jessibuca-pro.js 919 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self)["jessibuca-pro"]=t()}(this,function(){"use strict";const i="fetch",F="websocket",j="worker",n="player",U="playerAudio",v="playbackTF",p="mp4",N="webm",z="flv",G="webTransport",H="nakedFlow",V={flv:"FLV",m7s:"m7s",hls:"HLS",fmp4:"FMP4",webrtc:"Webrtc",webTransport:"WebTransport",nakedFlow:"裸流"},W="canvas",K="video",$="debug",J="warn",q="click",Q="jbprov",Y={url:"",playbackConfig:{},fullscreenWatermarkConfig:{},playType:n,playbackForwardMaxRateDecodeIFrame:4,playOptions:{},isLive:!0,isMulti:!1,isCrypto:!1},X={playType:n,container:"",videoBuffer:1e3,videoBufferDelay:1e3,networkDelay:1e4,isResize:!0,isFullResize:!1,isFlv:!1,isHls:!1,isFmp4:!1,isWebrtc:!1,isWebrtcForZLM:!1,isNakedFlow:!1,isMpeg4:!1,debug:!1,debugLevel:J,debugUuid:"",isMulti:!1,hotKey:!1,loadingTimeout:10,heartTimeout:10,timeout:10,pageVisibilityHiddenTimeout:300,loadingTimeoutReplay:!0,heartTimeoutReplay:!0,loadingTimeoutReplayTimes:3,heartTimeoutReplayTimes:3,heartTimeoutReplayUseLastFrameShow:!1,replayUseLastFrameShow:!1,supportDblclickFullscreen:!1,showBandwidth:!1,showPerformance:!1,mseCorrectTimeDuration:20,keepScreenOn:!0,isNotMute:!1,hasAudio:!0,hasVideo:!0,operateBtns:{fullscreen:!1,screenshot:!1,play:!1,audio:!1,record:!1,ptz:!1,quality:!1,zoom:!1,close:!1,scale:!1,performance:!1,aiFace:!1,aiObject:!1,fullscreenFn:null,fullscreenExitFn:null,screenshotFn:null,playFn:null,pauseFn:null,recordFn:null,recordStopFn:null},extendOperateBtns:[],contextmenuBtns:[],watermarkConfig:{},controlAutoHide:!1,hasControl:!1,loadingIcon:!0,loadingText:"",background:"",backgroundLoadingShow:!1,loadingBackground:"",decoder:"decoder-pro.js",decoderAudio:"decoder-pro-audio.js",decoderWASM:"",isDecoderUseCDN:!1,url:"",rotate:0,mirrorRotate:"none",playbackConfig:{playList:[],fps:"",showControl:!0,showRateBtn:!1,rateConfig:[],isCacheBeforeDecodeForFpsRender:!1,uiUsePlaybackPause:!1,isPlaybackPauseClearCache:!0,isUseFpsRender:!1,isUseLocalCalculateTime:!1,localOneFrameTimestamp:40,supportWheel:!1},qualityConfig:[],defaultStreamQuality:"",scaleConfig:["拉伸","缩放","正常"],forceNoOffscreen:!0,hiddenAutoPause:!1,protocol:2,demuxType:z,useWasm:!1,useWCS:!1,useSIMD:!0,wcsUseVideoRender:!0,wasmUseVideoRender:!0,mseUseCanvasRender:!1,hlsUseCanvasRender:!1,useMSE:!1,useOffscreen:!1,useWebGPU:!1,mseDecodeErrorReplay:!0,wcsDecodeErrorReplay:!0,wasmDecodeErrorReplay:!0,autoWasm:!0,webglAlignmentErrorReplay:!0,webglContextLostErrorReplay:!0,openWebglAlignment:!1,syncAudioAndVideo:!1,playbackDelayTime:1e3,playbackFps:25,playbackForwardMaxRateDecodeIFrame:4,playbackCurrentTimeMove:!0,useVideoRender:!0,useCanvasRender:!1,networkDelayTimeoutReplay:!1,recordType:p,checkFirstIFrame:!0,nakedFlowFps:25,audioEngine:null,isShowRecordingUI:!0,isShowZoomingUI:!0,useFaceDetector:!1,useObjectDetector:!1,ptzClickType:q,ptzStopEmitDelay:.3,ptzZoomShow:!1,ptzApertureShow:!1,ptzFocusShow:!1,ptzMoreArrowShow:!1,weiXinInAndroidAudioBufferSize:4800,isCrypto:!1,cryptoKey:"",cryptoIV:"",cryptoKeyUrl:"",autoResize:!1,useWebFullScreen:!1,ptsMaxDiff:3600,aiFaceDetectWidth:192,aiObjectDetectWidth:192,videoRenderSupportScale:!0,mediaSourceTsIsMaxDiffReplay:!0,controlHtml:"",isH265:!1,supportLockScreenPlayAudio:!0,supportHls265:!0},Z="init",ee="initVideo",te="initAudio",ie="audioCode",re="videoCode",se="videoCodec",ae="closeEnd",E={fullscreen:"fullscreen$2",webFullscreen:"webFullscreen",decoderWorkerInit:"decoderWorkerInit",play:"play",playing:"playing",pause:"pause",mute:"mute",load:"load",loading:"loading",zooming:"zooming",videoInfo:"videoInfo",timeUpdate:"timeUpdate",audioInfo:"audioInfo",log:"log",error:"error",kBps:"kBps",timeout:"timeout",delayTimeout:"delayTimeout",delayTimeoutRetryEnd:"delayTimeoutRetryEnd",loadingTimeout:"loadingTimeout",loadingTimeoutRetryEnd:"loadingTimeoutRetryEnd",stats:"stats",performance:"performance",faceDetectActive:"faceDetectActive",objectDetectActive:"objectDetectActive",record:"record",recording:"recording",recordingTimestamp:"recordingTimestamp",recordStart:"recordStart",recordEnd:"recordEnd",recordCreateError:"recordCreateError",recordBlob:"recordBlob",buffer:"buffer",videoFrame:"videoFrame",start:"start",metadata:"metadata",resize:"resize",volumechange:"volumechange",destroy:"destroy",beforeDestroy:"beforeDestroy",streamEnd:"streamEnd",streamRate:"streamRate",streamAbps:"streamAbps",streamVbps:"streamVbps",streamDts:"streamDts",streamSuccess:"streamSuccess",streamMessage:"streamMessage",streamError:"streamError",streamStats:"streamStats",mseSourceOpen:"mseSourceOpen",mseSourceClose:"mseSourceClose",mseSourceended:"mseSourceended",mseSourceBufferError:"mseSourceBufferError",mseAddSourceBufferError:"mseAddSourceBufferError",mseSourceBufferBusy:"mseSourceBufferBusy",mseSourceBufferFull:"mseSourceBufferFull",videoWaiting:"videoWaiting",videoTimeUpdate:"videoTimeUpdate",videoSyncAudio:"videoSyncAudio",playToRenderTimes:"playToRenderTimes",playbackTime:"playbackTime",playbackTimestamp:"playbackTimestamp",playbackPrecision:"playbackPrecision",playbackJustTime:"playbackJustTime",playbackStats:"playbackStats",playbackSeek:"playbackSeek",playbackPause:"playbackPause",playbackPauseOrResume:"playbackPauseOrResume",playbackRateChange:"playbackRateChange",playbackPreRateChange:"playbackPreRateChange",ptz:"ptz",streamQualityChange:"streamQualityChange",visibilityChange:"visibilityChange",netBuf:"netBuf",close:"close",networkDelayTimeout:"networkDelayTimeout",togglePerformancePanel:"togglePerformancePanel",viewResizeChange:"viewResizeChange",flvDemuxBufferSizeTooLarge:"flvDemuxBufferSizeTooLarge",talkGetUserMediaSuccess:"talkGetUserMediaSuccess",talkGetUserMediaFail:"talkGetUserMediaFail",talkGetUserMediaTimeout:"talkGetUserMediaTimeout",talkStreamStart:"talkStreamStart",talkStreamOpen:"talkStreamOpen",talkStreamClose:"talkStreamClose",talkStreamError:"talkStreamError",talkStreamInactive:"talkStreamInactive",webrtcDisconnect:"webrtcDisconnect",webrtcFailed:"webrtcFailed",webrtcClosed:"webrtcClosed",crashLog:"crashLog",focus:"focus",blur:"blur",visibilityHiddenTimeout:"visibilityHiddenTimeout",websocketOpen:"websocketOpen",websocketClose:"websocketClose",websocketError:"websocketError",websocketMessage:"websocketMessage",aiObjectDetectorInfo:"aiObjectDetectorInfo",aiFaceDetector:"aiFaceDetector",playFailedAndPaused:"playFailedAndPaused",audioResumeState:"audioResumeState"},ne={load:E.load,timeUpdate:E.timeUpdate,videoInfo:E.videoInfo,audioInfo:E.audioInfo,error:E.error,kBps:E.kBps,start:E.start,timeout:E.timeout,loadingTimeout:E.loadingTimeout,loadingTimeoutRetryEnd:E.loadingTimeoutRetryEnd,delayTimeout:E.delayTimeout,delayTimeoutRetryEnd:E.delayTimeoutRetryEnd,fullscreen:"fullscreen",webFullscreen:E.webFullscreen,play:E.play,pause:E.pause,mute:E.mute,stats:E.stats,performance:E.performance,recordingTimestamp:E.recordingTimestamp,recordStart:E.recordStart,recordEnd:E.recordEnd,recordBlob:E.recordBlob,playToRenderTimes:E.playToRenderTimes,playbackSeek:E.playbackSeek,playbackStats:E.playbackStats,playbackTimestamp:E.playbackTimestamp,playbackPauseOrResume:E.playbackPauseOrResume,playbackPreRateChange:E.playbackPreRateChange,playbackRateChange:E.playbackRateChange,ptz:E.ptz,streamQualityChange:E.streamQualityChange,zooming:E.zooming,crashLog:E.crashLog,focus:E.focus,blur:E.blur,visibilityHiddenTimeout:E.visibilityHiddenTimeout,visibilityChange:E.visibilityChange,websocketOpen:E.websocketOpen,websocketClose:E.websocketClose,networkDelayTimeout:E.networkDelayTimeout,aiObjectDetectorInfo:E.aiObjectDetectorInfo,playFailedAndPaused:E.playFailedAndPaused,audioResumeState:E.audioResumeState},oe={talkStreamClose:E.talkStreamClose,talkStreamError:E.talkStreamError,talkStreamInactive:E.talkStreamInactive,talkGetUserMediaTimeout:E.talkGetUserMediaTimeout},m={playError:"playIsNotPauseOrUrlIsNull",fetchError:"fetchError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsDecodeError:"webcodecsDecodeError",webcodecsUnsupportedConfigurationError:"webcodecsUnsupportedConfigurationError",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceDecoderConfigurationError:"mediaSourceDecoderConfigurationError",mediaSourceFull:E.mseSourceBufferFull,mseSourceBufferError:E.mseSourceBufferError,mseAddSourceBufferError:E.mseAddSourceBufferError,mediaSourceAppendBufferError:"mediaSourceAppendBufferError",mediaSourceBufferListLarge:"mediaSourceBufferListLarge",mediaSourceAppendBufferEndTimeout:"mediaSourceAppendBufferEndTimeout",mediaSourceTsIsMaxDiff:"mediaSourceTsIsMaxDiff",mediaSourceUseCanvasRenderPlayFailed:"mediaSourceUseCanvasRenderPlayFailed",wasmDecodeError:"wasmDecodeError",wasmUseVideoRenderError:"wasmUseVideoRenderError",hlsError:"hlsError",webrtcError:"webrtcError",webglAlignmentError:"webglAlignmentError",wasmWidthOrHeightChange:"wasmWidthOrHeightChange",mseWidthOrHeightChange:"mseWidthOrHeightChange",wcsWidthOrHeightChange:"wcsWidthOrHeightChange",tallWebsocketClosedByError:"tallWebsocketClosedByError",flvDemuxBufferSizeTooLarge:E.flvDemuxBufferSizeTooLarge,wasmDecodeVideoNoResponseError:"wasmDecodeVideoNoResponseError",audioChannelError:"audioChannelError",simdH264DecodeVideoWidthIsTooLarge:"simdH264DecodeVideoWidthIsTooLarge",webglContextLostError:"webglContextLostError"},le="notConnect",ce="open",o={download:"download",base64:"base64",blob:"blob"},de="download",ue={7:"H264(AVC)",12:"H265(HEVC)",99:"MPEG4"},he="H264(AVC)",pe="H265(HEVC)",fe={AAC:"AAC",ALAW:"ALAW(g711a)",MULAW:"MULAW(g711u)"},ge={10:"AAC",7:"ALAW",8:"MULAW"},me=6,Ae="webcodecs",r="webgl",s="webgpu",ye="offscreen",be="mse",ve='video/mp4; codecs="avc1.64002A"',Ee='video/mp4; codecs="hev1.1.6.L123.b0"',we="oneHour",Te="halfHour",Se="fiveMin",ke={oneHour:"one-hour",halfHour:"half-hour",tenMin:"ten-min",fiveMin:"five-min"},_e=["oneHour","halfHour","tenMin","fiveMin"],Ce=["up","right","down","left","left-up","right-up","left-down","right-down"],Re="stop",De="fiStop",Le="g711a",xe="g711u",l={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"},Ie="canplay",Pe="waiting",Be="timeupdate",Me="ratechange",Oe="The user aborted a request",Fe="AbortError",je="AbortError",Ue="worklet",Ne={encType:Le,packetType:"rtp",rtpSsrc:"0000000000",numberChannels:1,sampleRate:8e3,sampleBitsWidth:16,debug:!1,debugLevel:J,testMicrophone:!1,audioBufferLength:160,engine:Ue,checkGetUserMediaTimeout:!1,getUserMediaTimeout:1e4},ze="worklet",Ge="script",He="active",Ve={name:"",index:0,icon:"",iconHover:"",iconTitle:"",activeIcon:"",activeIconHover:"",activeIconTitle:"",click:null,activeClick:null},We={content:"",click:null,index:0};class Ke{constructor(a){this.log=function(e){if(a._opt.debug&&a._opt.debugLevel==$){for(var t=a._opt.debugUuid?`[${a._opt.debugUuid}]`:"",i=arguments.length,r=new Array(1<i?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];console.log(`JbPro${t}:[✅✅✅][${e}]`,...r)}},this.warn=function(e){if(a._opt.debug&&(a._opt.debugLevel==$||a._opt.debugLevel==J)){for(var t=a._opt.debugUuid?`[${a._opt.debugUuid}]`:"",i=arguments.length,r=new Array(1<i?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];console.log(`JbPro${t}:[❗❗❗][${e}]`,...r)}},this.error=function(e){for(var t=a._opt.debugUuid?`[${a._opt.debugUuid}]`:"",i=arguments.length,r=new Array(1<i?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];console.error(`JbPro${t}:[❌❌❌][${e}]`,...r)}}}var B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $e(e,t){return e(t={exports:{}},t.exports),t.exports}var f=$e(function(e){var n,t,o,i,r;n="undefined"!=typeof window&&void 0!==window.document?window.document:{},t=e.exports,o=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,r=t.length,s={};i<r;i++)if((e=t[i])&&e[1]in n){for(i=0;i<e.length;i++)s[t[0][i]]=e[i];return s}return!1}(),i={change:o.fullscreenchange,error:o.fullscreenerror},r={request:function(s,a){return new Promise(function(e,t){var i=function(){this.off("change",i),e()}.bind(this),r=(this.on("change",i),(s=s||n.documentElement)[o.requestFullscreen](a));r instanceof Promise&&r.then(i).catch(t)}.bind(this))},exit:function(){return new Promise(function(e,t){var i,r;this.isFullscreen?(i=function(){this.off("change",i),e()}.bind(this),this.on("change",i),(r=n[o.exitFullscreen]())instanceof Promise&&r.then(i).catch(t)):e()}.bind(this))},toggle:function(e,t){return this.isFullscreen?this.exit():this.request(e,t)},onchange:function(e){this.on("change",e)},onerror:function(e){this.on("error",e)},on:function(e,t){e=i[e];e&&n.addEventListener(e,t,!1)},off:function(e,t){e=i[e];e&&n.removeEventListener(e,t,!1)},raw:o},o?(Object.defineProperties(r,{isFullscreen:{get:function(){return Boolean(n[o.fullscreenElement])}},element:{enumerable:!0,get:function(){return n[o.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(n[o.fullscreenEnabled])}}}),t?e.exports=r:window.screenfull=r):t?e.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}});function Je(e){return e[0]>>4==10&&0===e[1]}function qe(){}function Qe(e){let t=null;var i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let r=0;for(;!t&&r<i.length;){var s=i[r];try{var a={preserveDrawingBuffer:!0};t=e.getContext(s,a)}catch(e){console.error(e),t=null}t&&"function"==typeof t.getParameter||(t=null),++r}return t}function Ye(e){var e=(0<arguments.length&&void 0!==e?e:"").split(","),t=atob(e[1]),e=e[0].replace("data:","").replace(";base64","");let i=t.length,r=new Uint8Array(i);for(;i--;)r[i]=t.charCodeAt(i);return new File([r],"file",{type:e})}function A(){return(new Date).getTime()}function y(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function w(t,i,e){t&&("object"==typeof i&&Object.keys(i).forEach(e=>{w(t,e,i[e])}),t.style[i]=e)}function Xe(e,t,i){i=!(2<arguments.length&&void 0!==i)||i;return e?(e=getComputedStyle(e,null).getPropertyValue(t),i?parseFloat(e):e):0}function Ze(){return(performance&&"function"==typeof performance.now?performance:Date).now()}function et(i){let r=0,s=Ze();return e=>{var t;d(e)&&(r+=e,1e3<=(t=(e=Ze())-s))&&(i(r/t*1e3),s=e,r=0)}}f.isEnabled;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var tt=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(tt instanceof WebAssembly.Module)new WebAssembly.Instance(tt)instanceof WebAssembly.Instance}}catch(e){}function g(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function it(){const t=window.navigator.userAgent.toLowerCase()||"",i={type:"",version:""},e={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:-1<t.indexOf("chrome")&&-1<t.indexOf("safari"),Firefox:-1<t.indexOf("firefox"),Opera:-1<t.indexOf("opera"),Safari:-1<t.indexOf("safari")&&-1==t.indexOf("chrome"),Edge:-1<t.indexOf("edge"),QQBrowser:/qqbrowser/.test(t),WeixinBrowser:/MicroMessenger/i.test(t)};for(var r in e)if(e[r]){let e="";if("IE"===r){const i=t.match(/(msie\s|trident.*rv:)([\w.]+)/);i&&2<i.length&&(e=t.match(/(msie\s|trident.*rv:)([\w.]+)/)[2])}else if("Chrome"===r){for(var s in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[s].type&&(r="360");const i=t.match(/chrome\/([\d.]+)/);i&&1<i.length&&(e=i[1])}else if("Firefox"===r){const i=t.match(/firefox\/([\d.]+)/);i&&1<i.length&&(e=i[1])}else if("Opera"===r){const i=t.match(/opera\/([\d.]+)/);i&&1<i.length&&(e=i[1])}else if("Safari"===r){const i=t.match(/version\/([\d.]+)/);i&&1<i.length&&(e=i[1])}else if("Edge"===r){const i=t.match(/edge\/([\d.]+)/);i&&1<i.length&&(e=i[1])}else if("QQBrowser"===r){const i=t.match(/qqbrowser\/([\d.]+)/);i&&1<i.length&&(e=i[1])}i.type=r,i.version=parseInt(e)}return i}function rt(){var e=window.navigator.userAgent.toLowerCase();return e&&/iphone|ipad|ipod|ios/.test(e)}function st(){var e=window.navigator.userAgent;return!e.match(/Chrome/gi)&&e.match(/Safari/gi)}function at(e,t){var r;return 0===arguments.length?null:(t=t||"{y}-{m}-{d} {h}:{i}:{s}",e="object"==typeof e?e:(e=+(e=10===(""+e).length?1e3*parseInt(e):e),new Date(e)),r={y:e.getFullYear(),m:e.getMonth()+1,d:e.getDate(),h:e.getHours(),i:e.getMinutes(),s:e.getSeconds(),a:e.getDay()},t.replace(/{(y|m|d|h|i|s|a)+}/g,(e,t)=>{var i=r[t];return"a"===t?["一","二","三","四","五","六","日"][i-1]:(i=0<e.length&&i<10?"0"+i:i)||0}))}function nt(){return"VideoFrame"in window}function T(e){var t;return"string"!=typeof e||(t=Number(e),isNaN(t))?e:t}function ot(){return"xxxxxxxxxxxx4xxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})}function lt(s,a){let n,o,l=!1;return function e(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];l?(n=i,o=this):(l=!0,s.apply(this,i),setTimeout(()=>{l=!1,n&&(e.apply(o,n),n=null,o=null)},a))}}function d(e){return"[object Number]"===Object.prototype.toString.call(e)}function ct(){let e=!1;return e="MediaSource"in window&&window.MediaSource.isTypeSupported(Ee)?!0:e}function dt(){var e=it();return"chrome"===e.type.toLowerCase()&&107<=e.version}function ut(){let e=!1;return e="MediaStreamTrackGenerator"in window?!0:e}function ht(){let e=!1;return e="MediaStream"in window?!0:e}function pt(e){return null==e}function ft(e){return!0===e||!1===e}function c(e){return!pt(e)}function gt(e){var t={left:"",right:"",top:"",bottom:"",opacity:1,backgroundColor:"",image:{src:"",width:"100",height:"60"},text:{content:"",fontSize:"14",color:"#000"},rect:{color:"",lineWidth:2,width:"",height:""},html:""},i=Object.assign(t.image,e.image||{}),r=Object.assign(t.text,e.text||{});return Object.assign(t,e,{image:i,text:r})}function mt(e,t){e={container:e||"",text:"",opacity:"",angle:"",color:"",fontSize:"",fontFamily:""};return{watermark_parent_node:(e=Object.assign(e,t)).container,watermark_alpha:e.opacity,watermark_angle:e.angle,watermark_fontsize:e.fontSize,watermark_color:e.color,watermark_font:e.fontFamily,watermark_txt:e.text}}function At(e,c){return new Promise((t,i)=>{let r=gt(c);if(!r.image.src&&!r.text.content)return t(e);let s=document.createElement("canvas"),a=(s.width=c.width,s.height=c.height,s.getContext("2d")),n=0,o=0;d(r.left)?n=r.left:d(r.right)&&(n=s.width-r.right),d(r.top)?o=r.top:d(r.bottom)&&(o=s.height-r.bottom);const l=new Image;l.src=e,l.onload=()=>{if(a.drawImage(l,0,0),r.image&&r.image.src){const e=new Image;e.src=r.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=()=>{n-=r.image.width,a.drawImage(e,n,o,r.image.width,r.image.height),t(s.toDataURL(c.format,c.quality))},e.onerror=e=>{i()}}else r.text&&r.text.content&&(a.font=r.text.fontSize+"px 宋体",a.fillStyle=r.text.color,a.textAlign="right",a.fillText(r.text.content,n,o),t(s.toDataURL(c.format,c.quality)))},l.onerror=e=>{i(e)}})}function yt(e){var t,i;return-1<e&&(t=e%60,i=(i=Math.floor(e/3600))<10?"0"+i+":":i+":",(e=Math.floor(e/60)%60)<10&&(i+="0"),i+=e+":",(t=Math.round(t))<10&&(i+="0"),i+=t.toFixed(0)),i}function bt(e){let t="";var i,r;return-1<e&&(i=Math.floor(e/60/60)%60,r=Math.floor(e/60)%60,e=e%60,r=Math.round(r),t=i<10?"0"+i+":":i+":",r<10&&(t+="0"),t+=r+":",e<10&&(t+="0"),t+=e),t}function vt(e,t){var i=Math.floor(t/60/60)%60,r=Math.floor(t/60)%60,t=t%60;return new Date(e).setHours(i,r,t,0)}function Et(e){return(""+e).length}function wt(e){return!e||0!==Object.keys(e).length}function Tt(e){return"string"==typeof e}const St=()=>{var e=window.navigator.userAgent;return/MicroMessenger/i.test(e)};function kt(e){e=e||window.event;return e.target||e.srcElement}function b(e){return"function"==typeof e}function _t(e){let t=0,i=0;var r=e||window.event;return r.pageX||r.pageY?(t=r.pageX,i=r.pageY):(r.clientX||r.clientY)&&(t=e.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,i=e.clientY+document.documentElement.scrollTop+document.body.scrollTop),{posX:t,posY:i}}function Ct(e){return k(e.hasAudio)&&(e.useMSE||e.useWCS&&!e.useOffscreen)}function Rt(e){e=e.toString().trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1],e=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(e)}function Dt(e){e.close?e.close():e.destroy&&e.destroy()}function Lt(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function xt(e){for(var e=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),t=window.atob(e),i=new Uint8Array(t.length),r=0;r<t.length;++r)i[r]=t.charCodeAt(r);return i}function It(t){let i="";if("object"==typeof t)try{i=JSON.stringify(t),i=JSON.parse(i)}catch(e){i=t}else i=t;return i}function Pt(){return It(Y)}function Bt(){return It(X)}function Mt(e){return e[0]>>4==1&&0===e[1]}function S(e){return!0===e||"true"===e}function k(e){return!0!==e&&"true"!==e}function Ot(e){return e.replace(/-([a-z])/g,function(e,t){return t.toUpperCase()})}class Ft{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(t,e,i){let r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};if(t){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,i,r));t.addEventListener(e,i,r);var s=()=>{b(t.removeEventListener)&&t.removeEventListener(e,i,r)};return this.destroys.push(s),s}}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach(e=>e())}}class e{on(e,t,i){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:i}),this}once(r,s,a){const n=this;function o(){n.off(r,o);for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s.apply(a,t)}return o._=s,this.on(r,o,a)}emit(e){for(var t=((this.e||(this.e={}))[e]||[]).slice(),i=arguments.length,r=new Array(1<i?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];for(let e=0;e<t.length;e+=1)t[e].fn.apply(t[e].ctx,r);return this}off(e,i){const t=this.e||(this.e={});if(e){var r=t[e],s=[];if(r&&i)for(let e=0,t=r.length;e<t;e+=1)r[e].fn!==i&&r[e].fn._!==i&&s.push(r[e]);return s.length?t[e]=s:delete t[e],this}Object.keys(t).forEach(e=>{delete t[e]}),delete this.e}}var jt="undefined"!=typeof Float32Array?Float32Array:Array;function Ut(){var e=new jt(16);return jt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Nt(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function zt(e,t,i){var r=new jt(3);return r[0]=e,r[1]=t,r[2]=i,r}tt=new jt(3),jt!=Float32Array&&(tt[0]=0,tt[1]=0,tt[2]=0),br=new jt(4),jt!=Float32Array&&(br[0]=0,br[1]=0,br[2]=0,br[3]=0);class Gt{constructor(e,t){this.gl=e,t&&this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1);t=this._initShaderProgram();this._programInfo={program:t,attribLocations:{vertexPosition:e.getAttribLocation(t,"aVertexPosition"),texturePosition:e.getAttribLocation(t,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(t,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(t,"uModelMatrix"),viewMatrix:e.getUniformLocation(t,"uViewMatrix"),rgbatexture:e.getUniformLocation(t,"rgbaTexture"),ytexture:e.getUniformLocation(t,"yTexture"),utexture:e.getUniformLocation(t,"uTexture"),vtexture:e.getUniformLocation(t,"vTexture"),isyuv:e.getUniformLocation(t,"isyuv")}},this._buffers=this._initBuffers(),this._rgbatexture=this._createTexture(),this._ytexture=this._createTexture(),this._utexture=this._createTexture(),this._vtexture=this._createTexture()}destroy(){this.gl.deleteProgram(this._programInfo.program),this.gl.deleteBuffer(this._buffers.position),this.gl.deleteBuffer(this._buffers.texPosition),this.gl.deleteBuffer(this._buffers.indices),this.gl.deleteTexture(this._rgbatexture),this.gl.deleteTexture(this._ytexture),this.gl.deleteTexture(this._utexture),this.gl.deleteTexture(this._vtexture),this._programInfo=null,this._buffers=null,this._rgbatexture=null,this._ytexture=null,this._utexture=null,this._vtexture=null}_initShaderProgram(){var e=this._loadShader(this.gl.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),t=this._loadShader(this.gl.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,t),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?i:(console.log("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(i)),null)}_loadShader(e,t){var i=this.gl,e=i.createShader(e);return i.shaderSource(e,t),i.compileShader(e),i.getShaderParameter(e,i.COMPILE_STATUS)?e:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(e)),i.deleteShader(e),null)}_initBuffers(){var e=this.gl,t=e.createBuffer(),i=(e.bindBuffer(e.ARRAY_BUFFER,t),[-1,-1,1,-1,1,1,-1,1]);e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);var r=(r=[]).concat([0,1],[1,1],[1,0],[0,0]),s=e.createBuffer(),r=(e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW),e.createBuffer());return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{positions:i,position:t,texPosition:s,indices:r}}_createTexture(){var e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),e}_drawScene(e,t,i){this.gl.viewport(0,0,e,t),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.position),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this._buffers.positions),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this._programInfo.attribLocations.vertexPosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.vertexPosition),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.texPosition),this.gl.vertexAttribPointer(this._programInfo.attribLocations.texturePosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.texturePosition),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this._buffers.indices),i?(this.gl.activeTexture(this.gl.TEXTURE0+3),this.gl.bindTexture(this.gl.TEXTURE_2D,this._ytexture),this.gl.activeTexture(this.gl.TEXTURE0+4),this.gl.bindTexture(this.gl.TEXTURE_2D,this._utexture),this.gl.activeTexture(this.gl.TEXTURE0+5),this.gl.bindTexture(this.gl.TEXTURE_2D,this._vtexture)):(this.gl.activeTexture(this.gl.TEXTURE0+2),this.gl.bindTexture(this.gl.TEXTURE_2D,this._rgbatexture)),this.gl.useProgram(this._programInfo.program),this.gl.uniform1i(this._programInfo.uniformLocations.rgbatexture,2),this.gl.uniform1i(this._programInfo.uniformLocations.ytexture,3),this.gl.uniform1i(this._programInfo.uniformLocations.utexture,4),this.gl.uniform1i(this._programInfo.uniformLocations.vtexture,5),this.gl.uniform1i(this._programInfo.uniformLocations.isyuv,i?1:0),this.gl.drawElements(this.gl.TRIANGLES,6,this.gl.UNSIGNED_SHORT,0)}_calRect(e,t,i,r,s,a){var n=2*e/s-1,r=2*(a-t-r)/a-1,e=2*(e+i)/s-1,i=2*(a-t)/a-1;return[n,r,e,r,e,i,n,i]}_clear(){this.gl.clearColor(0,0,0,1),this.gl.clearDepth(1),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}render(e,t,i,r,s){var a=this.gl;this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,i),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,s),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}renderYUV(e,t,i){var r=i.slice(0,e*t),s=i.slice(e*t,e*t*5/4),i=i.slice(e*t*5/4,e*t*3/2),a=this.gl;this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,s),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,i),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}drawDom(e,t,i,r,s){var a=this.gl;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._rgbatexture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,s),this._buffers.positions=this._calRect(i,r,s.width,s.height,e,t),this._drawScene(e,t,!1)}}class Ht{constructor(e){this.gpu=e,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null,this.hasInited=!1,this.buffers=this._initBuffer(),this._initPipeline().then(e=>{this.pipeline=e,this.matrixGroupInfo=this._initMatrixGroupInfo(),this.hasInited=!0})}destroy(){this.gpu&&(this.gpu.device.destroy(),this.gpu=null),this.hasInited=!1,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null}_initBuffer(){var e=this.gpu.device,t=new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),i=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST}),t=(e.queue.writeBuffer(i,0,t),new Float32Array([0,1,1,1,1,0,0,0])),r=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST}),t=(e.queue.writeBuffer(r,0,t),new Uint16Array([0,1,2,0,2,3])),s=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.INDEX|window.GPUBufferUsage.COPY_DST});return e.queue.writeBuffer(s,0,t),{positionBuffer:i,texpositionBuffer:r,indexBuffer:s}}_initPipeline(){return new Promise((t,i)=>{var e=this.gpu.device,r=this.gpu.format,r={layout:"auto",vertex:{module:e.createShaderModule({code:"\n\n @binding(0) @group(0) var<uniform> uModelMatrix : mat4x4<f32>;\n @binding(1) @group(0) var<uniform> uViewMatrix : mat4x4<f32>;\n @binding(2) @group(0) var<uniform> uProjectionMatrix : mat4x4<f32>;\n\n struct VertexOutput {\n @builtin(position) Position : vec4<f32>,\n @location(0) vTexturePosition : vec2<f32>,\n }\n\n @vertex\n fn main(\n @location(0) aVertexPosition : vec4<f32>,\n @location(1) aTexturePosition : vec2<f32>\n ) -> VertexOutput {\n var output : VertexOutput;\n var tmppos : vec4<f32> = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n output.Position = vec4<f32>(tmppos.x, tmppos.y, (tmppos.z+1.)/2., tmppos.w); // webgl z [-1, 1], webgpu z [0, 1], 这里z做下调整 z-webgpu = (z-webgl+1)/2\n output.vTexturePosition = aTexturePosition;\n return output;\n }\n\n "}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:8,attributes:[{shaderLocation:1,offset:0,format:"float32x2"}]}]},primitive:{topology:"triangle-list"},fragment:{module:e.createShaderModule({code:"\n @group(1) @binding(0) var mySampler: sampler;\n @group(1) @binding(1) var yTexture: texture_2d<f32>;\n @group(1) @binding(2) var uTexture: texture_2d<f32>;\n @group(1) @binding(3) var vTexture: texture_2d<f32>;\n\n const YUV2RGB : mat4x4<f32> = mat4x4<f32>( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n @fragment\n fn main(\n @location(0) vTexturePosition: vec2<f32>\n ) -> @location(0) vec4<f32> {\n\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(vTexture, mySampler, vTexturePosition).r;\n\n return vec4<f32>(y, u, v, 1.0)*YUV2RGB;\n }\n\n "}),entryPoint:"main",targets:[{format:r}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};e.createRenderPipelineAsync(r).then(e=>{t(e)}).catch(e=>{i(e)})})}_initMatrixGroupInfo(){var e,t,i,r,s,a,n,o,l,c,d,u=this.gpu.device,h=this.pipeline,p=Ut(),f=(e=(t=g=1)/((f=-1)-g),y=1/((i=-1)-t),o=1/((n=.1)-(a=100)),(l=p)[0]=-2*e,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=-2*y,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=2*o,l[11]=0,l[12]=(f+g)*e,l[13]=(t+i)*y,l[14]=(a+n)*o,l[15]=1,Ut()),g=(Nt(f),Ut()),m=(e=g,t=zt(0,0,0),i=zt(0,0,-1),y=zt(0,1,0),a=t[0],n=t[1],t=t[2],o=y[0],l=y[1],y=y[2],c=i[0],d=i[1],i=i[2],Math.abs(a-c)<1e-6&&Math.abs(n-d)<1e-6&&Math.abs(t-i)<1e-6?Nt(e):(c=a-c,d=n-d,i=t-i,A=l*(i*=m=1/Math.hypot(c,d,i))-y*(d*=m),y=y*(c*=m)-o*i,o=o*d-l*c,(m=Math.hypot(A,y,o))?(A*=m=1/m,y*=m,o*=m):o=y=A=0,l=d*o-i*y,r=i*A-c*o,s=c*y-d*A,(m=Math.hypot(l,r,s))?(l*=m=1/m,r*=m,s*=m):s=r=l=0,e[0]=A,e[1]=l,e[2]=c,e[3]=0,e[4]=y,e[5]=r,e[6]=d,e[7]=0,e[8]=o,e[9]=s,e[10]=i,e[11]=0,e[12]=-(A*a+y*n+o*t),e[13]=-(l*a+r*n+s*t),e[14]=-(c*a+d*n+i*t),e[15]=1),u.createBuffer({size:64,usage:window.GPUBufferUsage.UNIFORM|window.GPUBufferUsage.COPY_DST})),A=(u.queue.writeBuffer(m,0,f),u.createBuffer({size:64,usage:window.GPUBufferUsage.UNIFORM|window.GPUBufferUsage.COPY_DST})),y=(u.queue.writeBuffer(A,0,g),u.createBuffer({size:64,usage:window.GPUBufferUsage.UNIFORM|window.GPUBufferUsage.COPY_DST}));return u.queue.writeBuffer(y,0,p),{modelMatrixBuffer:m,viewMatrixBuffer:A,projectMatrixBuffer:y,group:u.createBindGroup({label:"group0",layout:h.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:m}},{binding:1,resource:{buffer:A}},{binding:2,resource:{buffer:y}}]})}}_initTextureGroupInfo(e,t){var i=this.gpu.device,r=this.pipeline,s=i.createTexture({size:[e,t],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT}),a=i.createTexture({size:[e/2,t/2],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT}),e=i.createTexture({size:[e/2,t/2],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT}),t=i.createSampler({magFilter:"linear",minFilter:"linear"}),i=i.createBindGroup({label:"group1",layout:r.getBindGroupLayout(1),entries:[{binding:0,resource:t},{binding:1,resource:s.createView()},{binding:2,resource:a.createView()},{binding:3,resource:e.createView()}]});return{yTexture:s,uTexture:a,vTexture:e,group:i}}_drawScene(){var e=this.gpu.device,t=this.gpu.context,i=e.createCommandEncoder(),t={colorAttachments:[{view:t.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],depthStencilAttachment:{view:this.depthTexture.createView(),depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store"}},t=i.beginRenderPass(t);t.setPipeline(this.pipeline),t.setBindGroup(0,this.matrixGroupInfo.group),t.setBindGroup(1,this.textureGroupInfo.group),t.setVertexBuffer(0,this.buffers.positionBuffer),t.setVertexBuffer(1,this.buffers.texpositionBuffer),t.setIndexBuffer(this.buffers.indexBuffer,"uint16"),t.drawIndexed(6),t.end(),e.queue.submit([i.finish()])}renderYUV(e,t,i){var r,s,a;this.hasInited&&(r=i.slice(0,e*t),s=i.slice(e*t,e*t*5/4),i=i.slice(e*t*5/4,e*t*3/2),a=this.gpu.device,this.depthTexture||(this.depthTexture=this.gpu.device.createTexture({size:[e,t],format:"depth24plus",usage:window.GPUTextureUsage.RENDER_ATTACHMENT})),this.textureGroupInfo||(this.textureGroupInfo=this._initTextureGroupInfo(e,t)),a.queue.writeTexture({texture:this.textureGroupInfo.yTexture},r,{bytesPerRow:e,rowsPerImage:t},[e,t]),a.queue.writeTexture({texture:this.textureGroupInfo.uTexture},s,{bytesPerRow:e/2,rowsPerImage:t/2},[e/2,t/2]),a.queue.writeTexture({texture:this.textureGroupInfo.vTexture},i,{bytesPerRow:e/2,rowsPerImage:t/2},[e/2,t/2]),this._drawScene())}clear(){}}class Vt extends e{constructor(){super(),this.videoInfo={width:null,height:null,encType:null},this.init=!1}destroy(){this.resetInit(),this.off()}resetInit(){this.videoInfo={width:null,height:null,encType:null},this.init=!1}getHasInit(){return this.init}updateVideoInfo(e){c(e.encTypeCode)&&(this.videoInfo.encType=ue[e.encTypeCode]),c(e.encType)&&(this.videoInfo.encType=e.encType),c(e.width)&&(this.videoInfo.width=e.width),c(e.height)&&(this.videoInfo.height=e.height),c(this.videoInfo.encType)&&c(this.videoInfo.height)&&c(this.videoInfo.width)&&!this.init&&(this.player.emit(E.videoInfo,this.videoInfo),this.init=!0)}getVideoInfo(){return this.videoInfo}clearView(){}play(){}pause(){}getType(){return""}getCanvasType(){return""}isPlaying(){return!0}addContentToCanvas(){}getPlaybackQuality(){return null}}var Wt="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function Kt(e,t,i){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){Qt(r.response,t,i)},r.onerror=function(){console.error("could not download file")},r.send()}function $t(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&t.status<=299}function Jt(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(e){var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(i)}}var qt=Wt.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Qt="object"!=typeof window||window!==Wt?function(){}:"download"in HTMLAnchorElement.prototype&&!qt?function(e,t,i){var r=Wt.URL||Wt.webkitURL,s=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",s.download=t,s.rel="noopener","string"==typeof e?(s.href=e,s.origin!==location.origin?$t(s.href)?Kt(e,t,i):Jt(s,s.target="_blank"):Jt(s)):(s.href=r.createObjectURL(e),setTimeout(function(){r.revokeObjectURL(s.href)},4e4),setTimeout(function(){Jt(s)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){var r;t=t||e.name||"download","string"==typeof e?$t(e)?Kt(e,t,i):((r=document.createElement("a")).href=e,r.target="_blank",setTimeout(function(){Jt(r)})):navigator.msSaveOrOpenBlob((e=e,void 0===(i=i)?i={autoBom:!1}:"object"!=typeof i&&(console.warn("Deprecated: Expected third argument to be a object"),i={autoBom:!i}),i.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e),t)}:function(e,t,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return Kt(e,t,i);var s,a,n,t="application/octet-stream"===e.type,i=/constructor/i.test(Wt.HTMLElement)||Wt.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);(o||t&&i||qt)&&"undefined"!=typeof FileReader?((s=new FileReader).onloadend=function(){var e=s.result,e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;");r?r.location.href=e:location=e,r=null},s.readAsDataURL(e)):(a=Wt.URL||Wt.webkitURL,n=a.createObjectURL(e),r?r.location=n:location.href=n,r=null,setTimeout(function(){a.revokeObjectURL(n)},4e4))};class Yt{constructor(e,t){this.gl=e,t&&this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1);e=this._initShaderProgram();this.shaderProgram=e,this.programInfo={program:e,attribLocations:{vertexPosition:this.gl.getAttribLocation(e,"aVertexPosition")},uniformLocations:{linewidth:this.gl.getUniformLocation(e,"uLineWidth"),rect:this.gl.getUniformLocation(e,"uRect"),linecolor:this.gl.getUniformLocation(e,"uLineColor"),resolution:this.gl.getUniformLocation(e,"uResolution")}},this.buffers=this._initBuffers()}destroy(){this.gl.deleteProgram(this.shaderProgram),this.gl.deleteBuffer(this.buffers.position),this.gl.deleteBuffer(this.buffers.indices),this.shaderProgram=null,this.buffers=null}_initShaderProgram(){var e=this.gl,t=this._loadShader(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n void main(void) {\n gl_Position = aVertexPosition;\n }\n "),i=this._loadShader(e.FRAGMENT_SHADER,"\n precision highp float;\n uniform float uLineWidth;\n uniform vec4 uRect;\n uniform vec3 uLineColor;\n uniform vec2 uResolution;\n\n\n float inBox(vec2 st, vec4 rect){\n\n vec2 bl = step(rect.xy,st);\n float pct = bl.x * bl.y;\n\n vec2 tr = step(st, rect.zw);\n pct *= tr.x * tr.y;\n\n return pct;\n }\n\n void main(void) {\n\n vec2 cur = gl_FragCoord.xy/uResolution;\n\n float xlinewidth = uLineWidth/uResolution.x;\n float ylinewidth = uLineWidth/uResolution.y;\n\n // vec4 outRect = uRect + vec4(-1.*xlinewidth/2., -1.*ylinewidth/2., xlinewidth/2., ylinewidth/2.);\n // vec4 inRect = uRect + vec4(xlinewidth/2., ylinewidth/2., -1.*xlinewidth/2., -1.*ylinewidth/2.);\n\n vec4 outRect = uRect + vec4(-1.*xlinewidth/2., -1.*ylinewidth/2., xlinewidth/2., ylinewidth/2.);\n vec4 inRect = uRect;\n\n float a = inBox(cur, outRect);\n float b = inBox(cur, inRect);\n\n gl_FragColor = mix(vec4(0., 0., 0., 0.), vec4(uLineColor.rgb, 1.0), a-b);\n\n }\n "),r=e.createProgram();return e.attachShader(r,t),e.attachShader(r,i),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS)?r:(console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(r)),null)}_loadShader(e,t){var i=this.gl,e=i.createShader(e);return i.shaderSource(e,t),i.compileShader(e),i.getShaderParameter(e,i.COMPILE_STATUS)?e:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(e)),i.deleteShader(e),null)}_createTexture(){var e=this.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),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}_initBuffers(){var e=this.gl,t=e.createBuffer(),i=(e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),e.STATIC_DRAW),e.createBuffer());return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,indices:i}}_drawScene(e){var{canvasWidth:e,canvasHeight:t,rect:i,lineWidth:r,lineColor:s}=e,a=this.gl,n=this.buffers,o=this.programInfo;a.viewport(0,0,e,t),a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA),a.bindBuffer(a.ARRAY_BUFFER,n.position),a.vertexAttribPointer(o.attribLocations.vertexPosition,2,a.FLOAT,!1,0,0),a.enableVertexAttribArray(o.attribLocations.vertexPosition),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,n.indices),a.useProgram(o.program),a.uniform2f(o.uniformLocations.resolution,e,t),a.uniform4f(o.uniformLocations.rect,i[0],i[1],i[2],i[3]),a.uniform1f(o.uniformLocations.linewidth,r),a.uniform3f(o.uniformLocations.linecolor,s[0],s[1],s[2]),a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0)}drawBox(e){var{x:e,y:t,width:i,height:r,lineWidth:s,lineColor:a,canvasWidth:n,canvasHeight:o}=e,l=(l=e/n,r=(o-t-r)/o,e=(e+i)/n,i=(o-t)/o,(t=new jt(4))[0]=l,t[1]=r,t[2]=e,t[3]=i,t),a=zt(1,0,0);this._drawScene({canvasWidth:n,canvasHeight:o,rect:l,lineWidth:s,lineColor:a})}}class Xt extends Vt{constructor(e){super(),this.player=e;var t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.webglRender=null,this.webglRectRender=null,this.webGPURender=null,this.isWebglContextLost=!1,this.bitmaprenderer=null,this.renderType=null,this.controlHeight=0,this.proxyDestroyList=[],this.tempCanvasContentList=[],this._initCanvasRender()}destroy(){super.destroy(),0<this.proxyDestroyList.length&&(this.proxyDestroyList.forEach(e=>{e&&e()}),this.proxyDestroyList=[]),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.webglRender&&(this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.webglRectRender.destroy(),this.webglRectRender=null),this.webGPURender&&(this.webGPURender.destroy(),this.webGPURender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.isWebglContextLost=!1,this.videoInfo={width:"",height:"",encType:""},this.tempCanvasContentList=[],this.player.$container.removeChild(this.$videoElement),this.init=!1,this.off()}_initContextGl(){var e,t=this.player.events["proxy"];this.contextGl=Qe(this.$videoElement),this.contextGl?(e=t(this.$videoElement,"webglcontextlost",e=>{e.preventDefault(),this.player.debug.error("canvasVideo","webglcontextlost error",e),this.isWebglContextLost=!0,this.webglRender&&(this.player.debug.log("CommonCanvasLoader","webglcontextlost error and destroy webglRender"),this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.player.debug.log("CommonCanvasLoader","webglcontextlost error and destroy webglRectRender"),this.webglRectRender.destroy(),this.webglRectRender=null),this.contextGl=null,setTimeout(()=>{this.player.debug.log("CommonCanvasLoader","createContextGL()"),this.contextGl=Qe(this.$videoElement),this.player.debug.log("CommonCanvasLoader","createContextGL success"),this.contextGl&&this.contextGl.getContextAttributes&&this.contextGl.getContextAttributes().stencil?(this.webglRender=new Gt(this.contextGl,this.player._opt.openWebglAlignment),this.webglRectRender=new Yt(this.contextGl,this.player._opt.openWebglAlignment),this.isWebglContextLost=!1,this.player.debug.log("CommonCanvasLoader","webglcontextlost error reset and getContextAttributes().stencil is true")):(this.player.debug.error("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(m.webglContextLostError))},500)}),t=t(this.$videoElement,"webglcontextrestored",e=>{e.preventDefault(),this.player.debug.log("CommonCanvasLoader","webglcontextrestored ",e)}),this.webglRender=new Gt(this.contextGl,this.player._opt.openWebglAlignment),this.webglRectRender=new Yt(this.contextGl,this.player._opt.openWebglAlignment),this.proxyDestroyList.push(e,t)):this.player.debug.error("CommonCanvasLoader","_initContextGl() createContextGL error")}_initContextGPU(){var a=this.$videoElement;new Promise((r,s)=>{navigator.gpu?navigator.gpu.requestAdapter().then(i=>{i?i.requestDevice().then(e=>{if(e){var t=a.getContext("webgpu");if(t){const a=navigator.gpu.getPreferredCanvasFormat();t.configure({device:e,format:a,alphaMode:"opaque"}),r({adapter:i,device:e,context:t,format:a})}else s('WebGPU "context" create fail')}else s('WebGPU "device" request fail')}).catch(e=>{s('WebGPU "adapter.requestDevice()" fail')}):s('WebGPU "adapter" request fail is empty')}).catch(e=>{s('WebGPU "navigator.gpu.requestAdapter()" fail')}):s("WebGPU not support!!")}).then(e=>{this.webGPURender=new Ht(e),this.player.debug.log("CommonCanvasLoader","webGPURender init success")}).catch(e=>{this.player.debug.error("CommonCanvasLoader",`createWebGPUContext error is ${e} and next use webgl render`),this.renderType=r,this._initContextGl()})}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}screenshot(e,t,i,r){e=e||A(),r=r||o.download;let s=.92;!l[t]&&o[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(s=Number(i));var a=l[t]||l.png,i=this.$videoElement.toDataURL(a,s);if(r===o.base64)return i;{const t=Ye(i);if(r===o.blob)return t;if(r===o.download){const i=a.split("/")[1];Qt(t,e+"."+i)}}}screenshotWatermark(s){return new Promise((t,i)=>{(s=(s=Tt(s)?{filename:s}:s)||{}).width=this.videoInfo.width,s.height=this.videoInfo.height,s.filename=s.filename||A(),s.format=s.format?l[s.format]:l.png,s.quality=Number(s.quality)||.92,s.type=s.type||o.download;const r=this.$videoElement.toDataURL(s.format,s.quality);At(r,s).then(e=>{if(s.type===o.base64)t(r);else{const r=Ye(e);if(s.type===o.blob)t(r);else if(s.type===o.download){t();const e=s.format.split("/")[1];Qt(r,s.filename+"."+e)}}}).catch(e=>{i(e)})})}render(){}clearView(){}play(){}pause(){}resize(){this.player.debug.log("canvasVideo","resize");var e=this.player._opt;let t=this.player.width,i=this.player.height;if(e.hasControl&&!e.controlAutoHide){const r=this.controlHeight;g()&&this.player.fullscreen&&e.useWebFullScreen?t-=r:i-=r}let r=this.$videoElement.width,s=this.$videoElement.height;var a=e.rotate,n=(t-r)/2,o=(i-s)/2,l=(270!==a&&90!==a||(r=this.$videoElement.height,s=this.$videoElement.width),t/r),c=i/s;let d=c<l?c:l,u=(e.isResize||l!=c&&(d=l+","+c),"scale("+(d=e.isFullResize?c<l?l:c:d)+")");"none"===e.mirrorRotate&&a&&(u+=" rotate("+a+"deg)"),"level"===e.mirrorRotate?u+=" rotateY(180deg)":"vertical"===e.mirrorRotate&&(u+=" rotateX(180deg)"),this.$videoElement.style.transform=u,this.$videoElement.style.left=n+"px",this.$videoElement.style.top=o+"px"}initFps(){}setStreamFps(){}getStreamFps(){return 25}getType(){return W}getCanvasType(){return this.renderType===s?s:r}addContentToCanvas(){this.tempCanvasContentList=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]}}class Zt extends Xt{constructor(e){super(e),this.yuvList=[],this.controlHeight=38,this.tempTextCanvas=null,this.tempTextCanvasCtx=null,this.player.debug.log("CanvasVideo","init")}destroy(){super.destroy(),this.yuvList=[],this.tempTextCanvas&&(this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvas.width=0,this.tempTextCanvas.height=0,this.tempTextCanvas=null),this.player.debug.log("CanvasVideoLoader","destroy")}_initContext2D(){this.context2D=this.$videoElement.getContext("2d",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=Ae,this._initContext2D()):this.player._opt.useMSE&&this.player._opt.mseUseCanvasRender?(this.renderType=be,this._initContext2D()):this.player._opt.isHls&&this.player._opt.useCanvasRender?(this.renderType="hls",this._initContext2D()):this._supportOffscreen()?(this.renderType=ye,this._bindOffscreen()):this.player._opt.useWebGPU?(this.renderType=s,this._initContextGPU()):(this.renderType=r,this._initContextGl())}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}render(e){this.yuvList.push(e),this.startRender()}startRender(){for(;!(this.yuvList.length<=0);){var e=this.yuvList.shift();this.doRender(e)}}doRender(t){var e;switch(this.player.videoTimestamp=t.ts||0,this.renderType!==be&&(e={ts:t.ts||0,fps:!0},this.player.updateStats(e)),this.renderType){case ye:this.bitmaprenderer.transferFromImageBitmap(t.buffer);break;case r:case s:if(this.isWebglContextLost)this.player.debug.warn("CanvasVideoLoader","doRender() and webgl context is lost");else{let e=t.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector&&(e=this.player.ai.faceDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:t.output})),this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector&&(e=this.player.ai.objectDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:t.output})),this.renderType===s)try{if(!this.webGPURender)return void this.player.debug.warn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(t){this.player.debug.error("CanvasVideoLoader","doRender webgpu render and error: "+t.toString())}else if(this.renderType===r)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,e),this.doAddContentToWebGlCanvas()}catch(t){this.player.debug.error("CanvasVideoLoader",`doRender webgl render context is lost ${this.contextGl.isContextLost()} and error: `+t.toString())}}break;case Ae:if(b(t.videoFrame.createImageBitmap))try{t.videoFrame.createImageBitmap().then(e=>{this.context2D.drawImage(e,0,0,this.$videoElement.width,this.$videoElement.height),Dt(t.videoFrame),this.doAddContentToCanvas()})}catch(t){}else this.context2D.drawImage(t.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),Dt(t.videoFrame),this.doAddContentToCanvas();break;case be:case"hls":this.context2D.drawImage(t.$video,0,0,this.$videoElement.width,this.$videoElement.height),this.doAddContentToCanvas()}}clearView(){switch(this.renderType){case ye:e=this.$videoElement.width,t=this.$videoElement.height,(i=document.createElement("canvas")).width=e,i.height=t,e=window.createImageBitmap(i,0,0,e,t),i.width=0,i.height=0,e.then(e=>{this.bitmaprenderer.transferFromImageBitmap(e)});break;case r:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case s:this.webGPURender.clear();break;case Ae:case be:case"hls":this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}var e,t,i}_initTempTextCanvas(){this.tempTextCanvas=document.createElement("canvas"),this.tempTextCanvasCtx=this.tempTextCanvas.getContext("2d"),this.tempTextCanvas.width=600,this.tempTextCanvas.height=20}doAddContentToCanvas(){if(0<this.tempCanvasContentList.length&&this.context2D){let{ctx:t,list:e}={ctx:this.context2D,list:this.tempCanvasContentList};t.save(),(e||[]).forEach(e=>{"text"===e.type?(t.font=`${e.fontSize||12}px Arial`,t.fillStyle=e.color||"green",t.fillText(e.text,e.x,e.y)):"rect"===e.type&&(t.strokeStyle=e.color||"green",t.lineWidth=e.lineWidth||2,t.strokeRect(e.x,e.y,e.width,e.height))}),t.restore()}}doAddContentToWebGlCanvas(){0<this.tempCanvasContentList.length&&this.contextGl&&this.webglRectRender&&this.tempCanvasContentList.forEach(e=>{var t=e.x,i=e.y;if("rect"===e.type){var r=e.width,s=e.height,a=(a=e.color||"#008000",[parseInt(a.substring(1,3),16)/255,parseInt(a.substring(3,5),16)/255,parseInt(a.substring(5,7),16)/255,1]),n=e.lineWidth||4;r&&s&&this.webglRectRender.drawBox({x:t,y:i,width:r,height:s,lineColor:a,lineWidth:n,canvasWidth:this.$videoElement.width,canvasHeight:this.$videoElement.height})}else if("text"===e.type){const a=e.text||"";a&&(r=e.fontSize||20,s=e.color||"#008000",this.tempTextCanvas||this._initTempTextCanvas(),this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvasCtx.font=r+"px Arial",this.tempTextCanvasCtx.fillStyle=s,this.tempTextCanvasCtx.textBaseline="top",this.tempTextCanvasCtx.fillText(a,0,0),this.webglRender.drawDom(this.$videoElement.width,this.$videoElement.height,t,i,this.tempTextCanvas))}})}}class ei{constructor(e){this.player=e,this.configList=[],this.shadowRoot=null,this.shadowRootRealDom=null,this.shadowRootInnerDom=null,this.scale=1,this._initDom(),this.player.debug.log("SingleWatermark","int")}destroy(){this.configList=[],this.shadowRootInnerDom=null,this.scale=1,this.shadowRoot&&(this.player.$container.removeChild(this.shadowRootRealDom),this.shadowRoot=null,this.shadowRootInnerDom=null),this.player.debug.log("SingleWatermark","destroy")}resize(){this._resizeDom()}_initDom(){var e=this.player.$container,t=null,i=document.createElement("div"),r=(i.setAttribute("style","pointer-events: none !important;display: block !important;"),t="function"==typeof i.attachShadow?i.attachShadow({mode:"open"}):i.shadowRoot||i,document.createElement("div")),s=(r.setAttribute("style","position: absolute; top: 0; left: 0; width: 0; height: 0;display: none;"),t.appendChild(r),e.children),a=Math.floor(Math.random()*(s.length-1));s[a]?e.insertBefore(i,s[a]):e.appendChild(i),this.shadowRootInnerDom=r,this.shadowRootRealDom=i,this.shadowRoot=t}update(e){this._removeDom();let t=[];Array.isArray(e)?t=e:wt(e)&&t.push(e);e=t.map(e=>gt(e));this.configList=e,this._updateDom()}_resizeDom(){this.player.$container;const n=this.player.width,o=this.player.height,l=this.player.getVideoInfo();if(l&&0<l.height&&0<l.width){let e=l.width,t=l.height;var c=this.player._opt;let i=o,r=n;if(c.hasControl&&!c.controlAutoHide){const n=c.playType===v?48:38;g()&&this.player.fullscreen&&c.useWebFullScreen?r-=n:i-=n}var d=c.rotate,u=(r-e)/2,h=(i-t)/2,p=(270!==d&&90!==d||(e=l.height,t=l.width),r/e),f=i/t;let s=f<p?f:p,a=(c.isResize||p!=f&&(s=p+","+f),"scale("+(s=c.isFullResize?f<p?p:f:s)+")");"none"===c.mirrorRotate&&d&&(a+=" rotate("+d+"deg)"),"level"===c.mirrorRotate?a+=" rotateY(180deg)":"vertical"===c.mirrorRotate&&(a+=" rotateX(180deg)"),this.scale=-1!==(""+s).indexOf(",")?p:s,this.shadowRootInnerDom.style.transform=a,this.shadowRootInnerDom.style.left=u+"px",this.shadowRootInnerDom.style.top=h+"px",this.shadowRootInnerDom.style.width=l.width+"px",this.shadowRootInnerDom.style.height=l.height+"px",this.shadowRootInnerDom.style.display="block"}}_updateDom(){this.shadowRoot&&this.configList.forEach(e=>{var t=document.createElement("div");let i=null;e.image&&e.image.src?((i=document.createElement("img")).style.height="100%",i.style.width="100%",i.style.objectFit="contain",i.src=e.image.src):e.text&&e.text.content?i=document.createTextNode(e.text.content):(e.rect&&e.rect.color&&e.rect.width||e.html)&&(i=document.createElement("div")),i&&(t.appendChild(i),t.style.visibility="",t.style.position="absolute",t.style.display="block",t.style["-ms-user-select"]="none",t.style["-moz-user-select"]="none",t.style["-webkit-user-select"]="none",t.style["-o-user-select"]="none",t.style["user-select"]="none",t.style["-webkit-touch-callout"]="none",t.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",t.style["-webkit-text-size-adjust"]="none",t.style["-webkit-touch-callout"]="none",t.style.opacity=e.opacity,d(e.left)&&(t.style.left=e.left+"px"),d(e.right)&&(t.style.right=e.right+"px"),d(e.top)&&(t.style.top=e.top+"px"),d(e.bottom)&&(t.style.bottom=e.bottom+"px"),e.backgroundColor&&(t.style.backgroundColor=e.backgroundColor),t.style.overflow="hidden",t.style.zIndex="9999999",e.image&&e.image.src?(t.style.width=e.image.width+"px",t.style.height=e.image.height+"px"):e.text&&e.text.content?(t.style.fontSize=e.text.fontSize+"px",t.style.color=e.text.color):e.rect&&e.rect.color&&e.rect.width?(t.style.width=e.rect.width+"px",t.style.height=e.rect.height+"px",t.style.borderWidth=e.rect.lineWidth+"px",t.style.borderStyle="solid",t.style.borderColor=e.rect.color):e.html&&(t.innerHTML=e.html,t.style.width=e.width+"px",t.style.height=e.height+"px"),this.shadowRootInnerDom.appendChild(t))})}remove(){this._removeDom()}_removeDom(){this.shadowRootInnerDom&&(this.shadowRootInnerDom.innerHTML="")}}class ti extends Vt{constructor(t){super(),this.player=t;var e=document.createElement("video"),i=document.createElement("canvas"),i=(e.muted=!0,e.style.position="absolute",e.style.top=0,e.style.left=0,this._delayPlay=!1,t.$container.appendChild(e),this.$videoElement=e,this.$canvasElement=i,this.canvasContext=i.getContext("2d"),this.mediaStream=null,this.vwriter=null,t.canVideoTrackWritter()&&ut()&&ht()&&(this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.mediaStream=new MediaStream([this.trackGenerator]),e.srcObject=this.mediaStream,this.vwriter=this.trackGenerator.writable.getWriter()),this.fixChromeVideoFlashBug(),this.resize(),this.eventListenList=[],this.tempContentList=[],this.contentWatermark=null,this.player.events)["proxy"],e=i(this.$videoElement,"canplay",()=>{this.player.debug.log("Video","canplay"),this._delayPlay&&this._play()}),r=i(this.$videoElement,"waiting",()=>{this.player.debug.log("Video","waiting")}),s=i(this.$videoElement,"loadedmetadata",()=>{this.player.debug.log("Video","loadedmetadata")}),a=i(this.$videoElement,"timeupdate",e=>{e=parseInt(e.timeStamp,10);(this.player._opt.isWebrtc||this.player._opt.isHls)&&this.player.emit(E.timeUpdate,e),t._opt.isWebrtc&&(t.handleRender(),t.updateStats({fps:!0}))}),i=i(this.$videoElement,"error",()=>{this.player.debug.error("Video","Error "+this.$videoElement.error.code+"; details: "+this.$videoElement.error.message)});this.eventListenList.push(e,r,a,i,s),this.player.debug.log("Video","init")}destroy(){var e;if(super.destroy(),this.eventListenList&&(this.eventListenList.forEach(e=>{e()}),this.eventListenList=[]),this.contentWatermark&&(this.contentWatermark.destroy(),this.contentWatermark=null),this.tempContentList=[],this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()&&((e=this.player.$container).style.backdropFilter="none",e.style.transform="none"),this.$canvasElement.height=0,this.$canvasElement.width=0,this.$canvasElement=null,this.canvasContext=null,this.$videoElement){this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}this.player.$container.removeChild(this.$videoElement),this.$videoElement=null}this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(this.vwriter.close(),this.vwriter=null),this._delayPlay=!1,this.mediaStream&&(this.mediaStream.getTracks().forEach(e=>e.stop()),this.mediaStream=null),this.off(),this.player.debug.log("Video","destroy")}fixChromeVideoFlashBug(){var e;this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()&&((e=this.player.$container).style.backdropFilter="blur(0px)",e.style.transform="translateZ(0)")}_isNeedAddBackDropFilter(){var e=it().type.toLowerCase();return"chrome"===e||"edge"===e}isPause(){let e=!0;return e=this.$videoElement?this.$videoElement.paused:e}_getVideoReadyState(){let e=0;return e=this.$videoElement?this.$videoElement.readyState:e}_getVideoCurrentTime(){let e=0;return e=this.$videoElement?this.$videoElement.currentTime:e}play(){var e;this.$videoElement&&(e=this._getVideoReadyState(),this.player.debug.log("Video","play and readyState: "+e),0===e?(this.player.debug.warn("Video","readyState is 0 and set _delayPlay to true"),this._delayPlay=!0):this._play())}_play(){this.$videoElement&&this.$videoElement.play().then(()=>{this._delayPlay=!1,this.player.debug.log("Video","_play success"),setTimeout(()=>{this.isPlaying()||(this.player.debug.warn("Video","play failed and retry play"),this._play())},100)}).catch(e=>{this.player.debug.error("Video","_play error",e)})}pause(e){this.isPlaying()&&(e?this.$videoElement&&this.$videoElement.pause():setTimeout(()=>{this.$videoElement&&this.$videoElement.pause()},100))}clearView(){this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement.srcObject)&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject"))}screenshot(e,t,i,r){if(!this._canScreenshot())return this.player.debug.warn("Video","screenshot failed, video is not ready"),null;e=e||A(),r=r||o.download;let s=.92;!l[t]&&o[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(s=Number(i));var i=this.$videoElement,a=this.$canvasElement,n=(a.width=i.videoWidth,a.height=i.videoHeight,this.canvasContext.drawImage(i,0,0,a.width,a.height),l[t]||l.png),i=a.toDataURL(n,s);if(this.canvasContext.clearRect(0,0,a.width,a.height),a.width=0,a.height=0,r===o.base64)return i;{const t=Ye(i);if(r===o.blob)return t;if(r===o.download){const i=n.split("/")[1];Qt(t,e+"."+i)}}}screenshotWatermark(a){return new Promise((i,t)=>{if(Tt(a)&&(a={filename:a}),!this._canScreenshot())return this.player.debug.warn("Video","screenshot failed, video is not ready"),t("screenshot failed, video is not ready");var e=this.$videoElement,r=((a=a||{}).width=e.videoWidth,a.height=e.videoHeight,a.filename=a.filename||A(),a.format=a.format?l[a.format]:l.png,a.quality=Number(a.quality)||.92,a.type=a.type||o.download,this.$canvasElement);r.width=e.videoWidth,r.height=e.videoHeight,this.canvasContext.drawImage(e,0,0,r.width,r.height);const s=r.toDataURL(a.format,a.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,At(s,a).then(e=>{if(a.type===o.base64)i(s);else{var t=Ye(e);if(a.type===o.blob)i(t);else if(a.type===o.download){i();const e=a.format.split("/")[1];Qt(t,a.filename+"."+e)}}}).catch(e=>{t(e)})})}initCanvasViewSize(){this.resize()}clear(){var e=this.$videoElement,t=e.buffered,t=t.length?t.end(t.length-1):0;e.currentTime=t}render(t){if(this.vwriter){if(this.$videoElement.srcObject||(this.$videoElement.srcObject=this.mediaStream),this.$videoElement.paused&&this.player.debug.warn("Video","render error, video is paused"),this.player.videoTimestamp=t.ts||0,this.player.updateStats({fps:!0,ts:t.ts||0}),t.videoFrame)this.vwriter.write(t.videoFrame),Dt(t.videoFrame);else if(t.output){let e=t.output;this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector&&(e=this.player.ai.faceDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:t.output})),this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector&&(e=this.player.ai.objectDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:t.output}));try{r=e,s={format:"I420",codedWidth:this.videoInfo.width,codedHeight:this.videoInfo.height,timestamp:t.ts};var i=new VideoFrame(r,s);this.vwriter.write(i),Dt(i)}catch(t){this.player.debug.error("Video","render error",t),this.player.emitError(m.wasmUseVideoRenderError,t)}}this.doAddContentToWatermark()}else this.player.debug.warn("Video","render and this.vwriter is null");var r,s}resize(){let e=this.player.width,t=this.player.height;const i=this.player._opt,r=i.rotate;if(i.hasControl&&!i.controlAutoHide){const r=i.playType===v?48:38;g()&&this.player.fullscreen&&i.useWebFullScreen?e-=r:t-=r}this.$videoElement.width=e,this.$videoElement.height=t,270!==r&&90!==r||(this.$videoElement.width=t,this.$videoElement.height=e);let s=(e-this.$videoElement.width)/2,a=(t-this.$videoElement.height)/2,n="contain",o=(i.isResize||(n="fill"),i.isFullResize&&(n="none"),"");"none"===i.mirrorRotate&&r&&(o+=" rotate("+r+"deg)"),"level"===i.mirrorRotate?o+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(o+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit=n),this.$videoElement.style.transform=o,this.$videoElement.style.left=s+"px",this.$videoElement.style.top=a+"px"}getType(){return K}isPlaying(){return this.$videoElement&&k(this.$videoElement.paused)&&k(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}_canScreenshot(){return this.$videoElement&&2<=this.$videoElement.readyState}addContentToCanvas(){this.tempContentList=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]}doAddContentToWatermark(){var e;0<this.tempContentList.length?(this.contentWatermark||(this.contentWatermark=new ei(this.player),this.contentWatermark.resize()),e=this.tempContentList.map(e=>{var t={left:e.x,top:e.y};return"text"===e.type?t.text={content:e.text,fontSize:e.fontSize,color:e.color}:"rect"===e.type&&(t.rect={width:e.width,height:e.height,color:e.color,lineWidth:e.lineWidth}),t}),this.contentWatermark.update(e)):this.contentWatermark&&this.contentWatermark.remove()}getPlaybackQuality(){let e=null;var t;return this.$videoElement&&(e=b(this.$videoElement.getVideoPlaybackQuality)?{droppedVideoFrames:(t=this.$videoElement.getVideoPlaybackQuality()).droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}:{droppedVideoFrames:this.$videoElement.webkitDroppedFrameCount,totalVideoFrames:this.$videoElement.webkitDecodedFrameCount,creationTime:A()})&&(e.renderedVideoFrames=e.totalVideoFrames-e.droppedVideoFrames),e}}class ii extends Xt{constructor(e){super(e),this.controlHeight=48,this.bufferList=[],this.playing=!1,this.playInterval=null,this.fps=1,this.preFps=1,this.streamFps=0,this.playbackRate=1,this._firstTimestamp=null,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,this.player.on(E.playbackPause,e=>{e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}),this.player.debug.log("CanvasPlaybackLoader","init")}destroy(){this._stopSync(),this._firstTimestamp=null,this.playing=!1,this.playbackRate=1,this.fps=1,this.preFps=1,this.bufferList=[],this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,super.destroy(),this.player.debug.log("CanvasPlaybackLoader","destroy")}_initCanvasRender(){this.player._opt.useWebGPU?(this.renderType=s,this._initContextGPU()):(this.renderType=r,this._initContextGl())}_sync(){this._stopSync(),this._doPlay(),this.playInterval=setInterval(()=>{this._doPlay()},this.fragDuration)}_doPlay(){var e;0<this.bufferList.length&&!this.player.seeking&&(e=this.bufferList.shift())&&e.buffer&&(this._doRender(e.buffer),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:e.tfTs}))}_stopSync(){this.playInterval&&(clearInterval(this.playInterval),this.playInterval=null)}_doRender(e){if(this.getCanvasType()===r)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debug.error("CanvasPlaybackLoader",`doRender webgl render context is lost ${this.contextGl.isContextLost()} and error: `+e.toString())}else if(this.getCanvasType()===s)try{this.webGPURender?this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,e):this.player.debug.warn("CanvasVideoLoader","doRender webgpu render is not init")}catch(e){this.player.debug.error("CanvasPlaybackLoader","doRender webgpu render and error: "+e.toString())}}_updateStats(e){this.player.updateStats({fps:!0,ts:e}),this._startfpsTime||(this._startfpsTime=e,this._startFpsTimestamp=A());var t=e,i=A(),r=i-this._startFpsTimestamp;r<=1e3?this._renderFps+=1:(this.player.emit(E.playbackStats,{fps:this._renderFps,start:this._startfpsTime,end:t,timestamp:r,dataTimestamp:t-this._startfpsTime,audioBufferSize:this.player.audio?this.player.audio.bufferSize:0,videoBufferSize:this.player.video?this.player.video.bufferSize:0,ts:e}),this._renderFps=0,this._startfpsTime=t,this._startFpsTimestamp=i)}get rate(){return this.playbackRate}get fragDuration(){return Math.ceil(1e3/(this.fps*this.playbackRate))}get bufferSize(){return this.bufferList.length}getStreamFps(){return this.streamFps}initFps(){this._hasCalcFps?this.player.debug.log("CanvasPlaybackLoader","initFps, has calc fps"):(this.preFps=y(this.player.playback.fps,1,100),this.fps=this.preFps)}setFps(e){e!==this.fps?(100<e&&this.player.debug.warn("CanvasPlaybackLoader","setFps max",e),e<0&&this.player.debug.warn("CanvasPlaybackLoader","setFps min",e),this.fps=y(e,1,100),this.player.debug.log("CanvasPlaybackLoader",`setFps ${this.preFps} -> `+this.fps),this.player.playback.isUseFpsRender&&this._sync()):this.player.debug.log("CanvasPlaybackLoader","setFps, same fps "+e)}setStreamFps(e){this.player.debug.log("CanvasPlaybackLoader","setStreamFps",e),this._hasCalcFps=!0,this.streamFps=e,this.preFps=e,this.setFps(e)}setRate(e){e!==this.playbackRate&&(this.playbackRate=e,this.player.playback.isUseFpsRender)&&this._sync()}render$2(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);var t={tfTs:e.ts-this._firstTimestamp,ts:e.ts,buffer:e.output};this.bufferList.push(t),this.startRender(),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:t.tfTs})}startRender(){for(;!(this.bufferList.length<=0);){var e=this.bufferList.shift();this._doRender(e.buffer)}}pushData(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts,buffer:e.output},i=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(i||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debug.warn("CanvasPlaybackLoader","buffer size is "+this.bufferSize),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){const e=function(i){let r=i[0],s=null,e=1;var t;if(0<i.length&&(t=i[1])&&1e5<t.ts-r.ts&&(r=t,e=2),r)for(let t=e;t<i.length;t++){let e=i[t];e&&1e3<=e.ts-r.ts&&i[t-1].ts-r.ts<1e3&&(s=t+1)}return s}(this.bufferList);null!==e&&e!==this.preFps&&(this.player.debug.log("CanvasPlaybackLoader",`calc fps is ${e} pre fps is ${this.preFps} and updatePreFps`),this.setStreamFps(e))}if(!i){const e=this.bufferList.length,t=e/(this.fps*this.playbackRate);this.player.debug.log("CanvasPlaybackLoader","rate is",t),t<=1?this.setFps(this.preFps):(this.setFps(this.fps+Math.floor(t*this.playbackRate)),this.player.debug.warn("CanvasPlaybackLoader","rate is",t,"fps is",this.fps,"bufferListLength is",e))}}initVideo(){this.player.playback&&this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}initVideoDelay(){var e=this.player._opt.playbackDelayTime;0<e?this.delayTimeout=setTimeout(()=>{this.initVideo()},e):this.initVideo()}clearView(){this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT)}clear(){this.bufferList=[]}resume(){this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}pause(){this.player.playback.isUseFpsRender&&this._stopSync(),this.playing=!1}}class ri{constructor(e){return new(ri.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE?e.mseUseCanvasRender?Zt:ti:e.isHls?e.useCanvasRender?Zt:ti:e.isWebrtc?ti:e.useWCS?!e.useOffscreen&&e.wcsUseVideoRender?ti:Zt:e.playType===v?ii:e.wasmUseVideoRender&&!e.useOffscreen?ti:Zt}}class si extends e{constructor(e){super(),this.bufferList=[],this.player=e,this.$audio=null,this.scriptNode=null,this.workletProcessorNode=null,this.hasInitScriptNode=!1,this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),this.gainNode=this.audioContext.createGain();e=this.audioContext.createBufferSource();e.buffer=this.audioContext.createBuffer(1,1,22050),e.connect(this.audioContext.destination),e.noteOn?e.noteOn(0):e.start(0),this.audioBufferSourceNode=e,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.gainNode.gain.value=0,this.playing=!1,this.audioSyncVideoOption={diff:null},this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1,this.hasAudio=!1,this.audioResumeStateTimeout=null,this.on(E.videoSyncAudio,e=>{this.audioSyncVideoOption=e})}destroy(){this.closeAudio(),this.resetInit(),this.audioContext.close(),this.audioContext=null,this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=qe,this.scriptNode=null),this.workletProcessorNode&&(this.workletProcessorNode.port.onmessage=qe,this.workletProcessorNode=null),this.audioResumeStateTimeout&&(clearTimeout(this.audioResumeStateTimeout),this.audioResumeStateTimeout=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this.off()}resetInit(){this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1}getAudioInfo(){return this.audioInfo}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encType=ge[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(E.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}initScriptNode(){}initMobileScriptNode(){}initWorkletScriptNode(){}getEngineType(){return""}mute(e){e?(this.isMute||this.player.emit(E.mute,e),this.setVolume(0),this.clear()):(this.isMute&&this.player.emit(E.mute,e),this.setVolume(.5))}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=y(e,0,1),this.gainNode.gain.value=e,this.player.emit(E.volumechange,this.player.volume))}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.workletProcessorNode&&this.workletProcessorNode.disconnect(this.gainNode),this.gainNode)&&(this.gainNode.disconnect(this.mediaStreamAudioDestinationNode),this.$audio||this.gainNode.disconnect(this.audioContext.destination)),this.clear()}audioEnabled(e){e?this.isStateSuspended()&&(this.audioContext.resume().then(()=>{this.player.emit(E.audioResumeState,{state:this.audioContext.state,isRunning:this.isStateRunning()})}),this.audioResumeStateTimeout=setTimeout(()=>{clearTimeout(this.audioResumeStateTimeout),this.audioResumeStateTimeout=null,this.isStateSuspended()&&this.player.emit(E.audioResumeState,{state:this.audioContext.state,isRunning:this.isStateRunning()})},1e3)):this.isStateRunning()&&this.audioContext.suspend()}isStateRunning(){return"running"===this.audioContext.state}isStateSuspended(){return"suspended"===this.audioContext.state}clear(){this.bufferList=[]}play(e,t){}pause(){this.audioSyncVideoOption={diff:null},this.playing=!1}resume(){this.playing=!0}setRate(e){}getAudioBufferSize(){return 0}}class ai{constructor(e,t,i,r){this.player=e,this.audio=t,this.channel=i,this.bufferSize=r}extract(t,e){var i=this.provide(e);for(let e=0;e<i.size;e++)t[2*e]=i.left[e],t[2*e+1]=i.right[e];return this.audio.tempAudioTimestamp=i.ts,i.size}provide(t){let i=new Float32Array(t),r=new Float32Array(t),e=0,s=0,a=0,n=t/this.bufferSize;var o=this.audio.bufferList;if(o.length>n){try{for(let e=0;e<n;e++){const t=o.shift();2===this.channel?(i.set(t.buffer[0],a),r.set(t.buffer[1],a)):(i.set(t.buffer[0],a),r.set(t.buffer[0],a)),a+=this.bufferSize,s=t.ts}}catch(t){this.player.debug.error("Processor","provide()",t),i=new Float32Array(0),r=new Float32Array(0)}e=i.length}return{size:e,ts:s,left:i,right:r}}destroy(){this.buffer=null,this.channel=null}}class ni{constructor(){this._vector=new Float32Array,this._position=0,this._frameCount=0}get vector(){return this._vector}get position(){return this._position}get startIndex(){return 2*this._position}get frameCount(){return this._frameCount}get endIndex(){return 2*(this._position+this._frameCount)}clear(){this.receive(this._frameCount),this.rewind()}put(e){this._frameCount+=e}putSamples(e,t){let i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;var t=2*(t=t||0),r=2*(i=0<=i?i:(e.length-t)/2),s=(this.ensureCapacity(i+this._frameCount),this.endIndex);this.vector.set(e.subarray(t,t+r),s),this._frameCount+=i}putBuffer(e,t){let i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;t=t||0,0<=i||(i=e.frameCount-t),this.putSamples(e.vector,e.position+t,i)}receive(e){0<=e&&!(e>this._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}receiveSamples(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,i=this.startIndex;e.set(this._vector.subarray(i,i+2*t)),this.receive(t)}extract(e){var t=this.startIndex+2*(1<arguments.length&&void 0!==arguments[1]?arguments[1]:0);e.set(this._vector.subarray(t,t+2*(2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)))}ensureCapacity(){var e=parseInt(2*(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0));this._vector.length<e?((e=new Float32Array(e)).set(this._vector.subarray(this.startIndex,this.endIndex)),this._vector=e,this._position=0):this.rewind()}ensureAdditionalCapacity(){this.ensureCapacity(this._frameCount+(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0))}rewind(){0<this._position&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}}class oi{constructor(e){e?(this._inputBuffer=new ni,this._outputBuffer=new ni):this._inputBuffer=this._outputBuffer=null}get inputBuffer(){return this._inputBuffer}set inputBuffer(e){this._inputBuffer=e}get outputBuffer(){return this._outputBuffer}set outputBuffer(e){this._outputBuffer=e}clear(){this._inputBuffer.clear(),this._outputBuffer.clear()}}class li extends oi{constructor(e){super(e),this.reset(),this._rate=1}set rate(e){this._rate=e}reset(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}clone(){var e=new li;return e.rate=this._rate,e}process(){var e=this._inputBuffer.frameCount,e=(this._outputBuffer.ensureAdditionalCapacity(e/this._rate+1),this.transpose(e));this._inputBuffer.receive(),this._outputBuffer.put(e)}transpose(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;if(0===e)return 0;var t=this._inputBuffer.vector,i=this._inputBuffer.startIndex,r=this._outputBuffer.vector,s=this._outputBuffer.endIndex;let a=0,n=0;for(;this.slopeCount<1;)r[s+2*n]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[i],r[s+2*n+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*t[i+1],n+=1,this.slopeCount+=this._rate;if(--this.slopeCount,1!==e)e:for(;;){for(;1<this.slopeCount;)if(--this.slopeCount,(a+=1)>=e-1)break e;var o=i+2*a;r[s+2*n]=(1-this.slopeCount)*t[o]+this.slopeCount*t[o+2],r[s+2*n+1]=(1-this.slopeCount)*t[o+1]+this.slopeCount*t[o+3],n+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[i+2*e-2],this.prevSampleR=t[i+2*e-1],n}}function ci(){}class di extends class{constructor(e){this._pipe=e}get pipe(){return this._pipe}get inputBuffer(){return this._pipe.inputBuffer}get outputBuffer(){return this._pipe.outputBuffer}fillInputBuffer(){throw new Error("fillInputBuffer() not overridden")}fillOutputBuffer(){let e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;for(;this.outputBuffer.frameCount<e;){const e=16384-this.inputBuffer.frameCount;if(this.fillInputBuffer(e),this.inputBuffer.frameCount<16384)break;this._pipe.process()}}clear(){this._pipe.clear()}}{constructor(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:ci;super(t),this.callback=i,this.sourceSound=e,this.historyBufferSize=22050,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}get position(){return this._position}set position(e){if(e>this._position)throw new RangeError("New position may not be greater than current position");var t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}get sourcePosition(){return this._sourcePosition}set sourcePosition(e){this.clear(),this._sourcePosition=e}onEnd(){this.callback()}fillInputBuffer(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=new Float32Array(2*e),e=this.sourceSound.extract(t,e,this._sourcePosition);this._sourcePosition+=e,this.inputBuffer.putSamples(t,0,e)}extract(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,t=(this.fillOutputBuffer(this.outputBufferPosition+t),Math.min(t,this.outputBuffer.frameCount-this.outputBufferPosition)),e=(this.outputBuffer.extract(e,this.outputBufferPosition,t),this.outputBufferPosition+t);return this.outputBufferPosition=Math.min(this.historyBufferSize,e),this.outputBuffer.receive(Math.max(e-this.historyBufferSize,0)),this._position+=t,t}handleSampleData(e){this.extract(e.data,4096)}clear(){super.clear(),this.outputBufferPosition=0}}const ui=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];class hi extends oi{constructor(e){super(e),this._quickSeek=!0,this.midBufferDirty=!1,this.midBuffer=null,this.overlapLength=0,this.autoSeqSetting=!0,this.autoSeekSetting=!0,this._tempo=1,this.setParameters(44100,0,0,8)}clear(){super.clear(),this.clearMidBuffer()}clearMidBuffer(){this.midBufferDirty&&(this.midBufferDirty=!1,this.midBuffer=null)}setParameters(e,t,i,r){0<e&&(this.sampleRate=e),0<r&&(this.overlapMs=r),0<t?(this.sequenceMs=t,this.autoSeqSetting=!1):this.autoSeqSetting=!0,0<i?(this.seekWindowMs=i,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}set tempo(e){this._tempo=e,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,e=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(e+this.overlapLength,this.seekWindowLength)+this.seekLength}get tempo(){return this._tempo}get inputChunkSize(){return this.sampleReq}get outputChunkSize(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}calculateOverlapLength(){var e=this.sampleRate*(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)/1e3;e=e<16?16:e,this.overlapLength=e-=e%8,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}checkLimits(e,t,i){return e<t?t:i<e?i:e}calculateSequenceParameters(){var e;this.autoSeqSetting&&(e=150+-50*this._tempo,e=this.checkLimits(e,50,125),this.sequenceMs=Math.floor(e+.5)),this.autoSeekSetting&&(e=28.333333333333332+-10/1.5*this._tempo,e=this.checkLimits(e,15,25),this.seekWindowMs=Math.floor(e+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}set quickSeek(e){this._quickSeek=e}clone(){var e=new hi;return e.tempo=this._tempo,e.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),e}seekBestOverlapPosition(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}seekBestOverlapPositionStereo(){let e,t,i,r=0;for(this.preCalculateCorrelationReferenceStereo(),e=0,t=Number.MIN_VALUE;r<this.seekLength;r+=1)(i=this.calculateCrossCorrelationStereo(2*r,this.refMidBuffer))>t&&(t=i,e=r);return e}seekBestOverlapPositionStereoQuick(){let t,i,r,s,a,n=0;for(this.preCalculateCorrelationReferenceStereo(),i=Number.MIN_VALUE,t=0,s=0,a=0;n<4;n+=1){let e=0;for(;ui[n][e]&&!((a=s+ui[n][e])>=this.seekLength);)(r=this.calculateCrossCorrelationStereo(2*a,this.refMidBuffer))>i&&(i=r,t=a),e+=1;s=t}return t}preCalculateCorrelationReferenceStereo(){let e,t,i=0;for(;i<this.overlapLength;i+=1)t=i*(this.overlapLength-i),e=2*i,this.refMidBuffer[e]=this.midBuffer[e]*t,this.refMidBuffer[1+e]=this.midBuffer[1+e]*t}calculateCrossCorrelationStereo(e,t){var i=this._inputBuffer.vector;e+=this._inputBuffer.startIndex;let r=0,s=2;for(var a,n=2*this.overlapLength;s<n;s+=2)a=s+e,r+=i[a]*t[s]+i[a+1]*t[s+1];return r}overlap(e){this.overlapStereo(2*e)}overlapStereo(e){var t=this._inputBuffer.vector,i=(e+=this._inputBuffer.startIndex,this._outputBuffer.vector),r=this._outputBuffer.endIndex;let s,a,n=0;for(var o,l,c,d=1/this.overlapLength;n<this.overlapLength;n+=1)a=(this.overlapLength-n)*d,o=n*d,i[(c=(s=2*n)+r)+0]=t[(l=s+e)+0]*o+this.midBuffer[0+s]*a,i[c+1]=t[l+1]*o+this.midBuffer[1+s]*a}process(){var e;if(null===this.midBuffer){if(this._inputBuffer.frameCount<this.overlapLength)return;this.midBuffer=new Float32Array(2*this.overlapLength),this._inputBuffer.receiveSamples(this.midBuffer,this.overlapLength)}for(;this._inputBuffer.frameCount>=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),0<(t=this.seekWindowLength-2*this.overlapLength)&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);var t=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(t,t+2*this.overlapLength)),this.skipFract+=this.nominalSkip,e=Math.floor(this.skipFract),this.skipFract-=e,this._inputBuffer.receive(e)}}}function pi(e,t){return 1e-10<(t<e?e-t:t-e)}class fi{constructor(){this.transposer=new li(!1),this.stretch=new hi(!1),this._inputBuffer=new ni,this._intermediateBuffer=new ni,this._outputBuffer=new ni,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}clear(){this.transposer.clear(),this.stretch.clear()}clone(){var e=new fi;return e.rate=this.rate,e.tempo=this.tempo,e}get rate(){return this._rate}set rate(e){this.virtualRate=e,this.calculateEffectiveRateAndTempo()}set rateChange(e){this._rate=1+.01*e}get tempo(){return this._tempo}set tempo(e){this.virtualTempo=e,this.calculateEffectiveRateAndTempo()}set tempoChange(e){this.tempo=1+.01*e}set pitch(e){this.virtualPitch=e,this.calculateEffectiveRateAndTempo()}set pitchOctaves(e){this.pitch=Math.exp(.69314718056*e),this.calculateEffectiveRateAndTempo()}set pitchSemitones(e){this.pitchOctaves=e/12}get inputBuffer(){return this._inputBuffer}get outputBuffer(){return this._outputBuffer}calculateEffectiveRateAndTempo(){var e=this._tempo,t=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,pi(this._tempo,e)&&(this.stretch.tempo=this._tempo),pi(this._rate,t)&&(this.transposer.rate=this._rate),1<this._rate?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}process(){(1<this._rate?(this.stretch.process(),this.transposer):(this.transposer.process(),this.stretch)).process()}}class gi{constructor(e,t,i){this.player=e,this.audio=t,this.soundTouch=new fi,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new di(i,this.soundTouch)}setRate(e){e!==this.soundTouch.rate&&(this.soundTouch.tempo=e)}provide(e){var t=new Float32Array(2*e),i=this.filter.extract(t,e),r=new Float32Array(i),s=new Float32Array(i);for(let e=0;e<i;e++)r[e]=t[2*e],s[e]=t[2*e+1];return{size:i,left:r,right:s,ts:this.audio.tempAudioTimestamp||0}}destroy(){this.soundTouch&&(this.soundTouch.clear(),this.soundTouch=null),this.filter&&(this.filter=null)}}class mi extends si{constructor(e){super(e),this.defaultPlaybackRate=1,this.playbackRate=1,this.rateProcessor=null,this.processor=null,this.scriptNodeInterval=null,this.engineType=this.getAutoAudioEngineType(),this.audioBufferSize=this.getAudioBufferSizeByType(),this.$audio=null,this._delayPlay=!1,this.eventListenList=[],this.player._opt.supportLockScreenPlayAudio&&rt()&&(this.$audio=document.createElement("audio"),Object.assign(this.$audio.style,{position:"absolute",left:"-100%",top:"-100%"}),(e.$container||document.body).appendChild(this.$audio),this._bindAudioProxy(),this.player.debug.log("AudioContext","create audio element")),this.scriptStartTime=0,this.player.debug.log("AudioContext","init",`engineType: ${this.engineType}, audioBufferSize: `+this.audioBufferSize)}destroy(){super.destroy(),this.eventListenList&&(this.eventListenList.forEach(e=>{e()}),this.eventListenList=[]),this.$audio&&(this.$audio.pause(),this.$audio.srcObject=null,this.$audio.parentNode&&this.$audio.parentNode.removeChild(this.$audio),this.$audio=null),this.processor&&(this.processor.destroy(),this.processor=null),this.rateProcessor&&(this.rateProcessor.destroy(),this.rateProcessor=null),this.scriptNodeInterval&&(clearInterval(this.scriptNodeInterval),this.scriptNodeInterval=null),this.defaultPlaybackRate=1,this.playbackRate=1,this.scriptStartTime=0,this.audioBufferSize=0,this.engineType=Ge,this.player.debug.log("AudioContext","destroy")}isAudioPlaying(){return this.$audio&&k(this.$audio.paused)&&k(this.$audio.ended)&&0!==this.$audio.playbackRate&&0!==this.$audio.readyState}_bindAudioProxy(){var e=this.player.events["proxy"],e=e(this.$audio,"canplay",()=>{this.player.debug.log("AudioContext","canplay"),this._delayPlay&&this._audioElementPlay()});this.eventListenList.push(e)}_getAudioElementReadyState(){let e=0;return e=this.$audio?this.$audio.readyState:e}audioElementPlay(){var e;this.$audio&&(e=this._getAudioElementReadyState(),this.player.debug.log("AudioContext","play and readyState: "+e),0!==e||St()&&rt()?this._audioElementPlay():(this.player.debug.warn("AudioContext","readyState is 0 and set _delayPlay to true"),this._delayPlay=!0))}_audioElementPlay(){this.$audio&&this.$audio.play().then(()=>{this._delayPlay=!1,this.player.debug.log("AudioContext","_audioElementPlay success"),setTimeout(()=>{this.isAudioPlaying()||(this.player.debug.warn("AudioContext","play failed and retry play"),this._audioElementPlay())},100),this.isAudioPlaying()&&(this.player.debug.log("AudioContext","play success and remove document click event listener"),document.removeEventListener("click",this._audioElementPlay.bind(this)))}).catch(e=>{this.player.debug.error("AudioContext","_audioElementPlay error",e),document.addEventListener("click",this._audioElementPlay.bind(this))})}getAudioBufferSize(){return this.audioBufferSize}get oneBufferDuration(){return this.audioBufferSize/this.audioContext.sampleRate*1e3}get isActiveEngineType(){return this.engineType===He}initProcessor(){this.processor=new ai(this.player,this,this.audioInfo.channels,this.audioBufferSize),this.rateProcessor=new gi(this.player,this,this.processor)}getAutoAudioEngineType(){let t=this.player._opt.audioEngine||Ge;var e=()=>{var e;t=St()&&(e=window.navigator.userAgent.toLowerCase(),/android/i.test(e))?He:(!rt()||!this.player._opt.supportLockScreenPlayAudio)&&Lt()?ze:Ge};return this.player._opt.audioEngine?this.player._opt.audioEngine===ze&&Lt()?t=ze:this.player._opt.audioEngine===He?t=He:this.player._opt.audioEngine===Ge?t=Ge:e():e(),t}getAudioBufferSizeByType(){var e=this.engineType,t=(this.player._opt.hasVideo,this.player._opt.weiXinInAndroidAudioBufferSize);return e!==ze&&e===He?t||4800:1024}initScriptNode(){this.playing=!0,this.hasInitScriptNode||(this.initProcessor(),this.engineType===ze?this.initWorkletScriptNode():this.engineType===He?this.initIntervalScriptNode():this.engineType===Ge&&this.initProcessScriptNode(),this.audioElementPlay())}getEngineType(){return this.engineType}isPlaybackRateSpeed(){return this.playbackRate>this.defaultPlaybackRate}initProcessScriptNode(){var e=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);e.onaudioprocess=e=>{e=e.outputBuffer;this.handleScriptNodeCallback(e)},e.connect(this.gainNode),this.scriptNode=e,this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0}initIntervalScriptNode(){this.scriptStartTime=0;var e=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval(()=>{const e=this.audioContext.createBufferSource(),t=this.audioContext.createBuffer(this.audioInfo.channels,this.audioBufferSize,this.audioContext.sampleRate);this.handleScriptNodeCallback(t,()=>{this.scriptStartTime<this.audioContext.currentTime&&(this.player.debug.log("AudioContext",`script start time ${this.scriptStartTime} is less than current time `+this.audioContext.currentTime),this.scriptStartTime=this.audioContext.currentTime),e.buffer=t,e.connect(this.gainNode),e.start(this.scriptStartTime),this.scriptStartTime+=t.duration})},e),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0}initWorkletScriptNode(){this.audioContext&&this.audioContext.audioWorklet.addModule(Rt(function(){class e extends AudioWorkletProcessor{constructor(){super(),this.audioBufferSize=1024,this.start=!1,this.channels=1,this.samplesArray=[],this.offset=0,this.state=0,this.port.onmessage=e=>{"init"===e.data.message?(this.audioBufferSize=e.data.audioBufferSize,this.start=e.data.start,this.channels=e.data.channels,this.state=0,this.offset=0,this.samplesArray=[]):"stop"===e.data.message?(this.state=0,this.start=!1,this.offset=0,this.samplesArray=[]):"data"===e.data.message?this.samplesArray.push(e.data.buffer):"zero"===e.data.message&&this.samplesArray.push({left:new Float32Array(this.audioBufferSize).fill(0),right:new Float32Array(this.audioBufferSize).fill(0)})}}process(t,e,i){var r=e[0][0],s=e[0][1];if(0===this.offset&&this.port.postMessage({message:"beep"}),0===this.state)this.state=1;else if(1===this.state&&4<=this.samplesArray.length)this.state=2;else if(2===this.state){const t=this.samplesArray[0];for(let e=0;e<r.length;e++)1===this.channels?r[e]=t.left[e+this.offset]:2===this.channels&&(r[e]=t.left[e+this.offset],s)&&(s[e]=t.right[e+this.offset])}else 1===this.channels?r.fill(0):2===this.channels&&(r.fill(0),s)&&s.fill(0);return this.offset+=128,this.offset===this.audioBufferSize&&(this.offset=0,2===this.state&&this.samplesArray.shift(),0===this.samplesArray.length)&&(this.state=0),this.start}}registerProcessor("worklet-processor",e)})).then(()=>{if(this.audioContext){let e=[1];2===this.audioInfo.channels&&(e=[1,1]),this.workletProcessorNode=new AudioWorkletNode(this.audioContext,"worklet-processor",{numberOfOutputs:this.audioInfo.channels,outputChannelCount:e}),this.workletProcessorNode.connect(this.gainNode),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0,this.workletProcessorNode.port.postMessage({message:"init",audioBufferSize:this.audioBufferSize,start:!0,channels:this.audioInfo.channels}),this.workletProcessorNode.port.onmessage=e=>{this.workletProcessorNode?this.audioContext?this.handleScriptNodeCallback(this.workletProcessorNode,null,!0):this.workletProcessorNode.port.postMessage({message:"zero"}):this.player.debug.error("AudioContext","workletProcessorNode is null")}}else this.player.debug.error("AudioContext","initWorkletScriptNode audioContext is null")})}handleScriptNodeCallback(e,t){let i,r=2<arguments.length&&void 0!==arguments[2]&&arguments[2],s=(t=t||qe,e.length);r&&(i=e,s=this.audioBufferSize);var a,n=this.audioInfo.channels;this.bufferList.length&&this.playing?(a=this.player._opt).syncAudioAndVideo&&a.hasVideo&&(this.calcPlaybackRateBySync(),1e3<this.audioSyncVideoOption.diff)?(this.player.debug.warn("AudioContext",`audioSyncVideoOption more than diff :${this.audioSyncVideoOption.diff}, waiting`),r?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,n)):0===(a=this._provide(s)).size?r?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,n):(a&&a.ts&&(this.player.audioTimestamp=a.ts),r?i.port.postMessage({message:"data",buffer:a}):this.fillScriptNodeOutputBuffer(e,n,a)):r?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,n),t()}fillScriptNodeOutputBuffer(e,t,i){if(1===t){const t=e.getChannelData(0);!i||0===i.size?t.fill(0):t.set(i.left)}else if(2===t){const t=e.getChannelData(0),r=e.getChannelData(1);!i||0===i.size?(t.fill(0),r.fill(0)):(t.set(i.left),r.set(i.right))}}play(e,t){this.isMute||(this.hasInitScriptNode?(this.hasAudio=!0,this.bufferList.push({buffer:e,ts:t}),this.player._opt.syncAudioAndVideo||this.calcPlaybackRateByBuffer()):this.player.debug.warn("AudioContext","play has not init script node"))}calcPlaybackRateBySync(){if(!this.isMute&&this.playing){let e=this.playbackRate;this.audioSyncVideoOption.diff<-1e3?(e=this.defaultPlaybackRate+.1,this.player.debug.warn("AudioContext",`audioSyncVideoOption -1000 less than diff :${this.audioSyncVideoOption.diff}, speed up, playbackRate is `+e)):-500<this.audioSyncVideoOption.diff&&(e=this.defaultPlaybackRate),this.updatePlaybackRate(e)}}calcPlaybackRateByBuffer(){if(!this.isMute&&this.playing&&this.getEngineType()!==He){let e=this.playbackRate;var t=Math.floor(1e3/this.oneBufferDuration),i=Math.floor(5e3/this.oneBufferDuration);this.bufferList.length>i?(this.player.debug.warn("AudioContext",`bufferList length ${this.bufferList.length} more than ${i}, and drop`),this.clear()):(this.bufferList.length>t?(e=this.defaultPlaybackRate+.1,this.player.debug.warn("AudioContext",`bufferList length ${this.bufferList.length} more than ${t}, speed up, playbackRate is `+e)):this.bufferList.length<t/2&&(e=this.defaultPlaybackRate),this.updatePlaybackRate(e))}}updatePlaybackRate(e){this.rateProcessor&&(this.playbackRate=e,this.rateProcessor.setRate(this.playbackRate))}_provide(e){return(1===this.playbackRate?this.processor:this.rateProcessor).provide(e)}}class Ai extends e{constructor(e){super(),this.player=e,this.$video=e.video.$videoElement,this.init=!1,this.player._opt.hlsUseCanvasRender&&(this.$video=this.player.hlsDecoder.$videoElement),this.audioInfo={encType:"",channels:"",sampleRate:""},this.player.debug.log("Audio","init")}destroy(){this.resetInit(),this.off(),this.player.debug.log("Audio","destroy")}resetInit(){this.init=!1,this.audioInfo={encType:"",channels:"",sampleRate:""}}getAudioInfo(){return this.audioInfo}updateAudioInfo(e){c(e.encTypeCode)&&(this.audioInfo.encType=ge[e.encTypeCode]),c(e.encType)&&(this.audioInfo.encType=e.encType),c(e.channels)&&(this.audioInfo.channels=e.channels),c(e.sampleRate)&&(this.audioInfo.sampleRate=e.sampleRate),c(this.audioInfo.sampleRate)&&c(this.audioInfo.channels)&&c(this.audioInfo.encType)&&!this.init&&(this.player.emit(E.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return!0}get volume(){return S(this.$video.muted)?0:this.$video.volume}get isMute(){return 0===this.$video.volume||S(this.$video.muted)}mute(e){this.setVolume(e?0:this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e),isNaN(e)||(e=y(e,0,1),this.$video.muted&&(this.$video.muted=!1),this.$video.volume=e,this.player.emit(E.volumechange,this.player.volume))}clear(){}play(){}pause(){}resume(){}getEngineType(){return"audio"}isPlaybackRateSpeed(){return!1}getAudioBufferSize(){return 0}}class yi extends mi{constructor(e){super(e),this.delayTimeout=null,this.player.on(E.playbackPause,e=>{this.listenPlaybackPause(e)}),this.player.debug.log("AudioPlaybackContext","init")}destroy(){this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),super.destroy(),this.player.debug.log("AudioPlaybackLoader","destroy")}listenPlaybackPause(e){e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}initScriptNodeDelay(){var e=this.player._opt.playbackDelayTime;0<e?this.delayTimeout=setTimeout(()=>{this.initScriptNode()},e):this.initScriptNode()}setRate(e){e!==this.defaultPlaybackRate&&this.rateProcessor&&(this.player.debug.log("AudioPlaybackContext","setRate",e),this.defaultPlaybackRate=e,this.updatePlaybackRate(e))}}class bi extends mi{constructor(e){super(e),this.TAG_NAME="AudioPlayerLoader",this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy")}play(e,t){k(this.playing)||super.play(e,t)}pause(){this.player.debug.log(this.TAG_NAME,"pause"),this.playing=!1,this.clear()}resume(){this.player.debug.log(this.TAG_NAME,"resume"),this.playing=!0}}class vi{constructor(e){return new(vi.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.playType===v?yi:e.playType===U?bi:e.isHls||e.isWebrtc?Ai:mi}}class Ei extends e{constructor(t){super(),this.player=t,this.playing=!1,this.abortController=new AbortController,this.streamRate=et(e=>{t.emit(E.kBps,(e/1024).toFixed(2))}),this.streamRateInterval=null,t.debug.log("FetchStream","init")}destroy(){this.abort(),this.off(),this.streamRate=null,this.stopStreamRateInterval(),this.player.debug.log("FetchStream","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval(()=>{this.streamRate&&this.streamRate(0)},1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}fetchStream(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};const r=this.player["demux"];this.player._times.streamStart=A();t=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,t).then(e=>{if(e.ok&&200<=e.status&&e.status<=299)if(this.emit(E.streamSuccess),this.startStreamRateInterval(),"undefined"!=typeof WritableStream)e.body.pipeTo(new WritableStream({write:e=>(this.streamRate&&this.streamRate(e.byteLength),r.dispatch(e)),close:()=>{r.close()},abort:e=>{r.close();var t=e.toString();-1===t.indexOf(Oe)&&-1===t.indexOf(Fe)&&e.name!==je&&(this.abort(),this.emit(m.fetchError,e))}}));else{this.player.debug.log("FetchStream","not support WritableStream and use getReader() to read stream");const t=e.body.getReader(),i=()=>{t.read().then(e=>{var{done:e,value:t}=e;e?r.close():(this.streamRate&&this.streamRate(t.byteLength),r.dispatch(t),i())}).catch(e=>{r.close();var t=e.toString();-1===t.indexOf(Oe)&&-1===t.indexOf(Fe)&&e.name!==je&&(this.abort(),this.emit(m.fetchError,e))})};i()}else this.player.debug.error("FetchStream",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),this.abort(),this.emit(m.fetchError,`fetch response status is ${e.status} and ok is `+e.ok)}).catch(e=>{"AbortError"!==e.name&&(r.close(),this.abort(),this.emit(m.fetchError,e))})}abort(){this.abortController&&(this.abortController.abort(),this.abortController=null)}getStreamType(){return i}}class wi extends e{constructor(t){super(),this.player=t,this.socket=null,this.socketStatus=le,this.wsUrl=null,this.socketDestroyFnList=[],this.streamRate=et(e=>{t.emit(E.kBps,(e/1024).toFixed(2))}),this.streamRateInterval=null,t.debug.log("WebsocketStream","init")}destroy(){this._closeWebSocket(),this.stopStreamRateInterval(),this.wsUrl=null,this.off(),this.player.debug.log("WebsocketStream","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval(()=>{this.streamRate&&this.streamRate(0)},1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebSocket(){const e=this.player,{debug:t,events:{proxy:i},demux:r}=e;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer";var s=i(this.socket,"open",()=>{t.log("WebsocketStream","socket open"),this.socketStatus=ce,this.emit(E.streamSuccess),this.player.emit(E.websocketOpen),this.startStreamRateInterval()}),a=i(this.socket,"message",e=>{this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)}),n=i(this.socket,"close",e=>{t.log("WebsocketStream","socket close and code is "+e.code),1006===e.code&&t.error("WebsocketStream","socket close abnormally and code is "+e.code),r.close(),this.socketStatus="close",this.player.emit(E.websocketClose),this.emit(E.streamEnd)}),o=i(this.socket,"error",e=>{t.error("WebsocketStream","socket error",e),this.socketStatus="error",this.emit(m.websocketError,e),r.close(),t.log("WebsocketStream","socket error:",e.isTrusted?"websocket user aborted":"websocket error")});this.socketDestroyFnList.push(s,a,n,o)}_closeWebSocket(){this.socketDestroyFnList.forEach(e=>e()),this.socket&&(this.socket.close(1e3,"Client disconnecting"),this.socket=null),this.socketStatus=le,this.streamRate=null}_handleMessage(e){var t=this.player["demux"];t?t.dispatch(e):this.player.debug.warn("WebsocketStream","websocket handle message demux is null")}fetchStream(e,t){this.player._times.streamStart=A(),this.wsUrl=e,this._createWebSocket()}sendMessage(e){this.socket?this.socketStatus===ce?this.socket.send(e):this.player.debug.error("WebsocketStream","websocket send message error and socket status is "+this.socketStatus):this.player.debug.error("WebsocketStream","websocket send message socket is null")}resetFetchStream(){this._closeWebSocket(),this._createWebSocket()}getStreamType(){return F}}class Ti extends e{constructor(e){super(),(this.player=e).debug.log("HlsStream","init")}destroy(){this.off(),this.player.debug.log("HlsStream","destroy")}fetchStream(e){var t=this.player["hlsDecoder"];this.player._times.streamStart=A(),t.loadSource(e).then(()=>{this.player.debug.log("HlsStream","loadSource success"),this.emit(E.streamSuccess)}).catch(e=>{this.emit(m.hlsError,e)})}getStreamType(){return"hls"}}class Si extends e{constructor(e){super(),this.player=e,this.webrctUrl=null,e.debug.log("WebrtcStream","init")}destroy(){this.webrctUrl=null,this.off(),this.player.debug.log("WebrtcStream","destroy")}fetchStream(e){var t=this.player["webrtc"];this.player._times.streamStart=A(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),t.loadSource(this.webrctUrl).then(()=>{this.player.debug.log("WebrtcStream","loadSource success"),this.emit(E.streamSuccess)}).catch(e=>{this.emit(m.webrtcError,e)})}getStreamType(){return"webrtc"}}class ki extends e{constructor(t){super(),this.player=t,this.transport=null,this.wtUrl=null,this.streamRate=et(e=>{t.emit(E.kBps,(e/1024).toFixed(2))}),this.streamRateInterval=null,t.debug.log("WebTransportLoader","init")}destroy(){this.abort(),this.off(),this.player.debug.log("WebTransportLoader","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval(()=>{this.streamRate&&this.streamRate(0)},1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebTransport(){const e=this.player,{events:{},demux:t}=e;try{this.transport=new WebTransport(this.wtUrl),this.transport.ready.then(()=>{this.emit(E.streamSuccess),this.startStreamRateInterval(),this.transport.createBidirectionalStream().then(e=>{e.readable.pipeTo(new WritableStream(t.input))})}).catch(e=>{this.player.debug.warn("WebTransportLoader","_createWebTransport-ready",e)})}catch(e){this.player.debug.warn("WebTransportLoader","_createWebTransport",e)}}fetchStream(e){this.player._times.streamStart=A(),this.wtUrl=e.replace(/^wt/,"https"),this._createWebTransport()}abort(){if(this.transport)try{this.transport.close(),this.transport=null}catch(e){this.transport=null}}getStreamType(){return"webTransport"}}class _i extends e{constructor(e){super(),this.player=e,this.workUrl=null,e.debug.log("WorkerStream","init")}destroy(){this.workUrl=null,this.off(),this.player.debug.log("WorkerStream","destroy")}sendMessage(e){this.player.decoderWorker.workerSendMessage(e)}fetchStream(e){this.workUrl=e,this.player._times.streamStart=A(),this.player.decoderWorker.workerFetchStream(e)}getStreamType(){var e=this.player._opt.protocol;return j+" "+(2===e?i:F)}}class Ci{constructor(e){return new(Ci.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){var{protocol:t,useWasm:i,playType:r}=e;return 2===t?r===U||r!==n||i&&!Ct(e)?_i:Ei:1===t?r===U||r!==n||i&&!Ct(e)?_i:wi:3===t?Ti:4===t?Si:5===t?ki:void 0}}var Ri=$e(function(e){function T(i,s){if(!i)throw"First parameter is required.";s=new f(i,s=s||{type:"video"});var a=this;function t(e){e&&(s.initCallback=function(){e(),e=s.initCallback=null});var t=new g(i,s);(d=new t(i,s)).record(),c("recording"),s.disableLogs||console.log("Initialized recorderType:",d.constructor.name,"for output-type:",s.type)}function n(r){function e(e){if(d){Object.keys(d).forEach(function(e){"function"!=typeof d[e]&&(a[e]=d[e])});var t,i=d.blob;if(!i){if(!e)throw"Recording failed.";d.blob=i=e}if(i&&!s.disableLogs&&console.log(i.type,"->",y(i.size)),r){try{t=S.createObjectURL(i)}catch(e){}"function"==typeof r.call?r.call(a,t):r(t)}s.autoWriteToDisk&&l(function(e){var t={};t[s.type+"Blob"]=e,D.Store(t)})}else"function"==typeof r.call?r.call(a,""):r("")}r=r||function(){},d?"paused"===a.state?(a.resumeRecording(),setTimeout(function(){n(r)},1)):("recording"===a.state||s.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',a.state),s.disableLogs||console.log("Stopped recording "+s.type+" stream."),"gif"!==s.type?d.stop(e):(d.stop(),e()),c("stopped")):u()}function o(e){postMessage((new FileReaderSync).readAsDataURL(e))}function l(t,e){if(!t)throw"Pass a callback function over getDataURL.";var i,r=(e||d||{}).blob;r?"undefined"==typeof Worker||navigator.mozGetUserMedia?((i=new FileReader).readAsDataURL(r),i.onload=function(e){t(e.target.result)}):((i=function(e){try{var t=S.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return S.revokeObjectURL(t),i}catch(e){}}(o)).onmessage=function(e){t(e.data)},i.postMessage(r)):(s.disableLogs||console.warn("Blob encoder did not finish its job yet."),setTimeout(function(){l(t,e)},1e3))}function r(e){e=e||0,"paused"!==a.state?"stopped"!==a.state&&(e>=a.recordingDuration?n(a.onRecordingStopped):(e+=1e3,setTimeout(function(){r(e)},1e3))):setTimeout(function(){r(e)},1e3)}function c(e){a&&(a.state=e,"function"==typeof a.onStateChanged.call?a.onStateChanged.call(a,e):a.onStateChanged(e))}var d,e='It seems that recorder is destroyed or "startRecording" is not invoked for '+s.type+" recorder.";function u(){!0!==s.disableLogs&&console.warn(e)}var h={startRecording:function(e){return s.disableLogs||console.log("RecordRTC version: ",a.version),(s=e?new f(i,e):s).disableLogs||console.log("started recording "+s.type+" stream."),d?(d.clearRecordedData(),d.record(),c("recording"),a.recordingDuration&&r()):t(function(){a.recordingDuration&&r()}),a},stopRecording:n,pauseRecording:function(){d?"recording"===a.state?(c("paused"),d.pause(),s.disableLogs||console.log("Paused recording.")):s.disableLogs||console.warn("Unable to pause the recording. Recording state: ",a.state):u()},resumeRecording:function(){d?"paused"===a.state?(c("recording"),d.resume(),s.disableLogs||console.log("Resumed recording.")):s.disableLogs||console.warn("Unable to resume the recording. Recording state: ",a.state):u()},initRecorder:t,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return a.recordingDuration=e,a.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){a.onRecordingStopped=e}}},clearRecordedData:function(){d?(d.clearRecordedData(),s.disableLogs||console.log("Cleared old recorded data.")):u()},getBlob:function(){if(d)return d.blob;u()},getDataURL:l,toURL:function(){if(d)return S.createObjectURL(d.blob);u()},getInternalRecorder:function(){return d},save:function(e){d?b(d.blob,e):u()},getFromDisk:function(e){d?T.getFromDisk(s.type,e):u()},setAdvertisementArray:function(e){s.advertisement=[];for(var t=e.length,i=0;i<t;i++)s.advertisement.push({duration:i,image:e[i]})},blob:null,bufferSize:0,sampleRate:0,buffer:null,reset:function(){"recording"!==a.state||s.disableLogs||console.warn("Stop an active recorder."),d&&"function"==typeof d.clearRecordedData&&d.clearRecordedData(),d=null,c("inactive"),a.blob=null},onStateChanged:function(e){s.disableLogs||console.log("Recorder state changed:",e)},state:"inactive",getState:function(){return a.state},destroy:function(){var e=s.disableLogs;s={disableLogs:!0},a.reset(),c("destroyed"),h=a=null,v.AudioContextConstructor&&(v.AudioContextConstructor.close(),v.AudioContextConstructor=null),s.disableLogs=e,s.disableLogs||console.log("RecordRTC is destroyed.")},version:"5.6.2"};if(this){for(var p in h)this[p]=h[p];a=this}else a=h;return h}function f(e,t){return t.recorderType||t.type||(t.audio&&t.video?t.type="video":t.audio&&!t.video&&(t.type="audio")),t.recorderType&&!t.type&&(t.recorderType===h||t.recorderType===r||t.recorderType===P?t.type="video":t.recorderType===L?t.type="gif":t.recorderType===c?t.type="audio":t.recorderType===E&&(k(e,"audio").length&&k(e,"video").length||!k(e,"audio").length&&k(e,"video").length?t.type="video":k(e,"audio").length&&!k(e,"video").length&&(t.type="audio"))),"undefined"!=typeof MediaRecorder&&"requestData"in MediaRecorder.prototype&&(t.mimeType||(t.mimeType="video/webm"),t.type||(t.type=t.mimeType.split("/")[0]),t.bitsPerSecond),t.type||(t.mimeType&&(t.type=t.mimeType.split("/")[0]),t.type)||(t.type="audio"),t}function g(e,t){var i;return(d||s||n)&&(i=c),"undefined"!=typeof MediaRecorder&&"requestData"in MediaRecorder.prototype&&!d&&(i=E),"video"===t.type&&(d||n)&&(i=h,"undefined"!=typeof ReadableStream)&&(i=P),"gif"===t.type&&(i=L),"canvas"===t.type&&(i=r),u()&&i!==r&&i!==L&&"undefined"!=typeof MediaRecorder&&"requestData"in MediaRecorder.prototype&&(k(e,"video").length||k(e,"audio").length)&&("audio"===t.type?"function"==typeof MediaRecorder.isTypeSupported&&MediaRecorder.isTypeSupported("audio/webm")&&(i=E):"function"==typeof MediaRecorder.isTypeSupported&&MediaRecorder.isTypeSupported("video/webm")&&(i=E)),e instanceof Array&&e.length&&(i=I),t.recorderType&&(i=t.recorderType),!t.disableLogs&&i&&i.name&&console.log("Using recorderType:",i.name||i.constructor.name),i=!i&&l?E:i}function t(n){this.addStream=function(e){e&&(n=e)},this.mediaType={audio:!0,video:!0},this.startRecording=function(){var e,t,i,r,s=this.mediaType,a=this.mimeType||{audio:null,video:null,gif:null};if("function"!=typeof s.audio&&u()&&!k(n,"audio").length&&(s.audio=!1),"function"!=typeof s.video&&u()&&!k(n,"video").length&&(s.video=!1),"function"!=typeof s.gif&&u()&&!k(n,"video").length&&(s.gif=!1),!s.audio&&!s.video&&!s.gif)throw"MediaStream must have either audio or video tracks.";s.audio&&(e=null,"function"==typeof s.audio&&(e=s.audio),this.audioRecorder=new T(n,{type:"audio",bufferSize:this.bufferSize,sampleRate:this.sampleRate,numberOfAudioChannels:this.numberOfAudioChannels||2,disableLogs:this.disableLogs,recorderType:e,mimeType:a.audio,timeSlice:this.timeSlice,onTimeStamp:this.onTimeStamp}),s.video||this.audioRecorder.startRecording()),s.video&&(e=null,"function"==typeof s.video&&(e=s.video),t=n,u()&&s.audio&&"function"==typeof s.audio&&(r=k(n,"video")[0],o?((t=new A).addTrack(r),e&&e===h&&(e=E)):(t=new A).addTrack(r)),this.videoRecorder=new T(t,{type:"video",video:this.video,canvas:this.canvas,frameInterval:this.frameInterval||10,disableLogs:this.disableLogs,recorderType:e,mimeType:a.video,timeSlice:this.timeSlice,onTimeStamp:this.onTimeStamp,workerPath:this.workerPath,webAssemblyPath:this.webAssemblyPath,frameRate:this.frameRate,bitrate:this.bitrate}),s.audio||this.videoRecorder.startRecording()),s.audio&&s.video&&(i=this,r=!0===u(),!0===(r=s.audio instanceof c&&s.video||!0!==s.audio&&!0!==s.video&&s.audio!==s.video?!1:r)?(i.audioRecorder=null,i.videoRecorder.startRecording()):i.videoRecorder.initRecorder(function(){i.audioRecorder.initRecorder(function(){i.videoRecorder.startRecording(),i.audioRecorder.startRecording()})})),s.gif&&(e=null,"function"==typeof s.gif&&(e=s.gif),this.gifRecorder=new T(n,{type:"gif",frameRate:this.frameRate||200,quality:this.quality||10,disableLogs:this.disableLogs,recorderType:e,mimeType:a.gif}),this.gifRecorder.startRecording())},this.stopRecording=function(t){t=t||function(){},this.audioRecorder&&this.audioRecorder.stopRecording(function(e){t(e,"audio")}),this.videoRecorder&&this.videoRecorder.stopRecording(function(e){t(e,"video")}),this.gifRecorder&&this.gifRecorder.stopRecording(function(e){t(e,"gif")})},this.pauseRecording=function(){this.audioRecorder&&this.audioRecorder.pauseRecording(),this.videoRecorder&&this.videoRecorder.pauseRecording(),this.gifRecorder&&this.gifRecorder.pauseRecording()},this.resumeRecording=function(){this.audioRecorder&&this.audioRecorder.resumeRecording(),this.videoRecorder&&this.videoRecorder.resumeRecording(),this.gifRecorder&&this.gifRecorder.resumeRecording()},this.getBlob=function(e){var t={};return this.audioRecorder&&(t.audio=this.audioRecorder.getBlob()),this.videoRecorder&&(t.video=this.videoRecorder.getBlob()),this.gifRecorder&&(t.gif=this.gifRecorder.getBlob()),e&&e(t),t},this.destroy=function(){this.audioRecorder&&(this.audioRecorder.destroy(),this.audioRecorder=null),this.videoRecorder&&(this.videoRecorder.destroy(),this.videoRecorder=null),this.gifRecorder&&(this.gifRecorder.destroy(),this.gifRecorder=null)},this.getDataURL=function(i){function r(e,t){var i;"undefined"!=typeof Worker?((i=function(e){var t,e=S.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(e);if(void 0!==S)t=S;else{if("undefined"==typeof webkitURL)throw"Neither URL nor webkitURL detected.";t=webkitURL}return t.revokeObjectURL(e),i}(function(e){postMessage((new FileReaderSync).readAsDataURL(e))})).onmessage=function(e){t(e.data)},i.postMessage(e)):((i=new FileReader).readAsDataURL(e),i.onload=function(e){t(e.target.result)})}this.getBlob(function(e){e.audio&&e.video?r(e.audio,function(t){r(e.video,function(e){i({audio:t,video:e})})}):e.audio?r(e.audio,function(e){i({audio:e})}):e.video&&r(e.video,function(e){i({video:e})})})},this.writeToDisk=function(){T.writeToDisk({audio:this.audioRecorder,video:this.videoRecorder,gif:this.gifRecorder})},this.save=function(e){(e=e||{audio:!0,video:!0,gif:!0}).audio&&this.audioRecorder&&this.audioRecorder.save("string"==typeof e.audio?e.audio:""),e.video&&this.videoRecorder&&this.videoRecorder.save("string"==typeof e.video?e.video:""),e.gif&&this.gifRecorder&&this.gifRecorder.save("string"==typeof e.gif?e.gif:"")}}T.version="5.6.2",(e.exports=T).getFromDisk=function(i,r){if(!r)throw"callback is mandatory.";console.log("Getting recorded "+("all"===i?"blobs":i+" blob ")+" from disk!"),D.Fetch(function(e,t){"all"!==i&&t===i+"Blob"&&r&&r(e),"all"===i&&r&&r(e,t.replace("Blob",""))})},T.writeToDisk=function(e){console.log("Writing recorded blob(s) to disk!"),(e=e||{}).audio&&e.video&&e.gif?e.audio.getDataURL(function(i){e.video.getDataURL(function(t){e.gif.getDataURL(function(e){D.Store({audioBlob:i,videoBlob:t,gifBlob:e})})})}):e.audio&&e.video?e.audio.getDataURL(function(t){e.video.getDataURL(function(e){D.Store({audioBlob:t,videoBlob:e})})}):e.audio&&e.gif?e.audio.getDataURL(function(t){e.gif.getDataURL(function(e){D.Store({audioBlob:t,gifBlob:e})})}):e.video&&e.gif?e.video.getDataURL(function(t){e.gif.getDataURL(function(e){D.Store({videoBlob:t,gifBlob:e})})}):e.audio?e.audio.getDataURL(function(e){D.Store({audioBlob:e})}):e.video?e.video.getDataURL(function(e){D.Store({videoBlob:e})}):e.gif&&e.gif.getDataURL(function(e){D.Store({gifBlob:e})})},t.getFromDisk=T.getFromDisk,t.writeToDisk=T.writeToDisk,T.MRecordRTC=t,(e=void 0!==B?B:null)&&"undefined"==typeof window&&void 0!==B&&(B.navigator={userAgent:"Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45",getUserMedia:function(){}},B.console||(B.console={}),void 0!==B.console.log&&void 0!==B.console.error||(B.console.error=B.console.log=B.console.log||function(){console.log(arguments)}),"undefined"==typeof document&&(e.document={documentElement:{appendChild:function(){return""}}},document.createElement=document.captureStream=document.mozCaptureStream=function(){var e={getContext:function(){return e},play:function(){},pause:function(){},drawImage:function(){},toDataURL:function(){return""},style:{}};return e},e.HTMLVideoElement=function(){}),"undefined"==typeof location&&(e.location={protocol:"file:",href:"",hash:""}),"undefined"==typeof screen&&(e.screen={width:0,height:0}),void 0===S&&(e.URL={createObjectURL:function(){return""},revokeObjectURL:function(){return""}}),e.window=B);var a,p=window.requestAnimationFrame,m=(void 0===p&&("undefined"!=typeof webkitRequestAnimationFrame?p=webkitRequestAnimationFrame:"undefined"!=typeof mozRequestAnimationFrame?p=mozRequestAnimationFrame:"undefined"!=typeof msRequestAnimationFrame?p=msRequestAnimationFrame:void 0===p&&(a=0,p=function(e,t){var i=(new Date).getTime(),r=Math.max(0,16-(i-a)),s=setTimeout(function(){e(i+r)},r);return a=i+r,s})),window.cancelAnimationFrame),e=(void 0===m&&("undefined"!=typeof webkitCancelAnimationFrame?m=webkitCancelAnimationFrame:"undefined"!=typeof mozCancelAnimationFrame?m=mozCancelAnimationFrame:"undefined"!=typeof msCancelAnimationFrame?m=msCancelAnimationFrame:void 0===m&&(m=function(e){clearTimeout(e)})),window.AudioContext),S=(void 0===e&&("undefined"!=typeof webkitAudioContext&&(e=webkitAudioContext),"undefined"!=typeof mozAudioContext)&&(e=mozAudioContext),window.URL),s=(void 0===S&&"undefined"!=typeof webkitURL&&(S=webkitURL),"undefined"!=typeof navigator&&void 0===navigator.getUserMedia&&(void 0!==navigator.webkitGetUserMedia&&(navigator.getUserMedia=navigator.webkitGetUserMedia),void 0!==navigator.mozGetUserMedia)&&(navigator.getUserMedia=navigator.mozGetUserMedia),!(-1===navigator.userAgent.indexOf("Edge")||!navigator.msSaveBlob&&!navigator.msSaveOrOpenBlob)),n=!!window.opera||-1!==navigator.userAgent.indexOf("OPR/"),o=-1<navigator.userAgent.toLowerCase().indexOf("firefox")&&"netscape"in window&&/ rv:/.test(navigator.userAgent),d=!n&&!s&&!!navigator.webkitGetUserMedia||i()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),l=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),A=(l&&!d&&-1!==navigator.userAgent.indexOf("CriOS")&&(d=!(l=!1)),window.MediaStream);function y(e){var t;return 0===e?"0 Bytes":(t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10),(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t])}function b(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1],r=(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")&&(t=(r=t.split("."))[0],i=r[1]),(t||Math.round(9999999999*Math.random())+888888888)+"."+i);return void 0!==navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(e,r):void 0!==navigator.msSaveBlob?navigator.msSaveBlob(e,r):((t=document.createElement("a")).href=S.createObjectURL(e),t.download=r,t.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(t),"function"==typeof t.click?t.click():(t.target="_blank",t.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),void S.revokeObjectURL(t.href))}function i(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&0<=navigator.userAgent.indexOf("Electron")}function k(e,t){return e&&e.getTracks?e.getTracks().filter(function(e){return e.kind===(t||"audio")}):[]}function w(e,t){!("srcObject"in t)&&"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0!==(A=void 0===A&&"undefined"!=typeof webkitMediaStream?webkitMediaStream:A)&&void 0===A.prototype.stop&&(A.prototype.stop=function(){this.getTracks().forEach(function(e){e.stop()})}),T.invokeSaveAsDialog=b,T.getTracks=k,T.getSeekableBlob=function(e,r){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var s=new EBML.Reader,a=new EBML.Decoder,n=EBML.tools,t=new FileReader;t.onload=function(e){a.decode(this.result).forEach(function(e){s.read(e)}),s.stop();var t=n.makeMetadataSeekable(s.metadatas,s.duration,s.cues),i=this.result.slice(s.metadataSize),t=new Blob([t,i],{type:"video/webm"});r(t)},t.readAsArrayBuffer(e)},T.bytesToSize=y,T.isElectron=i;var v={};function u(){var e,t,i,r;return!!(o||l||s)||(t=navigator.userAgent,i=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10),(d||n)&&(e=t.indexOf("Chrome"),i=t.substring(e+7)),-1!==(t=(i=-1!==(t=i.indexOf(";"))?i.substring(0,t):i).indexOf(" "))&&(i=i.substring(0,t)),r=parseInt(""+i,10),isNaN(r)&&(i=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),49<=r)}function E(i,r){var e,s=this;if(void 0===i)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";"audio"===(r=r||{mimeType:"video/webm"}).type&&(k(i,"video").length&&k(i,"audio").length&&(navigator.mozGetUserMedia?(e=new A).addTrack(k(i,"audio")[0]):e=new A(k(i,"audio")),i=e),r.mimeType&&-1!==r.mimeType.toString().toLowerCase().indexOf("audio")||(r.mimeType=d?"audio/webm":"audio/ogg"),r.mimeType)&&"audio/ogg"!==r.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(r.mimeType="audio/ogg");var a,n=[];function o(){s.timestamps.push((new Date).getTime()),"function"==typeof r.onTimeStamp&&r.onTimeStamp(s.timestamps[s.timestamps.length-1],s.timestamps)}function l(e){return a&&a.mimeType?a.mimeType:e.mimeType||"video/webm"}function t(){n=[],a=null,s.timestamps=[]}this.getArrayOfBlobs=function(){return n},this.record=function(){s.blob=null,s.clearRecordedData(),s.timestamps=[],c=[],n=[];var t=r;r.disableLogs||console.log("Passing following config over MediaRecorder API.",t),a=a&&null,d&&!u()&&(t="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&t.mimeType&&!MediaRecorder.isTypeSupported(t.mimeType)&&(r.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",t.mimeType),t.mimeType="audio"===r.type?"audio/webm":"video/webm");try{a=new MediaRecorder(i,t),r.mimeType=t.mimeType}catch(e){a=new MediaRecorder(i)}t.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in a&&!1===a.canRecordMimeType(t.mimeType)&&(r.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",t.mimeType)),a.ondataavailable=function(e){e.data&&c.push("ondataavailable: "+y(e.data.size)),"number"!=typeof r.timeSlice?!e.data||!e.data.size||e.data.size<100||s.blob?s.recordingCallback&&(s.recordingCallback(new Blob([],{type:l(t)})),s.recordingCallback=null):(s.blob=r.getNativeBlob?e.data:new Blob([e.data],{type:l(t)}),s.recordingCallback&&(s.recordingCallback(s.blob),s.recordingCallback=null)):e.data&&e.data.size&&(n.push(e.data),o(),"function"==typeof r.ondataavailable)&&(e=r.getNativeBlob?e.data:new Blob([e.data],{type:l(t)}),r.ondataavailable(e))},a.onstart=function(){c.push("started")},a.onpause=function(){c.push("paused")},a.onresume=function(){c.push("resumed")},a.onstop=function(){c.push("stopped")},a.onerror=function(e){e&&(e.name||(e.name="UnknownError"),c.push("error: "+e),r.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",t.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),!s.manuallyStopped&&a&&"inactive"===a.state?(delete r.timeslice,a.start(6e5)):setTimeout(void 0,1e3),"inactive"!==a.state)&&"stopped"!==a.state&&a.stop()},"number"==typeof r.timeSlice?(o(),a.start(r.timeSlice)):a.start(36e5),r.initCallback&&r.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},s.manuallyStopped=!0,a&&(this.recordingCallback=e,"recording"===a.state&&a.stop(),"number"==typeof r.timeSlice)&&setTimeout(function(){s.blob=new Blob(n,{type:l(r)}),s.recordingCallback(s.blob)},100)},this.pause=function(){a&&"recording"===a.state&&a.pause()},this.resume=function(){a&&"paused"===a.state&&a.resume()},this.clearRecordedData=function(){a&&"recording"===a.state&&s.stop(t),t()},this.getInternalRecorder=function(){return a},this.blob=null,this.getState=function(){return a&&a.state||"inactive"};var c=[];this.getAllStates=function(){return c},void 0===r.checkForInactiveTracks&&(r.checkForInactiveTracks=!1),s=this,function e(){if(a&&!1!==r.checkForInactiveTracks)return!1===function(){if("active"in i){if(!i.active)return!1}else if("ended"in i&&i.ended)return!1;return!0}()?(r.disableLogs||console.log("MediaStream seems stopped."),void s.stop()):void setTimeout(e,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function c(e,r){if(!k(e,"audio").length)throw"Your stream has no audio tracks.";var s,a=this,n=[],o=[],l=!1,c=0,d=2,u=(r=r||{}).desiredSampRate;function h(){if(!1!==r.checkForInactiveTracks)if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function t(e,t){function i(e,t){var i,r=e.numberOfAudioChannels,s=e.leftBuffers.slice(0),a=e.rightBuffers.slice(0),n=e.sampleRate,o=e.internalInterleavedLength,e=e.desiredSampRate;function l(e,t,i){var r=Math.round(e.length*(t/i)),s=[],a=Number((e.length-1)/(r-1));s[0]=e[0];for(var n,o=1;o<r-1;o++){var l=o*a,c=Number(Math.floor(l)).toFixed(),d=Number(Math.ceil(l)).toFixed();s[o]=(n=e[c],d=e[d],n+(d-n)*(l-c))}return s[r-1]=e[e.length-1],s}function c(e,t){for(var i=new Float64Array(t),r=0,s=e.length,a=0;a<s;a++){var n=e[a];i.set(n,r),r+=n.length}return i}function d(e,t,i){for(var r=i.length,s=0;s<r;s++)e.setUint8(t+s,i.charCodeAt(s))}2===r&&(s=c(s,o),a=c(a,o),e)&&(s=l(s,e,n),a=l(a,e,n)),1===r&&(s=c(s,o),e)&&(s=l(s,e,n)),e&&(n=e),2===r&&(i=function(e,t){for(var i=e.length+t.length,r=new Float64Array(i),s=0,a=0;a<i;)r[a++]=e[s],r[a++]=t[s],s++;return r}(s,a));var o=(i=1===r?s:i).length,e=new ArrayBuffer(44+2*o),u=new DataView(e);d(u,0,"RIFF"),u.setUint32(4,36+2*o,!0),d(u,8,"WAVE"),d(u,12,"fmt "),u.setUint32(16,16,!0),u.setUint16(20,1,!0),u.setUint16(22,r,!0),u.setUint32(24,n,!0),u.setUint32(28,n*r*2,!0),u.setUint16(32,2*r,!0),u.setUint16(34,16,!0),d(u,36,"data"),u.setUint32(40,2*o,!0);for(var h=o,p=44,f=0;f<h;f++)u.setInt16(p,32767*i[f],!0),p+=2;if(t)return t({buffer:e,view:u});postMessage({buffer:e,view:u})}var r,s,a;e.noWorker?i(e,function(e){t(e.buffer,e.view)}):(r=i,r=S.createObjectURL(new Blob([r.toString(),";this.onmessage = function (eee) {"+r.name+"(eee.data);}"],{type:"application/javascript"})),(s=new Worker(r)).workerURL=r,(a=s).onmessage=function(e){t(e.data.buffer,e.data.view),S.revokeObjectURL(a.workerURL),a.terminate()},a.postMessage(e))}!0===r.leftChannel&&(d=1),(!(d=1===r.numberOfAudioChannels?1:d)||d<1)&&(d=2),r.disableLogs||console.log("StereoAudioRecorder is set to record number of channels: "+d),void 0===r.checkForInactiveTracks&&(r.checkForInactiveTracks=!0),this.record=function(){if(!1===h())throw"Please make sure MediaStream is active.";y(),v=A=!1,l=!0,void 0!==r.timeSlice&&w()},this.stop=function(i){i=i||function(){},l=!1,t({desiredSampRate:u,sampleRate:m,numberOfAudioChannels:d,internalInterleavedLength:c,leftBuffers:n,rightBuffers:1===d?[]:o,noWorker:r.noWorker},function(e,t){a.blob=new Blob([t],{type:"audio/wav"}),a.buffer=new ArrayBuffer(t.buffer.byteLength),a.view=t,a.sampleRate=u||m,a.bufferSize=g,a.length=c,v=!1,i&&i(a.blob)})},(T.Storage=void 0===T.Storage?{AudioContextConstructor:null,AudioContext:window.AudioContext||window.webkitAudioContext}:T.Storage).AudioContextConstructor&&"closed"!==T.Storage.AudioContextConstructor.state||(T.Storage.AudioContextConstructor=new T.Storage.AudioContext);var i=T.Storage.AudioContextConstructor,p=i.createMediaStreamSource(e),f=[0,256,512,1024,2048,4096,8192,16384],g=void 0===r.bufferSize?4096:r.bufferSize;if(-1!==f.indexOf(g)||r.disableLogs||console.log("Legal values for buffer-size are "+JSON.stringify(f,null,"\t")),i.createJavaScriptNode)s=i.createJavaScriptNode(g,d,d);else{if(!i.createScriptProcessor)throw"WebAudio API has no support on this browser.";s=i.createScriptProcessor(g,d,d)}p.connect(s),r.bufferSize||(g=s.bufferSize);var m=void 0!==r.sampleRate?r.sampleRate:i.sampleRate||44100,A=((m<22050||96e3<m)&&!r.disableLogs&&console.log("sample-rate must be under range 22050 and 96000."),r.disableLogs||r.desiredSampRate&&console.log("Desired sample-rate: "+r.desiredSampRate),!1);function y(){n=[],c=0,A=l=v=!(o=[]),i=null,a.leftchannel=n,a.rightchannel=o,a.numberOfAudioChannels=d,a.desiredSampRate=u,a.sampleRate=m,a.recordingLength=c,E={left:[],right:[],recordingLength:0}}function b(){s&&(s.onaudioprocess=null,s.disconnect(),s=null),p&&(p.disconnect(),p=null),y()}this.pause=function(){A=!0},this.resume=function(){if(!1===h())throw"Please make sure MediaStream is active.";l?A=!1:(r.disableLogs||console.log("Seems recording has been restarted."),this.record())},this.clearRecordedData=function(){r.checkForInactiveTracks=!1,l&&this.stop(b),b()},this.name="StereoAudioRecorder";var v=!(this.toString=function(){return this.name}),E=(s.onaudioprocess=function(e){var t,i;A||(!1===h()&&(r.disableLogs||console.log("MediaStream seems stopped."),s.disconnect(),l=!1),l?(v||(v=!0,r.onAudioProcessStarted&&r.onAudioProcessStarted(),r.initCallback&&r.initCallback()),t=e.inputBuffer.getChannelData(0),t=new Float32Array(t),n.push(t),2===d&&(e=e.inputBuffer.getChannelData(1),i=new Float32Array(e),o.push(i)),c+=g,a.recordingLength=c,void 0!==r.timeSlice&&(E.recordingLength+=g,E.left.push(t),2===d)&&E.right.push(i)):p&&(p.disconnect(),p=null))},i.createMediaStreamDestination?s.connect(i.createMediaStreamDestination()):s.connect(i.destination),this.leftchannel=n,this.rightchannel=o,this.numberOfAudioChannels=d,this.desiredSampRate=u,this.sampleRate=m,a.recordingLength=c,{left:[],right:[],recordingLength:0});function w(){l&&"function"==typeof r.ondataavailable&&void 0!==r.timeSlice&&(E.left.length?(t({desiredSampRate:u,sampleRate:m,numberOfAudioChannels:d,internalInterleavedLength:E.recordingLength,leftBuffers:E.left,rightBuffers:1===d?[]:E.right},function(e,t){t=new Blob([t],{type:"audio/wav"});r.ondataavailable(t),setTimeout(w,r.timeSlice)}),E={left:[],right:[],recordingLength:0}):setTimeout(w,r.timeSlice))}}function r(s,a){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(a=a||{}).frameInterval||(a.frameInterval=10);var r=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach(function(e){e in document.createElement("canvas")&&(r=!0)});var i,n,o,e=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),t=50,l=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(e&&l&&l[2]&&(t=parseInt(l[2],10)),e&&t<52&&(r=!1),r=a.useWhammyRecorder?!1:r)if(a.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),s instanceof HTMLCanvasElement)i=s;else{if(!(s instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";i=s.canvas}else!navigator.mozGetUserMedia||a.disableLogs||console.error("Canvas recording is NOT supported in Firefox.");this.record=function(){if(o=!0,r&&!a.useWhammyRecorder){var e;"captureStream"in i?e=i.captureStream(25):"mozCaptureStream"in i?e=i.mozCaptureStream(25):"webkitCaptureStream"in i&&(e=i.webkitCaptureStream(25));try{var t=new A;t.addTrack(k(e,"video")[0]),e=t}catch(e){}if(!e)throw"captureStream API are NOT available.";(n=new E(e,{mimeType:a.mimeType||"video/webm"})).record()}else p.frames=[],h=(new Date).getTime(),u();a.initCallback&&a.initCallback()},this.getWebPImages=function(e){var r;"canvas"===s.nodeName.toLowerCase()&&(r=p.frames.length,p.frames.forEach(function(e,t){var i=r-t,i=(a.disableLogs||console.log(i+"/"+r+" frames remaining"),a.onEncodingCallback&&a.onEncodingCallback(i,r),e.image.toDataURL("image/webp",1));p.frames[t].image=i}),a.disableLogs||console.log("Generating WebM")),e()};var c=!(this.stop=function(t){o=!1;var i=this;r&&n?n.stop(t):this.getWebPImages(function(){p.compile(function(e){a.disableLogs||console.log("Recording finished!"),i.blob=e,i.blob.forEach&&(i.blob=new Blob([],{type:"video/webm"})),t&&t(i.blob),p.frames=[]})})});function d(){p.frames=[],c=o=!1}function u(){if(c)return h=(new Date).getTime(),setTimeout(u,500);var e,t,i;"canvas"===s.nodeName.toLowerCase()?(e=(new Date).getTime()-h,h=(new Date).getTime(),p.frames.push({image:(i=(t=document.createElement("canvas")).getContext("2d"),t.width=s.width,t.height=s.height,i.drawImage(s,0,0),t),duration:e}),o&&setTimeout(u,a.frameInterval)):html2canvas(s,{grabMouse:void 0===a.showMousePointer||a.showMousePointer,onrendered:function(e){var t=(new Date).getTime()-h;if(!t)return setTimeout(u,a.frameInterval);h=(new Date).getTime(),p.frames.push({image:e.toDataURL("image/webp",1),duration:t}),o&&setTimeout(u,a.frameInterval)}})}this.pause=function(){c=!0,n instanceof E&&n.pause()},this.resume=function(){c=!1,n instanceof E?n.resume():o||this.record()},this.clearRecordedData=function(){o&&this.stop(d),d()},this.name="CanvasRecorder",this.toString=function(){return this.name};var h=(new Date).getTime(),p=new _.Video(100)}function h(e,b){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-n;return t?s?(n=(new Date).getTime(),setTimeout(i,100)):(n=(new Date).getTime(),a.paused&&a.play(),o.drawImage(a,0,0,E.width,E.height),v.frames.push({duration:t,image:E.toDataURL("image/webp")}),void(r||setTimeout(i,e,e))):setTimeout(i,e,e)}(b=b||{}).frameInterval||(b.frameInterval=10),b.disableLogs||console.log("Using frames-interval:",b.frameInterval);var r=!(this.record=function(){b.width||(b.width=320),b.height||(b.height=240),b.video||(b.video={width:b.width,height:b.height}),b.canvas||(b.canvas={width:b.width,height:b.height}),E.width=b.canvas.width||320,E.height=b.canvas.height||240,o=E.getContext("2d"),b.video&&b.video instanceof HTMLVideoElement?(a=b.video.cloneNode(),b.initCallback&&b.initCallback()):(a=document.createElement("video"),w(e,a),a.onloadedmetadata=function(){b.initCallback&&b.initCallback()},a.width=b.video.width,a.height=b.video.height),a.muted=!0,a.play(),n=(new Date).getTime(),v=new _.Video,b.disableLogs||(console.log("canvas resolutions",E.width,"*",E.height),console.log("video width/height",a.width||E.width,"*",a.height||E.height)),i(b.frameInterval)}),s=!(this.stop=function(A){A=A||function(){},r=!0;var y=this;setTimeout(function(){var i,e,t,r,s,a,n,d,u,h,o,p,f,g,m,l,c;i=v.frames,e=-1,r=t=null,s=function(e){v.frames=e,b.advertisement&&b.advertisement.length&&(v.frames=b.advertisement.concat(v.frames)),v.compile(function(e){y.blob=e,y.blob.forEach&&(y.blob=new Blob([],{type:"video/webm"})),A&&A(y.blob)})},(a=document.createElement("canvas")).width=E.width,a.height=E.height,d=a.getContext("2d"),u=[],h=-1===e,o=e&&0<e&&e<=i.length?e:i.length,p=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),f=t&&0<=t&&t<=1?t:0,g=r&&0<=r&&r<=1?r:0,m=!1,l=-1,c=(n={length:o,functionToLoop:function(e,t){function a(){!m&&l-n<=l*g||(h&&(m=!0),u.push(i[t])),e()}var n,o,l,c;m?a():((c=new Image).onload=function(){d.drawImage(c,0,0,E.width,E.height);var e=d.getImageData(0,0,E.width,E.height);n=0,o=e.data.length,l=e.data.length/4;for(var t=0;t<o;t+=4){var i=e.data[t],r=e.data[t+1],s=e.data[t+2];Math.sqrt(Math.pow(+i,2)+Math.pow(+r,2)+Math.pow(+s,2))<=p*f&&n++}a()},c.src=i[t].image)},callback:function(){(u=u.concat(i.slice(o))).length<=0&&u.push(i[i.length-1]),s(u)}}).length,function e(){++l!==c?setTimeout(function(){n.functionToLoop(e,l)},1):n.callback()}()},10)});function t(){v.frames=[],s=!(r=!0)}this.pause=function(){s=!0},this.resume=function(){s=!1,r&&this.record()},this.clearRecordedData=function(){r||this.stop(t),t()},this.name="WhammyRecorder",this.toString=function(){return this.name};var a,n,v,E=document.createElement("canvas"),o=E.getContext("2d")}void 0!==e?v.AudioContext=e:"undefined"!=typeof webkitAudioContext&&(v.AudioContext=webkitAudioContext),T.Storage=v,T.MediaStreamRecorder=E,T.StereoAudioRecorder=c,T.CanvasRecorder=r,T.WhammyRecorder=h;C.prototype.add=function(e,t){if("toDataURL"in(e="canvas"in e?e.canvas:e)&&(e=e.toDataURL("image/webp",this.quality)),!/^data:image\/webp;base64,/gi.test(e))throw"Input must be formatted properly as a base64 encoded DataURI of type image/webp";this.frames.push({image:e,duration:t||this.duration})},C.prototype.compile=function(t){i=R,i=S.createObjectURL(new Blob([i.toString(),"this.onmessage = function (eee) {"+i.name+"(eee.data);}"],{type:"application/javascript"})),e=new Worker(i),S.revokeObjectURL(i);var e,i=e;i.onmessage=function(e){e.data.error?console.error(e.data.error):t(e.data)},i.postMessage(this.frames)};var _={Video:C};function C(e){this.frames=[],this.duration=e||1,this.quality=.8}function R(e){function n(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i<e.length;i+=8)t.push(parseInt(e.substr(i,8),2));return new Uint8Array(t)}function c(e){for(var t=[],i=0;i<e.length;i++){var r=e[i].data,s=(r="string"==typeof(r="number"==typeof(r="object"==typeof r?c(r):r)?n(r.toString(2)):r)?new Uint8Array(r.split("").map(function(e){return e.charCodeAt(0)})):r).size||r.byteLength||r.length,a=Math.ceil(Math.ceil(Math.log(s)/Math.log(2))/8),s=s.toString(2),s=new Array(7*a+7+1-s.length).join("0")+s,a=new Array(a).join("0")+"1"+s;t.push(function(e){for(var t=[];0<e;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}(e[i].id)),t.push(n(a)),t.push(r)}return new Blob(t,{type:"video/webm"})}function o(e){for(var t=0,i={};t<e.length;){var r=e.substr(t,4),s=(s=t,parseInt(e.substr(s+4,4).split("").map(function(e){e=e.charCodeAt(0).toString(2);return new Array(8-e.length+1).join("0")+e}).join(""),2)),a=e.substr(t+4+4,s);t+=8+s,i[r]=i[r]||[],"RIFF"===r||"LIST"===r?i[r].push(o(a)):i[r].push(a)}return i}e=new function(e){var t=function(e){if(e[0]){for(var t=e[0].width,i=e[0].height,r=e[0].duration,s=1;s<e.length;s++)r+=e[s].duration;return{duration:r,width:t,height:i}}postMessage({error:"Something went wrong. Maybe WebP format is not supported in the current browser."})}(e);if(!t)return[];for(var i,r=[{id:440786851,data:[{data:1,id:17030},{data:1,id:17143},{data:4,id:17138},{data:8,id:17139},{data:"webm",id:17026},{data:2,id:17031},{data:2,id:17029}]},{id:408125543,data:[{id:357149030,data:[{data:1e6,id:2807729},{data:"whammy",id:19840},{data:"whammy",id:22337},{data:(i=t.duration,[].slice.call(new Uint8Array(new Float64Array([i]).buffer),0).map(function(e){return String.fromCharCode(e)}).reverse().join("")),id:17545}]},{id:374648427,data:[{id:174,data:[{data:1,id:215},{data:1,id:29637},{data:0,id:156},{data:"und",id:2274716},{data:"V_VP8",id:134},{data:"VP8",id:2459272},{data:1,id:131},{id:224,data:[{data:t.width,id:176},{data:t.height,id:186}]}]}]}]}],s=0,a=0;s<e.length;){for(var n=[],o=0;n.push(e[s]),o+=e[s].duration,++s<e.length&&o<3e4;);var l={id:524531317,data:function(e,i,t){return[{data:e,id:231}].concat(t.map(function(e){var t=function(e){var t=0;if(e.keyframe&&(t|=128),e.invisible&&(t|=8),e.lacing&&(t|=e.lacing<<1),e.discardable&&(t|=1),127<e.trackNum)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map(function(e){return String.fromCharCode(e)}).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(i)});return i+=e.duration,{data:t,id:163}}))}(a,0,n)};r[1].data.push(l),a+=o}return c(r)}(e.map(function(e){var t=function(e){for(var t=e.RIFF[0].WEBP[0],i=t.indexOf("*"),r=0,s=[];r<4;r++)s[r]=t.charCodeAt(i+3+r);return{width:16383&(s[1]<<8|s[0]),height:16383&(s[3]<<8|s[2]),data:t,riff:e}}(o(atob(e.image.slice(23))));return t.duration=e.duration,t}));postMessage(e)}T.Whammy=_;var D={init:function(){var i,e,t,r=this;function s(e){e.createObjectStore(r.dataStoreName)}function a(){var e=i.transaction([r.dataStoreName],"readwrite");function t(t){e.objectStore(r.dataStoreName).get(t).onsuccess=function(e){r.callback&&r.callback(e.target.result,t)}}r.videoBlob&&e.objectStore(r.dataStoreName).put(r.videoBlob,"videoBlob"),r.gifBlob&&e.objectStore(r.dataStoreName).put(r.gifBlob,"gifBlob"),r.audioBlob&&e.objectStore(r.dataStoreName).put(r.audioBlob,"audioBlob"),t("audioBlob"),t("videoBlob"),t("gifBlob")}"undefined"!=typeof indexedDB&&void 0!==indexedDB.open?(e=this.dbName||location.href.replace(/\/|:|#|%|\.|\[|\]/g,""),(t=indexedDB.open(e,1)).onerror=r.onError,t.onsuccess=function(){(i=t.result).onerror=r.onError,i.setVersion&&1!==i.version?i.setVersion(1).onsuccess=function(){s(i),a()}:a()},t.onupgradeneeded=function(e){s(e.target.result)}):console.error("IndexedDB API are not available in this browser.")},Fetch:function(e){return this.callback=e,this.init(),this},Store:function(e){return this.audioBlob=e.audioBlob,this.videoBlob=e.videoBlob,this.gifBlob=e.gifBlob,this.init(),this},onError:function(e){console.error(JSON.stringify(e,null,"\t"))},dataStoreName:"recordRTC",dbName:null};function L(e,i){"undefined"==typeof GIFEncoder&&((t=document.createElement("script")).src="https://www.webrtc-experiment.com/gif-recorder.js",(document.body||document.documentElement).appendChild(t)),i=i||{};var t,r,s=e instanceof CanvasRenderingContext2D||e instanceof HTMLCanvasElement,a=(this.record=function(){"undefined"!=typeof GIFEncoder&&l?(s||(i.width||(i.width=r.offsetWidth||320),i.height||(i.height=r.offsetHeight||240),i.video||(i.video={width:i.width,height:i.height}),i.canvas||(i.canvas={width:i.width,height:i.height}),n.width=i.canvas.width||320,n.height=i.canvas.height||240,r.width=i.video.width||320,r.height=i.video.height||240),(d=new GIFEncoder).setRepeat(0),d.setDelay(i.frameRate||200),d.setQuality(i.quality||10),d.start(),"function"==typeof i.onGifRecordingStarted&&i.onGifRecordingStarted(),u=p(function e(t){if(!0!==h.clearedRecordedData){if(a)return setTimeout(function(){e(t)},100);u=p(e),t-c<90||(!s&&r.paused&&r.play(),s||o.drawImage(r,0,0,n.width,n.height),i.onGifPreview&&i.onGifPreview(n.toDataURL("image/png")),d.addFrame(o),c=t)}}),i.initCallback&&i.initCallback()):setTimeout(h.record,1e3)},!(this.stop=function(e){e=e||function(){},u&&m(u),this.blob=new Blob([new Uint8Array(d.stream().bin)],{type:"image/gif"}),e(this.blob),d.stream().bin=[]})),n=(this.pause=function(){a=!0},this.resume=function(){a=!1},this.clearRecordedData=function(){h.clearedRecordedData=!0,d&&(d.stream().bin=[])},this.name="GifRecorder",this.toString=function(){return this.name},document.createElement("canvas")),o=n.getContext("2d"),l=(s&&(e instanceof CanvasRenderingContext2D?n=(o=e).canvas:e instanceof HTMLCanvasElement&&(o=e.getContext("2d"),n=e)),!0);s||((r=document.createElement("video")).muted=!0,r.autoplay=!0,r.playsInline=!0,l=!1,r.onloadedmetadata=function(){l=!0},w(e,r),r.play());var c,d,u=null,h=this}function x(r,s){s=s||"multi-streams-mixer";var a=[],n=!1,o=document.createElement("canvas"),l=o.getContext("2d"),c=(o.style.opacity=0,o.style.position="absolute",o.style.zIndex=-1,o.style.top="-1000em",o.style.left="-1000em",o.className=s,(document.body||document.documentElement).appendChild(o),this.disableLogs=!1,this.frameInterval=10,this.width=360,this.height=240,this.useGainNode=!0,this),e=window.AudioContext;void 0===e&&("undefined"!=typeof webkitAudioContext&&(e=webkitAudioContext),"undefined"!=typeof mozAudioContext)&&(e=mozAudioContext);window.URL,"undefined"!=typeof navigator&&void 0===navigator.getUserMedia&&(void 0!==navigator.webkitGetUserMedia&&(navigator.getUserMedia=navigator.webkitGetUserMedia),void 0!==navigator.mozGetUserMedia)&&(navigator.getUserMedia=navigator.mozGetUserMedia);var d=window.MediaStream,u=(void 0!==(d=void 0===d&&"undefined"!=typeof webkitMediaStream?webkitMediaStream:d)&&void 0===d.prototype.stop&&(d.prototype.stop=function(){this.getTracks().forEach(function(e){e.stop()})}),{});function h(){var e,t,i;n||(e=a.length,t=!1,i=[],a.forEach(function(e){e.stream||(e.stream={}),e.stream.fullcanvas?t=e:i.push(e)}),t?(o.width=t.stream.width,o.height=t.stream.height):i.length?(o.width=1<e?2*i[0].width:i[0].width,o.height=i[0].height*(9!==e&&10!==e?7!==e&&8!==e?5!==e&&6!==e?3!==e&&4!==e?1:2:3:4:5)):(o.width=c.width||360,o.height=c.height||240),t&&t instanceof HTMLVideoElement&&p(t),i.forEach(function(e,t){p(e,t)}),setTimeout(h,c.frameInterval))}function p(e,t){var i,r,s,a;n||(r=i=0,s=e.width,a=e.height,1===t&&(i=e.width),2===t&&(r=e.height),3===t&&(i=e.width,r=e.height),4===t&&(r=2*e.height),5===t&&(i=e.width,r=2*e.height),6===t&&(r=3*e.height),7===t&&(i=e.width,r=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(r=e.stream.top),void 0!==e.stream.width&&(s=e.stream.width),void 0!==e.stream.height&&(a=e.stream.height),l.drawImage(e,i,r,s,a),"function"==typeof e.stream.onRender&&e.stream.onRender(l,i,r,s,a,t))}function f(e){var t,i,r=document.createElement("video");return t=e,!("srcObject"in(i=r))&&"mozSrcObject"in i?i.mozSrcObject=t:i.srcObject=t,r.className=s,r.muted=!0,r.volume=0,r.width=e.width||c.width||360,r.height=e.height||c.height||240,r.play(),r}function g(e){a=[],(e=e||r).forEach(function(e){var t;e.getTracks().filter(function(e){return"video"===e.kind}).length&&((t=f(e)).stream=e,a.push(t))})}void 0!==e?u.AudioContext=e:"undefined"!=typeof webkitAudioContext&&(u.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){h()},this.appendStreams=function(e){if(!e)throw"First parameter is required.";(e=e instanceof Array?e:[e]).forEach(function(e){var t,i=new d;e.getTracks().filter(function(e){return"video"===e.kind}).length&&((t=f(e)).stream=e,a.push(t),i.addTrack(e.getTracks().filter(function(e){return"video"===e.kind})[0])),e.getTracks().filter(function(e){return"audio"===e.kind}).length&&(t=c.audioContext.createMediaStreamSource(e),c.audioDestination=c.audioContext.createMediaStreamDestination(),t.connect(c.audioDestination),i.addTrack(c.audioDestination.stream.getTracks().filter(function(e){return"audio"===e.kind})[0])),r.push(i)})},this.releaseStreams=function(){a=[],n=!0,c.gainNode&&(c.gainNode.disconnect(),c.gainNode=null),c.audioSources.length&&(c.audioSources.forEach(function(e){e.disconnect()}),c.audioSources=[]),c.audioDestination&&(c.audioDestination.disconnect(),c.audioDestination=null),c.audioContext&&c.audioContext.close(),c.audioContext=null,l.clearRect(0,0,o.width,o.height),o.stream&&(o.stream.stop(),o.stream=null)},this.resetVideoStreams=function(e){g(e=!e||e instanceof Array?e:[e])},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){n=!1;g(),"captureStream"in o?e=o.captureStream():"mozCaptureStream"in o?e=o.mozCaptureStream():c.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features"),t=new d,e.getTracks().filter(function(e){return"video"===e.kind}).forEach(function(e){t.addTrack(e)});var t,i=o.stream=t,e=function(){u.AudioContextConstructor||(u.AudioContextConstructor=new u.AudioContext),c.audioContext=u.AudioContextConstructor,c.audioSources=[],!0===c.useGainNode&&(c.gainNode=c.audioContext.createGain(),c.gainNode.connect(c.audioContext.destination),c.gainNode.gain.value=0);var t=0;if(r.forEach(function(e){e.getTracks().filter(function(e){return"audio"===e.kind}).length&&(t++,e=c.audioContext.createMediaStreamSource(e),!0===c.useGainNode&&e.connect(c.gainNode),c.audioSources.push(e))}),t)return c.audioDestination=c.audioContext.createMediaStreamDestination(),c.audioSources.forEach(function(e){e.connect(c.audioDestination)}),c.audioDestination.stream}();return e&&e.getTracks().filter(function(e){return"audio"===e.kind}).forEach(function(e){i.addTrack(e)}),r.forEach(function(e){e.fullcanvas}),i}}function I(i,r){i=i||[];var s,a,n=this;(r=r||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(r.frameInterval=10),r.video||(r.video={}),r.video.width||(r.video.width=360),r.video.height||(r.video.height=240),this.record=function(){var t;s=new x(i,r.elementClass||"multi-streams-mixer"),t=[],i.forEach(function(e){k(e,"video").forEach(function(e){t.push(e)})}),t.length&&(s.frameInterval=r.frameInterval||10,s.width=r.video.width||360,s.height=r.video.height||240,s.startDrawingFrames()),r.previewStream&&"function"==typeof r.previewStream&&r.previewStream(s.getMixedStream()),(a=new E(s.getMixedStream(),r)).record()},this.stop=function(t){a&&a.stop(function(e){n.blob=e,t(e),n.clearRecordedData()})},this.pause=function(){a&&a.pause()},this.resume=function(){a&&a.resume()},this.clearRecordedData=function(){a&&(a.clearRecordedData(),a=null),s&&(s.releaseStreams(),s=null)},this.addStreams=function(e){if(!e)throw"First parameter is required.";e instanceof Array||(e=[e]),i.concat(e),a&&s&&(s.appendStreams(e),r.previewStream)&&"function"==typeof r.previewStream&&r.previewStream(s.getMixedStream())},this.resetVideoStreams=function(e){s&&(!e||e instanceof Array||(e=[e]),s.resetVideoStreams(e))},this.getMixer=function(){return s},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function P(i,o){var l,r,s;function a(t,e){if(!o.workerPath&&!e)return l=!1,fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then(function(e){e.arrayBuffer().then(function(e){a(t,e)})});!o.workerPath&&e instanceof ArrayBuffer&&(e=new Blob([e],{type:"text/javascript"}),o.workerPath=S.createObjectURL(e)),o.workerPath||console.error("workerPath parameter is missing."),(r=new Worker(o.workerPath)).postMessage(o.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),r.addEventListener("message",function(e){"READY"===e.data?(r.postMessage({width:o.width,height:o.height,bitrate:o.bitrate||1200,timebaseDen:o.frameRate||30,realtime:o.realtime}),new ReadableStream({start:function(r){var s=document.createElement("canvas"),a=document.createElement("video"),n=!0;a.srcObject=i,a.muted=!0,a.height=o.height,a.width=o.width,a.volume=0,a.onplaying=function(){s.width=o.width,s.height=o.height;var e=s.getContext("2d"),t=1e3/o.frameRate,i=setInterval(function(){if(l&&(clearInterval(i),r.close()),n&&(n=!1,o.onVideoProcessStarted)&&o.onVideoProcessStarted(),e.drawImage(a,0,0),"closed"!==r._controlledReadableStream.state)try{r.enqueue(e.getImageData(0,0,o.width,o.height))}catch(e){}},t)},a.play()}}).pipeTo(new WritableStream({write:function(e){l?console.error("Got image, but recorder is finished!"):r.postMessage(e.data.buffer,[e.data.buffer])}}))):!e.data||s||n.push(e.data)})}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(o=o||{}).width=o.width||640,o.height=o.height||480,o.frameRate=o.frameRate||30,o.bitrate=o.bitrate||1200,o.realtime=o.realtime||!0,this.record=function(){s=!(n=[]),this.blob=null,a(i),"function"==typeof o.initCallback&&o.initCallback()},this.pause=function(){s=!0},this.resume=function(){s=!1};var n=[];this.stop=function(e){l=!0;var t,i=this;t=function(){i.blob=new Blob(n,{type:"video/webm"}),e(i.blob)},r?(r.addEventListener("message",function(e){null===e.data&&(r.terminate(),r=null,t())}),r.postMessage(null)):t()},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){s=!(n=[]),this.blob=null},this.blob=null}T.DiskStorage=D,T.GifRecorder=L,T.MultiStreamRecorder=I,T.RecordRTCPromisesHandler=function(e,t){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var r=this;r.recordRTC=new T(e,t),this.startRecording=function(){return new Promise(function(e,t){try{r.recordRTC.startRecording(),e()}catch(e){t(e)}})},this.stopRecording=function(){return new Promise(function(t,i){try{r.recordRTC.stopRecording(function(e){r.blob=r.recordRTC.getBlob(),r.blob&&r.blob.size?t(e):i("Empty blob.",r.blob)})}catch(t){i(t)}})},this.pauseRecording=function(){return new Promise(function(e,t){try{r.recordRTC.pauseRecording(),e()}catch(e){t(e)}})},this.resumeRecording=function(){return new Promise(function(e,t){try{r.recordRTC.resumeRecording(),e()}catch(e){t(e)}})},this.getDataURL=function(e){return new Promise(function(t,e){try{r.recordRTC.getDataURL(function(e){t(e)})}catch(t){e(t)}})},this.getBlob=function(){return new Promise(function(e,t){try{e(r.recordRTC.getBlob())}catch(e){t(e)}})},this.getInternalRecorder=function(){return new Promise(function(e,t){try{e(r.recordRTC.getInternalRecorder())}catch(e){t(e)}})},this.reset=function(){return new Promise(function(e,t){try{e(r.recordRTC.reset())}catch(e){t(e)}})},this.destroy=function(){return new Promise(function(e,t){try{e(r.recordRTC.destroy())}catch(e){t(e)}})},this.getState=function(){return new Promise(function(e,t){try{e(r.recordRTC.getState())}catch(e){t(e)}})},this.blob=null,this.version="5.6.2"},T.WebAssemblyRecorder=P});class Di{constructor(e){this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}destroy(){this._buffer=null}_fillCurrentWord(){var e,t=this._total_bytes-this._buffer_index;t<=0?console.error("ExpGolomb: _fillCurrentWord() but no bytes available",this._total_bytes,this._buffer_index):(t=Math.min(4,t),(e=new Uint8Array(4)).set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(e.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t)}readBits(e){var t,i;return 32<e&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left?(t=this._current_word>>>32-e,this._current_word<<=e,this._current_word_bits_left-=e,t):(t=this._current_word_bits_left?this._current_word:0,t>>>=32-this._current_word_bits_left,e=e-this._current_word_bits_left,this._fillCurrentWord(),e=Math.min(e,this._current_word_bits_left),i=this._current_word>>>32-e,this._current_word<<=e,this._current_word_bits_left-=e,t<<e|i)}readBool(){return 1===this.readBits(1)}readByte(){return this.readBits(8)}_skipLeadingZero(){let e;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){var e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}class P{static _ebsp2rbsp(e){let t=e,i=t.byteLength,r=new Uint8Array(i),s=0;for(let e=0;e<i;e++)2<=e&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(r[s]=t[e],s++);return new Uint8Array(r.buffer,0,s)}static parseSPS(e){let t=P._ebsp2rbsp(e),i=new Di(t);i.readByte();var e=i.readByte(),r=(i.readByte(),i.readByte());i.readUEG();let s=P.getProfileString(e),a=P.getLevelString(r),n=1,o=420,l=8;if((100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e||138===e||144===e)&&(3===(n=i.readUEG())&&i.readBits(1),n<=3&&(o=[0,420,422,444][n]),l=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){var c=3!==n?8:12;for(let e=0;e<c;e++)i.readBool()&&(e<6?P._skipScalingList(i,16):P._skipScalingList(i,64))}i.readUEG();r=i.readUEG();if(0===r)i.readUEG();else if(1===r){i.readBits(1),i.readSEG(),i.readSEG();var d=i.readUEG();for(let e=0;e<d;e++)i.readSEG()}var e=i.readUEG(),r=(i.readBits(1),i.readUEG()),u=i.readUEG(),h=i.readBits(1);0===h&&i.readBits(1),i.readBits(1);let p=0,f=0,g=0,m=0,A=(i.readBool()&&(p=i.readUEG(),f=i.readUEG(),g=i.readUEG(),m=i.readUEG()),1),y=1,b=0,v=!0,E=0,w=0,T=(i.readBool()&&(i.readBool()&&(0<(C=i.readByte())&&C<16?(A=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][C-1],y=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][C-1]):255===C&&(A=i.readByte()<<8|i.readByte(),y=i.readByte()<<8|i.readByte())),i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool())&&i.readBits(24),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool())&&(C=i.readBits(32),_=i.readBits(32),v=i.readBool(),E=_,w=2*C,b=E/w),1),S=(1===A&&1===y||(T=A/y),0),k=0;k=0===n?(S=1,2-h):(S=3===n?1:2,(1===n?2:1)*(2-h));var _=16*(r+1),C=16*(u+1)*(2-h),r=(_-=(p+f)*S,C-=(g+m)*k,Math.ceil(_*T));return i.destroy(),i=null,{profile_string:s,level_string:a,bit_depth:l,ref_frames:e,chroma_format:o,chroma_format_string:P.getChromaFormatString(o),frame_rate:{fixed:v,fps:b,fps_den:w,fps_num:E},sar_ratio:{width:A,height:y},codec_size:{width:_,height:C},present_size:{width:r,height:C}}}static parseSPS$2(e){let i=e.subarray(1,4),r="avc1.";for(let t=0;t<3;t++){let e=i[t].toString(16);e.length<2&&(e="0"+e),r+=e}let t=P._ebsp2rbsp(e),s=new Di(t);s.readByte();var e=s.readByte(),a=(s.readByte(),s.readByte());s.readUEG();let n=P.getProfileString(e),o=P.getLevelString(a),l=1,c=420,d=8,u=8;if((100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e||138===e||144===e)&&(3===(l=s.readUEG())&&s.readBits(1),l<=3&&(c=[0,420,422,444][l]),d=s.readUEG()+8,u=s.readUEG()+8,s.readBits(1),s.readBool())){var h=3!==l?8:12;for(let e=0;e<h;e++)s.readBool()&&(e<6?P._skipScalingList(s,16):P._skipScalingList(s,64))}s.readUEG();var p=s.readUEG();if(0===p)s.readUEG();else if(1===p){s.readBits(1),s.readSEG(),s.readSEG();var f=s.readUEG();for(let e=0;e<f;e++)s.readSEG()}var p=s.readUEG(),g=(s.readBits(1),s.readUEG()),m=s.readUEG(),A=s.readBits(1);0===A&&s.readBits(1),s.readBits(1);let y=0,b=0,v=0,E=0,w=(s.readBool()&&(y=s.readUEG(),b=s.readUEG(),v=s.readUEG(),E=s.readUEG()),1),T=1,S=0,k=!0,_=0,C=0,R=(s.readBool()&&(s.readBool()&&(0<(I=s.readByte())&&I<16?(w=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][I-1],T=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][I-1]):255===I&&(w=s.readByte()<<8|s.readByte(),T=s.readByte()<<8|s.readByte())),s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool())&&s.readBits(24),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool())&&(I=s.readBits(32),x=s.readBits(32),k=s.readBool(),_=x,C=2*I,S=_/C),1),D=(1===w&&1===T||(R=w/T),0),L=0;L=0===l?(D=1,2-A):(D=3===l?1:2,(1===l?2:1)*(2-A));var x=16*(g+1),I=16*(m+1)*(2-A),g=(x-=(y+b)*D,I-=(v+E)*L,Math.ceil(x*R));return s.destroy(),s=null,{codec_mimetype:r,profile_idc:e,level_idc:a,profile_string:n,level_string:o,chroma_format_idc:l,bit_depth:d,bit_depth_luma:d,bit_depth_chroma:u,ref_frames:p,chroma_format:c,chroma_format_string:P.getChromaFormatString(c),frame_rate:{fixed:k,fps:S,fps_den:C,fps_num:_},sar_ratio:{width:w,height:T},codec_size:{width:x,height:I},present_size:{width:g,height:I}}}static _skipScalingList(t,i){let r=8,s=8,a;for(let e=0;e<i;e++)0!==s&&(a=t.readSEG(),s=(r+a+256)%256),r=0===s?r:s}static getProfileString(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}}static getLevelString(e){return(e/10).toFixed(1)}static getChromaFormatString(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}class Li{constructor(e){this.buffer=e,this.buflen=e.length,this.bufpos=0,this.bufoff=0,this.iserro=!1}read(e){let t=0,i;for(;e;){if(e<0||this.bufpos>=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=8<this.bufoff+e?8-this.bufoff:e,t=(t<<=i)+(this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i),this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){var t=this.bufpos,i=this.bufoff,e=this.read(e);return this.bufpos=t,this.bufoff=i,e}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<<e)+this.read(e)-1}}function xi(t){const s={},i=new DataView(t.buffer);let e=i.getUint8(0),r=i.getUint8(1);if(i.getUint8(2),i.getUint8(3),1!==e||0===r)return{};var a=1+(3&i.getUint8(4));if(3!=a&&4!=a)return{};var n=31&i.getUint8(5);if(0==n)return{};let o=6;for(let e=0;e<n;e++){var l=i.getUint16(o,!1);if(o+=2,0!==l){var c=new Uint8Array(t.buffer,o,l),l=(o+=l,P.parseSPS(c));if(0===e){s.sps=c,s.timescale=1e3,s.codecWidth=l.codec_size.width,s.codecHeight=l.codec_size.height,s.presentWidth=l.present_size.width,s.presentHeight=l.present_size.height,s.profile=l.profile_string,s.level=l.level_string,s.bitDepth=l.bit_depth,s.chromaFormat=l.chroma_format,s.sarRatio=l.sar_ratio,s.frameRate=l.frame_rate,!1!==l.frame_rate.fixed&&0!==l.frame_rate.fps_num&&0!==l.frame_rate.fps_den||(s.frameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3});var l=s.frameRate.fps_den,d=s.frameRate.fps_num;s.refSampleDuration=s.timescale*(l/d);let i=c.subarray(1,4),r="avc1.";for(let t=0;t<3;t++){let e=i[t].toString(16);e.length<2&&(e="0"+e),r+=e}s.codec=r}}}var u=i.getUint8(o);if(0===u)return{};o++;for(let e=0;e<u;e++){var h,p=i.getUint16(o,!1);o+=2,0!==p&&(h=new Uint8Array(t.buffer,o,p),o+=p,s.pps=h)}if(s.videoType="avc",s.sps){const t=s.sps.byteLength,i=new Uint8Array([t>>>24&255,t>>>16&255,t>>>8&255,255&t]),e=new Uint8Array(t+4);e.set(i,0),e.set(s.sps,4),s.sps=e}if(s.pps){const t=s.pps.byteLength,i=new Uint8Array([t>>>24&255,t>>>16&255,t>>>8&255,255&t]),e=new Uint8Array(t+4);e.set(i,0),e.set(s.pps,4),s.pps=e}return s}function Ii(e){var t=e.byteLength,i=new Uint8Array(4),t=(i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,new Uint8Array(t+4));return t.set(i,0),t.set(e,4),t}function Pi(e){return 31&e[0]}function Bi(e){return e===me}function Mi(e){return 7!==e&&8!==e&&!Bi(e)}const Oi=e=>{let t=e,i=t.byteLength,r=new Uint8Array(i),s=0;for(let e=0;e<i;e++)2<=e&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(r[s]=t[e],s++);return new Uint8Array(r.buffer,0,s)};function Fi(e){var r={width:0,height:0,profile:0,level:0};e=e.slice(5);do{var s={};if(e.length<23)break;if(s.configurationVersion=e[0],1!=s.configurationVersion)break;s.general_profile_space=e[1]>>6&3,s.general_tier_flag=e[1]>>5&1,s.general_profile_idc=31&e[1],s.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],s.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],s.general_constraint_indicator_flags=s.general_constraint_indicator_flags<<16|e[10]<<8|e[11],s.general_level_idc=e[12],s.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],s.parallelismType=3&e[15],s.chromaFormat=3&e[16],s.bitDepthLumaMinus8=7&e[17],s.bitDepthChromaMinus8=7&e[18],s.avgFrameRate=e[19]<<8|e[20],s.constantFrameRate=e[21]>>6&3,s.numTemporalLayers=e[21]>>3&7,s.temporalIdNested=e[21]>>2&1,s.lengthSizeMinusOne=3&e[21];let t=e[22],i=e.slice(23);for(let e=0;e<t&&!(i.length<3);e++){var a=63&i[0],n=i[1]<<8|i[2];i=i.slice(3);for(let e=0;e<n&&!(i.length<2);e++){var o,l=i[0]<<8|i[1];if(i.length<2+l)break;i=i.slice(2),33==a&&((o=new Uint8Array(l)).set(i.slice(0,l),0),s.psps=function(e){var t={},i=e.length,r=[],s=new Li(e);s.read(1),s.read(6),s.read(6),s.read(3);for(let e=2;e<i;e++)e+2<i&&3==s.look(24)?(r.push(s.read(8)),r.push(s.read(8)),e+=2,s.read(8)):r.push(s.read(8));e=new Uint8Array(r),e=new Li(e);{var a,n;t.sps_video_parameter_set_id=e.read(4),t.sps_max_sub_layers_minus1=e.read(3),t.sps_temporal_id_nesting_flag=e.read(1),t.profile_tier_level=function(t,i){var r={};r.profile_space=t.read(2),r.tier_flag=t.read(1),r.profile_idc=t.read(5),r.profile_compatibility_flags=t.read(32),r.general_progressive_source_flag=t.read(1),r.general_interlaced_source_flag=t.read(1),r.general_non_packed_constraint_flag=t.read(1),r.general_frame_only_constraint_flag=t.read(1),t.read(32),t.read(12),r.level_idc=t.read(8),r.sub_layer_profile_present_flag=[],r.sub_layer_level_present_flag=[];for(let e=0;e<i;e++)r.sub_layer_profile_present_flag[e]=t.read(1),r.sub_layer_level_present_flag[e]=t.read(1);if(0<i)for(let e=i;e<8;e++)t.read(2);r.sub_layer_profile_space=[],r.sub_layer_tier_flag=[],r.sub_layer_profile_idc=[],r.sub_layer_profile_compatibility_flag=[],r.sub_layer_progressive_source_flag=[],r.sub_layer_interlaced_source_flag=[],r.sub_layer_non_packed_constraint_flag=[],r.sub_layer_frame_only_constraint_flag=[],r.sub_layer_level_idc=[];for(let e=0;e<i;e++)r.sub_layer_profile_present_flag[e]&&(r.sub_layer_profile_space[e]=t.read(2),r.sub_layer_tier_flag[e]=t.read(1),r.sub_layer_profile_idc[e]=t.read(5),r.sub_layer_profile_compatibility_flag[e]=t.read(32),r.sub_layer_progressive_source_flag[e]=t.read(1),r.sub_layer_interlaced_source_flag[e]=t.read(1),r.sub_layer_non_packed_constraint_flag[e]=t.read(1),r.sub_layer_frame_only_constraint_flag[e]=t.read(1),t.read(32),t.read(12)),r.sub_layer_level_present_flag[e]?r.sub_layer_level_idc[e]=t.read(8):r.sub_layer_level_idc[e]=1;return r}(e,t.sps_max_sub_layers_minus1),t.sps_seq_parameter_set_id=e.read_golomb(),t.chroma_format_idc=e.read_golomb(),t.separate_colour_plane_flag=3==t.chroma_format_idc?e.read(1):0,t.pic_width_in_luma_samples=e.read_golomb(),t.pic_height_in_luma_samples=e.read_golomb(),t.conformance_window_flag=e.read(1),t.conformance_window_flag?(a=1+(t.chroma_format_idc<2),n=1+(t.chroma_format_idc<3),t.conf_win_left_offset=e.read_golomb()*n,t.conf_win_right_offset=e.read_golomb()*n,t.conf_win_top_offset=e.read_golomb()*a,t.conf_win_bottom_offset=e.read_golomb()*a):(t.conf_win_left_offset=0,t.conf_win_right_offset=0,t.conf_win_top_offset=0,t.conf_win_bottom_offset=0)}return t}(o),r.profile=s.general_profile_idc,r.level=s.general_level_idc/30,r.width=s.psps.pic_width_in_luma_samples-(s.psps.conf_win_left_offset+s.psps.conf_win_right_offset),r.height=s.psps.pic_height_in_luma_samples-(s.psps.conf_win_top_offset+s.psps.conf_win_bottom_offset)),i=i.slice(l)}}}while(0);return r.codecWidth=r.width||1920,r.codecHeight=r.height||1080,r.presentHeight=r.codecHeight,r.presentWidth=r.codecWidth,r.timescale=1e3,r.refSampleDuration=1e3/23976*1e3,r.videoType="hevc",r}function ji(e){return(126&e[0])>>1}class Ui extends e{constructor(e){super(),this.player=e,this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.recordingInterval=null,this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.mdatBytesLength=0,this.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""}}destroy(){this._reset()}get isH264(){return 7===this.codecId}get isH265(){return 12===this.codecId}setFileName(e){this.fileName=e}get isRecording(){return this._isRecording}get recording(){return this._isRecording}get recordTime(){return this._recordingTimestamp}startRecord(){}handleAddNaluTrack(e,t,i,r){}handleAddTrack(e){}stopRecordAndSave(){}startRecordingInterval(){}stopRecordingInterval(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}getToTalByteLength(){}_reset(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.mdatBytesLength=0}initMetaData(e,t){let i;var r=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=r,7===t)i=xi(r);else if(12===t){i=function(e){var t=23,i=e[23];if(32!=(63&i))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is "+i),{};t+=2,++t;var i=e[27]|e[26]<<8,r=(t+=2,e.slice(28,28+i)),s=e[t+=i];if(33!=(63&s))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and sps tag is "+s),{};t+=2;var s=e[1+ ++t]|e[t]<<8,a=e.slice(t+=2,t+s),n=e[t+=s];if(34!=(63&n))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and pps tag is "+n),{};t+=2;var n=e[1+ ++t]|e[t]<<8,e=e.slice(t+=2,t+n),t=new Uint8Array([s>>>24&255,s>>>16&255,s>>>8&255,255&s]),o=new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n]),l=new Uint8Array([i>>>24&255,i>>>16&255,i>>>8&255,255&i]),s=new Uint8Array(4+s),t=(s.set(t,0),s.set(a,4),new Uint8Array(4+n)),a=(t.set(o,0),t.set(e,4),new Uint8Array(4+i));return a.set(l,0),a.set(r,4),{sps:s,pps:t,vps:a}}(r);const t=Fi(e);i=Object.assign(i,t)}i&&(i.vps&&(this.vps=i.vps),i.pps&&(this.pps=i.pps),i.sps&&(this.sps=i.sps),i.presentWidth&&(this.metaInfo.presentWidth=i.presentWidth),i.presentHeight&&(this.metaInfo.presentHeight=i.presentHeight),i.codecWidth&&(this.metaInfo.codecWidth=i.codecWidth),i.codecHeight&&(this.metaInfo.codecHeight=i.codecHeight),i.timescale&&(this.metaInfo.timescale=i.timescale),i.refSampleDuration&&(this.metaInfo.refSampleDuration=i.refSampleDuration),i.videoType)&&(this.metaInfo.videoType=i.videoType)}}class Ni extends Ui{constructor(e){super(e),this.totalByteLength=0,this._startRecordingTimestamp=null,e.debug.log("RecorderRTC","init")}_reset(){super._reset(),this.totalByteLength=0,this._startRecordingTimestamp=null,this.recorder&&(this.recorder.destroy(),this.recorder=null)}destroy(){super.destroy(),this._reset(),this.player.debug.log("RecorderRTC","destroy")}getSeekableBlob(t){const s=new EBML.Reader,a=new EBML.Decoder,n=EBML.tools,i=new FileReader;return new Promise((r,e)=>{i.onload=function(e){a.decode(this.result).forEach(function(e){s.read(e)}),s.stop();var t=n.makeMetadataSeekable(s.metadatas,s.duration,s.cues),i=this.result.slice(s.metadataSize),t=new Blob([t,i],{type:"video/webm"});r(t)},i.readAsArrayBuffer(t)})}startRecord(){const t=this.player.debug,i={type:"video",mimeType:"video/webm;codecs=h264",timeSlice:1e3,onTimeStamp:e=>{t.log("RecorderRTC","record timestamp :"+e),null===this._startRecordingTimestamp&&(this._startRecordingTimestamp=e),this._recordingTimestamp=(e-this._startRecordingTimestamp)/1e3},ondataavailable:e=>{this.totalByteLength+=e.size,t.log("RecorderRTC","ondataavailable",e.size)},disableLogs:!this.player._opt.debug};try{let e=null;if(this.player.getRenderType()===W?e=this.player.video.$videoElement.captureStream(25):this.player.video.mediaStream?e=this.player.video.mediaStream:this.player._opt.isHls||this.player._opt.useMSE||this.player._opt.useWCS?e=this.player.video.$videoElement.captureStream(25):this.player._opt.isWebrtc&&(e=this.player.webrtc.videoStream),e){if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const t=this.player.audio.mediaStreamAudioDestinationNode.stream;if(0<t.getAudioTracks().length){const i=t.getAudioTracks()[0];i&&i.enabled&&e.addTrack(i)}}this.recorder=Ri(e,i)}else t.error("RecorderRTC","startRecord error and can not create stream"),this.emit(E.recordCreateError)}catch(i){t.error("RecorderRTC","startRecord error",i),this.emit(E.recordCreateError)}this.recorder&&(this._isRecording=!0,this.player.emit(E.recording,!0),this.recorder.startRecording(),t.log("RecorderRTC","start recording"),this.player.emit(E.recordStart),this.startRecordingInterval())}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval(()=>{this.player.emit(E.recordingTimestamp,this._recordingTimestamp)},1e3)}stopRecordAndSave(){let i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:de,r=1<arguments.length?arguments[1]:void 0;return new Promise((t,e)=>{this.recorder&&this._isRecording||e("recorder is not ready"),r&&this.setFileName(r),this.recorder.stopRecording(()=>{this.player.debug.log("RecorderRTC","stop recording");var e=(this.fileName||A())+"."+N;if(this.recorder.getBlob(),"blob"===i){const i=this.recorder.getBlob();t(i),this.player.emit(E.recordBlob,i)}else t(),this.recorder.save(e);this.player.emit(E.recordEnd),this._reset(),this.player.emit(E.recording,!1)})})}getToTalByteLength(){return this.totalByteLength}getTotalDuration(){return this.recordTime}getType(){return N}initMetaData(){}}class u{static init(){for(var e in u.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],free:[],edts:[],elst:[],stss:[]},u.types)u.types.hasOwnProperty(e)&&(u.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var t=u.constants={};t.FTYP=new Uint8Array([105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,97,118,99,49,109,112,52,49,0,0,0,0]),t.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),t.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSC=t.STCO=t.STTS,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),t.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),t.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,r=Array.prototype.slice.call(arguments,1),s=r.length;for(let e=0;e<s;e++)t+=r[e].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let a=8;for(let e=0;e<s;e++)i.set(r[e],a),a+=r[e].byteLength;return i}static generateInitSegment(e,t,i){let r=u.box(u.types.ftyp,u.constants.FTYP),s=u.box(u.types.free),a=8,n=new Uint8Array;i+a>=Math.pow(2,32)-1?(a=16,(n=new Uint8Array(i+a)).set(new Uint8Array([0,0,0,1]),0),n.set(u.types.mdat,4),n.set(new Uint8Array([i+8>>>56&255,i+8>>>48&255,i+8>>>40&255,i+8>>>32&255,i+8>>>24&255,i+8>>>16&255,i+8>>>8&255,i+8&255]),8)):((n=new Uint8Array(i+a))[0]=i+8>>>24&255,n[1]=i+8>>>16&255,n[2]=i+8>>>8&255,n[3]=i+8&255,n.set(u.types.mdat,4));for(let e=0;e<t.length;e++){var o=t[e];o.duration=o.refSampleDuration*o.sequenceNumber;for(let e=0;e<o.sequenceNumber;e++){var l=o.samples[e],l=(l.chunkOffset=r.byteLength+s.byteLength+a,l.data);n.set(l,a),a+=l.byteLength}}i=u.moov(e,t),e=new Uint8Array(r.byteLength+i.byteLength+n.byteLength+s.byteLength);return e.set(r,0),e.set(s,r.byteLength),e.set(n,r.byteLength+s.byteLength),e.set(i,r.byteLength+n.byteLength+s.byteLength),e}static moov(e,t){let i=e.timescale,r=e.duration,s=t.length,a=u.mvhd(i,r),n=new Uint8Array;for(let e=0;e<s;e++){var o=u.trak(t[e]),l=new Uint8Array(o.byteLength+n.byteLength);l.set(n,0),l.set(o,n.byteLength),(n=new Uint8Array(l.byteLength)).set(l,0)}return u.box(u.types.moov,a,n)}static mvhd(e,t){return u.box(u.types.mvhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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,0,0,0,3]))}static trak(e){return u.box(u.types.trak,u.tkhd(e),u.mdia(e))}static tkhd(e){var t=e.id,i=e.duration,r=e.presentWidth,e=e.presentHeight;return u.box(u.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,e>>>8&255,255&e,0,0]))}static edts(e,t){return u.box(u.types.edts,u.elst(e,t))}static elst(t,i){let r=0;for(let e=0;e<i;e++)"video"===t[e].type&&(r+=t[e].duration);var e=t[i].duration;return 0===r&&(r=t[i].refSampleDuration),u.box(u.types.elst,new Uint8Array([0,0,0,0,0,0,0,2,r>>>24&255,r>>>16&255,r>>>8&255,255&r,255,255,255,255,0,1,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,0,0,0,0,1,0,0]))}static mdia(e){return u.box(u.types.mdia,u.mdhd(e),u.hdlr(e),u.minf(e))}static mdhd(e){var t=e.timescale/e.refSampleDuration,e=t*e.duration/e.timescale;return u.box(u.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e,85,196,0,0]))}static hdlr(e){var t=u.constants.HDLR_VIDEO;return u.box(u.types.hdlr,t)}static minf(e){var t=u.box(u.types.vmhd,u.constants.VMHD);return u.box(u.types.minf,t,u.dinf(),u.stbl(e))}static dinf(){return u.box(u.types.dinf,u.box(u.types.dref,u.constants.DREF))}static stbl(e){var i=e.samples,r=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:i[0].duration}],s=[i[0].duration],a=i.length;for(let t=0;t<a;t++)for(let e=0;e<r.length;e++)i[t].duration===r[e].duration?r[e].num++:s.indexOf(i[t].duration)<0&&(s.push(i[t].duration),r.push({No:2,num:0,sampleDelte:1,chunkNo:t+1,duration:i[t].duration}));return u.box(u.types.stbl,u.stsd(e),u.stts(r),u.stss(i),u.stsc(r),u.stsz(i),u.stco(r,i))}static stts(t){let i=t.length,e=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]),r=e.byteLength,s=new Uint8Array(r+8*i);s.set(e,0);for(let e=0;e<i;e++)s.set(new Uint8Array([t[e].num>>>24&255,t[e].num>>>16&255,t[e].num>>>8&255,255&t[e].num,t[e].sampleDelte>>>24&255,t[e].sampleDelte>>>16&255,t[e].sampleDelte>>>8&255,255&t[e].sampleDelte]),r),r+=8;return u.box(u.types.stts,s)}static stss(t){var i=[],r=t.length;for(let e=0;e<r;e++)!0===t[e].isKeyframe&&i.push(e+1);let s=i.length,e=new Uint8Array([0,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s]),a=e.byteLength,n=new Uint8Array(a+4*s);n.set(e,0);for(let e=0;e<s;e++)n.set(new Uint8Array([i[e]>>>24&255,i[e]>>>16&255,i[e]>>>8&255,255&i[e]]),a),a+=4;return u.box(u.types.stss,n)}static stsc(t){let i=t.length,e=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]),r=e.byteLength,s=new Uint8Array(r+12*i);s.set(e,0);for(let e=0;e<i;e++){var a=t[e].chunkNo,n=t[e].num,o=t[e].sampleDelte;s.set(new Uint8Array([a>>>24&255,a>>>16&255,a>>>8&255,255&a,n>>>24&255,n>>>16&255,n>>>8&255,255&n,o>>>24&255,o>>>16&255,o>>>8&255,255&o]),r),r+=12}return u.box(u.types.stsc,s)}static stsz(t){let i=t.length,e=new Uint8Array([0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]),r=e.byteLength,s=new Uint8Array(r+4*i);s.set(e,0);for(let e=0;e<i;e++){var a=t[e].data.byteLength;s.set(new Uint8Array([a>>>24&255,a>>>16&255,a>>>8&255,255&a]),r),r+=4}return u.box(u.types.stsz,s)}static stco(e,t){t=t[0].chunkOffset;return u.box(u.types.stco,new Uint8Array([0,0,0,0,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t]))}static stsd(e){return"audio"===e.type?"mp3"===e.codec?u.box(u.types.stsd,u.constants.STSD_PREFIX,u.mp3(e)):u.box(u.types.stsd,u.constants.STSD_PREFIX,u.mp4a(e)):"avc"===e.videoType?u.box(u.types.stsd,u.constants.STSD_PREFIX,u.avc1(e)):u.box(u.types.stsd,u.constants.STSD_PREFIX,u.hvc1(e))}static mp3(e){var t=e.channelCount,e=e.audioSampleRate,t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return u.box(u.types[".mp3"],t)}static mp4a(e){var t=e.channelCount,i=e.audioSampleRate,t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return u.box(u.types.mp4a,t,u.esds(e))}static esds(e){var e=e.config||[],t=e.length,t=new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e).concat([6,1,2]));return u.box(u.types.esds,t)}static avc1(e){var t=e.avcc,i=e.codecWidth,e=e.codecHeight,i=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,i>>>8&255,255&i,e>>>8&255,255&e,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return u.box(u.types.avc1,i,u.box(u.types.avcC,t))}static hvc1(e){var t=e.avcc,i=e.codecWidth,e=e.codecHeight,i=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,i>>>8&255,255&i,e>>>8&255,255&e,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return u.box(u.types.hvc1,i,u.box(u.types.hvcC,t))}static mvex(e){return u.box(u.types.mvex,u.trex(e))}static trex(e){e=e.id,e=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return u.box(u.types.trex,e)}static moof(e,t){return u.box(u.types.moof,u.mfhd(e.sequenceNumber),u.traf(e,t))}static mfhd(e){e=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return u.box(u.types.mfhd,e)}static traf(e,t){var i=e.id,i=u.box(u.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),t=u.box(u.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),r=u.sdtp(e),e=u.trun(e,r.byteLength+16+16+8+16+8+8);return u.box(u.types.traf,i,t,e,r)}static sdtp(e){var t=e.samples||[],i=t.length,r=new Uint8Array(4+i);for(let e=0;e<i;e++){var s=t[e].flags;r[e+4]=s.isLeading<<6|s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy}return u.box(u.types.sdtp,r)}static trun(e,t){var i=e.samples||[],r=i.length,e=12+16*r,s=new Uint8Array(e);s.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,(t+=8+e)>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(let e=0;e<r;e++){var a=i[e].duration,n=i[e].size,o=i[e].flags,l=i[e].cts;s.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,n>>>24&255,n>>>16&255,n>>>8&255,255&n,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.isNonSync,0,0,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*e)}return u.box(u.types.trun,s)}static mdat(e){return u.box(u.types.mdat,e)}}u.init();class zi extends Ui{constructor(e){super(e),this.tagName="recorderMP4",this.totalDuration=0,this.totalByteLength=0,this.bufferList=[],this.cacheTrack={},this.sequenceNumber=0,e.debug.log(this.tagName,"init")}destroy(){super.destroy(),this._reset(),this.player.debug.log(this.tagName,"destroy")}_reset(){super._reset(),this.totalDuration=0,this.totalByteLength=0,this.sequenceNumber=0,this.cacheTrack={},this.bufferList=[]}startRecord(){var e=this.player.debug;this._isRecording=!0,this.player.emit(E.recording,!0),e.log(this.tagName,"start recording"),this.player.emit(E.recordStart),this.startRecordingInterval()}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval(()=>{this.player.emit(E.recordingTimestamp,this.getTotalDuration())},1e3)}formatFmp4Track(e,t,i,r){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:i,cts:r,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}handleAddNaluTrack(e,t,i,r){this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,i,r)}handleAddFmp4Track(e){if(this.isRecording)if(null!==this.sps&&null!==this.pps||!this.isH264)if(null!==this.sps&&null!==this.pps&&null!==this.vps||!this.isH265){var t=Object.assign({},e),i=(t.pts=t.dts+t.cts,t.data);if(t.isKeyframe)if(this.isH264){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength);e.set(this.sps,0),e.set(this.pps,this.sps.byteLength);var r=new Uint8Array(e.byteLength+i.byteLength);r.set(e,0),r.set(i,e.byteLength),t.data=r}else if(this.isH265){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);e.set(this.vps,0),e.set(this.sps,this.vps.byteLength),e.set(this.pps,this.vps.byteLength+this.sps.byteLength);r=new Uint8Array(e.byteLength+i.byteLength);r.set(e,0),r.set(i,e.byteLength),t.data=r}t.size=t.data.byteLength,this.totalDuration+=t.duration,this.totalByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.bufferList.push(t)}else this.player.debug.error(this.tagName,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");else this.player.debug.error(this.tagName,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");else this.player.debug.error(this.tagName,"handleAddFmp4Track, isRecording is false ")}getTotalDuration(){return this.totalDuration/1e3}getType(){return p}getToTalByteLength(){return this.totalByteLength}stopRecordAndSave(){let e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:de,t=1<arguments.length?arguments[1]:void 0;return new Promise((i,r)=>{if(!this.isRecording)return this.player.debug.error(this.tagName,"stop recording fail, isRecording is false "),r("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debug.error(this.tagName,"stop recording fail, this.bufferList.length is 0 "),r("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);r={id:1,type:"video",sps:this.sps,pps:this.pps,samples:this.bufferList,sequenceNumber:this.bufferList.length,length:0,addSampleNum:1,duration:0,...this.metaInfo},r=u.generateInitSegment({timescale:1e3,duration:this.totalDuration},[r],this.totalByteLength),this.player.debug.log(this.tagName,"stop recording"),r=new Blob([r],{type:"application/octet-stream"});if("blob"===e)i(r),this.player.emit(E.recordBlob,r);else{i();{i=(this.fileName||A())+"."+p;let e=window.URL.createObjectURL(r),t=window.document.createElement("a");t.download=i,t.href=e;i=window.document.createEvent("MouseEvents");i.initEvent("click",!0,!0),t.dispatchEvent(i),setTimeout(()=>{window.URL.revokeObjectURL(e)},rt()?1e3:0)}}this._reset(),this.player.emit(E.recording,!1)})}}class Gi{constructor(e){return new(Gi.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.recordType===p&&(e.useWasm||e.useMSE||e.useWCS)?zi:Ni}}class Hi{constructor(e){this.player=e,this.destroyResolve=null;let t=e._opt.decoder;if(0===(t=k(this.player._opt.useWasm)?e._opt.decoderAudio:t).indexOf("http")&&this.player._opt.isDecoderUseCDN){const e=new Blob([`importScripts("${t}")`],{type:"application/javascript"});t=window.URL.createObjectURL(e)}this.decoderWorker=new Worker(t),this._initDecoderWorker(),e.debug.log("decoderWorker","init"),e.on(E.visibilityChange,()=>{this.updateWorkConfig({key:"visibility",value:e.visibility})})}destroy(){return new Promise((e,t)=>{this.player.loaded?(this.player.debug.log("decoderWorker","has loaded and post message to destroy"),this.decoderWorker?(this.decoderWorker.postMessage({cmd:"close"}),this.destroyResolve=e):(this.player.debug.warn("decoderWorker","has loaded but decoderWorker is null and destroy directly"),this._destroy(),setTimeout(()=>{e()},0))):(this.player.debug.log("decoderWorker","has not loaded and destroy directly"),this._destroy(),setTimeout(()=>{e()},0))})}_destroy(){this.decoderWorker&&(this.decoderWorker.terminate(),this.decoderWorker=null),this.player.debug.log("decoderWorker","destroy"),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null)}_initDecoderWorker(){const{debug:i,events:{}}=this.player;this.decoderWorker.onmessage=e=>{var t=e.data;switch(t.cmd){case Z:i.log("decoderWorker","onmessage:",Z),this.decoderWorker&&this._initWork(),this.player.loaded||this.player.emit(E.load),this.player.emit(E.decoderWorkerInit);break;case re:i.log("decoderWorker","onmessage:",re,t.code),this.player._times.decodeStart||(this.player._times.decodeStart=A()),this.player.video.updateVideoInfo({encTypeCode:t.code});break;case se:i.log("decoderWorker","onmessage:",se,t.codecId),this.player.recorder&&this.player.recorder.initMetaData(t.buffer,t.codecId);break;case ie:i.log("decoderWorker","onmessage:",ie,t.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:t.code});break;case ee:(i.log("decoderWorker","onmessage:",ee,`width:${t.w},height:`+t.h),this.player.video.updateVideoInfo({width:t.w,height:t.h}),this.player._opt.openWebglAlignment||t.w/2%4==0||this.player.getRenderType()!==W)?(this.player.video.initCanvasViewSize(),this.player._opt.playType===v&&(this.player.video.initFps(),this.player.video.initVideoDelay())):this.player.emit(m.webglAlignmentError);break;case te:(i.log("decoderWorker","onmessage:",te,`channels:${t.channels},sampleRate:`+t.sampleRate),2<t.channels)?this.player.emitError(m.audioChannelError,`audio channel is ${t.channels}, max is 2`):this.player.audio&&(this.player.audio.updateAudioInfo(t),this.player._opt.playType===n?this.player.audio.initScriptNode():this.player._opt.playType===v&&this.player.audio.initScriptNodeDelay());break;case"render":if(this.player.video)if(this.player._opt.playType===n){if(k(this.player.video.getHasInit()))return void i.warn("decoderWorker","onmessage render but video has not init");this.player.video.render(t),this.player.handleRender(),this.player.emit(E.timeUpdate,t.ts),this.player.updateStats({dfps:!0,buf:t.delay}),this.player._times.videoStart||(this.player._times.videoStart=A(),this.player.handlePlayToRenderTimes())}else this.player._opt.playType===v&&(this.player.updateStats({dfps:!0}),k(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData(t):this.player.video.render$2(t)):!this.player.playback.isPlaybackPauseClearCache&&this.player.playback.isCacheBeforeDecodeForFpsRender&&this.player.playback.isUseFpsRender&&this.player.video.pushData(t));else i.warn("decoderWorker","onmessage render but video is null");break;case"videoNalu":this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===p&&this.player.recorder.handleAddNaluTrack(t.buffer,t.isIFrame,t.ts,t.cts);break;case"playAudio":this.player.audio?(this.player.playing&&this.player.audio||!this.player.video)&&(this.player._opt.hasVideo||this.player.handleRender(),this.player._opt.playType===n||this.player._opt.playType===v&&(k(this.player.playbackPause)||!this.player.playback.isPlaybackPauseClearCache&&this.player.playback.isCacheBeforeDecodeForFpsRender&&this.player.playback.isUseFpsRender))&&this.player.audio.play(t.buffer,t.ts):i.warn("decoderWorker","onmessage playAudio but audio is null");break;case"workerFetch":if(t.type===E.streamSuccess)this.player.stream?this.player.stream.emit(E.streamSuccess):i.warn("decoderWorker","onmessage and workerFetch response stream success but stream is null");else if(t.type===E.streamRate)this.player.emit(E.kBps,(t.value/1024).toFixed(2));else if(t.type===E.streamEnd)this.player?(t.value===F&&this.player.emit(E.websocketClose),this.player.stream?this.player.stream.emit(E.streamEnd):i&&i.warn("decoderWorker","onmessage and workerFetch response stream end but player.stream is null")):i&&i.warn("decoderWorker","onmessage and workerFetch response stream end but player is null");else if(t.type===m.websocketError)this.player&&this.player.stream?this.player.stream.emit(m.websocketError,t.value):i&&i.warn("decoderWorker","onmessage and workerFetch response websocket error but stream is null");else if(t.type===m.fetchError)this.player&&this.player.stream?this.player.stream.emit(m.fetchError,t.value):i&&i.warn("decoderWorker","onmessage and workerFetch response fetch error but stream is null");else if(t.type===E.streamAbps)this.player.updateStats({abps:t.value});else if(t.type===E.streamVbps)this.player._times.demuxStart||(this.player._times.demuxStart=A()),this.player.updateStats({vbps:t.value});else if(t.type===E.streamDts)this.player.updateStats({dts:t.value});else if(t.type===E.netBuf)this.player.updateStats({netBuf:t.value});else if(t.type===E.networkDelayTimeout)this.player.emit(E.networkDelayTimeout,t.value);else if(t.type===E.streamStats){const i=JSON.parse(t.value);this.player.updateStats({workerStats:i})}else t.type===E.websocketOpen&&this.player.emit(E.websocketOpen);break;case"iframeIntervalTs":this.player&&(this.player.videoIframeIntervalTs=t.value);break;case"playbackStreamVideoFps":this.player&&this.player.video&&this.player.video.setStreamFps(t.value);break;case"wasmError":t.message&&-1!==t.message.indexOf("Invalid NAL unit size")&&this.player.emitError(m.wasmDecodeError,"");break;case"wasmDecodeVideoNoResponseError":this.player.emitError(m.wasmDecodeVideoNoResponseError);break;case"simdH264DecodeVideoWidthIsTooLarge":this.player.emitError(m.simdH264DecodeVideoWidthIsTooLarge);break;case"wasmWidthOrHeightChange":this.player.emitError(m.wasmWidthOrHeightChange);break;case ae:i.log("decoderWorker","onmessage:",ae),this._destroy();break;default:this.player[t.cmd]&&this.player[t.cmd](t)}}}_initWork(){var e={debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment,playType:this.player._opt.playType,hasAudio:this.player._opt.hasAudio,hasVideo:this.player._opt.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:this.player._opt.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:this.player.audio&&this.player.audio.audioContext&&this.player.audio.audioContext.sampleRate||0,audioBufferSize:this.player.audio&&this.player.audio.getAudioBufferSize()||1024,networkDelay:this.player._opt.networkDelay,visibility:this.player.visibility,useSIMD:this.player._opt.useSIMD,recordType:this.player._opt.recordType,isNakedFlow:this.player._opt.isNakedFlow,checkFirstIFrame:this.player._opt.checkFirstIFrame,isCrypto:this.player._opt.isCrypto};this.decoderWorker.postMessage({cmd:"init",opt:JSON.stringify(e)}),this.player._opt.isCrypto&&(this.updateWorkConfig({key:"cryptoKey",value:this.player._opt.cryptoKey}),this.updateWorkConfig({key:"cryptoIV",value:this.player._opt.cryptoIV}))}decodeVideo(e,t,i){this.player._opt.playType===n?this._decodeVideo(e,t,i):this.player._opt.playType===v&&(this.player.video.rate>=this.player._opt.playbackForwardMaxRateDecodeIFrame?i&&(this.player.debug.log("decoderWorker",`current rate is ${this.player.video.rate},only decode i frame`),this._decodeVideoNoDelay(e,t,i)):1===this.player.video.rate?this._decodeVideo(e,t,i):this._decodeVideoNoDelay(e,t,i))}_decodeVideo(e,t,i){t={type:2,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:"decode",buffer:e,options:t},[e.buffer])}_decodeVideoNoDelay(e,t,i){this.decoderWorker.postMessage({cmd:"videoDecode",buffer:e,ts:Math.max(t,0),isIFrame:i},[e.buffer])}decodeAudio(e,t){this.player._opt.playType===n?this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===v&&(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t))}_decodeAudio(e,t){t={type:1,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:"decode",buffer:e,options:t},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:"audioDecode",buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:"updateConfig",key:e.key,value:e.value})}workerFetchStream(e){var t=this.player["_opt"],t={protocol:t.protocol,isFlv:t.isFlv};this.decoderWorker.postMessage({cmd:"fetchStream",url:e,opt:JSON.stringify(t)})}clearWorkBuffer(){this.decoderWorker.postMessage({cmd:"clearBuffer",needClear:0<arguments.length&&void 0!==arguments[0]&&arguments[0]})}workerSendMessage(e){this.decoderWorker.postMessage({cmd:"sendWsMessage",message:e})}}class Vi extends e{constructor(e){super(),this.player=e,this.stopId=null,this.firstTimestamp=null,this.startTimestamp=null,this.preDelayTimestamp=null,this.preLoopTimestamp=null,this.bufferStartDts=null,this.bufferStartLocalTs=null,this.preIframeTs=null,this.preTimestamp=null,this.preTimestampDuration=0,this.prevPayloadBufferSize=0,this.isStreamTsMoreThanLocal=!1,this.delay=-1,this.pushLatestDelay=-1,this.bufferList=[],this.dropping=!1,this.isPushDropping=!1,this.initInterval(),this.player.debug.log("CommonDemux","init")}destroy(){this.bufferList=[],this.stopId&&(clearInterval(this.stopId),this.stopId=null),this.firstTimestamp=null,this.startTimestamp=null,this.bufferStartDts=null,this.bufferStartLocalTs=null,this.preDelayTimestamp=null,this.preLoopTimestamp=null,this.preIframeTs=null,this.preTimestamp=null,this.preTimestampDuration=0,this.prevPayloadBufferSize=0,this.isStreamTsMoreThanLocal=!1,this.delay=-1,this.pushLatestDelay=-1,this.dropping=!1,this.isPushDropping=!1,this.off(),this.player.debug.log("CommonDemux","destroy")}isDropping(){return this.dropping||this.isPushDropping}getDelay(e){var t,i;return e&&this.player.isDemuxDecodeFirstIIframeInit()?(this.preDelayTimestamp&&this.preDelayTimestamp>e?1e3<this.preDelayTimestamp-e&&this.player.debug.warn("CommonDemux",`getDelay and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms`):this.firstTimestamp?e&&(t=Date.now()-this.startTimestamp,(i=e-this.firstTimestamp)<=t?(this.isStreamTsMoreThanLocal=!1,this.delay=t-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-t)):(this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1),this.preDelayTimestamp=e,this.delay):-1}getDelayNotUpdateDelay(t){if(t&&this.player.isDemuxDecodeFirstIIframeInit())if(this.preDelayTimestamp&&1e3<this.preDelayTimestamp-t)this.player.debug.warn("CommonDemux",`getDelayNotUpdateDelay and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${t} more than ${this.preDelayTimestamp-t}ms`);else if(this.firstTimestamp){let e=-1;var i;return t&&(i=Date.now()-this.startTimestamp,t=t-this.firstTimestamp,e=t<=i?i-t:t-i),e}return-1}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}resetAllDelay(){this.resetDelay(),this.preDelayTimestamp=null}initInterval(){this.player.debug.log("CommonDemux","init Interval"),this._loop(),this.stopId=setInterval(()=>{var e=(new Date).getTime(),e=(this.preLoopTimestamp||(this.preLoopTimestamp=e),e-this.preLoopTimestamp);100<e&&this.player.debug.warn("CommonDemux","loop demux diff time is "+e),this._loop(),this.preLoopTimestamp=(new Date).getTime()},10)}_loop(){let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay,r=this.player._opt.playType===n;if(this.bufferList.length)if(this.isPushDropping)this.player.debug.warn("CommonDemux","_loop isPushDropping is true and bufferList length is "+this.bufferList.length);else if(this.player._opt.useMSE&&this.player.mseDecoder&&this.player.mseDecoder.getSourceBufferUpdating())this.player.debug.warn("CommonDemux","_loop getSourceBufferUpdating is true and bufferList length is "+this.bufferList.length);else if(this.dropping){e=this.bufferList.shift();const t=this.getDelayNotUpdateDelay(e.ts);for(this.player.debug.warn("CommonDemux",`_loop is dropping and data.ts is ${e.ts}, data.isIFrame is ${e.isIFrame} tempDelay is ${t}, delay is `+this.delay);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift();e.isIFrame&&t<=this.getNotDroppingDelayTs()&&(this.player.debug.log("CommonDemux","_loop data isIFrame is true and delay is "+this.delay),this.dropping=!1,this._doDecoderDecode(e))}else e=this.bufferList[0],-1===this.getDelay(e.ts)?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>i+t&&r?this.hasIframeInBufferList()?(this.player.debug.warn("CommonDemux",`_loop delay is ${this.delay}, set dropping is true`),this.resetAllDelay(),this.dropping=!0):(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>t?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay<0&&this.player.debug.warn("CommonDemux",`_loop delay is ${this.delay} bufferList is `+this.bufferList);else-1!==this.delay&&this.player.debug.log("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}_doDecode(e,t,i,r){var s=this.player,a={ts:i,cts:4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,type:t,isIFrame:!1};2===t&&s._opt.playType===n&&this.calcNetworkDelay(i),s._opt.useWCS&&!s._opt.useOffscreen||s._opt.useMSE?(2===t&&(a.isIFrame=r),this.pushBuffer(e,a)):2===t?s.decoderWorker&&s.decoderWorker.decodeVideo(e,i,r):1===t&&s._opt.hasAudio&&s.decoderWorker&&s.decoderWorker.decodeAudio(e,i)}_doDecoderDecode(e){var t=this.player,{webcodecsDecoder:i,mseDecoder:r}=t;1===e.type?t._opt.hasAudio&&t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts):2===e.type&&(t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t._opt.useMSE&&r.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts))}pushBuffer(e,t){const i=this.player._opt.videoBuffer,r=this.player._opt.videoBufferDelay,s=this.player._opt.playType===n;if(1===t.type&&Je(e))this.player.debug.log("CommonDemux",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is `+Je(e)),this._doDecoderDecode({ts:t.ts,payload:e,type:1});else{if(0<this.preTimestampDuration&&0<this.preTimestamp&&2===t.type){const e=t.ts-this.preTimestamp;e>=2*this.preTimestampDuration-5&&this.player.debug.warn("CommonDemux",`pushBuffer video
  2. ts is ${t.ts}, preTimestamp is ${this.preTimestamp},
  3. diff is ${e} and preTimestampDuration is ${this.preTimestampDuration}
  4. maybe trigger black screen or flower screen`)}if(0<this.preTimestamp&&t.ts<this.preTimestamp&&2===t.type&&36e5<this.preTimestamp-t.ts&&(this.player.debug.warn("CommonDemux",`pushBuffer video
  5. ts is ${t.ts}, preTimestamp is ${this.preTimestamp},
  6. diff is ${this.preTimestamp-t.ts} more than 3600000
  7. and resetAllDelay()`),this.resetAllDelay()),t.ts<=this.preTimestamp&&0<this.preTimestamp&&2===t.type&&this.player.debug.warn("CommonDemux",`pushBuffer video
  8. ts is ${t.ts} less than (or equal) preTimestamp is ${this.preTimestamp} and
  9. payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is `+this.prevPayloadBufferSize),s&&this.player.isDemuxDecodeFirstIIframeInit()){var a=this.getDelayNotUpdateDelay(t.ts);this.pushLatestDelay=a;const s=r+i;this.player._opt.useMSE?a>s&&this.delay<s&&0<this.delay&&this.hasIframeInBufferList()&&!1===this.isPushDropping&&!1===this.player.mseDecoder.getSourceBufferUpdating()&&(this.player.debug.warn("CommonDemux",`useMSE, pushLatestDelay is ${a} > ${r+i}, bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):a>s&&this.delay<s&&0<this.delay&&this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux",`useWCS, pushLatestDelay is ${a} > ${r+i},bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2())}2===t.type&&(0<this.preTimestamp&&(this.preTimestampDuration=t.ts-this.preTimestamp),this.prevPayloadBufferSize=e.byteLength,this.preTimestamp=t.ts),1===t.type?this.bufferList.push({ts:t.ts,payload:e,type:1}):2===t.type&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:2,isIFrame:t.isIFrame})}}dropBuffer$2(){var e,t,i;0<this.bufferList.length&&(this.isPushDropping=!0,0<=(e=this.bufferList.findIndex(e=>S(e.isIFrame)&&2===e.type))?(this.bufferList=this.bufferList.slice(e),t=this.bufferList.shift(),i=this.getDelayNotUpdateDelay(t.ts),this._doDecoderDecode(t),this.isPushDropping=!1,this.player.debug.log("CommonDemux",`dropBuffer$2() iFrameIndex is ${e},and bufferList length is ${this.bufferList.length} and tempDelay is ${i} ,delay is ${this.delay} `)):this.isPushDropping=!1),0===this.bufferList.length&&(this.isPushDropping=!1)}clearBuffer(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.player.debug.log("CommonDemux",`clearBuffer,buffer length is ${this.bufferList.length}, need clear is `+e),e&&(this.bufferList=[]),this.resetAllDelay(),this.dropping=!0}calcNetworkDelay(e){var t,i,r;this.player.isDemuxDecodeFirstIIframeInit()&&0<e&&(null===this.bufferStartDts?(this.bufferStartDts=e,this.bufferStartLocalTs=A()):e<this.bufferStartDts&&(this.player.debug.warn("CommonDemux",`calcNetworkDelay dts is ${e} and bufferStartDts is `+this.bufferStartDts),this.bufferStartDts=e,this.bufferStartLocalTs=A()),(r=(t=e-this.bufferStartDts)<(i=A()-this.bufferStartLocalTs)?i-t:0)>this.player._opt.networkDelay&&this.player._opt.playType===n&&(this.player.debug.warn("CommonDemux",`delay is more than networkDelay and now dts:${e},start dts is ${this.bufferStartDts}, vs start is ${t},local diff is ${i} ,delay is ${r}, _opt.networkDelay is `+this.player._opt.networkDelay),this.player.emit(E.networkDelayTimeout,r)),this.player.updateStats({netBuf:r}))}calcIframeIntervalTimestamp(e){var t;null===this.preIframeTs?this.preIframeTs=e:this.preIframeTs<e&&(t=e-this.preIframeTs,this.player&&(this.player.videoIframeIntervalTs=t),this.preIframeTs=e)}getNotDroppingDelayTs(){return this.player._opt.videoBuffer+this.player._opt.videoBufferDelay/2}getMaxDelayTs(){return this.player._opt.videoBuffer+this.player._opt.videoBufferDelay}getPushLatestDelay(){return this.pushLatestDelay}hasIframeInBufferList(){return this.bufferList.some(e=>2===e.type&&e.isIFrame)}getInputByteLength(){return 0}getIsStreamTsMoreThanLocal(){return this.isStreamTsMoreThanLocal}close(){}reset(){}}const Wi=Symbol(32),Ki=Symbol(16),$i=Symbol(8);class Ji{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(i){return e=this,l=function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise((t,e)=>{this.reject=e,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)},this.demand(i,!0)||null==(e=this.pull)||e.call(this,i)})},new(o=(o=n=void 0)||Promise)(function(i,t){function r(e){try{a(l.next(e))}catch(e){t(e)}}function s(e){try{a(l.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?i(e.value):((t=e.value)instanceof o?t:new o(function(e){e(t)})).then(r,s)}a((l=l.apply(e,n||[])).next())});var e,n,o,l}readU32(){return this.read(Wi)}readU16(){return this.read(Ki)}readU8(){return this.read($i)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null!=(e=this.reject)&&e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(this.buffer&&this.need){let e=null;const r=this.buffer.subarray(this.consumed);let t=0;var i=e=>r.length<(t=e);if("number"==typeof this.need){if(i(this.need))return;e=r.subarray(0,t)}else if(this.need===Wi){if(i(4))return;e=r[0]<<24|r[1]<<16|r[2]<<8|r[3]}else if(this.need===Ki){if(i(2))return;e=r[0]<<8|r[1]}else if(this.need===$i){if(i(1))return;e=r[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(r.subarray(0,t)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(r.subarray(0,t)),e=this.need}return this.consumed+=t,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise(e=>this.pull=e);this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){var t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{const e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}Ji.U32=Wi,Ji.U16=Ki,Ji.U8=$i;var qi,Qi="application/json, text/javascript",Yi="text/html",Xi=/^(?:text|application)\/xml/i,Zi=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,er=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,tr=/^\s*$/,ir={},rr={},sr="",ar={type:"GET",beforeSend:_,success:_,error:_,complete:_,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:Qi,xml:"application/xml, text/xml",html:Yi,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:_,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function _(){}function h(e,t){"object"==typeof e&&(t=e,e=void 0);var i,r=hr({},t=t||{});for(i in ar)void 0===r[i]&&(r[i]=ar[i]);try{var s={},a=new Promise(function(e,t){s.resolve=e,s.reject=t});a.resolve=s.resolve,a.reject=s.reject,r.promise=a}catch(e){r.promise={resolve:_,reject:_}}var n,o,l,c,d,a=er.exec(window.location.href.toLowerCase())||[],u=(r.url=((e||r.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,a[1]+"//"),r.url),h=(r.crossDomain||(r.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(r.url)&&RegExp.$2!==window.location.href),r.dataType);if("jsonp"===h)return/=\?/.test(r.url)||(a=(r.jsonp||"callback")+"=?",r.url=dr(r.url,a)),l=(n=r).jsonpCallback||"jsonp"+gr(),c=window.document.createElement("script"),d={abort:function(){l in window&&(window[l]=_)}},a=window.document.getElementsByTagName("head")[0]||window.document.documentElement,c.onerror=function(e){e=e,window.clearTimeout(o),d.abort(),lr(e.type,d,e.type,n),p()},window[l]=function(e){window.clearTimeout(o),nr(e,d,n),p()},ur(n),c.src=n.url.replace(/=\?/,"="+l),c.src=dr(c.src,"_="+(new Date).getTime()),c.async=!0,n.scriptCharset&&(c.charset=n.scriptCharset),a.insertBefore(c,a.firstChild),0<n.timeout&&(o=window.setTimeout(function(){d.abort(),lr("timeout",d,"timeout",n),p()},n.timeout)),n.promise.abort=function(){d.abort()},n.promise.xhr=d,n.promise;function p(){c.clearAttributes?c.clearAttributes():c.onload=c.onreadystatechange=c.onerror=null,c.parentNode&&c.parentNode.removeChild(c),c=null,delete window[l]}ur(r);var f=r.accepts[h]||r.accepts["*"],g={};/^([\w-]+:)\/\//.test(r.url)?RegExp.$1:window.location.protocol;var m,A=ar.xhr(),f=(r.crossDomain||g["X-Requested-With"]||(g["X-Requested-With"]="XMLHttpRequest"),r.ifModified&&(ir[u]&&(g["If-Modified-Since"]=ir[u]),rr[u])&&(g["If-None-Match"]=rr[u]),f&&(-1<(g.Accept=f).indexOf(",")&&(f=f.split(",",2)[0]),A.overrideMimeType)&&A.overrideMimeType(f),!/^(?:GET|HEAD)$/.test(r.type.toUpperCase())),f=((r.data&&f&&!1!==r.contentType||t.contentType)&&(g["Content-Type"]=r.contentType),!1!==r.cache||f||(r.url=(t=/([?&])_=[^&]*/).test(u)?u.replace(t,"$1_="+gr()):u+(/\?/.test(u)?"&":"?")+"_="+gr()),r.headers=hr(g,r.headers||{}),A.onreadystatechange=function(){if(4===A.readyState){clearTimeout(m);var e,t=!1;if(200<=A.status&&A.status<300||304===A.status){sr=A.getAllResponseHeaders(),r.ifModified&&((i=cr("Last-Modified"))&&(ir[u]=i),i=cr("etag"))&&(rr[u]=i),h=h||(i=A.getResponseHeader("content-type"))&&(i===Yi?"html":i===Qi?"json":Xi.test(i)&&"xml")||"text",e=A.responseText;try{"xml"===h?e=A.responseXML:"json"===h&&(e=tr.test(e)?null:JSON.parse(e))}catch(e){t=e}t?lr(t,"parseerror",A,r):nr(e,A,r)}else lr(null,"error",A,r)}var i},!("async"in r)||r.async);if(A.open(r.type,r.url,f,r.username,r.password),r.xhrFields)for(var y in r.xhrFields)A[y]=r.xhrFields[y];for(y in r.mimeType&&A.overrideMimeType&&A.overrideMimeType(r.mimeType),r.headers)void 0!==r.headers[y]&&A.setRequestHeader(y,r.headers[y]+"");return!1===function(e){var t=e.context;if(!1===e.beforeSend.call(t,A,e))return!1}(r)?(A.abort(),!1):(0<r.timeout&&(m=window.setTimeout(function(){A.onreadystatechange=_,A.abort(),lr(null,"timeout",A,r)},r.timeout)),A.send(r.data||null),r.promise.abort=function(){A.abort()},r.promise)}function nr(e,t,i){var r=i.context,s="success";i.success.call(r,e,s,t),i.promise.resolve(e,s,t),or(s,t,i)}function or(e,t,i){var r=i.context;i.complete.call(r,t,e)}function lr(e,t,i,r){var s=r.context;r.error.call(s,i,t,e),r.promise.reject(i,t,e),or(t,i,r)}function cr(e){var t;if(!qi){for(qi={};t=Zi.exec(sr);)qi[t[1].toLowerCase()]=t[2];t=qi[e.toLowerCase()]}return null===t?null:t}function dr(e,t){return(e+"&"+t).replace(/[&?]{1,2}/,"?")}function ur(e){var t,i;!pr(e)||e.data instanceof FormData||!e.processData||(e.data=(t=e.data,(i=[]).add=function(e,t){this.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},function e(t,i,r,s){var a=function(e){return"[object Array]"===Object.prototype.toString.call(e)}(i);for(var n in i){var o=i[n];s&&(n=r?s:s+"["+(a?"":n)+"]"),!s&&a?t.add(o.name,o.value):(r?a:pr)(o)?e(t,o,r,n):t.add(n,o)}}(i,t,void 0),i.join("&").replace("%20","+"))),!e.data||e.type&&"GET"!==e.type.toUpperCase()||(e.url=dr(e.url,e.data))}function hr(e){for(var t=Array.prototype.slice.call(arguments,1),i=0,r=t.length;i<r;i++){var s,a=t[i]||{};for(s in a)a.hasOwnProperty(s)&&void 0!==a[s]&&(e[s]=a[s])}return e}function pr(e){var t=typeof e;return"function"==t||"object"==t&&!!e}function fr(e){return"function"==typeof e}function gr(){return(new Date).getTime()}function mr(e){return parseInt(e)===e}function Ar(e){if(mr(e.length)){for(var t=0;t<e.length;t++)if(!mr(e[t])||e[t]<0||255<e[t])return;return 1}}function a(e,t){if(e.buffer&&"Uint8Array"===e.name)return e=t?e.slice?e.slice():Array.prototype.slice.call(e):e;if(Array.isArray(e)){if(Ar(e))return new Uint8Array(e);throw new Error("Array contains invalid value: "+e)}if(mr(e.length)&&Ar(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function C(e){return new Uint8Array(e)}function R(e,t,i,r,s){null==r&&null==s||(e=e.slice?e.slice(r,s):Array.prototype.slice.call(e,r,s)),t.set(e,i)}h.get=function(e,t,i,r){return fr(t)&&(r=r||i,i=t,t=void 0),h({url:e,data:t,success:i,dataType:r})},h.post=function(e,t,i,r){return fr(t)&&(r=r||i,i=t,t=void 0),h({type:"POST",url:e,data:t,success:i,dataType:r})},h.getJSON=function(e,t,i){return fr(t)&&(i=t,t=void 0),h({url:e,data:t,success:i,dataType:"json"})},h.ajaxSetup=function(e,t){return t?hr(hr(e,ar),t):hr(ar,e)};var yr,br={toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i<e.length;){var r=e.charCodeAt(i++);37===r?(t.push(parseInt(e.substr(i,2),16)),i+=2):t.push(r)}return a(t)},fromBytes:function(e){for(var t=[],i=0;i<e.length;){var r=e[i];r<128?(t.push(String.fromCharCode(r)),i++):191<r&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}},vr=(yr="0123456789abcdef",{toBytes:function(e){for(var t=[],i=0;i<e.length;i+=2)t.push(parseInt(e.substr(i,2),16));return t},fromBytes:function(e){for(var t=[],i=0;i<e.length;i++){var r=e[i];t.push(yr[(240&r)>>4]+yr[15&r])}return t.join("")}}),Er={16:10,24:12,32:14},wr=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],D=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Tr=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Sr=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],kr=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],_r=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Cr=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Rr=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Dr=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Lr=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],xr=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ir=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Pr=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Br=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Mr=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Or(e){for(var t=[],i=0;i<e.length;i+=4)t.push(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]);return t}function L(e){if(!(this instanceof L))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:a(e,!0)}),this._prepare()}function Fr(e){if(!(this instanceof Fr))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new L(e)}function jr(e,t){if(!(this instanceof jr))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=C(16);this._lastCipherblock=a(t,!0),this._aes=new L(e)}function Ur(e,t,i){if(!(this instanceof Ur))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=C(16);this.segmentSize=i=i||1,this._shiftRegister=a(t,!0),this._aes=new L(e)}function Nr(e,t){if(!(this instanceof Nr))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=C(16);this._lastPrecipher=a(t,!0),this._lastPrecipherIndex=16,this._aes=new L(e)}function zr(e){if(!(this instanceof zr))throw Error("Counter must be instanitated with `new`");"number"==typeof(e=0!==e?e||1:e)?(this._counter=C(16),this.setValue(e)):this.setBytes(e)}function Gr(e,t){if(!(this instanceof Gr))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof zr||(t=new zr(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new L(e)}L.prototype._prepare=function(){var e=Er[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(var i,r=4*(e+1),s=this.key.length/4,a=Or(this.key),t=0;t<s;t++)this._Ke[i=t>>2][t%4]=a[t],this._Kd[e-i][t%4]=a[t];for(var n,o=0,l=s;l<r;){if(n=a[s-1],a[0]^=D[n>>16&255]<<24^D[n>>8&255]<<16^D[255&n]<<8^D[n>>24&255]^wr[o]<<24,o+=1,8!=s)for(t=1;t<s;t++)a[t]^=a[t-1];else{for(t=1;t<s/2;t++)a[t]^=a[t-1];for(n=a[s/2-1],a[s/2]^=D[255&n]^D[n>>8&255]<<8^D[n>>16&255]<<16^D[n>>24&255]<<24,t=s/2+1;t<s;t++)a[t]^=a[t-1]}for(t=0;t<s&&l<r;)this._Ke[c=l>>2][d=l%4]=a[t],this._Kd[e-c][d]=a[t++],l++}for(var c=1;c<e;c++)for(var d=0;d<4;d++)n=this._Kd[c][d],this._Kd[c][d]=Ir[n>>24&255]^Pr[n>>16&255]^Br[n>>8&255]^Mr[255&n]},L.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],r=Or(e),s=0;s<4;s++)r[s]^=this._Ke[0][s];for(var a=1;a<t;a++){for(s=0;s<4;s++)i[s]=Sr[r[s]>>24&255]^kr[r[(s+1)%4]>>16&255]^_r[r[(s+2)%4]>>8&255]^Cr[255&r[(s+3)%4]]^this._Ke[a][s];r=i.slice()}for(var n,o=C(16),s=0;s<4;s++)n=this._Ke[t][s],o[4*s]=255&(D[r[s]>>24&255]^n>>24),o[4*s+1]=255&(D[r[(s+1)%4]>>16&255]^n>>16),o[4*s+2]=255&(D[r[(s+2)%4]>>8&255]^n>>8),o[4*s+3]=255&(D[255&r[(s+3)%4]]^n);return o},L.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],r=Or(e),s=0;s<4;s++)r[s]^=this._Kd[0][s];for(var a=1;a<t;a++){for(s=0;s<4;s++)i[s]=Rr[r[s]>>24&255]^Dr[r[(s+3)%4]>>16&255]^Lr[r[(s+2)%4]>>8&255]^xr[255&r[(s+1)%4]]^this._Kd[a][s];r=i.slice()}for(var n,o=C(16),s=0;s<4;s++)n=this._Kd[t][s],o[4*s]=255&(Tr[r[s]>>24&255]^n>>24),o[4*s+1]=255&(Tr[r[(s+3)%4]>>16&255]^n>>16),o[4*s+2]=255&(Tr[r[(s+2)%4]>>8&255]^n>>8),o[4*s+3]=255&(Tr[255&r[(s+1)%4]]^n);return o},Fr.prototype.encrypt=function(e){if((e=a(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=C(e.length),i=C(16),r=0;r<e.length;r+=16)R(e,i,0,r,r+16),R(i=this._aes.encrypt(i),t,r);return t},Fr.prototype.decrypt=function(e){if((e=a(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=C(e.length),i=C(16),r=0;r<e.length;r+=16)R(e,i,0,r,r+16),R(i=this._aes.decrypt(i),t,r);return t},jr.prototype.encrypt=function(e){if((e=a(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=C(e.length),i=C(16),r=0;r<e.length;r+=16){R(e,i,0,r,r+16);for(var s=0;s<16;s++)i[s]^=this._lastCipherblock[s];this._lastCipherblock=this._aes.encrypt(i),R(this._lastCipherblock,t,r)}return t},jr.prototype.decrypt=function(e){if((e=a(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=C(e.length),i=C(16),r=0;r<e.length;r+=16){R(e,i,0,r,r+16);for(var i=this._aes.decrypt(i),s=0;s<16;s++)t[r+s]=i[s]^this._lastCipherblock[s];R(e,this._lastCipherblock,0,r,r+16)}return t},Ur.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t=a(e,!0),i=0;i<t.length;i+=this.segmentSize){for(var r=this._aes.encrypt(this._shiftRegister),s=0;s<this.segmentSize;s++)t[i+s]^=r[s];R(this._shiftRegister,this._shiftRegister,0,this.segmentSize),R(t,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return t},Ur.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t=a(e,!0),i=0;i<t.length;i+=this.segmentSize){for(var r=this._aes.encrypt(this._shiftRegister),s=0;s<this.segmentSize;s++)t[i+s]^=r[s];R(this._shiftRegister,this._shiftRegister,0,this.segmentSize),R(e,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return t},Nr.prototype.decrypt=Nr.prototype.encrypt=function(e){for(var t=a(e,!0),i=0;i<t.length;i++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[i]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},zr.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;0<=t;--t)this._counter[t]=e%256,e=parseInt(e/256)},zr.prototype.setBytes=function(e){if(16!=(e=a(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},zr.prototype.increment=function(){for(var e=15;0<=e;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};Gr.prototype.decrypt=Gr.prototype.encrypt=function(e){for(var t=a(e,!0),i=0;i<t.length;i++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[i]^=this._remainingCounter[this._remainingCounterIndex++];return t};const Hr={AES:L,Counter:zr,ModeOfOperation:{ecb:Fr,cbc:jr,cfb:Ur,ofb:Nr,ctr:Gr},utils:{hex:vr,utf8:br},padding:{pkcs7:{pad:function(e){var t=16-(e=a(e,!0)).length%16,i=C(e.length+t);R(e,i);for(var r=e.length;r<i.length;r++)i[r]=t;return i},strip:function(e){if((e=a(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(16<t)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,r=0;r<t;r++)if(e[i+r]!==t)throw new Error("PKCS#7 invalid padding byte");var s=C(i);return R(e,s,0,0,i),s}}},_arrayTest:{coerceArray:a,createArray:C,copyArray:R}};class Vr extends Vi{constructor(e){super(e),this.input=new Ji(this.demux()),e.debug.log("FlvDemux","init")}destroy(){super.destroy(),this.input=null,this.player.debug.log("FlvDemux","destroy")}dispatch(e){this.input?this.input.write(e):this.player&&this.player.debug.warn("FlvDemux","dispatch() this.input is null")}*demux(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),r=this.player;for(;;){if(!this.input)return;t[3]=0;const e=yield 15,l=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];var s=i[0],a=(t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11],i[0]),n=(yield s).slice();if(!r)return;switch(l){case 8:r._opt.hasAudio&&(r.updateStats({abps:n.byteLength}),0<n.byteLength)&&this._doDecode(n,1,a);break;case 9:if(r._opt.hasVideo){r.updateStats({vbps:n.byteLength,dts:a});const t=n[0]>>4&15,c=1==t;if(1!=t&&2!=t&&r.debug.warn("FlvDemux",`frameType is ${t} is not keyFrame or interFrame`),c&&this.calcIframeIntervalTimestamp(a),0<n.byteLength){i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;var o=i[0];r._times.demuxStart||(r._times.demuxStart=A());let e=n;r._opt.isCrypto&&(r._opt.cryptoKey&&0<r._opt.cryptoKey.byteLength&&r._opt.cryptoIV&&0<r._opt.cryptoIV.byteLength?e=function(t,i,r){i=new Uint8Array(i),r=new Uint8Array(r);const s=t.byteLength;let a=5;for(;a<s;){o=(o=t.slice(a,a+4))[3]|o[2]<<8|o[1]<<16|o[0]<<24;if(o>s)break;var n=t[a+4];if(1==(n&=31)||5==n){const s=t.slice(a+4+2,a+4+o);let e=new Hr.ModeOfOperation.ctr(i,new Hr.Counter(r));n=e.decrypt(s);e=null,t.set(n,a+4+2)}a=a+4+o}var o;return t}(n,r._opt.cryptoKey,r._opt.cryptoIV):r.debug.error("FlvDemux",`cryptoKey.length is ${r._opt.cryptoKey&&r._opt.cryptoKey.byteLength} or cryptoIV.length is ${r._opt.cryptoIV&&r._opt.cryptoIV.byteLength} null`)),this._doDecode(e,2,a,c,o)}}break;default:r.debug.log("FlvDemux","demux() type is "+l)}}}close(){this.input=null}getInputByteLength(){let e=0;return e=this.input&&this.input.buffer?this.input.buffer.byteLength:e}}class Wr extends Vi{constructor(e){super(e),e.debug.log("M7sDemux","init")}destroy(){super.destroy(),this.player.debug.log("M7sDemux","destroy")}dispatch(t){const i=this.player,r=new DataView(t),s=r.getUint8(0),a=r.getUint32(1,!1);switch(s){case 1:if(i._opt.hasAudio){const r=new Uint8Array(t,5);i.updateStats({abps:r.byteLength}),0<r.byteLength&&this._doDecode(r,s,a)}break;case 2:if(i._opt.hasVideo)if(i._times.demuxStart||(i._times.demuxStart=A()),5<r.byteLength){var n=new Uint8Array(t,5),o=r.getUint8(5)>>4==1;let e=a;this.player._opt.useMSE&&c(this.player.mseDecoder.firstRenderTime)&&(e=a-this.player.mseDecoder.firstRenderTime),i.updateStats({vbps:n.byteLength,dts:e}),0<n.byteLength&&(o&&this.calcIframeIntervalTimestamp(a),this._doDecode(n,s,a,o))}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",r.byteLength)}}}class Kr extends Vr{constructor(e){super(e),e.debug.log("WebTransportDemux","init")}destroy(){this.player.debug.log("WebTransportDemux","destroy"),super.destroy()}}class $r extends Vi{TAG_NAME="NakedFlowDemux";constructor(e){super(e),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.localDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.localDts=0,this.localAudioDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,this.player.debug.log(this.TAG_NAME,"destroy")}dispatch(e){this.player;e=new Uint8Array(e);this.extractNALu$2(e)}addNaluToBuffer(e){var t=e.byteLength+this.tempNaluBufferList.byteLength,t=new Uint8Array(t);t.set(this.tempNaluBufferList,0),t.set(e,this.tempNaluBufferList.byteLength),this.tempNaluBufferList=t}downloadNakedFlowFile(){var e=new Blob([this.tempNaluBufferList]);try{var t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".h264",t.click()}catch(e){console.error("downloadTempNalu",e)}}getNaluDts(){var e=this.player._opt.nakedFlowFps;return this.localDts=this.localDts+parseInt(1e3/e),this.localDts}getNaluAudioDts(){var e=this.player.audio.audioContext.sampleRate,t=this.player.audio.audioBufferSize;return this.localDts+parseInt(t/e*1e3)}extractNALu(e){let t,i,r=0,s=e.byteLength,a=0,n=[];for(;r<s;)switch(t=e[r++],a){case 0:0===t&&(a=1);break;case 1:a=0===t?2:0;break;case 2:case 3:a=0===t?3:(1===t&&r<s&&(e[r],i&&n.push(e.subarray(i,r-a-1)),i=r),0)}return i&&n.push(e.subarray(i,s)),n}extractNALu$2(t){let a=null;if(t&&!(t.byteLength<1)){this.lastBuf?((a=new Uint8Array(t.byteLength+this.lastBuf.length)).set(this.lastBuf),a.set(new Uint8Array(t),this.lastBuf.length)):a=new Uint8Array(t);let i=0,r=-1,s=-2;var n=new Array;for(let t=0;t<a.length;t+=2){const e=a[t],o=a[t+1];0==r&&0==e&&0==o?n.push(t-1):1==o&&0==e&&0==r&&0==s&&n.push(t-2),s=e,r=o}if(1<n.length)for(let t=0;t<n.length-1;++t){const e=a.subarray(n[t],n[t+1]+1);this.handleNALu(e),i=n[t+1]}else i=n[0];if(0!=i&&i<a.length)this.lastBuf=a.subarray(i);else{this.lastBuf||(this.lastBuf=a);const e=new Uint8Array(this.lastBuf.length+t.byteLength);e.set(this.lastBuf),e.set(new Uint8Array(t),this.lastBuf.length),this.lastBuf=e}}}handleNALu(e){e.byteLength<4?this.player.debug.warn(this.TAG_NAME,`handleNALu nalu byteLength is ${e.byteLength} <= 4`):(e=e.slice(4),this.handleVideoNalu(e))}handleVideoNalu(e){const t=new Uint8Array(e);if(this.streamVideoType||(this.streamVideoType=function(e){let t=null,i=31&e[0];return t=(t=7!=i&&8!=i?t:he)||32!=(i=(126&e[0])>>1)&&33!=i&&34!=i?t:pe}(t)),this.streamVideoType===he){const e=this.handleAddNaluStartCode(t),i=this.extractNALu(e);if(0===i.length)this.player.debug.warn(this.TAG_NAME,"handleVideoNalu","naluList.length === 0");else{const r=[];if(i.forEach(e=>{var t=Pi(e);8===t||7===t?this.handleVideoH264Nalu(e):Mi(t)&&r.push(e)}),1===r.length)this.handleVideoH264Nalu(r[0]);else{const e=function(t){if(0===t.length)return!1;var i=Pi(t[0]);for(let e=1;e<t.length;e++)if(i!==Pi(t[e]))return!1;return!0}(r);if(e){const e=Pi(r[0]),t=5===e;this.handleVideoH264NaluList(r,t,e)}else r.forEach(e=>{this.handleVideoH264Nalu(e)})}}}else this.streamVideoType===pe?34===ji(t)?this.extractH265PPS(t):this.handleVideoH265Nalu(t):this.player.debug.error(this.TAG_NAME," this.streamVideoType is null")}extractH264PPS(e){e=this.handleAddNaluStartCode(e);this.extractNALu(e).forEach(e=>{Bi(Pi(e))?this.extractH264SEI(e):this.handleVideoH264Nalu(e)})}extractH265PPS(e){e=this.handleAddNaluStartCode(e);this.extractNALu(e).forEach(e=>{39===ji(e)?this.extractH265SEI(e):this.handleVideoH265Nalu(e)})}extractH264SEI(e){e=this.handleAddNaluStartCode(e);this.extractNALu(e).forEach(e=>{this.handleVideoH264Nalu(e)})}extractH265SEI(e){e=this.handleAddNaluStartCode(e);this.extractNALu(e).forEach(e=>{this.handleVideoH265Nalu(e)})}handleAddNaluStartCode(e){var t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i}handleAudioAACNalu(t){if(t&&!(t.byteLength<1)){this.streamAudioType||(this.streamAudioType=fe.AAC);let e=new Uint8Array(t);var i=e.slice(0,7);if(e=e.slice(7),!this.isSendAACSeqHeader){const t=(192&i[2])>>6,e=(60&i[2])>>2,r=(1&i[2])<<2|(192&i[3])>>6,s=new Uint8Array([175,0,t<<3|(14&e)>>1,(1&e)<<7|r<<3]);this.isSendAACSeqHeader=!0,this._doDecode(s,1,0,!1,0)}const r=this.getNaluAudioDts(),s=new Uint8Array(e.length+2);s.set([175,1],0),s.set(e,2),this._doDecode(s,1,r,!1,0)}}handleAudioG711ANalu(e){var t,i;!e||e.byteLength<1||(this.streamAudioType||(this.streamAudioType=fe.ALAW),e=new Uint8Array(e),t=this.getNaluAudioDts(),(i=new Uint8Array(e.length+1)).set([114],0),i.set(e,1),this._doDecode(i,1,t,!1,0))}handleAudioG711UNalu(e){var t,i;!e||e.byteLength<1||(this.streamAudioType||(this.streamAudioType=fe.MULAW),e=new Uint8Array(e),t=this.getNaluAudioDts(),(i=new Uint8Array(e.length+1)).set([130],0),i.set(e,1),this._doDecode(i,1,t,!1,0))}handleVideoH264Nalu(e){var t,i,r,s=Pi(e);switch(s){case 7:this.sps=e;break;case 8:this.pps=e}if(this.isSendSeqHeader)if(Mi(s)){this.player._times.demuxStart||(this.player._times.demuxStart=A());const a=5===s,n=this.getNaluDts(),o=(t=e,(i=[])[0]=a?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=t.byteLength>>24&255,i[6]=t.byteLength>>16&255,i[7]=t.byteLength>>8&255,i[8]=255&t.byteLength,(r=new Uint8Array(i.length+t.byteLength)).set(i,0),r.set(t,i.length),r);this.player.updateStats({vbps:o.byteLength,dts:n}),a&&this.calcIframeIntervalTimestamp(n),this._doDecode(o,2,n,a,0)}else this.player.debug.warn(this.TAG_NAME,"handleVideoH264Nalu is avc seq head nalType is "+s);else if(this.sps&&this.pps){this.isSendSeqHeader=!0;const e=function(e){let{sps:t,pps:i}=e,r=8+t.byteLength+1+2+i.byteLength,s=!1;var e=P.parseSPS$2(t),a=(66!==t[3]&&77!==t[3]&&88!==t[3]&&(s=!0,r+=4),new Uint8Array(r)),n=(a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225,t.byteLength),o=(a[6]=n>>>8,a[7]=255&n,8),n=(a.set(t,8),a[o+=n]=1,i.byteLength),n=(a[o+1]=n>>>8,a[o+2]=255&n,a.set(i,o+3),o+=3+n,s&&(a[o]=252|e.chroma_format_idc,a[o+1]=248|e.bit_depth_luma-8,a[o+2]=248|e.bit_depth_chroma-8,a[o+3]=0,o+=4),[23,0,0,0,0]),e=new Uint8Array(n.length+a.byteLength);return e.set(n,0),e.set(a,n.length),e}({sps:this.sps,pps:this.pps});this._doDecode(e,2,0,!0,0)}}handleVideoH264NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=A());const i=this.getNaluDts(),a=(e=e.reduce((e,t)=>{var e=Ii(e),t=Ii(t),i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i}),(r=[])[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,(s=new Uint8Array(r.length+e.byteLength)).set(r,0),s.set(e,r.length),s);this.player.updateStats({vbps:a.byteLength,dts:i}),t&&this.calcIframeIntervalTimestamp(i),this._doDecode(a,2,i,t,0)}else this.player.debug.warn(this.TAG_NAME,"handleVideoH264NaluList isSendSeqHeader is false");var r,s}handleVideoH265Nalu(e){var t,i,r=ji(e);switch(r){case 32:this.vps=e;break;case 33:this.sps=e;break;case 34:this.pps=e}if(this.isSendSeqHeader){if(!(32<=r&&r<=40)){this.player._times.demuxStart||(this.player._times.demuxStart=A());const s=16<=r&&r<=21,a=this.getNaluDts(),n=(r=e,(t=[])[0]=s?28:44,t[1]=1,t[2]=0,t[3]=0,t[4]=0,t[5]=r.byteLength>>24&255,t[6]=r.byteLength>>16&255,t[7]=r.byteLength>>8&255,t[8]=255&r.byteLength,(i=new Uint8Array(t.length+r.byteLength)).set(t,0),i.set(r,t.length),i);this.player.updateStats({vbps:n.byteLength,dts:a}),s&&this.calcIframeIntervalTimestamp(a),this._doDecode(n,2,a,s,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=function(e){var{vps:e,pps:t,sps:i}=e,r={configurationVersion:1},s=(e=>{e=Oi(e),e=new Di(e);return e.readByte(),e.readByte(),e.readBits(4),e.readBits(2),e.readBits(6),{num_temporal_layers:e.readBits(3)+1,temporal_id_nested:e.readBool()}})(e),a=(e=>{let t=Oi(e),a=new Di(t),i=(a.readByte(),a.readByte(),0),r=0,s=0,n=0;a.readBits(4);var o=a.readBits(3),e=(a.readBool(),a.readBits(2)),l=a.readBool(),c=a.readBits(5),d=a.readByte(),u=a.readByte(),h=a.readByte(),p=a.readByte(),f=a.readByte(),g=a.readByte(),m=a.readByte(),O=a.readByte(),F=a.readByte(),j=a.readByte(),A=a.readByte(),y=[],U=[];for(let e=0;e<o;e++)y.push(a.readBool()),U.push(a.readBool());if(0<o)for(let e=o;e<8;e++)a.readBits(2);for(let e=0;e<o;e++)y[e]&&(a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte()),y[e]&&a.readByte();a.readUEG();var b,v=a.readUEG(),N=(3==v&&a.readBits(1),a.readUEG()),z=a.readUEG(),E=(a.readBool()&&(i+=a.readUEG(),r+=a.readUEG(),s+=a.readUEG(),n+=a.readUEG()),a.readUEG()),G=a.readUEG(),H=a.readUEG();for(let e=a.readBool()?0:o;e<=o;e++)a.readUEG(),a.readUEG(),a.readUEG();if(a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readBool()&&a.readBool())for(let t=0;t<4;t++)for(let e=0;e<(3===t?2:6);e++)if(a.readBool()){var V=Math.min(64,1<<4+(t<<1));1<t&&a.readSEG();for(let e=0;e<V;e++)a.readSEG()}else a.readUEG();a.readBool(),a.readBool(),a.readBool()&&(a.readByte(),a.readUEG(),a.readUEG(),a.readBool());let w=a.readUEG(),T=0;for(let t=0;t<w;t++){let e=!1;if(e=0!==t?a.readBool():e){t===w&&a.readUEG(),a.readBool(),a.readUEG();let i=0;for(let e=0;e<=T;e++){let e=a.readBool(),t=!1;e||(t=a.readBool()),(e||t)&&i++}T=i}else{var S=a.readUEG(),k=a.readUEG();T=S+k;for(let e=0;e<S;e++)a.readUEG(),a.readBool();for(let e=0;e<k;e++)a.readUEG(),a.readBool()}}if(a.readBool()){var W=a.readUEG();for(let e=0;e<W;e++){for(let e=0;e<H+4;e++)a.readBits(1);a.readBits(1)}}let _=0,C=1,R=1,D=!1,L=1,x=1;if(a.readBool(),a.readBool(),a.readBool()){if(a.readBool()&&(0<(b=a.readByte())&&b<16?(C=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][b-1],R=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][b-1]):255===b&&(C=a.readBits(16),R=a.readBits(16))),a.readBool()&&a.readBool(),a.readBool()&&(a.readBits(3),a.readBool(),a.readBool())&&(a.readByte(),a.readByte(),a.readByte()),a.readBool()&&(a.readUEG(),a.readUEG()),a.readBool(),a.readBool(),a.readBool(),a.readBool()&&(i+=a.readUEG(),r+=a.readUEG(),s+=a.readUEG(),n+=a.readUEG()),a.readBool()&&(L=a.readBits(32),x=a.readBits(32),a.readBool())&&(a.readUEG(),a.readBool())){let i,r,s=!1;i=a.readBool(),r=a.readBool(),(i||r)&&((s=a.readBool())&&(a.readByte(),a.readBits(5),a.readBool(),a.readBits(5)),a.readBits(4),a.readBits(4),s&&a.readBits(4),a.readBits(5),a.readBits(5),a.readBits(5));for(let e=0;e<=o;e++){var I=a.readBool();D=I;let e=!1,t=!1;if((e=I?e:a.readBool())?a.readSEG():t=a.readBool(),t||(cpbcnt=a.readUEG()+1),i)for(let e=0;e<1;e++)a.readUEG(),a.readUEG(),s&&(a.readUEG(),a.readUEG());if(r)for(let e=0;e<1;e++)a.readUEG(),a.readUEG(),s&&(a.readUEG(),a.readUEG())}}a.readBool()&&(a.readBool(),a.readBool(),a.readBool(),_=a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG())}a.readBool();let K=`hvc1.${c}.1.L${A}.B0`,P=N,B=z,M=1;return 1!==C&&1!==R&&(M=C/R),a.destroy(),a=null,{codec_mimetype:K,level_string:(A/30).toFixed(1),profile_idc:c,bit_depth:E+8,ref_frames:1,chroma_format:v,chroma_format_string:(e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}})(v),general_level_idc:A,general_profile_space:e,general_tier_flag:l,general_profile_idc:c,general_profile_compatibility_flags_1:d,general_profile_compatibility_flags_2:u,general_profile_compatibility_flags_3:h,general_profile_compatibility_flags_4:p,general_constraint_indicator_flags_1:f,general_constraint_indicator_flags_2:g,general_constraint_indicator_flags_3:m,general_constraint_indicator_flags_4:O,general_constraint_indicator_flags_5:F,general_constraint_indicator_flags_6:j,min_spatial_segmentation_idc:_,constant_frame_rate:0,chroma_format_idc:v,bit_depth_luma_minus8:E,bit_depth_chroma_minus8:G,frame_rate:{fixed:D,fps:x/L,fps_den:L,fps_num:x},sar_ratio:{width:C,height:R},codec_size:{width:P,height:B},present_size:{width:P*M,height:B}}})(i),n=(e=>{e=Oi(e),e=new Di(e);e.readByte(),e.readByte(),e.readUEG(),e.readUEG(),e.readBool(),e.readBool(),e.readBits(3),e.readBool(),e.readBool(),e.readUEG(),e.readUEG(),e.readSEG(),e.readBool(),e.readBool(),e.readBool()&&e.readUEG(),e.readSEG(),e.readSEG(),e.readBool(),e.readBool(),e.readBool(),e.readBool();let t=e.readBool(),i=e.readBool(),r=1;return i&&t?r=0:i?r=3:t&&(r=2),{parallelismType:r}})(t),r=Object.assign(r,s,a,n),s=23+(5+e.byteLength)+(5+i.byteLength)+(5+t.byteLength),n=((a=new Uint8Array(s))[0]=1,a[1]=(3&r.general_profile_space)<<6|(r.general_tier_flag?1:0)<<5|31&r.general_profile_idc,a[2]=r.general_profile_compatibility_flags_1||0,a[3]=r.general_profile_compatibility_flags_2||0,a[4]=r.general_profile_compatibility_flags_3||0,a[5]=r.general_profile_compatibility_flags_4||0,a[6]=r.general_constraint_indicator_flags_1||0,a[7]=r.general_constraint_indicator_flags_2||0,a[8]=r.general_constraint_indicator_flags_3||0,a[9]=r.general_constraint_indicator_flags_4||0,a[10]=r.general_constraint_indicator_flags_5||0,a[11]=r.general_constraint_indicator_flags_6||0,a[12]=60,a[13]=240|(3840&r.min_spatial_segmentation_idc)>>8,a[14]=255&r.min_spatial_segmentation_idc,a[15]=252|3&r.parallelismType,a[16]=252|3&r.chroma_format_idc,a[17]=248|7&r.bit_depth_luma_minus8,a[18]=248|7&r.bit_depth_chroma_minus8,a[19]=0,a[20]=0,a[21]=(3&r.constant_frame_rate)<<6|(7&r.num_temporal_layers)<<3|(r.temporal_id_nested?1:0)<<2|3,a[22]=3,a[23]=160,a[24]=0,a[25]=1,a[26]=(65280&e.byteLength)>>8,a[27]=(255&e.byteLength)>>0,a.set(e,28),a[23+(5+e.byteLength)+0]=161,a[23+(5+e.byteLength)+1]=0,a[23+(5+e.byteLength)+2]=1,a[23+(5+e.byteLength)+3]=(65280&i.byteLength)>>8,a[23+(5+e.byteLength)+4]=(255&i.byteLength)>>0,a.set(i,23+(5+e.byteLength)+5),a[23+(5+e.byteLength+5+i.byteLength)+0]=162,a[23+(5+e.byteLength+5+i.byteLength)+1]=0,a[23+(5+e.byteLength+5+i.byteLength)+2]=1,a[23+(5+e.byteLength+5+i.byteLength)+3]=(65280&t.byteLength)>>8,a[23+(5+e.byteLength+5+i.byteLength)+4]=(255&t.byteLength)>>0,a.set(t,23+(5+e.byteLength+5+i.byteLength)+5),[28,0,0,0,0]);return(s=new Uint8Array(n.length+a.byteLength)).set(n,0),s.set(a,n.length),s}({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(e,2,0,!0,0)}}getInputByteLength(){let e=0;return e=this.lastBuf?this.lastBuf.byteLength:e}}class Jr extends Vi{constructor(e){super(e),(this.player=e).debug.log("EmptyDemux","init")}destroy(){super.destroy(),this.player.debug.log("EmptyDemux","destroy")}}class qr{constructor(e){return new(qr.getLoaderFactory(e._opt.demuxType))(e)}static getLoaderFactory(e){return"m7s"===e?Wr:e===z?Vr:e===G?Kr:e===H?$r:Jr}}class Qr extends e{constructor(e){super(),this.player=e,this.hasInit=!1,this.isDecodeFirstIIframe=!1,this.isInitInfo=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.decoder=null,this.isWidthOrHeightChanged=!1,this.initDecoder(),e.debug.log("Webcodecs","init")}destroy(){this.decoder&&("closed"!==this.decoder.state&&this.decoder.close(),this.decoder=null),this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.hasInit=!1,this.isInitInfo=!1,this.isDecodeFirstIIframe=!1,this.isWidthOrHeightChanged=!1,this.off(),this.player.debug.log("Webcodecs","destroy")}initDecoder(){const t=this;this.decoder=new VideoDecoder({output(e){t.handleDecode(e)},error(e){t.handleError(e)}})}handleDecode(e){this.isInitInfo||(this.player.video.updateVideoInfo({width:e.codedWidth,height:e.codedHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player._times.videoStart||(this.player._times.videoStart=A(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender(),this.player.updateStats({dfps:!0,buf:this.player.demux&&this.player.demux.delay||0})}handleError(e){this.player.debug.error("Webcodecs","VideoDecoder handleError:",e.code,e);e=e.toString();-1!==e.indexOf("Unsupported configuration")&&this.player.emitError(m.webcodecsUnsupportedConfigurationError,e)}decodeVideo(i,r,s,a){if(this.hasInit)if(this.isDecodeFirstIIframe||s||this.player.debug.warn("Webcodecs","VideoDecoder isDecodeFirstIIframe false and isIframe is false"),!this.isDecodeFirstIIframe&&s&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(s&&0===i[1]){const r=15&i[0];let e={};7==r?e=xi(i.slice(5)):12==r&&(e=Fi(i));const a=this.player.video.videoInfo;a&&a.width&&a.height&&e&&e.codecWidth&&e.codecHeight&&(e.codecWidth!==a.width||e.codecHeight!==a.height)&&(this.player.debug.warn("Webcodecs",`decodeVideo: video width or height is changed, old width is ${videoWidth}, old height is ${videoHeight}, new width is ${e.codecWidth}, new height is ${e.codecHeight}, and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(m.wcsWidthOrHeightChange))}if(this.isWidthOrHeightChanged)this.player.debug.warn("Webcodecs","decodeVideo: video width or height is changed, and return");else if(Mt(i))this.player.debug.warn("Webcodecs","decodeVideo and payload is video sequence header so drop this frame");else if(i.byteLength<12)this.player.debug.warn("Webcodecs","decodeVideo and payload is too small , payload length is "+i.byteLength);else{let e=!1,t=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=t,e=!0);var n=t-this.prevTimestamp,n=(((this.decodeDiffTimestamp=n)<5||500<n)&&!e&&this.player.debug.warn("Webcodecs","decodeVideo diff time is ",n),i.slice(5)),o=new EncodedVideoChunk({data:n,timestamp:r,type:s?"key":"delta"});this.player.emit(E.timeUpdate,r),this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===p&&this.player.recorder.handleAddNaluTrack(n,s,r,a);try{if(this.isDecodeStateClosed())return void this.player.debug.warn("Webcodecs","VideoDecoder isDecodeStateClosed true");this.decoder.decode(o)}catch(i){this.player.debug.error("Webcodecs","VideoDecoder",i);const r=i.toString();-1===r.indexOf("A key frame is required after configure() or flush()")&&-1===r.indexOf("Cannot call 'decode' on a closed codec")||this.player.emit(m.webcodecsDecodeError)}this.prevTimestamp=(new Date).getTime()}}else this.player.debug.warn("Webcodecs","VideoDecoder isDecodeFirstIIframe false");else if(s&&0===i[1]){const r=15&i[0];if(this.player.video.updateVideoInfo({encTypeCode:r}),12!=r||dt()){this.player._times.decodeStart||(this.player._times.decodeStart=A());let e=null;const a=i.slice(5);7==r?e=function(e){let i=e.subarray(1,4),r="avc1.";for(let t=0;t<3;t++){let e=i[t].toString(16);e.length<2&&(e="0"+e),r+=e}return{codec:r,description:e}}(a):12==r&&((n=a).subarray(1,4),e={codec:"hev1.1.6.L120.90",description:n}),this.player.recorder&&this.player._opt.recordType===p&&this.player.recorder.initMetaData(i,r),this.player.debug.log("Webcodecs","decodeVideo and webcodecs configure");try{this.decoder.configure(e),this.hasInit=!0}catch(i){this.player.debug.log("Webcodecs","configure error",i.code,i)}}else{const i=it();this.player.debug.warn("Webcodecs","WebcodecsDecoder not support hevc decode",i.type,i.version),void this.emit(m.webcodecsH265NotSupport)}}}getDecodeDiffTimes(){return this.decodeDiffTimestamp}isDecodeStateClosed(){return"closed"===this.decoder.state}}const Yr={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"加载",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制",narrow:"缩小",expand:"放大",ptz:"操作盘",ptzActive:"操作盘激活",zoom:"电子放大",zoomStop:"关闭电子放大",close:"关闭",performance:"性能面板",performanceActive:"性能面板激活",face:"人脸识别",faceActive:"人脸识别激活"};var x=Object.keys(Yr).reduce((e,t)=>(e[t]=`
  10. <i class="jessibuca-icon jessibuca-icon-${t}"></i>
  11. ${Yr[t]?`<span class="icon-title-tips"><span class="icon-title">${Yr[t]}</span></span>`:""}
  12. `,e),{});function Xr(e,t){let i=!1;return e.forEach(e=>{i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)}),i}function Zr(e,t,i){let r=0<arguments.length&&void 0!==e?e:[],s=1<arguments.length&&void 0!==t?t:[],a=2<arguments.length?i:void 0;const n=r.length,o=s.length,l=Math.max(n,o),c=2e3,d=Math.ceil(l/c);let u=0,h=0;!function e(){let t="",i="";for(let e=0;e<c;e++){const a=r[h],c=(a&&(t+=`
  13. <div class="jessibuca-playback-time-minute-one${a.hasRecord?" active":""}${a.isStart?" start":""}" data-has-record="${a.hasRecord}"
  14. data-time="${a.timestamp}" data-type="${a.dataType}">
  15. <span class="jessibuca-playback-time-title-tips ${h>n-60?"jessibuca-playback-time-title-tips-left":""}"><span class="jessibuca-playback-time-title">${a.title}</span></span>
  16. </div>
  17. `),s[h]);c&&(i+=`
  18. <div class="jessibuca-playback-time-hour" data-hour="${c.hour}" data-min="${c.min}" data-second="${c.second}"><span class="jessibuca-playback-time-hour-text">${c.title}</span></div>
  19. `),h+=1}t&&a.$playbackTimeListOne.insertAdjacentHTML("beforeend",t),i&&a.$playbackTimeListSecond.insertAdjacentHTML("beforeend",i),(u+=1)<d&&(a.rafId=window.requestAnimationFrame(e))}()}function es(e,t){Zr(function(e){var i,r,s,a=0<arguments.length&&void 0!==e?e:[],n=[],o=(a[0]||{}).startTimestamp;for(let t=0;t<1440;t++){var l=t%60==0;let e=!1;o&&(e=Xr(a,(i=o,r=t,s=void 0,s=Math.floor(r/60)%60,r=Math.floor(r%60),new Date(i).setHours(s,r,0,0)))),n.push({title:function(e,t){let i="";var r;return-1<e&&(r=Math.floor(e/60)%60,e=e%60,e=Math.round(e),i=r<10?"0"+r+":":r+":",e<10&&(i+="0"),i+=e,pt(t)||(t<10&&(t="0"+t),i+=":"+t)),i}(t),timestamp:t,dataType:"min",hasRecord:e,isStart:l})}return n}(e),function(){var i=[];for(let t=0;t<24;t++){let e=t+":00";t<10&&(e="0"+e),i.push({title:e,hour:t,min:0,second:0})}return i}(),t)}var ts=(y,b)=>{const s=y["events"]["proxy"],a=document.createElement("object");a.setAttribute("aria-hidden","true"),a.setAttribute("tabindex",-1),a.type="text/html",a.data="about:blank",w(a,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});let n=y.width,e=y.height;const t=lt(()=>{y.width===n&&y.height===e||(n=y.width,e=y.height,y.emit(E.resize),l())},500),i=(s(a,"load",()=>{s(a.contentDocument.defaultView,"resize",()=>{t()})}),y.$container.appendChild(a),y.on(E.destroy,()=>{y.$container.removeChild(a)}),y.on(E.volumechange,()=>{var e,t,i;0===(e=y.volume)?(w(b.$volumeOn,"display","none"),w(b.$volumeOff,"display","flex"),w(b.$volumeHandle,"top","48px")):b.$volumeHandle&&b.$volumePanel&&(t=Xe(b.$volumePanel,"height")||60,i=Xe(b.$volumeHandle,"height"),w(b.$volumeHandle,"top",t-(t-i)*e-i+"px"),w(b.$volumeOn,"display","flex"),w(b.$volumeOff,"display","none")),b.$volumePanelText&&(b.$volumePanelText.innerHTML=parseInt(100*e))}),y.on(E.loading,e=>{w(b.$loading,"display",e?"flex":"none"),(k(y._opt.backgroundLoadingShow)&&S(e)||k(e))&&w(b.$poster,"display","none"),e&&w(b.$playBig,"display","none"),g()||e||(b.$loadingBgImage.width=0,b.$loadingBgImage.height=0,b.$loadingBgImage.src="",w(b.$loadingBg,"display","none"))}),e=>{y.fullscreen&&kt(e)!==y.$container||r()}),r=e=>{e=ft(e)?e:y.fullscreen;w(b.$fullscreenExit,"display",e?"flex":"none"),w(b.$fullscreen,"display",e?"none":"flex")},o=()=>y._opt.playType===v&&y._opt.playbackConfig.showControl,l=i=>{g()&&b.$controls&&y._opt.useWebFullScreen&&setTimeout(()=>{if(y.fullscreen){const i=o()?48:38;var e=y.height/2-y.width+i/2,t=y.height/2-i/2;b.$controls.style.transform=`translateX(${-e}px) translateY(-${t}px) rotate(-90deg)`}else b.$controls.style.transform="translateX(0) translateY(0) rotate(0)";i&&i()},10)};try{f.on("change",i),y.events.destroys.push(()=>{f.off("change",i)})}catch(y){}y.on(E.webFullscreen,e=>{g()&&(r(e),l(()=>{d()}))}),y.on(E.recording,()=>{y.playing&&(w(b.$record,"display",y.recording?"none":"flex"),w(b.$recordStop,"display",y.recording?"flex":"none"),y._opt.hasControl||y._opt.isShowRecordingUI)&&w(b.$recording,"display",y.recording?"flex":"none")}),y.on(E.recordingTimestamp,e=>{b.$recordingTime&&(b.$recordingTime.innerHTML=yt(e))}),y.on(E.zooming,()=>{y.playing&&(w(b.$zoom,"display",y.zooming?"none":"flex"),w(b.$zoomStop,"display",y.zooming?"flex":"none"),y._opt.hasControl||y._opt.isShowZoomingUI)&&w(b.$zoomControls,"display",y.zooming?"flex":"none")}),y.on(E.playing,e=>{c(e)});const c=t=>{w(b.$play,"display",t?"none":"flex"),w(b.$playBig,"display",t?"none":"block"),w(b.$pause,"display",t?"flex":"none"),w(b.$screenshot,"display",t?"flex":"none"),w(b.$record,"display",t?"flex":"none"),w(b.$qualityMenu,"display",t?"flex":"none"),w(b.$volume,"display",t?"flex":"none"),w(b.$ptz,"display",t?"flex":"none"),w(b.$zoom,"display",t?"flex":"none"),w(b.$scaleMenu,"display",t?"flex":"none"),w(b.$faceDetect,"display",t?"flex":"none"),w(b.$controlHtml,"display",t?"flex":"none"),y.isPlayback()&&w(b.$speedMenu,"display",t?"flex":"none"),r(),b.extendBtnList.forEach(e=>{e.$iconWrap&&w(e.$iconWrap,"display",t?"flex":"none"),e.$activeIconWrap&&w(e.$activeIconWrap,"display","none")}),y._opt.showPerformance?w(b.$performanceActive,"display",t?"flex":"none"):w(b.$performance,"display",t?"flex":"none"),w(b.$poster,"display","none"),w(b.$ptzActive,"display","none"),w(b.$recordStop,"display","none"),w(b.$zoomStop,"display","none"),w(b.$faceDetectActive,"display","none"),t||(b.$speed&&(b.$speed.innerHTML="0 KB/s"),w(b.$zoomControls,"display","none"),w(b.$recording,"display","none"),b.$ptzControl&&b.$ptzControl.classList.remove("jessibuca-ptz-controls-show")),d()},d=(y.on(E.playbackPause,e=>{c(!e)}),y.on(E.kBps,e=>{e=function(e){if(null==e||""===e||0===parseFloat(e)||"NaN"===e)return"0 KB/s";var t=["KB/s","MB/s","GB/s","TB/s","PB/s","EB/s","ZB/s","YB/s"],e=parseFloat(e),i=Math.floor(Math.log(e)/Math.log(1024));let r=e/Math.pow(1024,i);return(r=r.toFixed(2))+(t[i]||t[0])}(e);b.kbpsShow=e,y._opt.showBandwidth&&(b.$speed&&(b.$speed.innerHTML=e),d())}),()=>{if(o()){let e=b.controlsInnerRect.width-b.controlsLeftRect.width-b.controlsRightRect.width-b.controlsPlaybackBtnsRect.width;g()&&y.webFullscreen&&(e=b.controlsInnerRect.height-b.controlsLeftRect.height-b.controlsRightRect.height-b.controlsPlaybackBtnsRect.height),b.$playbackTimeInner.style.width=e+"px"}});if(o()){const s=()=>{if(o()){let e=0;var t,i,r=y.playback&&y.playback.playingTimestamp;r&&(t=(r=new Date(r)).getHours(),i=r.getMinutes(),r=r.getSeconds(),y.playback.is60Min?e=60*t+i:y.playback.is30Min?e=2*(60*t+i)+parseInt(r/30,10):y.playback.is10Min?e=6*(60*t+i)+parseInt(r/10,10):y.playback.is5Min?e=12*(60*t+i)+parseInt(r/5,10):y.playback.is1Min&&(e=60*(60*t+i)+parseInt(r,10)),b.$playbackCurrentTime.style.left=e+"px")}},a=e=>{b.$playbackNarrow.classList.remove("disabled"),b.$playbackExpand.classList.remove("disabled"),e===we&&b.$playbackNarrow.classList.add("disabled"),e===Se&&b.$playbackExpand.classList.add("disabled")},n=()=>{var e=b.$playbackCurrentTime.style.left,e=parseInt(e,10),t=b.controlsPlaybackTimeInner.width,e=0<e-t/2?parseInt(e-t/2,10):0;b.$playbackTimeInner.scrollLeft=e};y._opt.showBandwidth&&(b.$controlsLeft.style.width="90px"),y.on(E.playbackTime,e=>{b.$playbackCurrentTimeText&&(b.$playbackCurrentTimeText.innerText=at(e,"{h}:{i}:{s}")),s()}),y.on(E.playbackPrecision,(i,r)=>{b.$playbackTimeScroll.classList.remove(ke.oneHour,ke.halfHour,ke.fiveMin,ke.tenMin),b.$playbackTimeScroll.classList.add(ke[i]),b.rafId&&(window.cancelAnimationFrame(b.rafId),b.rafId=null),b.changePercisitionInterval&&(clearTimeout(b.changePercisitionInterval),b.changePercisitionInterval=null),b.$playbackTimeListOne.innerHTML="",b.$playbackTimeListSecond.innerHTML="",b.changePercisitionInterval=setTimeout(()=>{switch(b.$playbackTimeListOne.innerHTML="",b.$playbackTimeListSecond.innerHTML="",i){case we:es(r,b);break;case Te:t=b,Zr(function(e){var s=0<arguments.length&&void 0!==e?e:[],a=[],n=(s[0]||{}).startTimestamp;for(let r=0;r<1440;r++){let e=60*r,t=e%1800==0,i=!1;n&&(i=Xr(s,vt(n,e))),a.push({title:bt(e),timestamp:e,dataType:"second",hasRecord:i,isStart:t});var o=60*r+30;t=o%1800==0,n&&(i=Xr(s,vt(n,o))),a.push({title:bt(o),timestamp:o,dataType:"second",hasRecord:i,isStart:t})}return a}(r),function(){var r=[];for(let i=0;i<24;i++){let e=i+":00",t=i+":30";i<10&&(e="0"+e,t="0"+t),r.push({title:e,hour:i,min:0,second:0}),r.push({title:t,hour:i,min:30,second:0})}return r}(),t);break;case"tenMin":t=b,Zr(function(e){var a=0<arguments.length&&void 0!==e?e:[],n=[],o=(a[0]||{}).startTimestamp;for(let s=0;s<144;s++)for(let r=0;r<60;r++){let e=10*r+600*s,t=e%600==0,i=!1;o&&(i=Xr(a,vt(o,e))),n.push({title:bt(e),timestamp:e,dataType:"second",isStart:t,hasRecord:i})}return n}(r),function(){var r=[];for(let i=0;i<24;i++){let t=i+":00";i<10&&(t="0"+t),r.push({title:t,hour:i,min:0,second:0});for(let e=1;e<6;e++){var s=e+"0";r.push({title:t.replace(":00",":"+s),hour:i,min:10*e,second:0})}}return r}(),t);break;case Se:e=b,Zr(function(e){var a=0<arguments.length&&void 0!==e?e:[],n=[],o=(a[0]||{}).startTimestamp;for(let s=0;s<288;s++)for(let r=0;r<60;r++){let e=5*r+300*s,t=e%300==0,i=!1;o&&(i=Xr(a,vt(o,e))),n.push({title:bt(e),timestamp:e,dataType:"second",isStart:t,hasRecord:i})}return n}(r),function(){var r=[];for(let i=0;i<24;i++){let t=i+":00";i<10&&(t="0"+t),r.push({title:t,hour:i,min:0,second:0}),r.push({title:t.replace(":00",":05"),hour:i,min:5,second:0});for(let e=1;e<6;e++){var s=e+"0",a=e+"5";r.push({title:t.replace(":00",":"+s),hour:i,min:10*e,second:0}),r.push({title:t.replace(":00",":"+a),hour:i,min:10*e+5,second:0})}}return r}(),e)}var e,t;s(),a(i),n()},16)}),y.on(E.resize,()=>{d()}),d()}if(y._opt.operateBtns.quality&&0<y._opt.qualityConfig.length){y.on(E.streamQualityChange,e=>{s(e)});const s=i=>{b.$qualityText.innerText=i,b.$qualityMenuItems.forEach(e=>{var t=e.dataset.quality;e.classList.remove("jessibuca-quality-menu-item-active"),t===i&&e.classList.add("jessibuca-quality-menu-item-active")})};{const h=y._opt.qualityConfig||[];let t="";h.forEach(e=>{t+=`
  20. <div class="jessibuca-quality-menu-item" data-quality="${e}">${e}</div>
  21. `}),t&&(b.$qualityMenuList.insertAdjacentHTML("beforeend",t),Object.defineProperty(b,"$qualityMenuItems",{value:y.$container.querySelectorAll(".jessibuca-quality-menu-item")}),setTimeout(()=>{var e=h[0];y.streamQuality=e},0))}y.streamQuality&&s(y.streamQuality)}if(y._opt.operateBtns.scale&&0<y._opt.scaleConfig.length){y.on(E.viewResizeChange,e=>{s(e)});const s=i=>{var e=y._opt.scaleConfig[i];b.$scaleText.innerText=e,b.$scaleMenuItems.forEach(e=>{var t=e.dataset.scale;e.classList.remove("jessibuca-scale-menu-item-active"),T(t)===T(i)&&e.classList.add("jessibuca-scale-menu-item-active")})};{var u=y._opt.scaleConfig||[];let i="";u.forEach((e,t)=>{i+=`
  22. <div class="jessibuca-scale-menu-item" data-scale="${t}">${e}</div>
  23. `}),i&&(b.$scaleMenuList.insertAdjacentHTML("beforeend",i),Object.defineProperty(b,"$scaleMenuItems",{value:y.$container.querySelectorAll(".jessibuca-scale-menu-item")}))}s(y.scaleType)}if(y.isPlayback()&&y._opt.playbackConfig.showRateBtn&&0<y._opt.playbackConfig.rateConfig.length){y.on(E.playbackRateChange,e=>{s(e)});const s=i=>{var e=y._opt.playbackConfig.rateConfig.find(e=>T(e.value)===T(i));e&&(b.$speedText.innerText=e.label,b.$speedMenuItems.forEach(e=>{var t=e.dataset.speed;e.classList.remove("jessibuca-speed-menu-item-active"),T(t)===T(i)&&e.classList.add("jessibuca-speed-menu-item-active")}))};{u=y._opt.playbackConfig.rateConfig;let i="";u.forEach((e,t)=>{i+=`
  24. <div class="jessibuca-speed-menu-item" data-speed="${e.value}">${e.label}</div>
  25. `}),i&&(b.$speedMenuList.insertAdjacentHTML("beforeend",i),Object.defineProperty(b,"$speedMenuItems",{value:y.$container.querySelectorAll(".jessibuca-speed-menu-item")}))}const a=y.playback?y.playback.playbackRate:1;s(a)}y.on(E.stats,function(){var e,t,i,r,s,a,n,o,l,c,d,u,h,p,f,g,m,A=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y._opt.showPerformance?(w(b.$performancePanel,"display","block"),b.$performancePanel.innerHTML="",e=y.video&&y.video.videoInfo||{},t=y.audio&&y.audio.audioInfo||{},i=y._times||{},r=y.getRenderType(),s=y.getCanvasRenderType(),a=y.getDecodeType(),n=y.getDemuxType(),o=y.getStreamType(),l=y.getAudioEngineType(),u=y.getRecordingDuration(),h=y.getRecordingByteLength(),c=y.isAudioPlaybackRateSpeed(),d=y.videoIframeIntervalTs,u=yt(u),h=null==(f=h)||""==f?"0 Bytes":(g=new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"),m=0,f=parseFloat(f),m=Math.floor(Math.log(f)/Math.log(1024)),(f/Math.pow(1024,m)).toFixed(2)+g[m]),f=y.isPlayback()?"录播":"直播",g=A.isDropping,m=y.control?y.control.kbpsShow:"0 KB/s",p=y.getVideoPlaybackQuality(),f=`
  26. <div class="jessibuca-performance-item">
  27. <span>版本 "6-3-2023"</span>
  28. </div>
  29. <div class="jessibuca-performance-item">
  30. <span>播放模式 ${f}</span>
  31. </div>
  32. ${y.isPlayback()?`
  33. <div class="jessibuca-performance-item">
  34. <span>播放倍率 ${y.playback.rate}倍</span>
  35. </div>
  36. <div class="jessibuca-performance-item">
  37. <span>播放模式 ${y.playback.isUseFpsRender?"固定FPS":"动态FPS"}</span>
  38. </div>
  39. ${y.playback.isUseFpsRender?`
  40. <div class="jessibuca-performance-item">
  41. <span>固定FPS ${y.video.getStreamFps()}</span>
  42. </div>
  43. `:""}
  44. `:""}
  45. <div class="jessibuca-performance-item">
  46. <span>解封装模式 ${V[n]}</span>
  47. </div>
  48. <div class="jessibuca-performance-item">
  49. <span>解码模式 ${a}</span>
  50. </div>
  51. <div class="jessibuca-performance-item">
  52. <span>渲染组件 ${r}</span>
  53. </div>
  54. ${r===W?`
  55. <div class="jessibuca-performance-item">
  56. <span>渲染引擎 ${s}</span>
  57. </div>
  58. `:""}
  59. <div class="jessibuca-performance-item">
  60. <span>网络请求组件 ${o}</span>
  61. </div>
  62. <div class="jessibuca-performance-item">
  63. <span>视频格式 ${e.encType||"-"}</span>
  64. </div>
  65. <div class="jessibuca-performance-item">
  66. <span>视频(宽x高) ${e.width||"-"}x${e.height||"-"}</span>
  67. </div>
  68. ${y.isPlayer()?`
  69. <div class="jessibuca-performance-item">
  70. <span>视频GOP(ms) ${d||"-"}</span>
  71. </div>
  72. `:""}
  73. <div class="jessibuca-performance-item">
  74. <span>音频格式 ${fe[t.encType]||"-"}</span>
  75. </div>
  76. <div class="jessibuca-performance-item">
  77. <span>音频引擎 ${l||"-"}</span>
  78. </div>
  79. <div class="jessibuca-performance-item">
  80. <span>音频通道 ${t.channels||"-"}</span>
  81. </div>
  82. <div class="jessibuca-performance-item">
  83. <span>音频采样率 ${t.sampleRate||"-"}</span>
  84. </div>
  85. ${y.isPlayer()?`
  86. <div class="jessibuca-performance-item">
  87. <span>播放器初始化(ms) ${i.playTimestamp}</span>
  88. </div>
  89. <div class="jessibuca-performance-item">
  90. <span>开始请求地址(ms) ${i.streamTimestamp}</span>
  91. </div>
  92. <div class="jessibuca-performance-item">
  93. <span>请求响应(ms) ${i.streamResponseTimestamp}</span>
  94. </div>
  95. <div class="jessibuca-performance-item">
  96. <span>解封装(ms) ${i.demuxTimestamp}</span>
  97. </div>
  98. <div class="jessibuca-performance-item">
  99. <span>解码(ms) ${i.decodeTimestamp}</span>
  100. </div>
  101. <div class="jessibuca-performance-item">
  102. <span>页面开始渲染(ms) ${i.videoTimestamp}</span>
  103. </div>
  104. <div class="jessibuca-performance-item">
  105. <span>初始化到页面渲染(ms) ${i.allTimestamp}</span>
  106. </div>
  107. ${y.recording?`
  108. <div class="jessibuca-performance-item">
  109. <span>视频录制时间 ${u}</span>
  110. </div>
  111. <div class="jessibuca-performance-item">
  112. <span>视频录制大小 ${h}</span>
  113. </div>
  114. `:""}
  115. `:""}
  116. <div class="jessibuca-performance-item">
  117. <span>音频码率(bit) ${A.abps}</span>
  118. </div>
  119. <div class="jessibuca-performance-item">
  120. <span>视频码率(bit) ${A.vbps}</span>
  121. </div>
  122. <div class="jessibuca-performance-item">
  123. <span>视频帧率(fps) ${A.fps}</span>
  124. </div>
  125. <div class="jessibuca-performance-item">
  126. <span>视频峰值帧率(fps) ${A.maxFps}</span>
  127. </div>
  128. <div class="jessibuca-performance-item">
  129. <span>解码帧率(fps) ${A.dfps}</span>
  130. </div>
  131. <div class="jessibuca-performance-item">
  132. <span>音频缓冲帧 ${A.audioBuffer}</span>
  133. </div>
  134. <div class="jessibuca-performance-item">
  135. <span>音频缓冲时长(ms) ${A.audioBufferDelayTs}</span>
  136. </div>
  137. ${y.isPlayer()?`
  138. <div class="jessibuca-performance-item">
  139. <span>视频待解码帧 ${A.demuxBuffer}</span>
  140. </div>
  141. `:`
  142. <div class="jessibuca-performance-item">
  143. <span>缓存时长(ms) ${A.playbackCacheDataDuration}</span>
  144. </div>
  145. <div class="jessibuca-performance-item">
  146. <span>视频待渲染帧 ${A.playbackVideoBuffer}</span>
  147. </div>
  148. <div class="jessibuca-performance-item">
  149. <span>视频待解码帧 ${A.demuxBuffer}</span>
  150. </div>
  151. <div class="jessibuca-performance-item">
  152. <span>音频待解码帧 ${A.audioDemuxBuffer}</span>
  153. </div>
  154. `}
  155. <div class="jessibuca-performance-item">
  156. <span>待解封装数据(byte) ${A.flvBuffer}</span>
  157. </div>
  158. ${y._opt.useMSE?`
  159. <div class="jessibuca-performance-item">
  160. <span>MSE缓冲时长(ms) ${A.mseDelay}</span>
  161. </div>
  162. <div class="jessibuca-performance-item">
  163. <span>MSE解码间隔(ms) ${A.mseDecodeDiffTimes}</span>
  164. </div>
  165. <div class="jessibuca-performance-item">
  166. <span>MSE解码时间(ms) ${A.mseTs}</span>
  167. </div>
  168. <div class="jessibuca-performance-item">
  169. <span>MSE播放模式 ${1<A.mseDecodePlaybackRate?"加速":"正常"}</span>
  170. </div>
  171. `:""}
  172. ${y._opt.useWCS?`
  173. <div class="jessibuca-performance-item">
  174. <span>WCS解码间隔(ms) ${A.wcsDecodeDiffTimes}</span>
  175. </div>
  176. `:""}
  177. ${y._opt.isHls?`<div class="jessibuca-performance-item">
  178. <span>HLS缓冲时长(ms) ${A.hlsDelay}</span>
  179. </div>
  180. <div class="jessibuca-performance-item">
  181. <span>HLS播放模式 ${1<A.hlsDecodePlaybackRate?"加速":"正常"}</span>
  182. </div>
  183. `:""}
  184. ${y.isPlayer()&&p?`
  185. <div class="jessibuca-performance-item">
  186. <span>已渲染帧 ${p.renderedVideoFrames}</span>
  187. </div>
  188. <div class="jessibuca-performance-item">
  189. <span>已丢弃帧 ${p.droppedVideoFrames}</span>
  190. </div>
  191. `:""}
  192. ${y.isPlayer()?`
  193. <div class="jessibuca-performance-item">
  194. <span>网络延迟(ms) ${A.netBuf}</span>
  195. </div>
  196. <div class="jessibuca-performance-item">
  197. <span>缓冲时长(ms) ${A.buf}</span>
  198. </div>
  199. <div class="jessibuca-performance-item">
  200. <span>最新缓冲时长(ms) ${A.pushLatestDelay}</span>
  201. </div>
  202. `:""}
  203. <div class="jessibuca-performance-item">
  204. <span>视频显示时间(ms) ${A.ts}</span>
  205. </div>
  206. ${y._opt.hasAudio&&y.isAudioNotMute()?`
  207. <div class="jessibuca-performance-item">
  208. <span>音频显示时间(ms) ${A.audioTs}</span>
  209. </div>
  210. ${y._opt.hasVideo?`
  211. <div class="jessibuca-performance-item">
  212. <span>音视频同步时间戳(ms) ${A.ts-A.audioTs}</span>
  213. </div>
  214. `:""}
  215. <div class="jessibuca-performance-item">
  216. <span>音频播放模式 ${c?"加速":"正常"}</span>
  217. </div>
  218. `:""}
  219. <div class="jessibuca-performance-item">
  220. <span>视频解码时间(ms) ${A.dts}</span>
  221. </div>
  222. ${y.isPlayer()?`
  223. <div class="jessibuca-performance-item">
  224. <span>解码前-解码后延迟(ms) ${A.delayTs}</span>
  225. </div>
  226. <div class="jessibuca-performance-item">
  227. <span>总延迟(网络+解码)(ms) ${A.totalDelayTs}</span>
  228. </div>
  229. `:""}
  230. ${y.isPlayer()&&A.isStreamTsMoreThanLocal?'<div class="jessibuca-performance-item">\n <span>是否超过一倍率推流 是</span>\n </div>\n ':""}
  231. ${y.isPlayer()?`
  232. <div class="jessibuca-performance-item">
  233. <span>是否在丢帧 ${g}</span>
  234. </div>
  235. `:""}
  236. <div class="jessibuca-performance-item">
  237. <span>网速 ${m}</span>
  238. </div>
  239. <div class="jessibuca-performance-item">
  240. <span>播放时长(s) ${yt(A.pTs)}</span>
  241. </div>
  242. <div class="jessibuca-performance-item-block"></div>
  243. `,b.$performancePanel.insertAdjacentHTML("beforeend",f)):(b.$performancePanel.innerHTML="",w(b.$performancePanel,"display","none"))}),y.on(E.togglePerformancePanel,e=>{w(b.$performance,"display",e?"none":"flex"),w(b.$performanceActive,"display",e?"flex":"none")}),y.on(E.faceDetectActive,e=>{w(b.$faceDetect,"display",e?"none":"flex"),w(b.$faceDetectActive,"display",e?"flex":"none")})};function is(e,t){var i,r,t=(t=void 0===t?{}:t).insertAt;e&&"undefined"!=typeof document&&(i=document.head||document.getElementsByTagName("head")[0],(r=document.createElement("style")).type="text/css","top"===t&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e)))}function rs(e,t){t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function I(e,t,i){e.style[t]=i}function ss(e,t){return e.composedPath&&-1<e.composedPath().indexOf(t)}function t(e){let t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}is('@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jessibuca-container .jessibuca-icon{cursor:pointer;width:16px;height:16px;display:inline-block}.jessibuca-container .jessibuca-ptz-controls{position:absolute;width:156px;height:156px;visibility:hidden;opacity:0;border-radius:78px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4BAMAAAA9UfJZAAAAMFBMVEUAAABHcEy0tLRZWVmysrKoqKi1tbWvr6+2traBgYG1tbWWlpa1tbW1tbVUVFS1tbVGCHqkAAAAD3RSTlMzAO9U3LSWySp3aZcVRDUDw823AAAJYUlEQVR42u3d32sbVxYH8EPHxgg/lBsa7SBkukmpSbwLI2KbEPpgZ5MQtwmM0wRMmgdhP6RgEuwlSVnYlmGMYaEvMU1KKX4QNq0pocVmm7CYfRBaQguFpbgPKRSC/4V2LGliO+bulWKrkvVrftyZ+WbxeTRG+nDnnnNmRjP3EpMR6tMH18du/0Xj1tGz5+9cf/DUlPKx5PsTkr8s3eZ1cX7ym1zkuI/f1wTFunNt9fP+FIno7/98/tFY+Y8ffBUlLrmkl2Cr96guTv27BMxP5iLCqUvi68+tpqhJKPNXBH3SjACnfimm/7Wmsl3fI/FP75lh457oPH+1Da3M+1T8481QcT0T7UetevR618LDPdH4hTlyHLGH3LoZEk6d4PlvyVW8pfNeMwzcDwa/kCKXoTzk9tfB455o1mXyEIOa+0PrFvcFt+fIU8QM/k6guOQifzNFHkN5l/flgsOJVHibfMR9l2nhBqem+VXyFZ/xghkMTp3il8lnDPKiGQROhs2lzjEuKcVW1uWk4ybk2Eq63pxk3CK/RZLiJO+Ti/vZXw3ZX1E+kon7jv+JJMY/+Q15uIRWIKmRthZk4VTDTsnFKYZtSsItWiskObq1Pjm4f8gqIrUF5W8ycAl+nAKIT/iCf1zSKFAgkW4/7drifrLmgsHF2k87alvhblFAcbJttWuDU/VtCiyyedMXbjGfCg6n6H1+cHE+TQFGFx/3jksa2xRoZO2cZ9xsUJn6e8aOeMX1aGco4Biw1jzilm0KPNJb3nBxvhI8rrtVTlCLK5ptCiEyBS+474POhr2c+NA9Lqm/QaHEiXzONW42yN5Q2ydG3OLU4MvI7+XEdImbCWvgSkN3zB1O1YYptOhoNnRNcDM2hRjGMTc4VZsOE9fVZOioyYyjUKPJrKPGNW44XFxX41rXEPc4vFTdS9iLTnFJ4wyFHAO2U1zcSoWNU7RLDnFTb1DocaLoDJfgc+HjYo3uTjTArW9TBJHdcYJTtdEocJ0NCnE97nGBIon0RQc4YzgaXIfdHhdBHdmrJuNtceubFFFkdtrhVG0lKlx3XUrsxz22KbIwLrbBTQ1Hhxsotsb18FR0OIWvtcT9Z5sijOyfW+KM6ShxXXYrXMJKRYlTtIUWuLubFGlknrXAGaPR4jrt5riERRFH7XGtwc1sRo3LHGuKi/qo7j+uhJOr9flKMBW4QR2uxk1NR4/rKjbGRdpXG/bXKtxrAEdVHNfTDXHLf0TAvbLVCJfU5hBwMSvXABfPE0To4w1wP25i4DLPG+CmRjFwncV6nIpQSF4UE7MOd7hAIJG+VIe7u4GCG3pWh0uPouA6C/txMFOuetIR3JSrmnQEN+WqJh2BVbmaSreLS+JMudKky9Xg4jYBRXq8BndoEwmXOVKDWx5GwnVs1eD0OSRcLF+N67EIKrS1Klx8GwuXHa/C/biBhRt6XoVbnsbCdW1V4bDyoZIRZZwKlg8iI8wKLl5Aw73oEWXcoQ003NCRCm59GA3XsVPBTa2g4bqLFZyWQsMp1h6uJ09woa/t4tCaV6WBEWSy7qYrQSbrbroS2MVNzUUOAXbWSnel0sU+AUbpsl/gEjYizlgo4w5vI+Kyl8o4xEryopYI3N1hRFzHszJueRQR17lVxqXnEHGxQhmHd06yd15CgBcQlcsIYokCJi69IHDxbUycOGki9toGJm7otMC9/ism7tXfBA6zBperMIHW4HIVJsDrwsrVIYE2CNEibIHDbBDlFkFJ0AYhWkSOemxUnLFGqN2r1L8ItXuV+hfFN1FxmXH6wwYqbuivdAgXd4RQ+36p8xNq3y91flqfRsV17dD6KCquc4eWcXFbtLyCiusu0hQ0bg4VFytSGhdXICOFilNs0nFx+QOcZ5xGsGEd4DzjOC6OH+A847QD3P9jtuJ2CGjcQeP3gYM+2YQ+TYe+wMG+NETGQd+OgL6RA30LDPrm4eu/ouJe/Q37hjX0rX7oH0mgf16C/mEO+idN6B+DoX9Gx34AAfrRDeiHXqAfF0Lt/OUHrVAfUcucRn+4D/qxSOgHSqEfxcV+iBn68W/EV3AqD85Dv3IA/bIG9GsumC8IaSb+q1XYL6VBv84H/SIk9Cuk0C/fQr+2jP3CN/Sr8tCLDEAvzwC9sAX0kiDYi6lAL0MDvYAP9NJH0ItGYS+3Bb1QGVaP2LfEG/TieNDLCmIvyAi9lCX0IqDQy6diLzwLvWQv9GLH0MtER76rRqWxPgdemtwYf9kWdYdeDh97IwHoLRigN6/A3vYDesMU6K1msDfpgd7eiOmjSEf1ZdpSC3ozMuht3LA3wIPeOjDSTRdfKb7M21VCb/QJvUUq9uay0NvyYm9oHFFKdDvaChp6E23s7cehN25nh5G3vE8aZ8LGDdjMIY49zoc9dPpFx7ikHnIh7sjnHOPYTMj36oxjzDlO1UI9Xe9oUICb49iMDTBwzXCqFuKsG2gycM1wYtaFlrCK3mTgmuJU7UzkA9cUx2bDGjpFH2FucUk9pA57onGNa4lj31uhnJzEtA+ZexxLh3KpkykwL7g4D+GUuJuPe8Kx5RCuJtJbzBuuJ/hyMmCtecSx2aBzIqaNMK+4pBHwtU7WznnGiZwI9Oykq1U2tMWxxSD7hKL3MT84VQ/wwGbzpi8c+47fCsp2kt9g/nDsp6AyNqb1Mb+4pBFQKU7bpm8cS/DjQdg+aXT/wTWOzfLL8m2DfITJwLFFS/oZQHf7CecQpxq25GqnGO0nnEMcS2iSq13WWmCycKLaHZebDDeYPBz7mb8tz3aff8Rk4tiivJQd5H1MLo5NyNIN8t6cbJw6ZV2WYys6tTnHCZ2MsRM2k8nHSdG5srnBMTXNr/qzfcYLLmyucEyd8FdR7vNeNzZ3OJZc5G967mTKu7wvx4LDMfYFtz2efMYM/o7LL3OLY080byVlULNusqBx7AeDX3B9aJWH3P6aBY8rpUX+W3e2t3SXqeAZVzq0/JyLmRe7wt0fUs849t8Jzv/u8Ngq/+K8d42FhxODp/P8VQc85VPxjzc9folXHFO/1Lh1rc3BjT0S//SeycLGCd6Sxvm51abDp8xf4dyaNL1/gw+caBhLuvj6O6v36mWn5scEPe+H5hMn4uP3hUEAr63e6y+PYX//qflHY+U/fvCVzw/3ixPD98vSbV4X5ye/yfn+aP+4MvDpg+tjZ4+K8bKOnr1z/cFTU8rH/g92biFxn2S73AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;transition:visibility .3s,opacity .3s;right:43px;bottom:135px}.jessibuca-container .jessibuca-ptz-controls.jessibuca-ptz-controls-show{visibility:visible;opacity:1}.jessibuca-container .jessibuca-ptz-bg-active{visibility:hidden;opacity:0;width:156px;height:156px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4CAMAAAD4oR9YAAAAM1BMVEX///////////////////////////9HcEz///////////////////////////////////85yRS0AAAAEXRSTlO5DCgVgZBxAK2fQDRkBR5XTPLKM/gAABnnSURBVHja7F0Jkqs6DGQPO9z/tD8Jq6WWbCCvIjKfzAGmulrW3ooedr6ui+M4TdP++SXPr1l/SdL3aRrHhv7ZyA5qb9xe0L3Am+DrkzeCL/BeX908MezTuPsfOArdgl3KsZuhq99fk/Tx3waum+ByAHua5QbYilkzY1aP728YhrH5InrfBa57OLAtVjpRbYaumex04dq4APeC7vnVSfo/45bXLe33jGscMx3f0A1vyg3t69e2dRL/NeA6wrgdcCvjyPM2U25mXDt9xVD3f/qN0yi3Mm6P20S54vlXtGPS/R3GPSbYOsC4ZAvmJtiaGiL3Zlzx/Ht+Y/KXTJXbqmaqe9za1VYn3N7YpX/OVGev2qduOLIiB7xqOzGuWCiXFVmWtU3368A5lkqeOJI21I5XXaORxVRnxmUTdNnY/4U3riNvHMJts9XRtdXVUttipdzrK/4x7UyY6sK4Gbo+nU21T1zKcd9AGJetlMvyLKvj3zXVfeqQElMljINx3MK4xVQ3xj2Ry7N/6CiMOIfYyVUXWxUyBx7HuZRbcHt9bf/Lb9zsHlzKzabauJaK47iVcC7jJujS33/joKkmxDnM4QiJ4xDjZuT+DXQW3jgxV012qcPuiePhCGfchlv1/P0D6Czmqmuq2gPGkbIS8Q4ZsNU3dGP3Y2+cW1RyKpkrbAnwqhi3iXHFHrU3bFVV5c3vBsCsOALjkXErAW85F3rjFvBm5Kos+TngCOXYG7fA1ojFER7GPUHbmer0tfGPANeROM6pjvDMQSkrsWQ1d564Fbr61964TvSqDa6O0ELmAtvGuc2rrpQrn/aa/qCpYq+6mSpOVhnjWBy38u2JXFl9yL8acg6CV3Ur5yxVZfW4AsRxG+XKssz6n3njVMYR4Eg8sj1yi3tgtroxrpyhG38gc+h8PYddPQ551dVQW5jju2/cG7kXdB946Uy9cbDnQOpxuCCHcq5dHDcht8D2/K67VxPNGtLJd7qDTcgb1zLGbXEcY9z0Fd39GReTzIH1B/2lcxrGTYxjXnXyqxNyef8zpipVlfDsyCCmDkuumhGvWq6W+vyisqxvDJwwOxJQO6fNmjaQcRt0ZdR2dwWOFZViuculNWtgBZjk+DNq1cq45y+Lf5NxE25B3oEyLueFJWqtT+Ciqr8r48jsCAyAG+2Na53MAdQxX16VhHEL4Z7Ilc2dGad28pskaULiEdDlyijjdqa6gBeNtwSu63AnP3V6NUnAG9cu1RHOuL2hVi5qr6+9Za4qV0dCGcfCEfDIufWRFbsZvKy7KeNgW7XHvRqxWfOGLhO6XCrjoiiPb/rGdZ75uGRfj9u3B1sWAEtdLuxVF/Cq9HaMe4A4TptkZYwLqI44rmGDbUe5E8hZcg54zquRbHXu5NN6HKuO7N84YqwbdGV/Q8YF5arUN7CJTNLkgplD5T5xG+OOI2ehAhxv00ocOlpWwhHwljns5uNg6bxCb9wbueSupip6VTnj2jGudSvnOeqrVo6h7vl2nHM2K8AkV1WyfDYDvHUcWF+1VBl3EDlLKdc2dQ6aNbhXw2eAt14Nf+MqFse5rDuS8tucHUmhqaJppYF6B8440h7E8cjhqMTiLtcaAL+ga9jWZb35hpbHceyNI9WRSmHcE7n4jqbqTp2D2nnzgm154mB1hJQy1cwBIpd3twCOrjnEoDsoTZ2jepybb2VKrhpx3zB92Z29Khpl1ZN8MHWzJV1CdYQHJEeqTMbqcfEMW+obLBwES83w7AgvY0YlMNT3N96GcXEHGQdxG2t3CQ5kDkoFeO8esHd4fc193jinAtxvXhUN3Ywz5VAFGM3cENfgVM4x5YICYRumqu5yIVMdJuhaLXMAFWBKOIhbWFBiO44Dg4Usxx/cCrDyxqESMIYuu4lX1fYcGnVaaVmtKXZxHOzW5Bvfqtk3iLAFuVaLew4HluDUzIH1VYMZF+AgLMZxcAYY1uNYBTgrwPDIaqxOQ1p540IchBFTJW9c2ofNAO99Q+sYaugbJ35Vd4sKsPbGqVM33KsWmdpXLeXqufsVNwhH8FyhOh8n74foKb5WVDr0zFky1Rgt+iaJZyJTWErKMynpqsqgVy4q0xv0VTvZq0pJPq5jzn41zzzVET0aCYjmTO05OLaaBEwWqhvSenUkKtVw5P0N96mOpNr2YCPuh4AJCGEAoioDver7628Sx8WAcU2i1eM259AWhZBzuQEJieN07JR6sCHgXoSLnepI7yo9NqgCLE5A6K4hjHGKsVqK49JYEGyBg4XIq2b7FREUx5Xu2LkXOtmz2pJBW5sOqdjJF3sOjHG5fz7OT7n8DtURwjjPtBKtx7VLOa6Q4zh5Wkn8xhvU4xbG9al/s2bAbxwYkJO7XCGME43VIuMc56Dnqi7hpPE4cVopBLnibozTp5X4DHAQ49iwfsCX3IhxYFoJB8C0y7Xr1iwBSZXDulIUjF11G6+qr5aPALlCmTrfyWfQzCEK49xoPMnnjFMaq3QlX9tzQPuq0QFbLeNbMU6cHRn3Sb60HwJ6NXAhKQi61nzpPAbtQaY8jUUgQnRHSodxZSjjoig161W7HePIRGZDJzJHQXiEzE4DpRtSjotCHzkUkhj2qqJi4V54T1S6cWwVp/nhjAP1JQuDhbs4TtFW0spKTgW4UHJVFv4GQpcZA64jkt1xDNS8lDEv9Y3z5KpRGY4biIINMC7e2lxKNFJDqUfQquGZA2yrHoINUM7G6ZX1iVM2RKDUI08dssVUfduDRyI5QDkbFWCnscrWVWV1/RZ2uaRc9UyKL1LO0r7q1qwBm761WsmEUjdge9ApAB9iHHWslq4kMalHTbHQieO0zXKljHmIc4XdOE695yCpsg7eOE7t5B/4Uqv1uDSGKhDYq0r6yQWYj5NnRw5BNxjOHJAKRJB+nJqr4jcuOki4qOzs5qrgulSDJzJHUcyrCNMdOc44ty5nel815KDZ4HTypeoILAEfZJxbCjYkSpVKgZx/IpOfXgnarDkKXWIrHAm7kiTqxw1er+oQzg2Bj32FTcYJ2kpCIx9PK2XMq1ZCz+EM46LYZK4qaCsdmo+TqiOV5FWPITdYLZ2jOqYa/6LN8kJSZT1dxkSTJEYKmZ2/OuI5aIYYh+UzKn3TN9A9mLjL1cl6LexKkqof575xVJWVx3HRefdgUbGQNGs2U2Ul4HYQ60o+HeBzjCtt9VXVqXMpc3DEzh2NzEJSnr7OuG35wUTpPGjqXN3lQgdE0AWRA2sOHls1eO2yh/uqWM1LbUgvQzeatOhR5NZM39QIBNyQbviBVajYItbOYa56knCbrRrUj0vxTn5QVQlOnUtdrjKKztuqpbMEJ27WtCG3BzX9uMPfYqsmlW7SPnRfFeSqwTrAp9641VZtXi1PlX1VN44THzlvPe4k45aZLys9h+7cvuqsAqEpBAm6I9HJN24pZ9oIRzp5XzVUsVCZOnd0Ry4zbu52GdMBDn7j+NVyYXaEneW6+sbNrQcjtwdJCTh4WmlrSLcF3axRZ4AvMC6zxjj9annty1X9M8BoefBMQGKudB5UjnMnMltQV1JuD5JK5jnGTUU52zeke+4cfMJ7ygxwSZuDJ6EbzDEuZF+VNLnczCETlPdkdf3Tj5yhAHhNVdV9VXgJGV9JyqWjjRdS1fWRs6vmRctK1KuiLD/b22q2KyvlWJT1HOPeo3IWqyNwlwtrxJNrlwW69ZNr0qKnoBsfNrWVcH+w9gzIFXxDeisr5cxSrzCusFVWkpVukH7coF/0zQRt0a2QGZ1HLrfAuIfDOL/uiLOTz9UMMiTmtXMOVXmxW/P+OqM6wPBKEmLcbuiGMw4lq9cmIPbewa5iIb3LdYxxKHMouYDcSeRqcxd9+dS5VFWCGZd3e9DtR5+21dbYRd/1EAaagUC6IzDLV7YHj4pSKbmDkZRLnmRNcHeQ3azZdvLJ9qCUOVyhXGVmQUSpx9GWAzNW6Y0DmYMzrbTeHjzxxTeI41zktugXtQezAsRxon7caUt9VZZMMQ7pAPMnjnTyB5lxJHPgU+enGTeajONUHWB46wfW41jmAE79nHerNiYyFeXpBu/keycyM8983CWv+sxWLe2rsgpwH7qRxPuqb7pl6IKe61RPYpcbvefQy3e58LSSbwY4B071CuNKk31VtswlTyuJ+6oZuss1h3HVCTEDluZb7Ks6prqrjijlOLTLxRlXUhng85RLo+77por7qp5c1fUN8I1Tbw9eqce9ArkvA6eqxOOr5UQGgrdVC1l5GszHnYSuNsC4OKgeF6au73S5Mt983IU3bvwqcN3jAe9y9VgkvvHPskp7DuI9h7PfYOGNw3EcH7rx91XRPbNPT2TOEbCNNw7uJOGhG+naD8+5PG/cJcI9gYu/CxuYVuqd+6reHbgBWqrvavlV5LLvAqfdc6AFYElcyW1IS0eScqg7ch65/MvABXW5ElWvZXDiOL2Tz3VHzn7Vt4F7iNuDobMjwp7DUh3hfKs+EQCbAs43O9KgG9KDrK6vMe5qIPdd4NS7XFLi4NxzADf0eEPa8aqX1lV35REjb5zac1geuYVwtfjGbTmXsJH0qf7g14Hz9xzE9iD0qigewTv5F71qaeKNwz0HXI+jb5zLODABQWaAP+MbXA2SbxdH9KlzMjw9jvAUMr72o6363hQ4VyQ+lU+vkH70ALVFM2cnP8f1uOojhLPgVZnWI7y9Enjtcr+TT/qDJdj0LW9tqlgFQtUdYQfNQupxnHE3dw5aripmDgOcOt90gHOpOvKRF85EOCJKPSrVEa/y9D9QLDQEXKco3UiqVPtdrjZIIxNuSEeX+qomc9U+3S/WUIUgvD2o7nJ9UnfECnAPWQUiSOu8HYKERz6oO2IDuE7THcHOATIO9xzQhnT1IcblVhjnagRp8QjZVw1gHOFb9ZnSuY1OvutVe3/86w4Be7XOc6GvetsuF47jAq5dElFWn9a5oJF5YUDOBHCdds9BzRw2xrWy1jl946qrC6tfb0i7uWoKZ0eaoJs1e8LR+6pQPy66GMiNhqaV4ljbc/DqjrTC1fL8n/RVa0ummiI1r0a/yyUPT2dcXBR08s9Cl9gVpdKvEvgO00LB7qta585g4eP7jIuDxEXdaSV87TID91WdiUx67uf011lkHBTea/R6HN1XhTdr0AmROw9Pd1h5euurJvxKEh2e9uyrfnYn38q4vnp7cLchXXuVbtxdLoFx1UVtpWnv0uLNGudquTCROXj2HHI6riRK791zJakjIxDKRGatMI5fu8z81y4vzU5bE2yJmYLyFsc1jaythPcc+CW4j2grGVi71GTQgnLV1tFrQduDUj3uWvwb27p2Sefjel/PAXXy+QywoFh4IZKrTF67lC6I1H6NTHEGOBeWB88LoVm6dimoGaxO1a+RiafOpX3V8r7yGayOuZfPgGsOQhy3V4Fgew7wSlJ5hXG1aY1Msj2IK8B0BAK8cYIIxBXG9bZuD6ZUlCqk5zC0x/Yczh9YtSVK9ZA3pAN6Dqq6vnAo9ANx3Ndl0LazXPK0kq/n4J06F+45XMkc7Ajv0Sy/VzZrpAsiLUnyhZ38fQX4vOqIOXX9o9cutRlgfZfrSuZgTVxU9KrKPQdQOgd3CZB7OO9VzcnZ4pYDHddnkoVSrprlAXe5ynN5gxF1/Vi7ocenp7XdcueJyxSt8wtjhRYku2EcB3Hb1LxqHMb9192VJTmuw7DxSsfxdv/Tvn7TSceiAEpylqYnH/lWsWBRXABMVLHQ8B4cjvWUfN1xTYU6wJEqqy7y1ynBEIGt8ycqBxe2BGh3JEt3hO3HtXjm0KFJ/kHIOTDCmEUM2RFMH9ygn8N+WoNmDpcLZEgfFuz2pQPMKof7eHBME0RsxAVX3OFS1Y/Zj77jtGQ34nLRWjVeHtFF/pOIc2EvRdf1m/2UKy11s+8qtXzmAKQMhiNNTDefqiWtFIlkQqEbNJFuO7g6oqr84p8PC710IxN0R0bK5VIFV2svTx9CnCPTxspm1iiGiBKeptmh26tAYOXpp+y3HSGuqUwnONzIZN7bRAdYp4bDZpee5qq5OsAKcdTQISjykUjmM/aq3lRZK3rH6a5SOMmPZw5BQ47yQ05rvm3NVVXhkLCs0YqF2EN60A4iw8Ev1dtcNXvmsGK+qukh/QIRtEHE06cK1fXtKRfLqoTLRadcw8Ev1ZkTXBXzVdkdt5k1PvtQo/24I604520lvq0EFAvxXLXlytPHpjUXcRU4tTuiJvkx4EbugxHojrRJTn4p5jY3gcspucLQKW0lVnNhFQhF5ir+VhsvgZsN/Tji9cOcVybD6wcOuQ5MuXpxirhyt0tTea9NTPKLEVf7CdzMaZdZbpd0Pw6LZ1wiN7PhWGpwk1Uz/BzQDsSEnOB6vXT+cLscntoB3sQZ4qiaV/qOixjSJYgrBNwwu0OcSYKzzbe1ExwYrF6InFdpVp3EG+IIJSlsnWv9uEQ/DrMH497IcOgt4hNxC9vXv2b5ElhU32fuuF78IQ4r3XyreV3NST5V86K16uG6YRF3iIt1gJscxRbgE9oG88E2oa5fdMu14h9x5pZX2I9DuaGn+nGXmOdw6PHrvh+X9OWagGdNbzCkI5uk7NhpwHliSDf2sIY4wQHl6ZysWvoaqcUz4hLyGUrsfF85QIZIvASsh1zZsYsA54qTDyuHSAViM7wH+x6NarDWeRHiFpHT3HE1g5zldsk6wEDOdiiwJejFJeKYvaqtWEhFqShfFSkWHikaPHZH0qJUxEOvnK9a4CE9ibvACVQsbMLKwWTWGP6qMeKOAW6o3AWOXHHZ/TiD55BGXHZW3UScfqqPVdbGMjSLa1VVcRG+KmRI53fOOxGnn2piedpgSK9GB5h0MssBVzsM3AwdfXPuuFh3ZGLaonBUk3/J9eIfcXDmcC1RLEwotgTvuDzIDY3LwM1z0kMam/1gjcyWjQePq7VscjrE2YuFxNHMLFWB1vlwKDO4rlX1tj7ROidZNc1XzZJPZh/q73O5BPBVo90R5PaTyKqYPVhcdK3iGXHxJB8RRLT14KZYl1FW7RJa5zkf6uw2cJJ8x5kbmcDsx+yO6NglQreInO+Oy9oBNry348qh2M5hFTkH4sysihA3WXNVvAIciQSVtH2d745kdZUYQ9pa1o8QNxzLqO4m+eFcNRk6BLmWiHZ3gK+a+FZH8Y444q9qbuuTmcMLlad7Ee+Iq9gOcNJ7cFqZDjCXOs98AV9m8Y84OFitI7fLK0VcwHPoqZ+Dks+wPtRhEf+IS4kZ1ElqOZrW3CBH+ar2O24U34GT8rmqntWsif24jjFrrCtuEjkD4qC2kpqrjrQ9cpDLZXlIt+I+cEl/VernsB7Zj9PTQZIYKjkX4iCz5go7mYpZY2qdI77qH+M9MtRyGsQZXC5rrzBWnt77OQCNzKB2YIi7ipwDcZXJ5YJS54p32UM/h84WAmZZdZMTBE435LLt3sm2foajbyqtTnKCwCkVCFMlHnKSpkhev4UdYHDHke5IK2cIXKACYbuWm7UqVp7uzDsOI66bzxE4ogKBZg5ZtWqCIR2+4wDiLtl2s84m+VW8ra+YNXZ3BHaA4VwVvn8vjcipEJezr8/UDOgOMDeYYv24ZGXvtzuS0Y9jO8AT3QHmnPzhz9G4OZs5QKIvFgJW40FYqraAWRP4OQSRK4qbM55Dxpeqd4B/uiNTmj1oVg5ZhZbvKZdi1mBHMyIuanPydXdk97GW4U28GZqFSjdL8h2nkgN+x7E7bo+40rj50AHOkTq3NYIQ4tpolRXKi36/Q0rj5m2uWkV81ZS6/hRvK/XRyIHRHIby95v/d1y9WEk1lmW1uVx4XekWua4SOSHiKuZnZu3HYXV9yh6EPIc74NojBuQe9uMqUz+ujp4jI+2dt6w7Qp3ghuw+krNaNctBrwYqaNB7MHgAdyk/h5K+pdfx4GzusoafKujHRR3gDu/HhfpxfxF3lTMGbrZtCdB+XIi4KDegmQPagbh1zsufIY4QV2ltJcVXDTn5EeKKuFyqcmgrOWng9g05pZG5RFvnd8SNtDuiPKRbw9H3/ztumkVOjrg5ra2kEIe7IxBx4e7IA3DjMwf3eMfhh9xovH/73dZ5n9cBHrpFzhs4hbhgB5iqeaH5IGDWtCazZuhnOXHg5jmdVX9mDte0u9TjAQz9HB6Iu4zPHt2v7kgNe+cb3FbqeVa9qBfw39C1jZw9cMBDmr7jwqHDylzL+5Sfw2V9wcn9Iy5qZFoTaZRV9b7+k1nB55Sr2gEOaysFiFO+tCSrhqsj2yzyjyAu3lYCHnojyap85gAdfV9wu3l+x2V0R36INSvWAUbvuMvzydRprWogTmfVO+AI4uB+XF/JvxK4UHekMZRucHdkQhsQvdqPuwGurV95cl+LhUR3hPfjTN5lkFa78bUH97StdEdcOJC277h0bvgO24ty6RkQV5OtG5Pn0GIy19S8/OCeKofojlu47gjVT+4/EjZvdu9grnq1uVxAB1il1beEzRtBJJQICv1VMeKU93a0OzItbzq5k90RgLhl+XGCqy3ERdYrO0fftXnb2T3VqjfE5aigMbf3YANirN54co93XMjJT20rhWteP5Hrr/NbT+7xjoPMctOzJkqq6/Luk3u84+7vuGUBSzeBweoE3yPTm8Hm444LiA5gyMXuuJU56G3NR07uAXHVwwo5fgBTf1Xo2rjVnzq7r6yK1LwSr5HHHTdt9fy5k5/R7XLcJdX7FbeOy2dP7trPweQ57FRZx7r6+Mndq3ldEzrAY938ysl9uiQ1cJNVa2SO16X6tZP/dj8uDqJW2VfM/O/ftf7FmPkK3OMZ3MAu8G3T6ytiTTU7OK8jxMlfuN1idg/X91/9VUZ81WOVo8P+Bw+0DogP6NDPAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-up{transform:rotate(-90deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-left{transform:rotate(180deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-down{transform:rotate(90deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-left-up{transform:rotate(-135deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-right-up{transform:rotate(-45deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-left-down{transform:rotate(135deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-right-down{transform:rotate(45deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-show{visibility:visible;opacity:1}.jessibuca-container .jessibuca-ptz-control{position:absolute;left:53px;top:53px;width:50px;height:50px;background:#fff;border-radius:50%;transition:left .3s,top .3s}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-left{left:33px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-up{top:33px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-right{left:73px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-down{top:73px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-left-up{top:39px;left:39px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-left-down{left:39px;top:67px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-right-up{top:39px;left:67px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-right-down{top:67px;left:67px}.jessibuca-container .jessibuca-ptz-icon{position:relative}.jessibuca-container .jessibuca-ptz-icon:hover .icon-title-tips{visibility:visible;opacity:1}.jessibuca-container .jessibuca-ptz-btns{display:block;position:absolute;left:0;top:156px;width:156px;box-sizing:border-box;padding:0 30px}.jessibuca-container .jessibuca-ptz-btns .jessibuca-ptz-btn{display:flex;justify-content:space-between}.jessibuca-container .jessibuca-ptz-expand .jessibuca-ptz-expand-icon{display:inline-block;width:28px;height:28px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAANlBMVEVfX19fX19fX19fX19fX19fX19fX19HcExfX19fX19fX1/////Pz8+oqKjCwsKhoaHn5+eWlpaOqTaDAAAAC3RSTlP/3CaKxwJiAELtp4ri/s4AAACuSURBVCjPfZPREoUgCERXBdPRyv7/Z6/Z1aQp9oWJMyYLiKUrOIpAJBdGCldgbzBkPM/QEoTI3jBEPBRDhwEvChe08Q1Ge0ImvIq4Qj8ljrLdH77CyQPWlCdHC0Q1e9rmmuC+oQN9Q4LwcQg40L6eyqm0uEpXSUqe3fKpkkqL+Y/o+07SrahNEO0T0LBsvOitf4xsLqiNTB32wtqaVKosGLO2mhUrS93+PZ4D99wPqzMJVcbEyA8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-ptz-expand:hover .jessibuca-ptz-expand-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////i4uLZ2dnIyMjExMS8vLy+iXNeAAAACnRSTlMAYomLxwEm9+NCLo6DKwAAALNJREFUKM99k9kWgyAMRIMmEMLm/39tKaVKFJkXl3sYJ4sAXeQ3ZOcYd0+gRYblFBuFLYoS2ot5lpvYn8zJQ65TO2GVNmdCmQq/qczw4gjpejD14BgmhziEIvCjVRlPioftHW6A7xBB1a8CCUMvsuSqEkPM7eZX6h8GrQ67bYpNIbRL6rb4/k2EfVXKsgmqfQrW9qnGq96a28jGQG1ky2HXpVysyYyeDIhWq7le6ua9P36HD6+2GRi8iBZBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-ptz-narrow .jessibuca-ptz-narrow-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/9/f2/v7/y8vLUObqxAAAADXRSTlMA3IrE6SZi9wI+y0gNXAn3CgAAAI5JREFUKM+Fk1kOwyAMBQ04bJHT3P+0JVUMNMWv8zvSk1cipfjAKXHwhR7k6KTjYp7dVuWLug1XWB5wz96T/JD2O3Phmv0k5ypL6lVVFIPYpLOka5WKSSFvS0/BloHYlkza5HkMzrvVLo8ZlRr7mtFYWBBsBQ4BjC//GTxcGVw2PpOVHQ6fJj7qS4936OoN2K4e5yE6N1UAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jessibuca-container .jessibuca-ptz-narrow:hover .jessibuca-ptz-narrow-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAAJ1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v7X19ckk9ihAAAACnRSTlMA9+NCAsuKJsRiPv/2GwAAAJlJREFUGNNjYAAC5gxFoTYDBijw1FoFBIumQHjsUavAYGkBmGu0CgqUwRqlYNyFIO2Fq+BAnIGBJQrBXerAwLkKCUxgYELmKjBYIXMXM2Qhc5cxdCFzVzBoIXMXMYAcsRsMdgEdgs4FKT4DBqdAitGMQrMIzRkojlRB9wKaB9G8z+CMGjgshjCuMCjoWNxRAxYt2KGRYgJiAQAnZcjElaB/xwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-ptz-aperture-far .jessibuca-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAASFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+kpKRzc3ODg4PFxcW1tbXW1tbk5OT29vaVlZVmZmZ8vCMFAAAADHRSTlMAxGJ5Mssm9+NCiYtiH91SAAABAklEQVQoz41T7Q6DIAyEJQooUL55/zddhVazzZjdHyqXXo8DhWCYTWqltNyN+MZLuxP69UGti/vAsl6c0e4L+tQ2yv1AEbvecMhO5cXdYhk+6aO3WGrNAMwentlMz/ZAKIlNoRsqY2wtFWu9t8wasc0iYVN0LkQfrG1zbxNyrIBcntOQrH1Ukkb60QcxYF1xMA2dh8zWj6ZDsLCsIrL4Ds5Hm9FMbCEROWUB0COaLXEIZJKV7CKybGO7UuxjxY2C/TkMbxboKBQCxgMN6MCJQ6Ch/QjOZg/B13LGx8FDTe3IFvl+Bc9XBi3UWoex68qeL/vxmdyxyvz3NJ8f9dDef36HN7koIK2LjxB0AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jessibuca-container .jessibuca-ptz-aperture-far:hover .jessibuca-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v6cnJzr6+u/v7+xsbGlpaXNzc3b29vqh7uRAAAAC3RSTlMAyRjKA59J/3PzPhe1wxwAAAD2SURBVCjPjZPrssMgCIR1mkYtisD7P+zBCyZpM5mzv5hs0M8VnZvaok9BlXzc3FXbO5z0vtifFC5Kn8OL4UfxwVvuHm61d5Z0b6ZGZZwZpQAUosWsjVZntVS1sH3ZFo1IRVYfGXgx+VGwNkkIVbhq9/jm3cAhaNv1Uk3IA8mNn7D3kbQeWK3TLH2jCthrDFcTMwUWaKiClc9mJtJWhS3SF5BpJqMQW1b3xwnkDahMoHYomkeJRgSENA/MFsKML7fgoCBVbGvM+Cx4JcKWbWHKK/h1ZYS1Jy/nK3u8bB3KhzG5deMxtfv3aO7/Heq+9ms8h9fxHP4AHzAWU9zlWNgAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-ptz-aperture-near .jessibuca-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+FhYWbm5vz8/Nzc3OwsLDi4uLDw8PW1tZmZmYgm6a+AAAAC3RSTlMAYmOLx4kn9+NCIVJiPGAAAAD+SURBVCjPjVPttoMgDMOJAqOU8uH7v+qKFN2c597lF5LTJg1VqQG3aGuM1bNTV0wWDtjpg3pq+IB+npyzcIE9ejsDXzDCrjccs+tOariF3n2OLyw5xko0vh9MDjNb9Q0hp2GK3cixlIApe4/JD9appR8SFxWAUFLg6n63iB1irnY1Jv0mlrok7nUdcZRa1YeshxBA9iijChlxI6iZEaBgSEL2tkRcymPGGJpqlbZ6uDg0WR/F0DwuMpxDkYwiIXA8hO2uMJdGCCK6teB8RQoY8xGfevQjxYQt25qoRwDT25MRBjZ7GtP/P/afa3LHmrflXa+ruf661Hvv+et3eAF6Fh3v+sSUGgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jessibuca-container .jessibuca-ptz-aperture-near:hover .jessibuca-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZn///+qqqq9vb3z8/PMzMzo6Oja2tpXGg+mAAAACnRSTlP/JomLxwJiAONCr+rW2wAAAOtJREFUKM99U9sWhCAInEpLBS///7WLEWy7p9O8qEzCMBIOQ15DAlLYsoegS9yFMKQ93skl4Adh+ZI54Q8pG5nxgKzkgkcsk4zhmQxRyN1OPHqtncjOu5AuppcJ6s1EHTA1YzC3Wgq3YmzGqpsmlwZAo7F8oLEVKoeE6+TbSxK0JJ/3FLOwFnUxzXuoltYDDMLoAlmYXLAWIrkqbdZKs+q4KBfkNV1uwGaBim9TdLWS3R7iGRvCNTPB7JvGlc5EXK8cKbrxooint73RzXh7Msl6Oj/uT/b62O9j8sj6gMXX0Xwf6jP3Zr9DtNAHTYMMXrXSK0YAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-ptz-focus-far .jessibuca-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAPFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////92dnbs7OyFhYWjo6Pe3t7Ly8uxsbG8vLyG+Q0EAAAAC3RSTlMAiWJjx9wm/0Lti7mfpe0AAADaSURBVCjPfVMJDoQgDERFC/bg8P9/XUSO6CqTqA0TptNDpSrMpC2A1btRT8wrNKzzjdo03KC3zhkLD9imbeAFhd3sG2kvZQ2v0NknfGBJZKkhBM9MxOxDKBV1N4iHi0TRHYjN01Qi7/kK2PtyNDU7DAEJgDAAN0u1jsQEFEkcVVmrqjeXrkWRmC67eqbgG7bJyvkQSQkvUvec7szpek6t9ubWJSK/uJVSm+APzHKCh++DWWuH4plQKNYOpfappcjy2VvJn9744cjGwx6uyXjBxqs5Xuqsvf/9Dj8rLhRg+bQ5VAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jessibuca-container .jessibuca-ptz-focus-far:hover .jessibuca-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZmZmZn///+xsbGoqKjt7e309PTExMTQ0NDe3t774OlGAAAAC3RSTlP/itxixwImAELtp8B2gZgAAADmSURBVCjPjZMLjsUgCEVpq60G8Lf/xQ62gvNeOmZuUiWeKHC1cKnC5iJAdFuwJXgmf+xg2g//G54OPuTOCUOEL8WgMMCLwgPP+Abj2aF38CrnBR7whw6Bo4fWUk7MMrQ2OrpAq0GspTLLgKg1wTailNITZA0EaTkZGjIAY5NwlATah5CGRMJYj50tFtlWiapsLvAPRdtL/WOmET7QzZyl5ywzp7NWsjBJ1odsragJqeJ9HGFNZoLaJw71hMTm0O7NeDE1Z6YsU5rGL69sedmXXz0ToW8PzA/oV09T8OJR32fb7+B17Qe3WwtC9PVbHAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-ptz-focus-near .jessibuca-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAARVBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/////t7e2dnZ3W1tbGxsa3t7eDg4Oqqqri4uKTk5NImu/5AAAADXRSTlMAYieJ3MvE/0Lti4oh87zNagAAAOtJREFUKM+NU1sOwyAMY30FtoWS8Lj/UZe2gWpVh2aJH1wcO0mNqbDj4gDc8rLmiscEDdPji3rP8IX5fXLWwQWuaVu4gbKDuyPdsJMz3GLefcIPbJ6PDCEAFDlUAJiORM3NigQFAXAFlqOeRhWJyFFIHxNGvRrN0mp470U++3axGM2RAmXcXqKnkDSN0a9WIk5Sa01MpDXBQAdVtrA8lBhFnnKpsmoo5VBrhszV0KuJ5N2tP92O50iQjpzcctravoihdoi0Q1NrfN56m0VWzFBoje+OrD/s7pr0F0yUr6s5/LvUu/bz+B2ep+IHdMIV2SUZfCsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jessibuca-container .jessibuca-ptz-focus-near:hover .jessibuca-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////c3Nz09PTp6enR0dHFxcW7u7uwsLAUKT0cAAAADXRSTlMA3IrE6WIm9wI+y0gNQZpqdwAAAOdJREFUKM99U9GShCAMQ8BF3Cmlpfz/r15dAe88l8zwQiQkoRrTEa3zIXhno7lhWxcYWNbtN/fa4Q/218VFDzf4of0O8A/h3TQfOGU/ytsOj9gPVyt8warkmYEQQAgABYDxTKROz88koS6AVIB1fRCNbSI1cVUy15Jq27LGjTtyzipPeWw40/IXQkrHyZSRmqw3LaQgctFNKYzYyGACfEXossLMojFEj7J0WfdwJ3dD9uY2X25tL0Hj45mTR87Y66u9IQFsDS1bL57o7JbUDNIofvpk08eej8kTe3Hz0ZwP9UFfv8OgfgBUByCEUZhYtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-ptz-arrow{cursor:pointer;position:absolute;width:0;height:0}.jessibuca-container .jessibuca-ptz-arrow-up{left:71px;top:15px;border:7px solid transparent;border-bottom:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-right{top:71px;right:15px;border:7px solid transparent;border-left:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-left{left:15px;top:71px;border:7px solid transparent;border-right:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-down{left:71px;bottom:15px;border:7px solid transparent;border-top:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-left-up{transform:rotate(45deg);left:32px;top:33px;border:7px solid transparent;border-right:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-right-up{transform:rotate(-45deg);right:32px;top:33px;border:7px solid transparent;border-left:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-left-down{transform:rotate(45deg);left:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-right-down{transform:rotate(-45deg);right:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jessibuca-container .jessibuca-loading-bg{display:none;position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jessibuca-container .jessibuca-loading-bg img{width:100%;height:100%}.jessibuca-container .jessibuca-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jessibuca-container .jessibuca-play-big{position:absolute;display:none;height:100%;width:100%;background:rgba(0,0,0,.4)}.jessibuca-container .jessibuca-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jessibuca-container .jessibuca-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==")}.jessibuca-container .jessibuca-recording{display:none;position:absolute;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:95px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jessibuca-container .jessibuca-recording .jessibuca-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;animation:magentaPulse 1s linear infinite}.jessibuca-container .jessibuca-recording .jessibuca-recording-time{font-size:14px;font-weight:500;color:#ddd}.jessibuca-container .jessibuca-recording .jessibuca-icon-recordStop{width:16px;height:16px;cursor:pointer}.jessibuca-container .jessibuca-zoom-controls{display:none;position:absolute;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:150px;height:30px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jessibuca-container .jessibuca-zoom-controls .jessibuca-zoom-narrow{width:16px;height:16px;cursor:pointer}.jessibuca-container .jessibuca-zoom-controls .jessibuca-zoom-tips{font-size:14px;font-weight:500;color:#ddd}.jessibuca-container .jessibuca-zoom-controls .jessibuca-zoom-expand,.jessibuca-container .jessibuca-zoom-controls .jessibuca-zoom-stop2{width:16px;height:16px;cursor:pointer}.jessibuca-container .jessibuca-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jessibuca-container .jessibuca-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jessibuca-container .jessibuca-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;transition:all .2s ease-in-out;-webkit-user-select:none;user-select:none;transition:width .5s ease-in}.jessibuca-container .jessibuca-controls .jessibuca-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jessibuca-container .jessibuca-controls .jessibuca-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-face,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-face-active,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-fullscreen,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-fullscreen-exit,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-icon-audio,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-microphone-close,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-pause,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-performance,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-performance-active,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-play,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-ptz,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-ptz-active,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-quality-menu,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-record,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-record-stop,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-scale-menu,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-screenshot,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-speed-menu,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-template-menu,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-volume,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-zoom,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-zoom-stop{display:none}.jessibuca-container .jessibuca-controls .jessibuca-controls-item-html{position:relative;display:none;justify-content:center}.jessibuca-container .jessibuca-controls .jessibuca-icon-audio,.jessibuca-container .jessibuca-controls .jessibuca-icon-mute{z-index:1}.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom{display:flex;justify-content:space-between;height:100%}.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-left,.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-right{display:flex;align-items:center}.jessibuca-container.jessibuca-controls-show .jessibuca-controls{opacity:1;visibility:visible}.jessibuca-container.jessibuca-controls-show-auto-hide .jessibuca-controls{opacity:.8;visibility:visible;display:none}.jessibuca-container.jessibuca-hide-cursor *{cursor:none!important}.jessibuca-container .jessibuca-icon-loading{width:50px;height:50px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEVHcEx4eHh4eHh4eHh4eHh3d3d4eHh4eHh4eHh4eHh4eHiqaCaRAAAACnRSTlMAikwX3CxpwZ7zIGi5xgAAAZ9JREFUOMt9lb9Lw0AUx2Njqm4iGEqmEnBxslKUdhJctFMVcW5wKZ0CLpJJQRw6iVqQbg3FtPdX+l5+XHJ3796bQj557773fe8ujtOI+6jz5p84dHjTkYD4+RhT9CIRZWRPJr1bChnbY532GhT4oUpbI6HEuqvgIH9544dh9J4/rpr0Ms8oV3zMNT7X1MXSmaznzfHjM4n72moe5n8ryYrW9rKRvgf0S93JA7yKa9lbzUg3keJb8OVCtwkrFmoO4MnsAuj5rGqnZg+GZXUXkl9NjEui9n3YA9XgpMgakLXz6ujMTIgrCkPVv0Jil8KgKQN/wRN69hLcb1vrbR2nQkxwiZTGQ5Teb7TO8PUaS8Q03sE+zkjP8qbjzgJtEhRbV4gnlkOFeM7hDYNdxPbiYFvKSHN6L2NmY5WzMYPtplZdTxncRvn2sI+DHIoug22jWMaA12Y7BrXzrG8BX32XPMDKWVzw1bdMOnH1KNqNi8toqn7JGumZnStXLi0e4tcP6R3I635Nc/mzsMxl9aux9b78UVmn2pve8u6eR50j9c0/ywzyVl5+z84AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;animation:rotation 1s linear infinite}.jessibuca-container .jessibuca-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEzMzMzMzMzMzMzMzMzNzc3MzMzMzMzNzc3Nzc3MzMzMzMwv5ahDAAAAC3RSTlMAW+8S2UGVwyyZnOTRhEMAAAEfSURBVDjLzZKxbsJADIYdBQpsSCyVMlXAdEuQYGKpWFk6dWHJgsQ7sMDSpUv3PgITAQT0f7ly57ucQ45KXRAZot+/89k+X4ju9KzL4XOhlm3pR0enYrWViSRPXQIQSASkRSkIJEFRimYCuQAHSW89IOv6SH5TCsuAj68Ab1wDzqkAzqoC7AUAPtgsABgkBBgkCJiNHehGok//KRVsHqd+3Dj1/vukt3AH/Jj05s5/AmyZhFVWXDls44iVvfQWkCvgxU6g9ZdJfCLvjJbYaT3GvjOY4mQSG3SJGjhr/Y1Xohp+TGKqqzexZ/1GVGdNCitt6R8zVvb9d+JmKdl8o5sPWbtxT6zFuJcDQtk92MNmYiXHquYlZlVt1j4P6cd7fgHFW7Nhqu29TwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEz////////////////////////////////////////////////////////NXt0CAAAADnRSTlMAWe+X2TINXUYZvctoYyuS2NgAAAEVSURBVDjLzZKhDsJADIZLCAsEg8WgEGCWGSwCgZxB4MgEAonB8wQEXoBH4BEWXgPJgEBG0mdgR3u77raRYAgnlq+9+/t3TQF+dKbZcJXSYSnzlViT457lRScKmBqILSFA3GoO8S4E+Ex5JiSJ4CbVdyOQdZNomX9D4dl+ko3NC8vFFmhPy8FIsi0ZlwLBW/LY5BxYYreUSgoFAEmhB5Rc9OCbUoXmTmDadQKTn4y6A/XTaoSKdb6KyGU6RJ7eHgpb3ABinAoil303xB6vQnRahNhXvMdre+fzOgxVrokX4jHAnBh8PALU8Eq8BqgTg/vePF8tpuPy9/NFaalSc273RizarYqfkswjifNMQ/TyTGMv4v87L+ks5gqDbc9OAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEzMzMzHx8fMzMzMzMzOzs7MzMz4IlKVAAAABnRSTlMA6xIU1hVqIuOVAAAAMUlEQVQ4y2NgGFYgLS3RAEQziQFZoxKjEqMSaBJpEAkgIw1ZQlBQRAEs4QhkDeIMDgAWx1gMHyIL4wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEz///////////////////////+3ygHaAAAABnRSTlMA7OgSFBXMmAA4AAAAM0lEQVQ4y2NgGFYgLS3JAUQzi6WlJY5KjEqMSqBJpEEkgIw0ZAklJSUDsISikpLQIM7gAJjhWp6XcaOxAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEVHcEzGxsbMzMzMzMzLy8vMzMzMzMzNzc3MzMzMzMxEZ/aQAAAACXRSTlMADPKKKeBxlV6neZ4mAAAArUlEQVQ4y2NgGDZgJhpowCURAJeYpIQENJEkCgWRgCeShAGyjfgl2EqwS7BFToZJiLg4ICTEImdOh0pwRM6cDJcIjpw5E6aDFeh8B5gECBCUYAkKCoMbNXNSOlyCgUEQ4apJJmxIEkjOVWFgxi4RgEsikGQJnEYp4pLA6VxUDyJLIAUJcRLIwY7qXKSIQvOHWCQODzKIleBPPjgTHM4kijNR48oGkajiYUMykwMAAfmZhUjBISQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMA8gyMLeRw1x2DBpWGN2QDAAAAt0lEQVQ4y2NgGDbgDBpIwCVRAJc4KIgEZM4EwCU2KSEBHySJCcg29iBJGCBLgHUs24FdYlnNYZiESksDXKJALebMaagES8yZw3CJypgzZ2A6WIHOd4BJgABMgh2XBEtpaBjcqDMHs+ESDFyLEK46aMGGkEB2rgQDJ3aJAFwSUSRL4DQKp+VHcTkXxYMoEkhBQpwEcrCjSCBHFJo/1GIO408MOJMPzgSHM4niTNS4skENqnjYkMzkAEgzyFpeX6L3AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAOVBMVEVHcEz///////////////////////////////////////////////////////////////////////99PJZNAAAAEnRSTlMAMPndsnZj1CSYPcmL6wsdoU80pOJLAAABu0lEQVRIx5VV26KEIAhMA++p9f8fezatFDPr8LSrjMxwiWlqzRuMYKW0ENH46c3WuGyVLXEduuO83UyK59fl1jX5EEUXD9DOaSh43XEP5zUIdZ4pAecTofVnWSt3ip4rx7N61vjnY1D30CpH4QQR8vsP+RA5Rs3KpjfMU/pMim/LgbvH7DF2F8sU0owqapKLqgnhuGWwImUagn2zhUX6WQQoYkXG9WxSAJd700/ygsCpAoliaDsPiG48GM1X5Ft/06sfp8DrDE+3DpekWjxM6366fgEcnklC+AIIWYQmPEeAaUmjFOnhCLDfxZRH+w1gU5b/DYjfNcyJ0p7dxX8B+FwxQVtvAGB5ig0d5gFA5KbzS91hI8CenvlHflfN/XvzJQnxbBEko1gbvVnPii+FadSVRUEaYylQfJtpLB+aRG4LY/80yKdUbCraM0lozGR4ewZ0Wtnj1iC7hjWKNnjYmR62W15cLlL3+2pyMR09jccyuyUrHKsvthc5xsY1iWJ0Xk3t+2XP7AnWwrAQmBH6asXubmL1Z5Lz6o992jWiu9lnMSiQsK27FS9NxhCumZgB2fTBPFsFolhZr5B/D3o9sJAI6skAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEwimP0imPwimP8imPwimP0imPsimP0imfsimPwimP0imPwimf8imPwimPwimPxLmg1rAAAAD3RSTlMA15sisGUvdz3szYwMT8H+hDJEAAABx0lEQVQ4y3WUO08CQRCADxBQchBiMDE24KswFlw0Wtig/oHzUWglJBZWio3GDjUxlhhrEzT+ABMrO2iptLLVRluDggI+xtmdXW73LkxxNzvfzuzszNwZhhDzdOxqaPGgYrgkOgFczh90ezAJQmpL2v6OHYnqk2aWxOTtAnu/O/Y5XNZXmTZjo3ot7aESwLdFeqAM0MoJkMf9ltwVQJ9PcQN0UFIJogvdJgLQVFMsAlxyBaPmVBDCE8W7qd+2SDsx0q4OwhSrCG134W54jDfKLjDNxaL8/9AAMM/solptRnoALBbwEPWYrOEzLnrZsTGoMW+fBHG2SiLPUNI6KMOH8QS/XsCMBYQekIEv7NGZF/Rht2yqmA4i3UG9O0iTqgMfhirDhRdU8XJZqqEO8tDAqje8IIt1r+I5HmBjfD9AxQ1MgJQRpc6GJRALHOAS1WRlhMs4VaSFzwIWzCUF3op71kdNsNs/FDCuA58YqCQl7IhN3WbDnlLtfjnuON515WM17c7w41QPOuBIzDT5wqi0T4ESGV3gjtTjkuPATwHoX9+cPRlmmvJ57YAir2qKy459QL/UhrS/uAu3xf8KiX3DI+b22t6jc9F/qfaum9E1pJ4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEzMzMzOzs7Pz8/MzMzMzMzNzc3MzMzMzMzMzMzMzMzMzMzNzc3MzMzMzMxdHBitAAAADnRSTlMA8AwGYt0aUcg+til5kgmZywUAAAGWSURBVDjL1VM9SwNBEB12IcGkMagxNktQSZFCYimIJAqKpZ3Vco3YBYs0NkKQgBg4ECtLFSFVCGgQrERBsLayPE0Ip7n5De73BdKLTrE3ezPvze6+GYDfsAQKy/Rz0i/OZJjY9XREuohTKulS+ZFGiADfyZXU5uHktI44VH5apDx554aXwJqloiIwiEsStAjCAsRNF1jCmGqa4Vc+BvS4JkjwzyPE6xiwzsxxeTbZxqjkANSWZFkoIj5bQBl4aBDfkPDNpeRRialB+SRAFz8UU1sAaEUjSCDoJ7iukZJ1V+c01bFczM1pWaa+a0Rp7MHn4V8Z1R9vLLCv9WjKdVFfk77JP+bZdz35YAfKXx6KhKp93abUYVbrj49g9aAYSuFCLbPUwzdCsYEWTloXgw1oGwQbENeuKwxzXhxwAADRMFd+zzRc6AAASY6RH8VjUHaXTrlOpDgCUP3gelc01e2d+f16cWbnQ46BGCRNVsWAWQJVw2xGfUXVv2k1OsLfazXqblzS99u1FwKFvBJioXBY2+r82U75Ab7O0ypVV0wKAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEz///////////////////////////////////////////////////////////////////+GUsxbAAAAEXRSTlMA3clDHfdfDQbsVG00u4Cqkr04dRsAAAGaSURBVEjH7VXLdsQgCPUBAROdjP//s1UTDUxsz3TRTc+wC94bHsLVmP9hkE8LIdvgupt2tFhcpy2CMZyVxNePEoqDp4hwEGz5PTqWoZNzLrmD9riltBEYzzpZQ8bweXy56Qy6Tivsp5JQYtawuMH3eJlSxIJtdSSa4xer4lMB89pK23mKrwjZVpsRzLq35vEE3+r26h6w5EKppcp3fP2lIpTPWJvoXoobeNI1sM3haHvx56tu2sdElJ54GbnPQ7RZ1sCpl8qPEMXBNQ8vN82jNbzLCPzGSDOZj/2Bqd19R1rELIEbDFrUJfKYdlALbDuDMko/hz7t8DqtCfr8h1Vt4rn7eh/6Ph37ch20aW8McsfGCOXzcr+GOlQG1rJ2HSHUDO/4Mu01qVAqTCpCJfgZ3phTS2pKm5aZOMUbs7Q6nk6L8UzRh6W78jH+gD/VRxHokPuNgUGTaPPR+zDR1mrlvcGgwkAVacSbeoN4Z0rb5/6XLrW/2GTLk2NhXHRKzrqAt9cD4rr4ddvae0NAYgOICdZyvPj4UYRf2BdfbB8iWvnTUwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxi4XDRAAAACHRSTlMAf3WqJmy+7azWNnMAAADNSURBVDjLxZQ9E4IwDIaLfMzCOTDSOz07OjLir5CR0dmJFVHIzzZtnMzbOzcyZHnuaXpJWmO2ji4GhpAzzZeQzw8FKCj1pMHss9OgpwsGOS0YGOcVUMPsfBVkmJoVCBJW0FFB6SFIaMKAlRGDnEiDkuM00lP3SmL6H5QSh+iIr9ZWVWntUV9Z4qWbHAWrhcUYNLC4Wwm3xb1r2mOQYoVn2EKFAVb81KHiQQq6L3vSUoMBUmSzgCKbVeiL3eTp3Odf8H1sxRAZZNZt/Vt8AHcPQbiQQVF+AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAe4Fzh7MZbKPtN8gpX19xAAAA3klEQVQ4y8XUIQ7CQBAF0CWhKQHDGtQKQFcURUgqEARBED0Aoqp3IKnoATAEW8MNOACmhQYKcyi6uyjmr+aLqXj56bSbVoh/J3HBxcw0ZfA2c3FiQLGeQcWh1lOVDDJTAeCbCgAR6QqCDj0xCEU5Bl2BIALKMwhdKjGILRUYfCIOEynlvABANk64M5jabJxHfJY2I76yzYu/ZCc0s1WbNYAQ3jxqwMoGHoqWGHpUQajEgcYYcKWFtjLE4FGJQewoxODRDQOqKPPcHl9sfzSXa/0L349tEDsOsp/8+2/xAY+BZBY9KhM5AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzKysrMzMzMzMzMzMzMzMzMzMzMzMzMzMzNzc3MzMz8gU00AAAACnRSTlMAL0jMZKt96hGJsSKv1QAAAJ9JREFUOMvN078KQFAYBfCbJEw2q6SUyWxTnsJT2JTJ6D38Gb6n5PpT6BwbuaNfTnz3fEp9fZwAP7czD0MsGCzBYJcEYsGwBEHQQRB0EII1CMAWdAOzyJUvJ4jyDVyZVHKGpj9guEI2IuhaDFadYnCkIm9I+kPgn8t+kI7kOsT72HcwQnJR9Gofy8DrwwtHK8pLzdeALg5fNb6cdJ1fOjOGYrl5CLFcggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAL0TQf2frEaZYt8E+idL4AAAAnUlEQVQ4y2NgoDdgUcAuzr4Hh4TaGQHsBp3BLsG+BoeE2hnsEkCDsEqADMIqATIImwTYICwSEIPQJFhnBjKInUGSUA2CSPCcOcIwB1ki5xRM4iiDDrKEzQlsEuUF2CVY0jbgkDhjMLQkEkj0IM4gQQ1EHMHOOXMiakRpTiQQtXgTA+7kgzvB4UyiuBM17myAM+Pgzmq4MyfO7EwjAAAEf+BAxqI/agAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMztXryaAAAAD3RSTlMAHd4P7ztyiy1OnKhdx7uY2gyAAAAB8ElEQVQ4y72Uu0vDQBzHE45C3SJFaSGjUEiRpJRCBifXokkpSv0DfOBrEKxUUSoFH9ClFAUfU7c4OARRCs5WjThIsJuDlLo4ldvPe8SYxGyCt1zgw+dev+8vHPcvYybvfCR2OgUv2CoLdI62bUn3gq5UJxOomZofXPUNrIChJRklfcDSiKK2bYQ6PiCaREk0EQoYPFYa3F73F+DGsBJLmAjBAMBKakG15KAxqIhd2KuK5reRccBDNbqGJhfSlnNc/kBh4OY+vaoR5QrRC0afKgxMrKdXNKI8yxRENpyd+i0VA6wMm5IOBmORCwfAFjGwolofevbuPrvpGhRgpVaqiJflrLuUQQFRToS9l894EMDe7q6yL7/G5wMATc5mQCiAvQo3HAbwLtyYHQZgTxhohgGUa/CP12EA16W2/Ou4ZEj1dNG9oPMkZGiwJWQ8j+huPoJy9Z/XHTfUFSbAURveCtE5px5vs7hQDKS25FSDn2KR5Up1/lRmIHne7BvKd82LMRJbSjr5M40lmaYZ5/PRpiCpizjJyk+CwOGOzACLpSdz02QxkiuRhd8dNOwkV7zl2YX1mcySKJrQiPkXY9klSt6rkJPRwIlmzrcWSGyzHuTb11V/N0y/S6SdwdCR4m/47OIN7XOQCfwJwHGp8IcfyRdBLEZK4Uxp6wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAP1BMVEVHcEz///////////////////////////////////////////////////////////////////////////////9KjZoYAAAAFHRSTlMAbk2o8o0P5TsGnVojFi/XHcV9urLaq0oAAAIQSURBVEjH3ZZZkqswDEXxLM8T+1/rkw0BuwM0f131+IvDyZVk6SrL8p88QCHp8UAnWmoWoG8AwQRN4/vOiqwUuwWqiob646MMhEW+KnMLMIXffgiZoODBusb7kCzjByF7OOszkOyp4amJ7fWVPwCN6BpyWRypvANPCvi7u4aTXe13YI+KkYA5bMRTSMlLnSyGwisSH40B0FJOrKVB6iAw2U7sGgPgQ/DTPQjitCOZT4Q6gWCtGwGFbSM34ENUNSpAKTACmC31rnRgJwjDdkFAJpfkAsZcAJvCSVQB2FaWWKdB/ATMAHwIUYL21lRBZRDiC5AnsBHBUqxEyaraFMoz0AnvHNa6xDWS34FGgNf6PYAEZoCt+BroUWFVbeb5HbCqSvB2cToyca+Adjlycdawt0C/HeyScl1W/w3gsU3aAd7JF8AuAN6isr7NAogXAFeq59Ec7ifAm49hF8wCMWfVNXAeCAkjEGuBr6R5ZGJzBrl4gGniBME+w8aMMyCsNZtfaemnmYaAQ6I3Rz0fnDhHJxc93Vrr7sHWjP3XRtTba2L3EkdFVaPC6YmXxKI9DGF1YPLdiwfD2r37cL5nDVw+uKzU5K27hsXCXPtyC2uyyl0D0p2TY7VaIvFYWU0Dm8TdOXmrVp52HG4lU4K/N38PpS/Kw70dbmb/sC0WCcQwNNzzjrzUj7veUyIIyL/4m/EP8V829O8zh5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-ptz{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAM1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzNzc3MzMzNzc3MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxDm1AzAAAAEXRSTlMAHqw+E8It/gjxc03jhGDTlgAjE2kAAAI6SURBVEjHpVbZkoQgDBwg3Of/f+12gtfMbK1Yy4NampCju4Ov1y8ruNyyo9fyCibVlNW6vUu29GpWQwTVdPTernqwffHex0WP4Nro3k+PrMKCvew/PcZ95aoNsY9yua+cGxTZsnf2K7ch4CAdGnWwYx/5LgKZCgxGdrhH3BeqNmnwviFXPZbQJmcM25HJ5n7/Pczr2QqksMJfO7BJOHLKLWFdMiL1QXYRwFagMklb4GB1zS7s8Le3fqH7Q28tVLkKdIzeaOJB2OKtY8KfTQCUa4++dNsLbrqpTR7xguHGt8hfg8P+seuaEkNdBjahzOD7g1cHP21SL2LtMNBKMdTRJjffTX1wVgrsEb1ITJU6QknwYJAcQky2cE02NbzPp70KyKggtpu9xM7Ik+CBIqY+8FrYyRUkrs+MEm1TG6tG9LZxNDNFGDue63TYGgIHqUUcuNhvhyZtn5LnlDq3Juxa4noCuX0scErOpNMDCrVcHPCS5rFGuQR9KZpxnB6CQ0ZO+AIBcTPk3UdbTx1L7jLEEHsMW7ZYm8NlIFyxn8+xdL7MURYEhzd5k2N2TabxIAORwC2r00QQfNSgrnqTJfh7cDmDu9ggtV0EZFr7kGu4KAxtNDln406TLwF9iZCIwn9EfjPuncRHYm5x3NfK3cFAS5kWxljSnTFlPHBAUFg5HsCCVOd9cdwXq+027un2QJlMjqISJutCDceRtTTuT4+1Q3HWHR8cu0fh9sGvADTYH9iLah/9nPz5+/MDJnQfoIVoAnQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-ptz:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAQlBMVEVHcEz////////////////////////////////////////////////////////////////////////////////////1bZCPAAAAFXRSTlMAeVoYDS1pBiPv4/g6lkzO2qSxvoixscijAAACi0lEQVRIx51W2ZLcIAwcLnPf+P9/NS2wp5xkq0ziF3ZRC3R0i/l8fvi04oxx89n+RBi1sqB38TKw7lw7lNzDa3U0e57bHhJ4d567HlqGC08eLAj9Gv8XD4/OwtsdhlfCW2s9LfWtuNrMhG1uLWP17Xh14LF4m8dx1OJ9jkm85YCYch5JzDVy81on3MFYkpTNYGmHHloYI+aqlNhlh5ZSvmH1AyBUwPcMX+u/clW3XYvA2YgRGXyZIZX6PXv0l3GlV9Jp9FKcK7mytJIg8xEeBdaBtV4P8tAixexnp73tY7ZBkrk9WEL8t7ZUDqtIA3jXa8sODSeUVqw5aztT+g4QeNAgM0PGTA0+EmfVeUvU0CEW4hX+lt/zseE7jJKDSmi0EUKBhr7EAMKPvNjOA9Fz4Yk/CFgcGRSdkYOHCLRxQfzKRN5SB/b5Ot8SzzQiKqcb6ipFdCfi1JI84OBdxzarhJ8RkpxHOQszl7bpn0GpmnXq6R4OfTkwwlyUWzeQg7rSLNhNUzEUEqJF3DMHeeXgqRIaYwHimLKipK8hMZOYVfJ5oKtIFSgXk5z4KcNx3GOIPGYfPigh9YGHBNQKVKbZhxMnqq+OHfWBHARZfWm1dnfSXfJuXInplse8wy39zkisdQ5kuLY+Bpc5hwGiH8Mx1rE24DFaLqXkfrNVkjk+8JPTPF0bUw+R9MCVuA8ks/xDyF/9orMqpBQeiob5RbIbmv7/TxvoX1Oqa914TsYg7QUWx8Y7R89JQY8mY6Dat1G5GARuMOgYHY9cbL1vNvc++fk67olLk4nrQSl7457OPqdeKn+vEwm4LPzW87DyXvqIyei9znHS+cZz9SxV+Qf8nNbjn37NkDx4+PmCXzHOLUMtjgmUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-ptzActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEwgmv8imPwimPwhmP8imP8imPwimPwmmf8imPwimPwhmP0imPwimPwimPwimPsimP0imPoLqfILAAAAEnRSTlMADprCJBnU/gXwh3LiUKxAXjJ/ELXKAAACbklEQVRIx5VW2bbjIAwLa1jM9v8/O7Iht+09MwPlpS2VwLZkJ9f1lxVG1joPdZ0u1ZIxurhv8DH6dMpQI5t439GAEc7xYPgTRnAtV7plReRhd5kDP8+fd+wzt70yPhIJzWT7/6DCJCAYLReZPMIuJC4pClSktHqbNpJO1aTmmAme3cvtWs9NSfq52CPhnJNjlbVHwgmWSWGHeQHcKFjj7fygwidf2fa4mbVOuladcnsoDn9/CKKAWf6HEtpANiJvUp9Fgr0SvocPP/sqjOCK9ktpyCAo4Kt/d4n4/6baseNKAt5XrauPN1A4ZLAd30RUI4kNfELVx+yd3lrXYIg1Bp/B/dGs5N8mPsJoVyiwkofQSlm+K9aiwmoQMDoI4wefoK/rhkESrSuV+BR2i6HZH9juLzxCtBmn6rFmB66gNJQwBOSxncT/N3FAlxAoLQfJDy2+6rMLI3aznl9fhOcGSdZzoNhex2K3TXJEVe3M4Zb6QhHuJc5BWakYIqqietcPw6FK+EHofUHRqtLEQ5X8dKVENXXgEpLOpcjwkFI30YFVHE8fyx2ShZJ/ydTKlZwZ4BCOv/af9uMi0DILe4kieynScgPbhai+DRDckTT6N6zJpI3HMghM3BMg+q9pHmwrbR0Q0D5wc0JHPy0E5Ur7Nf3Rk68LnR0NHfO28/T5P4cNr+uLFR7eEdiNxvMRbd5Onlqsis4iIVdme4di3akWOz+3T0aUnFWHa8QZrO51NO69MeLPafrNuBenxel/3d21j8k/jyxf+75OQabFxOtuT94G3Lpjzb0zBn2Dl0ep/waPidQ/p/XB60Dp7e8F/QO7WSJg4zEzdwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-ptzActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcExru/9ru/9qu/9ru/9ru/9ru/9ru/9svP9ruv9ru/9ru/9ru/9ru/9ru/9ru/9ru/9ru/+3uxEqAAAAEnRSTlMA5q0cR/PC/ggSKtN5OIhaa5izIOiAAAACV0lEQVRIx5VW2ZLjMAiMToNu/f/PboNsJ5PaKWv8kKRkWkDTQF6v/zyUfO+JX9sP1dKKd/v2acQcm992kbo1R4il7iHIif0BRNtCUOozH4cikAdt2YfjRLTnzN15/8I85wFCI2xDzlnyMLO7R0aFoTzbFGB+jIkYLkyePvmW8d2fs2ZfZuv8It9s6zvV5uSr2LmKb9oVh37QvpjYOcf8fcO3Cb1jGqOU0SvTTd6X2KUBLgKdLzaiDtE2n+isTh8/+AX7E6/Vh/NNSyfVm10RXIe1nxXRapmsDQB7SMnkmE0IxgqvUn0jteEf1T2CHXgr0gjZllGk1HoJL7lD7fRpD20CgJcwQ6EdSh3lLK0zVfuqz2WvPlPJh7HqnCQ4MysxoAYQE0vHub/toRuqzRy5pEUvbg62MzlJQn1MHBe1x7WSAddpNDSN1c9wRMhKfi2jrICwAIsQvHkD7Al41bOrBNC1Y7QdmSg15LDokGETJB/imxYJKfmFMDqI3FjUkDS3NSEDjBaxknRYSb+4nj4kC43W2OKrkqGB8jV2Fq03YiWbhHQTpUV1mMHXWYf8HlNX7ZUQRC6iwBAIK0r0ILr1UxqKsPattAkhwSIiMl76bT/Ft/TbTy2jHQoM7Cz9isHVMb6GILl0H4DGivbw7xNc8rAtiJn3O/qvD6JT/wgs7Y370ZSdWmbZWEKiG1lXImldW7Q1jGMbZW9tUVKZmGjjGvf+EXAqzWiX5OfFSHVp/zjbfGPc3whdcbTF67V2N1e79qYMru2/AnzVYFsdWFt/+nOypv8vQvoHou4gOtSrG5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-performance{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTM7OzszMzM3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3NzW8hQDoAAAAMdFJOUwC/gO8ra6tUQNmVEKtAA1gAAAE4SURBVDjLzZMhT8RAEIWnpS3tXcWdQ6wgOJIKfFdUICv6AyruB5w4EuSJCwRXgUBWkGArLsEi6JVuaZkfxawguSWz/p7azLdtdt97C3ASagp+PpeXPDjHVx7McMWDCBc8qPCZB4m44YFIeOBh+ckCf9z+sCCYqi8WvA/5Nwu26cfA+JRBs4h7WmX/tr9AXcQHAPdgzEPZh5idTQBOZ3zyiModISKQGxZ7dd85E0SKfMGjM7vXeI/5AE5LvrwpcK9IOrQYB5BlCsFIvjzgrkaSjsBZbmC9XsGsAxfn8gKXpL9sSlnQFBwFTTuaKWXgI5Ar+sfHTrW6DUDO+2jEEtCNQ9wL6gNujMvvdFS3eugxGT51fBXxTvF1wLLngbT0BGphKalAy0MQ3Z4Ha2V7UoMFJKkFVAWcvH4B0OJfd9YsTl0AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-performance:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwD2qdfrViyAwW2XORBGtSCsD6SyAAABN0lEQVRIx+2VzQ7DIAyDYfxToH7/p10CbQ+T2s33Rb1MijM3/qDG/EurolD9zSNRggBU0hFelMABmenfADhGkJDhGUFGgiX6I1AAQlDgZK/td8ELtQORiTmIq42I2bYdCD8NjzPmYQxO+rbn2S5qzEUF6YjkgcJude56X3s0SoL7LRAeylyaVPiFq0Jyx230mpeXmXVOHssRbhackhCq25Sny++xcBW1n6Snqw6BTgrqRP6kzfDcgmRLGonDWSf2OecwB491dOrEVZpNsxiyiHzWJ0Z+BbBwzaoWVb49HrqVfSkxHen7WNznLhzl8xpQlT3E9oHUtYaufB+7NY9g9ctbjFfj/h1DwXUrzDltMn1Ql9M814EQWPLmEBg4R7JSzpFQxTmSBMkLvJKOhFHfKEEnv3L/+qw3DuMPzAFH9pIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-performanceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUdwTBGW2xKV2hKW3BKW2xGW3BKW2xGW3BGW2xKW2xKV3RGW2xGW2xGW3BKW2+P2IvgAAAAOdFJOUwC/gCvzq1RAleURc9VmrA9rXAAAAT9JREFUOMvNkzFLw1AUhU+SxtTahnZyC+IsIeAenDuE/oJQcS/FTYTi6hKcHYpDZ/EXBME95BeURpM0Me39Db4Mgk/u23umcL8kvHfOucBBKEr5eW95xoMjeuBBlyY86NOQBwt654HrPPHAca/YuUHrDQsG9eybBWa1+GLBqvS3LJiNX0vGJw/R0N6LJ+/f6x9I3uwG0D+luRU0FnmdCtBy6ZM7KvQdjgXwJYuNZVNrFfqF8IX+nFm/oBvyS2iZ8OWxgH4u1IZmU4kgfoa5E77c0jwhoTYCbTRFGE7QrXFCveCURkK/2cRBCp2gFYiyWk7Jw4AgXOmQZMAqa9uAeCP+JsViihtb9OKIPtBUuvy8jeqyHRpMhvc5X0W6Lvg60HrPg0DREySOoqQJKRbByRWbExaqlSoVwB0rwCLFwesHquttxhcsa64AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-performanceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTH3G63zE6n3G7H3F633G7H3F633G633F7H3F7HvG7H3G7H3F6xOzy+EAAAAMdFJOUwC/hKbvK0BT2XURZct0z00AAAE3SURBVDjLzZMhU8NAEIX3LiSUNqI1qBMMChFRgYxAd07E4CI6HQwzEUXgKjC4CH5ABAKJyA+oaHqBJO3+KPaYYSZh9nyfyuyXu7l77x3ASSgu+flYX/HgHOc8kC4wwikPMnzhQaTueKAiHvi43bFg0m4OLPBM9sWCjyb9ZsHm8NkwPiUQT8MjfSX/fn+F/C3syJf9YB7oLsDkjIaiHix5QCNbGBmAFPve+3lXi/0viLB3ZnmDz5g2ICry5daAvCbZhSE2oIsFeC35ssJljiQbgZitIY7nIGu4wLG+xBnpL5tClxQhCANR1Q5TSmCCQK7YjftOVbYNUOxot0EsHl0uwHdFfcD14PJLG9W9HfpMho81X0V8MnwdcHvkgS4cBcqVo6QKHQ9B1a6XY1zAcSiIFg6QlXDy+gEd714RcAqEowAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-face{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTL+/v76+vsDAwL+/v7+/v7+/v8DAwL+/v7+/v96T4QgAAAAJdFJOUwBAgSCbs9hZap+hQJoAAADvSURBVDjLY2AYRkAJCAygbEZBQUEBKJtpJhDAOJpA9kSYxESgKphuIaBuhASqyYzESjC2hDRilQBZ64BFgm2qMLPYNCwSkQpAwlMBWYIRzJsKYrKCxZSRncKSDFYzBSNY2MD2MqRhSFgqgClPAwwJBxwSbAk4jGKZDCKZp2JIsEOcOx0ztjQDYL5ENwsYJKrTsMSvGSgepzVg2pE5qSikPRPT8sopBuDod0ATZ54JsbZyBrJgAVAp1Ax2oPXMykjxYQaLA2CMoERUZQDMrgBUCc8CKIdzAvHJhyQJpLQLSu0TCaV2lPwBSu0KQy+LAwBuJj5UbruNggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-face:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTP///////////////////////////////////////////////w2imYoAAAAMdFJOUwBAgBvfrFmcw4wrbtGliFoAAAD2SURBVDjLY2AYRkAJCAygbEZBQUEBKJvpDBDAODpA9kGYxEGgKphuIaBuhASqyYzESjBu79yIVWIP0NoCLBIsR4WZJY5gkYiZACRqFJAlGMG8EyAmK1hMGdkp7M4gkus4RrCwBIApFwwJmwlgqsYAQ6IAIrEAwygHHEaxngJbfhRDgg0sxHoMM7Z0AmC+RAPsJ4S5NE5gid8VoHg8sgHTDh/PzM60HkzLc44bgKMf3RKuMwoQ+dNIgswJDAycUDPYjhgwMCsjxYcJLA6AMYISUTkBMLsaUCVqEqAcngPEJx+SJJDSLii1HySU2lHyByi1Kwy9LA4AqflRBKNSA88AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-faceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTBCT2xKV2hGY2hKW2xGW2xGW2xGW2xKX3BGX3BKW23povfoAAAAKdFJOUwBAgRybs9hZLG6hrV9tAAAA80lEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTgmZiFViFtBaBywSbEuFmcWWYZGIUgASXgrIEoxg3lIQkxUspozsFJZkEMmxBCNY2MD2MqRhSFgpgCkvAwwJBxwSbAk4jGJZAbZ8KYYEO8S5yzFjSysA5kt0s5YKc6guwxK/baB4XDYB045Vi4pCyrMwLa9aYgCOfgc0cY5VEGurViIJMhcAlULNYF9mwMCsjBQfZrA4AMYISkRVBcDsCkCV8CqAcrgWEJ98SJJASrug1L6QUGpHyR+g1K4w9LI4ALk0RHtSETFcAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-faceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTHzD63zE6n7H7H3F7H3F633G63zF7H3G7H3F7H3F68TinBIAAAAKdFJOUwBAgR+Z31ipwW4yAjb9AAAA+UlEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTmmZiFViFtBaBywSrMuFmSWWYpGoUgASXgrIEowgHtsKEJMDLKaM7BSWYLCaJRjBwloAploxJKwUwJSXAYYE2KUMVRgSrAFgKhTDKPbFIJJ5OYYEG1iIfRlmbGkVwHyJBlhWCDNrrMASvxageFw6AdOOqKCklrQuTMuzlhiAo98BTZx5FcTarJXIgglApVBr2ZYaMDArI8WHKSwOgDGCElFZBTC7GlAlvBKgHK4FxCcfkiSQ0i4otS8klNpR8gcotSsMvSwOAIs+RIlIrewIAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-zoom{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAkUExURUdwTMDAwL+/v7+/v7+/v76+vr+/v7+/v7+/v7+/v7+/v7+/vxtcv/AAAAALdFJOUwBVdZCpGdZE7C3B0wnY6AAAAV9JREFUOMt1lDtPwzAQx20ghGwVsHVJhQRDlsywWKqEULsw8FhRJ2iWiglGGJvFCw8xIVVCSEwkKU25L4ftpOHs2Cclsu7v370smxCLecRh+xOH8Ja5kGEs/6dtYf1XONcWZurbwwRCQjYZ9l7uHAPAOBHpI1QC/QSY9g84ldmnAn7Z3htwsfZnvSe54eJd5hlcC7gccxTwSETZEr5+714vLRdfkFraVNtetXLpR7ha+mkHCV1Y/q8ZOW8AgDkecsIaAEIcGbIGyLUq4KcBYl0o7QAB4FZACBMrQKpaJOCZQqyAIhgayYEpgD1DZghXCvBTNJFKmCvgzmhcCEsBwMjSRx6BslYftRX0JLYKrAsLqzDC54EFMwvy58QhMM8hFNq0UpwET+sLC9/4BmEBTytyRCIbDoAEiR1Qp1dbRxfoyv9g3ogaKVuXhVZZbtqX6Ez6H23PxG4CM259QDwt/h8ABfK8nDqSAAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-zoom:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwCCyreU7KZVRCDaZnETLwj6WaYVAAABUUlEQVRIx5WV2Q6EIAxFoVBWxf7/184AOnGUsvTBqDmXrqRCzNou1kwGtyZIQNuiD0P6evWTURFUMtIoPO+iVoGIZPkMqkdKA0jZgoJ6suQc2EoiGBldOoQ9HSDk5+GTs1Fqo9IlcEpvNv3qv0MBhSalIFSv3+MCJCY8fUaCxasycrMu9dp5VTUhubXZ6CqsAvn66ZAsx+e8fON37oT3bZ4aiRU0kDlavGSrQI95HPBZACt8FuCL16IruBVkzBeBW+CLYHvyfiDQd96IpHpOMqP++fAq9VMQ7rwrM5+6gjwG/3y/D/m8ylPYpvpAeqO7DfvwMPO9D6jnBabG56YFZx77fEjD+9AyLdYEhp8nxoNh5wmJtfY8AS+wzIZZrJNcC4h3wV8IH1p87Iyfnc6XVaAd7ICHAsebw97zgDSxZ/yvViiPuYUfTe650knM2+7Ywz9yOCklzohLOwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-zoomStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwDjmTC6Y0KBVakX8s8iC3JYR1wyAAABVUlEQVRIx62V2baFIAiGcwJRS97/aU/Zbtht0VzrcJOuvl/AAabpXy1RF0F/m2h2PX5mzucEuO9gMon1MY7KlG8w4LImC1XFQmxDGVkm1DYpXi0qS1gXTEGzKoqNS1ajAxPqJDikFLcFS+aukYJffRfXnAj9kYUXFVi86wzzPjuCFRXBwS3KaC/Pt02Ww7uf1jz3BVYtX/OsyDQFDn7yswPXb+Ovs39eJJWwxrOXV4thgC+//QBf/uMAXwAa4AuRBvgdWR58CB2B+eaRG5e8QO7Jn2sIAvzhbdsDnXzev8q0BengGXv8EciH3y1CY5++yI/BRNx82g/La7lc7b0Am/tUC6n3HoZ4SbDyy5BgzSNivV6wbPXeIPOpHlOU+CjkTQKvQOpXdRdJvn+5xttWQa4EZUOzluonT6+q72X6Zb0+T/lNhQd7hg9vm8LWUhW5gT4iN7c/0ZUo8Q3AttYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-zoomStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUdwTBKV2hGW2xKW2xKW2xKW2xGV3BGW2xGW3BGX2xKW3BKW2xCX2xKW2yDN61kAAAANdFJOUwCAVKxm3T/DmhrxKw97YQBGAAABaklEQVQ4y2NgIA6wGqCLMCqAqV4HdIm9F0Ek22UMM9hiG4AkVzQDA+cmx+YyJJnDlw8wMNQaNpfevbu0QgxJgrN3JQPD3VvhjU57kESnOZqvvXuJgcEXxVFMEkDt1w11gZYwoVgue3d5SzaQSgCydZG1TMkBU8vBuq9guBcqNBNDgj0GQrMEb0CVYEmA2ViANRQZ795tQPZduADciXcVUNSthGu4hGrAJawagBIXsWoAClzGqgEocRWrBqDIrQNQDTPRXZ8A0cB41wBNQgGiQfbubTQJAagGDB0GIA0OsnevbkCTCADiu4J374ahW34JqAEIbiXMRJOAgkvMKJYgJBx6717AKiF4F4eOu+jxgQCXGHBIKPDgkBC8JYCURJDtQHYWN4oEcvpZiyR+C9lZtkgSKKG1CyGOGrxItleixjrcLFBWRAYcMIkG9NQMiY67N7AlcxAQwMwA6SBxM2xZQ3jtVRPsRQ83sg8ACMIUxzzE8wsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-close{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-close:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTP///////////////////////////////////8kBMKEAAAAJdFJOUwCt0igUwJdJePGbgLgAAADcSURBVDjL1ZMxEoIwFESTCaOWFDapqeicnAALTiANnaWlnVewDTMW/7b+aCAb8jkAVIHN2/lsNkrt73lf8M08nnF1pAYFR/dFmAAx7SIoi4iDbRrWDMAuQFzmmxAGbjjJgjj6dCjMCAND/o8RWQMzUgIRKYE/wsC5TJIRR74rBUZaqqXwLZEXT0WTDGwLW1aavJWQir9qadw++NgykWoMNtcykh8Q5EECgr5C+jjpGjHjPGhPU5eVzyfPJitfnUyhPg6ywMKZ7BygcYcsPCj1Kc8uXYPqpeSLs6PnC4w8S+8OJ9MLAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-narrow{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwAyqXf5Hu1TZxDRmrxFjN7ZJa7NAAABXElEQVRIx92VS5KFIAxFgfALoLL/1XaVKPBCQteb9KAzM3Ik3FyiUv8rQqo0MsrL0VQmfJDWa1/5OPn1x1hxFWNMsv3ZsN/vJZy6ZVzoJWam/rcemA+pXwQWoLQXSZN8fAiaDy1dxKMlkvZsdiaIuC3pWPmgKccAIDToYk5x6ykahpF209B3i2sBtAic6wlHRRhHQJhrOghQOAeWyTaRAM1h9ELcq9AuInYVqMXzMBqwO2QC3IU7y5X0+MLYKa44nSFQlR5foxvxYVlN+3CIfbhvhUcKGHE42NX6G7O+do0rYHYbVGTuAz+BCjcHMn9zh/M8stsySp3CoAn8PHFFHJjPl2qa3jiYrBXY7tzIGRwi6mg+nbgQs++8t+tQDnyDNrEQev2fVJt3hIoE8dl1AYXWHrkzvkScJRdHizsiAASNtEk7S/NtXUbs70RSXxKgviPKFz99bVIB9SfxA8uZLAsxki39AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-narrow:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTMzMzMzMzM3NzczMzM7Ozs3NzczMzMzMzMzMzMzMzMzMzMzMzH6OaiEAAAAMdFJOUwBv7U2hEB4zt9NZixFhg1cAAAF+SURBVDjLY2CgF+CacwYKXFHEWXtg4mcOLUCWKDqDAKeRxJnBIhounWDaASFRAzJiO5CR5QNkHUHYoAPkioKZ7CAZAZgEB5AzHcpmBLKPwyRszpw5gWzsSRgbaNIEFIfAXAxkJiBcsgeh7MyZg0hu50RYcuaMAqqnTsMlNiAHgw7c9jNnCpAl9sCtPHMISEQJgoAwxPUGUAmgL9h1IEHYAPYJ1L2g0OGEhi3QfTHwQAFJMCECPQhFggUqAfRCDkIC5DwnSPwJoNhxKICBgS0NBEDuXAN3Ptx5EOADVgiRcEBOGIhIOHPmGJIEIyJMkeMJ7I2jiPhASkw9CJN9kKKZgfsM3G6QZoS79iClH+YzCPsyQL5EVnVmMpgVDQ7kwzAJcEDNNgsNXwINfAOEZ0FASQeWsA8jeQoVwLVUwoVUULUwrISJJ6xB1cJgDcpshxoDGLhgEQYDbIaCUqUMkPhAziRIGRUkcRJbFl6DS4LrDGoyR9HSgFWC3bORnFIEAI39IME59Pz6AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-expand{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUdwTM3NzczMzMzMzMzMzMzMzMvLy8vLy8zMzMzMzMzMzMzMzMzMzMzMzMzMzAmiiJAAAAAOdFJOUwAqre7XQBoOxWGeiHNRIXj5WAAAAcNJREFUOMu1VLtKQ0EQ3Ygx5FEIPhpFVLAIaNAUPkACWliGYGEpMWKjIKktJGBjIWIhiAgSRGwESWkhwcpGEAUtRJCYmBjFzDc4szv7uCpYOcXd2T07u2fOzF4h/jLf01H/xdzP9a4koFWi2W/rs8A26UXWwNiEu+5PWADyDnDorMOrPSwo7x186DjYJm/GAM84q+9JzkUKMRnQtkv2Y+j3MtCM/pTeFcHJO/s3nguJCM/QG7MMKaRggBSN99NyJ97ypoEPmSVAjsZ1gE8NyB0hgBcaw4Ywq9AEUKUxgEenGUi5EXTJjgIqdGlnBqCxkFb0FS2o42cXSOFEHPfM69yhzLKQIbEepieIbVgDNSEWXSDiAKsGwKNadA0L7lGUz/LmBia2uaXKk+c80p48iro6nE+IMxdY31sGcq4kPlMQK16NN5S1iJQ6EZNKIKmGKZS8bCUqp9jEw0J7VVtaPInFJdGU8NLObGMhT11MITJua9DT6ONuJWlGNdBGIg0R9271fFp1j0oFx0+vj1nJER3SDl4zIYGYs1h0Q4JJA5z43RCLDKi8cvYZntNy/Er1KpSch7j0uH+X1VKUfv1J+I1a/2xf3OKDpNnEfRYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-expand:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA5UExURUdwTP///////////////////////////////////////////////////////////////////////308lk0AAAASdFJOUwBFnl8nDsur9hnq2jeLum17VecmAZgAAAGgSURBVEjH1VbZdsUgCIz7boz//7Fto3FBzLk9fSpvUUdgGDDH8WfjV6JKqZC8+eR0kLmZVky8H/cxA7PpBSJoRsyy3XliM24UP8/y1iQW1tljUIl479mQvlv5utptAzE8NMTC5kPkCdZV3VAA4OpFfHGdKoJhCTixJ0NPe7pki9eo3hbGtbLkOwXSqY6ueQgI6PXxN11dASWAEwL6DRQ4LIlLABgEUGIg3UWJycyAvl89DBRHyOxIG+emeLgMNxNRYQLUCJnLWj9lzzqKzsJY7fbloVDjoJw4AUrOYZH2HZXRgKYGSJ8DSkgGdl3YhlThhkoZC8pFGWt1CWzVH0rMsa10jTTNhWMvAAlKf4CUoDT40hFACgF8K5jzAdR4cxVmtX9LZWmgLngTFIMNb5EZQNAWVcgUIHmPoOhkesbPCY+bOs+XAeEedfp5xjxSsXBY8qcJsiKtlZIbHhe+RWQbaUqBylmGK8Lld1sQQuEHbdAbxHFhTqhprK8IccLAFRnrJLGXLkjdnqLTgMrir53xF2OMcLFq4Rf/B0RjQvin9gVLNDmYNA/hrAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-menu-icon-text,.jessibuca-container .jessibuca-quality-icon-text,.jessibuca-container .jessibuca-scale-icon-text,.jessibuca-container .jessibuca-speed-icon-text{font-size:14px;min-width:30px;height:20px;line-height:20px;cursor:pointer;text-align:center}.jessibuca-container .jessibuca-speed{font-size:14px;color:#fff}.jessibuca-container .jessibuca-menu-list,.jessibuca-container .jessibuca-quality-menu-list,.jessibuca-container .jessibuca-scale-menu-list,.jessibuca-container .jessibuca-speed-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;overflow:hidden;width:max-content}.jessibuca-container .jessibuca-menu-list.jessibuca-menu-shown,.jessibuca-container .jessibuca-menu-list.jessibuca-quality-menu-shown,.jessibuca-container .jessibuca-menu-list.jessibuca-scale-menu-shown,.jessibuca-container .jessibuca-menu-list.jessibuca-speed-menu-shown,.jessibuca-container .jessibuca-quality-menu-list.jessibuca-menu-shown,.jessibuca-container .jessibuca-quality-menu-list.jessibuca-quality-menu-shown,.jessibuca-container .jessibuca-quality-menu-list.jessibuca-scale-menu-shown,.jessibuca-container .jessibuca-quality-menu-list.jessibuca-speed-menu-shown,.jessibuca-container .jessibuca-scale-menu-list.jessibuca-menu-shown,.jessibuca-container .jessibuca-scale-menu-list.jessibuca-quality-menu-shown,.jessibuca-container .jessibuca-scale-menu-list.jessibuca-scale-menu-shown,.jessibuca-container .jessibuca-scale-menu-list.jessibuca-speed-menu-shown,.jessibuca-container .jessibuca-speed-menu-list.jessibuca-menu-shown,.jessibuca-container .jessibuca-speed-menu-list.jessibuca-quality-menu-shown,.jessibuca-container .jessibuca-speed-menu-list.jessibuca-scale-menu-shown,.jessibuca-container .jessibuca-speed-menu-list.jessibuca-speed-menu-shown{visibility:visible;opacity:1}.jessibuca-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jessibuca-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jessibuca-container .jessibuca-quality-menu{padding:8px 0}.jessibuca-container .jessibuca-menu-item,.jessibuca-container .jessibuca-quality-menu-item,.jessibuca-container .jessibuca-scale-menu-item,.jessibuca-container .jessibuca-speed-menu-item{display:block;height:25px;line-height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jessibuca-container .jessibuca-menu-item:hover,.jessibuca-container .jessibuca-quality-menu-item:hover,.jessibuca-container .jessibuca-scale-menu-item:hover,.jessibuca-container .jessibuca-speed-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jessibuca-container .jessibuca-menu-item:focus,.jessibuca-container .jessibuca-quality-menu-item:focus,.jessibuca-container .jessibuca-scale-menu-item:focus,.jessibuca-container .jessibuca-speed-menu-item:focus{outline:none}.jessibuca-container .jessibuca-menu-item.jessibuca-menu-item-active,.jessibuca-container .jessibuca-menu-item.jessibuca-quality-menu-item-active,.jessibuca-container .jessibuca-menu-item.jessibuca-scale-menu-item-active,.jessibuca-container .jessibuca-menu-item.jessibuca-speed-menu-item-active,.jessibuca-container .jessibuca-quality-menu-item.jessibuca-menu-item-active,.jessibuca-container .jessibuca-quality-menu-item.jessibuca-quality-menu-item-active,.jessibuca-container .jessibuca-quality-menu-item.jessibuca-scale-menu-item-active,.jessibuca-container .jessibuca-quality-menu-item.jessibuca-speed-menu-item-active,.jessibuca-container .jessibuca-scale-menu-item.jessibuca-menu-item-active,.jessibuca-container .jessibuca-scale-menu-item.jessibuca-quality-menu-item-active,.jessibuca-container .jessibuca-scale-menu-item.jessibuca-scale-menu-item-active,.jessibuca-container .jessibuca-scale-menu-item.jessibuca-speed-menu-item-active,.jessibuca-container .jessibuca-speed-menu-item.jessibuca-menu-item-active,.jessibuca-container .jessibuca-speed-menu-item.jessibuca-quality-menu-item-active,.jessibuca-container .jessibuca-speed-menu-item.jessibuca-scale-menu-item-active,.jessibuca-container .jessibuca-speed-menu-item.jessibuca-speed-menu-item-active{color:#2298fc}.jessibuca-container .jessibuca-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jessibuca-container .jessibuca-volume-panel-wrap.jessibuca-volume-panel-wrap-show{visibility:visible;opacity:1}.jessibuca-container .jessibuca-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jessibuca-container .jessibuca-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jessibuca-container .jessibuca-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jessibuca-container .jessibuca-volume-panel-handle:before{bottom:-54px;background:#fff}.jessibuca-container .jessibuca-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jessibuca-container .jessibuca-volume-panel-handle:after,.jessibuca-container .jessibuca-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-controls{width:100vh}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-loading{flex-direction:row}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-loading-text{transform:rotate(270deg)}.jessibuca-container .jessibuca-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;left:10px;top:10px;min-width:200px;padding:5px 0;background-color:rgba(0,0,0,.9);border-radius:3px}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu{cursor:pointer;font-size:12px;display:block;color:#fff;padding:10px 15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 0 2px rgba(0,0,0,.5);border-bottom:1px solid hsla(0,0%,100%,.1)}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu a{color:#fff;text-decoration:none}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu span{display:inline-block;padding:0 7px}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu span.art-current,.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu span:hover{color:var(--theme)}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu:hover{background-color:hsla(0,0%,100%,.1)}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu:last-child{border-bottom:none}.jessibuca-container.jessibuca-contextmenus-show .jessibuca-contextmenus{display:flex}.jessibuca-container-playback .jessibuca-controls{height:48px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center{flex:1;display:flex;box-sizing:border-box;justify-content:space-between;font-size:12px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time{box-sizing:border-box;flex:1;position:relative;height:100%}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-inner{width:300px;height:100%;overflow-y:hidden;overflow-x:auto}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-current-time{position:absolute;left:0;top:0;height:15px;width:1px;background-color:red;text-align:center;z-index:1}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-current-time-text{position:absolute;box-sizing:border-box;padding:0 5px;width:60px;left:-25px;top:15px;border:1px solid red;height:15px;line-height:15px;cursor:move;background-color:#fff;color:#000;-webkit-user-select:none;user-select:none}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll{position:relative;width:1440px;margin:0 auto}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll.one-hour{width:1440px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll.half-hour{width:2880px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll.ten-min{width:8640px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll.five-min{width:17280px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll.one-min{width:86400px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-list{position:relative;background-color:#ccc;height:48px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-day{height:100%;overflow:hidden}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-one-wrap{height:8px;z-index:1}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-second-wrap{height:25px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-btns{display:flex;align-items:center}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute-one,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-second-one{float:left;width:1px;height:8px;margin:0;cursor:default;position:relative;z-index:1}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute-one.active,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-second-one.active{background-color:orange;cursor:pointer}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute-one.start,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-second-one.start{background-color:#999}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute-one:hover .jessibuca-playback-time-title-tips,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-second-one:hover .jessibuca-playback-time-title-tips{visibility:visible;opacity:1}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-title-tips{pointer-events:none;position:absolute;left:0;top:100%;visibility:hidden;opacity:0;transform:translateX(13%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:#000;border-radius:4px;z-index:1}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-title-tips.jessibuca-playback-time-title-tips-left{transform:translateX(-100%)}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-title-tips .jessibuca-playback-time-title{display:inline-block;padding:2px 5px;font-size:12px;white-space:nowrap;color:#fff}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-hour,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute{float:left;position:relative;width:60px;box-sizing:border-box;border-top:1px solid #999;-webkit-user-select:none;user-select:none;text-align:left;height:25px;line-height:25px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-hour:first-child,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute:first-child{border-left:0}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-hour:first-child .jessibuca-playback-time-hour-text,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute:first-child .jessibuca-playback-time-hour-text{left:0}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-hour:after,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute:after{content:"";position:absolute;left:0;top:-8px;width:1px;height:14px;background-color:#999}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-hour-text,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute-text{position:absolute;left:-13px}.jessibuca-container-playback .jessibuca-playback-expand.disabled .jessibuca-icon-expand,.jessibuca-container-playback .jessibuca-playback-narrow.disabled .jessibuca-icon-narrow{cursor:no-drop}.jessibuca-container-playback.jessibuca-fullscreen-web .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-playback-time-inner{overflow-y:auto}.jessibuca-zoom-control{cursor:grab}.jessibuca-performance-panel{position:absolute;box-sizing:border-box;z-index:10000;left:0;top:0;padding:5px;font-size:10px;background:rgba(0,0,0,.2);color:#fff;max-height:100%;overflow-y:auto;display:none}.jessibuca-performance-panel .jessibuca-performance-item{display:flex;align-items:center;margin-top:3px;color:#fff}.jessibuca-performance-panel .jessibuca-performance-item-block{height:10px}');class as{constructor(e){this.player=e,this.extendBtnList=[],c=this,(l=e)._opt.hasControl&&l._opt.controlAutoHide?l.$container.classList.add("jessibuca-controls-show-auto-hide"):l.$container.classList.add("jessibuca-controls-show"),d=l._opt,u=d.operateBtns,h=`
  244. <div class="jessibuca-controls-center">
  245. <div class="jessibuca-controls-playback-time">
  246. <div class="jessibuca-controls-playback-time-inner">
  247. <div class="jessibuca-controls-playback-time-scroll">
  248. <div class="jessibuca-controls-playback-time-list">
  249. <div class="jessibuca-playback-time-day">
  250. <div class="jessibuca-playback-time-one-wrap"></div>
  251. <div class="jessibuca-playback-time-second-wrap"></div>
  252. </div>
  253. </div>
  254. <div class="jessibuca-controls-playback-current-time">
  255. <div class="jessibuca-controls-playback-current-time-text">00:00:00</div>
  256. </div>
  257. </div>
  258. </div>
  259. </div>
  260. <div class="jessibuca-controls-playback-btns">
  261. <div class="jessibuca-controls-item jessibuca-playback-narrow">${x.narrow}</div>
  262. <div class="jessibuca-controls-item jessibuca-playback-expand">${x.expand}</div>
  263. </div>
  264. </div>
  265. `,l.$container.insertAdjacentHTML("beforeend",`
  266. ${d.background?`<div class="jessibuca-poster" style="background-image: url(${d.background})"></div>`:""}
  267. <div class="jessibuca-loading-bg">
  268. <img class="jessibuca-loading-bg-image" src="" alt="">
  269. </div>
  270. ${d.loadingIcon?`
  271. <div class="jessibuca-loading">
  272. ${x.loading}
  273. ${d.loadingText?`<div class="jessibuca-loading-text">${d.loadingText}</div>`:""}
  274. </div>
  275. `:""}
  276. ${d.hasControl&&u.play?'<div class="jessibuca-play-big"></div>':""}
  277. ${d.hasControl&&u.ptz?`
  278. <div class="jessibuca-ptz-controls">
  279. <div class="jessibuca-ptz-bg-active"></div>
  280. <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-up" data-arrow="up"></div>
  281. <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-right" data-arrow="right"></div>
  282. <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-down" data-arrow="down"></div>
  283. <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-left" data-arrow="left"></div>
  284. ${d.ptzMoreArrow?'\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-left-up" data-arrow="left-up"></div>\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-right-up" data-arrow="right-up"></div>\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-left-down" data-arrow="left-down"></div>\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-right-down" data-arrow="right-down"></div>\n ':""}
  285. <div class="jessibuca-ptz-control"></div>
  286. <div class="jessibuca-ptz-btns">
  287. ${d.ptzZoomShow?'\n <div class="jessibuca-ptz-btn">\n <div class="jessibuca-ptz-expand jessibuca-ptz-icon">\n <i class="jessibuca-ptz-expand-icon"></i>\n <span class="icon-title-tips">\n <span class="icon-title">缩放+</span>\n </span>\n </div>\n <div class="jessibuca-ptz-narrow jessibuca-ptz-icon">\n <i class="jessibuca-ptz-narrow-icon"></i>\n <span class="icon-title-tips">\n <span class="icon-title">缩放-</span>\n </span>\n </div>\n </div>\n ':""}
  288. ${d.ptzApertureShow?'\n <div class="jessibuca-ptz-btn">\n <div class="jessibuca-ptz-aperture-far jessibuca-ptz-icon">\n <i class="jessibuca-ptz-aperture-icon"></i>\n <span class="icon-title-tips">\n <span class="icon-title">光圈+</span>\n </span>\n </div>\n <div class="jessibuca-ptz-aperture-near jessibuca-ptz-icon">\n <i class="jessibuca-ptz-aperture-icon"></i>\n <span class="icon-title-tips">\n <span class="icon-title">光圈-</span>\n </span>\n </div>\n </div>\n ':""}
  289. ${d.ptzFocusShow?'\n <div class="jessibuca-ptz-btn">\n <div class="jessibuca-ptz-focus-far jessibuca-ptz-icon">\n <i class="jessibuca-ptz-focus-icon"></i>\n <span class="icon-title-tips">\n <span class="icon-title">聚焦+</span>\n </span>\n </div>\n <div class="jessibuca-ptz-focus-near jessibuca-ptz-icon">\n <i class="jessibuca-ptz-focus-icon"></i>\n <span class="icon-title-tips">\n <span class="icon-title">聚焦-</span>\n </span>\n </div>\n </div>\n ':""}
  290. </div>
  291. </div>
  292. `:""}
  293. ${d.hasVideo?`
  294. <div class="jessibuca-zoom-controls">
  295. <div class="jessibuca-zoom-narrow">${x.narrow}</div>
  296. <div class="jessibuca-zoom-tips">电子放大</div>
  297. <div class="jessibuca-zoom-expand">${x.expand}</div>
  298. <div class="jessibuca-zoom-stop2">${x.zoomStop}</div>
  299. </div>
  300. <div class="jessibuca-recording">
  301. <div class="jessibuca-recording-red-point"></div>
  302. <div class="jessibuca-recording-time">00:00:00</div>
  303. <div class="jessibuca-icon-recordStop jessibuca-recording-stop">${x.recordStop}</div>
  304. </div>
  305. `:""}
  306. ${d.hasControl?`
  307. <div class="jessibuca-controls">
  308. <div class="jessibuca-controls-bottom">
  309. <div class="jessibuca-controls-left">
  310. ${d.showBandwidth?'<div class="jessibuca-controls-item jessibuca-speed"></div>':""}
  311. <div class="jessibuca-controls-item-html">${d.controlHtml}</div>
  312. </div>
  313. ${d.playType===v&&d.playbackConfig.showControl?h:""}
  314. <div class="jessibuca-controls-right">
  315. ${d.playType===v&&d.playbackConfig.showRateBtn?'\n <div class="jessibuca-controls-item-wrap">\n <div class="jessibuca-controls-item jessibuca-speed-menu">\n <div class="jessibuca-speed-icon-text"></div>\n <div class="jessibuca-speed-menu-list"></div>\n </div>\n </div>\n ':""}
  316. ${u.close?`<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-close">${x.close}</div></div>`:""}
  317. ${u.performance?`<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-performance">${x.performance}</div><div class="jessibuca-controls-item jessibuca-performance-active">${x.performanceActive}</div></div>`:""}
  318. ${u.aiFace?`<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-face">${x.face}</div><div class="jessibuca-controls-item jessibuca-face-active">${x.faceActive}</div></div>`:""}
  319. ${u.quality?'\n <div class="jessibuca-controls-item-wrap">\n <div class="jessibuca-controls-item jessibuca-quality-menu">\n <div class="jessibuca-quality-icon-text"></div>\n <div class="jessibuca-quality-menu-list"></div>\n </div>\n </div>\n ':""}
  320. ${u.scale?'\n <div class="jessibuca-controls-item-wrap">\n <div class="jessibuca-controls-item jessibuca-scale-menu">\n <div class="jessibuca-scale-icon-text"></div>\n <div class="jessibuca-scale-menu-list"></div>\n </div>\n </div>\n ':""}
  321. ${u.audio?`
  322. <div class="jessibuca-controls-item-wrap">
  323. <div class="jessibuca-controls-item jessibuca-volume">
  324. ${x.audio}
  325. ${x.mute}
  326. <div class="jessibuca-volume-panel-wrap">
  327. <div class="jessibuca-volume-panel">
  328. <div class="jessibuca-volume-panel-handle"></div>
  329. </div>
  330. <div class="jessibuca-volume-panel-text"></div>
  331. </div>
  332. </div>
  333. </div>
  334. `:""}
  335. ${u.play?`<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-play">${x.play}</div><div class="jessibuca-controls-item jessibuca-pause">${x.pause}</div></div>`:""}
  336. ${u.screenshot?`<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-screenshot">${x.screenshot}</div></div>`:""}
  337. ${u.record?` <div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-record">${x.record}</div><div class="jessibuca-controls-item jessibuca-record-stop">${x.recordStop}</div></div>`:""}
  338. ${u.ptz?` <div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-ptz">${x.ptz}</div><div class="jessibuca-controls-item jessibuca-ptz-active">${x.ptzActive}</div></div>`:""}
  339. ${u.zoom?` <div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-zoom">${x.zoom}</div><div class="jessibuca-controls-item jessibuca-zoom-stop">${x.zoomStop}</div></div>`:""}
  340. ${u.fullscreen?`<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-fullscreen">${x.fullscreen}</div><div class="jessibuca-controls-item jessibuca-fullscreen-exit">${x.fullscreenExit}</div></div>`:""}
  341. </div>
  342. </div>
  343. </div>
  344. `:""}
  345. <div class="jessibuca-performance-panel"></div>
  346. <div class="jessibuca-contextmenus"></div>
  347. `),Object.defineProperty(c,"$poster",{value:l.$container.querySelector(".jessibuca-poster")}),Object.defineProperty(c,"$loadingBg",{value:l.$container.querySelector(".jessibuca-loading-bg")}),Object.defineProperty(c,"$loadingBgImage",{value:l.$container.querySelector(".jessibuca-loading-bg-image")}),Object.defineProperty(c,"$loading",{value:l.$container.querySelector(".jessibuca-loading")}),Object.defineProperty(c,"$play",{value:l.$container.querySelector(".jessibuca-play")}),Object.defineProperty(c,"$playBig",{value:l.$container.querySelector(".jessibuca-play-big")}),Object.defineProperty(c,"$recording",{value:l.$container.querySelector(".jessibuca-recording")}),Object.defineProperty(c,"$recordingTime",{value:l.$container.querySelector(".jessibuca-recording-time")}),Object.defineProperty(c,"$recordingStop",{value:l.$container.querySelector(".jessibuca-recording-stop")}),Object.defineProperty(c,"$pause",{value:l.$container.querySelector(".jessibuca-pause")}),Object.defineProperty(c,"$controls",{value:l.$container.querySelector(".jessibuca-controls")}),Object.defineProperty(c,"$controlsInner",{value:l.$container.querySelector(".jessibuca-controls-bottom")}),Object.defineProperty(c,"$controlsLeft",{value:l.$container.querySelector(".jessibuca-controls-left")}),Object.defineProperty(c,"$controlsRight",{value:l.$container.querySelector(".jessibuca-controls-right")}),Object.defineProperty(c,"$volume",{value:l.$container.querySelector(".jessibuca-volume")}),Object.defineProperty(c,"$volumePanelWrap",{value:l.$container.querySelector(".jessibuca-volume-panel-wrap")}),Object.defineProperty(c,"$volumePanelText",{value:l.$container.querySelector(".jessibuca-volume-panel-text")}),Object.defineProperty(c,"$volumePanel",{value:l.$container.querySelector(".jessibuca-volume-panel")}),Object.defineProperty(c,"$volumeHandle",{value:l.$container.querySelector(".jessibuca-volume-panel-handle")}),Object.defineProperty(c,"$volumeOn",{value:l.$container.querySelector(".jessibuca-icon-audio")}),Object.defineProperty(c,"$volumeOff",{value:l.$container.querySelector(".jessibuca-icon-mute")}),Object.defineProperty(c,"$fullscreen",{value:l.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(c,"$fullscreenExit",{value:l.$container.querySelector(".jessibuca-fullscreen-exit")}),Object.defineProperty(c,"$record",{value:l.$container.querySelector(".jessibuca-record")}),Object.defineProperty(c,"$recordStop",{value:l.$container.querySelector(".jessibuca-record-stop")}),Object.defineProperty(c,"$screenshot",{value:l.$container.querySelector(".jessibuca-screenshot")}),Object.defineProperty(c,"$speed",{value:l.$container.querySelector(".jessibuca-speed")}),Object.defineProperty(c,"$controlHtml",{value:l.$container.querySelector(".jessibuca-controls-item-html")}),Object.defineProperty(c,"$playbackTime",{value:l.$container.querySelector(".jessibuca-controls-playback-time")}),Object.defineProperty(c,"$playbackTimeInner",{value:l.$container.querySelector(".jessibuca-controls-playback-time-inner")}),Object.defineProperty(c,"$playbackTimeScroll",{value:l.$container.querySelector(".jessibuca-controls-playback-time-scroll")}),Object.defineProperty(c,"$playbackTimeList",{value:l.$container.querySelector(".jessibuca-controls-playback-time-list")}),Object.defineProperty(c,"$playbackTimeListOne",{value:l.$container.querySelector(".jessibuca-playback-time-one-wrap")}),Object.defineProperty(c,"$playbackTimeListSecond",{value:l.$container.querySelector(".jessibuca-playback-time-second-wrap")}),Object.defineProperty(c,"$playbackCurrentTime",{value:l.$container.querySelector(".jessibuca-controls-playback-current-time")}),Object.defineProperty(c,"$playbackCurrentTimeText",{value:l.$container.querySelector(".jessibuca-controls-playback-current-time-text")}),Object.defineProperty(c,"$controlsPlaybackBtns",{value:l.$container.querySelector(".jessibuca-controls-playback-btns")}),Object.defineProperty(c,"$playbackNarrow",{value:l.$container.querySelector(".jessibuca-playback-narrow")}),Object.defineProperty(c,"$playbackExpand",{value:l.$container.querySelector(".jessibuca-playback-expand")}),Object.defineProperty(c,"$ptz",{value:l.$container.querySelector(".jessibuca-ptz")}),Object.defineProperty(c,"$ptzActive",{value:l.$container.querySelector(".jessibuca-ptz-active")}),Object.defineProperty(c,"$ptzControl",{value:l.$container.querySelector(".jessibuca-ptz-controls")}),Object.defineProperty(c,"$ptzBgActive",{value:l.$container.querySelector(".jessibuca-ptz-bg-active")}),Object.defineProperty(c,"$ptzControlCircular",{value:l.$container.querySelector(".jessibuca-ptz-control")}),Object.defineProperty(c,"$ptzArrows",{value:l.$container.querySelectorAll(".jessibuca-ptz-arrow")}),Object.defineProperty(c,"$ptzExpand",{value:l.$container.querySelector(".jessibuca-ptz-expand")}),Object.defineProperty(c,"$ptzNarrow",{value:l.$container.querySelector(".jessibuca-ptz-narrow")}),Object.defineProperty(c,"$ptzApertureFar",{value:l.$container.querySelector(".jessibuca-ptz-aperture-far")}),Object.defineProperty(c,"$ptzApertureNear",{value:l.$container.querySelector(".jessibuca-ptz-aperture-near")}),Object.defineProperty(c,"$ptzFocusFar",{value:l.$container.querySelector(".jessibuca-ptz-focus-far")}),Object.defineProperty(c,"$ptzFocusNear",{value:l.$container.querySelector(".jessibuca-ptz-focus-near")}),Object.defineProperty(c,"$qualityText",{value:l.$container.querySelector(".jessibuca-quality-icon-text")}),Object.defineProperty(c,"$qualityMenu",{value:l.$container.querySelector(".jessibuca-quality-menu")}),Object.defineProperty(c,"$qualityMenuList",{value:l.$container.querySelector(".jessibuca-quality-menu-list")}),Object.defineProperty(c,"$scaleText",{value:l.$container.querySelector(".jessibuca-scale-icon-text")}),Object.defineProperty(c,"$scaleMenu",{value:l.$container.querySelector(".jessibuca-scale-menu")}),Object.defineProperty(c,"$scaleMenuList",{value:l.$container.querySelector(".jessibuca-scale-menu-list")}),Object.defineProperty(c,"$zoom",{value:l.$container.querySelector(".jessibuca-zoom")}),Object.defineProperty(c,"$zoomStop",{value:l.$container.querySelector(".jessibuca-zoom-stop")}),Object.defineProperty(c,"$zoomNarrow",{value:l.$container.querySelector(".jessibuca-zoom-narrow")}),Object.defineProperty(c,"$zoomExpand",{value:l.$container.querySelector(".jessibuca-zoom-expand")}),Object.defineProperty(c,"$zoomStop2",{value:l.$container.querySelector(".jessibuca-zoom-stop2")}),Object.defineProperty(c,"$close",{value:l.$container.querySelector(".jessibuca-close")}),Object.defineProperty(c,"$zoomControls",{value:l.$container.querySelector(".jessibuca-zoom-controls")}),Object.defineProperty(c,"$performancePanel",{value:l.$container.querySelector(".jessibuca-performance-panel")}),Object.defineProperty(c,"$performance",{value:l.$container.querySelector(".jessibuca-performance")}),Object.defineProperty(c,"$performanceActive",{value:l.$container.querySelector(".jessibuca-performance-active")}),Object.defineProperty(c,"$faceDetect",{value:l.$container.querySelector(".jessibuca-face")}),Object.defineProperty(c,"$faceDetectActive",{value:l.$container.querySelector(".jessibuca-face-active")}),Object.defineProperty(c,"$contextmenus",{value:l.$container.querySelector(".jessibuca-contextmenus")}),Object.defineProperty(c,"$speedText",{value:l.$container.querySelector(".jessibuca-speed-icon-text")}),Object.defineProperty(c,"$speedMenu",{value:l.$container.querySelector(".jessibuca-speed-menu")}),Object.defineProperty(c,"$speedMenuList",{value:l.$container.querySelector(".jessibuca-speed-menu-list")}),0<e._opt.extendOperateBtns.length&&e._opt.extendOperateBtns.forEach(e=>{this.addExtendBtn(e)}),o=this,Object.defineProperty(o,"controlsRect",{get:()=>o.$controls.getBoundingClientRect()}),Object.defineProperty(o,"controlsInnerRect",{get:()=>o.$controlsInner.getBoundingClientRect()}),Object.defineProperty(o,"controlsLeftRect",{get:()=>o.$controlsLeft.getBoundingClientRect()}),Object.defineProperty(o,"controlsRightRect",{get:()=>o.$controlsRight.getBoundingClientRect()}),Object.defineProperty(o,"controlsPlaybackTimeInner",{get:()=>o.$playbackTimeInner&&o.$playbackTimeInner.getBoundingClientRect()||{}}),Object.defineProperty(o,"controlsPlaybackBtnsRect",{get:()=>o.$controlsPlaybackBtns&&o.$controlsPlaybackBtns.getBoundingClientRect()||{width:0}}),ts(e,this);{var r=e,s=this;const p=r["events"]["proxy"],f=r._opt,g=f.operateBtns;function t(e){var{bottom:t,height:i}=s.$volumePanel.getBoundingClientRect(),r=s.$volumeHandle.getBoundingClientRect()["height"];return y(t-e.y-r/2,0,i-r/2)/(i-r)}if(p(window,["click","contextmenu"],e=>{-1<e.composedPath().indexOf(r.$container)?s.isFocus=!0:s.isFocus=!1}),p(window,"orientationchange",()=>{setTimeout(()=>{r.resize()},300)}),p(s.$controls,"click",e=>{e.stopPropagation()}),g.play&&(p(s.$pause,"click",e=>{f.playType===v&&f.playbackConfig.uiUsePlaybackPause?r.playbackPause=!0:b(g.pauseFn)?g.pauseFn():r.pause()}),p(s.$play,"click",e=>{f.playType===v&&r.playbackPause?r.playbackPause=!1:b(g.playFn)?g.playFn():(r.play(),r.resumeAudioAfterPause())})),p(s.$playBig,"click",e=>{f.playType===v&&r.playbackPause?r.playbackPause=!1:b(g.playFn)?g.playFn():(r.play(),r.resumeAudioAfterPause())}),g.screenshot&&p(s.$screenshot,"click",e=>{e.stopPropagation(),b(g.screenshotFn)?g.screenshotFn():r.video.screenshot()}),g.audio&&(p(s.$volume,"mouseover",()=>{s.$volumePanelWrap.classList.add("jessibuca-volume-panel-wrap-show")}),p(s.$volume,"mouseout",()=>{s.$volumePanelWrap.classList.remove("jessibuca-volume-panel-wrap-show")}),p(s.$volumeOn,"click",e=>{e.stopPropagation(),w(s.$volumeOn,"display","none"),w(s.$volumeOff,"display","block");e=r.volume;r.volume=0,r._lastVolume=e}),p(s.$volumeOff,"click",e=>{e.stopPropagation(),w(s.$volumeOn,"display","block"),w(s.$volumeOff,"display","none"),r.volume=r.lastVolume||.5}),p(s.$volumePanel,"click",e=>{e.stopPropagation(),r.volume=t(e)}),p(s.$volumeHandle,"mousedown",()=>{s.isVolumeDroging=!0}),p(s.$volumeHandle,"mousemove",e=>{s.isVolumeDroging&&(r.volume=t(e))}),p(document,"mouseup",()=>{s.isVolumeDroging&&(s.isVolumeDroging=!1)})),g.record&&(p(s.$record,"click",e=>{e.stopPropagation(),b(g.recordFn)?g.recordFn():r.recording=!0}),p(s.$recordStop,"click",e=>{e.stopPropagation(),b(g.recordStopFn)?g.recordStopFn():r.recording=!1})),p(s.$recordingStop,"click",e=>{e.stopPropagation(),b(g.recordStopFn)?g.recordStopFn():r.recording=!1}),g.fullscreen&&(p(s.$fullscreen,"click",e=>{e.stopPropagation(),b(g.fullscreenFn)?g.fullscreenFn():r.fullscreen=!0}),p(s.$fullscreenExit,"click",e=>{e.stopPropagation(),b(g.fullscreenExitFn)?g.fullscreenExitFn():r.fullscreen=!1})),g.ptz&&(p(s.$ptz,"click",e=>{e.stopPropagation(),w(s.$ptzActive,"display","flex"),w(s.$ptz,"display","none"),s.$ptzControl.classList.add("jessibuca-ptz-controls-show")}),p(s.$ptzActive,"click",e=>{e.stopPropagation(),w(s.$ptz,"display","flex"),w(s.$ptzActive,"display","none"),s.$ptzControl.classList.remove("jessibuca-ptz-controls-show")}),s.$ptzArrows.forEach(e=>{if(f.ptzClickType===q)p(e,"click",e=>{e.stopPropagation();e=e.currentTarget.dataset.arrow;s.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-show"),s.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-"+e),s.$ptzControlCircular.classList.add("jessibuca-ptz-control-"+e),r.emit(E.ptz,Ot(e)),setTimeout(()=>{s.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-show"),Ce.forEach(e=>{s.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-"+e),s.$ptzControlCircular.classList.remove("jessibuca-ptz-control-"+e)}),r.emit(E.ptz,Re)},1e3*f.ptzStopEmitDelay)});else if("mouseDownAndUp"===f.ptzClickType){let t=!1;p(e,"mousedown",e=>{e.stopPropagation(),t=!0;e=e.currentTarget.dataset.arrow;s.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-show"),s.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-"+e),s.$ptzControlCircular.classList.add("jessibuca-ptz-control-"+e),r.emit(E.ptz,Ot(e))});const i=()=>{t=!1,s.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-show"),Ce.forEach(e=>{s.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-"+e),s.$ptzControlCircular.classList.remove("jessibuca-ptz-control-"+e)}),r.emit(E.ptz,Re)};p(e,"mouseup",e=>{e.stopPropagation(),t&&i()}),p(window,"mouseup",e=>{e.stopPropagation(),t&&i()})}}),f.ptzZoomShow&&(p(s.$ptzExpand,"click",e=>{e.stopPropagation(),r.emit(E.ptz,"zoomExpand"),setTimeout(()=>{r.emit(E.ptz,Re)},1e3*f.ptzStopEmitDelay)}),p(s.$ptzNarrow,"click",e=>{e.stopPropagation(),r.emit(E.ptz,"zoomNarrow"),setTimeout(()=>{r.emit(E.ptz,Re)},1e3*f.ptzStopEmitDelay)})),f.ptzApertureShow&&(p(s.$ptzApertureFar,"click",e=>{e.stopPropagation(),r.emit(E.ptz,"apertureFar"),setTimeout(()=>{r.emit(E.ptz,De)},1e3*f.ptzStopEmitDelay)}),p(s.$ptzApertureNear,"click",e=>{e.stopPropagation(),r.emit(E.ptz,"apertureNear"),setTimeout(()=>{r.emit(E.ptz,De)},1e3*f.ptzStopEmitDelay)})),f.ptzFocusShow)&&(p(s.$ptzFocusFar,"click",e=>{e.stopPropagation(),r.emit(E.ptz,"focusFar"),setTimeout(()=>{r.emit(E.ptz,De)},1e3*f.ptzStopEmitDelay)}),p(s.$ptzFocusNear,"click",e=>{e.stopPropagation(),r.emit(E.ptz,"focusNear"),setTimeout(()=>{r.emit(E.ptz,De)},1e3*f.ptzStopEmitDelay)})),g.performance&&(p(s.$performance,"click",e=>{e.stopPropagation(),r.togglePerformancePanel(!0)}),p(s.$performanceActive,"click",e=>{e.stopPropagation(),r.togglePerformancePanel(!1)})),g.aiFace&&(p(s.$faceDetect,"click",e=>{e.stopPropagation(),r.faceDetect(!0)}),p(s.$faceDetectActive,"click",e=>{e.stopPropagation(),r.faceDetect(!1)})),r._opt.hasControl&&r._opt.controlAutoHide){p(r.$container,"mouseover",()=>{r.fullscreen||(w(s.$controls,"display","block"),f())}),p(r.$container,"mousemove",()=>{r.$container&&s.$controls&&(r.fullscreen,"none"===s.$controls.style.display)&&(w(s.$controls,"display","block"),f())}),p(r.$container,"mouseout",()=>{g(),w(s.$controls,"display","none")});let e=null;const f=()=>{g(),e=setTimeout(()=>{w(s.$controls,"display","none")},5e3)},g=()=>{e&&(clearTimeout(e),e=null)}}r._opt.playType===v&&(p(s.$playbackNarrow,"click",e=>{e.stopPropagation(),r.playback&&r.playback.narrowPrecision()}),p(s.$playbackExpand,"click",e=>{e.stopPropagation(),r.playback&&r.playback.expandPrecision()}),p(s.$playbackTimeList,"click",e=>{e=kt(e);e.matches("div.jessibuca-playback-time-minute-one")&&r.playback&&r.playback.seek(e.dataset)}),r._opt.playbackConfig.showRateBtn&&(p(s.$speedMenu,"mouseover",()=>{s.$speedMenuList.classList.add("jessibuca-speed-menu-shown")}),p(s.$speedMenu,"mouseout",()=>{s.$speedMenuList.classList.remove("jessibuca-speed-menu-shown")}),p(s.$speedMenuList,"click",e=>{var t=kt(e);if(t.matches("div.jessibuca-speed-menu-item")){const e=t.dataset;r.emit(E.playbackPreRateChange,e.speed)}})),r._opt.playbackConfig.supportWheel)&&p(s.$playbackTimeInner,"wheel",e=>{e.preventDefault(),0<(e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3)?r.playback&&r.playback.expandPrecision():r.playback&&r.playback.narrowPrecision()}),g.quality&&(p(s.$qualityMenu,"mouseover",()=>{s.$qualityMenuList.classList.add("jessibuca-quality-menu-shown")}),p(s.$qualityMenu,"mouseout",()=>{s.$qualityMenuList.classList.remove("jessibuca-quality-menu-shown")}),p(s.$qualityMenuList,"click",e=>{var t=kt(e);if(t.matches("div.jessibuca-quality-menu-item")){const e=t.dataset;r.streamQuality=e.quality}})),g.scale&&(p(s.$scaleMenu,"mouseover",()=>{s.$scaleMenuList.classList.add("jessibuca-scale-menu-shown")}),p(s.$scaleMenu,"mouseout",()=>{s.$scaleMenuList.classList.remove("jessibuca-scale-menu-shown")}),p(s.$scaleMenuList,"click",e=>{var t=kt(e);if(t.matches("div.jessibuca-scale-menu-item")){const e=t.dataset;r.setScaleMode(e.scale)}})),g.zoom&&(p(s.$zoom,"click",e=>{e.stopPropagation(),r.zooming=!0}),p(s.$zoomStop,"click",e=>{e.stopPropagation(),r.zooming=!1})),p(s.$zoomExpand,"click",e=>{e.stopPropagation(),r.zoom&&r.zoom.expandPrecision()}),p(s.$zoomNarrow,"click",e=>{e.stopPropagation(),r.zoom&&r.zoom.narrowPrecision()}),p(s.$zoomStop2,"click",e=>{e.stopPropagation(),r.zooming=!1}),g.close&&p(s.$close,"click",e=>{e.stopPropagation(),r.doDestroy()})}if(e._opt.hotKey){var i=e,a=this;const m=i["events"]["proxy"],A={};function n(e,t){A[e]?A[e].push(t):A[e]=[t]}n(27,()=>{i.fullscreen&&(i.fullscreen=!1)}),n(38,()=>{i.volume+=.05}),n(40,()=>{i.volume-=.05}),m(window,"keydown",e=>{if(a.isFocus){const a=document.activeElement.tagName.toUpperCase(),t=document.activeElement.getAttribute("contenteditable");if("INPUT"!==a&&"TEXTAREA"!==a&&""!==t&&"true"!==t){const a=A[e.keyCode];a&&(e.preventDefault(),a.forEach(e=>e()))}}})}var o,l,c,d,u,h;this.btnIndex=0,this.kbpsShow="0 KB/s",this.initLoadingBackground(),this.player.debug.log("Control","init")}destroy(){var e;this.$performancePanel&&(this.$performancePanel.innerHTML="",t(this.$performancePanel)||(e=this.player.$container.querySelector(".jessibuca-performance-panel"))&&this.player.$container&&this.player.$container.removeChild(e)),this.$poster&&!t(this.$poster)&&(e=this.player.$container.querySelector(".jessibuca-poster"))&&this.player.$container&&this.player.$container.removeChild(e),this.$loading&&!t(this.$loading)&&(e=this.player.$container.querySelector(".jessibuca-loading"))&&this.player.$container&&this.player.$container.removeChild(e),this.$loadingBg&&!t(this.$loadingBg)&&(e=this.player.$container.querySelector(".jessibuca-loading-bg"))&&this.player.$container&&this.player.$container.removeChild(e),this.$controls&&!t(this.$controls)&&(e=this.player.$container.querySelector(".jessibuca-controls"))&&this.player.$container&&this.player.$container.removeChild(e),this.$playBig&&!t(this.$playBig)&&(e=this.player.$container.querySelector(".jessibuca-play-big"))&&this.player.$container&&this.player.$container.removeChild(e),this.$recording&&!t(this.$recording)&&(e=this.player.$container.querySelector(".jessibuca-recording"))&&this.player.$container&&this.player.$container.removeChild(e),this.$ptzControl&&!t(this.$ptzControl)&&(e=this.player.$container.querySelector(".jessibuca-ptz-controls"))&&this.player.$container&&this.player.$container.removeChild(e),this.$zoomControls&&!t(this.$zoomControls)&&(e=this.player.$container.querySelector(".jessibuca-zoom-controls"))&&this.player.$container&&this.player.$container.removeChild(e),this.$contextmenus&&(this.$contextmenus.innerHTML="",t(this.$contextmenus)||(e=this.player.$container.querySelector(".jessibuca-contextmenus"))&&this.player.$container&&this.player.$container.removeChild(e)),this.btnIndex=0,this.extendBtnList=[],this.kbpsShow="0 KB/s",this.player.$container&&(this.player.$container.classList.remove("jessibuca-controls-show-auto-hide"),this.player.$container.classList.remove("jessibuca-controls-show")),this.player.debug.log("control","destroy")}getBtnIndex(){return this.btnIndex++}autoSize(){var e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,r=t/i,s=e.video.$videoElement.width/e.video.$videoElement.height;if(r>s){const r=(t-i*s)/2;e.$container.style.padding=`0 ${r}px`}else{const r=(i-t/s)/2;e.$container.style.padding=r+"px 0"}}initLoadingBackground(){var r=this.player;if(r._opt.loadingBackground&&r._opt.heartTimeoutReplayUseLastFrameShow){let e=r.height;var s=r._opt,a=(s.hasControl&&!s.controlAutoHide&&(e-=s.playType===v?48:38),this.$loadingBgImage.width=r.width,this.$loadingBgImage.height=e,s.rotate);270!==a&&90!==a||(control.$loadingBgImage.width=e,control.$loadingBgImage.height=r.width),this.$loadingBgImage.src=r._opt.loadingBackground;let t="contain",i=(s.isResize||(t="fill"),s.isFullResize&&(t="none"),"");"none"===s.mirrorRotate&&a&&(i+=" rotate("+a+"deg)"),"level"===s.mirrorRotate?i+=" rotateY(180deg)":"vertical"===s.mirrorRotate&&(i+=" rotateX(180deg)"),this.$loadingBgImage.style.transform=i,this.$loadingBgImage.style.objectFit=t,I(this.$loadingBg,"display","block")}}_validateExtendBtn(t){let e=!0;return t.name||(this.player.debug.warn("Control","extend button name is required"),e=!1),e&&-1!==this.extendBtnList.findIndex(e=>e.name===t.name)&&(this.player.debug.warn("Control",`extend button name: ${t.name} is already exist`),e=!1),e&&!t.icon&&(this.player.debug.warn("Control","extend button icon is required"),e=!1),e}addExtendBtn(){let t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};var e=It(Ve);if(t=Object.assign({},e,t),this._validateExtendBtn(t)){const i=t.name||"",r=this.$controlsRight,s=t.activeIcon&&t.activeClick,a=`
  348. <div class="jessibuca-controls-item-wrap">
  349. ${t.icon?`<div class="jessibuca-controls-item jessibuca-control-extend-${i}">
  350. <i class="jessibuca-icon jessibuca-icon-extend-${i}"></i>
  351. ${t.iconTitle?`
  352. <span class="icon-title-tips"><span class="icon-title">${t.iconTitle}</span></span>
  353. `:""}
  354. </div>`:""}
  355. ${t.activeIcon?`<div class="jessibuca-controls-item jessibuca-control-extend-${i}-active">
  356. <i class="jessibuca-icon jessibuca-icon-extend-${i}-active"></i>
  357. ${t.activeIconTitle?`
  358. <span class="icon-title-tips"><span class="icon-title">${t.activeIconTitle}</span></span>
  359. `:""}
  360. </div>`:""}
  361. </div>
  362. `,n=Array.from(r.children)[t.index],o=(n?n.insertAdjacentHTML("beforebegin",a):rs(r,a),t.icon?r.querySelector(".jessibuca-icon-extend-"+i):null),l=t.icon?r.querySelector(".jessibuca-control-extend-"+i):null,c=t.activeIcon?r.querySelector(`.jessibuca-icon-extend-${i}-active`):null,d=t.activeIcon?r.querySelector(`.jessibuca-control-extend-${i}-active`):null,{proxy:u}=this.player["events"];t.icon&&(I(o,"background",`url(${t.icon}) no-repeat center`),I(o,"background-size","100% 100%"),I(l,"display","none"),t.iconHover)&&(u(o,"mouseover",()=>{I(o,"background",`url(${t.iconHover}) no-repeat center`),I(o,"background-size","100% 100%")}),u(o,"mouseout",()=>{I(o,"background",`url(${t.icon}) no-repeat center`),I(o,"background-size","100% 100%")})),t.activeIcon&&(I(c,"background",`url(${t.activeIcon}) no-repeat center`),I(c,"background-size","100% 100%"),I(d,"display","none"),t.activeIconHover)&&(u(c,"mouseover",()=>{I(c,"background",`url(${t.activeIconHover}) no-repeat center`),I(c,"background-size","100% 100%")}),u(c,"mouseout",()=>{I(c,"background",`url(${t.activeIcon}) no-repeat center`),I(c,"background-size","100% 100%")})),t.click&&o&&u(o,"click",e=>{e.preventDefault(),s&&(I(l,"display","none"),I(d,"display","flex")),t.click.call(this.player,this,e)}),t.activeClick&&c&&u(c,"click",e=>{e.preventDefault(),I(l,"display","flex"),I(d,"display","none"),t.activeClick.call(this.player,this,e)}),this.extendBtnList.push({name:i,$iconWrap:l,$activeIconWrap:d})}}}is(".jessibuca-container{position:relative;width:100%;height:100%;overflow:hidden}.jessibuca-container.jessibuca-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}");class M{static init(){for(var e in M.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},M.types)M.types.hasOwnProperty(e)&&(M.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var t=M.constants={};t.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),t.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),t.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSC=t.STCO=t.STTS,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),t.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),t.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,r=Array.prototype.slice.call(arguments,1),s=r.length;for(let e=0;e<s;e++)t+=r[e].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let a=8;for(let e=0;e<s;e++)i.set(r[e],a),a+=r[e].byteLength;return i}static generateInitSegment(e){var t=M.box(M.types.ftyp,M.constants.FTYP),e=M.moov(e),i=new Uint8Array(t.byteLength+e.byteLength);return i.set(t,0),i.set(e,t.byteLength),i}static moov(e){var t=M.mvhd(e.timescale,e.duration),i=M.trak(e),e=M.mvex(e);return M.box(M.types.moov,t,i,e)}static mvhd(e,t){return M.box(M.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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]))}static trak(e){return M.box(M.types.trak,M.tkhd(e),M.mdia(e))}static tkhd(e){var t=e.id,i=e.duration,r=e.presentWidth,e=e.presentHeight;return M.box(M.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,e>>>8&255,255&e,0,0]))}static mdia(e){return M.box(M.types.mdia,M.mdhd(e),M.hdlr(e),M.minf(e))}static mdhd(e){var t=e.timescale,e=e.duration;return M.box(M.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e,85,196,0,0]))}static hdlr(e){e="audio"===e.type?M.constants.HDLR_AUDIO:M.constants.HDLR_VIDEO;return M.box(M.types.hdlr,e)}static minf(e){var t="audio"===e.type?M.box(M.types.smhd,M.constants.SMHD):M.box(M.types.vmhd,M.constants.VMHD);return M.box(M.types.minf,t,M.dinf(),M.stbl(e))}static dinf(){return M.box(M.types.dinf,M.box(M.types.dref,M.constants.DREF))}static stbl(e){return M.box(M.types.stbl,M.stsd(e),M.box(M.types.stts,M.constants.STTS),M.box(M.types.stsc,M.constants.STSC),M.box(M.types.stsz,M.constants.STSZ),M.box(M.types.stco,M.constants.STCO))}static stsd(e){return"audio"===e.type?M.box(M.types.stsd,M.constants.STSD_PREFIX,M.mp4a(e)):"avc"===e.videoType?M.box(M.types.stsd,M.constants.STSD_PREFIX,M.avc1(e)):M.box(M.types.stsd,M.constants.STSD_PREFIX,M.hvc1(e))}static mp4a(e){var t=e.channelCount,i=e.audioSampleRate,t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return M.box(M.types.mp4a,t,M.esds(e))}static esds(e){var e=e.config||[],t=e.length,t=new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e).concat([6,1,2]));return M.box(M.types.esds,t)}static avc1(e){var t=e.avcc,i=e.codecWidth,e=e.codecHeight,i=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,i>>>8&255,255&i,e>>>8&255,255&e,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return M.box(M.types.avc1,i,M.box(M.types.avcC,t))}static hvc1(e){var t=e.avcc,i=e.codecWidth,e=e.codecHeight,i=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,i>>>8&255,255&i,e>>>8&255,255&e,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return M.box(M.types.hvc1,i,M.box(M.types.hvcC,t))}static mvex(e){return M.box(M.types.mvex,M.trex(e))}static trex(e){e=e.id,e=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return M.box(M.types.trex,e)}static moof(e,t){return M.box(M.types.moof,M.mfhd(e.sequenceNumber),M.traf(e,t))}static mfhd(e){e=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return M.box(M.types.mfhd,e)}static traf(e,t){var i=e.id,i=M.box(M.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),t=M.box(M.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),r=M.sdtp(e),e=M.trun(e,r.byteLength+16+16+8+16+8+8);return M.box(M.types.traf,i,t,e,r)}static sdtp(e){var t=new Uint8Array(5),e=e.flags;return t[4]=e.isLeading<<6|e.dependsOn<<4|e.isDependedOn<<2|e.hasRedundancy,M.box(M.types.sdtp,t)}static trun(e,t){var i=new Uint8Array(28),t=(i.set([0,0,15,1,0,0,0,1,(t+=36)>>>24&255,t>>>16&255,t>>>8&255,255&t],0),e.duration),r=e.size,s=e.flags,e=e.cts;return i.set([t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e],12),M.box(M.types.trun,i)}static mdat(e){return M.box(M.types.mdat,e)}}M.init();class ns extends e{constructor(t){super(),this.player=t,this.isAvc=!0,this.mediaSource=new window.MediaSource,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.cacheTrack={},this.timeInit=!1,this.sequenceNumber=0,this.dropping=!1,this.firstRenderTime=null,this.$videoElement=null,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.isDecodeFirstIIframe=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.prevPayloadBufferSize=0,this.isWidthOrHeightChanged=!1,this.prevTs=null,this.mediaSourceObjectURL=window.URL.createObjectURL(this.mediaSource),this.eventListenList=[],t._opt.mseUseCanvasRender?(this.$videoElement=document.createElement("video"),this.$videoElement.src=this.mediaSourceObjectURL,this.initVideoEvents()):(this.player.video.$videoElement.src=this.mediaSourceObjectURL,this.$videoElement=this.player.video.$videoElement);const{proxy:e}=t["events"],i=e(this.mediaSource,"sourceopen",()=>{this.player&&this.player.emit(E.mseSourceOpen)}),r=e(this.mediaSource,"sourceclose",()=>{this.player&&this.player.emit(E.mseSourceClose)}),s=e(this.mediaSource,"sourceended",()=>{this.player&&this.player.emit(E.mseSourceended)});if(this.eventListenList.push(i,r,s),this.player.isPlayer){const a=e(this.$videoElement,Be,e=>{if(this._handleUpdatePlaybackRate(),t._opt.mseUseCanvasRender)if(this.player.checkIsInRender())this.player.handleRender();else{const t=parseInt(e.timeStamp,10);this.player.debug.warn("MediaSource",`mseUseCanvasRender is true and $videoElement ts is ${t}, but not in render`)}else this.player.handleRender()}),i=e(this.$videoElement,Me,()=>{t.debug.log("MediaSource","video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)});this.eventListenList.push(a,i)}t.debug.log("MediaSource","init")}destroy(){this.stop(),this.eventListenList.length&&(this.eventListenList.forEach(e=>e()),this.eventListenList=[]),this.mediaSource=null,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.sequenceNumber=0,this.cacheTrack={},this.timeInit=!1,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.isDecodeFirstIIframe=!1,this.prevTimestamp=null,this.prevDts=null,this.prevPayloadBufferSize=0,this.prevTs=null,this.firstRenderTime=null,this.isWidthOrHeightChanged=!1,this.dropping=!1,this.$videoElement&&(this.player._opt.mseUseCanvasRender&&this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement=null),this.mediaSourceObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceObjectURL),this.mediaSourceObjectURL=null),this.off(),this.player.debug.log("MediaSource","destroy")}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return"open"===this.state}get isStateClosed(){return"closed"===this.state}get isStateEnded(){return"ended"===this.state}get duration(){return this.mediaSource&&this.mediaSource.duration||-1}set duration(e){this.mediaSource.duration=e}initVideoEvents(){var e=this.player.events["proxy"],t=e(this.$videoElement,Ie,()=>{this.player.debug.log("MediaSource","video canplay"),this.$videoElement.play().then(()=>{this.player.debug.log("MediaSource","video play")}).catch(e=>{this.player.debug.error("MediaSource","video play error ",e),this.player.emitError(m.mediaSourceUseCanvasRenderPlayFailed,e)})}),i=e(this.$videoElement,Pe,()=>{this.player.debug.log("MediaSource","video waiting")}),e=e(this.$videoElement,Be,e=>{e=parseInt(e.timeStamp,10);this.player.emit(E.videoTimeUpdate,e),this.$videoElement.paused&&(this.player.debug.warn("MediaSource","video is paused and next try to replay"),this.$videoElement.play().then(()=>{this.player.debug.log("MediaSource","video is paused and replay success")}).catch(e=>{this.player.debug.warn("MediaSource","video is paused and replay error ",e)}))});this.eventListenList.push(t,i,e)}decodeVideo(t,i,r,s){var e=this.player;if(e)if(this.player.isDestroyed())this.player.debug.warn("MediaSource","decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&r&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(r&&0===t[1]){const i=15&t[0];let e={};7==i?e=xi(t.slice(5)):12==i&&(e=Fi(t));const s=this.player.video.videoInfo;s&&s.width&&s.height&&e&&e.codecWidth&&e.codecHeight&&(e.codecWidth!==s.width||e.codecHeight!==s.height)&&(this.player.debug.warn("MediaSource",`
  363. decodeVideo: video width or height is changed,
  364. old width is ${s.width}, old height is ${s.height},
  365. new width is ${e.codecWidth}, new height is ${e.codecHeight},
  366. and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(m.mseWidthOrHeightChange))}if(this.isWidthOrHeightChanged)this.player.debug.warn("MediaSource","decodeVideo: video width or height is changed, and return");else if(Mt(t))this.player.debug.warn("MediaSource","decodeVideo and payload is video sequence header so drop this frame");else if(t.byteLength<12)this.player.debug.warn("MediaSource","decodeVideo and payload is too small , payload length is "+t.byteLength);else{null===this.firstRenderTime&&(this.firstRenderTime=i);let e=i-this.firstRenderTime;if(e<0&&(this.player.debug.warn("MediaSource",`decodeVideo
  367. local dts is < 0 , ts is ${i} and prevTs is ${this.prevTs},
  368. firstRenderTime is ${this.firstRenderTime} and mseCorrectTimeDuration is `+this.player._opt.mseCorrectTimeDuration),e=null===this.prevDts?0:this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(i)))this.player.debug.warn("MediaSource",`decodeVideo is max diff , ts is ${i} and prevTs is ${this.prevTs}, diff is `+(this.prevTs-i)),this.emit(m.mediaSourceTsIsMaxDiff);else{if(null!==this.prevDts&&e<=this.prevDts){if(this.player.debug.warn("MediaSource",`
  369. decodeVideo dts is less than(or equal) prev dts ,
  370. dts is ${e} and prev dts is ${this.prevDts} ,
  371. and now ts is ${i} and prev ts is ${this.prevTs} ,
  372. and diff is ${i-this.prevTs} and firstRenderTime is ${this.firstRenderTime},
  373. and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration},
  374. and prevPayloadBufferSize is ${this.prevPayloadBufferSize} and payload size is `+t.byteLength),e===this.prevDts&&this.prevPayloadBufferSize===t.byteLength)return void this.player.debug.warn("MediaSource","decodeVideo dts is equal to prev dts and payload size is equal to prev payload size so drop this frame");if(e=this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(i))return this.player.debug.warn("MediaSource",`decodeVideo is max diff , ts is ${i} and prevTs is ${this.prevTs}, diff is ${this.prevTs-i} and emit replay`),void this.emit(m.mediaSourceTsIsMaxDiff)}this._decodeVideo(t,e,r,s,i),this.prevDts=e,this.prevPayloadBufferSize=t.byteLength,this.prevTs=i,this.player.getRenderType()===K&&this.player.video&&this.player.video.doAddContentToWatermark()}}}else this.player.debug.warn("MediaSource","decodeVideo isDecodeFirstIIframe false");else if(r&&0===t[1]){const s=15&t[0];(e.video.updateVideoInfo({encTypeCode:s}),12!=s||ct())?(e._times.decodeStart||(e._times.decodeStart=A()),this.hasInit=this._decodeConfigurationRecord(t,i,r,s)):this.emit(m.mediaSourceH265NotSupport)}else this.player.debug.warn("MediaSource",`decodeVideo has not init , isIframe is ${r} , payload is `+t[1])}_checkTsIsMaxDiff(e){return 0<this.prevTs&&e<this.prevTs&&36e5<this.prevTs-e}_decodeConfigurationRecord(e,t,i,r){let s=e.slice(5),a={};return 7===r?a=xi(s):12===r&&(a=Fi(e)),this.player.recorder&&this.player._opt.recordType===p&&this.player.recorder.initMetaData(e,r),0===a.codecWidth&&0===a.codecHeight?(this.player.debug.warn("MediaSource","_decodeConfigurationRecord",a),this.emit(m.mediaSourceDecoderConfigurationError),!1):(e={id:1,type:"video",timescale:1e3,duration:0,avcc:s,codecWidth:a.codecWidth,codecHeight:a.codecHeight,videoType:a.videoType},e=M.generateInitSegment(e),this.isAvc=7===r,this.appendBuffer(e.buffer),this.sequenceNumber=0,this.cacheTrack={},!(this.timeInit=!1))}_decodeVideo(e,t,i,r,s){var a=this.player;let n=e.slice(5),o=n.byteLength,l=(new Date).getTime(),c=!1;this.prevTimestamp||(this.prevTimestamp=l,c=!0);var d,u,e=l-this.prevTimestamp,e=(((this.decodeDiffTimestamp=e)<5||500<e)&&!c&&a.debug.warn("MediaSource",`_decodeVideo now time is ${l} and prev time is ${this.prevTimestamp}, diff time is ${e} ms`),this.$videoElement),h=a._opt.videoBufferDelay+a._opt.videoBuffer;1<e.buffered.length&&(this.removeBuffer(e.buffered.start(0),e.buffered.end(0)),this.timeInit=!1),this.dropping&&this.cacheTrack.id&&t-this.cacheTrack.dts>h?(a.debug.warn("MediaSource","dropping time is ",t-this.cacheTrack.dts),this.dropping=!1,this.cacheTrack={}):this.cacheTrack.id&&t>=this.cacheTrack.dts?(h=8+this.cacheTrack.size,(d=new Uint8Array(h))[0]=h>>>24&255,d[1]=h>>>16&255,d[2]=h>>>8&255,d[3]=255&h,d.set(M.types.mdat,4),d.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts,this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===p&&this.player.recorder.handleAddFmp4Track(this.cacheTrack),h=M.moof(this.cacheTrack,this.cacheTrack.dts),(u=new Uint8Array(h.byteLength+d.byteLength)).set(h,0),u.set(d,h.byteLength),this.appendBuffer(u.buffer),a.emit(E.timeUpdate,s),a.videoTimestamp=s,a.updateStats({fps:!0,ts:s,mseTs:t,buf:a.demux&&a.demux.delay||0}),a._times.videoStart||(a._times.videoStart=A(),a.handlePlayToRenderTimes())):(a.debug.log("MediaSource",`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${s} cacheTrack dts is `+(this.cacheTrack&&this.cacheTrack.dts)),this.timeInit=!1,this.cacheTrack={}),this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=1,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=o,this.cacheTrack.dts=t,this.cacheTrack.cts=r,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=n,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},this.timeInit||1!==e.buffered.length||(a.debug.log("MediaSource","timeInit set true"),this.timeInit=!0,e.currentTime=e.buffered.end(0)),!this.isInitInfo&&0<e.videoWidth&&0<e.videoHeight&&(a.debug.log("MediaSource",`updateVideoInfo: ${e.videoWidth},`+e.videoHeight),a.video.updateVideoInfo({width:e.videoWidth,height:e.videoHeight}),a.video.initCanvasViewSize(),this.isInitInfo=!0),a._opt.mseUseCanvasRender&&a.video.render({$video:e,ts:t}),this.prevTimestamp=(new Date).getTime()}appendBuffer(e){var{debug:t,events:{proxy:i}}=this.player;if(null===this.sourceBuffer){var r=this.isAvc?ve:Ee;try{this.sourceBuffer=this.mediaSource.addSourceBuffer(r)}catch(e){t.warn("MediaSource","this.mediaSource.addSourceBuffer()",e.code,e),this.player.emitError(m.mseAddSourceBufferError,e)}r=i(this.sourceBuffer,"error",e=>{this.player.emitError(m.mseSourceBufferError,e)}),i=i(this.sourceBuffer,"updateend",()=>{});this.eventListenList.push(r,i)}if(this.mediaSourceAppendBufferFull)t.warn("MediaSource","this.mediaSourceAppendBufferFull is true");else if(this.mediaSourceAppendBufferError)t.warn("MediaSource","this.mediaSourceAppendBufferError is true");else if(!1===this.sourceBuffer.updating&&this.isStateOpen)try{this.sourceBuffer.appendBuffer(e)}catch(e){t.warn("MediaSource","this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.emit(m.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.emit(m.mediaSourceAppendBufferError)):(t.error("MediaSource","appendBuffer error",e),this.player.emitError(E.mseSourceBufferError,e))}else this.isStateClosed?this.player.emitError(m.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed"):this.isStateEnded?this.player.emitError(m.mseSourceBufferError,"mediaSource is end"):S(this.sourceBuffer.updating)&&(t.warn("MediaSource","mseSourceBufferBusy"),this.player.emit(E.mseSourceBufferBusy))}getSourceBufferUpdating(){return this.sourceBuffer&&this.sourceBuffer.updating}stop(){this.abortSourceBuffer(),this.endOfStream(),this.removeSourceBuffer()}dropSourceBuffer(e){var t=this.$videoElement;this.dropping=e,0<t.buffered.length&&1<t.buffered.end(0)-t.currentTime&&(this.player.debug.warn("MediaSource","dropSourceBuffer",`$video.buffered.end(0) is ${t.buffered.end(0)} - $video.currentTime `+t.currentTime),t.currentTime=t.buffered.end(0))}checkSourceBufferDelay(){var e=this.$videoElement;let t=0;return(t=0<e.buffered.length?e.buffered.end(e.buffered.length-1)-e.currentTime:t)<0&&(this.player.debug.warn("MediaSource",`checkSourceBufferDelay end(0) is ${e.buffered.end(0)} - currentTime is ${e.currentTime} and result < 0 and result is `+t),t=0),t}getDecodeDiffTimes(){return this.decodeDiffTimestamp}removeBuffer(e,t){if(this.isStateOpen&&!1===this.sourceBuffer.updating)try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debug.warn("MediaSource","removeBuffer() error",e)}else this.player.debug.warn("MediaSource","removeBuffer() this.isStateOpen is",this.isStateOpen,"this.sourceBuffer.updating",this.sourceBuffer.updating)}endOfStream(){if(this.isStateOpen&&this.$videoElement&&1<=this.$videoElement.readyState)try{this.mediaSource.endOfStream()}catch(e){this.player.debug.warn("MediaSource","endOfStream() error",e)}}abortSourceBuffer(){this.isStateOpen&&this.sourceBuffer&&(this.sourceBuffer.abort(),this.sourceBuffer=null)}removeSourceBuffer(){if(!this.isStateClosed&&this.mediaSource&&this.sourceBuffer)try{this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debug.warn("MediaSource","removeSourceBuffer() error",e)}}_handleUpdatePlaybackRate(){if(this.$videoElement){var t=this.$videoElement,i=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3,r=t.buffered,r=(r.length&&r.start(0),r.length?r.end(r.length-1):0);let e=t.currentTime;var s=r-e,i=Math.max(5,3+i),i=(i<s?(this.player.debug.warn("MediaSource",`handleUpdatePlaybackRate and buffered is ${r} and current is ${e} , delay buffer is more than ${i} is ${s} and new time is `+r),t.currentTime=r,e=t.currentTime):s<0&&(this.player.debug.warn("MediaSource",`handleUpdatePlaybackRate and delay buffer is ${r} - current is ${e} = ${s} < 0 and check video is paused : ${t.paused} `),t.paused)&&t.play(),this._getPlaybackRate(r-e));t.playbackRate!==i&&(this.player.debug.warn("MediaSource",`handleUpdatePlaybackRate and buffered is ${r} and current time is ${e} and delay is ${r-e} set playbackRate is ${i} `),t.playbackRate=i)}}getDecodePlaybackRate(){let e=0;var t=this.$videoElement;return e=t?t.playbackRate:e}_getPlaybackRate(e){var t=this.$videoElement,i=this.player._opt.videoBuffer,r=i+this.player._opt.videoBufferDelay;return e*=1e3,1===t.playbackRate?r<e?1.2:1:e<=i?1:t.playbackRate}}const os=()=>"wakeLock"in navigator&&-1===window.navigator.userAgent.indexOf("Samsung")&&k(rt());class ls{constructor(e){this.player=e,this.enabled=!1,os()?(this.player.debug.log("NoSleep","Native Wake Lock API supported."),this._wakeLock=null,this.handleVisibilityChange=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):(this.player.debug.log("NoSleep","Native Wake Lock API not supported. so use video element."),this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYECGFOAZwEAAAAAABLfEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHYTbuMU6uEElTDZ1OsggGXTbuMU6uEHFO7a1OsghLJ7AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmsirXsYMPQkBNgI1MYXZmNTguNDUuMTAwV0GNTGF2ZjU4LjQ1LjEwMESJiECzmgAAAAAAFlSua0C5rgEAAAAAAABO14EBc8WI9UhIq9EDJPCcgQAitZyDdW5khoVWX1ZQOIOBASPjg4QF9eEA4AEAAAAAAAAbsIIBQLqB8FSwggElVLqB8FWwiFW3gQFVuIECrgEAAAAAAABZ14ECc8WIUEWPA9J/iJ6cgQAitZyDdW5khoZBX09QVVNWqoNjLqBWu4QExLQAg4EC4ZGfgQG1iEDncAAAAAAAYmSBIGOik09wdXNIZWFkAQE4AYC7AAAAAAASVMNnQcJzcwEAAAAAAACXY8CAZ8gBAAAAAAAAFUWji01BSk9SX0JSQU5ERIeEaXNvbWfIAQAAAAAAABZFo41NSU5PUl9WRVJTSU9ORIeDNTEyZ8gBAAAAAAAAJ0WjkUNPTVBBVElCTEVfQlJBTkRTRIeQaXNvbWlzbzJhdmMxbXA0MWfIAQAAAAAAABpFo4dFTkNPREVSRIeNTGF2ZjU4LjQ1LjEwMHNzAQAAAAAAAIZjwItjxYj1SEir0QMk8GfIAQAAAAAAAB5Fo4xIQU5ETEVSX05BTUVEh4xWaWRlb0hhbmRsZXJnyAEAAAAAAAAhRaOHRU5DT0RFUkSHlExhdmM1OC45MS4xMDAgbGlidnB4Z8iiRaOIRFVSQVRJT05Eh5QwMDowMDowNS4wMDcwMDAwMDAAAHNzAQAAAAAAAIdjwItjxYhQRY8D0n+InmfIAQAAAAAAAB5Fo4xIQU5ETEVSX05BTUVEh4xTb3VuZEhhbmRsZXJnyAEAAAAAAAAiRaOHRU5DT0RFUkSHlUxhdmM1OC45MS4xMDAgbGlib3B1c2fIokWjiERVUkFUSU9ORIeUMDA6MDA6MDUuMDE4MDAwMDAwAAAfQ7Z1T2TngQCjh4IAAID4//6jQKSBAAeAMBIAnQEqQAHwAABHCIWFiIWEiAICAAYWBPcGgWSfa9ubJzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh69AD+/6tQgKOHggAVgPj//qOHggApgPj//qOHggA9gPj//qOHggBRgPj//qOHggBlgPj//qOegQBrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCAHmA+P/+o4eCAI2A+P/+o4eCAKGA+P/+o4eCALWA+P/+o4eCAMmA+P/+o56BAM8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IA3YD4//6jh4IA8YD4//6jh4IBBYD4//6jh4IBGYD4//6jh4IBLYD4//6jnoEBMwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggFBgPj//qOHggFVgPj//qOHggFpgPj//qOHggF9gPj//qOHggGRgPj//qOegQGXANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCAaWA+P/+o4eCAbmA+P/+o4eCAc2A+P/+o4eCAeGA+P/+o4eCAfWA+P/+o56BAfsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ICCYD4//6jh4ICHYD4//6jh4ICMYD4//6jh4ICRYD4//6jh4ICWYD4//6jnoECXwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggJtgPj//qOHggKBgPj//qOHggKVgPj//qOHggKpgPj//qOHggK9gPj//qOegQLDANECAAUQEBRgAGFgv9AAIgAQzX61yT5xzAAAo4eCAtGA+P/+o4eCAuWA+P/+o4eCAvmA+P/+o4eCAw2A+P/+o4eCAyGA+P/+o56BAycA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IDNYD4//6jh4IDSYD4//6jh4IDXYD4//6jh4IDcYD4//6jh4IDhYD4//6jnoEDiwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggOZgPj//qOHggOtgPj//qOHggPBgPj//qOHggPVgPj//qOHggPpgPj//qOegQPvANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCA/2A+P/+o4eCBBGA+P/+o4eCBCWA+P/+o4eCBDmA+P/+o4eCBE2A+P/+o56BBFMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IEiID4//6jh4IEnID4//6jh4IEsID4//6jnoEEtwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggTEgPj//qOHggTYgPj//qOHggTsgPj//qOHggUAgPj//qOHggUUgPj//qOegQUbANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBSiA+P/+o4eCBTyA+P/+o4eCBVCA+P/+o4eCBWSA+P/+o4eCBXiA+P/+o56BBX8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IFjID4//6jh4IFoID4//6jh4IFtID4//6jh4IFyID4//6jh4IF3ID4//6jnoEF4wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggXwgPj//qOHggYEgPj//qOHggYYgPj//qOHggYsgPj//qOHggZAgPj//qOegQZHANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBlSA+P/+o4eCBmiA+P/+o4eCBnyA+P/+o4eCBpCA+P/+o4eCBqSA+P/+o56BBqsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IGuID4//6jh4IGzID4//6jh4IG4ID4//6jh4IG9ID4//6jh4IHCID4//6jnoEHDwDRAgAFEBAUYABhYL/QACIAEM1+tck+ccwAAKOHggccgPj//qOHggcwgPj//qOHggdEgPj//qOHggdYgPj//qOHggdsgPj//qOegQdzANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCB4CA+P/+o4eCB5SA+P/+o4eCB6iA+P/+o4eCB7yA+P/+o4eCB9CA+P/+o56BB9cA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IH5ID4//6jh4IH+ID4//6jh4IIDID4//6jh4IIIID4//6jh4IINID4//6jnoEIOwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgghIgPj//qOHgghcgPj//qOHgghwgPj//qOHggiEgPj//qOegQifANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCMCA+P/+o4eCCNSA+P/+o4eCCOiA+P/+o4eCCPyA+P/+o56BCQMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IJEID4//6jh4IJJID4//6jh4IJOID4//6jh4IJTID4//6jh4IJYID4//6jnoEJZwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggl0gPj//qOHggmIgPj//qOHggmcgPj//qOHggmwgPj//qOHggnEgPj//qOegQnLANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCdiA+P/+o4eCCeyA+P/+o4eCCgCA+P/+o4eCChSA+P/+o4eCCiiA+P/+o56BCi8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IKPID4//6jh4IKUID4//6jh4IKZID4//6jh4IKeID4//6jh4IKjID4//6jnoEKkwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggqggPj//qOHggq0gPj//qOHggrIgPj//qOHggrcgPj//qOHggrwgPj//qOegQr3ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCwSA+P/+o4eCCxiA+P/+o4eCCyyA+P/+o4eCC0CA+P/+o4eCC1SA+P/+o56BC1sA0QIABRAQFGAAYWC/0AAiABDNfrXJPnHMAACjh4ILaID4//6jh4ILfID4//6jh4ILkID4//6jh4ILpID4//6jh4ILuID4//6jnoELvwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggvMgPj//qOHggvggPj//qOHggv0gPj//qOHggwIgPj//qOHggwcgPj//qOegQwjANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDDCA+P/+o4eCDESA+P/+o4eCDFiA+P/+o4eCDGyA+P/+o4eCDICA+P/+o56BDIcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IMlID4//6jh4IMqID4//6jh4IMvID4//6jh4IM0ID4//6jnoEM6wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg0MgPj//qOHgg0ggPj//qOHgg00gPj//qOHgg1IgPj//qOegQ1PANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDVyA+P/+o4eCDXCA+P/+o4eCDYSA+P/+o4eCDZiA+P/+o4eCDayA+P/+o56BDbMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4INwID4//6jh4IN1ID4//6jh4IN6ID4//6jh4IN/ID4//6jh4IOEID4//6jnoEOFwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg4kgPj//qOHgg44gPj//qOHgg5MgPj//qOHgg5ggPj//qOHgg50gPj//qOegQ57ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDoiA+P/+o4eCDpyA+P/+o4eCDrCA+P/+o4eCDsSA+P/+o4eCDtiA+P/+o56BDt8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IO7ID4//6jh4IPAID4//6jh4IPFID4//6jh4IPKID4//6jh4IPPID4//6jnoEPQwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg9QgPj//qOHgg9kgPj//qOHgg94gPj//qOHgg+MgPj//qOHgg+ggPj//qOegQ+nANECAAUQEBRgAGFgv9AAIgAQzX61yT5xzAAAo4eCD7SA+P/+o4eCD8iA+P/+o4eCD9yA+P/+o4eCD/CA+P/+o4eCEASA+P/+o56BEAsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IQGID4//6jh4IQLID4//6jh4IQQID4//6jh4IQVID4//6jh4IQaID4//6jnoEQbwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghB8gPj//qOHghCQgPj//qOHghCkgPj//qOHghC4gPj//qOHghDMgPj//qOegRDTANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEOCA+P/+o4eCEPSA+P/+o4eCEQiA+P/+o56BETcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IRQ4D4//6jh4IRV4D4//6jh4IRa4D4//6jh4IRf4D4//6jh4IRk4D4//6jnoERmwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghGngPj//qOHghG7gPj//qOHghHPgPj//qOHghHjgPj//qOHghH3gPj//qOegRH/ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEguA+P/+o4eCEh+A+P/+o4eCEjOA+P/+o4eCEkeA+P/+o4eCEluA+P/+o56BEmMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ISb4D4//6jh4ISg4D4//6jh4ISl4D4//6jh4ISq4D4//6jh4ISv4D4//6jnoESxwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghLTgPj//qOHghLngPj//qOHghL7gPj//qOHghMPgPj//qOHghMjgPj//qOegRMrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEzeA+P/+o4eCE0uA+P/+o4eCE1+A+P/+o4eCE3OA+P/+oAEAAAAAAAAPoYeCE4cA+P/+daKDB/KBHFO7a5G7j7OBB7eK94EB8YIDX/CBDA=="),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACORtZGF03gIATGF2YzU4LjM1LjEwMAACMEAOAAACcQYF//9t3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MSByMzAyNyA0MTIxMjc3IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTAgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTcgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0wIHdlaWdodHA9MCBrZXlpbnQ9MjUwIGtleWludF9taW49MTAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD00MCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIzLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IGlwX3JhdGlvPTEuNDAgYXE9MToxLjAwAIAAAADvZYiED/JigADD7JycnJycnJycnJycnJycnJycnJ11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114BGCAHARggBwEYIAcBGCAHARggBwAAAAdBmjgf4BLYARggBwEYIAcBGCAHARggBwAAAAdBmlQH+AS2ARggBwEYIAcBGCAHARggBwAAAAdBmmA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZrAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0Ga4D/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbAD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbID/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBm0A/wCWwARggBwEYIAcBGCAHAAAAB0GbYD/AJbABGCAHARggBwEYIAcAAAAHQZuAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GboD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbwD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0Gb4D/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBmgA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmiA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmkA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZpgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwAAAAdBmsA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmuA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmwA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZsgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtgP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GbgD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GboD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbwD/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBm+A/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmgA/wCWwARggBwEYIAcAAAAHQZogP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GaQD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GaYD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GagD/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBmqA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmsA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmuA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZsAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZsgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GbYD/AJbABGCAHARggBwAAAAdBm4A/wCWwARggBwEYIAcBGCAHARggBwAAAAdBm6A/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZvAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZvgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZoAO8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GaIDfAJbABGCAHARggBwEYIAcBGCAHAAAMxm1vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAABOgAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAPLdHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAABOIAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAElVVUA8AAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAATiAAAAAAAAQAAAAADQ21kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAKAAAAMgAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAu5taW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAKuc3RibAAAAKpzdHNkAAAAAAAAAAEAAACaYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAFAAPAASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAADRhdmNDAULAC//hABxnQsAL2QFB+/8ACwAMEAAAAwAQAAADAUDxQqSAAQAFaMuDyyAAAAAQcGFzcAAAAAsAAAAMAAAAGHN0dHMAAAAAAAAAAQAAADIAAAQAAAAAFHN0c3MAAAAAAAAAAQAAAAEAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAA3HN0c3oAAAAAAAAAAAAAADIAAANoAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAANhzdGNvAAAAAAAAADIAAABFAAADwQAAA9wAAAP3AAAEFgAABDEAAARMAAAEawAABIYAAAShAAAEwAAABNcAAATuAAAFDQAABSgAAAVDAAAFYgAABX0AAAWYAAAFtwAABdIAAAXtAAAGBAAABh8AAAY6AAAGWQAABnQAAAaPAAAGrgAABskAAAbkAAAHAwAABx4AAAcxAAAHUAAAB2sAAAeGAAAHpQAAB8AAAAfbAAAH+gAACBUAAAgwAAAITwAACGIAAAh9AAAInAAACLcAAAjSAAAI8QAACCV0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAAE6AAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAABOIAAAEAAABAAAAAAedbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAACsRAADYVRVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAAHSG1pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAHDHN0YmwAAABqc3RzZAAAAAAAAAABAAAAWm1wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAACsRAAAAAAANmVzZHMAAAAAA4CAgCUAAgAEgICAF0AVAAAAAAENiAAABVQFgICABRIIVuUABoCAgAECAAAAYHN0dHMAAAAAAAAACgAAAC8AAAQAAAAAAQAACtUAAAAsAAAEAAAAAAEAAArWAAAALAAABAAAAAABAAAK1QAAACwAAAQAAAAAAQAACtUAAAAaAAAEAAAAAAEAAAH/AAABzHN0c2MAAAAAAAAAJQAAAAEAAAABAAAAAQAAAAIAAAAFAAAAAQAAAAMAAAAEAAAAAQAAAAUAAAAFAAAAAQAAAAYAAAAEAAAAAQAAAAgAAAAFAAAAAQAAAAkAAAAEAAAAAQAAAAsAAAAFAAAAAQAAAAwAAAADAAAAAQAAAA4AAAAFAAAAAQAAAA8AAAAEAAAAAQAAABEAAAAFAAAAAQAAABIAAAAEAAAAAQAAABQAAAAFAAAAAQAAABUAAAAEAAAAAQAAABcAAAADAAAAAQAAABgAAAAEAAAAAQAAABoAAAAFAAAAAQAAABsAAAAEAAAAAQAAAB0AAAAFAAAAAQAAAB4AAAAEAAAAAQAAACAAAAAFAAAAAQAAACEAAAAEAAAAAQAAACIAAAACAAAAAQAAACMAAAAFAAAAAQAAACQAAAAEAAAAAQAAACYAAAAFAAAAAQAAACcAAAAEAAAAAQAAACkAAAAFAAAAAQAAACoAAAAEAAAAAQAAACwAAAAFAAAAAQAAAC0AAAACAAAAAQAAAC4AAAAEAAAAAQAAAC8AAAAFAAAAAQAAADAAAAAEAAAAAQAAADIAAAAFAAAAAQAAADMAAAAEAAAAAQAAA1xzdHN6AAAAAAAAAAAAAADSAAAAFQAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAA3HN0Y28AAAAAAAAAMwAAADAAAAOtAAADzAAAA+cAAAQCAAAEIQAABDwAAARXAAAEdgAABJEAAASsAAAEywAABOIAAAT5AAAFGAAABTMAAAVOAAAFbQAABYgAAAWjAAAFwgAABd0AAAX4AAAGDwAABioAAAZFAAAGZAAABn8AAAaaAAAGuQAABtQAAAbvAAAHDgAABykAAAc8AAAHWwAAB3YAAAeRAAAHsAAAB8sAAAfmAAAIBQAACCAAAAg7AAAIWgAACG0AAAiIAAAIpwAACMIAAAjdAAAI/AAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAADSAAAAAQAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTguMjAuMTAw"),Object.assign(this.noSleepVideo.style,{position:"absolute",left:"-100%",top:"-100%"}),document.querySelector("body").append(this.noSleepVideo),this.noSleepVideo.addEventListener("timeupdate",()=>{this.noSleepVideo&&4<this.noSleepVideo.currentTime&&(this.noSleepVideo.currentTime=1)}))}destroy(){if(this._wakeLock&&(this._wakeLock.release(),this._wakeLock=null),this.noSleepVideo){try{this.noSleepVideo.parentNode&&this.noSleepVideo.parentNode.removeChild(this.noSleepVideo)}catch(e){this.player.debug.warn("NoSleep","Failed to remove noSleepVideo element.")}this.noSleepVideo=null}this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange))}_addSourceToVideo(e,t,i){var r=document.createElement("source");r.src=i,r.type="video/"+t,e.appendChild(r)}get isEnabled(){return this.enabled}enable(){const t=this.player.debug;return os()?navigator.wakeLock.request("screen").then(e=>{this._wakeLock=e,this.enabled=!0,t.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",()=>{t.log("wakeLock","Wake Lock released.")})}).catch(e=>{throw this.enabled=!1,t.warn("wakeLock",e.name+", "+e.message),e}):this.noSleepVideo.play().then(e=>(t.log("wakeLock","noSleepVideo Wake Lock active."),this.enabled=!0,e)).catch(e=>{throw t.warn("wakeLock",`noSleepVideo ${e.name}, `+e.message),this.enabled=!1,e})}disable(){os()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):this.noSleepVideo.pause(),this.enabled=!1,this.player.debug.log("wakeLock","Disabling wake lock.")}}var O=(vr=$e(function(e,t){"undefined"!=typeof window&&(e.exports=function(){return i={"./node_modules/eventemitter3/index.js":function(e,t,i){var r=Object.prototype.hasOwnProperty,p="~";function s(){}function a(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function n(e,t,i,r,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");i=new a(i,r||e,s),r=p?p+t:t;return e._events[r]?e._events[r].fn?e._events[r]=[e._events[r],i]:e._events[r].push(i):(e._events[r]=i,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(p=!1)),o.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)r.call(e,t)&&i.push(p?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},o.prototype.listeners=function(e){var e=p?p+e:e,t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var i=0,r=t.length,s=new Array(r);i<r;i++)s[i]=t[i].fn;return s},o.prototype.listenerCount=function(e){e=p?p+e:e,e=this._events[e];return e?e.fn?1:e.length:0},o.prototype.emit=function(e,t,i,r,s,a){var n=p?p+e:e;if(!this._events[n])return!1;var o,l=this._events[n],c=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,r),!0;case 5:return l.fn.call(l.context,t,i,r,s),!0;case 6:return l.fn.call(l.context,t,i,r,s,a),!0}for(h=1,o=new Array(c-1);h<c;h++)o[h-1]=arguments[h];l.fn.apply(l.context,o)}else for(var d,u=l.length,h=0;h<u;h++)switch(l[h].once&&this.removeListener(e,l[h].fn,void 0,!0),c){case 1:l[h].fn.call(l[h].context);break;case 2:l[h].fn.call(l[h].context,t);break;case 3:l[h].fn.call(l[h].context,t,i);break;case 4:l[h].fn.call(l[h].context,t,i,r);break;default:if(!o)for(d=1,o=new Array(c-1);d<c;d++)o[d-1]=arguments[d];l[h].fn.apply(l[h].context,o)}return!0},o.prototype.on=function(e,t,i){return n(this,e,t,i,!1)},o.prototype.once=function(e,t,i){return n(this,e,t,i,!0)},o.prototype.removeListener=function(e,t,i,r){e=p?p+e:e;if(this._events[e])if(t){var s=this._events[e];if(s.fn)s.fn!==t||r&&!s.once||i&&s.context!==i||l(this,e);else{for(var a=0,n=[],o=s.length;a<o;a++)(s[a].fn!==t||r&&!s[a].once||i&&s[a].context!==i)&&n.push(s[a]);n.length?this._events[e]=1===n.length?n[0]:n:l(this,e)}}else l(this,e);return this},o.prototype.removeAllListeners=function(e){return e?(e=p?p+e:e,this._events[e]&&l(this,e)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=p,e.exports=o.EventEmitter=o},"./node_modules/url-toolkit/src/url-toolkit.js":function(e,t,i){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,a=/^([^\/?#]*)([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=o.parseURL(e);if(r)return r.path=o.normalizePath(r.path),o.buildURLFromParts(r);throw new Error("Error trying to parse base URL.")}r=o.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=o.normalizePath(r.path),o.buildURLFromParts(r)):t;t=o.parseURL(e);if(!t)throw new Error("Error trying to parse base URL.");!t.netLoc&&t.path&&"/"!==t.path[0]&&(e=a.exec(t.path),t.netLoc=e[1],t.path=e[2]),t.netLoc&&!t.path&&(t.path="/");var s,e={scheme:t.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};return r.netLoc||(e.netLoc=t.netLoc,"/"===r.path[0])||(r.path?(s=(s=t.path).substring(0,s.lastIndexOf("/")+1)+r.path,e.path=o.normalizePath(s)):(e.path=t.path,r.params||(e.params=t.params,r.query)||(e.query=t.query))),null===e.path&&(e.path=i.alwaysNormalize?o.normalizePath(r.path):r.path),o.buildURLFromParts(e)},parseURL:function(e){e=r.exec(e);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(s,"");e.length!==(e=e.replace(n,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=o},"./node_modules/webworkify-webpack/index.js":function(e,t,h){function a(i){var r={};function s(e){var t;return(r[e]||(t=r[e]={i:e,l:!1,exports:{}},i[e].call(t.exports,t,t.exports,s),t.l=!0,t)).exports}s.m=i,s.c=r,s.i=function(e){return e},s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},s.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="/",s.oe=function(e){throw console.error(e),e};var e=s(s.s=ENTRY_MODULE);return e.default||e}var p="[\\.|\\-|\\+|\\w|/|@]+",f="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function g(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}e.exports=function(u,e){var i={main:h.m},r=(e=e||{}).all?{main:Object.keys(i.main)}:function(e){for(var t={main:[u]},i={main:[]},r={main:{}};function(i){return Object.keys(i).reduce(function(e,t){return e||0<i[t].length},!1)}(t);)for(var s=Object.keys(t),a=0;a<s.length;a++){var n=s[a],o=t[n].pop();if(r[n]=r[n]||{},!r[n][o]&&e[n][o]){r[n][o]=!0,i[n]=i[n]||[],i[n].push(o);for(var l=function(e,t,i){var r={},s=(r[i]=[],t.toString());if(t=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)){for(var a,t=t[1],n=new RegExp("(\\\\n|\\W)"+g(t)+f,"g");a=n.exec(s);)"dll-reference"!==a[3]&&r[i].push(a[3]);for(n=new RegExp("\\("+g(t)+'\\("(dll-reference\\s('+p+'))"\\)\\)'+f,"g");a=n.exec(s);)e[a[2]]||(r[i].push(a[1]),e[a[2]]=h(a[1]).m),r[a[2]]=r[a[2]]||[],r[a[2]].push(a[4]);for(var o,l=Object.keys(r),c=0;c<l.length;c++)for(var d=0;d<r[l[c]].length;d++)o=r[l[c]][d],isNaN(+o)||(r[l[c]][d]=+r[l[c]][d])}return r}(e,e[n][o],n),c=Object.keys(l),d=0;d<c.length;d++)t[c[d]]=t[c[d]]||[],t[c[d]]=t[c[d]].concat(l[c[d]])}}return i}(i),s="",t=(Object.keys(r).filter(function(e){return"main"!==e}).forEach(function(t){for(var e=0;r[t][e];)e++;r[t].push(e),i[t][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",s=s+"var "+t+" = ("+a.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+r[t].map(function(e){return JSON.stringify(e)+": "+i[t][e].toString()}).join(",")+"});\n"}),s=s+"new (("+a.toString().replace("ENTRY_MODULE",JSON.stringify(u))+")({"+r.main.map(function(e){return JSON.stringify(e)+": "+i.main[e].toString()}).join(",")+"}))(self);",new window.Blob([s],{type:"text/javascript"}));return e.bare||(e=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(t),(t=new window.Worker(e)).objectURL=e),t}},"./src/config.ts":function(e,t,i){i.r(t),i.d(t,"hlsDefaultConfig",function(){return E}),i.d(t,"mergeConfig",function(){return w}),i.d(t,"enableStreamingMode",function(){return T});var t=i("./src/controller/abr-controller.ts"),r=i("./src/controller/audio-stream-controller.ts"),s=i("./src/controller/audio-track-controller.ts"),a=i("./src/controller/subtitle-stream-controller.ts"),n=i("./src/controller/subtitle-track-controller.ts"),o=i("./src/controller/buffer-controller.ts"),l=i("./src/controller/timeline-controller.ts"),c=i("./src/controller/cap-level-controller.ts"),d=i("./src/controller/fps-controller.ts"),u=i("./src/controller/eme-controller.ts"),h=i("./src/controller/cmcd-controller.ts"),p=i("./src/utils/xhr-loader.ts"),f=i("./src/utils/fetch-loader.ts"),g=i("./src/utils/cues.ts"),m=i("./src/utils/mediakeys-helper.ts"),A=i("./src/utils/logger.ts");function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}function b(t,e){var i,r=Object.keys(t);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(t),e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)),r}function v(r){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?b(Object(s),!0).forEach(function(e){var t,i;t=r,i=s[e=e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(s)):b(Object(s)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(s,e))})}return r}var E=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:p.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:t.default,bufferController:o.default,capLevelController:c.default,fpsController:d.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:m.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},{cueHandler:g.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:a.SubtitleStreamController,subtitleTrackController:n.default,timelineController:l.TimelineController,audioStreamController:r.default,audioTrackController:s.default,emeController:u.default,cmcdController:h.default});function w(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return y({},e,t)}function T(e){var t=e.loader;t!==f.default&&t!==p.default?(A.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):Object(f.fetchSupported)()&&(e.loader=f.default,e.progressive=!0,e.enableSoftwareAES=!0,A.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}},"./src/controller/abr-controller.ts":function(e,t,i){i.r(t);var A=i("./src/polyfills/number.ts"),r=i("./src/utils/ewma-bandwidth-estimator.ts"),y=i("./src/events.ts"),b=i("./src/utils/buffer-helper.ts"),s=i("./src/errors.ts"),o=i("./src/types/loader.ts"),v=i("./src/utils/logger.ts");function a(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0;e=(this.hls=e).config;this.bwEstimator=new r.default(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate),this.registerListeners()}(i=n.prototype).registerListeners=function(){var e=this.hls;e.on(y.Events.FRAG_LOADING,this.onFragLoading,this),e.on(y.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(y.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(y.Events.ERROR,this.onError,this)},i.unregisterListeners=function(){var e=this.hls;e.off(y.Events.FRAG_LOADING,this.onFragLoading,this),e.off(y.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(y.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(y.Events.ERROR,this.onError,this)},i.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},i.onFragLoading=function(e,t){var i=t.frag;i.type!==o.PlaylistLevelType.MAIN||this.timer||(this.fragCurrent=i,this.partCurrent=null!=(i=t.part)?i:null,this.timer=self.setInterval(this.onCheck,100))},i.onLevelLoaded=function(e,t){var i=this.hls.config;t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},i._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,r=i.autoLevelEnabled,s=i.config,a=i.media;if(e&&a){var n=(t||e).stats,o=(t||e).duration;if(n.aborted)v.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;else if(r&&!a.paused&&a.playbackRate&&a.readyState){var r=performance.now()-n.loading.start,l=Math.abs(a.playbackRate);if(!(r<=500*o/l)){var c=i.levels,d=i.minAutoLevel,u=c[e.level],u=n.total||Math.max(n.loaded,Math.round(o*u.maxBitrate/8)),h=Math.max(1,n.bwEstimate?n.bwEstimate/8:1e3*n.loaded/r),u=(u-n.loaded)/h,p=a.currentTime,f=(b.BufferHelper.bufferInfo(a,p,s.maxBufferHole).end-p)/l;if(!(2*o/l<=f||u<=f)){for(var g=Number.POSITIVE_INFINITY,m=e.level-1;d<m&&!((g=o*c[m].maxBitrate/(6.4*h))<f);m--);u<=g||(a=this.bwEstimator.getEstimate(),v.logger.warn("Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+m+"\n Current BW estimate: "+(Object(A.isFiniteNumber)(a)?(a/1024).toFixed(3):"Unknown")+" Kb/s\n Estimated load time for current fragment: "+u.toFixed(3)+" s\n Estimated load time for the next fragment: "+g.toFixed(3)+" s\n Time to underbuffer: "+f.toFixed(3)+" s"),i.nextLoadLevel=m,this.bwEstimator.sample(r,n.loaded),this.clearTimer(),e.loader&&(this.fragCurrent=this.partCurrent=null,e.loader.abort()),i.trigger(y.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:n}))}}}}},i.onFragLoaded=function(e,t){var i,r,s,a,n=t.frag,t=t.part;n.type===o.PlaylistLevelType.MAIN&&Object(A.isFiniteNumber)(n.sn)&&(i=(t||n).stats,s=(t||n).duration,this.clearTimer(),this.lastLoadedFragLevel=n.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate&&(r=((a=this.hls.levels[n.level]).loaded?a.loaded.bytes:0)+i.loaded,s=(a.loaded?a.loaded.duration:0)+s,a.loaded={bytes:r,duration:s},a.realBitrate=Math.round(8*r/s)),n.bitrateTest)&&(a={stats:i,frag:n,part:t,id:n.type},this.onFragBuffered(y.Events.FRAG_BUFFERED,a),n.bitrateTest=!1)},i.onFragBuffered=function(e,t){var i,r=t.frag,t=t.part,t=(t||r).stats;t.aborted||r.type!==o.PlaylistLevelType.MAIN||"initSegment"===r.sn||(i=t.parsing.end-t.loading.start,this.bwEstimator.sample(i,t.loaded),t.bwEstimate=this.bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=i/1e3:this.bitrateTestDelay=0)},i.onError=function(e,t){switch(t.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},i.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},i.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,r=i.maxAutoLevel,s=i.config,a=i.minAutoLevel,i=i.media,t=t?t.duration:e?e.duration:0,e=i?i.currentTime:0,n=i&&0!==i.playbackRate?Math.abs(i.playbackRate):1,o=this.bwEstimator?this.bwEstimator.getEstimate():s.abrEwmaDefaultEstimate,i=(b.BufferHelper.bufferInfo(i,e,s.maxBufferHole).end-e)/n,e=this.findBestLevel(o,a,r,i,s.abrBandWidthFactor,s.abrBandWidthUpFactor);if(0<=e)return e;v.logger.trace((i?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var l,n=t?Math.min(t,s.maxStarvationDelay):s.maxStarvationDelay,c=s.abrBandWidthFactor,d=s.abrBandWidthUpFactor;return i||(l=this.bitrateTestDelay)&&(n=(t?Math.min(t,s.maxLoadingDelay):s.maxLoadingDelay)-l,v.logger.trace("bitrate test took "+Math.round(1e3*l)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*n)+" ms"),c=d=1),e=this.findBestLevel(o,a,r,i+n,c,d),Math.max(e,0)},i.findBestLevel=function(e,t,i,r,s,a){for(var n,o=this.fragCurrent,l=this.partCurrent,c=this.lastLoadedFragLevel,d=this.hls.levels,u=d[c],h=!(null==u||null==(n=u.details)||!n.live),p=null==u?void 0:u.codecSet,f=l?l.duration:o?o.duration:0,g=i;t<=g;g--){var m=d[g];if(m&&(!p||m.codecSet===p)){var A,m=m.details,m=(l?null==m?void 0:m.partTarget:null==m?void 0:m.averagetargetduration)||f,y=d[g].maxBitrate,b=y*m/(A=g<=c?s*e:a*e);if(v.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+g+"/"+Math.round(A)+"/"+y+"/"+m+"/"+r+"/"+b),y<A&&(!b||h&&!this.bitrateTestDelay||b<r))return g}}return-1},a(n.prototype,[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator;return-1===e||t&&t.canEstimate()?(t=this.getNextABRAutoLevel(),-1!==e?Math.min(e,t):t):e},set:function(e){this._nextAutoLevel=e}}]),t.default=n},"./src/controller/audio-stream-controller.ts":function(e,t,i){i.r(t);var s=i("./src/polyfills/number.ts"),u=i("./src/controller/base-stream-controller.ts"),h=i("./src/events.ts"),a=i("./src/utils/buffer-helper.ts"),n=i("./src/controller/fragment-tracker.ts"),r=i("./src/types/level.ts"),d=i("./src/types/loader.ts"),p=i("./src/loader/fragment.ts"),f=i("./src/demux/chunk-cache.ts"),g=i("./src/demux/transmuxer-interface.ts"),m=i("./src/types/transmuxer.ts"),o=i("./src/controller/fragment-finders.ts"),l=i("./src/utils/discontinuities.ts"),c=i("./src/errors.ts"),A=i("./src/utils/logger.ts");function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}v=u.default,i=v,(E=w).prototype=Object.create(i.prototype),b(E.prototype.constructor=E,i),(E=w.prototype).onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var e=this.hls;e.on(h.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(h.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(h.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(h.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(h.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(h.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(h.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(h.Events.ERROR,this.onError,this),e.on(h.Events.BUFFER_RESET,this.onBufferReset,this),e.on(h.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(h.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(h.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(h.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var e=this.hls;e.off(h.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(h.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(h.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(h.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(h.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(h.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(h.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(h.Events.ERROR,this.onError,this),e.off(h.Events.BUFFER_RESET,this.onBufferReset,this),e.off(h.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(h.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(h.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(h.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onInitPtsFound=function(e,t){var i=t.frag,r=t.id,t=t.initPTS;"main"===r&&(r=i.cc,this.initPTS[i.cc]=t,this.log("InitPTS for cc: "+r+" found from main: "+t),this.videoTrackCC=r,this.state===u.State.WAITING_INIT_PTS)&&this.tick()},E.startLoad=function(e){var t;this.levels?(t=this.lastCurrentTime,this.stopLoad(),this.setInterval(100),(this.fragLoadError=0)<t&&-1===e?(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=u.State.IDLE):(this.loadedmetadata=!1,this.state=u.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()):(this.startPosition=e,this.state=u.State.STOPPED)},E.doTick=function(){switch(this.state){case u.State.IDLE:this.doTickIdle();break;case u.State.WAITING_TRACK:var e=this.levels,t=this.trackId,t=null==e||null==(e=e[t])?void 0:e.details;if(t){if(this.waitForCdnTuneIn(t))break;this.state=u.State.WAITING_INIT_PTS}break;case u.State.FRAG_LOADING_WAITING_RETRY:e=performance.now(),t=this.retryDate;(!t||t<=e||null!=(t=this.media)&&t.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=u.State.IDLE);break;case u.State.WAITING_INIT_PTS:var i,r,e=this.waitingData;e?(t=e.frag,i=e.part,r=e.cache,e=e.complete,void 0!==this.initPTS[t.cc]?(this.waitingData=null,this.waitingVideoCC=-1,this.state=u.State.FRAG_LOADING,i={frag:t,part:i,payload:r.flush(),networkDetails:null},this._handleFragmentLoadProgress(i),e&&v.prototype._handleFragmentLoadComplete.call(this,i)):this.videoTrackCC!==this.waitingVideoCC?(A.logger.log("Waiting fragment cc ("+t.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment()):(r=this.getLoadPosition(),e=a.BufferHelper.bufferInfo(this.mediaBuffer,r,this.config.maxBufferHole),Object(o.fragmentWithinToleranceTest)(e.end,this.config.maxFragLookUpTolerance,t)<0&&(A.logger.log("Waiting fragment cc ("+t.cc+") @ "+t.start+" cancelled because another fragment at "+e.end+" is needed"),this.clearWaitingFragment()))):this.state=u.State.IDLE}this.onTickEnd()},E.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=u.State.IDLE)},E.onTickEnd=function(){var e,t=this.media;t&&t.readyState&&(e=(this.mediaBuffer||t).buffered,!this.loadedmetadata&&e.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime)},E.doTickIdle=function(){var e,t,i=this.hls,r=this.levels,s=this.media,a=this.trackId,n=i.config;r&&r[a]&&(s||!this.startFragRequested&&n.startFragPrefetch)&&(!(n=r[a].details)||n.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(n)?this.state=u.State.WAITING_TRACK:(this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer||this.media,p.ElementaryStreamTypes.AUDIO,d.PlaylistLevelType.AUDIO)),null!==(r=this.getFwdBufferInfo(this.mediaBuffer||this.media,d.PlaylistLevelType.AUDIO))&&(a=r.len,e=this.getMaxBufferLength(),t=this.audioSwitch,e<=a&&!t||(!t&&this._streamEnded(r,n)?(i.trigger(h.Events.BUFFER_EOS,{type:"audio"}),this.state=u.State.ENDED):(e=n.fragments[0].start,a=r.end,t&&(a=i=this.getLoadPosition(),n.PTSKnown)&&i<e&&(r.end>e||r.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=e+.05),(t=this.getNextFragment(a,n))?"identity"!==(null==(i=t.decryptdata)?void 0:i.keyFormat)||null!=(r=t.decryptdata)&&r.key?this.loadFragment(t,n,a):this.loadKey(t,n):this.bufferFlushed=!0)))))},E.getMaxBufferLength=function(){var e=v.prototype.getMaxBufferLength.call(this),t=this.getFwdBufferInfo(this.videoBuffer||this.media,d.PlaylistLevelType.MAIN);return null===t?e:Math.max(e,t.len)},E.onMediaDetaching=function(){this.videoBuffer=null,v.prototype.onMediaDetaching.call(this)},E.onAudioTracksUpdated=function(e,t){t=t.audioTracks;this.resetTransmuxer(),this.levels=t.map(function(e){return new r.Level(e)})},E.onAudioTrackSwitching=function(e,t){var i=!!t.url,t=(this.trackId=t.id,this.fragCurrent);null!=t&&t.loader&&t.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.audioSwitch=!0,this.state=u.State.IDLE):this.state=u.State.STOPPED,this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},E.onLevelLoaded=function(e,t){this.mainDetails=t.details},E.onAudioTrackLoaded=function(e,t){var i=this.levels,r=t.details,t=t.id;if(i){this.log("Track "+t+" loaded ["+r.startSN+","+r.endSN+"],duration:"+r.totalduration);var i=i[t],s=0;if(r.live||null!=(a=i.details)&&a.live){var a=this.mainDetails;if(r.fragments[0]||(r.deltaUpdateFailed=!0),r.deltaUpdateFailed||!a)return;s=!i.details&&r.hasProgramDateTime&&a.hasProgramDateTime?(Object(l.alignMediaPlaylistByPDT)(r,a),r.fragments[0].start):this.alignPlaylists(r,i.details)}i.details=r,this.levelLastLoaded=t,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(i.details,s),this.state!==u.State.WAITING_TRACK||this.waitForCdnTuneIn(r)||(this.state=u.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+t)},E._handleFragmentLoadProgress=function(e){var t,i,r,s,a=e.frag,n=e.part,e=e.payload,o=this.config,l=this.trackId,c=this.levels;c?(c=c[l],console.assert(c,"Audio track is defined on fragment load progress"),t=c.details,console.assert(t,"Audio track details are defined on fragment load progress"),o=o.defaultAudioCodec||c.audioCodec||"mp4a.40.2",c=(c=this.transmuxer)||(this.transmuxer=new g.default(this.hls,d.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this))),i=this.initPTS[a.cc],r=null==(r=a.initSegment)?void 0:r.data,void 0!==i?(s=n?n.index:-1,s=new m.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,e.byteLength,s,-1!==s),c.push(e,r,o,"",a,n,t.totalduration,!1,s,i)):(A.logger.log("Unknown video PTS for cc "+a.cc+", waiting for video PTS before demuxing audio frag "+a.sn+" of ["+t.startSN+" ,"+t.endSN+"],track "+l),(this.waitingData=this.waitingData||{frag:a,part:n,cache:new f.default,complete:!1}).cache.push(new Uint8Array(e)),this.waitingVideoCC=this.videoTrackCC,this.state=u.State.WAITING_INIT_PTS)):this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered")},E._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:v.prototype._handleFragmentLoadComplete.call(this,e)},E.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},E.onBufferCreated=function(e,t){var i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},E.onFragBuffered=function(e,t){var i=t.frag,t=t.part;i.type===d.PlaylistLevelType.AUDIO&&(this.fragContextChanged(i)?this.warn("Fragment "+i.sn+(t?" p: "+t.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==i.sn&&(this.fragPrevious=i,this.audioSwitch)&&(this.audioSwitch=!1,this.hls.trigger(h.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.fragBufferedComplete(i,t)))},E.onError=function(e,t){switch(t.details){case c.ErrorDetails.FRAG_LOAD_ERROR:case c.ErrorDetails.FRAG_LOAD_TIMEOUT:case c.ErrorDetails.KEY_LOAD_ERROR:case c.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(d.PlaylistLevelType.AUDIO,t);break;case c.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case c.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==u.State.ERROR&&this.state!==u.State.STOPPED&&(this.state=t.fatal?u.State.ERROR:u.State.IDLE,this.warn(t.details+" while loading frag, switching to "+this.state+" state"));break;case c.ErrorDetails.BUFFER_FULL_ERROR:var i,r;"audio"!==t.parent||this.state!==u.State.PARSING&&this.state!==u.State.PARSED||(i=!0,(i=(r=this.getFwdBufferInfo(this.mediaBuffer,d.PlaylistLevelType.AUDIO))&&.5<r.len?!this.reduceMaxBufferLength(r.len):i)&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,v.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState())}},E.onBufferFlushed=function(e,t){t.type===p.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},E._handleTransmuxComplete=function(e){var t,i,r,s,a,n,o,l=this.hls,c=e.remuxResult,e=e.chunkMeta,d=this.getCurrentContext(e);d?(t=d.frag,d=d.part,i=c.audio,r=c.text,s=c.id3,c=c.initSegment,this.fragContextChanged(t)||(this.state=u.State.PARSING,this.audioSwitch&&i&&this.completeAudioSwitch(),null!=c&&c.tracks&&(this._bufferInitSegment(c.tracks,t,e),l.trigger(h.Events.FRAG_PARSING_INIT_SEGMENT,{frag:t,id:"audio",tracks:c.tracks})),i&&(c=i.startPTS,n=i.endPTS,o=i.startDTS,a=i.endDTS,d&&(d.elementaryStreams[p.ElementaryStreamTypes.AUDIO]={startPTS:c,endPTS:n,startDTS:o,endDTS:a}),t.setElementaryStreamInfo(p.ElementaryStreamTypes.AUDIO,c,n,o,a),this.bufferFragmentData(i,t,d,e)),null!=s&&null!=(c=s.samples)&&c.length&&(n=y({frag:t,id:"audio"},s),l.trigger(h.Events.FRAG_PARSING_METADATA,n)),r&&(o=y({frag:t,id:"audio"},r),l.trigger(h.Events.FRAG_PARSING_USERDATA,o)))):(this.warn("The loading context changed while buffering fragment "+e.sn+" of level "+e.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(e.level))},E._bufferInitSegment=function(e,t,i){var r;this.state===u.State.PARSING&&(e.video&&delete e.video,r=e.audio)&&(r.levelCodec=r.codec,r.id="audio",this.log("Init audio buffer, container:"+r.container+", codecs[parsed]=["+r.codec+"]"),this.hls.trigger(h.Events.BUFFER_CODECS,e),null!=(e=r.initSegment)&&e.byteLength&&(r={type:"audio",frag:t,part:null,chunkMeta:i,parent:t.type,data:e},this.hls.trigger(h.Events.BUFFER_APPENDING,r)),this.tick())},E.loadFragment=function(e,t,i){var r=this.fragmentTracker.getState(e);this.fragCurrent=e,!this.audioSwitch&&r!==n.FragmentState.NOT_LOADED&&r!==n.FragmentState.PARTIAL||("initSegment"===e.sn?this._loadInitSegment(e):t.live&&!Object(s.isFiniteNumber)(this.initPTS[e.cc])?(this.log("Waiting for video PTS in continuity counter "+e.cc+" of live stream before loading audio fragment "+e.sn+" of level "+this.trackId),this.state=u.State.WAITING_INIT_PTS):(this.startFragRequested=!0,v.prototype.loadFragment.call(this,e,t,i)))},E.completeAudioSwitch=function(){var e=this.hls,t=this.media,i=this.trackId;t&&(this.log("Switching audio track : flushing all audio"),v.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,e.trigger(h.Events.AUDIO_TRACK_SWITCHED,{id:i})};var v,E,i=w;function w(e,t){return(e=v.call(this,e,t,"[audio-stream-controller]")||this).videoBuffer=null,e.videoTrackCC=-1,e.waitingVideoCC=-1,e.audioSwitch=!1,e.trackId=-1,e.waitingData=null,e.mainDetails=null,e.bufferFlushed=!1,e._registerListeners(),e}t.default=i},"./src/controller/audio-track-controller.ts":function(e,t,i){i.r(t);var l=i("./src/events.ts"),r=i("./src/errors.ts"),s=i("./src/controller/base-playlist-controller.ts"),a=i("./src/types/loader.ts");function n(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}c=s.default,i=c,(s=d).prototype=Object.create(i.prototype),o(s.prototype.constructor=s,i),(s=d.prototype).registerListeners=function(){var e=this.hls;e.on(l.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(l.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(l.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(l.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var e=this.hls;e.off(l.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(l.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(l.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(l.Events.ERROR,this.onError,this)},s.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,c.prototype.destroy.call(this)},s.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},s.onManifestParsed=function(e,t){this.tracks=t.audioTracks||[]},s.onAudioTrackLoaded=function(e,t){var i,r=t.id,s=t.details,a=this.tracksInGroup[r];a?(i=a.details,a.details=t.details,this.log("audioTrack "+r+" loaded ["+s.startSN+"-"+s.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,i))):this.warn("Invalid audio track id "+r)},s.onLevelLoading=function(e,t){this.switchLevel(t.level)},s.onLevelSwitching=function(e,t){this.switchLevel(t.level)},s.switchLevel=function(e){var t,i,e=this.hls.levels[e];null!=e&&e.audioGroupIds&&(t=e.audioGroupIds[e.urlId],this.groupId!==t)&&(this.groupId=t,e=this.tracks.filter(function(e){return!t||e.groupId===t}),this.selectDefaultTrack&&!e.some(function(e){return e.default})&&(this.selectDefaultTrack=!1),i={audioTracks:this.tracksInGroup=e},this.log("Updating audio tracks, "+e.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(l.Events.AUDIO_TRACKS_UPDATED,i),this.selectInitialTrack())},s.onError=function(e,t){c.prototype.onError.call(this,e,t),!t.fatal&&t.context&&t.context.type===a.PlaylistContextType.AUDIO_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},s.setAudioTrack=function(e){var t,i,r,s,a,n,o=this.tracksInGroup;e<0||e>=o.length?this.warn("Invalid id passed to audio-track controller"):(this.clearTimer(),t=o[this.trackId],this.log("Now switching to audio-track index "+e),i=(o=o[e]).id,r=void 0===(r=o.groupId)?"":r,s=o.name,a=o.type,n=o.url,this.trackId=e,this.trackName=s,this.selectDefaultTrack=!1,this.hls.trigger(l.Events.AUDIO_TRACK_SWITCHING,{id:i,groupId:r,name:s,type:a,url:n}),o.details&&!o.details.live||(e=this.switchParams(o.url,null==t?void 0:t.details),this.loadPlaylist(e)))},s.selectInitialTrack=function(){var e=this.tracksInGroup,e=(console.assert(e.length,"Initial audio track should be selected when tracks are known"),this.trackName),e=this.findTrackId(e)||this.findTrackId();-1!==e?this.setAudioTrack(e):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(l.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},s.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;i<t.length;i++){var r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||e===r.name))return r.id}return-1},s.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var i=t.id,r=t.groupId,t=t.url;if(e)try{t=e.addDirectives(t)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("loading audio-track playlist for id: "+i),this.clearTimer(),this.hls.trigger(l.Events.AUDIO_TRACK_LOADING,{url:t,id:i,groupId:r,deliveryDirectives:e||null})}},n(d.prototype,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}}]);var c,i=d;function d(e){return(e=c.call(this,e,"[audio-track-controller]")||this).tracks=[],e.groupId=null,e.tracksInGroup=[],e.trackId=-1,e.trackName="",e.selectDefaultTrack=!0,e.registerListeners(),e}t.default=i},"./src/controller/base-playlist-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return a});var o=i("./src/polyfills/number.ts"),l=i("./src/types/level.ts"),f=i("./src/controller/level-helper.ts"),r=i("./src/utils/logger.ts"),s=i("./src/errors.ts"),a=((t=n.prototype).destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},t.onError=function(e,t){t.fatal&&t.type===s.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},t.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},t.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},t.stopLoad=function(){this.canLoad=!1,this.clearTimer()},t.switchParams=function(e,t){var i=null==t?void 0:t.renditionReports;if(i)for(var r=0;r<i.length;r++){var s=i[r],a=""+s.URI;if(a===e.substr(-a.length)){var n,a=parseInt(s["LAST-MSN"]),s=parseInt(s["LAST-PART"]);if(t&&this.hls.config.lowLatencyMode&&(n=Math.min(t.age-t.partTarget,t.targetduration),void 0!==s)&&n>t.partTarget&&(s+=1),Object(o.isFiniteNumber)(a))return new l.HlsUrlParameters(a,Object(o.isFiniteNumber)(s)?s:void 0,l.HlsSkip.No)}}},t.loadPlaylist=function(e){},t.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},t.playlistLoaded=function(e,t,i){var r=this,s=t.details,a=t.stats,n=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(s.advancedDateTime=Date.now()-n,s.live||null!=i&&i.live){if(s.reloaded(i),i&&this.log("live playlist "+e+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),i&&0<s.fragments.length&&Object(f.mergeDetails)(i,s),this.canLoad&&s.live){var o,n=void 0,l=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var c=this.hls.config.lowLatencyMode,d=s.lastPartSn,u=s.endSN,h=s.lastPartIndex,p=d===u,d=(-1!==h?(n=p?u+1:d,l=p?c?0:h:h+1):n=u+1,s.age),h=d+s.ageHeader,u=Math.min(h-s.partTarget,1.5*s.targetduration);if(0<u&&(i&&u>i.tuneInGoal?(this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+u+" with playlist age: "+s.age),u=0):(n+=h=Math.floor(u/s.targetduration),void 0!==l&&(l+=Math.round(u%s.targetduration/s.partTarget)),this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+d.toFixed(2)+"s goal: "+u+" skip sn "+h+" to part "+l)),s.tuneInGoal=u),o=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l),c||!p)return void this.loadPlaylist(o)}else o=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l);i=Object(f.computeReloadInterval)(s,a);void 0!==n&&s.canBlockReload&&(i-=s.partTarget||1),this.log("reload live playlist "+e+" in "+Math.round(i)+" ms"),this.timer=self.setTimeout(function(){return r.loadPlaylist(o)},i)}}else this.clearTimer()},t.getDeliveryDirectives=function(e,t,i,r){var s=Object(l.getSkipValue)(e,i);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,s=l.HlsSkip.No),new l.HlsUrlParameters(i,r,s)},t.retryLoadingOrFail=function(e){var t,i=this,r=this.hls.config,s=this.retryCount<r.levelLoadingMaxRetry;return s?(this.retryCount++,-1<e.details.indexOf("LoadTimeOut")&&null!=(t=e.context)&&t.deliveryDirectives?(this.warn("retry playlist loading #"+this.retryCount+' after "'+e.details+'"'),this.loadPlaylist()):(t=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout),this.timer=self.setTimeout(function(){return i.loadPlaylist()},t),this.warn("retry playlist loading #"+this.retryCount+" in "+t+' ms after "'+e.details+'"'))):(this.warn('cannot recover from error "'+e.details+'"'),this.clearTimer(),e.fatal=!0),s},n);function n(e,t){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=r.logger.log.bind(r.logger,t+":"),this.warn=r.logger.warn.bind(r.logger,t+":"),this.hls=e}},"./src/controller/base-stream-controller.ts":function(e,t,i){i.r(t),i.d(t,"State",function(){return E}),i.d(t,"default",function(){return w});var l=i("./src/polyfills/number.ts"),t=i("./src/task-loop.ts"),u=i("./src/controller/fragment-tracker.ts"),n=i("./src/utils/buffer-helper.ts"),s=i("./src/utils/logger.ts"),h=i("./src/events.ts"),r=i("./src/errors.ts"),a=i("./src/types/transmuxer.ts"),o=i("./src/utils/mp4-tools.ts"),c=i("./src/utils/discontinuities.ts"),p=i("./src/controller/fragment-finders.ts"),d=i("./src/controller/level-helper.ts"),f=i("./src/loader/fragment-loader.ts"),g=i("./src/crypt/decrypter.ts"),m=i("./src/utils/time-ranges.ts"),A=i("./src/types/loader.ts");function y(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var v,E={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},w=(v=t.default,i=v,(t=T).prototype=Object.create(i.prototype),b(t.prototype.constructor=t,i),(t=T.prototype).doTick=function(){this.onTickEnd()},t.onTickEnd=function(){},t.startLoad=function(e){},t.stopLoad=function(){this.fragmentLoader.abort();var e=this.fragCurrent;e&&this.fragmentTracker.removeFragment(e),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=E.STOPPED},t._streamEnded=function(e,t){var i=this.fragCurrent,r=this.fragmentTracker;return!(!(!t.live&&i&&i.sn>=t.endSN)||e.nextStart)&&(null!=(e=t.partList)&&e.length?(t=e[e.length-1],n.BufferHelper.isBuffered(this.media,t.start+t.duration/2)):(e=r.getState(i))===u.FragmentState.PARTIAL||e===u.FragmentState.OK)},t.onMediaAttached=function(e,t){t=this.media=this.mediaBuffer=t.media,this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended),t=this.config;this.levels&&t.autoStartLoad&&this.state===E.STOPPED&&this.startLoad(t.startPosition)},t.onMediaDetaching=function(){var e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},t.onMediaSeeking=function(){var e=this.config,t=this.fragCurrent,i=this.media,r=this.mediaBuffer,s=this.state,a=i?i.currentTime:0,r=n.BufferHelper.bufferInfo(r||i,a,e.maxBufferHole);this.log("media seeking to "+(Object(l.isFiniteNumber)(a)?a.toFixed(3):a)+", state: "+s),s===E.ENDED?this.resetLoadingState():t&&!r.len&&(s=e.maxFragLookUpTolerance,e=t.start-s,s=a>t.start+t.duration+s,a<e||s)&&(s&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.loader.abort()),this.resetLoadingState()),i&&(this.lastCurrentTime=a),this.loadedmetadata||r.len||(this.nextLoadPosition=this.startPosition=a),this.tickImmediate()},t.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},t.onKeyLoaded=function(e,t){var i;this.state===E.KEY_LOADING&&t.frag===this.fragCurrent&&this.levels&&(this.state=E.IDLE,i=this.levels[t.frag.level].details)&&this.loadFragment(t.frag,i,t.frag.start)},t.onHandlerDestroying=function(){this.stopLoad(),v.prototype.onHandlerDestroying.call(this)},t.onHandlerDestroyed=function(){this.state=E.STOPPED,this.hls.off(h.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,v.prototype.onHandlerDestroyed.call(this)},t.loadKey=function(e,t){this.log("Loading key for "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level),this.state=E.KEY_LOADING,this.fragCurrent=e,this.hls.trigger(h.Events.KEY_LOADING,{frag:e})},t.loadFragment=function(e,t,i){this._loadFragForPlayback(e,t,i)},t._loadFragForPlayback=function(i,e,t){var r=this;this._doFragLoad(i,e,t,function(e){r.fragContextChanged(i)?(r.warn("Fragment "+i.sn+(e.part?" p: "+e.part.index:"")+" of level "+i.level+" was dropped during download."),r.fragmentTracker.removeFragment(i)):(i.stats.chunkCount++,r._handleFragmentLoadProgress(e))}).then(function(e){if(e){r.fragLoadError=0;var t=r.state;if(!r.fragContextChanged(i))return"payload"in e&&(r.log("Loaded fragment "+i.sn+" of level "+i.level),r.hls.trigger(h.Events.FRAG_LOADED,e),r.state===E.BACKTRACKING)?(r.fragmentTracker.backtrack(i,e),void r.resetFragmentLoading(i)):void r._handleFragmentLoadComplete(e);t!==E.FRAG_LOADING&&t!==E.BACKTRACKING&&(r.fragCurrent||t!==E.PARSING)||(r.fragmentTracker.removeFragment(i),r.state=E.IDLE)}}).catch(function(e){r.warn(e),r.resetFragmentLoading(i)})},t.flushMainBuffer=function(e,t,i){void 0===i&&(i=null),e-t&&(e={startOffset:e,endOffset:t,type:i},this.fragLoadError=0,this.hls.trigger(h.Events.BUFFER_FLUSHING,e))},t._loadInitSegment=function(a){var n=this;this._doFragLoad(a).then(function(e){if(e&&!n.fragContextChanged(a)&&n.levels)return e;throw new Error("init load aborted")}).then(function(i){var r,s=n.hls,e=i.payload,t=a.decryptdata;return e&&0<e.byteLength&&t&&t.key&&t.iv&&"AES-128"===t.method?(r=self.performance.now(),n.decrypter.webCryptoDecrypt(new Uint8Array(e),t.key.buffer,t.iv.buffer).then(function(e){var t=self.performance.now();return s.trigger(h.Events.FRAG_DECRYPTED,{frag:a,payload:e,stats:{tstart:r,tdecrypt:t}}),i.payload=e,i})):i}).then(function(e){var t=n.fragCurrent,i=n.hls,r=n.levels;if(!r)throw new Error("init load aborted, missing levels");r=r[a.level].details,console.assert(r,"Level details are defined when init segment is loaded"),r=a.stats;n.state=E.IDLE,n.fragLoadError=0,a.data=new Uint8Array(e.payload),r.parsing.start=r.buffering.start=self.performance.now(),r.parsing.end=r.buffering.end=self.performance.now(),e.frag===t&&i.trigger(h.Events.FRAG_BUFFERED,{stats:r,frag:t,part:null,id:a.type}),n.tick()}).catch(function(e){n.warn(e),n.resetFragmentLoading(a)})},t.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId},t.fragBufferedComplete=function(e,t){var i=this.mediaBuffer||this.media;this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level+" "+m.default.toString(n.BufferHelper.getBuffered(i))),this.state=E.IDLE,this.tick()},t._handleFragmentLoadComplete=function(e){var t,i,r=this.transmuxer;r&&(i=e.frag,t=e.part,e=!(e=e.partsLoaded)||0===e.length||e.some(function(e){return!e}),i=new a.ChunkMetadata(i.level,i.sn,i.stats.chunkCount+1,0,t?t.index:-1,!e),r.flush(i))},t._handleFragmentLoadProgress=function(e){},t._doFragLoad=function(e,t,i,r){var s=this;if(void 0===i&&(i=null),!this.levels)throw new Error("frag load aborted, missing levels");if(i=Math.max(e.start,i||0),this.config.lowLatencyMode&&t){var a=t.partList;if(a&&r){i>e.end&&t.fragmentHint&&(e=t.fragmentHint);var n,o=this.getNextPart(a,e,i);if(-1<o)return n=a[o],this.log("Loading part sn: "+e.sn+" p: "+n.index+" cc: "+e.cc+" of playlist ["+t.startSN+"-"+t.endSN+"] parts [0-"+o+"-"+(a.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(i.toFixed(3))),this.nextLoadPosition=n.start+n.duration,this.state=E.FRAG_LOADING,this.hls.trigger(h.Events.FRAG_LOADING,{frag:e,part:a[o],targetBufferTime:i}),this.doFragPartsLoad(e,a,o,r).catch(function(e){return s.handleFragLoadError(e)});if(!e.url||this.loadedEndOfParts(a,i))return Promise.resolve(null)}}return this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(t?"of ["+t.startSN+"-"+t.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(i.toFixed(3))),Object(l.isFiniteNumber)(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=E.FRAG_LOADING,this.hls.trigger(h.Events.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragmentLoader.load(e,r).catch(function(e){return s.handleFragLoadError(e)})},t.doFragPartsLoad=function(o,l,t,c){var d=this;return new Promise(function(a,e){var n=[];!function i(r){var s=l[r];d.fragmentLoader.loadPart(o,s,c).then(function(e){var t=(n[s.index]=e).part,e=(d.hls.trigger(h.Events.FRAG_LOADED,e),l[r+1]);if(!e||e.fragment!==o)return a({frag:o,part:t,partsLoaded:n});i(r+1)}).catch(e)}(t)})},t.handleFragLoadError=function(e){e=e.data;return e&&e.details===r.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(h.Events.ERROR,e),null},t._handleTransmuxerFlush=function(e){var t,i,r,s=this.getCurrentContext(e);s&&this.state===E.PARSING?(t=s.frag,i=s.part,s=s.level,r=self.performance.now(),t.stats.parsing.end=r,i&&(i.stats.parsing.end=r),this.updateLevelTiming(t,i,s,e.partial)):this.fragCurrent||(this.state=E.IDLE)},t.getCurrentContext=function(e){var t,i=this.levels,r=e.level,s=e.sn,e=e.part;return i&&i[r]?(i=i[r],(t=(e=-1<e?Object(d.getPartWith)(i,s,e):null)?e.fragment:Object(d.getFragmentWithSN)(i,s,this.fragCurrent))?{frag:t,part:e,level:i}:null):(this.warn("Levels object was unset while buffering fragment "+s+" of level "+r+". The current chunk will not be buffered."),null)},t.bufferFragmentData=function(e,t,i,r){var s,a,n;e&&this.state===E.PARSING&&(n=e.data1,s=e.data2,a=(a=n)&&s?Object(o.appendUint8Array)(n,s):a)&&a.length&&(n={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:a},this.hls.trigger(h.Events.BUFFER_APPENDING,n),e.dropped)&&e.independent&&!i&&this.flushBufferGap(t)},t.flushBufferGap=function(e){var t,i,r=this.media;r&&(n.BufferHelper.isBuffered(r,r.currentTime)?(t=r.currentTime,r=n.BufferHelper.bufferInfo(r,t,0),i=e.duration,i=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),r=Math.max(Math.min(e.start-i,r.end-i),t+i),e.start-r>i&&this.flushMainBuffer(r,e.start)):this.flushMainBuffer(0,e.start))},t.getFwdBufferInfo=function(e,t){var i=this.config,r=this.getLoadPosition();if(!Object(l.isFiniteNumber)(r))return null;var s=n.BufferHelper.bufferInfo(e,r,i.maxBufferHole);if(0===s.len&&void 0!==s.nextStart){t=this.fragmentTracker.getBufferedFrag(r,t);if(t&&s.nextStart<t.end)return n.BufferHelper.bufferInfo(e,r,Math.max(s.nextStart,i.maxBufferHole))}return s},t.getMaxBufferLength=function(e){var t=this.config,e=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength;return Math.min(e,t.maxMaxBufferLength)},t.reduceMaxBufferLength=function(e){var t=this.config,e=e||t.maxBufferLength;return t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},t.getNextFragment=function(e,t){var i=t.fragments,r=i.length;if(!r)return null;var s,a=this.config,n=i[0].start;if(t.live){var o=a.initialLiveManifestSize;if(r<o)return this.warn("Not enough fragments to start playback (have: "+r+", need: "+o+")"),null;t.PTSKnown||this.startFragRequested||-1!==this.startPosition||(s=this.getInitialLiveFragment(t,i),this.startPosition=s?this.hls.liveSyncPosition||s.start:e)}else e<=n&&(s=i[0]);return s||(r=a.lowLatencyMode?t.partEnd:t.fragmentEnd,s=this.getFragmentAtPosition(e,r,t)),s=null==(o=s)||!o.initSegment||null!=(n=s)&&n.initSegment.data||this.bitrateTest?s:s.initSegment},t.getNextPart=function(e,t,i){for(var r=-1,s=!1,a=!0,n=0,o=e.length;n<o;n++){var l=e[n],a=a&&!l.independent;if(-1<r&&i<l.start)break;var c=l.loaded;!c&&(s||l.independent||a)&&l.fragment===t&&(r=n),s=c}return r},t.loadedEndOfParts=function(e,t){e=e[e.length-1];return e&&t>e.start&&e.loaded},t.getInitialLiveFragment=function(e,t){var i,r=this.fragPrevious,s=null;return r?(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),s=Object(p.findFragmentByPDT)(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),s||((i=r.sn+1)>=e.startSN&&i<=e.endSN&&(i=t[i-e.startSN],r.cc===i.cc)&&this.log("Live playlist, switching playlist, load frag with next SN: "+(s=i).sn),s)||(s=Object(p.findFragWithCC)(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+s.sn)):null!==(i=this.hls.liveSyncPosition)&&(s=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e)),s},t.getFragmentAtPosition=function(e,t,i){var r,s=this.config,a=this.fragPrevious,n=i.fragments,o=i.endSN,l=i.fragmentHint,c=s.maxFragLookUpTolerance,s=!!(s.lowLatencyMode&&i.partList&&l);if(s&&l&&!this.bitrateTest&&(n=n.concat(l),o=l.sn),r=e<t?(l=t-c<e?0:c,Object(p.findFragmentByPTS)(a,n,e,l)):n[n.length-1]){t=r.sn-i.startSN,c=a&&r.level===a.level,e=n[1+t];if(this.fragmentTracker.getState(r)===u.FragmentState.BACKTRACKED){r=null;for(var d=t;n[d]&&this.fragmentTracker.getState(n[d])===u.FragmentState.BACKTRACKED;)r=a?n[d--]:n[--d];r=r||e}else a&&r.sn===a.sn&&!s&&c&&(r=r.sn<o&&this.fragmentTracker.getState(e)!==u.FragmentState.OK?(this.log("SN "+r.sn+" just loaded, load next one: "+e.sn),e):null)}return r},t.synchronizeToLiveEdge=function(e){var t,i,r,s,a=this.config,n=this.media;n&&(t=this.hls.liveSyncPosition,i=n.currentTime,s=e.fragments[0].start,r=e.edge,s=i>=s-a.maxFragLookUpTolerance&&i<=r,null!==t)&&n.duration>t&&(i<t||!s)&&(a=void 0!==a.liveMaxLatencyDuration?a.liveMaxLatencyDuration:a.liveMaxLatencyDurationCount*e.targetduration,!s&&n.readyState<4||i<r-a)&&(this.loadedmetadata||(this.nextLoadPosition=t),n.readyState)&&(this.warn("Playback: "+i.toFixed(3)+" is located too far from the end of live sliding playlist: "+r+", reset currentTime to : "+t.toFixed(3)),n.currentTime=t)},t.alignPlaylists=function(e,t){var i,r,s,a=this.levels,n=this.levelLastLoaded,o=this.fragPrevious,a=null!==n?a[n]:null,n=e.fragments.length;return n?(i=e.fragments[0].start,s=!t,r=e.alignedSliding&&Object(l.isFiniteNumber)(i),s||!r&&!i?(Object(c.alignStream)(o,a,e),s=e.fragments[0].start,this.log("Live playlist sliding: "+s.toFixed(2)+" start-sn: "+(t?t.startSN:"na")+"->"+e.startSN+" prev-sn: "+(o?o.sn:"na")+" fragments: "+n),s):i):(this.warn("No fragments in live playlist"),0)},t.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},t.setStartPosition=function(e,t){var i,r=this.startPosition;-1!==(r=r<t?-1:r)&&-1!==this.lastCurrentTime||(i=e.startTimeOffset,Object(l.isFiniteNumber)(i)?(r=t+i,i<0&&(r+=e.totalduration),r=Math.min(Math.max(t,r),t+e.totalduration),this.log("Start time offset "+i+" found in playlist, adjust startPosition to "+r),this.startPosition=r):e.live?r=this.hls.liveSyncPosition||t:this.startPosition=r=0,this.lastCurrentTime=r),this.nextLoadPosition=r},t.getLoadPosition=function(){var e=this.media,t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t},t.handleFragLoadAborted=function(e,t){this.transmuxer&&"initSegment"!==e.sn&&e.stats.aborted&&(this.warn("Fragment "+e.sn+(t?" part"+t.index:"")+" of level "+e.level+" was aborted"),this.resetFragmentLoading(e))},t.resetFragmentLoading=function(e){this.fragCurrent&&this.fragContextChanged(e)||(this.state=E.IDLE)},t.onFragmentOrKeyLoadError=function(e,t){var i,r;t.fatal||(i=t.frag)&&i.type===e&&(r=this.fragCurrent,console.assert(r&&i.sn===r.sn&&i.level===r.level&&i.urlId===r.urlId,"Frag load error must match current frag to retry"),r=this.config,this.fragLoadError+1<=r.fragLoadingMaxRetry?this.resetLiveStartWhenNotLoaded(i.level)||(r=Math.min(Math.pow(2,this.fragLoadError)*r.fragLoadingRetryDelay,r.fragLoadingMaxRetryTimeout),this.warn("Fragment "+i.sn+" of "+e+" "+i.level+" failed to load, retrying in "+r+"ms"),this.retryDate=self.performance.now()+r,this.fragLoadError++,this.state=E.FRAG_LOADING_WAITING_RETRY):t.levelRetry?(e===A.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=E.IDLE):(s.logger.error(t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.hls.stopLoad(),this.state=E.ERROR))},t.afterBufferFlushed=function(e,t,i){e&&(e=n.BufferHelper.getBuffered(e),this.fragmentTracker.detectEvictedFragments(t,e,i),this.state===E.ENDED)&&this.resetLoadingState()},t.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=E.IDLE},t.resetLiveStartWhenNotLoaded=function(e){if(!this.loadedmetadata){this.startFragRequested=!1;e=this.levels?this.levels[e].details:null;if(null!=e&&e.live)return this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},t.updateLevelTiming=function(s,e,a,n){var o=this,l=a.details;console.assert(!!l,"level.details must be defined"),Object.keys(s.elementaryStreams).reduce(function(e,t){var i,r=s.elementaryStreams[t];return r?(i=r.endPTS-r.startPTS)<=0?(o.warn("Could not parse fragment "+s.sn+" "+t+" duration reliably ("+i+") resetting transmuxer to fallback to playlist timing"),o.resetTransmuxer(),e||!1):(i=n?0:Object(d.updateFragPTSDTS)(l,s,r.startPTS,r.endPTS,r.startDTS,r.endDTS),o.hls.trigger(h.Events.LEVEL_PTS_UPDATED,{details:l,level:a,drift:i,type:t,frag:s,start:r.startPTS,end:r.endPTS}),!0):e},!1)?(this.state=E.PARSED,this.hls.trigger(h.Events.FRAG_PARSED,{frag:s,part:e})):this.resetLoadingState()},t.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},y(T.prototype,[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}]),T);function T(e,t,i){var r;return(r=v.call(this)||this).hls=void 0,r.fragPrevious=null,r.fragCurrent=null,r.fragmentTracker=void 0,r.transmuxer=null,r._state=E.STOPPED,r.media=void 0,r.mediaBuffer=void 0,r.config=void 0,r.bitrateTest=!1,r.lastCurrentTime=0,r.nextLoadPosition=0,r.startPosition=0,r.loadedmetadata=!1,r.fragLoadError=0,r.retryDate=0,r.levels=null,r.fragmentLoader=void 0,r.levelLastLoaded=null,r.startFragRequested=!1,r.decrypter=void 0,r.initPTS=[],r.onvseeking=null,r.onvended=null,r.logPrefix="",r.log=void 0,r.warn=void 0,r.logPrefix=i,r.log=s.logger.log.bind(s.logger,i+":"),r.warn=s.logger.warn.bind(s.logger,i+":"),r.hls=e,r.fragmentLoader=new f.default(e.config),r.fragmentTracker=t,r.config=e.config,r.decrypter=new g.default(e,e.config),e.on(h.Events.KEY_LOADED,r.onKeyLoaded,function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r}},"./src/controller/buffer-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return a});var l=i("./src/polyfills/number.ts"),g=i("./src/events.ts"),m=i("./src/utils/logger.ts"),A=i("./src/errors.ts"),y=i("./src/utils/buffer-helper.ts"),t=i("./src/utils/mediasource-helper.ts"),n=i("./src/loader/fragment.ts"),r=i("./src/controller/buffer-operation-queue.ts"),s=Object(t.getMediaSource)(),c=/([ha]vc.)(?:\.[^.,]+)+/,a=((i=o.prototype).hasSourceTypes=function(){return 0<this.getSourceBufferTypes().length||0<Object.keys(this.pendingTracks).length},i.destroy=function(){this.unregisterListeners(),this.details=null},i.registerListeners=function(){var e=this.hls;e.on(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.Events.BUFFER_RESET,this.onBufferReset,this),e.on(g.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.Events.BUFFER_EOS,this.onBufferEos,this),e.on(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.Events.FRAG_PARSED,this.onFragParsed,this),e.on(g.Events.FRAG_CHANGED,this.onFragChanged,this)},i.unregisterListeners=function(){var e=this.hls;e.off(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.Events.BUFFER_RESET,this.onBufferReset,this),e.off(g.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.Events.BUFFER_EOS,this.onBufferEos,this),e.off(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.Events.FRAG_PARSED,this.onFragParsed,this),e.off(g.Events.FRAG_CHANGED,this.onFragChanged,this)},i._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new r.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},i.onManifestParsed=function(e,t){var i=2;(!t.audio||t.video)&&t.altAudio||(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,m.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},i.onMediaAttaching=function(e,t){var i,t=this.media=t.media;t&&s&&((i=this.mediaSource=new s).addEventListener("sourceopen",this._onMediaSourceOpen),i.addEventListener("sourceended",this._onMediaSourceEnded),i.addEventListener("sourceclose",this._onMediaSourceClose),t.src=self.URL.createObjectURL(i),this._objectUrl=t.src)},i.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(m.logger.log("[buffer-controller]: media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){m.logger.warn("[buffer-controller]: onMediaDetaching: "+e.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):m.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(g.Events.MEDIA_DETACHED,void 0)},i.onBufferReset=function(){var i=this;this.getSourceBufferTypes().forEach(function(t){var e=i.sourceBuffer[t];try{e&&(i.removeBufferListeners(t),i.mediaSource&&i.mediaSource.removeSourceBuffer(e),i.sourceBuffer[t]=void 0)}catch(e){m.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",e)}}),this._initSourceBuffer()},i.onBufferCodecs=function(e,a){var n=this,o=this.getSourceBufferTypes().length;Object.keys(a).forEach(function(e){var t,i,r,s;o?(t=n.tracks[e])&&"function"==typeof t.buffer.changeType&&(i=(s=a[e]).codec,r=s.levelCodec,s=s.container,(t.levelCodec||t.codec).replace(c,"$1")!==(r||i).replace(c,"$1"))&&n.appendChangeType(e,s+";codecs="+(r||i)):n.pendingTracks[e]=a[e]}),o||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},i.appendChangeType=function(t,i){var r=this,s=this.operationQueue;s.append({execute:function(){var e=r.sourceBuffer[t];e&&(m.logger.log("[buffer-controller]: changing "+t+" sourceBuffer type to "+i),e.changeType(i)),s.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(e){m.logger.warn("[buffer-controller]: Failed to change "+t+" SourceBuffer type",e)}},t)},i.onBufferAppending=function(e,t){var s=this,i=this.hls,r=this.operationQueue,a=this.tracks,n=t.data,o=t.type,l=t.frag,c=t.part,d=t.chunkMeta,u=d.buffering[o],t=self.performance.now(),h=(u.start=t,l.stats.buffering),p=c?c.stats.buffering:null,t=(0===h.start&&(h.start=t),p&&0===p.start&&(p.start=t),a.audio),f="audio"===o&&1===d.id&&"audio/mpeg"===(null==t?void 0:t.container);r.append({execute:function(){var e,t;u.executeStart=self.performance.now(),f&&(e=s.sourceBuffer[o])&&(t=l.start-e.timestampOffset,.1<=Math.abs(t))&&(m.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+l.start+" (delta: "+t+") sn: "+l.sn+")"),e.timestampOffset=l.start),s.appendExecutor(n,o)},onStart:function(){},onComplete:function(){var e,t=self.performance.now(),i=(u.executeEnd=u.end=t,0===h.first&&(h.first=t),p&&0===p.first&&(p.first=t),s.sourceBuffer),r={};for(e in i)r[e]=y.BufferHelper.getBuffered(i[e]);s.appendError=0,s.hls.trigger(g.Events.BUFFER_APPENDED,{type:o,frag:l,part:c,chunkMeta:d,parent:l.type,timeRanges:r})},onError:function(e){m.logger.error("[buffer-controller]: Error encountered while trying to append to the "+o+" SourceBuffer",e);var t={type:A.ErrorTypes.MEDIA_ERROR,parent:l.type,details:A.ErrorDetails.BUFFER_APPEND_ERROR,err:e,fatal:!1};e.code===DOMException.QUOTA_EXCEEDED_ERR?t.details=A.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,t.details=A.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>i.config.appendErrorMaxRetry&&(m.logger.error("[buffer-controller]: Failed "+i.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),i.trigger(g.Events.ERROR,t)}},o)},i.onBufferFlushing=function(e,i){function t(t){return{execute:r.removeExecutor.bind(r,t,i.startOffset,i.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(g.Events.BUFFER_FLUSHED,{type:t})},onError:function(e){m.logger.warn("[buffer-controller]: Failed to remove from "+t+" SourceBuffer",e)}}}var r=this,s=this.operationQueue;i.type?s.append(t(i.type),i.type):this.getSourceBufferTypes().forEach(function(e){s.append(t(e),e)})},i.onFragParsed=function(e,t){var i=this,r=t.frag,s=t.part,t=[],a=(s||r).elementaryStreams;a[n.ElementaryStreamTypes.AUDIOVIDEO]?t.push("audiovideo"):(a[n.ElementaryStreamTypes.AUDIO]&&t.push("audio"),a[n.ElementaryStreamTypes.VIDEO]&&t.push("video")),0===t.length&&m.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers(function(){var e=self.performance.now(),e=(r.stats.buffering.end=e,s&&(s.stats.buffering.end=e),(s||r).stats);i.hls.trigger(g.Events.FRAG_BUFFERED,{frag:r,part:s,stats:e,id:r.type})},t)},i.onFragChanged=function(e,t){this.flushBackBuffer()},i.onBufferEos=function(e,r){var s=this;this.getSourceBufferTypes().reduce(function(e,t){var i=s.sourceBuffer[t];return r.type&&r.type!==t||i&&!i.ended&&(i.ended=!0,m.logger.log("[buffer-controller]: "+t+" sourceBuffer now EOS")),e&&!(i&&!i.ended)},!0)&&this.blockBuffers(function(){var e=s.mediaSource;e&&"open"===e.readyState&&e.endOfStream()})},i.onLevelUpdated=function(e,t){t=t.details;t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},i.flushBackBuffer=function(){var e,t,i,r,s=this.hls,a=this.details,n=this.media,o=this.sourceBuffer;n&&null!==a&&(e=this.getSourceBufferTypes()).length&&(i=a.live&&null!==s.config.liveBackBufferLength?s.config.liveBackBufferLength:s.config.backBufferLength,!Object(l.isFiniteNumber)(i)||i<0||(n=n.currentTime,t=a.levelTargetDuration,i=Math.max(i,t),r=Math.floor(n/t)*t-i,e.forEach(function(e){var t=o[e];t&&0<(t=y.BufferHelper.getBuffered(t)).length&&r>t.start(0)&&(s.trigger(g.Events.BACK_BUFFER_REACHED,{bufferEnd:r}),a.live&&s.trigger(g.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r}),s.trigger(g.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:e}))})))},i.updateMediaElementDuration=function(){var e,t,i,r,s,a;this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState&&(e=this.details,t=this.hls,s=this.media,i=this.mediaSource,r=e.fragments[0].start+e.totalduration,s=s.duration,a=Object(l.isFiniteNumber)(i.duration)?i.duration:0,e.live&&t.config.liveDurationInfinity?(m.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(e)):(a<r&&s<r||!Object(l.isFiniteNumber)(s))&&(m.logger.log("[buffer-controller]: Updating Media Source duration to "+r.toFixed(3)),i.duration=r))},i.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;i.length&&e.live&&null!=t&&t.setLiveSeekableRange&&(i=Math.max(0,i[0].start),e=Math.max(i,i+e.totalduration),t.setLiveSeekableRange(i,e))},i.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,r=Object.keys(i).length;(r&&!e||2===r)&&(this.createSourceBuffers(i),this.pendingTracks={},0===(e=this.getSourceBufferTypes()).length?this.hls.trigger(g.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"}):e.forEach(function(e){t.executeNext(e)}))},i.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var r,s=0;for(r in e)if(!t[r]){var a=e[r];if(!a)throw Error("source buffer exists for track "+r+", however track does not");var n=a.levelCodec||a.codec,o=a.container+";codecs="+n;m.logger.log("[buffer-controller]: creating sourceBuffer("+o+")");try{var l=t[r]=i.addSourceBuffer(o),c=r;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[r]={buffer:l,codec:n,container:a.container,levelCodec:a.levelCodec,id:a.id},s++}catch(e){m.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+e.message),this.hls.trigger(g.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:o})}}s&&this.hls.trigger(g.Events.BUFFER_CREATED,{tracks:this.tracks})},i._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},i._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},i._onSBUpdateError=function(e,t){m.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(g.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});e=this.operationQueue.current(e);e&&e.onError(t)},i.removeExecutor=function(e,t,i){var r=this.media,s=this.mediaSource,a=this.operationQueue,n=this.sourceBuffer[e];r&&s&&n?(r=Object(l.isFiniteNumber)(r.duration)?r.duration:1/0,s=Object(l.isFiniteNumber)(s.duration)?s.duration:1/0,(t=Math.max(0,t))<(i=Math.min(i,r,s))?(m.logger.log("[buffer-controller]: Removing ["+t+","+i+"] from the "+e+" SourceBuffer"),console.assert(!n.updating,e+" sourceBuffer must not be updating"),n.remove(t,i)):a.shiftAndExecuteNext(e)):(m.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),a.shiftAndExecuteNext(e))},i.appendExecutor=function(e,t){var i=this.operationQueue,r=this.sourceBuffer[t];r?(r.ended=!1,console.assert(!r.updating,t+" sourceBuffer must not be updating"),r.appendBuffer(e)):(m.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),i.shiftAndExecuteNext(t))},i.blockBuffers=function(e,t){var i,r,s=this;(t=void 0===t?this.getSourceBufferTypes():t).length?(i=this.operationQueue,r=t.map(function(e){return i.appendBlocker(e)}),Promise.all(r).then(function(){e(),t.forEach(function(e){var t=s.sourceBuffer[e];t&&t.updating||i.shiftAndExecuteNext(e)})})):(m.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(e))},i.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},i.addBufferListener=function(e,t,i){var r=this.sourceBuffer[e];r&&(i=i.bind(this,e),this.listeners[e].push({event:t,listener:i}),r.addEventListener(t,i))},i.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach(function(e){t.removeEventListener(e.event,e.listener)})},o);function o(e){var r=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var e=r.hls,t=r.media,i=r.mediaSource;m.logger.log("[buffer-controller]: Media source opened"),t&&(r.updateMediaElementDuration(),e.trigger(g.Events.MEDIA_ATTACHED,{media:t})),i&&i.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},this._onMediaSourceClose=function(){m.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){m.logger.log("[buffer-controller]: Media source ended")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}},"./src/controller/buffer-operation-queue.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r});var a=i("./src/utils/logger.ts"),r=((t=s.prototype).append=function(e,t){var i=this.queues[t];i.push(e),1===i.length&&this.buffers[t]&&this.executeNext(t)},t.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},t.appendBlocker=function(e){var t,i=new Promise(function(e){t=e}),r={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(r,e),i},t.executeNext=function(e){var t=this.buffers,i=this.queues,r=t[e],i=i[e];if(i.length){var s=i[0];try{s.execute()}catch(t){a.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),s.onError(t),r&&r.updating||(i.shift(),this.executeNext(e))}}},t.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},t.current=function(e){return this.queues[e][0]},s);function s(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}},"./src/controller/cap-level-controller.ts":function(e,t,i){i.r(t);var r=i("./src/events.ts");function s(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i=n.prototype).setStreamController=function(e){this.streamController=e},i.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},i.registerListeners=function(){var e=this.hls;e.on(r.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},i.unregisterListener=function(){var e=this.hls;e.off(r.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},i.onFpsDropLevelCapping=function(e,t){n.isLevelAllowed(t.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(t.droppedLevel)},i.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null},i.onManifestParsed=function(e,t){var i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()},i.onBufferCodecs=function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()},i.onMediaDetaching=function(){this.stopCapping()},i.detectPlayerSize=function(){var e,t;this.media&&0<this.mediaHeight&&0<this.mediaWidth&&(e=this.hls.levels).length&&((t=this.hls).autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping)},i.getMaxLevel=function(i){var r=this,e=this.hls.levels;return e.length?(e=e.filter(function(e,t){return n.isLevelAllowed(t,r.restrictedLevels)&&t<=i}),this.clientRect=null,n.getMaxLevelByMediaSize(e,this.mediaWidth,this.mediaHeight)):-1},i.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},i.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},i.getDimensions=function(){var e,t,i;return this.clientRect||(t={width:0,height:0},(e=this.media)&&(i=e.getBoundingClientRect(),t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)),this.clientRect=t)},n.isLevelAllowed=function(e,t){return-1===(t=void 0===t?[]:t).indexOf(e)},n.getMaxLevelByMediaSize=function(e,t,i){if(!e||!e.length)return-1;for(var r,s=e.length-1,a=0;a<e.length;a+=1){var n=e[a];if((n.width>=t||n.height>=i)&&(!(r=e[a+1])||n.width!==r.width||n.height!==r.height)){s=a;break}}return s},i=[{key:"contentScaleFactor",get:function(){var e=1;try{e=self.devicePixelRatio}catch(e){}return e}}],s((a=n).prototype,[{key:"mediaWidth",get:function(){return this.getDimensions().width*n.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*n.contentScaleFactor}}]),s(a,i);var a=n;function n(e){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}t.default=a},"./src/controller/cmcd-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return h});var r=i("./src/events.ts"),n=i("./src/types/cmcd.ts"),s=i("./src/utils/buffer-helper.ts"),o=i("./src/utils/logger.ts");function a(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,i){t&&a(e.prototype,t),i&&a(e,i)}function d(e,t){var i,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e){var t;if(e)return"string"==typeof e?c(e,void 0):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,void 0):void 0}(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),i=0,function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}(t=p.prototype).registerListeners=function(){var e=this.hls;e.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(r.Events.BUFFER_CREATED,this.onBufferCreated,this)},t.unregisterListeners=function(){var e=this.hls;e.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(r.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},t.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},t.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},t.onBufferCreated=function(e,t){var i;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(i=t.tracks.video)?void 0:i.buffer},t.createData=function(){var e;return{v:n.CMCDVersion,sf:n.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},t.apply=function(e,t){u(t=void 0===t?{}:t,this.createData());var i=t.ot===n.CMCDObjectType.INIT||t.ot===n.CMCDObjectType.VIDEO||t.ot===n.CMCDObjectType.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering),this.useHeaders?(i=p.toHeaders(t),Object.keys(i).length&&(e.headers||(e.headers={}),u(e.headers,i))):(i=p.toQuery(t))&&(e.url=p.appendQueryToUri(e.url,i))},t.getObjectType=function(e){var t=e.type;return"subtitle"===t?n.CMCDObjectType.TIMED_TEXT:"initSegment"===e.sn?n.CMCDObjectType.INIT:"audio"===t?n.CMCDObjectType.AUDIO:"main"===t?this.hls.audioTracks.length?n.CMCDObjectType.VIDEO:n.CMCDObjectType.MUXED:void 0},t.getTopBandwidth=function(e){for(var t=0,i=this.hls,r=d(e===n.CMCDObjectType.AUDIO?i.audioTracks:(e=-1<(e=i.maxAutoLevel)?e+1:i.levels.length,i.levels.slice(0,e)));!(s=r()).done;){var s=s.value;s.bitrate>t&&(t=s.bitrate)}return 0<t?t:NaN},t.getBufferLength=function(e){var t=this.hls.media,e=e===n.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return e&&t?1e3*s.BufferHelper.bufferInfo(e,t.currentTime,this.config.maxBufferHole).len:NaN},t.createPlaylistLoader=function(){var e=this.config.pLoader,r=this.applyPlaylistData,t=e||this.config.loader;return(e=i.prototype).destroy=function(){this.loader.destroy()},e.abort=function(){this.loader.abort()},e.load=function(e,t,i){r(e),this.loader.load(e,t,i)},l(i,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),i;function i(e){this.loader=void 0,this.loader=new t(e)}},t.createFragmentLoader=function(){var e=this.config.fLoader,r=this.applyFragmentData,t=e||this.config.loader;return(e=i.prototype).destroy=function(){this.loader.destroy()},e.abort=function(){this.loader.abort()},e.load=function(e,t,i){r(e),this.loader.load(e,t,i)},l(i,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),i;function i(e){this.loader=void 0,this.loader=new t(e)}},p.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)},p.serialize=function(e){for(var t=[],i=function(e){return Math.round(e)},r=function(e){return 100*i(e/100)},s={br:i,d:i,bl:r,dl:r,mtp:r,nor:function(e){return encodeURIComponent(e)},rtp:r,tb:i},a=d(Object.keys(e||{}).sort());!(l=a()).done;){var n,o,l=l.value,c=e[l];n=c,Number.isNaN(n)||null==n||""===n||!1===n||"v"===l&&1===c||"pr"==l&&1===c||(n=typeof(c=(n=s[l])?n(c):c),o=void 0,o="ot"===l||"sf"===l||"st"===l?l+"="+c:"boolean"==n?l:"number"==n?l+"="+c:l+"="+JSON.stringify(c),t.push(o))}return t.join(",")},p.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],r=[{},{},{},{}],s={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},a=0,n=Object.keys(e);a<n.length;a++){var o=n[a];r[null!=s[o]?s[o]:1][o]=e[o]}for(var l=0;l<r.length;l++){var c=p.serialize(r[l]);c&&(t["CMCD-"+i[l]]=c)}return t},p.toQuery=function(e){return"CMCD="+encodeURIComponent(p.serialize(e))},p.appendQueryToUri=function(e,t){var i;return t?(i=e.includes("?")?"&":"?",e+i+t):e};var h=p;function p(e){var a=this,e=(this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(e){try{a.apply(e,{ot:n.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(e){o.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=function(e){try{var t=e.frag,i=a.hls.levels[t.level],r=a.getObjectType(t),s={d:1e3*t.duration,ot:r};r!==n.CMCDObjectType.VIDEO&&r!==n.CMCDObjectType.AUDIO&&r!=n.CMCDObjectType.MUXED||(s.br=i.bitrate/1e3,s.tb=a.getTopBandwidth(r)/1e3,s.bl=a.getBufferLength(r)),a.apply(e,s)}catch(e){o.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=e,this.config=e.config),t=e.cmcd;null!=t&&(e.pLoader=this.createPlaylistLoader(),e.fLoader=this.createFragmentLoader(),this.sid=t.sessionId||p.uuid(),this.cid=t.contentId,this.useHeaders=!0===t.useHeaders,this.registerListeners())}},"./src/controller/eme-controller.ts":function(e,t,i){i.r(t);var n=i("./src/events.ts"),o=i("./src/errors.ts"),l=i("./src/utils/logger.ts"),c=i("./src/utils/mediakeys-helper.ts");function r(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=e,this._config=e.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}(i=s.prototype).destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},i._registerListeners=function(){this.hls.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(n.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this)},i._unregisterListeners=function(){this.hls.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(n.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this)},i.getLicenseServerUrl=function(e){if(e===c.KeySystems.WIDEVINE)if(this._widevineLicenseUrl)return this._widevineLicenseUrl;throw new Error('no license server URL configured for key-system "'+e+'"')},i._attemptKeySystemAccess=function(t,e,n){var i=this,e=function(e,t,i){if(e===c.KeySystems.WIDEVINE)return r=n,s=i,a={audioCapabilities:[],videoCapabilities:[]},t.forEach(function(e){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+e+'"',robustness:s.audioRobustness||""})}),r.forEach(function(e){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"',robustness:s.videoRobustness||""})}),[a];var r,s,a;throw new Error("Unknown key-system: "+e)}(t,e,this._drmSystemOptions),e=(l.logger.log("Requesting encrypted media key-system access"),this.requestMediaKeySystemAccess(t,e));this.mediaKeysPromise=e.then(function(e){return i._onMediaKeySystemAccessObtained(t,e)}),e.catch(function(e){l.logger.error('Failed to obtain key-system "'+t+'" access:',e)})},i._onMediaKeySystemAccessObtained=function(t,e){var i=this,r=(l.logger.log('Access for key-system "'+t+'" obtained'),{mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:t}),s=(this._mediaKeysList.push(r),Promise.resolve().then(function(){return e.createMediaKeys()}).then(function(e){return r.mediaKeys=e,l.logger.log('Media-keys created for key-system "'+t+'"'),i._onMediaKeysCreated(),e}));return s.catch(function(e){l.logger.error("Failed to create media-keys:",e)}),s},i._onMediaKeysCreated=function(){var t=this;this._mediaKeysList.forEach(function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),t._onNewMediaKeySession(e.mediaKeysSession))})},i._onNewMediaKeySession=function(t){var i=this;l.logger.log("New key-system session "+t.sessionId),t.addEventListener("message",function(e){i._onKeySessionMessage(t,e.message)},!1)},i._onKeySessionMessage=function(t,e){l.logger.log("Got EME message event, creating license request"),this._requestLicense(e,function(e){l.logger.log("Received license data (length: "+(e&&e.byteLength)+"), updating key-session"),t.update(e)})},i.onMediaEncrypted=function(t){var e,i=this;l.logger.log('Media is encrypted using "'+t.initDataType+'" init data type'),this.mediaKeysPromise?this.mediaKeysPromise.then(e=function(e){i._media&&(i._attemptSetMediaKeys(e),i._generateRequestWithPreferredKeySession(t.initDataType,t.initData))}).catch(e):(l.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.KEY_SYSTEM_ERROR,details:o.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0}))},i._attemptSetMediaKeys=function(e){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");var t;this._hasSetMediaKeys||((t=this._mediaKeysList[0])&&t.mediaKeys?(l.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0):(l.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.KEY_SYSTEM_ERROR,details:o.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0})))},i._generateRequestWithPreferredKeySession=function(e,t){var i,r=this,s=this._mediaKeysList[0];s?s.mediaKeysSessionInitialized?l.logger.warn("Key-Session already initialized but requested again"):(i=s.mediaKeysSession)?t?(l.logger.log('Generating key-session request for "'+e+'" init data type'),s.mediaKeysSessionInitialized=!0,i.generateRequest(e,t).then(function(){l.logger.debug("Key-session generation succeeded")}).catch(function(e){l.logger.error("Error generating key-session request:",e),r.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.KEY_SYSTEM_ERROR,details:o.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})):(l.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.KEY_SYSTEM_ERROR,details:o.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0})):(l.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.KEY_SYSTEM_ERROR,details:o.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0})):(l.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.KEY_SYSTEM_ERROR,details:o.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0}))},i._createLicenseXhr=function(e,t,i){var r=new XMLHttpRequest,t=(r.responseType="arraybuffer",r.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,r,e,t,i),this._licenseXhrSetup);if(t)try{t.call(this.hls,r,e),t=void 0}catch(e){l.logger.error(e)}try{r.readyState||r.open("POST",e,!0),t&&t.call(this.hls,r,e)}catch(e){throw new Error("issue setting up KeySystem license XHR "+e)}return r},i._onLicenseRequestReadyStageChange=function(e,t,i,r){if(4===e.readyState)if(200===e.status){this._requestLicenseFailureCount=0,l.logger.log("License request succeeded");var s=e.response,a=this._licenseResponseCallback;if(a)try{s=a.call(this.hls,e,t)}catch(e){l.logger.error(e)}r(s)}else(l.logger.error("License Request XHR failed ("+t+"). Status: "+e.status+" ("+e.statusText+")"),this._requestLicenseFailureCount++,3<this._requestLicenseFailureCount)?this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.KEY_SYSTEM_ERROR,details:o.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0}):(a=3-this._requestLicenseFailureCount+1,l.logger.warn("Retrying license request, "+a+" attempts left"),this._requestLicense(i,r))},i._generateLicenseRequestChallenge=function(e,t){if(e.mediaKeySystemDomain===c.KeySystems.WIDEVINE)return t;throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},i._requestLicense=function(e,t){l.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(i)try{var r=this.getLicenseServerUrl(i.mediaKeySystemDomain),s=this._createLicenseXhr(r,e,t),a=(l.logger.log("Sending license request to URL: "+r),this._generateLicenseRequestChallenge(i,e));s.send(a)}catch(e){l.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.KEY_SYSTEM_ERROR,details:o.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}else l.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.KEY_SYSTEM_ERROR,details:o.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0})},i.onMediaAttached=function(e,t){this._emeEnabled&&(t=t.media,(this._media=t).addEventListener("encrypted",this._onMediaEncrypted))},i.onMediaDetached=function(){var e=this._media,t=this._mediaKeysList;e&&(e.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map(function(e){if(e.mediaKeysSession)return e.mediaKeysSession.close().catch(function(){})})).then(function(){return e.setMediaKeys(null)}).catch(function(){}))},i.onManifestParsed=function(e,t){var i;this._emeEnabled&&(i=t.levels.map(function(e){return e.audioCodec}).filter(function(e){return!!e}),t=t.levels.map(function(e){return e.videoCodec}).filter(function(e){return!!e}),this._attemptKeySystemAccess(c.KeySystems.WIDEVINE,i,t))},r(s.prototype,[{key:"requestMediaKeySystemAccess",get:function(){if(this._requestMediaKeySystemAccess)return this._requestMediaKeySystemAccess;throw new Error("No requestMediaKeySystemAccess function configured")}}]),t.default=s},"./src/controller/fps-controller.ts":function(e,t,i){i.r(t);var l=i("./src/events.ts"),c=i("./src/utils/logger.ts");function r(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}(i=r.prototype).setStreamController=function(e){this.streamController=e},i.registerListeners=function(){this.hls.on(l.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},i.unregisterListeners=function(){this.hls.off(l.Events.MEDIA_ATTACHING,this.onMediaAttaching)},i.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},i.onMediaAttaching=function(e,t){var i=this.hls.config;i.capLevelOnFPSDrop&&(t=t.media instanceof self.HTMLVideoElement?t.media:null,(this.media=t)&&"function"==typeof t.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod))},i.checkFPS=function(e,t,i){var r,s,a,n,o=performance.now();t&&(this.lastTime&&(n=o-this.lastTime,r=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,n=1e3*r/n,(a=this.hls).trigger(l.Events.FPS_DROP,{currentDropped:r,currentDecoded:s,totalDroppedFrames:i}),0<n)&&r>a.config.fpsDroppedMonitoringThreshold*s&&(n=a.currentLevel,c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+n),0<n)&&(-1===a.autoLevelCapping||a.autoLevelCapping>=n)&&(a.trigger(l.Events.FPS_DROP_LEVEL_CAPPING,{level:--n,droppedLevel:a.currentLevel}),a.autoLevelCapping=n,this.streamController.nextLevelSwitch()),this.lastTime=o,this.lastDroppedFrames=i,this.lastDecodedFrames=t)},i.checkFPSInterval=function(){var e,t=this.media;t&&(this.isVideoPlaybackQualityAvailable?(e=t.getVideoPlaybackQuality(),this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)):this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount))},t.default=r},"./src/controller/fragment-finders.ts":function(e,t,i){i.r(t),i.d(t,"findFragmentByPDT",function(){return r}),i.d(t,"findFragmentByPTS",function(){return s}),i.d(t,"fragmentWithinToleranceTest",function(){return o}),i.d(t,"pdtWithinToleranceTest",function(){return l}),i.d(t,"findFragWithCC",function(){return c});var a=i("./src/polyfills/number.ts"),n=i("./src/utils/binary-search.ts");function r(e,t,i){if(null!==t&&Array.isArray(e)&&e.length&&Object(a.isFiniteNumber)(t)&&!(t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))){i=i||0;for(var r=0;r<e.length;++r){var s=e[r];if(l(t,i,s))return s}}return null}function s(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var s=null;return e?s=t[e.sn-t[0].sn+1]||null:0===i&&0===t[0].start&&(s=t[0]),(!s||0!==o(i,r,s))&&n.default.search(t,o.bind(null,i,r))||s}function o(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0);t=Math.min(t,i.duration+(i.deltaPTS||0));return i.start+i.duration-t<=e?1:i.start-t>e&&i.start?-1:0}function l(e,t,i){t=1e3*Math.min(t,i.duration+(i.deltaPTS||0));return(i.endProgramDateTime||0)-t>e}function c(e,t){return n.default.search(e,function(e){return e.cc<t?1:e.cc>t?-1:0})}},"./src/controller/fragment-tracker.ts":function(e,t,i){i.r(t),i.d(t,"FragmentState",function(){return r}),i.d(t,"FragmentTracker",function(){return a});var r,s=i("./src/events.ts"),o=i("./src/types/loader.ts"),a=((t=r=r||{}).NOT_LOADED="NOT_LOADED",t.BACKTRACKED="BACKTRACKED",t.APPENDING="APPENDING",t.PARTIAL="PARTIAL",t.OK="OK",(i=n.prototype)._registerListeners=function(){var e=this.hls;e.on(s.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(s.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(s.Events.FRAG_LOADED,this.onFragLoaded,this)},i._unregisterListeners=function(){var e=this.hls;e.off(s.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(s.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(s.Events.FRAG_LOADED,this.onFragLoaded,this)},i.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},i.getAppendedFrag=function(e,t){if(t===o.PlaylistLevelType.MAIN){var i=this.activeFragment,r=this.activeParts;if(!i)return null;if(r)for(var s=r.length;s--;){var a=r[s],n=a?a.end:i.appendedPTS;if(a.start<=e&&void 0!==n&&e<=n)return 9<s&&(this.activeParts=r.slice(s-9)),a}else if(i.start<=e&&void 0!==i.appendedPTS&&e<=i.appendedPTS)return i}return this.getBufferedFrag(e,t)},i.getBufferedFrag=function(e,t){for(var i=this.fragments,r=Object.keys(i),s=r.length;s--;){var a=i[r[s]];if((null==a?void 0:a.body.type)===t&&a.buffered){a=a.body;if(a.start<=e&&e<=a.end)return a}}return null},i.detectEvictedFragments=function(i,r,s){var a=this;Object.keys(this.fragments).forEach(function(e){var t=a.fragments[e];t&&(t.buffered?(e=t.range[i])&&e.time.some(function(e){e=!a.isTimeBuffered(e.startPTS,e.endPTS,r);return e&&a.removeFragment(t.body),e}):t.body.type===s&&a.removeFragment(t.body))})},i.detectPartialFragments=function(e){var r,s=this,a=this.timeRanges,n=e.frag,o=e.part;a&&"initSegment"!==n.sn&&(e=c(n),r=this.fragments[e])&&(Object.keys(a).forEach(function(e){var t,i=n.elementaryStreams[e];i&&(t=a[e],i=null!==o||!0===i.partial,r.range[e]=s.getBufferedTimes(n,o,i,t))}),r.backtrack=r.loaded=null,Object.keys(r.range).length?r.buffered=!0:this.removeFragment(r.body))},i.fragBuffered=function(e){e=c(e),e=this.fragments[e];e&&(e.backtrack=e.loaded=null,e.buffered=!0)},i.getBufferedTimes=function(e,t,i,r){for(var s={time:[],partial:i},a=(t||e).start,n=(t||e).end,o=e.minEndPTS||n,l=e.maxStartPTS||a,c=0;c<r.length;c++){var d=r.start(c)-this.bufferPadding,u=r.end(c)+this.bufferPadding;if(d<=l&&o<=u){s.time.push({startPTS:Math.max(a,r.start(c)),endPTS:Math.min(n,r.end(c))});break}if(a<u&&d<n)s.partial=!0,s.time.push({startPTS:Math.max(a,r.start(c)),endPTS:Math.min(n,r.end(c))});else if(n<=d)break}return s},i.getPartialFragment=function(t){var i,r,s=null,a=0,n=this.bufferPadding,o=this.fragments;return Object.keys(o).forEach(function(e){e=o[e];e&&l(e)&&(i=e.body.start-n,r=e.body.end+n,i<=t)&&t<=r&&(i=Math.min(t-i,r-t),a<=i)&&(s=e.body,a=i)}),s},i.getState=function(e){e=c(e),e=this.fragments[e];return e?e.buffered?l(e)?r.PARTIAL:r.OK:e.backtrack?r.BACKTRACKED:r.APPENDING:r.NOT_LOADED},i.backtrack=function(e,t){e=c(e),e=this.fragments[e];return!e||e.backtrack?null:(t=e.backtrack=t||e.loaded,e.loaded=null,t)},i.getBacktrackData=function(e){var t=c(e),t=this.fragments[t];if(t){var i,t=t.backtrack;if(null!=t&&null!=(i=t.payload)&&i.byteLength)return t;this.removeFragment(e)}return null},i.isTimeBuffered=function(e,t,i){for(var r,s,a=0;a<i.length;a++){if(r=i.start(a)-this.bufferPadding,s=i.end(a)+this.bufferPadding,r<=e&&t<=s)return!0;if(t<=r)return!1}return!1},i.onFragLoaded=function(e,t){var i=t.frag,r=t.part;"initSegment"===i.sn||i.bitrateTest||r||(r=c(i),this.fragments[r]={body:i,loaded:t,backtrack:null,buffered:!1,range:Object.create(null)})},i.onBufferAppended=function(e,t){var r=this,s=t.frag,a=t.part,n=t.timeRanges;s.type===o.PlaylistLevelType.MAIN&&(this.activeFragment=s,a?((t=this.activeParts)||(this.activeParts=t=[]),t.push(a)):this.activeParts=null),this.timeRanges=n,Object.keys(n).forEach(function(e){var t=n[e];if(r.detectEvictedFragments(e,t),!a)for(var i=0;i<t.length;i++)s.appendedPTS=Math.max(t.end(i),s.appendedPTS||0)})},i.onFragBuffered=function(e,t){this.detectPartialFragments(t)},i.hasFragment=function(e){e=c(e);return!!this.fragments[e]},i.removeFragmentsInRange=function(t,i,r){var s=this;Object.keys(this.fragments).forEach(function(e){var e=s.fragments[e];e&&e.buffered&&(e=e.body).type===r&&e.start<i&&e.end>t&&s.removeFragment(e)})},i.removeFragment=function(e){var t=c(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),delete this.fragments[t]},i.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},n);function n(e){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=e,this._registerListeners()}function l(e){var t;return e.buffered&&(null!=(t=e.range.video)&&t.partial||null!=(t=e.range.audio)&&t.partial)}function c(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn}},"./src/controller/gap-controller.ts":function(e,t,i){i.r(t),i.d(t,"STALL_MINIMUM_DURATION_MS",function(){return p}),i.d(t,"MAX_START_GAP_JUMP",function(){return f}),i.d(t,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return g}),i.d(t,"SKIP_BUFFER_RANGE_START",function(){return m}),i.d(t,"default",function(){return r});var c=i("./src/utils/buffer-helper.ts"),d=i("./src/errors.ts"),u=i("./src/events.ts"),h=i("./src/utils/logger.ts"),p=250,f=2,g=.1,m=.05,r=((t=s.prototype).destroy=function(){this.hls=this.fragmentTracker=this.media=null},t.poll=function(e){var t=this.config,i=this.media,r=this.stalled,s=i.currentTime,a=i.seeking,n=this.seeking&&!a,o=!this.seeking&&a;if(this.seeking=a,s===e){if((o||n)&&(this.stalled=null),!i.paused&&!i.ended&&0!==i.playbackRate&&c.BufferHelper.getBuffered(i).length){e=c.BufferHelper.bufferInfo(i,s,0),o=0<e.len,n=e.nextStart||0;if(o||n){if(a){var o=e.len>f,l=!n||f<n-s&&!this.fragmentTracker.getPartialFragment(s);if(o||l)return;this.moved=!1}if(!this.moved&&null!==this.stalled){o=Math.max(n,e.start||0)-s,l=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,n=null!=l&&null!=(n=l.details)&&n.live?2*l.details.targetduration:f;if(0<o&&o<=n)return void this._trySkipBufferHole(null)}l=self.performance.now();null!==r?(o=l-r,!a&&p<=o&&this._reportStall(e.len),n=c.BufferHelper.bufferInfo(i,s,t.maxBufferHole),this._tryFixBufferStall(n,o)):this.stalled=l}}}else this.moved=!0,null!==r&&(this.stallReported&&(a=self.performance.now()-r,h.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(a)+"ms"),this.stallReported=!1),this.stalled=null,this.nudgeRetry=0)},t._tryFixBufferStall=function(e,t){var i=this.config,r=this.fragmentTracker,s=this.media.currentTime,r=r.getPartialFragment(s);r&&this._trySkipBufferHole(r)||e.len>i.maxBufferHole&&t>1e3*i.highBufferWatchdogPeriod&&(h.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,i=this.media;this.stallReported||(this.stallReported=!0,h.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(u.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,i=this.hls,r=this.media,s=r.currentTime,a=0,n=c.BufferHelper.getBuffered(r),o=0;o<n.length;o++){var l=n.start(o);if(s+t.maxBufferHole>=a&&s<l)return l=Math.max(l+m,r.currentTime+g),h.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+l),this.moved=!0,this.stalled=null,r.currentTime=l,e&&i.trigger(u.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+l,frag:e}),l;a=n.end(o)}return 0},t._tryNudgeBuffer=function(){var e=this.config,t=this.hls,i=this.media,r=i.currentTime,s=(this.nudgeRetry||0)+1;(this.nudgeRetry=s)<e.nudgeMaxRetry?(s=r+s*e.nudgeOffset,h.logger.warn("Nudging 'currentTime' from "+r+" to "+s),i.currentTime=s,t.trigger(u.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})):(h.logger.error("Playhead still not moving while enough data buffered @"+r+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(u.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0}))},s);function s(e,t,i,r){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=r}},"./src/controller/id3-track-controller.ts":function(e,t,i){i.r(t);var r=i("./src/events.ts"),s=i("./src/utils/texttrack-utils.ts"),h=i("./src/demux/id3.ts");function a(e){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=e,this._registerListeners()}(i=a.prototype).destroy=function(){this._unregisterListeners()},i._registerListeners=function(){var e=this.hls;e.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},i._unregisterListeners=function(){var e=this.hls;e.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},i.onMediaAttached=function(e,t){this.media=t.media},i.onMediaDetaching=function(){this.id3Track&&(Object(s.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},i.getID3Track=function(e){if(this.media){for(var t=0;t<e.length;t++){var i=e[t];if("metadata"===i.kind&&"id3"===i.label)return Object(s.sendAddTrackEvent)(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},i.onFragParsingMetadata=function(e,t){if(this.media){var i=t.frag,r=t.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var s=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,a=0;a<r.length;a++){var n=h.getID3Frames(r[a].data);if(n){var o=r[a].pts,l=a<r.length-1?r[a+1].pts:i.end;l-o<=0&&(l=o+.25);for(var c=0;c<n.length;c++){var d,u=n[c];h.isTimeStampFrame(u)||((d=new s(o,l,"")).value=u,this.id3Track.addCue(d))}}}}},i.onBufferFlushing=function(e,t){var i=t.startOffset,r=t.endOffset,t=t.type;t&&"audio"!==t||(t=this.id3Track)&&Object(s.removeCuesInRange)(t,i,r)},t.default=a},"./src/controller/latency-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return o});var r=i("./src/errors.ts"),s=i("./src/events.ts"),a=i("./src/utils/logger.ts");function n(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t=l.prototype).destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},t.registerListeners=function(){this.hls.on(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(s.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(s.Events.ERROR,this.onError,this)},t.unregisterListeners=function(){this.hls.off(s.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(s.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(s.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(s.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(s.Events.ERROR,this.onError)},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},t.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},t.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},t.onLevelUpdated=function(e,t){t=t.details;(this.levelDetails=t).advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},t.onError=function(e,t){t.details===r.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,a.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},t.timeupdate=function(){var e,t,i,r=this.media,s=this.levelDetails;r&&s&&(this.currentTime=r.currentTime,null!==(t=this.computeLatency()))&&(this._latency=t,i=(e=this.config).lowLatencyMode,e=e.maxLiveSyncPlaybackRate,i)&&1!==e&&null!==(i=this.targetLatency)&&(i=(t=t-i)<Math.min(this.maxLatency,i+s.targetduration),s.live&&i&&.05<t&&1<this.forwardBufferLength?(s=Math.min(2,Math.max(1,e)),i=Math.round(2/(1+Math.exp(-.75*t-this.edgeStalled))*20)/20,r.playbackRate=Math.min(s,Math.max(1,i))):1!==r.playbackRate&&0!==r.playbackRate&&(r.playbackRate=1))},t.estimateLiveEdge=function(){var e=this.levelDetails;return null===e?null:e.edge+e.age},t.computeLatency=function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime},n(l.prototype,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e,t,i,r,s,a=this.levelDetails;return null===a?null:(e=a.holdBack,r=a.partHoldBack,a=a.targetduration,t=(s=this.config).liveSyncDuration,i=s.liveSyncDurationCount,s=s.lowLatencyMode&&r||e,(s=(r=this.hls.userConfig).liveSyncDuration||r.liveSyncDurationCount||0===s?void 0!==t?t:i*a:s)+Math.min(+this.stallCount,a))}},{key:"liveSyncPosition",get:function(){var e,t=this.estimateLiveEdge(),i=this.targetLatency,r=this.levelDetails;return null===t||null===i||null===r?null:(e=r.edge,t=t-i-this.edgeStalled,i=e-r.totalduration,e=e-(this.config.lowLatencyMode&&r.partTarget||r.targetduration),Math.min(Math.max(i,t),e))}},{key:"drift",get:function(){var e=this.levelDetails;return null===e?1:e.drift}},{key:"edgeStalled",get:function(){var e,t=this.levelDetails;return null===t?0:(e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration),Math.max(t.age-e,0))}},{key:"forwardBufferLength",get:function(){var e,t=this.media,i=this.levelDetails;return t&&i?(e=t.buffered.length)?t.buffered.end(e-1):i.edge-this.currentTime:0}}]);var o=l;function l(e){var t=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return t.timeupdate()},this.hls=e,this.config=e.config,this.registerListeners()}},"./src/controller/level-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return n});var p=i("./src/types/level.ts"),f=i("./src/events.ts"),g=i("./src/errors.ts"),m=i("./src/utils/codecs.ts"),A=i("./src/controller/level-helper.ts"),t=i("./src/controller/base-playlist-controller.ts"),o=i("./src/types/loader.ts");function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}function r(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l,y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),n=(l=t.default,i=l,(t=c).prototype=Object.create(i.prototype),a(t.prototype.constructor=t,i),(t=c.prototype)._registerListeners=function(){var e=this.hls;e.on(f.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(f.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(f.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(f.Events.ERROR,this.onError,this)},t._unregisterListeners=function(){var e=this.hls;e.off(f.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(f.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(f.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(f.Events.ERROR,this.onError,this)},t.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,l.prototype.destroy.call(this)},t.startLoad=function(){this._levels.forEach(function(e){e.loadError=0}),l.prototype.startLoad.call(this)},t.onManifestLoaded=function(e,t){var i,r,s=[],a=[],n=[],o={},l=!1,c=!1,d=!1;if(t.levels.forEach(function(e){var t=e.attrs,i=(l=l||!(!e.width||!e.height),c=c||!!e.videoCodec,d=d||!!e.audioCodec,y&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0),e.bitrate+"-"+e.attrs.RESOLUTION+"-"+e.attrs.CODECS);(r=o[i])?r.url.push(e.url):(r=new p.Level(e),o[i]=r,s.push(r)),t&&(t.AUDIO&&Object(A.addGroupId)(r,"audio",t.AUDIO),t.SUBTITLES)&&Object(A.addGroupId)(r,"text",t.SUBTITLES)}),s=(s=(l||c)&&d?s.filter(function(e){var t=e.videoCodec,i=e.width,e=e.height;return!!t||!(!i||!e)}):s).filter(function(e){var t=e.audioCodec,e=e.videoCodec;return(!t||Object(m.isCodecSupportedInMp4)(t,"audio"))&&(!e||Object(m.isCodecSupportedInMp4)(e,"video"))}),t.audioTracks&&(a=t.audioTracks.filter(function(e){return!e.audioCodec||Object(m.isCodecSupportedInMp4)(e.audioCodec,"audio")}),Object(A.assignTrackIdsByGroup)(a)),t.subtitles&&(n=t.subtitles,Object(A.assignTrackIdsByGroup)(n)),0<s.length){i=s[0].bitrate,s.sort(function(e,t){return e.bitrate-t.bitrate}),this._levels=s;for(var u=0;u<s.length;u++)if(s[u].bitrate===i){this._firstLevel=u,this.log("manifest loaded, "+s.length+" level(s) found, first bitrate: "+i);break}var h=d&&!c,n={levels:s,audioTracks:a,subtitleTracks:n,firstLevel:this._firstLevel,stats:t.stats,audio:d,video:c,altAudio:!h&&a.some(function(e){return!!e.url})};this.hls.trigger(f.Events.MANIFEST_PARSED,n),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(f.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,reason:"no level with compatible codecs found in manifest"})},t.onError=function(e,t){if(l.prototype.onError.call(this,e,t),!t.fatal){var i=t.context,e=this._levels[this.currentLevelIndex];if(i&&(i.type===o.PlaylistContextType.AUDIO_TRACK&&e.audioGroupIds&&i.groupId===e.audioGroupIds[e.urlId]||i.type===o.PlaylistContextType.SUBTITLE_TRACK&&e.textGroupIds&&i.groupId===e.textGroupIds[e.urlId]))this.redundantFailover(this.currentLevelIndex);else{var r,s,a=!1,n=!0;switch(t.details){case g.ErrorDetails.FRAG_LOAD_ERROR:case g.ErrorDetails.FRAG_LOAD_TIMEOUT:case g.ErrorDetails.KEY_LOAD_ERROR:case g.ErrorDetails.KEY_LOAD_TIMEOUT:t.frag&&(!(s=this._levels[t.frag.level])||(s.fragmentError++,s.fragmentError>this.hls.config.fragLoadingMaxRetry))&&(r=t.frag.level);break;case g.ErrorDetails.LEVEL_LOAD_ERROR:case g.ErrorDetails.LEVEL_LOAD_TIMEOUT:i&&(i.deliveryDirectives&&(n=!1),r=i.level),a=!0;break;case g.ErrorDetails.REMUX_ALLOC_ERROR:r=t.level,a=!0}void 0!==r&&this.recoverLevel(t,r,a,n)}}},t.recoverLevel=function(e,t,i,r){var s=e.details,a=this._levels[t];if(a.loadError++,i){if(!this.retryLoadingOrFail(e))return void(this.currentLevelIndex=-1);e.levelRetry=!0}r&&(1<(i=a.url.length)&&a.loadError<i?(e.levelRetry=!0,this.redundantFailover(t)):-1===this.manualLevelIndex&&(r=0===t?this._levels.length-1:t-1,this.currentLevelIndex!==r)&&0===this._levels[r].loadError&&(this.warn(s+": switch to "+r),e.levelRetry=!0,this.hls.nextAutoLevel=r))},t.redundantFailover=function(e){var t,i=this._levels[e],r=i.url.length;1<r&&(t=(i.urlId+1)%r,this.warn("Switching to redundant URL-id "+t),this._levels.forEach(function(e){e.urlId=t}),this.level=e)},t.onFragLoaded=function(e,t){var t=t.frag;void 0!==t&&t.type===o.PlaylistLevelType.MAIN&&void 0!==(t=this._levels[t.level])&&(t.fragmentError=0,t.loadError=0)},t.onLevelLoaded=function(e,t){var i=t.level,r=t.details,s=this._levels[i];s?i===this.currentLevelIndex?(0===s.fragmentError&&(s.loadError=0,this.retryCount=0),this.playlistLoaded(i,t,s.details)):null!=(s=t.deliveryDirectives)&&s.skip&&(r.deltaUpdateFailed=!0):(this.warn("Invalid level index "+i),null!=(s=t.deliveryDirectives)&&s.skip&&(r.deltaUpdateFailed=!0))},t.onAudioTrackSwitched=function(e,t){var i=this.hls.levels[this.currentLevelIndex];if(i&&i.audioGroupIds){for(var r=-1,s=this.hls.audioTracks[t.id].groupId,a=0;a<i.audioGroupIds.length;a++)if(i.audioGroupIds[a]===s){r=a;break}r!==i.urlId&&(i.urlId=r,this.startLoad())}},t.loadPlaylist=function(e){var t=this.currentLevelIndex,i=this._levels[t];if(this.canLoad&&i&&0<i.url.length){var r=i.urlId,i=i.url[r];if(e)try{i=e.addDirectives(i)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Attempt loading level index "+t+(e?" at sn "+e.msn+" part "+e.part:"")+" with URL-id "+r+" "+i),this.clearTimer(),this.hls.trigger(f.Events.LEVEL_LOADING,{url:i,level:t,id:r,deliveryDirectives:e||null})}},t.removeLevel=function(i,r){function s(e,t){return t!==r}var e=this._levels.filter(function(e,t){return t!==i||1<e.url.length&&void 0!==r&&(e.url=e.url.filter(s),e.audioGroupIds&&(e.audioGroupIds=e.audioGroupIds.filter(s)),e.textGroupIds&&(e.textGroupIds=e.textGroupIds.filter(s)),!(e.urlId=0))}).map(function(e,t){var i=e.details;return null!=i&&i.fragments&&i.fragments.forEach(function(e){e.level=t}),e});this._levels=e,this.hls.trigger(f.Events.LEVELS_UPDATED,{levels:e})},r(c.prototype,[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;if(0!==t.length&&(this.currentLevelIndex!==e||null==(i=t[e])||!i.details)){if(e<0||e>=t.length){var i=e<0;if(this.hls.trigger(f.Events.ERROR,{type:g.ErrorTypes.OTHER_ERROR,details:g.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:i,reason:"invalid level idx"}),i)return;e=Math.min(e,t.length-1)}this.clearTimer();var i=this.currentLevelIndex,r=t[i],t=t[e],i=(this.log("switching to level "+e+" from "+i),s({},t,{level:this.currentLevelIndex=e,maxBitrate:t.maxBitrate,uri:t.uri,urlId:t.urlId})),e=(delete i._urlId,this.hls.trigger(f.Events.LEVEL_SWITCHING,i),t.details);e&&!e.live||(i=this.switchParams(t.uri,null==r?void 0:r.details),this.loadPlaylist(i))}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){var e;return void 0===this._startLevel?void 0!==(e=this.hls.config.startLevel)?e:this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}]),c);function c(e){return(e=l.call(this,e,"[level-controller]")||this)._levels=[],e._firstLevel=-1,e._startLevel=void 0,e.currentLevelIndex=-1,e.manualLevelIndex=-1,e.onParsedComplete=void 0,e._registerListeners(),e}},"./src/controller/level-helper.ts":function(e,t,i){i.r(t),i.d(t,"addGroupId",function(){return r}),i.d(t,"assignTrackIdsByGroup",function(){return s}),i.d(t,"updatePTS",function(){return a}),i.d(t,"updateFragPTSDTS",function(){return m}),i.d(t,"mergeDetails",function(){return n}),i.d(t,"mapPartIntersection",function(){return A}),i.d(t,"mapFragmentIntersection",function(){return y}),i.d(t,"adjustSliding",function(){return b}),i.d(t,"addSliding",function(){return o}),i.d(t,"computeReloadInterval",function(){return l}),i.d(t,"getFragmentWithSN",function(){return c}),i.d(t,"getPartWith",function(){return d});var p=i("./src/polyfills/number.ts"),f=i("./src/utils/logger.ts");function r(e,t,i){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(i);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(i)}}function s(e){var i={};e.forEach(function(e){var t=e.groupId||"";e.id=i[t]=i[t]||0,i[t]++})}function a(e,t,i){g(e[t],e[i])}function g(e,t){var i,r=t.startPTS;Object(p.isFiniteNumber)(r)?(i=0,(r=t.sn>e.sn?(i=r-e.start,e):(i=e.start-r,t)).duration!==i&&(r.duration=i)):t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function m(e,t,i,r,s,a){r-i<=0&&(f.logger.warn("Fragment should have a positive duration",t),r=i+t.duration,a=s+t.duration);var n=i,o=r,l=t.startPTS,c=t.endPTS,d=(Object(p.isFiniteNumber)(l)&&(d=Math.abs(l-i),Object(p.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(d,t.deltaPTS):t.deltaPTS=d,n=Math.max(i,l),i=Math.min(i,l),s=Math.min(s,t.startDTS),o=Math.min(r,c),r=Math.max(r,c),a=Math.max(a,t.endDTS)),t.duration=r-i,i-t.start);t.appendedPTS=r,t.start=t.startPTS=i,t.maxStartPTS=n,t.startDTS=s,t.endPTS=r,t.minEndPTS=o,t.endDTS=a;var u,l=t.sn;if(!e||l<e.startSN||l>e.endSN)return 0;var c=l-e.startSN,h=e.fragments;for(h[c]=t,u=c;0<u;u--)g(h[u],h[u-1]);for(u=c;u<h.length-1;u++)g(h[u],h[u+1]);return e.fragmentHint&&g(h[h.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,d}function n(e,i){for(var r=null,t=e.fragments,s=t.length-1;0<=s;s--){var a=t[s].initSegment;if(a){r=a;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var n,o=0;if(y(e,i,function(e,t){e.relurl&&(o=e.cc-t.cc),Object(p.isFiniteNumber)(e.startPTS)&&Object(p.isFiniteNumber)(e.endPTS)&&(t.start=t.startPTS=e.startPTS,t.startDTS=e.startDTS,t.appendedPTS=e.appendedPTS,t.maxStartPTS=e.maxStartPTS,t.endPTS=e.endPTS,t.endDTS=e.endDTS,t.minEndPTS=e.minEndPTS,t.duration=e.endPTS-e.startPTS,t.duration&&(n=t),i.PTSKnown=i.alignedSliding=!0),t.elementaryStreams=e.elementaryStreams,t.loader=e.loader,t.stats=e.stats,t.urlId=e.urlId,e.initSegment&&(t.initSegment=e.initSegment,r=e.initSegment)}),r&&(i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments).forEach(function(e){var t;e.initSegment&&e.initSegment.relurl!==(null==(t=r)?void 0:t.relurl)||(e.initSegment=r)}),i.skippedSegments&&(i.deltaUpdateFailed=i.fragments.some(function(e){return!e}),i.deltaUpdateFailed)){f.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=i.skippedSegments;l--;)i.fragments.shift();i.startSN=i.fragments[0].sn,i.startCC=i.fragments[0].cc}var c=i.fragments;if(o){f.logger.warn("discontinuity sliding from playlist, take drift into account");for(var d=0;d<c.length;d++)c[d].cc+=o}i.skippedSegments&&(i.startCC=i.fragments[0].cc),A(e.partList,i.partList,function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),n?m(i,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):b(e,i),c.length&&(i.totalduration=i.edge-c[0].start),i.driftStartTime=e.driftStartTime,i.driftStart=e.driftStart;var u,h=i.advancedDateTime;i.advanced&&h?(u=i.edge,i.driftStart||(i.driftStartTime=h,i.driftStart=u),i.driftEndTime=h,i.driftEnd=u):(i.driftEndTime=e.driftEndTime,i.driftEnd=e.driftEnd,i.advancedDateTime=e.advancedDateTime)}function A(e,t,i){if(e&&t)for(var r=0,s=0,a=e.length;s<=a;s++){var n=e[s],o=t[s+r];n&&o&&n.index===o.index&&n.fragment.sn===o.fragment.sn?i(n,o):r--}}function y(e,t,i){for(var r=t.skippedSegments,s=Math.max(e.startSN,t.startSN)-t.startSN,a=(e.fragmentHint?1:0)+(r?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,n=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=s;c<=a;c++){var d=l[n+c],u=o[c];r&&!u&&c<r&&(u=t.fragments[c]=d),d&&u&&i(d,u)}}function b(e,t){var i=t.startSN+t.skippedSegments-e.startSN,e=e.fragments;i<0||i>=e.length||o(t,e[i].start)}function o(e,t){if(t){for(var i=e.fragments,r=e.skippedSegments;r<i.length;r++)i[r].start+=t;e.fragmentHint&&(e.fragmentHint.start+=t)}}function l(e,t){var i,r=1e3*e.levelTargetDuration,s=r/2,a=e.age,n=0<a&&a<3*r,t=t.loading.end-t.loading.start,o=e.availabilityDelay;return!1===e.updated?n?(i=333*e.misses,i=Math.max(Math.min(s,2*t),i),e.availabilityDelay=(e.availabilityDelay||0)+i):i=s:i=n?(o=Math.min(o||r/2,a),(e.availabilityDelay=o)+r-a):r-t,Math.round(i)}function c(e,t,i){var r;return e&&e.details?(e=e.details).fragments[t-e.startSN]||((r=e.fragmentHint)&&r.sn===t?r:t<e.startSN&&i&&i.sn===t?i:null):null}function d(e,t,i){if(e&&e.details){var r=e.details.partList;if(r)for(var s=r.length;s--;){var a=r[s];if(a.index===i&&a.fragment.sn===t)return a}}return null}},"./src/controller/stream-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return b});var f=i("./src/polyfills/number.ts"),g=i("./src/controller/base-stream-controller.ts"),a=i("./src/is-supported.ts"),m=i("./src/events.ts"),s=i("./src/utils/buffer-helper.ts"),n=i("./src/controller/fragment-tracker.ts"),u=i("./src/types/loader.ts"),A=i("./src/loader/fragment.ts"),h=i("./src/demux/transmuxer-interface.ts"),p=i("./src/types/transmuxer.ts"),r=i("./src/controller/gap-controller.ts"),o=i("./src/errors.ts"),l=i("./src/utils/logger.ts");function c(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}y=g.default,t=y,(i=v).prototype=Object.create(t.prototype),d(i.prototype.constructor=i,t),(i=v.prototype)._registerListeners=function(){var e=this.hls;e.on(m.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(m.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(m.Events.ERROR,this.onError,this),e.on(m.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(m.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(m.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(m.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(m.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i._unregisterListeners=function(){var e=this.hls;e.off(m.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(m.Events.ERROR,this.onError,this),e.off(m.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(m.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(m.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(m.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(m.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(m.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},i.startLoad=function(e){var t,i,r;this.levels?(t=this.lastCurrentTime,i=this.hls,this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,this.startFragRequested||(-1===(r=i.startLevel)&&(i.config.testBandwidth?this.bitrateTest=!(r=0):r=i.nextAutoLevel),this.level=i.nextLoadLevel=r,this.loadedmetadata=!1),0<t&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=g.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()):(this._forceStartLoad=!0,this.state=g.State.STOPPED)},i.stopLoad=function(){this._forceStartLoad=!1,y.prototype.stopLoad.call(this)},i.doTick=function(){switch(this.state){case g.State.IDLE:this.doTickIdle();break;case g.State.WAITING_LEVEL:var e=this.levels,t=this.level,t=null==e||null==(e=e[t])?void 0:e.details;if(t&&(!t.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(t))break;this.state=g.State.IDLE}break;case g.State.FRAG_LOADING_WAITING_RETRY:e=self.performance.now(),t=this.retryDate;(!t||t<=e||null!=(t=this.media)&&t.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=g.State.IDLE)}this.onTickEnd()},i.onTickEnd=function(){y.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},i.doTickIdle=function(){var e=this.hls,t=this.levelLastLoaded,i=this.levels,r=this.media,s=e.config,a=e.nextLoadLevel;null===t||!(r||!this.startFragRequested&&s.startFragPrefetch)||this.altAudio&&this.audioOnly||!i||!i[a]||(t=i[a],this.level=e.nextLoadLevel=a,!(s=t.details)||this.state===g.State.WAITING_LEVEL||s.live&&this.levelLastLoaded!==a?this.state=g.State.WAITING_LEVEL:null===(i=this.getFwdBufferInfo(this.mediaBuffer||r,u.PlaylistLevelType.MAIN))||i.len>=this.getMaxBufferLength(t.maxBitrate)||(this._streamEnded(i,s)?(e={},this.altAudio&&(e.type="video"),this.hls.trigger(m.Events.BUFFER_EOS,e),this.state=g.State.ENDED):(a=i.end,t=this.getNextFragment(a,s),this.couldBacktrack&&!this.fragPrevious&&t&&"initSegment"!==t.sn&&1<(e=t.sn-s.startSN)&&(t=s.fragments[e-1],this.fragmentTracker.removeFragment(t)),t&&this.fragmentTracker.getState(t)===n.FragmentState.OK&&this.nextLoadPosition>a&&(i=this.audioOnly&&!this.altAudio?A.ElementaryStreamTypes.AUDIO:A.ElementaryStreamTypes.VIDEO,this.afterBufferFlushed(r,i,u.PlaylistLevelType.MAIN),t=this.getNextFragment(this.nextLoadPosition,s)),t&&("identity"!==(null==(e=(t=!t.initSegment||t.initSegment.data||this.bitrateTest?t:t.initSegment).decryptdata)?void 0:e.keyFormat)||null!=(r=t.decryptdata)&&r.key?this.loadFragment(t,s,a):this.loadKey(t,s)))))},i.loadFragment=function(e,t,i){var r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,r===n.FragmentState.BACKTRACKED){var s=this.fragmentTracker.getBacktrackData(e);if(s)return this._handleFragmentLoadProgress(s),void this._handleFragmentLoadComplete(s);r=n.FragmentState.NOT_LOADED}r===n.FragmentState.NOT_LOADED||r===n.FragmentState.PARTIAL?"initSegment"===e.sn?this._loadInitSegment(e):this.bitrateTest?(e.bitrateTest=!0,this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e)):(this.startFragRequested=!0,y.prototype.loadFragment.call(this,e,t,i)):r===n.FragmentState.APPENDING?this.reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e):0===(null==(s=this.media)?void 0:s.buffered.length)&&this.fragmentTracker.removeAllFragments()},i.getAppendedFrag=function(e){e=this.fragmentTracker.getAppendedFrag(e,u.PlaylistLevelType.MAIN);return e&&"fragment"in e?e.fragment:e},i.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,u.PlaylistLevelType.MAIN)},i.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},i.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},i.nextLevelSwitch=function(){var e,t=this.levels,i=this.media;null!=i&&i.readyState&&((e=this.getAppendedFrag(i.currentTime))&&1<e.start&&this.flushMainBuffer(0,e.start-1),e=!i.paused&&t&&(e=t[this.hls.nextLoadLevel],t=this.fragLastKbps)&&this.fragCurrent?this.fragCurrent.duration*e.maxBitrate/(1e3*t)+1:0,t=this.getBufferedFrag(i.currentTime+e))&&(i=this.followingBufferedFrag(t))&&(this.abortCurrentFrag(),e=i.maxStartPTS||i.start,i=i.duration,t=Math.max(t.end,e+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,.5*i),.75*i)),this.flushMainBuffer(t,Number.POSITIVE_INFINITY))},i.abortCurrentFrag=function(){var e=this.fragCurrent;(this.fragCurrent=null)!=e&&e.loader&&e.loader.abort(),this.state===g.State.KEY_LOADING&&(this.state=g.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},i.flushMainBuffer=function(e,t){y.prototype.flushMainBuffer.call(this,e,t,this.altAudio?"video":null)},i.onMediaAttached=function(e,t){y.prototype.onMediaAttached.call(this,e,t);e=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),e.addEventListener("playing",this.onvplaying),e.addEventListener("seeked",this.onvseeked),this.gapController=new r.default(this.config,e,this.fragmentTracker,this.hls)},i.onMediaDetaching=function(){var e=this.media;e&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),y.prototype.onMediaDetaching.call(this)},i.onMediaPlaying=function(){this.tick()},i.onMediaSeeked=function(){var e=this.media,e=e?e.currentTime:null;Object(f.isFiniteNumber)(e)&&this.log("Media seeked to "+e.toFixed(3)),this.tick()},i.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(m.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},i.onManifestParsed=function(e,t){var i,r=!1,s=!1;t.levels.forEach(function(e){(i=e.audioCodec)&&(-1!==i.indexOf("mp4a.40.2")&&(r=!0),-1!==i.indexOf("mp4a.40.5"))&&(s=!0)}),this.audioCodecSwitch=r&&s&&!Object(a.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},i.onLevelLoading=function(e,t){var i=this.levels;i&&this.state===g.State.IDLE&&(!(i=i[t.level]).details||i.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(i.details))&&(this.state=g.State.WAITING_LEVEL)},i.onLevelLoaded=function(e,t){var i=this.levels,r=t.level,s=t.details,a=s.totalduration;if(i){this.log("Level "+r+" loaded ["+s.startSN+","+s.endSN+"], cc ["+s.startCC+", "+s.endCC+"] duration:"+a);a=this.fragCurrent,t=(!a||this.state!==g.State.FRAG_LOADING&&this.state!==g.State.FRAG_LOADING_WAITING_RETRY||a.level!==t.level&&a.loader&&(this.state=g.State.IDLE,a.loader.abort()),i[r]),a=0;if(s.live||null!=(i=t.details)&&i.live){if(s.fragments[0]||(s.deltaUpdateFailed=!0),s.deltaUpdateFailed)return;a=this.alignPlaylists(s,t.details)}if(t.details=s,this.levelLastLoaded=r,this.hls.trigger(m.Events.LEVEL_UPDATED,{details:s,level:r}),this.state===g.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(s))return;this.state=g.State.IDLE}this.startFragRequested?s.live&&this.synchronizeToLiveEdge(s):this.setStartPosition(s,a),this.tick()}else this.warn("Levels were reset while loading level "+r)},i._handleFragmentLoadProgress=function(e){var t,i,r,s,a,n,o,l=e.frag,c=e.part,e=e.payload,d=this.levels;d?(t=(d=d[l.level]).details)?(i=d.videoCodec,r=t.PTSKnown||!t.live,s=null==(s=l.initSegment)?void 0:s.data,d=this._getAudioCodec(d),a=this.transmuxer=this.transmuxer||new h.default(this.hls,u.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),n=c?c.index:-1,n=new p.ChunkMetadata(l.level,l.sn,l.stats.chunkCount,e.byteLength,n,-1!==n),o=this.initPTS[l.cc],a.push(e,s,d,i,l,c,t.totalduration,r,n,o)):this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset"):this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered")},i.onAudioTrackSwitching=function(e,t){var i=this.altAudio,r=!!t.url,t=t.id;r||(this.mediaBuffer!==this.media?(this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media,null!=(r=this.fragCurrent)&&r.loader&&(this.log("Switching to main audio track, cancel main fragment load"),r.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()):this.audioOnly&&this.resetTransmuxer(),r=this.hls,i&&r.trigger(m.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),r.trigger(m.Events.AUDIO_TRACK_SWITCHED,{id:t}))},i.onAudioTrackSwitched=function(e,t){var i,t=t.id,t=!!this.hls.audioTracks[t].url;t&&(i=this.videoBuffer)&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i),this.altAudio=t,this.tick()},i.onBufferCreated=function(e,t){var i,r=t.tracks,s=!1;for(i in r){var a,n,o=r[i];"main"===o.id?(n=o,"video"===(a=i)&&(o=r[i])&&(this.videoBuffer=o.buffer)):s=!0}s&&n?(this.log("Alternate track found, use "+a+".buffered to schedule main fragment loading"),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media},i.onFragBuffered=function(e,t){var i,r=t.frag,t=t.part;r&&r.type!==u.PlaylistLevelType.MAIN||(this.fragContextChanged(r)?(this.warn("Fragment "+r.sn+(t?" p: "+t.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),this.state===g.State.PARSED&&(this.state=g.State.IDLE)):(i=(t||r).stats,this.fragLastKbps=Math.round(8*i.total/(i.buffering.end-i.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,t)))},i.onError=function(e,t){switch(t.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(u.PlaylistLevelType.MAIN,t);break;case o.ErrorDetails.LEVEL_LOAD_ERROR:case o.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==g.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=g.State.ERROR):t.levelRetry||this.state!==g.State.WAITING_LEVEL||(this.state=g.State.IDLE));break;case o.ErrorDetails.BUFFER_FULL_ERROR:var i,r;"main"!==t.parent||this.state!==g.State.PARSING&&this.state!==g.State.PARSED||(i=!0,(i=(r=this.getFwdBufferInfo(this.media,u.PlaylistLevelType.MAIN))&&.5<r.len?!this.reduceMaxBufferLength(r.len):i)&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState())}},i.checkBuffer=function(){var e,t=this.media,i=this.gapController;t&&i&&t.readyState&&(e=s.BufferHelper.getBuffered(t),!this.loadedmetadata&&e.length?(this.loadedmetadata=!0,this.seekToStartPos()):i.poll(this.lastCurrentTime),this.lastCurrentTime=t.currentTime)},i.onFragLoadEmergencyAborted=function(){this.state=g.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},i.onBufferFlushed=function(e,t){var i,t=t.type;(t!==A.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio)&&(i=(t===A.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media,this.afterBufferFlushed(i,t,u.PlaylistLevelType.MAIN))},i.onLevelsUpdated=function(e,t){this.levels=t.levels},i.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},i.seekToStartPos=function(){var e,t=this.media,i=t.currentTime,r=this.startPosition;0<=r&&i<r&&(t.seeking?l.logger.log("could not seek to "+r+", already seeking at "+i):(0<(e=((e=s.BufferHelper.getBuffered(t)).length?e.start(0):0)-r)&&(e<this.config.maxBufferHole||e<this.config.maxFragLookUpTolerance)&&(l.logger.log("adjusting start position by "+e+" to match buffer start"),this.startPosition=r+=e),this.log("seek to target start position "+r+" from current time "+i),t.currentTime=r))},i._getAudioCodec=function(e){e=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e},i._loadBitrateTestFrag=function(r){var s=this;this._doFragLoad(r).then(function(e){var t,i=s.hls;!e||i.nextLoadLevel||s.fragContextChanged(r)||(s.fragLoadError=0,s.state=g.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1,(t=r.stats).parsing.start=t.parsing.end=t.buffering.start=t.buffering.end=self.performance.now(),i.trigger(m.Events.FRAG_LOADED,e))})},i._handleTransmuxComplete=function(e){var t="main",i=this.hls,r=e.remuxResult,e=e.chunkMeta,s=this.getCurrentContext(e);if(s){var a=s.frag,n=s.part,s=s.level,o=r.video,l=r.text,c=r.id3,d=r.initSegment,u=this.altAudio?void 0:r.audio;if(!this.fragContextChanged(a)){if(this.state=g.State.PARSING,d&&(d.tracks&&(this._bufferInitSegment(s,d.tracks,a,e),i.trigger(m.Events.FRAG_PARSING_INIT_SEGMENT,{frag:a,id:t,tracks:d.tracks})),h=d.initPTS,d=d.timescale,Object(f.isFiniteNumber)(h))&&(this.initPTS[a.cc]=h,i.trigger(m.Events.INIT_PTS_FOUND,{frag:a,id:t,initPTS:h,timescale:d})),o&&!1!==r.independent){if(s.details){var h=o.startPTS,d=o.endPTS,s=o.startDTS,p=o.endDTS;if(n)n.elementaryStreams[o.type]={startPTS:h,endPTS:d,startDTS:s,endDTS:p};else if(o.firstKeyFrame&&o.independent&&(this.couldBacktrack=!0),o.dropped&&o.independent){if(this.getLoadPosition()+this.config.maxBufferHole<h)return void this.backtrack(a);a.setElementaryStreamInfo(o.type,a.start,d,a.start,p,!0)}a.setElementaryStreamInfo(o.type,h,d,s,p),this.bufferFragmentData(o,a,n,e)}}else if(!1===r.independent)return void this.backtrack(a);u&&(h=u.startPTS,d=u.endPTS,s=u.startDTS,p=u.endDTS,n&&(n.elementaryStreams[A.ElementaryStreamTypes.AUDIO]={startPTS:h,endPTS:d,startDTS:s,endDTS:p}),a.setElementaryStreamInfo(A.ElementaryStreamTypes.AUDIO,h,d,s,p),this.bufferFragmentData(u,a,n,e)),null!=c&&null!=(o=c.samples)&&o.length&&(r={frag:a,id:t,samples:c.samples},i.trigger(m.Events.FRAG_PARSING_METADATA,r)),l&&(h={frag:a,id:t,samples:l.samples},i.trigger(m.Events.FRAG_PARSING_USERDATA,h))}}else this.warn("The loading context changed while buffering fragment "+e.sn+" of level "+e.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(e.level)},i._bufferInitSegment=function(e,i,r,s){var t,a,n,o,l,c=this;this.state===g.State.PARSING&&(this.audioOnly=!!i.audio&&!i.video,this.altAudio&&!this.audioOnly&&delete i.audio,t=i.audio,a=i.video,n=i.audiovideo,t&&(o=e.audioCodec,l=navigator.userAgent.toLowerCase(),this.audioCodecSwitch&&(o=o&&(-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==t.metadata.channelCount)&&-1===l.indexOf("firefox")&&(o="mp4a.40.5"),-1!==l.indexOf("android")&&"audio/mpeg"!==t.container&&this.log("Android: force audio codec to "+(o="mp4a.40.2")),e.audioCodec&&e.audioCodec!==o&&this.log('Swapping manifest audio codec "'+e.audioCodec+'" for "'+o+'"'),t.levelCodec=o,t.id="main",this.log("Init audio buffer, container:"+t.container+", codecs[selected/level/parsed]=["+(o||"")+"/"+(e.audioCodec||"")+"/"+t.codec+"]")),a&&(a.levelCodec=e.videoCodec,a.id="main",this.log("Init video buffer, container:"+a.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+a.codec+"]")),n&&this.log("Init audiovideo buffer, container:"+n.container+", codecs[level/parsed]=["+(e.attrs.CODECS||"")+"/"+n.codec+"]"),this.hls.trigger(m.Events.BUFFER_CODECS,i),Object.keys(i).forEach(function(e){var t=i[e].initSegment;null!=t&&t.byteLength&&c.hls.trigger(m.Events.BUFFER_APPENDING,{type:e,data:t,frag:r,part:null,chunkMeta:s,parent:r.type})}),this.tick())},i.backtrack=function(e){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(e);var t=this.fragmentTracker.backtrack(e);this.fragPrevious=null,this.nextLoadPosition=e.start,t?this.resetFragmentLoading(e):this.state=g.State.BACKTRACKING},i.checkFragmentChanged=function(){var e,t=this.media,i=null;t&&1<t.readyState&&!1===t.seeking&&(e=t.currentTime,s.BufferHelper.isBuffered(t,e)?i=this.getAppendedFrag(e):s.BufferHelper.isBuffered(t,e+.1)&&(i=this.getAppendedFrag(e+.1)),i)&&(t=this.fragPlaying,e=i.level,t&&i.sn===t.sn&&t.level===e&&i.urlId===t.urlId||(this.hls.trigger(m.Events.FRAG_CHANGED,{frag:i}),t&&t.level===e||this.hls.trigger(m.Events.LEVEL_SWITCHED,{level:e}),this.fragPlaying=i))},c(v.prototype,[{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentLevel",get:function(){var e=this.media;if(e){e=this.getAppendedFrag(e.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;return e?(e=this.getAppendedFrag(e.currentTime),this.followingBufferedFrag(e)):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]);var y,b=v;function v(e,t){return(e=y.call(this,e,t,"[stream-controller]")||this).audioCodecSwap=!1,e.gapController=null,e.level=-1,e._forceStartLoad=!1,e.altAudio=!1,e.audioOnly=!1,e.fragPlaying=null,e.onvplaying=null,e.onvseeked=null,e.fragLastKbps=0,e.stalled=!1,e.couldBacktrack=!1,e.audioCodecSwitch=!1,e.videoBuffer=null,e._registerListeners(),e}},"./src/controller/subtitle-stream-controller.ts":function(e,t,i){i.r(t),i.d(t,"SubtitleStreamController",function(){return g});var a=i("./src/events.ts"),l=i("./src/utils/buffer-helper.ts"),c=i("./src/controller/fragment-finders.ts"),n=i("./src/utils/discontinuities.ts"),o=i("./src/controller/level-helper.ts"),d=i("./src/controller/fragment-tracker.ts"),u=i("./src/controller/base-stream-controller.ts"),h=i("./src/types/loader.ts"),r=i("./src/types/level.ts");function s(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}f=u.default,t=f,(i=m).prototype=Object.create(t.prototype),p(i.prototype.constructor=i,t),(i=m.prototype).onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},i._registerListeners=function(){var e=this.hls;e.on(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(a.Events.ERROR,this.onError,this),e.on(a.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(a.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(a.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(a.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(a.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},i._unregisterListeners=function(){var e=this.hls;e.off(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(a.Events.ERROR,this.onError,this),e.off(a.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(a.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(a.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(a.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(a.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},i.startLoad=function(){this.stopLoad(),this.state=u.State.IDLE,this.setInterval(500),this.tick()},i.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},i.onLevelLoaded=function(e,t){this.mainDetails=t.details},i.onSubtitleFragProcessed=function(e,t){var i=t.frag,t=t.success;if(this.fragPrevious=i,this.state=u.State.IDLE,t){var r=this.tracksBuffered[this.currentTrackId];if(r){for(var s,a=i.start,n=0;n<r.length;n++)if(a>=r[n].start&&a<=r[n].end){s=r[n];break}t=i.start+i.duration;s?s.end=t:r.push(s={start:a,end:t}),this.fragmentTracker.fragBuffered(i)}}},i.onBufferFlushing=function(e,t){var i,r,s,a=t.startOffset,n=t.endOffset;0===a&&n!==Number.POSITIVE_INFINITY&&(i=this.currentTrackId,(r=this.levels).length)&&r[i]&&r[i].details&&((s=n-r[i].details.targetduration)<=0||(t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(function(e){for(var t=0;t<e.length;)if(e[t].end<=s)e.shift();else{if(!(e[t].start<s))break;e[t].start=s,t++}}),this.fragmentTracker.removeFragmentsInRange(a,s,h.PlaylistLevelType.SUBTITLE)))},i.onError=function(e,t){var t=t.frag;t&&t.type===h.PlaylistLevelType.SUBTITLE&&(null!=(t=this.fragCurrent)&&t.loader&&this.fragCurrent.loader.abort(),this.state=u.State.IDLE)},i.onSubtitleTracksUpdated=function(e,t){var i=this,t=t.subtitleTracks;this.tracksBuffered=[],this.levels=t.map(function(e){return new r.Level(e)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(e){i.tracksBuffered[e.id]=[]}),this.mediaBuffer=null},i.onSubtitleTrackSwitch=function(e,t){this.currentTrackId=t.id,this.levels.length&&-1!==this.currentTrackId?(null!=(t=this.levels[this.currentTrackId])&&t.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,t&&this.setInterval(500)):this.clearInterval()},i.onSubtitleTrackLoaded=function(e,t){var i=t.details,t=t.id,r=this.currentTrackId,s=this.levels;if(s.length){var a=s[r];if(!(t>=s.length||t!==r)&&a){if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||null!=(s=a.details)&&s.live){r=this.mainDetails;if(i.deltaUpdateFailed||!r)return;s=r.fragments[0];a.details?0===this.alignPlaylists(i,a.details)&&s&&Object(o.addSliding)(i,s.start):i.hasProgramDateTime&&r.hasProgramDateTime?Object(n.alignMediaPlaylistByPDT)(i,r):s&&Object(o.addSliding)(i,s.start)}a.details=i,this.levelLastLoaded=t,this.tick(),!i.live||this.fragCurrent||!this.media||this.state!==u.State.IDLE||Object(c.findFragmentByPTS)(null,i.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),a.details=void 0)}}},i._handleFragmentLoadComplete=function(e){var i,r=e.frag,e=e.payload,t=r.decryptdata,s=this.hls;!this.fragContextChanged(r)&&e&&0<e.byteLength&&t&&t.key&&t.iv&&"AES-128"===t.method&&(i=performance.now(),this.decrypter.webCryptoDecrypt(new Uint8Array(e),t.key.buffer,t.iv.buffer).then(function(e){var t=performance.now();s.trigger(a.Events.FRAG_DECRYPTED,{frag:r,payload:e,stats:{tstart:i,tdecrypt:t}})}))},i.doTick=function(){var e,t,i,r,s,a,n,o;this.media?this.state===u.State.IDLE&&(a=this.currentTrackId,(e=this.levels).length)&&e[a]&&e[a].details&&(a=(e=e[a].details).targetduration,t=this.config,s=this.media,i=(s=l.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,s.currentTime-a,t.maxBufferHole)).end,s.len>this.getMaxBufferLength()+a||(console.assert(e,"Subtitle track details are defined on idle subtitle stream controller tick"),a=(s=e.fragments).length,o=e.edge,n=this.fragPrevious,i<o?(o=t.maxFragLookUpTolerance,!(r=Object(c.findFragmentByPTS)(n,s,i,o))&&n&&n.start<s[0].start&&(r=s[0])):r=s[a-1],null!=(t=r)&&t.encrypted?this.loadKey(r,e):r&&this.fragmentTracker.getState(r)===d.FragmentState.NOT_LOADED&&this.loadFragment(r,e,i))):this.state=u.State.IDLE},i.loadFragment=function(e,t,i){this.fragCurrent=e,f.prototype.loadFragment.call(this,e,t,i)},s(m.prototype,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]);var f,g=m;function m(e,t){return(e=f.call(this,e,t,"[subtitle-stream-controller]")||this).levels=[],e.currentTrackId=-1,e.tracksBuffered=[],e.mainDetails=null,e._registerListeners(),e}},"./src/controller/subtitle-track-controller.ts":function(e,t,i){i.r(t);var l=i("./src/events.ts"),r=i("./src/utils/texttrack-utils.ts"),s=i("./src/controller/base-playlist-controller.ts"),a=i("./src/types/loader.ts");function n(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}c=s.default,i=c,(s=d).prototype=Object.create(i.prototype),o(s.prototype.constructor=s,i),(s=d.prototype).destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,c.prototype.destroy.call(this)},s.registerListeners=function(){var e=this.hls;e.on(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(l.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(l.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(l.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var e=this.hls;e.off(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(l.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(l.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(l.Events.ERROR,this.onError,this)},s.onMediaAttached=function(e,t){this.media=t.media,this.media&&(-1<this.queuedDefaultTrack&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},s.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},s.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),-1<this.trackId&&(this.queuedDefaultTrack=this.trackId),u(this.media.textTracks).forEach(function(e){Object(r.clearCurrentCues)(e)}),this.subtitleTrack=-1,this.media=null)},s.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},s.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},s.onSubtitleTrackLoaded=function(e,t){var i,r=t.id,s=t.details,a=this.trackId,a=this.tracksInGroup[a];a?(i=a.details,a.details=t.details,this.log("subtitle track "+r+" loaded ["+s.startSN+"-"+s.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,i))):this.warn("Invalid subtitle track id "+r)},s.onLevelLoading=function(e,t){this.switchLevel(t.level)},s.onLevelSwitching=function(e,t){this.switchLevel(t.level)},s.switchLevel=function(e){var t,i,r,s,e=this.hls.levels[e];null!=e&&e.textGroupIds&&(t=e.textGroupIds[e.urlId],this.groupId!==t)&&(e=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,i=this.tracks.filter(function(e){return!t||e.groupId===t}),this.tracksInGroup=i,r=this.findTrackId(null==e?void 0:e.name)||this.findTrackId(),this.groupId=t,s={subtitleTracks:i},this.log("Updating subtitle tracks, "+i.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(l.Events.SUBTITLE_TRACKS_UPDATED,s),-1!==r)&&this.setSubtitleTrack(r,e)},s.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;i<t.length;i++){var r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||e===r.name))return r.id}return-1},s.onError=function(e,t){c.prototype.onError.call(this,e,t),!t.fatal&&t.context&&t.context.type===a.PlaylistContextType.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},s.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var i=t.id,r=t.groupId,t=t.url;if(e)try{t=e.addDirectives(t)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Loading subtitle playlist for id "+i),this.hls.trigger(l.Events.SUBTITLE_TRACK_LOADING,{url:t,id:i,groupId:r,deliveryDirectives:e||null})}},s.toggleTrackModes=function(e){var t,i=this,r=this.media,s=this.subtitleDisplay,a=this.trackId;r&&(t=(r=u(r.textTracks)).filter(function(e){return e.groupId===i.groupId}),-1===e?[].slice.call(r).forEach(function(e){e.mode="disabled"}):(r=t[a])&&(r.mode="disabled"),a=t[e])&&(a.mode=s?"showing":"hidden")},s.setSubtitleTrack=function(e,t){var i,r,s,a,n,o=this.tracksInGroup;this.media?(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(-1===e||null!=(i=o[e])&&i.details)||e<-1||e>=o.length||(this.clearTimer(),i=o[e],this.log("Switching to subtitle track "+e),this.trackId=e,i?(o=i.id,r=i.groupId,s=i.name,a=i.type,n=i.url,this.hls.trigger(l.Events.SUBTITLE_TRACK_SWITCH,{id:o,groupId:void 0===r?"":r,name:s,type:a,url:n}),o=this.switchParams(i.url,null==t?void 0:t.details),this.loadPlaylist(o)):this.hls.trigger(l.Events.SUBTITLE_TRACK_SWITCH,{id:e}))):this.queuedDefaultTrack=e},s.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=u(this.media.textTracks),i=0;i<t.length;i++)if("hidden"===t[i].mode)e=i;else if("showing"===t[i].mode){e=i;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)}},n(d.prototype,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1;var t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}}]);var c,i=d;function d(e){var t;return(t=c.call(this,e,"[subtitle-track-controller]")||this).media=null,t.tracks=[],t.groupId=null,t.tracksInGroup=[],t.trackId=-1,t.selectDefaultTrack=!0,t.queuedDefaultTrack=-1,t.trackChangeListener=function(){return t.onTextTracksChanged()},t.asyncPollTrackChange=function(){return t.pollTrackChange(0)},t.useTextTrackPolling=!1,t.subtitlePollingInterval=-1,t.subtitleDisplay=!0,t.registerListeners(),t}function u(e){for(var t=[],i=0;i<e.length;i++){var r=e[i];"subtitles"===r.kind&&r.label&&t.push(e[i])}return t}t.default=i},"./src/controller/timeline-controller.ts":function(e,t,i){i.r(t),i.d(t,"TimelineController",function(){return r});var l=i("./src/polyfills/number.ts"),h=i("./src/events.ts"),a=i("./src/utils/cea-608-parser.ts"),n=i("./src/utils/output-filter.ts"),o=i("./src/utils/webvtt-parser.ts"),c=i("./src/utils/texttrack-utils.ts"),d=i("./src/utils/imsc1-ttml-parser.ts"),u=i("./src/types/loader.ts"),p=i("./src/utils/logger.ts"),r=((t=s.prototype).destroy=function(){var e=this.hls;e.off(h.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(h.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(h.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(h.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(h.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(h.Events.FRAG_LOADING,this.onFragLoading,this),e.off(h.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(h.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(h.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(h.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(h.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(h.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},t.addCues=function(e,t,i,r,s){for(var a,n,o,l=!1,c=s.length;c--;){var d=s[c],u=(a=d[0],u=d[1],n=t,Math.min(u,i)-Math.max(a,n));if(0<=u&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],i),l=!0,.5<u/(i-t)))return}l||s.push([t,i]),this.config.renderTextTracksNatively?(o=this.captionsTracks[e],this.Cues.newCue(o,t,i,r)):(o=this.Cues.newCue(null,t,i,r),this.hls.trigger(h.Events.CUES_PARSED,{type:"captions",cues:o,track:e}))},t.onInitPtsFound=function(e,t){var i=this,r=t.frag,s=t.id,a=t.initPTS,t=t.timescale,n=this.unparsedVttFrags;"main"===s&&(this.initPTS[r.cc]=a,this.timescale[r.cc]=t),n.length&&(this.unparsedVttFrags=[],n.forEach(function(e){i.onFragLoaded(h.Events.FRAG_LOADED,e)}))},t.getExistingTrack=function(e){var t=this.media;if(t)for(var i=0;i<t.textTracks.length;i++){var r=t.textTracks[i];if(r[e])return r}return null},t.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},t.createNativeTrack=function(e){var t,i,r,s,a;this.captionsTracks[e]||(s=this.captionsProperties,t=this.captionsTracks,i=this.media,r=(s=s[e]).label,s=s.languageCode,(a=this.getExistingTrack(e))?(t[e]=a,Object(c.clearCurrentCues)(t[e]),Object(c.sendAddTrackEvent)(t[e],i)):(a=this.createTextTrack("captions",r,s))&&(a[e]=!0,t[e]=a))},t.createNonNativeTrack=function(e){var t;this.nonNativeCaptionsTracks[e]||(t=this.captionsProperties[e])&&(t={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media},this.nonNativeCaptionsTracks[e]=t,this.hls.trigger(h.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[t]}))},t.createTextTrack=function(e,t,i){var r=this.media;if(r)return r.addTextTrack(e,t,i)},t.onMediaAttaching=function(e,t){this.media=t.media,this._cleanTracks()},t.onMediaDetaching=function(){var t=this.captionsTracks;Object.keys(t).forEach(function(e){Object(c.clearCurrentCues)(t[e]),delete t[e]}),this.nonNativeCaptionsTracks={}},t.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},t._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var i=0;i<t.length;i++)Object(c.clearCurrentCues)(t[i])}},t.onSubtitleTracksUpdated=function(e,t){var o,l=this,t=(this.textTracks=[],t.subtitleTracks||[]),i=t.some(function(e){return e.textCodec===d.IMSC1_CODEC});(this.config.enableWebVTT||i&&this.config.enableIMSC1)&&(i=this.tracks&&t&&this.tracks.length===t.length,this.tracks=t||[],this.config.renderTextTracksNatively?(o=this.media?this.media.textTracks:[],this.tracks.forEach(function(e,t){var i,r,s;if(t<o.length){for(var a=null,n=0;n<o.length;n++)if(r=o[n],s=e,r&&r.label===s.name&&!r.textTrack1&&!r.textTrack2){a=o[n];break}a&&(i=a)}i?Object(c.clearCurrentCues)(i):(i=l.createTextTrack("subtitles",e.name,e.lang))&&(i.mode="disabled"),i&&(i.groupId=e.groupId,l.textTracks.push(i))})):!i&&this.tracks&&this.tracks.length&&(t=this.tracks.map(function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}),this.hls.trigger(h.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:t})))},t.onManifestLoaded=function(e,t){var i=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(function(e){var t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);t&&(t="textTrack"+t[1],t=i.captionsProperties[t])&&(t.label=e.name,e.lang&&(t.languageCode=e.lang),t.media=e)})},t.onFragLoading=function(e,t){var i,r=this.cea608Parser1,s=this.cea608Parser2,a=this.lastSn,n=this.lastPartIndex;this.enabled&&r&&s&&t.frag.type===u.PlaylistLevelType.MAIN&&(i=t.frag.sn,t=null!=(t=null==t||null==(t=t.part)?void 0:t.index)?t:-1,i===a+1||i===a&&t===n+1||(r.reset(),s.reset()),this.lastSn=i,this.lastPartIndex=t)},t.onFragLoaded=function(e,t){var i,r,s=t.frag,a=t.payload,n=this.initPTS,o=this.unparsedVttFrags;s.type===u.PlaylistLevelType.SUBTITLE&&(a.byteLength?Object(l.isFiniteNumber)(n[s.cc])?(i=s.decryptdata,r="stats"in t,null!=i&&null!=i.key&&"AES-128"===i.method&&!r||(i=this.tracks[s.level],(r=this.vttCCs)[s.cc]||(r[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),i&&i.textCodec===d.IMSC1_CODEC?this._parseIMSC1(s,a):this._parseVTTs(s,a,r))):(o.push(t),n.length&&this.hls.trigger(h.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Missing initial subtitle PTS")})):this.hls.trigger(h.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")}))},t._parseIMSC1=function(t,e){var i=this,r=this.hls;Object(d.parseIMSC1)(e,this.initPTS[t.cc],this.timescale[t.cc],function(e){i._appendCues(e,t.level),r.trigger(h.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},function(e){p.logger.log("Failed to parse IMSC1: "+e),r.trigger(h.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})})},t._parseVTTs=function(t,i,e){var r=this,s=this.hls;Object(o.parseWebVTT)(i,this.initPTS[t.cc],this.timescale[t.cc],e,t.cc,t.start,function(e){r._appendCues(e,t.level),s.trigger(h.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},function(e){r._fallbackToIMSC1(t,i),p.logger.log("Failed to parse VTT cue: "+e),s.trigger(h.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})})},t._fallbackToIMSC1=function(e,t){var i=this,r=this.tracks[e.level];r.textCodec||Object(d.parseIMSC1)(t,this.initPTS[e.cc],this.timescale[e.cc],function(){r.textCodec=d.IMSC1_CODEC,i._parseIMSC1(e,t)},function(){r.textCodec="wvtt"})},t._appendCues=function(e,t){var i,r=this.hls;this.config.renderTextTracksNatively?"disabled"!==(i=this.textTracks[t]).mode&&e.forEach(function(e){return Object(c.addCueToTrack)(i,e)}):(t=this.tracks[t].default?"default":"subtitles"+t,r.trigger(h.Events.CUES_PARSED,{type:"subtitles",cues:e,track:t}))},t.onFragDecrypted=function(e,t){var i=t.frag;i.type===u.PlaylistLevelType.SUBTITLE&&(Object(l.isFiniteNumber)(this.initPTS[i.cc])?this.onFragLoaded(h.Events.FRAG_LOADED,t):this.unparsedVttFrags.push(t))},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,r=this.cea608Parser2;if(this.enabled&&i&&r)for(var s=0;s<t.samples.length;s++){var a=t.samples[s].bytes;a&&(a=this.extractCea608Data(a),i.addData(t.samples[s].pts,a[0]),r.addData(t.samples[s].pts,a[1]))}},t.onBufferFlushing=function(e,t){var i,r,s=t.startOffset,a=t.endOffset,n=t.endOffsetSubtitles,t=t.type,o=this.media;!o||o.currentTime<a||(t&&"video"!==t||(i=this.captionsTracks,Object.keys(i).forEach(function(e){return Object(c.removeCuesInRange)(i[e],s,a)})),this.config.renderTextTracksNatively&&0===s&&void 0!==n&&(r=this.textTracks,Object.keys(r).forEach(function(e){return Object(c.removeCuesInRange)(r[e],s,n)})))},t.extractCea608Data=function(e){for(var t=31&e[0],i=2,r=[[],[]],s=0;s<t;s++){var a=e[i++],n=127&e[i++],o=127&e[i++],l=3&a;0==n&&0==o||0==(4&a)||0!=l&&1!=l||(r[l].push(n),r[l].push(o))}return r},s);function s(e){var t,i,r,s;this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions&&(t=new n.default(this,"textTrack1"),i=new n.default(this,"textTrack2"),r=new n.default(this,"textTrack3"),s=new n.default(this,"textTrack4"),this.cea608Parser1=new a.default(1,t,i),this.cea608Parser2=new a.default(3,r,s)),e.on(h.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(h.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(h.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(h.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(h.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(h.Events.FRAG_LOADING,this.onFragLoading,this),e.on(h.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(h.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(h.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(h.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(h.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(h.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}},"./src/crypt/aes-crypto.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r});s.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)};var r=s;function s(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}},"./src/crypt/aes-decryptor.ts":function(e,t,i){i.r(t),i.d(t,"removePadding",function(){return s}),i.d(t,"default",function(){return a});var r=i("./src/utils/typed-array.ts");function s(e){var t=e.byteLength,i=t&&new DataView(e.buffer).getUint8(t-1);return i?Object(r.sliceUint8)(e,0,t-i):e}(t=n.prototype).uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),i=new Uint32Array(4),r=0;r<4;r++)i[r]=t.getUint32(4*r);return i},t.initTable=function(){for(var e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],s=i[1],a=i[2],n=i[3],i=this.invSubMix,o=i[0],l=i[1],c=i[2],d=i[3],u=new Uint32Array(256),h=0,p=0,f=0,f=0;f<256;f++)u[f]=f<128?f<<1:f<<1^283;for(f=0;f<256;f++){var g=p^p<<1^p<<2^p<<3^p<<4,m=(e[h]=g=g>>>8^255&g^99,u[t[g]=h]),A=u[m],y=u[A],b=257*u[g]^16843008*g;r[h]=b<<24|b>>>8,s[h]=b<<16|b>>>16,a[h]=b<<8|b>>>24,n[h]=b,o[g]=(b=16843009*y^65537*A^257*m^16843008*h)<<24|b>>>8,l[g]=b<<16|b>>>16,c[g]=b<<8|b>>>24,d[g]=b,h?(h=m^u[u[u[y^m]]],p^=u[u[p]]):h=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,r=0;r<t.length&&i;)i=t[r]===this.key[r],r++;if(!i){this.key=t;var s=this.keySize=t.length;if(4!==s&&6!==s&&8!==s)throw new Error("Invalid aes key size="+s);for(var a,n,o,l=this.ksRows=4*(s+6+1),c=this.keySchedule=new Uint32Array(l),d=this.invKeySchedule=new Uint32Array(l),u=this.sBox,h=this.rcon,e=this.invSubMix,p=e[0],f=e[1],g=e[2],m=e[3],A=0;A<l;A++)A<s?n=c[A]=t[A]:(o=n,A%s==0?(o=u[(o=o<<8|o>>>24)>>>24]<<24|u[o>>>16&255]<<16|u[o>>>8&255]<<8|u[255&o],o^=h[A/s|0]<<24):6<s&&A%s==4&&(o=u[o>>>24]<<24|u[o>>>16&255]<<16|u[o>>>8&255]<<8|u[255&o]),c[A]=n=(c[A-s]^o)>>>0);for(a=0;a<l;a++)A=l-a,o=3&a?c[A]:c[A-4],d[a]=a<4||A<=4?o:p[u[o>>>24]]^f[u[o>>>16&255]]^g[u[o>>>8&255]]^m[u[255&o]],d[a]=d[a]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,i){for(var r,s,a,n,o,l,c,d,u,h,p,f,g,m,A=this.keySize+6,y=this.invKeySchedule,b=this.invSBox,v=this.invSubMix,E=v[0],w=v[1],T=v[2],S=v[3],v=this.uint8ArrayToUint32Array_(i),k=v[0],_=v[1],C=v[2],R=v[3],D=new Int32Array(e),L=new Int32Array(D.length),x=this.networkToHostOrderSwap;t<D.length;){for(u=x(D[t]),h=x(D[t+1]),p=x(D[t+2]),f=x(D[t+3]),o=u^y[0],l=f^y[1],c=p^y[2],d=h^y[3],g=4,m=1;m<A;m++)r=E[o>>>24]^w[l>>16&255]^T[c>>8&255]^S[255&d]^y[g],s=E[l>>>24]^w[c>>16&255]^T[d>>8&255]^S[255&o]^y[g+1],a=E[c>>>24]^w[d>>16&255]^T[o>>8&255]^S[255&l]^y[g+2],n=E[d>>>24]^w[o>>16&255]^T[l>>8&255]^S[255&c]^y[g+3],o=r,l=s,c=a,d=n,g+=4;r=b[o>>>24]<<24^b[l>>16&255]<<16^b[c>>8&255]<<8^b[255&d]^y[g],s=b[l>>>24]<<24^b[c>>16&255]<<16^b[d>>8&255]<<8^b[255&o]^y[g+1],a=b[c>>>24]<<24^b[d>>16&255]<<16^b[o>>8&255]<<8^b[255&l]^y[g+2],n=b[d>>>24]<<24^b[o>>16&255]<<16^b[l>>8&255]<<8^b[255&c]^y[g+3],L[t]=x(r^k),L[t+1]=x(n^_),L[t+2]=x(a^C),L[t+3]=x(s^R),k=u,_=h,C=p,R=f,t+=4}return L.buffer};var a=n;function n(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}},"./src/crypt/decrypter.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r});var n=i("./src/crypt/aes-crypto.ts"),o=i("./src/crypt/fast-aes-key.ts"),l=i("./src/crypt/aes-decryptor.ts"),s=i("./src/utils/logger.ts"),c=i("./src/utils/mp4-tools.ts"),d=i("./src/utils/typed-array.ts"),r=((t=a.prototype).destroy=function(){this.observer=null},t.isSync=function(){return this.config.enableSoftwareAES},t.flush=function(){var e=this.currentResult;if(e)return e=new Uint8Array(e),this.reset(),this.removePKCS7Padding?Object(l.removePadding)(e):e;this.reset()},t.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},t.decrypt=function(e,t,i,r){var s;this.config.enableSoftwareAES?(this.softwareDecrypt(new Uint8Array(e),t,i),(s=this.flush())&&r(s.buffer)):this.webCryptoDecrypt(new Uint8Array(e),t,i).then(r)},t.softwareDecrypt=function(e,t,i){var r=this.currentIV,s=this.currentResult,a=this.remainderData,a=(this.logOnce("JS AES decrypt"),a&&(e=Object(c.appendUint8Array)(a,e),this.remainderData=null),this.getValidChunk(e));if(!a.length)return null;r&&(i=r);e=this.softwareDecrypter,(e=e||(this.softwareDecrypter=new l.default)).expandKey(t),r=s;return this.currentResult=e.decrypt(a.buffer,0,i),this.currentIV=Object(d.sliceUint8)(a,-16).buffer,r||null},t.webCryptoDecrypt=function(t,i,r){var s=this,a=this.subtle;return this.key===i&&this.fastAesKey||(this.key=i,this.fastAesKey=new o.default(a,i)),this.fastAesKey.expandKey().then(function(e){return a?new n.default(a,r).decrypt(t.buffer,e):Promise.reject(new Error("web crypto not initialized"))}).catch(function(e){return s.onWebCryptoError(e,t,i,r)})},t.onWebCryptoError=function(e,t,i,r){return s.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",e),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(t,i,r)},t.getValidChunk=function(e){var t=e,i=e.length-e.length%16;return i!==e.length&&(t=Object(d.sliceUint8)(e,0,i),this.remainderData=Object(d.sliceUint8)(e,i)),t},t.logOnce=function(e){this.logEnabled&&(s.logger.log("[decrypter.ts]: "+e),this.logEnabled=!1)},a);function a(e,t,i){i=(void 0===i?{}:i).removePKCS7Padding,i=void 0===i||i;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=e,this.config=t,this.removePKCS7Padding=i)try{var r=self.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch(e){}null===this.subtle&&(this.config.enableSoftwareAES=!0)}},"./src/crypt/fast-aes-key.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r});s.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])};var r=s;function s(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}},"./src/demux/aacdemuxer.ts":function(e,t,i){i.r(t);var r=i("./src/demux/base-audio-demuxer.ts"),s=i("./src/demux/adts.ts"),a=i("./src/utils/logger.ts"),n=i("./src/demux/id3.ts");function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}l=r.default,i=l,(r=c).prototype=Object.create(i.prototype),o(r.prototype.constructor=r,i),(r=c.prototype).resetInitSegment=function(e,t,i){l.prototype.resetInitSegment.call(this,e,t,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:e,duration:i,inputTimeScale:9e4,dropped:0}},c.probe=function(e){if(e)for(var t=(n.getID3Data(e,0)||[]).length,i=e.length;t<i;t++)if(s.probe(e,t))return a.logger.log("ADTS sync word found !"),!0;return!1},r.canParse=function(e,t){return s.canParse(e,t)},r.appendFrame=function(e,t,i){s.initTrackConfig(e,this.observer,t,i,e.manifestCodec);e=s.appendFrame(e,t,i,this.initPTS,this.frameIndex);if(e&&0===e.missing)return e};var l,i=c;function c(e,t){var i;return(i=l.call(this)||this).observer=void 0,i.config=void 0,i.observer=e,i.config=t,i}i.minProbeByteLength=9,t.default=i},"./src/demux/adts.ts":function(e,t,i){i.r(t),i.d(t,"getAudioConfig",function(){return a}),i.d(t,"isHeaderPattern",function(){return r}),i.d(t,"getHeaderLength",function(){return n}),i.d(t,"getFullFrameLength",function(){return o}),i.d(t,"canGetFrameLength",function(){return s}),i.d(t,"isHeader",function(){return l}),i.d(t,"canParse",function(){return c}),i.d(t,"probe",function(){return d}),i.d(t,"initTrackConfig",function(){return f}),i.d(t,"getFrameDuration",function(){return g}),i.d(t,"parseFrameHeader",function(){return m}),i.d(t,"appendFrame",function(){return A});var u=i("./src/utils/logger.ts"),h=i("./src/errors.ts"),p=i("./src/events.ts");function a(e,t,i,r){var s,a,n=navigator.userAgent.toLowerCase(),o=r,l=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],c=1+((192&t[i+2])>>>6),d=(60&t[i+2])>>>2;if(!(l.length-1<d))return s=(1&t[i+2])<<2,s|=(192&t[i+3])>>>6,u.logger.log("manifest codec:"+r+", ADTS type:"+c+", samplingIndex:"+d),t=/firefox/i.test(n)?6<=d?(c=5,a=new Array(4),d-3):(c=2,a=new Array(2),d):-1!==n.indexOf("android")?(c=2,a=new Array(2),d):(c=5,a=new Array(4),r&&(-1!==r.indexOf("mp4a.40.29")||-1!==r.indexOf("mp4a.40.5"))||!r&&6<=d?d-3:((r&&-1!==r.indexOf("mp4a.40.2")&&(6<=d&&1==s||/vivaldi/i.test(n))||!r&&1==s)&&(c=2,a=new Array(2)),d)),a[0]=c<<3,a[0]|=(14&d)>>1,a[1]|=(1&d)<<7,a[1]|=s<<3,5===c&&(a[1]|=(14&t)>>1,a[2]=(1&t)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:l[d],channelCount:s,codec:"mp4a.40."+c,manifestCodec:o};e.trigger(p.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+d})}function r(e,t){return 255===e[t]&&240==(246&e[t+1])}function n(e,t){return 1&e[t+1]?7:9}function o(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function s(e,t){return t+5<e.length}function l(e,t){return t+1<e.length&&r(e,t)}function c(e,t){return s(e,t)&&r(e,t)&&o(e,t)<=e.length-t}function d(e,t){var i,r;return!!l(e,t)&&!(t+(r=n(e,t))>=e.length||(i=o(e,t))<=r)&&((r=t+i)===e.length||l(e,r))}function f(e,t,i,r,s){e.samplerate||(t=a(t,i,r,s))&&(e.config=t.config,e.samplerate=t.samplerate,e.channelCount=t.channelCount,e.codec=t.codec,e.manifestCodec=t.manifestCodec,u.logger.log("parsed codec:"+e.codec+", rate:"+t.samplerate+", channels:"+t.channelCount))}function g(e){return 9216e4/e}function m(e,t,i,r,s){var a=n(e,t),e=o(e,t);if(0<(e-=a))return{headerLength:a,frameLength:e,stamp:i+r*s}}function A(e,t,i,r,s){var a,n,o,r=m(t,i,r,s,g(e.samplerate));if(r)return s=r.frameLength,n=r.headerLength,r=r.stamp,s=n+s,(o=Math.max(0,i+s-t.length))?(a=new Uint8Array(s-n)).set(t.subarray(i+n,t.length),0):a=t.subarray(i+n,i+s),t={unit:a,pts:r},o||e.samples.push(t),{sample:t,length:s,missing:o}}},"./src/demux/base-audio-demuxer.ts":function(e,t,i){i.r(t),i.d(t,"initPTSFn",function(){return g});var r=i("./src/polyfills/number.ts"),u=i("./src/demux/id3.ts"),h=i("./src/demux/dummy-demuxed-track.ts"),p=i("./src/utils/mp4-tools.ts"),f=i("./src/utils/typed-array.ts");(i=s.prototype).resetInitSegment=function(e,t,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},i.resetTimeStamp=function(){},i.resetContiguity=function(){},i.canParse=function(e,t){return!1},i.appendFrame=function(e,t,i){},i.demux=function(e,t){this.cachedData&&(e=Object(p.appendUint8Array)(this.cachedData,e),this.cachedData=null);var i,r,s,a=u.getID3Data(e,0),n=a?a.length:0,o=this._audioTrack,l=this._id3Track,c=a?u.getTimeStamp(a):void 0,d=e.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=g(c,t)),a&&0<a.length&&l.samples.push({pts:this.initPTS,dts:this.initPTS,data:a}),r=this.initPTS;n<d;)this.canParse(e,n)?(s=this.appendFrame(o,e,n))?(this.frameIndex++,r=s.sample.pts,i=n+=s.length):n=d:u.canParse(e,n)?(a=u.getID3Data(e,n),l.samples.push({pts:r,dts:r,data:a}),i=n+=a.length):n++,n===d&&i!==d&&(s=Object(f.sliceUint8)(e,i),this.cachedData?this.cachedData=Object(p.appendUint8Array)(this.cachedData,s):this.cachedData=s);return{audioTrack:o,avcTrack:Object(h.dummyTrack)(),id3Track:l,textTrack:Object(h.dummyTrack)()}},i.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},i.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(h.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(h.dummyTrack)()}},i.destroy=function(){};var g=function(e,t){return Object(r.isFiniteNumber)(e)?90*e:9e4*t};function s(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}t.default=s},"./src/demux/chunk-cache.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r});(i=s.prototype).push=function(e){this.chunks.push(e),this.dataLength+=e.length},i.flush=function(){var e=this.chunks,a=this.dataLength;return e.length?(e=1===e.length?e[0]:function(e){for(var t=new Uint8Array(a),i=0,r=0;r<e.length;r++){var s=e[r];t.set(s,i),i+=s.length}return t}(e),this.reset(),e):new Uint8Array(0)},i.reset=function(){this.chunks.length=0,this.dataLength=0};var r=s;function s(){this.chunks=[],this.dataLength=0}},"./src/demux/dummy-demuxed-track.ts":function(e,t,i){function r(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}i.r(t),i.d(t,"dummyTrack",function(){return r})},"./src/demux/exp-golomb.ts":function(e,t,i){i.r(t);var r=i("./src/utils/logger.ts");function s(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}(i=s.prototype).loadWord=function(){var e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),t=Math.min(4,t);if(0===t)throw new Error("no bytes available");r.set(e.subarray(i,i+t)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*t,this.bytesAvailable-=t},i.skipBits=function(e){var t;this.bitsAvailable>e||(e=(e-=this.bitsAvailable)-((t=e>>3)>>3),this.bytesAvailable-=t,this.loadWord()),this.word<<=e,this.bitsAvailable-=e},i.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;return 32<e&&r.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,0<this.bitsAvailable?this.word<<=t:0<this.bytesAvailable&&this.loadWord(),0<(t=e-t)&&this.bitsAvailable?i<<t|this.readBits(t):i},i.skipLZ=function(){for(var e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},i.skipUEG=function(){this.skipBits(1+this.skipLZ())},i.skipEG=function(){this.skipBits(1+this.skipLZ())},i.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},i.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},i.readBoolean=function(){return 1===this.readBits(1)},i.readUByte=function(){return this.readBits(8)},i.readUShort=function(){return this.readBits(16)},i.readUInt=function(){return this.readBits(32)},i.skipScalingList=function(e){for(var t=8,i=8,r=0;r<e;r++)t=0===(i=0!==i?(t+this.readEG()+256)%256:i)?t:i},i.readSPS=function(){var e,t,i,r=0,s=0,a=0,n=0,o=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),d=this.readBoolean.bind(this),u=this.skipBits.bind(this),h=this.skipEG.bind(this),p=this.skipUEG.bind(this),f=this.skipScalingList.bind(this),g=(o(),o());if(l(5),u(3),o(),p(),100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g){g=c();if(3===g&&u(1),p(),p(),u(1),d())for(t=3!==g?8:12,i=0;i<t;i++)d()&&f(i<6?16:64)}p();g=c();if(0===g)c();else if(1===g)for(u(1),h(),h(),e=c(),i=0;i<e;i++)h();p(),u(1);var g=c(),p=c(),l=l(1),m=(0===l&&u(1),u(1),d()&&(r=c(),s=c(),a=c(),n=c()),[1,1]);if(d()&&d())switch(o()){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:m=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(g+1)-2*r-2*s),height:(2-l)*(p+1)*16-(l?2:4)*(a+n),pixelRatio:m}},i.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t.default=s},"./src/demux/id3.ts":function(e,t,i){i.r(t),i.d(t,"isHeader",function(){return o}),i.d(t,"isFooter",function(){return l}),i.d(t,"getID3Data",function(){return r}),i.d(t,"canParse",function(){return s}),i.d(t,"getTimeStamp",function(){return a}),i.d(t,"isTimeStampFrame",function(){return n}),i.d(t,"getID3Frames",function(){return h}),i.d(t,"decodeFrame",function(){return p}),i.d(t,"utf8ArrayToStr",function(){return y}),i.d(t,"testables",function(){return b});var d,o=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},l=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},r=function(e,t){for(var i=t,r=0;o(e,t);)r=(r+=10)+c(e,t+6),l(e,t+10)&&(r+=10),t+=r;if(0<r)return e.subarray(i,i+r)},c=function(e,t){var i=0,i=(127&e[t])<<21;return(i=(i|=(127&e[t+1])<<14)|(127&e[t+2])<<7)|127&e[t+3]},s=function(e,t){return o(e,t)&&c(e,t+6)+10<=e.length-t},a=function(e){for(var t=h(e),i=0;i<t.length;i++){var r=t[i];if(n(r))return A(r)}},n=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},u=function(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=c(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}},h=function(e){for(var t=0,i=[];o(e,t);){for(var r=c(e,t+6),s=(t+=10)+r;t+8<s;){var a=u(e.subarray(t)),n=p(a);n&&i.push(n),t+=a.size+10}l(e,t)&&(t+=10)}return i},p=function(e){return("PRIV"===e.type?f:"W"===e.type[0]?m:g)(e)},f=function(e){var t,i;if(!(e.size<2))return t=y(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1)),{key:e.type,info:t,data:i.buffer}},g=function(e){var t,i;if(!(e.size<2))return"TXXX"===e.type?(t=1,t+=(i=y(e.data.subarray(1),!0)).length+1,t=y(e.data.subarray(t)),{key:e.type,info:i,data:t}):(i=y(e.data.subarray(1)),{key:e.type,data:i})},m=function(e){var t,i;return"WXXX"===e.type?e.size<2?void 0:(t=1,t+=(i=y(e.data.subarray(1),!0)).length+1,t=y(e.data.subarray(t)),{key:e.type,info:i,data:t}):(i=y(e.data),{key:e.type,data:i})},A=function(e){var t;if(8===e.data.byteLength)return t=1&(e=new Uint8Array(e.data))[3],e=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7],e/=45,t&&(e+=47721858.84),Math.round(e)},y=function(e,t){void 0===t&&(t=!1);var i,r;d=d||void 0===self.TextDecoder?d:new self.TextDecoder("utf-8");if(d)return i=d.decode(e),t?-1!==(r=i.indexOf("\0"))?i.substring(0,r):i:i.replace(/\0/g,"");for(var s,a,n,o=e.length,l="",c=0;c<o;){if(0===(s=e[c++])&&t)return l;if(0!==s&&3!==s)switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(s);break;case 12:case 13:a=e[c++],l+=String.fromCharCode((31&s)<<6|63&a);break;case 14:a=e[c++],n=e[c++],l+=String.fromCharCode((15&s)<<12|(63&a)<<6|(63&n)<<0)}}return l},b={decodeTextFrame:g}},"./src/demux/mp3demuxer.ts":function(e,t,i){i.r(t);var r=i("./src/demux/base-audio-demuxer.ts"),s=i("./src/demux/id3.ts"),a=i("./src/utils/logger.ts"),n=i("./src/demux/mpegaudio.ts");function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}l=r.default,i=l,(r=c).prototype=Object.create(i.prototype),o(r.prototype.constructor=r,i),(r=c.prototype).resetInitSegment=function(e,t,i){l.prototype.resetInitSegment.call(this,e,t,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:e,duration:i,inputTimeScale:9e4,dropped:0}},c.probe=function(e){if(e)for(var t=(s.getID3Data(e,0)||[]).length,i=e.length;t<i;t++)if(n.probe(e,t))return a.logger.log("MPEG Audio sync word found !"),!0;return!1},r.canParse=function(e,t){return n.canParse(e,t)},r.appendFrame=function(e,t,i){if(null!==this.initPTS)return n.appendFrame(e,t,i,this.initPTS,this.frameIndex)};var l,i=c;function c(){return l.apply(this,arguments)||this}i.minProbeByteLength=4,t.default=i},"./src/demux/mp4demuxer.ts":function(e,t,i){i.r(t);var r=i("./src/utils/mp4-tools.ts"),s=i("./src/demux/dummy-demuxed-track.ts"),i=((i=a.prototype).resetTimeStamp=function(){},i.resetInitSegment=function(){},i.resetContiguity=function(){},a.probe=function(e){return 0<Object(r.findBox)({data:e,start:0,end:Math.min(e.length,16384)},["moof"]).length},i.demux=function(e){var t=e,i=Object(s.dummyTrack)();return this.config.progressive?(this.remainderData&&(t=Object(r.appendUint8Array)(this.remainderData,e)),e=Object(r.segmentValidRange)(t),this.remainderData=e.remainder,i.samples=e.valid||new Uint8Array):i.samples=t,{audioTrack:Object(s.dummyTrack)(),avcTrack:i,id3Track:Object(s.dummyTrack)(),textTrack:Object(s.dummyTrack)()}},i.flush=function(){var e=Object(s.dummyTrack)();return e.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(s.dummyTrack)(),avcTrack:e,id3Track:Object(s.dummyTrack)(),textTrack:Object(s.dummyTrack)()}},i.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},i.destroy=function(){},a);function a(e,t){this.remainderData=null,this.config=void 0,this.config=t}i.minProbeByteLength=1024,t.default=i},"./src/demux/mpegaudio.ts":function(e,t,i){i.r(t),i.d(t,"appendFrame",function(){return r}),i.d(t,"parseHeader",function(){return n}),i.d(t,"isHeaderPattern",function(){return s}),i.d(t,"isHeader",function(){return a}),i.d(t,"canParse",function(){return o}),i.d(t,"probe",function(){return l});var u=null,h=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],p=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],f=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],g=[0,1,1,4];function r(e,t,i,r,s){if(!(i+24>t.length)){var a=n(t,i);if(a&&i+a.frameLength<=t.length)return r=r+s*(9e4*a.samplesPerFrame/a.sampleRate),s={unit:t.subarray(i,i+a.frameLength),pts:r,dts:r},e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(s),{sample:s,length:a.frameLength,missing:0}}}function n(e,t){var i,r,s,a,n,o=e[t+1]>>3&3,l=e[t+1]>>1&3,c=e[t+2]>>4&15,d=e[t+2]>>2&3;if(1!=o&&0!=c&&15!=c&&3!=d)return n=e[t+2]>>1&1,i=e[t+3]>>6,c=1e3*h[14*(3==o?3-l:3==l?3:4)+c-1],d=p[3*(3==o?0:2==o?1:2)+d],r=3==i?1:2,a=8*(o=f[o][l])*(s=g[l]),o=Math.floor(o*c/d+n)*s,null===u&&(n=(navigator.userAgent||"").match(/Chrome\/(\d+)/i),u=n?parseInt(n[1]):0),u&&u<=87&&2==l&&224e3<=c&&0==i&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:r,frameLength:o,samplesPerFrame:a}}function s(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function a(e,t){return t+1<e.length&&s(e,t)}function o(e,t){return s(e,t)&&4<=e.length-t}function l(e,t){var i;return!!(t+1<e.length&&s(e,t))&&(i=4,(t=t+(i=null!=(t=n(e,t))&&t.frameLength?t.frameLength:i))===e.length||a(e,t))}},"./src/demux/sample-aes.ts":function(e,t,i){i.r(t);var r=i("./src/crypt/decrypter.ts"),c=i("./src/demux/tsdemuxer.ts");function s(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new r.default(e,t,{removePKCS7Padding:!1})}(i=s.prototype).decryptBuffer=function(e,t){this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,t)},i.decryptAacSample=function(t,i,r,s){var a=t[i].unit,e=a.subarray(16,a.length-a.length%16),e=e.buffer.slice(e.byteOffset,e.byteOffset+e.length),n=this;this.decryptBuffer(e,function(e){e=new Uint8Array(e);a.set(e,16),s||n.decryptAacSamples(t,i+1,r)})},i.decryptAacSamples=function(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(e,t,i,r),!r)return}}},i.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),r=0,s=32;s<e.length-16;s+=160,r+=16)i.set(e.subarray(s,s+16),r);return i},i.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),r=0,s=32;s<e.length-16;s+=160,r+=16)e.set(i.subarray(r,r+16),s);return e},i.decryptAvcSample=function(t,i,r,s,a,n){var o=Object(c.discardEPB)(a.data),e=this.getAvcEncryptedData(o),l=this;this.decryptBuffer(e.buffer,function(e){a.data=l.getAvcDecryptedUnit(o,e),n||l.decryptAvcSamples(t,i,r+1,s)})},i.decryptAvcSamples=function(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();for(var s=e[t].units;!(i>=s.length);i++){var a=s[i];if(!(a.data.length<=48||1!==a.type&&5!==a.type)){var n=this.decrypter.isSync();if(this.decryptAvcSample(e,t,i,r,a,n),!n)return}}}},t.default=s},"./src/demux/transmuxer-interface.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r});var l=i("./node_modules/webworkify-webpack/index.js"),c=i("./src/events.ts"),w=i("./src/demux/transmuxer.ts"),T=i("./src/utils/logger.ts"),d=i("./src/errors.ts"),t=i("./src/utils/mediasource-helper.ts"),u=i("./node_modules/eventemitter3/index.js"),h=Object(t.getMediaSource)()||{isTypeSupported:function(){return!1}},r=((i=s.prototype).destroy=function(){var e=this.worker,e=(e?(e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null):(e=this.transmuxer)&&(e.destroy(),this.transmuxer=null),this.observer);e&&e.removeAllListeners(),this.observer=null},i.push=function(e,t,i,r,s,a,n,o,l,c){var d=this,u=(l.transmuxing.start=self.performance.now(),this.transmuxer),h=this.worker,p=(a||s).start,f=s.decryptdata,g=this.frag,m=!(g&&s.cc===g.cc),A=!(g&&l.level===g.level),y=g?l.sn-g.sn:-1,b=this.part?l.part-this.part.index:1,v=!A&&(1==y||0==y&&1==b),E=self.performance.now(),E=((A||y||0===s.stats.parsing.start)&&(s.stats.parsing.start=E),!a||!b&&v||(a.stats.parsing.start=E),!(g&&(null==(y=s.initSegment)?void 0:y.url)===(null==(b=g.initSegment)?void 0:b.url))),y=new w.TransmuxState(m,v,o,A,p,E);v&&!m&&!E||(T.logger.log("[transmuxer-interface, "+s.type+"]: Starting new transmux session for sn: "+l.sn+" p: "+l.part+" level: "+l.level+" id: "+l.id+"\n discontinuity: "+m+"\n trackSwitch: "+A+"\n contiguous: "+v+"\n accurateTimeOffset: "+o+"\n timeOffset: "+p+"\n initSegmentChange: "+E),g=new w.TransmuxConfig(i,r,t,n,c),this.configureTransmuxer(g)),this.frag=s,this.part=a,h?h.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:y},e instanceof ArrayBuffer?[e]:[]):u&&(b=u.push(e,f,l,y),Object(w.isPromise)(b)?b.then(function(e){d.handleTransmuxComplete(e)}):this.handleTransmuxComplete(b))},i.flush=function(t){var i=this,e=(t.transmuxing.start=self.performance.now(),this.transmuxer),r=this.worker;r?r.postMessage({cmd:"flush",chunkMeta:t}):e&&(r=e.flush(t),Object(w.isPromise)(r)?r.then(function(e){i.handleFlushResult(e,t)}):this.handleFlushResult(r,t))},i.handleFlushResult=function(e,t){var i=this;e.forEach(function(e){i.handleTransmuxComplete(e)}),this.onFlush(t)},i.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}},i.configureTransmuxer=function(e){var t=this.worker,i=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):i&&i.configure(e)},i.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},s);function s(i,e,t,r){function s(e,t){(t=t||{}).frag=n.frag,t.id=n.id,i.trigger(e,t)}var a,n=this,t=(this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=i,this.id=e,this.onTransmuxComplete=t,this.onFlush=r,i.config),r=(this.observer=new u.EventEmitter,this.observer.on(c.Events.FRAG_DECRYPTED,s),this.observer.on(c.Events.ERROR,s),{mp4:h.isTypeSupported("video/mp4"),mpeg:h.isTypeSupported("audio/mpeg"),mp3:h.isTypeSupported('audio/mp4; codecs="mp3"')}),o=navigator.vendor;if(t.enableWorker&&"undefined"!=typeof Worker){T.logger.log("demuxing in webworker");try{a=this.worker=l("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),a.addEventListener("message",this.onwmsg),a.onerror=function(e){i.trigger(c.Events.ERROR,{type:d.ErrorTypes.OTHER_ERROR,details:d.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(e.message+" ("+e.filename+":"+e.lineno+")")})},a.postMessage({cmd:"init",typeSupported:r,vendor:o,id:e,config:JSON.stringify(t)})}catch(i){T.logger.warn("Error in worker:",i),T.logger.error("Error while initializing DemuxerWorker, fallback to inline"),a&&self.URL.revokeObjectURL(a.objectURL),this.transmuxer=new w.default(this.observer,r,t,o,e),this.worker=null}}else this.transmuxer=new w.default(this.observer,r,t,o,e)}},"./src/demux/transmuxer-worker.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return s});var o=i("./src/demux/transmuxer.ts"),r=i("./src/events.ts"),l=i("./src/utils/logger.ts"),c=i("./node_modules/eventemitter3/index.js");function s(s){function a(e,t){s.postMessage({event:e,data:t})}var n=new c.EventEmitter;n.on(r.Events.FRAG_DECRYPTED,a),n.on(r.Events.ERROR,a),s.addEventListener("message",function(e){var t=e.data;switch(t.cmd){case"init":var i=JSON.parse(t.config);s.transmuxer=new o.default(n,t.typeSupported,i,t.vendor,t.id),Object(l.enableLogs)(i.debug),a("init",null);break;case"configure":s.transmuxer.configure(t.config);break;case"demux":i=s.transmuxer.push(t.data,t.decryptdata,t.chunkMeta,t.state);Object(o.isPromise)(i)?i.then(function(e){d(s,e)}):d(s,i);break;case"flush":var r=t.chunkMeta,i=s.transmuxer.flush(r);Object(o.isPromise)(i)?i.then(function(e){u(s,e,r)}):u(s,i,r)}})}function d(e,t){var i,r,s;((i=t.remuxResult).audio||i.video||i.text||i.id3||i.initSegment)&&(i=[],r=(s=t.remuxResult).audio,s=s.video,r&&a(i,r),s&&a(i,s),e.postMessage({event:"transmuxComplete",data:t},i))}function a(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function u(t,e,i){e.forEach(function(e){d(t,e)}),t.postMessage({event:"flush",data:i})}},"./src/demux/transmuxer.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return u}),i.d(t,"isPromise",function(){return p}),i.d(t,"TransmuxConfig",function(){return f}),i.d(t,"TransmuxState",function(){return g});var y,l=i("./src/events.ts"),c=i("./src/errors.ts"),r=i("./src/crypt/decrypter.ts"),t=i("./src/demux/aacdemuxer.ts"),A=i("./src/demux/mp4demuxer.ts"),s=i("./src/demux/tsdemuxer.ts"),a=i("./src/demux/mp3demuxer.ts"),n=i("./src/remux/mp4-remuxer.ts"),b=i("./src/remux/passthrough-remuxer.ts"),o=i("./src/demux/chunk-cache.ts"),v=i("./src/utils/mp4-tools.ts"),E=i("./src/utils/logger.ts");try{y=self.performance.now.bind(self.performance)}catch(e){E.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var w=[{demux:s.default,remux:n.default},{demux:A.default,remux:b.default},{demux:t.default,remux:n.default},{demux:a.default,remux:n.default}],d=1024,u=(w.forEach(function(e){e=e.demux;d=Math.max(d,e.minProbeByteLength)}),(i=h.prototype).configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},i.push=function(e,t,i,r){var s=this,a=i.transmuxing,e=(a.executeStart=y(),new Uint8Array(e)),n=this.cache,o=this.config,l=this.currentTransmuxState,c=this.transmuxConfig,t=(r&&(this.currentTransmuxState=r),d=null,d=0<e.byteLength&&null!=t&&null!=t.key&&null!==t.iv&&null!=t.method?t:d);if(t&&"AES-128"===t.method){var d=this.getDecrypter();if(!o.enableSoftwareAES)return this.decryptionPromise=d.webCryptoDecrypt(e,t.key.buffer,t.iv.buffer).then(function(e){e=s.push(e,null,i);return s.decryptionPromise=null,e}),this.decryptionPromise;o=d.softwareDecrypt(e,t.key.buffer,t.iv.buffer);if(!o)return a.executeEnd=y(),T(i);e=new Uint8Array(o)}var d=r||l,o=d.contiguous,r=d.discontinuity,l=d.trackSwitch,u=d.accurateTimeOffset,h=d.timeOffset,d=d.initSegmentChange,p=c.audioCodec,f=c.videoCodec,g=c.defaultInitPts,m=c.duration,A=c.initSegmentData,p=((r||l||d)&&this.resetInitSegment(A,p,f,m),(r||d)&&this.resetInitialTimestamp(g),o||this.resetContiguity(),this.needsProbing(e,r,l)&&(n.dataLength&&(A=n.flush(),e=Object(v.appendUint8Array)(A,e)),this.configureTransmuxer(e,c)),this.transmux(e,t,h,u,i)),f=this.currentTransmuxState;return f.contiguous=!0,f.discontinuity=!1,f.trackSwitch=!1,a.executeEnd=y(),p},i.flush=function(t){var i,r=this,e=t.transmuxing,s=(e.executeStart=y(),this.decrypter),a=this.cache,n=this.currentTransmuxState,o=this.decryptionPromise;return o?o.then(function(){return r.flush(t)}):(i=[],o=n.timeOffset,s&&(n=s.flush())&&i.push(this.push(n,null,t)),s=a.dataLength,a.reset(),n=this.demuxer,a=this.remuxer,n&&a?p(a=n.flush(o))?a.then(function(e){return r.flushRemux(i,e,t),i}):(this.flushRemux(i,a,t),i):(d<=s&&this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),e.executeEnd=y(),[T(t)]))},i.flushRemux=function(e,t,i){var r=t.audioTrack,s=t.avcTrack,a=t.id3Track,t=t.textTrack,n=this.currentTransmuxState,o=n.accurateTimeOffset,n=n.timeOffset,r=(E.logger.log("[transmuxer.ts]: Flushed fragment "+i.sn+(-1<i.part?" p: "+i.part:"")+" of level "+i.level),this.remuxer.remux(r,s,a,t,n,o,!0,this.id));e.push({remuxResult:r,chunkMeta:i}),i.transmuxing.executeEnd=y()},i.resetInitialTimestamp=function(e){var t=this.demuxer,i=this.remuxer;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))},i.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},i.resetInitSegment=function(e,t,i,r){var s=this.demuxer,a=this.remuxer;s&&a&&(s.resetInitSegment(t,i,r),a.resetInitSegment(e,t,i))},i.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},i.transmux=function(e,t,i,r,s){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,r,s):this.transmuxUnencrypted(e,i,r,s)},i.transmuxUnencrypted=function(e,t,i,r){var e=this.demuxer.demux(e,t,!1,!this.config.progressive),s=e.audioTrack,a=e.avcTrack,n=e.id3Track,e=e.textTrack;return{remuxResult:this.remuxer.remux(s,a,n,e,t,i,!1,this.id),chunkMeta:r}},i.transmuxSampleAes=function(e,t,i,r,s){var a=this;return this.demuxer.demuxSampleAes(e,t,i).then(function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.avcTrack,e.id3Track,e.textTrack,i,r,!1,a.id),chunkMeta:s}})},i.configureTransmuxer=function(e,t){for(var i,r=this.config,s=this.observer,a=this.typeSupported,n=this.vendor,o=t.audioCodec,l=t.defaultInitPts,c=t.duration,d=t.initSegmentData,t=t.videoCodec,u=0,h=w.length;u<h;u++)if(w[u].demux.probe(e)){i=w[u];break}i||(E.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),i={demux:A.default,remux:b.default});var p=this.demuxer,f=this.remuxer,g=i.remux,m=i.demux;f&&f instanceof g||(this.remuxer=new g(s,r,a,n)),p&&p instanceof m||(this.demuxer=new m(s,r,a),this.probe=m.probe),this.resetInitSegment(d,o,t,c),this.resetInitialTimestamp(l)},i.needsProbing=function(e,t,i){return!this.demuxer||!this.remuxer||t||i},i.getDecrypter=function(){return this.decrypter||(this.decrypter=new r.default(this.observer,this.config))},h),T=function(e){return{remuxResult:{},chunkMeta:e}};function h(e,t,i,r,s){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new o.default,this.observer=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=s}function p(e){return"then"in e&&e.then instanceof Function}var f=function(e,t,i,r,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=s},g=function(e,t,i,r,s,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=s,this.initSegmentChange=a}},"./src/demux/tsdemuxer.ts":function(e,t,i){i.r(t),i.d(t,"discardEPB",function(){return j});var p=i("./src/demux/adts.ts"),o=i("./src/demux/mpegaudio.ts"),C=i("./src/demux/exp-golomb.ts"),R=i("./src/demux/id3.ts"),r=i("./src/demux/sample-aes.ts"),D=i("./src/events.ts"),L=i("./src/utils/mp4-tools.ts"),x=i("./src/utils/logger.ts"),I=i("./src/errors.ts"),s={video:1,audio:2,id3:3,text:4},i=(P.probe=function(e){e=P.syncOffset(e);return!(e<0||(e&&x.logger.warn("MPEG2-TS detected but first sync word found @ offset "+e+", junk ahead ?"),0))},P.syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),i=0;i<t;){if(71===e[i]&&71===e[i+188]&&71===e[i+376])return i;i++}return-1},P.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:s[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}},(i=P.prototype).resetInitSegment=function(e,t,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=P.createTrack("video",i),this._audioTrack=P.createTrack("audio",i),this._id3Track=P.createTrack("id3",i),this._txtTrack=P.createTrack("text",i),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=t,this._duration=i},i.resetTimeStamp=function(){},i.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,i=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},i.demux=function(e,t,i,r){void 0===r&&(r=!1),(i=void 0===i?!1:i)||(this.sampleAes=null);var s,a=this._avcTrack,n=this._audioTrack,o=this._id3Track,l=a.pid,c=a.pesData,d=n.pid,u=o.pid,h=n.pesData,p=o.pesData,f=!1,g=this.pmtParsed,m=this._pmtId,A=e.length;if(this.remainderData&&(A=(e=Object(L.appendUint8Array)(this.remainderData,e)).length,this.remainderData=null),A<188&&!r)return this.remainderData=e,{audioTrack:n,avcTrack:a,id3Track:o,textTrack:this._txtTrack};var y=Math.max(0,P.syncOffset(e));(A-=(A+y)%188)<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,A,e.buffer.byteLength-A));for(var b,v=0,E=y;E<A;E+=188)if(71===e[E]){var w=!!(64&e[E+1]),T=((31&e[E+1])<<8)+e[E+2],S=void 0;if(1<(48&e[E+3])>>4){if((S=E+5+e[E+4])===E+188)continue}else S=E+4;switch(T){case l:w&&(c&&(s=M(c))&&this.parseAVCPES(s,!1),c={data:[],size:0}),c&&(c.data.push(e.subarray(S,E+188)),c.size+=E+188-S);break;case d:w&&(h&&(s=M(h))&&(n.isAAC?this.parseAACPES(s):this.parseMPEGPES(s)),h={data:[],size:0}),h&&(h.data.push(e.subarray(S,E+188)),h.size+=E+188-S);break;case u:w&&(p&&(s=M(p))&&this.parseID3PES(s),p={data:[],size:0}),p&&(p.data.push(e.subarray(S,E+188)),p.size+=E+188-S);break;case 0:w&&(S+=e[S]+1),m=this._pmtId=(31&(k=e)[(b=S)+10])<<8|k[b+11];break;case m:w&&(S+=e[S]+1);var k=function(e,t,i,r){var s={audio:-1,avc:-1,id3:-1,isAAC:!0},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<a;){var n=(31&e[t+1])<<8|e[t+2];switch(e[t]){case 207:if(!r){x.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===s.audio&&(s.audio=n);break;case 21:-1===s.id3&&(s.id3=n);break;case 219:if(!r){x.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===s.avc&&(s.avc=n);break;case 3:case 4:i?-1===s.audio&&(s.audio=n,s.isAAC=!1):x.logger.log("MPEG audio found, not supported in this browser");break;case 36:x.logger.warn("Unsupported HEVC stream type found")}t+=5+((15&e[t+3])<<8|e[t+4])}return s}(e,S,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,i);0<(l=k.avc)&&(a.pid=l),0<(d=k.audio)&&(n.pid=d,n.isAAC=k.isAAC),0<(u=k.id3)&&(o.pid=u),f&&!g&&(x.logger.log("reparse from beginning"),f=!1,E=y-188),g=this.pmtParsed=!0;break;case 17:case 8191:break;default:f=!0}}else v++;0<v&&this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+v+" TS packet/s that do not start with 0x47"}),a.pesData=c,n.pesData=h,o.pesData=p;var _={audioTrack:n,avcTrack:a,id3Track:o,textTrack:this._txtTrack};return r&&this.extractRemainingSamples(_),_},i.flush=function(){var e=this.remainderData;return this.remainderData=null,e=e?this.demux(e,-1,!1,!0):{audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},i.extractRemainingSamples=function(e){var t,i=e.audioTrack,r=e.avcTrack,e=e.id3Track,s=r.pesData,a=i.pesData,n=e.pesData;s&&(t=M(s))?(this.parseAVCPES(t,!0),r.pesData=null):r.pesData=s,a&&(t=M(a))?(i.isAAC?this.parseAACPES(t):this.parseMPEGPES(t),i.pesData=null):(null!=a&&a.size&&x.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=a),n&&(t=M(n))?(this.parseID3PES(t),e.pesData=null):e.pesData=n},i.demuxSampleAes=function(e,t,i){e=this.demux(e,i,!0,!this.config.progressive),i=this.sampleAes=new r.default(this.observer,this.config,t);return this.decrypt(e,i)},i.decrypt=function(r,s){return new Promise(function(e){var t=r.audioTrack,i=r.avcTrack;t.samples&&t.isAAC?s.decryptAacSamples(t.samples,0,function(){i.samples?s.decryptAvcSamples(i.samples,0,0,function(){e(r)}):e(r)}):i.samples&&s.decryptAvcSamples(i.samples,0,0,function(){e(r)})})},i.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},i.parseAVCPES=function(E,e){var w,T=this,S=this._avcTrack,t=this.parseAVCNALu(E.data),k=this.avcSample,_=!1;E.data=null,k&&t.length&&!S.audFound&&(O(k,S),k=this.avcSample=B(!1,E.pts,E.dts,"")),t.forEach(function(e){switch(e.type){case 1:w=!0,(k=k||(T.avcSample=B(!0,E.pts,E.dts,""))).frame=!0;var t=e.data;_&&4<t.length&&(2!==(t=new C.default(t).readSliceType())&&4!==t&&7!==t&&9!==t||(k.key=!0));break;case 5:w=!0,(k=k||(T.avcSample=B(!0,E.pts,E.dts,""))).key=!0,k.frame=!0;break;case 6:w=!0;var i=new C.default(j(e.data));i.readUByte();for(var r=0,s=0,a=!1,n=0;!a&&1<i.bytesAvailable;){for(r=0;r+=n=i.readUByte(),255===n;);for(s=0;s+=n=i.readUByte(),255===n;);if(4===r&&0!==i.bytesAvailable){if(a=!0,181===i.readUByte()&&49===i.readUShort()&&1195456820===i.readUInt()&&3===i.readUByte()){for(var o=i.readUByte(),l=31&o,c=[o,i.readUByte()],d=0;d<l;d++)c.push(i.readUByte()),c.push(i.readUByte()),c.push(i.readUByte());F(T._txtTrack.samples,{type:3,pts:E.pts,bytes:c})}}else if(5===r&&0!==i.bytesAvailable){if(a=!0,16<s){for(var u=[],h=0;h<16;h++)u.push(i.readUByte().toString(16)),3!==h&&5!==h&&7!==h&&9!==h||u.push("-");for(var p=s-16,f=new Uint8Array(p),g=0;g<p;g++)f[g]=i.readUByte();F(T._txtTrack.samples,{pts:E.pts,payloadType:r,uuid:u.join(""),userData:Object(R.utf8ArrayToStr)(f),userDataBytes:f})}}else if(s<i.bytesAvailable)for(var m=0;m<s;m++)i.readUByte()}break;case 7:if(_=w=!0,!S.sps){t=new C.default(e.data).readSPS();S.width=t.width,S.height=t.height,S.pixelRatio=t.pixelRatio,S.sps=[e.data],S.duration=T._duration;for(var A=e.data.subarray(1,4),y="avc1.",b=0;b<3;b++){var v=A[b].toString(16);y+=v=v.length<2?"0"+v:v}S.codec=y}break;case 8:w=!0,S.pps||(S.pps=[e.data]);break;case 9:w=!1,S.audFound=!0,k&&O(k,S),k=T.avcSample=B(!1,E.pts,E.dts,"");break;case 12:w=!1;break;default:w=!1,k&&(k.debug+="unknown NAL "+e.type+" ")}k&&w&&k.units.push(e)}),e&&k&&(O(k,S),this.avcSample=null)},i.getLastNalUnit=function(){var e,t,i=this.avcSample;return t=null!=(e=i=i&&0!==i.units.length?i:(e=this._avcTrack.samples)[e.length-1])&&e.units?(e=i.units)[e.length-1]:t},i.parseAVCNALu=function(e){var t,i,r,s,a,n,o=e.byteLength,l=this._avcTrack,c=l.naluState||0,d=c,u=[],h=0,p=-1,f=0;for(-1===c&&(f=31&e[p=0],c=0,h=1);h<o;)t=e[h++],c=c?1!==c?t?1===t?(0<=p?(r={data:e.subarray(p,h-c-1),type:f},u.push(r)):(r=this.getLastNalUnit())&&(d&&h<=4-d&&r.state&&(r.data=r.data.subarray(0,r.data.byteLength-d)),0<(i=h-c-1))&&((s=new Uint8Array(r.data.byteLength+i)).set(r.data,0),s.set(e.subarray(0,i),r.data.byteLength),r.data=s,r.state=0),h<o?(f=31&e[p=h],0):-1):0:3:t?0:2:t?0:1;return 0<=p&&0<=c&&(a={data:e.subarray(p,o),type:f,state:c},u.push(a)),0===u.length&&(a=this.getLastNalUnit())&&((n=new Uint8Array(a.data.byteLength+e.byteLength)).set(a.data,0),n.set(e,a.data.byteLength),a.data=n),l.naluState=c,u},i.parseAACPES=function(e){var t,i,r,s,a=0,n=this._audioTrack,o=this.aacOverFlow,l=e.data;for(o&&(this.aacOverFlow=null,c=(s=o.sample.unit.byteLength)-(s=Math.min(o.missing,s)),o.sample.unit.set(l.subarray(0,s),c),n.samples.push(o.sample),a=o.missing),t=a,i=l.length;t<i-1&&!p.isHeader(l,t);t++);if(t===a||(s=t<i-1?(r="AAC PES did not start with ADTS header,offset:"+t,!1):(r="no ADTS header found in AAC PES",!0),x.logger.warn("parsing error:"+r),this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:s,reason:r}),!s)){if(p.initTrackConfig(n,this.observer,l,t,this.audioCodec),void 0!==e.pts)d=e.pts;else{if(!o)return void x.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var c=p.getFrameDuration(n.samplerate),d=o.sample.pts+c}for(var u=0;t<i;){if(p.isHeader(l,t)){if(t+5<i){var h=p.appendFrame(n,l,t,d,u);if(h){if(!h.missing){t+=h.length,u++;continue}this.aacOverFlow=h}}break}t++}}},i.parseMPEGPES=function(e){var t=e.data,i=t.length,r=0,s=0,a=e.pts;if(void 0!==a)for(;s<i;)if(o.isHeader(t,s)){var n=o.appendFrame(this._audioTrack,t,s,a,r);if(!n)break;s+=n.length,r++}else s++;else x.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},i.parseID3PES=function(e){void 0!==e.pts?this._id3Track.samples.push(e):x.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},P);function P(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=i}function B(e,t,i,r){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:r,length:0}}function M(e){var t,i,r,s,a=0,n=e.data;if(!e||0===e.size)return null;for(;n[0].length<19&&1<n.length;){var o=new Uint8Array(n[0].length+n[1].length);o.set(n[0]),o.set(n[1],n[0].length),n[0]=o,n.splice(1,1)}if(1!==((t=n[0])[0]<<16)+(t[1]<<8)+t[2])return null;if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;var l=t[7],c=(192&l&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?54e5<r-(s=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)&&(x.logger.warn(Math.round((r-s)/9e4)+"s delta between PTS and DTS, align them"),r=s):s=r),(l=t[8])+9);if(e.size<=c)return null;e.size-=c;for(var d=new Uint8Array(e.size),u=0,h=n.length;u<h;u++){var p=(t=n[u]).byteLength;if(c){if(p<c){c-=p;continue}t=t.subarray(c),p-=c,c=0}d.set(t,a),a+=p}return i&&(i-=l+3),{data:d,pts:r,dts:s,len:i}}function O(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var i=t.samples,r=i.length;if(!r)return t.dropped++;i=i[r-1];e.pts=i.pts,e.dts=i.dts}t.samples.push(e)}e.debug.length&&x.logger.log(e.pts+"/"+e.dts+":"+e.debug)}function F(e,t){var i=e.length;if(0<i){if(t.pts>=e[i-1].pts)e.push(t);else for(var r=i-1;0<=r;r--)if(t.pts<e[r].pts){e.splice(r,0,t);break}}else e.push(t)}function j(e){for(var t=e.byteLength,i=[],r=1;r<t-2;)0===e[r]&&0===e[r+1]&&3===e[r+2]?(i.push(r+2),r+=2):r++;if(0===i.length)return e;for(var s=t-i.length,a=new Uint8Array(s),n=0,r=0;r<s;n++,r++)n===i[0]&&(n++,i.shift()),a[r]=e[n];return a}i.minProbeByteLength=188,t.default=i},"./src/errors.ts":function(e,t,i){var r,s;i.r(t),i.d(t,"ErrorTypes",function(){return r}),i.d(t,"ErrorDetails",function(){return s}),(i=r=r||{}).NETWORK_ERROR="networkError",i.MEDIA_ERROR="mediaError",i.KEY_SYSTEM_ERROR="keySystemError",i.MUX_ERROR="muxError",i.OTHER_ERROR="otherError",(t=s=s||{}).KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.UNKNOWN="unknown"},"./src/events.ts":function(e,t,i){var r;i.r(t),i.d(t,"Events",function(){return r}),(i=r=r||{}).MEDIA_ATTACHING="hlsMediaAttaching",i.MEDIA_ATTACHED="hlsMediaAttached",i.MEDIA_DETACHING="hlsMediaDetaching",i.MEDIA_DETACHED="hlsMediaDetached",i.BUFFER_RESET="hlsBufferReset",i.BUFFER_CODECS="hlsBufferCodecs",i.BUFFER_CREATED="hlsBufferCreated",i.BUFFER_APPENDING="hlsBufferAppending",i.BUFFER_APPENDED="hlsBufferAppended",i.BUFFER_EOS="hlsBufferEos",i.BUFFER_FLUSHING="hlsBufferFlushing",i.BUFFER_FLUSHED="hlsBufferFlushed",i.MANIFEST_LOADING="hlsManifestLoading",i.MANIFEST_LOADED="hlsManifestLoaded",i.MANIFEST_PARSED="hlsManifestParsed",i.LEVEL_SWITCHING="hlsLevelSwitching",i.LEVEL_SWITCHED="hlsLevelSwitched",i.LEVEL_LOADING="hlsLevelLoading",i.LEVEL_LOADED="hlsLevelLoaded",i.LEVEL_UPDATED="hlsLevelUpdated",i.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",i.LEVELS_UPDATED="hlsLevelsUpdated",i.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",i.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",i.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",i.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",i.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",i.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",i.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",i.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",i.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",i.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",i.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",i.CUES_PARSED="hlsCuesParsed",i.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",i.INIT_PTS_FOUND="hlsInitPtsFound",i.FRAG_LOADING="hlsFragLoading",i.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",i.FRAG_LOADED="hlsFragLoaded",i.FRAG_DECRYPTED="hlsFragDecrypted",i.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",i.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",i.FRAG_PARSING_METADATA="hlsFragParsingMetadata",i.FRAG_PARSED="hlsFragParsed",i.FRAG_BUFFERED="hlsFragBuffered",i.FRAG_CHANGED="hlsFragChanged",i.FPS_DROP="hlsFpsDrop",i.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",i.ERROR="hlsError",i.DESTROYING="hlsDestroying",i.KEY_LOADING="hlsKeyLoading",i.KEY_LOADED="hlsKeyLoaded",i.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",i.BACK_BUFFER_REACHED="hlsBackBufferReached"},"./src/hls.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return l});var s=i("./node_modules/url-toolkit/src/url-toolkit.js"),u=i("./src/loader/playlist-loader.ts"),h=i("./src/loader/key-loader.ts"),p=i("./src/controller/id3-track-controller.ts"),f=i("./src/controller/latency-controller.ts"),g=i("./src/controller/level-controller.ts"),m=i("./src/controller/fragment-tracker.ts"),A=i("./src/controller/stream-controller.ts"),r=i("./src/is-supported.ts"),y=i("./src/utils/logger.ts"),b=i("./src/config.ts"),v=i("./node_modules/eventemitter3/index.js"),a=i("./src/events.ts"),n=i("./src/errors.ts");function o(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}E.isSupported=function(){return Object(r.isSupported)()},(t=E.prototype).createController=function(e,t,i){return e?(t=t?new e(this,t):new e(this),i&&i.push(t),t):null},t.on=function(e,t,i){this._emitter.on(e,t,i=void 0===i?this:i)},t.once=function(e,t,i){this._emitter.once(e,t,i=void 0===i?this:i)},t.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},t.off=function(e,t,i,r){this._emitter.off(e,t,i=void 0===i?this:i,r)},t.listeners=function(e){return this._emitter.listeners(e)},t.emit=function(e,t,i){return this._emitter.emit(e,t,i)},t.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){y.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.trigger(a.Events.ERROR,{type:n.ErrorTypes.OTHER_ERROR,details:n.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,error:t})}return!1},t.listenerCount=function(e){return this._emitter.listenerCount(e)},t.destroy=function(){y.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(e){return e.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(e){return e.destroy()}),this.coreComponents.length=0},t.attachMedia=function(e){y.logger.log("attachMedia"),this._media=e,this.trigger(a.Events.MEDIA_ATTACHING,{media:e})},t.detachMedia=function(){y.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},t.loadSource=function(e){this.stopLoad();var t=this.media,i=this.url,r=this.url=s.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});y.logger.log("loadSource:"+r),t&&i&&i!==r&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(t)),this.trigger(a.Events.MANIFEST_LOADING,{url:e})},t.startLoad=function(t){void 0===t&&(t=-1),y.logger.log("startLoad("+t+")"),this.networkControllers.forEach(function(e){e.startLoad(t)})},t.stopLoad=function(){y.logger.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},t.swapAudioCodec=function(){y.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.recoverMediaError=function(){y.logger.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},t.removeLevel=function(e,t){this.levelController.removeLevel(e,t=void 0===t?0:t)},t=[{key:"version",get:function(){return"1.1.5"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return n.ErrorTypes}},{key:"ErrorDetails",get:function(){return n.ErrorDetails}},{key:"DefaultConfig",get:function(){return E.defaultConfig||b.hlsDefaultConfig},set:function(e){E.defaultConfig=e}}],o((i=E).prototype,[{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){y.logger.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){y.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){y.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){y.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){y.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){e=!!e;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(y.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e)}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(e)for(var i=e.length,r=0;r<i;r++)if(e[r].maxBitrate>t)return r;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}]),o(i,t);var l=E;function E(e){void 0===e&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new v.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var t=this.config=Object(b.mergeConfig)(E.DefaultConfig,e),e=(this.userConfig=e,Object(y.enableLogs)(t.debug),this._autoLevelCapping=-1,t.progressive&&Object(b.enableStreamingMode)(t),t.abrController),i=t.bufferController,r=t.capLevelController,s=t.fpsController,e=this.abrController=new e(this),i=this.bufferController=new i(this),r=this.capLevelController=new r(this),s=new s(this),a=new u.default(this),n=new h.default(this),o=new p.default(this),l=this.levelController=new g.default(this),c=new m.FragmentTracker(this),d=this.streamController=new A.default(this,c),l=(r.setStreamController(d),s.setStreamController(d),[l,d]),d=(this.networkControllers=l,[a,n,e,i,r,s,o,c]);this.audioTrackController=this.createController(t.audioTrackController,null,l),this.createController(t.audioStreamController,c,l),this.subtitleTrackController=this.createController(t.subtitleTrackController,null,l),this.createController(t.subtitleStreamController,c,l),this.createController(t.timelineController,null,d),this.emeController=this.createController(t.emeController,null,d),this.cmcdController=this.createController(t.cmcdController,null,d),this.latencyController=this.createController(f.default,null,d),this.coreComponents=d}l.defaultConfig=void 0},"./src/is-supported.ts":function(e,t,i){i.r(t),i.d(t,"isSupported",function(){return a}),i.d(t,"changeTypeSupported",function(){return n});var r=i("./src/utils/mediasource-helper.ts");function s(){return self.SourceBuffer||self.WebKitSourceBuffer}function a(){var e,t=Object(r.getMediaSource)();return!!t&&(e=s(),t=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),e=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove,!!t)&&!!e}function n(){var e=s();return"function"==typeof(null==e||null==(e=e.prototype)?void 0:e.changeType)}},"./src/loader/fragment-loader.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return l}),i.d(t,"LoadError",function(){return g});var r=i("./src/polyfills/number.ts"),h=i("./src/errors.ts");function s(e){var i="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,t)}function t(){return a(e,arguments,o(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n(t,e)})(e)}function a(e,t,i){return(a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return;if(Reflect.construct.sham)return;if("function"==typeof Proxy)return 1;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),1}catch(e){}}()?Reflect.construct:function(e,t,i){var r=[null],t=(r.push.apply(r,t),new(Function.bind.apply(e,r)));return i&&n(t,i.prototype),t}).apply(null,arguments)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=Math.pow(2,17),l=((t=c.prototype).destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(n,o){var l=this,e=n.url;if(!e)return Promise.reject(new g({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,networkDetails:null},"Fragment does not have a "+(e?"part list":"url")));this.abort();var i=this.config,c=i.fLoader,d=i.loader;return new Promise(function(s,r){l.loader&&l.loader.destroy();var a=l.loader=n.loader=new(c||d)(i),e=f(n),t={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:i.fragLoadingMaxRetryTimeout,highWaterMark:p};n.stats=a.stats,a.load(e,t,{onSuccess:function(e,t,i,r){l.resetLoader(n,a),s({frag:n,part:null,payload:e.data,networkDetails:r})},onError:function(e,t,i){l.resetLoader(n,a),r(new g({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,response:e,networkDetails:i}))},onAbort:function(e,t,i){l.resetLoader(n,a),r(new g({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,networkDetails:i}))},onTimeout:function(e,t,i){l.resetLoader(n,a),r(new g({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,networkDetails:i}))},onProgress:function(e,t,i,r){o&&o({frag:n,part:null,payload:i,networkDetails:r})}})})},t.loadPart=function(n,o,l){var c=this,i=(this.abort(),this.config),d=i.fLoader,u=i.loader;return new Promise(function(s,r){c.loader&&c.loader.destroy();var a=c.loader=n.loader=new(d||u)(i),e=f(n,o),t={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:i.fragLoadingMaxRetryTimeout,highWaterMark:p};o.stats=a.stats,a.load(e,t,{onSuccess:function(e,t,i,r){c.resetLoader(n,a),c.updateStatsFromPart(n,o);e={frag:n,part:o,payload:e.data,networkDetails:r};l(e),s(e)},onError:function(e,t,i){c.resetLoader(n,a),r(new g({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,part:o,response:e,networkDetails:i}))},onAbort:function(e,t,i){n.stats.aborted=o.stats.aborted,c.resetLoader(n,a),r(new g({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,part:o,networkDetails:i}))},onTimeout:function(e,t,i){c.resetLoader(n,a),r(new g({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,part:o,networkDetails:i}))}})})},t.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,s=r.total,e=(i.loaded+=r.loaded,s?(s=((e=Math.round(e.duration/t.duration))-(t=Math.min(Math.round(i.loaded/s),e)))*Math.round(i.loaded/t),i.total=i.loaded+s):i.total=Math.max(i.loaded,i.total),i.loading),t=r.loading;e.start?e.first+=t.first-t.start:(e.start=t.start,e.first=t.first),e.end=t.end},t.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},c);function c(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}function f(e,t){var i=(t=void 0===t?null:t)||e,e={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},t=i.byteRangeStartOffset,i=i.byteRangeEndOffset;return Object(r.isFiniteNumber)(t)&&Object(r.isFiniteNumber)(i)&&(e.rangeStart=t,e.rangeEnd=i),e}d=s(Error),i=d,(t=u).prototype=Object.create(i.prototype),n(t.prototype.constructor=t,i);var d,g=u;function u(e){for(var t,i=arguments.length,r=new Array(1<i?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return(t=d.call.apply(d,[this].concat(r))||this).data=void 0,t.data=e,t}},"./src/loader/fragment.ts":function(e,t,i){i.r(t),i.d(t,"ElementaryStreamTypes",function(){return r}),i.d(t,"BaseSegment",function(){return g}),i.d(t,"Fragment",function(){return m}),i.d(t,"Part",function(){return A});var r,s=i("./src/polyfills/number.ts"),a=i("./node_modules/url-toolkit/src/url-toolkit.js"),n=i("./src/utils/logger.ts"),o=i("./src/loader/level-key.ts"),l=i("./src/loader/load-stats.ts");function c(e,t){e.prototype=Object.create(t.prototype),d(e.prototype.constructor=e,t)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t,i){t&&u(e.prototype,t),i&&u(e,i)}(t=r=r||{}).AUDIO="audio",t.VIDEO="video",t.AUDIOVIDEO="audiovideo";v.prototype.setByteRange=function(e,t){var e=e.split("@",2),i=[];1===e.length?i[0]=t?t.byteRangeEndOffset:0:i[0]=parseInt(e[1]),i[1]=parseInt(e[0])+i[0],this._byteRange=i},h(v,[{key:"byteRange",get:function(){return this._byteRange||[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(a.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}]);var p,f,g=v,m=(c(b,f=g),(i=b.prototype).createInitializationVector=function(e){for(var t=new Uint8Array(16),i=12;i<16;i++)t[i]=e>>8*(15-i)&255;return t},i.setDecryptDataFromLevelKey=function(e,t){var i=e;return"AES-128"===(null==e?void 0:e.method)&&e.uri&&!e.iv&&((i=o.LevelKey.fromURI(e.uri)).method=e.method,i.iv=this.createInitializationVector(t),i.keyFormat="identity"),i},i.setElementaryStreamInfo=function(e,t,i,r,s,a){void 0===a&&(a=!1);var n=this.elementaryStreams,o=n[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,s)):n[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:s,partial:a}},i.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[r.AUDIO]=null,e[r.VIDEO]=null,e[r.AUDIOVIDEO]=null},h(b,[{key:"decryptdata",get:function(){var e;return this.levelkey||this._decryptdata?(!this._decryptdata&&this.levelkey&&("number"!=typeof(e=this.sn)&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&n.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)),this._decryptdata):null}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){var e;return null!==this.programDateTime&&Object(s.isFiniteNumber)(this.programDateTime)?(e=Object(s.isFiniteNumber)(this.duration)?this.duration:0,this.programDateTime+1e3*e):null}},{key:"encrypted",get:function(){var e;return!(null==(e=this.decryptdata)||!e.keyFormat||!this.decryptdata.uri)}}]),b),A=(c(y,p=g),h(y,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),y);function y(e,t,i,r,s){(i=p.call(this,i)||this).fragOffset=0,i.duration=0,i.gap=!1,i.independent=!1,i.relurl=void 0,i.fragment=void 0,i.index=void 0,i.stats=new l.LoadStats,i.duration=e.decimalFloatingPoint("DURATION"),i.gap=e.bool("GAP"),i.independent=e.bool("INDEPENDENT"),i.relurl=e.enumeratedString("URI"),i.fragment=t,i.index=r;t=e.enumeratedString("BYTERANGE");return t&&i.setByteRange(t,s),s&&(i.fragOffset=s.fragOffset+s.duration),i}function b(e,t){return(t=f.call(this,t)||this)._decryptdata=null,t.rawProgramDateTime=null,t.programDateTime=null,t.tagList=[],t.duration=0,t.sn=0,t.levelkey=void 0,t.type=void 0,t.loader=null,t.level=-1,t.cc=0,t.startPTS=void 0,t.endPTS=void 0,t.appendedPTS=void 0,t.startDTS=void 0,t.endDTS=void 0,t.start=0,t.deltaPTS=void 0,t.maxStartPTS=void 0,t.minEndPTS=void 0,t.stats=new l.LoadStats,t.urlId=0,t.data=void 0,t.bitrateTest=!1,t.title=null,t.initSegment=null,t.type=e,t}function v(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[r.AUDIO]=null,t[r.VIDEO]=null,t[r.AUDIOVIDEO]=null,t),this.baseurl=e}},"./src/loader/key-loader.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return s});var n=i("./src/events.ts"),r=i("./src/errors.ts"),o=i("./src/utils/logger.ts"),s=((t=a.prototype)._registerListeners=function(){this.hls.on(n.Events.KEY_LOADING,this.onKeyLoading,this)},t._unregisterListeners=function(){this.hls.off(n.Events.KEY_LOADING,this.onKeyLoading)},t.destroy=function(){for(var e in this._unregisterListeners(),this.loaders){e=this.loaders[e];e&&e.destroy()}this.loaders={}},t.onKeyLoading=function(e,t){var i,r,t=t.frag,s=t.type,a=this.loaders[s];t.decryptdata?(i=t.decryptdata.uri)!==this.decrypturl||null===this.decryptkey?(r=this.hls.config,a&&(o.logger.warn("abort previous key loader for type:"+s),a.abort()),i?(a=r.loader,s=t.loader=this.loaders[s]=new a(r),this.decrypturl=i,this.decryptkey=null,a={url:i,frag:t,responseType:"arraybuffer"},i={timeout:r.fragLoadingTimeOut,maxRetry:0,retryDelay:r.fragLoadingRetryDelay,maxRetryDelay:r.fragLoadingMaxRetryTimeout,highWaterMark:0},r={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},s.load(a,i,r)):o.logger.warn("key uri is falsy")):this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(n.Events.KEY_LOADED,{frag:t})):o.logger.warn("Missing decryption data on fragment in onKeyLoading")},t.loadsuccess=function(e,t,i){i=i.frag;i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=null,delete this.loaders[i.type],this.hls.trigger(n.Events.KEY_LOADED,{frag:i})):o.logger.error("after key load, decryptdata unset")},t.loaderror=function(e,t){var t=t.frag,i=t.loader;i&&i.abort(),delete this.loaders[t.type],this.hls.trigger(n.Events.ERROR,{type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:t,response:e})},t.loadtimeout=function(e,t){var t=t.frag,i=t.loader;i&&i.abort(),delete this.loaders[t.type],this.hls.trigger(n.Events.ERROR,{type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:t})},a);function a(e){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=e,this._registerListeners()}},"./src/loader/level-details.ts":function(e,t,i){i.r(t),i.d(t,"LevelDetails",function(){return a});var r=i("./src/polyfills/number.ts");function s(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.prototype.reloaded=function(e){var t,i;e?(t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex,this.updated=this.endSN!==e.endSN||!!i||!!t,this.advanced=this.endSN>e.endSN||0<t||0==t&&0<i,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay):(this.advanced=!0,this.updated=!0)},s(n.prototype,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(r.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return 0<e?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]);var a=n;function n(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=e}},"./src/loader/level-key.ts":function(e,t,i){i.r(t),i.d(t,"LevelKey",function(){return a});var r=i("./node_modules/url-toolkit/src/url-toolkit.js");function s(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.fromURL=function(e,t){return new n(e,t)},n.fromURI=function(e){return new n(e)},s(n.prototype,[{key:"uri",get:function(){return this._uri}}]);var a=n;function n(e,t){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,this._uri=t?Object(r.buildAbsoluteURL)(e,t,{alwaysNormalize:!0}):e}},"./src/loader/load-stats.ts":function(e,t,i){i.r(t),i.d(t,"LoadStats",function(){return r});var r=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r});var F=i("./src/polyfills/number.ts"),j=i("./node_modules/url-toolkit/src/url-toolkit.js"),U=i("./src/loader/fragment.ts"),N=i("./src/loader/level-details.ts"),z=i("./src/loader/level-key.ts"),G=i("./src/utils/attr-list.ts"),H=i("./src/utils/logger.ts"),c=i("./src/utils/codecs.ts"),d=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,l=/#EXT-X-MEDIA:(.*)/g,V=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),W=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),K=/\.(mp4|m4s|m4v|m4a)$/i,r=(u.findGroup=function(e,t){for(var i=0;i<e.length;i++){var r=e[i];if(r.id===t)return r}},u.convertAVC1ToAVCOTI=function(e){var t,i=e.split(".");return 2<i.length?(t=i.shift()+".",(t+=parseInt(i.shift()).toString(16))+("000"+parseInt(i.shift()).toString(16)).substr(-4)):e},u.resolve=function(e,t){return j.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},u.parseMasterPlaylist=function(e,t){var i,r,s,a,n=[],o={},l=!1;for(d.lastIndex=0;null!=(i=d.exec(e));)i[1]?(s={attrs:r=new G.AttrList(i[1]),bitrate:r.decimalInteger("AVERAGE-BANDWIDTH")||r.decimalInteger("BANDWIDTH"),name:r.NAME,url:u.resolve(i[2],t)},(a=r.decimalResolution("RESOLUTION"))&&(s.width=a.width,s.height=a.height),function(r,s){["video","audio","text"].forEach(function(t){var e,i=r.filter(function(e){return Object(c.isCodecType)(e,t)});i.length&&(e=i.filter(function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)}),s[t+"Codec"]=(0<e.length?e:i)[0],r=r.filter(function(e){return-1===i.indexOf(e)}))}),s.unknownCodecs=r}((r.CODECS||"").split(/[ ,]+/).filter(function(e){return e}),s),s.videoCodec&&-1!==s.videoCodec.indexOf("avc1")&&(s.videoCodec=u.convertAVC1ToAVCOTI(s.videoCodec)),n.push(s)):i[3]&&(a=new G.AttrList(i[3]))["DATA-ID"]&&(l=!0,o[a["DATA-ID"]]=a);return{levels:n,sessionData:l?o:null}},u.parseMasterPlaylistMedia=function(e,t,i,r){void 0===r&&(r=[]);var s=[],a=0;for(l.lastIndex=0;null!==(o=l.exec(e));){var n,o=new G.AttrList(o[1]);o.TYPE===i&&(o={attrs:o,bitrate:0,id:a++,groupId:o["GROUP-ID"],instreamId:o["INSTREAM-ID"],name:o.NAME||o.LANGUAGE||"",type:i,default:o.bool("DEFAULT"),autoselect:o.bool("AUTOSELECT"),forced:o.bool("FORCED"),lang:o.LANGUAGE,url:o.URI?u.resolve(o.URI,t):""},r.length&&(h(o,n=u.findGroup(r,o.groupId)||r[0],"audioCodec"),h(o,n,"textCodec")),s.push(o))}return s},u.parseLevelPlaylist=function(e,t,i,r,s){var a,n,o,l=new N.LevelDetails(t),c=l.fragments,d=null,u=0,h=0,p=0,f=0,g=null,m=new U.Fragment(r,t),A=-1,y=!1;for(V.lastIndex=0,l.m3u8=e;null!==(a=V.exec(e));){y&&(y=!1,(m=new U.Fragment(r,t)).start=p,m.sn=u,m.cc=f,m.level=i,d)&&(m.initSegment=d,m.rawProgramDateTime=d.rawProgramDateTime);var b=a[1];if(b){m.duration=parseFloat(b);var v=(" "+a[2]).slice(1);m.title=v||null,m.tagList.push(v?["INF",b,v]:["INF",b])}else if(a[3])Object(F.isFiniteNumber)(m.duration)&&(m.start=p,o&&(m.levelkey=o),m.sn=u,m.level=i,m.cc=f,m.urlId=s,c.push(m),m.relurl=(" "+a[3]).slice(1),$(m,g),p+=(g=m).duration,u++,y=!(h=0));else if(a[4]){v=(" "+a[4]).slice(1);g?m.setByteRange(v,g):m.setByteRange(v)}else if(a[5])m.rawProgramDateTime=(" "+a[5]).slice(1),m.tagList.push(["PROGRAM-DATE-TIME",m.rawProgramDateTime]),-1===A&&(A=c.length);else if(a=a[0].match(W)){for(n=1;n<a.length&&void 0===a[n];n++);var E=(" "+a[n]).slice(1),w=(" "+a[n+1]).slice(1),T=a[n+2]?(" "+a[n+2]).slice(1):"";switch(E){case"PLAYLIST-TYPE":l.type=w.toUpperCase();break;case"MEDIA-SEQUENCE":u=l.startSN=parseInt(w);break;case"SKIP":var S=new G.AttrList(w),k=S.decimalInteger("SKIPPED-SEGMENTS");if(Object(F.isFiniteNumber)(k)){for(var O=l.skippedSegments=k;O--;)c.unshift(null);u+=k}k=S.enumeratedString("RECENTLY-REMOVED-DATERANGES");k&&(l.recentlyRemovedDateranges=k.split("\t"));break;case"TARGETDURATION":l.targetduration=parseFloat(w);break;case"VERSION":l.version=parseInt(w);break;case"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"#":(w||T)&&m.tagList.push(T?[w,T]:[w]);break;case"DIS":f++;case"GAP":m.tagList.push([E]);break;case"BITRATE":m.tagList.push([E,w]);break;case"DISCONTINUITY-SEQ":f=parseInt(w);break;case"KEY":var S=new G.AttrList(w),k=S.enumeratedString("METHOD"),_=S.URI,C=S.hexadecimalInteger("IV"),R=S.enumeratedString("KEYFORMATVERSIONS"),D=S.enumeratedString("KEYID"),L=null!=(L=S.enumeratedString("KEYFORMAT"))?L:"identity";-1<["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"].indexOf(L)?H.logger.warn("Keyformat "+L+" is not supported from the manifest"):"identity"===L&&k&&(o=z.LevelKey.fromURL(t,_),_)&&0<=["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(k)&&(o.method=k,o.keyFormat=L,D&&(o.keyID=D),R&&(o.keyFormatVersions=R),o.iv=C);break;case"START":_=new G.AttrList(w).decimalFloatingPoint("TIME-OFFSET");Object(F.isFiniteNumber)(_)&&(l.startTimeOffset=_);break;case"MAP":L=new G.AttrList(w);m.relurl=L.URI,L.BYTERANGE&&m.setByteRange(L.BYTERANGE),m.level=i,m.sn="initSegment",o&&(m.levelkey=o),m.initSegment=null,d=m,y=!0;break;case"SERVER-CONTROL":D=new G.AttrList(w);l.canBlockReload=D.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=D.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=0<l.canSkipUntil&&D.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=D.optionalFloat("PART-HOLD-BACK",0),l.holdBack=D.optionalFloat("HOLD-BACK",0);break;case"PART-INF":R=new G.AttrList(w);l.partTarget=R.decimalFloatingPoint("PART-TARGET");break;case"PART":var C=(C=l.partList)||(l.partList=[]),x=0<h?C[C.length-1]:void 0,I=h++,I=new U.Part(new G.AttrList(w),m,t,I,x);C.push(I),m.duration+=I.duration;break;case"PRELOAD-HINT":x=new G.AttrList(w);l.preloadHint=x;break;case"RENDITION-REPORT":I=new G.AttrList(w);l.renditionReports=l.renditionReports||[],l.renditionReports.push(I);break;default:H.logger.warn("line parsed but not handled: "+a)}}else H.logger.warn("No matches on slow regex match for level playlist!")}g&&!g.relurl?(c.pop(),p-=g.duration,l.partList&&(l.fragmentHint=g)):l.partList&&($(m,g),m.cc=f,l.fragmentHint=m);var P=c.length,B=c[0],M=c[P-1];return 0<(p+=l.skippedSegments*l.targetduration)&&P&&M?(l.averagetargetduration=p/P,P=M.sn,l.endSN="initSegment"!==P?P:0,B&&(l.startCC=B.cc,B.initSegment||l.fragments.every(function(e){return e.relurl&&(e=e.relurl,K.test(null!=(e=null==(e=j.parseURL(e))?void 0:e.path)?e:""))})&&(H.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(m=new U.Fragment(r,t)).relurl=M.relurl,m.level=i,m.sn="initSegment",B.initSegment=m,l.needSidxRanges=!0))):(l.endSN=0,l.startCC=0),l.fragmentHint&&(p+=l.fragmentHint.duration),l.totalduration=p,l.endCC=f,0<A&&function(e,t){for(var i=e[t],r=t;r--;){var s=e[r];if(!s)return;s.programDateTime=i.programDateTime-1e3*s.duration,i=s}}(c,A),l},u);function u(){}function h(e,t,i){t=t[i];t&&(e[i]=t)}function $(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Object(F.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(e,t,i){i.r(t);var h=i("./src/polyfills/number.ts"),p=i("./src/events.ts"),f=i("./src/errors.ts"),u=i("./src/utils/logger.ts"),s=i("./src/utils/mp4-tools.ts"),g=i("./src/loader/m3u8-parser.ts"),m=i("./src/types/loader.ts"),A=i("./src/utils/attr-list.ts");function y(e,t){e=e.url;return e=void 0!==e&&0!==e.indexOf("data:")?e:t.url}function r(e){this.hls=void 0,this.loaders=Object.create(null),this.hls=e,this.registerListeners()}(i=r.prototype).registerListeners=function(){var e=this.hls;e.on(p.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(p.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},i.unregisterListeners=function(){var e=this.hls;e.off(p.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(p.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},i.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,r=t.loader,i=new(i||r)(t);return e.loader=i,this.loaders[e.type]=i},i.getInternalLoader=function(e){return this.loaders[e.type]},i.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},i.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},i.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},i.onManifestLoading=function(e,t){t=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:m.PlaylistContextType.MANIFEST,url:t,deliveryDirectives:null})},i.onLevelLoading=function(e,t){var i=t.id,r=t.level,s=t.url,t=t.deliveryDirectives;this.load({id:i,groupId:null,level:r,responseType:"text",type:m.PlaylistContextType.LEVEL,url:s,deliveryDirectives:t})},i.onAudioTrackLoading=function(e,t){var i=t.id,r=t.groupId,s=t.url,t=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:m.PlaylistContextType.AUDIO_TRACK,url:s,deliveryDirectives:t})},i.onSubtitleTrackLoading=function(e,t){var i=t.id,r=t.groupId,s=t.url,t=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:m.PlaylistContextType.SUBTITLE_TRACK,url:s,deliveryDirectives:t})},i.load=function(e){var t,i,r,s,a=this.hls.config;if(o=this.getInternalLoader(e)){var n=o.context;if(n&&n.url===e.url)return void u.logger.trace("[playlist-loader]: playlist request ongoing");u.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),o.abort()}switch(e.type){case m.PlaylistContextType.MANIFEST:t=a.manifestLoadingMaxRetry,i=a.manifestLoadingTimeOut,r=a.manifestLoadingRetryDelay,s=a.manifestLoadingMaxRetryTimeout;break;case m.PlaylistContextType.LEVEL:case m.PlaylistContextType.AUDIO_TRACK:case m.PlaylistContextType.SUBTITLE_TRACK:t=0,i=a.levelLoadingTimeOut;break;default:t=a.levelLoadingMaxRetry,i=a.levelLoadingTimeOut,r=a.levelLoadingRetryDelay,s=a.levelLoadingMaxRetryTimeout}var o=this.createInternalLoader(e),n=(null!=(n=e.deliveryDirectives)&&n.part&&(e.type===m.PlaylistContextType.LEVEL&&null!==e.level?l=this.hls.levels[e.level].details:e.type===m.PlaylistContextType.AUDIO_TRACK&&null!==e.id?l=this.hls.audioTracks[e.id].details:e.type===m.PlaylistContextType.SUBTITLE_TRACK&&null!==e.id&&(l=this.hls.subtitleTracks[e.id].details),l)&&(n=l.partTarget,l=l.targetduration,n&&l&&(i=Math.min(1e3*Math.max(3*n,.8*l),i))),{timeout:i,maxRetry:t,retryDelay:r,maxRetryDelay:s,highWaterMark:0}),l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};o.load(e,n,l)},i.loadsuccess=function(e,t,i,r){var s;void 0===r&&(r=null),i.isSidxRequest?(this.handleSidxRequest(e,i),this.handlePlaylistLoaded(e,t,i,r)):(this.resetInternalLoader(i.type),0===(s=e.data).indexOf("#EXTM3U")?(t.parsing.start=performance.now(),0<s.indexOf("#EXTINF:")||0<s.indexOf("#EXT-X-TARGETDURATION:")?this.handleTrackOrLevelPlaylist(e,t,i,r):this.handleMasterPlaylist(e,t,i,r)):this.handleManifestParsingError(e,i,"no EXTM3U delimiter",r))},i.loaderror=function(e,t,i){this.handleNetworkError(t,i=void 0===i?null:i,!1,e)},i.loadtimeout=function(e,t,i){this.handleNetworkError(t,i=void 0===i?null:i,!0)},i.handleMasterPlaylist=function(e,t,i,r){var s,a,n=this.hls,o=e.data,l=y(e,i),c=g.default.parseMasterPlaylist(o,l),d=c.levels,c=c.sessionData;d.length?(s=d.map(function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}}),a=d.map(function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}}),s=g.default.parseMasterPlaylistMedia(o,l,"AUDIO",s),a=g.default.parseMasterPlaylistMedia(o,l,"SUBTITLES",a),o=g.default.parseMasterPlaylistMedia(o,l,"CLOSED-CAPTIONS"),s.length&&!s.some(function(e){return!e.url})&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(u.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),s.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new A.AttrList({}),bitrate:0,url:""})),n.trigger(p.Events.MANIFEST_LOADED,{levels:d,audioTracks:s,subtitles:a,captions:o,url:l,stats:t,networkDetails:r,sessionData:c})):this.handleManifestParsingError(e,i,"no level found in manifest",r)},i.handleTrackOrLevelPlaylist=function(e,t,i,r){var s=this.hls,a=i.id,n=i.level,o=i.type,l=y(e,i),c=Object(h.isFiniteNumber)(a)?a:0,d=Object(h.isFiniteNumber)(n)?n:c,u=function(){switch(i.type){case m.PlaylistContextType.AUDIO_TRACK:return m.PlaylistLevelType.AUDIO;case m.PlaylistContextType.SUBTITLE_TRACK:return m.PlaylistLevelType.SUBTITLE;default:return m.PlaylistLevelType.MAIN}}(),d=g.default.parseLevelPlaylist(e.data,l,d,u,c);d.fragments.length?(o===m.PlaylistContextType.MANIFEST&&(u={attrs:new A.AttrList({}),bitrate:0,details:d,name:"",url:l},s.trigger(p.Events.MANIFEST_LOADED,{levels:[u],audioTracks:[],url:l,stats:t,networkDetails:r,sessionData:null})),t.parsing.end=performance.now(),d.needSidxRanges?(u=null==(c=d.fragments[0].initSegment)?void 0:c.url,this.load({url:u,isSidxRequest:!0,type:o,level:n,levelDetails:d,id:a,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})):(i.levelDetails=d,this.handlePlaylistLoaded(e,t,i,r))):s.trigger(p.Events.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:l,reason:"no fragments found in level",level:"number"==typeof i.level?i.level:void 0})},i.handleSidxRequest=function(e,t){var i,r=Object(s.parseSegmentIndex)(new Uint8Array(e.data));r&&(e=r.references,i=t.levelDetails,e.forEach(function(e,t){e=e.info,t=i.fragments[t];0===t.byteRange.length&&t.setByteRange(String(1+e.end-e.start)+"@"+String(e.start)),t.initSegment&&t.initSegment.setByteRange(String(r.moovEndOffset)+"@0")}))},i.handleManifestParsingError=function(e,t,i,r){this.hls.trigger(p.Events.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===m.PlaylistContextType.MANIFEST,url:e.url,reason:i,response:e,context:t,networkDetails:r})},i.handleNetworkError=function(e,t,i,r){u.logger.warn("[playlist-loader]: A network "+((i=void 0===i?!1:i)?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var s=f.ErrorDetails.UNKNOWN,a=!1,n=this.getInternalLoader(e);switch(e.type){case m.PlaylistContextType.MANIFEST:s=i?f.ErrorDetails.MANIFEST_LOAD_TIMEOUT:f.ErrorDetails.MANIFEST_LOAD_ERROR,a=!0;break;case m.PlaylistContextType.LEVEL:s=i?f.ErrorDetails.LEVEL_LOAD_TIMEOUT:f.ErrorDetails.LEVEL_LOAD_ERROR,a=!1;break;case m.PlaylistContextType.AUDIO_TRACK:s=i?f.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:f.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,a=!1;break;case m.PlaylistContextType.SUBTITLE_TRACK:s=i?f.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:f.ErrorDetails.SUBTITLE_LOAD_ERROR,a=!1}n&&this.resetInternalLoader(e.type);n={type:f.ErrorTypes.NETWORK_ERROR,details:s,fatal:a,url:e.url,loader:n,context:e,networkDetails:t};r&&(n.response=r),this.hls.trigger(p.Events.ERROR,n)},i.handlePlaylistLoaded=function(e,t,i,r){var s=i.type,a=i.level,n=i.id,o=i.groupId,l=i.loader,c=i.levelDetails,d=i.deliveryDirectives;if(null!=c&&c.targetduration){if(l)switch(c.live&&(l.getCacheAge&&(c.ageHeader=l.getCacheAge()||0),l.getCacheAge&&!isNaN(c.ageHeader)||(c.ageHeader=0)),s){case m.PlaylistContextType.MANIFEST:case m.PlaylistContextType.LEVEL:this.hls.trigger(p.Events.LEVEL_LOADED,{details:c,level:a||0,id:n||0,stats:t,networkDetails:r,deliveryDirectives:d});break;case m.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(p.Events.AUDIO_TRACK_LOADED,{details:c,id:n||0,groupId:o||"",stats:t,networkDetails:r,deliveryDirectives:d});break;case m.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(p.Events.SUBTITLE_TRACK_LOADED,{details:c,id:n||0,groupId:o||"",stats:t,networkDetails:r,deliveryDirectives:d})}}else this.handleManifestParsingError(e,i,"invalid target duration",r)},t.default=r},"./src/polyfills/number.ts":function(e,t,i){i.r(t),i.d(t,"isFiniteNumber",function(){return r}),i.d(t,"MAX_SAFE_INTEGER",function(){return s});var r=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},s=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(e,t,i){function r(){}i.r(t),r.getSilentFrame=function(e,t){return"mp4a.40.2"===e?1===t?new Uint8Array([0,200,0,128,35,128]):2===t?new Uint8Array([33,0,73,144,2,25,0,35,128]):3===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]):4===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]):5===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]):6===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]):void 0:1===t?new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]):2===t||3===t?new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]):void 0},t.default=r},"./src/remux/mp4-generator.ts":function(e,t,i){i.r(t);var a=Math.pow(2,32)-1,i=(u.init=function(){for(var e in u.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]})u.types.hasOwnProperty(e)&&(u.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),t=(u.HDLR_TYPES={video:t,audio:i},new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])),i=new Uint8Array([0,0,0,0,0,0,0,0]),i=(u.STTS=u.STSC=u.STCO=i,u.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),u.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),u.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),u.STSD=new Uint8Array([0,0,0,0,0,0,0,1]),new Uint8Array([105,115,111,109])),r=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);u.FTYP=u.box(u.types.ftyp,i,s,i,r),u.DINF=u.box(u.types.dinf,u.box(u.types.dref,t))},u.box=function(e){for(var t=8,i=arguments.length,r=new Array(1<i?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];for(var a=r.length,n=a;a--;)t+=r[a].byteLength;var o=new Uint8Array(t);for(o[0]=t>>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),a=0,t=8;a<n;a++)o.set(r[a],t),t+=r[a].byteLength;return o},u.hdlr=function(e){return u.box(u.types.hdlr,u.HDLR_TYPES[e])},u.mdat=function(e){return u.box(u.types.mdat,e)},u.mdhd=function(e,t){t*=e;var i=Math.floor(t/(1+a)),t=Math.floor(t%(1+a));return u.box(u.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t,85,196,0,0]))},u.mdia=function(e){return u.box(u.types.mdia,u.mdhd(e.timescale,e.duration),u.hdlr(e.type),u.minf(e))},u.mfhd=function(e){return u.box(u.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},u.minf=function(e){return"audio"===e.type?u.box(u.types.minf,u.box(u.types.smhd,u.SMHD),u.DINF,u.stbl(e)):u.box(u.types.minf,u.box(u.types.vmhd,u.VMHD),u.DINF,u.stbl(e))},u.moof=function(e,t,i){return u.box(u.types.moof,u.mfhd(e),u.traf(i,t))},u.moov=function(e){for(var t=e.length,i=[];t--;)i[t]=u.trak(e[t]);return u.box.apply(null,[u.types.moov,u.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(u.mvex(e)))},u.mvex=function(e){for(var t=e.length,i=[];t--;)i[t]=u.trex(e[t]);return u.box.apply(null,[u.types.mvex].concat(i))},u.mvhd=function(e,t){t*=e;var i=Math.floor(t/(1+a)),t=Math.floor(t%(1+a)),e=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t,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 u.box(u.types.mvhd,e)},u.sdtp=function(e){for(var t,i=e.samples||[],r=new Uint8Array(4+i.length),s=0;s<i.length;s++)t=i[s].flags,r[s+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return u.box(u.types.sdtp,r)},u.stbl=function(e){return u.box(u.types.stbl,u.stsd(e),u.box(u.types.stts,u.STTS),u.box(u.types.stsc,u.STSC),u.box(u.types.stsz,u.STSZ),u.box(u.types.stco,u.STCO))},u.avc1=function(e){for(var t,i,r=[],s=[],a=0;a<e.sps.length;a++)i=(t=e.sps[a]).byteLength,r.push(i>>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(t));for(a=0;a<e.pps.length;a++)i=(t=e.pps[a]).byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(t));var n=u.box(u.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(s))),o=e.width,l=e.height,c=e.pixelRatio[0],d=e.pixelRatio[1];return u.box(u.types.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,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n,u.box(u.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),u.box(u.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,d>>24,d>>16&255,d>>8&255,255&d])))},u.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},u.mp4a=function(e){var t=e.samplerate;return u.box(u.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]),u.box(u.types.esds,u.esds(e)))},u.mp3=function(e){var t=e.samplerate;return u.box(u.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]))},u.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?u.box(u.types.stsd,u.STSD,u.mp4a(e)):u.box(u.types.stsd,u.STSD,u.mp3(e)):u.box(u.types.stsd,u.STSD,u.avc1(e))},u.tkhd=function(e){var t=e.id,i=e.duration*e.timescale,r=e.width,e=e.height,s=Math.floor(i/(1+a)),i=Math.floor(i%(1+a));return u.box(u.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,i>>24,i>>16&255,i>>8&255,255&i,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,e>>8&255,255&e,0,0]))},u.traf=function(e,t){var i=u.sdtp(e),r=e.id,s=Math.floor(t/(1+a)),t=Math.floor(t%(1+a));return u.box(u.types.traf,u.box(u.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),u.box(u.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t])),u.trun(e,i.length+16+20+8+16+8+8),i)},u.trak=function(e){return e.duration=e.duration||4294967295,u.box(u.types.trak,u.tkhd(e),u.mdia(e))},u.trex=function(e){e=e.id;return u.box(u.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},u.trun=function(e,t){var i,r,s,a,n,o=e.samples||[],l=o.length,e=12+16*l,c=new Uint8Array(e);for(c.set([0,0,15,1,l>>>24&255,l>>>16&255,l>>>8&255,255&l,(t+=8+e)>>>24&255,t>>>16&255,t>>>8&255,255&t],0),i=0;i<l;i++)r=(n=o[i]).duration,s=n.size,a=n.flags,n=n.cts,c.set([r>>>24&255,r>>>16&255,r>>>8&255,255&r,s>>>24&255,s>>>16&255,s>>>8&255,255&s,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,61440&a.degradPrio,15&a.degradPrio,n>>>24&255,n>>>16&255,n>>>8&255,255&n],12+16*i);return u.box(u.types.trun,c)},u.initSegment=function(e){u.types||u.init();var e=u.moov(e),t=new Uint8Array(u.FTYP.byteLength+e.byteLength);return t.set(u.FTYP),t.set(e,u.FTYP.byteLength),t},u);function u(){}i.types=void 0,i.HDLR_TYPES=void 0,i.STTS=void 0,i.STSC=void 0,i.STCO=void 0,i.STSZ=void 0,i.VMHD=void 0,i.SMHD=void 0,i.STSD=void 0,i.FTYP=void 0,i.DINF=void 0,t.default=i},"./src/remux/mp4-remuxer.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r}),i.d(t,"normalizePts",function(){return X});var h=i("./src/polyfills/number.ts"),F=i("./src/remux/aac-helper.ts"),V=i("./src/remux/mp4-generator.ts"),W=i("./src/events.ts"),K=i("./src/errors.ts"),$=i("./src/utils/logger.ts"),w=i("./src/types/loader.ts"),J=i("./src/utils/timescale-conversion.ts");function q(){return(q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}var Q=null,s=null,Y=!1,r=((t=a.prototype).destroy=function(){},t.resetTimeStamp=function(e){$.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){$.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){$.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},t.getVideoStartPts=function(e){var r=!1,e=e.reduce(function(e,t){var i=t.pts-e;return i<-4294967296?(r=!0,X(e,t.pts)):0<i?e:t.pts},e[0].pts);return r&&$.logger.debug("PTS rollover detected"),e},t.remux=function(e,t,i,r,s,a,n,o){var l,c,d,u,h,p,f,g=s,m=s,A=-1<e.pid,y=-1<t.pid,b=t.samples.length,v=0<e.samples.length,E=1<b;return(A&&!v||y&&!E)&&!this.ISGenerated&&!n||(this.ISGenerated||(d=this.generateIS(e,t,s)),A=this.isVideoContiguous,n=-1,E&&(n=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!A)&&this.config.forceKeyFrameOnDiscontinuity&&(p=!0,0<n?($.logger.warn("[mp4-remuxer]: Dropped "+n+" out of "+b+" video samples due to a missing keyframe"),f=this.getVideoStartPts(t.samples),t.samples=t.samples.slice(n),t.dropped+=n,m+=(t.samples[0].pts-f)/(t.timescale||9e4)):-1===n&&($.logger.warn("[mp4-remuxer]: No keyframe found out of "+b+" video samples"),p=!1)),this.ISGenerated&&(v&&E&&(f=this.getVideoStartPts(t.samples),b=(X(e.samples[0].pts,f)-f)/t.inputTimeScale,g+=Math.max(0,b),m+=Math.max(0,-b)),v?(e.samplerate||($.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),d=this.generateIS(e,t,s)),c=this.remuxAudio(e,g,this.isAudioContiguous,a,y||E||o===w.PlaylistLevelType.AUDIO?m:void 0),E&&(f=c?c.endPTS-c.startPTS:0,t.inputTimeScale||($.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),d=this.generateIS(e,t,s)),l=this.remuxVideo(t,m,A,f))):E&&(l=this.remuxVideo(t,m,A,0)),l)&&(l.firstKeyFrame=n,l.independent=-1!==n)),{audio:c,video:l,initSegment:d,independent:p,text:u=this.ISGenerated&&(i.samples.length&&(h=this.remuxID3(i,s)),r.samples.length)?this.remuxText(r,s):u,id3:h}},t.generateIS=function(e,t,i){var r,s,a,n=e.samples,o=t.samples,l=this.typeSupported,c={},d=!Object(h.isFiniteNumber)(this._initPTS),u="audio/mp4";if(d&&(a=s=1/0),e.config&&n.length&&(e.timescale=e.samplerate,e.isAAC||(l.mpeg?(u="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3")),c.audio={id:"audio",container:u,codec:e.codec,initSegment:!e.isAAC&&l.mpeg?new Uint8Array(0):V.default.initSegment([e]),metadata:{channelCount:e.channelCount}},d)&&(r=e.inputTimeScale,a=s=n[0].pts-Math.round(r*i)),t.sps&&t.pps&&o.length&&(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:V.default.initSegment([t]),metadata:{width:t.width,height:t.height}},d)&&(r=t.inputTimeScale,u=this.getVideoStartPts(o),l=Math.round(r*i),s=Math.min(s,X(o[0].dts,u)-l),a=Math.min(a,u-l)),Object.keys(c).length)return this.ISGenerated=!0,d&&(this._initPTS=a,this._initDTS=s),{tracks:c,initPTS:a,timescale:r}},t.remuxVideo=function(e,t,i,r){var s,a=e.inputTimeScale,n=e.samples,o=[],l=n.length,c=this._initPTS,d=this.nextAvcDts,u=8,h=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,f=0,g=!1;i&&null!==d||(d=t*a-(n[0].pts-X(n[0].dts,n[0].pts)));for(var m=0;m<l;m++){var A=n[m];A.pts=X(A.pts-c,d),A.dts=X(A.dts-c,d),A.dts>A.pts&&(f=Math.max(Math.min(f,A.pts-A.dts),-18e3)),A.dts<n[0<m?m-1:m].dts&&(g=!0)}g&&n.sort(function(e,t){var i=e.dts-t.dts,e=e.pts-t.pts;return i||e}),y=n[0].dts;var y,t=n[n.length-1].dts,b=Math.round((t-y)/(l-1));if(f<0){if(f<-2*b){$.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(J.toMsFromMpegTsClock)(-b,!0)+" ms");for(var v=f,E=0;E<l;E++)n[E].dts=v=Math.max(v,n[E].pts-b),n[E].pts=Math.max(v,n[E].pts)}else{$.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(J.toMsFromMpegTsClock)(f,!0)+" ms to overcome this issue");for(var w=0;w<l;w++)n[w].dts=n[w].dts+f}y=n[0].dts}i&&((D=b<(i=y-d))||i<-1)&&(D?$.logger.warn("AVC: "+Object(J.toMsFromMpegTsClock)(i,!0)+" ms ("+i+"dts) hole between fragments detected, filling it"):$.logger.warn("AVC: "+Object(J.toMsFromMpegTsClock)(-i,!0)+" ms ("+i+"dts) overlapping between fragments detected"),y=d,D=n[0].pts-i,n[0].dts=y,n[0].pts=D,$.logger.log("Video: First PTS/DTS adjusted: "+Object(J.toMsFromMpegTsClock)(D,!0)+"/"+Object(J.toMsFromMpegTsClock)(y,!0)+", delta: "+Object(J.toMsFromMpegTsClock)(i,!0)+" ms")),Y&&(y=Math.max(0,y));for(var T=0,O=0,S=0;S<l;S++){for(var k=n[S],F=k.units,j=F.length,_=0,C=0;C<j;C++)_+=F[C].data.length;O+=_,T+=j,k.length=_,k.dts=Math.max(k.dts,y),k.pts=Math.max(k.pts,k.dts,0),h=Math.min(k.pts,h),p=Math.max(k.pts,p)}t=n[l-1].dts;var R,D=O+4*T+8;try{R=new Uint8Array(D)}catch(e){return void this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:K.ErrorTypes.MUX_ERROR,details:K.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:D,reason:"fail allocating video mdat "+D})}var U=new DataView(R.buffer);U.setUint32(0,D),R.set(V.default.types.mdat,4);for(var L=0;L<l;L++){for(var x,I=n[L],N=I.units,z=0,P=0,G=N.length;P<G;P++){var B=N[P],H=B.data,B=B.data.byteLength;U.setUint32(u,B),u+=4,R.set(H,u),u+=B,z+=4+B}L<l-1?s=n[L+1].dts-I.dts:(M=this.config,x=I.dts-n[0<L?L-1:L].dts,M.stretchShortVideoTrack&&null!==this.nextAudioPts&&Math.floor(M.maxBufferHole*a)<(M=(r?h+r*a:this.nextAudioPts)-I.pts)?((s=M-x)<0&&(s=x),$.logger.log("[mp4-remuxer]: It is approximately "+M/90+" ms to the next segment; using duration "+s/90+" ms for the last video frame.")):s=x);var M=Math.round(I.pts-I.dts);o.push(new Z(I.key,s,z,M))}o.length&&Q&&Q<70&&((i=o[0].flags).dependsOn=2,i.isNonSync=0),console.assert(void 0!==s,"mp4SampleDuration must be computed"),this.nextAvcDts=d=t+s,this.isVideoContiguous=!0;D={data1:V.default.moof(e.sequenceNumber++,y,q({},e,{samples:o})),data2:R,startPTS:h/a,endPTS:(p+s)/a,startDTS:y/a,endDTS:d/a,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,console.assert(R.length,"MDAT length must not be zero"),D},t.remuxAudio=function(e,t,i,r,s){var a=e.inputTimeScale,n=a/(e.samplerate||a),o=e.isAAC?1024:1152,l=o*n,c=this._initPTS,d=!e.isAAC&&this.typeSupported.mpeg,u=[],h=e.samples,p=d?0:8,f=this.nextAudioPts||-1,g=t*a;if(this.isAudioContiguous=i=i||h.length&&0<f&&(r&&Math.abs(g-f)<9e3||Math.abs(X(h[0].pts-c,g)-f)<20*l),h.forEach(function(e){e.pts=X(e.pts-c,g)}),!i||f<0){if(!(h=h.filter(function(e){return 0<=e.pts})).length)return;f=0===s?0:r?Math.max(0,g):h[0].pts}if(e.isAAC)for(var m=void 0!==s,A=this.config.maxAudioFramesDrift,y=0,b=f;y<h.length;y++){var v=h[y],E=v.pts,w=E-b,T=Math.abs(1e3*w/a);if(w<=-A*l&&m)0===y&&($.logger.warn("Audio frame @ "+(E/a).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*w/a)+" ms."),this.nextAudioPts=f=b=E);else if(A*l<=w&&T<1e4&&m){var S=Math.round(w/l);(b=E-S*l)<0&&(S--,b+=l),0===y&&(this.nextAudioPts=f=b),$.logger.warn("[mp4-remuxer]: Injecting "+S+" audio frame @ "+(b/a).toFixed(3)+"s due to "+Math.round(1e3*w/a)+" ms gap.");for(var k=0;k<S;k++){var _=Math.max(b,0),C=F.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);C||($.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),C=v.unit.subarray()),h.splice(y,0,{unit:C,pts:_}),b+=l,y++}}v.pts=b,b+=l}for(var R,D=null,L=null,x=0,I=h.length;I--;)x+=h[I].unit.byteLength;for(var P=0,O=h.length;P<O;P++){var B=h[P],M=B.unit,B=B.pts;if(null!==L)u[P-1].duration=Math.round((B-L)/n);else{if(D=B=i&&e.isAAC?f:B,!(0<x))return;x+=p;try{R=new Uint8Array(x)}catch(e){return void this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:K.ErrorTypes.MUX_ERROR,details:K.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:x,reason:"fail allocating audio mdat "+x})}d||(new DataView(R.buffer).setUint32(0,x),R.set(V.default.types.mdat,4))}R.set(M,p);M=M.byteLength;p+=M,u.push(new Z(!0,o,M,0)),L=B}t=u.length;if(t)return this.nextAudioPts=f=L+n*u[u.length-1].duration,r={data1:d?new Uint8Array(0):V.default.moof(e.sequenceNumber++,D/n,q({},e,{samples:u})),data2:R,startPTS:r=D/a,endPTS:s=f/a,startDTS:r,endDTS:s,type:"audio",hasAudio:!0,hasVideo:!(e.samples=[]),nb:t},this.isAudioContiguous=!0,console.assert(R.length,"MDAT length must not be zero"),r},t.remuxEmptyAudio=function(e,t,i,r){var s=e.inputTimeScale,a=s/(e.samplerate||s),n=this.nextAudioPts,o=(null!==n?n:r.startDTS*s)+this._initDTS,n=r.endDTS*s+this._initDTS,l=1024*a,c=Math.ceil((n-o)/l),d=F.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if($.logger.warn("[mp4-remuxer]: remux empty Audio"),d){for(var u=[],h=0;h<c;h++){var p=o+h*l;u.push({unit:d,pts:p,dts:p})}return e.samples=u,this.remuxAudio(e,t,i,!1)}$.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},t.remuxID3=function(e,t){var i=e.samples.length;if(i){for(var r=e.inputTimeScale,s=this._initPTS,a=this._initDTS,n=0;n<i;n++){var o=e.samples[n];o.pts=X(o.pts-s,t*r)/r,o.dts=X(o.dts-a,t*r)/r}var l=e.samples;return e.samples=[],{samples:l}}},t.remuxText=function(e,t){var i=e.samples.length;if(i){for(var r=e.inputTimeScale,s=this._initPTS,a=0;a<i;a++){var n=e.samples[a];n.pts=X(n.pts-s,t*r)/r}e.samples.sort(function(e,t){return e.pts-t.pts});var o=e.samples;return e.samples=[],{samples:o}}},a);function a(e,t,i,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===Q&&(e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i),Q=e?parseInt(e[1]):0),null===s&&(t=navigator.userAgent.match(/Safari\/(\d+)/i),s=t?parseInt(t[1]):0),Y=!!Q&&Q<75||!!s&&s<600}function X(e,t){var i;if(null!==t)for(i=t<e?-8589934592:8589934592;4294967296<Math.abs(e-t);)e+=i;return e}var Z=function(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags=new n(e)},n=function(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}},"./src/remux/passthrough-remuxer.ts":function(e,t,i){i.r(t);var u=i("./src/polyfills/number.ts"),h=i("./src/utils/mp4-tools.ts"),a=i("./src/loader/fragment.ts"),p=i("./src/utils/logger.ts");(i=r.prototype).destroy=function(){},i.resetTimeStamp=function(e){this.initPTS=e,this.lastEndDTS=null},i.resetNextTimestamp=function(){this.lastEndDTS=null},i.resetInitSegment=function(e,t,i){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e),this.emitInitSegment=!0},i.generateInitSegment=function(e){var t,i,r=this.audioCodec,s=this.videoCodec;e&&e.byteLength?(t=this.initData=Object(h.parseInitSegment)(e),r=r||n(t.audio,a.ElementaryStreamTypes.AUDIO),s=s||n(t.video,a.ElementaryStreamTypes.VIDEO),i={},t.audio&&t.video?i.audiovideo={container:"video/mp4",codec:r+","+s,initSegment:e,id:"main"}:t.audio?i.audio={container:"audio/mp4",codec:r,initSegment:e,id:"audio"}:t.video?i.video={container:"video/mp4",codec:s,initSegment:e,id:"main"}:p.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i):(this.initTracks=void 0,this.initData=void 0)},i.remux=function(e,t,i,r,s){var a,n,o,l=this.initPTS,c=this.lastEndDTS,d={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0},s=(Object(u.isFiniteNumber)(c)||(c=this.lastEndDTS=s||0),t.samples);return s&&s.length&&(t={initPTS:void 0,timescale:1},(o=this.initData)&&o.length||(this.generateInitSegment(s),o=this.initData),o&&o.length?(this.emitInitSegment&&(t.tracks=this.initTracks,this.emitInitSegment=!1),Object(u.isFiniteNumber)(l)||(this.initPTS=t.initPTS=l=f(o,s,c)),a=(n=Object(h.getDuration)(s,o))+(c=c),Object(h.offsetStartDTS)(o,s,l),0<n?this.lastEndDTS=a:(p.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp()),l="",(n=!!o.audio)&&(l+="audio"),(o=!!o.video)&&(l+="video"),d.audio="audio"===(s={data1:s,startPTS:c,startDTS:c,endPTS:a,endDTS:a,type:l,hasAudio:n,hasVideo:o,nb:1,dropped:0}).type?s:void 0,d.video="audio"!==s.type?s:void 0,d.text=r,d.id3=i,d.initSegment=t):p.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment.")),d};var f=function(e,t,i){return Object(h.getStartDTS)(e,t)-i};function r(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}function n(e,t){e=null==e?void 0:e.codec;return e&&4<e.length?e:"hvc1"===e?"hvc1.1.c.L120.90":"av01"===e?"av01.0.04M.08":"avc1"===e||t===a.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}t.default=r},"./src/task-loop.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r});(i=s.prototype).destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},i.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},i.onHandlerDestroyed=function(){},i.hasInterval=function(){return!!this._tickInterval},i.hasNextTick=function(){return!!this._tickTimer},i.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},i.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),!(this._tickInterval=null))},i.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),!(this._tickTimer=null))},i.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),1<this._tickCallCount&&this.tickImmediate(),this._tickCallCount=0)},i.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},i.doTick=function(){};var r=s;function s(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}},"./src/types/cmcd.ts":function(e,t,i){i.r(t),i.d(t,"CMCDVersion",function(){return n}),i.d(t,"CMCDObjectType",function(){return r}),i.d(t,"CMCDStreamingFormat",function(){return s}),i.d(t,"CMCDStreamType",function(){return a});var r,s,a,n=1;(i=r=r||{}).MANIFEST="m",i.AUDIO="a",i.VIDEO="v",i.MUXED="av",i.INIT="i",i.CAPTION="c",i.TIMED_TEXT="tt",i.KEY="k",i.OTHER="o",(t=s=s||{}).DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o",(i=a=a||{}).VOD="v",i.LIVE="l"},"./src/types/level.ts":function(e,t,i){function r(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var s;function a(e,t){var i=e.canSkipUntil,r=e.canSkipDateRanges,e=e.endSN;return i&&(void 0!==t?t-e:0)<i?r?s.v2:s.Yes:s.No}i.r(t),i.d(t,"HlsSkip",function(){return s}),i.d(t,"getSkipValue",function(){return a}),i.d(t,"HlsUrlParameters",function(){return n}),i.d(t,"Level",function(){return o}),(i=s=s||{}).No="",i.Yes="YES",i.v2="v2";c.prototype.addDirectives=function(e){e=new self.URL(e);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.toString()};var n=c,o=(r(l.prototype,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(e){e%=this.url.length;this._urlId!==e&&(this.details=void 0,this._urlId=e)}}]),l);function l(e){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[e.url],this.attrs=e.attrs,this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.unknownCodecs=e.unknownCodecs,this.codecSet=[e.videoCodec,e.audioCodec].filter(function(e){return e}).join(",").replace(/\.[^.,]+/g,"")}function c(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}},"./src/types/loader.ts":function(e,t,i){var r,s;i.r(t),i.d(t,"PlaylistContextType",function(){return r}),i.d(t,"PlaylistLevelType",function(){return s}),(i=r=r||{}).MANIFEST="manifest",i.LEVEL="level",i.AUDIO_TRACK="audioTrack",i.SUBTITLE_TRACK="subtitleTrack",(t=s=s||{}).MAIN="main",t.AUDIO="audio",t.SUBTITLE="subtitle"},"./src/types/transmuxer.ts":function(e,t,i){i.r(t),i.d(t,"ChunkMetadata",function(){return r});var r=function(e,t,i,r,s,a){void 0===r&&(r=0),void 0===s&&(s=-1),void 0===a&&(a=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=s,this.partial=a}},"./src/utils/attr-list.ts":function(e,t,i){i.r(t),i.d(t,"AttrList",function(){return a});var r=/^(\d+)x(\d+)$/,s=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,a=((i=n.prototype).decimalInteger=function(e){e=parseInt(this[e],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},i.hexadecimalInteger=function(e){if(this[e]){for(var t=(1&(t=(this[e]||"0x").slice(2)).length?"0":"")+t,i=new Uint8Array(t.length/2),r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(2*r,2*r+2),16);return i}return null},i.hexadecimalIntegerAsNumber=function(e){e=parseInt(this[e],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},i.decimalFloatingPoint=function(e){return parseFloat(this[e])},i.optionalFloat=function(e,t){e=this[e];return e?parseFloat(e):t},i.enumeratedString=function(e){return this[e]},i.bool=function(e){return"YES"===this[e]},i.decimalResolution=function(e){e=r.exec(this[e]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},n.parseAttrList=function(e){var t,i={};for(s.lastIndex=0;null!==(t=s.exec(e));){var r=t[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[t[1]]=r}return i},n);function n(e){for(var t in e="string"==typeof e?n.parseAttrList(e):e)e.hasOwnProperty(t)&&(this[t]=e[t])}},"./src/utils/binary-search.ts":function(e,t,i){i.r(t),t.default={search:function(e,t){for(var i,r,s=0,a=e.length-1;s<=a;){var n=t(r=e[i=(s+a)/2|0]);if(0<n)s=1+i;else{if(!(n<0))return r;a=i-1}}return null}}},"./src/utils/buffer-helper.ts":function(e,t,i){i.r(t),i.d(t,"BufferHelper",function(){return a});var r=i("./src/utils/logger.ts"),s={length:0,start:function(){return 0},end:function(){return 0}},a=(n.isBuffered=function(e,t){try{if(e)for(var i=n.getBuffered(e),r=0;r<i.length;r++)if(t>=i.start(r)&&t<=i.end(r))return!0}catch(e){}return!1},n.bufferInfo=function(e,t,i){try{if(e){for(var r=n.getBuffered(e),s=[],a=0;a<r.length;a++)s.push({start:r.start(a),end:r.end(a)});return this.bufferedInfo(s,t,i)}}catch(e){}return{len:0,start:t,end:t,nextStart:void 0}},n.bufferedInfo=function(e,t,i){t=Math.max(0,t),e.sort(function(e,t){return e.start-t.start||t.end-e.end});var r=[];if(i)for(var s=0;s<e.length;s++){var a,n=r.length;n&&(a=r[n-1].end,e[s].start-a<i)?e[s].end>a&&(r[n-1].end=e[s].end):r.push(e[s])}else r=e;for(var o,l=0,c=t,d=t,u=0;u<r.length;u++){var h=r[u].start,p=r[u].end;if(h<=t+i&&t<p)c=h,l=(d=p)-t;else if(t+i<h){o=h;break}}return{len:l,start:c||0,end:d||0,nextStart:o}},n.getBuffered=function(e){try{return e.buffered}catch(e){return r.logger.log("failed to get media.buffered",e),s}},n);function n(){}},"./src/utils/cea-608-parser.ts":function(e,t,i){i.r(t),i.d(t,"Row",function(){return y}),i.d(t,"CaptionScreen",function(){return b});function a(e){var t=e;return s.hasOwnProperty(e)&&(t=s[e]),String.fromCharCode(t)}function l(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i].toString(16));return t}var c,r=i("./src/utils/logger.ts"),s={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},d=15,n=100,o={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},u={17:2,18:4,21:6,22:8,23:10,19:13,20:15},h={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],g=((i=c=c||{})[i.ERROR=0]="ERROR",i[i.TEXT=1]="TEXT",i[i.WARNING=2]="WARNING",i[i.INFO=2]="INFO",i[i.DEBUG=3]="DEBUG",i[i.DATA=3]="DATA",C.prototype.log=function(e,t){this.verboseLevel>=e&&r.logger.log(this.time+" ["+e+"] "+t)},C),m=((i=_.prototype).reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},i.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;i<t.length;i++){var r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}},i.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},i.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},i.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},i.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},_),A=((i=k.prototype).reset=function(){this.uchar=" ",this.penState.reset()},i.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},i.setPenState=function(e){this.penState.copy(e)},i.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},i.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},i.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},k),y=((i=S.prototype).equals=function(e){for(var t=!0,i=0;i<n;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t},i.copy=function(e){for(var t=0;t<n;t++)this.chars[t].copy(e.chars[t])},i.isEmpty=function(){for(var e=!0,t=0;t<n;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},i.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(c.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>n&&(this.logger.log(c.DEBUG,"Too large cursor position "+this.pos),this.pos=n)},i.moveCursor=function(e){var t=this.pos+e;if(1<e)for(var i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)},i.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},i.insertChar=function(e){144<=e&&this.backSpace();var t=a(e);this.pos>=n?this.logger.log(c.ERROR,"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},i.clearFromPos=function(e){for(var t=e;t<n;t++)this.chars[t].reset()},i.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},i.clearToEndOfRow=function(){this.clearFromPos(this.pos)},i.getTextString=function(){for(var e=[],t=!0,i=0;i<n;i++){var r=this.chars[i].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")},i.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},S),b=((i=T.prototype).reset=function(){for(var e=0;e<d;e++)this.rows[e].clear();this.currRow=14},i.equals=function(e){for(var t=!0,i=0;i<d;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},i.copy=function(e){for(var t=0;t<d;t++)this.rows[t].copy(e.rows[t])},i.isEmpty=function(){for(var e=!0,t=0;t<d;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},i.backSpace=function(){this.rows[this.currRow].backSpace()},i.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},i.insertChar=function(e){this.rows[this.currRow].insertChar(e)},i.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},i.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},i.setCursor=function(e){this.logger.log(c.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},i.setPAC=function(e){this.logger.log(c.INFO,"pacData = "+JSON.stringify(e));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var i=0;i<d;i++)this.rows[i].clear();var r=this.currRow+1-this.nrRollUpRows,s=this.lastOutputScreen;if(s){var a=s.rows[r].cueStartTime,n=this.logger.time;if(a&&null!==n&&a<n)for(var o=0;o<this.nrRollUpRows;o++)this.rows[t-this.nrRollUpRows+o+1].copy(s.rows[r+o])}}this.currRow=t;a=this.rows[this.currRow],null!==e.indent&&(n=e.indent,n=Math.max(n-1,0),a.setCursor(e.indent),e.color=a.chars[n].penState.foreground),a={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(a)},i.setBkgData=function(e){this.logger.log(c.INFO,"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},i.setRollUpRows=function(e){this.nrRollUpRows=e},i.rollUp=function(){var e;null!==this.nrRollUpRows?(this.logger.log(c.TEXT,this.getDisplayText()),e=this.currRow+1-this.nrRollUpRows,(e=this.rows.splice(e,1)[0]).clear(),this.rows.splice(this.currRow,0,e),this.logger.log(c.INFO,"Rolling up")):this.logger.log(c.DEBUG,"roll_up but nrRollUpRows not set yet")},i.getDisplayText=function(e){e=e||!1;for(var t=[],i="",r=0;r<d;r++){var s=this.rows[r].getTextString();s&&t.push(e?"Row "+(r+1)+": '"+s+"'":s.trim())}return i=0<t.length?e?"["+t.join(" | ")+"]":t.join("\n"):i},i.getTextAndFormat=function(){return this.rows},T),v=((i=w.prototype).reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},i.getHandler=function(){return this.outputFilter},i.setHandler=function(e){this.outputFilter=e},i.setPAC=function(e){this.writeScreen.setPAC(e)},i.setBkgData=function(e){this.writeScreen.setBkgData(e)},i.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(c.INFO,"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},i.insertChars=function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var i=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(c.INFO,i+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(c.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},i.ccRCL=function(){this.logger.log(c.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},i.ccBS=function(){this.logger.log(c.INFO,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory)&&this.outputDataUpdate()},i.ccAOF=function(){},i.ccAON=function(){},i.ccDER=function(){this.logger.log(c.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},i.ccRU=function(e){this.logger.log(c.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},i.ccFON=function(){this.logger.log(c.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},i.ccRDC=function(){this.logger.log(c.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},i.ccTR=function(){this.logger.log(c.INFO,"TR"),this.setMode("MODE_TEXT")},i.ccRTD=function(){this.logger.log(c.INFO,"RTD"),this.setMode("MODE_TEXT")},i.ccEDM=function(){this.logger.log(c.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},i.ccCR=function(){this.logger.log(c.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},i.ccENM=function(){this.logger.log(c.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},i.ccEOC=function(){var e;this.logger.log(c.INFO,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode&&(e=this.displayedMemory,this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(c.TEXT,"DISP: "+this.displayedMemory.getDisplayText())),this.outputDataUpdate(!0)},i.ccTO=function(e){this.logger.log(c.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},i.ccMIDROW=function(e){var t={flash:!1};t.underline=e%2==1,t.italics=46<=e,t.italics?t.foreground="white":(e=Math.floor(e/2)-16,t.foreground=["white","green","blue","cyan","red","yellow","magenta"][e]),this.logger.log(c.INFO,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},i.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},i.cueSplitAtTime=function(e){!this.outputFilter||this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e)},w);function E(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new g;this.channels=[null,new v(e,t,r),new v(e+1,i,r)],this.cmdHistory={a:null,b:null},this.logger=r}function w(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new b(i),this.nonDisplayedMemory=new b(i),this.lastOutputScreen=new b(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}function T(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var t=0;t<d;t++)this.rows.push(new y(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}function S(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var t=0;t<n;t++)this.chars.push(new A);this.logger=e,this.pos=0,this.currPenState=new m}function k(e,t,i,r,s,a){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new m(t,i,r,s,a)}function _(e,t,i,r,s){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=i||!1,this.background=r||"black",this.flash=s||!1}function C(){this.time=null,this.verboseLevel=c.ERROR}function R(e,t,i){i.a=e,i.b=t}function D(e,t,i){return i.a===e&&i.b===t}(i=E.prototype).getHandler=function(e){return this.channels[e].getHandler()},i.setHandler=function(e,t){this.channels[e].setHandler(t)},i.addData=function(e,t){var i,r=!1;this.logger.time=e;for(var s=0;s<t.length;s+=2){var a,n=127&t[s],o=127&t[s+1];0==n&&0==o||(this.logger.log(c.DATA,"["+l([t[s],t[s+1]])+"] -> ("+l([n,o])+")"),!(i=(i=(i=(i=this.parseCmd(n,o))||this.parseMidrow(n,o))||this.parsePAC(n,o))||this.parseBackgroundAttributes(n,o))&&(r=this.parseChars(n,o))&&((a=this.currentChannel)&&0<a?this.channels[a].insertChars(r):this.logger.log(c.WARNING,"No channel found yet. TEXT-MODE?")),i)||r||this.logger.log(c.WARNING,"Couldn't parse cleaned data "+l([n,o])+" orig: "+l([t[s],t[s+1]]))}},i.parseCmd=function(e,t){var i,r,s=this.cmdHistory;return((20===e||28===e||21===e||29===e)&&32<=t&&t<=47||(23===e||31===e)&&33<=t&&t<=35)&&(D(e,t,s)?(R(null,null,s),this.logger.log(c.DEBUG,"Repeated command ("+l([e,t])+") is dropped")):(r=this.channels[i=20===e||21===e||23===e?1:2],20===e||21===e||28===e||29===e?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),R(e,t,s),this.currentChannel=i),!0)},i.parseMidrow=function(e,t){var i;return(17===e||25===e)&&32<=t&&t<=47&&((i=17===e?1:2)!==this.currentChannel?(this.logger.log(c.ERROR,"Mismatch channel in midrow parsing"),!1):!!(i=this.channels[i])&&(i.ccMIDROW(t),this.logger.log(c.DEBUG,"MIDROW ("+l([e,t])+")"),!0))},i.parsePAC=function(e,t){var i,r,s=this.cmdHistory;return((17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127||(16===e||24===e)&&64<=t&&t<=95)&&(D(e,t,s)?(R(null,null,s),!0):!!(r=this.channels[i=e<=23?1:2])&&(r.setPAC(this.interpretPAC((64<=t&&t<=95?1==i?o:h:1==i?u:p)[e],t)),R(e,t,s),this.currentChannel=i,!0))},i.interpretPAC=function(e,t){e={color:null,italics:!1,indent:null,underline:!1,row:e},t=95<t?t-96:t-64;return e.underline=1==(1&t),t<=13?e.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(t/2)]:t<=15?(e.italics=!0,e.color="white"):e.indent=4*Math.floor((t-16)/2),e},i.parseChars=function(e,t){var i,r=null,s=null;return 17<=(s=25<=e?(i=2,e-8):(i=1,e))&&s<=19?(this.logger.log(c.INFO,"Special char '"+a(s=17===s?t+80:18===s?t+112:t+144)+"' in channel "+i),r=[s]):32<=e&&e<=127&&(r=0===t?[e]:[e,t]),r&&(i=l(r),this.logger.log(c.DEBUG,"Char codes = "+i.join(",")),R(e,t,this.cmdHistory)),r},i.parseBackgroundAttributes=function(e,t){var i,r;return((16===e||24===e)&&32<=t&&t<=47||(23===e||31===e)&&45<=t&&t<=47)&&(r={},16===e||24===e?(i=Math.floor((t-32)/2),r.background=f[i],t%2==1&&(r.background=r.background+"_semi")):45===t?r.background="transparent":(r.foreground="black",47===t&&(r.underline=!0)),this.channels[e<=23?1:2].setBkgData(r),R(e,t,this.cmdHistory),!0)},i.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}},i.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var i=this.channels[t];i&&i.cueSplitAtTime(e)}},t.default=E},"./src/utils/codecs.ts":function(e,t,i){i.r(t),i.d(t,"isCodecType",function(){return s}),i.d(t,"isCodecSupportedInMp4",function(){return a});var r={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function s(e,t){t=r[t];return!!t&&!0===t[e.slice(0,4)]}function a(e,t){return MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}},"./src/utils/cues.ts":function(e,t,i){i.r(t);var f=i("./src/utils/vttparser.ts"),g=i("./src/utils/webvtt-parser.ts"),m=i("./src/utils/texttrack-utils.ts"),A=/\s/;t.default={newCue:function(t,e,i,r){for(var s,a,n,o,l=[],c=self.VTTCue||self.TextTrackCue,d=0;d<r.rows.length;d++)if(a=!0,n=0,o="",!(s=r.rows[d]).isEmpty()){for(var u=0;u<s.chars.length;u++)A.test(s.chars[u].uchar)&&a?n++:(o+=s.chars[u].uchar,a=!1);(s.cueStartTime=e)===i&&(i+=1e-4),16<=n?n--:n++;var h=Object(f.fixLineBreaks)(o.trim()),p=Object(g.generateCueId)(e,i,h);t&&t.cues&&t.cues.getCueById(p)||((h=new c(e,i,h)).id=p,h.line=d+1,h.align="left",h.position=10+Math.min(80,10*Math.floor(8*n/32)),l.push(h))}return t&&l.length&&(l.sort(function(e,t){return"auto"===e.line||"auto"===t.line?0:8<e.line&&8<t.line?t.line-e.line:e.line-t.line}),l.forEach(function(e){return Object(m.addCueToTrack)(t,e)})),l}}},"./src/utils/discontinuities.ts":function(e,t,i){i.r(t),i.d(t,"findFirstFragWithCC",function(){return r}),i.d(t,"shouldAlignOnDiscontinuities",function(){return o}),i.d(t,"findDiscontinuousReferenceFrag",function(){return l}),i.d(t,"adjustSlidingStart",function(){return d}),i.d(t,"alignStream",function(){return u}),i.d(t,"alignPDT",function(){return h}),i.d(t,"alignFragmentByPDTDelta",function(){return p}),i.d(t,"alignMediaPlaylistByPDT",function(){return f});var s=i("./src/polyfills/number.ts"),a=i("./src/utils/logger.ts"),n=i("./src/controller/level-helper.ts");function r(e,t){for(var i=null,r=0,s=e.length;r<s;r++){var a=e[r];if(a&&a.cc===t){i=a;break}}return i}function o(e,t,i){return!(!t.details||!(i.endCC>i.startCC||e&&e.cc<i.startCC))}function l(e,t){e=e.fragments,t=t.fragments;if(t.length&&e.length){e=r(e,t[0].cc);if(e&&(!e||e.startPTS))return e;a.logger.log("No frag in previous level to align on")}else a.logger.log("No fragments to align")}function c(e,t){e&&(t=e.start+t,e.start=e.startPTS=t,e.endPTS=t+e.duration)}function d(e,t){for(var i=t.fragments,r=0,s=i.length;r<s;r++)c(i[r],e);t.fragmentHint&&c(t.fragmentHint,e),t.alignedSliding=!0}function u(e,t,i){var r;t&&(o(e,t,e=i)&&(r=l(t.details,e))&&Object(s.isFiniteNumber)(r.start)&&(a.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),d(r.start,e)),!i.alignedSliding&&t.details&&h(i,t.details),i.alignedSliding||!t.details||i.skippedSegments||Object(n.adjustSliding)(t.details,i))}function h(e,t){var i,r;t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime&&(i=t.fragments[0].programDateTime,t=((r=e.fragments[0].programDateTime)-i)/1e3+t.fragments[0].start)&&Object(s.isFiniteNumber)(t)&&(a.logger.log("Adjusting PTS using programDateTime delta "+(r-i)+"ms, sliding:"+t.toFixed(3)+" "+e.url+" "),d(t,e))}function p(e,t){var i=e.programDateTime;i&&(e.start=e.startPTS=i=(i-t)/1e3,e.endPTS=i+e.duration)}function f(e,t){var i;t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime&&(i=t.fragments[0].programDateTime-1e3*t.fragments[0].start,e.fragments.forEach(function(e){p(e,i)}),e.fragmentHint&&p(e.fragmentHint,i),e.alignedSliding=!0)}},"./src/utils/ewma-bandwidth-estimator.ts":function(e,t,i){i.r(t);var s=i("./src/utils/ewma.ts");function r(e,t,i){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new s.default(e),this.fast_=new s.default(t)}(i=r.prototype).update=function(e,t){var i=this.slow_,r=this.fast_;this.slow_.halfLife!==e&&(this.slow_=new s.default(e,i.getEstimate(),i.getTotalWeight())),this.fast_.halfLife!==t&&(this.fast_=new s.default(t,r.getEstimate(),r.getTotalWeight()))},i.sample=function(e,t){e=(e=Math.max(e,this.minDelayMs_))/1e3,t=8*t/e;this.fast_.sample(e,t),this.slow_.sample(e,t)},i.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},i.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},i.destroy=function(){},t.default=r},"./src/utils/ewma.ts":function(e,t,i){function r(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}i.r(t),(i=r.prototype).sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},i.getTotalWeight=function(){return this.totalWeight_},i.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},t.default=r},"./src/utils/fetch-loader.ts":function(e,t,i){i.r(t),i.d(t,"fetchSupported",function(){return l});var u=i("./src/polyfills/number.ts"),r=i("./src/loader/load-stats.ts"),c=i("./src/demux/chunk-cache.ts");function s(e){var i="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,t)}function t(){return a(e,arguments,o(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n(t,e)})(e)}function a(e,t,i){return(a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return;if(Reflect.construct.sham)return;if("function"==typeof Proxy)return 1;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),1}catch(e){}}()?Reflect.construct:function(e,t,i){var r=[null],t=(r.push.apply(r,t),new(Function.bind.apply(e,r)));return i&&n(t,i.prototype),t}).apply(null,arguments)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(){return(h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}function l(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}(i=d.prototype).destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},i.abortInternal=function(){var e=this.response;e&&e.ok||(this.stats.aborted=!0,this.controller.abort())},i.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},i.load=function(r,s,a){var n=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var e=function(e,t){t={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(h({},e.headers))};return e.rangeEnd&&t.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),t}(r,this.controller.signal),l=a.onProgress,c="arraybuffer"===r.responseType,d=c?"byteLength":"length";this.context=r,this.config=s,this.callbacks=a,this.request=this.fetchSetup(r,e),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){n.abortInternal(),a.onTimeout(o,r,n.response)},s.timeout),self.fetch(this.request).then(function(e){var t,i;if((n.response=n.loader=e).ok)return o.loading.first=Math.max(self.performance.now(),o.loading.start),o.total=parseInt(e.headers.get("Content-Length")||"0"),l&&Object(u.isFiniteNumber)(s.highWaterMark)?n.loadProgressively(e,o,r,s.highWaterMark,l):c?e.arrayBuffer():e.text();throw t=e.status,i=e.statusText,new A(i||"fetch, bad network response",t,e)}).then(function(e){var t=n.response,i=(self.clearTimeout(n.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first),o.loaded=o.total=e[d],{url:t.url,data:e});l&&!Object(u.isFiniteNumber)(s.highWaterMark)&&l(o,r,e,t),a.onSuccess(i,o,r,t)}).catch(function(e){var t;self.clearTimeout(n.requestTimeout),o.aborted||(t=e.code||0,a.onError({code:t,text:e.message},r,e.details))})},i.getCacheAge=function(){var e,t=null;return t=this.response?(e=this.response.headers.get("age"))?parseFloat(e):null:t},i.loadProgressively=function(r,s,a,n,o){void 0===n&&(n=0);var l=new c.default,e=r.body.getReader();return function i(){return e.read().then(function(e){var t;return e.done?(l.dataLength&&o(s,a,l.flush(),r),Promise.resolve(new ArrayBuffer(0))):(t=(e=e.value).length,s.loaded+=t,t<n||l.dataLength?(l.push(e),l.dataLength>=n&&o(s,a,l.flush(),r)):o(s,a,e,r),i())}).catch(function(){return Promise.reject()})}()};i=d;function d(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||p,this.controller=new self.AbortController,this.stats=new r.LoadStats}function p(e,t){return new self.Request(e.url,t)}f=s(Error),m=f,(g=y).prototype=Object.create(m.prototype),n(g.prototype.constructor=g,m);var f,g,m,A=y;function y(e,t,i){return(e=f.call(this,e)||this).code=void 0,e.details=void 0,e.code=t,e.details=i,e}t.default=i},"./src/utils/imsc1-ttml-parser.ts":function(e,t,i){i.r(t),i.d(t,"IMSC1_CODEC",function(){return r}),i.d(t,"parseIMSC1",function(){return s});var n=i("./src/utils/mp4-tools.ts"),o=i("./src/utils/vttparser.ts"),p=i("./src/utils/vttcue.ts"),l=i("./src/demux/id3.ts"),c=i("./src/utils/timescale-conversion.ts"),f=i("./src/utils/webvtt-parser.ts");function g(){return(g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}var r="stpp.ttml.im1t",d=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,u=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,m={left:"start",center:"center",right:"end",start:"start",end:"end"};function s(e,t,i,r,s){var a=Object(n.findBox)(new Uint8Array(e),["mdat"]);if(0!==a.length){a=a[0],a=Object(l.utf8ArrayToStr)(new Uint8Array(e,a.start,a.end-a.start)),t=Object(c.toTimescaleFromScale)(t,1,i);try{r(function(e,l){var i,c,d,u,h,r=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(r)return i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},c=Object.keys(i).reduce(function(e,t){return e[t]=r.getAttribute("ttp:"+t)||i[t],e},{}),d="preserve"!==r.getAttribute("xml:space"),u=y(A(r,"styling","style")),h=y(A(r,"layout","region")),e=A(r,"body","[begin]"),[].map.call(e,function(e){var t=function r(e,s){return[].slice.call(e.childNodes).reduce(function(e,t,i){return"br"===t.nodeName&&i?e+"\n":null!=(i=t.childNodes)&&i.length?r(t,s):s?e+t.textContent.trim().replace(/\s+/g," "):e+t.textContent},"")}(e,d);if(!t||!e.hasAttribute("begin"))return null;var i=E(e.getAttribute("begin"),c),r=E(e.getAttribute("dur"),c),s=E(e.getAttribute("end"),c);if(null===i)throw v(e);if(null===s){if(null===r)throw v(e);s=i+r}var a,n,o,r=new p.default(i-l,s-l,t),i=(r.id=Object(f.generateCueId)(r.startTime,r.endTime,r.text),h[e.getAttribute("region")]),s=u[e.getAttribute("style")],t=(r.position=10,r.size=80,a=i,n=s,o="http://www.w3.org/ns/ttml#styling",["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce(function(e,t){var i=b(n,o,t)||b(a,o,t);return i&&(e[t]=i),e},{})),e=t.textAlign;return e&&((i=m[e])&&(r.lineAlign=i),r.align=e),g(r,t),r}).filter(function(e){return null!==e});throw new Error("Invalid ttml")}(a,t))}catch(e){s(e)}}else s(new Error("Could not parse IMSC1 mdat"))}function A(e,t,i){e=e.getElementsByTagName(t)[0];return e?[].slice.call(e.querySelectorAll(i)):[]}function y(e){return e.reduce(function(e,t){var i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function b(e,t,i){return e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function v(e){return new Error("Could not parse ttml timestamp "+e)}function E(r,e){var t,i,s,a;return r?(null===(t=Object(o.parseTimeStamp)(r))&&(d.test(r)?(i=e,s=d.exec(r),a=(0|s[4])+(0|s[5])/i.subFrameRate,t=3600*(0|s[1])+60*(0|s[2])+(0|s[3])+a/i.frameRate):u.test(r)&&(t=function(e){var t=u.exec(r),i=Number(t[1]);switch(t[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}(e))),t):null}},"./src/utils/logger.ts":function(e,t,i){i.r(t),i.d(t,"enableLogs",function(){return n}),i.d(t,"logger",function(){return o});function s(){}var r={trace:s,debug:s,log:s,warn:s,info:s,error:s},a=r;function n(e){if(self.console&&!0===e||"object"==typeof e){!function(i){for(var e=arguments.length,t=new Array(1<e?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];t.forEach(function(e){var t;a[e]=i[e]?i[e].bind(i):(e=e,(t=self.console[e])?t.bind(self.console,"["+e+"] >"):s)})}(e,"debug","log","info","warn","error");try{a.log()}catch(e){a=r}}else a=r}var o=r},"./src/utils/mediakeys-helper.ts":function(e,t,i){i.r(t),i.d(t,"KeySystems",function(){return r}),i.d(t,"requestMediaKeySystemAccess",function(){return s}),(i=r=r||{}).WIDEVINE="com.widevine.alpha",i.PLAYREADY="com.microsoft.playready";var r,s="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},"./src/utils/mediasource-helper.ts":function(e,t,i){function r(){return self.MediaSource||self.WebKitMediaSource}i.r(t),i.d(t,"getMediaSource",function(){return r})},"./src/utils/mp4-tools.ts":function(e,t,i){i.r(t),i.d(t,"bin2str",function(){return d}),i.d(t,"readUint16",function(){return h}),i.d(t,"readUint32",function(){return A}),i.d(t,"writeUint32",function(){return n}),i.d(t,"findBox",function(){return y}),i.d(t,"parseSegmentIndex",function(){return b}),i.d(t,"parseInitSegment",function(){return s}),i.d(t,"getStartDTS",function(){return o}),i.d(t,"getDuration",function(){return l}),i.d(t,"computeRawDurationFromSamples",function(){return v}),i.d(t,"offsetStartDTS",function(){return u}),i.d(t,"segmentValidRange",function(){return p}),i.d(t,"appendUint8Array",function(){return f});var r=i("./src/utils/typed-array.ts"),m=i("./src/loader/fragment.ts"),a=Math.pow(2,32)-1,c=[].push;function d(e){return String.fromCharCode.apply(null,e)}function h(e,t){"data"in e&&(t+=e.start,e=e.data);e=e[t]<<8|e[t+1];return e<0?65536+e:e}function A(e,t){"data"in e&&(t+=e.start,e=e.data);e=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return e<0?4294967296+e:e}function n(e,t,i){"data"in e&&(t+=e.start,e=e.data),e[t]=i>>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function y(e,t){var i,r,s=[];if(t.length)for(var a=("data"in e?(i=e.data,r=e.start,e.end):(r=0,(i=e).byteLength)),n=r;n<a;){var o,l=A(i,n),l=1<l?n+l:a;d(i.subarray(n+4,n+8))===t[0]&&(1===t.length?s.push({data:i,start:n+8,end:l}):(o=y({data:i,start:n+8,end:l},t.slice(1))).length&&c.apply(s,o)),n=l}return s}function b(e){var t=y(e,["moov"])[0],t=t?t.end:null,e=y(e,["sidx"]);if(!e||!e[0])return null;var i=[],r=e[0],e=r.data[0],s=0===e?8:16,a=A(r,s),n=r.end+0,o=h(r,s=(s+=4)+(0===e?8:16)+2);s+=2;for(var l=0;l<o;l++){var c=s,d=A(r,c),u=(c+=4,2147483647&d);if(1==(2147483648&d)>>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;d=A(r,c);c+=4,i.push({referenceSize:u,subsegmentDuration:d,info:{duration:d/a,start:n,end:n+u-1}}),n+=u,s=c+=4}return{earliestPresentationTime:0,timescale:a,version:e,referencesCount:o,references:i,moovEndOffset:t}}function s(e){for(var i=[],t=y(e,["moov","trak"]),r=0;r<t.length;r++){var s,a,n,o=t[r],l=y(o,["tkhd"])[0];l&&(l=A(l,0===l.data[l.start]?12:20),s=y(o,["mdia","mdhd"])[0])&&(s=A(s,0===s.data[s.start]?12:20),a=y(o,["mdia","hdlr"])[0])&&(a=d(a.data.subarray(a.start+8,a.start+12)),a={soun:m.ElementaryStreamTypes.AUDIO,vide:m.ElementaryStreamTypes.VIDEO}[a])&&(n=void 0,(o=y(o,["mdia","minf","stbl","stsd"])[0])&&(n=d(o.data.subarray(o.start+12,o.start+16))),i[l]={timescale:s,type:a},i[a]={timescale:s,id:l,codec:n})}return y(e,["moov","mvex","trex"]).forEach(function(e){var t=A(e,4),t=i[t];t&&(t.default={duration:A(e,12),flags:A(e,20)})}),i}function o(a,e){return y(e,["moof","traf"]).reduce(function(e,t){var r=y(t,["tfdt"])[0],s=r.data[r.start],t=y(t,["tfhd"]).reduce(function(e,t){t=A(t,4),t=a[t];if(t){var i=A(r,4),i=(i=1===s?(i*=Math.pow(2,32))+A(r,8):i)/(t.timescale||9e4);if(isFinite(i)&&(null===e||i<e))return i}return e},null);return null!==t&&isFinite(t)&&(null===e||t<e)?t:e},null)||0}function l(e,t){for(var i=0,r=0,s=0,a=y(e,["moof","traf"]),n=0;n<a.length;n++){var o=a[n],l=y(o,["tfhd"])[0],c=t[A(l,4)];if(c){var d=c.default,u=A(l,0)|(null==d?void 0:d.flags),h=null==d?void 0:d.duration;8&u&&(h=A(l,2&u?12:8));for(var p=c.timescale||9e4,f=y(o,["trun"]),g=0;g<f.length;g++)!(i=v(f[g]))&&h&&(i=h*A(f[g],4)),c.type===m.ElementaryStreamTypes.VIDEO?r+=i/p:c.type===m.ElementaryStreamTypes.AUDIO&&(s+=i/p)}}if(0===r&&0===s){e=b(e);if(null!=e&&e.references)return e.references.reduce(function(e,t){return e+t.info.duration||0},0)}return r||s}function v(e){var t=A(e,0),i=8;1&t&&(i+=4),4&t&&(i+=4);for(var r=0,s=A(e,4),a=0;a<s;a++)256&t&&(r+=A(e,i),i+=4),512&t&&(i+=4),1024&t&&(i+=4),2048&t&&(i+=4);return r}function u(i,e,s){y(e,["moof","traf"]).forEach(function(t){y(t,["tfhd"]).forEach(function(e){var r,e=A(e,4),e=i[e];e&&(r=e.timescale||9e4,y(t,["tfdt"]).forEach(function(e){var t=e.data[e.start],i=A(e,4);0===t?n(e,4,i-s*r):(i=(i=(i*=Math.pow(2,32))+A(e,8))-s*r,i=Math.max(i,0),t=Math.floor(i/(a+1)),i=Math.floor(i%(a+1)),n(e,4,t),n(e,8,i))}))})})}function p(e){var t={valid:null,remainder:null},i=y(e,["moof"]);return i&&(i.length<2?t.remainder=e:(i=i[i.length-1],t.valid=Object(r.sliceUint8)(e,0,i.start-8),t.remainder=Object(r.sliceUint8)(e,i.start-8))),t}function f(e,t){var i=new Uint8Array(e.length+t.length);return i.set(e),i.set(t,e.length),i}},"./src/utils/output-filter.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r});(i=s.prototype).dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},i.newCue=function(e,t,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},i.reset=function(){this.cueRanges=[],this.startTime=null};var r=s;function s(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}},"./src/utils/texttrack-utils.ts":function(e,t,i){i.r(t),i.d(t,"sendAddTrackEvent",function(){return r}),i.d(t,"addCueToTrack",function(){return a}),i.d(t,"clearCurrentCues",function(){return n}),i.d(t,"removeCuesInRange",function(){return o}),i.d(t,"getCuesInRange",function(){return l});var s=i("./src/utils/logger.ts");function r(e,t){var i;try{i=new Event("addtrack")}catch(e){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function a(e,t){var i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(i){s.logger.debug("[texttrack-utils]: "+i);var r=new self.TextTrackCue(t.startTime,t.endTime,t.text);r.id=t.id,e.addCue(r)}"disabled"===i&&(e.mode=i)}function n(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var i=e.cues.length;i--;)e.removeCue(e.cues[i]);"disabled"===t&&(e.mode=t)}function o(e,t,i){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&0<e.cues.length)for(var s=l(e.cues,t,i),a=0;a<s.length;a++)e.removeCue(s[a]);"disabled"===r&&(e.mode=r)}function l(e,t,i){var r=[],s=function(e,t){if(t<e[0].startTime)return 0;var i=e.length-1;if(t>e[i].endTime)return-1;for(var r=0,s=i;r<=s;){var a=Math.floor((s+r)/2);if(t<e[a].startTime)s=a-1;else{if(!(t>e[a].startTime&&r<i))return a;r=a+1}}return e[r].startTime-t<t-e[s].startTime?r:s}(e,t);if(-1<s)for(var a=s,n=e.length;a<n;a++){var o=e[a];if(o.startTime>=t&&o.endTime<=i)r.push(o);else if(o.startTime>i)return r}return r}},"./src/utils/time-ranges.ts":function(e,t,i){i.r(t),t.default={toString:function(e){for(var t="",i=e.length,r=0;r<i;r++)t+="["+e.start(r).toFixed(3)+","+e.end(r).toFixed(3)+"]";return t}}},"./src/utils/timescale-conversion.ts":function(e,t,i){function s(e,t,i,r){e=e*t*(i=void 0===i?1:i);return(r=void 0===r?!1:r)?Math.round(e):e}function r(e,t,i,r){return s(e,t,1/(i=void 0===i?1:i),r=void 0===r?!1:r)}function a(e,t){return s(e,1e3,1/9e4,t=void 0===t?!1:t)}function n(e,t){return s(e,9e4,1/(t=void 0===t?1:t))}i.r(t),i.d(t,"toTimescaleFromBase",function(){return s}),i.d(t,"toTimescaleFromScale",function(){return r}),i.d(t,"toMsFromMpegTsClock",function(){return a}),i.d(t,"toMpegTsClockFromTimescale",function(){return n})},"./src/utils/typed-array.ts":function(e,t,i){function r(e,t,i){return Uint8Array.prototype.slice?e.slice(t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))}i.r(t),i.d(t,"sliceUint8",function(){return r})},"./src/utils/vttcue.ts":function(e,t,i){function b(e,t){return"string"==typeof t&&!!Array.isArray(e)&&(t=t.toLowerCase(),!!~e.indexOf(t))&&t}function v(e){return b(s,e)}function E(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var s=1;s<arguments.length;s++){var a,n=arguments[s];for(a in n)e[a]=n[a]}return e}function r(e,t,i){var r=this,s={enumerable:!0},a=(r.hasBeenReset=!1,""),n=!1,o=e,l=t,c=i,d=null,u="",h=!0,p="auto",f="start",g=50,m="middle",A=50,y="middle";Object.defineProperty(r,"id",E({},s,{get:function(){return a},set:function(e){a=""+e}})),Object.defineProperty(r,"pauseOnExit",E({},s,{get:function(){return n},set:function(e){n=!!e}})),Object.defineProperty(r,"startTime",E({},s,{get:function(){return o},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");o=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"endTime",E({},s,{get:function(){return l},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");l=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"text",E({},s,{get:function(){return c},set:function(e){c=""+e,this.hasBeenReset=!0}})),Object.defineProperty(r,"region",E({},s,{get:function(){return d},set:function(e){d=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"vertical",E({},s,{get:function(){return u},set:function(e){e=b(w,e);if(!1===e)throw new SyntaxError("An invalid or illegal string was specified.");u=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"snapToLines",E({},s,{get:function(){return h},set:function(e){h=!!e,this.hasBeenReset=!0}})),Object.defineProperty(r,"line",E({},s,{get:function(){return p},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");p=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"lineAlign",E({},s,{get:function(){return f},set:function(e){e=v(e);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");f=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"position",E({},s,{get:function(){return g},set:function(e){if(e<0||100<e)throw new Error("Position must be between 0 and 100.");g=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"positionAlign",E({},s,{get:function(){return m},set:function(e){e=v(e);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");m=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"size",E({},s,{get:function(){return A},set:function(e){if(e<0||100<e)throw new Error("Size must be between 0 and 100.");A=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"align",E({},s,{get:function(){return y},set:function(e){e=v(e);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),r.displayState=void 0}var w,s;i.r(t),t.default="undefined"!=typeof self&&self.VTTCue?self.VTTCue:(w=["","lr","rl"],s=["start","middle","end","left","right"],r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r)},"./src/utils/vttparser.ts":function(e,t,i){i.r(t),i.d(t,"parseTimeStamp",function(){return l}),i.d(t,"fixLineBreaks",function(){return p}),i.d(t,"VTTParser",function(){return n});var o=i("./src/utils/vttcue.ts"),r=(s.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},s);function s(){}function l(e){function t(e,t,i,r){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(r||0)}e=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return e?59<parseFloat(e[2])?t(e[2],e[3],0,e[4]):t(e[1],e[2],e[3],e[4]):null}(t=a.prototype).set=function(e,t){this.get(e)||""===t||(this.values[e]=t)},t.get=function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,i){for(var r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}},t.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},t.percent=function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){t=parseFloat(t);if(0<=t&&t<=100)return this.set(e,t),!0}return!1};var c=a;function a(){this.values=Object.create(null)}function d(e,t,i,r){var s,a,n=r?e.split(r):[e];for(s in n)"string"==typeof n[s]&&2===(a=n[s].split(i)).length&&t(a[0],a[1])}var u=new o.default(0,0,""),h="middle"===u.align?"middle":"center";function p(e){return e.replace(/<br(?: \/)?>/gi,"\n")}(i=f.prototype).parse=function(e){var r=this;function t(){for(var e=0,t=p(t=r.buffer);e<t.length&&"\r"!==t[e]&&"\n"!==t[e];)++e;var i=t.substr(0,e);return"\r"===t[e]&&++e,"\n"===t[e]&&++e,r.buffer=t.substr(e),i}e&&(r.buffer+=r.decoder.decode(e,{stream:!0}));try{var i="";if("INITIAL"===r.state){if(!/\r\n|\n/.test(r.buffer))return this;var s=(i=t()).match(/^()?WEBVTT([ \t].*)?$/);if(!s||!s[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}for(var a=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;switch(a?a=!1:i=t(),r.state){case"HEADER":/:/.test(i)?d(i,function(e,t){},/:/):i||(r.state="ID");continue;case"NOTE":i||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){r.state="NOTE";break}if(!i)continue;if(r.cue=new o.default(0,0,""),r.state="CUE",-1===i.indexOf("--\x3e")){r.cue.id=i;continue}case"CUE":if(!r.cue){r.state="BADCUE";continue}try{!function(t,e,s){var i,a,r=t;function n(){var e=l(t);if(null===e)throw new Error("Malformed timestamp: "+r);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function o(){t=t.replace(/^\s+/,"")}if(o(),e.startTime=n(),o(),"--\x3e"!==t.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);t=t.substr(3),o(),e.endTime=n(),o(),i=t,e=e,a=new c,d(i,function(e,t){var i;switch(e){case"region":for(var r=s.length-1;0<=r;r--)if(s[r].id===t){a.set(e,s[r].region);break}break;case"vertical":a.alt(e,t,["rl","lr"]);break;case"line":i=t.split(","),a.integer(e,i[0]),a.percent(e,i[0])&&a.set("snapToLines",!1),a.alt(e,i[0],["auto"]),2===i.length&&a.alt("lineAlign",i[1],["start",h,"end"]);break;case"position":i=t.split(","),a.percent(e,i[0]),2===i.length&&a.alt("positionAlign",i[1],["start",h,"end","line-left","line-right","auto"]);break;case"size":a.percent(e,t);break;case"align":a.alt(e,t,["start",h,"end","left","right"])}},/:/,/\s/),e.region=a.get("region",null),e.vertical=a.get("vertical",""),"auto"===(i=a.get("line","auto"))&&-1===u.line&&(i=-1),e.line=i,e.lineAlign=a.get("lineAlign","start"),e.snapToLines=a.get("snapToLines",!0),e.size=a.get("size",100),e.align=a.get("align",h),"auto"===(i=a.get("position","auto"))&&50===u.position&&(i="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=i}(i,r.cue,r.regionList)}catch(e){r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":var n=-1!==i.indexOf("--\x3e");if(!i||n&&(a=!0)){r.oncue&&r.cue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}if(null===r.cue)continue;r.cue.text&&(r.cue.text+="\n"),r.cue.text+=i;continue;case"BADCUE":i||(r.state="ID")}}}catch(e){"CUETEXT"===r.state&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state="INITIAL"===r.state?"BADWEBVTT":"BADCUE"}return this},i.flush=function(){var t=this;try{if(!t.cue&&"HEADER"!==t.state||(t.buffer+="\n\n",t.parse()),"INITIAL"===t.state||"BADWEBVTT"===t.state)throw new Error("Malformed WebVTT signature.")}catch(e){t.onparsingerror&&t.onparsingerror(e)}return t.onflush&&t.onflush(),this};var n=f;function f(){this.state="INITIAL",this.buffer="",this.decoder=new r,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}},"./src/utils/webvtt-parser.ts":function(e,t,i){i.r(t),i.d(t,"generateCueId",function(){return S}),i.d(t,"parseWebVTT",function(){return s});var A=i("./src/polyfills/number.ts"),y=i("./src/utils/vttparser.ts"),b=i("./src/demux/id3.ts"),v=i("./src/utils/timescale-conversion.ts"),E=i("./src/remux/mp4-remuxer.ts"),w=/\r\n|\n\r|\n|\r/g,T=function(e,t,i){return e.substr(i=void 0===i?0:i,t.length)===t},r=function(e){for(var t=5381,i=e.length;i;)t=33*t^e.charCodeAt(--i);return(t>>>0).toString()};function S(e,t,i){return r(e.toString())+r(t.toString())+r(i)}function s(e,t,i,s,a,n,r,o){var l,c=new y.VTTParser,e=Object(b.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(w,"\n").split("\n"),d=[],u=Object(v.toMpegTsClockFromTimescale)(t,i),h="00:00.000",p=0,f=0,g=!0,m=!1;c.oncue=function(e){var t=s[a],i=s.ccOffset,r=(p-u)/9e4,i=(null!=t&&t.new&&(void 0!==f?i=s.ccOffset=t.start:function(e,t){var i,r=e[a],s=e[r.prevCC];if(!s||!s.new&&r.new)return e.ccOffset=e.presentationOffset=r.start,r.new=!1;for(;null!=(i=s)&&i.new;)e.ccOffset+=r.start-s.start,r.new=!1,s=e[(r=s).prevCC];e.presentationOffset=t}(s,r)),r&&(i=r-s.presentationOffset),m&&(t=e.endTime-e.startTime,r=Object(E.normalizePts)(9e4*(e.startTime+i-f),9e4*n)/9e4,e.startTime=r,e.endTime=r+t),e.text.trim());e.text=decodeURIComponent(encodeURIComponent(i)),e.id||(e.id=S(e.startTime,e.endTime,i)),0<e.endTime&&d.push(e)},c.onparsingerror=function(e){l=e},c.onflush=function(){l?o(l):r(d)},e.forEach(function(e){if(g){if(T(e,"X-TIMESTAMP-MAP=")){m=!(g=!1),e.substr(16).split(",").forEach(function(e){T(e,"LOCAL:")?h=e.substr(6):T(e,"MPEGTS:")&&(p=parseInt(e.substr(7)))});try{f=function(e){var t=parseInt(e.substr(-3)),i=parseInt(e.substr(-6,2)),r=parseInt(e.substr(-9,2)),s=9<e.length?parseInt(e.substr(0,e.indexOf(":"))):0;if(Object(A.isFiniteNumber)(t)&&Object(A.isFiniteNumber)(i)&&Object(A.isFiniteNumber)(r)&&Object(A.isFiniteNumber)(s))return t+1e3*i+6e4*r+36e5*s;throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e)}(h)/1e3}catch(e){m=!1,l=e}return}""===e&&(g=!1)}c.parse(e+"\n")}),c.flush()}},"./src/utils/xhr-loader.ts":function(e,t,i){i.r(t);var o=i("./src/utils/logger.ts"),r=i("./src/loader/load-stats.ts"),s=/^age:\s*[\d.]+\s*$/m;function a(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e?e.xhrSetup:null,this.stats=new r.LoadStats,this.retryDelay=0}(i=a.prototype).destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},i.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState)&&(this.stats.aborted=!0,e.abort())},i.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},i.load=function(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.retryDelay=t.retryDelay,this.loadInternal()},i.loadInternal=function(){var e=this.config,t=this.context;if(e){var i=this.loader=new self.XMLHttpRequest,r=this.stats,r=(r.loading.first=0,r.loaded=0,this.xhrSetup);try{if(r)try{r(i,t.url)}catch(e){i.open("GET",t.url,!0),r(i,t.url)}i.readyState||i.open("GET",t.url,!0);var s=this.context.headers;if(s)for(var a in s)i.setRequestHeader(a,s[a])}catch(e){return void this.callbacks.onError({code:i.status,text:e.message},t,i)}t.rangeEnd&&i.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),i.onreadystatechange=this.readystatechange.bind(this),i.onprogress=this.loadprogress.bind(this),i.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),i.send()}},i.readystatechange=function(){var e,t,i,r,s=this.context,a=this.loader,n=this.stats;s&&a&&(t=a.readyState,e=this.config,!n.aborted)&&2<=t&&(self.clearTimeout(this.requestTimeout),0===n.loading.first&&(n.loading.first=Math.max(self.performance.now(),n.loading.start)),4===t?(a.onreadystatechange=null,a.onprogress=null,200<=(t=a.status)&&t<300?(n.loading.end=Math.max(self.performance.now(),n.loading.first),r="arraybuffer"===s.responseType?(i=a.response).byteLength:(i=a.responseText).length,n.loaded=n.total=r,this.callbacks&&((r=this.callbacks.onProgress)&&r(n,s,i,a),this.callbacks)&&(r={url:a.responseURL,data:i},this.callbacks.onSuccess(r,n,s,a))):n.retry>=e.maxRetry||400<=t&&t<499?(o.logger.error(t+" while loading "+s.url),this.callbacks.onError({code:t,text:a.statusText},s,a)):(o.logger.warn(t+" while loading "+s.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,e.maxRetryDelay),n.retry++)):(self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout)))},i.loadtimeout=function(){o.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},i.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},i.getCacheAge=function(){var e,t=null;return t=this.loader&&s.test(this.loader.getAllResponseHeaders())?(e=this.loader.getResponseHeader("age"))?parseFloat(e):null:t},t.default=a}},r={},s.m=i,s.c=r,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)s.d(i,r,function(e){return t[e]}.bind(null,r));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="/dist/",s(s.s="./src/hls.ts").default;function s(e){var t;return(r[e]||(t=r[e]={i:e,l:!1,exports:{}},i[e].call(t.exports,t,t.exports,s),t.l=!0,t)).exports}var i,r}())}))&&vr.__esModule&&Object.prototype.hasOwnProperty.call(vr,"default")?vr.default:vr;class cs extends e{constructor(e){super(),(this.player=e)._opt,this.canVideoPlay=!1,this.$videoElement=null,this.canvasRenderInterval=null,this.bandwidthEstimateInterval=null,this.fpsInterval=null,this.hlsFps=0,this.hlsPrevFrams=0,this.isInitInfo=!1,this.eventsDestroy=[],function(){let e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}()?(this.$videoElement=this.player.video.$videoElement,this.canVideoPlay=!0):O.isSupported()?(this.$videoElement=this.player.video.$videoElement,this.hls=new O({}),this._initHls(),this._bindEvents()):this.player.debug.error("HlsDecoder","init hls error ,not support "),this.player.debug.log("HlsDecoder","init")}destroy(){this.hls&&(this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach(e=>e()),this.eventsDestroy=[]),this.isInitInfo=!1,this._stopCanvasRender(),this._stopBandwidthEstimateInterval(),this._stopFpsInterval(),this.$videoElement=null,this.hlsFps=0,this.player.debug.log("HlsDecoder","destroy")}checkHlsBufferedDelay(){var e=this.$videoElement;let t=0;var i=e.buffered,i=i.length?i.end(i.length-1):0;return(t=i-e.currentTime)<0&&(this.player.debug.warn("HlsDecoder","checkHlsBufferedDelay result < 0",t,i,e.currentTime),t=0),t}getFps(){return this.hlsFps}_startCanvasRender(){this._stopCanvasRender(),this.canvasRenderInterval=setInterval(()=>{this.player.video.render({$video:this.$videoElement,ts:0})},40)}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval(()=>{let e=0;this.hls.bandwidthEstimate&&(e=this.hls.bandwidthEstimate),this.player.emit(E.kBps,(e/1024/8/10).toFixed(2))},1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startFpsInterval(){this._stopCanvasRender(),this.fpsInterval=setInterval(()=>{var e=this.$videoElement.getVideoPlaybackQuality();this.hlsFps=e.totalVideoFrames-this.hlsPrevFrams,this.hlsPrevFrams=e.totalVideoFrames},1e3)}_stopFpsInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_initHls(){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.$videoElement.muted=!0,st()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}_bindEvents(){const i=this.player,e=this.player.events["proxy"];this.hls;var t=e(this.$videoElement,Be,e=>{this.hls&&(e=parseInt(e.timeStamp,10),i.handleRender(),i.updateStats({ts:e,dts:e,fps:!0}),i.emit(E.videoTimeUpdate,e))});this.eventsDestroy.push(t),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(O.Events.ERROR,(e,t)=>{if(t.fatal)switch(t.type){case O.ErrorTypes.NETWORK_ERROR:this.player.debug.error("HlsDecoder","fatal network error encountered, try to recover"),this.hls.startLoad();break;case O.ErrorTypes.MEDIA_ERROR:this.player.debug.error("HlsDecoder","fatal media error encountered, try to recover"),this.hls.recoverMediaError()}}),this.hls.on(O.Events.MEDIA_ATTACHING,()=>{}),this.hls.on(O.Events.MEDIA_ATTACHED,()=>{}),this.hls.on(O.Events.MEDIA_DETACHING,()=>{}),this.hls.on(O.Events.MEDIA_DETACHED,()=>{}),this.hls.on(O.Events.BUFFER_RESET,()=>{}),this.hls.on(O.Events.BUFFER_CODECS,()=>{}),this.hls.on(O.Events.BUFFER_CREATED,()=>{}),this.hls.on(O.Events.BUFFER_APPENDING,(e,t)=>{this.player.debug.log("HlsDecoder","BUFFER_APPENDING",t)}),this.hls.on(O.Events.BUFFER_APPENDED,()=>{}),this.hls.on(O.Events.BUFFER_EOS,()=>{}),this.hls.on(O.Events.BUFFER_FLUSHING,()=>{}),this.hls.on(O.Events.BUFFER_FLUSHED,()=>{}),this.hls.on(O.Events.MANIFEST_LOADING,()=>{this.player.debug.log("HlsDecoder","MANIFEST_LOADING 开始加载playlist m3u8资源")}),this.hls.on(O.Events.MANIFEST_LOADED,(e,t)=>{this.player.debug.log("HlsDecoder","MANIFEST_LOADED playlist m3u8文件加载完成",t)}),this.hls.on(O.Events.MANIFEST_PARSED,()=>{this.player.debug.log("HlsDecoder","MANIFEST_PARSED playlist m3u8解析完成"),i._times.demuxStart||(i._times.demuxStart=A())}),this.hls.on(O.Events.LEVEL_LOADING,()=>{}),this.hls.on(O.Events.LEVEL_LOADED,(e,t)=>{}),this.hls.on(O.Events.FRAG_LOADING,()=>{}),this.hls.on(O.Events.FRAG_LOADED,(e,t)=>{i._times.decodeStart||(i._times.decodeStart=A())}),this.hls.on(O.Events.BUFFER_APPENDING,()=>{i._times.videoStart||(i._times.videoStart=A(),i.handlePlayToRenderTimes())}),this.hls.on(O.Events.FRAG_DECRYPTED,()=>{}),this.hls.on(O.Events.KEY_LOADING,()=>{}),this.hls.on(O.Events.KEY_LOADING,()=>{}),this.hls.on(O.Events.FPS_DROP,e=>{}),this.hls.on(O.Events.FPS_DROP_LEVEL_CAPPING,e=>{}),this.hls.on(O.Events.FRAG_PARSING_INIT_SEGMENT,(e,t)=>{this.player.debug.log("HlsDecoder","FRAG_PARSING_INIT_SEGMENT",t);const i=!!(t&&t.tracks&&t.tracks.audio),r=!!(t&&t.tracks&&t.tracks.video);if(i&&t.tracks.audio){var s=t.tracks.audio;const i=s.metadata&&s.metadata.channelCount?s.metadata.channelCount:0,r=s.codec;this.player.audio&&this.player.audio.updateAudioInfo({encType:r,channels:i,sampleRate:44100})}var a;r&&t.tracks.video&&(t=(s=t.tracks.video).codec,a=s.metadata&&s.metadata.width?s.metadata.width:0,s=s.metadata&&s.metadata.height?s.metadata.height:0,this.player.video)&&this.player.video.updateVideoInfo({encTypeCode:-1!==t.indexOf("avc")?7:12,width:a,height:s})})}initVideoPlay(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),this.$videoElement.muted=!0,this.$videoElement.src=e}initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}initVideoEvents(){var e=this.player.events["proxy"],t=e(this.$videoElement,Ie,()=>{this.player.debug.log("HlsDecoder","video canplay"),this.$videoElement.play().then(()=>{this.player.debug.log("HlsDecoder","video play"),this._startCanvasRender(),this.initRenderSize()}).catch(e=>{this.player.debug.warn("HlsDecoder","video play error ",e)})}),i=e(this.$videoElement,Pe,()=>{this.player.debug.log("HlsDecoder","video waiting")}),r=e(this.$videoElement,Be,e=>{e=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:e}),this.player.emit(E.videoTimeUpdate,e),this.$videoElement.paused&&(this.player.debug.warn("HlsDecoder","video is paused and next try to replay"),this.$videoElement.play().then(()=>{this.player.debug.log("HlsDecoder","video is paused and replay success")}).catch(e=>{this.player.debug.warn("HlsDecoder","video is paused and replay error ",e)}))}),e=e(this.$videoElement,Me,()=>{this.player.debug.log("HlsDecoder","video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)});this.eventsDestroy.push(t,i,r,e)}loadSource(i){return new Promise((e,t)=>{this.canVideoPlay?(this.initVideoPlay(i),e()):this.hls.on(O.Events.MEDIA_ATTACHED,()=>{this.hls.loadSource(i),e()})})}_handleUpdatePlaybackRate(){if(this.$videoElement){var t=this.$videoElement,i=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3,r=t.buffered,r=(r.length&&r.start(0),r.length?r.end(r.length-1):0);let e=t.currentTime;var s=r-e,i=Math.max(5,3+i),i=(i<s?(this.player.debug.warn("HlsDecoder",`handleUpdatePlaybackRate and delay buffer is more than ${i} is ${s} and new time is ${r} `),t.currentTime=r,e=t.currentTime):s<0&&this.player.debug.warn("HlsDecoder",`handleUpdatePlaybackRate and delay buffer is less than 0 is ${s} and new time is `+r),this._getPlaybackRate(r-e));t.playbackRate!==i&&(t.playbackRate=i)}}_getPlaybackRate(e){var t=this.$videoElement,i=this.player._opt.videoBuffer,r=i+this.player._opt.videoBufferDelay;return e*=1e3,1===t.playbackRate?r<e?1.2:1:e<=i?1:t.playbackRate}getDecodePlaybackRate(){let e=0;var t=this.$videoElement;return e=t?t.playbackRate:e}}class ds extends e{constructor(e){super(),this.player=e,this.rtcPeerConnection=null,this.videoStream=null,this._initRtcPeerConnection(),this.player.debug.log("WebrtcDecoder","init")}destroy(){this.rtcPeerConnection&&(this.rtcPeerConnection.close(),this.rtcPeerConnection=null),this.videoStream=null,this.player.video.$videoElement.srcObject=null,this.player.debug.log("WebrtcDecoder","destroy")}_initRtcPeerConnection(){const t=new RTCPeerConnection,i=this.player;t.addTransceiver("video",{direction:"recvonly"}),t.addTransceiver("audio",{direction:"recvonly"}),t.onsignalingstatechange=e=>{this.player.debug.log("WebrtcDecoder","onsignalingstatechange",e)},t.oniceconnectionstatechange=e=>{this.player.debug.log("WebrtcDecoder","oniceconnectionstatechange",t.iceConnectionState)},t.onicecandidate=e=>{this.player.debug.log("WebrtcDecoder","onicecandidate",e)},t.ontrack=e=>{var t=i.video.$videoElement;"video"===e.track.kind&&(e=e.streams[0],t.srcObject=e,this.videoStream=e)},t.onconnectionstatechange=e=>{switch(i.debug.log("WebrtcDecoder","sdp connect status "+t.connectionState),t.connectionState){case"connected":break;case"disconnected":i.emit(E.webrtcDisconnect);break;case"failed":i.emit(E.webrtcFailed);break;case"closed":i.emit(E.webrtcClosed)}},this.rtcPeerConnection=t}loadSource(s){return new Promise((t,i)=>{const r=this.rtcPeerConnection;r.createOffer().then(e=>{r.setLocalDescription(e),this.player.debug.log("WebrtcDecoder","getWebRtcRemoteSdp loadSource"),e=e.sdp,fetch(s,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:e}).then(e=>{e.text().then(e=>{this.player.debug.log("WebrtcDecoder","getWebRtcRemoteSdp response"),r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})),t()}).catch(e=>{this.player.debug.error("WebrtcDecoder","loadSource response.text() error",e),i(e)})}).catch(e=>{this.player.debug.error("WebrtcDecoder","loadSource getWebRtcRemoteSdp response error",e),i(e)})}).catch(e=>{this.player.debug.error("WebrtcDecoder","loadSource rtcPeerConnection.createOffer() error",e),i(e)})})}}class us extends e{constructor(e){super(),this.tagName="WebrtcForZLMDecoder",this.player=e,this.rtcPeerConnection=null,this.videoStream=null,this._initRtcPeerConnection(),this.player.debug.log(this.tagName,"init")}destroy(){this.rtcPeerConnection&&(this.rtcPeerConnection.close(),this.rtcPeerConnection=null),this.videoStream&&(this.videoStream.getTracks().forEach(e=>e.stop()),this.videoStream=null),this.videoStream=null,this.player.video.$videoElement.srcObject=null,this.player.debug.log(this.tagName,"destroy")}_initRtcPeerConnection(){const t=new RTCPeerConnection,i=this.player;t.addTransceiver("video",{direction:"recvonly"}),t.addTransceiver("audio",{direction:"recvonly"}),t.onsignalingstatechange=e=>{console.log("onsignalingstatechange",e)},t.oniceconnectionstatechange=e=>{console.log("oniceconnectionstatechange",t.iceConnectionState)},t.onicecandidate=e=>{console.log("onicecandidate",e)},t.ontrack=e=>{var t=i.video.$videoElement;console.log("ontrack",e),"video"===e.track.kind&&(e=e.streams[0],t.srcObject=e,this.videoStream=e)},this.rtcPeerConnection=t}loadSource(s){return new Promise((t,i)=>{const r=this.rtcPeerConnection;r.createOffer().then(e=>{r.setLocalDescription(e),this.player.debug.log(this.tagName,"getWebRtcRemoteSdp loadSource"),e=e.sdp,h({url:s,type:"POST",data:e,contentType:"text/plain;charset=utf-8",processData:!1,dataType:"json"}).then(e=>{this.player.debug.log(this.tagName,"getWebRtcRemoteSdp response");e=e.data;if(0!==e.code)return i(e.msg);r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e.sdp})),t()}).catch(e=>{this.player.debug.error(this.tagName,"loadSource getWebRtcRemoteSdp response error",e),i(e)})}).catch(e=>{this.player.debug.error(this.tagName,"loadSource rtcPeerConnection.createOffer() error",e),i(e)})})}}class hs extends e{constructor(e,t){super(),this.player=e,this.player.$container.classList.add("jessibuca-container-playback"),this._showPrecision=null,this._startTime=null,this._playStartTime=null,this._playingTimestamp=null,this._fps=parseInt(t.fps,10)||e._opt.playbackFps,this._isUseFpsRender=!!S(t.isUseFpsRender),this._rate=1,this._audioTimestamp=0,this._videoTimestamp=0,this._currentLocalTimestamp=0,this._localOneFrameTimestamp=t.localOneFrameTimestamp||40,this._localCalculateTimeInterval=null,this._isUseLocalCalculateTime=!!S(t.isUseLocalCalculateTime),this._isPlaybackPauseClearCache=!k(t.isPlaybackPauseClearCache),this._isCacheBeforeDecodeForFpsRender=!!S(t.isCacheBeforeDecodeForFpsRender),this._startfpsTime=null,this._startFpsTimestamp=null,this._checkStatsInterval=null,this._playbackTs=0,this._renderFps=0,this._isUseLocalCalculateTime?this._startLocalCalculateTime():this._listen(),this.playbackList=[],this._totalDuration=0,this.initPlaybackList(t.playList),this.player.on(E.playbackPause,e=>{e?this.pause():this.resume()}),e.debug.log("Playback","init",{fps:this._fps,isUseFpsRender:this._isUseFpsRender,localOneFrameTimestamp:this._localOneFrameTimestamp,isUseLocalCalculateTime:this._isUseLocalCalculateTime,uiUsePlaybackPause:t.uiUsePlaybackPause,showControl:t.showControl})}destroy(){this._startTime=null,this._showPrecision=null,this._playStartTime=null,this._playingTimestamp=null,this._totalDuration=0,this._audioTimestamp=0,this._videoTimestamp=0,this._fps=null,this._isUseFpsRender=!1,this._rate=1,this.playbackList=[],this._localCalculateTimeInterval=null,this._currentLocalTimestamp=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._renderFps=0,this._playbackTs=0,this._stopLocalCalculateTime(),this.clearStatsInterval(),this.player.$container&&this.player.$container.classList.remove("jessibuca-container-playback"),this.off(),this.player.debug.log("Playback","destroy")}_listen(){this.player.on(E.stats,e=>{e=e.ts,this._playStartTime||(this._playStartTime=e),e-=this._playStartTime;this.setPlayingTimestamp(e)})}pause(){this.clearStatsInterval()}resume(){this.startCheckStatsInterval()}updateStats(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(this._startFpsTimestamp||(this._startFpsTimestamp=A()),c(t.ts)&&(this.player.updateStats({fps:!0,ts:t.ts}),this._playbackTs=t.ts,this._startfpsTime||(this._startfpsTime=t.ts),this._renderFps+=1),A()),i=t-this._startFpsTimestamp;if(!(i<1e3)){let e=null;this._startfpsTime&&(e=this._playbackTs-this._startfpsTime),this.player.emit(E.playbackStats,{fps:this._renderFps,rate:this.rate,start:this._startfpsTime,end:this._playbackTs,timestamp:i,dataTimestamp:e,audioBufferSize:this.player.audio?this.player.audio.bufferSize:0,videoBufferSize:this.player.video?this.player.video.bufferSize:0,ts:this._playbackTs}),this._renderFps=0,this._startfpsTime=this._playbackTs,this._startFpsTimestamp=t}}updateLocalOneFrameTimestamp(e){this._localOneFrameTimestamp=e}_startLocalCalculateTime(){this._stopLocalCalculateTime(),this._localCalculateTimeInterval=setInterval(()=>{var e=this._currentLocalTimestamp,e=(this._playStartTime||(this._playStartTime=e),e-this._playStartTime);this.setPlayingTimestamp(e)},1e3)}startCheckStatsInterval(){this.clearStatsInterval(),this._checkStatsInterval=setInterval(()=>{this.updateStats()},1e3)}_stopLocalCalculateTime(){this._localCalculateTimeInterval&&(clearInterval(this._localCalculateTimeInterval),this._localCalculateTimeInterval=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}increaseLocalTimestamp(){this._isUseLocalCalculateTime&&(this._currentLocalTimestamp+=this._localOneFrameTimestamp)}initPlaybackList(e){this.playbackList=e||[];let i=0;this.playbackList.forEach((e,t)=>{10===Et(e.start)&&(e.startTimestamp=1e3*e.start,e.startTime=at(e.startTimestamp)),10===Et(e.end)&&(e.endTimestamp=1e3*e.end,e.endTime=at(e.endTimestamp)),e.duration=e.end-e.start,i+=e.duration}),this._totalDuration=i,this.player.debug.log("Playback",this.playbackList),0<this.playbackList.length&&this.setStartTime(this.playbackList[0].startTimestamp),this.setShowPrecision(we)}get startTime(){return this._startTime||0}setStartTime(e){this._startTime=e,this._playStartTime=null}setRate(e){this._rate=e,this.player.emit(E.playbackRateChange,e)}get fps(){return this._fps}get rate(){return this._rate}get isUseFpsRender(){return this._isUseFpsRender}get isUseLocalCalculateTime(){return this._isUseLocalCalculateTime}get showPrecision(){return this._showPrecision}get is60Min(){return this.showPrecision===we}get is30Min(){return this.showPrecision===Te}get is10Min(){return"tenMin"===this.showPrecision}get is5Min(){return this.showPrecision===Se}get is1Min(){return this.showPrecision===Se}get isPlaybackPauseClearCache(){return this._isPlaybackPauseClearCache}get isCacheBeforeDecodeForFpsRender(){return this._isCacheBeforeDecodeForFpsRender}setShowPrecision(e){this._showPrecision&&this._showPrecision===e||(this._showPrecision=e,this.player.emit(E.playbackPrecision,this._showPrecision,this.playbackList))}setPlayingTimestamp(e){var e=this.startTime+e,t=(this._playingTimestamp=e,this.player.emit(E.playbackTime,e),new Date(e));this.player.emit(E.playbackTimestamp,{ts:e,hour:t.getHours(),min:t.getMinutes(),second:t.getSeconds()})}get playingTimestamp(){return this._playingTimestamp}narrowPrecision(){var e=_e.indexOf(this.showPrecision)-1;0<=e&&(e=_e[e],this.setShowPrecision(e))}expandPrecision(){var e=_e.indexOf(this.showPrecision)+1;e<=_e.length-1&&(e=_e[e],this.setShowPrecision(e))}seek(t){if(console.log(t),"true"===t.hasRecord){let e=t.time;"min"===t.type&&(e=60*t.time),this.player.emit(E.playbackSeek,function(e){let t={};return t=-1<e?{hour:Math.floor(e/60/60)%60,min:Math.floor(e/60)%60,second:e%60}:t}(e))}}}class ps extends e{constructor(e){super(),this.player=e,this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0};var{proxy:t}=this.player["events"];this.player.on(E.zooming,e=>{if(e){this.player.$container.classList.add("jessibuca-zoom-control"),this._bindEvents();const e=this.player.video.$videoElement.style.transform;var t=this.player.video.$videoElement.style.left,i=this.player.video.$videoElement.style.top,t=parseFloat(t),i=parseFloat(i),t=(t&&(this.videoPosition.left=t),i&&(this.videoPosition.top=i),(this.prevVideoElementStyleTransform=e).match(/scale\([0-9., ]*\)/g));t&&t[0]&&(i=t[0].replace("scale(","").replace(")",""),this.prevVideoElementStyleScale=i.split(","))}else this.player.$container.classList.remove("jessibuca-zoom-control"),this._unbindEvents(),this._resetVideoPosition(),this.player.$container.style.cursor="auto",this.player.video.$videoElement.style.transform=this.prevVideoElementStyleTransform,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null}),t(window,"mouseup",e=>{this.handleMouseUp(e)}),e.debug.log("zoom","init")}destroy(){this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.off(),this.player.debug.log("zoom","destroy")}_bindEvents(){var e=this.player["events"]["proxy"],t=e(this.player.$container,"mousemove",e=>{this.handleMouseMove(e)}),t=(this.bindEvents.push(t),e(this.player.$container,"mousedown",e=>{this.handleMouseDown(e)}));this.bindEvents.push(t)}_unbindEvents(){this.bindEvents.forEach(e=>{e&&e()})}handleMouseMove(e){var t,i,r;e.stopPropagation(),this.isDragging&&this.player.zooming&&({posX:e,posY:t}=_t(e),i=this.tempPosition.x-e,r=this.tempPosition.y-t,this.videoPosition.left=this.videoPosition.left-i,this.videoPosition.top=this.videoPosition.top-r,this.tempPosition.x=e,this.tempPosition.y=t,this.updateVideoPosition())}handleMouseDown(e){e.stopPropagation();const t=kt(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){const{posX:t,posY:i}=_t(e);this.player.$container.style.cursor="grabbing",this.tempPosition.x=t,this.tempPosition.y=i,this.isDragging=!0,this.player.debug.log("zoom","handleMouseDown is dragging true")}}handleMouseUp(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(this.tempPosition={x:0,y:0},this.isDragging=!1,this.player.$container.style.cursor="grab",this.player.debug.log("zoom","handleMouseUp is dragging false"))}updateVideoPosition(){var e=this.player.video.$videoElement;e.style.left=this.videoPosition.left+"px",e.style.top=this.videoPosition.top+"px"}_resetVideoPosition(){this.player.resize(),this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.currentZoom=1}narrowPrecision(){this.currentZoom<=1||(--this.currentZoom,this.updateVideoElementScale())}expandPrecision(){5<=this.currentZoom||(this.currentZoom+=1,this.updateVideoElementScale())}updateVideoElementScale(){const e=this.player.video.$videoElement;let t=e.style.transform,i=1,r=1;if(this.prevVideoElementStyleScale){const e=this.prevVideoElementStyleScale[0],t=(void 0!==e&&(i=e,r=e),this.prevVideoElementStyleScale[1]);void 0!==t&&(r=t)}r=T(r);var s=.5*(i=T(i))*(this.currentZoom-1)+i,a=.5*r*(this.currentZoom-1)+r,n=-1===t.indexOf("scale(")?t+` scale(${s},${a})`:t.replace(/scale\([0-9., ]*\)/,`scale(${s},${a})`);this.player.debug.log("zoom",`updateVideoElementScale end is ${s}, ${a} style is `+n),e.style.transform=n}}class fs extends e{constructor(e){super(),this.player=e,this.faceDetector=null,this.objectDetector=null,this.initFaceDetector(),this.initObjectDetector(),this.player.debug.log("AiLoader","init")}initFaceDetector(){if(this.player._opt.useFaceDetector&&window.JessibucaProFaceDetector){const e=new JessibucaProFaceDetector({detectWidth:this.player._opt.aiFaceDetectWidth});e.load().then(()=>{this.player.debug.log("AiLoader","init face detector success"),this.faceDetector=e})}}initObjectDetector(){if(this.player._opt.useObjectDetector&&window.JessibucaProObjectDetector){const e=new JessibucaProObjectDetector({detectWidth:this.player._opt.aiObjectDetectWidth});e.load().then(()=>{this.player.debug.log("AiLoader","init object detector success"),this.objectDetector=e,this.objectDetector.on("jessibuca-pro-object-detector-info",e=>{e&&0<e.length&&this.player.emit(E.aiObjectDetectorInfo,e)})})}}destroy(){this.faceDetector&&(this.faceDetector.destroy(),this.faceDetector=null),this.objectDetector&&(this.objectDetector.destroy(),this.objectDetector=null),this.off()}}class gs extends e{constructor(e){super(),this.player=e,this.LOG_NAME="Contextmenu",this.menuList=[],this.$contextmenus=e.control.$contextmenus,g()?this.player.debug.warn(this.LOG_NAME,"not support mobile"):this.init(),e.debug.log(this.LOG_NAME,"init")}destroy(){this.menuList=[],this.player.debug.log(this.LOG_NAME,"destroy")}get isShow(){return this.player.$container.classList.contains("jessibuca-contextmenus-show")}show(){this.player.$container.classList.add("jessibuca-contextmenus-show")}hide(){this.player.$container.classList.remove("jessibuca-contextmenus-show")}init(){var{proxy:e}=this.player["events"];0<this.player._opt.contextmenuBtns.length&&this.player._opt.contextmenuBtns.forEach(e=>{this.addMenuItem(e)}),e(this.player.$container,"contextmenu",e=>{e.preventDefault(),this.show();var t=e.clientX,e=e.clientY,{height:i,width:r,left:s,top:a}=this.player.$container.getBoundingClientRect(),{height:n,width:o}=this.$contextmenus.getBoundingClientRect();let l=t-s,c=e-a;s+r<t+o&&(l=r-o),a+i<e+n&&(c=i-n),w(this.$contextmenus,{left:l+"px",top:c+"px"})}),e(this.player.$container,"click",e=>{ss(e,this.$contextmenus)||this.hide()}),this.player.on(E.blur,()=>{this.hide()})}_validateMenuItem(e){let t=!0;return e.content||(this.player.debug.warn(this.LOG_NAME,"content is required"),t=!1),t}addMenuItem(){let t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};var e,i,r,s,a=It(We);t=Object.assign({},a,t),this._validateMenuItem(t)&&({events:{proxy:a},debug:e}=this.player,r=`
  375. <div class="jessibuca-contextmenu jessibuca-contextmenu-${i=ot()}">
  376. ${t.content}
  377. </div>
  378. `,(s=Array.from(this.$contextmenus.children)[t.index])?s.insertAdjacentHTML("beforebegin",r):rs(this.$contextmenus,r),s=this.$contextmenus.querySelector(".jessibuca-contextmenu-"+i),t.click&&a(s,"click",e=>{e.preventDefault(),t.click.call(this.player,this,e),this.hide()}),this.menuList.push({uuid:i,$menuItem:s}))}}class ms extends e{_opt={};constructor(e){let t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};super(),this.$container=e;var i,e=Bt();if(this._opt=Object.assign({},e,t),this.debug=new Ke(this),this._opt.forceNoOffscreen=!0,g()&&(this._opt.controlAutoHide=!1),this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),(this._opt.isHls||this._opt.isWebrtc)&&(this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1),this._opt.isNakedFlow,!this._opt.isHls&&!this._opt.isWebrtc){if(this._opt.useWCS){const e="VideoEncoder"in window,t=dt();this._opt.useWCS=e,this._opt.useWCS&&this._opt.isH265&&(this._opt.useWCS=t),this._opt.useWCS||this.debug.warn("Player",`
  379. useWCS is true,
  380. and supportWCS is ${e}, supportHevcWCS is ${t} , _opt.isH265 is ${this._opt.isH265}
  381. so set useWCS false`),this._opt.useWCS&&(this._opt.useOffscreen?this._opt.wcsUseVideoRender=!1:this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=ut()&&ht(),this._opt.wcsUseVideoRender||this.debug.warn("Player","wcsUseVideoRender is true, but not support so set wcsUseVideoRender false")))}if(this._opt.useMSE){const e=function(){let e=!1;return e="MediaSource"in window&&window.MediaSource.isTypeSupported(ve)?!0:e}(),t=ct();this._opt.useMSE=e,this._opt.useMSE&&this._opt.isH265&&(this._opt.useMSE=t),this._opt.useMSE||this.debug.warn("Player",`
  382. useMSE is true,
  383. and supportMSE is ${e}, supportHevcMSE is ${t} , _opt.isH265 is ${this._opt.isH265}
  384. so set useMSE false`)}}this._opt.useMSE?(this._opt.useWCS&&this.debug.warn("Player","useMSE is true and useWCS is true then useWCS set true->false"),this._opt.forceNoOffscreen||this.debug.warn("Player","useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0):this._opt.useWCS,!this._opt.useSIMD&&-1===this._opt.decoder.indexOf("-simd")||(this._opt.useSIMD=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))&&k(/iphone/i.test(navigator.userAgent)),this._opt.useSIMD)||this.debug.warn("Player","useSIMD is true, but not support so set useSIMD false"),this._opt.useSIMD?-1===this._opt.decoder.indexOf("-simd")&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro","decoder-pro-simd")):-1!==this._opt.decoder.indexOf("-simd")&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd","decoder-pro")),-1!==this._opt.decoder.indexOf("-simd")?this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd","decoder-pro-audio"):this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro","decoder-pro-audio"),k(this._opt.hasAudio)&&(this._opt.operateBtns.audio=!1),k(this._opt.hasVideo)&&(this._opt.operateBtns.fullscreen=!1,this._opt.operateBtns.screenshot=!1,this._opt.operateBtns.record=!1,this._opt.operateBtns.ptz=!1,this._opt.operateBtns.quality=!1,this._opt.operateBtns.zoom=!1),this._opt.qualityConfig&&0===this._opt.qualityConfig.length&&this._opt.operateBtns.quality&&(this._opt.operateBtns.quality=!1,this.debug.warn("Player","_opt.qualityConfig is empty, so set operateBtns.quality false")),S(this._opt.useWebGPU)&&(this._opt.useWebGPU=function(){let e=!1;return e="gpu"in navigator?!0:e}(),k(this._opt.useWebGPU))&&this.debug.warn("Player","useWebGPU is true, but not support so set useWebGPU false"),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._playbackPause=!1,this._hasLoaded=!1,this._zooming=!1,this._destroyed=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._checkVisibleHiddenTimeout=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,pTs:0,dts:0},this._allStatsData={},this._faceDetectActive=!1,this._objectDetectActive=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,this._videoIframeIntervalTs=0,this._streamQuality=this._opt.defaultStreamQuality||"",this._visibility=!0,this._lastestVisibilityChangeTimestamp=null,this._tempWorkerStats=null,this._historyFpsList=[],this._isPlayback()&&(this._opt.useMSE=!1,this._opt.useWCS=!1),k(this._opt.useMSE)&&k(this._opt.useWCS)&&k(this._opt.isWebrtc)&&k(this._opt.isHls)&&(this._opt.useWasm=!0),(this._opt.isHls||this._opt.isWebrtc)&&(this._opt.hasVideo=!0,this._opt.hasAudio=!0),this._opt.hasVideo||(this._opt.useMSE=!1,this._opt.useWCS=!1),this._opt.useWasm&&(this._opt.useOffscreen?this._opt.wasmUseVideoRender=!1:this._opt.wasmUseVideoRender&&(this._opt.wasmUseVideoRender=nt()&&ut()&&ht(),this._opt.wasmUseVideoRender||this.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")),this._opt.useSIMD?this.debug.log("Player","use simd wasm"):this.debug.log("Player","use wasm")),this._opt.useWasm&&(this._opt.useFaceDetector&&window.JessibucaProFaceDetector||this._opt.useObjectDetector&&window.JessibucaProObjectDetector)?(this.ai=new fs(this),this._opt.useFaceDetector&&window.JessibucaProFaceDetector||(this._opt.operateBtns.aiFace=!1),this._opt.useObjectDetector&&window.JessibucaProObjectDetector||(this._opt.operateBtns.aiObject=!1)):(this._opt.operateBtns.aiObject=!1,this._opt.operateBtns.aiFace=!1),!this._opt.useFaceDetector||this._opt.useWasm&&window.JessibucaProFaceDetector||this.debug.warn("Player",`use face detector, useWasm is ${this._opt.useWasm} and window.JessibucaProFaceDetector is `+!!window.JessibucaProFaceDetector),!this._opt.useObjectDetector||this._opt.useWasm&&window.JessibucaProObjectDetector||this.debug.warn("Player",`use object detector, useWasm is ${this._opt.useWasm} and window.JessibucaProObjectDetector is `+!!window.JessibucaProObjectDetector),this._opt.useVideoRender&&(this._opt.useWasm&&!this._opt.useOffscreen?(this._opt.wasmUseVideoRender=nt()&&ut()&&ht(),this._opt.wasmUseVideoRender||this.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")):this._opt.useWCS&&!this._opt.useOffscreen&&(this._opt.wcsUseVideoRender=ut()&&ht(),this._opt.wcsUseVideoRender||this.debug.warn("Player","use wcs video render, but not support so set wcsUseVideoRender false"))),this._opt.useCanvasRender&&(this._opt.useMSE&&(this._opt.mseUseCanvasRender=!0),this._opt.useWasm&&(this._opt.wasmUseVideoRender=!1),this._opt.useWCS&&(this._opt.wcsUseVideoRender=!1),this._opt.isHls)&&!st()&&(this._opt.hlsUseCanvasRender=!0),this._opt.useVideoRender=!1,this._opt.useCanvasRender=!1,this._opt.useWasm?this._opt.wasmUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useWCS?this._opt.wcsUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useMSE?this._opt.mseUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this._opt.isHls?this._opt.hlsUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this._opt.isWebrtc&&(this._opt.useVideoRender=!0),i=this,Object.defineProperty(i,"rect",{get:()=>{var e=i.$container.getBoundingClientRect();return e.width=Math.max(e.width,i.$container.clientWidth),e.height=Math.max(e.height,i.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach(e=>{Object.defineProperty(i,e,{get:()=>i.rect[e]})}),this.events=new Ft(this),this._opt.hasVideo&&(this.video=new ri(this),this.recorder=new Gi(this)),this._opt.isHls?(this.hlsDecoder=new cs(this),this.loaded=!0):this._opt.isWebrtc?(this._opt.isWebrtcForZLM?this.webrtc=new us(this):this.webrtc=new ds(this),this.loaded=!0):Ct(this._opt)?this.loaded=!0:this.decoderWorker=new Hi(this),this._opt.hasAudio&&(this.audio=new vi(this)),this.stream=null,this.demux=null,this._lastVolume=null,this._isInZoom=!1,this._playingStartTimestamp=null,this._opt.useWCS&&(this.webcodecsDecoder=new Qr(this),this._opt.hasAudio||(this.loaded=!0)),this._opt.useMSE&&(this.mseDecoder=new ns(this),this._opt.hasAudio||(this.loaded=!0)),this.control=new as(this),0<this._opt.contextmenuBtns.length&&(this.contextmenu=new gs(this)),this._isPlayback()&&(this.playback=new hs(this,this._opt.playbackConfig)),this._opt.operateBtns.zoom&&(this.zoom=new ps(this)),/(iphone|ipad|ipod|ios|android)/i.test(window.navigator.userAgent.toLowerCase())&&(this.keepScreenOn=new ls(this));var r=this;try{const a=e=>{kt(e)===r.$container&&(r.emit(ne.fullscreen,r.fullscreen),!r.fullscreen||r._opt.useMSE)&&r.resize()};f.on("change",a),r.events.destroys.push(()=>{f.off("change",a)})}catch(r){}if(r.on(E.decoderWorkerInit,()=>{r.debug.log("player","listen decoderWorkerInit and set loaded true"),r.loaded=!0}),r.on(E.play,()=>{r.loading=!1}),r.on(E.fullscreen,e=>{if(e)try{f.request(r.$container).then(()=>{}).catch(e=>{r.debug.error("player","fullscreen request error",e),g()&&r._opt.useWebFullScreen&&(r.webFullscreen=!0)})}catch(e){g()&&r._opt.useWebFullScreen&&(r.webFullscreen=!0)}else try{f.exit().then(()=>{r.webFullscreen&&(r.webFullscreen=!1)}).catch(e=>{r.debug.error("player","fullscreen exit error",e),r.webFullscreen&&(r.webFullscreen=!1)})}catch(e){r.webFullscreen&&(r.webFullscreen=!1)}}),g()&&r.on(E.webFullscreen,e=>{e?r.$container.classList.add("jessibuca-fullscreen-web"):r.$container.classList.remove("jessibuca-fullscreen-web"),r.emit(ne.fullscreen,r.fullscreen)}),r.on(E.resize,()=>{r.video&&r.video.resize()}),r._opt.debug){const n=[E.timeUpdate];Object.keys(E).forEach(t=>{r.on(E[t],e=>{n.includes(t)||r.debug.log("player events",E[t],e)})}),Object.keys(m).forEach(t=>{r.on(m[t],e=>{r.debug.warn("player event error",m[t],e)})})}{var s=this;const{_opt:o,debug:l,events:{proxy:c}}=s;if(o.supportDblclickFullscreen&&c(s.$container,"dblclick",e=>{e=kt(e).nodeName.toLowerCase();"canvas"!==e&&"video"!==e||(s.fullscreen=!s.fullscreen)}),c(document,"visibilitychange",()=>{s.visibility="visible"===document.visibilityState,l.log("visibilitychange",document.visibilityState),o.hiddenAutoPause&&(l.log("visibilitychange","hiddenAutoPause is true ",document.visibilityState,s._isPlayingBeforePageHidden),"visible"===document.visibilityState?s._isPlayingBeforePageHidden&&s.play():(s._isPlayingBeforePageHidden=s.playing,s.playing&&s.pause()))}),c(document,["click","contextmenu"],e=>{ss(e,s.$container)?(s.isInput="INPUT"===e.target.tagName,s.isFocus=!0,s.emit(E.focus)):(s.isInput=!1,s.isFocus=!1,s.emit(E.blur))}),o.autoResize){const o=lt(()=>{s.resize()},500);c(window,["resize","orientationchange"],()=>{o()}),screen&&screen.orientation&&screen.orientation.onchange&&c(screen.orientation,"change",()=>{o()})}}this.singleWatermark=new ei(this),this._opt.watermarkConfig&&this.updateWatermark(this._opt.watermarkConfig),this._opt.useWCS&&this.debug.log("Player","use WCS"),this._opt.useMSE&&this.debug.log("Player","use MSE"),this._opt.useOffscreen&&this.debug.log("Player","use offscreen"),this._opt.isHls&&this.debug.log("Player","use hls"),this._opt.isWebrtc&&this.debug.log("Player","use webrtc"),this._isPlayback()&&this.debug.log("Player","use playback"),this._opt.hasVideo&&(0===this.width&&this.debug.warn("Player","container width is 0, please check the container width"),0===this.height)&&this.debug.warn("Player","container height is 0, please check the container height"),this.debug.log("Player options",JSON.stringify(this._opt))}destroy(){return new Promise((e,t)=>{this._destroyed=!0,this.emit("destroy"),this.off(),this.events&&(this.events.destroy(),this.events=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.clearVisibilityHiddenTimeout(),this.decoderWorker?this.decoderWorker.destroy().then(()=>{this.decoderWorker=null,this._destroy(),e()}):(this._destroy(),e())})}_destroy(){this._loading=!1,this._playing=!1,this._playbackPause=!1,this._hasLoaded=!1,this._lastVolume=null,this._zooming=!1,this._faceDetectActive=!1,this._objectDetectActive=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.singleWatermark&&(this.singleWatermark.destroy(),this.singleWatermark=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.video&&(this.video.destroy(),this.video=null),this.audio&&(this.audio.destroy(),this.audio=null),this.stream&&(this.stream.destroy(),this.stream=null),this.recorder&&(this.recorder.destroy(),this.recorder=null),this.control&&(this.control.destroy(),this.control=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.demux&&(this.demux.destroy(),this.demux=null),this.hlsDecoder&&(this.hlsDecoder.destroy(),this.hlsDecoder=null),this.playback&&(this.playback.destroy(),this.playback=null),this.zoom&&(this.zoom.destroy(),this.zoom=null),this.ai&&(this.ai.destroy(),this.ai=null),this.keepScreenOn&&(this.releaseWakeLock(),this.keepScreenOn.destroy(),this.keepScreenOn=null),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._streamQuality="",this._visibility=!0,this._isInZoom=!1,this._playingStartTimestamp=null,this._lastestVisibilityChangeTimestamp=null,this._videoIframeIntervalTs=null,this._tempWorkerStats=null,this.debug.log("play","destroy end"),this._opt=Bt(),this.$container=null}set fullscreen(e){g()&&this._opt.useWebFullScreen?(this.emit(E.webFullscreen,e),setTimeout(()=>{this.updateOption({rotate:e?270:0}),this.resize()},10)):this.emit(E.fullscreen,e)}get fullscreen(){return f.isFullscreen||this.webFullscreen}set webFullscreen(e){this.emit(E.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("jessibuca-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded||this._opt.isHls||this._opt.isWebrtc||this._opt.useMSE&&!this._opt.hasAudio||this._opt.useWCS&&!this._opt.hasAudio}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(E.playing,e),this.emit(E.volumechange,this.volume),e?this.emit(E.play):this.emit(E.pause))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio?(this.audio.setVolume(e),this._lastVolume=this.volume):this.debug.error("Player","set volume error, audio is null"))}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(E.loading,this._loading))}get loading(){return this._loading}set zooming(e){this.zooming!==e&&(this.zoom||(this.zoom=new ps(this)),this._zooming=e,this.emit(E.zooming,this.zooming))}get zooming(){return this._zooming}set recording(e){e?this.playing&&!this.recording&&(this.recorder&&this.recorder.startRecord(),this._opt.useWasm)&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0}):this.recording&&(this._opt.useWasm&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder)&&this.recorder.stopRecordAndSave().then(()=>{}).catch(e=>{})}get recording(){return!!this.recorder&&this.recorder.isRecording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(E.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))}set streamQuality(e){this.streamQuality!==e&&(this._streamQuality=e,this.emit(E.streamQualityChange,e))}get streamQuality(){return this._streamQuality}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return S(this._opt.debug)}get scaleType(){var e=this._opt,t=e.isResize,e=e.isFullResize;let i=0;return k(e)&&k(t)?i=0:k(e)&&S(t)?i=1:S(e)&&S(t)&&(i=2),i}set visibility(e){this._visibility!==e&&(this._visibility=e,this.emit(E.visibilityChange,e),this._lastestVisibilityChangeTimestamp=A(),e?this.clearVisibilityHiddenTimeout():this.startVisibilityHiddenTimeout())}get visibility(){return this._visibility}set playbackPause(e){this._playbackPause!==e&&(this._playbackPause=e,this.emit(E.playbackPause,e),this.emit(E.playbackPauseOrResume,e))}get playbackPause(){return this._playbackPause}set videoIframeIntervalTs(e){this._videoIframeIntervalTs=e}get videoIframeIntervalTs(){return this._videoIframeIntervalTs}set faceDetectActive(e){this._faceDetectActive!==e&&(this._faceDetectActive=e,this.emit(E.faceDetectActive,e))}get faceDetectActive(){return this._faceDetectActive}set objectDetectActive(e){this._objectDetectActive!==e&&(this._objectDetectActive=e,this.emit(E.objectDetectActive,e))}get objectDetectActive(){return this._objectDetectActive}get isUseWorkerDemuxAndDecode(){return this.stream&&this.stream.getStreamType()===j}isDestroyed(){return this._destroyed}updateOption(e){this._opt=Object.assign({},this._opt,e)}init(){return new Promise((e,t)=>{this.video||this._opt.hasVideo&&(this.video=new ri(this)),this.audio||this._opt.hasAudio&&(this.audio=new vi(this)),this.stream||(this.stream=new Ci(this)),this._opt.isHls?(this.hlsDecoder||(this.hlsDecoder=new cs(this),this.loaded=!0),e()):this._opt.isWebrtc?(this.webrtc||(this._opt.isWebrtcForZLM?this.webrtc=new us(this):this.webrtc=new ds(this),this.loaded=!0),e()):(this.demux||this._opt.hasVideo&&!this.isUseWorkerDemuxAndDecode&&(this.demux=new qr(this)),this._opt.useWCS&&!this.webcodecsDecoder&&(this.webcodecsDecoder=new Qr(this)),this._opt.useMSE&&!this.mseDecoder&&(this.mseDecoder=new ns(this)),this.decoderWorker?this.loaded?e():this.once(E.decoderWorkerInit,()=>{this.loaded=!0,e()}):Ct(this._opt)?e():(this.decoderWorker=new Hi(this),this.once(E.decoderWorkerInit,()=>{this.loaded=!0,e()})))})}play(i,r){return new Promise((e,t)=>{if(!i&&!this._opt.url)return t("url is empty");this.loading=!0,this.playing=!1,this._times.playInitStart=A(),i=i||this._opt.url,this._opt.url=i,this.clearCheckHeartTimeout(),this.init().then(()=>{this._times.playStart=A(),this._opt.isNotMute&&this.mute(!1),this.webcodecsDecoder&&this.webcodecsDecoder.once(m.webcodecsH265NotSupport,()=>{this.emitError(m.webcodecsH265NotSupport)}),this.mseDecoder&&(this.mseDecoder.once(m.mediaSourceH265NotSupport,()=>{this.emitError(m.mediaSourceH265NotSupport)}),this.mseDecoder.once(m.mediaSourceFull,()=>{this.emitError(m.mediaSourceFull)}),this.mseDecoder.once(m.mediaSourceAppendBufferError,()=>{this.emitError(m.mediaSourceAppendBufferError)}),this.mseDecoder.once(m.mediaSourceBufferListLarge,()=>{this.emitError(m.mediaSourceBufferListLarge)}),this.mseDecoder.once(m.mediaSourceAppendBufferEndTimeout,()=>{this.emitError(m.mediaSourceAppendBufferEndTimeout)}),this.mseDecoder.once(m.mediaSourceDecoderConfigurationError,()=>{this.emitError(m.mediaSourceDecoderConfigurationError)}),this.mseDecoder.once(m.mediaSourceTsIsMaxDiff,()=>{this.emitError(m.mediaSourceTsIsMaxDiff)})),this.enableWakeLock(),this.checkLoadingTimeout(),this.stream?(this.stream.once(m.fetchError,e=>{this.emitError(m.fetchError,e)}),this.stream.once(m.websocketError,e=>{this.emitError(m.websocketError,e)}),this.stream.once(E.streamEnd,()=>{this.emit(E.streamEnd)}),this.stream.once(m.hlsError,e=>{this.emitError(m.hlsError,e)}),this.stream.once(m.webrtcError,e=>{this.emitError(m.webrtcError,e)}),this.stream.once(E.streamSuccess,()=>{e(),this._times.streamResponse=A(),this.video&&this.video.play(),this.checkStatsInterval(),this.isPlayback()&&this.playback&&this.playback.startCheckStatsInterval()}),this.stream.fetchStream(i,r)):this.debug.warn("player","play() this.stream is null")}).catch(e=>{t(e)})})}close(){return new Promise((e,t)=>{this._close().then(()=>{this.video&&this.video.clearView(),e()}).catch(e=>{t(e)})})}resumeAudioAfterPause(){this.lastVolume&&(this.volume=this.lastVolume)}_close(){return new Promise((e,t)=>{const i=()=>{this.stream&&(this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.hlsDecoder&&(this.hlsDecoder.destroy(),this.hlsDecoder=null),this.webrtc&&(this.webrtc.destroy(),this.webrtc=null),this.audio&&(this.audio.destroy(),this.audio=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.isPlayback()&&this.playback&&this.playback.clearStatsInterval(),this.loading=!1,this.recording=!1,this.zooming=!1,this.playing=!1,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""}};this.decoderWorker?this.decoderWorker.destroy().then(()=>{this.decoderWorker=null,i(),setTimeout(()=>{e()},0)}).catch(e=>{this.debug&&this.debug.error("player","close() decoderWorker.destroy() error",e),t()}):(i(),setTimeout(()=>{e()},0))})}pause(){let i=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return new Promise((e,t)=>{i?this.close().then(()=>{e()}).catch(e=>{t(e)}):this._close().then(()=>{e()}).catch(e=>{t(e)})})}isAudioMute(){let e=!0;return e=this.audio?this.audio.isMute:e}isAudioNotMute(){return!this.isAudioMute()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video&&this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}stopRecordAndSave(e,r){return new Promise((t,i)=>{this.recorder||i("recorder is null"),this.recording?(this._opt.useWasm&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0}),this.recorder.stopRecordAndSave(e,r).then(e=>{t(e)}).catch(e=>{i(e)})):i("recorder is not recording")})}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach(e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(t=!0)}),(this._opt.showBandwidth||t)&&(e=!0),e=this._isPlayback()&&this._opt.playbackConfig.showControl?!0:e}_isPlayback(){return this._opt.playType===v}useWasmDecode(){return k(this._opt.useMSE)&&k(this._opt.useWCS)}canVideoTrackWritter(){var e=this._opt;return k(e.isHls)&&k(e.isWebrtc)&&k(e.useMSE)&&(e.useWCS&&k(e.useOffscreen)&&e.wcsUseVideoRender||this.useWasmDecode())}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}checkHeartTimeout(){this._checkHeartTimeout=setTimeout(()=>{k(this.playbackPause)&&this.playing?this.isDestroyed()?this.debug&&this.debug.warn("player","checkHeartTimeout but player is destroyed"):0!==this._stats.fps?this.debug&&this.debug.warn("player","checkHeartTimeout but fps is "+this._stats.fps):k(this.visibility)&&0!==this._stats.vbps?this.debug&&this.debug.warn("player","checkHeartTimeout but page is not visibility and vbps is "+this._stats.vbps):(this.debug.warn("player",`checkHeartTimeout and
  385. pause and emit delayTimeout event and
  386. current vbps is ${this._stats.vbps} and
  387. current fps is ${this._stats.fps} and
  388. current visibility is ${this.visibility} and`),this.emit(E.timeout,E.delayTimeout),this.emit(E.delayTimeout)):this.debug.warn("player",`playbackPause is ${this.playbackPause}, playing is `+this.playing)},1e3*this._opt.heartTimeout)}checkHeartTimeout$2(){var e;k(this.playbackPause)&&this.playing?this.isDestroyed()?this.debug&&this.debug.warn("player","checkHeartTimeout$2 but player is destroyed"):k(this.isHistoryFpsListAllZero())?this.debug&&this.debug.warn("player","checkHeartTimeout$2 but fps is not all zero"):0!==this._stats.fps?this.debug&&this.debug.warn("player","checkHeartTimeout$2 but fps is "+this._stats.fps):k(this.visibility)&&0!==this._stats.vbps?this.debug&&this.debug.warn("player","checkHeartTimeout$2 but page is not visibility and vbps is "+this._stats.vbps):(e=this._historyFpsList.join(","),this.debug.warn("player",`checkHeartTimeout$2 and
  389. pause and emit delayTimeout event and
  390. current vbps is ${this._stats.vbps} and
  391. current fps is ${this._stats.fps} and
  392. history FpsList is ${e} and
  393. current visibility is ${this.visibility} and`),this.emit(E.timeout,E.delayTimeout),this.emit(E.delayTimeout)):this.debug.log("player",`checkHeartTimeout$2 playbackPause is ${this.playbackPause}, playing is `+this.playing)}checkStatsInterval(){this._checkStatsInterval=setInterval(()=>{this.updateStats()},1e3)}clearCheckHeartTimeout(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout(()=>{this.playing?this.debug.warn("player",`checkLoadingTimeout but loading is ${this.loading} and playing is `+this.playing):this.isDestroyed()?this.debug&&this.debug.warn("player","checkLoadingTimeout but player is destroyed"):(this.debug.warn("player","checkLoadingTimeout and pause and emit loadingTimeout event"),this.emit(E.timeout,E.loadingTimeout),this.emit(E.loadingTimeout))},1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(this.debug.log("player","clearCheckLoadingTimeout"),clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.isDestroyed()?this.debug&&this.debug.warn("player","handleRender but player is destroyed"):(this.loading&&(this.clearCheckLoadingTimeout(),this.emit(E.start),this.loading=!1),this.playing||(this.playing=!0))}updateStats(){var p=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this._startBpsTime||(this._startBpsTime=A()),c(p.ts)&&(this._stats.ts=p.ts,null===this._playingStartTimestamp)&&0<p.ts&&(this._playingStartTimestamp=p.ts),c(p.dts)&&(this._stats.dts=p.dts),c(p.mseTs)&&(this._stats.mseTs=p.mseTs),c(p.buf)&&(this._stats.buf=p.buf),c(p.netBuf)&&(this._stats.netBuf=p.netBuf),p.fps&&(this._stats.fps+=1),p.dfps&&(this._stats.dfps+=1),p.abps&&(this._stats.abps+=p.abps),p.vbps&&(this._stats.vbps+=p.vbps),p.workerStats&&(this._tempWorkerStats=p.workerStats);const f=A();if(!(f-this._startBpsTime<1e3)){null!==this._playingStartTimestamp&&0<this._stats.fps&&(this._stats.pTs+=1);let e=0,t=0,i=0,r=(this._opt.useMSE&&this.mseDecoder&&(e=this.mseDecoder.checkSourceBufferDelay(),e=parseInt(1e3*e,10),t=this.mseDecoder.getDecodeDiffTimes(),i=this.mseDecoder.getDecodePlaybackRate()),this._opt.useWCS&&this.webcodecsDecoder&&(t=this.webcodecsDecoder.getDecodeDiffTimes()),this._opt.isHls&&this.hlsDecoder&&(e=this.hlsDecoder.checkHlsBufferedDelay(),e=parseInt(1e3*e,10),i=this.hlsDecoder.getDecodePlaybackRate()),0),s=0,a=0,n=!1,o=!1,l=0,c=(this.demux&&(n=this.demux.isDropping()),this._opt.useWasm?this._tempWorkerStats&&(s=this._tempWorkerStats.demuxBufferDelay,a=this._tempWorkerStats.audioDemuxBufferDelay,r=this._tempWorkerStats.flvBufferByteLength,this._stats.netBuf=this._tempWorkerStats.netBuf,n=this._tempWorkerStats.isDropping,l=this._tempWorkerStats.pushLatestDelay,o=this._tempWorkerStats.isStreamTsMoreThanLocal):this.demux&&(r=this.demux.getInputByteLength(),l=this.demux.getPushLatestDelay(),o=this.demux.getIsStreamTsMoreThanLocal(),this.demux.bufferList)&&(s=this.demux.bufferList.length),0),d=0,u=(this.audio&&this.audio.bufferList&&(c=this.audio.bufferList.length,d=c*this.audio.oneBufferDuration),0),h=0;if(this.isPlayback()&&this.video){this._opt.playbackConfig.isUseFpsRender&&(u=this.video.bufferList&&this.video.bufferList.length||0);p=this.video.getStreamFps();const f=0<p?1e3/p:0;h=parseInt(f*u+f*s,10)}var p=this._stats.dts-this._stats.ts,g=p+this._stats.netBuf;this._opt.isHls&&(this._stats.fps=this.hlsDecoder.getFps()),this._stats.fps>this._stats.maxFps&&(this._stats.maxFps=this._stats.fps),this._allStatsData=Object.assign(this._stats,{audioBuffer:c,audioBufferDelayTs:d,audioTs:this.audioTimestamp,playbackVideoBuffer:u,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:h,demuxBuffer:s,pushLatestDelay:l,audioDemuxBuffer:a,flvBuffer:r,mseDelay:e,mseDecodeDiffTimes:t,mseDecodePlaybackRate:i,wcsDecodeDiffTimes:t,hlsDelay:e,hlsDecodePlaybackRate:i,delayTs:p,totalDelayTs:g,isDropping:n,isStreamTsMoreThanLocal:o}),this.emit(E.stats,this._allStatsData),1048576<this._allStatsData.flvBuffer&&this.emit(m.flvDemuxBufferSizeTooLarge,this._allStatsData.flvBuffer),this._opt.hasVideo&&this.emit(E.performance,function(e){let t=0;return 24<=e?t=2:15<=e&&(t=1),t}(this._stats.fps)),this.updateHistoryFpsList(this._stats.fps),this._stats.fps=0,this._stats.dfps=0,this._stats.abps=0,this._stats.vbps=0,this._startBpsTime=f}}resetStats(){this._startBpsTime=null,this._playingStartTimestamp=null,this._historyFpsList=[],this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,pTs:0,dts:0},this._allStatsData={}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}clearBufferDelay(){this._opt.useWasm?this.decoderWorker&&this.decoderWorker.clearWorkBuffer(!0):this.demux&&this.demux.clearBuffer(!0)}doDestroy(){this.emit(E.beforeDestroy)}handlePlayToRenderTimes(){var e=this.getPlayToRenderTimes();this.emit(E.playToRenderTimes,e)}getPlayToRenderTimes(){var e=this._times;return e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart,e.demuxTimestamp=e.demuxStart-e.streamResponse,e.decodeTimestamp=e.decodeStart-e.demuxStart,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,e}getOption(){return this._opt}isPlayer(){return this._opt.playType===n}isPlayback(){return this._opt.playType===v}isDemuxSetCodecInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=this.webcodecsDecoder.hasInit:t.useMSE&&(e=this.mseDecoder.hasInit),e}isDemuxDecodeFirstIIframeInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.isDecodeFirstIIframe:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.isDecodeFirstIIframe),e}isAudioPlaybackRateSpeed(){let e=!1;return e=this.audio?this.audio.isPlaybackRateSpeed():e}getPlayingTimestamp(){return this._stats.pTs}getRecordingType(){let e=null;return e=this.recorder?this.recorder.getType():e}getRecordingByteLength(){let e=0;return e=this.recording?this.recorder.getToTalByteLength():e}getRecordingDuration(){let e=0;return e=this.recording?this.recorder.getTotalDuration():e}getDecodeType(){let e="";var t=this.getOption();return t.useMSE&&(e+="mse "),t.useWCS&&(e+="wcs "),t.useWasm&&(e+="wasm ",t.useSIMD)&&(e+="simd "),t.useOffscreen&&(e+="offscreen "),e}getDemuxType(){return this.getOption().demuxType}getRenderType(){let e="";return e=this.video?this.video.getType():e}getCanvasRenderType(){let e="";return e=this.video?this.video.getCanvasType():e}getAudioEngineType(){let e="";return e=this.audio?this.audio.getEngineType():e}getStreamType(){let e="";return e=this.stream?this.stream.getStreamType():e}getAllStatsData(){return this._allStatsData}togglePerformancePanel(e){this.updateOption({showPerformance:e}),this.emit(E.togglePerformancePanel,e)}setScaleMode(e){var t={isFullResize:!1,isResize:!1};switch(e=Number(e)){case 0:t.isFullResize=!1,t.isResize=!1;break;case 1:t.isFullResize=!1,t.isResize=!0;break;case 2:t.isFullResize=!0,t.isResize=!0}this.updateOption(t),this.resize(),this.emit(E.viewResizeChange,e)}startVisibilityHiddenTimeout(){this.clearVisibilityHiddenTimeout(),0<this._opt.pageVisibilityHiddenTimeout&&(this.visibilityHiddenTimeout=setTimeout(()=>{this.emit(E.visibilityHiddenTimeout)},1e3*this._opt.pageVisibilityHiddenTimeout))}clearVisibilityHiddenTimeout(){this._checkVisibleHiddenTimeout&&(clearTimeout(this._checkVisibleHiddenTimeout),this._checkVisibleHiddenTimeout=null)}faceDetect(e){this.faceDetectActive=e}objectDetect(e){this.objectDetectActive=e}downloadNakedFlowFile(){this.demux&&this.demux.downloadNakedFlowFile&&this.demux.downloadNakedFlowFile()}hasCacheOnGopBuffer(){var e=this.videoIframeIntervalTs,t=this._allStatsData.demuxBuffer,i=this._allStatsData.maxFps;let r=e&&t&&i?e<1e3/i*t:!1;return r}addContentToCanvas(){this.video&&this.video.addContentToCanvas(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[])}sendWebsocketMessage(e){var t=this.getStreamType();t===F||t===j+" "+F?this.stream.sendMessage(e):this.debug.warn("player","sendWebsocketMessage: stream type is not websocket, current stream type is "+this.getStreamType())}checkIsInRender(){var e=this._stats;return 0<e.vbps&&0<e.fps}setControlHtml(e){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML=e)}clearControlHtml(){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML="")}updateWatermark(e){this.singleWatermark&&this.singleWatermark.update(e)}removeWatermark(){this.singleWatermark&&this.singleWatermark.remove()}getVideoInfo(){let e=null;return e=this.video?this.video.getVideoInfo():e}getAudioInfo(){let e=null;return e=this.audio?this.audio.getAudioInfo():e}getVideoPlaybackQuality(){let e=null;return e=this.video?this.video.getPlaybackQuality():e}emitError(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";this.emit(E.error,e,t),this.emit(e,t)}updateHistoryFpsList(e){this._historyFpsList.length>this._opt.heartTimeout&&this._historyFpsList.shift(),this._historyFpsList.push(e),this.isHistoryFpsListAllZero()&&this.checkHeartTimeout$2()}isHistoryFpsListAllZero(){let t=!0;if(t=this._historyFpsList.length<this._opt.heartTimeout?!1:t)for(let e=0;e<this._historyFpsList.length;e++)if(0<this._historyFpsList[e]){t=!1;break}return t}isUseHls265(){return S(this._opt.isHls)&&S(this._opt.supportHls265)}isOldHls(){return S(this._opt.isHls)&&k(this._opt.supportHls265)}}class As{constructor(e){var{fromSampleRate:e,toSampleRate:t,channels:i,inputBufferSize:r}=e;if(!e||!t||!i)throw new Error("Invalid settings specified for the resampler.");this.resampler=null,this.fromSampleRate=e,this.toSampleRate=t,this.channels=i||0,this.inputBufferSize=r,this.initialize()}initialize(){this.fromSampleRate==this.toSampleRate?(this.resampler=e=>e,this.ratioWeight=1):(this.fromSampleRate<this.toSampleRate?(this.linearInterpolation(),this.lastWeight=1):(this.multiTap(),this.tailExists=!1,this.lastWeight=0),this.initializeBuffers(),this.ratioWeight=this.fromSampleRate/this.toSampleRate)}bufferSlice(t){try{return this.outputBuffer.subarray(0,t)}catch(e){try{return this.outputBuffer.length=t,this.outputBuffer}catch(e){return this.outputBuffer.slice(0,t)}}}initializeBuffers(){this.outputBufferSize=Math.ceil(this.inputBufferSize*this.toSampleRate/this.fromSampleRate/this.channels*1.0000004768371582)+this.channels+this.channels;try{this.outputBuffer=new Float32Array(this.outputBufferSize),this.lastOutput=new Float32Array(this.channels)}catch(e){this.outputBuffer=[],this.lastOutput=[]}}linearInterpolation(){this.resampler=e=>{let t,i,r,s,a,n,o,l,c,d=e.length,u=this.channels;if(d%u!=0)throw new Error("Buffer was of incorrect sample length.");if(d<=0)return[];for(t=this.outputBufferSize,i=this.ratioWeight,r=this.lastWeight,s=0,a=0,n=0,o=0,l=this.outputBuffer;r<1;r+=i)for(a=r%1,s=1-a,this.lastWeight=r%1,c=0;c<this.channels;++c)l[o++]=this.lastOutput[c]*s+e[c]*a;for(--r,d-=u,n=Math.floor(r)*u;o<t&&n<d;){for(a=r%1,s=1-a,c=0;c<this.channels;++c)l[o++]=e[n+(0<c?c:0)]*s+e[n+(u+c)]*a;r+=i,n=Math.floor(r)*u}for(c=0;c<u;++c)this.lastOutput[c]=e[n++];return this.bufferSlice(o)}}multiTap(){this.resampler=e=>{let t,i,r,s,a,n,o,l,c,d,u,h=e.length,p=this.channels;if(h%p!=0)throw new Error("Buffer was of incorrect sample length.");if(h<=0)return[];for(t=this.outputBufferSize,i=[],r=this.ratioWeight,s=0,n=0,l=!this.tailExists,this.tailExists=!1,c=this.outputBuffer,d=0,u=0,a=0;a<p;++a)i[a]=0;do{if(l)for(s=r,a=0;a<p;++a)i[a]=0;else{for(s=this.lastWeight,a=0;a<p;++a)i[a]=this.lastOutput[a];l=!0}for(;0<s&&n<h;){if(o=1+n-u,!(s>=o)){for(a=0;a<p;++a)i[a]+=e[n+(0<a?a:0)]*s;u+=s,s=0;break}for(a=0;a<p;++a)i[a]+=e[n++]*o;u=n,s-=o}if(0!==s){for(this.lastWeight=s,a=0;a<p;++a)this.lastOutput[a]=i[a];this.tailExists=!0;break}for(a=0;a<p;++a)c[d++]=i[a]/r}while(n<h&&d<t);return this.bufferSlice(d)}}resample(e){return this.fromSampleRate==this.toSampleRate?this.ratioWeight=1:(this.fromSampleRate<this.toSampleRate?this.lastWeight=1:(this.tailExists=!1,this.lastWeight=0),this.initializeBuffers(),this.ratioWeight=this.fromSampleRate/this.toSampleRate),this.resampler(e)}}const ys=[255,511,1023,2047,4095,8191,16383,32767];function bs(t,i,r){for(let e=0;e<r;e++)if(t<=i[e])return e;return r}class vs extends e{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=(super(),e&&(this.player=e),this.tag="talk",It(Ne));this._opt=Object.assign({},e,t),this._opt.sampleRate=parseInt(this._opt.sampleRate,10),this._opt.sampleBitsWidth=parseInt(this._opt.sampleBitsWidth,10),this.audioContext=null,this.gainNode=null,this.recorder=null,this.workletRecorder=null,this.biquadFilter=null,this.userMediaStream=null,this.bufferSize=512,this._opt.audioBufferLength=this.calcAudioBufferLength(),this.audioBufferList=[],this.socket=null,this.socketStatus=le,this.mediaStreamSource=null,this.heartInterval=null,this.checkGetUserMediaTimeout=null,this.wsUrl=null,this.startTimestamp=0,this.sequenceId=0,this.tempTimestamp=null,this.tempRtpBufferList=[],this.events=new Ft(this),this._initTalk(),this.player||(this.debug=new Ke(this)),this.log(this.tag,"init",this._opt)}destroy(){this.userMediaStream&&(this.userMediaStream.getTracks&&this.userMediaStream.getTracks().forEach(e=>{e.stop()}),this.userMediaStream=null),this.mediaStreamSource&&(this.mediaStreamSource.disconnect(),this.mediaStreamSource=null),this.recorder&&(this.recorder.disconnect(),this.recorder.onaudioprocess=null),this.biquadFilter&&(this.biquadFilter.disconnect(),this.biquadFilter=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.workletRecorder&&(this.workletRecorder.disconnect(),this.workletRecorder=null),this.socket&&(this.socketStatus===ce&&this._sendClose(),this.socket.close(),this.socket=null),this._stopHeartInterval(),this._stopCheckGetUserMediaTimeout(),this.audioContext=null,this.gainNode=null,this.recorder=null,this.audioBufferList=[],this.sequenceId=0,this.wsUrl=null,this.tempTimestamp=null,this.tempRtpBufferList=[],this.startTimestamp=0,this.log("talk","destroy")}addRtpToBuffer(e){var t=e.length+this.tempRtpBufferList.length,t=new Uint8Array(t);t.set(this.tempRtpBufferList,0),t.set(e,this.tempRtpBufferList.length),this.tempRtpBufferList=t}downloadRtpFile(){var e=new Blob([this.tempRtpBufferList]);try{var t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".rtp",t.click()}catch(e){console.error("downloadRtpFile",e)}}calcAudioBufferLength(){var e=this._opt["sampleRate"];return 8*e*.02/8}get socketStatusOpen(){return this.socketStatus===ce}log(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._log("log",...t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._log("warn",...t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._log("error",...t)}_log(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];(this.player?this.player.debug:this.debug||console)[e](...i)}_getSequenceId(){return++this.sequenceId}_createWebSocket(){return new Promise((e,t)=>{var i=this.events.proxy;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer",this.emit(E.talkStreamStart),i(this.socket,"open",()=>{this.socketStatus=ce,this.log(this.tag,"websocket open -> do talk"),this.emit(E.talkStreamOpen),e(),this._doTalk()}),i(this.socket,"message",e=>{this.log(this.tag,"websocket message",e.data)}),i(this.socket,"close",e=>{this.socketStatus="close",this.log(this.tag,"websocket close"),this.emit(E.talkStreamClose),t(e)}),i(this.socket,"error",e=>{this.socketStatus="error",this.error(this.tag,"websocket error",e),this.emit(E.talkStreamError,e),t(e)})})}_sendClose(){}_initTalk(){this._initMethods(),this._opt.engine===Ue?this._initWorklet():"script"===this._opt.engine&&this._initScriptProcessor(),this.log(this.tag,"audioContext samplerate",this.audioContext.sampleRate)}_initMethods(){this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.biquadFilter=this.audioContext.createBiquadFilter(),this.biquadFilter.type="lowpass",this.biquadFilter.frequency.value=3e3,this.resampler=new As({fromSampleRate:this.audioContext.sampleRate,toSampleRate:this._opt.sampleRate,channels:this._opt.numberChannels,inputBufferSize:this.bufferSize})}_initScriptProcessor(){var e=this.audioContext.createScriptProcessor||this.audioContext.createJavaScriptNode;this.recorder=e.apply(this.audioContext,[this.bufferSize,this._opt.numberChannels,this._opt.numberChannels]),this.recorder.onaudioprocess=e=>this._onaudioprocess(e)}_initWorklet(){this.audioContext.audioWorklet.addModule(Rt(function(){class e extends AudioWorkletProcessor{constructor(e){super(),this._cursor=0,this._bufferSize=e.processorOptions.bufferSize,this._buffer=new Float32Array(this._bufferSize)}process(t,e,i){if(t.length&&t[0].length)for(let e=0;e<t[0][0].length;e++)this._cursor+=1,this._cursor===this._bufferSize&&(this._cursor=0,this.port.postMessage({eventType:"data",buffer:this._buffer})),this._buffer[this._cursor]=t[0][0][e];return!0}}registerProcessor("talk-processor",e)})).then(()=>{var e=new AudioWorkletNode(this.audioContext,"talk-processor",{processorOptions:{bufferSize:this.bufferSize}});e.connect(this.gainNode),e.port.onmessage=e=>{"data"===e.data.eventType&&this._encodeAudioData(e.data.buffer)},this.workletRecorder=e})}_onaudioprocess(e){e=e.inputBuffer.getChannelData(0);this._encodeAudioData(new Float32Array(e))}_encodeAudioData(e){if(0===e[0]&&0===e[1])this.log(this.tag,"empty audio data");else{const r=this.resampler.resample(e);let t=r;if(16===this._opt.sampleBitsWidth?t=function(e){let t=e.length,i=new Int16Array(t);for(;t--;){var r=Math.max(-1,Math.min(1,e[t]));i[t]=r<0?32768*r:32767*r}return i}(r):8===this._opt.sampleBitsWidth&&(t=function(e){let t=e.length,i=new Int8Array(t);for(;t--;){var r=Math.max(-1,Math.min(1,e[t]));i[t]=parseInt(255/(65535/(32768+(r<0?32768*r:32767*r))),10)}return i}(r)),null!==t.buffer){let e=null;this._opt.encType===Le?e=function(e){const i=[];return Array.prototype.slice.call(e).forEach((e,t)=>{i[t]=function(e){let t,i,r;return 0<=e?t=213:(t=85,(e=-e-1)<0&&(e=32767)),8<=(i=bs(e,ys,8))?127^t:(r=i<<4,(r|=i<2?e>>4&15:e>>i+3&15)^t)}(e)}),i}(t):this._opt.encType===xe&&(e=function(e){const i=[];return Array.prototype.slice.call(e).forEach((e,t)=>{i[t]=function(e){let t=0;t=e<0?(e=132-e,127):(e+=132,255);var i=bs(e,ys,8);return 8<=i?127^t:(i<<4|e>>i+3&15)^t}(e)}),i}(t));const r=Uint8Array.from(e);for(let e=0;e<r.length;e++){var i=this.audioBufferList.length;this.audioBufferList[+i]=r[e],this.audioBufferList.length===this._opt.audioBufferLength&&(this._sendTalkMsg(new Uint8Array(this.audioBufferList)),this.audioBufferList=[])}}}}_parseAudioMsg(e){let t=null;return"rtp"!==this._opt.packetType||this._opt.encType!==Le&&this._opt.encType!==xe?"opus"===this._opt.packetType?t=this.opusPacket(e):"empty"===this._opt.packetType&&(t=e):t=this.rtpPacket(e),t}rtpPacket(e){var t=[];let i=0,r,s;var a=this._opt.rtpSsrc,n=e.length,n=(this._opt.encType===Le?i=8:this._opt.encType===xe&&(i=0),this.startTimestamp||(this.startTimestamp=A()),s=A()-this.startTimestamp,r=this._getSequenceId(),n+12),o=(t[0]=255&n>>8,t[1]=255&n>>0,t[2]=128,t[3]=128+i,t[4]=r/256,t[5]=r%256,t[6]=s/65536/256,t[7]=s/65536%256,t[8]=s%65536/256,t[9]=s%65536%256,t[10]=a/65536/256,t[11]=a/65536%256,t[12]=a%65536/256,t[13]=a%65536%256,t.concat([...e])),l=new Uint8Array(o.length);for(let e=0;e<o.length;e++)l[e]=o[e];return l}opusPacket(e){return e}_sendTalkMsg(e){null===this.tempTimestamp&&(this.tempTimestamp=A());var t=A(),i=t-this.tempTimestamp,r=this._parseAudioMsg(e);this.log(this.tag,`'send talk msg and diff is ${i} and byteLength is ${r.byteLength} and length is ${r.length}, and g711 length is `+e.length),"rtp"===this._opt.packetType&&this.addRtpToBuffer(r),r&&(this.socketStatusOpen?this.socket.send(r.buffer):this.emit(m.tallWebsocketClosedByError)),this.tempTimestamp=t}_doTalk(){this._getUserMedia()}_getUserMedia(){this.log(this.tag,"getUserMedia"),void 0===window.navigator.mediaDevices&&(window.navigator.mediaDevices={}),void 0===window.navigator.mediaDevices.getUserMedia&&(this.log(this.tag,"window.navigator.mediaDevices.getUserMedia is undefined and init function"),window.navigator.mediaDevices.getUserMedia=function(i){var r=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return r?new Promise(function(e,t){r.call(navigator,i,e,t)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}),this._opt.checkGetUserMediaTimeout&&this._startCheckGetUserMediaTimeout(),window.navigator.mediaDevices.getUserMedia({audio:{latency:!0,noiseSuppression:!0,autoGainControl:!0,echoCancellation:!0,sampleRate:48e3,channelCount:1},video:!1}).then(e=>{this.log(this.tag,"getUserMedia success"),this.userMediaStream=e,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.mediaStreamSource.connect(this.biquadFilter),this.recorder?(this.biquadFilter.connect(this.recorder),this.recorder.connect(this.gainNode)):this.workletRecorder&&(this.biquadFilter.connect(this.workletRecorder),this.workletRecorder.connect(this.gainNode)),this.gainNode.connect(this.audioContext.destination),this.emit(E.talkGetUserMediaSuccess),null===e.oninactive&&(e.oninactive=e=>{this._handleStreamInactive(e)})}).catch(e=>{this.error(this.tag,"getUserMedia error",e.toString()),this.emit(E.talkGetUserMediaFail,e.toString())}).finally(()=>{this.log(this.tag,"getUserMedia finally"),this._stopCheckGetUserMediaTimeout()})}_getUserMedia2(){this.log(this.tag,"getUserMedia"),navigator.mediaDevices?navigator.mediaDevices.getUserMedia({audio:!0}).then(e=>{this.log(this.tag,"getUserMedia2 success")}):navigator.getUserMedia({audio:!0},this.log(this.tag,"getUserMedia2 success"),this.log(this.tag,"getUserMedia2 fail"))}async _getUserMedia3(){this.log(this.tag,"getUserMedia3");try{var e=await navigator.mediaDevices.getUserMedia({audio:{latency:!0,noiseSuppression:!0,autoGainControl:!0,echoCancellation:!0,sampleRate:48e3,channelCount:1},video:!1});console.log("getUserMedia() got stream:",e),this.log(this.tag,"getUserMedia3 success")}catch(e){this.log(this.tag,"getUserMedia3 fail")}}_handleStreamInactive(e){this.userMediaStream&&(this.error(this.tag,"stream oninactive"),this.emit(E.talkStreamInactive))}_startCheckGetUserMediaTimeout(){this._stopCheckGetUserMediaTimeout(),this.checkGetUserMediaTimeout=setTimeout(()=>{this.log(this.tag,"check getUserMedia timeout"),this.emit(E.talkGetUserMediaTimeout)},this._opt.getUserMediaTimeout)}_stopCheckGetUserMediaTimeout(){this.checkGetUserMediaTimeout&&(this.log(this.tag,"stop checkGetUserMediaTimeout"),clearTimeout(this.checkGetUserMediaTimeout),this.checkGetUserMediaTimeout=null)}_startHeartInterval(){this.heartInterval=setInterval(()=>{this.log(this.tag,"heart interval");var e=[35,36,0,0,0,0,0,0],e=new Uint8Array(e);this.socket.send(e.buffer)},15e3)}_stopHeartInterval(){this.heartInterval&&(this.log(this.tag,"stop heart interval"),clearInterval(this.heartInterval),this.heartInterval=null)}startTalk(i){return new Promise((e,t)=>function(){let e=!1;var t=window.navigator;return e=t?(e=!(!t.mediaDevices||!t.mediaDevices.getUserMedia))||!!(t.getUserMedia||t.webkitGetUserMedia||t.mozGetUserMedia||t.msGetUserMedia):e}()?(this.wsUrl=i,this._opt.testMicrophone?(this._doTalk(),e()):(this._createWebSocket().catch(e=>{t(e)}),this.once(E.talkGetUserMediaFail,()=>{t("getUserMedia fail")}),void this.once(E.talkGetUserMediaSuccess,()=>{e()}))):t("not support getUserMedia"))}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(e=y(e,0,1),this.gainNode.gain.value=e)}getOption(){return this._opt}get volume(){return this.gainNode?parseFloat(100*this.gainNode.gain.value).toFixed(0):null}}class Es{constructor(e){this.player=e,this.globalSetting=null;e=ot();this.defaultSettings={watermark_id:"JessibucaPro_"+e,watermark_prefix:"JessibucaPro_mask_"+e,watermark_txt:"JessibucaPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null},this.player.debug.log("Watermark","int")}destroy(){this._removeMark(),this.globalSetting=null,this.defaultSettings={watermark_id:"",watermark_prefix:"",watermark_txt:"JessibucaPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null},this.player.debug.log("Watermark","destroy")}remove(){this._removeMark()}load(e){this.globalSetting=e,this._loadMark(e)}resize(){this.globalSetting&&this._loadMark(this.globalSetting)}_loadMark(){var e=this.defaultSettings;if(1===arguments.length&&"object"==typeof arguments[0]){var t,i=arguments[0]||{};for(t in i)i[t]&&e[t]&&i[t]===e[t]||!i[t]&&0!==i[t]||(e[t]=i[t])}var r=document.getElementById(e.watermark_id),s=(r&&r.parentNode&&r.parentNode.removeChild(r),"string"==typeof e.watermark_parent_node?document.getElementById(e.watermark_parent_node):e.watermark_parent_node),r=s||document.body,a=r.getBoundingClientRect(),n=Math.max(r.scrollWidth,r.clientWidth,a.width),o=Math.max(r.scrollHeight,r.clientHeight,a.height),a=arguments[0]||{},a=((a.watermark_parent_width||a.watermark_parent_height)&&r&&(e.watermark_x=e.watermark_x+0,e.watermark_y=e.watermark_y+0),document.getElementById(e.watermark_id)),l=null;a?a.shadowRoot&&(l=a.shadowRoot):((a=document.createElement("div")).id=e.watermark_id,a.setAttribute("style","pointer-events: none !important; display: block !important"),l="function"==typeof a.attachShadow?a.attachShadow({mode:"open"}):a,(d=r.children)[u=Math.floor(Math.random()*(d.length-1))]?r.insertBefore(a,d[u]):r.appendChild(a)),e.watermark_cols=parseInt((n-e.watermark_x)/(e.watermark_width+e.watermark_x_space));var c,d=parseInt((n-e.watermark_x-e.watermark_width*e.watermark_cols)/e.watermark_cols);e.watermark_x_space=d&&e.watermark_x_space,e.watermark_rows=parseInt((o-e.watermark_y)/(e.watermark_height+e.watermark_y_space));var u=parseInt((o-e.watermark_y-e.watermark_height*e.watermark_rows)/e.watermark_rows);e.watermark_y_space=u&&e.watermark_y_space;for(var h=s?(c=e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)):(c=0+e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),0+e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)),p=0;p<e.watermark_rows;p++)for(var f=s?0+e.watermark_y+(o-h)/2+(e.watermark_y_space+e.watermark_height)*p:e.watermark_y+(o-h)/2+(e.watermark_y_space+e.watermark_height)*p,g=0;g<e.watermark_cols;g++){var m=s?0+e.watermark_x+(n-c)/2+(e.watermark_width+e.watermark_x_space)*g:e.watermark_x+(n-c)/2+(e.watermark_width+e.watermark_x_space)*g,A=document.createElement("div"),y=document.createTextNode(e.watermark_txt);A.appendChild(y),A.id=e.watermark_prefix+p+g,A.style.webkitTransform="rotate(-"+e.watermark_angle+"deg)",A.style.MozTransform="rotate(-"+e.watermark_angle+"deg)",A.style.msTransform="rotate(-"+e.watermark_angle+"deg)",A.style.OTransform="rotate(-"+e.watermark_angle+"deg)",A.style.transform="rotate(-"+e.watermark_angle+"deg)",A.style.visibility="",A.style.position="absolute",A.style.left=m+"px",A.style.top=f+"px",A.style.overflow="hidden",A.style.zIndex="9999999",A.style.opacity=e.watermark_alpha,A.style.fontSize=e.watermark_fontsize,A.style.fontFamily=e.watermark_font,A.style.color=e.watermark_color,A.style.textAlign="center",A.style.width=e.watermark_width+"px",A.style.height=e.watermark_height+"px",A.style.display="block",A.style["-ms-user-select"]="none",l.appendChild(A)}}_removeMark(){var e,t=this.defaultSettings,t=document.getElementById(t.watermark_id);t&&(e=t.parentNode)&&e.removeChild(t)}}class ws extends e{_opt={};constructor(){let t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};super(),Object.keys(t).forEach(e=>{if(void 0===t[e])throw new Error(`JbPro option "${e}" can not be undefined`)});var e,i,r=Pt(),r=Object.assign({},r,t);r.url="",r.isMulti&&(r.debugUuid="xxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),this.debug=new Ke(this);let s=t.container;if(!(s="string"==typeof t.container?document.querySelector(t.container):s))throw this.debug.error("JbPro","JbPro need container option and now container is",t.container),new Error("JbPro need container option");if("CANVAS"===s.nodeName||"VIDEO"===s.nodeName)throw this.debug.error("JbPro",`JbPro container type can not be ${s.nodeName} type`),new Error(`JbPro container type can not be ${s.nodeName} type`);if(r.videoBuffer>=r.heartTimeout)throw this.debug.error("JbPro",`JbPro videoBuffer ${r.videoBuffer}s must be less than heartTimeout ${r.heartTimeout}s`),new Error(`JbPro videoBuffer ${r.videoBuffer}s must be less than heartTimeout ${r.heartTimeout}s`);if(this._checkHasCreated(s))throw this.debug.error("JbPro","JbPro container has been created and can not be created again",s),new Error("JbPro container has been created and can not be created again",s);if(s.classList.add("jessibuca-container"),e=s,Q,i=ot(),e&&(e.dataset?e.dataset.jbprov=i:e.setAttribute("data-jbprov",i)),k(r.isLive)){const t=document.createElement("video");t.muted=!0,t.setAttribute("controlsList","nodownload"),t.disablePictureInPicture="disablePictureInPicture",t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.height="100%",t.style.width="100%",s.appendChild(t),this.$videoElement=t,this.$container=s,void(this._opt=r)}else delete r.container,c(r.videoBuffer)&&(r.videoBuffer=1e3*Number(r.videoBuffer)),c(r.videoBufferDelay)&&(r.videoBufferDelay=1e3*Number(r.videoBufferDelay)),c(r.networkDelay)&&(r.networkDelay=1e3*Number(r.networkDelay)),c(r.timeout)&&(pt(r.loadingTimeout)&&(r.loadingTimeout=r.timeout),pt(r.heartTimeout))&&(r.heartTimeout=r.timeout),this._opt=r,this._destroyed=!1,this.$container=s,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.events=new Ft(this),this.watermark=new Es(this),this._initPlayer(s,r),this._initWatermark(),this.debug.log("JbPro",'init success and version is "6-3-2023"'),console.log('JbPro version is "6-3-2023"')}destroy(){return new Promise((e,t)=>{this.debug.log("JbPro","destroy()"),this._destroyed=!0,this.off(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$container.removeChild(this.$videoElement),this.$videoElement=null),this.player?this.player.destroy().then(()=>{this.player=null,this._destroy(),setTimeout(()=>{e()},0)}).catch(()=>{t()}):(this._destroy(),setTimeout(()=>{e()},0))})}_destroy(){var e;this.events&&(this.events.destroy(),this.events=null),this.talk&&(this.talk.destroy(),this.talk=null),this.watermark&&(this.watermark.destroy(),this.watermark=null),this.$container&&(this.$container.classList.remove("jessibuca-container"),e=this.$container,Q,e&&(e.dataset?delete e.dataset.jbprov:e.removeAttribute("data-jbprov")),this.$container=null),this.debug&&this.debug.log("JbPro","destroy end"),this._resetOpt(),this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0}_resetOpt(){this._opt=Pt()}_initPlayer(e,t){this.player=new ms(e,t),this.debug.log("JbPro","_initPlayer",this.player.getOption()),this._bindEvents()}_initTalk(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.talk&&(this.talk.destroy(),this.talk=null),this.player&&(e.debug=this.player._opt.debug),this.talk=new vs(this.player,e),this.debug.log("JbPro","_initTalk",this.talk.getOption()),this._bindTalkEvents()}_resetPlayer(){let r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return new Promise((e,t)=>{const i=()=>{this._opt.url="",this._opt.playOptions={},this._opt=Object.assign(this._opt,r),this._initPlayer(this.$container,this._opt)};this.player?this.player.destroy().then(()=>{this.player=null,i(),e()}):(i(),e())})}_bindEvents(){Object.keys(ne).forEach(t=>{this.player.on(ne[t],e=>{this.emit(t,e)})}),this.player.once(E.beforeDestroy,()=>{this.emit(E.close),this.destroy().then(()=>{}).catch(e=>{})}),this.player.on(E.resize,()=>{this.watermark&&this.watermark.resize(),this.player.singleWatermark&&this.player.singleWatermark.resize()}),this.player.on(E.fullscreen,()=>{this.watermark&&this.watermark.resize(),this.player.singleWatermark&&this.player.singleWatermark.resize()}),this.player.on(E.videoInfo,()=>{this.player.singleWatermark&&this.player.singleWatermark.resize()})}_bindTalkEvents(){Object.keys(oe).forEach(t=>{this.player.on(oe[t],e=>{this.emit(t,e)})})}_initWatermark(){var e;wt(this._opt.fullscreenWatermarkConfig)&&((e=mt(this.$container,this._opt.fullscreenWatermarkConfig)).watermark_txt?this.watermark.load(e):this.debug.warn("JbPro","fullscreenWatermarkConfig text is empty"))}_checkHasCreated(e){return!!e&&(e=e,Q,!!(e?e.dataset?e.dataset.jbprov:e.getAttribute("data-jbprov"):""))}isDestroyed(){return this._destroyed}getOption(){return this.player?this.player.getOption():{}}setDebug(e){this.debug.log("JbPro","setDebug() "+e),this.player?this.player.updateOption({debug:!!e}):this.debug.warn("JbPro","player is not init")}getIsDebug(){let e=!1;return e=this.player?this.player._opt.debug:e}mute(){this.debug.log("JbPro","mute()"),this.player&&this.player.mute(!0)}cancelMute(){this.debug.log("JbPro","cancelMute()"),this.player&&this.player.mute(!1)}setVolume(e){this.debug.log("JbPro","setVolume() "+e),this.player&&(this.player.volume=e)}getVolume(){let e=null;return this.player&&(e=this.player.volume,e=parseFloat(e).toFixed(2)),e}audioResume(){this.debug.log("JbPro","audioResume()"),this.player&&this.player.audio?this.player.audio.audioEnabled(!0):this.debug.warn("JbPro","audioResume error")}setTimeout(e){this.debug.log("JbPro","setTimeout() "+e),e=Number(e),isNaN(e)?this.debug.warn("JbPro",`setTimeout error: ${e} is not a number`):this.player&&this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e})}setScaleMode(e){this.debug.log("JbPro","setScaleMode() "+e),this.player?this.player.setScaleMode(e):this.debug.warn("JbPro","setScaleMode() player is null")}pause(){let e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return new Promise((t,i)=>{if(this.debug.log("JbPro","pause() "+e),this.isDestroyed())return i("JbPro is destroyed");this.player?this.player.pause(e).then(e=>{t(e)}).catch(e=>{i(e)}):i("player is null")})}close(){return new Promise((e,t)=>{this.debug.log("JbPro","close()"),this._opt.url="",this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.player?this.player.close().then(()=>{e()}).catch(e=>{t(e)}):t("player is null")})}clearView(){this.debug.log("JbPro","clearView()"),this.player&&this.player.video?this.getRenderType()===W?this.player.video.clearView():this.debug.warn("JbPro","clearView","render type is video, not support clearView, please use canvas render type"):this.debug.warn("JbPro","clearView","player is null")}play(){let a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise((i,r)=>{if(this.debug.log("JbPro","play() "+a),a||this._opt.url)if(a=a&&(""+a).trim(),k(this._opt.isLive))this.$videoElement.controls="controls",this.$videoElement.muted=!1,this.$videoElement.src=a,this.$videoElement.play(),i(this.$videoElement);else{if(this._opt.isCrypto){var e,t=n.cryptoKey||this._opt.playOptions.cryptoKey,s=n.cryptoIV||this._opt.playOptions.cryptoIV;if(!t||!s)return e=a||this._opt.url,void this._cryptoPlay(e).then(e=>{var{cryptoIV:e,cryptoKey:t}=e;this._opt.playOptions.cryptoKey=t,this._opt.playOptions.cryptoIV=e,n.cryptoIV=e,n.cryptoKey=t,this._playBefore(a,n).then(()=>{i()}).catch(e=>{r(e)})}).catch(e=>{r(e)});this._opt.playOptions.cryptoKey=t,this._opt.playOptions.cryptoIV=s,n.cryptoIV=s,n.cryptoKey=t}this._playBefore(a,n).then(()=>{i()}).catch(e=>{r(e)})}else this.emit(E.error,m.playError),r("url is null and this._opt.url is null")})}_playBefore(i,r){return new Promise((e,t)=>{this.player?i?this._opt.url?i===this._opt.url?this.player.playing?(this.debug.log("JbPro","_playBefore","playing and resolve()"),e()):(this.debug.log("JbPro","_playBefore","pause -> play"),this.player.play(this._opt.url,this._opt.playOptions).then(()=>{e(),this.player.resumeAudioAfterPause()}).catch(e=>{this.debug.error("JbPro","_playBefore this.player.play error",e),this.emit(E.crashLog,this.getCrashLog("this.player.play 1",e)),this.player.pause().then(()=>{t(e)})})):this.player.pause().then(()=>{this._play(i,r).then(()=>{e()}).catch(e=>{this.debug.error("JbPro","_play error",e),this.emit(E.crashLog,this.getCrashLog("this.player.play 2",e)),t(e)})}).catch(e=>{this.debug.error("JbPro","this.player.pause error",e),t(e)}):this._play(i,r).then(()=>{e()}).catch(e=>{this.debug.error("JbPro","_play error",e),this.emit(E.crashLog,this.getCrashLog("this.player.play 3",e)),t(e)}):this.player.play(this._opt.url,this._opt.playOptions).then(()=>{e(),this.player.resumeAudioAfterPause()}).catch(e=>{this.debug.error("JbPro","this.player.play error",e),this.emit(E.crashLog,this.getCrashLog("this.player.play 4",e)),this.player.pause().then(()=>{t(e)})}):i?this._play(i,r).then(()=>{e()}).catch(e=>{this.debug.error("JbPro","_play error",e),this.emit(E.crashLog,this.getCrashLog("this.player.play 5",e)),t(e)}):this._play(this._opt.url,this._opt.playOptions).then(()=>{e()}).catch(e=>{this.debug.error("JbPro","_play error",e),this.emit(E.crashLog,this.getCrashLog("this.player.play 6",e)),t(e)})})}_cryptoPlay(n){return new Promise((r,s)=>{var e,t=function(){var e=(n||document.location.toString()).split("//"),t=e[1].indexOf("/");let i=e[1].substring(t);return i=-1!=i.indexOf("?")?i.split("?")[0]:i}();let i=this._opt.cryptoKeyUrl,a="";if(i)a=i;else{const r=function(e){var t=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");let r=e;return t&&(i.setAttribute("href",r),r=i.href),i.setAttribute("href",r),{origin:i.origin,href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}(n);i=r.origin+"/crypto/",a=i+"?stream="+t}e=a,new Promise((t,i)=>{h.get(e).then(e=>{t(e)}).catch(e=>{i(e)})}).then(e=>{if(e){const t=e.split("."),i=xt(t[0]),a=xt(t[1]);a&&i?r({cryptoIV:a,cryptoKey:i}):s("get cryptoIV or cryptoKey error")}else s(`cryptoKeyUrl: getM7SCryptoStreamKey ${a} res is null`)}).catch(e=>{s(e)})})}playback(r){let s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise((e,t)=>{if(this.debug.log("JbPro","playback() "+r),k(this._opt.isLive))return t("this._opt.isLive is false, can not playback");var i=Bt(),i=Object.assign({},i.playbackConfig,this._opt.playbackConfig,s);i.isUseFpsRender||i.isCacheBeforeDecodeForFpsRender&&(i.isCacheBeforeDecodeForFpsRender=!1,this.debug.warn("JbPro","playbackConfig.isUseFpsRender is false, isCacheBeforeDecodeForFpsRender can not be ture, isCacheBeforeDecodeForFpsRender is set to false")),0===i.rateConfig.length&&i.showRateBtn&&(i.showRateBtn=!1,this.debug.warn("JbPro","playbackConfig.rateConfig.length is 0, showRateBtn can not be ture, showRateBtn is set to false")),this._resetPlayer({videoBuffer:0,playbackConfig:i,playType:v,openWebglAlignment:!0,useMSE:!1,useWCS:!1,useSIMD:!0}).then(()=>{this.play(r).then(()=>{e()}).catch(e=>{t(e)})}).catch(e=>{t(e)})})}playbackPause(){let i=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return this.debug.log("JbPro","playbackPause() "+i),this._opt.playType===n?Promise.reject("playType is player, can not call playbackPause method"):new Promise((e,t)=>{if(!this.player)return t("player is null");S(i)?this.pause().then(()=>{e()}).catch(e=>{t(e)}):(this.player.playbackPause=!0,e())})}playbackResume(){return this.debug.log("JbPro","playbackResume()"),this._opt.playType===n?Promise.reject("playType is player, can not call playbackResume method"):new Promise((e,t)=>{if(!this.player)return t();this.player.playbackPause=!1,e()})}forward(i){return this.debug.log("JbPro","forward() "+i),k(this._opt.isLive)||this._opt.playType===n?Promise.reject("forward() method only just for playback type"):d(Number(i))?new Promise((e,t)=>{(this.player&&this.player.playing?(i=y(Number(i),.1,32),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"playbackRate",value:i}),this.player.playback.setRate(i),this.player.video&&this.player.video.setRate(i),this.player.audio&&this.player.audio.setRate(i),e):t)()}):Promise.reject(`forward() params "rate": ${i} must be number type`)}playbackForward(e){return this.forward(e)}normal(){return this.forward(1)}playbackNormal(){return this.normal()}updatePlaybackForwardMaxRateDecodeIFrame(e){this.debug.log("JbPro","updatePlaybackForwardMaxRateDecodeIFrame() "+e),e=Number(e),e=y(e=parseInt(e,10),1,8),this._opt.playbackForwardMaxRateDecodeIFrame=e,this.player?(this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e}),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"playbackForwardMaxRateDecodeIFrame",value:e})):this.debug.warn("JbPro","updatePlaybackForwardMaxRateDecodeIFrame() player is null")}setPlaybackStartTime(e){this.debug.log("JbPro","setPlaybackStartTime() "+e);var t=Et(e);this.player?this.player.isPlayback()?t<10&&0!==e?this.debug.warn("JbPro",`timestamp: ${e} is not valid`):this.player.playing&&(10===t&&(e*=1e3),this.player.playback.setStartTime(e),this.playbackClearCacheBuffer()):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}playbackClearCacheBuffer(){this.debug.log("JbPro","playbackClearCacheBuffer()"),this.player?this.player.isPlayback()?(this.player.video&&this.player.video.clear(),this.player.audio&&this.player.audio.clear(),this.player.decoderWorker.clearWorkBuffer(!0)):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}getPlaybackCurrentRate(){return this.player&&this.player.isPlayback()?this.player.playback.rate:1}updatePlaybackLocalOneFrameTimestamp(e){this.debug.log("JbPro","updatePlaybackLocalOneFrameTimestamp() "+e),this.player?this.player.isPlayback()?this.player.playback.updateLocalOneFrameTimestamp(e):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}setStreamQuality(e){this.debug.log("JbPro","setStreamQuality() "+e),this.player?this.player._opt.operateBtns.quality?(this.player._opt.qualityConfig||[]).includes(e)?this.player.streamQuality=e:this.debug.warn("JbPro",`quality: ${e} is not in qualityList`):this.debug.warn("JbPro","player._opt.operateBtns.quality is false"):this.debug.warn("JbPro","player is null")}_play(){let d=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",u=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise((e,t)=>{if(!this.player)return t("player is null");let i=!1;this._opt.url&&this._opt.url!==d&&(i=!0),this._opt.url=d,this._opt.playOptions=u;var r=0===d.indexOf("http"),s=0===d.indexOf("webrtc"),a=0===d.indexOf("wt"),n=!s&&-1!==d.indexOf(".m3u8"),o=!s&&-1!==d.indexOf(".flv"),l=r?n?3:2:a?5:s?4:1,r=this._opt.isNakedFlow?H:r&&!n||o||this._opt.isFlv?z:n?"hls":s?"webrtc":a?G:"m7s";if(o&&!this._opt.isFlv&&(this._opt.isFlv=!0),!l||!r)return t(`play protocol is ${l}, demuxType is `+r);const c=()=>{this.player.once(m.webglAlignmentError,e=>{this.emit(E.crashLog,this.getCrashLog(m.webglAlignmentError,e)),this.pause().then(()=>{if(this.player&&this.player._opt.webglAlignmentErrorReplay){this.debug.log("JbPro","webglAlignmentError");const e=this._opt.url;this._resetPlayer({openWebglAlignment:!0}).then(()=>{this.play(e).then(()=>{this.debug.log("JbPro","webglAlignmentError and play success")}).catch(e=>{this.debug.error("JbPro","webglAlignmentError and play error",e)})}).catch(e=>{this.debug.error("JbPro","webglAlignmentError and _resetPlayer error",e)})}else this.emit(E.playFailedAndPaused,m.webglAlignmentError),this.debug.log("JbPro","webglAlignmentError and webglAlignmentErrorReplay is false")}).catch(e=>{this.debug.error("JbPro","webglAlignmentError and pause error",e)})}),this.player.once(m.webglContextLostError,e=>{this.emit(E.crashLog,this.getCrashLog(m.webglContextLostError,e)),this.pause().then(()=>{if(this.player&&this.player._opt.webglContextLostErrorReplay){this.debug.log("JbPro","webglContextLostError");const t=this._opt.url,i={};var e;this.player._opt.replayUseLastFrameShow&&(e=this.screenshot("","png",.92,"base64"),i.loadingBackground=e),this._resetPlayer(i).then(()=>{this.play(t).then(()=>{this.debug.log("JbPro","webglContextLostError and play success")}).catch(e=>{this.debug.error("JbPro","webglContextLostError and play error",e)})}).catch(e=>{this.debug.error("JbPro","webglContextLostError and _resetPlayer error",e)})}else this.emit(E.playFailedAndPaused,m.webglContextLostError),this.debug.log("JbPro","webglContextLostError and webglContextLostErrorReplay is false")}).catch(e=>{this.debug.error("JbPro","webglAlignmentError and pause error",e)})}),this.player.once(m.mediaSourceH265NotSupport,e=>{this.emit(E.crashLog,this.getCrashLog(m.mediaSourceH265NotSupport,e)),this.pause().then(()=>{if(this.player&&this.player._opt.autoWasm){this.debug.log("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play");const e=this._opt.url;this._resetPlayer({useMSE:!1,useWCS:!1}).then(()=>{this.play(e).then(()=>{this.debug.log("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")}).catch(e=>{this.debug.error("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] _resetPlayer error",e)})}else this.emit(E.playFailedAndPaused,m.mediaSourceH265NotSupport),this.debug.log("JbPro","mediaSourceH265NotSupport and autoWasm is false")}).catch(e=>{this.debug.error("JbPro","mediaSourceH265NotSupport and pause error",e)})}),this.player.once(m.mediaSourceFull,e=>{this.emit(E.crashLog,this.getCrashLog(m.mediaSourceFull,e)),this.pause().then(()=>{if(this.player&&this.player._opt.mseDecodeErrorReplay){this.debug.log("JbPro","mediaSourceFull and auto wasm [mse-> wasm] reset player and play");const i=this._opt.url;let e={};var t;this.player._opt.autoWasm&&(e={useMSE:!1,useWCS:!1}),this.player._opt.replayUseLastFrameShow&&(t=this.screenshot("","png",.92,"base64"),e.loadingBackground=t),this._resetPlayer(e).then(()=>{this.play(i).then(()=>{this.debug.log("JbPro","mediaSourceFull and reset player and play success")}).catch(e=>{this.debug.error("JbPro","mediaSourceFull and reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","mediaSourceFull and _resetPlayer error",e)})}else this.emit(E.playFailedAndPaused,m.mediaSourceFull),this.debug.log("JbPro","mediaSourceFull and autoWasm is false")}).catch(e=>{this.debug.error("JbPro","mediaSourceFull and pause error",e)})}),this.player.once(m.mediaSourceAppendBufferError,e=>{this.emit(E.crashLog,this.getCrashLog(m.mediaSourceAppendBufferError,e)),this.pause().then(()=>{if(this.player&&this.player._opt.mseDecodeErrorReplay){this.debug.log("JbPro","mediaSourceAppendBufferError and auto wasm [mse-> wasm] reset player and play");const i=this._opt.url;let e={};var t;this.player._opt.autoWasm&&(e={useMSE:!1,useWCS:!1}),this.player._opt.replayUseLastFrameShow&&(t=this.screenshot("","png",.92,"base64"),e.loadingBackground=t),this._resetPlayer(e).then(()=>{this.play(i).then(()=>{this.debug.log("JbPro","mediaSourceAppendBufferError and reset player and play success")}).catch(e=>{this.debug.error("JbPro","mediaSourceAppendBufferError and reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","mediaSourceAppendBufferError and _resetPlayer error",e)})}else this.emit(E.playFailedAndPaused,m.mediaSourceAppendBufferError),this.debug.log("JbPro","mediaSourceAppendBufferError and autoWasm is false")}).catch(e=>{this.debug.error("JbPro","mediaSourceAppendBufferError and pause error",e)})}),this.player.once(m.mediaSourceBufferListLarge,e=>{this.emit(E.crashLog,this.getCrashLog(m.mediaSourceBufferListLarge,e)),this.pause().then(()=>{if(this.player&&this.player._opt.mseDecodeErrorReplay){this.debug.log("JbPro","media source buffer list large and auto wasm [mse-> wasm] reset player and play");const i=this._opt.url;let e={};var t;this.player._opt.autoWasm&&(e={useMSE:!1,useWCS:!1}),this.player._opt.replayUseLastFrameShow&&(t=this.screenshot("","png",.92,"base64"),e.loadingBackground=t),this._resetPlayer(e).then(()=>{this.play(i).then(()=>{this.debug.log("JbPro","media source buffer list large and reset player and play success")}).catch(e=>{this.debug.error("JbPro","media source buffer list large and reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","media source buffer list large and _resetPlayer error",e)})}else this.emit(E.playFailedAndPaused,m.mediaSourceBufferListLarge),this.debug.log("JbPro","media source buffer list large and autoWasm is false")}).catch(e=>{this.debug.error("JbPro","media source buffer list large and pause error",e)})}),this.player.once(m.mediaSourceAppendBufferEndTimeout,e=>{this.emit(E.crashLog,this.getCrashLog(m.mediaSourceAppendBufferEndTimeout,e)),this.pause().then(()=>{if(this.player&&this.player._opt.mseDecodeErrorReplay){this.debug.log("JbPro","media source append buffer end timeout and auto wasm [mse-> wasm] reset player and play");const i=this._opt.url;let e={};var t;this.player._opt.autoWasm&&(e={useMSE:!1,useWCS:!1}),this.player._opt.replayUseLastFrameShow&&(t=this.screenshot("","png",.92,"base64"),e.loadingBackground=t),this._resetPlayer(e).then(()=>{this.play(i).then(()=>{this.debug.log("JbPro","media source append buffer end timeout and reset player and play success")}).catch(e=>{this.debug.error("JbPro","media source append buffer end timeout and reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","media source append buffer end timeout and _resetPlayer error",e)})}else this.emit(E.playFailedAndPaused,m.mediaSourceAppendBufferEndTimeout),this.debug.log("JbPro","media source append buffer end timeout and autoWasm is false")}).catch(e=>{this.debug.error("JbPro","media source append buffer end timeout and pause error",e)})}),this.player.once(m.mseSourceBufferError,e=>{this.emit(E.crashLog,this.getCrashLog(m.mseSourceBufferError,e)),this.pause().then(()=>{if(this.player&&this.player._opt.mseDecodeErrorReplay){this.debug.log("JbPro","mseSourceBufferError auto wasm [mse-> wasm] reset player and play");const i=this._opt.url;let e={};var t;this.player._opt.autoWasm&&(e={useMSE:!1,useWCS:!1}),this.player._opt.replayUseLastFrameShow&&(t=this.screenshot("","png",.92,"base64"),e.loadingBackground=t),this._resetPlayer(e).then(()=>{this.play(i).then(()=>{this.debug.log("JbPro","mseSourceBufferError auto wasm [mse-> wasm] reset player and play success")}).catch(e=>{this.debug.error("JbPro","mseSourceBufferError auto wasm [mse-> wasm] reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","mseSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",e)})}else this.emit(E.playFailedAndPaused,m.mseSourceBufferError),this.debug.log("JbPro","mseSourceBufferError and autoWasm is false")}).catch(e=>{this.debug.error("JbPro","mseSourceBufferError and pause error:",e)})}),this.player.once(m.mseAddSourceBufferError,e=>{this.emit(E.crashLog,this.getCrashLog(m.mseAddSourceBufferError,e)),this.pause().then(()=>{if(this.player&&this.player._opt.autoWasm){this.debug.log("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play");const e=this._opt.url;this._resetPlayer({useMSE:!1,useWCS:!1}).then(()=>{this.play(e).then(()=>{this.debug.log("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play success")}).catch(e=>{this.debug.error("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",e)})}else this.emit(E.playFailedAndPaused,m.mseAddSourceBufferError),this.debug.log("JbPro","mseAddSourceBufferError and autoWasm is false")}).catch(e=>{this.debug.error("JbPro","mseAddSourceBufferError and pause error",e)})}),this.player.once(m.mediaSourceDecoderConfigurationError,e=>{this.emit(E.crashLog,this.getCrashLog(m.mediaSourceDecoderConfigurationError,e)),this.pause().then(()=>{if(this.player&&this.player._opt.autoWasm){this.debug.log("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play");const e=this._opt.url;this._resetPlayer({useMSE:!1,useWCS:!1}).then(()=>{this.play(e).then(()=>{this.debug.log("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")}).catch(e=>{this.debug.error("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] _resetPlayer and play error",e)})}else this.debug.log("JbPro","mediaSourceDecoderConfigurationError and autoWasm is false")}).catch(e=>{this.debug.error("JbPro","mediaSourceDecoderConfigurationError and pause error",e)})}),this.player.once(m.mediaSourceTsIsMaxDiff,e=>{this.emit(E.crashLog,this.getCrashLog(m.mediaSourceTsIsMaxDiff,e)),this.pause().then(()=>{if(this.player&&this.player._opt.mediaSourceTsIsMaxDiffReplay){this.debug.log("JbPro","mediaSourceTsIsMaxDiff reset player and play");const e=this._opt.url,t={};t.loadingBackground=this.screenshot("","png",.92,"base64"),this._resetPlayer(t).then(()=>{this.play(e).then(()=>{}).catch(e=>{this.debug.error("JbPro","mediaSourceTsIsMaxDiff replay error",e)})}).catch(e=>{this.debug.error("JbPro","mediaSourceTsIsMaxDiff _resetPlayer error",e)})}else this.emit(E.playFailedAndPaused,m.mediaSourceTsIsMaxDiff),this.debug.log("JbPro","mediaSourceTsIsMaxDiff and replay is false")}).catch(e=>{this.debug.error("JbPro","mediaSourceTsIsMaxDiff and pause error",e)})}),this.player.once(m.mseWidthOrHeightChange,e=>{this.emit(E.crashLog,this.getCrashLog(m.mseWidthOrHeightChange,e)),this.debug.log("JbPro","mseWidthOrHeightChange and reset player and play");const t=this._opt.url,i=this.screenshot("","png",.92,"base64");this._resetPlayer({loadingBackground:i}).then(()=>{this.play(t).then(()=>{this.debug.log("JbPro","mseWidthOrHeightChange and reset player and play success")}).catch(e=>{this.debug.error("JbPro","mseWidthOrHeightChange and reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)})}),this.player.once(m.mediaSourceUseCanvasRenderPlayFailed,e=>{this.emit(E.crashLog,this.getCrashLog(m.mediaSourceUseCanvasRenderPlayFailed,e)),this.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player"),this.pause().then(()=>{this._resetPlayer().then(()=>{this.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player success")}).catch(e=>{this.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player error",e)})}).catch(e=>{this.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause",e)})}),this.player.once(m.webcodecsH265NotSupport,e=>{this.emit(E.crashLog,this.getCrashLog(m.webcodecsH265NotSupport,e)),this.pause().then(()=>{if(this.player&&this.player._opt.autoWasm){this.debug.log("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play");const e=this._opt.url;this._resetPlayer({useMSE:!1,useWCS:!1}).then(()=>{this.play(e).then(()=>{this.debug.log("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")}).catch(e=>{this.debug.error("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] _resetPlayer and play error",e)})}else this.emit(E.playFailedAndPaused,m.webcodecsH265NotSupport),this.debug.log("JbPro","webcodecsH265NotSupport and autoWasm is false")}).catch(e=>{this.debug.error("JbPro","webcodecsH265NotSupport and pause error",e)})}),this.player.once(m.webcodecsUnsupportedConfigurationError,e=>{this.emit(E.crashLog,this.getCrashLog(m.webcodecsUnsupportedConfigurationError,e)),this.pause().then(()=>{if(this.player&&this.player._opt.autoWasm){this.debug.log("Jessibuca","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play");const e=this._opt.url;this._resetPlayer({useMSE:!1,useWCS:!1}).then(()=>{this.play(e).then(()=>{this.debug.log("Jessibuca","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play error",e)})}).catch(e=>{this.debug.error("Jessibuca","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] _resetPlayer and play error",e)})}else this.emit(E.playFailedAndPaused,m.webcodecsUnsupportedConfigurationError),this.debug.log("Jessibuca","webcodecsUnsupportedConfigurationError and autoWasm is false")}).catch(e=>{this.debug.error("Jessibuca","webcodecsUnsupportedConfigurationError and pause error",e)})}),this.player.once(m.webcodecsDecodeError,e=>{this.emit(E.crashLog,this.getCrashLog(m.webcodecsDecodeError,e)),this.pause().then(()=>{if(this.player&&this.player._opt.wcsDecodeErrorReplay){this.debug.log("JbPro","webcodecs decode error reset player and play");const i=this._opt.url;let e={};var t;this.player._opt.autoWasm&&(e={useMSE:!1,useWCS:!1}),this.player._opt.replayUseLastFrameShow&&(t=this.screenshot("","png",.92,"base64"),e.loadingBackground=t),this._resetPlayer(e).then(()=>{this.play(i).then(()=>{this.debug.log("JbPro","webcodecs decode error reset player and play success")}).catch(e=>{this.debug.error("JbPro","webcodecs decode error reset player and play error",e)})}).catch(()=>{this.debug.error("JbPro","webcodecs decode error _resetPlayer error")})}else this.emit(E.playFailedAndPaused,m.webcodecsDecodeError),this.debug.log("JbPro","webcodecs decode error and autoWasm is false")}).catch(e=>{this.debug.error("JbPro","webcodecs decode error and pause error",e)})}),this.player.once(m.wcsWidthOrHeightChange,e=>{this.emit(E.crashLog,this.getCrashLog(m.wcsWidthOrHeightChange,e)),this.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play");const t=this._opt.url,i=this.screenshot("","png",.92,"base64");this._resetPlayer({loadingBackground:i}).then(()=>{this.play(t).then(()=>{this.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play success")}).catch(e=>{this.debug.error("JbPro","wcsWidthOrHeightChange and reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)})}),this.player.once(m.wasmDecodeError,e=>{this.emit(E.crashLog,this.getCrashLog(m.wasmDecodeError,e)),this.pause().then(()=>{if(this.player&&this.player._opt.wasmDecodeErrorReplay){this.debug.log("JbPro","wasm decode error and reset player and play");const t=this._opt.url,i={};var e;this.player._opt.replayUseLastFrameShow&&(e=this.screenshot("","png",.92,"base64"),i.loadingBackground=e),this._resetPlayer(i).then(()=>{this.play(t).then(()=>{this.debug.log("JbPro","wasm decode error and reset player and play success")}).catch(e=>{this.debug.error("JbPro","wasm decode error and reset player and play error",e)})}).catch(()=>{this.debug.error("JbPro","wasm decode error and _resetPlayer error")})}else this.emit(E.playFailedAndPaused,m.wasmDecodeError),this.debug.log("JbPro","wasm decode error and wasmDecodeErrorReplay is false")}).catch(e=>{this.debug.error("JbPro","wasm decode error and pause error",e)})}),this.player.once(m.wasmDecodeVideoNoResponseError,e=>{this.emit(E.crashLog,this.getCrashLog(m.wasmDecodeVideoNoResponseError,e)),this.pause().then(()=>{this.debug.log("JbPro","wasm decode video no response error and reset player and play");const e=this._opt.url,t={};if(this.player&&this.player._opt.replayUseLastFrameShow){const e=this.screenshot("","png",.92,"base64");t.loadingBackground=e}this._resetPlayer(t).then(()=>{this.play(e).then(()=>{this.debug.log("JbPro","wasm decode video no response error and reset player and play success")}).catch(e=>{this.debug.error("JbPro","wasm decode video no response error and reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","wasm decode video no response error and _resetPlayer error",e)})}).catch(e=>{this.debug.error("JbPro","wasm decode video no response error and pause error",e)})}),this.player.once(m.wasmWidthOrHeightChange,e=>{this.emit(E.crashLog,this.getCrashLog(m.wasmWidthOrHeightChange,e)),this.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play");const t=this._opt.url,i=this.screenshot("","png",.92,"base64");this._resetPlayer({loadingBackground:i}).then(()=>{this.play(t).then(()=>{this.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play success")}).catch(e=>{this.debug.error("JbPro","wasmWidthOrHeightChange and reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)})}),this.player.once(m.wasmUseVideoRenderError,e=>{this.emit(E.crashLog,this.getCrashLog(m.wasmUseVideoRenderError,e)),this.debug.log("JbPro","wasmUseVideoRenderError and reset player and play");const t=this._opt.url;this._resetPlayer({useVideoRender:!1}).then(()=>{this.play(t).then(()=>{this.debug.log("JbPro","wasmUseVideoRenderError and reset player and play success")}).catch(e=>{this.debug.error("JbPro","wasmUseVideoRenderError and reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","wasmUseVideoRenderError and _resetPlayer error",e)})}),this.player.once(m.simdH264DecodeVideoWidthIsTooLarge,e=>{this.emit(E.crashLog,this.getCrashLog(m.simdH264DecodeVideoWidthIsTooLarge,e)),this.pause().then(()=>{this.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play");const e=this._opt.url;this._resetPlayer({useSIMD:!1}).then(()=>{this.play(e).then(()=>{this.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")}).catch(e=>{this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",e)})}).catch(e=>{this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and _resetPlayer error",e)})}).catch(e=>{this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and pause error",e)})}),this.player.once(E.networkDelayTimeout,e=>{if(this.player._opt.networkDelayTimeoutReplay){this.emit(E.crashLog,this.getCrashLog(E.networkDelayTimeout,e)),this.debug.log("JbPro","network delay time out and reset player and play");const t=this._opt.url,i={};if(this.player&&this.player._opt.replayUseLastFrameShow){const e=this.screenshot("","png",.92,"base64");i.loadingBackground=e}this._resetPlayer(i).then(()=>{this.play(t).then(()=>{this.debug.log("JbPro","wasm decode error and reset player and play success")}).catch(e=>{this.debug.error("JbPro","wasm decode error and reset player and play error",e)})}).catch(()=>{this.debug.error("JbPro","wasm decode error and _resetPlayer error")})}}),this.player.once(m.fetchError,e=>{this.emit(E.crashLog,this.getCrashLog(m.fetchError,e)),this.debug.log("JbPro","fetch error and reset player"),this.pause().then(()=>{this._resetPlayer().then(()=>{this.emit(E.playFailedAndPaused,m.fetchError)}).catch(()=>{this.emit(E.playFailedAndPaused,m.fetchError)})}).catch(e=>{this.debug.error("JbPro","fetch error and pause",e)})}),this.player.once(E.streamEnd,e=>{this.emit(E.crashLog,this.getCrashLog(E.streamEnd,e)),this.debug.log("JbPro","streamEnd reset player"),this.pause().then(()=>{this._resetPlayer().then(()=>{this.emit(E.playFailedAndPaused,E.streamEnd)}).catch(()=>{this.emit(E.playFailedAndPaused,E.streamEnd)})}).catch(e=>{this.debug.error("JbPro","streamEnd pause",e)})}),this.player.once(m.websocketError,e=>{this.emit(E.crashLog,this.getCrashLog(m.websocketError,e)),this.debug.log("JbPro","websocketError and reset player"),this.pause().then(()=>{this._resetPlayer().then(()=>{this.emit(E.playFailedAndPaused,m.websocketError)}).catch(()=>{this.emit(E.playFailedAndPaused,m.websocketError)})}).catch(e=>{this.debug.error("JbPro","websocketError and pause",e)})}),this.player.once(m.webrtcError,e=>{this.emit(E.crashLog,this.getCrashLog(m.webrtcError,e)),this.debug.log("JbPro","webrtcError and reset player"),this.pause().then(()=>{this._resetPlayer().then(()=>{this.emit(E.playFailedAndPaused,m.webrtcError)}).catch(()=>{this.emit(E.playFailedAndPaused,m.webrtcError)})}).catch(e=>{this.debug.error("JbPro","webrtcError and pause",e)})}),this.player.once(m.hlsError,e=>{this.emit(E.crashLog,this.getCrashLog(m.hlsError,e)),this.debug.log("JbPro","hlsError and reset player"),this.pause().then(()=>{this._resetPlayer().then(()=>{this.emit(E.playFailedAndPaused,m.hlsError)}).catch(()=>{this.emit(E.playFailedAndPaused,m.hlsError)})}).catch(e=>{this.debug.error("JbPro","hlsError and pause",e)})}),this.player.on(E.delayTimeout,e=>{this.emit(E.crashLog,this.getCrashLog(E.delayTimeout,e)),this.isDestroyed()?this.debug.log("JbPro","delay timeout but player is destroyed"):this.pause().then(()=>{if(this.player&&this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes<this.player._opt.heartTimeoutReplayTimes||-1===this.player._opt.heartTimeoutReplayTimes))if(this.debug.log("JbPro",`delay timeout replay time is ${this._heartTimeoutReplayTimes} and heartTimeoutReplayTimes is `+this.player._opt.heartTimeoutReplayTimes),this.isDestroyed())this.debug&&this.debug.warn("JbPro","delay timeout replay but player is destroyed");else{this._heartTimeoutReplayTimes+=1;const e=this._opt.url,t={};(this.player._opt.heartTimeoutReplayUseLastFrameShow||this.player._opt.replayUseLastFrameShow)&&(t.loadingBackground=this.screenshot("","png",.92,"base64")),this._resetPlayer(t).then(()=>{this.play(e).then(()=>{}).catch(e=>{this.debug.error("JbPro","delay timeout replay error",e)})}).catch(e=>{this.debug.error("JbPro","delay timeout _resetPlayer error",e)})}else this.emit(E.playFailedAndPaused,E.delayTimeout),this.player&&this.player.emit(E.delayTimeoutRetryEnd),this.debug.warn("JbPro",`delayTimeoutRetryEnd and
  394. opt.heartTimeout is ${this.player&&this.player._opt.heartTimeout} and
  395. opt.heartTimeoutReplay is ${this.player&&this.player._opt.heartTimeoutReplay} and
  396. opt.heartTimeoutReplayTimes is ${this.player&&this.player._opt.heartTimeoutReplayTimes},and
  397. local._heartTimeoutReplayTimes is `+this._heartTimeoutReplayTimes)}).catch(e=>{this.debug.error("JbPro","delay timeout and pause error",e)})}),this.player.on(E.loadingTimeout,e=>{this.emit(E.crashLog,this.getCrashLog(E.loadingTimeout,e)),this.isDestroyed()?this.debug.log("JbPro","loading timeout but player is destroyed"):this.pause().then(()=>{if(this.player&&this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes<this.player._opt.loadingTimeoutReplayTimes||-1===this.player._opt.loadingTimeoutReplayTimes))if(this.debug.log("JbPro",`loading timeout and
  398. replay time is ${this._loadingTimeoutReplayTimes} and
  399. loadingTimeoutReplayTimes is `+this.player._opt.loadingTimeoutReplayTimes),this.isDestroyed())this.debug&&this.debug.warn("JbPro","delay timeout replay but player is destroyed");else{this._loadingTimeoutReplayTimes+=1;const e=this._opt.url;this._resetPlayer().then(()=>{this.play(e).then(()=>{}).catch(e=>{this.debug.error("JbPro","loading timeout replay error",e)})}).catch(e=>{this.debug.error("JbPro","loading timeout _resetPlayer error",e)})}else this.emit(E.playFailedAndPaused,E.loadingTimeout),this.player&&this.player.emit(E.loadingTimeoutRetryEnd),this.debug.log("JbPro",`loadingTimeoutRetryEnd and
  400. opt.loadingTimeout is ${this.player&&this.player._opt.loadingTimeout} and
  401. opt.loadingTimeoutReplay is ${this.player&&this.player._opt.loadingTimeoutReplay} and
  402. local._loadingTimeoutReplayTimes time is ${this._loadingTimeoutReplayTimes} and
  403. opt.loadingTimeoutReplayTimes is `+(this.player&&this.player._opt.loadingTimeoutReplayTimes))}).catch(e=>{this.debug.error("JbPro","loading timeout and pause error",e)})}),this.hasLoaded()?this.player.play(d,u).then(()=>{e()}).catch(e=>{this.debug.error("JbPro","hasLoaded and play error",e),this.emit(E.crashLog,this.getCrashLog("hasLoaded and play error",e)),this.player.pause().then(()=>{t(e)}).catch(e=>{this.debug.error("JbPro","hasLoaded and play error and next pause error",e)})}):this.player.once(E.decoderWorkerInit,()=>{this.player.play(d,u).then(()=>{e()}).catch(e=>{this.debug.error("JbPro","decoderWorkerInit and play error",e),this.emit(E.crashLog,this.getCrashLog("decoderWorkerInit and play error",e)),this.player&&this.player.pause().then(()=>{t(e)}).catch(e=>{this.debug.error("JbPro","decoderWorkerInit and play error and next pause error",e)})})})};n||s||i?this._resetPlayer({protocol:l,demuxType:r,isHls:n,isWebrtc:s,url:d}).then(()=>{c()}).catch(e=>{t("reset player error")}):(this.player.updateOption({protocol:l,demuxType:r,isFlv:this._opt.isFlv,cryptoKey:u.cryptoKey||"",cryptoIV:u.cryptoIV||""}),u.cryptoKey&&u.cryptoIV&&(this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"cryptoKey",value:u.cryptoKey}),this.player.decoderWorker)&&this.player.decoderWorker.updateWorkConfig({key:"cryptoIV",value:u.cryptoIV}),c())})}resize(){this.debug.log("JbPro","resize()"),this.player&&this.player.resize()}setBufferTime(e){this.debug.log("JbPro","setBufferTime() "+e),e=Number(e),this.player?(10<e&&this.debug.warn("JbPro",`setBufferTime() buffer time is ${e} second, is too large, video will show blank screen until cache ${e} second buffer data`),this.player.updateOption({videoBuffer:1e3*e}),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"videoBuffer",value:1e3*e})):this.debug.warn("JbPro","setBufferTime() player is not ready")}setBufferDelayTime(e){this.debug.log("JbPro","setBufferDelayTime() "+e),e=Number(e),this.player?(e<.2&&this.debug.warn("JbPro",`setBufferDelayTime() buffer time delay is ${e} second, is too small`),e=y(e,.2,100),this.player.updateOption({videoBufferDelay:1e3*e}),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"videoBufferDelay",value:1e3*e})):this.debug.warn("JbPro","setBufferDelayTime() player is not ready")}setRotate(e){this.debug.log("JbPro","setRotate() "+e),e=parseInt(e,10),this.player?this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)?(this.player.updateOption({rotate:e}),this.resize()):this.debug.warn("JbPro",`setRotate() rotate is ${e} and this._opt.rotate is `+this._opt.rotate):this.debug.warn("JbPro","setRotate() player is not ready")}setMirrorRotate(e){this.debug.log("JbPro","setMirrorRotate() "+e),this.player?this._opt.mirrorRotate!==e&&-1!==["none","level","vertical"].indexOf(e)?(this.player.updateOption({mirrorRotate:e}),this.resize()):this.debug.warn("JbPro",`setMirrorRotate() mirrorRotate is ${e} and this._opt.mirrorRotate is `+this._opt.mirrorRotate):this.debug.warn("JbPro","setMirrorRotate() player is not ready")}hasLoaded(){return this.player&&this.player.loaded||!1}setKeepScreenOn(){this.debug.log("JbPro","setKeepScreenOn()"),this.player?this.player.updateOption({keepScreenOn:!0}):this.debug.warn("JbPro","setKeepScreenOn() player is not ready")}setFullscreen(e){this.debug.log("JbPro","setFullscreen() "+e);e=!!e;this.player?this.player.fullscreen!==e&&(this.player.fullscreen=e):this.debug.warn("JbPro","setFullscreen() player is not ready")}screenshot(e,t,i,r){return this.debug.log("JbPro",`screenshot() ${e} ${t} ${i} `+r),this.player&&this.player.video?this.player.video.screenshot(e,t,i,r):(this.debug.warn("JbPro","screenshot() player is not ready"),null)}screenshotWatermark(e){return new Promise((t,i)=>{this.debug.log("JbPro","screenshotWatermark()",e),this.player&&this.player.video?this.player.video.screenshotWatermark(e).then(e=>{t(e)}).catch(e=>{i(e)}):(this.debug.warn("JbPro","screenshotWatermark() player is not ready"),i("player is not ready"))})}startRecord(i,r){return new Promise((e,t)=>{if(this.debug.log("JbPro",`startRecord() ${i} `+r),!this.player)return this.debug.warn("JbPro","startRecord() player is not ready"),t("player is not ready");this.player.playing?(this.player.startRecord(i,r),e()):(this.debug.warn("JbPro","startRecord() player is not playing"),t("not playing"))})}stopRecordAndSave(e,r){return new Promise((t,i)=>{this.debug.log("JbPro",`stopRecordAndSave() ${e} `+r),this.player&&this.player.recording?this.player.stopRecordAndSave(e,r).then(e=>{t(e)}).catch(e=>{i(e)}):i("not recording")})}isPlaying(){let e=!1;return this.player&&(this._opt.playType===n?e=this.player.playing:this._opt.playType===v&&(e=k(this.player.playbackPause)&&this.player.playing)),e}isLoading(){return!!this.player&&this.player.loading}isPause(){let e=!1;return this._opt.playType===n?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===v&&this.player&&(e=this.player.playbackPause),e}isPaused(){return this.isPause()}isPlaybackPause(){let e=!1;return e=this._opt.playType===v&&this.player?this.player.playbackPause:e}isMute(){let e=!0;return e=this.player?this.player.isAudioMute():e}isRecording(){return this.player&&this.player.recorder&&this.player.recorder.recording||!1}clearBufferDelay(){this.debug.log("JbPro","clearBufferDelay()"),this.player?this.player.clearBufferDelay():this.debug.warn("JbPro","clearBufferDelay() player is not init")}setNetworkDelayTime(e){this.debug.log("JbPro","setNetworkDelayTime() "+e),e=Number(e),this.player?(e<1&&this.debug.warn("JbPro",`setNetworkDelayTime() network delay is ${e} second, is too small`),e=y(e,1,100),this.player.updateOption({networkDelay:1e3*e}),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"networkDelay",value:1e3*e})):this.debug.warn("JbPro","setNetworkDelayTime() player is not init")}getDecodeType(){let e="";return e=this.player?this.player.getDecodeType():e}getRenderType(){let e="";return e=this.player?this.player.getRenderType():e}getAudioEngineType(){let e="";return e=this.player?this.player.getAudioEngineType():e}getPlayingTimestamp(){let e=0;return e=this.player?this.player.getPlayingTimestamp():e}getStatus(){let e="destroy";return e=this.player?this.player.loading?"loading":this.player.playing?"playing":"paused":e}getPlayType(){return this.player?this.player._opt.playType:n}togglePerformancePanel(e){this.debug.log("JbPro","togglePerformancePanel() "+e);var t=this.player._opt.showPerformance;let i=!t;(i=ft(e)?e:i)!==t?this.player?this.player.togglePerformancePanel(i):this.debug.warn("JbPro","togglePerformancePanel() failed, this.player is not init"):this.debug.warn("JbPro",`togglePerformancePanel() failed, showPerformance is prev: ${t} === now: `+i)}openZoom(){this.debug.log("JbPro","openZoom()"),this.player?this.player.zooming=!0:this.debug.warn("JbPro","openZoom() failed, this.player is not init")}closeZoom(){this.debug.log("JbPro","closeZoom()"),this.player?this.player.zooming=!1:this.debug.warn("JbPro","closeZoom() failed, this.player is not init")}isZoomOpen(){let e=!1;return e=this.player?this.player.zooming:e}expandZoom(){this.debug.log("JbPro","expandZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.expandPrecision():this.debug.warn("JbPro","expandZoom() failed, zoom is not open or not init")}narrowZoom(){this.debug.log("JbPro","narrowZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.narrowPrecision():this.debug.warn("JbPro","narrowZoom failed, zoom is not open or not init")}getCurrentZoomIndex(){let e=1;return e=this.player&&this.player.zoom?this.player.zoom.currentZoom:e}startTalk(i){let r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise((e,t)=>{this.debug.log("JbPro","startTalk()",i,r),this._initTalk(r),this.talk.startTalk(i).then(()=>{e(),this.talk.once(E.talkStreamClose,()=>{this.debug.warn("JbPro","talk stream close"),this.stopTalk().catch(e=>{})}),this.talk.once(E.talkStreamError,e=>{this.debug.warn("JbPro","talk stream error",e),this.stopTalk().catch(e=>{})}),this.talk.once(E.talkStreamInactive,()=>{this.debug.warn("JbPro","talk stream inactive"),this.stopTalk().catch(e=>{})})}).catch(e=>{t(e)})})}stopTalk(){return new Promise((e,t)=>{if(this.debug.log("JbPro","stopTalk()"),!this.talk)return t("stopTalk() talk is not init");this.talk.destroy(),e()})}getTalkVolume(){return new Promise((e,t)=>{if(!this.talk)return t("getTalkVolume() talk is not init");e(this.talk.volume)})}setTalkVolume(i){return new Promise((e,t)=>{if(this.debug.log("JbPro","setTalkVolume()",i),!this.talk)return t("setTalkVolume() talk is not init");this.talk.setVolume(i/100),e()})}setNakedFlowFps(r){return new Promise((e,t)=>{var i;return this.debug.log("JbPro","setNakedFlowFps()",r),this.player?pt(r)?t("setNakedFlowFps() fps is empty"):(i=y(i=Number(r),1,100),void this.player.updateOption({nakedFlowFps:i})):t("setNakedFlowFps() player is not init")})}getCrashLog(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";if(this.player){var i=this.player.getAllStatsData(),r=this.player,i={url:this._opt.url,playType:r.isPlayback()?"playback":"live",demuxType:r.getDemuxType(),decoderType:r.getDecodeType(),renderType:r.getRenderType(),videoInfo:{encType:"",width:"",height:""},audioInfo:{encType:"",sampleRate:"",channels:""},audioEngine:r.getAudioEngineType(),allTimes:i.pTs,timestamp:A(),type:e,error:function(e){const t=Object.prototype.toString;return function(e){switch(t.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:try{return e instanceof Error}catch(e){}}}(e)?e.message:null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}(t)||e};if(r.video){const e=r.video.videoInfo||{};i.videoInfo={encType:e.encType||"",width:e.width||"",height:e.height||""}}if(r.audio){const e=r.audio.audioInfo||{};i.audioInfo={encType:e.encType||"",sampleRate:e.sampleRate||"",channels:e.channels||""}}return i}}updateDebugLevel(e){this.debug.log("JbPro","updateDebugLevel()",e),this.player?e!==$&&e!==J?this.debug.warn("JbPro","updateDebugLevel() level is not valid, level: "+e):e===this.player._opt.debugLevel?this.debug.warn("JbPro","updateDebugLevel() level is same, level: "+e):(this.player.updateOption({debugLevel:e}),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"debugLevel",value:e})):this.debug.warn("JbPro","updateDebugLevel() player is not init")}updateWatermark(e){this.debug.log("JbPro","updateWatermark()",e),this.player?this.player.updateWatermark(e):this.debug.warn("JbPro","updateWatermark() player is not init")}removeWatermark(){this.debug.log("JbPro","removeWatermark()"),this.player?this.player.removeWatermark():this.debug.warn("JbPro","removeWatermark() player is not init")}updateFullscreenWatermark(e){var t;this.debug.log("JbPro","updateFullscreenWatermark()",e),wt(e)?(this._opt.fullscreenWatermarkConfig=e,(t=mt(this.$container,e)).watermark_txt?this.watermark.load(t):this.debug.warn("JbPro","fullscreenWatermarkConfig text is empty")):this.debug.warn("JbPro","updateFullscreenWatermark() config is not valid, config: "+e)}removeFullscreenWatermark(){this.debug.log("JbPro","removeFullscreenWatermark()"),this.watermark?this.watermark.remove():this.debug.warn("JbPro","removeFullscreenWatermark() watermark is not init")}faceDetectOpen(){this.debug.log("JbPro","faceDetectOpen()"),this.player?this.player.faceDetect(!0):this.debug.warn("JbPro","faceDetectOpen() player is not init")}faceDetectClose(){this.debug.log("JbPro","faceDetectClose()"),this.player?this.player.faceDetect(!1):this.debug.warn("JbPro","faceDetectClose() player is not init")}objectDetectOpen(){this.debug.log("JbPro","objectDetectOpen()"),this.player?this.player.objectDetect(!0):this.debug.warn("JbPro","objectDetectOpen() player is not init")}objectDetectClose(){this.debug.log("JbPro","objectDetectClose()"),this.player?this.player.objectDetect(!1):this.debug.warn("JbPro","objectDetectClose() player is not init")}sendWebsocketMessage(e){this.debug.log("JbPro","sendWebsocketMessage()",e),this.player?this.player.sendWebsocketMessage(e):this.debug.warn("JbPro","sendWebsocketMessage() player is not init")}addContentToCanvas(e){this.debug.log("JbPro","addContentToCanvas()",e),this.player?this.player.addContentToCanvas(e):this.debug.warn("JbPro","addContentToCanvas() player is not init")}clearContentToCanvas(){this.debug.log("JbPro","clearContentToCanvas()"),this.player?this.player.addContentToCanvas([]):this.debug.warn("JbPro","clearContentToCanvas() player is not init")}setControlHtml(e){this.debug.log("JbPro","setControlHtml()",e),this.player?this.player.setControlHtml(e):this.debug.warn("JbPro","setControlHtml() player is not init")}clearControlHtml(){this.debug.log("JbPro","clearControlHtml()"),this.player?this.player.clearControlHtml():this.debug.warn("JbPro","clearControlHtml() player is not init")}getVideoInfo(){let e=null;return e=this.player?this.player.getVideoInfo():e}getAudioInfo(){let e=null;return e=this.player?this.player.getAudioInfo():e}downloadTempNakedFlowFile(){return new Promise((e,t)=>{this.player?(this.player.downloadNakedFlowFile(),e()):t("player is not init")})}downloadTempRtpFile(){return new Promise((e,t)=>{this.talk?(this.talk.downloadRtpFile(),e()):t("talk is not init")})}}return ws.ERROR=m,ws.EVENTS=ne,window.JessibucaPro=ws,window.WebPlayerPro=ws});