@wirekyt/dom 0.0.1 → 0.0.2

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 (476) hide show
  1. package/dist/anatomy-DMuSMbOP.d.cts +18 -0
  2. package/dist/anatomy-DMuSMbOP.d.ts +18 -0
  3. package/dist/anatomy.cjs +3 -0
  4. package/dist/anatomy.d.cts +2 -0
  5. package/dist/anatomy.d.ts +2 -0
  6. package/dist/anatomy.js +2 -0
  7. package/dist/angle-3hqP0Mp5.cjs +13 -0
  8. package/dist/angle-oNt8uGHQ.js +8 -0
  9. package/dist/aria-hidden-CEXexb2I.js +127 -0
  10. package/dist/aria-hidden-Y7iJHPMr.cjs +132 -0
  11. package/dist/aria-hidden.cjs +3 -0
  12. package/dist/aria-hidden.d.cts +10 -0
  13. package/dist/aria-hidden.d.ts +10 -0
  14. package/dist/aria-hidden.js +2 -0
  15. package/dist/array-BGtygd0o.cjs +198 -0
  16. package/dist/array-C4KbHsha.js +73 -0
  17. package/dist/auto-resize-5F5iiKZb.cjs +106 -0
  18. package/dist/auto-resize-KkNfCcBt.js +95 -0
  19. package/dist/auto-resize.cjs +4 -0
  20. package/dist/auto-resize.d.cts +7 -0
  21. package/dist/auto-resize.d.ts +7 -0
  22. package/dist/auto-resize.js +2 -0
  23. package/dist/caret-CHqaP4XG.cjs +30 -0
  24. package/dist/caret-aiDJ6mAS.js +19 -0
  25. package/dist/closest-Clo6ODcK.js +117 -0
  26. package/dist/closest-IiRz1GIJ.cjs +176 -0
  27. package/dist/collection-CJU0oDtX.js +1295 -0
  28. package/dist/collection-CwzUJwBJ.cjs +1342 -0
  29. package/dist/collection.cjs +15 -0
  30. package/dist/collection.d.cts +34 -0
  31. package/dist/collection.d.ts +34 -0
  32. package/dist/collection.js +3 -0
  33. package/dist/color-CsugZjq6.d.cts +60 -0
  34. package/dist/color-CsugZjq6.d.ts +60 -0
  35. package/dist/color-utils-DzeOVYlL.cjs +662 -0
  36. package/dist/color-utils-lDDg9FEh.js +639 -0
  37. package/dist/color-utils.cjs +6 -0
  38. package/dist/color-utils.d.cts +18 -0
  39. package/dist/color-utils.d.ts +18 -0
  40. package/dist/color-utils.js +2 -0
  41. package/dist/computed-style-B1MKlCoo.js +9 -0
  42. package/dist/computed-style-DLArEFNw.cjs +14 -0
  43. package/dist/controller-B8E8ZJCI.cjs +133 -0
  44. package/dist/controller-Dv7lWHDr.js +92 -0
  45. package/dist/core-BF6G2RiC.d.cts +1 -0
  46. package/dist/core-BNMw-JId.cjs +372 -0
  47. package/dist/core-BdeZuSX6.d.ts +1 -0
  48. package/dist/core-CJ0MZr3D.js +289 -0
  49. package/dist/core.cjs +19 -0
  50. package/dist/core.d.cts +3 -0
  51. package/dist/core.d.ts +3 -0
  52. package/dist/core.js +3 -0
  53. package/dist/create-anatomy-B2q3wiaw.js +22 -0
  54. package/dist/create-anatomy-BwDn25ph.cjs +27 -0
  55. package/dist/create-props-CgtcN_Qu.js +4 -0
  56. package/dist/create-props-CjLx2oS8.cjs +9 -0
  57. package/dist/data-url-C-Uk31Q9.cjs +42 -0
  58. package/dist/data-url-DHUHj7UF.js +37 -0
  59. package/dist/data-url-Gx_SWG-k.d.cts +10 -0
  60. package/dist/data-url-Gx_SWG-k.d.ts +10 -0
  61. package/dist/date-utils-D-JJHedx.cjs +868 -0
  62. package/dist/date-utils-D5zXW-Cs.js +569 -0
  63. package/dist/date-utils.cjs +52 -0
  64. package/dist/date-utils.d.cts +7 -0
  65. package/dist/date-utils.d.ts +7 -0
  66. package/dist/date-utils.js +2 -0
  67. package/dist/dismissable-C0bixtzl.cjs +348 -0
  68. package/dist/dismissable-KM1jPtNQ.js +337 -0
  69. package/dist/dismissable-layer-BTX5EvXw.d.ts +40 -0
  70. package/dist/dismissable-layer-Ch5niVaq.d.cts +40 -0
  71. package/dist/dismissable.cjs +4 -0
  72. package/dist/dismissable.d.cts +3 -0
  73. package/dist/dismissable.d.ts +3 -0
  74. package/dist/dismissable.js +2 -0
  75. package/dist/dom-query-CQzY93XU.cjs +488 -0
  76. package/dist/dom-query-e7fh0TEH.js +243 -0
  77. package/dist/dom-query.cjs +180 -0
  78. package/dist/dom-query.d.cts +142 -0
  79. package/dist/dom-query.d.ts +142 -0
  80. package/dist/dom-query.js +43 -0
  81. package/dist/equal-C927y7MN.cjs +30 -0
  82. package/dist/equal-DtrP8DPh.js +25 -0
  83. package/dist/event-DDz-mMhM.cjs +242 -0
  84. package/dist/event-bTItRgiw.js +117 -0
  85. package/dist/file-utils-6EXCdfHx.js +116 -0
  86. package/dist/file-utils-B7OJigQq.cjs +151 -0
  87. package/dist/file-utils.cjs +92 -0
  88. package/dist/file-utils.d.cts +40 -0
  89. package/dist/file-utils.d.ts +40 -0
  90. package/dist/file-utils.js +82 -0
  91. package/dist/focus-trap-89E5I9nm.js +487 -0
  92. package/dist/focus-trap-D7jKsfHW.cjs +498 -0
  93. package/dist/focus-trap.cjs +4 -0
  94. package/dist/focus-trap.d.cts +89 -0
  95. package/dist/focus-trap.d.ts +89 -0
  96. package/dist/focus-trap.js +2 -0
  97. package/dist/focus-visible-DWdQf__4.js +176 -0
  98. package/dist/focus-visible-G4cmlWqq.cjs +217 -0
  99. package/dist/focus-visible.cjs +9 -0
  100. package/dist/focus-visible.d.cts +32 -0
  101. package/dist/focus-visible.d.ts +32 -0
  102. package/dist/focus-visible.js +2 -0
  103. package/dist/form-B1DW_w_3.js +89 -0
  104. package/dist/form-CoupKpuP.cjs +130 -0
  105. package/dist/from-window-5ZhzSURC.js +68 -0
  106. package/dist/from-window-B9DKtaoR.cjs +115 -0
  107. package/dist/functions-isw5Ovcx.d.cts +16 -0
  108. package/dist/functions-isw5Ovcx.d.ts +16 -0
  109. package/dist/highlight-word.cjs +95 -0
  110. package/dist/highlight-word.d.cts +24 -0
  111. package/dist/highlight-word.d.ts +24 -0
  112. package/dist/highlight-word.js +94 -0
  113. package/dist/hotkeys.cjs +1183 -0
  114. package/dist/hotkeys.d.cts +199 -0
  115. package/dist/hotkeys.d.ts +199 -0
  116. package/dist/hotkeys.js +1173 -0
  117. package/dist/i18n-utils-BD4VtonY.cjs +345 -0
  118. package/dist/i18n-utils-C4FQZ39m.js +280 -0
  119. package/dist/i18n-utils.cjs +216 -0
  120. package/dist/i18n-utils.d.cts +71 -0
  121. package/dist/i18n-utils.d.ts +71 -0
  122. package/dist/i18n-utils.js +204 -0
  123. package/dist/index-3tNJficI.d.cts +117 -0
  124. package/dist/index-3tNJficI.d.ts +117 -0
  125. package/dist/index-BEfvdGE2.d.cts +116 -0
  126. package/dist/index-BEfvdGE2.d.ts +116 -0
  127. package/dist/index-BF6G2RiC.d.cts +1 -0
  128. package/dist/index-BKgxIVbE.d.cts +285 -0
  129. package/dist/index-BMtpmaRD.d.cts +16 -0
  130. package/dist/index-BMtpmaRD.d.ts +16 -0
  131. package/dist/index-BWiYePx8.d.cts +216 -0
  132. package/dist/index-BXfunVyD.d.cts +1342 -0
  133. package/dist/index-BXfunVyD.d.ts +1342 -0
  134. package/dist/index-BdeZuSX6.d.ts +1 -0
  135. package/dist/index-C2865AJq.d.cts +25 -0
  136. package/dist/index-C2865AJq.d.ts +25 -0
  137. package/dist/index-CFoN0L3C.d.ts +285 -0
  138. package/dist/index-vPrqYDHu.d.ts +216 -0
  139. package/dist/index.cjs +19 -0
  140. package/dist/index.d.cts +3 -0
  141. package/dist/index.d.ts +3 -0
  142. package/dist/index.js +3 -0
  143. package/dist/initial-focus-BQxRRFPa.cjs +37 -0
  144. package/dist/initial-focus-BrN5tT2X.js +26 -0
  145. package/dist/interact-outside-BjqIunFx.js +211 -0
  146. package/dist/interact-outside-Dphjr2Zh.cjs +216 -0
  147. package/dist/interact-outside.cjs +3 -0
  148. package/dist/interact-outside.d.cts +2 -0
  149. package/dist/interact-outside.d.ts +2 -0
  150. package/dist/interact-outside.js +2 -0
  151. package/dist/json-tree-utils.cjs +1518 -0
  152. package/dist/json-tree-utils.d.cts +117 -0
  153. package/dist/json-tree-utils.d.ts +117 -0
  154. package/dist/json-tree-utils.js +1469 -0
  155. package/dist/list-collection-D_eNKrot.d.cts +60 -0
  156. package/dist/list-collection-RqYEWHb4.d.ts +60 -0
  157. package/dist/live-region-BD0OgmrH.cjs +68 -0
  158. package/dist/live-region-F8YMmbrY.js +63 -0
  159. package/dist/live-region.cjs +3 -0
  160. package/dist/live-region.d.cts +2 -0
  161. package/dist/live-region.d.ts +2 -0
  162. package/dist/live-region.js +2 -0
  163. package/dist/machines/accordion/index.cjs +328 -0
  164. package/dist/machines/accordion/index.d.cts +83 -0
  165. package/dist/machines/accordion/index.d.ts +83 -0
  166. package/dist/machines/accordion/index.js +321 -0
  167. package/dist/machines/angle-slider/index.cjs +420 -0
  168. package/dist/machines/angle-slider/index.d.cts +84 -0
  169. package/dist/machines/angle-slider/index.d.ts +84 -0
  170. package/dist/machines/angle-slider/index.js +415 -0
  171. package/dist/machines/async-list/index.cjs +310 -0
  172. package/dist/machines/async-list/index.d.cts +90 -0
  173. package/dist/machines/async-list/index.d.ts +90 -0
  174. package/dist/machines/async-list/index.js +308 -0
  175. package/dist/machines/avatar/index.cjs +165 -0
  176. package/dist/machines/avatar/index.d.cts +63 -0
  177. package/dist/machines/avatar/index.d.ts +63 -0
  178. package/dist/machines/avatar/index.js +160 -0
  179. package/dist/machines/carousel/index.cjs +929 -0
  180. package/dist/machines/carousel/index.d.cts +146 -0
  181. package/dist/machines/carousel/index.d.ts +146 -0
  182. package/dist/machines/carousel/index.js +920 -0
  183. package/dist/machines/cascade-select/index.cjs +1426 -0
  184. package/dist/machines/cascade-select/index.d.cts +167 -0
  185. package/dist/machines/cascade-select/index.d.ts +167 -0
  186. package/dist/machines/cascade-select/index.js +1419 -0
  187. package/dist/machines/checkbox/index.cjs +316 -0
  188. package/dist/machines/checkbox/index.d.cts +81 -0
  189. package/dist/machines/checkbox/index.d.ts +81 -0
  190. package/dist/machines/checkbox/index.js +311 -0
  191. package/dist/machines/clipboard/index.cjs +228 -0
  192. package/dist/machines/clipboard/index.d.cts +72 -0
  193. package/dist/machines/clipboard/index.d.ts +72 -0
  194. package/dist/machines/clipboard/index.js +221 -0
  195. package/dist/machines/collapsible/index.cjs +363 -0
  196. package/dist/machines/collapsible/index.d.cts +82 -0
  197. package/dist/machines/collapsible/index.d.ts +82 -0
  198. package/dist/machines/collapsible/index.js +358 -0
  199. package/dist/machines/color-picker/index.cjs +1534 -0
  200. package/dist/machines/color-picker/index.d.cts +207 -0
  201. package/dist/machines/color-picker/index.d.ts +207 -0
  202. package/dist/machines/color-picker/index.js +1518 -0
  203. package/dist/machines/combobox/index.cjs +1554 -0
  204. package/dist/machines/combobox/index.d.cts +219 -0
  205. package/dist/machines/combobox/index.d.ts +219 -0
  206. package/dist/machines/combobox/index.js +1542 -0
  207. package/dist/machines/date-input/index.cjs +1974 -0
  208. package/dist/machines/date-input/index.d.cts +230 -0
  209. package/dist/machines/date-input/index.d.ts +230 -0
  210. package/dist/machines/date-input/index.js +1958 -0
  211. package/dist/machines/date-picker/index.cjs +2424 -0
  212. package/dist/machines/date-picker/index.d.cts +378 -0
  213. package/dist/machines/date-picker/index.d.ts +378 -0
  214. package/dist/machines/date-picker/index.js +2408 -0
  215. package/dist/machines/dialog/index.cjs +378 -0
  216. package/dist/machines/dialog/index.d.cts +94 -0
  217. package/dist/machines/dialog/index.d.ts +94 -0
  218. package/dist/machines/dialog/index.js +373 -0
  219. package/dist/machines/drawer/index.cjs +2066 -0
  220. package/dist/machines/drawer/index.d.cts +334 -0
  221. package/dist/machines/drawer/index.d.ts +334 -0
  222. package/dist/machines/drawer/index.js +2059 -0
  223. package/dist/machines/editable/index.cjs +550 -0
  224. package/dist/machines/editable/index.d.cts +114 -0
  225. package/dist/machines/editable/index.d.ts +114 -0
  226. package/dist/machines/editable/index.js +545 -0
  227. package/dist/machines/file-upload/index.cjs +648 -0
  228. package/dist/machines/file-upload/index.d.cts +150 -0
  229. package/dist/machines/file-upload/index.d.ts +150 -0
  230. package/dist/machines/file-upload/index.js +641 -0
  231. package/dist/machines/floating-panel/index.cjs +1020 -0
  232. package/dist/machines/floating-panel/index.d.cts +149 -0
  233. package/dist/machines/floating-panel/index.d.ts +149 -0
  234. package/dist/machines/floating-panel/index.js +1012 -0
  235. package/dist/machines/hover-card/index.cjs +441 -0
  236. package/dist/machines/hover-card/index.d.cts +82 -0
  237. package/dist/machines/hover-card/index.d.ts +82 -0
  238. package/dist/machines/hover-card/index.js +436 -0
  239. package/dist/machines/image-cropper/index.cjs +2082 -0
  240. package/dist/machines/image-cropper/index.d.cts +182 -0
  241. package/dist/machines/image-cropper/index.d.ts +182 -0
  242. package/dist/machines/image-cropper/index.js +2076 -0
  243. package/dist/machines/listbox/index.cjs +873 -0
  244. package/dist/machines/listbox/index.d.cts +175 -0
  245. package/dist/machines/listbox/index.d.ts +175 -0
  246. package/dist/machines/listbox/index.js +860 -0
  247. package/dist/machines/marquee/index.cjs +387 -0
  248. package/dist/machines/marquee/index.d.cts +102 -0
  249. package/dist/machines/marquee/index.d.ts +102 -0
  250. package/dist/machines/marquee/index.js +382 -0
  251. package/dist/machines/menu/index.cjs +1562 -0
  252. package/dist/machines/menu/index.d.cts +188 -0
  253. package/dist/machines/menu/index.d.ts +188 -0
  254. package/dist/machines/menu/index.js +1549 -0
  255. package/dist/machines/navigation-menu/index.cjs +860 -0
  256. package/dist/machines/navigation-menu/index.d.cts +131 -0
  257. package/dist/machines/navigation-menu/index.d.ts +131 -0
  258. package/dist/machines/navigation-menu/index.js +855 -0
  259. package/dist/machines/number-input/index.cjs +1014 -0
  260. package/dist/machines/number-input/index.d.cts +136 -0
  261. package/dist/machines/number-input/index.d.ts +136 -0
  262. package/dist/machines/number-input/index.js +1009 -0
  263. package/dist/machines/pagination/index.cjs +413 -0
  264. package/dist/machines/pagination/index.d.cts +139 -0
  265. package/dist/machines/pagination/index.d.ts +139 -0
  266. package/dist/machines/pagination/index.js +404 -0
  267. package/dist/machines/password-input/index.cjs +224 -0
  268. package/dist/machines/password-input/index.d.cts +71 -0
  269. package/dist/machines/password-input/index.d.ts +71 -0
  270. package/dist/machines/password-input/index.js +219 -0
  271. package/dist/machines/pin-input/index.cjs +595 -0
  272. package/dist/machines/pin-input/index.d.cts +107 -0
  273. package/dist/machines/pin-input/index.d.ts +107 -0
  274. package/dist/machines/pin-input/index.js +590 -0
  275. package/dist/machines/popover/index.cjs +516 -0
  276. package/dist/machines/popover/index.d.cts +107 -0
  277. package/dist/machines/popover/index.d.ts +107 -0
  278. package/dist/machines/popover/index.js +511 -0
  279. package/dist/machines/presence/index.cjs +193 -0
  280. package/dist/machines/presence/index.d.cts +44 -0
  281. package/dist/machines/presence/index.d.ts +44 -0
  282. package/dist/machines/presence/index.js +190 -0
  283. package/dist/machines/progress/index.cjs +282 -0
  284. package/dist/machines/progress/index.d.cts +96 -0
  285. package/dist/machines/progress/index.d.ts +96 -0
  286. package/dist/machines/progress/index.js +277 -0
  287. package/dist/machines/qr-code/index.cjs +167 -0
  288. package/dist/machines/qr-code/index.d.cts +71 -0
  289. package/dist/machines/qr-code/index.d.ts +71 -0
  290. package/dist/machines/qr-code/index.js +162 -0
  291. package/dist/machines/radio-group/index.cjs +465 -0
  292. package/dist/machines/radio-group/index.d.cts +218 -0
  293. package/dist/machines/radio-group/index.d.ts +218 -0
  294. package/dist/machines/radio-group/index.js +458 -0
  295. package/dist/machines/rating-group/index.cjs +405 -0
  296. package/dist/machines/rating-group/index.d.cts +101 -0
  297. package/dist/machines/rating-group/index.d.ts +101 -0
  298. package/dist/machines/rating-group/index.js +398 -0
  299. package/dist/machines/scroll-area/index.cjs +865 -0
  300. package/dist/machines/scroll-area/index.d.cts +126 -0
  301. package/dist/machines/scroll-area/index.d.ts +126 -0
  302. package/dist/machines/scroll-area/index.js +860 -0
  303. package/dist/machines/select/index.cjs +1226 -0
  304. package/dist/machines/select/index.d.cts +190 -0
  305. package/dist/machines/select/index.d.ts +190 -0
  306. package/dist/machines/select/index.js +1214 -0
  307. package/dist/machines/signature-pad/index.cjs +337 -0
  308. package/dist/machines/signature-pad/index.d.cts +108 -0
  309. package/dist/machines/signature-pad/index.d.ts +108 -0
  310. package/dist/machines/signature-pad/index.js +330 -0
  311. package/dist/machines/slider/index.cjs +1103 -0
  312. package/dist/machines/slider/index.d.cts +154 -0
  313. package/dist/machines/slider/index.d.ts +154 -0
  314. package/dist/machines/slider/index.js +1094 -0
  315. package/dist/machines/splitter/index.cjs +1686 -0
  316. package/dist/machines/splitter/index.d.cts +282 -0
  317. package/dist/machines/splitter/index.d.ts +282 -0
  318. package/dist/machines/splitter/index.js +1675 -0
  319. package/dist/machines/steps/index.cjs +330 -0
  320. package/dist/machines/steps/index.d.cts +109 -0
  321. package/dist/machines/steps/index.d.ts +109 -0
  322. package/dist/machines/steps/index.js +325 -0
  323. package/dist/machines/switch/index.cjs +307 -0
  324. package/dist/machines/switch/index.d.cts +80 -0
  325. package/dist/machines/switch/index.d.ts +80 -0
  326. package/dist/machines/switch/index.js +302 -0
  327. package/dist/machines/tabs/index.cjs +542 -0
  328. package/dist/machines/tabs/index.d.cts +113 -0
  329. package/dist/machines/tabs/index.d.ts +113 -0
  330. package/dist/machines/tabs/index.js +533 -0
  331. package/dist/machines/tags-input/index.cjs +1151 -0
  332. package/dist/machines/tags-input/index.d.cts +182 -0
  333. package/dist/machines/tags-input/index.d.ts +182 -0
  334. package/dist/machines/tags-input/index.js +1144 -0
  335. package/dist/machines/timer/index.cjs +329 -0
  336. package/dist/machines/timer/index.d.cts +102 -0
  337. package/dist/machines/timer/index.d.ts +102 -0
  338. package/dist/machines/timer/index.js +323 -0
  339. package/dist/machines/toast/index.cjs +1185 -0
  340. package/dist/machines/toast/index.d.cts +204 -0
  341. package/dist/machines/toast/index.d.ts +204 -0
  342. package/dist/machines/toast/index.js +1180 -0
  343. package/dist/machines/toc/index.cjs +358 -0
  344. package/dist/machines/toc/index.d.cts +98 -0
  345. package/dist/machines/toc/index.d.ts +98 -0
  346. package/dist/machines/toc/index.js +351 -0
  347. package/dist/machines/toggle/index.cjs +99 -0
  348. package/dist/machines/toggle/index.d.cts +46 -0
  349. package/dist/machines/toggle/index.d.ts +46 -0
  350. package/dist/machines/toggle/index.js +94 -0
  351. package/dist/machines/toggle-group/index.cjs +329 -0
  352. package/dist/machines/toggle-group/index.d.cts +81 -0
  353. package/dist/machines/toggle-group/index.d.ts +81 -0
  354. package/dist/machines/toggle-group/index.js +322 -0
  355. package/dist/machines/tooltip/index.cjs +638 -0
  356. package/dist/machines/tooltip/index.d.cts +84 -0
  357. package/dist/machines/tooltip/index.d.ts +84 -0
  358. package/dist/machines/tooltip/index.js +633 -0
  359. package/dist/machines/tour/index.cjs +1123 -0
  360. package/dist/machines/tour/index.d.cts +207 -0
  361. package/dist/machines/tour/index.d.ts +207 -0
  362. package/dist/machines/tour/index.js +1115 -0
  363. package/dist/machines/tree-view/index.cjs +1288 -0
  364. package/dist/machines/tree-view/index.d.cts +221 -0
  365. package/dist/machines/tree-view/index.d.ts +221 -0
  366. package/dist/machines/tree-view/index.js +1279 -0
  367. package/dist/mutation-observer-_LbwtN3W.cjs +61 -0
  368. package/dist/mutation-observer-qObPUo3D.js +50 -0
  369. package/dist/navigate-CJOaL3vx.js +31 -0
  370. package/dist/navigate-uJG-006f.cjs +42 -0
  371. package/dist/overflow-BBihfMxX.cjs +67 -0
  372. package/dist/overflow-C-zO1CWA.js +44 -0
  373. package/dist/platform-BDB0wXUk.js +26 -0
  374. package/dist/platform-BZS-dkZN.cjs +109 -0
  375. package/dist/point-C9A4dk1i.js +27 -0
  376. package/dist/point-DxnCrJBy.cjs +32 -0
  377. package/dist/pointer-lock-BvfSjt_s.cjs +31 -0
  378. package/dist/pointer-lock-WezxTqu-.js +26 -0
  379. package/dist/pointer-move-CGzan38r.cjs +42 -0
  380. package/dist/pointer-move-Tijb8Ptk.js +37 -0
  381. package/dist/polygon-BvdwYRBw.js +76 -0
  382. package/dist/polygon-CTR1kEoU.cjs +93 -0
  383. package/dist/popper-DkAAS9VE.cjs +487 -0
  384. package/dist/popper-DzBZzAe4.js +464 -0
  385. package/dist/popper.cjs +6 -0
  386. package/dist/popper.d.cts +2 -0
  387. package/dist/popper.d.ts +2 -0
  388. package/dist/popper.js +2 -0
  389. package/dist/press-B7XLrLGR.js +65 -0
  390. package/dist/press-BdD5suLQ.cjs +70 -0
  391. package/dist/proxy-tab-focus-DWMXvAfO.js +54 -0
  392. package/dist/proxy-tab-focus-NthYgHdY.cjs +59 -0
  393. package/dist/raf-BSDcY4UD.cjs +85 -0
  394. package/dist/raf-DgINgykK.d.cts +15 -0
  395. package/dist/raf-DgINgykK.d.ts +15 -0
  396. package/dist/raf-Dhvm7f1e.js +62 -0
  397. package/dist/rect-utils-DiT4k3jS.cjs +548 -0
  398. package/dist/rect-utils-d_3gZVsc.js +459 -0
  399. package/dist/rect-utils.cjs +165 -0
  400. package/dist/rect-utils.d.cts +197 -0
  401. package/dist/rect-utils.d.ts +197 -0
  402. package/dist/rect-utils.js +116 -0
  403. package/dist/remove-scroll-DTVA5f4w.cjs +86 -0
  404. package/dist/remove-scroll-WEheFCiq.js +81 -0
  405. package/dist/remove-scroll.cjs +3 -0
  406. package/dist/remove-scroll.d.cts +4 -0
  407. package/dist/remove-scroll.d.ts +4 -0
  408. package/dist/remove-scroll.js +2 -0
  409. package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
  410. package/dist/scale-C5BBHVgH.js +17 -0
  411. package/dist/scale-C7iiUGhS.cjs +22 -0
  412. package/dist/scope-CysKlKe9.cjs +28 -0
  413. package/dist/scope-D1873Mzi.js +23 -0
  414. package/dist/scroll-CVJ40w2e.js +46 -0
  415. package/dist/scroll-Dyd1QLrc.cjs +63 -0
  416. package/dist/scroll-snap-Cuaqdevf.cjs +224 -0
  417. package/dist/scroll-snap-DqMiFASa.js +201 -0
  418. package/dist/scroll-snap.cjs +6 -0
  419. package/dist/scroll-snap.d.cts +14 -0
  420. package/dist/scroll-snap.d.ts +14 -0
  421. package/dist/scroll-snap.js +2 -0
  422. package/dist/selection-ClKhnWit.d.cts +49 -0
  423. package/dist/selection-DzLiSVkg.d.ts +49 -0
  424. package/dist/selection-map-962WvX2k.js +45 -0
  425. package/dist/selection-map-BwlZr1LH.cjs +68 -0
  426. package/dist/set-CFNGOW5W.js +50 -0
  427. package/dist/set-DrtWCLFb.cjs +73 -0
  428. package/dist/store-BLpJlMxz.js +257 -0
  429. package/dist/store-Btfrm2bs.cjs +47 -0
  430. package/dist/store-C5HvdLyc.js +42 -0
  431. package/dist/store-Wg8KVwNv.cjs +298 -0
  432. package/dist/store.cjs +9 -0
  433. package/dist/store.d.cts +26 -0
  434. package/dist/store.d.ts +26 -0
  435. package/dist/store.js +2 -0
  436. package/dist/stringify-state.cjs +48 -0
  437. package/dist/stringify-state.d.cts +8 -0
  438. package/dist/stringify-state.d.ts +8 -0
  439. package/dist/stringify-state.js +44 -0
  440. package/dist/tabbable-Bz1-1GAY.cjs +206 -0
  441. package/dist/tabbable-CDA1YMjZ.js +147 -0
  442. package/dist/text-selection-B3OQpQGy.cjs +75 -0
  443. package/dist/text-selection-DXvWvm6k.js +64 -0
  444. package/dist/timers-BRyPrXIX.js +82 -0
  445. package/dist/timers-Beu4SfAj.cjs +99 -0
  446. package/dist/tree-collection-3QX3EIhq.d.ts +77 -0
  447. package/dist/tree-collection-C6oDQGUJ.d.cts +77 -0
  448. package/dist/typeahead-DremEgML.d.cts +45 -0
  449. package/dist/typeahead-DremEgML.d.ts +45 -0
  450. package/dist/types-BFuHIo7S.js +10 -0
  451. package/dist/types-CczqoQLL.d.cts +57 -0
  452. package/dist/types-CczqoQLL.d.ts +57 -0
  453. package/dist/types-CjocssbC.d.cts +13 -0
  454. package/dist/types-CjocssbC.d.ts +13 -0
  455. package/dist/types-D7oF7eWh.d.cts +54 -0
  456. package/dist/types-D7oF7eWh.d.ts +54 -0
  457. package/dist/types-HCvp3Bhv.cjs +21 -0
  458. package/dist/types.cjs +14 -0
  459. package/dist/types.d.cts +6 -0
  460. package/dist/types.d.ts +6 -0
  461. package/dist/types.js +12 -0
  462. package/dist/utils-BH-oBBz2.cjs +614 -0
  463. package/dist/utils-Cht5XaHf.js +267 -0
  464. package/dist/utils.cjs +95 -0
  465. package/dist/utils.d.cts +144 -0
  466. package/dist/utils.d.ts +144 -0
  467. package/dist/utils.js +7 -0
  468. package/dist/visually-hidden-BgSCFLz_.cjs +29 -0
  469. package/dist/visually-hidden-yDJ517KZ.js +18 -0
  470. package/dist/wait-for-3n85JcCU.d.cts +15 -0
  471. package/dist/wait-for-3n85JcCU.d.ts +15 -0
  472. package/dist/wait-for-CI5Ye-Lo.js +69 -0
  473. package/dist/wait-for-Db73VpZQ.cjs +86 -0
  474. package/dist/warning-CrzBpWT1.js +19 -0
  475. package/dist/warning-HAmFXLHm.cjs +42 -0
  476. package/package.json +349 -6
@@ -0,0 +1,1173 @@
1
+ //#region src/common/hotkeys/modifier.ts
2
+ const MODIFIER_NORMALIZATION_MAP = /* @__PURE__ */ new Map([
3
+ ["ctrl", "Control"],
4
+ ["control", "Control"],
5
+ ["alt", "Alt"],
6
+ ["option", "Alt"],
7
+ ["shift", "Shift"],
8
+ ["meta", "Meta"],
9
+ ["cmd", "Meta"],
10
+ ["command", "Meta"],
11
+ ["win", "Meta"],
12
+ ["windows", "Meta"]
13
+ ]);
14
+ const normalizeModifier = (key) => MODIFIER_NORMALIZATION_MAP.get(key.toLowerCase()) ?? key;
15
+ const MODIFIER_SET = /* @__PURE__ */ new Set([
16
+ "control",
17
+ "ctrl",
18
+ "alt",
19
+ "option",
20
+ "shift",
21
+ "meta",
22
+ "cmd",
23
+ "command",
24
+ "win",
25
+ "windows"
26
+ ]);
27
+ const isModifierSet = (key) => MODIFIER_SET.has(key.toLowerCase());
28
+ function resolveControlOrMeta(key, platform) {
29
+ return isModKey(key.toLowerCase()) ? platform === "mac" ? "Meta" : "Control" : key;
30
+ }
31
+ function isModKey(key) {
32
+ return key.toLowerCase() === "mod" || key.toLowerCase() === "controlormeta";
33
+ }
34
+ //#endregion
35
+ //#region src/common/hotkeys/normalize.ts
36
+ function normalizeKey(eventKey) {
37
+ if (eventKey.length === 1 && SINGLE_LETTER_REGEX.test(eventKey)) return eventKey.toUpperCase();
38
+ const lower = eventKey.toLowerCase();
39
+ const normalized = KEY_NORMALIZATION_MAP.get(lower);
40
+ if (normalized !== void 0) return normalized;
41
+ if (FUNCTION_KEY_REGEX$1.test(lower)) return lower.toUpperCase();
42
+ return eventKey;
43
+ }
44
+ const SINGLE_LETTER_REGEX = /[a-z]/i;
45
+ const FUNCTION_KEY_REGEX$1 = /^f([1-9]|1[0-9])$/;
46
+ const KEY_NORMALIZATION_MAP = /* @__PURE__ */ new Map([
47
+ ["backspace", "Backspace"],
48
+ ["tab", "Tab"],
49
+ ["clear", "Clear"],
50
+ ["enter", "Enter"],
51
+ ["return", "Enter"],
52
+ ["esc", "Escape"],
53
+ ["escape", "Escape"],
54
+ ["space", " "],
55
+ ["spacebar", " "],
56
+ ["up", "ArrowUp"],
57
+ ["arrowup", "ArrowUp"],
58
+ ["down", "ArrowDown"],
59
+ ["arrowdown", "ArrowDown"],
60
+ ["left", "ArrowLeft"],
61
+ ["arrowleft", "ArrowLeft"],
62
+ ["right", "ArrowRight"],
63
+ ["arrowright", "ArrowRight"],
64
+ ["pageup", "PageUp"],
65
+ ["pgup", "PageUp"],
66
+ ["pagedown", "PageDown"],
67
+ ["pgdn", "PageDown"],
68
+ ["home", "Home"],
69
+ ["end", "End"],
70
+ ["del", "Delete"],
71
+ ["delete", "Delete"],
72
+ ["ins", "Insert"],
73
+ ["insert", "Insert"]
74
+ ]);
75
+ //#endregion
76
+ //#region src/common/hotkeys/key-to-code.ts
77
+ function keyToCode(key) {
78
+ if (UPPERCASE_LETTER_REGEX.test(key)) return `Key${key}`;
79
+ if (SINGLE_DIGIT_REGEX.test(key)) return `Digit${key}`;
80
+ if (FUNCTION_KEY_WITH_F20_REGEX.test(key)) return key;
81
+ if (DIRECT_KEY_CODES.has(key)) return key;
82
+ return SPECIAL_KEY_CODES.get(key);
83
+ }
84
+ const UPPERCASE_LETTER_REGEX = /^[A-Z]$/;
85
+ const SINGLE_DIGIT_REGEX = /^[0-9]$/;
86
+ const FUNCTION_KEY_WITH_F20_REGEX = /^F([1-9]|1[0-9]|20)$/;
87
+ const DIRECT_KEY_CODES = /* @__PURE__ */ new Set([
88
+ "Enter",
89
+ "Tab",
90
+ "Backspace",
91
+ "Delete",
92
+ "Escape",
93
+ "ArrowUp",
94
+ "ArrowDown",
95
+ "ArrowLeft",
96
+ "ArrowRight",
97
+ "Home",
98
+ "End",
99
+ "PageUp",
100
+ "PageDown",
101
+ "Insert"
102
+ ]);
103
+ const SPECIAL_KEY_CODES = /* @__PURE__ */ new Map([
104
+ [" ", "Space"],
105
+ ["-", "Minus"],
106
+ ["=", "Equal"],
107
+ ["+", "Equal"],
108
+ ["[", "BracketLeft"],
109
+ ["]", "BracketRight"],
110
+ [";", "Semicolon"],
111
+ ["'", "Quote"],
112
+ ["`", "Backquote"],
113
+ ["\\", "Backslash"],
114
+ [",", "Comma"],
115
+ [".", "Period"],
116
+ ["/", "Slash"]
117
+ ]);
118
+ //#endregion
119
+ //#region src/common/hotkeys/utils.ts
120
+ const typeOf = (value) => Object.prototype.toString.call(value).slice(8, -1);
121
+ const isDocument = (value) => typeOf(value) === "Document";
122
+ function getDoc(root) {
123
+ return isDocument(root) ? root : root.ownerDocument || document;
124
+ }
125
+ function getWin(root) {
126
+ return getDoc(root).defaultView || window;
127
+ }
128
+ const FORM_TAGS = /* @__PURE__ */ new Set([
129
+ "input",
130
+ "textarea",
131
+ "select"
132
+ ]);
133
+ const isFormTag = (tagName) => FORM_TAGS.has(tagName);
134
+ const isHTMLElement = (target) => {
135
+ return target !== null && typeof target === "object" && "localName" in target && "nodeType" in target && target.nodeType === 1;
136
+ };
137
+ const getEventTarget = (event) => {
138
+ const target = event.composedPath?.()[0] || event.target;
139
+ return isHTMLElement(target) ? target : null;
140
+ };
141
+ const isContentEditableElement = (target) => {
142
+ if (!target) return false;
143
+ return isHTMLElement(target) && target.isContentEditable;
144
+ };
145
+ const NA_REGEX = /Mac|iPod|iPhone|iPad/;
146
+ const isMac = () => typeof navigator !== "undefined" && NA_REGEX.test(navigator.userAgent);
147
+ const getPlatform = () => isMac() ? "mac" : "windows";
148
+ const toArray = (value) => {
149
+ if (Array.isArray(value)) return value.filter((item) => item !== void 0);
150
+ return value !== void 0 ? [value] : [];
151
+ };
152
+ const UNICODE_LETTER = /^\p{L}$/u;
153
+ const UNICODE_NUMBER = /^\p{N}$/u;
154
+ const isSymbolKey = (key) => {
155
+ if (key.length !== 1) return false;
156
+ if (UNICODE_LETTER.test(key) || UNICODE_NUMBER.test(key)) return false;
157
+ return true;
158
+ };
159
+ //#endregion
160
+ //#region src/common/hotkeys/parser.ts
161
+ function parseHotkeyString(hotkey, platform) {
162
+ const parts = hotkey.split("+");
163
+ const modifiers = [];
164
+ let keyIndex = parts.length - 1;
165
+ for (let i = 0; i < parts.length - 1; i++) {
166
+ const part = parts[i].trim().toLowerCase();
167
+ const resolved = resolveControlOrMeta(part, platform).toLowerCase();
168
+ if (part === "") {
169
+ keyIndex = i;
170
+ break;
171
+ }
172
+ if (isModifierSet(resolved) || resolved === "mod" || resolved === "controlormeta") modifiers.push(parts[i].trim());
173
+ else {
174
+ keyIndex = i;
175
+ break;
176
+ }
177
+ }
178
+ return {
179
+ modifiers,
180
+ key: parts.slice(keyIndex).join("+").trim()
181
+ };
182
+ }
183
+ function parseHotkey(hotkey, platform) {
184
+ if (hotkey.includes(">")) {
185
+ const sequenceParts = hotkey.split(">");
186
+ const sequenceSteps = [];
187
+ const allKeys = [];
188
+ const allCodes = [];
189
+ for (const rawPart of sequenceParts) {
190
+ const part = rawPart.trim();
191
+ if (part.includes("+")) {
192
+ const { modifiers, key } = parseHotkeyString(part, platform);
193
+ const step = {
194
+ key: normalizeKey(key),
195
+ alt: false,
196
+ ctrl: false,
197
+ meta: false,
198
+ shift: false
199
+ };
200
+ for (const modifier of modifiers) switch (normalizeModifier(resolveControlOrMeta(modifier, platform))) {
201
+ case "Alt":
202
+ step.alt = true;
203
+ break;
204
+ case "Control":
205
+ step.ctrl = true;
206
+ break;
207
+ case "Meta":
208
+ step.meta = true;
209
+ break;
210
+ case "Shift":
211
+ step.shift = true;
212
+ break;
213
+ }
214
+ sequenceSteps.push(step);
215
+ allKeys.push(step.key);
216
+ const code = keyToCode(step.key);
217
+ if (code != null) allCodes.push(code);
218
+ } else {
219
+ const key = normalizeKey(part);
220
+ sequenceSteps.push({
221
+ key,
222
+ alt: false,
223
+ ctrl: false,
224
+ meta: false,
225
+ shift: false
226
+ });
227
+ allKeys.push(key);
228
+ const code = keyToCode(key);
229
+ if (code != null) allCodes.push(code);
230
+ }
231
+ }
232
+ return {
233
+ keys: allKeys,
234
+ codes: allCodes.length > 0 ? allCodes : void 0,
235
+ alt: false,
236
+ ctrl: false,
237
+ meta: false,
238
+ shift: false,
239
+ isSequence: true,
240
+ sequenceSteps
241
+ };
242
+ }
243
+ const { modifiers, key } = parseHotkeyString(hotkey, platform);
244
+ const result = {
245
+ keys: [],
246
+ codes: [],
247
+ alt: false,
248
+ ctrl: false,
249
+ meta: false,
250
+ shift: false,
251
+ isSequence: false
252
+ };
253
+ for (const modifier of modifiers) switch (normalizeModifier(resolveControlOrMeta(modifier, platform))) {
254
+ case "Alt":
255
+ result.alt = true;
256
+ break;
257
+ case "Control":
258
+ result.ctrl = true;
259
+ break;
260
+ case "Meta":
261
+ result.meta = true;
262
+ break;
263
+ case "Shift":
264
+ result.shift = true;
265
+ break;
266
+ }
267
+ if (key && key !== ">") {
268
+ const normalizedKey = normalizeKey(key);
269
+ result.keys.push(normalizedKey);
270
+ const code = keyToCode(normalizedKey);
271
+ if (code != null) result.codes?.push(code);
272
+ }
273
+ return result;
274
+ }
275
+ function toMatchableHotkeySteps(parsed) {
276
+ return parsed.keys.map((key, index) => ({
277
+ key,
278
+ code: parsed.codes?.[index],
279
+ alt: parsed.alt,
280
+ ctrl: parsed.ctrl,
281
+ meta: parsed.meta,
282
+ shift: parsed.shift
283
+ }));
284
+ }
285
+ function matchesHotkeyStep(step, event) {
286
+ const eventKey = normalizeKey(event.key);
287
+ const keyMatches = step.key === eventKey;
288
+ if (isSymbolKey(step.key)) {
289
+ const modifierHeld = event.altKey || event.metaKey || event.ctrlKey;
290
+ if (!keyMatches && !(modifierHeld && step.code && step.code === event.code)) return false;
291
+ const isRealAltGr = (event.getModifierState?.("AltGraph") ?? false) && event.ctrlKey;
292
+ const effectiveCtrl = isRealAltGr ? false : event.ctrlKey;
293
+ const effectiveAlt = isRealAltGr ? false : event.altKey;
294
+ if ((step.ctrl || false) !== effectiveCtrl) return false;
295
+ if ((step.meta || false) !== event.metaKey) return false;
296
+ if (step.shift && !event.shiftKey) return false;
297
+ if (step.alt && !effectiveAlt) return false;
298
+ return true;
299
+ }
300
+ if ((event.getModifierState?.("AltGraph") ?? false) && event.ctrlKey) return false;
301
+ if ((step.alt || false) !== event.altKey) return false;
302
+ if ((step.ctrl || false) !== event.ctrlKey) return false;
303
+ if ((step.meta || false) !== event.metaKey) return false;
304
+ if ((step.shift || false) !== event.shiftKey) return false;
305
+ return keyMatches || !!step.code && step.code === event.code;
306
+ }
307
+ function matchesHotkey(parsed, event) {
308
+ return toMatchableHotkeySteps(parsed).some((step) => matchesHotkeyStep(step, event));
309
+ }
310
+ function shouldTrigger(event, options) {
311
+ const target = getEventTarget(event);
312
+ if (!target) return true;
313
+ const tagName = target.localName;
314
+ const isContentEditable = isContentEditableElement(target);
315
+ if (isFormTag(tagName)) {
316
+ if (options.enableOnFormTags === false || options.enableOnFormTags === void 0) return false;
317
+ if (Array.isArray(options.enableOnFormTags)) {
318
+ if (!options.enableOnFormTags.includes(tagName)) return false;
319
+ }
320
+ }
321
+ if (isContentEditable && !options.enableOnContentEditable) return false;
322
+ return true;
323
+ }
324
+ function isHotKey(hotkey, event, options = {}, platform) {
325
+ if (event.key === "Dead") return false;
326
+ if (!shouldTrigger(event, options)) return false;
327
+ const resolved = platform ?? getPlatform();
328
+ return toArray(hotkey).some((h) => {
329
+ return matchesHotkey(parseHotkey(h, resolved), event);
330
+ });
331
+ }
332
+ function isHotkeyEqual(a, b, platform) {
333
+ const resolved = platform ?? getPlatform();
334
+ const pa = parseHotkey(a, resolved);
335
+ const pb = parseHotkey(b, resolved);
336
+ if (pa.isSequence !== pb.isSequence) return false;
337
+ if (pa.isSequence && pb.isSequence) {
338
+ const stepsA = pa.sequenceSteps;
339
+ const stepsB = pb.sequenceSteps;
340
+ if (!stepsA || !stepsB || stepsA.length !== stepsB.length) return false;
341
+ return stepsA.every((stepA, i) => {
342
+ const stepB = stepsB[i];
343
+ return stepA.key === stepB.key && (stepA.ctrl ?? false) === (stepB.ctrl ?? false) && (stepA.alt ?? false) === (stepB.alt ?? false) && (stepA.shift ?? false) === (stepB.shift ?? false) && (stepA.meta ?? false) === (stepB.meta ?? false);
344
+ });
345
+ }
346
+ return pa.ctrl === pb.ctrl && pa.alt === pb.alt && pa.shift === pb.shift && pa.meta === pb.meta && pa.keys.length === pb.keys.length && pa.keys.every((k, i) => k === pb.keys[i]);
347
+ }
348
+ function getHotkeyPriority(parsed) {
349
+ let priority = 0;
350
+ if (parsed.isSequence) priority += 1e3;
351
+ if (parsed.alt) priority += 100;
352
+ if (parsed.ctrl) priority += 100;
353
+ if (parsed.meta) priority += 100;
354
+ if (parsed.shift) priority += 100;
355
+ priority += parsed.keys.length * 10;
356
+ return priority;
357
+ }
358
+ //#endregion
359
+ //#region src/common/hotkeys/store.ts
360
+ const defaultOptions = {
361
+ preventDefault: true,
362
+ stopPropagation: false,
363
+ enableOnFormTags: false,
364
+ enableOnContentEditable: false,
365
+ capture: true
366
+ };
367
+ const DEFAULT_SCOPES = ["*"];
368
+ function hasNonShiftModifier(parsed) {
369
+ return !!(parsed.ctrl || parsed.meta || parsed.alt);
370
+ }
371
+ var HotkeyStore = class {
372
+ state;
373
+ target;
374
+ defaultCommandOptions = { ...defaultOptions };
375
+ commandOptionOverrides = /* @__PURE__ */ new Map();
376
+ sequenceTimeoutMs = 1e3;
377
+ conflictBehavior = "warn";
378
+ sequenceStates = /* @__PURE__ */ new Map();
379
+ registrationOrder = 0;
380
+ platform = "mac";
381
+ listeners = {};
382
+ firedCommands = /* @__PURE__ */ new Set();
383
+ hasKeyupCommands = false;
384
+ subscribers = /* @__PURE__ */ new Set();
385
+ constructor(options) {
386
+ const defaultScopes = options?.activeScopes ? toArray(options.activeScopes) : DEFAULT_SCOPES;
387
+ this.state = {
388
+ pressedKeys: /* @__PURE__ */ new Set(),
389
+ pressedCodes: /* @__PURE__ */ new Set(),
390
+ commands: /* @__PURE__ */ new Map(),
391
+ listening: false,
392
+ activeScopes: new Set(defaultScopes)
393
+ };
394
+ if (options?.sequenceTimeoutMs !== void 0) this.sequenceTimeoutMs = options.sequenceTimeoutMs;
395
+ if (options?.conflictBehavior !== void 0) this.conflictBehavior = options.conflictBehavior;
396
+ this.applyDefaultOptions(options?.defaultOptions);
397
+ }
398
+ init(options) {
399
+ if (!options.target) throw new Error("target is required for initialization");
400
+ this.applyDefaultOptions(options.defaultOptions);
401
+ this.target = options.target;
402
+ this.platform = getPlatform();
403
+ this.updateParsedHotkeys();
404
+ this.updateListeners();
405
+ return this;
406
+ }
407
+ destroy() {
408
+ this.stopListening();
409
+ this.clear();
410
+ this.subscribers.clear();
411
+ this.sequenceStates.clear();
412
+ this.firedCommands.clear();
413
+ this.target = void 0;
414
+ this.registrationOrder = 0;
415
+ }
416
+ setScope(scope) {
417
+ const scopes = toArray(scope);
418
+ this.state.activeScopes = new Set(scopes);
419
+ this.clearAllSequences();
420
+ this.notifySubscribers();
421
+ return this;
422
+ }
423
+ addScope(scope) {
424
+ this.state.activeScopes.add(scope);
425
+ this.notifySubscribers();
426
+ return this;
427
+ }
428
+ removeScope(scope) {
429
+ this.state.activeScopes.delete(scope);
430
+ this.notifySubscribers();
431
+ return this;
432
+ }
433
+ getActiveScopes() {
434
+ return [...this.state.activeScopes];
435
+ }
436
+ getState() {
437
+ return this.state;
438
+ }
439
+ toggleScope(scope) {
440
+ if (this.state.activeScopes.has(scope)) this.state.activeScopes.delete(scope);
441
+ else this.state.activeScopes.add(scope);
442
+ this.notifySubscribers();
443
+ return this;
444
+ }
445
+ subscribe(selector, callback) {
446
+ const subscriber = {
447
+ selector,
448
+ callback,
449
+ lastValue: selector(this.state)
450
+ };
451
+ this.subscribers.add(subscriber);
452
+ return () => {
453
+ this.subscribers.delete(subscriber);
454
+ };
455
+ }
456
+ register(commands) {
457
+ const commandArray = toArray(commands);
458
+ for (const command of commandArray) {
459
+ const scopes = command.scopes ? toArray(command.scopes) : DEFAULT_SCOPES;
460
+ const parsed = parseHotkey(command.hotkey, this.platform);
461
+ const priority = getHotkeyPriority(parsed);
462
+ const resolvedOptions = {
463
+ ...this.defaultCommandOptions,
464
+ ...command.options
465
+ };
466
+ if (command.options?.enableOnFormTags === void 0 && hasNonShiftModifier(parsed)) resolvedOptions.enableOnFormTags = true;
467
+ this.detectConflicts(command.id, command.hotkey);
468
+ this.state.commands.set(command.id, {
469
+ id: command.id,
470
+ hotkey: command.hotkey,
471
+ action: command.action,
472
+ options: resolvedOptions,
473
+ enabled: command.enabled ?? true,
474
+ scopes,
475
+ keywords: command.keywords ?? [],
476
+ _parsed: parsed,
477
+ _priority: priority,
478
+ _registrationOrder: this.registrationOrder++,
479
+ ...command.label !== void 0 && { label: command.label },
480
+ ...command.description !== void 0 && { description: command.description },
481
+ ...command.category !== void 0 && { category: command.category }
482
+ });
483
+ this.commandOptionOverrides.set(command.id, command.options);
484
+ }
485
+ this.refreshKeyupFlag();
486
+ this.updateListeners();
487
+ this.notifySubscribers();
488
+ return this;
489
+ }
490
+ unregister(id) {
491
+ const command = this.state.commands.get(id);
492
+ if (command) {
493
+ this.state.commands.delete(id);
494
+ this.commandOptionOverrides.delete(id);
495
+ this.firedCommands.delete(id);
496
+ this.resetSequence(command.hotkey);
497
+ this.refreshKeyupFlag();
498
+ this.updateListeners();
499
+ this.notifySubscribers();
500
+ }
501
+ return this;
502
+ }
503
+ enable(id) {
504
+ const command = this.state.commands.get(id);
505
+ if (command) {
506
+ command.enabled = true;
507
+ this.updateListeners();
508
+ this.notifySubscribers();
509
+ }
510
+ return this;
511
+ }
512
+ disable(id) {
513
+ const command = this.state.commands.get(id);
514
+ if (command) {
515
+ command.enabled = false;
516
+ this.updateListeners();
517
+ this.notifySubscribers();
518
+ }
519
+ return this;
520
+ }
521
+ setEnabled(id, enabled) {
522
+ const command = this.state.commands.get(id);
523
+ if (command) {
524
+ command.enabled = enabled;
525
+ this.updateListeners();
526
+ this.notifySubscribers();
527
+ }
528
+ return this;
529
+ }
530
+ clear() {
531
+ this.clearAllSequences();
532
+ this.state.commands.clear();
533
+ this.commandOptionOverrides.clear();
534
+ this.state.pressedKeys.clear();
535
+ this.state.pressedCodes.clear();
536
+ this.firedCommands.clear();
537
+ this.hasKeyupCommands = false;
538
+ this.updateListeners();
539
+ this.notifySubscribers();
540
+ return this;
541
+ }
542
+ isPressed(hotkey) {
543
+ const parsed = parseHotkey(hotkey, this.platform);
544
+ if (parsed.isSequence) return false;
545
+ const logicalKeysMatch = parsed.keys.every((k) => this.state.pressedKeys.has(k));
546
+ const codes = parsed.codes;
547
+ const codesAligned = codes && codes.length > 0 && codes.length === parsed.keys.length && codes.every((c) => this.state.pressedCodes.has(c));
548
+ return (logicalKeysMatch || !!codesAligned) && this.modifiersMatchPressed(parsed);
549
+ }
550
+ getCurrentlyPressed() {
551
+ return [...this.state.pressedKeys];
552
+ }
553
+ getPressedCodes() {
554
+ return [...this.state.pressedCodes];
555
+ }
556
+ modifiersMatchPressed(parsed) {
557
+ const pk = this.state.pressedKeys;
558
+ const has = (name) => pk.has(name);
559
+ if (parsed.keys.some(isSymbolKey)) {
560
+ if (parsed.ctrl !== has("Control")) return false;
561
+ if (parsed.meta !== has("Meta")) return false;
562
+ if (parsed.shift && !has("Shift")) return false;
563
+ if (parsed.alt && !has("Alt")) return false;
564
+ return true;
565
+ }
566
+ if (parsed.alt !== has("Alt")) return false;
567
+ if (parsed.ctrl !== has("Control")) return false;
568
+ if (parsed.meta !== has("Meta")) return false;
569
+ if (parsed.shift !== has("Shift")) return false;
570
+ return true;
571
+ }
572
+ applyDefaultOptions(options) {
573
+ if (!options) return;
574
+ this.defaultCommandOptions = {
575
+ ...defaultOptions,
576
+ ...options
577
+ };
578
+ for (const [id, command] of this.state.commands) command.options = {
579
+ ...this.defaultCommandOptions,
580
+ ...this.commandOptionOverrides.get(id)
581
+ };
582
+ }
583
+ updateParsedHotkeys() {
584
+ for (const command of this.state.commands.values()) if (command.hotkey.split("+").some((part) => isModKey(part.trim()))) {
585
+ command._parsed = parseHotkey(command.hotkey, this.platform);
586
+ command._priority = getHotkeyPriority(command._parsed);
587
+ }
588
+ }
589
+ refreshKeyupFlag() {
590
+ this.hasKeyupCommands = false;
591
+ for (const command of this.state.commands.values()) if (command.options.eventType === "keyup") {
592
+ this.hasKeyupCommands = true;
593
+ break;
594
+ }
595
+ }
596
+ detectConflicts(newId, newHotkey) {
597
+ if (this.conflictBehavior === "allow") return;
598
+ const toDelete = [];
599
+ for (const [existingId, existing] of this.state.commands) {
600
+ if (existingId === newId) continue;
601
+ if (existing.hotkey !== newHotkey) continue;
602
+ const message = `[hotkeys] Conflict: "${newHotkey}" is already registered by command "${existingId}". Command "${newId}" will also respond to this hotkey.`;
603
+ switch (this.conflictBehavior) {
604
+ case "error": throw new Error(message);
605
+ case "replace":
606
+ toDelete.push(existingId);
607
+ break;
608
+ default:
609
+ console.warn(message);
610
+ break;
611
+ }
612
+ }
613
+ for (const id of toDelete) {
614
+ this.state.commands.delete(id);
615
+ this.commandOptionOverrides.delete(id);
616
+ }
617
+ }
618
+ updateListeners() {
619
+ if (!this.target) return;
620
+ if (this.state.commands.size > 0) this.startListening();
621
+ else this.stopListening();
622
+ }
623
+ startListening() {
624
+ if (!this.target || this.state.listening) return;
625
+ const win = getWin(this.target);
626
+ const phases = this.getListenerPhases();
627
+ if (phases.capture) {
628
+ const record = {
629
+ keyDown: ((e) => this.executeMatchingCommands(e, true, "keydown")),
630
+ keyUp: ((e) => this.handleKeyUp(e, true)),
631
+ blur: (() => this.handleBlur())
632
+ };
633
+ this.target.addEventListener("keydown", record.keyDown, true);
634
+ this.target.addEventListener("keyup", record.keyUp, true);
635
+ win.addEventListener("blur", record.blur);
636
+ win.addEventListener("contextmenu", record.blur);
637
+ this.listeners.capture = record;
638
+ }
639
+ if (phases.bubble) {
640
+ const record = {
641
+ keyDown: ((e) => this.executeMatchingCommands(e, false, "keydown")),
642
+ keyUp: ((e) => this.handleKeyUp(e, false)),
643
+ blur: (() => this.handleBlur())
644
+ };
645
+ this.target.addEventListener("keydown", record.keyDown, false);
646
+ this.target.addEventListener("keyup", record.keyUp, false);
647
+ win.addEventListener("blur", record.blur);
648
+ win.addEventListener("contextmenu", record.blur);
649
+ this.listeners.bubble = record;
650
+ }
651
+ this.state.listening = true;
652
+ }
653
+ stopListening() {
654
+ if (!this.target || !this.state.listening) return;
655
+ const win = getWin(this.target);
656
+ if (this.listeners.capture) {
657
+ const r = this.listeners.capture;
658
+ if (r.keyDown) this.target.removeEventListener("keydown", r.keyDown, true);
659
+ if (r.keyUp) this.target.removeEventListener("keyup", r.keyUp, true);
660
+ if (r.blur) {
661
+ win.removeEventListener("blur", r.blur);
662
+ win.removeEventListener("contextmenu", r.blur);
663
+ }
664
+ }
665
+ if (this.listeners.bubble) {
666
+ const r = this.listeners.bubble;
667
+ if (r.keyDown) this.target.removeEventListener("keydown", r.keyDown, false);
668
+ if (r.keyUp) this.target.removeEventListener("keyup", r.keyUp, false);
669
+ if (r.blur) {
670
+ win.removeEventListener("blur", r.blur);
671
+ win.removeEventListener("contextmenu", r.blur);
672
+ }
673
+ }
674
+ this.listeners = {};
675
+ this.state.listening = false;
676
+ }
677
+ getListenerPhases() {
678
+ let capture = false;
679
+ let bubble = false;
680
+ for (const command of this.state.commands.values()) {
681
+ if (!(typeof command.enabled === "function" ? command.enabled() : command.enabled)) continue;
682
+ if (command.options.capture !== false) capture = true;
683
+ else bubble = true;
684
+ if (capture && bubble) break;
685
+ }
686
+ return {
687
+ capture,
688
+ bubble
689
+ };
690
+ }
691
+ handleKeyUp(event, capture) {
692
+ if (this.hasKeyupCommands) this.executeMatchingCommands(event, capture, "keyup");
693
+ const eventKey = normalizeKey(event.key);
694
+ this.state.pressedKeys.delete(eventKey);
695
+ if (event.code) this.state.pressedCodes.delete(event.code);
696
+ if (this.firedCommands.size > 0) this.firedCommands.clear();
697
+ this.notifySubscribers();
698
+ }
699
+ handleBlur() {
700
+ this.state.pressedKeys.clear();
701
+ this.state.pressedCodes.clear();
702
+ this.firedCommands.clear();
703
+ this.clearAllSequences();
704
+ this.notifySubscribers();
705
+ }
706
+ executeMatchingCommands(event, capture, eventType) {
707
+ if (event.key === "Dead") return;
708
+ const eventKey = normalizeKey(event.key);
709
+ if (eventType === "keydown") {
710
+ this.state.pressedKeys.add(eventKey);
711
+ if (event.code) this.state.pressedCodes.add(event.code);
712
+ this.notifySubscribers();
713
+ }
714
+ const matches = [];
715
+ for (const [_id, command] of this.state.commands) {
716
+ if (!(typeof command.enabled === "function" ? command.enabled() : command.enabled)) continue;
717
+ if (command.options.capture !== false !== capture) continue;
718
+ if ((command.options.eventType ?? "keydown") !== eventType) continue;
719
+ if (!command.scopes.some((scope) => scope === "*" || this.state.activeScopes.has(scope))) continue;
720
+ if (!shouldTrigger(event, command.options)) continue;
721
+ if (command.options.requireReset && this.firedCommands.has(command.id)) continue;
722
+ if (command._parsed.isSequence ? this.handleSequence(command.hotkey, command._parsed, eventKey, event) : matchesHotkey(command._parsed, event)) matches.push({
723
+ command,
724
+ priority: command._priority
725
+ });
726
+ }
727
+ if (matches.length === 0) return;
728
+ matches.sort((a, b) => {
729
+ if (b.priority !== a.priority) return b.priority - a.priority;
730
+ return a.command._registrationOrder - b.command._registrationOrder;
731
+ });
732
+ const highestPriority = matches[0].priority;
733
+ const toExecute = matches.filter((m) => m.priority === highestPriority);
734
+ for (const { command } of toExecute) {
735
+ if (command.options.preventDefault) event.preventDefault();
736
+ if (command.options.stopPropagation) event.stopPropagation();
737
+ if (command.options.requireReset) this.firedCommands.add(command.id);
738
+ try {
739
+ command.action(event);
740
+ } catch (error) {
741
+ console.error(`Error executing hotkey command "${command.id}":`, error);
742
+ }
743
+ }
744
+ }
745
+ handleSequence(hotkeyString, parsed, eventKey, event) {
746
+ if (!this.target) {
747
+ console.warn("Cannot handle sequence: target is not initialized");
748
+ return false;
749
+ }
750
+ const win = getWin(this.target);
751
+ let state = this.sequenceStates.get(hotkeyString);
752
+ if (!state) {
753
+ state = { recordedKeys: [] };
754
+ this.sequenceStates.set(hotkeyString, state);
755
+ }
756
+ if (state.timeoutId) clearTimeout(state.timeoutId);
757
+ const currentStepIndex = state.recordedKeys.length;
758
+ const expectedStep = parsed.sequenceSteps?.[currentStepIndex];
759
+ if (expectedStep) if (matchesHotkeyStep({
760
+ key: expectedStep.key,
761
+ code: parsed.codes?.[currentStepIndex],
762
+ alt: expectedStep.alt,
763
+ ctrl: expectedStep.ctrl,
764
+ meta: expectedStep.meta,
765
+ shift: expectedStep.shift
766
+ }, event)) {
767
+ state.recordedKeys.push(eventKey);
768
+ if (state.recordedKeys.length === parsed.sequenceSteps.length) {
769
+ this.resetSequence(hotkeyString);
770
+ return true;
771
+ }
772
+ state.timeoutId = win.setTimeout(() => {
773
+ this.resetSequence(hotkeyString);
774
+ }, this.sequenceTimeoutMs);
775
+ } else this.resetSequence(hotkeyString);
776
+ else this.resetSequence(hotkeyString);
777
+ return false;
778
+ }
779
+ clearAllSequences() {
780
+ for (const state of this.sequenceStates.values()) if (typeof state.timeoutId === "number") clearTimeout(state.timeoutId);
781
+ this.sequenceStates.clear();
782
+ }
783
+ resetSequence(hotkey) {
784
+ const state = this.sequenceStates.get(hotkey);
785
+ if (state && typeof state.timeoutId === "number") clearTimeout(state.timeoutId);
786
+ this.sequenceStates.delete(hotkey);
787
+ }
788
+ notifySubscribers() {
789
+ for (const subscriber of this.subscribers) try {
790
+ const newValue = subscriber.selector(this.state);
791
+ if (newValue !== subscriber.lastValue) {
792
+ subscriber.lastValue = newValue;
793
+ subscriber.callback(newValue);
794
+ }
795
+ } catch (error) {
796
+ console.error("Error in hotkey store subscriber:", error);
797
+ }
798
+ }
799
+ };
800
+ function createHotkeyStore(options) {
801
+ const store = new HotkeyStore(options);
802
+ if (options?.target) store.init(options);
803
+ return store;
804
+ }
805
+ //#endregion
806
+ //#region src/common/hotkeys/format.ts
807
+ const PLATFORM_MODIFIERS = {
808
+ mac: {
809
+ Control: "⌃",
810
+ Alt: "⌥",
811
+ Shift: "⇧",
812
+ Meta: "⌘"
813
+ },
814
+ windows: {
815
+ Control: "Ctrl",
816
+ Alt: "Alt",
817
+ Shift: "Shift",
818
+ Meta: "Win"
819
+ },
820
+ linux: {
821
+ Control: "Ctrl",
822
+ Alt: "Alt",
823
+ Shift: "Shift",
824
+ Meta: "Super"
825
+ }
826
+ };
827
+ const KEY_SYMBOLS = /* @__PURE__ */ new Map([
828
+ ["ArrowUp", "↑"],
829
+ ["ArrowDown", "↓"],
830
+ ["ArrowLeft", "←"],
831
+ ["ArrowRight", "→"],
832
+ ["Backspace", "⌫"],
833
+ ["Delete", "⌦"],
834
+ ["Enter", "↵"],
835
+ ["Tab", "⇥"],
836
+ ["Escape", "Esc"],
837
+ ["Space", "␣"],
838
+ [" ", "␣"]
839
+ ]);
840
+ const KEY_NAMES = /* @__PURE__ */ new Map([
841
+ ["ArrowUp", "Up"],
842
+ ["ArrowDown", "Down"],
843
+ ["ArrowLeft", "Left"],
844
+ ["ArrowRight", "Right"],
845
+ ["Space", "Space"],
846
+ [" ", "Space"]
847
+ ]);
848
+ function formatHotkey(hotkey, options = {}) {
849
+ const { platform = "auto", style = "mixed", separator = " ", sequenceSeparator = " then ", useShortNames = true } = options;
850
+ const targetPlatform = platform === "auto" ? getPlatform() : platform;
851
+ if (hotkey.includes(">")) return hotkey.split(">").map((part) => formatSingleHotkey(part.trim(), targetPlatform, style, separator, useShortNames)).join(sequenceSeparator);
852
+ return formatSingleHotkey(hotkey, targetPlatform, style, separator, useShortNames);
853
+ }
854
+ function formatSingleHotkey(hotkey, platform, style, separator, useShortNames) {
855
+ if (!hotkey.trim()) return "";
856
+ const parsed = parseHotkey(hotkey, platform);
857
+ const modifiers = [];
858
+ if (parsed.ctrl) modifiers.push("Control");
859
+ if (parsed.alt) modifiers.push("Alt");
860
+ if (parsed.shift) modifiers.push("Shift");
861
+ if (parsed.meta) modifiers.push("Meta");
862
+ const keys = parsed.keys;
863
+ const platformModifiers = PLATFORM_MODIFIERS[platform];
864
+ const formattedModifiers = modifiers.map((modifier) => {
865
+ const mappedModifier = platformModifiers[modifier];
866
+ if (style === "symbols" && platform === "mac") return mappedModifier || modifier;
867
+ if (style === "text" || platform !== "mac") return useShortNames && modifier === "Control" ? "Ctrl" : mappedModifier || modifier;
868
+ return mappedModifier || modifier;
869
+ });
870
+ const formattedKeys = keys.map((key) => {
871
+ if (style === "symbols") return KEY_SYMBOLS.get(key) || key;
872
+ if (style === "text") return KEY_NAMES.get(key) || key;
873
+ return KEY_SYMBOLS.get(key) || KEY_NAMES.get(key) || key;
874
+ });
875
+ return [...formattedModifiers, ...formattedKeys].join(separator);
876
+ }
877
+ //#endregion
878
+ //#region src/common/hotkeys/recorder.ts
879
+ const MODIFIER_KEYS = /* @__PURE__ */ new Set([
880
+ "Control",
881
+ "Alt",
882
+ "Shift",
883
+ "Meta"
884
+ ]);
885
+ const DEFAULT_SEQUENCE_TIMEOUT = 1e3;
886
+ var HotkeyRecorder = class {
887
+ state = {
888
+ recording: false,
889
+ value: null
890
+ };
891
+ target;
892
+ options;
893
+ platform;
894
+ keyDownHandler;
895
+ keyUpHandler;
896
+ subscribers = /* @__PURE__ */ new Set();
897
+ steps = [];
898
+ sequenceTimerId;
899
+ constructor(options = {}) {
900
+ this.options = options;
901
+ this.platform = getPlatform();
902
+ }
903
+ init(target) {
904
+ this.target = target;
905
+ this.platform = getPlatform();
906
+ return this;
907
+ }
908
+ start() {
909
+ if (this.state.recording) return this;
910
+ const root = this.target;
911
+ if (!root) {
912
+ console.warn("HotkeyRecorder: target is not set. Call init() first.");
913
+ return this;
914
+ }
915
+ this.steps = [];
916
+ this.clearSequenceTimer();
917
+ this.setState({
918
+ recording: true,
919
+ value: this.state.value
920
+ });
921
+ this.attachListeners(root);
922
+ return this;
923
+ }
924
+ stop() {
925
+ if (!this.state.recording) return this;
926
+ this.finalize();
927
+ return this;
928
+ }
929
+ cancel() {
930
+ if (!this.state.recording) return this;
931
+ this.detachListeners();
932
+ this.clearSequenceTimer();
933
+ this.steps = [];
934
+ this.setState({
935
+ recording: false,
936
+ value: this.state.value
937
+ });
938
+ this.options.onCancel?.();
939
+ return this;
940
+ }
941
+ clear() {
942
+ this.detachListeners();
943
+ this.clearSequenceTimer();
944
+ this.steps = [];
945
+ this.setState({
946
+ recording: false,
947
+ value: null
948
+ });
949
+ this.options.onClear?.();
950
+ return this;
951
+ }
952
+ setOptions(options) {
953
+ this.options = {
954
+ ...this.options,
955
+ ...options
956
+ };
957
+ return this;
958
+ }
959
+ getState() {
960
+ return this.state;
961
+ }
962
+ subscribe(callback) {
963
+ this.subscribers.add(callback);
964
+ return () => {
965
+ this.subscribers.delete(callback);
966
+ };
967
+ }
968
+ destroy() {
969
+ this.detachListeners();
970
+ this.clearSequenceTimer();
971
+ this.subscribers.clear();
972
+ this.steps = [];
973
+ this.target = void 0;
974
+ }
975
+ setState(next) {
976
+ this.state = next;
977
+ for (const fn of this.subscribers) try {
978
+ fn(this.state);
979
+ } catch (error) {
980
+ console.error("Error in hotkey recorder subscriber:", error);
981
+ }
982
+ }
983
+ attachListeners(root) {
984
+ this.keyDownHandler = ((event) => {
985
+ this.handleKeyDown(event);
986
+ });
987
+ this.keyUpHandler = ((event) => {
988
+ event.preventDefault();
989
+ });
990
+ root.addEventListener("keydown", this.keyDownHandler, true);
991
+ root.addEventListener("keyup", this.keyUpHandler, true);
992
+ }
993
+ detachListeners() {
994
+ if (!this.target) return;
995
+ if (this.keyDownHandler) this.target.removeEventListener("keydown", this.keyDownHandler, true);
996
+ if (this.keyUpHandler) this.target.removeEventListener("keyup", this.keyUpHandler, true);
997
+ this.keyDownHandler = void 0;
998
+ this.keyUpHandler = void 0;
999
+ }
1000
+ handleKeyDown(event) {
1001
+ event.preventDefault();
1002
+ event.stopPropagation();
1003
+ const key = event.key;
1004
+ if (key === "Escape") {
1005
+ this.cancel();
1006
+ return;
1007
+ }
1008
+ if (key === "Backspace" || key === "Delete") {
1009
+ this.clear();
1010
+ return;
1011
+ }
1012
+ if (MODIFIER_KEYS.has(key)) return;
1013
+ if (key === "Dead") return;
1014
+ this.clearSequenceTimer();
1015
+ const parts = [];
1016
+ if (event.ctrlKey) parts.push("Control");
1017
+ if (event.altKey) parts.push("Alt");
1018
+ if (event.shiftKey) parts.push("Shift");
1019
+ if (event.metaKey) parts.push("Meta");
1020
+ const normalizedKey = normalizeKey(key);
1021
+ parts.push(normalizedKey);
1022
+ const chord = parts.join("+");
1023
+ this.steps.push(chord);
1024
+ const currentValue = this.buildRecordedHotkey();
1025
+ this.setState({
1026
+ recording: true,
1027
+ value: currentValue
1028
+ });
1029
+ const timeout = this.options.sequenceTimeoutMs ?? DEFAULT_SEQUENCE_TIMEOUT;
1030
+ this.sequenceTimerId = setTimeout(() => {
1031
+ this.finalize();
1032
+ }, timeout);
1033
+ }
1034
+ buildRecordedHotkey() {
1035
+ const value = this.steps.join(` > `);
1036
+ return {
1037
+ value,
1038
+ display: formatHotkey(value, {
1039
+ platform: this.platform,
1040
+ ...this.options.formatOptions
1041
+ })
1042
+ };
1043
+ }
1044
+ finalize() {
1045
+ this.detachListeners();
1046
+ this.clearSequenceTimer();
1047
+ const recorded = this.steps.length > 0 ? this.buildRecordedHotkey() : null;
1048
+ this.steps = [];
1049
+ this.setState({
1050
+ recording: false,
1051
+ value: recorded
1052
+ });
1053
+ if (recorded) this.options.onRecord?.(recorded);
1054
+ }
1055
+ clearSequenceTimer() {
1056
+ if (this.sequenceTimerId !== void 0) {
1057
+ clearTimeout(this.sequenceTimerId);
1058
+ this.sequenceTimerId = void 0;
1059
+ }
1060
+ }
1061
+ };
1062
+ function createHotkeyRecorder(options) {
1063
+ const recorder = new HotkeyRecorder(options);
1064
+ if (options?.target) recorder.init(options.target);
1065
+ return recorder;
1066
+ }
1067
+ //#endregion
1068
+ //#region src/common/hotkeys/validate.ts
1069
+ const KNOWN_SPECIAL_KEYS = /* @__PURE__ */ new Set([
1070
+ "Backspace",
1071
+ "Tab",
1072
+ "Clear",
1073
+ "Enter",
1074
+ "Escape",
1075
+ "ArrowUp",
1076
+ "ArrowDown",
1077
+ "ArrowLeft",
1078
+ "ArrowRight",
1079
+ "PageUp",
1080
+ "PageDown",
1081
+ "Home",
1082
+ "End",
1083
+ "Delete",
1084
+ "Insert",
1085
+ " "
1086
+ ]);
1087
+ const FUNCTION_KEY_REGEX = /^F([1-9]|1[0-9]|20)$/;
1088
+ function isKnownKey(key) {
1089
+ if (key.length === 1) return true;
1090
+ if (FUNCTION_KEY_REGEX.test(key)) return true;
1091
+ if (KNOWN_SPECIAL_KEYS.has(key)) return true;
1092
+ if (normalizeKey(key) !== key) return true;
1093
+ return false;
1094
+ }
1095
+ function validateHotkey(hotkey) {
1096
+ const errors = [];
1097
+ const warnings = [];
1098
+ if (!hotkey || !hotkey.trim()) {
1099
+ errors.push("Hotkey string is empty");
1100
+ return {
1101
+ valid: false,
1102
+ errors,
1103
+ warnings
1104
+ };
1105
+ }
1106
+ if (hotkey.includes(">")) {
1107
+ const steps = hotkey.split(">");
1108
+ for (let i = 0; i < steps.length; i++) {
1109
+ const step = steps[i].trim();
1110
+ if (!step) {
1111
+ errors.push(`Sequence step ${i + 1} is empty`);
1112
+ continue;
1113
+ }
1114
+ const stepResult = validateSingleHotkey(step);
1115
+ for (const err of stepResult.errors) errors.push(`Step ${i + 1}: ${err}`);
1116
+ for (const warn of stepResult.warnings) warnings.push(`Step ${i + 1}: ${warn}`);
1117
+ }
1118
+ } else {
1119
+ const result = validateSingleHotkey(hotkey);
1120
+ errors.push(...result.errors);
1121
+ warnings.push(...result.warnings);
1122
+ }
1123
+ return {
1124
+ valid: errors.length === 0,
1125
+ errors,
1126
+ warnings
1127
+ };
1128
+ }
1129
+ function validateSingleHotkey(hotkey) {
1130
+ const errors = [];
1131
+ const warnings = [];
1132
+ const parts = hotkey.split("+");
1133
+ if (parts.length === 0) {
1134
+ errors.push("Hotkey string is empty");
1135
+ return {
1136
+ errors,
1137
+ warnings
1138
+ };
1139
+ }
1140
+ const modifiers = [];
1141
+ let keyPart;
1142
+ for (let i = 0; i < parts.length; i++) {
1143
+ const part = parts[i].trim();
1144
+ if (i === parts.length - 1) if (isModifierSet(part) || part.toLowerCase() === "mod" || part.toLowerCase() === "controlormeta") {
1145
+ warnings.push(`"${hotkey}" contains only modifiers with no action key`);
1146
+ keyPart = part;
1147
+ } else keyPart = part;
1148
+ else if (!isModifierSet(part) && part.toLowerCase() !== "mod" && part.toLowerCase() !== "controlormeta") {
1149
+ if (part === "") {
1150
+ keyPart = "+";
1151
+ break;
1152
+ }
1153
+ errors.push(`"${part}" is not a recognized modifier`);
1154
+ } else {
1155
+ const lower = part.toLowerCase();
1156
+ if (modifiers.includes(lower)) warnings.push(`Duplicate modifier "${part}"`);
1157
+ modifiers.push(lower);
1158
+ }
1159
+ }
1160
+ if (keyPart !== void 0) {
1161
+ if (!isKnownKey(normalizeKey(keyPart)) && keyPart !== "+") warnings.push(`"${keyPart}" is not a commonly recognized key`);
1162
+ }
1163
+ return {
1164
+ errors,
1165
+ warnings
1166
+ };
1167
+ }
1168
+ function assertValidHotkey(hotkey) {
1169
+ const result = validateHotkey(hotkey);
1170
+ if (!result.valid) throw new Error(`Invalid hotkey "${hotkey}": ${result.errors.join(", ")}`);
1171
+ }
1172
+ //#endregion
1173
+ export { HotkeyRecorder, HotkeyStore, assertValidHotkey, createHotkeyRecorder, createHotkeyStore, formatHotkey, isHotKey, isHotkeyEqual, parseHotkey, validateHotkey };