hhdlinkble 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +2 -2
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# JS-SDK
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
8
|
+
|
|
9
|
+
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
10
|
+
|
|
11
|
+
## Add your files
|
|
12
|
+
|
|
13
|
+
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
|
14
|
+
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
cd existing_repo
|
|
18
|
+
git remote add origin http://192.168.10.253/ble-sdk/js-sdk.git
|
|
19
|
+
git branch -M main
|
|
20
|
+
git push -uf origin main
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Integrate with your tools
|
|
24
|
+
|
|
25
|
+
- [ ] [Set up project integrations](http://192.168.10.253/ble-sdk/js-sdk/-/settings/integrations)
|
|
26
|
+
|
|
27
|
+
## Collaborate with your team
|
|
28
|
+
|
|
29
|
+
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
|
30
|
+
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
|
31
|
+
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
|
32
|
+
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
|
33
|
+
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
|
34
|
+
|
|
35
|
+
## Test and Deploy
|
|
36
|
+
|
|
37
|
+
Use the built-in continuous integration in GitLab.
|
|
38
|
+
|
|
39
|
+
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
|
40
|
+
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
|
41
|
+
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
|
42
|
+
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
|
43
|
+
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
# Editing this README
|
|
48
|
+
|
|
49
|
+
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
|
50
|
+
|
|
51
|
+
## Suggestions for a good README
|
|
52
|
+
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
53
|
+
|
|
54
|
+
## Name
|
|
55
|
+
Choose a self-explaining name for your project.
|
|
56
|
+
|
|
57
|
+
## Description
|
|
58
|
+
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
59
|
+
|
|
60
|
+
## Badges
|
|
61
|
+
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
62
|
+
|
|
63
|
+
## Visuals
|
|
64
|
+
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
71
|
+
|
|
72
|
+
## Support
|
|
73
|
+
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
74
|
+
|
|
75
|
+
## Roadmap
|
|
76
|
+
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
77
|
+
|
|
78
|
+
## Contributing
|
|
79
|
+
State if you are open to contributions and what your requirements are for accepting them.
|
|
80
|
+
|
|
81
|
+
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
82
|
+
|
|
83
|
+
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
84
|
+
|
|
85
|
+
## Authors and acknowledgment
|
|
86
|
+
Show your appreciation to those who have contributed to the project.
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
For open source projects, say how it is licensed.
|
|
90
|
+
|
|
91
|
+
## Project status
|
|
92
|
+
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
package/dist/index.cjs.js
CHANGED
|
@@ -12,4 +12,4 @@ function(){var t=U,e=t.lib,r=e.WordArray,n=e.Hasher,i=t.algo,a=r.create([0,1,2,3
|
|
|
12
12
|
* derived from CryptoJS.mode.CTR
|
|
13
13
|
* Jan Hruby jhruby.web@gmail.com
|
|
14
14
|
*/
|
|
15
|
-
U.mode.CTRGladman=function(){var t=U.lib.BlockCipherMode.extend();function e(t){if(255&~(t>>24))t+=1<<24;else{var e=t>>16&255,r=t>>8&255,n=255&t;255===e?(e=0,255===r?(r=0,255===n?n=0:++n):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=n}return t}function r(t){return 0===(t[0]=e(t[0]))&&(t[1]=e(t[1])),t}var n=t.Encryptor=t.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),r(o);var s=o.slice(0);n.encryptBlock(s,0);for(var c=0;c<i;c++)t[e+c]^=s[c]}});return t.Decryptor=n,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.Rabbit=e.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)s.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(i[0]^=l,i[1]^=f,i[2]^=u,i[3]^=h,i[4]^=l,i[5]^=f,i[6]^=u,i[7]^=h,r=0;r<4;r++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=e._createHelper(o)}(),U.mode.CTR=function(){var t=U.lib.BlockCipherMode.extend(),e=t.Encryptor=t.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)t[e+s]^=o[s]}});return t.Decryptor=e,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.RabbitLegacy=e.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)s.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(n[0]^=l,n[1]^=f,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=f,n[6]^=u,n[7]^=h,i=0;i<4;i++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=e._createHelper(o)}(),U.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){for(var e=t.words,r=t.sigBytes-1;!(e[r>>>2]>>>24-r%4*8&255);)r--;t.sigBytes=r+1}},U),new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);var C={formatTime:w,inArray:function(t,e,r){for(var n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1},ab2hex:b,mergeArrayBuffer:function(){for(var t=0,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0;i<r.length;i++)r[i]=new Uint8Array(r[i]),t+=r[i].length;for(var a=new Uint8Array(t),o=0,s=0,c=r;s<c.length;s++){var l=c[s];a.set(l,o),o+=l.length}return a.buffer},Encrypt:B,Decrypt:function(t,e,r){var n=b(B(b(new Uint8Array(16).buffer),e)),i=m.exports;t=A(t);var a=new Uint8Array([]);e=b(e);for(var o=i.enc.Hex.parse(e),c=i.enc.Hex.parse(""),l=0;l<t.length;l+=16){var u=t.slice(l,l+16);if(b(u)!=n){var f=i.enc.Hex.parse(b(u)),h=i.enc.Base64.stringify(f),g=i.AES.decrypt(h,o,{iv:c,mode:i.mode.CBC,padding:i.pad.ZeroPadding});a=new Uint8Array([].concat(s(a),s(A(i.enc.Hex.stringify(g)))))}}return a},Crc16_Ccitt:S,SunCheck:function(t,e){var r,n=0;for(r=0;r<e;r++)n=n+(255&t[r])&255;return n=1+~n,(n&=255)>240&&(n-=16),n},stringToUint8Array:function(t){for(var e=[],r=0,n=t.length;r<n;++r)e.push(t.charCodeAt(r));return new Uint8Array(e)},sleep:function(t){for(var e=new Date,r=e.getTime()+t;;)if((e=new Date).getTime()>r)return},Uint8ArrayToHex:function(t,e){if(null==t)return"";for(var r,n=[],i=0;i<t.length;i++)1==(r=t[i].toString(16)).length&&(r="0"+r),n.push(r);return e?n.join(""):n.join(" ")},Uint8ArrayToString:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},getTimeArr:function(t){var e=w(new Date);return t&&(e=w(new Date(t))),A(e)},HexToUint8Array:A,DelayExecFunc:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;null==t||t.length<1||null==e||r<1||function n(){null==t||t.length<1||(e(t.shift()),setTimeout(n,r))}()},SplitArray:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null==t||t.length<1||e<1)return[];for(var n=[],i=0;i<t.length;)n.push(t.slice(i,i+e)),i+=e;return null==r||n.forEach((function(t,e,n){r(t)})),n},clone:function(t){var e=null;if(t instanceof Array)e=t.concat();else if(t instanceof Function)e=t;else for(var r in e=new Object,t){var n=t[r];e[r]=n instanceof Object?this.clone(n):n}return e},GetPowerPercent:function(t){if(t<=3)return 0;if(t>4.22)return 102;if(t>=4.2)return 100;var e=0,r=0,n=0,i=10;return t<4.2&&t>=4.06?(e=90,r=4.2,n=4.06):t<4.06&&t>=3.98?(e=80,r=4.06,n=3.98):t<3.98&&t>=3.92?(e=70,r=3.98,n=3.92):t<3.92&&t>=3.87?(e=60,r=3.92,n=3.87):t<3.87&&t>=3.82?(e=50,r=3.87,n=3.82):t<3.82&&t>=3.79?(e=40,r=3.82,n=3.79):t<3.79&&t>=3.77?(e=30,r=3.79,n=3.77):t<3.77&&t>=3.74?(e=20,r=3.77,n=3.74):t<3.74&&t>=3.68?(e=10,r=3.74,n=3.68):t<3.68&&t>=3.45?(e=5,r=3.68,n=3.45,i=5):t<3.45&&t>=3&&(e=0,r=3.45,n=3,i=5),parseInt(e+i*(t-n)/(r-n))},GetPower:function(t){return t<3?5:t>=3?100:parseInt(t)},GetPowertow:function(t){var e=0;return t<1.4?0:t>=3?100:(t<3&&t>=2.5?e=(e=parseInt(392.16*t-488.24))>=100?100:e:t<2.016&&t>=1.4?e=parseInt(44.286*t*t-10.706*t-14.206):t<2.628&&t>=2.016?e=parseInt(13141*t*t-3752.7*t*t*t-15022*t+5653.6):t<3&&t>=2.628&&(e=(e=parseInt(53.763*t+19.36))>=100?100:e),e)},GetXorCheck:function(t,e){if(null==t||e<1)return 0;for(var r=0,n=0;n<e;n++)r^=t[n],r&=255;return r},ShiftSend:function(t){for(var e=new ArrayBuffer(2*t.length+2),r=new DataView(e,0),n=1,i=1;i<t.length-1;i++)126==t[i]?(r.setUint8(n,125),r.setUint8(n+1,2),n++):125==t[i]?(r.setUint8(n,125),r.setUint8(n+1,1),n++):r.setUint8(n,t[i]),n++;r.setUint8(0,126),r.setUint8(n,126),n++;var a=function(t){for(var e=Buffer.alloc(t.byteLength,0),r=new Uint8Array(t),n=0;n<e.length;++n)e[n]=r[n];return e}(e=e.slice(0,n));try{return a.slice(0,n)}catch(t){return!1}},recoverRecv:function(t){for(var e=new Uint8Array(t.length),r=0,n=0;n<t.length;n++)125==t[n]?2==t[n+1]?(e[r]=126,n++):1==t[n+1]?(e[r]=125,n++):e[r]=t[n]:e[r]=t[n],r++;return e=e.slice(0,r)},bufferToHex:function(t){if(null==t)return"";for(var e,r=[],n=0;n<t.length;n++)1==(e=t[n].toString(16)).length&&(e="0"+e),r.push(e);return r.join(" ")},stringToUint8Arraytwo:function(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?(e.push(192|n>>6),e.push(128|63&n)):n<65536?(e.push(224|n>>12),e.push(128|n>>6&63),e.push(128|63&n)):(e.push(240|n>>18),e.push(128|n>>12&63),e.push(128|n>>6&63),e.push(128|63&n))}return new Uint8Array(e)},checkCrc:function(t,e){var r=new ArrayBuffer(2),n=new DataView(r);n.setUint8(0,t[0]),n.setUint8(1,t[1]);var i=t.slice(12,e),a=S(i,i.length);return a&=65535,n.getUint16(0)==a}};var k={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"2401":return r=a(a({},r),function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint16(3),n={};1==(r>>15&1)?n.Power=((32767&r)/100).toFixed(2):n.Voltage=(r/1e3).toFixed(2);return n.sealNum=e.getUint32(5),n.unsealNum=e.getUint32(9),n.Time=C.Uint8ArrayToHex(t.slice(13,20),!0),n}(c));case"2403":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={CardList:[]},n=(t.length-1)/4,i=0;i<n;i++){var a=t.slice(e,e+4);r.CardList.push(C.ab2hex(a)),e+=4}return r.CardList=r.CardList,r}(c));case"2406":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={sealLogList:[]},n=(t.length-1)/11,i=0;i<n;i++){var a={};a.eventID=t[e];var o=t.slice(e+1,e+1+4);a.UserId=C.ab2hex(o),o=t.slice(e+5,e+5+6),a.Time=C.ab2hex(o),r.sealLogList.push(a),e+=11}return r}(c));case"2407":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=1,n={alarmLogList:[]},i=(t.length-1)/10,a=0;a<i;a++){var o={};o.eventID=e.getUint8(r),o.sealStatus=e.getUint8(r+1),o.Voltage=e.getUint16(r+2)/1e3;var s=t.slice(r+4,r+4+6);o.Time=C.ab2hex(s),n.alarmLogList.push(o),r+=10}return n}(c));case"2409":return r=a(a({},r),function(t){if(1!=t[0])return;var e=1,r={Content:""},n=t.slice(e,e+512);return r.Content=C.Uint8ArrayToString(n),r}(c));case"240D":return r.Data=function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(1),n=1,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2)}catch(t){break}if("0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o){var c=0;2==s&&(c=e.getUint16(n+3)),i[""+o]=c}else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x04"==o||"0x07"==o||"0x06"==o||"0x10"==o||"0x12"==o||"0xFC"==o){c="";c=C.Uint8ArrayToHex(t.slice(n+3,n+3+s),!0),i[""+o]=c}else if("0x11"==o||"0x0E"==o||"0x08"==o||"0x09"==o||"0x0A"==o){var l=t.slice(n+3,n+3+s);if(parseInt(l[0])>=49)i[""+o]=C.Uint8ArrayToString(l);else{for(var u="",f=0;f<l.length;f++)u+=l[f];i[""+o]=u}}else{l=t.slice(n+3,n+3+s);i[""+o]=l.toString()}n+=2+s}return i}(c),r;case"2402":case"2408":case"240A":case"240B":case"240C":return r}}catch(t){return console.log("==--",t),r}}};function T(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var I={setCommand:function(t,e){switch(t){case"HHD_BLE_2401":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=1;for(var r=new Uint8Array(20),n=C.stringToUint8Arraytwo(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];r[8]=parseInt(t.setData.cmd);var a=C.getTimeArr();return r[9]=a[0],r[10]=a[1],r[11]=a[2],r[12]=a[3],r[13]=a[4],r[14]=a[5],r[15]=a[6],r[16]=0,r[17]=0,r[18]=0,r[19]=0,T(e,r,t)}(e);case"HHD_BLE_2402":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=2;for(var r=t.setData,n=new Uint8Array(8+4*r.length),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];var o=0;for(a=0;a<r.length;a++){for(var s=C.HexToUint8Array(r[a]),c=0;c<4;c++)n[8+o+c]=s[c];o+=4}return T(e,n,t)}(e);case"HHD_BLE_2403":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=3;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2406":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=6;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2407":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=7;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2408":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=8;for(var r=C.stringToUint8Arraytwo(t.setData.content),n=new Uint8Array(8+r.length+1),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];n[8]=parseInt(t.setData.address);for(a=0;a<r.length;a++)n[9+a]=r[a];return T(e,n,t)}(e);case"HHD_BLE_2409":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=9;for(var r=new Uint8Array(9),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return r[8]=t.setData.address,T(e,r,t)}(e);case"HHD_BLE_240A":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=10;for(var r=new Uint8Array(16),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.password);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240B":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=11;for(var r=new Uint8Array(24),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.aespassword);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240C":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(a.setUint8(r+1,parseInt(o)),"0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o)a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o||"0xFE"==o||"0x14"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x04"==o){a.setUint8(r+2,7);var c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),a.setUint8(r+9,c[6]),r+=9}else if("0x07"==o){a.setUint8(r+2,6);c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),r+=8}else if("0xFC"==o){var l=C.HexToUint8Array(s);a.setUint8(r+2,l.length);for(var u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);r+=l.length+2}else{for(l=C.stringToUint8Arraytwo(s),u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);a.setUint8(r+2,l.length),r+=2+l.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var f=new Uint8Array(2);f[0]=36,f[1]=12;var h=new Uint8Array(8+r+1),g=C.stringToUint8Array(t.blePassword);for(u=0;u<g.byteLength;u++)h[u]=g[u];for(u=0;u<r+1;u++)h[8+u]=a.getUint8(u);return T(f,h,t)}return!1}(e);case"HHD_BLE_240D":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=13;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e)}}},H=a(a({},k),I),L=Object.freeze({__proto__:null,default:H});var D={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),t=C.recoverRecv(t),console.log("反转报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(3,5);i=2047&new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+15!=n)return r;var s=t.slice(13,n-2);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);switch(console.log("解密后:",C.ab2hex(c)),c=c.slice(8,i),r.Code=c[0],C.ab2hex(t.slice(1,3)).toUpperCase()){case"0311":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0313":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0215":return r;case"0217":return r=a(a({},r),function(t){var e=0,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function R(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=126,i[1]=t[0],i[2]=t[1];var a=e.length+6|32768;i[3]=a>>8,i[4]=a;var o="00000000000000"+r.lockId;o=o.substr(-12),i[5]=parseInt(o.substr(0,2),16),i[6]=parseInt(o.substr(2,2),16),i[7]=parseInt(o.substr(4,2),16),i[8]=parseInt(o.substr(6,2),16),i[9]=parseInt(o.substr(8,2),16),i[10]=parseInt(o.substr(10,2),16),i[11]=0,i[12]=0;var s=parseInt(16*Math.ceil((6+e.length)/16)),c=new Uint8Array(s),l=C.getTimeArr();c[0]=l[1],c[1]=l[2],c[2]=l[3],c[3]=l[4],c[4]=l[5],c[5]=l[6];for(var u=0;u<e.length;u++)c[6+u]=e[u];var f=C.Encrypt(C.ab2hex(c.buffer),n);for(u=0;u<f.byteLength;u++)i[13+u]=f[u];return i[13+f.byteLength]=C.GetXorCheck(i.slice(1,f.byteLength+13),f.byteLength+13),i[14+f.byteLength]=126,C.ShiftSend(i.slice(0,14+f.byteLength+1))}var E={setCommand:function(t,e){switch(t){case"HHD_JT_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),R(S,B,t)}return!1}(e);case"HHD_JT_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return R(r,a,t)}(e);case"HHD_JT_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),R(r,i,t)}(e);case"HHD_JT_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,R(r,n,t)}(e)}}},P=a(a({},D),E),M=Object.freeze({__proto__:null,default:P});var O={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"0310":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0312":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0214":return r;case"0216":return r=a(a({},r),function(t){var e=1,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function N(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var z={setCommand:function(t,e){switch(t){case"HHD_G_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),N(S,B,t)}return!1}(e);case"HHD_G_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return N(r,a,t)}(e);case"HHD_G_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),N(r,i,t)}(e);case"HHD_G_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,N(r,n,t)}(e)}}},F=a(a({},O),z),j=Object.freeze({__proto__:null,default:F}),V=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.modules={Block:!1!==e.Block?H:null,JTGlock:!1!==e.JTGlock?P:null,Glock:!1!==e.Glock?F:null},this.version="__VERSION__"},n=[{key:"loadModule",value:(a=o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.modules[e]){t.next=16;break}t.t0=e,t.next="Block"===t.t0?4:"JTGlock"===t.t0?8:"Glock"===t.t0?12:16;break;case 4:return t.next=6,Promise.resolve().then((function(){return L}));case 6:return this.modules.Block=t.sent.default,t.abrupt("break",16);case 8:return t.next=10,Promise.resolve().then((function(){return M}));case 10:return this.modules.JTlock=t.sent.default,t.abrupt("break",16);case 12:return t.next=14,Promise.resolve().then((function(){return j}));case 14:return this.modules.Glock=t.sent.default,t.abrupt("break",16);case 16:return t.abrupt("return",this.modules[e]);case 17:case"end":return t.stop()}}),t,this)})),s=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=a.apply(t,r);function s(t){e(o,n,i,s,c,"next",t)}function c(t){e(o,n,i,s,c,"throw",t)}s(void 0)}))},function(t){return s.apply(this,arguments)})},{key:"Block",get:function(){return this.modules.Block}},{key:"JTGlock",get:function(){return this.modules.JTGlock}},{key:"Glock",get:function(){return this.modules.Glock}}],n&&r(t.prototype,n),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i,a,s}();module.exports=V;
|
|
15
|
+
U.mode.CTRGladman=function(){var t=U.lib.BlockCipherMode.extend();function e(t){if(255&~(t>>24))t+=1<<24;else{var e=t>>16&255,r=t>>8&255,n=255&t;255===e?(e=0,255===r?(r=0,255===n?n=0:++n):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=n}return t}function r(t){return 0===(t[0]=e(t[0]))&&(t[1]=e(t[1])),t}var n=t.Encryptor=t.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),r(o);var s=o.slice(0);n.encryptBlock(s,0);for(var c=0;c<i;c++)t[e+c]^=s[c]}});return t.Decryptor=n,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.Rabbit=e.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)s.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(i[0]^=l,i[1]^=f,i[2]^=u,i[3]^=h,i[4]^=l,i[5]^=f,i[6]^=u,i[7]^=h,r=0;r<4;r++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=e._createHelper(o)}(),U.mode.CTR=function(){var t=U.lib.BlockCipherMode.extend(),e=t.Encryptor=t.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)t[e+s]^=o[s]}});return t.Decryptor=e,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.RabbitLegacy=e.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)s.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(n[0]^=l,n[1]^=f,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=f,n[6]^=u,n[7]^=h,i=0;i<4;i++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=e._createHelper(o)}(),U.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){for(var e=t.words,r=t.sigBytes-1;!(e[r>>>2]>>>24-r%4*8&255);)r--;t.sigBytes=r+1}},U),new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);var C={formatTime:w,inArray:function(t,e,r){for(var n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1},ab2hex:b,mergeArrayBuffer:function(){for(var t=0,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0;i<r.length;i++)r[i]=new Uint8Array(r[i]),t+=r[i].length;for(var a=new Uint8Array(t),o=0,s=0,c=r;s<c.length;s++){var l=c[s];a.set(l,o),o+=l.length}return a.buffer},Encrypt:B,Decrypt:function(t,e,r){var n=b(B(b(new Uint8Array(16).buffer),e)),i=m.exports;t=A(t);var a=new Uint8Array([]);e=b(e);for(var o=i.enc.Hex.parse(e),c=i.enc.Hex.parse(""),l=0;l<t.length;l+=16){var u=t.slice(l,l+16);if(b(u)!=n){var f=i.enc.Hex.parse(b(u)),h=i.enc.Base64.stringify(f),g=i.AES.decrypt(h,o,{iv:c,mode:i.mode.CBC,padding:i.pad.NoPadding});a=new Uint8Array([].concat(s(a),s(A(i.enc.Hex.stringify(g)))))}}return a},Crc16_Ccitt:S,SunCheck:function(t,e){var r,n=0;for(r=0;r<e;r++)n=n+(255&t[r])&255;return n=1+~n,(n&=255)>240&&(n-=16),n},stringToUint8Array:function(t){for(var e=[],r=0,n=t.length;r<n;++r)e.push(t.charCodeAt(r));return new Uint8Array(e)},sleep:function(t){for(var e=new Date,r=e.getTime()+t;;)if((e=new Date).getTime()>r)return},Uint8ArrayToHex:function(t,e){if(null==t)return"";for(var r,n=[],i=0;i<t.length;i++)1==(r=t[i].toString(16)).length&&(r="0"+r),n.push(r);return e?n.join(""):n.join(" ")},Uint8ArrayToString:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},getTimeArr:function(t){var e=w(new Date);return t&&(e=w(new Date(t))),A(e)},HexToUint8Array:A,DelayExecFunc:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;null==t||t.length<1||null==e||r<1||function n(){null==t||t.length<1||(e(t.shift()),setTimeout(n,r))}()},SplitArray:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null==t||t.length<1||e<1)return[];for(var n=[],i=0;i<t.length;)n.push(t.slice(i,i+e)),i+=e;return null==r||n.forEach((function(t,e,n){r(t)})),n},clone:function(t){var e=null;if(t instanceof Array)e=t.concat();else if(t instanceof Function)e=t;else for(var r in e=new Object,t){var n=t[r];e[r]=n instanceof Object?this.clone(n):n}return e},GetPowerPercent:function(t){if(t<=3)return 0;if(t>4.22)return 102;if(t>=4.2)return 100;var e=0,r=0,n=0,i=10;return t<4.2&&t>=4.06?(e=90,r=4.2,n=4.06):t<4.06&&t>=3.98?(e=80,r=4.06,n=3.98):t<3.98&&t>=3.92?(e=70,r=3.98,n=3.92):t<3.92&&t>=3.87?(e=60,r=3.92,n=3.87):t<3.87&&t>=3.82?(e=50,r=3.87,n=3.82):t<3.82&&t>=3.79?(e=40,r=3.82,n=3.79):t<3.79&&t>=3.77?(e=30,r=3.79,n=3.77):t<3.77&&t>=3.74?(e=20,r=3.77,n=3.74):t<3.74&&t>=3.68?(e=10,r=3.74,n=3.68):t<3.68&&t>=3.45?(e=5,r=3.68,n=3.45,i=5):t<3.45&&t>=3&&(e=0,r=3.45,n=3,i=5),parseInt(e+i*(t-n)/(r-n))},GetPower:function(t){return t<3?5:t>=3?100:parseInt(t)},GetPowertow:function(t){var e=0;return t<1.4?0:t>=3?100:(t<3&&t>=2.5?e=(e=parseInt(392.16*t-488.24))>=100?100:e:t<2.016&&t>=1.4?e=parseInt(44.286*t*t-10.706*t-14.206):t<2.628&&t>=2.016?e=parseInt(13141*t*t-3752.7*t*t*t-15022*t+5653.6):t<3&&t>=2.628&&(e=(e=parseInt(53.763*t+19.36))>=100?100:e),e)},GetXorCheck:function(t,e){if(null==t||e<1)return 0;for(var r=0,n=0;n<e;n++)r^=t[n],r&=255;return r},ShiftSend:function(t){for(var e=new ArrayBuffer(2*t.length+2),r=new DataView(e,0),n=1,i=1;i<t.length-1;i++)126==t[i]?(r.setUint8(n,125),r.setUint8(n+1,2),n++):125==t[i]?(r.setUint8(n,125),r.setUint8(n+1,1),n++):r.setUint8(n,t[i]),n++;r.setUint8(0,126),r.setUint8(n,126),n++;try{return new Uint8Array(e.slice(0,n))}catch(t){return!1}},recoverRecv:function(t){for(var e=new Uint8Array(t.length),r=0,n=0;n<t.length;n++)125==t[n]?2==t[n+1]?(e[r]=126,n++):1==t[n+1]?(e[r]=125,n++):e[r]=t[n]:e[r]=t[n],r++;return e=e.slice(0,r)},bufferToHex:function(t){if(null==t)return"";for(var e,r=[],n=0;n<t.length;n++)1==(e=t[n].toString(16)).length&&(e="0"+e),r.push(e);return r.join(" ")},stringToUint8Arraytwo:function(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?(e.push(192|n>>6),e.push(128|63&n)):n<65536?(e.push(224|n>>12),e.push(128|n>>6&63),e.push(128|63&n)):(e.push(240|n>>18),e.push(128|n>>12&63),e.push(128|n>>6&63),e.push(128|63&n))}return new Uint8Array(e)},checkCrc:function(t,e){var r=new ArrayBuffer(2),n=new DataView(r);n.setUint8(0,t[0]),n.setUint8(1,t[1]);var i=t.slice(12,e),a=S(i,i.length);return a&=65535,n.getUint16(0)==a}};var k={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"2401":return r=a(a({},r),function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint16(3),n={};1==(r>>15&1)?n.Power=((32767&r)/100).toFixed(2):n.Voltage=(r/1e3).toFixed(2);return n.sealNum=e.getUint32(5),n.unsealNum=e.getUint32(9),n.Time=C.Uint8ArrayToHex(t.slice(13,20),!0),n}(c));case"2403":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={CardList:[]},n=(t.length-1)/4,i=0;i<n;i++){var a=t.slice(e,e+4);r.CardList.push(C.ab2hex(a)),e+=4}return r.CardList=r.CardList,r}(c));case"2406":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={sealLogList:[]},n=(t.length-1)/11,i=0;i<n;i++){var a={};a.eventID=t[e];var o=t.slice(e+1,e+1+4);a.UserId=C.ab2hex(o),o=t.slice(e+5,e+5+6),a.Time=C.ab2hex(o),r.sealLogList.push(a),e+=11}return r}(c));case"2407":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=1,n={alarmLogList:[]},i=(t.length-1)/10,a=0;a<i;a++){var o={};o.eventID=e.getUint8(r),o.sealStatus=e.getUint8(r+1),o.Voltage=e.getUint16(r+2)/1e3;var s=t.slice(r+4,r+4+6);o.Time=C.ab2hex(s),n.alarmLogList.push(o),r+=10}return n}(c));case"2409":return r=a(a({},r),function(t){if(1!=t[0])return;var e=1,r={Content:""},n=t.slice(e,e+512);return r.Content=C.Uint8ArrayToString(n),r}(c));case"240D":return r.Data=function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(1),n=1,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2)}catch(t){break}if("0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o){var c=0;2==s&&(c=e.getUint16(n+3)),i[""+o]=c}else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x04"==o||"0x07"==o||"0x06"==o||"0x10"==o||"0x12"==o||"0xFC"==o){c="";c=C.Uint8ArrayToHex(t.slice(n+3,n+3+s),!0),i[""+o]=c}else if("0x11"==o||"0x0E"==o||"0x08"==o||"0x09"==o||"0x0A"==o){var l=t.slice(n+3,n+3+s);if(parseInt(l[0])>=49)i[""+o]=C.Uint8ArrayToString(l);else{for(var u="",f=0;f<l.length;f++)u+=l[f];i[""+o]=u}}else{l=t.slice(n+3,n+3+s);i[""+o]=l.toString()}n+=2+s}return i}(c),r;case"2402":case"2408":case"240A":case"240B":case"240C":return r}}catch(t){return console.log("==--",t),r}}};function T(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var I={setCommand:function(t,e){switch(t){case"HHD_BLE_2401":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=1;for(var r=new Uint8Array(20),n=C.stringToUint8Arraytwo(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];r[8]=parseInt(t.setData.cmd);var a=C.getTimeArr();return r[9]=a[0],r[10]=a[1],r[11]=a[2],r[12]=a[3],r[13]=a[4],r[14]=a[5],r[15]=a[6],r[16]=0,r[17]=0,r[18]=0,r[19]=0,T(e,r,t)}(e);case"HHD_BLE_2402":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=2;for(var r=t.setData,n=new Uint8Array(8+4*r.length),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];var o=0;for(a=0;a<r.length;a++){for(var s=C.HexToUint8Array(r[a]),c=0;c<4;c++)n[8+o+c]=s[c];o+=4}return T(e,n,t)}(e);case"HHD_BLE_2403":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=3;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2406":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=6;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2407":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=7;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2408":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=8;for(var r=C.stringToUint8Arraytwo(t.setData.content),n=new Uint8Array(8+r.length+1),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];n[8]=parseInt(t.setData.address);for(a=0;a<r.length;a++)n[9+a]=r[a];return T(e,n,t)}(e);case"HHD_BLE_2409":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=9;for(var r=new Uint8Array(9),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return r[8]=t.setData.address,T(e,r,t)}(e);case"HHD_BLE_240A":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=10;for(var r=new Uint8Array(16),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.password);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240B":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=11;for(var r=new Uint8Array(24),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.aespassword);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240C":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(a.setUint8(r+1,parseInt(o)),"0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o)a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o||"0xFE"==o||"0x14"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x04"==o){a.setUint8(r+2,7);var c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),a.setUint8(r+9,c[6]),r+=9}else if("0x07"==o){a.setUint8(r+2,6);c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),r+=8}else if("0xFC"==o){var l=C.HexToUint8Array(s);a.setUint8(r+2,l.length);for(var u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);r+=l.length+2}else{for(l=C.stringToUint8Arraytwo(s),u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);a.setUint8(r+2,l.length),r+=2+l.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var f=new Uint8Array(2);f[0]=36,f[1]=12;var h=new Uint8Array(8+r+1),g=C.stringToUint8Array(t.blePassword);for(u=0;u<g.byteLength;u++)h[u]=g[u];for(u=0;u<r+1;u++)h[8+u]=a.getUint8(u);return T(f,h,t)}return!1}(e);case"HHD_BLE_240D":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=13;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e)}}},H=a(a({},k),I),L=Object.freeze({__proto__:null,default:H});var D={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),t=C.recoverRecv(t),console.log("反转报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(3,5);i=2047&new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+15!=n)return r;var s=t.slice(13,n-2);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);switch(console.log("解密后:",C.ab2hex(c)),c=c.slice(8,i),console.log("解密后:",C.ab2hex(c)),console.log("解密后:",i),r.Code=c[0],C.ab2hex(t.slice(1,3)).toUpperCase()){case"0311":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0313":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0215":return r;case"0217":return r=a(a({},r),function(t){var e=0,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function R(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)})),console.log("11111");var i=new Uint8Array(2e3);i[0]=126,i[1]=t[0],i[2]=t[1];var a=e.length+6|32768;i[3]=a>>8,i[4]=a;var o="00000000000000"+r.lockId;o=o.substr(-12),i[5]=parseInt(o.substr(0,2),16),i[6]=parseInt(o.substr(2,2),16),i[7]=parseInt(o.substr(4,2),16),i[8]=parseInt(o.substr(6,2),16),i[9]=parseInt(o.substr(8,2),16),i[10]=parseInt(o.substr(10,2),16),i[11]=0,i[12]=0;var s=parseInt(16*Math.ceil((6+e.length)/16)),c=new Uint8Array(s),l=C.getTimeArr();c[0]=l[1],c[1]=l[2],c[2]=l[3],c[3]=l[4],c[4]=l[5],c[5]=l[6];for(var u=0;u<e.length;u++)c[6+u]=e[u];console.log("22323");var f=C.Encrypt(C.ab2hex(c.buffer),n);console.log("22323"),console.log("abx",C.ab2hex(f));for(u=0;u<f.byteLength;u++)i[13+u]=f[u];return i[13+f.byteLength]=C.GetXorCheck(i.slice(1,f.byteLength+13),f.byteLength+13),i[14+f.byteLength]=126,console.log("abx",C.ab2hex(C.ShiftSend(i.slice(0,14+f.byteLength+1)))),C.ShiftSend(i.slice(0,14+f.byteLength+1))}var E={setCommand:function(t,e){switch(t){case"HHD_JT_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),console.log("原始报文",t),console.log("原始报文",C.ab2hex(S)),R(S,B,t)}return!1}(e);case"HHD_JT_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return R(r,a,t)}(e);case"HHD_JT_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),R(r,i,t)}(e);case"HHD_JT_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,R(r,n,t)}(e)}}},P=a(a({},D),E),M=Object.freeze({__proto__:null,default:P});var O={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"0310":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0312":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0214":return r;case"0216":return r=a(a({},r),function(t){var e=1,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function N(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var z={setCommand:function(t,e){switch(t){case"HHD_G_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),N(S,B,t)}return!1}(e);case"HHD_G_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return N(r,a,t)}(e);case"HHD_G_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),N(r,i,t)}(e);case"HHD_G_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,N(r,n,t)}(e)}}},F=a(a({},O),z),j=Object.freeze({__proto__:null,default:F}),V=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.modules={Block:!1!==e.Block?H:null,JTGlock:!1!==e.JTGlock?P:null,Glock:!1!==e.Glock?F:null},this.version="__VERSION__"},n=[{key:"loadModule",value:(a=o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.modules[e]){t.next=16;break}t.t0=e,t.next="Block"===t.t0?4:"JTGlock"===t.t0?8:"Glock"===t.t0?12:16;break;case 4:return t.next=6,Promise.resolve().then((function(){return L}));case 6:return this.modules.Block=t.sent.default,t.abrupt("break",16);case 8:return t.next=10,Promise.resolve().then((function(){return M}));case 10:return this.modules.JTGlock=t.sent.default,t.abrupt("break",16);case 12:return t.next=14,Promise.resolve().then((function(){return j}));case 14:return this.modules.Glock=t.sent.default,t.abrupt("break",16);case 16:return t.abrupt("return",this.modules[e]);case 17:case"end":return t.stop()}}),t,this)})),s=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=a.apply(t,r);function s(t){e(o,n,i,s,c,"next",t)}function c(t){e(o,n,i,s,c,"throw",t)}s(void 0)}))},function(t){return s.apply(this,arguments)})},{key:"Block",get:function(){return this.modules.Block}},{key:"JTGlock",get:function(){return this.modules.JTGlock}},{key:"Glock",get:function(){return this.modules.Glock}}],n&&r(t.prototype,n),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i,a,s}();module.exports=V;
|
package/dist/index.esm.js
CHANGED
|
@@ -12,4 +12,4 @@ function(){var t=U,e=t.lib,r=e.WordArray,n=e.Hasher,i=t.algo,a=r.create([0,1,2,3
|
|
|
12
12
|
* derived from CryptoJS.mode.CTR
|
|
13
13
|
* Jan Hruby jhruby.web@gmail.com
|
|
14
14
|
*/
|
|
15
|
-
U.mode.CTRGladman=function(){var t=U.lib.BlockCipherMode.extend();function e(t){if(255&~(t>>24))t+=1<<24;else{var e=t>>16&255,r=t>>8&255,n=255&t;255===e?(e=0,255===r?(r=0,255===n?n=0:++n):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=n}return t}function r(t){return 0===(t[0]=e(t[0]))&&(t[1]=e(t[1])),t}var n=t.Encryptor=t.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),r(o);var s=o.slice(0);n.encryptBlock(s,0);for(var c=0;c<i;c++)t[e+c]^=s[c]}});return t.Decryptor=n,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.Rabbit=e.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)s.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(i[0]^=l,i[1]^=f,i[2]^=u,i[3]^=h,i[4]^=l,i[5]^=f,i[6]^=u,i[7]^=h,r=0;r<4;r++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=e._createHelper(o)}(),U.mode.CTR=function(){var t=U.lib.BlockCipherMode.extend(),e=t.Encryptor=t.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)t[e+s]^=o[s]}});return t.Decryptor=e,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.RabbitLegacy=e.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)s.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(n[0]^=l,n[1]^=f,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=f,n[6]^=u,n[7]^=h,i=0;i<4;i++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=e._createHelper(o)}(),U.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){for(var e=t.words,r=t.sigBytes-1;!(e[r>>>2]>>>24-r%4*8&255);)r--;t.sigBytes=r+1}},U),new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);var C={formatTime:w,inArray:function(t,e,r){for(var n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1},ab2hex:b,mergeArrayBuffer:function(){for(var t=0,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0;i<r.length;i++)r[i]=new Uint8Array(r[i]),t+=r[i].length;for(var a=new Uint8Array(t),o=0,s=0,c=r;s<c.length;s++){var l=c[s];a.set(l,o),o+=l.length}return a.buffer},Encrypt:B,Decrypt:function(t,e,r){var n=b(B(b(new Uint8Array(16).buffer),e)),i=m.exports;t=A(t);var a=new Uint8Array([]);e=b(e);for(var o=i.enc.Hex.parse(e),c=i.enc.Hex.parse(""),l=0;l<t.length;l+=16){var u=t.slice(l,l+16);if(b(u)!=n){var f=i.enc.Hex.parse(b(u)),h=i.enc.Base64.stringify(f),g=i.AES.decrypt(h,o,{iv:c,mode:i.mode.CBC,padding:i.pad.ZeroPadding});a=new Uint8Array([].concat(s(a),s(A(i.enc.Hex.stringify(g)))))}}return a},Crc16_Ccitt:S,SunCheck:function(t,e){var r,n=0;for(r=0;r<e;r++)n=n+(255&t[r])&255;return n=1+~n,(n&=255)>240&&(n-=16),n},stringToUint8Array:function(t){for(var e=[],r=0,n=t.length;r<n;++r)e.push(t.charCodeAt(r));return new Uint8Array(e)},sleep:function(t){for(var e=new Date,r=e.getTime()+t;;)if((e=new Date).getTime()>r)return},Uint8ArrayToHex:function(t,e){if(null==t)return"";for(var r,n=[],i=0;i<t.length;i++)1==(r=t[i].toString(16)).length&&(r="0"+r),n.push(r);return e?n.join(""):n.join(" ")},Uint8ArrayToString:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},getTimeArr:function(t){var e=w(new Date);return t&&(e=w(new Date(t))),A(e)},HexToUint8Array:A,DelayExecFunc:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;null==t||t.length<1||null==e||r<1||function n(){null==t||t.length<1||(e(t.shift()),setTimeout(n,r))}()},SplitArray:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null==t||t.length<1||e<1)return[];for(var n=[],i=0;i<t.length;)n.push(t.slice(i,i+e)),i+=e;return null==r||n.forEach((function(t,e,n){r(t)})),n},clone:function(t){var e=null;if(t instanceof Array)e=t.concat();else if(t instanceof Function)e=t;else for(var r in e=new Object,t){var n=t[r];e[r]=n instanceof Object?this.clone(n):n}return e},GetPowerPercent:function(t){if(t<=3)return 0;if(t>4.22)return 102;if(t>=4.2)return 100;var e=0,r=0,n=0,i=10;return t<4.2&&t>=4.06?(e=90,r=4.2,n=4.06):t<4.06&&t>=3.98?(e=80,r=4.06,n=3.98):t<3.98&&t>=3.92?(e=70,r=3.98,n=3.92):t<3.92&&t>=3.87?(e=60,r=3.92,n=3.87):t<3.87&&t>=3.82?(e=50,r=3.87,n=3.82):t<3.82&&t>=3.79?(e=40,r=3.82,n=3.79):t<3.79&&t>=3.77?(e=30,r=3.79,n=3.77):t<3.77&&t>=3.74?(e=20,r=3.77,n=3.74):t<3.74&&t>=3.68?(e=10,r=3.74,n=3.68):t<3.68&&t>=3.45?(e=5,r=3.68,n=3.45,i=5):t<3.45&&t>=3&&(e=0,r=3.45,n=3,i=5),parseInt(e+i*(t-n)/(r-n))},GetPower:function(t){return t<3?5:t>=3?100:parseInt(t)},GetPowertow:function(t){var e=0;return t<1.4?0:t>=3?100:(t<3&&t>=2.5?e=(e=parseInt(392.16*t-488.24))>=100?100:e:t<2.016&&t>=1.4?e=parseInt(44.286*t*t-10.706*t-14.206):t<2.628&&t>=2.016?e=parseInt(13141*t*t-3752.7*t*t*t-15022*t+5653.6):t<3&&t>=2.628&&(e=(e=parseInt(53.763*t+19.36))>=100?100:e),e)},GetXorCheck:function(t,e){if(null==t||e<1)return 0;for(var r=0,n=0;n<e;n++)r^=t[n],r&=255;return r},ShiftSend:function(t){for(var e=new ArrayBuffer(2*t.length+2),r=new DataView(e,0),n=1,i=1;i<t.length-1;i++)126==t[i]?(r.setUint8(n,125),r.setUint8(n+1,2),n++):125==t[i]?(r.setUint8(n,125),r.setUint8(n+1,1),n++):r.setUint8(n,t[i]),n++;r.setUint8(0,126),r.setUint8(n,126),n++;var a=function(t){for(var e=Buffer.alloc(t.byteLength,0),r=new Uint8Array(t),n=0;n<e.length;++n)e[n]=r[n];return e}(e=e.slice(0,n));try{return a.slice(0,n)}catch(t){return!1}},recoverRecv:function(t){for(var e=new Uint8Array(t.length),r=0,n=0;n<t.length;n++)125==t[n]?2==t[n+1]?(e[r]=126,n++):1==t[n+1]?(e[r]=125,n++):e[r]=t[n]:e[r]=t[n],r++;return e=e.slice(0,r)},bufferToHex:function(t){if(null==t)return"";for(var e,r=[],n=0;n<t.length;n++)1==(e=t[n].toString(16)).length&&(e="0"+e),r.push(e);return r.join(" ")},stringToUint8Arraytwo:function(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?(e.push(192|n>>6),e.push(128|63&n)):n<65536?(e.push(224|n>>12),e.push(128|n>>6&63),e.push(128|63&n)):(e.push(240|n>>18),e.push(128|n>>12&63),e.push(128|n>>6&63),e.push(128|63&n))}return new Uint8Array(e)},checkCrc:function(t,e){var r=new ArrayBuffer(2),n=new DataView(r);n.setUint8(0,t[0]),n.setUint8(1,t[1]);var i=t.slice(12,e),a=S(i,i.length);return a&=65535,n.getUint16(0)==a}};var k={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"2401":return r=a(a({},r),function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint16(3),n={};1==(r>>15&1)?n.Power=((32767&r)/100).toFixed(2):n.Voltage=(r/1e3).toFixed(2);return n.sealNum=e.getUint32(5),n.unsealNum=e.getUint32(9),n.Time=C.Uint8ArrayToHex(t.slice(13,20),!0),n}(c));case"2403":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={CardList:[]},n=(t.length-1)/4,i=0;i<n;i++){var a=t.slice(e,e+4);r.CardList.push(C.ab2hex(a)),e+=4}return r.CardList=r.CardList,r}(c));case"2406":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={sealLogList:[]},n=(t.length-1)/11,i=0;i<n;i++){var a={};a.eventID=t[e];var o=t.slice(e+1,e+1+4);a.UserId=C.ab2hex(o),o=t.slice(e+5,e+5+6),a.Time=C.ab2hex(o),r.sealLogList.push(a),e+=11}return r}(c));case"2407":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=1,n={alarmLogList:[]},i=(t.length-1)/10,a=0;a<i;a++){var o={};o.eventID=e.getUint8(r),o.sealStatus=e.getUint8(r+1),o.Voltage=e.getUint16(r+2)/1e3;var s=t.slice(r+4,r+4+6);o.Time=C.ab2hex(s),n.alarmLogList.push(o),r+=10}return n}(c));case"2409":return r=a(a({},r),function(t){if(1!=t[0])return;var e=1,r={Content:""},n=t.slice(e,e+512);return r.Content=C.Uint8ArrayToString(n),r}(c));case"240D":return r.Data=function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(1),n=1,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2)}catch(t){break}if("0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o){var c=0;2==s&&(c=e.getUint16(n+3)),i[""+o]=c}else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x04"==o||"0x07"==o||"0x06"==o||"0x10"==o||"0x12"==o||"0xFC"==o){c="";c=C.Uint8ArrayToHex(t.slice(n+3,n+3+s),!0),i[""+o]=c}else if("0x11"==o||"0x0E"==o||"0x08"==o||"0x09"==o||"0x0A"==o){var l=t.slice(n+3,n+3+s);if(parseInt(l[0])>=49)i[""+o]=C.Uint8ArrayToString(l);else{for(var u="",f=0;f<l.length;f++)u+=l[f];i[""+o]=u}}else{l=t.slice(n+3,n+3+s);i[""+o]=l.toString()}n+=2+s}return i}(c),r;case"2402":case"2408":case"240A":case"240B":case"240C":return r}}catch(t){return console.log("==--",t),r}}};function T(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var I={setCommand:function(t,e){switch(t){case"HHD_BLE_2401":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=1;for(var r=new Uint8Array(20),n=C.stringToUint8Arraytwo(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];r[8]=parseInt(t.setData.cmd);var a=C.getTimeArr();return r[9]=a[0],r[10]=a[1],r[11]=a[2],r[12]=a[3],r[13]=a[4],r[14]=a[5],r[15]=a[6],r[16]=0,r[17]=0,r[18]=0,r[19]=0,T(e,r,t)}(e);case"HHD_BLE_2402":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=2;for(var r=t.setData,n=new Uint8Array(8+4*r.length),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];var o=0;for(a=0;a<r.length;a++){for(var s=C.HexToUint8Array(r[a]),c=0;c<4;c++)n[8+o+c]=s[c];o+=4}return T(e,n,t)}(e);case"HHD_BLE_2403":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=3;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2406":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=6;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2407":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=7;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2408":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=8;for(var r=C.stringToUint8Arraytwo(t.setData.content),n=new Uint8Array(8+r.length+1),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];n[8]=parseInt(t.setData.address);for(a=0;a<r.length;a++)n[9+a]=r[a];return T(e,n,t)}(e);case"HHD_BLE_2409":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=9;for(var r=new Uint8Array(9),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return r[8]=t.setData.address,T(e,r,t)}(e);case"HHD_BLE_240A":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=10;for(var r=new Uint8Array(16),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.password);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240B":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=11;for(var r=new Uint8Array(24),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.aespassword);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240C":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(a.setUint8(r+1,parseInt(o)),"0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o)a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o||"0xFE"==o||"0x14"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x04"==o){a.setUint8(r+2,7);var c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),a.setUint8(r+9,c[6]),r+=9}else if("0x07"==o){a.setUint8(r+2,6);c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),r+=8}else if("0xFC"==o){var l=C.HexToUint8Array(s);a.setUint8(r+2,l.length);for(var u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);r+=l.length+2}else{for(l=C.stringToUint8Arraytwo(s),u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);a.setUint8(r+2,l.length),r+=2+l.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var f=new Uint8Array(2);f[0]=36,f[1]=12;var h=new Uint8Array(8+r+1),g=C.stringToUint8Array(t.blePassword);for(u=0;u<g.byteLength;u++)h[u]=g[u];for(u=0;u<r+1;u++)h[8+u]=a.getUint8(u);return T(f,h,t)}return!1}(e);case"HHD_BLE_240D":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=13;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e)}}},H=a(a({},k),I),L=Object.freeze({__proto__:null,default:H});var D={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),t=C.recoverRecv(t),console.log("反转报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(3,5);i=2047&new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+15!=n)return r;var s=t.slice(13,n-2);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);switch(console.log("解密后:",C.ab2hex(c)),c=c.slice(8,i),r.Code=c[0],C.ab2hex(t.slice(1,3)).toUpperCase()){case"0311":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0313":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0215":return r;case"0217":return r=a(a({},r),function(t){var e=0,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function R(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=126,i[1]=t[0],i[2]=t[1];var a=e.length+6|32768;i[3]=a>>8,i[4]=a;var o="00000000000000"+r.lockId;o=o.substr(-12),i[5]=parseInt(o.substr(0,2),16),i[6]=parseInt(o.substr(2,2),16),i[7]=parseInt(o.substr(4,2),16),i[8]=parseInt(o.substr(6,2),16),i[9]=parseInt(o.substr(8,2),16),i[10]=parseInt(o.substr(10,2),16),i[11]=0,i[12]=0;var s=parseInt(16*Math.ceil((6+e.length)/16)),c=new Uint8Array(s),l=C.getTimeArr();c[0]=l[1],c[1]=l[2],c[2]=l[3],c[3]=l[4],c[4]=l[5],c[5]=l[6];for(var u=0;u<e.length;u++)c[6+u]=e[u];var f=C.Encrypt(C.ab2hex(c.buffer),n);for(u=0;u<f.byteLength;u++)i[13+u]=f[u];return i[13+f.byteLength]=C.GetXorCheck(i.slice(1,f.byteLength+13),f.byteLength+13),i[14+f.byteLength]=126,C.ShiftSend(i.slice(0,14+f.byteLength+1))}var E={setCommand:function(t,e){switch(t){case"HHD_JT_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),R(S,B,t)}return!1}(e);case"HHD_JT_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return R(r,a,t)}(e);case"HHD_JT_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),R(r,i,t)}(e);case"HHD_JT_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,R(r,n,t)}(e)}}},P=a(a({},D),E),M=Object.freeze({__proto__:null,default:P});var O={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"0310":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0312":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0214":return r;case"0216":return r=a(a({},r),function(t){var e=1,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function N(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var z={setCommand:function(t,e){switch(t){case"HHD_G_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),N(S,B,t)}return!1}(e);case"HHD_G_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return N(r,a,t)}(e);case"HHD_G_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),N(r,i,t)}(e);case"HHD_G_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,N(r,n,t)}(e)}}},F=a(a({},O),z),j=Object.freeze({__proto__:null,default:F}),V=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.modules={Block:!1!==e.Block?H:null,JTGlock:!1!==e.JTGlock?P:null,Glock:!1!==e.Glock?F:null},this.version="__VERSION__"},n=[{key:"loadModule",value:(a=o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.modules[e]){t.next=16;break}t.t0=e,t.next="Block"===t.t0?4:"JTGlock"===t.t0?8:"Glock"===t.t0?12:16;break;case 4:return t.next=6,Promise.resolve().then((function(){return L}));case 6:return this.modules.Block=t.sent.default,t.abrupt("break",16);case 8:return t.next=10,Promise.resolve().then((function(){return M}));case 10:return this.modules.JTlock=t.sent.default,t.abrupt("break",16);case 12:return t.next=14,Promise.resolve().then((function(){return j}));case 14:return this.modules.Glock=t.sent.default,t.abrupt("break",16);case 16:return t.abrupt("return",this.modules[e]);case 17:case"end":return t.stop()}}),t,this)})),s=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=a.apply(t,r);function s(t){e(o,n,i,s,c,"next",t)}function c(t){e(o,n,i,s,c,"throw",t)}s(void 0)}))},function(t){return s.apply(this,arguments)})},{key:"Block",get:function(){return this.modules.Block}},{key:"JTGlock",get:function(){return this.modules.JTGlock}},{key:"Glock",get:function(){return this.modules.Glock}}],n&&r(t.prototype,n),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i,a,s}();export{V as default};
|
|
15
|
+
U.mode.CTRGladman=function(){var t=U.lib.BlockCipherMode.extend();function e(t){if(255&~(t>>24))t+=1<<24;else{var e=t>>16&255,r=t>>8&255,n=255&t;255===e?(e=0,255===r?(r=0,255===n?n=0:++n):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=n}return t}function r(t){return 0===(t[0]=e(t[0]))&&(t[1]=e(t[1])),t}var n=t.Encryptor=t.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),r(o);var s=o.slice(0);n.encryptBlock(s,0);for(var c=0;c<i;c++)t[e+c]^=s[c]}});return t.Decryptor=n,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.Rabbit=e.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)s.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(i[0]^=l,i[1]^=f,i[2]^=u,i[3]^=h,i[4]^=l,i[5]^=f,i[6]^=u,i[7]^=h,r=0;r<4;r++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=e._createHelper(o)}(),U.mode.CTR=function(){var t=U.lib.BlockCipherMode.extend(),e=t.Encryptor=t.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)t[e+s]^=o[s]}});return t.Decryptor=e,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.RabbitLegacy=e.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)s.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(n[0]^=l,n[1]^=f,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=f,n[6]^=u,n[7]^=h,i=0;i<4;i++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=e._createHelper(o)}(),U.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){for(var e=t.words,r=t.sigBytes-1;!(e[r>>>2]>>>24-r%4*8&255);)r--;t.sigBytes=r+1}},U),new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);var C={formatTime:w,inArray:function(t,e,r){for(var n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1},ab2hex:b,mergeArrayBuffer:function(){for(var t=0,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0;i<r.length;i++)r[i]=new Uint8Array(r[i]),t+=r[i].length;for(var a=new Uint8Array(t),o=0,s=0,c=r;s<c.length;s++){var l=c[s];a.set(l,o),o+=l.length}return a.buffer},Encrypt:B,Decrypt:function(t,e,r){var n=b(B(b(new Uint8Array(16).buffer),e)),i=m.exports;t=A(t);var a=new Uint8Array([]);e=b(e);for(var o=i.enc.Hex.parse(e),c=i.enc.Hex.parse(""),l=0;l<t.length;l+=16){var u=t.slice(l,l+16);if(b(u)!=n){var f=i.enc.Hex.parse(b(u)),h=i.enc.Base64.stringify(f),g=i.AES.decrypt(h,o,{iv:c,mode:i.mode.CBC,padding:i.pad.NoPadding});a=new Uint8Array([].concat(s(a),s(A(i.enc.Hex.stringify(g)))))}}return a},Crc16_Ccitt:S,SunCheck:function(t,e){var r,n=0;for(r=0;r<e;r++)n=n+(255&t[r])&255;return n=1+~n,(n&=255)>240&&(n-=16),n},stringToUint8Array:function(t){for(var e=[],r=0,n=t.length;r<n;++r)e.push(t.charCodeAt(r));return new Uint8Array(e)},sleep:function(t){for(var e=new Date,r=e.getTime()+t;;)if((e=new Date).getTime()>r)return},Uint8ArrayToHex:function(t,e){if(null==t)return"";for(var r,n=[],i=0;i<t.length;i++)1==(r=t[i].toString(16)).length&&(r="0"+r),n.push(r);return e?n.join(""):n.join(" ")},Uint8ArrayToString:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},getTimeArr:function(t){var e=w(new Date);return t&&(e=w(new Date(t))),A(e)},HexToUint8Array:A,DelayExecFunc:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;null==t||t.length<1||null==e||r<1||function n(){null==t||t.length<1||(e(t.shift()),setTimeout(n,r))}()},SplitArray:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null==t||t.length<1||e<1)return[];for(var n=[],i=0;i<t.length;)n.push(t.slice(i,i+e)),i+=e;return null==r||n.forEach((function(t,e,n){r(t)})),n},clone:function(t){var e=null;if(t instanceof Array)e=t.concat();else if(t instanceof Function)e=t;else for(var r in e=new Object,t){var n=t[r];e[r]=n instanceof Object?this.clone(n):n}return e},GetPowerPercent:function(t){if(t<=3)return 0;if(t>4.22)return 102;if(t>=4.2)return 100;var e=0,r=0,n=0,i=10;return t<4.2&&t>=4.06?(e=90,r=4.2,n=4.06):t<4.06&&t>=3.98?(e=80,r=4.06,n=3.98):t<3.98&&t>=3.92?(e=70,r=3.98,n=3.92):t<3.92&&t>=3.87?(e=60,r=3.92,n=3.87):t<3.87&&t>=3.82?(e=50,r=3.87,n=3.82):t<3.82&&t>=3.79?(e=40,r=3.82,n=3.79):t<3.79&&t>=3.77?(e=30,r=3.79,n=3.77):t<3.77&&t>=3.74?(e=20,r=3.77,n=3.74):t<3.74&&t>=3.68?(e=10,r=3.74,n=3.68):t<3.68&&t>=3.45?(e=5,r=3.68,n=3.45,i=5):t<3.45&&t>=3&&(e=0,r=3.45,n=3,i=5),parseInt(e+i*(t-n)/(r-n))},GetPower:function(t){return t<3?5:t>=3?100:parseInt(t)},GetPowertow:function(t){var e=0;return t<1.4?0:t>=3?100:(t<3&&t>=2.5?e=(e=parseInt(392.16*t-488.24))>=100?100:e:t<2.016&&t>=1.4?e=parseInt(44.286*t*t-10.706*t-14.206):t<2.628&&t>=2.016?e=parseInt(13141*t*t-3752.7*t*t*t-15022*t+5653.6):t<3&&t>=2.628&&(e=(e=parseInt(53.763*t+19.36))>=100?100:e),e)},GetXorCheck:function(t,e){if(null==t||e<1)return 0;for(var r=0,n=0;n<e;n++)r^=t[n],r&=255;return r},ShiftSend:function(t){for(var e=new ArrayBuffer(2*t.length+2),r=new DataView(e,0),n=1,i=1;i<t.length-1;i++)126==t[i]?(r.setUint8(n,125),r.setUint8(n+1,2),n++):125==t[i]?(r.setUint8(n,125),r.setUint8(n+1,1),n++):r.setUint8(n,t[i]),n++;r.setUint8(0,126),r.setUint8(n,126),n++;try{return new Uint8Array(e.slice(0,n))}catch(t){return!1}},recoverRecv:function(t){for(var e=new Uint8Array(t.length),r=0,n=0;n<t.length;n++)125==t[n]?2==t[n+1]?(e[r]=126,n++):1==t[n+1]?(e[r]=125,n++):e[r]=t[n]:e[r]=t[n],r++;return e=e.slice(0,r)},bufferToHex:function(t){if(null==t)return"";for(var e,r=[],n=0;n<t.length;n++)1==(e=t[n].toString(16)).length&&(e="0"+e),r.push(e);return r.join(" ")},stringToUint8Arraytwo:function(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?(e.push(192|n>>6),e.push(128|63&n)):n<65536?(e.push(224|n>>12),e.push(128|n>>6&63),e.push(128|63&n)):(e.push(240|n>>18),e.push(128|n>>12&63),e.push(128|n>>6&63),e.push(128|63&n))}return new Uint8Array(e)},checkCrc:function(t,e){var r=new ArrayBuffer(2),n=new DataView(r);n.setUint8(0,t[0]),n.setUint8(1,t[1]);var i=t.slice(12,e),a=S(i,i.length);return a&=65535,n.getUint16(0)==a}};var k={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"2401":return r=a(a({},r),function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint16(3),n={};1==(r>>15&1)?n.Power=((32767&r)/100).toFixed(2):n.Voltage=(r/1e3).toFixed(2);return n.sealNum=e.getUint32(5),n.unsealNum=e.getUint32(9),n.Time=C.Uint8ArrayToHex(t.slice(13,20),!0),n}(c));case"2403":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={CardList:[]},n=(t.length-1)/4,i=0;i<n;i++){var a=t.slice(e,e+4);r.CardList.push(C.ab2hex(a)),e+=4}return r.CardList=r.CardList,r}(c));case"2406":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={sealLogList:[]},n=(t.length-1)/11,i=0;i<n;i++){var a={};a.eventID=t[e];var o=t.slice(e+1,e+1+4);a.UserId=C.ab2hex(o),o=t.slice(e+5,e+5+6),a.Time=C.ab2hex(o),r.sealLogList.push(a),e+=11}return r}(c));case"2407":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=1,n={alarmLogList:[]},i=(t.length-1)/10,a=0;a<i;a++){var o={};o.eventID=e.getUint8(r),o.sealStatus=e.getUint8(r+1),o.Voltage=e.getUint16(r+2)/1e3;var s=t.slice(r+4,r+4+6);o.Time=C.ab2hex(s),n.alarmLogList.push(o),r+=10}return n}(c));case"2409":return r=a(a({},r),function(t){if(1!=t[0])return;var e=1,r={Content:""},n=t.slice(e,e+512);return r.Content=C.Uint8ArrayToString(n),r}(c));case"240D":return r.Data=function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(1),n=1,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2)}catch(t){break}if("0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o){var c=0;2==s&&(c=e.getUint16(n+3)),i[""+o]=c}else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x04"==o||"0x07"==o||"0x06"==o||"0x10"==o||"0x12"==o||"0xFC"==o){c="";c=C.Uint8ArrayToHex(t.slice(n+3,n+3+s),!0),i[""+o]=c}else if("0x11"==o||"0x0E"==o||"0x08"==o||"0x09"==o||"0x0A"==o){var l=t.slice(n+3,n+3+s);if(parseInt(l[0])>=49)i[""+o]=C.Uint8ArrayToString(l);else{for(var u="",f=0;f<l.length;f++)u+=l[f];i[""+o]=u}}else{l=t.slice(n+3,n+3+s);i[""+o]=l.toString()}n+=2+s}return i}(c),r;case"2402":case"2408":case"240A":case"240B":case"240C":return r}}catch(t){return console.log("==--",t),r}}};function T(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var I={setCommand:function(t,e){switch(t){case"HHD_BLE_2401":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=1;for(var r=new Uint8Array(20),n=C.stringToUint8Arraytwo(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];r[8]=parseInt(t.setData.cmd);var a=C.getTimeArr();return r[9]=a[0],r[10]=a[1],r[11]=a[2],r[12]=a[3],r[13]=a[4],r[14]=a[5],r[15]=a[6],r[16]=0,r[17]=0,r[18]=0,r[19]=0,T(e,r,t)}(e);case"HHD_BLE_2402":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=2;for(var r=t.setData,n=new Uint8Array(8+4*r.length),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];var o=0;for(a=0;a<r.length;a++){for(var s=C.HexToUint8Array(r[a]),c=0;c<4;c++)n[8+o+c]=s[c];o+=4}return T(e,n,t)}(e);case"HHD_BLE_2403":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=3;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2406":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=6;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2407":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=7;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2408":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=8;for(var r=C.stringToUint8Arraytwo(t.setData.content),n=new Uint8Array(8+r.length+1),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];n[8]=parseInt(t.setData.address);for(a=0;a<r.length;a++)n[9+a]=r[a];return T(e,n,t)}(e);case"HHD_BLE_2409":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=9;for(var r=new Uint8Array(9),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return r[8]=t.setData.address,T(e,r,t)}(e);case"HHD_BLE_240A":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=10;for(var r=new Uint8Array(16),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.password);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240B":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=11;for(var r=new Uint8Array(24),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.aespassword);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240C":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(a.setUint8(r+1,parseInt(o)),"0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o)a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o||"0xFE"==o||"0x14"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x04"==o){a.setUint8(r+2,7);var c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),a.setUint8(r+9,c[6]),r+=9}else if("0x07"==o){a.setUint8(r+2,6);c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),r+=8}else if("0xFC"==o){var l=C.HexToUint8Array(s);a.setUint8(r+2,l.length);for(var u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);r+=l.length+2}else{for(l=C.stringToUint8Arraytwo(s),u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);a.setUint8(r+2,l.length),r+=2+l.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var f=new Uint8Array(2);f[0]=36,f[1]=12;var h=new Uint8Array(8+r+1),g=C.stringToUint8Array(t.blePassword);for(u=0;u<g.byteLength;u++)h[u]=g[u];for(u=0;u<r+1;u++)h[8+u]=a.getUint8(u);return T(f,h,t)}return!1}(e);case"HHD_BLE_240D":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=13;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e)}}},H=a(a({},k),I),L=Object.freeze({__proto__:null,default:H});var D={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),t=C.recoverRecv(t),console.log("反转报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(3,5);i=2047&new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+15!=n)return r;var s=t.slice(13,n-2);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);switch(console.log("解密后:",C.ab2hex(c)),c=c.slice(8,i),console.log("解密后:",C.ab2hex(c)),console.log("解密后:",i),r.Code=c[0],C.ab2hex(t.slice(1,3)).toUpperCase()){case"0311":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0313":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0215":return r;case"0217":return r=a(a({},r),function(t){var e=0,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function R(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)})),console.log("11111");var i=new Uint8Array(2e3);i[0]=126,i[1]=t[0],i[2]=t[1];var a=e.length+6|32768;i[3]=a>>8,i[4]=a;var o="00000000000000"+r.lockId;o=o.substr(-12),i[5]=parseInt(o.substr(0,2),16),i[6]=parseInt(o.substr(2,2),16),i[7]=parseInt(o.substr(4,2),16),i[8]=parseInt(o.substr(6,2),16),i[9]=parseInt(o.substr(8,2),16),i[10]=parseInt(o.substr(10,2),16),i[11]=0,i[12]=0;var s=parseInt(16*Math.ceil((6+e.length)/16)),c=new Uint8Array(s),l=C.getTimeArr();c[0]=l[1],c[1]=l[2],c[2]=l[3],c[3]=l[4],c[4]=l[5],c[5]=l[6];for(var u=0;u<e.length;u++)c[6+u]=e[u];console.log("22323");var f=C.Encrypt(C.ab2hex(c.buffer),n);console.log("22323"),console.log("abx",C.ab2hex(f));for(u=0;u<f.byteLength;u++)i[13+u]=f[u];return i[13+f.byteLength]=C.GetXorCheck(i.slice(1,f.byteLength+13),f.byteLength+13),i[14+f.byteLength]=126,console.log("abx",C.ab2hex(C.ShiftSend(i.slice(0,14+f.byteLength+1)))),C.ShiftSend(i.slice(0,14+f.byteLength+1))}var E={setCommand:function(t,e){switch(t){case"HHD_JT_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),console.log("原始报文",t),console.log("原始报文",C.ab2hex(S)),R(S,B,t)}return!1}(e);case"HHD_JT_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return R(r,a,t)}(e);case"HHD_JT_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),R(r,i,t)}(e);case"HHD_JT_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,R(r,n,t)}(e)}}},P=a(a({},D),E),M=Object.freeze({__proto__:null,default:P});var O={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"0310":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0312":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0214":return r;case"0216":return r=a(a({},r),function(t){var e=1,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function N(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var z={setCommand:function(t,e){switch(t){case"HHD_G_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),N(S,B,t)}return!1}(e);case"HHD_G_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return N(r,a,t)}(e);case"HHD_G_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),N(r,i,t)}(e);case"HHD_G_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,N(r,n,t)}(e)}}},F=a(a({},O),z),j=Object.freeze({__proto__:null,default:F}),V=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.modules={Block:!1!==e.Block?H:null,JTGlock:!1!==e.JTGlock?P:null,Glock:!1!==e.Glock?F:null},this.version="__VERSION__"},n=[{key:"loadModule",value:(a=o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.modules[e]){t.next=16;break}t.t0=e,t.next="Block"===t.t0?4:"JTGlock"===t.t0?8:"Glock"===t.t0?12:16;break;case 4:return t.next=6,Promise.resolve().then((function(){return L}));case 6:return this.modules.Block=t.sent.default,t.abrupt("break",16);case 8:return t.next=10,Promise.resolve().then((function(){return M}));case 10:return this.modules.JTGlock=t.sent.default,t.abrupt("break",16);case 12:return t.next=14,Promise.resolve().then((function(){return j}));case 14:return this.modules.Glock=t.sent.default,t.abrupt("break",16);case 16:return t.abrupt("return",this.modules[e]);case 17:case"end":return t.stop()}}),t,this)})),s=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=a.apply(t,r);function s(t){e(o,n,i,s,c,"next",t)}function c(t){e(o,n,i,s,c,"throw",t)}s(void 0)}))},function(t){return s.apply(this,arguments)})},{key:"Block",get:function(){return this.modules.Block}},{key:"JTGlock",get:function(){return this.modules.JTGlock}},{key:"Glock",get:function(){return this.modules.Glock}}],n&&r(t.prototype,n),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i,a,s}();export{V as default};
|
package/dist/index.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var hhdble=function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function e(t,e,r,n,i,a,o){try{var s=t[a](o),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,i)}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,c(n.key),n)}}function n(t,e,r){return(e=c(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(){o=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var a=e&&e.prototype instanceof y?e:y,o=Object.create(a.prototype),s=new H(n||[]);return i(o,"_invoke",{value:C(t,r,s)}),o}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var g="suspendedStart",p="suspendedYield",d="executing",v="completed",x={};function y(){}function U(){}function m(){}var w={};u(w,s,(function(){return this}));var _=Object.getPrototypeOf,b=_&&_(_(L([])));b&&b!==r&&n.call(b,s)&&(w=b);var A=m.prototype=y.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function B(t,e){function r(i,a,o,s){var c=h(t[i],t,a);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){r("next",t,o,s)}),(function(t){r("throw",t,o,s)})):e.resolve(u).then((function(t){l.value=t,o(l)}),(function(t){return r("throw",t,o,s)}))}s(c.arg)}var a;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return a=a?a.then(i,i):i()}})}function C(e,r,n){var i=g;return function(a,o){if(i===d)throw Error("Generator is already running");if(i===v){if("throw"===a)throw o;return{value:t,done:!0}}for(n.method=a,n.arg=o;;){var s=n.delegate;if(s){var c=k(s,n);if(c){if(c===x)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===g)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=d;var l=h(e,r,n);if("normal"===l.type){if(i=n.done?v:p,l.arg===x)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=v,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),x;var a=h(i,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,x;var o=a.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,x):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,x)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function H(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function L(e){if(e||""===e){var r=e[s];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(typeof e+" is not iterable")}return U.prototype=m,i(A,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:U,configurable:!0}),U.displayName=u(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===U||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,l,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},S(B.prototype),u(B.prototype,c,(function(){return this})),e.AsyncIterator=B,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new B(f(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},S(A),u(A,l,"Generator"),u(A,s,(function(){return this})),u(A,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=L,H.prototype={constructor:H,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,x):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),x},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),x}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),x}},e}function s(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var l,u,f,h,g,p,d,v,x,y,U,m={exports:{}};function w(t){var e=t.getFullYear(),r=t.getMonth()+1,n=t.getDate(),i=t.getHours(),a=t.getMinutes(),o=t.getSeconds();return[e,r,n].map(_).join("/")+" "+[i,a,o].map(_).join(":")}function _(t){return(t=t.toString())[1]?t:"0"+t}function b(t){return Array.prototype.map.call(new Uint8Array(t),(function(t){return("00"+t.toString(16)).slice(-2)})).join("")}function A(t){return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(t){return parseInt(t,16)})))}function S(t,e){for(var r=65535,n=0;n<e;++n)for(var i=0;i<8;i++){var a=0,o=0;1==(t[n]>>7-i&1)&&(o=1),1==(r>>15&1)&&(a=1),r<<=1,1==(a^o)&&(r^=4129)}return r}function B(t,e){t=A(t);var r=m.exports;e=b(e);for(var n=r.enc.Hex.parse(e),i=r.enc.Hex.parse(""),a=new Uint8Array([]),o=0;o<t.length;o+=16){var c=t.slice(o,o+16),l=r.enc.Hex.parse(b(c)),u=r.AES.encrypt(l,n,{iv:i,mode:r.mode.CBC,padding:r.pad.ZeroPadding});a=new Uint8Array([].concat(s(a),s(A(r.enc.Hex.stringify(u.ciphertext)))))}return a}m.exports=(U=U||function(t,e){var r=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),n={},i=n.lib={},a=i.Base={extend:function(t){var e=r(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=a.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;e[n+a>>>2]|=o<<24-(n+a)%4*8}else for(a=0;a<i;a+=4)e[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r,n=[],i=function(e){var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n;return i/=4294967296,(i+=.5)*(t.random()>.5?1:-1)}},a=0;a<e;a+=4){var s=i(4294967296*(r||t.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new o.init(n,e)}}),s=n.enc={},c=s.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var a=e[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new o.init(r,e/2)}},l=s.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var a=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new o.init(r,e)}},u=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},f=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*a,l=t.min(4*c,i);if(c){for(var u=0;u<c;u+=a)this._doProcessBlock(n,u);var f=n.splice(0,c);r.sigBytes-=l}return new o.init(f,l)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});i.Hasher=f.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new h.HMAC.init(t,r).finalize(e)}}});var h=n.algo={};return n}(Math),function(){var t=U,e=t.lib.WordArray;function r(t,r,n){for(var i=[],a=0,o=0;o<r;o++)if(o%4){var s=n[t.charCodeAt(o-1)]<<o%4*2,c=n[t.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=(s|c)<<24-a%4*8,a++}return e.create(i,a)}t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var i=[],a=0;a<r;a+=3)for(var o=(e[a>>>2]>>>24-a%4*8&255)<<16|(e[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|e[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(t){var e=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<n.length;a++)i[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var s=t.indexOf(o);-1!==s&&(e=s)}return r(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){var e=U,r=e.lib,n=r.WordArray,i=r.Hasher,a=e.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var s=a.MD5=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,s=t[e+0],h=t[e+1],g=t[e+2],p=t[e+3],d=t[e+4],v=t[e+5],x=t[e+6],y=t[e+7],U=t[e+8],m=t[e+9],w=t[e+10],_=t[e+11],b=t[e+12],A=t[e+13],S=t[e+14],B=t[e+15],C=a[0],k=a[1],T=a[2],I=a[3];C=c(C,k,T,I,s,7,o[0]),I=c(I,C,k,T,h,12,o[1]),T=c(T,I,C,k,g,17,o[2]),k=c(k,T,I,C,p,22,o[3]),C=c(C,k,T,I,d,7,o[4]),I=c(I,C,k,T,v,12,o[5]),T=c(T,I,C,k,x,17,o[6]),k=c(k,T,I,C,y,22,o[7]),C=c(C,k,T,I,U,7,o[8]),I=c(I,C,k,T,m,12,o[9]),T=c(T,I,C,k,w,17,o[10]),k=c(k,T,I,C,_,22,o[11]),C=c(C,k,T,I,b,7,o[12]),I=c(I,C,k,T,A,12,o[13]),T=c(T,I,C,k,S,17,o[14]),C=l(C,k=c(k,T,I,C,B,22,o[15]),T,I,h,5,o[16]),I=l(I,C,k,T,x,9,o[17]),T=l(T,I,C,k,_,14,o[18]),k=l(k,T,I,C,s,20,o[19]),C=l(C,k,T,I,v,5,o[20]),I=l(I,C,k,T,w,9,o[21]),T=l(T,I,C,k,B,14,o[22]),k=l(k,T,I,C,d,20,o[23]),C=l(C,k,T,I,m,5,o[24]),I=l(I,C,k,T,S,9,o[25]),T=l(T,I,C,k,p,14,o[26]),k=l(k,T,I,C,U,20,o[27]),C=l(C,k,T,I,A,5,o[28]),I=l(I,C,k,T,g,9,o[29]),T=l(T,I,C,k,y,14,o[30]),C=u(C,k=l(k,T,I,C,b,20,o[31]),T,I,v,4,o[32]),I=u(I,C,k,T,U,11,o[33]),T=u(T,I,C,k,_,16,o[34]),k=u(k,T,I,C,S,23,o[35]),C=u(C,k,T,I,h,4,o[36]),I=u(I,C,k,T,d,11,o[37]),T=u(T,I,C,k,y,16,o[38]),k=u(k,T,I,C,w,23,o[39]),C=u(C,k,T,I,A,4,o[40]),I=u(I,C,k,T,s,11,o[41]),T=u(T,I,C,k,p,16,o[42]),k=u(k,T,I,C,x,23,o[43]),C=u(C,k,T,I,m,4,o[44]),I=u(I,C,k,T,b,11,o[45]),T=u(T,I,C,k,B,16,o[46]),C=f(C,k=u(k,T,I,C,g,23,o[47]),T,I,s,6,o[48]),I=f(I,C,k,T,y,10,o[49]),T=f(T,I,C,k,S,15,o[50]),k=f(k,T,I,C,v,21,o[51]),C=f(C,k,T,I,b,6,o[52]),I=f(I,C,k,T,p,10,o[53]),T=f(T,I,C,k,w,15,o[54]),k=f(k,T,I,C,h,21,o[55]),C=f(C,k,T,I,U,6,o[56]),I=f(I,C,k,T,B,10,o[57]),T=f(T,I,C,k,x,15,o[58]),k=f(k,T,I,C,A,21,o[59]),C=f(C,k,T,I,d,6,o[60]),I=f(I,C,k,T,_,10,o[61]),T=f(T,I,C,k,g,15,o[62]),k=f(k,T,I,C,m,21,o[63]),a[0]=a[0]+C|0,a[1]=a[1]+k|0,a[2]=a[2]+T|0,a[3]=a[3]+I|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var a=t.floor(n/4294967296),o=n;r[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,r,n,i,a,o){var s=t+(e&r|~e&n)+i+o;return(s<<a|s>>>32-a)+e}function l(t,e,r,n,i,a,o){var s=t+(e&n|r&~n)+i+o;return(s<<a|s>>>32-a)+e}function u(t,e,r,n,i,a,o){var s=t+(e^r^n)+i+o;return(s<<a|s>>>32-a)+e}function f(t,e,r,n,i,a,o){var s=t+(r^(e|~n))+i+o;return(s<<a|s>>>32-a)+e}e.MD5=i._createHelper(s),e.HmacMD5=i._createHmacHelper(s)}(Math),g=(h=U).lib,p=g.WordArray,d=g.Hasher,v=h.algo,x=[],y=v.SHA1=d.extend({_doReset:function(){this._hash=new p.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=0;c<80;c++){if(c<16)x[c]=0|t[e+c];else{var l=x[c-3]^x[c-8]^x[c-14]^x[c-16];x[c]=l<<1|l>>>31}var u=(n<<5|n>>>27)+s+x[c];u+=c<20?1518500249+(i&a|~i&o):c<40?1859775393+(i^a^o):c<60?(i&a|i&o|a&o)-1894007588:(i^a^o)-899497514,s=o,o=a,a=i<<30|i>>>2,i=n,n=u}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=d.clone.call(this);return t._hash=this._hash.clone(),t}}),h.SHA1=d._createHelper(y),h.HmacSHA1=d._createHmacHelper(y),function(t){var e=U,r=e.lib,n=r.WordArray,i=r.Hasher,a=e.algo,o=[],s=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(o[i]=r(t.pow(n,.5))),s[i]=r(t.pow(n,1/3)),i++),n++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6],h=r[7],g=0;g<64;g++){if(g<16)c[g]=0|t[e+g];else{var p=c[g-15],d=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,v=c[g-2],x=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;c[g]=d+c[g-7]+x+c[g-16]}var y=n&i^n&a^i&a,U=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),m=h+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&u^~l&f)+s[g]+c[g];h=f,f=u,u=l,l=o+m|0,o=a,a=i,i=n,n=m+(U+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+l|0,r[5]=r[5]+u|0,r[6]=r[6]+f|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(l),e.HmacSHA256=i._createHmacHelper(l)}(Math),function(){var t=U,e=t.lib.WordArray,r=t.enc;function n(t){return t<<8&4278255360|t>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i+=2){var a=e[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var r=t.length,n=[],i=0;i<r;i++)n[i>>>1]|=t.charCodeAt(i)<<16-i%2*16;return e.create(n,2*r)}},r.Utf16LE={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],a=0;a<r;a+=2){var o=n(e[a>>>2]>>>16-a%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var r=t.length,i=[],a=0;a<r;a++)i[a>>>1]|=n(t.charCodeAt(a)<<16-a%2*16);return e.create(i,2*r)}}}(),function(){if("function"==typeof ArrayBuffer){var t=U.lib.WordArray,e=t.init,r=t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var r=t.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=t[i]<<24-i%4*8;e.call(this,n,r)}else e.apply(this,arguments)};r.prototype=t}}(),
|
|
1
|
+
var hhdlinkble=function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function e(t,e,r,n,i,a,o){try{var s=t[a](o),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,i)}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,c(n.key),n)}}function n(t,e,r){return(e=c(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(){o=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var a=e&&e.prototype instanceof y?e:y,o=Object.create(a.prototype),s=new H(n||[]);return i(o,"_invoke",{value:C(t,r,s)}),o}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var g="suspendedStart",p="suspendedYield",d="executing",v="completed",x={};function y(){}function U(){}function m(){}var w={};u(w,s,(function(){return this}));var _=Object.getPrototypeOf,b=_&&_(_(L([])));b&&b!==r&&n.call(b,s)&&(w=b);var A=m.prototype=y.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function B(t,e){function r(i,a,o,s){var c=h(t[i],t,a);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){r("next",t,o,s)}),(function(t){r("throw",t,o,s)})):e.resolve(u).then((function(t){l.value=t,o(l)}),(function(t){return r("throw",t,o,s)}))}s(c.arg)}var a;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return a=a?a.then(i,i):i()}})}function C(e,r,n){var i=g;return function(a,o){if(i===d)throw Error("Generator is already running");if(i===v){if("throw"===a)throw o;return{value:t,done:!0}}for(n.method=a,n.arg=o;;){var s=n.delegate;if(s){var c=k(s,n);if(c){if(c===x)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===g)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=d;var l=h(e,r,n);if("normal"===l.type){if(i=n.done?v:p,l.arg===x)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=v,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),x;var a=h(i,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,x;var o=a.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,x):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,x)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function H(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function L(e){if(e||""===e){var r=e[s];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(typeof e+" is not iterable")}return U.prototype=m,i(A,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:U,configurable:!0}),U.displayName=u(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===U||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,l,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},S(B.prototype),u(B.prototype,c,(function(){return this})),e.AsyncIterator=B,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new B(f(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},S(A),u(A,l,"Generator"),u(A,s,(function(){return this})),u(A,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=L,H.prototype={constructor:H,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,x):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),x},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),x}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),x}},e}function s(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var l,u,f,h,g,p,d,v,x,y,U,m={exports:{}};function w(t){var e=t.getFullYear(),r=t.getMonth()+1,n=t.getDate(),i=t.getHours(),a=t.getMinutes(),o=t.getSeconds();return[e,r,n].map(_).join("/")+" "+[i,a,o].map(_).join(":")}function _(t){return(t=t.toString())[1]?t:"0"+t}function b(t){return Array.prototype.map.call(new Uint8Array(t),(function(t){return("00"+t.toString(16)).slice(-2)})).join("")}function A(t){return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(t){return parseInt(t,16)})))}function S(t,e){for(var r=65535,n=0;n<e;++n)for(var i=0;i<8;i++){var a=0,o=0;1==(t[n]>>7-i&1)&&(o=1),1==(r>>15&1)&&(a=1),r<<=1,1==(a^o)&&(r^=4129)}return r}function B(t,e){t=A(t);var r=m.exports;e=b(e);for(var n=r.enc.Hex.parse(e),i=r.enc.Hex.parse(""),a=new Uint8Array([]),o=0;o<t.length;o+=16){var c=t.slice(o,o+16),l=r.enc.Hex.parse(b(c)),u=r.AES.encrypt(l,n,{iv:i,mode:r.mode.CBC,padding:r.pad.ZeroPadding});a=new Uint8Array([].concat(s(a),s(A(r.enc.Hex.stringify(u.ciphertext)))))}return a}m.exports=(U=U||function(t,e){var r=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),n={},i=n.lib={},a=i.Base={extend:function(t){var e=r(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=a.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;e[n+a>>>2]|=o<<24-(n+a)%4*8}else for(a=0;a<i;a+=4)e[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r,n=[],i=function(e){var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n;return i/=4294967296,(i+=.5)*(t.random()>.5?1:-1)}},a=0;a<e;a+=4){var s=i(4294967296*(r||t.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new o.init(n,e)}}),s=n.enc={},c=s.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var a=e[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new o.init(r,e/2)}},l=s.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var a=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new o.init(r,e)}},u=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},f=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*a,l=t.min(4*c,i);if(c){for(var u=0;u<c;u+=a)this._doProcessBlock(n,u);var f=n.splice(0,c);r.sigBytes-=l}return new o.init(f,l)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});i.Hasher=f.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new h.HMAC.init(t,r).finalize(e)}}});var h=n.algo={};return n}(Math),function(){var t=U,e=t.lib.WordArray;function r(t,r,n){for(var i=[],a=0,o=0;o<r;o++)if(o%4){var s=n[t.charCodeAt(o-1)]<<o%4*2,c=n[t.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=(s|c)<<24-a%4*8,a++}return e.create(i,a)}t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var i=[],a=0;a<r;a+=3)for(var o=(e[a>>>2]>>>24-a%4*8&255)<<16|(e[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|e[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(t){var e=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<n.length;a++)i[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var s=t.indexOf(o);-1!==s&&(e=s)}return r(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){var e=U,r=e.lib,n=r.WordArray,i=r.Hasher,a=e.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var s=a.MD5=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,s=t[e+0],h=t[e+1],g=t[e+2],p=t[e+3],d=t[e+4],v=t[e+5],x=t[e+6],y=t[e+7],U=t[e+8],m=t[e+9],w=t[e+10],_=t[e+11],b=t[e+12],A=t[e+13],S=t[e+14],B=t[e+15],C=a[0],k=a[1],T=a[2],I=a[3];C=c(C,k,T,I,s,7,o[0]),I=c(I,C,k,T,h,12,o[1]),T=c(T,I,C,k,g,17,o[2]),k=c(k,T,I,C,p,22,o[3]),C=c(C,k,T,I,d,7,o[4]),I=c(I,C,k,T,v,12,o[5]),T=c(T,I,C,k,x,17,o[6]),k=c(k,T,I,C,y,22,o[7]),C=c(C,k,T,I,U,7,o[8]),I=c(I,C,k,T,m,12,o[9]),T=c(T,I,C,k,w,17,o[10]),k=c(k,T,I,C,_,22,o[11]),C=c(C,k,T,I,b,7,o[12]),I=c(I,C,k,T,A,12,o[13]),T=c(T,I,C,k,S,17,o[14]),C=l(C,k=c(k,T,I,C,B,22,o[15]),T,I,h,5,o[16]),I=l(I,C,k,T,x,9,o[17]),T=l(T,I,C,k,_,14,o[18]),k=l(k,T,I,C,s,20,o[19]),C=l(C,k,T,I,v,5,o[20]),I=l(I,C,k,T,w,9,o[21]),T=l(T,I,C,k,B,14,o[22]),k=l(k,T,I,C,d,20,o[23]),C=l(C,k,T,I,m,5,o[24]),I=l(I,C,k,T,S,9,o[25]),T=l(T,I,C,k,p,14,o[26]),k=l(k,T,I,C,U,20,o[27]),C=l(C,k,T,I,A,5,o[28]),I=l(I,C,k,T,g,9,o[29]),T=l(T,I,C,k,y,14,o[30]),C=u(C,k=l(k,T,I,C,b,20,o[31]),T,I,v,4,o[32]),I=u(I,C,k,T,U,11,o[33]),T=u(T,I,C,k,_,16,o[34]),k=u(k,T,I,C,S,23,o[35]),C=u(C,k,T,I,h,4,o[36]),I=u(I,C,k,T,d,11,o[37]),T=u(T,I,C,k,y,16,o[38]),k=u(k,T,I,C,w,23,o[39]),C=u(C,k,T,I,A,4,o[40]),I=u(I,C,k,T,s,11,o[41]),T=u(T,I,C,k,p,16,o[42]),k=u(k,T,I,C,x,23,o[43]),C=u(C,k,T,I,m,4,o[44]),I=u(I,C,k,T,b,11,o[45]),T=u(T,I,C,k,B,16,o[46]),C=f(C,k=u(k,T,I,C,g,23,o[47]),T,I,s,6,o[48]),I=f(I,C,k,T,y,10,o[49]),T=f(T,I,C,k,S,15,o[50]),k=f(k,T,I,C,v,21,o[51]),C=f(C,k,T,I,b,6,o[52]),I=f(I,C,k,T,p,10,o[53]),T=f(T,I,C,k,w,15,o[54]),k=f(k,T,I,C,h,21,o[55]),C=f(C,k,T,I,U,6,o[56]),I=f(I,C,k,T,B,10,o[57]),T=f(T,I,C,k,x,15,o[58]),k=f(k,T,I,C,A,21,o[59]),C=f(C,k,T,I,d,6,o[60]),I=f(I,C,k,T,_,10,o[61]),T=f(T,I,C,k,g,15,o[62]),k=f(k,T,I,C,m,21,o[63]),a[0]=a[0]+C|0,a[1]=a[1]+k|0,a[2]=a[2]+T|0,a[3]=a[3]+I|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var a=t.floor(n/4294967296),o=n;r[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,r,n,i,a,o){var s=t+(e&r|~e&n)+i+o;return(s<<a|s>>>32-a)+e}function l(t,e,r,n,i,a,o){var s=t+(e&n|r&~n)+i+o;return(s<<a|s>>>32-a)+e}function u(t,e,r,n,i,a,o){var s=t+(e^r^n)+i+o;return(s<<a|s>>>32-a)+e}function f(t,e,r,n,i,a,o){var s=t+(r^(e|~n))+i+o;return(s<<a|s>>>32-a)+e}e.MD5=i._createHelper(s),e.HmacMD5=i._createHmacHelper(s)}(Math),g=(h=U).lib,p=g.WordArray,d=g.Hasher,v=h.algo,x=[],y=v.SHA1=d.extend({_doReset:function(){this._hash=new p.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=0;c<80;c++){if(c<16)x[c]=0|t[e+c];else{var l=x[c-3]^x[c-8]^x[c-14]^x[c-16];x[c]=l<<1|l>>>31}var u=(n<<5|n>>>27)+s+x[c];u+=c<20?1518500249+(i&a|~i&o):c<40?1859775393+(i^a^o):c<60?(i&a|i&o|a&o)-1894007588:(i^a^o)-899497514,s=o,o=a,a=i<<30|i>>>2,i=n,n=u}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=d.clone.call(this);return t._hash=this._hash.clone(),t}}),h.SHA1=d._createHelper(y),h.HmacSHA1=d._createHmacHelper(y),function(t){var e=U,r=e.lib,n=r.WordArray,i=r.Hasher,a=e.algo,o=[],s=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(o[i]=r(t.pow(n,.5))),s[i]=r(t.pow(n,1/3)),i++),n++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6],h=r[7],g=0;g<64;g++){if(g<16)c[g]=0|t[e+g];else{var p=c[g-15],d=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,v=c[g-2],x=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;c[g]=d+c[g-7]+x+c[g-16]}var y=n&i^n&a^i&a,U=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),m=h+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&u^~l&f)+s[g]+c[g];h=f,f=u,u=l,l=o+m|0,o=a,a=i,i=n,n=m+(U+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+l|0,r[5]=r[5]+u|0,r[6]=r[6]+f|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(l),e.HmacSHA256=i._createHmacHelper(l)}(Math),function(){var t=U,e=t.lib.WordArray,r=t.enc;function n(t){return t<<8&4278255360|t>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i+=2){var a=e[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var r=t.length,n=[],i=0;i<r;i++)n[i>>>1]|=t.charCodeAt(i)<<16-i%2*16;return e.create(n,2*r)}},r.Utf16LE={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],a=0;a<r;a+=2){var o=n(e[a>>>2]>>>16-a%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var r=t.length,i=[],a=0;a<r;a++)i[a>>>1]|=n(t.charCodeAt(a)<<16-a%2*16);return e.create(i,2*r)}}}(),function(){if("function"==typeof ArrayBuffer){var t=U.lib.WordArray,e=t.init,r=t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var r=t.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=t[i]<<24-i%4*8;e.call(this,n,r)}else e.apply(this,arguments)};r.prototype=t}}(),
|
|
2
2
|
/** @preserve
|
|
3
3
|
(c) 2012 by C茅dric Mesnil. All rights reserved.
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
@@ -12,4 +12,4 @@ function(){var t=U,e=t.lib,r=e.WordArray,n=e.Hasher,i=t.algo,a=r.create([0,1,2,3
|
|
|
12
12
|
* derived from CryptoJS.mode.CTR
|
|
13
13
|
* Jan Hruby jhruby.web@gmail.com
|
|
14
14
|
*/
|
|
15
|
-
U.mode.CTRGladman=function(){var t=U.lib.BlockCipherMode.extend();function e(t){if(255&~(t>>24))t+=1<<24;else{var e=t>>16&255,r=t>>8&255,n=255&t;255===e?(e=0,255===r?(r=0,255===n?n=0:++n):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=n}return t}function r(t){return 0===(t[0]=e(t[0]))&&(t[1]=e(t[1])),t}var n=t.Encryptor=t.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),r(o);var s=o.slice(0);n.encryptBlock(s,0);for(var c=0;c<i;c++)t[e+c]^=s[c]}});return t.Decryptor=n,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.Rabbit=e.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)s.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(i[0]^=l,i[1]^=f,i[2]^=u,i[3]^=h,i[4]^=l,i[5]^=f,i[6]^=u,i[7]^=h,r=0;r<4;r++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=e._createHelper(o)}(),U.mode.CTR=function(){var t=U.lib.BlockCipherMode.extend(),e=t.Encryptor=t.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)t[e+s]^=o[s]}});return t.Decryptor=e,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.RabbitLegacy=e.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)s.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(n[0]^=l,n[1]^=f,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=f,n[6]^=u,n[7]^=h,i=0;i<4;i++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=e._createHelper(o)}(),U.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){for(var e=t.words,r=t.sigBytes-1;!(e[r>>>2]>>>24-r%4*8&255);)r--;t.sigBytes=r+1}},U),new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);var C={formatTime:w,inArray:function(t,e,r){for(var n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1},ab2hex:b,mergeArrayBuffer:function(){for(var t=0,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0;i<r.length;i++)r[i]=new Uint8Array(r[i]),t+=r[i].length;for(var a=new Uint8Array(t),o=0,s=0,c=r;s<c.length;s++){var l=c[s];a.set(l,o),o+=l.length}return a.buffer},Encrypt:B,Decrypt:function(t,e,r){var n=b(B(b(new Uint8Array(16).buffer),e)),i=m.exports;t=A(t);var a=new Uint8Array([]);e=b(e);for(var o=i.enc.Hex.parse(e),c=i.enc.Hex.parse(""),l=0;l<t.length;l+=16){var u=t.slice(l,l+16);if(b(u)!=n){var f=i.enc.Hex.parse(b(u)),h=i.enc.Base64.stringify(f),g=i.AES.decrypt(h,o,{iv:c,mode:i.mode.CBC,padding:i.pad.ZeroPadding});a=new Uint8Array([].concat(s(a),s(A(i.enc.Hex.stringify(g)))))}}return a},Crc16_Ccitt:S,SunCheck:function(t,e){var r,n=0;for(r=0;r<e;r++)n=n+(255&t[r])&255;return n=1+~n,(n&=255)>240&&(n-=16),n},stringToUint8Array:function(t){for(var e=[],r=0,n=t.length;r<n;++r)e.push(t.charCodeAt(r));return new Uint8Array(e)},sleep:function(t){for(var e=new Date,r=e.getTime()+t;;)if((e=new Date).getTime()>r)return},Uint8ArrayToHex:function(t,e){if(null==t)return"";for(var r,n=[],i=0;i<t.length;i++)1==(r=t[i].toString(16)).length&&(r="0"+r),n.push(r);return e?n.join(""):n.join(" ")},Uint8ArrayToString:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},getTimeArr:function(t){var e=w(new Date);return t&&(e=w(new Date(t))),A(e)},HexToUint8Array:A,DelayExecFunc:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;null==t||t.length<1||null==e||r<1||function n(){null==t||t.length<1||(e(t.shift()),setTimeout(n,r))}()},SplitArray:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null==t||t.length<1||e<1)return[];for(var n=[],i=0;i<t.length;)n.push(t.slice(i,i+e)),i+=e;return null==r||n.forEach((function(t,e,n){r(t)})),n},clone:function(t){var e=null;if(t instanceof Array)e=t.concat();else if(t instanceof Function)e=t;else for(var r in e=new Object,t){var n=t[r];e[r]=n instanceof Object?this.clone(n):n}return e},GetPowerPercent:function(t){if(t<=3)return 0;if(t>4.22)return 102;if(t>=4.2)return 100;var e=0,r=0,n=0,i=10;return t<4.2&&t>=4.06?(e=90,r=4.2,n=4.06):t<4.06&&t>=3.98?(e=80,r=4.06,n=3.98):t<3.98&&t>=3.92?(e=70,r=3.98,n=3.92):t<3.92&&t>=3.87?(e=60,r=3.92,n=3.87):t<3.87&&t>=3.82?(e=50,r=3.87,n=3.82):t<3.82&&t>=3.79?(e=40,r=3.82,n=3.79):t<3.79&&t>=3.77?(e=30,r=3.79,n=3.77):t<3.77&&t>=3.74?(e=20,r=3.77,n=3.74):t<3.74&&t>=3.68?(e=10,r=3.74,n=3.68):t<3.68&&t>=3.45?(e=5,r=3.68,n=3.45,i=5):t<3.45&&t>=3&&(e=0,r=3.45,n=3,i=5),parseInt(e+i*(t-n)/(r-n))},GetPower:function(t){return t<3?5:t>=3?100:parseInt(t)},GetPowertow:function(t){var e=0;return t<1.4?0:t>=3?100:(t<3&&t>=2.5?e=(e=parseInt(392.16*t-488.24))>=100?100:e:t<2.016&&t>=1.4?e=parseInt(44.286*t*t-10.706*t-14.206):t<2.628&&t>=2.016?e=parseInt(13141*t*t-3752.7*t*t*t-15022*t+5653.6):t<3&&t>=2.628&&(e=(e=parseInt(53.763*t+19.36))>=100?100:e),e)},GetXorCheck:function(t,e){if(null==t||e<1)return 0;for(var r=0,n=0;n<e;n++)r^=t[n],r&=255;return r},ShiftSend:function(t){for(var e=new ArrayBuffer(2*t.length+2),r=new DataView(e,0),n=1,i=1;i<t.length-1;i++)126==t[i]?(r.setUint8(n,125),r.setUint8(n+1,2),n++):125==t[i]?(r.setUint8(n,125),r.setUint8(n+1,1),n++):r.setUint8(n,t[i]),n++;r.setUint8(0,126),r.setUint8(n,126),n++;var a=function(t){for(var e=Buffer.alloc(t.byteLength,0),r=new Uint8Array(t),n=0;n<e.length;++n)e[n]=r[n];return e}(e=e.slice(0,n));try{return a.slice(0,n)}catch(t){return!1}},recoverRecv:function(t){for(var e=new Uint8Array(t.length),r=0,n=0;n<t.length;n++)125==t[n]?2==t[n+1]?(e[r]=126,n++):1==t[n+1]?(e[r]=125,n++):e[r]=t[n]:e[r]=t[n],r++;return e=e.slice(0,r)},bufferToHex:function(t){if(null==t)return"";for(var e,r=[],n=0;n<t.length;n++)1==(e=t[n].toString(16)).length&&(e="0"+e),r.push(e);return r.join(" ")},stringToUint8Arraytwo:function(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?(e.push(192|n>>6),e.push(128|63&n)):n<65536?(e.push(224|n>>12),e.push(128|n>>6&63),e.push(128|63&n)):(e.push(240|n>>18),e.push(128|n>>12&63),e.push(128|n>>6&63),e.push(128|63&n))}return new Uint8Array(e)},checkCrc:function(t,e){var r=new ArrayBuffer(2),n=new DataView(r);n.setUint8(0,t[0]),n.setUint8(1,t[1]);var i=t.slice(12,e),a=S(i,i.length);return a&=65535,n.getUint16(0)==a}};var k={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"2401":return r=a(a({},r),function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint16(3),n={};1==(r>>15&1)?n.Power=((32767&r)/100).toFixed(2):n.Voltage=(r/1e3).toFixed(2);return n.sealNum=e.getUint32(5),n.unsealNum=e.getUint32(9),n.Time=C.Uint8ArrayToHex(t.slice(13,20),!0),n}(c));case"2403":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={CardList:[]},n=(t.length-1)/4,i=0;i<n;i++){var a=t.slice(e,e+4);r.CardList.push(C.ab2hex(a)),e+=4}return r.CardList=r.CardList,r}(c));case"2406":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={sealLogList:[]},n=(t.length-1)/11,i=0;i<n;i++){var a={};a.eventID=t[e];var o=t.slice(e+1,e+1+4);a.UserId=C.ab2hex(o),o=t.slice(e+5,e+5+6),a.Time=C.ab2hex(o),r.sealLogList.push(a),e+=11}return r}(c));case"2407":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=1,n={alarmLogList:[]},i=(t.length-1)/10,a=0;a<i;a++){var o={};o.eventID=e.getUint8(r),o.sealStatus=e.getUint8(r+1),o.Voltage=e.getUint16(r+2)/1e3;var s=t.slice(r+4,r+4+6);o.Time=C.ab2hex(s),n.alarmLogList.push(o),r+=10}return n}(c));case"2409":return r=a(a({},r),function(t){if(1!=t[0])return;var e=1,r={Content:""},n=t.slice(e,e+512);return r.Content=C.Uint8ArrayToString(n),r}(c));case"240D":return r.Data=function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(1),n=1,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2)}catch(t){break}if("0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o){var c=0;2==s&&(c=e.getUint16(n+3)),i[""+o]=c}else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x04"==o||"0x07"==o||"0x06"==o||"0x10"==o||"0x12"==o||"0xFC"==o){c="";c=C.Uint8ArrayToHex(t.slice(n+3,n+3+s),!0),i[""+o]=c}else if("0x11"==o||"0x0E"==o||"0x08"==o||"0x09"==o||"0x0A"==o){var l=t.slice(n+3,n+3+s);if(parseInt(l[0])>=49)i[""+o]=C.Uint8ArrayToString(l);else{for(var u="",f=0;f<l.length;f++)u+=l[f];i[""+o]=u}}else{l=t.slice(n+3,n+3+s);i[""+o]=l.toString()}n+=2+s}return i}(c),r;case"2402":case"2408":case"240A":case"240B":case"240C":return r}}catch(t){return console.log("==--",t),r}}};function T(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var I={setCommand:function(t,e){switch(t){case"HHD_BLE_2401":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=1;for(var r=new Uint8Array(20),n=C.stringToUint8Arraytwo(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];r[8]=parseInt(t.setData.cmd);var a=C.getTimeArr();return r[9]=a[0],r[10]=a[1],r[11]=a[2],r[12]=a[3],r[13]=a[4],r[14]=a[5],r[15]=a[6],r[16]=0,r[17]=0,r[18]=0,r[19]=0,T(e,r,t)}(e);case"HHD_BLE_2402":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=2;for(var r=t.setData,n=new Uint8Array(8+4*r.length),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];var o=0;for(a=0;a<r.length;a++){for(var s=C.HexToUint8Array(r[a]),c=0;c<4;c++)n[8+o+c]=s[c];o+=4}return T(e,n,t)}(e);case"HHD_BLE_2403":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=3;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2406":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=6;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2407":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=7;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2408":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=8;for(var r=C.stringToUint8Arraytwo(t.setData.content),n=new Uint8Array(8+r.length+1),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];n[8]=parseInt(t.setData.address);for(a=0;a<r.length;a++)n[9+a]=r[a];return T(e,n,t)}(e);case"HHD_BLE_2409":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=9;for(var r=new Uint8Array(9),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return r[8]=t.setData.address,T(e,r,t)}(e);case"HHD_BLE_240A":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=10;for(var r=new Uint8Array(16),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.password);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240B":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=11;for(var r=new Uint8Array(24),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.aespassword);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240C":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(a.setUint8(r+1,parseInt(o)),"0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o)a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o||"0xFE"==o||"0x14"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x04"==o){a.setUint8(r+2,7);var c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),a.setUint8(r+9,c[6]),r+=9}else if("0x07"==o){a.setUint8(r+2,6);c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),r+=8}else if("0xFC"==o){var l=C.HexToUint8Array(s);a.setUint8(r+2,l.length);for(var u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);r+=l.length+2}else{for(l=C.stringToUint8Arraytwo(s),u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);a.setUint8(r+2,l.length),r+=2+l.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var f=new Uint8Array(2);f[0]=36,f[1]=12;var h=new Uint8Array(8+r+1),g=C.stringToUint8Array(t.blePassword);for(u=0;u<g.byteLength;u++)h[u]=g[u];for(u=0;u<r+1;u++)h[8+u]=a.getUint8(u);return T(f,h,t)}return!1}(e);case"HHD_BLE_240D":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=13;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e)}}},H=a(a({},k),I),L=Object.freeze({__proto__:null,default:H});var D={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),t=C.recoverRecv(t),console.log("反转报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(3,5);i=2047&new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+15!=n)return r;var s=t.slice(13,n-2);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);switch(console.log("解密后:",C.ab2hex(c)),c=c.slice(8,i),r.Code=c[0],C.ab2hex(t.slice(1,3)).toUpperCase()){case"0311":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0313":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0215":return r;case"0217":return r=a(a({},r),function(t){var e=0,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function R(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=126,i[1]=t[0],i[2]=t[1];var a=e.length+6|32768;i[3]=a>>8,i[4]=a;var o="00000000000000"+r.lockId;o=o.substr(-12),i[5]=parseInt(o.substr(0,2),16),i[6]=parseInt(o.substr(2,2),16),i[7]=parseInt(o.substr(4,2),16),i[8]=parseInt(o.substr(6,2),16),i[9]=parseInt(o.substr(8,2),16),i[10]=parseInt(o.substr(10,2),16),i[11]=0,i[12]=0;var s=parseInt(16*Math.ceil((6+e.length)/16)),c=new Uint8Array(s),l=C.getTimeArr();c[0]=l[1],c[1]=l[2],c[2]=l[3],c[3]=l[4],c[4]=l[5],c[5]=l[6];for(var u=0;u<e.length;u++)c[6+u]=e[u];var f=C.Encrypt(C.ab2hex(c.buffer),n);for(u=0;u<f.byteLength;u++)i[13+u]=f[u];return i[13+f.byteLength]=C.GetXorCheck(i.slice(1,f.byteLength+13),f.byteLength+13),i[14+f.byteLength]=126,C.ShiftSend(i.slice(0,14+f.byteLength+1))}var E={setCommand:function(t,e){switch(t){case"HHD_JT_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),R(S,B,t)}return!1}(e);case"HHD_JT_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return R(r,a,t)}(e);case"HHD_JT_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),R(r,i,t)}(e);case"HHD_JT_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,R(r,n,t)}(e)}}},P=a(a({},D),E),M=Object.freeze({__proto__:null,default:P});var O={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"0310":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0312":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0214":return r;case"0216":return r=a(a({},r),function(t){var e=1,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function N(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var z={setCommand:function(t,e){switch(t){case"HHD_G_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),N(S,B,t)}return!1}(e);case"HHD_G_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return N(r,a,t)}(e);case"HHD_G_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),N(r,i,t)}(e);case"HHD_G_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,N(r,n,t)}(e)}}},F=a(a({},O),z),j=Object.freeze({__proto__:null,default:F}),V=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.modules={Block:!1!==e.Block?H:null,JTGlock:!1!==e.JTGlock?P:null,Glock:!1!==e.Glock?F:null},this.version="__VERSION__"},n=[{key:"loadModule",value:(a=o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.modules[e]){t.next=16;break}t.t0=e,t.next="Block"===t.t0?4:"JTGlock"===t.t0?8:"Glock"===t.t0?12:16;break;case 4:return t.next=6,Promise.resolve().then((function(){return L}));case 6:return this.modules.Block=t.sent.default,t.abrupt("break",16);case 8:return t.next=10,Promise.resolve().then((function(){return M}));case 10:return this.modules.JTlock=t.sent.default,t.abrupt("break",16);case 12:return t.next=14,Promise.resolve().then((function(){return j}));case 14:return this.modules.Glock=t.sent.default,t.abrupt("break",16);case 16:return t.abrupt("return",this.modules[e]);case 17:case"end":return t.stop()}}),t,this)})),s=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=a.apply(t,r);function s(t){e(o,n,i,s,c,"next",t)}function c(t){e(o,n,i,s,c,"throw",t)}s(void 0)}))},function(t){return s.apply(this,arguments)})},{key:"Block",get:function(){return this.modules.Block}},{key:"JTGlock",get:function(){return this.modules.JTGlock}},{key:"Glock",get:function(){return this.modules.Glock}}],n&&r(t.prototype,n),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i,a,s}();return V}();
|
|
15
|
+
U.mode.CTRGladman=function(){var t=U.lib.BlockCipherMode.extend();function e(t){if(255&~(t>>24))t+=1<<24;else{var e=t>>16&255,r=t>>8&255,n=255&t;255===e?(e=0,255===r?(r=0,255===n?n=0:++n):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=n}return t}function r(t){return 0===(t[0]=e(t[0]))&&(t[1]=e(t[1])),t}var n=t.Encryptor=t.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),r(o);var s=o.slice(0);n.encryptBlock(s,0);for(var c=0;c<i;c++)t[e+c]^=s[c]}});return t.Decryptor=n,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.Rabbit=e.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)s.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(i[0]^=l,i[1]^=f,i[2]^=u,i[3]^=h,i[4]^=l,i[5]^=f,i[6]^=u,i[7]^=h,r=0;r<4;r++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=e._createHelper(o)}(),U.mode.CTR=function(){var t=U.lib.BlockCipherMode.extend(),e=t.Encryptor=t.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)t[e+s]^=o[s]}});return t.Decryptor=e,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.RabbitLegacy=e.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)s.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(n[0]^=l,n[1]^=f,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=f,n[6]^=u,n[7]^=h,i=0;i<4;i++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=e._createHelper(o)}(),U.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){for(var e=t.words,r=t.sigBytes-1;!(e[r>>>2]>>>24-r%4*8&255);)r--;t.sigBytes=r+1}},U),new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);var C={formatTime:w,inArray:function(t,e,r){for(var n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1},ab2hex:b,mergeArrayBuffer:function(){for(var t=0,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0;i<r.length;i++)r[i]=new Uint8Array(r[i]),t+=r[i].length;for(var a=new Uint8Array(t),o=0,s=0,c=r;s<c.length;s++){var l=c[s];a.set(l,o),o+=l.length}return a.buffer},Encrypt:B,Decrypt:function(t,e,r){var n=b(B(b(new Uint8Array(16).buffer),e)),i=m.exports;t=A(t);var a=new Uint8Array([]);e=b(e);for(var o=i.enc.Hex.parse(e),c=i.enc.Hex.parse(""),l=0;l<t.length;l+=16){var u=t.slice(l,l+16);if(b(u)!=n){var f=i.enc.Hex.parse(b(u)),h=i.enc.Base64.stringify(f),g=i.AES.decrypt(h,o,{iv:c,mode:i.mode.CBC,padding:i.pad.NoPadding});a=new Uint8Array([].concat(s(a),s(A(i.enc.Hex.stringify(g)))))}}return a},Crc16_Ccitt:S,SunCheck:function(t,e){var r,n=0;for(r=0;r<e;r++)n=n+(255&t[r])&255;return n=1+~n,(n&=255)>240&&(n-=16),n},stringToUint8Array:function(t){for(var e=[],r=0,n=t.length;r<n;++r)e.push(t.charCodeAt(r));return new Uint8Array(e)},sleep:function(t){for(var e=new Date,r=e.getTime()+t;;)if((e=new Date).getTime()>r)return},Uint8ArrayToHex:function(t,e){if(null==t)return"";for(var r,n=[],i=0;i<t.length;i++)1==(r=t[i].toString(16)).length&&(r="0"+r),n.push(r);return e?n.join(""):n.join(" ")},Uint8ArrayToString:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},getTimeArr:function(t){var e=w(new Date);return t&&(e=w(new Date(t))),A(e)},HexToUint8Array:A,DelayExecFunc:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;null==t||t.length<1||null==e||r<1||function n(){null==t||t.length<1||(e(t.shift()),setTimeout(n,r))}()},SplitArray:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null==t||t.length<1||e<1)return[];for(var n=[],i=0;i<t.length;)n.push(t.slice(i,i+e)),i+=e;return null==r||n.forEach((function(t,e,n){r(t)})),n},clone:function(t){var e=null;if(t instanceof Array)e=t.concat();else if(t instanceof Function)e=t;else for(var r in e=new Object,t){var n=t[r];e[r]=n instanceof Object?this.clone(n):n}return e},GetPowerPercent:function(t){if(t<=3)return 0;if(t>4.22)return 102;if(t>=4.2)return 100;var e=0,r=0,n=0,i=10;return t<4.2&&t>=4.06?(e=90,r=4.2,n=4.06):t<4.06&&t>=3.98?(e=80,r=4.06,n=3.98):t<3.98&&t>=3.92?(e=70,r=3.98,n=3.92):t<3.92&&t>=3.87?(e=60,r=3.92,n=3.87):t<3.87&&t>=3.82?(e=50,r=3.87,n=3.82):t<3.82&&t>=3.79?(e=40,r=3.82,n=3.79):t<3.79&&t>=3.77?(e=30,r=3.79,n=3.77):t<3.77&&t>=3.74?(e=20,r=3.77,n=3.74):t<3.74&&t>=3.68?(e=10,r=3.74,n=3.68):t<3.68&&t>=3.45?(e=5,r=3.68,n=3.45,i=5):t<3.45&&t>=3&&(e=0,r=3.45,n=3,i=5),parseInt(e+i*(t-n)/(r-n))},GetPower:function(t){return t<3?5:t>=3?100:parseInt(t)},GetPowertow:function(t){var e=0;return t<1.4?0:t>=3?100:(t<3&&t>=2.5?e=(e=parseInt(392.16*t-488.24))>=100?100:e:t<2.016&&t>=1.4?e=parseInt(44.286*t*t-10.706*t-14.206):t<2.628&&t>=2.016?e=parseInt(13141*t*t-3752.7*t*t*t-15022*t+5653.6):t<3&&t>=2.628&&(e=(e=parseInt(53.763*t+19.36))>=100?100:e),e)},GetXorCheck:function(t,e){if(null==t||e<1)return 0;for(var r=0,n=0;n<e;n++)r^=t[n],r&=255;return r},ShiftSend:function(t){for(var e=new ArrayBuffer(2*t.length+2),r=new DataView(e,0),n=1,i=1;i<t.length-1;i++)126==t[i]?(r.setUint8(n,125),r.setUint8(n+1,2),n++):125==t[i]?(r.setUint8(n,125),r.setUint8(n+1,1),n++):r.setUint8(n,t[i]),n++;r.setUint8(0,126),r.setUint8(n,126),n++;try{return new Uint8Array(e.slice(0,n))}catch(t){return!1}},recoverRecv:function(t){for(var e=new Uint8Array(t.length),r=0,n=0;n<t.length;n++)125==t[n]?2==t[n+1]?(e[r]=126,n++):1==t[n+1]?(e[r]=125,n++):e[r]=t[n]:e[r]=t[n],r++;return e=e.slice(0,r)},bufferToHex:function(t){if(null==t)return"";for(var e,r=[],n=0;n<t.length;n++)1==(e=t[n].toString(16)).length&&(e="0"+e),r.push(e);return r.join(" ")},stringToUint8Arraytwo:function(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?(e.push(192|n>>6),e.push(128|63&n)):n<65536?(e.push(224|n>>12),e.push(128|n>>6&63),e.push(128|63&n)):(e.push(240|n>>18),e.push(128|n>>12&63),e.push(128|n>>6&63),e.push(128|63&n))}return new Uint8Array(e)},checkCrc:function(t,e){var r=new ArrayBuffer(2),n=new DataView(r);n.setUint8(0,t[0]),n.setUint8(1,t[1]);var i=t.slice(12,e),a=S(i,i.length);return a&=65535,n.getUint16(0)==a}};var k={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"2401":return r=a(a({},r),function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint16(3),n={};1==(r>>15&1)?n.Power=((32767&r)/100).toFixed(2):n.Voltage=(r/1e3).toFixed(2);return n.sealNum=e.getUint32(5),n.unsealNum=e.getUint32(9),n.Time=C.Uint8ArrayToHex(t.slice(13,20),!0),n}(c));case"2403":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={CardList:[]},n=(t.length-1)/4,i=0;i<n;i++){var a=t.slice(e,e+4);r.CardList.push(C.ab2hex(a)),e+=4}return r.CardList=r.CardList,r}(c));case"2406":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={sealLogList:[]},n=(t.length-1)/11,i=0;i<n;i++){var a={};a.eventID=t[e];var o=t.slice(e+1,e+1+4);a.UserId=C.ab2hex(o),o=t.slice(e+5,e+5+6),a.Time=C.ab2hex(o),r.sealLogList.push(a),e+=11}return r}(c));case"2407":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=1,n={alarmLogList:[]},i=(t.length-1)/10,a=0;a<i;a++){var o={};o.eventID=e.getUint8(r),o.sealStatus=e.getUint8(r+1),o.Voltage=e.getUint16(r+2)/1e3;var s=t.slice(r+4,r+4+6);o.Time=C.ab2hex(s),n.alarmLogList.push(o),r+=10}return n}(c));case"2409":return r=a(a({},r),function(t){if(1!=t[0])return;var e=1,r={Content:""},n=t.slice(e,e+512);return r.Content=C.Uint8ArrayToString(n),r}(c));case"240D":return r.Data=function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(1),n=1,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2)}catch(t){break}if("0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o){var c=0;2==s&&(c=e.getUint16(n+3)),i[""+o]=c}else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x04"==o||"0x07"==o||"0x06"==o||"0x10"==o||"0x12"==o||"0xFC"==o){c="";c=C.Uint8ArrayToHex(t.slice(n+3,n+3+s),!0),i[""+o]=c}else if("0x11"==o||"0x0E"==o||"0x08"==o||"0x09"==o||"0x0A"==o){var l=t.slice(n+3,n+3+s);if(parseInt(l[0])>=49)i[""+o]=C.Uint8ArrayToString(l);else{for(var u="",f=0;f<l.length;f++)u+=l[f];i[""+o]=u}}else{l=t.slice(n+3,n+3+s);i[""+o]=l.toString()}n+=2+s}return i}(c),r;case"2402":case"2408":case"240A":case"240B":case"240C":return r}}catch(t){return console.log("==--",t),r}}};function T(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var I={setCommand:function(t,e){switch(t){case"HHD_BLE_2401":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=1;for(var r=new Uint8Array(20),n=C.stringToUint8Arraytwo(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];r[8]=parseInt(t.setData.cmd);var a=C.getTimeArr();return r[9]=a[0],r[10]=a[1],r[11]=a[2],r[12]=a[3],r[13]=a[4],r[14]=a[5],r[15]=a[6],r[16]=0,r[17]=0,r[18]=0,r[19]=0,T(e,r,t)}(e);case"HHD_BLE_2402":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=2;for(var r=t.setData,n=new Uint8Array(8+4*r.length),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];var o=0;for(a=0;a<r.length;a++){for(var s=C.HexToUint8Array(r[a]),c=0;c<4;c++)n[8+o+c]=s[c];o+=4}return T(e,n,t)}(e);case"HHD_BLE_2403":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=3;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2406":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=6;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2407":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=7;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2408":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=8;for(var r=C.stringToUint8Arraytwo(t.setData.content),n=new Uint8Array(8+r.length+1),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];n[8]=parseInt(t.setData.address);for(a=0;a<r.length;a++)n[9+a]=r[a];return T(e,n,t)}(e);case"HHD_BLE_2409":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=9;for(var r=new Uint8Array(9),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return r[8]=t.setData.address,T(e,r,t)}(e);case"HHD_BLE_240A":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=10;for(var r=new Uint8Array(16),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.password);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240B":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=11;for(var r=new Uint8Array(24),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.aespassword);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240C":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(a.setUint8(r+1,parseInt(o)),"0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o)a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o||"0xFE"==o||"0x14"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x04"==o){a.setUint8(r+2,7);var c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),a.setUint8(r+9,c[6]),r+=9}else if("0x07"==o){a.setUint8(r+2,6);c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),r+=8}else if("0xFC"==o){var l=C.HexToUint8Array(s);a.setUint8(r+2,l.length);for(var u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);r+=l.length+2}else{for(l=C.stringToUint8Arraytwo(s),u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);a.setUint8(r+2,l.length),r+=2+l.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var f=new Uint8Array(2);f[0]=36,f[1]=12;var h=new Uint8Array(8+r+1),g=C.stringToUint8Array(t.blePassword);for(u=0;u<g.byteLength;u++)h[u]=g[u];for(u=0;u<r+1;u++)h[8+u]=a.getUint8(u);return T(f,h,t)}return!1}(e);case"HHD_BLE_240D":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=13;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e)}}},H=a(a({},k),I),L=Object.freeze({__proto__:null,default:H});var D={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),t=C.recoverRecv(t),console.log("反转报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(3,5);i=2047&new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+15!=n)return r;var s=t.slice(13,n-2);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);switch(console.log("解密后:",C.ab2hex(c)),c=c.slice(8,i),console.log("解密后:",C.ab2hex(c)),console.log("解密后:",i),r.Code=c[0],C.ab2hex(t.slice(1,3)).toUpperCase()){case"0311":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0313":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0215":return r;case"0217":return r=a(a({},r),function(t){var e=0,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function R(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)})),console.log("11111");var i=new Uint8Array(2e3);i[0]=126,i[1]=t[0],i[2]=t[1];var a=e.length+6|32768;i[3]=a>>8,i[4]=a;var o="00000000000000"+r.lockId;o=o.substr(-12),i[5]=parseInt(o.substr(0,2),16),i[6]=parseInt(o.substr(2,2),16),i[7]=parseInt(o.substr(4,2),16),i[8]=parseInt(o.substr(6,2),16),i[9]=parseInt(o.substr(8,2),16),i[10]=parseInt(o.substr(10,2),16),i[11]=0,i[12]=0;var s=parseInt(16*Math.ceil((6+e.length)/16)),c=new Uint8Array(s),l=C.getTimeArr();c[0]=l[1],c[1]=l[2],c[2]=l[3],c[3]=l[4],c[4]=l[5],c[5]=l[6];for(var u=0;u<e.length;u++)c[6+u]=e[u];console.log("22323");var f=C.Encrypt(C.ab2hex(c.buffer),n);console.log("22323"),console.log("abx",C.ab2hex(f));for(u=0;u<f.byteLength;u++)i[13+u]=f[u];return i[13+f.byteLength]=C.GetXorCheck(i.slice(1,f.byteLength+13),f.byteLength+13),i[14+f.byteLength]=126,console.log("abx",C.ab2hex(C.ShiftSend(i.slice(0,14+f.byteLength+1)))),C.ShiftSend(i.slice(0,14+f.byteLength+1))}var E={setCommand:function(t,e){switch(t){case"HHD_JT_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),console.log("原始报文",t),console.log("原始报文",C.ab2hex(S)),R(S,B,t)}return!1}(e);case"HHD_JT_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return R(r,a,t)}(e);case"HHD_JT_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),R(r,i,t)}(e);case"HHD_JT_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,R(r,n,t)}(e)}}},P=a(a({},D),E),M=Object.freeze({__proto__:null,default:P});var O={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"0310":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0312":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0214":return r;case"0216":return r=a(a({},r),function(t){var e=1,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function N(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var z={setCommand:function(t,e){switch(t){case"HHD_G_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),N(S,B,t)}return!1}(e);case"HHD_G_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return N(r,a,t)}(e);case"HHD_G_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),N(r,i,t)}(e);case"HHD_G_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,N(r,n,t)}(e)}}},F=a(a({},O),z),j=Object.freeze({__proto__:null,default:F}),V=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.modules={Block:!1!==e.Block?H:null,JTGlock:!1!==e.JTGlock?P:null,Glock:!1!==e.Glock?F:null},this.version="__VERSION__"},n=[{key:"loadModule",value:(a=o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.modules[e]){t.next=16;break}t.t0=e,t.next="Block"===t.t0?4:"JTGlock"===t.t0?8:"Glock"===t.t0?12:16;break;case 4:return t.next=6,Promise.resolve().then((function(){return L}));case 6:return this.modules.Block=t.sent.default,t.abrupt("break",16);case 8:return t.next=10,Promise.resolve().then((function(){return M}));case 10:return this.modules.JTGlock=t.sent.default,t.abrupt("break",16);case 12:return t.next=14,Promise.resolve().then((function(){return j}));case 14:return this.modules.Glock=t.sent.default,t.abrupt("break",16);case 16:return t.abrupt("return",this.modules[e]);case 17:case"end":return t.stop()}}),t,this)})),s=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=a.apply(t,r);function s(t){e(o,n,i,s,c,"next",t)}function c(t){e(o,n,i,s,c,"throw",t)}s(void 0)}))},function(t){return s.apply(this,arguments)})},{key:"Block",get:function(){return this.modules.Block}},{key:"JTGlock",get:function(){return this.modules.JTGlock}},{key:"Glock",get:function(){return this.modules.Glock}}],n&&r(t.prototype,n),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i,a,s}();return V}();
|