/*! For license information please see bundle.js.LICENSE.txt */ !function(){var e={328:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return El}});var n=i(908),r=i.n(n),a=i(144),s=i.n(a);function o(){return o=Object.assign||function(e){for(var t=1;t-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(C),D=String.fromCharCode(9),L=function(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},R=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n},O=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}c(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,i){var n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((function(e){for(var r=0;r0&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=a},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:x(e.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,d=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange),n&&(i.key=n)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||h,e.attributes?(s.attributes||(s.attributes={}),o(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||h,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(u={default:/yes/i.test(e.attributes.DEFAULT)}).default?u.autoselect=!0:u.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(u.language=e.attributes.LANGUAGE),e.attributes.URI&&(u.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(u.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(u.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(u.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=u}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){d+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),s.dateTimeString=e.dateTimeString,s.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,N.call(this,this.manifest))},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data},skip:function(){this.manifest.skip=M(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part:function(){var t=this;l=!0;var i=this.manifest.segments.length,n=M(e.attributes);s.parts=s.parts||[],s.parts.push(n),n.byterange&&(n.byterange.hasOwnProperty("offset")||(n.byterange.offset=f),f=n.byterange.offset+n.byterange.length);var r=s.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+r+" for segment #"+i,e.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((function(e,i){e.hasOwnProperty("lastPart")||t.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+i+" lacks required attribute(s): LAST-PART"})}))},"server-control":function(){var t=this.manifest.serverControl=M(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),N.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var t=this.manifest.segments.length,i=M(e.attributes),n=i.type&&"PART"===i.type;s.preloadHints=s.preloadHints||[],s.preloadHints.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=n?f:0,n&&(f=i.byterange.offset+i.byterange.length)));var r=s.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t,e.attributes,["TYPE","URI"]),i.type)for(var a=0;af&&(f=y);var b=void 0;if(_<0){var T=m+1;b=T===t.length?"dynamic"===i&&r>0&&s.indexOf("$Number$")>0?ge(e,f,v):(o*l-f)/v:(t[T].t-f)/v}else b=_+1;for(var w=h+p.length+b,S=h+p.length;S=r?a:""+new Array(r-a.length+1).join("0")+a)}}(t))},be=function(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,a=ie({baseUrl:e.baseUrl,source:ye(r.sourceURL,i),range:r.range}),s=function(e,t){return e.duration||t?e.duration?ae(e):ve(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}(e,t);return s.map((function(t){i.Number=t.number,i.Time=t.time;var n=ye(e.media||"",i),r=e.timescale||1,s=e.presentationTimeOffset||0,o=e.periodStart+(t.time-s)/r;return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:E(e.baseUrl||"",n),map:a,number:t.number,presentationTime:o}}))},Te=function(e,t){var i=e.duration,n=e.segmentUrls,r=void 0===n?[]:n,a=e.periodStart;if(!i&&!t||i&&t)throw new Error("SEGMENT_TIME_UNSPECIFIED");var s,o=r.map((function(t){return function(e,t){var i=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,a=ie({baseUrl:i,source:r.sourceURL,range:r.range}),s=ie({baseUrl:i,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)}));return i&&(s=ae(e)),t&&(s=ve(e,t)),s.map((function(t,i){if(o[i]){var n=o[i],r=e.timescale||1,s=e.presentationTimeOffset||0;return n.timeline=t.timeline,n.duration=t.duration,n.number=t.number,n.presentationTime=a+(t.time-s)/r,n}})).filter((function(e){return e}))},we=function(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=be,t=Z(n,r.template)):r.base?(i=se,t=Z(n,r.base)):r.list&&(i=Te,t=Z(n,r.list));var a={attributes:n};if(!i)return a;var s=i(t,r.segmentTimeline);if(t.duration){var o=t,u=o.duration,l=o.timescale,c=void 0===l?1:l;t.duration=u/c}else s.length?t.duration=s.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0;return a.attributes=t,a.segments=s,r.base&&t.indexRange&&(a.sidx=s[0],a.segments=[]),a},Se=function(e,t){return te(e.childNodes).filter((function(e){return e.tagName===t}))},Ee=function(e){return e.textContent.trim()},Ce=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],u=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)},xe={mediaPresentationDuration:function(e){return Ce(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return Ce(e)},suggestedPresentationDelay:function(e){return Ce(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return Ce(e)},start:function(e){return Ce(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?Ce(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},ke=function(e){return e&&e.attributes?te(e.attributes).reduce((function(e,t){var i=xe[t.name]||xe.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}},Ie={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},Ae=function(e,t){return t.length?ee(e.map((function(e){return t.map((function(t){return E(e,Ee(t))}))}))):e},Pe=function(e){var t=Se(e,"SegmentTemplate")[0],i=Se(e,"SegmentList")[0],n=i&&Se(i,"SegmentURL").map((function(e){return Z({tag:"SegmentURL"},ke(e))})),r=Se(e,"SegmentBase")[0],a=i||t,s=a&&Se(a,"SegmentTimeline")[0],o=i||r||t,u=o&&Se(o,"Initialization")[0],l=t&&ke(t);l&&u?l.initialization=u&&ke(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,segmentTimeline:s&&Se(s,"S").map((function(e){return ke(e)})),list:i&&Z(ke(i),{segmentUrls:n,initialization:ke(u)}),base:r&&Z(ke(r),{initialization:ke(u)})};return Object.keys(c).forEach((function(e){c[e]||delete c[e]})),c},De=function(e,t){return function(i,n){var a=Ae(t,Se(i.node,"BaseURL")),s=parseInt(i.attributes.id,10),o=r().isNaN(s)?n:s,u=Z(e,{periodIndex:o,periodStart:i.attributes.start});"number"==typeof i.attributes.duration&&(u.periodDuration=i.attributes.duration);var l=Se(i.node,"AdaptationSet"),c=Pe(i.node);return ee(l.map(function(e,t,i){return function(n){var r,a=ke(n),s=Ae(t,Se(n,"BaseURL")),o=Se(n,"Role")[0],u={role:ke(o)},l=Z(e,a,u),c=Se(n,"Accessibility")[0],h="urn:scte:dash:cc:cea-608:2015"===(r=ke(c)).schemeIdUri?("string"!=typeof r.value?[]:r.value.split(";")).map((function(e){var t,i;if(i=e,/^CC\d=/.test(e)){var n=e.split("=");t=n[0],i=n[1]}else/^CC\d$/.test(e)&&(t=e);return{channel:t,language:i}})):"urn:scte:dash:cc:cea-708:2015"===r.schemeIdUri?("string"!=typeof r.value?[]:r.value.split(";")).map((function(e){var t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){var i=e.split("="),n=i[0],r=i[1],a=void 0===r?"":r;t.channel=n,t.language=e,a.split(",").forEach((function(e){var i=e.split(":"),n=i[0],r=i[1];"lang"===n?t.language=r:"er"===n?t.easyReader=Number(r):"war"===n?t.aspectRatio=Number(r):"3D"===n&&(t["3D"]=Number(r))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0;h&&(l=Z(l,{captionServices:h}));var d=Se(n,"Label")[0];if(d&&d.childNodes.length){var p=d.childNodes[0].nodeValue.trim();l=Z(l,{label:p})}var f=Se(n,"ContentProtection").reduce((function(e,t){var i=ke(t),n=Ie[i.schemeIdUri];if(n){e[n]={attributes:i};var r=Se(t,"cenc:pssh")[0];if(r){var a=Ee(r),s=a&&x(a);e[n].pssh=s}}return e}),{});Object.keys(f).length&&(l=Z(l,{contentProtection:f}));var m=Pe(n),g=Se(n,"Representation"),v=Z(i,m);return ee(g.map(function(e,t,i){return function(n){var r=Se(n,"BaseURL"),a=Ae(t,r),s=Z(e,ke(n)),o=Pe(n);return a.map((function(e){return{segmentInfo:Z(i,o),attributes:Z(s,{baseUrl:e})}}))}}(l,s,v)))}}(u,a,c)))}},Le=function(e){if(""===e)throw new Error("DASH_EMPTY_MANIFEST");var t,i,n=new $.DOMParser;try{i=(t=n.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error("DASH_INVALID_XML");return i},Re=function(e,t){void 0===t&&(t={});var i=function(e,t){void 0===t&&(t={});var i=t,n=i.manifestUri,r=void 0===n?"":n,a=i.NOW,s=void 0===a?Date.now():a,o=i.clientOffset,u=void 0===o?0:o,l=Se(e,"Period");if(!l.length)throw new Error("INVALID_NUMBER_OF_PERIOD");var c=Se(e,"Location"),h=ke(e),d=Ae([r],Se(e,"BaseURL"));h.type=h.type||"static",h.sourceDuration=h.mediaPresentationDuration||0,h.NOW=s,h.clientOffset=u,c.length&&(h.locations=c.map(Ee));var p=[];return l.forEach((function(e,t){var i=ke(e),n=p[t-1];i.start=function(e){var t=e.attributes,i=e.priorPeriodAttributes,n=e.mpdType;return"number"==typeof t.start?t.start:i&&"number"==typeof i.start&&"number"==typeof i.duration?i.start+i.duration:i||"static"!==n?null:0}({attributes:i,priorPeriodAttributes:n?n.attributes:null,mpdType:h.type}),p.push({node:e,attributes:i})})),{locations:h.locations,representationInfo:ee(p.map(De(h,d)))}}(Le(e),t);return function(e,t,i){var n;if(void 0===i&&(i={}),!e.length)return{};var r=e[0].attributes,a=r.sourceDuration,s=r.type,o=r.suggestedPresentationDelay,u=r.minimumUpdatePeriod,l=le(e.filter(pe)).map(de),c=le(e.filter(fe)),h=e.filter(me),d=e.map((function(e){return e.attributes.captionServices})).filter(Boolean),p={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(n={AUDIO:{},VIDEO:{}},n["CLOSED-CAPTIONS"]={},n.SUBTITLES={},n),uri:"",duration:a,playlists:he(l,i)};u>=0&&(p.minimumUpdatePeriod=1e3*u),t&&(p.locations=t),"dynamic"===s&&(p.suggestedPresentationDelay=o);var f=0===p.playlists.length;return c.length&&(p.mediaGroups.AUDIO.audio=function(e,t,i){var n;void 0===t&&(t={}),void 0===i&&(i=!1);var r=e.reduce((function(e,r){var a=r.attributes.role&&r.attributes.role.value||"",s=r.attributes.lang||"",o=r.attributes.label||"main";if(s&&!r.attributes.label){var u=a?" ("+a+")":"";o=""+r.attributes.lang+u}e[o]||(e[o]={language:s,autoselect:!0,default:"main"===a,playlists:[],uri:""});var l=ce(function(e,t){var i,n=e.attributes,r=e.segments,a=e.sidx,s={attributes:(i={NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},i["PROGRAM-ID"]=1,i),uri:"",endList:"static"===n.type,timeline:n.periodIndex,resolvedUri:"",targetDuration:n.duration,segments:r,mediaSequence:r.length?r[0].number:1};return n.contentProtection&&(s.contentProtection=n.contentProtection),a&&(s.sidx=a),t&&(s.attributes.AUDIO="audio",s.attributes.SUBTITLES="subs"),s}(r,i),t);return e[o].playlists.push(l),void 0===n&&"main"===a&&((n=r).default=!0),e}),{});return n||(r[Object.keys(r)[0]].default=!0),r}(c,i,f)),h.length&&(p.mediaGroups.SUBTITLES.subs=function(e,t){return void 0===t&&(t={}),e.reduce((function(e,i){var n=i.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),e[n].playlists.push(ce(function(e){var t,i=e.attributes,n=e.segments;void 0===n&&(n=[{uri:i.baseUrl,timeline:i.periodIndex,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);var r=((t={NAME:i.id,BANDWIDTH:i.bandwidth})["PROGRAM-ID"]=1,t);return i.codecs&&(r.CODECS=i.codecs),{attributes:r,uri:"",endList:"static"===i.type,timeline:i.periodIndex,resolvedUri:i.baseUrl||"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1}}(i),t)),e}),{})}(h,i)),d.length&&(p.mediaGroups["CLOSED-CAPTIONS"].cc=d.reduce((function(e,t){return t?(t.forEach((function(t){var i=t.channel,n=t.language;e[n]={autoselect:!1,default:!1,instreamId:i,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e):e}),{})),p}(i.representationInfo.map(we),i.locations,t.sidxMapping)},Oe=i(221),Me=i.n(Oe),Ne=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||(t=e,ArrayBuffer.isView(t))||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0));var t},Ue=r().BigInt||Number,Fe=[Ue("0x1"),Ue("0x100"),Ue("0x10000"),Ue("0x1000000"),Ue("0x100000000"),Ue("0x10000000000"),Ue("0x1000000000000"),Ue("0x100000000000000"),Ue("0x10000000000000000")],Be=(k=new Uint16Array([65484]),255===(I=new Uint8Array(k.buffer,k.byteOffset,k.byteLength))[0]||I[0],function(e,t){var i=void 0===t?{}:t,n=i.signed,r=void 0!==n&&n,a=i.le,s=void 0!==a&&a;e=Ne(e);var o=s?"reduce":"reduceRight",u=(e[o]?e[o]:Array.prototype[o]).call(e,(function(t,i,n){var r=s?n:Math.abs(n+1-e.length);return t+Ue(i)*Fe[r]}),Ue(0));if(r){var l=Fe[e.length]/Ue(2)-Ue(1);(u=Ue(u))>l&&(u-=l,u-=l,u-=Ue(2))}return Number(u)}),je=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n=t.length&&u.call(t,(function(t,i){return t===(o[i]?o[i]&e[a+i]:e[a+i])}))},Ve=Ne([73,68,51]),Ge=function e(t,i){return void 0===i&&(i=0),(t=Ne(t)).length-i<10||!He(t,Ve,{offset:i})?i:(i+=function(e,t){void 0===t&&(t=0);var i=(e=Ne(e))[t+5],n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?n+20:n+10}(t,i),e(t,i))},qe=(new Uint8Array([79,112,117,115,72,101,97,100]),function(e){return"string"==typeof e?je(e):e}),We=function(e){e=Ne(e);for(var t=[],i=0;e.length>i;){var n=e[i],r=0,a=0,s=e[++a];for(a++;128&s;)r=(127&s)<<7,s=e[a],a++;r+=127&s;for(var o=0;o>>0,o=t.subarray(a+4,a+8);if(0===s)break;var u=a+s;if(u>t.length){if(n)break;u=t.length}var l=t.subarray(a+8,u);He(o,i[0])&&(1===i.length?r.push(l):r.push.apply(r,e(l,i.slice(1),n))),a=u}return r},Ye={EBML:Ne([26,69,223,163]),DocType:Ne([66,130]),Segment:Ne([24,83,128,103]),SegmentInfo:Ne([21,73,169,102]),Tracks:Ne([22,84,174,107]),Track:Ne([174]),TrackNumber:Ne([215]),DefaultDuration:Ne([35,227,131]),TrackEntry:Ne([174]),TrackType:Ne([131]),FlagDefault:Ne([136]),CodecID:Ne([134]),CodecPrivate:Ne([99,162]),VideoTrack:Ne([224]),AudioTrack:Ne([225]),Cluster:Ne([31,67,182,117]),Timestamp:Ne([231]),TimestampScale:Ne([42,215,177]),BlockGroup:Ne([160]),BlockDuration:Ne([155]),Block:Ne([161]),SimpleBlock:Ne([163])},ze=[128,64,32,16,8,4,2,1],Ke=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var r=function(e){for(var t=1,i=0;i=i.length)return i.length;var r=Ke(i,n,!1);if(He(t.bytes,r.bytes))return n;var a=Ke(i,n+r.length);return e(t,i,n+a.length+a.value+r.length)},Je=function e(t,i){i=function(e){return Array.isArray(e)?e.map((function(e){return Qe(e)})):[Qe(e)]}(i),t=Ne(t);var n=[];if(!i.length)return n;for(var r=0;rt.length?t.length:o+s.value,l=t.subarray(o,u);He(i[0],a.bytes)&&(1===i.length?n.push(l):n=n.concat(e(l,i.slice(1)))),r+=a.length+s.length+l.length}return n},Ze=Ne([0,0,0,1]),et=Ne([0,0,1]),tt=Ne([0,0,3]),it=function(e){for(var t=[],i=1;i>1&63),-1!==i.indexOf(u)&&(r=a+o),a+=o+("h264"===t?1:2)}else a++}return e.subarray(0,0)},rt={webm:Ne([119,101,98,109]),matroska:Ne([109,97,116,114,111,115,107,97]),flac:Ne([102,76,97,67]),ogg:Ne([79,103,103,83]),ac3:Ne([11,119]),riff:Ne([82,73,70,70]),avi:Ne([65,86,73]),wav:Ne([87,65,86,69]),"3gp":Ne([102,116,121,112,51,103]),mp4:Ne([102,116,121,112]),fmp4:Ne([115,116,121,112]),mov:Ne([102,116,121,112,113,116]),moov:Ne([109,111,111,118]),moof:Ne([109,111,111,102])},at={aac:function(e){var t=Ge(e);return He(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Ge(e);return He(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Je(e,[Ye.EBML,Ye.DocType])[0];return He(t,rt.webm)},mkv:function(e){var t=Je(e,[Ye.EBML,Ye.DocType])[0];return He(t,rt.matroska)},mp4:function(e){return!at["3gp"](e)&&!at.mov(e)&&(!(!He(e,rt.mp4,{offset:4})&&!He(e,rt.fmp4,{offset:4}))||!(!He(e,rt.moof,{offset:4})&&!He(e,rt.moov,{offset:4}))||void 0)},mov:function(e){return He(e,rt.mov,{offset:4})},"3gp":function(e){return He(e,rt["3gp"],{offset:4})},ac3:function(e){var t=Ge(e);return He(e,rt.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+1880?u:0)}if(r().console){var l=r().console[i];l||"debug"!==i||(l=r().console.info||r().console.log),l&&s&&o.test(i)&&l[Array.isArray(a)?"apply":"call"](r().console,a)}}}(t,a),a.createLogger=function(i){return e(t+": "+i)},a.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},a.level=function(e){if("string"==typeof e){if(!a.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');n=e}return n},(a.history=function(){return bt?[].concat(bt):[]}).filter=function(e){return(bt||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},a.history.clear=function(){bt&&(bt.length=0)},a.history.disable=function(){null!==bt&&(bt.length=0,bt=null)},a.history.enable=function(){null===bt&&(bt=[])},a.error=function(){for(var e=arguments.length,t=new Array(e),r=0;r1?t-1:0),n=1;n=0)throw new Error("class has illegal whitespace characters")}function ii(){return s()===r().document}function ni(e){return kt(e)&&1===e.nodeType}function ri(){try{return r().parent!==r().self}catch(e){return!0}}function ai(e){return function(t,i){if(!ei(t))return s()[e](null);ei(i)&&(i=s().querySelector(i));var n=ni(i)?i:s();return n[e]&&n[e](t)}}function si(e,t,i,n){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={});var r=s().createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(Tt.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+i+"."),r.setAttribute(e,i)):"textContent"===e?oi(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),n&&xi(r,n),r}function oi(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function ui(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function li(e,t){return ti(t),e.classList?e.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(e.className);var i}function ci(e,t){return e.classList?e.classList.add(t):li(e,t)||(e.className=(e.className+" "+t).trim()),e}function hi(e,t){return e?(e.classList?e.classList.remove(t):(ti(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e):(Tt.warn("removeClass was called with an element that doesn't exist"),null)}function di(e,t,i){var n=li(e,t);if("function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=!n),i!==n)return i?ci(e,t):hi(e,t),e}function pi(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null==n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function fi(e){var t={};if(e&&e.attributes&&e.attributes.length>0)for(var i=e.attributes,n=i.length-1;n>=0;n--){var r=i[n].name,a=i[n].value;"boolean"!=typeof e[r]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+r+",")||(a=null!==a),t[r]=a}return t}function mi(e,t){return e.getAttribute(t)}function gi(e,t,i){e.setAttribute(t,i)}function vi(e,t){e.removeAttribute(t)}function _i(){s().body.focus(),s().onselectstart=function(){return!1}}function yi(){s().onselectstart=function(){return!0}}function bi(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((function(e){void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(At(e,"height"))),i.width||(i.width=parseFloat(At(e,"width"))),i}}function Ti(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,i=e.offsetHeight,n=0,r=0;e.offsetParent&&e!==s()[mt.fullscreenElement];)n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:n,top:r,width:t,height:i}}function wi(e,t){var i={x:0,y:0};if($t)for(var n=e;n&&"html"!==n.nodeName.toLowerCase();){var r=At(n,"transform");if(/^matrix/.test(r)){var a=r.slice(7,-1).split(/,\s/).map(Number);i.x+=a[4],i.y+=a[5]}else if(/^matrix3d/.test(r)){var s=r.slice(9,-1).split(/,\s/).map(Number);i.x+=s[12],i.y+=s[13]}n=n.parentNode}var o={},u=Ti(t.target),l=Ti(e),c=l.width,h=l.height,d=t.offsetY-(l.top-u.top),p=t.offsetX-(l.left-u.left);return t.changedTouches&&(p=t.changedTouches[0].pageX-l.left,d=t.changedTouches[0].pageY+l.top,$t&&(p-=i.x,d-=i.y)),o.y=1-Math.max(0,Math.min(1,d/h)),o.x=Math.max(0,Math.min(1,p/c)),o}function Si(e){return kt(e)&&3===e.nodeType}function Ei(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Ci(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return"function"==typeof e&&(e=e()),ni(e)||Si(e)?e:"string"==typeof e&&/\S/.test(e)?s().createTextNode(e):void 0})).filter((function(e){return e}))}function xi(e,t){return Ci(t).forEach((function(t){return e.appendChild(t)})),e}function ki(e,t){return xi(Ei(e),t)}function Ii(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}var Ai,Pi=ai("querySelector"),Di=ai("querySelectorAll"),Li=Object.freeze({__proto__:null,isReal:ii,isEl:ni,isInFrame:ri,createEl:si,textContent:oi,prependTo:ui,hasClass:li,addClass:ci,removeClass:hi,toggleClass:di,setAttributes:pi,getAttributes:fi,getAttribute:mi,setAttribute:gi,removeAttribute:vi,blockTextSelection:_i,unblockTextSelection:yi,getBoundingClientRect:bi,findPosition:Ti,getPointerPosition:wi,isTextNode:Si,emptyEl:Ei,normalizeContent:Ci,appendContent:xi,insertContent:ki,isSingleLeftClick:Ii,$:Pi,$$:Di}),Ri=!1,Oi=function(){if(!1!==Ai.options.autoSetup){var e=Array.prototype.slice.call(s().getElementsByTagName("video")),t=Array.prototype.slice.call(s().getElementsByTagName("audio")),i=Array.prototype.slice.call(s().getElementsByTagName("video-js")),n=e.concat(t,i);if(n&&n.length>0)for(var r=0,a=n.length;r-1&&(a={passive:!0}),e.addEventListener(t,n.dispatcher,a)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function Ki(e,t,i){if(Gi.has(e)){var n=Gi.get(e);if(n.handlers){if(Array.isArray(t))return Wi(Ki,e,t,i);var r=function(e,t){n.handlers[t]=[],qi(e,t)};if(void 0!==t){var a=n.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s=t&&(e.apply(void 0,arguments),i=n)}},an=function(){};an.prototype.allowedEvents_={},an.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},zi(this,e,t),this.addEventListener=i},an.prototype.addEventListener=an.prototype.on,an.prototype.off=function(e,t){Ki(this,e,t)},an.prototype.removeEventListener=an.prototype.off,an.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},$i(this,e,t),this.addEventListener=i},an.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Ji(this,e,t),this.addEventListener=i},an.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=Xi(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Qi(this,e)},an.prototype.dispatchEvent=an.prototype.trigger,an.prototype.queueTrigger=function(e){var t=this;Zi||(Zi=new Map);var i=e.type||e,n=Zi.get(this);n||(n=new Map,Zi.set(this,n));var a=n.get(i);n.delete(i),r().clearTimeout(a);var s=r().setTimeout((function(){0===n.size&&(n=null,Zi.delete(t)),t.trigger(e)}),0);n.set(i,s)};var sn=function(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e},on=function(e){return e instanceof an||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"==typeof e[t]}))},un=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},ln=function(e,t,i){if(!e||!e.nodeName&&!on(e))throw new Error("Invalid target for "+sn(t)+"#"+i+"; must be a DOM node or evented object.")},cn=function(e,t,i){if(!un(e))throw new Error("Invalid event type for "+sn(t)+"#"+i+"; must be a non-empty string or array.")},hn=function(e,t,i){if("function"!=typeof e)throw new Error("Invalid listener for "+sn(t)+"#"+i+"; must be a function.")},dn=function(e,t,i){var n,r,a,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return s?(n=e.eventBusEl_,t.length>=3&&t.shift(),r=t[0],a=t[1]):(n=t[0],r=t[1],a=t[2]),ln(n,e,i),cn(r,e,i),hn(a,e,i),{isTargetingSelf:s,target:n,type:r,listener:a=nn(e,a)}},pn=function(e,t,i,n){ln(e,e,t),e.nodeName?en[t](e,i,n):e[t](i,n)},fn={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),this.el_=null),this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(e){return e?(this.options_=bn(this.options_,e),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(e,t,i){return si(e,t,i)},t.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],s=n&&n.split("-")[0],o=r&&r[s],u=i;return a&&a[e]?u=a[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,(function(e,i){var n=t[i-1],r=n;return void 0===n&&(r=e),r}))),u},t.handleLanguagechange=function(){},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(e){return this.childIndex_[e]},t.getChild=function(e){if(e)return this.childNameIndex_[e]},t.getDescendant=function(){for(var e=arguments.length,t=new Array(e),i=0;i=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[yn(e.name())]=null,this.childNameIndex_[_n(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},t.initChildren=function(){var t=this,i=this.options_.children;if(i){var n,r=this.options_,a=e.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((function(e){var n,r;return"string"==typeof e?r=i[n=e]||t.options_[n]||{}:(n=e.name,r=e),{name:n,opts:r}})).filter((function(t){var i=e.getComponent(t.opts.componentClass||yn(t.name));return i&&!a.isTech(i)})).forEach((function(e){var i=e.name,n=e.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=t.options_.playerOptions;var a=t.addChild(i,n);a&&(t[i]=a)}}))}},t.buildCSSClass=function(){return""},t.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout((function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)},t.$=function(e,t){return Pi(e,t||this.contentEl())},t.$$=function(e,t){return Di(e,t||this.contentEl())},t.hasClass=function(e){return li(this.el_,e)},t.addClass=function(e){ci(this.el_,e)},t.removeClass=function(e){hi(this.el_,e)},t.toggleClass=function(e,t){di(this.el_,e,t)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(e){return mi(this.el_,e)},t.setAttribute=function(e,t){gi(this.el_,e,t)},t.removeAttribute=function(e){vi(this.el_,e)},t.width=function(e,t){return this.dimension("width",e,t)},t.height=function(e,t){return this.dimension("height",e,t)},t.dimensions=function(e,t){this.width(e,!0),this.height(t)},t.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+yn(e)],10)},t.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=At(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+yn(e);t=this.el_[i]}return t},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(e){this.player_&&this.player_.handleKeyDown(e)},t.handleKeyPress=function(e){this.handleKeyDown(e)},t.emitTapEvents=function(){var e,t=0,i=null;this.on("touchstart",(function(n){1===n.touches.length&&(i={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=r().performance.now(),e=!0)})),this.on("touchmove",(function(t){if(t.touches.length>1)e=!1;else if(i){var n=t.touches[0].pageX-i.pageX,r=t.touches[0].pageY-i.pageY;Math.sqrt(n*n+r*r)>10&&(e=!1)}}));var n=function(){e=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(n){i=null,!0===e&&r().performance.now()-t<200&&(n.preventDefault(),this.trigger("tap"))}))},t.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=nn(this.player(),this.player().reportUserActivity);this.on("touchstart",(function(){t(),this.clearInterval(e),e=this.setInterval(t,250)}));var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},t.setTimeout=function(e,t){var i,n=this;return e=nn(this,e),this.clearTimersOnDispose_(),i=r().setTimeout((function(){n.setTimeoutIds_.has(i)&&n.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i},t.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),r().clearTimeout(e)),e},t.setInterval=function(e,t){e=nn(this,e),this.clearTimersOnDispose_();var i=r().setInterval(e,t);return this.setIntervalIds_.add(i),i},t.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),r().clearInterval(e)),e},t.requestAnimationFrame=function(e){var t,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=nn(this,e),t=r().requestAnimationFrame((function(){i.rafIds_.has(t)&&i.rafIds_.delete(t),e()})),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},t.requestNamedAnimationFrame=function(e,t){var i=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=nn(this,t);var n=this.requestAnimationFrame((function(){t(),i.namedRafs_.has(e)&&i.namedRafs_.delete(e)}));return this.namedRafs_.set(e,n),e}},t.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},t.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),r().cancelAnimationFrame(e)),e):this.clearTimeout(e)},t.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((function(t){var i=t[0],n=t[1];e[i].forEach((function(t,i){return e[n](i)}))})),e.clearingTimersOnDispose_=!1})))},e.registerComponent=function(t,i){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var n=e.getComponent("Tech"),r=n&&n.isTech(i),a=e===i||e.prototype.isPrototypeOf(i.prototype);if(r||!a)throw new Error('Illegal component, "'+t+'"; '+(r?"techs must be registered using Tech.registerTech()":"must be a Component subclass")+".");t=yn(t),e.components_||(e.components_={});var s=e.getComponent("Player");if("Player"===t&&s&&s.players){var o=s.players,u=Object.keys(o);if(o&&u.length>0&&u.map((function(e){return o[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=i,e.components_[_n(t)]=i,i},e.getComponent=function(t){if(t&&e.components_)return e.components_[t]},e}();function xn(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function kn(e){var t;return t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:xn.bind(null,"start",0,e),end:xn.bind(null,"end",1,e)},r().Symbol&&r().Symbol.iterator&&(t[r().Symbol.iterator]=function(){return(e||[]).values()}),t}function In(e,t){return Array.isArray(e)?kn(e):void 0===e||void 0===t?kn():kn([[e,t]])}function An(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=In(0,0));for(var a=0;at&&(n=t),r+=n-i;return r/t}function Pn(e){if(e instanceof Pn)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:kt(e)&&("number"==typeof e.code&&(this.code=e.code),xt(this,e)),this.message||(this.message=Pn.defaultMessages[this.code]||"")}Cn.prototype.supportsRaf_="function"==typeof r().requestAnimationFrame&&"function"==typeof r().cancelAnimationFrame,Cn.registerComponent("Component",Cn),Pn.prototype.code=0,Pn.prototype.message="",Pn.prototype.status=null,Pn.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],Pn.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var Dn=0;Dn=0;n--)if(t[n].enabled){Fn(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}c(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&Fn(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,Fn(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(Nn),jn=function(e,t){for(var i=0;i=0;n--)if(t[n].selected){jn(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(u(i),"selectedIndex",{get:function(){for(var e=0;e0&&(r().console&&r().console.groupCollapsed&&r().console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach((function(e){return Tt.error(e)})),r().console&&r().console.groupEnd&&r().console.groupEnd()),i.flush()},ir=function(e,t){var i={uri:e},n=Zn(e);n&&(i.cors=n);var a="use-credentials"===t.tech_.crossOrigin();a&&(i.withCredentials=a),g()(i,nn(this,(function(e,i,n){if(e)return Tt.error(e,i);t.loaded_=!0,"function"!=typeof r().WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(function(e){if("vttjserror"!==e.type)return tr(n,t);Tt.error("vttjs failed to load, stopping trying to process "+t.src)})):tr(n,t)})))},nr=function(e){function t(t){var i;if(void 0===t&&(t={}),!t.tech)throw new Error("A tech was not provided.");var n=bn(t,{kind:Yn[t.kind]||"subtitles",language:t.language||t.srclang||""}),r=zn[n.mode]||"disabled",a=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=e.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var s=new qn(i.cues_),o=new qn(i.activeCues_),l=!1,c=nn(u(i),(function(){this.tech_.isReady_&&!this.tech_.isDisposed()&&(this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1))}));return i.tech_.one("dispose",(function(){i.tech_.off("timeupdate",c)})),"disabled"!==r&&i.tech_.on("timeupdate",c),Object.defineProperties(u(i),{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){zn[e]&&r!==e&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||ir(this.src,this),this.tech_.off("timeupdate",c),"disabled"!==r&&this.tech_.on("timeupdate",c),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(l=!1,t.length!==this.activeCues_.length)l=!0;else for(var a=0;a0)return void this.trigger("vttjsloaded");var t=s().createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=function(){e.trigger("vttjsloaded")},t.onerror=function(){e.trigger("vttjserror")},this.on("dispose",(function(){t.onload=null,t.onerror=null})),r().WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)},i.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e=0;r--){var a=e[r];a[t]&&a[t](n,i)}}(e,i,o,s),o}var gr={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},vr={setCurrentTime:1,setMuted:1,setVolume:1},_r={play:1,pause:1};function yr(e){return function(t,i){return t===pr?pr:i[e]?i[e](t):t}}function br(e,t,i,n,r,a){void 0===e&&(e={}),void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a=!1);var s=t,o=s[0],u=s.slice(1);if("string"==typeof o)br(e,hr[o],i,n,r,a);else if(o){var l=function(e,t){var i=dr[e.id()],n=null;if(null==i)return n=t(e),dr[e.id()]=[[t,n]],n;for(var r=0;r0;!this.player_.tech(!0)||(Wt||Vt)&&t||this.player_.tech(!0).focus(),this.player_.paused()?Rn(this.player_.play()):this.player_.pause()}},t}(xr);Cn.registerComponent("PosterImage",kr);var Ir={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Ar(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Pr(e,t,i){try{e.style[t]=i}catch(e){return}}var Dr=function(e){function t(t,i,n){var a;a=e.call(this,t,i,n)||this;var s=function(e){return a.updateDisplay(e)};return t.on("loadstart",(function(e){return a.toggleDisplay(e)})),t.on("texttrackchange",s),t.on("loadedmetadata",(function(e){return a.preselectTrack(e)})),t.ready(nn(u(a),(function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",s),t.on("playerresize",s),r().addEventListener("orientationchange",s),t.on("dispose",(function(){return r().removeEventListener("orientationchange",s)}));for(var e=this.options_.playerOptions.tracks||[],i=0;i0;return Rn(t),void(!this.player_.tech(!0)||(Wt||Vt)&&i||this.player_.tech(!0).focus())}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(r){var a=function(){return r.focus()};Ln(t)?t.then(a,(function(){})):this.setTimeout(a,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(Rr);Or.prototype.controlText_="Play Video",Cn.registerComponent("BigPlayButton",Or);var Mr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){f().isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(Rr);Cn.registerComponent("CloseButton",Mr);var Nr=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",(function(e){return n.handlePlay(e)})),n.on(t,"pause",(function(e){return n.handlePause(e)})),i.replay&&n.on(t,"ended",(function(e){return n.handleEnded(e)})),n}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?Rn(this.player_.play()):this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(function(e){return t.handleSeeked(e)}))},t}(Rr);Nr.prototype.controlText_="Play",Cn.registerComponent("PlayToggle",Nr);var Ur=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=i="-"),(r=r>0||s>0?r+":":"")+(n=((r||a>=10)&&n<10?"0"+n:n)+":")+(i<10?"0"+i:i)},Fr=Ur;function Br(e,t){return void 0===t&&(t=e),Fr(e,t)}var jr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["timeupdate","ended"],(function(e){return n.updateContent(e)})),n.updateTextNode_(),n}c(t,e);var i=t.prototype;return i.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control"}),n=si("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return i.appendChild(n),this.contentEl_=si("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},i.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},i.updateTextNode_=function(e){var t=this;void 0===e&&(e=0),e=Br(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(function(){if(t.contentEl_){var e=t.textNode_;e&&t.contentEl_.firstChild!==e&&(e=null,Tt.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),t.textNode_=s().createTextNode(t.formattedTime_),t.textNode_&&(e?t.contentEl_.replaceChild(t.textNode_,e):t.contentEl_.appendChild(t.textNode_))}})))},i.updateContent=function(e){},t}(Cn);jr.prototype.labelText_="Time",jr.prototype.controlText_="Time",Cn.registerComponent("TimeDisplay",jr);var Hr=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)},t}(jr);Hr.prototype.labelText_="Current Time",Hr.prototype.controlText_="Current Time",Cn.registerComponent("CurrentTimeDisplay",Hr);var Vr=function(e){function t(t,i){var n,r=function(e){return n.updateContent(e)};return(n=e.call(this,t,i)||this).on(t,"durationchange",r),n.on(t,"loadstart",r),n.on(t,"loadedmetadata",r),n}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(jr);Vr.prototype.labelText_="Duration",Vr.prototype.controlText_="Duration",Cn.registerComponent("DurationDisplay",Vr);var Gr=function(e){function t(){return e.apply(this,arguments)||this}return c(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=e.prototype.createEl.call(this,"div"),n=e.prototype.createEl.call(this,"span",{textContent:"/"});return i.appendChild(n),t.appendChild(i),t},t}(Cn);Cn.registerComponent("TimeDivider",Gr);var qr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",(function(e){return n.updateContent(e)})),n}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return t.insertBefore(si("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},t}(jr);qr.prototype.labelText_="Remaining Time",qr.prototype.controlText_="Remaining Time",Cn.registerComponent("RemainingTimeDisplay",qr);var Wr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",(function(e){return n.updateShowing(e)})),n}c(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=si("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(si("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(s().createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(Cn);Cn.registerComponent("LiveDisplay",Wr);var Xr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&(n.updateLiveEdgeStatusHandler_=function(e){return n.updateLiveEdgeStatus(e)},n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatusHandler_)),n}c(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=si("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,e.prototype.dispose.call(this)},t}(Rr);Xr.prototype.controlText_="Seek to live, currently playing live",Cn.registerComponent("SeekToLive",Xr);var Yr=function(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))},zr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseDown_=function(e){return n.handleMouseDown(e)},n.handleMouseUp_=function(e){return n.handleMouseUp(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleMouseMove_=function(e){return n.handleMouseMove(e)},n.update_=function(e){return n.update(e)},n.bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}c(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=xt({tabIndex:0},i),n=xt({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Gt||e.preventDefault(),_i(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;yi(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.update()},i.update=function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",(function(){var i=e.vertical()?"height":"width";e.bar.el().style[i]=(100*t).toFixed(2)+"%"}))),t}},i.getProgress=function(){return Number(Yr(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var t=wi(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){f().isEventKey(t,"Left")||f().isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):f().isEventKey(t,"Right")||f().isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(Cn);Cn.registerComponent("Slider",zr);var Kr=function(e,t){return Yr(e/t*100,0,100).toFixed(2)+"%"},Qr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",(function(e){return n.update(e)})),n}c(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),i=si("span",{className:"vjs-control-text"}),n=si("span",{textContent:this.localize("Loaded")}),r=s().createTextNode(": ");return this.percentageEl_=si("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),t},i.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",(function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),a=t.partEls_,s=Kr(r,n);t.percent_!==s&&(t.el_.style.width=s,oi(t.percentageEl_,s),t.percent_=s);for(var o=0;oi.length;h--)t.el_.removeChild(a[h-1]);a.length=i.length}))},t}(Cn);Cn.registerComponent("LoadProgressBar",Qr);var $r=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=rn(nn(u(n),n.update),tn),n}c(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=Ti(this.el_),r=bi(this.player_.el()),a=e.width*t;if(r&&n){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right),u=n.width/2;sn.width&&(u=n.width),u=Math.round(u),this.el_.style.right="-"+u+"px",this.write(i)}},i.write=function(e){oi(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",(function(){var a,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),u=o-t*o;a=(u<1?"":"-")+Br(u,o)}else a=Br(i,s);r.update(e,t,a),n&&n()}))},t}(Cn);Cn.registerComponent("TimeTooltip",$r);var Jr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=rn(nn(u(n),n.update),tn),n}c(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(Cn);Jr.prototype.options_={children:[]},$t||Ft||Jr.prototype.options_.children.push("timeTooltip"),Cn.registerComponent("PlayProgressBar",Jr);var Zr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=rn(nn(u(n),n.update),tn),n}c(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,(function(){i.el_.style.left=e.width*t+"px"}))},t}(Cn);Zr.prototype.options_={children:["timeTooltip"]},Cn.registerComponent("MouseTimeDisplay",Zr);var ea=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}c(t,e);var i=t.prototype;return i.setEventHandlers_=function(){var e=this;this.update_=nn(this,this.update),this.update=rn(this.update_,tn),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in s()&&"visibilityState"in s()&&this.on(s(),"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(e){"hidden"===s().visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,tn))},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(t){var i=this;if("hidden"!==s().visibilityState){var n=e.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",(function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,r=i.player_.duration();t&&t.isLive()&&(r=i.player_.liveTracker.liveCurrentTime()),i.percent_!==n&&(i.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),i.percent_=n),i.currentTime_===e&&i.duration_===r||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[Br(e,r),Br(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(bi(i.el()),i.getProgress())})),n}},i.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},i.handleMouseDown=function(t){Ii(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},i.handleMouseMove=function(e){if(Ii(e)){var t,i=this.calculateDistance(e),n=this.player_.liveTracker;if(n&&n.isLive()){if(i>=.99)return void n.seekToLiveEdge();var r=n.seekableStart(),a=n.liveCurrentTime();if((t=r+i*n.liveWindow())>=a&&(t=a),t<=r&&(t=r+.1),t===1/0)return}else(t=i*this.player_.duration())===this.player_.duration()&&(t-=.1);this.userSeek_(t)}},i.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Rn(this.player_.play()):this.update_()},i.stepForward=function(){this.userSeek_(this.player_.currentTime()+5)},i.stepBack=function(){this.userSeek_(this.player_.currentTime()-5)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(t){var i=this.player_.liveTracker;if(f().isEventKey(t,"Space")||f().isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(f().isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if(f().isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(f()(t))){t.preventDefault(),t.stopPropagation();var n=10*(f().codes[f()(t)]-f().codes[0])/100;i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else f().isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):f().isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in s()&&"visibilityState"in s()&&this.off(s(),"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},t}(zr);ea.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},$t||Ft||ea.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Cn.registerComponent("SeekBar",ea);var ta=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=rn(nn(u(n),n.handleMouseMove),tn),n.throttledHandleMouseSeek=rn(nn(u(n),n.handleMouseSeek),tn),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.handleMouseDownHandler_=function(e){return n.handleMouseDown(e)},n.enable(),n}c(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(i||n){var r=t.el(),a=Ti(r),s=wi(r,e).x;s=Yr(s,0,1),n&&n.update(a,s),i&&i.update(a,t.getProgress())}}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){if(this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Rn(this.player_.play())}},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.removeListenersAddedOnMousedownAndTouchstart=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},t}(Cn);ta.prototype.options_={children:["seekBar"]},Cn.registerComponent("ProgressControl",ta);var ia=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["enterpictureinpicture","leavepictureinpicture"],(function(e){return n.handlePictureInPictureChange(e)})),n.on(t,["disablepictureinpicturechanged","loadedmetadata"],(function(e){return n.handlePictureInPictureEnabledChange(e)})),n.disable(),n}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},i.handlePictureInPictureEnabledChange=function(){s().pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}(Rr);ia.prototype.controlText_="Picture-in-Picture",Cn.registerComponent("PictureInPictureToggle",ia);var na=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"fullscreenchange",(function(e){return n.handleFullscreenChange(e)})),!1===s()[t.fsApi_.fullscreenEnabled]&&n.disable(),n}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(Rr);na.prototype.controlText_="Fullscreen",Cn.registerComponent("FullscreenToggle",na);var ra=function(e){function t(){return e.apply(this,arguments)||this}return c(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return t.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),t},t}(Cn);Cn.registerComponent("VolumeLevel",ra);var aa=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=rn(nn(u(n),n.update),tn),n}c(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i,n){if(!i){var r=bi(this.el_),a=bi(this.player_.el()),s=e.width*t;if(!a||!r)return;var o=e.left-a.left+s,u=e.width-s+(a.right-e.right),l=r.width/2;or.width&&(l=r.width),this.el_.style.right="-"+l+"px"}this.write(n+"%")},i.write=function(e){oi(this.el_,e)},i.updateVolume=function(e,t,i,n,r){var a=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(function(){a.update(e,t,i,n.toFixed(0)),r&&r()}))},t}(Cn);Cn.registerComponent("VolumeLevelTooltip",aa);var sa=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=rn(nn(u(n),n.update),tn),n}c(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t,i){var n=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,(function(){i?n.el_.style.bottom=e.height*t+"px":n.el_.style.left=e.width*t+"px"}))},t}(Cn);sa.prototype.options_={children:["volumeLevelTooltip"]},Cn.registerComponent("MouseVolumeLevelDisplay",sa);var oa=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",(function(e){return n.updateLastVolume_(e)})),n.on(t,"volumechange",(function(e){return n.updateARIAAttributes(e)})),t.ready((function(){return n.updateARIAAttributes()})),n}c(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){Ii(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){var t=this.getChild("mouseVolumeLevelDisplay");if(t){var i=this.el(),n=bi(i),r=this.vertical(),a=wi(i,e);a=r?a.y:a.x,a=Yr(a,0,1),t.update(n,a,r)}Ii(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",(function(){0===e.player_.volume()&&e.player_.lastVolume_(t)}))},t}(zr);oa.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},$t||Ft||oa.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),oa.prototype.playerEvent="volumechange",Cn.registerComponent("VolumeBar",oa);var ua=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,(void 0===i.volumeBar||It(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(u(n=e.call(this,t,i)||this),t),n.throttledHandleMouseMove=rn(nn(u(n),n.handleMouseMove),tn),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n.on("touchstart",(function(e){return n.handleMouseDown(e)})),n.on("mousemove",(function(e){return n.handleMouseMove(e)})),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}c(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(Cn);ua.prototype.options_={children:["volumeBar"]},Cn.registerComponent("VolumeControl",ua);var la=function(e){function t(t,i){var n;return function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(u(n=e.call(this,t,i)||this),t),n.on(t,["loadstart","volumechange"],(function(e){return n.update(e)})),n}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;$t&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)hi(this.el_,"vjs-vol-"+i);ci(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(Rr);la.prototype.controlText_="Mute",Cn.registerComponent("MuteToggle",la);var ca=function(e){function t(t,i){var n;return void 0===i&&(i={}),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||It(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).handleKeyPressHandler_=function(e){return n.handleKeyPress(e)},n.on(t,["loadstart"],(function(e){return n.volumePanelState_(e)})),n.on(n.muteToggle,"keyup",(function(e){return n.handleKeyPress(e)})),n.on(n.volumeControl,"keyup",(function(e){return n.handleVolumeControlKeyUp(e)})),n.on("keydown",(function(e){return n.handleKeyPress(e)})),n.on("mouseover",(function(e){return n.handleMouseOver(e)})),n.on("mouseout",(function(e){return n.handleMouseOut(e)})),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}c(t,e);var i=t.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},i.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},i.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){f().isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),zi(s(),"keyup",this.handleKeyPressHandler_)},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),Ki(s(),"keyup",this.handleKeyPressHandler_)},i.handleKeyPress=function(e){f().isEventKey(e,"Esc")&&this.handleMouseOut()},t}(Cn);ca.prototype.options_={children:["muteToggle","volumeControl"]},Cn.registerComponent("VolumePanel",ca);var ha=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",(function(e){return n.handleKeyDown(e)})),n.boundHandleBlur_=function(e){return n.handleBlur(e)},n.boundHandleTapClick_=function(e){return n.handleTapClick(e)},n}c(t,e);var i=t.prototype;return i.addEventListenerForItem=function(e){e instanceof Cn&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof Cn&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},i.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},i.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=si(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),zi(i,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),i},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},i.handleBlur=function(e){var t=e.relatedTarget||s().activeElement;if(!this.children().some((function(e){return e.el()===t}))){var i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}},i.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter((function(t){return t.el()===e.target}))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},i.handleKeyDown=function(e){f().isEventKey(e,"Left")||f().isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(f().isEventKey(e,"Right")||f().isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},i.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},i.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},t}(Cn);Cn.registerComponent("Menu",ha);var da=function(e){function t(t,i){var n;void 0===i&&(i={}),(n=e.call(this,t,i)||this).menuButton_=new Rr(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=Rr.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0;var a=function(e){return n.handleClick(e)};return n.handleMenuKeyUp_=function(e){return n.handleMenuKeyUp(e)},n.on(n.menuButton_,"tap",a),n.on(n.menuButton_,"click",a),n.on(n.menuButton_,"keydown",(function(e){return n.handleKeyDown(e)})),n.on(n.menuButton_,"mouseenter",(function(){n.addClass("vjs-hover"),n.menu.show(),zi(s(),"keyup",n.handleMenuKeyUp_)})),n.on("mouseleave",(function(e){return n.handleMouseLeave(e)})),n.on("keydown",(function(e){return n.handleSubmenuKeyDown(e)})),n}c(t,e);var i=t.prototype;return i.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},i.createMenu=function(){var e=new ha(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=si("li",{className:"vjs-menu-title",textContent:yn(this.options_.title),tabIndex:-1}),i=new Cn(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n-1&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n-1&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(ga);Cn.registerComponent("OffTextTrackMenuItem",va);var _a=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return c(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=ga),this.label_&&(i=this.label_+" off"),e.push(new va(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r-1){var s=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+a.kind+"-menu-item"),e.push(s)}}return e},t}(pa);Cn.registerComponent("TextTrackButton",_a);var ya=function(e){function t(t,i){var n,r=i.track,a=i.cue,s=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=a.text,i.selected=a.startTime<=s&&s=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(yn(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i-1&&(n.label_="captions"),n.menuButton_.controlText(yn(n.label_)),n}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Sa(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t,Ca)},t}(_a);xa.prototype.kinds_=["captions","subtitles"],xa.prototype.controlText_="Subtitles",Cn.registerComponent("SubsCapsButton",xa);var ka=function(e){function t(t,i){var n,r=i.track,a=t.audioTracks();i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=new Array(e),i=0;i=0;i--)t.push(new Aa(this.player(),{rate:e[i]+"x"}));return t},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){for(var t=this.player().playbackRate(),i=this.playbackRates(),n=i[0],r=0;rt){n=i[r];break}this.player().playbackRate(n)},i.handlePlaybackRateschange=function(e){this.update()},i.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},t}(da);Pa.prototype.controlText_="Playback Rate",Cn.registerComponent("PlaybackRateMenuButton",Pa);var Da=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(t,i,n){return void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i.className||(i.className=this.buildCSSClass()),e.prototype.createEl.call(this,t,i,n)},t}(Cn);Cn.registerComponent("Spacer",Da);var La=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:" "})},t}(Da);Cn.registerComponent("CustomControlSpacer",La);var Ra=function(e){function t(){return e.apply(this,arguments)||this}return c(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(Cn);Ra.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in s()&&Ra.prototype.options_.children.splice(Ra.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Cn.registerComponent("ControlBar",Ra);var Oa=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",(function(e){return n.open(e)})),n}c(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(Mn);Oa.prototype.options_=o({},Mn.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Cn.registerComponent("ErrorDisplay",Oa);var Ma="vjs-text-track-settings",Na=["#000","Black"],Ua=["#00F","Blue"],Fa=["#0FF","Cyan"],Ba=["#0F0","Green"],ja=["#F0F","Magenta"],Ha=["#F00","Red"],Va=["#FFF","White"],Ga=["#FF0","Yellow"],qa=["1","Opaque"],Wa=["0.5","Semi-Transparent"],Xa=["0","Transparent"],Ya={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Na,Va,Ha,Ba,Ua,Ga,ja,Fa]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[qa,Wa,Xa]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Va,Na,Ha,Ba,Ua,Ga,ja,Fa]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[qa,Wa]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[Xa,Wa,qa]}};function za(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}Ya.windowColor.options=Ya.backgroundColor.options;var Ka=function(e){function t(t,i){var n;return i.temporary=!1,(n=e.call(this,t,i)||this).updateDisplay=n.updateDisplay.bind(u(n)),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=si("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")}),n.el().appendChild(n.endDialog),n.setDefaults(),void 0===i.persistTextTrackSettings&&(n.options_.persistTextTrackSettings=n.options_.playerOptions.persistTextTrackSettings),n.on(n.$(".vjs-done-button"),"click",(function(){n.saveSettings(),n.close()})),n.on(n.$(".vjs-default-button"),"click",(function(){n.setDefaults(),n.updateDisplay()})),Ct(Ya,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}c(t,e);var i=t.prototype;return i.dispose=function(){this.endDialog=null,e.prototype.dispose.call(this)},i.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=Ya[e],a=r.id.replace("%s",this.id_),s=[t,a].join(" ").trim();return["<"+i+' id="'+a+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"",'").join("")},i.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['
','',this.localize("Text"),"",this.createElSelect_("color",e),'',this.createElSelect_("textOpacity",e),"","
"].join("")},i.createElBgColor_=function(){var e="captions-background-"+this.id_;return['
','',this.localize("Background"),"",this.createElSelect_("backgroundColor",e),'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")},i.createElWinColor_=function(){var e="captions-window-"+this.id_;return['
','',this.localize("Window"),"",this.createElSelect_("windowColor",e),'',this.createElSelect_("windowOpacity",e),"","
"].join("")},i.createElColors_=function(){return si("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return si("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})},i.createElControls_=function(){var e=this.localize("restore all settings to the default values");return si("div",{className:"vjs-track-settings-controls",innerHTML:['",'"].join("")})},i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.label=function(){return this.localize("Caption Settings Dialog")},i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.buildCSSClass=function(){return e.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e,t,i,n=this;return t=function(e,t,i){var r,a,s=(r=n.$(t.selector),a=t.parser,za(r.options[r.options.selectedIndex].value,a));return void 0!==s&&(e[i]=s),e},void 0===(i={})&&(i=0),Et(e=Ya).reduce((function(i,n){return t(i,e[n],n)}),i)},i.setValues=function(e){var t=this;Ct(Ya,(function(i,n){!function(e,t,i){if(t)for(var n=0;nthis.options_.liveTolerance;this.timeupdateSeen_&&n!==1/0||(s=!1),s!==this.behindLiveEdge_&&(this.behindLiveEdge_=s,this.trigger("liveedgechange"))}},i.handleDurationchange=function(){this.toggleTracking()},i.toggleTracking=function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},i.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,tn),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))},i.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},i.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},i.reset_=function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)},i.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},i.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},i.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return"number"==typeof this.trackingInterval_},i.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},i.dispose=function(){this.off(s(),"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),e.prototype.dispose.call(this)},t}(Cn);Cn.registerComponent("LiveTracker",Ja);var Za,es=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var a=0;a=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready((function(){r.forEach((function(e){this.trigger(e)}),this)}))}},i.setScrubbing=function(e){this.isScrubbing_=e},i.scrubbing=function(){return this.isScrubbing_},i.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&Jt?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){Tt(e,"Video is not ready. (Video.js)")}},i.duration=function(){var e=this;return this.el_.duration===1/0&&Ft&&Gt&&0===this.el_.currentTime?(this.on("timeupdate",(function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))})),NaN):this.el_.duration||NaN},i.width=function(){return this.el_.offsetWidth},i.height=function(){return this.el_.offsetHeight},i.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",(function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)}))}},i.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var e=r().navigator&&r().navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},i.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Rn(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}),0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},i.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},i.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},i.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},i.reset=function(){t.resetMediaElement(this.el_)},i.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.setControls=function(e){this.el_.controls=!!e},i.addTextTrack=function(t,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,n):e.prototype.addTextTrack.call(this,t,i,n)},i.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return e.prototype.createRemoteTextTrack.call(this,t);var i=s().createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i},i.addRemoteTextTrack=function(t,i){var n=e.prototype.addRemoteTextTrack.call(this,t,i);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},i.removeRemoteTextTrack=function(t){if(e.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),n=i.length;n--;)t!==i[n]&&t!==i[n].track||this.el().removeChild(i[n])},i.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),r().performance&&"function"==typeof r().performance.now?e.creationTime=r().performance.now():r().performance&&r().performance.timing&&"number"==typeof r().performance.timing.navigationStart&&(e.creationTime=r().Date.now()-r().performance.timing.navigationStart),e},t}(cr);as(ss,"TEST_VID",(function(){if(ii()){var e=s().createElement("video"),t=s().createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}})),ss.isSupported=function(){try{ss.TEST_VID.volume=.5}catch(e){return!1}return!(!ss.TEST_VID||!ss.TEST_VID.canPlayType)},ss.canPlayType=function(e){return ss.TEST_VID.canPlayType(e)},ss.canPlaySource=function(e,t){return ss.canPlayType(e.type)},ss.canControlVolume=function(){try{var e=ss.TEST_VID.volume;return ss.TEST_VID.volume=e/2+.1,e!==ss.TEST_VID.volume}catch(e){return!1}},ss.canMuteVolume=function(){try{var e=ss.TEST_VID.muted;return ss.TEST_VID.muted=!e,ss.TEST_VID.muted?gi(ss.TEST_VID,"muted","muted"):vi(ss.TEST_VID,"muted"),e!==ss.TEST_VID.muted}catch(e){return!1}},ss.canControlPlaybackRate=function(){if(Ft&&Gt&&qt<58)return!1;try{var e=ss.TEST_VID.playbackRate;return ss.TEST_VID.playbackRate=e/2+.1,e!==ss.TEST_VID.playbackRate}catch(e){return!1}},ss.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(s().createElement("video"),"src",{get:e,set:e}),Object.defineProperty(s().createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(s().createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(s().createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},ss.supportsNativeTextTracks=function(){return Jt||$t&&Gt},ss.supportsNativeVideoTracks=function(){return!(!ss.TEST_VID||!ss.TEST_VID.videoTracks)},ss.supportsNativeAudioTracks=function(){return!(!ss.TEST_VID||!ss.TEST_VID.audioTracks)},ss.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresVolumeControl","canControlVolume"],["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function(e){var t=e[0],i=e[1];as(ss.prototype,t,(function(){return ss[i]()}),!0)})),ss.prototype.movingMediaElementInDOM=!$t,ss.prototype.featuresFullscreenResize=!0,ss.prototype.featuresProgressEvents=!0,ss.prototype.featuresTimeupdateEvents=!0,ss.patchCanPlayType=function(){Bt>=4&&!Ht&&!Gt&&(Za=ss.TEST_VID&&ss.TEST_VID.constructor.prototype.canPlayType,ss.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":Za.call(this,e)})},ss.unpatchCanPlayType=function(){var e=ss.TEST_VID.constructor.prototype.canPlayType;return Za&&(ss.TEST_VID.constructor.prototype.canPlayType=Za),e},ss.patchCanPlayType(),ss.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},ss.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){ss.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){ss.prototype["set"+yn(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){ss.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){ss.prototype["set"+yn(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){ss.prototype[e]=function(){return this.el_[e]()}})),cr.withSourceHandlers(ss),ss.nativeSourceHandler={},ss.nativeSourceHandler.canPlayType=function(e){try{return ss.TEST_VID.canPlayType(e)}catch(e){return""}},ss.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return ss.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=Jn(e.src);return ss.nativeSourceHandler.canPlayType("video/"+i)}return""},ss.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},ss.nativeSourceHandler.dispose=function(){},ss.registerSourceHandler(ss.nativeSourceHandler),cr.registerTech("Html5",ss);var os=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],us={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},ls=["tiny","xsmall","small","medium","large","xlarge","huge"],cs={};ls.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;cs[e]="vjs-layout-"+t}));var hs={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},ds=function(e){function t(i,n,r){var a;if(i.id=i.id||n.id||"vjs_video_"+Hi(),(n=xt(t.getTagSettings(i),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language)if("function"==typeof i.closest){var o=i.closest("[lang]");o&&o.getAttribute&&(n.language=o.getAttribute("lang"))}else for(var l=i;l&&1===l.nodeType;){if(fi(l).hasOwnProperty("lang")){n.language=l.getAttribute("lang");break}l=l.parentNode}if((a=e.call(this,null,n,r)||this).boundDocumentFullscreenChange_=function(e){return a.documentFullscreenChange_(e)},a.boundFullWindowOnEscKey_=function(e){return a.fullWindowOnEscKey(e)},a.boundUpdateStyleEl_=function(e){return a.updateStyleEl_(e)},a.boundApplyInitTime_=function(e){return a.applyInitTime_(e)},a.boundUpdateCurrentBreakpoint_=function(e){return a.updateCurrentBreakpoint_(e)},a.boundHandleTechClick_=function(e){return a.handleTechClick_(e)},a.boundHandleTechDoubleClick_=function(e){return a.handleTechDoubleClick_(e)},a.boundHandleTechTouchStart_=function(e){return a.handleTechTouchStart_(e)},a.boundHandleTechTouchMove_=function(e){return a.handleTechTouchMove_(e)},a.boundHandleTechTouchEnd_=function(e){return a.handleTechTouchEnd_(e)},a.boundHandleTechTap_=function(e){return a.handleTechTap_(e)},a.isFullscreen_=!1,a.log=wt(a.id_),a.fsApi_=mt,a.isPosterFromTech_=!1,a.queuedCallbacks_=[],a.isReady_=!1,a.hasStarted_=!1,a.userActive_=!1,a.debugEnabled_=!1,!a.options_||!a.options_.techOrder||!a.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(a.tag=i,a.tagAttributes=i&&fi(i),a.language(a.options_.language),n.languages){var c={};Object.getOwnPropertyNames(n.languages).forEach((function(e){c[e.toLowerCase()]=n.languages[e]})),a.languages_=c}else a.languages_=t.prototype.options_.languages;a.resetCache_(),a.poster_=n.poster||"",a.controls_=!!n.controls,i.controls=!1,i.removeAttribute("controls"),a.changingSrc_=!1,a.playCallbacks_=[],a.playTerminatedQueue_=[],i.hasAttribute("autoplay")?a.autoplay(!0):a.autoplay(a.options_.autoplay),n.plugins&&Object.keys(n.plugins).forEach((function(e){if("function"!=typeof a[e])throw new Error('plugin "'+e+'" does not exist')})),a.scrubbing_=!1,a.el_=a.createEl(),mn(u(a),{eventBusKey:"el_"}),a.fsApi_.requestFullscreen&&(zi(s(),a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_),a.on(a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_)),a.fluid_&&a.on(["playerreset","resize"],a.boundUpdateStyleEl_);var h=bn(a.options_);n.plugins&&Object.keys(n.plugins).forEach((function(e){a[e](n.plugins[e])})),n.debug&&a.debug(!0),a.options_.playerOptions=h,a.middleware_=[],a.playbackRates(n.playbackRates),a.initChildren(),a.isAudio("audio"===i.nodeName.toLowerCase()),a.controls()?a.addClass("vjs-controls-enabled"):a.addClass("vjs-controls-disabled"),a.el_.setAttribute("role","region"),a.isAudio()?a.el_.setAttribute("aria-label",a.localize("Audio Player")):a.el_.setAttribute("aria-label",a.localize("Video Player")),a.isAudio()&&a.addClass("vjs-audio"),a.flexNotSupported_()&&a.addClass("vjs-no-flex"),zt&&a.addClass("vjs-touch-enabled"),$t||a.addClass("vjs-workinghover"),t.players[a.id_]=u(a);var d=ht.split(".")[0];return a.addClass("vjs-v"+d),a.userActive(!0),a.reportUserActivity(),a.one("play",(function(e){return a.listenForUserActivity_(e)})),a.on("stageclick",(function(e){return a.handleStageClick_(e)})),a.on("keydown",(function(e){return a.handleKeyDown(e)})),a.on("languagechange",(function(e){return a.handleLanguagechange(e)})),a.breakpoints(a.options_.breakpoints),a.responsive(a.options_.responsive),a}c(t,e);var i=t.prototype;return i.dispose=function(){var i=this;this.trigger("dispose"),this.off("dispose"),Ki(s(),this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Ki(s(),"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),t.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),dr[this.id()]=null,lr.names.forEach((function(e){var t=lr[e],n=i[t.getterName]();n&&n.off&&n.off()})),e.prototype.dispose.call(this)},i.createEl=function(){var t,i=this.tag,n=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),a="video-js"===this.tag.tagName.toLowerCase();n?t=this.el_=i.parentNode:a||(t=this.el_=e.prototype.createEl.call(this,"div"));var o=fi(i);if(a){for(t=this.el_=i,i=this.tag=s().createElement("video");t.children.length;)i.appendChild(t.firstChild);li(t,"video-js")||ci(t,"video-js"),t.appendChild(i),n=this.playerElIngest_=t,Object.keys(t).forEach((function(e){try{i[e]=t[e]}catch(e){}}))}if(i.setAttribute("tabindex","-1"),o.tabindex="-1",(Wt||Gt&&Yt)&&(i.setAttribute("role","application"),o.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in o&&delete o.width,"height"in o&&delete o.height,Object.getOwnPropertyNames(o).forEach((function(e){a&&"class"===e||t.setAttribute(e,o[e]),a&&i.setAttribute(e,o[e])})),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=t.player=this,this.addClass("vjs-paused"),!0!==r().VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=Fi("vjs-styles-dimensions");var u=Pi(".vjs-styles-defaults"),l=Pi("head");l.insertBefore(this.styleEl_,u?u.nextSibling:l.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);for(var c=i.getElementsByTagName("a"),h=0;h0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),a=n[1]/n[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/a:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*a,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),Bi(this.styleEl_,"\n ."+i+" {\n width: "+e+"px;\n height: "+t+"px;\n }\n\n ."+i+".vjs-fluid {\n padding-top: "+100*a+"%;\n }\n ")}else{var s="number"==typeof this.width_?this.width_:this.options_.width,o="number"==typeof this.height_?this.height_:this.options_.height,u=this.tech_&&this.tech_.el();u&&(s>=0&&(u.width=s),o>=0&&(u.height=o))}},i.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=yn(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(cr.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(a=!1);var s={source:t,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset,Promise:this.options_.Promise};lr.names.forEach((function(e){var t=lr[e];s[t.getterName]=i[t.privateName]})),xt(s,this.options_[n]),xt(s,this.options_[r]),xt(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var o,u,l=cr.getTech(e);if(!l)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new l(s),this.tech_.ready(nn(this,this.handleTechReady_),!0),o=this.textTracksJson_||[],u=this.tech_,o.forEach((function(e){var t=u.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((function(e){return t.addCue(e)}))})),u.textTracks(),os.forEach((function(e){i.on(i.tech_,e,(function(t){return i["handleTech"+yn(e)+"_"](t)}))})),Object.keys(us).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+us[e]+"_"].bind(i),event:t}):i["handleTech"+us[e]+"_"](t)}))})),this.on(this.tech_,"loadstart",(function(e){return i.handleTechLoadStart_(e)})),this.on(this.tech_,"sourceset",(function(e){return i.handleTechSourceset_(e)})),this.on(this.tech_,"waiting",(function(e){return i.handleTechWaiting_(e)})),this.on(this.tech_,"ended",(function(e){return i.handleTechEnded_(e)})),this.on(this.tech_,"seeking",(function(e){return i.handleTechSeeking_(e)})),this.on(this.tech_,"play",(function(e){return i.handleTechPlay_(e)})),this.on(this.tech_,"firstplay",(function(e){return i.handleTechFirstPlay_(e)})),this.on(this.tech_,"pause",(function(e){return i.handleTechPause_(e)})),this.on(this.tech_,"durationchange",(function(e){return i.handleTechDurationChange_(e)})),this.on(this.tech_,"fullscreenchange",(function(e,t){return i.handleTechFullscreenChange_(e,t)})),this.on(this.tech_,"fullscreenerror",(function(e,t){return i.handleTechFullscreenError_(e,t)})),this.on(this.tech_,"enterpictureinpicture",(function(e){return i.handleTechEnterPictureInPicture_(e)})),this.on(this.tech_,"leavepictureinpicture",(function(e){return i.handleTechLeavePictureInPicture_(e)})),this.on(this.tech_,"error",(function(e){return i.handleTechError_(e)})),this.on(this.tech_,"posterchange",(function(e){return i.handleTechPosterChange_(e)})),this.on(this.tech_,"textdata",(function(e){return i.handleTechTextData_(e)})),this.on(this.tech_,"ratechange",(function(e){return i.handleTechRateChange_(e)})),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||ui(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},i.unloadTech_=function(){var e,t,i,n=this;lr.names.forEach((function(e){var t=lr[e];n[t.privateName]=n[t.getterName]()})),this.textTracksJson_=(e=this.tech_,t=e.$$("track"),i=Array.prototype.map.call(t,(function(e){return e.track})),Array.prototype.map.call(t,(function(e){var t=On(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(e){return-1===i.indexOf(e)})).map(On))),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},i.tech=function(e){return void 0===e&&Tt.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},i.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)},i.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)},i.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},i.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())},i.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var i,n=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var n=t.play();if(Ln(n))return n.catch((function(e){throw i(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))}))};if("any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():n():Ln(i=this.play())&&(i=i.catch(n)),Ln(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(){t.trigger({type:"autoplay-failure",autoplay:e})}))}},i.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((function(e){return e.src===t}));if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((function(e){return e.callback(e.event)})),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},i.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",(function i(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))}))},i.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},i.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},i.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},i.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},i.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},i.handleTechFirstPlay_=function(){this.options_.starttime&&(Tt.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},i.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},i.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},i.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},i.handleTechClick_=function(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?Rn(this.play()):this.pause()))},i.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(function(t){return t.contains(e.target)}))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},i.handleTechTap_=function(){this.userActive(!this.userActive())},i.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},i.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},i.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},i.handleStageClick_=function(){this.reportUserActivity()},i.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},i.documentFullscreenChange_=function(e){var t=e.target.player;if(!t||t===this){var i=this.el(),n=s()[this.fsApi_.fullscreenElement]===i;!n&&i.matches?n=i.matches(":"+this.fsApi_.fullscreen):!n&&i.msMatchesSelector&&(n=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}},i.handleTechFullscreenChange_=function(e,t){t&&(t.nativeIOSFullscreen&&this.toggleClass("vjs-ios-native-fs"),this.isFullscreen(t.isFullscreen))},i.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},i.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},i.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},i.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},i.handleTechError_=function(){var e=this.tech_.error();this.error(e)},i.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},i.getCache=function(){return this.cache_},i.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}},i.techCall_=function(e,t){this.ready((function(){if(e in vr)return function(e,t,i,n){return t[i](e.reduce(yr(i),n))}(this.middleware_,this.tech_,e,t);if(e in _r)return mr(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw Tt(e),e}}),!0)},i.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in gr)return function(e,t,i){return e.reduceRight(yr(i),t[i]())}(this.middleware_,this.tech_,e);if(e in _r)return mr(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw Tt("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw Tt("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw Tt(t),t}}},i.play=function(){var e=this,t=this.options_.Promise||r().Promise;return t?new t((function(t){e.play_(t)})):this.play_()},i.play_=function(e){var t=this;void 0===e&&(e=Rn),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!Jt&&!$t||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},i.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},i.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},i.pause=function(){this.techCall_("pause")},i.paused=function(){return!1!==this.techGet_("paused")},i.played=function(){return this.techGet_("played")||In(0,0)},i.scrubbing=function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},i.currentTime=function(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},i.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},i.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},i.remainingTime=function(){return this.duration()-this.currentTime()},i.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},i.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=In(0,0)),e},i.bufferedPercent=function(){return An(this.buffered(),this.duration())},i.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},i.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},i.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},i.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},i.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},i.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},i.isFullscreen=function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_},i.requestFullscreen=function(e){var t=this.options_.Promise||r().Promise;if(t){var i=this;return new t((function(t,n){function r(){i.off("fullscreenerror",s),i.off("fullscreenchange",a)}function a(){r(),t()}function s(e,t){r(),n(t)}i.one("fullscreenchange",a),i.one("fullscreenerror",s);var o=i.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(t,n))}))}return this.requestFullscreenHelper_()},i.requestFullscreenHelper_=function(e){var t,i=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then((function(){return i.isFullscreen(!0)}),(function(){return i.isFullscreen(!1)})),n}this.tech_.supportsFullScreen()&&1==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},i.exitFullscreen=function(){var e=this.options_.Promise||r().Promise;if(e){var t=this;return new e((function(e,i){function n(){t.off("fullscreenerror",a),t.off("fullscreenchange",r)}function r(){n(),e()}function a(e,t){n(),i(t)}t.one("fullscreenchange",r),t.one("fullscreenerror",a);var s=t.exitFullscreenHelper_();s&&(s.then(n,n),s.then(e,i))}))}return this.exitFullscreenHelper_()},i.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=s()[this.fsApi_.exitFullscreen]();return t&&Rn(t.then((function(){return e.isFullscreen(!1)}))),t}this.tech_.supportsFullScreen()&&1==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},i.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=s().documentElement.style.overflow,zi(s(),"keydown",this.boundFullWindowOnEscKey_),s().documentElement.style.overflow="hidden",ci(s().body,"vjs-full-window"),this.trigger("enterFullWindow")},i.fullWindowOnEscKey=function(e){f().isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},i.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,Ki(s(),"keydown",this.boundFullWindowOnEscKey_),s().documentElement.style.overflow=this.docOrigOverflow,hi(s().body,"vjs-full-window"),this.trigger("exitFullWindow")},i.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},i.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},i.requestPictureInPicture=function(){if("pictureInPictureEnabled"in s()&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},i.exitPictureInPicture=function(){if("pictureInPictureEnabled"in s())return s().exitPictureInPicture()},i.handleKeyDown=function(e){var t,i,n=this.options_.userActions;n&&n.hotkeys&&(t=this.el_.ownerDocument.activeElement,i=t.tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof n.hotkeys?n.hotkeys.call(this,e):this.handleHotkeys(e)))},i.handleHotkeys=function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},i=t.fullscreenKey,n=void 0===i?function(e){return f().isEventKey(e,"f")}:i,r=t.muteKey,a=void 0===r?function(e){return f().isEventKey(e,"m")}:r,o=t.playPauseKey,u=void 0===o?function(e){return f().isEventKey(e,"k")||f().isEventKey(e,"Space")}:o;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();var l=Cn.getComponent("FullscreenToggle");!1!==s()[this.fsApi_.fullscreenEnabled]&&l.prototype.handleClick.call(this,e)}else a.call(this,e)?(e.preventDefault(),e.stopPropagation(),Cn.getComponent("MuteToggle").prototype.handleClick.call(this,e)):u.call(this,e)&&(e.preventDefault(),e.stopPropagation(),Cn.getComponent("PlayToggle").prototype.handleClick.call(this,e))},i.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i1?i.handleSrc_(n.slice(1)):(i.changingSrc_=!1,i.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0),void i.triggerReady());a=r,s=i.tech_,a.forEach((function(e){return e.setTech&&e.setTech(s)}))})),this.options_.retryOnError&&n.length>1){var r=function(){i.error(null),i.handleSrc_(n.slice(1),!0)},a=function(){i.off("error",r)};this.one("error",r),this.one("playing",a),this.resetRetryOnError_=function(){i.off("error",r),i.off("playing",a)}}}else this.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0)},i.src=function(e){return this.handleSrc_(e,!1)},i.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,yn(t)!==yn(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready((function(){n.changingSrc_=!1})),!1):(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1))},i.load=function(){this.techCall_("load")},i.reset=function(){var e=this,t=this.options_.Promise||r().Promise;this.paused()||!t?this.doReset_():Rn(this.play().then((function(){return e.doReset_()})))},i.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),on(this)&&this.trigger("playerreset")},i.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},i.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar,t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},i.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},i.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},i.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},i.currentSource=function(){return this.cache_.source||{}},i.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},i.currentType=function(){return this.currentSource()&&this.currentSource().type||""},i.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},i.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},i.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},i.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},i.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},i.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},i.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},i.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},i.error=function(e){var t=this;if(void 0===e)return this.error_||null;if(pt("beforeerror").forEach((function(i){var n=i(t,e);kt(n)&&!Array.isArray(n)||"string"==typeof n||"number"==typeof n||null===n?e=n:t.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){var i=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),void this.one("loadstart",(function(){this.off(["click","touchstart"],i)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new Pn(e),this.addClass("vjs-error"),Tt.error("(CODE:"+this.error_.code+" "+Pn.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),pt("error").forEach((function(e){return e(t,t.error_)}))},i.reportUserActivity=function(e){this.userActivity_=!0},i.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},i.listenForUserActivity_=function(){var e,t,i,n=nn(this,this.reportUserActivity),r=function(t){n(),this.clearInterval(e)};this.on("mousedown",(function(){n(),this.clearInterval(e),e=this.setInterval(n,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())})),this.on("mouseup",r),this.on("mouseleave",r);var a,s=this.getChild("controlBar");!s||$t||Ft||(s.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),s.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",n),this.on("keyup",n),this.setInterval((function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var e=this.options_.inactivityTimeout;e<=0||(a=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}}),250)},i.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},i.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},i.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},i.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},i.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},i.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},i.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},i.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},i.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},i.language=function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),on(this)&&this.trigger("languagechange"))},i.languages=function(){return bn(t.prototype.options_.languages,this.languages_)},i.toJSON=function(){var e=bn(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i"):function(){}},As=1/30,Ps=.1,Ds=function(e,t){var i,n=[];if(e&&e.length)for(i=0;i=t}))},Rs=function(e,t){return Ds(e,(function(e){return e-As>=t}))},Os=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i "+e.end(i));return t.join(", ")},Ms=function(e){for(var t=[],i=0;ia||(i+=t>r&&t<=a?a-t:a-r)}return i},Fs=Ss.createTimeRange,Bs=function(e,t){if(!t.preload)return t.duration;var i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},js=function(e){return(e.segments||[]).reduce((function(e,t,i){return t.parts?t.parts.forEach((function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e}),[])},Hs=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},Vs=function(e){var t=e.preloadSegment;if(t){var i=t.parts;return(t.preloadHints||[]).reduce((function(e,t){return e+("PART"===t.type?1:0)}),0)+(i&&i.length?i.length:0)}},Gs=function(e,t){if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;var i=Hs(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},qs=function(e,t,i){if(void 0===t&&(t=e.mediaSequence+e.segments.length),tr){var s=[r,n];n=s[0],r=s[1]}if(n<0){for(var o=n;oDate.now()},Ks=function(e){return e.excludeUntil&&e.excludeUntil===1/0},Qs=function(e){var t=zs(e);return!e.disabled&&!t},$s=function(e,t){return t.attributes&&t.attributes[e]},Js=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((function(e){return!!Qs(e)&&(e.attributes.BANDWIDTH||0)0)for(var d=l-1;d>=0;d--){var p=u[d];if(o+=p.duration,s){if(o<0)continue}else if(o+As<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-Xs({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:d})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i}}if(l<0){for(var f=l;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i};l=0}for(var m=l;m0)continue}else if(o-As>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+Xs({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:m})}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:i}},isEnabled:Qs,isDisabled:function(e){return e.disabled},isBlacklisted:zs,isIncompatible:Ks,playlistEnd:Ys,isAes:function(e){for(var t=0;t-1&&o!==s.length-1&&(i._HLS_part=o),(o>-1||s.length)&&a--}i._HLS_msn=a}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){var u=new(r().URL)(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&u.searchParams.set(e,i[e])})),e=u.toString()}return e}(i,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(function(t,i){if(e.request)return t?e.playlistRequestError(e.request,e.media(),"HAVE_METADATA"):void e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})}))}},i.playlistRequestError=function(e,t,i){var n=t.uri,r=t.id;this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")},i.parseManifest_=function(e){var t=this,i=e.url;return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,s=e.customTagMappers,o=void 0===s?[]:s,u=e.experimentalLLHLS,l=new U;t&&l.on("warn",t),i&&l.on("info",i),a.forEach((function(e){return l.addParser(e)})),o.forEach((function(e){return l.addTagMapper(e)})),l.push(n),l.end();var c=l.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){c.hasOwnProperty(e)&&delete c[e]})),c.segments&&c.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!c.targetDuration){var h=10;c.segments&&c.segments.length&&(h=c.segments.reduce((function(e,t){return Math.max(e,t.duration)}),0)),t&&t("manifest has no targetDuration defaulting to "+h),c.targetDuration=h}var d=Hs(c);if(d.length&&!c.partTargetDuration){var p=d.reduce((function(e,t){return Math.max(e,t.duration)}),0);t&&(t("manifest has no partTargetDuration defaulting to "+p),no.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),c.partTargetDuration=p}return c}({onwarn:function(e){var n=e.message;return t.logger_("m3u8-parser warn for "+i+": "+n)},oninfo:function(e){var n=e.message;return t.logger_("m3u8-parser info for "+i+": "+n)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},i.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url,r=e.id;this.request=null,this.state="HAVE_METADATA";var a=i||this.parseManifest_({url:n,manifestString:t});a.lastRequest=Date.now(),so({playlist:a,uri:n,id:r});var s=mo(this.master,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,s?(this.master=s,this.media_=this.master.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(go(this.media(),!!s)),this.trigger("loadedplaylist")},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),r().clearTimeout(this.mediaUpdateTimeout),r().clearTimeout(this.finalRenditionTimeout),this.off()},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e,t){var i=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(r().clearTimeout(this.finalRenditionTimeout),t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=r().setTimeout(this.media.bind(this,e,!1),n)}else{var a=this.state,s=!this.media_||e.id!==this.media_.id,o=this.master.playlists[e.id];if(o&&o.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(s&&(this.trigger("mediachanging"),"HAVE_MASTER"===a?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(go(e,!0)),s){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){if(e.lastRequest=Date.now(),e.resolvedUri=ks(i.handleManifestRedirects,e.resolvedUri,n),t)return i.playlistRequestError(i.request,e,a);i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MASTER"===a?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}},i.pause=function(){this.mediaUpdateTimeout&&(r().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},i.load=function(e){var t=this;this.mediaUpdateTimeout&&(r().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var i=this.media();if(e){var n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=r().setTimeout((function(){t.mediaUpdateTimeout=null,t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},i.updateMediaUpdateTimeout_=function(e){var t=this;this.mediaUpdateTimeout&&(r().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=r().setTimeout((function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)}),e))},i.start=function(){var e=this;if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=r().location.href),this.src.resolvedUri=this.src.uri,void setTimeout((function(){e.setupInitialPlaylist(e.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.src=ks(e.handleManifestRedirects,e.src,i);var n=e.parseManifest_({manifestString:i.responseText,url:e.src});e.setupInitialPlaylist(n)}}))},i.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri},i.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,oo(this.master,this.srcUri()),e.playlists.forEach((function(e){e.segments=po(e),e.segments.forEach((function(t){ho(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t=this.srcUri()||r().location.href;this.master=function(e,t){var i=ro(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:r().location.href,resolvedUri:r().location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n}(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(lo),_o=Ss.xhr,yo=Ss.mergeOptions,bo=function(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),n(t,e)},To=function(){var e=function e(t,i){t=yo({timeout:45e3},t);var n=e.beforeRequest||Ss.Vhs.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var a=(!0===Ss.Vhs.xhr.original?_o:Ss.Vhs.xhr)(t,(function(e,t){return bo(a,e,t,i)})),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=t.uri,a.requestTime=Date.now(),a};return e.original=!0,e},wo=function(e){var t,i,n={};return e.byterange&&(n.Range=(i=(t=e.byterange).offset+t.length-1,"bytes="+t.offset+"-"+i)),n},So=function(e,t){return e.start(t)+"-"+e.end(t)},Eo=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Co=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},xo=function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},ko=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Io=function(e){return e.resolvedUri},Ao=function(e){for(var t=Array.prototype.slice.call(e),i=16,n="",r=0;rnew Date(o.getTime()+1e3*u)?null:(i>o&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:io.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(i,n);if(!h)return c({message:i+" was not found in the stream"});var d=h.segment,p=function(e,t){var i,n;try{i=new Date(e),n=new Date(t)}catch(e){}var r=i.getTime();return(n.getTime()-r)/1e3}(d.dateTimeObject,i);if("estimate"===h.type)return 0===a?c({message:i+" is not buffered yet. Try again"}):(s(h.estimatedStart+p),void l.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:a-1,seekTo:s,pauseAfterSeek:u,tech:l,callback:c})})));var f=d.start+p;l.one("seeked",(function(){return c(null,l.currentTime())})),u&&l.pause(),s(f)},Lo=function(e,t){if(4===e.readyState)return t()},Ro=Ss.EventTarget,Oo=Ss.mergeOptions,Mo=function(e,t){if(!fo(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(var i=0;i=c+l)return o(t,{response:a.subarray(l,l+c),status:i.status,uri:i.uri});n.request=n.vhs_.xhr({uri:s,responseType:"arraybuffer",headers:wo({byterange:e.sidx.byterange})},o)}))}else this.mediaRequest_=r().setTimeout((function(){return i(!1)}),0)},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},r().clearTimeout(this.minimumUpdatePeriodTimeout_),r().clearTimeout(this.mediaRequest_),r().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},i.hasPendingRequest=function(){return this.request||this.mediaRequest_},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=this.state;if("string"==typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})})))},i.haveMetadata=function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},i.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),r().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(r().clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},i.load=function(e){var t=this;r().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var i=this.media();if(e){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=r().setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},i.start=function(){var e=this;this.started=!0,this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_(),e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=r().setTimeout((function(){return e.haveMaster_()}),0)},i.requestMaster_=function(e){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(!t.requestErrored_(i,n)){var r=n.responseText!==t.masterPlaylistLoader_.masterXml_;return t.masterPlaylistLoader_.masterXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now(),t.masterPlaylistLoader_.srcUrl=ks(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n),r?(t.handleMaster_(),void t.syncClientServerClock_((function(){return e(n,r)}))):e(n,r)}"HAVE_NOTHING"===t.state&&(t.started=!1)}))},i.syncClientServerClock_=function(e){var t,i=this,n=(t=this.masterPlaylistLoader_.masterXml_,function(e){var t=Se(e,"UTCTiming")[0];if(!t)return null;var i=ke(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;default:throw new Error("UNSUPPORTED_UTC_TIMING_SCHEME")}return i}(Le(t)));return null===n?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===n.method?(this.masterPlaylistLoader_.clientOffset_=n.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:xs(this.masterPlaylistLoader_.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials},(function(t,r){if(i.request){if(t)return i.masterPlaylistLoader_.clientOffset_=i.masterLoaded_-Date.now(),e();var a;a="HEAD"===n.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):i.masterLoaded_:Date.parse(r.responseText),i.masterPlaylistLoader_.clientOffset_=a-Date.now(),e()}})))},i.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},i.handleMaster_=function(){this.mediaRequest_=null;var e,t,i,n=(e={masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_},i=Re(e.masterXml,{manifestUri:t=e.srcUrl,clientOffset:e.clientOffset,sidxMapping:e.sidxMapping}),oo(i,t),i),r=this.masterPlaylistLoader_.master;r&&(n=function(e,t,i){for(var n=!0,r=Oo(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),a=0;a-1)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},m=function(e){return t(w.hdlr,I[e])},f=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(w.mdhd,i)},p=function(e){return t(w.mdia,f(e),m(e.type),s(e))},a=function(e){return t(w.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},s=function(e){return t(w.minf,"video"===e.type?t(w.vmhd,A):t(w.smhd,P),i(),v(e))},o=function(e,i){for(var n=[],r=i.length;r--;)n[r]=y(i[r]);return t.apply(null,[w.moof,a(e)].concat(n))},u=function(e){for(var i=e.length,n=[];i--;)n[i]=h(e[i]);return t.apply(null,[w.moov,c(4294967295)].concat(n).concat(l(e)))},l=function(e){for(var i=e.length,n=[];i--;)n[i]=b(e[i]);return t.apply(null,[w.mvex].concat(n))},c=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t(w.mvhd,i)},g=function(e){var i,n,r=e.samples||[],a=new Uint8Array(4+r.length);for(n=0;n>>8),s.push(255&r[i].byteLength),s=s.concat(Array.prototype.slice.call(r[i]));for(i=0;i>>8),o.push(255&a[i].byteLength),o=o.concat(Array.prototype.slice.call(a[i]));if(n=[w.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(w.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),t(w.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1];n.push(t(w.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return t.apply(null,n)},U=function(e){return t(w.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),n(e))},d=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(w.tkhd,i)},y=function(e){var i,n,r,a,s,o;return i=t(w.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/(V+1)),o=Math.floor(e.baseMediaDecodeTime%(V+1)),n=t(w.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(r=T(e,92),t(w.traf,i,n,r)):(a=g(e),r=T(e,a.length+92),t(w.traf,i,n,r,a))},h=function(e){return e.duration=e.duration||4294967295,t(w.trak,d(e),p(e))},b=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(w.trex,i)},j=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},B=function(e,i){var n,r,a,s,o,u;for(i+=20+16*(s=e.samples||[]).length,a=j(s,i),(r=new Uint8Array(a.length+16*s.length)).set(a),n=a.length,u=0;u>>24,r[n++]=(16711680&o.duration)>>>16,r[n++]=(65280&o.duration)>>>8,r[n++]=255&o.duration,r[n++]=(4278190080&o.size)>>>24,r[n++]=(16711680&o.size)>>>16,r[n++]=(65280&o.size)>>>8,r[n++]=255&o.size,r[n++]=o.flags.isLeading<<2|o.flags.dependsOn,r[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[n++]=61440&o.flags.degradationPriority,r[n++]=15&o.flags.degradationPriority,r[n++]=(4278190080&o.compositionTimeOffset)>>>24,r[n++]=(16711680&o.compositionTimeOffset)>>>16,r[n++]=(65280&o.compositionTimeOffset)>>>8,r[n++]=255&o.compositionTimeOffset;return t(w.trun,r)},F=function(e,i){var n,r,a,s,o,u;for(i+=20+8*(s=e.samples||[]).length,a=j(s,i),(n=new Uint8Array(a.length+8*s.length)).set(a),r=a.length,u=0;u>>24,n[r++]=(16711680&o.duration)>>>16,n[r++]=(65280&o.duration)>>>8,n[r++]=255&o.duration,n[r++]=(4278190080&o.size)>>>24,n[r++]=(16711680&o.size)>>>16,n[r++]=(65280&o.size)>>>8,n[r++]=255&o.size;return t(w.trun,n)},T=function(e,t){return"audio"===e.type?F(e,t):B(e,t)},r=function(){return t(w.ftyp,S,E,S,C)};var G,q,W,X,Y,z,K,Q,$=function(e){return t(w.mdat,e)},J=o,Z=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ee=[33,16,5,32,164,27],te=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ie=function(e){for(var t=[];e--;)t.push(0);return t},ne=9e4;z=function(e,t){return q(Y(e,t))},K=function(e,t){return W(X(e),t)},Q=function(e,t,i){return X(i?e:e-t)};var re=ne,ae=q=function(e){return e*ne},se=(W=function(e,t){return e*t},X=function(e){return e/ne}),oe=(Y=function(e,t){return e/t},z),ue=K,le=Q,ce=function(e,t,i,n){var r,a,s,o,u,l=0,c=0,h=0;if(t.length&&(r=oe(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(re/(e.samplerate/1024)),i&&n&&(l=r-Math.max(i,n),h=(c=Math.floor(l/a))*a),!(c<1||h>45e3))){for((s=function(){if(!G){var e={96e3:[ee,[227,64],ie(154),[56]],88200:[ee,[231],ie(170),[56]],64e3:[ee,[248,192],ie(240),[56]],48e3:[ee,[255,192],ie(268),[55,148,128],ie(54),[112]],44100:[ee,[255,192],ie(268),[55,163,128],ie(84),[112]],32e3:[ee,[255,192],ie(268),[55,234],ie(226),[112]],24e3:[ee,[255,192],ie(268),[55,255,128],ie(268),[111,112],ie(126),[224]],16e3:[ee,[255,192],ie(268),[55,255,128],ie(268),[111,255],ie(269),[223,108],ie(195),[1,192]],12e3:[te,ie(268),[3,127,248],ie(268),[6,255,240],ie(268),[13,255,224],ie(268),[27,253,128],ie(259),[56]],11025:[te,ie(268),[3,127,248],ie(268),[6,255,240],ie(268),[13,255,224],ie(268),[27,255,192],ie(268),[55,175,128],ie(108),[112]],8e3:[te,ie(268),[3,121,16],ie(47),[7]]};t=e,G=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})}var t;return G}()[e.samplerate])||(s=t[0].data),o=0;o=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},ve.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},ve.prototype.addText=function(e){this.rows[this.rowIdx]+=e},ve.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var _e=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new ve(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};_e.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new ve(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},_e.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},_e.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var ye=function e(t){t=t||{},e.prototype.init.call(this);var i,n=this,r=t.captionServices||{},a={};Object.keys(r).forEach((function(e){i=r[e],/^SERVICE/.test(e)&&(a[e]=i.encoding)})),this.serviceEncodings=a,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(n.new708Packet(),n.add708Bytes(e)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(e))}};ye.prototype=new H,ye.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},ye.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},ye.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,r=0,a=t[r++];for(e.seq=a>>6,e.sizeCode=63&a;r>5)&&n>0&&(i=a=t[r++]),this.pushServiceBlock(i,r,n),n>0&&(r+=n-1)},ye.prototype.pushServiceBlock=function(e,t,i){var n,r=t,a=this.current708Packet.data,s=this.services[e];for(s||(s=this.initService(e,r));r>5,a.rowLock=(16&n)>>4,a.columnLock=(8&n)>>3,a.priority=7&n,n=i[++e],a.relativePositioning=(128&n)>>7,a.anchorVertical=127&n,n=i[++e],a.anchorHorizontal=n,n=i[++e],a.anchorPoint=(240&n)>>4,a.rowCount=15&n,n=i[++e],a.columnCount=63&n,n=i[++e],a.windowStyle=(56&n)>>3,a.penStyle=7&n,a.virtualRowCount=a.rowCount+1,e},ye.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.winAttr;return n=i[++e],r.fillOpacity=(192&n)>>6,r.fillRed=(48&n)>>4,r.fillGreen=(12&n)>>2,r.fillBlue=3&n,n=i[++e],r.borderType=(192&n)>>6,r.borderRed=(48&n)>>4,r.borderGreen=(12&n)>>2,r.borderBlue=3&n,n=i[++e],r.borderType+=(128&n)>>5,r.wordWrap=(64&n)>>6,r.printDirection=(48&n)>>4,r.scrollDirection=(12&n)>>2,r.justify=3&n,n=i[++e],r.effectSpeed=(240&n)>>4,r.effectDirection=(12&n)>>2,r.displayEffect=3&n,e},ye.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},ye.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},ye.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<>4,r.offset=(12&n)>>2,r.penSize=3&n,n=i[++e],r.italics=(128&n)>>7,r.underline=(64&n)>>6,r.edgeType=(56&n)>>3,r.fontStyle=7&n,e},ye.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penColor;return n=i[++e],r.fgOpacity=(192&n)>>6,r.fgRed=(48&n)>>4,r.fgGreen=(12&n)>>2,r.fgBlue=3&n,n=i[++e],r.bgOpacity=(192&n)>>6,r.bgRed=(48&n)>>4,r.bgGreen=(12&n)>>2,r.bgBlue=3&n,n=i[++e],r.edgeRed=(48&n)>>4,r.edgeGreen=(12&n)>>2,r.edgeBlue=3&n,e},ye.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],r.row=15&n,n=i[++e],r.column=63&n,e},ye.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var be={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Te=function(e){return null===e?"":(e=be[e]||e,String.fromCharCode(e))},we=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Se=function(){for(var e=[],t=15;t--;)e.push("");return e},Ee=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Se();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Se();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Se()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))a=Te((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=Te((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=we.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=Te(n),a+=Te(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Ee.prototype=new H,Ee.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch(e){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},Ee.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Se(),this.nonDisplayed_=Se(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Ee.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Ee.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Ee.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Ee.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Ee.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Ee.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},Ee.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Ee.prototype.isNormalChar=function(e){return e>=32&&e<=127},Ee.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Se(),this.displayed_=Se()),void 0!==t&&t!==this.row_)for(var i=0;i"}),"");this[this.mode_](e,i)},Ee.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+""}),"");this.formatting_=[],this[this.mode_](e,t)}},Ee.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Ee.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Ee.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},Ae=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||ke,this.push=function(e){this.type_!==ke&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=Ie(e.dts,n),e.pts=Ie(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ae.prototype=new H;var Pe,De=Ae,Le=Ie,Re=function(e,t,i){var n,r="";for(n=t;n>>2;c*=4,c+=3&l[7],o.timeStamp=c,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=s}while(i>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=xe.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=xe.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}},Fe.prototype=new H,Fe.STREAM_TYPES={h264:27,adts:15},Be=function(){var e,t=this,i=!1,n={data:[],size:0},r={data:[],size:0},a={data:[],size:0},s=function(e,i,n){var r,a,s=new Uint8Array(e.size),o={type:i},u=0,l=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,u=0;u>>3,h.pts*=4,h.pts+=(6&c[13])>>>1,h.dts=h.pts,64&d&&(h.dts=(14&c[14])<<27|(255&c[15])<<20|(254&c[16])<<12|(255&c[17])<<5|(254&c[18])>>>3,h.dts*=4,h.dts+=(6&c[18])>>>1)),h.data=c.subarray(9+c[8])),r="video"===i||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};Be.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case xe.H264_STREAM_TYPE:e=n,t="video";break;case xe.ADTS_STREAM_TYPE:e=r,t="audio";break;case xe.METADATA_STREAM_TYPE:e=a,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(r,"audio"),s(a,"timed-metadata")},this.flush=function(){if(!i&&e){var n={type:"metadata",tracks:[]};null!==e.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}},Be.prototype=new H;var Ge={PAT_PID:0,MP2T_PACKET_LENGTH:Ve,TransportPacketStream:Ue,TransportParseStream:Fe,ElementaryStream:Be,TimestampRolloverStream:He,CaptionStream:Ce.CaptionStream,Cea608Stream:Ce.Cea608Stream,Cea708Stream:Ce.Cea708Stream,MetadataStream:je};for(var qe in xe)xe.hasOwnProperty(qe)&&(Ge[qe]=xe[qe]);var We,Xe=Ge,Ye=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];We=function(e){var t,i=0;We.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+e+" to "+t+" in frame "+i+" outside syncword"})},this.push=function(n){var r,a,s,o,u,l=0;if(e||(i=0),"audio"===n.type){var c;for(t&&t.length?(s=t,(t=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),t.set(n.data,s.byteLength)):t=n.data;l+7>5,u=9e4*(o=1024*(1+(3&t[l+6])))/Ye[(60&t[l+2])>>>2],t.byteLength-l>>6&3),channelcount:(1&t[l+2])<<2|(192&t[l+3])>>>6,samplerate:Ye[(60&t[l+2])>>>2],samplingfrequencyindex:(60&t[l+2])>>>2,samplesize:16,data:t.subarray(l+7+a,l+r)}),i++,l+=r}else"number"!=typeof c&&(c=l),l++;"number"==typeof c&&(this.skipWarn_(c,l),c=null),t=t.subarray(l)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}},We.prototype=new H;var ze,Ke,Qe,$e=We,Je=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};Ke=function(){var e,t,i=0;Ke.prototype.init.call(this),this.push=function(n){var r;t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;for(var a=t.byteLength;i3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},Ke.prototype=new H,Qe={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},ze=function(){var e,t,i,n,r,a,s,o=new Ke;ze.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(s){var o={trackId:t,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(e,t){var i,n=8,r=8;for(i=0;i=0?i:0,(16&e[t+5])>>4?i+20:i+10},nt=function e(t,i){return t.length-i<10||t[i]!=="I".charCodeAt(0)||t[i+1]!=="D".charCodeAt(0)||t[i+2]!=="3".charCodeAt(0)?i:e(t,i+=it(t,i))},rt=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},at={isLikelyAacData:function(e){var t=nt(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:it,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=rt(e.subarray(10,14)));do{if((i=rt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r>>2;return(o*=4)+(3&s[7])}break}}t+=10,t+=i}while(t=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255!=(255&e[u])||240!=(240&e[u+1]))u++;else{if(e.length-u<7)break;if(u+(o=at.parseAdtsSize(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else{if(e.length-u<10)break;if(u+(o=at.parseId3TagSize(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=n>0?e.subarray(u):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new H;var st,ot,ut,lt,ct=Ze,ht=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],dt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],pt=et.H264Stream,ft=at.isLikelyAacData,mt=function(e,t){t.stream=e,this.trigger("log",t)},gt=function(e,t){for(var i=Object.keys(t),n=0;n=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))}(n,e,r),e.baseMediaDecodeTime=de(e,t.keepOriginalTimestamps),p=ce(e,o,a,s),e.samples=function(e){var t,i,n=[];for(t=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e}(o)),s.length){var f;if(!(f=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");he(e),o=f}pe(e,o),e.samples=function(e,t){var i,n,r,a,s,o=t||0,u=[];for(i=0;i=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=i=0;tn.pts?t++:(i++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===i?e:i===e.length?null:((l=e.slice(i)).byteLength=a,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,i,n,r,a,o,u;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=s[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(u=o?i:a))return e;var l=e.slice(u),c=l.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){s=e}},st.prototype=new H,lt=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,lt.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}},lt.prototype=new H,lt.prototype.flush=function(e){var t,i,n,a,s=0,o={captions:[],captionStreams:{},metadata:[],info:{}},l=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(l=this.videoTrack.timelineStartInfo.pts,dt.forEach((function(e){o.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(l=this.audioTrack.timelineStartInfo.pts,ht.forEach((function(e){o.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?o.type=this.pendingTracks[0].type:o.type="combined",this.emittedTracks+=this.pendingTracks.length,n=function(e){var t,i=r(),n=u(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t}(this.pendingTracks),o.initSegment=new Uint8Array(n.byteLength),o.initSegment.set(n),o.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},lt.prototype.setRemux=function(e){this.remuxTracks=e},ut=function(e){var t,i,n=this,r=!0;ut.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new Xe.MetadataStream,r.aacStream=new ct,r.audioTimestampRolloverStream=new Xe.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Xe.TimestampRolloverStream("timed-metadata"),r.adtsStream=new $e,r.coalesceStream=new lt(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(a){"timed-metadata"!==a.type&&"audio"!==a.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new ot(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),gt(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Xe.MetadataStream,r.packetStream=new Xe.TransportPacketStream,r.parseStream=new Xe.TransportParseStream,r.elementaryStream=new Xe.ElementaryStream,r.timestampRolloverStream=new Xe.TimestampRolloverStream,r.adtsStream=new $e,r.h264Stream=new pt,r.captionStream=new Xe.CaptionStream(e),r.coalesceStream=new lt(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new st(t,e),r.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new ot(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),gt(this,r)},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,he(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,he(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=ft(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},ut.prototype=new H;var yt,bt,Tt,wt={Transmuxer:ut,VideoSegmentStream:st,AudioSegmentStream:ot,AUDIO_PROPERTIES:ht,VIDEO_PROPERTIES:dt,generateSegmentTimingInfo:_t},St=function(e){return e>>>0},Et=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])},Ct=St,xt=function e(t,i){var n,r,a,s,o,u=[];if(!i.length)return null;for(n=0;n1?n+r:t.byteLength,a===i[0]&&(1===i.length?u.push(t.subarray(n+8,s)):(o=e(t.subarray(n+8,s),i.slice(1))).length&&(u=u.concat(o))),n=s;return u},kt=St,It=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},At=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a0?function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:kt(e[4]<<24|e[5]<<16|e[6]<<8|e[7])};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=kt(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),t}(l[0]).baseMediaDecodeTime:0,h=xt(s,["trun"]);t===u&&h.length>0&&(i=function(e,t,i){var n=t,r=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,s=i.trackId,o=[];return e.forEach((function(e){var t=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],c=n.getUint32(4),h=8;for(r&&(i.dataOffset=n.getInt32(h),h+=4),a&&c&&(t={flags:It(e.subarray(h,h+4))},h+=4,s&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(h):t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t),c--);c--;)t={},s&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),u&&(t.flags=It(e.subarray(h,h+4)),h+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(h):t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t);return i}(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=n+e.compositionTimeOffset,n+=e.duration})),o=o.concat(t)})),o}(h,c,o),n=function(e,t,i){var n,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u={logs:[],seiNals:[]};for(r=0;r+40;){var u=t.shift();this.parse(u,a,s)}return o=function(e,t,i){if(null===t)return null;var n=Lt(e,t)[t]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(e,i,n),o&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Ot=St,Mt=function(e){return("00"+e.toString(16)).slice(-2)};yt=function(e,t){var i,n,r;return i=xt(t,["moof","traf"]),n=[].concat.apply([],i.map((function(t){return xt(t,["tfhd"]).map((function(i){var n,r,a;return n=Ot(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),r=e[n]||9e4,a=xt(t,["tfdt"]).map((function(e){var t,i;return t=e[0],i=Ot(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=Ot(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),i}))[0],(a="number"!=typeof a||isNaN(a)?1/0:a)/r}))}))),r=Math.min.apply(null,n),isFinite(r)?r:0},Tt=function(e){var t=0===e[0]?12:20;return Ot(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},bt=function(e){var t=xt(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,n,r={},a=xt(e,["tkhd"])[0];a&&(n=(t=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0),r.id=0===n?t.getUint32(12):t.getUint32(20));var s=xt(e,["mdia","hdlr"])[0];if(s){var o=Et(s.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var u=xt(e,["mdia","minf","stbl","stsd"])[0];if(u){var l=u.subarray(8);r.codec=Et(l.subarray(4,8));var c,h=xt(l,[r.codec])[0];h&&(/^[asm]vc[1-9]$/i.test(r.codec)?(c=h.subarray(78),"avcC"===Et(c.subarray(4,8))&&c.length>11?(r.codec+=".",r.codec+=Mt(c[9]),r.codec+=Mt(c[10]),r.codec+=Mt(c[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(c=h.subarray(28),"esds"===Et(c.subarray(4,8))&&c.length>20&&0!==c[19]?(r.codec+="."+Mt(c[19]),r.codec+="."+Mt(c[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var d=xt(e,["mdia","mdhd"])[0];d&&(r.timescale=Tt(d)),i.push(r)})),i};var Nt=yt,Ut=bt,Ft=function(e){var t=31&e[1];return(t<<=8)|e[2]},Bt=function(e){return!!(64&e[1])},jt=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},Ht=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Vt={parseType:function(e,t){var i=Ft(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=Bt(e),i=4+jt(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=Bt(e),n=4+jt(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var a=12+((15&e[n+10])<<8|e[n+11]);a=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+jt(e),i=e.subarray(t),n=0,r=0,a=!1;r3&&"slice_layer_without_partitioning_rbsp_idr"===Ht(31&i[r+3])&&(a=!0),a}},Gt=Le,qt={};qt.ts=Vt,qt.aac=at;var Wt=re,Xt=188,Yt=71,zt=function(e,t,i){for(var n,r,a,s,o=0,u=Xt,l=!1;u<=e.byteLength;)if(e[o]!==Yt||e[u]!==Yt&&u!==e.byteLength)o++,u++;else{if(n=e.subarray(o,u),"pes"===qt.ts.parseType(n,t.pid)&&(r=qt.ts.parsePesType(n,t.table),a=qt.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=qt.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)),l)break;o+=Xt,u+=Xt}for(o=(u=e.byteLength)-Xt,l=!1;o>=0;)if(e[o]!==Yt||e[u]!==Yt&&u!==e.byteLength)o--,u--;else{if(n=e.subarray(o,u),"pes"===qt.ts.parseType(n,t.pid)&&(r=qt.ts.parsePesType(n,t.table),a=qt.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=qt.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)),l)break;o-=Xt,u-=Xt}},Kt=function(e,t,i){for(var n,r,a,s,o,u,l,c=0,h=Xt,d=!1,p={data:[],size:0};h=0;)if(e[c]!==Yt||e[h]!==Yt)c--,h--;else{if(n=e.subarray(c,h),"pes"===qt.ts.parseType(n,t.pid)&&(r=qt.ts.parsePesType(n,t.table),a=qt.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=qt.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),d=!0)),d)break;c-=Xt,h-=Xt}},Qt=function(e,t){var i;return i=qt.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,a=null,s=0,o=0;e.length-o>=3;){switch(qt.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=qt.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=qt.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=qt.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=qt.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var u=Wt/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*u,pts:a+1024*n*u}]}}(e):function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=Xt;r0}(f)){t.isFmp4=!0;var m=t.map.tracks,g={isFmp4:!0,hasVideo:!!m.video,hasAudio:!!m.audio};m.audio&&m.audio.codec&&"enca"!==m.audio.codec&&(g.audioCodec=m.audio.codec),m.video&&m.video.codec&&"encv"!==m.video.codec&&(g.videoCodec=m.video.codec),m.video&&m.audio&&(g.isMuxed=!0),n(t,g);var v=function(e){h(t,{data:f,type:g.hasAudio&&!g.isMuxed?"audio":"video"}),e&&e.length&&u(t,e),d(null,t,{})};Qo({action:"probeMp4StartTime",timescales:t.map.timescales,data:f,transmuxer:t.transmuxer,callback:function(e){var n=e.data,a=e.startTime;i=n.buffer,t.bytes=f=n,g.hasAudio&&!g.isMuxed&&r(t,"audio","start",a),g.hasVideo&&r(t,"video","start",a),m.video&&n.byteLength&&t.transmuxer?Qo({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:f,timescales:t.map.timescales,trackIds:[m.video.id],callback:function(e){i=e.data.buffer,t.bytes=f=e.data,e.logs.forEach((function(e){p(Ss.mergeOptions(e,{stream:"mp4CaptionParser"}))})),v(e.captions)}}):v()}})}else if(t.transmuxer){if(void 0===t.container&&(t.container=lt(f)),"ts"!==t.container&&"aac"!==t.container)return n(t,{hasAudio:!1,hasVideo:!1}),void d(null,t,{});nu({segment:t,bytes:i,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:h,doneFn:d,onTransmuxerLog:p})}else d(null,t,{})},au=function(e,t){var i,n=e.id,r=e.key,a=e.encryptedBytes,s=e.decryptionWorker;s.addEventListener("message",(function e(i){if(i.data.source===n){s.removeEventListener("message",e);var r=i.data.decrypted;t(new Uint8Array(r.bytes,r.byteOffset,r.byteLength))}})),i=r.bytes.slice?r.bytes.slice():new Uint32Array(Array.prototype.slice.call(r.bytes)),s.postMessage(xo({source:n,encrypted:a,key:i,iv:r.iv}),[a.buffer,i.buffer])},su=function(e){var t=e.xhr,i=e.xhrOptions,n=e.decryptionWorker,r=e.segment,a=e.abortFn,s=e.progressFn,o=e.trackInfoFn,u=e.timingInfoFn,l=e.videoSegmentTimingInfoFn,c=e.audioSegmentTimingInfoFn,h=e.id3Fn,d=e.captionsFn,p=e.isEndOfTimeline,f=e.endedTimelineFn,m=e.dataFn,g=e.doneFn,v=e.onTransmuxerLog,_=[],y=function(e){var t=e.activeXhrs,i=e.decryptionWorker,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,h=e.dataFn,d=e.doneFn,p=e.onTransmuxerLog,f=0,m=!1;return function(e,g){if(!m){if(e)return m=!0,Zo(t),d(e,g);if((f+=1)===t.length){var v=function(){if(g.encryptedBytes)return function(e){var t=e.decryptionWorker,i=e.segment,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,h=e.dataFn,d=e.doneFn,p=e.onTransmuxerLog;au({id:i.requestId,key:i.key,encryptedBytes:i.encryptedBytes,decryptionWorker:t},(function(e){i.bytes=e,ru({segment:i,bytes:i.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:h,doneFn:d,onTransmuxerLog:p})}))}({decryptionWorker:i,segment:g,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:h,doneFn:d,onTransmuxerLog:p});ru({segment:g,bytes:g.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:h,doneFn:d,onTransmuxerLog:p})};if(g.endOfAllRequests=Date.now(),g.map&&g.map.encryptedBytes&&!g.map.bytes)return au({decryptionWorker:i,id:g.requestId+"-init",encryptedBytes:g.map.encryptedBytes,key:g.map.key},(function(e){g.map.bytes=e,iu(g,(function(e){if(e)return Zo(t),d(e,g);v()}))}));v()}}}}({activeXhrs:_,decryptionWorker:n,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:h,captionsFn:d,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m,doneFn:g,onTransmuxerLog:v});if(r.key&&!r.key.bytes){var b=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&b.push(r.map.key);var T=t(Ss.mergeOptions(i,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),tu(r,b,y));_.push(T)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){var w=t(Ss.mergeOptions(i,{uri:r.map.key.resolvedUri,responseType:"arraybuffer"}),tu(r,[r.map.key],y));_.push(w)}var S=Ss.mergeOptions(i,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:wo(r.map)}),E=function(e){var t=e.segment,i=e.finishProcessingFn;return function(e,n){var r=eu(e,n);if(r)return i(r,t);var a=new Uint8Array(n.response);if(t.map.key)return t.map.encryptedBytes=a,i(null,t);t.map.bytes=a,iu(t,(function(e){if(e)return e.xhr=n,e.status=n.status,i(e,t);i(null,t)}))}}({segment:r,finishProcessingFn:y}),C=t(S,E);_.push(C)}var x=Ss.mergeOptions(i,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:wo(r)}),k=t(x,function(e){var t=e.segment,i=e.finishProcessingFn,n=e.responseType;return function(e,r){var a=eu(e,r);if(a)return i(a,t);var s="arraybuffer"!==n&&r.responseText?function(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),i=0;i1)return ou("multiple "+e+" codecs found as attributes: "+t[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(t[e]=null);t[e]=t[e][0]})),t},cu=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},hu=function(e,t){var i=t.attributes||{},n=lu(function(e){var t=e.attributes||{};if(t.CODECS)return V(t.CODECS)}(t)||[]);if(uu(e,t)&&!n.audio&&!function(e,t){if(!uu(e,t))return!0;var i=t.attributes||{},n=e.mediaGroups.AUDIO[i.AUDIO];for(var r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1}(e,t)){var r=lu(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return V(r.playlists[0].attributes.CODECS)}return null}(e,i.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},du=Is("PlaylistSelector"),pu=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},fu=function(e,t){if(!e)return"";var i=r().getComputedStyle(e);return i?i[t]:""},mu=function(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))},gu=function(e,t){var i,n;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||r().Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),i-(n||r().Number.MAX_VALUE)},vu=function(e,t,i,n,a,s){if(e){var o={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:a},u=e.playlists;io.isAudioOnly(e)&&(u=s.getAudioTrackPlaylists_(),o.audioOnly=!0);var l=u.map((function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||r().Number.MAX_VALUE,width:t,height:i,playlist:e}}));mu(l,(function(e,t){return e.bandwidth-t.bandwidth}));var c=(l=l.filter((function(e){return!io.isIncompatible(e.playlist)}))).filter((function(e){return io.isEnabled(e.playlist)}));c.length||(c=l.filter((function(e){return!io.isDisabled(e.playlist)})));var h=c.filter((function(e){return e.bandwidth*Bo.BANDWIDTH_VARIANCEi||e.height>n}))).filter((function(e){return e.width===_[0].width&&e.height===_[0].height})),d=y[y.length-1],b=y.filter((function(e){return e.bandwidth===d.bandwidth}))[0]),s.experimentalLeastPixelDiffSelector){var S=g.map((function(e){return e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e}));mu(S,(function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff})),T=S[0]}var E=T||b||w||p||c[0]||l[0];if(E&&E.playlist){var C="sortedPlaylistReps";return T?C="leastPixelDiffRep":b?C="resolutionPlusOneRep":w?C="resolutionBestRep":p?C="bandwidthBestRep":c[0]&&(C="enabledPlaylistReps"),du("choosing "+pu(E)+" using "+C+" with options",o),E.playlist}return du("could not choose a playlist with options",o),null}},_u=function(){var e=this.useDevicePixelRatio&&r().devicePixelRatio||1;return vu(this.playlists.master,this.systemBandwidth,parseInt(fu(this.tech_.el(),"width"),10)*e,parseInt(fu(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},yu=function(e,t,i){var n,r;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime>=e&&r.endTime<=t&&i.removeCue(r)},bu=function(e){return"number"==typeof e&&isFinite(e)},Tu=1/60,wu=function(e){var t=e.startOfSegment,i=e.duration,n=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,u=a.segments,l=void 0===u?[]:u,c=e.mediaIndex,h=e.partIndex,d=e.timeline,p=l.length-1,f="mediaIndex/partIndex increment";e.getMediaInfoForTime?f="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(f="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(f+=" with independent "+e.independent);var m="number"==typeof h,g=e.segment.uri?"segment":"pre-segment",v=m?Vs({preloadSegment:n})-1:0;return g+" ["+(s+c)+"/"+(s+p)+"]"+(m?" part ["+h+"/"+v+"]":"")+" segment start/end ["+n.start+" => "+n.end+"]"+(m?" part start/end ["+r.start+" => "+r.end+"]":"")+" startOfSegment ["+t+"] duration ["+i+"] timeline ["+d+"] selected by ["+f+"] playlist ["+o+"]"},Su=function(e){return e+"TimingInfo"},Eu=function(e){var t=e.timelineChangeController,i=e.currentTimeline,n=e.segmentTimeline,r=e.loaderType,a=e.audioDisabled;if(i===n)return!1;if("audio"===r){var s=t.lastTimelineChange({type:"main"});return!s||s.to!==n}if("main"===r&&a){var o=t.pendingTimelineChange({type:"audio"});return!o||o.to!==n}return!1},Cu=function(e){var t=e.segmentDuration,i=e.maxDuration;return!!t&&Math.round(t)>i+As},xu=function(e){function t(t,i){var n;if(n=e.call(this)||this,!t)throw new TypeError("Initialization settings are required");if("function"!=typeof t.currentTime)throw new TypeError("No currentTime getter specified");if(!t.mediaSource)throw new TypeError("No MediaSource specified");return n.bandwidth=t.bandwidth,n.throughput={rate:0,count:0},n.roundTrip=NaN,n.resetStats_(),n.mediaIndex=null,n.partIndex=null,n.hasPlayed_=t.hasPlayed,n.currentTime_=t.currentTime,n.seekable_=t.seekable,n.seeking_=t.seeking,n.duration_=t.duration,n.mediaSource_=t.mediaSource,n.vhs_=t.vhs,n.loaderType_=t.loaderType,n.currentMediaInfo_=void 0,n.startingMediaInfo_=void 0,n.segmentMetadataTrack_=t.segmentMetadataTrack,n.goalBufferLength_=t.goalBufferLength,n.sourceType_=t.sourceType,n.sourceUpdater_=t.sourceUpdater,n.inbandTextTracks_=t.inbandTextTracks,n.state_="INIT",n.timelineChangeController_=t.timelineChangeController,n.shouldSaveSegmentTimingInfo_=!0,n.parse708captions_=t.parse708captions,n.captionServices_=t.captionServices,n.experimentalExactManifestTimings=t.experimentalExactManifestTimings,n.checkBufferTimeout_=null,n.error_=void 0,n.currentTimeline_=-1,n.pendingSegment_=null,n.xhrOptions_=null,n.pendingSegments_=[],n.audioDisabled_=!1,n.isPendingTimestampOffset_=!1,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=Ss.browser.IE_VERSION>=11,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",(function(){n.isEndOfStream_()||(n.ended_=!1)})),n.fetchAtBuffer_=!1,n.logger_=Is("SegmentLoader["+n.loaderType_+"]"),Object.defineProperty(u(n),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",(function(){n.hasEnoughInfoToLoad_()&&n.processLoadQueue_(),n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),n}c(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return function(e){var t=new Wo;t.currentTransmux=null,t.transmuxQueue=[];var i=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)},t.postMessage({action:"init",options:e}),t}({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},i.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},i.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&r().clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},i.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},i.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},i.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,r().clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},i.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},i.error=function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},i.endOfStream=function(){this.ended_=!0,this.transmuxer_&&Ko(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},i.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Ss.createTimeRanges();if("main"===this.loaderType_){var t=e.hasAudio,i=e.hasVideo,n=e.isMuxed;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=ko(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e},i.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Io(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r},i.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},i.load=function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.playlist=function(e,t){if(void 0===t&&(t={}),e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");var a=e.mediaSequence-i.mediaSequence;if(this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var s=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!s.parts||!s.parts.length||!s.parts[this.partIndex])){var o=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=o}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}},i.pause=function(){this.checkBufferTimeout_&&(r().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},i.paused=function(){return null===this.checkBufferTimeout_},i.resetEverything=function(e){this.ended_=!1,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))},i.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},i.resyncLoader=function(){this.transmuxer_&&Ko(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},i.remove=function(e,t,i,n){if(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r=1,a=function(){0==--r&&i()};for(var s in!n&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,a)),(n||"main"===this.loaderType_)&&(this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil((t-n)*ct.ONE_SECOND_IN_TS),a=Math.ceil((i-n)*ct.ONE_SECOND_IN_TS),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),s.splice(u,o-u+1),s}(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a)),this.inbandTextTracks_)yu(e,t,this.inbandTextTracks_[s]);yu(e,t,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")},i.monitorBuffer_=function(){this.checkBufferTimeout_&&r().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=r().setTimeout(this.monitorBufferTick_.bind(this),1)},i.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&r().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=r().setTimeout(this.monitorBufferTick_.bind(this),500)},i.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}},i.isEndOfStream_=function(e,t,i){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===i&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var n="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&a},i.chooseNextRequest_=function(){var e=this.buffered_(),t=Ns(e)||0,i=Us(e,this.currentTime_()),n=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var s={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(s.isSyncRequest)s.mediaIndex=function(e,t,i){t=t||[];for(var n=[],r=0,a=0;ai))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,a,t);else if(null!==this.mediaIndex){var o=a[this.mediaIndex],u="number"==typeof this.partIndex?this.partIndex:-1;s.startOfSegment=o.end?o.end:t,o.parts&&o.parts[u+1]?(s.mediaIndex=this.mediaIndex,s.partIndex=u+1):s.mediaIndex=this.mediaIndex+1}else{var l=io.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),c=l.segmentIndex,h=l.startTime,d=l.partIndex;s.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),s.mediaIndex=c,s.startOfSegment=h,s.partIndex=d}var p=a[s.mediaIndex],f=p&&"number"==typeof s.partIndex&&p.parts&&p.parts[s.partIndex];if(!p||"number"==typeof s.partIndex&&!f)return null;if("number"!=typeof s.partIndex&&p.parts&&(s.partIndex=0,f=p.parts[0]),!i&&f&&!f.independent)if(0===s.partIndex){var m=a[s.mediaIndex-1],g=m.parts&&m.parts.length&&m.parts[m.parts.length-1];g&&g.independent&&(s.mediaIndex-=1,s.partIndex=m.parts.length-1,s.independent="previous segment")}else p.parts[s.partIndex-1].independent&&(s.partIndex-=1,s.independent="previous part");var v=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return s.mediaIndex>=a.length-1&&v&&!this.seeking_()?null:this.generateSegmentInfo_(s)},i.generateSegmentInfo_=function(e){var t=e.independent,i=e.playlist,n=e.mediaIndex,r=e.startOfSegment,a=e.isSyncRequest,s=e.partIndex,o=e.forceTimestampOffset,u=e.getMediaInfoForTime,l=i.segments[n],c="number"==typeof s&&l.parts[s],h={requestId:"segment-loader-"+Math.random(),uri:c&&c.resolvedUri||l.resolvedUri,mediaIndex:n,partIndex:c?s:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:c&&c.duration||l.duration,segment:l,part:c,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:u,independent:t},d=void 0!==o?o:this.isPendingTimestampOffset_;h.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:d});var p=Ns(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(h.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(h.gopsToAlignWith=function(e,t,i){if(null==t||!e.length)return[];var n,r=Math.ceil((t-i+3)*ct.ONE_SECOND_IN_TS);for(n=0;nr);n++);return e.slice(n)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),h},i.timestampOffsetForSegment_=function(e){return i=(t=e).segmentTimeline,n=t.currentTimeline,r=t.startOfSegment,a=t.buffered,t.overrideCheck||i!==n?i "+o+" for "+e),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"});var n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);var r=t.textTracks().getTrackById(n);if(r)e[i]=r;else{var a=i,s=i,o=!1,u=(t.options_.vhs&&t.options_.vhs.captionServices||{})[n];u&&(a=u.label,s=u.language,o=u.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:n,default:o,label:a,language:s},!1).track}}}(l,i.vhs_.tech_,e),yu(s,o,l[e]),function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var a=r().WebKitDataCue||r().VTTCue;i.forEach((function(e){var i=e.stream;t[i].addCue(new a(e.startTime+n,e.endTime+n,e.text))}))}}({captionArray:u,inbandTextTracks:l,timestampOffset:n})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")},i.handleId3_=function(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();!function(e,t,i){e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)}(this.inbandTextTracks_,i,this.vhs_.tech_),function(e){var t=e.inbandTextTracks,i=e.metadataArray,n=e.timestampOffset,a=e.videoDuration;if(i){var s=r().WebKitDataCue||r().VTTCue,o=t.metadataTrack_;if(o&&(i.forEach((function(e){var t=e.cueTime+n;!("number"!=typeof t||r().isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((function(e){var i=new s(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return Ss.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return Ss.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return Ss.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(i),o.addCue(i)}))})),o.cues&&o.cues.length)){for(var u=o.cues,l=[],c=0;c1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Ms(o).join(", ")),u.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Ms(u).join(", "));var l=o.length?o.start(0):0,c=o.length?o.end(o.length-1):0,h=u.length?u.start(0):0,d=u.length?u.end(u.length-1):0;if(c-l<=1&&d-h<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+s.byteLength+", audio buffer: "+Ms(o).join(", ")+", video buffer: "+Ms(u).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:n,type:a,bytes:s}));var p=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+p),this.remove(0,p,(function(){i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=r().setTimeout((function(){i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),i.quotaExceededErrorRetryTimeout_=null,i.processCallQueue_()}),1e3)}),!0)},i.handleAppendError_=function(e,t){var i=e.segmentInfo,n=e.type,r=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(n+" append of "+r.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:i,type:n,bytes:r}))},i.appendToSourceBuffer_=function(e){var t,i,n,r=e.segmentInfo,a=e.type,s=e.initSegment,o=e.data,u=e.bytes;if(!u){var l=[o],c=o.byteLength;s&&(l.unshift(s),c+=s.byteLength),n=0,(t={bytes:c,segments:l}).bytes&&(i=new Uint8Array(t.bytes),t.segments.forEach((function(e){i.set(e,n),n+=e.byteLength}))),u=i}this.sourceUpdater_.appendBuffer({segmentInfo:r,type:a,bytes:u},this.handleAppendError_.bind(this,{segmentInfo:r,type:a,bytes:u}))},i.handleSegmentTimingInfo_=function(e,t,i){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var n=this.pendingSegment_.segment,r=e+"TimingInfo";n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}},i.appendData_=function(e,t){var i=t.type,n=t.data;if(n&&n.byteLength&&("audio"!==i||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}},i.loadSegment_=function(e){var t=this;this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((function(){var i=o({},e,{forceTimestampOffset:!0});o(e,t.generateSegmentInfo_(i)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)}))},i.updateTransmuxerAndRequestSegment_=function(e){var t=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,a=e.timeline!==this.currentTimeline_&&e.timeline>0,s=n||r&&a;this.logger_("Requesting "+wu(e)),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=su({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:s,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(i){var n=i.message,r=i.level,a=i.stream;t.logger_(wu(e)+" logged from transmuxer stream "+a+" as a "+r+": "+n)}})},i.trimBackBuffer_=function(e){var t=function(e,t,i){var n=t-Bo.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));var r=t-i;return Math.min(r,n)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)},i.createSimplifiedSegmentObj_=function(e){var t=e.segment,i=e.part,n={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},r=e.playlist.segments[e.mediaIndex-1];if(r&&r.timeline===t.timeline&&(r.videoTimingInfo?n.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(n.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key){var a=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=a}return t.map&&(n.map=this.initSegmentForMap(t.map)),n},i.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},i.saveBandwidthRelatedStats_=function(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}},i.setTimeMapping_=function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)},i.updateMediaSecondsLoaded_=function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},i.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},i.trueSegmentStart_=function(e){var t=e.currentStart,i=e.playlist,n=e.mediaIndex,r=e.firstVideoFrameTimeForData,a=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,o=e.videoTimingInfo,u=e.audioTimingInfo;if(void 0!==t)return t;if(!s)return u.start;var l=i.segments[n-1];return 0!==n&&l&&void 0!==l.start&&l.end===r+a?o.start:r},i.waitForAppendsToComplete_=function(e){var t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed,a="main"===this.loaderType_&&n,s=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);a&&e.waitingOnAppends++,s&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},i.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},i.checkForIllegalMediaSwitch=function(e){var t=function(e,t,i){return"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null}(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,blacklistDuration:1/0}),this.trigger("error"),!0)},i.updateSourceBufferTimestampOffset_=function(e){if(null!==e.timestampOffset&&"number"==typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var t=!1;e.timestampOffset-=e.timingInfo.start,e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}},i.updateTimingInfoEnd_=function(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"==typeof i.end?i.end:i.start+e.duration)},i.handleAppendsDone_=function(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});var t=function(e,t){if("hls"!==t)return null;var i,n,r,a,s=(i=e.audioTimingInfo,n=e.videoTimingInfo,r=i&&"number"==typeof i.start&&"number"==typeof i.end?i.end-i.start:0,a=n&&"number"==typeof n.start&&"number"==typeof n.end?n.end-n.start:0,Math.max(r,a));if(!s)return null;var o=e.playlist.targetDuration,u=Cu({segmentDuration:s,maxDuration:2*o}),l=Cu({segmentDuration:s,maxDuration:o}),c="Segment with index "+e.mediaIndex+" from playlist "+e.playlist.id+" has a duration of "+s+" when the reported duration is "+e.duration+" and the target duration is "+o+". For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";return u||l?{severity:u?"warn":"info",message:c}:null}(e,this.sourceType_);if(t&&("warn"===t.severity?Ss.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",!e.isSyncRequest||(this.trigger("syncinfoupdate"),e.hasAppendedData_)){this.logger_("Appended "+wu(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");var i=e.segment,n=e.part,r=i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration,a=n&&n.end&&this.currentTime_()-n.end>3*e.playlist.partTargetDuration;if(r||a)return this.logger_("bad "+(r?"segment":"part")+" "+wu(e)),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}else this.logger_("Throwing away un-appended sync request "+wu(e))},i.recordThroughput_=function(e){if(e.duration=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e},i.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},i.segmentRequestFinished_=function(e,t,i){var n=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===$o&&this.handleTimeout_(),e.code===Jo?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var a=this.pendingSegment_;this.saveBandwidthRelatedStats_(a.duration,t.stats),this.state="APPENDING",this.trigger("appending");var s=a.segment;if(s.map&&(s.map.bytes=t.map.bytes),a.bytes=t.bytes,"function"!=typeof r().WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var o,u=function(){n.subtitlesTrack_.tech_.off("vttjsloaded",o),n.stopForError({message:"Error loading vtt.js"})};return o=function(){n.subtitlesTrack_.tech_.off("vttjserror",u),n.segmentRequestFinished_(e,t,i)},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",o),void this.subtitlesTrack_.tech_.one("vttjserror",u)}s.requested=!0;try{this.parseVTTCues_(a)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(a,this.syncController_.timelines[a.timeline],this.playlist_),a.cues.length?a.timingInfo={start:a.cues[0].startTime,end:a.cues[a.cues.length-1].endTime}:a.timingInfo={start:a.startOfSegment,end:a.startOfSegment+a.duration},a.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");a.byteLength=a.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,a.cues.forEach((function(e){n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_?new(r().VTTCue)(e.startTime,e.endTime,e.text):e)})),function(e){var t=e.cues;if(t)for(var i=0;i1&&n.push(t[a]);n.length&&n.forEach((function(t){return e.removeCue(t)}))}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},i.handleData_=function(){},i.updateTimingInfoEnd_=function(){},i.parseVTTCues_=function(e){var t,i=!1;"function"==typeof r().TextDecoder?t=new(r().TextDecoder)("utf8"):(t=r().WebVTT.StringDecoder(),i=!0);var n=new(r().WebVTT.Parser)(r(),r().vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){e.timestampmap=t},n.onparsingerror=function(e){Ss.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var a=e.segment.map.bytes;i&&(a=Xu(a)),n.parse(a)}var s=e.bytes;i&&(s=Xu(s)),n.parse(s),n.flush()},i.updateTimeMapping_=function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,a=r.MPEGTS/ct.ONE_SECOND_IN_TS-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=a,e.endTime+=a})),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}else n.empty=!0},t}(xu),Ku=function(e,t){for(var i=e.cues,n=0;n=r.adStartTime&&t<=r.adEndTime)return r}return null},Qu=[{name:"VOD",run:function(e,t,i,n,r){return i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var a=null,s=null,o=js(t);r=r||0;for(var u=0;u=d)&&(s=d,a={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o=h)&&(s=h,a={time:c.time,segmentIndex:u,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],$u=function(e){function t(t){var i;return(i=e.call(this)||this).timelines=[],i.discontinuities=[],i.timelineToDatetimeMappings={},i.logger_=Is("SyncController"),i}c(t,e);var i=t.prototype;return i.getSyncPoint=function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null},i.getExpiredTime=function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+Xs({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))},i.runStrategies_=function(e,t,i,n){for(var r=[],a=0;a86400)Ss.log.warn("Not saving expired segment info. Media sequence gap "+i+" is too large.");else for(var n=i-1;n>=0;n--){var r=e.segments[n];if(r&&void 0!==r.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},i.setDateTimeMappingForStart=function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}},i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i),r=t.segment;n&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start}));var a=r.dateTimeObject;r.discontinuity&&i&&a&&(this.timelineToDatetimeMappings[r.timeline]=-a.getTime()/1e3)},i.timestampOffsetForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].time},i.mappingForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping},i.calculateSegmentTimeMapping_=function(e,t,i){var n,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+o.time+"] [mapping: "+o.mapping+"]")),n=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=n,s.end=r),(!a.start||no){var u;u=s<0?i.start-Xs({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+Xs({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:u,accuracy:o}}}},i.dispose=function(){this.trigger("dispose"),this.off()},t}(Ss.EventTarget),Ju=function(e){function t(){var t;return(t=e.call(this)||this).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}c(t,e);var i=t.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.lastTimelineChanges_[t]={type:t,from:i,to:n},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(Ss.EventTarget),Zu=Vo(Go((function(){function e(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var t=e((function(e){function t(e,t){for(var i=0;i-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n>7))^e]=e;for(t=i=0;!h[t];t^=n||1,i=f[i]||1)for(a=(a=i^i<<1^i<<2^i<<3^i<<4)>>8^255&a^99,h[t]=a,d[a]=t,o=16843009*p[r=p[n=p[t]]]^65537*r^257*n^16843008*t,s=257*p[a]^16843008*a,e=0;e<4;e++)l[e][t]=s=s<<24^s>>>8,c[e][a]=o=o<<24^o>>>8;for(e=0;e<5;e++)l[e]=l[e].slice(0),c[e]=c[e].slice(0);return u}()),this._tables=[[a[0][0].slice(),a[0][1].slice(),a[0][2].slice(),a[0][3].slice(),a[0][4].slice()],[a[1][0].slice(),a[1][1].slice(),a[1][2].slice(),a[1][3].slice(),a[1][4].slice()]];var r=this._tables[0][4],s=this._tables[1],o=e.length,u=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");var l=e.slice(0),c=[];for(this._key=[l,c],t=o;t<4*o+28;t++)n=l[t-1],(t%o==0||8===o&&t%o==4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],t%o==0&&(n=n<<8^n>>>24^u<<24,u=u<<1^283*(u>>7))),l[t]=l[t-o]^n;for(i=0;t;i++,t--)n=l[3&i?t:t-4],c[i]=t<=4||i<4?n:s[0][r[n>>>24]]^s[1][r[n>>16&255]]^s[2][r[n>>8&255]]^s[3][r[255&n]]}return e.prototype.decrypt=function(e,t,i,n,r,a){var s,o,u,l,c=this._key[1],h=e^c[0],d=n^c[1],p=i^c[2],f=t^c[3],m=c.length/4-2,g=4,v=this._tables[1],_=v[0],y=v[1],b=v[2],T=v[3],w=v[4];for(l=0;l>>24]^y[d>>16&255]^b[p>>8&255]^T[255&f]^c[g],o=_[d>>>24]^y[p>>16&255]^b[f>>8&255]^T[255&h]^c[g+1],u=_[p>>>24]^y[f>>16&255]^b[h>>8&255]^T[255&d]^c[g+2],f=_[f>>>24]^y[h>>16&255]^b[d>>8&255]^T[255&p]^c[g+3],g+=4,h=s,d=o,p=u;for(l=0;l<4;l++)r[(3&-l)+a]=w[h>>>24]<<24^w[d>>16&255]<<16^w[p>>8&255]<<8^w[255&f]^c[g++],s=h,h=d,d=p,p=f,f=s},e}(),o=function(e){function t(){var t;return(t=e.call(this,r)||this).jobs=[],t.delay=1,t.timeout_=null,t}n(t,e);var i=t.prototype;return i.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(r),u=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},l=function(){function e(t,i,n,r){var a=e.STEP,s=new Int32Array(t.buffer),l=new Uint8Array(t.byteLength),c=0;for(this.asyncStream_=new o,this.asyncStream_.push(this.decryptChunk_(s.subarray(c,c+a),i,n,l)),c=a;c>2),m=new s(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),v=new Int32Array(g.buffer);for(n=i[0],r=i[1],a=i[2],o=i[3],p=0;p=0&&(t="main-desc"),t},il=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},nl=function(e,t){t.activePlaylistLoader=e,e.load()},rl={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;il(i,n);var a=n.activeTrack(),s=n.activeGroup(),o=(s.filter((function(e){return e.default}))[0]||s[0]).id,u=n.tracks[o];if(a!==u){for(var l in Ss.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[l].enabled=n.tracks[l]===u;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];Ss.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),il(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},al={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",rl[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",rl[e](e,i))}},sl={AUDIO:function(e,t){var i=t.vhs,n=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],u=o.groups,l=o.tracks,c=o.logger_,h=t.masterPlaylistLoader,d=to(h.master);for(var p in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}},d&&(s[e].main.default.playlists=h.master.playlists)),s[e])for(var f in u[p]||(u[p]=[]),s[e][p]){var m=s[e][p][f],g=void 0;if(d?(c("AUDIO group '"+p+"' label '"+f+"' is a master playlist"),m.isMasterPlaylist=!0,g=null):g="vhs-json"===n&&m.playlists?new vo(m.playlists[0],i,a):m.resolvedUri?new vo(m.resolvedUri,i,a):m.playlists&&"dash"===n?new Fo(m.playlists[0],i,a,h):null,m=Ss.mergeOptions({id:f,playlistLoader:g},m),al[e](e,m.playlistLoader,t),u[p].push(m),void 0===l[f]){var v=new Ss.AudioTrack({id:f,kind:tl(m),enabled:!1,language:m.language,default:m.default,label:f});l[f]=v}}r.on("error",rl[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,u=t.mediaTypes[e],l=u.groups,c=u.tracks,h=t.masterPlaylistLoader;for(var d in o[e])for(var p in l[d]||(l[d]=[]),o[e][d])if(!o[e][d][p].forced){var f=o[e][d][p],m=void 0;if("hls"===r)m=new vo(f.resolvedUri,n,s);else if("dash"===r){if(!f.playlists.filter((function(e){return e.excludeUntil!==1/0})).length)return;m=new Fo(f.playlists[0],n,s,h)}else"vhs-json"===r&&(m=new vo(f.playlists?f.playlists[0]:f.resolvedUri,n,s));if(f=Ss.mergeOptions({id:p,playlistLoader:m},f),al[e](e,f.playlistLoader,t),l[d].push(f),void 0===c[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;c[p]=g}}a.on("error",rl[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in n[e])for(var u in a[o]||(a[o]=[]),n[e][o]){var l=n[e][o][u];if(/^(?:CC|SERVICE)/.test(l.instreamId)){var c=i.options_.vhs&&i.options_.vhs.captionServices||{},h={label:u,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(c[h.instreamId]&&(h=Ss.mergeOptions(h,c[h.instreamId])),void 0===h.default&&delete h.default,a[o].push(Ss.mergeOptions({id:u},l)),void 0===s[u]){var d=i.addRemoteTextTrack({id:h.instreamId,kind:"captions",default:h.default,language:h.language,label:h.label},!1).track;s[u]=d}}}}},ol=function e(t,i){for(var n=0;n "+a+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,i)},i.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=r().setInterval((function(){return e.checkABR_()}),250)},i.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(r().clearInterval(this.abrTimer_),this.abrTimer_=null)},i.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var i,n=e.mediaGroups.AUDIO,r=Object.keys(n);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{var a=n.main||r.length&&n[r[0]];for(var s in a)if(a[s].default){i={label:s};break}}if(!i)return t;var o=[];for(var u in n)if(n[u][i.label]){var l=n[u][i.label];if(l.playlists&&l.playlists.length)o.push.apply(o,l.playlists);else if(l.uri)o.push(l);else if(e.playlists.length)for(var c=0;c1&&to(t.master))for(var u=0;u1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},i.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return function(e){var t=e.currentPlaylist,i=e.buffered,n=e.currentTime,r=e.nextPlaylist,a=e.bufferLowWaterLine,s=e.bufferHighWaterLine,o=e.duration,u=e.experimentalBufferBasedABR,l=e.log;if(!r)return Ss.log.warn("We received no playlist to switch to. Please check your stream."),!1;var c="allowing switch "+(t&&t.id||"null")+" -> "+r.id;if(!t)return l(c+" as current playlist is not set"),!0;if(r.id===t.id)return!1;var h=Boolean(Ls(i,n).length);if(!t.endList)return h||"number"!=typeof t.partTargetDuration?(l(c+" as current playlist is live"),!0):(l("not "+c+" as current playlist is live llhls, but currentTime isn't in buffered."),!1);var d=Us(i,n),p=u?Bo.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Bo.MAX_BUFFER_LOW_WATER_LINE;if(om)&&d>=a){var v=c+" as forwardBuffer >= bufferLowWaterLine ("+d+" >= "+a+")";return u&&(v+=" and next bandwidth > current bandwidth ("+f+" > "+m+")"),l(v),!0}return l("not "+c+" as no switching criteria met"),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},i.setupSegmentLoaderListeners_=function(){var e=this;this.experimentalBufferBasedABR||(this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist();e.shouldSwitchToMedia_(t)&&e.switchMedia_(t,"bandwidthupdate"),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")}))),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("appenderror",(function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("ended",(function(){e.logger_("main segment loader ended"),e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(t){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120))}));var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()}))},i.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},i.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},i.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},i.fastQualityChange_=function(e){var t=this;void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((function(){Ss.browser.IE_VERSION||Ss.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")},i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()this.maxPlaylistRetries?1/0:Date.now()+1e3*t,i.excludeUntil=n,e.reason&&(i.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var u=this.selectPlaylist();if(!u)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var l=e.internal?this.logger_:Ss.log.warn,c=e.message?" "+e.message:"";l((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+c+" Switching to playlist "+u.id+"."),u.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var h=u.targetDuration/2*1e3||5e3,d="number"==typeof u.lastRequest&&Date.now()-u.lastRequest<=h;return this.switchMedia_(u,"exclude",s||d)},i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},i.delegateLoaders_=function(e,t){var i=this,n=[],r="all"===e;(r||"main"===e)&&n.push(this.masterPlaylistLoader_);var a=[];(r||"audio"===e)&&a.push("AUDIO"),(r||"subtitle"===e)&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach((function(e){var t=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader;t&&n.push(t)})),["main","audio","subtitle"].forEach((function(t){var r=i[t+"SegmentLoader_"];!r||e!==t&&"all"!==e||n.push(r)})),n.forEach((function(e){return t.forEach((function(t){"function"==typeof e[t]&&e[t]()}))}))},i.setCurrentTime=function(e){var t=Ls(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0},i.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Iu.Playlist.duration(e):1/0:0},i.seekable=function(){return this.seekable_},i.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_&&!this.sourceUpdater_.hasCreatedSourceBuffers()){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n=this.masterPlaylistLoader_.master,r=Iu.Playlist.seekable(t,i,Iu.Playlist.liveEdgeDelay(n,t));if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=Iu.Playlist.seekable(t,i,Iu.Playlist.liveEdgeDelay(n,t))).length)return}var a,s;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),s=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=Ss.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)0&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}},i.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()},i.master=function(){return this.masterPlaylistLoader_.master},i.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},i.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)},i.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};t.video=t.main;var i=hu(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||Y)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r)&&(n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||Y,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),n.audio||n.video){var a,s={};if(["video","audio"].forEach((function(e){if(n.hasOwnProperty(e)&&(r=t[e].isFmp4,o=n[e],!(r?W(o):X(o)))){var i=t[e].isFmp4?"browser":"muxer";s[i]=s[i]||[],s[i].push(n[e]),"audio"===e&&(a=i)}var r,o})),r&&a&&this.media().attributes.AUDIO){var o=this.media().attributes.AUDIO;this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===o&&t!==e.media()&&(t.excludeUntil=1/0)})),this.logger_("excluding audio group "+o+" as "+a+' does not support codec(s): "'+n.audio+'"')}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var u=[];if(["video","audio"].forEach((function(t){var i=(V(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(V(n[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&u.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+n[t]+'"')})),u.length)return void this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+u.join(", ")+".",blacklistDuration:1/0,internal:!0})}return n}var l=Object.keys(s).reduce((function(e,t){return e&&(e+=", "),e+(t+' does not support codec(s): "')+s[t].join(",")+'"'}),"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:l,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},i.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}},i.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,i=[];Object.keys(t).forEach((function(n){var r=t[n];if(-1===i.indexOf(r.id)){i.push(r.id);var a=hu(e.master,r),s=[];!a.audio||X(a.audio)||W(a.audio)||s.push("audio codec "+a.audio),!a.video||X(a.video)||W(a.video)||s.push("video codec "+a.video),a.text&&"stpp.ttml.im1t"===a.text&&s.push("text codec "+a.text),s.length&&(r.excludeUntil=1/0,e.logger_("excluding "+r.id+" for unsupported: "+s.join(", ")))}}))},i.excludeIncompatibleVariants_=function(e){var t=this,i=[],n=this.master().playlists,r=lu(V(e)),a=cu(r),s=r.video&&V(r.video)[0]||null,o=r.audio&&V(r.audio)[0]||null;Object.keys(n).forEach((function(e){var r=n[e];if(-1===i.indexOf(r.id)&&r.excludeUntil!==1/0){i.push(r.id);var u=[],l=hu(t.masterPlaylistLoader_.master,r),c=cu(l);if(l.audio||l.video){if(c!==a&&u.push('codec count "'+c+'" !== "'+a+'"'),!t.sourceUpdater_.canChangeType()){var h=l.video&&V(l.video)[0]||null,d=l.audio&&V(l.audio)[0]||null;h&&s&&h.type.toLowerCase()!==s.type.toLowerCase()&&u.push('video codec "'+h.type+'" !== "'+s.type+'"'),d&&o&&d.type.toLowerCase()!==o.type.toLowerCase()&&u.push('audio codec "'+d.type+'" !== "'+o.type+'"')}u.length&&(r.excludeUntil=1/0,t.logger_("blacklisting "+r.id+": "+u.join(" && ")))}}}))},i.updateAdCues_=function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i){if(void 0===i&&(i=0),e.segments)for(var n,a=i,s=0;s0&&this.logger_("resetting possible stalled download count for "+e+" loader"),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var i=0;i=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),i=this.tech_.currentTime();if(this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){var n=t.start(0);e=n+(n===t.end(0)?0:Ps)}if(void 0!==e)return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+Os(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;for(var r=this.masterPlaylistController_.sourceUpdater_,a=this.tech_.buffered(),s=r.audioBuffer?r.audioBuffered():null,o=r.videoBuffer?r.videoBuffered():null,u=this.media(),l=u.partTargetDuration?u.partTargetDuration:2*(u.targetDuration-As),c=[s,o],h=0;h "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"}),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;var a=Rs(r,t);if(a.length>0){var s=a.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+a.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1},t.afterSeekableWindow_=function(e,t,i,n){if(void 0===n&&(n=!1),!e.length)return!1;var r=e.end(e.length-1)+Ps;return!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:a}}return null},e}(),ml={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},gl=function e(t,i){var n=0,r=0,a=Ss.mergeOptions(ml,i);t.ready((function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})}));var s=function(){r&&t.currentTime(r)},o=function(e){null!=e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},u=function(){return Date.now()-n<1e3*a.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):a.getSource&&"function"==typeof a.getSource?(n=Date.now(),a.getSource.call(t,o)):void Ss.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},l=function e(){t.off("loadedmetadata",s),t.off("error",u),t.off("dispose",e)};t.on("error",u),t.on("dispose",l),t.reloadSourceOnError=function(i){l(),e(t,i)}},vl="2.12.0",_l={PlaylistLoader:vo,Playlist:io,utils:Po,STANDARD_PLAYLIST_SELECTOR:_u,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(io.isEnabled);return mu(t,(function(e,t){return gu(e,t)})),t.filter((function(t){return!!hu(e.playlists.master,t).video}))[0]||null},lastBandwidthSelector:_u,movingAverageBandwidthSelector:function(e){var t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var n=this.useDevicePixelRatio&&r().devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),vu(this.playlists.master,t,parseInt(fu(this.tech_.el(),"width"),10)*n,parseInt(fu(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:gu,comparePlaylistResolution:function(e,t){var i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||r().Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),i===(n=n||r().Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:To()};Object.keys(Bo).forEach((function(e){Object.defineProperty(_l,e,{get:function(){return Ss.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),Bo[e]},set:function(t){Ss.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?Ss.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):Bo[e]=t}})}));var yl="videojs-vhs",bl=function(e,t){for(var i=t.media(),n=-1,r=0;r=i&&e>=i?Math.max(e,n):n}return e},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){Ss.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return i.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return i.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return i.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return Ms(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return Ms(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!r().localStorage)return!1;var t=Tl();t=t?Ss.mergeOptions(t,e):e;try{r().localStorage.setItem(yl,JSON.stringify(t))}catch(e){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var e;(e=i).representations=function(){var t=e.masterPlaylistController_.master(),i=to(t)?e.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((function(e){return!Ks(e)})).map((function(t,i){return new dl(e,t,t.id)})):[]}})),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",(function(){i.setupEme_()})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.masterPlaylistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=r().URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},i.setupEme_=function(){var e,t,i,n=this,r=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,a=(e={player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:r&&r.media()},t=e.player,!(!(i=function(e,t,i){if(!e)return e;var n={};t&&t.attributes&&t.attributes.CODECS&&(n=lu(V(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);var r=q(n.video),a=q(n.audio),s={};for(var o in e)s[o]={},a&&(s[o].audioContentType=a),r&&(s[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(s[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(s[o].url=e[o]);return Ss.mergeOptions(e,s)}(e.sourceKeySystems,e.media,e.audioMedia))||(t.currentSource().keySystems=i,i&&!t.eme&&(Ss.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1))));this.player_.tech_.on("keystatuschange",(function(e){"output-restricted"===e.status&&n.masterPlaylistController_.blacklistCurrentPlaylist({playlist:n.masterPlaylistController_.media(),message:"DRM keystatus changed to "+e.status+". Playlist will fail to play. Check for HDCP content.",blacklistDuration:1/0})})),11!==Ss.browser.IE_VERSION&&a?(this.logger_("waiting for EME key session creation"),function(e){var t=e.player,i=e.sourceKeySystems,n=e.audioMedia,r=e.mainPlaylists;if(!t.eme.initializeMediaKeys)return Promise.resolve();var a,s,o=(a=n?r.concat([n]):r,s=Object.keys(i),a.reduce((function(e,t){if(!t.contentProtection)return e;var i=s.reduce((function(e,i){var n=t.contentProtection[i];return n&&n.pssh&&(e[i]={pssh:n.pssh}),e}),{});return Object.keys(i).length&&e.push(i),e}),[])),u=[],l=[];return o.forEach((function(e){l.push(new Promise((function(e,i){t.tech_.one("keysessioncreated",e)}))),u.push(new Promise((function(i,n){t.eme.initializeMediaKeys({keySystems:e},(function(e){e?n(e):i()}))})))})),Promise.race([Promise.all(u),Promise.race(l)])}({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:r&&r.media(),mainPlaylists:this.playlists.master.playlists}).then((function(){n.logger_("created EME key session"),n.masterPlaylistController_.sourceUpdater_.initializedEme()})).catch((function(e){n.logger_("error while creating EME key session",e),n.player_.error({message:"Failed to initialize media keys for EME",code:3})}))):this.masterPlaylistController_.sourceUpdater_.initializedEme()},i.setupQualityLevels_=function(){var e=this,t=Ss.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach((function(e){t.addQualityLevel(e)})),bl(t,i.playlists)})),this.playlists.on("mediachange",(function(){bl(e.qualityLevels_,e.playlists)})))},t.version=function(){return{"@videojs/http-streaming":vl,"mux.js":"5.14.1","mpd-parser":"0.19.2","m3u8-parser":"4.7.0","aes-decrypter":"3.1.2"}},i.version=function(){return this.constructor.version()},i.canChangeType=function(){return Wu.canChangeType()},i.play=function(){this.masterPlaylistController_.play()},i.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},i.duration=function(){return this.masterPlaylistController_.duration()},i.seekable=function(){return this.masterPlaylistController_.seekable()},i.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&r().URL.revokeObjectURL&&(r().URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),e.prototype.dispose.call(this)},i.convertToProgramTime=function(e,t){return function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===n)return r({message:"getProgramTime: playlist and time must be provided"});var a=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i,n=0,r=0;rn){if(e>n+.25*a.duration)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t);if(!a)return r({message:"valid programTime was not found"});if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)}({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},i.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),Do({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},t}(Ss.getComponent("Component")),Sl={name:"videojs-http-streaming",VERSION:vl,canHandleSource:function(e,t){void 0===t&&(t={});var i=Ss.mergeOptions(Ss.options,t);return Sl.canPlayType(e.type,i)},handleSource:function(e,t,i){void 0===i&&(i={});var n=Ss.mergeOptions(Ss.options,i);return t.vhs=new wl(e,t,n),Ss.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return Ss.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=To(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){void 0===t&&(t={});var i=Ss.mergeOptions(Ss.options,t).vhs.overrideNative,n=void 0===i?!Ss.browser.IS_ANY_SAFARI:i,r=Q(e);return!r||_l.supportsTypeNatively(r)&&!n?"":"maybe"}};W("avc1.4d400d,mp4a.40.2")&&Ss.getTech("Html5").registerSourceHandler(Sl,0),Ss.VhsHandler=wl,Object.defineProperty(Ss,"HlsHandler",{get:function(){return Ss.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),wl},configurable:!0}),Ss.VhsSourceHandler=Sl,Object.defineProperty(Ss,"HlsSourceHandler",{get:function(){return Ss.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),Sl},configurable:!0}),Ss.Vhs=_l,Object.defineProperty(Ss,"Hls",{get:function(){return Ss.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),_l},configurable:!0}),Ss.use||(Ss.registerComponent("Hls",_l),Ss.registerComponent("Vhs",_l)),Ss.options.vhs=Ss.options.vhs||{},Ss.options.hls=Ss.options.hls||{},Ss.getPlugin&&Ss.getPlugin("reloadSourceOnError")||(Ss.registerPlugin||Ss.plugin)("reloadSourceOnError",(function(e){gl(this,e)}));var El=Ss},154:function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t=400&&r.statusCode<=599){var s=a;if(t)if(n.TextDecoder){var o=(void 0===(u=r.headers&&r.headers["content-type"])&&(u=""),u.toLowerCase().split(";").reduce((function(e,t){var i=t.split("="),n=i[0],r=i[1];return"charset"===n.trim()?r.trim():e}),"utf-8"));try{s=new TextDecoder(o).decode(a)}catch(e){}}else s=String.fromCharCode.apply(null,new Uint8Array(a));e({cause:s})}else e(null,a);var u}}},603:function(e,t,i){"use strict";var n=i(908),r=i(154),a=i(376);function s(e,t,i){var n=e;return a(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=r({},t,{uri:e}),n.callback=i,n}function o(e,t,i){return u(t=s(e,t,i))}function u(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,n,r){t||(t=!0,e.callback(i,n,r))};function n(){var e=void 0;if(e=l.response?l.response:l.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(l),g)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(c),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,v)}function a(){if(!u){var t;clearTimeout(c),t=e.useXDR&&void 0===l.status?200:1223===l.status?204:l.status;var r=v,a=null;return 0!==t?(r={body:n(),statusCode:t,method:d,headers:{},url:h,rawRequest:l},l.getAllResponseHeaders&&(r.headers=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();void 0===t[n]?t[n]=r:Array.isArray(t[n])?t[n].push(r):t[n]=[t[n],r]})),t):t}(l.getAllResponseHeaders()))):a=new Error("Internal XMLHttpRequest Error"),i(a,r,r.body)}}var s,u,l=e.xhr||null;l||(l=e.cors||e.useXDR?new o.XDomainRequest:new o.XMLHttpRequest);var c,h=l.url=e.uri||e.url,d=l.method=e.method||"GET",p=e.body||e.data,f=l.headers=e.headers||{},m=!!e.sync,g=!1,v={body:void 0,headers:{},statusCode:0,method:d,url:h,rawRequest:l};if("json"in e&&!1!==e.json&&(g=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),p=JSON.stringify(!0===e.json?p:e.json))),l.onreadystatechange=function(){4===l.readyState&&setTimeout(a,0)},l.onload=a,l.onerror=r,l.onprogress=function(){},l.onabort=function(){u=!0},l.ontimeout=r,l.open(d,h,!m,e.username,e.password),m||(l.withCredentials=!!e.withCredentials),!m&&e.timeout>0&&(c=setTimeout((function(){if(!u){u=!0,l.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),l.setRequestHeader)for(s in f)f.hasOwnProperty(s)&&l.setRequestHeader(s,f[s]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(l.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(l),l.send(p||null),l}o.httpHandler=i(490),e.exports=o,e.exports.default=o,o.XMLHttpRequest=n.XMLHttpRequest||function(){},o.XDomainRequest="withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:n.XDomainRequest,function(e,t){for(var i=0;i=t+i||t?new java.lang.String(e,t,i)+"":e}function g(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}h.prototype.parseFromString=function(e,t){var i=this.options,n=new c,r=i.domBuilder||new d,s=i.errorHandler,o=i.locator,l=i.xmlns||{},h=/\/x?html?$/.test(t),p=h?a.HTML_ENTITIES:a.XML_ENTITIES;return o&&r.setDocumentLocator(o),n.errorHandler=function(e,t,i){if(!e){if(t instanceof d)return t;e=t}var n={},r=e instanceof Function;function a(t){var a=e[t];!a&&r&&(a=2==e.length?function(i){e(t,i)}:e),n[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+f(i))}||function(){}}return i=i||{},a("warning"),a("error"),a("fatalError"),n}(s,r,o),n.domBuilder=i.domBuilder||r,h&&(l[""]=u.HTML),l.xml=l.xml||u.XML,e&&"string"==typeof e?n.parse(e,l,p):n.errorHandler.error("invalid doc source"),r.doc},d.prototype={startDocument:function(){this.doc=(new o).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,n){var r=this.doc,a=r.createElementNS(e,i||t),s=n.length;g(this,a),this.currentElement=a,this.locator&&p(this.locator,a);for(var o=0;o=0))throw k(C,new Error(e.tagName+"@"+i));for(var r=t.length-1;n"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function F(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(F(e,t))return!0}while(e=e.nextSibling)}function B(){}function j(e,t,i,r){e&&e._inc++,i.namespaceURI===n.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function H(e,t,i){if(e&&e._inc){e._inc++;var n=t.childNodes;if(i)n[n.length++]=i;else{for(var r=t.firstChild,a=0;r;)n[a++]=r,r=r.nextSibling;n.length=a}}}function V(e,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:e.firstChild=n,n?n.previousSibling=i:e.lastChild=i,H(e.ownerDocument,e),t}function G(e,t,i){var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===b){var r=t.firstChild;if(null==r)return t;var a=t.lastChild}else r=a=t;var s=i?i.previousSibling:e.lastChild;r.previousSibling=s,a.nextSibling=i,s?s.nextSibling=r:e.firstChild=r,null==i?e.lastChild=a:i.previousSibling=a;do{r.parentNode=e}while(r!==a&&(r=r.nextSibling));return H(e.ownerDocument||e,e),t.nodeType==b&&(t.firstChild=t.lastChild=null),t}function q(){this._nsMap={}}function W(){}function X(){}function Y(){}function z(){}function K(){}function Q(){}function $(){}function J(){}function Z(){}function ee(){}function te(){}function ie(){}function ne(e,t){var i=[],n=9==this.nodeType&&this.documentElement||this,r=n.prefix,a=n.namespaceURI;if(a&&null==r&&null==(r=n.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return se(this,i,e,t,s),i.join("")}function re(e,t,i){var r=e.prefix||"",a=e.namespaceURI;if(!a)return!1;if("xml"===r&&a===n.XML||a===n.XMLNS)return!1;for(var s=i.length;s--;){var o=i[s];if(o.prefix===r)return o.namespace!==a}return!0}function ae(e,t,i){e.push(" ",t,'="',i.replace(/[<&"]/g,U),'"')}function se(e,t,i,r,a){if(a||(a=[]),r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case c:var s=e.attributes,o=s.length,u=e.firstChild,l=e.tagName,m=l;if(!(i=n.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var T,w=0;w=0;S--)if(""===(E=a[S]).prefix&&E.namespace===e.namespaceURI){T=E.namespace;break}if(T!==e.namespaceURI)for(S=a.length-1;S>=0;S--){var E;if((E=a[S]).namespace===e.namespaceURI){E.prefix&&(m=E.prefix+":"+l);break}}}t.push("<",m);for(var C=0;C"),i&&/^script$/i.test(l))for(;u;)u.data?t.push(u.data):se(u,t,i,r,a.slice()),u=u.nextSibling;else for(;u;)se(u,t,i,r,a.slice()),u=u.nextSibling;t.push("")}else t.push("/>");return;case _:case b:for(u=e.firstChild;u;)se(u,t,i,r,a.slice()),u=u.nextSibling;return;case h:return ae(t,e.name,e.value);case d:return t.push(e.data.replace(/[<&]/g,U).replace(/]]>/g,"]]>"));case p:return t.push("");case v:return t.push("\x3c!--",e.data,"--\x3e");case y:var A=e.publicId,P=e.systemId;if(t.push("");else if(P&&"."!=P)t.push(" SYSTEM ",P,">");else{var D=e.internalSubset;D&&t.push(" [",D,"]"),t.push(">")}return;case g:return t.push("");case f:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function oe(e,t,i){var n;switch(t.nodeType){case c:(n=t.cloneNode(!1)).ownerDocument=e;case b:break;case h:i=!0}if(n||(n=t.cloneNode(!1)),n.ownerDocument=e,n.parentNode=null,i)for(var r=t.firstChild;r;)n.appendChild(oe(e,r,i)),r=r.nextSibling;return n}function ue(e,t,i){var n=new t.constructor;for(var r in t){var a=t[r];"object"!=typeof a&&a!=n[r]&&(n[r]=a)}switch(t.childNodes&&(n.childNodes=new I),n.ownerDocument=e,n.nodeType){case c:var s=t.attributes,o=n.attributes=new D,u=s.length;o._ownerElement=n;for(var l=0;l0},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var n in i)if(i[n]==e)return n;t=t.nodeType==h?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&e in i)return i[e];t=t.nodeType==h?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},o(l,N),o(l,N.prototype),B.prototype={nodeName:"#document",nodeType:_,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==b){for(var i=e.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,t),i=n}return e}return null==this.documentElement&&e.nodeType==c&&(this.documentElement=e),G(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),V(this,e)},importNode:function(e,t){return oe(this,e,t)},getElementById:function(e){var t=null;return F(this.documentElement,(function(i){if(i.nodeType==c&&i.getAttribute("id")==e)return t=i,!0})),t},getElementsByClassName:function(e){var t=s(e);return new A(this,(function(i){var n=[];return t.length>0&&F(i.documentElement,(function(r){if(r!==i&&r.nodeType===c){var a=r.getAttribute("class");if(a){var o=e===a;if(!o){var u=s(a);o=t.every((l=u,function(e){return l&&-1!==l.indexOf(e)}))}o&&n.push(r)}}var l})),n}))},createElement:function(e){var t=new q;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new I,(t.attributes=new D)._ownerElement=t,t},createDocumentFragment:function(){var e=new ee;return e.ownerDocument=this,e.childNodes=new I,e},createTextNode:function(e){var t=new Y;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new z;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new K;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new te;return i.ownerDocument=this,i.tagName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new W;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Z;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new q,n=t.split(":"),r=i.attributes=new D;return i.childNodes=new I,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,r._ownerElement=i,i},createAttributeNS:function(e,t){var i=new W,n=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,i}},u(B,N),q.prototype={nodeType:c,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===b?this.insertBefore(e,null):function(e,t){var i=t.parentNode;if(i){var n=e.lastChild;i.removeChild(t),n=e.lastChild}return n=e.lastChild,t.parentNode=e,t.previousSibling=n,t.nextSibling=null,n?n.nextSibling=t:e.firstChild=t,e.lastChild=t,H(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new A(this,(function(t){var i=[];return F(t,(function(n){n===t||n.nodeType!=c||"*"!==e&&n.tagName!=e||i.push(n)})),i}))},getElementsByTagNameNS:function(e,t){return new A(this,(function(i){var n=[];return F(i,(function(r){r===i||r.nodeType!==c||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||n.push(r)})),n}))}},B.prototype.getElementsByTagName=q.prototype.getElementsByTagName,B.prototype.getElementsByTagNameNS=q.prototype.getElementsByTagNameNS,u(q,N),W.prototype.nodeType=h,u(W,N),X.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(S[E])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},u(X,N),Y.prototype={nodeName:"#text",nodeType:d,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},u(Y,X),z.prototype={nodeName:"#comment",nodeType:v},u(z,X),K.prototype={nodeName:"#cdata-section",nodeType:p},u(K,X),Q.prototype.nodeType=y,u(Q,N),$.prototype.nodeType=T,u($,N),J.prototype.nodeType=m,u(J,N),Z.prototype.nodeType=f,u(Z,N),ee.prototype.nodeName="#document-fragment",ee.prototype.nodeType=b,u(ee,N),te.prototype.nodeType=g,u(te,N),ie.prototype.serializeToString=function(e,t,i){return ne.call(e,t,i)},N.prototype.toString=ne;try{if(Object.defineProperty){function ce(e){switch(e.nodeType){case c:case b:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(ce(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(A.prototype,"length",{get:function(){return P(this),this.$$length}}),Object.defineProperty(N.prototype,"textContent",{get:function(){return ce(this)},set:function(e){switch(this.nodeType){case c:case b:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),le=function(e,t,i){e["$$"+t]=i}}}catch(e){}t.DocumentType=Q,t.DOMException=k,t.DOMImplementation=M,t.Element=q,t.Node=N,t.NodeList=I,t.XMLSerializer=ie},45:function(e,t,i){var n=i(167).freeze;t.XML_ENTITIES=n({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=n({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES},969:function(e,t,i){var n=i(146);n.DOMImplementation,n.XMLSerializer,t.DOMParser=i(129).DOMParser},925:function(e,t,i){var n=i(167).NAMESPACE,r=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,a=new RegExp("[\\-\\.0-9"+r.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),s=new RegExp("^"+r.source+a.source+"*(?::"+r.source+a.source+"*)?$");function o(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,o)}function u(){}function l(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function c(e,t,i,r,a,s){function o(e,t,n){i.attributeNames.hasOwnProperty(e)&&s.fatalError("Attribute "+e+" redefined"),i.addValue(e,t,n)}for(var u,l=++t,c=0;;){var h=e.charAt(l);switch(h){case"=":if(1===c)u=e.slice(t,l),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(s.warning('attribute value must after "="'),u=e.slice(t,l)),t=l+1,!((l=e.indexOf(h,t))>0))throw new Error("attribute value no end '"+h+"' match");o(u,d=e.slice(t,l).replace(/&#?\w+;/g,a),t-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');o(u,d=e.slice(t,l).replace(/&#?\w+;/g,a),t),s.warning('attribute "'+u+'" missed start quot('+h+")!!"),t=l+1,c=5}break;case"/":switch(c){case 0:i.setTagName(e.slice(t,l));case 5:case 6:case 7:c=7,i.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),0==c&&i.setTagName(e.slice(t,l)),l;case">":switch(c){case 0:i.setTagName(e.slice(t,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(d=e.slice(t,l)).slice(-1)&&(i.closed=!0,d=d.slice(0,-1));case 2:2===c&&(d=u),4==c?(s.warning('attribute "'+d+'" missed quot(")!'),o(u,d.replace(/&#?\w+;/g,a),t)):(n.isHTML(r[""])&&d.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),o(d,d,t));break;case 3:throw new Error("attribute value missed!!")}return l;case"€":h=" ";default:if(h<=" ")switch(c){case 0:i.setTagName(e.slice(t,l)),c=6;break;case 1:u=e.slice(t,l),c=2;break;case 4:var d=e.slice(t,l).replace(/&#?\w+;/g,a);s.warning('attribute "'+d+'" missed quot(")!!'),o(u,d,t);case 5:c=6}else switch(c){case 2:i.tagName,n.isHTML(r[""])&&u.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead2!!'),o(u,u,t),t=l,c=1;break;case 5:s.warning('attribute space is required"'+u+'"!!');case 6:c=1,t=l;break;case 3:c=4,t=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function h(e,t,i){for(var r=e.tagName,a=null,s=e.length;s--;){var o=e[s],u=o.qName,l=o.value;if((p=u.indexOf(":"))>0)var c=o.prefix=u.slice(0,p),h=u.slice(p+1),d="xmlns"===c&&h;else h=u,c=null,d="xmlns"===u&&"";o.localName=h,!1!==d&&(null==a&&(a={},f(i,i={})),i[d]=a[d]=l,o.uri=n.XMLNS,t.startPrefixMapping(d,l))}for(s=e.length;s--;)(c=(o=e[s]).prefix)&&("xml"===c&&(o.uri=n.XML),"xmlns"!==c&&(o.uri=i[c||""]));var p;(p=r.indexOf(":"))>0?(c=e.prefix=r.slice(0,p),h=e.localName=r.slice(p+1)):(c=null,h=e.localName=r);var m=e.uri=i[c||""];if(t.startElement(m,h,r,e),!e.closed)return e.currentNSMap=i,e.localNSMap=a,!0;if(t.endElement(m,h,r),a)for(c in a)t.endPrefixMapping(c)}function d(e,t,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var a=e.indexOf("",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(i)?(r.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,n),r.characters(s,0,s.length),a)}return t+1}function p(e,t,i,n){var r=n[i];return null==r&&((r=e.lastIndexOf(""))t?(i.comment(e,t+4,r-t-4),r+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var a=function(e,t){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=t,r.exec(e);i=r.exec(e);)if(n.push(i),i[1])return n}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],u=!1,l=!1;s>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],l=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(l=a[3][0]));var c=a[s-1];return i.startDTD(o,u,l),i.endDTD(),c.index+c[0].length}return-1}function g(e,t,i){var n=e.indexOf("?>",t);if(n){var r=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,i.processingInstruction(r[1],r[2]),n+2):-1}return-1}function v(){this.attributeNames={}}o.prototype=new Error,o.prototype.name=o.name,u.prototype={parse:function(e,t,i){var r=this.domBuilder;r.startDocument(),f(t,t={}),function(e,t,i,r,a){function s(e){var t=e.slice(1,-1);return t in i?i[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),i=56320+(1023&e);return String.fromCharCode(t,i)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(a.error("entity not found:"+e),e)}function u(t){if(t>E){var i=e.substring(E,t).replace(/&#?\w+;/g,s);T&&f(E),r.characters(i,0,t-E),E=t}}function f(t,i){for(;t>=y&&(i=b.exec(e));)_=i.index,y=_+i[0].length,T.lineNumber++;T.columnNumber=t-_+1}for(var _=0,y=0,b=/.*(?:\r\n?|\n)|.*$/g,T=r.locator,w=[{currentNSMap:t}],S={},E=0;;){try{var C=e.indexOf("<",E);if(C<0){if(!e.substr(E).match(/^\s*$/)){var x=r.doc,k=x.createTextNode(e.substr(E));x.appendChild(k),r.currentElement=k}return}switch(C>E&&u(C),e.charAt(C+1)){case"/":var I=e.indexOf(">",C+3),A=e.substring(C+2,I).replace(/[ \t\n\r]+$/g,""),P=w.pop();I<0?(A=e.substring(C+2).replace(/[\s<].*/,""),a.error("end tag name: "+A+" is not complete:"+P.tagName),I=C+1+A.length):A.match(/\sE?E=I:u(Math.max(C,E)+1)}}(e,t,i,r,this.errorHandler),r.endDocument()}},v.prototype={setTagName:function(e){if(!s.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!s.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},t.XMLReader=u,t.ParseError=o},144:function(e,t,i){var n,r=void 0!==i.g?i.g:"undefined"!=typeof window?window:{},a=i(893);"undefined"!=typeof document?n=document:(n=r["__GLOBAL_DOCUMENT_CACHE@4"])||(n=r["__GLOBAL_DOCUMENT_CACHE@4"]=a),e.exports=n},908:function(e,t,i){var n;n="undefined"!=typeof window?window:void 0!==i.g?i.g:"undefined"!=typeof self?self:{},e.exports=n},376:function(e){e.exports=function(e){if(!e)return!1;var i=t.call(e);return"[object Function]"===i||"function"==typeof e&&"[object RegExp]"!==i||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var t=Object.prototype.toString},537:function(e,t){function i(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return s[e];var i,a=String(e);return(i=n[a.toLowerCase()])?i:(i=r[a.toLowerCase()])||(1===a.length?a.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){var a;if(a=n[t.toLowerCase()])return a===i;if(a=r[t.toLowerCase()])return a===i}else if("number"==typeof t)return t===i;return!1}};var n=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(a=97;a<123;a++)n[String.fromCharCode(a)]=a-32;for(var a=48;a<58;a++)n[a-48]=a;for(a=1;a<13;a++)n["f"+a]=a+111;for(a=0;a<10;a++)n["numpad "+a]=a+96;var s=t.names=t.title={};for(a in n)s[n[a]]=a;for(var o in r)n[o]=r[o]},477:function(){window.createjs=window.createjs||{},createjs.extend=function(e,t){"use strict";function i(){this.constructor=e}return i.prototype=t.prototype,e.prototype=new i},window.createjs=window.createjs||{},createjs.promote=function(e,t){"use strict";var i=e.prototype,n=Object.getPrototypeOf&&Object.getPrototypeOf(i)||i.__proto__;if(n)for(var r in i[(t+="_")+"constructor"]=n.constructor,n)i.hasOwnProperty(r)&&"function"==typeof n[r]&&(i[t+r]=n[r]);return e},window.createjs=window.createjs||{},createjs.indexOf=function(e,t){"use strict";for(var i=0,n=e.length;i=0&&!e.propagationStopped;s--)a[s]._dispatchEvent(e,1+(0==s));for(s=1;s=.97*(e._interval-1)&&e._tick()},e._handleRAF=function(){e._timerId=null,e._setupTick(),e._tick()},e._handleTimeout=function(){e._timerId=null,e._setupTick(),e._tick()},e._setupTick=function(){if(null==e._timerId){var t=e.timingMode;if(t==e.RAF_SYNCHED||t==e.RAF){var i=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(i)return e._timerId=i(t==e.RAF?e._handleRAF:e._handleSynch),void(e._raf=!0)}e._raf=!1,e._timerId=setTimeout(e._handleTimeout,e._interval)}},e._tick=function(){var t=e.paused,i=e._getTime(),n=i-e._lastTime;if(e._lastTime=i,e._ticks++,t&&(e._pausedTicks++,e._pausedTime+=n),e.hasEventListener("tick")){var r=new createjs.Event("tick"),a=e.maxDelta;r.delta=a&&n>a?a:n,r.paused=t,r.time=i,r.runTime=i-e._pausedTime,e.dispatchEvent(r)}for(e._tickTimes.unshift(e._getTime()-i);e._tickTimes.length>100;)e._tickTimes.pop();for(e._times.unshift(i);e._times.length>100;)e._times.pop()};var t=window,i=t.performance.now||t.performance.mozNow||t.performance.msNow||t.performance.oNow||t.performance.webkitNow;e._getTime=function(){return(i&&i.call(t.performance)||(new Date).getTime())-e._startTime},createjs.Ticker=e}(),window.createjs=window.createjs||{},function(){"use strict";function e(e){this.readyState=e.readyState,this._video=e,this._canvas=null,this._lastTime=-1,this.readyState<2&&e.addEventListener("canplaythrough",this._videoReady.bind(this))}var t=e.prototype;t.getImage=function(){if(!(this.readyState<2)){var e=this._canvas,t=this._video;if(e||((e=this._canvas=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas")).width=t.videoWidth,e.height=t.videoHeight),t.readyState>=2&&t.currentTime!==this._lastTime){var i=e.getContext("2d");i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0,e.width,e.height),this._lastTime=t.currentTime}return e}},t._videoReady=function(){this.readyState=2},createjs.VideoBuffer=e}(),window.createjs=window.createjs||{},function(){"use strict";function e(e,t,i,n,r,a,s,o,u,l,c){this.Event_constructor(e,t,i),this.stageX=n,this.stageY=r,this.rawX=null==u?n:u,this.rawY=null==l?r:l,this.nativeEvent=a,this.pointerID=s,this.primary=!!o,this.relatedTarget=c}var t=createjs.extend(e,createjs.Event);t._get_localX=function(){return this.currentTarget.globalToLocal(this.rawX,this.rawY).x},t._get_localY=function(){return this.currentTarget.globalToLocal(this.rawX,this.rawY).y},t._get_isTouch=function(){return-1!==this.pointerID};try{Object.defineProperties(t,{localX:{get:t._get_localX},localY:{get:t._get_localY},isTouch:{get:t._get_isTouch}})}catch(e){}t.clone=function(){return new e(this.type,this.bubbles,this.cancelable,this.stageX,this.stageY,this.nativeEvent,this.pointerID,this.primary,this.rawX,this.rawY)},t.toString=function(){return"[MouseEvent (type="+this.type+" stageX="+this.stageX+" stageY="+this.stageY+")]"},createjs.MouseEvent=createjs.promote(e,"Event")}(),window.createjs=window.createjs||{},function(){"use strict";function e(e,t,i,n,r,a){this.setValues(e,t,i,n,r,a)}var t=e.prototype;e.DEG_TO_RAD=Math.PI/180,e.identity=null,t.setValues=function(e,t,i,n,r,a){return this.a=null==e?1:e,this.b=t||0,this.c=i||0,this.d=null==n?1:n,this.tx=r||0,this.ty=a||0,this},t.append=function(e,t,i,n,r,a){var s=this.a,o=this.b,u=this.c,l=this.d;return 1==e&&0==t&&0==i&&1==n||(this.a=s*e+u*t,this.b=o*e+l*t,this.c=s*i+u*n,this.d=o*i+l*n),this.tx=s*r+u*a+this.tx,this.ty=o*r+l*a+this.ty,this},t.prepend=function(e,t,i,n,r,a){var s=this.a,o=this.c,u=this.tx;return this.a=e*s+i*this.b,this.b=t*s+n*this.b,this.c=e*o+i*this.d,this.d=t*o+n*this.d,this.tx=e*u+i*this.ty+r,this.ty=t*u+n*this.ty+a,this},t.appendMatrix=function(e){return this.append(e.a,e.b,e.c,e.d,e.tx,e.ty)},t.prependMatrix=function(e){return this.prepend(e.a,e.b,e.c,e.d,e.tx,e.ty)},t.appendTransform=function(t,i,n,r,a,s,o,u,l){if(a%360)var c=a*e.DEG_TO_RAD,h=Math.cos(c),d=Math.sin(c);else h=1,d=0;return s||o?(s*=e.DEG_TO_RAD,o*=e.DEG_TO_RAD,this.append(Math.cos(o),Math.sin(o),-Math.sin(s),Math.cos(s),t,i),this.append(h*n,d*n,-d*r,h*r,0,0)):this.append(h*n,d*n,-d*r,h*r,t,i),(u||l)&&(this.tx-=u*this.a+l*this.c,this.ty-=u*this.b+l*this.d),this},t.prependTransform=function(t,i,n,r,a,s,o,u,l){if(a%360)var c=a*e.DEG_TO_RAD,h=Math.cos(c),d=Math.sin(c);else h=1,d=0;return(u||l)&&(this.tx-=u,this.ty-=l),s||o?(s*=e.DEG_TO_RAD,o*=e.DEG_TO_RAD,this.prepend(h*n,d*n,-d*r,h*r,0,0),this.prepend(Math.cos(o),Math.sin(o),-Math.sin(s),Math.cos(s),t,i)):this.prepend(h*n,d*n,-d*r,h*r,t,i),this},t.rotate=function(t){t*=e.DEG_TO_RAD;var i=Math.cos(t),n=Math.sin(t),r=this.a,a=this.b;return this.a=r*i+this.c*n,this.b=a*i+this.d*n,this.c=-r*n+this.c*i,this.d=-a*n+this.d*i,this},t.skew=function(t,i){return t*=e.DEG_TO_RAD,i*=e.DEG_TO_RAD,this.append(Math.cos(i),Math.sin(i),-Math.sin(t),Math.cos(t),0,0),this},t.scale=function(e,t){return this.a*=e,this.b*=e,this.c*=t,this.d*=t,this},t.translate=function(e,t){return this.tx+=this.a*e+this.c*t,this.ty+=this.b*e+this.d*t,this},t.identity=function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},t.invert=function(){var e=this.a,t=this.b,i=this.c,n=this.d,r=this.tx,a=e*n-t*i;return this.a=n/a,this.b=-t/a,this.c=-i/a,this.d=e/a,this.tx=(i*this.ty-n*r)/a,this.ty=-(e*this.ty-t*r)/a,this},t.isIdentity=function(){return 0===this.tx&&0===this.ty&&1===this.a&&0===this.b&&0===this.c&&1===this.d},t.equals=function(e){return this.tx===e.tx&&this.ty===e.ty&&this.a===e.a&&this.b===e.b&&this.c===e.c&&this.d===e.d},t.transformPoint=function(e,t,i){return(i=i||{}).x=e*this.a+t*this.c+this.tx,i.y=e*this.b+t*this.d+this.ty,i},t.decompose=function(t){null==t&&(t={}),t.x=this.tx,t.y=this.ty,t.scaleX=Math.sqrt(this.a*this.a+this.b*this.b),t.scaleY=Math.sqrt(this.c*this.c+this.d*this.d);var i=Math.atan2(-this.c,this.d),n=Math.atan2(this.b,this.a);return Math.abs(1-i/n)<1e-5?(t.rotation=n/e.DEG_TO_RAD,this.a<0&&this.d>=0&&(t.rotation+=t.rotation<=0?180:-180),t.skewX=t.skewY=0):(t.skewX=i/e.DEG_TO_RAD,t.skewY=n/e.DEG_TO_RAD),t},t.copy=function(e){return this.setValues(e.a,e.b,e.c,e.d,e.tx,e.ty)},t.clone=function(){return new e(this.a,this.b,this.c,this.d,this.tx,this.ty)},t.toString=function(){return"[Matrix2D (a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+")]"},e.identity=new e,createjs.Matrix2D=e}(),window.createjs=window.createjs||{},function(){"use strict";function e(e,t,i,n,r){this.setValues(e,t,i,n,r)}var t=e.prototype;t.setValues=function(e,t,i,n,r){return this.visible=null==e||!!e,this.alpha=null==t?1:t,this.shadow=i,this.compositeOperation=n,this.matrix=r||this.matrix&&this.matrix.identity()||new createjs.Matrix2D,this},t.append=function(e,t,i,n,r){return this.alpha*=t,this.shadow=i||this.shadow,this.compositeOperation=n||this.compositeOperation,this.visible=this.visible&&e,r&&this.matrix.appendMatrix(r),this},t.prepend=function(e,t,i,n,r){return this.alpha*=t,this.shadow=this.shadow||i,this.compositeOperation=this.compositeOperation||n,this.visible=this.visible&&e,r&&this.matrix.prependMatrix(r),this},t.identity=function(){return this.visible=!0,this.alpha=1,this.shadow=this.compositeOperation=null,this.matrix.identity(),this},t.clone=function(){return new e(this.alpha,this.shadow,this.compositeOperation,this.visible,this.matrix.clone())},createjs.DisplayProps=e}(),window.createjs=window.createjs||{},function(){"use strict";function e(e,t){this.setValues(e,t)}var t=e.prototype;t.setValues=function(e,t){return this.x=e||0,this.y=t||0,this},t.copy=function(e){return this.x=e.x,this.y=e.y,this},t.clone=function(){return new e(this.x,this.y)},t.toString=function(){return"[Point (x="+this.x+" y="+this.y+")]"},createjs.Point=e}(),window.createjs=window.createjs||{},function(){"use strict";function e(e,t,i,n){this.setValues(e,t,i,n)}var t=e.prototype;t.setValues=function(e,t,i,n){return this.x=e||0,this.y=t||0,this.width=i||0,this.height=n||0,this},t.extend=function(e,t,i,n){return n=n||0,e+(i=i||0)>this.x+this.width&&(this.width=e+i-this.x),t+n>this.y+this.height&&(this.height=t+n-this.y),e=this.x&&e+i<=this.x+this.width&&t>=this.y&&t+n<=this.y+this.height},t.union=function(e){return this.clone().extend(e.x,e.y,e.width,e.height)},t.intersection=function(t){var i=t.x,n=t.y,r=i+t.width,a=n+t.height;return this.x>i&&(i=this.x),this.y>n&&(n=this.y),this.x+this.width0)for(r=this._images=[],t=0;t=e)break e;t++,this._frames.push({image:u,rect:new createjs.Rectangle(d,h,i,n),regX:this._regX,regY:this._regY}),d+=i+r}h+=n+r}this._numFrames=t}},createjs.SpriteSheet=createjs.promote(e,"EventDispatcher")}(),window.createjs=window.createjs||{},function(){"use strict";function e(){this.command=null,this._stroke=null,this._strokeStyle=null,this._oldStrokeStyle=null,this._strokeDash=null,this._oldStrokeDash=null,this._strokeIgnoreScale=!1,this._fill=null,this._instructions=[],this._commitIndex=0,this._activeInstructions=[],this._dirty=!1,this._storeIndex=0,this.clear()}var t=e.prototype,i=e;e.getRGB=function(e,t,i,n){return null!=e&&null==i&&(n=t,i=255&e,t=e>>8&255,e=e>>16&255),null==n?"rgb("+e+","+t+","+i+")":"rgba("+e+","+t+","+i+","+n+")"},e.getHSL=function(e,t,i,n){return null==n?"hsl("+e%360+","+t+"%,"+i+"%)":"hsla("+e%360+","+t+"%,"+i+"%,"+n+")"},e.BASE_64={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,a:26,b:27,c:28,d:29,e:30,f:31,g:32,h:33,i:34,j:35,k:36,l:37,m:38,n:39,o:40,p:41,q:42,r:43,s:44,t:45,u:46,v:47,w:48,x:49,y:50,z:51,0:52,1:53,2:54,3:55,4:56,5:57,6:58,7:59,8:60,9:61,"+":62,"/":63},e.STROKE_CAPS_MAP=["butt","round","square"],e.STROKE_JOINTS_MAP=["miter","round","bevel"];var n=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");n.getContext&&(e._ctx=n.getContext("2d"),n.width=n.height=1),t._getInstructions=function(){return this._updateInstructions(),this._instructions},t.getInstructions=createjs.deprecate(t._getInstructions,"Graphics.getInstructions");try{Object.defineProperties(t,{instructions:{get:t._getInstructions}})}catch(e){}t.isEmpty=function(){return!(this._instructions.length||this._activeInstructions.length)},t.draw=function(e,t){this._updateInstructions();for(var i=this._instructions,n=this._storeIndex,r=i.length;n>3,p=i[d];if(!p||3&h)throw"bad path data (@"+r+"): "+c;var f=n[d];d||(o=u=0),s.length=0,r++;for(var m=2+(h>>2&1),g=0;g>5?-1:1;v=(31&v)<<6|l[t.charAt(r+1)],3==m&&(v=v<<6|l[t.charAt(r+2)]),v=_*v/10,g%2?o=v+=o:u=v+=u,s[g]=v,r+=m}p.apply(this,s)}return this},t.store=function(){return this._updateInstructions(!0),this._storeIndex=this._instructions.length,this},t.unstore=function(){return this._storeIndex=0,this},t.clone=function(){var t=new e;return t.command=this.command,t._stroke=this._stroke,t._strokeStyle=this._strokeStyle,t._strokeDash=this._strokeDash,t._strokeIgnoreScale=this._strokeIgnoreScale,t._fill=this._fill,t._instructions=this._instructions.slice(),t._commitIndex=this._commitIndex,t._activeInstructions=this._activeInstructions.slice(),t._dirty=this._dirty,t._storeIndex=this._storeIndex,t},t.toString=function(){return"[Graphics]"},t.mt=t.moveTo,t.lt=t.lineTo,t.at=t.arcTo,t.bt=t.bezierCurveTo,t.qt=t.quadraticCurveTo,t.a=t.arc,t.r=t.rect,t.cp=t.closePath,t.c=t.clear,t.f=t.beginFill,t.lf=t.beginLinearGradientFill,t.rf=t.beginRadialGradientFill,t.bf=t.beginBitmapFill,t.ef=t.endFill,t.ss=t.setStrokeStyle,t.sd=t.setStrokeDash,t.s=t.beginStroke,t.ls=t.beginLinearGradientStroke,t.rs=t.beginRadialGradientStroke,t.bs=t.beginBitmapStroke,t.es=t.endStroke,t.dr=t.drawRect,t.rr=t.drawRoundRect,t.rc=t.drawRoundRectComplex,t.dc=t.drawCircle,t.de=t.drawEllipse,t.dp=t.drawPolyStar,t.p=t.decodePath,t._updateInstructions=function(t){var i=this._instructions,n=this._activeInstructions,r=this._commitIndex;if(this._dirty&&n.length){i.length=r,i.push(e.beginCmd);var a=n.length,s=i.length;i.length=s+a;for(var o=0;o=2)&&((this.style=e._ctx.createPattern(t,i||"")).props={image:t,repetition:i,type:"bitmap"}),this},t.path=!1,(t=(i.Stroke=function(e,t){this.style=e,this.ignoreScale=t}).prototype).exec=function(e){this.style&&(e.strokeStyle=this.style,this.ignoreScale&&(e.save(),e.setTransform(1,0,0,1,0,0)),e.stroke(),this.ignoreScale&&e.restore())},t.linearGradient=i.Fill.prototype.linearGradient,t.radialGradient=i.Fill.prototype.radialGradient,t.bitmap=i.Fill.prototype.bitmap,t.path=!1,(t=(i.StrokeStyle=function(e,t,i,n,r){this.width=e,this.caps=t,this.joints=i,this.miterLimit=n,this.ignoreScale=r}).prototype).exec=function(t){t.lineWidth=null==this.width?"1":this.width,t.lineCap=null==this.caps?"butt":isNaN(this.caps)?this.caps:e.STROKE_CAPS_MAP[this.caps],t.lineJoin=null==this.joints?"miter":isNaN(this.joints)?this.joints:e.STROKE_JOINTS_MAP[this.joints],t.miterLimit=null==this.miterLimit?"10":this.miterLimit,t.ignoreScale=null!=this.ignoreScale&&this.ignoreScale},t.path=!1,(i.StrokeDash=function(e,t){this.segments=e,this.offset=t||0}).prototype.exec=function(e){e.setLineDash&&(e.setLineDash(this.segments||i.StrokeDash.EMPTY_SEGMENTS),e.lineDashOffset=this.offset||0)},i.StrokeDash.EMPTY_SEGMENTS=[],(i.RoundRect=function(e,t,i,n,r,a,s,o){this.x=e,this.y=t,this.w=i,this.h=n,this.radiusTL=r,this.radiusTR=a,this.radiusBR=s,this.radiusBL=o}).prototype.exec=function(e){var t=(ut&&(c=t),h<0&&(h*=n=-1),h>t&&(h=t),d<0&&(d*=r=-1),d>t&&(d=t),p<0&&(p*=a=-1),p>t&&(p=t),e.moveTo(s+u-h,o),e.arcTo(s+u+h*n,o-h*n,s+u,o+h,h),e.lineTo(s+u,o+l-d),e.arcTo(s+u+d*r,o+l+d*r,s+u-d,o+l,d),e.lineTo(s+p,o+l),e.arcTo(s-p*a,o+l+p*a,s,o+l-p,p),e.lineTo(s,o+c),e.arcTo(s-c*i,o-c*i,s+c,o,c),e.closePath()},(i.Circle=function(e,t,i){this.x=e,this.y=t,this.radius=i}).prototype.exec=function(e){e.arc(this.x,this.y,this.radius,0,2*Math.PI)},(i.Ellipse=function(e,t,i,n){this.x=e,this.y=t,this.w=i,this.h=n}).prototype.exec=function(e){var t=this.x,i=this.y,n=this.w,r=this.h,a=.5522848,s=n/2*a,o=r/2*a,u=t+n,l=i+r,c=t+n/2,h=i+r/2;e.moveTo(t,h),e.bezierCurveTo(t,h-o,c-s,i,c,i),e.bezierCurveTo(c+s,i,u,h-o,u,h),e.bezierCurveTo(u,h+o,c+s,l,c,l),e.bezierCurveTo(c-s,l,t,h+o,t,h)},(i.PolyStar=function(e,t,i,n,r,a){this.x=e,this.y=t,this.radius=i,this.sides=n,this.pointSize=r,this.angle=a}).prototype.exec=function(e){var t=this.x,i=this.y,n=this.radius,r=(this.angle||0)/180*Math.PI,a=this.sides,s=1-(this.pointSize||0),o=Math.PI/a;e.moveTo(t+Math.cos(r)*n,i+Math.sin(r)*n);for(var u=0;u0&&0!=this.scaleX&&0!=this.scaleY)},t.draw=function(e,t){var i=this.bitmapCache;return!(!i||t)&&i.draw(e)},t.updateContext=function(t){var i=this,n=i.mask,r=i._props.matrix;n&&n.graphics&&!n.graphics.isEmpty()&&(n.getMatrix(r),t.transform(r.a,r.b,r.c,r.d,r.tx,r.ty),n.graphics.drawAsPath(t),t.clip(),r.invert(),t.transform(r.a,r.b,r.c,r.d,r.tx,r.ty)),this.getMatrix(r);var a=r.tx,s=r.ty;e._snapToPixelEnabled&&i.snapToPixel&&(a=a+(a<0?-.5:.5)|0,s=s+(s<0?-.5:.5)|0),t.transform(r.a,r.b,r.c,r.d,a,s),t.globalAlpha*=i.alpha,i.compositeOperation&&(t.globalCompositeOperation=i.compositeOperation),i.shadow&&this._applyShadow(t,i.shadow)},t.cache=function(e,t,i,n,r,a){this.bitmapCache||(this.bitmapCache=new createjs.BitmapCache),this.bitmapCache.define(this,e,t,i,n,r,a)},t.updateCache=function(e){if(!this.bitmapCache)throw"cache() must be called before updateCache()";this.bitmapCache.update(e)},t.uncache=function(){this.bitmapCache&&(this.bitmapCache.release(),this.bitmapCache=void 0)},t.getCacheDataURL=function(){return this.bitmapCache?this.bitmapCache.getDataURL():null},t.localToGlobal=function(e,t,i){return this.getConcatenatedMatrix(this._props.matrix).transformPoint(e,t,i||new createjs.Point)},t.globalToLocal=function(e,t,i){return this.getConcatenatedMatrix(this._props.matrix).invert().transformPoint(e,t,i||new createjs.Point)},t.localToLocal=function(e,t,i,n){return n=this.localToGlobal(e,t,n),i.globalToLocal(n.x,n.y,n)},t.setTransform=function(e,t,i,n,r,a,s,o,u){return this.x=e||0,this.y=t||0,this.scaleX=null==i?1:i,this.scaleY=null==n?1:n,this.rotation=r||0,this.skewX=a||0,this.skewY=s||0,this.regX=o||0,this.regY=u||0,this},t.getMatrix=function(e){var t=this,i=e&&e.identity()||new createjs.Matrix2D;return t.transformMatrix?i.copy(t.transformMatrix):i.appendTransform(t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.skewX,t.skewY,t.regX,t.regY)},t.getConcatenatedMatrix=function(e){for(var t=this,i=this.getMatrix(e);t=t.parent;)i.prependMatrix(t.getMatrix(t._props.matrix));return i},t.getConcatenatedDisplayProps=function(e){e=e?e.identity():new createjs.DisplayProps;var t=this,i=t.getMatrix(e.matrix);do{e.prepend(t.visible,t.alpha,t.shadow,t.compositeOperation),t!=this&&i.prependMatrix(t.getMatrix(t._props.matrix))}while(t=t.parent);return e},t.hitTest=function(t,i){var n=e._hitTestContext;n.setTransform(1,0,0,1,-t,-i),this.draw(n);var r=this._testHit(n);return n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,2,2),r},t.set=function(e){for(var t in e)this[t]=e[t];return this},t.getBounds=function(){if(this._bounds)return this._rectangle.copy(this._bounds);var e=this.cacheCanvas;if(e){var t=this._cacheScale;return this._rectangle.setValues(this._cacheOffsetX,this._cacheOffsetY,e.width/t,e.height/t)}return null},t.getTransformedBounds=function(){return this._getBounds()},t.setBounds=function(e,t,i,n){this._bounds=null!=e?(this._bounds||new createjs.Rectangle).setValues(e,t,i,n):e},t.clone=function(){return this._cloneProps(new e)},t.toString=function(){return"[DisplayObject (name="+this.name+")]"},t._updateState=null,t._cloneProps=function(e){return e.alpha=this.alpha,e.mouseEnabled=this.mouseEnabled,e.tickEnabled=this.tickEnabled,e.name=this.name,e.regX=this.regX,e.regY=this.regY,e.rotation=this.rotation,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.shadow=this.shadow,e.skewX=this.skewX,e.skewY=this.skewY,e.visible=this.visible,e.x=this.x,e.y=this.y,e.compositeOperation=this.compositeOperation,e.snapToPixel=this.snapToPixel,e.filters=null==this.filters?null:this.filters.slice(0),e.mask=this.mask,e.hitArea=this.hitArea,e.cursor=this.cursor,e._bounds=this._bounds,e},t._applyShadow=function(e,t){t=t||Shadow.identity,e.shadowColor=t.color,e.shadowOffsetX=t.offsetX,e.shadowOffsetY=t.offsetY,e.shadowBlur=t.blur},t._tick=function(e){var t=this._listeners;t&&t.tick&&(e.target=null,e.propagationStopped=e.immediatePropagationStopped=!1,this.dispatchEvent(e))},t._testHit=function(t){try{var i=t.getImageData(0,0,1,1).data[3]>1}catch(t){if(!e.suppressCrossDomainErrors)throw"An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images."}return i},t._getBounds=function(e,t){return this._transformBounds(this.getBounds(),e,t)},t._transformBounds=function(e,t,i){if(!e)return e;var n=e.x,r=e.y,a=e.width,s=e.height,o=this._props.matrix;o=i?o.identity():this.getMatrix(o),(n||r)&&o.appendTransform(0,0,1,1,0,0,0,-n,-r),t&&o.prependMatrix(t);var u=a*o.a,l=a*o.b,c=s*o.c,h=s*o.d,d=o.tx,p=o.ty,f=d,m=d,g=p,v=p;return(n=u+d)m&&(m=n),(n=u+c+d)m&&(m=n),(n=c+d)m&&(m=n),(r=l+p)v&&(v=r),(r=l+h+p)v&&(v=r),(r=h+p)v&&(v=r),e.setValues(f,g,m-f,v-g)},t._hasMouseEventListener=function(){for(var t=e._MOUSE_EVENTS,i=0,n=t.length;i0&&0!=this.scaleX&&0!=this.scaleY&&e)},t.draw=function(e,t){if(this.DisplayObject_draw(e,t))return!0;for(var i=this.children.slice(),n=0,r=i.length;n1){for(var i=0;ithis.children.length)return arguments[i-2];if(i>2){for(var r=0;r1){for(var i=!0,n=0;n1){for(var i=[],n=0;n=n)){for(var r=0;r0,1==i),n},t.getObjectUnderPoint=function(e,t,i){var n=this.localToGlobal(e,t);return this._getObjectsUnderPoint(n.x,n.y,null,i>0,1==i)},t.getBounds=function(){return this._getBounds(null,!0)},t.getTransformedBounds=function(){return this._getBounds()},t.clone=function(t){var i=this._cloneProps(new e);return t&&this._cloneChildren(i),i},t.toString=function(){return"[Container (name="+this.name+")]"},t._tick=function(e){if(this.tickChildren)for(var t=this.children.length-1;t>=0;t--){var i=this.children[t];i.tickEnabled&&i._tick&&i._tick(e)}this.DisplayObject__tick(e)},t._cloneChildren=function(e){e.children.length&&e.removeAllChildren();for(var t=e.children,i=0,n=this.children.length;ithis.children.length-1)return!1;var i=this.children[e];return i&&(i.parent=null),this.children.splice(e,1),t||i.dispatchEvent("removed"),!0},t._getObjectsUnderPoint=function(t,i,n,r,a,s){if(!(s=s||0)&&!this._testMask(this,t,i))return null;var o,u=createjs.DisplayObject._hitTestContext;a=a||r&&this._hasMouseEventListener();for(var l=this.children,c=l.length-1;c>=0;c--){var h=l[c],d=h.hitArea;if(h.visible&&(d||h.isVisible())&&(!r||h.mouseEnabled)&&(d||this._testMask(h,t,i)))if(!d&&h instanceof e){var p=h._getObjectsUnderPoint(t,i,n,r,a,s+1);if(!n&&p)return r&&!this.mouseChildren?this:p}else{if(r&&!a&&!h._hasMouseEventListener())continue;var f=h.getConcatenatedDisplayProps(h._props);if(o=f.matrix,d&&(o.appendMatrix(d.getMatrix(d._props.matrix)),f.alpha=d.alpha),u.globalAlpha=f.alpha,u.setTransform(o.a,o.b,o.c,o.d,o.tx-t,o.ty-i),(d||h).draw(u),!this._testHit(u))continue;if(u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,2,2),!n)return r&&!this.mouseChildren?this:h;n.push(h)}}return null},t._testMask=function(e,t,i){var n=e.mask;if(!n||!n.graphics||n.graphics.isEmpty())return!0;var r=this._props.matrix,a=e.parent;r=a?a.getConcatenatedMatrix(r):r.identity(),r=n.getMatrix(n._props.matrix).prependMatrix(r);var s=createjs.DisplayObject._hitTestContext;return s.setTransform(r.a,r.b,r.c,r.d,r.tx-t,r.ty-i),n.graphics.drawAsPath(s),s.fillStyle="#000",s.fill(),!!this._testHit(s)&&(s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,2,2),!0)},t._getBounds=function(e,t){var i=this.DisplayObject_getBounds();if(i)return this._transformBounds(i,e,t);var n=this._props.matrix;n=t?n.identity():this.getMatrix(n),e&&n.prependMatrix(e);for(var r=this.children.length,a=null,s=0;s=0&&n>=0&&i<=a-1&&n<=s-1)?(o.x=i,o.y=n):this.mouseMoveOutside&&(o.x=i<0?0:i>a-1?a-1:i,o.y=n<0?0:n>s-1?s-1:n),o.posEvtObj=t,o.rawX=i,o.rawY=n,e!==this._primaryPointerID&&-1!==e||(this.mouseX=o.x,this.mouseY=o.y,this.mouseInBounds=o.inBounds)},t._handleMouseUp=function(e){this._handlePointerUp(-1,e,!1)},t._handlePointerUp=function(e,t,i,n){var r=this._nextStage,a=this._getPointerData(e);if(!this._prevStage||void 0!==n){var s=null,o=a.target;n||!o&&!r||(s=this._getObjectsUnderPoint(a.x,a.y,null,!0)),a.down&&(this._dispatchMouseEvent(this,"stagemouseup",!1,e,a,t,s),a.down=!1),s==o&&this._dispatchMouseEvent(o,"click",!0,e,a,t),this._dispatchMouseEvent(o,"pressup",!0,e,a,t),i?(e==this._primaryPointerID&&(this._primaryPointerID=null),delete this._pointerData[e]):a.target=null,r&&r._handlePointerUp(e,t,i,n||s&&this)}},t._handleMouseDown=function(e){this._handlePointerDown(-1,e,e.pageX,e.pageY)},t._handlePointerDown=function(e,t,i,n,r){this.preventSelection&&t.preventDefault(),null!=this._primaryPointerID&&-1!==e||(this._primaryPointerID=e),null!=n&&this._updatePointerPosition(e,t,i,n);var a=null,s=this._nextStage,o=this._getPointerData(e);r||(a=o.target=this._getObjectsUnderPoint(o.x,o.y,null,!0)),o.inBounds&&(this._dispatchMouseEvent(this,"stagemousedown",!1,e,o,t,a),o.down=!0),this._dispatchMouseEvent(a,"mousedown",!0,e,o,t),s&&s._handlePointerDown(e,t,i,n,r||a&&this)},t._testMouseOver=function(e,t,i){if(!this._prevStage||void 0!==t){var n=this._nextStage;if(this._mouseOverIntervalID){var r=this._getPointerData(-1);if(r&&(e||this.mouseX!=this._mouseOverX||this.mouseY!=this._mouseOverY||!this.mouseInBounds)){var a,s,o,u=r.posEvtObj,l=i||u&&u.target==this.canvas,c=null,h=-1,d="";!t&&(e||this.mouseInBounds&&l)&&(c=this._getObjectsUnderPoint(this.mouseX,this.mouseY,null,!0),this._mouseOverX=this.mouseX,this._mouseOverY=this.mouseY);var p=this._mouseOverTarget||[],f=p[p.length-1],m=this._mouseOverTarget=[];for(a=c;a;)m.unshift(a),d||(d=a.cursor),a=a.parent;for(this.canvas.style.cursor=d,!t&&i&&(i.canvas.style.cursor=d),s=0,o=m.length;sh;s--)this._dispatchMouseEvent(p[s],"rollout",!1,-1,r,u,c);for(s=m.length-1;s>h;s--)this._dispatchMouseEvent(m[s],"rollover",!1,-1,r,u,f);f!=c&&this._dispatchMouseEvent(c,"mouseover",!0,-1,r,u,f),n&&n._testMouseOver(e,t||c&&this,i||l&&this)}}else n&&n._testMouseOver(e,t,i)}},t._handleDoubleClick=function(e,t){var i=null,n=this._nextStage,r=this._getPointerData(-1);t||(i=this._getObjectsUnderPoint(r.x,r.y,null,!0),this._dispatchMouseEvent(i,"dblclick",!0,-1,r,e)),n&&n._handleDoubleClick(e,t||i&&this)},t._dispatchMouseEvent=function(e,t,i,n,r,a,s){if(e&&(i||e.hasEventListener(t))){var o=new createjs.MouseEvent(t,i,!1,r.x,r.y,a,n,n===this._primaryPointerID||-1===n,r.rawX,r.rawY,s);e.dispatchEvent(o)}},createjs.Stage=createjs.promote(e,"Container")}(),window.createjs=window.createjs||{},function(){"use strict";function e(t,i){if(this.Stage_constructor(t),void 0!==i){if("object"!=typeof i)throw"Invalid options object";var n=i.premultiply,r=i.transparent,a=i.antialias,s=i.preserveBuffer,o=i.autoPurge}this.vocalDebug=!1,this._preserveBuffer=s||!1,this._antialias=a||!1,this._transparent=r||!1,this._premultiply=n||!1,this._autoPurge=void 0,this.autoPurge=o,this._viewportWidth=0,this._viewportHeight=0,this._projectionMatrix=null,this._webGLContext=null,this._clearColor={r:.5,g:.5,b:.5,a:0},this._maxCardsPerBatch=e.DEFAULT_MAX_BATCH_SIZE,this._activeShader=null,this._vertices=null,this._vertexPositionBuffer=null,this._uvs=null,this._uvPositionBuffer=null,this._indices=null,this._textureIndexBuffer=null,this._alphas=null,this._alphaBuffer=null,this._textureDictionary=[],this._textureIDs={},this._batchTextures=[],this._baseTextures=[],this._batchTextureCount=8,this._lastTextureInsert=-1,this._batchID=0,this._drawID=0,this._slotBlacklist=[],this._isDrawing=0,this._lastTrackedCanvas=0,this.isCacheControlled=!1,this._cacheContainer=new createjs.Container,this._initializeWebGL()}var t=createjs.extend(e,createjs.Stage);e.buildUVRects=function(e,t,i){if(!e||!e._frames)return null;void 0===t&&(t=-1),void 0===i&&(i=!1);for(var n=-1!=t&&i?t:0,r=-1!=t&&i?t+1:e._frames.length,a=n;athis._maxTextureSlots||e<0)throw"Slot outside of acceptable range";this._slotBlacklist[e]=!!t},t.getTargetRenderTexture=function(e,t,i){var n,r=!1,a=this._webGLContext;if(void 0!==e.__lastRT&&e.__lastRT===e.__rtA&&(r=!0),r?(void 0===e.__rtB?e.__rtB=this.getRenderBufferTexture(t,i):(t==e.__rtB._width&&i==e.__rtB._height||this.resizeTexture(e.__rtB,t,i),this.setTextureParams(a)),n=e.__rtB):(void 0===e.__rtA?e.__rtA=this.getRenderBufferTexture(t,i):(t==e.__rtA._width&&i==e.__rtA._height||this.resizeTexture(e.__rtA,t,i),this.setTextureParams(a)),n=e.__rtA),!n)throw"Problems creating render textures, known causes include using too much VRAM by not releasing WebGL texture instances";return e.__lastRT=n,n},t.releaseTexture=function(e){var t,i;if(e){if(e.children)for(t=0,i=e.children.length;t0?e:1)||1,n=Math.ceil(t>0?t:1)||1,r=this._webGLContext,a=r.createTexture();return this.resizeTexture(a,i,n),this.setTextureParams(r,!1),a},t.resizeTexture=function(e,t,i){var n=this._webGLContext;n.bindTexture(n.TEXTURE_2D,e),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t,i,0,n.RGBA,n.UNSIGNED_BYTE,null),e.width=t,e.height=i},t.getRenderBufferTexture=function(e,t){var i=this._webGLContext,n=this.getBaseTexture(e,t);if(!n)return null;var r=i.createFramebuffer();return r?(n.width=e,n.height=t,i.bindFramebuffer(i.FRAMEBUFFER,r),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,n,0),r._renderTexture=n,n._frameBuffer=r,n._storeID=this._textureDictionary.length,this._textureDictionary[n._storeID]=n,i.bindFramebuffer(i.FRAMEBUFFER,null),n):null},t.setTextureParams=function(e,t){t&&this._antialias?(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR)):(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST)),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)},t.setClearColor=function(e){var t,i,n,r,a;"string"==typeof e?0==e.indexOf("#")?(4==e.length&&(e="#"+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)+e.charAt(3)+e.charAt(3)),t=Number("0x"+e.slice(1,3))/255,i=Number("0x"+e.slice(3,5))/255,n=Number("0x"+e.slice(5,7))/255,r=Number("0x"+e.slice(7,9))/255):0==e.indexOf("rgba(")&&(a=e.slice(5,-1).split(","),t=Number(a[0])/255,i=Number(a[1])/255,n=Number(a[2])/255,r=Number(a[3])):(t=((4278190080&e)>>>24)/255,i=((16711680&e)>>>16)/255,n=((65280&e)>>>8)/255,r=(255&e)/255),this._clearColor.r=t||0,this._clearColor.g=i||0,this._clearColor.b=n||0,this._clearColor.a=r||0,this._webGLContext&&this._webGLContext.clearColor(this._clearColor.r,this._clearColor.g,this._clearColor.b,this._clearColor.a)},t.toString=function(){return"[StageGL (name="+this.name+")]"},t._fetchWebGLContext=function(e,t){var i;try{i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t)}catch(e){}if(i)i.viewportWidth=e.width,i.viewportHeight=e.height;else{var n="Could not initialize WebGL";console.error?console.error(n):console.log(n)}return i},t._fetchShaderProgram=function(t,i,n,r,a){var s,o;switch(t.useProgram(null),i){case"filter":o=e.COVER_VERTEX_HEADER+(n||e.COVER_VERTEX_BODY),s=e.COVER_FRAGMENT_HEADER+(r||e.COVER_FRAGMENT_BODY);break;case"particle":o=e.REGULAR_VERTEX_HEADER+e.PARTICLE_VERTEX_BODY,s=e.REGULAR_FRAGMENT_HEADER+e.PARTICLE_FRAGMENT_BODY;break;case"override":o=e.REGULAR_VERTEX_HEADER+(n||e.REGULAR_VERTEX_BODY),s=e.REGULAR_FRAGMENT_HEADER+(r||e.REGULAR_FRAGMENT_BODY);break;default:o=e.REGULAR_VERTEX_HEADER+e.REGULAR_VERTEX_BODY,s=e.REGULAR_FRAGMENT_HEADER+e.REGULAR_FRAGMENT_BODY}var u=this._createShader(t,t.VERTEX_SHADER,o),l=this._createShader(t,t.FRAGMENT_SHADER,s),c=t.createProgram();if(t.attachShader(c,u),t.attachShader(c,l),t.linkProgram(c),c._type=i,!t.getProgramParameter(c,t.LINK_STATUS))throw t.useProgram(this._activeShader),t.getProgramInfoLog(c);if(t.useProgram(c),"filter"===i)c.vertexPositionAttribute=t.getAttribLocation(c,"vertexPosition"),t.enableVertexAttribArray(c.vertexPositionAttribute),c.uvPositionAttribute=t.getAttribLocation(c,"uvPosition"),t.enableVertexAttribArray(c.uvPositionAttribute),c.samplerUniform=t.getUniformLocation(c,"uSampler"),t.uniform1i(c.samplerUniform,0),c.uprightUniform=t.getUniformLocation(c,"uUpright"),t.uniform1f(c.uprightUniform,0),a&&a(t,this,c);else{c.vertexPositionAttribute=t.getAttribLocation(c,"vertexPosition"),t.enableVertexAttribArray(c.vertexPositionAttribute),c.uvPositionAttribute=t.getAttribLocation(c,"uvPosition"),t.enableVertexAttribArray(c.uvPositionAttribute),c.textureIndexAttribute=t.getAttribLocation(c,"textureIndex"),t.enableVertexAttribArray(c.textureIndexAttribute),c.alphaAttribute=t.getAttribLocation(c,"objectAlpha"),t.enableVertexAttribArray(c.alphaAttribute);for(var h=[],d=0;de.MAX_TEXTURE_SIZE||t.height>e.MAX_TEXTURE_SIZE)&&console&&console.error("Oversized Texture: "+t.width+"x"+t.height+" vs "+e.MAX_TEXTURE_SIZE+"max"))},t._insertTextureInBatch=function(e,t){if(this._batchTextures[t._activeIndex]!==t){var i=-1,n=(this._lastTextureInsert+1)%this._batchTextureCount,r=n;do{if(this._batchTextures[r]._batchID!=this._batchID&&!this._slotBlacklist[r]){i=r;break}r=(r+1)%this._batchTextureCount}while(r!==n);-1===i&&(this.batchReason="textureOverflow",this._drawBuffers(e),this.batchCardCount=0,i=n),this._batchTextures[i]=t,t._activeIndex=i,(a=t._imageData)&&a._invalid&&void 0!==t._drawID?this._updateTextureImageData(e,a):(e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,t),this.setTextureParams(e)),this._lastTextureInsert=i}else{var a=t._imageData;null!=t._storeID&&a&&a._invalid&&this._updateTextureImageData(e,a)}t._drawID=this._drawID,t._batchID=this._batchID},t._killTextureObject=function(e){if(e){var t=this._webGLContext;if(void 0!==e._storeID&&e._storeID>=0){for(var i in this._textureDictionary[e._storeID]=void 0,this._textureIDs)this._textureIDs[i]==e._storeID&&delete this._textureIDs[i];e._imageData&&(e._imageData._storeID=void 0),e._imageData=e._storeID=void 0}void 0!==e._activeIndex&&this._batchTextures[e._activeIndex]===e&&(this._batchTextures[e._activeIndex]=this._baseTextures[e._activeIndex]);try{e._frameBuffer&&t.deleteFramebuffer(e._frameBuffer),e._frameBuffer=void 0}catch(e){this.vocalDebug&&console.log(e)}try{t.deleteTexture(e)}catch(e){this.vocalDebug&&console.log(e)}}},t._backupBatchTextures=function(e,t){var i=this._webGLContext;this._backupTextures||(this._backupTextures=[]),void 0===t&&(t=this._backupTextures);for(var n=0;n0&&this._drawBuffers(t),this._isDrawing++,this._drawID++,this.batchCardCount=0,this.depth=0,this._appendToBatchGroup(e,t,new createjs.Matrix2D,this.alpha,i),this.batchReason="drawFinish",this._drawBuffers(t),this._isDrawing--},t._cacheDraw=function(e,t,i,n){var r,a=this._activeShader,s=this._slotBlacklist,o=this._maxTextureSlots-1,u=this._viewportWidth,l=this._viewportHeight;this.protectTextureSlot(o,!0);var c=t.getMatrix();(c=c.clone()).scale(1/n.scale,1/n.scale),(c=c.invert()).translate(-n.offX/n.scale*t.scaleX,-n.offY/n.scale*t.scaleY);var h=this._cacheContainer;h.children=[t],h.transformMatrix=c,this._backupBatchTextures(!1),i&&i.length?this._drawFilters(t,i,n):this.isCacheControlled?(e.clear(e.COLOR_BUFFER_BIT),this._batchDraw(h,e,!0)):(e.activeTexture(e.TEXTURE0+o),t.cacheCanvas=this.getTargetRenderTexture(t,n._drawWidth,n._drawHeight),r=t.cacheCanvas,e.bindFramebuffer(e.FRAMEBUFFER,r._frameBuffer),this.updateViewport(n._drawWidth,n._drawHeight),this._projectionMatrix=this._projectionMatrixFlip,e.clear(e.COLOR_BUFFER_BIT),this._batchDraw(h,e,!0),e.bindFramebuffer(e.FRAMEBUFFER,null),this.updateViewport(u,l)),this._backupBatchTextures(!0),this.protectTextureSlot(o,!1),this._activeShader=a,this._slotBlacklist=s},t._drawFilters=function(e,t,i){var n,r=this._webGLContext,a=this._maxTextureSlots-1,s=this._viewportWidth,o=this._viewportHeight,u=this._cacheContainer,l=t.length;r.activeTexture(r.TEXTURE0+a),n=this.getTargetRenderTexture(e,i._drawWidth,i._drawHeight),r.bindFramebuffer(r.FRAMEBUFFER,n._frameBuffer),this.updateViewport(i._drawWidth,i._drawHeight),r.clear(r.COLOR_BUFFER_BIT),this._batchDraw(u,r,!0),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n),this.setTextureParams(r);var c=!1,h=0,d=t[h];do{this._activeShader=this.getFilterShader(d),this._activeShader&&(r.activeTexture(r.TEXTURE0+a),n=this.getTargetRenderTexture(e,i._drawWidth,i._drawHeight),r.bindFramebuffer(r.FRAMEBUFFER,n._frameBuffer),r.viewport(0,0,i._drawWidth,i._drawHeight),r.clear(r.COLOR_BUFFER_BIT),this._drawCover(r,c),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n),this.setTextureParams(r),(l>1||t[0]._multiPass)&&(c=!c),d=null!==d._multiPass?d._multiPass:t[++h])}while(d);this.isCacheControlled?(r.bindFramebuffer(r.FRAMEBUFFER,null),this.updateViewport(s,o),this._activeShader=this.getFilterShader(this),r.clear(r.COLOR_BUFFER_BIT),this._drawCover(r,c)):(c&&(r.activeTexture(r.TEXTURE0+a),n=this.getTargetRenderTexture(e,i._drawWidth,i._drawHeight),r.bindFramebuffer(r.FRAMEBUFFER,n._frameBuffer),this._activeShader=this.getFilterShader(this),r.viewport(0,0,i._drawWidth,i._drawHeight),r.clear(r.COLOR_BUFFER_BIT),this._drawCover(r,!c)),r.bindFramebuffer(r.FRAMEBUFFER,null),this.updateViewport(s,o),e.cacheCanvas=n)},t._appendToBatchGroup=function(t,i,n,r,a){t._glMtx||(t._glMtx=new createjs.Matrix2D);var s,o,u,l,c=t._glMtx;c.copy(n),t.transformMatrix?c.appendMatrix(t.transformMatrix):c.appendTransform(t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.skewX,t.skewY,t.regX,t.regY);for(var h=t.children.length,d=0;dthis._maxCardsPerBatch&&(this.batchReason="vertexOverflow",this._drawBuffers(i),this.batchCardCount=0),p._glMtx||(p._glMtx=new createjs.Matrix2D);var f,m,g,v,_,y,b=p._glMtx;b.copy(c),p.transformMatrix?b.appendMatrix(p.transformMatrix):b.appendTransform(p.x,p.y,p.scaleX,p.scaleY,p.rotation,p.skewX,p.skewY,p.regX,p.regY);var T=p.cacheCanvas&&!a;if(2===p._webGLRenderStyle||T)g=!a&&p.cacheCanvas||p.image;else{if(1!==p._webGLRenderStyle)continue;if(null===(v=p.spriteSheet.getFrame(p.currentFrame)))continue;g=v.image}var w=this._uvs,S=this._vertices,E=this._indices,C=this._alphas;if(g){if(void 0===g._storeID)_=this._loadTextureImage(i,g),this._insertTextureInBatch(i,_);else{if(!(_=this._textureDictionary[g._storeID])){this.vocalDebug&&console.log("Texture should not be looked up while not being stored.");continue}_._batchID!==this._batchID&&this._insertTextureInBatch(i,_)}if(m=_._activeIndex,2===p._webGLRenderStyle||T)!T&&p.sourceRect?(p._uvRect||(p._uvRect={}),y=p.sourceRect,(f=p._uvRect).t=y.y/g.height,f.l=y.x/g.width,f.b=(y.y+y.height)/g.height,f.r=(y.x+y.width)/g.width,s=0,o=0,u=y.width+s,l=y.height+o):(f=e.UV_RECT,T?(s=(y=p.bitmapCache).x+y._filterOffX/y.scale,o=y.y+y._filterOffY/y.scale,u=y._drawWidth/y.scale+s,l=y._drawHeight/y.scale+o):(s=0,o=0,u=g.width+s,l=g.height+o));else if(1===p._webGLRenderStyle){var x=v.rect;(f=v.uvRect)||(f=e.buildUVRects(p.spriteSheet,p.currentFrame,!1)),s=-v.regX,o=-v.regY,u=x.width-v.regX,l=x.height-v.regY}var k=this.batchCardCount*e.INDICIES_PER_CARD,I=2*k;S[I]=s*b.a+o*b.c+b.tx,S[I+1]=s*b.b+o*b.d+b.ty,S[I+2]=s*b.a+l*b.c+b.tx,S[I+3]=s*b.b+l*b.d+b.ty,S[I+4]=u*b.a+o*b.c+b.tx,S[I+5]=u*b.b+o*b.d+b.ty,S[I+6]=S[I+2],S[I+7]=S[I+3],S[I+8]=S[I+4],S[I+9]=S[I+5],S[I+10]=u*b.a+l*b.c+b.tx,S[I+11]=u*b.b+l*b.d+b.ty,w[I]=f.l,w[I+1]=f.t,w[I+2]=f.l,w[I+3]=f.b,w[I+4]=f.r,w[I+5]=f.t,w[I+6]=f.l,w[I+7]=f.b,w[I+8]=f.r,w[I+9]=f.t,w[I+10]=f.r,w[I+11]=f.b,E[k]=E[k+1]=E[k+2]=E[k+3]=E[k+4]=E[k+5]=m,C[k]=C[k+1]=C[k+2]=C[k+3]=C[k+4]=C[k+5]=p.alpha*r,this.batchCardCount++}}else this._appendToBatchGroup(p,i,c,p.alpha*r)}},t._drawBuffers=function(t){if(!(this.batchCardCount<=0)){this.vocalDebug&&console.log("Draw["+this._drawID+":"+this._batchID+"] : "+this.batchReason);var i=this._activeShader,n=this._vertexPositionBuffer,r=this._textureIndexBuffer,a=this._uvPositionBuffer,s=this._alphaBuffer;t.useProgram(i),t.bindBuffer(t.ARRAY_BUFFER,n),t.vertexAttribPointer(i.vertexPositionAttribute,n.itemSize,t.FLOAT,!1,0,0),t.bufferSubData(t.ARRAY_BUFFER,0,this._vertices),t.bindBuffer(t.ARRAY_BUFFER,r),t.vertexAttribPointer(i.textureIndexAttribute,r.itemSize,t.FLOAT,!1,0,0),t.bufferSubData(t.ARRAY_BUFFER,0,this._indices),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(i.uvPositionAttribute,a.itemSize,t.FLOAT,!1,0,0),t.bufferSubData(t.ARRAY_BUFFER,0,this._uvs),t.bindBuffer(t.ARRAY_BUFFER,s),t.vertexAttribPointer(i.alphaAttribute,s.itemSize,t.FLOAT,!1,0,0),t.bufferSubData(t.ARRAY_BUFFER,0,this._alphas),t.uniformMatrix4fv(i.pMatrixUniform,t.FALSE,this._projectionMatrix);for(var o=0;o0&&this._drawBuffers(t),this.vocalDebug&&console.log("Draw["+this._drawID+":"+this._batchID+"] : Cover");var n=this._activeShader,r=this._vertexPositionBuffer,a=this._uvPositionBuffer;t.clear(t.COLOR_BUFFER_BIT),t.useProgram(n),t.bindBuffer(t.ARRAY_BUFFER,r),t.vertexAttribPointer(n.vertexPositionAttribute,r.itemSize,t.FLOAT,!1,0,0),t.bufferSubData(t.ARRAY_BUFFER,0,e.COVER_VERT),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(n.uvPositionAttribute,a.itemSize,t.FLOAT,!1,0,0),t.bufferSubData(t.ARRAY_BUFFER,0,i?e.COVER_UV_FLIP:e.COVER_UV),t.uniform1i(n.samplerUniform,0),t.uniform1f(n.uprightUniform,i?0:1),t.drawArrays(t.TRIANGLES,0,e.INDICIES_PER_CARD)},createjs.StageGL=createjs.promote(e,"Stage")}(),window.createjs=window.createjs||{},function(){function e(e){this.DisplayObject_constructor(),"string"==typeof e?(this.image=document.createElement("img"),this.image.src=e):this.image=e,this.sourceRect=null,this._webGLRenderStyle=createjs.DisplayObject._StageGL_BITMAP}var t=createjs.extend(e,createjs.DisplayObject);t.initialize=e,t.isVisible=function(){var e=this.image,t=this.cacheCanvas||e&&(e.naturalWidth||e.getContext||e.readyState>=2);return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY&&t)},t.draw=function(e,t){if(this.DisplayObject_draw(e,t))return!0;var i=this.image,n=this.sourceRect;if(i.getImage&&(i=i.getImage()),!i)return!0;if(n){var r=n.x,a=n.y,s=r+n.width,o=a+n.height,u=0,l=0,c=i.width,h=i.height;r<0&&(u-=r,r=0),s>c&&(s=c),a<0&&(l-=a,a=0),o>h&&(o=h),e.drawImage(i,r,a,s-r,o-a,u,l,s-r,o-a)}else e.drawImage(i,0,0);return!0},t.getBounds=function(){var e=this.DisplayObject_getBounds();if(e)return e;var t=this.image,i=this.sourceRect||t;return t&&(t.naturalWidth||t.getContext||t.readyState>=2)?this._rectangle.setValues(0,0,i.width,i.height):null},t.clone=function(t){var i=this.image;i&&t&&(i=i.cloneNode());var n=new e(i);return this.sourceRect&&(n.sourceRect=this.sourceRect.clone()),this._cloneProps(n),n},t.toString=function(){return"[Bitmap (name="+this.name+")]"},createjs.Bitmap=createjs.promote(e,"DisplayObject")}(),window.createjs=window.createjs||{},function(){"use strict";function e(e,t){this.DisplayObject_constructor(),this.currentFrame=0,this.currentAnimation=null,this.paused=!0,this.spriteSheet=e,this.currentAnimationFrame=0,this.framerate=0,this._animation=null,this._currentFrame=null,this._skipAdvance=!1,this._webGLRenderStyle=createjs.DisplayObject._StageGL_SPRITE,null!=t&&this.gotoAndPlay(t)}var t=createjs.extend(e,createjs.DisplayObject);t.initialize=e,t.isVisible=function(){var e=this.cacheCanvas||this.spriteSheet.complete;return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY&&e)},t.draw=function(e,t){if(this.DisplayObject_draw(e,t))return!0;this._normalizeFrame();var i=this.spriteSheet.getFrame(0|this._currentFrame);if(!i)return!1;var n=i.rect;return n.width&&n.height&&e.drawImage(i.image,n.x,n.y,n.width,n.height,-i.regX,-i.regY,n.width,n.height),!0},t.play=function(){this.paused=!1},t.stop=function(){this.paused=!0},t.gotoAndPlay=function(e){this.paused=!1,this._skipAdvance=!0,this._goto(e)},t.gotoAndStop=function(e){this.paused=!0,this._goto(e)},t.advance=function(e){var t=this.framerate||this.spriteSheet.framerate,i=t&&null!=e?e/(1e3/t):1;this._normalizeFrame(i)},t.getBounds=function(){return this.DisplayObject_getBounds()||this.spriteSheet.getFrameBounds(this.currentFrame,this._rectangle)},t.clone=function(){return this._cloneProps(new e(this.spriteSheet))},t.toString=function(){return"[Sprite (name="+this.name+")]"},t._cloneProps=function(e){return this.DisplayObject__cloneProps(e),e.currentFrame=this.currentFrame,e.currentAnimation=this.currentAnimation,e.paused=this.paused,e.currentAnimationFrame=this.currentAnimationFrame,e.framerate=this.framerate,e._animation=this._animation,e._currentFrame=this._currentFrame,e._skipAdvance=this._skipAdvance,e},t._tick=function(e){this.paused||(this._skipAdvance||this.advance(e&&e.delta),this._skipAdvance=!1),this.DisplayObject__tick(e)},t._normalizeFrame=function(e){e=e||0;var t,i=this._animation,n=this.paused,r=this._currentFrame;if(i){var a=i.speed||1,s=this.currentAnimationFrame;if(s+e*a>=(t=i.frames.length)){var o=i.next;if(this._dispatchAnimationEnd(i,r,n,o,t-1))return;if(o)return this._goto(o,e-(t-s)/a);this.paused=!0,s=i.frames.length-1}else s+=e*a;this.currentAnimationFrame=s,this._currentFrame=i.frames[0|s]}else if((r=this._currentFrame+=e)>=(t=this.spriteSheet.getNumFrames())&&t>0&&!this._dispatchAnimationEnd(i,r,n,t-1)&&(this._currentFrame-=t)>=t)return this._normalizeFrame();r=0|this._currentFrame,this.currentFrame!=r&&(this.currentFrame=r,this.dispatchEvent("change"))},t._dispatchAnimationEnd=function(e,t,i,n,r){var a=e?e.name:null;if(this.hasEventListener("animationend")){var s=new createjs.Event("animationend");s.name=a,s.next=n,this.dispatchEvent(s)}var o=this._animation!=e||this._currentFrame!=t;return o||i||!this.paused||(this.currentAnimationFrame=r,o=!0),o},t._goto=function(e,t){if(this.currentAnimationFrame=0,isNaN(e)){var i=this.spriteSheet.getAnimation(e);i&&(this._animation=i,this.currentAnimation=e,this._normalizeFrame(t))}else this.currentAnimation=this._animation=null,this._currentFrame=e,this._normalizeFrame()},createjs.Sprite=createjs.promote(e,"DisplayObject")}(),window.createjs=window.createjs||{},function(){"use strict";function e(e){this.DisplayObject_constructor(),this.graphics=e||new createjs.Graphics}var t=createjs.extend(e,createjs.DisplayObject);t.isVisible=function(){var e=this.cacheCanvas||this.graphics&&!this.graphics.isEmpty();return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY&&e)},t.draw=function(e,t){return this.DisplayObject_draw(e,t)||this.graphics.draw(e,this),!0},t.clone=function(t){var i=t&&this.graphics?this.graphics.clone():this.graphics;return this._cloneProps(new e(i))},t.toString=function(){return"[Shape (name="+this.name+")]"},createjs.Shape=createjs.promote(e,"DisplayObject")}(),window.createjs=window.createjs||{},function(){"use strict";function e(e,t,i){this.DisplayObject_constructor(),this.text=e,this.font=t,this.color=i,this.textAlign="left",this.textBaseline="top",this.maxWidth=null,this.outline=0,this.lineHeight=0,this.lineWidth=null}var t=createjs.extend(e,createjs.DisplayObject),i=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");i.getContext&&(e._workingContext=i.getContext("2d"),i.width=i.height=1),e.H_OFFSETS={start:0,left:0,center:-.5,end:-1,right:-1},e.V_OFFSETS={top:0,hanging:-.01,middle:-.4,alphabetic:-.8,ideographic:-.85,bottom:-1},t.isVisible=function(){var e=this.cacheCanvas||null!=this.text&&""!==this.text;return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY&&e)},t.draw=function(e,t){if(this.DisplayObject_draw(e,t))return!0;var i=this.color||"#000";return this.outline?(e.strokeStyle=i,e.lineWidth=1*this.outline):e.fillStyle=i,this._drawText(this._prepContext(e)),!0},t.getMeasuredWidth=function(){return this._getMeasuredWidth(this.text)},t.getMeasuredLineHeight=function(){return 1.2*this._getMeasuredWidth("M")},t.getMeasuredHeight=function(){return this._drawText(null,{}).height},t.getBounds=function(){var t=this.DisplayObject_getBounds();if(t)return t;if(null==this.text||""===this.text)return null;var i=this._drawText(null,{}),n=this.maxWidth&&this.maxWidththis.lineWidth){var p=h.split(/(\s)/);h=p[0],d=t.measureText(h).width;for(var f=1,m=p.length;fthis.lineWidth?(r&&this._drawTextLine(t,h,o*a),n&&n.push(h),d>s&&(s=d),h=p[f+1],d=t.measureText(h).width,o++):(h+=p[f]+p[f+1],d+=g)}}r&&this._drawTextLine(t,h,o*a),n&&n.push(h),i&&null==d&&(d=t.measureText(h).width),d>s&&(s=d),o++}return i&&(i.width=s,i.height=o*a),r||t.restore(),i},t._drawTextLine=function(e,t,i){this.outline?e.strokeText(t,0,i,this.maxWidth||65535):e.fillText(t,0,i,this.maxWidth||65535)},t._getMeasuredWidth=function(t){var i=e._workingContext;i.save();var n=this._prepContext(i).measureText(t).width;return i.restore(),n},createjs.Text=createjs.promote(e,"DisplayObject")}(),window.createjs=window.createjs||{},function(){"use strict";function e(e,t){this.Container_constructor(),this.text=e||"",this.spriteSheet=t,this.lineHeight=0,this.letterSpacing=0,this.spaceWidth=0,this._oldProps={text:0,spriteSheet:0,lineHeight:0,letterSpacing:0,spaceWidth:0},this._oldStage=null,this._drawAction=null}var t=createjs.extend(e,createjs.Container);e.maxPoolSize=100,e._spritePool=[],t.draw=function(e,t){this.DisplayObject_draw(e,t)||(this._updateState(),this.Container_draw(e,t))},t.getBounds=function(){return this._updateText(),this.Container_getBounds()},t.isVisible=function(){var e=this.cacheCanvas||this.spriteSheet&&this.spriteSheet.complete&&this.text;return!!(this.visible&&this.alpha>0&&0!==this.scaleX&&0!==this.scaleY&&e)},t.clone=function(){return this._cloneProps(new e(this.text,this.spriteSheet))},t.addChild=t.addChildAt=t.removeChild=t.removeChildAt=t.removeAllChildren=function(){},t._updateState=function(){this._updateText()},t._cloneProps=function(e){return this.Container__cloneProps(e),e.lineHeight=this.lineHeight,e.letterSpacing=this.letterSpacing,e.spaceWidth=this.spaceWidth,e},t._getFrameIndex=function(e,t){var i,n=t.getAnimation(e);return n||(e!=(i=e.toUpperCase())||e!=(i=e.toLowerCase())||(i=null),i&&(n=t.getAnimation(i))),n&&n.frames[0]},t._getFrame=function(e,t){var i=this._getFrameIndex(e,t);return null==i?i:t.getFrame(i)},t._getLineHeight=function(e){var t=this._getFrame("1",e)||this._getFrame("T",e)||this._getFrame("L",e)||e.getFrame(0);return t?t.rect.height:1},t._getSpaceWidth=function(e){var t=this._getFrame("1",e)||this._getFrame("l",e)||this._getFrame("e",e)||this._getFrame("a",e)||e.getFrame(0);return t?t.rect.width:1},t._updateText=function(){var t,i=0,n=0,r=this._oldProps,a=!1,s=this.spaceWidth,o=this.lineHeight,u=this.spriteSheet,l=e._spritePool,c=this.children,h=0,d=c.length;for(var p in r)r[p]!=this[p]&&(r[p]=this[p],a=!0);if(a){var f=!!this._getFrame(" ",u);f||s||(s=this._getSpaceWidth(u)),o||(o=this._getLineHeight(u));for(var m=0,g=this.text.length;mh;)l.push(t=c.pop()),t.parent=null,d--;l.length>e.maxPoolSize&&(l.length=e.maxPoolSize)}},createjs.BitmapText=createjs.promote(e,"Container")}(),window.createjs=window.createjs||{},function(){"use strict";function e(t){var i,n,r,a;this.Container_constructor(),!e.inited&&e.init(),t instanceof String||arguments.length>1?(i=t,n=arguments[1],a=arguments[3],null==(r=arguments[2])&&(r=-1),t=null):t&&(i=t.mode,n=t.startPosition,r=t.loop,a=t.labels),t||(t={labels:a}),this.mode=i||e.INDEPENDENT,this.startPosition=n||0,this.loop=!0===r?-1:r||0,this.currentFrame=0,this.paused=t.paused||!1,this.actionsEnabled=!0,this.autoReset=!0,this.frameBounds=this.frameBounds||t.frameBounds,this.framerate=null,t.useTicks=t.paused=!0,this.timeline=new createjs.Timeline(t),this._synchOffset=0,this._rawPosition=-1,this._bound_resolveState=this._resolveState.bind(this),this._t=0,this._managed={}}var t=createjs.extend(e,createjs.Container);e.INDEPENDENT="independent",e.SINGLE_FRAME="single",e.SYNCHED="synched",e.inited=!1,e.init=function(){e.inited||(i.install(),e.inited=!0)},t._getLabels=function(){return this.timeline.getLabels()},t.getLabels=createjs.deprecate(t._getLabels,"MovieClip.getLabels"),t._getCurrentLabel=function(){return this.timeline.currentLabel},t.getCurrentLabel=createjs.deprecate(t._getCurrentLabel,"MovieClip.getCurrentLabel"),t._getDuration=function(){return this.timeline.duration},t.getDuration=createjs.deprecate(t._getDuration,"MovieClip.getDuration");try{Object.defineProperties(t,{labels:{get:t._getLabels},currentLabel:{get:t._getCurrentLabel},totalFrames:{get:t._getDuration},duration:{get:t._getDuration}})}catch(e){}function i(){throw"MovieClipPlugin cannot be instantiated."}t.initialize=e,t.isVisible=function(){return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY)},t.draw=function(e,t){return this.DisplayObject_draw(e,t)||(this._updateState(),this.Container_draw(e,t)),!0},t.play=function(){this.paused=!1},t.stop=function(){this.paused=!0},t.gotoAndPlay=function(e){this.paused=!1,this._goto(e)},t.gotoAndStop=function(e){this.paused=!0,this._goto(e)},t.advance=function(t){var i=e.INDEPENDENT;if(this.mode===i){for(var n=this,r=n.framerate;(n=n.parent)&&null===r;)n.mode===i&&(r=n._framerate);if(this._framerate=r,!this.paused){var a=null!==r&&-1!==r&&null!==t?t/(1e3/r)+this._t:1,s=0|a;for(this._t=a-s;s--;)this._updateTimeline(this._rawPosition+1,!1)}}},t.clone=function(){throw"MovieClip cannot be cloned."},t.toString=function(){return"[MovieClip (name="+this.name+")]"},t._updateState=function(){-1!==this._rawPosition&&this.mode===e.INDEPENDENT||this._updateTimeline(-1)},t._tick=function(e){this.advance(e&&e.delta),this.Container__tick(e)},t._goto=function(e){var t=this.timeline.resolve(e);null!=t&&(this._t=0,this._updateTimeline(t,!0))},t._reset=function(){this._rawPosition=-1,this._t=this.currentFrame=0,this.paused=!1},t._updateTimeline=function(t,i){var n=this.mode!==e.INDEPENDENT,r=this.timeline;n&&(t=this.startPosition+(this.mode===e.SINGLE_FRAME?0:this._synchOffset)),t<0&&(t=0),(this._rawPosition!==t||n)&&(this._rawPosition=t,r.loop=this.loop,r.setPosition(t,n||!this.actionsEnabled,i,this._bound_resolveState))},t._renderFirstFrame=function(){var e=this.timeline,t=e.rawPosition;e.setPosition(0,!0,!0,this._bound_resolveState),e.rawPosition=t},t._resolveState=function(){var e=this.timeline;for(var t in this.currentFrame=e.position,this._managed)this._managed[t]=1;for(var i=e.tweens,n=0,r=i.length;n=0;n--){var l=u[n].id;1===this._managed[l]&&(this.removeChildAt(n),delete this._managed[l])}},t._setState=function(e,t){if(e)for(var i=e.length-1;i>=0;i--){var n=e[i],r=n.t,a=n.p;for(var s in a)r[s]=a[s];this._addManagedChild(r,t)}},t._addManagedChild=function(t,i){t._off||(this.addChildAt(t,0),t instanceof e&&(t._synchOffset=i,t.mode===e.INDEPENDENT&&t.autoReset&&!this._managed[t.id]&&t._reset()),this._managed[t.id]=2)},t._getBounds=function(e,t){var i=this.DisplayObject_getBounds();return i||this.frameBounds&&(i=this._rectangle.copy(this.frameBounds[this.currentFrame])),i?this._transformBounds(i,e,t):this.Container__getBounds(e,t)},createjs.MovieClip=createjs.promote(e,"Container"),i.priority=100,i.ID="MovieClip",i.install=function(){createjs.Tween._installPlugin(i)},i.init=function(t,n,r){"startPosition"===n&&t.target instanceof e&&t._addPlugin(i)},i.step=function(e,t,i){},i.change=function(e,t,i,n,r,a){if("startPosition"===i)return 1===r?t.props[i]:t.prev.props[i]}}(),window.createjs=window.createjs||{},function(){"use strict";function e(){throw"SpriteSheetUtils cannot be instantiated"}var t=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");t.getContext&&(e._workingCanvas=t,e._workingContext=t.getContext("2d"),t.width=t.height=1),e.extractFrame=function(t,i){isNaN(i)&&(i=t.getAnimation(i).frames[0]);var n=t.getFrame(i);if(!n)return null;var r=n.rect,a=e._workingCanvas;a.width=r.width,a.height=r.height,e._workingContext.drawImage(n.image,r.x,r.y,r.width,r.height,0,0,r.width,r.height);var s=document.createElement("img");return s.src=a.toDataURL("image/png"),s},e.addFlippedFrames=createjs.deprecate(null,"SpriteSheetUtils.addFlippedFrames"),e.mergeAlpha=createjs.deprecate(null,"SpriteSheetUtils.mergeAlpha"),e._flip=function(t,i,n,r){for(var a=t._images,s=e._workingCanvas,o=e._workingContext,u=a.length/i,l=0;lthis.maxHeight)throw e.ERR_DIMENSIONS;for(var r=0,a=0,s=0;n.length;){var o=this._fillRow(n,r,s,i,t);if(o.w>a&&(a=o.w),r+=o.h,!o.h||!n.length){var u=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");u.width=this._getSize(a,this.maxWidth),u.height=this._getSize(r,this.maxHeight),this._data.images[s]=u,o.h||(a=r=0,s++)}}},t._setupMovieClipFrame=function(e,t){var i=e.actionsEnabled;e.actionsEnabled=!1,e.gotoAndStop(t.i),e.actionsEnabled=i,t.f&&t.f(e,t.d,t.i)},t._getSize=function(e,t){for(var i=4;Math.pow(2,++i)=0;c--){var h=t[c],d=this._scale*h.scale,p=h.sourceRect,f=h.source,m=Math.floor(d*p.x-a),g=Math.floor(d*p.y-a),v=Math.ceil(d*p.height+2*a),_=Math.ceil(d*p.width+2*a);if(_>s)throw e.ERR_DIMENSIONS;v>o||u+_>s||(h.img=n,h.rect=new createjs.Rectangle(u,i,_,v),l=l||v,t.splice(c,1),r[h.index]=[u,i,_,v,n,Math.round(-m+d*f.regX-a),Math.round(-g+d*f.regY-a)],u+=_)}return{w:u,h:l}},t._endBuild=function(){this.spriteSheet=new createjs.SpriteSheet(this._data),this._data=null,this.progress=1,this.dispatchEvent("complete")},t._run=function(){for(var e=50*Math.max(.01,Math.min(.99,this.timeSlice||.3)),t=(new Date).getTime()+e,i=!1;t>(new Date).getTime();)if(!this._drawNext()){i=!0;break}if(i)this._endBuild();else{var n=this;this._timerID=setTimeout((function(){n._run()}),50-e)}var r=this.progress=this._index/this._frames.length;if(this.hasEventListener("progress")){var a=new createjs.Event("progress");a.progress=r,this.dispatchEvent(a)}},t._drawNext=function(){var e=this._frames[this._index],t=e.scale*this._scale,i=e.rect,n=e.sourceRect,r=this._data.images[e.img].getContext("2d");return e.funct&&e.funct(e.source,e.data),r.save(),r.beginPath(),r.rect(i.x,i.y,i.width,i.height),r.clip(),r.translate(Math.ceil(i.x-n.x*t),Math.ceil(i.y-n.y*t)),r.scale(t,t),e.source.draw(r),r.restore(),++this._index=1?n:1,this.height=r>=1?r:1,this.x=t||0,this.y=i||0,this.scale=a||1,this.update()},t.update=function(t){if(!this.target)throw"define() must be called before update()";var i=e.getFilterBounds(this.target),n=this.target.cacheCanvas;this._drawWidth=Math.ceil(this.width*this.scale)+i.width,this._drawHeight=Math.ceil(this.height*this.scale)+i.height,n&&this._drawWidth==n.width&&this._drawHeight==n.height||this._updateSurface(),this._filterOffX=i.x,this._filterOffY=i.y,this.offX=this.x*this.scale+this._filterOffX,this.offY=this.y*this.scale+this._filterOffY,this._drawToCache(t),this.cacheID=this.cacheID?this.cacheID+1:1},t.release=function(){if(this._webGLCache)this._webGLCache.isCacheControlled||(this.__lastRT&&(this.__lastRT=void 0),this.__rtA&&this._webGLCache._killTextureObject(this.__rtA),this.__rtB&&this._webGLCache._killTextureObject(this.__rtB),this.target&&this.target.cacheCanvas&&this._webGLCache._killTextureObject(this.target.cacheCanvas)),this._webGLCache=!1;else{var e=this.target.stage;e instanceof createjs.StageGL&&e.releaseTexture(this.target.cacheCanvas)}this.target=this.target.cacheCanvas=null,this.cacheID=this._cacheDataURLID=this._cacheDataURL=void 0,this.width=this.height=this.x=this.y=this.offX=this.offY=0,this.scale=1},t.getCacheDataURL=function(){var e=this.target&&this.target.cacheCanvas;return e?(this.cacheID!=this._cacheDataURLID&&(this._cacheDataURLID=this.cacheID,this._cacheDataURL=e.toDataURL?e.toDataURL():null),this._cacheDataURL):null},t.draw=function(e){return!!this.target&&(e.drawImage(this.target.cacheCanvas,this.x+this._filterOffX/this.scale,this.y+this._filterOffY/this.scale,this._drawWidth/this.scale,this._drawHeight/this.scale),!0)},t._updateSurface=function(){if(!this._options||!this._options.useGL)return(e=this.target.cacheCanvas)||(e=this.target.cacheCanvas=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas")),e.width=this._drawWidth,void(e.height=this._drawHeight);if(!this._webGLCache)if("stage"===this._options.useGL){if(!this.target.stage||!this.target.stage.isWebGL)throw"Cannot use 'stage' for cache because the object's parent stage is "+(this.target.stage?"non WebGL.":"not set, please addChild to the correct stage.");this.target.cacheCanvas=!0,this._webGLCache=this.target.stage}else if("new"===this._options.useGL)this.target.cacheCanvas=document.createElement("canvas"),this._webGLCache=new createjs.StageGL(this.target.cacheCanvas,{antialias:!0,transparent:!0,autoPurge:-1}),this._webGLCache.isCacheControlled=!0;else{if(!(this._options.useGL instanceof createjs.StageGL))throw"Invalid option provided to useGL, expected ['stage', 'new', StageGL, undefined], got "+this._options.useGL;this.target.cacheCanvas=!0,this._webGLCache=this._options.useGL,this._webGLCache.isCacheControlled=!0}var e=this.target.cacheCanvas,t=this._webGLCache;t.isCacheControlled&&(e.width=this._drawWidth,e.height=this._drawHeight,t.updateViewport(this._drawWidth,this._drawHeight)),this.target.filters?(t.getTargetRenderTexture(this.target,this._drawWidth,this._drawHeight),t.getTargetRenderTexture(this.target,this._drawWidth,this._drawHeight)):t.isCacheControlled||t.getTargetRenderTexture(this.target,this._drawWidth,this._drawHeight)},t._drawToCache=function(e){var t=this.target.cacheCanvas,i=this.target,n=this._webGLCache;if(n)n.cacheDraw(i,i.filters,this),(t=this.target.cacheCanvas).width=this._drawWidth,t.height=this._drawHeight;else{var r=t.getContext("2d");e||r.clearRect(0,0,this._drawWidth+1,this._drawHeight+1),r.save(),r.globalCompositeOperation=e,r.setTransform(this.scale,0,0,this.scale,-this._filterOffX,-this._filterOffY),r.translate(-this.x,-this.y),i.draw(r,!0),r.restore(),i.filters&&i.filters.length&&this._applyFilters(r)}t._invalid=!0},t._applyFilters=function(e){var t,i=this.target.filters,n=this._drawWidth,r=this._drawHeight,a=0,s=i[a];do{s.usesContext?(t&&(e.putImageData(t,0,0),t=null),s.applyFilter(e,0,0,n,r)):(t||(t=e.getImageData(0,0,n,r)),s._applyFilter(t)),s=null!==s._multiPass?s._multiPass:i[++a]}while(s);t&&e.putImageData(t,0,0)},createjs.BitmapCache=e}(),window.createjs=window.createjs||{},function(){"use strict";function e(e,t,i){this.Filter_constructor(),this._blurX=e,this._blurXTable=[],this._lastBlurX=null,this._blurY=t,this._blurYTable=[],this._lastBlurY=null,this._quality,this._lastQuality=null,this.FRAG_SHADER_TEMPLATE="uniform float xWeight[{{blurX}}];uniform float yWeight[{{blurY}}];uniform vec2 textureOffset;void main(void) {vec4 color = vec4(0.0);float xAdj = ({{blurX}}.0-1.0)/2.0;float yAdj = ({{blurY}}.0-1.0)/2.0;vec2 sampleOffset;for(int i=0; i<{{blurX}}; i++) {for(int j=0; j<{{blurY}}; j++) {sampleOffset = vRenderCoord + (textureOffset * vec2(float(i)-xAdj, float(j)-yAdj));color += texture2D(uSampler, sampleOffset) * (xWeight[i] * yWeight[j]);}}gl_FragColor = color.rgba;}",(isNaN(i)||i<1)&&(i=1),this.setQuality(0|i)}var t=createjs.extend(e,createjs.Filter);t.getBlurX=function(){return this._blurX},t.getBlurY=function(){return this._blurY},t.setBlurX=function(e){(isNaN(e)||e<0)&&(e=0),this._blurX=e},t.setBlurY=function(e){(isNaN(e)||e<0)&&(e=0),this._blurY=e},t.getQuality=function(){return this._quality},t.setQuality=function(e){(isNaN(e)||e<0)&&(e=0),this._quality=0|e},t._getShader=function(){var e=this._lastBlurX!==this._blurX,t=this._lastBlurY!==this._blurY,i=this._lastQuality!==this._quality;return e||t||i?((e||i)&&(this._blurXTable=this._getTable(this._blurX*this._quality)),(t||i)&&(this._blurYTable=this._getTable(this._blurY*this._quality)),this._updateShader(),this._lastBlurX=this._blurX,this._lastBlurY=this._blurY,void(this._lastQuality=this._quality)):this._compiledShader},t._setShader=function(){this._compiledShader};try{Object.defineProperties(t,{blurX:{get:t.getBlurX,set:t.setBlurX},blurY:{get:t.getBlurY,set:t.setBlurY},quality:{get:t.getQuality,set:t.setQuality},_builtShader:{get:t._getShader,set:t._setShader}})}catch(e){console.log(e)}t._getTable=function(e){if(e<=1)return[1];for(var t=[],i=Math.ceil(2*e),n=(i+=i%2?0:1)/2|0,r=-n;r<=n;r++){var a=r/n*4.2;t.push(1/Math.sqrt(2*Math.PI)*Math.pow(Math.E,-Math.pow(a,2)/4))}var s=t.reduce((function(e,t){return e+t}));return t.map((function(e,t,i){return e/s}))},t._updateShader=function(){if(void 0!==this._blurX&&void 0!==this._blurY){var e=this.FRAG_SHADER_TEMPLATE;e=(e=e.replace(/\{\{blurX\}\}/g,this._blurXTable.length.toFixed(0))).replace(/\{\{blurY\}\}/g,this._blurYTable.length.toFixed(0)),this.FRAG_SHADER_BODY=e}},t.shaderParamSetup=function(e,t,i){e.uniform1fv(e.getUniformLocation(i,"xWeight"),this._blurXTable),e.uniform1fv(e.getUniformLocation(i,"yWeight"),this._blurYTable),e.uniform2f(e.getUniformLocation(i,"textureOffset"),2/(t._viewportWidth*this._quality),2/(t._viewportHeight*this._quality))},e.MUL_TABLE=[1,171,205,293,57,373,79,137,241,27,391,357,41,19,283,265,497,469,443,421,25,191,365,349,335,161,155,149,9,278,269,261,505,245,475,231,449,437,213,415,405,395,193,377,369,361,353,345,169,331,325,319,313,307,301,37,145,285,281,69,271,267,263,259,509,501,493,243,479,118,465,459,113,446,55,435,429,423,209,413,51,403,199,393,97,3,379,375,371,367,363,359,355,351,347,43,85,337,333,165,327,323,5,317,157,311,77,305,303,75,297,294,73,289,287,71,141,279,277,275,68,135,67,133,33,262,260,129,511,507,503,499,495,491,61,121,481,477,237,235,467,232,115,457,227,451,7,445,221,439,218,433,215,427,425,211,419,417,207,411,409,203,202,401,399,396,197,49,389,387,385,383,95,189,47,187,93,185,23,183,91,181,45,179,89,177,11,175,87,173,345,343,341,339,337,21,167,83,331,329,327,163,81,323,321,319,159,79,315,313,39,155,309,307,153,305,303,151,75,299,149,37,295,147,73,291,145,289,287,143,285,71,141,281,35,279,139,69,275,137,273,17,271,135,269,267,133,265,33,263,131,261,130,259,129,257,1],e.SHG_TABLE=[0,9,10,11,9,12,10,11,12,9,13,13,10,9,13,13,14,14,14,14,10,13,14,14,14,13,13,13,9,14,14,14,15,14,15,14,15,15,14,15,15,15,14,15,15,15,15,15,14,15,15,15,15,15,15,12,14,15,15,13,15,15,15,15,16,16,16,15,16,14,16,16,14,16,13,16,16,16,15,16,13,16,15,16,14,9,16,16,16,16,16,16,16,16,16,13,14,16,16,15,16,16,10,16,15,16,14,16,16,14,16,16,14,16,16,14,15,16,16,16,14,15,14,15,13,16,16,15,17,17,17,17,17,17,14,15,17,17,16,16,17,16,15,17,16,17,11,17,16,17,16,17,16,17,17,16,17,17,16,17,17,16,16,17,17,17,16,14,17,17,17,17,15,16,14,16,15,16,13,16,15,16,14,16,15,16,12,16,15,16,17,17,17,17,17,13,16,15,17,17,17,16,15,17,17,17,16,15,17,17,14,16,17,17,16,17,17,16,15,17,16,14,17,16,15,17,16,17,17,16,17,15,16,17,14,17,16,15,17,16,17,13,17,16,17,17,16,17,14,17,16,17,16,17,16,17,9],t.getBounds=function(e){var t=0|this.blurX,i=0|this.blurY;if(t<=0&&i<=0)return e;var n=Math.pow(this.quality,.2);return(e||new createjs.Rectangle).pad(i*n+1,t*n+1,i*n+1,t*n+1)},t.clone=function(){return new e(this.blurX,this.blurY,this.quality)},t.toString=function(){return"[BlurFilter]"},t._applyFilter=function(t){var i=this._blurX>>1;if(isNaN(i)||i<0)return!1;var n=this._blurY>>1;if(isNaN(n)||n<0)return!1;if(0==i&&0==n)return!1;var r=this.quality;(isNaN(r)||r<1)&&(r=1),(r|=0)>3&&(r=3),r<1&&(r=1);var a=t.data,s=0,o=0,u=0,l=0,c=0,h=0,d=0,p=0,f=0,m=0,g=0,v=0,_=0,y=0,b=0,T=i+i+1|0,w=n+n+1|0,S=0|t.width,E=0|t.height,C=S-1|0,x=E-1|0,k=i+1|0,I=n+1|0,A={r:0,b:0,g:0,a:0},P=A;for(u=1;u0;){d=h=0;var F=O,B=M;for(o=E;--o>-1;){for(p=k*(v=a[0|h]),f=k*(_=a[h+1|0]),m=k*(y=a[h+2|0]),g=k*(b=a[h+3|0]),P=A,u=k;--u>-1;)P.r=v,P.g=_,P.b=y,P.a=b,P=P.n;for(u=1;u>>B,a[h++]=f*F>>>B,a[h++]=m*F>>>B,a[h++]=g*F>>>B,l=d+((l=s+i+1)0)for(o=0;o>>B,b>0?(a[l]=p*F>>>B,a[l+1]=f*F>>>B,a[l+2]=m*F>>>B):a[l]=a[l+1]=a[l+2]=0,l=s+((l=o+I)>>B,b>0?(b=255/b,a[l]=(p*F>>>B)*b,a[l+1]=(f*F>>>B)*b,a[l+2]=(m*F>>>B)*b):a[l]=a[l+1]=a[l+2]=0,l=s+((l=o+I)0?3*e/100:e/100),i=.3086,n=.6094,r=.082;return this._multiplyMatrix([i*(1-t)+t,n*(1-t),r*(1-t),0,0,i*(1-t),n*(1-t)+t,r*(1-t),0,0,i*(1-t),n*(1-t),r*(1-t)+t,0,0,0,0,0,1,0,0,0,0,0,1]),this},t.adjustHue=function(e){if(0==e||isNaN(e))return this;e=this._cleanValue(e,180)/180*Math.PI;var t=Math.cos(e),i=Math.sin(e),n=.213,r=.715,a=.072;return this._multiplyMatrix([n+.787*t+i*-n,r+t*-r+i*-r,a+t*-a+.928*i,0,0,n+t*-n+.143*i,r+t*(1-r)+.14*i,a+t*-a+-.283*i,0,0,n+t*-n+-.787*i,r+t*-r+i*r,a+.928*t+i*a,0,0,0,0,0,1,0,0,0,0,0,1]),this},t.concat=function(t){return(t=this._fixMatrix(t)).length!=e.LENGTH||this._multiplyMatrix(t),this},t.clone=function(){return(new e).copy(this)},t.toArray=function(){for(var t=[],i=0,n=e.LENGTH;ie.LENGTH&&(t=t.slice(0,e.LENGTH)),t},createjs.ColorMatrix=e}(),window.createjs=window.createjs||{},function(){"use strict";function e(e){this.Filter_constructor(),this.matrix=e,this.FRAG_SHADER_BODY="uniform mat4 uColorMatrix;uniform vec4 uColorMatrixOffset;void main(void) {vec4 color = texture2D(uSampler, vRenderCoord);mat4 m = uColorMatrix;vec4 newColor = vec4(0,0,0,0);newColor.r = color.r*m[0][0] + color.g*m[0][1] + color.b*m[0][2] + color.a*m[0][3];newColor.g = color.r*m[1][0] + color.g*m[1][1] + color.b*m[1][2] + color.a*m[1][3];newColor.b = color.r*m[2][0] + color.g*m[2][1] + color.b*m[2][2] + color.a*m[2][3];newColor.a = color.r*m[3][0] + color.g*m[3][1] + color.b*m[3][2] + color.a*m[3][3];gl_FragColor = newColor + uColorMatrixOffset;}"}var t=createjs.extend(e,createjs.Filter);t.shaderParamSetup=function(e,t,i){var n=this.matrix,r=new Float32Array([n[0],n[1],n[2],n[3],n[5],n[6],n[7],n[8],n[10],n[11],n[12],n[13],n[15],n[16],n[17],n[18]]);e.uniformMatrix4fv(e.getUniformLocation(i,"uColorMatrix"),!1,r),e.uniform4f(e.getUniformLocation(i,"uColorMatrixOffset"),n[4]/255,n[9]/255,n[14]/255,n[19]/255)},t.toString=function(){return"[ColorMatrixFilter]"},t.clone=function(){return new e(this.matrix)},t._applyFilter=function(e){for(var t,i,n,r,a=e.data,s=a.length,o=this.matrix,u=o[0],l=o[1],c=o[2],h=o[3],d=o[4],p=o[5],f=o[6],m=o[7],g=o[8],v=o[9],_=o[10],y=o[11],b=o[12],T=o[13],w=o[14],S=o[15],E=o[16],C=o[17],x=o[18],k=o[19],I=0;I0||window.navigator.pointerEnabled&&window.navigator.maxTouchPoints>0)},e.enable=function(t,i,n){return!!(t&&t.canvas&&e.isSupported())&&(t.__touch||(t.__touch={pointers:{},multitouch:!i,preventDefault:!n,count:0},"ontouchstart"in window?e._IOS_enable(t):(window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&e._IE_enable(t)),!0)},e.disable=function(t){t&&("ontouchstart"in window?e._IOS_disable(t):(window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&e._IE_disable(t),delete t.__touch)},e._IOS_enable=function(t){var i=t.canvas,n=t.__touch.f=function(i){e._IOS_handleEvent(t,i)};i.addEventListener("touchstart",n,!1),i.addEventListener("touchmove",n,!1),i.addEventListener("touchend",n,!1),i.addEventListener("touchcancel",n,!1)},e._IOS_disable=function(e){var t=e.canvas;if(t){var i=e.__touch.f;t.removeEventListener("touchstart",i,!1),t.removeEventListener("touchmove",i,!1),t.removeEventListener("touchend",i,!1),t.removeEventListener("touchcancel",i,!1)}},e._IOS_handleEvent=function(e,t){if(e){e.__touch.preventDefault&&t.preventDefault&&t.preventDefault();for(var i=t.changedTouches,n=t.type,r=0,a=i.length;r0;r+=12,a--)n.references.push({referenceType:(128&e[r])>>>7,referencedSize:2147483647&i.getUint32(r),subsegmentDuration:i.getUint32(r+4),startsWithSap:!!(128&e[r+8]),sapType:(112&e[r+8])>>>4,sapDeltaTime:268435455&i.getUint32(r+8)});return n}},489:function(e){var t,i,n,r,a,s,o,u=9e4;t=function(e){return e*u},i=function(e,t){return e*t},n=function(e){return e/u},r=function(e,t){return e/t},a=function(e,i){return t(r(e,i))},s=function(e,t){return i(n(e),t)},o=function(e,t,i){return n(i?e:e-t)},e.exports={ONE_SECOND_IN_TS:u,secondsToVideoTs:t,secondsToAudioTs:i,videoTsToSeconds:n,audioTsToSeconds:r,audioTsToVideoTs:a,videoTsToAudioTs:s,metadataTsToSeconds:o}},974:function(e){e.exports=function(e,t){var i,n=null;try{i=JSON.parse(e,t)}catch(e){n=e}return[n,i]}},945:function(e){var t,i,n,r,a;t=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var s=a.parseURL(t);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return n.alwaysNormalize?(s.path=a.normalizePath(s.path),a.buildURLFromParts(s)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=i.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(l.netLoc=o.netLoc,"/"!==s.path[0]))if(s.path){var c=o.path,h=c.substring(0,c.lastIndexOf("/")+1)+s.path;l.path=a.normalizePath(h)}else l.path=o.path,s.params||(l.params=o.params,s.query||(l.query=o.query));return null===l.path&&(l.path=n.alwaysNormalize?a.normalizePath(s.path):s.path),a.buildURLFromParts(l)},parseURL:function(e){var i=t.exec(e);return i?{scheme:i[1]||"",netLoc:i[2]||"",path:i[3]||"",params:i[4]||"",query:i[5]||"",fragment:i[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(n,"");e.length!==(e=e.replace(r,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a},407:function(e,t,i){var n=i(908),r=e.exports={WebVTT:i(706),VTTCue:i(230),VTTRegion:i(710)};n.vttjs=r,n.WebVTT=r.WebVTT;var a=r.VTTCue,s=r.VTTRegion,o=n.VTTCue,u=n.VTTRegion;r.shim=function(){n.VTTCue=a,n.VTTRegion=s},r.restore=function(){n.VTTCue=o,n.VTTRegion=u},n.VTTCue||r.shim()},706:function(e,t,i){var n=i(144),r=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function a(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function s(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function o(){this.values=r(null)}function u(e,t,i,n){var r=n?e.split(n):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(i);2===s.length&&t(s[0],s[1])}}function l(e,t,i){var n=e;function r(){var t=s(e);if(null===t)throw new a(a.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function l(){e=e.replace(/^\s+/,"")}if(l(),t.startTime=r(),l(),"--\x3e"!==e.substr(0,3))throw new a(a.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),l(),t.endTime=r(),l(),function(e,t){var n=new o;u(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];n.integer(e,s),n.percent(e,s)&&n.set("snapToLines",!1),n.alt(e,s,["auto"]),2===a.length&&n.alt("lineAlign",a[1],["start","center","end"]);break;case"position":a=t.split(","),n.percent(e,a[0]),2===a.length&&n.alt("positionAlign",a[1],["start","center","end"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");try{t.line=n.get("line","auto")}catch(e){}t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100);try{t.align=n.get("align","center")}catch(e){t.align=n.get("align","middle")}try{t.position=n.get("position","auto")}catch(e){t.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}a.prototype=r(Error.prototype),a.prototype.constructor=a,a.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},o.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n=0&&t<=100)&&(this.set(e,t),!0)}};var c=n.createElement&&n.createElement("textarea"),h={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},d={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},p={v:"title",lang:"lang"},f={rt:"ruby"};function m(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function n(e,t){return!f[t.localName]||f[t.localName]===e.localName}function r(t,i){var n=h[t];if(!n)return null;var r=e.document.createElement(n),a=p[t];return a&&i&&(r[a]=i.trim()),r}for(var a,o,u=e.document.createElement("div"),l=u,m=[];null!==(a=i());)if("<"!==a[0])l.appendChild(e.document.createTextNode((o=a,c.innerHTML=o,o=c.textContent,c.textContent="",o)));else{if("/"===a[1]){m.length&&m[m.length-1]===a.substr(2).replace(">","")&&(m.pop(),l=l.parentNode);continue}var g,v=s(a.substr(1,a.length-2));if(v){g=e.document.createProcessingInstruction("timestamp",v),l.appendChild(g);continue}var _=a.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!_)continue;if(!(g=r(_[1],_[3])))continue;if(!n(l,g))continue;if(_[2]){var y=_[2].split(".");y.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(d.hasOwnProperty(i)){var n=t?"background-color":"color",r=d[i];g.style[n]=r}})),g.className=y.join(" ")}m.push(_[1]),l.appendChild(g),l=g}return u}var g=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function v(e){for(var t=0;t=i[0]&&e<=i[1])return!0}return!1}function _(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var a=i.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(n(e,t),r(e)):void 0}for(n(t,e);i=r(t);)for(var a=0;a=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;rh&&(c=c<0?-1:1,c*=Math.ceil(h/l)*l),s<0&&(c+=""===a.vertical?i.height:i.width,o=o.reverse()),r.move(d,c)}else{var p=r.lineHeight/i.height*100;switch(a.lineAlign){case"center":s-=p/2;break;case"end":s-=p}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],r=new T(t)}var f=function(e,t){for(var r,a=new T(e),s=1,o=0;ou&&(r=new T(e),s=u),e=new T(a)}return r||a}(r,o);t.move(f.toCSSCompatValues(i))}function S(){}y.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},y.prototype.formatStyle=function(e,t){return 0===e?0:e+t},b.prototype=r(y.prototype),b.prototype.constructor=b,T.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},T.prototype.overlaps=function(e){return this.lefte.left&&this.tope.top},T.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},T.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},T.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},T.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},T.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},S.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},S.convertCueToDOMTree=function(e,t){return e&&t?m(e,t):null},S.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t100)throw new Error("Position must be between 0 and 100.");m=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return g},set:function(e){var t=n(e);t?(g=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return v},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");v=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return _},set:function(e){var t=n(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");_=t,this.hasBeenReset=!0}}}),this.displayState=void 0}r.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},e.exports=r},710:function(e){var t={"":!0,up:!0};function i(e){return"number"==typeof e&&e>=0&&e<=100}e.exports=function(){var e=100,n=3,r=0,a=100,s=0,o=100,u="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!i(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return n},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");n=e}},regionAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!i(e))throw new Error("RegionAnchorX must be between 0 and 100.");a=e}},regionAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!i(e))throw new Error("RegionAnchorY must be between 0 and 100.");r=e}},viewportAnchorY:{enumerable:!0,get:function(){return o},set:function(e){if(!i(e))throw new Error("ViewportAnchorY must be between 0 and 100.");o=e}},viewportAnchorX:{enumerable:!0,get:function(){return s},set:function(e){if(!i(e))throw new Error("ViewportAnchorX must be between 0 and 100.");s=e}},scroll:{enumerable:!0,get:function(){return u},set:function(e){var i=function(e){return"string"==typeof e&&!!t[e.toLowerCase()]&&e.toLowerCase()}(e);!1===i?console.warn("Scroll: an invalid or illegal string was specified."):u=i}}})}},575:function(e,t,i){var n;n=i(328),e.exports=function(e){"use strict";var t,i,n,r,a,s,o,u,l=e.browser.IS_IOS||e.browser.IS_NATIVE_ANDROID,c=e.getTech("Tech"),h=e.extend(c,{constructor:function(e,t){c.call(this,e,t),this.setPoster(e.poster),this.setSrc(this.options_.source,!0),this.setTimeout(function(){this.el_&&(this.el_.parentNode.className+=" vjs-youtube",l&&(this.el_.parentNode.className+=" vjs-youtube-mobile"),h.isApiReady?this.initYTPlayer():h.apiReadyQueue.push(this))}.bind(this))},dispose:function(){if(this.ytPlayer)this.ytPlayer.stopVideo&&this.ytPlayer.stopVideo(),this.ytPlayer.destroy&&this.ytPlayer.destroy();else{var e=h.apiReadyQueue.indexOf(this);-1!==e&&h.apiReadyQueue.splice(e,1)}this.ytPlayer=null,this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-youtube","").replace(" vjs-youtube-mobile",""),this.el_.parentNode.removeChild(this.el_),c.prototype.dispose.call(this)},createEl:function(){var e=document.createElement("div");e.setAttribute("id",this.options_.techId),e.setAttribute("style","width:100%;height:100%;top:0;left:0;position:absolute"),e.setAttribute("class","vjs-tech");var t=document.createElement("div");if(t.appendChild(e),!l&&!this.options_.ytControls){var i=document.createElement("div");i.setAttribute("class","vjs-iframe-blocker"),i.setAttribute("style","position:absolute;top:0;left:0;width:100%;height:100%"),i.onclick=function(){this.pause()}.bind(this),t.appendChild(i)}return t},initYTPlayer:function(){var e={controls:0,modestbranding:1,rel:0,showinfo:0,loop:this.options_.loop?1:0};if(void 0!==this.options_.autohide&&(e.autohide=this.options_.autohide),void 0!==this.options_.cc_load_policy&&(e.cc_load_policy=this.options_.cc_load_policy),void 0!==this.options_.ytControls&&(e.controls=this.options_.ytControls),void 0!==this.options_.disablekb&&(e.disablekb=this.options_.disablekb),void 0!==this.options_.color&&(e.color=this.options_.color),e.controls?void 0!==this.options_.fs&&(e.fs=this.options_.fs):e.fs=0,-1!==this.options_.source.src.indexOf("end=")){var t=this.options_.source.src.match(/end=([0-9]*)/);this.options_.end=parseInt(t[1])}if(void 0!==this.options_.end&&(e.end=this.options_.end),void 0!==this.options_.hl?e.hl=this.options_.hl:void 0!==this.options_.language&&(e.hl=this.options_.language.substr(0,2)),void 0!==this.options_.iv_load_policy&&(e.iv_load_policy=this.options_.iv_load_policy),void 0!==this.options_.list?e.list=this.options_.list:this.url&&void 0!==this.url.listId&&(e.list=this.url.listId),void 0!==this.options_.listType&&(e.listType=this.options_.listType),void 0!==this.options_.modestbranding&&(e.modestbranding=this.options_.modestbranding),void 0!==this.options_.playlist&&(e.playlist=this.options_.playlist),void 0!==this.options_.playsinline&&(e.playsinline=this.options_.playsinline),void 0!==this.options_.rel&&(e.rel=this.options_.rel),void 0!==this.options_.showinfo&&(e.showinfo=this.options_.showinfo),-1!==this.options_.source.src.indexOf("start=")){var i=this.options_.source.src.match(/start=([0-9]*)/);this.options_.start=parseInt(i[1])}if(void 0!==this.options_.start&&(e.start=this.options_.start),void 0!==this.options_.theme&&(e.theme=this.options_.theme),void 0!==this.options_.customVars){var n=this.options_.customVars;Object.keys(n).forEach((function(t){e[t]=n[t]}))}this.activeVideoId=this.url?this.url.videoId:null,this.activeList=e.list;var r={videoId:this.activeVideoId,playerVars:e,events:{onReady:this.onPlayerReady.bind(this),onPlaybackQualityChange:this.onPlayerPlaybackQualityChange.bind(this),onPlaybackRateChange:this.onPlayerPlaybackRateChange.bind(this),onStateChange:this.onPlayerStateChange.bind(this),onVolumeChange:this.onPlayerVolumeChange.bind(this),onError:this.onPlayerError.bind(this)}};void 0!==this.options_.enablePrivacyEnhancedMode&&this.options_.enablePrivacyEnhancedMode&&(r.host="https://www.youtube-nocookie.com"),this.ytPlayer=new YT.Player(this.options_.techId,r)},onPlayerReady:function(){this.options_.muted&&this.ytPlayer.mute(),this.ytPlayer.getAvailablePlaybackRates().length>1&&(this.featuresPlaybackRate=!0),this.playerReady_=!0,this.triggerReady(),this.playOnReady?this.play():this.cueOnReady&&(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)},onPlayerPlaybackQualityChange:function(){},onPlayerPlaybackRateChange:function(){this.trigger("ratechange")},onPlayerStateChange:function(e){var t=e.data;if(t!==this.lastState&&!this.errorNumber)switch(this.lastState=t,t){case-1:this.trigger("loadstart"),this.trigger("loadedmetadata"),this.trigger("durationchange"),this.trigger("ratechange");break;case YT.PlayerState.ENDED:this.trigger("ended");break;case YT.PlayerState.PLAYING:this.trigger("timeupdate"),this.trigger("durationchange"),this.trigger("playing"),this.trigger("play"),this.isSeeking&&this.onSeeked();break;case YT.PlayerState.PAUSED:this.trigger("canplay"),this.isSeeking?this.onSeeked():this.trigger("pause");break;case YT.PlayerState.BUFFERING:this.player_.trigger("timeupdate"),this.player_.trigger("waiting")}},onPlayerVolumeChange:function(){this.trigger("volumechange")},onPlayerError:function(e){this.errorNumber=e.data,this.trigger("pause"),this.trigger("error")},error:function(){var e=1e3+this.errorNumber;switch(this.errorNumber){case 5:return{code:e,message:"Error while trying to play the video"};case 2:case 100:return{code:e,message:"Unable to find the video"};case 101:case 150:return{code:e,message:"Playback on other Websites has been disabled by the video owner."}}return{code:e,message:"YouTube unknown error ("+this.errorNumber+")"}},loadVideoById_:function(e){var t={videoId:e};this.options_.start&&(t.startSeconds=this.options_.start),this.options_.end&&(t.endSeconds=this.options_.end),this.ytPlayer.loadVideoById(t)},cueVideoById_:function(e){var t={videoId:e};this.options_.start&&(t.startSeconds=this.options_.start),this.options_.end&&(t.endSeconds=this.options_.end),this.ytPlayer.cueVideoById(t)},src:function(e){return e&&this.setSrc({src:e}),this.source},poster:function(){return l?null:this.poster_},setPoster:function(e){this.poster_=e},setSrc:function(e){e&&e.src&&(delete this.errorNumber,this.source=e,this.url=h.parseUrl(e.src),this.options_.poster||this.url.videoId&&(this.poster_="https://img.youtube.com/vi/"+this.url.videoId+"/0.jpg",this.trigger("posterchange"),this.checkHighResPoster()),this.options_.autoplay&&!l?this.isReady_?this.play():this.playOnReady=!0:this.activeVideoId!==this.url.videoId&&(this.isReady_?(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId):this.cueOnReady=!0))},autoplay:function(){return this.options_.autoplay},setAutoplay:function(e){this.options_.autoplay=e},loop:function(){return this.options_.loop},setLoop:function(e){this.options_.loop=e},play:function(){this.url&&this.url.videoId&&(this.wasPausedBeforeSeek=!1,this.isReady_?(this.url.listId&&(this.activeList===this.url.listId?this.ytPlayer.playVideo():(this.ytPlayer.loadPlaylist(this.url.listId),this.activeList=this.url.listId)),this.activeVideoId===this.url.videoId?this.ytPlayer.playVideo():(this.loadVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)):(this.trigger("waiting"),this.playOnReady=!0))},pause:function(){this.ytPlayer&&this.ytPlayer.pauseVideo()},paused:function(){return!this.ytPlayer||this.lastState!==YT.PlayerState.PLAYING&&this.lastState!==YT.PlayerState.BUFFERING},currentTime:function(){return this.ytPlayer?this.ytPlayer.getCurrentTime():0},setCurrentTime:function(e){this.lastState===YT.PlayerState.PAUSED&&(this.timeBeforeSeek=this.currentTime()),this.isSeeking||(this.wasPausedBeforeSeek=this.paused()),this.ytPlayer.seekTo(e,!0),this.trigger("timeupdate"),this.trigger("seeking"),this.isSeeking=!0,this.lastState===YT.PlayerState.PAUSED&&this.timeBeforeSeek!==e&&(clearInterval(this.checkSeekedInPauseInterval),this.checkSeekedInPauseInterval=setInterval(function(){this.lastState===YT.PlayerState.PAUSED&&this.isSeeking?this.currentTime()!==this.timeBeforeSeek&&(this.trigger("timeupdate"),this.onSeeked()):clearInterval(this.checkSeekedInPauseInterval)}.bind(this),250))},seeking:function(){return this.isSeeking},seekable:function(){return this.ytPlayer?e.createTimeRange(0,this.ytPlayer.getDuration()):e.createTimeRange()},onSeeked:function(){clearInterval(this.checkSeekedInPauseInterval),this.isSeeking=!1,this.wasPausedBeforeSeek&&this.pause(),this.trigger("seeked")},playbackRate:function(){return this.ytPlayer?this.ytPlayer.getPlaybackRate():1},setPlaybackRate:function(e){this.ytPlayer&&this.ytPlayer.setPlaybackRate(e)},duration:function(){return this.ytPlayer?this.ytPlayer.getDuration():0},currentSrc:function(){return this.source&&this.source.src},ended:function(){return!!this.ytPlayer&&this.lastState===YT.PlayerState.ENDED},volume:function(){return this.ytPlayer?this.ytPlayer.getVolume()/100:1},setVolume:function(e){this.ytPlayer&&this.ytPlayer.setVolume(100*e)},muted:function(){return!!this.ytPlayer&&this.ytPlayer.isMuted()},setMuted:function(e){this.ytPlayer&&(this.muted(!0),e?this.ytPlayer.mute():this.ytPlayer.unMute(),this.setTimeout((function(){this.trigger("volumechange")}),50))},buffered:function(){if(!this.ytPlayer||!this.ytPlayer.getVideoLoadedFraction)return e.createTimeRange();var t=this.ytPlayer.getVideoLoadedFraction()*this.ytPlayer.getDuration();return e.createTimeRange(0,t)},preload:function(){},load:function(){},reset:function(){},networkState:function(){if(!this.ytPlayer)return 0;switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 3:return 2;default:return 1}},readyState:function(){if(!this.ytPlayer)return 0;switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 5:return 1;case 3:return 2;default:return 4}},supportsFullScreen:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled},checkHighResPoster:function(){var e="https://img.youtube.com/vi/"+this.url.videoId+"/maxresdefault.jpg";try{var t=new Image;t.onload=function(){if("naturalHeight"in t){if(t.naturalHeight<=90||t.naturalWidth<=120)return}else if(t.height<=90||t.width<=120)return;this.poster_=e,this.trigger("posterchange")}.bind(this),t.onerror=function(){},t.src=e}catch(e){}}});h.isSupported=function(){return!0},h.canPlaySource=function(e){return h.canPlayType(e.type)},h.canPlayType=function(e){return"video/youtube"===e},h.parseUrl=function(e){var t={videoId:null},i=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);i&&11===i[2].length&&(t.videoId=i[2]);return(i=e.match(/[?&]list=([^#\&\?]+)/))&&i[1]&&(t.listId=i[1]),t},h.apiReadyQueue=[],"undefined"!=typeof document&&(r="https://www.youtube.com/iframe_api",a=function(){YT.ready((function(){h.isApiReady=!0;for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:{},t=e.id,i=e.url,n=t||i;if(!n)throw new Error("An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.");if(u(n))return"https://vimeo.com/".concat(n);if(l(n))return n.replace("http:","https:");if(t)throw new TypeError("“".concat(t,"” is not a valid video id."));throw new TypeError("“".concat(n,"” is not a vimeo.com url."))}var h=void 0!==Array.prototype.indexOf,d="undefined"!=typeof window&&void 0!==window.postMessage;if(!(a||h&&d))throw new Error("Sorry, the Vimeo Player API is not available in this browser.");var p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==i.g?i.g:"undefined"!=typeof self?self:{};!function(e){if(!e.WeakMap){var t=Object.prototype.hasOwnProperty,i=function(e,t,i){Object.defineProperty?Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i}):e[t]=i};e.WeakMap=function(){function e(){if(void 0===this)throw new TypeError("Constructor WeakMap requires 'new'");if(i(this,"_id",a("_WeakMap")),arguments.length>0)throw new TypeError("WeakMap iterable is not supported")}function r(e,i){if(!n(e)||!t.call(e,"_id"))throw new TypeError(i+" method called on incompatible receiver "+typeof e)}function a(e){return e+"_"+s()+"."+s()}function s(){return Math.random().toString().substring(2)}return i(e.prototype,"delete",(function(e){if(r(this,"delete"),!n(e))return!1;var t=e[this._id];return!(!t||t[0]!==e||(delete e[this._id],0))})),i(e.prototype,"get",(function(e){if(r(this,"get"),n(e)){var t=e[this._id];return t&&t[0]===e?t[1]:void 0}})),i(e.prototype,"has",(function(e){if(r(this,"has"),!n(e))return!1;var t=e[this._id];return!(!t||t[0]!==e)})),i(e.prototype,"set",(function(e,t){if(r(this,"set"),!n(e))throw new TypeError("Invalid value used as weak map key");var a=e[this._id];return a&&a[0]===e?(a[1]=t,this):(i(e,this._id,[e,t]),this)})),i(e,"_polyfill",!0),e}()}function n(e){return Object(e)===e}}("undefined"!=typeof self?self:"undefined"!=typeof window?window:p);var f,m,g=(f=function(e){var t,i,n;n=function(){var e,t,i,n=Object.prototype.toString,r="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,t,i,n){return Object.defineProperty(e,t,{value:i,writable:!0,configurable:!1!==n})}}catch(t){e=function(e,t,i){return e[t]=i,e}}function a(e,n){i.add(e,n),t||(t=r(i.drain))}function s(e){var t,i=typeof e;return null==e||"object"!=i&&"function"!=i||(t=e.then),"function"==typeof t&&t}function o(){for(var e=0;e0&&a(o,i))}catch(e){c.call(new d(i),e)}}}function c(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&a(o,t))}function h(e,t,i,n){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return w.reduce((function(t,i){var n=e.getAttribute("data-vimeo-".concat(i));return(n||""===n)&&(t[i]=""===n?1:n),t}),t)}function E(e,t){var i=e.html;if(!t)throw new TypeError("An element must be provided");if(null!==t.getAttribute("data-vimeo-initialized"))return t.querySelector("iframe");var n=document.createElement("div");return n.innerHTML=i,t.appendChild(n.firstChild),t.setAttribute("data-vimeo-initialized","true"),t.querySelector("iframe")}function C(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;return new Promise((function(n,r){if(!l(e))throw new TypeError("“".concat(e,"” is not a vimeo.com url."));var a="https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(e));for(var s in t)t.hasOwnProperty(s)&&(a+="&".concat(s,"=").concat(encodeURIComponent(t[s])));var o="XDomainRequest"in window?new XDomainRequest:new XMLHttpRequest;o.open("GET",a,!0),o.onload=function(){if(404!==o.status)if(403!==o.status)try{var t=JSON.parse(o.responseText);if(403===t.domain_status_code)return E(t,i),void r(new Error("“".concat(e,"” is not embeddable.")));n(t)}catch(e){r(e)}else r(new Error("“".concat(e,"” is not embeddable.")));else r(new Error("“".concat(e,"” was not found.")))},o.onerror=function(){var e=o.status?" (".concat(o.status,")"):"";r(new Error("There was an error fetching the embed code from Vimeo".concat(e,".")))},o.send()}))}function x(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.warn(e),{}}return e}function k(e,t,i){if(e.element.contentWindow&&e.element.contentWindow.postMessage){var n={method:t};void 0!==i&&(n.value=i);var r=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,"$1"));r>=8&&r<10&&(n=JSON.stringify(n)),e.element.contentWindow.postMessage(n,e.origin)}}function I(e,t){var i,n=[];if((t=x(t)).event)"error"===t.event&&y(e,t.data.method).forEach((function(i){var n=new Error(t.data.message);n.name=t.data.name,i.reject(n),b(e,t.data.method,i)})),n=y(e,"event:".concat(t.event)),i=t.data;else if(t.method){var r=function(e,t){var i=y(e,t);if(i.length<1)return!1;var n=i.shift();return b(e,t,n),n}(e,t.method);r&&(n.push(r),i=t.value)}n.forEach((function(t){try{if("function"==typeof t)return void t.call(e,i);t.resolve(i)}catch(e){}}))}var A=new WeakMap,P=new WeakMap,D={},L=function(){function e(i){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t(this,e),window.jQuery&&i instanceof jQuery&&(i.length>1&&window.console&&console.warn&&console.warn("A jQuery object with multiple elements was passed, using the first element."),i=i[0]),"undefined"!=typeof document&&"string"==typeof i&&(i=document.getElementById(i)),!o(i))throw new TypeError("You must pass either a valid element or a valid id.");if("IFRAME"!==i.nodeName){var a=i.querySelector("iframe");a&&(i=a)}if("IFRAME"===i.nodeName&&!l(i.getAttribute("src")||""))throw new Error("The player element passed isn’t a Vimeo embed.");if(A.has(i))return A.get(i);this._window=i.ownerDocument.defaultView,this.element=i,this.origin="*";var s=new g((function(e,t){if(n._onMessage=function(i){if(l(i.origin)&&n.element.contentWindow===i.source){"*"===n.origin&&(n.origin=i.origin);var r=x(i.data);if(r&&"error"===r.event&&r.data&&"ready"===r.data.method){var a=new Error(r.data.message);return a.name=r.data.name,void t(a)}var s=r&&"ready"===r.event,o=r&&"ping"===r.method;if(s||o)return n.element.setAttribute("data-ready","true"),void e();I(n,r)}},n._window.addEventListener("message",n._onMessage),"IFRAME"!==n.element.nodeName){var a=S(i,r);C(c(a),a,i).then((function(e){var t=E(e,i);return n.element=t,n._originalElement=i,T(i,t),A.set(n.element,n),e})).catch(t)}}));if(P.set(this,s),A.set(this.element,this),"IFRAME"===this.element.nodeName&&k(this,"ping"),D.isEnabled){var u=function(){return D.exit()};this.fullscreenchangeHandler=function(){D.isFullscreen?_(n,"event:exitFullscreen",u):b(n,"event:exitFullscreen",u),n.ready().then((function(){k(n,"fullscreenchange",D.isFullscreen)}))},D.on("fullscreenchange",this.fullscreenchangeHandler)}return this}var i,n;return i=e,n=[{key:"callMethod",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new g((function(n,r){return t.ready().then((function(){_(t,e,{resolve:n,reject:r}),k(t,e,i)})).catch(r)}))}},{key:"get",value:function(e){var t=this;return new g((function(i,n){return e=s(e,"get"),t.ready().then((function(){_(t,e,{resolve:i,reject:n}),k(t,e)})).catch(n)}))}},{key:"set",value:function(e,t){var i=this;return new g((function(n,r){if(e=s(e,"set"),null==t)throw new TypeError("There must be a value to set.");return i.ready().then((function(){_(i,e,{resolve:n,reject:r}),k(i,e,t)})).catch(r)}))}},{key:"on",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(!t)throw new TypeError("You must pass a callback function.");if("function"!=typeof t)throw new TypeError("The callback must be a function.");0===y(this,"event:".concat(e)).length&&this.callMethod("addEventListener",e).catch((function(){})),_(this,"event:".concat(e),t)}},{key:"off",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(t&&"function"!=typeof t)throw new TypeError("The callback must be a function.");b(this,"event:".concat(e),t)&&this.callMethod("removeEventListener",e).catch((function(e){}))}},{key:"loadVideo",value:function(e){return this.callMethod("loadVideo",e)}},{key:"ready",value:function(){var e=P.get(this)||new g((function(e,t){t(new Error("Unknown player. Probably unloaded."))}));return g.resolve(e)}},{key:"addCuePoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.callMethod("addCuePoint",{time:e,data:t})}},{key:"removeCuePoint",value:function(e){return this.callMethod("removeCuePoint",e)}},{key:"enableTextTrack",value:function(e,t){if(!e)throw new TypeError("You must pass a language.");return this.callMethod("enableTextTrack",{language:e,kind:t})}},{key:"disableTextTrack",value:function(){return this.callMethod("disableTextTrack")}},{key:"pause",value:function(){return this.callMethod("pause")}},{key:"play",value:function(){return this.callMethod("play")}},{key:"requestFullscreen",value:function(){return D.isEnabled?D.request(this.element):this.callMethod("requestFullscreen")}},{key:"exitFullscreen",value:function(){return D.isEnabled?D.exit():this.callMethod("exitFullscreen")}},{key:"getFullscreen",value:function(){return D.isEnabled?g.resolve(D.isFullscreen):this.get("fullscreen")}},{key:"requestPictureInPicture",value:function(){return this.callMethod("requestPictureInPicture")}},{key:"exitPictureInPicture",value:function(){return this.callMethod("exitPictureInPicture")}},{key:"getPictureInPicture",value:function(){return this.get("pictureInPicture")}},{key:"unload",value:function(){return this.callMethod("unload")}},{key:"destroy",value:function(){var e=this;return new g((function(t){if(P.delete(e),A.delete(e.element),e._originalElement&&(A.delete(e._originalElement),e._originalElement.removeAttribute("data-vimeo-initialized")),e.element&&"IFRAME"===e.element.nodeName&&e.element.parentNode&&(e.element.parentNode.parentNode&&e._originalElement&&e._originalElement!==e.element.parentNode?e.element.parentNode.parentNode.removeChild(e.element.parentNode):e.element.parentNode.removeChild(e.element)),e.element&&"DIV"===e.element.nodeName&&e.element.parentNode){e.element.removeAttribute("data-vimeo-initialized");var i=e.element.querySelector("iframe");i&&i.parentNode&&(i.parentNode.parentNode&&e._originalElement&&e._originalElement!==i.parentNode?i.parentNode.parentNode.removeChild(i.parentNode):i.parentNode.removeChild(i))}e._window.removeEventListener("message",e._onMessage),D.isEnabled&&D.off("fullscreenchange",e.fullscreenchangeHandler),t()}))}},{key:"getAutopause",value:function(){return this.get("autopause")}},{key:"setAutopause",value:function(e){return this.set("autopause",e)}},{key:"getBuffered",value:function(){return this.get("buffered")}},{key:"getCameraProps",value:function(){return this.get("cameraProps")}},{key:"setCameraProps",value:function(e){return this.set("cameraProps",e)}},{key:"getChapters",value:function(){return this.get("chapters")}},{key:"getCurrentChapter",value:function(){return this.get("currentChapter")}},{key:"getColor",value:function(){return this.get("color")}},{key:"setColor",value:function(e){return this.set("color",e)}},{key:"getCuePoints",value:function(){return this.get("cuePoints")}},{key:"getCurrentTime",value:function(){return this.get("currentTime")}},{key:"setCurrentTime",value:function(e){return this.set("currentTime",e)}},{key:"getDuration",value:function(){return this.get("duration")}},{key:"getEnded",value:function(){return this.get("ended")}},{key:"getLoop",value:function(){return this.get("loop")}},{key:"setLoop",value:function(e){return this.set("loop",e)}},{key:"setMuted",value:function(e){return this.set("muted",e)}},{key:"getMuted",value:function(){return this.get("muted")}},{key:"getPaused",value:function(){return this.get("paused")}},{key:"getPlaybackRate",value:function(){return this.get("playbackRate")}},{key:"setPlaybackRate",value:function(e){return this.set("playbackRate",e)}},{key:"getPlayed",value:function(){return this.get("played")}},{key:"getQualities",value:function(){return this.get("qualities")}},{key:"getQuality",value:function(){return this.get("quality")}},{key:"setQuality",value:function(e){return this.set("quality",e)}},{key:"getSeekable",value:function(){return this.get("seekable")}},{key:"getSeeking",value:function(){return this.get("seeking")}},{key:"getTextTracks",value:function(){return this.get("textTracks")}},{key:"getVideoEmbedCode",value:function(){return this.get("videoEmbedCode")}},{key:"getVideoId",value:function(){return this.get("videoId")}},{key:"getVideoTitle",value:function(){return this.get("videoTitle")}},{key:"getVideoWidth",value:function(){return this.get("videoWidth")}},{key:"getVideoHeight",value:function(){return this.get("videoHeight")}},{key:"getVideoUrl",value:function(){return this.get("videoUrl")}},{key:"getVolume",value:function(){return this.get("volume")}},{key:"setVolume",value:function(e){return this.set("volume",e)}}],n&&r(i.prototype,n),e}();a||(D=function(){var e=function(){for(var e,t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],i=0,n=t.length,r={};i0&&void 0!==arguments[0]?arguments[0]:document,t=[].slice.call(e.querySelectorAll("[data-vimeo-id], [data-vimeo-url]")),i=function(e){"console"in window&&console.error&&console.error("There was an error creating an embed: ".concat(e))};t.forEach((function(e){try{if(null!==e.getAttribute("data-vimeo-defer"))return;var t=S(e);C(c(t),t,e).then((function(t){return E(t,e)})).catch(i)}catch(e){i(e)}}))}(),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(!window.VimeoPlayerResizeEmbeds_){window.VimeoPlayerResizeEmbeds_=!0;var t=function(t){if(l(t.origin)&&t.data&&"spacechange"===t.data.event)for(var i=e.querySelectorAll("iframe"),n=0;n{this._player.on(e,(t=>{this._vimeoState.progress.duration!==t.duration&&this.trigger("durationchange"),this._vimeoState.progress=t,this.trigger(e)}))})),this._player.on("pause",(()=>this._vimeoState.playing=!1)),this._player.on("play",(()=>{this._vimeoState.playing=!0,this._vimeoState.ended=!1})),this._player.on("ended",(()=>{this._vimeoState.playing=!1,this._vimeoState.ended=!0})),this._player.on("volumechange",(e=>this._vimeoState.volume=e)),this._player.on("error",(e=>this.trigger("error",e))),this.triggerReady()}initVimeoState(){const e=this._vimeoState={ended:!1,playing:!1,volume:0,progress:{seconds:0,percent:0,duration:0}};this._player.getCurrentTime().then((t=>e.progress.seconds=t)),this._player.getDuration().then((t=>e.progress.duration=t)),this._player.getPaused().then((t=>e.playing=!t)),this._player.getVolume().then((t=>e.volume=t))}createEl(){const t=e.default.dom.createEl("div",{id:this.options_.techId});return t.style.cssText="width:100%;height:100%;top:0;left:0;position:absolute",t.className="vjs-vimeo",t}controls(){return!0}supportsFullScreen(){return!0}src(){return this.options_.source}currentSrc(){return this.options_.source.src}currentTime(){return this._vimeoState.progress.seconds}setCurrentTime(e){this._player.setCurrentTime(e)}volume(){return this._vimeoState.volume}setVolume(e){return this._player.setVolume(e)}duration(){return this._vimeoState.progress.duration}buffered(){const t=this._vimeoState.progress;return e.default.createTimeRange(0,t.percent*t.duration)}paused(){return!this._vimeoState.playing}pause(){this._player.pause()}play(){this._player.play()}muted(){return 0===this._vimeoState.volume}ended(){return this._vimeoState.ended}playbackRate(){return 1}}N.prototype.featuresTimeupdateEvents=!0,N.isSupported=function(){return!0},M.withSourceHandlers(N),N.nativeSourceHandler={},N.nativeSourceHandler.canPlayType=function(e){return"video/vimeo"===e?"maybe":""},N.nativeSourceHandler.canHandleSource=function(e){return e.type?N.nativeSourceHandler.canPlayType(e.type):e.src?N.nativeSourceHandler.canPlayType(e.src):""},N.nativeSourceHandler.handleSource=function(e,t){t.src(e.src)},N.nativeSourceHandler.dispose=function(){},N.registerSourceHandler(N.nativeSourceHandler),void 0!==e.default.registerTech?e.default.registerTech("Vimeo",N):e.default.registerComponent("Vimeo",N),N.VERSION="0.0.1";var U=function(){return U=Object.assign||function(e){for(var t,i=1,n=arguments.length;i{const e=q[0],t={};for(const i of q)if((i?i[1]:void 0)in document){for(const[n,r]of i.entries())t[e[n]]=r;return t}return!1})(),X={change:W.fullscreenchange,error:W.fullscreenerror};let Y={request:(e=document.documentElement,t)=>new Promise(((i,n)=>{const r=()=>{Y.off("change",r),i()};Y.on("change",r);const a=e[W.requestFullscreen](t);a instanceof Promise&&a.then(r).catch(n)})),exit:()=>new Promise(((e,t)=>{if(!Y.isFullscreen)return void e();const i=()=>{Y.off("change",i),e()};Y.on("change",i);const n=document[W.exitFullscreen]();n instanceof Promise&&n.then(i).catch(t)})),toggle:(e,t)=>Y.isFullscreen?Y.exit():Y.request(e,t),onchange(e){Y.on("change",e)},onerror(e){Y.on("error",e)},on(e,t){const i=X[e];i&&document.addEventListener(i,t,!1)},off(e,t){const i=X[e];i&&document.removeEventListener(i,t,!1)},raw:W};Object.defineProperties(Y,{isFullscreen:{get:()=>Boolean(document[W.fullscreenElement])},element:{enumerable:!0,get:()=>document[W.fullscreenElement]?document[W.fullscreenElement]:void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[W.fullscreenEnabled])}}),W||(Y={isEnabled:!1});var z=Y}();var r=window;for(var a in n)r[a]=n[a];n.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})}();