avke-sdk 1.0.0

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.
@@ -0,0 +1,3986 @@
1
+ var e = {
2
+ RESPONSE_CODE: {
3
+ DEVICE_CODE: "0x81",
4
+ RM6X21_CODE: "0xAB",
5
+ GLOBAL_FUNC_CODE: "0x80",
6
+ GLOBAL_LIGTH_CODE: "0x98",
7
+ GLOBAL_BATTERY_CODE: "0xB7",
8
+ GLOBAL_LOGO_LIGTH_CODE: "0x99",
9
+ GLOBAL_JOURNEY_CODE: "0xA9",
10
+ RT_ALL_JOURNEY_CODE: "0x80",
11
+ RM6X21_JOURNEY_CODE: "0x92",
12
+ RM6X21_LAYOUT0_CODE: "0xA3",
13
+ RM6X21_ARGB_CODE: "0xAA",
14
+ CONNECT_MODE: {
15
+ USB: 0,
16
+ Bluetooth1: 1,
17
+ Bluetooth2: 2,
18
+ Bluetooth3: 3,
19
+ WIRELESS: 4
20
+ },
21
+ MATRIX6X21_CODE: {
22
+ ADC_HALL_CODE: "0x02",
23
+ KEY_STATUS_CODE: "0x03",
24
+ ADC_MAX_JOURNEY_CODE: "0x04",
25
+ ADC_MIN_JOURNEY_CODE: "0x05",
26
+ ADC_ORIGINAL_CODE: "0x06",
27
+ ADC_MAX_ORIGINAL_CODE: "0x07",
28
+ ADC_MIN_ORIGINAL_CODE: "0x08"
29
+ },
30
+ MATRIX6X21_LAYOUT_CODE: {
31
+ FN0: "0x00",
32
+ FN1: "0x01",
33
+ JOURNEY4: "0x04",
34
+ MODE: "0x08",
35
+ RTDOWN14: "0x14",
36
+ RTUP15: "0x15",
37
+ SAFE16: "0x16",
38
+ SAFE17: "0x17",
39
+ AXIS19: "0x19"
40
+ },
41
+ MATRIX6X21_LAYOUT_MODE_CODE: {
42
+ HRT: "0x20",
43
+ DKS: "0x01",
44
+ SOCD: "0x08",
45
+ MPT: "0x02",
46
+ MT: "0x03",
47
+ END: "0x05",
48
+ TGL: "0x04",
49
+ RS: "0x09",
50
+ MACRO: "0x06"
51
+ },
52
+ MATRIX6X21_ADVANCED_FUNC_CODE: {
53
+ DKS: "0xA6",
54
+ SOCD: "0xAC",
55
+ MPT: "0xA7",
56
+ MT: "0xA4",
57
+ END: "0xA8",
58
+ TGL: "0XA5",
59
+ RS: "0xAD",
60
+ MACRO: "0xA1"
61
+ },
62
+ CUSTOM_BUTTON_COMMAND_TYPE_CMD: {
63
+ KEY: "0x00",
64
+ MEDIA1: "0x10",
65
+ MEDIA2: "0x11",
66
+ MEDIA3: "0x12",
67
+ HOTKEY: "0x60",
68
+ MOUSE: "0x70",
69
+ SYS: "0xF1",
70
+ SYS1: "0xF0",
71
+ MACRO: "0xE0"
72
+ },
73
+ FUNC_TYPE_CMD: {
74
+ MAC: "0x22",
75
+ WIN_KEY_STATUS: "0x20",
76
+ RETE: "0x50",
77
+ LOD: "0xB4",
78
+ DPI: "0xB5",
79
+ SLEEP: "0xB6",
80
+ SITE: "0x60",
81
+ FIRST_FLAG: "0xB3",
82
+ SERIAL_NUMBER: "0xB2",
83
+ PROFILE_INDEX: "0x70",
84
+ RT_ALL: "0xA1"
85
+ },
86
+ UPGRADE: {
87
+ SIGN: "0x88",
88
+ ERASE: "0x89",
89
+ WRITE: "0x8C",
90
+ READ: "0x8D",
91
+ RCRC: "0x8E"
92
+ },
93
+ UPGRADE_SIGN_TYPE: {
94
+ SIGN1: "0x02",
95
+ SIGN2: "0x03",
96
+ SIGN3: "0x02",
97
+ SIGN4: "0x04"
98
+ }
99
+ },
100
+ SET_DEVICE_RT_ALL_JOURNEY_CMD: [
101
+ "0x5C",
102
+ "0x03",
103
+ "0x00",
104
+ "0x93",
105
+ "0xA1",
106
+ "0x00",
107
+ "0xFF",
108
+ "0xFF"
109
+ ],
110
+ READ_DEVICE_RT_ALL_JOURNEY_CMD: [
111
+ "0x5C",
112
+ "0x03",
113
+ "0x00",
114
+ "0x93",
115
+ "0xA1",
116
+ "0xFF",
117
+ "0xFF",
118
+ "0xFF"
119
+ ],
120
+ SET_DEVICE_REST_CMD: [
121
+ "0x5C",
122
+ "0x03",
123
+ "0x00",
124
+ "0x93",
125
+ "0x11",
126
+ "0xFF",
127
+ "0xFF"
128
+ ],
129
+ SET_DEVICE_RETE_CMD: [
130
+ "0x5C",
131
+ "0x04",
132
+ "0x00",
133
+ "0x94",
134
+ "0x50",
135
+ "0x00",
136
+ "0xFF",
137
+ "0xFF"
138
+ ],
139
+ SET_DEVICE_WIN_MODE_CMD: [
140
+ "0x5C",
141
+ "0x03",
142
+ "0x00",
143
+ "0x93",
144
+ "0x30",
145
+ "0x00",
146
+ "0xFF",
147
+ "0xFF"
148
+ ],
149
+ SET_DEVICE_MAC_MODE_CMD: [
150
+ "0x5C",
151
+ "0x03",
152
+ "0x00",
153
+ "0x93",
154
+ "0x31",
155
+ "0x00",
156
+ "0xFF",
157
+ "0xFF"
158
+ ],
159
+ SET_DEVICE_LOD_CMD: [
160
+ "0x5C",
161
+ "0x04",
162
+ "0x00",
163
+ "0x94",
164
+ "0xB4",
165
+ "0x01",
166
+ "0xFF",
167
+ "0xFF"
168
+ ],
169
+ READ_DEVICE_LOD_CMD: [
170
+ "0x5C",
171
+ "0x03",
172
+ "0x00",
173
+ "0x93",
174
+ "0xB4",
175
+ "0xFF",
176
+ "0xFF",
177
+ "0xFF"
178
+ ],
179
+ SET_DEVICE_SLEEP_CMD: [
180
+ "0x5C",
181
+ "0x04",
182
+ "0x00",
183
+ "0x94",
184
+ "0xB6",
185
+ "0x01",
186
+ "0xFF",
187
+ "0xFF"
188
+ ],
189
+ READ_DEVICE_SLEEP_CMD: [
190
+ "0x5C",
191
+ "0x03",
192
+ "0x00",
193
+ "0x93",
194
+ "0xB6",
195
+ "0xFF",
196
+ "0xFF",
197
+ "0xFF"
198
+ ],
199
+ SET_DEVICE_DPI_CMD: [
200
+ "0x5C",
201
+ "0x0C",
202
+ "0x00",
203
+ "0x9C",
204
+ "0xB5",
205
+ "0x01",
206
+ "0x0a",
207
+ "0x32",
208
+ "0x00",
209
+ "0x0b",
210
+ "0x32",
211
+ "0x00",
212
+ "0x01",
213
+ "0x01",
214
+ "0xFF",
215
+ "0xFF"
216
+ ],
217
+ READ_DEVICE_DPI_CMD: [
218
+ "0x5C",
219
+ "0x04",
220
+ "0x00",
221
+ "0x94",
222
+ "0xB5",
223
+ "0x00",
224
+ "0xFF",
225
+ "0xFF"
226
+ ],
227
+ READ_DEVICE_BATTERY_CMD: [
228
+ "0x5C",
229
+ "0x04",
230
+ "0x00",
231
+ "0x94",
232
+ "0xB7",
233
+ "0x00",
234
+ "0xFF",
235
+ "0xFF"
236
+ ],
237
+ READ_DEVICE_RETE_CMD: [
238
+ "0x5C",
239
+ "0x03",
240
+ "0x00",
241
+ "0x93",
242
+ "0x50",
243
+ "0xFF",
244
+ "0xFF"
245
+ ],
246
+ READ_DEVICE_WIN_MODE_CMD: [
247
+ "0x5C",
248
+ "0x03",
249
+ "0x00",
250
+ "0x93",
251
+ "0x21",
252
+ "0xFF",
253
+ "0xFF"
254
+ ],
255
+ READ_DEVICE_MAC_MODE_CMD: [
256
+ "0x5C",
257
+ "0x03",
258
+ "0x00",
259
+ "0x93",
260
+ "0x22",
261
+ "0xFF",
262
+ "0xFF"
263
+ ],
264
+ SET_DEVICE_PROFILE_CMD: [
265
+ "0x5C",
266
+ "0x04",
267
+ "0x00",
268
+ "0x94",
269
+ "0x70",
270
+ "0x02",
271
+ "0xFF",
272
+ "0xFF"
273
+ ],
274
+ READ_DEVICE_PROFILE_CMD: [
275
+ "0x5C",
276
+ "0x04",
277
+ "0x00",
278
+ "0x94",
279
+ "0x70",
280
+ "0xFF",
281
+ "0xFF",
282
+ "0xFF"
283
+ ],
284
+ SET_DEVICE_FIRST_FLAG_CMD: [
285
+ "0x5C",
286
+ "0x04",
287
+ "0x00",
288
+ "0x94",
289
+ "0xB3",
290
+ "0x01",
291
+ "0xFF",
292
+ "0xFF"
293
+ ],
294
+ READ_DEVICE_FIRST_FLAG_CMD: [
295
+ "0x5C",
296
+ "0x04",
297
+ "0x00",
298
+ "0x94",
299
+ "0xB3",
300
+ "0xFF",
301
+ "0xFF",
302
+ "0xFF"
303
+ ],
304
+ SET_DEVICE_SERIAL_NUMBER_CMD: [
305
+ "0x5C",
306
+ "0x05",
307
+ "0x00",
308
+ "0x95",
309
+ "0xB1",
310
+ "0x02",
311
+ "0xFF",
312
+ "0xFF",
313
+ "0xFF",
314
+ "0xFF"
315
+ ],
316
+ READ_DEVICE_SERIAL_NUMBER_CMD: [
317
+ "0x5C",
318
+ "0x05",
319
+ "0x00",
320
+ "0x95",
321
+ "0xB2",
322
+ "0x02",
323
+ "0xFF",
324
+ "0xFF",
325
+ "0xFF",
326
+ "0xFF"
327
+ ],
328
+ SET_DEVICE_WIN_STATUS_CMD: [
329
+ "0x5C",
330
+ "0x03",
331
+ "0x00",
332
+ "0x93",
333
+ "0x20",
334
+ "0x00",
335
+ "0xFF",
336
+ "0xFF"
337
+ ],
338
+ READ_DEVICE_WIN_STATUS_CMD: [
339
+ "0x5C",
340
+ "0x03",
341
+ "0x00",
342
+ "0x93",
343
+ "0x20",
344
+ "0xFF",
345
+ "0xFF"
346
+ ],
347
+ SET_DEVICE_SITE_CMD: [
348
+ "0x5C",
349
+ "0x03",
350
+ "0x00",
351
+ "0x93",
352
+ "0x60"
353
+ ],
354
+ READ_DEVICE_SITE_CMD: [
355
+ "0x5C",
356
+ "0x03",
357
+ "0x00",
358
+ "0x93",
359
+ "0x60",
360
+ "0xFF",
361
+ "0xFF"
362
+ ],
363
+ READ_DEVICE_INFO_CMD: [
364
+ "0x5C",
365
+ "0x02",
366
+ "0x01",
367
+ "0x93",
368
+ "0xFF",
369
+ "0xFF"
370
+ ],
371
+ READ_DEFKEY_MATRIX_CMD: {
372
+ ROW1_ROW2: [
373
+ "0x5C",
374
+ "0x03",
375
+ "0x2B",
376
+ "0XC0",
377
+ "0x00",
378
+ "0x00",
379
+ "0x01"
380
+ ],
381
+ ROW3_ROW4: [
382
+ "0x5C",
383
+ "0x03",
384
+ "0x2B",
385
+ "0XC2",
386
+ "0x00",
387
+ "0x02",
388
+ "0x03"
389
+ ],
390
+ ROW5_ROW6: [
391
+ "0x5C",
392
+ "0x03",
393
+ "0x2B",
394
+ "0XC4",
395
+ "0x00",
396
+ "0x04",
397
+ "0x05"
398
+ ]
399
+ },
400
+ READ_RM6X21_HALL_16BIT_CMD: {
401
+ ROW1_ROW3: [
402
+ "0x5C",
403
+ "0x04",
404
+ "0x12",
405
+ "0xA6",
406
+ "0x02",
407
+ "0x01",
408
+ "0xFF",
409
+ "0xFF"
410
+ ],
411
+ ROW4_ROW6: [
412
+ "0x5C",
413
+ "0x04",
414
+ "0x12",
415
+ "0xA6",
416
+ "0x02",
417
+ "0x02",
418
+ "0xFF",
419
+ "0xFF"
420
+ ]
421
+ },
422
+ READ_RM6X21_ADC_16BIT_CMD: {
423
+ ROW1_ROW3: [
424
+ "0x5C",
425
+ "0x04",
426
+ "0x12",
427
+ "0xA6",
428
+ "0x06",
429
+ "0x01",
430
+ "0xFF",
431
+ "0xFF"
432
+ ],
433
+ ROW4_ROW6: [
434
+ "0x5C",
435
+ "0x04",
436
+ "0x12",
437
+ "0xA6",
438
+ "0x06",
439
+ "0x02",
440
+ "0xFF",
441
+ "0xFF"
442
+ ]
443
+ },
444
+ READ_RM6X21_KEYSTATUS_8BIT_CMD: [
445
+ "0x5C",
446
+ "0x04",
447
+ "0x12",
448
+ "0xA6",
449
+ "0x03",
450
+ "0x01",
451
+ "0xFF",
452
+ "0xFF"
453
+ ],
454
+ READ_LAYOUT_KEY_CUSTOM_HEAD_CMD: [
455
+ "0x5C",
456
+ "0x39",
457
+ "0x23",
458
+ "0xED",
459
+ "0x00"
460
+ ],
461
+ SET_DEVICE_PRGB_CMD: /* @__PURE__ */ "0x5C.0x2c.0x18.0xd4.0x01.0x00.0x00.0x00.0x00.0x00.0x00.0xFF.0xFF.0x00.0xFF.0x00.0xFF.0x00.0x7F.0x7F.0xFF.0xFF.0x00.0x00.0xFF.0x7F.0x00.0x7F.0xFF.0x7F.0x7F.0x00.0xFF.0x7F.0x7F.0x7F.0xFF.0x00.0x00.0x00.0x00.0x01.0x03.0x04.0x03.0x0f.0xFF.0xFF".split("."),
462
+ SET_CUSTOM_BUTTON_MODE_CMD: /* @__PURE__ */ "0x5C.0x2c.0x18.0xd4.0x01.0x00.0x00.0x00.0x00.0x00.0x00.0xFF.0xFF.0x00.0xFF.0x00.0xFF.0x00.0x7F.0x7F.0xFF.0xFF.0x00.0x00.0xFF.0x7F.0x00.0x7F.0xFF.0x7F.0x7F.0x00.0xFF.0x7F.0x7F.0x7F.0xFF.0x00.0x00.0x00.0x00.0x01.0x04.0x15.0x03.0x02.0xFF.0xFF".split("."),
463
+ SET_CUSTOM_LOGO_MODE_CMD: /* @__PURE__ */ "0x5C.0x2c.0x19.0xd5.0x01.0x00.0x00.0x00.0x00.0x00.0x00.0xFF.0xFF.0x00.0xFF.0x00.0xFF.0x00.0x7F.0x7F.0xFF.0xFF.0x00.0x00.0xFF.0x7F.0x00.0x7F.0xFF.0x7F.0x7F.0x00.0xFF.0x7F.0x7F.0x7F.0xFF.0x00.0x00.0x00.0x00.0x01.0x03.0x04.0x03.0x0f.0xFF.0xFF".split("."),
464
+ SET_CUSTOM_LOGO_CMD: /* @__PURE__ */ "0x5C.0x2b.0x19.0xd5.0x01.0x00.0x00.0x00.0x00.0x00.0x00.0xFF.0xFF.0x00.0xFF.0x00.0xFF.0x00.0x7F.0x7F.0xFF.0xFF.0x00.0x00.0xFF.0x7F.0x00.0x7F.0xFF.0x7F.0x7F.0x00.0xFF.0x7F.0x7F.0x7F.0xFF.0x00.0x00.0x00.0x00.0x01.0x03.0x04.0x03.0x00.0x00.0x00".split("."),
465
+ SET_CUSTOM_BUTTON_RGB_HEAD_CMD: [
466
+ "0x5C",
467
+ "0x39",
468
+ "0x2A",
469
+ "0xFF",
470
+ "0x01"
471
+ ],
472
+ SET_CUSTOM_BUTTON_RGB_END_CMD: [
473
+ "0x5C",
474
+ "0x39",
475
+ "0x2A",
476
+ "0xF8",
477
+ "0x01",
478
+ "0xfe",
479
+ "0xfe",
480
+ "0xfe",
481
+ "0xfe"
482
+ ],
483
+ PRGBBRIGHTNESS: "0x03",
484
+ PRGBSPEED: "0x03",
485
+ PRGBLIST: [],
486
+ READ_GLOBAL_JOURNEY_CMD: [
487
+ "0x5C",
488
+ "0x0F",
489
+ "0x29",
490
+ "0xC9",
491
+ "0x00"
492
+ ],
493
+ SET_GLOBAL_JOURNEY_CMD: [
494
+ "0x5C",
495
+ "0x0F",
496
+ "0x29",
497
+ "0xC9",
498
+ "0x01",
499
+ "0x00",
500
+ "0x00",
501
+ "0x00",
502
+ "0x00",
503
+ "0xC8",
504
+ "0x00",
505
+ "0xC8",
506
+ "0x00",
507
+ "0x00",
508
+ "0x00",
509
+ "0x00",
510
+ "0x00",
511
+ "0x00",
512
+ "0x00"
513
+ ],
514
+ SET_DEVICE_FUNCTION_OP_CMD: [
515
+ "0x5C",
516
+ "0x03",
517
+ "0x00",
518
+ "0x93",
519
+ "0x0C",
520
+ "0xFF",
521
+ "0xFF"
522
+ ],
523
+ SET_DEVICE_BUTTON_OP_HEAD: [
524
+ "0x5C",
525
+ "0x39",
526
+ "0x23",
527
+ "0xFF",
528
+ "0x01"
529
+ ],
530
+ SET_DEVICE_BUTTON_OP_CMD: [
531
+ "0x5C",
532
+ "0x39",
533
+ "0x23",
534
+ "0xED",
535
+ "0x01",
536
+ "0x1b",
537
+ "0x00",
538
+ "0xFF",
539
+ "0x00"
540
+ ],
541
+ SET_DEVICE_BUTTON_AXIS_CMD: [
542
+ "0x5C",
543
+ "0x39",
544
+ "0x23",
545
+ "0xED",
546
+ "0x01",
547
+ "0xFF",
548
+ "0x19",
549
+ "0xFF",
550
+ "0x00",
551
+ "0xFF",
552
+ "0xFF"
553
+ ],
554
+ SET_DEVICE_BUTTON_OP_FN_CMD: [
555
+ "0x5C",
556
+ "0x39",
557
+ "0x23",
558
+ "0xED",
559
+ "0x01",
560
+ "0x1b",
561
+ "0x01",
562
+ "0xFF",
563
+ "0x00"
564
+ ],
565
+ SET_DEVICE_BUTTON_DEL_CMD: [
566
+ "0x5C",
567
+ "0x39",
568
+ "0x23",
569
+ "0xED",
570
+ "0x01",
571
+ "0x00",
572
+ "0x08",
573
+ "0x00",
574
+ "0x00",
575
+ "0x00",
576
+ "0x08",
577
+ "0x00",
578
+ "0x00",
579
+ "0x00",
580
+ "0x00"
581
+ ],
582
+ SET_DEVICE_BUTTON_JOURNEY_CMD: [
583
+ "0xFF",
584
+ "0x04",
585
+ "0x00",
586
+ "0x00"
587
+ ],
588
+ SET_RESET_BUTTON_JOURNEY_CMD: [
589
+ "0xFF",
590
+ "0x08",
591
+ "0x00",
592
+ "0x00",
593
+ "0xFF",
594
+ "0x04",
595
+ "0xd0",
596
+ "0x07"
597
+ ],
598
+ SET_DEVICE_BUTTON_RT_CMD: [
599
+ "0xFF",
600
+ "0x08",
601
+ "0x20",
602
+ "0x00",
603
+ "0xFF",
604
+ "0x14",
605
+ "0x00",
606
+ "0x00",
607
+ "0xFF",
608
+ "0x15",
609
+ "0x00",
610
+ "0x00"
611
+ ],
612
+ SET_DEVICE_BUTTON_SAFEZONE_CMD: [
613
+ "0xFF",
614
+ "0x16",
615
+ "0x00",
616
+ "0x00",
617
+ "0xFF",
618
+ "0x17",
619
+ "0x00",
620
+ "0x00"
621
+ ],
622
+ SET_RESET_BUTTON_RT_CMD: [
623
+ "0xFF",
624
+ "0x08",
625
+ "0x00",
626
+ "0x00",
627
+ "0xFF",
628
+ "0x04",
629
+ "0xd0",
630
+ "0x07"
631
+ ],
632
+ SET_DEVICE_FUNCTION_TGL_CMD: /* @__PURE__ */ "0x5C.0x3A.0x25.0xEF.0x01.0xFF.0xFF.0x00.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF".split("."),
633
+ SET_DEVICE_FUNCTION_END_CMD: /* @__PURE__ */ "0x5C.0x04.0x28.0xBD.0x01.0xFF.0xFF.0x00.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0x00".split("."),
634
+ SET_DEVICE_FUNCTION_MT_CMD: /* @__PURE__ */ "0x5C.0x07.0x24.0xD0.0x01.0xFF.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00".split("."),
635
+ SET_DEVICE_FUNCTION_RS_CMD: /* @__PURE__ */ "0x5C.0x05.0x2D.0xc7.0x01.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00".split("."),
636
+ SET_DEVICE_FUNCTION_MPT_CMD: /* @__PURE__ */ "0x5C.0x33.0x27.0xEB.0x01.0xFF.0xFF.0x00.0xFF.0x00.0xFF.0x00.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0x00.0xFF.0x00.0xFF.0x00.0xFF.0xFF.0xFF.0xFF.0xFF.0x00.0xFF.0x00.0xFF.0x00.0xFF.0xFF.0xFF.0xFF.0xFF.0x00.0xFF.0x00.0xFF.0x00.0xFF.0xFF.0xFF.0xFF.0xFF.0x00.0xFF.0x00.0xFF.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00".split("."),
637
+ SET_DEVICE_FUNCTION_DKS_CMD: /* @__PURE__ */ "0x5C.0x38.0x26.0xEF.0x01.0xFF.0xFF.0x00.0xFF.0x00.0xFF.0x00.0xFF.0x00.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0x00.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0x00.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0xFF.0x00.0x00.0x00.0x00.0x00".split("."),
638
+ SET_DEVICE_FUNCTION_SOCD_CMD: /* @__PURE__ */ "0x5C.0x07.0x2C.0xC4.0x01.0xFF.0xFF.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00.0x00".split("."),
639
+ MACRO_TYPE_CMD: {
640
+ DELAY: [
641
+ "0x06",
642
+ "0x00",
643
+ "0x00"
644
+ ],
645
+ KEY_DOWN: [
646
+ "0x84",
647
+ "0x00",
648
+ "0x00"
649
+ ],
650
+ KEY_UP: [
651
+ "0x04",
652
+ "0x00",
653
+ "0x00"
654
+ ],
655
+ MOUSE_X: [
656
+ "0x85",
657
+ "0x00",
658
+ "0x00"
659
+ ],
660
+ MOUSE_Y: [
661
+ "0x05",
662
+ "0x00",
663
+ "0x00"
664
+ ]
665
+ },
666
+ SET_DEVICE_FUNCTION_MACRO_CMD: [
667
+ "0x5C",
668
+ "0x00",
669
+ "0x20",
670
+ "0xFF",
671
+ "0x01",
672
+ "0xFF",
673
+ "0xFF",
674
+ "0x00"
675
+ ],
676
+ SET_DEVICE_SIGN1_CMD: [
677
+ "0x5C",
678
+ "0x27",
679
+ "0x08",
680
+ "0xBF",
681
+ "0x02"
682
+ ],
683
+ SET_DEVICE_SIGN2_CMD: [
684
+ "0x5C",
685
+ "0x27",
686
+ "0x08",
687
+ "0xBF",
688
+ "0x03"
689
+ ],
690
+ SET_DEVICE_SIGN_ERASE_CMD: [
691
+ "0x5C",
692
+ "0x09",
693
+ "0x09",
694
+ "0xA2",
695
+ "0x00",
696
+ "0x00",
697
+ "0x00",
698
+ "0x00",
699
+ "0x00",
700
+ "0x00",
701
+ "0x00",
702
+ "0x00",
703
+ "0xFF",
704
+ "0x00",
705
+ "0x00"
706
+ ],
707
+ SET_DEVICE_SIGN3_CMD: /* @__PURE__ */ "0x5C.0x27.0x08.0xBF.0x02.0x10.0x77.0xc6.0xf4.0x87.0xf4.0xd1.0x0f.0xf1.0xc0.0x91.0x00.0x3b.0x0b.0xb1.0xa4.0x14.0x10.0x38.0x31.0x38.0x32.0x37.0x34.0x37.0x38.0x30.0x39.0x30.0x39.0x36.0x34.0x35.0x37.0xFF.0xFF.0xFF.0xFF".split("."),
708
+ SET_DEVICE_SIGN4_CMD: [
709
+ "0x5C",
710
+ "0x27",
711
+ "0x08",
712
+ "0xBF",
713
+ "0x04"
714
+ ],
715
+ SET_DEVICE_SIGN5_CMD: [
716
+ "0x5C",
717
+ "0x27",
718
+ "0x08",
719
+ "0xBF",
720
+ "0x06"
721
+ ],
722
+ SET_DEVICE_SIGN6_CMD: [
723
+ "0x5C",
724
+ "0x27",
725
+ "0x08",
726
+ "0xBF",
727
+ "0x05"
728
+ ],
729
+ SET_DEVICE_SIGN_REBOOT_CMD: [
730
+ "0x5C",
731
+ "0x02",
732
+ "0x0A",
733
+ "0x9C",
734
+ "0xFF",
735
+ "0xFF",
736
+ "0x00",
737
+ "0x00",
738
+ "0x00"
739
+ ],
740
+ READ_DEVICE_APP_CRC_CMD: [
741
+ "0x5C",
742
+ "0x0A",
743
+ "0x0E",
744
+ "0x00",
745
+ "0x00",
746
+ "0x00",
747
+ "0x00",
748
+ "0x00",
749
+ "0x00",
750
+ "0x00",
751
+ "0x00",
752
+ "0x00",
753
+ "0xFF",
754
+ "0xFF"
755
+ ],
756
+ SET_DEVICE_SIGN_APP_CMD: [
757
+ "0x5C",
758
+ "0x0A",
759
+ "0x0B",
760
+ "0x00",
761
+ "0x00",
762
+ "0x00",
763
+ "0x00",
764
+ "0x00",
765
+ "0x00",
766
+ "0x00",
767
+ "0x00",
768
+ "0x00",
769
+ "0x00",
770
+ "0x00"
771
+ ],
772
+ SET_DEVICE_WRITE_FIRMWARE_CMD: [
773
+ "0x5C",
774
+ "0xFA",
775
+ "0x0C",
776
+ "0xFF",
777
+ "0x00",
778
+ "0x00",
779
+ "0x00",
780
+ "0x00",
781
+ "0xF4",
782
+ "0x00"
783
+ ]
784
+ }, t = { KEYMAP: [
785
+ {
786
+ Name: "A",
787
+ Task: "A",
788
+ VKCode: "65",
789
+ ScanCode: "30",
790
+ Flag: "0",
791
+ Hid: "0x04",
792
+ Value: "A"
793
+ },
794
+ {
795
+ Name: "B",
796
+ Task: "B",
797
+ VKCode: "66",
798
+ ScanCode: "48",
799
+ Flag: "0",
800
+ Hid: "0x05",
801
+ Value: "B"
802
+ },
803
+ {
804
+ Name: "C",
805
+ Task: "C",
806
+ VKCode: "67",
807
+ ScanCode: "46",
808
+ Flag: "0",
809
+ Hid: "0x06",
810
+ Value: "C"
811
+ },
812
+ {
813
+ Name: "D",
814
+ Task: "D",
815
+ VKCode: "68",
816
+ ScanCode: "32",
817
+ Flag: "0",
818
+ Hid: "0x07",
819
+ Value: "D"
820
+ },
821
+ {
822
+ Name: "E",
823
+ Task: "E",
824
+ VKCode: "69",
825
+ ScanCode: "18",
826
+ Flag: "0",
827
+ Hid: "0x08",
828
+ Value: "E"
829
+ },
830
+ {
831
+ Name: "F",
832
+ Task: "F",
833
+ VKCode: "70",
834
+ ScanCode: "33",
835
+ Flag: "0",
836
+ Hid: "0x09",
837
+ Value: "F"
838
+ },
839
+ {
840
+ Name: "G",
841
+ Task: "G",
842
+ VKCode: "71",
843
+ ScanCode: "34",
844
+ Flag: "0",
845
+ Hid: "0x0A",
846
+ Value: "G"
847
+ },
848
+ {
849
+ Name: "H",
850
+ Task: "H",
851
+ VKCode: "72",
852
+ ScanCode: "35",
853
+ Flag: "0",
854
+ Hid: "0x0B",
855
+ Value: "H"
856
+ },
857
+ {
858
+ Name: "I",
859
+ Task: "I",
860
+ VKCode: "73",
861
+ ScanCode: "23",
862
+ Flag: "0",
863
+ Hid: "0x0C",
864
+ Value: "I"
865
+ },
866
+ {
867
+ Name: "J",
868
+ Task: "J",
869
+ VKCode: "74",
870
+ ScanCode: "36",
871
+ Flag: "0",
872
+ Hid: "0x0D",
873
+ Value: "J"
874
+ },
875
+ {
876
+ Name: "K",
877
+ Task: "K",
878
+ VKCode: "75",
879
+ ScanCode: "37",
880
+ Flag: "0",
881
+ Hid: "0x0E",
882
+ Value: "K"
883
+ },
884
+ {
885
+ Name: "L",
886
+ Task: "L",
887
+ VKCode: "76",
888
+ ScanCode: "38",
889
+ Flag: "0",
890
+ Hid: "0x0F",
891
+ Value: "L"
892
+ },
893
+ {
894
+ Name: "M",
895
+ Task: "M",
896
+ VKCode: "77",
897
+ ScanCode: "50",
898
+ Flag: "0",
899
+ Hid: "0x10",
900
+ Value: "M"
901
+ },
902
+ {
903
+ Name: "N",
904
+ Task: "N",
905
+ VKCode: "78",
906
+ ScanCode: "49",
907
+ Flag: "0",
908
+ Hid: "0x11",
909
+ Value: "N"
910
+ },
911
+ {
912
+ Name: "O",
913
+ Task: "O",
914
+ VKCode: "79",
915
+ ScanCode: "24",
916
+ Flag: "0",
917
+ Hid: "0x12",
918
+ Value: "O"
919
+ },
920
+ {
921
+ Name: "P",
922
+ Task: "P",
923
+ VKCode: "80",
924
+ ScanCode: "25",
925
+ Flag: "0",
926
+ Hid: "0x13",
927
+ Value: "P"
928
+ },
929
+ {
930
+ Name: "Q",
931
+ Task: "Q",
932
+ VKCode: "81",
933
+ ScanCode: "16",
934
+ Flag: "0",
935
+ Hid: "0x14",
936
+ Value: "Q"
937
+ },
938
+ {
939
+ Name: "R",
940
+ Task: "R",
941
+ VKCode: "82",
942
+ ScanCode: "19",
943
+ Flag: "0",
944
+ Hid: "0x15",
945
+ Value: "R"
946
+ },
947
+ {
948
+ Name: "S",
949
+ Task: "S",
950
+ VKCode: "83",
951
+ ScanCode: "31",
952
+ Flag: "0",
953
+ Hid: "0x16",
954
+ Value: "S"
955
+ },
956
+ {
957
+ Name: "T",
958
+ Task: "T",
959
+ VKCode: "84",
960
+ ScanCode: "20",
961
+ Flag: "0",
962
+ Hid: "0x17",
963
+ Value: "T"
964
+ },
965
+ {
966
+ Name: "U",
967
+ Task: "U",
968
+ VKCode: "85",
969
+ ScanCode: "22",
970
+ Flag: "0",
971
+ Hid: "0x18",
972
+ Value: "U"
973
+ },
974
+ {
975
+ Name: "V",
976
+ Task: "V",
977
+ VKCode: "86",
978
+ ScanCode: "47",
979
+ Flag: "0",
980
+ Hid: "0x19",
981
+ Value: "V"
982
+ },
983
+ {
984
+ Name: "W",
985
+ Task: "W",
986
+ VKCode: "87",
987
+ ScanCode: "16",
988
+ Flag: "0",
989
+ Hid: "0x1A",
990
+ Value: "W"
991
+ },
992
+ {
993
+ Name: "X",
994
+ Task: "X",
995
+ VKCode: "88",
996
+ ScanCode: "45",
997
+ Flag: "0",
998
+ Hid: "0x1B",
999
+ Value: "X"
1000
+ },
1001
+ {
1002
+ Name: "Y",
1003
+ Task: "Y",
1004
+ VKCode: "89",
1005
+ ScanCode: "21",
1006
+ Flag: "0",
1007
+ Hid: "0x1C",
1008
+ Value: "Y"
1009
+ },
1010
+ {
1011
+ Name: "Z",
1012
+ Task: "Z",
1013
+ VKCode: "90",
1014
+ ScanCode: "44",
1015
+ Flag: "0",
1016
+ Hid: "0x1D",
1017
+ Value: "Z"
1018
+ },
1019
+ {
1020
+ Name: "0",
1021
+ Task: "0",
1022
+ VKCode: "48",
1023
+ ScanCode: "11",
1024
+ Flag: "0",
1025
+ Hid: "0x27",
1026
+ Value: "U0"
1027
+ },
1028
+ {
1029
+ Name: "1",
1030
+ Task: "1",
1031
+ VKCode: "49",
1032
+ ScanCode: "2",
1033
+ Flag: "0",
1034
+ Hid: "0x1E",
1035
+ Value: "U1"
1036
+ },
1037
+ {
1038
+ Name: "2",
1039
+ Task: "2",
1040
+ VKCode: "50",
1041
+ ScanCode: "3",
1042
+ Flag: "0",
1043
+ Hid: "0x1F",
1044
+ Value: "U2"
1045
+ },
1046
+ {
1047
+ Name: "3",
1048
+ Task: "3",
1049
+ VKCode: "51",
1050
+ ScanCode: "4",
1051
+ Flag: "0",
1052
+ Hid: "0x20",
1053
+ Value: "U3"
1054
+ },
1055
+ {
1056
+ Name: "4",
1057
+ Task: "4",
1058
+ VKCode: "52",
1059
+ ScanCode: "5",
1060
+ Flag: "0",
1061
+ Hid: "0x21",
1062
+ Value: "U4"
1063
+ },
1064
+ {
1065
+ Name: "5",
1066
+ Task: "5",
1067
+ VKCode: "53",
1068
+ ScanCode: "6",
1069
+ Flag: "0",
1070
+ Hid: "0x22",
1071
+ Value: "U5"
1072
+ },
1073
+ {
1074
+ Name: "6",
1075
+ Task: "6",
1076
+ VKCode: "54",
1077
+ ScanCode: "7",
1078
+ Flag: "0",
1079
+ Hid: "0x23",
1080
+ Value: "U6"
1081
+ },
1082
+ {
1083
+ Name: "7",
1084
+ Task: "7",
1085
+ VKCode: "55",
1086
+ ScanCode: "8",
1087
+ Flag: "0",
1088
+ Hid: "0x24",
1089
+ Value: "U7"
1090
+ },
1091
+ {
1092
+ Name: "8",
1093
+ Task: "8",
1094
+ VKCode: "56",
1095
+ ScanCode: "9",
1096
+ Flag: "0",
1097
+ Hid: "0x25",
1098
+ Value: "U8"
1099
+ },
1100
+ {
1101
+ Name: "9",
1102
+ Task: "9",
1103
+ VKCode: "57",
1104
+ ScanCode: "10",
1105
+ Flag: "0",
1106
+ Hid: "0x26",
1107
+ Value: "U9"
1108
+ },
1109
+ {
1110
+ Name: "Num Lock",
1111
+ Task: "Num LOCK",
1112
+ VKCode: "144",
1113
+ ScanCode: "69",
1114
+ Flag: "1",
1115
+ Hid: "0x53",
1116
+ Value: "NUMLOCK"
1117
+ },
1118
+ {
1119
+ Name: "Num /",
1120
+ Task: "Num /",
1121
+ VKCode: "111",
1122
+ ScanCode: "53",
1123
+ Flag: "1",
1124
+ Hid: "0x54",
1125
+ Value: "NUMSLASH"
1126
+ },
1127
+ {
1128
+ Name: "Num *",
1129
+ Task: "Num *",
1130
+ VKCode: "106",
1131
+ ScanCode: "55",
1132
+ Flag: "0",
1133
+ Hid: "0x55",
1134
+ Value: "NUMSTAR"
1135
+ },
1136
+ {
1137
+ Name: "Num ",
1138
+ Task: "Num ",
1139
+ VKCode: "109",
1140
+ ScanCode: "74",
1141
+ Flag: "0",
1142
+ Hid: "0x56",
1143
+ Value: "NUMMINUS"
1144
+ },
1145
+ {
1146
+ Name: "Num +",
1147
+ Task: "Num +",
1148
+ VKCode: "107",
1149
+ ScanCode: "78",
1150
+ Flag: "0",
1151
+ Hid: "0x57",
1152
+ Value: "NUMPLUS"
1153
+ },
1154
+ {
1155
+ Name: "Num Enter",
1156
+ Task: "Num ENTER",
1157
+ VKCode: "13",
1158
+ ScanCode: "28",
1159
+ Flag: "1",
1160
+ Hid: "0x58",
1161
+ Value: "NUMENTER"
1162
+ },
1163
+ {
1164
+ Name: "Num .",
1165
+ Task: "Num .",
1166
+ VKCode: "110",
1167
+ ScanCode: "83",
1168
+ Flag: "0",
1169
+ Hid: "0x63",
1170
+ Value: "NUMPERIOD"
1171
+ },
1172
+ {
1173
+ Name: "Num 0",
1174
+ Task: "Num 0",
1175
+ VKCode: "96",
1176
+ ScanCode: "82",
1177
+ Flag: "0",
1178
+ Hid: "0x62",
1179
+ Value: "Num 0"
1180
+ },
1181
+ {
1182
+ Name: "Num 1",
1183
+ Task: "Num 1",
1184
+ VKCode: "97",
1185
+ ScanCode: "79",
1186
+ Flag: "0",
1187
+ Hid: "0x59",
1188
+ Value: "Num 1"
1189
+ },
1190
+ {
1191
+ Name: "Num 2",
1192
+ Task: "Num 2",
1193
+ VKCode: "98",
1194
+ ScanCode: "80",
1195
+ Flag: "0",
1196
+ Hid: "0x5A",
1197
+ Value: "Num 2"
1198
+ },
1199
+ {
1200
+ Name: "Num 3",
1201
+ Task: "Num 3",
1202
+ VKCode: "99",
1203
+ ScanCode: "81",
1204
+ Flag: "0",
1205
+ Hid: "0x5B",
1206
+ Value: "Num 3"
1207
+ },
1208
+ {
1209
+ Name: "Num 4",
1210
+ Task: "Num 4",
1211
+ VKCode: "100",
1212
+ ScanCode: "75",
1213
+ Flag: "0",
1214
+ Hid: "0x5C",
1215
+ Value: "Num 4"
1216
+ },
1217
+ {
1218
+ Name: "Num 5",
1219
+ Task: "Num 5",
1220
+ VKCode: "101",
1221
+ ScanCode: "76",
1222
+ Flag: "0",
1223
+ Hid: "0x5D",
1224
+ Value: "Num 5"
1225
+ },
1226
+ {
1227
+ Name: "Num 6",
1228
+ Task: "Num 6",
1229
+ VKCode: "102",
1230
+ ScanCode: "77",
1231
+ Flag: "0",
1232
+ Hid: "0x5E",
1233
+ Value: "Num 6"
1234
+ },
1235
+ {
1236
+ Name: "Num 7",
1237
+ Task: "Num 7",
1238
+ VKCode: "103",
1239
+ ScanCode: "71",
1240
+ Flag: "0",
1241
+ Hid: "0x5F",
1242
+ Value: "Num 7"
1243
+ },
1244
+ {
1245
+ Name: "Num 8",
1246
+ Task: "Num 8",
1247
+ VKCode: "104",
1248
+ ScanCode: "72",
1249
+ Flag: "0",
1250
+ Hid: "0x60",
1251
+ Value: "Num 8"
1252
+ },
1253
+ {
1254
+ Name: "Num 9",
1255
+ Task: "Num 9",
1256
+ VKCode: "105",
1257
+ ScanCode: "73",
1258
+ Flag: "0",
1259
+ Hid: "0x61",
1260
+ Value: "Num 9"
1261
+ },
1262
+ {
1263
+ Name: "Esc",
1264
+ Task: "Esc",
1265
+ VKCode: "27",
1266
+ ScanCode: "1",
1267
+ Flag: "0",
1268
+ Hid: "0x29",
1269
+ Value: "Esc"
1270
+ },
1271
+ {
1272
+ Name: "F1",
1273
+ Task: "F1",
1274
+ VKCode: "112",
1275
+ ScanCode: "59",
1276
+ Flag: "0",
1277
+ Hid: "0x3A",
1278
+ Value: "F1"
1279
+ },
1280
+ {
1281
+ Name: "F2",
1282
+ Task: "F2",
1283
+ VKCode: "113",
1284
+ ScanCode: "60",
1285
+ Flag: "0",
1286
+ Hid: "0x3B",
1287
+ Value: "F2"
1288
+ },
1289
+ {
1290
+ Name: "F3",
1291
+ Task: "F3",
1292
+ VKCode: "114",
1293
+ ScanCode: "61",
1294
+ Flag: "0",
1295
+ Hid: "0x3C",
1296
+ Value: "F3"
1297
+ },
1298
+ {
1299
+ Name: "F4",
1300
+ Task: "F4",
1301
+ VKCode: "115",
1302
+ ScanCode: "62",
1303
+ Flag: "0",
1304
+ Hid: "0x3D",
1305
+ Value: "F4"
1306
+ },
1307
+ {
1308
+ Name: "F5",
1309
+ Task: "F5",
1310
+ VKCode: "116",
1311
+ ScanCode: "63",
1312
+ Flag: "0",
1313
+ Hid: "0x3E",
1314
+ Value: "F5"
1315
+ },
1316
+ {
1317
+ Name: "F6",
1318
+ Task: "F6",
1319
+ VKCode: "117",
1320
+ ScanCode: "64",
1321
+ Flag: "0",
1322
+ Hid: "0x3F",
1323
+ Value: "F6"
1324
+ },
1325
+ {
1326
+ Name: "F7",
1327
+ Task: "F7",
1328
+ VKCode: "118",
1329
+ ScanCode: "65",
1330
+ Flag: "0",
1331
+ Hid: "0x40",
1332
+ Value: "F7"
1333
+ },
1334
+ {
1335
+ Name: "F8",
1336
+ Task: "F8",
1337
+ VKCode: "119",
1338
+ ScanCode: "66",
1339
+ Flag: "0",
1340
+ Hid: "0x41",
1341
+ Value: "F8"
1342
+ },
1343
+ {
1344
+ Name: "F9",
1345
+ Task: "F9",
1346
+ VKCode: "120",
1347
+ ScanCode: "67",
1348
+ Flag: "0",
1349
+ Hid: "0x42",
1350
+ Value: "F9"
1351
+ },
1352
+ {
1353
+ Name: "F10",
1354
+ Task: "F10",
1355
+ VKCode: "121",
1356
+ ScanCode: "68",
1357
+ Flag: "0",
1358
+ Hid: "0x43",
1359
+ Value: "F10"
1360
+ },
1361
+ {
1362
+ Name: "F11",
1363
+ Task: "F11",
1364
+ VKCode: "122",
1365
+ ScanCode: "87",
1366
+ Flag: "0",
1367
+ Hid: "0x44",
1368
+ Value: "F11"
1369
+ },
1370
+ {
1371
+ Name: "F12",
1372
+ Task: "F12",
1373
+ VKCode: "123",
1374
+ ScanCode: "88",
1375
+ Flag: "0",
1376
+ Hid: "0x45",
1377
+ Value: "F12"
1378
+ },
1379
+ {
1380
+ Name: "`",
1381
+ Task: "`",
1382
+ VKCode: "192",
1383
+ ScanCode: "41",
1384
+ Flag: "0",
1385
+ Hid: "0x35",
1386
+ Value: "TILDE"
1387
+ },
1388
+ {
1389
+ Name: "-",
1390
+ Task: "-",
1391
+ VKCode: "189",
1392
+ ScanCode: "12",
1393
+ Flag: "0",
1394
+ Hid: "0x2D",
1395
+ Value: "MINUS"
1396
+ },
1397
+ {
1398
+ Name: "+",
1399
+ Task: "+",
1400
+ VKCode: "187",
1401
+ ScanCode: "13",
1402
+ Flag: "0",
1403
+ Hid: "0x2E",
1404
+ Value: "EQUAL"
1405
+ },
1406
+ {
1407
+ Name: "Backspace",
1408
+ Task: "BACKSPACE",
1409
+ VKCode: "8",
1410
+ ScanCode: "14",
1411
+ Flag: "0",
1412
+ Hid: "0x2A",
1413
+ Value: "Backspace"
1414
+ },
1415
+ {
1416
+ Name: "[",
1417
+ Task: "[",
1418
+ VKCode: "219",
1419
+ ScanCode: "26",
1420
+ Flag: "0",
1421
+ Hid: "0x2F",
1422
+ Value: "LBRACKET"
1423
+ },
1424
+ {
1425
+ Name: "]",
1426
+ Task: "]",
1427
+ VKCode: "221",
1428
+ ScanCode: "27",
1429
+ Flag: "0",
1430
+ Hid: "0x30",
1431
+ Value: "RBRACKET"
1432
+ },
1433
+ {
1434
+ Name: "\\",
1435
+ Task: "\\",
1436
+ VKCode: "220",
1437
+ ScanCode: "43",
1438
+ Flag: "0",
1439
+ Hid: "0x31",
1440
+ Value: "BACKSLASH"
1441
+ },
1442
+ {
1443
+ Name: ";",
1444
+ Task: ";",
1445
+ VKCode: "186",
1446
+ ScanCode: "39",
1447
+ Flag: "0",
1448
+ Hid: "0x33",
1449
+ Value: "SEMICOLON"
1450
+ },
1451
+ {
1452
+ Name: "'",
1453
+ Task: "'",
1454
+ VKCode: "222",
1455
+ ScanCode: "40",
1456
+ Flag: "0",
1457
+ Hid: "0x34",
1458
+ Value: "QUOTE"
1459
+ },
1460
+ {
1461
+ Name: "Enter",
1462
+ Task: "ENTER",
1463
+ VKCode: "13",
1464
+ ScanCode: "28",
1465
+ Flag: "0",
1466
+ Hid: "0x28",
1467
+ Value: "Enter"
1468
+ },
1469
+ {
1470
+ Name: ",",
1471
+ Task: ",",
1472
+ VKCode: "188",
1473
+ ScanCode: "51",
1474
+ Flag: "0",
1475
+ Hid: "0x36",
1476
+ Value: "COMMA"
1477
+ },
1478
+ {
1479
+ Name: ".",
1480
+ Task: ".",
1481
+ VKCode: "190",
1482
+ ScanCode: "52",
1483
+ Flag: "0",
1484
+ Hid: "0x37",
1485
+ Value: "PERIOD"
1486
+ },
1487
+ {
1488
+ Name: "/",
1489
+ Task: "/",
1490
+ VKCode: "191",
1491
+ ScanCode: "53",
1492
+ Flag: "0",
1493
+ Hid: "0x38",
1494
+ Value: "SLASH"
1495
+ },
1496
+ {
1497
+ Name: "Tab",
1498
+ Task: "Tab",
1499
+ VKCode: "9",
1500
+ ScanCode: "15",
1501
+ Flag: "0",
1502
+ Hid: "0x2B",
1503
+ Value: "Tab"
1504
+ },
1505
+ {
1506
+ Name: "CapsLock",
1507
+ Task: "CAPSLOCK",
1508
+ VKCode: "20",
1509
+ ScanCode: "58",
1510
+ Flag: "0",
1511
+ Hid: "0x39",
1512
+ Value: "CAPSLOCK"
1513
+ },
1514
+ {
1515
+ Name: "Ctrl",
1516
+ Task: "LCTRL",
1517
+ VKCode: "162",
1518
+ ScanCode: "29",
1519
+ Flag: "0",
1520
+ Hid: "0xE0",
1521
+ Value: "LCTRL"
1522
+ },
1523
+ {
1524
+ Name: "Shift",
1525
+ Task: "LSHIFT",
1526
+ VKCode: "160",
1527
+ ScanCode: "42",
1528
+ Flag: "0",
1529
+ Hid: "0xE1",
1530
+ Value: "LSHIFT"
1531
+ },
1532
+ {
1533
+ Name: "Alt",
1534
+ Task: "LALT",
1535
+ VKCode: "164",
1536
+ ScanCode: "56",
1537
+ Flag: "0",
1538
+ Hid: "0xE2",
1539
+ Value: "LALT"
1540
+ },
1541
+ {
1542
+ Name: "Win",
1543
+ Task: "LWIN",
1544
+ VKCode: "91",
1545
+ ScanCode: "91",
1546
+ Flag: "1",
1547
+ Hid: "0xE3",
1548
+ Value: "LWIN"
1549
+ },
1550
+ {
1551
+ Name: "Ctrl",
1552
+ Task: "RCTRL",
1553
+ VKCode: "163",
1554
+ ScanCode: "29",
1555
+ Flag: "1",
1556
+ Hid: "0xE4",
1557
+ Value: "RCTRL"
1558
+ },
1559
+ {
1560
+ Name: "Shift",
1561
+ Task: "RSHIFT",
1562
+ VKCode: "161",
1563
+ ScanCode: "54",
1564
+ Flag: "1",
1565
+ Hid: "0xE5",
1566
+ Value: "RSHIFT"
1567
+ },
1568
+ {
1569
+ Name: "Alt",
1570
+ Task: "RALT",
1571
+ VKCode: "165",
1572
+ ScanCode: "56",
1573
+ Flag: "1",
1574
+ Hid: "0xE6",
1575
+ Value: "RALT"
1576
+ },
1577
+ {
1578
+ Name: "Win",
1579
+ Task: "RWIN",
1580
+ VKCode: "91",
1581
+ ScanCode: "92",
1582
+ Flag: "1",
1583
+ Hid: "0xE7",
1584
+ Value: "RWIN"
1585
+ },
1586
+ {
1587
+ Name: "Menu",
1588
+ Task: "Menu",
1589
+ VKCode: "93",
1590
+ ScanCode: "93",
1591
+ Flag: "1",
1592
+ Hid: "0x65",
1593
+ Value: "Menu"
1594
+ },
1595
+ {
1596
+ Name: "Space",
1597
+ Task: "Space",
1598
+ VKCode: "32",
1599
+ ScanCode: "57",
1600
+ Flag: "0",
1601
+ Hid: "0x2C",
1602
+ Value: "Space"
1603
+ },
1604
+ {
1605
+ Name: "Space",
1606
+ Task: "Space",
1607
+ VKCode: "32",
1608
+ ScanCode: "57",
1609
+ Flag: "0",
1610
+ Hid: "0xF0",
1611
+ Value: "Space"
1612
+ },
1613
+ {
1614
+ Name: "Space",
1615
+ Task: "Space",
1616
+ VKCode: "32",
1617
+ ScanCode: "57",
1618
+ Flag: "0",
1619
+ Hid: "0xF1",
1620
+ Value: "Space"
1621
+ },
1622
+ {
1623
+ Name: "Print Screen",
1624
+ Task: "PRINTSCREEN",
1625
+ VKCode: "44",
1626
+ ScanCode: "55",
1627
+ Flag: "1",
1628
+ Hid: "0x46",
1629
+ Value: "PRINTSCREEN"
1630
+ },
1631
+ {
1632
+ Name: "Scroll Lock",
1633
+ Task: "SCROLLLOCK",
1634
+ VKCode: "145",
1635
+ ScanCode: "70",
1636
+ Flag: "0",
1637
+ Hid: "0x47",
1638
+ Value: "SCROLLLOCK"
1639
+ },
1640
+ {
1641
+ Name: "Pause",
1642
+ Task: "PAUSE",
1643
+ VKCode: "19",
1644
+ ScanCode: "69",
1645
+ Flag: "0",
1646
+ Hid: "0x48",
1647
+ Value: "PAUSE"
1648
+ },
1649
+ {
1650
+ Name: "Insert",
1651
+ Task: "INSERT",
1652
+ VKCode: "45",
1653
+ ScanCode: "82",
1654
+ Flag: "1",
1655
+ Hid: "0x49",
1656
+ Value: "INSERT"
1657
+ },
1658
+ {
1659
+ Name: "Home",
1660
+ Task: "HOME",
1661
+ VKCode: "36",
1662
+ ScanCode: "71",
1663
+ Flag: "1",
1664
+ Hid: "0x4A",
1665
+ Value: "HOME"
1666
+ },
1667
+ {
1668
+ Name: "PgUp",
1669
+ Task: "PAGEUP",
1670
+ VKCode: "33",
1671
+ ScanCode: "73",
1672
+ Flag: "1",
1673
+ Hid: "0x4B",
1674
+ Value: "PAGEUP"
1675
+ },
1676
+ {
1677
+ Name: "Delete",
1678
+ Task: "DELETE",
1679
+ VKCode: "46",
1680
+ ScanCode: "83",
1681
+ Flag: "1",
1682
+ Hid: "0x4C",
1683
+ Value: "DELETE"
1684
+ },
1685
+ {
1686
+ Name: "End",
1687
+ Task: "END",
1688
+ VKCode: "35",
1689
+ ScanCode: "79",
1690
+ Flag: "1",
1691
+ Hid: "0x4D",
1692
+ Value: "END"
1693
+ },
1694
+ {
1695
+ Name: "PgDn",
1696
+ Task: "PAGEDOWN",
1697
+ VKCode: "34",
1698
+ ScanCode: "81",
1699
+ Flag: "1",
1700
+ Hid: "0x4E",
1701
+ Value: "PAGEDOWN"
1702
+ },
1703
+ {
1704
+ Name: "Up",
1705
+ Task: "UP",
1706
+ VKCode: "38",
1707
+ ScanCode: "72",
1708
+ Flag: "1",
1709
+ Hid: "0x52",
1710
+ Value: "Up"
1711
+ },
1712
+ {
1713
+ Name: "Down",
1714
+ Task: "DOWN",
1715
+ VKCode: "40",
1716
+ ScanCode: "80",
1717
+ Flag: "1",
1718
+ Hid: "0x51",
1719
+ Value: "Down"
1720
+ },
1721
+ {
1722
+ Name: "Left",
1723
+ Task: "LEFT",
1724
+ VKCode: "37",
1725
+ ScanCode: "75",
1726
+ Flag: "1",
1727
+ Hid: "0x50",
1728
+ Value: "Left"
1729
+ },
1730
+ {
1731
+ Name: "Right",
1732
+ Task: "Right",
1733
+ VKCode: "39",
1734
+ ScanCode: "77",
1735
+ Flag: "1",
1736
+ Hid: "0x4F",
1737
+ Value: "Right"
1738
+ },
1739
+ {
1740
+ Name: "MUTE",
1741
+ Task: "MUTE",
1742
+ VKCode: "7F",
1743
+ Hid: "0x7F",
1744
+ Value: "MUTE"
1745
+ },
1746
+ {
1747
+ Name: "CALC",
1748
+ Task: "CALC",
1749
+ VKCode: "7F",
1750
+ Hid: "0x92",
1751
+ Value: "CALC"
1752
+ },
1753
+ {
1754
+ Name: "VOICE +",
1755
+ Task: "VOICE +",
1756
+ VKCode: "7F",
1757
+ Hid: "0x80",
1758
+ Value: "VOICE +"
1759
+ },
1760
+ {
1761
+ Name: "VOICE ",
1762
+ Task: "VOICE ",
1763
+ VKCode: "7F",
1764
+ Hid: "0x81",
1765
+ Value: "VOICE "
1766
+ },
1767
+ {
1768
+ Name: "FN",
1769
+ Task: "FN",
1770
+ VKCode: "91",
1771
+ Hid: "0x01",
1772
+ Value: "FN"
1773
+ },
1774
+ {
1775
+ Name: "FN2",
1776
+ Task: "FN2",
1777
+ VKCode: "91",
1778
+ Hid: "0x02",
1779
+ Value: "FN2"
1780
+ },
1781
+ {
1782
+ Name: "FN3",
1783
+ Task: "FN3",
1784
+ VKCode: "91",
1785
+ Hid: "0x03",
1786
+ Value: "FN3"
1787
+ }
1788
+ ] }, n = {
1789
+ protocolVer: 1,
1790
+ lastBinVer: -1,
1791
+ curDeviceMode: null,
1792
+ curDeviceHandle: null,
1793
+ curWebHandle: null,
1794
+ manualUrl: "",
1795
+ ConnectMode: 0,
1796
+ Battery: 0,
1797
+ Ischarge: 0,
1798
+ kaleidoscope: 0,
1799
+ FirmwareID: -1,
1800
+ FirmwareVer: -1,
1801
+ FirmwareNum: -1,
1802
+ FirmwareFull: -1,
1803
+ RunMode: -1,
1804
+ SN: -1,
1805
+ SNDatas: -1,
1806
+ SignDatas: -1,
1807
+ SignSN: -1,
1808
+ SignCRC: -1,
1809
+ ProfileIndex: 0,
1810
+ curWebSite: "",
1811
+ reteVal: 0,
1812
+ lodVal: 0,
1813
+ macStatus: 0,
1814
+ winKeyStatus: 0,
1815
+ FirstFlag: -1,
1816
+ SerialNumber: -1,
1817
+ modeLigth: 1,
1818
+ modeChildLigth: 1,
1819
+ brightnessLigth: 1,
1820
+ speedLigth: 1,
1821
+ sleep: 2,
1822
+ modeLigthLogo: -1,
1823
+ modeChildLigthLogo: 0,
1824
+ brightnessLigthLogo: 0,
1825
+ speedLigthLogo: 0,
1826
+ sleepLogo: 0,
1827
+ journey_global: 2,
1828
+ rt_all_journey: 0,
1829
+ curMaxJourney: 0,
1830
+ curMaxJourneyKeyStatus: 0,
1831
+ keyMapStructure: {
1832
+ index: -1,
1833
+ key_name: "",
1834
+ name: "",
1835
+ hid: 0,
1836
+ axisSet: {
1837
+ brand: "",
1838
+ name: "",
1839
+ model: ""
1840
+ },
1841
+ journey: 0,
1842
+ adc_data: 0,
1843
+ key_status: 0,
1844
+ fn: 0,
1845
+ fn_custom: {
1846
+ fn_code: "",
1847
+ type: "",
1848
+ name: "",
1849
+ content: ""
1850
+ },
1851
+ is_set: 1,
1852
+ custom: {
1853
+ type: "",
1854
+ name: "",
1855
+ content: ""
1856
+ },
1857
+ journey_RT: {
1858
+ down: "-",
1859
+ up: "-"
1860
+ },
1861
+ journey_global: "-",
1862
+ safe_zone_top: "-",
1863
+ safe_zone_bottom: "-",
1864
+ journey_trigger: "-",
1865
+ select: 0,
1866
+ working_mode: 0,
1867
+ axis: 0,
1868
+ routeAxis: 0,
1869
+ ARGB: 0,
1870
+ RGB: "#ffffff"
1871
+ },
1872
+ DPIS: [],
1873
+ MatrixList: {
1874
+ MatrixKey: [],
1875
+ MatrixADCTemp: [],
1876
+ MatrixADC: [],
1877
+ MatrixJourneyTemp: [],
1878
+ MatrixJourney: [],
1879
+ MatrixLayout0Temp: [],
1880
+ MatrixLayout0: [],
1881
+ MatrixLayout1Temp: [],
1882
+ MatrixLayout1: [],
1883
+ MatrixLayout4Temp: [],
1884
+ MatrixLayout4: [],
1885
+ MatrixLayout14Temp: [],
1886
+ MatrixLayout14: [],
1887
+ MatrixLayout15Temp: [],
1888
+ MatrixLayout15: [],
1889
+ MatrixLayout16Temp: [],
1890
+ MatrixLayout16: [],
1891
+ MatrixLayout17Temp: [],
1892
+ MatrixLayout17: [],
1893
+ MatrixLayout19Temp: [],
1894
+ MatrixLayout19: [],
1895
+ MatrixLayout8Temp: [],
1896
+ MatrixLayout8: [],
1897
+ MatrixKeyStatus: [],
1898
+ KeyMap: []
1899
+ },
1900
+ keyMapIndexByHid: null,
1901
+ ListenID: -1,
1902
+ typeMatrixID: -1,
1903
+ typeMatrixPageID: -1,
1904
+ inPage: 0,
1905
+ log(e, t) {
1906
+ let n = /* @__PURE__ */ new Date(), r = `[${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, "0")}-${String(n.getDate()).padStart(2, "0")} ${String(n.getHours()).padStart(2, "0")}:${String(n.getMinutes()).padStart(2, "0")}:${String(n.getSeconds()).padStart(2, "0")} ${String(n.getMilliseconds()).padStart(3, "0")}]`, i = "", a = "";
1907
+ switch (e) {
1908
+ case 0:
1909
+ i = "LOG", a = "color: blue;";
1910
+ break;
1911
+ case 1:
1912
+ i = "SUCCESS", a = "color: green;";
1913
+ break;
1914
+ case 2:
1915
+ i = "WARNING", a = "color: orange;";
1916
+ break;
1917
+ case 3:
1918
+ i = "ERROR", a = "color: red; font-weight: bold;";
1919
+ break;
1920
+ default:
1921
+ i = "LOG", a = "";
1922
+ break;
1923
+ }
1924
+ console.log(`%c${r} [${i}] ${t}`, a);
1925
+ },
1926
+ unpack(e) {
1927
+ let t = [];
1928
+ for (let n = 0; n < e.length; n += 10) t.push(e.slice(n, n + 10));
1929
+ return t;
1930
+ },
1931
+ padTo512(e) {
1932
+ let t = e.length, n = Math.ceil(t / 65536) * 65536, r = new Uint8Array(n);
1933
+ r.set(e);
1934
+ for (let e = t; e < n; e++) r[e] = 255;
1935
+ return r;
1936
+ },
1937
+ padToPackage540(e) {
1938
+ let t = e.length, n = Math.ceil(t / 540) * 540, r = new Uint8Array(n);
1939
+ r.set(e);
1940
+ for (let e = t; e < n; e++) r[e] = 255;
1941
+ return r;
1942
+ },
1943
+ getHighLowBits32(e) {
1944
+ let t = (e & 4294901760) >> 16, n = e & 65535;
1945
+ if (e >= 0 && e <= 4294967295) {
1946
+ let e = [
1947
+ n & 255,
1948
+ n >> 8,
1949
+ t & 255,
1950
+ t >> 8
1951
+ ];
1952
+ return e[0] = e[0].toString(16), e[1] = e[1].toString(16), e[2] = e[2].toString(16), e[3] = e[3].toString(16), e;
1953
+ } else throw Error("The decimal number must be between 0 and 65535.");
1954
+ },
1955
+ getGifBufferCommand(e, t) {
1956
+ let n = t.SET_DEVICE_WRITE_IMAGE_START_CMD, r = [];
1957
+ for (let t = 0; t < e.length; t += 512) {
1958
+ let i = e.slice(t, t + 512);
1959
+ i = this.padToPackage540(i);
1960
+ for (let e = 0; e < i.length; e += 54) {
1961
+ let t = i.slice(e, e + 54), a = this.mergeUint8Arrays([n, t]), o = a[a.length - 1], s = this.getCRC1(a[1], a[2], o);
1962
+ s = this.getHighLowBits(s), a[3] = parseInt(s[0], 16), r.push(a);
1963
+ }
1964
+ }
1965
+ return this.unpack(r);
1966
+ },
1967
+ redMatrix(e) {
1968
+ let t = new Uint8Array(e.READ_DEFKEY_MATRIX_CMD.ROW1_ROW2.map((e) => parseInt(e, 16)));
1969
+ this.curDeviceHandle.sendReport(0, t), setTimeout(() => {
1970
+ let t = new Uint8Array(e.READ_DEFKEY_MATRIX_CMD.ROW3_ROW4.map((e) => parseInt(e, 16)));
1971
+ this.curDeviceHandle.sendReport(0, t);
1972
+ }, 500), setTimeout(() => {
1973
+ let t = new Uint8Array(e.READ_DEFKEY_MATRIX_CMD.ROW5_ROW6.map((e) => parseInt(e, 16)));
1974
+ this.curDeviceHandle.sendReport(0, t);
1975
+ }, 1e3);
1976
+ },
1977
+ sendHidDataCallBack() {
1978
+ this.curWebHandle.refreshHIDeviceData();
1979
+ },
1980
+ getCRC(e, t, n) {
1981
+ return 145 + parseInt(e, 16) + parseInt(t, 16) + parseInt(n, 16);
1982
+ },
1983
+ getCRC1(e, t, n) {
1984
+ return 187 + e + t + n;
1985
+ },
1986
+ getWorkingMode(e, t) {
1987
+ switch (e &= 15, e) {
1988
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.DKS): return "DKS";
1989
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.SOCD): return "SOCD";
1990
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.MPT): return "MPT";
1991
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.MT): return "MT";
1992
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.END): return "END";
1993
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.TGL): return "TGL";
1994
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.RS): return "RS";
1995
+ }
1996
+ return "";
1997
+ },
1998
+ getBottonHidOJBFromName(e, t) {
1999
+ t = this.isNumber(parseInt(t)) ? "U" + t : t, t = t == "\\" ? "\\\\" : t, t = t == "=" ? "+" : t;
2000
+ let n = null, r = e.KEYMAP;
2001
+ for (var i in r) if (r[i].Value == t) {
2002
+ n = r[i];
2003
+ break;
2004
+ }
2005
+ return n ??= this.getBottonHidOJBFromTask(e, t), n;
2006
+ },
2007
+ getBottonHidOJBFromTask(e, t) {
2008
+ t = this.isNumber(parseInt(t)) ? "U" + t : t, t = t == "\\" ? "\\\\" : t, t = t == "=" ? "+" : t;
2009
+ let n = null, r = e.KEYMAP;
2010
+ for (var i in r) if (r[i].Task == t) {
2011
+ n = r[i];
2012
+ break;
2013
+ }
2014
+ return n ??= this.getBottonHidOJBFromName(e, t), n;
2015
+ },
2016
+ getBottonHidOJBFromHID(e, t) {
2017
+ let n = e.KEYMAP;
2018
+ for (var r in n) if (parseInt(n[r].Hid, 16) == t) return n[r];
2019
+ },
2020
+ getBottonHidOJBFromHIDMedia(e, t) {
2021
+ for (let n in e) for (let r in e[n]) if (t == e[n][r].code) return e[n][r];
2022
+ },
2023
+ startListeningNormal(e) {
2024
+ let t = this;
2025
+ this.ListenID = setInterval(function() {
2026
+ setTimeout(() => {
2027
+ let n = new Uint8Array(e.READ_RM6X21_HALL_16BIT_CMD.ROW1_ROW3.map((e) => parseInt(e, 16)));
2028
+ t.typeMatrixID = parseInt(e.READ_RM6X21_HALL_16BIT_CMD.ROW1_ROW3[4], 16), t.typeMatrixPageID = parseInt(e.READ_RM6X21_HALL_16BIT_CMD.ROW1_ROW3[5], 16), t.curDeviceHandle.sendReport(0, n);
2029
+ }, 1), setTimeout(() => {
2030
+ let n = new Uint8Array(e.READ_RM6X21_HALL_16BIT_CMD.ROW4_ROW6.map((e) => parseInt(e, 16)));
2031
+ t.typeMatrixID = parseInt(e.READ_RM6X21_HALL_16BIT_CMD.ROW4_ROW6[4], 16), t.typeMatrixPageID = parseInt(e.READ_RM6X21_HALL_16BIT_CMD.ROW4_ROW6[5], 16), t.curDeviceHandle.sendReport(0, n);
2032
+ }, 10), setTimeout(() => {
2033
+ let n = new Uint8Array(e.READ_RM6X21_ADC_16BIT_CMD.ROW1_ROW3.map((e) => parseInt(e, 16)));
2034
+ t.typeMatrixID = parseInt(e.READ_RM6X21_ADC_16BIT_CMD.ROW1_ROW3[4], 16), t.typeMatrixPageID = parseInt(e.READ_RM6X21_ADC_16BIT_CMD.ROW1_ROW3[5], 16), t.curDeviceHandle.sendReport(0, n);
2035
+ }, 20), setTimeout(() => {
2036
+ let n = new Uint8Array(e.READ_RM6X21_ADC_16BIT_CMD.ROW4_ROW6.map((e) => parseInt(e, 16)));
2037
+ t.typeMatrixID = parseInt(e.READ_RM6X21_ADC_16BIT_CMD.ROW4_ROW6[4], 16), t.typeMatrixPageID = parseInt(e.READ_RM6X21_ADC_16BIT_CMD.ROW4_ROW6[5], 16), t.curDeviceHandle.sendReport(0, n);
2038
+ }, 30), setTimeout(() => {
2039
+ let n = new Uint8Array(e.READ_RM6X21_KEYSTATUS_8BIT_CMD.map((e) => parseInt(e, 16)));
2040
+ t.typeMatrixID = parseInt(e.READ_RM6X21_KEYSTATUS_8BIT_CMD[4], 16), t.typeMatrixPageID = parseInt(e.READ_RM6X21_KEYSTATUS_8BIT_CMD[5], 16), t.curDeviceHandle.sendReport(0, n);
2041
+ }, 40);
2042
+ }, 60);
2043
+ },
2044
+ formatJourneyMapMatrix() {
2045
+ let e = 0;
2046
+ for (var t = 0; t < 6; t++) for (var n = 0; n < 21; n++) this.MatrixList.KeyMap[t][n].journey = this.MatrixList.MatrixJourney[e], this.MatrixList.KeyMap[t][n].adc_data = this.MatrixList.MatrixADC[e], this.MatrixList.KeyMap[t][n].key_status = this.MatrixList.MatrixKeyStatus[e], e++;
2047
+ },
2048
+ setARGBKey(e, t) {
2049
+ let n = this.toHexStringArr(e).slice(5, 61);
2050
+ if (!t.keyMapIndexByHid) {
2051
+ t.keyMapIndexByHid = {};
2052
+ for (let e = 0; e < t.MatrixList.KeyMap.length; e++) for (let n = 0; n < t.MatrixList.KeyMap[e].length; n++) {
2053
+ let r = t.MatrixList.KeyMap[e][n];
2054
+ t.keyMapIndexByHid[String(r.hid)] = {
2055
+ i: e,
2056
+ j: n
2057
+ };
2058
+ }
2059
+ }
2060
+ for (let e = 0; e < n.length; e += 4) {
2061
+ let r = n[e], i = t.keyMapIndexByHid[String(r)];
2062
+ if (!i) continue;
2063
+ let a = parseInt(n[e + 1], 16) + "," + parseInt(n[e + 2], 16) + "," + parseInt(n[e + 3], 16), o = "#" + n[e + 1].toString() + n[e + 2].toString() + n[e + 3].toString(), s = t.MatrixList.KeyMap[i.i][i.j];
2064
+ s.ARGB === a && s.RGB === o || (s.ARGB = a, s.RGB = o, s.lightStyle = "--bgcolor:" + o + ";--bgAcolor:rgb(" + a + ",0.1)");
2065
+ }
2066
+ },
2067
+ setMatrixJourneyHeadData(e, t) {
2068
+ let n = this.toHexStringArr(e);
2069
+ if (this.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_HALL_CODE) && this.typeMatrixPageID == 1) {
2070
+ let e = n.slice(6, 64);
2071
+ this.MatrixList.MatrixJourneyTemp = e, this.inPage = 1;
2072
+ } else if (this.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_HALL_CODE)) {
2073
+ let e = n.slice(6, 64);
2074
+ this.MatrixList.MatrixJourneyTemp.push.apply(this.MatrixList.MatrixJourneyTemp, e), this.inPage = 1;
2075
+ } else if (this.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_ORIGINAL_CODE) && this.typeMatrixPageID == 1) {
2076
+ let e = n.slice(6, 64);
2077
+ this.MatrixList.MatrixADCTemp = e, this.inPage = 1;
2078
+ } else if (this.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_ORIGINAL_CODE)) {
2079
+ let e = n.slice(6, 64);
2080
+ this.MatrixList.MatrixADCTemp.push.apply(this.MatrixList.MatrixADCTemp, e), this.inPage = 1;
2081
+ } else if (this.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.KEY_STATUS_CODE)) {
2082
+ this.inPage = 1, this.formatJourney(), this.formatJourneyMapMatrix(), this.sendHidDataCallBack(), this.curMaxJourneyKeyStatus = 0;
2083
+ let e = n.slice(6, 64);
2084
+ this.MatrixList.MatrixKeyStatus = e;
2085
+ }
2086
+ },
2087
+ setMatrixJourneyNOHeadData(e, t) {
2088
+ if (this.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_HALL_CODE)) {
2089
+ this.inPage++;
2090
+ let t = this.toHexStringArr(e), n = this.inPage == 3 ? 4 : 64, r = t.slice(0, n);
2091
+ this.MatrixList.MatrixJourneyTemp.push.apply(this.MatrixList.MatrixJourneyTemp, r);
2092
+ } else if (this.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_ORIGINAL_CODE)) {
2093
+ this.inPage++;
2094
+ let t = this.toHexStringArr(e), n = this.inPage == 3 ? 4 : 64, r = t.slice(0, n);
2095
+ this.MatrixList.MatrixADCTemp.push.apply(this.MatrixList.MatrixADCTemp, r);
2096
+ } else if (this.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.KEY_STATUS_CODE)) {
2097
+ this.inPage++;
2098
+ let t = this.toHexStringArr(e), n = this.inPage == 3 ? 4 : 64, r = t.slice(0, n);
2099
+ this.MatrixList.MatrixKeyStatus.push.apply(this.MatrixList.MatrixKeyStatus, r);
2100
+ }
2101
+ },
2102
+ formatJourney() {
2103
+ this.MatrixList.MatrixJourney = [], this.MatrixList.MatrixJourneyTemp = this.MatrixList.MatrixJourneyTemp.slice(0, 252);
2104
+ for (var e = 0; e < this.MatrixList.MatrixJourneyTemp.length; e++) if (e % 2 == 0) {
2105
+ var t = parseInt(this.MatrixList.MatrixJourneyTemp[e + 1], 16);
2106
+ t = (t & 255) << 8 | (t & 65280) >> 8;
2107
+ var n = t + parseInt(this.MatrixList.MatrixJourneyTemp[e], 16);
2108
+ this.MatrixList.MatrixJourney.push(n);
2109
+ }
2110
+ this.MatrixList.MatrixADC = [], this.MatrixList.MatrixADCTemp = this.MatrixList.MatrixADCTemp.slice(0, 252);
2111
+ for (var e = 0; e < this.MatrixList.MatrixADCTemp.length; e++) if (e % 2 == 0) {
2112
+ var t = parseInt(this.MatrixList.MatrixADCTemp[e + 1], 16);
2113
+ t = (t & 255) << 8 | (t & 65280) >> 8;
2114
+ var n = t + parseInt(this.MatrixList.MatrixADCTemp[e], 16);
2115
+ this.MatrixList.MatrixADC.push(n);
2116
+ }
2117
+ for (var e in this.MatrixList.MatrixKeyStatus) this.MatrixList.MatrixKeyStatus[e] = parseInt(this.MatrixList.MatrixKeyStatus[e], 16);
2118
+ this.curMaxJourneyKeyStatus = this.getMaxValue(this.MatrixList.MatrixKeyStatus), this.curMaxJourney = this.getMaxValue(this.MatrixList.MatrixJourney), this.curMaxJourney /= 1e3;
2119
+ },
2120
+ setGlobalJourneyData(e, t) {
2121
+ let n = this.toHexStringArr(e);
2122
+ var r = parseInt(n[8], 16);
2123
+ r = (r & 255) << 8 | (r & 65280) >> 8, t.journey_global = (r + parseInt(n[7], 16)) / 1e3;
2124
+ },
2125
+ setGlobalLigthData(e, t) {
2126
+ let n = this.toHexStringArr(e);
2127
+ t.modeLigth = n[43], t.modeChildLigth = n[41], t.brightnessLigth = n[42], t.speedLigth = n[44], t.sleep = n[45];
2128
+ },
2129
+ setGlobalLigthLogoData(e, t) {
2130
+ let n = this.toHexStringArr(e);
2131
+ t.modeLigthLogo = n[43], t.modeChildLigthLogo = n[41], t.brightnessLigthLogo = n[42], t.speedLigthLogo = n[44], t.sleepLogo = n[45];
2132
+ },
2133
+ getDGVal(e, t) {
2134
+ var n = parseInt(t, 16);
2135
+ return n = (n & 255) << 8 | (n & 65280) >> 8, n + parseInt(e, 16);
2136
+ },
2137
+ setAdvancedFuncData(e, t, n, r) {
2138
+ let i = n.MatrixList.KeyMap, a = function(e, t, r) {
2139
+ for (let a in i) for (let o in i[a]) i[a][o].name == e && (n.MatrixList.KeyMap[a][o].custom.type = t, n.MatrixList.KeyMap[a][o].custom.content = r);
2140
+ }, o = this.toHexStringArr(e);
2141
+ switch (parseInt(o[2], 16)) {
2142
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.SOCD):
2143
+ {
2144
+ let e = this.getBottonHidOJBFromHID(r, parseInt(o[5], 16)), t = this.getBottonHidOJBFromHID(r, parseInt(o[6], 16)), n = e.Value + "|" + t.Value;
2145
+ a(e.Value, "SOCD", n);
2146
+ }
2147
+ break;
2148
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.DKS):
2149
+ {
2150
+ let e = this.getBottonHidOJBFromHID(r, parseInt(o[5], 16)), t = this.getBottonHidOJBFromHID(r, parseInt(o[6], 16)), n = this.getBottonHidOJBFromHID(r, parseInt(o[8], 16)), i = this.getBottonHidOJBFromHID(r, parseInt(o[10], 16)), s = this.getBottonHidOJBFromHID(r, parseInt(o[12], 16));
2151
+ o[10], o[11], o[12], o[13];
2152
+ let c = e.Value + "," + t.Value + "|" + n.Value + "|" + i.Value + "|" + s.Value;
2153
+ a(e.Name, "DKS", c);
2154
+ }
2155
+ break;
2156
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.MPT):
2157
+ {
2158
+ let e = this.getBottonHidOJBFromHID(r, parseInt(o[5], 16)), t = this.getBottonHidOJBFromHID(r, parseInt(o[6], 16)), n = this.getBottonHidOJBFromHID(r, parseInt(o[8], 16)), i = this.getBottonHidOJBFromHID(r, parseInt(o[10], 16));
2159
+ var s = this.getDGVal(o[12], o[13]) / 1e3, c = this.getDGVal(o[14], o[15]) / 1e3, l = this.getDGVal(o[16], o[17]) / 1e3;
2160
+ let u = e.Value + "|" + t.Value + "|" + s + "|" + n.Value + "|" + c + "|" + i.Value + "|" + l;
2161
+ a(e.Name, "MPT", u);
2162
+ }
2163
+ break;
2164
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.MT):
2165
+ {
2166
+ let e = this.getBottonHidOJBFromHID(r, parseInt(o[5], 16)), t = this.getBottonHidOJBFromHID(r, parseInt(o[6], 16)), n = this.getBottonHidOJBFromHID(r, parseInt(o[8], 16)), i = e.Value + "|" + n.Value + "|" + t.Value;
2167
+ a(e.Name, "MT", i);
2168
+ }
2169
+ break;
2170
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.END):
2171
+ {
2172
+ let e = this.getBottonHidOJBFromHID(r, parseInt(o[5], 16)), t = this.getBottonHidOJBFromHID(r, parseInt(o[6], 16)), n = e.Value + "|" + t.Value;
2173
+ a(e.Name, "END", n);
2174
+ }
2175
+ break;
2176
+ case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.TGL):
2177
+ {
2178
+ let e = this.getBottonHidOJBFromHID(r, parseInt(o[5], 16)), t = this.getBottonHidOJBFromHID(r, parseInt(o[6], 16)), n = parseInt(o[8], 16) * 10, i = e.Value + "|" + t.Value + "|" + n;
2179
+ a(e.Name, "TGL", i);
2180
+ }
2181
+ break;
2182
+ }
2183
+ },
2184
+ getCurrentConfig(e) {
2185
+ let t = this.toHexStringArr(e);
2186
+ return parseInt(t[6], 16);
2187
+ },
2188
+ setGlobalFuncData(e, t, n) {
2189
+ let r = this.toHexStringArr(e);
2190
+ if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.MAC)) n.macStatus = parseInt(r[6], 16);
2191
+ else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.WIN_KEY_STATUS)) n.winKeyStatus = parseInt(r[6], 16);
2192
+ else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.RETE)) n.reteVal = parseInt(r[6], 16);
2193
+ else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.LOD)) n.lodVal = parseInt(r[6], 16);
2194
+ else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.SLEEP)) n.sleep = parseInt(r[6], 16);
2195
+ else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.DPI)) {
2196
+ var i = parseInt(r[9], 16);
2197
+ i = (i & 255) << 8 | (i & 65280) >> 8;
2198
+ var a = i + parseInt(r[8], 16), o = parseInt(r[12], 16);
2199
+ o = (o & 255) << 8 | (o & 65280) >> 8;
2200
+ var s = o + parseInt(r[11], 16);
2201
+ let e = {
2202
+ index: parseInt(r[6], 16),
2203
+ x: a,
2204
+ y: s,
2205
+ is_cur: parseInt(r[13], 16),
2206
+ is_activate: parseInt(r[14], 16)
2207
+ };
2208
+ n.DPIS.push(e);
2209
+ } else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.SITE)) {
2210
+ let t = new TextDecoder();
2211
+ n.curWebSite = this.trimSpaces(t.decode(e.slice(6, parseInt(r[1], 16) + 3)));
2212
+ } else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.FIRST_FLAG)) n.FirstFlag = parseInt(r[6], 16);
2213
+ else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.SERIAL_NUMBER)) {
2214
+ var c = parseInt(r[8], 16);
2215
+ c = (c & 255) << 8 | (c & 65280) >> 8;
2216
+ var l = c + parseInt(r[7], 16);
2217
+ l > 2e4 && (c = parseInt(r[7], 16), c = (c & 255) << 8 | (c & 65280) >> 8, l = c + parseInt(r[6], 16)), n.SerialNumber = l;
2218
+ } else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.PROFILE_INDEX)) n.ProfileIndex = parseInt(r[6], 16);
2219
+ else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.RT_ALL)) n.rt_all_journey = parseInt(r[6], 16);
2220
+ else if (parseInt(r[5], 16) == parseInt(t.RESPONSE_CODE.GLOBAL_BATTERY_CODE)) {
2221
+ let e = parseInt(r[6], 16), t = parseInt(r[7], 16);
2222
+ n.Battery = e, n.Ischarge = t;
2223
+ }
2224
+ },
2225
+ setUpgradeSignFuncData(e, t, n) {
2226
+ this.toHexStringArr(e);
2227
+ {
2228
+ let t = new TextDecoder();
2229
+ this.trimSpaces(t.decode(e.slice(7, 23))), this.trimSpaces(t.decode(e.slice(23, 39))), n.SignDatas = e.slice(7, 23), n.SignSN = e.slice(23, 39);
2230
+ }
2231
+ },
2232
+ setUpgradeCRCData(e, t, n) {
2233
+ n.SignCRC = e.slice(13, 15);
2234
+ },
2235
+ setMatrixLayoutData(e, t, n) {
2236
+ let r = this.toHexStringArr(e);
2237
+ if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.FN0) && n.typeMatrixPageID == 1) {
2238
+ let e = r.slice(5, 61);
2239
+ n.MatrixList.MatrixLayout0Temp = e;
2240
+ } else if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.FN0)) {
2241
+ let e = r.slice(5, 61);
2242
+ n.MatrixList.MatrixLayout0Temp.push.apply(n.MatrixList.MatrixLayout0Temp, e);
2243
+ }
2244
+ if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.FN1) && n.typeMatrixPageID == 1) {
2245
+ let e = r.slice(5, 61);
2246
+ n.MatrixList.MatrixLayout1Temp = e;
2247
+ } else if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.FN1)) {
2248
+ let e = r.slice(5, 61);
2249
+ n.MatrixList.MatrixLayout1Temp.push.apply(n.MatrixList.MatrixLayout1Temp, e);
2250
+ }
2251
+ if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.JOURNEY4) && n.typeMatrixPageID == 1) {
2252
+ let e = r.slice(5, 61);
2253
+ n.MatrixList.MatrixLayout4Temp = e;
2254
+ } else if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.JOURNEY4)) {
2255
+ let e = r.slice(5, 61);
2256
+ n.MatrixList.MatrixLayout4Temp.push.apply(n.MatrixList.MatrixLayout4Temp, e);
2257
+ }
2258
+ if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.RTDOWN14) && n.typeMatrixPageID == 1) {
2259
+ let e = r.slice(5, 61);
2260
+ n.MatrixList.MatrixLayout14Temp = e;
2261
+ } else if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.RTDOWN14)) {
2262
+ let e = r.slice(5, 61);
2263
+ n.MatrixList.MatrixLayout14Temp.push.apply(n.MatrixList.MatrixLayout14Temp, e);
2264
+ }
2265
+ if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.RTUP15) && n.typeMatrixPageID == 1) {
2266
+ let e = r.slice(5, 61);
2267
+ n.MatrixList.MatrixLayout15Temp = e;
2268
+ } else if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.RTUP15)) {
2269
+ let e = r.slice(5, 61);
2270
+ n.MatrixList.MatrixLayout15Temp.push.apply(n.MatrixList.MatrixLayout15Temp, e);
2271
+ }
2272
+ if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.SAFE16) && n.typeMatrixPageID == 1) {
2273
+ let e = r.slice(5, 61);
2274
+ n.MatrixList.MatrixLayout16Temp = e;
2275
+ } else if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.SAFE16)) {
2276
+ let e = r.slice(5, 61);
2277
+ n.MatrixList.MatrixLayout16Temp.push.apply(n.MatrixList.MatrixLayout16Temp, e);
2278
+ }
2279
+ if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.SAFE17) && n.typeMatrixPageID == 1) {
2280
+ let e = r.slice(5, 61);
2281
+ n.MatrixList.MatrixLayout17Temp = e;
2282
+ } else if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.SAFE17)) {
2283
+ let e = r.slice(5, 61);
2284
+ n.MatrixList.MatrixLayout17Temp.push.apply(n.MatrixList.MatrixLayout17Temp, e);
2285
+ }
2286
+ if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.AXIS19) && n.typeMatrixPageID == 1) {
2287
+ let e = r.slice(5, 61);
2288
+ n.MatrixList.MatrixLayout19Temp = e;
2289
+ } else if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.AXIS19)) {
2290
+ let e = r.slice(5, 61);
2291
+ n.MatrixList.MatrixLayout19Temp.push.apply(n.MatrixList.MatrixLayout19Temp, e);
2292
+ }
2293
+ if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.MODE) && n.typeMatrixPageID == 1) {
2294
+ let e = r.slice(5, 61);
2295
+ n.MatrixList.MatrixLayout8Temp = e;
2296
+ } else if (n.typeMatrixID == parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.MODE)) {
2297
+ let e = r.slice(5, 61);
2298
+ n.MatrixList.MatrixLayout8Temp.push.apply(n.MatrixList.MatrixLayout8Temp, e);
2299
+ }
2300
+ },
2301
+ formatLayout0(e, t, n, r) {
2302
+ this.MatrixList.MatrixLayout0 = [];
2303
+ for (var i = 0; i < this.MatrixList.MatrixLayout0Temp.length; i++) if (i % 4 == 0) {
2304
+ let r = this.MatrixList.MatrixLayout0Temp[i], a = parseInt(this.MatrixList.MatrixLayout0Temp[i + 2], 16), o = parseInt(this.MatrixList.MatrixLayout0Temp[i + 3], 16);
2305
+ o &= 240;
2306
+ let s = {
2307
+ hid: r,
2308
+ type: "",
2309
+ name: "",
2310
+ content: ""
2311
+ };
2312
+ if (a == parseInt(r, 16)) continue;
2313
+ switch (o) {
2314
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.KEY, 16):
2315
+ s.name = this.getBottonHidOJBFromHID(t, a).Name, s.type = s.name;
2316
+ break;
2317
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA1, 16):
2318
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA2, 16):
2319
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA3, 16):
2320
+ a = "0x" + this.MatrixList.MatrixLayout0Temp[i + 2].toString(16) + ",0x" + this.MatrixList.MatrixLayout0Temp[i + 3].toString(16), s.name = this.getBottonHidOJBFromHIDMedia(n, a).name, s.type = s.name;
2321
+ break;
2322
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.HOTKEY, 16):
2323
+ {
2324
+ a = "0x" + this.MatrixList.MatrixLayout0Temp[i + 2].toString(16) + ",0x" + this.MatrixList.MatrixLayout0Temp[i + 3].toString(16);
2325
+ let e = this.getBottonHidOJBFromHIDMedia(n, a);
2326
+ if (e) s.name = e.name, s.type = s.name;
2327
+ else {
2328
+ let e = a.split(","), n = this.getBottonHidOJBFromHID(t, e[0]);
2329
+ s.type = this.parseHotKeyCommand(parseInt(e[1], 16)) + n.Name;
2330
+ }
2331
+ }
2332
+ break;
2333
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MOUSE, 16):
2334
+ a = "0x" + this.MatrixList.MatrixLayout0Temp[i + 2].toString(16) + ",0x" + this.MatrixList.MatrixLayout0Temp[i + 3].toString(16), s.name = this.getBottonHidOJBFromHIDMedia(n, a).name, s.type = s.name;
2335
+ break;
2336
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.SYS, 16):
2337
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.SYS1, 16):
2338
+ {
2339
+ a = "0x" + this.MatrixList.MatrixLayout0Temp[i + 2].toString(16) + ",0x" + this.MatrixList.MatrixLayout0Temp[i + 3].toString(16);
2340
+ let e = this.getBottonHidOJBFromHIDMedia(n, a);
2341
+ e ? (s.name = e.name, s.type = s.name) : (console.log(a), s.type = "SYS");
2342
+ }
2343
+ break;
2344
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MACRO, 16):
2345
+ s.type = "MACRO";
2346
+ break;
2347
+ default:
2348
+ console.log(o), s.type = "FUNC";
2349
+ break;
2350
+ }
2351
+ this.MatrixList.MatrixLayout0.push(s);
2352
+ }
2353
+ let a = 0;
2354
+ for (var i = 0; i < 6; i++) for (var o = 0; o < 21; o++) {
2355
+ for (let e in this.MatrixList.MatrixLayout0) this.MatrixList.MatrixLayout0[e].type != "" && this.MatrixList.MatrixLayout0[e].hid == r.MatrixList.KeyMap[i][o].hid && (r.MatrixList.KeyMap[i][o].custom.name = this.MatrixList.MatrixLayout0[e].type, r.MatrixList.KeyMap[i][o].custom.type = this.MatrixList.MatrixLayout0[e].type);
2356
+ a++;
2357
+ }
2358
+ },
2359
+ formatLayout1(e, t, n, r) {
2360
+ this.MatrixList.MatrixLayout1 = [];
2361
+ for (var i = 0; i < this.MatrixList.MatrixLayout1Temp.length; i++) if (i % 4 == 0) {
2362
+ let r = this.MatrixList.MatrixLayout1Temp[i], a = parseInt(this.MatrixList.MatrixLayout1Temp[i + 2], 16), o = parseInt(this.MatrixList.MatrixLayout1Temp[i + 3], 16);
2363
+ o &= 240;
2364
+ let s = {
2365
+ hid: r,
2366
+ type: "",
2367
+ name: "",
2368
+ content: "",
2369
+ fn_code: "0x" + this.MatrixList.MatrixLayout1Temp[i + 2] + ",0x" + this.MatrixList.MatrixLayout1Temp[i + 3]
2370
+ };
2371
+ if (o == 0 && a == 1 || a == parseInt(r, 16)) continue;
2372
+ switch (o) {
2373
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.KEY, 16):
2374
+ s.name = this.getBottonHidOJBFromHID(t, a).Name, s.type = s.name;
2375
+ break;
2376
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA1, 16):
2377
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA2, 16):
2378
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA3, 16):
2379
+ a = "0x" + this.MatrixList.MatrixLayout1Temp[i + 2].toString(16) + ",0x" + this.MatrixList.MatrixLayout1Temp[i + 3].toString(16), s.name = this.getBottonHidOJBFromHIDMedia(n, a).name, s.type = s.name;
2380
+ break;
2381
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.HOTKEY, 16):
2382
+ {
2383
+ a = "0x" + this.MatrixList.MatrixLayout1Temp[i + 2].toString(16) + ",0x" + this.MatrixList.MatrixLayout1Temp[i + 3].toString(16);
2384
+ let e = this.getBottonHidOJBFromHIDMedia(n, a);
2385
+ if (e) s.name = e.name, s.type = s.name;
2386
+ else {
2387
+ let e = a.split(","), n = this.getBottonHidOJBFromHID(t, e[0]);
2388
+ s.type = this.parseHotKeyCommand(parseInt(e[1], 16)) + n.Name;
2389
+ }
2390
+ }
2391
+ break;
2392
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MOUSE, 16):
2393
+ a = "0x" + this.MatrixList.MatrixLayout1Temp[i + 2].toString(16) + ",0x" + this.MatrixList.MatrixLayout1Temp[i + 3].toString(16), s.name = this.getBottonHidOJBFromHIDMedia(n, a).name, s.type = s.name;
2394
+ break;
2395
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.SYS, 16):
2396
+ case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.SYS1, 16):
2397
+ {
2398
+ a = "0x" + this.MatrixList.MatrixLayout1Temp[i + 2].toString(16) + ",0x" + this.MatrixList.MatrixLayout1Temp[i + 3].toString(16);
2399
+ let e = this.getBottonHidOJBFromHIDMedia(n, a);
2400
+ e ? (s.name = e.name, s.type = s.name) : (console.log(a), s.type = "SYS");
2401
+ }
2402
+ break;
2403
+ default:
2404
+ console.log(o), s.type = "FUNC";
2405
+ break;
2406
+ }
2407
+ this.MatrixList.MatrixLayout1.push(s);
2408
+ }
2409
+ let a = 0;
2410
+ for (var i = 0; i < 6; i++) for (var o = 0; o < 21; o++) {
2411
+ for (let e in this.MatrixList.MatrixLayout1) this.MatrixList.MatrixLayout1[e].type != "" && this.MatrixList.MatrixLayout1[e].hid == r.MatrixList.KeyMap[i][o].hid && (r.MatrixList.KeyMap[i][o].fn_custom.fn_code = this.MatrixList.MatrixLayout1[e].fn_code, r.MatrixList.KeyMap[i][o].fn_custom.name = this.MatrixList.MatrixLayout1[e].type, r.MatrixList.KeyMap[i][o].fn_custom.type = this.MatrixList.MatrixLayout1[e].type);
2412
+ a++;
2413
+ }
2414
+ },
2415
+ formatLayout4(e) {
2416
+ this.MatrixList.MatrixLayout4 = [];
2417
+ for (var t = 0; t < this.MatrixList.MatrixLayout4Temp.length; t++) if (t % 4 == 0) {
2418
+ let e = this.MatrixList.MatrixLayout4Temp[t];
2419
+ var n = parseInt(this.MatrixList.MatrixLayout4Temp[t + 3], 16);
2420
+ n = (n & 255) << 8 | (n & 65280) >> 8;
2421
+ let r = {
2422
+ hid: e,
2423
+ journey: n + parseInt(this.MatrixList.MatrixLayout4Temp[t + 2], 16)
2424
+ };
2425
+ this.MatrixList.MatrixLayout4.push(r);
2426
+ }
2427
+ let r = 0;
2428
+ for (var t = 0; t < 6; t++) for (var i = 0; i < 21; i++) {
2429
+ for (let n in this.MatrixList.MatrixLayout4) this.MatrixList.MatrixLayout4[n].hid == e.MatrixList.KeyMap[t][i].hid && (e.MatrixList.KeyMap[t][i].journey_trigger = this.MatrixList.MatrixLayout4[n].journey / 1e3);
2430
+ r++;
2431
+ }
2432
+ },
2433
+ formatLayout8(e) {
2434
+ this.MatrixList.MatrixLayout8 = [];
2435
+ for (var t = 0; t < this.MatrixList.MatrixLayout8Temp.length; t++) if (t % 4 == 0) {
2436
+ let e = this.MatrixList.MatrixLayout8Temp[t];
2437
+ var n = parseInt(this.MatrixList.MatrixLayout8Temp[t + 3], 16);
2438
+ n = (n & 255) << 8 | (n & 65280) >> 8;
2439
+ let r = {
2440
+ hid: e,
2441
+ working_mode: n + parseInt(this.MatrixList.MatrixLayout8Temp[t + 2], 16)
2442
+ };
2443
+ this.MatrixList.MatrixLayout8.push(r);
2444
+ }
2445
+ let r = 0;
2446
+ for (var t = 0; t < 6; t++) for (var i = 0; i < 21; i++) {
2447
+ for (let n in this.MatrixList.MatrixLayout8) this.MatrixList.MatrixLayout8[n].hid == e.MatrixList.KeyMap[t][i].hid && (e.MatrixList.KeyMap[t][i].working_mode = this.MatrixList.MatrixLayout8[n].working_mode);
2448
+ r++;
2449
+ }
2450
+ },
2451
+ formatLayout14(e) {
2452
+ this.MatrixList.MatrixLayout14 = [];
2453
+ for (var t = 0; t < this.MatrixList.MatrixLayout14Temp.length; t++) if (t % 4 == 0) {
2454
+ let e = this.MatrixList.MatrixLayout14Temp[t];
2455
+ var n = parseInt(this.MatrixList.MatrixLayout14Temp[t + 3], 16);
2456
+ n = (n & 255) << 8 | (n & 65280) >> 8;
2457
+ let r = {
2458
+ hid: e,
2459
+ down: n + parseInt(this.MatrixList.MatrixLayout14Temp[t + 2], 16)
2460
+ };
2461
+ this.MatrixList.MatrixLayout14.push(r);
2462
+ }
2463
+ let r = 0;
2464
+ for (var t = 0; t < 6; t++) for (var i = 0; i < 21; i++) {
2465
+ for (let n in this.MatrixList.MatrixLayout14) this.MatrixList.MatrixLayout14[n].hid == e.MatrixList.KeyMap[t][i].hid && (e.MatrixList.KeyMap[t][i].journey_RT.down = this.MatrixList.MatrixLayout14[n].down / 1e3);
2466
+ r++;
2467
+ }
2468
+ },
2469
+ formatLayout15(e) {
2470
+ this.MatrixList.MatrixLayout15 = [];
2471
+ for (var t = 0; t < this.MatrixList.MatrixLayout15Temp.length; t++) if (t % 4 == 0) {
2472
+ let e = this.MatrixList.MatrixLayout15Temp[t];
2473
+ var n = parseInt(this.MatrixList.MatrixLayout15Temp[t + 3], 16);
2474
+ n = (n & 255) << 8 | (n & 65280) >> 8;
2475
+ let r = {
2476
+ hid: e,
2477
+ up: n + parseInt(this.MatrixList.MatrixLayout15Temp[t + 2], 16)
2478
+ };
2479
+ this.MatrixList.MatrixLayout15.push(r);
2480
+ }
2481
+ let r = 0;
2482
+ for (var t = 0; t < 6; t++) for (var i = 0; i < 21; i++) {
2483
+ for (let n in this.MatrixList.MatrixLayout15) this.MatrixList.MatrixLayout15[n].hid == e.MatrixList.KeyMap[t][i].hid && (e.MatrixList.KeyMap[t][i].journey_RT.up = this.MatrixList.MatrixLayout15[n].up / 1e3);
2484
+ r++;
2485
+ }
2486
+ },
2487
+ formatLayout16(e) {
2488
+ this.MatrixList.MatrixLayout16 = [];
2489
+ for (var t = 0; t < this.MatrixList.MatrixLayout16Temp.length; t++) if (t % 4 == 0) {
2490
+ let e = this.MatrixList.MatrixLayout16Temp[t];
2491
+ var n = parseInt(this.MatrixList.MatrixLayout16Temp[t + 3], 16);
2492
+ n = (n & 255) << 8 | (n & 65280) >> 8;
2493
+ let r = {
2494
+ hid: e,
2495
+ down: n + parseInt(this.MatrixList.MatrixLayout16Temp[t + 2], 16)
2496
+ };
2497
+ this.MatrixList.MatrixLayout16.push(r);
2498
+ }
2499
+ let r = 0;
2500
+ for (var t = 0; t < 6; t++) for (var i = 0; i < 21; i++) {
2501
+ for (let n in this.MatrixList.MatrixLayout16) this.MatrixList.MatrixLayout16[n].hid == e.MatrixList.KeyMap[t][i].hid && (e.MatrixList.KeyMap[t][i].safe_zone_top = this.MatrixList.MatrixLayout16[n].down / 1e3);
2502
+ r++;
2503
+ }
2504
+ },
2505
+ formatLayout17(e) {
2506
+ this.MatrixList.MatrixLayout17 = [];
2507
+ for (var t = 0; t < this.MatrixList.MatrixLayout17Temp.length; t++) if (t % 4 == 0) {
2508
+ let e = this.MatrixList.MatrixLayout17Temp[t];
2509
+ var n = parseInt(this.MatrixList.MatrixLayout17Temp[t + 3], 16);
2510
+ n = (n & 255) << 8 | (n & 65280) >> 8;
2511
+ let r = {
2512
+ hid: e,
2513
+ up: n + parseInt(this.MatrixList.MatrixLayout17Temp[t + 2], 16)
2514
+ };
2515
+ this.MatrixList.MatrixLayout17.push(r);
2516
+ }
2517
+ let r = 0;
2518
+ for (var t = 0; t < 6; t++) for (var i = 0; i < 21; i++) {
2519
+ for (let n in this.MatrixList.MatrixLayout17) this.MatrixList.MatrixLayout17[n].hid == e.MatrixList.KeyMap[t][i].hid && (e.MatrixList.KeyMap[t][i].safe_zone_bottom = this.MatrixList.MatrixLayout17[n].up / 1e3);
2520
+ r++;
2521
+ }
2522
+ },
2523
+ formatLayout19(e) {
2524
+ this.MatrixList.MatrixLayout19 = [];
2525
+ for (var t = 0; t < this.MatrixList.MatrixLayout19Temp.length; t++) if (t % 4 == 0) {
2526
+ let e = this.MatrixList.MatrixLayout19Temp[t];
2527
+ var n = parseInt(this.MatrixList.MatrixLayout19Temp[t + 3], 16), r = parseInt(this.MatrixList.MatrixLayout19Temp[t + 3], 16);
2528
+ r = (r & 255) << 8 | (r & 65280) >> 8;
2529
+ let i = {
2530
+ hid: e,
2531
+ axis: parseInt(this.MatrixList.MatrixLayout19Temp[t + 2], 16),
2532
+ routeAxis: n
2533
+ };
2534
+ this.MatrixList.MatrixLayout19.push(i);
2535
+ }
2536
+ let i = 0;
2537
+ for (var t = 0; t < 6; t++) for (var a = 0; a < 21; a++) {
2538
+ for (let n in this.MatrixList.MatrixLayout19) this.MatrixList.MatrixLayout19[n].hid == e.MatrixList.KeyMap[t][a].hid && (e.MatrixList.KeyMap[t][a].axis = this.MatrixList.MatrixLayout19[n].axis, e.MatrixList.KeyMap[t][a].routeAxis = this.MatrixList.MatrixLayout19[n].routeAxis);
2539
+ i++;
2540
+ }
2541
+ },
2542
+ getMaxValue(e) {
2543
+ return e.reduce((e, t) => t > e ? t : e, e[0]);
2544
+ },
2545
+ getDeviceInfo(e) {
2546
+ let t = new TextDecoder();
2547
+ this.toHexString(e);
2548
+ let n = parseInt(this.toHexString(Array.from(e.slice(5, 9)).reverse()), 16), r = parseInt(this.toHexString(e.slice(10, 11)), 16), i = parseInt(this.toHexString(e.slice(11, 12)), 16), a = this.trimSpaces(t.decode(e.slice(13, 29)), 16);
2549
+ var o = this.trimSpaces(t.decode(e.slice(30, 42)));
2550
+ o = o.split(".").pop();
2551
+ let s = parseInt(this.toHexString(e.slice(46, 47)), 16), c = this.toHexString(e.slice(59, 63));
2552
+ return this.ConnectMode = s, this.FirmwareID = n, this.FirmwareNum = o, this.RunMode = i, this.SN = a, this.SNDatas = e.slice(13, 29), {
2553
+ BoardID: n,
2554
+ FWsize: r,
2555
+ RunMode: i,
2556
+ SN: a,
2557
+ Version: o,
2558
+ ConnectMode: s,
2559
+ CheckNum: c
2560
+ };
2561
+ },
2562
+ getADCData(e, t) {},
2563
+ getSetPRGBCmd(e) {
2564
+ return e;
2565
+ },
2566
+ mergeUint8Arrays(e) {
2567
+ let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
2568
+ return e.forEach((e) => {
2569
+ n.set(e, r), r += e.length;
2570
+ }), n;
2571
+ },
2572
+ toHexString(e) {
2573
+ return e.reduce((e, t) => e + t.toString(16).padStart(2, "0"), "");
2574
+ },
2575
+ toHexStringArr(e) {
2576
+ return e.reduce((e, t) => e + t.toString(16).padStart(2, "0"), "").match(/.{1,2}/g);
2577
+ },
2578
+ fromHexString(e) {
2579
+ return new Uint8Array(e.toString().match(/.{1,2}/g).map((e) => parseInt(e, 16)));
2580
+ },
2581
+ trimSpaces(e) {
2582
+ return e = e.replace(/\u0000/g, ""), e = e.replace(/\u0010/g, ""), e = e.replace(/\r/g, ""), e = e.replace(/\n/g, ""), e;
2583
+ },
2584
+ getHighLowBits(e) {
2585
+ if (e >= 0 && e <= 65535) {
2586
+ let t = [e & 255, e >> 8];
2587
+ return t[0] = t[0].toString(16), t[1] = t[1].toString(16), t;
2588
+ } else throw Error("The decimal number must be between 0 and 65535.");
2589
+ },
2590
+ startCalibrate(e) {
2591
+ e.SET_DEVICE_FUNCTION_OP_CMD[4] = "0x0C";
2592
+ let t = new Uint8Array(e.SET_DEVICE_FUNCTION_OP_CMD.map((e) => parseInt(e, 16)));
2593
+ this.curDeviceHandle.sendReport(0, t), setTimeout(() => {
2594
+ this.startListeningNormal(e);
2595
+ }, 100);
2596
+ },
2597
+ stopCalibrate(e) {
2598
+ this.stopListening(), setTimeout(() => {
2599
+ e.SET_DEVICE_FUNCTION_OP_CMD[4] = "0x0D";
2600
+ let t = new Uint8Array(e.SET_DEVICE_FUNCTION_OP_CMD.map((e) => parseInt(e, 16)));
2601
+ this.curDeviceHandle.sendReport(0, t);
2602
+ }, 1e3);
2603
+ },
2604
+ isNumber(e) {
2605
+ return typeof e == "number" && !isNaN(e);
2606
+ },
2607
+ parseHotKeyCommand(e) {
2608
+ let t = [
2609
+ {
2610
+ Name: "Ctrl",
2611
+ Hid: "0x01"
2612
+ },
2613
+ {
2614
+ Name: "Shift",
2615
+ Hid: "0x02"
2616
+ },
2617
+ {
2618
+ Name: "Alt",
2619
+ Hid: "0x04"
2620
+ },
2621
+ {
2622
+ Name: "Win",
2623
+ Hid: "0x08"
2624
+ }
2625
+ ], n = "", r = e & 15;
2626
+ for (var i = 0; i < t.length; i++) r & parseInt(t[i].Hid, 16) && (n += t[i].Name + "+");
2627
+ return n;
2628
+ },
2629
+ getHotKeyCommand(e, t) {
2630
+ let n = {
2631
+ modifier: 0,
2632
+ key: 0
2633
+ }, r = function(e) {
2634
+ let t = [
2635
+ {
2636
+ Name: "Ctrl",
2637
+ Hid: "0x01"
2638
+ },
2639
+ {
2640
+ Name: "Shift",
2641
+ Hid: "0x02"
2642
+ },
2643
+ {
2644
+ Name: "Alt",
2645
+ Hid: "0x04"
2646
+ },
2647
+ {
2648
+ Name: "Win",
2649
+ Hid: "0x08"
2650
+ },
2651
+ {
2652
+ Name: "LCTRL",
2653
+ Hid: "0x01"
2654
+ },
2655
+ {
2656
+ Name: "LSHIFT",
2657
+ Hid: "0x02"
2658
+ },
2659
+ {
2660
+ Name: "RCTRL",
2661
+ Hid: "0x01"
2662
+ },
2663
+ {
2664
+ Name: "RSHIFT",
2665
+ Hid: "0x02"
2666
+ }
2667
+ ];
2668
+ for (var n = 0; n < t.length; n++) if (t[n].Name == e) return t[n];
2669
+ return !1;
2670
+ }, i = t.split("+"), a = 0;
2671
+ for (let e = 0; e < i.length; e++) {
2672
+ let t = r(i[e]);
2673
+ t && (t.Hid = parseInt(t.Hid, 16), a = a == 0 ? t.Hid : a |= t.Hid);
2674
+ }
2675
+ let o = i[i.length - 1], s = this.getBottonHidOJBFromName(e, o);
2676
+ return a = a |= 96, n.modifier = a.toString(16), n.key = s.Hid, n;
2677
+ },
2678
+ getMacroCommand(e, t, n, r, i, a, o) {
2679
+ let s = this, c = function(e) {
2680
+ let t = n.KEYMAP;
2681
+ for (var r in t) if (t[r].VKCode == e) return t[r].Hid;
2682
+ }, l = function(e) {
2683
+ switch (e.type) {
2684
+ case "keydown":
2685
+ {
2686
+ let n = c(e.keyCode), r = t.MACRO_TYPE_CMD.KEY_DOWN;
2687
+ return r[1] = n, r;
2688
+ }
2689
+ break;
2690
+ case "keyup":
2691
+ {
2692
+ let n = c(e.keyCode), r = t.MACRO_TYPE_CMD.KEY_UP;
2693
+ return r[1] = n, r;
2694
+ }
2695
+ break;
2696
+ case "mousedown":
2697
+ {
2698
+ let n = t.MACRO_TYPE_CMD.KEY_DOWN;
2699
+ return n[1] = e.keyCode.toString(16), n;
2700
+ }
2701
+ break;
2702
+ case "mouseup":
2703
+ {
2704
+ let n = t.MACRO_TYPE_CMD.KEY_UP;
2705
+ return n[1] = e.keyCode.toString(16), n;
2706
+ }
2707
+ break;
2708
+ case "time":
2709
+ {
2710
+ let n = s.getHighLowBits(e.keyCode), r = t.MACRO_TYPE_CMD.DELAY;
2711
+ return r[1] = n[0], r[2] = n[1], r;
2712
+ }
2713
+ break;
2714
+ }
2715
+ }, u = [];
2716
+ for (let e = 0; e < r.length; e++) {
2717
+ let t = l(r[e]);
2718
+ u.push(...t);
2719
+ }
2720
+ u.unshift(o.toString(16)), u.unshift(a.toString(16)), u.unshift(i.toString(16));
2721
+ let d = function(e, t) {
2722
+ let n = [];
2723
+ for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
2724
+ return n;
2725
+ }, f = t.SET_DEVICE_FUNCTION_MACRO_CMD;
2726
+ f[5] = e.toString(16), f[6] = (r.length * 3 + 3).toString(16), f[7] = "0x00";
2727
+ let p = d(u, 56);
2728
+ for (let e in p) {
2729
+ e == p.length - 1 && (f[7] = "0x01"), p[e] = f.concat(p[e]), p[e][1] = (p[e].length - 4).toString(16);
2730
+ let t = p[e][p[e].length - 1];
2731
+ p[e][3] = this.getCRC(p[e][1], p[e][2], t), p[e][3] = p[e][3].toString(16);
2732
+ }
2733
+ return p;
2734
+ },
2735
+ chunkArray(e, t) {
2736
+ let n = [];
2737
+ for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
2738
+ return n;
2739
+ },
2740
+ getButtonJourneyCommand(e, t, n) {
2741
+ let r = t * 1e3;
2742
+ r = this.getHighLowBits(r);
2743
+ let i = n.SET_DEVICE_BUTTON_JOURNEY_CMD, a = [];
2744
+ e.forEach(function(e) {
2745
+ i[0] = e.getAttribute("hid"), i[2] = r[0], i[3] = r[1], a.push(...i);
2746
+ }), a = this.chunkArray(a, 8);
2747
+ let o = n.SET_DEVICE_BUTTON_OP_HEAD, s = [], c = [];
2748
+ for (let e = 0; e < a.length; e++) if (e != 0 && e % 6 == 0 || e == a.length - 1) {
2749
+ c.push(...a[e]), c = o.concat(c);
2750
+ let t = c.length - 4 == parseInt(o[1], 16) ? c[c.length - 1] : 0;
2751
+ c[3] = this.getCRC(o[1], o[2], t), c[3] = c[3].toString(16), s.push(c), c = [];
2752
+ } else c.push(...a[e]);
2753
+ return s;
2754
+ },
2755
+ getButtonRestJourneyCommand(e, t) {
2756
+ let n = t.SET_RESET_BUTTON_JOURNEY_CMD, r = [];
2757
+ e.forEach(function(e) {
2758
+ let t = e.getAttribute("hid"), i = e.getAttribute("working_mode");
2759
+ if (i == null) {
2760
+ console.log(e.getAttribute("name")), console.log(i);
2761
+ return;
2762
+ }
2763
+ let a = parseInt(i);
2764
+ console.log(a.toString(16)), n[0] = t, n[2] = a.toString(16), n[4] = t, r.push(...n);
2765
+ }), r = this.chunkArray(r, 8);
2766
+ let i = t.SET_DEVICE_BUTTON_OP_HEAD, a = [], o = [];
2767
+ for (let e = 0; e < r.length; e++) if (e != 0 && e % 6 == 0 || e == r.length - 1) {
2768
+ o.push(...r[e]), o = i.concat(o);
2769
+ let t = o.length - 4 == parseInt(i[1], 16) ? o[o.length - 1] : 0;
2770
+ o[3] = this.getCRC(i[1], i[2], t), o[3] = o[3].toString(16), a.push(o), o = [];
2771
+ } else o.push(...r[e]);
2772
+ return a;
2773
+ },
2774
+ getButtonSafeZoneCommand(e, t, n, r) {
2775
+ let i = t * 1e3;
2776
+ i = this.getHighLowBits(i);
2777
+ let a = n * 1e3;
2778
+ a = this.getHighLowBits(a);
2779
+ let o = r.SET_DEVICE_BUTTON_SAFEZONE_CMD, s = [];
2780
+ e.forEach(function(e) {
2781
+ let t = e.getAttribute("hid");
2782
+ o[0] = t, o[4] = t, o[2] = i[0], o[3] = i[1], o[6] = a[0], o[7] = a[1], s.push(...o);
2783
+ }), s = this.chunkArray(s, 12);
2784
+ let c = r.SET_DEVICE_BUTTON_OP_HEAD, l = [], u = [];
2785
+ for (let e = 0; e < s.length; e++) if (e != 0 && e % 3 == 0 || e == s.length - 1) {
2786
+ u.push(...s[e]), u = c.concat(u);
2787
+ let t = u.length == 57 ? u[u.length - 1] : 0;
2788
+ u[3] = this.getCRC(c[1], c[2], t), u[3] = u[3].toString(16), l.push(u), u = [];
2789
+ } else u.push(...s[e]);
2790
+ return l;
2791
+ },
2792
+ getButtonRTSwitchCommand(e, t, n) {
2793
+ let r = this, i = n.SET_DEVICE_BUTTON_RT_CMD, a = e ? 32 : 16, o = [];
2794
+ t.forEach(function(e) {
2795
+ let t = e.getAttribute("hid"), n = e.getAttribute("working_mode"), s = e.getAttribute("rt_up"), c = e.getAttribute("rt_down");
2796
+ if (n == null) return;
2797
+ let l = parseFloat(s) * 1e3;
2798
+ l = r.getHighLowBits(l);
2799
+ let u = parseFloat(c) * 1e3;
2800
+ u = r.getHighLowBits(u);
2801
+ let d = a + parseInt(n);
2802
+ i[0] = t, i[2] = d.toString(16), i[4] = t, i[8] = t, i[6] = u[0], i[7] = u[1], i[10] = l[0], i[11] = l[1], o.push(...i);
2803
+ }), o = this.chunkArray(o, 12);
2804
+ let s = n.SET_DEVICE_BUTTON_OP_HEAD, c = [], l = [];
2805
+ for (let e = 0; e < o.length; e++) if (e != 0 && e % 3 == 0 || e == o.length - 1) {
2806
+ l.push(...o[e]), l = s.concat(l);
2807
+ let t = l.length == 57 ? l[l.length - 1] : 0;
2808
+ l[3] = this.getCRC(s[1], s[2], t), l[3] = l[3].toString(16), c.push(l), l = [];
2809
+ } else l.push(...o[e]);
2810
+ return c;
2811
+ },
2812
+ getButtonRTCommand(e, t, n, r) {
2813
+ let i = t * 1e3;
2814
+ i = this.getHighLowBits(i);
2815
+ let a = n * 1e3;
2816
+ a = this.getHighLowBits(a);
2817
+ let o = r.SET_DEVICE_BUTTON_RT_CMD, s = [];
2818
+ e.forEach(function(e) {
2819
+ let t = e.getAttribute("hid"), n = e.getAttribute("working_mode");
2820
+ if (n == null) {
2821
+ console.log(e.getAttribute("name")), console.log(n);
2822
+ return;
2823
+ }
2824
+ let r = 32 + parseInt(n);
2825
+ o[0] = t, o[2] = r.toString(16), o[4] = t, o[8] = t, o[6] = a[0], o[7] = a[1], o[10] = i[0], o[11] = i[1], s.push(...o);
2826
+ }), s = this.chunkArray(s, 12);
2827
+ let c = r.SET_DEVICE_BUTTON_OP_HEAD, l = [], u = [];
2828
+ for (let e = 0; e < s.length; e++) if (e != 0 && e % 3 == 0 || e == s.length - 1) {
2829
+ u.push(...s[e]), u = c.concat(u);
2830
+ let t = u.length == 57 ? u[u.length - 1] : 0;
2831
+ u[3] = this.getCRC(c[1], c[2], t), u[3] = u[3].toString(16), l.push(u), u = [];
2832
+ } else u.push(...s[e]);
2833
+ return l;
2834
+ },
2835
+ getButtonRGBCommand(e, t, n) {
2836
+ let r = [
2837
+ t.substring(0, 2),
2838
+ t.substring(2, 4),
2839
+ t.substring(4, 6)
2840
+ ], i = [];
2841
+ e.forEach(function(e) {
2842
+ let t = [];
2843
+ t[0] = e.getAttribute("hid"), t[1] = r[0], t[2] = r[1], t[3] = r[2], i.push(...t);
2844
+ });
2845
+ let a = n.SET_CUSTOM_BUTTON_RGB_HEAD_CMD, o = [], s = [], c = 1;
2846
+ for (let e = 0; e < i.length; e++) {
2847
+ if (c == 56 || e == i.length - 1) {
2848
+ s.push(i[e]), s = a.concat(s);
2849
+ let t = s.length == 61 ? s[s.length - 1] : 0;
2850
+ s[3] = this.getCRC(a[1], a[2], t), s[3] = s[3].toString(16), o.push(s), s = [], c = 1;
2851
+ continue;
2852
+ } else s.push(i[e]);
2853
+ c++;
2854
+ }
2855
+ return o;
2856
+ },
2857
+ getButtonLayoutCustomCompletion(e, t) {
2858
+ let n = [
2859
+ "0x00",
2860
+ t,
2861
+ "0x00",
2862
+ "0x00"
2863
+ ];
2864
+ if (e.length != 56) for (var r = 0; r <= (56 - e.length) / 4; r++) e.push(...n);
2865
+ return e;
2866
+ },
2867
+ getButtonLayout0CustomCommand(e) {
2868
+ let t = this.MatrixList.KeyMap, n = [], r = [
2869
+ "0xAA",
2870
+ "0x00",
2871
+ "0x00",
2872
+ "0x00"
2873
+ ];
2874
+ for (var i = 0; i < t.length; i++) for (var a = 0; a < t[i].length; a++) t[i][a].hid != "00" && (r[0] = t[i][a].hid, n.push(...r));
2875
+ let o = e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD, s = [], c = [], l = 1;
2876
+ for (let t = 0; t < n.length; t++) {
2877
+ if (l == 56 || t == n.length - 1) {
2878
+ c.push(n[t]), c = this.getButtonLayoutCustomCompletion(c, e.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.FN0), c = o.concat(c), s.push(c), c = [], l = 1;
2879
+ continue;
2880
+ } else c.push(n[t]);
2881
+ l++;
2882
+ }
2883
+ return s;
2884
+ },
2885
+ getButtonLayout8CustomCommand(e) {
2886
+ let t = this.MatrixList.KeyMap, n = [], r = [
2887
+ "0xAA",
2888
+ "0x08",
2889
+ "0x00",
2890
+ "0x00"
2891
+ ];
2892
+ for (var i = 0; i < t.length; i++) for (var a = 0; a < t[i].length; a++) t[i][a].hid != "00" && (r[0] = t[i][a].hid, n.push(...r));
2893
+ let o = e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD, s = [], c = [], l = 1;
2894
+ for (let t = 0; t < n.length; t++) {
2895
+ if (l == 56 || t == n.length - 1) {
2896
+ c.push(n[t]), c = this.getButtonLayoutCustomCompletion(c, e.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.MODE), c = o.concat(c), s.push(c), c = [], l = 1;
2897
+ continue;
2898
+ } else c.push(n[t]);
2899
+ l++;
2900
+ }
2901
+ return s;
2902
+ },
2903
+ getButtonLayout1CustomCommand(e) {
2904
+ let t = this.MatrixList.KeyMap, n = [], r = [
2905
+ "0xAA",
2906
+ "0x01",
2907
+ "0x00",
2908
+ "0x00"
2909
+ ];
2910
+ for (var i = 0; i < t.length; i++) for (var a = 0; a < t[i].length; a++) t[i][a].hid != "00" && (r[0] = t[i][a].hid, n.push(...r));
2911
+ let o = e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD, s = [], c = [], l = 1;
2912
+ for (let t = 0; t < n.length; t++) {
2913
+ if (l == 56 || t == n.length - 1) {
2914
+ c.push(n[t]), c = this.getButtonLayoutCustomCompletion(c, e.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.FN0), c = o.concat(c), s.push(c), c = [], l = 1;
2915
+ continue;
2916
+ } else c.push(n[t]);
2917
+ l++;
2918
+ }
2919
+ return s;
2920
+ },
2921
+ getButtonLayout4CustomCommand(e) {
2922
+ let t = this.MatrixList.KeyMap, n = [], r = [
2923
+ "0xAA",
2924
+ "0x04",
2925
+ "0x00",
2926
+ "0x00"
2927
+ ];
2928
+ for (var i = 0; i < t.length; i++) for (var a = 0; a < t[i].length; a++) t[i][a].hid != "00" && (r[0] = t[i][a].hid, n.push(...r));
2929
+ let o = e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD, s = [], c = [], l = 1;
2930
+ for (let t = 0; t < n.length; t++) {
2931
+ if (l == 56 || t == n.length - 1) {
2932
+ c.push(n[t]), c = this.getButtonLayoutCustomCompletion(c, e.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.JOURNEY4), c = o.concat(c), s.push(c), c = [], l = 1;
2933
+ continue;
2934
+ } else c.push(n[t]);
2935
+ l++;
2936
+ }
2937
+ return s;
2938
+ },
2939
+ getButtonLayout14CustomCommand(e) {
2940
+ let t = this.MatrixList.KeyMap, n = [], r = [
2941
+ "0xAA",
2942
+ "0x14",
2943
+ "0x00",
2944
+ "0x00"
2945
+ ];
2946
+ for (var i = 0; i < t.length; i++) for (var a = 0; a < t[i].length; a++) t[i][a].hid != "00" && (r[0] = t[i][a].hid, n.push(...r));
2947
+ let o = e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD, s = [], c = [], l = 1;
2948
+ for (let t = 0; t < n.length; t++) {
2949
+ if (l == 56 || t == n.length - 1) {
2950
+ c.push(n[t]), c = this.getButtonLayoutCustomCompletion(c, e.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.JOURNEY4), c = o.concat(c), s.push(c), c = [], l = 1;
2951
+ continue;
2952
+ } else c.push(n[t]);
2953
+ l++;
2954
+ }
2955
+ return s;
2956
+ },
2957
+ getButtonLayout15CustomCommand(e) {
2958
+ let t = this.MatrixList.KeyMap, n = [], r = [
2959
+ "0xAA",
2960
+ "0x15",
2961
+ "0x00",
2962
+ "0x00"
2963
+ ];
2964
+ for (var i = 0; i < t.length; i++) for (var a = 0; a < t[i].length; a++) t[i][a].hid != "00" && (r[0] = t[i][a].hid, n.push(...r));
2965
+ let o = e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD, s = [], c = [], l = 1;
2966
+ for (let t = 0; t < n.length; t++) {
2967
+ if (l == 56 || t == n.length - 1) {
2968
+ c.push(n[t]), c = this.getButtonLayoutCustomCompletion(c, e.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.JOURNEY4), c = o.concat(c), s.push(c), c = [], l = 1;
2969
+ continue;
2970
+ } else c.push(n[t]);
2971
+ l++;
2972
+ }
2973
+ return s;
2974
+ },
2975
+ getButtonLayout16CustomCommand(e) {
2976
+ let t = this.MatrixList.KeyMap, n = [], r = [
2977
+ "0xAA",
2978
+ "0x16",
2979
+ "0x00",
2980
+ "0x00"
2981
+ ];
2982
+ for (var i = 0; i < t.length; i++) for (var a = 0; a < t[i].length; a++) t[i][a].hid != "00" && (r[0] = t[i][a].hid, n.push(...r));
2983
+ let o = e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD, s = [], c = [], l = 1;
2984
+ for (let t = 0; t < n.length; t++) {
2985
+ if (l == 56 || t == n.length - 1) {
2986
+ c.push(n[t]), c = this.getButtonLayoutCustomCompletion(c, e.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.JOURNEY4), c = o.concat(c), s.push(c), c = [], l = 1;
2987
+ continue;
2988
+ } else c.push(n[t]);
2989
+ l++;
2990
+ }
2991
+ return s;
2992
+ },
2993
+ getButtonLayout17CustomCommand(e) {
2994
+ let t = this.MatrixList.KeyMap, n = [], r = [
2995
+ "0xAA",
2996
+ "0x17",
2997
+ "0x00",
2998
+ "0x00"
2999
+ ];
3000
+ for (var i = 0; i < t.length; i++) for (var a = 0; a < t[i].length; a++) t[i][a].hid != "00" && (r[0] = t[i][a].hid, n.push(...r));
3001
+ let o = e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD, s = [], c = [], l = 1;
3002
+ for (let t = 0; t < n.length; t++) {
3003
+ if (l == 56 || t == n.length - 1) {
3004
+ c.push(n[t]), c = this.getButtonLayoutCustomCompletion(c, e.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.JOURNEY4), c = o.concat(c), s.push(c), c = [], l = 1;
3005
+ continue;
3006
+ } else c.push(n[t]);
3007
+ l++;
3008
+ }
3009
+ return s;
3010
+ },
3011
+ getButtonLayout19CustomCommand(e) {
3012
+ let t = this.MatrixList.KeyMap, n = [], r = [
3013
+ "0xAA",
3014
+ "0x19",
3015
+ "0x00",
3016
+ "0x00"
3017
+ ];
3018
+ for (var i = 0; i < t.length; i++) for (var a = 0; a < t[i].length; a++) t[i][a].hid != "00" && (r[0] = t[i][a].hid, n.push(...r));
3019
+ let o = e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD, s = [], c = [], l = 1;
3020
+ for (let t = 0; t < n.length; t++) {
3021
+ if (l == 56 || t == n.length - 1) {
3022
+ c.push(n[t]), c = this.getButtonLayoutCustomCompletion(c, e.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.AXIS19), c = o.concat(c), s.push(c), c = [], l = 1;
3023
+ continue;
3024
+ } else c.push(n[t]);
3025
+ l++;
3026
+ }
3027
+ return s;
3028
+ },
3029
+ getMatrixKey(e) {
3030
+ let t = [], n = this.toHexStringArr(e), r = n.slice(6, 27), i = n.slice(28, 49);
3031
+ return t.push(r, i), t;
3032
+ },
3033
+ getFormatKeyMapMatrix(e, n, r) {
3034
+ let i = e.concat(n).concat(r), a = function(e) {
3035
+ let n = t.KEYMAP;
3036
+ for (var r in n) if (parseInt(n[r].Hid, 16) == parseInt(e, 16)) return n[r];
3037
+ }, o = [], s = 0;
3038
+ for (let e = 0; e < 6; e++) {
3039
+ let t = [], n = i[e];
3040
+ if (!n) break;
3041
+ for (let e = 0; e < 21; e++) {
3042
+ var c = parseInt(n[e], 16) == 0 ? 0 : a(n[e]);
3043
+ let r = {
3044
+ index: s,
3045
+ key_name: c ? c.Value : 0,
3046
+ name: c ? c.Name : 0,
3047
+ hid: n[e]
3048
+ };
3049
+ t.push(r), s++;
3050
+ }
3051
+ o.push(t);
3052
+ }
3053
+ return o;
3054
+ }
3055
+ }, r = "1.0.0", i = "AVKE SDK", a = class {
3056
+ constructor() {
3057
+ this.currentVersion = r, this.supportedVersions = ["1.0.0"], this.deviceCompatibility = {
3058
+ keyboard: {
3059
+ minFirmwareVersion: "1.0.0",
3060
+ maxFirmwareVersion: "2.0.0"
3061
+ },
3062
+ mouse: {
3063
+ minFirmwareVersion: "1.0.0",
3064
+ maxFirmwareVersion: "2.0.0"
3065
+ }
3066
+ };
3067
+ }
3068
+ getVersion() {
3069
+ return {
3070
+ version: this.currentVersion,
3071
+ name: i,
3072
+ buildDate: (/* @__PURE__ */ new Date()).toISOString()
3073
+ };
3074
+ }
3075
+ checkCompatibility(e, t) {
3076
+ let n = this.deviceCompatibility[e];
3077
+ if (!n) return {
3078
+ compatible: !1,
3079
+ reason: "Unknown device type"
3080
+ };
3081
+ let r = this.compareVersions(t, n.minFirmwareVersion) >= 0 && this.compareVersions(t, n.maxFirmwareVersion) <= 0;
3082
+ return {
3083
+ compatible: r,
3084
+ reason: r ? "Compatible" : `Firmware version ${t} not supported. Supported range: ${n.minFirmwareVersion} - ${n.maxFirmwareVersion}`
3085
+ };
3086
+ }
3087
+ compareVersions(e, t) {
3088
+ let n = e.split(".").map(Number), r = t.split(".").map(Number);
3089
+ for (let e = 0; e < Math.max(n.length, r.length); e++) {
3090
+ let t = n[e] || 0, i = r[e] || 0;
3091
+ if (t > i) return 1;
3092
+ if (t < i) return -1;
3093
+ }
3094
+ return 0;
3095
+ }
3096
+ getSupportedDeviceTypes() {
3097
+ return Object.keys(this.deviceCompatibility);
3098
+ }
3099
+ }, o = class {
3100
+ constructor() {
3101
+ this.levels = {
3102
+ DEBUG: 0,
3103
+ INFO: 1,
3104
+ WARN: 2,
3105
+ ERROR: 3
3106
+ }, this.currentLevel = this.levels.INFO, this.logs = [], this.maxLogs = 1e3;
3107
+ }
3108
+ setLevel(e) {
3109
+ this.levels[e] !== void 0 && (this.currentLevel = this.levels[e]);
3110
+ }
3111
+ debug(e, t = null) {
3112
+ this.log("DEBUG", e, t);
3113
+ }
3114
+ info(e, t = null) {
3115
+ this.log("INFO", e, t);
3116
+ }
3117
+ warn(e, t = null) {
3118
+ this.log("WARN", e, t);
3119
+ }
3120
+ error(e, t = null) {
3121
+ this.log("ERROR", e, t);
3122
+ }
3123
+ log(e, t, n = null) {
3124
+ if (this.levels[e] < this.currentLevel) return;
3125
+ let r = {
3126
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3127
+ level: e,
3128
+ message: t,
3129
+ data: n,
3130
+ stack: e === "ERROR" ? (/* @__PURE__ */ Error()).stack : null
3131
+ };
3132
+ this.logs.push(r), this.logs.length > this.maxLogs && this.logs.shift();
3133
+ let i = e.toLowerCase();
3134
+ console[i] && console[i](`[${e}] ${t}`, n || "");
3135
+ }
3136
+ getLogs(e = null, t = 100) {
3137
+ let n = this.logs;
3138
+ return e && (n = this.logs.filter((t) => t.level === e)), n.slice(-t);
3139
+ }
3140
+ clearLogs() {
3141
+ this.logs = [];
3142
+ }
3143
+ }, s = class {
3144
+ constructor() {
3145
+ this.metrics = {
3146
+ operations: {},
3147
+ connections: {},
3148
+ errors: {}
3149
+ }, this.startTime = Date.now();
3150
+ }
3151
+ recordOperation(e, t, n, r = !0) {
3152
+ let i = n - t;
3153
+ this.metrics.operations[e] || (this.metrics.operations[e] = {
3154
+ count: 0,
3155
+ totalTime: 0,
3156
+ avgTime: 0,
3157
+ minTime: Infinity,
3158
+ maxTime: 0,
3159
+ successCount: 0,
3160
+ errorCount: 0
3161
+ });
3162
+ let a = this.metrics.operations[e];
3163
+ a.count++, a.totalTime += i, a.avgTime = a.totalTime / a.count, a.minTime = Math.min(a.minTime, i), a.maxTime = Math.max(a.maxTime, i), r ? a.successCount++ : a.errorCount++;
3164
+ }
3165
+ recordConnection(e, t = !0) {
3166
+ this.metrics.connections[e] || (this.metrics.connections[e] = {
3167
+ connectCount: 0,
3168
+ disconnectCount: 0,
3169
+ totalConnectedTime: 0,
3170
+ lastConnected: null,
3171
+ lastDisconnected: null
3172
+ });
3173
+ let n = this.metrics.connections[e];
3174
+ t ? (n.connectCount++, n.lastConnected = (/* @__PURE__ */ new Date()).toISOString()) : (n.disconnectCount++, n.lastDisconnected = (/* @__PURE__ */ new Date()).toISOString());
3175
+ }
3176
+ recordError(e, t) {
3177
+ this.metrics.errors[e] || (this.metrics.errors[e] = {
3178
+ count: 0,
3179
+ lastError: null,
3180
+ messages: []
3181
+ });
3182
+ let n = this.metrics.errors[e];
3183
+ n.count++, n.lastError = (/* @__PURE__ */ new Date()).toISOString(), n.messages.push({
3184
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3185
+ message: t.message || t,
3186
+ stack: t.stack
3187
+ }), n.messages.length > 10 && n.messages.shift();
3188
+ }
3189
+ getReport() {
3190
+ return {
3191
+ uptime: Date.now() - this.startTime,
3192
+ operations: this.metrics.operations,
3193
+ connections: this.metrics.connections,
3194
+ errors: this.metrics.errors,
3195
+ summary: {
3196
+ totalOperations: Object.values(this.metrics.operations).reduce((e, t) => e + t.count, 0),
3197
+ totalErrors: Object.values(this.metrics.errors).reduce((e, t) => e + t.count, 0),
3198
+ activeConnections: Object.values(this.metrics.connections).filter((e) => e.lastConnected && (!e.lastDisconnected || e.lastConnected > e.lastDisconnected)).length
3199
+ }
3200
+ };
3201
+ }
3202
+ reset() {
3203
+ this.metrics = {
3204
+ operations: {},
3205
+ connections: {},
3206
+ errors: {}
3207
+ }, this.startTime = Date.now();
3208
+ }
3209
+ }, c = new a(), l = new o(), u = new s(), d = class {
3210
+ static methodTypes = {
3211
+ getLightingBase: "万花筒灯效",
3212
+ setLightingBase: "万花筒灯效",
3213
+ getLightingPalette: "万花筒灯效",
3214
+ setLightingPalette: "万花筒灯效",
3215
+ getLightingCustom: "万花筒灯效",
3216
+ setLightingCustom: "万花筒灯效",
3217
+ getDecorate1Custom: "万花筒灯效",
3218
+ setDecorate1Custom: "万花筒灯效",
3219
+ getLightingArea: "万花筒灯效",
3220
+ getDoubleLighting: "万花筒灯效",
3221
+ getSpecialLighting: "万花筒灯效",
3222
+ setLightingDirectDrive: "万花筒灯效",
3223
+ getDevices: "全局功能",
3224
+ init: "全局功能",
3225
+ getDevicesInfo: "全局功能",
3226
+ getConfig: "全局功能",
3227
+ setConfig: "全局功能",
3228
+ getRateOfReturnList: "全局功能",
3229
+ getRateOfReturn: "全局功能",
3230
+ setRateOfReturn: "全局功能",
3231
+ getRtPrecision: "轴体行程功能",
3232
+ getLightingSleepTime: "全局功能",
3233
+ setLightingSleepTime: "全局功能",
3234
+ closeDevice: "全局功能",
3235
+ reconnection: "全局功能",
3236
+ on: "全局功能",
3237
+ off: "全局功能",
3238
+ appToBoot: "全局功能",
3239
+ bootToApp: "全局功能",
3240
+ upgrade: "全局功能",
3241
+ GFSRestore: "全局功能",
3242
+ getSystemType: "全局功能",
3243
+ setSystemType: "全局功能",
3244
+ getKeyList: "按键功能",
3245
+ getKeyInfo: "按键功能",
3246
+ setKeyConfig: "按键功能",
3247
+ getPerformance: "轴体行程功能",
3248
+ setPerformance: "轴体行程功能",
3249
+ getADCSample: "轴体行程功能",
3250
+ getRoute: "轴体行程功能",
3251
+ calibrationStart: "轴体行程功能",
3252
+ calibrationEnd: "轴体行程功能",
3253
+ getCalibrationStatus: "轴体行程功能",
3254
+ getAxisList: "轴体行程功能",
3255
+ getShakeOptimizationSwitch: "轴体行程功能",
3256
+ setShakeOptimizationSwitch: "轴体行程功能",
3257
+ getHigherKey: "高级按键功能",
3258
+ setHigherKeyNONE: "高级按键功能",
3259
+ setHigherKeyDKS: "高级按键功能",
3260
+ setHigherKeyMPT: "高级按键功能",
3261
+ setHigherKeyMT: "高级按键功能",
3262
+ setHigherKeyTGL: "高级按键功能",
3263
+ setHigherKeyEND: "高级按键功能",
3264
+ setHigherKeySOCD: "高级按键功能",
3265
+ setHigherKeyRS: "高级按键功能"
3266
+ };
3267
+ constructor(e = {}) {
3268
+ this.devices = [], this.currentDevice = null, this.eventListeners = {}, this.deviceType = "keyboard", this.configs = e.configs || [{
3269
+ vendorId: 7338,
3270
+ productId: 2054,
3271
+ usagePage: 65440,
3272
+ usage: 1
3273
+ }], this.usage = e.usage || 1, this.usagePage = e.usagePage || 65440, this.versionManager = c, this.logger = l, this.performanceMonitor = u, this.config = {
3274
+ autoReconnect: e.autoReconnect || !1,
3275
+ reconnectInterval: e.reconnectInterval || 5e3,
3276
+ timeout: e.timeout || 1e4,
3277
+ logLevel: e.logLevel || "INFO",
3278
+ ...e
3279
+ }, this.logger.setLevel(this.config.logLevel), this.logger.info("ServiceKeyboard initialized", {
3280
+ config: this.config,
3281
+ configs: this.configs,
3282
+ usage: this.usage,
3283
+ usagePage: this.usagePage
3284
+ });
3285
+ }
3286
+ async _sendHIDCommand(e, t, n, r = "Timeout waiting for report", i = 2e3) {
3287
+ await this.currentDevice.sendReport(t, e);
3288
+ let a = await new Promise((e, n) => {
3289
+ let a = (n) => {
3290
+ n.reportId === t && (this.currentDevice.removeEventListener("inputreport", a), e(n));
3291
+ };
3292
+ this.currentDevice.addEventListener("inputreport", a), setTimeout(() => {
3293
+ this.currentDevice.removeEventListener("inputreport", a), n(Error(r));
3294
+ }, i);
3295
+ }), o = new Uint8Array(a.data.buffer);
3296
+ return n ? n(o) : o;
3297
+ }
3298
+ async getLightingBase(e) {
3299
+ return {
3300
+ area: e?.area || "Keyboard",
3301
+ open: "Open",
3302
+ mode: 1,
3303
+ luminance: 80,
3304
+ speed: 80,
3305
+ direction: "Forward",
3306
+ selectStaticColor: 0
3307
+ };
3308
+ }
3309
+ async setLightingBase(e) {
3310
+ return {
3311
+ area: e?.area || "Keyboard",
3312
+ ...e?.data
3313
+ };
3314
+ }
3315
+ async getLightingPalette(e) {
3316
+ return { staticColors: [
3317
+ {
3318
+ R: 0,
3319
+ G: 0,
3320
+ B: 0,
3321
+ H: 255
3322
+ },
3323
+ {
3324
+ R: 255,
3325
+ G: 0,
3326
+ B: 0,
3327
+ H: 255
3328
+ },
3329
+ {
3330
+ R: 0,
3331
+ G: 255,
3332
+ B: 0,
3333
+ H: 255
3334
+ },
3335
+ {
3336
+ R: 255,
3337
+ G: 255,
3338
+ B: 0,
3339
+ H: 255
3340
+ },
3341
+ {
3342
+ R: 0,
3343
+ G: 0,
3344
+ B: 255,
3345
+ H: 255
3346
+ },
3347
+ {
3348
+ R: 255,
3349
+ G: 0,
3350
+ B: 255,
3351
+ H: 255
3352
+ },
3353
+ {
3354
+ R: 0,
3355
+ G: 255,
3356
+ B: 255,
3357
+ H: 255
3358
+ },
3359
+ {
3360
+ R: 255,
3361
+ G: 255,
3362
+ B: 255,
3363
+ H: 255
3364
+ }
3365
+ ] };
3366
+ }
3367
+ async setLightingPalette(e) {
3368
+ return { staticColors: e?.data?.staticColors || [] };
3369
+ }
3370
+ async getLightingCustom() {
3371
+ return [[{
3372
+ R: 0,
3373
+ G: 207,
3374
+ B: 244,
3375
+ isCustom: !1
3376
+ }]];
3377
+ }
3378
+ async setLightingCustom(e) {}
3379
+ async getDecorate1Custom(e) {
3380
+ return [[{
3381
+ R: 128,
3382
+ G: 41,
3383
+ B: 49,
3384
+ isCustom: !0
3385
+ }]];
3386
+ }
3387
+ async setDecorate1Custom(e) {}
3388
+ async getLightingArea() {
3389
+ return {
3390
+ total: 2,
3391
+ areas: [{
3392
+ index: 0,
3393
+ count: 20,
3394
+ rows: 6,
3395
+ cols: 15
3396
+ }, {
3397
+ index: 1,
3398
+ count: 5,
3399
+ rows: 1,
3400
+ cols: 22
3401
+ }]
3402
+ };
3403
+ }
3404
+ async getDoubleLighting() {
3405
+ return { doubleLighting: 1 };
3406
+ }
3407
+ async getSpecialLighting() {
3408
+ return { specialLighting: 1 };
3409
+ }
3410
+ async setLightingDirectDrive(e, t) {}
3411
+ async getDefaultKeyLayout() {
3412
+ let t = new Uint8Array(e.READ_DEFKEY_MATRIX_CMD.ROW1_ROW2.map((e) => parseInt(e, 16))), r = new Uint8Array(e.READ_DEFKEY_MATRIX_CMD.ROW3_ROW4.map((e) => parseInt(e, 16))), i = new Uint8Array(e.READ_DEFKEY_MATRIX_CMD.ROW5_ROW6.map((e) => parseInt(e, 16)));
3413
+ try {
3414
+ let e = await this._sendHIDCommand(t, 0, (e) => n.getMatrixKey(e), "Timeout waiting for key matrix row1/row2 report"), a = await this._sendHIDCommand(r, 0, (e) => n.getMatrixKey(e), "Timeout waiting for key matrix row3/row4 report"), o = await this._sendHIDCommand(i, 0, (e) => n.getMatrixKey(e), "Timeout waiting for key matrix row5/row6 report");
3415
+ return {
3416
+ code: 0,
3417
+ layout: n.getFormatKeyMapMatrix(e, a, o)
3418
+ };
3419
+ } catch (e) {
3420
+ throw this.logger.error("getDefaultKeyLayout", e), e;
3421
+ }
3422
+ }
3423
+ async getKeyList() {
3424
+ return {
3425
+ code: 0,
3426
+ keys: [{
3427
+ id: 1,
3428
+ name: "A"
3429
+ }, {
3430
+ id: 2,
3431
+ name: "B"
3432
+ }]
3433
+ };
3434
+ }
3435
+ async getKeyInfo(e) {
3436
+ return {
3437
+ code: 0,
3438
+ key: {
3439
+ id: e,
3440
+ name: "A",
3441
+ type: "normal",
3442
+ macro: null
3443
+ }
3444
+ };
3445
+ }
3446
+ async setKeyConfig(e, t) {
3447
+ if (typeof t == "string") try {
3448
+ t = JSON.parse(t);
3449
+ } catch {}
3450
+ return { code: 0 };
3451
+ }
3452
+ async getRtPrecision() {
3453
+ return { min: .001 };
3454
+ }
3455
+ async getPerformance(e) {
3456
+ return {
3457
+ row: e?.row ?? 0,
3458
+ col: e?.col ?? 0,
3459
+ mode: 0,
3460
+ normalPress: 2,
3461
+ normalRelease: 2,
3462
+ rtFirstTouch: .5,
3463
+ rtPress: .3,
3464
+ rtRelease: .3,
3465
+ pressDeadStroke: .2,
3466
+ releaseDeadStroke: .2,
3467
+ axis: 0,
3468
+ calibrate: 0
3469
+ };
3470
+ }
3471
+ async setPerformance(e) {
3472
+ return {
3473
+ row: e?.row ?? 0,
3474
+ col: e?.col ?? 0,
3475
+ mode: e?.mode ?? 0,
3476
+ normalPress: e?.normalPress ?? 2,
3477
+ normalRelease: e?.normalRelease ?? 2,
3478
+ rtFirstTouch: e?.rtFirstTouch ?? .5,
3479
+ rtPress: e?.rtPress ?? .3,
3480
+ rtRelease: e?.rtRelease ?? .3,
3481
+ pressDeadStroke: e?.pressDeadStroke ?? .2,
3482
+ releaseDeadStroke: e?.releaseDeadStroke ?? .2,
3483
+ ...e?.axis === void 0 ? {} : { axis: e.axis },
3484
+ ...e?.axisV2Id === void 0 ? {} : { axisV2Id: e.axisV2Id },
3485
+ ...e?.axisRangeMax === void 0 ? {} : { axisRangeMax: e.axisRangeMax },
3486
+ ...e?.axisCoefficient === void 0 ? {} : { axisCoefficient: e.axisCoefficient },
3487
+ calibrate: e?.calibrate ?? 0
3488
+ };
3489
+ }
3490
+ async getADCSample(e) {
3491
+ return {
3492
+ adc: 0,
3493
+ row: e?.row ?? 0,
3494
+ data: [
3495
+ 2715,
3496
+ 2700,
3497
+ 2686,
3498
+ 2693,
3499
+ 2704,
3500
+ 2772,
3501
+ 2674,
3502
+ 2688
3503
+ ]
3504
+ };
3505
+ }
3506
+ async getRoute(e) {
3507
+ return {
3508
+ route: 0,
3509
+ row: e?.row ?? 0,
3510
+ data: [
3511
+ 0,
3512
+ 0,
3513
+ 0,
3514
+ 343,
3515
+ 0,
3516
+ 0,
3517
+ 0,
3518
+ 0
3519
+ ]
3520
+ };
3521
+ }
3522
+ async calibrationStart() {
3523
+ return {
3524
+ status: 0,
3525
+ message: "Calibration started"
3526
+ };
3527
+ }
3528
+ async calibrationEnd() {
3529
+ return {
3530
+ status: 0,
3531
+ message: "Calibration finished"
3532
+ };
3533
+ }
3534
+ async getCalibrationStatus(e) {
3535
+ return {
3536
+ calibrate: 2,
3537
+ row: e?.row ?? 0,
3538
+ data: [
3539
+ 0,
3540
+ 0,
3541
+ 0,
3542
+ 0,
3543
+ 0,
3544
+ 0,
3545
+ 0,
3546
+ 0
3547
+ ]
3548
+ };
3549
+ }
3550
+ async getAxisList() {
3551
+ return {
3552
+ total: 4,
3553
+ list: [
3554
+ 54,
3555
+ 24,
3556
+ 1,
3557
+ 69
3558
+ ]
3559
+ };
3560
+ }
3561
+ async getShakeOptimizationSwitch() {
3562
+ return {
3563
+ enabled: !1,
3564
+ status: 0
3565
+ };
3566
+ }
3567
+ async setShakeOptimizationSwitch(e) {
3568
+ return {
3569
+ enabled: !!e,
3570
+ status: 0
3571
+ };
3572
+ }
3573
+ async getHigherKey(e) {
3574
+ return {
3575
+ row: e?.row ?? 0,
3576
+ col: e?.col ?? 0,
3577
+ mode: 0
3578
+ };
3579
+ }
3580
+ async setHigherKeyNONE(e) {
3581
+ return {
3582
+ row: e?.row ?? 0,
3583
+ col: e?.col ?? 0,
3584
+ mode: 0,
3585
+ data: e?.data ?? { mode: 0 }
3586
+ };
3587
+ }
3588
+ async setHigherKeyDKS(e) {
3589
+ return {
3590
+ row: e?.row ?? 0,
3591
+ col: e?.col ?? 0,
3592
+ mode: 1,
3593
+ data: {
3594
+ kcs: e?.data?.kcs ?? [],
3595
+ trps: e?.data?.trps ?? [],
3596
+ dbs: e?.data?.dbs ?? []
3597
+ }
3598
+ };
3599
+ }
3600
+ async setHigherKeyMPT(e) {
3601
+ return {
3602
+ row: e?.row ?? 0,
3603
+ col: e?.col ?? 0,
3604
+ mode: 2,
3605
+ data: {
3606
+ kcs: e?.data?.kcs ?? [],
3607
+ dbs: e?.data?.dbs ?? []
3608
+ }
3609
+ };
3610
+ }
3611
+ async setHigherKeyMT(e) {
3612
+ return {
3613
+ row: e?.row ?? 0,
3614
+ col: e?.col ?? 0,
3615
+ mode: 3,
3616
+ data: {
3617
+ time: e?.data?.time ?? 0,
3618
+ kcs: e?.data?.kcs ?? []
3619
+ }
3620
+ };
3621
+ }
3622
+ async setHigherKeyTGL(e) {
3623
+ return {
3624
+ row: e?.row ?? 0,
3625
+ col: e?.col ?? 0,
3626
+ mode: 4,
3627
+ data: {
3628
+ kcs: e?.data?.kcs ?? 0,
3629
+ delay: e?.data?.delay ?? 0
3630
+ }
3631
+ };
3632
+ }
3633
+ async setHigherKeyEND(e) {
3634
+ return {
3635
+ row: e?.row ?? 0,
3636
+ col: e?.col ?? 0,
3637
+ mode: 5,
3638
+ data: {
3639
+ kcs: e?.data?.kcs ?? [],
3640
+ delay: e?.data?.delay ?? 0
3641
+ }
3642
+ };
3643
+ }
3644
+ async setHigherKeySOCD(e) {
3645
+ return {
3646
+ row: e?.row ?? 0,
3647
+ col: e?.col ?? 0,
3648
+ mode: 6,
3649
+ data: {
3650
+ row2: e?.row2 ?? 0,
3651
+ col2: e?.col2 ?? 0,
3652
+ kcs: e?.kcs ?? [],
3653
+ delay: e?.delay ?? 0,
3654
+ mode: e?.mode ?? 0
3655
+ }
3656
+ };
3657
+ }
3658
+ async setHigherKeyRS(e) {
3659
+ return {
3660
+ row: e?.row ?? 0,
3661
+ col: e?.col ?? 0,
3662
+ mode: 7,
3663
+ data: {
3664
+ row2: e?.data?.row2 ?? 0,
3665
+ col2: e?.data?.col2 ?? 0,
3666
+ delay: e?.data?.delay ?? 0,
3667
+ kcs: e?.data?.kcs ?? []
3668
+ }
3669
+ };
3670
+ }
3671
+ async getRateOfReturnList() {
3672
+ return {
3673
+ code: 0,
3674
+ list: []
3675
+ };
3676
+ }
3677
+ async getDevices() {
3678
+ let e = Date.now();
3679
+ try {
3680
+ if (this.logger.debug("Getting devices list"), !navigator.hid) throw Error("WebHID API is not supported in this browser.");
3681
+ let t = this.configs && this.configs.length > 0 ? this.configs.map((e) => ({
3682
+ vendorId: e.vendorId,
3683
+ productId: e.productId,
3684
+ usagePage: e.usagePage,
3685
+ usage: e.usage
3686
+ })) : void 0, n = await navigator.hid.getDevices();
3687
+ (!n || n.length === 0) && (n = await navigator.hid.requestDevice({ filters: t || [] }));
3688
+ let r = n.map((e) => ({
3689
+ id: e.deviceId || `${e.vendorId}:${e.productId}`,
3690
+ usage: e.collections?.[0]?.usage || this.usage,
3691
+ usagePage: e.collections?.[0]?.usagePage || this.usagePage,
3692
+ vendorId: e.vendorId,
3693
+ productId: e.productId,
3694
+ productName: e.productName,
3695
+ data: {},
3696
+ type: "keyboard"
3697
+ }));
3698
+ return this.performanceMonitor.recordOperation("getDevices", e, Date.now(), !0), this.logger.info(`Found ${r.length} devices`, { devices: r }), r;
3699
+ } catch (t) {
3700
+ throw this.performanceMonitor.recordOperation("getDevices", e, Date.now(), !1), this.performanceMonitor.recordError("getDevices", t), this.logger.error("Failed to get devices", t), t;
3701
+ }
3702
+ }
3703
+ async init(e) {
3704
+ let t = Date.now();
3705
+ try {
3706
+ if (this.logger.info(`Initializing keyboard device: ${e}`), !navigator.hid) throw Error("WebHID API is not supported in this browser.");
3707
+ let n = await navigator.hid.getDevices(), r = null;
3708
+ for (let e = 0; e < n.length; e++) {
3709
+ let t = n[e];
3710
+ t.collections[0].usagePage == this.usagePage && (r = t);
3711
+ }
3712
+ if (!r) throw Error("Device not found or not authorized.");
3713
+ r.opened || await r.open(), this.currentDevice = r, this.performanceMonitor.recordConnection(e, !0);
3714
+ let i = await this.getDevicesInfo(), a = this.versionManager.checkCompatibility("keyboard", i.Version);
3715
+ return a.compatible || this.logger.warn(`Device firmware version check: ${a.reason}`), this.performanceMonitor.recordOperation("init", t, Date.now(), !0), this.logger.info("Keyboard device initialized successfully", {
3716
+ deviceId: e,
3717
+ deviceInfo: i
3718
+ }), {
3719
+ code: 0,
3720
+ info: "Initialization successful!"
3721
+ };
3722
+ } catch (n) {
3723
+ throw this.performanceMonitor.recordOperation("init", t, Date.now(), !1), this.performanceMonitor.recordError("init", n), this.logger.error(`Failed to initialize keyboard device: ${e}`, n), n;
3724
+ }
3725
+ }
3726
+ async getDevicesInfo() {
3727
+ if (!this.currentDevice) throw Error("No device initialized.");
3728
+ let t = new Uint8Array(e.READ_DEVICE_INFO_CMD.map((e) => parseInt(e, 16)));
3729
+ try {
3730
+ let e = await this._sendHIDCommand(t, 0, (e) => n.getDeviceInfo(e), "Timeout waiting for device info report");
3731
+ return console.log("DeviceInfo", { DeviceInfo: e }), e;
3732
+ } catch (e) {
3733
+ throw this.logger.error("Failed to get device info", e), e;
3734
+ }
3735
+ }
3736
+ async getConfig() {
3737
+ let t = new Uint8Array(e.READ_DEVICE_PROFILE_CMD.map((e) => parseInt(e, 16)));
3738
+ try {
3739
+ let e = await this._sendHIDCommand(t, 0, (e) => n.getCurrentConfig(e), "Timeout waiting for device info report");
3740
+ return {
3741
+ code: 0,
3742
+ configName: "Config" + e,
3743
+ value: e
3744
+ };
3745
+ } catch (e) {
3746
+ throw this.logger.error("Failed to get config", e), e;
3747
+ }
3748
+ }
3749
+ async setConfig(t) {
3750
+ e.SET_DEVICE_PROFILE_CMD[5] = parseInt(t);
3751
+ let n = new Uint8Array(e.SET_DEVICE_PROFILE_CMD.map((e) => parseInt(e, 16)));
3752
+ try {
3753
+ return await this._sendHIDCommand(n, 0, null, "Timeout waiting for device info report"), {
3754
+ code: 0,
3755
+ setConfigName: "Config" + t,
3756
+ configIndex: t
3757
+ };
3758
+ } catch (e) {
3759
+ throw this.logger.error("Failed to set config", e), e;
3760
+ }
3761
+ }
3762
+ async getRateOfReturn() {
3763
+ let t = new Uint8Array(e.READ_DEVICE_RATE_CMD.map((e) => parseInt(e, 16)));
3764
+ try {
3765
+ return {
3766
+ code: 0,
3767
+ key: await this._sendHIDCommand(t, 0, (e) => n.getDeviceRate(e), "Timeout waiting for device rate report")
3768
+ };
3769
+ } catch (e) {
3770
+ throw this.logger.error("Failed to get rate of return", e), e;
3771
+ }
3772
+ }
3773
+ async setRateOfReturn(t) {
3774
+ e.SET_DEVICE_RATE_CMD[5] = parseInt(t);
3775
+ let n = new Uint8Array(e.SET_DEVICE_RATE_CMD.map((e) => parseInt(e, 16)));
3776
+ try {
3777
+ return await this._sendHIDCommand(n, 0, null, "Timeout waiting for device rate set report"), { code: 0 };
3778
+ } catch (e) {
3779
+ throw this.logger.error("Failed to set rate of return", e), e;
3780
+ }
3781
+ }
3782
+ async getLightingSleepTime() {
3783
+ let t = new Uint8Array(e.READ_DEVICE_SLEEP_CMD.map((e) => parseInt(e, 16)));
3784
+ try {
3785
+ return {
3786
+ code: 0,
3787
+ value: await this._sendHIDCommand(t, 0, (e) => n.getDeviceSleep(e), "Timeout waiting for device sleep report")
3788
+ };
3789
+ } catch (e) {
3790
+ throw this.logger.error("Failed to get lighting sleep time", e), e;
3791
+ }
3792
+ }
3793
+ async setLightingSleepTime(t) {
3794
+ e.SET_DEVICE_SLEEP_CMD[5] = parseInt(t);
3795
+ let n = new Uint8Array(e.SET_DEVICE_SLEEP_CMD.map((e) => parseInt(e, 16)));
3796
+ try {
3797
+ return await this._sendHIDCommand(n, 0, null, "Timeout waiting for device sleep set report"), { code: 0 };
3798
+ } catch (e) {
3799
+ throw this.logger.error("Failed to set lighting sleep time", e), e;
3800
+ }
3801
+ }
3802
+ async closeDevice() {
3803
+ return this.currentDevice = null, { code: 0 };
3804
+ }
3805
+ async reconnection(e, t) {
3806
+ return { code: 0 };
3807
+ }
3808
+ on(e, t) {
3809
+ this.eventListeners[e] || (this.eventListeners[e] = []), this.eventListeners[e].push(t);
3810
+ }
3811
+ off(e, t) {
3812
+ this.eventListeners[e] && (this.eventListeners[e] = this.eventListeners[e].filter((e) => e !== t));
3813
+ }
3814
+ async appToBoot() {
3815
+ return { code: 0 };
3816
+ }
3817
+ async bootToApp() {
3818
+ return { code: 0 };
3819
+ }
3820
+ async upgrade(e, t, n) {
3821
+ return { code: 0 };
3822
+ }
3823
+ async GFSRestore() {
3824
+ return { code: 0 };
3825
+ }
3826
+ async getSystemType() {
3827
+ let t = new Uint8Array(e.READ_DEVICE_SYSTEM_CMD.map((e) => parseInt(e, 16)));
3828
+ try {
3829
+ let { key: e, value: r } = await this._sendHIDCommand(t, 0, (e) => n.getDeviceSystem(e), "Timeout waiting for device system report");
3830
+ return {
3831
+ code: 0,
3832
+ key: e,
3833
+ value: r
3834
+ };
3835
+ } catch (e) {
3836
+ throw this.logger.error("Failed to get system type", e), e;
3837
+ }
3838
+ }
3839
+ async setSystemType(t) {
3840
+ e.SET_DEVICE_SYSTEM_CMD[5] = parseInt(t);
3841
+ let n = new Uint8Array(e.SET_DEVICE_SYSTEM_CMD.map((e) => parseInt(e, 16)));
3842
+ try {
3843
+ return await this._sendHIDCommand(n, 0, null, "Timeout waiting for device system set report"), { code: 0 };
3844
+ } catch (e) {
3845
+ throw this.logger.error("Failed to set system type", e), e;
3846
+ }
3847
+ }
3848
+ }, f = class {
3849
+ constructor(e = {}) {
3850
+ this.devices = [], this.currentDevice = null, this.eventListeners = {}, this.deviceType = "mouse", this.configs = e.configs || [], this.usage = e.usage || 2, this.usagePage = e.usagePage || 65457, this.versionManager = c, this.logger = l, this.performanceMonitor = u, this.config = {
3851
+ autoReconnect: e.autoReconnect || !1,
3852
+ reconnectInterval: e.reconnectInterval || 5e3,
3853
+ timeout: e.timeout || 1e4,
3854
+ logLevel: e.logLevel || "INFO",
3855
+ ...e
3856
+ }, this.logger.setLevel(this.config.logLevel), this.logger.info("ServiceMouse initialized", {
3857
+ config: this.config,
3858
+ configs: this.configs,
3859
+ usage: this.usage,
3860
+ usagePage: this.usagePage
3861
+ });
3862
+ }
3863
+ async getDevices() {
3864
+ let e = Date.now();
3865
+ try {
3866
+ this.logger.debug("Getting mouse devices list");
3867
+ let t = [{
3868
+ id: "mock-mouse-1",
3869
+ usage: 2,
3870
+ usagePage: 65440,
3871
+ vendorId: 7331,
3872
+ productId: 2050,
3873
+ productName: "Mock Mouse",
3874
+ data: {},
3875
+ type: "mouse"
3876
+ }];
3877
+ return this.performanceMonitor.recordOperation("getDevices", e, Date.now(), !0), this.logger.info(`Found ${t.length} mouse devices`, { devices: t }), t;
3878
+ } catch (t) {
3879
+ throw this.performanceMonitor.recordOperation("getDevices", e, Date.now(), !1), this.performanceMonitor.recordError("getDevices", t), this.logger.error("Failed to get mouse devices", t), t;
3880
+ }
3881
+ }
3882
+ async init(e) {
3883
+ let t = Date.now();
3884
+ try {
3885
+ this.logger.info(`Initializing mouse device: ${e}`), this.currentDevice = {
3886
+ id: e,
3887
+ type: "mouse"
3888
+ }, this.performanceMonitor.recordConnection(e, !0);
3889
+ let n = await this.getDevicesInfo(), r = this.versionManager.checkCompatibility("mouse", n.appVersion);
3890
+ return r.compatible || this.logger.warn(`Device firmware version check: ${r.reason}`), this.performanceMonitor.recordOperation("init", t, Date.now(), !0), this.logger.info("Mouse device initialized successfully", {
3891
+ deviceId: e,
3892
+ deviceInfo: n
3893
+ }), this.currentDevice;
3894
+ } catch (n) {
3895
+ throw this.performanceMonitor.recordOperation("init", t, Date.now(), !1), this.performanceMonitor.recordError("init", n), this.logger.error(`Failed to initialize mouse device: ${e}`, n), n;
3896
+ }
3897
+ }
3898
+ async getDevicesInfo() {
3899
+ return {
3900
+ type: 2,
3901
+ subType: 0,
3902
+ boardId: 3145730,
3903
+ appVersion: "1.0.1.0",
3904
+ pcbVersion: "1-0-0-0",
3905
+ runModeVersion: 0,
3906
+ sn: "54817806657765148212548",
3907
+ timestamp: "2025052215:4"
3908
+ };
3909
+ }
3910
+ async getProtocolVersion() {
3911
+ return {
3912
+ mainVersion: 1,
3913
+ subVersion: 0,
3914
+ hardwareVersion: 1,
3915
+ softwareVersion: 0
3916
+ };
3917
+ }
3918
+ async getDPIList() {
3919
+ return { list: [
3920
+ 400,
3921
+ 800,
3922
+ 1600,
3923
+ 3200,
3924
+ 6400,
3925
+ 12800,
3926
+ 16e3
3927
+ ] };
3928
+ }
3929
+ async getDPI() {
3930
+ return { value: 1600 };
3931
+ }
3932
+ async setDPI(e) {
3933
+ console.log(`Setting DPI to ${e}`);
3934
+ }
3935
+ async getRateOfReturnList() {
3936
+ return { list: [
3937
+ "125Hz",
3938
+ "250Hz",
3939
+ "500Hz",
3940
+ "1000Hz"
3941
+ ] };
3942
+ }
3943
+ async getRateOfReturn() {
3944
+ return { key: "1000Hz" };
3945
+ }
3946
+ async setRateOfReturn(e) {
3947
+ console.log(`Setting rate of return to ${e}`);
3948
+ }
3949
+ async getLiftOffDistance() {
3950
+ return { value: 2 };
3951
+ }
3952
+ async setLiftOffDistance(e) {
3953
+ console.log(`Setting lift-off distance to ${e}`);
3954
+ }
3955
+ async getButtonMapping() {
3956
+ return {
3957
+ left: "left-click",
3958
+ right: "right-click",
3959
+ middle: "middle-click",
3960
+ dpi: "dpi-cycle",
3961
+ forward: "forward",
3962
+ backward: "backward"
3963
+ };
3964
+ }
3965
+ async setButtonMapping(e) {
3966
+ console.log("Setting button mapping:", e);
3967
+ }
3968
+ async closeDevice() {
3969
+ this.currentDevice = null;
3970
+ }
3971
+ async reconnection(e, t) {}
3972
+ on(e, t) {
3973
+ this.eventListeners[e] || (this.eventListeners[e] = []), this.eventListeners[e].push(t);
3974
+ }
3975
+ off(e, t) {
3976
+ this.eventListeners[e] && (this.eventListeners[e] = this.eventListeners[e].filter((e) => e !== t));
3977
+ }
3978
+ async appToBoot() {}
3979
+ async bootToApp() {}
3980
+ async upgrade(e, t, n) {
3981
+ return { success: !0 };
3982
+ }
3983
+ async GFSRestore() {}
3984
+ }, p = d;
3985
+ //#endregion
3986
+ export { o as Logger, s as PerformanceMonitor, d as ServiceKeyboard, f as ServiceMouse, a as VersionManager, p as default, l as logger, u as performanceMonitor, c as versionManager };