quirk-ui 0.1.73 → 0.1.76

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 (296) hide show
  1. package/dist/AccordionItem.css.d.ts +13 -0
  2. package/dist/{CategoryFilters-CIWwf9VY.js → CategoryFilters-Dvx_tFs9.js} +1 -1
  3. package/dist/{CategoryFilters-CvmFCE3e.cjs → CategoryFilters-jaBdSByQ.cjs} +1 -1
  4. package/dist/CategoryFilters.css.d.ts +31 -0
  5. package/dist/FormField-BO1hKjUb.js +228 -0
  6. package/dist/FormField-wfYSN1Vd.cjs +1 -0
  7. package/dist/FormField.css +1 -0
  8. package/dist/FormField.css.d.ts +22 -0
  9. package/dist/HeroSubComponents.css.d.ts +30 -0
  10. package/dist/NavLink.css.d.ts +72 -0
  11. package/dist/core/components/Accordion/Accordion.test.cjs +1 -1
  12. package/dist/core/components/Accordion/Accordion.test.mjs +1 -1
  13. package/dist/core/components/Accordion/AccordionItem.test.cjs +1 -1
  14. package/dist/core/components/Accordion/AccordionItem.test.mjs +1 -1
  15. package/dist/core/components/Avatar/Avatar.test.cjs +1 -1
  16. package/dist/core/components/Avatar/Avatar.test.mjs +1 -1
  17. package/dist/core/components/Badge/Badge.test.cjs +1 -1
  18. package/dist/core/components/Badge/Badge.test.mjs +1 -1
  19. package/dist/core/components/Badge/index.cjs +1 -1
  20. package/dist/core/components/Badge/index.mjs +1 -1
  21. package/dist/core/components/Box/Box.test.cjs +1 -1
  22. package/dist/core/components/Box/Box.test.mjs +1 -1
  23. package/dist/core/components/Box/index.cjs +1 -1
  24. package/dist/core/components/Box/index.mjs +1 -1
  25. package/dist/core/components/Breadcrumbs/Breadcrumbs.test.cjs +1 -1
  26. package/dist/core/components/Breadcrumbs/Breadcrumbs.test.mjs +1 -1
  27. package/dist/core/components/Breadcrumbs/index.cjs +1 -1
  28. package/dist/core/components/Breadcrumbs/index.mjs +1 -1
  29. package/dist/core/components/Button/Button.test.cjs +1 -1
  30. package/dist/core/components/Button/Button.test.mjs +2 -2
  31. package/dist/core/components/Button/index.cjs +1 -1
  32. package/dist/core/components/Button/index.mjs +1 -1
  33. package/dist/core/components/ButtonGroup/ButtonGroup.test.cjs +1 -1
  34. package/dist/core/components/ButtonGroup/ButtonGroup.test.mjs +1 -1
  35. package/dist/core/components/Calendar/Calendar.test.cjs +1 -1
  36. package/dist/core/components/Calendar/Calendar.test.mjs +2 -2
  37. package/dist/core/components/Calendar/index.cjs +1 -1
  38. package/dist/core/components/Calendar/index.mjs +1 -1
  39. package/dist/core/components/Card/Card.test.cjs +1 -1
  40. package/dist/core/components/Card/Card.test.mjs +1 -1
  41. package/dist/core/components/Card/index.cjs +1 -1
  42. package/dist/core/components/Card/index.mjs +1 -1
  43. package/dist/core/components/Carousel/Carousel.test.cjs +1 -1
  44. package/dist/core/components/Carousel/Carousel.test.mjs +1 -1
  45. package/dist/core/components/Checkbox/Checkbox.test.cjs +1 -1
  46. package/dist/core/components/Checkbox/Checkbox.test.mjs +1 -1
  47. package/dist/core/components/Container/Container.test.cjs +1 -1
  48. package/dist/core/components/Container/Container.test.mjs +1 -1
  49. package/dist/core/components/Container/index.cjs +1 -1
  50. package/dist/core/components/Container/index.mjs +1 -1
  51. package/dist/core/components/DatePicker/DatePicker.test.cjs +1 -1
  52. package/dist/core/components/DatePicker/DatePicker.test.mjs +2 -2
  53. package/dist/core/components/DatePicker/index.cjs +1 -1
  54. package/dist/core/components/DatePicker/index.mjs +2 -2
  55. package/dist/core/components/Divider/Divider.test.cjs +1 -1
  56. package/dist/core/components/Divider/Divider.test.mjs +1 -1
  57. package/dist/core/components/Divider/index.cjs +1 -1
  58. package/dist/core/components/Divider/index.mjs +1 -1
  59. package/dist/core/components/Drawer/Drawer.test.cjs +1 -1
  60. package/dist/core/components/Drawer/Drawer.test.mjs +1 -1
  61. package/dist/core/components/Drawer/index.cjs +1 -1
  62. package/dist/core/components/Drawer/index.mjs +1 -1
  63. package/dist/core/components/Fieldset/Fieldset.test.cjs +1 -1
  64. package/dist/core/components/Fieldset/Fieldset.test.mjs +1 -1
  65. package/dist/core/components/Fieldset/index.cjs +1 -1
  66. package/dist/core/components/Fieldset/index.mjs +1 -1
  67. package/dist/core/components/FileUpload/FileUpload.test.cjs +1 -1
  68. package/dist/core/components/FileUpload/FileUpload.test.mjs +1 -1
  69. package/dist/core/components/FileUpload/index.cjs +1 -1
  70. package/dist/core/components/FileUpload/index.mjs +1 -1
  71. package/dist/core/components/FloatingActionButton/FloatingActionButton.test.cjs +1 -1
  72. package/dist/core/components/FloatingActionButton/FloatingActionButton.test.mjs +1 -1
  73. package/dist/core/components/FloatingActionButton/index.cjs +1 -1
  74. package/dist/core/components/FloatingActionButton/index.mjs +1 -1
  75. package/dist/core/components/Footer/Footer.test.cjs +1 -1
  76. package/dist/core/components/Footer/Footer.test.mjs +1 -1
  77. package/dist/core/components/Footer/index.cjs +1 -1
  78. package/dist/core/components/Footer/index.mjs +2 -2
  79. package/dist/core/components/Form/Form.test.cjs +1 -1
  80. package/dist/core/components/Form/Form.test.mjs +1 -1
  81. package/dist/core/components/Form/index.cjs +1 -1
  82. package/dist/core/components/Form/index.mjs +1 -1
  83. package/dist/core/components/Grid/Grid.test.cjs +1 -1
  84. package/dist/core/components/Grid/Grid.test.mjs +1 -1
  85. package/dist/core/components/Heading/Heading.test.cjs +1 -1
  86. package/dist/core/components/Heading/Heading.test.mjs +1 -1
  87. package/dist/core/components/Input/Input.test.cjs +1 -1
  88. package/dist/core/components/Input/Input.test.mjs +1 -1
  89. package/dist/core/components/Input/index.cjs +1 -1
  90. package/dist/core/components/Input/index.mjs +25 -31
  91. package/dist/core/components/Label/Label.test.cjs +1 -1
  92. package/dist/core/components/Label/Label.test.mjs +1 -1
  93. package/dist/core/components/Label/index.cjs +1 -1
  94. package/dist/core/components/Label/index.mjs +1 -1
  95. package/dist/core/components/List/List.test.cjs +1 -1
  96. package/dist/core/components/List/List.test.mjs +1 -1
  97. package/dist/core/components/List/index.cjs +1 -1
  98. package/dist/core/components/List/index.mjs +1 -1
  99. package/dist/core/components/Modal/Modal.test.cjs +1 -1
  100. package/dist/core/components/Modal/Modal.test.mjs +1 -1
  101. package/dist/core/components/Modal/index.cjs +1 -1
  102. package/dist/core/components/Modal/index.mjs +1 -1
  103. package/dist/core/components/NavBar/NavBar.test.cjs +1 -1
  104. package/dist/core/components/NavBar/NavBar.test.mjs +1 -1
  105. package/dist/core/components/NavBar/index.cjs +1 -1
  106. package/dist/core/components/NavBar/index.mjs +1 -1
  107. package/dist/core/components/Notification/Notification.test.cjs +1 -1
  108. package/dist/core/components/Notification/Notification.test.mjs +1 -1
  109. package/dist/core/components/Notification/index.cjs +1 -1
  110. package/dist/core/components/Notification/index.mjs +1 -1
  111. package/dist/core/components/NotificationContainer/NotificationContainer.test.cjs +1 -1
  112. package/dist/core/components/NotificationContainer/NotificationContainer.test.mjs +1 -1
  113. package/dist/core/components/NotificationContainer/index.cjs +1 -1
  114. package/dist/core/components/NotificationContainer/index.mjs +1 -1
  115. package/dist/core/components/ProgressBar/ProgressBar.test.cjs +1 -1
  116. package/dist/core/components/ProgressBar/ProgressBar.test.mjs +1 -1
  117. package/dist/core/components/ProgressBar/index.cjs +1 -1
  118. package/dist/core/components/ProgressBar/index.mjs +1 -1
  119. package/dist/core/components/Radio/Radio.test.cjs +1 -1
  120. package/dist/core/components/Radio/Radio.test.mjs +1 -1
  121. package/dist/core/components/Radio/index.cjs +1 -1
  122. package/dist/core/components/Radio/index.mjs +1 -1
  123. package/dist/core/components/Range/Range.test.cjs +1 -1
  124. package/dist/core/components/Range/Range.test.mjs +1 -1
  125. package/dist/core/components/Range/index.cjs +1 -1
  126. package/dist/core/components/Range/index.mjs +1 -1
  127. package/dist/core/components/Select/Select.test.cjs +1 -1
  128. package/dist/core/components/Select/Select.test.mjs +176 -106
  129. package/dist/core/components/Select/index.cjs +1 -1
  130. package/dist/core/components/Select/index.mjs +100 -80
  131. package/dist/core/components/Sidebar/Sidebar.test.cjs +1 -1
  132. package/dist/core/components/Sidebar/Sidebar.test.mjs +1 -1
  133. package/dist/core/components/Sidebar/index.cjs +1 -1
  134. package/dist/core/components/Sidebar/index.mjs +1 -1
  135. package/dist/core/components/Skeleton/Skeleton.test.cjs +1 -1
  136. package/dist/core/components/Skeleton/Skeleton.test.mjs +1 -1
  137. package/dist/core/components/Spacer/Spacer.test.cjs +1 -1
  138. package/dist/core/components/Spacer/Spacer.test.mjs +1 -1
  139. package/dist/core/components/Spinner/Spinner.test.cjs +1 -1
  140. package/dist/core/components/Spinner/Spinner.test.mjs +1 -1
  141. package/dist/core/components/Stack/Stack.test.cjs +1 -1
  142. package/dist/core/components/Stack/Stack.test.mjs +1 -1
  143. package/dist/core/components/Switch/Switch.test.cjs +1 -1
  144. package/dist/core/components/Switch/Switch.test.mjs +1 -1
  145. package/dist/core/components/Table/Table.test.cjs +1 -1
  146. package/dist/core/components/Table/Table.test.mjs +1 -1
  147. package/dist/core/components/Tabs/Tabs.test.cjs +1 -1
  148. package/dist/core/components/Tabs/Tabs.test.mjs +1 -1
  149. package/dist/core/components/Text/Text.test.cjs +1 -1
  150. package/dist/core/components/Text/Text.test.mjs +1 -1
  151. package/dist/core/components/Textarea/Textarea.test.cjs +1 -1
  152. package/dist/core/components/Textarea/Textarea.test.mjs +1 -1
  153. package/dist/core/components/Textarea/index.cjs +1 -1
  154. package/dist/core/components/Textarea/index.mjs +1 -1
  155. package/dist/core/components/Tooltip/Tooltip.test.cjs +1 -1
  156. package/dist/core/components/Tooltip/Tooltip.test.mjs +1 -1
  157. package/dist/core/components/Tooltip/index.cjs +1 -1
  158. package/dist/core/components/Tooltip/index.mjs +1 -1
  159. package/dist/core.cjs +1 -1
  160. package/dist/core.d.ts +30 -43
  161. package/dist/core.mjs +42 -44
  162. package/dist/{index-BQV8LRFm.js → index-Ck6GdALV.js} +0 -1
  163. package/dist/{index-DITXfOUM.cjs → index-CvpbNrYS.cjs} +16 -16
  164. package/dist/{index-2ZLA4POI.js → index-DTDGFsW8.js} +1 -1
  165. package/dist/{index-D0ylyll7.cjs → index-hPJqlEOh.cjs} +1 -1
  166. package/dist/{index-CnlJ2RgH.js → index-paelIj6o.js} +1 -1
  167. package/dist/{index-odc0vuSq.cjs → index-rFLvzU5A.cjs} +1 -1
  168. package/dist/index.css.d.ts +1 -0
  169. package/dist/index10.css.d.ts +7 -0
  170. package/dist/index11.css.d.ts +26 -0
  171. package/dist/index12.css.d.ts +24 -0
  172. package/dist/index13.css.d.ts +33 -0
  173. package/dist/index14.css.d.ts +10 -0
  174. package/dist/index15.css.d.ts +18 -0
  175. package/dist/index16.css.d.ts +38 -0
  176. package/dist/index17.css.d.ts +16 -0
  177. package/dist/index18.css.d.ts +14 -0
  178. package/dist/index19.css.d.ts +17 -0
  179. package/dist/index2.css.d.ts +9 -0
  180. package/dist/index20.css.d.ts +13 -0
  181. package/dist/index21.css.d.ts +25 -0
  182. package/dist/index22.css.d.ts +5 -0
  183. package/dist/index23.css.d.ts +19 -0
  184. package/dist/index24.css.d.ts +21 -0
  185. package/dist/index25.css +1 -1
  186. package/dist/index25.css.d.ts +16 -0
  187. package/dist/index26.css.d.ts +10 -0
  188. package/dist/index27.css.d.ts +18 -0
  189. package/dist/index28.css.d.ts +16 -0
  190. package/dist/index29.css.d.ts +10 -0
  191. package/dist/index3.css.d.ts +12 -0
  192. package/dist/index30.css.d.ts +19 -0
  193. package/dist/index31.css.d.ts +15 -0
  194. package/dist/index32.css.d.ts +22 -0
  195. package/dist/index33.css.d.ts +15 -0
  196. package/dist/index34.css +1 -1
  197. package/dist/index34.css.d.ts +14 -0
  198. package/dist/index35.css +1 -1
  199. package/dist/index35.css.d.ts +23 -0
  200. package/dist/index36.css +1 -1
  201. package/dist/index36.css.d.ts +14 -0
  202. package/dist/index37.css +1 -1
  203. package/dist/index37.css.d.ts +18 -0
  204. package/dist/index38.css +1 -1
  205. package/dist/index38.css.d.ts +21 -0
  206. package/dist/index39.css +1 -1
  207. package/dist/index39.css.d.ts +20 -0
  208. package/dist/index4.css.d.ts +10 -0
  209. package/dist/index40.css +1 -1
  210. package/dist/index40.css.d.ts +17 -0
  211. package/dist/index41.css +1 -1
  212. package/dist/index41.css.d.ts +14 -0
  213. package/dist/index42.css +1 -1
  214. package/dist/index42.css.d.ts +22 -0
  215. package/dist/index43.css +1 -1
  216. package/dist/index43.css.d.ts +35 -0
  217. package/dist/index44.css +1 -1
  218. package/dist/index44.css.d.ts +13 -0
  219. package/dist/index45.css +1 -1
  220. package/dist/index45.css.d.ts +23 -0
  221. package/dist/index46.css +1 -1
  222. package/dist/index46.css.d.ts +12 -0
  223. package/dist/index47.css +1 -1
  224. package/dist/index47.css.d.ts +19 -0
  225. package/dist/index48.css +1 -1
  226. package/dist/index48.css.d.ts +20 -0
  227. package/dist/index49.css +1 -1
  228. package/dist/index49.css.d.ts +20 -0
  229. package/dist/index5.css.d.ts +22 -0
  230. package/dist/index50.css +1 -1
  231. package/dist/index50.css.d.ts +27 -0
  232. package/dist/index51.css +1 -1
  233. package/dist/index51.css.d.ts +17 -0
  234. package/dist/index52.css +1 -1
  235. package/dist/index52.css.d.ts +11 -0
  236. package/dist/index53.css.d.ts +12 -0
  237. package/dist/index54.css.d.ts +14 -0
  238. package/dist/index55.css.d.ts +20 -0
  239. package/dist/index56.css.d.ts +25 -0
  240. package/dist/index57.css.d.ts +13 -0
  241. package/dist/index58.css +1 -1
  242. package/dist/index58.css.d.ts +12 -0
  243. package/dist/index59.css +1 -1
  244. package/dist/index59.css.d.ts +20 -0
  245. package/dist/index6.css.d.ts +19 -0
  246. package/dist/index60.css +1 -1
  247. package/dist/index60.css.d.ts +20 -0
  248. package/dist/index61.css +1 -1
  249. package/dist/index61.css.d.ts +18 -0
  250. package/dist/index62.css +1 -1
  251. package/dist/index62.css.d.ts +22 -0
  252. package/dist/index63.css +1 -1
  253. package/dist/index63.css.d.ts +28 -0
  254. package/dist/index64.css +1 -1
  255. package/dist/index64.css.d.ts +26 -0
  256. package/dist/index65.css +1 -1
  257. package/dist/index65.css.d.ts +19 -0
  258. package/dist/index7.css.d.ts +40 -0
  259. package/dist/index8.css.d.ts +32 -0
  260. package/dist/index9.css.d.ts +9 -0
  261. package/dist/main.cjs +1 -1
  262. package/dist/main.d.ts +48 -43
  263. package/dist/main.mjs +94 -94
  264. package/dist/next/blocks/DocumentListBlock/CategoryFilters.cjs +1 -1
  265. package/dist/next/blocks/DocumentListBlock/CategoryFilters.mjs +2 -2
  266. package/dist/next/blocks/DocumentListBlock/index.cjs +1 -1
  267. package/dist/next/blocks/DocumentListBlock/index.mjs +2 -2
  268. package/dist/next/blocks/FormBlock/FormField.cjs +1 -0
  269. package/dist/next/blocks/FormBlock/FormField.mjs +13 -0
  270. package/dist/next/blocks/FormBlock/index.cjs +1 -0
  271. package/dist/next/blocks/FormBlock/index.mjs +192 -0
  272. package/dist/next/blocks/FormBlock/validate.cjs +1 -0
  273. package/dist/next/blocks/FormBlock/validate.mjs +76 -0
  274. package/dist/next/blocks/TabsBlock/index.cjs +1 -1
  275. package/dist/next/blocks/TabsBlock/index.mjs +1 -1
  276. package/dist/next/blocks/WasHelpfulBlock/index.cjs +1 -1
  277. package/dist/next/blocks/WasHelpfulBlock/index.mjs +1 -1
  278. package/dist/next/cards/BlogArticleCard/index.cjs +1 -1
  279. package/dist/next/cards/BlogArticleCard/index.mjs +1 -1
  280. package/dist/next/cards/SpotlightCard/index.cjs +1 -1
  281. package/dist/next/cards/SpotlightCard/index.mjs +1 -1
  282. package/dist/next/ui/CallToAction/index.cjs +1 -1
  283. package/dist/next/ui/CallToAction/index.mjs +1 -1
  284. package/dist/next.cjs +1 -1
  285. package/dist/next.d.ts +18 -0
  286. package/dist/next.mjs +45 -43
  287. package/dist/styles.css.d.ts +1 -0
  288. package/dist/tokens.css.d.ts +1 -0
  289. package/package.json +1 -1
  290. package/dist/core/components/MultiSelect/MultiSelect.test.cjs +0 -6
  291. package/dist/core/components/MultiSelect/MultiSelect.test.mjs +0 -3518
  292. package/dist/core/components/MultiSelect/__mocks__/styles.module.css.cjs +0 -1
  293. package/dist/core/components/MultiSelect/__mocks__/styles.module.css.mjs +0 -14
  294. package/dist/core/components/MultiSelect/index.cjs +0 -1
  295. package/dist/core/components/MultiSelect/index.mjs +0 -94
  296. package/dist/index66.css +0 -1
@@ -1,3518 +0,0 @@
1
- import { jsxs as rn, jsx as h } from "react/jsx-runtime";
2
- import on from "react";
3
- import { j as J, v as vt, d as I, i as b, r as g, g as p, s as w } from "../../../index-BQV8LRFm.js";
4
- import { MultiSelect as v } from "./index.mjs";
5
- function d(e, t, n) {
6
- return e.namespaceURI && e.namespaceURI !== "http://www.w3.org/1999/xhtml" || (t = Array.isArray(t) ? t : [
7
- t
8
- ], !t.includes(e.tagName.toLowerCase())) ? !1 : n ? Object.entries(n).every(([i, r]) => e[i] === r) : !0;
9
- }
10
- function _(e) {
11
- var t;
12
- if (sn(e) && e.defaultView)
13
- return e.defaultView;
14
- if (!((t = e.ownerDocument) === null || t === void 0) && t.defaultView)
15
- return e.ownerDocument.defaultView;
16
- throw new Error(`Could not determine window of node. Node was ${un(e)}`);
17
- }
18
- function sn(e) {
19
- return e.nodeType === 9;
20
- }
21
- function un(e) {
22
- return typeof e == "function" ? `function ${e.name}` : e === null ? "null" : String(e);
23
- }
24
- function mt(e, t) {
25
- return new Promise((n, i) => {
26
- const r = new t();
27
- r.onerror = i, r.onabort = i, r.onload = () => {
28
- n(String(r.result));
29
- }, r.readAsText(e);
30
- });
31
- }
32
- function Ve(e, t) {
33
- const n = {
34
- ...t,
35
- length: t.length,
36
- item: (i) => n[i],
37
- [Symbol.iterator]: function* () {
38
- for (let r = 0; r < n.length; r++)
39
- yield n[r];
40
- }
41
- };
42
- return n.constructor = e.FileList, e.FileList && Object.setPrototypeOf(n, e.FileList.prototype), Object.freeze(n), n;
43
- }
44
- function M(e, t, n) {
45
- return t in e ? Object.defineProperty(e, t, {
46
- value: n,
47
- enumerable: !0,
48
- configurable: !0,
49
- writable: !0
50
- }) : e[t] = n, e;
51
- }
52
- class yt {
53
- getAsFile() {
54
- return this.file;
55
- }
56
- getAsString(t) {
57
- typeof this.data == "string" && t(this.data);
58
- }
59
- /* istanbul ignore next */
60
- webkitGetAsEntry() {
61
- throw new Error("not implemented");
62
- }
63
- constructor(t, n) {
64
- M(this, "kind", void 0), M(this, "type", void 0), M(this, "file", null), M(this, "data", void 0), typeof t == "string" ? (this.kind = "string", this.type = String(n), this.data = t) : (this.kind = "file", this.type = t.type, this.file = t);
65
- }
66
- }
67
- class ln extends Array {
68
- add(...t) {
69
- const n = new yt(t[0], t[1]);
70
- return this.push(n), n;
71
- }
72
- clear() {
73
- this.splice(0, this.length);
74
- }
75
- remove(t) {
76
- this.splice(t, 1);
77
- }
78
- }
79
- function Ee(e, t) {
80
- const [n, i] = e.split("/"), r = !i || i === "*";
81
- return (o) => t ? o.type === (r ? n : e) : r ? o.type.startsWith(`${n}/`) : o.type === n;
82
- }
83
- function an(e) {
84
- return new class {
85
- getData(n) {
86
- var i;
87
- const r = (i = this.items.find(Ee(n, !0))) !== null && i !== void 0 ? i : this.items.find(Ee(n, !1));
88
- let o = "";
89
- return r == null || r.getAsString((s) => {
90
- o = s;
91
- }), o;
92
- }
93
- setData(n, i) {
94
- const r = this.items.findIndex(Ee(n, !0)), o = new yt(i, n);
95
- r >= 0 ? this.items.splice(r, 1, o) : this.items.push(o);
96
- }
97
- clearData(n) {
98
- if (n) {
99
- const i = this.items.findIndex(Ee(n, !0));
100
- i >= 0 && this.items.remove(i);
101
- } else
102
- this.items.clear();
103
- }
104
- get types() {
105
- const n = [];
106
- return this.files.length && n.push("Files"), this.items.forEach((i) => n.push(i.type)), Object.freeze(n), n;
107
- }
108
- /* istanbul ignore next */
109
- setDragImage() {
110
- }
111
- constructor() {
112
- M(this, "dropEffect", "none"), M(this, "effectAllowed", "uninitialized"), M(this, "items", new ln()), M(this, "files", Ve(e, []));
113
- }
114
- }();
115
- }
116
- function He(e, t = []) {
117
- const n = typeof e.DataTransfer > "u" ? an(e) : (
118
- /* istanbul ignore next */
119
- new e.DataTransfer()
120
- );
121
- return Object.defineProperty(n, "files", {
122
- get: () => Ve(e, t)
123
- }), n;
124
- }
125
- async function cn(e, t) {
126
- return t.kind === "file" ? t.getAsFile() : new e.Blob([
127
- await new Promise((n) => t.getAsString(n))
128
- ], {
129
- type: t.type
130
- });
131
- }
132
- function Et(e, t, n) {
133
- return t in e ? Object.defineProperty(e, t, {
134
- value: n,
135
- enumerable: !0,
136
- configurable: !0,
137
- writable: !0
138
- }) : e[t] = n, e;
139
- }
140
- function wt(e, ...t) {
141
- const n = Object.fromEntries(t.map((i) => [
142
- typeof i == "string" ? "text/plain" : i.type,
143
- Promise.resolve(i)
144
- ]));
145
- return typeof e.ClipboardItem < "u" ? new e.ClipboardItem(n) : new class {
146
- get types() {
147
- return Array.from(Object.keys(this.data));
148
- }
149
- async getType(r) {
150
- const o = await this.data[r];
151
- if (!o)
152
- throw new Error(`${r} is not one of the available MIME types on this item.`);
153
- return o instanceof e.Blob ? o : new e.Blob([
154
- o
155
- ], {
156
- type: r
157
- });
158
- }
159
- constructor(r) {
160
- Et(this, "data", void 0), this.data = r;
161
- }
162
- }(n);
163
- }
164
- const ee = Symbol("Manage ClipboardSub");
165
- function Xe(e, t) {
166
- return Object.assign(new class extends e.EventTarget {
167
- async read() {
168
- return Array.from(this.items);
169
- }
170
- async readText() {
171
- let i = "";
172
- for (const r of this.items) {
173
- const o = r.types.includes("text/plain") ? "text/plain" : r.types.find((s) => s.startsWith("text/"));
174
- o && (i += await r.getType(o).then((s) => mt(s, e.FileReader)));
175
- }
176
- return i;
177
- }
178
- async write(i) {
179
- this.items = i;
180
- }
181
- async writeText(i) {
182
- this.items = [
183
- wt(e, i)
184
- ];
185
- }
186
- constructor(...i) {
187
- super(...i), Et(this, "items", []);
188
- }
189
- }(), {
190
- [ee]: t
191
- });
192
- }
193
- function Ke(e) {
194
- return !!(e != null && e[ee]);
195
- }
196
- function dn(e) {
197
- if (Ke(e.navigator.clipboard))
198
- return e.navigator.clipboard[ee];
199
- const t = Object.getOwnPropertyDescriptor(e.navigator, "clipboard");
200
- let n;
201
- const i = {
202
- resetClipboardStub: () => {
203
- n = Xe(e, i);
204
- },
205
- detachClipboardStub: () => {
206
- t ? Object.defineProperty(e.navigator, "clipboard", t) : Object.defineProperty(e.navigator, "clipboard", {
207
- value: void 0,
208
- configurable: !0
209
- });
210
- }
211
- };
212
- return n = Xe(e, i), Object.defineProperty(e.navigator, "clipboard", {
213
- get: () => n,
214
- configurable: !0
215
- }), n[ee];
216
- }
217
- function fn(e) {
218
- Ke(e.navigator.clipboard) && e.navigator.clipboard[ee].resetClipboardStub();
219
- }
220
- function pn(e) {
221
- Ke(e.navigator.clipboard) && e.navigator.clipboard[ee].detachClipboardStub();
222
- }
223
- async function hn(e) {
224
- const t = e.defaultView, n = t == null ? void 0 : t.navigator.clipboard, i = n && await n.read();
225
- if (!i)
226
- throw new Error("The Clipboard API is unavailable.");
227
- const r = He(t);
228
- for (const o of i)
229
- for (const s of o.types)
230
- r.setData(s, await o.getType(s).then((u) => mt(u, t.FileReader)));
231
- return r;
232
- }
233
- async function Ct(e, t) {
234
- const n = _(e), i = n.navigator.clipboard, r = [];
235
- for (let s = 0; s < t.items.length; s++) {
236
- const u = t.items[s], l = await cn(n, u);
237
- r.push(wt(n, l));
238
- }
239
- if (!(i && await i.write(r).then(
240
- () => !0,
241
- // Can happen with other implementations that e.g. require permissions
242
- /* istanbul ignore next */
243
- () => !1
244
- )))
245
- throw new Error("The Clipboard API is unavailable.");
246
- }
247
- const Pe = globalThis;
248
- typeof Pe.afterEach == "function" && Pe.afterEach(() => fn(globalThis.window));
249
- typeof Pe.afterAll == "function" && Pe.afterAll(() => pn(globalThis.window));
250
- const Tt = [
251
- "input:not([type=hidden]):not([disabled])",
252
- "button:not([disabled])",
253
- "select:not([disabled])",
254
- "textarea:not([disabled])",
255
- '[contenteditable=""]',
256
- '[contenteditable="true"]',
257
- "a[href]",
258
- "[tabindex]:not([disabled])"
259
- ].join(", ");
260
- function je(e) {
261
- return e.matches(Tt);
262
- }
263
- function bn(e) {
264
- return new e.constructor(e.type, e);
265
- }
266
- function U(e) {
267
- for (let n = e; n; n = n.parentElement)
268
- if (d(n, [
269
- "button",
270
- "input",
271
- "select",
272
- "textarea",
273
- "optgroup",
274
- "option"
275
- ])) {
276
- if (n.hasAttribute("disabled"))
277
- return !0;
278
- } else if (d(n, "fieldset")) {
279
- var t;
280
- if (n.hasAttribute("disabled") && !(!((t = n.querySelector(":scope > legend")) === null || t === void 0) && t.contains(e)))
281
- return !0;
282
- } else if (n.tagName.includes("-") && n.constructor.formAssociated && n.hasAttribute("disabled"))
283
- return !0;
284
- return !1;
285
- }
286
- function ye(e) {
287
- const t = e.activeElement;
288
- return t != null && t.shadowRoot ? ye(t.shadowRoot) : U(t) ? e.ownerDocument ? (
289
- /* istanbul ignore next */
290
- e.ownerDocument.body
291
- ) : e.body : t;
292
- }
293
- function Ne(e) {
294
- var t;
295
- return (t = ye(e)) !== null && t !== void 0 ? t : (
296
- /* istanbul ignore next */
297
- e.body
298
- );
299
- }
300
- function gn(e, t) {
301
- let n = e;
302
- do {
303
- if (t(n))
304
- return n;
305
- n = n.parentElement;
306
- } while (n && n !== e.ownerDocument.body);
307
- }
308
- function X(e) {
309
- return e.hasAttribute("contenteditable") && (e.getAttribute("contenteditable") == "true" || e.getAttribute("contenteditable") == "");
310
- }
311
- function ge(e) {
312
- const t = vn(e);
313
- return t && (t.closest('[contenteditable=""]') || t.closest('[contenteditable="true"]'));
314
- }
315
- function vn(e) {
316
- return e.nodeType === 1 ? e : e.parentElement;
317
- }
318
- var kt = /* @__PURE__ */ function(e) {
319
- return e.button = "button", e.color = "color", e.file = "file", e.image = "image", e.reset = "reset", e.submit = "submit", e.checkbox = "checkbox", e.radio = "radio", e;
320
- }(kt || {});
321
- function St(e) {
322
- return d(e, "button") || d(e, "input") && e.type in kt;
323
- }
324
- function te(e) {
325
- return _t(e) && !e.readOnly || X(e);
326
- }
327
- var It = /* @__PURE__ */ function(e) {
328
- return e.text = "text", e.date = "date", e["datetime-local"] = "datetime-local", e.email = "email", e.month = "month", e.number = "number", e.password = "password", e.search = "search", e.tel = "tel", e.time = "time", e.url = "url", e.week = "week", e;
329
- }(It || {});
330
- function _t(e) {
331
- return d(e, "textarea") || d(e, "input") && e.type in It;
332
- }
333
- function O(e) {
334
- return Pt(e) && _t(e);
335
- }
336
- function mn(e) {
337
- return Pt(e) && St(e);
338
- }
339
- function Pt(e) {
340
- return e.nodeType === 1;
341
- }
342
- function yn(e) {
343
- const t = e.ownerDocument.getSelection();
344
- if (t != null && t.focusNode && O(e)) {
345
- const i = ge(t.focusNode);
346
- if (i) {
347
- if (!t.isCollapsed) {
348
- var n;
349
- const r = ((n = i.firstChild) === null || n === void 0 ? void 0 : n.nodeType) === 3 ? i.firstChild : i;
350
- t.setBaseAndExtent(r, 0, r, 0);
351
- }
352
- } else
353
- t.setBaseAndExtent(e, 0, e, 0);
354
- }
355
- }
356
- function ne(e, t) {
357
- return J().eventWrapper(e);
358
- }
359
- function L(e) {
360
- const t = gn(e, je), n = ye(e.ownerDocument);
361
- (t ?? e.ownerDocument.body) !== n && (ne(t ? () => t.focus() : () => n == null ? void 0 : n.blur()), yn(t ?? e.ownerDocument.body));
362
- }
363
- function En(e) {
364
- !je(e) || !(ye(e.ownerDocument) === e) || ne(() => e.blur());
365
- }
366
- const $ = {};
367
- $.click = (e, t, n) => {
368
- const i = t.closest("button,input,label,select,textarea"), r = i && d(i, "label") && i.control;
369
- if (r && r !== t)
370
- return () => {
371
- je(r) && (L(r), n.dispatchEvent(r, bn(e)));
372
- };
373
- if (d(t, "input", {
374
- type: "file"
375
- }))
376
- return () => {
377
- En(t), t.dispatchEvent(new (_(t)).Event("fileDialog")), L(t);
378
- };
379
- };
380
- const ie = Symbol("Displayed value in UI"), D = Symbol("Displayed selection in UI"), Oe = Symbol("Initial value to compare on blur");
381
- function wn(e) {
382
- return typeof e == "object" && ie in e;
383
- }
384
- function Cn(e) {
385
- return !!e && typeof e == "object" && D in e;
386
- }
387
- function Tn(e, t) {
388
- e[Oe] === void 0 && (e[Oe] = e.value), e[ie] = t, e.value = Object.assign(new String(t), {
389
- [ie]: !0
390
- });
391
- }
392
- function A(e) {
393
- return e[ie] === void 0 ? e.value : String(e[ie]);
394
- }
395
- function qe(e) {
396
- e[ie] = void 0;
397
- }
398
- function Ot(e) {
399
- e[Oe] = void 0;
400
- }
401
- function kn(e) {
402
- return e[Oe];
403
- }
404
- function Sn(e, t) {
405
- e[D] = t;
406
- }
407
- function se(e, { focusOffset: t, anchorOffset: n = t }, i = "replace") {
408
- const r = A(e).length, o = (f) => Math.max(0, Math.min(r, f)), s = i === "replace" || e[D] === void 0 ? o(n) : e[D].anchorOffset, u = o(t), l = Math.min(s, u), a = Math.max(s, u);
409
- if (e[D] = {
410
- anchorOffset: s,
411
- focusOffset: u
412
- }, e.selectionStart === l && e.selectionEnd === a)
413
- return;
414
- const c = Object.assign(new Number(l), {
415
- [D]: !0
416
- });
417
- try {
418
- e.setSelectionRange(c, a);
419
- } catch {
420
- }
421
- }
422
- function ve(e) {
423
- var t, n, i;
424
- const r = (i = e[D]) !== null && i !== void 0 ? i : {
425
- anchorOffset: (t = e.selectionStart) !== null && t !== void 0 ? t : 0,
426
- focusOffset: (n = e.selectionEnd) !== null && n !== void 0 ? n : 0
427
- };
428
- return {
429
- ...r,
430
- startOffset: Math.min(r.anchorOffset, r.focusOffset),
431
- endOffset: Math.max(r.anchorOffset, r.focusOffset)
432
- };
433
- }
434
- function In(e) {
435
- return !!e[D];
436
- }
437
- function Se(e) {
438
- e[D] = void 0;
439
- }
440
- const Ae = globalThis.parseInt;
441
- function _n(e) {
442
- const t = e.replace(/\D/g, "");
443
- if (t.length < 2)
444
- return e;
445
- const n = Ae(t[0], 10), i = Ae(t[1], 10);
446
- if (n >= 3 || n === 2 && i >= 4) {
447
- let r;
448
- return n >= 3 ? r = 1 : r = 2, Ye(t, r);
449
- }
450
- return e.length === 2 ? e : Ye(t, 2);
451
- }
452
- function Ye(e, t) {
453
- const n = e.slice(0, t), i = Math.min(Ae(n, 10), 23), r = e.slice(t), o = Ae(r, 10), s = Math.min(o, 59);
454
- return `${i.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`;
455
- }
456
- function At(e, t) {
457
- const n = e.cloneNode();
458
- return n.value = t, n.value === t;
459
- }
460
- var xt = /* @__PURE__ */ function(e) {
461
- return e.email = "email", e.password = "password", e.search = "search", e.telephone = "telephone", e.text = "text", e.url = "url", e;
462
- }(xt || {});
463
- function Pn(e) {
464
- var t;
465
- const n = (t = e.getAttribute("maxlength")) !== null && t !== void 0 ? t : "";
466
- return /^\d+$/.test(n) && Number(n) >= 0 ? Number(n) : void 0;
467
- }
468
- function On(e) {
469
- return d(e, "textarea") || d(e, "input") && e.type in xt;
470
- }
471
- function Dt(e, t, n, i) {
472
- if (Ie(e) && t + n >= 0 && t + n <= e.nodeValue.length)
473
- return {
474
- node: e,
475
- offset: t + n
476
- };
477
- const r = Je(e, t, n);
478
- if (r) {
479
- if (Ie(r))
480
- return {
481
- node: r,
482
- offset: n > 0 ? Math.min(1, r.nodeValue.length) : Math.max(r.nodeValue.length - 1, 0)
483
- };
484
- if (d(r, "br")) {
485
- const o = Je(r, void 0, n);
486
- return o ? Ie(o) ? {
487
- node: o,
488
- offset: n > 0 ? 0 : o.nodeValue.length
489
- } : n < 0 && d(o, "br") ? {
490
- node: r.parentNode,
491
- offset: we(r)
492
- } : {
493
- node: o.parentNode,
494
- offset: we(o) + (n > 0 ? 0 : 1)
495
- } : n < 0 && i === "deleteContentBackward" ? {
496
- node: r.parentNode,
497
- offset: we(r)
498
- } : void 0;
499
- } else
500
- return {
501
- node: r.parentNode,
502
- offset: we(r) + (n > 0 ? 1 : 0)
503
- };
504
- }
505
- }
506
- function Je(e, t, n) {
507
- const i = Number(t) + (n < 0 ? -1 : 0);
508
- return t !== void 0 && ze(e) && i >= 0 && i < e.children.length && (e = e.children[i]), xn(e, n === 1 ? "next" : "previous", An);
509
- }
510
- function An(e) {
511
- if (Ie(e))
512
- return !0;
513
- if (ze(e)) {
514
- if (d(e, [
515
- "input",
516
- "textarea"
517
- ]))
518
- return e.type !== "hidden";
519
- if (d(e, "br"))
520
- return !0;
521
- }
522
- return !1;
523
- }
524
- function we(e) {
525
- let t = 0;
526
- for (; e.previousSibling; )
527
- t++, e = e.previousSibling;
528
- return t;
529
- }
530
- function ze(e) {
531
- return e.nodeType === 1;
532
- }
533
- function Ie(e) {
534
- return e.nodeType === 3;
535
- }
536
- function xn(e, t, n) {
537
- for (; ; ) {
538
- var i;
539
- const r = e[`${t}Sibling`];
540
- if (r) {
541
- if (e = Dn(r, t === "next" ? "first" : "last"), n(e))
542
- return e;
543
- } else if (e.parentNode && (!ze(e.parentNode) || !X(e.parentNode) && e.parentNode !== ((i = e.ownerDocument) === null || i === void 0 ? void 0 : i.body)))
544
- e = e.parentNode;
545
- else
546
- break;
547
- }
548
- }
549
- function Dn(e, t) {
550
- for (; e.hasChildNodes(); )
551
- e = e[`${t}Child`];
552
- return e;
553
- }
554
- const me = Symbol("Track programmatic changes for React workaround");
555
- function Un(e) {
556
- return Object.getOwnPropertyNames(e).some((t) => t.startsWith("__react")) && _(e).REACT_VERSION === 17;
557
- }
558
- function Nn(e) {
559
- Un(e) && (e[me] = {
560
- previousValue: String(e.value),
561
- tracked: []
562
- });
563
- }
564
- function Bn(e, t) {
565
- var n, i;
566
- (i = e[me]) === null || i === void 0 || (n = i.tracked) === null || n === void 0 || n.push(t), e[me] || (qe(e), se(e, {
567
- focusOffset: t.length
568
- }));
569
- }
570
- function Mn(e, t) {
571
- var n;
572
- const i = e[me];
573
- if (e[me] = void 0, !(!(i == null || (n = i.tracked) === null || n === void 0) && n.length))
574
- return;
575
- const r = i.tracked.length === 2 && i.tracked[0] === i.previousValue && i.tracked[1] === e.value;
576
- r || qe(e), In(e) && se(e, {
577
- focusOffset: r ? t : e.value.length
578
- });
579
- }
580
- function Ut(e) {
581
- const t = Ln(e);
582
- if (t && O(t))
583
- return {
584
- type: "input",
585
- selection: ve(t)
586
- };
587
- const n = t == null ? void 0 : t.ownerDocument.getSelection();
588
- return {
589
- type: ge(e) && (n == null ? void 0 : n.anchorNode) && ge(n.anchorNode) ? "contenteditable" : "default",
590
- selection: n
591
- };
592
- }
593
- function Ln(e) {
594
- return e.nodeType === 1 ? e : e.parentElement;
595
- }
596
- function $n(e) {
597
- const t = Ut(e);
598
- if (t.type === "input")
599
- return t.selection;
600
- if (t.type === "contenteditable") {
601
- var n;
602
- return (n = t.selection) === null || n === void 0 ? void 0 : n.getRangeAt(0);
603
- }
604
- }
605
- function Y({ focusNode: e, focusOffset: t, anchorNode: n = e, anchorOffset: i = t }) {
606
- var r, o;
607
- if (Ut(e).type === "input")
608
- return se(e, {
609
- anchorOffset: i,
610
- focusOffset: t
611
- });
612
- (o = n.ownerDocument) === null || o === void 0 || (r = o.getSelection()) === null || r === void 0 || r.setBaseAndExtent(n, i, e, t);
613
- }
614
- function Nt(e) {
615
- return d(e, "input") && [
616
- "date",
617
- "time"
618
- ].includes(e.type);
619
- }
620
- function re(e, t, n, i = "insertText") {
621
- const r = $n(t);
622
- r && (!Nt(t) && !e.dispatchUIEvent(t, "beforeinput", {
623
- inputType: i,
624
- data: n
625
- }) || ("startContainer" in r ? Fn(e, t, r, n, i) : Rn(e, t, r, n, i)));
626
- }
627
- function Fn(e, t, n, i, r) {
628
- let o = !1;
629
- if (!n.collapsed)
630
- o = !0, n.deleteContents();
631
- else if ([
632
- "deleteContentBackward",
633
- "deleteContentForward"
634
- ].includes(r)) {
635
- const s = Dt(n.startContainer, n.startOffset, r === "deleteContentBackward" ? -1 : 1, r);
636
- if (s) {
637
- o = !0;
638
- const u = n.cloneRange();
639
- u.comparePoint(s.node, s.offset) < 0 ? u.setStart(s.node, s.offset) : u.setEnd(s.node, s.offset), u.deleteContents();
640
- }
641
- }
642
- if (i)
643
- if (n.endContainer.nodeType === 3) {
644
- const s = n.endOffset;
645
- n.endContainer.insertData(s, i), n.setStart(n.endContainer, s + i.length), n.setEnd(n.endContainer, s + i.length);
646
- } else {
647
- const s = t.ownerDocument.createTextNode(i);
648
- n.insertNode(s), n.setStart(s, i.length), n.setEnd(s, i.length);
649
- }
650
- (o || i) && e.dispatchUIEvent(t, "input", {
651
- inputType: r
652
- });
653
- }
654
- function Rn(e, t, n, i, r) {
655
- let o = i;
656
- if (On(t)) {
657
- const a = Pn(t);
658
- if (a !== void 0 && i.length > 0) {
659
- const c = a - t.value.length;
660
- if (c > 0)
661
- o = i.substring(0, c);
662
- else
663
- return;
664
- }
665
- }
666
- const { newValue: s, newOffset: u, oldValue: l } = Vn(o, t, n, r);
667
- s === l && u === n.startOffset && u === n.endOffset || d(t, "input", {
668
- type: "number"
669
- }) && !Hn(s) || (Tn(t, s), Y({
670
- focusNode: t,
671
- anchorOffset: u,
672
- focusOffset: u
673
- }), Nt(t) ? At(t, s) && (Qe(e, t, u, {}), e.dispatchUIEvent(t, "change"), Ot(t)) : Qe(e, t, u, {
674
- data: i,
675
- inputType: r
676
- }));
677
- }
678
- function Vn(e, t, { startOffset: n, endOffset: i }, r) {
679
- const o = A(t), s = Math.max(0, n === i && r === "deleteContentBackward" ? n - 1 : n), u = o.substring(0, s), l = Math.min(o.length, n === i && r === "deleteContentForward" ? n + 1 : i), a = o.substring(l, o.length);
680
- let c = `${u}${e}${a}`, f = s + e.length;
681
- if (d(t, "input", {
682
- type: "time"
683
- })) {
684
- const m = _n(c);
685
- m !== "" && At(t, m) && (c = m, f = m.length);
686
- }
687
- return {
688
- oldValue: o,
689
- newValue: c,
690
- newOffset: f
691
- };
692
- }
693
- function Qe(e, t, n, i) {
694
- e.dispatchUIEvent(t, "input", i), Mn(t, n);
695
- }
696
- function Hn(e) {
697
- var t, n;
698
- const i = e.split("e", 2);
699
- return !(/[^\d.\-e]/.test(e) || Number((t = e.match(/-/g)) === null || t === void 0 ? void 0 : t.length) > 2 || Number((n = e.match(/\./g)) === null || n === void 0 ? void 0 : n.length) > 1 || i[1] && !/^-?\d*$/.test(i[1]));
700
- }
701
- $.cut = (e, t, n) => () => {
702
- te(t) && re(n, t, "", "deleteByCut");
703
- };
704
- function Kn(e) {
705
- return e ? X(e) ? e.textContent : A(e) : null;
706
- }
707
- function jn(e) {
708
- const t = _(e);
709
- for (let n = e; n != null && n.ownerDocument; n = n.parentElement) {
710
- const { display: i, visibility: r } = t.getComputedStyle(n);
711
- if (i === "none" || r === "hidden")
712
- return !1;
713
- }
714
- return !0;
715
- }
716
- function qn(e, t) {
717
- const n = e.ownerDocument, i = n.querySelectorAll(Tt), r = Array.from(i).filter((l) => l === e || !(Number(l.getAttribute("tabindex")) < 0 || U(l)));
718
- Number(e.getAttribute("tabindex")) >= 0 && r.sort((l, a) => {
719
- const c = Number(l.getAttribute("tabindex")), f = Number(a.getAttribute("tabindex"));
720
- return c === f ? 0 : c === 0 ? 1 : f === 0 ? -1 : c - f;
721
- });
722
- const o = {};
723
- let s = [
724
- n.body
725
- ];
726
- const u = d(e, "input", {
727
- type: "radio"
728
- }) ? e.name : void 0;
729
- r.forEach((l) => {
730
- const a = l;
731
- if (d(a, "input", {
732
- type: "radio"
733
- }) && a.name) {
734
- if (a === e) {
735
- s.push(a);
736
- return;
737
- } else if (a.name === u)
738
- return;
739
- if (a.checked) {
740
- s = s.filter((c) => !d(c, "input", {
741
- type: "radio",
742
- name: a.name
743
- })), s.push(a), o[a.name] = a;
744
- return;
745
- }
746
- if (typeof o[a.name] < "u")
747
- return;
748
- }
749
- s.push(a);
750
- });
751
- for (let l = s.findIndex((a) => a === e); ; )
752
- if (l += t ? -1 : 1, l === s.length ? l = 0 : l === -1 && (l = s.length - 1), s[l] === e || s[l] === n.body || jn(s[l]))
753
- return s[l];
754
- }
755
- function Ze(e, t) {
756
- if (O(e)) {
757
- const n = ve(e);
758
- Y({
759
- focusNode: e,
760
- focusOffset: n.startOffset === n.endOffset ? n.focusOffset + t : t < 0 ? n.startOffset : n.endOffset
761
- });
762
- } else {
763
- const n = e.ownerDocument.getSelection();
764
- if (!(n != null && n.focusNode))
765
- return;
766
- if (n.isCollapsed) {
767
- const i = Dt(n.focusNode, n.focusOffset, t);
768
- i && Y({
769
- focusNode: i.node,
770
- focusOffset: i.offset
771
- });
772
- } else
773
- n[t < 0 ? "collapseToStart" : "collapseToEnd"]();
774
- }
775
- }
776
- function Bt(e) {
777
- if (O(e))
778
- return Y({
779
- focusNode: e,
780
- anchorOffset: 0,
781
- focusOffset: A(e).length
782
- });
783
- var t;
784
- const n = (t = ge(e)) !== null && t !== void 0 ? t : e.ownerDocument.body;
785
- Y({
786
- focusNode: n,
787
- anchorOffset: 0,
788
- focusOffset: n.childNodes.length
789
- });
790
- }
791
- function zn(e) {
792
- if (O(e))
793
- return ve(e).startOffset === 0 && ve(e).endOffset === A(e).length;
794
- var t;
795
- const n = (t = ge(e)) !== null && t !== void 0 ? t : e.ownerDocument.body, i = e.ownerDocument.getSelection();
796
- return (i == null ? void 0 : i.anchorNode) === n && i.focusNode === n && i.anchorOffset === 0 && i.focusOffset === n.childNodes.length;
797
- }
798
- function fe(e, t, n) {
799
- var i;
800
- if (O(e))
801
- return Y({
802
- focusNode: e,
803
- anchorOffset: t,
804
- focusOffset: n
805
- });
806
- if (X(e) && ((i = e.firstChild) === null || i === void 0 ? void 0 : i.nodeType) === 3)
807
- return Y({
808
- focusNode: e.firstChild,
809
- anchorOffset: t,
810
- focusOffset: n
811
- });
812
- throw new Error("Not implemented. The result of this interaction is unreliable.");
813
- }
814
- function Ce(e, t, n) {
815
- const i = _(t), r = Array.from(t.ownerDocument.querySelectorAll(t.name ? `input[type="radio"][name="${i.CSS.escape(t.name)}"]` : 'input[type="radio"][name=""], input[type="radio"]:not([name])'));
816
- for (let o = r.findIndex((s) => s === t) + n; ; o += n) {
817
- if (r[o] || (o = n > 0 ? 0 : r.length - 1), r[o] === t)
818
- return;
819
- if (!U(r[o])) {
820
- L(r[o]), e.dispatchUIEvent(r[o], "click");
821
- return;
822
- }
823
- }
824
- }
825
- $.keydown = (e, t, n) => {
826
- var i, r;
827
- return (r = (i = et[e.key]) === null || i === void 0 ? void 0 : i.call(et, e, t, n)) !== null && r !== void 0 ? r : Gn(e, t, n);
828
- };
829
- const et = {
830
- ArrowDown: (e, t, n) => {
831
- if (d(t, "input", {
832
- type: "radio"
833
- }))
834
- return () => Ce(n, t, 1);
835
- },
836
- ArrowLeft: (e, t, n) => d(t, "input", {
837
- type: "radio"
838
- }) ? () => Ce(n, t, -1) : () => Ze(t, -1),
839
- ArrowRight: (e, t, n) => d(t, "input", {
840
- type: "radio"
841
- }) ? () => Ce(n, t, 1) : () => Ze(t, 1),
842
- ArrowUp: (e, t, n) => {
843
- if (d(t, "input", {
844
- type: "radio"
845
- }))
846
- return () => Ce(n, t, -1);
847
- },
848
- Backspace: (e, t, n) => {
849
- if (te(t))
850
- return () => {
851
- re(n, t, "", "deleteContentBackward");
852
- };
853
- },
854
- Delete: (e, t, n) => {
855
- if (te(t))
856
- return () => {
857
- re(n, t, "", "deleteContentForward");
858
- };
859
- },
860
- End: (e, t) => {
861
- if (d(t, [
862
- "input",
863
- "textarea"
864
- ]) || X(t))
865
- return () => {
866
- var n, i;
867
- const r = (i = (n = Kn(t)) === null || n === void 0 ? void 0 : n.length) !== null && i !== void 0 ? i : (
868
- /* istanbul ignore next */
869
- 0
870
- );
871
- fe(t, r, r);
872
- };
873
- },
874
- Home: (e, t) => {
875
- if (d(t, [
876
- "input",
877
- "textarea"
878
- ]) || X(t))
879
- return () => {
880
- fe(t, 0, 0);
881
- };
882
- },
883
- PageDown: (e, t) => {
884
- if (d(t, [
885
- "input"
886
- ]))
887
- return () => {
888
- const n = A(t).length;
889
- fe(t, n, n);
890
- };
891
- },
892
- PageUp: (e, t) => {
893
- if (d(t, [
894
- "input"
895
- ]))
896
- return () => {
897
- fe(t, 0, 0);
898
- };
899
- },
900
- Tab: (e, t, n) => () => {
901
- const i = qn(t, n.system.keyboard.modifiers.Shift);
902
- L(i), O(i) && se(i, {
903
- anchorOffset: 0,
904
- focusOffset: i.value.length
905
- });
906
- }
907
- }, Gn = (e, t, n) => {
908
- if (e.code === "KeyA" && n.system.keyboard.modifiers.Control)
909
- return () => Bt(t);
910
- };
911
- $.keypress = (e, t, n) => {
912
- if (e.key === "Enter") {
913
- if (d(t, "button") || d(t, "input") && Wn.includes(t.type) || d(t, "a") && t.href)
914
- return () => {
915
- n.dispatchUIEvent(t, "click");
916
- };
917
- if (d(t, "input")) {
918
- const i = t.form, r = i == null ? void 0 : i.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
919
- return r ? () => n.dispatchUIEvent(r, "click") : i && Xn.includes(t.type) && i.querySelectorAll("input").length === 1 ? () => n.dispatchUIEvent(i, "submit") : void 0;
920
- }
921
- }
922
- if (te(t)) {
923
- const i = e.key === "Enter" ? X(t) && !n.system.keyboard.modifiers.Shift ? "insertParagraph" : "insertLineBreak" : "insertText", r = e.key === "Enter" ? `
924
- ` : e.key;
925
- return () => re(n, t, r, i);
926
- }
927
- };
928
- const Wn = [
929
- "button",
930
- "color",
931
- "file",
932
- "image",
933
- "reset",
934
- "submit"
935
- ], Xn = [
936
- "email",
937
- "month",
938
- "password",
939
- "search",
940
- "tel",
941
- "text",
942
- "url",
943
- "week"
944
- ];
945
- $.keyup = (e, t, n) => {
946
- var i;
947
- return (i = tt[e.key]) === null || i === void 0 ? void 0 : i.call(tt, e, t, n);
948
- };
949
- const tt = {
950
- " ": (e, t, n) => {
951
- if (St(t))
952
- return () => n.dispatchUIEvent(t, "click");
953
- }
954
- };
955
- $.paste = (e, t, n) => {
956
- if (te(t))
957
- return () => {
958
- var i;
959
- const r = (i = e.clipboardData) === null || i === void 0 ? void 0 : i.getData("text");
960
- r && re(n, t, r, "insertFromPaste");
961
- };
962
- };
963
- const Mt = {
964
- auxclick: {
965
- EventType: "PointerEvent",
966
- defaultInit: {
967
- bubbles: !0,
968
- cancelable: !0,
969
- composed: !0
970
- }
971
- },
972
- beforeinput: {
973
- EventType: "InputEvent",
974
- defaultInit: {
975
- bubbles: !0,
976
- cancelable: !0,
977
- composed: !0
978
- }
979
- },
980
- blur: {
981
- EventType: "FocusEvent",
982
- defaultInit: {
983
- bubbles: !1,
984
- cancelable: !1,
985
- composed: !0
986
- }
987
- },
988
- click: {
989
- EventType: "PointerEvent",
990
- defaultInit: {
991
- bubbles: !0,
992
- cancelable: !0,
993
- composed: !0
994
- }
995
- },
996
- contextmenu: {
997
- EventType: "PointerEvent",
998
- defaultInit: {
999
- bubbles: !0,
1000
- cancelable: !0,
1001
- composed: !0
1002
- }
1003
- },
1004
- copy: {
1005
- EventType: "ClipboardEvent",
1006
- defaultInit: {
1007
- bubbles: !0,
1008
- cancelable: !0,
1009
- composed: !0
1010
- }
1011
- },
1012
- change: {
1013
- EventType: "Event",
1014
- defaultInit: {
1015
- bubbles: !0,
1016
- cancelable: !1
1017
- }
1018
- },
1019
- cut: {
1020
- EventType: "ClipboardEvent",
1021
- defaultInit: {
1022
- bubbles: !0,
1023
- cancelable: !0,
1024
- composed: !0
1025
- }
1026
- },
1027
- dblclick: {
1028
- EventType: "MouseEvent",
1029
- defaultInit: {
1030
- bubbles: !0,
1031
- cancelable: !0,
1032
- composed: !0
1033
- }
1034
- },
1035
- focus: {
1036
- EventType: "FocusEvent",
1037
- defaultInit: {
1038
- bubbles: !1,
1039
- cancelable: !1,
1040
- composed: !0
1041
- }
1042
- },
1043
- focusin: {
1044
- EventType: "FocusEvent",
1045
- defaultInit: {
1046
- bubbles: !0,
1047
- cancelable: !1,
1048
- composed: !0
1049
- }
1050
- },
1051
- focusout: {
1052
- EventType: "FocusEvent",
1053
- defaultInit: {
1054
- bubbles: !0,
1055
- cancelable: !1,
1056
- composed: !0
1057
- }
1058
- },
1059
- keydown: {
1060
- EventType: "KeyboardEvent",
1061
- defaultInit: {
1062
- bubbles: !0,
1063
- cancelable: !0,
1064
- composed: !0
1065
- }
1066
- },
1067
- keypress: {
1068
- EventType: "KeyboardEvent",
1069
- defaultInit: {
1070
- bubbles: !0,
1071
- cancelable: !0,
1072
- composed: !0
1073
- }
1074
- },
1075
- keyup: {
1076
- EventType: "KeyboardEvent",
1077
- defaultInit: {
1078
- bubbles: !0,
1079
- cancelable: !0,
1080
- composed: !0
1081
- }
1082
- },
1083
- paste: {
1084
- EventType: "ClipboardEvent",
1085
- defaultInit: {
1086
- bubbles: !0,
1087
- cancelable: !0,
1088
- composed: !0
1089
- }
1090
- },
1091
- input: {
1092
- EventType: "InputEvent",
1093
- defaultInit: {
1094
- bubbles: !0,
1095
- cancelable: !1,
1096
- composed: !0
1097
- }
1098
- },
1099
- mousedown: {
1100
- EventType: "MouseEvent",
1101
- defaultInit: {
1102
- bubbles: !0,
1103
- cancelable: !0,
1104
- composed: !0
1105
- }
1106
- },
1107
- mouseenter: {
1108
- EventType: "MouseEvent",
1109
- defaultInit: {
1110
- bubbles: !1,
1111
- cancelable: !1,
1112
- composed: !0
1113
- }
1114
- },
1115
- mouseleave: {
1116
- EventType: "MouseEvent",
1117
- defaultInit: {
1118
- bubbles: !1,
1119
- cancelable: !1,
1120
- composed: !0
1121
- }
1122
- },
1123
- mousemove: {
1124
- EventType: "MouseEvent",
1125
- defaultInit: {
1126
- bubbles: !0,
1127
- cancelable: !0,
1128
- composed: !0
1129
- }
1130
- },
1131
- mouseout: {
1132
- EventType: "MouseEvent",
1133
- defaultInit: {
1134
- bubbles: !0,
1135
- cancelable: !0,
1136
- composed: !0
1137
- }
1138
- },
1139
- mouseover: {
1140
- EventType: "MouseEvent",
1141
- defaultInit: {
1142
- bubbles: !0,
1143
- cancelable: !0,
1144
- composed: !0
1145
- }
1146
- },
1147
- mouseup: {
1148
- EventType: "MouseEvent",
1149
- defaultInit: {
1150
- bubbles: !0,
1151
- cancelable: !0,
1152
- composed: !0
1153
- }
1154
- },
1155
- pointerover: {
1156
- EventType: "PointerEvent",
1157
- defaultInit: {
1158
- bubbles: !0,
1159
- cancelable: !0,
1160
- composed: !0
1161
- }
1162
- },
1163
- pointerenter: {
1164
- EventType: "PointerEvent",
1165
- defaultInit: {
1166
- bubbles: !1,
1167
- cancelable: !1
1168
- }
1169
- },
1170
- pointerdown: {
1171
- EventType: "PointerEvent",
1172
- defaultInit: {
1173
- bubbles: !0,
1174
- cancelable: !0,
1175
- composed: !0
1176
- }
1177
- },
1178
- pointermove: {
1179
- EventType: "PointerEvent",
1180
- defaultInit: {
1181
- bubbles: !0,
1182
- cancelable: !0,
1183
- composed: !0
1184
- }
1185
- },
1186
- pointerup: {
1187
- EventType: "PointerEvent",
1188
- defaultInit: {
1189
- bubbles: !0,
1190
- cancelable: !0,
1191
- composed: !0
1192
- }
1193
- },
1194
- pointercancel: {
1195
- EventType: "PointerEvent",
1196
- defaultInit: {
1197
- bubbles: !0,
1198
- cancelable: !1,
1199
- composed: !0
1200
- }
1201
- },
1202
- pointerout: {
1203
- EventType: "PointerEvent",
1204
- defaultInit: {
1205
- bubbles: !0,
1206
- cancelable: !0,
1207
- composed: !0
1208
- }
1209
- },
1210
- pointerleave: {
1211
- EventType: "PointerEvent",
1212
- defaultInit: {
1213
- bubbles: !1,
1214
- cancelable: !1
1215
- }
1216
- },
1217
- submit: {
1218
- EventType: "Event",
1219
- defaultInit: {
1220
- bubbles: !0,
1221
- cancelable: !0
1222
- }
1223
- }
1224
- };
1225
- function Lt(e) {
1226
- return Mt[e].EventType;
1227
- }
1228
- const Yn = [
1229
- "MouseEvent",
1230
- "PointerEvent"
1231
- ];
1232
- function Jn(e) {
1233
- return Yn.includes(Lt(e));
1234
- }
1235
- function Qn(e) {
1236
- return Lt(e) === "KeyboardEvent";
1237
- }
1238
- const Zn = {
1239
- ClipboardEvent: [
1240
- ti
1241
- ],
1242
- Event: [],
1243
- FocusEvent: [
1244
- de,
1245
- ni
1246
- ],
1247
- InputEvent: [
1248
- de,
1249
- ii
1250
- ],
1251
- MouseEvent: [
1252
- de,
1253
- Be,
1254
- nt
1255
- ],
1256
- PointerEvent: [
1257
- de,
1258
- Be,
1259
- nt,
1260
- oi
1261
- ],
1262
- KeyboardEvent: [
1263
- de,
1264
- Be,
1265
- ri
1266
- ]
1267
- };
1268
- function $t(e, t, n) {
1269
- const i = _(t), { EventType: r, defaultInit: o } = Mt[e], s = new (ei(i))[r](e, o);
1270
- return Zn[r].forEach((u) => u(s, n ?? {})), s;
1271
- }
1272
- function ei(e) {
1273
- var t;
1274
- const n = (t = e.Event) !== null && t !== void 0 ? t : class {
1275
- };
1276
- var i;
1277
- const r = (i = e.AnimationEvent) !== null && i !== void 0 ? i : class extends n {
1278
- };
1279
- var o;
1280
- const s = (o = e.ClipboardEvent) !== null && o !== void 0 ? o : class extends n {
1281
- };
1282
- var u;
1283
- const l = (u = e.PopStateEvent) !== null && u !== void 0 ? u : class extends n {
1284
- };
1285
- var a;
1286
- const c = (a = e.ProgressEvent) !== null && a !== void 0 ? a : class extends n {
1287
- };
1288
- var f;
1289
- const m = (f = e.TransitionEvent) !== null && f !== void 0 ? f : class extends n {
1290
- };
1291
- var y;
1292
- const C = (y = e.UIEvent) !== null && y !== void 0 ? y : class extends n {
1293
- };
1294
- var N;
1295
- const ue = (N = e.CompositionEvent) !== null && N !== void 0 ? N : class extends C {
1296
- };
1297
- var R;
1298
- const le = (R = e.FocusEvent) !== null && R !== void 0 ? R : class extends C {
1299
- };
1300
- var V;
1301
- const ae = (V = e.InputEvent) !== null && V !== void 0 ? V : class extends C {
1302
- };
1303
- var H;
1304
- const ce = (H = e.KeyboardEvent) !== null && H !== void 0 ? H : class extends C {
1305
- };
1306
- var K;
1307
- const j = (K = e.MouseEvent) !== null && K !== void 0 ? K : class extends C {
1308
- };
1309
- var q;
1310
- const en = (q = e.DragEvent) !== null && q !== void 0 ? q : class extends j {
1311
- };
1312
- var De;
1313
- const tn = (De = e.PointerEvent) !== null && De !== void 0 ? De : class extends j {
1314
- };
1315
- var Ue;
1316
- const nn = (Ue = e.TouchEvent) !== null && Ue !== void 0 ? Ue : class extends C {
1317
- };
1318
- return {
1319
- Event: n,
1320
- AnimationEvent: r,
1321
- ClipboardEvent: s,
1322
- PopStateEvent: l,
1323
- ProgressEvent: c,
1324
- TransitionEvent: m,
1325
- UIEvent: C,
1326
- CompositionEvent: ue,
1327
- FocusEvent: le,
1328
- InputEvent: ae,
1329
- KeyboardEvent: ce,
1330
- MouseEvent: j,
1331
- DragEvent: en,
1332
- PointerEvent: tn,
1333
- TouchEvent: nn
1334
- };
1335
- }
1336
- function F(e, t) {
1337
- for (const [n, i] of Object.entries(t))
1338
- Object.defineProperty(e, n, {
1339
- get: () => i ?? null
1340
- });
1341
- }
1342
- function E(e) {
1343
- return Number(e ?? 0);
1344
- }
1345
- function ti(e, { clipboardData: t }) {
1346
- F(e, {
1347
- clipboardData: t
1348
- });
1349
- }
1350
- function ni(e, { relatedTarget: t }) {
1351
- F(e, {
1352
- relatedTarget: t
1353
- });
1354
- }
1355
- function ii(e, { data: t, inputType: n, isComposing: i }) {
1356
- F(e, {
1357
- data: t,
1358
- isComposing: !!i,
1359
- inputType: String(n)
1360
- });
1361
- }
1362
- function de(e, { view: t, detail: n }) {
1363
- F(e, {
1364
- view: t,
1365
- detail: E(n ?? 0)
1366
- });
1367
- }
1368
- function Be(e, { altKey: t, ctrlKey: n, metaKey: i, shiftKey: r, modifierAltGraph: o, modifierCapsLock: s, modifierFn: u, modifierFnLock: l, modifierNumLock: a, modifierScrollLock: c, modifierSymbol: f, modifierSymbolLock: m }) {
1369
- F(e, {
1370
- altKey: !!t,
1371
- ctrlKey: !!n,
1372
- metaKey: !!i,
1373
- shiftKey: !!r,
1374
- getModifierState(y) {
1375
- return !!{
1376
- Alt: t,
1377
- AltGraph: o,
1378
- CapsLock: s,
1379
- Control: n,
1380
- Fn: u,
1381
- FnLock: l,
1382
- Meta: i,
1383
- NumLock: a,
1384
- ScrollLock: c,
1385
- Shift: r,
1386
- Symbol: f,
1387
- SymbolLock: m
1388
- }[y];
1389
- }
1390
- });
1391
- }
1392
- function ri(e, { key: t, code: n, location: i, repeat: r, isComposing: o, charCode: s }) {
1393
- F(e, {
1394
- key: String(t),
1395
- code: String(n),
1396
- location: E(i),
1397
- repeat: !!r,
1398
- isComposing: !!o,
1399
- charCode: s
1400
- });
1401
- }
1402
- function nt(e, { x: t, y: n, screenX: i, screenY: r, clientX: o = t, clientY: s = n, button: u, buttons: l, relatedTarget: a, offsetX: c, offsetY: f, pageX: m, pageY: y }) {
1403
- F(e, {
1404
- screenX: E(i),
1405
- screenY: E(r),
1406
- clientX: E(o),
1407
- x: E(o),
1408
- clientY: E(s),
1409
- y: E(s),
1410
- button: E(u),
1411
- buttons: E(l),
1412
- relatedTarget: a,
1413
- offsetX: E(c),
1414
- offsetY: E(f),
1415
- pageX: E(m),
1416
- pageY: E(y)
1417
- });
1418
- }
1419
- function oi(e, { pointerId: t, width: n, height: i, pressure: r, tangentialPressure: o, tiltX: s, tiltY: u, twist: l, pointerType: a, isPrimary: c }) {
1420
- F(e, {
1421
- pointerId: E(t),
1422
- width: E(n ?? 1),
1423
- height: E(i ?? 1),
1424
- pressure: E(r),
1425
- tangentialPressure: E(o),
1426
- tiltX: E(s),
1427
- tiltY: E(u),
1428
- twist: E(l),
1429
- pointerType: String(a),
1430
- isPrimary: !!c
1431
- });
1432
- }
1433
- function si(e, t, n, i = !1) {
1434
- (Jn(t) || Qn(t)) && (n = {
1435
- ...n,
1436
- ...this.system.getUIEventModifiers()
1437
- });
1438
- const r = $t(t, e, n);
1439
- return Ft.call(this, e, r, i);
1440
- }
1441
- function Ft(e, t, n = !1) {
1442
- var i;
1443
- const r = t.type, o = n ? () => {
1444
- } : (i = $[r]) === null || i === void 0 ? void 0 : i.call($, t, e, this);
1445
- if (o) {
1446
- t.preventDefault();
1447
- let s = !1;
1448
- return Object.defineProperty(t, "defaultPrevented", {
1449
- get: () => s
1450
- }), Object.defineProperty(t, "preventDefault", {
1451
- value: () => {
1452
- s = t.cancelable;
1453
- }
1454
- }), ne(() => e.dispatchEvent(t)), s || o(), !s;
1455
- }
1456
- return ne(() => e.dispatchEvent(t));
1457
- }
1458
- function W(e, t, n) {
1459
- const i = $t(t, e, n);
1460
- ne(() => e.dispatchEvent(i));
1461
- }
1462
- const it = Symbol("patched focus/blur methods");
1463
- function Rt(e) {
1464
- if (e.prototype[it])
1465
- return;
1466
- const { focus: t, blur: n } = e.prototype;
1467
- Object.defineProperties(e.prototype, {
1468
- focus: {
1469
- configurable: !0,
1470
- get: () => r
1471
- },
1472
- blur: {
1473
- configurable: !0,
1474
- get: () => o
1475
- },
1476
- [it]: {
1477
- configurable: !0,
1478
- get: () => ({
1479
- focus: t,
1480
- blur: n
1481
- })
1482
- }
1483
- });
1484
- let i;
1485
- function r(s) {
1486
- if (this.ownerDocument.visibilityState !== "hidden")
1487
- return t.call(this, s);
1488
- const u = rt(this.ownerDocument);
1489
- if (u === this)
1490
- return;
1491
- const l = Symbol("focus call");
1492
- i = l, u && (n.call(u), W(u, "blur", {
1493
- relatedTarget: this
1494
- }), W(u, "focusout", {
1495
- relatedTarget: i === l ? this : null
1496
- })), i === l && (t.call(this, s), W(this, "focus", {
1497
- relatedTarget: u
1498
- })), i === l && W(this, "focusin", {
1499
- relatedTarget: u
1500
- });
1501
- }
1502
- function o() {
1503
- if (this.ownerDocument.visibilityState !== "hidden")
1504
- return n.call(this);
1505
- const s = rt(this.ownerDocument);
1506
- if (s !== this)
1507
- return;
1508
- i = Symbol("blur call"), n.call(this), W(s, "blur", {
1509
- relatedTarget: null
1510
- }), W(s, "focusout", {
1511
- relatedTarget: null
1512
- });
1513
- }
1514
- }
1515
- function rt(e) {
1516
- const t = ye(e);
1517
- return (t == null ? void 0 : t.tagName) === "BODY" ? null : t;
1518
- }
1519
- const Me = Symbol("Interceptor for programmatical calls");
1520
- function Q(e, t, n) {
1521
- const i = Object.getOwnPropertyDescriptor(e.constructor.prototype, t), r = Object.getOwnPropertyDescriptor(e, t), o = i != null && i.set ? "set" : "value";
1522
- if (typeof (i == null ? void 0 : i[o]) != "function" || i[o][Me])
1523
- throw new Error(`Element ${e.tagName} does not implement "${String(t)}".`);
1524
- function s(...u) {
1525
- const { applyNative: l = !1, realArgs: a, then: c } = n.call(this, ...u), f = (!l && r || i)[o];
1526
- o === "set" ? f.call(this, a) : f.call(this, ...a), c == null || c();
1527
- }
1528
- s[Me] = Me, Object.defineProperty(e, t, {
1529
- ...r ?? i,
1530
- [o]: s
1531
- });
1532
- }
1533
- function ui(e) {
1534
- Q(e, "value", function(n) {
1535
- const i = wn(n);
1536
- return i && Nn(this), {
1537
- applyNative: !!i,
1538
- realArgs: li(this, n),
1539
- then: i ? void 0 : () => Bn(this, String(n))
1540
- };
1541
- });
1542
- }
1543
- function li(e, t) {
1544
- return d(e, "input", {
1545
- type: "number"
1546
- }) && String(t) !== "" && !Number.isNaN(Number(t)) ? String(Number(t)) : String(t);
1547
- }
1548
- function ai(e) {
1549
- Q(e, "setSelectionRange", function(n, ...i) {
1550
- const r = Cn(n);
1551
- return {
1552
- applyNative: !!r,
1553
- realArgs: [
1554
- Number(n),
1555
- ...i
1556
- ],
1557
- then: () => r ? void 0 : Se(e)
1558
- };
1559
- }), Q(e, "selectionStart", function(n) {
1560
- return {
1561
- realArgs: n,
1562
- then: () => Se(e)
1563
- };
1564
- }), Q(e, "selectionEnd", function(n) {
1565
- return {
1566
- realArgs: n,
1567
- then: () => Se(e)
1568
- };
1569
- }), Q(e, "select", function() {
1570
- return {
1571
- realArgs: [],
1572
- then: () => Sn(e, {
1573
- anchorOffset: 0,
1574
- focusOffset: A(e).length
1575
- })
1576
- };
1577
- });
1578
- }
1579
- function ci(e) {
1580
- Q(e, "setRangeText", function(...n) {
1581
- return {
1582
- realArgs: n,
1583
- then: () => {
1584
- qe(e), Se(e);
1585
- }
1586
- };
1587
- });
1588
- }
1589
- const Z = Symbol("Node prepared with document state workarounds");
1590
- function Vt(e) {
1591
- e[Z] || (e.addEventListener("focus", (t) => {
1592
- const n = t.target;
1593
- ot(n);
1594
- }, {
1595
- capture: !0,
1596
- passive: !0
1597
- }), e.activeElement && ot(e.activeElement), e.addEventListener("blur", (t) => {
1598
- const n = t.target, i = kn(n);
1599
- i !== void 0 && (n.value !== i && W(n, "change"), Ot(n));
1600
- }, {
1601
- capture: !0,
1602
- passive: !0
1603
- }), e[Z] = Z);
1604
- }
1605
- function ot(e) {
1606
- e[Z] || (d(e, [
1607
- "input",
1608
- "textarea"
1609
- ]) && (ui(e), ai(e), ci(e)), e[Z] = Z);
1610
- }
1611
- function di(e) {
1612
- return fi(e) ? e : e.ownerDocument;
1613
- }
1614
- function fi(e) {
1615
- return e.nodeType === 9;
1616
- }
1617
- var S = /* @__PURE__ */ function(e) {
1618
- return e[e.Trigger = 2] = "Trigger", e[e.Call = 1] = "Call", e;
1619
- }({});
1620
- function pe(e, t) {
1621
- e.levelRefs[t] = {};
1622
- }
1623
- function Te(e, t) {
1624
- return e.levelRefs[t];
1625
- }
1626
- function oe(e) {
1627
- const t = e.delay;
1628
- if (typeof t == "number")
1629
- return Promise.all([
1630
- new Promise((n) => globalThis.setTimeout(() => n(), t)),
1631
- e.advanceTimers(t)
1632
- ]);
1633
- }
1634
- var _e = /* @__PURE__ */ function(e) {
1635
- return e[e.EachTrigger = 4] = "EachTrigger", e[e.EachApiCall = 2] = "EachApiCall", e[e.EachTarget = 1] = "EachTarget", e[e.Never = 0] = "Never", e;
1636
- }({});
1637
- function z(e, t, n) {
1638
- return t in e ? Object.defineProperty(e, t, {
1639
- value: n,
1640
- enumerable: !0,
1641
- configurable: !0,
1642
- writable: !0
1643
- }) : e[t] = n, e;
1644
- }
1645
- var P = /* @__PURE__ */ function(e) {
1646
- return e[e.STANDARD = 0] = "STANDARD", e[e.LEFT = 1] = "LEFT", e[e.RIGHT = 2] = "RIGHT", e[e.NUMPAD = 3] = "NUMPAD", e;
1647
- }({});
1648
- const pi = [
1649
- "Alt",
1650
- "AltGraph",
1651
- "Control",
1652
- "Fn",
1653
- "Meta",
1654
- "Shift",
1655
- "Symbol"
1656
- ];
1657
- function st(e) {
1658
- return pi.includes(e);
1659
- }
1660
- const hi = [
1661
- "CapsLock",
1662
- "FnLock",
1663
- "NumLock",
1664
- "ScrollLock",
1665
- "SymbolLock"
1666
- ];
1667
- function ut(e) {
1668
- return hi.includes(e);
1669
- }
1670
- class bi {
1671
- isKeyPressed(t) {
1672
- return this.pressed.has(String(t.code));
1673
- }
1674
- getPressedKeys() {
1675
- return this.pressed.values().map((t) => t.keyDef);
1676
- }
1677
- /** Press a key */
1678
- async keydown(t, n) {
1679
- const i = String(n.key), r = String(n.code), o = Ne(t.config.document);
1680
- this.setKeydownTarget(o), this.pressed.add(r, n), st(i) && (this.modifiers[i] = !0);
1681
- const s = t.dispatchUIEvent(o, "keydown", {
1682
- key: i,
1683
- code: r
1684
- });
1685
- ut(i) && !this.modifiers[i] && (this.modifiers[i] = !0, this.modifierLockStart[i] = !0), s && this.pressed.setUnprevented(r), s && this.hasKeyPress(i) && t.dispatchUIEvent(Ne(t.config.document), "keypress", {
1686
- key: i,
1687
- code: r,
1688
- charCode: n.key === "Enter" ? 13 : String(n.key).charCodeAt(0)
1689
- });
1690
- }
1691
- /** Release a key */
1692
- async keyup(t, n) {
1693
- const i = String(n.key), r = String(n.code), o = this.pressed.isUnprevented(r);
1694
- this.pressed.delete(r), st(i) && !this.pressed.values().find((s) => s.keyDef.key === i) && (this.modifiers[i] = !1), t.dispatchUIEvent(Ne(t.config.document), "keyup", {
1695
- key: i,
1696
- code: r
1697
- }, !o), ut(i) && this.modifiers[i] && (this.modifierLockStart[i] ? this.modifierLockStart[i] = !1 : this.modifiers[i] = !1);
1698
- }
1699
- setKeydownTarget(t) {
1700
- t !== this.lastKeydownTarget && (this.carryChar = ""), this.lastKeydownTarget = t;
1701
- }
1702
- hasKeyPress(t) {
1703
- return (t.length === 1 || t === "Enter") && !this.modifiers.Control && !this.modifiers.Alt;
1704
- }
1705
- constructor(t) {
1706
- z(this, "system", void 0), z(this, "modifiers", {
1707
- Alt: !1,
1708
- AltGraph: !1,
1709
- CapsLock: !1,
1710
- Control: !1,
1711
- Fn: !1,
1712
- FnLock: !1,
1713
- Meta: !1,
1714
- NumLock: !1,
1715
- ScrollLock: !1,
1716
- Shift: !1,
1717
- Symbol: !1,
1718
- SymbolLock: !1
1719
- }), z(this, "pressed", new class {
1720
- add(n, i) {
1721
- var r, o, s;
1722
- (s = (r = this.registry)[o = n]) !== null && s !== void 0 || (r[o] = {
1723
- keyDef: i,
1724
- unpreventedDefault: !1
1725
- });
1726
- }
1727
- has(n) {
1728
- return !!this.registry[n];
1729
- }
1730
- setUnprevented(n) {
1731
- const i = this.registry[n];
1732
- i && (i.unpreventedDefault = !0);
1733
- }
1734
- isUnprevented(n) {
1735
- var i;
1736
- return !!(!((i = this.registry[n]) === null || i === void 0) && i.unpreventedDefault);
1737
- }
1738
- delete(n) {
1739
- delete this.registry[n];
1740
- }
1741
- values() {
1742
- return Object.values(this.registry);
1743
- }
1744
- constructor() {
1745
- z(this, "registry", {});
1746
- }
1747
- }()), z(this, "carryChar", ""), z(this, "lastKeydownTarget", void 0), z(this, "modifierLockStart", {}), this.system = t;
1748
- }
1749
- }
1750
- const gi = [
1751
- // alphanumeric block - writing system
1752
- ..."0123456789".split("").map((e) => ({
1753
- code: `Digit${e}`,
1754
- key: e
1755
- })),
1756
- ...")!@#$%^&*(".split("").map((e, t) => ({
1757
- code: `Digit${t}`,
1758
- key: e,
1759
- shiftKey: !0
1760
- })),
1761
- ..."abcdefghijklmnopqrstuvwxyz".split("").map((e) => ({
1762
- code: `Key${e.toUpperCase()}`,
1763
- key: e
1764
- })),
1765
- ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((e) => ({
1766
- code: `Key${e}`,
1767
- key: e,
1768
- shiftKey: !0
1769
- })),
1770
- {
1771
- code: "BracketLeft",
1772
- key: "["
1773
- },
1774
- {
1775
- code: "BracketLeft",
1776
- key: "{",
1777
- shiftKey: !0
1778
- },
1779
- {
1780
- code: "BracketRight",
1781
- key: "]"
1782
- },
1783
- {
1784
- code: "BracketRight",
1785
- key: "}",
1786
- shiftKey: !0
1787
- },
1788
- // alphanumeric block - functional
1789
- {
1790
- code: "Space",
1791
- key: " "
1792
- },
1793
- {
1794
- code: "AltLeft",
1795
- key: "Alt",
1796
- location: P.LEFT
1797
- },
1798
- {
1799
- code: "AltRight",
1800
- key: "Alt",
1801
- location: P.RIGHT
1802
- },
1803
- {
1804
- code: "ShiftLeft",
1805
- key: "Shift",
1806
- location: P.LEFT
1807
- },
1808
- {
1809
- code: "ShiftRight",
1810
- key: "Shift",
1811
- location: P.RIGHT
1812
- },
1813
- {
1814
- code: "ControlLeft",
1815
- key: "Control",
1816
- location: P.LEFT
1817
- },
1818
- {
1819
- code: "ControlRight",
1820
- key: "Control",
1821
- location: P.RIGHT
1822
- },
1823
- {
1824
- code: "MetaLeft",
1825
- key: "Meta",
1826
- location: P.LEFT
1827
- },
1828
- {
1829
- code: "MetaRight",
1830
- key: "Meta",
1831
- location: P.RIGHT
1832
- },
1833
- {
1834
- code: "OSLeft",
1835
- key: "OS",
1836
- location: P.LEFT
1837
- },
1838
- {
1839
- code: "OSRight",
1840
- key: "OS",
1841
- location: P.RIGHT
1842
- },
1843
- {
1844
- code: "ContextMenu",
1845
- key: "ContextMenu"
1846
- },
1847
- {
1848
- code: "Tab",
1849
- key: "Tab"
1850
- },
1851
- {
1852
- code: "CapsLock",
1853
- key: "CapsLock"
1854
- },
1855
- {
1856
- code: "Backspace",
1857
- key: "Backspace"
1858
- },
1859
- {
1860
- code: "Enter",
1861
- key: "Enter"
1862
- },
1863
- // function
1864
- {
1865
- code: "Escape",
1866
- key: "Escape"
1867
- },
1868
- // arrows
1869
- {
1870
- code: "ArrowUp",
1871
- key: "ArrowUp"
1872
- },
1873
- {
1874
- code: "ArrowDown",
1875
- key: "ArrowDown"
1876
- },
1877
- {
1878
- code: "ArrowLeft",
1879
- key: "ArrowLeft"
1880
- },
1881
- {
1882
- code: "ArrowRight",
1883
- key: "ArrowRight"
1884
- },
1885
- // control pad
1886
- {
1887
- code: "Home",
1888
- key: "Home"
1889
- },
1890
- {
1891
- code: "End",
1892
- key: "End"
1893
- },
1894
- {
1895
- code: "Delete",
1896
- key: "Delete"
1897
- },
1898
- {
1899
- code: "PageUp",
1900
- key: "PageUp"
1901
- },
1902
- {
1903
- code: "PageDown",
1904
- key: "PageDown"
1905
- },
1906
- // Special keys that are not part of a default US-layout but included for specific behavior
1907
- {
1908
- code: "Fn",
1909
- key: "Fn"
1910
- },
1911
- {
1912
- code: "Symbol",
1913
- key: "Symbol"
1914
- },
1915
- {
1916
- code: "AltRight",
1917
- key: "AltGraph"
1918
- }
1919
- ], vi = [
1920
- {
1921
- name: "MouseLeft",
1922
- pointerType: "mouse",
1923
- button: "primary"
1924
- },
1925
- {
1926
- name: "MouseRight",
1927
- pointerType: "mouse",
1928
- button: "secondary"
1929
- },
1930
- {
1931
- name: "MouseMiddle",
1932
- pointerType: "mouse",
1933
- button: "auxiliary"
1934
- },
1935
- {
1936
- name: "TouchA",
1937
- pointerType: "touch"
1938
- },
1939
- {
1940
- name: "TouchB",
1941
- pointerType: "touch"
1942
- },
1943
- {
1944
- name: "TouchC",
1945
- pointerType: "touch"
1946
- }
1947
- ];
1948
- function mi(e, t, n) {
1949
- return t in e ? Object.defineProperty(e, t, {
1950
- value: n,
1951
- enumerable: !0,
1952
- configurable: !0,
1953
- writable: !0
1954
- }) : e[t] = n, e;
1955
- }
1956
- class Ht {
1957
- getButtons() {
1958
- let t = 0;
1959
- for (const n of Object.keys(this.pressed))
1960
- t |= 2 ** Number(n);
1961
- return t;
1962
- }
1963
- down(t) {
1964
- const n = $e(t.button);
1965
- if (n in this.pressed) {
1966
- this.pressed[n].push(t);
1967
- return;
1968
- }
1969
- return this.pressed[n] = [
1970
- t
1971
- ], n;
1972
- }
1973
- up(t) {
1974
- const n = $e(t.button);
1975
- if (n in this.pressed && (this.pressed[n] = this.pressed[n].filter((i) => i.name !== t.name), this.pressed[n].length === 0))
1976
- return delete this.pressed[n], n;
1977
- }
1978
- constructor() {
1979
- mi(this, "pressed", {});
1980
- }
1981
- }
1982
- const lt = {
1983
- primary: 0,
1984
- secondary: 1,
1985
- auxiliary: 2,
1986
- back: 3,
1987
- X1: 3,
1988
- forward: 4,
1989
- X2: 4
1990
- };
1991
- function $e(e = 0) {
1992
- return e in lt ? lt[e] : Number(e);
1993
- }
1994
- const at = {
1995
- 1: 2,
1996
- 2: 1
1997
- };
1998
- function Fe(e) {
1999
- return e = $e(e), e in at ? at[e] : e;
2000
- }
2001
- function yi(e, t, n) {
2002
- return t in e ? Object.defineProperty(e, t, {
2003
- value: n,
2004
- enumerable: !0,
2005
- configurable: !0,
2006
- writable: !0
2007
- }) : e[t] = n, e;
2008
- }
2009
- class Ei {
2010
- get countPressed() {
2011
- return this.pressedKeys.size;
2012
- }
2013
- isPressed(t) {
2014
- return this.pressedKeys.has(t.name);
2015
- }
2016
- addPressed(t) {
2017
- return this.pressedKeys.add(t.name);
2018
- }
2019
- removePressed(t) {
2020
- return this.pressedKeys.delete(t.name);
2021
- }
2022
- constructor() {
2023
- yi(this, "pressedKeys", /* @__PURE__ */ new Set());
2024
- }
2025
- }
2026
- function be(e, t) {
2027
- const n = [];
2028
- for (let o = e; o; o = o.parentElement)
2029
- n.push(o);
2030
- const i = [];
2031
- for (let o = t; o; o = o.parentElement)
2032
- i.push(o);
2033
- let r = 0;
2034
- for (; !(r >= n.length || r >= i.length || n[n.length - 1 - r] !== i[i.length - 1 - r]); r++)
2035
- ;
2036
- return [
2037
- n.slice(0, n.length - r),
2038
- i.slice(0, i.length - r),
2039
- i.slice(i.length - r)
2040
- ];
2041
- }
2042
- function Re({ target: e, node: t, offset: n }) {
2043
- return O(e) ? {
2044
- node: e,
2045
- offset: n ?? A(e).length
2046
- } : t ? {
2047
- node: t,
2048
- offset: n ?? (t.nodeType === 3 ? t.nodeValue.length : t.childNodes.length)
2049
- } : Kt(e, n);
2050
- }
2051
- function Kt(e, t, n = !0) {
2052
- let i = t === void 0 ? e.childNodes.length - 1 : 0;
2053
- const r = t === void 0 ? -1 : 1;
2054
- for (; t === void 0 ? i >= (n ? Math.max(e.childNodes.length - 1, 0) : 0) : i <= e.childNodes.length; ) {
2055
- if (t && i === e.childNodes.length)
2056
- throw new Error("The given offset is out of bounds.");
2057
- const o = e.childNodes.item(i), s = String(o.textContent);
2058
- if (s.length)
2059
- if (t !== void 0 && s.length < t)
2060
- t -= s.length;
2061
- else {
2062
- if (o.nodeType === 1)
2063
- return Kt(o, t, !1);
2064
- if (o.nodeType === 3)
2065
- return {
2066
- node: o,
2067
- offset: t ?? o.nodeValue.length
2068
- };
2069
- }
2070
- i += r;
2071
- }
2072
- return {
2073
- node: e,
2074
- offset: e.childNodes.length
2075
- };
2076
- }
2077
- function wi({ document: e, target: t, clickCount: n, node: i, offset: r }) {
2078
- if (mn(t))
2079
- return;
2080
- const o = O(t), s = String(o ? A(t) : t.textContent), [u, l] = i ? (
2081
- // which elements might be considered in the same line of text.
2082
- // TODO: support expanding initial range on multiple clicks if node is given
2083
- [
2084
- r,
2085
- r
2086
- ]
2087
- ) : Ci(s, r, n);
2088
- if (o)
2089
- return se(t, {
2090
- anchorOffset: u ?? s.length,
2091
- focusOffset: l ?? s.length
2092
- }), {
2093
- node: t,
2094
- start: u ?? 0,
2095
- end: l ?? s.length
2096
- };
2097
- {
2098
- const { node: a, offset: c } = Re({
2099
- target: t,
2100
- node: i,
2101
- offset: u
2102
- }), { node: f, offset: m } = Re({
2103
- target: t,
2104
- node: i,
2105
- offset: l
2106
- }), y = t.ownerDocument.createRange();
2107
- try {
2108
- y.setStart(a, c), y.setEnd(f, m);
2109
- } catch {
2110
- throw new Error("The given offset is out of bounds.");
2111
- }
2112
- const C = e.getSelection();
2113
- return C == null || C.removeAllRanges(), C == null || C.addRange(y.cloneRange()), y;
2114
- }
2115
- }
2116
- function Ci(e, t, n) {
2117
- if (n % 3 === 1 || e.length === 0)
2118
- return [
2119
- t,
2120
- t
2121
- ];
2122
- const i = t ?? e.length;
2123
- return n % 3 === 2 ? [
2124
- i - e.substr(0, t).match(/(\w+|\s+|\W)?$/)[0].length,
2125
- t === void 0 ? t : t + e.substr(t).match(/^(\w+|\s+|\W)?/)[0].length
2126
- ] : [
2127
- i - e.substr(0, t).match(/[^\r\n]*$/)[0].length,
2128
- t === void 0 ? t : t + e.substr(t).match(/^[^\r\n]*/)[0].length
2129
- ];
2130
- }
2131
- function Ti(e, { document: t, target: n, node: i, offset: r }) {
2132
- const o = Re({
2133
- target: n,
2134
- node: i,
2135
- offset: r
2136
- });
2137
- if ("node" in e) {
2138
- if (o.node === e.node) {
2139
- const s = o.offset < e.start ? e.end : e.start, u = o.offset > e.end || o.offset < e.start ? o.offset : e.end;
2140
- se(e.node, {
2141
- anchorOffset: s,
2142
- focusOffset: u
2143
- });
2144
- }
2145
- } else {
2146
- const s = e.cloneRange(), u = s.comparePoint(o.node, o.offset);
2147
- u < 0 ? s.setStart(o.node, o.offset) : u > 0 && s.setEnd(o.node, o.offset);
2148
- const l = t.getSelection();
2149
- l == null || l.removeAllRanges(), l == null || l.addRange(s.cloneRange());
2150
- }
2151
- }
2152
- function jt(e, t) {
2153
- var n, i, r, o, s, u, l, a, c, f, m, y, C, N, ue, R, le, V, ae, H, ce, K, j, q;
2154
- return e.target !== t.target || ((n = e.coords) === null || n === void 0 ? void 0 : n.x) !== ((i = t.coords) === null || i === void 0 ? void 0 : i.x) || ((r = e.coords) === null || r === void 0 ? void 0 : r.y) !== ((o = t.coords) === null || o === void 0 ? void 0 : o.y) || ((s = e.coords) === null || s === void 0 ? void 0 : s.clientX) !== ((u = t.coords) === null || u === void 0 ? void 0 : u.clientX) || ((l = e.coords) === null || l === void 0 ? void 0 : l.clientY) !== ((a = t.coords) === null || a === void 0 ? void 0 : a.clientY) || ((c = e.coords) === null || c === void 0 ? void 0 : c.offsetX) !== ((f = t.coords) === null || f === void 0 ? void 0 : f.offsetX) || ((m = e.coords) === null || m === void 0 ? void 0 : m.offsetY) !== ((y = t.coords) === null || y === void 0 ? void 0 : y.offsetY) || ((C = e.coords) === null || C === void 0 ? void 0 : C.pageX) !== ((N = t.coords) === null || N === void 0 ? void 0 : N.pageX) || ((ue = e.coords) === null || ue === void 0 ? void 0 : ue.pageY) !== ((R = t.coords) === null || R === void 0 ? void 0 : R.pageY) || ((le = e.coords) === null || le === void 0 ? void 0 : le.screenX) !== ((V = t.coords) === null || V === void 0 ? void 0 : V.screenX) || ((ae = e.coords) === null || ae === void 0 ? void 0 : ae.screenY) !== ((H = t.coords) === null || H === void 0 ? void 0 : H.screenY) || ((ce = e.caret) === null || ce === void 0 ? void 0 : ce.node) !== ((K = t.caret) === null || K === void 0 ? void 0 : K.node) || ((j = e.caret) === null || j === void 0 ? void 0 : j.offset) !== ((q = t.caret) === null || q === void 0 ? void 0 : q.offset);
2155
- }
2156
- function G(e, t, n) {
2157
- return t in e ? Object.defineProperty(e, t, {
2158
- value: n,
2159
- enumerable: !0,
2160
- configurable: !0,
2161
- writable: !0
2162
- }) : e[t] = n, e;
2163
- }
2164
- class ki {
2165
- move(t, n, i) {
2166
- const r = this.position, o = this.getTarget(t);
2167
- if (this.position = n, !jt(r, n))
2168
- return;
2169
- const s = this.getTarget(t), u = this.getEventInit("mousemove"), [l, a] = be(o, s);
2170
- return {
2171
- leave: () => {
2172
- o !== s && (t.dispatchUIEvent(o, "mouseout", u), l.forEach((c) => t.dispatchUIEvent(c, "mouseleave", u)));
2173
- },
2174
- enter: () => {
2175
- o !== s && (t.dispatchUIEvent(s, "mouseover", u), a.forEach((c) => t.dispatchUIEvent(c, "mouseenter", u)));
2176
- },
2177
- move: () => {
2178
- i || (t.dispatchUIEvent(s, "mousemove", u), this.modifySelecting(t));
2179
- }
2180
- };
2181
- }
2182
- down(t, n, i) {
2183
- const r = this.buttons.down(n);
2184
- if (r === void 0)
2185
- return;
2186
- const o = this.getTarget(t);
2187
- this.buttonDownTarget[r] = o;
2188
- const s = this.getEventInit("mousedown", n.button), u = U(o);
2189
- !i && (u || t.dispatchUIEvent(o, "mousedown", s)) && (this.startSelecting(t, s.detail), L(o)), !u && Fe(n.button) === 2 && t.dispatchUIEvent(o, "contextmenu", this.getEventInit("contextmenu", n.button));
2190
- }
2191
- up(t, n, i) {
2192
- const r = this.buttons.up(n);
2193
- if (r === void 0)
2194
- return;
2195
- const o = this.getTarget(t);
2196
- if (!U(o)) {
2197
- if (!i) {
2198
- const u = this.getEventInit("mouseup", n.button);
2199
- t.dispatchUIEvent(o, "mouseup", u), this.endSelecting();
2200
- }
2201
- const s = be(this.buttonDownTarget[r], o)[2][0];
2202
- if (s) {
2203
- const u = this.getEventInit("click", n.button);
2204
- u.detail && (t.dispatchUIEvent(s, u.button === 0 ? "click" : "auxclick", u), u.button === 0 && u.detail === 2 && t.dispatchUIEvent(s, "dblclick", {
2205
- ...this.getEventInit("dblclick", n.button),
2206
- detail: u.detail
2207
- }));
2208
- }
2209
- }
2210
- }
2211
- resetClickCount() {
2212
- this.clickCount.reset();
2213
- }
2214
- getEventInit(t, n) {
2215
- const i = {
2216
- ...this.position.coords
2217
- };
2218
- return i.button = Fe(n), i.buttons = this.buttons.getButtons(), t === "mousedown" ? i.detail = this.clickCount.getOnDown(i.button) : t === "mouseup" ? i.detail = this.clickCount.getOnUp(i.button) : (t === "click" || t === "auxclick") && (i.detail = this.clickCount.incOnClick(i.button)), i;
2219
- }
2220
- getTarget(t) {
2221
- var n;
2222
- return (n = this.position.target) !== null && n !== void 0 ? n : t.config.document.body;
2223
- }
2224
- startSelecting(t, n) {
2225
- var i, r;
2226
- this.selecting = wi({
2227
- document: t.config.document,
2228
- target: this.getTarget(t),
2229
- node: (i = this.position.caret) === null || i === void 0 ? void 0 : i.node,
2230
- offset: (r = this.position.caret) === null || r === void 0 ? void 0 : r.offset,
2231
- clickCount: n
2232
- });
2233
- }
2234
- modifySelecting(t) {
2235
- var n, i;
2236
- this.selecting && Ti(this.selecting, {
2237
- document: t.config.document,
2238
- target: this.getTarget(t),
2239
- node: (n = this.position.caret) === null || n === void 0 ? void 0 : n.node,
2240
- offset: (i = this.position.caret) === null || i === void 0 ? void 0 : i.offset
2241
- });
2242
- }
2243
- endSelecting() {
2244
- this.selecting = void 0;
2245
- }
2246
- constructor() {
2247
- G(this, "position", {}), G(this, "buttons", new Ht()), G(this, "selecting", void 0), G(this, "buttonDownTarget", {}), G(this, "clickCount", new class {
2248
- incOnClick(t) {
2249
- const n = this.down[t] === void 0 ? void 0 : Number(this.down[t]) + 1;
2250
- return this.count = this.count[t] === void 0 ? {} : {
2251
- [t]: Number(this.count[t]) + 1
2252
- }, n;
2253
- }
2254
- getOnDown(t) {
2255
- var n;
2256
- this.down = {
2257
- [t]: (n = this.count[t]) !== null && n !== void 0 ? n : 0
2258
- };
2259
- var i;
2260
- return this.count = {
2261
- [t]: (i = this.count[t]) !== null && i !== void 0 ? i : 0
2262
- }, Number(this.count[t]) + 1;
2263
- }
2264
- getOnUp(t) {
2265
- return this.down[t] === void 0 ? void 0 : Number(this.down[t]) + 1;
2266
- }
2267
- reset() {
2268
- this.count = {};
2269
- }
2270
- constructor() {
2271
- G(this, "down", {}), G(this, "count", {});
2272
- }
2273
- }());
2274
- }
2275
- }
2276
- function xe(e, t) {
2277
- var n;
2278
- return ((n = qt(e, t)) === null || n === void 0 ? void 0 : n.pointerEvents) !== "none";
2279
- }
2280
- function Si(e) {
2281
- const t = _(e);
2282
- for (let n = e, i = []; n != null && n.ownerDocument; n = n.parentElement) {
2283
- i.push(n);
2284
- const r = t.getComputedStyle(n).pointerEvents;
2285
- if (r && ![
2286
- "inherit",
2287
- "unset"
2288
- ].includes(r))
2289
- return {
2290
- pointerEvents: r,
2291
- tree: i
2292
- };
2293
- }
2294
- }
2295
- const ct = Symbol("Last check for pointer-events");
2296
- function qt(e, t) {
2297
- const n = t[ct];
2298
- if (!(e.config.pointerEventsCheck !== _e.Never && (!n || dt(e.config.pointerEventsCheck, _e.EachApiCall) && n[S.Call] !== Te(e, S.Call) || dt(e.config.pointerEventsCheck, _e.EachTrigger) && n[S.Trigger] !== Te(e, S.Trigger))))
2299
- return n == null ? void 0 : n.result;
2300
- const r = Si(t);
2301
- return t[ct] = {
2302
- [S.Call]: Te(e, S.Call),
2303
- [S.Trigger]: Te(e, S.Trigger),
2304
- result: r
2305
- }, r;
2306
- }
2307
- function he(e, t) {
2308
- const n = qt(e, t);
2309
- if ((n == null ? void 0 : n.pointerEvents) === "none")
2310
- throw new Error([
2311
- `Unable to perform pointer interaction as the element ${n.tree.length > 1 ? "inherits" : "has"} \`pointer-events: none\`:`,
2312
- "",
2313
- Ii(n.tree)
2314
- ].join(`
2315
- `));
2316
- }
2317
- function Ii(e) {
2318
- return e.reverse().map((t, n) => [
2319
- "".padEnd(n),
2320
- t.tagName,
2321
- t.id && `#${t.id}`,
2322
- t.hasAttribute("data-testid") && `(testId=${t.getAttribute("data-testid")})`,
2323
- _i(t),
2324
- e.length > 1 && n === 0 && " <-- This element declared `pointer-events: none`",
2325
- e.length > 1 && n === e.length - 1 && " <-- Asserted pointer events here"
2326
- ].filter(Boolean).join("")).join(`
2327
- `);
2328
- }
2329
- function _i(e) {
2330
- var t;
2331
- let n;
2332
- if (e.hasAttribute("aria-label"))
2333
- n = e.getAttribute("aria-label");
2334
- else if (e.hasAttribute("aria-labelledby")) {
2335
- var i, r;
2336
- n = (r = e.ownerDocument.getElementById(e.getAttribute("aria-labelledby"))) === null || r === void 0 || (i = r.textContent) === null || i === void 0 ? void 0 : i.trim();
2337
- } else if (d(e, [
2338
- "button",
2339
- "input",
2340
- "meter",
2341
- "output",
2342
- "progress",
2343
- "select",
2344
- "textarea"
2345
- ]) && (!((t = e.labels) === null || t === void 0) && t.length))
2346
- n = Array.from(e.labels).map((s) => {
2347
- var u;
2348
- return (u = s.textContent) === null || u === void 0 ? void 0 : u.trim();
2349
- }).join("|");
2350
- else if (d(e, "button")) {
2351
- var o;
2352
- n = (o = e.textContent) === null || o === void 0 ? void 0 : o.trim();
2353
- }
2354
- return n = n == null ? void 0 : n.replace(/\n/g, " "), Number(n == null ? void 0 : n.length) > 30 && (n = `${n == null ? void 0 : n.substring(0, 29)}…`), n ? `(label=${n})` : "";
2355
- }
2356
- function dt(e, t) {
2357
- return (e & t) > 0;
2358
- }
2359
- function x(e, t, n) {
2360
- return t in e ? Object.defineProperty(e, t, {
2361
- value: n,
2362
- enumerable: !0,
2363
- configurable: !0,
2364
- writable: !0
2365
- }) : e[t] = n, e;
2366
- }
2367
- class Pi {
2368
- init(t) {
2369
- const n = this.getTarget(t), [, i] = be(null, n), r = this.getEventInit();
2370
- return he(t, n), t.dispatchUIEvent(n, "pointerover", r), i.forEach((o) => t.dispatchUIEvent(o, "pointerenter", r)), this;
2371
- }
2372
- move(t, n) {
2373
- const i = this.position, r = this.getTarget(t);
2374
- if (this.position = n, !jt(i, n))
2375
- return;
2376
- const o = this.getTarget(t), s = this.getEventInit(-1), [u, l] = be(r, o);
2377
- return {
2378
- leave: () => {
2379
- xe(t, r) && r !== o && (t.dispatchUIEvent(r, "pointerout", s), u.forEach((a) => t.dispatchUIEvent(a, "pointerleave", s)));
2380
- },
2381
- enter: () => {
2382
- he(t, o), r !== o && (t.dispatchUIEvent(o, "pointerover", s), l.forEach((a) => t.dispatchUIEvent(a, "pointerenter", s)));
2383
- },
2384
- move: () => {
2385
- t.dispatchUIEvent(o, "pointermove", s);
2386
- }
2387
- };
2388
- }
2389
- down(t, n = 0) {
2390
- if (this.isDown)
2391
- return;
2392
- const i = this.getTarget(t);
2393
- he(t, i), this.isDown = !0, this.isPrevented = !t.dispatchUIEvent(i, "pointerdown", this.getEventInit(n));
2394
- }
2395
- up(t, n = 0) {
2396
- if (!this.isDown)
2397
- return;
2398
- const i = this.getTarget(t);
2399
- he(t, i), this.isPrevented = !1, this.isDown = !1, t.dispatchUIEvent(i, "pointerup", this.getEventInit(n));
2400
- }
2401
- release(t) {
2402
- const n = this.getTarget(t), [i] = be(n, null), r = this.getEventInit();
2403
- xe(t, n) && (t.dispatchUIEvent(n, "pointerout", r), i.forEach((o) => t.dispatchUIEvent(o, "pointerleave", r))), this.isCancelled = !0;
2404
- }
2405
- getTarget(t) {
2406
- var n;
2407
- return (n = this.position.target) !== null && n !== void 0 ? n : t.config.document.body;
2408
- }
2409
- getEventInit(t) {
2410
- return {
2411
- ...this.position.coords,
2412
- pointerId: this.pointerId,
2413
- pointerType: this.pointerType,
2414
- isPrimary: this.isPrimary,
2415
- button: Fe(t),
2416
- buttons: this.buttons.getButtons()
2417
- };
2418
- }
2419
- constructor({ pointerId: t, pointerType: n, isPrimary: i }, r) {
2420
- x(this, "pointerId", void 0), x(this, "pointerType", void 0), x(this, "isPrimary", void 0), x(this, "buttons", void 0), x(this, "isMultitouch", !1), x(this, "isCancelled", !1), x(this, "isDown", !1), x(this, "isPrevented", !1), x(this, "position", {}), this.pointerId = t, this.pointerType = n, this.isPrimary = i, this.isMultitouch = !i, this.buttons = r;
2421
- }
2422
- }
2423
- function B(e, t, n) {
2424
- return t in e ? Object.defineProperty(e, t, {
2425
- value: n,
2426
- enumerable: !0,
2427
- configurable: !0,
2428
- writable: !0
2429
- }) : e[t] = n, e;
2430
- }
2431
- class Oi {
2432
- isKeyPressed(t) {
2433
- return this.devices.get(t.pointerType).isPressed(t);
2434
- }
2435
- async press(t, n, i) {
2436
- this.devices.get(n.pointerType).addPressed(n), this.buttons.down(n);
2437
- const r = this.getPointerName(n), o = n.pointerType === "touch" ? this.pointers.new(r, n.pointerType, this.buttons) : this.pointers.get(r);
2438
- o.position = i, o.pointerType !== "touch" && (this.mouse.position = i), o.pointerType === "touch" && o.init(t), o.down(t, n.button), o.pointerType !== "touch" && this.mouse.down(t, n, o.isPrevented);
2439
- }
2440
- async move(t, n, i) {
2441
- const r = this.pointers.get(n), o = r.move(t, i), s = r.pointerType === "touch" ? void 0 : this.mouse.move(t, i, r.isPrevented);
2442
- o == null || o.leave(), s == null || s.leave(), o == null || o.enter(), s == null || s.enter(), o == null || o.move(), s == null || s.move();
2443
- }
2444
- async release(t, n, i) {
2445
- const r = this.devices.get(n.pointerType);
2446
- r.removePressed(n), this.buttons.up(n);
2447
- const o = this.pointers.get(this.getPointerName(n)), s = o.isPrevented;
2448
- if (o.position = i, o.pointerType !== "touch" && (this.mouse.position = i), r.countPressed === 0 && o.up(t, n.button), o.pointerType === "touch" && o.release(t), o.pointerType === "touch" && !o.isMultitouch) {
2449
- const u = this.mouse.move(t, i, s);
2450
- u == null || u.leave(), u == null || u.enter(), u == null || u.move(), this.mouse.down(t, n, s);
2451
- }
2452
- if (!o.isMultitouch) {
2453
- const u = this.mouse.move(t, i, s);
2454
- u == null || u.leave(), u == null || u.enter(), u == null || u.move(), this.mouse.up(t, n, s);
2455
- }
2456
- }
2457
- getPointerName(t) {
2458
- return t.pointerType === "touch" ? t.name : t.pointerType;
2459
- }
2460
- getPreviousPosition(t) {
2461
- return this.pointers.has(t) ? this.pointers.get(t).position : void 0;
2462
- }
2463
- resetClickCount() {
2464
- this.mouse.resetClickCount();
2465
- }
2466
- getMouseTarget(t) {
2467
- var n;
2468
- return (n = this.mouse.position.target) !== null && n !== void 0 ? n : t.config.document.body;
2469
- }
2470
- setMousePosition(t) {
2471
- this.mouse.position = t, this.pointers.get("mouse").position = t;
2472
- }
2473
- constructor(t) {
2474
- B(this, "system", void 0), B(this, "mouse", void 0), B(this, "buttons", void 0), B(this, "devices", new class {
2475
- get(n) {
2476
- var i, r, o;
2477
- return (o = (i = this.registry)[r = n]) !== null && o !== void 0 ? o : i[r] = new Ei();
2478
- }
2479
- constructor() {
2480
- B(this, "registry", {});
2481
- }
2482
- }()), B(this, "pointers", new class {
2483
- new(n, i, r) {
2484
- const o = i !== "touch" || !Object.values(this.registry).some((s) => s.pointerType === "touch" && !s.isCancelled);
2485
- return o || Object.values(this.registry).forEach((s) => {
2486
- s.pointerType === i && !s.isCancelled && (s.isMultitouch = !0);
2487
- }), this.registry[n] = new Pi({
2488
- pointerId: this.nextId++,
2489
- pointerType: i,
2490
- isPrimary: o
2491
- }, r), this.registry[n];
2492
- }
2493
- get(n) {
2494
- if (!this.has(n))
2495
- throw new Error(`Trying to access pointer "${n}" which does not exist.`);
2496
- return this.registry[n];
2497
- }
2498
- has(n) {
2499
- return n in this.registry;
2500
- }
2501
- constructor() {
2502
- B(this, "registry", {}), B(this, "nextId", 1);
2503
- }
2504
- }()), this.system = t, this.buttons = new Ht(), this.mouse = new ki(), this.pointers.new("mouse", "mouse", this.buttons);
2505
- }
2506
- }
2507
- function ft(e, t, n) {
2508
- return t in e ? Object.defineProperty(e, t, {
2509
- value: n,
2510
- enumerable: !0,
2511
- configurable: !0,
2512
- writable: !0
2513
- }) : e[t] = n, e;
2514
- }
2515
- class zt {
2516
- getUIEventModifiers() {
2517
- return {
2518
- altKey: this.keyboard.modifiers.Alt,
2519
- ctrlKey: this.keyboard.modifiers.Control,
2520
- metaKey: this.keyboard.modifiers.Meta,
2521
- shiftKey: this.keyboard.modifiers.Shift,
2522
- modifierAltGraph: this.keyboard.modifiers.AltGraph,
2523
- modifierCapsLock: this.keyboard.modifiers.CapsLock,
2524
- modifierFn: this.keyboard.modifiers.Fn,
2525
- modifierFnLock: this.keyboard.modifiers.FnLock,
2526
- modifierNumLock: this.keyboard.modifiers.NumLock,
2527
- modifierScrollLock: this.keyboard.modifiers.ScrollLock,
2528
- modifierSymbol: this.keyboard.modifiers.Symbol,
2529
- modifierSymbolLock: this.keyboard.modifiers.SymbolLock
2530
- };
2531
- }
2532
- constructor() {
2533
- ft(this, "keyboard", new bi(this)), ft(this, "pointer", new Oi(this));
2534
- }
2535
- }
2536
- async function Ai(e) {
2537
- const t = [];
2538
- return this.config.skipHover || t.push({
2539
- target: e
2540
- }), t.push({
2541
- keys: "[MouseLeft]",
2542
- target: e
2543
- }), this.pointer(t);
2544
- }
2545
- async function xi(e) {
2546
- return this.pointer([
2547
- {
2548
- target: e
2549
- },
2550
- "[MouseLeft][MouseLeft]"
2551
- ]);
2552
- }
2553
- async function Di(e) {
2554
- return this.pointer([
2555
- {
2556
- target: e
2557
- },
2558
- "[MouseLeft][MouseLeft][MouseLeft]"
2559
- ]);
2560
- }
2561
- async function Ui(e) {
2562
- return this.pointer({
2563
- target: e
2564
- });
2565
- }
2566
- async function Ni(e) {
2567
- return he(this, this.system.pointer.getMouseTarget(this)), this.pointer({
2568
- target: e.ownerDocument.body
2569
- });
2570
- }
2571
- async function Bi({ shift: e } = {}) {
2572
- return this.keyboard(e === !0 ? "{Shift>}{Tab}{/Shift}" : e === !1 ? "[/ShiftLeft][/ShiftRight]{Tab}" : "{Tab}");
2573
- }
2574
- var Ge = /* @__PURE__ */ function(e) {
2575
- return e["{"] = "}", e["["] = "]", e;
2576
- }(Ge || {});
2577
- function Gt(e, t) {
2578
- let n = 0;
2579
- const i = e[n] in Ge ? e[n] : "";
2580
- n += i.length;
2581
- const o = new RegExp(`^\\${i}{2}`).test(e) ? "" : i;
2582
- return {
2583
- type: o,
2584
- ...o === "" ? Mi(e, n, t) : Li(e, n, o, t)
2585
- };
2586
- }
2587
- function Mi(e, t, n) {
2588
- const i = e[t];
2589
- return Wt(i, e, t, n), t += i.length, {
2590
- consumedLength: t,
2591
- descriptor: i,
2592
- releasePrevious: !1,
2593
- releaseSelf: !0,
2594
- repeat: 1
2595
- };
2596
- }
2597
- function Li(e, t, n, i) {
2598
- var r, o;
2599
- const s = e[t] === "/" ? "/" : "";
2600
- t += s.length;
2601
- const u = n === "{" && e[t] === "\\";
2602
- t += Number(u);
2603
- const l = u ? e[t] : (r = e.slice(t).match(n === "{" ? /^\w+|^[^}>/]/ : /^\w+/)) === null || r === void 0 ? void 0 : r[0];
2604
- Wt(l, e, t, i), t += l.length;
2605
- var a;
2606
- const c = (a = (o = e.slice(t).match(/^>\d+/)) === null || o === void 0 ? void 0 : o[0]) !== null && a !== void 0 ? a : "";
2607
- t += c.length;
2608
- const f = e[t] === "/" || !c && e[t] === ">" ? e[t] : "";
2609
- t += f.length;
2610
- const m = Ge[n], y = e[t] === m ? m : "";
2611
- if (!y)
2612
- throw new Error(Xt([
2613
- !c && "repeat modifier",
2614
- !f && "release modifier",
2615
- `"${m}"`
2616
- ].filter(Boolean).join(" or "), e[t], e, i));
2617
- return t += y.length, {
2618
- consumedLength: t,
2619
- descriptor: l,
2620
- releasePrevious: !!s,
2621
- repeat: c ? Math.max(Number(c.substr(1)), 1) : 1,
2622
- releaseSelf: $i(f, c)
2623
- };
2624
- }
2625
- function Wt(e, t, n, i) {
2626
- if (!e)
2627
- throw new Error(Xt("key descriptor", t[n], t, i));
2628
- }
2629
- function $i(e, t) {
2630
- if (e)
2631
- return e === "/";
2632
- if (t)
2633
- return !1;
2634
- }
2635
- function Xt(e, t, n, i) {
2636
- return `Expected ${e} but found "${t ?? ""}" in "${n}"
2637
- See ${i === "pointer" ? "https://testing-library.com/docs/user-event/pointer#pressing-a-button-or-touching-the-screen" : "https://testing-library.com/docs/user-event/keyboard"}
2638
- for more information about how userEvent parses your input.`;
2639
- }
2640
- function Fi(e, t) {
2641
- const n = [];
2642
- do {
2643
- const { type: r, descriptor: o, consumedLength: s, releasePrevious: u, releaseSelf: l = !0, repeat: a } = Gt(t, "keyboard");
2644
- var i;
2645
- const c = (i = e.find((f) => {
2646
- if (r === "[") {
2647
- var m;
2648
- return ((m = f.code) === null || m === void 0 ? void 0 : m.toLowerCase()) === o.toLowerCase();
2649
- } else if (r === "{") {
2650
- var y;
2651
- return ((y = f.key) === null || y === void 0 ? void 0 : y.toLowerCase()) === o.toLowerCase();
2652
- }
2653
- return f.key === o;
2654
- })) !== null && i !== void 0 ? i : {
2655
- key: "Unknown",
2656
- code: "Unknown",
2657
- [r === "[" ? "code" : "key"]: o
2658
- };
2659
- n.push({
2660
- keyDef: c,
2661
- releasePrevious: u,
2662
- releaseSelf: l,
2663
- repeat: a
2664
- }), t = t.slice(s);
2665
- } while (t);
2666
- return n;
2667
- }
2668
- async function Ri(e) {
2669
- const t = Fi(this.config.keyboardMap, e);
2670
- for (let n = 0; n < t.length; n++)
2671
- await oe(this.config), await Vi(this, t[n]);
2672
- }
2673
- async function Vi(e, { keyDef: t, releasePrevious: n, releaseSelf: i, repeat: r }) {
2674
- const { system: o } = e;
2675
- if (o.keyboard.isKeyPressed(t) && await o.keyboard.keyup(e, t), !n) {
2676
- for (let s = 1; s <= r; s++)
2677
- await o.keyboard.keydown(e, t), s < r && await oe(e.config);
2678
- i && await o.keyboard.keyup(e, t);
2679
- }
2680
- }
2681
- async function Hi(e) {
2682
- for (const t of e.system.keyboard.getPressedKeys())
2683
- await e.system.keyboard.keyup(e, t);
2684
- }
2685
- function Yt(e) {
2686
- const t = O(e) ? {
2687
- "text/plain": Ki(e)
2688
- } : {
2689
- "text/plain": String(e.ownerDocument.getSelection())
2690
- }, n = He(_(e));
2691
- for (const i in t)
2692
- t[i] && n.setData(i, t[i]);
2693
- return n;
2694
- }
2695
- function Ki(e) {
2696
- const t = ve(e);
2697
- return A(e).substring(t.startOffset, t.endOffset);
2698
- }
2699
- async function ji() {
2700
- const e = this.config.document;
2701
- var t;
2702
- const n = (t = e.activeElement) !== null && t !== void 0 ? t : (
2703
- /* istanbul ignore next */
2704
- e.body
2705
- ), i = Yt(n);
2706
- if (i.items.length !== 0)
2707
- return this.dispatchUIEvent(n, "copy", {
2708
- clipboardData: i
2709
- }) && this.config.writeToClipboard && await Ct(e, i), i;
2710
- }
2711
- async function qi() {
2712
- const e = this.config.document;
2713
- var t;
2714
- const n = (t = e.activeElement) !== null && t !== void 0 ? t : (
2715
- /* istanbul ignore next */
2716
- e.body
2717
- ), i = Yt(n);
2718
- if (i.items.length !== 0)
2719
- return this.dispatchUIEvent(n, "cut", {
2720
- clipboardData: i
2721
- }) && this.config.writeToClipboard && await Ct(n.ownerDocument, i), i;
2722
- }
2723
- async function zi(e) {
2724
- const t = this.config.document;
2725
- var n;
2726
- const i = (n = t.activeElement) !== null && n !== void 0 ? n : (
2727
- /* istanbul ignore next */
2728
- t.body
2729
- );
2730
- var r;
2731
- const o = (r = typeof e == "string" ? Gi(t, e) : e) !== null && r !== void 0 ? r : await hn(t).catch(() => {
2732
- throw new Error("`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.");
2733
- });
2734
- this.dispatchUIEvent(i, "paste", {
2735
- clipboardData: o
2736
- });
2737
- }
2738
- function Gi(e, t) {
2739
- const n = He(_(e));
2740
- return n.setData("text", t), n;
2741
- }
2742
- function pt(e, t) {
2743
- const n = [];
2744
- do {
2745
- const { descriptor: i, consumedLength: r, releasePrevious: o, releaseSelf: s = !0 } = Gt(t, "pointer"), u = e.find((l) => l.name === i);
2746
- u && n.push({
2747
- keyDef: u,
2748
- releasePrevious: o,
2749
- releaseSelf: s
2750
- }), t = t.slice(r);
2751
- } while (t);
2752
- return n;
2753
- }
2754
- async function Wi(e) {
2755
- const { pointerMap: t } = this.config, n = [];
2756
- (Array.isArray(e) ? e : [
2757
- e
2758
- ]).forEach((i) => {
2759
- typeof i == "string" ? n.push(...pt(t, i)) : "keys" in i ? n.push(...pt(t, i.keys).map((r) => ({
2760
- ...i,
2761
- ...r
2762
- }))) : n.push(i);
2763
- });
2764
- for (let i = 0; i < n.length; i++)
2765
- await oe(this.config), await Xi(this, n[i]);
2766
- this.system.pointer.resetClickCount();
2767
- }
2768
- async function Xi(e, t) {
2769
- var n, i;
2770
- const r = "pointerName" in t && t.pointerName ? t.pointerName : "keyDef" in t ? e.system.pointer.getPointerName(t.keyDef) : "mouse", o = e.system.pointer.getPreviousPosition(r);
2771
- var s, u, l, a;
2772
- const c = {
2773
- target: (s = t.target) !== null && s !== void 0 ? s : Yi(e, o),
2774
- coords: (u = t.coords) !== null && u !== void 0 ? u : o == null ? void 0 : o.coords,
2775
- caret: {
2776
- node: (l = t.node) !== null && l !== void 0 ? l : ht(t) || o == null || (n = o.caret) === null || n === void 0 ? void 0 : n.node,
2777
- offset: (a = t.offset) !== null && a !== void 0 ? a : ht(t) || o == null || (i = o.caret) === null || i === void 0 ? void 0 : i.offset
2778
- }
2779
- };
2780
- "keyDef" in t ? (e.system.pointer.isKeyPressed(t.keyDef) && (pe(e, S.Trigger), await e.system.pointer.release(e, t.keyDef, c)), t.releasePrevious || (pe(e, S.Trigger), await e.system.pointer.press(e, t.keyDef, c), t.releaseSelf && (pe(e, S.Trigger), await e.system.pointer.release(e, t.keyDef, c)))) : (pe(e, S.Trigger), await e.system.pointer.move(e, r, c));
2781
- }
2782
- function ht(e) {
2783
- var t, n;
2784
- return !!((n = (t = e.target) !== null && t !== void 0 ? t : e.node) !== null && n !== void 0 ? n : e.offset !== void 0);
2785
- }
2786
- function Yi(e, t) {
2787
- if (!t)
2788
- throw new Error("This pointer has no previous position. Provide a target property!");
2789
- var n;
2790
- return (n = t.target) !== null && n !== void 0 ? n : e.config.document.body;
2791
- }
2792
- async function Ji(e) {
2793
- if (!te(e) || U(e))
2794
- throw new Error("clear()` is only supported on editable elements.");
2795
- if (L(e), e.ownerDocument.activeElement !== e)
2796
- throw new Error("The element to be cleared could not be focused.");
2797
- if (Bt(e), !zn(e))
2798
- throw new Error("The element content to be cleared could not be selected.");
2799
- re(this, e, "", "deleteContentBackward");
2800
- }
2801
- async function Qi(e, t) {
2802
- return Jt.call(this, !0, e, t);
2803
- }
2804
- async function Zi(e, t) {
2805
- return Jt.call(this, !1, e, t);
2806
- }
2807
- async function Jt(e, t, n) {
2808
- if (!e && !t.multiple)
2809
- throw J().getElementError("Unable to deselect an option in a non-multiple select. Use selectOptions to change the selection instead.", t);
2810
- const i = Array.isArray(n) ? n : [
2811
- n
2812
- ], r = Array.from(t.querySelectorAll('option, [role="option"]')), o = i.map((u) => {
2813
- if (typeof u != "string" && r.includes(u))
2814
- return u;
2815
- {
2816
- const l = r.find((a) => a.value === u || a.innerHTML === u);
2817
- if (l)
2818
- return l;
2819
- throw J().getElementError(`Value "${String(u)}" not found in options`, t);
2820
- }
2821
- }).filter((u) => !U(u));
2822
- if (U(t) || !o.length) return;
2823
- const s = (u) => {
2824
- u.selected = e, this.dispatchUIEvent(t, "input", {
2825
- bubbles: !0,
2826
- cancelable: !1,
2827
- composed: !0
2828
- }), this.dispatchUIEvent(t, "change");
2829
- };
2830
- if (d(t, "select"))
2831
- if (t.multiple)
2832
- for (const u of o) {
2833
- const l = this.config.pointerEventsCheck === 0 ? !0 : xe(this, u);
2834
- l && (this.dispatchUIEvent(u, "pointerover"), this.dispatchUIEvent(t, "pointerenter"), this.dispatchUIEvent(u, "mouseover"), this.dispatchUIEvent(t, "mouseenter"), this.dispatchUIEvent(u, "pointermove"), this.dispatchUIEvent(u, "mousemove"), this.dispatchUIEvent(u, "pointerdown"), this.dispatchUIEvent(u, "mousedown")), L(t), l && (this.dispatchUIEvent(u, "pointerup"), this.dispatchUIEvent(u, "mouseup")), s(u), l && this.dispatchUIEvent(u, "click"), await oe(this.config);
2835
- }
2836
- else if (o.length === 1) {
2837
- const u = this.config.pointerEventsCheck === 0 ? !0 : xe(this, t);
2838
- u ? await this.click(t) : L(t), s(o[0]), u && (this.dispatchUIEvent(t, "pointerover"), this.dispatchUIEvent(t, "pointerenter"), this.dispatchUIEvent(t, "mouseover"), this.dispatchUIEvent(t, "mouseenter"), this.dispatchUIEvent(t, "pointerup"), this.dispatchUIEvent(t, "mouseup"), this.dispatchUIEvent(t, "click")), await oe(this.config);
2839
- } else
2840
- throw J().getElementError("Cannot select multiple options on a non-multiple select", t);
2841
- else if (t.getAttribute("role") === "listbox")
2842
- for (const u of o)
2843
- await this.click(u), await this.unhover(u);
2844
- else
2845
- throw J().getElementError("Cannot select options on elements that are neither select nor listbox elements", t);
2846
- }
2847
- async function er(e, t, { skipClick: n = this.config.skipClick, skipAutoClose: i = this.config.skipAutoClose, initialSelectionStart: r, initialSelectionEnd: o } = {}) {
2848
- e.disabled || (n || await this.click(e), r !== void 0 && fe(e, r, o ?? r), await this.keyboard(t), i || await Hi(this));
2849
- }
2850
- const bt = Symbol("files and value properties are mocked");
2851
- function Le(e, t, n) {
2852
- n ? Object.defineProperty(e, t, n) : delete e[t];
2853
- }
2854
- function tr(e, t) {
2855
- var n;
2856
- (n = e[bt]) === null || n === void 0 || n.restore();
2857
- const i = Object.getOwnPropertyDescriptor(e, "type"), r = Object.getOwnPropertyDescriptor(e, "value"), o = Object.getOwnPropertyDescriptor(e, "files");
2858
- function s() {
2859
- Le(e, "type", i), Le(e, "value", r), Le(e, "files", o);
2860
- }
2861
- e[bt] = {
2862
- restore: s
2863
- }, Object.defineProperties(e, {
2864
- files: {
2865
- configurable: !0,
2866
- get: () => t
2867
- },
2868
- value: {
2869
- configurable: !0,
2870
- get: () => t.length ? `C:\\fakepath\\${t[0].name}` : "",
2871
- set(u) {
2872
- if (u === "")
2873
- s();
2874
- else {
2875
- var l;
2876
- r == null || (l = r.set) === null || l === void 0 || l.call(e, u);
2877
- }
2878
- }
2879
- },
2880
- type: {
2881
- configurable: !0,
2882
- get: () => "file",
2883
- set(u) {
2884
- u !== "file" && (s(), e.type = u);
2885
- }
2886
- }
2887
- });
2888
- }
2889
- async function nr(e, t) {
2890
- const n = d(e, "label") ? e.control : e;
2891
- if (!n || !d(n, "input", {
2892
- type: "file"
2893
- }))
2894
- throw new TypeError(`The ${n === e ? "given" : "associated"} ${n == null ? void 0 : n.tagName} element does not accept file uploads`);
2895
- if (U(e)) return;
2896
- const i = (Array.isArray(t) ? t : [
2897
- t
2898
- ]).filter((o) => !this.config.applyAccept || ir(o, n.accept)).slice(0, n.multiple ? void 0 : 1), r = () => {
2899
- var o;
2900
- i.length === ((o = n.files) === null || o === void 0 ? void 0 : o.length) && i.every((s, u) => {
2901
- var l;
2902
- return s === ((l = n.files) === null || l === void 0 ? void 0 : l.item(u));
2903
- }) || (tr(n, Ve(_(e), i)), this.dispatchUIEvent(n, "input"), this.dispatchUIEvent(n, "change"));
2904
- };
2905
- n.addEventListener("fileDialog", r), await this.click(e), n.removeEventListener("fileDialog", r);
2906
- }
2907
- function ke(e) {
2908
- return e.toLowerCase().replace(/(\.|\/)jpg\b/g, "$1jpeg");
2909
- }
2910
- function ir(e, t) {
2911
- if (!t)
2912
- return !0;
2913
- const n = [
2914
- "audio/*",
2915
- "image/*",
2916
- "video/*"
2917
- ];
2918
- return ke(t).trim().split(/\s*,\s*/).some((i) => i.startsWith(".") ? ke(e.name).endsWith(i) : n.includes(i) ? ke(e.type).startsWith(i.replace("*", "")) : ke(e.type) === i);
2919
- }
2920
- const gt = {
2921
- click: Ai,
2922
- dblClick: xi,
2923
- tripleClick: Di,
2924
- hover: Ui,
2925
- unhover: Ni,
2926
- tab: Bi,
2927
- keyboard: Ri,
2928
- copy: ji,
2929
- cut: qi,
2930
- paste: zi,
2931
- pointer: Wi,
2932
- clear: Ji,
2933
- deselectOptions: Zi,
2934
- selectOptions: Qi,
2935
- type: er,
2936
- upload: nr
2937
- };
2938
- function rr(e) {
2939
- return J().asyncWrapper(e);
2940
- }
2941
- const Qt = {
2942
- applyAccept: !0,
2943
- autoModify: !0,
2944
- delay: 0,
2945
- document: globalThis.document,
2946
- keyboardMap: gi,
2947
- pointerMap: vi,
2948
- pointerEventsCheck: _e.EachApiCall,
2949
- skipAutoClose: !1,
2950
- skipClick: !1,
2951
- skipHover: !1,
2952
- writeToClipboard: !1,
2953
- advanceTimers: () => Promise.resolve()
2954
- }, or = {
2955
- ...Qt,
2956
- writeToClipboard: !0
2957
- };
2958
- function Zt(e = {}, t = or, n) {
2959
- const i = ar(e, n, t);
2960
- return {
2961
- ...t,
2962
- ...e,
2963
- document: i
2964
- };
2965
- }
2966
- function sr(e = {}) {
2967
- const t = Zt(e);
2968
- Vt(t.document), Rt(_(t.document).HTMLElement);
2969
- var n;
2970
- const i = (n = t.document.defaultView) !== null && n !== void 0 ? n : (
2971
- /* istanbul ignore next */
2972
- globalThis.window
2973
- );
2974
- return dn(i), We(t).api;
2975
- }
2976
- function T({ keyboardState: e, pointerState: t, ...n } = {}, i) {
2977
- const r = Zt(n, Qt, i);
2978
- Vt(r.document), Rt(_(r.document).HTMLElement);
2979
- var o;
2980
- const s = (o = t ?? e) !== null && o !== void 0 ? o : new zt();
2981
- return {
2982
- api: We(r, s).api,
2983
- system: s
2984
- };
2985
- }
2986
- function ur(e) {
2987
- return We({
2988
- ...this.config,
2989
- ...e
2990
- }, this.system).api;
2991
- }
2992
- function lr(e, t) {
2993
- function n(...i) {
2994
- return pe(e, S.Call), rr(() => t.apply(e, i).then(async (r) => (await oe(e.config), r)));
2995
- }
2996
- return Object.defineProperty(n, "name", {
2997
- get: () => t.name
2998
- }), n;
2999
- }
3000
- function We(e, t = new zt()) {
3001
- const n = {};
3002
- return Object.assign(n, {
3003
- config: e,
3004
- dispatchEvent: Ft.bind(n),
3005
- dispatchUIEvent: si.bind(n),
3006
- system: t,
3007
- levelRefs: {},
3008
- ...gt
3009
- }), {
3010
- instance: n,
3011
- api: {
3012
- ...Object.fromEntries(Object.entries(gt).map(([i, r]) => [
3013
- i,
3014
- lr(n, r)
3015
- ])),
3016
- setup: ur.bind(n)
3017
- }
3018
- };
3019
- }
3020
- function ar(e, t, n) {
3021
- var i, r;
3022
- return (r = (i = e.document) !== null && i !== void 0 ? i : t && di(t)) !== null && r !== void 0 ? r : n.document;
3023
- }
3024
- function cr(e) {
3025
- return T().api.clear(e);
3026
- }
3027
- function dr(e, t = {}) {
3028
- return T(t, e).api.click(e);
3029
- }
3030
- function fr(e = {}) {
3031
- return T(e).api.copy();
3032
- }
3033
- function pr(e = {}) {
3034
- return T(e).api.cut();
3035
- }
3036
- function hr(e, t = {}) {
3037
- return T(t).api.dblClick(e);
3038
- }
3039
- function br(e, t, n = {}) {
3040
- return T(n).api.deselectOptions(e, t);
3041
- }
3042
- function gr(e, t = {}) {
3043
- return T(t).api.hover(e);
3044
- }
3045
- async function vr(e, t = {}) {
3046
- const { api: n, system: i } = T(t);
3047
- return n.keyboard(e).then(() => i);
3048
- }
3049
- async function mr(e, t = {}) {
3050
- const { api: n, system: i } = T(t);
3051
- return n.pointer(e).then(() => i);
3052
- }
3053
- function yr(e, t) {
3054
- return T(t).api.paste(e);
3055
- }
3056
- function Er(e, t, n = {}) {
3057
- return T(n).api.selectOptions(e, t);
3058
- }
3059
- function wr(e, t = {}) {
3060
- return T(t).api.tripleClick(e);
3061
- }
3062
- function Cr(e, t, n = {}) {
3063
- return T(n, e).api.type(e, t, n);
3064
- }
3065
- function Tr(e, t = {}) {
3066
- const { api: n, system: i } = T(t);
3067
- return i.pointer.setMousePosition({
3068
- target: e
3069
- }), n.unhover(e);
3070
- }
3071
- function kr(e, t, n = {}) {
3072
- return T(n).api.upload(e, t);
3073
- }
3074
- function Sr(e = {}) {
3075
- return T().api.tab(e);
3076
- }
3077
- const Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3078
- __proto__: null,
3079
- clear: cr,
3080
- click: dr,
3081
- copy: fr,
3082
- cut: pr,
3083
- dblClick: hr,
3084
- deselectOptions: br,
3085
- hover: gr,
3086
- keyboard: vr,
3087
- paste: yr,
3088
- pointer: mr,
3089
- selectOptions: Er,
3090
- tab: Sr,
3091
- tripleClick: wr,
3092
- type: Cr,
3093
- unhover: Tr,
3094
- upload: kr
3095
- }, Symbol.toStringTag, { value: "Module" })), _r = {
3096
- ...Ir,
3097
- setup: sr
3098
- };
3099
- vt.mock("../Label", () => ({
3100
- Label: ({ children: e, htmlFor: t, required: n }) => /* @__PURE__ */ rn("label", { htmlFor: t, children: [
3101
- e,
3102
- n && /* @__PURE__ */ h("span", { "aria-label": "required", children: " *" })
3103
- ] })
3104
- }));
3105
- I("MultiSelect", () => {
3106
- const e = [
3107
- { label: "Option A", value: "a" },
3108
- { label: "Option B", value: "b" },
3109
- { label: "Option C", value: "c" }
3110
- ];
3111
- I("Rendering", () => {
3112
- b("renders label and options", () => {
3113
- g(
3114
- /* @__PURE__ */ h(
3115
- v,
3116
- {
3117
- id: "select1",
3118
- name: "test",
3119
- label: "Options",
3120
- value: [],
3121
- onChange: () => {
3122
- },
3123
- options: e
3124
- }
3125
- )
3126
- ), p(
3127
- w.getByLabelText("Options", { exact: !1 })
3128
- ).toBeInTheDocument(), e.forEach(
3129
- ({ label: t }) => p(w.getByRole("option", { name: t })).toBeInTheDocument()
3130
- );
3131
- }), b("renders without a label", () => {
3132
- g(
3133
- /* @__PURE__ */ h(
3134
- v,
3135
- {
3136
- id: "select-no-label",
3137
- name: "test",
3138
- value: [],
3139
- onChange: () => {
3140
- },
3141
- options: e
3142
- }
3143
- )
3144
- );
3145
- const t = w.getByRole("listbox");
3146
- p(t).toBeInTheDocument();
3147
- }), b("generates id when not provided", () => {
3148
- const { container: t } = g(
3149
- /* @__PURE__ */ h(
3150
- v,
3151
- {
3152
- name: "test",
3153
- value: [],
3154
- onChange: () => {
3155
- },
3156
- options: e
3157
- }
3158
- )
3159
- ), n = t.querySelector("select");
3160
- p(n).toHaveAttribute("id"), p(n == null ? void 0 : n.id).toMatch(/multiselect-/);
3161
- }), b("applies custom className", () => {
3162
- const { container: t } = g(
3163
- /* @__PURE__ */ h(
3164
- v,
3165
- {
3166
- className: "custom-select",
3167
- value: [],
3168
- onChange: () => {
3169
- },
3170
- options: e
3171
- }
3172
- )
3173
- );
3174
- p(t.querySelector(".custom-select")).toBeInTheDocument();
3175
- });
3176
- }), I("Selection Behavior", () => {
3177
- b("calls onChange handler with selected values", async () => {
3178
- const t = _r.setup(), n = vt.fn();
3179
- function i() {
3180
- const [o, s] = on.useState([]);
3181
- return /* @__PURE__ */ h(
3182
- v,
3183
- {
3184
- id: "select2",
3185
- name: "test",
3186
- label: "Options",
3187
- options: e,
3188
- value: o,
3189
- onChange: (u) => {
3190
- s(u), n(u);
3191
- }
3192
- }
3193
- );
3194
- }
3195
- g(/* @__PURE__ */ h(i, {}));
3196
- const r = w.getByLabelText("Options", {
3197
- exact: !1
3198
- });
3199
- await t.selectOptions(r, ["a", "b"]), p(n).toHaveBeenCalledWith(["a", "b"]);
3200
- }), b("displays selected values", () => {
3201
- g(
3202
- /* @__PURE__ */ h(
3203
- v,
3204
- {
3205
- id: "select-selected",
3206
- name: "test",
3207
- value: ["a", "b"],
3208
- onChange: () => {
3209
- },
3210
- options: e
3211
- }
3212
- )
3213
- );
3214
- const t = w.getByRole("listbox");
3215
- p(t.value).toContain("a");
3216
- }), b("shows selected count when items are selected", () => {
3217
- g(
3218
- /* @__PURE__ */ h(v, { value: ["a", "b"], onChange: () => {
3219
- }, options: e })
3220
- ), p(w.getByText("2 items selected")).toBeInTheDocument();
3221
- }), b("shows singular count for one item", () => {
3222
- g(
3223
- /* @__PURE__ */ h(v, { value: ["a"], onChange: () => {
3224
- }, options: e })
3225
- ), p(w.getByText("1 item selected")).toBeInTheDocument();
3226
- }), b("does not show count when no items selected", () => {
3227
- g(/* @__PURE__ */ h(v, { value: [], onChange: () => {
3228
- }, options: e })), p(w.queryByText(/items? selected/)).not.toBeInTheDocument();
3229
- });
3230
- }), I("Sizes", () => {
3231
- b("applies small size class", () => {
3232
- const { container: t } = g(
3233
- /* @__PURE__ */ h(
3234
- v,
3235
- {
3236
- size: "sm",
3237
- value: [],
3238
- onChange: () => {
3239
- },
3240
- options: e
3241
- }
3242
- )
3243
- ), n = t.querySelector("select");
3244
- p(n).toHaveClass("sm");
3245
- }), b("applies medium size by default", () => {
3246
- const { container: t } = g(
3247
- /* @__PURE__ */ h(v, { value: [], onChange: () => {
3248
- }, options: e })
3249
- ), n = t.querySelector("select");
3250
- p(n).toHaveClass("md");
3251
- }), b("applies large size class", () => {
3252
- const { container: t } = g(
3253
- /* @__PURE__ */ h(
3254
- v,
3255
- {
3256
- size: "lg",
3257
- value: [],
3258
- onChange: () => {
3259
- },
3260
- options: e
3261
- }
3262
- )
3263
- ), n = t.querySelector("select");
3264
- p(n).toHaveClass("lg");
3265
- });
3266
- }), I("States", () => {
3267
- b("renders disabled select", () => {
3268
- g(
3269
- /* @__PURE__ */ h(
3270
- v,
3271
- {
3272
- label: "Options",
3273
- disabled: !0,
3274
- value: [],
3275
- onChange: () => {
3276
- },
3277
- options: e
3278
- }
3279
- )
3280
- );
3281
- const t = w.getByLabelText("Options", { exact: !1 });
3282
- p(t).toBeDisabled();
3283
- }), b("renders required select", () => {
3284
- g(
3285
- /* @__PURE__ */ h(
3286
- v,
3287
- {
3288
- label: "Options",
3289
- required: !0,
3290
- value: [],
3291
- onChange: () => {
3292
- },
3293
- options: e
3294
- }
3295
- )
3296
- );
3297
- const t = w.getByLabelText("Options", { exact: !1 });
3298
- p(t).toBeRequired();
3299
- });
3300
- }), I("Error State", () => {
3301
- b("shows error styling when error is boolean", () => {
3302
- const { container: t } = g(
3303
- /* @__PURE__ */ h(
3304
- v,
3305
- {
3306
- error: !0,
3307
- value: [],
3308
- onChange: () => {
3309
- },
3310
- options: e
3311
- }
3312
- )
3313
- ), n = t.querySelector("select");
3314
- p(n).toHaveClass("error"), p(n).toHaveAttribute("aria-invalid", "true");
3315
- }), b("shows error message when error is string", () => {
3316
- g(
3317
- /* @__PURE__ */ h(
3318
- v,
3319
- {
3320
- error: "Please select at least one option",
3321
- value: [],
3322
- onChange: () => {
3323
- },
3324
- options: e
3325
- }
3326
- )
3327
- ), p(
3328
- w.getByText("Please select at least one option")
3329
- ).toBeInTheDocument();
3330
- });
3331
- }), I("Helper Text", () => {
3332
- b("displays helper text", () => {
3333
- g(
3334
- /* @__PURE__ */ h(
3335
- v,
3336
- {
3337
- helperText: "Select multiple options by holding Ctrl/Cmd",
3338
- value: [],
3339
- onChange: () => {
3340
- },
3341
- options: e
3342
- }
3343
- )
3344
- ), p(
3345
- w.getByText("Select multiple options by holding Ctrl/Cmd")
3346
- ).toBeInTheDocument();
3347
- }), b("links helper text with aria-describedby", () => {
3348
- g(
3349
- /* @__PURE__ */ h(
3350
- v,
3351
- {
3352
- id: "select-help",
3353
- helperText: "Helper text",
3354
- value: [],
3355
- onChange: () => {
3356
- },
3357
- options: e
3358
- }
3359
- )
3360
- );
3361
- const t = w.getByRole("listbox");
3362
- p(t).toHaveAttribute(
3363
- "aria-describedby",
3364
- "select-help-description"
3365
- );
3366
- });
3367
- }), I("Placeholder", () => {
3368
- b("renders placeholder option", () => {
3369
- g(
3370
- /* @__PURE__ */ h(
3371
- v,
3372
- {
3373
- placeholder: "Select items...",
3374
- value: [],
3375
- onChange: () => {
3376
- },
3377
- options: e
3378
- }
3379
- )
3380
- ), p(
3381
- w.getByRole("option", { name: "Select items..." })
3382
- ).toBeInTheDocument();
3383
- }), b("placeholder is disabled", () => {
3384
- g(
3385
- /* @__PURE__ */ h(
3386
- v,
3387
- {
3388
- placeholder: "Select items...",
3389
- value: [],
3390
- onChange: () => {
3391
- },
3392
- options: e
3393
- }
3394
- )
3395
- );
3396
- const t = w.getByRole("option", {
3397
- name: "Select items..."
3398
- });
3399
- p(t).toBeDisabled();
3400
- });
3401
- }), I("Disabled Options", () => {
3402
- b("renders disabled options", () => {
3403
- g(
3404
- /* @__PURE__ */ h(
3405
- v,
3406
- {
3407
- value: [],
3408
- onChange: () => {
3409
- },
3410
- options: [
3411
- { label: "Option A", value: "a" },
3412
- { label: "Option B (disabled)", value: "b", disabled: !0 },
3413
- { label: "Option C", value: "c" }
3414
- ]
3415
- }
3416
- )
3417
- );
3418
- const n = w.getByRole("option", {
3419
- name: "Option B (disabled)"
3420
- });
3421
- p(n).toBeDisabled();
3422
- });
3423
- }), I("Custom Height", () => {
3424
- b("applies minHeight style", () => {
3425
- const { container: t } = g(
3426
- /* @__PURE__ */ h(
3427
- v,
3428
- {
3429
- minHeight: "200px",
3430
- value: [],
3431
- onChange: () => {
3432
- },
3433
- options: e
3434
- }
3435
- )
3436
- ), n = t.querySelector("select");
3437
- p(n).toHaveStyle({ minHeight: "200px" });
3438
- }), b("applies maxHeight style", () => {
3439
- const { container: t } = g(
3440
- /* @__PURE__ */ h(
3441
- v,
3442
- {
3443
- maxHeight: "300px",
3444
- value: [],
3445
- onChange: () => {
3446
- },
3447
- options: e
3448
- }
3449
- )
3450
- ), n = t.querySelector("select");
3451
- p(n).toHaveStyle({ maxHeight: "300px" });
3452
- });
3453
- }), I("Accessibility", () => {
3454
- b("sets aria-invalid when error is present", () => {
3455
- g(
3456
- /* @__PURE__ */ h(
3457
- v,
3458
- {
3459
- error: "Error message",
3460
- value: [],
3461
- onChange: () => {
3462
- },
3463
- options: e
3464
- }
3465
- )
3466
- );
3467
- const t = w.getByRole("listbox");
3468
- p(t).toHaveAttribute("aria-invalid", "true");
3469
- }), b("associates label with select", () => {
3470
- g(
3471
- /* @__PURE__ */ h(
3472
- v,
3473
- {
3474
- id: "accessible-select",
3475
- label: "Select Options",
3476
- value: [],
3477
- onChange: () => {
3478
- },
3479
- options: e
3480
- }
3481
- )
3482
- );
3483
- const t = w.getByLabelText("Select Options", { exact: !1 });
3484
- p(t).toHaveAttribute("id", "accessible-select");
3485
- });
3486
- }), I("Props Forwarding", () => {
3487
- b("forwards HTML attributes", () => {
3488
- const { container: t } = g(
3489
- /* @__PURE__ */ h(
3490
- v,
3491
- {
3492
- "data-testid": "custom-select",
3493
- value: [],
3494
- onChange: () => {
3495
- },
3496
- options: e
3497
- }
3498
- )
3499
- ), n = t.querySelector("select");
3500
- p(n).toHaveAttribute("data-testid", "custom-select");
3501
- }), b("forwards name attribute", () => {
3502
- g(
3503
- /* @__PURE__ */ h(
3504
- v,
3505
- {
3506
- name: "custom-name",
3507
- value: [],
3508
- onChange: () => {
3509
- },
3510
- options: e
3511
- }
3512
- )
3513
- );
3514
- const t = w.getByRole("listbox");
3515
- p(t).toHaveAttribute("name", "custom-name");
3516
- });
3517
- });
3518
- });