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 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.KeyboardSDK={}))})(this,function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t={RESPONSE_CODE:{DEVICE_CODE:`0x81`,RM6X21_CODE:`0xAB`,GLOBAL_FUNC_CODE:`0x80`,GLOBAL_LIGTH_CODE:`0x98`,GLOBAL_BATTERY_CODE:`0xB7`,GLOBAL_LOGO_LIGTH_CODE:`0x99`,GLOBAL_JOURNEY_CODE:`0xA9`,RT_ALL_JOURNEY_CODE:`0x80`,RM6X21_JOURNEY_CODE:`0x92`,RM6X21_LAYOUT0_CODE:`0xA3`,RM6X21_ARGB_CODE:`0xAA`,CONNECT_MODE:{USB:0,Bluetooth1:1,Bluetooth2:2,Bluetooth3:3,WIRELESS:4},MATRIX6X21_CODE:{ADC_HALL_CODE:`0x02`,KEY_STATUS_CODE:`0x03`,ADC_MAX_JOURNEY_CODE:`0x04`,ADC_MIN_JOURNEY_CODE:`0x05`,ADC_ORIGINAL_CODE:`0x06`,ADC_MAX_ORIGINAL_CODE:`0x07`,ADC_MIN_ORIGINAL_CODE:`0x08`},MATRIX6X21_LAYOUT_CODE:{FN0:`0x00`,FN1:`0x01`,JOURNEY4:`0x04`,MODE:`0x08`,RTDOWN14:`0x14`,RTUP15:`0x15`,SAFE16:`0x16`,SAFE17:`0x17`,AXIS19:`0x19`},MATRIX6X21_LAYOUT_MODE_CODE:{HRT:`0x20`,DKS:`0x01`,SOCD:`0x08`,MPT:`0x02`,MT:`0x03`,END:`0x05`,TGL:`0x04`,RS:`0x09`,MACRO:`0x06`},MATRIX6X21_ADVANCED_FUNC_CODE:{DKS:`0xA6`,SOCD:`0xAC`,MPT:`0xA7`,MT:`0xA4`,END:`0xA8`,TGL:`0XA5`,RS:`0xAD`,MACRO:`0xA1`},CUSTOM_BUTTON_COMMAND_TYPE_CMD:{KEY:`0x00`,MEDIA1:`0x10`,MEDIA2:`0x11`,MEDIA3:`0x12`,HOTKEY:`0x60`,MOUSE:`0x70`,SYS:`0xF1`,SYS1:`0xF0`,MACRO:`0xE0`},FUNC_TYPE_CMD:{MAC:`0x22`,WIN_KEY_STATUS:`0x20`,RETE:`0x50`,LOD:`0xB4`,DPI:`0xB5`,SLEEP:`0xB6`,SITE:`0x60`,FIRST_FLAG:`0xB3`,SERIAL_NUMBER:`0xB2`,PROFILE_INDEX:`0x70`,RT_ALL:`0xA1`},UPGRADE:{SIGN:`0x88`,ERASE:`0x89`,WRITE:`0x8C`,READ:`0x8D`,RCRC:`0x8E`},UPGRADE_SIGN_TYPE:{SIGN1:`0x02`,SIGN2:`0x03`,SIGN3:`0x02`,SIGN4:`0x04`}},SET_DEVICE_RT_ALL_JOURNEY_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0xA1`,`0x00`,`0xFF`,`0xFF`],READ_DEVICE_RT_ALL_JOURNEY_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0xA1`,`0xFF`,`0xFF`,`0xFF`],SET_DEVICE_REST_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x11`,`0xFF`,`0xFF`],SET_DEVICE_RETE_CMD:[`0x5C`,`0x04`,`0x00`,`0x94`,`0x50`,`0x00`,`0xFF`,`0xFF`],SET_DEVICE_WIN_MODE_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x30`,`0x00`,`0xFF`,`0xFF`],SET_DEVICE_MAC_MODE_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x31`,`0x00`,`0xFF`,`0xFF`],SET_DEVICE_LOD_CMD:[`0x5C`,`0x04`,`0x00`,`0x94`,`0xB4`,`0x01`,`0xFF`,`0xFF`],READ_DEVICE_LOD_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0xB4`,`0xFF`,`0xFF`,`0xFF`],SET_DEVICE_SLEEP_CMD:[`0x5C`,`0x04`,`0x00`,`0x94`,`0xB6`,`0x01`,`0xFF`,`0xFF`],READ_DEVICE_SLEEP_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0xB6`,`0xFF`,`0xFF`,`0xFF`],SET_DEVICE_DPI_CMD:[`0x5C`,`0x0C`,`0x00`,`0x9C`,`0xB5`,`0x01`,`0x0a`,`0x32`,`0x00`,`0x0b`,`0x32`,`0x00`,`0x01`,`0x01`,`0xFF`,`0xFF`],READ_DEVICE_DPI_CMD:[`0x5C`,`0x04`,`0x00`,`0x94`,`0xB5`,`0x00`,`0xFF`,`0xFF`],READ_DEVICE_BATTERY_CMD:[`0x5C`,`0x04`,`0x00`,`0x94`,`0xB7`,`0x00`,`0xFF`,`0xFF`],READ_DEVICE_RETE_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x50`,`0xFF`,`0xFF`],READ_DEVICE_WIN_MODE_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x21`,`0xFF`,`0xFF`],READ_DEVICE_MAC_MODE_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x22`,`0xFF`,`0xFF`],SET_DEVICE_PROFILE_CMD:[`0x5C`,`0x04`,`0x00`,`0x94`,`0x70`,`0x02`,`0xFF`,`0xFF`],READ_DEVICE_PROFILE_CMD:[`0x5C`,`0x04`,`0x00`,`0x94`,`0x70`,`0xFF`,`0xFF`,`0xFF`],SET_DEVICE_FIRST_FLAG_CMD:[`0x5C`,`0x04`,`0x00`,`0x94`,`0xB3`,`0x01`,`0xFF`,`0xFF`],READ_DEVICE_FIRST_FLAG_CMD:[`0x5C`,`0x04`,`0x00`,`0x94`,`0xB3`,`0xFF`,`0xFF`,`0xFF`],SET_DEVICE_SERIAL_NUMBER_CMD:[`0x5C`,`0x05`,`0x00`,`0x95`,`0xB1`,`0x02`,`0xFF`,`0xFF`,`0xFF`,`0xFF`],READ_DEVICE_SERIAL_NUMBER_CMD:[`0x5C`,`0x05`,`0x00`,`0x95`,`0xB2`,`0x02`,`0xFF`,`0xFF`,`0xFF`,`0xFF`],SET_DEVICE_WIN_STATUS_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x20`,`0x00`,`0xFF`,`0xFF`],READ_DEVICE_WIN_STATUS_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x20`,`0xFF`,`0xFF`],SET_DEVICE_SITE_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x60`],READ_DEVICE_SITE_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x60`,`0xFF`,`0xFF`],READ_DEVICE_INFO_CMD:[`0x5C`,`0x02`,`0x01`,`0x93`,`0xFF`,`0xFF`],READ_DEFKEY_MATRIX_CMD:{ROW1_ROW2:[`0x5C`,`0x03`,`0x2B`,`0XC0`,`0x00`,`0x00`,`0x01`],ROW3_ROW4:[`0x5C`,`0x03`,`0x2B`,`0XC2`,`0x00`,`0x02`,`0x03`],ROW5_ROW6:[`0x5C`,`0x03`,`0x2B`,`0XC4`,`0x00`,`0x04`,`0x05`]},READ_RM6X21_HALL_16BIT_CMD:{ROW1_ROW3:[`0x5C`,`0x04`,`0x12`,`0xA6`,`0x02`,`0x01`,`0xFF`,`0xFF`],ROW4_ROW6:[`0x5C`,`0x04`,`0x12`,`0xA6`,`0x02`,`0x02`,`0xFF`,`0xFF`]},READ_RM6X21_ADC_16BIT_CMD:{ROW1_ROW3:[`0x5C`,`0x04`,`0x12`,`0xA6`,`0x06`,`0x01`,`0xFF`,`0xFF`],ROW4_ROW6:[`0x5C`,`0x04`,`0x12`,`0xA6`,`0x06`,`0x02`,`0xFF`,`0xFF`]},READ_RM6X21_KEYSTATUS_8BIT_CMD:[`0x5C`,`0x04`,`0x12`,`0xA6`,`0x03`,`0x01`,`0xFF`,`0xFF`],READ_LAYOUT_KEY_CUSTOM_HEAD_CMD:[`0x5C`,`0x39`,`0x23`,`0xED`,`0x00`],SET_DEVICE_PRGB_CMD:`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(`.`),SET_CUSTOM_BUTTON_MODE_CMD:`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(`.`),SET_CUSTOM_LOGO_MODE_CMD:`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(`.`),SET_CUSTOM_LOGO_CMD:`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(`.`),SET_CUSTOM_BUTTON_RGB_HEAD_CMD:[`0x5C`,`0x39`,`0x2A`,`0xFF`,`0x01`],SET_CUSTOM_BUTTON_RGB_END_CMD:[`0x5C`,`0x39`,`0x2A`,`0xF8`,`0x01`,`0xfe`,`0xfe`,`0xfe`,`0xfe`],PRGBBRIGHTNESS:`0x03`,PRGBSPEED:`0x03`,PRGBLIST:[],READ_GLOBAL_JOURNEY_CMD:[`0x5C`,`0x0F`,`0x29`,`0xC9`,`0x00`],SET_GLOBAL_JOURNEY_CMD:[`0x5C`,`0x0F`,`0x29`,`0xC9`,`0x01`,`0x00`,`0x00`,`0x00`,`0x00`,`0xC8`,`0x00`,`0xC8`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`],SET_DEVICE_FUNCTION_OP_CMD:[`0x5C`,`0x03`,`0x00`,`0x93`,`0x0C`,`0xFF`,`0xFF`],SET_DEVICE_BUTTON_OP_HEAD:[`0x5C`,`0x39`,`0x23`,`0xFF`,`0x01`],SET_DEVICE_BUTTON_OP_CMD:[`0x5C`,`0x39`,`0x23`,`0xED`,`0x01`,`0x1b`,`0x00`,`0xFF`,`0x00`],SET_DEVICE_BUTTON_AXIS_CMD:[`0x5C`,`0x39`,`0x23`,`0xED`,`0x01`,`0xFF`,`0x19`,`0xFF`,`0x00`,`0xFF`,`0xFF`],SET_DEVICE_BUTTON_OP_FN_CMD:[`0x5C`,`0x39`,`0x23`,`0xED`,`0x01`,`0x1b`,`0x01`,`0xFF`,`0x00`],SET_DEVICE_BUTTON_DEL_CMD:[`0x5C`,`0x39`,`0x23`,`0xED`,`0x01`,`0x00`,`0x08`,`0x00`,`0x00`,`0x00`,`0x08`,`0x00`,`0x00`,`0x00`,`0x00`],SET_DEVICE_BUTTON_JOURNEY_CMD:[`0xFF`,`0x04`,`0x00`,`0x00`],SET_RESET_BUTTON_JOURNEY_CMD:[`0xFF`,`0x08`,`0x00`,`0x00`,`0xFF`,`0x04`,`0xd0`,`0x07`],SET_DEVICE_BUTTON_RT_CMD:[`0xFF`,`0x08`,`0x20`,`0x00`,`0xFF`,`0x14`,`0x00`,`0x00`,`0xFF`,`0x15`,`0x00`,`0x00`],SET_DEVICE_BUTTON_SAFEZONE_CMD:[`0xFF`,`0x16`,`0x00`,`0x00`,`0xFF`,`0x17`,`0x00`,`0x00`],SET_RESET_BUTTON_RT_CMD:[`0xFF`,`0x08`,`0x00`,`0x00`,`0xFF`,`0x04`,`0xd0`,`0x07`],SET_DEVICE_FUNCTION_TGL_CMD:`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(`.`),SET_DEVICE_FUNCTION_END_CMD:`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(`.`),SET_DEVICE_FUNCTION_MT_CMD:`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(`.`),SET_DEVICE_FUNCTION_RS_CMD:`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(`.`),SET_DEVICE_FUNCTION_MPT_CMD:`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(`.`),SET_DEVICE_FUNCTION_DKS_CMD:`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(`.`),SET_DEVICE_FUNCTION_SOCD_CMD:`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(`.`),MACRO_TYPE_CMD:{DELAY:[`0x06`,`0x00`,`0x00`],KEY_DOWN:[`0x84`,`0x00`,`0x00`],KEY_UP:[`0x04`,`0x00`,`0x00`],MOUSE_X:[`0x85`,`0x00`,`0x00`],MOUSE_Y:[`0x05`,`0x00`,`0x00`]},SET_DEVICE_FUNCTION_MACRO_CMD:[`0x5C`,`0x00`,`0x20`,`0xFF`,`0x01`,`0xFF`,`0xFF`,`0x00`],SET_DEVICE_SIGN1_CMD:[`0x5C`,`0x27`,`0x08`,`0xBF`,`0x02`],SET_DEVICE_SIGN2_CMD:[`0x5C`,`0x27`,`0x08`,`0xBF`,`0x03`],SET_DEVICE_SIGN_ERASE_CMD:[`0x5C`,`0x09`,`0x09`,`0xA2`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0xFF`,`0x00`,`0x00`],SET_DEVICE_SIGN3_CMD:`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(`.`),SET_DEVICE_SIGN4_CMD:[`0x5C`,`0x27`,`0x08`,`0xBF`,`0x04`],SET_DEVICE_SIGN5_CMD:[`0x5C`,`0x27`,`0x08`,`0xBF`,`0x06`],SET_DEVICE_SIGN6_CMD:[`0x5C`,`0x27`,`0x08`,`0xBF`,`0x05`],SET_DEVICE_SIGN_REBOOT_CMD:[`0x5C`,`0x02`,`0x0A`,`0x9C`,`0xFF`,`0xFF`,`0x00`,`0x00`,`0x00`],READ_DEVICE_APP_CRC_CMD:[`0x5C`,`0x0A`,`0x0E`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0xFF`,`0xFF`],SET_DEVICE_SIGN_APP_CMD:[`0x5C`,`0x0A`,`0x0B`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`,`0x00`],SET_DEVICE_WRITE_FIRMWARE_CMD:[`0x5C`,`0xFA`,`0x0C`,`0xFF`,`0x00`,`0x00`,`0x00`,`0x00`,`0xF4`,`0x00`]},n={KEYMAP:[{Name:`A`,Task:`A`,VKCode:`65`,ScanCode:`30`,Flag:`0`,Hid:`0x04`,Value:`A`},{Name:`B`,Task:`B`,VKCode:`66`,ScanCode:`48`,Flag:`0`,Hid:`0x05`,Value:`B`},{Name:`C`,Task:`C`,VKCode:`67`,ScanCode:`46`,Flag:`0`,Hid:`0x06`,Value:`C`},{Name:`D`,Task:`D`,VKCode:`68`,ScanCode:`32`,Flag:`0`,Hid:`0x07`,Value:`D`},{Name:`E`,Task:`E`,VKCode:`69`,ScanCode:`18`,Flag:`0`,Hid:`0x08`,Value:`E`},{Name:`F`,Task:`F`,VKCode:`70`,ScanCode:`33`,Flag:`0`,Hid:`0x09`,Value:`F`},{Name:`G`,Task:`G`,VKCode:`71`,ScanCode:`34`,Flag:`0`,Hid:`0x0A`,Value:`G`},{Name:`H`,Task:`H`,VKCode:`72`,ScanCode:`35`,Flag:`0`,Hid:`0x0B`,Value:`H`},{Name:`I`,Task:`I`,VKCode:`73`,ScanCode:`23`,Flag:`0`,Hid:`0x0C`,Value:`I`},{Name:`J`,Task:`J`,VKCode:`74`,ScanCode:`36`,Flag:`0`,Hid:`0x0D`,Value:`J`},{Name:`K`,Task:`K`,VKCode:`75`,ScanCode:`37`,Flag:`0`,Hid:`0x0E`,Value:`K`},{Name:`L`,Task:`L`,VKCode:`76`,ScanCode:`38`,Flag:`0`,Hid:`0x0F`,Value:`L`},{Name:`M`,Task:`M`,VKCode:`77`,ScanCode:`50`,Flag:`0`,Hid:`0x10`,Value:`M`},{Name:`N`,Task:`N`,VKCode:`78`,ScanCode:`49`,Flag:`0`,Hid:`0x11`,Value:`N`},{Name:`O`,Task:`O`,VKCode:`79`,ScanCode:`24`,Flag:`0`,Hid:`0x12`,Value:`O`},{Name:`P`,Task:`P`,VKCode:`80`,ScanCode:`25`,Flag:`0`,Hid:`0x13`,Value:`P`},{Name:`Q`,Task:`Q`,VKCode:`81`,ScanCode:`16`,Flag:`0`,Hid:`0x14`,Value:`Q`},{Name:`R`,Task:`R`,VKCode:`82`,ScanCode:`19`,Flag:`0`,Hid:`0x15`,Value:`R`},{Name:`S`,Task:`S`,VKCode:`83`,ScanCode:`31`,Flag:`0`,Hid:`0x16`,Value:`S`},{Name:`T`,Task:`T`,VKCode:`84`,ScanCode:`20`,Flag:`0`,Hid:`0x17`,Value:`T`},{Name:`U`,Task:`U`,VKCode:`85`,ScanCode:`22`,Flag:`0`,Hid:`0x18`,Value:`U`},{Name:`V`,Task:`V`,VKCode:`86`,ScanCode:`47`,Flag:`0`,Hid:`0x19`,Value:`V`},{Name:`W`,Task:`W`,VKCode:`87`,ScanCode:`16`,Flag:`0`,Hid:`0x1A`,Value:`W`},{Name:`X`,Task:`X`,VKCode:`88`,ScanCode:`45`,Flag:`0`,Hid:`0x1B`,Value:`X`},{Name:`Y`,Task:`Y`,VKCode:`89`,ScanCode:`21`,Flag:`0`,Hid:`0x1C`,Value:`Y`},{Name:`Z`,Task:`Z`,VKCode:`90`,ScanCode:`44`,Flag:`0`,Hid:`0x1D`,Value:`Z`},{Name:`0`,Task:`0`,VKCode:`48`,ScanCode:`11`,Flag:`0`,Hid:`0x27`,Value:`U0`},{Name:`1`,Task:`1`,VKCode:`49`,ScanCode:`2`,Flag:`0`,Hid:`0x1E`,Value:`U1`},{Name:`2`,Task:`2`,VKCode:`50`,ScanCode:`3`,Flag:`0`,Hid:`0x1F`,Value:`U2`},{Name:`3`,Task:`3`,VKCode:`51`,ScanCode:`4`,Flag:`0`,Hid:`0x20`,Value:`U3`},{Name:`4`,Task:`4`,VKCode:`52`,ScanCode:`5`,Flag:`0`,Hid:`0x21`,Value:`U4`},{Name:`5`,Task:`5`,VKCode:`53`,ScanCode:`6`,Flag:`0`,Hid:`0x22`,Value:`U5`},{Name:`6`,Task:`6`,VKCode:`54`,ScanCode:`7`,Flag:`0`,Hid:`0x23`,Value:`U6`},{Name:`7`,Task:`7`,VKCode:`55`,ScanCode:`8`,Flag:`0`,Hid:`0x24`,Value:`U7`},{Name:`8`,Task:`8`,VKCode:`56`,ScanCode:`9`,Flag:`0`,Hid:`0x25`,Value:`U8`},{Name:`9`,Task:`9`,VKCode:`57`,ScanCode:`10`,Flag:`0`,Hid:`0x26`,Value:`U9`},{Name:`Num Lock`,Task:`Num LOCK`,VKCode:`144`,ScanCode:`69`,Flag:`1`,Hid:`0x53`,Value:`NUMLOCK`},{Name:`Num /`,Task:`Num /`,VKCode:`111`,ScanCode:`53`,Flag:`1`,Hid:`0x54`,Value:`NUMSLASH`},{Name:`Num *`,Task:`Num *`,VKCode:`106`,ScanCode:`55`,Flag:`0`,Hid:`0x55`,Value:`NUMSTAR`},{Name:`Num `,Task:`Num `,VKCode:`109`,ScanCode:`74`,Flag:`0`,Hid:`0x56`,Value:`NUMMINUS`},{Name:`Num +`,Task:`Num +`,VKCode:`107`,ScanCode:`78`,Flag:`0`,Hid:`0x57`,Value:`NUMPLUS`},{Name:`Num Enter`,Task:`Num ENTER`,VKCode:`13`,ScanCode:`28`,Flag:`1`,Hid:`0x58`,Value:`NUMENTER`},{Name:`Num .`,Task:`Num .`,VKCode:`110`,ScanCode:`83`,Flag:`0`,Hid:`0x63`,Value:`NUMPERIOD`},{Name:`Num 0`,Task:`Num 0`,VKCode:`96`,ScanCode:`82`,Flag:`0`,Hid:`0x62`,Value:`Num 0`},{Name:`Num 1`,Task:`Num 1`,VKCode:`97`,ScanCode:`79`,Flag:`0`,Hid:`0x59`,Value:`Num 1`},{Name:`Num 2`,Task:`Num 2`,VKCode:`98`,ScanCode:`80`,Flag:`0`,Hid:`0x5A`,Value:`Num 2`},{Name:`Num 3`,Task:`Num 3`,VKCode:`99`,ScanCode:`81`,Flag:`0`,Hid:`0x5B`,Value:`Num 3`},{Name:`Num 4`,Task:`Num 4`,VKCode:`100`,ScanCode:`75`,Flag:`0`,Hid:`0x5C`,Value:`Num 4`},{Name:`Num 5`,Task:`Num 5`,VKCode:`101`,ScanCode:`76`,Flag:`0`,Hid:`0x5D`,Value:`Num 5`},{Name:`Num 6`,Task:`Num 6`,VKCode:`102`,ScanCode:`77`,Flag:`0`,Hid:`0x5E`,Value:`Num 6`},{Name:`Num 7`,Task:`Num 7`,VKCode:`103`,ScanCode:`71`,Flag:`0`,Hid:`0x5F`,Value:`Num 7`},{Name:`Num 8`,Task:`Num 8`,VKCode:`104`,ScanCode:`72`,Flag:`0`,Hid:`0x60`,Value:`Num 8`},{Name:`Num 9`,Task:`Num 9`,VKCode:`105`,ScanCode:`73`,Flag:`0`,Hid:`0x61`,Value:`Num 9`},{Name:`Esc`,Task:`Esc`,VKCode:`27`,ScanCode:`1`,Flag:`0`,Hid:`0x29`,Value:`Esc`},{Name:`F1`,Task:`F1`,VKCode:`112`,ScanCode:`59`,Flag:`0`,Hid:`0x3A`,Value:`F1`},{Name:`F2`,Task:`F2`,VKCode:`113`,ScanCode:`60`,Flag:`0`,Hid:`0x3B`,Value:`F2`},{Name:`F3`,Task:`F3`,VKCode:`114`,ScanCode:`61`,Flag:`0`,Hid:`0x3C`,Value:`F3`},{Name:`F4`,Task:`F4`,VKCode:`115`,ScanCode:`62`,Flag:`0`,Hid:`0x3D`,Value:`F4`},{Name:`F5`,Task:`F5`,VKCode:`116`,ScanCode:`63`,Flag:`0`,Hid:`0x3E`,Value:`F5`},{Name:`F6`,Task:`F6`,VKCode:`117`,ScanCode:`64`,Flag:`0`,Hid:`0x3F`,Value:`F6`},{Name:`F7`,Task:`F7`,VKCode:`118`,ScanCode:`65`,Flag:`0`,Hid:`0x40`,Value:`F7`},{Name:`F8`,Task:`F8`,VKCode:`119`,ScanCode:`66`,Flag:`0`,Hid:`0x41`,Value:`F8`},{Name:`F9`,Task:`F9`,VKCode:`120`,ScanCode:`67`,Flag:`0`,Hid:`0x42`,Value:`F9`},{Name:`F10`,Task:`F10`,VKCode:`121`,ScanCode:`68`,Flag:`0`,Hid:`0x43`,Value:`F10`},{Name:`F11`,Task:`F11`,VKCode:`122`,ScanCode:`87`,Flag:`0`,Hid:`0x44`,Value:`F11`},{Name:`F12`,Task:`F12`,VKCode:`123`,ScanCode:`88`,Flag:`0`,Hid:`0x45`,Value:`F12`},{Name:"`",Task:"`",VKCode:`192`,ScanCode:`41`,Flag:`0`,Hid:`0x35`,Value:`TILDE`},{Name:`-`,Task:`-`,VKCode:`189`,ScanCode:`12`,Flag:`0`,Hid:`0x2D`,Value:`MINUS`},{Name:`+`,Task:`+`,VKCode:`187`,ScanCode:`13`,Flag:`0`,Hid:`0x2E`,Value:`EQUAL`},{Name:`Backspace`,Task:`BACKSPACE`,VKCode:`8`,ScanCode:`14`,Flag:`0`,Hid:`0x2A`,Value:`Backspace`},{Name:`[`,Task:`[`,VKCode:`219`,ScanCode:`26`,Flag:`0`,Hid:`0x2F`,Value:`LBRACKET`},{Name:`]`,Task:`]`,VKCode:`221`,ScanCode:`27`,Flag:`0`,Hid:`0x30`,Value:`RBRACKET`},{Name:`\\`,Task:`\\`,VKCode:`220`,ScanCode:`43`,Flag:`0`,Hid:`0x31`,Value:`BACKSLASH`},{Name:`;`,Task:`;`,VKCode:`186`,ScanCode:`39`,Flag:`0`,Hid:`0x33`,Value:`SEMICOLON`},{Name:`'`,Task:`'`,VKCode:`222`,ScanCode:`40`,Flag:`0`,Hid:`0x34`,Value:`QUOTE`},{Name:`Enter`,Task:`ENTER`,VKCode:`13`,ScanCode:`28`,Flag:`0`,Hid:`0x28`,Value:`Enter`},{Name:`,`,Task:`,`,VKCode:`188`,ScanCode:`51`,Flag:`0`,Hid:`0x36`,Value:`COMMA`},{Name:`.`,Task:`.`,VKCode:`190`,ScanCode:`52`,Flag:`0`,Hid:`0x37`,Value:`PERIOD`},{Name:`/`,Task:`/`,VKCode:`191`,ScanCode:`53`,Flag:`0`,Hid:`0x38`,Value:`SLASH`},{Name:`Tab`,Task:`Tab`,VKCode:`9`,ScanCode:`15`,Flag:`0`,Hid:`0x2B`,Value:`Tab`},{Name:`CapsLock`,Task:`CAPSLOCK`,VKCode:`20`,ScanCode:`58`,Flag:`0`,Hid:`0x39`,Value:`CAPSLOCK`},{Name:`Ctrl`,Task:`LCTRL`,VKCode:`162`,ScanCode:`29`,Flag:`0`,Hid:`0xE0`,Value:`LCTRL`},{Name:`Shift`,Task:`LSHIFT`,VKCode:`160`,ScanCode:`42`,Flag:`0`,Hid:`0xE1`,Value:`LSHIFT`},{Name:`Alt`,Task:`LALT`,VKCode:`164`,ScanCode:`56`,Flag:`0`,Hid:`0xE2`,Value:`LALT`},{Name:`Win`,Task:`LWIN`,VKCode:`91`,ScanCode:`91`,Flag:`1`,Hid:`0xE3`,Value:`LWIN`},{Name:`Ctrl`,Task:`RCTRL`,VKCode:`163`,ScanCode:`29`,Flag:`1`,Hid:`0xE4`,Value:`RCTRL`},{Name:`Shift`,Task:`RSHIFT`,VKCode:`161`,ScanCode:`54`,Flag:`1`,Hid:`0xE5`,Value:`RSHIFT`},{Name:`Alt`,Task:`RALT`,VKCode:`165`,ScanCode:`56`,Flag:`1`,Hid:`0xE6`,Value:`RALT`},{Name:`Win`,Task:`RWIN`,VKCode:`91`,ScanCode:`92`,Flag:`1`,Hid:`0xE7`,Value:`RWIN`},{Name:`Menu`,Task:`Menu`,VKCode:`93`,ScanCode:`93`,Flag:`1`,Hid:`0x65`,Value:`Menu`},{Name:`Space`,Task:`Space`,VKCode:`32`,ScanCode:`57`,Flag:`0`,Hid:`0x2C`,Value:`Space`},{Name:`Space`,Task:`Space`,VKCode:`32`,ScanCode:`57`,Flag:`0`,Hid:`0xF0`,Value:`Space`},{Name:`Space`,Task:`Space`,VKCode:`32`,ScanCode:`57`,Flag:`0`,Hid:`0xF1`,Value:`Space`},{Name:`Print Screen`,Task:`PRINTSCREEN`,VKCode:`44`,ScanCode:`55`,Flag:`1`,Hid:`0x46`,Value:`PRINTSCREEN`},{Name:`Scroll Lock`,Task:`SCROLLLOCK`,VKCode:`145`,ScanCode:`70`,Flag:`0`,Hid:`0x47`,Value:`SCROLLLOCK`},{Name:`Pause`,Task:`PAUSE`,VKCode:`19`,ScanCode:`69`,Flag:`0`,Hid:`0x48`,Value:`PAUSE`},{Name:`Insert`,Task:`INSERT`,VKCode:`45`,ScanCode:`82`,Flag:`1`,Hid:`0x49`,Value:`INSERT`},{Name:`Home`,Task:`HOME`,VKCode:`36`,ScanCode:`71`,Flag:`1`,Hid:`0x4A`,Value:`HOME`},{Name:`PgUp`,Task:`PAGEUP`,VKCode:`33`,ScanCode:`73`,Flag:`1`,Hid:`0x4B`,Value:`PAGEUP`},{Name:`Delete`,Task:`DELETE`,VKCode:`46`,ScanCode:`83`,Flag:`1`,Hid:`0x4C`,Value:`DELETE`},{Name:`End`,Task:`END`,VKCode:`35`,ScanCode:`79`,Flag:`1`,Hid:`0x4D`,Value:`END`},{Name:`PgDn`,Task:`PAGEDOWN`,VKCode:`34`,ScanCode:`81`,Flag:`1`,Hid:`0x4E`,Value:`PAGEDOWN`},{Name:`Up`,Task:`UP`,VKCode:`38`,ScanCode:`72`,Flag:`1`,Hid:`0x52`,Value:`Up`},{Name:`Down`,Task:`DOWN`,VKCode:`40`,ScanCode:`80`,Flag:`1`,Hid:`0x51`,Value:`Down`},{Name:`Left`,Task:`LEFT`,VKCode:`37`,ScanCode:`75`,Flag:`1`,Hid:`0x50`,Value:`Left`},{Name:`Right`,Task:`Right`,VKCode:`39`,ScanCode:`77`,Flag:`1`,Hid:`0x4F`,Value:`Right`},{Name:`MUTE`,Task:`MUTE`,VKCode:`7F`,Hid:`0x7F`,Value:`MUTE`},{Name:`CALC`,Task:`CALC`,VKCode:`7F`,Hid:`0x92`,Value:`CALC`},{Name:`VOICE +`,Task:`VOICE +`,VKCode:`7F`,Hid:`0x80`,Value:`VOICE +`},{Name:`VOICE `,Task:`VOICE `,VKCode:`7F`,Hid:`0x81`,Value:`VOICE `},{Name:`FN`,Task:`FN`,VKCode:`91`,Hid:`0x01`,Value:`FN`},{Name:`FN2`,Task:`FN2`,VKCode:`91`,Hid:`0x02`,Value:`FN2`},{Name:`FN3`,Task:`FN3`,VKCode:`91`,Hid:`0x03`,Value:`FN3`}]},r={protocolVer:1,lastBinVer:-1,curDeviceMode:null,curDeviceHandle:null,curWebHandle:null,manualUrl:``,ConnectMode:0,Battery:0,Ischarge:0,kaleidoscope:0,FirmwareID:-1,FirmwareVer:-1,FirmwareNum:-1,FirmwareFull:-1,RunMode:-1,SN:-1,SNDatas:-1,SignDatas:-1,SignSN:-1,SignCRC:-1,ProfileIndex:0,curWebSite:``,reteVal:0,lodVal:0,macStatus:0,winKeyStatus:0,FirstFlag:-1,SerialNumber:-1,modeLigth:1,modeChildLigth:1,brightnessLigth:1,speedLigth:1,sleep:2,modeLigthLogo:-1,modeChildLigthLogo:0,brightnessLigthLogo:0,speedLigthLogo:0,sleepLogo:0,journey_global:2,rt_all_journey:0,curMaxJourney:0,curMaxJourneyKeyStatus:0,keyMapStructure:{index:-1,key_name:``,name:``,hid:0,axisSet:{brand:``,name:``,model:``},journey:0,adc_data:0,key_status:0,fn:0,fn_custom:{fn_code:``,type:``,name:``,content:``},is_set:1,custom:{type:``,name:``,content:``},journey_RT:{down:`-`,up:`-`},journey_global:`-`,safe_zone_top:`-`,safe_zone_bottom:`-`,journey_trigger:`-`,select:0,working_mode:0,axis:0,routeAxis:0,ARGB:0,RGB:`#ffffff`},DPIS:[],MatrixList:{MatrixKey:[],MatrixADCTemp:[],MatrixADC:[],MatrixJourneyTemp:[],MatrixJourney:[],MatrixLayout0Temp:[],MatrixLayout0:[],MatrixLayout1Temp:[],MatrixLayout1:[],MatrixLayout4Temp:[],MatrixLayout4:[],MatrixLayout14Temp:[],MatrixLayout14:[],MatrixLayout15Temp:[],MatrixLayout15:[],MatrixLayout16Temp:[],MatrixLayout16:[],MatrixLayout17Temp:[],MatrixLayout17:[],MatrixLayout19Temp:[],MatrixLayout19:[],MatrixLayout8Temp:[],MatrixLayout8:[],MatrixKeyStatus:[],KeyMap:[]},keyMapIndexByHid:null,ListenID:-1,typeMatrixID:-1,typeMatrixPageID:-1,inPage:0,log(e,t){let n=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=``;switch(e){case 0:i=`LOG`,a=`color: blue;`;break;case 1:i=`SUCCESS`,a=`color: green;`;break;case 2:i=`WARNING`,a=`color: orange;`;break;case 3:i=`ERROR`,a=`color: red; font-weight: bold;`;break;default:i=`LOG`,a=``;break}console.log(`%c${r} [${i}] ${t}`,a)},unpack(e){let t=[];for(let n=0;n<e.length;n+=10)t.push(e.slice(n,n+10));return t},padTo512(e){let t=e.length,n=Math.ceil(t/65536)*65536,r=new Uint8Array(n);r.set(e);for(let e=t;e<n;e++)r[e]=255;return r},padToPackage540(e){let t=e.length,n=Math.ceil(t/540)*540,r=new Uint8Array(n);r.set(e);for(let e=t;e<n;e++)r[e]=255;return r},getHighLowBits32(e){let t=(e&4294901760)>>16,n=e&65535;if(e>=0&&e<=4294967295){let e=[n&255,n>>8,t&255,t>>8];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}else throw Error(`The decimal number must be between 0 and 65535.`)},getGifBufferCommand(e,t){let n=t.SET_DEVICE_WRITE_IMAGE_START_CMD,r=[];for(let t=0;t<e.length;t+=512){let i=e.slice(t,t+512);i=this.padToPackage540(i);for(let e=0;e<i.length;e+=54){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);s=this.getHighLowBits(s),a[3]=parseInt(s[0],16),r.push(a)}}return this.unpack(r)},redMatrix(e){let t=new Uint8Array(e.READ_DEFKEY_MATRIX_CMD.ROW1_ROW2.map(e=>parseInt(e,16)));this.curDeviceHandle.sendReport(0,t),setTimeout(()=>{let t=new Uint8Array(e.READ_DEFKEY_MATRIX_CMD.ROW3_ROW4.map(e=>parseInt(e,16)));this.curDeviceHandle.sendReport(0,t)},500),setTimeout(()=>{let t=new Uint8Array(e.READ_DEFKEY_MATRIX_CMD.ROW5_ROW6.map(e=>parseInt(e,16)));this.curDeviceHandle.sendReport(0,t)},1e3)},sendHidDataCallBack(){this.curWebHandle.refreshHIDeviceData()},getCRC(e,t,n){return 145+parseInt(e,16)+parseInt(t,16)+parseInt(n,16)},getCRC1(e,t,n){return 187+e+t+n},getWorkingMode(e,t){switch(e&=15,e){case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.DKS):return`DKS`;case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.SOCD):return`SOCD`;case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.MPT):return`MPT`;case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.MT):return`MT`;case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.END):return`END`;case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.TGL):return`TGL`;case parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_MODE_CODE.RS):return`RS`}return``},getBottonHidOJBFromName(e,t){t=this.isNumber(parseInt(t))?`U`+t:t,t=t==`\\`?`\\\\`:t,t=t==`=`?`+`:t;let n=null,r=e.KEYMAP;for(var i in r)if(r[i].Value==t){n=r[i];break}return n??=this.getBottonHidOJBFromTask(e,t),n},getBottonHidOJBFromTask(e,t){t=this.isNumber(parseInt(t))?`U`+t:t,t=t==`\\`?`\\\\`:t,t=t==`=`?`+`:t;let n=null,r=e.KEYMAP;for(var i in r)if(r[i].Task==t){n=r[i];break}return n??=this.getBottonHidOJBFromName(e,t),n},getBottonHidOJBFromHID(e,t){let n=e.KEYMAP;for(var r in n)if(parseInt(n[r].Hid,16)==t)return n[r]},getBottonHidOJBFromHIDMedia(e,t){for(let n in e)for(let r in e[n])if(t==e[n][r].code)return e[n][r]},startListeningNormal(e){let t=this;this.ListenID=setInterval(function(){setTimeout(()=>{let n=new Uint8Array(e.READ_RM6X21_HALL_16BIT_CMD.ROW1_ROW3.map(e=>parseInt(e,16)));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)},1),setTimeout(()=>{let n=new Uint8Array(e.READ_RM6X21_HALL_16BIT_CMD.ROW4_ROW6.map(e=>parseInt(e,16)));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)},10),setTimeout(()=>{let n=new Uint8Array(e.READ_RM6X21_ADC_16BIT_CMD.ROW1_ROW3.map(e=>parseInt(e,16)));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)},20),setTimeout(()=>{let n=new Uint8Array(e.READ_RM6X21_ADC_16BIT_CMD.ROW4_ROW6.map(e=>parseInt(e,16)));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)},30),setTimeout(()=>{let n=new Uint8Array(e.READ_RM6X21_KEYSTATUS_8BIT_CMD.map(e=>parseInt(e,16)));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)},40)},60)},formatJourneyMapMatrix(){let e=0;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++},setARGBKey(e,t){let n=this.toHexStringArr(e).slice(5,61);if(!t.keyMapIndexByHid){t.keyMapIndexByHid={};for(let e=0;e<t.MatrixList.KeyMap.length;e++)for(let n=0;n<t.MatrixList.KeyMap[e].length;n++){let r=t.MatrixList.KeyMap[e][n];t.keyMapIndexByHid[String(r.hid)]={i:e,j:n}}}for(let e=0;e<n.length;e+=4){let r=n[e],i=t.keyMapIndexByHid[String(r)];if(!i)continue;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];s.ARGB===a&&s.RGB===o||(s.ARGB=a,s.RGB=o,s.lightStyle=`--bgcolor:`+o+`;--bgAcolor:rgb(`+a+`,0.1)`)}},setMatrixJourneyHeadData(e,t){let n=this.toHexStringArr(e);if(this.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_HALL_CODE)&&this.typeMatrixPageID==1){let e=n.slice(6,64);this.MatrixList.MatrixJourneyTemp=e,this.inPage=1}else if(this.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_HALL_CODE)){let e=n.slice(6,64);this.MatrixList.MatrixJourneyTemp.push.apply(this.MatrixList.MatrixJourneyTemp,e),this.inPage=1}else if(this.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_ORIGINAL_CODE)&&this.typeMatrixPageID==1){let e=n.slice(6,64);this.MatrixList.MatrixADCTemp=e,this.inPage=1}else if(this.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_ORIGINAL_CODE)){let e=n.slice(6,64);this.MatrixList.MatrixADCTemp.push.apply(this.MatrixList.MatrixADCTemp,e),this.inPage=1}else if(this.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.KEY_STATUS_CODE)){this.inPage=1,this.formatJourney(),this.formatJourneyMapMatrix(),this.sendHidDataCallBack(),this.curMaxJourneyKeyStatus=0;let e=n.slice(6,64);this.MatrixList.MatrixKeyStatus=e}},setMatrixJourneyNOHeadData(e,t){if(this.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_HALL_CODE)){this.inPage++;let t=this.toHexStringArr(e),n=this.inPage==3?4:64,r=t.slice(0,n);this.MatrixList.MatrixJourneyTemp.push.apply(this.MatrixList.MatrixJourneyTemp,r)}else if(this.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.ADC_ORIGINAL_CODE)){this.inPage++;let t=this.toHexStringArr(e),n=this.inPage==3?4:64,r=t.slice(0,n);this.MatrixList.MatrixADCTemp.push.apply(this.MatrixList.MatrixADCTemp,r)}else if(this.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_CODE.KEY_STATUS_CODE)){this.inPage++;let t=this.toHexStringArr(e),n=this.inPage==3?4:64,r=t.slice(0,n);this.MatrixList.MatrixKeyStatus.push.apply(this.MatrixList.MatrixKeyStatus,r)}},formatJourney(){this.MatrixList.MatrixJourney=[],this.MatrixList.MatrixJourneyTemp=this.MatrixList.MatrixJourneyTemp.slice(0,252);for(var e=0;e<this.MatrixList.MatrixJourneyTemp.length;e++)if(e%2==0){var t=parseInt(this.MatrixList.MatrixJourneyTemp[e+1],16);t=(t&255)<<8|(t&65280)>>8;var n=t+parseInt(this.MatrixList.MatrixJourneyTemp[e],16);this.MatrixList.MatrixJourney.push(n)}this.MatrixList.MatrixADC=[],this.MatrixList.MatrixADCTemp=this.MatrixList.MatrixADCTemp.slice(0,252);for(var e=0;e<this.MatrixList.MatrixADCTemp.length;e++)if(e%2==0){var t=parseInt(this.MatrixList.MatrixADCTemp[e+1],16);t=(t&255)<<8|(t&65280)>>8;var n=t+parseInt(this.MatrixList.MatrixADCTemp[e],16);this.MatrixList.MatrixADC.push(n)}for(var e in this.MatrixList.MatrixKeyStatus)this.MatrixList.MatrixKeyStatus[e]=parseInt(this.MatrixList.MatrixKeyStatus[e],16);this.curMaxJourneyKeyStatus=this.getMaxValue(this.MatrixList.MatrixKeyStatus),this.curMaxJourney=this.getMaxValue(this.MatrixList.MatrixJourney),this.curMaxJourney/=1e3},setGlobalJourneyData(e,t){let n=this.toHexStringArr(e);var r=parseInt(n[8],16);r=(r&255)<<8|(r&65280)>>8,t.journey_global=(r+parseInt(n[7],16))/1e3},setGlobalLigthData(e,t){let n=this.toHexStringArr(e);t.modeLigth=n[43],t.modeChildLigth=n[41],t.brightnessLigth=n[42],t.speedLigth=n[44],t.sleep=n[45]},setGlobalLigthLogoData(e,t){let n=this.toHexStringArr(e);t.modeLigthLogo=n[43],t.modeChildLigthLogo=n[41],t.brightnessLigthLogo=n[42],t.speedLigthLogo=n[44],t.sleepLogo=n[45]},getDGVal(e,t){var n=parseInt(t,16);return n=(n&255)<<8|(n&65280)>>8,n+parseInt(e,16)},setAdvancedFuncData(e,t,n,r){let i=n.MatrixList.KeyMap,a=function(e,t,r){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)},o=this.toHexStringArr(e);switch(parseInt(o[2],16)){case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.SOCD):{let e=this.getBottonHidOJBFromHID(r,parseInt(o[5],16)),t=this.getBottonHidOJBFromHID(r,parseInt(o[6],16)),n=e.Value+`|`+t.Value;a(e.Value,`SOCD`,n)}break;case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.DKS):{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));o[10],o[11],o[12],o[13];let c=e.Value+`,`+t.Value+`|`+n.Value+`|`+i.Value+`|`+s.Value;a(e.Name,`DKS`,c)}break;case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.MPT):{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));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;let u=e.Value+`|`+t.Value+`|`+s+`|`+n.Value+`|`+c+`|`+i.Value+`|`+l;a(e.Name,`MPT`,u)}break;case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.MT):{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;a(e.Name,`MT`,i)}break;case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.END):{let e=this.getBottonHidOJBFromHID(r,parseInt(o[5],16)),t=this.getBottonHidOJBFromHID(r,parseInt(o[6],16)),n=e.Value+`|`+t.Value;a(e.Name,`END`,n)}break;case parseInt(t.RESPONSE_CODE.MATRIX6X21_ADVANCED_FUNC_CODE.TGL):{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;a(e.Name,`TGL`,i)}break}},getCurrentConfig(e){let t=this.toHexStringArr(e);return parseInt(t[6],16)},setGlobalFuncData(e,t,n){let r=this.toHexStringArr(e);if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.MAC))n.macStatus=parseInt(r[6],16);else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.WIN_KEY_STATUS))n.winKeyStatus=parseInt(r[6],16);else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.RETE))n.reteVal=parseInt(r[6],16);else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.LOD))n.lodVal=parseInt(r[6],16);else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.SLEEP))n.sleep=parseInt(r[6],16);else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.DPI)){var i=parseInt(r[9],16);i=(i&255)<<8|(i&65280)>>8;var a=i+parseInt(r[8],16),o=parseInt(r[12],16);o=(o&255)<<8|(o&65280)>>8;var s=o+parseInt(r[11],16);let e={index:parseInt(r[6],16),x:a,y:s,is_cur:parseInt(r[13],16),is_activate:parseInt(r[14],16)};n.DPIS.push(e)}else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.SITE)){let t=new TextDecoder;n.curWebSite=this.trimSpaces(t.decode(e.slice(6,parseInt(r[1],16)+3)))}else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.FIRST_FLAG))n.FirstFlag=parseInt(r[6],16);else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.SERIAL_NUMBER)){var c=parseInt(r[8],16);c=(c&255)<<8|(c&65280)>>8;var l=c+parseInt(r[7],16);l>2e4&&(c=parseInt(r[7],16),c=(c&255)<<8|(c&65280)>>8,l=c+parseInt(r[6],16)),n.SerialNumber=l}else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.PROFILE_INDEX))n.ProfileIndex=parseInt(r[6],16);else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.FUNC_TYPE_CMD.RT_ALL))n.rt_all_journey=parseInt(r[6],16);else if(parseInt(r[5],16)==parseInt(t.RESPONSE_CODE.GLOBAL_BATTERY_CODE)){let e=parseInt(r[6],16),t=parseInt(r[7],16);n.Battery=e,n.Ischarge=t}},setUpgradeSignFuncData(e,t,n){this.toHexStringArr(e);{let t=new TextDecoder;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)}},setUpgradeCRCData(e,t,n){n.SignCRC=e.slice(13,15)},setMatrixLayoutData(e,t,n){let r=this.toHexStringArr(e);if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.FN0)&&n.typeMatrixPageID==1){let e=r.slice(5,61);n.MatrixList.MatrixLayout0Temp=e}else if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.FN0)){let e=r.slice(5,61);n.MatrixList.MatrixLayout0Temp.push.apply(n.MatrixList.MatrixLayout0Temp,e)}if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.FN1)&&n.typeMatrixPageID==1){let e=r.slice(5,61);n.MatrixList.MatrixLayout1Temp=e}else if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.FN1)){let e=r.slice(5,61);n.MatrixList.MatrixLayout1Temp.push.apply(n.MatrixList.MatrixLayout1Temp,e)}if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.JOURNEY4)&&n.typeMatrixPageID==1){let e=r.slice(5,61);n.MatrixList.MatrixLayout4Temp=e}else if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.JOURNEY4)){let e=r.slice(5,61);n.MatrixList.MatrixLayout4Temp.push.apply(n.MatrixList.MatrixLayout4Temp,e)}if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.RTDOWN14)&&n.typeMatrixPageID==1){let e=r.slice(5,61);n.MatrixList.MatrixLayout14Temp=e}else if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.RTDOWN14)){let e=r.slice(5,61);n.MatrixList.MatrixLayout14Temp.push.apply(n.MatrixList.MatrixLayout14Temp,e)}if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.RTUP15)&&n.typeMatrixPageID==1){let e=r.slice(5,61);n.MatrixList.MatrixLayout15Temp=e}else if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.RTUP15)){let e=r.slice(5,61);n.MatrixList.MatrixLayout15Temp.push.apply(n.MatrixList.MatrixLayout15Temp,e)}if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.SAFE16)&&n.typeMatrixPageID==1){let e=r.slice(5,61);n.MatrixList.MatrixLayout16Temp=e}else if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.SAFE16)){let e=r.slice(5,61);n.MatrixList.MatrixLayout16Temp.push.apply(n.MatrixList.MatrixLayout16Temp,e)}if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.SAFE17)&&n.typeMatrixPageID==1){let e=r.slice(5,61);n.MatrixList.MatrixLayout17Temp=e}else if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.SAFE17)){let e=r.slice(5,61);n.MatrixList.MatrixLayout17Temp.push.apply(n.MatrixList.MatrixLayout17Temp,e)}if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.AXIS19)&&n.typeMatrixPageID==1){let e=r.slice(5,61);n.MatrixList.MatrixLayout19Temp=e}else if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.AXIS19)){let e=r.slice(5,61);n.MatrixList.MatrixLayout19Temp.push.apply(n.MatrixList.MatrixLayout19Temp,e)}if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.MODE)&&n.typeMatrixPageID==1){let e=r.slice(5,61);n.MatrixList.MatrixLayout8Temp=e}else if(n.typeMatrixID==parseInt(t.RESPONSE_CODE.MATRIX6X21_LAYOUT_CODE.MODE)){let e=r.slice(5,61);n.MatrixList.MatrixLayout8Temp.push.apply(n.MatrixList.MatrixLayout8Temp,e)}},formatLayout0(e,t,n,r){this.MatrixList.MatrixLayout0=[];for(var i=0;i<this.MatrixList.MatrixLayout0Temp.length;i++)if(i%4==0){let r=this.MatrixList.MatrixLayout0Temp[i],a=parseInt(this.MatrixList.MatrixLayout0Temp[i+2],16),o=parseInt(this.MatrixList.MatrixLayout0Temp[i+3],16);o&=240;let s={hid:r,type:``,name:``,content:``};if(a==parseInt(r,16))continue;switch(o){case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.KEY,16):s.name=this.getBottonHidOJBFromHID(t,a).Name,s.type=s.name;break;case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA1,16):case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA2,16):case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA3,16):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;break;case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.HOTKEY,16):{a=`0x`+this.MatrixList.MatrixLayout0Temp[i+2].toString(16)+`,0x`+this.MatrixList.MatrixLayout0Temp[i+3].toString(16);let e=this.getBottonHidOJBFromHIDMedia(n,a);if(e)s.name=e.name,s.type=s.name;else{let e=a.split(`,`),n=this.getBottonHidOJBFromHID(t,e[0]);s.type=this.parseHotKeyCommand(parseInt(e[1],16))+n.Name}}break;case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MOUSE,16):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;break;case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.SYS,16):case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.SYS1,16):{a=`0x`+this.MatrixList.MatrixLayout0Temp[i+2].toString(16)+`,0x`+this.MatrixList.MatrixLayout0Temp[i+3].toString(16);let e=this.getBottonHidOJBFromHIDMedia(n,a);e?(s.name=e.name,s.type=s.name):(console.log(a),s.type=`SYS`)}break;case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MACRO,16):s.type=`MACRO`;break;default:console.log(o),s.type=`FUNC`;break}this.MatrixList.MatrixLayout0.push(s)}let a=0;for(var i=0;i<6;i++)for(var o=0;o<21;o++){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);a++}},formatLayout1(e,t,n,r){this.MatrixList.MatrixLayout1=[];for(var i=0;i<this.MatrixList.MatrixLayout1Temp.length;i++)if(i%4==0){let r=this.MatrixList.MatrixLayout1Temp[i],a=parseInt(this.MatrixList.MatrixLayout1Temp[i+2],16),o=parseInt(this.MatrixList.MatrixLayout1Temp[i+3],16);o&=240;let s={hid:r,type:``,name:``,content:``,fn_code:`0x`+this.MatrixList.MatrixLayout1Temp[i+2]+`,0x`+this.MatrixList.MatrixLayout1Temp[i+3]};if(o==0&&a==1||a==parseInt(r,16))continue;switch(o){case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.KEY,16):s.name=this.getBottonHidOJBFromHID(t,a).Name,s.type=s.name;break;case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA1,16):case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA2,16):case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MEDIA3,16):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;break;case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.HOTKEY,16):{a=`0x`+this.MatrixList.MatrixLayout1Temp[i+2].toString(16)+`,0x`+this.MatrixList.MatrixLayout1Temp[i+3].toString(16);let e=this.getBottonHidOJBFromHIDMedia(n,a);if(e)s.name=e.name,s.type=s.name;else{let e=a.split(`,`),n=this.getBottonHidOJBFromHID(t,e[0]);s.type=this.parseHotKeyCommand(parseInt(e[1],16))+n.Name}}break;case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.MOUSE,16):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;break;case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.SYS,16):case parseInt(e.RESPONSE_CODE.CUSTOM_BUTTON_COMMAND_TYPE_CMD.SYS1,16):{a=`0x`+this.MatrixList.MatrixLayout1Temp[i+2].toString(16)+`,0x`+this.MatrixList.MatrixLayout1Temp[i+3].toString(16);let e=this.getBottonHidOJBFromHIDMedia(n,a);e?(s.name=e.name,s.type=s.name):(console.log(a),s.type=`SYS`)}break;default:console.log(o),s.type=`FUNC`;break}this.MatrixList.MatrixLayout1.push(s)}let a=0;for(var i=0;i<6;i++)for(var o=0;o<21;o++){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);a++}},formatLayout4(e){this.MatrixList.MatrixLayout4=[];for(var t=0;t<this.MatrixList.MatrixLayout4Temp.length;t++)if(t%4==0){let e=this.MatrixList.MatrixLayout4Temp[t];var n=parseInt(this.MatrixList.MatrixLayout4Temp[t+3],16);n=(n&255)<<8|(n&65280)>>8;let r={hid:e,journey:n+parseInt(this.MatrixList.MatrixLayout4Temp[t+2],16)};this.MatrixList.MatrixLayout4.push(r)}let r=0;for(var t=0;t<6;t++)for(var i=0;i<21;i++){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);r++}},formatLayout8(e){this.MatrixList.MatrixLayout8=[];for(var t=0;t<this.MatrixList.MatrixLayout8Temp.length;t++)if(t%4==0){let e=this.MatrixList.MatrixLayout8Temp[t];var n=parseInt(this.MatrixList.MatrixLayout8Temp[t+3],16);n=(n&255)<<8|(n&65280)>>8;let r={hid:e,working_mode:n+parseInt(this.MatrixList.MatrixLayout8Temp[t+2],16)};this.MatrixList.MatrixLayout8.push(r)}let r=0;for(var t=0;t<6;t++)for(var i=0;i<21;i++){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);r++}},formatLayout14(e){this.MatrixList.MatrixLayout14=[];for(var t=0;t<this.MatrixList.MatrixLayout14Temp.length;t++)if(t%4==0){let e=this.MatrixList.MatrixLayout14Temp[t];var n=parseInt(this.MatrixList.MatrixLayout14Temp[t+3],16);n=(n&255)<<8|(n&65280)>>8;let r={hid:e,down:n+parseInt(this.MatrixList.MatrixLayout14Temp[t+2],16)};this.MatrixList.MatrixLayout14.push(r)}let r=0;for(var t=0;t<6;t++)for(var i=0;i<21;i++){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);r++}},formatLayout15(e){this.MatrixList.MatrixLayout15=[];for(var t=0;t<this.MatrixList.MatrixLayout15Temp.length;t++)if(t%4==0){let e=this.MatrixList.MatrixLayout15Temp[t];var n=parseInt(this.MatrixList.MatrixLayout15Temp[t+3],16);n=(n&255)<<8|(n&65280)>>8;let r={hid:e,up:n+parseInt(this.MatrixList.MatrixLayout15Temp[t+2],16)};this.MatrixList.MatrixLayout15.push(r)}let r=0;for(var t=0;t<6;t++)for(var i=0;i<21;i++){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);r++}},formatLayout16(e){this.MatrixList.MatrixLayout16=[];for(var t=0;t<this.MatrixList.MatrixLayout16Temp.length;t++)if(t%4==0){let e=this.MatrixList.MatrixLayout16Temp[t];var n=parseInt(this.MatrixList.MatrixLayout16Temp[t+3],16);n=(n&255)<<8|(n&65280)>>8;let r={hid:e,down:n+parseInt(this.MatrixList.MatrixLayout16Temp[t+2],16)};this.MatrixList.MatrixLayout16.push(r)}let r=0;for(var t=0;t<6;t++)for(var i=0;i<21;i++){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);r++}},formatLayout17(e){this.MatrixList.MatrixLayout17=[];for(var t=0;t<this.MatrixList.MatrixLayout17Temp.length;t++)if(t%4==0){let e=this.MatrixList.MatrixLayout17Temp[t];var n=parseInt(this.MatrixList.MatrixLayout17Temp[t+3],16);n=(n&255)<<8|(n&65280)>>8;let r={hid:e,up:n+parseInt(this.MatrixList.MatrixLayout17Temp[t+2],16)};this.MatrixList.MatrixLayout17.push(r)}let r=0;for(var t=0;t<6;t++)for(var i=0;i<21;i++){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);r++}},formatLayout19(e){this.MatrixList.MatrixLayout19=[];for(var t=0;t<this.MatrixList.MatrixLayout19Temp.length;t++)if(t%4==0){let e=this.MatrixList.MatrixLayout19Temp[t];var n=parseInt(this.MatrixList.MatrixLayout19Temp[t+3],16),r=parseInt(this.MatrixList.MatrixLayout19Temp[t+3],16);r=(r&255)<<8|(r&65280)>>8;let i={hid:e,axis:parseInt(this.MatrixList.MatrixLayout19Temp[t+2],16),routeAxis:n};this.MatrixList.MatrixLayout19.push(i)}let i=0;for(var t=0;t<6;t++)for(var a=0;a<21;a++){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);i++}},getMaxValue(e){return e.reduce((e,t)=>t>e?t:e,e[0])},getDeviceInfo(e){let t=new TextDecoder;this.toHexString(e);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);var o=this.trimSpaces(t.decode(e.slice(30,42)));o=o.split(`.`).pop();let s=parseInt(this.toHexString(e.slice(46,47)),16),c=this.toHexString(e.slice(59,63));return this.ConnectMode=s,this.FirmwareID=n,this.FirmwareNum=o,this.RunMode=i,this.SN=a,this.SNDatas=e.slice(13,29),{BoardID:n,FWsize:r,RunMode:i,SN:a,Version:o,ConnectMode:s,CheckNum:c}},getADCData(e,t){},getSetPRGBCmd(e){return e},mergeUint8Arrays(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;return e.forEach(e=>{n.set(e,r),r+=e.length}),n},toHexString(e){return e.reduce((e,t)=>e+t.toString(16).padStart(2,`0`),``)},toHexStringArr(e){return e.reduce((e,t)=>e+t.toString(16).padStart(2,`0`),``).match(/.{1,2}/g)},fromHexString(e){return new Uint8Array(e.toString().match(/.{1,2}/g).map(e=>parseInt(e,16)))},trimSpaces(e){return e=e.replace(/\u0000/g,``),e=e.replace(/\u0010/g,``),e=e.replace(/\r/g,``),e=e.replace(/\n/g,``),e},getHighLowBits(e){if(e>=0&&e<=65535){let t=[e&255,e>>8];return t[0]=t[0].toString(16),t[1]=t[1].toString(16),t}else throw Error(`The decimal number must be between 0 and 65535.`)},startCalibrate(e){e.SET_DEVICE_FUNCTION_OP_CMD[4]=`0x0C`;let t=new Uint8Array(e.SET_DEVICE_FUNCTION_OP_CMD.map(e=>parseInt(e,16)));this.curDeviceHandle.sendReport(0,t),setTimeout(()=>{this.startListeningNormal(e)},100)},stopCalibrate(e){this.stopListening(),setTimeout(()=>{e.SET_DEVICE_FUNCTION_OP_CMD[4]=`0x0D`;let t=new Uint8Array(e.SET_DEVICE_FUNCTION_OP_CMD.map(e=>parseInt(e,16)));this.curDeviceHandle.sendReport(0,t)},1e3)},isNumber(e){return typeof e==`number`&&!isNaN(e)},parseHotKeyCommand(e){let t=[{Name:`Ctrl`,Hid:`0x01`},{Name:`Shift`,Hid:`0x02`},{Name:`Alt`,Hid:`0x04`},{Name:`Win`,Hid:`0x08`}],n=``,r=e&15;for(var i=0;i<t.length;i++)r&parseInt(t[i].Hid,16)&&(n+=t[i].Name+`+`);return n},getHotKeyCommand(e,t){let n={modifier:0,key:0},r=function(e){let t=[{Name:`Ctrl`,Hid:`0x01`},{Name:`Shift`,Hid:`0x02`},{Name:`Alt`,Hid:`0x04`},{Name:`Win`,Hid:`0x08`},{Name:`LCTRL`,Hid:`0x01`},{Name:`LSHIFT`,Hid:`0x02`},{Name:`RCTRL`,Hid:`0x01`},{Name:`RSHIFT`,Hid:`0x02`}];for(var n=0;n<t.length;n++)if(t[n].Name==e)return t[n];return!1},i=t.split(`+`),a=0;for(let e=0;e<i.length;e++){let t=r(i[e]);t&&(t.Hid=parseInt(t.Hid,16),a=a==0?t.Hid:a|=t.Hid)}let o=i[i.length-1],s=this.getBottonHidOJBFromName(e,o);return a=a|=96,n.modifier=a.toString(16),n.key=s.Hid,n},getMacroCommand(e,t,n,r,i,a,o){let s=this,c=function(e){let t=n.KEYMAP;for(var r in t)if(t[r].VKCode==e)return t[r].Hid},l=function(e){switch(e.type){case`keydown`:{let n=c(e.keyCode),r=t.MACRO_TYPE_CMD.KEY_DOWN;return r[1]=n,r}break;case`keyup`:{let n=c(e.keyCode),r=t.MACRO_TYPE_CMD.KEY_UP;return r[1]=n,r}break;case`mousedown`:{let n=t.MACRO_TYPE_CMD.KEY_DOWN;return n[1]=e.keyCode.toString(16),n}break;case`mouseup`:{let n=t.MACRO_TYPE_CMD.KEY_UP;return n[1]=e.keyCode.toString(16),n}break;case`time`:{let n=s.getHighLowBits(e.keyCode),r=t.MACRO_TYPE_CMD.DELAY;return r[1]=n[0],r[2]=n[1],r}break}},u=[];for(let e=0;e<r.length;e++){let t=l(r[e]);u.push(...t)}u.unshift(o.toString(16)),u.unshift(a.toString(16)),u.unshift(i.toString(16));let d=function(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n},f=t.SET_DEVICE_FUNCTION_MACRO_CMD;f[5]=e.toString(16),f[6]=(r.length*3+3).toString(16),f[7]=`0x00`;let p=d(u,56);for(let e in p){e==p.length-1&&(f[7]=`0x01`),p[e]=f.concat(p[e]),p[e][1]=(p[e].length-4).toString(16);let t=p[e][p[e].length-1];p[e][3]=this.getCRC(p[e][1],p[e][2],t),p[e][3]=p[e][3].toString(16)}return p},chunkArray(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n},getButtonJourneyCommand(e,t,n){let r=t*1e3;r=this.getHighLowBits(r);let i=n.SET_DEVICE_BUTTON_JOURNEY_CMD,a=[];e.forEach(function(e){i[0]=e.getAttribute(`hid`),i[2]=r[0],i[3]=r[1],a.push(...i)}),a=this.chunkArray(a,8);let o=n.SET_DEVICE_BUTTON_OP_HEAD,s=[],c=[];for(let e=0;e<a.length;e++)if(e!=0&&e%6==0||e==a.length-1){c.push(...a[e]),c=o.concat(c);let t=c.length-4==parseInt(o[1],16)?c[c.length-1]:0;c[3]=this.getCRC(o[1],o[2],t),c[3]=c[3].toString(16),s.push(c),c=[]}else c.push(...a[e]);return s},getButtonRestJourneyCommand(e,t){let n=t.SET_RESET_BUTTON_JOURNEY_CMD,r=[];e.forEach(function(e){let t=e.getAttribute(`hid`),i=e.getAttribute(`working_mode`);if(i==null){console.log(e.getAttribute(`name`)),console.log(i);return}let a=parseInt(i);console.log(a.toString(16)),n[0]=t,n[2]=a.toString(16),n[4]=t,r.push(...n)}),r=this.chunkArray(r,8);let i=t.SET_DEVICE_BUTTON_OP_HEAD,a=[],o=[];for(let e=0;e<r.length;e++)if(e!=0&&e%6==0||e==r.length-1){o.push(...r[e]),o=i.concat(o);let t=o.length-4==parseInt(i[1],16)?o[o.length-1]:0;o[3]=this.getCRC(i[1],i[2],t),o[3]=o[3].toString(16),a.push(o),o=[]}else o.push(...r[e]);return a},getButtonSafeZoneCommand(e,t,n,r){let i=t*1e3;i=this.getHighLowBits(i);let a=n*1e3;a=this.getHighLowBits(a);let o=r.SET_DEVICE_BUTTON_SAFEZONE_CMD,s=[];e.forEach(function(e){let t=e.getAttribute(`hid`);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)}),s=this.chunkArray(s,12);let c=r.SET_DEVICE_BUTTON_OP_HEAD,l=[],u=[];for(let e=0;e<s.length;e++)if(e!=0&&e%3==0||e==s.length-1){u.push(...s[e]),u=c.concat(u);let t=u.length==57?u[u.length-1]:0;u[3]=this.getCRC(c[1],c[2],t),u[3]=u[3].toString(16),l.push(u),u=[]}else u.push(...s[e]);return l},getButtonRTSwitchCommand(e,t,n){let r=this,i=n.SET_DEVICE_BUTTON_RT_CMD,a=e?32:16,o=[];t.forEach(function(e){let t=e.getAttribute(`hid`),n=e.getAttribute(`working_mode`),s=e.getAttribute(`rt_up`),c=e.getAttribute(`rt_down`);if(n==null)return;let l=parseFloat(s)*1e3;l=r.getHighLowBits(l);let u=parseFloat(c)*1e3;u=r.getHighLowBits(u);let d=a+parseInt(n);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)}),o=this.chunkArray(o,12);let s=n.SET_DEVICE_BUTTON_OP_HEAD,c=[],l=[];for(let e=0;e<o.length;e++)if(e!=0&&e%3==0||e==o.length-1){l.push(...o[e]),l=s.concat(l);let t=l.length==57?l[l.length-1]:0;l[3]=this.getCRC(s[1],s[2],t),l[3]=l[3].toString(16),c.push(l),l=[]}else l.push(...o[e]);return c},getButtonRTCommand(e,t,n,r){let i=t*1e3;i=this.getHighLowBits(i);let a=n*1e3;a=this.getHighLowBits(a);let o=r.SET_DEVICE_BUTTON_RT_CMD,s=[];e.forEach(function(e){let t=e.getAttribute(`hid`),n=e.getAttribute(`working_mode`);if(n==null){console.log(e.getAttribute(`name`)),console.log(n);return}let r=32+parseInt(n);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)}),s=this.chunkArray(s,12);let c=r.SET_DEVICE_BUTTON_OP_HEAD,l=[],u=[];for(let e=0;e<s.length;e++)if(e!=0&&e%3==0||e==s.length-1){u.push(...s[e]),u=c.concat(u);let t=u.length==57?u[u.length-1]:0;u[3]=this.getCRC(c[1],c[2],t),u[3]=u[3].toString(16),l.push(u),u=[]}else u.push(...s[e]);return l},getButtonRGBCommand(e,t,n){let r=[t.substring(0,2),t.substring(2,4),t.substring(4,6)],i=[];e.forEach(function(e){let t=[];t[0]=e.getAttribute(`hid`),t[1]=r[0],t[2]=r[1],t[3]=r[2],i.push(...t)});let a=n.SET_CUSTOM_BUTTON_RGB_HEAD_CMD,o=[],s=[],c=1;for(let e=0;e<i.length;e++){if(c==56||e==i.length-1){s.push(i[e]),s=a.concat(s);let t=s.length==61?s[s.length-1]:0;s[3]=this.getCRC(a[1],a[2],t),s[3]=s[3].toString(16),o.push(s),s=[],c=1;continue}else s.push(i[e]);c++}return o},getButtonLayoutCustomCompletion(e,t){let n=[`0x00`,t,`0x00`,`0x00`];if(e.length!=56)for(var r=0;r<=(56-e.length)/4;r++)e.push(...n);return e},getButtonLayout0CustomCommand(e){let t=this.MatrixList.KeyMap,n=[],r=[`0xAA`,`0x00`,`0x00`,`0x00`];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));let o=e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD,s=[],c=[],l=1;for(let t=0;t<n.length;t++){if(l==56||t==n.length-1){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;continue}else c.push(n[t]);l++}return s},getButtonLayout8CustomCommand(e){let t=this.MatrixList.KeyMap,n=[],r=[`0xAA`,`0x08`,`0x00`,`0x00`];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));let o=e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD,s=[],c=[],l=1;for(let t=0;t<n.length;t++){if(l==56||t==n.length-1){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;continue}else c.push(n[t]);l++}return s},getButtonLayout1CustomCommand(e){let t=this.MatrixList.KeyMap,n=[],r=[`0xAA`,`0x01`,`0x00`,`0x00`];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));let o=e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD,s=[],c=[],l=1;for(let t=0;t<n.length;t++){if(l==56||t==n.length-1){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;continue}else c.push(n[t]);l++}return s},getButtonLayout4CustomCommand(e){let t=this.MatrixList.KeyMap,n=[],r=[`0xAA`,`0x04`,`0x00`,`0x00`];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));let o=e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD,s=[],c=[],l=1;for(let t=0;t<n.length;t++){if(l==56||t==n.length-1){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;continue}else c.push(n[t]);l++}return s},getButtonLayout14CustomCommand(e){let t=this.MatrixList.KeyMap,n=[],r=[`0xAA`,`0x14`,`0x00`,`0x00`];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));let o=e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD,s=[],c=[],l=1;for(let t=0;t<n.length;t++){if(l==56||t==n.length-1){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;continue}else c.push(n[t]);l++}return s},getButtonLayout15CustomCommand(e){let t=this.MatrixList.KeyMap,n=[],r=[`0xAA`,`0x15`,`0x00`,`0x00`];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));let o=e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD,s=[],c=[],l=1;for(let t=0;t<n.length;t++){if(l==56||t==n.length-1){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;continue}else c.push(n[t]);l++}return s},getButtonLayout16CustomCommand(e){let t=this.MatrixList.KeyMap,n=[],r=[`0xAA`,`0x16`,`0x00`,`0x00`];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));let o=e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD,s=[],c=[],l=1;for(let t=0;t<n.length;t++){if(l==56||t==n.length-1){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;continue}else c.push(n[t]);l++}return s},getButtonLayout17CustomCommand(e){let t=this.MatrixList.KeyMap,n=[],r=[`0xAA`,`0x17`,`0x00`,`0x00`];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));let o=e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD,s=[],c=[],l=1;for(let t=0;t<n.length;t++){if(l==56||t==n.length-1){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;continue}else c.push(n[t]);l++}return s},getButtonLayout19CustomCommand(e){let t=this.MatrixList.KeyMap,n=[],r=[`0xAA`,`0x19`,`0x00`,`0x00`];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));let o=e.READ_LAYOUT_KEY_CUSTOM_HEAD_CMD,s=[],c=[],l=1;for(let t=0;t<n.length;t++){if(l==56||t==n.length-1){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;continue}else c.push(n[t]);l++}return s},getMatrixKey(e){let t=[],n=this.toHexStringArr(e),r=n.slice(6,27),i=n.slice(28,49);return t.push(r,i),t},getFormatKeyMapMatrix(e,t,r){let i=e.concat(t).concat(r),a=function(e){let t=n.KEYMAP;for(var r in t)if(parseInt(t[r].Hid,16)==parseInt(e,16))return t[r]},o=[],s=0;for(let e=0;e<6;e++){let t=[],n=i[e];if(!n)break;for(let e=0;e<21;e++){var c=parseInt(n[e],16)==0?0:a(n[e]);let r={index:s,key_name:c?c.Value:0,name:c?c.Name:0,hid:n[e]};t.push(r),s++}o.push(t)}return o}},i=`1.0.0`,a=`AVKE SDK`,o=class{constructor(){this.currentVersion=i,this.supportedVersions=[`1.0.0`],this.deviceCompatibility={keyboard:{minFirmwareVersion:`1.0.0`,maxFirmwareVersion:`2.0.0`},mouse:{minFirmwareVersion:`1.0.0`,maxFirmwareVersion:`2.0.0`}}}getVersion(){return{version:this.currentVersion,name:a,buildDate:new Date().toISOString()}}checkCompatibility(e,t){let n=this.deviceCompatibility[e];if(!n)return{compatible:!1,reason:`Unknown device type`};let r=this.compareVersions(t,n.minFirmwareVersion)>=0&&this.compareVersions(t,n.maxFirmwareVersion)<=0;return{compatible:r,reason:r?`Compatible`:`Firmware version ${t} not supported. Supported range: ${n.minFirmwareVersion} - ${n.maxFirmwareVersion}`}}compareVersions(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]||0,i=r[e]||0;if(t>i)return 1;if(t<i)return-1}return 0}getSupportedDeviceTypes(){return Object.keys(this.deviceCompatibility)}},s=class{constructor(){this.levels={DEBUG:0,INFO:1,WARN:2,ERROR:3},this.currentLevel=this.levels.INFO,this.logs=[],this.maxLogs=1e3}setLevel(e){this.levels[e]!==void 0&&(this.currentLevel=this.levels[e])}debug(e,t=null){this.log(`DEBUG`,e,t)}info(e,t=null){this.log(`INFO`,e,t)}warn(e,t=null){this.log(`WARN`,e,t)}error(e,t=null){this.log(`ERROR`,e,t)}log(e,t,n=null){if(this.levels[e]<this.currentLevel)return;let r={timestamp:new Date().toISOString(),level:e,message:t,data:n,stack:e===`ERROR`?Error().stack:null};this.logs.push(r),this.logs.length>this.maxLogs&&this.logs.shift();let i=e.toLowerCase();console[i]&&console[i](`[${e}] ${t}`,n||``)}getLogs(e=null,t=100){let n=this.logs;return e&&(n=this.logs.filter(t=>t.level===e)),n.slice(-t)}clearLogs(){this.logs=[]}},c=class{constructor(){this.metrics={operations:{},connections:{},errors:{}},this.startTime=Date.now()}recordOperation(e,t,n,r=!0){let i=n-t;this.metrics.operations[e]||(this.metrics.operations[e]={count:0,totalTime:0,avgTime:0,minTime:1/0,maxTime:0,successCount:0,errorCount:0});let a=this.metrics.operations[e];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++}recordConnection(e,t=!0){this.metrics.connections[e]||(this.metrics.connections[e]={connectCount:0,disconnectCount:0,totalConnectedTime:0,lastConnected:null,lastDisconnected:null});let n=this.metrics.connections[e];t?(n.connectCount++,n.lastConnected=new Date().toISOString()):(n.disconnectCount++,n.lastDisconnected=new Date().toISOString())}recordError(e,t){this.metrics.errors[e]||(this.metrics.errors[e]={count:0,lastError:null,messages:[]});let n=this.metrics.errors[e];n.count++,n.lastError=new Date().toISOString(),n.messages.push({timestamp:new Date().toISOString(),message:t.message||t,stack:t.stack}),n.messages.length>10&&n.messages.shift()}getReport(){return{uptime:Date.now()-this.startTime,operations:this.metrics.operations,connections:this.metrics.connections,errors:this.metrics.errors,summary:{totalOperations:Object.values(this.metrics.operations).reduce((e,t)=>e+t.count,0),totalErrors:Object.values(this.metrics.errors).reduce((e,t)=>e+t.count,0),activeConnections:Object.values(this.metrics.connections).filter(e=>e.lastConnected&&(!e.lastDisconnected||e.lastConnected>e.lastDisconnected)).length}}}reset(){this.metrics={operations:{},connections:{},errors:{}},this.startTime=Date.now()}},l=new o,u=new s,d=new c,f=class{static methodTypes={getLightingBase:`万花筒灯效`,setLightingBase:`万花筒灯效`,getLightingPalette:`万花筒灯效`,setLightingPalette:`万花筒灯效`,getLightingCustom:`万花筒灯效`,setLightingCustom:`万花筒灯效`,getDecorate1Custom:`万花筒灯效`,setDecorate1Custom:`万花筒灯效`,getLightingArea:`万花筒灯效`,getDoubleLighting:`万花筒灯效`,getSpecialLighting:`万花筒灯效`,setLightingDirectDrive:`万花筒灯效`,getDevices:`全局功能`,init:`全局功能`,getDevicesInfo:`全局功能`,getConfig:`全局功能`,setConfig:`全局功能`,getRateOfReturnList:`全局功能`,getRateOfReturn:`全局功能`,setRateOfReturn:`全局功能`,getRtPrecision:`轴体行程功能`,getLightingSleepTime:`全局功能`,setLightingSleepTime:`全局功能`,closeDevice:`全局功能`,reconnection:`全局功能`,on:`全局功能`,off:`全局功能`,appToBoot:`全局功能`,bootToApp:`全局功能`,upgrade:`全局功能`,GFSRestore:`全局功能`,getSystemType:`全局功能`,setSystemType:`全局功能`,getKeyList:`按键功能`,getKeyInfo:`按键功能`,setKeyConfig:`按键功能`,getPerformance:`轴体行程功能`,setPerformance:`轴体行程功能`,getADCSample:`轴体行程功能`,getRoute:`轴体行程功能`,calibrationStart:`轴体行程功能`,calibrationEnd:`轴体行程功能`,getCalibrationStatus:`轴体行程功能`,getAxisList:`轴体行程功能`,getShakeOptimizationSwitch:`轴体行程功能`,setShakeOptimizationSwitch:`轴体行程功能`,getHigherKey:`高级按键功能`,setHigherKeyNONE:`高级按键功能`,setHigherKeyDKS:`高级按键功能`,setHigherKeyMPT:`高级按键功能`,setHigherKeyMT:`高级按键功能`,setHigherKeyTGL:`高级按键功能`,setHigherKeyEND:`高级按键功能`,setHigherKeySOCD:`高级按键功能`,setHigherKeyRS:`高级按键功能`};constructor(e={}){this.devices=[],this.currentDevice=null,this.eventListeners={},this.deviceType=`keyboard`,this.configs=e.configs||[{vendorId:7338,productId:2054,usagePage:65440,usage:1}],this.usage=e.usage||1,this.usagePage=e.usagePage||65440,this.versionManager=l,this.logger=u,this.performanceMonitor=d,this.config={autoReconnect:e.autoReconnect||!1,reconnectInterval:e.reconnectInterval||5e3,timeout:e.timeout||1e4,logLevel:e.logLevel||`INFO`,...e},this.logger.setLevel(this.config.logLevel),this.logger.info(`ServiceKeyboard initialized`,{config:this.config,configs:this.configs,usage:this.usage,usagePage:this.usagePage})}async _sendHIDCommand(e,t,n,r=`Timeout waiting for report`,i=2e3){await this.currentDevice.sendReport(t,e);let a=await new Promise((e,n)=>{let a=n=>{n.reportId===t&&(this.currentDevice.removeEventListener(`inputreport`,a),e(n))};this.currentDevice.addEventListener(`inputreport`,a),setTimeout(()=>{this.currentDevice.removeEventListener(`inputreport`,a),n(Error(r))},i)}),o=new Uint8Array(a.data.buffer);return n?n(o):o}async getLightingBase(e){return{area:e?.area||`Keyboard`,open:`Open`,mode:1,luminance:80,speed:80,direction:`Forward`,selectStaticColor:0}}async setLightingBase(e){return{area:e?.area||`Keyboard`,...e?.data}}async getLightingPalette(e){return{staticColors:[{R:0,G:0,B:0,H:255},{R:255,G:0,B:0,H:255},{R:0,G:255,B:0,H:255},{R:255,G:255,B:0,H:255},{R:0,G:0,B:255,H:255},{R:255,G:0,B:255,H:255},{R:0,G:255,B:255,H:255},{R:255,G:255,B:255,H:255}]}}async setLightingPalette(e){return{staticColors:e?.data?.staticColors||[]}}async getLightingCustom(){return[[{R:0,G:207,B:244,isCustom:!1}]]}async setLightingCustom(e){}async getDecorate1Custom(e){return[[{R:128,G:41,B:49,isCustom:!0}]]}async setDecorate1Custom(e){}async getLightingArea(){return{total:2,areas:[{index:0,count:20,rows:6,cols:15},{index:1,count:5,rows:1,cols:22}]}}async getDoubleLighting(){return{doubleLighting:1}}async getSpecialLighting(){return{specialLighting:1}}async setLightingDirectDrive(e,t){}async getDefaultKeyLayout(){let e=new Uint8Array(t.READ_DEFKEY_MATRIX_CMD.ROW1_ROW2.map(e=>parseInt(e,16))),n=new Uint8Array(t.READ_DEFKEY_MATRIX_CMD.ROW3_ROW4.map(e=>parseInt(e,16))),i=new Uint8Array(t.READ_DEFKEY_MATRIX_CMD.ROW5_ROW6.map(e=>parseInt(e,16)));try{let t=await this._sendHIDCommand(e,0,e=>r.getMatrixKey(e),`Timeout waiting for key matrix row1/row2 report`),a=await this._sendHIDCommand(n,0,e=>r.getMatrixKey(e),`Timeout waiting for key matrix row3/row4 report`),o=await this._sendHIDCommand(i,0,e=>r.getMatrixKey(e),`Timeout waiting for key matrix row5/row6 report`);return{code:0,layout:r.getFormatKeyMapMatrix(t,a,o)}}catch(e){throw this.logger.error(`getDefaultKeyLayout`,e),e}}async getKeyList(){return{code:0,keys:[{id:1,name:`A`},{id:2,name:`B`}]}}async getKeyInfo(e){return{code:0,key:{id:e,name:`A`,type:`normal`,macro:null}}}async setKeyConfig(e,t){if(typeof t==`string`)try{t=JSON.parse(t)}catch{}return{code:0}}async getRtPrecision(){return{min:.001}}async getPerformance(e){return{row:e?.row??0,col:e?.col??0,mode:0,normalPress:2,normalRelease:2,rtFirstTouch:.5,rtPress:.3,rtRelease:.3,pressDeadStroke:.2,releaseDeadStroke:.2,axis:0,calibrate:0}}async setPerformance(e){return{row:e?.row??0,col:e?.col??0,mode:e?.mode??0,normalPress:e?.normalPress??2,normalRelease:e?.normalRelease??2,rtFirstTouch:e?.rtFirstTouch??.5,rtPress:e?.rtPress??.3,rtRelease:e?.rtRelease??.3,pressDeadStroke:e?.pressDeadStroke??.2,releaseDeadStroke:e?.releaseDeadStroke??.2,...e?.axis===void 0?{}:{axis:e.axis},...e?.axisV2Id===void 0?{}:{axisV2Id:e.axisV2Id},...e?.axisRangeMax===void 0?{}:{axisRangeMax:e.axisRangeMax},...e?.axisCoefficient===void 0?{}:{axisCoefficient:e.axisCoefficient},calibrate:e?.calibrate??0}}async getADCSample(e){return{adc:0,row:e?.row??0,data:[2715,2700,2686,2693,2704,2772,2674,2688]}}async getRoute(e){return{route:0,row:e?.row??0,data:[0,0,0,343,0,0,0,0]}}async calibrationStart(){return{status:0,message:`Calibration started`}}async calibrationEnd(){return{status:0,message:`Calibration finished`}}async getCalibrationStatus(e){return{calibrate:2,row:e?.row??0,data:[0,0,0,0,0,0,0,0]}}async getAxisList(){return{total:4,list:[54,24,1,69]}}async getShakeOptimizationSwitch(){return{enabled:!1,status:0}}async setShakeOptimizationSwitch(e){return{enabled:!!e,status:0}}async getHigherKey(e){return{row:e?.row??0,col:e?.col??0,mode:0}}async setHigherKeyNONE(e){return{row:e?.row??0,col:e?.col??0,mode:0,data:e?.data??{mode:0}}}async setHigherKeyDKS(e){return{row:e?.row??0,col:e?.col??0,mode:1,data:{kcs:e?.data?.kcs??[],trps:e?.data?.trps??[],dbs:e?.data?.dbs??[]}}}async setHigherKeyMPT(e){return{row:e?.row??0,col:e?.col??0,mode:2,data:{kcs:e?.data?.kcs??[],dbs:e?.data?.dbs??[]}}}async setHigherKeyMT(e){return{row:e?.row??0,col:e?.col??0,mode:3,data:{time:e?.data?.time??0,kcs:e?.data?.kcs??[]}}}async setHigherKeyTGL(e){return{row:e?.row??0,col:e?.col??0,mode:4,data:{kcs:e?.data?.kcs??0,delay:e?.data?.delay??0}}}async setHigherKeyEND(e){return{row:e?.row??0,col:e?.col??0,mode:5,data:{kcs:e?.data?.kcs??[],delay:e?.data?.delay??0}}}async setHigherKeySOCD(e){return{row:e?.row??0,col:e?.col??0,mode:6,data:{row2:e?.row2??0,col2:e?.col2??0,kcs:e?.kcs??[],delay:e?.delay??0,mode:e?.mode??0}}}async setHigherKeyRS(e){return{row:e?.row??0,col:e?.col??0,mode:7,data:{row2:e?.data?.row2??0,col2:e?.data?.col2??0,delay:e?.data?.delay??0,kcs:e?.data?.kcs??[]}}}async getRateOfReturnList(){return{code:0,list:[]}}async getDevices(){let e=Date.now();try{if(this.logger.debug(`Getting devices list`),!navigator.hid)throw Error(`WebHID API is not supported in this browser.`);let t=this.configs&&this.configs.length>0?this.configs.map(e=>({vendorId:e.vendorId,productId:e.productId,usagePage:e.usagePage,usage:e.usage})):void 0,n=await navigator.hid.getDevices();(!n||n.length===0)&&(n=await navigator.hid.requestDevice({filters:t||[]}));let r=n.map(e=>({id:e.deviceId||`${e.vendorId}:${e.productId}`,usage:e.collections?.[0]?.usage||this.usage,usagePage:e.collections?.[0]?.usagePage||this.usagePage,vendorId:e.vendorId,productId:e.productId,productName:e.productName,data:{},type:`keyboard`}));return this.performanceMonitor.recordOperation(`getDevices`,e,Date.now(),!0),this.logger.info(`Found ${r.length} devices`,{devices:r}),r}catch(t){throw this.performanceMonitor.recordOperation(`getDevices`,e,Date.now(),!1),this.performanceMonitor.recordError(`getDevices`,t),this.logger.error(`Failed to get devices`,t),t}}async init(e){let t=Date.now();try{if(this.logger.info(`Initializing keyboard device: ${e}`),!navigator.hid)throw Error(`WebHID API is not supported in this browser.`);let n=await navigator.hid.getDevices(),r=null;for(let e=0;e<n.length;e++){let t=n[e];t.collections[0].usagePage==this.usagePage&&(r=t)}if(!r)throw Error(`Device not found or not authorized.`);r.opened||await r.open(),this.currentDevice=r,this.performanceMonitor.recordConnection(e,!0);let i=await this.getDevicesInfo(),a=this.versionManager.checkCompatibility(`keyboard`,i.Version);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`,{deviceId:e,deviceInfo:i}),{code:0,info:`Initialization successful!`}}catch(n){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}}async getDevicesInfo(){if(!this.currentDevice)throw Error(`No device initialized.`);let e=new Uint8Array(t.READ_DEVICE_INFO_CMD.map(e=>parseInt(e,16)));try{let t=await this._sendHIDCommand(e,0,e=>r.getDeviceInfo(e),`Timeout waiting for device info report`);return console.log(`DeviceInfo`,{DeviceInfo:t}),t}catch(e){throw this.logger.error(`Failed to get device info`,e),e}}async getConfig(){let e=new Uint8Array(t.READ_DEVICE_PROFILE_CMD.map(e=>parseInt(e,16)));try{let t=await this._sendHIDCommand(e,0,e=>r.getCurrentConfig(e),`Timeout waiting for device info report`);return{code:0,configName:`Config`+t,value:t}}catch(e){throw this.logger.error(`Failed to get config`,e),e}}async setConfig(e){t.SET_DEVICE_PROFILE_CMD[5]=parseInt(e);let n=new Uint8Array(t.SET_DEVICE_PROFILE_CMD.map(e=>parseInt(e,16)));try{return await this._sendHIDCommand(n,0,null,`Timeout waiting for device info report`),{code:0,setConfigName:`Config`+e,configIndex:e}}catch(e){throw this.logger.error(`Failed to set config`,e),e}}async getRateOfReturn(){let e=new Uint8Array(t.READ_DEVICE_RATE_CMD.map(e=>parseInt(e,16)));try{return{code:0,key:await this._sendHIDCommand(e,0,e=>r.getDeviceRate(e),`Timeout waiting for device rate report`)}}catch(e){throw this.logger.error(`Failed to get rate of return`,e),e}}async setRateOfReturn(e){t.SET_DEVICE_RATE_CMD[5]=parseInt(e);let n=new Uint8Array(t.SET_DEVICE_RATE_CMD.map(e=>parseInt(e,16)));try{return await this._sendHIDCommand(n,0,null,`Timeout waiting for device rate set report`),{code:0}}catch(e){throw this.logger.error(`Failed to set rate of return`,e),e}}async getLightingSleepTime(){let e=new Uint8Array(t.READ_DEVICE_SLEEP_CMD.map(e=>parseInt(e,16)));try{return{code:0,value:await this._sendHIDCommand(e,0,e=>r.getDeviceSleep(e),`Timeout waiting for device sleep report`)}}catch(e){throw this.logger.error(`Failed to get lighting sleep time`,e),e}}async setLightingSleepTime(e){t.SET_DEVICE_SLEEP_CMD[5]=parseInt(e);let n=new Uint8Array(t.SET_DEVICE_SLEEP_CMD.map(e=>parseInt(e,16)));try{return await this._sendHIDCommand(n,0,null,`Timeout waiting for device sleep set report`),{code:0}}catch(e){throw this.logger.error(`Failed to set lighting sleep time`,e),e}}async closeDevice(){return this.currentDevice=null,{code:0}}async reconnection(e,t){return{code:0}}on(e,t){this.eventListeners[e]||(this.eventListeners[e]=[]),this.eventListeners[e].push(t)}off(e,t){this.eventListeners[e]&&(this.eventListeners[e]=this.eventListeners[e].filter(e=>e!==t))}async appToBoot(){return{code:0}}async bootToApp(){return{code:0}}async upgrade(e,t,n){return{code:0}}async GFSRestore(){return{code:0}}async getSystemType(){let e=new Uint8Array(t.READ_DEVICE_SYSTEM_CMD.map(e=>parseInt(e,16)));try{let{key:t,value:n}=await this._sendHIDCommand(e,0,e=>r.getDeviceSystem(e),`Timeout waiting for device system report`);return{code:0,key:t,value:n}}catch(e){throw this.logger.error(`Failed to get system type`,e),e}}async setSystemType(e){t.SET_DEVICE_SYSTEM_CMD[5]=parseInt(e);let n=new Uint8Array(t.SET_DEVICE_SYSTEM_CMD.map(e=>parseInt(e,16)));try{return await this._sendHIDCommand(n,0,null,`Timeout waiting for device system set report`),{code:0}}catch(e){throw this.logger.error(`Failed to set system type`,e),e}}},p=class{constructor(e={}){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=l,this.logger=u,this.performanceMonitor=d,this.config={autoReconnect:e.autoReconnect||!1,reconnectInterval:e.reconnectInterval||5e3,timeout:e.timeout||1e4,logLevel:e.logLevel||`INFO`,...e},this.logger.setLevel(this.config.logLevel),this.logger.info(`ServiceMouse initialized`,{config:this.config,configs:this.configs,usage:this.usage,usagePage:this.usagePage})}async getDevices(){let e=Date.now();try{this.logger.debug(`Getting mouse devices list`);let t=[{id:`mock-mouse-1`,usage:2,usagePage:65440,vendorId:7331,productId:2050,productName:`Mock Mouse`,data:{},type:`mouse`}];return this.performanceMonitor.recordOperation(`getDevices`,e,Date.now(),!0),this.logger.info(`Found ${t.length} mouse devices`,{devices:t}),t}catch(t){throw this.performanceMonitor.recordOperation(`getDevices`,e,Date.now(),!1),this.performanceMonitor.recordError(`getDevices`,t),this.logger.error(`Failed to get mouse devices`,t),t}}async init(e){let t=Date.now();try{this.logger.info(`Initializing mouse device: ${e}`),this.currentDevice={id:e,type:`mouse`},this.performanceMonitor.recordConnection(e,!0);let n=await this.getDevicesInfo(),r=this.versionManager.checkCompatibility(`mouse`,n.appVersion);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`,{deviceId:e,deviceInfo:n}),this.currentDevice}catch(n){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}}async getDevicesInfo(){return{type:2,subType:0,boardId:3145730,appVersion:`1.0.1.0`,pcbVersion:`1-0-0-0`,runModeVersion:0,sn:`54817806657765148212548`,timestamp:`2025052215:4`}}async getProtocolVersion(){return{mainVersion:1,subVersion:0,hardwareVersion:1,softwareVersion:0}}async getDPIList(){return{list:[400,800,1600,3200,6400,12800,16e3]}}async getDPI(){return{value:1600}}async setDPI(e){console.log(`Setting DPI to ${e}`)}async getRateOfReturnList(){return{list:[`125Hz`,`250Hz`,`500Hz`,`1000Hz`]}}async getRateOfReturn(){return{key:`1000Hz`}}async setRateOfReturn(e){console.log(`Setting rate of return to ${e}`)}async getLiftOffDistance(){return{value:2}}async setLiftOffDistance(e){console.log(`Setting lift-off distance to ${e}`)}async getButtonMapping(){return{left:`left-click`,right:`right-click`,middle:`middle-click`,dpi:`dpi-cycle`,forward:`forward`,backward:`backward`}}async setButtonMapping(e){console.log(`Setting button mapping:`,e)}async closeDevice(){this.currentDevice=null}async reconnection(e,t){}on(e,t){this.eventListeners[e]||(this.eventListeners[e]=[]),this.eventListeners[e].push(t)}off(e,t){this.eventListeners[e]&&(this.eventListeners[e]=this.eventListeners[e].filter(e=>e!==t))}async appToBoot(){}async bootToApp(){}async upgrade(e,t,n){return{success:!0}}async GFSRestore(){}},m=f;e.Logger=s,e.PerformanceMonitor=c,e.ServiceKeyboard=f,e.ServiceMouse=p,e.VersionManager=o,e.default=m,e.logger=u,e.performanceMonitor=d,e.versionManager=l});
package/dist/logo.svg ADDED
@@ -0,0 +1,34 @@
1
+ <svg width="200" height="60" viewBox="0 0 200 60" xmlns="http://www.w3.org/2000/svg">
2
+ <defs>
3
+ <linearGradient id="logoGradient" x1="0%" y1="0%" x2="100%" y2="0%">
4
+ <stop offset="0%" style="stop-color:#667eea;stop-opacity:1" />
5
+ <stop offset="50%" style="stop-color:#764ba2;stop-opacity:1" />
6
+ <stop offset="100%" style="stop-color:#f093fb;stop-opacity:1" />
7
+ </linearGradient>
8
+ <linearGradient id="iconGradient" x1="0%" y1="0%" x2="100%" y2="100%">
9
+ <stop offset="0%" style="stop-color:#4facfe;stop-opacity:1" />
10
+ <stop offset="100%" style="stop-color:#00f2fe;stop-opacity:1" />
11
+ </linearGradient>
12
+ </defs>
13
+
14
+ <!-- Icon part -->
15
+ <g transform="translate(0, 10)">
16
+ <!-- Keyboard representation -->
17
+ <rect x="5" y="15" width="25" height="20" rx="2" fill="url(#iconGradient)" opacity="0.8"/>
18
+ <rect x="8" y="18" width="4" height="4" rx="1" fill="#fff"/>
19
+ <rect x="14" y="18" width="4" height="4" rx="1" fill="#fff"/>
20
+ <rect x="20" y="18" width="4" height="4" rx="1" fill="#fff"/>
21
+ <rect x="8" y="24" width="4" height="4" rx="1" fill="#fff"/>
22
+ <rect x="14" y="24" width="4" height="4" rx="1" fill="#fff"/>
23
+ <rect x="20" y="24" width="4" height="4" rx="1" fill="#fff"/>
24
+
25
+ <!-- Mouse representation -->
26
+ <ellipse cx="22" cy="32" rx="6" ry="8" fill="url(#iconGradient)" opacity="0.6"/>
27
+ <rect x="19" y="28" width="6" height="8" rx="3" fill="url(#iconGradient)"/>
28
+ <circle cx="22" cy="26" r="1.5" fill="#fff"/>
29
+ </g>
30
+
31
+ <!-- Text part -->
32
+ <text x="45" y="25" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="url(#logoGradient)">AVKE</text>
33
+ <text x="45" y="42" font-family="Arial, sans-serif" font-size="10" fill="#666">爱客游戏外设开发者联盟</text>
34
+ </svg>
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "avke-sdk",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "AVKE - 爱客游戏外设开发者联盟 SDK",
6
+ "main": "dist/keyboard-sdk.umd.js",
7
+ "module": "dist/keyboard-sdk.es.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "dev": "vite --mode debug",
14
+ "website:dev": "vite --mode website",
15
+ "website:build": "vite build --mode website",
16
+ "build": "vite build",
17
+ "build:debug": "vite build --mode debug",
18
+ "preview": "vite preview",
19
+ "test": "node test/run-tests.js",
20
+ "test:node": "node test/sdk-tests.js",
21
+ "test:browser": "npm run website:dev & sleep 3 && open http://localhost:4001/test.html"
22
+ },
23
+ "keywords": [
24
+ "keyboard",
25
+ "sdk",
26
+ "hardware",
27
+ "communication"
28
+ ],
29
+ "author": "Your Name",
30
+ "license": "MIT",
31
+ "devDependencies": {
32
+ "@vitejs/plugin-vue": "^6.0.5",
33
+ "typescript": "^5.0.0",
34
+ "vite": "^8.0.0",
35
+ "vitepress": "^1.6.4",
36
+ "vue": "^3.5.30"
37
+ },
38
+ "dependencies": {
39
+ "vue-i18n": "^9.14.4",
40
+ "vue-router": "^4.6.4"
41
+ }
42
+ }