forked from vanjoge/RTVS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrtvs.wx.js
2 lines (2 loc) · 49.7 KB
/
rtvs.wx.js
1
2
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.rtvswx=e()}})(function(){var e,t,n;return function(){function e(t,n,i){function r(a,o){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!o&&u)return u(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var h=n[a]={exports:{}};t[a][0].call(h.exports,function(e){var n=t[a][1][e];return r(n||e)},h,h.exports,e,t,n,i)}return n[a].exports}for(var s="function"==typeof require&&require,a=0;a<i.length;a++)r(i[a]);return r}return e}()({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(e,i.key,i)}}return function(t,n,i){if(n)e(t.prototype,n);if(i)e(t,i);return t}}();var r=e("../helper/ByteHelper");var s=h(r);var a=e("../events");var o=h(a);var u=e("../utils/logger");var l=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var d=function(){function e(t){f(this,e);this.wfs=t;this.msg_serial_number=0;this.v2=true}i(e,[{key:"JT1078808Package7",value:function e(t,n,i,r){var s=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;var a=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;var o=arguments.length>6&&arguments[6]!==undefined?arguments[6]:null;return this.JT1078808Package(t,n,i,r,s,a,7,o)}},{key:"JT1078808Package",value:function t(n,i,r,a){var o=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;var u=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;var l=arguments.length>6&&arguments[6]!==undefined?arguments[6]:8;var h=arguments.length>7&&arguments[7]!==undefined?arguments[7]:null;var f=arguments.length>8&&arguments[8]!==undefined?arguments[8]:null;if(o==null){o=r}var d=0;if(i){d=i.GetLength()}var c=0;if(h){c=h.msg_serial_number;if(c>=255)h.msg_serial_number=0;else h.msg_serial_number+=1}else{c=this.msg_serial_number;if(c>=255)this.msg_serial_number=0;else this.msg_serial_number+=1}var g=this.wfs.config.protocol!=0;var v=new e.JTHeader(n,false,0,d,o,c,g);var y=0;var T;T=new Uint8Array(d+v.GetLength());v.GetBinaryData(T,y);y+=v.GetLength();if(d>0){i.GetBinaryData(T,y)}var S=new e.JT808Package(T,0,T.length);var w=0;if(f==null&&this.wfs&&this.wfs.config){f=this.wfs.config.defaultCtags}if(f!=null){w=f.length+2}var m=new e.JTRTHead(false,u,0,r,a,l,0,0,0,0,S.length+w,g,this.wfs.config.protocol==2);y=0;var p=new Uint8Array(m.GetLength()+S.length+w);m.GetBinaryData(p,0);y+=m.GetLength();for(var b=0;b<S.length;b++){p[y++]=S[b]}if(w>0){s.default.UIntToByte2(p,y,f.length);s.default.StringToGBK(p,y+2,f)}return{binary:p,head:v}}},{key:"Send9101",value:function t(n,i){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;var o=new e.JTRealVideoTransferRequest("",0,0,i,r,s);var u=this.JT1078808Package(37121,o,n,i,n,a);this.Send(u.binary)}},{key:"Send9102",value:function t(n,i,r,s,a){var o=arguments.length>5&&arguments[5]!==undefined?arguments[5]:null;var u=new e.JTRealVideoTransferControl(i,r,s,a);var l=this.JT1078808Package(37122,u,n,i,o);this.Send(l.binary)}},{key:"Send9201",value:function t(n,i,r,s,a,o,u,l,h,f){var d=arguments.length>10&&arguments[10]!==undefined?arguments[10]:null;var c=new e.JTVideoPlaybackRequest("",0,0,i,r,s,a,o,u,l,h,f);var g=this.JT1078808Package(37377,c,n,i,n,d);this.Send(g.binary)}},{key:"Send9202",value:function t(n,i,r,s,a){var o=arguments.length>5&&arguments[5]!==undefined?arguments[5]:null;var u=new e.JTVideoPlaybackControl(i,r,s,a);var l=this.JT1078808Package(37378,u,n,i,o);this.Send(l.binary)}},{key:"Send9205",value:function t(n,i,r,s,a,o,u,l,h,f,d){var c=arguments.length>11&&arguments[11]!==undefined?arguments[11]:null;var g=new e.JTQueryVideoFileList(r,s,a,o,u,l,h,f);var v=this.JT1078808Package(37381,g,i,r,null,0,8,n,c);n.sendMessage(v.binary,d,4613,v.head.SerialNumber)}},{key:"Send9206",value:function t(n,i,r,s,a,o,u,l,h,f,d,c,g,v,y,T){var S=arguments.length>16&&arguments[16]!==undefined?arguments[16]:null;var w=new e.JTVideoFileUpload(r,s,a,o,u,l,h,f,d,c,g,v,y);var m=this.JT1078808Package(37382,w,i,r,null,0,8,n,S);n.sendMessage(m.binary,T,4614)}},{key:"Send9207",value:function t(n,i,r,s){var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;var o=new e.JTVideoFileUploadControl(r,s);var u=this.JT1078808Package(37383,o,n,i,a);this.Send(u.binary)}},{key:"Send9301",value:function t(n,i,r,s){var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;var o=new e.JTRTPTZRotate(i,r,s);var u=this.JT1078808Package(37633,o,n,i,a);this.Send(u.binary)}},{key:"Send9302",value:function t(n,i,r){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var a=new e.JTRPTZControl(i,r);var o=this.JT1078808Package(37634,a,n,i,s);this.Send(o.binary)}},{key:"Send9303",value:function t(n,i,r){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var a=new e.JTRPTZControl(i,r);var o=this.JT1078808Package(37635,a,n,i,s);this.Send(o.binary)}},{key:"Send9304",value:function t(n,i,r){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var a=new e.JTRPTZControl(i,r);var o=this.JT1078808Package(37636,a,n,i,s);this.Send(o.binary)}},{key:"Send9305",value:function t(n,i,r){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var a=new e.JTRPTZControl(i,r);var o=this.JT1078808Package(37637,a,n,i,s);this.Send(o.binary)}},{key:"Send9306",value:function t(n,i,r){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var a=new e.JTRPTZControl(i,r);var o=this.JT1078808Package(37638,a,n,i,s);this.Send(o.binary)}},{key:"Send8881",value:function t(n,i,r){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var a=new e.JTPrioritySetExt(r);var o=this.JT1078808Package(34945,a,n,i,s);this.Send(o.binary)}},{key:"Send9101Webrtc",value:function e(t,n){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;var s=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;this.Send9101_SpecialSim(this.GetWebrtcSim(t),t,n,i,r,s)}},{key:"Send9201Webrtc",value:function e(t,n,i,r,s,a,o,u,l,h){var f=arguments.length>10&&arguments[10]!==undefined?arguments[10]:null;this.Send9201_SpecialSim(this.GetWebrtcSim(t),t,n,i,r,s,a,o,u,l,h,f)}},{key:"Send8801",value:function t(n,i,r){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var a=new e.JT0x8886(5,r,null,null);var o=this.JT1078808Package(34950,a,n,i,s);this.Send(o.binary)}},{key:"SendHeartRtmp",value:function t(n,i,r,s){var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;var o=new e.JT0x8886(6,null,r,s);var u=this.JT1078808Package(34950,o,n,i,a);this.Send(u.binary)}},{key:"Send9101Rtmp",value:function e(t,n){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;var s=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;this.Send9101_SpecialSim(this.GetRtmpSim(t),t,n,i,r,s)}},{key:"Send9201Rtmp",value:function e(t,n,i,r,s,a,o,u,l,h){var f=arguments.length>10&&arguments[10]!==undefined?arguments[10]:null;this.Send9201_SpecialSim(this.GetRtmpSim(t),t,n,i,r,s,a,o,u,l,h,f)}},{key:"Send9101_SpecialSim",value:function t(n,i,r){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:1;var o=arguments.length>5&&arguments[5]!==undefined?arguments[5]:null;var u=new e.JTRealVideoTransferRequest("",0,0,r,s,a);var l=this.JT1078808Package7(37121,u,i,r,n,o);this.Send(l.binary)}},{key:"Send9201_SpecialSim",value:function t(n,i,r,s,a,o,u,l,h,f,d){var c=arguments.length>11&&arguments[11]!==undefined?arguments[11]:null;var g=new e.JTVideoPlaybackRequest("",0,0,r,s,a,o,u,l,h,f,d);var v=this.JT1078808Package7(37377,g,i,r,n,c);this.Send(v.binary)}},{key:"Send8890",value:function t(n,i,r,s){var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;var o=new e.JT0x8890(r,s);var u=this.JT1078808Package(34960,o,n,i,a);this.Send(u.binary)}},{key:"SendAudio",value:function t(n,i,r,s,a,o){var u=new e.JTRTHead(1,a,s,n,i,3,0,o,0,0,r.length,this.wfs.config.protocol!=0,this.wfs.config.protocol==2);var l=new Uint8Array(u.GetLength()+r.length);u.GetBinaryData(l,0);var h=u.GetLength();for(var f=0;f<r.length;f++){l[h++]=r[f]}this.Send(l)}},{key:"Send",value:function e(t){this.wfs.trigger(o.default.WEBSOCKET_DATA_UPLOADING,{data:t})}},{key:"GetRtmpSim",value:function e(t){var n="1234888888ec";if(n==t.toLowerCase()){return"1234888888eb"}return n}},{key:"GetWebrtcSim",value:function e(t){var n="1234888888ee";if(n==t.toLowerCase()){return"1234888888ed"}return n}}]);return e}();d.GetFirstSerialNumber=function(e){var t=void 0;if(e.PackInfo){t=e.SerialNumber-e.PackInfo.Index+1}else{t=e.SerialNumber}return t};d.GetMsbBody=function(e,t){var n=e.GetLength();return t.slice(n,n+e.MsgLen)};d.JTRTHead=function(e,t,n,i,r,a,o,u,l,h,f,d,c){this.V=2;this.P=false;this.X=false;this.CC=1;this.M=e;this.PT=t;this.SerialNumber=n;this.Sim=i;this.Channel=r;this.XXXX=a;this.YYYY=o;this.RTTimeSpan=u;this.LastIFrameInterval=l;this.LastFrameInterval=h;this.DLen=f;this.BinaryDataLen=0;this.Sim20=d;this.SimDynamic=c;this.FillByBinary=function(e,t,n){if(isNaN(t)){t=0}if(isNaN(n)){n=e.length}var r=t;if(e[r]===48&&e[r+1]===49&&e[r+2]===99){if(e[r+3]===114){this.SimDynamic=true}else if(e[r+3]!==100){return}r+=4;this.V=e[r]>>6;this.P=(e[r]&32)===32;this.X=(e[r]&16)===16;this.CC=e[r]&15;r+=1;this.M=(e[r]&128)===128;this.PT=e[r]&127;r+=1;this.SerialNumber=s.default.Byte2ToUInt(e,r);r+=2;if(this.SimDynamic){var a=s.default.Byte2ToUInt(e,r);i=s.default.GBKToString(e,r+2,a);r+=a+2}if(this.Sim20){this.Sim=s.default.BcdToString(e,r,20);r+=10}else{this.Sim=s.default.BcdToString(e,r,12);r+=6}this.Channel=e[r];r+=1;this.XXXX=e[r]>>4;this.YYYY=e[r]&15;r+=1;if(this.XXXX<4){this.RTTimeSpan=s.default.Byte8ToULong(e,r);r+=8}if(this.XXXX<3){this.LastIFrameInterval=s.default.Byte2ToUInt(e,r);r+=2;this.LastFrameInterval=s.default.Byte2ToUInt(e,r);r+=2}this.DLen=s.default.Byte2ToUInt(e,r);r+=2;this.BinaryDataLen=r-t}};this.GetBinaryData=function(g,v){var y=v;g[y++]=48;g[y++]=49;g[y++]=99;if(c)g[y++]=114;else g[y++]=100;g[y++]=129;if(e==1){g[y++]=t|128}else{g[y++]=t}s.default.UIntToByte2(g,y,n);y+=2;if(c){s.default.UIntToByte2(g,y,i.length);s.default.StringToGBK(g,y+2,i);y+=i.length+2}else if(d){s.default.StringToBcd(g,y,i,20);y+=10}else{s.default.StringToBcd(g,y,i,12);y+=6}g[y++]=r;g[y++]=a<<4&240|o&15;if(a>=4){s.default.UIntToByte2(g,y,f)}else if(a===3){s.default.ULongToByte8(g,y,u);s.default.UIntToByte2(g,y+8,f)}else{s.default.ULongToByte8(g,y,u);s.default.UIntToByte2(g,y+8,l);s.default.UIntToByte2(g,y+10,h);s.default.UIntToByte2(g,y+12,f)}};this.GetLength=function(){var e=0;if(c){e=2+i.length}else if(d){e=10}else{e=6}if(a>=4){return e+12}else if(a==3){return e+20}else{return e+24}}};d.JTHeader=function(e,t,n,i,r,a,o,u){this.MsgId=e;this.Sub=t;this.DataEncryptType=n;this.MsgLen=i;this.Sim=r;this.SerialNumber=a;this.Length=0;this.PackInfo=null;this.Is2019=o?true:false;this.Ver=u==null?1:u;this.FillByBinary=function(e,t,n){var i=t;this.MsgId=s.default.Byte2ToUInt(e,i);this.Is2019=(e[i+2]&64)===64;this.Sub=(e[i+2]&32)===32;this.DataEncryptType=(e[i+2]&28)>>2;e[i+2]=e[i+2]&3;this.MsgLen=s.default.Byte2ToUInt(e,i+2);if(this.Is2019){this.Ver=e[i+4];this.Sim=s.default.BcdToString(e,i+5,20);i+=15}else{this.Sim=s.default.BcdToString(e,i+4,12);i+=10}this.SerialNumber=s.default.Byte2ToUInt(e,i);if(this.Sub){this.PackInfo=new d.JTPackageInfo;this.PackInfo.Sum=s.default.Byte2ToUInt(e,i+2);this.PackInfo.Index=s.default.Byte2ToUInt(e,i+4)}};this.GetBinaryData=function(t,o){var u=o;s.default.UIntToByte2(t,u,e);u+=2;s.default.UIntToByte2(t,u,i);var l=64;if(!this.Is2019){l=0}if(this.Sub){l=l|32}l=l|(n&7)<<2;t[u]=t[u]|l;u+=2;if(this.Is2019){t[u]=this.Ver;s.default.StringToBcd(t,u+1,r,20);u+=11}else{s.default.StringToBcd(t,u,r,12);u+=6}s.default.UIntToByte2(t,u,a);if(this.Sub){s.default.UIntToByte2(t,u+2,this.PackInfo.Sum);s.default.UIntToByte2(t,u+4,this.PackInfo.Index)}};this.GetLength=function(){if(this.Is2019){return this.Sub?21:17}return this.Sub?16:12}};d.JTPackageInfo=function(e,t){this.Index=e;this.Sum=t};d.JTRealVideoTransferRequest=function(e,t,n,i,r,a){this.IPAddress=e;this.TcpPort=t;this.UdpPort=n;this.Channel=i;this.DataType=r;this.StreamType=a;this.Length=0;this.GetBinaryData=function(o,u){o[u]=s.default.StringToGBK(o,u+1,e);u=u+1+o[u];s.default.UIntToByte2(o,u,t);u+=2;s.default.UIntToByte2(o,u,n);u+=2;o[u++]=i;o[u++]=r;o[u++]=a};this.GetLength=function(){var t=e.length;return t+8}};d.JTRealVideoTransferControl=function(e,t,n,i){this.Channel=e;this.ControlCommand=t;this.SwitchStreamType=n;this.TurnOffMediaType=i;this.GetBinaryData=function(r,s){r[s]=e;s+=1;r[s]=t;s+=1;r[s]=i;s+=1;r[s]=n;s+=1};this.GetLength=function(){return 4}};d.JTVideoPlaybackRequest=function(e,t,n,i,r,a,o,u,l,h,f,c){this.IPAddress=e;this.TcpPort=t;this.UdpPort=n;this.Channel=i;this.MediaType=r;this.StreamType=a;this.StorageType=o;this.PlaybackMode=u;this.Multiple=l;this.StartTime=h;this.EndTime=f;this.DataSource=c;this.Length=0;this.GetBinaryData=function(g,v){g[v]=s.default.StringToGBK(g,v+1,e);v=v+1+g[v];s.default.UIntToByte2(g,v,t);v+=2;s.default.UIntToByte2(g,v,n);v+=2;g[v++]=i;g[v++]=r;g[v++]=a;g[v++]=o;g[v++]=u;g[v++]=l;var y=d.GetYYMMddHHmmssByDate(h);s.default.StringToBcd(g,v,y,12);v+=6;if(f===""){s.default.StringToBcd(g,v,"000000000000",12)}else{var T=d.GetYYMMddHHmmssByDate(f);s.default.StringToBcd(g,v,T,12)}v+=6;g[v++]=c};this.GetLength=function(){var t=e.length;return t+24}};d.JTVideoPlaybackControl=function(e,t,n,i){this.Channel=e;this.PlaybackControl=t;this.Multiple=n;this.DragPlaybackPosition=i;this.GetBinaryData=function(r,a){r[a]=e;a+=1;r[a]=t;a+=1;r[a]=n;a+=1;if(t===5){var o=d.GetYYMMddHHmmssByDate(i);s.default.StringToBcd(r,a,o,12);a+=6}};this.GetLength=function(){return 9}};d.JTQueryVideoFileList=function(e,t,n,i,r,a,o,u){this.Channel=e,this.StartTime=t,this.EndTime=n,this.Alarm=i,this.MediaType=r,this.StreamType=a,this.StorageType=o,this.DataSource=u;this.GetBinaryData=function(l,h){l[h]=e;h+=1;if(t===0){s.default.StringToBcd(l,h,"000000000000",12)}else{var f=d.UnixLongToDate(t);var c=d.GetYYMMddHHmmssByDate(f);s.default.StringToBcd(l,h,c,12)}h+=6;if(n===0){s.default.StringToBcd(l,h,"000000000000",12)}else{var g=d.UnixLongToDate(n);var v=d.GetYYMMddHHmmssByDate(g);s.default.StringToBcd(l,h,v,12)}h+=6;s.default.ULongToByte8(l,h,i);h+=8;l[h]=r;h+=1;l[h]=a;h+=1;l[h]=o;h+=1;l[h]=u;h+=1};this.GetLength=function(){return 25}};d.JTVideoFileUpload=function(e,t,n,i,r,a,o,u,l,h,f,c,g){this.Channel=e;this.FtpAddress=t;this.FtpPort=n;this.UserName=i;this.Password=r;this.FileUploadPath=a;this.StartTime=o;this.EndTime=u;this.Alarm=l;this.MediaType=h;this.StreamType=f;this.StorageType=c;this.TaskExecutionCondition=g;this.GetBinaryData=function(v,y){var T=s.default.StringToGBK(v,y+1,t);v[y]=T;y+=1;y+=T;s.default.UIntToByte2(v,y,n);y+=2;var S=s.default.StringToGBK(v,y+1,i);v[y]=S;y+=1;y+=S;var w=s.default.StringToGBK(v,y+1,r);v[y]=w;y+=1;y+=w;var m=s.default.StringToGBK(v,y+1,a);v[y]=m;y+=1;y+=m;v[y]=e;y+=1;var p=d.GetYYMMddHHmmssByDate(o);s.default.StringToBcd(v,y,p,12);y+=6;var b=d.GetYYMMddHHmmssByDate(u);s.default.StringToBcd(v,y,b,12);y+=6;s.default.ULongToByte8(v,y,l);y+=8;v[y]=h;y+=1;v[y]=f;y+=1;v[y]=c;y+=1;v[y]=g;y+=1};this.GetLength=function(){return 31+t.length+i.length+r.length+a.length}};d.JTVideoFileUploadControl=function(e,t){this.SerialNumber=e;this.UploadControl=t;this.GetBinaryData=function(n,i){s.default.UIntToByte2(n,i,e);i+=2;n[i]=t;i+=1};this.GetLength=function(){return 3}};d.JTRTPTZRotate=function(e,t,n){this.LogicalChannel=e;this.Direction=t;this.Speed=n;this.GetBinaryData=function(i,r){i[r]=e;r+=1;i[r]=t;r+=1;i[r]=n;r+=1};this.GetLength=function(){return 3}};d.JTRPTZControl=function(e,t){this.Channel=e;this.Flag=t;this.GetBinaryData=function(n,i){n[i]=e;i+=1;n[i]=t;i+=1};this.GetLength=function(){return 2}};d.JT808Package=function(e,t,n){var i=n+2;var r=t;var s=0;for(;r<n+t;r++){s=e[r]^s;if(e[r]===126||e[r]===125){i++}}if(s===126||s===125){i+=2}else{i+=1}var a=new Uint8Array(i);var o=0;a[o++]=126;for(r=t;r<n+t;r++,o++){a[o]=e[r];if(e[r]===126){a[o]=125;a[++o]=2}else if(e[r]===125){a[++o]=1}}if(s===126){a[o++]=125;a[o++]=2}else if(s===125){a[o++]=125;a[o++]=1}else{a[o++]=s}a[o]=126;return a};d.JTVideoListInfo=function(){this.SerialNumber;this.FileCount;this.FileList;this.FillByBinary=function(e,t,n){this.FileList=[];var i=t;this.SerialNumber=s.default.Byte2ToUInt(e,i);i+=2;this.FileCount=s.default.Byte4ToUInt(e,i);i+=4;if(this.FileCount>0&&e.length>=28*this.FileCount+i){for(var r=0;r<this.FileCount;r++){var a=new d.JTVideoFileListItem;a.FillByBinary(e,i);this.FileList.push(a);i+=28}}}};d.JTVideoFileListItem=function(){this.Channel;this.StartTime;this.EndTime;this.Alarm;this.MediaType;this.StreamType;this.StorageType;this.FileSize;this.FillByBinary=function(e,t){this.Channel=e[t];t+=1;this.StartTime=s.default.BcdToString(e,t,12);t+=6;this.EndTime=s.default.BcdToString(e,t,12);t+=6;this.Alarm=s.default.Byte8ToULong(e,t);t+=8;this.MediaType=e[t];t+=1;this.StreamType=e[t];t+=1;this.StorageType=e[t];t+=1;this.FileSize=s.default.Byte4ToUInt(e,t);t+=4}};d.JTVideoFileUploadEndInform=function(){this.SerialNumber;this.Result;this.FillByBinary=function(e,t){this.SerialNumber=s.default.Byte2ToUInt(e,t);t+=2;this.Result=e[t];t+=1}};d.SplitData=function(){var e=[];this.SplitDataBy7E=function(t,n,i,r){try{var s=0;var a=false;var o=false;var u=[];if(e!=[]&&(i>0&&t[n]!=126||i>1&&t[n]==126&&t[n+1]==126)){u=e;a=false;if(e.length>0)o=e[e.length-1]==125}else{u=[];a=true;o=false}while(s<i){if(t[n+s]==126){a=!a;if(a){try{r(u)}catch(e){l.default.error("SplitDataBy7E analyze exeception:"+e)}}else{while(i>s+1&&t[n+s+1]==126){s++}u=[]}}else if(o){if(t[n+s]==1)u[u.length-1]=125;else if(t[n+s]==2)u[u.length-1]=126;else{l.default.error("ErrorBinaryData7E");break}}else{u.push(t[n+s])}o=t[n+s]==125;s++}e=a?[]:u}catch(e){l.default.error("SplitDataBy7E exception:"+e)}}};d.CheckHelper=function(){this.CheckXOR=function(e,t,n){var i=0;for(var r=0;r<n;r++){i=(e[r+t]^i)&255}return i}};d.GetYYMMddHHmmssByDate=function(e){try{var t="";var n=d.ParseDate(e);var i=n.getFullYear()-2e3;t+=(i+"").length<2?"0"+i:i;var r=n.getMonth()+1;t+=(r+"").length<2?"0"+r:r;var s=n.getDate();t+=(s+"").length<2?"0"+s:s;var a=n.getHours();t+=(a+"").length<2?"0"+a:a;var o=n.getMinutes();t+=(o+"").length<2?"0"+o:o;var u=n.getSeconds();t+=(u+"").length<2?"0"+u:u;return t}catch(e){l.default.error("Datetime format must match:yyyy-mm-dd hh:mm:ss");return""}};d.ParseDate=function(e){var t=Date.parse(e);if(isNaN(t)){return new Date(Date.parse(e.replace(/-/g,"/")))}else{return new Date(t)}};d.DateToUnixLong=function(e){return Date.parse(d.ParseDate(e))/1e3};d.UnixLongToDate=function(e){return new Date(e*1e3)};d.JTPrioritySetExt=function(e){this.Priority=e;this.GetBinaryData=function(t,n){t[n]=e;n+=1};this.GetLength=function(){return 1}};d.ExtendRefuse=function(){this.DLen;this.Reason;this.FillByBinary=function(t,n,i){if(isNaN(n)){n=0}if(isNaN(i)){i=t.length}var r=n;this.DLen=s.default.Byte2ToUInt(t,r);r+=2;this.Reason=e(t,r,this.DLen)};function e(e,t,n){var i="",r=e;for(var s=t;s<n+t;s++){var a=r[s].toString(2),o=a.match(/^1+?(?=0)/);if(o&&a.length==8){var u=o[0].length;var l=r[s].toString(2).slice(7-u);for(var h=1;h<u;h++){l+=r[h+s].toString(2).slice(2)}i+=String.fromCharCode(parseInt(l,2));s+=u-1}else{i+=String.fromCharCode(r[s])}}return i}};d.JT0x8886=function(e,t,n,i){this.Type=e;this.WebrtcRoomid=t;this.RtmpURL=n;this.RtmpClientId=i;this.Length=0;this.GetBinaryData=function(r,a){r[a]=e;a+=1;if(e==5){var o=s.default.StringToGBK(r,a+2,t);s.default.UIntToByte2(r,a,o)}if(e==6){var o=s.default.StringToGBK(r,a+2,n);s.default.UIntToByte2(r,a,o);a=a+2+o;o=s.default.StringToGBK(r,a+2,i);s.default.UIntToByte2(r,a,o)}};this.GetLength=function(){var r=1;if(e==5){r+=t.length+2}if(e==6){r+=n.length+i.length+4}return r}};d.JT0x0889=function(){this.ASerial;this.Type;this.Url;this.FillByBinary=function(e,t,n){this.ASerial=s.default.Byte2ToUInt(e,t);this.Type=e[t+2];this.Url=s.default.GBKToString(e,t+3,n-3)}};d.JT0x8890=function(e,t){this.NType=e;this.Notice=t;this.FillByBinary=function(e,t,n){this.NType=s.default.Byte2ToUInt(e,t);var i=s.default.Byte2ToUInt(e,t+2);this.Notice=s.default.Utf8ArrayToStr(e,t+4,i)};this.GetBinaryData=function(e,t){s.default.UIntToByte2(e,t,this.NType);if(this.Notice!=null&&this.Notice.length>0){s.default.UIntToByte2(e,t+2,this.Notice.length);s.default.StringToGBK(e,t+4,this.Notice)}};this.GetLength=function(){if(this.Notice!=null){return 4+this.Notice.length}else{return 4}}};d.JT1003=function(){this.AudioCodeType;this.AudioChannels;this.AudioSamplingRate;this.AudioSamplingDigit;this.AudioFrameLength;this.AudioOut;this.VideoCodeType;this.AudioMaxChannels;this.VideoMaxChannels;this.FillByBinary=function(e,t,n){var i=t;this.AudioCodeType=e[i];i++;this.AudioChannels=e[i];i++;this.AudioSamplingRate=e[i];i++;this.AudioSamplingDigit=e[i];i++;this.AudioFrameLength=s.default.Byte2ToUInt(e,i);i+=2;this.AudioOut=e[i];i++;this.VideoCodeType=e[i];i+=1;this.AudioMaxChannels=e[i];i+=1;this.VideoMaxChannels=e[i];i+=1}};n.default=d},{"../events":2,"../helper/ByteHelper":3,"../utils/logger":9}],2:[function(e,t,n){"use strict";t.exports={MEDIA_ATTACHING:"wfsMediaAttaching",MEDIA_ATTACHED:"wfsMediaAttached",FRAG_LOADING:"wfsFragLoading",BUFFER_CREATED:"wfsBufferCreated",BUFFER_APPENDING:"wfsBufferAppending",BUFFER_RESET:"wfsBufferReset",FRAG_PARSING_DATA:"wfsFragParsingData",FRAG_PARSING_INIT_SEGMENT:"wfsFragParsingInitSegment",H264_DATA_PARSING:"wfsH264DataParsing",WEBSOCKET_ATTACHED:"wfsWebsocketAttached",WEBSOCKET_ATTACHING:"wfsWebsocketAttaching",WEBSOCKET_DATA_UPLOADING:"wfsWebsocketDataUploading",WEBSOCKET_MESSAGE_SENDING:"wfsWebsocketMessageSending",WEBSOCKET_CLOSE:"wfsWebsocketClose",WEBSOCKET_OPEN:"wfsWebsocketOpen",FILE_HEAD_LOADING:"wfsFileHeadLoading",FILE_HEAD_LOADED:"wfsFileHeadLoaded",FILE_DATA_LOADING:"wfsFileDataLoading",FILE_DATA_LOADED:"wfsFileDataLoaded",FILE_PARSING_DATA:"wfsFileParsingData",JT1078_DATA_PARSING:"wfsJT1078DataParsing",JT1078_PCM_OUT:"wfsJT1078PcmOut",JT1078_RGB_OUT:"wfsJT1078RgbOut",JT1078_YUV_OUT:"wfsJT1078YuvOut",JT1078ToFMp4_DATA_PARSING:"wfsJT1078ToFMp4DataParsing",WEBRTC_SFU_INFO:"wfsWebrtcSFUInfo",HLS_INFO:"wfsHlsInfo",SPEEK_DATA:"wfsSpeekParsingData",WEBRTC_SRS_MSG:"wfsWebrtcSrsInfo"}},{}],3:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(e,i.key,i)}}return function(t,n,i){if(n)e(t.prototype,n);if(i)e(t,i);return t}}();var r=e("../utils/long");var s=a(r);function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var u=function(){function e(){o(this,e)}i(e,[{key:"toHex",value:function t(n){return e.toHex(n)}}],[{key:"concatenate",value:function e(t,n){var i=0;var r=true;var s=false;var a=undefined;try{for(var o=n[Symbol.iterator](),u;!(r=(u=o.next()).done);r=true){var l=u.value;i+=l.length}}catch(e){s=true;a=e}finally{try{if(!r&&o.return){o.return()}}finally{if(s){throw a}}}var h=new t(i);var f=0;var d=true;var c=false;var g=undefined;try{for(var v=n[Symbol.iterator](),y;!(d=(y=v.next()).done);d=true){var T=y.value;h.set(T,f);f+=T.length}}catch(e){c=true;g=e}finally{try{if(!d&&v.return){v.return()}}finally{if(c){throw g}}}return h}},{key:"toHex",value:function e(t){var n=t.toString(16);if(n.length<2){return"0"+n}return n}},{key:"Byte2ToUInt",value:function e(t,n){return t[n+1]|t[n]<<8}},{key:"Byte4ToUInt",value:function e(t,n){return t[n+3]|t[n+2]<<8|t[n+1]<<16|t[n]<<24}},{key:"BcdToString",value:function e(t,n,i){var r="";for(var s=0;s<i/2;s++){r+=this.toHex(t[n+s])}return r}},{key:"StringTimeToUnixLong",value:function e(t){var n=parseInt("20"+t.substring(0,2));var i=parseInt(t.substring(2,4));var r=parseInt(t.substring(4,6));var s=parseInt(t.substring(6,8));var a=parseInt(t.substring(8,10));var o=parseInt(t.substring(10,12));if(r==0||i==0||i>12||r>31||s>24||a>60||o>60){return}var u=n+"-"+i+"-"+r+" "+s+":"+a+":"+o;return parseInt(new Date(u).getTime()/1e3)}},{key:"StringToBcd",value:function e(t,n,i,r){while(i.length<r){i="0"+i}for(var s=0;s<r/2;s++){t[n+s]=parseInt("0x"+i.substring(s*2,s*2+2))}}},{key:"Byte8ToULong",value:function t(n,i){return new s.default(e.Byte4ToUInt(n,i+4),e.Byte4ToUInt(n,i),true)}},{key:"UIntToByte2",value:function e(t,n,i){t[n++]=i>>8&255;t[n++]=i&255}},{key:"IntToByte4",value:function e(t,n,i){t[n++]=i>>24&255;t[n++]=i>>16&255;t[n++]=i>>8&255;t[n++]=i&255}},{key:"ULongToByte8",value:function e(t,n,i){if(!s.default.isLong(i)){i=s.default.fromString(i.toString(),true)}var r=i.toBytesBE();t[n++]=r[0];t[n++]=r[1];t[n++]=r[2];t[n++]=r[3];t[n++]=r[4];t[n++]=r[5];t[n++]=r[6];t[n++]=r[7]}},{key:"StringToGBK",value:function e(t,n,i){for(var r=0;r<i.length;r++){t[n+r]=i.charCodeAt(r)}return i.length}},{key:"GBKToString",value:function e(t,n,i){if(n===undefined){n=0}if(i===undefined){i=t.length}var r="";for(var s=0;s<i;s++){r+=String.fromCharCode(t[s+n])}return r}},{key:"Utf8ArrayToStr",value:function e(t,n,i){if(n===undefined){n=0}if(i===undefined){i=t.length}var r,s,i,a;var o,u;r="";i=i;s=n;while(s-n<i){a=t[s++];switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(a);break;case 12:case 13:o=t[s++];r+=String.fromCharCode((a&31)<<6|o&63);break;case 14:o=t[s++];u=t[s++];r+=String.fromCharCode((a&15)<<12|(o&63)<<6|(u&63)<<0);break}}return r}}]);return e}();n.default=u},{"../utils/long":10}],4:[function(e,t,n){"use strict";t.exports=e("./rtvswx.js").default},{"./rtvswx.js":7}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(e,i.key,i)}}return function(t,n,i){if(n)e(t.prototype,n);if(i)e(t,i);return t}}();var r=e("../JX/JTT1078");var s=u(r);var a=e("../utils/logger");var o=u(a);function u(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var h=function(){function e(t){l(this,e);this.wfs=t;this.jt1078=new s.default(this)}i(e,[{key:"destroy",value:function e(){this.close()}},{key:"trigger",value:function e(t,n){this.send(n.data)}},{key:"send",value:function e(t){this.wss.send({data:t.buffer,complete:function e(t){o.default.debug("sendSocketMessage",t)}})}},{key:"conn",value:function e(t,n,i,r){this.callback=r;var s=this;var a=true;this.wss=wx.connectSocket({url:"wss://"+t+":"+n,complete:function e(t){o.default.debug("connectSocket",t)}});this.wss.onClose(function(e){o.default.debug("SocketClosed",e);if(this.wfs.config.events){if(this.wfs.config.events.onWsClose){this.wfs.config.events.onWsClose(this.wfs.video_id,this.wfs)}if(this.wfs.config.events.onServerNotice){this.wfs.config.events.onServerNotice("onWsClose",this.wfs.video_id,this.wfs)}this.wfs.Stop()}}.bind(this));this.wss.onMessage(function(e){s.receive(e)});var u=function e(t){if(a){a=false;o.default.debug("onSocketOpen",t);if(s.wfs.config.protocol!=0){s.send(new Uint8Array([48,49,99,100,231,255,253,242,0,0,0,0,0,0,0,128,0,0]))}i()}};this.wss.onOpen(u);if(this.wss.readyState==1){u()}}},{key:"close",value:function e(){if(this.wss){this.wss.close({complete:function e(t){o.default.debug("closeSocket",t)}});this.wss=null}}},{key:"receive",value:function e(t){var n=new Uint8Array(t.data);if(n[0]==126&&n[n.length-1]==126){var i=new s.default.JTHeader;i.FillByBinary(n,1);if(this.JX808Data(i,n,i.GetLength()+1)){return}}var r=String.fromCharCode.apply(null,n);var a=JSON.parse(r);this.callback(a)}},{key:"JX808Data",value:function e(t,n,i){switch(t.MsgId){case 34960:var r=new s.default.JT0x8890;r.FillByBinary(n,i);if(this.wfs.config.events){if(r.NType==0){if(this.wfs.config.events.onDevConnect){this.wfs.config.events.onDevConnect(this.wfs.video_id,this.wfs)}if(this.wfs.config.events.onServerNotice){this.wfs.config.events.onServerNotice("onDevConnect",this.wfs.video_id,this.wfs)}}if(r.NType==1){if(this.wfs.config.events.onDevDisconnect){this.wfs.config.events.onDevDisconnect(this.wfs.video_id,this.wfs)}if(this.wfs.config.events.onServerNotice){this.wfs.config.events.onServerNotice("onDevDisconnect",this.wfs.video_id,this.wfs)}}if(r.NType==2){if(this.wfs.config.events.onEndByServer){if(this.wfs.config.events.onEndByServer(r.Notice,this.wfs.video_id,this.wfs)){this.wfs.CloseSocket();return true}}this.wfs.Stop()}}return true}return false}},{key:"config",get:function e(){return this.wfs.config}}]);return e}();n.default=h},{"../JX/JTT1078":1,"../utils/logger":9}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(e,i.key,i)}}return function(t,n,i){if(n)e(t.prototype,n);if(i)e(t,i);return t}}();var r=e("../helper/ByteHelper");var s=u(r);var a=e("../utils/logger");var o=u(a);function u(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var h=function(){function e(t){l(this,e);this.wfs=t;this.ok=false}i(e,[{key:"destroy",value:function e(){this.close()}},{key:"getConnByCluster",value:function e(t,n,i,r){this.callback=r;var s=this;var a=true;this.wss=wx.connectSocket({url:"wss://"+t+":"+n,complete:function e(t){o.default.debug("ClusterConnect",t)}});this.wss.onClose(function(e){o.default.debug("ClusterClosed",e);if(!this.ok&&this.wfs.config.events){if(this.wfs.config.events.onWsClose){this.wfs.config.events.onWsClose(this.wfs.video_id,this.wfs)}if(this.wfs.config.events.onServerNotice){this.wfs.config.events.onServerNotice("onWsClose",this.wfs.video_id,this.wfs)}this.wfs.Stop()}}.bind(this));this.wss.onMessage(function(e){s.receive(e)});this.wss.onOpen(function(e){if(a){a=false;o.default.debug("ClusterOpen",e);s.send(i)}});if(a&&this.wss.readyState==1){a=false;o.default.debug("ClusterOpen2",res);s.send(i)}}},{key:"close",value:function e(){if(this.wss){this.wss.close({complete:function e(t){o.default.debug("CloseCluster",t)}});this.wss=null}}},{key:"send",value:function e(t){var n=new Uint8Array([1,0,0,3,235,0,0,0,0,0,0,0,0,0,0,0,0]);s.default.StringToGBK(n,5,t);this.wss.send({data:n.buffer,complete:function e(t){o.default.debug("ClusterSendMessage",t)}})}},{key:"receive",value:function e(t){var n=new Uint8Array(t.data);var i=s.default.GBKToString(n);this.ok=/[^:]+:\d+.*/.test(i);this.callback(i,this)}}]);return e}();n.default=h},{"../helper/ByteHelper":3,"../utils/logger":9}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(e,i.key,i)}}return function(t,n,i){if(n)e(t.prototype,n);if(i)e(t,i);return t}}();var r=e("./utils/cvComm");var s=d(r);var a=e("./loader/wxwssCluster")
;var o=d(a);var u=e("./loader/wxwss");var l=d(u);var h=e("./utils/logger");var f=d(h);function d(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var g=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};c(this,e);this.config=t;if(this.config.protocol==undefined){this.config.protocol=0}this.socketCreatedId=0;this.StartID=0;this.time_id=-1}i(e,[{key:"onHlsInfo",value:function e(t){var n="mytv";var i=/rtmp:\/\/[^\/]+\/([^\/]+)\//.exec(t.ServerAddr);if(i.length>1){n=i[1]}this.rtmp_url=t.ServerAddr;this.clientid=t.ClinetID;this.httpsFlv=this.hls2flvurl(t.HlsHttpsAddr,n);this.StartHeartbeat()}},{key:"StartRealTimeVideo",value:function e(t,n,i){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;var s=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;this.Stop();this.IsRequestPlay=true;this.createSocketAndSendCmd(n,i,function(){if(s){this.wss.jt1078.Send9101Rtmp(n,i,0,r)}else{this.wss.jt1078.Send9101Rtmp(n,i,1,r)}}.bind(this),function(e){this.onHlsInfo(e);t(this.rtmp_url,this.httpsFlv)}.bind(this))}},{key:"PlaybackVideo",value:function e(t,n,i,r){var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var o=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;var u=arguments.length>6&&arguments[6]!==undefined?arguments[6]:0;var l=arguments.length>7&&arguments[7]!==undefined?arguments[7]:0;var h=arguments[8];var f=arguments.length>9&&arguments[9]!==undefined?arguments[9]:"";var d=arguments.length>10&&arguments[10]!==undefined?arguments[10]:0;var c=s.default.SimChannelLen(n,i,this.config.protocol);n=c.Sim;i=c.Channel;this.Stop();this.IsRequestPlay=true;this.createSocketAndSendCmd(n,i,function(){this.IsPlay=true;this.wss.jt1078.Send9201Rtmp(n,i,r,a,o,u,l,h,f,d)}.bind(this),function(e){this.onHlsInfo(e);t(this.rtmp_url,this.httpsFlv)}.bind(this))}},{key:"hls2flvurl",value:function e(t,n){var i=/(http(s){0,1}:\/\/[^\/]+\/)hls\/(.+)\.m3u8/.exec(t);return i[1]+"live.flv?app="+n+"&stream="+i[3]}},{key:"createSocketAndSendCmd",value:function e(t,n,i,r){var a=s.default.SimChannelLen(t,n,this.config.protocol);t=a.Sim;n=a.Channel;this.Sim=t;this.Channel=n;var u=this.socketCreatedId;this.CloseSocket();this.cluster=new o.default(this);this.cluster.getConnByCluster(this.config.clusterHost,this.config.clusterPort,t,function(e,t){this.CloseSocket();if(e!=null){var n=e.split(":");if(u==this.socketCreatedId){this.wss=new l.default(this);this.wss.conn(n[0],n[1],i,r)}}}.bind(this))}},{key:"CloseSocket",value:function e(){if(this.cluster){this.cluster.close();this.cluster=null}if(this.wss){this.wss.close();this.wss=null;this.socketCreatedId++}this.StopHeartbeat()}},{key:"Stop",value:function e(){var t=this.IsRequestPlay;this.IsRequestPlay=false;this.CloseSocket();if(t){if(this.config.events&&this.config.events.onStop){this.config.events.onStop(this.video_id,this)}}}},{key:"StartHeartbeat",value:function e(){this.StartID++;if(this.time_id===-1){this.time_id=setInterval(this.SendHeartbeatPackage.bind(this),1e3*5)}}},{key:"StopHeartbeat",value:function e(){if(this.time_id!=-1){clearInterval(this.time_id);this.time_id=-1;this.StartID++}}},{key:"SendHeartbeatPackage",value:function e(){this.wss.jt1078.SendHeartRtmp(this.Sim,this.Channel,this.rtmp_url,this.clientid)}}],[{key:"logger",get:function e(){return f.default}}]);return e}();f.default.SetLevel(1);n.default=g},{"./loader/wxwss":5,"./loader/wxwssCluster":6,"./utils/cvComm":8,"./utils/logger":9}],8:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(e,i.key,i)}}return function(t,n,i){if(n)e(t.prototype,n);if(i)e(t,i);return t}}();function r(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var s=function(){function e(){r(this,e)}i(e,null,[{key:"SimChannelLen",value:function e(t,n){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if(i==0){t=this.FixLen(t,12)}else if(i==2){if(!/.{20}_.{20}/g.test(t)){t=this.FixLen(t,20)+"_"+this.FixLen(n,20)}n=1}else{t=this.FixLen(t,20)}return{Sim:t,Channel:n}}},{key:"FixLen",value:function e(t,n){if(typeof t!=="string"){t=String(t)}if(t.length>n){return t.substr(0,n)}else{while(t.length<n){t="0"+t}return t}}},{key:"IsHttps",value:function e(){if(document){return document.location.protocol=="https:"}else{return true}}},{key:"GetWsp",value:function t(){if(e.IsHttps()){return"wss://"}else{return"ws://"}}},{key:"loadJs",value:function e(t,n){var i=document.createElement("script");i.type="text/javascript";if(typeof n!="undefined"){if(i.readyState){i.onreadystatechange=function(){if(i.readyState=="loaded"||i.readyState=="complete"){i.onreadystatechange=null;n()}}}else{i.onload=function(){n()}}}i.src=t;document.body.appendChild(i)}},{key:"loadCss",value:function e(t,n,i,r){var s=document.createElement("link");s.type="text/css";s.rel="stylesheet";if(n){s.id=n}if(typeof i!="undefined"){if(s.readyState){s.onreadystatechange=function(){if(s.readyState=="loaded"||s.readyState=="complete"){s.onreadystatechange=null;i()}}}else{s.onload=function(){i()}}}s.href=t;if(r)document.head.prepend(s);else document.head.appendChild(s)}},{key:"IsFullscreen",value:function e(){if(document.fullScreen||document.webkitIsFullScreen||document.mozFullScreen){var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;if(t&&(t.classList.contains("video-box-body")||t.classList.contains("video-container"))){return true}}return false}}]);return e}();n.default=s},{}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(e,i.key,i)}}return function(t,n,i){if(n)e(t.prototype,n);if(i)e(t,i);return t}}();function s(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var a=function(){function e(){s(this,e)}r(e,null,[{key:"SetLevel",value:function t(n){e.level=n}},{key:"SetTag",value:function t(n){if(typeof e.tags=="undefined")e.tags=new Map;e.tags.set(n,1)}},{key:"debug",value:function t(n){var i;if(typeof e.level!="undefined"&&e.level>0){return}for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a<r;a++){s[a-1]=arguments[a]}(i=console).log.apply(i,["debug:"+(new Date).toLocaleTimeString()+" :"+n].concat(s))}},{key:"warn",value:function t(n){var i;if(typeof e.level!="undefined"&&e.level>1){return}for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a<r;a++){s[a-1]=arguments[a]}(i=console).log.apply(i,["warn:"+(new Date).toLocaleTimeString()+" :"+n].concat(s))}},{key:"error",value:function t(n){var i;if(typeof e.level!="undefined"&&e.level>2){return}for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a<r;a++){s[a-1]=arguments[a]}(i=console).log.apply(i,["error "+(new Date).toLocaleTimeString()+" :"+n].concat(s))}},{key:"custom",value:function t(n,r){var s;if(typeof e.tags=="undefined")return;if(!i(e.tags.has(n)))return;for(var a=arguments.length,o=Array(a>2?a-2:0),u=2;u<a;u++){o[u-2]=arguments[u]}(s=console).log.apply(s,["tag:"+n+" "+(new Date).toLocaleTimeString()+" :"+r].concat(o))}},{key:"downArrayBuffer",value:function e(t,n){var i=new Blob([t]);this.downBlob(i,n)}},{key:"downUint8Arrays",value:function e(t,n){var i=new Blob(t);this.downBlob(i,n)}},{key:"downBlob",value:function e(t,n){var i=document.createElement("a");i.download=n;i.style.display="none";i.href=URL.createObjectURL(t);document.body.appendChild(i);i.click();URL.revokeObjectURL(i.href);document.body.removeChild(i)}},{key:"diffTimeStr",value:function e(t,n){var i=n.getTime()-t.getTime();var r=Math.floor(i/(24*3600*1e3));var s=i%(24*3600*1e3);var a=Math.floor(s/(3600*1e3));var o=s%(3600*1e3);var u=Math.floor(o/(60*1e3));var l=o%(60*1e3);var h=Math.round(l/1e3);var f=h.toString();if(h<10){f="0"+f}f=u+":"+f;if(u<10){f="0"+f}if(a>0){f=a+":"+f}if(r>0){f=r+"d"+f}return f}}]);return e}();n.default=a},{}],10:[function(e,t,n){"use strict";t.exports=r;var i=null;try{i=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function r(e,t,n){this.low=e|0;this.high=t|0;this.unsigned=!!n}r.prototype.__isLong__;Object.defineProperty(r.prototype,"__isLong__",{value:true});function s(e){return(e&&e["__isLong__"])===true}r.isLong=s;var a={};var o={};function u(e,t){var n,i,r;if(t){e>>>=0;if(r=0<=e&&e<256){i=o[e];if(i)return i}n=h(e,(e|0)<0?-1:0,true);if(r)o[e]=n;return n}else{e|=0;if(r=-128<=e&&e<128){i=a[e];if(i)return i}n=h(e,e<0?-1:0,false);if(r)a[e]=n;return n}}r.fromInt=u;function l(e,t){if(isNaN(e))return t?p:m;if(t){if(e<0)return p;if(e>=T)return C}else{if(e<=-S)return _;if(e+1>=S)return I}if(e<0)return l(-e,t).neg();return h(e%y|0,e/y|0,t)}r.fromNumber=l;function h(e,t,n){return new r(e,t,n)}r.fromBits=h;var f=Math.pow;function d(e,t,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return m;if(typeof t==="number"){n=t,t=false}else{t=!!t}n=n||10;if(n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");else if(i===0){return d(e.substring(1),t,n).neg()}var r=l(f(n,8));var s=m;for(var a=0;a<e.length;a+=8){var o=Math.min(8,e.length-a),u=parseInt(e.substring(a,a+o),n);if(o<8){var h=l(f(n,o));s=s.mul(h).add(l(u))}else{s=s.mul(r);s=s.add(l(u))}}s.unsigned=t;return s}r.fromString=d;function c(e,t){if(typeof e==="number")return l(e,t);if(typeof e==="string")return d(e,t);return h(e.low,e.high,typeof t==="boolean"?t:e.unsigned)}r.fromValue=c;var g=1<<16;var v=1<<24;var y=g*g;var T=y*y;var S=T/2;var w=u(v);var m=u(0);r.ZERO=m;var p=u(0,true);r.UZERO=p;var b=u(1);r.ONE=b;var B=u(1,true);r.UONE=B;var k=u(-1);r.NEG_ONE=k;var I=h(4294967295|0,2147483647|0,false);r.MAX_VALUE=I;var C=h(4294967295|0,4294967295|0,true);r.MAX_UNSIGNED_VALUE=C;var _=h(0,2147483648|0,false);r.MIN_VALUE=_;var L=r.prototype;L.toInt=function e(){return this.unsigned?this.low>>>0:this.low};L.toNumber=function e(){if(this.unsigned)return(this.high>>>0)*y+(this.low>>>0);return this.high*y+(this.low>>>0)};L.toString=function e(t){t=t||10;if(t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(_)){var n=l(t),i=this.div(n),r=i.mul(n).sub(this);return i.toString(t)+r.toInt().toString(t)}else return"-"+this.neg().toString(t)}var s=l(f(t,6),this.unsigned),a=this;var o="";while(true){var u=a.div(s),h=a.sub(u.mul(s)).toInt()>>>0,d=h.toString(t);a=u;if(a.isZero())return d+o;else{while(d.length<6){d="0"+d}o=""+d+o}}};L.getHighBits=function e(){return this.high};L.getHighBitsUnsigned=function e(){return this.high>>>0};L.getLowBits=function e(){return this.low};L.getLowBitsUnsigned=function e(){return this.low>>>0};L.getNumBitsAbs=function e(){if(this.isNegative())return this.eq(_)?64:this.neg().getNumBitsAbs();var t=this.high!=0?this.high:this.low;for(var n=31;n>0;n--){if((t&1<<n)!=0)break}return this.high!=0?n+33:n+1};L.isZero=function e(){return this.high===0&&this.low===0};L.eqz=L.isZero;L.isNegative=function e(){return!this.unsigned&&this.high<0};L.isPositive=function e(){return this.unsigned||this.high>=0};L.isOdd=function e(){return(this.low&1)===1};L.isEven=function e(){return(this.low&1)===0};L.equals=function e(t){if(!s(t))t=c(t);if(this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1)return false;return this.high===t.high&&this.low===t.low};L.eq=L.equals;L.notEquals=function e(t){return!this.eq(t)};L.neq=L.notEquals;L.ne=L.notEquals;L.lessThan=function e(t){return this.comp(t)<0};L.lt=L.lessThan;L.lessThanOrEqual=function e(t){return this.comp(t)<=0};L.lte=L.lessThanOrEqual;L.le=L.lessThanOrEqual;L.greaterThan=function e(t){return this.comp(t)>0};L.gt=L.greaterThan;L.greaterThanOrEqual=function e(t){return this.comp(t)>=0};L.gte=L.greaterThanOrEqual;L.ge=L.greaterThanOrEqual;L.compare=function e(t){if(!s(t))t=c(t);if(this.eq(t))return 0;var n=this.isNegative(),i=t.isNegative();if(n&&!i)return-1;if(!n&&i)return 1;if(!this.unsigned)return this.sub(t).isNegative()?-1:1;return t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1};L.comp=L.compare;L.negate=function e(){if(!this.unsigned&&this.eq(_))return _;return this.not().add(b)};L.neg=L.negate;L.add=function e(t){if(!s(t))t=c(t);var n=this.high>>>16;var i=this.high&65535;var r=this.low>>>16;var a=this.low&65535;var o=t.high>>>16;var u=t.high&65535;var l=t.low>>>16;var f=t.low&65535;var d=0,g=0,v=0,y=0;y+=a+f;v+=y>>>16;y&=65535;v+=r+l;g+=v>>>16;v&=65535;g+=i+u;d+=g>>>16;g&=65535;d+=n+o;d&=65535;return h(v<<16|y,d<<16|g,this.unsigned)};L.subtract=function e(t){if(!s(t))t=c(t);return this.add(t.neg())};L.sub=L.subtract;L.multiply=function e(t){if(this.isZero())return m;if(!s(t))t=c(t);if(i){var n=i["mul"](this.low,this.high,t.low,t.high);return h(n,i["get_high"](),this.unsigned)}if(t.isZero())return m;if(this.eq(_))return t.isOdd()?_:m;if(t.eq(_))return this.isOdd()?_:m;if(this.isNegative()){if(t.isNegative())return this.neg().mul(t.neg());else return this.neg().mul(t).neg()}else if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(w)&&t.lt(w))return l(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16;var a=this.high&65535;var o=this.low>>>16;var u=this.low&65535;var f=t.high>>>16;var d=t.high&65535;var g=t.low>>>16;var v=t.low&65535;var y=0,T=0,S=0,p=0;p+=u*v;S+=p>>>16;p&=65535;S+=o*v;T+=S>>>16;S&=65535;S+=u*g;T+=S>>>16;S&=65535;T+=a*v;y+=T>>>16;T&=65535;T+=o*g;y+=T>>>16;T&=65535;T+=u*d;y+=T>>>16;T&=65535;y+=r*v+a*g+o*d+u*f;y&=65535;return h(S<<16|p,y<<16|T,this.unsigned)};L.mul=L.multiply;L.divide=function e(t){if(!s(t))t=c(t);if(t.isZero())throw Error("division by zero");if(i){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1){return this}var n=(this.unsigned?i["div_u"]:i["div_s"])(this.low,this.high,t.low,t.high);return h(n,i["get_high"](),this.unsigned)}if(this.isZero())return this.unsigned?p:m;var r,a,o;if(!this.unsigned){if(this.eq(_)){if(t.eq(b)||t.eq(k))return _;else if(t.eq(_))return b;else{var u=this.shr(1);r=u.div(t).shl(1);if(r.eq(m)){return t.isNegative()?b:k}else{a=this.sub(t.mul(r));o=r.add(a.div(t));return o}}}else if(t.eq(_))return this.unsigned?p:m;if(this.isNegative()){if(t.isNegative())return this.neg().div(t.neg());return this.neg().div(t).neg()}else if(t.isNegative())return this.div(t.neg()).neg();o=m}else{if(!t.unsigned)t=t.toUnsigned();if(t.gt(this))return p;if(t.gt(this.shru(1)))return B;o=p}a=this;while(a.gte(t)){r=Math.max(1,Math.floor(a.toNumber()/t.toNumber()));var d=Math.ceil(Math.log(r)/Math.LN2),g=d<=48?1:f(2,d-48),v=l(r),y=v.mul(t);while(y.isNegative()||y.gt(a)){r-=g;v=l(r,this.unsigned);y=v.mul(t)}if(v.isZero())v=b;o=o.add(v);a=a.sub(y)}return o};L.div=L.divide;L.modulo=function e(t){if(!s(t))t=c(t);if(i){var n=(this.unsigned?i["rem_u"]:i["rem_s"])(this.low,this.high,t.low,t.high);return h(n,i["get_high"](),this.unsigned)}return this.sub(this.div(t).mul(t))};L.mod=L.modulo;L.rem=L.modulo;L.not=function e(){return h(~this.low,~this.high,this.unsigned)};L.and=function e(t){if(!s(t))t=c(t);return h(this.low&t.low,this.high&t.high,this.unsigned)};L.or=function e(t){if(!s(t))t=c(t);return h(this.low|t.low,this.high|t.high,this.unsigned)};L.xor=function e(t){if(!s(t))t=c(t);return h(this.low^t.low,this.high^t.high,this.unsigned)};L.shiftLeft=function e(t){if(s(t))t=t.toInt();if((t&=63)===0)return this;else if(t<32)return h(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned);else return h(0,this.low<<t-32,this.unsigned)};L.shl=L.shiftLeft;L.shiftRight=function e(t){if(s(t))t=t.toInt();if((t&=63)===0)return this;else if(t<32)return h(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned);else return h(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};L.shr=L.shiftRight;L.shiftRightUnsigned=function e(t){if(s(t))t=t.toInt();if((t&=63)===0)return this;if(t<32)return h(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned);if(t===32)return h(this.high,0,this.unsigned);return h(this.high>>>t-32,0,this.unsigned)};L.shru=L.shiftRightUnsigned;L.shr_u=L.shiftRightUnsigned;L.rotateLeft=function e(t){var n;if(s(t))t=t.toInt();if((t&=63)===0)return this;if(t===32)return h(this.high,this.low,this.unsigned);if(t<32){n=32-t;return h(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)}t-=32;n=32-t;return h(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned)};L.rotl=L.rotateLeft;L.rotateRight=function e(t){var n;if(s(t))t=t.toInt();if((t&=63)===0)return this;if(t===32)return h(this.high,this.low,this.unsigned);if(t<32){n=32-t;return h(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)}t-=32;n=32-t;return h(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned)};L.rotr=L.rotateRight;L.toSigned=function e(){if(!this.unsigned)return this;return h(this.low,this.high,false)};L.toUnsigned=function e(){if(this.unsigned)return this;return h(this.low,this.high,true)};L.toBytes=function e(t){return t?this.toBytesLE():this.toBytesBE()};L.toBytesLE=function e(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};L.toBytesBE=function e(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};r.fromBytes=function e(t,n,i){return i?r.fromBytesLE(t,n):r.fromBytesBE(t,n)};r.fromBytesLE=function e(t,n){return new r(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};r.fromBytesBE=function e(t,n){return new r(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)}},{}]},{},[4])(4)});