node-poweredup 9.0.0 → 10.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.
Files changed (706) hide show
  1. package/README.md +6 -11
  2. package/dist/color.d.ts +7 -0
  3. package/dist/color.d.ts.map +1 -0
  4. package/dist/color.js +15 -0
  5. package/dist/color.js.map +1 -0
  6. package/dist/consts.d.ts +645 -0
  7. package/dist/consts.d.ts.map +1 -0
  8. package/{docs/consts.js.html → dist/consts.js} +74 -127
  9. package/dist/consts.js.map +1 -0
  10. package/dist/devices/absolutemotor.d.ts +41 -0
  11. package/dist/devices/absolutemotor.d.ts.map +1 -0
  12. package/dist/devices/absolutemotor.js +115 -0
  13. package/dist/devices/absolutemotor.js.map +1 -0
  14. package/dist/devices/basicmotor.d.ts +37 -0
  15. package/dist/devices/basicmotor.d.ts.map +1 -0
  16. package/dist/devices/basicmotor.js +57 -0
  17. package/dist/devices/basicmotor.js.map +1 -0
  18. package/dist/devices/colordistancesensor.d.ts +74 -0
  19. package/dist/devices/colordistancesensor.d.ts.map +1 -0
  20. package/dist/devices/colordistancesensor.js +278 -0
  21. package/dist/devices/colordistancesensor.js.map +1 -0
  22. package/dist/devices/currentsensor.d.ts +17 -0
  23. package/dist/devices/currentsensor.d.ts.map +1 -0
  24. package/dist/devices/currentsensor.js +55 -0
  25. package/dist/devices/currentsensor.js.map +1 -0
  26. package/dist/devices/device.d.ts +72 -0
  27. package/dist/devices/device.d.ts.map +1 -0
  28. package/dist/devices/device.js +162 -0
  29. package/dist/devices/device.js.map +1 -0
  30. package/dist/devices/duplotrainbasecolorsensor.d.ts +20 -0
  31. package/dist/devices/duplotrainbasecolorsensor.d.ts.map +1 -0
  32. package/dist/devices/duplotrainbasecolorsensor.js +77 -0
  33. package/dist/devices/duplotrainbasecolorsensor.js.map +1 -0
  34. package/dist/devices/duplotrainbasemotor.d.ts +10 -0
  35. package/dist/devices/duplotrainbasemotor.d.ts.map +1 -0
  36. package/dist/devices/duplotrainbasemotor.js +12 -0
  37. package/dist/devices/duplotrainbasemotor.js.map +1 -0
  38. package/dist/devices/duplotrainbasespeaker.d.ts +27 -0
  39. package/dist/devices/duplotrainbasespeaker.d.ts.map +1 -0
  40. package/dist/devices/duplotrainbasespeaker.js +38 -0
  41. package/dist/devices/duplotrainbasespeaker.js.map +1 -0
  42. package/dist/devices/duplotrainbasespeedometer.d.ts +17 -0
  43. package/dist/devices/duplotrainbasespeedometer.d.ts.map +1 -0
  44. package/dist/devices/duplotrainbasespeedometer.js +34 -0
  45. package/dist/devices/duplotrainbasespeedometer.js.map +1 -0
  46. package/dist/devices/hubled.d.ts +28 -0
  47. package/dist/devices/hubled.d.ts.map +1 -0
  48. package/dist/devices/hubled.js +58 -0
  49. package/dist/devices/hubled.js.map +1 -0
  50. package/dist/devices/light.d.ts +24 -0
  51. package/dist/devices/light.d.ts.map +1 -0
  52. package/dist/devices/light.js +44 -0
  53. package/dist/devices/light.js.map +1 -0
  54. package/dist/devices/marioaccelerometer.d.ts +18 -0
  55. package/dist/devices/marioaccelerometer.d.ts.map +1 -0
  56. package/dist/devices/marioaccelerometer.js +50 -0
  57. package/dist/devices/marioaccelerometer.js.map +1 -0
  58. package/dist/devices/mariobarcodesensor.d.ts +18 -0
  59. package/dist/devices/mariobarcodesensor.d.ts.map +1 -0
  60. package/dist/devices/mariobarcodesensor.js +58 -0
  61. package/dist/devices/mariobarcodesensor.js.map +1 -0
  62. package/dist/devices/mariopantssensor.d.ts +17 -0
  63. package/dist/devices/mariopantssensor.d.ts.map +1 -0
  64. package/dist/devices/mariopantssensor.js +34 -0
  65. package/dist/devices/mariopantssensor.js.map +1 -0
  66. package/dist/devices/mediumlinearmotor.d.ts +10 -0
  67. package/dist/devices/mediumlinearmotor.d.ts.map +1 -0
  68. package/dist/devices/mediumlinearmotor.js +12 -0
  69. package/dist/devices/mediumlinearmotor.js.map +1 -0
  70. package/dist/devices/motionsensor.d.ts +17 -0
  71. package/dist/devices/motionsensor.d.ts.map +1 -0
  72. package/dist/devices/motionsensor.js +38 -0
  73. package/dist/devices/motionsensor.js.map +1 -0
  74. package/dist/devices/movehubmediumlinearmotor.d.ts +10 -0
  75. package/dist/devices/movehubmediumlinearmotor.d.ts.map +1 -0
  76. package/dist/devices/movehubmediumlinearmotor.js +12 -0
  77. package/dist/devices/movehubmediumlinearmotor.js.map +1 -0
  78. package/dist/devices/movehubtiltsensor.d.ts +17 -0
  79. package/dist/devices/movehubtiltsensor.d.ts.map +1 -0
  80. package/dist/devices/movehubtiltsensor.js +36 -0
  81. package/dist/devices/movehubtiltsensor.js.map +1 -0
  82. package/dist/devices/piezobuzzer.d.ts +17 -0
  83. package/dist/devices/piezobuzzer.d.ts.map +1 -0
  84. package/dist/devices/piezobuzzer.js +27 -0
  85. package/dist/devices/piezobuzzer.js.map +1 -0
  86. package/dist/devices/remotecontrolbutton.d.ts +20 -0
  87. package/dist/devices/remotecontrolbutton.d.ts.map +1 -0
  88. package/dist/devices/remotecontrolbutton.js +40 -0
  89. package/dist/devices/remotecontrolbutton.js.map +1 -0
  90. package/dist/devices/simplemediumlinearmotor.d.ts +10 -0
  91. package/dist/devices/simplemediumlinearmotor.d.ts.map +1 -0
  92. package/dist/devices/simplemediumlinearmotor.js +12 -0
  93. package/dist/devices/simplemediumlinearmotor.js.map +1 -0
  94. package/dist/devices/tachomotor.d.ts +65 -0
  95. package/dist/devices/tachomotor.d.ts.map +1 -0
  96. package/dist/devices/tachomotor.js +161 -0
  97. package/dist/devices/tachomotor.js.map +1 -0
  98. package/dist/devices/technic3x3colorlightmatrix.d.ts +22 -0
  99. package/dist/devices/technic3x3colorlightmatrix.d.ts.map +1 -0
  100. package/dist/devices/technic3x3colorlightmatrix.js +53 -0
  101. package/dist/devices/technic3x3colorlightmatrix.js.map +1 -0
  102. package/dist/devices/techniccolorsensor.d.ts +27 -0
  103. package/dist/devices/techniccolorsensor.d.ts.map +1 -0
  104. package/dist/devices/techniccolorsensor.js +71 -0
  105. package/dist/devices/techniccolorsensor.js.map +1 -0
  106. package/dist/devices/technicdistancesensor.d.ts +27 -0
  107. package/dist/devices/technicdistancesensor.d.ts.map +1 -0
  108. package/dist/devices/technicdistancesensor.js +57 -0
  109. package/dist/devices/technicdistancesensor.js.map +1 -0
  110. package/dist/devices/technicforcesensor.d.ts +19 -0
  111. package/dist/devices/technicforcesensor.d.ts.map +1 -0
  112. package/dist/devices/technicforcesensor.js +58 -0
  113. package/dist/devices/technicforcesensor.js.map +1 -0
  114. package/dist/devices/techniclargeangularmotor.d.ts +13 -0
  115. package/dist/devices/techniclargeangularmotor.d.ts.map +1 -0
  116. package/dist/devices/techniclargeangularmotor.js +12 -0
  117. package/dist/devices/techniclargeangularmotor.js.map +1 -0
  118. package/dist/devices/techniclargelinearmotor.d.ts +10 -0
  119. package/dist/devices/techniclargelinearmotor.d.ts.map +1 -0
  120. package/dist/devices/techniclargelinearmotor.js +12 -0
  121. package/dist/devices/techniclargelinearmotor.js.map +1 -0
  122. package/dist/devices/technicmediumangularmotor.d.ts +13 -0
  123. package/dist/devices/technicmediumangularmotor.d.ts.map +1 -0
  124. package/dist/devices/technicmediumangularmotor.js +12 -0
  125. package/dist/devices/technicmediumangularmotor.js.map +1 -0
  126. package/dist/devices/technicmediumhubaccelerometersensor.d.ts +17 -0
  127. package/dist/devices/technicmediumhubaccelerometersensor.d.ts.map +1 -0
  128. package/dist/devices/technicmediumhubaccelerometersensor.js +38 -0
  129. package/dist/devices/technicmediumhubaccelerometersensor.js.map +1 -0
  130. package/dist/devices/technicmediumhubgyrosensor.d.ts +17 -0
  131. package/dist/devices/technicmediumhubgyrosensor.d.ts.map +1 -0
  132. package/dist/devices/technicmediumhubgyrosensor.js +38 -0
  133. package/dist/devices/technicmediumhubgyrosensor.js.map +1 -0
  134. package/dist/devices/technicmediumhubtiltsensor.d.ts +38 -0
  135. package/dist/devices/technicmediumhubtiltsensor.d.ts.map +1 -0
  136. package/dist/devices/technicmediumhubtiltsensor.js +103 -0
  137. package/dist/devices/technicmediumhubtiltsensor.js.map +1 -0
  138. package/dist/devices/technicsmallangularmotor.d.ts +13 -0
  139. package/dist/devices/technicsmallangularmotor.d.ts.map +1 -0
  140. package/dist/devices/technicsmallangularmotor.js +12 -0
  141. package/dist/devices/technicsmallangularmotor.js.map +1 -0
  142. package/dist/devices/technicxlargelinearmotor.d.ts +10 -0
  143. package/dist/devices/technicxlargelinearmotor.d.ts.map +1 -0
  144. package/dist/devices/technicxlargelinearmotor.js +12 -0
  145. package/dist/devices/technicxlargelinearmotor.js.map +1 -0
  146. package/dist/devices/tiltsensor.d.ts +17 -0
  147. package/dist/devices/tiltsensor.d.ts.map +1 -0
  148. package/dist/devices/tiltsensor.js +36 -0
  149. package/dist/devices/tiltsensor.js.map +1 -0
  150. package/dist/devices/trainmotor.d.ts +10 -0
  151. package/dist/devices/trainmotor.d.ts.map +1 -0
  152. package/dist/devices/trainmotor.js +12 -0
  153. package/dist/devices/trainmotor.js.map +1 -0
  154. package/dist/devices/voltagesensor.d.ts +17 -0
  155. package/dist/devices/voltagesensor.d.ts.map +1 -0
  156. package/dist/devices/voltagesensor.js +59 -0
  157. package/dist/devices/voltagesensor.js.map +1 -0
  158. package/dist/hubs/basehub.d.ts +154 -0
  159. package/dist/hubs/basehub.d.ts.map +1 -0
  160. package/dist/hubs/basehub.js +383 -0
  161. package/dist/hubs/basehub.js.map +1 -0
  162. package/dist/hubs/duplotrainbase.d.ts +18 -0
  163. package/dist/hubs/duplotrainbase.d.ts.map +1 -0
  164. package/dist/hubs/duplotrainbase.js +35 -0
  165. package/dist/hubs/duplotrainbase.js.map +1 -0
  166. package/dist/hubs/hub.d.ts +20 -0
  167. package/dist/hubs/hub.d.ts.map +1 -0
  168. package/dist/hubs/hub.js +44 -0
  169. package/dist/hubs/hub.js.map +1 -0
  170. package/dist/hubs/lpf2hub.d.ts +46 -0
  171. package/dist/hubs/lpf2hub.d.ts.map +1 -0
  172. package/{docs/hubs_lpf2hub.js.html → dist/hubs/lpf2hub.js} +23 -103
  173. package/dist/hubs/lpf2hub.js.map +1 -0
  174. package/dist/hubs/mario.d.ts +18 -0
  175. package/dist/hubs/mario.d.ts.map +1 -0
  176. package/dist/hubs/mario.js +31 -0
  177. package/dist/hubs/mario.js.map +1 -0
  178. package/dist/hubs/movehub.d.ts +19 -0
  179. package/dist/hubs/movehub.d.ts.map +1 -0
  180. package/dist/hubs/movehub.js +46 -0
  181. package/dist/hubs/movehub.js.map +1 -0
  182. package/dist/hubs/remotecontrol.d.ts +18 -0
  183. package/dist/hubs/remotecontrol.d.ts.map +1 -0
  184. package/dist/hubs/remotecontrol.js +37 -0
  185. package/dist/hubs/remotecontrol.js.map +1 -0
  186. package/dist/hubs/technicmediumhub.d.ts +18 -0
  187. package/dist/hubs/technicmediumhub.d.ts.map +1 -0
  188. package/dist/hubs/technicmediumhub.js +42 -0
  189. package/dist/hubs/technicmediumhub.js.map +1 -0
  190. package/dist/hubs/technicsmallhub.d.ts +19 -0
  191. package/dist/hubs/technicsmallhub.d.ts.map +1 -0
  192. package/dist/hubs/technicsmallhub.js +41 -0
  193. package/dist/hubs/technicsmallhub.js.map +1 -0
  194. package/dist/hubs/wedo2smarthub.d.ts +39 -0
  195. package/dist/hubs/wedo2smarthub.d.ts.map +1 -0
  196. package/dist/hubs/wedo2smarthub.js +186 -0
  197. package/dist/hubs/wedo2smarthub.js.map +1 -0
  198. package/dist/index-browser.d.ts +2 -0
  199. package/dist/index-browser.d.ts.map +1 -0
  200. package/dist/index-browser.js +96 -0
  201. package/dist/index-browser.js.map +1 -0
  202. package/dist/index-node.d.ts +50 -0
  203. package/dist/index-node.d.ts.map +1 -0
  204. package/dist/index-node.js +50 -0
  205. package/dist/index-node.js.map +1 -0
  206. package/dist/interfaces.d.ts +24 -0
  207. package/dist/interfaces.d.ts.map +1 -0
  208. package/dist/interfaces.js +2 -0
  209. package/dist/interfaces.js.map +1 -0
  210. package/dist/nobleabstraction.d.ts +27 -0
  211. package/dist/nobleabstraction.d.ts.map +1 -0
  212. package/dist/nobleabstraction.js +121 -0
  213. package/dist/nobleabstraction.js.map +1 -0
  214. package/dist/node/color.js +2 -29
  215. package/dist/node/color.js.map +1 -1
  216. package/dist/node/commands.d.ts +299 -0
  217. package/dist/node/commands.js +672 -0
  218. package/dist/node/commands.js.map +1 -0
  219. package/dist/node/connection.d.ts +187 -0
  220. package/dist/node/connection.js +478 -0
  221. package/dist/node/connection.js.map +1 -0
  222. package/dist/node/consts.js +57 -60
  223. package/dist/node/consts.js.map +1 -1
  224. package/dist/node/devices/absolutemotor.d.ts +0 -1
  225. package/dist/node/devices/absolutemotor.js +14 -41
  226. package/dist/node/devices/absolutemotor.js.map +1 -1
  227. package/dist/node/devices/basicmotor.d.ts +3 -3
  228. package/dist/node/devices/basicmotor.js +6 -33
  229. package/dist/node/devices/basicmotor.js.map +1 -1
  230. package/dist/node/devices/colordistancesensor.d.ts +4 -5
  231. package/dist/node/devices/colordistancesensor.js +11 -38
  232. package/dist/node/devices/colordistancesensor.js.map +1 -1
  233. package/dist/node/devices/currentsensor.d.ts +0 -1
  234. package/dist/node/devices/currentsensor.js +7 -34
  235. package/dist/node/devices/currentsensor.js.map +1 -1
  236. package/dist/node/devices/device.d.ts +4 -7
  237. package/dist/node/devices/device.js +3 -30
  238. package/dist/node/devices/device.js.map +1 -1
  239. package/dist/node/devices/duplotrainbasecolorsensor.d.ts +0 -1
  240. package/dist/node/devices/duplotrainbasecolorsensor.js +9 -36
  241. package/dist/node/devices/duplotrainbasecolorsensor.js.map +1 -1
  242. package/dist/node/devices/duplotrainbasemotor.js +3 -30
  243. package/dist/node/devices/duplotrainbasemotor.js.map +1 -1
  244. package/dist/node/devices/duplotrainbasespeaker.js +5 -32
  245. package/dist/node/devices/duplotrainbasespeaker.js.map +1 -1
  246. package/dist/node/devices/duplotrainbasespeedometer.d.ts +0 -1
  247. package/dist/node/devices/duplotrainbasespeedometer.js +7 -34
  248. package/dist/node/devices/duplotrainbasespeedometer.js.map +1 -1
  249. package/dist/node/devices/hubled.js +5 -32
  250. package/dist/node/devices/hubled.js.map +1 -1
  251. package/dist/node/devices/index.d.ts +14 -0
  252. package/dist/node/devices/index.js +154 -0
  253. package/dist/node/devices/index.js.map +1 -0
  254. package/dist/node/devices/led.d.ts +140 -0
  255. package/dist/node/devices/led.js +295 -0
  256. package/dist/node/devices/led.js.map +1 -0
  257. package/dist/node/devices/light.js +5 -32
  258. package/dist/node/devices/light.js.map +1 -1
  259. package/dist/node/devices/marioaccelerometer.d.ts +0 -1
  260. package/dist/node/devices/marioaccelerometer.js +7 -34
  261. package/dist/node/devices/marioaccelerometer.js.map +1 -1
  262. package/dist/node/devices/mariobarcodesensor.d.ts +0 -1
  263. package/dist/node/devices/mariobarcodesensor.js +7 -34
  264. package/dist/node/devices/mariobarcodesensor.js.map +1 -1
  265. package/dist/node/devices/mariopantssensor.d.ts +0 -1
  266. package/dist/node/devices/mariopantssensor.js +7 -34
  267. package/dist/node/devices/mariopantssensor.js.map +1 -1
  268. package/dist/node/devices/mediumlinearmotor.js +3 -30
  269. package/dist/node/devices/mediumlinearmotor.js.map +1 -1
  270. package/dist/node/devices/motionsensor.d.ts +0 -1
  271. package/dist/node/devices/motionsensor.js +7 -34
  272. package/dist/node/devices/motionsensor.js.map +1 -1
  273. package/dist/node/devices/motor.d.ts +182 -0
  274. package/dist/node/devices/motor.js +367 -0
  275. package/dist/node/devices/motor.js.map +1 -0
  276. package/dist/node/devices/movehubmediumlinearmotor.js +3 -30
  277. package/dist/node/devices/movehubmediumlinearmotor.js.map +1 -1
  278. package/dist/node/devices/movehubtiltsensor.d.ts +0 -1
  279. package/dist/node/devices/movehubtiltsensor.js +7 -34
  280. package/dist/node/devices/movehubtiltsensor.js.map +1 -1
  281. package/dist/node/devices/piezobuzzer.js +3 -30
  282. package/dist/node/devices/piezobuzzer.js.map +1 -1
  283. package/dist/node/devices/remotecontrolbutton.d.ts +0 -1
  284. package/dist/node/devices/remotecontrolbutton.js +8 -35
  285. package/dist/node/devices/remotecontrolbutton.js.map +1 -1
  286. package/dist/node/devices/sensor.d.ts +305 -0
  287. package/dist/node/devices/sensor.js +662 -0
  288. package/dist/node/devices/sensor.js.map +1 -0
  289. package/dist/node/devices/simplemediumlinearmotor.js +3 -30
  290. package/dist/node/devices/simplemediumlinearmotor.js.map +1 -1
  291. package/dist/node/devices/tachomotor.d.ts +0 -1
  292. package/dist/node/devices/tachomotor.js +14 -41
  293. package/dist/node/devices/tachomotor.js.map +1 -1
  294. package/dist/node/devices/technic3x3colorlightmatrix.js +7 -34
  295. package/dist/node/devices/technic3x3colorlightmatrix.js.map +1 -1
  296. package/dist/node/devices/techniccolorsensor.d.ts +0 -1
  297. package/dist/node/devices/techniccolorsensor.js +9 -36
  298. package/dist/node/devices/techniccolorsensor.js.map +1 -1
  299. package/dist/node/devices/technicdistancesensor.d.ts +0 -1
  300. package/dist/node/devices/technicdistancesensor.js +7 -34
  301. package/dist/node/devices/technicdistancesensor.js.map +1 -1
  302. package/dist/node/devices/technicforcesensor.d.ts +0 -1
  303. package/dist/node/devices/technicforcesensor.js +7 -34
  304. package/dist/node/devices/technicforcesensor.js.map +1 -1
  305. package/dist/node/devices/techniclargeangularmotor.js +3 -30
  306. package/dist/node/devices/techniclargeangularmotor.js.map +1 -1
  307. package/dist/node/devices/techniclargelinearmotor.js +3 -30
  308. package/dist/node/devices/techniclargelinearmotor.js.map +1 -1
  309. package/dist/node/devices/technicmediumangularmotor.js +3 -30
  310. package/dist/node/devices/technicmediumangularmotor.js.map +1 -1
  311. package/dist/node/devices/technicmediumhubaccelerometersensor.d.ts +0 -1
  312. package/dist/node/devices/technicmediumhubaccelerometersensor.js +7 -34
  313. package/dist/node/devices/technicmediumhubaccelerometersensor.js.map +1 -1
  314. package/dist/node/devices/technicmediumhubgyrosensor.d.ts +0 -1
  315. package/dist/node/devices/technicmediumhubgyrosensor.js +7 -34
  316. package/dist/node/devices/technicmediumhubgyrosensor.js.map +1 -1
  317. package/dist/node/devices/technicmediumhubtiltsensor.d.ts +0 -1
  318. package/dist/node/devices/technicmediumhubtiltsensor.js +7 -34
  319. package/dist/node/devices/technicmediumhubtiltsensor.js.map +1 -1
  320. package/dist/node/devices/technicsmallangularmotor.js +3 -30
  321. package/dist/node/devices/technicsmallangularmotor.js.map +1 -1
  322. package/dist/node/devices/technicxlargelinearmotor.js +3 -30
  323. package/dist/node/devices/technicxlargelinearmotor.js.map +1 -1
  324. package/dist/node/devices/tiltsensor.d.ts +0 -1
  325. package/dist/node/devices/tiltsensor.js +7 -34
  326. package/dist/node/devices/tiltsensor.js.map +1 -1
  327. package/dist/node/devices/trainmotor.js +3 -30
  328. package/dist/node/devices/trainmotor.js.map +1 -1
  329. package/dist/node/devices/voltagesensor.d.ts +0 -1
  330. package/dist/node/devices/voltagesensor.js +7 -34
  331. package/dist/node/devices/voltagesensor.js.map +1 -1
  332. package/dist/node/hub.d.ts +291 -0
  333. package/dist/node/hub.js +778 -0
  334. package/dist/node/hub.js.map +1 -0
  335. package/dist/node/hubs/basehub.d.ts +9 -11
  336. package/dist/node/hubs/basehub.js +74 -101
  337. package/dist/node/hubs/basehub.js.map +1 -1
  338. package/dist/node/hubs/duplotrainbase.d.ts +1 -2
  339. package/dist/node/hubs/duplotrainbase.js +6 -33
  340. package/dist/node/hubs/duplotrainbase.js.map +1 -1
  341. package/dist/node/hubs/hub.d.ts +1 -2
  342. package/dist/node/hubs/hub.js +8 -35
  343. package/dist/node/hubs/hub.js.map +1 -1
  344. package/dist/node/hubs/lpf2hub.d.ts +5 -6
  345. package/dist/node/hubs/lpf2hub.js +17 -44
  346. package/dist/node/hubs/lpf2hub.js.map +1 -1
  347. package/dist/node/hubs/mario.d.ts +1 -2
  348. package/dist/node/hubs/mario.js +6 -33
  349. package/dist/node/hubs/mario.js.map +1 -1
  350. package/dist/node/hubs/movehub.d.ts +1 -2
  351. package/dist/node/hubs/movehub.js +8 -35
  352. package/dist/node/hubs/movehub.js.map +1 -1
  353. package/dist/node/hubs/remotecontrol.d.ts +1 -2
  354. package/dist/node/hubs/remotecontrol.js +6 -33
  355. package/dist/node/hubs/remotecontrol.js.map +1 -1
  356. package/dist/node/hubs/technicmediumhub.d.ts +1 -2
  357. package/dist/node/hubs/technicmediumhub.js +6 -33
  358. package/dist/node/hubs/technicmediumhub.js.map +1 -1
  359. package/dist/node/hubs/technicsmallhub.d.ts +1 -2
  360. package/dist/node/hubs/technicsmallhub.js +6 -33
  361. package/dist/node/hubs/technicsmallhub.js.map +1 -1
  362. package/dist/node/hubs/wedo2smarthub.d.ts +3 -5
  363. package/dist/node/hubs/wedo2smarthub.js +10 -37
  364. package/dist/node/hubs/wedo2smarthub.js.map +1 -1
  365. package/dist/node/index-browser.js +91 -116
  366. package/dist/node/index-browser.js.map +1 -1
  367. package/dist/node/index-node.d.ts +1 -0
  368. package/dist/node/index-node.js +49 -119
  369. package/dist/node/index-node.js.map +1 -1
  370. package/dist/node/index.d.ts +31 -0
  371. package/dist/node/index.js +93 -0
  372. package/dist/node/index.js.map +1 -0
  373. package/dist/node/index.mjs +0 -0
  374. package/dist/node/interfaces.d.ts +1 -3
  375. package/dist/node/interfaces.js +1 -2
  376. package/dist/node/nobleabstraction.d.ts +0 -2
  377. package/dist/node/nobleabstraction.js +5 -7
  378. package/dist/node/nobleabstraction.js.map +1 -1
  379. package/dist/node/poweredup-browser.d.ts +0 -2
  380. package/dist/node/poweredup-browser.js +23 -49
  381. package/dist/node/poweredup-browser.js.map +1 -1
  382. package/dist/node/poweredup-node.d.ts +0 -2
  383. package/dist/node/poweredup-node.js +31 -58
  384. package/dist/node/poweredup-node.js.map +1 -1
  385. package/dist/node/poweredup.d.ts +83 -0
  386. package/dist/node/poweredup.js +542 -0
  387. package/dist/node/poweredup.js.map +1 -0
  388. package/dist/node/protocol-wedo.d.ts +158 -0
  389. package/dist/node/protocol-wedo.js +342 -0
  390. package/dist/node/protocol-wedo.js.map +1 -0
  391. package/dist/node/protocol.d.ts +340 -0
  392. package/dist/node/protocol.js +730 -0
  393. package/dist/node/protocol.js.map +1 -0
  394. package/dist/node/types.d.ts +408 -0
  395. package/dist/node/types.js +291 -0
  396. package/dist/node/types.js.map +1 -0
  397. package/dist/node/utils.d.ts +1 -2
  398. package/dist/node/utils.js +14 -26
  399. package/dist/node/utils.js.map +1 -1
  400. package/dist/node/webbleabstraction.d.ts +1 -3
  401. package/dist/node/webbleabstraction.js +3 -7
  402. package/dist/node/webbleabstraction.js.map +1 -1
  403. package/dist/poweredup-browser.d.ts +46 -0
  404. package/dist/poweredup-browser.d.ts.map +1 -0
  405. package/dist/poweredup-browser.js +210 -0
  406. package/dist/poweredup-browser.js.map +1 -0
  407. package/dist/poweredup-node.d.ts +49 -0
  408. package/dist/poweredup-node.d.ts.map +1 -0
  409. package/dist/poweredup-node.js +166 -0
  410. package/dist/poweredup-node.js.map +1 -0
  411. package/dist/tsconfig.tsbuildinfo +1 -0
  412. package/dist/utils.d.ts +13 -0
  413. package/dist/utils.d.ts.map +1 -0
  414. package/dist/utils.js +90 -0
  415. package/dist/utils.js.map +1 -0
  416. package/dist/webbleabstraction.d.ts +27 -0
  417. package/dist/webbleabstraction.d.ts.map +1 -0
  418. package/dist/webbleabstraction.js +104 -0
  419. package/dist/webbleabstraction.js.map +1 -0
  420. package/docs/.nojekyll +1 -0
  421. package/docs/assets/hierarchy.js +1 -0
  422. package/docs/assets/highlight.css +99 -0
  423. package/docs/assets/icons.js +18 -0
  424. package/docs/assets/icons.svg +1 -0
  425. package/docs/assets/main.js +60 -0
  426. package/docs/assets/navigation.js +1 -0
  427. package/docs/assets/search.js +1 -0
  428. package/docs/assets/style.css +1633 -0
  429. package/docs/classes/AbsoluteMotor.html +242 -0
  430. package/docs/classes/BaseHub.html +220 -0
  431. package/docs/classes/BasicMotor.html +201 -0
  432. package/docs/classes/Color.html +3 -0
  433. package/docs/classes/ColorDistanceSensor.html +214 -0
  434. package/docs/classes/CurrentSensor.html +185 -0
  435. package/docs/classes/Device.html +185 -0
  436. package/docs/classes/DuploTrainBase.html +233 -0
  437. package/docs/classes/DuploTrainBaseColorSensor.html +185 -0
  438. package/docs/classes/DuploTrainBaseMotor.html +201 -0
  439. package/docs/classes/DuploTrainBaseSpeaker.html +191 -0
  440. package/docs/classes/DuploTrainBaseSpeedometer.html +185 -0
  441. package/docs/classes/Hub.html +233 -0
  442. package/docs/classes/HubLED.html +191 -0
  443. package/docs/classes/Light.html +195 -0
  444. package/docs/classes/Mario.html +233 -0
  445. package/docs/classes/MediumLinearMotor.html +229 -0
  446. package/docs/classes/MotionSensor.html +185 -0
  447. package/docs/classes/MoveHub.html +233 -0
  448. package/docs/classes/MoveHubMediumLinearMotor.html +229 -0
  449. package/docs/classes/MoveHubTiltSensor.html +185 -0
  450. package/docs/classes/PiezoBuzzer.html +189 -0
  451. package/docs/classes/PoweredUP.html +180 -0
  452. package/docs/classes/RemoteControl.html +233 -0
  453. package/docs/classes/RemoteControlButton.html +185 -0
  454. package/docs/classes/SimpleMediumLinearMotor.html +201 -0
  455. package/docs/classes/TachoMotor.html +229 -0
  456. package/docs/classes/Technic3x3ColorLightMatrix.html +189 -0
  457. package/docs/classes/TechnicColorSensor.html +191 -0
  458. package/docs/classes/TechnicDistanceSensor.html +192 -0
  459. package/docs/classes/TechnicForceSensor.html +185 -0
  460. package/docs/classes/TechnicLargeAngularMotor.html +242 -0
  461. package/docs/classes/TechnicLargeLinearMotor.html +242 -0
  462. package/docs/classes/TechnicMediumAngularMotor.html +242 -0
  463. package/docs/classes/TechnicMediumHub.html +233 -0
  464. package/docs/classes/TechnicMediumHubAccelerometerSensor.html +185 -0
  465. package/docs/classes/TechnicMediumHubGyroSensor.html +185 -0
  466. package/docs/classes/TechnicMediumHubTiltSensor.html +197 -0
  467. package/docs/classes/TechnicSmallAngularMotor.html +242 -0
  468. package/docs/classes/TechnicXLargeLinearMotor.html +242 -0
  469. package/docs/classes/TiltSensor.html +185 -0
  470. package/docs/classes/TrainMotor.html +201 -0
  471. package/docs/classes/VoltageSensor.html +185 -0
  472. package/docs/classes/WeDo2SmartHub.html +229 -0
  473. package/docs/enums/ActionType.html +22 -0
  474. package/docs/enums/AlertOperation.html +10 -0
  475. package/docs/enums/AlertPayload.html +6 -0
  476. package/docs/enums/AlertType.html +10 -0
  477. package/docs/enums/BLECharacteristic.html +15 -0
  478. package/docs/enums/BLEManufacturerData.html +8 -0
  479. package/docs/enums/BLEService.html +7 -0
  480. package/docs/enums/BrakingStyle.html +7 -0
  481. package/docs/enums/ButtonState.html +11 -0
  482. package/docs/enums/Consts.Color.html +25 -0
  483. package/docs/enums/DeviceType.html +79 -0
  484. package/docs/enums/DuploTrainBaseSound.html +11 -0
  485. package/docs/enums/ErrorCode.html +18 -0
  486. package/docs/enums/Event.html +8 -0
  487. package/docs/enums/HWNetWorkCommandType.html +28 -0
  488. package/docs/enums/HWNetworkFamily.html +20 -0
  489. package/docs/enums/HWNetworkSubFamily.html +16 -0
  490. package/docs/enums/HubPropertyOperation.html +14 -0
  491. package/docs/enums/HubPropertyPayload.html +32 -0
  492. package/docs/enums/HubPropertyReference.html +32 -0
  493. package/docs/enums/HubType.html +19 -0
  494. package/docs/enums/IOTypeID.html +30 -0
  495. package/docs/enums/MarioColor.html +17 -0
  496. package/docs/enums/MarioPantsType.html +13 -0
  497. package/docs/enums/MessageType.html +48 -0
  498. package/docs/enums/ModeInformationType.html +22 -0
  499. package/docs/enums/PortInputFormatSetupSubCommand.html +14 -0
  500. package/docs/hierarchy.html +1 -0
  501. package/docs/index.html +18 -120
  502. package/docs/modules/Consts.html +1 -0
  503. package/docs/modules.html +1 -0
  504. package/docs/variables/ColorNames.html +1 -0
  505. package/docs/variables/DeviceTypeNames.html +1 -0
  506. package/docs/variables/HubTypeNames.html +1 -0
  507. package/docs/variables/isWebBluetooth.html +1 -0
  508. package/package.json +19 -25
  509. package/src/color.ts +1 -1
  510. package/src/consts.ts +16 -16
  511. package/src/devices/absolutemotor.ts +4 -7
  512. package/src/devices/basicmotor.ts +4 -8
  513. package/src/devices/colordistancesensor.ts +8 -14
  514. package/src/devices/currentsensor.ts +3 -3
  515. package/src/devices/device.ts +2 -2
  516. package/src/devices/duplotrainbasecolorsensor.ts +4 -4
  517. package/src/devices/duplotrainbasemotor.ts +3 -3
  518. package/src/devices/duplotrainbasespeaker.ts +3 -5
  519. package/src/devices/duplotrainbasespeedometer.ts +3 -3
  520. package/src/devices/hubled.ts +3 -5
  521. package/src/devices/light.ts +4 -6
  522. package/src/devices/marioaccelerometer.ts +3 -3
  523. package/src/devices/mariobarcodesensor.ts +3 -3
  524. package/src/devices/mariopantssensor.ts +3 -3
  525. package/src/devices/mediumlinearmotor.ts +3 -3
  526. package/src/devices/motionsensor.ts +3 -3
  527. package/src/devices/movehubmediumlinearmotor.ts +3 -3
  528. package/src/devices/movehubtiltsensor.ts +3 -3
  529. package/src/devices/piezobuzzer.ts +3 -4
  530. package/src/devices/remotecontrolbutton.ts +3 -3
  531. package/src/devices/simplemediumlinearmotor.ts +3 -3
  532. package/src/devices/tachomotor.ts +5 -11
  533. package/src/devices/technic3x3colorlightmatrix.ts +4 -5
  534. package/src/devices/techniccolorsensor.ts +4 -5
  535. package/src/devices/technicdistancesensor.ts +3 -4
  536. package/src/devices/technicforcesensor.ts +3 -3
  537. package/src/devices/techniclargeangularmotor.ts +3 -3
  538. package/src/devices/techniclargelinearmotor.ts +3 -3
  539. package/src/devices/technicmediumangularmotor.ts +3 -3
  540. package/src/devices/technicmediumhubaccelerometersensor.ts +3 -3
  541. package/src/devices/technicmediumhubgyrosensor.ts +3 -3
  542. package/src/devices/technicmediumhubtiltsensor.ts +6 -9
  543. package/src/devices/technicsmallangularmotor.ts +3 -3
  544. package/src/devices/technicxlargelinearmotor.ts +3 -3
  545. package/src/devices/tiltsensor.ts +3 -3
  546. package/src/devices/trainmotor.ts +3 -3
  547. package/src/devices/voltagesensor.ts +3 -3
  548. package/src/hubs/basehub.ts +42 -51
  549. package/src/hubs/duplotrainbase.ts +5 -5
  550. package/src/hubs/hub.ts +5 -5
  551. package/src/hubs/lpf2hub.ts +4 -7
  552. package/src/hubs/mario.ts +5 -5
  553. package/src/hubs/movehub.ts +5 -5
  554. package/src/hubs/remotecontrol.ts +5 -5
  555. package/src/hubs/technicmediumhub.ts +5 -5
  556. package/src/hubs/technicsmallhub.ts +5 -5
  557. package/src/hubs/wedo2smarthub.ts +7 -9
  558. package/src/index-browser.ts +46 -46
  559. package/src/index-node.ts +47 -46
  560. package/src/interfaces.ts +2 -2
  561. package/src/nobleabstraction.ts +10 -10
  562. package/src/poweredup-browser.ts +15 -19
  563. package/src/poweredup-node.ts +15 -22
  564. package/src/utils.ts +1 -1
  565. package/src/webbleabstraction.ts +3 -3
  566. package/tsconfig.tsbuildinfo +1 -0
  567. package/typedoc.json +14 -0
  568. package/.jsdoc.json +0 -40
  569. package/abandonware-noble.d.ts +0 -129
  570. package/dist/browser/poweredup.js +0 -3
  571. package/dist/browser/poweredup.js.LICENSE.txt +0 -8
  572. package/dist/browser/poweredup.js.map +0 -1
  573. package/docs/AbsoluteMotor.html +0 -2008
  574. package/docs/BaseHub.html +0 -1391
  575. package/docs/BasicMotor.html +0 -1459
  576. package/docs/ColorDistanceSensor.html +0 -3025
  577. package/docs/CurrentSensor.html +0 -1022
  578. package/docs/Device.html +0 -841
  579. package/docs/DuploTrainBase.html +0 -2092
  580. package/docs/DuploTrainBaseColorSensor.html +0 -1509
  581. package/docs/DuploTrainBaseMotor.html +0 -1479
  582. package/docs/DuploTrainBaseSpeaker.html +0 -1193
  583. package/docs/DuploTraniBaseSpeedometer.html +0 -871
  584. package/docs/Hub.html +0 -7451
  585. package/docs/HubLED.html +0 -1239
  586. package/docs/LPF2Hub.html +0 -2066
  587. package/docs/Light.html +0 -1239
  588. package/docs/Mario.html +0 -2092
  589. package/docs/MarioAccelerometer.html +0 -1215
  590. package/docs/MarioBarcodeSensor.html +0 -1215
  591. package/docs/MarioPantsSensor.html +0 -1022
  592. package/docs/MediumLinearMotor.html +0 -1357
  593. package/docs/MotionSensor.html +0 -1022
  594. package/docs/MoveHub.html +0 -2092
  595. package/docs/MoveHubMediumLinearMotor.html +0 -1357
  596. package/docs/MoveHubTiltSensor.html +0 -1045
  597. package/docs/PiezoBuzzer.html +0 -1057
  598. package/docs/PoweredUP.html +0 -4371
  599. package/docs/RemoteControl.html +0 -2092
  600. package/docs/RemoteControlButton.html +0 -1022
  601. package/docs/SimpleMediumLinearMotor.html +0 -871
  602. package/docs/TachoMotor.html +0 -2620
  603. package/docs/Technic3x3ColorLightMatrix.html +0 -1037
  604. package/docs/TechnicColorSensor.html +0 -1525
  605. package/docs/TechnicDistanceSensor.html +0 -1401
  606. package/docs/TechnicForceSensor.html +0 -1316
  607. package/docs/TechnicLargeAngularMotor.html +0 -2028
  608. package/docs/TechnicLargeLinearMotor.html +0 -2028
  609. package/docs/TechnicMediumAngularMotor.html +0 -2028
  610. package/docs/TechnicMediumHub.html +0 -2092
  611. package/docs/TechnicMediumHubAccelerometerSensor.html +0 -1068
  612. package/docs/TechnicMediumHubGyroSensor.html +0 -1068
  613. package/docs/TechnicMediumHubTiltSensor.html +0 -1696
  614. package/docs/TechnicSmallAngularMotor.html +0 -2028
  615. package/docs/TechnicXLargeLinearMotor.html +0 -2028
  616. package/docs/TiltSensor.html +0 -1045
  617. package/docs/TrainMotor.html +0 -1479
  618. package/docs/VoltageSensor.html +0 -1022
  619. package/docs/WeDo2SmartHub.html +0 -1887
  620. package/docs/devices_absolutemotor.js.html +0 -195
  621. package/docs/devices_basicmotor.js.html +0 -138
  622. package/docs/devices_colordistancesensor.js.html +0 -361
  623. package/docs/devices_currentsensor.js.html +0 -132
  624. package/docs/devices_device.js.html +0 -239
  625. package/docs/devices_duplotrainbasecolorsensor.js.html +0 -154
  626. package/docs/devices_duplotrainbasemotor.js.html +0 -89
  627. package/docs/devices_duplotrainbasespeaker.js.html +0 -117
  628. package/docs/devices_duplotrainbasespeedometer.js.html +0 -111
  629. package/docs/devices_hubled.js.html +0 -137
  630. package/docs/devices_light.js.html +0 -123
  631. package/docs/devices_marioaccelerometer.js.html +0 -127
  632. package/docs/devices_mariobarcodesensor.js.html +0 -135
  633. package/docs/devices_mariopantssensor.js.html +0 -111
  634. package/docs/devices_mediumlinearmotor.js.html +0 -89
  635. package/docs/devices_motionsensor.js.html +0 -115
  636. package/docs/devices_movehubmediumlinearmotor.js.html +0 -89
  637. package/docs/devices_movehubtiltsensor.js.html +0 -113
  638. package/docs/devices_piezobuzzer.js.html +0 -105
  639. package/docs/devices_remotecontrolbutton.js.html +0 -117
  640. package/docs/devices_simplemediumlinearmotor.js.html +0 -89
  641. package/docs/devices_tachomotor.js.html +0 -244
  642. package/docs/devices_technic3x3colorlightmatrix.js.html +0 -131
  643. package/docs/devices_techniccolorsensor.js.html +0 -149
  644. package/docs/devices_technicdistancesensor.js.html +0 -135
  645. package/docs/devices_technicforcesensor.js.html +0 -135
  646. package/docs/devices_techniclargeangularmotor.js.html +0 -89
  647. package/docs/devices_techniclargelinearmotor.js.html +0 -89
  648. package/docs/devices_technicmediumangularmotor.js.html +0 -89
  649. package/docs/devices_technicmediumhubaccelerometersensor.js.html +0 -115
  650. package/docs/devices_technicmediumhubgyrosensor.js.html +0 -115
  651. package/docs/devices_technicmediumhubtiltsensor.js.html +0 -183
  652. package/docs/devices_technicsmallangularmotor.js.html +0 -89
  653. package/docs/devices_technicxlargelinearmotor.js.html +0 -89
  654. package/docs/devices_tiltsensor.js.html +0 -113
  655. package/docs/devices_trainmotor.js.html +0 -89
  656. package/docs/devices_voltagesensor.js.html +0 -136
  657. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  658. package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
  659. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  660. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  661. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  662. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  663. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  664. package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
  665. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  666. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  667. package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
  668. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  669. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  670. package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  671. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  672. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  673. package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
  674. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  675. package/docs/fonts/OpenSans-Semibold-webfont.eot +0 -0
  676. package/docs/fonts/OpenSans-Semibold-webfont.svg +0 -1830
  677. package/docs/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  678. package/docs/fonts/OpenSans-Semibold-webfont.woff +0 -0
  679. package/docs/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  680. package/docs/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1830
  681. package/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  682. package/docs/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  683. package/docs/global.html +0 -3996
  684. package/docs/hubs_basehub.js.html +0 -469
  685. package/docs/hubs_duplotrainbase.js.html +0 -112
  686. package/docs/hubs_hub.js.html +0 -121
  687. package/docs/hubs_mario.js.html +0 -108
  688. package/docs/hubs_movehub.js.html +0 -123
  689. package/docs/hubs_remotecontrol.js.html +0 -114
  690. package/docs/hubs_technicmediumhub.js.html +0 -119
  691. package/docs/hubs_technicsmallhub.js.html +0 -118
  692. package/docs/hubs_wedo2smarthub.js.html +0 -265
  693. package/docs/icons/home.svg +0 -4
  694. package/docs/icons/search.svg +0 -4
  695. package/docs/poweredup-browser.js.html +0 -292
  696. package/docs/poweredup-node.js.html +0 -250
  697. package/docs/scripts/linenumber.js +0 -25
  698. package/docs/scripts/pagelocation.js +0 -89
  699. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  700. package/docs/scripts/prettify/lang-css.js +0 -2
  701. package/docs/scripts/prettify/prettify.js +0 -28
  702. package/docs/styles/collapse.css +0 -27
  703. package/docs/styles/jsdoc-default.css +0 -358
  704. package/docs/styles/prettify-jsdoc.css +0 -111
  705. package/docs/styles/prettify-tomorrow.css +0 -132
  706. package/noble-mac.d.ts +0 -3
package/typedoc.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "entryPoints": ["src/index-node.ts"],
4
+ "out": "docs",
5
+ "name": "node-poweredup",
6
+ "readme": "README.md",
7
+ "excludePrivate": true,
8
+ "excludeProtected": true,
9
+ "excludeInternal": true,
10
+ "intentionallyNotExported": ["IDeviceInterface", "IBLEAbstraction", "Output"],
11
+ "navigationLinks": {
12
+ "GitHub": "https://github.com/nathankellenicki/node-poweredup"
13
+ }
14
+ }
package/.jsdoc.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "tags": {
3
- "allowUnknownTags": true,
4
- "dictionaries": ["jsdoc"]
5
- },
6
- "source": {
7
- "include": [ "README.md", "dist/node" ],
8
- "includePattern": ".js$"
9
- },
10
- "plugins": ["plugins/markdown"],
11
- "templates": {
12
- "referenceTitle": "node-poweredup Reference",
13
- "logoFile": "",
14
- "cleverLinks": false,
15
- "monospaceLinks": false,
16
- "dateFormat": "ddd MMM Do YYYY",
17
- "outputSourceFiles": true,
18
- "outputSourcePath": true,
19
- "systemName": "node-poweredup",
20
- "footer": "",
21
- "copyright": "node-poweredup by Nathan Kellenicki licensed under the MIT license.",
22
- "navType": "vertical",
23
- "theme": "simplex",
24
- "linenums": true,
25
- "collapseSymbols": false,
26
- "inverseNav": true,
27
- "protocol": "html://",
28
- "methodHeadingReturns": false
29
- },
30
- "markdown": {
31
- "parser": "gfm",
32
- "hardwrap": true
33
- },
34
- "opts": {
35
- "destination": "./docs/",
36
- "encoding": "utf8",
37
- "private": true,
38
- "recurse": true
39
- }
40
- }
@@ -1,129 +0,0 @@
1
- declare module "@abandonware/noble" {
2
- // Type definitions for noble
3
- // Project: https://github.com/sandeepmistry/noble
4
- // Definitions by: Seon-Wook Park <https://github.com/swook>
5
- // Shantanu Bhadoria <https://github.com/shantanubhadoria>
6
- // Luke Libraro <https://github.com/lukel99>
7
- // Dan Chao <https://github.com/bioball>
8
- // Michal Lower <https://github.com/keton>
9
- // Rob Moran <https://github.com/thegecko>
10
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
11
-
12
- /// <reference types="node" />
13
-
14
- import events = require("events");
15
-
16
- export function startScanning(callback?: (error?: Error) => void): void;
17
- export function startScanning(serviceUUIDs: string[], callback?: (error?: Error) => void): void;
18
- export function startScanning(serviceUUIDs: string[], allowDuplicates: boolean, callback?: (error?: Error) => void): void;
19
- export function stopScanning(callback?: () => void): void;
20
-
21
- export function on(event: "stateChange", listener: (state: string) => void): events.EventEmitter;
22
- export function on(event: "scanStart", listener: () => void): events.EventEmitter;
23
- export function on(event: "scanStop", listener: () => void): events.EventEmitter;
24
- export function on(event: "discover", listener: (peripheral: Peripheral) => void): events.EventEmitter;
25
- export function on(event: string, listener: Function): events.EventEmitter;
26
-
27
- export function removeListener(event: "stateChange", listener: (state: string) => void): events.EventEmitter;
28
- export function removeListener(event: "scanStart", listener: () => void): events.EventEmitter;
29
- export function removeListener(event: "scanStop", listener: () => void): events.EventEmitter;
30
- export function removeListener(event: "discover", listener: (peripheral: Peripheral) => void): events.EventEmitter;
31
- export function removeListener(event: string, listener: Function): events.EventEmitter;
32
-
33
- export var state:string;
34
-
35
- export class Peripheral extends events.EventEmitter {
36
- id: string;
37
- uuid: string;
38
- address: string;
39
- addressType: string;
40
- connectable: boolean;
41
- advertisement: Advertisement;
42
- rssi: number;
43
- services: Service[];
44
- state: 'error' | 'connecting' | 'connected' | 'disconnecting' | 'disconnected';
45
-
46
- connect(callback?: (error: string) => void): void;
47
- disconnect(callback?: () => void): void;
48
- updateRssi(callback?: (error: string, rssi: number) => void): void;
49
- discoverServices(serviceUUIDs: string[], callback?: (error: string, services: Service[]) => void): void;
50
- discoverAllServicesAndCharacteristics(callback?: (error: string, services: Service[], characteristics: Characteristic[]) => void): void;
51
- discoverSomeServicesAndCharacteristics(serviceUUIDs: string[], characteristicUUIDs: string[], callback?: (error: string, services: Service[], characteristics: Characteristic[]) => void): void;
52
-
53
- readHandle(handle: Buffer, callback: (error: string, data: Buffer) => void): void;
54
- writeHandle(handle: Buffer, data: Buffer, withoutResponse: boolean, callback: (error: string) => void): void;
55
- toString(): string;
56
-
57
- on(event: "connect", listener: (error: string) => void): this;
58
- on(event: "disconnect", listener: (error: string) => void): this;
59
- on(event: "rssiUpdate", listener: (rssi: number) => void): this;
60
- on(event: "servicesDiscover", listener: (services: Service[]) => void): this;
61
- on(event: string, listener: Function): this;
62
- }
63
-
64
- export interface Advertisement {
65
- localName: string;
66
- serviceData: {
67
- uuid: string,
68
- data: Buffer
69
- };
70
- txPowerLevel: number;
71
- manufacturerData: Buffer;
72
- serviceUuids: string[];
73
- }
74
-
75
- export class Service extends events.EventEmitter {
76
- uuid: string;
77
- name: string;
78
- type: string;
79
- includedServiceUuids: string[];
80
- characteristics: Characteristic[];
81
-
82
- discoverIncludedServices(serviceUUIDs: string[], callback?: (error: string, includedServiceUuids: string[]) => void): void;
83
- discoverCharacteristics(characteristicUUIDs: string[], callback?: (error: string, characteristics: Characteristic[]) => void): void;
84
- toString(): string;
85
-
86
- on(event: "includedServicesDiscover", listener: (includedServiceUuids: string[]) => void): this;
87
- on(event: "characteristicsDiscover", listener: (characteristics: Characteristic[]) => void): this;
88
- on(event: string, listener: Function): this;
89
- }
90
-
91
- export class Characteristic extends events.EventEmitter {
92
- uuid: string;
93
- name: string;
94
- type: string;
95
- properties: string[];
96
- descriptors: Descriptor[];
97
-
98
- read(callback?: (error: string, data: Buffer) => void): void;
99
- write(data: Buffer, notify: boolean, callback?: (error: string) => void): void;
100
- broadcast(broadcast: boolean, callback?: (error: string) => void): void;
101
- notify(notify: boolean, callback?: (error: string) => void): void;
102
- discoverDescriptors(callback?: (error: string, descriptors: Descriptor[]) => void): void;
103
- toString(): string;
104
- subscribe(callback?: (error: string) => void): void;
105
- unsubscribe(callback?: (error: string) => void): void;
106
-
107
- on(event: "read", listener: (data: Buffer, isNotification: boolean) => void): this;
108
- on(event: "write", withoutResponse: boolean, listener: (error: string) => void): this;
109
- on(event: "broadcast", listener: (state: string) => void): this;
110
- on(event: "notify", listener: (state: string) => void): this;
111
- on(event: "descriptorsDiscover", listener: (descriptors: Descriptor[]) => void): this;
112
- on(event: string, listener: Function): this;
113
- on(event: string, option: boolean, listener: Function): this;
114
- }
115
-
116
- export class Descriptor extends events.EventEmitter {
117
- uuid: string;
118
- name: string;
119
- type: string;
120
-
121
- readValue(callback?: (error: string, data: Buffer) => void): void;
122
- writeValue(data: Buffer, callback?: (error: string) => void): void;
123
- toString(): string;
124
-
125
- on(event: "valueRead", listener: (error: string, data: Buffer) => void): this;
126
- on(event: "valueWrite", listener: (error: string) => void): this;
127
- on(event: string, listener: Function): this;
128
- }
129
- }
@@ -1,3 +0,0 @@
1
- /*! For license information please see poweredup.js.LICENSE.txt */
2
- (()=>{var e={7526:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,o=a(e),s=o[0],c=o[1],u=new n(function(e,t,r){return 3*(t+r)/4-r}(0,s,c)),f=0,l=c>0?s-4:s;for(r=0;r<l;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[f++]=t>>16&255,u[f++]=t>>8&255,u[f++]=255&t;return 2===c&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[f++]=255&t),1===c&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[f++]=t>>8&255,u[f++]=255&t),u},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,o=[],s=16383,a=0,u=i-n;a<u;a+=s)o.push(c(e,a,a+s>u?u:a+s));return 1===n?(t=e[i-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[i-2]<<8)+e[i-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],i[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,i){for(var n,o,s=[],a=t;a<i;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=n)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},8287:(e,t,r)=>{"use strict";const i=r(7526),n=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|p(e,t);let i=a(r);const n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return _(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return c.from(i,t,r);const n=function(e){if(c.isBuffer(e)){const t=0|d(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||q(e.length)?a(0):_(e):"Buffer"===e.type&&Array.isArray(e.data)?_(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return f(e),a(e<0?0:0|d(e))}function _(e){const t=e.length<0?0:0|d(e.length),r=a(t);for(let i=0;i<t;i+=1)r[i]=255&e[i];return r}function h(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(i,c.prototype),i}function d(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(e).length;default:if(n)return i?-1:$(e).length;t=(""+t).toLowerCase(),n=!0}}function E(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,r);case"utf8":case"utf-8":return g(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return D(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function O(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function T(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:b(e,t,r,i,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,i,n){let o,s=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){let i=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===i?0:o-i)){if(-1===i&&(i=o),o-i+1===c)return i*s}else-1!==i&&(o-=o-i),i=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let i=0;i<c;i++)if(u(e,o+i)!==u(t,i)){r=!1;break}if(r)return o}return-1}function v(e,t,r,i){r=Number(r)||0;const n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;const o=t.length;let s;for(i>o/2&&(i=o/2),s=0;s<i;++s){const i=parseInt(t.substr(2*s,2),16);if(q(i))return s;e[r+s]=i}return s}function M(e,t,r,i){return z($(t,e.length-r),e,r,i)}function y(e,t,r,i){return z(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function R(e,t,r,i){return z(K(t),e,r,i)}function m(e,t,r,i){return z(function(e,t){let r,i,n;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i);return o}(t,e.length-r),e,r,i)}function S(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function g(e,t,r){r=Math.min(e.length,r);const i=[];let n=t;for(;n<r;){const t=e[n];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(n+s<=r){let r,i,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[n+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[n+1],i=e[n+2],128==(192&r)&&128==(192&i)&&(c=(15&t)<<12|(63&r)<<6|63&i,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[n+1],i=e[n+2],a=e[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&i)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),n+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=I));return r}(i)}c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return f(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return l(e)},c.allocUnsafeSlow=function(e){return l(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),X(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const i=c.allocUnsafe(t);let n=0;for(r=0;r<e.length;++r){let t=e[r];if(X(t,Uint8Array))n+t.length>i.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(i,n)):Uint8Array.prototype.set.call(i,t,n);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,n)}n+=t.length}return i},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)O(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)O(this,t,t+3),O(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)O(this,t,t+7),O(this,t+1,t+6),O(this,t+2,t+5),O(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?g(this,0,e):E.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,i,n){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(i,n),f=e.slice(t,r);for(let e=0;e<a;++e)if(u[e]!==f[e]){o=u[e],s=f[e];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return T(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return T(this,e,t,r,!1)},c.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return M(this,e,t,r);case"ascii":case"latin1":case"binary":return y(this,e,t,r);case"base64":return R(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function A(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function D(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function L(e,t,r){const i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=t;i<r;++i)n+=Z[e[i]];return n}function C(e,t,r){const i=e.slice(t,r);let n="";for(let e=0;e<i.length-1;e+=2)n+=String.fromCharCode(i[e]+256*i[e+1]);return n}function P(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,i,n,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function B(e,t,r,i,n){x(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function w(e,t,r,i,n){x(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function U(e,t,r,i,n,o){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function H(e,t,r,i,o){return t=+t,r>>>=0,o||U(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function j(e,t,r,i,o){return t=+t,r>>>=0,o||U(e,0,r,8),n.write(e,t,r,i,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,c.prototype),i},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let i=this[e],n=1,o=0;for(;++o<t&&(n*=256);)i+=this[e+o]*n;return i},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let i=this[e+--t],n=1;for(;t>0&&(n*=256);)i+=this[e+--t]*n;return i},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||k(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(i)+(BigInt(n)<<BigInt(32))})),c.prototype.readBigUInt64BE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||k(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(i)<<BigInt(32))+BigInt(n)})),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let i=this[e],n=1,o=0;for(;++o<t&&(n*=256);)i+=this[e+o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let i=t,n=1,o=this[e+--i];for(;i>0&&(n*=256);)o+=this[e+--i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||k(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||k(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||N(this,e,t,r,Math.pow(2,8*r)-1,0);let n=1,o=0;for(this[t]=255&e;++o<r&&(n*=256);)this[t+o]=e/n&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||N(this,e,t,r,Math.pow(2,8*r)-1,0);let n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return w(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);N(this,e,t,r,i-1,-i)}let n=0,o=1,s=0;for(this[t]=255&e;++n<r&&(o*=256);)e<0&&0===s&&0!==this[t+n-1]&&(s=1),this[t+n]=(e/o|0)-s&255;return t+r},c.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);N(this,e,t,r,i-1,-i)}let n=r-1,o=1,s=0;for(this[t+n]=255&e;--n>=0&&(o*=256);)e<0&&0===s&&0!==this[t+n+1]&&(s=1),this[t+n]=(e/o|0)-s&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return w(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return H(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return H(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,i){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);const n=i-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,i):Uint8Array.prototype.set.call(e,this.subarray(r,i),t),n},c.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{const o=c.isBuffer(e)?e:c.from(e,i),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=o[n%s]}return this};const F={};function W(e,t,r){F[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function G(e){let t="",r=e.length;const i="-"===e[0]?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function x(e,t,r,i,n,o){if(e>r||e<t){const i="bigint"==typeof t?"n":"";let n;throw n=o>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new F.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){V(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||k(t,e.length-(r+1))}(i,n,o)}function V(e,t){if("number"!=typeof e)throw new F.ERR_INVALID_ARG_TYPE(t,"number",e)}function k(e,t,r){if(Math.floor(e)!==e)throw V(e,r),new F.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}W("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),W("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),W("ERR_OUT_OF_RANGE",(function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=G(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=G(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i}),RangeError);const Y=/[^+/0-9A-Za-z-_]/g;function $(e,t){let r;t=t||1/0;const i=e.length;let n=null;const o=[];for(let s=0;s<i;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function K(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(Y,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function q(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const i=16*r;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t}();function Q(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}},8385:(e,t,r)=>{"use strict";r.r(t),r.d(t,{compare:()=>f,compareVersions:()=>u,satisfies:()=>d,validate:()=>p,validateStrict:()=>E});const i=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,n=e=>{if("string"!=typeof e)throw new TypeError("Invalid argument expected string");const t=e.match(i);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},o=e=>"*"===e||"x"===e||"X"===e,s=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},a=(e,t)=>{if(o(e)||o(t))return 0;const[r,i]=((e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t])(s(e),s(t));return r>i?1:r<i?-1:0},c=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){const i=a(e[r]||"0",t[r]||"0");if(0!==i)return i}return 0},u=(e,t)=>{const r=n(e),i=n(t),o=r.pop(),s=i.pop(),a=c(r,i);return 0!==a?a:o&&s?c(o.split("."),s.split(".")):o||s?o?-1:1:0},f=(e,t,r)=>{h(r);const i=u(e,t);return l[r].includes(i)},l={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},_=Object.keys(l),h=e=>{if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===_.indexOf(e))throw new Error(`Invalid operator, expected one of ${_.join("|")}`)},d=(e,t)=>{if((t=t.replace(/([><=]+)\s+/g,"$1")).includes("||"))return t.split("||").some((t=>d(e,t)));if(t.includes(" - ")){const[r,i]=t.split(" - ",2);return d(e,`>=${r} <=${i}`)}if(t.includes(" "))return t.trim().replace(/\s{2,}/g," ").split(" ").every((t=>d(e,t)));const r=t.match(/^([<>=~^]+)/),i=r?r[1]:"=";if("^"!==i&&"~"!==i)return f(e,t,i);const[o,s,a,,u]=n(e),[l,_,h,,p]=n(t),E=[o,s,a],O=[l,null!=_?_:"x",null!=h?h:"x"];if(p){if(!u)return!1;if(0!==c(E,O))return!1;if(-1===c(u.split("."),p.split(".")))return!1}const T=O.findIndex((e=>"0"!==e))+1,b="~"===i?2:T>1?T:1;return 0===c(E.slice(0,b),O.slice(0,b))&&-1!==c(E.slice(b),O.slice(b))},p=e=>"string"==typeof e&&/^[v\d]/.test(e)&&i.test(e),E=e=>"string"==typeof e&&/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(e)},7833:(e,t,r)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let i=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(n=i))})),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(736)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},736:(e,t,r)=>{e.exports=function(e){function t(e){let r,n,o,s=null;function a(...e){if(!a.enabled)return;const i=a,n=Number(new Date),o=n-(r||n);i.diff=o,i.prev=r,i.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,n)=>{if("%%"===r)return"%";s++;const o=t.formatters[n];if("function"==typeof o){const t=e[s];r=o.call(i,t),e.splice(s,1),s--}return r})),t.formatArgs.call(i,e),(i.log||t.log).apply(i,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=i,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(n!==t.namespaces&&(n=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function i(e,r){const i=t(this.namespace+(void 0===r?":":r)+e);return i.log=this.log,i}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").split(/[\s,]+/),n=i.length;for(r=0;r<n;r++)i[r]&&("-"===(e=i[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,i;for(r=0,i=t.skips.length;r<i;r++)if(t.skips[r].test(e))return!1;for(r=0,i=t.names.length;r<i;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(6585),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},7007:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,o),i(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}p(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&p(e,"error",t,{once:!0})}(e,n)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,i){var n,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=c(e))>0&&s.length>n&&!s.warned){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=s.length,u=f,console&&console.warn&&console.warn(u)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=f.bind(i);return n.listener=r,i.wrapFn=n,n}function _(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):d(n,n.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function d(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function p(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(o){i.once&&e.removeEventListener(t,n),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,f=d(c,u);for(r=0;r<u;++r)i(f[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,l(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,l(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,i,n,o,s;if(a(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,o=Object.keys(r);for(i=0;i<o.length;++i)"removeListener"!==(n=o[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return _(this,e,!0)},o.prototype.rawListeners=function(e){return _(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},o.prototype.listenerCount=h,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},251:(e,t)=>{t.read=function(e,t,r,i,n){var o,s,a=8*n-i-1,c=(1<<a)-1,u=c>>1,f=-7,l=r?n-1:0,_=r?-1:1,h=e[t+l];for(l+=_,o=h&(1<<-f)-1,h>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=_,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=i;f>0;s=256*s+e[t+l],l+=_,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,i),o-=u}return(h?-1:1)*s*Math.pow(2,o-i)},t.write=function(e,t,r,i,n,o){var s,a,c,u=8*o-n-1,f=(1<<u)-1,l=f>>1,_=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:o-1,d=i?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+l>=1?_/c:_*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*c-1)*Math.pow(2,n),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,n),s=0));n>=8;e[r+h]=255&a,h+=d,a/=256,n-=8);for(s=s<<n|a,u+=n;u>0;e[r+h]=255&s,h+=d,s/=256,u-=8);e[r+h-d]|=128*p}},6585:e=>{var t=1e3,r=60*t,i=60*r,n=24*i,o=7*n;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,a){a=a||{};var c,u,f=typeof e;if("string"===f&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(s){var a=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*o;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===f&&isFinite(e))return a.long?(c=e,(u=Math.abs(c))>=n?s(c,u,n,"day"):u>=i?s(c,u,i,"hour"):u>=r?s(c,u,r,"minute"):u>=t?s(c,u,t,"second"):c+" ms"):function(e){var o=Math.abs(e);return o>=n?Math.round(e/n)+"d":o>=i?Math.round(e/i)+"h":o>=r?Math.round(e/r)+"m":o>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},8359:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Color=void 0;const s=o(r(8066));t.Color=class{constructor(e,t){this._brightness=100,this._color=e,this._brightness=t||100}toValue(){return this._color===s.Color.NONE?this._color:this._color+(Math.round(this._brightness/10)<<4)}}},8066:(e,t)=>{"use strict";var r,i,n,o,s,a,c,u,f,l,_,h,d,p,E,O,T,b,v,M,y,R,m,S,g,I,A;Object.defineProperty(t,"__esModule",{value:!0}),t.MarioColor=t.MarioPantsType=t.PortInputFormatSetupSubCommand=t.ModeInformationType=t.HWNetworkSubFamily=t.HWNetworkFamily=t.HWNetWorkCommandType=t.ErrorCode=t.IOTypeID=t.Event=t.AlertPayload=t.AlertOperation=t.AlertType=t.ActionType=t.HubPropertyPayload=t.HubPropertyOperation=t.HubPropertyReference=t.MessageType=t.BLECharacteristic=t.BLEService=t.BLEManufacturerData=t.DuploTrainBaseSound=t.BrakingStyle=t.ButtonState=t.ColorNames=t.Color=t.DeviceTypeNames=t.DeviceType=t.HubTypeNames=t.HubType=void 0,function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.WEDO2_SMART_HUB=1]="WEDO2_SMART_HUB",e[e.MOVE_HUB=2]="MOVE_HUB",e[e.HUB=3]="HUB",e[e.REMOTE_CONTROL=4]="REMOTE_CONTROL",e[e.DUPLO_TRAIN_BASE=5]="DUPLO_TRAIN_BASE",e[e.TECHNIC_MEDIUM_HUB=6]="TECHNIC_MEDIUM_HUB",e[e.MARIO=7]="MARIO",e[e.TECHNIC_SMALL_HUB=8]="TECHNIC_SMALL_HUB"}(r||(t.HubType=r={})),t.HubTypeNames=r,function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.SIMPLE_MEDIUM_LINEAR_MOTOR=1]="SIMPLE_MEDIUM_LINEAR_MOTOR",e[e.TRAIN_MOTOR=2]="TRAIN_MOTOR",e[e.LIGHT=8]="LIGHT",e[e.VOLTAGE_SENSOR=20]="VOLTAGE_SENSOR",e[e.CURRENT_SENSOR=21]="CURRENT_SENSOR",e[e.PIEZO_BUZZER=22]="PIEZO_BUZZER",e[e.HUB_LED=23]="HUB_LED",e[e.TILT_SENSOR=34]="TILT_SENSOR",e[e.MOTION_SENSOR=35]="MOTION_SENSOR",e[e.COLOR_DISTANCE_SENSOR=37]="COLOR_DISTANCE_SENSOR",e[e.MEDIUM_LINEAR_MOTOR=38]="MEDIUM_LINEAR_MOTOR",e[e.MOVE_HUB_MEDIUM_LINEAR_MOTOR=39]="MOVE_HUB_MEDIUM_LINEAR_MOTOR",e[e.MOVE_HUB_TILT_SENSOR=40]="MOVE_HUB_TILT_SENSOR",e[e.DUPLO_TRAIN_BASE_MOTOR=41]="DUPLO_TRAIN_BASE_MOTOR",e[e.DUPLO_TRAIN_BASE_SPEAKER=42]="DUPLO_TRAIN_BASE_SPEAKER",e[e.DUPLO_TRAIN_BASE_COLOR_SENSOR=43]="DUPLO_TRAIN_BASE_COLOR_SENSOR",e[e.DUPLO_TRAIN_BASE_SPEEDOMETER=44]="DUPLO_TRAIN_BASE_SPEEDOMETER",e[e.TECHNIC_LARGE_LINEAR_MOTOR=46]="TECHNIC_LARGE_LINEAR_MOTOR",e[e.TECHNIC_XLARGE_LINEAR_MOTOR=47]="TECHNIC_XLARGE_LINEAR_MOTOR",e[e.TECHNIC_MEDIUM_ANGULAR_MOTOR=48]="TECHNIC_MEDIUM_ANGULAR_MOTOR",e[e.TECHNIC_LARGE_ANGULAR_MOTOR=49]="TECHNIC_LARGE_ANGULAR_MOTOR",e[e.TECHNIC_MEDIUM_HUB_GEST_SENSOR=54]="TECHNIC_MEDIUM_HUB_GEST_SENSOR",e[e.REMOTE_CONTROL_BUTTON=55]="REMOTE_CONTROL_BUTTON",e[e.REMOTE_CONTROL_RSSI=56]="REMOTE_CONTROL_RSSI",e[e.TECHNIC_MEDIUM_HUB_ACCELEROMETER=57]="TECHNIC_MEDIUM_HUB_ACCELEROMETER",e[e.TECHNIC_MEDIUM_HUB_GYRO_SENSOR=58]="TECHNIC_MEDIUM_HUB_GYRO_SENSOR",e[e.TECHNIC_MEDIUM_HUB_TILT_SENSOR=59]="TECHNIC_MEDIUM_HUB_TILT_SENSOR",e[e.TECHNIC_MEDIUM_HUB_TEMPERATURE_SENSOR=60]="TECHNIC_MEDIUM_HUB_TEMPERATURE_SENSOR",e[e.TECHNIC_COLOR_SENSOR=61]="TECHNIC_COLOR_SENSOR",e[e.TECHNIC_DISTANCE_SENSOR=62]="TECHNIC_DISTANCE_SENSOR",e[e.TECHNIC_FORCE_SENSOR=63]="TECHNIC_FORCE_SENSOR",e[e.TECHNIC_3X3_COLOR_LIGHT_MATRIX=64]="TECHNIC_3X3_COLOR_LIGHT_MATRIX",e[e.TECHNIC_SMALL_ANGULAR_MOTOR=65]="TECHNIC_SMALL_ANGULAR_MOTOR",e[e.MARIO_ACCELEROMETER=71]="MARIO_ACCELEROMETER",e[e.MARIO_BARCODE_SENSOR=73]="MARIO_BARCODE_SENSOR",e[e.MARIO_PANTS_SENSOR=74]="MARIO_PANTS_SENSOR",e[e.TECHNIC_MEDIUM_ANGULAR_MOTOR_GREY=75]="TECHNIC_MEDIUM_ANGULAR_MOTOR_GREY",e[e.TECHNIC_LARGE_ANGULAR_MOTOR_GREY=76]="TECHNIC_LARGE_ANGULAR_MOTOR_GREY"}(i||(t.DeviceType=i={})),t.DeviceTypeNames=i,function(e){e[e.BLACK=0]="BLACK",e[e.PINK=1]="PINK",e[e.PURPLE=2]="PURPLE",e[e.BLUE=3]="BLUE",e[e.LIGHT_BLUE=4]="LIGHT_BLUE",e[e.CYAN=5]="CYAN",e[e.GREEN=6]="GREEN",e[e.YELLOW=7]="YELLOW",e[e.ORANGE=8]="ORANGE",e[e.RED=9]="RED",e[e.WHITE=10]="WHITE",e[e.NONE=255]="NONE"}(n||(t.Color=n={})),t.ColorNames=n,function(e){e[e.PRESSED=2]="PRESSED",e[e.RELEASED=0]="RELEASED",e[e.UP=1]="UP",e[e.DOWN=255]="DOWN",e[e.STOP=127]="STOP"}(o||(t.ButtonState=o={})),function(e){e[e.FLOAT=0]="FLOAT",e[e.HOLD=126]="HOLD",e[e.BRAKE=127]="BRAKE"}(s||(t.BrakingStyle=s={})),function(e){e[e.BRAKE=3]="BRAKE",e[e.STATION_DEPARTURE=5]="STATION_DEPARTURE",e[e.WATER_REFILL=7]="WATER_REFILL",e[e.HORN=9]="HORN",e[e.STEAM=10]="STEAM"}(a||(t.DuploTrainBaseSound=a={})),function(e){e[e.DUPLO_TRAIN_BASE_ID=32]="DUPLO_TRAIN_BASE_ID",e[e.MOVE_HUB_ID=64]="MOVE_HUB_ID",e[e.HUB_ID=65]="HUB_ID",e[e.REMOTE_CONTROL_ID=66]="REMOTE_CONTROL_ID",e[e.MARIO_ID=67]="MARIO_ID",e[e.TECHNIC_MEDIUM_HUB_ID=128]="TECHNIC_MEDIUM_HUB_ID",e[e.TECHNIC_SMALL_HUB_ID=131]="TECHNIC_SMALL_HUB_ID"}(c||(t.BLEManufacturerData=c={})),function(e){e.WEDO2_SMART_HUB="00001523-1212-efde-1523-785feabcd123",e.WEDO2_SMART_HUB_2="00004f0e-1212-efde-1523-785feabcd123",e.WEDO2_SMART_HUB_3="2a19",e.WEDO2_SMART_HUB_4="180f",e.WEDO2_SMART_HUB_5="180a",e.LPF2_HUB="00001623-1212-efde-1623-785feabcd123"}(u||(t.BLEService=u={})),function(e){e.WEDO2_BATTERY="2a19",e.WEDO2_FIRMWARE_REVISION="2a26",e.WEDO2_BUTTON="00001526-1212-efde-1523-785feabcd123",e.WEDO2_PORT_TYPE="00001527-1212-efde-1523-785feabcd123",e.WEDO2_LOW_VOLTAGE_ALERT="00001528-1212-efde-1523-785feabcd123",e.WEDO2_HIGH_CURRENT_ALERT="00001529-1212-efde-1523-785feabcd123",e.WEDO2_LOW_SIGNAL_ALERT="0000152a-1212-efde-1523-785feabcd123",e.WEDO2_DISCONNECT="0000152b-1212-efde-1523-785feabcd123",e.WEDO2_SENSOR_VALUE="00001560-1212-efde-1523-785feabcd123",e.WEDO2_VALUE_FORMAT="00001561-1212-efde-1523-785feabcd123",e.WEDO2_PORT_TYPE_WRITE="00001563-1212-efde-1523-785feabcd123",e.WEDO2_MOTOR_VALUE_WRITE="00001565-1212-efde-1523-785feabcd123",e.WEDO2_NAME_ID="00001524-1212-efde-1523-785feabcd123",e.LPF2_ALL="00001624-1212-efde-1623-785feabcd123"}(f||(t.BLECharacteristic=f={})),function(e){e[e.HUB_PROPERTIES=1]="HUB_PROPERTIES",e[e.HUB_ACTIONS=2]="HUB_ACTIONS",e[e.HUB_ALERTS=3]="HUB_ALERTS",e[e.HUB_ATTACHED_IO=4]="HUB_ATTACHED_IO",e[e.GENERIC_ERROR_MESSAGES=5]="GENERIC_ERROR_MESSAGES",e[e.HW_NETWORK_COMMANDS=8]="HW_NETWORK_COMMANDS",e[e.FW_UPDATE_GO_INTO_BOOT_MODE=16]="FW_UPDATE_GO_INTO_BOOT_MODE",e[e.FW_UPDATE_LOCK_MEMORY=17]="FW_UPDATE_LOCK_MEMORY",e[e.FW_UPDATE_LOCK_STATUS_REQUEST=18]="FW_UPDATE_LOCK_STATUS_REQUEST",e[e.FW_LOCK_STATUS=19]="FW_LOCK_STATUS",e[e.PORT_INFORMATION_REQUEST=33]="PORT_INFORMATION_REQUEST",e[e.PORT_MODE_INFORMATION_REQUEST=34]="PORT_MODE_INFORMATION_REQUEST",e[e.PORT_INPUT_FORMAT_SETUP_SINGLE=65]="PORT_INPUT_FORMAT_SETUP_SINGLE",e[e.PORT_INPUT_FORMAT_SETUP_COMBINEDMODE=66]="PORT_INPUT_FORMAT_SETUP_COMBINEDMODE",e[e.PORT_INFORMATION=67]="PORT_INFORMATION",e[e.PORT_MODE_INFORMATION=68]="PORT_MODE_INFORMATION",e[e.PORT_VALUE_SINGLE=69]="PORT_VALUE_SINGLE",e[e.PORT_VALUE_COMBINEDMODE=70]="PORT_VALUE_COMBINEDMODE",e[e.PORT_INPUT_FORMAT_SINGLE=71]="PORT_INPUT_FORMAT_SINGLE",e[e.PORT_INPUT_FORMAT_COMBINEDMODE=72]="PORT_INPUT_FORMAT_COMBINEDMODE",e[e.VIRTUAL_PORT_SETUP=97]="VIRTUAL_PORT_SETUP",e[e.PORT_OUTPUT_COMMAND=129]="PORT_OUTPUT_COMMAND",e[e.PORT_OUTPUT_COMMAND_FEEDBACK=130]="PORT_OUTPUT_COMMAND_FEEDBACK"}(l||(t.MessageType=l={})),function(e){e[e.ADVERTISING_NAME=1]="ADVERTISING_NAME",e[e.BUTTON=2]="BUTTON",e[e.FW_VERSION=3]="FW_VERSION",e[e.HW_VERSION=4]="HW_VERSION",e[e.RSSI=5]="RSSI",e[e.BATTERY_VOLTAGE=6]="BATTERY_VOLTAGE",e[e.BATTERY_TYPE=7]="BATTERY_TYPE",e[e.MANUFACTURER_NAME=8]="MANUFACTURER_NAME",e[e.RADIO_FIRMWARE_VERSION=9]="RADIO_FIRMWARE_VERSION",e[e.LEGO_WIRELESS_PROTOCOL_VERSION=10]="LEGO_WIRELESS_PROTOCOL_VERSION",e[e.SYSTEM_TYPE_ID=11]="SYSTEM_TYPE_ID",e[e.HW_NETWORK_ID=12]="HW_NETWORK_ID",e[e.PRIMARY_MAC_ADDRESS=13]="PRIMARY_MAC_ADDRESS",e[e.SECONDARY_MAC_ADDRESS=14]="SECONDARY_MAC_ADDRESS",e[e.HARDWARE_NETWORK_FAMILY=15]="HARDWARE_NETWORK_FAMILY"}(_||(t.HubPropertyReference=_={})),function(e){e[e.SET_DOWNSTREAM=1]="SET_DOWNSTREAM",e[e.ENABLE_UPDATES_DOWNSTREAM=2]="ENABLE_UPDATES_DOWNSTREAM",e[e.DISABLE_UPDATES_DOWNSTREAM=3]="DISABLE_UPDATES_DOWNSTREAM",e[e.RESET_DOWNSTREAM=4]="RESET_DOWNSTREAM",e[e.REQUEST_UPDATE_DOWNSTREAM=5]="REQUEST_UPDATE_DOWNSTREAM",e[e.UPDATE_UPSTREAM=6]="UPDATE_UPSTREAM"}(h||(t.HubPropertyOperation=h={})),function(e){e[e.ADVERTISING_NAME=1]="ADVERTISING_NAME",e[e.BUTTON_STATE=2]="BUTTON_STATE",e[e.FW_VERSION=3]="FW_VERSION",e[e.HW_VERSION=4]="HW_VERSION",e[e.RSSI=5]="RSSI",e[e.BATTERY_VOLTAGE=6]="BATTERY_VOLTAGE",e[e.BATTERY_TYPE=7]="BATTERY_TYPE",e[e.MANUFACTURER_NAME=8]="MANUFACTURER_NAME",e[e.RADIO_FIRMWARE_VERSION=9]="RADIO_FIRMWARE_VERSION",e[e.LWP_PROTOCOL_VERSION=10]="LWP_PROTOCOL_VERSION",e[e.SYSTEM_TYPE_ID=11]="SYSTEM_TYPE_ID",e[e.HW_NETWORK_ID=12]="HW_NETWORK_ID",e[e.PRIMARY_MAC_ADDRESS=13]="PRIMARY_MAC_ADDRESS",e[e.SECONDARY_MAC_ADDRESS=14]="SECONDARY_MAC_ADDRESS",e[e.HW_NETWORK_FAMILY=15]="HW_NETWORK_FAMILY"}(d||(t.HubPropertyPayload=d={})),function(e){e[e.SWITCH_OFF_HUB=1]="SWITCH_OFF_HUB",e[e.DISCONNECT=2]="DISCONNECT",e[e.VCC_PORT_CONTROL_ON=3]="VCC_PORT_CONTROL_ON",e[e.VCC_PORT_CONTROL_OFF=4]="VCC_PORT_CONTROL_OFF",e[e.ACTIVATE_BUSY_INDICATION=5]="ACTIVATE_BUSY_INDICATION",e[e.RESET_BUSY_INDICATION=6]="RESET_BUSY_INDICATION",e[e.SHUTDOWN=47]="SHUTDOWN",e[e.HUB_WILL_SWITCH_OFF=48]="HUB_WILL_SWITCH_OFF",e[e.HUB_WILL_DISCONNECT=49]="HUB_WILL_DISCONNECT",e[e.HUB_WILL_GO_INTO_BOOT_MODE=50]="HUB_WILL_GO_INTO_BOOT_MODE"}(p||(t.ActionType=p={})),function(e){e[e.LOW_VOLTAGE=1]="LOW_VOLTAGE",e[e.HIGH_CURRENT=2]="HIGH_CURRENT",e[e.LOW_SIGNAL_STRENGTH=3]="LOW_SIGNAL_STRENGTH",e[e.OVER_POWER_CONDITION=4]="OVER_POWER_CONDITION"}(E||(t.AlertType=E={})),function(e){e[e.LOW_VOLTAGE=1]="LOW_VOLTAGE",e[e.HIGH_CURRENT=2]="HIGH_CURRENT",e[e.LOW_SIGNAL_STRENGTH=3]="LOW_SIGNAL_STRENGTH",e[e.OVER_POWER_CONDITION=4]="OVER_POWER_CONDITION"}(O||(t.AlertOperation=O={})),function(e){e[e.STATUS_OK=0]="STATUS_OK",e[e.ALERT=255]="ALERT"}(T||(t.AlertPayload=T={})),function(e){e[e.DETACHED_IO=0]="DETACHED_IO",e[e.ATTACHED_IO=1]="ATTACHED_IO",e[e.ATTACHED_VIRTUAL_IO=2]="ATTACHED_VIRTUAL_IO"}(b||(t.Event=b={})),function(e){e[e.MOTOR=1]="MOTOR",e[e.SYSTEM_TRAIN_MOTOR=2]="SYSTEM_TRAIN_MOTOR",e[e.BUTTON=5]="BUTTON",e[e.LED_LIGHT=8]="LED_LIGHT",e[e.VOLTAGE=20]="VOLTAGE",e[e.CURRENT=21]="CURRENT",e[e.PIEZO_TONE_SOUND=22]="PIEZO_TONE_SOUND",e[e.RGB_LIGHT=23]="RGB_LIGHT",e[e.EXTERNAL_TILT_SENSOR=34]="EXTERNAL_TILT_SENSOR",e[e.MOTION_SENSOR=35]="MOTION_SENSOR",e[e.VISION_SENSOR=37]="VISION_SENSOR",e[e.EXTERNAL_MOTOR=38]="EXTERNAL_MOTOR",e[e.INTERNAL_MOTOR=39]="INTERNAL_MOTOR",e[e.INTERNAL_TILT=40]="INTERNAL_TILT"}(v||(t.IOTypeID=v={})),function(e){e[e.ACK=1]="ACK",e[e.MACK=2]="MACK",e[e.BUFFER_OVERFLOW=3]="BUFFER_OVERFLOW",e[e.TIMEOUT=4]="TIMEOUT",e[e.COMMAND_NOT_RECOGNIZED=5]="COMMAND_NOT_RECOGNIZED",e[e.INVALID_USE=6]="INVALID_USE",e[e.OVERCURRENT=7]="OVERCURRENT",e[e.INTERNAL_ERROR=8]="INTERNAL_ERROR"}(M||(t.ErrorCode=M={})),function(e){e[e.CONNECTION_REQUEST=2]="CONNECTION_REQUEST",e[e.FAMILY_REQUEST=3]="FAMILY_REQUEST",e[e.FAMILY_SET=4]="FAMILY_SET",e[e.JOIN_DENIED=5]="JOIN_DENIED",e[e.GET_FAMILY=6]="GET_FAMILY",e[e.FAMILY=7]="FAMILY",e[e.GET_SUBFAMILY=8]="GET_SUBFAMILY",e[e.SUBFAMILY=9]="SUBFAMILY",e[e.SUBFAMILY_SET=10]="SUBFAMILY_SET",e[e.GET_EXTENDED_FAMILY=11]="GET_EXTENDED_FAMILY",e[e.EXTENDED_FAMILY=12]="EXTENDED_FAMILY",e[e.EXTENDED_FAMILY_SET=13]="EXTENDED_FAMILY_SET",e[e.RESET_LONG_PRESS_TIMING=14]="RESET_LONG_PRESS_TIMING"}(y||(t.HWNetWorkCommandType=y={})),function(e){e[e.GREEN=1]="GREEN",e[e.YELLOW=2]="YELLOW",e[e.RED=3]="RED",e[e.BLUE=4]="BLUE",e[e.PURPLE=5]="PURPLE",e[e.LIGHT_BLUE=6]="LIGHT_BLUE",e[e.TEAL=7]="TEAL",e[e.PINK=8]="PINK",e[e.WHITE=0]="WHITE"}(R||(t.HWNetworkFamily=R={})),function(e){e[e.ONE_FLASH=1]="ONE_FLASH",e[e.TWO_FLASHES=2]="TWO_FLASHES",e[e.THREE_FLASHES=3]="THREE_FLASHES",e[e.FOUR_FLASHES=4]="FOUR_FLASHES",e[e.FIVE_FLASHES=5]="FIVE_FLASHES",e[e.SIX_FLASHES=6]="SIX_FLASHES",e[e.SEVEN_FLASHES=7]="SEVEN_FLASHES"}(m||(t.HWNetworkSubFamily=m={})),function(e){e[e.NAME=0]="NAME",e[e.RAW=1]="RAW",e[e.PCT=2]="PCT",e[e.SI=3]="SI",e[e.SYMBOL=4]="SYMBOL",e[e.MAPPING=5]="MAPPING",e[e.USED_INTERNALLY=6]="USED_INTERNALLY",e[e.MOTOR_BIAS=7]="MOTOR_BIAS",e[e.CAPABILITY_BITS=8]="CAPABILITY_BITS",e[e.VALUE_FORMAT=128]="VALUE_FORMAT"}(S||(t.ModeInformationType=S={})),function(e){e[e.SET_MODEANDDATASET_COMBINATIONS=1]="SET_MODEANDDATASET_COMBINATIONS",e[e.LOCK_LPF2_DEVICE_FOR_SETUP=2]="LOCK_LPF2_DEVICE_FOR_SETUP",e[e.UNLOCKANDSTARTWITHMULTIUPDATEENABLED=3]="UNLOCKANDSTARTWITHMULTIUPDATEENABLED",e[e.UNLOCKANDSTARTWITHMULTIUPDATEDISABLED=4]="UNLOCKANDSTARTWITHMULTIUPDATEDISABLED",e[e.NOT_USED=5]="NOT_USED",e[e.RESET_SENSOR=6]="RESET_SENSOR"}(g||(t.PortInputFormatSetupSubCommand=g={})),function(e){e[e.NONE=0]="NONE",e[e.PROPELLER=6]="PROPELLER",e[e.CAT=17]="CAT",e[e.FIRE=18]="FIRE",e[e.NORMAL=33]="NORMAL",e[e.BUILDER=34]="BUILDER"}(I||(t.MarioPantsType=I={})),function(e){e[e.WHITE=4864]="WHITE",e[e.RED=5376]="RED",e[e.BLUE=5888]="BLUE",e[e.YELLOW=6144]="YELLOW",e[e.BLACK=6656]="BLACK",e[e.GREEN=9472]="GREEN",e[e.BROWN=27136]="BROWN",e[e.CYAN=16897]="CYAN"}(A||(t.MarioColor=A={}))},42:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.AbsoluteMotor=void 0;const a=r(7508),c=s(r(8066)),u=r(6185);class f extends a.TachoMotor{constructor(e,r,i={},n=c.DeviceType.UNKNOWN){super(e,r,Object.assign({},i,t.ModeMap),n)}receive(e){if(this._mode===l.ABSOLUTE){const t=(0,u.normalizeAngle)(e.readInt16LE(this.isWeDo2SmartHub?2:4));this.notify("absolute",{angle:t})}else super.receive(e)}gotoAngle(e,t=100){if(!this.isVirtualPort&&e instanceof Array)throw new Error("Only virtual ports can accept multiple positions");if(this.isWeDo2SmartHub)throw new Error("Absolute positioning is not available on the WeDo 2.0 Smart Hub");return this.cancelEventTimer(),new Promise((r=>{let n;null==t&&(t=100),e instanceof Array?(n=i.from([129,this.portId,17,14,0,0,0,0,0,0,0,0,(0,u.mapSpeed)(t),this._maxPower,this._brakeStyle,this.useProfile()]),n.writeInt32LE((0,u.normalizeAngle)(e[0]),4),n.writeInt32LE((0,u.normalizeAngle)(e[1]),8)):(n=i.from([129,this.portId,17,13,0,0,0,0,(0,u.mapSpeed)(t),this._maxPower,this._brakeStyle,this.useProfile()]),n.writeInt32LE((0,u.normalizeAngle)(e),4)),this.send(n),this._finishedCallbacks.push((()=>r()))}))}gotoRealZero(e=100){return new Promise((t=>{const r=this.mode;let i=!1;this.on("absolute",(async({angle:n})=>{if(!i)return i=!0,n<0?n=Math.abs(n):e=-e,await this.rotateByDegrees(n,e),r&&this.subscribe(r),t()})),this.requestUpdate()}))}resetZero(){return new Promise((e=>{const t=i.from([129,this.portId,17,81,2,0,0,0,0]);return this.send(t),e()}))}}var l;t.AbsoluteMotor=f,function(e){e[e.ROTATION=2]="ROTATION",e[e.ABSOLUTE=3]="ABSOLUTE"}(l||(t.Mode=l={})),t.ModeMap={rotate:l.ROTATION,absolute:l.ABSOLUTE}},5373:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BasicMotor=void 0;const a=r(3124),c=s(r(8066)),u=r(6185);class f extends a.Device{constructor(e,t,r,i=c.DeviceType.UNKNOWN){super(e,t,r,i)}setPower(e,t=!0){return t&&this.cancelEventTimer(),this.writeDirect(0,i.from([(0,u.mapSpeed)(e)]))}rampPower(e,t,r){return this.cancelEventTimer(),new Promise((i=>{(0,u.calculateRamp)(this,e,t,r).on("changePower",(e=>{this.setPower(e,!1)})).on("finished",i)}))}stop(){return this.cancelEventTimer(),this.setPower(0)}brake(){return this.cancelEventTimer(),this.setPower(c.BrakingStyle.BRAKE)}}t.BasicMotor=f},5466:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Output=t.ModeMap=t.Mode=t.ColorDistanceSensor=void 0;const a=r(3124),c=s(r(8066)),u=r(6185);class f extends a.Device{constructor(e,r){super(e,r,t.ModeMap,c.DeviceType.COLOR_DISTANCE_SENSOR)}receive(e){switch(this._mode){case l.COLOR:if(e[this.isWeDo2SmartHub?2:4]<=10){const t=(0,u.parseColor)(e[this.isWeDo2SmartHub?2:4]);this.notify("color",{color:t})}break;case l.DISTANCE:if(this.isWeDo2SmartHub)break;if(e[4]<=10){let t=Math.floor(25.4*e[4])-20;t<0&&(t=0),this.notify("distance",{distance:t})}break;case l.DISTANCE_COUNT:if(this.isWeDo2SmartHub)break;if(8!==e.length)break;const t=e.readUInt32LE(4);this.notify("distanceCount",{count:t});break;case l.REFLECT:if(this.isWeDo2SmartHub)break;const r=e[4];this.notify("reflect",{reflect:r});break;case l.AMBIENT:if(this.isWeDo2SmartHub)break;const i=e[4];this.notify("ambient",{ambient:i});break;case l.RGB_I:if(this.isWeDo2SmartHub)break;if(10!==e.length)break;const n=e.readUInt16LE(4),o=e.readUInt16LE(6),s=e.readUInt16LE(8);this.notify("rgbIntensity",{red:n,green:o,blue:s});break;case l.COLOR_AND_DISTANCE:if(this.isWeDo2SmartHub)break;let a=e[5];const c=e[7];if(c>0&&(a+=1/c),a=Math.floor(25.4*a)-20,e[4]<=10){const t=e[4];this.notify("colorAndDistance",{color:t,distance:a})}}}setPFExtendedChannel(e){let t=0;e>=4&&(e-=4,t=1);const r=i.alloc(2);return r[0]=(e-1<<4)+(t<<3),r[1]=96,this.sendPFIRMessage(r)}setPFPower(e,t,r){let n=0;e>4&&(e-=4,n=1);const o=i.alloc(2);return o[0]=(e-1<<4)+(n<<3)+("RED"===t?4:5),o[1]=this._pfPowerToPWM(r)<<4,this.sendPFIRMessage(o)}startPFMotors(e,t,r){let n=0;e>4&&(e-=4,n=1);const o=i.alloc(2);return o[0]=(e-1+4+(n<<3)<<4)+this._pfPowerToPWM(t),o[1]=this._pfPowerToPWM(r)<<4,this.sendPFIRMessage(o)}sendPFIRMessage(e){if(this.isWeDo2SmartHub)throw new Error("Power Functions IR is not available on the WeDo 2.0 Smart Hub");{const t=i.alloc(2);return t[0]=(e[0]<<4)+(e[1]>>4),t[1]=e[0]>>4,this.subscribe(l.PF_IR),this.writeDirect(7,t)}}setColor(e){return new Promise((t=>{if(!1===e&&(e=0),this.isWeDo2SmartHub)throw new Error("Setting LED color is not available on the WeDo 2.0 Smart Hub");return this.subscribe(l.LED),this.writeDirect(5,i.from([e])),t()}))}setDistanceCount(e){return new Promise((t=>{if(this.isWeDo2SmartHub)throw new Error("Setting distance count is not available on the WeDo 2.0 Smart Hub");{const t=i.alloc(4);t.writeUInt32LE(e%2**32),this.writeDirect(2,t)}return t()}))}_pfPowerToPWM(e){return 15&e}}var l,_;t.ColorDistanceSensor=f,function(e){e[e.COLOR=0]="COLOR",e[e.DISTANCE=1]="DISTANCE",e[e.DISTANCE_COUNT=2]="DISTANCE_COUNT",e[e.REFLECT=3]="REFLECT",e[e.AMBIENT=4]="AMBIENT",e[e.LED=5]="LED",e[e.RGB_I=6]="RGB_I",e[e.PF_IR=7]="PF_IR",e[e.COLOR_AND_DISTANCE=8]="COLOR_AND_DISTANCE"}(l||(t.Mode=l={})),t.ModeMap={color:l.COLOR,distance:l.DISTANCE,distanceCount:l.DISTANCE_COUNT,reflect:l.REFLECT,ambient:l.AMBIENT,rgbIntensity:l.RGB_I,colorAndDistance:l.COLOR_AND_DISTANCE},function(e){e.RED="RED",e.BLUE="BLUE"}(_||(t.Output=_={}))},3839:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.CurrentSensor=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.CURRENT_SENSOR)}receive(e){if(this.mode===u.CURRENT)if(this.isWeDo2SmartHub){const t=e.readInt16LE(2)/1e3;this.notify("current",{current:t})}else{let t=f[this.hub.type];void 0===t&&(t=f[a.HubType.UNKNOWN]);let r=l[this.hub.type];void 0===r&&(r=l[a.HubType.UNKNOWN]);const i=e.readUInt16LE(4)*t/r;this.notify("current",{current:i})}}}var u;t.CurrentSensor=c,function(e){e[e.CURRENT=0]="CURRENT"}(u||(t.Mode=u={})),t.ModeMap={current:u.CURRENT};const f={[a.HubType.UNKNOWN]:2444,[a.HubType.TECHNIC_MEDIUM_HUB]:4175},l={[a.HubType.UNKNOWN]:4095}},3124:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;const a=r(7007),c=s(r(8066));class u extends a.EventEmitter{constructor(e,t,r={},i=c.DeviceType.UNKNOWN){super(),this.autoSubscribe=!0,this.values={},this._busy=!1,this._finishedCallbacks=[],this._connected=!0,this._modeMap={},this._isVirtualPort=!1,this._eventTimer=null,this._hub=e,this._portId=t,this._type=i,this._modeMap=r,this._isWeDo2SmartHub=this.hub.type===c.HubType.WEDO2_SMART_HUB,this._isVirtualPort=this.hub.isPortVirtual(t);const n=e=>{"detach"!==e&&this.autoSubscribe&&void 0!==this._modeMap[e]&&this.subscribe(this._modeMap[e])},o=e=>{e.portId===this.portId&&(this._connected=!1,this.hub.removeListener("detach",o),this.emit("detach"))};for(const e in this._modeMap)this.hub.listenerCount(e)>0&&n(e);this.hub.on("newListener",n),this.on("newListener",n),this.hub.on("detach",o)}get connected(){return this._connected}get hub(){return this._hub}get portId(){return this._portId}get portName(){return this.hub.getPortNameForPortId(this.portId)}get type(){return this._type}get typeName(){return c.DeviceTypeNames[this.type]}get mode(){return this._mode}get isWeDo2SmartHub(){return this._isWeDo2SmartHub}get isVirtualPort(){return this._isVirtualPort}writeDirect(e,t){return this.isWeDo2SmartHub?this.send(i.concat([i.from([this.portId,1,2]),t]),c.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE):this.send(i.concat([i.from([129,this.portId,17,81,e]),t]),c.BLECharacteristic.LPF2_ALL)}send(e,t=c.BLECharacteristic.LPF2_ALL){return this._ensureConnected(),this.hub.send(e,t)}subscribe(e){this._ensureConnected(),e!==this._mode&&(this._mode=e,this.hub.subscribe(this.portId,this.type,e))}unsubscribe(e){this._ensureConnected()}receive(e){this.notify("receive",{message:e})}notify(e,t){this.values[e]=t,this.emit(e,t),this.hub.listenerCount(e)>0&&this.hub.emit(e,this,t)}requestUpdate(){this.send(i.from([33,this.portId,0]))}finish(e){if(16&~e)for(this._busy=!(1&~e);this._finishedCallbacks.length>Number(this._busy);){const e=this._finishedCallbacks.shift();e&&e()}}setEventTimer(e){this._eventTimer=e}cancelEventTimer(){this._eventTimer&&(clearTimeout(this._eventTimer),this._eventTimer=null)}_ensureConnected(){if(!this.connected)throw new Error("Device is not connected")}}t.Device=u},692:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.DuploTrainBaseColorSensor=void 0;const s=r(3124),a=o(r(8066)),c=r(6185);class u extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.DUPLO_TRAIN_BASE_COLOR_SENSOR)}receive(e){switch(this._mode){case f.INTENSITY:const t=e[4];this.notify("intensity",{intensity:t});break;case f.COLOR:if(e[4]<=10){const t=(0,c.parseColor)(e[4]);this.notify("color",{color:t})}break;case f.REFLECTIVITY:const r=e[4];this.notify("reflect",{reflect:r});break;case f.RGB:const i=Math.floor(e.readUInt16LE(4)/4),n=Math.floor(e.readUInt16LE(6)/4),o=Math.floor(e.readUInt16LE(8)/4);this.notify("rgb",{red:i,green:n,blue:o})}}}var f;t.DuploTrainBaseColorSensor=u,function(e){e[e.INTENSITY=0]="INTENSITY",e[e.COLOR=1]="COLOR",e[e.REFLECTIVITY=2]="REFLECTIVITY",e[e.RGB=3]="RGB"}(f||(t.Mode=f={})),t.ModeMap={intensity:f.INTENSITY,color:f.COLOR,reflect:f.REFLECTIVITY,rgb:f.RGB}},1940:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DuploTrainBaseMotor=void 0;const s=r(5373),a=o(r(8066));class c extends s.BasicMotor{constructor(e,t){super(e,t,{},a.DeviceType.DUPLO_TRAIN_BASE_MOTOR)}}t.DuploTrainBaseMotor=c},5636:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Mode=t.DuploTrainBaseSpeaker=void 0;const a=r(3124),c=s(r(8066));class u extends a.Device{constructor(e,t){super(e,t,{},c.DeviceType.DUPLO_TRAIN_BASE_SPEAKER)}playSound(e){return new Promise((t=>(this.subscribe(f.SOUND),this.writeDirect(1,i.from([e])),t())))}playTone(e){this.subscribe(f.TONE),this.writeDirect(2,i.from([e]))}}var f;t.DuploTrainBaseSpeaker=u,function(e){e[e.SOUND=1]="SOUND",e[e.TONE=2]="TONE"}(f||(t.Mode=f={}))},1472:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.DuploTrainBaseSpeedometer=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.DUPLO_TRAIN_BASE_SPEEDOMETER)}receive(e){if(this._mode===u.SPEED){const t=e.readInt16LE(4);this.notify("speed",{speed:t})}}}var u;t.DuploTrainBaseSpeedometer=c,function(e){e[e.SPEED=0]="SPEED"}(u||(t.Mode=u={})),t.ModeMap={speed:u.SPEED}},1422:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Mode=t.HubLED=void 0;const a=r(3124),c=s(r(8066));class u extends a.Device{constructor(e,t){super(e,t,{},c.DeviceType.HUB_LED)}setColor(e){return new Promise((t=>("boolean"==typeof e&&(e=0),this.isWeDo2SmartHub?(this.send(i.from([6,23,1,1]),c.BLECharacteristic.WEDO2_PORT_TYPE_WRITE),this.send(i.from([6,4,1,e]),c.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE)):(this.subscribe(f.COLOR),this.writeDirect(0,i.from([e]))),t())))}setRGB(e,t,r){return new Promise((n=>(this.isWeDo2SmartHub?(this.send(i.from([6,23,1,2]),c.BLECharacteristic.WEDO2_PORT_TYPE_WRITE),this.send(i.from([6,4,3,e,t,r]),c.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE)):(this.subscribe(f.RGB),this.writeDirect(1,i.from([e,t,r]))),n())))}}var f;t.HubLED=u,function(e){e[e.COLOR=0]="COLOR",e[e.RGB=1]="RGB"}(f||(t.Mode=f={}))},9128:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Light=void 0;const a=r(3124),c=s(r(8066)),u=r(6185);class f extends a.Device{constructor(e,t){super(e,t,{},c.DeviceType.LIGHT)}setBrightness(e,t=!0){return t&&this.cancelEventTimer(),new Promise((t=>(this.writeDirect(0,i.from([e])),t())))}rampBrightness(e,t,r){return this.cancelEventTimer(),new Promise((i=>{(0,u.calculateRamp)(this,e,t,r).on("changePower",(e=>{this.setBrightness(e,!1)})).on("finished",i)}))}}t.Light=f},399:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.MarioAccelerometer=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.MARIO_ACCELEROMETER)}receive(e){switch(this._mode){case u.ACCEL:const t=e[4],r=e[5],i=e[6];this.notify("accel",{x:t,y:r,z:i});break;case u.GEST:const n=e[4];this.notify("gesture",{gesture:n})}}}var u;t.MarioAccelerometer=c,function(e){e[e.ACCEL=0]="ACCEL",e[e.GEST=1]="GEST"}(u||(t.Mode=u={})),t.ModeMap={accel:u.ACCEL,gesture:u.GEST}},6556:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.MarioBarcodeSensor=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.MARIO_BARCODE_SENSOR)}receive(e){switch(this._mode){case u.BARCODE:const t=e.readUInt16LE(4),r=e.readUInt16LE(6);65535===r?this.notify("barcode",{barcode:t}):65535===t&&this.notify("barcode",{color:r});break;case u.RGB:const i=e[4],n=e[5],o=e[6];this.notify("rgb",{r:i,g:n,b:o})}}}var u;t.MarioBarcodeSensor=c,function(e){e[e.BARCODE=0]="BARCODE",e[e.RGB=1]="RGB"}(u||(t.Mode=u={})),t.ModeMap={barcode:u.BARCODE,rgb:u.RGB}},9834:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.MarioPantsSensor=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.MARIO_PANTS_SENSOR)}receive(e){if(this._mode===u.PANTS){const t=e[4];this.notify("pants",{pants:t})}}}var u;t.MarioPantsSensor=c,function(e){e[e.PANTS=0]="PANTS"}(u||(t.Mode=u={})),t.ModeMap={pants:u.PANTS}},9823:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.MediumLinearMotor=void 0;const s=r(7508),a=o(r(8066));class c extends s.TachoMotor{constructor(e,t){super(e,t,{},a.DeviceType.MEDIUM_LINEAR_MOTOR)}}t.MediumLinearMotor=c},5530:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.MotionSensor=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.MOTION_SENSOR)}receive(e){if(this._mode===u.DISTANCE){let t=e[this.isWeDo2SmartHub?2:4];1===e[this.isWeDo2SmartHub?3:5]&&(t+=255),t*=10,this.notify("distance",{distance:t})}}}var u;t.MotionSensor=c,function(e){e[e.DISTANCE=0]="DISTANCE"}(u||(t.Mode=u={})),t.ModeMap={distance:u.DISTANCE}},8941:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.MoveHubMediumLinearMotor=void 0;const s=r(7508),a=o(r(8066));class c extends s.TachoMotor{constructor(e,t){super(e,t,{},a.DeviceType.MOVE_HUB_MEDIUM_LINEAR_MOTOR)}}t.MoveHubMediumLinearMotor=c},4081:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.MoveHubTiltSensor=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.MOVE_HUB_TILT_SENSOR)}receive(e){if(this._mode===u.TILT){const t=-e.readInt8(4),r=e.readInt8(5);this.notify("tilt",{x:t,y:r})}}}var u;t.MoveHubTiltSensor=c,function(e){e[e.TILT=0]="TILT"}(u||(t.Mode=u={})),t.ModeMap={tilt:u.TILT}},8055:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PiezoBuzzer=void 0;const a=r(3124),c=s(r(8066));class u extends a.Device{constructor(e,t){super(e,t,{},c.DeviceType.PIEZO_BUZZER)}playTone(e,t){return new Promise((n=>{const o=i.from([5,2,4,0,0,0,0]);o.writeUInt16LE(e,3),o.writeUInt16LE(t,5),this.send(o,c.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE),r.g.setTimeout(n,t)}))}}t.PiezoBuzzer=u},87:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ButtonState=t.ModeMap=t.Mode=t.RemoteControlButton=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.REMOTE_CONTROL_BUTTON)}receive(e){if(this._mode===u.BUTTON_EVENTS){const t=e[4];this.notify("remoteButton",{event:t})}}}var u;t.RemoteControlButton=c,function(e){e[e.BUTTON_EVENTS=0]="BUTTON_EVENTS"}(u||(t.Mode=u={})),t.ModeMap={remoteButton:u.BUTTON_EVENTS},t.ButtonState={UP:1,DOWN:255,STOP:127,RELEASED:0}},8693:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleMediumLinearMotor=void 0;const s=r(5373),a=o(r(8066));class c extends s.BasicMotor{constructor(e,t){super(e,t,{},a.DeviceType.SIMPLE_MEDIUM_LINEAR_MOTOR)}}t.SimpleMediumLinearMotor=c},7508:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.TachoMotor=void 0;const a=r(5373),c=s(r(8066)),u=r(6185);class f extends a.BasicMotor{constructor(e,r,i={},n=c.DeviceType.UNKNOWN){super(e,r,Object.assign({},i,t.ModeMap),n),this._brakeStyle=c.BrakingStyle.BRAKE,this._maxPower=100,this.useAccelerationProfile=!0,this.useDecelerationProfile=!0}receive(e){if(this._mode===l.ROTATION){const t=e.readInt32LE(this.isWeDo2SmartHub?2:4);this.notify("rotate",{degrees:t})}}setBrakingStyle(e){this._brakeStyle=e}setMaxPower(e){this._maxPower=e}setAccelerationTime(e,t=0){const r=i.from([129,this.portId,17,5,0,0,t]);r.writeUInt16LE(e,4),this.send(r)}setDecelerationTime(e,t=0){const r=i.from([129,this.portId,17,6,0,0,t]);r.writeUInt16LE(e,4),this.send(r)}setSpeed(e,t){if(!this.isVirtualPort&&e instanceof Array)throw new Error("Only virtual ports can accept multiple speeds");if(this.isWeDo2SmartHub)throw new Error("Motor speed is not available on the WeDo 2.0 Smart Hub");return this.cancelEventTimer(),new Promise((r=>{let n;null==e&&(e=100),void 0!==t?(n=e instanceof Array?i.from([129,this.portId,17,10,0,0,(0,u.mapSpeed)(e[0]),(0,u.mapSpeed)(e[1]),this._maxPower,this._brakeStyle,this.useProfile()]):i.from([129,this.portId,17,9,0,0,(0,u.mapSpeed)(e),this._maxPower,this._brakeStyle,this.useProfile()]),n.writeUInt16LE(t,4)):n=e instanceof Array?i.from([129,this.portId,17,8,(0,u.mapSpeed)(e[0]),(0,u.mapSpeed)(e[1]),this._maxPower,this.useProfile()]):i.from([129,this.portId,17,7,(0,u.mapSpeed)(e),this._maxPower,this.useProfile()]),this.send(n),this._finishedCallbacks.push((()=>r()))}))}rotateByDegrees(e,t){if(!this.isVirtualPort&&t instanceof Array)throw new Error("Only virtual ports can accept multiple speeds");if(this.isWeDo2SmartHub)throw new Error("Rotation is not available on the WeDo 2.0 Smart Hub");return this.cancelEventTimer(),new Promise((r=>{let n;null==t&&(t=100),n=t instanceof Array?i.from([129,this.portId,17,12,0,0,0,0,(0,u.mapSpeed)(t[0]),(0,u.mapSpeed)(t[1]),this._maxPower,this._brakeStyle,this.useProfile()]):i.from([129,this.portId,17,11,0,0,0,0,(0,u.mapSpeed)(t),this._maxPower,this._brakeStyle,this.useProfile()]),n.writeUInt32LE(e,4),this.send(n),this._finishedCallbacks.push((()=>r()))}))}useProfile(){let e=0;return this.useAccelerationProfile&&(e+=1),this.useDecelerationProfile&&(e+=2),e}}var l;t.TachoMotor=f,function(e){e[e.ROTATION=2]="ROTATION"}(l||(t.Mode=l={})),t.ModeMap={rotate:l.ROTATION}},3164:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Mode=t.Technic3x3ColorLightMatrix=void 0;const a=r(8359),c=r(3124),u=s(r(8066));class f extends c.Device{constructor(e,t){super(e,t,{},u.DeviceType.TECHNIC_3X3_COLOR_LIGHT_MATRIX)}setMatrix(e){return new Promise((t=>{this.subscribe(l.PIX_0);const r=new Array(9);for(let t=0;t<r.length;t++)"number"==typeof e&&(r[t]=e+160),e[t]instanceof a.Color&&(r[t]=e[t].toValue()),e[t]===u.Color.NONE&&(r[t]=u.Color.NONE),e[t]<=10&&(r[t]=e[t]+160);return this.writeDirect(l.PIX_0,i.from(r)),t()}))}}var l;t.Technic3x3ColorLightMatrix=f,function(e){e[e.LEV_0=0]="LEV_0",e[e.COL_0=1]="COL_0",e[e.PIX_0=2]="PIX_0",e[e.TRANS=3]="TRANS"}(l||(t.Mode=l={}))},9161:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.TechnicColorSensor=void 0;const a=r(3124),c=s(r(8066)),u=r(6185);class f extends a.Device{constructor(e,r){super(e,r,t.ModeMap,c.DeviceType.TECHNIC_COLOR_SENSOR)}receive(e){switch(this._mode){case l.COLOR:if(e[4]<=10){const t=(0,u.parseColor)(e[4]);this.notify("color",{color:t})}break;case l.REFLECTIVITY:const t=e[4];this.notify("reflect",{reflect:t});break;case l.AMBIENT_LIGHT:const r=e[4];this.notify("ambient",{ambient:r})}}setBrightness(e,t,r){this.writeDirect(3,i.from([e,t,r]))}}var l;t.TechnicColorSensor=f,function(e){e[e.COLOR=0]="COLOR",e[e.REFLECTIVITY=1]="REFLECTIVITY",e[e.AMBIENT_LIGHT=2]="AMBIENT_LIGHT"}(l||(t.Mode=l={})),t.ModeMap={color:l.COLOR,reflect:l.REFLECTIVITY,ambient:l.AMBIENT_LIGHT}},6719:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.TechnicDistanceSensor=void 0;const a=r(3124),c=s(r(8066));class u extends a.Device{constructor(e,r){super(e,r,t.ModeMap,c.DeviceType.TECHNIC_DISTANCE_SENSOR)}receive(e){switch(this._mode){case f.DISTANCE:const t=e.readUInt16LE(4);this.notify("distance",{distance:t});break;case f.FAST_DISTANCE:const r=e.readUInt16LE(4);this.notify("fastDistance",{fastDistance:r})}}setBrightness(e,t,r,n){this.writeDirect(5,i.from([e,r,t,n]))}}var f;t.TechnicDistanceSensor=u,function(e){e[e.DISTANCE=0]="DISTANCE",e[e.FAST_DISTANCE=1]="FAST_DISTANCE"}(f||(t.Mode=f={})),t.ModeMap={distance:f.DISTANCE,fastDistance:f.FAST_DISTANCE}},381:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.TechnicForceSensor=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.TECHNIC_FORCE_SENSOR)}receive(e){switch(this._mode){case u.FORCE:const t=e[this.isWeDo2SmartHub?2:4]/10;this.notify("force",{force:t});break;case u.TOUCHED:const r=!!e[4];this.notify("touched",{touched:r});break;case u.TAPPED:const i=e[4];this.notify("tapped",{tapped:i})}}}var u;t.TechnicForceSensor=c,function(e){e[e.FORCE=0]="FORCE",e[e.TOUCHED=1]="TOUCHED",e[e.TAPPED=2]="TAPPED"}(u||(t.Mode=u={})),t.ModeMap={force:u.FORCE,touched:u.TOUCHED,tapped:u.TAPPED}},3488:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TechnicLargeAngularMotor=void 0;const s=r(42),a=o(r(8066));class c extends s.AbsoluteMotor{constructor(e,t,r={},i=a.DeviceType.TECHNIC_LARGE_ANGULAR_MOTOR){super(e,t,{},i)}}t.TechnicLargeAngularMotor=c},3281:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TechnicLargeLinearMotor=void 0;const s=r(42),a=o(r(8066));class c extends s.AbsoluteMotor{constructor(e,t){super(e,t,{},a.DeviceType.TECHNIC_LARGE_LINEAR_MOTOR)}}t.TechnicLargeLinearMotor=c},4230:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TechnicMediumAngularMotor=void 0;const s=r(42),a=o(r(8066));class c extends s.AbsoluteMotor{constructor(e,t,r={},i=a.DeviceType.TECHNIC_MEDIUM_ANGULAR_MOTOR){super(e,t,{},i)}}t.TechnicMediumAngularMotor=c},8971:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.TechnicMediumHubAccelerometerSensor=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.TECHNIC_MEDIUM_HUB_ACCELEROMETER)}receive(e){if(this._mode===u.ACCEL){const t=Math.round(e.readInt16LE(4)/4.096),r=Math.round(e.readInt16LE(6)/4.096),i=Math.round(e.readInt16LE(8)/4.096);this.notify("accel",{x:t,y:r,z:i})}}}var u;t.TechnicMediumHubAccelerometerSensor=c,function(e){e[e.ACCEL=0]="ACCEL"}(u||(t.Mode=u={})),t.ModeMap={accel:u.ACCEL}},2835:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.TechnicMediumHubGyroSensor=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.TECHNIC_MEDIUM_HUB_GYRO_SENSOR)}receive(e){if(this._mode===u.GYRO){const t=Math.round(7*e.readInt16LE(4)/400),r=Math.round(7*e.readInt16LE(6)/400),i=Math.round(7*e.readInt16LE(8)/400);this.notify("gyro",{x:t,y:r,z:i})}}}var u;t.TechnicMediumHubGyroSensor=c,function(e){e[e.GYRO=0]="GYRO"}(u||(t.Mode=u={})),t.ModeMap={gyro:u.GYRO}},5039:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.TechnicMediumHubTiltSensor=void 0;const a=r(3124),c=s(r(8066));class u extends a.Device{constructor(e,r){super(e,r,t.ModeMap,c.DeviceType.TECHNIC_MEDIUM_HUB_TILT_SENSOR),this._impactThreshold=10,this._impactHoldoff=10}receive(e){switch(this._mode){case f.TILT:let t=-e.readInt16LE(4);const r=e.readInt16LE(6),i=e.readInt16LE(8);90!==r&&-90!==r||(t=Math.sign(r)*(t+180),t>180&&(t-=360),t<-180&&(t+=360)),this.notify("tilt",{x:i,y:r,z:t});break;case f.IMPACT_COUNT:if(8!==e.length)break;const n=e.readUInt32LE(4);this.notify("impactCount",{count:n})}}setImpactCount(e){return new Promise((t=>{const r=i.alloc(4);return r.writeUInt32LE(e%2**32),this.writeDirect(1,r),t()}))}setImpactThreshold(e){return this._impactThreshold=e,new Promise((e=>(this.writeDirect(2,i.from([this._impactThreshold,this._impactHoldoff])),e())))}setImpactHoldoff(e){return this._impactHoldoff=e,new Promise((e=>(this.writeDirect(2,i.from([this._impactThreshold,this._impactHoldoff])),e())))}}var f;t.TechnicMediumHubTiltSensor=u,function(e){e[e.TILT=0]="TILT",e[e.IMPACT_COUNT=1]="IMPACT_COUNT"}(f||(t.Mode=f={})),t.ModeMap={tilt:f.TILT,impactCount:f.IMPACT_COUNT}},1188:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TechnicSmallAngularMotor=void 0;const s=r(42),a=o(r(8066));class c extends s.AbsoluteMotor{constructor(e,t,r={},i=a.DeviceType.TECHNIC_SMALL_ANGULAR_MOTOR){super(e,t,{},i)}}t.TechnicSmallAngularMotor=c},4843:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TechnicXLargeLinearMotor=void 0;const s=r(42),a=o(r(8066));class c extends s.AbsoluteMotor{constructor(e,t){super(e,t,{},a.DeviceType.TECHNIC_XLARGE_LINEAR_MOTOR)}}t.TechnicXLargeLinearMotor=c},5047:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.TiltSensor=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.TILT_SENSOR)}receive(e){if(this._mode===u.TILT){const t=e.readInt8(this.isWeDo2SmartHub?2:4),r=e.readInt8(this.isWeDo2SmartHub?3:5);this.notify("tilt",{x:t,y:r})}}}var u;t.TiltSensor=c,function(e){e[e.TILT=0]="TILT"}(u||(t.Mode=u={})),t.ModeMap={tilt:u.TILT}},717:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TrainMotor=void 0;const s=r(5373),a=o(r(8066));class c extends s.BasicMotor{constructor(e,t){super(e,t,{},a.DeviceType.TRAIN_MOTOR)}}t.TrainMotor=c},9152:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ModeMap=t.Mode=t.VoltageSensor=void 0;const s=r(3124),a=o(r(8066));class c extends s.Device{constructor(e,r){super(e,r,t.ModeMap,a.DeviceType.VOLTAGE_SENSOR)}receive(e){if(this._mode===u.VOLTAGE)if(this.isWeDo2SmartHub){const t=e.readInt16LE(2)/40;this.notify("voltage",{voltage:t})}else{let t=f[this.hub.type];void 0===t&&(t=f[a.HubType.UNKNOWN]);let r=l[this.hub.type];void 0===r&&(r=l[a.HubType.UNKNOWN]);const i=e.readUInt16LE(4)*t/r;this.notify("voltage",{voltage:i})}}}var u;t.VoltageSensor=c,function(e){e[e.VOLTAGE=0]="VOLTAGE"}(u||(t.Mode=u={})),t.ModeMap={voltage:u.VOLTAGE};const f={[a.HubType.UNKNOWN]:9.615,[a.HubType.DUPLO_TRAIN_BASE]:6.4,[a.HubType.REMOTE_CONTROL]:6.4},l={[a.HubType.UNKNOWN]:3893,[a.HubType.DUPLO_TRAIN_BASE]:3047,[a.HubType.REMOTE_CONTROL]:3200,[a.HubType.TECHNIC_MEDIUM_HUB]:4095}},9597:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseHub=void 0;const s=r(7007),a=r(5466),c=r(3839),u=r(3124),f=r(692),l=r(1940),_=r(5636),h=r(1472),d=r(1422),p=r(9128),E=r(399),O=r(6556),T=r(9834),b=r(9823),v=r(5530),M=r(8941),y=r(4081),R=r(8055),m=r(87),S=r(8693),g=r(9161),I=r(6719),A=r(381),D=r(3488),L=r(3281),C=r(1188),P=r(4230),N=r(8971),B=r(2835),w=r(5039),U=r(4843),H=r(5047),j=r(717),F=r(9152),W=o(r(8066)),G=r(7833),x=r(3164),V=G("basehub");class k extends s.EventEmitter{constructor(e,t={},r=W.HubType.UNKNOWN){super(),this._attachedDevices={},this._name="",this._firmwareVersion="0.0.00.0000",this._hardwareVersion="0.0.00.0000",this._primaryMACAddress="00:00:00:00:00:00",this._batteryLevel=100,this._rssi=-60,this._portMap={},this._virtualPorts=[],this._attachCallbacks=[],this.setMaxListeners(23),this._type=r,this._bleDevice=e,this._portMap=Object.assign({},t),e.on("disconnect",(()=>{this.emit("disconnect")}))}get name(){return this._bleDevice.name}get connected(){return this._bleDevice.connected}get connecting(){return this._bleDevice.connecting}get type(){return this._type}get ports(){return Object.keys(this._portMap)}get firmwareVersion(){return this._firmwareVersion}get hardwareVersion(){return this._hardwareVersion}get primaryMACAddress(){return this._primaryMACAddress}get uuid(){return this._bleDevice.uuid}get batteryLevel(){return this._batteryLevel}get rssi(){return this._rssi}connect(){if(this._bleDevice.connecting)throw new Error("Already connecting");if(this._bleDevice.connected)throw new Error("Already connected");return this._bleDevice.connect()}disconnect(){return this._bleDevice.disconnect()}getDeviceAtPort(e){const t=this._portMap[e];return void 0!==t?this._attachedDevices[t]:void 0}waitForDeviceAtPort(e){return new Promise((t=>{const r=this.getDeviceAtPort(e);if(r)return t(r);this._attachCallbacks.push((r=>r.portName===e&&(t(r),!0)))}))}getDevices(){return Object.values(this._attachedDevices)}getDevicesByType(e){return this.getDevices().filter((t=>t.type===e))}waitForDeviceByType(e){return new Promise((t=>{const r=this.getDevicesByType(e);if(r.length>=1)return t(r[0]);this._attachCallbacks.push((r=>r.type===e&&(t(r),!0)))}))}getPortNameForPortId(e){for(const t of Object.keys(this._portMap))if(this._portMap[t]===e)return t}isPortVirtual(e){return this._virtualPorts.indexOf(e)>-1}sleep(e){return new Promise((t=>{r.g.setTimeout(t,e)}))}wait(e){return Promise.all(e)}send(e,t){return Promise.resolve()}subscribe(e,t,r){}unsubscribe(e,t,r){}manuallyAttachDevice(e,t){if(this._attachedDevices[t]){if(this._attachedDevices[t].type===e)return V(`Device of ${e} already attached to portId ${t}, returning existing device`),this._attachedDevices[t];throw new Error(`Already a different type of device attached to portId ${t}. Only use this method when you are certain what's attached.`)}{V(`No device attached to portId ${t}, creating and attaching device type ${e}`);const r=this._createDevice(e,t);return this._attachDevice(r),r}}_attachDevice(e){if(this._attachedDevices[e.portId]&&this._attachedDevices[e.portId].type===e.type)return;this._attachedDevices[e.portId]=e,this.emit("attach",e),V(`Attached device type ${e.type} (${W.DeviceTypeNames[e.type]}) on port ${e.portName} (${e.portId})`);let t=this._attachCallbacks.length;for(;t--;)(0,this._attachCallbacks[t])(e)&&this._attachCallbacks.splice(t,1)}_detachDevice(e){delete this._attachedDevices[e.portId],this.emit("detach",e),V(`Detached device type ${e.type} (${W.DeviceTypeNames[e.type]}) on port ${e.portName} (${e.portId})`)}_createDevice(e,t){let r;return r={[W.DeviceType.LIGHT]:p.Light,[W.DeviceType.TRAIN_MOTOR]:j.TrainMotor,[W.DeviceType.SIMPLE_MEDIUM_LINEAR_MOTOR]:S.SimpleMediumLinearMotor,[W.DeviceType.MOVE_HUB_MEDIUM_LINEAR_MOTOR]:M.MoveHubMediumLinearMotor,[W.DeviceType.MOTION_SENSOR]:v.MotionSensor,[W.DeviceType.TILT_SENSOR]:H.TiltSensor,[W.DeviceType.MOVE_HUB_TILT_SENSOR]:y.MoveHubTiltSensor,[W.DeviceType.PIEZO_BUZZER]:R.PiezoBuzzer,[W.DeviceType.TECHNIC_COLOR_SENSOR]:g.TechnicColorSensor,[W.DeviceType.TECHNIC_DISTANCE_SENSOR]:I.TechnicDistanceSensor,[W.DeviceType.TECHNIC_FORCE_SENSOR]:A.TechnicForceSensor,[W.DeviceType.TECHNIC_MEDIUM_HUB_TILT_SENSOR]:w.TechnicMediumHubTiltSensor,[W.DeviceType.TECHNIC_MEDIUM_HUB_GYRO_SENSOR]:B.TechnicMediumHubGyroSensor,[W.DeviceType.TECHNIC_MEDIUM_HUB_ACCELEROMETER]:N.TechnicMediumHubAccelerometerSensor,[W.DeviceType.MEDIUM_LINEAR_MOTOR]:b.MediumLinearMotor,[W.DeviceType.TECHNIC_SMALL_ANGULAR_MOTOR]:C.TechnicSmallAngularMotor,[W.DeviceType.TECHNIC_MEDIUM_ANGULAR_MOTOR]:P.TechnicMediumAngularMotor,[W.DeviceType.TECHNIC_LARGE_ANGULAR_MOTOR]:D.TechnicLargeAngularMotor,[W.DeviceType.TECHNIC_LARGE_LINEAR_MOTOR]:L.TechnicLargeLinearMotor,[W.DeviceType.TECHNIC_XLARGE_LINEAR_MOTOR]:U.TechnicXLargeLinearMotor,[W.DeviceType.COLOR_DISTANCE_SENSOR]:a.ColorDistanceSensor,[W.DeviceType.VOLTAGE_SENSOR]:F.VoltageSensor,[W.DeviceType.CURRENT_SENSOR]:c.CurrentSensor,[W.DeviceType.REMOTE_CONTROL_BUTTON]:m.RemoteControlButton,[W.DeviceType.HUB_LED]:d.HubLED,[W.DeviceType.DUPLO_TRAIN_BASE_COLOR_SENSOR]:f.DuploTrainBaseColorSensor,[W.DeviceType.DUPLO_TRAIN_BASE_MOTOR]:l.DuploTrainBaseMotor,[W.DeviceType.DUPLO_TRAIN_BASE_SPEAKER]:_.DuploTrainBaseSpeaker,[W.DeviceType.DUPLO_TRAIN_BASE_SPEEDOMETER]:h.DuploTrainBaseSpeedometer,[W.DeviceType.MARIO_ACCELEROMETER]:E.MarioAccelerometer,[W.DeviceType.MARIO_BARCODE_SENSOR]:O.MarioBarcodeSensor,[W.DeviceType.MARIO_PANTS_SENSOR]:T.MarioPantsSensor,[W.DeviceType.TECHNIC_MEDIUM_ANGULAR_MOTOR_GREY]:P.TechnicMediumAngularMotor,[W.DeviceType.TECHNIC_LARGE_ANGULAR_MOTOR_GREY]:D.TechnicLargeAngularMotor,[W.DeviceType.TECHNIC_3X3_COLOR_LIGHT_MATRIX]:x.Technic3x3ColorLightMatrix}[e],r?new r(this,t,void 0,e):new u.Device(this,t,void 0,e)}_getDeviceByPortId(e){return this._attachedDevices[e]}}t.BaseHub=k},8062:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PortMap=t.DuploTrainBase=void 0;const s=r(8650),a=o(r(8066)),c=r(7833)("duplotrainbase");class u extends s.LPF2Hub{static IsDuploTrainBase(e){return e.advertisement&&e.advertisement.serviceUuids&&e.advertisement.serviceUuids.indexOf(a.BLEService.LPF2_HUB.replace(/-/g,""))>=0&&e.advertisement.manufacturerData&&e.advertisement.manufacturerData.length>3&&e.advertisement.manufacturerData[3]===a.BLEManufacturerData.DUPLO_TRAIN_BASE_ID}constructor(e){super(e,t.PortMap,a.HubType.DUPLO_TRAIN_BASE),c("Discovered Duplo Train Base")}async connect(){c("Connecting to Duplo Train Base"),await super.connect(),c("Connect completed")}}t.DuploTrainBase=u,t.PortMap={MOTOR:0,COLOR:18,SPEEDOMETER:19}},1718:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PortMap=t.Hub=void 0;const s=r(8385),a=r(8650),c=o(r(8066)),u=r(7833)("hub");class f extends a.LPF2Hub{static IsHub(e){return e.advertisement&&e.advertisement.serviceUuids&&e.advertisement.serviceUuids.indexOf(c.BLEService.LPF2_HUB.replace(/-/g,""))>=0&&e.advertisement.manufacturerData&&e.advertisement.manufacturerData.length>3&&e.advertisement.manufacturerData[3]===c.BLEManufacturerData.HUB_ID}constructor(e){super(e,t.PortMap,c.HubType.HUB),this._currentPort=59,u("Discovered Powered UP Hub")}async connect(){u("Connecting to Powered UP Hub"),await super.connect(),u("Connect completed")}_checkFirmware(e){if(1===(0,s.compareVersions)("1.1.00.0004",e))throw new Error(`Your Powered Up Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`)}}t.Hub=f,t.PortMap={A:0,B:1,HUB_LED:50,CURRENT_SENSOR:59,VOLTAGE_SENSOR:60}},8650:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.LPF2Hub=void 0;const a=r(9597),c=s(r(8066)),u=r(6185),f=r(7833),l=f("lpf2hub"),_=f("lpf2hubmodeinfo");class h extends a.BaseHub{constructor(){super(...arguments),this._messageBuffer=i.alloc(0),this._propertyRequestCallbacks={}}async connect(){l("LPF2Hub connecting"),await super.connect(),await this._bleDevice.discoverCharacteristicsForService(c.BLEService.LPF2_HUB),this._bleDevice.subscribeToCharacteristic(c.BLECharacteristic.LPF2_ALL,this._parseMessage.bind(this)),await this._requestHubPropertyReports(c.HubPropertyPayload.BUTTON_STATE),await this._requestHubPropertyValue(c.HubPropertyPayload.FW_VERSION),await this._requestHubPropertyValue(c.HubPropertyPayload.HW_VERSION),await this._requestHubPropertyReports(c.HubPropertyPayload.RSSI),await this._requestHubPropertyReports(c.HubPropertyPayload.BATTERY_VOLTAGE),await this._requestHubPropertyValue(c.HubPropertyPayload.PRIMARY_MAC_ADDRESS),this.emit("connect"),l("LPF2Hub connected")}shutdown(){return this.send(i.from([2,1]),c.BLECharacteristic.LPF2_ALL)}async setName(e){if(e.length>14)throw new Error("Name must be 14 characters or less");let t=i.from([1,1,1]);t=i.concat([t,i.from(e,"ascii")]),await this.send(t,c.BLECharacteristic.LPF2_ALL),await this.send(t,c.BLECharacteristic.LPF2_ALL),this._name=e}send(e,t){return(e=i.concat([i.alloc(2),e]))[0]=e.length,l("Sent Message (LPF2_ALL)",e),this._bleDevice.writeToCharacteristic(t,e)}subscribe(e,t,r){return this.send(i.from([65,e,r,1,0,0,0,1]),c.BLECharacteristic.LPF2_ALL)}unsubscribe(e,t){return this.send(i.from([65,e,t,1,0,0,0,0]),c.BLECharacteristic.LPF2_ALL)}createVirtualPort(e,t){const r=this.getDeviceAtPort(e);if(!r)throw new Error(`Port ${e} does not have an attached device`);const n=this.getDeviceAtPort(t);if(!n)throw new Error(`Port ${t} does not have an attached device`);if(r.type!==n.type)throw new Error("Both devices must be of the same type to create a virtual port");return this.send(i.from([97,1,r.portId,n.portId]),c.BLECharacteristic.LPF2_ALL)}_checkFirmware(e){}_parseMessage(e){if(e&&(this._messageBuffer=i.concat([this._messageBuffer,e])),this._messageBuffer.length<=0)return;const t=this._messageBuffer[0];if(t<=this._messageBuffer.length){const e=this._messageBuffer.slice(0,t);switch(this._messageBuffer=this._messageBuffer.slice(t),l("Received Message (LPF2_ALL)",e),e[2]){case c.MessageType.HUB_PROPERTIES:{const t=e[3],r=this._propertyRequestCallbacks[t];r?r(e):this._parseHubPropertyResponse(e),delete this._propertyRequestCallbacks[t];break}case c.MessageType.HUB_ATTACHED_IO:this._parsePortMessage(e);break;case c.MessageType.PORT_INFORMATION:this._parsePortInformationResponse(e);break;case c.MessageType.PORT_MODE_INFORMATION:this._parseModeInformationResponse(e);break;case c.MessageType.PORT_VALUE_SINGLE:this._parseSensorMessage(e);break;case c.MessageType.PORT_OUTPUT_COMMAND_FEEDBACK:this._parsePortAction(e)}this._messageBuffer.length>0&&this._parseMessage()}}_requestHubPropertyValue(e){return new Promise((t=>{this._propertyRequestCallbacks[e]=e=>(this._parseHubPropertyResponse(e),t()),this.send(i.from([1,e,5]),c.BLECharacteristic.LPF2_ALL)}))}_requestHubPropertyReports(e){return this.send(i.from([1,e,2]),c.BLECharacteristic.LPF2_ALL)}_parseHubPropertyResponse(e){if(e[3]===c.HubPropertyPayload.BUTTON_STATE){if(1===e[5])return void this.emit("button",{event:c.ButtonState.PRESSED});if(0===e[5])return void this.emit("button",{event:c.ButtonState.RELEASED})}else if(e[3]===c.HubPropertyPayload.FW_VERSION)this._firmwareVersion=(0,u.decodeVersion)(e.readInt32LE(5)),this._checkFirmware(this._firmwareVersion);else if(e[3]===c.HubPropertyPayload.HW_VERSION)this._hardwareVersion=(0,u.decodeVersion)(e.readInt32LE(5));else if(e[3]===c.HubPropertyPayload.RSSI){const t=e.readInt8(5);0!==t&&(this._rssi=t,this.emit("rssi",{rssi:this._rssi}))}else if(e[3]===c.HubPropertyPayload.PRIMARY_MAC_ADDRESS)this._primaryMACAddress=(0,u.decodeMACAddress)(e.slice(5));else if(e[3]===c.HubPropertyPayload.BATTERY_VOLTAGE){const t=e[5];t!==this._batteryLevel&&(this._batteryLevel=t,this.emit("batteryLevel",{batteryLevel:t}))}}async _parsePortMessage(e){const t=e[3],r=e[4],i=r?e.readUInt16LE(5):0;if(r===c.Event.ATTACHED_IO){if(_.enabled){const r=c.DeviceTypeNames[e[5]]||"Unknown";_(`Port ${(0,u.toHex)(t)}, type ${(0,u.toHex)(i,4)} (${r})`);const n=(0,u.decodeVersion)(e.readInt32LE(7)),o=(0,u.decodeVersion)(e.readInt32LE(11));_(`Port ${(0,u.toHex)(t)}, hardware version ${n}, software version ${o}`),await this._sendPortInformationRequest(t)}const r=this._createDevice(i,t);this._attachDevice(r)}else if(r===c.Event.DETACHED_IO){const e=this._getDeviceByPortId(t);if(e&&(this._detachDevice(e),this.isPortVirtual(t))){const e=this.getPortNameForPortId(t);e&&delete this._portMap[e],this._virtualPorts=this._virtualPorts.filter((e=>e!==t))}}else if(r===c.Event.ATTACHED_VIRTUAL_IO){const t=this.getPortNameForPortId(e[7])+this.getPortNameForPortId(e[8]),r=e[3];this._portMap[t]=r,this._virtualPorts.push(r);const n=this._createDevice(i,r);this._attachDevice(n)}}async _sendPortInformationRequest(e){await this.send(i.from([33,e,1]),c.BLECharacteristic.LPF2_ALL),await this.send(i.from([33,e,2]),c.BLECharacteristic.LPF2_ALL)}async _parsePortInformationResponse(e){const t=e[3];if(2===e[4]){const r=[];for(let t=5;t<e.length;t+=2)r.push(e.readUInt16LE(t));return void _(`Port ${(0,u.toHex)(t)}, mode combinations [${r.map((e=>(0,u.toBin)(e,0))).join(", ")}]`)}const r=e[6],i=(0,u.toBin)(e.readUInt16LE(7),r),n=(0,u.toBin)(e.readUInt16LE(9),r);_(`Port ${(0,u.toHex)(t)}, total modes ${r}, input modes ${i}, output modes ${n}`);for(let e=0;e<r;e++)await this._sendModeInformationRequest(t,e,c.ModeInformationType.NAME),await this._sendModeInformationRequest(t,e,c.ModeInformationType.RAW),await this._sendModeInformationRequest(t,e,c.ModeInformationType.PCT),await this._sendModeInformationRequest(t,e,c.ModeInformationType.SI),await this._sendModeInformationRequest(t,e,c.ModeInformationType.SYMBOL),await this._sendModeInformationRequest(t,e,c.ModeInformationType.VALUE_FORMAT)}_sendModeInformationRequest(e,t,r){return this.send(i.from([34,e,t,r]),c.BLECharacteristic.LPF2_ALL)}_parseModeInformationResponse(e){const t=(0,u.toHex)(e[3]),r=e[4];switch(e[5]){case c.ModeInformationType.NAME:_(`Port ${t}, mode ${r}, name ${e.slice(6,e.length).toString()}`);break;case c.ModeInformationType.RAW:_(`Port ${t}, mode ${r}, RAW min ${e.readFloatLE(6)}, max ${e.readFloatLE(10)}`);break;case c.ModeInformationType.PCT:_(`Port ${t}, mode ${r}, PCT min ${e.readFloatLE(6)}, max ${e.readFloatLE(10)}`);break;case c.ModeInformationType.SI:_(`Port ${t}, mode ${r}, SI min ${e.readFloatLE(6)}, max ${e.readFloatLE(10)}`);break;case c.ModeInformationType.SYMBOL:_(`Port ${t}, mode ${r}, SI symbol ${e.slice(6,e.length).toString()}`);break;case c.ModeInformationType.VALUE_FORMAT:const i=e[6],n=["8bit","16bit","32bit","float"][e[7]],o=e[8],s=e[9];_(`Port ${t}, mode ${r}, Value ${i} x ${n}, Decimal format ${o}.${s}`)}}_parsePortAction(e){for(let t=3;t<e.length;t+=2){const r=this._getDeviceByPortId(e[t]);r&&r.finish(e[t+1])}}_parseSensorMessage(e){const t=e[3],r=this._getDeviceByPortId(t);r&&r.receive(e)}}t.LPF2Hub=h},3005:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PortMap=t.Mario=void 0;const s=r(8650),a=o(r(8066)),c=r(7833)("movehub");class u extends s.LPF2Hub{static IsMario(e){return e.advertisement&&e.advertisement.serviceUuids&&e.advertisement.serviceUuids.indexOf(a.BLEService.LPF2_HUB.replace(/-/g,""))>=0&&e.advertisement.manufacturerData&&e.advertisement.manufacturerData.length>3&&e.advertisement.manufacturerData[3]===a.BLEManufacturerData.MARIO_ID}constructor(e){super(e,t.PortMap,a.HubType.MARIO),c("Discovered Mario")}async connect(){c("Connecting to Mario"),await super.connect(),c("Connect completed")}}t.Mario=u,t.PortMap={}},7365:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PortMap=t.MoveHub=void 0;const s=r(8385),a=r(8650),c=o(r(8066)),u=r(7833)("movehub");class f extends a.LPF2Hub{static IsMoveHub(e){return e.advertisement&&e.advertisement.serviceUuids&&e.advertisement.serviceUuids.indexOf(c.BLEService.LPF2_HUB.replace(/-/g,""))>=0&&e.advertisement.manufacturerData&&e.advertisement.manufacturerData.length>3&&e.advertisement.manufacturerData[3]===c.BLEManufacturerData.MOVE_HUB_ID}constructor(e){super(e,t.PortMap,c.HubType.MOVE_HUB),u("Discovered Move Hub")}async connect(){u("Connecting to Move Hub"),await super.connect(),u("Connect completed")}_checkFirmware(e){if(1===(0,s.compareVersions)("2.0.00.0017",e))throw new Error(`Your Move Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`)}}t.MoveHub=f,t.PortMap={A:0,B:1,C:2,D:3,HUB_LED:50,TILT_SENSOR:58,CURRENT_SENSOR:59,VOLTAGE_SENSOR:60}},7410:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PortMap=t.RemoteControl=void 0;const s=r(8650),a=o(r(8066)),c=r(7833)("remotecontrol");class u extends s.LPF2Hub{static IsRemoteControl(e){return e.advertisement&&e.advertisement.serviceUuids&&e.advertisement.serviceUuids.indexOf(a.BLEService.LPF2_HUB.replace(/-/g,""))>=0&&e.advertisement.manufacturerData&&e.advertisement.manufacturerData.length>3&&e.advertisement.manufacturerData[3]===a.BLEManufacturerData.REMOTE_CONTROL_ID}constructor(e){super(e,t.PortMap,a.HubType.REMOTE_CONTROL),c("Discovered Powered UP Remote")}async connect(){c("Connecting to Powered UP Remote"),await super.connect(),c("Connect completed")}}t.RemoteControl=u,t.PortMap={LEFT:0,RIGHT:1,HUB_LED:52,VOLTAGE_SENSOR:59,REMOTE_CONTROL_RSSI:60}},5661:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PortMap=t.TechnicMediumHub=void 0;const s=r(8650),a=o(r(8066)),c=r(7833)("technicmediumhub");class u extends s.LPF2Hub{static IsTechnicMediumHub(e){return e.advertisement&&e.advertisement.serviceUuids&&e.advertisement.serviceUuids.indexOf(a.BLEService.LPF2_HUB.replace(/-/g,""))>=0&&e.advertisement.manufacturerData&&e.advertisement.manufacturerData.length>3&&e.advertisement.manufacturerData[3]===a.BLEManufacturerData.TECHNIC_MEDIUM_HUB_ID}constructor(e){super(e,t.PortMap,a.HubType.TECHNIC_MEDIUM_HUB),c("Discovered Control+ Hub")}async connect(){c("Connecting to Control+ Hub"),await super.connect(),c("Connect completed")}}t.TechnicMediumHub=u,t.PortMap={A:0,B:1,C:2,D:3,HUB_LED:50,CURRENT_SENSOR:59,VOLTAGE_SENSOR:60,ACCELEROMETER:97,GYRO_SENSOR:98,TILT_SENSOR:99}},8293:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PortMap=t.TechnicSmallHub=void 0;const s=r(8650),a=o(r(8066)),c=r(7833)("hub");class u extends s.LPF2Hub{static IsTechnicSmallHub(e){return e.advertisement&&e.advertisement.serviceUuids&&e.advertisement.serviceUuids.indexOf(a.BLEService.LPF2_HUB.replace(/-/g,""))>=0&&e.advertisement.manufacturerData&&e.advertisement.manufacturerData.length>3&&e.advertisement.manufacturerData[3]===a.BLEManufacturerData.TECHNIC_SMALL_HUB_ID}constructor(e){super(e,t.PortMap,a.HubType.TECHNIC_SMALL_HUB),this._currentPort=59,c("Discovered Spike Essential Hub")}async connect(){c("Connecting to Spike Essential Hub"),await super.connect(),c("Connect completed")}}t.TechnicSmallHub=u,t.PortMap={A:0,B:1,HUB_LED:49,CURRENT_SENSOR:59,VOLTAGE_SENSOR:60,ACCELEROMETER:97,GYRO_SENSOR:98,TILT_SENSOR:99}},5940:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PortMap=t.WeDo2SmartHub=void 0;const a=r(9597),c=s(r(8066)),u=r(6185),f=r(7833)("wedo2smarthub");class l extends a.BaseHub{static IsWeDo2SmartHub(e){return e.advertisement&&e.advertisement.serviceUuids&&e.advertisement.serviceUuids.indexOf(c.BLEService.WEDO2_SMART_HUB.replace(/-/g,""))>=0}constructor(e){super(e,t.PortMap,c.HubType.WEDO2_SMART_HUB),this._lastTiltX=0,this._lastTiltY=0,f("Discovered WeDo 2.0 Smart Hub")}connect(){return new Promise((async e=>{f("Connecting to WeDo 2.0 Smart Hub"),await super.connect(),await this._bleDevice.discoverCharacteristicsForService(c.BLEService.WEDO2_SMART_HUB),await this._bleDevice.discoverCharacteristicsForService(c.BLEService.WEDO2_SMART_HUB_2),u.isWebBluetooth?(await this._bleDevice.discoverCharacteristicsForService("battery_service"),await this._bleDevice.discoverCharacteristicsForService("device_information")):(await this._bleDevice.discoverCharacteristicsForService(c.BLEService.WEDO2_SMART_HUB_3),await this._bleDevice.discoverCharacteristicsForService(c.BLEService.WEDO2_SMART_HUB_4),await this._bleDevice.discoverCharacteristicsForService(c.BLEService.WEDO2_SMART_HUB_5)),f("Connect completed"),this.emit("connect"),e(),this._bleDevice.subscribeToCharacteristic(c.BLECharacteristic.WEDO2_PORT_TYPE,this._parsePortMessage.bind(this)),this._bleDevice.subscribeToCharacteristic(c.BLECharacteristic.WEDO2_SENSOR_VALUE,this._parseSensorMessage.bind(this)),this._bleDevice.subscribeToCharacteristic(c.BLECharacteristic.WEDO2_BUTTON,this._parseSensorMessage.bind(this)),u.isWebBluetooth?(this._bleDevice.readFromCharacteristic("00002a19-0000-1000-8000-00805f9b34fb",((e,t)=>{t&&this._parseBatteryMessage(t)})),this._bleDevice.subscribeToCharacteristic("00002a19-0000-1000-8000-00805f9b34fb",this._parseHighCurrentAlert.bind(this))):(this._bleDevice.subscribeToCharacteristic(c.BLECharacteristic.WEDO2_BATTERY,this._parseBatteryMessage.bind(this)),this._bleDevice.readFromCharacteristic(c.BLECharacteristic.WEDO2_BATTERY,((e,t)=>{t&&this._parseBatteryMessage(t)}))),this._bleDevice.subscribeToCharacteristic(c.BLECharacteristic.WEDO2_HIGH_CURRENT_ALERT,this._parseHighCurrentAlert.bind(this)),u.isWebBluetooth?this._bleDevice.readFromCharacteristic("00002a26-0000-1000-8000-00805f9b34fb",((e,t)=>{t&&this._parseFirmwareRevisionString(t)})):this._bleDevice.readFromCharacteristic(c.BLECharacteristic.WEDO2_FIRMWARE_REVISION,((e,t)=>{t&&this._parseFirmwareRevisionString(t)}))}))}shutdown(){return this.send(i.from([0]),c.BLECharacteristic.WEDO2_DISCONNECT)}setName(e){if(e.length>14)throw new Error("Name must be 14 characters or less");return new Promise((t=>{const r=i.from(e,"ascii");return this.send(r,c.BLECharacteristic.WEDO2_NAME_ID),this.send(r,c.BLECharacteristic.WEDO2_NAME_ID),this._name=e,t()}))}send(e,t){return f.enabled&&f(`Sent Message (${this._getCharacteristicNameFromUUID(t)})`,e),this._bleDevice.writeToCharacteristic(t,e)}subscribe(e,t,r){this.send(i.from([1,2,e,t,r,1,0,0,0,0,1]),c.BLECharacteristic.WEDO2_PORT_TYPE_WRITE)}unsubscribe(e,t,r){this.send(i.from([1,2,e,t,r,1,0,0,0,0,0]),c.BLECharacteristic.WEDO2_PORT_TYPE_WRITE)}_getCharacteristicNameFromUUID(e){const t=Object.keys(c.BLECharacteristic);for(let r=0;r<t.length;r++){const i=t[r];if(c.BLECharacteristic[i]===e)return i}return"UNKNOWN"}_parseHighCurrentAlert(e){f("Received Message (WEDO2_HIGH_CURRENT_ALERT)",e)}_parseBatteryMessage(e){f("Received Message (WEDO2_BATTERY)",e);const t=e[0];t!==this._batteryLevel&&(this._batteryLevel=t,this.emit("batteryLevel",{batteryLevel:t}))}_parseFirmwareRevisionString(e){f("Received Message (WEDO2_FIRMWARE_REVISION)",e),this._firmwareVersion=e.toString()}_parsePortMessage(e){f("Received Message (WEDO2_PORT_TYPE)",e);const t=e[0],r=e[1],i=r?e[3]:0;if(1===r){const e=this._createDevice(i,t);this._attachDevice(e)}else if(0===r){const e=this._getDeviceByPortId(t);e&&this._detachDevice(e)}}_parseSensorMessage(e){if(f("Received Message (WEDO2_SENSOR_VALUE)",e),1===e[0])return void this.emit("button",{event:c.ButtonState.PRESSED});if(0===e[0])return void this.emit("button",{event:c.ButtonState.RELEASED});const t=e[1],r=this._getDeviceByPortId(t);r&&r.receive(e)}}t.WeDo2SmartHub=l,t.PortMap={A:1,B:2,CURRENT_SENSOR:3,VOLTAGE_SENSOR:4,PIEZO_BUZZER:5,HUB_LED:6}},1681:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const s=o(r(8066)),a=r(8440),c=r(8359),u=r(9597),f=r(8062),l=r(1718),_=r(3005),h=r(7365),d=r(7410),p=r(5661),E=r(5940),O=r(5466),T=r(3839),b=r(3124),v=r(692),M=r(1940),y=r(5636),R=r(1472),m=r(1422),S=r(9128),g=r(9823),I=r(5530),A=r(8941),D=r(4081),L=r(8055),C=r(87),P=r(8693),N=r(9161),B=r(6719),w=r(381),U=r(3488),H=r(3281),j=r(1188),F=r(4230),W=r(8971),G=r(2835),x=r(5039),V=r(4843),k=r(3164),Y=r(5047),$=r(717),K=r(9152),z=r(7508),X=r(42),q=r(5373),Z=r(6185);window.PoweredUP={PoweredUP:a.PoweredUP,BaseHub:u.BaseHub,WeDo2SmartHub:E.WeDo2SmartHub,TechnicMediumHub:p.TechnicMediumHub,Hub:l.Hub,RemoteControl:d.RemoteControl,DuploTrainBase:f.DuploTrainBase,Consts:s,Color:c.Color,ColorDistanceSensor:O.ColorDistanceSensor,Device:b.Device,DuploTrainBaseColorSensor:v.DuploTrainBaseColorSensor,DuploTrainBaseMotor:M.DuploTrainBaseMotor,DuploTrainBaseSpeaker:y.DuploTrainBaseSpeaker,DuploTrainBaseSpeedometer:R.DuploTrainBaseSpeedometer,HubLED:m.HubLED,Light:S.Light,Mario:_.Mario,MediumLinearMotor:g.MediumLinearMotor,MotionSensor:I.MotionSensor,MoveHub:h.MoveHub,MoveHubMediumLinearMotor:A.MoveHubMediumLinearMotor,MoveHubTiltSensor:D.MoveHubTiltSensor,PiezoBuzzer:L.PiezoBuzzer,RemoteControlButton:C.RemoteControlButton,SimpleMediumLinearMotor:P.SimpleMediumLinearMotor,TechnicColorSensor:N.TechnicColorSensor,TechnicDistanceSensor:B.TechnicDistanceSensor,TechnicForceSensor:w.TechnicForceSensor,TechnicMediumHubAccelerometerSensor:W.TechnicMediumHubAccelerometerSensor,TechnicMediumHubGyroSensor:G.TechnicMediumHubGyroSensor,TechnicMediumHubTiltSensor:x.TechnicMediumHubTiltSensor,TechnicSmallAngularMotor:j.TechnicSmallAngularMotor,TechnicMediumAngularMotor:F.TechnicMediumAngularMotor,TechnicLargeAngularMotor:U.TechnicLargeAngularMotor,TechnicLargeLinearMotor:H.TechnicLargeLinearMotor,TechnicXLargeLinearMotor:V.TechnicXLargeLinearMotor,Technic3x3ColorLightMatrix:k.Technic3x3ColorLightMatrix,TiltSensor:Y.TiltSensor,TrainMotor:$.TrainMotor,VoltageSensor:K.VoltageSensor,CurrentSensor:T.CurrentSensor,TachoMotor:z.TachoMotor,AbsoluteMotor:X.AbsoluteMotor,BasicMotor:q.BasicMotor,isWebBluetooth:Z.isWebBluetooth}},8440:function(e,t,r){"use strict";var i=r(8287).hp,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PoweredUP=void 0;const a=r(3613),c=r(8062),u=r(1718),f=r(3005),l=r(7365),_=r(7410),h=r(5661),d=r(5940),p=s(r(8066)),E=r(7007),O=r(7833),T=r(8293),b=O("poweredup");class v extends E.EventEmitter{constructor(){super(),this._connectedHubs={},this._discoveryEventHandler=this._discoveryEventHandler.bind(this)}async scan(){try{const e=await navigator.bluetooth.requestDevice({filters:[{services:[p.BLEService.WEDO2_SMART_HUB]},{services:[p.BLEService.LPF2_HUB]}],optionalServices:[p.BLEService.WEDO2_SMART_HUB_2,"battery_service","device_information"]}),t=await e.gatt.connect();return this._discoveryEventHandler.call(this,t),!0}catch(e){return!1}}getHubs(){return Object.values(this._connectedHubs)}getHubByUUID(e){return this._connectedHubs[e]}getHubByPrimaryMACAddress(e){return Object.values(this._connectedHubs).filter((t=>t.primaryMACAddress===e))[0]}getHubsByName(e){return Object.values(this._connectedHubs).filter((t=>t.name===e))}getHubsByType(e){return Object.values(this._connectedHubs).filter((t=>t.type===e))}_determineLPF2HubType(e){return new Promise((async t=>{let r=i.alloc(0);await e.subscribeToCharacteristic(p.BLECharacteristic.LPF2_ALL,(n=>{for(r=i.concat([r,n]);r[0]<=r.length;){const i=r[0],n=r.slice(0,i);if(r=r.slice(i),1===n[2]&&11===n[3]){switch(n[5]){case p.BLEManufacturerData.REMOTE_CONTROL_ID:t(p.HubType.REMOTE_CONTROL);break;case p.BLEManufacturerData.MOVE_HUB_ID:t(p.HubType.MOVE_HUB);break;case p.BLEManufacturerData.HUB_ID:t(p.HubType.HUB);break;case p.BLEManufacturerData.DUPLO_TRAIN_BASE_ID:t(p.HubType.DUPLO_TRAIN_BASE);break;case p.BLEManufacturerData.TECHNIC_SMALL_HUB_ID:t(p.HubType.TECHNIC_SMALL_HUB);break;case p.BLEManufacturerData.TECHNIC_MEDIUM_HUB_ID:t(p.HubType.TECHNIC_MEDIUM_HUB);break;case p.BLEManufacturerData.MARIO_ID:t(p.HubType.MARIO)}b("Hub type determined")}else b("Stashed in mailbox (LPF2_ALL)",n),e.addToCharacteristicMailbox(p.BLECharacteristic.LPF2_ALL,n)}})),e.writeToCharacteristic(p.BLECharacteristic.LPF2_ALL,i.from([5,0,1,11,5]))}))}async _discoveryEventHandler(e){const t=new a.WebBLEDevice(e);let r,i=p.HubType.UNKNOWN,n=!1;try{await t.discoverCharacteristicsForService(p.BLEService.WEDO2_SMART_HUB),i=p.HubType.WEDO2_SMART_HUB}catch(e){}try{i!==p.HubType.WEDO2_SMART_HUB&&(await t.discoverCharacteristicsForService(p.BLEService.LPF2_HUB),n=!0)}catch(e){}switch(n&&(i=await this._determineLPF2HubType(t)),i){case p.HubType.WEDO2_SMART_HUB:r=new d.WeDo2SmartHub(t);break;case p.HubType.MOVE_HUB:r=new l.MoveHub(t);break;case p.HubType.HUB:r=new u.Hub(t);break;case p.HubType.REMOTE_CONTROL:r=new _.RemoteControl(t);break;case p.HubType.DUPLO_TRAIN_BASE:r=new c.DuploTrainBase(t);break;case p.HubType.TECHNIC_SMALL_HUB:r=new T.TechnicSmallHub(t);break;case p.HubType.TECHNIC_MEDIUM_HUB:r=new h.TechnicMediumHub(t);break;case p.HubType.MARIO:r=new f.Mario(t);break;default:return}t.on("discoverComplete",(()=>{r.on("connect",(()=>{b(`Hub ${r.uuid} connected`),this._connectedHubs[r.uuid]=r})),r.on("disconnect",(()=>{b(`Hub ${r.uuid} disconnected`),delete this._connectedHubs[r.uuid]})),b(`Hub ${r.uuid} discovered`),this.emit("discover",r)}))}}t.PoweredUP=v},6185:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseColor=t.calculateRamp=t.roundAngleToNearest90=t.normalizeAngle=t.decodeMACAddress=t.decodeVersion=t.mapSpeed=t.toBin=t.toHex=t.isWebBluetooth=void 0;const i=r(7007);t.isWebBluetooth=!("undefined"==typeof navigator||!navigator||!navigator.bluetooth),t.toHex=(e,t=2)=>e.toString(16).padStart(t,"0"),t.toBin=(e,t=8)=>e.toString(2).padStart(t,"0"),t.mapSpeed=e=>127===e?127:(e>100?e=100:e<-100&&(e=-100),e),t.decodeVersion=e=>{const t=e.toString(16).padStart(8,"0");return[t[0],t[1],t.substring(2,4),t.substring(4)].join(".")},t.decodeMACAddress=e=>Array.from(e).map((e=>(0,t.toHex)(e,2))).join(":"),t.normalizeAngle=e=>e>=180?e-(e+180)/360*360:e<-180?e+(180-e)/360*360:e,t.roundAngleToNearest90=e=>(e=(0,t.normalizeAngle)(e))<-135?-180:e<-45?-90:e<45?0:e<135?90:-180,t.calculateRamp=(e,t,r,n)=>{const o=new i.EventEmitter,s=Math.abs(r-t);let a=n/s,c=1;a<50&&s>0&&(c=50/a,a=50),t>r&&(c=-c);let u=0;const f=setInterval((()=>{let e=Math.round(t+ ++u*c);(r>t&&e>r||t>r&&e<r)&&(e=r),o.emit("changePower",e),e===r&&(clearInterval(f),o.emit("finished"))}),a);return e.setEventTimer(f),o},t.parseColor=e=>(1!==e&&5!==e||(e+=1),e)},3613:(e,t,r)=>{"use strict";var i=r(8287).hp;Object.defineProperty(t,"__esModule",{value:!0}),t.WebBLEDevice=void 0;const n=r(7833),o=r(7007),s=n("bledevice");class a extends o.EventEmitter{constructor(e){super(),this._name="",this._listeners={},this._characteristics={},this._queue=Promise.resolve(),this._mailbox=[],this._connected=!1,this._connecting=!1,this._webBLEServer=e,this._uuid=e.device.id,this._name=e.device.name,e.device.addEventListener("gattserverdisconnected",(()=>{this._connecting=!1,this._connected=!1,this.emit("disconnect")})),setTimeout((()=>{this.emit("discoverComplete")}),2e3)}get uuid(){return this._uuid}get name(){return this._name}get connecting(){return this._connecting}get connected(){return this._connected}connect(){return new Promise((e=>(this._connected=!0,e())))}disconnect(){return new Promise((e=>(this._webBLEServer.device.gatt.disconnect(),this._connected=!1,e())))}async discoverCharacteristicsForService(e){s("Service/characteristic discovery started");const t=await this._webBLEServer.getPrimaryService(e),r=await t.getCharacteristics();for(const e of r)this._characteristics[e.uuid]=e;s("Service/characteristic discovery finished")}subscribeToCharacteristic(e,t){this._listeners[e]&&this._characteristics[e].removeEventListener("characteristicvaluechanged",this._listeners[e]),this._listeners[e]=e=>{const r=i.alloc(e.target.value.buffer.byteLength),n=new Uint8Array(e.target.value.buffer);for(let e=0;e<r.length;e++)r[e]=n[e];return s("Incoming data",r),t(r)},this._characteristics[e].addEventListener("characteristicvaluechanged",this._listeners[e]);const r=Array.from(this._mailbox);this._mailbox=[];for(const e of r)s("Replayed from mailbox (LPF2_ALL)",e),t(e);return this._characteristics[e].startNotifications()}addToCharacteristicMailbox(e,t){this._mailbox.push(t)}readFromCharacteristic(e,t){this._characteristics[e].readValue().then((e=>{const r=i.alloc(e.buffer.byteLength),n=new Uint8Array(e.buffer);for(let e=0;e<r.length;e++)r[e]=n[e];t(null,r)}))}writeToCharacteristic(e,t){return this._queue=this._queue.then((()=>this._characteristics[e].writeValueWithoutResponse(t)))}_sanitizeUUID(e){return e.replace(/-/g,"")}}t.WebBLEDevice=a}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(1681)})();
3
- //# sourceMappingURL=poweredup.js.map
@@ -1,8 +0,0 @@
1
- /*!
2
- * The buffer module from node.js, for the browser.
3
- *
4
- * @author Feross Aboukhadijeh <https://feross.org>
5
- * @license MIT
6
- */
7
-
8
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */