!function(A,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(A="undefined"!=typeof globalThis?globalThis:A||self).EZUIKit=e()}(this,(function(){"use strict";function A(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(A);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(A,e).enumerable}))),t.push.apply(t,i)}return t}function e(e){for(var t=1;tA.length)&&(e=A.length);for(var t=0,i=new Array(e);t=A.length?{done:!0}:{done:!1,value:A[i++]}},e:function(A){throw A},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,o=!1;return{s:function(){t=t.call(A)},n:function(){var A=t.next();return r=A.done,A},e:function(A){o=!0,a=A},f:function(){try{r||null==t.return||t.return()}finally{if(o)throw a}}}}var C=function(){return o((function A(e,t){a(this,A),this.coreX=e,this.coreY=t}),[{key:"toString",value:function(){return"".concat(this.coreX,"-").concat(this.coreY)}}])}();Date.prototype.Format=function(A){var e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var t in/(y+)/.test(A)&&(A=A.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),e)new RegExp("("+t+")").test(A)&&(A=A.replace(RegExp.$1,1==RegExp.$1.length?e[t]:("00"+e[t]).substr((""+e[t]).length)));return A};var d=function(A,e,t,i){var n=document.getElementsByTagName("head")[0].getElementsByTagName("script"),a=!1;if(t)a=t();else for(var r=0;r3){var t=e[1],i=e[2],n="1"===e[3],a="live";return A.indexOf("rec=local")>-1?a="rec":A.indexOf("rec=cloud")>-1&&(a="cloud.rec"),{deviceSerial:t,channelNo:i,hd:n,type:a}}return{}};var y=function(A,e,t,i,a,r){var o=A,s=new XMLHttpRequest;s.onreadystatechange=function(){if(4==s.readyState&&200==s.status)if(function(A){if("string"==typeof A)try{var e=JSON.parse(A);return!("object"!==n(e)||!e)}catch(A){return!1}console.log("It is not a string!")}(s.responseText)){var A=JSON.parse(s.responseText);a(A)}else a(s.responseText)},s.open(e,o,!0);var g=new FormData;for(var c in t)g.append(c,t[c]);if(i&&"object"===n(i))for(var c in i)s.setRequestHeader(c,i[c]);s.send(g)},_=function(){return!!window&&navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i)},S=function(){return o((function A(e,t){var i=this;a(this,A),d("https://open.ys7.com/assets/ezuikit_v3.4/js/hls.js",(function(){console.log("加载hls.min.js成功",window.Hls),console.log("isSupportHls",window.Hls.isSupported()),window.Hls.isSupported()&&i.initHLS(e,t)}),(function(){return!!window.Hls}))}),[{key:"toString",value:function(){return"hls ".concat(this.coreX,"-").concat(this.coreY)}},{key:"initHLS",value:function(A,e){var t=m(e),i=t.deviceSerial,n=t.channelNo;t.hd,window.ezuikitMonitor.report({protocol:"hls",url:e,serial:i,no:n,action:1});var a=document.getElementById(A),r=new window.Hls({defaultAudioCodec:"mp4a.40.2"});r.loadSource(e),r.attachMedia(a),r.on(window.Hls.Events.MANIFEST_PARSED,(function(){a.play()})),r.on(window.Hls.Events.ERROR,(function(A,e){if(e.fatal)switch(e.type){case window.Hls.ErrorTypes.NETWORK_ERROR:console.log("fatal network error encountered, try to recover"),r.startLoad();break;case window.Hls.ErrorTypes.MEDIA_ERROR:console.log("fatal media error encountered, try to recover"),r.recoverMediaError();break;default:r.destroy()}})),this.hls=r,this.video=a,this.hlsUrl=e}},{key:"play",value:function(){console.log("执行hls播放",this.video),this.hls.startLoad(),this.video.play()}},{key:"stop",value:function(){this.video.pause(),this.hls.stopLoad()}}])}(),D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function w(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}!function(A,e){!function(e,t){A.exports=t()}(self,(()=>(()=>{var A={99:A=>{var e,t="object"==typeof Reflect?Reflect:null,i=t&&"function"==typeof t.apply?t.apply:function(A,e,t){return Function.prototype.apply.call(A,e,t)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(A){return Object.getOwnPropertyNames(A).concat(Object.getOwnPropertySymbols(A))}:function(A){return Object.getOwnPropertyNames(A)};var n=Number.isNaN||function(A){return A!=A};function a(){a.init.call(this)}A.exports=a,A.exports.once=function(A,e){return new Promise((function(t,i){function n(t){A.removeListener(e,a),i(t)}function a(){"function"==typeof A.removeListener&&A.removeListener("error",n),t([].slice.call(arguments))}h(A,e,a,{once:!0}),"error"!==e&&function(A,e,t){"function"==typeof A.on&&h(A,"error",e,{once:!0})}(A,n)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var r=10;function o(A){if("function"!=typeof A)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof A)}function s(A){return void 0===A._maxListeners?a.defaultMaxListeners:A._maxListeners}function g(A,e,t,i){var n,a,r,g;if(o(t),void 0===(a=A._events)?(a=A._events=Object.create(null),A._eventsCount=0):(void 0!==a.newListener&&(A.emit("newListener",e,t.listener?t.listener:t),a=A._events),r=a[e]),void 0===r)r=a[e]=t,++A._eventsCount;else if("function"==typeof r?r=a[e]=i?[t,r]:[r,t]:i?r.unshift(t):r.push(t),(n=s(A))>0&&r.length>n&&!r.warned){r.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=A,c.type=e,c.count=r.length,g=c,console&&console.warn&&console.warn(g)}return A}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(A,e,t){var i={fired:!1,wrapFn:void 0,target:A,type:e,listener:t},n=c.bind(i);return n.listener=t,i.wrapFn=n,n}function I(A,e,t){var i=A._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?t?[n.listener||n]:[n]:t?function(A){for(var e=new Array(A.length),t=0;t0&&(r=e[0]),r instanceof Error)throw r;var o=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw o.context=r,o}var s=a[A];if(void 0===s)return!1;if("function"==typeof s)i(s,this,e);else{var g=s.length,c=d(s,g);for(t=0;t=0;a--)if(t[a]===e||t[a].listener===e){r=t[a].listener,n=a;break}if(n<0)return this;0===n?t.shift():function(A,e){for(;e+1=0;i--)this.removeListener(A,e[i]);return this},a.prototype.listeners=function(A){return I(this,A,!0)},a.prototype.rawListeners=function(A){return I(this,A,!1)},a.listenerCount=function(A,e){return"function"==typeof A.listenerCount?A.listenerCount(e):C.call(A,e)},a.prototype.listenerCount=C,a.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},994:(A,e,t)=>{t.d(e,{Z:()=>i});const i=class{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){const A=!this.hasAudio||this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,e=!this.hasVideo||this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&A&&e}isSeekable(){return this.hasKeyframesIndex}getNearestKeyframe(A){if(null==this.keyframesIndex)return null;const e=this.keyframesIndex,t=this._search(e.times,A);return{index:t,milliseconds:e.times[t],fileposition:e.filepositions[t]}}_search(A,e){let t=0;const i=A.length-1;let n=0,a=0,r=i;for(e=A[n]&&e{t.d(e,{J1:()=>r,Vn:()=>a,Wk:()=>i,Yy:()=>n});class i{constructor(A,e,t,i,n){this.dts=A,this.pts=e,this.duration=t,this.originalDts=i,this.isSyncPoint=n,this.fileposition=null}}class n{constructor(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}appendSyncPoint(A){A.isSyncPoint=!0,this.syncPoints.push(A)}}class a{constructor(){this._list=[]}clear(){this._list=[]}appendArray(A){const e=this._list;0!==A.length&&(e.length>0&&A[0].originalDts=e[n].dts&&A((null===(e=t[n].lastSample)||void 0===e?void 0:e.originalDts)||0)&&A=((null===(t=null===(e=i[a])||void 0===e?void 0:e.lastSample)||void 0===t?void 0:t.originalDts)||0)&&(a===i.length-1||a0&&(r=this._searchNearestSegmentBefore(n.originalBeginDts)+1),this._lastAppendLocation=r,this._list.splice(r,0,n)}getLastSegmentBefore(A){const e=this._searchNearestSegmentBefore(A);return e>=0?this._list[e]:null}getLastSampleBefore(A){const e=this.getLastSegmentBefore(A);return null!=e?e.lastSample:null}getLastSyncPointBefore(A){let e=this._searchNearestSegmentBefore(A),t=this._list[e].syncPoints;for(;0===t.length&&e>0;)e--,t=this._list[e].syncPoints;return t.length>0?t[t.length-1]:null}}},943:(A,e,t)=>{t.d(e,{Z:()=>bA});var i=t(99),n=t(645),a=t(479),r=t(994);function o(A,e,t){const i=A;if(e+t=128){e.push(String.fromCharCode(65535&A)),i+=2;continue}}}else if(t[i]<240){if(o(t,i,2)){const A=(15&t[i])<<12|(63&t[i+1])<<6|63&t[i+2];if(A>=2048&&55296!=(63488&A)){e.push(String.fromCharCode(65535&A)),i+=3;continue}}}else if(t[i]<248&&o(t,i,3)){let A=(7&t[i])<<18|(63&t[i+1])<<12|(63&t[i+2])<<6|63&t[i+3];if(A>65536&&A<1114112){A-=65536,e.push(String.fromCharCode(A>>>10|55296)),e.push(String.fromCharCode(1023&A|56320)),i+=4;continue}}e.push(String.fromCharCode(65533)),++i}return e.join("")};var g=t(411);const c=function(){const A=new ArrayBuffer(2);return new DataView(A).setInt16(0,256,!0),256===new Int16Array(A)[0]}();class l{static parseScriptData(A,e,t){const i={};try{const n=l.parseValue(A,e,t),a=l.parseValue(A,e+n.size,t-n.size);i[n.data]=a.data}catch(A){n.Z.e("AMF",A.toString())}return i}static parseObject(A,e,t){if(t<3)throw new g.rT("Data not enough when parse ScriptDataObject");const i=l.parseString(A,e,t),n=l.parseValue(A,e+i.size,t-i.size),a=n.objectEnd;return{data:{name:i.data,value:n.data},size:i.size+n.size,objectEnd:a}}static parseVariable(A,e,t){return l.parseObject(A,e,t)}static parseString(A,e,t){if(t<2)throw new g.rT("Data not enough when parse String");const i=new DataView(A,e,t).getUint16(0,!c);let n;return n=i>0?s(new Uint8Array(A,e+2,i)):"",{data:n,size:2+i}}static parseLongString(A,e,t){if(t<4)throw new g.rT("Data not enough when parse LongString");const i=new DataView(A,e,t).getUint32(0,!c);let n;return n=i>0?s(new Uint8Array(A,e+4,i)):"",{data:n,size:4+i}}static parseDate(A,e,t){if(t<10)throw new g.rT("Data size invalid when parse Date");const i=new DataView(A,e,t);let n=i.getFloat64(0,!c);return n+=60*i.getInt16(8,!c)*1e3,{data:new Date(n),size:10}}static parseValue(A,e,t){if(t<1)throw new g.rT("Data not enough when parse Value");const i=new DataView(A,e,t);let a=1;const r=i.getUint8(0);let o,s=!1;try{switch(r){case 0:o=i.getFloat64(1,!c),a+=8;break;case 1:o=!!i.getUint8(1),a+=1;break;case 2:{const i=l.parseString(A,e+1,t-1);o=i.data,a+=i.size;break}case 3:{o={};let n=0;for(9==(16777215&i.getUint32(t-4,!c))&&(n=3);a32)throw new g.OC("ExpGolomb: readBits() bits exceeded max 32bits!");if(A<=this._current_word_bits_left){const e=this._current_word>>>32-A;return this._current_word<<=A,this._current_word_bits_left-=A,e}let e=this._current_word_bits_left?this._current_word:0;e>>>=32-this._current_word_bits_left;const t=A-this._current_word_bits_left;this._fillCurrentWord();const i=Math.min(t,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,e=e<>>A)return this._current_word<<=A,this._current_word_bits_left-=A,A;return this._fillCurrentWord(),A+this._skipLeadingZero()}readUEG(){const A=this._skipLeadingZero();return this.readBits(A+1)-1}readSEG(){const A=this.readUEG();return 1&A?A+1>>>1:-1*(A>>>1)}};class d{static _ebsp2rbsp(A){const e=A,t=e.byteLength,i=new Uint8Array(t);let n=0;for(let A=0;A=2&&3===e[A]&&0===e[A-1]&&0===e[A-2]||(i[n]=e[A],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(A){const e=A.subarray(1,4);let t="avc1.";for(let A=0;A<3;A++){let i=e[A].toString(16);i.length<2&&(i="0"+i),t+=i}const i=d._ebsp2rbsp(A);let n=new C(i);n.readByte();const a=n.readByte();n.readByte();const r=n.readByte();n.readUEG();const o=d.getProfileString(a),s=d.getLevelString(r);let g=1,c=420;let l=8,I=8;if((100===a||110===a||122===a||244===a||44===a||83===a||86===a||118===a||128===a||138===a||144===a)&&(g=n.readUEG(),3===g&&n.readBits(1),g<=3&&(c=[0,420,422,444][g]),l=n.readUEG()+8,I=n.readUEG()+8,n.readBits(1),n.readBool())){const A=3!==g?8:12;for(let e=0;e0&&A<16?(y=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][A-1],_=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][A-1]):255===A&&(y=n.readByte()<<8|n.readByte(),_=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){const A=n.readBits(32),e=n.readBits(32);D=n.readBool(),w=e,v=2*A,S=w/v}}let F=1;1===y&&1===_||(F=y/_);let b=0,R=0;0===g?(b=1,R=2-f):(b=3===g?1:2,R=(1===g?2:1)*(2-f));let k=16*(u+1),P=16*(E+1)*(2-f);k-=(Q+x)*b,P-=(p+m)*R;const N=Math.ceil(k*F);return n.destroy(),n=null,{codec_mimetype:t,profile_idc:a,level_idc:r,profile_string:o,level_string:s,chroma_format_idc:g,bit_depth:l,bit_depth_luma:l,bit_depth_chroma:I,ref_frames:B,chroma_format:c,chroma_format_string:d.getChromaFormatString(c),frame_rate:{fixed:D,fps:S,fps_den:v,fps_num:w},sar_ratio:{width:y,height:_},codec_size:{width:k,height:P},present_size:{width:N,height:P}}}static _skipScalingList(A,e){let t=8,i=8,n=0;for(let a=0;a=2&&3===e[A]&&0===e[A-1]&&0===e[A-2]||(i[n]=e[A],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(A){const e=u._ebsp2rbsp(A),t=new C(e);return t.readByte(),t.readByte(),t.readBits(4),t.readBits(2),t.readBits(6),{num_temporal_layers:t.readBits(3)+1,temporal_id_nested:t.readBool()}}static parseSPS(A){const e=u._ebsp2rbsp(A);let t=new C(e);t.readByte(),t.readByte();let i=0,n=0,a=0,r=0;t.readBits(4);const o=t.readBits(3),s=(t.readBool(),t.readBits(2)),g=t.readBool(),c=t.readBits(5),l=t.readByte(),I=t.readByte(),d=t.readByte(),h=t.readByte(),B=t.readByte(),E=t.readByte(),f=t.readByte(),Q=t.readByte(),x=t.readByte(),p=t.readByte(),m=t.readByte(),y=[],_=[];for(let A=0;A0)for(let A=o;A<8;A++)t.readBits(2);for(let A=0;A1&&t.readSEG();for(let A=0;A0&&A<=16?(M=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][A-1],T=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][A-1]):255===A&&(M=t.readBits(16),T=t.readBits(16))}if(t.readBool()&&t.readBool(),t.readBool()&&(t.readBits(3),t.readBool(),t.readBool()&&(t.readByte(),t.readByte(),t.readByte())),t.readBool()&&(t.readUEG(),t.readUEG()),t.readBool(),t.readBool(),t.readBool(),P=t.readBool(),P&&(t.readUEG(),t.readUEG(),t.readUEG(),t.readUEG()),t.readBool()&&(Y=t.readBits(32),G=t.readBits(32),t.readBool()&&t.readUEG(),t.readBool())){let A=!1,e=!1,i=!1;A=t.readBool(),e=t.readBool(),(A||e)&&(i=t.readBool(),i&&(t.readByte(),t.readBits(5),t.readBool(),t.readBits(5)),t.readBits(4),t.readBits(4),i&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let n=0;n<=o;n++){const n=t.readBool();L=n;let a=!1,r=1;n||(a=t.readBool());let o=!1;if(a?t.readSEG():o=t.readBool(),o||(r=t.readUEG()+1),A)for(let A=0;A>3,n=!!(4&A[t]),a=!!(2&A[t]);A[t],t+=1,n&&(t+=1);let r=Number.POSITIVE_INFINITY;if(a){r=0;for(let e=0;r|=(127&A[t])<<7*e,t+=1,128&A[t];e++);}1===i&&(e=m.parseSeuqneceHeader(A.subarray(t,t+r))),t+=r}return e}static parseSeuqneceHeader(A){let e=new C(A);const t=e.readBits(3),i=(e.readBool(),e.readBool());let n=!0,a=0,r=0;const o=[];if(i)o.push({operating_point_idc:0,level:e.readBits(5),tier:0});else{if(e.readBool()){const A=e.readBits(32),t=e.readBits(32),i=e.readBool();if(i){let A=0;for(;0===e.readBits(1);)A+=1;A>=32||e.readBits(A)}r=A,a=t,n=i,e.readBool()&&(e.readBits(5),e.readBits(32),e.readBits(5),e.readBits(5))}const A=e.readBool(),t=e.readBits(5);for(let i=0;i<=t;i++){const t=e.readBits(12),i=e.readBits(5),n=i>7?e.readBits(1):0;o.push({operating_point_idc:t,level:i,tier:n}),A&&e.readBool()&&e.readBits(4)}}const{level:s,tier:g}=o[0],c=e.readBits(4),l=e.readBits(4),I=e.readBits(c+1)+1,d=e.readBits(l+1)+1;let h=!1;i||(h=e.readBool()),h&&(e.readBits(4),e.readBits(4)),e.readBool(),e.readBool(),e.readBool();let B=!1,u=2;i||(e.readBool(),e.readBool(),e.readBool(),e.readBool(),B=e.readBool(),B&&(e.readBool(),e.readBool()),u=e.readBool()?2:e.readBits(1),u&&(e.readBool()||e.readBits(1)),B&&e.readBits(3)),e.readBool(),e.readBool(),e.readBool();const E=e.readBool();let f=8;f=2===t&&E?e.readBool()?12:10:E?10:8;let Q=!1;1!==t&&(Q=e.readBool()),e.readBool()&&(e.readBits(8),e.readBits(8),e.readBits(8));let x=1,p=1;return Q?(e.readBits(1),x=1,p=1):(e.readBits(1),0===t?(x=1,p=1):1===t?(x=0,p=0):12===f?e.readBits(1)&&e.readBits(1):(x=1,p=0),x&&p&&e.readBits(2),e.readBits(1)),e.readBool(),e.destroy(),e=null,{codec_mimetype:`av01.${t}.${m.getLevelString(s,g)}.${f.toString(10).padStart(2,"0")}`,level:s,tier:g,level_string:m.getLevelString(s,g),profile_idc:t,profile_string:`${t}`,bit_depth:f,ref_frames:1,chroma_format:m.getChromaFormat(Q,x,p),chroma_format_string:m.getChromaFormatString(Q,x,p),frame_rate:{fixed:n,fps:a/r,fps_den:r,fps_num:a},sar_ratio:{width:1,height:1},codec_size:{width:I,height:d},present_size:{width:1*I,height:d}}}static getLevelString(A,e){return`${A.toString(10).padStart(2,"0")}${0===e?"M":"H"}`}static getChromaFormat(A,e,t){return A?0:0===e&&0===t?3:1===e&&0===t?2:1===e&&1===t?1:Number.NaN}static getChromaFormatString(A,e,t){return A?"4:0:0":0===e&&0===t?"4:4:4":1===e&&0===t?"4:2:2":1===e&&1===t?"4:2:0":"Unknown"}}const y=m;class _{constructor(A,e){this.TAG="FLVDemuxer",this._config=e,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=A.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=A.hasAudioTrack,this._hasVideo=A.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new r.Z,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){const A=new ArrayBuffer(2);return new DataView(A).setInt16(0,256,!0),256===new Int16Array(A)[0]}()}destroy(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null}static probe(A){const e=new Uint8Array(A);if(e.byteLength<9)return{needMoreData:!0};const t={match:!1};if(70!==e[0]||76!==e[1]||86!==e[2]||1!==e[3])return t;const i=(4&e[4])>>>2!=0,n=!!(1&e[4]),a=(r=e)[5]<<24|r[6]<<16|r[7]<<8|r[8];var r;return a<9?t:{match:!0,consumed:a,dataOffset:a,hasAudioTrack:i,hasVideoTrack:n}}bindDataSource(A){return A.onDataArrival=this.parseChunks.bind(this),this}get onTrackMetadata(){return this._onTrackMetadata}set onTrackMetadata(A){this._onTrackMetadata=A}get onMediaInfo(){return this._onMediaInfo}set onMediaInfo(A){this._onMediaInfo=A}get onMetaDataArrived(){return this._onMetaDataArrived}set onMetaDataArrived(A){this._onMetaDataArrived=A}get onScriptDataArrived(){return this._onScriptDataArrived}set onScriptDataArrived(A){this._onScriptDataArrived=A}get onError(){return this._onError}set onError(A){this._onError=A}get onDataAvailable(){return this._onDataAvailable}set onDataAvailable(A){this._onDataAvailable=A}get timestampBase(){return this._timestampBase}set timestampBase(A){this._timestampBase=A}get overridedDuration(){return this._duration}set overridedDuration(A){this._durationOverrided=!0,this._duration=A,this._mediaInfo&&(this._mediaInfo.duration=A)}set overridedHasAudio(A){this._hasAudioFlagOverrided=!0,this._hasAudio=A,this._mediaInfo&&(this._mediaInfo.hasAudio=A)}set overridedHasVideo(A){this._hasVideoFlagOverrided=!0,this._hasVideo=A,this._mediaInfo&&(this._mediaInfo.hasVideo=A)}resetMediaInfo(){this._mediaInfo=new r.Z}_isInitialMetadataDispatched(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched}parseChunks(A,e){var t,i;if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new g.rT("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");let a=0;const r=this._littleEndian;if(0===e){if(!(A.byteLength>13))return 0;{const e=_.probe(A);a=(null==e?void 0:e.dataOffset)||0}}for(this._firstParse&&(this._firstParse=!1,e+a!==this._dataOffset&&n.Z.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==new DataView(A,a).getUint32(0,!r)&&n.Z.w(this.TAG,"PrevTagSize0 !== 0 !!!"),a+=4);aA.byteLength)break;const i=t.getUint8(0),o=16777215&t.getUint32(0,!r);if(a+11+o+4>A.byteLength)break;if(8!==i&&9!==i&&18!==i){n.Z.w(this.TAG,`Unsupported tag type ${i}, skipped`),a+=11+o+4;continue}const s=t.getUint8(4),g=t.getUint8(5),c=t.getUint8(6)|g<<8|s<<16|t.getUint8(7)<<24;16777215&t.getUint32(7,!r)&&n.Z.w(this.TAG,"Meet tag which has StreamID != 0!");const l=a+11;switch(i){case 8:this._parseAudioData(A,l,o,c);break;case 9:this._parseVideoData(A,l,o,c,e+a);break;case 18:this._parseScriptData(A,l,o)}const I=t.getUint32(11+o,!r);I!==11+o&&n.Z.w(this.TAG,`Invalid PrevTagSize ${I}`),a+=11+o+4}return this._isInitialMetadataDispatched()&&this._dispatch&&((null===(t=this._audioTrack)||void 0===t?void 0:t.length)||(null===(i=this._videoTrack)||void 0===i?void 0:i.length))&&this._onDataAvailable(this._audioTrack,this._videoTrack),a}_parseScriptData(A,e,t){var i,a,r;const o=I.parseScriptData(A,e,t);if(o.hasOwnProperty("onMetaData")){if(null==o.onMetaData||"object"!=typeof o.onMetaData)return void n.Z.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&n.Z.w(this.TAG,"Found another onMetaData tag!"),this._metadata=o;const A=null===(i=this._metadata)||void 0===i?void 0:i.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},A)),"boolean"==typeof(null==A?void 0:A.hasAudio)&&(this._hasAudioFlagOverrided||(this._hasAudio=A.hasAudio,this._mediaInfo&&(this._mediaInfo.hasAudio=this._hasAudio))),"boolean"==typeof(null==A?void 0:A.hasVideo)&&(this._hasVideoFlagOverrided||(this._hasVideo=A.hasVideo,this._mediaInfo&&(this._mediaInfo.hasVideo=this._hasVideo))),"number"==typeof(null==A?void 0:A.audiodatarate)&&this._mediaInfo&&(this._mediaInfo.audioDataRate=A.audiodatarate),"number"==typeof(null==A?void 0:A.videodatarate)&&this._mediaInfo&&(this._mediaInfo.videoDataRate=A.videodatarate),"number"==typeof(null==A?void 0:A.width)&&this._mediaInfo&&(this._mediaInfo.width=A.width),"number"==typeof(null==A?void 0:A.height)&&this._mediaInfo&&(this._mediaInfo.height=A.height),"number"==typeof(null==A?void 0:A.duration)){if(!this._durationOverrided){const e=Math.floor(A.duration*this._timescale);this._duration=e,this._mediaInfo&&(this._mediaInfo.duration=e)}}else this._mediaInfo&&(this._mediaInfo.duration=0);if("number"==typeof(null==A?void 0:A.framerate)){const e=Math.floor(1e3*A.framerate);if(e>0){const A=e/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=A,this._referenceFrameRate.fps_num=e,this._referenceFrameRate.fps_den=1e3,this._mediaInfo&&(this._mediaInfo.fps=A)}}if("object"==typeof(null==A?void 0:A.keyframes)){this._mediaInfo&&(this._mediaInfo.hasKeyframesIndex=!0);const e=A.keyframes;this._mediaInfo&&(this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(e)),A.keyframes=null}else this._mediaInfo&&(this._mediaInfo.hasKeyframesIndex=!1);this._dispatch=!1,this._mediaInfo&&(this._mediaInfo.metadata=A),n.Z.v(this.TAG,"Parsed onMetaData"),(null===(a=this._mediaInfo)||void 0===a?void 0:a.isComplete())&&(null===(r=this._onMediaInfo)||void 0===r||r.call(this,this._mediaInfo))}Object.keys(o).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},o))}_parseKeyframesIndex(A){const e=[],t=[];for(let i=1;i>>4;if(2!==u&&10!==u)return void(null===(a=this._onError)||void 0===a||a.call(this,B.Z.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+u));let E=0;const f=(12&h)>>>2;if(!(f>=0&&f<=4))return void(null===(r=this._onError)||void 0===r||r.call(this,B.Z.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+f));E=this._flvSoundRateTable[f];const Q=1&h;let x=this._audioMetadata;const m=this._audioTrack;if(x||(!1!==this._hasAudio||this._hasAudioFlagOverrided||(this._hasAudio=!0,this._mediaInfo&&(this._mediaInfo.hasAudio=!0)),x=this._audioMetadata={},x.type="audio",x.id=null==m?void 0:m.id,x.timescale=this._timescale,x.duration=this._duration,x.audioSampleRate=E,x.channelCount=0===Q?1:2),10===u){const a=this._parseAACAudioData(A,e+1,t-1);if(void 0===a)return;if(0===(null==a?void 0:a.packetType)){if(null==x?void 0:x.config){if(p(a.data.config,null==x?void 0:x.config))return;n.Z.w(this.TAG,"AudioSpecificConfig has been changed, re-generate initialization segment")}const A=a.data;x.audioSampleRate=null==A?void 0:A.samplingRate,x.channelCount=null==A?void 0:A.channelCount,x.codec=null==A?void 0:A.codec,x.originalCodec=null==A?void 0:A.originalCodec,x.config=null==A?void 0:A.config,x.refSampleDuration=1024/x.audioSampleRate*x.timescale,n.Z.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&((null===(o=this._audioTrack)||void 0===o?void 0:o.length)||(null===(s=this._videoTrack)||void 0===s?void 0:s.length))&&(null===(g=this._onDataAvailable)||void 0===g||g.call(this,this._audioTrack,this._videoTrack)):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,null===(c=this._onTrackMetadata)||void 0===c||c.call(this,"audio",x);const e=this._mediaInfo;e.audioCodec=x.originalCodec||"",e.audioSampleRate=x.audioSampleRate,e.audioChannelCount=x.channelCount,e.hasVideo?null!=e.videoCodec&&(e.mimeType='video/x-flv; codecs="'+e.videoCodec+","+e.audioCodec+'"'):e.mimeType='video/x-flv; codecs="'+e.audioCodec+'"',(null==e?void 0:e.isComplete())&&(null===(l=this._onMediaInfo)||void 0===l||l.call(this,e))}else if(1===a.packetType){const A=this._timestampBase+i,e={unit:a.data,length:a.data.byteLength,dts:A,pts:A};m&&(null==m||m.samples.push(e),m.length+=(null===(I=null==a?void 0:a.data)||void 0===I?void 0:I.length)||0)}else n.Z.e(this.TAG,`Flv: Unsupported AAC data type ${a.packetType}`)}else if(2===u){if(!x.codec){const i=this._parseMP3AudioData(A,e+1,t-1,!0);if(void 0===i)return;x.audioSampleRate=i.samplingRate,x.channelCount=i.channelCount,x.codec=i.codec,x.originalCodec=i.originalCodec,x.refSampleDuration=1152/x.audioSampleRate*x.timescale,n.Z.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,null===(C=this._onTrackMetadata)||void 0===C||C.call(this,"audio",x);const a=this._mediaInfo;a.audioCodec=x.codec,a.audioSampleRate=x.audioSampleRate,a.audioChannelCount=x.channelCount,a.audioDataRate=i.bitRate,(null==a?void 0:a.hasVideo)?null!=a.videoCodec&&(a.mimeType='video/x-flv; codecs="'+a.videoCodec+","+a.audioCodec+'"'):a.mimeType='video/x-flv; codecs="'+a.audioCodec+'"',a.isComplete()&&(null===(d=this._onMediaInfo)||void 0===d||d.call(this,a))}const a=this._parseMP3AudioData(A,e+1,t-1,!1);if(void 0===a)return;const r=this._timestampBase+i,o={unit:a,length:a.byteLength,dts:r,pts:r};null==m||m.samples.push(o),m&&(m.length+=a.length)}}_parseAACAudioData(A,e,t){if(t<=1)return void n.Z.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");const i={},a=new Uint8Array(A,e,t);return i.packetType=a[0],0===a[0]?i.data=this._parseAACAudioSpecificConfig(A,e+1,t-1):i.data=a.subarray(1),i}_parseAACAudioSpecificConfig(A,e,t){var i,n;const a=new Uint8Array(A,e,t);let r=null,o=0,s=0,g=0,c=null;if(o=s=a[0]>>>3,g=(7&a[0])<<1|a[1]>>>7,g<0||g>=this._mpegSamplingRates.length)return void(null===(i=this._onError)||void 0===i||i.call(this,B.Z.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!"));const l=this._mpegSamplingRates[g],I=(120&a[1])>>>3;if(I<0||I>=8)return void(null===(n=this._onError)||void 0===n||n.call(this,B.Z.FORMAT_ERROR,"Flv: AAC invalid channel configuration"));5===o&&(c=(7&a[1])<<1|a[2]>>>7,a[2]);const C=self.navigator.userAgent.toLowerCase();return C.includes("firefox")?g>=6?(o=5,r=new Array(4),c=g-3):(o=2,r=new Array(2),c=g):C.includes("android")?(o=2,r=new Array(2),c=g):(o=5,c=g,r=new Array(4),g>=6?c=g-3:1===I&&(o=2,r=new Array(2),c=g)),r[0]=o<<3,r[0]|=(15&g)>>>1,r[1]=(15&g)<<7,r[1]|=(15&I)<<3,5===o&&(r[1]|=(15&c)>>>1,r[2]=(1&c)<<7,r[2]|=8,r[3]=0),{config:r,samplingRate:l,channelCount:I,codec:"mp4a.40."+o,originalCodec:"mp4a.40."+s}}_parseMP3AudioData(A,e,t,i){if(t<4)return void n.Z.w(this.TAG,"Flv: Invalid MP3 packet, header missing!");this._littleEndian;const a=new Uint8Array(A,e,t);let r;if(i){if(255!==a[0])return;const A=a[1]>>>3&3,e=(6&a[1])>>1,t=(240&a[2])>>>4,i=(12&a[2])>>>2,n=3&~(a[3]>>>6)?2:1;let o=0,s=0;const g="mp3";switch(A){case 0:o=this._mpegAudioV25SampleRateTable[i];break;case 2:o=this._mpegAudioV20SampleRateTable[i];break;case 3:o=this._mpegAudioV10SampleRateTable[i]}switch(e){case 1:t>>4;if(128&s){const n=15&s,r=String.fromCharCode(...new Uint8Array(A,e,t).slice(1,5));"hvc1"===r?this._parseEnhancedHEVCVideoPacket(A,e+5,t-5,i,a,g,n):"av01"===r?this._parseEnhancedAV1VideoPacket(A,e+5,t-5,i,a,g,n):null===(o=this._onError)||void 0===o||o.call(this,B.Z.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${r}`)}else{const n=15&s;7===n?this._parseAVCVideoPacket(A,e+1,t-1,i,a,g):12===n?this._parseHEVCVideoPacket(A,e+1,t-1,i,a,g):null===(r=this._onError)||void 0===r||r.call(this,B.Z.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${n}`)}}_parseAVCVideoPacket(A,e,t,i,a,r){var o;if(t<4)return void n.Z.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");const s=this._littleEndian,g=new DataView(A,e,t),c=g.getUint8(0),l=(16777215&g.getUint32(0,!s))<<8>>8;0===c?this._parseAVCDecoderConfigurationRecord(A,e+4,t-4):1===c?this._parseAVCVideoData(A,e+4,t-4,i,a,r,l):2===c||null===(o=this._onError)||void 0===o||o.call(this,B.Z.FORMAT_ERROR,`Flv: Invalid video packet type ${c}`)}_parseHEVCVideoPacket(A,e,t,i,a,r){var o;if(t<4)return void n.Z.w(this.TAG,"Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime");const s=this._littleEndian,g=new DataView(A,e,t),c=g.getUint8(0),l=(16777215&g.getUint32(0,!s))<<8>>8;0===c?this._parseHEVCDecoderConfigurationRecord(A,e+4,t-4):1===c?this._parseHEVCVideoData(A,e+4,t-4,i,a,r,l):2===c||null===(o=this._onError)||void 0===o||o.call(this,B.Z.FORMAT_ERROR,`Flv: Invalid video packet type ${c}`)}_parseEnhancedHEVCVideoPacket(A,e,t,i,n,a,r){var o;const s=this._littleEndian,g=new DataView(A,e,t);if(0===r)this._parseHEVCDecoderConfigurationRecord(A,e,t);else if(1===r){const r=(4294967040&g.getUint32(0,!s))>>8;this._parseHEVCVideoData(A,e+3,t-3,i,n,a,r)}else 3===r?this._parseHEVCVideoData(A,e,t,i,n,a,0):2===r||null===(o=this._onError)||void 0===o||o.call(this,B.Z.FORMAT_ERROR,`Flv: Invalid video packet type ${r}`)}_parseEnhancedAV1VideoPacket(A,e,t,i,n,a,r){var o,s;this._littleEndian,0===r?this._parseAV1CodecConfigurationRecord(A,e,t):1===r?this._parseAV1VideoData(A,e,t,i,n,a,0):5===r?null===(o=this._onError)||void 0===o||o.call(this,B.Z.FORMAT_ERROR,`Flv: Not Suported MP2T AV1 video packet type ${r}`):2===r||null===(s=this._onError)||void 0===s||s.call(this,B.Z.FORMAT_ERROR,`Flv: Invalid video packet type ${r}`)}_parseAVCDecoderConfigurationRecord(A,e,t){var i,a,r,o,s,g,c,l,I,C,d;if(t<7)return void n.Z.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");let u=this._videoMetadata;const E=this._videoTrack,f=this._littleEndian,Q=new DataView(A,e,t);if(u){if(void 0!==u.avcc){const i=new Uint8Array(A,e,t);if(p(i,u.avcc))return;n.Z.w(this.TAG,"AVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else!1!==this._hasVideo||this._hasVideoFlagOverrided||(this._hasVideo=!0,this._mediaInfo&&(this._mediaInfo.hasVideo=!0)),u=this._videoMetadata={},u.type="video",u.id=null==E?void 0:E.id,u.timescale=this._timescale,u.duration=this._duration;const x=Q.getUint8(0),m=Q.getUint8(1);if(Q.getUint8(2),Q.getUint8(3),1!==x||0===m)return void(null===(i=this._onError)||void 0===i||i.call(this,B.Z.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord"));if(this._naluLengthSize=1+(3&Q.getUint8(4)),3!==this._naluLengthSize&&4!==this._naluLengthSize)return void(null===(a=this._onError)||void 0===a||a.call(this,B.Z.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1)));const y=31&Q.getUint8(5);if(0===y)return void(null===(r=this._onError)||void 0===r||r.call(this,B.Z.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS"));y>1&&n.Z.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${y}`);let _=6;for(let t=0;t1&&n.Z.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${S}`),_++;for(let A=0;A=t){n.Z.w(this.TAG,`Malformed Nalu near timestamp ${d}, offset = ${I}, dataSize = ${t}`);break}let i=g.getUint32(I,!s);if(3===C&&(i>>>=8),i>t-C)return void n.Z.w(this.TAG,`Malformed Nalus near timestamp ${d}, NaluSize > DataSize!`);const a=31&g.getUint8(I+C);5===a&&(h=!0);const r=new Uint8Array(A,e+I,C+i),o={type:a,data:r};c.push(o),l+=r.byteLength,I+=C+i}if(c.length){const A=this._videoTrack,e={units:c,length:l,isKeyframe:h,dts:d,cts:o,pts:d+o};h&&(e.fileposition=a),A&&(A.samples.push(e),A.length+=l)}}_parseHEVCVideoData(A,e,t,i,a,r,o){const s=this._littleEndian,g=new DataView(A,e,t),c=[];let l=0,I=0;const C=this._naluLengthSize,d=this._timestampBase+i;let h=1===r;for(;I=t){n.Z.w(this.TAG,`Malformed Nalu near timestamp ${d}, offset = ${I}, dataSize = ${t}`);break}let i=g.getUint32(I,!s);if(3===C&&(i>>>=8),i>t-C)return void n.Z.w(this.TAG,`Malformed Nalus near timestamp ${d}, NaluSize > DataSize!`);const a=31&g.getUint8(I+C);19!==a&&20!==a||(h=!0);const r=new Uint8Array(A,e+I,C+i),o={type:a,data:r};c.push(o),l+=r.byteLength,I+=C+i}if(c.length){const A=this._videoTrack,e={units:c,length:l,isKeyframe:h,dts:d,cts:o,pts:d+o};h&&(e.fileposition=a),A&&(null==A||A.samples.push(e),A.length+=l)}}_parseAV1VideoData(A,e,t,i,n,a,r){this._littleEndian;const o=[];let s=0;const g=this._timestampBase+i,c=1===a;if(s=t,o.push({unitType:0,data:new Uint8Array(A,e+0,t)}),o.length){const A=this._videoTrack,e={units:o,length:s,isKeyframe:c,dts:g,cts:r,pts:g+r};c&&(e.fileposition=n),A&&(null==A||A.samples.push(e),A.length+=s)}}}const S=_;class D{constructor(){}destroy(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onSMPTE2038Metadata=null,this.onSCTE35Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null}}class w{constructor(){this.program_pmt_pid={}}}var v,F,b,R;!function(A){A[A.kMPEG1Audio=3]="kMPEG1Audio",A[A.kMPEG2Audio=4]="kMPEG2Audio",A[A.kPESPrivateData=6]="kPESPrivateData",A[A.kADTSAAC=15]="kADTSAAC",A[A.kLOASAAC=17]="kLOASAAC",A[A.kAC3=129]="kAC3",A[A.kEAC3=135]="kEAC3",A[A.kID3=21]="kID3",A[A.kSCTE35=134]="kSCTE35",A[A.kH264=27]="kH264",A[A.kH265=36]="kH265"}(v||(v={}));class k{constructor(){this.pid_stream_type={},this.common_pids={h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},this.pes_private_data_pids={},this.timed_id3_pids={},this.scte_35_pids={},this.smpte2038_pids={}}}class P{}class N{}class M{constructor(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0,this.random_access_indicator=0}}!function(A){A[A.kUnspecified=0]="kUnspecified",A[A.kSliceNonIDR=1]="kSliceNonIDR",A[A.kSliceDPA=2]="kSliceDPA",A[A.kSliceDPB=3]="kSliceDPB",A[A.kSliceDPC=4]="kSliceDPC",A[A.kSliceIDR=5]="kSliceIDR",A[A.kSliceSEI=6]="kSliceSEI",A[A.kSliceSPS=7]="kSliceSPS",A[A.kSlicePPS=8]="kSlicePPS",A[A.kSliceAUD=9]="kSliceAUD",A[A.kEndOfSequence=10]="kEndOfSequence",A[A.kEndOfStream=11]="kEndOfStream",A[A.kFiller=12]="kFiller",A[A.kSPSExt=13]="kSPSExt",A[A.kReserved0=14]="kReserved0"}(F||(F={}));class T{}class L{constructor(A){const e=A.data.byteLength;this.type=A.type,this.data=new Uint8Array(4+e),new DataView(this.data.buffer).setUint32(0,e),this.data.set(A.data,4)}}class Y{constructor(A){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=A,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&n.Z.e(this.TAG,"Could not find H264 startcode until payload end!")}findNextStartCodeOffset(A){let e=A;const t=this.data_;for(;;){if(e+3>=t.byteLength)return this.eof_flag_=!0,t.byteLength;const A=t[e+0]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],i=t[e+0]<<16|t[e+1]<<8|t[e+2];if(1===A||1===i)return e;e++}}readNextNaluPayload(){const A=this.data_;let e=null;for(;null==e&&!this.eof_flag_;){let t=this.current_startcode_offset_;t+=1==(A[t]<<24|A[t+1]<<16|A[t+2]<<8|A[t+3])?4:3;const i=31&A[t],n=(128&A[t])>>>7,a=this.findNextStartCodeOffset(t);if(this.current_startcode_offset_=a,i>=F.kReserved0)continue;if(0!==n)continue;const r=A.subarray(t,a);e=new T,e.type=i,e.data=r}return e}}class G{constructor(A,e,t){let i=8+A.byteLength+1+2+e.byteLength,n=!1;66!==A[3]&&77!==A[3]&&88!==A[3]&&(n=!0,i+=4);const a=this.data=new Uint8Array(i);a[0]=1,a[1]=A[1],a[2]=A[2],a[3]=A[3],a[4]=255,a[5]=225;const r=A.byteLength;a[6]=r>>>8,a[7]=255&r;let o=8;a.set(A,8),o+=r,a[o]=1;const s=e.byteLength;a[o+1]=s>>>8,a[o+2]=255&s,a.set(e,o+3),o+=3+s,n&&(a[o]=252|t.chroma_format_idc,a[o+1]=248|t.bit_depth_luma-8,a[o+2]=248|t.bit_depth_chroma-8,a[o+3]=0,o+=4)}getData(){return this.data}}!function(A){A[A.kNull=0]="kNull",A[A.kAACMain=1]="kAACMain",A[A.kAAC_LC=2]="kAAC_LC",A[A.kAAC_SSR=3]="kAAC_SSR",A[A.kAAC_LTP=4]="kAAC_LTP",A[A.kAAC_SBR=5]="kAAC_SBR",A[A.kAAC_Scalable=6]="kAAC_Scalable",A[A.kLayer1=32]="kLayer1",A[A.kLayer2=33]="kLayer2",A[A.kLayer3=34]="kLayer3"}(b||(b={})),function(A){A[A.k96000Hz=0]="k96000Hz",A[A.k88200Hz=1]="k88200Hz",A[A.k64000Hz=2]="k64000Hz",A[A.k48000Hz=3]="k48000Hz",A[A.k44100Hz=4]="k44100Hz",A[A.k32000Hz=5]="k32000Hz",A[A.k24000Hz=6]="k24000Hz",A[A.k22050Hz=7]="k22050Hz",A[A.k16000Hz=8]="k16000Hz",A[A.k12000Hz=9]="k12000Hz",A[A.k11025Hz=10]="k11025Hz",A[A.k8000Hz=11]="k8000Hz",A[A.k7350Hz=12]="k7350Hz"}(R||(R={}));const U=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class J{}class H extends J{}class K{constructor(A){this.TAG="AACADTSParser",this.data_=A,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&n.Z.e(this.TAG,"Could not found ADTS syncword until payload end")}findNextSyncwordOffset(A){let e=A;const t=this.data_;for(;;){if(e+7>=t.byteLength)return this.eof_flag_=!0,t.byteLength;if(4095==(t[e+0]<<8|t[e+1])>>>4)return e;e++}}readNextAACFrame(){const A=this.data_;let e=null;for(;null==e&&!this.eof_flag_;){let t=this.current_syncword_offset_;const i=(8&A[t+1])>>>3,n=(6&A[t+1])>>>1,a=1&A[t+1],r=(192&A[t+2])>>>6,o=(60&A[t+2])>>>2,s=(1&A[t+2])<<2|(192&A[t+3])>>>6,g=(3&A[t+3])<<11|A[t+4]<<3|(224&A[t+5])>>>5;if(A[t+6],t+g>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}const c=1===a?7:9,l=g-c;t+=c;const I=this.findNextSyncwordOffset(t+l);if(this.current_syncword_offset_=I,0!==i&&1!==i||0!==n)continue;const C=A.subarray(t,t+l);e=new J,e.audio_object_type=r+1,e.sampling_freq_index=o,e.sampling_frequency=U[o],e.channel_config=s,e.data=C}return e}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class V{constructor(A){this.TAG="AACLOASParser",this.data_=A,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&n.Z.e(this.TAG,"Could not found LOAS syncword until payload end")}findNextSyncwordOffset(A){let e=A;const t=this.data_;for(;;){if(e+1>=t.byteLength)return this.eof_flag_=!0,t.byteLength;if(695==(t[e+0]<<3|t[e+1]>>>5))return e;e++}}getLATMValue(A){const e=A.readBits(2);let t=0;for(let i=0;i<=e;i++)t<<=8,t|=A.readByte();return t}readNextAACFrame(A){const e=this.data_;let t=null;for(;null==t&&!this.eof_flag_;){const i=this.current_syncword_offset_,a=(31&e[i+1])<<8|e[i+2];if(i+3+a>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}const r=new C(e.subarray(i+3,i+3+a));let o=null;if(r.readBool()){if(null==A){n.Z.w(this.TAG,"StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+a),r.destroy();continue}o=A}else{const A=r.readBool();if(A&&r.readBool()){n.Z.e(this.TAG,"audioMuxVersionA is Not Supported"),r.destroy();break}if(A&&this.getLATMValue(r),!r.readBool()){n.Z.e(this.TAG,"allStreamsSameTimeFraming zero is Not Supported"),r.destroy();break}if(0!==r.readBits(6)){n.Z.e(this.TAG,"more than 2 numSubFrames Not Supported"),r.destroy();break}if(0!==r.readBits(4)){n.Z.e(this.TAG,"more than 2 numProgram Not Supported"),r.destroy();break}if(0!==r.readBits(3)){n.Z.e(this.TAG,"more than 2 numLayer Not Supported"),r.destroy();break}let e=A?this.getLATMValue(r):0;const t=r.readBits(5);e-=5;const i=r.readBits(4);e-=4;const a=r.readBits(4);e-=4,r.readBits(3),e-=3,e>0&&r.readBits(e);const s=r.readBits(3);if(0!==s){n.Z.e(this.TAG,`frameLengthType = ${s}. Only frameLengthType = 0 Supported`),r.destroy();break}r.readByte();const g=r.readBool();if(g)if(A)this.getLATMValue(r);else{let A=0;for(;;){A<<=8;const e=r.readBool();if(A+=r.readByte(),!e)break}console.log(A)}r.readBool()&&r.readByte(),o=new H,o.audio_object_type=t,o.sampling_freq_index=i,o.sampling_frequency=U[o.sampling_freq_index],o.channel_config=a,o.other_data_present=g}let s=0;for(;;){const A=r.readByte();if(s+=A,255!==A)break}const g=new Uint8Array(s);for(let A=0;A=6?(i=5,e=new Array(4),r=n-3):(i=2,e=new Array(2),r=n):o.includes("android")?(i=2,e=new Array(2),r=n):(i=5,r=n,e=new Array(4),n>=6?r=n-3:1===a&&(i=2,e=new Array(2),r=n)),e[0]=i<<3,e[0]|=(15&n)>>>1,e[1]=(15&n)<<7,e[1]|=(15&a)<<3,5===i&&(e[1]|=(15&r)>>>1,e[2]=(1&r)<<7,e[2]|=8,e[3]=0),this.config=e,this.sampling_rate=U[n],this.channel_count=a,this.codec_mimetype="mp4a.40."+i.toString(),this.original_codec_mimetype="mp4a.40."+t.toString()}}class j{}class O{}var Z;!function(A){A[A.kSpliceNull=0]="kSpliceNull",A[A.kSpliceSchedule=4]="kSpliceSchedule",A[A.kSpliceInsert=5]="kSpliceInsert",A[A.kTimeSignal=6]="kTimeSignal",A[A.kBandwidthReservation=7]="kBandwidthReservation",A[A.kPrivateCommand=255]="kPrivateCommand"}(Z||(Z={}));const q=A=>{const e=A.readBool();return e?(A.readBits(6),{time_specified_flag:e,pts_time:4*A.readBits(31)+A.readBits(2)}):(A.readBits(7),{time_specified_flag:e})},X=A=>{const e=A.readBool();return A.readBits(6),{auto_return:e,duration:4*A.readBits(31)+A.readBits(2)}},z=(A,e)=>{const t=e.readBits(8);return A?{component_tag:t}:{component_tag:t,splice_time:q(e)}},$=A=>({component_tag:A.readBits(8),utc_splice_time:A.readBits(32)}),AA=A=>{const e=A.readBits(32),t=A.readBool();A.readBits(7);const i={splice_event_id:e,splice_event_cancel_indicator:t};if(t)return i;if(i.out_of_network_indicator=A.readBool(),i.program_splice_flag=A.readBool(),i.duration_flag=A.readBool(),A.readBits(5),i.program_splice_flag)i.utc_splice_time=A.readBits(32);else{i.component_count=A.readBits(8),i.components=[];for(let e=0;e({descriptor_tag:A,descriptor_length:e,identifier:t,provider_avail_id:i.readBits(32)}),tA=(A,e,t,i)=>{const n=i.readBits(8),a=i.readBits(3);i.readBits(5);let r="";for(let A=0;A{const e=A.readBits(8);return A.readBits(7),{component_tag:e,pts_offset:4*A.readBits(31)+A.readBits(2)}},nA=(A,e,t,i)=>{const n=i.readBits(32),a=i.readBool();i.readBits(7);const r={descriptor_tag:A,descriptor_length:e,identifier:t,segmentation_event_id:n,segmentation_event_cancel_indicator:a};if(a)return r;if(r.program_segmentation_flag=i.readBool(),r.segmentation_duration_flag=i.readBool(),r.delivery_not_restricted_flag=i.readBool(),r.delivery_not_restricted_flag?i.readBits(5):(r.web_delivery_allowed_flag=i.readBool(),r.no_regional_blackout_flag=i.readBool(),r.archive_allowed_flag=i.readBool(),r.device_restrictions=i.readBits(2)),!r.program_segmentation_flag){r.component_count=i.readBits(8),r.components=[];for(let A=0;A({descriptor_tag:A,descriptor_length:e,identifier:t,TAI_seconds:i.readBits(48),TAI_ns:i.readBits(32),UTC_offset:i.readBits(16)}),rA=A=>({component_tag:A.readBits(8),ISO_code:String.fromCharCode(A.readBits(8),A.readBits(8),A.readBits(8)),Bit_Stream_Mode:A.readBits(3),Num_Channels:A.readBits(4),Full_Srvc_Audio:A.readBool()}),oA=(A,e,t,i)=>{const n=i.readBits(4),a=[];for(let A=0;A=t.byteLength)return this.eof_flag_=!0,t.byteLength;const A=t[e+0]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],i=t[e+0]<<16|t[e+1]<<8|t[e+2];if(1===A||1===i)return e;e++}}readNextNaluPayload(){const A=this.data_;let e=null;for(;null==e&&!this.eof_flag_;){let t=this.current_startcode_offset_;t+=1==(A[t]<<24|A[t+1]<<16|A[t+2]<<8|A[t+3])?4:3;const i=A[t]>>1&63,n=(128&A[t])>>>7,a=this.findNextStartCodeOffset(t);if(this.current_startcode_offset_=a,0!==n)continue;const r=A.subarray(t,a);e=new gA,e.type=i,e.data=r}return e}}class IA{constructor(A,e,t,i){const n=23+(5+A.byteLength)+(5+e.byteLength)+(5+t.byteLength),a=this.data=new Uint8Array(n);a[0]=1,a[1]=(3&i.general_profile_space)<<6|(i.general_tier_flag?1:0)<<5|31&i.general_profile_idc,a[2]=i.general_profile_compatibility_flags_1,a[3]=i.general_profile_compatibility_flags_2,a[4]=i.general_profile_compatibility_flags_3,a[5]=i.general_profile_compatibility_flags_4,a[6]=i.general_constraint_indicator_flags_1,a[7]=i.general_constraint_indicator_flags_2,a[8]=i.general_constraint_indicator_flags_3,a[9]=i.general_constraint_indicator_flags_4,a[10]=i.general_constraint_indicator_flags_5,a[11]=i.general_constraint_indicator_flags_6,a[12]=i.general_level_idc,a[13]=240|(3840&i.min_spatial_segmentation_idc)>>8,a[14]=255&i.min_spatial_segmentation_idc,a[15]=252|3&i.parallelismType,a[16]=252|3&i.chroma_format_idc,a[17]=248|7&i.bit_depth_luma_minus8,a[18]=248|7&i.bit_depth_chroma_minus8,a[19]=0,a[20]=0,a[21]=(3&i.constant_frame_rate)<<6|(7&i.num_temporal_layers)<<3|(i.temporal_id_nested?1:0)<<2|3,a[22]=3,a[23]=128|sA.kSliceVPS,a[24]=0,a[25]=1,a[26]=(65280&A.byteLength)>>8,a[27]=255&A.byteLength,a.set(A,28),a[23+(5+A.byteLength)+0]=128|sA.kSliceSPS,a[23+(5+A.byteLength)+1]=0,a[23+(5+A.byteLength)+2]=1,a[23+(5+A.byteLength)+3]=(65280&e.byteLength)>>8,a[23+(5+A.byteLength)+4]=255&e.byteLength,a.set(e,23+(5+A.byteLength)+5),a[23+(5+A.byteLength+5+e.byteLength)+0]=128|sA.kSlicePPS,a[23+(5+A.byteLength+5+e.byteLength)+1]=0,a[23+(5+A.byteLength+5+e.byteLength)+2]=1,a[23+(5+A.byteLength+5+e.byteLength)+3]=(65280&t.byteLength)>>8,a[23+(5+A.byteLength+5+e.byteLength)+4]=255&t.byteLength,a.set(t,23+(5+A.byteLength+5+e.byteLength)+5)}getData(){return this.data}}class CA{}class dA{}class hA{}const BA=[[64,64,80,80,96,96,112,112,128,128,160,160,192,192,224,224,256,256,320,320,384,384,448,448,512,512,640,640,768,768,896,896,1024,1024,1152,1152,1280,1280],[69,70,87,88,104,105,121,122,139,140,174,175,208,209,243,244,278,279,348,349,417,418,487,488,557,558,696,697,835,836,975,976,1114,1115,1253,1254,1393,1394],[96,96,120,120,144,144,168,168,192,192,240,240,288,288,336,336,384,384,480,480,576,576,672,672,768,768,960,960,1152,1152,1344,1344,1536,1536,1728,1728,1920,1920]];class uA{constructor(A){this.TAG="AC3Parser",this.data_=A,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&n.Z.e(this.TAG,"Could not found AC3 syncword until payload end")}findNextSyncwordOffset(A){let e=A;const t=this.data_;for(;;){if(e+7>=t.byteLength)return this.eof_flag_=!0,t.byteLength;if(2935==(t[e+0]<<8|t[e+1]))return e;e++}}readNextAC3Frame(){const A=this.data_;let e=null;for(;null==e&&!this.eof_flag_;){const t=this.current_syncword_offset_,i=A[t+4]>>6,n=[48e3,44200,33e3][i],a=63&A[t+4],r=2*BA[i][a];if(t+r>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}const o=this.findNextSyncwordOffset(t+r);this.current_syncword_offset_=o;const s=A[t+5]>>3,g=7&A[t+5],c=A[t+6]>>5;let l=0;!!(1&c)&&1!==c&&(l+=2),!!(4&c)&&(l+=2),2===c&&(l+=2);const I=(A[t+6]<<8|A[t+7])>>12-l&1,C=[2,1,2,3,3,4,4,5][c]+I;e=new hA,e.sampling_frequency=n,e.channel_count=C,e.channel_mode=c,e.bit_stream_identification=s,e.low_frequency_effects_channel_on=I,e.bit_stream_mode=g,e.frame_size_code=a,e.data=A.subarray(t,t+r)}return e}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class EA{constructor(A){let e=[];e=[A.sampling_rate_code<<6|A.bit_stream_identification<<1|A.bit_stream_mode>>2,(3&A.bit_stream_mode)<<6|A.channel_mode<<3|A.low_frequency_effects_channel_on<<2|A.frame_size_code>>4,A.frame_size_code<<4&224],this.config=e,this.sampling_rate=A.sampling_frequency,this.bit_stream_identification=A.bit_stream_identification,this.bit_stream_mode=A.bit_stream_mode,this.low_frequency_effects_channel_on=A.low_frequency_effects_channel_on,this.channel_count=A.channel_count,this.channel_mode=A.channel_mode,this.codec_mimetype="ac-3",this.original_codec_mimetype="ac-3"}}class fA{}class QA{constructor(A){this.TAG="EAC3Parser",this.data_=A,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&n.Z.e(this.TAG,"Could not found AC3 syncword until payload end")}findNextSyncwordOffset(A){let e=A;const t=this.data_;for(;;){if(e+7>=t.byteLength)return this.eof_flag_=!0,t.byteLength;if(2935==(t[e+0]<<8|t[e+1]))return e;e++}}readNextEAC3Frame(){const A=this.data_;let e=null;for(;null==e&&!this.eof_flag_;){const t=this.current_syncword_offset_,i=new C(A.subarray(t+2)),n=(i.readBits(2),i.readBits(3),i.readBits(11)+1<<1);let a=i.readBits(2),r=null,o=null;3===a?(a=i.readBits(2),r=[24e3,22060,16e3][a],o=3):(r=[48e3,44100,32e3][a],o=i.readBits(2));const s=i.readBits(3),g=i.readBits(1),c=i.readBits(5);if(t+n>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}const l=this.findNextSyncwordOffset(t+n);this.current_syncword_offset_=l;const I=[2,1,2,3,3,4,4,5][s]+g;i.destroy(),e=new fA,e.sampling_frequency=r,e.channel_count=I,e.channel_mode=s,e.bit_stream_identification=c,e.low_frequency_effects_channel_on=g,e.frame_size=n,e.num_blks=[1,2,3,6][o],e.data=A.subarray(t,t+n)}return e}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class xA{constructor(A){let e=[];const t=Math.floor(A.frame_size*A.sampling_frequency/(16*A.num_blks));e=[255&t,248&t,A.sampling_rate_code<<6|A.bit_stream_identification<<1,A.channel_mode<<1|A.low_frequency_effects_channel_on,0],this.config=e,this.sampling_rate=A.sampling_frequency,this.bit_stream_identification=A.bit_stream_identification,this.num_blks=A.num_blks,this.low_frequency_effects_channel_on=A.low_frequency_effects_channel_on,this.channel_count=A.channel_count,this.channel_mode=A.channel_mode,this.codec_mimetype="ec-3",this.original_codec_mimetype="ec-3"}}const pA=class extends D{constructor(A,e){super(),this.TAG="TSDemuxer",this.first_parse_=!0,this.media_info_=new r.Z,this.timescale_=90,this.duration_=0,this.current_pmt_pid_=-1,this.program_pmt_map_={},this.pes_slice_queues_={},this.section_slice_queues_={},this.video_metadata_={vps:void 0,sps:void 0,pps:void 0,details:void 0},this.audio_metadata_={codec:void 0,audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},this.aac_last_sample_pts_=void 0,this.aac_last_incomplete_data_=null,this.has_video_=!1,this.has_audio_=!1,this.video_init_segment_dispatched_=!1,this.audio_init_segment_dispatched_=!1,this.video_metadata_changed_=!1,this.audio_metadata_changed_=!1,this.loas_previous_frame=null,this.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this.ts_packet_size_=A.ts_packet_size,this.sync_offset_=A.sync_offset,this.config_=e}destroy(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,super.destroy()}static probe(A){const e=new Uint8Array(A);let t=-1,i=188;if(e.byteLength<=3*i)return{needMoreData:!0};for(;-1===t;){const A=Math.min(1e3,e.byteLength-3*i);for(let n=0;n=4?(n.Z.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),t-=4):204===i&&n.Z.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:i,sync_offset:t})}bindDataSource(A){return A.onDataArrival=this.parseChunks.bind(this),this}resetMediaInfo(){this.media_info_=new r.Z}parseChunks(A,e){var t;if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new g.rT("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");let i=0;for(this.first_parse_&&(this.first_parse_=!1,i=this.sync_offset_);i+this.ts_packet_size_<=A.byteLength;){const a=e+i;192===this.ts_packet_size_&&(i+=4);const r=new Uint8Array(A,i,188),o=r[0];if(71!==o){n.Z.e(this.TAG,`sync_byte = ${o}, not 0x47`);break}const s=(64&r[1])>>>6,g=(r[1],(31&r[1])<<8|r[2]),c=(48&r[3])>>>4,l=15&r[3];let I={},C=4;if(2===c||3===c){const e=r[4];if(5+e===188){i+=188,204===this.ts_packet_size_&&(i+=16);continue}e>0&&(I=this.parseAdaptationField(A,i+4,1+e)),C=5+e}if(1===c||3===c)if(0===g||g===this.current_pmt_pid_||void 0!==this.pmt_&&this.pmt_.pid_stream_type[g]===v.kSCTE35){const e=188-C;this.handleSectionSlice(A,i+C,e,{pid:g,file_position:a,payload_unit_start_indicator:s,continuity_conunter:l,random_access_indicator:I.random_access_indicator})}else if(void 0!==(null===(t=this.pmt_)||void 0===t?void 0:t.pid_stream_type[g])){const e=188-C,t=this.pmt_.pid_stream_type[g];(g===this.pmt_.common_pids.h264||g===this.pmt_.common_pids.h265||g===this.pmt_.common_pids.adts_aac||g===this.pmt_.common_pids.loas_aac||g===this.pmt_.common_pids.ac3||g===this.pmt_.common_pids.eac3||g===this.pmt_.common_pids.opus||g===this.pmt_.common_pids.mp3||this.pmt_.pes_private_data_pids[g]||this.pmt_.timed_id3_pids[g])&&this.handlePESSlice(A,i+C,e,{pid:g,stream_type:t,file_position:a,payload_unit_start_indicator:s,continuity_conunter:l,random_access_indicator:I.random_access_indicator})}i+=188,204===this.ts_packet_size_&&(i+=16)}return this.dispatchAudioVideoMediaSegment(),i}parseAdaptationField(A,e,t){const i=new Uint8Array(A,e,t),a=i[0];return a>0?a>183?(n.Z.w(this.TAG,`Illegal adaptation_field_length: ${a}`),{}):{discontinuity_indicator:(128&i[1])>>>7,random_access_indicator:(64&i[1])>>>6,elementary_stream_priority_indicator:(32&i[1])>>>5}:{}}handleSectionSlice(A,e,t,i){const n=new Uint8Array(A,e,t);let a=this.section_slice_queues_?this.section_slice_queues_[i.pid]:{};if(i.payload_unit_start_indicator){const r=n[0];if(void 0!==a&&0!==(null==a?void 0:a.total_length)){const n=new Uint8Array(A,e+1,Math.min(t,r));a.slices.push(n),a.total_length+=n.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,i):this.clearSlices(a,i)}for(let o=1+r;o=a.expected_length&&this.clearSlices(a,i),o+=s.byteLength}}else if(void 0!==a&&0!==a.total_length){const n=new Uint8Array(A,e,Math.min(t,a.expected_length-a.total_length));a.slices.push(n),a.total_length+=n.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,i):a.total_length>=a.expected_length&&this.clearSlices(a,i)}}handlePESSlice(A,e,t,i){const a=new Uint8Array(A,e,t),r=a[0]<<16|a[1]<<8|a[2],o=(a[3],a[4]<<8|a[5]);if(i.payload_unit_start_indicator){if(1!==r)return void n.Z.e(this.TAG,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${r}`);const A=this.pes_slice_queues_[i.pid];A&&(0===A.expected_length||A.expected_length===A.total_length?this.emitPESSlices(A,i):this.clearSlices(A,i)),this.pes_slice_queues_&&(this.pes_slice_queues_[i.pid]=new M,this.pes_slice_queues_[i.pid].file_position=i.file_position,this.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator)}if(void 0===this.pes_slice_queues_[i.pid])return;const s=this.pes_slice_queues_[i.pid];s.slices.push(a),i.payload_unit_start_indicator&&(s.expected_length=0===o?0:o+6),s.total_length+=a.byteLength,s.expected_length>0&&s.expected_length===s.total_length?this.emitPESSlices(s,i):s.expected_length>0&&s.expected_length>>6,r=e[8];let o,s;2!==t&&3!==t||(o=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,s=3===t?536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2:o);const g=9+r;let c;if(0!==a){if(a<3+r)return void n.Z.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");c=a-3-r}else c=e.byteLength-g;const l=e.subarray(g,g+c);switch(A.stream_type){case v.kMPEG1Audio:case v.kMPEG2Audio:this.parseMP3Payload(l,o);break;case v.kPESPrivateData:this.pmt_.common_pids.opus===A.pid?this.parseOpusPayload(l,o):this.pmt_.common_pids.ac3===A.pid?this.parseAC3Payload(l,o):this.pmt_.common_pids.eac3===A.pid?this.parseEAC3Payload(l,o):this.pmt_.smpte2038_pids[A.pid]?this.parseSMPTE2038MetadataPayload(l,o,s,A.pid,i):this.parsePESPrivateDataPayload(l,o,s,A.pid,i);break;case v.kADTSAAC:this.parseADTSAACPayload(l,o);break;case v.kLOASAAC:this.parseLOASAACPayload(l,o);break;case v.kAC3:this.parseAC3Payload(l,o);break;case v.kEAC3:this.parseEAC3Payload(l,o);break;case v.kID3:this.parseTimedID3MetadataPayload(l,o,s,A.pid,i);break;case v.kH264:this.parseH264Payload(l,o,s,A.file_position,A.random_access_indicator);break;case v.kH265:this.parseH265Payload(l,o,s,A.file_position,A.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&A.stream_type===v.kPESPrivateData){const t=6;let n;n=0!==a?a:e.byteLength-t;const r=e.subarray(t,t+n);this.parsePESPrivateDataPayload(r,void 0,void 0,A.pid,i)}}else n.Z.e(this.TAG,`parsePES: packet_start_code_prefix should be 1 but with value ${t}`)}parsePAT(A){const e=A[0];if(0!==e)return void n.Z.e(this.TAG,`parsePAT: table_id ${e} is not corresponded to PAT!`);const t=(15&A[1])<<8|A[2],i=(A[3],A[4],(62&A[5])>>>1),a=1&A[5],r=A[6];A[7];let o=null;if(1===a&&0===r)o=new w,o.version_number=i;else if(o=this.pat_,null==o)return;const s=t-5-4;let g=-1,c=-1;for(let e=8;e<8+s;e+=4){const t=A[e]<<8|A[e+1],i=(31&A[e+2])<<8|A[e+3];0===t?o.network_pid=i:(o.program_pmt_pid[t]=i,-1===g&&(g=t),-1===c&&(c=i))}1===a&&0===r&&(void 0===this.pat_&&n.Z.v(this.TAG,`Parsed first PAT: ${JSON.stringify(o)}`),this.pat_=o,this.current_program_=g,this.current_pmt_pid_=c)}parsePMT(A){const e=A[0];if(2!==e)return void n.Z.e(this.TAG,`parsePMT: table_id ${e} is not corresponded to PMT!`);const t=(15&A[1])<<8|A[2],i=A[3]<<8|A[4],a=(62&A[5])>>>1,r=1&A[5],o=A[6];A[7];let s=null;if(1===r&&0===o)s=new k,s.program_number=i,s.version_number=a,this.program_pmt_map_[i]=s;else if(s=this.program_pmt_map_[i],null==s)return;A[8],A[9];const g=(15&A[10])<<8|A[11],c=12+g,l=t-9-g-4;for(let e=c;e0){for(let t=e+5;t{var e,t,i,n,a,r;const o=new C(A),s=o.readBits(8),g=o.readBool(),c=o.readBool();o.readBits(2);const l=o.readBits(12),I=o.readBits(8),d=o.readBool(),h=o.readBits(6),B=4*o.readBits(31)+o.readBits(2),u=o.readBits(8),E=o.readBits(12),f=o.readBits(12),Q=o.readBits(8);let x=null;Q===Z.kSpliceNull?x={}:Q===Z.kSpliceSchedule?x=(A=>{const e=A.readBits(8),t=[];for(let i=0;i{const e=A.readBits(32),t=A.readBool();A.readBits(7);const i={splice_event_id:e,splice_event_cancel_indicator:t};if(t)return i;if(i.out_of_network_indicator=A.readBool(),i.program_splice_flag=A.readBool(),i.duration_flag=A.readBool(),i.splice_immediate_flag=A.readBool(),A.readBits(4),i.program_splice_flag&&!i.splice_immediate_flag&&(i.splice_time=q(A)),!i.program_splice_flag){i.component_count=A.readBits(8),i.components=[];for(let e=0;e({splice_time:q(A)}))(o):Q===Z.kBandwidthReservation?x={}:Q===Z.kPrivateCommand?x=((A,e)=>{const t=String.fromCharCode(e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8)),i=new Uint8Array(A-4);for(let t=0;t1&&(n.Z.w(this.TAG,`AAC: Detected pts overlapped, expected: ${A}ms, PES pts: ${o}ms`),o=A)}}const s=new K(A);let g=null,c=o,l=0;for(;null!=(g=s.readNextAACFrame());){r=1024/g.sampling_frequency*1e3;const A={codec:"aac",data:g};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(A)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(A)):(this.audio_metadata_={codec:"aac",audio_object_type:g.audio_object_type,sampling_freq_index:g.sampling_freq_index,sampling_frequency:g.sampling_frequency,channel_config:g.channel_config},this.dispatchAudioInitSegment(A)),l=c;const e=Math.floor(c),t={unit:g.data,length:g.data.byteLength,pts:e,dts:e};this.audio_track_&&(null===(a=this.audio_track_)||void 0===a||a.samples.push(t),this.audio_track_.length+=g.data.byteLength),c+=r}s.hasIncompleteData()&&(this.aac_last_incomplete_data_=s.getIncompleteData()),l&&(this.aac_last_sample_pts_=l)}parseLOASAACPayload(A,e){var t,i,a;if(this.has_video_&&!this.video_init_segment_dispatched_)return;if(this.aac_last_incomplete_data_){const e=new Uint8Array(A.byteLength+this.aac_last_incomplete_data_.byteLength);e.set(this.aac_last_incomplete_data_,0),e.set(A,this.aac_last_incomplete_data_.byteLength),A=e}let r,o=0;if(void 0!==e&&(o=e/this.timescale_),"aac"===(null===(t=this.audio_metadata_)||void 0===t?void 0:t.codec)){if(void 0===e&&void 0!==this.aac_last_sample_pts_)r=1024/this.audio_metadata_.sampling_frequency*1e3,o=this.aac_last_sample_pts_+r;else if(void 0===e)return void n.Z.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.aac_last_sample_pts_){r=1024/this.audio_metadata_.sampling_frequency*1e3;const A=this.aac_last_sample_pts_+r;Math.abs(A-o)>1&&(n.Z.w(this.TAG,`AAC: Detected pts overlapped, expected: ${A}ms, PES pts: ${o}ms`),o=A)}}const s=new V(A);let g=null,c=o,l=0;for(;null!=(g=s.readNextAACFrame(null!==(i=this.loas_previous_frame)&&void 0!==i?i:void 0));){this.loas_previous_frame=g,r=1024/g.sampling_frequency*1e3;const A={codec:"aac",data:g};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(A)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(A)):(this.audio_metadata_={codec:"aac",audio_object_type:g.audio_object_type,sampling_freq_index:g.sampling_freq_index,sampling_frequency:g.sampling_frequency,channel_config:g.channel_config},this.dispatchAudioInitSegment(A)),l=c;const e=Math.floor(c),t={unit:g.data,length:g.data.byteLength,pts:e,dts:e};this.audio_track_&&(null===(a=this.audio_track_)||void 0===a||a.samples.push(t),this.audio_track_.length+=g.data.byteLength),c+=r}s.hasIncompleteData()&&(this.aac_last_incomplete_data_=s.getIncompleteData()),l&&(this.aac_last_sample_pts_=l)}parseAC3Payload(A,e){var t,i;if(this.has_video_&&!this.video_init_segment_dispatched_)return;let a,r=0;if(void 0!==e&&(r=e/this.timescale_),"ac-3"===(null===(t=this.audio_metadata_)||void 0===t?void 0:t.codec))if(void 0===e&&void 0!==this.aac_last_sample_pts_)a=1536/this.audio_metadata_.sampling_frequency*1e3,r=this.aac_last_sample_pts_+a;else if(void 0===e)return void n.Z.w(this.TAG,"AC3: Unknown pts");const o=new uA(A);let s=null,g=r,c=0;for(;null!=(s=o.readNextAC3Frame());){a=1536/s.sampling_frequency*1e3;const A={codec:"ac-3",data:s};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(A)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(A)):(this.audio_metadata_={codec:"ac-3",sampling_frequency:s.sampling_frequency,bit_stream_identification:s.bit_stream_identification,bit_stream_mode:s.bit_stream_mode,low_frequency_effects_channel_on:s.low_frequency_effects_channel_on,channel_mode:s.channel_mode},this.dispatchAudioInitSegment(A)),c=g;const e=Math.floor(g),t={unit:s.data,length:s.data.byteLength,pts:e,dts:e};this.audio_track_&&(null===(i=this.audio_track_)||void 0===i||i.samples.push(t),this.audio_track_.length+=s.data.byteLength),g+=a}c&&(this.aac_last_sample_pts_=c)}parseEAC3Payload(A,e){var t,i;if(this.has_video_&&!this.video_init_segment_dispatched_)return;let a,r=0;if(void 0!==e&&(r=e/this.timescale_),"ec-3"===(null===(t=this.audio_metadata_)||void 0===t?void 0:t.codec))if(void 0===e&&void 0!==this.aac_last_sample_pts_)a=256*(this.audio_metadata_.num_blks||0)/(this.audio_metadata_.sampling_frequency||0)*1e3,r=this.aac_last_sample_pts_+a;else if(void 0===e)return void n.Z.w(this.TAG,"EAC3: Unknown pts");const o=new QA(A);let s=null,g=r,c=0;for(;null!=(s=o.readNextEAC3Frame());){a=1536/s.sampling_frequency*1e3;const A={codec:"ec-3",data:s};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(A)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(A)):(this.audio_metadata_={codec:"ec-3",sampling_frequency:s.sampling_frequency,bit_stream_identification:s.bit_stream_identification,low_frequency_effects_channel_on:s.low_frequency_effects_channel_on,num_blks:s.num_blks,channel_mode:s.channel_mode},this.dispatchAudioInitSegment(A)),c=g;const e=Math.floor(g),t={unit:s.data,length:s.data.byteLength,pts:e,dts:e};this.audio_track_&&(null===(i=this.audio_track_)||void 0===i||i.samples.push(t),this.audio_track_.length+=s.data.byteLength),g+=a}c&&(this.aac_last_sample_pts_=c)}parseOpusPayload(A,e){var t,i;if(this.has_video_&&!this.video_init_segment_dispatched_)return;let a,r=0;if(void 0!==e&&(r=e/this.timescale_),"opus"===(null===(t=this.audio_metadata_)||void 0===t?void 0:t.codec))if(void 0===e&&void 0!==this.aac_last_sample_pts_)a=20,r=this.aac_last_sample_pts_+a;else if(void 0===e)return void n.Z.w(this.TAG,"Opus: Unknown pts");let o=r,s=0;for(let e=0;e>>3&3,o=(6&A[1])>>1;A[2];const s=(12&A[2])>>>2,g=3&~(A[3]>>>6)?2:1;let c=0,l=34;switch(r){case 0:c=a[s];break;case 2:c=n[s];break;case 3:c=i[s]}switch(o){case 1:l=34;break;case 2:l=33;break;case 3:l=32}const I=new dA;I.object_type=l,I.sample_rate=c,I.channel_count=g,I.data=A;const C={codec:"mp3",data:I};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(C)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(C)):(this.audio_metadata_={codec:"mp3",object_type:l,sample_rate:c,channel_count:g},this.dispatchAudioInitSegment(C));const d={unit:A,length:A.byteLength,pts:e/this.timescale_,dts:e/this.timescale_};this.audio_track_&&(null===(t=this.audio_track_)||void 0===t||t.samples.push(d),this.audio_track_.length+=A.byteLength)}detectAudioMetadataChange(A){var e,t,i,a;if(A.codec!==(null===(e=this.audio_metadata_)||void 0===e?void 0:e.codec))return n.Z.v(this.TAG,`Audio: Audio Codecs changed from ${null===(t=this.audio_metadata_)||void 0===t?void 0:t.codec} to ${A.codec}`),!0;if("aac"===A.codec&&"aac"===this.audio_metadata_.codec){const e=A.data;if(e.audio_object_type!==this.audio_metadata_.audio_object_type)return n.Z.v(this.TAG,`AAC: AudioObjectType changed from ${this.audio_metadata_.audio_object_type} to ${e.audio_object_type}`),!0;if(e.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return n.Z.v(this.TAG,`AAC: SamplingFrequencyIndex changed from ${this.audio_metadata_.sampling_freq_index} to ${e.sampling_freq_index}`),!0;if(e.channel_config!==this.audio_metadata_.channel_config)return n.Z.v(this.TAG,`AAC: Channel configuration changed from ${null===(i=this.audio_metadata_)||void 0===i?void 0:i.channel_config} to ${e.channel_config}`),!0}else if("ac-3"===A.codec&&"ac-3"===this.audio_metadata_.codec){const e=A.data;if(e.sampling_frequency!==this.audio_metadata_.sampling_frequency)return n.Z.v(this.TAG,`AC3: Sampling Frequency changed from ${null===(a=this.audio_metadata_)||void 0===a?void 0:a.sampling_frequency} to ${e.sampling_frequency}`),!0;if(e.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return n.Z.v(this.TAG,`AC3: Bit Stream Identification changed from ${this.audio_metadata_.bit_stream_identification} to ${e.bit_stream_identification}`),!0;if(e.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return n.Z.v(this.TAG,`AC3: BitStream Mode changed from ${this.audio_metadata_.bit_stream_mode} to ${e.bit_stream_mode}`),!0;if(e.channel_mode!==this.audio_metadata_.channel_mode)return n.Z.v(this.TAG,`AC3: Channel Mode changed from ${this.audio_metadata_.channel_mode} to ${e.channel_mode}`),!0;if(e.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return n.Z.v(this.TAG,`AC3: Low Frequency Effects Channel On changed from ${this.audio_metadata_.low_frequency_effects_channel_on} to ${e.low_frequency_effects_channel_on}`),!0}else if("opus"===A.codec&&"opus"===this.audio_metadata_.codec){const e=A.meta;if(e.sample_rate!==this.audio_metadata_.sample_rate)return n.Z.v(this.TAG,`Opus: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${e.sample_rate}`),!0;if(e.channel_count!==this.audio_metadata_.channel_count)return n.Z.v(this.TAG,`Opus: Channel count changed from ${this.audio_metadata_.channel_count} to ${e.channel_count}`),!0}else if("mp3"===A.codec&&"mp3"===this.audio_metadata_.codec){const e=A.data;if(e.object_type!==this.audio_metadata_.object_type)return n.Z.v(this.TAG,`MP3: AudioObjectType changed from ${this.audio_metadata_.object_type} to ${e.object_type}`),!0;if(e.sample_rate!==this.audio_metadata_.sample_rate)return n.Z.v(this.TAG,`MP3: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${e.sample_rate}`),!0;if(e.channel_count!==this.audio_metadata_.channel_count)return n.Z.v(this.TAG,`MP3: Channel count changed from ${this.audio_metadata_.channel_count} to ${e.channel_count}`),!0}return!1}dispatchAudioInitSegment(A){var e,t,i,a,r,o;const s={type:"audio"};if(s.id=null===(e=this.audio_track_)||void 0===e?void 0:e.id,s.timescale=1e3,s.duration=this.duration_,"aac"===(null===(t=this.audio_metadata_)||void 0===t?void 0:t.codec)){const e="aac"===A.codec?A.data:null,t=new W(e);s.audioSampleRate=t.sampling_rate,s.channelCount=t.channel_count,s.codec=t.codec_mimetype,s.originalCodec=t.original_codec_mimetype,s.config=t.config,s.refSampleDuration=1024/s.audioSampleRate*s.timescale}else if("ac-3"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec)){const e="ac-3"===A.codec?A.data:null,t=new EA(e);s.audioSampleRate=t.sampling_rate,s.channelCount=t.channel_count,s.codec=t.codec_mimetype,s.originalCodec=t.original_codec_mimetype,s.config=t.config,s.refSampleDuration=1536/s.audioSampleRate*s.timescale}else if("ec-3"===(null===(a=this.audio_metadata_)||void 0===a?void 0:a.codec)){const e="ec-3"===A.codec?A.data:null,t=new xA(e);s.audioSampleRate=t.sampling_rate,s.channelCount=t.channel_count,s.codec=t.codec_mimetype,s.originalCodec=t.original_codec_mimetype,s.config=t.config,s.refSampleDuration=256*t.num_blks/s.audioSampleRate*s.timescale}else"opus"===(null===(r=this.audio_metadata_)||void 0===r?void 0:r.codec)?(s.audioSampleRate=this.audio_metadata_.sample_rate,s.channelCount=this.audio_metadata_.channel_count,s.channelConfigCode=this.audio_metadata_.channel_config_code,s.codec="opus",s.originalCodec="opus",s.config=void 0,s.refSampleDuration=20):"mp3"===(null===(o=this.audio_metadata_)||void 0===o?void 0:o.codec)&&(s.audioSampleRate=this.audio_metadata_.sample_rate,s.channelCount=this.audio_metadata_.channel_count,s.codec="mp3",s.originalCodec="mp3",s.config=void 0);this.audio_init_segment_dispatched_||n.Z.v(this.TAG,`Generated first AudioSpecificConfig for mimeType: ${s.codec}`),this.onTrackMetadata&&this.onTrackMetadata("audio",s),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;const g=this.media_info_;g.hasAudio=!0,g.audioCodec=s.originalCodec,g.audioSampleRate=s.audioSampleRate,g.audioChannelCount=s.channelCount,g.hasVideo&&g.videoCodec?g.mimeType=`video/mp2t; codecs="${g.videoCodec},${g.audioCodec}"`:g.mimeType=`video/mp2t; codecs="${g.audioCodec}"`,g.isComplete()&&this.onMediaInfo&&this.onMediaInfo(g)}dispatchPESPrivateDataDescriptor(A,e,t){const i=new O;i.pid=A,i.stream_type=e,i.descriptor=t,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(i)}parsePESPrivateDataPayload(A,e,t,i,n){const a=new j;if(a.pid=i,a.stream_id=n,a.len=A.byteLength,a.data=A,void 0!==e){const A=Math.floor(e/this.timescale_);a.pts=A}else a.nearest_pts=this.aac_last_sample_pts_;if(void 0!==t){const A=Math.floor(t/this.timescale_);a.dts=A}this.onPESPrivateData&&this.onPESPrivateData(a)}parseTimedID3MetadataPayload(A,e,t,i,n){const a=new j;if(a.pid=i,a.stream_id=n,a.len=A.byteLength,a.data=A,void 0!==e){const A=Math.floor(e/this.timescale_);a.pts=A}if(void 0!==t){const A=Math.floor(t/this.timescale_);a.dts=A}this.onTimedID3Metadata&&this.onTimedID3Metadata(a)}parseSMPTE2038MetadataPayload(A,e,t,i,n){const a=new CA;if(a.pid=i,a.stream_id=n,a.len=A.byteLength,a.data=A,void 0!==e){const A=Math.floor(e/this.timescale_);a.pts=A}if(a.nearest_pts=this.aac_last_sample_pts_,void 0!==t){const A=Math.floor(t/this.timescale_);a.dts=A}a.ancillaries=(A=>{let e=new C(A),t=0;const i=[];for(;t+=6,0===e.readBits(6);){const A=e.readBool();t+=1;const n=e.readBits(11);t+=11;const a=e.readBits(12);t+=12;const r=255&e.readBits(10);t+=10;const o=255&e.readBits(10);t+=10;const s=255&e.readBits(10);t+=10;const g=new Uint8Array(s);for(let A=0;A>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(A,4);let r=8;for(let A=0;A>>24&255,A>>>16&255,A>>>8&255,255&A,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(A){return yA.box(yA.types.trak,yA.tkhd(A),yA.mdia(A))}static tkhd(A){const e=A.id,t=A.duration,i=A.presentWidth,n=A.presentHeight;return yA.box(yA.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(A){return yA.box(yA.types.mdia,yA.mdhd(A),yA.hdlr(A),yA.minf(A))}static mdhd(A){const e=A.timescale,t=A.duration;return yA.box(yA.types.mdhd,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,85,196,0,0]))}static hdlr(A){let e=null;return e="audio"===A.type?yA.constants.HDLR_AUDIO:yA.constants.HDLR_VIDEO,yA.box(yA.types.hdlr,e)}static minf(A){let e=null;return e="audio"===A.type?yA.box(yA.types.smhd,yA.constants.SMHD):yA.box(yA.types.vmhd,yA.constants.VMHD),yA.box(yA.types.minf,e,yA.dinf(),yA.stbl(A))}static dinf(){return yA.box(yA.types.dinf,yA.box(yA.types.dref,yA.constants.DREF))}static stbl(A){return yA.box(yA.types.stbl,yA.stsd(A),yA.box(yA.types.stts,yA.constants.STTS),yA.box(yA.types.stsc,yA.constants.STSC),yA.box(yA.types.stsz,yA.constants.STSZ),yA.box(yA.types.stco,yA.constants.STCO))}static stsd(A){return"audio"===A.type?"mp3"===A.codec?yA.box(yA.types.stsd,yA.constants.STSD_PREFIX,yA.mp3(A)):"ac-3"===A.codec?yA.box(yA.types.stsd,yA.constants.STSD_PREFIX,yA.ac3(A)):"ec-3"===A.codec?yA.box(yA.types.stsd,yA.constants.STSD_PREFIX,yA.ec3(A)):"opus"===A.codec?yA.box(yA.types.stsd,yA.constants.STSD_PREFIX,yA.Opus(A)):yA.box(yA.types.stsd,yA.constants.STSD_PREFIX,yA.mp4a(A)):"video"===A.type&&A.codec.startsWith("hvc1")?yA.box(yA.types.stsd,yA.constants.STSD_PREFIX,yA.hvc1(A)):"video"===A.type&&A.codec.startsWith("av01")?yA.box(yA.types.stsd,yA.constants.STSD_PREFIX,yA.av01(A)):yA.box(yA.types.stsd,yA.constants.STSD_PREFIX,yA.avc1(A))}static mp3(A){const e=A.channelCount,t=A.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e,0,16,0,0,0,0,t>>>8&255,255&t,0,0]);return yA.box(yA.types[".mp3"],i)}static mp4a(A){const e=A.channelCount,t=A.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e,0,16,0,0,0,0,t>>>8&255,255&t,0,0]);return yA.box(yA.types.mp4a,i,yA.esds(A))}static ac3(A){var e;const t=A.channelCount,i=A.audioSampleRate,n=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 yA.box(yA.types["ac-3"],n,yA.box(yA.types.dac3,new Uint8Array(null!==(e=A.config)&&void 0!==e?e:[])))}static ec3(A){var e;const t=A.channelCount,i=A.audioSampleRate,n=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 yA.box(yA.types["ec-3"],n,yA.box(yA.types.dec3,new Uint8Array(null!==(e=A.config)&&void 0!==e?e:[])))}static esds(A){var e;const t=null!==(e=A.config)&&void 0!==e?e:[],i=t.length,n=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return yA.box(yA.types.esds,n)}static Opus(A){const e=A.channelCount,t=A.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e,0,16,0,0,0,0,t>>>8&255,255&t,0,0]);return yA.box(yA.types.Opus,i,yA.dOps(A))}static dOps(A){const e=A.channelCount,t=A.channelConfigCode,i=A.audioSampleRate;let n=[];switch(t){case 1:case 2:n=[0];break;case 0:n=[255,1,1,0,1];break;case 128:n=[255,2,0,0,1];break;case 3:n=[1,2,1,0,2,1];break;case 4:n=[1,2,2,0,1,2,3];break;case 5:n=[1,3,2,0,4,1,2,3];break;case 6:n=[1,4,2,0,4,1,2,3,5];break;case 7:n=[1,4,2,0,4,1,2,3,5,6];break;case 8:n=[1,5,3,0,6,1,2,3,4,5,7];break;case 130:n=[1,1,2,0,1];break;case 131:n=[1,1,3,0,1,2];break;case 132:n=[1,1,4,0,1,2,3];break;case 133:n=[1,1,5,0,1,2,3,4];break;case 134:n=[1,1,6,0,1,2,3,4,5];break;case 135:n=[1,1,7,0,1,2,3,4,5,6];break;case 136:n=[1,1,8,0,1,2,3,4,5,6,7]}const a=new Uint8Array([0,e,0,0,i>>>24&255,i>>>17&255,i>>>8&255,i>>>0&255,0,0,...n]);return yA.box(yA.types.dOps,a)}static avc1(A){const e=A.avcc,t=A.codecWidth,i=A.codecHeight,n=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,t>>>8&255,255&t,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,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 yA.box(yA.types.avc1,n,yA.box(yA.types.avcC,e))}static hvc1(A){const e=A.hvcc,t=A.codecWidth,i=A.codecHeight,n=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,t>>>8&255,255&t,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,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 yA.box(yA.types.hvc1,n,yA.box(yA.types.hvcC,e))}static av01(A){var e,t;const i=A.av1c,n=null!==(e=A.codecWidth)&&void 0!==e?e:192,a=null!==(t=A.codecHeight)&&void 0!==t?t:108,r=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,n>>>8&255,255&n,a>>>8&255,255&a,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,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 yA.box(yA.types.av01,r,yA.box(yA.types.av1C,i))}static mvex(A){return yA.box(yA.types.mvex,yA.trex(A))}static trex(A){const e=A.id,t=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 yA.box(yA.types.trex,t)}static moof(A,e){return yA.box(yA.types.moof,yA.mfhd(A.sequenceNumber),yA.traf(A,e))}static mfhd(A){const e=new Uint8Array([0,0,0,0,A>>>24&255,A>>>16&255,A>>>8&255,255&A]);return yA.box(yA.types.mfhd,e)}static traf(A,e){const t=A.id,i=yA.box(yA.types.tfhd,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),n=yA.box(yA.types.tfdt,new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e])),a=yA.sdtp(A),r=yA.trun(A,a.byteLength+16+16+8+16+8+8);return yA.box(yA.types.traf,i,n,r,a)}static sdtp(A){const e=A.samples||[],t=e.length,i=new Uint8Array(4+t);for(let A=0;A>>24&255,i>>>16&255,i>>>8&255,255&i,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0);for(let A=0;A>>24&255,e>>>16&255,e>>>8&255,255&e,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.isNonSync,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r],12+16*A)}return yA.box(yA.types.trun,a)}static mdat(A){return yA.box(yA.types.mdat,A)}}yA.constants={FTYP:new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),STSD_PREFIX:new Uint8Array([0,0,0,0,0,0,0,1]),STTS:mA,STSC:mA,STCO:mA,STSZ:new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),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]),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]),DREF:new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),SMHD:new Uint8Array([0,0,0,0,0,0,0,0]),VMHD:new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},yA.init();const _A=yA,SA=class{static getSilentFrame(A,e){if("mp4a.40.2"===A){if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===e)return 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])}else{if(1===e)return 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]);if(2===e)return 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]);if(3===e)return 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])}return null}};var DA=t(68);const wA=class{constructor(A){var e;this.TAG="MP4Remuxer",this._fillSilentAfterSeek=!1,this._config=A,this._isLive=!!A.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new DA.J1("audio"),this._videoSegmentInfoList=new DA.J1("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!a.Z.chrome||!(a.Z.version&&a.Z.version.major<50||a.Z.version&&50===a.Z.version.major&&((null===(e=a.Z.version)||void 0===e?void 0:e.build)||0)<2661)),this._fillSilentAfterSeek=!(!a.Z.msedge&&!a.Z.msie),this._mp3UseMpegAudio=!a.Z.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}destroy(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null}bindDataSource(A){var e;return A.onDataAvailable=null===(e=this.remux)||void 0===e?void 0:e.bind(this),A.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}get onInitSegment(){return this._onInitSegment}set onInitSegment(A){this._onInitSegment=A}get onMediaSegment(){return this._onMediaSegment}set onMediaSegment(A){this._onMediaSegment=A}insertDiscontinuity(){this._audioNextDts=this._videoNextDts=void 0}seek(A){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()}remux(A,e){if(!this._onMediaSegment)throw new g.rT("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(A,e),e&&this._remuxVideo(e),A&&this._remuxAudio(A)}_onTrackMetadataReceived(A,e){let t=null,i="mp4",n=e.codec;if("audio"===A)this._audioMeta=e,"mp3"===e.codec&&this._mp3UseMpegAudio?(i="mpeg",n="",t=new Uint8Array):t=_A.generateInitSegment(e);else{if("video"!==A)return;this._videoMeta=e,t=_A.generateInitSegment(e)}if(!this._onInitSegment)throw new g.rT("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(A,{type:A,data:t.buffer,codec:n,container:`${A}/${i}`,mediaDuration:e.duration})}_calculateDtsBase(A,e){var t,i;this._dtsBaseInited||((null===(t=null==A?void 0:A.samples)||void 0===t?void 0:t.length)&&(this._audioDtsBase=A.samples[0].dts),(null===(i=null==e?void 0:e.samples)||void 0===i?void 0:i.length)&&(this._videoDtsBase=e.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}getTimestampBase(){if(this._dtsBaseInited)return this._dtsBase}flushStashedSamples(){const A=this._videoStashedLastSample,e=this._audioStashedLastSample,t={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=A&&(t.samples.push(A),t.length=null==A?void 0:A.length);const i={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=null==e?void 0:e.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(t,!0),this._remuxAudio(i,!0)}_remuxAudio(A,e){var t,i,r,o,s,g,c;if(null==this._audioMeta)return;const l=A,I=l.samples;let C,d=-1,h=-1;const B=this._audioMeta.refSampleDuration,u="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,E=this._dtsBaseInited&&void 0===this._audioNextDts;let f=!1;if(!I||0===I.length)return;if(1===I.length&&!e)return;let Q=0,x=null,p=0;u?(Q=0,p=l.length):(Q=8,p=8+l.length);let m=null;if(I.length>1&&(m=I.pop(),p-=m.length),null!=this._audioStashedLastSample){const A=this._audioStashedLastSample;this._audioStashedLastSample=null,I.unshift(A),p+=A.length}null!=m&&(this._audioStashedLastSample=m);const y=I[0].dts-this._dtsBase;if(this._audioNextDts)C=y-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())C=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(f=!0);else{const A=this._audioSegmentInfoList.getLastSampleBefore(y);if(null!=A){let e=y-(A.originalDts+A.duration);e<=3&&(e=0),C=y-(A.dts+A.duration+e)}else C=0}if(f){const A=y-C,e=this._videoSegmentInfoList.getLastSegmentBefore(y);if(null!=e&&e.beginDts=e*(B||0)&&this._fillAudioTimestampGap&&!a.Z.safari){l=!0;const e=Math.floor(C/(B||0));n.Z.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: ${i} ms, curRefDts: ${A} ms, dtsCorrection: ${Math.round(C)} ms, generate: ${e} frames`),c=Math.floor(A),u=Math.floor(A+(B||0))-c;let a=SA.getSilentFrame(null===(r=this._audioMeta)||void 0===r?void 0:r.originalCodec,this._audioMeta.channelCount);null==a&&(n.Z.w(this.TAG,`Unable to generate silent frame for ${null===(o=this._audioMeta)||void 0===o?void 0:o.originalCodec} with ${this._audioMeta.channelCount} channels, repeat last frame`),a=t),h=[];for(let t=0;t=1?null===(s=_[_.length-1])||void 0===s?void 0:s.duration:Math.floor(B||0),this._audioNextDts=c+u;-1===d&&(d=c),_.push({dts:c,pts:c,cts:0,unit:e.unit,size:null===(g=e.unit)||void 0===g?void 0:g.byteLength,duration:u,originalDts:i,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),l&&_.push.apply(_,h)}}if(0===_.length)return l.samples=[],void(l.length=0);u?x=new Uint8Array(p):(x=new Uint8Array(p),x[0]=p>>>24&255,x[1]=p>>>16&255,x[2]=p>>>8&255,x[3]=255&p,x.set(_A.types.mdat,4));for(let A=0;A<_.length;A++){const e=_[A].unit;x.set(e,Q),Q+=e.byteLength||0}const S=_[_.length-1];h=S.dts+S.duration;const D=new DA.Yy;D.beginDts=d,D.endDts=h,D.beginPts=d,D.endPts=h,D.originalBeginDts=_[0].originalDts,D.originalEndDts=S.originalDts+S.duration,D.firstSample=new DA.Wk(_[0].dts,_[0].pts,_[0].duration,_[0].originalDts,!1),D.lastSample=new DA.Wk(S.dts,S.pts,S.duration,S.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(D),l.samples=_,l.sequenceNumber++;let w=null;w=u?new Uint8Array:_A.moof(l,d),l.samples=[],l.length=0;const v={type:"audio",data:this._mergeBoxes(w,x).buffer,sampleCount:_.length,info:D};u&&E&&v&&(v.timestampOffset=d),null===(c=this._onMediaSegment)||void 0===c||c.call(this,"audio",v)}_remuxVideo(A,e){var t,i;if(null==this._videoMeta)return;const n=A,a=n.samples;let r,o=-1,s=-1,g=-1,c=-1;if(!a||0===a.length)return;if(1===a.length&&!e)return;let l=8,I=null,C=8+A.length,d=null;if(a.length>1&&(d=a.pop(),C-=d.length),null!=this._videoStashedLastSample){const A=this._videoStashedLastSample;this._videoStashedLastSample=null,a.unshift(A),C+=(null==A?void 0:A.length)||0}null!=d&&(this._videoStashedLastSample=d);const h=a[0].dts-this._dtsBase;if(this._videoNextDts)r=h-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())r=0;else{const A=this._videoSegmentInfoList.getLastSampleBefore(h);if(null!=A){let e=h-(A.originalDts+A.duration);e<=3&&(e=0),r=h-(A.dts+A.duration+e)}else r=0}const B=new DA.Yy,u=[];for(let A=0;A=1?u[u.length-1].duration:Math.floor((null===(t=this._videoMeta)||void 0===t?void 0:t.refSampleDuration)||0),n){const A=new DA.Wk(s,l,I,e.dts,!0);A.fileposition=e.fileposition,B.appendSyncPoint(A)}u.push({dts:s,pts:l,cts:c,units:e.units,size:e.length,isKeyframe:n,duration:I,originalDts:i,flags:{isLeading:0,dependsOn:n?2:1,isDependedOn:n?1:0,hasRedundancy:0,isNonSync:n?0:1}})}I=new Uint8Array(C),I[0]=C>>>24&255,I[1]=C>>>16&255,I[2]=C>>>8&255,I[3]=255&C,I.set(_A.types.mdat,4);for(let A=0;A{t.timestampBase=n,n+=t.duration,t.cors=A.cors,t.withCredentials=A.withCredentials,e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy)})),isNaN(n)||this._mediaDataSource.duration===n||(this._mediaDataSource.duration=n),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}destroy(){var A,e,t;this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(null===(A=this._ioctl)||void 0===A||A.destroy(),this._ioctl=null),this._demuxer&&(null===(e=this._demuxer)||void 0===e||e.destroy(),this._demuxer=null),this._remuxer&&(null===(t=this._remuxer)||void 0===t||t.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null}on(A,e){this._emitter.addListener(A,e)}off(A,e){this._emitter.removeListener(A,e)}start(){this._loadSegment(0),this._enableStatisticsReporter()}_loadSegment(A,e){var t,i,n;if(this._currentSegmentIndex=A,null===(t=this._mediaDataSource)||void 0===t?void 0:t.segments){const t=null===(i=this._mediaDataSource)||void 0===i?void 0:i.segments[A],a=this._ioctl=new vA.Z(t,this._config,A);a.onError=this._onIOException.bind(this),a.onSeeked=this._onIOSeeked.bind(this),a.onComplete=this._onIOComplete.bind(this),a.onRedirect=this._onIORedirect.bind(this),a.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),e?null===(n=this._demuxer)||void 0===n||n.bindDataSource(this._ioctl):a.onDataArrival=this._onInitChunkArrival.bind(this),a.open(e)}}stop(){this._internalAbort(),this._disableStatisticsReporter()}_internalAbort(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)}pause(){var A;(null===(A=this._ioctl)||void 0===A?void 0:A.isWorking())&&(this._ioctl.pause(),this._disableStatisticsReporter())}resume(){var A;(null===(A=this._ioctl)||void 0===A?void 0:A.isPaused())&&(this._ioctl.resume(),this._enableStatisticsReporter())}seek(A){var e,t,i,n,a,r,o,s,g,c,l,I,C,d;if(null==this._mediaInfo||!(null===(e=this._mediaInfo)||void 0===e?void 0:e.isSeekable()))return;const h=this._searchSegmentIndexContains(A);if(h===this._currentSegmentIndex){const e=(null===(t=this._mediaInfo)||void 0===t?void 0:t.segments)?null===(i=this._mediaInfo)||void 0===i?void 0:i.segments[h]:{};if(void 0===e)this._pendingSeekTime=A;else{const t=null==e?void 0:e.getNearestKeyframe(A);null===(n=this._remuxer)||void 0===n||n.seek(null==t?void 0:t.milliseconds),null===(a=this._ioctl)||void 0===a||a.seek(null==t?void 0:t.fileposition),this._pendingResolveSeekPoint=null==t?void 0:t.milliseconds}}else{const e=(null===(r=this._mediaInfo)||void 0===r?void 0:r.segments)?null===(o=this._mediaInfo)||void 0===o?void 0:o.segments[h]:{};if(void 0===e)this._pendingSeekTime=A,this._internalAbort(),null===(s=this._remuxer)||void 0===s||s.seek(),null===(g=this._remuxer)||void 0===g||g.insertDiscontinuity(),this._loadSegment(h);else{const t=e.getNearestKeyframe(A);this._internalAbort(),null===(c=this._remuxer)||void 0===c||c.seek(A),null===(l=this._remuxer)||void 0===l||l.insertDiscontinuity(),this._demuxer&&(null===(I=this._demuxer)||void 0===I||I.resetMediaInfo(),this._demuxer.timestampBase=(null===(C=this._mediaDataSource)||void 0===C?void 0:C.segments)?null===(d=this._mediaDataSource)||void 0===d?void 0:d.segments[h].timestampBase:0),this._loadSegment(h,null==t?void 0:t.fileposition),this._pendingResolveSeekPoint=null==t?void 0:t.milliseconds,this._reportSegmentMediaInfo(h)}}this._enableStatisticsReporter()}_searchSegmentIndexContains(A){var e;const t=this._mediaDataSource.segments;let i=((null==t?void 0:t.length)||0)-1;if(0===((null==t?void 0:t.length)||0))return i;for(let n=0;n<((null==t?void 0:t.length)||0);n++)if(t&&A<((null===(e=t[n])||void 0===e?void 0:e.timestampBase)||0)){i=n-1;break}return i}_onInitChunkArrival(A,e){var t,i,a,r,o;let s=0;if(e>0)null===(t=this._demuxer)||void 0===t||t.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments?null===(i=this._mediaDataSource.segments[this._currentSegmentIndex])||void 0===i?void 0:i.timestampBase:0,s=(null===(a=this._demuxer)||void 0===a?void 0:a.parseChunks(A,e))||0;else{let t=null;t=S.probe(A),t.match&&(this._setupFLVDemuxerRemuxer(t),s=(null===(r=this._demuxer)||void 0===r?void 0:r.parseChunks(A,e))||0),t.match||(null==t?void 0:t.needMoreData)||(t=pA.probe(A),t.match&&(this._setupTSDemuxerRemuxer(t),s=(null===(o=this._demuxer)||void 0===o?void 0:o.parseChunks(A,e))||0)),t.match||(null==t?void 0:t.needMoreData)||(t=null,n.Z.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then((()=>{this._internalAbort()})),this._emitter.emit(FA.Z.DEMUX_ERROR,B.Z.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"))}return s}_setupFLVDemuxerRemuxer(A){var e;this._demuxer=new S(A,this._config),this._remuxer||(this._remuxer=new wA(this._config));const t=this._mediaDataSource;void 0===t.duration||isNaN(t.duration)||(this._demuxer.overridedDuration=t.duration),"boolean"==typeof t.hasAudio&&(this._demuxer.overridedHasAudio=t.hasAudio),"boolean"==typeof t.hasVideo&&(this._demuxer.overridedHasVideo=t.hasVideo),t.segments&&this._demuxer&&this._remuxer&&(this._demuxer.timestampBase=null===(e=null==t?void 0:t.segments[this._currentSegmentIndex])||void 0===e?void 0:e.timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this))}_setupTSDemuxerRemuxer(A){const e=this._demuxer=new pA(A,this._config);this._remuxer||(this._remuxer=new wA(this._config)),e.onError=this._onDemuxException.bind(this),e.onMediaInfo=this._onMediaInfo.bind(this),e.onMetaDataArrived=this._onMetaDataArrived.bind(this),e.onTimedID3Metadata=this._onTimedID3Metadata.bind(this),e.onSMPTE2038Metadata=this._onSMPTE2038Metadata.bind(this),e.onSCTE35Metadata=this._onSCTE35Metadata.bind(this),e.onPESPrivateDataDescriptor=this._onPESPrivateDataDescriptor.bind(this),e.onPESPrivateData=this._onPESPrivateData.bind(this),this._remuxer.bindDataSource(this._demuxer),this._demuxer.bindDataSource(this._ioctl),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this)}_onMediaInfo(A){var e,t;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},A),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=(null===(t=null===(e=this._mediaDataSource)||void 0===e?void 0:e.segments)||void 0===t?void 0:t.length)||0,Object.setPrototypeOf(this._mediaInfo,r.Z.prototype));const i=Object.assign({},A);Object.setPrototypeOf(i,r.Z.prototype),this._mediaInfo.segments&&(this._mediaInfo.segments[this._currentSegmentIndex]=i),this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((()=>{const A=this._pendingSeekTime;this._pendingSeekTime=null,this.seek(A)}))}_onMetaDataArrived(A){this._emitter.emit(FA.Z.METADATA_ARRIVED,A)}_onScriptDataArrived(A){this._emitter.emit(FA.Z.SCRIPTDATA_ARRIVED,A)}_onTimedID3Metadata(A){var e;const t=null===(e=this._remuxer)||void 0===e?void 0:e.getTimestampBase();void 0!==t&&(void 0!==A.pts&&(A.pts-=t),void 0!==A.dts&&(A.dts-=t),this._emitter.emit(FA.Z.TIMED_ID3_METADATA_ARRIVED,A))}_onSMPTE2038Metadata(A){var e;const t=null===(e=this._remuxer)||void 0===e?void 0:e.getTimestampBase();void 0!==t&&(void 0!==A.pts&&(A.pts-=t),void 0!==A.dts&&(A.dts-=t),void 0!==A.nearest_pts&&(A.nearest_pts-=t),this._emitter.emit(FA.Z.SMPTE2038_METADATA_ARRIVED,A))}_onSCTE35Metadata(A){var e;const t=null===(e=this._remuxer)||void 0===e?void 0:e.getTimestampBase();void 0!==t&&(void 0!==A.pts&&(A.pts-=t),void 0!==A.nearest_pts&&(A.nearest_pts-=t),this._emitter.emit(FA.Z.SCTE35_METADATA_ARRIVED,A))}_onPESPrivateDataDescriptor(A){this._emitter.emit(FA.Z.PES_PRIVATE_DATA_DESCRIPTOR,A)}_onPESPrivateData(A){var e;const t=null===(e=this._remuxer)||void 0===e?void 0:e.getTimestampBase();void 0!==t&&(void 0!==A.pts&&(A.pts-=t),void 0!==A.nearest_pts&&(A.nearest_pts-=t),void 0!==A.dts&&(A.dts-=t),this._emitter.emit(FA.Z.PES_PRIVATE_DATA_ARRIVED,A))}_onIOSeeked(){var A;null===(A=this._remuxer)||void 0===A||A.insertDiscontinuity()}_onIOComplete(A){var e,t;const i=A+1;i<((null===(t=null===(e=this._mediaDataSource)||void 0===e?void 0:e.segments)||void 0===t?void 0:t.length)||0)?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(i)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(FA.Z.LOADING_COMPLETE),this._disableStatisticsReporter())}_onIORedirect(A){var e;const t=null===(e=this._ioctl)||void 0===e?void 0:e.extraData;this._mediaDataSource.segments&&(this._mediaDataSource.segments[t].redirectedURL=A)}_onIORecoveredEarlyEof(){this._emitter.emit(FA.Z.RECOVERED_EARLY_EOF)}_onIOException(A,e){n.Z.e(this.TAG,`IOException: type = ${A}, code = ${e.code}, msg = ${e.msg}`),this._emitter.emit(FA.Z.IO_ERROR,A,e),this._disableStatisticsReporter()}_onDemuxException(A,e){n.Z.e(this.TAG,`DemuxException: type = ${A}, info = ${e}`),this._emitter.emit(FA.Z.DEMUX_ERROR,A,e)}_onRemuxerInitSegmentArrival(A,e){this._emitter.emit(FA.Z.INIT_SEGMENT,A,e)}_onRemuxerMediaSegmentArrival(A,e){if(null==this._pendingSeekTime&&(this._emitter.emit(FA.Z.MEDIA_SEGMENT,A,e),null!=this._pendingResolveSeekPoint&&"video"===A)){const A=e.info.syncPoints;let t=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,a.Z.safari&&A.length>0&&A[0].originalDts===t&&(t=A[0].pts),this._emitter.emit(FA.Z.RECOMMEND_SEEKPOINT,t)}}_enableStatisticsReporter(){null==this._statisticsReporter&&this._reportStatisticsInfo&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}_disableStatisticsReporter(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}_reportSegmentMediaInfo(A){var e,t,i,n;const a=(null===(e=this._mediaInfo)||void 0===e?void 0:e.segments)?null===(t=this._mediaInfo)||void 0===t?void 0:t.segments[A]:{},r=Object.assign({},a);r.duration=null===(i=this._mediaInfo)||void 0===i?void 0:i.duration,r.segmentCount=null===(n=this._mediaInfo)||void 0===n?void 0:n.segmentCount,delete r.segments,delete r.keyframesIndex,this._emitter.emit(FA.Z.MEDIA_INFO,r)}_reportStatisticsInfo(){var A,e,t,i,n,a;const r={};r.url=null===(A=this._ioctl)||void 0===A?void 0:A.currentURL,r.hasRedirect=null===(e=this._ioctl)||void 0===e?void 0:e.hasRedirect,r.hasRedirect&&(r.redirectedURL=null===(t=this._ioctl)||void 0===t?void 0:t.currentRedirectedURL),r.speed=null===(i=this._ioctl)||void 0===i?void 0:i.currentSpeed,r.loaderType=null===(n=this._ioctl)||void 0===n?void 0:n.loaderType,r.currentSegmentIndex=this._currentSegmentIndex,r.totalSegmentCount=null===(a=this._mediaDataSource.segments)||void 0===a?void 0:a.length,this._emitter.emit(FA.Z.STATISTICS_INFO,r)}}},473:(A,e,t)=>{t.d(e,{Z:()=>i});const i={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",SMPTE2038_METADATA_ARRIVED:"smpte2038_metadata_arrived",SCTE35_METADATA_ARRIVED:"scte35_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},638:(A,e,t)=>{var i=t(278),n=t(943),a=t(473);let r=null;const o=function(A,e){self.postMessage({msg:"logcat_callback",data:{type:A,logcat:e}})};function s(A,e){const t={msg:a.Z.INIT_SEGMENT,data:{type:A,data:e}};self.postMessage(t,[e.data])}function g(A,e){const t={msg:a.Z.MEDIA_SEGMENT,data:{type:A,data:e}};self.postMessage(t,[e.data])}function c(){const A={msg:a.Z.LOADING_COMPLETE};self.postMessage(A)}function l(){const A={msg:a.Z.RECOVERED_EARLY_EOF};self.postMessage(A)}function I(A){const e={msg:a.Z.MEDIA_INFO,data:A};self.postMessage(e)}function C(A){const e={msg:a.Z.METADATA_ARRIVED,data:A};self.postMessage(e)}function d(A){const e={msg:a.Z.SCRIPTDATA_ARRIVED,data:A};self.postMessage(e)}function h(A){const e={msg:a.Z.TIMED_ID3_METADATA_ARRIVED,data:A};self.postMessage(e)}function B(A){const e={msg:a.Z.SMPTE2038_METADATA_ARRIVED,data:A};self.postMessage(e)}function u(A){const e={msg:a.Z.SCTE35_METADATA_ARRIVED,data:A};self.postMessage(e)}function E(A){const e={msg:a.Z.PES_PRIVATE_DATA_DESCRIPTOR,data:A};self.postMessage(e)}function f(A){const e={msg:a.Z.PES_PRIVATE_DATA_ARRIVED,data:A};self.postMessage(e)}function Q(A){const e={msg:a.Z.STATISTICS_INFO,data:A};self.postMessage(e)}function x(A,e){self.postMessage({msg:a.Z.IO_ERROR,data:{type:A,info:e}})}function p(A,e){self.postMessage({msg:a.Z.DEMUX_ERROR,data:{type:A,info:e}})}function m(A){self.postMessage({msg:a.Z.RECOMMEND_SEEKPOINT,data:A})}self.addEventListener("message",(function(A){switch(A.data.cmd){case"init":r=new n.Z(A.data.param[0],A.data.param[1]),r.on(a.Z.IO_ERROR,x),r.on(a.Z.DEMUX_ERROR,p),r.on(a.Z.INIT_SEGMENT,s),r.on(a.Z.MEDIA_SEGMENT,g),r.on(a.Z.LOADING_COMPLETE,c),r.on(a.Z.RECOVERED_EARLY_EOF,l),r.on(a.Z.MEDIA_INFO,I),r.on(a.Z.METADATA_ARRIVED,C),r.on(a.Z.SCRIPTDATA_ARRIVED,d),r.on(a.Z.TIMED_ID3_METADATA_ARRIVED,h),r.on(a.Z.SMPTE2038_METADATA_ARRIVED,B),r.on(a.Z.SCTE35_METADATA_ARRIVED,u),r.on(a.Z.PES_PRIVATE_DATA_DESCRIPTOR,E),r.on(a.Z.PES_PRIVATE_DATA_ARRIVED,f),r.on(a.Z.STATISTICS_INFO,Q),r.on(a.Z.RECOMMEND_SEEKPOINT,m);break;case"destroy":r&&(r.destroy(),r=null),self.postMessage({msg:"destroyed"});break;case"start":null==r||r.start();break;case"stop":null==r||r.stop();break;case"seek":null==r||r.seek(A.data.param);break;case"pause":null==r||r.pause();break;case"resume":null==r||r.resume();break;case"logging_config":{const e=A.data.param;i.Z.applyConfig(e),!0===e.enableCallback?i.Z.addLogListener(o):i.Z.removeLogListener(o);break}}}))},898:(A,e,t)=>{t.d(e,{Z:()=>i});const i={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},578:(A,e,t)=>{t.d(e,{default:()=>G});var i=t(575);const n={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0,url:void 0,redirectedURL:void 0,cors:!1};function a(){return Object.assign({},n)}class r{static supportMSEH264Playback(){var A;return null===(A=window.MediaSource)||void 0===A?void 0:A.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}static supportMSEH265Playback(){var A;return null===(A=window.MediaSource)||void 0===A?void 0:A.isTypeSupported('video/mp4; codecs="hvc1.1.6.L93.B0"')}static supportNetworkStreamIO(){const A=new i.Z({},a()),e=A.loaderType;return A.destroy(),"fetch-stream-loader"===e||"xhr-moz-chunked-loader"===e}static getNetworkLoaderTypeName(){const A=new i.Z({},a()),e=A.loaderType;return A.destroy(),e}static supportNativeMediaPlayback(A){void 0===r.videoElement&&(r.videoElement=window.document.createElement("video"));const e=r.videoElement.canPlayType(A);return"probably"===e||"maybe"===e}static getFeatureList(){const A={msePlayback:!1,mseLivePlayback:!1,mseH265Playback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return A.msePlayback=r.supportMSEH264Playback(),A.networkStreamIO=r.supportNetworkStreamIO(),A.networkLoaderName=r.getNetworkLoaderTypeName()||"",A.mseLivePlayback=A.msePlayback&&A.networkStreamIO,A.mseH265Playback=r.supportMSEH265Playback(),A.nativeMP4H264Playback=r.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),A.nativeMP4H265Playback=r.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0"'),A.nativeWebmVP8Playback=r.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),A.nativeWebmVP9Playback=r.supportNativeMediaPlayback('video/webm; codecs="vp9"'),A}}const o=r;var s=t(108),g=t(99),c=t(645),l=t(479);const I={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",SMPTE2038_METADATA_ARRIVED:"smpte2038_metadata_arrived",SCTE35_METADATA_ARRIVED:"scte35_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info"},C=function(){const A=ENTRY_MODULE,e={};function t(i){if(e[i])return e[i].exports;const n=e[i]={exports:{}};return A[i](n,n.exports,t),n.exports}t.m=A,t.n=A=>{const e=A&&A.__esModule?()=>A.default:()=>A;return t.d(e,{a:e}),e},t.d=(A,e)=>{for(const i in e)t.o(e,i)&&!t.o(A,i)&&Object.defineProperty(A,i,{enumerable:!0,get:e[i]})},t.g=function(){if("[object Object]"===Object.prototype.toString.call(globalThis))return globalThis;try{return this||new Function("return this")()}catch(A){if("[object Object]"===Object.prototype.toString.call(window))return window}}(),t.o=(A,e)=>Object.prototype.hasOwnProperty.call(A,e),t.r=A=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})};const i=t(ENTRY_MODULE);return i.default||i};C.toString();const d="[\\.|\\-|\\+|\\w|/|@]+",h="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+d+").*?\\)";function B(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function u(A,e,i){const n={};n[i]=[];const a=e.toString(),r=a.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)||a.match(/^\(\w+,\s*\w+,\s*(\w+)\)\s?\=\s?\>/);if(!r)return n;const o=r[1];let s,g=new RegExp("(\\\\n|\\W)"+B(o)+h,"g");for(;s=g.exec(a);)"dll-reference"!==s[3]&&n[i].push(s[3]);for(g=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+d+'))"\\)\\)'+h,"g");s=g.exec(a);)A[s[2]]||(n[i].push(s[1]),A[s[2]]=t(s[1]).m),n[s[2]]=n[s[2]]||[],n[s[2]].push(s[4]);const c=Object.keys(n);for(let A=0;Ae||A[t].length>0),!1)}function f(A,e,t,i){const n=A[i].map((A=>`"${A}": ${e[i][A].toString()}`)).join(","),a=C.toString().split("ENTRY_MODULE");return`${a[0]}{${n}}${a[1]}"${t}"${a[2]}`}var Q=t(278),x=t(943),p=t(473),m=t(994);const y=class{constructor(A,e){if(this.TAG="Transmuxer",this._workerDestroying=!1,this._controller=null,this._emitter=new g.EventEmitter,e.enableWorker&&"undefined"!=typeof Worker)try{this._worker=this._worker=function(A,e){e=e||{};const i={main:t.m},n=e.all?{main:Object.keys(i.main)}:function(A,e){const t={main:[e]},i={main:[]},n={main:{}};for(;E(t);){const e=Object.keys(t);for(let a=0;a"main"!==A)).forEach((A=>{let e=0;for(;n[A][e];)e++;n[A].push(e),i[A][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",a+=`var ${A} = (${f(n,i,e,modules)})();\n`})),a+=`(${f(n,i,A,"main")})();`;const r=new window.Blob([a],{type:"text/javascript"});if(e.bare)return r;const o=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(r),s=new window.Worker(o);return s.objectURL=o,s}(638),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[A,e]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},Q.Z.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:Q.Z.getConfig()})}catch(t){c.Z.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new x.Z(A,e)}else this._controller=new x.Z(A,e);if(this._controller){const A=this._controller;null==A||A.on(p.Z.IO_ERROR,this._onIOError.bind(this)),null==A||A.on(p.Z.DEMUX_ERROR,this._onDemuxError.bind(this)),null==A||A.on(p.Z.INIT_SEGMENT,this._onInitSegment.bind(this)),null==A||A.on(p.Z.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),null==A||A.on(p.Z.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),null==A||A.on(p.Z.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),null==A||A.on(p.Z.MEDIA_INFO,this._onMediaInfo.bind(this)),null==A||A.on(p.Z.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),null==A||A.on(p.Z.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),null==A||A.on(p.Z.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),null==A||A.on(p.Z.SMPTE2038_METADATA_ARRIVED,this._onSMPTE2038MetadataArrived.bind(this)),null==A||A.on(p.Z.SCTE35_METADATA_ARRIVED,this._onSCTE35MetadataArrived.bind(this)),null==A||A.on(p.Z.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),null==A||A.on(p.Z.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),null==A||A.on(p.Z.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),null==A||A.on(p.Z.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}destroy(){var A;this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),Q.Z.removeListener(this.e.onLoggingConfigChanged),this.e=null):(null===(A=this._controller)||void 0===A||A.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null}on(A,e){this._emitter.addListener(A,e)}off(A,e){this._emitter.removeListener(A,e)}hasWorker(){return null!=this._worker}open(){var A;this._worker?this._worker.postMessage({cmd:"start"}):null===(A=this._controller)||void 0===A||A.start()}close(){var A;this._worker?this._worker.postMessage({cmd:"stop"}):null===(A=this._controller)||void 0===A||A.stop()}seek(A){var e;this._worker?this._worker.postMessage({cmd:"seek",param:A}):null===(e=this._controller)||void 0===e||e.seek(A)}pause(){var A;this._worker?this._worker.postMessage({cmd:"pause"}):null===(A=this._controller)||void 0===A||A.pause()}resume(){var A;this._worker?this._worker.postMessage({cmd:"resume"}):null===(A=this._controller)||void 0===A||A.resume()}_onInitSegment(A,e){Promise.resolve().then((()=>{this._emitter.emit(p.Z.INIT_SEGMENT,A,e)}))}_onMediaSegment(A,e){Promise.resolve().then((()=>{this._emitter.emit(p.Z.MEDIA_SEGMENT,A,e)}))}_onLoadingComplete(){Promise.resolve().then((()=>{this._emitter.emit(p.Z.LOADING_COMPLETE)}))}_onRecoveredEarlyEof(){Promise.resolve().then((()=>{this._emitter.emit(p.Z.RECOVERED_EARLY_EOF)}))}_onMediaInfo(A){Promise.resolve().then((()=>{this._emitter.emit(p.Z.MEDIA_INFO,A)}))}_onMetaDataArrived(A){Promise.resolve().then((()=>{this._emitter.emit(p.Z.METADATA_ARRIVED,A)}))}_onScriptDataArrived(A){Promise.resolve().then((()=>{this._emitter.emit(p.Z.SCRIPTDATA_ARRIVED,A)}))}_onTimedID3MetadataArrived(A){Promise.resolve().then((()=>{this._emitter.emit(p.Z.TIMED_ID3_METADATA_ARRIVED,A)}))}_onSMPTE2038MetadataArrived(A){Promise.resolve().then((()=>{this._emitter.emit(p.Z.SMPTE2038_METADATA_ARRIVED,A)}))}_onSCTE35MetadataArrived(A){Promise.resolve().then((()=>{this._emitter.emit(p.Z.SCTE35_METADATA_ARRIVED,A)}))}_onPESPrivateDataDescriptor(A){Promise.resolve().then((()=>{this._emitter.emit(p.Z.PES_PRIVATE_DATA_DESCRIPTOR,A)}))}_onPESPrivateDataArrived(A){Promise.resolve().then((()=>{this._emitter.emit(p.Z.PES_PRIVATE_DATA_ARRIVED,A)}))}_onStatisticsInfo(A){Promise.resolve().then((()=>{this._emitter.emit(p.Z.STATISTICS_INFO,A)}))}_onIOError(A,e){Promise.resolve().then((()=>{this._emitter.emit(p.Z.IO_ERROR,A,e)}))}_onDemuxError(A,e){Promise.resolve().then((()=>{this._emitter.emit(p.Z.DEMUX_ERROR,A,e)}))}_onRecommendSeekpoint(A){Promise.resolve().then((()=>{this._emitter.emit(p.Z.RECOMMEND_SEEKPOINT,A)}))}_onLoggingConfigChanged(A){this._worker&&this._worker.postMessage({cmd:"logging_config",param:A})}_onWorkerMessage(A){const e=A.data,t=null==e?void 0:e.data;if("destroyed"===e.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(e.msg){case p.Z.INIT_SEGMENT:case p.Z.MEDIA_SEGMENT:this._emitter.emit(e.msg,t.type,t.data);break;case p.Z.LOADING_COMPLETE:case p.Z.RECOVERED_EARLY_EOF:this._emitter.emit(e.msg);break;case p.Z.MEDIA_INFO:Object.setPrototypeOf(t,m.Z.prototype),this._emitter.emit(e.msg,t);break;case p.Z.METADATA_ARRIVED:case p.Z.SCRIPTDATA_ARRIVED:case p.Z.TIMED_ID3_METADATA_ARRIVED:case p.Z.SMPTE2038_METADATA_ARRIVED:case p.Z.SCTE35_METADATA_ARRIVED:case p.Z.PES_PRIVATE_DATA_DESCRIPTOR:case p.Z.PES_PRIVATE_DATA_ARRIVED:case p.Z.STATISTICS_INFO:this._emitter.emit(e.msg,t);break;case p.Z.IO_ERROR:case p.Z.DEMUX_ERROR:this._emitter.emit(e.msg,t.type,t.info);break;case p.Z.RECOMMEND_SEEKPOINT:this._emitter.emit(e.msg,t);break;case"logcat_callback":c.Z.emitter.emit("log",t.type,t.logcat)}}},_="error",S="source_open",D="update_end",w="buffer_full";var v=t(68),F=t(411);const b=class{constructor(A){this.TAG="MSEController",this._config=A,this._emitter=new g.EventEmitter,this._config.isLive&&void 0===this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new v.Vn}destroy(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null}on(A,e){this._emitter.addListener(A,e)}off(A,e){this._emitter.removeListener(A,e)}attachMediaElement(A){if(this._mediaSource)throw new F.rT("MediaSource has been attached to an HTMLMediaElement!");const e=this._mediaSource=new window.MediaSource;e.addEventListener("sourceopen",this.e.onSourceOpen),e.addEventListener("sourceended",this.e.onSourceEnded),e.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=A,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),A.src=this._mediaSourceObjectURL}detachMediaElement(){if(this._mediaSource){const A=this._mediaSource;for(const e in this._sourceBuffers){const t=this._pendingSegments[e];t.splice(0,t.length),this._pendingSegments[e]=null,this._pendingRemoveRanges[e]=null,this._lastInitSegments[e]=null;const i=this._sourceBuffers[e];if(i){if("closed"!==A.readyState){try{A.removeSourceBuffer(i)}catch(A){c.Z.e(this.TAG,A.message)}null==i||i.removeEventListener("error",this.e.onSourceBufferError),null==i||i.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[e]=null,this._sourceBuffers[e]=null}}if("open"===A.readyState)try{A.endOfStream()}catch(A){c.Z.e(this.TAG,A.message)}A.removeEventListener("sourceopen",this.e.onSourceOpen),A.removeEventListener("sourceended",this.e.onSourceEnded),A.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)}appendInitSegment(A,e){var t;if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(A),void this._pendingSegments[A.type].push(A);const i=A;let n=`${i.container}`;i.codec&&i.codec.length>0&&(n+=`;codecs=${i.codec}`);let a=!1;if(c.Z.v(this.TAG,"Received Initialization Segment, mimeType: "+n),this._lastInitSegments[i.type]=i,n!==this._mimeTypes[i.type]){if(this._mimeTypes[i.type])c.Z.v(this.TAG,`Notice: ${i.type} mimeType changed, origin: ${this._mimeTypes[i.type]||""}, target: ${n}`);else{a=!0;try{const A=this._sourceBuffers[i.type]=this._mediaSource.addSourceBuffer(n);A.addEventListener("error",this.e.onSourceBufferError),A.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(A){return c.Z.e(this.TAG,A.message),void this._emitter.emit(_,{code:A.code,msg:A.message})}}this._mimeTypes[i.type]=n}e||this._pendingSegments[i.type].push(i),a||this._sourceBuffers[i.type]&&!(null===(t=this._sourceBuffers[i.type])||void 0===t?void 0:t.updating)&&this._doAppendSegments(),l.Z.safari&&"audio/mpeg"===i.container&&i.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=i.mediaDuration/1e3,this._updateMediaSourceDuration())}appendMediaSegment(A){const e=A;this._pendingSegments[e.type].push(e),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();const t=this._sourceBuffers[e.type];!t||t.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()}seek(A){var e,t;for(const i in this._sourceBuffers){if(!this._sourceBuffers[i])continue;const n=this._sourceBuffers[i];if("open"===(null===(e=this._mediaSource)||void 0===e?void 0:e.readyState))try{null==n||n.abort()}catch(A){c.Z.e(this.TAG,A.message)}this._idrList.clear();const a=this._pendingSegments[i];if(a.splice(0,a.length),"closed"!==(null===(t=this._mediaSource)||void 0===t?void 0:t.readyState)){if(n){for(let A=0;A=1&&t-A.start(0)>=((null===(e=this._config)||void 0===e?void 0:e.autoCleanupMaxBackwardDuration)||0))return!0}}return!1}_doCleanupSourceBuffer(){var A,e,t;const i=null===(A=this._mediaElement)||void 0===A?void 0:A.currentTime;for(const A in this._sourceBuffers){const n=this._sourceBuffers[A];if(n){const a=n.buffered;let r=!1;for(let n=0;n=((null===(e=this._config)||void 0===e?void 0:e.autoCleanupMaxBackwardDuration)||0)){r=!0;const e=i-((null===(t=this._config)||void 0===t?void 0:t.autoCleanupMinBackwardDuration)||0);this._pendingRemoveRanges[A].push({start:o,end:e})}}else s0&&(isNaN(a)||r>a)&&(c.Z.v(this.TAG,`Update MediaSource duration from ${a} to ${r}`),this._mediaSource.duration=r),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}_doRemoveRanges(){var A;for(const e in this._pendingRemoveRanges){if(!this._sourceBuffers[e]||(null===(A=this._sourceBuffers[e])||void 0===A?void 0:A.updating))continue;const t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];for(;i.length&&!(null==t?void 0:t.updating);){const A=i.shift();null==t||t.remove(A.start,A.end)}}}_doAppendSegments(){var A,e,t;const i=this._pendingSegments;for(const n in i)if(this._sourceBuffers[n]&&!(null===(A=this._sourceBuffers[n])||void 0===A?void 0:A.updating)&&i[n].length>0){const A=i[n].shift();if(null==A?void 0:A.timestampOffset){const t=(null===(e=this._sourceBuffers[n])||void 0===e?void 0:e.timestampOffset)||0,i=A.timestampOffset/1e3;Math.abs(t-i)>.1&&(c.Z.v(this.TAG,`Update MPEG audio timestampOffset from ${t} to ${i}`),this._sourceBuffers[n]&&(this._sourceBuffers[n].timestampOffset=i)),delete A.timestampOffset}if(!A.data||0===A.data.byteLength)continue;try{null===(t=this._sourceBuffers[n])||void 0===t||t.appendBuffer(A.data),this._isBufferFull=!1,"video"===n&&A.hasOwnProperty("info")&&this._idrList.appendArray(A.info.syncPoints)}catch(e){this._pendingSegments[n].unshift(A),22===e.code?(this._isBufferFull||this._emitter.emit(w),this._isBufferFull=!0):(c.Z.e(this.TAG,e.message),this._emitter.emit(_,{code:e.code,msg:e.message}))}}}_onSourceOpen(){var A;if(c.Z.v(this.TAG,"MediaSource onSourceOpen"),null===(A=this._mediaSource)||void 0===A||A.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0){const A=this._pendingSourceBufferInit;for(;A.length;){const e=A.shift();this.appendInitSegment(e,!0)}}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(S)}_onSourceEnded(){c.Z.v(this.TAG,"MediaSource onSourceEnded")}_onSourceClose(){c.Z.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))}_hasPendingSegments(){const A=this._pendingSegments;return A.video.length>0||A.audio.length>0}_hasPendingRemoveRanges(){const A=this._pendingRemoveRanges;return A.video.length>0||A.audio.length>0}_onSourceBufferUpdateEnd(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(D)}_onSourceBufferError(A){c.Z.e(this.TAG,`SourceBuffer Error: ${A}`)}};var R=t(898);const k={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},P={NETWORK_EXCEPTION:s.nm.EXCEPTION,NETWORK_STATUS_CODE_INVALID:s.nm.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:s.nm.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:s.nm.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:R.Z.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:R.Z.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:R.Z.CODEC_UNSUPPORTED};const N=class{constructor(A,e){var t,i,n;this.TAG="MSEPlayer",this._type="MSEPlayer",this._emitter=new g.EventEmitter,this._config=a(),"object"==typeof e&&Object.assign(this._config,e);const r=A.type.toLowerCase();if("mse"!==r&&"mpegts"!==r&&"m2ts"!==r&&"flv"!==r)throw new F.OC("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");A.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=A,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;const o=l.Z.chrome&&(l.Z.version&&(null===(t=l.Z.version)||void 0===t?void 0:t.major)<50||l.Z.version&&50===(null===(i=null===l.Z||void 0===l.Z?void 0:l.Z.version)||void 0===i?void 0:i.major)&&((null===(n=null===l.Z||void 0===l.Z?void 0:l.Z.version)||void 0===n?void 0:n.build)||-1)<2661);this._alwaysSeekKeyframe=!!(o||l.Z.msedge||l.Z.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}destroy(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}on(A,e){A===I.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((()=>{this._emitter.emit(I.MEDIA_INFO,this.mediaInfo)})):A===I.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((()=>{this._emitter.emit(I.STATISTICS_INFO,this.statisticsInfo)})),this._emitter.addListener(A,e)}off(A,e){this._emitter.removeListener(A,e)}attachMediaElement(A){var e,t,i,n,a;if(this._mediaElement=A,A.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),A.addEventListener("seeking",this.e.onvSeeking),A.addEventListener("canplay",this.e.onvCanPlay),A.addEventListener("stalled",this.e.onvStalled),A.addEventListener("progress",this.e.onvProgress),this._msectl=new b(this._config),null===(e=this._msectl)||void 0===e||e.on(D,this._onmseUpdateEnd.bind(this)),null===(t=this._msectl)||void 0===t||t.on(w,this._onmseBufferFull.bind(this)),null===(i=this._msectl)||void 0===i||i.on(S,(()=>{this._mseSourceOpened=!0,this._hasPendingLoad&&(this._hasPendingLoad=!1,this.load())})),null===(n=this._msectl)||void 0===n||n.on(_,(A=>{this._emitter.emit(I.ERROR,k.MEDIA_ERROR,P.MEDIA_MSE_ERROR,A)})),null===(a=this._msectl)||void 0===a||a.attachMediaElement(A),null!=this._pendingSeekTime)try{A.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(A){}}detachMediaElement(){var A;this._mediaElement&&(null===(A=this._msectl)||void 0===A||A.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)}load(){if(!this._mediaElement)throw new F.rT("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new F.rT("MSEPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(!this._config.deferLoadAfterSourceOpen||this._mseSourceOpened?(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new y(this._mediaDataSource,this._config),this._transmuxer.on(p.Z.INIT_SEGMENT,((A,e)=>{var t;null===(t=this._msectl)||void 0===t||t.appendInitSegment(e)})),this._transmuxer.on(p.Z.MEDIA_SEGMENT,((A,e)=>{var t,i,n;if(null===(t=this._msectl)||void 0===t||t.appendMediaSegment(e),this._config.lazyLoad&&!this._config.isLive){const A=null===(i=this._mediaElement)||void 0===i?void 0:i.currentTime;e.info.endDts>=1e3*(A+((null===(n=this._config)||void 0===n?void 0:n.lazyLoadMaxDuration)||0))&&null==this._progressChecker&&(c.Z.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}})),this._transmuxer.on(p.Z.LOADING_COMPLETE,(()=>{var A;null===(A=this._msectl)||void 0===A||A.endOfStream(),this._emitter.emit(I.LOADING_COMPLETE)})),this._transmuxer.on(p.Z.RECOVERED_EARLY_EOF,(()=>{this._emitter.emit(I.RECOVERED_EARLY_EOF)})),this._transmuxer.on(p.Z.IO_ERROR,((A,e)=>{this._emitter.emit(I.ERROR,k.NETWORK_ERROR,A,e)})),this._transmuxer.on(p.Z.DEMUX_ERROR,((A,e)=>{this._emitter.emit(I.ERROR,k.MEDIA_ERROR,A,{code:-1,msg:e})})),this._transmuxer.on(p.Z.MEDIA_INFO,(A=>{this._mediaInfo=A,this._emitter.emit(I.MEDIA_INFO,Object.assign({},A))})),this._transmuxer.on(p.Z.METADATA_ARRIVED,(A=>{this._emitter.emit(I.METADATA_ARRIVED,A)})),this._transmuxer.on(p.Z.SCRIPTDATA_ARRIVED,(A=>{this._emitter.emit(I.SCRIPTDATA_ARRIVED,A)})),this._transmuxer.on(p.Z.TIMED_ID3_METADATA_ARRIVED,(A=>{this._emitter.emit(I.TIMED_ID3_METADATA_ARRIVED,A)})),this._transmuxer.on(p.Z.SMPTE2038_METADATA_ARRIVED,(A=>{this._emitter.emit(I.SMPTE2038_METADATA_ARRIVED,A)})),this._transmuxer.on(p.Z.SCTE35_METADATA_ARRIVED,(A=>{this._emitter.emit(I.SCTE35_METADATA_ARRIVED,A)})),this._transmuxer.on(p.Z.PES_PRIVATE_DATA_DESCRIPTOR,(A=>{this._emitter.emit(I.PES_PRIVATE_DATA_DESCRIPTOR,A)})),this._transmuxer.on(p.Z.PES_PRIVATE_DATA_ARRIVED,(A=>{this._emitter.emit(I.PES_PRIVATE_DATA_ARRIVED,A)})),this._transmuxer.on(p.Z.STATISTICS_INFO,(A=>{this._statisticsInfo=this._fillStatisticsInfo(A),this._emitter.emit(I.STATISTICS_INFO,Object.assign({},this._statisticsInfo))})),this._transmuxer.on(p.Z.RECOMMEND_SEEKPOINT,(A=>{this._mediaElement&&!this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=A/1e3)})),this._transmuxer.open()):this._hasPendingLoad=!0)}unload(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}play(){var A;return function(A,e,t,i){return new(t||(t=Promise))((function(n,a){function r(A){try{s(i.next(A))}catch(A){a(A)}}function o(A){try{s(i.throw(A))}catch(A){a(A)}}function s(A){var e;A.done?n(A.value):(e=A.value,e instanceof t?e:new t((function(A){A(e)}))).then(r,o)}s((i=i.apply(A,e||[])).next())}))}(this,void 0,void 0,(function*(){return yield null===(A=this._mediaElement)||void 0===A?void 0:A.play()}))}pause(){var A;null===(A=this._mediaElement)||void 0===A||A.pause()}get type(){return this._type}get buffered(){var A;return null===(A=this._mediaElement)||void 0===A?void 0:A.buffered}get duration(){var A;return null===(A=this._mediaElement)||void 0===A?void 0:A.duration}get volume(){var A;return null===(A=this._mediaElement)||void 0===A?void 0:A.volume}set volume(A){this._mediaElement&&(this._mediaElement.volume=A)}get muted(){var A;return null===(A=this._mediaElement)||void 0===A?void 0:A.muted}set muted(A){this._mediaElement&&(this._mediaElement.muted=A)}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(A){this._mediaElement?this._internalSeek(A):this._pendingSeekTime=A}get mediaInfo(){return Object.assign({},this._mediaInfo)}get statisticsInfo(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}_fillStatisticsInfo(A){if(A.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return A;let e=!0,t=0,i=0;if(this._mediaElement.getVideoPlaybackQuality){const A=this._mediaElement.getVideoPlaybackQuality();t=A.totalVideoFrames,i=A.droppedVideoFrames}else void 0!==this._mediaElement.webkitDecodedFrameCount?(t=this._mediaElement.webkitDecodedFrameCount,i=this._mediaElement.webkitDroppedFrameCount):e=!1;return e&&(A.decodedFrames=t,A.droppedFrames=i),A}_onmseUpdateEnd(){var A,e,t,i;const n=null===(A=this._mediaElement)||void 0===A?void 0:A.buffered,a=(null===(e=this._mediaElement)||void 0===e?void 0:e.currentTime)||0;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&(null==n?void 0:n.length)>0&&!(null===(t=this._mediaElement)||void 0===t?void 0:t.paused)){const A=n.end(n.length-1);if(A>((null===(i=this._config)||void 0===i?void 0:i.liveBufferLatencyMaxLatency)||0)&&A-a>(this._config.liveBufferLatencyMaxLatency||0)){const e=A-(this._config.liveBufferLatencyMinRemain||0);this.currentTime=e}}if(!this._config.lazyLoad||this._config.isLive)return;let r=0;for(let A=0;A=a+(this._config.lazyLoadMaxDuration||0)&&null==this._progressChecker&&(c.Z.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}_onmseBufferFull(){c.Z.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()}_suspendTransmuxer(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))}_checkProgressAndResume(){var A,e,t;const i=(null===(A=this._mediaElement)||void 0===A?void 0:A.currentTime)||0,n=null===(e=this._mediaElement)||void 0===e?void 0:e.buffered;let a=!1;for(let A=0;A=e&&i=t-(this._config.lazyLoadRecoverDuration||0)&&(a=!0);break}}a&&(window.clearInterval(this._progressChecker),this._progressChecker=null,a&&(c.Z.v(this.TAG,"Continue loading from paused position"),null===(t=this._transmuxer)||void 0===t||t.resume()))}_isTimepointBuffered(A){var e;const t=null===(e=this._mediaElement)||void 0===e?void 0:e.buffered;for(let e=0;e=i&&A0){const e=(null===(t=this._mediaElement)||void 0===t?void 0:t.buffered).start(0);(e<1&&A0&&e.currentTime0){const A=a.start(0);if(A<1&&n{this._emitter.emit(I.MEDIA_INFO,this.mediaInfo)})):A===I.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((()=>{this._emitter.emit(I.STATISTICS_INFO,this.statisticsInfo)})),this._emitter.addListener(A,e)}off(A,e){this._emitter.removeListener(A,e)}attachMediaElement(A){if(this._mediaElement=A,A.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{A.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(A){}}detachMediaElement(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}load(){var A;if(!this._mediaElement)throw new F.rT("HTMLMediaElement must be attached before load()!");this._mediaElement.src=(null===(A=this._mediaDataSource)||void 0===A?void 0:A.url)||"",this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}unload(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}play(){var A;return function(A,e,t,i){return new(t||(t=Promise))((function(n,a){function r(A){try{s(i.next(A))}catch(A){a(A)}}function o(A){try{s(i.throw(A))}catch(A){a(A)}}function s(A){var e;A.done?n(A.value):(e=A.value,e instanceof t?e:new t((function(A){A(e)}))).then(r,o)}s((i=i.apply(A,e||[])).next())}))}(this,void 0,void 0,(function*(){return yield null===(A=this._mediaElement)||void 0===A?void 0:A.play()}))}pause(){var A;null===(A=this._mediaElement)||void 0===A||A.pause()}get type(){return this._type}get buffered(){var A;return null===(A=this._mediaElement)||void 0===A?void 0:A.buffered}get duration(){var A;return null===(A=this._mediaElement)||void 0===A?void 0:A.duration}get volume(){var A;return null===(A=this._mediaElement)||void 0===A?void 0:A.volume}set volume(A){this._mediaElement&&(this._mediaElement.volume=A)}get muted(){var A;return null===(A=this._mediaElement)||void 0===A?void 0:A.muted}set muted(A){this._mediaElement&&(this._mediaElement.muted=A)}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(A){this._mediaElement?this._mediaElement.currentTime=A:this._pendingSeekTime=A}get mediaInfo(){const A={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(A.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(A.width=this._mediaElement.videoWidth,A.height=this._mediaElement.videoHeight)),A}get statisticsInfo(){const A={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return A;let e=!0,t=0,i=0;if(this._mediaElement.getVideoPlaybackQuality){const A=this._mediaElement.getVideoPlaybackQuality();t=A.totalVideoFrames,i=A.droppedVideoFrames}else void 0!==this._mediaElement.webkitDecodedFrameCount?(t=this._mediaElement.webkitDecodedFrameCount,i=this._mediaElement.webkitDroppedFrameCount):e=!1;return e&&(A.decodedFrames=t,A.droppedFrames=i),A}_onvLoadedMetadata(A){null!=this._pendingSeekTime&&(this._mediaElement&&(this._mediaElement.currentTime=this._pendingSeekTime),this._pendingSeekTime=null),this._emitter.emit(I.MEDIA_INFO,this.mediaInfo)}_reportStatisticsInfo(){this._emitter.emit(I.STATISTICS_INFO,this.statisticsInfo)}},T={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32},L=["h264","h265"],Y={createPlayer:function(A,e){(null==A?void 0:A.url)&&(A.url=(A=>{const e=A.split("?"),t=new URLSearchParams(e[1]);return t.delete("vc"),t.set("vc",L.reduce(((A,e)=>A+(T[e]||0)),0).toString()),e[0]+"?"+t.toString()})(A.url));const t=A;if(null==t||"object"!=typeof t)throw new F.OC("MediaDataSource must be an javascript object!");if(!Object.prototype.hasOwnProperty.call(t,"type"))throw new F.OC("MediaDataSource must has type field to indicate video file type!");switch(t.type){case"mse":case"mpegts":case"m2ts":case"flv":return new N(t,e);default:return new M(t,e)}},isSupported:function(){return o.supportMSEH264Playback()},getFeatureList:function(){return o.getFeatureList()},BaseLoader:s.fp,LoaderStatus:s.GM,LoaderErrors:s.nm,version:"",Events:I,ErrorTypes:k,ErrorDetails:P,MSEPlayer:N,NativePlayer:M,LoggingControl:Q.Z};Object.defineProperty(Y,"version",{enumerable:!0,get:function(){return"2.0.0"}});const G=Y},607:(A,e,t)=>{A.exports=t(578).default},575:(A,e,t)=>{t.d(e,{Z:()=>E});var i=t(645);const n=class{constructor(){var A;this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,(null===(A=self.performance)||void 0===A?void 0:A.now)?this._now=self.performance.now.bind(self.performance):this._now=Date.now}reset(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}addBytes(A){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=A,this._totalBytes+=A):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=A,this._totalBytes+=A):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=A,this._totalBytes+=A,this._lastCheckpoint=this._now())}get currentKBps(){this.addBytes(0);let A=(this._now()-this._lastCheckpoint)/1e3;return 0===A&&(A=1),this._intervalBytes/A/1024}get lastSecondKBps(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}get averageKBps(){const A=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/A/1024}};var a=t(108),r=t(479),o=t(411);class s extends a.fp{static isSupported(){var A;try{const e=r.Z.msedge&&((null===(A=null===r.Z||void 0===r.Z?void 0:r.Z.version)||void 0===A?void 0:A.minor)||0)>=15048&&!r.Z.webkit,t=!r.Z.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(A){return!1}}constructor(A,e){super("fetch-stream-loader"),this.TAG="FetchStreamLoader",this._seekHandler=A,this._config=e,this._needStash=!0,this._requestAbort=!1,this._abortController=null,this._contentLength=null,this._receivedLength=0}destroy(){this.isWorking()&&this.abort(),super.destroy()}open(A,e){this._dataSource=A,this._range=e;let t=A.url;this._config.reuseRedirectedURL&&void 0!==A.redirectedURL&&(t=A.redirectedURL);const i=this._seekHandler.getConfig(t,e),n=new self.Headers;if("object"==typeof i.headers){const A=i.headers;for(const e in A)A.hasOwnProperty(e)&&n.append(e,A[e])}const r={method:"GET",headers:n,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(const A in this._config.headers)n.append(A,this._config.headers[A]);A.cors||(r.mode="same-origin"),A.withCredentials&&(r.credentials="include"),(null==A?void 0:A.referrerPolicy)&&(r.referrerPolicy=A.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,this._abortController&&(r.signal=this._abortController.signal)),this._status=a.GM.kConnecting,self.fetch(i.url,r).then((A=>{var e,t;if(this._requestAbort)return this._status=a.GM.kIdle,void(null===(e=A.body)||void 0===e||e.cancel());if(A.ok&&A.status>=200&&A.status<=299){if(A.url!==i.url&&this._onURLRedirect){const e=this._seekHandler.removeURLParameters(A.url);this._onURLRedirect(e)}const e=A.headers.get("Content-Length");return null!=e&&(this._contentLength=parseInt(e),0!==this._contentLength&&this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)),this._pump.call(this,null===(t=A.body)||void 0===t?void 0:t.getReader())}if(this._status=a.GM.kError,!this._onError)throw new o.OZ("FetchStreamLoader: Http code invalid, "+A.status+" "+A.statusText);this._onError(a.nm.HTTP_STATUS_CODE_INVALID,{code:A.status,msg:A.statusText})})).catch((A=>{var e;if(!(null===(e=this._abortController)||void 0===e?void 0:e.signal.aborted)){if(this._status=a.GM.kError,!this._onError)throw A;this._onError(a.nm.EXCEPTION,{code:-1,msg:A.message})}}))}abort(){var A;if(this._requestAbort=!0,(this._status!==a.GM.kBuffering||!r.Z.chrome)&&this._abortController)try{null===(A=this._abortController)||void 0===A||A.abort()}catch(A){}}_pump(A){return A.read().then((e=>{var t,i,n,r;if(e.done)if(null!==this._contentLength&&this._receivedLength{var e,t;if(null===(t=null===(e=this._abortController)||void 0===e?void 0:e.signal)||void 0===t?void 0:t.aborted)return void(this._status=a.GM.kComplete);if(11===A.code&&r.Z.msedge)return;this._status=a.GM.kError;let i=0,n=null;if(19!==A.code&&"network error"!==A.message||!(null===this._contentLength||null!==this._contentLength&&this._receivedLength299)){if(this._status=a.GM.kError,!this._onError)throw new o.OZ("MozChunkedLoader: Http code invalid, "+e.status+" "+e.statusText);this._onError(a.nm.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})}else this._status=a.GM.kBuffering}}_onProgress(A){var e;if(this._status===a.GM.kError)return;null===this._contentLength&&null!==A.total&&0!==A.total&&(this._contentLength=A.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));const t=A.target.response,i=((null===(e=this._range)||void 0===e?void 0:e.from)||0)+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}_onLoadEnd(A){this._requestAbort?this._requestAbort=!1:this._status!==a.GM.kError&&(this._status=a.GM.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}_onXhrError(A){this._status=a.GM.kError;let e=0,t=null;if(this._contentLength&&A.loaded=this._contentLength&&(n=((null===(e=this._range)||void 0===e?void 0:e.from)||0)+this._contentLength-1),this._currentRequestRange={from:i,to:n},this._internalOpen(this._dataSource,this._currentRequestRange)}_internalOpen(A,e){this._lastTimeLoaded=0;let t=A.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?t=this._currentRedirectedURL:null!=A.redirectedURL&&(t=A.redirectedURL));const i=this._seekHandler.getConfig(t,e);this._currentRequestURL=i.url;const n=this._xhr=new XMLHttpRequest;if(n.open("GET",i.url,!0),n.responseType="arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onload=this._onLoad.bind(this),n.onerror=this._onXhrError.bind(this),A.withCredentials&&(n.withCredentials=!0),"object"==typeof i.headers){const A=i.headers;for(const e in A)A.hasOwnProperty(e)&&n.setRequestHeader(e,A[e])}if("object"==typeof this._config.headers){const A=this._config.headers;for(const e in A)A.hasOwnProperty(e)&&n.setRequestHeader(e,A[e])}n.send()}abort(){this._requestAbort=!0,this._internalAbort(),this._status=a.GM.kComplete}_internalAbort(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}_onReadyStateChange(A){const e=A.target;if(2===e.readyState){if(null!=e.responseURL){const A=this._seekHandler.removeURLParameters(e.responseURL);e.responseURL!==this._currentRequestURL&&A!==this._currentRedirectedURL&&(this._currentRedirectedURL=A,this._onURLRedirect&&this._onURLRedirect(A))}if(e.status>=200&&e.status<=299){if(this._waitForTotalLength)return;this._status=a.GM.kBuffering}else{if(this._status=a.GM.kError,!this._onError)throw new o.OZ("RangeLoader: Http code invalid, "+e.status+" "+e.statusText);this._onError(a.nm.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})}}}_onProgress(A){if(this._status===a.GM.kError)return;if(null===this._contentLength){let e=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,e=!0;const t=A.total;this._internalAbort(),null!=t&&0!==t&&(this._totalLength=t)}if(-1===this._range.to?this._contentLength=(this._totalLength||0)-this._range.from:this._contentLength=this._range.to-this._range.from+1,e)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}const e=A.loaded-this._lastTimeLoaded;this._lastTimeLoaded=A.loaded,this._speedSampler.addBytes(e)}_normalizeSpeed(A){const e=this._chunkSizeKBList,t=e.length-1;let i=0,n=0,a=t;if(A=e[i]&&A=3&&(e=this._speedSampler.currentKBps)),0!==e){const A=this._normalizeSpeed(e);this._currentSpeedNormalized!==A&&(this._currentSpeedNormalized=A,this._currentChunkSizeKB=A)}const t=A.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength;let n=!1;null!=this._contentLength&&this._receivedLength0&&this._receivedLength{this._dispatchArrayBuffer(null==e?void 0:e.result)},e.readAsArrayBuffer(A.data)}else{this._status=a.GM.kError;const e={code:-1,msg:"Unsupported WebSocket message type: "+A.data.constructor.name};if(!this._onError)throw new o.OZ(e.msg);this._onError(a.nm.EXCEPTION,e)}}_dispatchArrayBuffer(A){const e=A,t=this._receivedLength;this._receivedLength+=e.byteLength,this._onDataArrival&&this._onDataArrival(e,t,this._receivedLength)}_onWebSocketError(A){this._status=a.GM.kError;const e={code:A.code,msg:A.message};if(!this._onError)throw new o.OZ(e.msg);this._onError(a.nm.EXCEPTION,e)}}const h=d,B=class{constructor(A){this._zeroStart=A||!1}getConfig(A,e){const t={};if(0!==e.from||-1!==e.to){let A;A=-1!==e.to?`bytes=${e.from.toString()}-${e.to.toString()}`:`bytes=${e.from.toString()}-`,t.Range=A}else this._zeroStart&&(t.Range="bytes=0-");return{url:A,headers:t}}removeURLParameters(A){return A}},u=class{constructor(A,e){this._startName=A,this._endName=e}getConfig(A,e){let t=A;if(0!==e.from||-1!==e.to){let A=!0;t.includes("?")||(t+="?",A=!1),A&&(t+="&"),t+=`${this._startName}=${e.from.toString()}`,-1!==e.to&&(t+=`&${this._endName}=${e.to.toString()}`)}return{url:t,headers:{}}}removeURLParameters(A){const e=A.split("?")[0];let t;const i=A.indexOf("?");-1!==i&&(t=A.substring(i+1));let n="";if(void 0!==t&&t.length>0){const A=t.split("&");for(let e=0;e0;t[0]!==this._startName&&t[0]!==this._endName&&(i&&(n+="&"),n+=A[e])}}return 0===n.length?e:e+"?"+n}},E=class{constructor(A,e,t){this.TAG="IOController",this._config=e,this._extraData=t,this._stashInitialSize=65536,void 0!==e.stashInitialSize&&e.stashInitialSize>0&&(this._stashInitialSize=e.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,e.enableStashBuffer||(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=A,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(A.url||""),this._refTotalLength=A.filesize?A.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new n,this._speedNormalizeList=[32,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}destroy(){var A,e,t;(null===(A=this._loader)||void 0===A?void 0:A.isWorking())&&(null===(e=this._loader)||void 0===e||e.abort()),null===(t=this._loader)||void 0===t||t.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null}isWorking(){var A;return(null===(A=this._loader)||void 0===A?void 0:A.isWorking())&&!this._paused}isPaused(){return this._paused}get status(){var A;return null===(A=this._loader)||void 0===A?void 0:A.status}get extraData(){return this._extraData}set extraData(A){this._extraData=A}get onDataArrival(){return this._onDataArrival}set onDataArrival(A){this._onDataArrival=A}get onSeeked(){return this._onSeeked}set onSeeked(A){this._onSeeked=A}get onError(){return this._onError}set onError(A){this._onError=A}get onComplete(){return this._onComplete}set onComplete(A){this._onComplete=A}get onRedirect(){return this._onRedirect}set onRedirect(A){this._onRedirect=A}get onRecoveredEarlyEof(){return this._onRecoveredEarlyEof}set onRecoveredEarlyEof(A){this._onRecoveredEarlyEof=A}get currentURL(){var A;return null===(A=this._dataSource)||void 0===A?void 0:A.url}get hasRedirect(){var A;return null!=this._redirectedURL||void 0!==(null===(A=this._dataSource)||void 0===A?void 0:A.redirectedURL)}get currentRedirectedURL(){var A;return this._redirectedURL||(null===(A=this._dataSource)||void 0===A?void 0:A.redirectedURL)}get currentSpeed(){var A,e;return this._loaderClass===C?null===(A=this._loader)||void 0===A?void 0:A.currentSpeed:null===(e=this._speedSampler)||void 0===e?void 0:e.lastSecondKBps}get loaderType(){var A;return null===(A=this._loader)||void 0===A?void 0:A.type}_selectSeekHandler(){const A=this._config;if("range"===A.seekType)this._seekHandler=new B(!!this._config.rangeLoadZeroStart);else if("param"===A.seekType){const e=A.seekParamStart||"bstart",t=A.seekParamEnd||"bend";this._seekHandler=new u(e,t)}else{if("custom"!==A.seekType)throw new o.OC(`Invalid seekType in config: ${(null==A?void 0:A.seekType)||""}`);if("function"!=typeof A.customSeekHandler)throw new o.OC("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new A.customSeekHandler}}_selectLoader(){var A;if(null!=this._config.customLoader)this._loaderClass=(null===(A=this._config)||void 0===A?void 0:A.customLoader)||null;else if(this._isWebSocketURL)this._loaderClass=h;else if(g.isSupported())this._loaderClass=g;else if(l.isSupported())this._loaderClass=l;else{if(!C.isSupported())throw new o.OZ("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=C}}_createLoader(){var A;this._loaderClass&&(this._loader=new this._loaderClass(this._seekHandler,this._config),(null===(A=this._loader)||void 0===A?void 0:A.needStashBuffer)||(this._enableStash=!1),this._loader&&(this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)))}open(A){var e,t;this._currentRange={from:0,to:-1},A&&(this._currentRange.from=A),null===(e=this._speedSampler)||void 0===e||e.reset(),A||(this._fullRequestFlag=!0),null===(t=this._loader)||void 0===t||t.open(this._dataSource,Object.assign({},this._currentRange))}abort(){var A;null===(A=this._loader)||void 0===A||A.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}pause(){var A,e;this.isWorking()&&(null===(A=this._loader)||void 0===A||A.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange&&(this._currentRange.to=this._stashByteStart-1)):this._resumeFrom=((null===(e=this._currentRange)||void 0===e?void 0:e.to)||0)+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}resume(){if(this._paused){this._paused=!1;const A=this._resumeFrom;this._resumeFrom=0,this._internalSeek(A,!0)}}seek(A){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(A,!0)}_internalSeek(A,e){var t,i,n,a;(null===(t=this._loader)||void 0===t?void 0:t.isWorking())&&(null===(i=this._loader)||void 0===i||i.abort()),this._flushStashBuffer(e),null===(n=this._loader)||void 0===n||n.destroy(),this._loader=null;const r={from:A,to:-1};this._currentRange={from:r.from,to:-1},null===(a=this._speedSampler)||void 0===a||a.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,r),this._onSeeked&&this._onSeeked()}updateUrl(A){if(!A||"string"!=typeof A||0===A.length)throw new o.OC("Url must be a non-empty string!");this._dataSource.url=A}_expandBuffer(A){let e=this._stashSize;for(;e+10485760){const A=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(t,0,e).set(A,0)}this._stashBuffer=t,this._bufferSize=e}_normalizeSpeed(A){const e=this._speedNormalizeList,t=e.length-1;let i=0,n=0,a=t;if(A=e[i]&&A=512&&A<=1024?Math.floor(1.5*A):2*A,e>8192&&(e=8192);const t=1024*e+1048576;this._bufferSize0){const e=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(e,this._stashByteStart);if(i0){const A=new Uint8Array(e,i);t.set(A,0),this._stashUsed=A.byteLength,this._stashByteStart+=i}}else this._stashUsed=0,this._stashByteStart+=i;this._stashUsed+A.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+A.byteLength),t=new Uint8Array(this._stashBuffer,0,this._bufferSize)),t.set(new Uint8Array(A),this._stashUsed),this._stashUsed+=A.byteLength}else{const i=this._dispatchChunks(A,e);if(ithis._bufferSize&&(this._expandBuffer(n),t=new Uint8Array(this._stashBuffer,0,this._bufferSize)),t.set(new Uint8Array(A,i),0),this._stashUsed+=n,this._stashByteStart=e+i}}}else if(0===this._stashUsed){const t=this._dispatchChunks(A,e);if(tthis._bufferSize&&this._expandBuffer(i),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(A,t),0),this._stashUsed+=i,this._stashByteStart=e+t}}else{this._stashUsed+A.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+A.byteLength);const e=new Uint8Array(this._stashBuffer,0,this._bufferSize);e.set(new Uint8Array(A),this._stashUsed),this._stashUsed+=A.byteLength;const t=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(t0){const A=new Uint8Array(this._stashBuffer,t);e.set(A,0)}this._stashUsed-=t,this._stashByteStart+=t}}_flushStashBuffer(A){if(this._stashUsed>0){const e=this._stashBuffer.slice(0,this._stashUsed),t=this._dispatchChunks(e,this._stashByteStart),n=e.byteLength-t;if(t0){const A=new Uint8Array(this._stashBuffer,0,this._bufferSize),i=new Uint8Array(e,t);A.set(i,0),this._stashUsed=i.byteLength,this._stashByteStart+=t}return 0}i.Z.w(this.TAG,`${n} bytes unconsumed data remain when flush buffer, dropped`)}return this._stashUsed=0,this._stashByteStart=0,n}return 0}_onLoaderComplete(A,e){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}_onLoaderError(A,e){var t;switch(i.Z.e(this.TAG,`Loader error, code = ${e.code}, msg = ${e.msg}`),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,A=a.nm.UNRECOVERABLE_EARLY_EOF),A){case a.nm.EARLY_EOF:if(!this._config.isLive&&this._totalLength){const A=((null===(t=this._currentRange)||void 0===t?void 0:t.to)||0)+1;return void(A{t.d(e,{GM:()=>n,fp:()=>r,nm:()=>a});var i=t(411);const n={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},a={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"};class r{constructor(A){this._type=A||"undefined",this._status=n.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}destroy(){this._status=n.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}isWorking(){return this._status===n.kConnecting||this._status===n.kBuffering}get type(){return this._type}get status(){return this._status}get needStashBuffer(){return this._needStash}get onContentLengthKnown(){return this._onContentLengthKnown}set onContentLengthKnown(A){this._onContentLengthKnown=A}get onURLRedirect(){return this._onURLRedirect}set onURLRedirect(A){this._onURLRedirect=A}get onDataArrival(){return this._onDataArrival}set onDataArrival(A){this._onDataArrival=A}get onError(){return this._onError}set onError(A){this._onError=A}get onComplete(){return this._onComplete}set onComplete(A){this._onComplete=A}open(A,e){throw new i.do("Unimplemented abstract function!")}abort(){throw new i.do("Unimplemented abstract function!")}}},479:(A,e,t)=>{t.d(e,{Z:()=>n});const i={};!function(){const A=self.navigator.userAgent.toLowerCase(),e=/(edge)\/([\w.]+)/.exec(A)||/(opr)[\/]([\w.]+)/.exec(A)||/(chrome)[ \/]([\w.]+)/.exec(A)||/(iemobile)[\/]([\w.]+)/.exec(A)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(A)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(A)||/(webkit)[ \/]([\w.]+)/.exec(A)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(A)||/(msie) ([\w.]+)/.exec(A)||A.includes("trident")&&/(rv)(?::| )([\w.]+)/.exec(A)||!A.includes("compatible")&&/(firefox)[ \/]([\w.]+)/.exec(A)||[],t=/(ipad)/.exec(A)||/(ipod)/.exec(A)||/(windows phone)/.exec(A)||/(iphone)/.exec(A)||/(kindle)/.exec(A)||/(android)/.exec(A)||/(windows)/.exec(A)||/(mac)/.exec(A)||/(linux)/.exec(A)||/(cros)/.exec(A)||[],n={browser:e[5]||e[3]||e[1]||"",version:e[2]||e[4]||"0",majorVersion:e[4]||e[2]||"0",platform:t[0]||""},a={};if(n.browser){a[n.browser]=!0;const A=n.majorVersion.split(".");a.version={major:parseInt(n.majorVersion,10),string:n.version},A.length>1&&(a.version.minor=parseInt(A[1],10)),A.length>2&&(a.version.build=parseInt(A[2],10))}if(n.platform&&(a[n.platform]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),a.rv||a.iemobile){a.rv&&delete a.rv;const A="msie";n.browser=A,a[A]=!0}if(a.edge){delete a.edge;const A="msedge";n.browser=A,a[A]=!0}if(a.opr){const A="opera";n.browser=A,a[A]=!0}if(a.safari&&a.android){const A="android";n.browser=A,a[A]=!0}a.name=n.browser,a.platform=n.platform;for(const A in i)Object.prototype.hasOwnProperty.call(i,A)&&delete i[A];Object.assign(i,a)}();const n=i},411:(A,e,t)=>{t.d(e,{OC:()=>a,OZ:()=>i,do:()=>r,rT:()=>n});class i{constructor(A){this.name="RuntimeException",this._message=A}get message(){return this._message}toString(){return this.name+": "+this.message}}class n extends i{constructor(A){super(A),this.name="IllegalStateException"}}class a extends i{constructor(A){super(A),this.name="InvalidArgumentException"}}class r extends i{constructor(A){super(A),this.name="NotImplementedException"}}},645:(A,e,t)=>{t.d(e,{Z:()=>a});var i=t(99);class n{static e(A,e){var t;A&&!n.FORCE_GLOBAL_TAG||(A=n.GLOBAL_TAG);const i=`[${A}] > ${e}`;n.ENABLE_CALLBACK&&(null===(t=n.emitter)||void 0===t||t.emit("log","error",i)),n.ENABLE_ERROR&&(console.error?console.error(i):console.warn?console.warn(i):console.log(i))}static i(A,e){A&&!n.FORCE_GLOBAL_TAG||(A=n.GLOBAL_TAG);const t=`[${A}] > ${e}`;n.ENABLE_CALLBACK&&n.emitter.emit("log","info",t),n.ENABLE_INFO&&(console.info?console.info(t):console.log(t))}static w(A,e){A&&!n.FORCE_GLOBAL_TAG||(A=n.GLOBAL_TAG);const t=`[${A}] > ${e}`;n.ENABLE_CALLBACK&&n.emitter.emit("log","warn",t),n.ENABLE_WARN&&(console.warn?console.warn(t):console.log(t))}static d(A,e){var t;A&&!n.FORCE_GLOBAL_TAG||(A=n.GLOBAL_TAG);const i=`[${A}] > ${e}`;n.ENABLE_CALLBACK&&(null===(t=n.emitter)||void 0===t||t.emit("log","debug",i)),n.ENABLE_DEBUG&&(console.debug?console.debug(i):console.log(i))}static v(A,e){var t;A&&!n.FORCE_GLOBAL_TAG||(A=n.GLOBAL_TAG);const i=`[${A}] > ${e}`;n.ENABLE_CALLBACK&&(null===(t=n.emitter)||void 0===t||t.emit("log","verbose",i)),n.ENABLE_VERBOSE&&console.log(i)}}n.FORCE_GLOBAL_TAG=!1,n.GLOBAL_TAG="mpegts.js",n.ENABLE_CALLBACK=!1,n.emitter=new i.EventEmitter,n.ENABLE_ERROR=!0,n.ENABLE_INFO=!0,n.ENABLE_WARN=!0,n.ENABLE_DEBUG=!0,n.ENABLE_VERBOSE=!0;const a=n},278:(A,e,t)=>{t.d(e,{Z:()=>r});var i=t(99),n=t(645);class a{static get forceGlobalTag(){return n.Z.FORCE_GLOBAL_TAG}static set forceGlobalTag(A){n.Z.FORCE_GLOBAL_TAG=A,a._notifyChange()}static get globalTag(){return n.Z.GLOBAL_TAG}static set globalTag(A){n.Z.GLOBAL_TAG=A,a._notifyChange()}static get enableAll(){return n.Z.ENABLE_VERBOSE&&n.Z.ENABLE_DEBUG&&n.Z.ENABLE_INFO&&n.Z.ENABLE_WARN&&n.Z.ENABLE_ERROR}static set enableAll(A){n.Z.ENABLE_VERBOSE=A,n.Z.ENABLE_DEBUG=A,n.Z.ENABLE_INFO=A,n.Z.ENABLE_WARN=A,n.Z.ENABLE_ERROR=A,a._notifyChange()}static get enableDebug(){return n.Z.ENABLE_DEBUG}static set enableDebug(A){n.Z.ENABLE_DEBUG=A,a._notifyChange()}static get enableVerbose(){return n.Z.ENABLE_VERBOSE}static set enableVerbose(A){n.Z.ENABLE_VERBOSE=A,a._notifyChange()}static get enableInfo(){return n.Z.ENABLE_INFO}static set enableInfo(A){n.Z.ENABLE_INFO=A,a._notifyChange()}static get enableWarn(){return n.Z.ENABLE_WARN}static set enableWarn(A){n.Z.ENABLE_WARN=A,a._notifyChange()}static get enableError(){return n.Z.ENABLE_ERROR}static set enableError(A){n.Z.ENABLE_ERROR=A,a._notifyChange()}static getConfig(){return{globalTag:n.Z.GLOBAL_TAG,forceGlobalTag:n.Z.FORCE_GLOBAL_TAG,enableVerbose:n.Z.ENABLE_VERBOSE,enableDebug:n.Z.ENABLE_DEBUG,enableInfo:n.Z.ENABLE_INFO,enableWarn:n.Z.ENABLE_WARN,enableError:n.Z.ENABLE_ERROR,enableCallback:n.Z.ENABLE_CALLBACK}}static applyConfig(A){n.Z.GLOBAL_TAG=A.globalTag,n.Z.FORCE_GLOBAL_TAG=A.forceGlobalTag,n.Z.ENABLE_VERBOSE=A.enableVerbose,n.Z.ENABLE_DEBUG=A.enableDebug,n.Z.ENABLE_INFO=A.enableInfo,n.Z.ENABLE_WARN=A.enableWarn,n.Z.ENABLE_ERROR=A.enableError,n.Z.ENABLE_CALLBACK=!!A.enableCallback}static _notifyChange(){const A=a.emitter;if(A.listenerCount("change")>0){const e=a.getConfig();A.emit("change",e)}}static registerListener(A){a.emitter.addListener("change",A)}static removeListener(A){a.emitter.removeListener("change",A)}static addLogListener(A){n.Z.emitter.addListener("log",A),n.Z.emitter.listenerCount("log")>0&&(n.Z.ENABLE_CALLBACK=!0,a._notifyChange())}static removeLogListener(A){n.Z.emitter.removeListener("log",A),0===n.Z.emitter.listenerCount("log")&&(n.Z.ENABLE_CALLBACK=!1,a._notifyChange())}}a.emitter=new i.EventEmitter;const r=a}},e={};function t(i){var n=e[i];if(void 0!==n)return n.exports;var a=e[i]={exports:{}};return A[i](a,a.exports,t),a.exports}return t.m=A,t.n=A=>{var e=A&&A.__esModule?()=>A.default:()=>A;return t.d(e,{a:e}),e},t.d=(A,e)=>{for(var i in e)t.o(e,i)&&!t.o(A,i)&&Object.defineProperty(A,i,{enumerable:!0,get:e[i]})},t.o=(A,e)=>Object.prototype.hasOwnProperty.call(A,e),t(607)})()))}({exports:{}});!function(){function A(A,e){if(!(A instanceof e))throw new TypeError("Cannot call a class as a function")}function e(A,e){for(var t=0;t"']/g,Z=RegExp(j.source),q=RegExp(O.source),X=/<%-([\s\S]+?)%>/g,z=/<%([\s\S]+?)%>/g,$=/<%=([\s\S]+?)%>/g,AA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,eA=/^\w*$/,tA=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,iA=/[\\^$.*+?()[\]{}|]/g,nA=RegExp(iA.source),aA=/^\s+/,rA=/\s/,oA=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,sA=/\{\n\/\* \[wrapped with (.+)\] \*/,gA=/,? & /,cA=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lA=/[()=,{}\[\]\/\s]/,IA=/\\(\\)?/g,CA=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dA=/\w*$/,hA=/^[-+]0x[0-9a-f]+$/i,BA=/^0b[01]+$/i,uA=/^\[object .+?Constructor\]$/,EA=/^0o[0-7]+$/i,fA=/^(?:0|[1-9]\d*)$/,QA=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xA=/($^)/,pA=/['\n\r\u2028\u2029\\]/g,mA="\\ud800-\\udfff",yA="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_A="\\u2700-\\u27bf",SA="a-z\\xdf-\\xf6\\xf8-\\xff",DA="A-Z\\xc0-\\xd6\\xd8-\\xde",wA="\\ufe0e\\ufe0f",vA="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",FA="['’]",bA="["+mA+"]",RA="["+vA+"]",kA="["+yA+"]",PA="\\d+",NA="["+_A+"]",MA="["+SA+"]",TA="[^"+mA+vA+PA+_A+SA+DA+"]",LA="\\ud83c[\\udffb-\\udfff]",YA="[^"+mA+"]",GA="(?:\\ud83c[\\udde6-\\uddff]){2}",UA="[\\ud800-\\udbff][\\udc00-\\udfff]",JA="["+DA+"]",HA="\\u200d",KA="(?:"+MA+"|"+TA+")",VA="(?:"+JA+"|"+TA+")",WA="(?:['’](?:d|ll|m|re|s|t|ve))?",jA="(?:['’](?:D|LL|M|RE|S|T|VE))?",OA="(?:"+kA+"|"+LA+")"+"?",ZA="["+wA+"]?",qA=ZA+OA+("(?:"+HA+"(?:"+[YA,GA,UA].join("|")+")"+ZA+OA+")*"),XA="(?:"+[NA,GA,UA].join("|")+")"+qA,zA="(?:"+[YA+kA+"?",kA,GA,UA,bA].join("|")+")",$A=RegExp(FA,"g"),Ae=RegExp(kA,"g"),ee=RegExp(LA+"(?="+LA+")|"+zA+qA,"g"),te=RegExp([JA+"?"+MA+"+"+WA+"(?="+[RA,JA,"$"].join("|")+")",VA+"+"+jA+"(?="+[RA,JA+KA,"$"].join("|")+")",JA+"?"+KA+"+"+WA,JA+"+"+jA,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",PA,XA].join("|"),"g"),ie=RegExp("["+HA+mA+yA+wA+"]"),ne=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ae=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],re=-1,oe={};oe[N]=oe[M]=oe[T]=oe[L]=oe[Y]=oe[G]=oe[U]=oe[J]=oe[H]=!0,oe[B]=oe[u]=oe[k]=oe[E]=oe[P]=oe[f]=oe[Q]=oe[x]=oe[m]=oe[y]=oe[_]=oe[w]=oe[v]=oe[F]=oe[R]=!1;var se={};se[B]=se[u]=se[k]=se[P]=se[E]=se[f]=se[N]=se[M]=se[T]=se[L]=se[Y]=se[m]=se[y]=se[_]=se[w]=se[v]=se[F]=se[b]=se[G]=se[U]=se[J]=se[H]=!0,se[Q]=se[x]=se[R]=!1;var ge={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ce=parseFloat,le=parseInt,Ie="object"==typeof D&&D&&D.Object===Object&&D,Ce="object"==typeof self&&self&&self.Object===Object&&self,de=Ie||Ce||Function("return this")(),he=e&&!e.nodeType&&e,Be=he&&A&&!A.nodeType&&A,ue=Be&&Be.exports===he,Ee=ue&&Ie.process,fe=function(){try{var A=Be&&Be.require&&Be.require("util").types;return A||Ee&&Ee.binding&&Ee.binding("util")}catch(A){}}(),Qe=fe&&fe.isArrayBuffer,xe=fe&&fe.isDate,pe=fe&&fe.isMap,me=fe&&fe.isRegExp,ye=fe&&fe.isSet,_e=fe&&fe.isTypedArray;function Se(A,e,t){switch(t.length){case 0:return A.call(e);case 1:return A.call(e,t[0]);case 2:return A.call(e,t[0],t[1]);case 3:return A.call(e,t[0],t[1],t[2])}return A.apply(e,t)}function De(A,e,t,i){for(var n=-1,a=null==A?0:A.length;++n-1}function ke(A,e,t){for(var i=-1,n=null==A?0:A.length;++i-1;);return t}function tt(A,e){for(var t=A.length;t--&&Je(e,A[t],0)>-1;);return t}var it=je({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nt=je({"&":"&","<":"<",">":">",'"':""","'":"'"});function at(A){return"\\"+ge[A]}function rt(A){return ie.test(A)}function ot(A){var e=-1,t=Array(A.size);return A.forEach((function(A,i){t[++e]=[i,A]})),t}function st(A,e){return function(t){return A(e(t))}}function gt(A,e){for(var t=-1,i=A.length,n=0,r=[];++t",""":'"',"'":"'"});var Bt=function A(e){var D,rA=(e=null==e?de:Bt.defaults(de.Object(),e,Bt.pick(de,ae))).Array,mA=e.Date,yA=e.Error,_A=e.Function,SA=e.Math,DA=e.Object,wA=e.RegExp,vA=e.String,FA=e.TypeError,bA=rA.prototype,RA=_A.prototype,kA=DA.prototype,PA=e["__core-js_shared__"],NA=RA.toString,MA=kA.hasOwnProperty,TA=0,LA=(D=/[^.]+$/.exec(PA&&PA.keys&&PA.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"",YA=kA.toString,GA=NA.call(DA),UA=de._,JA=wA("^"+NA.call(MA).replace(iA,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),HA=ue?e.Buffer:t,KA=e.Symbol,VA=e.Uint8Array,WA=HA?HA.allocUnsafe:t,jA=st(DA.getPrototypeOf,DA),OA=DA.create,ZA=kA.propertyIsEnumerable,qA=bA.splice,XA=KA?KA.isConcatSpreadable:t,zA=KA?KA.iterator:t,ee=KA?KA.toStringTag:t,ie=function(){try{var A=Ia(DA,"defineProperty");return A({},"",{}),A}catch(A){}}(),ge=e.clearTimeout!==de.clearTimeout&&e.clearTimeout,Ie=mA&&mA.now!==de.Date.now&&mA.now,Ce=e.setTimeout!==de.setTimeout&&e.setTimeout,he=SA.ceil,Be=SA.floor,Ee=DA.getOwnPropertySymbols,fe=HA?HA.isBuffer:t,Ye=e.isFinite,je=bA.join,ut=st(DA.keys,DA),Et=SA.max,ft=SA.min,Qt=mA.now,xt=e.parseInt,pt=SA.random,mt=bA.reverse,yt=Ia(e,"DataView"),_t=Ia(e,"Map"),St=Ia(e,"Promise"),Dt=Ia(e,"Set"),wt=Ia(e,"WeakMap"),vt=Ia(DA,"create"),Ft=wt&&new wt,bt={},Rt=La(yt),kt=La(_t),Pt=La(St),Nt=La(Dt),Mt=La(wt),Tt=KA?KA.prototype:t,Lt=Tt?Tt.valueOf:t,Yt=Tt?Tt.toString:t;function Gt(A){if(eo(A)&&!Kr(A)&&!(A instanceof Kt)){if(A instanceof Ht)return A;if(MA.call(A,"__wrapped__"))return Ya(A)}return new Ht(A)}var Ut=function(){function A(){}return function(e){if(!Ao(e))return{};if(OA)return OA(e);A.prototype=e;var i=new A;return A.prototype=t,i}}();function Jt(){}function Ht(A,e){this.__wrapped__=A,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=t}function Kt(A){this.__wrapped__=A,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Vt(A){var e=-1,t=null==A?0:A.length;for(this.clear();++e=e?A:e)),A}function si(A,e,i,n,a,r){var o,s=1&e,g=2&e,c=4&e;if(i&&(o=a?i(A,n,a,r):i(A)),o!==t)return o;if(!Ao(A))return A;var l=Kr(A);if(l){if(o=function(A){var e=A.length,t=new A.constructor(e);e&&"string"==typeof A[0]&&MA.call(A,"index")&&(t.index=A.index,t.input=A.input);return t}(A),!s)return Fn(A,o)}else{var I=ha(A),C=I==x||I==p;if(Or(A))return yn(A,s);if(I==_||I==B||C&&!a){if(o=g||C?{}:ua(A),!s)return g?function(A,e){return bn(A,da(A),e)}(A,function(A,e){return A&&bn(e,ko(e),A)}(o,A)):function(A,e){return bn(A,Ca(A),e)}(A,ni(o,A))}else{if(!se[I])return a?A:{};o=function(A,e,t){var i=A.constructor;switch(e){case k:return _n(A);case E:case f:return new i(+A);case P:return function(A,e){var t=e?_n(A.buffer):A.buffer;return new A.constructor(t,A.byteOffset,A.byteLength)}(A,t);case N:case M:case T:case L:case Y:case G:case U:case J:case H:return Sn(A,t);case m:return new i;case y:case F:return new i(A);case w:return function(A){var e=new A.constructor(A.source,dA.exec(A));return e.lastIndex=A.lastIndex,e}(A);case v:return new i;case b:return n=A,Lt?DA(Lt.call(n)):{}}var n}(A,I,s)}}r||(r=new Zt);var d=r.get(A);if(d)return d;r.set(A,o),ro(A)?A.forEach((function(t){o.add(si(t,e,i,t,A,r))})):to(A)&&A.forEach((function(t,n){o.set(n,si(t,e,i,n,A,r))}));var h=l?t:(c?g?aa:na:g?ko:Ro)(A);return we(h||A,(function(t,n){h&&(t=A[n=t]),ei(o,n,si(t,e,i,n,A,r))})),o}function gi(A,e,i){var n=i.length;if(null==A)return!n;for(A=DA(A);n--;){var a=i[n],r=e[a],o=A[a];if(o===t&&!(a in A)||!r(o))return!1}return!0}function ci(A,e,n){if("function"!=typeof A)throw new FA(i);return ba((function(){A.apply(t,n)}),e)}function li(A,e,t,i){var n=-1,a=Re,r=!0,o=A.length,s=[],g=e.length;if(!o)return s;t&&(e=Pe(e,ze(t))),i?(a=ke,r=!1):e.length>=200&&(a=At,r=!1,e=new Ot(e));A:for(;++n-1},Wt.prototype.set=function(A,e){var t=this.__data__,i=ti(t,A);return i<0?(++this.size,t.push([A,e])):t[i][1]=e,this},jt.prototype.clear=function(){this.size=0,this.__data__={hash:new Vt,map:new(_t||Wt),string:new Vt}},jt.prototype.delete=function(A){var e=ca(this,A).delete(A);return this.size-=e?1:0,e},jt.prototype.get=function(A){return ca(this,A).get(A)},jt.prototype.has=function(A){return ca(this,A).has(A)},jt.prototype.set=function(A,e){var t=ca(this,A),i=t.size;return t.set(A,e),this.size+=t.size==i?0:1,this},Ot.prototype.add=Ot.prototype.push=function(A){return this.__data__.set(A,n),this},Ot.prototype.has=function(A){return this.__data__.has(A)},Zt.prototype.clear=function(){this.__data__=new Wt,this.size=0},Zt.prototype.delete=function(A){var e=this.__data__,t=e.delete(A);return this.size=e.size,t},Zt.prototype.get=function(A){return this.__data__.get(A)},Zt.prototype.has=function(A){return this.__data__.has(A)},Zt.prototype.set=function(A,e){var t=this.__data__;if(t instanceof Wt){var i=t.__data__;if(!_t||i.length<199)return i.push([A,e]),this.size=++t.size,this;t=this.__data__=new jt(i)}return t.set(A,e),this.size=t.size,this};var Ii=Pn(Qi),Ci=Pn(xi,!0);function di(A,e){var t=!0;return Ii(A,(function(A,i,n){return t=!!e(A,i,n)})),t}function hi(A,e,i){for(var n=-1,a=A.length;++n0&&t(o)?e>1?ui(o,e-1,t,i,n):Ne(n,o):i||(n[n.length]=o)}return n}var Ei=Nn(),fi=Nn(!0);function Qi(A,e){return A&&Ei(A,e,Ro)}function xi(A,e){return A&&fi(A,e,Ro)}function pi(A,e){return be(e,(function(e){return Xr(A[e])}))}function mi(A,e){for(var i=0,n=(e=Qn(e,A)).length;null!=A&&ie}function Di(A,e){return null!=A&&MA.call(A,e)}function wi(A,e){return null!=A&&e in DA(A)}function vi(A,e,i){for(var n=i?ke:Re,a=A[0].length,r=A.length,o=r,s=rA(r),g=1/0,c=[];o--;){var l=A[o];o&&e&&(l=Pe(l,ze(e))),g=ft(l.length,g),s[o]=!i&&(e||a>=120&&l.length>=120)?new Ot(o&&l):t}l=A[0];var I=-1,C=s[0];A:for(;++I=o?s:s*("desc"==t[i]?-1:1)}return A.index-e.index}(A,e,t)}))}function Vi(A,e,t){for(var i=-1,n=e.length,a={};++i-1;)o!==A&&qA.call(o,s,1),qA.call(A,s,1);return A}function ji(A,e){for(var t=A?e.length:0,i=t-1;t--;){var n=e[t];if(t==i||n!==a){var a=n;fa(n)?qA.call(A,n,1):In(A,n)}}return A}function Oi(A,e){return A+Be(pt()*(e-A+1))}function Zi(A,e){var t="";if(!A||e<1||e>I)return t;do{e%2&&(t+=A),(e=Be(e/2))&&(A+=A)}while(e);return t}function qi(A,e){return Ra(Da(A,e,ns),A+"")}function Xi(A){return Xt(Uo(A))}function zi(A,e){var t=Uo(A);return Na(t,oi(e,0,t.length))}function $i(A,e,i,n){if(!Ao(A))return A;for(var a=-1,r=(e=Qn(e,A)).length,o=r-1,s=A;null!=s&&++an?0:n+e),(t=t>n?n:t)<0&&(t+=n),n=e>t?0:t-e>>>0,e>>>=0;for(var a=rA(n);++i>>1,r=A[a];null!==r&&!so(r)&&(t?r<=e:r=200){var g=e?null:qn(A);if(g)return ct(g);r=!1,n=At,s=new Ot}else s=e?[]:o;A:for(;++i=n?A:nn(A,e,i)}var mn=ge||function(A){return de.clearTimeout(A)};function yn(A,e){if(e)return A.slice();var t=A.length,i=WA?WA(t):new A.constructor(t);return A.copy(i),i}function _n(A){var e=new A.constructor(A.byteLength);return new VA(e).set(new VA(A)),e}function Sn(A,e){var t=e?_n(A.buffer):A.buffer;return new A.constructor(t,A.byteOffset,A.length)}function Dn(A,e){if(A!==e){var i=A!==t,n=null===A,a=A==A,r=so(A),o=e!==t,s=null===e,g=e==e,c=so(e);if(!s&&!c&&!r&&A>e||r&&o&&g&&!s&&!c||n&&o&&g||!i&&g||!a)return 1;if(!n&&!r&&!c&&A1?i[a-1]:t,o=a>2?i[2]:t;for(r=A.length>3&&"function"==typeof r?(a--,r):t,o&&Qa(i[0],i[1],o)&&(r=a<3?t:r,a=1),e=DA(e);++n-1?a[r?e[o]:o]:t}}function Gn(A){return ia((function(e){var n=e.length,a=n,r=Ht.prototype.thru;for(A&&e.reverse();a--;){var o=e[a];if("function"!=typeof o)throw new FA(i);if(r&&!s&&"wrapper"==oa(o))var s=new Ht([],!0)}for(a=s?a:n;++a1&&f.reverse(),I&&cs))return!1;var c=r.get(A),l=r.get(e);if(c&&l)return c==e&&l==A;var I=-1,C=!0,d=2&i?new Ot:t;for(r.set(A,e),r.set(e,A);++I-1&&A%1==0&&A1?"& ":"")+e[i],e=e.join(t>2?", ":" "),A.replace(oA,"{\n/* [wrapped with "+e+"] */\n")}(i,function(A,e){return we(h,(function(t){var i="_."+t[0];e&t[1]&&!Re(A,i)&&A.push(i)})),A.sort()}(function(A){var e=A.match(sA);return e?e[1].split(gA):[]}(i),t)))}function Pa(A){var e=0,i=0;return function(){var n=Qt(),a=16-(n-i);if(i=n,a>0){if(++e>=800)return arguments[0]}else e=0;return A.apply(t,arguments)}}function Na(A,e){var i=-1,n=A.length,a=n-1;for(e=e===t?n:e;++i1?A[e-1]:t;return i="function"==typeof i?(A.pop(),i):t,ar(A,i)}));function Ir(A){var e=Gt(A);return e.__chain__=!0,e}function Cr(A,e){return e(A)}var dr=ia((function(A){var e=A.length,i=e?A[0]:0,n=this.__wrapped__,a=function(e){return ri(e,A)};return!(e>1||this.__actions__.length)&&n instanceof Kt&&fa(i)?((n=n.slice(i,+i+(e?1:0))).__actions__.push({func:Cr,args:[a],thisArg:t}),new Ht(n,this.__chain__).thru((function(A){return e&&!A.length&&A.push(t),A}))):this.thru(a)}));var hr=Rn((function(A,e,t){MA.call(A,t)?++A[t]:ai(A,t,1)}));var Br=Yn(Ha),ur=Yn(Ka);function Er(A,e){return(Kr(A)?we:Ii)(A,ga(e,3))}function fr(A,e){return(Kr(A)?ve:Ci)(A,ga(e,3))}var Qr=Rn((function(A,e,t){MA.call(A,t)?A[t].push(e):ai(A,t,[e])}));var xr=qi((function(A,e,t){var i=-1,n="function"==typeof e,a=Wr(A)?rA(A.length):[];return Ii(A,(function(A){a[++i]=n?Se(e,A,t):Fi(A,e,t)})),a})),pr=Rn((function(A,e,t){ai(A,t,e)}));function mr(A,e){return(Kr(A)?Pe:Yi)(A,ga(e,3))}var yr=Rn((function(A,e,t){A[t?0:1].push(e)}),(function(){return[[],[]]}));var _r=qi((function(A,e){if(null==A)return[];var t=e.length;return t>1&&Qa(A,e[0],e[1])?e=[]:t>2&&Qa(e[0],e[1],e[2])&&(e=[e[0]]),Ki(A,ui(e,1),[])})),Sr=Ie||function(){return de.Date.now()};function Dr(A,e,i){return e=i?t:e,e=A&&null==e?A.length:e,zn(A,g,t,t,t,t,e)}function wr(A,e){var n;if("function"!=typeof e)throw new FA(i);return A=ho(A),function(){return--A>0&&(n=e.apply(this,arguments)),A<=1&&(e=t),n}}var vr=qi((function(A,e,t){var i=1;if(t.length){var n=gt(t,sa(vr));i|=o}return zn(A,i,e,t,n)})),Fr=qi((function(A,e,t){var i=3;if(t.length){var n=gt(t,sa(Fr));i|=o}return zn(e,i,A,t,n)}));function br(A,e,n){var a,r,o,s,g,c,l=0,I=!1,C=!1,d=!0;if("function"!=typeof A)throw new FA(i);function h(e){var i=a,n=r;return a=r=t,l=e,s=A.apply(n,i)}function B(A){var i=A-c;return c===t||i>=e||i<0||C&&A-l>=o}function u(){var A=Sr();if(B(A))return E(A);g=ba(u,function(A){var t=e-(A-c);return C?ft(t,o-(A-l)):t}(A))}function E(A){return g=t,d&&a?h(A):(a=r=t,s)}function f(){var A=Sr(),i=B(A);if(a=arguments,r=this,c=A,i){if(g===t)return function(A){return l=A,g=ba(u,e),I?h(A):s}(c);if(C)return mn(g),g=ba(u,e),h(c)}return g===t&&(g=ba(u,e)),s}return e=uo(e)||0,Ao(n)&&(I=!!n.leading,o=(C="maxWait"in n)?Et(uo(n.maxWait)||0,e):o,d="trailing"in n?!!n.trailing:d),f.cancel=function(){g!==t&&mn(g),l=0,a=c=r=g=t},f.flush=function(){return g===t?s:E(Sr())},f}var Rr=qi((function(A,e){return ci(A,1,e)})),kr=qi((function(A,e,t){return ci(A,uo(e)||0,t)}));function Pr(A,e){if("function"!=typeof A||null!=e&&"function"!=typeof e)throw new FA(i);var t=function(){var i=arguments,n=e?e.apply(this,i):i[0],a=t.cache;if(a.has(n))return a.get(n);var r=A.apply(this,i);return t.cache=a.set(n,r)||a,r};return t.cache=new(Pr.Cache||jt),t}function Nr(A){if("function"!=typeof A)throw new FA(i);return function(){var e=arguments;switch(e.length){case 0:return!A.call(this);case 1:return!A.call(this,e[0]);case 2:return!A.call(this,e[0],e[1]);case 3:return!A.call(this,e[0],e[1],e[2])}return!A.apply(this,e)}}Pr.Cache=jt;var Mr=xn((function(A,e){var t=(e=1==e.length&&Kr(e[0])?Pe(e[0],ze(ga())):Pe(ui(e,1),ze(ga()))).length;return qi((function(i){for(var n=-1,a=ft(i.length,t);++n=e})),Hr=bi(function(){return arguments}())?bi:function(A){return eo(A)&&MA.call(A,"callee")&&!ZA.call(A,"callee")},Kr=rA.isArray,Vr=Qe?ze(Qe):function(A){return eo(A)&&_i(A)==k};function Wr(A){return null!=A&&$r(A.length)&&!Xr(A)}function jr(A){return eo(A)&&Wr(A)}var Or=fe||us,Zr=xe?ze(xe):function(A){return eo(A)&&_i(A)==f};function qr(A){if(!eo(A))return!1;var e=_i(A);return e==Q||"[object DOMException]"==e||"string"==typeof A.message&&"string"==typeof A.name&&!no(A)}function Xr(A){if(!Ao(A))return!1;var e=_i(A);return e==x||e==p||"[object AsyncFunction]"==e||"[object Proxy]"==e}function zr(A){return"number"==typeof A&&A==ho(A)}function $r(A){return"number"==typeof A&&A>-1&&A%1==0&&A<=I}function Ao(A){var e=typeof A;return null!=A&&("object"==e||"function"==e)}function eo(A){return null!=A&&"object"==typeof A}var to=pe?ze(pe):function(A){return eo(A)&&ha(A)==m};function io(A){return"number"==typeof A||eo(A)&&_i(A)==y}function no(A){if(!eo(A)||_i(A)!=_)return!1;var e=jA(A);if(null===e)return!0;var t=MA.call(e,"constructor")&&e.constructor;return"function"==typeof t&&t instanceof t&&NA.call(t)==GA}var ao=me?ze(me):function(A){return eo(A)&&_i(A)==w};var ro=ye?ze(ye):function(A){return eo(A)&&ha(A)==v};function oo(A){return"string"==typeof A||!Kr(A)&&eo(A)&&_i(A)==F}function so(A){return"symbol"==typeof A||eo(A)&&_i(A)==b}var go=_e?ze(_e):function(A){return eo(A)&&$r(A.length)&&!!oe[_i(A)]};var co=jn(Li),lo=jn((function(A,e){return A<=e}));function Io(A){if(!A)return[];if(Wr(A))return oo(A)?Ct(A):Fn(A);if(zA&&A[zA])return function(A){for(var e,t=[];!(e=A.next()).done;)t.push(e.value);return t}(A[zA]());var e=ha(A);return(e==m?ot:e==v?ct:Uo)(A)}function Co(A){return A?(A=uo(A))===l||A===-1/0?17976931348623157e292*(A<0?-1:1):A==A?A:0:0===A?A:0}function ho(A){var e=Co(A),t=e%1;return e==e?t?e-t:e:0}function Bo(A){return A?oi(ho(A),0,d):0}function uo(A){if("number"==typeof A)return A;if(so(A))return C;if(Ao(A)){var e="function"==typeof A.valueOf?A.valueOf():A;A=Ao(e)?e+"":e}if("string"!=typeof A)return 0===A?A:+A;A=Xe(A);var t=BA.test(A);return t||EA.test(A)?le(A.slice(2),t?2:8):hA.test(A)?C:+A}function Eo(A){return bn(A,ko(A))}function fo(A){return null==A?"":cn(A)}var Qo=kn((function(A,e){if(ya(e)||Wr(e))bn(e,Ro(e),A);else for(var t in e)MA.call(e,t)&&ei(A,t,e[t])})),xo=kn((function(A,e){bn(e,ko(e),A)})),po=kn((function(A,e,t,i){bn(e,ko(e),A,i)})),mo=kn((function(A,e,t,i){bn(e,Ro(e),A,i)})),yo=ia(ri);var _o=qi((function(A,e){A=DA(A);var i=-1,n=e.length,a=n>2?e[2]:t;for(a&&Qa(e[0],e[1],a)&&(n=1);++i1),e})),bn(A,aa(A),t),i&&(t=si(t,7,ea));for(var n=e.length;n--;)In(t,e[n]);return t}));var To=ia((function(A,e){return null==A?{}:function(A,e){return Vi(A,e,(function(e,t){return wo(A,t)}))}(A,e)}));function Lo(A,e){if(null==A)return{};var t=Pe(aa(A),(function(A){return[A]}));return e=ga(e),Vi(A,t,(function(A,t){return e(A,t[0])}))}var Yo=Xn(Ro),Go=Xn(ko);function Uo(A){return null==A?[]:$e(A,Ro(A))}var Jo=Tn((function(A,e,t){return e=e.toLowerCase(),A+(t?Ho(e):e)}));function Ho(A){return Xo(fo(A).toLowerCase())}function Ko(A){return(A=fo(A))&&A.replace(QA,it).replace(Ae,"")}var Vo=Tn((function(A,e,t){return A+(t?"-":"")+e.toLowerCase()})),Wo=Tn((function(A,e,t){return A+(t?" ":"")+e.toLowerCase()})),jo=Mn("toLowerCase");var Oo=Tn((function(A,e,t){return A+(t?"_":"")+e.toLowerCase()}));var Zo=Tn((function(A,e,t){return A+(t?" ":"")+Xo(e)}));var qo=Tn((function(A,e,t){return A+(t?" ":"")+e.toUpperCase()})),Xo=Mn("toUpperCase");function zo(A,e,i){return A=fo(A),(e=i?t:e)===t?function(A){return ne.test(A)}(A)?function(A){return A.match(te)||[]}(A):function(A){return A.match(cA)||[]}(A):A.match(e)||[]}var $o=qi((function(A,e){try{return Se(A,t,e)}catch(A){return qr(A)?A:new yA(A)}})),As=ia((function(A,e){return we(e,(function(e){e=Ta(e),ai(A,e,vr(A[e],A))})),A}));function es(A){return function(){return A}}var ts=Gn(),is=Gn(!0);function ns(A){return A}function as(A){return Ni("function"==typeof A?A:si(A,1))}var rs=qi((function(A,e){return function(t){return Fi(t,A,e)}})),os=qi((function(A,e){return function(t){return Fi(A,t,e)}}));function ss(A,e,t){var i=Ro(e),n=pi(e,i);null!=t||Ao(e)&&(n.length||!i.length)||(t=e,e=A,A=this,n=pi(e,Ro(e)));var a=!(Ao(t)&&"chain"in t&&!t.chain),r=Xr(A);return we(n,(function(t){var i=e[t];A[t]=i,r&&(A.prototype[t]=function(){var e=this.__chain__;if(a||e){var t=A(this.__wrapped__);return(t.__actions__=Fn(this.__actions__)).push({func:i,args:arguments,thisArg:A}),t.__chain__=e,t}return i.apply(A,Ne([this.value()],arguments))})})),A}function gs(){}var cs=Kn(Pe),ls=Kn(Fe),Is=Kn(Le);function Cs(A){return xa(A)?We(Ta(A)):function(A){return function(e){return mi(e,A)}}(A)}var ds=Wn(),hs=Wn(!0);function Bs(){return[]}function us(){return!1}var Es=Hn((function(A,e){return A+e}),0),fs=Zn("ceil"),Qs=Hn((function(A,e){return A/e}),1),xs=Zn("floor");var ps,ms=Hn((function(A,e){return A*e}),1),ys=Zn("round"),_s=Hn((function(A,e){return A-e}),0);return Gt.after=function(A,e){if("function"!=typeof e)throw new FA(i);return A=ho(A),function(){if(--A<1)return e.apply(this,arguments)}},Gt.ary=Dr,Gt.assign=Qo,Gt.assignIn=xo,Gt.assignInWith=po,Gt.assignWith=mo,Gt.at=yo,Gt.before=wr,Gt.bind=vr,Gt.bindAll=As,Gt.bindKey=Fr,Gt.castArray=function(){if(!arguments.length)return[];var A=arguments[0];return Kr(A)?A:[A]},Gt.chain=Ir,Gt.chunk=function(A,e,i){e=(i?Qa(A,e,i):e===t)?1:Et(ho(e),0);var n=null==A?0:A.length;if(!n||e<1)return[];for(var a=0,r=0,o=rA(he(n/e));aa?0:a+i),(n=n===t||n>a?a:ho(n))<0&&(n+=a),n=i>n?0:Bo(n);i>>0)?(A=fo(A))&&("string"==typeof e||null!=e&&!ao(e))&&!(e=cn(e))&&rt(A)?pn(Ct(A),0,i):A.split(e,i):[]},Gt.spread=function(A,e){if("function"!=typeof A)throw new FA(i);return e=null==e?0:Et(ho(e),0),qi((function(t){var i=t[e],n=pn(t,0,e);return i&&Ne(n,i),Se(A,this,n)}))},Gt.tail=function(A){var e=null==A?0:A.length;return e?nn(A,1,e):[]},Gt.take=function(A,e,i){return A&&A.length?nn(A,0,(e=i||e===t?1:ho(e))<0?0:e):[]},Gt.takeRight=function(A,e,i){var n=null==A?0:A.length;return n?nn(A,(e=n-(e=i||e===t?1:ho(e)))<0?0:e,n):[]},Gt.takeRightWhile=function(A,e){return A&&A.length?dn(A,ga(e,3),!1,!0):[]},Gt.takeWhile=function(A,e){return A&&A.length?dn(A,ga(e,3)):[]},Gt.tap=function(A,e){return e(A),A},Gt.throttle=function(A,e,t){var n=!0,a=!0;if("function"!=typeof A)throw new FA(i);return Ao(t)&&(n="leading"in t?!!t.leading:n,a="trailing"in t?!!t.trailing:a),br(A,e,{leading:n,maxWait:e,trailing:a})},Gt.thru=Cr,Gt.toArray=Io,Gt.toPairs=Yo,Gt.toPairsIn=Go,Gt.toPath=function(A){return Kr(A)?Pe(A,Ta):so(A)?[A]:Fn(Ma(fo(A)))},Gt.toPlainObject=Eo,Gt.transform=function(A,e,t){var i=Kr(A),n=i||Or(A)||go(A);if(e=ga(e,4),null==t){var a=A&&A.constructor;t=n?i?new a:[]:Ao(A)&&Xr(a)?Ut(jA(A)):{}}return(n?we:Qi)(A,(function(A,i,n){return e(t,A,i,n)})),t},Gt.unary=function(A){return Dr(A,1)},Gt.union=er,Gt.unionBy=tr,Gt.unionWith=ir,Gt.uniq=function(A){return A&&A.length?ln(A):[]},Gt.uniqBy=function(A,e){return A&&A.length?ln(A,ga(e,2)):[]},Gt.uniqWith=function(A,e){return e="function"==typeof e?e:t,A&&A.length?ln(A,t,e):[]},Gt.unset=function(A,e){return null==A||In(A,e)},Gt.unzip=nr,Gt.unzipWith=ar,Gt.update=function(A,e,t){return null==A?A:Cn(A,e,fn(t))},Gt.updateWith=function(A,e,i,n){return n="function"==typeof n?n:t,null==A?A:Cn(A,e,fn(i),n)},Gt.values=Uo,Gt.valuesIn=function(A){return null==A?[]:$e(A,ko(A))},Gt.without=rr,Gt.words=zo,Gt.wrap=function(A,e){return Tr(fn(e),A)},Gt.xor=or,Gt.xorBy=sr,Gt.xorWith=gr,Gt.zip=cr,Gt.zipObject=function(A,e){return un(A||[],e||[],ei)},Gt.zipObjectDeep=function(A,e){return un(A||[],e||[],$i)},Gt.zipWith=lr,Gt.entries=Yo,Gt.entriesIn=Go,Gt.extend=xo,Gt.extendWith=po,ss(Gt,Gt),Gt.add=Es,Gt.attempt=$o,Gt.camelCase=Jo,Gt.capitalize=Ho,Gt.ceil=fs,Gt.clamp=function(A,e,i){return i===t&&(i=e,e=t),i!==t&&(i=(i=uo(i))==i?i:0),e!==t&&(e=(e=uo(e))==e?e:0),oi(uo(A),e,i)},Gt.clone=function(A){return si(A,4)},Gt.cloneDeep=function(A){return si(A,5)},Gt.cloneDeepWith=function(A,e){return si(A,5,e="function"==typeof e?e:t)},Gt.cloneWith=function(A,e){return si(A,4,e="function"==typeof e?e:t)},Gt.conformsTo=function(A,e){return null==e||gi(A,e,Ro(e))},Gt.deburr=Ko,Gt.defaultTo=function(A,e){return null==A||A!=A?e:A},Gt.divide=Qs,Gt.endsWith=function(A,e,i){A=fo(A),e=cn(e);var n=A.length,a=i=i===t?n:oi(ho(i),0,n);return(i-=e.length)>=0&&A.slice(i,a)==e},Gt.eq=Gr,Gt.escape=function(A){return(A=fo(A))&&q.test(A)?A.replace(O,nt):A},Gt.escapeRegExp=function(A){return(A=fo(A))&&nA.test(A)?A.replace(iA,"\\$&"):A},Gt.every=function(A,e,i){var n=Kr(A)?Fe:di;return i&&Qa(A,e,i)&&(e=t),n(A,ga(e,3))},Gt.find=Br,Gt.findIndex=Ha,Gt.findKey=function(A,e){return Ge(A,ga(e,3),Qi)},Gt.findLast=ur,Gt.findLastIndex=Ka,Gt.findLastKey=function(A,e){return Ge(A,ga(e,3),xi)},Gt.floor=xs,Gt.forEach=Er,Gt.forEachRight=fr,Gt.forIn=function(A,e){return null==A?A:Ei(A,ga(e,3),ko)},Gt.forInRight=function(A,e){return null==A?A:fi(A,ga(e,3),ko)},Gt.forOwn=function(A,e){return A&&Qi(A,ga(e,3))},Gt.forOwnRight=function(A,e){return A&&xi(A,ga(e,3))},Gt.get=Do,Gt.gt=Ur,Gt.gte=Jr,Gt.has=function(A,e){return null!=A&&Ba(A,e,Di)},Gt.hasIn=wo,Gt.head=Wa,Gt.identity=ns,Gt.includes=function(A,e,t,i){A=Wr(A)?A:Uo(A),t=t&&!i?ho(t):0;var n=A.length;return t<0&&(t=Et(n+t,0)),oo(A)?t<=n&&A.indexOf(e,t)>-1:!!n&&Je(A,e,t)>-1},Gt.indexOf=function(A,e,t){var i=null==A?0:A.length;if(!i)return-1;var n=null==t?0:ho(t);return n<0&&(n=Et(i+n,0)),Je(A,e,n)},Gt.inRange=function(A,e,i){return e=Co(e),i===t?(i=e,e=0):i=Co(i),function(A,e,t){return A>=ft(e,t)&&A=-9007199254740991&&A<=I},Gt.isSet=ro,Gt.isString=oo,Gt.isSymbol=so,Gt.isTypedArray=go,Gt.isUndefined=function(A){return A===t},Gt.isWeakMap=function(A){return eo(A)&&ha(A)==R},Gt.isWeakSet=function(A){return eo(A)&&"[object WeakSet]"==_i(A)},Gt.join=function(A,e){return null==A?"":je.call(A,e)},Gt.kebabCase=Vo,Gt.last=qa,Gt.lastIndexOf=function(A,e,i){var n=null==A?0:A.length;if(!n)return-1;var a=n;return i!==t&&(a=(a=ho(i))<0?Et(n+a,0):ft(a,n-1)),e==e?function(A,e,t){for(var i=t+1;i--;)if(A[i]===e)return i;return i}(A,e,a):Ue(A,Ke,a,!0)},Gt.lowerCase=Wo,Gt.lowerFirst=jo,Gt.lt=co,Gt.lte=lo,Gt.max=function(A){return A&&A.length?hi(A,ns,Si):t},Gt.maxBy=function(A,e){return A&&A.length?hi(A,ga(e,2),Si):t},Gt.mean=function(A){return Ve(A,ns)},Gt.meanBy=function(A,e){return Ve(A,ga(e,2))},Gt.min=function(A){return A&&A.length?hi(A,ns,Li):t},Gt.minBy=function(A,e){return A&&A.length?hi(A,ga(e,2),Li):t},Gt.stubArray=Bs,Gt.stubFalse=us,Gt.stubObject=function(){return{}},Gt.stubString=function(){return""},Gt.stubTrue=function(){return!0},Gt.multiply=ms,Gt.nth=function(A,e){return A&&A.length?Hi(A,ho(e)):t},Gt.noConflict=function(){return de._===this&&(de._=UA),this},Gt.noop=gs,Gt.now=Sr,Gt.pad=function(A,e,t){A=fo(A);var i=(e=ho(e))?It(A):0;if(!e||i>=e)return A;var n=(e-i)/2;return Vn(Be(n),t)+A+Vn(he(n),t)},Gt.padEnd=function(A,e,t){A=fo(A);var i=(e=ho(e))?It(A):0;return e&&ie){var n=A;A=e,e=n}if(i||A%1||e%1){var a=pt();return ft(A+a*(e-A+ce("1e-"+((a+"").length-1))),e)}return Oi(A,e)},Gt.reduce=function(A,e,t){var i=Kr(A)?Me:Oe,n=arguments.length<3;return i(A,ga(e,4),t,n,Ii)},Gt.reduceRight=function(A,e,t){var i=Kr(A)?Te:Oe,n=arguments.length<3;return i(A,ga(e,4),t,n,Ci)},Gt.repeat=function(A,e,i){return e=(i?Qa(A,e,i):e===t)?1:ho(e),Zi(fo(A),e)},Gt.replace=function(){var A=arguments,e=fo(A[0]);return A.length<3?e:e.replace(A[1],A[2])},Gt.result=function(A,e,i){var n=-1,a=(e=Qn(e,A)).length;for(a||(a=1,A=t);++nI)return[];var t=d,i=ft(A,d);e=ga(e),A-=d;for(var n=qe(i,e);++t=r)return A;var s=i-It(n);if(s<1)return n;var g=o?pn(o,0,s).join(""):A.slice(0,s);if(a===t)return g+n;if(o&&(s+=g.length-s),ao(a)){if(A.slice(s).search(a)){var c,l=g;for(a.global||(a=wA(a.source,fo(dA.exec(a))+"g")),a.lastIndex=0;c=a.exec(l);)var I=c.index;g=g.slice(0,I===t?s:I)}}else if(A.indexOf(cn(a),s)!=s){var C=g.lastIndexOf(a);C>-1&&(g=g.slice(0,C))}return g+n},Gt.unescape=function(A){return(A=fo(A))&&Z.test(A)?A.replace(j,ht):A},Gt.uniqueId=function(A){var e=++TA;return fo(A)+e},Gt.upperCase=qo,Gt.upperFirst=Xo,Gt.each=Er,Gt.eachRight=fr,Gt.first=Wa,ss(Gt,(ps={},Qi(Gt,(function(A,e){MA.call(Gt.prototype,e)||(ps[e]=A)})),ps),{chain:!1}),Gt.VERSION="4.17.21",we(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(A){Gt[A].placeholder=Gt})),we(["drop","take"],(function(A,e){Kt.prototype[A]=function(i){i=i===t?1:Et(ho(i),0);var n=this.__filtered__&&!e?new Kt(this):this.clone();return n.__filtered__?n.__takeCount__=ft(i,n.__takeCount__):n.__views__.push({size:ft(i,d),type:A+(n.__dir__<0?"Right":"")}),n},Kt.prototype[A+"Right"]=function(e){return this.reverse()[A](e).reverse()}})),we(["filter","map","takeWhile"],(function(A,e){var t=e+1,i=1==t||3==t;Kt.prototype[A]=function(A){var e=this.clone();return e.__iteratees__.push({iteratee:ga(A,3),type:t}),e.__filtered__=e.__filtered__||i,e}})),we(["head","last"],(function(A,e){var t="take"+(e?"Right":"");Kt.prototype[A]=function(){return this[t](1).value()[0]}})),we(["initial","tail"],(function(A,e){var t="drop"+(e?"":"Right");Kt.prototype[A]=function(){return this.__filtered__?new Kt(this):this[t](1)}})),Kt.prototype.compact=function(){return this.filter(ns)},Kt.prototype.find=function(A){return this.filter(A).head()},Kt.prototype.findLast=function(A){return this.reverse().find(A)},Kt.prototype.invokeMap=qi((function(A,e){return"function"==typeof A?new Kt(this):this.map((function(t){return Fi(t,A,e)}))})),Kt.prototype.reject=function(A){return this.filter(Nr(ga(A)))},Kt.prototype.slice=function(A,e){A=ho(A);var i=this;return i.__filtered__&&(A>0||e<0)?new Kt(i):(A<0?i=i.takeRight(-A):A&&(i=i.drop(A)),e!==t&&(i=(e=ho(e))<0?i.dropRight(-e):i.take(e-A)),i)},Kt.prototype.takeRightWhile=function(A){return this.reverse().takeWhile(A).reverse()},Kt.prototype.toArray=function(){return this.take(d)},Qi(Kt.prototype,(function(A,e){var i=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),a=Gt[n?"take"+("last"==e?"Right":""):e],r=n||/^find/.test(e);a&&(Gt.prototype[e]=function(){var e=this.__wrapped__,o=n?[1]:arguments,s=e instanceof Kt,g=o[0],c=s||Kr(e),l=function(A){var e=a.apply(Gt,Ne([A],o));return n&&I?e[0]:e};c&&i&&"function"==typeof g&&1!=g.length&&(s=c=!1);var I=this.__chain__,C=!!this.__actions__.length,d=r&&!I,h=s&&!C;if(!r&&c){e=h?e:new Kt(this);var B=A.apply(e,o);return B.__actions__.push({func:Cr,args:[l],thisArg:t}),new Ht(B,I)}return d&&h?A.apply(this,o):(B=this.thru(l),d?n?B.value()[0]:B.value():B)})})),we(["pop","push","shift","sort","splice","unshift"],(function(A){var e=bA[A],t=/^(?:push|sort|unshift)$/.test(A)?"tap":"thru",i=/^(?:pop|shift)$/.test(A);Gt.prototype[A]=function(){var A=arguments;if(i&&!this.__chain__){var n=this.value();return e.apply(Kr(n)?n:[],A)}return this[t]((function(t){return e.apply(Kr(t)?t:[],A)}))}})),Qi(Kt.prototype,(function(A,e){var t=Gt[e];if(t){var i=t.name+"";MA.call(bt,i)||(bt[i]=[]),bt[i].push({name:e,func:t})}})),bt[Un(t,2).name]=[{name:"wrapper",func:t}],Kt.prototype.clone=function(){var A=new Kt(this.__wrapped__);return A.__actions__=Fn(this.__actions__),A.__dir__=this.__dir__,A.__filtered__=this.__filtered__,A.__iteratees__=Fn(this.__iteratees__),A.__takeCount__=this.__takeCount__,A.__views__=Fn(this.__views__),A},Kt.prototype.reverse=function(){if(this.__filtered__){var A=new Kt(this);A.__dir__=-1,A.__filtered__=!0}else(A=this.clone()).__dir__*=-1;return A},Kt.prototype.value=function(){var A=this.__wrapped__.value(),e=this.__dir__,t=Kr(A),i=e<0,n=t?A.length:0,a=function(A,e,t){var i=-1,n=t.length;for(;++i=this.__values__.length;return{done:A,value:A?t:this.__values__[this.__index__++]}},Gt.prototype.plant=function(A){for(var e,i=this;i instanceof Jt;){var n=Ya(i);n.__index__=0,n.__values__=t,e?a.__wrapped__=n:e=n;var a=n;i=i.__wrapped__}return a.__wrapped__=A,e},Gt.prototype.reverse=function(){var A=this.__wrapped__;if(A instanceof Kt){var e=A;return this.__actions__.length&&(e=new Kt(this)),(e=e.reverse()).__actions__.push({func:Cr,args:[Ar],thisArg:t}),new Ht(e,this.__chain__)}return this.thru(Ar)},Gt.prototype.toJSON=Gt.prototype.valueOf=Gt.prototype.value=function(){return hn(this.__wrapped__,this.__actions__)},Gt.prototype.first=Gt.prototype.head,zA&&(Gt.prototype[zA]=function(){return this}),Gt}();Be?((Be.exports=Bt)._=Bt,he._=Bt):de._=Bt}).call(D)}(F,F.exports);var b=w(F.exports),R=function(){return o((function A(e,t){a(this,A),this.id=t,this.jSPlugin=e,this.state={play:!1,loading:!1,text:""},this.loadingSetText=this.loadingSetText}),[{key:"toString",value:function(){return"".concat(this.coreX,"-").concat(this.coreY)}},{key:"setPlayStatus",value:function(A){this.state=Object.assign(this.state,A)}},{key:"loadingStart",value:function(A){var e=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(e),e.innerHTML="@keyframes antRotate {to {transform: rotate(400deg);transform-origin:50% 50%;}} .loading {display: inline-block;z-index: 1000;-webkit-animation: antRotate 1s infinite linear;animation: antRotate 1s infinite linear;}";var t=A,i=document.getElementById(t),n=i.offsetWidth,a=i.offsetHeight,r=i.offsetLeft;this.jSPlugin.isInspect&&"map"==this.jSPlugin.Theme.inspectMode&&(r=0),document.getElementById("".concat(A,"-loading-id-0"))&&document.getElementById("".concat(A,"-loading-id-0")).parentNode.removeChild(document.getElementById("".concat(A,"-loading-id-0")));var o=document.createElement("div");o.setAttribute("id","".concat(A,"-loading-id-0"));var s="position:absolute;outline:none;pointer-events:none;";s+="width: 100%;background-size: cover; background-repeat:no-repeat;",s+="height: 100%;",s+="top:0;",s+="left:"+r+"px;",o.setAttribute("style",s),o.style.height=a,o.setAttribute("class","loading-container"),i.style.position="relative",this.jSPlugin.isInspect&&"map"==this.jSPlugin.Theme.inspectMode&&(i.style.position="absolute"),i.appendChild(o);var g=document.createElement("div"),c=document.createElement("div");g.setAttribute("class","loading-item"),g.setAttribute("id","".concat(A,"-loading-item-0"));s="display:inline-flex;pointer-events:none;flex-direction:column;justify-content:center;align-items: center;width:100%;height:"+a+"px;outline:none;vertical-align: top;position:absolute;";function l(A,e,t,i){return{top:parseInt(i/t,10)*(A/t),left:i%t*(e/t)}}s+="left:"+l(a,n,1,0).left+"px;",s+="top:"+l(a,n,1,0).top+"px;",g.setAttribute("style",s);var I=1,C=document.createElement("div");c.innerHTML="",c.style.color="#fff",C.setAttribute("class","loading"),C.setAttribute("id","loading-icon");var d='';!this.jSPlugin.isMobile&&this.jSPlugin.isCall&&(I=this.jSPlugin.width/1024,d='')),C.innerHTML=d,g.appendChild(C),g.appendChild(c),o.appendChild(g)}},{key:"loadingStop",value:function(A){var e=document.getElementById("".concat(A,"-loading-item-0"));e&&document.getElementById("loading-icon")&&e.removeChild(document.getElementById("loading-icon"))}},{key:"loadingSetText",value:function(A){var e=this;if(this.loadingClearText(),document.getElementById("".concat(this.id,"-loading-item-0"))){var t=document.getElementById("".concat(this.id,"-loading-item-0")),i=document.getElementById("".concat(this.id,"-loading-item-0")).childNodes[1];if(i||(t.style.height="100%",(i=document.createElement("div")).innerHTML=A.text,t.appendChild(i)),i.id="".concat(this.id,"-loading-item-txt"),i.innerHTML=A.text,i.style.fontSize="14px",!this.jSPlugin.isMobile&&this.jSPlugin.isCall){var n=this.jSPlugin.width/1024;i.style.fontSize="".concat(28*n,"px"),i.style.marginTop="16px"}if(this.jSPlugin.isCall&&1==A.type){var a=document.getElementById("".concat(this.id,"-loading-item-txt")),r=document.createElement("div");r.style="margin-bottom: 8px;width:24px;height:24px;",r.innerHTML='\n \n \n \n \n \n \n \n ',t.insertBefore(r,a)}if(i.style.color=A.color||"#FFFFFF",this.state.text=A.text,A.delayClear)var o=setTimeout((function(){e.loadingClearText(),clearTimeout(o)}),parseInt(A.delayClear))}}},{key:"loadingSetTextWithBtn",value:function(A){var e=this;this.loadingClear(),console.log(this.jSPlugin);var t=!!this.jSPlugin.Theme.call&&this.jSPlugin.Theme.call.themeData||null;(t&&(0===t.customConfig.bellPoster||"onCall"===this.jSPlugin.Theme.call.bellStatus)||A.mask)&&document.getElementById("".concat(this.id,"-loading-id-0"))&&(document.getElementById("".concat(this.id,"-loading-id-0")).style.background=A.maskStyle||"rgba(0,0,0,0.7)");var i=document.getElementById("".concat(this.id,"-loading-item-0"));if(i){i.style.height="100%",i.style["pointer-events"]="auto";var n=document.createElement("div");if(n.id="".concat(this.id,"-loading-item-txt"),n.innerHTML=A.text,n.title=A.text,n.style.color=A.color||"#FFFFFF",A.isMobile){var a=14*(this.jSPlugin.width/375);n.style.fontSize=a+"px"}else{var r=28*(this.jSPlugin.width/1024);n.style.fontSize=r+"px"}if(this.jSPlugin.isInspect&&(n.style="text-align: center; color: white; font-size: 14px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis; width: 70%;"),i.appendChild(n),A.type&&2==A.type){var o=8,s=24;if(A.isMobile){s=24*(this.jSPlugin.width/375)}else{var g=this.jSPlugin.width/1024;o=g<1?16*g:16,s=40*g}var c=document.getElementById("".concat(this.id,"-loading-item-txt"));(C=document.createElement("div")).style="margin-bottom: ".concat(o,"px;width:").concat(s,"px;height:").concat(s,"px;"),C.innerHTML='\n \n \n \n \n \n \n \n '),i.insertBefore(C,c)}else{var l=document.createElement("div");if(l.id="".concat(this.id,"-loading-item-btn-wrap"),l.innerHTML='\n
').concat(A.btnName,'
\n \n \n \n '),A.isMobile)1==A.type?l.style="color:white;width:100px;height:30px;border-radius: 10px;background: rgba(255,255,255,0.25);text-align:center;line-height:30px;margin-top:9px;font-size:14px;-webkit-tap-highlight-color: transparent;":l.style="border: 1px solid rgba(204,204,204,1);color:white;width:80px;height:24px;border-radius: 12px;background: rgba(255,255,255,0.1);text-align:center;line-height:24px;margin-top:20px;font-size:12px;-webkit-tap-highlight-color: transparent;";else{var I=this.jSPlugin.width/1024;l.style="color:#648FFC;margin-top:16px;cursor: pointer;font-size:".concat(24*I,"px;"),this.jSPlugin.isInspect&&"video"==this.jSPlugin.Theme.inspectMode&&(l.style="border: 1px solid rgba(255,255,255,1);color:white; cursor: pointer;text-align: center;width:80px;height:32px;border-radius:2px; text-align:center;line-height:32px;margin-top:16px;font-size:14px;-webkit-tap-highlight-color: transparent;")}if(i.appendChild(l),A.isMobile&&1==A.type){var C,d=document.getElementById("".concat(this.id,"-loading-item-txt"));(C=document.createElement("div")).style="margin-bottom: 8px;width:24px;height:24px;",C.innerHTML='\n \n \n \n \n \n \n \n ',i.insertBefore(C,d)}document.getElementById("".concat(this.id,"-loading-item-btn-wrap"))&&(document.getElementById("".concat(this.id,"-loading-item-btn-wrap")).onclick=function(){e.jSPlugin.play(),e.loadingClear(),e.loadingStart(e.id),e.loadingSetText({text:"视频加载中"})})}this.state.text=A.text,A.delayClear&&setTimeout((function(){e.loadingClearText()}),parseInt(A.delayClear))}}},{key:"loadingClearText",value:function(){if(document.getElementById("".concat(this.id,"-loading-item-0"))){var A=document.getElementById("".concat(this.id,"-loading-item-0")).childNodes;A.length>1?A[1].parentNode.removeChild(A[1]):A[0]&&A[0].parentNode.removeChild(A[0])}}},{key:"loadingClear",value:function(){if(document.getElementById("".concat(this.id,"-loading-item-0"))){for(var A=document.getElementById("".concat(this.id,"-loading-item-0")).childNodes,e=A.length-1;e>=0;e--)A[e].parentNode.removeChild(A[e]);document.getElementById("".concat(this.id,"-loading-id-0"))&&(document.getElementById("".concat(this.id,"-loading-id-0")).style.background="none"),document.getElementById("loading-icon")&&document.getElementById("loading-icon").parentNode.removeChild(document.getElementById("loading-icon"))}}},{key:"loadingEnd",value:function(){var A=document.getElementById("".concat(this.id,"-loading-item-0"));if(A){A.parentNode.removeChild(A);var e=document.getElementById("".concat(this.id,"-loading-id-0"));e&&0===e.children.length&&e.parentNode.removeChild(e)}document.getElementById("".concat(this.id,"-loading-item-0")).style.background="none"}}])}(),k=function(){return o((function A(e,t){a(this,A),this.id=t,this.jSPlugin=e,this.timer=null,this.state={play:!1,loading:!1}}),[{key:"default",value:function(A,e){var t=this,i="msgId",n=e||document.getElementById("".concat(this.id,"-wrap"));document.getElementById("".concat(this.id,"-").concat(i))&&n.removeChild(document.getElementById("".concat(this.id,"-").concat(i)));var a=document.createElement("div");a.id="".concat(this.id,"-").concat(i),a.style="position: absolute;top: 50%;left:calc(50% - ".concat(14*A.length/2,"px);padding: 4px 16px;background: #00000080;color: #FFFFFF;font-size: 14px"),a.innerHTML=A,n.appendChild(a),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){var A=document.getElementById("".concat(t.id,"-").concat(i));n&&A&&n.removeChild(A)}),2e3)}}])}(),P={stream:{1001:"vtm地址或端口非法",1002:"vtm生成文件描述符失败",1003:"vtm设置文件描述符非阻塞失败",1004:"vtm设置文件描述符阻塞失败",1005:"vtm解析服务器ip失败",1006:"vtm描述符select失败",1007:"vtm文件描述符不在可读中",1008:"vtm网络发生错误getsockopt",1009:"vtm描述符select超时",1101:"proxy地址或端口非法",1102:"proxy生成文件描述符失败",1103:"proxy设置文件描述符非阻塞失败",1104:"proxy设置文件描述符阻塞失败",1105:"proxy解析服务器ip失败",1106:"proxy描述符select失败",1107:"proxy文件描述符不在可读中",1108:"proxy网络发生错误getsockopt",1109:"proxy描述符select超时",1201:"vtdu地址或端口非法",1202:"vtdu生成文件描述符失败",1203:"vtdu设置文件描述符非阻塞失败",1204:"vtdu设置文件描述符阻塞失败",1205:"vtdu解析服务器ip失败",1206:"vtdu描述符select失败",1207:"vtdu文件描述符不在可读中",1208:"vtdu网络发生错误getsockopt",1209:"vtdu描述符select超时",5e3:"cas回复信令,发现内存已经释放(和设备之间异常断开)",5400:"私有化协议vtm检测私有化协议中码流类型小于0或者设备序列号为空等非法参数场景返回(app不重试取流)",5402:"回放找不到录像文件",5403:"操作码或信令密钥与设备不匹配",5404:"设备不在线",5405:"流媒体向设备发送或接受信令超时/cas响应超时",5406:"token失效",5407:"客户端的URL格式错误",5409:"预览开启隐私保护",5410:"设备达到最大连接数",5411:"token无权限",5412:"session不存在",5413:"验证token异常",5415:"设备通道错",5416:"设备资源受限",5451:"设备不支持的码流类型",5452:"设备链接流媒体服务器失败",5454:"流媒体中关于设备取流会话不存在",5455:"设备通道未关联",5456:"设备通道关联设备不在线",5457:"客户端不支持端到端加密",5458:"设备不支持当前并发ECDH密",5459:"VTDU 处理ECDH 加密失败",5460:"流媒体中关于设备取流会话不存在",5492:"设备不支持的命令",5500:"服务器处理失败",5501:"流媒体vtdu达到最大负载,请扩容",5503:"vtm返回分配vtdu失败",5504:"流媒体vtdu达到最大负载",5505:"vtm ecdh解密失败",5506:"vtm 返回IPC不支持取流",5530:"机房故障不可用",5544:"设备返回无视频源",5545:"视频分享时间已经结束",5546:"vtdu返回达到取流并发路数限制",5547:"vtdu返回开放平台用户并发限制",5556:"ticket校验失败",5557:"回放服务器等待流头超时",5558:"查找录像开始时间错误",5560:"群组分享取流二次验证失败",5561:"分享群组用户被锁住",5562:"群组分享用户权限变更",5563:"认证服务连接失败",5564:"认证超时",5566:"不在分享时间内预览",5567:"分享通道被锁定",5568:"未找到认证类型",5569:"认证返回的参数异常",5600:"分享设备不在分享时间内",5601:"群组分享用户没权限",5602:"群组分享权限变更",5610:"接收流头失败",5620:"心跳超时",5701:"cas信令返回格式错误",5702:"SPGW请求Cas、Status透传超时",5703:"SPGW请求http不通",6001:"客户端参数出错",6099:"客户端默认错误",6101:"不支持的命令",6102:"设备流头发送失败",6103:"cas/设备返回错误1",6104:"cas/设备返回错误-1",6105:"设备返回错误码3",6106:"设备返回错误码4",6107:"设备返回错误码5",6108:"cas信令回应重复",6109:"视频广场取消分享",6110:"设备信令默认错误",6501:"设备数据链路和实际链路不匹配",6502:"设备数据链路重复建立连接",6503:"设备数据链路端口不匹配",6504:"缓存设备数据链路失败(内存块不足)",6505:"设备发送确认头消息重复",6506:"设备数据先于确定头部到达",6508:"设备数据头部长度非法",6509:"索引找不到设备数据管理块",6510:"设备数据链路vtdu内存块协议状态不匹配",6511:"设备数据头部没有streamkey错误",6512:"设备数据头部非法",6513:"设备数据长度过小",6514:"设备老协议推流头部没有streamkey错误",6515:"设备老协议推流数据非法",6516:"设备老协议索引找不到内存管理块",6517:"设备老协议推流数据非法",6518:"设备数据包过大",6519:"设备推流链路网络不稳定",6520:"设备推流链路网络不稳定",6700:"异常数据",6701:"回放结束",7001:"与相应服务连接失败",7002:"与相应服务连接失败",7003:"与相应服务连接失败",7004:"与相应服务连接失败",7005:"VTDU连接失败,或VTDU侧断开连接",7006:"vtm断开连接",7007:"客户端发送缓冲区满(上行带宽太小)",9e3:"无效包,包过大",9001:"地址不合法",9002:"缺少端口",9048:"免费版并发数达到上限,请升级企业版使用多并发能力",9049:"免费版并发数达到上限,请升级企业版使用多并发能力","0001":"通用错误返回","0002":"入参为空指针","0003":"入参值无效","0004":"信令消息解析非法","0005":"内存资源不足","0006":"协议格式不对或者消息体长度超过STREAM_MAX_MSGBODY_LEN","0007":"设备序列号长度不合法","0008":"取流url长度不合法","0009":"解析vtm返回vtdu地址不合法","0010":"解析vtm返回级联vtdu地址不合法","0011":"解析vtm返回会话标识长度不合法","0012":"vtdu返回流头长度不合法","0013":"vtdu会话长度非法","0014":"回调函数未注册","0015":"vtdu成功响应未携带会话标识","0016":"vtdu成功响应未携带流头","0017":"无数据流,尚未使用","0018":"信令消息体PB解析失败","0019":"信令消息体PB封装失败","0020":"申请系统内存资源失败","0021":"vtdu地址尚未获取到","0022":"客户端尚未支持","0023":"获取系统socket资源失败","0024":"上层填充的StreamSsnId不匹配","0025":"链接服务器失败","0026":"客户端请求未收到服务端应答","0027":"链路断开","0028":"没有取流链接","0029":"流成功停止","0030":"客户端防串流校验失败","0031":"应用层tcp粘包处理缓冲区满","0032":"无效状态迁移","0033":"无效客户端状态","0034":"向vtm取流流媒体信息请求超时","0035":"向代理取流请求超时","0036":"向代理保活取流请求超时","0037":"向vtdu取流请求超时","0038":"向vtdu保活取流请求超时"},server:{ptz:{start:{200:"",10001:"操作失败",10002:"账号异常,操作失败",10005:"账号异常,操作失败",20002:"设备不存在,请检查设备连接情况",20006:"操作失败,请检查设备网络情况",20007:"操作失败,请检查设备在线情况",20008:"操作过于频繁,稍后再试",20014:"操作失败",20032:"通道不存在请检查设备连接情况",49999:"操作失败,请重试",6e4:"操作失败,设备不支持该操作",60001:"操作失败,用户无权限",60002:"设备已旋转到上限位",60003:"设备已旋转到下限位",60004:"设备已旋转到左限位",60005:"设备已旋转到右限位",60006:"操作失败,请重试",60009:"设备正在操作中",60020:"操作失败"},stop:{200:"",10001:"操作失败",10002:"账号异常,操作失败",10005:"账号异常,操作失败",20002:"设备不存在,请检查设备连接情况",20006:"操作失败,请检查设备网络情况",20007:"操作失败,请检查设备在线情况",20008:"操作过于频繁,稍后再试",20014:"操作失败",20032:"通道不存在请检查设备连接情况",49999:"操作失败,请重试",6e4:"操作失败,设备不支持该操作",60001:"操作失败,用户无权限",60006:"操作失败,请重试",60009:"设备正在操作中",60020:"操作失败"}},talk:{200:"",10001:"播放失败",10002:"账号异常,操作失败",10031:"账号异常,操作失败",20002:"设备不存在请检查设备连接情况",60059:"播放失败"},time:{200:"",10001:"播放失败",10002:"账号异常,播放失败",10004:"账号异常,播放失败",10005:"账号异常,播放失败",10011:"播放失败",10013:"账号异常,播放失败",10030:"播放失败",20002:"设备不存在请检查设备连接情况",20014:"播放失败",20032:"设备不存在请检查设备连接情况",49999:"播放失败请重试",60024:"播放失败请重试"}},client:{default:{BTN_RETRY:"重试",BTN_RELOAD:"重新加载",LOADING:"加载中,请稍后",TIMEFORMAT_ERROR:"时间格式有误,请确认"},init:{USE_MULTITHREADING_WARING:"您当前浏览器可以开启谷歌实验室多线程特性,获取更好播放体验,避免浏览器卡顿及崩溃,详见",OPEN_INSTRUCTIONS:"开启说明",INIT_FINSHED:"初始化播放器完成",INIT_SUCCESS:"初始化播放器成功"},play:{GET_PLAYURL_FAILED:"获取播放地址失败",VIDEO_LOADING:"视频加载中",DISCONNECT:"连接断开,请重试",DEVICE_ENCRYPTED:"设备已加密",NO_RECORD:"未找到录像片段",PLAY_FAILED:"播放失败,请检查设备及客户端网络",PLAY_SUCCESS:"播放成功",STOP_SUCCESS:"停止成功",CHANGE_PLAYURL_SUCCESS:"切换播放地址成功",CHANGE_PLAYURL_FAILED:"切换播放地址失败",GET_OSD_TIME:"获取OSD时间",GET_OSD_TIME_FAILED:"获取OSD时间失败",SET_POSTER:"设置播放器封面",RESIZE:"调整播放器尺寸",SPEED:"倍速播放",GET_SPEED:"获取当前播放速率",MAX_SPEED_LIMIT:"播放速度最大为4倍速度",MIN_SPEED_LIMIT:"播放速度最小为1倍速度",SEEK_CANNOT_CROSS_DAYS:"seek时间不能跨日期",SEEK_TIMEFORMAT_ERROR:"seek时间格式错误",PAUSE:"暂停",PAUSE_FAILED:"暂停失败",RESUME:"恢复播放",RESUME_FAILED:"恢复播放失败"},call:{CALL_END:"通话已结束",USER_DO_NOT_OWN_DEVICE:"loadingSetTextWithBtn"},cloudRecord:{NO_CLOUD_RECORD:"该设备在当天没有云录制的录像"},videoLevel:{CHANGE_VIDEO_LEVEL:"切换清晰度",CHANGE_VIDEO_LEVEL_FAIL:"切换清晰度失败",GET_VIDEO_LEVEL_LIST:"获取设备支持的清晰度列表",PLEASE_INPUT_RIGHT_VIDEO_LEVEL:"请输入正确的清度",VIDEO_LEVEL_NOT_SUPPORT:"当前设备不支持该清晰度"},theme:{RESET_THEME:"重置主题",BTN_PLAY:"播放/结束播放",BTN_SOUND:"声音",BTN_RECORDVIDEO:"录屏",BTN_CAPTURE:"截图",BTN_TALK:"对讲",BTN_ZOOM:"电子放大",BTN_3D_ZOOM:"3D定位",BTN_PTZ:"云台控制",BTN_EXPEND:"全局全屏",BTN_WEBEXPEND:"网页全屏",BTN_HD:"画面清晰度",BTN_SPEED:"回放倍速",BTN_CLOUDREC:"云存储回放",BTN_CLOUDRECORD:"云录制",BTN_REC:"本地存储",DEVICE_NAME:"设备名称",DEVICE_ID:"设备序列号"},capture:{CAPTURE_SUCCESS:"截图成功",CAPTURE_FAILED:"截图失败"},record:{START_RECORD_SUCCESS:"开始录制成功",START_RECORD_FAILED:"开始录制失败",STOP_RECORD_SUCCESS:"停止录制成功",STOP_RECORD_FAILED:"停止录制失败"},sound:{OPEN_SOUND:"开启声音",CLOSE_SOUND:"关闭声音"},zoom:{ZOOM:"电子放大",START_ZOOM:"开启电子放大",CLOSE_ZOOM:"关闭电子放大","3D_ZOOM":"3D定位","3D_ZOOM_DISABLE":"未启用3D定位功能","3D_ZOOM_FAILED":"3D定位失败,请重试",START_3D_ZOOM:"开启3D定位",CLOSE_3D_ZOOM:"关闭3D定位",DEVICE_NOT_SUPPORT_3D_ZOOM:"当前设备不支持3D定位功能","3D_ZOOM_ACTIVED":"3D定位已处于开启状态","3D_ZOOM_NOT_ACTIVED":"未启用3D定位功能","3D_ZOOM_CLOSED":"3D定位已处于关闭状态",CHANGE_ZOOM_TYPE:"改变缩放模式"},fullscreen:{FULLSCREEN:"全局全屏",FULLSCREEN_EXIT:"退出全局全屏",GET_WEB_FULLSCREEN_STATUS:"获取浏览器网页全屏状态",WEB_FULLSCREEN:"开启网页全屏",WEB_FULLSCREEN_EXIT:"退出网页全屏"},destroy:{DESTROY:"销毁"},capacity:{GET_CAPACITY:"获取设备能力级",GET_CAPACITY_FAILED:"获取设备能力级失败"},ptz:{GET_PTZ_STATUS:"获取当前云台状态",GET_PTZ_STATUS_FAILED:"未加载Theme模块,无法获取云台状态",MOBILE_HIDE_PTZ:"移动端,非全屏状态不展示云台",OPTION_PTZ_FAILED:"未加载Theme模块,无法操作云台"},mirror:{MIRROR:"镜像翻转",MIRROR_TYPE_ERROR:"翻转参数类型错误"},FEC:{CHANGE_FEC_TYPE:"切换鱼眼矫正类型",DEVICE_NOT_SUPPORT:"设备不支持鱼眼模式",TYPE_NOT_SUPPORT:"鱼眼矫正类型暂时不支持",FEC_SUPPORT_VERSION:"当前只有V3软解支持鱼眼矫正",NO_CANVAS_ID:"鱼眼矫正类型需要分屏,但是没有传正确的分屏的canvas id",SET_FEC_PARAMS:"设置3D矫正视角参数",GET_FEC_PARAMS:"获取3D矫正视角参数",SET_FEC_PARAMS_FAILED:"该矫正类型不能设置3D矫正视角参数",GET_FEC_PARAMS_FAILED:"该矫正类型不能获取3D矫正视角参数",GET_FEC_PARAMS_SUPPORT_VERSION:"当前只有V3软解支持鱼眼矫正获取3D矫正视角参数"},watermark:{SET_WATERMARK:"设置水印"}}},N={color:"red",backgroundColor:"red",activeColor:"red",btnList:[{btnKey:"ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-header-0",iconId:"deviceID",part:"left",defaultActive:1,isrender:1,themeId:"934f270c08b14e928bf0c2ae8e1a937d"},{btnKey:"ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-header-1",iconId:"deviceName",part:"left",defaultActive:1,isrender:1,themeId:"934f270c08b14e928bf0c2ae8e1a937d"}]},M={color:"blue",backgroundColor:"blue",activeColor:"blue",btnList:[{btnKey:"ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-footer-0",iconId:"play",part:"left",defaultActive:0,isrender:0,themeId:"934f270c08b14e928bf0c2ae8e1a937d"}]},T=function(A){this.jsPlugin=A;var e={id:A.id,isMouseDown:!1,isOver:!1,mousePosition:null,oldTime:null,nowTime:A.nowTime||null,moved:null,hoverTime:"2018-12-07 12:00:00",hoverLeft:0,timeTipShow:!1,randomNum:123,timeWidthTbls:[60,1800,3600,86400],timeUnits:["范围: 1分钟; 单位: 秒","范围: 30分钟; 单位: 分钟","范围: 1小时; 单位: 分钟","范围: 1天; 单位: 小时","范围: 3天; 单位: 小时"],drawPen:null,timeSection:[],canvasWidth:null,canvasHeight:null,timeTips:null},t=this;Object.keys(e).forEach((function(A){t[A]=e[A]})),this.options={width:this.canvasWidth,height:48,time:(new Date).getTime(),timeSection:[],timeWidth:0},this.subTime=function(A){return A<10?"0"+A:A},this.tranTime=function(A){var e=A;if(A){var t=new Date(A);e=t.getFullYear()+"/"+(t.getMonth()+1)+"/"+t.getDate()+" "+this.subTime(t.getHours())+":"+this.subTime(t.getMinutes())+":"+this.subTime(t.getSeconds())}return e},this.init=function(A){var e=this.options;return new Promise((function(i,n){A.width&&document.getElementById(A.id).setAttribute("width",parseInt(A.width,10)+"px"),t.randomNum=(Math.random()+"").split(".").join(""),t.timeWidthTblIndex=e.timeWidth;var a=document.getElementById("".concat(t.jsPlugin.id,"-canvas"));t.drawPen=a.getContext("2d"),t.nowTime=A.nowTime,t.timeSection=e.timeSection||[],t.canvasWidth=a.offsetWidth,t.canvasHeight=a.offsetHeight,t.updata(),document.getElementById("".concat(t.jsPlugin.id,"-canvas")).addEventListener("mousemove",(function(A){t.options.readOnly||t.mousemove(A)})),document.getElementById("".concat(t.jsPlugin.id,"-canvas")).addEventListener("mouseover",(function(A){t.options.readOnly||t.mouseover(A)})),document.getElementById("".concat(t.jsPlugin.id,"-canvas")).addEventListener("mouseleave",(function(A){t.options.readOnly||t.mouseleave(A)})),document.getElementById("".concat(t.jsPlugin.id,"-canvas")).addEventListener("mousedown",(function(A){t.options.readOnly||t.mousedown(A)})),document.getElementById("".concat(t.jsPlugin.id,"-canvas")).addEventListener("mouseup",(function(e){if(!t.options.readOnly){var i=A.onChange;t.mouseUpFn(e,i)}})),i()}))},this.setWidth=function(A){A.width&&(document.getElementById(A.id).width=A.width,document.getElementById("".concat(A.id,"-canvas")).width=A.width,document.getElementById("".concat(A.id,"-canvas-container")).width=A.width,t.canvasWidth=A.width,t.updata({time:t.nowTime||new Date}))},this.mousemove=function(A){if(this.isMouseDown&&this.isOver){var e=this.mousePosition-A.pageX;if(0===e)return;var t=0;switch(this.timeWidth){case 60:t=.1;break;case 1800:t=3;break;case 3600:t=90;break;case 86400:t=120}var i=new Date(this.oldTime).getTime()+e*t*1e3;this.updata({time:i}),this.moved=!0}else{var n=parseInt(document.getElementById("".concat(this.jsPlugin.id,"-canvas-container")).offsetLeft,10);this.mousePosition=A.pageX-n,this.updata()}},this.mousedown=function(A){this.isMouseDown=!0,this.mousePosition=A.pageX,this.oldTime=this.nowTime},this.mouseover=function(A){this.isOver=!0},this.mouseleave=function(A){this.isOver=!1,this.isMouseDown=!1,this.updata()},this.changeSize=function(A){console.log("changeSize",A),this.options.timeWidth=A,this.updata({timeWidth:A})},this.mouseUpFn=function(A,e){if(this.isMouseDown&&(this.isMouseDown=!1,this.moved)){this.moved=!1;var t=new Date(this.nowTime).getFullYear()+"/"+(new Date(this.nowTime).getMonth()+1)+"/"+new Date(this.nowTime).getDate()+" "+this.subTime(new Date(this.nowTime).getHours())+":"+this.subTime(new Date(this.nowTime).getMinutes())+":"+this.subTime(new Date(this.nowTime).getSeconds());this.nowTime=new Date(t),this.updata({time:this.nowTime}),this.oldTime=this.nowTime,console.log("nowTime",new Date(this.nowTime),t),e(this.nowTime)}},this.readOnly=function(A){console.log("更改为只读"),this.options.readOnly=!0,document.getElementById("".concat(this.jsPlugin.id,"-canvas")).style.cursor="not-allowed"},this.unReadOnly=function(A){console.log("更改为只读"),this.options.readOnly=!1,document.getElementById("".concat(this.jsPlugin.id,"-canvas")).style.cursor="pointer"},this.run=function(A){t.isMouseDown||t.updata(A)},this.getTime=function(A){console.log("this",this),console.log("当前时间",new Date(this.nowTime))},this.updata=function(A){A=A||{},t.nowTime=A.time||t.nowTime,t.timeSection=A.timeSection||t.timeSection,t.timeWidthTblIndex=A.timeWidth||t.timeWidthTblIndex,t.timeWidth=t.timeWidthTbls[A.timeWidth||t.timeWidthTblIndex],t.timeUnit=t.timeUnits[A.timeWidth||t.timeWidthTblIndex],0===A.timeWidth&&(t.timeWidthTblIndex=0,t.timeWidth=t.timeWidthTbls[0],t.timeUnit=t.timeUnits[0]),t.drawPen.fillStyle="#000000",t.drawPen.fillRect(0,0,t.canvasWidth,t.canvasHeight),t.drawScale(),t.drawRecord(),t.drawOtherMsg()},this.drawSolidLine=function(A,e,t,i,n,a){this.drawPen.save(),this.drawPen.strokeStyle=a,this.drawPen.lineWidth=n,this.drawPen.beginPath(),this.drawPen.moveTo(A,e),this.drawPen.lineTo(t,i),this.drawPen.stroke(),this.drawPen.restore()},this.drawString=function(A,e,t,i,n){this.drawPen.font="12px serif",this.drawPen.fillStyle="#ffffff",this.drawPen.textAlign=i||"left",this.drawPen.fillText(A,e,t+10)},this.drawScale=function(){var A=this,e="rgba(255,255,255)",t=new Date(A.nowTime),i=t.getSeconds(),n=t.getMinutes(),a=t.getHours(),r=t.getDate(),o=0;switch(A.timeWidth){case 60:var s=parseInt(A.canvasWidth/10);t.setSeconds(t.getSeconds()-parseInt(s/2,10)),r=t.getDate(),a=t.getHours(),n=t.getMinutes(),i=t.getSeconds();for(var g=0;ge.canvasWidth&&(i=e.canvasWidth),i<=0&&(i=0),i}},this.drawOtherMsg=function(){this.drawSolidLine(this.canvasWidth/2,0,this.canvasWidth/2,this.canvasHeight,2,"#1890FF"),this.drawPen.shadowBlur=0,this.isOver&&!this.isMouseDown?(this.mouseTime=this.mousePosition/this.canvasWidth*this.timeWidth*1e3+this.nowTime-this.timeWidth/2*1e3,this.mouseString=this.tranTime(this.mouseTime),this.hoverTime=this.mouseString,this.hoverLeft=this.mousePosition-60,this.timeTipShow=!0):this.timeTipShow=!1}},L="https://open.ys7.com",Y=256,G=1536,U=2304,J=[{place:3,name:"鱼眼不矫正",type:0,correctType:0},{place:3,name:"360°全景",type:1,correctType:768},{place:3,name:"4分屏",type:4,correctList:[{correctType:Y,x:.25,y:.25},{correctType:Y,x:.75,y:.25},{correctType:Y,x:.25,y:.75},{correctType:Y,x:.75,y:.75}],correctType:Y},{place:3,name:"柱状",type:5,correctType:G,viewParam:{x:0,y:0}}],H=[{place:1,name:"鱼眼不矫正",type:0,correctType:0},{place:1,name:"360°全景",type:1,correctType:768},{place:1,name:"4分屏",type:2,correctList:[{correctType:Y,x:.25,y:.25},{correctType:Y,x:.75,y:.25},{correctType:Y,x:.25,y:.75},{correctType:Y,x:.75,y:.75}],correctType:Y},{place:1,name:"广角",type:4,correctType:U}];var K=L,V=function(){return o((function A(e){return a(this,A),A.instant?A.instant:(K=e||K,A.instant=this)}),[{key:"setDomain",value:function(A){K=A||K}},{key:"fetch",value:function(A){function e(e,t){return A.apply(this,arguments)}return e.toString=function(){return A.toString()},e}((function(A,e){return A="string"==typeof A?/^http/.test(A)?A:K+A:A,new Promise((function(t,i){fetch(A,e).then((function(A){try{return A.json()}catch(A){i({code:-1,msg:"data json parse error"})}})).then((function(A){200==+A.code||A.meta&&200===A.meta.code?t(A):i(A)})).catch((function(A){i(A)}))}))}))}])}();function W(A){var e=A.slice(0,4),t=A.slice(4,6),i=A.slice(6,8),n=A.slice(8,10),a=A.slice(10,12),r=A.slice(12,14);return new Date("".concat(e,"/").concat(t,"/").concat(i," ").concat(n,":").concat(a,":").concat(r))}function j(A,e){var t,i,n={startTime:e.startTime?new Date(e.startTime).Format("yyyy-MM-dd hh:mm:ss"):void 0,endTime:e.startTime?new Date(e.endTime).Format("yyyy-MM-dd hh:mm:ss"):void 0,spaceId:e.spaceId},a=Object.keys(n).reduce((function(A,e){return null==n[e]?A:A+="&".concat(e,"=").concat(encodeURIComponent(n[e]))}),"").replace("&",""),r=A.env.domain+"/api/service/cloudrecord/video/info/list?".concat(a);return(t=r,i={method:"get",headers:{accessToken:e.accessToken,deviceSerial:e.deviceSerial,localIndex:e.channelNo}},new Promise((function(A,e){fetch(t,i).then((function(A){return A.json()})).then((function(t){200==+t.code||t.meta&&200===t.meta.code?A(t):e(t)})).catch((function(A){e(A)}))}))).then((function(A){return A.data=(A.data||[]).map((function(A){return A.endTime=W(A.stopTime).getTime(),A.startTime=W(A.startTime).getTime(),A.busType=7,A})),A}))}function O(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(e<=-24||e>=24)&&(e=0);var t=A.slice(0,4),i=A.slice(4,6),n=A.slice(6,8),a=A.slice(8,10),r=A.slice(10,12),o=A.slice(12,14),s=new Date(Date.UTC(t,i-1,n,a,r,o));s.setHours(s.getHours()+e),s>new Date&&(s=new Date);var g=s.getUTCFullYear(),c=("0"+(s.getUTCMonth()+1)).slice(-2),l=("0"+s.getUTCDate()).slice(-2),I=("0"+s.getUTCHours()).slice(-2),C=("0"+s.getUTCMinutes()).slice(-2),d=("0"+s.getUTCSeconds()).slice(-2);return new Date("".concat(g,"/").concat(c,"/").concat(l," ").concat(I,":").concat(C,":").concat(d))}s(V,"instant",void 0);var Z=function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(e<=-24||e>=24)&&(e=0);var t=60*e*60*1e3,i=A.getTime()+t;return new Date(i)},q=function(){return o((function A(e){if(a(this,A),this.jSPlugin=e,!document.getElementById("".concat(this.jSPlugin.id,"-audioControls")))return!1;this.currentTimeWidth=0,this.date=new Date,this.datepickerVisible=!1,this.seekTimer=null,this.disabled=!1,this.isSeeking=!1,this.seekFrequency=2e3,this.recList=[],this.lastDate=null,this.nowTime=null,this.jSPlugin.params&&this.jSPlugin.params.seekFrequency&&(this.seekFrequency=this.jSPlugin.params.seekFrequency),this.recInit()}),[{key:"recInit",value:function(){var A=this;if(!document.getElementById("".concat(this.jSPlugin.id,"-audioControls")))return!1;this.currentTimeWidth=0;var e=parseInt(getComputedStyle(document.getElementById(this.jSPlugin.id)).width,10)-100,t=document.createElement("div");t.style="display:inline-block;height:48px;",t.id=this.jSPlugin.id+"-canvas-container";var i=document.createElement("canvas");i.id=this.jSPlugin.id+"-canvas",i.className="time-line-body",i.height="48",i.width=e,i.style="display:inline-block;",i.innerHTML="该浏览器不支持canvas",t.appendChild(i),E(t,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")));var n=document.createElement("div");n.className="timeline-controls",n.style="display:flex;width:100px;height:48px;text-align:center;line-height: 48px;vertical-align: top;background: #000000;";var a='\n
\n \n \n add\n \n \n \n \n \n \n \n \n \n \n \n \n \n reduce\n \n \n \n \n \n \n \n \n
\n\n\n');n.innerHTML=a,E(n,t),this.timeLine=new T(this.jSPlugin);var r=this;this.timeLine.init({id:this.jSPlugin.id+"-canvas",width:e,nowTime:this.nowTime,onChange:function(e){console.log("time",e,new Date(e).Format("yyyyMMddhhmmss"));var t=new Date(e).Format("yyyyMMddhhmmss");if(console.log("----------------this.jSPlugin.url",A.jSPlugin.url),A.jSPlugin.Theme&&A.jSPlugin.Theme.decoderState.state.recordvideo&&(A.jSPlugin.Theme.setDecoderState({recordvideo:!1}),"cloud.rec"===p(A.jSPlugin.url).type&&A.jSPlugin.stopSave()),"cloud.rec"===p(A.jSPlugin.url).type||A.jSPlugin.useSeek&&A.jSPlugin.capacity&&"1"==A.jSPlugin.capacity.support_seek_playback)A.isSeeking||r.recList.length>0&&(new Date(e).valueOf()>=r.lastDate?A.jSPlugin.pluginStatus.loadingSetText({text:"seek回放未找到录像片段",color:"red",delayClear:2e3}):A.unSyncTimeLine().then((function(){A.isSeeking=!0,A.jSPlugin.pluginStatus.loadingStart(A.jSPlugin.id),A.jSPlugin.pluginStatus.setPlayStatus({loading:!0}),A.jSPlugin.pluginStatus.loadingSetText({text:"加载中,请稍后"}),A.jSPlugin.Theme.setDisabled(!0),A.jSPlugin._tempSeekTime=e,A.jSPlugin.seek(t.substr(8,6),"235959").then((function(){var t=setInterval((function(){A.jSPlugin._destroy?clearInterval(t):A.jSPlugin.getOSDTime().then((function(i){var n=new Date(e).valueOf()/1e3;if(console.log("seek时间同步:",new Date(1e3*i.data).Format("hh:mm:ss"),new Date(1e3*n).Format("hh:mm:ss"),i.data>=n),i.data>=n-2){if(A.isSeeking=!1,A.syncTimeLine(),clearInterval(t),A.jSPlugin.pluginStatus.loadingStop(A.jSPlugin.id),A.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),A.jSPlugin.pluginStatus.loadingClear(),A.jSPlugin.Theme.setDisabled(!1),A.jSPlugin._tempSeekTime=null,A.jSPlugin.Theme)A.jSPlugin.Theme.decoderState.state.sound&&A.jSPlugin.openSound();r.jSPlugin.waterMark_JSPlugin&&r.jSPlugin.setWaterMarkFont(r.jSPlugin.waterMark_JSPlugin)}}))}),1e3)}))})));else{var i=function(){setTimeout((function(){A.disabled=!1}),A.seekFrequency)},n=A.jSPlugin.Theme.decoderState.state.play,a=function(e){A.disabled=!0,n?A.unSyncTimeLine().then((function(){A.jSPlugin.pluginStatus.loadingStart(A.jSPlugin.id),A.jSPlugin.pluginStatus.setPlayStatus({loading:!0}),A.jSPlugin.pluginStatus.loadingSetText({text:"加载中,请稍后"}),A.jSPlugin.Theme.setDisabled(!0),A.jSPlugin.pause(t).then((function(){console.log("暂停成功"),A.jSPlugin.resume(t).then((function(t){console.log("恢复成功:",t),A.jSPlugin.Theme&&A.jSPlugin.Theme.setDecoderState({play:!0}),A.jSPlugin.Theme&&A.jSPlugin.Theme.decoderState.state.sound&&A.jSPlugin.openSound(),e&&e(),A.syncTimeLine(),A.jSPlugin.pluginStatus.loadingStop(A.jSPlugin.id),A.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),A.jSPlugin.pluginStatus.loadingClear(),A.jSPlugin.Theme.setDisabled(!1),r.jSPlugin.waterMark_JSPlugin&&r.jSPlugin.setWaterMarkFont(r.jSPlugin.waterMark_JSPlugin)})).catch((function(A){console.log("恢复失败",A)}))})).catch((function(){console.log("暂停失败"),A.jSPlugin.resume(t).then((function(t){console.log("恢复成功"),A.jSPlugin.Theme&&A.jSPlugin.Theme.setDecoderState({play:!0}),e&&e(),A.syncTimeLine(),A.jSPlugin.pluginStatus.loadingStop(A.jSPlugin.id),A.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),A.jSPlugin.pluginStatus.loadingClear(),A.jSPlugin.Theme.setDisabled(!1),r.jSPlugin.waterMark_JSPlugin&&r.jSPlugin.setWaterMarkFont(r.jSPlugin.waterMark_JSPlugin)})).catch((function(A){console.log("恢复失败",A)}))}))})):A.unSyncTimeLine().then((function(){A.jSPlugin.pluginStatus.loadingStart(A.jSPlugin.id),A.jSPlugin.pluginStatus.setPlayStatus({loading:!0}),A.jSPlugin.pluginStatus.loadingSetText({text:"加载中,请稍后"}),A.jSPlugin.Theme.setDisabled(!0),A.jSPlugin.pause(t).then((function(){console.log("暂停成功"),A.jSPlugin.resume(t).then((function(t){A.jSPlugin.Theme&&A.jSPlugin.Theme.setDecoderState({play:!0}),A.jSPlugin.Theme&&A.jSPlugin.Theme.decoderState.state.sound&&A.jSPlugin.openSound(),e&&e(),A.syncTimeLine(),A.jSPlugin.pluginStatus.loadingStop(A.jSPlugin.id),A.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),A.jSPlugin.pluginStatus.loadingClear(),A.jSPlugin.Theme.setDisabled(!1)})).catch((function(A){console.log("恢复失败",A)}))})).catch((function(){console.log("暂停失败"),A.jSPlugin.resume(t).then((function(t){A.jSPlugin.Theme&&A.jSPlugin.Theme.setDecoderState({play:!0}),e&&e(),A.syncTimeLine(),A.jSPlugin.pluginStatus.loadingStop(A.jSPlugin.id),A.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),A.jSPlugin.pluginStatus.loadingClear(),A.jSPlugin.Theme.setDisabled(!1)})).catch((function(A){console.log("恢复失败",A)}))}))})),A.jSPlugin.Theme&&A.jSPlugin.Theme.decoderState&&A.jSPlugin.Theme.decoderState.state&&A.jSPlugin.Theme.decoderState.state.zoom&&(A.jSPlugin.Theme.setDecoderState({zoom:!1}),A.jSPlugin.Zoom.stopZoom())};A.disabled?(console.log("操作频繁,等待2秒后执行"),A.seekTimer&&clearTimeout(A.seekTimer),A.seekTimer=setTimeout((function(){a(i)}),A.seekFrequency)):a(i)}}}).then((function(){A.syncTimeLine()}));var o,s,g=this;o=g.jSPlugin,s=document.getElementById("".concat(o.id,"-wrap")),h("".concat(o.staticPath,"/rec/datepicker.min.css")),d("".concat(o.staticPath,"/rec/jquery.min.js"),(function(A){d("".concat(A.staticPath,"/rec/datepicker.js"),(function(A){d("".concat(A.staticPath,"/rec/datepicker.zh-CN.js"),(function(A){var e=s.getElementsByClassName("datepicker-container")[0];!e&&$("#".concat(A.id,"-datepicker")).datepicker&&$("#".concat(A.id,"-datepicker")).datepicker({autoShow:!1,autoHide:!0,autoPick:!0,language:"zh-CN",date:new Date(u("begin",A.params.url).replace(/(\d{4})(\d{2})(\d{2})/,"$1-$2-$3"))||new Date,format:"yyyy-mm-dd",endDate:new Date,inline:!0,container:s}),(e=s.getElementsByClassName("datepicker-container")[0])&&(e.style.display="none"),g.datepickerVisible=!1,$("#".concat(A.id,"-datepicker")).on("pick.datepicker",(function(t){if(console.log("重新选择日期",t.date,new Date(t.date).Format("yyyyMMddhhmmss"),new Date(document.getElementById("".concat(A.id,"-datepicker")).value).Format("yyyyMMdd")),t.date>new Date||new Date(t.date).Format("yyyyMMddhhmmss")===new Date(document.getElementById("".concat(A.id,"-datepicker")).value).Format("yyyyMMdd"))t.preventDefault();else{var i=new Date(t.date).Format("yyyy-MM-dd");document.getElementById("".concat(A.id,"-datepicker")).value=i,A.eventEmitter.emit("recStartTimeChange",{code:0,data:{time:i}}),g.renderRec(t.date),A.Theme.decoderState&&A.Theme.decoderState.state?A.Theme.decoderState.state.cloudRec?A.changePlayUrl({begin:new Date(t.date).Format("yyyyMMddhhmmss"),type:"cloud.rec"},(function(){}),!1):A.Theme.decoderState.state.rec?A.changePlayUrl({begin:new Date(t.date).Format("yyyyMMddhhmmss"),type:"rec"},(function(){}),!1):A.changePlayUrl({begin:new Date(t.date).Format("yyyyMMddhhmmss")},(function(){}),!1):A.changePlayUrl({begin:new Date(t.date).Format("yyyyMMddhhmmss")},(function(){}),!1)}e&&(e.style.display="none"),g.datepickerVisible=!1,A.Theme&&A.Theme.decoderState&&A.Theme.decoderState.state&&A.Theme.decoderState.state.zoom&&(A.Theme.setDecoderState({zoom:!1}),A.Zoom.stopZoom())})),$("#".concat(A.id,"-datepicker")).off("click").on("click",(function(A){console.log("点击日期"),g.datepickerVisible?e&&(e.style.display="none"):e&&(e.style.display="inline"),g.datepickerVisible=!g.datepickerVisible}))}),(function(){}),A)}),(function(){}),A)}),(function(){}),o),document.getElementById("".concat(this.jSPlugin.id,"-timeline-scale-add")).onclick=function(){A.unSyncTimeLine().then((function(){A.currentTimeWidth<3&&A.timeLine.changeSize(++A.currentTimeWidth),A.syncTimeLine()}))},document.getElementById("".concat(this.jSPlugin.id,"-timeline-scale-sub")).onclick=function(){A.unSyncTimeLine().then((function(){A.currentTimeWidth>0&&A.timeLine.changeSize(--A.currentTimeWidth),A.syncTimeLine()}))};var c=u("begin",this.jSPlugin.url)||(new Date).Format("yyyyMMdd");c=O(c,u("timeZone",this.jSPlugin.url)?parseInt(u("timeZone",this.jSPlugin.url)):0),this.renderRec(c.Format("yyyy-MM-dd")),this.observer=new MutationObserver((function(A,e){}));var l=document.getElementById("".concat(this.jSPlugin.id));this.observer.observe(l,{attributes:!0,attributeOldValue:!0,attributeFilter:["style"]})}},{key:"setDatepickerDate",value:function(A){var e=document.getElementById("".concat(this.jSPlugin.id,"-wrap"));if(e){var t=e.getElementsByClassName("datepicker-container")[0];if(t){var i=t;i.parentNode.removeChild(i),document.getElementById("".concat(this.jSPlugin.id,"-datepicker")).value=A.replace(/(\d{4})(\d{2})(\d{2})/,"$1-$2-$3"),$("#".concat(this.jSPlugin.id,"-datepicker")).datepicker({autoShow:!1,autoHide:!0,autoPick:!0,language:"zh-CN",defaultDate:A,format:"yyyy-mm-dd",endDate:new Date,inline:!0,container:document.getElementById("".concat(this.jSPlugin.id,"-wrap"))})}}}},{key:"datepickerHide",value:function(){var A=document.getElementById("".concat(this.jSPlugin.id,"-wrap"));A&&(A.getElementsByClassName("datepicker-container")[0].style.display="none");this.datepickerVisible=!1}},{key:"datepickerShow",value:function(){var A=document.getElementById("".concat(this.jSPlugin.id,"-wrap"));A&&(A.getElementsByClassName("datepicker-container")[0].style.display="inline");this.datepickerVisible=!0}},{key:"recAutoSize",value:function(A){var e=this,t=this,i=parseInt(getComputedStyle(document.getElementById(t.jSPlugin.id)).width,10)-100;document.getElementById("".concat(this.jSPlugin.id,"-canvas"))&&i!==parseInt(document.getElementById("".concat(t.jSPlugin.id,"-canvas")).width)&&t.unSyncTimeLine().then((function(){t.timeLine.setWidth({id:"".concat(e.jSPlugin.id),width:i}),t.syncTimeLine(),A&&A()}))}},{key:"syncTimeLine",value:function(){var A=this;this.jSPlugin.recTimer&&clearInterval(this.jSPlugin.recTimer),window.recTimer?Array.isArray(window.recTimer[this.jSPlugin.id])&&window.recTimer[this.jSPlugin.id].map((function(A){clearInterval(A)})):window.recTimer={},window.recTimer[this.jSPlugin.id]=[];var e=this;this.jSPlugin.recTimer=setInterval((function(){e.jSPlugin.getOSDTime().then((function(t){var i=t.data;if(-1===i)console.log("获取播放时间错误");else if(i>0){var n=new Date(i>1e12?i:1e3*i);A.nowTime=n,e.timeLine.run({time:n})}})).catch((function(A){var t=e.jSPlugin.Theme.decoderState.state.pauseDate;e.timeLine.run({time:e.timeLine.nowTime||t})}))}),1e3),window.recTimer[this.jSPlugin.id].push(this.jSPlugin.recTimer)}},{key:"unSyncTimeLine",value:function(){var A=this;return new Promise((function(e,t){A.jSPlugin.recTimer&&(clearInterval(A.jSPlugin.recTimer),A.jSPlugin.recTimer=null),window.recTimer?Array.isArray(window.recTimer[A.jSPlugin.id])&&(window.recTimer[A.jSPlugin.id].map((function(A){clearInterval(A)})),window.recTimer[A.jSPlugin.id]=[]):window.recTimer={},e()}))}},{key:"renderRec",value:function(A){var e=this;this.date=A;var t=this,i=new Date(new Date(A).Format("yyyy-MM-dd 00:00:00").replace(/-/g,"/")).getTime();this.jSPlugin.timeZone&&-1===this.jSPlugin.url.indexOf(".cloud")&&(i=new Date(Z(new Date(i),this.jSPlugin.timeZone).Format("yyyy-MM-dd 00:00:00").replace(/-/g,"/")).getTime());var n=new Date(new Date(i).Format("yyyy-MM-dd 23:59:59").replace(/-/g,"/")).getTime();if(this.timeLine.getRecord([],i,n),this.jSPlugin._isCloudRecord&&-1!==this.jSPlugin.url.indexOf(".cloud")&&"7"===u("busType",this.jSPlugin.url)){var a={accessToken:this.jSPlugin.accessToken,deviceSerial:p(this.jSPlugin.url).deviceSerial,channelNo:p(this.jSPlugin.url).channelNo,startTime:i,endTime:n,spaceId:this.jSPlugin._spaceId};j(this.jSPlugin,a).then((function(A){if(A.data&&A.data.length>0){var a=A.data;t.recList=a,t.lastDate=a[a.length-1].endTime,e.timeLine.getRecord(a,i,n)}}))}else{var r={accessToken:this.jSPlugin.accessToken,recType:"cloud.rec"===p(this.jSPlugin.url).type?1:2,deviceSerial:p(this.jSPlugin.url).deviceSerial,channelNo:p(this.jSPlugin.url).channelNo,startTime:i,endTime:n,version:"2.0"},o=this.jSPlugin.env.domain+"/api/lapp/video/by/time";y(o,"POST",r,"",(function(A){if(A.data&&A.data.files&&A.data.files.length>0){var a=A.data.files,o=(new Date).getTime(),s=A.data.isAll;if(t.recList=a,t.lastDate=a[a.length-1].endTime,s)e.timeLine.getRecord(a,i,n);else{!function A(){r.startTime=o,y(this.jSPlugin.env.domain+"/api/lapp/video/by/time","POST",r,"",(function(e){e.data&&e.data.files&&e.data.files.length>0&&0==e.data.isAll?(e.data.files&&(a=a.concat(e.data.files),t.recList=a,t.lastDate=a[a.length-1].endTime),o=e.data.nextFileTime>0?e.data.nextFileTime:(new Date).getTime(),A()):t.timeLine.getRecord(a,i,n)}))}()}e.timeLine.run({time:new Date(i)})}else A.data&&A.data.length>0&&(t.recList=A.data,t.lastDate=A.data[A.data.length-1].endTime,t.timeLine.getRecord(A.data,i,n),t.timeLine.run({time:new Date(i)}))}))}}}])}(),X=function(A){console.log("执行TimeLine - params",A),this.state={id:A.id,start:"00:00:00",end:"24:00:00",current:0,timelag:30,timeArr:[],availTimeLine:[],scrollTop:0,index:0,date:"",noTimeLineTxt:"",disabled:!1};var e=this;this.setState=function(A){Object.keys(A).forEach((function(t){e.state[t]=A[t],"scrollTop"===t&&document.getElementById("time-line-item").parentNode.scrollTo(0,A[t]),"current"===t&&(document.getElementById("time-line-current").innerHTML=A[t])}))},this.setDisabled=function(A){this.setState({disabled:A}),document.getElementById("time-line-item").parentNode.style.overflowY=A?"hidden":"scroll"},this.timeToSecond=function(A){var e=A.split(":"),t=Number(e[0]),i=Number(e[1]),n=Number(e[2]);return 60*t*60+60*i+(n||0)},this.minuteToTime=function(A){var e=Math.floor(A/60),t=A%60;return(e>9?e:"0"+e)+":"+(t>9?t:"0"+t)},this.timeToMinute=function(A){var e=A.split(":");return 60*Number(e[0])+Number(e[1])},this.getPlayParam=A.getPlayParam,this.checkIsAppleDevice=function(){var A=navigator.userAgent,e=!!A.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),t=A.indexOf("iPad")>-1,i=A.indexOf("iPhone")>-1||A.indexOf("Mac")>-1;return!!(e||t||i)},this.checkIsHarmonyOS=function(){return navigator.userAgent.indexOf("ohos")>-1},this.checkIsHarmonyOS()?(document.getElementById("time-line-item").parentNode.addEventListener("touchstart",(function(){if(e.state.disabled)return!1;A.ontouchstart()}),!1),document.getElementById("time-line-item").parentNode.addEventListener("touchmove",(function(){if(e.state.disabled)return!1;A.ontouchmove()}),!1),document.getElementById("time-line-item").parentNode.addEventListener("touchend",(function(){if(e.state.disabled)return!1;var t;new Promise((function(A,e){var i=-1;t=setInterval((function(){var e=document.getElementById("time-line-item").parentNode.scrollTop;e!==i?(console.log("scolling",e,i),i=e):(console.log("scoll stop",e,i),clearInterval(t),A(e))}),100)})).then((function(A){console.log("scollPromise: then",A,e),e.rectTopTotime(A),console.log("页面滚动实际高度",A,e.state),e.getPlayParam({current:e.state.current})})),A.ontouchend()}),!1)):(document.getElementById("time-line-item").parentNode.ontouchstart=function(){if(e.state.disabled)return!1;A.ontouchstart()},document.getElementById("time-line-item").parentNode.ontouchmove=function(){if(e.state.disabled)return!1;A.ontouchmove()},document.getElementById("time-line-item").parentNode.ontouchend=function(){if(e.state.disabled)return!1;var t;new Promise((function(A,e){var i=-1;t=setInterval((function(){var e=document.getElementById("time-line-item").parentNode.scrollTop;e!==i?(console.log("scolling",e,i),i=e):(console.log("scoll stop",e,i),clearInterval(t),A(e))}),100)})).then((function(A){console.log("scollPromise: then",A,e),e.rectTopTotime(A),console.log("页面滚动实际高度",A,e.state),e.getPlayParam({current:e.state.current})})),A.ontouchend()}),this.matchTimeDot()};X.prototype.changeScale=function(A){this.setState({timelag:A}),this.matchTimeDot()},X.prototype.setDateLine=function(A,e){A.length>0?(void 0===e&&(e=A.length-1),this.setState({availTimeLine:A,start:A[e].st,end:A[e].et,current:A[e].st}),console.log("this.state",this.state),this.matchRecTimeDot(),this.primaryOffsetH()):(this.setState({availTimeLine:[]}),console.log("this.state",this.state),this.matchRecTimeDot())},X.prototype.matchTimeDot=function(){var A=this.state,e=A.start,t=A.end,i=A.timelag;A.availTimeLine,console.log("start",e,"end",t);for(var n=[],a=this.timeToMinute(t),r=a=Math.floor(a/i)*i;r>=0;){var o=0,s=0;r==a&&(o=70),0==r&&(s=230);var g=this.minuteToTime(r);n.push({id:r,current:g,label:"a"+r,marginTop:o,marginBottom:s,recArr:[]}),r-=i}this.setState({timeArr:n}),this.renderDateLine()},X.prototype.matchRecTimeDot=function(){var A=this.state,e=A.start,t=A.end,i=A.timelag,n=A.availTimeLine,a=A.timeArr;console.log("start",e,"end",t);var r=[],o=n.length;if(0===o)for(var s=0;sl&&a[s].id')})),n+="
').concat(A.current,"
"),t.innerHTML=n,i.appendChild(t)}))},X.prototype.primaryOffsetH=function(){var A=this.state,e=A.start,t=A.timelag,i=A.timeArr[0].current,n=this.timeToSecond(i)-this.timeToSecond(e),a=Math.ceil(n/t)+60;this.setState({scrollTop:a}),console.log("起始偏移量",a)},X.prototype.currentOffsetH=function(){var A=this.state,e=A.current,t=A.timelag,i=A.timeArr[0].current,n=this.timeToSecond(i)-this.timeToSecond(e),a=Math.ceil(n/t)+60;this.setState({scrollTop:a})},X.prototype.rectTopTotime=function(A){var e,t,i=this.state.timelag,n=Math.floor(A/60),a=A-60*n;if(console.log("index:",n,"offsetH:",a),0==a)e=this.state.timeArr[n-1].current,t=0;else{var r=this.state.timeArr[n].current,o=this.timeToMinute(r),s=(60-a)*i,g=Math.floor(s/60)+o,c=60*Math.floor(s/60);t=Math.ceil(s-c),e=this.minuteToTime(g)}this.setState({current:e+":"+(t>9?t:"0"+t),scrollTop:A})},X.prototype.stepScrollTimeLine=function(A){this.setState({current:A}),this.currentOffsetH()},X.prototype.secondCountDown=function(A){var e=this.state.current.split(":"),t=60*Number(e[0])*60+60*Number(e[1])+Number(e[2])+1,i=Math.floor(t/3600),n=Math.floor((t-3600*i)/60),a=t-3600*i-60*n;this.setState({current:(i>9?i:"0"+i)+":"+(n>9?n:"0"+n)+":"+(a>9?a:"0"+a)})};var z=X;function AA(A){var e=new Date(A),t=e.getHours(),i=e.getMinutes(),n=e.getSeconds();return(t>9?t:"0"+t)+":"+(i>9?i:"0"+i)+":"+(n>9?n:"0"+n)}Date.prototype.Format=function(A){var e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var t in/(y+)/.test(A)&&(A=A.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),e)new RegExp("("+t+")").test(A)&&(A=A.replace(RegExp.$1,1==RegExp.$1.length?e[t]:("00"+e[t]).substr((""+e[t]).length)));return A};var eA=function(){return o((function A(e,t,i){var n=this;a(this,A),this.changeRecSpeed=t,this.resetMobileZoomStatus=i,this.isMobile=!0,this.jSPlugin=e,this.date=(new Date).Format("yyyy-MM-dd"),this.begin=((new Date).Format("yyyy-MM-dd")+" 00:00:00").replace(/-/g,"/"),this.end=((new Date).Format("yyyy-MM-dd")+" 23:59:59").replace(/-/g,"/"),this.initBegin=null,this.initEnd=null,this.type=p(this.jSPlugin.url).type,this.operating=!1,this.seekTimer=null,this.disabled=!1,this.seekFrequency=2e3,this.recList=[],this.isSeeking=!1,this.jSPlugin.params&&this.jSPlugin.params.seekFrequency&&(this.seekFrequency=this.jSPlugin.params.seekFrequency);var r=document.createElement("style");if(r.innerHTML='\n body{\n padding: 0;\n margin: 0;\n }\n .time-line-container {\n text-align: left;\n height: 300px;\n /* outline: 1px solid red; */\n /* background: gray; */\n position: relative;\n /* padding-top: 60px; */\n margin-top: 20px;\n }\n\n .time-line-container .time-line-item-container {\n display: inline-block;\n /* height: 400px; */\n width: 30%;\n /* background: indianred; */\n overflow-y: scroll;\n overflow-x: hidden;\n /* padding-top: 60px; */\n height: 300px;\n box-sizing: border-box;\n white-space: nowrap;\n position: relative;\n }\n\n .time-line-container .time-line-item-container::-webkit-scrollbar {\n width: 0px;\n /*滚动条宽度*/\n height: 0px;\n /*滚动条高度*/\n }\n\n .time-line-item .time-item {\n position: relative;\n box-sizing: border-box;\n height: 60px;\n font-size: 12px;\n color: rgb(150, 150, 150);\n border-right: 6px solid;\n border-right-color: #ddd;\n }\n\n .time-line-item .time-item .scale {\n width: 6px;\n height: 9px;\n border-bottom: 1px solid #ccc;\n float: right;\n clear: both;\n }\n\n .time-line-item .time-item .item-unavail {\n width: 6px;\n position: absolute;\n left: 100%;\n background-color: #ddd;\n }\n\n .time-line-container .current-time {\n position: absolute;\n left: 0;\n top: 40px;\n height: 29px;\n /* line-height: 58px; */\n border-bottom: 1px solid #648FFC;\n width: 60%;\n margin-left: 26%;\n }\n\n .time-line-container .current-time .current-time-bg {\n position: relative;\n top: 15px;\n width: 100px;\n height: 29px;\n line-height: 29px;\n left: -70px;\n font-size: 12px;\n color: #2C2C2C;\n }\n\n .time-line-container .current-time .current-time-bg::before {\n content: \'\';\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 100%;\n background: #648FFC;\n top: 11px;\n position: absolute;\n right: 30px;\n }\n\n .date-switch-container {\n height: 40px;\n position: relative;\n text-align: center;\n margin: 20px 10px;\n }\n\n .date-switch-container .current-date {\n line-height: 40px;\n height: 22px;\n font-size: 16px;\n color: #2C2C2C;\n text-align: center;\n font-weight: bold;\n }\n\n .date-container {\n width: 40px;\n height: 40px;\n position: absolute;\n right: 0;\n top: 0;\n }\n\n .rec-type-container {\n display: flex;\n justify-content: space-between;\n }\n\n .rec-type-container .rec-type-text {\n padding: 0 15px;\n font-size: 12px;\n color: #2C2C2C;\n }\n\n .rec-type-container .rec-type-switch {\n padding: 0 20px;\n }\n\n .date-container input {\n position: absolute;\n opacity: 0;\n display: inline-block;\n width: 40px;\n height: 40px;\n z-index: 10;\n left: 0;\n }\n\n .date-container label {\n position: absolute;\n left: 0;\n top: 0;\n /* display: none; */\n z-index: 0;\n }\n\n .date-icon {\n display: inline-block;\n width: 40px;\n height: 40px;\n background: url(\'https://resource.eziot.com/group2/M00/00/6A/CtwQF2F6VieAQrU9AAABP-_Nsqo949.png\') no-repeat 100% 100%;\n }\n .select-container {\n padding: 10px;\n display: flex;\n justify-content: space-between;\n }\n\n .advice {\n height: 24px;\n width: 70px;\n display: flex;\n justify-content: space-between;\n line-height: 24px;\n background: #F8F8F8;\n border-radius: 8px;\n }\n\n .advice span {\n width: 40px;\n display: inline-block;\n }\n\n input[type="checkbox"]:not(:checked)+.advice span:first-child {\n box-shadow: 0px 2px 5px 0px rgb(23 45 101 / 20%);\n border-radius: 8px;\n text-align: center;\n\n }\n\n input[type="checkbox"]:checked+.advice span:last-child {\n box-shadow: 0px 2px 5px 0px rgb(23 45 101 / 20%);\n border-radius: 8px;\n text-align: center;\n }\n\n input[type="checkbox"]:not(:checked)+.advice span:first-child svg {\n fill: #648FFC !important;\n }\n\n input[type="checkbox"]:checked+.advice span:last-child svg {\n fill: #648FFC !important;\n }',document.getElementsByTagName("head")[0].appendChild(r),u("begin",this.jSPlugin.url)){var o=u("begin",this.jSPlugin.url);this.date=o.slice(0,4)+"/"+o.slice(4,6)+"/"+o.slice(6,8),this.begin=this.date+" ".concat(o.slice(8,10)||"00",":").concat(o.slice(10,12)||"00",":").concat(o.slice(12,14)||"00"),this.end=this.date+" 23:59:59",this.initBegin=this.begin}if(u("end",this.jSPlugin.url)){var s=u("end",this.jSPlugin.url);this.end=this.date+" ".concat(s.slice(8,10)||"23",":").concat(s.slice(10,12)||"59",":").concat(s.slice(12,14)||"59"),this.initEnd=this.end}var g=document.createElement("div");g.id="date-switch-container-wrap",g.className="date-switch-container-wrap",g.style="",g.innerHTML='\n
\n
今日录像
\n
\n \n \n
\n
\n '),E(g,document.getElementById("".concat(this.jSPlugin.id,"-wrap")));var c=document.createElement("div");c.id="rec-type-container-wrap",c.className="rec-type-container-wrap",c.style="",c.innerHTML='\n
\n
0个录像
\n
\n \n
\n
\n ',E(c,g);var l=document.createElement("div");l.id="mobile-rec-wrap",l.className="mobileRec-wrap",l.style="",l.innerHTML='\n
\n
\n
00:00:00
\n
\n
\n
\n
\n
\n
\n ',E(l,c),this.TimeLineOBJ=new z({id:"time-line-item",getPlayParam:function(A){var e=n;console.log("子组件传值到父组件",A,A.current,n.date);var t=A.current,i=new Date(n.date).Format("yyyyMMdd").substr(0,8)+(A.current?t.replace(/:/g,""):A.current.replace(/:/g,""));if("cloud.rec"===n.type||n.jSPlugin.useSeek&&n.jSPlugin.capacity&&"1"==n.jSPlugin.capacity.support_seek_playback)n.isSeeking||e.recList.length>0&&(new Date("".concat(n.date," ").concat(A.current)).valueOf()>=e.lastDate?(n.jSPlugin.pluginStatus.loadingSetText({text:"seek回放未找到录像片段",color:"red",delayClear:2e3}),n.syncTimeLine()):n.unSyncTimeLine().then((function(){n.isSeeking=!0,n.jSPlugin.pluginStatus.loadingStart(n.jSPlugin.id),n.jSPlugin.pluginStatus.setPlayStatus({loading:!0}),n.jSPlugin.pluginStatus.loadingSetText({text:"加载中,请稍后"}),n.jSPlugin.Theme.setDisabled(!0),n.jSPlugin.seek(i.substr(8,6),"235959").then((function(){var A=setInterval((function(){n.jSPlugin.getOSDTime().then((function(t){console.log("seek时间同步:",new Date(1e3*t.data).Format("yyyyMMddhhmmss"),i,new Date(1e3*t.data).Format("yyyyMMddhhmmss")>=i),new Date(1e3*t.data).Format("yyyyMMddhhmmss")>=i&&(n.isSeeking=!1,n.syncTimeLine(),clearInterval(A),n.jSPlugin.pluginStatus.loadingStop(n.jSPlugin.id),n.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),n.jSPlugin.pluginStatus.loadingClear(),n.jSPlugin.Theme.setDisabled(!1),n.jSPlugin.waterMark_JSPlugin&&e.jSPlugin.setWaterMarkFont(e.jSPlugin.waterMark_JSPlugin))}))}),1e3)}))})));else{var a=function(){setTimeout((function(){n.disabled=!1}),n.seekFrequency)},r=n.jSPlugin.Theme.decoderState.state.play,o=function(A){n.disabled=!0,n.jSPlugin.pluginStatus.loadingStart(n.jSPlugin.id),n.jSPlugin.pluginStatus.setPlayStatus({loading:!0}),n.jSPlugin.pluginStatus.loadingSetText({text:"加载中,请稍后"}),n.jSPlugin.Theme.setDisabled(!0),r?n.unSyncTimeLine().then((function(){n.jSPlugin.pause(i).then((function(){console.log("暂停成功"),n.jSPlugin.resume(i).then((function(t){console.log("恢复成功"),n.syncTimeLine(),n.jSPlugin.pluginStatus.loadingStop(n.jSPlugin.id),n.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),n.jSPlugin.pluginStatus.loadingClear(),n.jSPlugin.Theme.setDisabled(!1),n.jSPlugin.waterMark_JSPlugin&&e.jSPlugin.setWaterMarkFont(e.jSPlugin.waterMark_JSPlugin),A&&A()}))})).catch((function(){console.log("暂停失败"),n.jSPlugin.resume(i).then((function(e){console.log("恢复成功"),n.syncTimeLine(),n.jSPlugin.pluginStatus.loadingStop(n.jSPlugin.id),n.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),n.jSPlugin.pluginStatus.loadingClear(),n.jSPlugin.Theme.setDisabled(!1),A&&A()}))}))})):n.unSyncTimeLine().then((function(){n.jSPlugin.resume(i).then((function(e){console.log("恢复成功"),n.syncTimeLine(),A&&A()}))}))};n.disabled?(console.log("操作频繁,等待2秒后执行"),n.seekTimer&&clearTimeout(n.seekTimer),n.seekTimer=setTimeout((function(){o(a)}),n.seekFrequency)):o(a)}},ontouchstart:function(){n.operating=!0,n.unSyncTimeLine()},ontouchmove:function(){0==n.operating&&(n.operating=!0,n.unSyncTimeLine())},ontouchend:function(){n.operating=!1}}),this.fetchDeviceRec(),document.getElementById("date").addEventListener("change",(function(A){console.log("日期变化",A.target.value);var e=A.target.value,t=parseInt(new Date(e).Format("yyyy/MM/dd").replace(/\//g,"")),i=new Date;t>parseInt(i.Format("yyyy/MM/dd").replace(/\//g,""))?document.getElementById("date").value=new Date(n.date.replace(/\//g,"-")||i.Format("yyyy-MM-dd")).Format("yyyy-MM-dd"):(n.date=new Date(e).Format("yyyy/MM/dd"),n.begin=n.date+" 00:00:00",n.end=n.date+" 23:59:59",n.jSPlugin.changePlayUrl({type:n.type,begin:"".concat(new Date(n.date).Format("yyyyMMdd"),"000000")}).then((function(A){setTimeout((function(){var A=document.getElementById("date");A&&(A.value=e)}),0)})),n.changeRecSpeed(1),n.resetMobileZoomStatus())})),document.getElementById("cloudType").checked="rec"===this.type,document.getElementById("cloudType").addEventListener("change",(function(A){var e=A.target.checked?2:1;n.type=A.target.checked?"rec":"cloud.rec",console.log("recType",e),n.jSPlugin.changePlayUrl({type:n.type,begin:"".concat(new Date(n.date).Format("yyyyMMdd"),"000000")}).then((function(){console.log("切换类型成功"),n.syncTimeLine(),n.changeRecSpeed(1),n.resetMobileZoomStatus()}),(function(A){console.log("err",A)})).catch((function(A){console.log(A)}))})),this.syncTimeLine()}),[{key:"fetchDeviceRec",value:function(){var A=this,e=function(e){var t=e.length;document.getElementById("recCount").innerHTML=t;for(var i=[],n=t-1;n>=0;n--){var a=e[n],r=AA(a.endTime),o=AA(a.startTime);i.push({st:o,et:r})}A.TimeLineOBJ.setDateLine(i)},t=new FormData,i=this;t.append("deviceSerial",p(this.jSPlugin.url).deviceSerial),t.append("channelNo",p(this.jSPlugin.url).channelNo),t.append("accessToken",this.jSPlugin.accessToken),t.append("recType","cloud.rec"===this.type?1:2);var n=u("timeZone",this.jSPlugin.url);if(n<=23&&n>=-23&&"cloud.rec"!==this.type){var a=O(new Date(this.begin).Format("yyyyMMddhhmmss"),+n);t.append("startTime",new Date(a.Format("yyyy/MM/dd")+" 00:00:00").getTime()),t.append("endTime",new Date(a.Format("yyyy/MM/dd")+" 23:59:59").getTime()),this.date=a.Format("yyyy/MM/dd")}else t.append("startTime",new Date(this.begin).getTime()),t.append("endTime",new Date(this.end).getTime());fetch(this.jSPlugin.env.domain+"/api/lapp/video/by/time",{method:"POST",body:t}).then((function(A){return A.json()})).then((function(A){if(200==A.code&&A.data){var t;t=A.data,i.recList=t,i.lastDate=t[t.length-1].endTime,e(t)}else e([])}))}},{key:"syncTimeLine",value:function(){var A=this;this.jSPlugin.recTimer&&clearInterval(this.jSPlugin.recTimer),window.recTimer?Array.isArray(window.recTimer[this.jSPlugin.id])&&window.recTimer[this.jSPlugin.id].map((function(A){clearInterval(A)})):window.recTimer={},window.recTimer[this.jSPlugin.id]=[];var e=this;this.jSPlugin.recTimer=setInterval((function(){if(A.operating)return console.log("操作中"),!1;A.jSPlugin.getOSDTime().then((function(A){A.data>0&&e.TimeLineOBJ.stepScrollTimeLine(function(A){var e=new Date(A),t=e.getHours(),i=e.getMinutes(),n=e.getSeconds();return(t>9?t:"0"+t)+":"+(i>9?i:"0"+i)+":"+(n>9?n:"0"+n)}(1e3*A.data))})).catch((function(A){console.log("err:-----",A),console.log("未找到当前获取播放时间,等待中...")}))}),1e3),window.recTimer[this.jSPlugin.id].push(this.jSPlugin.recTimer)}},{key:"unSyncTimeLine",value:function(){var A=this;return new Promise((function(e,t){A.jSPlugin.recTimer&&(clearInterval(A.jSPlugin.recTimer),A.jSPlugin.recTimer=null),window.recTimer?Array.isArray(window.recTimer[A.jSPlugin.id])&&(window.recTimer[A.jSPlugin.id].map((function(A){clearInterval(A)})),window.recTimer[A.jSPlugin.id]=[]):window.recTimer={},e()}))}}])}(),tA=function(){return o((function A(e){var t=this;if(a(this,A),this.jSPlugin=e,this.pluginStatus=new R(this,this.jSPlugin.id),this.showPtz=!1,document.getElementById(this.jSPlugin.id+"-ez-ptz-item"))return!1;var i=document.createElement("div");i.id=this.jSPlugin.id+"-ez-ptz-item",i.className="ez-ptz-wrap",i.style="display:none;";var n=document.createElement("style");n.innerHTML="\n .ez-ptz-container {\n position: relative;\n width: 80px;\n height: 80px;\n background: rgba(255, 255, 255, 0.70);\n box-shadow: 0px 0px 33px 4px rgb(0 0 0 / 15%);\n border: 1px solid rgba(255, 255, 255, 0.70);\n border-radius: 100%;\n cursor: pointer;\n overflow: hidden;\n user-select: none;\n }\n .ez-ptz-container .ez-ptz-icon.top {\n width: 0;\n height: 0;\n border-left: 4px solid transparent;\n border-right: 4px solid transparent;\n border-bottom: 8px solid #999999;\n position: absolute;\n display: inline-block;\n left: calc(50% - 4px);\n top: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.top.active {\n border-bottom-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.bottom {\n width: 0;\n height: 0;\n border-left: 4px solid transparent;\n border-right: 4px solid transparent;\n border-top: 8px solid #999999;\n position: absolute;\n display: inline-block;\n left: calc(50% - 4px);\n bottom: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.bottom.active {\n border-top-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.right {\n width: 0;\n height: 0;\n border-top: 4px solid transparent;\n border-bottom: 4px solid transparent;\n border-left: 8px solid #999999;\n position: absolute;\n display: inline-block;\n top: calc(50% - 4px);\n right: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.right.active {\n border-left-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.left {\n width: 0;\n height: 0;\n border-top: 4px solid transparent;\n border-bottom: 4px solid transparent;\n border-right: 8px solid #999999;\n position: absolute;\n display: inline-block;\n top: calc(50% - 4px);\n left: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.left.active {\n border-right-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.top-left {\n width: 4px;\n height: 4px;\n border-radius: 50%;\n position: absolute;\n display: inline-block;\n top: calc(25% - 4px);\n left: 16px;\n background: #999999;\n }\n\n .ez-ptz-container .ez-ptz-icon.top-left.active {\n border-right-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.left-bottom {\n width: 4px;\n height: 4px;\n border-radius: 50%;\n position: absolute;\n display: inline-block;\n bottom: calc(25% - 4px);\n left: 16px;\n background: #999999;\n }\n\n .ez-ptz-container .ez-ptz-icon.left-bottom.active {\n border-right-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.bottom-right {\n width: 4px;\n height: 4px;\n border-radius: 50%;\n position: absolute;\n display: inline-block;\n bottom: calc(25% - 4px);\n right: 16px;\n background: #999999;\n }\n\n .ez-ptz-container .ez-ptz-icon.bottom-right.active {\n border-right-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.right-top {\n width: 4px;\n height: 4px;\n border-radius: 50%;\n position: absolute;\n display: inline-block;\n top: calc(25% - 4px);\n right: 16px;\n background: #999999;\n }\n\n .ez-ptz-container .ez-ptz-icon.right-top.active {\n border-right-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-main.center {\n width: 23px;\n height: 23px;\n background: #407AFF;\n border-radius: 100%;\n top: calc(50% - 12.4px);\n left: calc(50% - 12.4px);\n position: absolute;\n }\n\n .ez-ptz-wrap {\n position: absolute;\n right: 0px;\n top: 0;\n width: 85px;\n height: 100%;\n padding: 0 20px;\n flex-direction: column;\n justify-content: center;\n background: rgba(0,0,0,0.9);\n box-sizing: content-box !important;\n }\n\n .ez-ptz-close {\n position: absolute;\n color: #FFFFFF;\n top: 0;\n right: 0px;\n }\n\n .ez-ptzspeed-progress-line{\n height: 1px;\n background: #ffffff;\n margin: 16px 0 8px;\n display: flex;\n justify-content: space-between;\n }\n\n .ez-ptzspeed-progress-line-dot{\n width: 5px;\n height: 5px;\n border: 2px solid #ffffff;\n border-radius: 50%;\n background: #ffffff;\n margin: -3px 0;\n cursor: pointer;\n }\n\n .ez-ptzspeed-progress-line-dot.active{\n border-color: #407AFF;\n }\n \n .ez-ptzspeed-progress-points{\n display: flex;\n justify-content: space-between;\n }\n\n .ez-ptzspeed-progress-points-slow{\n cursor: pointer;\n color: #ffffff;\n }\n\n .ez-ptzspeed-progress-points-mid{\n cursor: pointer;\n color: #ffffff;\n }\n\n .ez-ptzspeed-progress-points-fast{\n cursor: pointer;\n color: #ffffff;\n }\n\n .ez-ptzbtn-container{\n width: 100%;\n height:".concat(e.isMobile?"60px":"18px",";\n margin-top: 14px;\n display: ").concat(e.isMobile?"block":"flex",";\n }\n\n .ez-ptzbtn-focal,\n .ez-ptzbtn-zoom{\n width: ").concat(e.isMobile?"100%":"50%",";\n height: 20px;\n display: flex;\n border: 1px solid rgba(255,255,255,0.5);\n border-radius: 10px;\n padding-bottom: 0px;\n box-sizing: content-box;\n }\n\n .ez-ptzbtn-zoom-add,\n .ez-ptzbtn-zoom-sub,\n .ez-ptzbtn-focal-add,\n .ez-ptzbtn-focal-sub{\n width: ").concat(e.isMobile?"50%":"24px",";\n height: 20px;\n cursor: pointer;\n text-align: center;\n }\n\n .ez-ptzbtn-zoom{\n margin: ").concat(e.isMobile?"0 0 8px":"0 4px 0 0",";\n }\n\n .ez-ptzbtn-zoom-add{\n border-right: 1px solid rgba(255,255,255,0.5);\n }\n\n .ez-ptzbtn-focal-add{\n border-right: 1px solid rgba(255,255,255,0.5);\n }\n "),document.getElementsByTagName("head")[0].appendChild(n),i.innerHTML='\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n 慢\n
\n
\n 中\n
\n
\n 快\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n '),document.getElementById("".concat(e.id,"-wrap")).appendChild(i),document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).onmousedown=function(A){A.preventDefault(),A.stopPropagation(),console.log("点击开始"),t._handlePtzTouch(A,"start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).onmouseup=function(A){A.preventDefault(),A.stopPropagation(),console.log("触摸结束"),t._handlePtzTouch(A,"stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).ontouchstart=function(A){A.preventDefault(),A.stopPropagation(),console.log("触摸开始"),t._handlePtzTouch(A,"start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).ontouchend=function(A){A.preventDefault(),A.stopPropagation(),console.log("触摸结束",A),t._handlePtzTouch(A,"stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzspeed-container")).onmouseup=function(A){A.target.id&&(A.target.id.indexOf("slow")>-1&&(t.jSPlugin.ptzSpeed=t.jSPlugin.ptzSpeedOptions?t.jSPlugin.ptzSpeedOptions.slow:1,document.getElementById("ptzspeed-slow-dot").classList.add("active"),document.getElementById("ptzspeed-mid-dot").classList.remove("active"),document.getElementById("ptzspeed-fast-dot").classList.remove("active")),A.target.id.indexOf("mid")>-1&&(t.jSPlugin.ptzSpeed=t.jSPlugin.ptzSpeedOptions?t.jSPlugin.ptzSpeedOptions.mid:3,document.getElementById("ptzspeed-slow-dot").classList.remove("active"),document.getElementById("ptzspeed-mid-dot").classList.add("active"),document.getElementById("ptzspeed-fast-dot").classList.remove("active")),A.target.id.indexOf("fast")>-1&&(t.jSPlugin.ptzSpeed=t.jSPlugin.ptzSpeedOptions?t.jSPlugin.ptzSpeedOptions.fast:7,document.getElementById("ptzspeed-slow-dot").classList.remove("active"),document.getElementById("ptzspeed-mid-dot").classList.remove("active"),document.getElementById("ptzspeed-fast-dot").classList.add("active")))},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzspeed-container")).ontouchend=function(A){A.target.id&&(A.target.id.indexOf("slow")>-1&&(t.jSPlugin.ptzSpeed=t.jSPlugin.ptzSpeedOptions?t.jSPlugin.ptzSpeedOptions.slow:1,document.getElementById("ptzspeed-slow-dot").classList.add("active"),document.getElementById("ptzspeed-mid-dot").classList.remove("active"),document.getElementById("ptzspeed-fast-dot").classList.remove("active")),A.target.id.indexOf("mid")>-1&&(t.jSPlugin.ptzSpeed=t.jSPlugin.ptzSpeedOptions?t.jSPlugin.ptzSpeedOptions.mid:3,document.getElementById("ptzspeed-slow-dot").classList.remove("active"),document.getElementById("ptzspeed-mid-dot").classList.add("active"),document.getElementById("ptzspeed-fast-dot").classList.remove("active")),A.target.id.indexOf("fast")>-1&&(t.jSPlugin.ptzSpeed=t.jSPlugin.ptzSpeedOptions?t.jSPlugin.ptzSpeedOptions.fast:7,document.getElementById("ptzspeed-slow-dot").classList.remove("active"),document.getElementById("ptzspeed-mid-dot").classList.remove("active"),document.getElementById("ptzspeed-fast-dot").classList.add("active")))},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-add")).onmousedown=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("zoom","add","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-add")).onmouseup=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("zoom","add","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-sub")).onmousedown=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("zoom","sub","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-sub")).onmouseup=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("zoom","sub","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-add")).onmousedown=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("focal","add","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-add")).onmouseup=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("focal","add","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-sub")).onmousedown=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("focal","sub","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-sub")).onmouseup=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("focal","sub","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-add")).ontouchstart=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("zoom","add","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-add")).ontouchend=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("zoom","add","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-sub")).ontouchstart=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("zoom","sub","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-sub")).ontouchend=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("zoom","sub","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-add")).ontouchstart=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("focal","add","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-add")).ontouchend=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("focal","add","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-sub")).ontouchstart=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("focal","sub","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-sub")).ontouchend=function(A){A.preventDefault(),A.stopPropagation(),t._handleBtnTouch("focal","sub","stop")}}),[{key:"show",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-item"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-item")).style="display: flex;box-sizing: content-box;"),this.showPtz=!0,this.jSPlugin.eventEmitter&&this.jSPlugin.eventEmitter.emit("openPtz",{eventType:"openPtz",code:0,target:this,msg:"开启云台"})}},{key:"hide",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-item"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-item")).style="display: none"),this.showPtz=!1,this.jSPlugin.eventEmitter&&this.jSPlugin.eventEmitter.emit("closePtz",{eventType:"closePtz",code:0,target:this,msg:"关闭云台"})}},{key:"_handlePtzTouch",value:function(A,e){var t=this,i=document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).getBoundingClientRect(),n=i.left+41,a=i.top+41,r=A.x||A.changedTouches[0].clientX,o=A.y||A.changedTouches[0].clientY,s=0,g=this.jSPlugin.env.domain+"/api/lapp/device/ptz/start",c=0;function l(A,e){var t=Math.atan2(e,A);t<0&&(t+=2*Math.PI);var i=t*(180/Math.PI)-225-12.5;return i<0&&(i+=360),Math.floor(i/45)+1}if(/^rotate\(90/.test(document.getElementById("".concat(this.jSPlugin.id,"-wrap")).style.transform))switch(l(r-n,o-a)){case 1:s=2,c=90;break;case 2:s=4,c=135;break;case 3:s=0,c=180;break;case 4:s=6,c=225;break;case 5:s=3,c=270;break;case 6:s=7,c=315;break;case 7:s=1,c=0;break;case 8:s=5,c=45}else switch(l(r-n,o-a)){case 1:s=0,c=180;break;case 2:s=6,c=225;break;case 3:s=3,c=270;break;case 4:s=7,c=315;break;case 5:s=1,c=0;break;case 6:s=5,c=45;break;case 7:s=2,c=90;break;case 8:s=4,c=135}document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).style="background-image:linear-gradient(".concat(c,"deg, #4277FF 0%, rgba(100,143,252,0.00) 30%)"),"stop"===e&&(g=this.jSPlugin.env.domain+"/api/lapp/device/ptz/stop",document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).style="");var I=new FormData;I.append("deviceSerial",p(this.jSPlugin.url).deviceSerial),I.append("channelNo",p(this.jSPlugin.url).channelNo),I.append("speed",this.jSPlugin.ptzSpeed),I.append("direction",s),I.append("accessToken",this.jSPlugin.accessToken),fetch(g,{method:"POST",body:I}).then((function(A){return A.json()})).then((function(A){if("start"===e&&200!=A.code){console.log(A.code,t.jSPlugin.i18n.t("server.ptz."+e+"."+A.code));var i=t.jSPlugin.i18n.t("server.ptz."+e+"."+A.code)||A.msg;t.pluginStatus.loadingSetText({text:i,color:"red",delayClear:2e3})}60005!=A.code&&60002!=A.code&&60003!=A.code&&60004!=A.code&&60006!=A.code||(document.getElementById("".concat(t.jSPlugin.id,"-ez-ptz-container")).style="background-image:linear-gradient(".concat(c,"deg, #f45656 0%, rgba(100,143,252,0.00) 30%)"))})).catch((function(A){console.log("云台调用异常",A)}))}},{key:"_handleBtnTouch",value:function(A,e,t){var i=this,n=8;n="zoom"===A?"add"===e?8:9:"add"===e?10:11;var a=this.jSPlugin.env.domain+"/api/lapp/device/ptz/start";"stop"===t&&(a=this.jSPlugin.env.domain+"/api/lapp/device/ptz/stop");var r=new FormData;r.append("deviceSerial",p(this.jSPlugin.url).deviceSerial),r.append("channelNo",p(this.jSPlugin.url).channelNo),r.append("speed",this.jSPlugin.ptzSpeed),r.append("direction",n),r.append("accessToken",this.jSPlugin.accessToken),fetch(a,{method:"POST",body:r}).then((function(A){return A.json()})).then((function(e){"start"===t&&200!=e.code&&(6e4==e.code||60006==e.code?i.pluginStatus.loadingSetText({text:"zoom"===A?"当前设备不支持物理缩放":"当前设备不支持变焦",color:"red",delayClear:2e3}):i.pluginStatus.loadingSetText({text:e.msg,color:"red",delayClear:2e3}))})).catch((function(A){}))}}])}();function iA(A){throw new Error('Could not dynamically require "'+A+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}!function(A,e){A.exports=function(){function A(e,t,i){function n(r,o){if(!t[r]){if(!e[r]){if(!o&&iA)return iA(r);if(a)return a(r,!0);var s=new Error("Cannot find module '"+r+"'");throw s.code="MODULE_NOT_FOUND",s}var g=t[r]={exports:{}};e[r][0].call(g.exports,(function(A){return n(e[r][1][A]||A)}),g,g.exports,A,e,t,i)}return t[r].exports}for(var a=iA,r=0;r0&&void 0!==arguments[0]?arguments[0]:{}).window,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},t=i.log,g=i.detectBrowser(A),c={browserDetails:g,commonShim:s,extractVersion:i.extractVersion,disableLog:i.disableLog,disableWarnings:i.disableWarnings};switch(g.browser){case"chrome":if(!n||!n.shimPeerConnection||!e.shimChrome)return t("Chrome shim is not included in this adapter release."),c;t("adapter.js shimming chrome."),c.browserShim=n,n.shimGetUserMedia(A),n.shimMediaStream(A),n.shimPeerConnection(A),n.shimOnTrack(A),n.shimAddTrackRemoveTrack(A),n.shimGetSendersWithDtmf(A),n.shimGetStats(A),n.shimSenderReceiverGetStats(A),n.fixNegotiationNeeded(A),s.shimRTCIceCandidate(A),s.shimConnectionState(A),s.shimMaxMessageSize(A),s.shimSendThrowTypeError(A),s.removeAllowExtmapMixed(A);break;case"firefox":if(!r||!r.shimPeerConnection||!e.shimFirefox)return t("Firefox shim is not included in this adapter release."),c;t("adapter.js shimming firefox."),c.browserShim=r,r.shimGetUserMedia(A),r.shimPeerConnection(A),r.shimOnTrack(A),r.shimRemoveStream(A),r.shimSenderGetStats(A),r.shimReceiverGetStats(A),r.shimRTCDataChannel(A),r.shimAddTransceiver(A),r.shimCreateOffer(A),r.shimCreateAnswer(A),s.shimRTCIceCandidate(A),s.shimConnectionState(A),s.shimMaxMessageSize(A),s.shimSendThrowTypeError(A);break;case"edge":if(!a||!a.shimPeerConnection||!e.shimEdge)return t("MS edge shim is not included in this adapter release."),c;t("adapter.js shimming edge."),c.browserShim=a,a.shimGetUserMedia(A),a.shimGetDisplayMedia(A),a.shimPeerConnection(A),a.shimReplaceTrack(A),s.shimMaxMessageSize(A),s.shimSendThrowTypeError(A);break;case"safari":if(!o||!e.shimSafari)return t("Safari shim is not included in this adapter release."),c;t("adapter.js shimming safari."),c.browserShim=o,o.shimRTCIceServerUrls(A),o.shimCreateOfferLegacy(A),o.shimCallbacksAPI(A),o.shimLocalStreamsAPI(A),o.shimRemoteStreamsAPI(A),o.shimTrackEventTransceiver(A),o.shimGetUserMedia(A),s.shimRTCIceCandidate(A),s.shimMaxMessageSize(A),s.shimSendThrowTypeError(A),s.removeAllowExtmapMixed(A);break;default:t("Unsupported browser!")}return c}},{"./chrome/chrome_shim":3,"./common_shim":6,"./edge/edge_shim":7,"./firefox/firefox_shim":11,"./safari/safari_shim":14,"./utils":15}],3:[function(A,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.shimGetDisplayMedia=t.shimGetUserMedia=void 0;var i="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(A){return n(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":n(A)},a=A("./getusermedia");Object.defineProperty(t,"shimGetUserMedia",{enumerable:!0,get:function(){return a.shimGetUserMedia}});var r=A("./getdisplaymedia");Object.defineProperty(t,"shimGetDisplayMedia",{enumerable:!0,get:function(){return r.shimGetDisplayMedia}}),t.shimMediaStream=c,t.shimOnTrack=l,t.shimGetSendersWithDtmf=I,t.shimGetStats=C,t.shimSenderReceiverGetStats=d,t.shimAddTrackRemoveTrackWithNative=h,t.shimAddTrackRemoveTrack=B,t.shimPeerConnection=u,t.fixNegotiationNeeded=E;var o=s(A("../utils.js"));function s(A){if(A&&A.__esModule)return A;var e={};if(null!=A)for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t]);return e.default=A,e}function g(A,e,t){return e in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function c(A){A.MediaStream=A.MediaStream||A.webkitMediaStream}function l(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection&&!("ontrack"in A.RTCPeerConnection.prototype)){Object.defineProperty(A.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(A){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=A)},enumerable:!0,configurable:!0});var e=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){var t=this;return this._ontrackpoly||(this._ontrackpoly=function(e){e.stream.addEventListener("addtrack",(function(i){var n=void 0;n=A.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(A){return A.track&&A.track.id===i.track.id})):{track:i.track};var a=new Event("track");a.track=i.track,a.receiver=n,a.transceiver={receiver:n},a.streams=[e.stream],t.dispatchEvent(a)})),e.stream.getTracks().forEach((function(i){var n=void 0;n=A.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(A){return A.track&&A.track.id===i.id})):{track:i};var a=new Event("track");a.track=i,a.receiver=n,a.transceiver={receiver:n},a.streams=[e.stream],t.dispatchEvent(a)}))},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else o.wrapPeerConnectionEvent(A,"track",(function(A){return A.transceiver||Object.defineProperty(A,"transceiver",{value:{receiver:A.receiver}}),A}))}function I(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection&&!("getSenders"in A.RTCPeerConnection.prototype)&&"createDTMFSender"in A.RTCPeerConnection.prototype){var e=function(A,e){return{track:e,get dtmf(){return void 0===this._dtmf&&("audio"===e.kind?this._dtmf=A.createDTMFSender(e):this._dtmf=null),this._dtmf},_pc:A}};if(!A.RTCPeerConnection.prototype.getSenders){A.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var t=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addTrack=function(A,i){var n=t.apply(this,arguments);return n||(n=e(this,A),this._senders.push(n)),n};var n=A.RTCPeerConnection.prototype.removeTrack;A.RTCPeerConnection.prototype.removeTrack=function(A){n.apply(this,arguments);var e=this._senders.indexOf(A);-1!==e&&this._senders.splice(e,1)}}var a=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(A){var t=this;this._senders=this._senders||[],a.apply(this,[A]),A.getTracks().forEach((function(A){t._senders.push(e(t,A))}))};var r=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(A){var e=this;this._senders=this._senders||[],r.apply(this,[A]),A.getTracks().forEach((function(A){var t=e._senders.find((function(e){return e.track===A}));t&&e._senders.splice(e._senders.indexOf(t),1)}))}}else if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection&&"getSenders"in A.RTCPeerConnection.prototype&&"createDTMFSender"in A.RTCPeerConnection.prototype&&A.RTCRtpSender&&!("dtmf"in A.RTCRtpSender.prototype)){var o=A.RTCPeerConnection.prototype.getSenders;A.RTCPeerConnection.prototype.getSenders=function(){var A=this,e=o.apply(this,[]);return e.forEach((function(e){return e._pc=A})),e},Object.defineProperty(A.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function C(A){if(A.RTCPeerConnection){var e=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){var A=this,t=Array.prototype.slice.call(arguments),i=t[0],n=t[1],a=t[2];if(arguments.length>0&&"function"==typeof i)return e.apply(this,arguments);if(0===e.length&&(0===arguments.length||"function"!=typeof i))return e.apply(this,[]);var r=function(A){var e={};return A.result().forEach((function(A){var t={id:A.id,timestamp:A.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[A.type]||A.type};A.names().forEach((function(e){t[e]=A.stat(e)})),e[t.id]=t})),e},o=function(A){return new Map(Object.keys(A).map((function(e){return[e,A[e]]})))};if(arguments.length>=2){var s=function(A){n(o(r(A)))};return e.apply(this,[s,i])}return new Promise((function(t,i){e.apply(A,[function(A){t(o(r(A)))},i])})).then(n,a)}}}function d(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection&&A.RTCRtpSender&&A.RTCRtpReceiver){if(!("getStats"in A.RTCRtpSender.prototype)){var e=A.RTCPeerConnection.prototype.getSenders;e&&(A.RTCPeerConnection.prototype.getSenders=function(){var A=this,t=e.apply(this,[]);return t.forEach((function(e){return e._pc=A})),t});var t=A.RTCPeerConnection.prototype.addTrack;t&&(A.RTCPeerConnection.prototype.addTrack=function(){var A=t.apply(this,arguments);return A._pc=this,A}),A.RTCRtpSender.prototype.getStats=function(){var A=this;return this._pc.getStats().then((function(e){return o.filterStats(e,A.track,!0)}))}}if(!("getStats"in A.RTCRtpReceiver.prototype)){var n=A.RTCPeerConnection.prototype.getReceivers;n&&(A.RTCPeerConnection.prototype.getReceivers=function(){var A=this,e=n.apply(this,[]);return e.forEach((function(e){return e._pc=A})),e}),o.wrapPeerConnectionEvent(A,"track",(function(A){return A.receiver._pc=A.srcElement,A})),A.RTCRtpReceiver.prototype.getStats=function(){var A=this;return this._pc.getStats().then((function(e){return o.filterStats(e,A.track,!1)}))}}if("getStats"in A.RTCRtpSender.prototype&&"getStats"in A.RTCRtpReceiver.prototype){var a=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof A.MediaStreamTrack){var e=arguments[0],t=void 0,i=void 0,n=void 0;return this.getSenders().forEach((function(A){A.track===e&&(t?n=!0:t=A)})),this.getReceivers().forEach((function(A){return A.track===e&&(i?n=!0:i=A),A.track===e})),n||t&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return a.apply(this,arguments)}}}}function h(A){A.RTCPeerConnection.prototype.getLocalStreams=function(){var A=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(e){return A._shimmedLocalStreams[e][0]}))};var e=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addTrack=function(A,t){if(!t)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=e.apply(this,arguments);return this._shimmedLocalStreams[t.id]?-1===this._shimmedLocalStreams[t.id].indexOf(i)&&this._shimmedLocalStreams[t.id].push(i):this._shimmedLocalStreams[t.id]=[t,i],i};var t=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(A){var e=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},A.getTracks().forEach((function(A){var t=e.getSenders().find((function(e){return e.track===A}));if(t)throw new DOMException("Track already exists.","InvalidAccessError")}));var i=this.getSenders();t.apply(this,arguments);var n=this.getSenders().filter((function(A){return-1===i.indexOf(A)}));this._shimmedLocalStreams[A.id]=[A].concat(n)};var i=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(A){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[A.id],i.apply(this,arguments)};var n=A.RTCPeerConnection.prototype.removeTrack;A.RTCPeerConnection.prototype.removeTrack=function(A){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},A&&Object.keys(this._shimmedLocalStreams).forEach((function(t){var i=e._shimmedLocalStreams[t].indexOf(A);-1!==i&&e._shimmedLocalStreams[t].splice(i,1),1===e._shimmedLocalStreams[t].length&&delete e._shimmedLocalStreams[t]})),n.apply(this,arguments)}}function B(A){if(A.RTCPeerConnection){var e=o.detectBrowser(A);if(A.RTCPeerConnection.prototype.addTrack&&e.version>=65)return h(A);var t=A.RTCPeerConnection.prototype.getLocalStreams;A.RTCPeerConnection.prototype.getLocalStreams=function(){var A=this,e=t.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((function(e){return A._reverseStreams[e.id]}))};var i=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(e){var t=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},e.getTracks().forEach((function(A){var e=t.getSenders().find((function(e){return e.track===A}));if(e)throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[e.id]){var n=new A.MediaStream(e.getTracks());this._streams[e.id]=n,this._reverseStreams[n.id]=e,e=n}i.apply(this,[e])};var n=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(A){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[A.id]||A]),delete this._reverseStreams[this._streams[A.id]?this._streams[A.id].id:A.id],delete this._streams[A.id]},A.RTCPeerConnection.prototype.addTrack=function(e,t){var i=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((function(A){return A===e})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var a=this.getSenders().find((function(A){return A.track===e}));if(a)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var r=this._streams[t.id];if(r)r.addTrack(e),Promise.resolve().then((function(){i.dispatchEvent(new Event("negotiationneeded"))}));else{var o=new A.MediaStream([e]);this._streams[t.id]=o,this._reverseStreams[o.id]=t,this.addStream(o)}return this.getSenders().find((function(A){return A.track===e}))},["createOffer","createAnswer"].forEach((function(e){var t=A.RTCPeerConnection.prototype[e],i=g({},e,(function(){var A=this,e=arguments;return arguments.length&&"function"==typeof arguments[0]?t.apply(this,[function(t){var i=s(A,t);e[0].apply(null,[i])},function(A){e[1]&&e[1].apply(null,A)},arguments[2]]):t.apply(this,arguments).then((function(e){return s(A,e)}))}));A.RTCPeerConnection.prototype[e]=i[e]}));var a=A.RTCPeerConnection.prototype.setLocalDescription;A.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};var r=Object.getOwnPropertyDescriptor(A.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(A.RTCPeerConnection.prototype,"localDescription",{get:function(){var A=r.get.apply(this);return""===A.type?A:s(this,A)}}),A.RTCPeerConnection.prototype.removeTrack=function(A){var e=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!A._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(A._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var t=void 0;Object.keys(this._streams).forEach((function(i){e._streams[i].getTracks().find((function(e){return A.track===e}))&&(t=e._streams[i])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(A.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(A,e){var t=e.sdp;return Object.keys(A._reverseStreams||[]).forEach((function(e){var i=A._reverseStreams[e],n=A._streams[i.id];t=t.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:e.type,sdp:t})}function c(A,e){var t=e.sdp;return Object.keys(A._reverseStreams||[]).forEach((function(e){var i=A._reverseStreams[e],n=A._streams[i.id];t=t.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:e.type,sdp:t})}}function u(A){var e=o.detectBrowser(A);if(!A.RTCPeerConnection&&A.webkitRTCPeerConnection&&(A.RTCPeerConnection=A.webkitRTCPeerConnection),A.RTCPeerConnection){e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){var t=A.RTCPeerConnection.prototype[e],i=g({},e,(function(){return arguments[0]=new("addIceCandidate"===e?A.RTCIceCandidate:A.RTCSessionDescription)(arguments[0]),t.apply(this,arguments)}));A.RTCPeerConnection.prototype[e]=i[e]}));var t=A.RTCPeerConnection.prototype.addIceCandidate;A.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?e.version<78&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}}function E(A){o.wrapPeerConnectionEvent(A,"negotiationneeded",(function(A){if("stable"===A.target.signalingState)return A}))}},{"../utils.js":15,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(A,e,t){function i(A,e){A.navigator.mediaDevices&&"getDisplayMedia"in A.navigator.mediaDevices||A.navigator.mediaDevices&&("function"==typeof e?A.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then((function(e){var i=t.video&&t.video.width,n=t.video&&t.video.height,a=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:a||3}},i&&(t.video.mandatory.maxWidth=i),n&&(t.video.mandatory.maxHeight=n),A.navigator.mediaDevices.getUserMedia(t)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}Object.defineProperty(t,"__esModule",{value:!0}),t.shimGetDisplayMedia=i},{}],5:[function(A,e,t){Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(A){return n(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":n(A)};t.shimGetUserMedia=s;var a=r(A("../utils.js"));function r(A){if(A&&A.__esModule)return A;var e={};if(null!=A)for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t]);return e.default=A,e}var o=a.log;function s(A){var e=A&&A.navigator;if(e.mediaDevices){var t=a.detectBrowser(A),n=function(A){if("object"!==(void 0===A?"undefined":i(A))||A.mandatory||A.optional)return A;var e={};return Object.keys(A).forEach((function(t){if("require"!==t&&"advanced"!==t&&"mediaSource"!==t){var n="object"===i(A[t])?A[t]:{ideal:A[t]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var a=function(A,e){return A?A+e.charAt(0).toUpperCase()+e.slice(1):"deviceId"===e?"sourceId":e};if(void 0!==n.ideal){e.optional=e.optional||[];var r={};"number"==typeof n.ideal?(r[a("min",t)]=n.ideal,e.optional.push(r),(r={})[a("max",t)]=n.ideal,e.optional.push(r)):(r[a("",t)]=n.ideal,e.optional.push(r))}void 0!==n.exact&&"number"!=typeof n.exact?(e.mandatory=e.mandatory||{},e.mandatory[a("",t)]=n.exact):["min","max"].forEach((function(A){void 0!==n[A]&&(e.mandatory=e.mandatory||{},e.mandatory[a(A,t)]=n[A])}))}})),A.advanced&&(e.optional=(e.optional||[]).concat(A.advanced)),e},r=function(A,a){if(t.version>=61)return a(A);if((A=JSON.parse(JSON.stringify(A)))&&"object"===i(A.audio)){var r=function(A,e,t){e in A&&!(t in A)&&(A[t]=A[e],delete A[e])};r((A=JSON.parse(JSON.stringify(A))).audio,"autoGainControl","googAutoGainControl"),r(A.audio,"noiseSuppression","googNoiseSuppression"),A.audio=n(A.audio)}if(A&&"object"===i(A.video)){var s=A.video.facingMode;s=s&&("object"===(void 0===s?"undefined":i(s))?s:{ideal:s});var g=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!e.mediaDevices.getSupportedConstraints||!e.mediaDevices.getSupportedConstraints().facingMode||g)){delete A.video.facingMode;var c=void 0;if("environment"===s.exact||"environment"===s.ideal?c=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(c=["front"]),c)return e.mediaDevices.enumerateDevices().then((function(e){e=e.filter((function(A){return"videoinput"===A.kind}));var t=e.find((function(A){return c.some((function(e){return A.label.toLowerCase().includes(e)}))}));return!t&&e.length&&c.includes("back")&&(t=e[e.length-1]),t&&(A.video.deviceId=s.exact?{exact:t.deviceId}:{ideal:t.deviceId}),A.video=n(A.video),o("chrome: "+JSON.stringify(A)),a(A)}))}A.video=n(A.video)}return o("chrome: "+JSON.stringify(A)),a(A)},s=function(A){return t.version>=64?A:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[A.name]||A.name,message:A.message,constraint:A.constraint||A.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},g=function(A,t,i){r(A,(function(A){e.webkitGetUserMedia(A,t,(function(A){i&&i(s(A))}))}))};if(e.getUserMedia=g.bind(e),e.mediaDevices.getUserMedia){var c=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(A){return r(A,(function(A){return c(A).then((function(e){if(A.audio&&!e.getAudioTracks().length||A.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((function(A){A.stop()})),new DOMException("","NotFoundError");return e}),(function(A){return Promise.reject(s(A))}))}))}}}}},{"../utils.js":15}],6:[function(A,e,t){Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(A){return n(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":n(A)};t.shimRTCIceCandidate=g,t.shimMaxMessageSize=c,t.shimSendThrowTypeError=l,t.shimConnectionState=I,t.removeAllowExtmapMixed=C;var a=s(A("sdp")),r=o(A("./utils"));function o(A){if(A&&A.__esModule)return A;var e={};if(null!=A)for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t]);return e.default=A,e}function s(A){return A&&A.__esModule?A:{default:A}}function g(A){if(!(!A.RTCIceCandidate||A.RTCIceCandidate&&"foundation"in A.RTCIceCandidate.prototype)){var e=A.RTCIceCandidate;A.RTCIceCandidate=function(A){if("object"===(void 0===A?"undefined":i(A))&&A.candidate&&0===A.candidate.indexOf("a=")&&((A=JSON.parse(JSON.stringify(A))).candidate=A.candidate.substr(2)),A.candidate&&A.candidate.length){var t=new e(A),n=a.default.parseCandidate(A.candidate),r=Object.assign(t,n);return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new e(A)},A.RTCIceCandidate.prototype=e.prototype,r.wrapPeerConnectionEvent(A,"icecandidate",(function(e){return e.candidate&&Object.defineProperty(e,"candidate",{value:new A.RTCIceCandidate(e.candidate),writable:"false"}),e}))}}function c(A){if(A.RTCPeerConnection){var e=r.detectBrowser(A);"sctp"in A.RTCPeerConnection.prototype||Object.defineProperty(A.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var t=function(A){if(!A||!A.sdp)return!1;var e=a.default.splitSections(A.sdp);return e.shift(),e.some((function(A){var e=a.default.parseMLine(A);return e&&"application"===e.kind&&-1!==e.protocol.indexOf("SCTP")}))},i=function(A){var e=A.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===e||e.length<2)return-1;var t=parseInt(e[1],10);return t!=t?-1:t},n=function(A){var t=65536;return"firefox"===e.browser&&(t=e.version<57?-1===A?16384:2147483637:e.version<60?57===e.version?65535:65536:2147483637),t},o=function(A,t){var i=65536;"firefox"===e.browser&&57===e.version&&(i=65535);var n=a.default.matchPrefix(A.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===e.browser&&-1!==t&&(i=2147483637),i},s=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===e.browser&&e.version>=76&&"plan-b"===this.getConfiguration().sdpSemantics&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0}),t(arguments[0])){var A=i(arguments[0]),a=n(A),r=o(arguments[0],A),g=void 0;g=0===a&&0===r?Number.POSITIVE_INFINITY:0===a||0===r?Math.max(a,r):Math.min(a,r);var c={};Object.defineProperty(c,"maxMessageSize",{get:function(){return g}}),this._sctp=c}return s.apply(this,arguments)}}}function l(A){if(A.RTCPeerConnection&&"createDataChannel"in A.RTCPeerConnection.prototype){var e=A.RTCPeerConnection.prototype.createDataChannel;A.RTCPeerConnection.prototype.createDataChannel=function(){var A=e.apply(this,arguments);return t(A,this),A},r.wrapPeerConnectionEvent(A,"datachannel",(function(A){return t(A.channel,A.target),A}))}function t(A,e){var t=A.send;A.send=function(){var i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===A.readyState&&e.sctp&&n>e.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+e.sctp.maxMessageSize+" bytes)");return t.apply(A,arguments)}}}function I(A){if(A.RTCPeerConnection&&!("connectionState"in A.RTCPeerConnection.prototype)){var e=A.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(A){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),A&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=A)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(A){var t=e[A];e[A]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(A){var e=A.target;if(e._lastConnectionState!==e.connectionState){e._lastConnectionState=e.connectionState;var t=new Event("connectionstatechange",A);e.dispatchEvent(t)}return A},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),t.apply(this,arguments)}}))}}function C(A){if(A.RTCPeerConnection){var e=r.detectBrowser(A);if(!("chrome"===e.browser&&e.version>=71)){var t=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(A){return A&&A.sdp&&-1!==A.sdp.indexOf("\na=extmap-allow-mixed")&&(A.sdp=A.sdp.split("\n").filter((function(A){return"a=extmap-allow-mixed"!==A.trim()})).join("\n")),t.apply(this,arguments)}}}}},{"./utils":15,sdp:17}],7:[function(A,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.shimGetDisplayMedia=t.shimGetUserMedia=void 0;var i=A("./getusermedia");Object.defineProperty(t,"shimGetUserMedia",{enumerable:!0,get:function(){return i.shimGetUserMedia}});var n=A("./getdisplaymedia");Object.defineProperty(t,"shimGetDisplayMedia",{enumerable:!0,get:function(){return n.shimGetDisplayMedia}}),t.shimPeerConnection=c,t.shimReplaceTrack=l;var a=g(A("../utils")),r=A("./filtericeservers"),o=s(A("rtcpeerconnection-shim"));function s(A){return A&&A.__esModule?A:{default:A}}function g(A){if(A&&A.__esModule)return A;var e={};if(null!=A)for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t]);return e.default=A,e}function c(A){var e=a.detectBrowser(A);if(A.RTCIceGatherer&&(A.RTCIceCandidate||(A.RTCIceCandidate=function(A){return A}),A.RTCSessionDescription||(A.RTCSessionDescription=function(A){return A}),e.version<15025)){var t=Object.getOwnPropertyDescriptor(A.MediaStreamTrack.prototype,"enabled");Object.defineProperty(A.MediaStreamTrack.prototype,"enabled",{set:function(A){t.set.call(this,A);var e=new Event("enabled");e.enabled=A,this.dispatchEvent(e)}})}A.RTCRtpSender&&!("dtmf"in A.RTCRtpSender.prototype)&&Object.defineProperty(A.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new A.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),A.RTCDtmfSender&&!A.RTCDTMFSender&&(A.RTCDTMFSender=A.RTCDtmfSender);var i=(0,o.default)(A,e.version);A.RTCPeerConnection=function(A){return A&&A.iceServers&&(A.iceServers=(0,r.filterIceServers)(A.iceServers,e.version),a.log("ICE servers after filtering:",A.iceServers)),new i(A)},A.RTCPeerConnection.prototype=i.prototype}function l(A){A.RTCRtpSender&&!("replaceTrack"in A.RTCRtpSender.prototype)&&(A.RTCRtpSender.prototype.replaceTrack=A.RTCRtpSender.prototype.setTrack)}},{"../utils":15,"./filtericeservers":8,"./getdisplaymedia":9,"./getusermedia":10,"rtcpeerconnection-shim":16}],8:[function(A,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.filterIceServers=a;var i=n(A("../utils"));function n(A){if(A&&A.__esModule)return A;var e={};if(null!=A)for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t]);return e.default=A,e}function a(A,e){var t=!1;return(A=JSON.parse(JSON.stringify(A))).filter((function(A){if(A&&(A.urls||A.url)){var e=A.urls||A.url;A.url&&!A.urls&&i.deprecated("RTCIceServer.url","RTCIceServer.urls");var n="string"==typeof e;return n&&(e=[e]),e=e.filter((function(A){if(0===A.indexOf("stun:"))return!1;var e=A.startsWith("turn")&&!A.startsWith("turn:[")&&A.includes("transport=udp");return e&&!t?(t=!0,!0):e&&!t})),delete A.url,A.urls=n?e[0]:e,!!e.length}}))}},{"../utils":15}],9:[function(A,e,t){function i(A){"getDisplayMedia"in A.navigator&&A.navigator.mediaDevices&&(A.navigator.mediaDevices&&"getDisplayMedia"in A.navigator.mediaDevices||(A.navigator.mediaDevices.getDisplayMedia=A.navigator.getDisplayMedia.bind(A.navigator)))}Object.defineProperty(t,"__esModule",{value:!0}),t.shimGetDisplayMedia=i},{}],10:[function(A,e,t){function i(A){var e=A&&A.navigator,t=function(A){return{name:{PermissionDeniedError:"NotAllowedError"}[A.name]||A.name,message:A.message,constraint:A.constraint,toString:function(){return this.name}}},i=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(A){return i(A).catch((function(A){return Promise.reject(t(A))}))}}Object.defineProperty(t,"__esModule",{value:!0}),t.shimGetUserMedia=i},{}],11:[function(A,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.shimGetDisplayMedia=t.shimGetUserMedia=void 0;var i="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(A){return n(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":n(A)},a=A("./getusermedia");Object.defineProperty(t,"shimGetUserMedia",{enumerable:!0,get:function(){return a.shimGetUserMedia}});var r=A("./getdisplaymedia");Object.defineProperty(t,"shimGetDisplayMedia",{enumerable:!0,get:function(){return r.shimGetDisplayMedia}}),t.shimOnTrack=c,t.shimPeerConnection=l,t.shimSenderGetStats=I,t.shimReceiverGetStats=C,t.shimRemoveStream=d,t.shimRTCDataChannel=h,t.shimAddTransceiver=B,t.shimCreateOffer=u,t.shimCreateAnswer=E;var o=s(A("../utils"));function s(A){if(A&&A.__esModule)return A;var e={};if(null!=A)for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t]);return e.default=A,e}function g(A,e,t){return e in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function c(A){"object"===(void 0===A?"undefined":i(A))&&A.RTCTrackEvent&&"receiver"in A.RTCTrackEvent.prototype&&!("transceiver"in A.RTCTrackEvent.prototype)&&Object.defineProperty(A.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function l(A){var e=o.detectBrowser(A);if("object"===(void 0===A?"undefined":i(A))&&(A.RTCPeerConnection||A.mozRTCPeerConnection)){if(!A.RTCPeerConnection&&A.mozRTCPeerConnection&&(A.RTCPeerConnection=A.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){var t=A.RTCPeerConnection.prototype[e],i=g({},e,(function(){return arguments[0]=new("addIceCandidate"===e?A.RTCIceCandidate:A.RTCSessionDescription)(arguments[0]),t.apply(this,arguments)}));A.RTCPeerConnection.prototype[e]=i[e]})),e.version<68){var t=A.RTCPeerConnection.prototype.addIceCandidate;A.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?arguments[0]&&""===arguments[0].candidate?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}var n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},a=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){var A=Array.prototype.slice.call(arguments),t=A[0],i=A[1],r=A[2];return a.apply(this,[t||null]).then((function(A){if(e.version<53&&!i)try{A.forEach((function(A){A.type=n[A.type]||A.type}))}catch(e){if("TypeError"!==e.name)throw e;A.forEach((function(e,t){A.set(t,Object.assign({},e,{type:n[e.type]||e.type}))}))}return A})).then(i,r)}}}function I(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection&&A.RTCRtpSender&&(!A.RTCRtpSender||!("getStats"in A.RTCRtpSender.prototype))){var e=A.RTCPeerConnection.prototype.getSenders;e&&(A.RTCPeerConnection.prototype.getSenders=function(){var A=this,t=e.apply(this,[]);return t.forEach((function(e){return e._pc=A})),t});var t=A.RTCPeerConnection.prototype.addTrack;t&&(A.RTCPeerConnection.prototype.addTrack=function(){var A=t.apply(this,arguments);return A._pc=this,A}),A.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function C(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection&&A.RTCRtpSender&&(!A.RTCRtpSender||!("getStats"in A.RTCRtpReceiver.prototype))){var e=A.RTCPeerConnection.prototype.getReceivers;e&&(A.RTCPeerConnection.prototype.getReceivers=function(){var A=this,t=e.apply(this,[]);return t.forEach((function(e){return e._pc=A})),t}),o.wrapPeerConnectionEvent(A,"track",(function(A){return A.receiver._pc=A.srcElement,A})),A.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function d(A){A.RTCPeerConnection&&!("removeStream"in A.RTCPeerConnection.prototype)&&(A.RTCPeerConnection.prototype.removeStream=function(A){var e=this;o.deprecated("removeStream","removeTrack"),this.getSenders().forEach((function(t){t.track&&A.getTracks().includes(t.track)&&e.removeTrack(t)}))})}function h(A){A.DataChannel&&!A.RTCDataChannel&&(A.RTCDataChannel=A.DataChannel)}function B(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection){var e=A.RTCPeerConnection.prototype.addTransceiver;e&&(A.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var A=arguments[1],t=A&&"sendEncodings"in A;t&&A.sendEncodings.forEach((function(A){if("rid"in A&&!/^[a-z0-9]{0,16}$/i.test(A.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in A&&!(parseFloat(A.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in A&&!(parseFloat(A.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var i=e.apply(this,arguments);if(t){var n=i.sender,a=n.getParameters();"encodings"in a||(a.encodings=A.sendEncodings,this.setParametersPromises.push(n.setParameters(a).catch((function(){}))))}return i})}}function u(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection){var e=A.RTCPeerConnection.prototype.createOffer;A.RTCPeerConnection.prototype.createOffer=function(){var A=this,t=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return e.apply(A,t)})).finally((function(){A.setParametersPromises=[]})):e.apply(this,arguments)}}}function E(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection){var e=A.RTCPeerConnection.prototype.createAnswer;A.RTCPeerConnection.prototype.createAnswer=function(){var A=this,t=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return e.apply(A,t)})).finally((function(){A.setParametersPromises=[]})):e.apply(this,arguments)}}}},{"../utils":15,"./getdisplaymedia":12,"./getusermedia":13}],12:[function(A,e,t){function i(A,e){A.navigator.mediaDevices&&"getDisplayMedia"in A.navigator.mediaDevices||A.navigator.mediaDevices&&(A.navigator.mediaDevices.getDisplayMedia=function(t){if(!t||!t.video){var i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return!0===t.video?t.video={mediaSource:e}:t.video.mediaSource=e,A.navigator.mediaDevices.getUserMedia(t)})}Object.defineProperty(t,"__esModule",{value:!0}),t.shimGetDisplayMedia=i},{}],13:[function(A,e,t){Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(A){return n(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":n(A)};t.shimGetUserMedia=o;var a=r(A("../utils"));function r(A){if(A&&A.__esModule)return A;var e={};if(null!=A)for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t]);return e.default=A,e}function o(A){var e=a.detectBrowser(A),t=A&&A.navigator,n=A&&A.MediaStreamTrack;if(t.getUserMedia=function(A,e,i){a.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),t.mediaDevices.getUserMedia(A).then(e,i)},!(e.version>55&&"autoGainControl"in t.mediaDevices.getSupportedConstraints())){var r=function(A,e,t){e in A&&!(t in A)&&(A[t]=A[e],delete A[e])},o=t.mediaDevices.getUserMedia.bind(t.mediaDevices);if(t.mediaDevices.getUserMedia=function(A){return"object"===(void 0===A?"undefined":i(A))&&"object"===i(A.audio)&&(A=JSON.parse(JSON.stringify(A)),r(A.audio,"autoGainControl","mozAutoGainControl"),r(A.audio,"noiseSuppression","mozNoiseSuppression")),o(A)},n&&n.prototype.getSettings){var s=n.prototype.getSettings;n.prototype.getSettings=function(){var A=s.apply(this,arguments);return r(A,"mozAutoGainControl","autoGainControl"),r(A,"mozNoiseSuppression","noiseSuppression"),A}}if(n&&n.prototype.applyConstraints){var g=n.prototype.applyConstraints;n.prototype.applyConstraints=function(A){return"audio"===this.kind&&"object"===(void 0===A?"undefined":i(A))&&(A=JSON.parse(JSON.stringify(A)),r(A,"autoGainControl","mozAutoGainControl"),r(A,"noiseSuppression","mozNoiseSuppression")),g.apply(this,[A])}}}}},{"../utils":15}],14:[function(A,e,t){Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(A){return n(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":n(A)};t.shimLocalStreamsAPI=o,t.shimRemoteStreamsAPI=s,t.shimCallbacksAPI=g,t.shimGetUserMedia=c,t.shimConstraints=l,t.shimRTCIceServerUrls=I,t.shimTrackEventTransceiver=C,t.shimCreateOfferLegacy=d;var a=r(A("../utils"));function r(A){if(A&&A.__esModule)return A;var e={};if(null!=A)for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t]);return e.default=A,e}function o(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection){if("getLocalStreams"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in A.RTCPeerConnection.prototype)){var e=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addStream=function(A){var t=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(A)||this._localStreams.push(A),A.getAudioTracks().forEach((function(i){return e.call(t,i,A)})),A.getVideoTracks().forEach((function(i){return e.call(t,i,A)}))},A.RTCPeerConnection.prototype.addTrack=function(A){var t=arguments[1];return t&&(this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]),e.apply(this,arguments)}}"removeStream"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.removeStream=function(A){var e=this;this._localStreams||(this._localStreams=[]);var t=this._localStreams.indexOf(A);if(-1!==t){this._localStreams.splice(t,1);var i=A.getTracks();this.getSenders().forEach((function(A){i.includes(A.track)&&e.removeTrack(A)}))}})}}function s(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection&&("getRemoteStreams"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in A.RTCPeerConnection.prototype))){Object.defineProperty(A.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(A){var e=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=A),this.addEventListener("track",this._onaddstreampoly=function(A){A.streams.forEach((function(A){if(e._remoteStreams||(e._remoteStreams=[]),!e._remoteStreams.includes(A)){e._remoteStreams.push(A);var t=new Event("addstream");t.stream=A,e.dispatchEvent(t)}}))})}});var e=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){var A=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(A._remoteStreams||(A._remoteStreams=[]),!(A._remoteStreams.indexOf(e)>=0)){A._remoteStreams.push(e);var t=new Event("addstream");t.stream=e,A.dispatchEvent(t)}}))}),e.apply(A,arguments)}}}function g(A){if("object"===(void 0===A?"undefined":i(A))&&A.RTCPeerConnection){var e=A.RTCPeerConnection.prototype,t=e.createOffer,n=e.createAnswer,a=e.setLocalDescription,r=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(A,e){var i=arguments.length>=2?arguments[2]:arguments[0],n=t.apply(this,[i]);return e?(n.then(A,e),Promise.resolve()):n},e.createAnswer=function(A,e){var t=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[t]);return e?(i.then(A,e),Promise.resolve()):i};var s=function(A,e,t){var i=a.apply(this,[A]);return t?(i.then(e,t),Promise.resolve()):i};e.setLocalDescription=s,s=function(A,e,t){var i=r.apply(this,[A]);return t?(i.then(e,t),Promise.resolve()):i},e.setRemoteDescription=s,s=function(A,e,t){var i=o.apply(this,[A]);return t?(i.then(e,t),Promise.resolve()):i},e.addIceCandidate=s}}function c(A){var e=A&&A.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){var t=e.mediaDevices,i=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=function(A){return i(l(A))}}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(A,t,i){e.mediaDevices.getUserMedia(A).then(t,i)}.bind(e))}function l(A){return A&&void 0!==A.video?Object.assign({},A,{video:a.compactObject(A.video)}):A}function I(A){var e=A.RTCPeerConnection;A.RTCPeerConnection=function(A,t){if(A&&A.iceServers){for(var i=[],n=0;n=t&&parseInt(i[t],10)}function g(A,e,t){if(A.RTCPeerConnection){var i=A.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(A,i){if(A!==e)return n.apply(this,arguments);var a=function(A){var e=t(A);e&&i(e)};return this._eventMap=this._eventMap||{},this._eventMap[i]=a,n.apply(this,[A,a])};var a=i.removeEventListener;i.removeEventListener=function(A,t){if(A!==e||!this._eventMap||!this._eventMap[t])return a.apply(this,arguments);var i=this._eventMap[t];return delete this._eventMap[t],a.apply(this,[A,i])},Object.defineProperty(i,"on"+e,{get:function(){return this["_on"+e]},set:function(A){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),A&&this.addEventListener(e,this["_on"+e]=A)},enumerable:!0,configurable:!0})}}function c(A){return"boolean"!=typeof A?new Error("Argument type: "+(void 0===A?"undefined":i(A))+". Please use a boolean."):(r=A,A?"adapter.js logging disabled":"adapter.js logging enabled")}function l(A){return"boolean"!=typeof A?new Error("Argument type: "+(void 0===A?"undefined":i(A))+". Please use a boolean."):(o=!A,"adapter.js deprecation warnings "+(A?"disabled":"enabled"))}function I(){if("object"===("undefined"==typeof window?"undefined":i(window))){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function C(A,e){o&&console.warn(A+" is deprecated, please use "+e+" instead.")}function d(A){var e=A.navigator,t={browser:null,version:null};if(void 0===A||!A.navigator)return t.browser="Not a browser.",t;if(e.mozGetUserMedia)t.browser="firefox",t.version=s(e.userAgent,/Firefox\/(\d+)\./,1);else if(e.webkitGetUserMedia||!1===A.isSecureContext&&A.webkitRTCPeerConnection&&!A.RTCIceGatherer)t.browser="chrome",t.version=s(e.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(e.mediaDevices&&e.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=s(e.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!A.RTCPeerConnection||!e.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=s(e.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=A.RTCRtpTransceiver&&"currentDirection"in A.RTCRtpTransceiver.prototype}return t}function h(A){return"[object Object]"===Object.prototype.toString.call(A)}function B(A){return h(A)?Object.keys(A).reduce((function(e,t){var i=h(A[t]),n=i?B(A[t]):A[t],r=i&&!Object.keys(n).length;return void 0===n||r?e:Object.assign(e,a({},t,n))}),{}):A}function u(A,e,t){e&&!t.has(e.id)&&(t.set(e.id,e),Object.keys(e).forEach((function(i){i.endsWith("Id")?u(A,A.get(e[i]),t):i.endsWith("Ids")&&e[i].forEach((function(e){u(A,A.get(e),t)}))})))}function E(A,e,t){var i=t?"outbound-rtp":"inbound-rtp",n=new Map;if(null===e)return n;var a=[];return A.forEach((function(A){"track"===A.type&&A.trackIdentifier===e.id&&a.push(A)})),a.forEach((function(e){A.forEach((function(t){t.type===i&&t.trackId===e.id&&u(A,t,n)}))})),n}},{}],16:[function(A,e,t){var i=A("sdp");function n(A){return{inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[A.type]||A.type}function a(A,e,t,n,a){var r=i.writeRtpDescription(A.kind,e);if(r+=i.writeIceParameters(A.iceGatherer.getLocalParameters()),r+=i.writeDtlsParameters(A.dtlsTransport.getLocalParameters(),"offer"===t?"actpass":a||"active"),r+="a=mid:"+A.mid+"\r\n",A.rtpSender&&A.rtpReceiver?r+="a=sendrecv\r\n":A.rtpSender?r+="a=sendonly\r\n":A.rtpReceiver?r+="a=recvonly\r\n":r+="a=inactive\r\n",A.rtpSender){var o=A.rtpSender._initialTrackId||A.rtpSender.track.id;A.rtpSender._initialTrackId=o;var s="msid:"+(n?n.id:"-")+" "+o+"\r\n";r+="a="+s,r+="a=ssrc:"+A.sendEncodingParameters[0].ssrc+" "+s,A.sendEncodingParameters[0].rtx&&(r+="a=ssrc:"+A.sendEncodingParameters[0].rtx.ssrc+" "+s,r+="a=ssrc-group:FID "+A.sendEncodingParameters[0].ssrc+" "+A.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return r+="a=ssrc:"+A.sendEncodingParameters[0].ssrc+" cname:"+i.localCName+"\r\n",A.rtpSender&&A.sendEncodingParameters[0].rtx&&(r+="a=ssrc:"+A.sendEncodingParameters[0].rtx.ssrc+" cname:"+i.localCName+"\r\n"),r}function r(A,e){var t=!1;return(A=JSON.parse(JSON.stringify(A))).filter((function(A){if(A&&(A.urls||A.url)){var i=A.urls||A.url;A.url&&!A.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var n="string"==typeof i;return n&&(i=[i]),i=i.filter((function(A){return 0!==A.indexOf("turn:")||-1===A.indexOf("transport=udp")||-1!==A.indexOf("turn:[")||t?0===A.indexOf("stun:")&&e>=14393&&-1===A.indexOf("?transport=udp"):(t=!0,!0)})),delete A.url,A.urls=n?i[0]:i,!!i.length}}))}function o(A,e){var t={codecs:[],headerExtensions:[],fecMechanisms:[]},i=function(A,e){A=parseInt(A,10);for(var t=0;t0;o--)this._iceGatherers.push(new A.RTCIceGatherer({iceServers:t.iceServers,gatherPolicy:t.iceTransportPolicy}));else t.iceCandidatePoolSize=0;this._config=t,this.transceivers=[],this._sdpSessionId=i.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(C.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(C.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),C.prototype.onicecandidate=null,C.prototype.onaddstream=null,C.prototype.ontrack=null,C.prototype.onremovestream=null,C.prototype.onsignalingstatechange=null,C.prototype.oniceconnectionstatechange=null,C.prototype.onconnectionstatechange=null,C.prototype.onicegatheringstatechange=null,C.prototype.onnegotiationneeded=null,C.prototype.ondatachannel=null,C.prototype._dispatchEvent=function(A,e){this._isClosed||(this.dispatchEvent(e),"function"==typeof this["on"+A]&&this["on"+A](e))},C.prototype._emitGatheringStateChange=function(){var A=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",A)},C.prototype.getConfiguration=function(){return this._config},C.prototype.getLocalStreams=function(){return this.localStreams},C.prototype.getRemoteStreams=function(){return this.remoteStreams},C.prototype._createTransceiver=function(A,e){var t=this.transceivers.length>0,i={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:A,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&t)i.iceTransport=this.transceivers[0].iceTransport,i.dtlsTransport=this.transceivers[0].dtlsTransport;else{var n=this._createIceAndDtlsTransports();i.iceTransport=n.iceTransport,i.dtlsTransport=n.dtlsTransport}return e||this.transceivers.push(i),i},C.prototype.addTrack=function(e,t){if(this._isClosed)throw c("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var i,n=this.transceivers.find((function(A){return A.track===e}));if(n)throw c("InvalidAccessError","Track already exists.");for(var a=0;a=15025)A.getTracks().forEach((function(e){t.addTrack(e,A)}));else{var i=A.clone();A.getTracks().forEach((function(A,e){var t=i.getTracks()[e];A.addEventListener("enabled",(function(A){t.enabled=A.enabled}))})),i.getTracks().forEach((function(A){t.addTrack(A,i)}))}},C.prototype.removeTrack=function(e){if(this._isClosed)throw c("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(e instanceof A.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var t=this.transceivers.find((function(A){return A.rtpSender===e}));if(!t)throw c("InvalidAccessError","Sender was not created by this connection.");var i=t.stream;t.rtpSender.stop(),t.rtpSender=null,t.track=null,t.stream=null;var n=this.transceivers.map((function(A){return A.stream}));-1===n.indexOf(i)&&this.localStreams.indexOf(i)>-1&&this.localStreams.splice(this.localStreams.indexOf(i),1),this._maybeFireNegotiationNeeded()},C.prototype.removeStream=function(A){var e=this;A.getTracks().forEach((function(A){var t=e.getSenders().find((function(e){return e.track===A}));t&&e.removeTrack(t)}))},C.prototype.getSenders=function(){return this.transceivers.filter((function(A){return!!A.rtpSender})).map((function(A){return A.rtpSender}))},C.prototype.getReceivers=function(){return this.transceivers.filter((function(A){return!!A.rtpReceiver})).map((function(A){return A.rtpReceiver}))},C.prototype._createIceGatherer=function(e,t){var i=this;if(t&&e>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var n=new A.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(n,"state",{value:"new",writable:!0}),this.transceivers[e].bufferedCandidateEvents=[],this.transceivers[e].bufferCandidates=function(A){var t=!A.candidate||0===Object.keys(A.candidate).length;n.state=t?"completed":"gathering",null!==i.transceivers[e].bufferedCandidateEvents&&i.transceivers[e].bufferedCandidateEvents.push(A)},n.addEventListener("localcandidate",this.transceivers[e].bufferCandidates),n},C.prototype._gather=function(e,t){var n=this,a=this.transceivers[t].iceGatherer;if(!a.onlocalcandidate){var r=this.transceivers[t].bufferedCandidateEvents;this.transceivers[t].bufferedCandidateEvents=null,a.removeEventListener("localcandidate",this.transceivers[t].bufferCandidates),a.onlocalcandidate=function(A){if(!(n.usingBundle&&t>0)){var r=new Event("icecandidate");r.candidate={sdpMid:e,sdpMLineIndex:t};var o=A.candidate,s=!o||0===Object.keys(o).length;if(s)"new"!==a.state&&"gathering"!==a.state||(a.state="completed");else{"new"===a.state&&(a.state="gathering"),o.component=1,o.ufrag=a.getLocalParameters().usernameFragment;var g=i.writeCandidate(o);r.candidate=Object.assign(r.candidate,i.parseCandidate(g)),r.candidate.candidate=g,r.candidate.toJSON=function(){return{candidate:r.candidate.candidate,sdpMid:r.candidate.sdpMid,sdpMLineIndex:r.candidate.sdpMLineIndex,usernameFragment:r.candidate.usernameFragment}}}var c=i.getMediaSections(n._localDescription.sdp);c[r.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+r.candidate.candidate+"\r\n",n._localDescription.sdp=i.getDescription(n._localDescription.sdp)+c.join("");var l=n.transceivers.every((function(A){return A.iceGatherer&&"completed"===A.iceGatherer.state}));"gathering"!==n.iceGatheringState&&(n.iceGatheringState="gathering",n._emitGatheringStateChange()),s||n._dispatchEvent("icecandidate",r),l&&(n._dispatchEvent("icecandidate",new Event("icecandidate")),n.iceGatheringState="complete",n._emitGatheringStateChange())}},A.setTimeout((function(){r.forEach((function(A){a.onlocalcandidate(A)}))}),0)}},C.prototype._createIceAndDtlsTransports=function(){var e=this,t=new A.RTCIceTransport(null);t.onicestatechange=function(){e._updateIceConnectionState(),e._updateConnectionState()};var i=new A.RTCDtlsTransport(t);return i.ondtlsstatechange=function(){e._updateConnectionState()},i.onerror=function(){Object.defineProperty(i,"state",{value:"failed",writable:!0}),e._updateConnectionState()},{iceTransport:t,dtlsTransport:i}},C.prototype._disposeIceAndDtlsTransports=function(A){var e=this.transceivers[A].iceGatherer;e&&(delete e.onlocalcandidate,delete this.transceivers[A].iceGatherer);var t=this.transceivers[A].iceTransport;t&&(delete t.onicestatechange,delete this.transceivers[A].iceTransport);var i=this.transceivers[A].dtlsTransport;i&&(delete i.ondtlsstatechange,delete i.onerror,delete this.transceivers[A].dtlsTransport)},C.prototype._transceive=function(A,t,n){var a=o(A.localCapabilities,A.remoteCapabilities);t&&A.rtpSender&&(a.encodings=A.sendEncodingParameters,a.rtcp={cname:i.localCName,compound:A.rtcpParameters.compound},A.recvEncodingParameters.length&&(a.rtcp.ssrc=A.recvEncodingParameters[0].ssrc),A.rtpSender.send(a)),n&&A.rtpReceiver&&a.codecs.length>0&&("video"===A.kind&&A.recvEncodingParameters&&e<15019&&A.recvEncodingParameters.forEach((function(A){delete A.rtx})),A.recvEncodingParameters.length?a.encodings=A.recvEncodingParameters:a.encodings=[{}],a.rtcp={compound:A.rtcpParameters.compound},A.rtcpParameters.cname&&(a.rtcp.cname=A.rtcpParameters.cname),A.sendEncodingParameters.length&&(a.rtcp.ssrc=A.sendEncodingParameters[0].ssrc),A.rtpReceiver.receive(a))},C.prototype.setLocalDescription=function(A){var e,t,n=this;if(-1===["offer","answer"].indexOf(A.type))return Promise.reject(c("TypeError",'Unsupported type "'+A.type+'"'));if(!s("setLocalDescription",A.type,n.signalingState)||n._isClosed)return Promise.reject(c("InvalidStateError","Can not set local "+A.type+" in state "+n.signalingState));if("offer"===A.type)e=i.splitSections(A.sdp),t=e.shift(),e.forEach((function(A,e){var t=i.parseRtpParameters(A);n.transceivers[e].localCapabilities=t})),n.transceivers.forEach((function(A,e){n._gather(A.mid,e)}));else if("answer"===A.type){e=i.splitSections(n._remoteDescription.sdp),t=e.shift();var a=i.matchPrefix(t,"a=ice-lite").length>0;e.forEach((function(A,e){var r=n.transceivers[e],s=r.iceGatherer,g=r.iceTransport,c=r.dtlsTransport,l=r.localCapabilities,I=r.remoteCapabilities;if(!(i.isRejected(A)&&0===i.matchPrefix(A,"a=bundle-only").length||r.rejected)){var C=i.getIceParameters(A,t),d=i.getDtlsParameters(A,t);a&&(d.role="server"),n.usingBundle&&0!==e||(n._gather(r.mid,e),"new"===g.state&&g.start(s,C,a?"controlling":"controlled"),"new"===c.state&&c.start(d));var h=o(l,I);n._transceive(r,h.codecs.length>0,!1)}}))}return n._localDescription={type:A.type,sdp:A.sdp},"offer"===A.type?n._updateSignalingState("have-local-offer"):n._updateSignalingState("stable"),Promise.resolve()},C.prototype.setRemoteDescription=function(n){var a=this;if(-1===["offer","answer"].indexOf(n.type))return Promise.reject(c("TypeError",'Unsupported type "'+n.type+'"'));if(!s("setRemoteDescription",n.type,a.signalingState)||a._isClosed)return Promise.reject(c("InvalidStateError","Can not set remote "+n.type+" in state "+a.signalingState));var r={};a.remoteStreams.forEach((function(A){r[A.id]=A}));var C=[],d=i.splitSections(n.sdp),h=d.shift(),B=i.matchPrefix(h,"a=ice-lite").length>0,u=i.matchPrefix(h,"a=group:BUNDLE ").length>0;a.usingBundle=u;var E=i.matchPrefix(h,"a=ice-options:")[0];return a.canTrickleIceCandidates=!!E&&E.substr(14).split(" ").indexOf("trickle")>=0,d.forEach((function(s,c){var I=i.splitLines(s),d=i.getKind(s),E=i.isRejected(s)&&0===i.matchPrefix(s,"a=bundle-only").length,f=I[0].substr(2).split(" ")[2],Q=i.getDirection(s,h),x=i.parseMsid(s),p=i.getMid(s)||i.generateIdentifier();if(E||"application"===d&&("DTLS/SCTP"===f||"UDP/DTLS/SCTP"===f))a.transceivers[c]={mid:p,kind:d,protocol:f,rejected:!0};else{var m,y,_,S,D,w,v,F,b;!E&&a.transceivers[c]&&a.transceivers[c].rejected&&(a.transceivers[c]=a._createTransceiver(d,!0));var R,k,P=i.parseRtpParameters(s);E||(R=i.getIceParameters(s,h),(k=i.getDtlsParameters(s,h)).role="client"),v=i.parseRtpEncodingParameters(s);var N=i.parseRtcpParameters(s),M=i.matchPrefix(s,"a=end-of-candidates",h).length>0,T=i.matchPrefix(s,"a=candidate:").map((function(A){return i.parseCandidate(A)})).filter((function(A){return 1===A.component}));if(("offer"===n.type||"answer"===n.type)&&!E&&u&&c>0&&a.transceivers[c]&&(a._disposeIceAndDtlsTransports(c),a.transceivers[c].iceGatherer=a.transceivers[0].iceGatherer,a.transceivers[c].iceTransport=a.transceivers[0].iceTransport,a.transceivers[c].dtlsTransport=a.transceivers[0].dtlsTransport,a.transceivers[c].rtpSender&&a.transceivers[c].rtpSender.setTransport(a.transceivers[0].dtlsTransport),a.transceivers[c].rtpReceiver&&a.transceivers[c].rtpReceiver.setTransport(a.transceivers[0].dtlsTransport)),"offer"!==n.type||E){if("answer"===n.type&&!E){y=(m=a.transceivers[c]).iceGatherer,_=m.iceTransport,S=m.dtlsTransport,D=m.rtpReceiver,w=m.sendEncodingParameters,F=m.localCapabilities,a.transceivers[c].recvEncodingParameters=v,a.transceivers[c].remoteCapabilities=P,a.transceivers[c].rtcpParameters=N,T.length&&"new"===_.state&&(!B&&!M||u&&0!==c?T.forEach((function(A){g(m.iceTransport,A)})):_.setRemoteCandidates(T)),u&&0!==c||("new"===_.state&&_.start(y,R,"controlling"),"new"===S.state&&S.start(k));var L=o(m.localCapabilities,m.remoteCapabilities).codecs.filter((function(A){return"rtx"===A.name.toLowerCase()})).length;!L&&m.sendEncodingParameters[0].rtx&&delete m.sendEncodingParameters[0].rtx,a._transceive(m,"sendrecv"===Q||"recvonly"===Q,"sendrecv"===Q||"sendonly"===Q),!D||"sendrecv"!==Q&&"sendonly"!==Q?delete m.rtpReceiver:(b=D.track,x?(r[x.stream]||(r[x.stream]=new A.MediaStream),t(b,r[x.stream]),C.push([b,D,r[x.stream]])):(r.default||(r.default=new A.MediaStream),t(b,r.default),C.push([b,D,r.default])))}}else{(m=a.transceivers[c]||a._createTransceiver(d)).mid=p,m.iceGatherer||(m.iceGatherer=a._createIceGatherer(c,u)),T.length&&"new"===m.iceTransport.state&&(!M||u&&0!==c?T.forEach((function(A){g(m.iceTransport,A)})):m.iceTransport.setRemoteCandidates(T)),F=A.RTCRtpReceiver.getCapabilities(d),e<15019&&(F.codecs=F.codecs.filter((function(A){return"rtx"!==A.name}))),w=m.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var Y,G=!1;"sendrecv"===Q||"sendonly"===Q?(G=!m.rtpReceiver,D=m.rtpReceiver||new A.RTCRtpReceiver(m.dtlsTransport,d),G&&(b=D.track,x&&"-"===x.stream||(x?(r[x.stream]||(r[x.stream]=new A.MediaStream,Object.defineProperty(r[x.stream],"id",{get:function(){return x.stream}})),Object.defineProperty(b,"id",{get:function(){return x.track}}),Y=r[x.stream]):(r.default||(r.default=new A.MediaStream),Y=r.default)),Y&&(t(b,Y),m.associatedRemoteMediaStreams.push(Y)),C.push([b,D,Y]))):m.rtpReceiver&&m.rtpReceiver.track&&(m.associatedRemoteMediaStreams.forEach((function(A){var e=A.getTracks().find((function(A){return A.id===m.rtpReceiver.track.id}));e&&l(e,A)})),m.associatedRemoteMediaStreams=[]),m.localCapabilities=F,m.remoteCapabilities=P,m.rtpReceiver=D,m.rtcpParameters=N,m.sendEncodingParameters=w,m.recvEncodingParameters=v,a._transceive(a.transceivers[c],!1,G)}}})),void 0===a._dtlsRole&&(a._dtlsRole="offer"===n.type?"active":"passive"),a._remoteDescription={type:n.type,sdp:n.sdp},"offer"===n.type?a._updateSignalingState("have-remote-offer"):a._updateSignalingState("stable"),Object.keys(r).forEach((function(e){var t=r[e];if(t.getTracks().length){if(-1===a.remoteStreams.indexOf(t)){a.remoteStreams.push(t);var i=new Event("addstream");i.stream=t,A.setTimeout((function(){a._dispatchEvent("addstream",i)}))}C.forEach((function(A){var e=A[0],i=A[1];t.id===A[2].id&&I(a,e,i,[t])}))}})),C.forEach((function(A){A[2]||I(a,A[0],A[1],[])})),A.setTimeout((function(){a&&a.transceivers&&a.transceivers.forEach((function(A){A.iceTransport&&"new"===A.iceTransport.state&&A.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),A.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},C.prototype.close=function(){this.transceivers.forEach((function(A){A.iceTransport&&A.iceTransport.stop(),A.dtlsTransport&&A.dtlsTransport.stop(),A.rtpSender&&A.rtpSender.stop(),A.rtpReceiver&&A.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},C.prototype._updateSignalingState=function(A){this.signalingState=A;var e=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",e)},C.prototype._maybeFireNegotiationNeeded=function(){var e=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,A.setTimeout((function(){if(e.needNegotiation){e.needNegotiation=!1;var A=new Event("negotiationneeded");e._dispatchEvent("negotiationneeded",A)}}),0))},C.prototype._updateIceConnectionState=function(){var A,e={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(A){A.iceTransport&&!A.rejected&&e[A.iceTransport.state]++})),A="new",e.failed>0?A="failed":e.checking>0?A="checking":e.disconnected>0?A="disconnected":e.new>0?A="new":e.connected>0?A="connected":e.completed>0&&(A="completed"),A!==this.iceConnectionState){this.iceConnectionState=A;var t=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",t)}},C.prototype._updateConnectionState=function(){var A,e={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(A){A.iceTransport&&A.dtlsTransport&&!A.rejected&&(e[A.iceTransport.state]++,e[A.dtlsTransport.state]++)})),e.connected+=e.completed,A="new",e.failed>0?A="failed":e.connecting>0?A="connecting":e.disconnected>0?A="disconnected":e.new>0?A="new":e.connected>0&&(A="connected"),A!==this.connectionState){this.connectionState=A;var t=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",t)}},C.prototype.createOffer=function(){var t=this;if(t._isClosed)return Promise.reject(c("InvalidStateError","Can not call createOffer after close"));var n=t.transceivers.filter((function(A){return"audio"===A.kind})).length,r=t.transceivers.filter((function(A){return"video"===A.kind})).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(n=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(r=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(t.transceivers.forEach((function(A){"audio"===A.kind?--n<0&&(A.wantReceive=!1):"video"===A.kind&&--r<0&&(A.wantReceive=!1)}));n>0||r>0;)n>0&&(t._createTransceiver("audio"),n--),r>0&&(t._createTransceiver("video"),r--);var s=i.writeSessionBoilerplate(t._sdpSessionId,t._sdpSessionVersion++);t.transceivers.forEach((function(n,a){var r=n.track,o=n.kind,s=n.mid||i.generateIdentifier();n.mid=s,n.iceGatherer||(n.iceGatherer=t._createIceGatherer(a,t.usingBundle));var g=A.RTCRtpSender.getCapabilities(o);e<15019&&(g.codecs=g.codecs.filter((function(A){return"rtx"!==A.name}))),g.codecs.forEach((function(A){"H264"===A.name&&void 0===A.parameters["level-asymmetry-allowed"]&&(A.parameters["level-asymmetry-allowed"]="1"),n.remoteCapabilities&&n.remoteCapabilities.codecs&&n.remoteCapabilities.codecs.forEach((function(e){A.name.toLowerCase()===e.name.toLowerCase()&&A.clockRate===e.clockRate&&(A.preferredPayloadType=e.payloadType)}))})),g.headerExtensions.forEach((function(A){(n.remoteCapabilities&&n.remoteCapabilities.headerExtensions||[]).forEach((function(e){A.uri===e.uri&&(A.id=e.id)}))}));var c=n.sendEncodingParameters||[{ssrc:1001*(2*a+1)}];r&&e>=15019&&"video"===o&&!c[0].rtx&&(c[0].rtx={ssrc:c[0].ssrc+1}),n.wantReceive&&(n.rtpReceiver=new A.RTCRtpReceiver(n.dtlsTransport,o)),n.localCapabilities=g,n.sendEncodingParameters=c})),"max-compat"!==t._config.bundlePolicy&&(s+="a=group:BUNDLE "+t.transceivers.map((function(A){return A.mid})).join(" ")+"\r\n"),s+="a=ice-options:trickle\r\n",t.transceivers.forEach((function(A,e){s+=a(A,A.localCapabilities,"offer",A.stream,t._dtlsRole),s+="a=rtcp-rsize\r\n",!A.iceGatherer||"new"===t.iceGatheringState||0!==e&&t.usingBundle||(A.iceGatherer.getLocalCandidates().forEach((function(A){A.component=1,s+="a="+i.writeCandidate(A)+"\r\n"})),"completed"===A.iceGatherer.state&&(s+="a=end-of-candidates\r\n"))}));var g=new A.RTCSessionDescription({type:"offer",sdp:s});return Promise.resolve(g)},C.prototype.createAnswer=function(){var t=this;if(t._isClosed)return Promise.reject(c("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==t.signalingState&&"have-local-pranswer"!==t.signalingState)return Promise.reject(c("InvalidStateError","Can not call createAnswer in signalingState "+t.signalingState));var n=i.writeSessionBoilerplate(t._sdpSessionId,t._sdpSessionVersion++);t.usingBundle&&(n+="a=group:BUNDLE "+t.transceivers.map((function(A){return A.mid})).join(" ")+"\r\n"),n+="a=ice-options:trickle\r\n";var r=i.getMediaSections(t._remoteDescription.sdp).length;t.transceivers.forEach((function(A,i){if(!(i+1>r)){if(A.rejected)return"application"===A.kind?"DTLS/SCTP"===A.protocol?n+="m=application 0 DTLS/SCTP 5000\r\n":n+="m=application 0 "+A.protocol+" webrtc-datachannel\r\n":"audio"===A.kind?n+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===A.kind&&(n+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(n+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+A.mid+"\r\n");var s;A.stream&&("audio"===A.kind?s=A.stream.getAudioTracks()[0]:"video"===A.kind&&(s=A.stream.getVideoTracks()[0]),s&&e>=15019&&"video"===A.kind&&!A.sendEncodingParameters[0].rtx&&(A.sendEncodingParameters[0].rtx={ssrc:A.sendEncodingParameters[0].ssrc+1}));var g=o(A.localCapabilities,A.remoteCapabilities),c=g.codecs.filter((function(A){return"rtx"===A.name.toLowerCase()})).length;!c&&A.sendEncodingParameters[0].rtx&&delete A.sendEncodingParameters[0].rtx,n+=a(A,g,"answer",A.stream,t._dtlsRole),A.rtcpParameters&&A.rtcpParameters.reducedSize&&(n+="a=rtcp-rsize\r\n")}}));var s=new A.RTCSessionDescription({type:"answer",sdp:n});return Promise.resolve(s)},C.prototype.addIceCandidate=function(A){var e,t=this;return A&&void 0===A.sdpMLineIndex&&!A.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(n,a){if(!t._remoteDescription)return a(c("InvalidStateError","Can not add ICE candidate without a remote description"));if(A&&""!==A.candidate){var r=A.sdpMLineIndex;if(A.sdpMid)for(var o=0;o0?i.parseCandidate(A.candidate):{};if("tcp"===l.protocol&&(0===l.port||9===l.port))return n();if(l.component&&1!==l.component)return n();if((0===r||r>0&&s.iceTransport!==t.transceivers[0].iceTransport)&&!g(s.iceTransport,l))return a(c("OperationError","Can not add ICE candidate"));var I=A.candidate.trim();0===I.indexOf("a=")&&(I=I.substr(2)),(e=i.getMediaSections(t._remoteDescription.sdp))[r]+="a="+(l.type?I:"end-of-candidates")+"\r\n",t._remoteDescription.sdp=i.getDescription(t._remoteDescription.sdp)+e.join("")}else for(var C=0;C0?e[0].split("/")[1]:"sendrecv",uri:e[1]}},i.writeExtmap=function(A){return"a=extmap:"+(A.id||A.preferredId)+(A.direction&&"sendrecv"!==A.direction?"/"+A.direction:"")+" "+A.uri+"\r\n"},i.parseFmtp=function(A){for(var e,t={},i=A.substr(A.indexOf(" ")+1).split(";"),n=0;n-1?(t.attribute=A.substr(e+1,i-e-1),t.value=A.substr(i+1)):t.attribute=A.substr(e+1),t},i.parseSsrcGroup=function(A){var e=A.substr(13).split(" ");return{semantics:e.shift(),ssrcs:e.map((function(A){return parseInt(A,10)}))}},i.getMid=function(A){var e=i.matchPrefix(A,"a=mid:")[0];if(e)return e.substr(6)},i.parseFingerprint=function(A){var e=A.substr(14).split(" ");return{algorithm:e[0].toLowerCase(),value:e[1]}},i.getDtlsParameters=function(A,e){return{role:"auto",fingerprints:i.matchPrefix(A+e,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(A,e){var t="a=setup:"+e+"\r\n";return A.fingerprints.forEach((function(A){t+="a=fingerprint:"+A.algorithm+" "+A.value+"\r\n"})),t},i.getIceParameters=function(A,e){var t=i.splitLines(A);return{usernameFragment:(t=t.concat(i.splitLines(e))).filter((function(A){return 0===A.indexOf("a=ice-ufrag:")}))[0].substr(12),password:t.filter((function(A){return 0===A.indexOf("a=ice-pwd:")}))[0].substr(10)}},i.writeIceParameters=function(A){return"a=ice-ufrag:"+A.usernameFragment+"\r\na=ice-pwd:"+A.password+"\r\n"},i.parseRtpParameters=function(A){for(var e={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},t=i.splitLines(A)[0].split(" "),n=3;n0?"9":"0",t+=" UDP/TLS/RTP/SAVPF ",t+=e.codecs.map((function(A){return void 0!==A.preferredPayloadType?A.preferredPayloadType:A.payloadType})).join(" ")+"\r\n",t+="c=IN IP4 0.0.0.0\r\n",t+="a=rtcp:9 IN IP4 0.0.0.0\r\n",e.codecs.forEach((function(A){t+=i.writeRtpMap(A),t+=i.writeFmtp(A),t+=i.writeRtcpFb(A)}));var n=0;return e.codecs.forEach((function(A){A.maxptime>n&&(n=A.maxptime)})),n>0&&(t+="a=maxptime:"+n+"\r\n"),t+="a=rtcp-mux\r\n",e.headerExtensions&&e.headerExtensions.forEach((function(A){t+=i.writeExtmap(A)})),t},i.parseRtpEncodingParameters=function(A){var e,t=[],n=i.parseRtpParameters(A),a=-1!==n.fecMechanisms.indexOf("RED"),r=-1!==n.fecMechanisms.indexOf("ULPFEC"),o=i.matchPrefix(A,"a=ssrc:").map((function(A){return i.parseSsrcMedia(A)})).filter((function(A){return"cname"===A.attribute})),s=o.length>0&&o[0].ssrc,g=i.matchPrefix(A,"a=ssrc-group:FID").map((function(A){return A.substr(17).split(" ").map((function(A){return parseInt(A,10)}))}));g.length>0&&g[0].length>1&&g[0][0]===s&&(e=g[0][1]),n.codecs.forEach((function(A){if("RTX"===A.name.toUpperCase()&&A.parameters.apt){var i={ssrc:s,codecPayloadType:parseInt(A.parameters.apt,10)};s&&e&&(i.rtx={ssrc:e}),t.push(i),a&&((i=JSON.parse(JSON.stringify(i))).fec={ssrc:s,mechanism:r?"red+ulpfec":"red"},t.push(i))}})),0===t.length&&s&&t.push({ssrc:s});var c=i.matchPrefix(A,"b=");return c.length&&(c=0===c[0].indexOf("b=TIAS:")?parseInt(c[0].substr(7),10):0===c[0].indexOf("b=AS:")?1e3*parseInt(c[0].substr(5),10)*.95-16e3:void 0,t.forEach((function(A){A.maxBitrate=c}))),t},i.parseRtcpParameters=function(A){var e={},t=i.matchPrefix(A,"a=ssrc:").map((function(A){return i.parseSsrcMedia(A)})).filter((function(A){return"cname"===A.attribute}))[0];t&&(e.cname=t.value,e.ssrc=t.ssrc);var n=i.matchPrefix(A,"a=rtcp-rsize");e.reducedSize=n.length>0,e.compound=0===n.length;var a=i.matchPrefix(A,"a=rtcp-mux");return e.mux=a.length>0,e},i.parseMsid=function(A){var e,t=i.matchPrefix(A,"a=msid:");if(1===t.length)return{stream:(e=t[0].substr(7).split(" "))[0],track:e[1]};var n=i.matchPrefix(A,"a=ssrc:").map((function(A){return i.parseSsrcMedia(A)})).filter((function(A){return"msid"===A.attribute}));return n.length>0?{stream:(e=n[0].value.split(" "))[0],track:e[1]}:void 0},i.parseSctpDescription=function(A){var e,t=i.parseMLine(A),n=i.matchPrefix(A,"a=max-message-size:");n.length>0&&(e=parseInt(n[0].substr(19),10)),isNaN(e)&&(e=65536);var a=i.matchPrefix(A,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substr(12),10),protocol:t.fmt,maxMessageSize:e};if(i.matchPrefix(A,"a=sctpmap:").length>0){var r=i.matchPrefix(A,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(r[0],10),protocol:r[1],maxMessageSize:e}}},i.writeSctpDescription=function(A,e){var t=[];return t="DTLS/SCTP"!==A.protocol?["m="+A.kind+" 9 "+A.protocol+" "+e.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+e.port+"\r\n"]:["m="+A.kind+" 9 "+A.protocol+" "+e.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+e.port+" "+e.protocol+" 65535\r\n"],void 0!==e.maxMessageSize&&t.push("a=max-message-size:"+e.maxMessageSize+"\r\n"),t.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,21)},i.writeSessionBoilerplate=function(A,e,t){var n=void 0!==e?e:2;return"v=0\r\no="+(t||"thisisadapterortc")+" "+(A||i.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.writeMediaSection=function(A,e,t,n){var a=i.writeRtpDescription(A.kind,e);if(a+=i.writeIceParameters(A.iceGatherer.getLocalParameters()),a+=i.writeDtlsParameters(A.dtlsTransport.getLocalParameters(),"offer"===t?"actpass":"active"),a+="a=mid:"+A.mid+"\r\n",A.direction?a+="a="+A.direction+"\r\n":A.rtpSender&&A.rtpReceiver?a+="a=sendrecv\r\n":A.rtpSender?a+="a=sendonly\r\n":A.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",A.rtpSender){var r="msid:"+n.id+" "+A.rtpSender.track.id+"\r\n";a+="a="+r,a+="a=ssrc:"+A.sendEncodingParameters[0].ssrc+" "+r,A.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+A.sendEncodingParameters[0].rtx.ssrc+" "+r,a+="a=ssrc-group:FID "+A.sendEncodingParameters[0].ssrc+" "+A.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+A.sendEncodingParameters[0].ssrc+" cname:"+i.localCName+"\r\n",A.rtpSender&&A.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+A.sendEncodingParameters[0].rtx.ssrc+" cname:"+i.localCName+"\r\n"),a},i.getDirection=function(A,e){for(var t=i.splitLines(A),n=0;n=26&&A<=e||aA.extension.isInstalled()}return!0};var nA={extensionId:"hapfgfdkleiggjjpfpenajgdnfckjpaj",isInstalled:function(){return null!==document.querySelector("#janus-extension-installed")},getScreen:function(A){var e=window.setTimeout((function(){var e=new Error("NavigatorUserMediaError");return e.name='The required Chrome extension is not installed: click here to install it. (NOTE: this will need you to refresh the page)',A(e)}),1e3);this.cache[e]=A,window.postMessage({type:"janusGetScreen",id:e},"*")},init:function(){var A={};this.cache=A,window.addEventListener("message",(function(e){if(e.origin==window.location.origin)if("janusGotScreen"==e.data.type&&A[e.data.id]){var t=A[e.data.id];if(delete A[e.data.id],""===e.data.sourceId){var i=new Error("NavigatorUserMediaError");i.name="You cancelled the request for permission, giving up...",t(i)}else t(null,e.data.sourceId)}else"janusGetScreenPending"==e.data.type&&(console.log("clearing ",e.data.id),window.clearTimeout(e.data.id))}))}};function aA(A){if(void 0===aA.initDone)return A.error("Library not initialized"),{};if(!aA.isWebrtcSupported())return A.error("WebRTC not supported by this browser"),{};if(aA.log("Library initialized: "+aA.initDone),(A=A||{}).success="function"==typeof A.success?A.success:aA.noop,A.error="function"==typeof A.error?A.error:aA.noop,A.destroyed="function"==typeof A.destroyed?A.destroyed:aA.noop,null===A.server||void 0===A.server)return A.error("Invalid server url"),{};var e=!1,t=null,i={},a=null,r=null,o=0,s=A.server;aA.isArray(s)?(aA.log("Multiple servers provided ("+s.length+"), will use the first that works"),s=null,r=A.server,aA.debug(r)):0===s.indexOf("ws")?(e=!0,aA.log("Using WebSockets to contact Janus: "+s)):(e=!1,aA.log("Using REST API to contact Janus: "+s));var g=A.iceServers;null==g&&(g=[{urls:"stun:stun.l.google.com:19302"}]);var c=A.iceTransportPolicy,l=A.bundlePolicy,I=A.ipv6;null==I&&(I=!1);var C=!1;void 0!==A.withCredentials&&null!==A.withCredentials&&(C=!0===A.withCredentials);var d=10;void 0!==A.max_poll_events&&null!==A.max_poll_events&&(d=A.max_poll_events),d<1&&(d=1);var h=null;void 0!==A.token&&null!==A.token&&(h=A.token);var B=null;void 0!==A.apisecret&&null!==A.apisecret&&(B=A.apisecret),this.destroyOnUnload=!0,void 0!==A.destroyOnUnload&&null!==A.destroyOnUnload&&(this.destroyOnUnload=!0===A.destroyOnUnload);var u=25e3;void 0!==A.keepAlivePeriod&&null!==A.keepAlivePeriod&&(u=A.keepAlivePeriod),isNaN(u)&&(u=25e3);var E=6e4;function f(A){var e={high:9e5,medium:3e5,low:1e5};return null!=A&&(A.high&&(e.high=A.high),A.medium&&(e.medium=A.medium),A.low&&(e.low=A.low)),e}void 0!==A.longPollTimeout&&null!==A.longPollTimeout&&(E=A.longPollTimeout),isNaN(E)&&(E=6e4);var Q=!1,x=null,p={},m=this,y=0,_={};function S(){if(null!=x)if(aA.debug("Long poll..."),Q){var e=s+"/"+x+"?rid="+(new Date).getTime();null!=d&&(e=e+"&maxev="+d),null!=h&&(e=e+"&token="+encodeURIComponent(h)),null!=B&&(e=e+"&apisecret="+encodeURIComponent(B)),aA.httpAPICall(e,{verb:"GET",withCredentials:C,success:D,timeout:E,error:function(e,t){if(aA.error(e+":",t),++y>3)return Q=!1,void A.error("Lost connection to the server (is it down?)");S()}})}else aA.warn("Is the server down? (connected=false)")}function D(A,i){if(y=0,e||null==x||!0===i||S(),e||!aA.isArray(A))if("keepalive"!==A.rtcgw)if("ack"!==A.rtcgw)if("success"!==A.rtcgw)if("trickle"===A.rtcgw){if(null==(s=A.sender))return void aA.warn("Missing sender...");if(null==(c=p[s]))return void aA.debug("This handle is not attached to this session");var n=A.candidate;aA.debug("Got a trickled candidate on session "+x),aA.debug(n);var a=c.webrtcStuff;a.pc&&a.remoteSdp?(aA.debug("Adding remote candidate:",n),n&&!0!==n.completed?a.pc.addIceCandidate(n):a.pc.addIceCandidate(aA.endOfCandidates)):(aA.debug("We didn't do setRemoteDescription (trickle got here before the offer?), caching candidate"),a.candidates||(a.candidates=[]),a.candidates.push(n),aA.debug(a.candidates))}else{if("webrtcup"===A.rtcgw)return aA.debug("Got a webrtcup event on session "+x),aA.debug(A),null==(s=A.sender)?void aA.warn("Missing sender..."):null==(c=p[s])?void aA.debug("This handle is not attached to this session"):void c.webrtcState(!0);if("hangup"===A.rtcgw){if(aA.debug("Got a hangup event on session "+x),aA.debug(A),null==(s=A.sender))return void aA.warn("Missing sender...");if(null==(c=p[s]))return void aA.debug("This handle is not attached to this session");c.webrtcState(!1,A.reason),c.hangup()}else if("detached"===A.rtcgw){if(aA.debug("Got a detached event on session "+x),aA.debug(A),null==(s=A.sender))return void aA.warn("Missing sender...");if(null==(c=p[s]))return;c.detached=!0,c.ondetached(),c.detach()}else if("media"===A.rtcgw){if(aA.debug("Got a media event on session "+x),aA.debug(A),null==(s=A.sender))return void aA.warn("Missing sender...");if(null==(c=p[s]))return void aA.debug("This handle is not attached to this session");c.mediaState(A.type,A.receiving)}else if("slowlink"===A.rtcgw){if(aA.debug("Got a slowlink event on session "+x),aA.debug(A),null==(s=A.sender))return void aA.warn("Missing sender...");if(null==(c=p[s]))return void aA.debug("This handle is not attached to this session");c.slowLink(A.uplink,A.lost)}else{if("error"===A.rtcgw){var r,o;if(aA.error("Ooops: "+A.error.code+" "+A.error.reason),aA.debug(A),null!=(r=A.transaction))null!=(o=_[r])&&o(A),delete _[r];return}if("event"===A.rtcgw){var s;if(aA.debug("Got a plugin event on session "+x),aA.debug(A),null==(s=A.sender))return void aA.warn("Missing sender...");var g=A.plugindata;if(null==g)return void aA.warn("Missing plugindata...");aA.debug(" -- Event is coming from "+s+" ("+g.plugin+")");var c,l=g.data;if(aA.debug(l),null==(c=p[s]))return void aA.warn("This handle is not attached to this session");var I=A.jsep;null!=I&&(aA.debug("Handling SDP as well..."),aA.debug(I));var C=c.onmessage;null!=C?(aA.debug("Notifying application..."),C(l,I)):aA.debug("No provided notification callback")}else{if("timeout"===A.rtcgw)return aA.error("Timeout on session "+x),aA.debug(A),void(e&&t.close(3504,"Gateway timeout"));aA.warn("Unknown message/event '"+A.rtcgw+"' on session "+x),aA.debug(A)}}}else aA.debug("Got a success on session "+x),aA.debug(A),null!=(r=A.transaction)&&(null!=(o=_[r])&&o(A),delete _[r]);else aA.debug("Got an ack on session "+x),aA.debug(A),null!=(r=A.transaction)&&(null!=(o=_[r])&&o(A),delete _[r]);else aA.vdebug("Got a keepalive on session "+x);else for(var d=0;d data channel: "+t),"open"===t){if(a.dataChannel[e].pending&&a.dataChannel[e].pending.length>0){for(var i in aA.log("Sending pending messages on <"+e+">:",a.dataChannel[e].pending.length),a.dataChannel[e].pending){var r=a.dataChannel[e].pending[i];aA.log("Sending string on data channel <"+e+">: "+r),a.dataChannel[e].send(r)}a.dataChannel[e].pending=[]}n.ondataopen(e)}};a.dataChannel[e]=t||a.pc.createDataChannel(e,{ordered:!1}),a.dataChannel[e].onmessage=function(A){aA.log("Received message on data channel:",A);var e=A.target.label;n.ondata(A.data,e)},a.dataChannel[e].onopen=r,a.dataChannel[e].onclose=r,a.dataChannel[e].onerror=function(A){aA.error("Got error on data channel:",A)},a.dataChannel[e].pending=[],i&&a.dataChannel[e].pending.push(i)}else aA.warn("Invalid handle")}function k(A,e){(e=e||{}).success="function"==typeof e.success?e.success:aA.noop,e.error="function"==typeof e.error?e.error:aA.noop;var t=p[A];if(null==t||null===t.webrtcStuff||void 0===t.webrtcStuff)return aA.warn("Invalid handle"),void e.error("Invalid handle");var i=t.webrtcStuff,n=e.text;if(null==n)return aA.warn("Invalid text"),void e.error("Invalid text");var a=e.label?e.label:aA.dataChanDefaultLabel;return i.dataChannel[a]?"open"!==i.dataChannel[a].readyState?(i.dataChannel[a].pending.push(n),void e.success()):(aA.log("Sending string on data channel <"+a+">: "+n),i.dataChannel[a].send(n),void e.success()):(R(A,a,!1,n),void e.success())}function P(A,e){(e=e||{}).success="function"==typeof e.success?e.success:aA.noop,e.error="function"==typeof e.error?e.error:aA.noop;var t=p[A];if(null==t||null===t.webrtcStuff||void 0===t.webrtcStuff)return aA.warn("Invalid handle"),void e.error("Invalid handle");var i=t.webrtcStuff;if(null===i.dtmfSender||void 0===i.dtmfSender){if(void 0!==i.pc&&null!==i.pc){var n=i.pc.getSenders().find((function(A){return A.track&&"audio"===A.track.kind}));if(!n)return aA.warn("Invalid DTMF configuration (no audio track)"),void e.error("Invalid DTMF configuration (no audio track)");i.dtmfSender=n.dtmf,i.dtmfSender&&(aA.log("Created DTMF Sender"),i.dtmfSender.ontonechange=function(A){aA.debug("Sent DTMF tone: "+A.tone)})}if(null===i.dtmfSender||void 0===i.dtmfSender)return aA.warn("Invalid DTMF configuration"),void e.error("Invalid DTMF configuration")}var a=e.dtmf;if(null==a)return aA.warn("Invalid DTMF parameters"),void e.error("Invalid DTMF parameters");var r=a.tones;if(null==r)return aA.warn("Invalid DTMF string"),void e.error("Invalid DTMF string");var o=a.duration;null==o&&(o=500);var s=a.gap;null==s&&(s=50),aA.debug("Sending DTMF string "+r+" (duration "+o+"ms, gap "+s+"ms)"),i.dtmfSender.insertDTMF(r,o,s),e.success()}function N(A,i){(i=i||{}).success="function"==typeof i.success?i.success:aA.noop,i.error="function"==typeof i.error?i.error:aA.noop;var n=!0;void 0!==i.asyncRequest&&null!==i.asyncRequest&&(n=!0===i.asyncRequest);var a=!0;void 0!==i.noRequest&&null!==i.noRequest&&(a=!0===i.noRequest),aA.log("Destroying handle "+A+" (async="+n+")"),K(A);var r=p[A];if(null==r||r.detached)return delete p[A],void i.success();if(a)return delete p[A],void i.success();if(!Q)return aA.warn("Is the server down? (connected=false)"),void i.error("Is the server down? (connected=false)");var o={rtcgw:"detach",transaction:aA.randomString(12)};if(null!==r.token&&void 0!==r.token&&(o.token=r.token),null!=B&&(o.apisecret=B),e)return o.session_id=x,o.handle_id=A,t.send(JSON.stringify(o)),delete p[A],void i.success();aA.httpAPICall(s+"/"+x+"/"+A,{verb:"POST",async:n,withCredentials:C,body:o,success:function(e){aA.log("Destroyed handle:"),aA.debug(e),"success"!==e.rtcgw&&aA.error("Ooops: "+e.error.code+" "+e.error.reason),delete p[A],i.success()},error:function(e,t){aA.error(e+":",t),delete p[A],i.success()}})}function M(A,e,t,i,a){var r=p[A];if(null==r||null===r.webrtcStuff||void 0===r.webrtcStuff)return aA.warn("Invalid handle"),void i.error("Invalid handle");var o=r.webrtcStuff;aA.debug("streamsDone:",a),a&&(aA.debug(" -- Audio tracks:",a.getAudioTracks()),aA.debug(" -- Video tracks:",a.getVideoTracks()));var s=!1;if(o.myStream&&t.update&&!o.streamExternal){if((!t.update&&V(t)||t.update&&(t.addAudio||t.replaceAudio))&&a.getAudioTracks()&&a.getAudioTracks().length)if(o.myStream.addTrack(a.getAudioTracks()[0]),aA.unifiedPlan){aA.log((t.replaceAudio?"Replacing":"Adding")+" audio track:",a.getAudioTracks()[0]);var C=null;if((h=o.pc.getTransceivers())&&h.length>0)for(var d in h){if((u=h[d]).sender&&u.sender.track&&"audio"===u.sender.track.kind||u.receiver&&u.receiver.track&&"audio"===u.receiver.track.kind){C=u;break}}C&&C.sender?C.sender.replaceTrack(a.getAudioTracks()[0]):o.pc.addTrack(a.getAudioTracks()[0],a)}else aA.log((t.replaceAudio?"Replacing":"Adding")+" audio track:",a.getAudioTracks()[0]),o.pc.addTrack(a.getAudioTracks()[0],a);if((!t.update&&j(t)||t.update&&(t.addVideo||t.replaceVideo))&&a.getVideoTracks()&&a.getVideoTracks().length)if(o.myStream.addTrack(a.getVideoTracks()[0]),aA.unifiedPlan){aA.log((t.replaceVideo?"Replacing":"Adding")+" video track:",a.getVideoTracks()[0]);var h,B=null;if((h=o.pc.getTransceivers())&&h.length>0)for(var d in h){var u;if((u=h[d]).sender&&u.sender.track&&"video"===u.sender.track.kind||u.receiver&&u.receiver.track&&"video"===u.receiver.track.kind){B=u;break}}B&&B.sender?B.sender.replaceTrack(a.getVideoTracks()[0]):o.pc.addTrack(a.getVideoTracks()[0],a)}else aA.log((t.replaceVideo?"Replacing":"Adding")+" video track:",a.getVideoTracks()[0]),o.pc.addTrack(a.getVideoTracks()[0],a)}else o.myStream=a,s=!0;if(!o.pc){var E={iceServers:g,iceTransportPolicy:c,bundlePolicy:l};"chrome"===aA.webRTCAdapter.browserDetails.browser&&(E.sdpSemantics=aA.webRTCAdapter.browserDetails.version<72?"plan-b":"unified-plan");var Q={optional:[{DtlsSrtpKeyAgreement:!0}]};if(!0===I&&Q.optional.push({googIPv6:!0}),i.rtcConstraints&&"object"===n(i.rtcConstraints))for(var d in aA.debug("Adding custom PeerConnection constraints:",i.rtcConstraints),i.rtcConstraints)Q.optional.push(i.rtcConstraints[d]);"edge"===aA.webRTCAdapter.browserDetails.browser&&(E.bundlePolicy="max-bundle"),aA.log("Creating PeerConnection"),aA.debug(Q),o.pc=new RTCPeerConnection(E,Q),aA.debug(o.pc),o.pc.getStats&&(o.volume={},o.bitrate.value="0 kbits/sec"),aA.log("Preparing local SDP and gathering candidates (trickle="+o.trickle+")"),o.pc.oniceconnectionstatechange=function(A){o.pc&&r.iceState(o.pc.iceConnectionState)},o.pc.onicecandidate=function(e){if(null==e.candidate||"edge"===aA.webRTCAdapter.browserDetails.browser&&e.candidate.candidate.indexOf("endOfCandidates")>0)aA.log("End of candidates."),o.iceDone=!0,!0===o.trickle?b(A,{completed:!0}):function(A,e){e=e||{},e.success="function"==typeof e.success?e.success:aA.noop,e.error="function"==typeof e.error?e.error:aA.noop;var t=p[A];if(null==t||null===t.webrtcStuff||void 0===t.webrtcStuff)return void aA.warn("Invalid handle, not sending anything");var i=t.webrtcStuff;if(aA.log("Sending offer/answer SDP..."),null===i.mySdp||void 0===i.mySdp)return void aA.warn("Local SDP instance is invalid, not sending anything...");i.mySdp={type:i.pc.localDescription.type,sdp:i.pc.localDescription.sdp},!1===i.trickle&&(i.mySdp.trickle=!1);aA.debug(e),i.sdpSent=!0,e.success(i.mySdp)}(A,i);else{var t={candidate:e.candidate.candidate,sdpMid:e.candidate.sdpMid,sdpMLineIndex:e.candidate.sdpMLineIndex};!0===o.trickle&&b(A,t)}},o.pc.ontrack=function(A){aA.log("Handling Remote Track"),aA.debug(A),A.streams&&(o.remoteStream=A.streams[0],r.onremotestream(o.remoteStream),A.track.onended||(aA.log("Adding onended callback to track:",A.track),A.track.onended=function(A){aA.log("Remote track muted/removed:",A),o.remoteStream&&(o.remoteStream.removeTrack(A.target),r.onremotestream(o.remoteStream))},A.track.onmute=A.track.onended,A.track.onunmute=function(A){aA.log("Remote track flowing again:",A);try{o.remoteStream.addTrack(A.target),r.onremotestream(o.remoteStream)}catch(A){aA.error(A)}}))}}if(s&&null!=a){aA.log("Adding local stream");var x=!0===i.simulcast2;a.getTracks().forEach((function(A){if(aA.log("Adding local track:",A),x)if("audio"===A.kind)o.pc.addTrack(A,a);else{aA.log("Enabling rid-based simulcasting:",A);var e=f(i.simulcastMaxBitrates);o.pc.addTransceiver(A,{direction:"sendrecv",streams:[a],sendEncodings:[{rid:"h",active:!0,maxBitrate:e.high},{rid:"m",active:!0,maxBitrate:e.medium,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:e.low,scaleResolutionDownBy:4}]})}else o.pc.addTrack(A,a)}))}(function(A){if(aA.debug("isDataEnabled:",A),"edge"==aA.webRTCAdapter.browserDetails.browser)return aA.warn("Edge doesn't support data channels yet"),!1;return null!=A&&!0===A.data})(t)&&!o.dataChannel[aA.dataChanDefaultLabel]&&(aA.log("Creating data channel"),R(A,aA.dataChanDefaultLabel,!1),o.pc.ondatachannel=function(e){aA.log("Data channel created by Janus:",e),R(A,e.channel.label,e.channel)}),o.myStream&&r.onlocalstream(o.myStream),null==e?function(A,e,t){t=t||{},t.success="function"==typeof t.success?t.success:aA.noop,t.error="function"==typeof t.error?t.error:aA.noop,t.customizeSdp="function"==typeof t.customizeSdp?t.customizeSdp:aA.noop;var i=p[A];if(null==i||null===i.webrtcStuff||void 0===i.webrtcStuff)return aA.warn("Invalid handle"),void t.error("Invalid handle");var n=i.webrtcStuff,a=!0===t.simulcast;a?aA.log("Creating offer (iceDone="+n.iceDone+", simulcast="+a+")"):aA.log("Creating offer (iceDone="+n.iceDone+")");var r={};if(aA.unifiedPlan){var o=null,s=null,g=n.pc.getTransceivers();if(g&&g.length>0)for(var c in g){var l=g[c];l.sender&&l.sender.track&&"audio"===l.sender.track.kind||l.receiver&&l.receiver.track&&"audio"===l.receiver.track.kind?o||(o=l):(l.sender&&l.sender.track&&"video"===l.sender.track.kind||l.receiver&&l.receiver.track&&"video"===l.receiver.track.kind)&&(s||(s=l))}var I=V(e),C=W(e);I||C?I&&C?o&&(o.setDirection?o.setDirection("sendrecv"):o.direction="sendrecv",aA.log("Setting audio transceiver to sendrecv:",o)):I&&!C?o&&(o.setDirection?o.setDirection("sendonly"):o.direction="sendonly",aA.log("Setting audio transceiver to sendonly:",o)):!I&&C&&(o?(o.setDirection?o.setDirection("recvonly"):o.direction="recvonly",aA.log("Setting audio transceiver to recvonly:",o)):(o=n.pc.addTransceiver("audio",{direction:"recvonly"}),aA.log("Adding recvonly audio transceiver:",o))):e.removeAudio&&o&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive",aA.log("Setting audio transceiver to inactive:",o));var d=j(e),h=O(e);d||h?d&&h?s&&(s.setDirection?s.setDirection("sendrecv"):s.direction="sendrecv",aA.log("Setting video transceiver to sendrecv:",s)):d&&!h?s&&(s.setDirection?s.setDirection("sendonly"):s.direction="sendonly",aA.log("Setting video transceiver to sendonly:",s)):!d&&h&&(s?(s.setDirection?s.setDirection("recvonly"):s.direction="recvonly",aA.log("Setting video transceiver to recvonly:",s)):(s=n.pc.addTransceiver("video",{direction:"recvonly"}),aA.log("Adding recvonly video transceiver:",s))):e.removeVideo&&s&&(s.setDirection?s.setDirection("inactive"):s.direction="inactive",aA.log("Setting video transceiver to inactive:",s))}else r.offerToReceiveAudio=W(e),r.offerToReceiveVideo=O(e);var B=!0===t.iceRestart;B&&(r.iceRestart=!0);aA.debug(r);var u=j(e);if(u&&a&&"firefox"===aA.webRTCAdapter.browserDetails.browser){aA.log("Enabling Simulcasting for Firefox (RID)");var E=n.pc.getSenders().find((function(A){return"video"==A.track.kind}));if(E){var Q=E.getParameters();Q||(Q={});var x=f(t.simulcastMaxBitrates);Q.encodings=[{rid:"h",active:!0,maxBitrate:x.high},{rid:"m",active:!0,maxBitrate:x.medium,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:x.low,scaleResolutionDownBy:4}],E.setParameters(Q)}}n.pc.createOffer(r).then((function(A){aA.debug(A);var e={type:A.type,sdp:A.sdp};t.customizeSdp(e),A.sdp=e.sdp,aA.log("Setting local description"),u&&a&&("chrome"===aA.webRTCAdapter.browserDetails.browser||"safari"===aA.webRTCAdapter.browserDetails.browser?(aA.log("Enabling Simulcasting for Chrome (SDP munging)"),A.sdp=function(A){for(var e=A.split("\r\n"),t=!1,i=[-1],n=[-1],a=null,r=null,o=null,s=null,g=-1,c=0;c-1){g=c;break}}else if(t){var l=e[c].match(/a=ssrc-group:FID (\d+) (\d+)/);if(l)i[0]=l[1],n[0]=l[2],e.splice(c,1),c--;else{if(i[0]){if((d=e[c].match("a=ssrc:"+i[0]+" cname:(.+)"))&&(a=d[1]),(d=e[c].match("a=ssrc:"+i[0]+" msid:(.+)"))&&(r=d[1]),(d=e[c].match("a=ssrc:"+i[0]+" mslabel:(.+)"))&&(o=d[1]),(d=e[c].match("a=ssrc:"+i[0]+" label:(.+)"))&&(s=d[1]),0===e[c].indexOf("a=ssrc:"+n[0])){e.splice(c,1),c--;continue}if(0===e[c].indexOf("a=ssrc:"+i[0])){e.splice(c,1),c--;continue}}0!=e[c].length||(e.splice(c,1),c--)}}}if(i[0]<0){g=-1,t=!1;for(c=0;c-1){g=c;break}}else if(t){if(i[0]<0){var C=e[c].match(/a=ssrc:(\d+)/);if(C){i[0]=C[1],e.splice(c,1),c--;continue}}else{var d;if((d=e[c].match("a=ssrc:"+i[0]+" cname:(.+)"))&&(a=d[1]),(d=e[c].match("a=ssrc:"+i[0]+" msid:(.+)"))&&(r=d[1]),(d=e[c].match("a=ssrc:"+i[0]+" mslabel:(.+)"))&&(o=d[1]),(d=e[c].match("a=ssrc:"+i[0]+" label:(.+)"))&&(s=d[1]),0===e[c].indexOf("a=ssrc:"+n[0])){e.splice(c,1),c--;continue}if(0===e[c].indexOf("a=ssrc:"+i[0])){e.splice(c,1),c--;continue}}0!=e[c].length||(e.splice(c,1),c--)}}}if(i[0]<0)return aA.warn("Couldn't find the video SSRC, simulcasting NOT enabled"),A;g<0&&(g=e.length);i[1]=Math.floor(4294967295*Math.random()),i[2]=Math.floor(4294967295*Math.random()),n[1]=Math.floor(4294967295*Math.random()),n[2]=Math.floor(4294967295*Math.random());for(c=0;c0){for(var n=0;n0)for(var c in g){var l=g[c];l.sender&&l.sender.track&&"audio"===l.sender.track.kind||l.receiver&&l.receiver.track&&"audio"===l.receiver.track.kind?o||(o=l):(l.sender&&l.sender.track&&"video"===l.sender.track.kind||l.receiver&&l.receiver.track&&"video"===l.receiver.track.kind)&&(s||(s=l))}var I=V(e),C=W(e);if(I||C){if(I&&C){if(o)try{o.setDirection?o.setDirection("sendrecv"):o.direction="sendrecv",aA.log("Setting audio transceiver to sendrecv:",o)}catch(A){aA.error(A)}}else if(I&&!C)try{o&&(o.setDirection?o.setDirection("sendonly"):o.direction="sendonly",aA.log("Setting audio transceiver to sendonly:",o))}catch(A){aA.error(A)}else if(!I&&C)if(o)try{o.setDirection?o.setDirection("recvonly"):o.direction="recvonly",aA.log("Setting audio transceiver to recvonly:",o)}catch(A){aA.error(A)}else o=n.pc.addTransceiver("audio",{direction:"recvonly"}),aA.log("Adding recvonly audio transceiver:",o)}else if(e.removeAudio&&o)try{o.setDirection?o.setDirection("inactive"):o.direction="inactive",aA.log("Setting audio transceiver to inactive:",o)}catch(A){aA.error(A)}var d=j(e),h=O(e);if(d||h){if(d&&h){if(s)try{s.setDirection?s.setDirection("sendrecv"):s.direction="sendrecv",aA.log("Setting video transceiver to sendrecv:",s)}catch(A){aA.error(A)}}else if(d&&!h){if(s)try{s.setDirection?s.setDirection("sendonly"):s.direction="sendonly",aA.log("Setting video transceiver to sendonly:",s)}catch(A){aA.error(A)}}else if(!d&&h)if(s)try{s.setDirection?s.setDirection("recvonly"):s.direction="recvonly",aA.log("Setting video transceiver to recvonly:",s)}catch(A){aA.error(A)}else s=n.pc.addTransceiver("video",{direction:"recvonly"}),aA.log("Adding recvonly video transceiver:",s)}else if(e.removeVideo&&s)try{s.setDirection?s.setDirection("inactive"):s.direction="inactive",aA.log("Setting video transceiver to inactive:",s)}catch(A){aA.error(A)}}else r="firefox"==aA.webRTCAdapter.browserDetails.browser||"edge"==aA.webRTCAdapter.browserDetails.browser?{offerToReceiveAudio:W(e),offerToReceiveVideo:O(e)}:{mandatory:{OfferToReceiveAudio:W(e),OfferToReceiveVideo:O(e)}};aA.debug(r);var B=j(e);if(B&&a&&"firefox"===aA.webRTCAdapter.browserDetails.browser){aA.log("Enabling Simulcasting for Firefox (RID)");var u=n.pc.getSenders()[1];aA.log(u);var E=u.getParameters();aA.log(E);var Q=f(t.simulcastMaxBitrates);u.setParameters({encodings:[{rid:"high",active:!0,priority:"high",maxBitrate:Q.high},{rid:"medium",active:!0,priority:"medium",maxBitrate:Q.medium},{rid:"low",active:!0,priority:"low",maxBitrate:Q.low}]})}n.pc.createAnswer(r).then((function(A){aA.debug(A);var e={type:A.type,sdp:A.sdp};t.customizeSdp(e),A.sdp=e.sdp,aA.log("Setting local description"),B&&a&&("chrome"===aA.webRTCAdapter.browserDetails.browser?aA.warn("simulcast=true, but this is an answer, and video breaks in Chrome if we enable it"):"firefox"!==aA.webRTCAdapter.browserDetails.browser&&aA.warn("simulcast=true, but this is not Chrome nor Firefox, ignoring")),n.mySdp=A.sdp,n.pc.setLocalDescription(A).catch(t.error),n.mediaConstraints=r,n.iceDone||n.trickle?t.success(A):aA.log("Waiting for all candidates...")}),t.error)}(A,t,i)}),i.error)}function T(A,e,t){(t=t||{}).success="function"==typeof t.success?t.success:aA.noop,t.error="function"==typeof t.error?t.error:H;var i=t.jsep;if(e&&i)return aA.error("Provided a JSEP to a createOffer"),void t.error("Provided a JSEP to a createOffer");if(!(e||i&&i.type&&i.sdp))return aA.error("A valid JSEP is required for createAnswer"),void t.error("A valid JSEP is required for createAnswer");t.media=t.media||{audio:!0,video:!0};var a=t.media,r=p[A];if(null==r||null===r.webrtcStuff||void 0===r.webrtcStuff)return aA.warn("Invalid handle"),void t.error("Invalid handle");var o,s=r.webrtcStuff;if(s.trickle=(o=t.trickle,aA.debug("isTrickleEnabled:",o),null==o||!0===o),void 0===s.pc||null===s.pc)a.update=!1,a.keepAudio=!1,a.keepVideo=!1;else if(void 0!==s.pc&&null!==s.pc){if(aA.log("Updating existing media session"),a.update=!0,null!==t.stream&&void 0!==t.stream)t.stream!==s.myStream&&aA.log("Renegotiation involves a new external stream");else{if(a.addAudio){if(a.keepAudio=!1,a.replaceAudio=!1,a.removeAudio=!1,a.audioSend=!0,s.myStream&&s.myStream.getAudioTracks()&&s.myStream.getAudioTracks().length)return aA.error("Can't add audio stream, there already is one"),void t.error("Can't add audio stream, there already is one")}else a.removeAudio?(a.keepAudio=!1,a.replaceAudio=!1,a.addAudio=!1,a.audioSend=!1):a.replaceAudio&&(a.keepAudio=!1,a.addAudio=!1,a.removeAudio=!1,a.audioSend=!0);if(null===s.myStream||void 0===s.myStream?(a.replaceAudio&&(a.keepAudio=!1,a.replaceAudio=!1,a.addAudio=!0,a.audioSend=!0),V(a)&&(a.keepAudio=!1,a.addAudio=!0)):null===s.myStream.getAudioTracks()||void 0===s.myStream.getAudioTracks()||0===s.myStream.getAudioTracks().length?(a.replaceAudio&&(a.keepAudio=!1,a.replaceAudio=!1,a.addAudio=!0,a.audioSend=!0),V(a)&&(a.keepVideo=!1,a.addAudio=!0)):!V(a)||a.removeAudio||a.replaceAudio||(a.keepAudio=!0),a.addVideo){if(a.keepVideo=!1,a.replaceVideo=!1,a.removeVideo=!1,a.videoSend=!0,s.myStream&&s.myStream.getVideoTracks()&&s.myStream.getVideoTracks().length)return aA.error("Can't add video stream, there already is one"),void t.error("Can't add video stream, there already is one")}else a.removeVideo?(a.keepVideo=!1,a.replaceVideo=!1,a.addVideo=!1,a.videoSend=!1):a.replaceVideo&&(a.keepVideo=!1,a.addVideo=!1,a.removeVideo=!1,a.videoSend=!0);null===s.myStream||void 0===s.myStream||null===s.myStream.getVideoTracks()||void 0===s.myStream.getVideoTracks()||0===s.myStream.getVideoTracks().length?(a.replaceVideo&&(a.keepVideo=!1,a.replaceVideo=!1,a.addVideo=!0,a.videoSend=!0),j(a)&&(a.keepVideo=!1,a.addVideo=!0)):!j(a)||a.removeVideo||a.replaceVideo||(a.keepVideo=!0),a.addData&&(a.data=!0)}if(V(a)&&a.keepAudio&&j(a)&&a.keepVideo)return r.consentDialog(!1),void M(A,i,a,t,s.myStream)}if(a.update&&!s.streamExternal){if(a.removeAudio||a.replaceAudio){if(s.myStream&&s.myStream.getAudioTracks()&&s.myStream.getAudioTracks().length){var g=s.myStream.getAudioTracks()[0];aA.log("Removing audio track:",g),s.myStream.removeTrack(g);try{g.stop()}catch(A){}}if(s.pc.getSenders()&&s.pc.getSenders().length){var c=!0;if(a.replaceAudio&&aA.unifiedPlan&&(c=!1),c)for(var l in s.pc.getSenders()){(g=s.pc.getSenders()[l])&&g.track&&"audio"===g.track.kind&&(aA.log("Removing audio sender:",g),s.pc.removeTrack(g))}}}if(a.removeVideo||a.replaceVideo){if(s.myStream&&s.myStream.getVideoTracks()&&s.myStream.getVideoTracks().length){g=s.myStream.getVideoTracks()[0];aA.log("Removing video track:",g),s.myStream.removeTrack(g);try{g.stop()}catch(A){}}if(s.pc.getSenders()&&s.pc.getSenders().length){var I=!0;if(a.replaceVideo&&aA.unifiedPlan&&(I=!1),I)for(var l in s.pc.getSenders()){(g=s.pc.getSenders()[l])&&g.track&&"video"===g.track.kind&&(aA.log("Removing video sender:",g),s.pc.removeTrack(g))}}}}if(null!==t.stream&&void 0!==t.stream){var C=t.stream;if(aA.log("MediaStream provided by the application"),aA.debug(C),a.update&&s.myStream&&s.myStream!==t.stream&&!s.streamExternal){try{var d=s.myStream.getTracks();for(var h in d){var B=d[h];aA.log(B),null!=B&&B.stop()}}catch(A){}s.myStream=null}return s.streamExternal=!0,r.consentDialog(!1),void M(A,i,a,t,C)}if(V(a)||j(a)){if(!aA.isGetUserMediaAvailable())return void t.error("getUserMedia not available");var u={mandatory:{},optional:[]};r.consentDialog(!0);var E=V(a);!0===E&&null!=a&&null!=a&&"object"===n(a.audio)&&(E=a.audio);var f=j(a);if(!0===f&&null!=a&&null!=a){var Q=!0===t.simulcast,x=!0===t.simulcast2;if(!Q&&!x||i||void 0!==a.video&&!1!==a.video||(a.video="hires"),a.video&&"screen"!=a.video&&"window"!=a.video)if("object"===n(a.video))f=a.video;else{var m=0,y=0;"lowres"===a.video?(y=240,m=320):"lowres-16:9"===a.video?(y=180,m=320):"hires"===a.video||"hires-16:9"===a.video||"hdres"===a.video?(y=720,m=1280):"fhdres"===a.video?(y=1080,m=1920):"4kres"===a.video?(y=2160,m=3840):"stdres"===a.video?(y=480,m=640):"stdres-16:9"===a.video?(y=360,m=640):(aA.log("Default video setting is stdres 4:3"),y=480,m=640),aA.log("Adding media constraint:",a.video),f={height:{ideal:y},width:{ideal:m}},aA.log("Adding video constraint:",f)}else if("screen"===a.video||"window"===a.video){var _=function(e,n){r.consentDialog(!1),e?t.error(e):M(A,i,a,t,n)},S=function(A,e,t){aA.log("Adding media constraint (screen capture)"),aA.debug(A),navigator.mediaDevices.getUserMedia(A).then((function(A){t?navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){A.addTrack(t.getAudioTracks()[0]),e(null,A)})):e(null,A)})).catch((function(A){r.consentDialog(!1),e(A)}))};if(a.screenshareFrameRate||(a.screenshareFrameRate=3),navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return void navigator.mediaDevices.getDisplayMedia({video:!0}).then((function(e){r.consentDialog(!1),V(a)&&!a.keepAudio?navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(n){e.addTrack(n.getAudioTracks()[0]),M(A,i,a,t,e)})):M(A,i,a,t,e)}),(function(A){r.consentDialog(!1),t.error(A)}));if("chrome"===aA.webRTCAdapter.browserDetails.browser){var D=aA.webRTCAdapter.browserDetails.version,w=33;window.navigator.userAgent.match("Linux")&&(w=35),D>=26&&D<=w?(u={video:{mandatory:{googLeakyBucket:!0,maxWidth:window.screen.width,maxHeight:window.screen.height,minFrameRate:a.screenshareFrameRate,maxFrameRate:a.screenshareFrameRate,chromeMediaSource:"screen"}},audio:V(a)&&!a.keepAudio},S(u,_)):aA.extension.getScreen((function(A,e){if(A)return r.consentDialog(!1),t.error(A);(u={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",maxWidth:window.screen.width,maxHeight:window.screen.height,minFrameRate:a.screenshareFrameRate,maxFrameRate:a.screenshareFrameRate},optional:[{googLeakyBucket:!0},{googTemporalLayeredScreencast:!0}]}}).video.mandatory.chromeMediaSourceId=e,S(u,_,V(a)&&!a.keepAudio)}))}else if("firefox"===aA.webRTCAdapter.browserDetails.browser){if(!(aA.webRTCAdapter.browserDetails.version>=33)){var v=new Error("NavigatorUserMediaError");return v.name="Your version of Firefox does not support screen sharing, please install Firefox 33 (or more recent versions)",r.consentDialog(!1),void t.error(v)}u={video:{mozMediaSource:a.video,mediaSource:a.video},audio:V(a)&&!a.keepAudio},S(u,(function(A,e){if(_(A,e),!A)var t=e.currentTime,i=window.setInterval((function(){e||window.clearInterval(i),e.currentTime==t&&(window.clearInterval(i),e.onended&&e.onended()),t=e.currentTime}),500)}))}return}}null!=a&&"screen"===a.video||navigator.mediaDevices.enumerateDevices().then((function(e){var o=e.some((function(A){return"audioinput"===A.kind})),s=function(A){if(aA.debug("isScreenSendEnabled:",A),null==A)return!1;if("object"!==n(A.video)||"object"!==n(A.video.mandatory))return!1;var e=A.video.mandatory;if(e.chromeMediaSource)return"desktop"===e.chromeMediaSource||"screen"===e.chromeMediaSource;if(e.mozMediaSource)return"window"===e.mozMediaSource||"screen"===e.mozMediaSource;if(e.mediaSource)return"window"===e.mediaSource||"screen"===e.mediaSource;return!1}(a)||e.some((function(A){return"videoinput"===A.kind})),g=V(a),c=j(a),l=function(A){return aA.debug("isAudioSendRequired:",A),null!=A&&(!1!==A.audio&&!1!==A.audioSend&&(void 0!==A.failIfNoAudio&&null!==A.failIfNoAudio&&!0===A.failIfNoAudio))}(a),I=function(A){return aA.debug("isVideoSendRequired:",A),null!=A&&(!1!==A.video&&!1!==A.videoSend&&(void 0!==A.failIfNoVideo&&null!==A.failIfNoVideo&&!0===A.failIfNoVideo))}(a);if(g||c||l||I){var d=!!g&&o,h=!!c&&s;if(!d&&!h)return r.consentDialog(!1),t.error("No capture device found"),!1;if(!d&&l)return r.consentDialog(!1),t.error("Audio capture is required, but no capture device found"),!1;if(!h&&I)return r.consentDialog(!1),t.error("Video capture is required, but no capture device found"),!1}var B={audio:!(!o||a.keepAudio)&&E,video:!(!s||a.keepVideo)&&f};aA.debug("getUserMedia constraints",B),B.audio||B.video?navigator.mediaDevices.getUserMedia(B).then((function(e){r.consentDialog(!1),M(A,i,a,t,e)})).catch((function(A){r.consentDialog(!1),t.error({code:A.code,name:A.name,message:A.message})})):(r.consentDialog(!1),M(A,i,a,t,C))})).catch((function(A){r.consentDialog(!1),t.error("enumerateDevices error",A)}))}else M(A,i,a,t)}function L(A,e){(e=e||{}).success="function"==typeof e.success?e.success:aA.noop,e.error="function"==typeof e.error?e.error:H;var t=e.jsep,i=p[A];if(null==i||null===i.webrtcStuff||void 0===i.webrtcStuff)return aA.warn("Invalid handle"),void e.error("Invalid handle");var n=i.webrtcStuff;if(null!=t){if(null===n.pc)return aA.warn("Wait, no PeerConnection?? if this is an answer, use createAnswer and not handleRemoteJsep"),void e.error("No PeerConnection: if this is an answer, use createAnswer and not handleRemoteJsep");n.pc.setRemoteDescription(t).then((function(){if(aA.log("Remote description accepted!"),n.remoteSdp=t.sdp,n.candidates&&n.candidates.length>0){for(var A=0;A-1)&&"inbound-rtp"===A.type&&A.id.indexOf("rtcp")<0?e=!0:"ssrc"!=A.type||!A.bytesReceived||"VP8"!==A.googCodecName&&""!==A.googCodecName||(e=!0),e)if(t.bitrate.bsnow=A.bytesReceived,t.bitrate.tsnow=A.timestamp,null===t.bitrate.bsbefore||null===t.bitrate.tsbefore)t.bitrate.bsbefore=t.bitrate.bsnow,t.bitrate.tsbefore=t.bitrate.tsnow;else{var i=t.bitrate.tsnow-t.bitrate.tsbefore;"safari"==aA.webRTCAdapter.browserDetails.browser&&(i/=1e3);var n=Math.round(8*(t.bitrate.bsnow-t.bitrate.bsbefore)/i);"safari"===aA.webRTCAdapter.browserDetails.browser&&(n=parseInt(n/1e3)),t.bitrate.value=n+" kbits/sec",t.bitrate.bsbefore=t.bitrate.bsnow,t.bitrate.tsbefore=t.bitrate.tsnow}}}))}))}),1e3),"0 kbits/sec"):t.bitrate.value:(aA.warn("Getting the video bitrate unsupported by browser"),"Feature unsupported by browser")}function H(A){aA.error("WebRTC error:",A)}function K(A,i){aA.log("Cleaning WebRTC stuff");var n=p[A];if(null!=n){var a=n.webrtcStuff;if(null!=a){if(!0===i){var r={rtcgw:"hangup",transaction:aA.randomString(12)};null!==n.token&&void 0!==n.token&&(r.token=n.token),null!=B&&(r.apisecret=B),aA.debug("Sending hangup request (handle="+A+"):"),aA.debug(r),e?(r.session_id=x,r.handle_id=A,t.send(JSON.stringify(r))):aA.httpAPICall(s+"/"+x+"/"+A,{verb:"POST",withCredentials:C,body:r})}a.remoteStream=null,a.volume&&(a.volume.local&&a.volume.local.timer&&clearInterval(a.volume.local.timer),a.volume.remote&&a.volume.remote.timer&&clearInterval(a.volume.remote.timer)),a.volume={},a.bitrate.timer&&clearInterval(a.bitrate.timer),a.bitrate.timer=null,a.bitrate.bsnow=null,a.bitrate.bsbefore=null,a.bitrate.tsnow=null,a.bitrate.tsbefore=null,a.bitrate.value=null;try{if(!a.streamExternal&&null!==a.myStream&&void 0!==a.myStream){aA.log("Stopping local stream tracks");var o=a.myStream.getTracks();for(var g in o){var c=o[g];aA.log(c),null!=c&&c.stop()}}}catch(A){}a.streamExternal=!1,a.myStream=null;try{a.pc.close()}catch(A){}a.pc=null,a.candidates=null,a.mySdp=null,a.remoteSdp=null,a.iceDone=!1,a.dataChannel={},a.dtmfSender=null}n.oncleanup()}}function V(A){return aA.debug("isAudioSendEnabled:",A),null==A||!1!==A.audio&&(void 0===A.audioSend||null===A.audioSend||!0===A.audioSend)}function W(A){return aA.debug("isAudioRecvEnabled:",A),null==A||!1!==A.audio&&(void 0===A.audioRecv||null===A.audioRecv||!0===A.audioRecv)}function j(A){return aA.debug("isVideoSendEnabled:",A),null==A||!1!==A.video&&(void 0===A.videoSend||null===A.videoSend||!0===A.videoSend)}function O(A){return aA.debug("isVideoRecvEnabled:",A),null==A||!1!==A.video&&(void 0===A.videoRecv||null===A.videoRecv||!0===A.videoRecv)}v(A),this.getServer=function(){return s},this.isConnected=function(){return Q},this.reconnect=function(A){(A=A||{}).success="function"==typeof A.success?A.success:aA.noop,A.error="function"==typeof A.error?A.error:aA.noop,A.reconnect=!0,v(A)},this.getSessionId=function(){return x},this.destroy=function(n){!function(n){n=n||{},n.success="function"==typeof n.success?n.success:aA.noop;var r=!0;void 0!==n.asyncRequest&&null!==n.asyncRequest&&(r=!0===n.asyncRequest);var o=!0;void 0!==n.notifyDestroyed&&null!==n.notifyDestroyed&&(o=!0===n.notifyDestroyed);var g=!1;void 0!==n.cleanupHandles&&null!==n.cleanupHandles&&(g=!0===n.cleanupHandles);if(aA.log("Destroying session "+x+" (async="+r+")"),!Q)return aA.warn("Is the server down? (connected=false)"),void n.success();if(null==x)return aA.warn("No session to destroy"),n.success(),void(o&&A.destroyed());if(g)for(var c in p)N(c,{noRequest:!0});var l={rtcgw:"destroy",transaction:aA.randomString(12)};null!=h&&(l.token=h);null!=B&&(l.apisecret=B);if(e){l.session_id=x;var I=function(){for(var A in i)t.removeEventListener(A,i[A]);t.removeEventListener("message",d),t.removeEventListener("error",u),a&&clearTimeout(a),t.close()},d=function(e){var t=JSON.parse(e.data);t.session_id==l.session_id&&t.transaction==l.transaction&&(I(),n.success(),o&&A.destroyed())},u=function(e){I(),n.error("Failed to destroy the server: Is the server down?"),o&&A.destroyed()};return t.addEventListener("message",d),t.addEventListener("error",u),void t.send(JSON.stringify(l))}aA.httpAPICall(s+"/"+x,{verb:"POST",async:r,withCredentials:C,body:l,success:function(e){aA.log("Destroyed session:"),aA.debug(e),x=null,Q=!1,"success"!==e.rtcgw&&aA.error("Ooops: "+e.error.code+" "+e.error.reason),n.success(),o&&A.destroyed()},error:function(e,t){aA.error(e+":",t),x=null,Q=!1,n.success(),o&&A.destroyed()}})}(n)},this.attach=function(A){!function(A){if(A=A||{},A.success="function"==typeof A.success?A.success:aA.noop,A.error="function"==typeof A.error?A.error:aA.noop,A.consentDialog="function"==typeof A.consentDialog?A.consentDialog:aA.noop,A.iceState="function"==typeof A.iceState?A.iceState:aA.noop,A.mediaState="function"==typeof A.mediaState?A.mediaState:aA.noop,A.webrtcState="function"==typeof A.webrtcState?A.webrtcState:aA.noop,A.slowLink="function"==typeof A.slowLink?A.slowLink:aA.noop,A.onmessage="function"==typeof A.onmessage?A.onmessage:aA.noop,A.onlocalstream="function"==typeof A.onlocalstream?A.onlocalstream:aA.noop,A.onremotestream="function"==typeof A.onremotestream?A.onremotestream:aA.noop,A.ondata="function"==typeof A.ondata?A.ondata:aA.noop,A.ondataopen="function"==typeof A.ondataopen?A.ondataopen:aA.noop,A.oncleanup="function"==typeof A.oncleanup?A.oncleanup:aA.noop,A.ondetached="function"==typeof A.ondetached?A.ondetached:aA.noop,!Q)return aA.warn("Is the server down? (connected=false)"),void A.error("Is the server down? (connected=false)");var i=A.plugin;if(null==i)return aA.error("Invalid plugin"),void A.error("Invalid plugin");var n=A.opaqueId,a=A.token?A.token:h,r=aA.randomString(12),o={rtcgw:"attach",plugin:i,opaque_id:n,transaction:r};null!=a&&(o.token=a);null!=B&&(o.apisecret=B);if(e)return _[r]=function(e){if(aA.debug(e),"success"!==e.rtcgw)return aA.error("Ooops: "+e.error.code+" "+e.error.reason),void A.error("Ooops: "+e.error.code+" "+e.error.reason);var t=e.data.id;aA.log("Created handle: "+t);var n={session:m,plugin:i,id:t,token:a,detached:!1,webrtcStuff:{started:!1,myStream:null,streamExternal:!1,remoteStream:null,mySdp:null,mediaConstraints:null,pc:null,dataChannel:{},dtmfSender:null,trickle:!0,iceDone:!1,volume:{value:null,timer:null},bitrate:{value:null,bsnow:null,bsbefore:null,tsnow:null,tsbefore:null,timer:null}},getId:function(){return t},getPlugin:function(){return i},getVolume:function(){return Y(t,!0)},getRemoteVolume:function(){return Y(t,!0)},getLocalVolume:function(){return Y(t,!1)},isAudioMuted:function(){return G(t,!1)},muteAudio:function(){return U(t,!1,!0)},unmuteAudio:function(){return U(t,!1,!1)},isVideoMuted:function(){return G(t,!0)},muteVideo:function(){return U(t,!0,!0)},unmuteVideo:function(){return U(t,!0,!1)},getBitrate:function(){return J(t)},send:function(A){F(t,A)},data:function(A){k(t,A)},dtmf:function(A){P(t,A)},consentDialog:A.consentDialog,iceState:A.iceState,mediaState:A.mediaState,webrtcState:A.webrtcState,slowLink:A.slowLink,onmessage:A.onmessage,createOffer:function(A){T(t,!0,A)},createAnswer:function(A){T(t,!1,A)},handleRemoteJsep:function(A){L(t,A)},onlocalstream:A.onlocalstream,onremotestream:A.onremotestream,ondata:A.ondata,ondataopen:A.ondataopen,oncleanup:A.oncleanup,ondetached:A.ondetached,hangup:function(A){K(t,!0===A)},detach:function(A){N(t,A)}};p[t]=n,A.success(n)},o.session_id=x,void t.send(JSON.stringify(o));aA.httpAPICall(s+"/"+x,{verb:"POST",withCredentials:C,body:o,success:function(e){if(aA.debug(e),"success"!==e.rtcgw)return aA.error("Ooops: "+e.error.code+" "+e.error.reason),void A.error("Ooops: "+e.error.code+" "+e.error.reason);var t=e.data.id;aA.log("Created handle: "+t);var n={session:m,plugin:i,id:t,token:a,detached:!1,webrtcStuff:{started:!1,myStream:null,streamExternal:!1,remoteStream:null,mySdp:null,mediaConstraints:null,pc:null,dataChannel:{},dtmfSender:null,trickle:!0,iceDone:!1,volume:{value:null,timer:null},bitrate:{value:null,bsnow:null,bsbefore:null,tsnow:null,tsbefore:null,timer:null}},getId:function(){return t},getPlugin:function(){return i},getVolume:function(){return Y(t,!0)},getRemoteVolume:function(){return Y(t,!0)},getLocalVolume:function(){return Y(t,!1)},isAudioMuted:function(){return G(t,!1)},muteAudio:function(){return U(t,!1,!0)},unmuteAudio:function(){return U(t,!1,!1)},isVideoMuted:function(){return G(t,!0)},muteVideo:function(){return U(t,!0,!0)},unmuteVideo:function(){return U(t,!0,!1)},getBitrate:function(){return J(t)},send:function(A){F(t,A)},data:function(A){k(t,A)},dtmf:function(A){P(t,A)},consentDialog:A.consentDialog,iceState:A.iceState,mediaState:A.mediaState,webrtcState:A.webrtcState,slowLink:A.slowLink,onmessage:A.onmessage,createOffer:function(A){T(t,!0,A)},createAnswer:function(A){T(t,!1,A)},handleRemoteJsep:function(A){L(t,A)},onlocalstream:A.onlocalstream,onremotestream:A.onremotestream,ondata:A.ondata,ondataopen:A.ondataopen,oncleanup:A.oncleanup,ondetached:A.ondetached,hangup:function(A){K(t,!0===A)},detach:function(A){N(t,A)}};p[t]=n,A.success(n)},error:function(A,e){aA.error(A+":",e)}})}(A)}}aA.useDefaultDependencies=function(A){var e=A&&A.fetch||fetch,t=A&&A.Promise||Promise,i=A&&A.WebSocket||WebSocket;return{newWebSocket:function(A,e){return new i(A,e)},extension:A&&A.extension||nA,isArray:function(A){return Array.isArray(A)},webRTCAdapter:A&&A.adapter||window.adapter,httpAPICall:function(A,i){var a={method:i.verb,headers:{Accept:"application/json, text/plain, */*"},cache:"no-cache"};"POST"===i.verb&&(a.headers["Content-Type"]="application/json"),void 0!==i.withCredentials&&(a.credentials=!0===i.withCredentials?"include":i.withCredentials?i.withCredentials:"omit"),void 0!==i.body&&(a.body=JSON.stringify(i.body));var r=e(A,a).catch((function(A){return t.reject({message:"Probably a network error, is the server down?",error:A})}));if(void 0!==i.timeout){var o=new t((function(A,e){var t=setTimeout((function(){return clearTimeout(t),e({message:"Request timed out",timeout:i.timeout})}),i.timeout)}));r=t.race([r,o])}return r.then((function(A){return A.ok?n(i.success)===n(aA.noop)?A.json().then((function(A){i.success(A)})).catch((function(e){return t.reject({message:"Failed to parse response body",error:e,response:A})})):void 0:t.reject({message:"API call failed",response:A})})).catch((function(A){n(i.error)===n(aA.noop)&&i.error(A.message||"<< internal error >>",A)})),r}}},aA.useOldDependencies=function(A){var e=A&&A.jQuery||jQuery,t=A&&A.WebSocket||WebSocket;return{newWebSocket:function(A,e){return new t(A,e)},isArray:function(A){return e.isArray(A)},extension:A&&A.extension||nA,webRTCAdapter:A&&A.adapter||adapter,httpAPICall:function(A,t){var i=void 0!==t.body?{contentType:"application/json",data:JSON.stringify(t.body)}:{},a=void 0!==t.withCredentials?{xhrFields:{withCredentials:t.withCredentials}}:{};return e.ajax(e.extend(i,a,{url:A,type:t.verb,cache:!1,dataType:"json",async:t.async,timeout:t.timeout,success:function(A){n(t.success)===n(aA.noop)&&t.success(A)},error:function(A,e,i){n(t.error)===n(aA.noop)&&t.error(e,i)}}))}}},aA.noop=function(){},aA.dataChanDefaultLabel="JanusDataChannel",aA.endOfCandidates=null,aA.init=function(A){if((A=A||{}).callback="function"==typeof A.callback?A.callback:aA.noop,!0===aA.initDone)A.callback();else{if("undefined"!=typeof console&&void 0!==console.log||(console={log:function(){}}),aA.trace=aA.noop,aA.debug=aA.noop,aA.vdebug=aA.noop,aA.log=aA.noop,aA.warn=aA.noop,aA.error=aA.noop,!0===A.debug||"all"===A.debug)aA.trace=console.trace.bind(console),aA.debug=console.debug.bind(console),aA.vdebug=console.debug.bind(console),aA.log=console.log.bind(console),aA.warn=console.warn.bind(console),aA.error=console.error.bind(console);else if(Array.isArray(A.debug))for(var e in A.debug){var t=A.debug[e];switch(t){case"trace":aA.trace=console.trace.bind(console);break;case"debug":aA.debug=console.debug.bind(console);break;case"vdebug":aA.vdebug=console.debug.bind(console);break;case"log":aA.log=console.log.bind(console);break;case"warn":aA.warn=console.warn.bind(console);break;case"error":aA.error=console.error.bind(console);break;default:console.error("Unknown debugging option '"+t+"' (supported: 'trace', 'debug', 'vdebug', 'log', warn', 'error')")}}var i=A.dependencies||aA.useDefaultDependencies();aA.isArray=i.isArray,aA.webRTCAdapter=i.webRTCAdapter,aA.httpAPICall=i.httpAPICall,aA.newWebSocket=i.newWebSocket,aA.extension=i.extension,aA.extension.init(),aA.listDevices=function(A,e){A="function"==typeof A?A:aA.noop,null==e&&(e={audio:!0,video:!0}),aA.isGetUserMediaAvailable()?navigator.mediaDevices.getUserMedia(e).then((function(e){navigator.mediaDevices.enumerateDevices().then((function(t){aA.debug(t),A(t);try{var i=e.getTracks();for(var n in i){var a=i[n];null!=a&&a.stop()}}catch(A){}}))})).catch((function(e){aA.error(e),A([])})):(aA.warn("navigator.mediaDevices unavailable"),A([]))},aA.attachMediaStream=function(A,e){"chrome"===aA.webRTCAdapter.browserDetails.browser?aA.webRTCAdapter.browserDetails.version>=52?A.srcObject=e:aA.error("Error attaching stream to element"):A.srcObject=e},aA.reattachMediaStream=function(A,e){"chrome"===aA.webRTCAdapter.browserDetails.browser?aA.webRTCAdapter.browserDetails.version>=52?A.srcObject=e.srcObject:void 0!==A.src?A.src=e.src:aA.error("Error reattaching stream to element"):A.srcObject=e.srcObject};var n=["iPad","iPhone","iPod"].indexOf(navigator.platform)>=0?"pagehide":"beforeunload",a=window["on"+n];if(window.addEventListener(n,(function(A){for(var e in aA.log("Closing window"),aA.sessions)null!==aA.sessions[e]&&void 0!==aA.sessions[e]&&aA.sessions[e].destroyOnUnload&&(aA.log("Destroying session "+e),aA.sessions[e].destroy({asyncRequest:!1,notifyDestroyed:!1}));a&&"function"==typeof a&&a()})),aA.safariVp8=!1,"safari"===aA.webRTCAdapter.browserDetails.browser&&aA.webRTCAdapter.browserDetails.version>=605)if(RTCRtpSender&&RTCRtpSender.getCapabilities&&RTCRtpSender.getCapabilities("video")&&RTCRtpSender.getCapabilities("video").codecs&&RTCRtpSender.getCapabilities("video").codecs.length){for(var e in RTCRtpSender.getCapabilities("video").codecs){var r=RTCRtpSender.getCapabilities("video").codecs[e];if(r&&r.mimeType&&"video/vp8"===r.mimeType.toLowerCase()){aA.safariVp8=!0;break}}aA.safariVp8?aA.log("This version of Safari supports VP8"):aA.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu")}else{var o=new RTCPeerConnection({},{});o.createOffer({offerToReceiveVideo:!0}).then((function(A){aA.safariVp8=-1!==A.sdp.indexOf("VP8"),aA.safariVp8?aA.log("This version of Safari supports VP8"):aA.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu"),o.close(),o=null}))}if(aA.unifiedPlan=!1,"firefox"===aA.webRTCAdapter.browserDetails.browser&&aA.webRTCAdapter.browserDetails.version>=59)aA.unifiedPlan=!0;else if("chrome"===aA.webRTCAdapter.browserDetails.browser&&aA.webRTCAdapter.browserDetails.version<72)aA.unifiedPlan=!1;else if("undefined"==typeof RTCRtpTransceiver||"currentDirection"in RTCRtpTransceiver.prototype){var s=new RTCPeerConnection;try{s.addTransceiver("audio"),aA.unifiedPlan=!0}catch(A){}s.close()}else aA.unifiedPlan=!1;aA.initDone=!0,A.callback()}},aA.isWebrtcSupported=function(){return void 0!==window.RTCPeerConnection&&null!==window.RTCPeerConnection},aA.isGetUserMediaAvailable=function(){return void 0!==navigator.mediaDevices&&null!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia&&null!==navigator.mediaDevices.getUserMedia},aA.randomString=function(A){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="",i=0;i-1&&(window.EZUIKit.opt.talkType="gb28181"),A&&A(i.ttsUrl.indexOf("gb28181")>-1||-1!==window.EZUIKit.opt.deviceSerial.indexOf(":")),window.EZUIKit.opt.stream=i.stream,window.startTalk(),e.jSPlugin.eventEmitter&&e.jSPlugin.eventEmitter.emit("startTalk",{eventType:"startTalk",code:0,target:e,msg:"开启对讲"})}}else console.log(t.code,e.jSPlugin.i18n.t("server.talk."+t.code)),e.pluginStatus.loadingSetText({text:e.jSPlugin.i18n.t("server.talk."+t.code)||t.msg,color:"red",delayClear:2e3}),e.jSPlugin.eventEmitter&&e.jSPlugin.eventEmitter.emit("startTalk",{eventType:"startTalk",code:-1,target:e,msg:e.jSPlugin.i18n.t("server.talk."+t.code)||t.msg}),"function"==typeof e.jSPlugin.params.handleError&&e.jSPlugin.params.handleError({msg:t.msg,retcode:t.code,id:e.jSPlugin.params.id,type:"handleError"})})).catch((function(A){console.log("err",A)}))})).catch((function(A){console.log("对讲开启失败:",A)}))}},{key:"stopTalk",value:function(){window.stopTalk(),this.jSPlugin.eventEmitter&&this.jSPlugin.eventEmitter.emit("stopTalk",{eventType:"stopTalk",code:0,target:this,msg:"结束对讲"}),document.getElementById("myaudio")&&document.getElementById("myaudio").srcObject&&document.getElementById("myaudio").srcObject.getTracks()[0].stop()}},{key:"changeTalkChannelNo",value:function(A){window.EZUIKit.opt&&window.EZUIKit.opt.channelNo&&(this.talkChannelNo=A,window.EZUIKit.opt.channelNo=A)}}])}(),IA=function(){return o((function A(e){var t=this;a(this,A),this.jSPlugin=e,this.pluginStatus=new R(this,this.jSPlugin.id);var i=document.createElement("style");i.innerHTML="\n body{\n padding: 0;\n margin: 0;\n }\n #mobile-ez-ptz-container {\n display: inline-block;\n width: 375px;\n text-align: center;\n }\n .live-ptz-title{\n height: 25px;\n font-size: 18px;\n color: #2c2c2c;\n text-align: center;\n font-weight: 700;\n margin: 24px 0 12px;\n }\n .live-ptz-intro {\n margin-bottom: 24px;\n color: #aaaaaa;\n }\n .mobile-ez-ptz-wrap {\n background-image: linear-gradient(180deg, #f6f8ff 0%, #ededed6b 50%)\n }\n #mobile-ez-ptz-container .mobile-ez-ptz-container {\n position: relative;\n width: 260px;\n height: 260px;\n background: rgba(255, 255, 255, 0.80);\n border: 1px solid rgba(255, 255, 255, 0.80);\n border-radius: 100%;\n cursor: pointer;\n overflow: hidden;\n margin: auto;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.top {\n width: 0;\n height: 0;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-bottom: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n left: calc(50% - 6px);\n top: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.top.active {\n border-bottom-color: #1890FF;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.bottom {\n width: 0;\n height: 0;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-top: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n left: calc(50% - 6px);\n bottom: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.bottom.active {\n border-top-color: #1890FF;\n\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.right {\n width: 0;\n height: 0;\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n border-left: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n top: calc(50% - 6px);\n right: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.right.active {\n border-left-color: #1890FF;\n\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.left {\n width: 0;\n height: 0;\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n border-right: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n top: calc(50% - 6px);\n left: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.left.active {\n border-right-color: #1890FF;\n\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .ez-ptz-main.center {\n width: 52px;\n height: 52px;\n background: #FFFFFF;\n border: 2px solid #eee;\n border-radius: 100%;\n top: calc(50% - 26px);\n left: calc(50% - 26px);\n position: absolute;\n /* box-shadow: 0px -39px 40px 6px #1890ff; */\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-wrap {\n display: inline-block;\n padding: 24px 24px;\n border-radius: 100%;\n overflow: hidden;\n }\n\n #mobile-ez-ptz-container .ez-ptz-close {\n position: absolute;\n color: #FFFFFF;\n top: 0;\n right: 0px;\n }",document.getElementsByTagName("head")[0].appendChild(i);var n=document.createElement("div");n.className="mobile-ez-ptz-container",n.id="mobile-ez-ptz-container",n.style="display:inline-block;width: ".concat(this.jSPlugin.width,"px;text-align:center;");var r=document.createElement("div");r.className="live-ptz-title",r.id="live-ptz-title",r.innerHTML="云台控制",document.getElementById("live-ptz-title")||n.appendChild(r);var o=document.createElement("div");o.className="live-ptz-intro",o.id="live-ptz-intro",o.innerHTML="请通过操控云台来调整摄像机视角",document.getElementById("live-ptz-intro")||n.appendChild(o);var s=document.createElement("div");s.id="mobile-ez-ptz-item",s.className="mobile-ez-ptz-wrap",s.innerHTML='\n
\n
\n
\n
\n
\n
\n
\n ',document.getElementById("mobile-ez-ptz-item")||n.appendChild(s),E(n,document.getElementById("".concat(this.jSPlugin.id,"-wrap"))),document.getElementById("mobile-ez-ptz-item").ontouchstart=function(A){A.preventDefault(),console.log("触摸开始"),t._handlePtzTouch(A,"start")},document.getElementById("mobile-ez-ptz-item").ontouchend=function(A){A.preventDefault(),console.log("触摸结束",A),t._handlePtzTouch(A,"stop")},document.getElementById("mobile-ez-ptz-item").onmousedown=function(A){A.preventDefault(),console.log("触摸开始"),t._handlePtzTouch(A,"start")},document.getElementById("mobile-ez-ptz-item").onmouseup=function(A){A.preventDefault(),console.log("触摸结束",A),t._handlePtzTouch(A,"stop")}}),[{key:"show",value:function(){document.getElementById("mobile-ez-ptz-item").style="display: inline-block"}},{key:"hide",value:function(){document.getElementById("mobile-ez-ptz-item").style="display: none"}},{key:"_handlePtzTouch",value:function(A,e){var t=this,i=document.getElementById("mobile-ez-ptz-item").getBoundingClientRect(),n=i.left+130,a=i.top+130,r=(A.x||A.changedTouches[0].clientX)-n,o=(A.y||A.changedTouches[0].clientY)-a,s=0,g=this.jSPlugin.env.domain+"/api/lapp/device/ptz/start";Math.abs(r)>Math.abs(o)?r>0?(s=3,document.getElementsByClassName("mobile-ez-ptz-icon")[3].className=document.getElementsByClassName("mobile-ez-ptz-icon")[3].className.replace("default","active")):(s=2,document.getElementsByClassName("mobile-ez-ptz-icon")[1].className=document.getElementsByClassName("mobile-ez-ptz-icon")[1].className.replace("default","active")):o>0?(s=1,document.getElementsByClassName("mobile-ez-ptz-icon")[2].className=document.getElementsByClassName("mobile-ez-ptz-icon")[2].className.replace("default","active")):(s=0,document.getElementsByClassName("mobile-ez-ptz-icon")[0].className=document.getElementsByClassName("mobile-ez-ptz-icon")[0].className.replace("default","active")),document.getElementById("mobile-ez-ptz-item").style="background-image:linear-gradient(".concat(0===s?180:1===s?0:2===s?90:270,"deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)"),"stop"===e&&(g=this.jSPlugin.env.domain+"/api/lapp/device/ptz/stop",document.getElementById("mobile-ez-ptz-item").style="",document.getElementsByClassName("mobile-ez-ptz-icon")[3].className=document.getElementsByClassName("mobile-ez-ptz-icon")[3].className.replace("active","default"),document.getElementsByClassName("mobile-ez-ptz-icon")[1].className=document.getElementsByClassName("mobile-ez-ptz-icon")[1].className.replace("active","default"),document.getElementsByClassName("mobile-ez-ptz-icon")[2].className=document.getElementsByClassName("mobile-ez-ptz-icon")[2].className.replace("active","default"),document.getElementsByClassName("mobile-ez-ptz-icon")[0].className=document.getElementsByClassName("mobile-ez-ptz-icon")[0].className.replace("active","default"));var c=new FormData;c.append("deviceSerial",p(this.jSPlugin.url).deviceSerial),c.append("channelNo",p(this.jSPlugin.url).channelNo),c.append("speed",1),c.append("direction",s),c.append("accessToken",this.jSPlugin.accessToken),fetch(g,{method:"POST",body:c}).then((function(A){return A.json()})).then((function(A){if(200==A.code);else{console.log(A.code,t.jSPlugin.i18n.t("server.ptz."+e+"."+A.code));var i=t.jSPlugin.i18n.t("server.ptz."+e+"."+A.code)||A.msg;t.pluginStatus.loadingSetText({text:i,color:"red",delayClear:2e3}),60005!=A.code&&60002!=A.code&&60003!=A.code&&60004!=A.code||(document.getElementById("mobile-ez-ptz-item").style="background-image:linear-gradient(".concat(0===s?180:1===s?0:2===s?90:270,"deg, #f45656 0%, rgba(100,143,252,0.00) 50%)"))}})).catch((function(A){console.log("云台调用异常",A)}))}}])}(),CA={header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",iconId:"deviceID",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",iconId:"deviceName",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",iconId:"cloudRec",part:"right",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",iconId:"rec",part:"right",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"}]},footer:{color:"#FFFFFF",backgroundColor:"rgb(0 0 0 / 0%)",activeColor:"#1890FF",btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-0",iconId:"play",part:"left",defaultActive:1,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-1",iconId:"capturePicture",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-2",iconId:"sound",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-3",iconId:"pantile",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-4",iconId:"recordvideo",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-5",iconId:"talk",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-6",iconId:"hd",part:"right",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-7",iconId:"webExpend",part:"right",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-8",iconId:"expend",part:"right",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"}]}},dA={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:1},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:1},{iconId:"talk",part:"left",defaultActive:0,isrender:1},{iconId:"zoom",part:"left",defaultActive:0,isrender:1},{iconId:"hd",part:"right",defaultActive:0,isrender:1},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},hA={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:1},{iconId:"rec",part:"right",defaultActive:0,isrender:1}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:1},{iconId:"talk",part:"left",defaultActive:0,isrender:0},{iconId:"zoom",part:"left",defaultActive:0,isrender:1},{iconId:"speed",part:"right",defaultActive:0,isrender:1},{iconId:"hd",part:"right",defaultActive:0,isrender:0},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},BA={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:1},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:1},{iconId:"talk",part:"left",defaultActive:0,isrender:1},{iconId:"zoom",part:"left",defaultActive:0,isrender:1},{iconId:"speed",part:"right",defaultActive:0,isrender:0},{iconId:"hd",part:"right",defaultActive:0,isrender:1},{iconId:"webExpend",part:"right",defaultActive:0,isrender:1},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},uA={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"talk",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:1},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"zoom",part:"left",defaultActive:0,isrender:1},{iconId:"hd",part:"right",defaultActive:0,isrender:1},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},EA={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:0},{iconId:"deviceName",part:"left",defaultActive:0,isrender:0},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:0},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:0},{iconId:"sound",part:"left",defaultActive:1,isrender:0},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:0},{iconId:"talk",part:"left",defaultActive:0,isrender:0},{iconId:"zoom",part:"left",defaultActive:0,isrender:0},{iconId:"hd",part:"right",defaultActive:0,isrender:0},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:0}]}}},fA={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:0},{iconId:"talk",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:0},{iconId:"hd",part:"right",defaultActive:0,isrender:0},{iconId:"zoom",part:"left",defaultActive:0,isrender:0},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},QA={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:1},{iconId:"cloudRecord",part:"right",defaultActive:0,isrender:1},{iconId:"rec",part:"right",defaultActive:0,isrender:1}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:1},{iconId:"zoom",part:"left",defaultActive:0,isrender:1},{iconId:"speed",part:"right",defaultActive:0,isrender:1},{iconId:"hd",part:"right",defaultActive:0,isrender:0},{iconId:"webExpend",part:"right",defaultActive:0,isrender:1},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},xA={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:0},{iconId:"deviceName",part:"left",defaultActive:0,isrender:0},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"#00000080",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:0},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:0},{iconId:"sound",part:"left",defaultActive:1,isrender:0},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:0},{iconId:"talk",part:"left",defaultActive:0,isrender:0},{iconId:"zoom",part:"left",defaultActive:0,isrender:0},{iconId:"speed",part:"right",defaultActive:0,isrender:0},{iconId:"hd",part:"right",defaultActive:0,isrender:0},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:0}]}}},pA=[{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"pcLive",themeIntro:"PC直播全量版",themeName:"PC直播全量版",themeType:"webLive",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:BA.data.header,footer:BA.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"security",themeIntro:"PC直播安防版",themeName:"PC直播安防版",themeType:"webLive",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:uA.data.header,footer:uA.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"voice",themeIntro:"PC直播语音版",themeName:"PC直播语音版",themeType:"webLive",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:fA.data.header,footer:fA.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"simple",themeIntro:"PC直播极简版",themeName:"PC直播极简版",themeType:"webLive",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",poster:"",header:EA.data.header,footer:EA.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"pcRec",themeIntro:"PC回放全量版",themeName:"PC回放全量版",themeType:"webRec",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:QA.data.header,footer:QA.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"mobileLive",themeIntro:"Mobile直播全量版",themeName:"Mobile直播全量版",themeType:"mobileLive",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_GmAL5IhAABZs1vUK0s564.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:dA.data.header,footer:dA.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"mobileRec",themeIntro:"Mobile回放全量版",themeName:"Mobile回放全量版",themeType:"mobileRec",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_GmAL5IhAABZs1vUK0s564.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:hA.data.header,footer:hA.data.footer},{autoFocus:0,createTime:"2021-06-14T08:04:37.000Z",themeId:"miniRec",themeIntro:"Mobile回放全量版",themeName:"Mobile回放全量版",themeType:"mobileRec",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_GmAL5IhAABZs1vUK0s564.png",poster:"",header:xA.data.header,footer:xA.data.footer}],mA=function(){return o((function A(e){var t=this;a(this,A),this.jSPlugin=e,this.enableZoom=!1,this.videoWidth=1920,this.videoHeight=1080,this.currentScale=1,this.currentPosition={x:0,y:0,xPercent:.1,yPercent:.1,xCurrentVideo:0,yCurrentVideo:0,left:0,top:0,right:1920,bottom:1080},this.clientRect=document.getElementById(e.id).getBoundingClientRect(),this.DOM=document.getElementById(e.id);var i=document.createElement("div");i.id="".concat(e.id,"-zoom-container");var n=document.getElementById("".concat(e.id,"-audioControls")),r=48;n&&(r=n.offsetHeight);var o=e.isMobile?"\n -webkit-transform: scale(0.8);\n -moz-transform: scale(0.8);\n -ms-transform: scale(0.8);\n transform: scale(0.8);\n transform-origin: left bottom;":"";i.style="position: absolute;\n display:none;\n left: 12px;\n bottom: ".concat(e.isMobile?"".concat(r+6,"px"):"80px",";\n ").concat(o,"\n ");var s='\n \n
2.0X
\n
\n \n \n 放大\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n \n \n 缩小\n \n \n \n \n \n \n \n \n \n \n
\n \n ');if(i.innerHTML=s,document.getElementById("".concat(e.id,"-audioControls-left"))&&(document.getElementById("".concat(e.id,"-audioControls-left")).parentNode.appendChild(i),document.getElementById("".concat(e.id,"-addScale")).onclick=function(){t.addScale()},document.getElementById("".concat(e.id,"-subScale")).onclick=function(){t.subScale()}),e.jSPlugin)try{var g=e.jSPlugin._JSPlayM4_GetFrameInfo(0);this.videoWidth=g.width||e.width,this.videoHeight=g.height||e.height,this.currentPosition.right=g.width,this.currentPosition.bottom=g.height,e.jSPlugin.bEZoom=!0}catch(A){}this._event()}),[{key:"_event",value:function(){var A=this,e=setInterval((function(){var t=document.getElementById("".concat(A.jSPlugin.id,"-container-0"));clearInterval(e),A.jSPlugin.isMobile?t&&(t.addEventListener("touchstart",(function(e){return A.onTouchstart(e)})),t.addEventListener("touchend",(function(e){return A.onTouchend(e)}))):t&&(t.addEventListener("mousedown",(function(e){return A.onMouseDown(e)})),t.addEventListener("mouseup",(function(e){return A.onMouseUp(e)})))}),100)}},{key:"onMouseDown",value:function(A){if(1===this.currentScale)return!1;this.moveX=A.clientX,this.moveY=A.clientY}},{key:"onMouseUp",value:function(A){var e=this.currentPosition;if(1===this.currentScale)return!1;e.left=e.left-(A.clientX-this.moveX),e.top=e.top-(A.clientY-this.moveY),this.doScale()}},{key:"onTouchstart",value:function(A){if(1===this.currentScale)return!1;if(this.jSPlugin.use3DZoom||1===this.currentScale)return!1;if(!this.jSPlugin.beforeMobileZoomVerify())return!1;if(!this.inited){var e=this.jSPlugin.jSPlugin._JSPlayM4_GetFrameInfo(0);this.videoWidth=e.width,this.videoHeight=e.height,this.currentPosition.left=0,this.currentPosition.top=0,this.isMobileFullScreen?(this.currentPosition.right=e.height,this.currentPosition.bottom=e.width):(this.currentPosition.right=e.width,this.currentPosition.bottom=e.height),this.inited=!0}var t=A.touches[0];if(t){var i={clientX:0,clientY:0};i.clientX=t.clientX,i.clientY=t.clientY,this.point1=i}}},{key:"onTouchend",value:function(A){var e=this,t=this.currentPosition;if(1===this.currentScale)return!1;var i=A.changedTouches[0];this.isMobileFullScreen?(t.left=t.left-(i.clientY-e.point1.clientY),t.top=t.top+(i.clientX-e.point1.clientX)):(t.left=t.left-(i.clientX-e.point1.clientX),t.top=t.top-(i.clientY-e.point1.clientY)),e.doScale()}},{key:"renderDot",value:function(){var A=this.currentScale;document.getElementById("".concat(this.jSPlugin.id,"-scale-value"))&&(document.getElementById("".concat(this.jSPlugin.id,"-scale-value")).innerHTML="".concat(A,".0X")),document.getElementById("".concat(this.jSPlugin.id,"-line-dot"))&&(document.getElementById("".concat(this.jSPlugin.id,"-line-dot")).style.height="".concat((A-1)/7*100,"%")),document.getElementById("".concat(this.jSPlugin.id,"-scale-body-line-dot"))&&(document.getElementById("".concat(this.jSPlugin.id,"-scale-body-line-dot")).style.bottom="calc(".concat((A-1)/7*100,"% - 3px)"))}},{key:"getTopMostElement",value:function(A,e,t){var i=A?A.getBoundingClientRect():null,n=e?e.getBoundingClientRect():null,a=t?t.getBoundingClientRect():null;if(!i&&!n&&!a)return null;if(!i)return n.topthis.videoWidth-this.videoWidth/e&&(A.left=this.videoWidth-this.videoWidth/e),A.right=A.left+this.videoWidth/e,A.top=A.top+A.yPercent*(A.bottom-A.top)-this.videoHeight/e*.5,A.top<=0?A.top=0:A.top>this.videoHeight-this.videoHeight/e&&(A.top=this.videoHeight-this.videoHeight/e),A.bottom=A.top+this.videoHeight/e,A.left=parseInt(A.left,10),A.right=parseInt(A.right,10),A.top=parseInt(A.top,10),A.bottom=parseInt(A.bottom,10);try{A.left0&&void 0!==arguments[0]?arguments[0]:1;this.jSPlugin.eventEmitter&&this.jSPlugin.eventEmitter.emit("zoomAdd",{eventType:"zoomAdd",code:1,target:this,msg:"执行放大"});var e=this.currentScale,t=this.currentPosition;return e>=8?(console.log("达到最大倍率了"),this.jSPlugin.Message&&this.jSPlugin.Message.default("已经放大到最大倍数8.0X",document.getElementById("".concat(this.jSPlugin.id))),!1):(this.currentScale=this.currentScale+A,this.currentScale>8?(console.log("超出最大倍率"),this.jSPlugin.Message&&this.jSPlugin.Message.default("超出最大倍率8.0X",document.getElementById("".concat(this.jSPlugin.id))),!1):(t.xPercent=.5,t.yPercent=.5,void this.doScale()))}},{key:"subScale",value:function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.jSPlugin.eventEmitter&&this.jSPlugin.eventEmitter.emit("zoomSub",{eventType:"zoomSub",code:1,target:this,msg:"执行缩小"});var e=this.currentScale,t=this.currentPosition;return e<=1?(console.log("达到最小倍率了"),this.jSPlugin.Message&&this.jSPlugin.Message.default("已经缩小到最小倍数1.0X",document.getElementById("".concat(this.jSPlugin.id))),!1):e<=1?(console.log("达到最小倍率了"),!1):(this.currentScale=this.currentScale-A,this.currentScale<1?(console.log("超出最小倍率"),this.jSPlugin.Message&&this.jSPlugin.Message.default("超出最小倍率1.0X",document.getElementById("".concat(this.jSPlugin.id))),!1):(t.xPercent=.5,t.yPercent=.5,void this.doScale()))}},{key:"_JSPlayM4_SetDisplayRegion",value:function(A,e,t,i,n){this.jSPlugin&&this.jSPlugin.jSPlugin&&this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(A,e,t,i,n,this.isMobileFullScreen)}},{key:"isMobileFullScreen",get:function(){return!!(_()&&this.jSPlugin.Theme&&this.jSPlugin.Theme.decoderState&&this.jSPlugin.Theme.decoderState.state.expend)}}])}(),yA=function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},r={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},o="";r=Object.assign(r,a);var s=new Headers;Object.keys(r).map((function(A){s.append(A,r[A])})),r=s,Object.keys(Object.assign({},t)).forEach((function(A){var e=t[A];"string"==typeof t[A]&&(e=t[A].replace("%","%25")),void 0!==t[A]&&(o+="&".concat(A,"=").concat(encodeURIComponent(e)))})),o.length>0&&(o=-1!==["GET","PUT","DELETE"].indexOf(e.toUpperCase())?"?".concat(o.slice(1)):o.slice(1));var g=A+(-1!==["GET","PUT","DELETE"].indexOf(e.toUpperCase())?o:""),c={headers:r,method:e};"POST"===e&&(c.body=o),"POST"===e&&a&&"application/json"===a["Content-Type"]&&(c.body=JSON.stringify(t)),"GET"===e&&(-1===g.indexOf("?")?g+="?_r=".concat(Math.random()):g+="&_r=".concat(Math.random())),fetch(g,c).then((function(A){var e=A.headers.get("content-type");return e&&-1!==e.indexOf("application/json")?A.json():A.text()})).then((function(A){i&&i(A)})).catch((function(A){n&&n(A)}))},_A=function(A,e,t,i,n,a){return'\nn?48:32,"px;height: ").concat(i>n?48:32,"px;line-height: ").concat(i>n?48:30,'px;text-align: center;">\n ').concat(DA[a.level],"\n\n")},SA=[{name:"标清",level:1,streamTypeIn:1,icon:_A},{name:"高清",level:2,streamTypeIn:1,icon:_A}],DA={0:"流畅",1:"标清",2:"高清",3:"超清",4:"极清",5:"3K",6:"4k"},wA=function(A,e,t,i){var n="".concat(A.env.domain,"/api/service/media/template/getDetail?accessToken=").concat(A.accessToken,"&id=").concat(e);fetch(n,{method:"GET"}).then((function(A){return A.json()})).then((function(A){var e;console.log("get theme data",A),e=A,console.log(e),e.meta&&t(e)})).catch((function(A){var e;e=A,console.log(e),i(e)}))},vA=function(A,e,t,i){var n="".concat(A,"/api/service/device/capacity/video/quality?accessToken=").concat(e,"&deviceSerial=").concat(t,"&channelNo=").concat(i);return fetch(n,{method:"GET"}).then((function(A){return A.json()})).then((function(A){if(A.meta&&200===A.meta.code){if(A.data&&A.data.length>0){var e=[];return A.data.map((function(A){e.push({name:DA[A.videoLevel],level:A.videoLevel,streamTypeIn:A.streamTypeIn,icon:_A})})),e}return SA}return SA})).catch((function(){return SA}))};function FA(A){var e=new V,t=new FormData;for(var i in A)t.append(i,A[i]);return e.fetch("/api/lapp/device/info",{method:"POST",body:t})}var bA=function(A){var e="";return Object.keys(A).map((function(t,i){e+="".concat(t,":").concat(A[t]).concat(i0&&(this.autoFocus=parseInt(this.themeData.autoFocus),this.startAutoFocus(),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).addEventListener("click",(function(){document.getElementById("".concat(A.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(A.jSPlugin.id,"-audioControls")).style.opacity=1,document.getElementById("".concat(A.jSPlugin.id,"-audioControls")).style.pointerEvents="all"),A.startAutoFocus()}))),this.setDecoderState({cloudRec:"cloud.rec"===p(this.jSPlugin.url).type,rec:"rec"===p(this.jSPlugin.url).type,type:p(this.jSPlugin.url).type});else if(!this.themeInited)var n=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(n),A.jSPlugin.play(),A.themeInited=!0)}),50);b.findIndex(this.themeData.footer.btnList,(function(A){return"zoom"===A.iconId&&A.isrender>0}))>=0&&(this.isMobile&&!this.jSPlugin.use3DZoom&&(this.jSPlugin.beforeMobileZoomVerify=function(){return!!A.decoderState.state.play}),this.jSPlugin.Zoom=new mA(this.jSPlugin)),setTimeout((function(){document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen||A.jSPlugin.jSPlugin.JS_Resize(A.jSPlugin.width,A.jSPlugin.height-A._extendHeadeTimeLinrHight(!1,!1))}),50)}},{key:"setDecoderState",value:function(A){var e=this,t=this.themeData,i=t.header,n=t.footer;Object.keys(A).map((function(t,a){var r="#FFFFFF",o="#FFFFFF";switch(-1===i.btnList.findIndex((function(A){return A.iconId===t}))?(r=n.color.replace("-diy",""),o=n.activeColor.replace("-diy","")):(r=i.color.replace("-diy",""),o=n.activeColor.replace("-diy","")),t){case"play":A[t]?document.getElementById("".concat(e.jSPlugin.id,"-play"))&&(document.getElementById("".concat(e.jSPlugin.id,"-play-content")).children[0].children[0].style="display:inline-block",document.getElementById("".concat(e.jSPlugin.id,"-play-content")).children[0].children[1].style="display:none",document.getElementById("".concat(e.jSPlugin.id,"-play")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-play-content")).childNodes[0].children[0].style.fill=A[t]?o:r):document.getElementById("".concat(e.jSPlugin.id,"-play"))&&(document.getElementById("".concat(e.jSPlugin.id,"-play-content")).children[0].children[1].style="display:inline-block",document.getElementById("".concat(e.jSPlugin.id,"-play-content")).children[0].children[0].style="display:none",document.getElementById("".concat(e.jSPlugin.id,"-play")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-play-content")).childNodes[0].children[1].style.fill=A[t]?o:r);break;case"sound":document.getElementById("".concat(e.jSPlugin.id,"-sound"))&&(A[t]?(document.getElementById("".concat(e.jSPlugin.id,"-sound-content")).children[0].children[1].style="display:inline-block",document.getElementById("".concat(e.jSPlugin.id,"-sound-content")).children[0].children[0].style="display:none",document.getElementById("".concat(e.jSPlugin.id,"-sound")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-sound-content")).childNodes[0].children[1].style.fill=A[t]?o:r):(document.getElementById("".concat(e.jSPlugin.id,"-sound-content")).children[0].children[0].style="display:inline-block",document.getElementById("".concat(e.jSPlugin.id,"-sound-content")).children[0].children[1].style="display:none",document.getElementById("".concat(e.jSPlugin.id,"-sound")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-sound-content")).childNodes[0].children[0].style.fill=A[t]?o:r));break;case"recordvideo":document.getElementById("".concat(e.jSPlugin.id,"-recordvideo"))&&(document.getElementById("".concat(e.jSPlugin.id,"-recordvideo")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-recordvideo-content")).childNodes[0].style.fill=A[t]?o:r,A[t]?e.countTime("add",0):e.countTime("destroy",0));break;case"talk":document.getElementById("".concat(e.jSPlugin.id,"-talk"))&&(document.getElementById("".concat(e.jSPlugin.id,"-talk")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-talk-content")).childNodes[1].style.fill=A[t]?o:r);break;case"zoom":document.getElementById("".concat(e.jSPlugin.id,"-zoom"))&&(document.getElementById("".concat(e.jSPlugin.id,"-zoom")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-zoom-content")).childNodes[1].style.fill=A[t]?o:r);break;case"pantile":document.getElementById("".concat(e.jSPlugin.id,"-pantile"))&&(document.getElementById("".concat(e.jSPlugin.id,"-pantile")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-pantile-content")).childNodes[0].style.fill=A[t]?o:r);break;case"webExpend":A[t]?(document.getElementById("".concat(e.jSPlugin.id,"-webExpend"))&&(document.getElementById("".concat(e.jSPlugin.id,"-webExpend-content")).children[0].children[1].style="display:inline-block",document.getElementById("".concat(e.jSPlugin.id,"-webExpend-content")).children[0].children[0].style="display:none"),document.getElementById("".concat(e.jSPlugin.id,"-expend"))&&(document.getElementById("".concat(e.jSPlugin.id,"-expend")).className="disabled")):(document.getElementById("".concat(e.jSPlugin.id,"-webExpend"))&&(document.getElementById("".concat(e.jSPlugin.id,"-webExpend-content")).children[0].children[0].style="display:inline-block",document.getElementById("".concat(e.jSPlugin.id,"-webExpend-content")).children[0].children[1].style="display:none"),document.getElementById("".concat(e.jSPlugin.id,"-expend"))&&(document.getElementById("".concat(e.jSPlugin.id,"-expend")).className="")),document.getElementById("".concat(e.jSPlugin.id,"-webExpend"))&&(document.getElementById("".concat(e.jSPlugin.id,"-webExpend")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-webExpend-content")).childNodes[0].childNodes[0].style.fill=A[t]?o:r,document.getElementById("".concat(e.jSPlugin.id,"-webExpend-content")).childNodes[0].childNodes[1].style.fill=A[t]?o:r);break;case"capturePicture":document.getElementById("".concat(e.jSPlugin.id,"-capturePicture"))&&(document.getElementById("".concat(e.jSPlugin.id,"-capturePicture")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-capturePicture-content")).childNodes[0].style.fill=A[t]?o:r);break;case"expend":A[t]?(document.getElementById("".concat(e.jSPlugin.id,"-expend"))&&(document.getElementById("".concat(e.jSPlugin.id,"-expend-content")).children[0].children[1].style="display:inline-block",document.getElementById("".concat(e.jSPlugin.id,"-expend-content")).children[0].children[0].style="display:none"),document.getElementById("".concat(e.jSPlugin.id,"-webExpend"))&&(document.getElementById("".concat(e.jSPlugin.id,"-webExpend")).className="disabled")):(document.getElementById("".concat(e.jSPlugin.id,"-expend"))&&(document.getElementById("".concat(e.jSPlugin.id,"-expend-content")).children[0].children[0].style="display:inline-block",document.getElementById("".concat(e.jSPlugin.id,"-expend-content")).children[0].children[1].style="display:none"),document.getElementById("".concat(e.jSPlugin.id,"-webExpend"))&&(document.getElementById("".concat(e.jSPlugin.id,"-webExpend")).className="")),document.getElementById("".concat(e.jSPlugin.id,"-expend"))&&(document.getElementById("".concat(e.jSPlugin.id,"-expend")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-expend-content")).childNodes[0].childNodes[0].style.fill=A[t]?o:r,document.getElementById("".concat(e.jSPlugin.id,"-expend-content")).childNodes[0].childNodes[1].style.fill=A[t]?o:r);break;case"hd":break;case"speed":if(document.getElementById("".concat(e.jSPlugin.id,"-speed"))){var s=document.getElementById("".concat(e.jSPlugin.id,"-speed-content")).children[1].children[0];"not-allowed"!==s.style.cursor&&(s.style.color=A[t]?o:r,s.style.borderColor=A[t]?o:r)}document.getElementById("".concat(e.jSPlugin.id,"-select-mask"))&&(e.isMobile&&A[t]?document.getElementById("".concat(e.jSPlugin.id,"-select-mask")).style.display="block":document.getElementById("".concat(e.jSPlugin.id,"-select-mask")).style.display="none");break;case"cloudRec":document.getElementById("".concat(e.jSPlugin.id,"-cloudRec"))&&(document.getElementById("".concat(e.jSPlugin.id,"-cloudRec")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-cloudRec-content")).children[0].children[0].style.fill=A[t]?o:r),document.getElementById("".concat(e.jSPlugin.id,"-rec"))&&(document.getElementById("".concat(e.jSPlugin.id,"-rec")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-rec-content")).children[0].children[0].style.fill=A[t]?r:o);break;case"cloudRecord":var g=document.getElementById("".concat(e.jSPlugin.id,"-cloudRecord"));g&&(g.className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-cloudRecord-content")).children[0].children[0].style.fill=A[t]?o:r),document.getElementById("".concat(e.jSPlugin.id,"-rec"))&&(document.getElementById("".concat(e.jSPlugin.id,"-rec")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-rec-content")).children[0].children[0].style.fill=A[t]?r:o);break;case"rec":document.getElementById("".concat(e.jSPlugin.id,"-cloudRec"))&&(document.getElementById("".concat(e.jSPlugin.id,"-cloudRec")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-cloudRec-content")).children[0].children[0].style.fill=A[t]?r:o),document.getElementById("".concat(e.jSPlugin.id,"-cloudRecord"))&&(document.getElementById("".concat(e.jSPlugin.id,"-cloudRecord")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-cloudRecord-content")).children[0].children[0].style.fill=A[t]?r:o),document.getElementById("".concat(e.jSPlugin.id,"-rec"))&&(document.getElementById("".concat(e.jSPlugin.id,"-rec")).className=A[t]?"active":"",document.getElementById("".concat(e.jSPlugin.id,"-rec-content")).children[0].children[0].style.fill=A[t]?o:r)}e.decoderState.state=Object.assign(e.decoderState.state,A)}))}},{key:"startAutoFocus",value:function(){var A=this,e=this.autoFocus;this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.autoFocusTimer=setTimeout((function(){document.getElementById("".concat(A.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(A.jSPlugin.id,"-audioControls")).style.opacity=0,document.getElementById("".concat(A.jSPlugin.id,"-audioControls")).style.pointerEvents="none")}),1e3*e)}},{key:"stopAutoFocus",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.opacity=1,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.pointerEvents="all"),this.autoFocusTimer&&clearTimeout(this.autoFocusTimer)}},{key:"hideFooter",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.display="none")}},{key:"showFooter",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.display="block")}},{key:"toString",value:function(){return"".concat(this.coreX,"-").concat(this.coreY)}},{key:"renderFooter",value:function(A,e){var t=this,i=this.matchBtn(A),n=document.createElement("div");n.className="theme-icon-item",n.innerHTML="".concat('')+'
')).concat(i.domString,"
")+"
",n.onclick=function(A){if(t.decoderState.state.isEditing)return!1;i.onclick(A)},i.onmouseenter&&(n.onmouseenter=function(A){if(t.decoderState.state.isEditing)return!1;i.onmouseenter(A)}),i.onmouseleave&&(n.onmouseleave=function(A){if(t.decoderState.state.isEditing)return!1;i.onmouseleave(A)});var a=document.createElement("span");a.className="icon-move left",a.innerHTML=''),a.onclick=function(){t.editIcon(i.id,"left","footer")},n.appendChild(a);var r=document.createElement("span");r.className="icon-move right",r.innerHTML=''),r.onclick=function(){t.editIcon(i.id,"right","footer")},n.appendChild(r);var o=document.createElement("span");o.className="icon-move close",o.innerHTML='')+'',o.onclick=function(){t.editIcon(i.id,"delete","footer")},n.appendChild(o),"left"===e?document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).childNodes[0].appendChild(n):document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).childNodes[1].appendChild(n)}},{key:"editIcon",value:function(A,e,t){var i=this.themeData;console.log("themeData",this.themeData);var n=this.themeData[t].btnList,a=b.findIndex(n,(function(e){return e.iconId===A})),r=n[a];switch(e){case"delete":if("rec"===A){if(-1===b.findIndex(n,(function(A){return"cloudRec"===A.iconId&&1==A.isrender})))return this.jSPlugin.Message&&this.jSPlugin.Message.default("必须选中一种存储介质"),!1}else if("cloudRec"===A&&-1===b.findIndex(n,(function(A){return"rec"===A.iconId&&1==A.isrender})))return this.jSPlugin.Message&&this.jSPlugin.Message.default("必须选中一种存储介质"),!1;n[a].isrender=0;break;case"right":for(var o=-1,s=a+1;s=0;c--)if(n[c].part===n[a].part&&1==n[c].isrender){g=c;break}-1!==g&&(n[a]=n[g],n[g]=r)}i[t].btnList=n,this.changeTheme(i)}},{key:"renderHeader",value:function(A,e){var t=this,i=this.matchBtn(A),n=document.createElement("div");n.className="theme-icon-item",n.style="max-width:50%;",n.innerHTML="".concat('')+'')).concat(i.domString,"")+'',n.onclick=function(A){if(t.decoderState.state.isEditing)return!1;i.onclick(A)};var a=document.createElement("span");a.className="icon-move close",a.innerHTML='')+'',a.onclick=function(){t.editIcon(i.id,"delete","header")},n.appendChild(a),"left"===e?document.getElementById("".concat(this.jSPlugin.id,"-headControl")).childNodes[0].appendChild(n):document.getElementById("".concat(this.jSPlugin.id,"-headControl")).childNodes[1].appendChild(n)}},{key:"countTime",value:function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=this;if(!document.getElementById(this.jSPlugin.id+"time-area")){var i=document.createElement("div");i.id=this.jSPlugin.id+"time-area",i.className="time-area",i.innerHTML='00:00',document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).appendChild(i)}if(this.countTimer&&clearInterval(this.countTimer),"add"===A){var n=e;document.getElementById(t.jSPlugin.id+"time-area").style.display="flex",this.countTimer=setInterval((function(){++n,document.getElementById(t.jSPlugin.id+"time-area").children[1].innerHTML=function(A){var e=parseInt(A),t=0,i=0,n="00",a="00",r="00";e>59&&(t=parseInt(e/60),e=parseInt(e%60),t>59&&(i=parseInt(t/60),t=parseInt(t%60)));return n=parseInt(e)>9?parseInt(e):"0"+parseInt(e),a=parseInt(t)>9?parseInt(t):"0"+parseInt(t),r=parseInt(i)>9?parseInt(i):"0"+parseInt(i),i>0?r+":"+a+":"+n:t>0?a+":"+n:"00:"+n}(n)}),1e3)}else"destroy"===A&&(this.countTimer&&clearInterval(this.countTimer),this.countTimer=void 0,document.getElementById(t.jSPlugin.id+"time-area")&&(document.getElementById(t.jSPlugin.id+"time-area").children[1].innerHTML="00:00",document.getElementById(t.jSPlugin.id+"time-area").style.display="none"))}},{key:"setDisabled",value:function(A){var e=this.decoderState.state.sound,t=A?"cursor: not-allowed; color: gray; fill: gray; ":"cursor: default";null!=document.getElementById("".concat(this.jSPlugin.id,e?"-sound-icon":"-nosound-icon"))&&document.getElementById("".concat(this.jSPlugin.id,e?"-sound-icon":"-nosound-icon")).setAttribute("style",A?"cursor: not-allowed; color: gray; fill: gray;":"cursor: default"),null!=document.getElementById("".concat(this.jSPlugin.id,"-recordvideo-icon"))&&document.getElementById("".concat(this.jSPlugin.id,"-recordvideo-icon")).setAttribute("style",t),null!=document.getElementById("".concat(this.jSPlugin.id,"-capturePicture-icon"))&&document.getElementById("".concat(this.jSPlugin.id,"-capturePicture-icon")).setAttribute("style",t),null!=document.getElementById("".concat(this.jSPlugin.id,"-talk-icon"))&&document.getElementById("".concat(this.jSPlugin.id,"-talk-icon")).setAttribute("style",t),this.allowZoom||null!=document.getElementById("".concat(this.jSPlugin.id,"-zoom-icon"))&&document.getElementById("".concat(this.jSPlugin.id,"-zoom-icon")).setAttribute("style",t),document.getElementById("".concat(this.jSPlugin.id,"-pantile-icon"))&&"none"!=document.getElementById("".concat(this.jSPlugin.id,"-pantile-icon")).style.display&&document.getElementById("".concat(this.jSPlugin.id,"-pantile-icon")).setAttribute("style",t);var i=document.getElementsByClassName("".concat(this.jSPlugin.id,"-select-quality-btn"));if(i.length)for(var n=0;n'+'')+'')+'',a.onclick=function(){var A=e.decoderState.state,t=A.play,i=A.isEditing,n=A.rec,a=A.cloudRec,r=A.recordvideo,o=A.pantile;if(i)return!1;window.recTimer&&Array.isArray(window.recTimer[e.jSPlugin.id])&&(window.recTimer[e.jSPlugin.id].map((function(A){clearInterval(A)})),window.recTimer[e.jSPlugin.id]=[]),t?(n||a?(e.Rec&&e.Rec.unSyncTimeLine(),e.jSPlugin.pause().then((function(){e.setDecoderState({play:!t}),e.setDisabled(t)}))):(e.jSPlugin.stop().then((function(){e.setDecoderState({play:!t}),e.setDisabled(t)})),e.jSPlugin.Zoom.stopZoom(),e.jSPlugin.close3DZoom()),r&&e.setDecoderState({recordvideo:!1})):(n||a?(e.Rec&&e.Rec.syncTimeLine(),e.jSPlugin.resume().then((function(){e.setDecoderState({play:!t}),e.setDisabled(t)}))):e.jSPlugin.play().then((function(){e.setDecoderState({play:!t}),e.setDisabled(t)})),e.jSPlugin.use3DZoom&&e.resetMobileZoomStatus()),e.jSPlugin.use3DZoom?(e.setDecoderState({zoom:!1}),e.allowZoom=!1):e.allowZoom=n||a,o&&e.Ptz&&(e.Ptz.hide(),e.setDecoderState({pantile:!1})),document.getElementById("".concat(e.jSPlugin.id,"-speedSelect"))&&(document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).style.display="none"),e.setDecoderState({speed:!1})};break;case"sound":a.title=this.jSPlugin.i18n.t("client.theme.BTN_SOUND"),a.id=A,a.domString=''+'')+'\n \n \n \n \n ')+"",a.onclick=function(){var A=e.decoderState.state,t=A.play,i=A.sound,n=A.talk,a=A.pantile;t&&!n&&(i?(e.jSPlugin.closeSound(),e.setDecoderState({sound:!1})):(e.jSPlugin.openSound(),e.setDecoderState({sound:!0})),a&&e.Ptz&&(e.Ptz.hide(),e.setDecoderState({pantile:!1})))};break;case"recordvideo":if(r)break;a.title=this.jSPlugin.i18n.t("client.theme.BTN_RECORDVIDEO"),a.id=A,a.domString='')+'',a.onclick=function(){var A=e.decoderState.state,t=A.play,i=A.recordvideo;t&&(i?(e.jSPlugin.stopSave(),e.setDecoderState({recordvideo:!1})):(e.jSPlugin.startSave("".concat((new Date).getTime())),e.setDecoderState({recordvideo:!0})))};break;case"capturePicture":a.title=this.jSPlugin.i18n.t("client.theme.BTN_CAPTURE"),a.id=A,a.domString='')+'',a.onclick=function(){e.decoderState.state.play?e.jSPlugin.capturePicture("".concat((new Date).getTime()),(function(){}),e.jSPlugin.download):console.log("视频未播放,无法截图")};break;case"talk":if(r)break;a.title=this.jSPlugin.i18n.t("client.theme.BTN_TALK"),a.id=A,a.domString="
"+'')+'',a.onclick=function(){var A=e.decoderState.state,t=A.talk,i=A.sound;if(A.play)if(t){e.setDecoderState({talk:!1}),e.jSPlugin.Talk.stopTalk();var n=b.findIndex(e.themeData.footer.btnList,(function(A){return"sound"===A.iconId&&1===A.isrender&&1===A.defaultActive}))>-1;e.themeData&&n&&(e.jSPlugin.openSound(),e.setDecoderState({sound:!0}))}else e.setDecoderState({talk:!0}),e.jSPlugin.Talk.startTalk((function(A){i&&!A&&(e.jSPlugin.closeSound(),e.setDecoderState({sound:!1}))}))};break;case"zoom":if(r)break;a.title=this.jSPlugin.use3DZoom?this.jSPlugin.i18n.t("client.theme.BTN_3D_ZOOM"):this.jSPlugin.i18n.t("client.theme.BTN_ZOOM"),a.id=A,a.domString="
"+'\n \n \n \n \n '),a.onclick=function(){var A=e.decoderState.state,t=A.zoom,i=A.play,n=A.rec,a=A.cloudRec;if(e.jSPlugin.use3DZoom){if(!i)return!1;t?e.jSPlugin.close3DZoom():e.jSPlugin.enable3DZoom()}else{if(e.zoomDisable||!n&&!a&&!i)return!1;t?e.jSPlugin.Zoom.stopZoom():e.jSPlugin.Zoom.startZoom()}e.setDecoderState({zoom:!t})};break;case"pantile":if(r)break;a.title=this.jSPlugin.i18n.t("client.theme.BTN_PTZ"),a.id=A,a.domString='')+'',a.onclick=function(){var A=e.decoderState.state,t=A.play,i=A.pantile,n=A.expend;if(t)if(i)e.Ptz.hide(),e.setDecoderState({pantile:!1});else{if(e.isMobile&&!n)return console.log("移动端,非全屏状态不展示云台"),!1;e.Ptz.show(),e.setDecoderState({pantile:!0})}};break;case"expend":a.title=this.jSPlugin.i18n.t("client.theme.BTN_EXPEND"),a.id=A,a.domString='')+''+'\n '),a.onclick=function(){var A=e.decoderState.state,t=A.expend,i=A.pantile;if(e.setDecoderState({expend:!t}),t)if(e.isMobile){var n=e._extendHeadeTimeLinrHight(!1,!0),a=document.getElementById("".concat(e.jSPlugin.id,"-headControl"));document.getElementById("".concat(e.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(e.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop="-32px"),a&&(a.style.position="relative"),document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).style.bottom="calc(constant(safe-area-inset-bottom) + 100px)",document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).style.bottom="calc(env(safe-area-inset-bottom) + 100px)",document.getElementById("".concat(e.jSPlugin.id,"-select-speed")).style.background="#ffffff",function(A,e,t){var i="";i+="width:"+e+"px;",i+="height:"+t+"px;",i+="-webkit-transform: none; transform: none;",i+="-webkit-transform-origin: 0 0;",i+="transform-origin: 0 0;",A.style.cssText=i}(document.getElementById("".concat(e.jSPlugin.id,"-wrap")),e.jSPlugin.width,e.jSPlugin.height),e.jSPlugin.jSPlugin.JS_Resize(e.jSPlugin.width,e.jSPlugin.height-n),i&&e.Ptz&&(e.Ptz.hide(),e.setDecoderState({pantile:!1})),e.jSPlugin.fullScreenWidth=e.jSPlugin.width,e.jSPlugin.fullScreenHeight=e.jSPlugin.height,e.jSPlugin.Zoom&&e.jSPlugin.Zoom.handleFullscreen&&e.jSPlugin.Zoom.handleFullscreen(!t,e.jSPlugin.width,e.jSPlugin.height),document.getElementById("".concat(e.jSPlugin.id,"-pantile-icon"))&&(document.getElementById("".concat(e.jSPlugin.id,"-pantile-icon")).style.display="none"),document.getElementById("".concat(e.jSPlugin.id,"-hdSelect"))&&(document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).style.height=45*e.jSPlugin.videoLevelList.length+"px")}else x();else if(e.isMobile){var r=e._extendHeadeTimeLinrHight(!1,!0);f(document.getElementById("".concat(e.jSPlugin.id,"-wrap")));var o=document.documentElement.clientWidth,s=document.documentElement.clientHeight;document.getElementById("".concat(e.jSPlugin.id)).style["backface-visibility"]="hidden",document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).style.bottom=0,document.getElementById("".concat(e.jSPlugin.id,"-select-speed")).style.background="none",e.jSPlugin.jSPlugin.JS_Resize(s,o-r,!0),e.jSPlugin.fullScreenWidth=s,e.jSPlugin.fullScreenHeight=o-r,e.jSPlugin.Zoom&&e.jSPlugin.Zoom.handleFullscreen&&e.jSPlugin.Zoom.handleFullscreen(!t,s,o-r),document.getElementById("".concat(e.jSPlugin.id,"-pantile-icon"))&&(document.getElementById("".concat(e.jSPlugin.id,"-pantile-icon")).style.display="block"),document.getElementById("".concat(e.jSPlugin.id,"-hdSelect"))&&(document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).style.height="100%")}else{o=window.screen.width,s=window.screen.height;Q(document.getElementById("".concat(e.jSPlugin.id))).then((function(A){e.jSPlugin.jSPlugin.JS_Resize(o,s),e.jSPlugin.fullScreenWidth=o,e.jSPlugin.fullScreenHeight=s})).catch((function(A){console.log(A)})),e.jSPlugin.close3DZoom(),e.setDecoderState({speed:!1})}};break;case"webExpend":if(r)break;a.title=this.jSPlugin.i18n.t("client.theme.BTN_WEBEXPEND"),a.id=A,a.domString='')+''+'",a.onclick=function(){var A=e.decoderState.state,t=A.webExpend;if(A.expend)return console.log("正在全局全屏"),!1;if(window.recTimer&&Array.isArray(window.recTimer[e.jSPlugin.id])&&(window.recTimer[e.jSPlugin.id].map((function(A){clearInterval(A)})),window.recTimer[e.jSPlugin.id]=[]),t)x();else{var i=window.screen.width,n=window.screen.height;Q(document.getElementById("".concat(e.jSPlugin.id,"-wrap"))).then((function(){e.jSPlugin.jSPlugin.JS_Resize(i,n-e._extendHeadeTimeLinrHight(!1,!1))}))}e.jSPlugin.Theme.Rec&&setTimeout((function(){e.jSPlugin.Theme.Rec.recAutoSize()}),100),e.setDecoderState({webExpend:!t})};break;case"hd":if(r)break;var o="".concat(this.jSPlugin.id,"-select-quality"),s="".concat(o,"-item");a.title=this.jSPlugin.i18n.t("client.theme.BTN_HD"),a.id=A;var g="",c="";return this.jSPlugin.videoLevelList.findIndex((function(A){return A.level==e.jSPlugin.videoLevel}))>-1?this.jSPlugin.videoLevelList.map((function(A){g+='
  • ').concat(A.name,"
  • "),A.level==e.jSPlugin.videoLevel&&(c+=A.icon(e.jSPlugin.id,o,a.color,e.jSPlugin.width,RA,A))})):this.jSPlugin.videoLevelList.map((function(A,t){0===t&&(c+=A.icon(e.jSPlugin.id,o,a.color,e.jSPlugin.width,RA,A)),g+='
  • ').concat(A.name,"
  • ")})),g+='
  • 取消
  • '),c+=''),a.domString='\n \n ').concat(c,"\n "),a.onclick=function(A){var t=e.decoderState.state,i=t.expend,n=t.recordvideo,a=t.play,r=t.zoom,s=t.pantile;if(A.stopPropagation(),a){var g=A.target.id,c=A.target.getAttribute("data-type");if(0===g.indexOf(o)){if(e.jSPlugin.videoLevel+""!==c){var l=e.jSPlugin.videoLevelList.find((function(A){return A.level+""===c}));!l||l.streamTypeIn===e.jSPlugin.streamTypeIn&&l.level+""==e.jSPlugin.videoLevel+""||(e.jSPlugin.changeVideoLevel(l),r&&e.jSPlugin.Zoom.stopZoom())}e.resetMobileZoomStatus(),n&&e.setDecoderState({recordvideo:!1})}e.showHD=!e.showHD,document.getElementById("".concat(e.jSPlugin.id,"-hdSelect"))&&(document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).style.display="none"===document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).style.display?"block":"none",e.isMobile&&(document.getElementById("".concat(e.jSPlugin.id,"-select-hd-mask")).style.display="none"===document.getElementById("".concat(e.jSPlugin.id,"-select-hd-mask")).style.display?"block":"none"),e.themeData.autoFocus>0&&("none"===document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).style.display?e.startAutoFocus():e.stopAutoFocus())),e.isMobile&&i&&e.showHD?document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).className="hd speed-select mobile expend":document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).className=e.isMobile?"hd speed-select mobile":"speed-select",s&&e.Ptz&&(e.Ptz.hide(),e.setDecoderState({pantile:!1}))}},a;case"speed":if(r)break;a.title=this.jSPlugin.i18n.t("client.theme.BTN_SPEED"),a.id=A,a.domString='"+'\n
    ').concat(1===this.nextRate?"倍速":"".concat(this.nextRate,"倍").replace("3","0.5"),"
    \n ")+'')+"
    ",a.onclick=function(A){var t=e.decoderState.state,i=t.speed,n=t.expend,a=t.play;if(A.stopPropagation(),!a)return!1;if(!i&&e.isMobile&&(document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).className=n?"speed speed-select mobile expend":"speed speed-select mobile"),e.isMobile&&(n?(document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).style.bottom="constant(safe-area-inset-bottom)",document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).style.bottom="env(safe-area-inset-bottom)"):(document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).style.bottom="calc(constant(safe-area-inset-bottom) + 80px)",document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).style.bottom="calc(env(safe-area-inset-bottom) + 80px)")),e.nextRate=1,A.target.id)switch(A.target.id){case"".concat(e.jSPlugin.id,"-select-speed1"):e.nextRate=1,e.jSPlugin.jSPlugin.JS_Speed(e.nextRate),e.changeRecSpeed(1),e.jSPlugin.speed=1,e.setDecoderState({speed:!i});break;case"".concat(e.jSPlugin.id,"-select-speed2"):e.nextRate=2,e.jSPlugin.jSPlugin.JS_Speed(e.nextRate),e.changeRecSpeed(2),e.jSPlugin.speed=2,e.setDecoderState({speed:!i});break;case"".concat(e.jSPlugin.id,"-select-speed4"):e.nextRate=4,e.jSPlugin.jSPlugin.JS_Speed(e.nextRate),e.changeRecSpeed(4),e.jSPlugin.speed=4,e.setDecoderState({speed:!i});break;case"".concat(e.jSPlugin.id,"-select-speed05"):e.nextRate=3,e.jSPlugin.jSPlugin.JS_Speed(e.nextRate),e.changeRecSpeed(.5),e.jSPlugin.speed=.5,e.setDecoderState({speed:!i});break;default:e.isMobile?e.setDecoderState({speed:!i}):e.setDecoderState({speed:!0})}e.isMobile&&A.target.id==="".concat(e.jSPlugin.id,"-speed-text")?document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).style.display="block":document.getElementById("".concat(e.jSPlugin.id,"-speedSelect"))&&(document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).style.display="none"===document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).style.display?"block":"none"),e.setDecoderState({speed:!i}),e.themeData.autoFocus>0&&("none"===document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).style.display?e.startAutoFocus():e.stopAutoFocus())};break;case"deviceName":a.title=this.jSPlugin.i18n.t("client.theme.DEVICE_NAME"),a.id=A,a.domString="".concat(this.jSPlugin.i18n.t("client.theme.DEVICE_NAME"),""),a.onclick=function(){};break;case"deviceID":a.title=this.jSPlugin.i18n.t("client.theme.DEVICE_ID"),a.id=A,a.domString="".concat(this.jSPlugin.i18n.t("client.theme.DEVICE_ID"),""),a.onclick=function(){};break;case"cloudRec":if(this.jSPlugin._isCloudRecord)break;a.title=this.jSPlugin.i18n.t("client.theme.BTN_CLOUDREC"),a.id=A,a.domString='\n \n \n\t\n\t\n\t\n \n \n '),a.onclick=function(){e.setDecoderState({type:"cloud.rec",cloudRec:!0,rec:!1}),e.jSPlugin.eventEmitter.emit("recTypeChange",{eventType:"recTypeChange",code:0,data:{type:"cloud"}}),e.jSPlugin.changePlayUrl({type:"cloud.rec"},(function(){var A=u("begin",e.jSPlugin.url)||(new Date).Format("yyyyMMdd");e.Rec.renderRec("".concat(A.slice(0,4),"-").concat(A.slice(4,6),"-").concat(A.slice(6,8))),e.decoderState.state.zoom&&(e.setDecoderState({zoom:!1}),e.jSPlugin.Zoom.stopZoom(),e.jSPlugin.close3DZoom())}),!1)};break;case"cloudRecord":if(!this.jSPlugin._isCloudRecord)break;a.title=this.jSPlugin.i18n.t("client.theme.BTN_CLOUDRECORD"),a.id=A,a.domString=' \n\n\n\t\n\t\n\t\n\t'),a.onclick=function(){e.setDecoderState({type:"cloud.rec",cloudRec:!0,rec:!1}),e.jSPlugin.eventEmitter.emit("recTypeChange",{eventType:"recTypeChange",code:0,data:{type:"cloudRecord"}}),e.jSPlugin.url.replace(/rec\??|cloud.rec\??/,"cloud.rec?busType=7"),e.jSPlugin.changePlayUrl({type:"cloud.rec"},(function(){e.jSPlugin._isCloudRecord&&e.changeTheme("pcRec");var A=u("begin",e.jSPlugin.url)||(new Date).Format("yyyyMMdd");e.Rec.renderRec("".concat(A.slice(0,4),"-").concat(A.slice(4,6),"-").concat(A.slice(6,8))),e.decoderState.state.zoom&&(e.setDecoderState({zoom:!1}),e.jSPlugin.Zoom.stopZoom(),e.jSPlugin.close3DZoom())}),!1)};break;case"rec":a.title=this.jSPlugin.i18n.t("client.theme.BTN_REC"),a.id=A,a.domString='\n \n \n \n\n\n\n \n \n '),a.onclick=function(){e.setDecoderState({type:"rec",cloudRec:!1,rec:!0}),e.jSPlugin.eventEmitter.emit("recTypeChange",{eventType:"recTypeChange",code:0,data:{type:"local"}}),e.jSPlugin.changePlayUrl({type:"rec"},(function(){e.jSPlugin._isCloudRecord&&e.changeTheme("pcRec");var A=u("begin",e.jSPlugin.url)||(new Date).Format("yyyyMMdd");e.Rec.renderRec("".concat(A.slice(0,4),"-").concat(A.slice(4,6),"-").concat(A.slice(6,8))),e.decoderState.state.zoom&&(e.setDecoderState({zoom:!1}),e.jSPlugin.Zoom.stopZoom(),e.jSPlugin.close3DZoom())}),!1)}}return a}},{key:"_warpFullScreen",value:function(){var A=this,e=document.getElementById("".concat(this.jSPlugin.id,"-wrap")),t=this,i=function(){var e=t.decoderState.state,i=e.webExpend,n=e.expend,a=e.zoom;document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen?i?A.jSPlugin.eventEmitter&&A.jSPlugin.eventEmitter.emit("fullScreen",{eventType:"fullScreen",code:0,target:A,msg:"web 全屏"}):n&&(t.setDecoderState({expend:!1}),a&&t.jSPlugin.use3DZoom&&t.jSPlugin.enable3DZoom(),A.jSPlugin.eventEmitter&&A.jSPlugin.eventEmitter.emit("fullScreen",{eventType:"fullScreen",code:0,target:A,msg:"全局全屏"})):(t.jSPlugin.jSPlugin.JS_Resize(t.jSPlugin.width,t.jSPlugin.height-A._extendHeadeTimeLinrHight(!1,!1)),A.jSPlugin.eventEmitter&&A.jSPlugin.eventEmitter.emit("cancelFullScreen",{eventType:"cancelFullScreen",code:0,target:A,msg:"退出全局全屏"})),A.setDecoderState({speed:!1})};["fullscreenchange","webkitfullscreenchange","mozfullscreenchange"].forEach((function(A){e.removeEventListener(A,i),e.addEventListener(A,i)}))}},{key:"changeRecSpeed",value:function(A){var e=this,t=function(A){if(!document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")))return!1;document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).childNodes[0].className=document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).childNodes[0].className.replace("active","default"),document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).childNodes[1].className=document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).childNodes[1].className.replace("active","default"),document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).childNodes[2].className=document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).childNodes[2].className.replace("active","default"),document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).childNodes[3].className=document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).childNodes[3].className.replace("active","default"),document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).childNodes[A].className=document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).childNodes[A].className.replace("default","active")},i="1";switch(A){case 1:t(2),i="倍速";break;case 2:t(1),i="".concat(A,"倍");break;case 4:t(0),i="".concat(A,"倍");break;case.5:t(3),i="".concat(A,"倍");break;default:t(2),i="".concat(A,"倍")}document.getElementById("".concat(this.jSPlugin.id,"-speed-text"))&&(document.getElementById("".concat(this.jSPlugin.id,"-speed-text")).innerHTML=i)}},{key:"initThemeData",value:function(){var A=this,e=this.themeData,t=e.header,i=e.footer,n=this.jSPlugin.id;if(this.header=N,this.footer=M,this.isNeedRenderHeader=b.findIndex(t.btnList,(function(A){return A.isrender>0}))>=0&&"miniRec"!=this.jSPlugin.id,this.isMobile&&(this.isNeedRenderHeader=b.findIndex(t.btnList,(function(A){return A.isrender>0&&"deviceID"===A.iconId||A.isrender>0&&"deviceName"===A.iconId}))>=0&&"miniRec"!=this.jSPlugin.id),this.isNeedRenderFooter=b.findIndex(i.btnList,(function(A){return A.isrender>0}))>=0&&"miniRec"!=this.jSPlugin.id,this.isNeedRenderTimeLine=b.findIndex(t.btnList,(function(A){return"cloudRec"===A.iconId&&1===A.isrender||"rec"===A.iconId&&1===A.isrender}))>=0&&!this.jSPlugin.disabledTimeLine&&"miniRec"!=this.jSPlugin.id,["date-switch-container-wrap","rec-type-container-wrap","mobile-rec-wrap","mobile-ez-ptz-container"].forEach((function(A,e){document.getElementById(A)&&document.getElementById(A).parentElement.removeChild(document.getElementById(A))})),this.isNeedRenderHeader)if(document.getElementById("".concat(this.jSPlugin.id,"-headControl")))document.getElementById("".concat(this.jSPlugin.id,"-headControl")).innerHTML="
    ");else{var a=document.createElement("div");a.setAttribute("id","".concat(this.jSPlugin.id,"-headControl")),a.setAttribute("class","header-controls"),a.innerHTML="
    ");var r={height:this.jSPlugin.width>RA?"48px":"32px","line-height":this.jSPlugin.width>RA?"48px":"32px",display:"flex","justify-content":"space-between",top:0,"z-index":1,background:"#000000",color:"#FFFFFF",width:"100%"};a.style=bA(r),document.getElementById("".concat(n,"-wrap")).insertBefore(a,document.getElementById(n));var o=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(o)}),50)}else document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&document.getElementById("".concat(this.jSPlugin.id,"-headControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-headControl")));if(this.isNeedRenderFooter)if(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")))document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop="-".concat(this.jSPlugin.width>RA?48:32,"px"),document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).innerHTML='"));else{var s=document.createElement("div");s.setAttribute("id","".concat(this.jSPlugin.id,"-ez-iframe-footer-container")),s.setAttribute("class","ez-iframe-footer-container");var g={"min-height":this.jSPlugin.width>RA?"48px":"32px","max-height":this.jSPlugin.width>RA?"96px":"80px",position:"relative","margin-top":this.jSPlugin.width>RA?"-48px":"-32px",display:"flex","flex-wrap":"wrap","justify-content":"space-between","z-index":999,top:0,color:"#FFFFFF",width:"100%"};s.style=bA(g),s.innerHTML='"),E(s,document.getElementById(n))}else document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")));if(this.isNeedRenderHeader&&document.getElementById("".concat(this.jSPlugin.id,"-headControl"))){document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.background=t.backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=t.color;var c,l=I(t.btnList);try{for(l.s();!(c=l.n()).done;){var C=c.value;if(C.isrender)try{this.renderHeader(C.iconId,C.part)}catch(A){}}}catch(A){l.e(A)}finally{l.f()}}if(this.isNeedRenderFooter&&document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))){document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=i.backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=i.color;var d,h=I(i.btnList);try{for(h.s();!(d=h.n()).done;){var B=d.value;if(B.isrender)try{this.renderFooter(B.iconId,B.part)}catch(A){}}}catch(A){h.e(A)}finally{h.f()}}if(this.isNeedRenderTimeLine)if(this.isMobile)document.getElementById("".concat(this.jSPlugin.id,"-headControl-right"))&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl-right")).style.display="none"),this.Rec=new eA(this.jSPlugin,this.changeRecSpeed,this.resetMobileZoomStatus);else{this.Rec?this.Rec.recInit():(this.jSPlugin.decoderState=this.decoderState,this.jSPlugin.setDecoderState=this.setDecoderState,this.Rec=new q(this.jSPlugin));var u=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(u)}),50)}b.findIndex(this.themeData.footer.btnList,(function(A){return"pantile"===A.iconId&&1===A.isrender}))>=0&&!this.jSPlugin.disabledPTZ&&(this.isMobile&&(this.MobilePtz=new IA(this.jSPlugin)),this.Ptz=new tA(this.jSPlugin));var f=function(){var e=A,t=e.decoderState.state,i=t.expend,n=t.zoom,a=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen;e.Rec&&window.randomNum==e.jSPlugin.randomNum&&setTimeout((function(){e.Rec.recAutoSize((function(){if(e.jSPlugin.Zoom.currentScale>1){var A=e.jSPlugin.Zoom.currentScale;e.jSPlugin.Zoom.stopZoom(),setTimeout((function(){e.jSPlugin.Zoom.startZoom(),e.jSPlugin.Zoom.currentScale=A,e.jSPlugin.Zoom.doScale(A)}),200)}}))}),100),a||(i&&n&&e.jSPlugin.use3DZoom&&e.jSPlugin.enable3DZoom(),e.setDecoderState({webExpend:!1,expend:!1})),document.getElementById("".concat(e.jSPlugin.id,"-hdSelect"))&&(document.getElementById("".concat(e.jSPlugin.id,"-hdSelect")).style.display="none"),document.getElementById("".concat(e.jSPlugin.id,"-speedSelect"))&&(document.getElementById("".concat(e.jSPlugin.id,"-speedSelect")).style.display="none"),e.isMobile&&(document.getElementById("".concat(e.jSPlugin.id,"-select-hd-mask"))&&(document.getElementById("".concat(e.jSPlugin.id,"-select-hd-mask")).style.display="none"),document.getElementById("".concat(e.jSPlugin.id,"-select-mask"))&&(document.getElementById("".concat(e.jSPlugin.id,"-select-mask")).style.display="none")),e.themeData.autoFocus>0&&e.startAutoFocus()};if(["fullscreenchange","webkitfullscreenchange","mozfullscreenchange"].forEach((function(A,e){window.onFullscreenChange&&document.removeEventListener(A,window.onFullscreenChange),document.addEventListener(A,f),window.onFullscreenChange=f})),this.themeData.poster){this.jSPlugin.poster=this.themeData.poster;var Q=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(Q),A.jSPlugin.setPoster(A.themeData.poster))}),50)}this.inited=!0,this.getDeviceInfo(),this.renderThemeData()}},{key:"resetMobileZoomStatus",value:function(){if(this.isMobile){var A=document.getElementById("".concat(this.jSPlugin.id,"-zoom-container"));A&&A.style&&"none"!=A.style.display&&(A.style.display="none"),this.jSPlugin.jSPlugin.Zoom&&this.jSPlugin.jSPlugin.Zoom.resetZoom()}}},{key:"getDeviceInfo",value:function(A){var e=this;FA({accessToken:this.jSPlugin.accessToken,deviceSerial:p(this.jSPlugin.url).deviceSerial}).then((function(t){t.data&&(A&&A(t),document.getElementById("".concat(e.jSPlugin.id,"-deviceName-content"))&&(document.getElementById("".concat(e.jSPlugin.id,"-deviceName-content")).style.maxWidth="100%",document.getElementById("".concat(e.jSPlugin.id,"-deviceName-content")).style.overflow="hidden",document.getElementById("".concat(e.jSPlugin.id,"-deviceName-content")).style.textOverflow="ellipsis",document.getElementById("".concat(e.jSPlugin.id,"-deviceName-content")).style.whiteSpace="nowrap",document.getElementById("".concat(e.jSPlugin.id,"-deviceName-content")).innerHTML=t.data.deviceName),document.getElementById("".concat(e.jSPlugin.id,"-deviceID-content"))&&(document.getElementById("".concat(e.jSPlugin.id,"-deviceID-content")).style.maxWidth="100%",document.getElementById("".concat(e.jSPlugin.id,"-deviceID-content")).style.overflow="hidden",document.getElementById("".concat(e.jSPlugin.id,"-deviceID-content")).style.textOverflow="ellipsis",document.getElementById("".concat(e.jSPlugin.id,"-deviceID-content")).style.whiteSpace="nowrap",document.getElementById("".concat(e.jSPlugin.id,"-deviceID-content")).innerHTML=p(e.jSPlugin.url).deviceSerial))})).catch((function(A){console.log("获取设备信息失败",A)}))}},{key:"editStart",value:function(A){var e=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),t=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));t&&t.setAttribute("class","header-controls themeEditing"),e&&e.setAttribute("class","footer-controls themeEditing"),this.setDecoderState({isEditing:!0})}},{key:"editEnd",value:function(A){var e=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),t=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));t&&t.setAttribute("class","header-controls"),e&&e.setAttribute("class","footer-controls"),this.setDecoderState({isEditing:!1})}},{key:"webExpend",value:function(){var A=this,e=this.decoderState.state;e.webExpend;var t=e.expend;return!!e.play&&(t?(console.log("正在全局全屏"),!1):void Q(document.getElementById("".concat(this.jSPlugin.id,"-wrap"))).then((function(e){A.jSPlugin.jSPlugin.JS_Resize(window.screen.width,window.screen.height-A._extendHeadeTimeLinrHight(!1,!1))})).catch((function(A){console.log(A)})))}},{key:"expend",value:function(){var A=this,e=this.decoderState.state,t=e.webExpend;if(!e.play)return!1;if(t)return console.log("正在网站全屏"),!1;if(this.isMobile){f(document.getElementById("".concat(this.jSPlugin.id,"-wrap")));var i=document.documentElement.clientWidth,n=document.documentElement.clientHeight;document.getElementById("".concat(this.jSPlugin.id)).style["backface-visibility"]="hidden",this.jSPlugin.jSPlugin.JS_Resize(n,i-this._extendHeadeTimeLinrHight(!1,!0))}else{Q(document.getElementById("".concat(this.jSPlugin.id))).then((function(e){A.jSPlugin.jSPlugin.JS_Resize(window.screen.width,window.screen.height)})).catch((function(A){console.log(A)}))}}},{key:"_extendHeadeTimeLinrHight",value:function(A,e){var t=0,i=0,n=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));n&&!A&&(t=parseInt(getComputedStyle(n).height,10));var a=document.getElementById("".concat(this.jSPlugin.id,"-canvas-container"));return a&&!e&&(i=parseInt(window.getComputedStyle(a).height,10)),t+i}},{key:"disabledFECBtn",value:function(){var A=["".concat(this.jSPlugin.id,"-capturePicture"),"".concat(this.jSPlugin.id,"-capturePicture-content"),"".concat(this.jSPlugin.id,"-capturePicture-icon"),"".concat(this.jSPlugin.id,"-recordvideo"),"".concat(this.jSPlugin.id,"-recordvideo-content"),"".concat(this.jSPlugin.id,"-recordvideo-icon"),"".concat(this.jSPlugin.id,"-zoom"),"".concat(this.jSPlugin.id,"-zoom-content"),"".concat(this.jSPlugin.id,"-zoom-icon")],e=document.getElementById("".concat(this.jSPlugin.id,"-wrap"));if(this.jSPlugin.use3DZoom?this.jSPlugin.close3DZoom():this.jSPlugin.Zoom.stopZoom(),this.setDecoderState({zoom:!1}),e){var t,i=I(A);try{for(i.s();!(t=i.n()).done;){var n=t.value,a=e.querySelector("#".concat(n));a&&(a.style.display="none")}}catch(A){i.e(A)}finally{i.f()}}}},{key:"resumeFECBtn",value:function(){var A=["".concat(this.jSPlugin.id,"-capturePicture"),"".concat(this.jSPlugin.id,"-capturePicture-content"),"".concat(this.jSPlugin.id,"-capturePicture-icon"),"".concat(this.jSPlugin.id,"-recordvideo"),"".concat(this.jSPlugin.id,"-recordvideo-content"),"".concat(this.jSPlugin.id,"-recordvideo-icon"),"".concat(this.jSPlugin.id,"-zoom"),"".concat(this.jSPlugin.id,"-zoom-content"),"".concat(this.jSPlugin.id,"-zoom-icon")],e=document.getElementById("".concat(this.jSPlugin.id,"-wrap"));if(e){var t,i=I(A);try{for(i.s();!(t=i.n()).done;){var n=t.value,a=e.querySelector("#".concat(n));a&&(a.style.display="")}}catch(A){i.e(A)}finally{i.f()}}}},{key:"destroy",value:function(){var A=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));A&&(A.innerHTML="");var e=document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"));this._removeElement(e);var t=document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-item"));this._removeElement(t);var i=document.getElementById("mobile-ez-ptz-container");this._removeElement(i);var n=document.getElementById("date-switch-container-wrap");this._removeElement(n);var a=document.getElementById("rec-type-container-wrap");this._removeElement(a);var r=document.getElementById("mobile-rec-wrap");this._removeElement(r)}},{key:"_removeElement",value:function(A){A&&A.parentNode&&A.parentNode.removeChild(A)}}])}(),PA=function(){return o((function A(e){a(this,A),this.url=e.url||"",this.method=e.method||"POST",this.headers=e.headers||{},this.body=e.body||{},this.onBeforeUpload=e.onBeforeUpload||function(){},this.onUploadProgress=e.onUploadProgress||function(){},this.onUploadComplete=e.onUploadComplete||function(){},this.controller=new AbortController}),[{key:"upload",value:function(){var A=this;this.onBeforeUpload(this.body);var t={method:this.method,headers:this.headers,signal:this.controller.signal,body:this.body};fetch(this.url,t).then((function(A){return A.json()})).then((function(e){A.onUploadComplete({body:A.body,response:e})})).catch((function(A){"AbortError"===A.name?console.log("上传被取消"):console.error("Error:",A)})),t.body&&"FormData"==t.body.constructor.name&&"signal"in t&&t.signal.addEventListener("progress",(function(t){t.lengthComputable&&A.onUploadProgress(e(e({},A.body),{},{progress:t.loaded/t.total}))}))}},{key:"cancel",value:function(){this.controller.abort()}}])}(),NA=function(){return o((function A(e,t){a(this,A),this.jSPlugin=e,this.isMobile=t,this.timer=null,this.initToastCustom()}),[{key:"initToastCustom",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-wrap-Toast-custom"))?document.getElementById("".concat(this.jSPlugin.id,"-wrap-Toast-custom")).style.display="none":this.randerToast()}},{key:"randerToast",value:function(){var A=this.jSPlugin.width,e=1;e=this.isMobile?A/375||1:A/1024||1;var t=document.getElementById("".concat(this.jSPlugin.id,"-wrap")),i=document.createElement("div");i.style="display:none;position:absolute;top:0;width: 100%;align-items: center;justify-content: center;",i.id="".concat(this.jSPlugin.id,"-wrap-Toast-custom"),this.isMobile?i.innerHTML='
    \n
    \n '):i.innerHTML='
    \n
    \n '),t.insertBefore(i,document.getElementById(this.jSPlugin.id))}},{key:"initToastContent",value:function(A){var e=this,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3;console.log("content----------------",A),this.timer=null,document.getElementById("".concat(this.jSPlugin.id,"-wrap-Toast-custom"))?(document.getElementById("".concat(this.jSPlugin.id,"-wrap-Toast-custom")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-wrap-Toast-custom-content")).innerText=A||"",this.timer=setTimeout((function(){document.getElementById("".concat(e.jSPlugin.id,"-wrap"))&&document.getElementById("".concat(e.jSPlugin.id,"-wrap-Toast-custom"))&&document.getElementById("".concat(e.jSPlugin.id,"-wrap")).removeChild(document.getElementById("".concat(e.jSPlugin.id,"-wrap-Toast-custom")))}),t)):(this.randerToast(),this.initToastContent(A))}}])}(),MA=function(A,e,t){var i=new FormData;i.append("deviceSerial",p(A.url).deviceSerial),i.append("cmd","open"),A.accessToken;var n="".concat(A.env.domain,"/api/v3/device/acs/remote/door?accessToken=").concat(A.accessToken);fetch(n,{method:"POST",body:i}).then((function(A){return A.json()})).then((function(A){console.log("get theme data",A),function(A){console.log(A),e(A)}(A)})).catch((function(A){var e;e=A,console.log(e),t(e)}))},TA=function(A,e,t){var i={accessToken:A.accessToken,pageStart:0,pageSize:4,default:!0,voiceName:"轻应用语音文件"},n="".concat(A.env.domain,"/api/lapp/voice/query");yA(n,"POST",i,(function(A){console.log(A),e(A)}),(function(A){console.log(A),t(A)}),{"Content-Type":"application/x-www-form-urlencoded"})},LA=function(A,e,t,i){var n="".concat(A.env.domain,"/api/lapp/voice/send"),a=new FormData;a.append("deviceSerial",p(A.url).deviceSerial),a.append("accessToken",A.accessToken),a.append("channelNo",p(A.url).channelNo||1),a.append("fileUrl",e),fetch(n,{method:"POST",body:a}).then((function(A){return A.json()})).then((function(A){!function(A){console.log(A),t(A)}(A)})).catch((function(A){var e;e=A,console.log(e),i(e)}))},YA=function(){return o((function A(e,t){a(this,A),this.jSPlugin=e,this.videoWidth=e.width,this.switchFooter=t,this.sendLoadingStats=!1,this.toastCustom=new NA(e,!1),this.quickReplyList=["你好,请将快递放在门口","你好,稍等","你好,请将快递放入小区快递柜","你好,请将外卖放在门口"],this.initQuickReply()}),[{key:"initQuickReply",value:function(){document.getElementById("pc-quickReply-back")||this.renderQuickReply(),document.getElementById("pc-quickReply-back-item-0")||this.getQuickReplyList()}},{key:"renderQuickReply",value:function(){var A=this,e=this.videoWidth/1024||1,t=document.createElement("div");t.style="width:100%;",t.innerHTML='
    \n
    \n
    \n \n 返回\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n 返回\n
    \n
    \n \n \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReply")).appendChild(t),document.getElementById("pc-quickReply-back").onclick=function(){A.switchFooter("onBell")}}},{key:"matchQuickReplyBtn",value:function(){var A=this,e=this.videoWidth/1024||1,t=document.getElementById("pc-quickReply-content");this.quickReplyList&&this.quickReplyList.length>0&&this.quickReplyList.forEach((function(i,n){var a=document.createElement("div");a.id="pc-quickReply-back-item-".concat(n),a.style="margin: ".concat(8*e,"px 0 ").concat(8*e,"px ").concat(8*e,"px;cursor: pointer;\n padding: 0 ").concat(20*e,"px;min-height: ").concat(64*e,"px;width:calc(50% - ").concat(16*e,"px);\n display: inline-block;background: rgba(0,0,0,0.70);border-radius: 8px;text-align: center;\n box-sizing: border-box;font-size:").concat(24*e,"px;color: rgba(255,255,255,0.90);"),a.innerHTML='
    \n ').concat(i.voiceName,"\n
    "),a.onclick=function(){A.sendLoadingStats||(console.log("item:"+i),A.sendQuickReply(i,n))},t.appendChild(a)}))}},{key:"setBtnCheckLoading",value:function(A,e){var t=this.videoWidth/1024||1;if(e>-1){document.getElementById("pc-quickReply-back-item-".concat(e));var i=document.getElementById("pc-quickReply-back-item-box-".concat(e)),n=document.getElementById("pc-quickReply-name-".concat(e));if(1==A){var a=document.getElementById("pc-quickReply-icon-loading-".concat(e));a&&n&&i.removeChild(a)}else if(n){var r=document.createElement("span");r.id="pc-quickReply-icon-loading-".concat(e),r.style="vertical-align: middle;margin-right:".concat(16*t,"px;"),r.innerHTML=''),i.insertBefore(r,n)}}}},{key:"getQuickReplyList",value:function(){var A=this;console.log("getQuickReplyList"),this.madeLoadingDom(0);TA(this.jSPlugin,(function(e){if(e&&200==e.code){var t=e.data||[],i=[];e.data.forEach((function(A,e){i=A.voiceName.split("_"),t[e].voiceName=i[1]})),A.quickReplyList=t,setTimeout((function(){A.madeLoadingDom(2)}),500)}else A.madeLoadingDom(1)}),(function(e){console.log(e),A.madeLoadingDom(1)}))}},{key:"madeLoadingDom",value:function(A){var e=this,t=this.videoWidth/1024||1;if(0==A){if(document.getElementById("pc-quickReply-content").style.display="none",document.getElementById("pc-quickReply-loaderror").style.display="none",document.getElementById("pc-quickReply-loading").style.display="block",!document.getElementById("pc-quickReply-loading-box")){var i=document.createElement("div");i.id="pc-quickReply-loading-box",i.style="width: 100%;display: flex;align-items: center;justify-content: center;flex-direction: column;",i.innerHTML='
    \n \n
    \n
    加载中…
    '),document.getElementById("pc-quickReply-loading").appendChild(i)}}else if(1==A){if(document.getElementById("pc-quickReply-content").style.display="none",document.getElementById("pc-quickReply-loading").style.display="none",document.getElementById("pc-quickReply-loaderror").style.display="block",!document.getElementById("pc-quickReply-loaderror-box")){var n=document.createElement("div");n.id="pc-quickReply-loaderror-box",n.style="width: 100%;display: flex;align-items: center;justify-content: center;flex-direction: column;",n.innerHTML='
    快速回复加载失败
    \n
    重新加载
    '),document.getElementById("pc-quickReply-loaderror").appendChild(n),document.getElementById("pc-quickReply-loaderror-reload").onclick=function(){e.getQuickReplyList()}}}else document.getElementById("pc-quickReply-loading").style.display="none",document.getElementById("pc-quickReply-loaderror").style.display="none",document.getElementById("pc-quickReply-content").style.display="block",this.matchQuickReplyBtn()}},{key:"sendQuickReply",value:function(A,e){var t=this;this.sendLoadingStats=!0,this.setBtnCheckLoading(0,e);LA(this.jSPlugin,A.fileUrl,(function(A){t.sendLoadingStats=!1,t.setBtnCheckLoading(1,e),A&&200==A.code?t.toastCustom.initToastContent("快捷回复成功"):t.toastCustom.initToastContent("快捷回复失败,请重试"),t.switchFooter("onBell")}),(function(A){console.log(A),t.sendLoadingStats=!1,t.setBtnCheckLoading(1,e),t.toastCustom.initToastContent("快捷回复失败,请重试"),t.switchFooter("onBell")}))}}])}(),GA=function(){return o((function A(e,t){a(this,A),this.jSPlugin=e,this.videoWidth=e.width,this.switchFooter=t,this.toastCustom=new NA(e,!1),this.lockStatus=!1,this.initRemoteUnlock()}),[{key:"initRemoteUnlock",value:function(){document.getElementById("pc-remoteUnlock-back")?this.madeSlideEvent():this.renderRemoteUnlock()}},{key:"renderRemoteUnlock",value:function(){var A=this,e=this.videoWidth/1024||1,t=document.createElement("div");t.style="width:100%;",t.id="pc-remoteUnlock-box",t.innerHTML='
    \n
    \n
    \n \n 返回\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n 返回\n
    \n
    \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-audioControls-remoteUnlock")).appendChild(t),document.getElementById("pc-remoteUnlock-back").onclick=function(){A.goback()},this.renderRemoteUnlockSlide()}},{key:"renderRemoteUnlockSlide",value:function(){var A=this.videoWidth/1024||1,e=document.getElementById("pc-remoteUnlock-content"),t=document.createElement("div");t.id="pc-remoteUnlock-content-slide",t.style="width: 100%;display: flex;justify-content: center;cursor: pointer;",t.innerHTML='
    \n
    \n
    右滑开锁
    \n
    \n \n \n \n \n \n \n \n \n \n
    \n
    '),e.appendChild(t),this.madeSlideEvent()}},{key:"getOffsetLeft",value:function(A){var e=0;do{e+=A.offsetLeft,A=A.parentNode}while(A.parentNode);return e}},{key:"madeSlideEvent",value:function(){var A=this.videoWidth/1024||1,e=document.getElementById("".concat(this.jSPlugin.id)),t=this.getOffsetLeft(e),i=document.getElementById("pc-remoteUnlock-slide-box"),n=document.getElementById("pc-remoteUnlock-slide-bgColor"),a=document.getElementById("pc-remoteUnlock-slide-tips"),r=document.getElementById("pc-remoteUnlock-slide-ball"),o=this;r.onmousedown=function(e){var s=(e=e||window.event).offsetX;r.style.transition="",n.style.transition="",document.onmouseup=function(){console.log("--------------onmouseup"),o.lockStatus||(n.style.width="0px",r.style.left=8*A+"px",r.style.transition="left 0.6s linear",n.style.transition="width 0.6s linear"),document.onmouseup=null,document.onmousemove=null},document.onmousemove=function(e){e=e||window.event;console.log("videoDom",t);var g=e.pageX-i.offsetLeft-s-t,c=i.clientWidth-r.clientWidth-8*A;g<=0&&(g=0),g>=c&&(g=c),r.style.left=g+"px",g!=c||o.lockStatus||o.lockStatus||(o.lockStatus=!0,document.getElementById("slide-ball-start").style.display="none",document.getElementById("slide-ball-end").style.display="inline",n.style.width=i.clientWidth+"px",n.style.backgroundColor="#598FFF",i.style.border="0",r.style.backgroundColor="#ffffff",a.textContent="正在开锁",r.onmousedown=null,document.onmousemove=null,o.sendRemoteUnlockApi())}}}},{key:"resetRemoteUnlockSlide",value:function(){var A=document.getElementById("pc-remoteUnlock-box"),e=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-remoteUnlock"));A&&e&&e.removeChild(A)}},{key:"sendRemoteUnlockApi",value:function(){var A=this;console.log("下发远程开锁");MA(this.jSPlugin,(function(e){e&&200==e.code?A.toastCustom.initToastContent("开锁成功"):A.toastCustom.initToastContent("开锁失败,请重试"),A.goback()}),(function(e){console.log(e),A.toastCustom.initToastContent("开锁失败,请重试"),A.goback()}))}},{key:"goback",value:function(){this.switchFooter("onCall"),this.resetRemoteUnlockSlide()}}])}(),UA={customConfig:{defaultMicro:0,defaultPlay:0,maxTalkTime:0,bellPoster:0,maxBellTime:0},header:{onBell:{color:"#2c2c2c",backgroundColor:"#00000000 linear-gradient(180deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.00) 100%)",activeColor:"#1890FF",autoFocus:0,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-0",iconId:"ringStatus",part:"left",defaultActive:0,isrender:1,color:"#ffffff",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-1",iconId:"deviceCategory",part:"left",defaultActive:0,isrender:1,color:"#ffffff",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"}]},onCall:{color:"#2c2c2c",backgroundColor:"#00000000",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-0",iconId:"callStatus",part:"left",defaultActive:0,isrender:1,color:"#ffffff",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-1",iconId:"deviceCategory",part:"left",defaultActive:0,isrender:1,color:"#ffffff",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"}]}},footer:{onBell:{color:"#ffffff",backgroundColor:"#00000000",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-0",iconId:"quickReply",part:"left",defaultActive:1,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-1",iconId:"rejection",part:"left",defaultActive:0,isrender:1,color:"#2C2C2C",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-2",iconId:"answer",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-3",iconId:"remoteUnlock",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"}]},onCall:{color:"#2c2c2c",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-0",iconId:"mute",part:"left",defaultActive:1,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-1",iconId:"hangUp",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-2",iconId:"remoteUnlock",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"}]}}},JA=function(A){var e="";return Object.keys(A).map((function(t,i){e+="".concat(t,":").concat(A[t]).concat(i1&&void 0!==arguments[1])||arguments[1],t=r.themeData,i=t.header,n=t.footer,a=null;if("onCall"==A){console.log("接听"),r.bellStatus="onCall",r.switchFooter("onCall"),n[r.bellStatus].btnList.map((function(A,e){A.isrender&&r.renderFooter(A.iconId,A),"mute"==A.iconId&&(a=A)})),i[r.bellStatus].btnList.map((function(A,e){A.isrender&&r.renderHeader(A.iconId,A)}));var o=document.getElementById("".concat(r.jSPlugin.id,"-header-onBell"));o&&o.parentElement.removeChild(o),1==r.themeData.customConfig.bellPoster&&document.getElementById("bellring-icon")&&document.getElementById("".concat(r.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon")),0==r.themeData.customConfig.defaultMicro&&a?r.muteCommon(a):r.setDecoderState({mute:!1},a.backgroundColor),r.removeBellRing()}else console.log("响铃"),r.bellStatus="onBell",r.jSPlugin.Theme.changeTheme(r.themeData,e)})),this.jSPlugin=e,this.videoWidth=e.width,this.videoHeight=e.height,this.themeData=t,this.setDecoderState=i,this.decoderState=n,this.isNeedRenderHeader=!1,this.isNeedRenderFooter=!1,this.autoFocus=0,this.autoFocusTimer=null,this.bellStatus="onBell",this.recordTimer=null,this.nextRate=1,this.themeInited=!1,this.inited=!1,this.activeThemeStatus=!0,this.activeThemeStatusTxt="模板未激活",this.toastCustom=new NA(e,!1)}),[{key:"initBellRing",value:function(){var A=this,e=this.decoderState.state,t=e.play,i=e.isEditing;e.rejection;var n=this.videoWidth/1024;this.maxBellTime=1e3*this.themeData.customConfig.maxBellTime;var a=document.getElementById("bellring"),r=document.getElementById("bellring-audio");if(!a&&!r){if(this.jSPlugin.isNeedBellRing){var o=document.createElement("div");o.id="bellring",o.innerHTML='
    \n \n
    ',document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(o)}if(1!=this.themeData.customConfig.bellPoster||i)document.getElementById("bellring-icon")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon"));else{var s=(this.videoHeight-180*n)/2,g=document.createElement("div");g.id="bellring-icon",g.style="position: absolute;pointer-events: none;background: none;width: 100%;\n position: absolute;top: ".concat(s,"px;display: flex;align-items: center;justify-content: center;"),g.innerHTML='
    \n
    \n \n icon/响铃\n \n \n \n \n \n
    \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(g),t&&"onBell"==this.bellStatus&&this.jSPlugin.pause()}setTimeout((function(){var e=A.decoderState.state,t=e.isEditing,i=e.rejection;"onBell"!=A.bellStatus||i||(A.removeBellRing(),t||A.answerOvertime())}),this.maxBellTime)}}},{key:"removeBellRing",value:function(){document.getElementById("bellring")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring")),document.getElementById("bellring-icon")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon"))}},{key:"matchBtn",value:function(A,e){var t=this,i=this.themeData,n=i.header,a=i.footer,r=this.decoderState.state,o=r.mute,s=r.rejection,g={title:"",id:"",domString:"",color:"#FFFFFF",activeColor:"#FFFFFF",onclick:function(){},onmoveleft:function(){},onmoveright:function(){},onremove:function(){}};-1===n[this.bellStatus].btnList.findIndex((function(e){return e.iconId===A}))?(g.color=a[this.bellStatus].color,g.backgroundColor=a[this.bellStatus].backgroundColor,g.activeColor=a[this.bellStatus].activeColor):(g.color=n[this.bellStatus].color,g.backgroundColor=n[this.bellStatus].backgroundColor,g.activeColor=n[this.bellStatus].activeColor);var c=this.videoWidth/6;this.videoWidth;var l=this.videoWidth/1024||1;switch(A){case"ringStatus":return g.title=this.activeThemeStatus?"有人按门铃":this.activeThemeStatusTxt,g.id=A,g.domString='').concat(this.activeThemeStatus?"有人按门铃":this.activeThemeStatusTxt,""),g.onclick=function(){},g;case"deviceCategory":return g.title="设备名称",g.id=A,g.domString='').concat(this.deviceInfoData&&this.deviceInfoData.deviceName||"设备名称",""),g.onclick=function(){},g;case"callStatus":return g.title="通话中",g.id=A,g.domString='通话中'),g.onclick=function(){},g;case"deviceCategory":return g.title="设备名称",g.id=A,g.domString='').concat(this.deviceInfoData&&this.deviceInfoData.deviceName||"设备名称",""),g.onclick=function(){},g;case"rejection":return g.title="拒绝",g.id=A,g.domString='
    \n
    \n \n 拒绝\n \n \n \n \n \n
    \n
    拒绝
    \n
    '),g.onclick=function(){var A=t.decoderState.state,e=A.play,i=A.isEditing,n=A.rejection;if(i||n)return!1;console.log("拒绝"),e&&t.jSPlugin.stop(),t.removeBellRing(),t.setDecoderState({play:!1,rejection:!0}),t.rejectionStatusDispose(),"function"==typeof t.jSPlugin.hangUpCallback&&t.jSPlugin.hangUpCallback("rejection")},g;case"quickReply":return g.title="快捷回复",g.id=A,g.domString='
    \n
    \n \n 快捷回复\n \n \n \n \n \n
    \n
    快捷回复
    \n
    '),g.onclick=function(){if(t.decoderState.state.rejection)return!1;console.log("快捷回复"),t.switchFooter("quickReply"),t.quickReplyEle=new YA(t.jSPlugin,t.switchFooter)},g;case"answer":return g.title="接听",g.id=A,g.domString='
    \n
    \n \n 接听\n \n \n \n \n \n
    \n
    接听
    \n
    '),g.onclick=function(){var A=t.decoderState.state,i=A.play,r=A.isEditing,o=A.talk,s=A.sound,g=A.rejection;if(r||g)return!1;console.log("接听"),t.jSPlugin.pluginStatus.loadingClear(),i||(t.jSPlugin.pluginStatus.loadingStart(t.jSPlugin.id),t.jSPlugin.pluginStatus.loadingSetText({text:"视频加载中"}),t.jSPlugin.play(),t.setDecoderState({play:!i})),o||1!=t.themeData.customConfig.defaultMicro||(t.setDecoderState({talk:!0,mute:!1}),s&&t.jSPlugin.closeSound(),t.jSPlugin.Talk.startTalk()),t.setDecoderState({sound:!1}),t.bellStatus="onCall",t.switchFooter("onCall"),a[t.bellStatus].btnList.map((function(A,e){A.isrender&&t.renderFooter(A.iconId,A)})),n[t.bellStatus].btnList.map((function(A,e){A.isrender&&t.renderHeader(A.iconId,A)}));var c=document.getElementById("".concat(t.jSPlugin.id,"-header-onBell"));c&&c.parentElement.removeChild(c),1==t.themeData.customConfig.bellPoster&&(document.getElementById("bellring-icon")&&document.getElementById("".concat(t.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon")),t.jSPlugin.setPoster("")),0==t.themeData.customConfig.defaultMicro&&(t.muteCommon(e),t.jSPlugin.openSound(),t.setDecoderState({sound:!0})),t.removeBellRing(),t.maxTalkTime=1e3*t.themeData.customConfig.maxTalkTime*60;var l=t;setTimeout((function(){o&&(console.log("结束对讲"),l.setDecoderState({talk:!1}),l.jSPlugin.Talk.stopTalk()),i&&(l.jSPlugin.stop(),l.setDecoderState({play:!i})),t.rejectionStatusDispose(),t.remoteUnlockEle&&t.remoteUnlockEle.goback(),"function"==typeof t.jSPlugin.hangUpCallback&&t.jSPlugin.hangUpCallback("hangUp")}),t.maxTalkTime)},g;case"remoteUnlock":return g.title="远程开锁",g.id=A,g.domString='
    \n
    \n \n 开锁\n \n \n \n \n \n
    \n
    远程开锁
    \n
    '),g.onclick=function(){var A=t.decoderState.state,e=A.isEditing,i=A.rejection;if(e||"onBell"==t.bellStatus||i)return!1;console.log("远程开锁"),t.switchFooter("remoteUnlock"),t.remoteUnlockEle=new GA(t.jSPlugin,t.switchFooter)},g;case"mute":return g.title="静音",g.id=A,g.domString='
    \n
    \n \n 静音\n \n \n \n \n \n
    \n
    静音
    \n
    '),g.onclick=function(){var A=t.decoderState.state,i=A.talk,n=A.sound;if(A.play,A.rejection)return!1;console.log("静音"),i?(console.log("结束对讲"),t.setDecoderState({talk:!1,mute:!0},e.backgroundColor),t.jSPlugin.Talk.stopTalk(),t.jSPlugin.openSound(),t.setDecoderState({sound:!0})):(console.log("开始对讲"),t.setDecoderState({talk:!0,mute:!1},e.backgroundColor),n&&(t.jSPlugin.closeSound(),t.setDecoderState({sound:!1})),t.jSPlugin.Talk.startTalk())},g;case"hangUp":return g.title="挂断",g.id=A,g.domString='
    \n
    \n \n 挂断\n \n \n \n \n \n
    \n
    挂断
    \n
    '),g.onclick=function(){var A=t.decoderState.state,e=A.talk,i=A.play,n=A.sound;if(A.rejection)return!1;e&&(console.log("结束对讲"),t.setDecoderState({talk:!1}),t.jSPlugin.Talk.stopTalk()),i&&(t.jSPlugin.stop(),t.setDecoderState({play:!i})),n&&(t.jSPlugin.closeSound(),t.setDecoderState({sound:!1})),(i||e)&&(console.log("挂断"),t.removeBellRing(),t.rejectionStatusDispose(),"function"==typeof t.jSPlugin.hangUpCallback&&t.jSPlugin.hangUpCallback("hangUp"))},g;default:return g}}},{key:"answerOvertime",value:function(){this.toastCustom.initToastContent("应答超时");var A=this.decoderState.state.play;console.log("应答超时"),A&&this.jSPlugin.stop(),this.setDecoderState({play:!1,rejection:!0}),this.rejectionStatusDispose(),this.switchFooter("onBell"),"function"==typeof this.jSPlugin.hangUpCallback&&this.jSPlugin.hangUpCallback("rejection")}},{key:"rejectionStatusDispose",value:function(){var A=this,e=this.themeData.footer,t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")),n=document.getElementById("header-".concat(this.bellStatus,"-ringStatus"));"onBell"==this.bellStatus?(t.innerHTML="",t.style.color="#ffffff"):(i.innerHTML="",i.style.color="#ffffff"),console.log("rejectionStatusDispose"),this.setDecoderState({rejection:!0}),e[this.bellStatus].btnList.map((function(e,t){e.isrender&&A.renderFooter(e.iconId,e)})),n.innerText="通话已结束",this.jSPlugin.pluginStatus.loadingClear(),this.jSPlugin.pluginStatus.loadingSetTextWithBtn({text:"通话已结束",color:"white",isMobile:!1,type:2})}},{key:"userNoDevice",value:function(){var A=this;this.removeBellRing(),this.setDecoderState({rejection:!0});var e=this.themeData.footer,t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"));"onBell"==this.bellStatus?(t.innerHTML="",t.style.color="#ffffff"):(i.innerHTML="",i.style.color="#ffffff"),console.log("userNoDevice"),this.setDecoderState({rejection:!0}),e[this.bellStatus].btnList.map((function(e,t){e.isrender&&A.renderFooter(e.iconId,e)})),this.jSPlugin.pluginStatus.loadingClear(),this.jSPlugin.pluginStatus.loadingSetTextWithBtn({text:"该用户不拥有该设备",color:"white",isMobile:!1,type:2})}},{key:"renderHeader",value:function(A,e){var t=this,i=this.videoWidth/1024||1,n=this.matchBtn(A,e);if(document.getElementById("".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus,"-content"))){var a=document.createElement("span");a.innerHTML="".concat(n.domString),document.getElementById("".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus,"-content")).appendChild(a)}else{var r=document.createElement("div");r.id="".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus),r.style="max-width:50%;position:relative;",r.innerHTML='\n ').concat(n.domString,"\n "),r.onclick=function(A){if(t.decoderState.state.isEditing||!t.activeThemeStatus)return!1;n.onclick(A)},document.getElementById("".concat(this.jSPlugin.id,"-headControl")).childNodes[0].appendChild(r)}}},{key:"renderFooter",value:function(A,e){var t=this,i=this.decoderState.state.mute;if(console.log("-------------renderFooter"),"remoteUnlock"==A&&this.jSPlugin.capacity&&(!this.jSPlugin.capacity.support_unlock||0==this.jSPlugin.capacity.support_unlock))return!1;var n=this.matchBtn(A,e),a=this.videoWidth/6,r=document.createElement("div");r.className="theme-icon-item",this.jSPlugin.isWebConsole?r.style="padding:0 ".concat(.1*a,"px;"):r.style="padding:0 ".concat(.1*a,"px;cursor: pointer;"),r.innerHTML="".concat('')+'
    ')).concat(n.domString,"
    ")+"
    ",r.onclick=function(A){if(t.decoderState.state.isEditing||!t.activeThemeStatus)return!1;n.onclick(A)},n.onmouseenter&&(r.onmouseenter=function(A){if(t.decoderState.state.isEditing||!t.activeThemeStatus)return!1;n.onmouseenter(A)}),n.onmouseleave&&(r.onmouseleave=function(A){if(t.decoderState.state.isEditing||!t.activeThemeStatus)return!1;n.onmouseleave(A)});var o=this.videoWidth/597,s=document.createElement("span");s.className="icon-move left",s.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),s.onclick=function(){t.editIcon(n.id,"left","footer")},r.appendChild(s);var g=document.createElement("span");if(g.className="icon-move right",g.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),g.onclick=function(){t.editIcon(n.id,"right","footer")},r.appendChild(g),"answer"==A||"rejection"==A||"hangUp"==A);else{var c=document.createElement("span");c.className="icon-move close",c.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),c.onclick=function(){t.editIcon(n.id,"delete","footer")},r.appendChild(c)}"onCall"==this.bellStatus?document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).appendChild(r):document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).appendChild(r),this.decoderState.state.isEditing&&"mute"==A&&"onCall"==this.bellStatus&&(0!=this.themeData.customConfig.defaultMicro||i?this.setDecoderState({mute:!1},e.backgroundColor):this.setDecoderState({mute:!0},e.backgroundColor))}},{key:"switchFooter",value:function(A){var e={};switch(this.themeData&&(e=this.themeData.footer),A){case"onBell":document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReply"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReply")).style.display="none"),document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"))?"none"==document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.display&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="flex"):document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="flex";break;case"onCall":document.getElementById("".concat(this.jSPlugin.id,"-audioControls-remoteUnlock")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.display="flex",this.themeData&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.color=e[this.bellStatus].color);break;case"quickReply":document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReply")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="none";break;case"remoteUnlock":document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-audioControls-remoteUnlock")).style.display="flex"}}},{key:"initThemeData",value:function(){var A=this;console.log("-------------initThemeData");var e=this.decoderState.state.isEditing,t=this.themeData,i=t.header,n=t.footer,a=this.jSPlugin.id,r=this.videoWidth/1024;if(this.isNeedRenderHeader=b.findIndex(i[this.bellStatus].btnList,(function(A){return A.isrender>0}))>=0,this.isNeedRenderFooter=b.findIndex(n[this.bellStatus].btnList,(function(A){return A.isrender>0}))>=0,this.isNeedRenderHeader)if(document.getElementById("".concat(this.jSPlugin.id,"-headControl")))document.getElementById("".concat(this.jSPlugin.id,"-headControl")).innerHTML="
    ");else{var o=document.createElement("div");o.setAttribute("id","".concat(this.jSPlugin.id,"-headControl")),o.setAttribute("class","header-controls"),o.innerHTML="
    "),console.log(this.jSPlugin.height);var s=.2*this.jSPlugin.height+"px",g={height:s,display:"flex","justify-content":"space-between",top:0,"z-index":999,color:"#FFFFFF",width:"100%",position:"relative","margin-bottom":"-"+s,"align-items":"center",background:"transparent linear-gradient(180deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.00) 100%)"};o.style=JA(g),document.getElementById("".concat(a,"-wrap")).insertBefore(o,document.getElementById(a));var c=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(c)}),50)}else document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&document.getElementById("".concat(this.jSPlugin.id,"-headControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-headControl")));var l=.3*this.jSPlugin.height;if(this.isNeedRenderFooter)if(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")))document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop="-".concat(l,"px"),"onCall"==this.bellStatus?document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).innerHTML='\n \n \n \n \n '):document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).innerHTML='\n \n \n \n \n '));else{var I=document.createElement("div");I.setAttribute("id","".concat(this.jSPlugin.id,"-ez-iframe-footer-container")),I.setAttribute("class","ez-iframe-footer-container");var C={"min-height":l+"px","max-height":l+"px",position:"relative","margin-top":"-"+l+"px",display:"flex","flex-wrap":"wrap","justify-content":"space-between","z-index":999,top:0,color:"#FFFFFF",width:"100%","align-items":"center","background-image":"linear-gradient(180deg, rgba(0,0,0,0.00) 0%, rgba(0,0,0,0.60) 100%)","font-size":24*r+"px"};I.style=JA(C),I.innerHTML='\n \n \n \n \n '),E(I,document.getElementById(a))}else document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")));if(this.isNeedRenderHeader&&document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.background=i[this.bellStatus].backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=i[this.bellStatus].color,i[this.bellStatus].btnList.map((function(e,t){e.isrender&&A.renderHeader(e.iconId,e)}))),this.isNeedRenderFooter&&document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=n[this.bellStatus].backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=n[this.bellStatus].color,n[this.bellStatus].btnList.map((function(e,t){e.isrender&&A.renderFooter(e.iconId,e)}))),1==this.themeData.customConfig.bellPoster&&!e){this.jSPlugin.poster="https://resource.eziot.com/group1/M00/00/B8/CtwQEmPbGh2AVJB-ABDcYtyw5gk899.svg";var d=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(d),A.jSPlugin.setPoster(A.jSPlugin.poster))}),50)}this.activeThemeStatus&&(this.initBellRing(),window.addEventListener("click",this.autoPlayRing)),this.inited=!0,this.getCallDeviceInfo()}},{key:"renderThemeData",value:function(){var A=this,e=this.decoderState.state.isEditing,t=this.themeData,i=t.header,n=t.footer;if(this.isNeedRenderHeader&&i&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.background=i[this.bellStatus].backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=i[this.bellStatus].color.replace("-diy",""),i[this.bellStatus].btnList.map((function(e,t){e.isrender&&A.setDecoderState(s({},e.iconId,A.decoderState.state[e.iconId]))}))),this.isNeedRenderFooter&&n)document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=n[this.bellStatus].backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=n[this.bellStatus].color.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.color=n[this.bellStatus].color.replace("-diy",""),n[this.bellStatus].btnList.map((function(t,i){if(t.isrender&&A.setDecoderState(s({},t.iconId,A.decoderState.state[t.iconId])),0==i&&!A.themeInited&&A.activeThemeStatus)var n=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(n),1!=A.themeData.customConfig.bellPoster||e?A.jSPlugin.play():A.jSPlugin.pluginStatus.loadingClear(),A.themeInited=!0)}),50)})),-1!==this.jSPlugin.url.indexOf("hd.live")&&this.setDecoderState({hd:!0}),this.themeData.autoFocus>0&&(this.autoFocus=parseInt(this.themeData.autoFocus),this.startAutoFocus(),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).addEventListener("click",(function(){A.stopAutoFocus()}))),this.setDecoderState({cloudRec:"cloud.rec"===p(this.jSPlugin.url).type,rec:"rec"===p(this.jSPlugin.url).type,type:p(this.jSPlugin.url).type});else if(!this.themeInited&&this.activeThemeStatus)var a=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(a),A.themeData&&A.themeData.customConfig&&1==A.themeData.customConfig.bellPoster&&!e?A.jSPlugin.pluginStatus.loadingClear():A.jSPlugin.play(),A.themeInited=!0)}),50);var r=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(r),A.jSPlugin.reSize(A.jSPlugin.params.width,A.jSPlugin.params.height))}),50)}},{key:"setThemeData",value:function(A,e){this.themeData=A,"onCall"==e&&(this.bellStatus="onCall")}},{key:"startAutoFocus",value:function(){var A=this,e=this.autoFocus;this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.autoFocusTimer=setTimeout((function(){document.getElementById("".concat(A.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(A.jSPlugin.id,"-audioControls")).style.opacity=0,document.getElementById("".concat(A.jSPlugin.id,"-audioControls")).style.pointerEvents="none")}),1e3*e)}},{key:"stopAutoFocus",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.opacity=1,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.pointerEvents="all"),this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.startAutoFocus()}},{key:"editIcon",value:function(A,e,t){console.log("编辑组件",A,e,t);var i=this.themeData;console.log("themeData",this.themeData);var n=this.themeData[t][this.bellStatus].btnList,a=b.findIndex(n,(function(e){return e.iconId===A})),r=n[a];switch(e){case"delete":n[a].isrender=0;break;case"right":for(var o=-1,s=a+1;s=0;c--)if(n[c].part===n[a].part&&1==n[c].isrender){g=c;break}-1!==g&&(n[a]=n[g],n[g]=r)}console.log("new btnList",n),i[t][this.bellStatus].btnList=n,this.jSPlugin.Theme.changeTheme(i)}},{key:"countTime",value:function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=this;if(!document.getElementById(this.jSPlugin.id+"time-area")){var i=document.createElement("div");i.id=this.jSPlugin.id+"time-area",i.className="time-area",i.innerHTML='00:00',document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).appendChild(i)}if(this.countTimer&&clearInterval(this.countTimer),"add"===A){var n=e;document.getElementById(t.jSPlugin.id+"time-area").style.display="flex",this.countTimer=setInterval((function(){++n,document.getElementById(t.jSPlugin.id+"time-area").children[1].innerHTML=function(A){var e=parseInt(A),t=0,i=0,n="00",a="00",r="00";e>59&&(t=parseInt(e/60),e=parseInt(e%60),t>59&&(i=parseInt(t/60),t=parseInt(t%60)));return n=parseInt(e)>9?parseInt(e):"0"+parseInt(e),a=parseInt(t)>9?parseInt(t):"0"+parseInt(t),r=parseInt(i)>9?parseInt(i):"0"+parseInt(i),i>0?r+":"+a+":"+n:t>0?a+":"+n:"00:"+n}(n)}),1e3)}else"destroy"===A&&(this.countTimer&&clearInterval(this.countTimer),this.countTimer=void 0,document.getElementById(t.jSPlugin.id+"time-area")&&(document.getElementById(t.jSPlugin.id+"time-area").children[1].innerHTML="00:00",document.getElementById(t.jSPlugin.id+"time-area").style.display="none"))}},{key:"editStart",value:function(A){console.log("----------editStart2");var e=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"));document.getElementById("".concat(this.jSPlugin.id,"-headControl")),e&&e.setAttribute("class","footer-controls themeEditing"),t&&t.setAttribute("class","footer-controls themeEditing"),this.setDecoderState({isEditing:!0})}},{key:"editEnd",value:function(A){console.log("----------editEnd2");var e=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),t=document.getElementById("".concat(this.jSPlugin.id,"-headControl")),i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"));t&&t.setAttribute("class","header-controls"),e&&e.setAttribute("class","footer-controls"),i&&i.setAttribute("class","footer-controls")}},{key:"fetchThemeData",value:function(A){var e=this;wA(this.jSPlugin,A,(function(A){0==A.meta.code&&A.data?(e.activeThemeStatus=!0,e.themeData=A.data,A.data.header&&(e.themeData.header=A.data.header,e.themeData.header[e.bellStatus].btnList=e.themeData.header[e.bellStatus].btnList.sort((function(A,e){return A.btnKey.split("-")[3]-e.btnKey.split("-")[3]}))),A.data.footer&&(e.themeData.footer=A.data.footer,e.themeData.footer[e.bellStatus].btnList=e.themeData.footer[e.bellStatus].btnList.sort((function(A,e){return A.btnKey.split("-")[3]-e.btnKey.split("-")[3]}))),e.jSPlugin.capacity?(e.initThemeData(),e.renderThemeData()):setTimeout((function(){e.initThemeData(),e.renderThemeData()}),300)):(e.activeThemeStatus=!1,e.jSPlugin.pluginStatus.loadingClear(),e.setDecoderState({rejection:!0}),"111021"==A.meta.code?(e.jSPlugin.pluginStatus.loadingSetText({text:"无效的模板id",color:"#fff"}),e.activeThemeStatusTxt="无效的模板id"):"111023"==A.meta.code?(e.jSPlugin.pluginStatus.loadingSetText({text:"您的试用特权已到期,需前往轻应用控制台购买后使用。",color:"#fff"}),e.activeThemeStatusTxt="试用特权已到期"):(e.jSPlugin.pluginStatus.loadingSetText({text:"模板未激活,请先在开放平台轻应用控制台购买模板",color:"#fff"}),e.activeThemeStatusTxt="模板未激活"),e.themeData=UA,e.initThemeData(),e.renderThemeData())}),(function(){e.renderThemeData()}))}},{key:"getCallDeviceInfo",value:function(){var A=this;this.videoWidth,FA({accessToken:this.jSPlugin.accessToken,deviceSerial:p(this.jSPlugin.url).deviceSerial}).then((function(e){console.log("---------getCallDeviceInfo"),A.deviceInfoData=e.data,e.data.isEncrypt&&setTimeout((function(){A.jSPlugin.pluginStatus.loadingClear(),A.jSPlugin.pluginStatus.loadingSetText({text:"视频已加密",color:"#fff"})}),500),document.getElementById("header-".concat(A.bellStatus,"-deviceCategory"))&&(document.getElementById("header-".concat(A.bellStatus,"-deviceCategory")).innerText=""+e.data.deviceName)})).catch((function(e){20018!=e.code||A.jSPlugin.isWebConsole||A.userNoDevice(),console.log("获取设备信息失败",e)}))}},{key:"setHeaderText",value:function(A){var e=this.videoWidth/1024||1;document.getElementById("".concat(this.jSPlugin.id,"-deviceCategory-content"))&&(document.getElementById("".concat(this.jSPlugin.id,"-deviceCategory-content")).innerHTML='').concat(A,'').concat(this.deviceInfoData&&this.deviceInfoData.deviceName||"",""))}}])}(),KA=function(){return o((function A(e,t){a(this,A),this.jSPlugin=e,this.heightPop=t||366,this.initPopupCustom()}),[{key:"initPopupCustom",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-wrap-popup-custom"))?document.getElementById("".concat(this.jSPlugin.id,"-wrap-popup-custom")).style.display="flex":this.randerPopup()}},{key:"randerPopup",value:function(){var A=this,e=document.documentElement.clientWidth/375||1,t=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(t),t.innerHTML="@keyframes slideContentUp {0% {bottom: -".concat(366*e,"px;}\n 25% {bottom: -").concat(244*e,"px;}\n 50% {bottom: -").concat(122*e,"px;}\n 100% {bottom:0;}} .open-popup{animation:slideContentUp 0.3s 1 linear; -webkit-animation: slideContentUp 0.3s 1 linear;}");var i=document.getElementById("".concat(this.jSPlugin.id,"-wrap")),n=document.createElement("div");n.style="display:flex;",n.id="".concat(this.jSPlugin.id,"-wrap-popup-custom"),n.innerHTML='
    \n
    \n
    \n
    \n
    \n \n icon/close\n \n \n \n \n \n \n \n
    \n \n
    \n
    \n
    \n '),i.appendChild(n),document.getElementById("".concat(this.jSPlugin.id,"-wrap-popup-custom-mask")).onclick=function(){A.closePopupCustom()},document.getElementById("".concat(this.jSPlugin.id,"-popup-board-close")).onclick=function(){A.closePopupCustom()}}},{key:"closePopupCustom",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){})();var A=document.getElementById("".concat(this.jSPlugin.id,"-wrap")),e=document.getElementById("".concat(this.jSPlugin.id,"-wrap-popup-custom"));A&&e&&A.removeChild(e)}},{key:"initPopupContent",value:function(A,e){document.getElementById("popup-board-title-content").innerText=A||"",e&&document.getElementById("".concat(this.jSPlugin.id,"-popup-board-content")).appendChild(e)}}])}(),VA=function(){return o((function A(e,t,i){a(this,A),this.jSPlugin=e,this.videoWidth=i,this.switchFooter=t,this.toastCustom=new NA(e,!0),this.sendLoadingStats=!1,this.quickReplyList=["你好,请将快递放在门口","你好,稍等","你好,请将快递放入小区快递柜","你好,请将外卖放在门口"],this.popupCustom=new KA(e,366),document.getElementById("mobile-quickReply-list")||(this.popupCustom.initPopupContent("快捷回复",this.renderQuickReply()),this.initQuickReply())}),[{key:"initQuickReply",value:function(){document.getElementById("mobile-quickReply-list-item-0")||this.getQuickReplyList()}},{key:"renderQuickReply",value:function(){document.documentElement.clientWidth;var A=document.createElement("div");return A.style="width:100%;",A.id="mobile-quickReply-list",A.innerHTML='
    \n \n ',A}},{key:"matchQuickReplyBtn",value:function(){var A=this,e=this.videoWidth/375||1,t=document.getElementById("mobile-quickReply-content");this.quickReplyList&&this.quickReplyList.length>0&&this.quickReplyList.forEach((function(i,n){var a=document.createElement("div");a.id="mobile-quickReply-list-item-".concat(n),a.style="margin: ".concat(14*e,"px 0;\n padding: ").concat(12*e,"px ").concat(15*e,"px;min-height: ").concat(50*e,"px;width:100%;\n background: #ffffff;border-radius: ").concat(25*e,"px;display: flex;align-items: center;\n box-sizing: border-box;font-size:").concat(16*e,"px;color: #2c2c2c;"),a.innerHTML='\n \n icon/快捷回复播放\n \n \n \n \n \n ').concat(i.voiceName,""),a.onclick=function(){console.log("item:"+i),A.sendLoadingStats||(A.setBtnCheckStatus(n),A.sendQuickReply(i))},t.appendChild(a)}))}},{key:"setBtnCheckStatus",value:function(A){var e=this,t="";this.quickReplyList.forEach((function(i,n){t=document.getElementById("mobile-quickReply-list-item-".concat(n)),n==A?(t.style.background="#F4F6FC",t.style.color="#648FFC",e.setBtnCheckLoding(0,n)):(t.style.background="#ffffff",t.style.color="#2c2c2c")}))}},{key:"setBtnCheckLoding",value:function(A,e){console.log(e);var t=this.videoWidth/375||1;if(e>-1){var i=document.getElementById("mobile-quickReply-list-item-".concat(e)),n=document.getElementById("mobile-quickReply-name-".concat(e)),a=document.getElementById("mobile-quickReply-icon-".concat(e));if(1==A){if(document.getElementById("mobile-quickReply-icon-loading-".concat(e))&&n){var r=document.createElement("span");r.id="mobile-quickReply-icon-".concat(e),r.style="height:".concat(24*t,"px;"),r.innerHTML='\n \n icon/快捷回复播放\n \n \n \n \n \n '),i.insertBefore(r,n)}}else if(a&&n){i.removeChild(a);var o=document.createElement("span");o.id="mobile-quickReply-icon-loading-".concat(e),o.style="height:".concat(20*t,"px;width: ").concat(24*t,"px;"),o.innerHTML=''),i.insertBefore(o,n)}}}},{key:"getQuickReplyList",value:function(){var A=this;console.log("getQuickReplyList"),this.madeLoadingDom(0);TA(this.jSPlugin,(function(e){if(e&&200==e.code){var t=e.data||[],i=[];e.data.forEach((function(A,e){i=A.voiceName.split("_"),t[e].voiceName=i[1]})),A.quickReplyList=t,setTimeout((function(){A.madeLoadingDom(2)}),500)}else A.madeLoadingDom(1)}),(function(e){console.log(e),A.madeLoadingDom(1)}))}},{key:"madeLoadingDom",value:function(A){var e=this,t=this.videoWidth/375||1;if(0==A){if(document.getElementById("mobile-quickReply-content").style.display="none",document.getElementById("mobile-quickReply-loaderror").style.display="none",document.getElementById("mobile-quickReply-loading").style.display="block",!document.getElementById("mobile-quickReply-loading-box")){var i=document.createElement("div");i.id="mobile-quickReply-loading-box",i.style="width: 100%;display: flex;align-items: center;justify-content: center;flex-direction: row;",i.innerHTML='
    \n \n
    \n
    正在加载,请稍候
    '),document.getElementById("mobile-quickReply-loading").appendChild(i)}}else if(1==A){if(document.getElementById("mobile-quickReply-content").style.display="none",document.getElementById("mobile-quickReply-loading").style.display="none",document.getElementById("mobile-quickReply-loaderror").style.display="block",!document.getElementById("mobile-quickReply-loaderror-box")){var n=document.createElement("div");n.id="mobile-quickReply-loaderror-box",n.style="width: 100%;display: flex;align-items: center;justify-content: center;flex-direction: column;",n.innerHTML='
    \n \n
    \n
    \n 加载失败 \n 点击重试\n
    '),document.getElementById("mobile-quickReply-loaderror").appendChild(n),document.getElementById("mobile-quickReply-loaderror-reload").onclick=function(){e.getQuickReplyList()}}}else document.getElementById("mobile-quickReply-loading").style.display="none",document.getElementById("mobile-quickReply-loaderror").style.display="none",document.getElementById("mobile-quickReply-content").style.display="block",this.matchQuickReplyBtn()}},{key:"sendQuickReply",value:function(A){var e=this;this.sendLoadingStats=!0;LA(this.jSPlugin,A.fileUrl,(function(A){e.sendLoadingStats=!1,A&&200==A.code?e.toastCustom.initToastContent("快捷回复成功"):e.toastCustom.initToastContent("快捷回复失败,请重试"),e.popupCustom.closePopupCustom()}),(function(A){console.log(A),e.sendLoadingStats=!1,e.toastCustom.initToastContent("快捷回复失败,请重试"),e.popupCustom.closePopupCustom()}))}},{key:"closeQuickReplyEle",value:function(){this.popupCustom.closePopupCustom()}}])}(),WA=function(){return o((function A(e,t,i){a(this,A),this.jSPlugin=e,this.videoWidth=i,this.switchFooter=t,this.toastCustom=new NA(e,!0),this.lockStatus=!1,this.popupCustom=new KA(e,265),this.popupCustom.initPopupContent("远程开锁",this.renderRemoteUnlock()),this.renderRemoteUnlockSlide()}),[{key:"initRemoteUnlock",value:function(){document.getElementById("mobile-remoteUnlock-content")?this.madeSlideEvent():this.renderRemoteUnlock()}},{key:"renderRemoteUnlock",value:function(){var A=this.videoWidth/1024||1,e=document.createElement("div");return e.style="width:100%;",e.id="mobile-remoteUnlock-box",e.innerHTML='
    \n
    \n
    '),e}},{key:"renderRemoteUnlockSlide",value:function(){var A=this.videoWidth/375||1,e=document.getElementById("mobile-remoteUnlock-content"),t=document.createElement("div");t.id="mobile-remoteUnlock-content-slide",t.style="width: 100%;display: flex;justify-content: center;padding: 0 ".concat(15*A,"px"),t.innerHTML='
    \n
    \n
    右滑开锁
    \n
    \n \n icon/箭头向右\n \n \n \n \n \n \n
    \n
    '),e.appendChild(t),this.madeSlideEvent()}},{key:"madeSlideEvent",value:function(){var A=this.videoWidth/375||1,e=document.getElementById("mobile-remoteUnlock-slide-box"),t=document.getElementById("mobile-remoteUnlock-slide-bgColor"),i=document.getElementById("mobile-remoteUnlock-slide-tips"),n=document.getElementById("mobile-remoteUnlock-slide-ball"),a=this;n.ontouchstart=function(r){console.log("ontouchstart");var o=(r=r||window.event).touches[0].pageX;n.style.transition="",t.style.transition="",document.ontouchmove=function(r){var s=(r=r||window.event).touches[0].pageX-e.offsetLeft-o,g=e.clientWidth-n.clientWidth-8*A;s<=0&&(s=0),s>=g&&(s=g),n.style.left=s+"px",s!=g||a.lockStatus||(a.lockStatus=!0,document.getElementById("slide-ball-start").style.display="none",document.getElementById("slide-ball-end").style.display="inline",t.style.width=e.clientWidth+"px",t.style.backgroundColor="#598FFF",e.style.border="0",n.style.backgroundColor="#ffffff",i.textContent="正在开锁",i.style.color="#ffffff",n.ontouchstart=null,a.sendRemoteUnlockApi())},document.ontouchend=function(){a.lockStatus||(t.style.width="0px",n.style.left=8*A+"px",n.style.transition="left 0.6s linear",t.style.transition="width 0.6s linear"),document.ontouchend=null,document.ontouchmove=null}}}},{key:"resetRemoteUnlockSlide",value:function(){var A=this.videoWidth/1024||1;this.lockStatus=!1;var e=document.getElementById("mobile-remoteUnlock-slide-box"),t=document.getElementById("mobile-remoteUnlock-slide-bgColor"),i=document.getElementById("mobile-remoteUnlock-slide-tips"),n=document.getElementById("mobile-remoteUnlock-slide-ball");t.style.width="0px",n.style.left=8*A+"px",i.textContent="右滑开锁",i.style.color="#666666",document.getElementById("slide-ball-start").style.display="inline",document.getElementById("slide-ball-end").style.display="none",t.style.backgroundColor="#FFFFFF",e.style.border="1px solid rgba(255,255,255,1)",n.style.backgroundColor="#598FFF"}},{key:"sendRemoteUnlockApi",value:function(){var A=this;console.log("下发远程开锁");MA(this.jSPlugin,(function(e){e&&200==e.code?A.toastCustom.initToastContent("开锁成功"):A.toastCustom.initToastContent("开锁失败,请重试"),A.popupCustom.closePopupCustom()}),(function(e){console.log(e),A.toastCustom.initToastContent("开锁失败,请重试"),A.popupCustom.closePopupCustom()}))}},{key:"closeRemoteUnlock",value:function(){this.popupCustom.closePopupCustom()}}])}(),jA={customConfig:{defaultMicro:0,defaultPlay:0,maxTalkTime:0,bellPoster:0,maxBellTime:0},header:{onBell:{color:"#2c2c2c",backgroundColor:"#00000000 linear-gradient(180deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.00) 100%)",activeColor:"#1890FF",autoFocus:0,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-0",iconId:"ringStatus",part:"left",defaultActive:0,isrender:1,color:"#2c2c2c",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-1",iconId:"deviceCategory",part:"left",defaultActive:0,isrender:1,color:"#2c2c2c",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"}]},onCall:{color:"#2c2c2c",backgroundColor:"#00000000",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-0",iconId:"callStatus",part:"left",defaultActive:0,isrender:1,color:"#2c2c2c",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-1",iconId:"deviceCategory",part:"left",defaultActive:0,isrender:1,color:"#2c2c2c",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"}]}},footer:{onBell:{color:"#2c2c2c",backgroundColor:"#00000000",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-0",iconId:"quickReply",part:"left",defaultActive:1,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-1",iconId:"rejection",part:"left",defaultActive:0,isrender:1,color:"#2C2C2C",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-2",iconId:"answer",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-3",iconId:"remoteUnlock",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"}]},onCall:{color:"#2c2c2c",backgroundColor:"#00000080",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-0",iconId:"mute",part:"left",defaultActive:1,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-1",iconId:"hangUp",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-2",iconId:"remoteUnlock",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"}]}}},OA=function(A){var e="";return Object.keys(A).map((function(t,i){e+="".concat(t,":").concat(A[t]).concat(i1&&void 0!==arguments[1])||arguments[1],t=r.themeData,i=t.header,n=t.footer,a=null;if("onCall"==A){console.log("接听"),r.bellStatus="onCall",r.switchFooter("onCall"),n[r.bellStatus].btnList.map((function(A,e){A.isrender&&r.renderFooter(A.iconId,A),"mute"==A.iconId&&(a=A)})),i[r.bellStatus].btnList.map((function(A,e){A.isrender&&r.renderHeader(A.iconId,A)}));var o=document.getElementById("".concat(r.jSPlugin.id,"-header-onBell"));o&&o.parentElement.removeChild(o),1==r.themeData.customConfig.bellPoster&&document.getElementById("bellring-icon")&&document.getElementById("".concat(r.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon")),0==r.themeData.customConfig.defaultMicro&&a?r.muteCommon(a):r.setDecoderState({mute:!1},a.backgroundColor),r.removeBellRing(),r.miniRecCloseClick()}else console.log("响铃"),r.bellStatus="onBell",r.jSPlugin.Theme.changeTheme(r.themeData,e)})),s(this,"muteCommon",(function(A){var e=r.decoderState.state,t=e.talk,i=e.sound;t?(console.log("结束对讲"),r.setDecoderState({talk:!1,mute:!0},A.backgroundColor),r.jSPlugin.Talk.stopTalk(),i||r.jSPlugin.openSound(),r.setDecoderState({sound:!0})):(r.setDecoderState({talk:!1,mute:!0},A.backgroundColor),i||r.jSPlugin.openSound(),r.setDecoderState({sound:!0}))})),s(this,"autoPlayRing",(function(){console.log("autoPlayRing");var A=document.getElementById("bellring-audio");A&&(A.muted=!1,A.src="https://resource.eziot.com/group2/M00/00/8F/CtwQFmPbWnOAGuT5AAHZihhCJEM230.mp3",A.paused&&A.play()),r.checkIsAppleDevice()||!1?window.removeEventListener("touchstart",r.autoPlayRing):window.removeEventListener("click",r.autoPlayRing)})),this.jSPlugin=e,this.videoWidth=e.width,this.videoHeight=e.height,this.themeData=t,this.setDecoderState=i,this.decoderState=n,this.isNeedRenderHeader=!1,this.isNeedRenderFooter=!1,this.autoFocus=0,this.autoFocusTimer=null,this.bellStatus="onBell",this.recordTimer=null,this.nextRate=1,this.themeInited=!1,this.inited=!1,this.miniRecStatus="rec",this.activeThemeStatus=!0,this.activeThemeStatusTxt="模板未激活",this.miniRecNum=0,this.toastCustom=new NA(e,!0)}),[{key:"initBellRing",value:function(){var A=this,e=this.decoderState.state,t=e.play,i=e.isEditing,n=this.videoWidth,a=n/375;this.maxBellTime=1e3*this.themeData.customConfig.maxBellTime;var r=document.getElementById("bellring"),o=document.getElementById("bellring-audio");if(!r&&!o){if(this.jSPlugin.isNeedBellRing){var s=document.createElement("div");s.id="bellring",s.innerHTML='
    \n \n
    ',document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(s)}if(1!=this.themeData.customConfig.bellPoster||i)document.getElementById("bellring-icon")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon"));else{var g=1.8*n,c=6;document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(c=document.getElementById("".concat(this.jSPlugin.id,"-headControl")).offsetHeight+.1*g+6);var l=c+(this.videoHeight-130*a)/2,I=document.createElement("div");I.id="bellring-icon",I.style="position: absolute;pointer-events: none;background: none;width: 100%;\n position: absolute;top: ".concat(l,"px;display: flex;align-items: center;justify-content: center;"),I.innerHTML='
    \n
    \n \n icon/响铃\n \n \n \n \n \n
    \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(I),t&&"onBell"==this.bellStatus&&this.jSPlugin.pause()}setTimeout((function(){var e=A.decoderState.state,t=e.isEditing,i=e.rejection;"onBell"!=A.bellStatus||i||(A.removeBellRing(),t||A.answerOvertime())}),this.maxBellTime)}}},{key:"removeBellRing",value:function(){document.getElementById("bellring")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring")),document.getElementById("bellring-icon")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon"))}},{key:"getMiniCallTimeUrl",value:function(){if(console.log("--------------getMiniCallTimeUrl"),-1!==this.jSPlugin.url.indexOf("hd.live")?this.recUrl=this.jSPlugin.url.replace("hd.live","rec"):this.recUrl=this.jSPlugin.url.replace("live","rec"),this.jSPlugin.callTime){var A=parseInt(this.jSPlugin.callTime),e=A+5e3,t=new Date(A-1e4).Format("yyyyMMddhhmmss"),i=new Date(e).Format("yyyyMMddhhmmss");this.recUrl="".concat(this.recUrl,"?begin=").concat(t,"&end=").concat(i),console.log("recurl="+this.recUrl)}}},{key:"initMiniRec",value:function(){var A=this,e=this,t=this.videoWidth,i=t/375,n=1.8*t,a=6;document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(a=document.getElementById("".concat(this.jSPlugin.id,"-headControl")).offsetHeight+.1*n+6);var r=a+this.videoHeight+10*i;if(console.log(a),document.getElementById("miniRecbox"))document.getElementById("miniRecbox")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("miniRecbox")),document.getElementById("miniClose")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("miniClose")),this.initMiniRec();else{var o=document.createElement("div");o.id="miniRecbox",o.style="-webkit-border-radius: 8px;border-radius: 8px;overflow: hidden;position: absolute;top: ".concat(r,"px;right: ").concat(9*i,"px;"),o.innerHTML='
    ',document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(o),this.getMiniCallTimeUrl();var s={domain:L};this.miniRecPlayer=new el({id:"miniRec",width:160*i,height:90*i,template:"miniRec",url:this.recUrl,accessToken:this.jSPlugin.accessToken,handleError:function(t){console.log("小窗口handleError------------",t),t&&6701==t.retcode?(A.miniRecNum=A.miniRecNum+1,console.log("小窗口miniRecNum-----------------",A.miniRecNum),A.miniRecNum<5?e.miniRecPlayer.changePlayUrl({type:"miniRec"}):(console.log("小窗口------------------已播放5次,关闭小窗口"),e.miniRecCloseClick())):(console.log("小窗口------------------播放失败,关闭小窗口"),e.miniRecCloseClick())},env:this.jSPlugin.env||s});var g=document.createElement("div");g.id="miniClose",g.style="position: absolute;top: ".concat(r+8,"px;right: ").concat(16*i,"px;"),g.innerHTML='
    \n \n close\n \n \n \n \n \n \n \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(g),document.getElementById("miniClose-btn").onclick=function(){e.miniRecCloseClick()}}}},{key:"initMiniImageRec",value:function(){console.log("initMiniImageRec");var A=this.videoWidth/375,e=6;document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(e=document.getElementById("".concat(this.jSPlugin.id,"-headControl")).offsetHeight+26);var t=e+this.videoHeight+10*A;if(document.getElementById("miniRecbox"))document.getElementById("miniRecbox").style.top=t+"px",document.getElementById("miniClose").style.top=t+8+"px";else{var i=document.createElement("div");i.id="miniRecbox",i.style="-webkit-border-radius: 8px;border-radius: 8px;overflow: hidden;position: absolute;\n top: ".concat(t,"px;\n right: ").concat(9*A,"px;\n user-select: none;\n "),i.innerHTML='
    \n \n
    示意小窗位置
    \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(i);var n=document.createElement("div");n.id="miniClose",n.style="z-index: 4;position: absolute;top: ".concat(t+8,"px;right: ").concat(16*A,"px;"),n.innerHTML='
    \n \n close\n \n \n \n \n \n \n \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(n),document.getElementById("miniClose-btn").onclick=function(){}}}},{key:"miniRecCloseClick",value:function(){document.getElementById("miniRecbox")&&(console.log("---------------------miniRecCloseClick"),"rec"==this.miniRecStatus&&(this.miniRecPlayer&&this.miniRecPlayer.stop(),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("miniClose")),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("miniRecbox"))))}},{key:"miniRecSwitchClick",value:function(){console.log("---------------小窗口切换");var A=this.decoderState.state.isEditing,e=this.videoWidth,t=e/375,i=1.8*e,n=6;document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(n=document.getElementById("".concat(this.jSPlugin.id,"-headControl")).offsetHeight+.1*i+6),console.log("headerHeight-------",n);var a=n+this.videoHeight+10*t;if(console.log("videoTop-------",a),"rec"==this.miniRecStatus){this.miniRecStatus="live",A?(document.getElementById("miniRec-embed").style.width=this.jSPlugin.width+"px",document.getElementById("miniRec-embed").style.height=this.jSPlugin.height+"px",document.getElementById("miniRec").style.width=this.jSPlugin.width+"px",document.getElementById("miniRec").style.height=this.jSPlugin.height+"px"):this.miniRecPlayer.reSize(this.jSPlugin.width,this.jSPlugin.height),this.jSPlugin.reSize(160*t,90*t);var r=this.videoHeight+10*t,o=.2*i-90*t-10*t;document.getElementById("".concat(this.jSPlugin.id,"-wrap")).style.width=this.videoWidth+"px",document.getElementById("".concat(this.jSPlugin.id)).style.marginTop=r+"px",document.getElementById("".concat(this.jSPlugin.id)).style.marginLeft=e-160*t-9+"px",document.getElementById("".concat(this.jSPlugin.id)).style.overflow="hidden",document.getElementById("".concat(this.jSPlugin.id)).style.borderRadius="8px",document.getElementById("miniRecbox").style.top=n+"px",document.getElementById("miniRecbox").style.left="0",document.getElementById("miniRecbox").style.right="0",document.getElementById("miniRecbox").style.borderRadius="0px",document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop=o+"px"}else console.log(this.jSPlugin.width),this.miniRecStatus="rec",A?(document.getElementById("miniRec-embed").style.width=160*t+"px",document.getElementById("miniRec-embed").style.height=90*t+"px",document.getElementById("miniRec").style.width=160*t+"px",document.getElementById("miniRec").style.height=90*t+"px"):this.miniRecPlayer.reSize(160*t,90*t),this.jSPlugin.reSize(this.videoWidth,this.videoHeight),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).style.width=this.videoWidth+NaN,document.getElementById("".concat(this.jSPlugin.id)).style.marginTop="0",document.getElementById("".concat(this.jSPlugin.id)).style.marginLeft="0",document.getElementById("".concat(this.jSPlugin.id)).style.overflow="hidden",document.getElementById("".concat(this.jSPlugin.id)).style.borderRadius="0px",document.getElementById("miniRecbox").style.top=a+"px",document.getElementById("miniRecbox").style.right="9px",document.getElementById("miniRecbox").style.left="auto",document.getElementById("miniRecbox").style.borderRadius="8px",document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop=.2*i+"px"}},{key:"matchBtn",value:function(A,e){var t=this,i=this.themeData,n=i.header,a=i.footer,r=this.decoderState.state,o=r.mute,s=r.rejection;document.documentElement.clientHeight;var g=this.videoWidth/375,c=this.videoWidth/375||1,l={title:"",id:"",domString:"",color:"#FFFFFF",activeColor:"#FFFFFF",onclick:function(){},onmoveleft:function(){},onmoveright:function(){},onremove:function(){}};-1===n[this.bellStatus].btnList.findIndex((function(e){return e.iconId===A}))?(l.color=a[this.bellStatus].color,l.backgroundColor=a[this.bellStatus].backgroundColor,l.activeColor=a[this.bellStatus].activeColor):(l.color=n[this.bellStatus].color,l.backgroundColor=n[this.bellStatus].backgroundColor,l.activeColor=n[this.bellStatus].activeColor);var I=this.videoWidth/4;switch(A){case"ringStatus":return l.title=this.activeThemeStatus?"有人按门铃":this.activeThemeStatusTxt,l.id=A,l.domString='').concat(this.activeThemeStatus?"有人按门铃":this.activeThemeStatusTxt,""),l.onclick=function(){},l;case"deviceCategory":return l.title="设备名称",l.id=A,l.domString='').concat(this.deviceInfoData&&this.deviceInfoData.deviceName||"设备名称",""),l.onclick=function(){},l;case"callStatus":return l.title="通话中",l.id=A,l.domString='通话中'),l.onclick=function(){},l;case"deviceCategory":return l.title="设备名称",l.id=A,l.domString='').concat(this.deviceInfoData&&this.deviceInfoData.deviceName||"设备名称",""),l.onclick=function(){},l;case"rejection":return l.title="拒绝",l.id=A,l.domString='
    \n
    \n \n 拒绝\n \n \n \n \n \n
    \n
    拒绝
    \n
    '),l.onclick=function(){var A=t,e=t.decoderState.state,i=e.play,n=e.isEditing,a=e.rejection;if(n||a)return!1;console.log("拒绝"),i&&t.jSPlugin.stop(),t.removeBellRing(),t.setDecoderState({play:!1,rejection:!0}),A.miniRecCloseClick(),t.rejectionStatusDispose(),"function"==typeof t.jSPlugin.hangUpCallback&&t.jSPlugin.hangUpCallback("rejection")},l;case"quickReply":return l.title="快捷回复",l.id=A,l.domString='
    \n
    \n \n 快捷回复\n \n \n \n \n \n
    \n
    快捷回复
    \n
    '),l.onclick=function(){var A=t.decoderState.state,e=A.isEditing,i=A.rejection;if(e||i)return!1;console.log("快捷回复"),t.switchFooter("quickReply"),t.quickReplyEle=new VA(t.jSPlugin,t.switchFooter,t.videoWidth)},l;case"answer":return l.title="接听",l.id=A,l.domString='
    \n
    \n \n 接听\n \n \n \n \n \n
    \n
    接听
    \n
    '),l.onclick=function(){var A=t.decoderState.state,i=A.play,r=A.isEditing,o=A.talk,s=A.sound,g=A.rejection;if(r||g)return!1;console.log("接听"),t.jSPlugin.pluginStatus.loadingClear(),t.bellStatus="onCall",t.switchFooter("onCall"),a[t.bellStatus].btnList.map((function(A,e){A.isrender&&t.renderFooter(A.iconId,A)})),n[t.bellStatus].btnList.map((function(A,e){A.isrender&&t.renderHeader(A.iconId,A)}));var c=document.getElementById("".concat(t.jSPlugin.id,"-header-onBell"));c&&c.parentElement.removeChild(c),1==t.themeData.customConfig.bellPoster&&(document.getElementById("bellring-icon")&&document.getElementById("".concat(t.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon")),t.jSPlugin.setPoster("")),t.removeBellRing(),t.miniRecCloseClick(),i||(t.jSPlugin.pluginStatus.loadingStart(t.jSPlugin.id),t.jSPlugin.pluginStatus.loadingSetText({text:"视频加载中"}),t.jSPlugin.play(),t.setDecoderState({play:!i})),o||1!=t.themeData.customConfig.defaultMicro||(t.setDecoderState({talk:!0,mute:!1}),s&&t.jSPlugin.closeSound(),t.jSPlugin.Talk.startTalk()),t.setDecoderState({sound:!1}),0==t.themeData.customConfig.defaultMicro&&(t.muteCommon(e),t.jSPlugin.openSound(),t.setDecoderState({sound:!0})),t.maxTalkTime=1e3*t.themeData.customConfig.maxTalkTime*60;var l=t;setTimeout((function(){o&&(console.log("结束对讲"),l.setDecoderState({talk:!1}),l.jSPlugin.Talk.stopTalk()),i&&(l.jSPlugin.stop(),l.setDecoderState({play:!i})),t.rejectionStatusDispose(),t.remoteUnlockEle&&t.remoteUnlockEle.closeRemoteUnlock(),"function"==typeof t.jSPlugin.hangUpCallback&&t.jSPlugin.hangUpCallback("hangUp")}),t.maxTalkTime)},l;case"remoteUnlock":return l.title="远程开锁",l.id=A,l.domString='
    \n
    \n \n 开锁\n \n \n \n \n \n
    \n
    远程开锁
    \n
    '),l.onclick=function(){var A=t.decoderState.state,e=A.isEditing;A.play;var i=A.rejection;if(e||"onBell"==t.bellStatus||i)return!1;console.log("远程开锁"),t.switchFooter("remoteUnlock"),t.remoteUnlockEle=new WA(t.jSPlugin,t.switchFooter,t.videoWidth)},l;case"mute":return l.title="静音",l.id=A,l.domString='
    \n
    \n \n icon/静音\n \n \n \n \n \n
    \n
    静音
    \n
    '),l.onclick=function(){var A=t.decoderState.state,i=A.talk,n=A.sound;if(A.play,A.rejection)return!1;console.log("静音"),i?(console.log("结束对讲"),t.setDecoderState({talk:!1,mute:!0},e.backgroundColor),t.jSPlugin.Talk.stopTalk(),t.jSPlugin.openSound(),t.setDecoderState({sound:!0})):(console.log("开始对讲"),t.setDecoderState({talk:!0,mute:!1},e.backgroundColor),n&&(t.jSPlugin.closeSound(),t.setDecoderState({sound:!1})),t.jSPlugin.Talk.startTalk())},l;case"hangUp":return l.title="挂断",l.id=A,l.domString='
    \n
    \n \n 挂断\n \n \n \n \n \n
    \n
    挂断
    \n
    '),l.onclick=function(){var A=t,e=t.decoderState.state,i=e.talk,n=e.play;if(e.rejection)return!1;i&&(console.log("结束对讲"),t.setDecoderState({talk:!1}),t.jSPlugin.Talk.stopTalk()),n&&(t.jSPlugin.stop(),t.setDecoderState({play:!n})),(n||i)&&(A.miniRecCloseClick(),console.log("挂断"),t.rejectionStatusDispose(),"function"==typeof t.jSPlugin.hangUpCallback&&t.jSPlugin.hangUpCallback("hangUp"))},l;default:return l}}},{key:"answerOvertime",value:function(){this.toastCustom.initToastContent("应答超时");var A=this.decoderState.state.play;console.log("应答超时"),A&&this.jSPlugin.stop(),this.setDecoderState({play:!1,rejection:!0}),this.miniRecCloseClick(),this.rejectionStatusDispose(),this.quickReplyEle&&this.quickReplyEle.closeQuickReplyEle(),"function"==typeof this.jSPlugin.hangUpCallback&&this.jSPlugin.hangUpCallback("rejection")}},{key:"rejectionStatusDispose",value:function(){var A=this,e=this.themeData.footer,t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")),n=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReplyBtn")),a=document.getElementById("header-".concat(this.bellStatus,"-ringStatus"));"onBell"==this.bellStatus?(t.innerHTML="",n.innerHTML="",t.style.color="#2C2C2C"):(i.innerHTML="",i.style.color="#2C2C2C"),console.log("rejectionStatusDispose"),this.setDecoderState({rejection:!0}),e[this.bellStatus].btnList.map((function(e,t){e.isrender&&A.renderFooter(e.iconId,e)})),a.innerText="通话已结束",this.jSPlugin.pluginStatus.loadingClear(),this.jSPlugin.pluginStatus.loadingSetTextWithBtn({text:"通话已结束",color:"white",isMobile:!0,type:2})}},{key:"userNoDevice",value:function(){var A=this;this.removeBellRing(),this.setDecoderState({rejection:!0});var e=this.themeData.footer,t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")),n=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReplyBtn"));"onBell"==this.bellStatus?(t.innerHTML="",n.innerHTML="",t.style.color="#2C2C2C"):(i.innerHTML="",i.style.color="#2C2C2C"),console.log("userNoDevice"),this.setDecoderState({rejection:!0}),e[this.bellStatus].btnList.map((function(e,t){e.isrender&&A.renderFooter(e.iconId,e)})),this.jSPlugin.pluginStatus.loadingClear(),this.jSPlugin.pluginStatus.loadingSetTextWithBtn({text:"该用户不拥有该设备",color:"white",isMobile:!0,type:2})}},{key:"renderHeader",value:function(A,e){var t=this,i=this.matchBtn(A,e);if(document.getElementById("".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus,"-content"))){var n=document.createElement("span");n.innerHTML="".concat(i.domString),document.getElementById("".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus,"-content")).appendChild(n)}else{var a=document.createElement("div");a.id="".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus),a.style="max-width:50%;position:relative;",a.innerHTML='\n ').concat(i.domString,"\n "),a.onclick=function(A){if(t.decoderState.state.isEditing)return!1;i.onclick(A)},document.getElementById("".concat(this.jSPlugin.id,"-headControl")).childNodes[0].appendChild(a)}}},{key:"renderFooter",value:function(A,e){var t=this,i=this.decoderState.state.mute;if("remoteUnlock"==A&&this.jSPlugin.capacity&&(!this.jSPlugin.capacity.support_unlock||0==this.jSPlugin.capacity.support_unlock))return!1;var n=this.matchBtn(A,e),a=this.videoWidth/4,r=document.createElement("div");if(r.className="theme-icon-item","quickReply"!==n.id&&(r.style="width:".concat(.66*a,"px;padding:0 ").concat(.12*a,"px;box-sizing: content-box;-webkit-tap-highlight-color:transparent;")),r.innerHTML="".concat('')+'
    ')).concat(n.domString,"
    ")+"
    ",r.onclick=function(A){if(t.decoderState.state.isEditing||!t.activeThemeStatus)return!1;n.onclick(A)},n.onmouseenter&&(r.onmouseenter=function(A){if(t.decoderState.state.isEditing||!t.activeThemeStatus)return!1;n.onmouseenter(A)}),n.onmouseleave&&(r.onmouseleave=function(A){if(t.decoderState.state.isEditing||!t.activeThemeStatus)return!1;n.onmouseleave(A)}),"quickReply"!=A){var o=document.createElement("span");o.className="icon-move left",o.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),o.onclick=function(){t.editIcon(n.id,"left","footer")},r.appendChild(o);var s=document.createElement("span");s.className="icon-move right",s.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),s.onclick=function(){t.editIcon(n.id,"right","footer")},r.appendChild(s)}if("answer"==A||"rejection"==A||"hangUp"==A);else{var g=document.createElement("span");g.className="icon-move close",g.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),g.onclick=function(){t.editIcon(n.id,"delete","footer")},r.appendChild(g)}"onCall"==this.bellStatus?document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).appendChild(r):(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).appendChild(r),"quickReply"===n.id&&document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReplyBtn")).appendChild(r)),this.decoderState.state.isEditing&&"mute"==A&&"onCall"==this.bellStatus&&(0!=this.themeData.customConfig.defaultMicro||i?this.setDecoderState({mute:!1},e.backgroundColor):this.setDecoderState({mute:!0},e.backgroundColor))}},{key:"switchFooter",value:function(A){var e=this.themeData.footer;switch(A){case"onBell":document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"))?"none"==document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.display&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReplyBtn")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-btn-quickReply")).style.display="flex"):(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReplyBtn")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-btn-quickReply")).style.display="flex");break;case"onCall":document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-btn-quickReply")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.display="flex",this.themeData&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.color=e[this.bellStatus].color)}}},{key:"initThemeData",value:function(){var A=this;console.log("-------------initThemeData");var e=this.themeData,t=e.header,i=e.footer,n=this.decoderState.state.isEditing,a=this.videoWidth,r=a/375,o=1.8*a,g=this.jSPlugin.id;if(this.isNeedRenderHeader=b.findIndex(t[this.bellStatus].btnList,(function(A){return A.isrender>0}))>=0,this.isNeedRenderFooter=b.findIndex(i[this.bellStatus].btnList,(function(A){return A.isrender>0}))>=0,this.isNeedRenderHeader)if(document.getElementById("".concat(this.jSPlugin.id,"-headControl")))document.getElementById("".concat(this.jSPlugin.id,"-headControl")).innerHTML="
    ");else{var c=document.createElement("div");c.setAttribute("id","".concat(this.jSPlugin.id,"-headControl")),c.setAttribute("class","header-controls"),c.innerHTML="
    "),console.log(this.jSPlugin.height),this.jSPlugin.height;var l=s(s({display:"flex","justify-content":"space-between",top:0,"z-index":999,color:"#FFFFFF",width:"100%",position:"relative","margin-bottom":.1*o+"px","align-items":"center","text-align":"center","font-size":"24ox"},"color","#2c2c2c"),"margin-top","6px");c.style=OA(l),document.getElementById("".concat(g,"-wrap")).insertBefore(c,document.getElementById(g));var I=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(I)}),50)}else document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&document.getElementById("".concat(this.jSPlugin.id,"-headControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-headControl")));if(this.jSPlugin.height,this.isNeedRenderFooter)if(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")))document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop="".concat(.2*o,"px"),"onCall"==this.bellStatus?document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).innerHTML='\n \n \n \n \n \n '):document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).innerHTML='\n \n \n \n \n \n '));else{var C=document.createElement("div");C.setAttribute("id","".concat(this.jSPlugin.id,"-ez-iframe-footer-container")),C.setAttribute("class","ez-iframe-footer-container");var d={position:"relative","margin-top":.2*o+"px",display:"flex","flex-wrap":"wrap","justify-content":"space-between","z-index":999,top:0,color:"#FFFFFF",width:"100%","align-items":"center","font-size":"12px"};C.style=OA(d),C.innerHTML='\n \n \n \n \n \n '),E(C,document.getElementById(g))}else document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")));if(this.isNeedRenderHeader&&document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&t[this.bellStatus].btnList.map((function(e,t){e.isrender&&A.renderHeader(e.iconId,e)})),this.isNeedRenderFooter&&document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=i[this.bellStatus].backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=i[this.bellStatus].color,i[this.bellStatus].btnList.map((function(e,t){e.isrender&&A.renderFooter(e.iconId,e)}))),1!=this.themeData.customConfig.bellPoster||n)this.jSPlugin.setPoster("");else{this.jSPlugin.poster="https://resource.eziot.com/group1/M00/00/B8/CtwQEmPbGh2AVJB-ABDcYtyw5gk899.svg";var h=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(h),A.jSPlugin.setPoster(A.jSPlugin.poster))}),50)}this.activeThemeStatus&&(this.initBellRing(),this.checkIsAppleDevice()||!1?window.addEventListener("touchstart",this.autoPlayRing):window.addEventListener("click",this.autoPlayRing));this.inited=!0,this.getCallDeviceInfo()}},{key:"checkIsAppleDevice",value:function(){var A=navigator.userAgent,e=!!A.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),t=A.indexOf("iPad")>-1,i=A.indexOf("iPhone")>-1||A.indexOf("Mac")>-1;return!!(e||t||i)}},{key:"renderThemeData",value:function(){var A=this,e=this.themeData,t=e.header,i=e.footer,n=this.decoderState.state.isEditing;if(this.isNeedRenderHeader&&t&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=t[this.bellStatus].color.replace("-diy",""),t[this.bellStatus].btnList.map((function(e,t){e.isrender&&A.setDecoderState(s({},e.iconId,A.decoderState.state[e.iconId]))}))),this.isNeedRenderFooter&&i)document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=i[this.bellStatus].backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=i[this.bellStatus].color.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.color=i[this.bellStatus].color.replace("-diy",""),i[this.bellStatus].btnList.map((function(e,t){if(e.isrender&&A.setDecoderState(s({},e.iconId,A.decoderState.state[e.iconId])),console.log("-------------activeThemeStatus"),0==t&&!A.themeInited&&A.activeThemeStatus)var i=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(i),1!=A.themeData.customConfig.bellPoster||n?A.jSPlugin.play():A.jSPlugin.pluginStatus.loadingClear(),A.themeInited=!0)}),50)})),-1!==this.jSPlugin.url.indexOf("hd.live")&&this.setDecoderState({hd:!0}),this.themeData.autoFocus>0&&(this.autoFocus=parseInt(this.themeData.autoFocus),this.startAutoFocus(),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).addEventListener("click",(function(){A.stopAutoFocus()}))),this.setDecoderState({cloudRec:"cloud.rec"===p(this.jSPlugin.url).type,rec:"rec"===p(this.jSPlugin.url).type,type:p(this.jSPlugin.url).type});else if(!this.themeInited&&this.activeThemeStatus)var a=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(a),A.themeData&&A.themeData.customConfig&&1==A.themeData.customConfig.bellPoster&&!n?A.jSPlugin.pluginStatus.loadingClear():A.jSPlugin.play(),A.themeInited=!0)}),50);var r=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(r),A.jSPlugin.reSize(A.jSPlugin.params.width,A.jSPlugin.params.height))}),50);n||this.jSPlugin.isWebConsole?1==this.themeData.customConfig.miniWinRec?this.initMiniImageRec():this.miniRecCloseClick():setTimeout((function(){"onBell"==A.bellStatus&&A.jSPlugin.capacity&&1==A.jSPlugin.capacity.support_doorcall_playback&&(console.log("小窗口initMiniRec-------------设备能力集成功"),1==A.themeData.customConfig.miniWinRec&&(console.log("小窗口initMiniRec---------------画中画设置已开启"),(!A.deviceInfoData||A.deviceInfoData&&!A.deviceInfoData.isEncrypt)&&(console.log("小窗口initMiniRec---------------设备未加密"),A.miniRecNum=0,A.initMiniRec())))}),1e3)}},{key:"setThemeData",value:function(A,e){this.themeData=A,"onCall"==e&&(this.bellStatus="onCall")}},{key:"startAutoFocus",value:function(){var A=this,e=this.autoFocus;this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.autoFocusTimer=setTimeout((function(){document.getElementById("".concat(A.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(A.jSPlugin.id,"-audioControls")).style.opacity=0,document.getElementById("".concat(A.jSPlugin.id,"-audioControls")).style.pointerEvents="none")}),1e3*e)}},{key:"stopAutoFocus",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.opacity=1,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.pointerEvents="all"),this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.startAutoFocus()}},{key:"editIcon",value:function(A,e,t){console.log("编辑组件",A,e,t);var i=this.themeData;console.log("themeData",this.themeData);var n=this.themeData[t][this.bellStatus].btnList,a=b.findIndex(n,(function(e){return e.iconId===A})),r=n[a];switch(e){case"delete":n[a].isrender=0;break;case"right":for(var o=-1,s=a+1;s=0;c--)if(n[c].part===n[a].part&&1==n[c].isrender){g=c;break}-1!==g&&(n[a]=n[g],n[g]=r)}console.log("new btnList",n),i[t][this.bellStatus].btnList=n,this.jSPlugin.Theme.changeTheme(i)}},{key:"countTime",value:function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=this;if(!document.getElementById(this.jSPlugin.id+"time-area")){var i=document.createElement("div");i.id=this.jSPlugin.id+"time-area",i.className="time-area",i.innerHTML='00:00',document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).appendChild(i)}if(this.countTimer&&clearInterval(this.countTimer),"add"===A){var n=e;document.getElementById(t.jSPlugin.id+"time-area").style.display="flex",this.countTimer=setInterval((function(){++n,document.getElementById(t.jSPlugin.id+"time-area").children[1].innerHTML=function(A){var e=parseInt(A),t=0,i=0,n="00",a="00",r="00";e>59&&(t=parseInt(e/60),e=parseInt(e%60),t>59&&(i=parseInt(t/60),t=parseInt(t%60)));return n=parseInt(e)>9?parseInt(e):"0"+parseInt(e),a=parseInt(t)>9?parseInt(t):"0"+parseInt(t),r=parseInt(i)>9?parseInt(i):"0"+parseInt(i),i>0?r+":"+a+":"+n:t>0?a+":"+n:"00:"+n}(n)}),1e3)}else"destroy"===A&&(this.countTimer&&clearInterval(this.countTimer),this.countTimer=void 0,document.getElementById(t.jSPlugin.id+"time-area")&&(document.getElementById(t.jSPlugin.id+"time-area").children[1].innerHTML="00:00",document.getElementById(t.jSPlugin.id+"time-area").style.display="none"))}},{key:"editStart",value:function(A){console.log("----------editStart1");var e=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"));document.getElementById("".concat(this.jSPlugin.id,"-headControl")),e&&e.setAttribute("class","footer-controls themeEditing"),t&&t.setAttribute("class","footer-controls themeEditing"),this.setDecoderState({isEditing:!0})}},{key:"editEnd",value:function(A){console.log("----------editEnd1");var e=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),t=document.getElementById("".concat(this.jSPlugin.id,"-headControl")),i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"));t&&t.setAttribute("class","header-controls"),e&&e.setAttribute("class","footer-controls"),i&&i.setAttribute("class","footer-controls")}},{key:"fetchThemeData",value:function(A){var e=this;switch(this.jSPlugin.themeId){case"pcLive":case"pcRec":case"mobileLive":case"mobileRec":case"miniRec":break;default:wA(this.jSPlugin,A,(function(A){0==A.meta.code&&A.data?(e.activeThemeStatus=!0,e.themeData=A.data,A.data.header&&(e.themeData.header=A.data.header,e.themeData.header[e.bellStatus].btnList=e.themeData.header[e.bellStatus].btnList.sort((function(A,e){return A.btnKey.split("-")[3]-e.btnKey.split("-")[3]}))),A.data.footer&&(e.themeData.footer=A.data.footer,e.themeData.footer[e.bellStatus].btnList=e.themeData.footer[e.bellStatus].btnList.sort((function(A,e){return A.btnKey.split("-")[3]-e.btnKey.split("-")[3]}))),e.jSPlugin.capacity?(e.initThemeData(),e.renderThemeData()):setTimeout((function(){e.initThemeData(),e.renderThemeData()}),300)):(e.activeThemeStatus=!1,e.jSPlugin.pluginStatus.loadingClear(),e.setDecoderState({rejection:!0}),"111021"==A.meta.code?(e.jSPlugin.pluginStatus.loadingSetText({text:"无效的模板id",color:"#fff",type:1}),e.activeThemeStatusTxt="无效的模板id"):"111023"==A.meta.code?(e.jSPlugin.pluginStatus.loadingSetText({text:"您的试用特权已到期,需前往轻应用控制台购买后使用。",color:"#fff",type:1}),e.activeThemeStatusTxt="试用特权已到期"):(e.jSPlugin.pluginStatus.loadingSetText({text:"模板未激活,请先在开放平台轻应用控制台购买模板",color:"#fff",type:1}),e.activeThemeStatusTxt="模板未激活"),e.themeData=jA,e.initThemeData(),e.renderThemeData())}),(function(){e.renderThemeData()}))}}},{key:"getCallDeviceInfo",value:function(){var A=this;this.videoWidth,FA({accessToken:this.jSPlugin.accessToken,deviceSerial:p(this.jSPlugin.url).deviceSerial}).then((function(e){e.data&&(A.deviceInfoData=e.data,e.data.isEncrypt&&(console.log("小窗口miniRecCloseClick------------设备已加密"),A.miniRecCloseClick(),setTimeout((function(){A.jSPlugin.pluginStatus.loadingClear(),A.jSPlugin.pluginStatus.loadingSetText({text:"视频已加密",color:"#fff"})}),1e3)),document.getElementById("header-".concat(A.bellStatus,"-deviceCategory"))&&(document.getElementById("header-".concat(A.bellStatus,"-deviceCategory")).innerText=""+e.data.deviceName))})).catch((function(e){console.log("获取设备信息失败",e),20018!=e.code||A.jSPlugin.isWebConsole||A.userNoDevice()}))}},{key:"setHeaderText",value:function(A){console.log("setHeaderText");var e=this.videoWidth/375||1;document.getElementById("".concat(this.jSPlugin.id,"-deviceCategory-content"))&&(document.getElementById("".concat(this.jSPlugin.id,"-deviceCategory-content")).innerHTML='').concat(A,'').concat(this.deviceInfoData&&this.deviceInfoData.category||"",""))}}])}(),qA=function(){return o((function A(e){if(a(this,A),this.jSPlugin=e,this.videoWidth=e.width,this.autoFocus=0,this.autoFocusTimer=null,this.decoderState={state:{isEditing:!1,play:!1,sound:!1,recordvideo:!1,recordCount:"00:00",talk:!1,mute:!1,rejection:!1,cloudRec:"cloud.rec"===p(e.url).type,rec:"rec"===p(e.url).type,type:p(e.url).type}},console.log("matchEzopenUrl(jSPlugin.url)",p(e.url),this.decoderState.state),this.isMobile=navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i),void 0!==e.isMobile&&(this.isMobile=e.isMobile),this.themeData={},"themeData"==this.jSPlugin.themeId&&(this.themeData=this.jSPlugin.params.themeData),this.jSPlugin.themeId)if(this.isMobile?this.call=new ZA(this.jSPlugin,this.themeData,this.setDecoderState,this.decoderState):this.call=new HA(this.jSPlugin,this.themeData,this.setDecoderState,this.decoderState),"themeData"===this.jSPlugin.themeId)this.themeData=this.jSPlugin.params.themeData,this.call.initThemeData(),this.call.renderThemeData();else this.call.fetchThemeData(this.jSPlugin.themeId);this.jSPlugin.Talk||(this.jSPlugin.Talk=new lA(this.jSPlugin)),h("".concat(this.jSPlugin.staticPath,"/speed/speed.css")),h("".concat(this.jSPlugin.staticPath,"/css/theme.css"))}),[{key:"changeTheme",value:function(A){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"onBell";if("string"==typeof A)switch(this.jSPlugin.themeId=A,this.jSPlugin.themeId){case"pcLive":case"mobileCall":case"webCall":this.call.initThemeData(),this.call.renderThemeData();break;default:this.call.fetchThemeData(A)}else"object"===n(A)&&(this.themeData=A,this.call.setThemeData(A,t),this.call.initThemeData(),this.call.renderThemeData(),this.decoderState.state.isEditing&&e&&this.call.editStart());this.jSPlugin&&this.jSPlugin.handleThemeChange&&this.jSPlugin.handleThemeChange(A)}},{key:"setDecoderState",value:function(A,e){var t=this,i=this.themeData;i.header,i.footer,Object.keys(A).map((function(i){if("mute"===i)document.getElementById("".concat(t.jSPlugin.id,"-icon-mute"))&&(console.log("mute"),A[i]?(document.getElementById("".concat(t.jSPlugin.id,"-icon-mute")).style.background=e,document.getElementById("".concat(t.jSPlugin.id,"-icon-mute")).style.border=" 1px solid ".concat(e),document.getElementById("icon-mute-path").style.fill="#ffffff"):(document.getElementById("".concat(t.jSPlugin.id,"-icon-mute")).style.background="#ffffff",document.getElementById("".concat(t.jSPlugin.id,"-icon-mute")).style.border="1px solid ".concat(e),document.getElementById("icon-mute-path").style.fill=e));t.decoderState.state=Object.assign(t.decoderState.state,A)}))}},{key:"startAutoFocus",value:function(){var A=this,e=this.autoFocus;this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.autoFocusTimer=setTimeout((function(){document.getElementById("".concat(A.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(A.jSPlugin.id,"-audioControls")).style.opacity=0,document.getElementById("".concat(A.jSPlugin.id,"-audioControls")).style.pointerEvents="none")}),1e3*e)}},{key:"stopAutoFocus",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.opacity=1,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.pointerEvents="all"),this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.startAutoFocus()}},{key:"toString",value:function(){return"".concat(this.coreX,"-").concat(this.coreY)}},{key:"editIcon",value:function(A,e,t){console.log("编辑组件",A,e,t);var i=this.themeData;console.log("themeData",this.themeData);var n=this.themeData[t].btnList,a=b.findIndex(n,(function(e){return e.iconId===A})),r=n[a];switch(e){case"delete":if("rec"===A){if(-1===b.findIndex(n,(function(A){return"cloudRec"===A.iconId&&1==A.isrender})))return this.jSPlugin.Message&&this.jSPlugin.Message.default("必须选中一种存储介质"),!1}else if("cloudRec"===A&&-1===b.findIndex(n,(function(A){return"rec"===A.iconId&&1==A.isrender})))return this.jSPlugin.Message&&this.jSPlugin.Message.default("必须选中一种存储介质"),!1;n[a].isrender=0;break;case"right":for(var o=-1,s=a+1;s=0;c--)if(n[c].part===n[a].part&&1==n[c].isrender){g=c;break}-1!==g&&(n[a]=n[g],n[g]=r)}console.log("new btnList",n),i[t].btnList=n,this.changeTheme(i)}},{key:"countTime",value:function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=this;if(!document.getElementById(this.jSPlugin.id+"time-area")){var i=document.createElement("div");i.id=this.jSPlugin.id+"time-area",i.className="time-area",i.innerHTML='00:00',document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).appendChild(i)}if(this.countTimer&&clearInterval(this.countTimer),"add"===A){var n=e;document.getElementById(t.jSPlugin.id+"time-area").style.display="flex",this.countTimer=setInterval((function(){++n,document.getElementById(t.jSPlugin.id+"time-area").children[1].innerHTML=function(A){var e=parseInt(A),t=0,i=0,n="00",a="00",r="00";e>59&&(t=parseInt(e/60),e=parseInt(e%60),t>59&&(i=parseInt(t/60),t=parseInt(t%60)));return n=parseInt(e)>9?parseInt(e):"0"+parseInt(e),a=parseInt(t)>9?parseInt(t):"0"+parseInt(t),r=parseInt(i)>9?parseInt(i):"0"+parseInt(i),i>0?r+":"+a+":"+n:t>0?a+":"+n:"00:"+n}(n)}),1e3)}else"destroy"===A&&(this.countTimer&&clearInterval(this.countTimer),this.countTimer=void 0,document.getElementById(t.jSPlugin.id+"time-area")&&(document.getElementById(t.jSPlugin.id+"time-area").children[1].innerHTML="00:00",document.getElementById(t.jSPlugin.id+"time-area").style.display="none"))}},{key:"editStart",value:function(A){var e=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")),i=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));i&&i.setAttribute("class","header-controls themeEditing"),e&&e.setAttribute("class","footer-controls themeEditing"),t&&t.setAttribute("class","footer-controls themeEditing"),this.setDecoderState({isEditing:!0})}},{key:"editEnd",value:function(A){var e=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),t=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));t&&t.setAttribute("class","header-controls"),e&&e.setAttribute("class","footer-controls"),this.setDecoderState({isEditing:!1})}},{key:"setDisabled",value:function(A){}},{key:"getDeviceInfo",value:function(){var A=this,e=this.videoWidth/1024||1;FA({accessToken:this.jSPlugin.accessToken,deviceSerial:p(this.jSPlugin.url).deviceSerial}).then((function(t){200==t.code&&t.data&&document.getElementById("".concat(A.jSPlugin.id,"-deviceCategory-content"))&&(document.getElementById("".concat(A.jSPlugin.id,"-deviceCategory-content")).style.maxWidth="100%",document.getElementById("".concat(A.jSPlugin.id,"-deviceCategory-content")).style.overflow="hidden",document.getElementById("".concat(A.jSPlugin.id,"-deviceCategory-content")).style.textOverflow="ellipsis",document.getElementById("".concat(A.jSPlugin.id,"-deviceCategory-content")).style.whiteSpace="nowrap",document.getElementById("".concat(A.jSPlugin.id,"-deviceCategory-content")).innerHTML='有人按门铃').concat(t.data.category,""))})).catch((function(A){console.log("获取设备信息失败",A)}))}}])}(),XA=function(){return o((function A(e){a(this,A),this.jSPlugin=e;var t=window["EZUIKIT_TIMER_INTERVAL_".concat(e.id)];t&&Object.keys(t).length>0&&this.resetTimer(),window["EZUIKIT_TIMER_INTERVAL_".concat(e.id)]={}}),[{key:"createInterval",value:function(A,e,t){window["EZUIKIT_TIMER_INTERVAL_".concat(this.jSPlugin.id)][A]=setInterval(e,t)}},{key:"clearTimer",value:function(A){var e=window["EZUIKIT_TIMER_INTERVAL_".concat(this.jSPlugin.id)];e[A]&&(clearInterval(e[A]),delete e[A])}},{key:"resetTimer",value:function(){var A=window["EZUIKIT_TIMER_INTERVAL_".concat(this.jSPlugin.id)];for(var e in A)clearInterval(A[e]),delete A[e]}}])}(),zA=o((function A(e){var t=this;a(this,A),s(this,"initMap",(function(){var A=t,e=t.videoWidth,i=t.videoHeight;if(document.getElementById("".concat(t.jSPlugin.id,"-miniRecbox")))document.getElementById("".concat(t.jSPlugin.id,"-wrap")).removeChild(document.getElementById("".concat(t.jSPlugin.id,"-miniRecbox"))),t.initMap();else{var n=document.createElement("div");n.id="".concat(t.jSPlugin.id,"-miniRecbox"),n.style=";position: absolute; bottom:96px;right:".concat(t.jSPlugin.inspectVideoWidth,"px;"),n.innerHTML='
    '),document.getElementById("".concat(t.jSPlugin.id,"-wrap")).insertBefore(n,document.getElementById("".concat(t.jSPlugin.id,"-ez-iframe-footer-container"))),A.map=A.loadMap("".concat(t.jSPlugin.id,"-mapbox"))}return A.map})),s(this,"loadMap",(function(A){var e=new BMapGL.Map(A);return e.centerAndZoom(new BMapGL.Point(116.297611,40.047363),15),e.enableScrollWheelZoom(!0),e})),s(this,"createCircle",(function(A,e,i,n){var a=new BMapGL.Point(A,e),r=new BMapGL.Marker(a,{title:n});if(t.map.addOverlay(r),0!=i){var o=new BMapGL.Circle(new BMapGL.Point(A,e),i,{strokeColor:"#ff4d4f",strokeWeight:4,strokeOpacity:1,strokeStyle:"dashed",fillOpacity:0});t.map.addOverlay(o)}})),s(this,"createInspectPoints",(function(A){A.map((function(A){t.createCircle(A.longitude,A.latitude,A.radius,A.inspectPointName)}))})),s(this,"createPolygon",(function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#407AFF",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"solid",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"407AFF",o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,s=[];A.split(";").map((function(A){var e=A.split(",");s.push(new BMapGL.Point(e[0],e[1]))})),t.inspectRange=new BMapGL.Polygon(s,{strokeColor:e,strokeWeight:n,strokeOpacity:a,strokeStyle:i,fillOpacity:o,fillColor:r}),t.map.addOverlay(t.inspectRange)})),s(this,"createTrack",(function(A){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#18C796",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"solid",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,g=arguments.length>8&&void 0!==arguments[8]?arguments[8]:500,c=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,l=arguments.length>10&&void 0!==arguments[10]&&arguments[10],I=[];if(A.map((function(A){var e=!1;t.currentTrack.length>0&&t.currentTrack.map((function(t){t.longitude===A.longitude&&t.latitude===A.latitude&&t.reportTime===A.reportTime&&(e=!0)})),e||(0==I.length&&t.currentTrack.length>0&&I.push(new BMapGL.Point(t.currentTrack[t.currentTrack.length-1].longitude,t.currentTrack[t.currentTrack.length-1].latitude)),I.push(new BMapGL.Point(A.longitude,A.latitude)))})),0!=I.length){var C=new BMapGL.Polyline(I,{strokeColor:i,strokeWeight:a,strokeOpacity:r,strokeStyle:n,fillOpacity:o});if(e?(t.map.addOverlay(C),t.map.centerAndZoom(I[I.length-1],15)):(t.trackAni=new BMapGLLib.TrackAnimation(t.map,C,{overallView:l,tilt:s,duration:g,delay:c}),t.trackAni.start()),t.currentTrack=A,t.currentTrack.length>0&&t.currentTrack.length>0){var d=new BMapGL.Point(t.currentTrack[0].longitude,t.currentTrack[0].latitude);if(t.startPoint=new BMapGL.Marker(d,{icon:new BMapGL.Icon("".concat(t.jSPlugin.staticPath,"/imgs/start.png"),new BMapGL.Size(32,47)),offset:new BMapGL.Size(0,-17)}),t.map.addOverlay(t.startPoint),1==t.currentTrack.length)return;var h=new BMapGL.Point(t.currentTrack[t.currentTrack.length-1].longitude,t.currentTrack[t.currentTrack.length-1].latitude);t.endPoint&&t.map.removeOverlay(t.endPoint),setTimeout((function(){t.endPoint=new BMapGL.Marker(h,{icon:new BMapGL.Icon("".concat(t.jSPlugin.staticPath,"/imgs/end.png"),new BMapGL.Size(30,30))}),t.map.addOverlay(t.endPoint)}),e?0:g)}}})),s(this,"centerToTrack",(function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;t.currentTrack.length>0&&(1==t.currentTrack.length?t.map.centerAndZoom(new BMapGL.Point(t.currentTrack[0].longitude,t.currentTrack[0].latitude),A):t.map.centerAndZoom(new BMapGL.Point(t.currentTrack[t.currentTrack.length-1].longitude,t.currentTrack[t.currentTrack.length-1].latitude),A))})),this.jSPlugin=e,this.videoWidth=e.width,this.videoHeight=e.height,this.toastCustom=new NA(e,!1),this.currentTrack=[],this.startPoint=null,this.endPoint=null,this.trackAni=null,this.inspectRange=null,this.map=this.initMap()})),$A=o((function A(e){var t=this;a(this,A),s(this,"init",(function(){var A=t;if(t.videoWidth,t.videoHeight,document.getElementById("".concat(t.jSPlugin.id,"-inspect-global-box")))document.getElementById("".concat(t.jSPlugin.id,"-inspect-global-box"))&&document.getElementById("".concat(t.jSPlugin.id,"-wrap")).removeChild(document.getElementById("".concat(t.jSPlugin.id,"-inspect-global-box"))),A.init();else{var e=document.createElement("div");e.id="".concat(t.jSPlugin.id,"-inspect-global-box"),e.style=";position: absolute; left:0; top: 0; width: 100%; height: 100%; z-index: 10000; background: #fff;",e.innerHTML='
    \n
    \n
    \n
    加载中…
    \n
    \n '),document.getElementById("".concat(t.jSPlugin.id,"-wrap")).appendChild(e)}})),s(this,"deviceErrorInfo",(function(A,e){var i=Object.assign({tips:"",refreshBtn:"",refreshShow:!1},A);if(document.getElementById("".concat(t.jSPlugin.id,"-no-inspect-box")))document.getElementById("".concat(t.jSPlugin.id,"-no-inspect-box"))&&document.getElementById("".concat(t.jSPlugin.id,"-inspect-global-box")).removeChild(document.getElementById("".concat(t.jSPlugin.id,"-no-inspect-box"))),t.deviceErrorInfo(A,e);else{t.videoHeight;var n=document.createElement("div");n.id="".concat(t.jSPlugin.id,"-no-inspect-box"),n.style="width:100%;height:100%; background: #ffffff; display: flex; justify-content: center; align-items: center",n.innerHTML='
    \n
    \n \n
    \n
    '.concat(i.tips,'
    \n \n
    \n "),document.getElementById("".concat(t.jSPlugin.id,"-inspect-global-box")).appendChild(n),document.getElementById("".concat(t.jSPlugin.id,"-inspect-device-status-refresh")).addEventListener("click",(function(){e&&e()}))}})),s(this,"globalContainerToggle",(function(A,e){document.getElementById(A)&&(document.getElementById(A).style.display=e?"flex":"none")})),this.jSPlugin=e,this.videoWidth=e.width,this.videoHeight=e.height,this.toastCustom=new NA(e,!1),this.init()})),Ae=function(){return o((function A(t){a(this,A),this.timer=null;var i={wrapNode:document.body,time:2e3,content:"",type:"info",center:!1,top:8};this.params=e(e({},i),t),this.init()}),[{key:"init",value:function(){var A=this;this.timer=null;var e=this.params,t=e.wrapNode,i=e.content,n=e.time,a=e.type,r=e.center,o=e.top;this.wrapNode=t;var s=document.createElement("div");s.setAttribute("class","ezuikit-message"),r?s.setAttribute("style","top: 50%; transform: translateY(-50%);"):s.setAttribute("style","top: ".concat(o||0,"px;")),this.wrapNode.appendChild(s),this.initMessageContent(a,i,s),0!==n&&(this.timer=setTimeout((function(){A.wrapNode.removeChild(s)}),n||2e3))}},{key:"initMessageContent",value:function(A,e,t){var i=document.createElement("div");i.setAttribute("class","ezuikit-message-notice"),i.innerHTML='\n\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\t').concat("warning"===A?'':"","\n\t\t\t\t\t\t").concat("info"===A?'':"","\n\t\t\t\t\t\t").concat("error"===A?'':"","\n\t\t\t\t\t\t").concat("success"===A?'':"","\n\t\t\t\t\t\n\t\t\t\t\t").concat(e,"\n\t\t\t\t
    \n\t\t\t
    \n\t\t\t"),t.appendChild(i)}}])}(),ee=function(){return o((function A(t){a(this,A),this.params=e(e({},{id:"",width:"100%",height:"100%",preview:!0,showIcon:!0,src:"",alt:"",fallback:"https://img.ys7.com/group32/M00/81/9D/CtxIA2HnrGyADm_jAAAFfWjIDJs811.png"}),t),this.id=Math.random().toString(36).substr(2),this.init()}),[{key:"init",value:function(){var A=this.params,e=A.id,t=A.width,i=A.height,n=A.preview;if(document.getElementById(e)){var a=document.createElement("div");a.setAttribute("class","ezuikit-image"),a.setAttribute("style","width:".concat(t,";height:").concat(i,";")),document.getElementById(e).appendChild(a),this.initImage(a),n&&this.initPreview(a)}}},{key:"previewImg",value:function(){var A=this.params,e=A.src,t=A.alt,i=A.fallback,n=document.createElement("div");n.setAttribute("id",this.id+"-preview"),n.setAttribute("class","ezuikit-image-preview"),n.innerHTML='\n\t\t\t
    \n\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t
    \n\t\t\t');var a=document.createElement("img");a.setAttribute("class","ezuikit-image-preview-img"),a.setAttribute("alt",t),a.setAttribute("src",e),a.addEventListener("error",(function(){a.setAttribute("src",i)})),document.body.appendChild(n),n.querySelector(".ezuikit-image-preview-img-main").appendChild(a),document.getElementById(this.id+"-ezuikit-image-preview-operations").addEventListener("click",(function(){document.body.removeChild(n)}))}},{key:"initImage",value:function(A){var e=this.params,t=e.src,i=e.alt,n=e.fallback,a=document.createElement("img");a.setAttribute("class","ezuikit-image-img"),a.setAttribute("alt",i),a.setAttribute("src",t),a.addEventListener("error",(function(){a.setAttribute("src",n)})),A.appendChild(a)}},{key:"initPreview",value:function(A){var e=this,t=this.params.showIcon,i=document.createElement("div");i.setAttribute("class","ezuikit-image-mask"),t&&(i.innerHTML='\n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t预览\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t\t'),A.appendChild(i),A.onclick=function(){e.previewImg()}}}])}(),te=function(){return o((function A(t){a(this,A),this.params=e(e({},{id:"",parentNodeId:"",title:"",content:"",placement:"top",cancelText:"取消",arrowPointAtCenter:!1,okText:"确定",onCancel:function(){},onConfirm:function(){}}),t),this.initState=!1,this.init(t)}),[{key:"init",value:function(){var A=this,e=this.params,t=e.id,i=e.content,n=e.placement,a=e.title,r=document.getElementById(t);if(r){var o=document.createElement("div");if(o.setAttribute("id",t+"-popover"),o.setAttribute("class","ezuikit-popover"),o.setAttribute("style","display:none;"),o.innerHTML='\n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t\t
    \n\t\t\t\t\t\t'.concat(a?'
    '.concat(a,"
    "):"",'\n\t\t\t\t\t\t
    ').concat(i,"
    \n\t\t\t\t\t
    \n\t\t\t\t"),!document.getElementById(t+"-popover")){var s=document.body;this.params.parentNodeId&&(s=document.getElementById(this.params.parentNodeId)),s.appendChild(o),this.renderPopover(o,r,n)}document.body.addEventListener("click",(function(e){A.addEventListenerFn(e)}))}}},{key:"addEventListenerFn",value:function(A){var e=this.params.id,t=document.getElementById(e),i=document.getElementById(e+"-popover");t&&A.target!==t&&!t.contains(A.target)&&i&&A.target!==i&&!i.contains(A.target)&&this.hidePopover()}},{key:"hidePopover",value:function(){var A=this.params.id,e=document.getElementById(A+"-popover");e&&document.body.removeChild(e)}},{key:"renderPopover",value:function(A,e,t,i,n){A.style.display="block";var a=e.getBoundingClientRect(),r=a.top,o=a.left,s=a.width,g=a.height,c=A.getBoundingClientRect(),l=c.width,I=c.height;i&&(l=i),n&&(I=n);var C=document.body;this.params.parentNodeId&&(C=document.getElementById(this.params.parentNodeId));var d=this.params.arrowPointAtCenter,h=0,B=0,u=A.getElementsByClassName("ezuikit-popover-arrow")[0],E=u.getBoundingClientRect(),f=E.width,Q=E.height;if(d){var x=0,p=0;switch(t){case"top":default:x=l/2,p=I;break;case"bottom":x=l/2,p=0;break;case"left":x=l,p=I/2;break;case"right":x=0,p=I/2;break;case"topLeft":x=(s-f)/2,p=I;break;case"topRight":x=l-(s+f)/2,p=I;break;case"bottomLeft":x=(s-f)/2,p=0;break;case"bottomRight":x=l-(s+f)/2,p=0;break;case"leftTop":x=l,p=(g-Q)/2;break;case"leftBottom":x=l,p=I-(g+Q)/2;break;case"rightTop":x=0,p=(g-10)/2;break;case"rightBottom":x=0,p=I-(g+Q)/2}u.style.left=x+"px",u.style.top=p+"px"}switch(t){case"top":h=-(I+Q),B=(s-l)/2,A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-top");break;case"bottom":h=g-Q/2,B=(s-l)/2,A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-bottom");break;case"left":h=(g-I)/2,B=-(l+f/2),A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-left");break;case"right":h=(g-I)/2,B=s-f/2,A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-right");break;case"topLeft":h=-(I+Q),B=0,A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-topLeft");break;case"topRight":h=-(I+Q),B=s-l,A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-topRight");break;case"bottomLeft":h=g-Q/2,B=0,A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-bottomLeft");break;case"bottomRight":h=g-Q/2,B=s-l,A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-bottomRight");break;case"leftTop":h=0,B=-(l+f/2),A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-leftTop");break;case"leftBottom":h=g-I,B=-(l+f/2),A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-leftBottom");break;case"rightTop":h=0,B=s-f/2,A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-rightTop");break;case"rightBottom":h=g-I,B=s-f/2,A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-rightBottom");break;default:h=-I,B=(s-l)/2,A.setAttribute("class","ezuikit-popover ezuikit-popover-placement-top")}var m=document.documentElement.scrollTop||document.body.scrollTop,y=document.documentElement.scrollLeft||document.body.scrollLeft;A.style.top=r+m+h+"px",A.style.left=o+y+B+"px";var _=A.getBoundingClientRect(),S=C===document.body?{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}:C.getBoundingClientRect(),D=t;_.leftS.right&&(D=(D=D.replace("Left","Right")).replace("left","right")),_.topS.bottom&&(D=(D=D.replace("Bottom","Top")).replace("bottom","top")),D!==t&&this.renderPopover(A,e,D,l,I)}}])}(),ie=function(){return o((function A(t){a(this,A),this.params=e(e({},{id:"",content:"",placement:"top",cancelText:"取消",arrowPointAtCenter:!1,okText:"确定",onCancel:function(){},onConfirm:function(){}}),t),this.PopconfirmDom=null,this.init(t)}),[{key:"init",value:function(){var A=this,t=this.params,i=t.content,n=t.cancelText,a=t.okText,r=t.onCancel,o=t.onConfirm,s=document.createElement("div");s.innerHTML='\n
    \n
    \n\t\t\t\t\t\n \t\n \n\t\t\t\t\t\n
    \n
    \n
    \n ');var g=document.createElement("button");g.className="ezuikit-btn ezuikit-cancel-btn",g.innerText=n;var c=document.createElement("button");return c.className="ezuikit-btn ezuikit-ok-btn ezuikit-btn-primary",c.innerText=a,s.querySelector(".ezuikit-popover-buttons").appendChild(g),s.querySelector(".ezuikit-popover-buttons").appendChild(c),this.PopconfirmDom=new te(e(e({},this.params),{},{content:s.innerHTML})),document.getElementById("".concat(this.params.id,"-popover")).querySelector(".ezuikit-cancel-btn")&&(document.getElementById("".concat(this.params.id,"-popover")).querySelector(".ezuikit-cancel-btn").onclick=function(){r?r():A.hide()}),document.getElementById("".concat(this.params.id,"-popover")).querySelector(".ezuikit-ok-btn")&&(document.getElementById("".concat(this.params.id,"-popover")).querySelector(".ezuikit-ok-btn").onclick=function(){o?o():A.hide()}),this.PopconfirmDom}},{key:"hide",value:function(){this.PopconfirmDom.hidePopover()}}])}(),ne=function(){return o((function A(t){a(this,A),this.params=e(e({},{id:"",width:"100%",height:"100%",preview:!0,poster:"",fallback:"https://img.ys7.com/group32/M00/81/9D/CtxIA2HnrGyADm_jAAAFfWjIDJs811.png",src:""}),t),this.id=Math.random().toString(36).substr(2),this.init()}),[{key:"init",value:function(){var A=this.params,e=A.id,t=A.width,i=A.height,n=A.preview;if(document.getElementById(e)){var a=document.createElement("div");a.setAttribute("class","ezuikit-video"),a.setAttribute("style","width:".concat(t,";height:").concat(i,";")),document.getElementById(e).appendChild(a),this.initVideo(a),n&&this.initPreview(a)}}},{key:"previewVideo",value:function(){var A=this.params.src,e=document.createElement("div");e.setAttribute("id",this.id+"-preview"),e.setAttribute("class","ezuikit-image-video"),e.innerHTML='\n\t\t\t
    \n\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t
    \n\t\t\t'),document.body.appendChild(e),document.getElementById(this.id+"-ezuikit-video-preview-operations").addEventListener("click",(function(){document.body.removeChild(e)}))}},{key:"initVideo",value:function(A){var e=this.params,t=e.poster,i=e.fallback,n=document.createElement("img");n.setAttribute("class","ezuikit-video-img"),n.setAttribute("src",t),n.addEventListener("error",(function(){n.setAttribute("src",i)})),A.appendChild(n)}},{key:"initPreview",value:function(A){var e=this,t=document.createElement("div");t.setAttribute("class","ezuikit-video-mask"),t.innerHTML='\n\t\t\t
    \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
    \n\t\t\t',A.appendChild(t),A.onclick=function(){e.previewVideo()}}}])}(),ae=function(A,e,t,i){var n={accessToken:A.accessToken,inspectRecordId:e,page:0},a="".concat(A.env.domain,"/api/service/devicekit/bodycamera/device/trace");yA(a,"GET",n,(function(A){t&&t(A)}),(function(A){i&&i(A)}),{"Content-Type":"application/x-www-form-urlencoded"})},re=function(A,e,t,i){var n={accessToken:A.accessToken,deviceSerial:p(A.url).deviceSerial,validateCode:p(A.url).validCode,channelNo:p(A.url).channelNo,evidenceFileType:e},a="".concat(A.env.domain,"/api/service/devicekit/common/file/evidence");yA(a,"POST",n,(function(A){t&&t(A)}),(function(A){i&&i(A)}),{"Content-Type":"application/x-www-form-urlencoded"})},oe=function(A,e,t,i){var n={accessToken:A.accessToken,taskId:e},a="".concat(A.env.domain,"/api/service/devicekit/opencloud/task/info");yA(a,"GET",n,(function(A){t&&t(A)}),(function(A){i&&i(A)}),{"Content-Type":"application/x-www-form-urlencoded"})};var se=function(){return o((function A(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:function(){};a(this,A),this.jSPlugin=e,this.currentEventInfo=t,this.inspectInfo=e.Theme.inspect.inspectInfo,this.type=n,this.timer=i,this.startTime=1e3,this.videoRecordingStatus=!0,this.saveSuccessCallback=r,this.init()}),[{key:"init",value:function(){this.renderEventDetail(),this.eventDetailDomEvent()}},{key:"show",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-detail-wrap")).setAttribute("class","inspect-event-detail-wrap show")}},{key:"hide",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-detail-wrap")).setAttribute("class","inspect-event-detail-wrap"),document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-detail-box")).innerHTML=""}},{key:"validationEventTag",value:function(){return 0==document.getElementById("".concat(this.jSPlugin.id,"-event-tag")).value.length?(document.getElementById("".concat(this.jSPlugin.id,"-event-tag-error")).style.display="block",document.getElementById("".concat(this.jSPlugin.id,"-event-tag-error")).innerHTML="请输入事件标签",document.getElementById("".concat(this.jSPlugin.id,"-event-tag")).setAttribute("class","ezuikit-input input-has-error"),!1):(document.getElementById("".concat(this.jSPlugin.id,"-event-tag-error")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-event-tag")).setAttribute("class","ezuikit-input"),!0)}},{key:"renderVideo",value:function(A,e,t){var i=this;if(document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-videoPreview")).innerHTML="",1===A||2===A){if(document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-videoPreview")).innerHTML='\n
    \n
    \n
    \n
    \n 视频正在存储中…\n
    \n '),1!==this.type){var n=this.currentEventInfo.evidenceId;this.timer.clearTimer("videoRecordingStatusTimer"),this.timer.createInterval("videoRecordingStatusTimer",(function(){oe(i.jSPlugin,n,(function(A){if(A.meta&&200===A.meta.code){var e=A.data,t=e.taskStatus,n=e.fileUrl,a=e.videoCoverPic||"".concat(i.jSPlugin.staticPath,"/imgs/bg.svg");i.renderVideo(t,a,n)}}))}),1e3)}}else 4===A||5===A||6===A||7===A?(document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-videoPreview")).innerHTML='\n
    \n
    \n \n
    \n 视频存储失败\n
    \n '),this.timer.clearTimer("videoRecordingStatusTimer")):0!==A&&3!==A||(new ne({id:"".concat(this.jSPlugin.id,"-inspectEventDetail-videoPreview"),poster:e,fallback:"".concat(this.jSPlugin.staticPath,"/imgs/bg.svg"),src:t}),this.timer.clearTimer("videoRecordingStatusTimer"))}},{key:"renderEventDetail",value:function(){var A=this,e=this.currentEventInfo,t=e.evidenceFileType,i=e.fileUrl,n=e.taskStatus,a=e.videoCoverPic,r=document.createElement("div");r.setAttribute("class","inspectEventDetail");var o="";if(o=1===t?a||"".concat(this.jSPlugin.staticPath,"/imgs/bg.svg"):i||"".concat(this.jSPlugin.staticPath,"/imgs/bg.svg"),r.innerHTML='\n
    \n
    \n \n
    \n
    ').concat(1===this.type?"编辑":"").concat(0===t?"图片存证":"视频存证",'
    \n
    \n
    \n ').concat(0===t?'
    \n

    图片已取证,请填写存证信息:

    \n
    \n
    '):'
    \n \n
    \n \n
    00:00:00
    \n
    \n \n
    \n
    \n

    视频已取证:

    \n
    \n
    \n
    '),'\n \n
    \n \n '),document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-detail-box")).appendChild(r),1===this.type?document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-content-info-time")).innerHTML="".concat(1===t?this.currentEventInfo.eventBeginTime+" ~ "+this.currentEventInfo.eventEndTime:this.currentEventInfo.eventTime):(document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-content-info-time")).innerHTML="".concat((new Date).Format("yyyy-MM-dd hh:mm:ss")).concat(1===t?" ~ -":""),1===t&&document.getElementById("".concat(this.jSPlugin.id,"-video-recording-time"))&&this.videoRecordingStatus&&(0===this.type&&document.getElementById("".concat(this.jSPlugin.id,"-event-ok")).setAttribute("disabled","disabled"),this.timer.createInterval("videoRecordingTimer",(function(){var e,t,i,n;A.startTime&&(document.getElementById("".concat(A.jSPlugin.id,"-video-recording-time")).innerHTML=(e=A.startTime,t=parseInt(e%864e5/36e5),i=parseInt(e%36e5/6e4),n=parseInt(e%6e4/1e3),(t<10?"0".concat(t):t)+":"+(i<10?"0".concat(i):i)+":"+(n<10?"0".concat(n):n))),A.startTime+=1e3,A.startTime>A.jSPlugin.inspectRecordingDuration&&(document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn")).click(),A.timer&&A.timer.clearTimer("videoRecordingTimer"))}),1e3))),1===t){var s=this.currentEventInfo&&this.currentEventInfo.fileUrl;this.renderVideo(n,o,s)}else new ee({id:"".concat(this.jSPlugin.id,"-inspectEventDetail-picUrl"),src:o,fallback:"".concat(this.jSPlugin.staticPath,"/imgs/fallback.svg"),showIcon:!1});this.show()}},{key:"eventDetailDomEvent",value:function(){var A=this,e=this.currentEventInfo,t=e.evidenceFileType,i=e.evidenceId;document.getElementById("".concat(this.jSPlugin.id,"-event-cancel")).addEventListener("click",(function(e){A.cancelPopover=new ie({id:"".concat(A.jSPlugin.id,"-event-cancel"),content:"确定要取消吗?".concat(1===A.type?"取消后编辑的内容将不会保存。":"取消后对应存证也将删除。"),placement:"topRight",arrowPointAtCenter:!0,onCancel:function(){A.cancelPopover.hide()},onConfirm:function(){1===t&&(A.videoRecordingStatus&&0===A.type&&(A.timer&&A.timer.clearTimer("videoRecordingTimer"),A.startTime=1e3,document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn")).click()),A.timer.clearTimer("videoRecordingStatusTimer")),A.cancelPopover.hide(),A.hide()}})})),document.getElementById("".concat(this.jSPlugin.id,"-event-ok")).addEventListener("click",(function(){if(A.validationEventTag()){var e=A.currentEventInfo,t=e.evidenceFileType,i=e.evidenceId,n=A.inspectInfo,a=n.inspectRecordId,r=n.inspectPerson,o=document.getElementById("".concat(A.jSPlugin.id,"-inspectEventDetail-content-info-time")).innerHTML,s={inspectRecordId:a,depositaryOfficer:r,evidenceFileId:i,evidenceFileType:t,eventType:document.getElementById("".concat(A.jSPlugin.id,"-event-tag")).value,eventRemark:document.getElementById("".concat(A.jSPlugin.id,"-event-remark")).value};1===t&&(s.eventBeginTime=o.split("~")[0].trim(),s.eventEndTime=o.split("~")[1].trim(),A.timer.clearTimer("videoRecordingStatusTimer")),0===t&&(s.eventTime=o),1===A.type&&(s.inspectEventId=A.currentEventInfo.inspectEventId,delete s.depositaryOfficer,delete s.eventTime,delete s.eventBeginTime,delete s.eventEndTime,delete s.evidenceFileId,delete s.evidenceFileType,function(A,e,t,i){var n={accessToken:A.accessToken,inspectRecordId:"",inspectEventId:"",eventType:"",eventRemark:""},a=Object.assign(n,e),r="".concat(A.env.domain,"/api/service/devicekit/bodycamera/inspect/event/update");yA(r,"POST",a,(function(A){t&&t(A)}),(function(A){i&&i(A)}),{"Content-Type":"application/x-www-form-urlencoded"})}(A.jSPlugin,s,(function(e){e.meta&&200===e.meta.code?(A.hide(),A.saveSuccessCallback&&A.saveSuccessCallback({eventType:s.eventType,eventRemark:s.eventRemark})):new Ae({type:"error",content:"保存失败,".concat(e.meta&&e.meta.message||"请稍后重试!"),wrapNode:document.getElementById("".concat(A.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){new Ae({type:"error",content:"保存失败,请稍后重试!",wrapNode:document.getElementById("".concat(A.jSPlugin.id,"-inspect-event-box")),top:40})}))),0===A.type&&function(A,e,t,i){var n={accessToken:A.accessToken,inspectRecordId:"",eventType:"",evidenceFileId:"",eventTime:"",eventBeginTime:"",eventEndTime:"",depositaryOfficer:"",eventRemark:"",evidenceFileType:""},a=Object.assign(n,e),r="".concat(A.env.domain,"/api/service/devicekit/bodycamera/inspect/event");yA(r,"POST",a,(function(A){t&&t(A)}),(function(A){i&&i(A)}),{"Content-Type":"application/x-www-form-urlencoded"})}(A.jSPlugin,s,(function(e){e.meta&&200===e.meta.code?(A.hide(),A.saveSuccessCallback&&A.saveSuccessCallback()):new Ae({type:"error",content:"保存失败,".concat(e.meta&&e.meta.message||"请稍后重试!"),wrapNode:document.getElementById("".concat(A.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){new Ae({type:"error",content:"保存失败,请稍后重试!",wrapNode:document.getElementById("".concat(A.jSPlugin.id,"-inspect-event-box")),top:40})}))}})),document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-back")).addEventListener("click",(function(){A.backPopover=new ie({id:"".concat(A.jSPlugin.id,"-inspectEventDetail-back"),content:"确定要返回吗?".concat(1===A.type?"返回后编辑的内容将不会保存。":"返回后对应存证也将删除。"),placement:"bottomRight",arrowPointAtCenter:!0,onCancel:function(){A.backPopover.hide()},onConfirm:function(){1===t&&(A.videoRecordingStatus&&0===A.type&&(A.timer&&A.timer.clearTimer("videoRecordingTimer"),A.startTime=1e3,document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn")).click()),A.timer.clearTimer("videoRecordingStatusTimer")),A.backPopover.hide(),A.hide()}})})),document.getElementById("".concat(this.jSPlugin.id,"-video-recording-stop-btn"))&&document.getElementById("".concat(this.jSPlugin.id,"-video-recording-stop-btn")).addEventListener("click",(function(){document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn")).setAttribute("class","inspectEventDetail-stop-btn ezuikit-btn ezuikit-btn-loading"),document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn")).querySelector(".ezuikit-btn-loading-icon").style.display="inline-block",function(A,e,t,i){var n={accessToken:A.accessToken,taskId:e},a="".concat(A.env.domain,"/api/v3/open/cloud/video/frame/stop");yA(a,"POST",n,(function(A){t&&t(A)}),(function(A){i&&i(A)}),{"Content-Type":"application/x-www-form-urlencoded"})}(A.jSPlugin,i,(function(e){document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn"))&&(document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn")).setAttribute("class","inspectEventDetail-stop-btn ezuikit-btn"),document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn")).querySelector(".ezuikit-btn-loading-icon").style.display="none"),e.meta&&200===e.meta.code?oe(A.jSPlugin,i,(function(e){if(e.meta&&200===e.meta.code){var t=e.data,i=t.taskStatus,n=t.fileUrl,a=t.videoCoverPic;A.timer&&A.timer.clearTimer("videoRecordingTimer");var r=a||"".concat(A.jSPlugin.staticPath,"/imgs/bg.svg");A.renderVideo(i,r,n),document.getElementById("".concat(A.jSPlugin.id,"-inspectEventDetail-content-video-info")).style.display="block",document.getElementById("".concat(A.jSPlugin.id,"-inspectEventDetail-content-video-timer")).style.display="none";var o=document.getElementById("".concat(A.jSPlugin.id,"-inspectEventDetail-content-info-time")).innerHTML;document.getElementById("".concat(A.jSPlugin.id,"-inspectEventDetail-content-info-time")).innerHTML="".concat(o.split("~")[0]," ~ ").concat((new Date).Format("yyyy-MM-dd hh:mm:ss")),A.videoRecordingStatus=!1,document.getElementById("".concat(A.jSPlugin.id,"-event-ok")).removeAttribute("disabled")}})):new Ae({type:"error",content:"停止录制失败,请稍后重试!",wrapNode:document.getElementById("".concat(A.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn"))&&(document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn")).setAttribute("class","inspectEventDetail-stop-btn ezuikit-btn"),document.getElementById("".concat(A.jSPlugin.id,"-video-recording-stop-btn")).querySelector(".ezuikit-btn-loading-icon").style.display="none"),new Ae({type:"error",content:"停止录制失败,请稍后重试!",wrapNode:document.getElementById("".concat(A.jSPlugin.id,"-inspect-event-box")),top:40})}))})),document.getElementById("".concat(this.jSPlugin.id,"-event-tag")).addEventListener("input",(function(){A.validationEventTag()})),document.getElementById("".concat(this.jSPlugin.id,"-event-remark")).addEventListener("input",(function(A){var e=A.target.value;A.target.parentNode.setAttribute("data-count","".concat(e.length," / 100"))})),document.getElementById("".concat(this.jSPlugin.id,"-event-remark")).addEventListener("focus",(function(A){A.target.parentNode.setAttribute("class","ezuikit-input-textarea ezuikit-input-textarea-show-count ezuikit-input-textarea-focus")})),document.getElementById("".concat(this.jSPlugin.id,"-event-remark")).addEventListener("blur",(function(A){A.target.parentNode.setAttribute("class","ezuikit-input-textarea ezuikit-input-textarea-show-count")}))}}])}(),ge=function(){return o((function A(e,t,i){var n=this;a(this,A),s(this,"hideDelEConfirm",(function(){for(var A=0;A\n

    巡检事件

    \n
    \n
    \n \n \n 图片存证\n \n \n \n 视频存证\n
    \n
    \n \n \n \n
    \n
    \n \n
    \n
    \n
    \n \n

    暂无事件

    \n
    \n \n \n
    \n

    巡检事件

    \n
    \n
    \n '),document.getElementById("".concat(n.jSPlugin.id,"-wrap")).appendChild(e),n.jSPlugin.Theme.decoderState.state.play?n.enableEvidenceBtn():n.disableEvidenceBtn(),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-img")).onclick=function(){n.listLoading||n.startEvidence||(n.startEvidence=!0,n.hideDelEConfirm(),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-img")).setAttribute("class","ezuikit-btn ezuikit-btn-primary ezuikit-btn-loading"),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-img")).querySelector(".ezuikit-btn-loading-icon").style.display="inline-block",re(n.jSPlugin,0,(function(A){n.startEvidence=!1,document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-img")).setAttribute("class","ezuikit-btn ezuikit-btn-primary"),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-img")).querySelector(".ezuikit-btn-loading-icon").style.display="none",A.meta&&200===A.meta.code?new se(n.jSPlugin,A.data,n.timer,0,(function(){n.initEvent(),new Ae({type:"success",content:"保存成功",wrapNode:document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-box")),top:40})})):new Ae({type:"error",content:"图片存证失败,".concat(A.meta&&A.meta.message||"请稍后重试!"),wrapNode:document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){n.startEvidence=!1,document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-img")).setAttribute("class","ezuikit-btn ezuikit-btn-primary"),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-img")).querySelector(".ezuikit-btn-loading-icon").style.display="none",new Ae({type:"error",content:"图片存证失败,请稍后重试!",wrapNode:document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-box")),top:40})})))},document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-video")).onclick=function(){n.listLoading||n.startEvidence||(n.startEvidence=!0,n.hideDelEConfirm(),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-video")).setAttribute("class","ezuikit-btn ezuikit-btn-primary ezuikit-btn-loading"),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-video")).querySelector(".ezuikit-btn-loading-icon").style.display="inline-block",re(n.jSPlugin,1,(function(A){n.startEvidence=!1,document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-video")).setAttribute("class","ezuikit-btn ezuikit-btn-primary"),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-video")).querySelector(".ezuikit-btn-loading-icon").style.display="none",A.meta&&200===A.meta.code?new se(n.jSPlugin,A.data,n.timer,0,(function(){n.initEvent(),new Ae({type:"success",content:"保存成功",wrapNode:document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-box")),top:40})})):new Ae({type:"error",content:"视频存证失败,".concat(A.meta&&A.meta.message||"请稍后重试!"),wrapNode:document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){n.startEvidence=!1,document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-video")).setAttribute("class","ezuikit-btn ezuikit-btn-primary"),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-video")).querySelector(".ezuikit-btn-loading-icon").style.display="none",new Ae({type:"error",content:"视频存证失败,请稍后重试!",wrapNode:document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-box")),top:40})})))},document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-list-refresh")).onclick=function(){n.listLoading||n.startEvidence||(n.hideDelEConfirm(),document.getElementById("".concat(n.jSPlugin.id,"-inspect-loading")).style.display="block",document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-list-wrap")).style.display="none",document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-list-nodata-wrap")).style.display="none",A.initEvent())}}})),s(this,"renderList",(function(A){document.getElementById("".concat(n.jSPlugin.id,"-inspect-loading")).style.display="none";var e=A.data||[];if(e.length>0){document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-list-wrap")).style.display="block",document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-list-nodata-wrap")).style.display="none";for(var t=function(){var t=document.createElement("div");t.setAttribute("class","inspect-event-item");var a=e[i];t.setAttribute("id","".concat(n.jSPlugin.id,"-inspect-event-item-").concat(a.inspectEventId)),t.innerHTML="",document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-list-wrap-main")).appendChild(t);var r,o=document.createElement("div");o.setAttribute("class","inspect-event-item-header-wrap"),1==a.evidenceFileType&&(r="".concat(a.eventBeginTime.split(" ")[1],"~").concat(a.eventEndTime.split(" ")[1])),0==a.evidenceFileType&&(r="".concat(a.eventTime.split(" ")[1]));var s="";1===a.evidenceFileType&&(1===a.taskStatus||2===a.taskStatus?s="storage":4===a.taskStatus||5===a.taskStatus||6===a.taskStatus||7===a.taskStatus?s="storage-error":0!==a.taskStatus&&3!==a.taskStatus||(s="storage-success")),o.innerHTML='\n
    \n
    \n \n \n \n \n \n \n \n \n \n ').concat(r||"-",'\n
    \n
    \n \n \n \n \n
    \n
    \n '),t.appendChild(o),o.onclick=function(A){"none"===o.querySelector(".inspect-event-item-header-toggle-up").style.display?(o.querySelector(".inspect-event-item-header-toggle-up").style.display="block",o.querySelector(".inspect-event-item-header-toggle-down").style.display="none",t.querySelector(".inspect-event-item-body").style.display="block"):(o.querySelector(".inspect-event-item-header-toggle-up").style.display="none",o.querySelector(".inspect-event-item-header-toggle-down").style.display="block",t.querySelector(".inspect-event-item-body").style.display="none")};var g=document.createElement("div");g.setAttribute("class","inspect-event-item-body"),g.style.display="none";var c=(1===a.evidenceFileType?a.videoCoverPic:a.fileUrl)||"".concat(n.jSPlugin.staticPath,"/imgs/bg.svg");g.innerHTML='\n
    \n
    \n
    \n ').concat(a.eventType,"\n
    \n
    \n "),t.appendChild(g),1==a.evidenceFileType&&(1===a.taskStatus||2===a.taskStatus?document.getElementById("".concat(n.jSPlugin.id,"-inspect-view-").concat(a.inspectEventId)).innerHTML='\n
    \n
    \n
    \n
    \n 视频正在存储中…\n
    \n '):4===a.taskStatus?document.getElementById("".concat(n.jSPlugin.id,"-inspect-view-").concat(a.inspectEventId)).innerHTML='\n
    \n
    \n \n
    \n 视频存储失败\n
    \n '):0!==a.taskStatus&&3!==a.taskStatus||new ne({id:"".concat(n.jSPlugin.id,"-inspect-view-").concat(a.inspectEventId),src:a.fileUrl,poster:c,fallback:"".concat(n.jSPlugin.staticPath,"/imgs/bg.svg")})),0==a.evidenceFileType&&new ee({id:"".concat(n.jSPlugin.id,"-inspect-view-").concat(a.inspectEventId),src:c,fallback:"".concat(n.jSPlugin.staticPath,"/imgs/bg.svg"),showIcon:!1});var l=document.createElement("div");l.setAttribute("class","inspect-event-item-body-info-opr");var I=document.createElement("span");I.setAttribute("class","inspect-event-item-body-info-opr-icon"),I.innerHTML='\n \n ',l.appendChild(I);var C=document.createElement("span");C.setAttribute("class","inspect-event-item-body-info-opr-icon"),C.id="".concat(n.jSPlugin.id,"-inspect-event-del-").concat(a.inspectEventId),C.innerHTML=' \n \n ',l.appendChild(C),I.onclick=function(A){n.startEvidence||new se(n.jSPlugin,a,n.timer,1,(function(A){new Ae({type:"success",content:"保存成功",wrapNode:document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-box")),top:40}),a=Object.assign(a,A),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-item-").concat(a.inspectEventId)).querySelector(".inspect-event-item-body-info-tag-label").innerHTML=a.eventType,document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-item-").concat(a.inspectEventId)).querySelector(".inspect-event-item-body-info-tag-label").setAttribute("title",a.eventType)}))},C.onclick=function(A){n.startEvidence||(n.delE=new ie({id:"".concat(n.jSPlugin.id,"-inspect-event-del-").concat(a.inspectEventId),content:"确定要删除该事件吗?",placement:"topRight",arrowPointAtCenter:!0,onCancel:function(){n.delE.hide()},onConfirm:function(){!function(A,e,t,i){var n={accessToken:A.accessToken,inspectEventId:""},a=Object.assign(n,e),r="".concat(A.env.domain,"/api/service/devicekit/bodycamera/inspect/event/delete");yA(r,"POST",a,(function(A){t&&t(A)}),(function(A){i&&i(A)}),{"Content-Type":"application/x-www-form-urlencoded"})}(n.jSPlugin,{inspectEventId:a.inspectEventId},(function(A){A.meta&&200===A.meta.code?(n.delE.hide(),n.initEvent(),setTimeout((function(){new Ae({type:"success",content:"删除成功",wrapNode:document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-box")),top:40})}),10)):new Ae({type:"error",content:"删除失败,".concat(A.meta&&A.meta.message||"请稍后重试!"),wrapNode:document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){new Ae({type:"error",content:"删除失败,请稍后重试!",wrapNode:document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-box")),top:40})}))}}),n.delEConfirmList.push(n.delE))},t.querySelector(".inspect-event-item-body-info").appendChild(l),document.getElementById("".concat(n.jSPlugin.id,"-inspect-event-list-wrap")).onscroll=function(e){var t=e.target;n.hideDelEConfirm(),t.scrollTop+t.offsetHeight>=t.scrollHeight-48&&!n.listLoading&&(A.start+1)*A.size0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30,i=this;i.listLoading=!0,0===e?i.initRender(e):document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-list-more-loading")).style.display="flex";var n=function(e){new Ae({type:"error",content:e.meta&&e.meta.message||"列表获取失败,请稍后重试!",wrapNode:document.getElementById("".concat(A.jSPlugin.id,"-inspect-event-box")),top:40}),i.renderList({})};!function(A,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30,n=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,r={accessToken:A.accessToken,inspectRecordId:e,pageStart:t,pageSize:i},o="".concat(A.env.domain,"/api/service/devicekit/bodycamera/inspect/event/page");yA(o,"GET",r,(function(A){n&&n(A)}),(function(A){a&&a(A)}),{"Content-Type":"application/x-www-form-urlencoded"})}(i.jSPlugin,i.inspectRecordId,e,t,(function(e){i.listLoading=!1,document.getElementById("".concat(A.jSPlugin.id,"-inspect-event-list-more-loading")).style.display="none",e.meta&&200===e.meta.code?i.renderList(e.data||{}):n(e)}),(function(e){i.listLoading=!1,document.getElementById("".concat(A.jSPlugin.id,"-inspect-event-list-more-loading")).style.display="none",n(e)}))}},{key:"disableEvidenceBtn",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-img")).setAttribute("disabled","disabled"),document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-video")).setAttribute("disabled","disabled")}},{key:"enableEvidenceBtn",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-img")).removeAttribute("disabled"),document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-video")).removeAttribute("disabled")}}])}(),ce=function(){return o((function A(e,t,i,n,r){var o=this;a(this,A),s(this,"createLocationControl",(function(){var A=o;function e(){this.defaultAnchor=BMAP_ANCHOR_BOTTOM_LEFT,this.defaultOffset=new BMapGL.Size(40,105)}return e.prototype=new BMapGL.Control,e.prototype.initialize=function(e){var t=document.createElement("div");return t.style.cssText="width: 26px;height: 26px;display: flex;align-items: center;justify-content: center; box-shadow: 1px 2px 1px rgb(0 0 0 / 15%); background: #fff; cursor: pointer;",t.id="".concat(A.jSPlugin.id,"-location-btn"),t.innerHTML='\n \n ',t.onclick=function(e){setTimeout((function(){A.inspectMapWin.centerToTrack(18)}),100)},e.getContainer().appendChild(t),t},new e})),s(this,"initSwithcBtn",(function(){var A=document.createElement("div");A.id="".concat(o.jSPlugin.id,"-miniSwitch"),A.style="cursor: pointer;position: absolute; bottom: 106px; right: ".concat(o.jSPlugin.inspectVideoWidth+10,"px; z-index: 999;"),A.innerHTML="
    \n \n 大小窗切换\n \n \n \n \n \n
    '),document.getElementById("".concat(o.jSPlugin.id,"-wrap")).appendChild(A),document.getElementById("".concat(o.jSPlugin.id,"-miniSwitch-btn")).onclick=function(){b.throttle((function(){return o.miniRecSwitchClick()}),1e3)()}})),s(this,"initMiniWinToggleBtn",(function(){var A=.3333*o.videoWidth,e=.3333*o.videoHeight,t=document.createElement("div");t.id="".concat(o.jSPlugin.id,"-miniToggle"),t.style="cursor: pointer;position: absolute; bottom: ".concat(e/2+96-30,"px; right: ").concat(o.jSPlugin.inspectVideoWidth+A,"px; z-index: 999; height:60px; box-sizing: border-box; padding-top: 20px; text-align: center; width:20px; overflow: hidden; background: #000000; border-radius: 2px 0px 0px 2px; opacity: 0.7;"),t.innerHTML="
    \n \n \n \n \n
    '),document.getElementById("".concat(o.jSPlugin.id,"-wrap")).appendChild(t),document.getElementById("".concat(o.jSPlugin.id,"-miniToggle")).onclick=function(){o.miniWinToggleClick()}})),s(this,"init",(function(){o.initSwithcBtn(),o.initMiniWinToggleBtn()})),s(this,"setStyleListByIds",(function(A){A.map((function(A){var e=document.getElementById(A.id);e&&Object.keys(A.styleList).map((function(t){e.style[t]=A.styleList[t]}))}))})),this.jSPlugin=e,this.inspectMode=t,this.inspectMapWin=i,this.changeInspectMode=n,this.videoWidth=e.width,this.videoHeight=e.height,this.minWinStatus="open",this.decoderState=r,this.ZoomControl=new BMapGL.ZoomControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT,offset:new BMapGL.Size(40,50)}),this.LocationControl=this.createLocationControl(),this.NavigationControl3D=new BMapGL.NavigationControl3D({anchor:BMAP_ANCHOR_BOTTOM_LEFT,offset:new BMapGL.Size(28,105)}),this.init()}),[{key:"miniWinToggleClick",value:function(){var A=.3333*this.jSPlugin.width;"open"===this.minWinStatus?(this.setStyleListByIds([{id:"video"===this.inspectMode?"".concat(this.jSPlugin.id,"-mapbox"):"".concat(this.jSPlugin.id),styleList:{width:"0px"}},{id:"".concat(this.jSPlugin.id,"-miniSwitch"),styleList:{display:"none"}},{id:"".concat(this.jSPlugin.id,"-miniToggle"),styleList:{right:"".concat(this.jSPlugin.inspectVideoWidth,"px")}},{id:"".concat(this.jSPlugin.id,"-min-win-close-icon"),styleList:{display:"none"}},{id:"".concat(this.jSPlugin.id,"-min-win-open-icon"),styleList:{display:"inline-block"}}]),this.minWinStatus="close"):(this.setStyleListByIds([{id:"video"===this.inspectMode?"".concat(this.jSPlugin.id,"-mapbox"):"".concat(this.jSPlugin.id),styleList:{width:A+"px"}},{id:"".concat(this.jSPlugin.id,"-miniSwitch"),styleList:{display:"block"}},{id:"".concat(this.jSPlugin.id,"-miniToggle"),styleList:{right:"".concat(this.jSPlugin.inspectVideoWidth+A,"px")}},{id:"".concat(this.jSPlugin.id,"-min-win-close-icon"),styleList:{display:"inline-block"}},{id:"".concat(this.jSPlugin.id,"-min-win-open-icon"),styleList:{display:"none"}}]),this.minWinStatus="open")}},{key:"miniRecSwitchClick",value:function(){var A=this,e=.3333*this.jSPlugin.width,t=.3333*this.jSPlugin.height;"video"===this.inspectMode?(this.jSPlugin.Zoom&&this.jSPlugin.Zoom.stopZoom(),this.setStyleListByIds([{id:"".concat(this.jSPlugin.id,"-mapbox"),styleList:{width:this.jSPlugin.width+"px",height:this.jSPlugin.height+"px",marginBottom:"-40px"}},{id:"".concat(this.jSPlugin.id,"-ez-iframe-footer-container"),styleList:{top:this.jSPlugin.height+"px"}},{id:"".concat(this.jSPlugin.id),styleList:{position:"absolute",zIndex:"100",bottom:"96px",right:"".concat(this.jSPlugin.inspectVideoWidth,"px"),overflow:"hidden"}}]),this.jSPlugin.Theme.inspect.reSizeVideo(e,t),this.inspectMode="map",this.changeInspectMode("map"),this.inspectMapWin.map.addControl(this.NavigationControl3D),this.inspectMapWin.map.addControl(this.LocationControl),this.inspectMapWin.map.addControl(this.ZoomControl),this.inspectMapWin.map.addOverlay(this.inspectMapWin.inspectRange),document.getElementById("".concat(this.jSPlugin.id,"-loading-item-btn-wrap"))&&this.setStyleListByIds([{id:"".concat(this.jSPlugin.id,"-loading-item-btn"),styleList:{display:"none"}},{id:"".concat(this.jSPlugin.id,"-loading-item-btn-svg"),styleList:{display:"block"}},{id:"".concat(this.jSPlugin.id,"-loading-item-btn-wrap"),styleList:{border:"none",width:"32px",height:"14px"}}]),setTimeout((function(){A.inspectMapWin.centerToTrack(18)}),100)):(this.setStyleListByIds([{id:"".concat(this.jSPlugin.id,"-mapbox"),styleList:{width:e+"px",height:t+"px",marginBottom:"0"}},{id:"".concat(this.jSPlugin.id,"-ez-iframe-footer-container"),styleList:{top:"0px"}},{id:"".concat(this.jSPlugin.id),styleList:{position:"relative",zIndex:"0",bottom:"0",right:"0"}}]),this.jSPlugin.Theme.inspect.reSizeVideo(this.jSPlugin.width,this.jSPlugin.height),this.inspectMode="video",this.changeInspectMode("video"),this.inspectMapWin.map.removeControl(this.ZoomControl),this.inspectMapWin.map.removeControl(this.NavigationControl3D),this.inspectMapWin.map.removeControl(this.LocationControl),this.inspectMapWin.map.removeOverlay(this.inspectMapWin.inspectRange),document.getElementById("".concat(this.jSPlugin.id,"-loading-item-btn-wrap"))&&this.setStyleListByIds([{id:"".concat(this.jSPlugin.id,"-loading-item-btn"),styleList:{display:"block"}},{id:"".concat(this.jSPlugin.id,"-loading-item-btn-svg"),styleList:{display:"none"}},{id:"".concat(this.jSPlugin.id,"-loading-item-btn-wrap"),styleList:{border:"1px solid rgb(255, 255, 255)",width:"80px",height:"32px",color:"#fff","text-align":"center","line-height":"32px","font-size":"14px"}}]),setTimeout((function(){A.inspectMapWin.centerToTrack()}),100),this.jSPlugin.Zoom&&this.decoderState.state.play&&this.jSPlugin.Zoom.startZoom()),this.setStyleListByIds([{id:"".concat(this.jSPlugin.id,"-wrap"),styleList:{width:this.jSPlugin.width+this.jSPlugin.inspectVideoWidth+"px",height:this.jSPlugin.height+this.jSPlugin.inspectVideoHeight+"px"}}])}}])}(),le={customConfig:{defaultMicro:0,defaultPlay:0,maxTalkTime:0,bellPoster:0,maxBellTime:0,inspectInfo:{color:"#000000",backgroundColor:"#ffffff",activeColor:"#1890FF",btnList:[{btnKey:"inspectName",iconId:"inspectName",part:"left",defaultActive:0,isrender:1,color:"#262626"},{btnKey:"inspectBeginTime",iconId:"inspectBeginTime",part:"left",defaultActive:0,isrender:1,color:"#262626"},{btnKey:"inspectPerson",iconId:"inspectPerson",part:"right",defaultActive:0,isrender:1,color:"#262626"}]}},header:{color:"#2c2c2c",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{btnKey:"deviceName",iconId:"deviceName",part:"left",defaultActive:0,isrender:1,color:"#ffffff"},{btnKey:"inspectTime",iconId:"inspectTime",part:"left",defaultActive:0,isrender:1,color:"#ffffff"},{btnKey:"signalType",iconId:"signalType",part:"right",defaultActive:0,isrender:1,color:"#ffffff"},{btnKey:"batteryStatus",iconId:"batteryStatus",part:"right",defaultActive:0,isrender:1,color:"#ffffff"}]},footer:{color:"#ffffff",backgroundColor:"#000000",activeColor:"blue",btnList:[{btnKey:"talk",iconId:"talk",part:"left",defaultActive:1,isrender:1,backgroundColor:"#cccccc"},{btnKey:"sound",iconId:"sound",part:"left",defaultActive:1,isrender:1,backgroundColor:"#cccccc"}]}},Ie=function(A){var e="";return Object.keys(A).map((function(t,i){e+="".concat(t,":").concat(A[t]).concat(i\n \n ':"".concat(A,""):null}},{key:"renderBatteryStatus",value:function(A){return A&&0!=A?'\n
    \n ').concat(A,'%\n
    \n
    \n
    \n \n \n \n
    \n '):null}},{key:"renderInspectTime",value:function(A){if(!A)return null;var e,t,i,n,a=A.split(" "),r=a[0].split("-"),o=a[1].split(":"),s=new Date(r[0],r[1]-1,r[2],o[0],o[1],o[2]),g=(new Date).getTime()-new Date(s).getTime();return'\n \n '.concat((e=g,t=parseInt(e%864e5/36e5),i=parseInt(e%36e5/6e4),n=parseInt(e%6e4/1e3),(t<10?"0".concat(t):t)+":"+(i<10?"0".concat(i):i)+":"+(n<10?"0".concat(n):n)),"\n ")}},{key:"matchBtn",value:function(A,e){var t=this,i=this.themeData,n=i.customConfig,a=i.header,r=i.footer,o=n.inspectInfo,s={title:"",id:"",domString:"",color:"#FFFFFF",activeColor:"#FFFFFF",onclick:function(){},onmoveleft:function(){},onmoveright:function(){},onremove:function(){}},g=o.btnList.findIndex((function(e){return e.iconId===A}));switch(-1!==g?(s.color=o.color,s.backgroundColor=o.backgroundColor,s.activeColor=o.activeColor):-1!==(g=a.btnList.findIndex((function(e){return e.iconId===A})))?(s.color=a.color,s.backgroundColor=a.backgroundColor,s.activeColor=a.activeColor):(s.color=r.color,s.backgroundColor=r.backgroundColor,s.activeColor=r.activeColor),A){case"inspectName":return s.title="巡检名称",s.id=A,s.domString='巡检名称'),s.onclick=function(){},s;case"inspectBeginTime":return s.title="巡检开始时间",s.id=A,s.domString='巡检开始时间:-'),s.onclick=function(){},s;case"inspectPerson":return s.title="本地巡检员",s.id=A,s.domString='本地巡检员:-'),s.onclick=function(){},s;case"deviceName":return s.title="设备名称",s.id=A,s.domString='设备名称'),s.onclick=function(){},s;case"inspectTime":return s.title="巡检时长",s.id=A,s.domString='巡检时长:-'),s.onclick=function(){},s;case"signalType":return s.title="信号类型",s.id=A,s.domString=''),s.onclick=function(){},s;case"batteryStatus":return s.title="设备电量",s.id=A,s.domString=''),s.onclick=function(){},s;case"talk":return s.title="对讲",s.id=A,s.domString="
    "+'')+''+'对讲'),s.onclick=function(){var A=t.decoderState.state,e=A.talk,i=A.sound;if(A.play)if(e){console.log("结束对讲"),t.setDecoderState({talk:!1}),t.jSPlugin.Talk.stopTalk();var n=b.findIndex(t.themeData.footer.btnList,(function(A){return"sound"===A.iconId&&1===A.isrender&&1===A.defaultActive}))>-1;t.themeData&&n&&(t.jSPlugin.openSound(),t.setDecoderState({sound:!0}))}else console.log("开始对讲"),t.setDecoderState({talk:!0}),t.jSPlugin.Talk.startTalk((function(A){i&&!A&&(t.jSPlugin.closeSound(),t.setDecoderState({sound:!1}))}))},s;case"sound":return s.title="音量",s.id=A,s.domString=''+'')+'\n \n \n \n \n ')+'音量'),s.onclick=function(){var A=t.decoderState.state,e=A.play,i=A.sound,n=A.talk;e&&!n&&(i?(t.jSPlugin.closeSound(),t.setDecoderState({sound:!1})):(t.jSPlugin.openSound(),t.setDecoderState({sound:!0})))},s;default:return s}}},{key:"renderInspectInfo",value:function(A,e){var t=this.matchBtn(A,e),i=document.createElement("sapn");i.innerHTML="".concat(t.domString),"left"===e.part?document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl-left")).appendChild(i):document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl-right")).appendChild(i)}},{key:"renderHeader",value:function(A,e){var t=this.matchBtn(A,e),i=document.createElement("span");i.className="".concat(this.jSPlugin.id,"-header-content"),i.style="display: flex; align-items: center; ",i.innerHTML="\n ".concat(t.domString,"\n "),"left"===e.part?document.getElementById("".concat(this.jSPlugin.id,"-headControl-left")).appendChild(i):document.getElementById("".concat(this.jSPlugin.id,"-headControl-right")).appendChild(i)}},{key:"renderFooter",value:function(A,e){var t=this,i=this.matchBtn(A,e),n=this.videoWidth/6,a=document.createElement("div");a.className="theme-icon-item",this.jSPlugin.isWebConsole?a.style="padding:0 ".concat(.1*n,"px;"):a.style="padding:0 ".concat(.1*n,"px;cursor: pointer;"),a.innerHTML="".concat('')+'
    ')).concat(i.domString,"
    ")+"
    ",a.onclick=function(A){if(t.decoderState.state.isEditing||!t.activeThemeStatus)return!1;i.onclick(A)},i.onmouseenter&&(a.onmouseenter=function(A){if(t.decoderState.state.isEditing||!t.activeThemeStatus)return!1;i.onmouseenter(A)}),i.onmouseleave&&(a.onmouseleave=function(A){if(t.decoderState.state.isEditing||!t.activeThemeStatus)return!1;i.onmouseleave(A)}),document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).appendChild(a)}},{key:"initThemeData",value:function(){var A=this,e=this.themeData,t=e.customConfig,i=e.header,n=e.footer,a=t.inspectInfo,r=this.jSPlugin.id;if(this.isNeedRenderInspectInfo=b.findIndex(a.btnList,(function(A){return A.isrender>0}))>=0,this.isNeedRenderHeader=b.findIndex(i.btnList,(function(A){return A.isrender>0}))>=0,this.isNeedRenderFooter=b.findIndex(n.btnList,(function(A){return A.isrender>0}))>=0,this.isNeedRenderInspectInfo)if(document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")))document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).innerHTML="
    ");else{var o=document.createElement("div");o.setAttribute("id","".concat(this.jSPlugin.id,"-inspectInfoControl")),o.setAttribute("class","inspectInfo-controls"),o.innerHTML="
    ");var s={height:"58px",display:"flex","justify-content":"space-between",top:0,"z-index":999,color:"#000000",width:"".concat(this.jSPlugin.width+290,"px"),position:"relative","align-items":"center",background:"#ffffff","border-bottom":"1px solid #D9D9D9","box-sizing":"border-box"};o.style=Ie(s),document.getElementById("".concat(r,"-wrap")).insertBefore(o,document.getElementById(this.jSPlugin.id));var g=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(g)}),50)}else document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl"))&&document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")));if(this.isNeedRenderHeader)if(document.getElementById("".concat(this.jSPlugin.id,"-headControl")))document.getElementById("".concat(this.jSPlugin.id,"-headControl")).innerHTML="
    ");else{var c=document.createElement("div");c.setAttribute("id","".concat(this.jSPlugin.id,"-headControl")),c.setAttribute("class","header-controls"),c.innerHTML="
    ");var l={height:"56px",display:"flex","justify-content":"space-between",top:0,"z-index":999,color:"#FFFFFF",width:this.jSPlugin.width+"px",padding:"0 16px","box-sizing":"border-box",position:"relative","align-items":"center",background:"#000000"};c.style=Ie(l),document.getElementById("".concat(r,"-wrap")).insertBefore(c,document.getElementById(r));var I=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(I)}),50)}else document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&document.getElementById("".concat(this.jSPlugin.id,"-headControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-headControl")));if(this.isNeedRenderFooter)if(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")))document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop="-".concat("56px","px"));else{var C=document.createElement("div");C.setAttribute("id","".concat(this.jSPlugin.id,"-ez-iframe-footer-container")),C.setAttribute("class","ez-iframe-footer-container");var d={position:"relative",display:"flex",height:"56px","flex-wrap":"wrap","justify-content":"center","z-index":999,top:0,color:"#FFFFFF",width:this.jSPlugin.width+"px","align-items":"center","background-color":"#000000","font-size":"14px"};C.style=Ie(d),C.innerHTML='\n
    \n
    \n
    \n "),E(C,document.getElementById(r))}else document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")));this.isNeedRenderInspectInfo&&document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).style.background=a.backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).style.color=a.color,a.btnList.map((function(e,t){e.isrender&&A.renderInspectInfo(e.iconId,e)}))),this.isNeedRenderHeader&&document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.background=i.backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=i.color,i.btnList.map((function(e,t){e.isrender&&A.renderHeader(e.iconId,e)}))),this.isNeedRenderFooter&&document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=n.backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=n.color,n.btnList.map((function(e,t){e.isrender&&A.renderFooter(e.iconId,e)}))),this.inspectMapWin=new zA(this.jSPlugin),this.inspectSmallWin=new ce(this.jSPlugin,this.inspectMode,this.inspectMapWin,this.changeInspectMode,this.decoderState)}},{key:"renderThemeData",value:function(){var A=this,e=this.decoderState.state.isEditing,t=this.themeData,i=t.inspectInfo,n=t.header,a=t.footer;if(this.isNeedRenderInspectInfo&&i&&(document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).style.background=i.backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).style.color=i.color.replace("-diy",""),i.btnList.map((function(e,t){e.isrender&&A.setDecoderState(s({},e.iconId,A.decoderState.state[e.iconId]))}))),this.isNeedRenderHeader&&n&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.background=n.backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=n.color.replace("-diy",""),n.btnList&&n.btnList.map((function(e,t){e.isrender&&A.setDecoderState(s({},e.iconId,A.decoderState.state[e.iconId]))}))),this.isNeedRenderFooter&&a)document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=a.backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=a.color.replace("-diy",""),a.btnList.map((function(t,i){if(t.isrender&&A.setDecoderState(s({},t.iconId,A.decoderState.state[t.iconId])),0==i&&!A.themeInited&&A.activeThemeStatus)var n=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(n),1!=A.themeData.customConfig.bellPoster||e?A.jSPlugin.play():A.jSPlugin.pluginStatus.loadingClear(),A.themeInited=!0)}),50)})),this.setDecoderState({cloudRec:"cloud.rec"===p(this.jSPlugin.url).type,rec:"rec"===p(this.jSPlugin.url).type,type:p(this.jSPlugin.url).type});else if(!this.themeInited&&this.activeThemeStatus)var r=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(r),A.themeData&&A.themeData.customConfig&&1==A.themeData.customConfig.bellPoster&&!e?A.jSPlugin.pluginStatus.loadingClear():A.jSPlugin.play(),A.themeInited=!0)}),50);var o=setInterval((function(){window.EZUIKit[A.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(o),A.reSizeVideo(A.videoWidth,A.videoHeight))}),50);this.jSPlugin.Zoom||(this.jSPlugin.Zoom=new mA(this.jSPlugin)),this.getInspectDevInfo(this.jSPlugin,!0,!1)}},{key:"getInspectRecord",value:function(){var A=this;!function(A,e,t){var i={accessToken:A.accessToken,deviceSerial:p(A.url).deviceSerial},n="".concat(A.env.domain,"/api/service/devicekit/bodycamera/inspect/detail/latest");yA(n,"GET",i,(function(A){e&&e(A)}),(function(A){t&&t(A)}),{"Content-Type":"application/x-www-form-urlencoded"})}(this.jSPlugin,(function(e){if(200==e.meta.code&&e.data){var t=e.data;t.inspectRange&&A.inspectMapWin.createPolygon(t.inspectRange,"#407AFF","dashed",4,1,"#407AFF",.08),t.inspectPoints&&t.inspectPoints.length>0&&A.inspectMapWin.createInspectPoints(t.inspectPoints),"video"===A.inspectMode&&A.inspectMapWin.map.removeOverlay(A.inspectMapWin.inspectRange),document.getElementById("".concat(A.jSPlugin.id,"-inspectInfo-inspectName"))&&t.inspectName&&(document.getElementById("".concat(A.jSPlugin.id,"-inspectInfo-inspectName")).innerText=""+t.inspectName),document.getElementById("".concat(A.jSPlugin.id,"-inspectInfo-inspectBeginTime"))&&t.beginTime&&(document.getElementById("".concat(A.jSPlugin.id,"-inspectInfo-inspectBeginTime")).innerText="巡检开始时间:"+t.beginTime),document.getElementById("".concat(A.jSPlugin.id,"-header-inspectTime"))&&A.timer.createInterval("InspectTimer",(function(){document.getElementById("".concat(A.jSPlugin.id,"-header-inspectTime")).innerHTML=A.renderInspectTime(t.beginTime)}),1e3),document.getElementById("".concat(A.jSPlugin.id,"-inspectInfo-inspectPerson"))&&t.inspectPerson&&(document.getElementById("".concat(A.jSPlugin.id,"-inspectInfo-inspectPerson")).innerText="本地巡检员:"+t.inspectPerson),A.inspectInfo=t,t.inspectRecordId&&ae(A.jSPlugin,t.inspectRecordId,(function(e){200==e.meta.code&&e.data&&(A.inspectMapWin.createTrack(e.data,!0),A.timer.createInterval("TraceTimer",(function(){t.inspectRecordId&&ae(A.jSPlugin,t.inspectRecordId,(function(e){200==e.meta.code&&e.data&&A.inspectMapWin.createTrack(e.data,!1)}),(function(){}))}),5e3))}),(function(){})),A.InspectEvent=new ge(A.jSPlugin,t.inspectRecordId,A.timer)}}),(function(A){}))}},{key:"getInspectDevInfo",value:function(A){var e=this,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];!function(A,e,t){var i={accessToken:A.accessToken,deviceSerial:p(A.url).deviceSerial},n="".concat(A.env.domain,"/api/service/devicekit/bodycamera");yA(n,"GET",i,(function(A){e&&e(A)}),(function(A){t&&t(A)}),{"Content-Type":"application/x-www-form-urlencoded"})}(A,(function(n){n.meta&&200==n.meta.code&&n.data?1===n.data.status?(i&&!e.decoderState.state.play&&(e.jSPlugin.pluginStatus.loadingStart(e.jSPlugin.id),e.jSPlugin.pluginStatus.loadingSetText({text:"视频加载中"}),e.jSPlugin.play()),e.globalContainer.globalContainerToggle("".concat(e.jSPlugin.id,"-inspect-global-box"),!1),document.getElementById("".concat(e.jSPlugin.id,"-header-deviceName"))&&(document.getElementById("".concat(e.jSPlugin.id,"-header-deviceName")).innerText="".concat(n.data.deviceName,"(").concat(n.data.deviceSerial,")"),document.getElementById("".concat(e.jSPlugin.id,"-header-deviceName")).setAttribute("title","".concat(n.data.deviceName,"(").concat(n.data.deviceSerial,")"))),document.getElementById("".concat(e.jSPlugin.id,"-header-signalType"))&&(document.getElementById("".concat(e.jSPlugin.id,"-header-signalType")).innerHTML=e.renderSignalType(n.data.signalType)),document.getElementById("".concat(e.jSPlugin.id,"-header-batteryStatus"))&&(document.getElementById("".concat(e.jSPlugin.id,"-header-batteryStatus")).innerHTML=e.renderBatteryStatus(n.data.batteryStatus)),e.timer.createInterval("InspectDevInfoTimer",(function(){e.getInspectDevInfo(A,!1,!1)}),3e5),t&&e.getInspectRecord()):(e.globalContainer.globalContainerToggle("".concat(e.jSPlugin.id,"-inspect-loading-box"),!1),e.jSPlugin.stop(),e.globalContainer.deviceErrorInfo({tips:"当前设备未在巡检中",refreshBtn:"刷新",refreshShow:!0},(function(){e.globalContainer.globalContainerToggle("".concat(e.jSPlugin.id,"-no-inspect-box"),!1),e.globalContainer.globalContainerToggle("".concat(e.jSPlugin.id,"-inspect-loading-box"),!0),e.getInspectDevInfo(A,!0,!0)}))):(e.globalContainer.globalContainerToggle("".concat(e.jSPlugin.id,"-inspect-loading-box"),!1),e.jSPlugin.stop(),e.globalContainer.deviceErrorInfo({tips:n.meta.message,refreshShow:!1}))}),(function(){e.globalContainer.globalContainerToggle("".concat(e.jSPlugin.id,"-inspect-global-box"),!1)}))}},{key:"fetchThemeData",value:function(A){var e=this;wA(this.jSPlugin,A,(function(A){if(0!==A.meta.code||!A.data)return e.activeThemeStatus=!1,e.jSPlugin.pluginStatus.loadingClear(),"111021"==A.meta.code?(e.globalContainer.globalContainerToggle("".concat(e.jSPlugin.id,"-inspect-loading-box"),!1),e.jSPlugin.stop(),e.globalContainer.deviceErrorInfo({tips:"无效的模板id",refreshBtn:"刷新",refreshShow:!1}),void(e.activeThemeStatusTxt="无效的模板id")):"111023"==A.meta.code?(e.globalContainer.globalContainerToggle("".concat(e.jSPlugin.id,"-inspect-loading-box"),!1),e.jSPlugin.stop(),e.globalContainer.deviceErrorInfo({tips:"您的试用特权已到期,需前往轻应用控制台购买后使用。",refreshBtn:"刷新",refreshShow:!1}),void(e.activeThemeStatusTxt="试用特权已到期")):(e.globalContainer.globalContainerToggle("".concat(e.jSPlugin.id,"-inspect-loading-box"),!1),e.jSPlugin.stop(),e.globalContainer.deviceErrorInfo({tips:"模板未激活,请先在开放平台轻应用控制台购买模板",refreshBtn:"刷新",refreshShow:!1}),void(e.activeThemeStatusTxt="模板未激活"));e.activeThemeStatus=!0,e.themeData=A.data,e.jSPlugin.capacity?(e.initThemeData(),e.renderThemeData()):setTimeout((function(){e.initThemeData(),e.renderThemeData()}),300)}),(function(){e.themeData=le,e.themeData.header&&(e.themeData.header.btnList=e.themeData.header.btnList.sort((function(A,e){return A.btnKey.split("-")[3]-e.btnKey.split("-")[3]}))),e.themeData.footer&&(e.themeData.footer.btnList=e.themeData.footer.btnList.sort((function(A,e){return A.btnKey.split("-")[3]-e.btnKey.split("-")[3]}))),e.initThemeData(),e.renderThemeData()}))}},{key:"reSizeVideo",value:function(A,e){if(document.getElementById("".concat(this.jSPlugin.id)).style.width=A+"px",document.getElementById("".concat(this.jSPlugin.id)).style.height=e+"px",this.jSPlugin&&this.jSPlugin.bPlay)this.jSPlugin.JS_Resize(A,e);else{document.getElementById("".concat(this.jSPlugin.id,"-player"))&&(document.getElementById("".concat(this.jSPlugin.id,"-player")).width=A,document.getElementById("".concat(this.jSPlugin.id,"-player")).height=e,document.getElementById("".concat(this.jSPlugin.id,"-player")).style.width=A+"px",document.getElementById("".concat(this.jSPlugin.id,"-player")).style.height=e+"px",document.getElementById("".concat(this.jSPlugin.id,"-container-0")).style.height=e+"px");var t=1;if(document.getElementById("".concat(this.jSPlugin.id,"canvas0")))navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)&&(t=2),document.getElementById("".concat(this.jSPlugin.id,"canvas0")).style.width=A*t+"px",document.getElementById("".concat(this.jSPlugin.id,"canvas0")).style.height=e*t+"px",document.getElementById("".concat(this.jSPlugin.id,"canvas0")).width=A*t,document.getElementById("".concat(this.jSPlugin.id,"canvas0")).height=e*t,document.getElementById("".concat(this.jSPlugin.id,"canvas0")).parentNode.style.width=A*t+"px",document.getElementById("".concat(this.jSPlugin.id,"canvas0")).parentNode.style.height=e*t+"px",document.getElementById("".concat(this.jSPlugin.id,"canvas_draw0")).height=e*t}}},{key:"reSize",value:function(A,e){var t=.3333*A,i=.3333*e;document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).style.width=A+this.jSPlugin.inspectVideoWidth+"px"),document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.width=A+"px"),document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.width=A+"px"),"video"===this.jSPlugin.Theme.inspectMode?(this.reSizeVideo(A,e),document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.top=0),document.getElementById("".concat(this.jSPlugin.id,"-mapbox")).style.width=t+"px",document.getElementById("".concat(this.jSPlugin.id,"-mapbox")).style.height=i+"px"):(document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.top=e+"px"),this.reSizeVideo(t,i),document.getElementById("".concat(this.jSPlugin.id,"-mapbox")).style.width=A+"px",document.getElementById("".concat(this.jSPlugin.id,"-mapbox")).style.height=e+"px"),document.getElementById("".concat(this.jSPlugin.id,"-miniToggle")).style.bottom=i/2+96-30+"px",document.getElementById("".concat(this.jSPlugin.id,"-miniToggle")).style.right=this.jSPlugin.inspectVideoWidth+t+"px"}}])}(),he=function(){return o((function A(e){var t=this;if(a(this,A),s(this,"changeInspectMode",(function(A){t.inspectMode=A})),this.jSPlugin=e,this.videoWidth=e.width,this.videoHeight=e.height,this.inspectMode="video",this.autoFocus=0,this.decoderState={state:{isEditing:!1,play:!1,sound:!1,recordvideo:!1,recordCount:"00:00",talk:!1,mute:!1,rejection:!1,cloudRec:"cloud.rec"===p(e.url).type,rec:"rec"===p(e.url).type,type:p(e.url).type}},this.isMobile=navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i),void 0!==e.isMobile&&(this.isMobile=e.isMobile),this.themeData=le,"themeData"==this.jSPlugin.themeId&&(this.themeData=this.jSPlugin.params.themeData),this.timer||(this.timer=new XA(e)),this.jSPlugin.themeId)if(this.isMobile||(this.inspect=new de(this.jSPlugin,this.themeData,this.setDecoderState,this.decoderState,this.inspectMode,this.changeInspectMode,this.timer)),"themeData"===this.jSPlugin.themeId)this.themeData=this.jSPlugin.params.themeData,this.inspect.initThemeData(),this.inspect.renderThemeData();else this.inspect.fetchThemeData(this.jSPlugin.themeId);this.jSPlugin.Talk||(this.jSPlugin.Talk=new lA(this.jSPlugin)),h("".concat(this.jSPlugin.staticPath,"/css/theme.css")),h("".concat(this.jSPlugin.staticPath,"/css/component.css")),h("".concat(this.jSPlugin.staticPath,"/css/inspectTheme.css"))}),[{key:"setDecoderState",value:function(A,e){var t=this,i="#FFFFFF",n="#1890FF";Object.keys(A).map((function(e){switch(e){case"talk":document.getElementById("".concat(t.jSPlugin.id,"-talk"))&&(document.getElementById("".concat(t.jSPlugin.id,"-talk")).className=A[e]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-talk-content")).childNodes[1].style.fill=A[e]?n:i,document.getElementById("".concat(t.jSPlugin.id,"-talk-content")).childNodes[2].style.color=A[e]?n:i);break;case"sound":document.getElementById("".concat(t.jSPlugin.id,"-sound"))&&(A[e]?(document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).children[0].children[1].style="display:inline-block",document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).children[0].children[0].style="display:none",document.getElementById("".concat(t.jSPlugin.id,"-sound")).className=A[e]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).childNodes[0].children[1].style.fill=A[e]?n:i,document.getElementById("".concat(t.jSPlugin.id,"-sound-label")).style.color=A[e]?n:i):(document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).children[0].children[0].style="display:inline-block",document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).children[0].children[1].style="display:none",document.getElementById("".concat(t.jSPlugin.id,"-sound")).className=A[e]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-sound-label")).style.color=A[e]?n:i))}t.decoderState.state=Object.assign(t.decoderState.state,A)}))}},{key:"setDisabled",value:function(A){var e=this.decoderState.state,t=e.sound;e.hd,null!=document.getElementById("".concat(this.jSPlugin.id,t?"-sound-icon":"-nosound-icon"))&&document.getElementById("".concat(this.jSPlugin.id,t?"-sound-icon":"-nosound-icon")).setAttribute("style",A?"cursor: not-allowed;fill: gray":"cursor: default"),null!=document.getElementById("".concat(this.jSPlugin.id,"-sound-label"))&&document.getElementById("".concat(this.jSPlugin.id,"-sound-label")).setAttribute("style",A?"cursor: not-allowed; color: gray":"cursor: default"),null!=document.getElementById("".concat(this.jSPlugin.id,"-talk-icon"))&&document.getElementById("".concat(this.jSPlugin.id,"-talk-icon")).setAttribute("style",A?"cursor: not-allowed;fill: gray":"cursor: default"),null!=document.getElementById("".concat(this.jSPlugin.id,"-talk-label"))&&document.getElementById("".concat(this.jSPlugin.id,"-talk-label")).setAttribute("style",A?"cursor: not-allowed; color: gray":"cursor: default")}},{key:"inspectEnding",value:function(){var A=document.createElement("div");A.id="".concat(this.jSPlugin.id,"-inspect-ending-box"),A.style="width:100%; position: absolute; z-index: 10000; top:58px; bottom:0; left:0; background: #ffffff;",A.innerHTML='
    \n
    \n
    \n \n
    \n
    巡检已结束
    \n
    \n
    \n ',document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(A),this.jSPlugin.Zoom&&this.jSPlugin.Zoom.stopZoom()}}])}(),Be=function(){return o((function A(){a(this,A),this.events={}}),[{key:"on",value:function(A,e){A&&e&&(this.events[A]=this.events[A]||[],this.events[A].push(e))}},{key:"emit",value:function(A,e){A&&this.events[A]&&this.events[A].forEach((function(A){return A(e)}))}},{key:"off",value:function(A,e){A&&e&&this.events[A]&&this.events[A].splice(this.events[A].indexOf(e),1)}},{key:"once",value:function(A,e){var t=this;this.on(A,(function i(){var n=Array.prototype.slice.call(arguments);e.apply(null,n),t.off(A,i)}))}},{key:"removeAllListener",value:function(){this.events={}}}])}();!function(A,e){"object"===("undefined"==typeof module?"undefined":n(module))&&"object"===n(module.exports)?module.exports=A.document?e(A,!0):function(A){if(!A.document)throw new Error("EZUIPlayer requires a window with a document");return e(A)}:e(A)}("undefined"!=typeof window?window:void 0,(function(A,e){function t(A,e){for(var t=document.getElementsByTagName("head")[0].getElementsByTagName("script"),i=!1,n=0;n0&&(A+="&controls="+e.controls.join(","))),e.websocketParams&&(A+="&websocketParams="+JSON.stringify(e.websocketParams)),A;case"standard":return r+"/ezopen/h5/iframe?bSupporDoubleClickFull=0&url="+s.opt.url.replace("?","&")+"&autoplay="+s.opt.autoplay+"&audio="+s.opt.audio+"&accessToken="+e.accessToken+"&templete=1&id="+g+"&decoderVersion="+s.opt.decoderVersion;case"security":return r+"/ezopen/h5/iframe_se?bSupporDoubleClickFull=0&url="+s.opt.url.replace("?","&")+"&autoplay="+s.opt.autoplay+"&audio="+s.opt.audio+"&accessToken="+e.accessToken+"&templete=0&id="+g+"&decoderVersion="+s.opt.decoderVersion;case"theme":return A=r+"/jssdk/theme.html?url=".concat(e.url,"&accessToken=").concat(e.accessToken,"&id=").concat(g,"&isMobile=").concat(e.isMobile),void 0!==e.isMobile&&(A+="&isMobile="+e.isMobile),void 0!==e.autoplay&&(A+="&autoplay="+e.autoplay),void 0!==e.domain&&"https://test12open.ys7.com"==e.domain&&(A+="&env=test12"),void 0!==e.env&&void 0!==e.env.domain&&"https://test12open.ys7.com"==e.env.domain&&(A+="&env=test12"),void 0!==e.header&&(A+="&header="+e.header),A;default:return r+"/ezopen/h5/iframe?bSupporDoubleClickFull=0&url="+s.opt.url.replace("?","&")+"&autoplay="+s.opt.autoplay+"&audio="+s.opt.audio+"&accessToken="+e.accessToken+"&templete=0&id="+g+"&decoderVersion="+s.opt.decoderVersion}}();var I=document.getElementById(g).offsetHeight,C=document.getElementById(g).offsetWidth;e.height&&(I=parseInt(e.height),/\%$/.test(e.height)&&(C=document.getElementById(g).offsetWidth*(parseInt(e.height)/100))),e.width&&(C=parseInt(e.width),/\%$/.test(e.width)&&(C=document.getElementById(g).offsetWidth*(parseInt(e.width)/100))),l.width=C,l.height=I,l.id="EZUIKitPlayer-"+g,l.setAttribute("allowfullscreen",!0),l.setAttribute("allow","autoplay"),l.setAttribute("frameborder",0),c.appendChild(l);var d=s.opt.filePath+"/js/jquery.js";t(d,(function(){t("https://open.ys7.com/assets/layer/layer.js",(function(){if(u().headerContainer){var n=document.createElement("div");n.setAttribute("class","panel-top");var o=document.createElement("div");if(o.setAttribute("class","contros"),n.appendChild(o),c.insertBefore(n,l),u().capturePictureModule){var g=document.createElement("span");g.innerHTML=' ',g.onclick=function(){s.capturePicture()},o.appendChild(g)}if(console.log("matchHeaderOpt().saveModule",u().saveModule),u().saveModule){var I=document.createElement("span");I.innerHTML=' ',I.onclick=function(){s.startSave(),document.getElementById("startSave").setAttribute("class","icon hide"),document.getElementById("stopSave").setAttribute("class","icon")},o.appendChild(I);var C=document.createElement("span");C.innerHTML=' ',C.onclick=function(){s.stopSave(),document.getElementById("stopSave").setAttribute("class","icon hide"),document.getElementById("startSave").setAttribute("class","icon")},o.appendChild(C)}if(u().zoomModule){var d=document.createElement("span");d.innerHTML=' ',d.onclick=function(){s.enableZoom(),document.getElementById("enableZoom").setAttribute("class","icon hide"),document.getElementById("closeZoom").setAttribute("class","icon")},o.appendChild(d);var h=document.createElement("span");h.innerHTML=' ',h.onclick=function(){s.closeZoom(),document.getElementById("closeZoom").setAttribute("class","icon hide"),document.getElementById("enableZoom").setAttribute("class","icon")},o.appendChild(h)}}function B(){var A={footerContainer:!1,talkModule:!1,broadcastModule:!1,hdModule:!1,fullScreenModule:!1};switch(s.opt.template){case"simple":case"standard":var t;if(e.footer&&e.footer instanceof Array)A={footerContainer:!0,talkModule:-1!==(t=e.footer).indexOf("talk"),broadcastModule:-1!==t.indexOf("broadcast"),hdModule:-1!==t.indexOf("hd"),fullScreenModule:-1!==t.indexOf("fullScreen")};break;case"security":break;case"voice":A={footerContainer:!0,talkModule:!0,broadcastModule:!0,hdModule:!0,fullScreenModule:!0}}return A}function u(){var A={headerContainer:!1,capturePictureModule:!1,saveModule:!1,zoomModule:!1};switch(s.opt.template){case"simple":if(e.header&&e.header instanceof Array){var t=e.header;A={headerContainer:!0,capturePictureModule:-1!==t.indexOf("capturePicture"),saveModule:-1!==t.indexOf("save"),zoomModule:-1!==t.indexOf("zoom")}}break;case"standard":case"security":break;case"voice":A={headerContainer:!0,capturePictureModule:!0,saveModule:!0,zoomModule:!0}}return A}if(B().footerContainer||-1!==s.opt.plugin.indexOf("talk")){var E=s.opt.filePath+"/npm/css/recoder.css",f=s.opt.filePath+"/npm/js/recoder.js",Q=s.opt.filePath+"/recorder.js";if(function(A,e){for(var t=document.getElementsByTagName("head")[0].getElementsByTagName("link"),i=!1,n=0;n0?(t--,document.getElementById("time-area").innerHTML=i(t)):(clearInterval(a.state.countTimer),a.state.countTimer=void 0,console.log("倒计时结束,开启声音"))}),1e3)}else"destory"===A&&(clearInterval(a.state.countTimer),a.state.countTimer=void 0,document.getElementById("time-area").innerHTML="00:00");function i(A){var e,t,i,n=parseInt(A),a=0,r=0;return n>59&&(a=parseInt(n/60),n=parseInt(n%60),a>59&&(r=parseInt(a/60),a=parseInt(a%60))),e=parseInt(n)>9?parseInt(n):"0"+parseInt(n),t=parseInt(a)>9?parseInt(a):"0"+parseInt(a),i=parseInt(r)>9?parseInt(r):"0"+parseInt(r),r>0?i+":"+t+":"+e:a>0?t+":"+e:"00:"+e}},p=document.createElement("div");if(p.setAttribute("class","audio-controls"),c.appendChild(p),B().hdModule||B().fullScreenModule){var m=document.createElement("div");if(m.setAttribute("class","contros"),p.appendChild(m),B().hdModule){var y=document.createElement("span");y.setAttribute("id","video-hd"),y.innerHTML=-1===s.opt.url.indexOf(".hd")?"标清":"高清",y.onclick=function(){if(s.opt.videoLoading)return layer.msg("视频加载中,请稍后"),!1;var A=s.stop();s.opt.videoLoading=!0,A.then((function(A){s.opt.videoLoading=!1,-1===s.opt.url.indexOf(".hd")?(s.opt.url=s.opt.url.replace(".live",".hd.live"),y.innerHTML=-1===s.opt.url.indexOf(".hd")?"标清":"高清"):(s.opt.url=s.opt.url.replace(".hd.live",".live"),y.innerHTML=-1===s.opt.url.indexOf(".hd")?"标清":"高清"),s.play(s.opt.url)})).catch((function(A){console.log("error",A)}))},m.appendChild(y)}if(B().fullScreenModule){var _=document.createElement("span");_.setAttribute("class","hide"),_.setAttribute("id","ezuikit-open-sound"),_.setAttribute("title","打开声音"),_.setAttribute("style","vertical-align: top;"),_.innerHTML='',_.onclick=function(){s.openSound(0),_.setAttribute("class","hide"),S.setAttribute("class","")};var S=document.createElement("span");_.setAttribute("id","ezuikit-close-sound"),S.setAttribute("class","hide"),S.setAttribute("title","关闭声音"),S.setAttribute("style","vertical-align: top;"),S.innerHTML='',S.onclick=function(){s.closeSound(0),_.setAttribute("class",""),S.setAttribute("class","hide")},m.appendChild(_),m.appendChild(S)}if(1==s.opt.audio?S.setAttribute("class",""):(_.setAttribute("class",""),s.closeSound(0)),B().fullScreenModule){var D=document.createElement("span");D.setAttribute("title","全屏"),D.setAttribute("style","vertical-align: top;"),D.innerHTML=' ',D.onclick=function(){s.fullScreen()},m.appendChild(D)}}if(B().talkModule){var w=document.createElement("div"),v=document.createElement("div");w.setAttribute("class","ptp-talk off"),w.innerHTML=' 开启对讲',w.onclick=function(){if(console.log("EZUIKit.state.countTimer",a.state.countTimer),a.state.countTimer)return A.layer.msg("语音设备正忙,请稍后重试"),!1;x("add",0),console.log("开始对讲,关闭声音"),s.closeSound(0),console.log(s.opt),s.startTalk(),this.setAttribute("class","ptp-talk off hide"),v.setAttribute("class","ptp-talk on")},v.setAttribute("class","ptp-talk on hide"),v.innerHTML=' 关闭对讲',v.onclick=function(){console.log(s.opt),s.stopTalk(),x("destory",0),s.openSound(0),this.setAttribute("class","ptp-talk on hide"),w.setAttribute("class","ptp-talk off")},p.appendChild(w),p.appendChild(v)}if(B().broadcastModule){var F=function A(e){i(r+"/api/lapp/voice/query","POST",{accessToken:s.opt.accessToken,pageStart:e,pageSize:a.state.pageSize,default:a.state.fetchDefaultList?"true":"false"},0,(function(t){console.log("data",t),200==t.code&&(b(t.data,5),a.state.page=t.page.page,0!=e||0!=t.data.length||a.state.fetchDefaultList||(a.state.fetchDefaultList=!0,A(0)))}))},b=function(A){if(console.log("renderVoliceList",A),A&&A.length>0){for(var e=0;e"+(A[e].voiceName.length>10?A[e].voiceName.substr(0,10)+"...":A[e].voiceName)+"",document.getElementsByClassName("voice-list-ul")[0].append(t),t.onclick=function(A){console.log("点击元素",A.target,A.target.dataset.url);var e=A.target.dataset.url,t=A.target.dataset.time;R(e,t)}}A.length===a.state.pageSize?document.getElementById("voice-list-end").innerHTML="向下滚动加载更多":document.getElementById("voice-list-end").innerHTML="没有更多数据了"}},R=function(e,t){console.log("播放语音",e,t),i(r+"/api/lapp/voice/send","POST",{accessToken:s.opt.accessToken,deviceSerial:s.opt.deviceSerial,channelNo:s.opt.channelNo,fileUrl:e},0,(function(e){console.log("data.data",e.data),200==e.code?x("sub",parseInt(t)):"10001"==e.code?A.layer.msg("未找到当前语音"):A.layer.msg(e.msg||"发送失败,请稍后再试")}))},k=document.createElement("div"),P=document.createElement("div");k.setAttribute("class","broadcast off"),P.setAttribute("class","broadcast on hide"),k.innerHTML=' 语音播报',k.onclick=function(){this.setAttribute("class","broadcast off hide"),P.setAttribute("class","broadcast on")},P.innerHTML='
    自定义语音
    语音播报',P.onclick=function(){this.setAttribute("class","broadcast on hide"),k.setAttribute("class","broadcast off")},p.appendChild(k),p.appendChild(P),document.getElementById("voice-custom").onclick=function(){console.log("显示自定义语音"),N.setAttribute("class","speak off")},F(0);var N=document.createElement("div"),M=document.createElement("div");N.setAttribute("class","speak off hide"),M.setAttribute("class","speak on hide"),N.setAttribute("id","startSpeak"),M.setAttribute("id","stopSpeak"),N.innerHTML=' 按住说话',M.innerHTML=' 松开发送',p.appendChild(N),p.appendChild(M),document.getElementById("voice-list").onscroll=function(A){var e=this.scrollHeight;console.log("sum",e,this.scrollTop,document.getElementById("voice-list").clientHeight),e<=this.scrollTop+this.clientHeight&&(console.log("拖动到底,执行加载",a.state.page),F(++a.state.page))};var T,L=document.createElement("div");L.setAttribute("class","time-area"),L.setAttribute("id","time-area"),L.innerHTML="00:00",p.appendChild(L),document.getElementById("startSpeak").onmousedown=function(){if(a.state.countTimer)return A.layer.msg("语音设备正忙,请稍后重试"),!1;var e;function t(t){var i=e.createMediaStreamSource(t);T=new A.Recorder(i)}console.log("按住说话"),N.setAttribute("class","speak off hide"),M.setAttribute("class","speak on"),function(){console.log("run init");try{A.AudioContext=A.AudioContext||A.webkitAudioContext,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia,A.URL=A.URL||A.webkitURL,e=new AudioContext,console.log("Audio context set up."),console.log("navigator.getUserMedia "+(navigator.getUserMedia?"available.":"not present!"))}catch(e){console.log("err",e),A.layer.msg("No web audio support in this browser!")}navigator.getUserMedia({audio:!0},t,(function(A){console.log("No live audio input: "+A)}))}(),x("add",0),setTimeout((function(){a.state.recodeTime=0,T&&T.record()}),1e3),a.state.recodeTimer&&clearInterval(a.state.recodeTimer),a.state.recodeTimer=setInterval((function(){a.state.recodeTime>=59?(s.stopTalk(),x("destory",0),this.setAttribute("class","ptp-talk on hide"),w.setAttribute("class","ptp-talk off"),A.layer.msg("不超过1分钟")):a.state.recodeTime=a.state.recodeTime+1}),1e3)},document.getElementById("stopSpeak").onmouseup=function(){console.log("松开发送"),M.setAttribute("class","speak on hide"),function(){if(x("destory",0),a.state.recodeTime<1)return A.layer.msg("说话时间过短"),clearInterval(a.state.recodeTimer),!1;clearInterval(a.state.recodeTimer),function(){try{T&&T.stop(),T&&T.exportWAV((function(e){if(console.log("wav_file",e),e.size<1e3)return A.layer.msg("录音失败,请重试"),a.state.recodeTime=0,!1;x("sub",a.state.recodeTime+2);var t=new FormData;function n(e){console.log("data.data",e.data),200==e.code?x("sub",a.state.recodeTime+2):"10001"==e.code?A.layer.msg("未找到当前语音"):A.layer.msg(e.msg||"发送失败,请稍后再试")}t.append("voiceFile",e),t.append("accessToken",s.opt.accessToken),t.append("deviceSerial",s.opt.deviceSerial),t.append("channelNo",s.opt.channelNo),i(r+"/api/lapp/voice/sendonce","POST",{voiceFile:e,accessToken:s.opt.accessToken,deviceSerial:s.opt.deviceSerial,channelNo:s.opt.channelNo},0,n)})),T&&T.clear()}catch(A){console.log(A)}}()}()}}}}}))}));s=this;function h(A){s.opt.fullScreenStatus=A?1:0,e.fullScreenChangeCallBack&&e.fullScreenChangeCallBack({data:A,id:s.opt.id})}A.addEventListener("message",(function(t){t.origin;var i=s.opt.id;if(t.data.type)switch(t.data.type){case"openSound":i==t.data.id&&e.openSoundCallBack&&e.openSoundCallBack(t.data);break;case"closeSound":i==t.data.id&&e.closeSoundCallBack&&e.closeSoundCallBack(t.data);break;case"capturePicture":i==t.data.id&&e.capturePictureCallBack&&e.capturePictureCallBack(t.data);break;case"startSave":i==t.data.id&&e.startSaveCallBack&&e.startSaveCallBack(t.data);break;case"stopSave":i==t.data.id&&e.stopSaveCallBack&&e.stopSaveCallBack(t.data);break;case"fullScreen":i==t.data.id&&e.fullScreenCallBack&&e.fullScreenCallBack(t.data);break;case"getOSDTime":i==t.data.id&&e.getOSDTimeCallBack&&e.getOSDTimeCallBack(t.data);break;case"handleSuccess":i==t.data.id&&e.handleSuccess&&e.handleSuccess(t.data);break;case"handleError":i==t.data.id&&e.handleError&&e.handleError(t.data);break;case"dblclick":i==t.data.id&&s.opt.bSupporDoubleClickFull&&(0===s.opt.fullScreenStatus?s.fullScreen():s.cancelFullScreen());break;case"startTalk":s.startTalk(),s.closeSound();break;case"stopTalk":s.stopTalk(),s.openSound();break;case"clickEventHandle":console.log("event.data",t.data),e.clickEventHandle&&e.clickEventHandle(t.data);break;case"removeEventHandle":e.removeEventHandle&&e.removeEventHandle(t.data);break;case"esc":e.clickEventHandle&&e.clickEventHandle(t.data);break;case"iframeFullScreen":if(i==t.data.id){!function(e){var t=e.requestFullScreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullScreen;if(t)t.call(e);else if(void 0!==A.ActiveXObject){var i=new ActiveXObject("WScript.Shell");null!==i&&i.SendKeys("{F11}")}}(document.getElementById("EZUIKitPlayer-"+t.data.id))}}})),void 0!==document.fullScreen?document.addEventListener("fullscreenchange",(function(){h(document.fullscreen||!1)})):void 0!==document.webkitIsFullScreen?document.addEventListener("webkitfullscreenchange",(function(){h(document.webkitIsFullScreen||!1)})):void 0!==document.mozFullScreen&&document.addEventListener("mozfullscreenchange",(function(){h(document.mozFullScreen||!1)}))};return g.prototype.play=function(e){var t="EZUIKitPlayer-"+this.opt.id,i=document.getElementById(t).contentWindow;"object"===n(e)&&e.url&&(this.opt.url=e.url),"object"===n(e)&&e.accessToken&&(this.opt.accessToken=e.accessToken),"string"==typeof e&&(this.opt.url=e),i.postMessage({action:"play",accessToken:this.opt.accessToken,url:this.opt.url},r+"/ezopen/h5/iframe");var a=this;return this.opt.videoLoading=!0,new Promise((function(e,t){A.addEventListener("message",(function(A){a.opt.id==A.data.id&&"handleSuccess"===A.data.type&&(setTimeout((function(){a.opt.videoLoading=!1}),1e3),e(A.data))}))}))},g.prototype.stop=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("stop",r+"/ezopen/h5/iframe");var t=this;return new Promise((function(e,i){A.addEventListener("message",(function(A){t.opt.id==A.data.id&&"stop"===A.data.type&&e(A.data)}))}))},g.prototype.openSound=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("openSound",r+"/ezopen/h5/iframe");var t=this;return new Promise((function(e,i){A.addEventListener("message",(function(A){t.opt.id==A.data.id&&"openSound"===A.data.type&&e(A.data)}))}))},g.prototype.closeSound=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("closeSound",r+"/ezopen/h5/iframe");var t=this;return new Promise((function(e,i){A.addEventListener("message",(function(A){t.opt.id==A.data.id&&"closeSound"===A.data.type&&e(A.data)}))}))},g.prototype.startSave=function(e){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage({action:"startSave",fileName:e||"default"},r+"/ezopen/h5/iframe");var i=this;return new Promise((function(e,t){A.addEventListener("message",(function(A){i.opt.id==A.data.id&&"startSave"===A.data.type&&e(A.data)}))}))},g.prototype.stopSave=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("stopSave",r+"/ezopen/h5/iframe");var t=this;return new Promise((function(e,i){A.addEventListener("message",(function(A){t.opt.id==A.data.id&&"stopSave"===A.data.type&&e(A.data)}))}))},g.prototype.fullScreen=function(){if(1===this.opt.fullScreenStatus)return!1;var e="EZUIKitPlayer-"+this.opt.id,t=document.getElementById(e).contentWindow;if(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)){var i=document.documentElement.clientWidth,n=document.documentElement.clientHeight,a=(document.body,"");a+="width:"+n+"px;",a+="height:"+i+"px;",a+="-webkit-transform: rotate(90deg); transform: rotate(90deg);",a+="-webkit-transform-origin: "+i/2+"px "+i/2+"px;",a+="transform-origin: "+i/2+"px "+i/2+"px;",a+="position: fixed;top: 0;left: 0;z-index:10",document.getElementById(e).style.cssText=a,setTimeout((function(){t.postMessage("autoResize",r+"/ezopen/h5/iframe")}),500)}else{!function(e){var t=e.requestFullScreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullScreen;if(t)t.call(e);else if(void 0!==A.ActiveXObject){var i=new ActiveXObject("WScript.Shell");null!==i&&i.SendKeys("{F11}")}}(document.getElementById(e))}this.params.fullScreenCallBack&&this.params.fullScreenCallBack(this.opt.id),this.opt.fullScreenStatus=1},g.prototype.cancelFullScreen=function(){if(0===this.opt.fullScreenStatus)return!1;var A="EZUIKitPlayer-"+this.opt.id,e=document.getElementById(A).contentWindow;if(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)){var t=document.getElementById(A).width,i=document.getElementById(A).height,n=(document.body,"");n+="width:"+t+"px;",n+="height:"+i+"px;",n+="-webkit-transform: none; transform: none;",n+="-webkit-transform-origin: 0 0;",n+="transform-origin: 0 0;",document.getElementById(A).style.cssText=n,setTimeout((function(){e.postMessage("autoResize",r+"/ezopen/h5/iframe")}),500);var a=A+"cancel-full-screen",o=document.getElementById(a);o&&document.body.removeChild(o)}else document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.mozCancelFullScreen&&document.mozCancelFullScreen();this.params.cancelFullScreenCallBack&&this.params.cancelFullScreenCallBack(this.opt.id),this.opt.fullScreenStatus=0},g.prototype.capturePicture=function(e,t){var i="EZUIKitPlayer-"+this.opt.id;document.getElementById(i).contentWindow.postMessage({action:"capturePicture",fileName:e||"default",isUndownload:t},r+"/ezopen/h5/iframe");var n=this;return new Promise((function(e,t){A.addEventListener("message",(function(A){n.opt.id==A.data.id&&"capturePicture"===A.data.type&&e(A.data)}))}))},g.prototype.enableZoom=function(){var A="EZUIKitPlayer-"+this.opt.id;document.getElementById(A).contentWindow.postMessage("enableZoom",r+"/ezopen/h5/iframe")},g.prototype.closeZoom=function(){var A="EZUIKitPlayer-"+this.opt.id;document.getElementById(A).contentWindow.postMessage("closeZoom",r+"/ezopen/h5/iframe")},g.prototype.getOSDTime=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("getOSDTime",r+"/ezopen/h5/iframe");var t=this;return new Promise((function(e,i){A.addEventListener("message",(function(A){t.opt.id==A.data.id&&"getOSDTime"===A.data.type&&e(A.data)}))}))},g.prototype.autoResize=function(){var A="EZUIKitPlayer-"+this.opt.id;document.getElementById(A).contentWindow.postMessage("autoResize",r+"/ezopen/h5/iframe")},g.prototype.reSize=function(A,e){var t="EZUIKitPlayer-"+this.opt.id,i=document.getElementById(t).contentWindow,n=document.getElementById(this.opt.id);n.style.width=A+"px",n.style.height=e+"px",document.getElementById(this.opt.id).style.width=A+"px",document.getElementById(this.opt.id).style.height=e+"px";var a=document.getElementById(t);a.setAttribute("width",A),a.setAttribute("height",e),a.style.width=A+"px",a.style.height=e+"px",setTimeout((function(){i.postMessage({action:"autoResize"},r+"/ezopen/h5/iframe")}),500)},g.prototype.startTalk=function(){console.log("执行开始对讲"),console.log(this.opt);var e=this;a.opt=this.opt,A.EZUIKit&&(A.EZUIKit.opt=this.opt);i(e.opt.apiDomain,"POST",{accessToken:e.opt.accessToken,deviceSerial:e.opt.deviceSerial,channelNo:e.opt.channelNo},0,(function(t){if(200==t.code){var i=t.data;if(i){var n=i.rtcUrl;-1===n.indexOf("ws")&&(n=n.replace("https","wss").replace("rtcgw","rtcgw-ws")),e.opt.rtcUrl=n,e.opt.ttsUrl="tts://"+i.ttsUrl;var a="talk://"+e.opt.deviceSerial+":0:"+e.opt.channelNo+":cas.ys7.com:6500";e.opt.talkLink=e.opt.ttsUrl+"/"+a,e.opt.stream=i.stream,A.startTalk()}}}))},g.prototype.stopTalk=function(){console.log("执行结束对讲"),A.stopTalk()},g.prototype.edit=function(){var A="EZUIKitPlayer-"+this.opt.id;document.getElementById(A).contentWindow.postMessage("edit",r+"/ezopen/h5/iframe")},g.prototype.btnReRender=function(A){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage({action:"btnReRender",data:A},r+"/ezopen/h5/iframe")},g.prototype.changePlayUrl=function(A){A.deviceSerial&&(this.opt.deviceSerial=A.deviceSerial),A.channelNo&&(this.opt.channelNo=A.channelNo),A.accessToken&&(this.opt.accessToken=A.accessToken);var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage({action:"changePlayUrl",data:A},r+"/ezopen/h5/iframe")},g.prototype.fetchThemeData=function(){var A="EZUIKitPlayer-"+this.opt.id;document.getElementById(A).contentWindow.postMessage({action:"fetchThemeData"},r+"/ezopen/h5/iframe")},g.prototype.setThemeData=function(A,e,t){var i="EZUIKitPlayer-"+this.opt.id;document.getElementById(i).contentWindow.postMessage({action:"setThemeData",data:{accessToken:A,header:e,footer:t}},r+"/ezopen/h5/iframe")},a.EZUIKitPlayer=g,A.EZUIKitV3=a,a}));var ue=EZUIKitV3,Ee=function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=void 0,n=void 0,a=void 0,r=[];return function(){var s=function(A){return"function"==typeof A?A():A}(e),g=(new Date).getTime(),c=!i||g-i>s;i=g;for(var l=arguments.length,I=Array(l),C=0;C */ !function(){var A;function e(A){var e=0;return function(){return e>>0)+"_",n=0;return function A(t){if(this instanceof A)throw new TypeError("Symbol is not a constructor");return new e(i+(t||"")+"_"+n++,t)}})),a("Symbol.iterator",(function(A){if(A)return A;A=Symbol("Symbol.iterator");for(var i="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),a=0;a=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0),this.setOptions(A)}var e=A.prototype;return e.setOptions=function(A){var e;this._options=Object.assign({},this._options,A),this._levelNum=this._matchLevel(null!=(e=this._options.level)?e:"INFO"),this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0)},e._matchLevel=function(A){var e=3;switch(A){case"INFO":e=3;break;case"LOG":e=2;break;case"WARN":e=1;break;case"ERROR":e=0}return e},e._loggerFactory=function(e,t){var i=console[e];if(t&&i){var n,a=this._options.name?"%c["+this._options.name+"]%c %c["+e.toUpperCase()+"]":"%c["+e.toUpperCase()+"]",r=[this._options.name?"background: green;color: #fff":null,this._options.name?"":null,pe[e]].filter((function(A){return null!=A}));return(n=i).bind.apply(n,[].concat([console,a],r))}return A.noop},e.getOptions=function(){return this._options},e.getVersion=function(){return"1.0.0-alpha.3"},A}();function ye(A){return(A=+A)<10&&(A="0"+A),A+""}me.noop=function(){};var _e=["info","log","warn","error"],Se=function(A){var e=new me(A);return new Proxy(e,{get:function(A,e){if(_e.includes(e)){var t;if(null==(t=A._options)?void 0:t.showTime){var i=(a=(n=new Date(Date.now())).getFullYear(),r=n.getMonth()+1,o=n.getDate(),s=n.getHours(),g=n.getMinutes(),c=n.getSeconds(),l=n.getMilliseconds(),a+"/"+ye(r)+"/"+ye(o)+" "+ye(s)+":"+ye(g)+":"+ye(c)+":"+l);return A[e].bind(console,"["+i+"]")}return A[e].bind(console)}var n,a,r,o,s,g,c,l;return Reflect.get(A,e)}})},De="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==D?D:"undefined"!=typeof self?self:{};function we(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var ve,Fe=Array.isArray,be="object"==typeof De&&De&&De.Object===Object&&De,Re=be,ke="object"==typeof self&&self&&self.Object===Object&&self,Pe=Re||ke||Function("return this")(),Ne=Pe.Symbol,Me=Ne,Te=Object.prototype,Le=Te.hasOwnProperty,Ye=Te.toString,Ge=Me?Me.toStringTag:void 0,Ue=Object.prototype.toString,Je=function(A){var e=Le.call(A,Ge),t=A[Ge];try{A[Ge]=void 0;var i=!0}catch(A){}var n=Ye.call(A);return i&&(e?A[Ge]=t:delete A[Ge]),n},He=Ne?Ne.toStringTag:void 0,Ke=function(A){return null==A?void 0===A?"[object Undefined]":"[object Null]":He&&He in Object(A)?Je(A):function(A){return Ue.call(A)}(A)},Ve=function(A){return null!=A&&"object"==typeof A},We=Ke,je=Ve,Oe=function(A){return"symbol"==typeof A||je(A)&&"[object Symbol]"==We(A)},Ze=Fe,qe=Oe,Xe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ze=/^\w*$/,$e=function(A,e){if(Ze(A))return!1;var t=typeof A;return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=A&&!qe(A))||ze.test(A)||!Xe.test(A)||null!=e&&A in Object(e)},At=function(A){var e=typeof A;return null!=A&&("object"==e||"function"==e)},et=Ke,tt=At,it=function(A){if(!tt(A))return!1;var e=et(A);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},nt=Pe["__core-js_shared__"],at=(ve=/[^.]+$/.exec(nt&&nt.keys&&nt.keys.IE_PROTO||""))?"Symbol(src)_1."+ve:"",rt=Function.prototype.toString,ot=function(A){if(null!=A){try{return rt.call(A)}catch(A){}try{return A+""}catch(A){}}return""},st=it,gt=function(A){return!!at&&at in A},ct=At,lt=ot,It=/^\[object .+?Constructor\]$/,Ct=Function.prototype,dt=Object.prototype,ht=Ct.toString,Bt=dt.hasOwnProperty,ut=RegExp("^"+ht.call(Bt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Et=function(A,e){var t=function(A,e){return null==A?void 0:A[e]}(A,e);return function(A){return!(!ct(A)||gt(A))&&(st(A)?ut:It).test(lt(A))}(t)?t:void 0},ft=Et(Object,"create"),Qt=ft,xt=ft,pt=Object.prototype.hasOwnProperty,mt=ft,yt=Object.prototype.hasOwnProperty,_t=ft,St=function(){this.__data__=Qt?Qt(null):{},this.size=0},Dt=function(A){var e=this.has(A)&&delete this.__data__[A];return this.size-=e?1:0,e},wt=function(A){var e=this.__data__;if(xt){var t=e[A];return"__lodash_hash_undefined__"===t?void 0:t}return pt.call(e,A)?e[A]:void 0};function vt(A){var e=-1,t=null==A?0:A.length;for(this.clear();++e-1},Gt.prototype.set=function(A,e){var t=this.__data__,i=Lt(t,A);return i<0?(++this.size,t.push([A,e])):t[i][1]=e,this};var Ut=Gt,Jt=Et(Pe,"Map"),Ht=Ft,Kt=Ut,Vt=Jt,Wt=function(A,e){var t=A.__data__;return function(A){var e=typeof A;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==A:null===A}(e)?t["string"==typeof e?"string":"hash"]:t.map},jt=Wt,Ot=Wt,Zt=Wt,qt=Wt;function Xt(A){var e=-1,t=null==A?0:A.length;for(this.clear();++e-1&&A%1==0&&A-1&&A%1==0&&A<=9007199254740991},Li=ui,Yi=Pi,Gi=Fe,Ui=Mi,Ji=Ti,Hi=fi,Ki=function(A,e,t){for(var i=-1,n=(e=Li(e,A)).length,a=!1;++i0){if(++e>=800)return arguments[0]}else e=0;return A.apply(void 0,arguments)}}(Va),Oa=Ua,Za=function(A,e,t){return e=Ja(void 0===e?A.length-1:e,0),function(){for(var i=arguments,n=-1,a=Ja(i.length-e,0),r=Array(a);++n1?t[n-1]:void 0,r=n>2?t[2]:void 0;for(a=A.length>3&&"function"==typeof a?(n--,a):void 0,r&&nr(t[0],t[1],r)&&(a=n<3?void 0:a,n=1),e=Object(e);++i-1},Er=function(A,e,t){for(var i=-1,n=null==A?0:A.length;++i=200){var g=e?null:Qr(A);if(g)return xr(g);r=!1,n=fr,s=new Br}else s=e?[]:o;A:for(;++i{const t=[],i=[];return t.push(e),e||t.push(A.locale),A.enableFallback&&t.push(A.defaultLocale),t.filter(Boolean).map((A=>A.toString())).forEach((function(e){if(i.includes(e)||i.push(e),!A.enableFallback)return;const t=e.split("-");3===t.length&&i.push(`${t[0]}-${t[1]}`),i.push(t[0])})),pr(i)};class yr{constructor(A){this.i18n=A,this.registry={},this.register("default",mr)}register(A,e){if("function"!=typeof e){const A=e;e=()=>A}this.registry[A]=e}get(A){let e=this.registry[A]||this.registry[this.i18n.locale]||this.registry.default;return"function"==typeof e&&(e=e(this.i18n,A)),e instanceof Array||(e=[e]),e}}const _r=function({pluralizer:A,includeZero:e=!0,ordinal:t=!1}){return function(i,n){return[e&&0===n?"zero":"",A(n,t)].filter(Boolean)}}({pluralizer:(A,e)=>{const t=String(A).split("."),i=!t[1],n=Number(t[0])==A,a=n&&t[0].slice(-1),r=n&&t[0].slice(-2);return e?1==a&&11!=r?"one":2==a&&12!=r?"two":3==a&&13!=r?"few":"other":1==A&&i?"one":"other"},includeZero:!0});class Sr{constructor(A){this.i18n=A,this.registry={},this.register("default",_r)}register(A,e){this.registry[A]=e}get(A){return this.registry[A]||this.registry[this.i18n.locale]||this.registry.default}}var Dr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),wr=function(A){return Dr.test(A)},vr="\\ud800-\\udfff",Fr="["+vr+"]",br="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Rr="\\ud83c[\\udffb-\\udfff]",kr="[^"+vr+"]",Pr="(?:\\ud83c[\\udde6-\\uddff]){2}",Nr="[\\ud800-\\udbff][\\udc00-\\udfff]",Mr="(?:"+br+"|"+Rr+")?",Tr="[\\ufe0e\\ufe0f]?",Lr=Tr+Mr+"(?:\\u200d(?:"+[kr,Pr,Nr].join("|")+")"+Tr+Mr+")*",Yr="(?:"+[kr+br+"?",br,Pr,Nr,Fr].join("|")+")",Gr=RegExp(Rr+"(?="+Rr+")|"+Yr+Lr,"g"),Ur=function(A){return A.split("")},Jr=wr,Hr=function(A,e,t){var i=A.length;return t=void 0===t?i:t,!e&&t>=i?A:function(A,e,t){var i=-1,n=A.length;e<0&&(e=-e>n?0:n+e),(t=t>n?n:t)<0&&(t+=n),n=e>t?0:t-e>>>0,e>>>=0;for(var a=Array(n);++i(e[ko(t)]=A[t],e)),{}):{}}function No(A){return null!=A}var Mo=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,To=Math.ceil,Lo=Math.floor,Yo="[BigNumber Error] ",Go=Yo+"Number primitive has more than 15 significant digits: ",Uo=1e14,Jo=14,Ho=9007199254740991,Ko=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Vo=1e7,Wo=1e9;function jo(A){var e=0|A;return A>0||A===e?e:e-1}function Oo(A){for(var e,t,i=1,n=A.length,a=A[0]+"";ig^t?1:-1;for(o=(s=n.length)<(g=a.length)?s:g,r=0;ra[r]^t?1:-1;return s==g?0:s>g^t?1:-1}function qo(A,e,t,i){if(At||A!==Lo(A))throw Error(Yo+(i||"Argument")+("number"==typeof A?At?" out of range: ":" not an integer: ":" not a primitive number: ")+String(A))}function Xo(A){var e=A.c.length-1;return jo(A.e/Jo)==e&&A.c[e]%2!=0}function zo(A,e){return(A.length>1?A.charAt(0)+"."+A.slice(1):A)+(e<0?"e":"e+")+e}function $o(A,e,t){var i,n;if(e<0){for(n=t+".";++e;n+=t);A=n+A}else if(++e>(i=A.length)){for(n=t,e-=i;--e;n+=t);A+=n}else ef?I.c=I.e=null:A.e=10;s/=10,o++);return void(o>f?I.c=I.e=null:(I.e=o,I.c=[A]))}l=String(A)}else{if(!Mo.test(l=String(A)))return n(I,l,g);I.s=45==l.charCodeAt(0)?(l=l.slice(1),-1):1}(o=l.indexOf("."))>-1&&(l=l.replace(".","")),(s=l.search(/e/i))>0?(o<0&&(o=s),o+=+l.slice(s+1),l=l.substring(0,s)):o<0&&(o=l.length)}else{if(qo(e,2,y.length,"Base"),10==e&&_)return F(I=new S(A),d+I.e+1,h);if(l=String(A),g="number"==typeof A){if(0*A!=0)return n(I,l,g,e);if(I.s=1/A<0?(l=l.slice(1),-1):1,S.DEBUG&&l.replace(/^0\.0*|\./,"").length>15)throw Error(Go+A)}else I.s=45===l.charCodeAt(0)?(l=l.slice(1),-1):1;for(t=y.slice(0,e),o=s=0,c=l.length;so){o=c;continue}}else if(!r&&(l==l.toUpperCase()&&(l=l.toLowerCase())||l==l.toLowerCase()&&(l=l.toUpperCase()))){r=!0,s=-1,o=0;continue}return n(I,String(A),g,e)}g=!1,(o=(l=i(l,e,10,I.s)).indexOf("."))>-1?l=l.replace(".",""):o=l.length}for(s=0;48===l.charCodeAt(s);s++);for(c=l.length;48===l.charCodeAt(--c););if(l=l.slice(s,++c)){if(c-=s,g&&S.DEBUG&&c>15&&(A>Ho||A!==Lo(A)))throw Error(Go+I.s*A);if((o=o-s-1)>f)I.c=I.e=null;else if(o=u)?zo(s,r):$o(s,r,"0");else if(a=(A=F(new S(A),e,t)).e,o=(s=Oo(A.c)).length,1==i||2==i&&(e<=a||a<=B)){for(;oo){if(--e>0)for(s+=".";e--;s+="0");}else if((e+=a-o)>0)for(a+1==o&&(s+=".");e--;s+="0");return A.s<0&&n?"-"+s:s}function w(A,e){for(var t,i,n=1,a=new S(A[0]);n=10;n/=10,i++);return(t=i+t*Jo-1)>f?A.c=A.e=null:t=10;o/=10,n++);if((a=e-n)<0)a+=Jo,r=e,s=l[g=0],c=Lo(s/I[n-r-1]%10);else if((g=To((a+1)/Jo))>=l.length){if(!i)break A;for(;l.length<=g;l.push(0));s=c=0,n=1,r=(a%=Jo)-Jo+1}else{for(s=o=l[g],n=1;o>=10;o/=10,n++);c=(r=(a%=Jo)-Jo+n)<0?0:Lo(s/I[n-r-1]%10)}if(i=i||e<0||null!=l[g+1]||(r<0?s:s%I[n-r-1]),i=t<4?(c||i)&&(0==t||t==(A.s<0?3:2)):c>5||5==c&&(4==t||i||6==t&&(a>0?r>0?s/I[n-r]:0:l[g-1])%10&1||t==(A.s<0?8:7)),e<1||!l[0])return l.length=0,i?(e-=A.e+1,l[0]=I[(Jo-e%Jo)%Jo],A.e=-e||0):l[0]=A.e=0,A;if(0==a?(l.length=g,o=1,g--):(l.length=g+1,o=I[Jo-a],l[g]=r>0?Lo(s/I[n-r]%I[r])*o:0),i)for(;;){if(0==g){for(a=1,r=l[0];r>=10;r/=10,a++);for(r=l[0]+=o,o=1;r>=10;r/=10,o++);a!=o&&(A.e++,l[0]==Uo&&(l[0]=1));break}if(l[g]+=o,l[g]!=Uo)break;l[g--]=0,o=1}for(a=l.length;0===l[--a];l.pop());}A.e>f?A.c=A.e=null:A.e=u?zo(e,t):$o(e,t,"0"),A.s<0?"-"+e:e)}return S.clone=A,S.ROUND_UP=0,S.ROUND_DOWN=1,S.ROUND_CEIL=2,S.ROUND_FLOOR=3,S.ROUND_HALF_UP=4,S.ROUND_HALF_DOWN=5,S.ROUND_HALF_EVEN=6,S.ROUND_HALF_CEIL=7,S.ROUND_HALF_FLOOR=8,S.EUCLID=9,S.config=S.set=function(A){var e,t;if(null!=A){if("object"!=typeof A)throw Error(Yo+"Object expected: "+A);if(A.hasOwnProperty(e="DECIMAL_PLACES")&&(qo(t=A[e],0,Wo,e),d=t),A.hasOwnProperty(e="ROUNDING_MODE")&&(qo(t=A[e],0,8,e),h=t),A.hasOwnProperty(e="EXPONENTIAL_AT")&&((t=A[e])&&t.pop?(qo(t[0],-Wo,0,e),qo(t[1],0,Wo,e),B=t[0],u=t[1]):(qo(t,-Wo,Wo,e),B=-(u=t<0?-t:t))),A.hasOwnProperty(e="RANGE"))if((t=A[e])&&t.pop)qo(t[0],-Wo,-1,e),qo(t[1],1,Wo,e),E=t[0],f=t[1];else{if(qo(t,-Wo,Wo,e),!t)throw Error(Yo+e+" cannot be zero: "+t);E=-(f=t<0?-t:t)}if(A.hasOwnProperty(e="CRYPTO")){if((t=A[e])!==!!t)throw Error(Yo+e+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Q=!t,Error(Yo+"crypto unavailable");Q=t}else Q=t}if(A.hasOwnProperty(e="MODULO_MODE")&&(qo(t=A[e],0,9,e),x=t),A.hasOwnProperty(e="POW_PRECISION")&&(qo(t=A[e],0,Wo,e),p=t),A.hasOwnProperty(e="FORMAT")){if("object"!=typeof(t=A[e]))throw Error(Yo+e+" not an object: "+t);m=t}if(A.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(t=A[e])||/^.?$|[+\-.\s]|(.).*\1/.test(t))throw Error(Yo+e+" invalid: "+t);_="0123456789"==t.slice(0,10),y=t}}return{DECIMAL_PLACES:d,ROUNDING_MODE:h,EXPONENTIAL_AT:[B,u],RANGE:[E,f],CRYPTO:Q,MODULO_MODE:x,POW_PRECISION:p,FORMAT:m,ALPHABET:y}},S.isBigNumber=function(A){if(!A||!0!==A._isBigNumber)return!1;if(!S.DEBUG)return!0;var e,t,i=A.c,n=A.e,a=A.s;A:if("[object Array]"=={}.toString.call(i)){if((1===a||-1===a)&&n>=-Wo&&n<=Wo&&n===Lo(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break A}if((e=(n+1)%Jo)<1&&(e+=Jo),String(i[0]).length==e){for(e=0;e=Uo||t!==Lo(t))break A;if(0!==t)return!0}}}else if(null===i&&null===n&&(null===a||1===a||-1===a))return!0;throw Error(Yo+"Invalid BigNumber: "+A)},S.maximum=S.max=function(){return w(arguments,-1)},S.minimum=S.min=function(){return w(arguments,1)},S.random=(a=9007199254740992,r=Math.random()*a&2097151?function(){return Lo(Math.random()*a)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(A){var e,t,i,n,a,o=0,s=[],g=new S(C);if(null==A?A=d:qo(A,0,Wo),n=To(A/Jo),Q)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(n*=2));o>>11))>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),e[o]=t[0],e[o+1]=t[1]):(s.push(a%1e14),o+=2);o=n/2}else{if(!crypto.randomBytes)throw Q=!1,Error(Yo+"crypto unavailable");for(e=crypto.randomBytes(n*=7);o=9e15?crypto.randomBytes(7).copy(e,o):(s.push(a%1e14),o+=7);o=n/7}if(!Q)for(;o=10;a/=10,o++);ot-1&&(null==r[n+1]&&(r[n+1]=0),r[n+1]+=r[n]/t|0,r[n]%=t)}return r.reverse()}return function(i,n,a,r,o){var s,g,c,l,I,C,B,u,E=i.indexOf("."),f=d,Q=h;for(E>=0&&(l=p,p=0,i=i.replace(".",""),C=(u=new S(n)).pow(i.length-E),p=l,u.c=e($o(Oo(C.c),C.e,"0"),10,a,A),u.e=u.c.length),c=l=(B=e(i,n,a,o?(s=y,A):(s=A,y))).length;0==B[--l];B.pop());if(!B[0])return s.charAt(0);if(E<0?--c:(C.c=B,C.e=c,C.s=r,B=(C=t(C,u,f,Q,a)).c,I=C.r,c=C.e),E=B[g=c+f+1],l=a/2,I=I||g<0||null!=B[g+1],I=Q<4?(null!=E||I)&&(0==Q||Q==(C.s<0?3:2)):E>l||E==l&&(4==Q||I||6==Q&&1&B[g-1]||Q==(C.s<0?8:7)),g<1||!B[0])i=I?$o(s.charAt(1),-f,s.charAt(0)):s.charAt(0);else{if(B.length=g,I)for(--a;++B[--g]>a;)B[g]=0,g||(++c,B=[1].concat(B));for(l=B.length;!B[--l];);for(E=0,i="";E<=l;i+=s.charAt(B[E++]));i=$o(i,c,s.charAt(0))}return i}}(),t=function(){function A(A,e,t){var i,n,a,r,o=0,s=A.length,g=e%Vo,c=e/Vo|0;for(A=A.slice();s--;)o=((n=g*(a=A[s]%Vo)+(i=c*a+(r=A[s]/Vo|0)*g)%Vo*Vo+o)/t|0)+(i/Vo|0)+c*r,A[s]=n%t;return o&&(A=[o].concat(A)),A}function e(A,e,t,i){var n,a;if(t!=i)a=t>i?1:-1;else for(n=a=0;ne[n]?1:-1;break}return a}function t(A,e,t,i){for(var n=0;t--;)A[t]-=n,n=A[t]1;A.splice(0,1));}return function(i,n,a,r,o){var s,g,c,l,I,C,d,h,B,u,E,f,Q,x,p,m,y,_=i.s==n.s?1:-1,D=i.c,w=n.c;if(!(D&&D[0]&&w&&w[0]))return new S(i.s&&n.s&&(D?!w||D[0]!=w[0]:w)?D&&0==D[0]||!w?0*_:_/0:NaN);for(B=(h=new S(_)).c=[],_=a+(g=i.e-n.e)+1,o||(o=Uo,g=jo(i.e/Jo)-jo(n.e/Jo),_=_/Jo|0),c=0;w[c]==(D[c]||0);c++);if(w[c]>(D[c]||0)&&g--,_<0)B.push(1),l=!0;else{for(x=D.length,m=w.length,c=0,_+=2,(I=Lo(o/(w[0]+1)))>1&&(w=A(w,I,o),D=A(D,I,o),m=w.length,x=D.length),Q=m,E=(u=D.slice(0,m)).length;E=o/2&&p++;do{if(I=0,(s=e(w,u,m,E))<0){if(f=u[0],m!=E&&(f=f*o+(u[1]||0)),(I=Lo(f/p))>1)for(I>=o&&(I=o-1),d=(C=A(w,I,o)).length,E=u.length;1==e(C,u,d,E);)I--,t(C,m=10;_/=10,c++);F(h,a+(h.e=c+g*Jo-1)+1,r,l)}else h.e=g,h.r=+l;return h}}(),o=/^(-?)0([xbo])(?=\w[\w.]*$)/i,s=/^([^.]+)\.$/,g=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,l=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(A,e,t,i){var n,a=t?e:e.replace(l,"");if(c.test(a))A.s=isNaN(a)?null:a<0?-1:1;else{if(!t&&(a=a.replace(o,(function(A,e,t){return n="x"==(t=t.toLowerCase())?16:"b"==t?2:8,i&&i!=n?A:e})),i&&(n=i,a=a.replace(s,"$1").replace(g,"0.$1")),e!=a))return new S(a,n);if(S.DEBUG)throw Error(Yo+"Not a"+(i?" base "+i:"")+" number: "+e);A.s=null}A.c=A.e=null},I.absoluteValue=I.abs=function(){var A=new S(this);return A.s<0&&(A.s=1),A},I.comparedTo=function(A,e){return Zo(this,new S(A,e))},I.decimalPlaces=I.dp=function(A,e){var t,i,n,a=this;if(null!=A)return qo(A,0,Wo),null==e?e=h:qo(e,0,8),F(new S(a),A+a.e+1,e);if(!(t=a.c))return null;if(i=((n=t.length-1)-jo(this.e/Jo))*Jo,n=t[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},I.dividedBy=I.div=function(A,e){return t(this,new S(A,e),d,h)},I.dividedToIntegerBy=I.idiv=function(A,e){return t(this,new S(A,e),0,1)},I.exponentiatedBy=I.pow=function(A,e){var t,i,n,a,r,o,s,g,c=this;if((A=new S(A)).c&&!A.isInteger())throw Error(Yo+"Exponent not an integer: "+b(A));if(null!=e&&(e=new S(e)),r=A.e>14,!c.c||!c.c[0]||1==c.c[0]&&!c.e&&1==c.c.length||!A.c||!A.c[0])return g=new S(Math.pow(+b(c),r?A.s*(2-Xo(A)):+b(A))),e?g.mod(e):g;if(o=A.s<0,e){if(e.c?!e.c[0]:!e.s)return new S(NaN);(i=!o&&c.isInteger()&&e.isInteger())&&(c=c.mod(e))}else{if(A.e>9&&(c.e>0||c.e<-1||(0==c.e?c.c[0]>1||r&&c.c[1]>=24e7:c.c[0]<8e13||r&&c.c[0]<=9999975e7)))return a=c.s<0&&Xo(A)?-0:0,c.e>-1&&(a=1/a),new S(o?1/a:a);p&&(a=To(p/Jo+2))}for(r?(t=new S(.5),o&&(A.s=1),s=Xo(A)):s=(n=Math.abs(+b(A)))%2,g=new S(C);;){if(s){if(!(g=g.times(c)).c)break;a?g.c.length>a&&(g.c.length=a):i&&(g=g.mod(e))}if(n){if(0===(n=Lo(n/2)))break;s=n%2}else if(F(A=A.times(t),A.e+1,1),A.e>14)s=Xo(A);else{if(0==(n=+b(A)))break;s=n%2}c=c.times(c),a?c.c&&c.c.length>a&&(c.c.length=a):i&&(c=c.mod(e))}return i?g:(o&&(g=C.div(g)),e?g.mod(e):a?F(g,p,h,void 0):g)},I.integerValue=function(A){var e=new S(this);return null==A?A=h:qo(A,0,8),F(e,e.e+1,A)},I.isEqualTo=I.eq=function(A,e){return 0===Zo(this,new S(A,e))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(A,e){return Zo(this,new S(A,e))>0},I.isGreaterThanOrEqualTo=I.gte=function(A,e){return 1===(e=Zo(this,new S(A,e)))||0===e},I.isInteger=function(){return!!this.c&&jo(this.e/Jo)>this.c.length-2},I.isLessThan=I.lt=function(A,e){return Zo(this,new S(A,e))<0},I.isLessThanOrEqualTo=I.lte=function(A,e){return-1===(e=Zo(this,new S(A,e)))||0===e},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(A,e){var t,i,n,a,r=this,o=r.s;if(e=(A=new S(A,e)).s,!o||!e)return new S(NaN);if(o!=e)return A.s=-e,r.plus(A);var s=r.e/Jo,g=A.e/Jo,c=r.c,l=A.c;if(!s||!g){if(!c||!l)return c?(A.s=-e,A):new S(l?r:NaN);if(!c[0]||!l[0])return l[0]?(A.s=-e,A):new S(c[0]?r:3==h?-0:0)}if(s=jo(s),g=jo(g),c=c.slice(),o=s-g){for((a=o<0)?(o=-o,n=c):(g=s,n=l),n.reverse(),e=o;e--;n.push(0));n.reverse()}else for(i=(a=(o=c.length)<(e=l.length))?o:e,o=e=0;e0)for(;e--;c[t++]=0);for(e=Uo-1;i>o;){if(c[--i]=0;){for(t=0,I=f[n]%B,C=f[n]/B|0,a=n+(r=s);a>n;)t=((g=I*(g=E[--r]%B)+(o=C*g+(c=E[r]/B|0)*I)%B*B+d[a]+t)/h|0)+(o/B|0)+C*c,d[a--]=g%h;d[a]=t}return t?++i:d.splice(0,1),v(A,d,i)},I.negated=function(){var A=new S(this);return A.s=-A.s||null,A},I.plus=function(A,e){var t,i=this,n=i.s;if(e=(A=new S(A,e)).s,!n||!e)return new S(NaN);if(n!=e)return A.s=-e,i.minus(A);var a=i.e/Jo,r=A.e/Jo,o=i.c,s=A.c;if(!a||!r){if(!o||!s)return new S(n/0);if(!o[0]||!s[0])return s[0]?A:new S(o[0]?i:0*n)}if(a=jo(a),r=jo(r),o=o.slice(),n=a-r){for(n>0?(r=a,t=s):(n=-n,t=o),t.reverse();n--;t.push(0));t.reverse()}for((n=o.length)-(e=s.length)<0&&(t=s,s=o,o=t,e=n),n=0;e;)n=(o[--e]=o[e]+s[e]+n)/Uo|0,o[e]=Uo===o[e]?0:o[e]%Uo;return n&&(o=[n].concat(o),++r),v(A,o,r)},I.precision=I.sd=function(A,e){var t,i,n,a=this;if(null!=A&&A!==!!A)return qo(A,1,Wo),null==e?e=h:qo(e,0,8),F(new S(a),A,e);if(!(t=a.c))return null;if(i=(n=t.length-1)*Jo+1,n=t[n]){for(;n%10==0;n/=10,i--);for(n=t[0];n>=10;n/=10,i++);}return A&&a.e+1>i&&(i=a.e+1),i},I.shiftedBy=function(A){return qo(A,-9007199254740991,Ho),this.times("1e"+A)},I.squareRoot=I.sqrt=function(){var A,e,i,n,a,r=this,o=r.c,s=r.s,g=r.e,c=d+4,l=new S("0.5");if(1!==s||!o||!o[0])return new S(!s||s<0&&(!o||o[0])?NaN:o?r:1/0);if(0==(s=Math.sqrt(+b(r)))||s==1/0?(((e=Oo(o)).length+g)%2==0&&(e+="0"),s=Math.sqrt(+e),g=jo((g+1)/2)-(g<0||g%2),i=new S(e=s==1/0?"5e"+g:(e=s.toExponential()).slice(0,e.indexOf("e")+1)+g)):i=new S(s+""),i.c[0])for((s=(g=i.e)+c)<3&&(s=0);;)if(a=i,i=l.times(a.plus(t(r,a,c,1))),Oo(a.c).slice(0,s)===(e=Oo(i.c)).slice(0,s)){if(i.e0&&d>0){for(a=d%o||o,c=C.substr(0,a);a0&&(c+=g+C.slice(a)),I&&(c="-"+c)}i=l?c+(t.decimalSeparator||"")+((s=+t.fractionGroupSize)?l.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):l):c}return(t.prefix||"")+i+(t.suffix||"")},I.toFraction=function(A){var e,i,n,a,r,o,s,g,c,l,I,d,B=this,u=B.c;if(null!=A&&(!(s=new S(A)).isInteger()&&(s.c||1!==s.s)||s.lt(C)))throw Error(Yo+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+b(s));if(!u)return new S(B);for(e=new S(C),c=i=new S(C),n=g=new S(C),d=Oo(u),r=e.e=d.length-B.e-1,e.c[0]=Ko[(o=r%Jo)<0?Jo+o:o],A=!A||s.comparedTo(e)>0?r>0?e:c:s,o=f,f=1/0,s=new S(d),g.c[0]=0;l=t(s,e,0,1),1!=(a=i.plus(l.times(n))).comparedTo(A);)i=n,n=a,c=g.plus(l.times(a=c)),g=a,e=s.minus(l.times(a=e)),s=a;return a=t(A.minus(i),n,0,1),g=g.plus(a.times(c)),i=i.plus(a.times(n)),g.s=c.s=B.s,I=t(c,n,r*=2,h).minus(B).abs().comparedTo(t(g,i,r,h).minus(B).abs())<1?[c,n]:[g,i],f=o,I},I.toNumber=function(){return+b(this)},I.toPrecision=function(A,e){return null!=A&&qo(A,1,Wo),D(this,A,e,2)},I.toString=function(A){var e,t=this,n=t.s,a=t.e;return null===a?n?(e="Infinity",n<0&&(e="-"+e)):e="NaN":(null==A?e=a<=B||a>=u?zo(Oo(t.c),a):$o(Oo(t.c),a,"0"):10===A&&_?e=$o(Oo((t=F(new S(t),d+a+1,h)).c),t.e,"0"):(qo(A,2,y.length,"Base"),e=i($o(Oo(t.c),a,"0"),10,A,n,!0)),n<0&&t.c[0]&&(e="-"+e)),e},I.valueOf=I.toJSON=function(){return b(this)},I._isBigNumber=!0,I[Symbol.toStringTag]="BigNumber",I[Symbol.for("nodejs.util.inspect.custom")]=I.valueOf,null!=e&&S.set(e),S}();function ts(A){var e;return null!==(e=As[A])&&void 0!==e?e:As.default}!function(A){A[A.up=es.ROUND_UP]="up",A[A.down=es.ROUND_DOWN]="down",A[A.truncate=es.ROUND_DOWN]="truncate",A[A.halfUp=es.ROUND_HALF_UP]="halfUp",A[A.default=es.ROUND_HALF_UP]="default",A[A.halfDown=es.ROUND_HALF_DOWN]="halfDown",A[A.halfEven=es.ROUND_HALF_EVEN]="halfEven",A[A.banker=es.ROUND_HALF_EVEN]="banker",A[A.ceiling=es.ROUND_CEIL]="ceiling",A[A.ceil=es.ROUND_CEIL]="ceil",A[A.floor=es.ROUND_FLOOR]="floor"}(As||(As={}));var is=Math.floor,ns=/\s/,as=/^\s+/,rs=function(A){return A?A.slice(0,function(A){for(var e=A.length;e--&&ns.test(A.charAt(e)););return e}(A)+1).replace(as,""):A},os=At,ss=Oe,gs=/^[-+]0x[0-9a-f]+$/i,cs=/^0b[01]+$/i,ls=/^0o[0-7]+$/i,Is=parseInt,Cs=1/0,ds=function(A){return A?(A=function(A){if("number"==typeof A)return A;if(ss(A))return NaN;if(os(A)){var e="function"==typeof A.valueOf?A.valueOf():A;A=os(e)?e+"":e}if("string"!=typeof A)return 0===A?A:+A;A=rs(A);var t=cs.test(A);return t||ls.test(A)?Is(A.slice(2),t?2:8):gs.test(A)?NaN:+A}(A))===Cs||A===-1/0?17976931348623157e292*(A<0?-1:1):A==A?A:0:0===A?A:0},hs=ds,Bs=tr,us=Ii,Es=we((function(A,e,t){return e=(t?Bs(A,e,t):void 0===e)?1:function(A){var e=hs(A),t=e%1;return e==e?t?e-t:e:0}(e),function(A,e){var t="";if(!A||e<1||e>9007199254740991)return t;do{e%2&&(t+=A),(e=is(e/2))&&(A+=A)}while(e);return t}(us(A),e)}));function fs(A,e){const t=function(A,{precision:e,significant:t}){return t&&null!==e&&e>0?e-function(A){return A.isZero()?1:Math.floor(Math.log10(A.abs().toNumber())+1)}(A):e}(A,e);if(null===t)return A.toString();const i=ts(e.roundMode);if(t>=0)return A.toFixed(t,i);const n=Math.pow(10,Math.abs(t));return(A=new es(A.div(n).toFixed(0,i)).times(n)).toString()}function Qs(A,e){var t,i,n;const a=new es(A);if(e.raise&&!a.isFinite())throw new Error(`"${A}" is not a valid numeric value`);const r=fs(a,e),o=new es(r),s=o.lt(0),g=o.isZero();let[c,l]=r.split(".");const I=[];let C;const d=null!==(t=e.format)&&void 0!==t?t:"%n",h=null!==(i=e.negativeFormat)&&void 0!==i?i:`-${d}`,B=s&&!g?h:d;for(c=c.replace("-","");c.length>0;)I.unshift(c.substr(Math.max(0,c.length-3),3)),c=c.substr(0,c.length-3);return c=I.join(""),C=I.join(e.delimiter),l=e.significant?function({significand:A,whole:e,precision:t}){if("0"===e||null===t)return A;const i=Math.max(0,t-e.length);return(null!=A?A:"").substr(0,i)}({whole:c,significand:l,precision:e.precision}):null!=l?l:Es("0",null!==(n=e.precision)&&void 0!==n?n:0),e.stripInsignificantZeros&&l&&(l=l.replace(/0+$/,"")),a.isNaN()&&(C=A.toString()),l&&a.isFinite()&&(C+=(e.separator||".")+l),function(A,{formattedNumber:e,unit:t}){return A.replace("%n",e).replace("%u",t)}(B,{formattedNumber:C,unit:e.unit})}function xs(A,e,t){let i="";return(e instanceof String||"string"==typeof e)&&(i=e),e instanceof Array&&(i=e.join(A.defaultSeparator)),t.scope&&(i=[t.scope,i].join(A.defaultSeparator)),i}function ps(A){var e,t;if(null===A)return"null";const i=typeof A;return"object"!==i?i:(null===(t=null===(e=null==A?void 0:A.constructor)||void 0===e?void 0:e.name)||void 0===t?void 0:t.toLowerCase())||"object"}function ms(A,e,t){t=Object.keys(t).reduce(((e,i)=>(e[A.transformKey(i)]=t[i],e)),{});const i=e.match(A.placeholder);if(!i)return e;for(;i.length;){let n;const a=i.shift(),r=a.replace(A.placeholder,"$1");n=No(t[r])?t[r].toString().replace(/\$/gm,"_#$#_"):r in t?A.nullPlaceholder(A,a,e,t):A.missingPlaceholder(A,a,e,t);const o=new RegExp(a.replace(/\{/gm,"\\{").replace(/\}/gm,"\\}"));e=e.replace(o,n)}return e.replace(/_#\$#_/g,"$")}function ys(A,e,t={}){const i="locale"in(t=Object.assign({},t))?t.locale:A.locale,n=ps(i),a=A.locales.get("string"===n?i:typeof i).slice(),r=xs(A,e,t).split(A.defaultSeparator).map((e=>A.transformKey(e))),o=a.map((e=>r.reduce(((A,e)=>A&&A[e]),A.translations[e])));return o.push(t.defaultValue),o.find((A=>No(A)))}var _s=function(A,e){for(var t=-1,i=e.length,n=A.length;++to))return!1;var g=a.get(A),c=a.get(e);if(g&&c)return g==e&&c==A;var l=-1,I=!0,C=2&t?new bs:void 0;for(a.set(A,e),a.set(e,A);++le||a&&r&&s&&!o&&!g||i&&r&&s||!t&&s||!n)return 1;if(!i&&!a&&!g&&A0&&i(s)?t>1?A(s,t-1,i,n,a):vs(a,s):n||(a[a.length]=s)}return a},xc=function(A,e,t){e=e.length?dc(e,(function(A){return fc(A)?function(e){return hc(e,1===A.length?A[0]:A)}:A})):[Ec];var i=-1;e=dc(e,uc(Bc));var n=function(A,e){var t=-1,i=lc(A)?Array(A.length):[];return cc(A,(function(A,n,a){i[++t]=e(A,n,a)})),i}(A,(function(A,t,n){return{criteria:dc(e,(function(e){return e(A)})),index:++i,value:A}}));return function(A,e){var t=A.length;for(A.sort(e);t--;)A[t]=A[t].value;return A}(n,(function(A,e){return function(A,e,t){for(var i=-1,n=A.criteria,a=e.criteria,r=n.length,o=t.length;++i=o?s:s*("desc"==t[i]?-1:1)}return A.index-e.index}(A,e,t)}))},pc=tr,mc=we(Xa((function(A,e){if(null==A)return[];var t=e.length;return t>1&&pc(A,e[0],e[1])?e=[]:t>2&&pc(e[0],e[1],e[2])&&(e=[e[0]]),xc(A,Qc(e,1),[])}))),yc=ea;const _c={0:"unit",1:"ten",2:"hundred",3:"thousand",6:"million",9:"billion",12:"trillion",15:"quadrillion","-1":"deci","-2":"centi","-3":"mili","-6":"micro","-9":"nano","-12":"pico","-15":"femto"},Sc=we((function(A,e){return function(A,e,t){for(var i=-1,n=A.length,a=e.length,r={};++iparseInt(A,10))));const Dc=["byte","kb","mb","gb","tb","pb","eb"];function wc(A){if(A instanceof Date)return A;if("number"==typeof A){const e=new Date;return e.setTime(A),e}const e=new String(A).match(/(\d{4})-(\d{2})-(\d{2})(?:[ T](\d{2}):(\d{2}):(\d{2})(?:[.,](\d{1,3}))?)?(Z|\+00:?00)?/);if(e){const A=e.slice(1,8).map((A=>parseInt(A,10)||0));A[1]-=1;const[t,i,n,a,r,o,s]=A;return e[8]?new Date(Date.UTC(t,i,n,a,r,o,s)):new Date(t,i,n,a,r,o,s)}A.match(/([A-Z][a-z]{2}) ([A-Z][a-z]{2}) (\d+) (\d+:\d+:\d+) ([+-]\d+) (\d+)/)&&(new Date).setTime(Date.parse([RegExp.$1,RegExp.$2,RegExp.$3,RegExp.$6,RegExp.$4,RegExp.$5].join(" ")));const t=new Date;return t.setTime(Date.parse(A)),t}function vc({i18n:A,count:e,scope:t,options:i,baseScope:n}){let a,r;if(i=Object.assign({},i),a="object"==typeof t&&t?t:ys(A,t,i),!a)return A.missingTranslation.get(t,i);const o=A.pluralization.get(i.locale)(A,e),s=[];for(;o.length;){const A=o.shift();if(No(a[A])){r=a[A];break}s.push(A)}return No(r)?(i.count=e,A.interpolate(A,r,i)):A.missingTranslation.get(n.split(A.defaultSeparator).concat([s[0]]),i)}const Fc={meridian:{am:"AM",pm:"PM"},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:[null,"January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonthNames:[null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]};var bc=Math.ceil,Rc=Math.max,kc=tr,Pc=ds,Nc=we((function(A,e,t){return t&&"number"!=typeof t&&kc(A,e,t)&&(e=t=void 0),A=Pc(A),void 0===e?(e=A,A=0):e=Pc(e),function(A,e,t,i){for(var n=-1,a=Rc(bc((e-A)/(t||1)),0),r=Array(a);a--;)r[i?a:++n]=A,A+=t;return r}(A,e,t=void 0===t?At>=A&&t<=e,Tc=function(A,e){e instanceof Array&&(e=e.join(A.defaultSeparator));const t=e.split(A.defaultSeparator).slice(-1)[0];return A.missingTranslationPrefix+t.replace("_"," ").replace(/([a-z])([A-Z])/g,((A,e,t)=>`${e} ${t.toLowerCase()}`))},Lc=(A,e,t)=>{const i=xs(A,e,t),n="locale"in t?t.locale:A.locale,a=ps(n);return`[missing "${["string"==a?n:a,i].join(A.defaultSeparator)}" translation]`},Yc=(A,e,t)=>{const i=xs(A,e,t),n=[A.locale,i].join(A.defaultSeparator);throw new Error(`Missing translation: ${n}`)};class Gc{constructor(A){this.i18n=A,this.registry={},this.register("guess",Tc),this.register("message",Lc),this.register("error",Yc)}register(A,e){this.registry[A]=e}get(A,e){var t;return this.registry[null!==(t=e.missingBehavior)&&void 0!==t?t:this.i18n.missingBehavior](this.i18n,A,e)}}const Uc={defaultLocale:"en",availableLocales:["en"],locale:"en",defaultSeparator:".",placeholder:/(?:\{\{|%\{)(.*?)(?:\}\}?)/gm,enableFallback:!1,missingBehavior:"message",missingTranslationPrefix:"",missingPlaceholder:(A,e)=>`[missing "${e}" value]`,nullPlaceholder:(A,e,t,i)=>A.missingPlaceholder(A,e,t,i),transformKey:A=>A};let Jc=class{constructor(A={},e={}){this._locale=Uc.locale,this._defaultLocale=Uc.defaultLocale,this._version=0,this.onChangeHandlers=[],this.translations={},this.availableLocales=[],this.t=this.translate,this.p=this.pluralize,this.l=this.localize,this.distanceOfTimeInWords=this.timeAgoInWords;const{locale:t,enableFallback:i,missingBehavior:n,missingTranslationPrefix:a,missingPlaceholder:r,nullPlaceholder:o,defaultLocale:s,defaultSeparator:g,placeholder:c,transformKey:l}=Object.assign(Object.assign({},Uc),e);this.locale=t,this.defaultLocale=s,this.defaultSeparator=g,this.enableFallback=i,this.locale=t,this.missingBehavior=n,this.missingTranslationPrefix=a,this.missingPlaceholder=r,this.nullPlaceholder=o,this.placeholder=c,this.pluralization=new Sr(this),this.locales=new yr(this),this.missingTranslation=new Gc(this),this.transformKey=l,this.interpolate=ms,this.store(A)}store(A){rr(this.translations,A),this.hasChanged()}get locale(){return this._locale||this.defaultLocale||"en"}set locale(A){if("string"!=typeof A)throw new Error(`Expected newLocale to be a string; got ${ps(A)}`);const e=this._locale!==A;this._locale=A,e&&this.hasChanged()}get defaultLocale(){return this._defaultLocale||"en"}set defaultLocale(A){if("string"!=typeof A)throw new Error(`Expected newLocale to be a string; got ${ps(A)}`);const e=this._defaultLocale!==A;this._defaultLocale=A,e&&this.hasChanged()}translate(A,e){const t=function(A,e,t){let i=[{scope:e}];if(No(t.defaults)&&(i=i.concat(t.defaults)),No(t.defaultValue)){const n="function"==typeof t.defaultValue?t.defaultValue(A,e,t):t.defaultValue;i.push({message:n}),delete t.defaultValue}return i}(this,A,e=Object.assign({},e));let i;return t.some((A=>(No(A.scope)?i=ys(this,A.scope,e):No(A.message)&&(i=A.message),null!=i)))?("string"==typeof i?i=this.interpolate(this,i,e):"object"==typeof i&&i&&No(e.count)&&(i=vc({i18n:this,count:e.count||0,scope:i,options:e,baseScope:xs(this,A,e)})),e&&i instanceof Array&&(i=i.map((A=>"string"==typeof A?ms(this,A,e):A))),i):this.missingTranslation.get(A,e)}pluralize(A,e,t){return vc({i18n:this,count:A,scope:e,options:Object.assign({},t),baseScope:xs(this,e,null!=t?t:{})})}localize(A,e,t){if(t=Object.assign({},t),null==e)return"";switch(A){case"currency":return this.numberToCurrency(e);case"number":return Qs(e,Object.assign({delimiter:",",precision:3,separator:".",significant:!1,stripInsignificantZeros:!1},ys(this,"number.format")));case"percentage":return this.numberToPercentage(e);default:{let i;return i=A.match(/^(date|time)/)?this.toTime(A,e):e.toString(),ms(this,i,t)}}}toTime(A,e){const t=wc(e),i=ys(this,A);return t.toString().match(/invalid/i)?t.toString():i?this.strftime(t,i):t.toString()}numberToCurrency(A,e={}){return Qs(A,Object.assign(Object.assign(Object.assign({delimiter:",",format:"%u%n",precision:2,separator:".",significant:!1,stripInsignificantZeros:!1,unit:"$"},Po(this.get("number.format"))),Po(this.get("number.currency.format"))),e))}numberToPercentage(A,e={}){return Qs(A,Object.assign(Object.assign(Object.assign({delimiter:"",format:"%n%",precision:3,stripInsignificantZeros:!1,separator:".",significant:!1},Po(this.get("number.format"))),Po(this.get("number.percentage.format"))),e))}numberToHumanSize(A,e={}){return function(A,e,t){const i=ts(t.roundMode),n=1024,a=new es(e).abs(),r=a.lt(n);let o;const s=((A,e)=>{const t=Dc.length-1,i=new es(Math.log(A.toNumber())).div(Math.log(n)).integerValue(es.ROUND_DOWN).toNumber();return Math.min(t,i)})(a);o=r?a.integerValue():new es(fs(a.div(Math.pow(n,s)),{significant:t.significant,precision:t.precision,roundMode:t.roundMode}));const g=A.translate("number.human.storage_units.format",{defaultValue:"%n %u"}),c=A.translate(`number.human.storage_units.units.${r?"byte":Dc[s]}`,{count:a.integerValue().toNumber()});let l=o.toFixed(t.precision,i);return t.stripInsignificantZeros&&(l=l.replace(/(\..*?)0+$/,"$1").replace(/\.$/,"")),g.replace("%n",l).replace("%u",c)}(this,A,Object.assign(Object.assign(Object.assign({delimiter:"",precision:3,significant:!0,stripInsignificantZeros:!0,units:{billion:"Billion",million:"Million",quadrillion:"Quadrillion",thousand:"Thousand",trillion:"Trillion",unit:""}},Po(this.get("number.human.format"))),Po(this.get("number.human.storage_units"))),e))}numberToHuman(A,e={}){return function(A,e,t){const i={roundMode:t.roundMode,precision:t.precision,significant:t.significant};let n;if("string"===ps(t.units)){const e=t.units;if(n=ys(A,e),!n)throw new Error(`The scope "${A.locale}${A.defaultSeparator}${xs(A,e,{})}" couldn't be found`)}else n=t.units;let a=fs(new es(e),i);const r=((A,e)=>{const t=A.isZero()?0:Math.floor(Math.log10(A.abs().toNumber()));return(A=>mc(Object.keys(A).map((A=>Sc[A])),(A=>-1*A)))(e).find((A=>t>=A))||0})(new es(a),n),o=((A,e)=>A[_c[e.toString()]]||"")(n,r);if(a=fs(new es(a).div(Math.pow(10,r)),i),t.stripInsignificantZeros){let[A,e]=a.split(".");e=(e||"").replace(/0+$/,""),a=A,e&&(a+=`${t.separator}${e}`)}return t.format.replace("%n",a||"0").replace("%u",o).trim()}(this,A,Object.assign(Object.assign(Object.assign({delimiter:"",separator:".",precision:3,significant:!0,stripInsignificantZeros:!0,format:"%n %u",roundMode:"default",units:{billion:"Billion",million:"Million",quadrillion:"Quadrillion",thousand:"Thousand",trillion:"Trillion",unit:""}},Po(this.get("number.human.format"))),Po(this.get("number.human.decimal_units"))),e))}numberToRounded(A,e){return Qs(A,Object.assign({unit:"",precision:3,significant:!1,separator:".",delimiter:"",stripInsignificantZeros:!1},e))}numberToDelimited(A,e={}){return function(A,e){const t=new es(A);if(!t.isFinite())return A.toString();if(!e.delimiterPattern.global)throw new Error(`options.delimiterPattern must be a global regular expression; received ${e.delimiterPattern}`);let[i,n]=t.toString().split(".");return i=i.replace(e.delimiterPattern,(A=>`${A}${e.delimiter}`)),[i,n].filter(Boolean).join(e.separator)}(A,Object.assign({delimiterPattern:/(\d)(?=(\d\d\d)+(?!\d))/g,delimiter:",",separator:"."},e))}withLocale(A,e){return function(A,e,t,i){return new(t||(t=Promise))((function(n,a){function r(A){try{s(i.next(A))}catch(A){a(A)}}function o(A){try{s(i.throw(A))}catch(A){a(A)}}function s(A){var e;A.done?n(A.value):(e=A.value,e instanceof t?e:new t((function(A){A(e)}))).then(r,o)}s((i=i.apply(A,e||[])).next())}))}(this,void 0,void 0,(function*(){const t=this.locale;try{this.locale=A,yield e()}finally{this.locale=t}}))}strftime(A,e,t={}){return function(A,e,t={}){const{abbrDayNames:i,dayNames:n,abbrMonthNames:a,monthNames:r,meridian:o}=Object.assign(Object.assign({},Fc),t);if(isNaN(A.getTime()))throw new Error("strftime() requires a valid date object, but received an invalid date.");const s=A.getDay(),g=A.getDate(),c=A.getFullYear(),l=A.getMonth()+1,I=A.getHours();let C=I;const d=I>11?"pm":"am",h=A.getSeconds(),B=A.getMinutes(),u=A.getTimezoneOffset(),E=Math.floor(Math.abs(u/60)),f=Math.abs(u)-60*E,Q=(u>0?"-":"+")+(E.toString().length<2?"0"+E:E)+(f.toString().length<2?"0"+f:f);return C>12?C-=12:0===C&&(C=12),(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace("%a",i[s])).replace("%A",n[s])).replace("%b",a[l])).replace("%B",r[l])).replace("%d",g.toString().padStart(2,"0"))).replace("%e",g.toString())).replace("%-d",g.toString())).replace("%H",I.toString().padStart(2,"0"))).replace("%-H",I.toString())).replace("%k",I.toString())).replace("%I",C.toString().padStart(2,"0"))).replace("%-I",C.toString())).replace("%l",C.toString())).replace("%m",l.toString().padStart(2,"0"))).replace("%-m",l.toString())).replace("%M",B.toString().padStart(2,"0"))).replace("%-M",B.toString())).replace("%p",o[d])).replace("%P",o[d].toLowerCase())).replace("%S",h.toString().padStart(2,"0"))).replace("%-S",h.toString())).replace("%w",s.toString())).replace("%y",c.toString().padStart(2,"0").substr(-2))).replace("%-y",c.toString().padStart(2,"0").substr(-2).replace(/^0+/,""))).replace("%Y",c.toString())).replace(/%z/i,Q)}(A,e,Object.assign(Object.assign(Object.assign({},Po(ys(this,"date"))),{meridian:{am:ys(this,"time.am")||"AM",pm:ys(this,"time.pm")||"PM"}}),t))}update(A,e,t={strict:!1}){if(t.strict&&!ji(this.translations,A))throw new Error(`The path "${A}" is not currently defined`);const i=_i(this.translations,A),n=ps(i),a=ps(e);if(t.strict&&n!==a)throw new Error(`The current type for "${A}" is "${n}", but you're trying to override it with "${a}"`);let r;r="object"===a?Object.assign(Object.assign({},i),e):e;const o=A.split(this.defaultSeparator),s=o.pop();let g=this.translations;for(const A of o)g[A]||(g[A]={}),g=g[A];g[s]=r,this.hasChanged()}toSentence(A,e={}){const{wordsConnector:t,twoWordsConnector:i,lastWordConnector:n}=Object.assign(Object.assign({wordsConnector:", ",twoWordsConnector:" and ",lastWordConnector:", and "},Po(ys(this,"support.array"))),e),a=A.length;switch(a){case 0:return"";case 1:return`${A[0]}`;case 2:return A.join(i);default:return[A.slice(0,a-1).join(t),n,A[a-1]].join("")}}timeAgoInWords(A,e,t={}){return function(A,e,t,i={}){const n=i.scope||"datetime.distance_in_words",a=(e,t=0)=>A.t(e,{count:t,scope:n});e=wc(e),t=wc(t);let r=e.getTime()/1e3,o=t.getTime()/1e3;r>o&&([e,t,r,o]=[t,e,o,r]);const s=Math.round(o-r),g=Math.round((o-r)/60),c=g/60/24,l=Math.round(g/60),I=Math.round(c),C=Math.round(I/30);if(Mc(0,1,g))return i.includeSeconds?Mc(0,4,s)?a("less_than_x_seconds",5):Mc(5,9,s)?a("less_than_x_seconds",10):Mc(10,19,s)?a("less_than_x_seconds",20):Mc(20,39,s)?a("half_a_minute"):Mc(40,59,s)?a("less_than_x_minutes",1):a("x_minutes",1):0===g?a("less_than_x_minutes",1):a("x_minutes",g);if(Mc(2,44,g))return a("x_minutes",g);if(Mc(45,89,g))return a("about_x_hours",1);if(Mc(90,1439,g))return a("about_x_hours",l);if(Mc(1440,2519,g))return a("x_days",1);if(Mc(2520,43199,g))return a("x_days",I);if(Mc(43200,86399,g))return a("about_x_months",Math.round(g/43200));if(Mc(86400,525599,g))return a("x_months",C);let d=e.getFullYear();e.getMonth()+1>=3&&(d+=1);let h=t.getFullYear();t.getMonth()+1<3&&(h-=1);const B=525600,u=g-1440*(d>h?0:Nc(d,h).filter((A=>1==new Date(A,1,29).getMonth())).length),E=Math.trunc(u/B),f=parseFloat((u/B-E).toPrecision(3));return f<.25?a("about_x_years",E):f<.75?a("over_x_years",E):a("almost_x_years",E+1)}(this,A,e,t)}onChange(A){return this.onChangeHandlers.push(A),()=>{this.onChangeHandlers.splice(this.onChangeHandlers.indexOf(A),1)}}get version(){return this._version}formatNumber(A,e={}){return Qs(A,e=Object.assign(Object.assign({delimiter:",",precision:3,separator:".",unit:"",format:"%u%n",significant:!1,stripInsignificantZeros:!1},Po(this.get("number.format"))),e))}get(A){return ys(this,A)}runCallbacks(){this.onChangeHandlers.forEach((A=>A(this)))}hasChanged(){this._version+=1,this.runCallbacks()}};var Hc=function(){function A(A,e){this._i18n=new Jc(A,e)}var e=A.prototype;return e.t=function(A,e){return this._i18n.t(A,e)},e.appendTranslations=function(A){var e=this;Object.keys(A).forEach((function(t){e._i18n.translations[t]=Object.assign(e._i18n.translations[t]||{},A[t])}))},e.switchTranslation=function(A){this._i18n.locale=A},e.getCurrentLocale=function(){return this._i18n.locale},e.getCurrentTranslation=function(){return this._i18n.translations[this._i18n.locale]},e.getTranslations=function(){return this._i18n.translations},e.onChange=function(A){var e=this;return this._i18n.onChange((function(){return A(e)}))},e.getVersion=function(){return"1.0.1"},A}(),Kc=Hc,Vc={},Wc=function(A){var e=A.split("?")[1],t={};if(e)for(var i=e.split("&"),n=0;n2?a[1]:"sd"),"rec"===e.type&&(e.recType=a.length>2?a[1]:""),e.searchParams=Wc(A),e}return{}}Vc.getQuery=Wc,Vc.isHttp=function(A){return/^http[s]?:\/\//.test(A)},Vc.isMobile=function(A){var e,t;return!!((null!=A?A:null==(t=window)||null==(e=t.navigator)?void 0:e.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)},Vc.parseEzopenUrl=jc,Vc.pick=function(A,e){return Object.entries(A).reduce((function(A,t){var i=t[0],n=t[1];return e.includes(i)&&(A[i]=n),A}),{})},Vc.switchEzopenUrl=function(A,e){var t=null!=e?e:{},i=t.type,n=t.recType,a=t.search,r=t.definition,o=t.channelNo,s=t.deviceSerial,g=t.validateCode,c=jc(A);if(a){var l=Object.assign({},c.searchParams,Wc("?"+a.replace("?","")));a=Object.entries(l).reduce((function(A,e){var t=e[0],i=e[1];return""===i?A:A+=t+"="+encodeURIComponent(i)+"&"}),"?").replace(/&$/,"")}else a=c.search;return i=i||c.type,n=null!=n?n:c.recType,r=null!=r?r:c.definition,o=o||c.channelNo,s=s||c.deviceSerial,g=null!=g?g:c.validateCode,c.protocol+"//"+(g?g+"@":"")+c.hostname+"/"+s+"/"+o+("rec"===i&&n?"."+n:"")+("live"===i&&"hd"===r?"."+r:"")+"."+i+a};var Oc={exports:{}};!function(A,e){A.exports=function(){var A=1e3,e=6e4,t=36e5,i="millisecond",n="second",a="minute",r="hour",o="day",s="week",g="month",c="quarter",l="year",I="date",C="Invalid Date",d=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,B={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(A){var e=["th","st","nd","rd"],t=A%100;return"["+A+(e[(t-20)%10]||e[t]||e[0])+"]"}},u=function(A,e,t){var i=String(A);return!i||i.length>=e?A:""+Array(e+1-i.length).join(t)+A},E={s:u,z:function(A){var e=-A.utcOffset(),t=Math.abs(e),i=Math.floor(t/60),n=t%60;return(e<=0?"+":"-")+u(i,2,"0")+":"+u(n,2,"0")},m:function A(e,t){if(e.date()1)return A(r[0])}else{var o=e.name;Q[o]=e,n=o}return!i&&n&&(f=n),n||!i&&f},y=function(A,e){if(p(A))return A.clone();var t="object"==typeof e?e:{};return t.date=A,t.args=arguments,new S(t)},_=E;_.l=m,_.i=p,_.w=function(A,e){return y(A,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function B(A){this.$L=m(A.locale,null,!0),this.parse(A),this.$x=this.$x||A.x||{},this[x]=!0}var u=B.prototype;return u.parse=function(A){this.$d=function(A){var e=A.date,t=A.utc;if(null===e)return new Date(NaN);if(_.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(d);if(i){var n=i[2]-1||0,a=(i[7]||"0").substring(0,3);return t?new Date(Date.UTC(i[1],n,i[3]||1,i[4]||0,i[5]||0,i[6]||0,a)):new Date(i[1],n,i[3]||1,i[4]||0,i[5]||0,i[6]||0,a)}}return new Date(e)}(A),this.init()},u.init=function(){var A=this.$d;this.$y=A.getFullYear(),this.$M=A.getMonth(),this.$D=A.getDate(),this.$W=A.getDay(),this.$H=A.getHours(),this.$m=A.getMinutes(),this.$s=A.getSeconds(),this.$ms=A.getMilliseconds()},u.$utils=function(){return _},u.isValid=function(){return!(this.$d.toString()===C)},u.isSame=function(A,e){var t=y(A);return this.startOf(e)<=t&&t<=this.endOf(e)},u.isAfter=function(A,e){return y(A)0?2===s.length?typeof s[1]==n?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:3===s.length?typeof s[1]!==n||s[1].exec&&s[1].test?this[s[0]]=c?c.replace(s[1],s[2]):i:this[s[0]]=c?s[1].call(this,c,s[2]):i:4===s.length&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):i):this[s]=c||i;l+=2}},j=function(A,e){for(var t in e)if(typeof e[t]===r&&e[t].length>0){for(var n=0;n2&&(A[g]="iPad",A[l]=u),A},this.getEngine=function(){var A={};return A[c]=i,A[C]=i,W.call(A,E,Q.engine),A},this.getOS=function(){var A={};return A[c]=i,A[C]=i,W.call(A,E,Q.os),x&&!A[c]&&f&&"Unknown"!=f.platform&&(A[c]=f.platform.replace(/chrome os/i,G).replace(/macos/i,U)),A},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return E},this.setUA=function(A){return E=typeof A===o&&A.length>500?V(A,500):A,this},this.setUA(E),this};q.VERSION="1.0.37",q.BROWSER=J([c,C,s]),q.CPU=J([d]),q.DEVICE=J([g,I,l,h,B,E,u,f,Q]),q.ENGINE=q.OS=J([c,C]),A.exports&&(e=A.exports=q),e.UAParser=q;var X=typeof t!==a&&(t.jQuery||t.Zepto);if(X&&!X.ua){var z=new q;X.ua=z.getResult(),X.ua.get=function(){return z.getUA()},X.ua.set=function(A){z.setUA(A);var e=z.getResult();for(var t in e)X.ua[t]=e[t]}}}("object"==typeof window?window:D)}(qc,qc.exports);var Xc=qc.exports;!function(A,e){var t=Se,n=Kc,a=Vc,r=Zc,o=Xc,s=["attribute vec4 vertexPos;","attribute vec2 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos;","}"].join("\n"),g=["precision highp float;","varying highp vec2 textureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","const mat4 YUV2RGB = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","void main(void) {","highp float y = texture2D(ySampler, textureCoord).r;","highp float u = texture2D(uSampler, textureCoord).r;","highp float v = texture2D(vSampler, textureCoord).r;","gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n");window.SuperRender=function(){function A(A){this.canvasElement=document.getElementById(A),this.initContextGL(),this.contextGL&&(this.YUVProgram=this.initProgram(s,g),this.initBuffers(),this.initTextures())}return A.prototype.initContextGL=function(){var A=this.canvasElement,e=null;try{e=A.getContext("webgl")||A.getContext("experimental-webgl")}catch(A){e=null}e&&"function"==typeof e.getParameter||(e=null),this.contextGL=e},A.prototype.initProgram=function(A,e){var t=this.contextGL,i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,A),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS);var n=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(n,e),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS);var a=t.createProgram();return t.attachShader(a,i),t.attachShader(a,n),t.linkProgram(a),t.getProgramParameter(a,t.LINK_STATUS),t.deleteShader(i),t.deleteShader(n),a},A.prototype.initBuffers=function(){var A=this.contextGL,e=A.createBuffer();A.bindBuffer(A.ARRAY_BUFFER,e),A.bufferData(A.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),A.STATIC_DRAW),A.bindBuffer(A.ARRAY_BUFFER,null);var t=A.createBuffer();A.bindBuffer(A.ARRAY_BUFFER,t),A.bufferData(A.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),A.DYNAMIC_DRAW),A.bindBuffer(A.ARRAY_BUFFER,null),this.vertexPosBuffer=e,this.texturePosBuffer=t},A.prototype.initTexture=function(){var A=this.contextGL,e=A.createTexture();return A.bindTexture(A.TEXTURE_2D,e),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MAG_FILTER,A.LINEAR),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MIN_FILTER,A.LINEAR),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE),A.bindTexture(A.TEXTURE_2D,null),e},A.prototype.initTextures=function(){var A=this.contextGL,e=this.YUVProgram;A.useProgram(e);var t=this.initTexture(),i=A.getUniformLocation(e,"ySampler");A.uniform1i(i,0),this.yTextureRef=t;var n=this.initTexture(),a=A.getUniformLocation(e,"uSampler");A.uniform1i(a,1),this.uTextureRef=n;var r=this.initTexture(),o=A.getUniformLocation(e,"vSampler");A.uniform1i(o,2),this.vTextureRef=r,A.useProgram(null)},A.prototype.SR_DisplayFrameData=function(A,e,t,i,n){if(!(A<=0||e<=0)){var a=this.contextGL;if(null==t)return a.clearColor(0,0,0,0),void a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);var r=this.canvasElement;this.nWindowWidth=r.width,this.nWindowHeight=r.height;var o=this.nWindowWidth,s=this.nWindowHeight;a.clearColor(.8,.8,1,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT),a.viewport(0,0,o,s),this.updateFrameData(A,e,t,i,n);var g=this.YUVProgram;a.useProgram(g);var c=this.vertexPosBuffer;a.bindBuffer(a.ARRAY_BUFFER,c);var l=a.getAttribLocation(g,"vertexPos");a.enableVertexAttribArray(l),a.vertexAttribPointer(l,2,a.FLOAT,!1,0,0),a.bindBuffer(a.ARRAY_BUFFER,null);var I=this.texturePosBuffer;a.bindBuffer(a.ARRAY_BUFFER,I);var C=a.getAttribLocation(g,"texturePos");a.enableVertexAttribArray(C),a.vertexAttribPointer(C,2,a.FLOAT,!1,0,0),a.bindBuffer(a.ARRAY_BUFFER,null),a.drawArrays(a.TRIANGLE_STRIP,0,4),a.disableVertexAttribArray(l),a.disableVertexAttribArray(C),a.useProgram(null)}},A.prototype.updateFrameData=function(A,e,t,i,n){var a=this.contextGL,r=this.yTextureRef,o=this.uTextureRef,s=this.vTextureRef,g=t;if(A==i&&e==n){var c=A*e,l=g.subarray(0,c);a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,A,e,0,a.LUMINANCE,a.UNSIGNED_BYTE,l);var I=A/2*e/2,C=g.subarray(A*e,A*e+I);a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,s),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,A/2,e/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,C);var d=I,h=g.subarray(A*e+A*e/4,A*e+A*e/4+d);a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,o),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,A/2,e/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,h)}else{c=i*n,l=new Uint8Array(c);for(var B=0;B0&&i>0){var a=A.left/t,r=A.top/i,o=A.right/t,s=A.bottom/i;n=new Float32Array([o,r,a,r,o,s,a,s])}else n=new Float32Array([1,0,0,0,1,1,0,1]);var g=this.texturePosBuffer;e.bindBuffer(e.ARRAY_BUFFER,g),e.bufferSubData(e.ARRAY_BUFFER,0,n),e.bindBuffer(e.ARRAY_BUFFER,null)},A.prototype.SR_Destroy=function(){var A=this.contextGL,e=this.YUVProgram;A.deleteProgram(e);var t=this.vertexPosBuffer,i=this.texturePosBuffer;A.deleteBuffer(t),A.deleteBuffer(i);var n=this.yTextureRef,a=this.uTextureRef,r=this.vTextureRef;A.deleteTexture(n),A.deleteTexture(a),A.deleteTexture(r)},A}(),function(){var A=function(){function A(A,e){for(var t=0;t0&&e-1 in A)}function y(A,e){return A.nodeName&&A.nodeName.toLowerCase()===e.toLowerCase()}p.fn=p.prototype={jquery:Q,constructor:p,length:0,toArray:function(){return n.call(this)},get:function(A){return null==A?n.call(this):A<0?this[A+this.length]:this[A]},pushStack:function(A){var e=p.merge(this.constructor(),A);return e.prevObject=this,e},each:function(A){return p.each(this,A)},map:function(A){return this.pushStack(p.map(this,(function(e,t){return A.call(e,t,e)})))},slice:function(){return this.pushStack(n.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(p.grep(this,(function(A,e){return(e+1)%2})))},odd:function(){return this.pushStack(p.grep(this,(function(A,e){return e%2})))},eq:function(A){var e=this.length,t=+A+(A<0?e:0);return this.pushStack(t>=0&&t+~]|"+w+")"+w+"*"),U=new RegExp(w+"|>"),J=new RegExp(T),H=new RegExp("^"+N+"$"),K={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+T),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+w+"*(even|odd|(([+-]|)(\\d*)n|)"+w+"*(?:([+-]|)"+w+"*(\\d+)|))"+w+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+w+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+w+"*((?:-\\d)?\\d*)"+w+"*\\)|)(?=[^-]|$)","i")},V=/^(?:input|select|textarea|button)$/i,W=/^h\d$/i,j=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,O=/[+~]/,Z=new RegExp("\\\\[\\da-fA-F]{1,6}"+w+"?|\\\\([^\\r\\n\\f])","g"),q=function(A,e){var t="0x"+A.slice(1)-65536;return e||(t<0?String.fromCharCode(t+65536):String.fromCharCode(t>>10|55296,1023&t|56320))},X=function(){sA()},z=IA((function(A){return!0===A.disabled&&y(A,"fieldset")}),{dir:"parentNode",next:"legend"});try{B.apply(t=n.call(R.childNodes),R.childNodes),t[R.childNodes.length].nodeType}catch(A){B={apply:function(A,e){k.apply(A,n.call(e))},call:function(A){k.apply(A,n.call(arguments,1))}}}function $(A,e,t,i){var n,a,r,o,s,c,l,h=e&&e.ownerDocument,E=e?e.nodeType:9;if(t=t||[],"string"!=typeof A||!A||1!==E&&9!==E&&11!==E)return t;if(!i&&(sA(e),e=e||g,I)){if(11!==E&&(s=j.exec(A)))if(n=s[1]){if(9===E){if(!(r=e.getElementById(n)))return t;if(r.id===n)return B.call(t,r),t}else if(h&&(r=h.getElementById(n))&&$.contains(e,r)&&r.id===n)return B.call(t,r),t}else{if(s[2])return B.apply(t,e.getElementsByTagName(A)),t;if((n=s[3])&&e.getElementsByClassName)return B.apply(t,e.getElementsByClassName(n)),t}if(!(F[A+" "]||d&&d.test(A))){if(l=A,h=e,1===E&&(U.test(A)||G.test(A))){for((h=O.test(A)&&oA(e.parentNode)||e)==e&&C.scope||((o=e.getAttribute("id"))?o=p.escapeSelector(o):e.setAttribute("id",o=u)),a=(c=cA(A)).length;a--;)c[a]=(o?"#"+o:":scope")+" "+lA(c[a]);l=c.join(",")}try{return B.apply(t,h.querySelectorAll(l)),t}catch(e){F(A,!0)}finally{o===u&&e.removeAttribute("id")}}}return EA(A.replace(v,"$1"),e,t,i)}function AA(){var A=[];return function e(t,n){return A.push(t+" ")>i.cacheLength&&delete e[A.shift()],e[t+" "]=n}}function eA(A){return A[u]=!0,A}function tA(A){var e=g.createElement("fieldset");try{return!!A(e)}catch(A){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function iA(A){return function(e){return y(e,"input")&&e.type===A}}function nA(A){return function(e){return(y(e,"input")||y(e,"button"))&&e.type===A}}function aA(A){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===A:e.disabled===A:e.isDisabled===A||e.isDisabled!==!A&&z(e)===A:e.disabled===A:"label"in e&&e.disabled===A}}function rA(A){return eA((function(e){return e=+e,eA((function(t,i){for(var n,a=A([],t.length,e),r=a.length;r--;)t[n=a[r]]&&(t[n]=!(i[n]=t[n]))}))}))}function oA(A){return A&&void 0!==A.getElementsByTagName&&A}function sA(A){var e,t=A?A.ownerDocument||A:R;return t!=g&&9===t.nodeType&&t.documentElement?(l=(g=t).documentElement,I=!p.isXMLDoc(g),h=l.matches||l.webkitMatchesSelector||l.msMatchesSelector,l.msMatchesSelector&&R!=g&&(e=g.defaultView)&&e.top!==e&&e.addEventListener("unload",X),C.getById=tA((function(A){return l.appendChild(A).id=p.expando,!g.getElementsByName||!g.getElementsByName(p.expando).length})),C.disconnectedMatch=tA((function(A){return h.call(A,"*")})),C.scope=tA((function(){return g.querySelectorAll(":scope")})),C.cssHas=tA((function(){try{return g.querySelector(":has(*,:jqfake)"),!1}catch(A){return!0}})),C.getById?(i.filter.ID=function(A){var e=A.replace(Z,q);return function(A){return A.getAttribute("id")===e}},i.find.ID=function(A,e){if(void 0!==e.getElementById&&I){var t=e.getElementById(A);return t?[t]:[]}}):(i.filter.ID=function(A){var e=A.replace(Z,q);return function(A){var t=void 0!==A.getAttributeNode&&A.getAttributeNode("id");return t&&t.value===e}},i.find.ID=function(A,e){if(void 0!==e.getElementById&&I){var t,i,n,a=e.getElementById(A);if(a){if((t=a.getAttributeNode("id"))&&t.value===A)return[a];for(n=e.getElementsByName(A),i=0;a=n[i++];)if((t=a.getAttributeNode("id"))&&t.value===A)return[a]}return[]}}),i.find.TAG=function(A,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(A):e.querySelectorAll(A)},i.find.CLASS=function(A,e){if(void 0!==e.getElementsByClassName&&I)return e.getElementsByClassName(A)},d=[],tA((function(A){var e;l.appendChild(A).innerHTML="",A.querySelectorAll("[selected]").length||d.push("\\["+w+"*(?:value|"+P+")"),A.querySelectorAll("[id~="+u+"-]").length||d.push("~="),A.querySelectorAll("a#"+u+"+*").length||d.push(".#.+[+~]"),A.querySelectorAll(":checked").length||d.push(":checked"),(e=g.createElement("input")).setAttribute("type","hidden"),A.appendChild(e).setAttribute("name","D"),l.appendChild(A).disabled=!0,2!==A.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(e=g.createElement("input")).setAttribute("name",""),A.appendChild(e),A.querySelectorAll("[name='']").length||d.push("\\["+w+"*name"+w+"*="+w+"*(?:''|\"\")")})),C.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),b=function(A,e){if(A===e)return s=!0,0;var t=!A.compareDocumentPosition-!e.compareDocumentPosition;return t||(1&(t=(A.ownerDocument||A)==(e.ownerDocument||e)?A.compareDocumentPosition(e):1)||!C.sortDetached&&e.compareDocumentPosition(A)===t?A===g||A.ownerDocument==R&&$.contains(R,A)?-1:e===g||e.ownerDocument==R&&$.contains(R,e)?1:r?o.call(r,A)-o.call(r,e):0:4&t?-1:1)},g):g}for(e in $.matches=function(A,e){return $(A,null,null,e)},$.matchesSelector=function(A,e){if(sA(A),I&&!F[e+" "]&&(!d||!d.test(e)))try{var t=h.call(A,e);if(t||C.disconnectedMatch||A.document&&11!==A.document.nodeType)return t}catch(A){F(e,!0)}return $(e,g,null,[A]).length>0},$.contains=function(A,e){return(A.ownerDocument||A)!=g&&sA(A),p.contains(A,e)},$.attr=function(A,e){(A.ownerDocument||A)!=g&&sA(A);var t=i.attrHandle[e.toLowerCase()],n=t&&c.call(i.attrHandle,e.toLowerCase())?t(A,e,!I):void 0;return void 0!==n?n:A.getAttribute(e)},$.error=function(A){throw new Error("Syntax error, unrecognized expression: "+A)},p.uniqueSort=function(A){var e,t=[],i=0,a=0;if(s=!C.sortStable,r=!C.sortStable&&n.call(A,0),S.call(A,b),s){for(;e=A[a++];)e===A[a]&&(i=t.push(a));for(;i--;)D.call(A,t[i],1)}return r=null,A},p.fn.uniqueSort=function(){return this.pushStack(p.uniqueSort(n.apply(this)))},i=p.expr={cacheLength:50,createPseudo:eA,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(A){return A[1]=A[1].replace(Z,q),A[3]=(A[3]||A[4]||A[5]||"").replace(Z,q),"~="===A[2]&&(A[3]=" "+A[3]+" "),A.slice(0,4)},CHILD:function(A){return A[1]=A[1].toLowerCase(),"nth"===A[1].slice(0,3)?(A[3]||$.error(A[0]),A[4]=+(A[4]?A[5]+(A[6]||1):2*("even"===A[3]||"odd"===A[3])),A[5]=+(A[7]+A[8]||"odd"===A[3])):A[3]&&$.error(A[0]),A},PSEUDO:function(A){var e,t=!A[6]&&A[2];return K.CHILD.test(A[0])?null:(A[3]?A[2]=A[4]||A[5]||"":t&&J.test(t)&&(e=cA(t,!0))&&(e=t.indexOf(")",t.length-e)-t.length)&&(A[0]=A[0].slice(0,e),A[2]=t.slice(0,e)),A.slice(0,3))}},filter:{TAG:function(A){var e=A.replace(Z,q).toLowerCase();return"*"===A?function(){return!0}:function(A){return y(A,e)}},CLASS:function(A){var e=Q[A+" "];return e||(e=new RegExp("(^|"+w+")"+A+"("+w+"|$)"))&&Q(A,(function(A){return e.test("string"==typeof A.className&&A.className||void 0!==A.getAttribute&&A.getAttribute("class")||"")}))},ATTR:function(A,e,t){return function(i){var n=$.attr(i,A);return null==n?"!="===e:!e||(n+="","="===e?n===t:"!="===e?n!==t:"^="===e?t&&0===n.indexOf(t):"*="===e?t&&n.indexOf(t)>-1:"$="===e?t&&n.slice(-t.length)===t:"~="===e?(" "+n.replace(L," ")+" ").indexOf(t)>-1:"|="===e&&(n===t||n.slice(0,t.length+1)===t+"-"))}},CHILD:function(A,e,t,i,n){var a="nth"!==A.slice(0,3),r="last"!==A.slice(-4),o="of-type"===e;return 1===i&&0===n?function(A){return!!A.parentNode}:function(e,t,s){var g,c,l,I,C,d=a!==r?"nextSibling":"previousSibling",h=e.parentNode,B=o&&e.nodeName.toLowerCase(),f=!s&&!o,Q=!1;if(h){if(a){for(;d;){for(l=e;l=l[d];)if(o?y(l,B):1===l.nodeType)return!1;C=d="only"===A&&!C&&"nextSibling"}return!0}if(C=[r?h.firstChild:h.lastChild],r&&f){for(Q=(I=(g=(c=h[u]||(h[u]={}))[A]||[])[0]===E&&g[1])&&g[2],l=I&&h.childNodes[I];l=++I&&l&&l[d]||(Q=I=0)||C.pop();)if(1===l.nodeType&&++Q&&l===e){c[A]=[E,I,Q];break}}else if(f&&(Q=I=(g=(c=e[u]||(e[u]={}))[A]||[])[0]===E&&g[1]),!1===Q)for(;(l=++I&&l&&l[d]||(Q=I=0)||C.pop())&&(!(o?y(l,B):1===l.nodeType)||!++Q||(f&&((c=l[u]||(l[u]={}))[A]=[E,Q]),l!==e)););return(Q-=n)===i||Q%i==0&&Q/i>=0}}},PSEUDO:function(A,e){var t,n=i.pseudos[A]||i.setFilters[A.toLowerCase()]||$.error("unsupported pseudo: "+A);return n[u]?n(e):n.length>1?(t=[A,A,"",e],i.setFilters.hasOwnProperty(A.toLowerCase())?eA((function(A,t){for(var i,a=n(A,e),r=a.length;r--;)A[i=o.call(A,a[r])]=!(t[i]=a[r])})):function(A){return n(A,0,t)}):n}},pseudos:{not:eA((function(A){var e=[],t=[],i=uA(A.replace(v,"$1"));return i[u]?eA((function(A,e,t,n){for(var a,r=i(A,null,n,[]),o=A.length;o--;)(a=r[o])&&(A[o]=!(e[o]=a))})):function(A,n,a){return e[0]=A,i(e,null,a,t),e[0]=null,!t.pop()}})),has:eA((function(A){return function(e){return $(A,e).length>0}})),contains:eA((function(A){return A=A.replace(Z,q),function(e){return(e.textContent||p.text(e)).indexOf(A)>-1}})),lang:eA((function(A){return H.test(A||"")||$.error("unsupported lang: "+A),A=A.replace(Z,q).toLowerCase(),function(e){var t;do{if(t=I?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===A||0===t.indexOf(A+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}})),target:function(e){var t=A.location&&A.location.hash;return t&&t.slice(1)===e.id},root:function(A){return A===l},focus:function(A){return A===function(){try{return g.activeElement}catch(A){}}()&&g.hasFocus()&&!!(A.type||A.href||~A.tabIndex)},enabled:aA(!1),disabled:aA(!0),checked:function(A){return y(A,"input")&&!!A.checked||y(A,"option")&&!!A.selected},selected:function(A){return A.parentNode&&A.parentNode.selectedIndex,!0===A.selected},empty:function(A){for(A=A.firstChild;A;A=A.nextSibling)if(A.nodeType<6)return!1;return!0},parent:function(A){return!i.pseudos.empty(A)},header:function(A){return W.test(A.nodeName)},input:function(A){return V.test(A.nodeName)},button:function(A){return y(A,"input")&&"button"===A.type||y(A,"button")},text:function(A){var e;return y(A,"input")&&"text"===A.type&&(null==(e=A.getAttribute("type"))||"text"===e.toLowerCase())},first:rA((function(){return[0]})),last:rA((function(A,e){return[e-1]})),eq:rA((function(A,e,t){return[t<0?t+e:t]})),even:rA((function(A,e){for(var t=0;te?e:t;--i>=0;)A.push(i);return A})),gt:rA((function(A,e,t){for(var i=t<0?t+e:t;++i1?function(e,t,i){for(var n=A.length;n--;)if(!A[n](e,t,i))return!1;return!0}:A[0]}function dA(A,e,t,i,n){for(var a,r=[],o=0,s=A.length,g=null!=e;o-1&&(a[c]=!(r[c]=I))}}else C=dA(C===r?C.splice(u,C.length):C),n?n(null,r,C,g):B.apply(r,C)}))}function BA(A){for(var e,t,n,r=A.length,s=i.relative[A[0].type],g=s||i.relative[" "],c=s?1:0,l=IA((function(A){return A===e}),g,!0),I=IA((function(A){return o.call(e,A)>-1}),g,!0),C=[function(A,t,i){var n=!s&&(i||t!=a)||((e=t).nodeType?l(A,t,i):I(A,t,i));return e=null,n}];c1&&CA(C),c>1&&lA(A.slice(0,c-1).concat({value:" "===A[c-2].type?"*":""})).replace(v,"$1"),t,c0,n=A.length>0,r=function(r,o,s,c,l){var C,d,h,u=0,f="0",Q=r&&[],x=[],m=a,y=r||n&&i.find.TAG("*",l),S=E+=null==m?1:Math.random()||.1,D=y.length;for(l&&(a=o==g||o||l);f!==D&&null!=(C=y[f]);f++){if(n&&C){for(d=0,o||C.ownerDocument==g||(sA(C),s=!I);h=A[d++];)if(h(C,o||g,s)){B.call(c,C);break}l&&(E=S)}t&&((C=!h&&C)&&u--,r&&Q.push(C))}if(u+=f,t&&f!==u){for(d=0;h=e[d++];)h(Q,x,o,s);if(r){if(u>0)for(;f--;)Q[f]||x[f]||(x[f]=_.call(c));x=dA(x)}B.apply(c,x),l&&!r&&x.length>0&&u+e.length>1&&p.uniqueSort(c)}return l&&(E=S,a=m),Q};return t?eA(r):r}(r,n)),o.selector=A}return o}function EA(A,e,t,n){var a,r,o,s,g,c="function"==typeof A&&A,l=!n&&cA(A=c.selector||A);if(t=t||[],1===l.length){if((r=l[0]=l[0].slice(0)).length>2&&"ID"===(o=r[0]).type&&9===e.nodeType&&I&&i.relative[r[1].type]){if(!(e=(i.find.ID(o.matches[0].replace(Z,q),e)||[])[0]))return t;c&&(e=e.parentNode),A=A.slice(r.shift().value.length)}for(a=K.needsContext.test(A)?0:r.length;a--&&(o=r[a],!i.relative[s=o.type]);)if((g=i.find[s])&&(n=g(o.matches[0].replace(Z,q),O.test(r[0].type)&&oA(e.parentNode)||e))){if(r.splice(a,1),!(A=n.length&&lA(r)))return B.apply(t,n),t;break}}return(c||uA(A,l))(n,e,!I,t,!e||O.test(A)&&oA(e.parentNode)||e),t}gA.prototype=i.filters=i.pseudos,i.setFilters=new gA,C.sortStable=u.split("").sort(b).join("")===u,sA(),C.sortDetached=tA((function(A){return 1&A.compareDocumentPosition(g.createElement("fieldset"))})),p.find=$,p.expr[":"]=p.expr.pseudos,p.unique=p.uniqueSort,$.compile=uA,$.select=EA,$.setDocument=sA,$.tokenize=cA,$.escape=p.escapeSelector,$.getText=p.text,$.isXML=p.isXMLDoc,$.selectors=p.expr,$.support=p.support,$.uniqueSort=p.uniqueSort}();var P=function(A,e,t){for(var i=[],n=void 0!==t;(A=A[e])&&9!==A.nodeType;)if(1===A.nodeType){if(n&&p(A).is(t))break;i.push(A)}return i},N=function(A,e){for(var t=[];A;A=A.nextSibling)1===A.nodeType&&A!==e&&t.push(A);return t},M=p.expr.match.needsContext,T=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function L(A,e,t){return d(e)?p.grep(A,(function(A,i){return!!e.call(A,i,A)!==t})):e.nodeType?p.grep(A,(function(A){return A===e!==t})):"string"!=typeof e?p.grep(A,(function(A){return o.call(e,A)>-1!==t})):p.filter(e,A,t)}p.filter=function(A,e,t){var i=e[0];return t&&(A=":not("+A+")"),1===e.length&&1===i.nodeType?p.find.matchesSelector(i,A)?[i]:[]:p.find.matches(A,p.grep(e,(function(A){return 1===A.nodeType})))},p.fn.extend({find:function(A){var e,t,i=this.length,n=this;if("string"!=typeof A)return this.pushStack(p(A).filter((function(){for(e=0;e1?p.uniqueSort(t):t},filter:function(A){return this.pushStack(L(this,A||[],!1))},not:function(A){return this.pushStack(L(this,A||[],!0))},is:function(A){return!!L(this,"string"==typeof A&&M.test(A)?p(A):A||[],!1).length}});var Y,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,U=p.fn.init=function(A,e,t){var i,n;if(!A)return this;if(t=t||Y,"string"==typeof A){if(!(i="<"===A[0]&&">"===A[A.length-1]&&A.length>=3?[null,A,null]:G.exec(A))||!i[1]&&e)return!e||e.jquery?(e||t).find(A):this.constructor(e).find(A);if(i[1]){if(e=e instanceof p?e[0]:e,p.merge(this,p.parseHTML(i[1],e&&e.nodeType?e.ownerDocument||e:B,!0)),T.test(i[1])&&p.isPlainObject(e))for(i in e)d(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return(n=B.getElementById(i[2]))&&(this[0]=n,this.length=1),this}return A.nodeType?(this[0]=A,this.length=1,this):d(A)?void 0!==t.ready?t.ready(A):A(p):p.makeArray(A,this)};U.prototype=p.fn,Y=p(B);var J=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function K(A,e){for(;(A=A[e])&&1!==A.nodeType;);return A}p.fn.extend({has:function(A){var e=p(A,this),t=e.length;return this.filter((function(){for(var A=0;A-1:1===t.nodeType&&p.find.matchesSelector(t,A))){a.push(t);break}return this.pushStack(a.length>1?p.uniqueSort(a):a)},index:function(A){return A?"string"==typeof A?o.call(p(A),this[0]):o.call(this,A.jquery?A[0]:A):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(A,e){return this.pushStack(p.uniqueSort(p.merge(this.get(),p(A,e))))},addBack:function(A){return this.add(null==A?this.prevObject:this.prevObject.filter(A))}}),p.each({parent:function(A){var e=A.parentNode;return e&&11!==e.nodeType?e:null},parents:function(A){return P(A,"parentNode")},parentsUntil:function(A,e,t){return P(A,"parentNode",t)},next:function(A){return K(A,"nextSibling")},prev:function(A){return K(A,"previousSibling")},nextAll:function(A){return P(A,"nextSibling")},prevAll:function(A){return P(A,"previousSibling")},nextUntil:function(A,e,t){return P(A,"nextSibling",t)},prevUntil:function(A,e,t){return P(A,"previousSibling",t)},siblings:function(A){return N((A.parentNode||{}).firstChild,A)},children:function(A){return N(A.firstChild)},contents:function(A){return null!=A.contentDocument&&i(A.contentDocument)?A.contentDocument:(y(A,"template")&&(A=A.content||A),p.merge([],A.childNodes))}},(function(A,e){p.fn[A]=function(t,i){var n=p.map(this,e,t);return"Until"!==A.slice(-5)&&(i=t),i&&"string"==typeof i&&(n=p.filter(i,n)),this.length>1&&(H[A]||p.uniqueSort(n),J.test(A)&&n.reverse()),this.pushStack(n)}}));var V=/[^\x20\t\r\n\f]+/g;function W(A){return A}function j(A){throw A}function O(A,e,t,i){var n;try{A&&d(n=A.promise)?n.call(A).done(e).fail(t):A&&d(n=A.then)?n.call(A,e,t):e.apply(void 0,[A].slice(i))}catch(A){t.apply(void 0,[A])}}p.Callbacks=function(A){A="string"==typeof A?function(A){var e={};return p.each(A.match(V)||[],(function(A,t){e[t]=!0})),e}(A):p.extend({},A);var e,t,i,n,a=[],r=[],o=-1,s=function(){for(n=n||A.once,i=e=!0;r.length;o=-1)for(t=r.shift();++o-1;)a.splice(t,1),t<=o&&o--})),this},has:function(A){return A?p.inArray(A,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return n=r=[],a=t="",this},disabled:function(){return!a},lock:function(){return n=r=[],t||e||(a=t=""),this},locked:function(){return!!n},fireWith:function(A,t){return n||(t=[A,(t=t||[]).slice?t.slice():t],r.push(t),e||s()),this},fire:function(){return g.fireWith(this,arguments),this},fired:function(){return!!i}};return g},p.extend({Deferred:function(e){var t=[["notify","progress",p.Callbacks("memory"),p.Callbacks("memory"),2],["resolve","done",p.Callbacks("once memory"),p.Callbacks("once memory"),0,"resolved"],["reject","fail",p.Callbacks("once memory"),p.Callbacks("once memory"),1,"rejected"]],i="pending",n={state:function(){return i},always:function(){return a.done(arguments).fail(arguments),this},catch:function(A){return n.then(null,A)},pipe:function(){var A=arguments;return p.Deferred((function(e){p.each(t,(function(t,i){var n=d(A[i[4]])&&A[i[4]];a[i[1]]((function(){var A=n&&n.apply(this,arguments);A&&d(A.promise)?A.promise().progress(e.notify).done(e.resolve).fail(e.reject):e[i[0]+"With"](this,n?[A]:arguments)}))})),A=null})).promise()},then:function(e,i,n){var a=0;function r(e,t,i,n){return function(){var o=this,s=arguments,g=function(){var A,g;if(!(e=a&&(i!==j&&(o=void 0,s=[A]),t.rejectWith(o,s))}};e?c():(p.Deferred.getErrorHook?c.error=p.Deferred.getErrorHook():p.Deferred.getStackHook&&(c.error=p.Deferred.getStackHook()),A.setTimeout(c))}}return p.Deferred((function(A){t[0][3].add(r(0,A,d(n)?n:W,A.notifyWith)),t[1][3].add(r(0,A,d(e)?e:W)),t[2][3].add(r(0,A,d(i)?i:j))})).promise()},promise:function(A){return null!=A?p.extend(A,n):n}},a={};return p.each(t,(function(A,e){var r=e[2],o=e[5];n[e[1]]=r.add,o&&r.add((function(){i=o}),t[3-A][2].disable,t[3-A][3].disable,t[0][2].lock,t[0][3].lock),r.add(e[3].fire),a[e[0]]=function(){return a[e[0]+"With"](this===a?void 0:this,arguments),this},a[e[0]+"With"]=r.fireWith})),n.promise(a),e&&e.call(a,a),a},when:function(A){var e=arguments.length,t=e,i=Array(t),a=n.call(arguments),r=p.Deferred(),o=function(A){return function(t){i[A]=this,a[A]=arguments.length>1?n.call(arguments):t,--e||r.resolveWith(i,a)}};if(e<=1&&(O(A,r.done(o(t)).resolve,r.reject,!e),"pending"===r.state()||d(a[t]&&a[t].then)))return r.then();for(;t--;)O(a[t],o(t),r.reject);return r.promise()}});var Z=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;p.Deferred.exceptionHook=function(e,t){A.console&&A.console.warn&&e&&Z.test(e.name)&&A.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},p.readyException=function(e){A.setTimeout((function(){throw e}))};var q=p.Deferred();function X(){B.removeEventListener("DOMContentLoaded",X),A.removeEventListener("load",X),p.ready()}p.fn.ready=function(A){return q.then(A).catch((function(A){p.readyException(A)})),this},p.extend({isReady:!1,readyWait:1,ready:function(A){(!0===A?--p.readyWait:p.isReady)||(p.isReady=!0,!0!==A&&--p.readyWait>0||q.resolveWith(B,[p]))}}),p.ready.then=q.then,"complete"===B.readyState||"loading"!==B.readyState&&!B.documentElement.doScroll?A.setTimeout(p.ready):(B.addEventListener("DOMContentLoaded",X),A.addEventListener("load",X));var z=function(A,e,t,i,n,a,r){var o=0,s=A.length,g=null==t;if("object"===f(t))for(o in n=!0,t)z(A,e,o,t[o],!0,a,r);else if(void 0!==i&&(n=!0,d(i)||(r=!0),g&&(r?(e.call(A,i),e=null):(g=e,e=function(A,e,t){return g.call(p(A),t)})),e))for(;o1,null,!0)},removeData:function(A){return this.each((function(){rA.remove(this,A)}))}}),p.extend({queue:function(A,e,t){var i;if(A)return e=(e||"fx")+"queue",i=aA.get(A,e),t&&(!i||Array.isArray(t)?i=aA.access(A,e,p.makeArray(t)):i.push(t)),i||[]},dequeue:function(A,e){e=e||"fx";var t=p.queue(A,e),i=t.length,n=t.shift(),a=p._queueHooks(A,e);"inprogress"===n&&(n=t.shift(),i--),n&&("fx"===e&&t.unshift("inprogress"),delete a.stop,n.call(A,(function(){p.dequeue(A,e)}),a)),!i&&a&&a.empty.fire()},_queueHooks:function(A,e){var t=e+"queueHooks";return aA.get(A,t)||aA.access(A,t,{empty:p.Callbacks("once memory").add((function(){aA.remove(A,[e+"queue",t])}))})}}),p.fn.extend({queue:function(A,e){var t=2;return"string"!=typeof A&&(e=A,A="fx",t--),arguments.length\x20\t\r\n\f]*)/i,_A=/^$|^module$|\/(?:java|ecma)script/i;xA=B.createDocumentFragment().appendChild(B.createElement("div")),(pA=B.createElement("input")).setAttribute("type","radio"),pA.setAttribute("checked","checked"),pA.setAttribute("name","t"),xA.appendChild(pA),C.checkClone=xA.cloneNode(!0).cloneNode(!0).lastChild.checked,xA.innerHTML="",C.noCloneChecked=!!xA.cloneNode(!0).lastChild.defaultValue,xA.innerHTML="",C.option=!!xA.lastChild;var SA={thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function DA(A,e){var t;return t=void 0!==A.getElementsByTagName?A.getElementsByTagName(e||"*"):void 0!==A.querySelectorAll?A.querySelectorAll(e||"*"):[],void 0===e||e&&y(A,e)?p.merge([A],t):t}function wA(A,e){for(var t=0,i=A.length;t",""]);var vA=/<|&#?\w+;/;function FA(A,e,t,i,n){for(var a,r,o,s,g,c,l=e.createDocumentFragment(),I=[],C=0,d=A.length;C-1)n&&n.push(a);else if(g=dA(a),r=DA(l.appendChild(a),"script"),g&&wA(r),t)for(c=0;a=r[c++];)_A.test(a.type||"")&&t.push(a);return l}var bA=/^([^.]*)(?:\.(.+)|)/;function RA(){return!0}function kA(){return!1}function PA(A,e,t,i,n,a){var r,o;if("object"==typeof e){for(o in"string"!=typeof t&&(i=i||t,t=void 0),e)PA(A,o,t,i,e[o],a);return A}if(null==i&&null==n?(n=t,i=t=void 0):null==n&&("string"==typeof t?(n=i,i=void 0):(n=i,i=t,t=void 0)),!1===n)n=kA;else if(!n)return A;return 1===a&&(r=n,n=function(A){return p().off(A),r.apply(this,arguments)},n.guid=r.guid||(r.guid=p.guid++)),A.each((function(){p.event.add(this,e,n,i,t)}))}function NA(A,e,t){t?(aA.set(A,e,!1),p.event.add(A,e,{namespace:!1,handler:function(A){var t,i=aA.get(this,e);if(1&A.isTrigger&&this[e]){if(i)(p.event.special[e]||{}).delegateType&&A.stopPropagation();else if(i=n.call(arguments),aA.set(this,e,i),this[e](),t=aA.get(this,e),aA.set(this,e,!1),i!==t)return A.stopImmediatePropagation(),A.preventDefault(),t}else i&&(aA.set(this,e,p.event.trigger(i[0],i.slice(1),this)),A.stopPropagation(),A.isImmediatePropagationStopped=RA)}})):void 0===aA.get(A,e)&&p.event.add(A,e,RA)}p.event={global:{},add:function(A,e,t,i,n){var a,r,o,s,g,c,l,I,C,d,h,B=aA.get(A);if(iA(A))for(t.handler&&(t=(a=t).handler,n=a.selector),n&&p.find.matchesSelector(CA,n),t.guid||(t.guid=p.guid++),(s=B.events)||(s=B.events=Object.create(null)),(r=B.handle)||(r=B.handle=function(e){return void 0!==p&&p.event.triggered!==e.type?p.event.dispatch.apply(A,arguments):void 0}),g=(e=(e||"").match(V)||[""]).length;g--;)C=h=(o=bA.exec(e[g])||[])[1],d=(o[2]||"").split(".").sort(),C&&(l=p.event.special[C]||{},C=(n?l.delegateType:l.bindType)||C,l=p.event.special[C]||{},c=p.extend({type:C,origType:h,data:i,handler:t,guid:t.guid,selector:n,needsContext:n&&p.expr.match.needsContext.test(n),namespace:d.join(".")},a),(I=s[C])||((I=s[C]=[]).delegateCount=0,l.setup&&!1!==l.setup.call(A,i,d,r)||A.addEventListener&&A.addEventListener(C,r)),l.add&&(l.add.call(A,c),c.handler.guid||(c.handler.guid=t.guid)),n?I.splice(I.delegateCount++,0,c):I.push(c),p.event.global[C]=!0)},remove:function(A,e,t,i,n){var a,r,o,s,g,c,l,I,C,d,h,B=aA.hasData(A)&&aA.get(A);if(B&&(s=B.events)){for(g=(e=(e||"").match(V)||[""]).length;g--;)if(C=h=(o=bA.exec(e[g])||[])[1],d=(o[2]||"").split(".").sort(),C){for(l=p.event.special[C]||{},I=s[C=(i?l.delegateType:l.bindType)||C]||[],o=o[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),r=a=I.length;a--;)c=I[a],!n&&h!==c.origType||t&&t.guid!==c.guid||o&&!o.test(c.namespace)||i&&i!==c.selector&&("**"!==i||!c.selector)||(I.splice(a,1),c.selector&&I.delegateCount--,l.remove&&l.remove.call(A,c));r&&!I.length&&(l.teardown&&!1!==l.teardown.call(A,d,B.handle)||p.removeEvent(A,C,B.handle),delete s[C])}else for(C in s)p.event.remove(A,C+e[g],t,i,!0);p.isEmptyObject(s)&&aA.remove(A,"handle events")}},dispatch:function(A){var e,t,i,n,a,r,o=new Array(arguments.length),s=p.event.fix(A),g=(aA.get(this,"events")||Object.create(null))[s.type]||[],c=p.event.special[s.type]||{};for(o[0]=s,e=1;e=1))for(;g!==this;g=g.parentNode||this)if(1===g.nodeType&&("click"!==A.type||!0!==g.disabled)){for(a=[],r={},t=0;t-1:p.find(n,this,null,[g]).length),r[n]&&a.push(i);a.length&&o.push({elem:g,handlers:a})}return g=this,s\s*$/g;function YA(A,e){return y(A,"table")&&y(11!==e.nodeType?e:e.firstChild,"tr")&&p(A).children("tbody")[0]||A}function GA(A){return A.type=(null!==A.getAttribute("type"))+"/"+A.type,A}function UA(A){return"true/"===(A.type||"").slice(0,5)?A.type=A.type.slice(5):A.removeAttribute("type"),A}function JA(A,e){var t,i,n,a,r,o;if(1===e.nodeType){if(aA.hasData(A)&&(o=aA.get(A).events))for(n in aA.remove(e,"handle events"),o)for(t=0,i=o[n].length;t1&&"string"==typeof B&&!C.checkClone&&TA.test(B))return A.each((function(n){var a=A.eq(n);u&&(e[0]=B.call(this,n,a.html())),KA(a,e,t,i)}));if(I&&(r=(n=FA(e,A[0].ownerDocument,!1,A,i)).firstChild,1===n.childNodes.length&&(n=r),r||i)){for(s=(o=p.map(DA(n,"script"),GA)).length;l0&&wA(r,!s&&DA(A,"script")),o},cleanData:function(A){for(var e,t,i,n=p.event.special,a=0;void 0!==(t=A[a]);a++)if(iA(t)){if(e=t[aA.expando]){if(e.events)for(i in e.events)n[i]?p.event.remove(t,i):p.removeEvent(t,i,e.handle);t[aA.expando]=void 0}t[rA.expando]&&(t[rA.expando]=void 0)}}}),p.fn.extend({detach:function(A){return VA(this,A,!0)},remove:function(A){return VA(this,A)},text:function(A){return z(this,(function(A){return void 0===A?p.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=A)}))}),null,A,arguments.length)},append:function(){return KA(this,arguments,(function(A){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||YA(this,A).appendChild(A)}))},prepend:function(){return KA(this,arguments,(function(A){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=YA(this,A);e.insertBefore(A,e.firstChild)}}))},before:function(){return KA(this,arguments,(function(A){this.parentNode&&this.parentNode.insertBefore(A,this)}))},after:function(){return KA(this,arguments,(function(A){this.parentNode&&this.parentNode.insertBefore(A,this.nextSibling)}))},empty:function(){for(var A,e=0;null!=(A=this[e]);e++)1===A.nodeType&&(p.cleanData(DA(A,!1)),A.textContent="");return this},clone:function(A,e){return A=null!=A&&A,e=null==e?A:e,this.map((function(){return p.clone(this,A,e)}))},html:function(A){return z(this,(function(A){var e=this[0]||{},t=0,i=this.length;if(void 0===A&&1===e.nodeType)return e.innerHTML;if("string"==typeof A&&!MA.test(A)&&!SA[(yA.exec(A)||["",""])[1].toLowerCase()]){A=p.htmlPrefilter(A);try{for(;t=0&&(s+=Math.max(0,Math.ceil(A["offset"+e[0].toUpperCase()+e.slice(1)]-a-s-o-.5))||0),s+g}function se(A,e,t){var i=OA(A),n=(!C.boxSizingReliable()||t)&&"border-box"===p.css(A,"boxSizing",!1,i),a=n,r=XA(A,e,i),o="offset"+e[0].toUpperCase()+e.slice(1);if(WA.test(r)){if(!t)return r;r="auto"}return(!C.boxSizingReliable()&&n||!C.reliableTrDimensions()&&y(A,"tr")||"auto"===r||!parseFloat(r)&&"inline"===p.css(A,"display",!1,i))&&A.getClientRects().length&&(n="border-box"===p.css(A,"boxSizing",!1,i),(a=o in A)&&(r=A[o])),(r=parseFloat(r)||0)+oe(A,e,t||(n?"border":"content"),a,i,r)+"px"}function ge(A,e,t,i,n){return new ge.prototype.init(A,e,t,i,n)}p.extend({cssHooks:{opacity:{get:function(A,e){if(e){var t=XA(A,"opacity");return""===t?"1":t}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(A,e,t,i){if(A&&3!==A.nodeType&&8!==A.nodeType&&A.style){var n,a,r,o=tA(e),s=jA.test(e),g=A.style;if(s||(e=te(o)),r=p.cssHooks[e]||p.cssHooks[o],void 0===t)return r&&"get"in r&&void 0!==(n=r.get(A,!1,i))?n:g[e];"string"==(a=typeof t)&&(n=lA.exec(t))&&n[1]&&(t=uA(A,e,n),a="number"),null!=t&&t==t&&("number"!==a||s||(t+=n&&n[3]||(p.cssNumber[o]?"":"px")),C.clearCloneStyle||""!==t||0!==e.indexOf("background")||(g[e]="inherit"),r&&"set"in r&&void 0===(t=r.set(A,t,i))||(s?g.setProperty(e,t):g[e]=t))}},css:function(A,e,t,i){var n,a,r,o=tA(e);return jA.test(e)||(e=te(o)),(r=p.cssHooks[e]||p.cssHooks[o])&&"get"in r&&(n=r.get(A,!0,t)),void 0===n&&(n=XA(A,e,i)),"normal"===n&&e in ae&&(n=ae[e]),""===t||t?(a=parseFloat(n),!0===t||isFinite(a)?a||0:n):n}}),p.each(["height","width"],(function(A,e){p.cssHooks[e]={get:function(A,t,i){if(t)return!ie.test(p.css(A,"display"))||A.getClientRects().length&&A.getBoundingClientRect().width?se(A,e,i):ZA(A,ne,(function(){return se(A,e,i)}))},set:function(A,t,i){var n,a=OA(A),r=!C.scrollboxSize()&&"absolute"===a.position,o=(r||i)&&"border-box"===p.css(A,"boxSizing",!1,a),s=i?oe(A,e,i,o,a):0;return o&&r&&(s-=Math.ceil(A["offset"+e[0].toUpperCase()+e.slice(1)]-parseFloat(a[e])-oe(A,e,"border",!1,a)-.5)),s&&(n=lA.exec(t))&&"px"!==(n[3]||"px")&&(A.style[e]=t,t=p.css(A,e)),re(0,t,s)}}})),p.cssHooks.marginLeft=zA(C.reliableMarginLeft,(function(A,e){if(e)return(parseFloat(XA(A,"marginLeft"))||A.getBoundingClientRect().left-ZA(A,{marginLeft:0},(function(){return A.getBoundingClientRect().left})))+"px"})),p.each({margin:"",padding:"",border:"Width"},(function(A,e){p.cssHooks[A+e]={expand:function(t){for(var i=0,n={},a="string"==typeof t?t.split(" "):[t];i<4;i++)n[A+IA[i]+e]=a[i]||a[i-2]||a[0];return n}},"margin"!==A&&(p.cssHooks[A+e].set=re)})),p.fn.extend({css:function(A,e){return z(this,(function(A,e,t){var i,n,a={},r=0;if(Array.isArray(e)){for(i=OA(A),n=e.length;r1)}}),p.Tween=ge,ge.prototype={constructor:ge,init:function(A,e,t,i,n,a){this.elem=A,this.prop=t,this.easing=n||p.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=i,this.unit=a||(p.cssNumber[t]?"":"px")},cur:function(){var A=ge.propHooks[this.prop];return A&&A.get?A.get(this):ge.propHooks._default.get(this)},run:function(A){var e,t=ge.propHooks[this.prop];return this.options.duration?this.pos=e=p.easing[this.easing](A,this.options.duration*A,0,1,this.options.duration):this.pos=e=A,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),t&&t.set?t.set(this):ge.propHooks._default.set(this),this}},ge.prototype.init.prototype=ge.prototype,ge.propHooks={_default:{get:function(A){var e;return 1!==A.elem.nodeType||null!=A.elem[A.prop]&&null==A.elem.style[A.prop]?A.elem[A.prop]:(e=p.css(A.elem,A.prop,""))&&"auto"!==e?e:0},set:function(A){p.fx.step[A.prop]?p.fx.step[A.prop](A):1!==A.elem.nodeType||!p.cssHooks[A.prop]&&null==A.elem.style[te(A.prop)]?A.elem[A.prop]=A.now:p.style(A.elem,A.prop,A.now+A.unit)}}},ge.propHooks.scrollTop=ge.propHooks.scrollLeft={set:function(A){A.elem.nodeType&&A.elem.parentNode&&(A.elem[A.prop]=A.now)}},p.easing={linear:function(A){return A},swing:function(A){return.5-Math.cos(A*Math.PI)/2},_default:"swing"},p.fx=ge.prototype.init,p.fx.step={};var ce,le,Ie=/^(?:toggle|show|hide)$/,Ce=/queueHooks$/;function de(){le&&(!1===B.hidden&&A.requestAnimationFrame?A.requestAnimationFrame(de):A.setTimeout(de,p.fx.interval),p.fx.tick())}function he(){return A.setTimeout((function(){ce=void 0})),ce=Date.now()}function Be(A,e){var t,i=0,n={height:A};for(e=e?1:0;i<4;i+=2-e)n["margin"+(t=IA[i])]=n["padding"+t]=A;return e&&(n.opacity=n.width=A),n}function ue(A,e,t){for(var i,n=(Ee.tweeners[e]||[]).concat(Ee.tweeners["*"]),a=0,r=n.length;a1)},removeAttr:function(A){return this.each((function(){p.removeAttr(this,A)}))}}),p.extend({attr:function(A,e,t){var i,n,a=A.nodeType;if(3!==a&&8!==a&&2!==a)return void 0===A.getAttribute?p.prop(A,e,t):(1===a&&p.isXMLDoc(A)||(n=p.attrHooks[e.toLowerCase()]||(p.expr.match.bool.test(e)?fe:void 0)),void 0!==t?null===t?void p.removeAttr(A,e):n&&"set"in n&&void 0!==(i=n.set(A,t,e))?i:(A.setAttribute(e,t+""),t):n&&"get"in n&&null!==(i=n.get(A,e))?i:null==(i=p.find.attr(A,e))?void 0:i)},attrHooks:{type:{set:function(A,e){if(!C.radioValue&&"radio"===e&&y(A,"input")){var t=A.value;return A.setAttribute("type",e),t&&(A.value=t),e}}}},removeAttr:function(A,e){var t,i=0,n=e&&e.match(V);if(n&&1===A.nodeType)for(;t=n[i++];)A.removeAttribute(t)}}),fe={set:function(A,e,t){return!1===e?p.removeAttr(A,t):A.setAttribute(t,t),t}},p.each(p.expr.match.bool.source.match(/\w+/g),(function(A,e){var t=Qe[e]||p.find.attr;Qe[e]=function(A,e,i){var n,a,r=e.toLowerCase();return i||(a=Qe[r],Qe[r]=n,n=null!=t(A,e,i)?r:null,Qe[r]=a),n}}));var xe=/^(?:input|select|textarea|button)$/i,pe=/^(?:a|area)$/i;function me(A){return(A.match(V)||[]).join(" ")}function ye(A){return A.getAttribute&&A.getAttribute("class")||""}function _e(A){return Array.isArray(A)?A:"string"==typeof A&&A.match(V)||[]}p.fn.extend({prop:function(A,e){return z(this,p.prop,A,e,arguments.length>1)},removeProp:function(A){return this.each((function(){delete this[p.propFix[A]||A]}))}}),p.extend({prop:function(A,e,t){var i,n,a=A.nodeType;if(3!==a&&8!==a&&2!==a)return 1===a&&p.isXMLDoc(A)||(e=p.propFix[e]||e,n=p.propHooks[e]),void 0!==t?n&&"set"in n&&void 0!==(i=n.set(A,t,e))?i:A[e]=t:n&&"get"in n&&null!==(i=n.get(A,e))?i:A[e]},propHooks:{tabIndex:{get:function(A){var e=p.find.attr(A,"tabindex");return e?parseInt(e,10):xe.test(A.nodeName)||pe.test(A.nodeName)&&A.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),C.optSelected||(p.propHooks.selected={get:function(A){var e=A.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(A){var e=A.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),p.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){p.propFix[this.toLowerCase()]=this})),p.fn.extend({addClass:function(A){var e,t,i,n,a,r;return d(A)?this.each((function(e){p(this).addClass(A.call(this,e,ye(this)))})):(e=_e(A)).length?this.each((function(){if(i=ye(this),t=1===this.nodeType&&" "+me(i)+" "){for(a=0;a-1;)t=t.replace(" "+n+" "," ");r=me(t),i!==r&&this.setAttribute("class",r)}})):this:this.attr("class","")},toggleClass:function(A,e){var t,i,n,a,r=typeof A,o="string"===r||Array.isArray(A);return d(A)?this.each((function(t){p(this).toggleClass(A.call(this,t,ye(this),e),e)})):"boolean"==typeof e&&o?e?this.addClass(A):this.removeClass(A):(t=_e(A),this.each((function(){if(o)for(a=p(this),n=0;n-1)return!0;return!1}});var Se=/\r/g;p.fn.extend({val:function(A){var e,t,i,n=this[0];return arguments.length?(i=d(A),this.each((function(t){var n;1===this.nodeType&&(null==(n=i?A.call(this,t,p(this).val()):A)?n="":"number"==typeof n?n+="":Array.isArray(n)&&(n=p.map(n,(function(A){return null==A?"":A+""}))),(e=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,n,"value")||(this.value=n))}))):n?(e=p.valHooks[n.type]||p.valHooks[n.nodeName.toLowerCase()])&&"get"in e&&void 0!==(t=e.get(n,"value"))?t:"string"==typeof(t=n.value)?t.replace(Se,""):null==t?"":t:void 0}}),p.extend({valHooks:{option:{get:function(A){var e=p.find.attr(A,"value");return null!=e?e:me(p.text(A))}},select:{get:function(A){var e,t,i,n=A.options,a=A.selectedIndex,r="select-one"===A.type,o=r?null:[],s=r?a+1:n.length;for(i=a<0?s:r?a:0;i-1)&&(t=!0);return t||(A.selectedIndex=-1),a}}}}),p.each(["radio","checkbox"],(function(){p.valHooks[this]={set:function(A,e){if(Array.isArray(e))return A.checked=p.inArray(p(A).val(),e)>-1}},C.checkOn||(p.valHooks[this].get=function(A){return null===A.getAttribute("value")?"on":A.value})}));var De=A.location,we={guid:Date.now()},ve=/\?/;p.parseXML=function(e){var t,i;if(!e||"string"!=typeof e)return null;try{t=(new A.DOMParser).parseFromString(e,"text/xml")}catch(A){}return i=t&&t.getElementsByTagName("parsererror")[0],t&&!i||p.error("Invalid XML: "+(i?p.map(i.childNodes,(function(A){return A.textContent})).join("\n"):e)),t};var Fe=/^(?:focusinfocus|focusoutblur)$/,be=function(A){A.stopPropagation()};p.extend(p.event,{trigger:function(e,t,i,n){var a,r,o,s,g,l,I,C,u=[i||B],E=c.call(e,"type")?e.type:e,f=c.call(e,"namespace")?e.namespace.split("."):[];if(r=C=o=i=i||B,3!==i.nodeType&&8!==i.nodeType&&!Fe.test(E+p.event.triggered)&&(E.indexOf(".")>-1&&(f=E.split("."),E=f.shift(),f.sort()),g=E.indexOf(":")<0&&"on"+E,(e=e[p.expando]?e:new p.Event(E,"object"==typeof e&&e)).isTrigger=n?2:3,e.namespace=f.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),t=null==t?[e]:p.makeArray(t,[e]),I=p.event.special[E]||{},n||!I.trigger||!1!==I.trigger.apply(i,t))){if(!n&&!I.noBubble&&!h(i)){for(s=I.delegateType||E,Fe.test(s+E)||(r=r.parentNode);r;r=r.parentNode)u.push(r),o=r;o===(i.ownerDocument||B)&&u.push(o.defaultView||o.parentWindow||A)}for(a=0;(r=u[a++])&&!e.isPropagationStopped();)C=r,e.type=a>1?s:I.bindType||E,(l=(aA.get(r,"events")||Object.create(null))[e.type]&&aA.get(r,"handle"))&&l.apply(r,t),(l=g&&r[g])&&l.apply&&iA(r)&&(e.result=l.apply(r,t),!1===e.result&&e.preventDefault());return e.type=E,n||e.isDefaultPrevented()||I._default&&!1!==I._default.apply(u.pop(),t)||!iA(i)||g&&d(i[E])&&!h(i)&&((o=i[g])&&(i[g]=null),p.event.triggered=E,e.isPropagationStopped()&&C.addEventListener(E,be),i[E](),e.isPropagationStopped()&&C.removeEventListener(E,be),p.event.triggered=void 0,o&&(i[g]=o)),e.result}},simulate:function(A,e,t){var i=p.extend(new p.Event,t,{type:A,isSimulated:!0});p.event.trigger(i,null,e)}}),p.fn.extend({trigger:function(A,e){return this.each((function(){p.event.trigger(A,e,this)}))},triggerHandler:function(A,e){var t=this[0];if(t)return p.event.trigger(A,e,t,!0)}});var Re=/\[\]$/,ke=/\r?\n/g,Pe=/^(?:submit|button|image|reset|file)$/i,Ne=/^(?:input|select|textarea|keygen)/i;function Me(A,e,t,i){var n;if(Array.isArray(e))p.each(e,(function(e,n){t||Re.test(A)?i(A,n):Me(A+"["+("object"==typeof n&&null!=n?e:"")+"]",n,t,i)}));else if(t||"object"!==f(e))i(A,e);else for(n in e)Me(A+"["+n+"]",e[n],t,i)}p.param=function(A,e){var t,i=[],n=function(A,e){var t=d(e)?e():e;i[i.length]=encodeURIComponent(A)+"="+encodeURIComponent(null==t?"":t)};if(null==A)return"";if(Array.isArray(A)||A.jquery&&!p.isPlainObject(A))p.each(A,(function(){n(this.name,this.value)}));else for(t in A)Me(t,A[t],e,n);return i.join("&")},p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var A=p.prop(this,"elements");return A?p.makeArray(A):this})).filter((function(){var A=this.type;return this.name&&!p(this).is(":disabled")&&Ne.test(this.nodeName)&&!Pe.test(A)&&(this.checked||!mA.test(A))})).map((function(A,e){var t=p(this).val();return null==t?null:Array.isArray(t)?p.map(t,(function(A){return{name:e.name,value:A.replace(ke,"\r\n")}})):{name:e.name,value:t.replace(ke,"\r\n")}})).get()}});var Te=/%20/g,Le=/#.*$/,Ye=/([?&])_=[^&]*/,Ge=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ue=/^(?:GET|HEAD)$/,Je=/^\/\//,He={},Ke={},Ve="*/".concat("*"),We=B.createElement("a");function je(A){return function(e,t){"string"!=typeof e&&(t=e,e="*");var i,n=0,a=e.toLowerCase().match(V)||[];if(d(t))for(;i=a[n++];)"+"===i[0]?(i=i.slice(1)||"*",(A[i]=A[i]||[]).unshift(t)):(A[i]=A[i]||[]).push(t)}}function Oe(A,e,t,i){var n={},a=A===Ke;function r(o){var s;return n[o]=!0,p.each(A[o]||[],(function(A,o){var g=o(e,t,i);return"string"!=typeof g||a||n[g]?a?!(s=g):void 0:(e.dataTypes.unshift(g),r(g),!1)})),s}return r(e.dataTypes[0])||!n["*"]&&r("*")}function Ze(A,e){var t,i,n=p.ajaxSettings.flatOptions||{};for(t in e)void 0!==e[t]&&((n[t]?A:i||(i={}))[t]=e[t]);return i&&p.extend(!0,A,i),A}We.href=De.href,p.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:De.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(De.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ve,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":p.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(A,e){return e?Ze(Ze(A,p.ajaxSettings),e):Ze(p.ajaxSettings,A)},ajaxPrefilter:je(He),ajaxTransport:je(Ke),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,n,a,r,o,s,g,c,l,I,C=p.ajaxSetup({},t),d=C.context||C,h=C.context&&(d.nodeType||d.jquery)?p(d):p.event,u=p.Deferred(),E=p.Callbacks("once memory"),f=C.statusCode||{},Q={},x={},m="canceled",y={readyState:0,getResponseHeader:function(A){var e;if(g){if(!r)for(r={};e=Ge.exec(a);)r[e[1].toLowerCase()+" "]=(r[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=r[A.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return g?a:null},setRequestHeader:function(A,e){return null==g&&(A=x[A.toLowerCase()]=x[A.toLowerCase()]||A,Q[A]=e),this},overrideMimeType:function(A){return null==g&&(C.mimeType=A),this},statusCode:function(A){var e;if(A)if(g)y.always(A[y.status]);else for(e in A)f[e]=[f[e],A[e]];return this},abort:function(A){var e=A||m;return i&&i.abort(e),_(0,e),this}};if(u.promise(y),C.url=((e||C.url||De.href)+"").replace(Je,De.protocol+"//"),C.type=t.method||t.type||C.method||C.type,C.dataTypes=(C.dataType||"*").toLowerCase().match(V)||[""],null==C.crossDomain){s=B.createElement("a");try{s.href=C.url,s.href=s.href,C.crossDomain=We.protocol+"//"+We.host!=s.protocol+"//"+s.host}catch(A){C.crossDomain=!0}}if(C.data&&C.processData&&"string"!=typeof C.data&&(C.data=p.param(C.data,C.traditional)),Oe(He,C,t,y),g)return y;for(l in(c=p.event&&C.global)&&0==p.active++&&p.event.trigger("ajaxStart"),C.type=C.type.toUpperCase(),C.hasContent=!Ue.test(C.type),n=C.url.replace(Le,""),C.hasContent?C.data&&C.processData&&0===(C.contentType||"").indexOf("application/x-www-form-urlencoded")&&(C.data=C.data.replace(Te,"+")):(I=C.url.slice(n.length),C.data&&(C.processData||"string"==typeof C.data)&&(n+=(ve.test(n)?"&":"?")+C.data,delete C.data),!1===C.cache&&(n=n.replace(Ye,"$1"),I=(ve.test(n)?"&":"?")+"_="+we.guid+++I),C.url=n+I),C.ifModified&&(p.lastModified[n]&&y.setRequestHeader("If-Modified-Since",p.lastModified[n]),p.etag[n]&&y.setRequestHeader("If-None-Match",p.etag[n])),(C.data&&C.hasContent&&!1!==C.contentType||t.contentType)&&y.setRequestHeader("Content-Type",C.contentType),y.setRequestHeader("Accept",C.dataTypes[0]&&C.accepts[C.dataTypes[0]]?C.accepts[C.dataTypes[0]]+("*"!==C.dataTypes[0]?", "+Ve+"; q=0.01":""):C.accepts["*"]),C.headers)y.setRequestHeader(l,C.headers[l]);if(C.beforeSend&&(!1===C.beforeSend.call(d,y,C)||g))return y.abort();if(m="abort",E.add(C.complete),y.done(C.success),y.fail(C.error),i=Oe(Ke,C,t,y)){if(y.readyState=1,c&&h.trigger("ajaxSend",[y,C]),g)return y;C.async&&C.timeout>0&&(o=A.setTimeout((function(){y.abort("timeout")}),C.timeout));try{g=!1,i.send(Q,_)}catch(A){if(g)throw A;_(-1,A)}}else _(-1,"No Transport");function _(e,t,r,s){var l,I,B,Q,x,m=t;g||(g=!0,o&&A.clearTimeout(o),i=void 0,a=s||"",y.readyState=e>0?4:0,l=e>=200&&e<300||304===e,r&&(Q=function(A,e,t){for(var i,n,a,r,o=A.contents,s=A.dataTypes;"*"===s[0];)s.shift(),void 0===i&&(i=A.mimeType||e.getResponseHeader("Content-Type"));if(i)for(n in o)if(o[n]&&o[n].test(i)){s.unshift(n);break}if(s[0]in t)a=s[0];else{for(n in t){if(!s[0]||A.converters[n+" "+s[0]]){a=n;break}r||(r=n)}a=a||r}if(a)return a!==s[0]&&s.unshift(a),t[a]}(C,y,r)),!l&&p.inArray("script",C.dataTypes)>-1&&p.inArray("json",C.dataTypes)<0&&(C.converters["text script"]=function(){}),Q=function(A,e,t,i){var n,a,r,o,s,g={},c=A.dataTypes.slice();if(c[1])for(r in A.converters)g[r.toLowerCase()]=A.converters[r];for(a=c.shift();a;)if(A.responseFields[a]&&(t[A.responseFields[a]]=e),!s&&i&&A.dataFilter&&(e=A.dataFilter(e,A.dataType)),s=a,a=c.shift())if("*"===a)a=s;else if("*"!==s&&s!==a){if(!(r=g[s+" "+a]||g["* "+a]))for(n in g)if((o=n.split(" "))[1]===a&&(r=g[s+" "+o[0]]||g["* "+o[0]])){!0===r?r=g[n]:!0!==g[n]&&(a=o[0],c.unshift(o[1]));break}if(!0!==r)if(r&&A.throws)e=r(e);else try{e=r(e)}catch(A){return{state:"parsererror",error:r?A:"No conversion from "+s+" to "+a}}}return{state:"success",data:e}}(C,Q,y,l),l?(C.ifModified&&((x=y.getResponseHeader("Last-Modified"))&&(p.lastModified[n]=x),(x=y.getResponseHeader("etag"))&&(p.etag[n]=x)),204===e||"HEAD"===C.type?m="nocontent":304===e?m="notmodified":(m=Q.state,I=Q.data,l=!(B=Q.error))):(B=m,!e&&m||(m="error",e<0&&(e=0))),y.status=e,y.statusText=(t||m)+"",l?u.resolveWith(d,[I,m,y]):u.rejectWith(d,[y,m,B]),y.statusCode(f),f=void 0,c&&h.trigger(l?"ajaxSuccess":"ajaxError",[y,C,l?I:B]),E.fireWith(d,[y,m]),c&&(h.trigger("ajaxComplete",[y,C]),--p.active||p.event.trigger("ajaxStop")))}return y},getJSON:function(A,e,t){return p.get(A,e,t,"json")},getScript:function(A,e){return p.get(A,void 0,e,"script")}}),p.each(["get","post"],(function(A,e){p[e]=function(A,t,i,n){return d(t)&&(n=n||i,i=t,t=void 0),p.ajax(p.extend({url:A,type:e,dataType:n,data:t,success:i},p.isPlainObject(A)&&A))}})),p.ajaxPrefilter((function(A){var e;for(e in A.headers)"content-type"===e.toLowerCase()&&(A.contentType=A.headers[e]||"")})),p._evalUrl=function(A,e,t){return p.ajax({url:A,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(A){p.globalEval(A,e,t)}})},p.fn.extend({wrapAll:function(A){var e;return this[0]&&(d(A)&&(A=A.call(this[0])),e=p(A,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map((function(){for(var A=this;A.firstElementChild;)A=A.firstElementChild;return A})).append(this)),this},wrapInner:function(A){return d(A)?this.each((function(e){p(this).wrapInner(A.call(this,e))})):this.each((function(){var e=p(this),t=e.contents();t.length?t.wrapAll(A):e.append(A)}))},wrap:function(A){var e=d(A);return this.each((function(t){p(this).wrapAll(e?A.call(this,t):A)}))},unwrap:function(A){return this.parent(A).not("body").each((function(){p(this).replaceWith(this.childNodes)})),this}}),p.expr.pseudos.hidden=function(A){return!p.expr.pseudos.visible(A)},p.expr.pseudos.visible=function(A){return!!(A.offsetWidth||A.offsetHeight||A.getClientRects().length)},p.ajaxSettings.xhr=function(){try{return new A.XMLHttpRequest}catch(A){}};var qe={0:200,1223:204},Xe=p.ajaxSettings.xhr();C.cors=!!Xe&&"withCredentials"in Xe,C.ajax=Xe=!!Xe,p.ajaxTransport((function(e){var t,i;if(C.cors||Xe&&!e.crossDomain)return{send:function(n,a){var r,o=e.xhr();if(o.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(r in e.xhrFields)o[r]=e.xhrFields[r];for(r in e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest"),n)o.setRequestHeader(r,n[r]);t=function(A){return function(){t&&(t=i=o.onload=o.onerror=o.onabort=o.ontimeout=o.onreadystatechange=null,"abort"===A?o.abort():"error"===A?"number"!=typeof o.status?a(0,"error"):a(o.status,o.statusText):a(qe[o.status]||o.status,o.statusText,"text"!==(o.responseType||"text")||"string"!=typeof o.responseText?{binary:o.response}:{text:o.responseText},o.getAllResponseHeaders()))}},o.onload=t(),i=o.onerror=o.ontimeout=t("error"),void 0!==o.onabort?o.onabort=i:o.onreadystatechange=function(){4===o.readyState&&A.setTimeout((function(){t&&i()}))},t=t("abort");try{o.send(e.hasContent&&e.data||null)}catch(A){if(t)throw A}},abort:function(){t&&t()}}})),p.ajaxPrefilter((function(A){A.crossDomain&&(A.contents.script=!1)})),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(A){return p.globalEval(A),A}}}),p.ajaxPrefilter("script",(function(A){void 0===A.cache&&(A.cache=!1),A.crossDomain&&(A.type="GET")})),p.ajaxTransport("script",(function(A){var e,t;if(A.crossDomain||A.scriptAttrs)return{send:function(i,n){e=p("