@wirekyt/dom 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (476) hide show
  1. package/dist/anatomy-DMuSMbOP.d.cts +18 -0
  2. package/dist/anatomy-DMuSMbOP.d.ts +18 -0
  3. package/dist/anatomy.cjs +3 -0
  4. package/dist/anatomy.d.cts +2 -0
  5. package/dist/anatomy.d.ts +2 -0
  6. package/dist/anatomy.js +2 -0
  7. package/dist/angle-3hqP0Mp5.cjs +13 -0
  8. package/dist/angle-oNt8uGHQ.js +8 -0
  9. package/dist/aria-hidden-CEXexb2I.js +127 -0
  10. package/dist/aria-hidden-Y7iJHPMr.cjs +132 -0
  11. package/dist/aria-hidden.cjs +3 -0
  12. package/dist/aria-hidden.d.cts +10 -0
  13. package/dist/aria-hidden.d.ts +10 -0
  14. package/dist/aria-hidden.js +2 -0
  15. package/dist/array-BGtygd0o.cjs +198 -0
  16. package/dist/array-C4KbHsha.js +73 -0
  17. package/dist/auto-resize-5F5iiKZb.cjs +106 -0
  18. package/dist/auto-resize-KkNfCcBt.js +95 -0
  19. package/dist/auto-resize.cjs +4 -0
  20. package/dist/auto-resize.d.cts +7 -0
  21. package/dist/auto-resize.d.ts +7 -0
  22. package/dist/auto-resize.js +2 -0
  23. package/dist/caret-CHqaP4XG.cjs +30 -0
  24. package/dist/caret-aiDJ6mAS.js +19 -0
  25. package/dist/closest-Clo6ODcK.js +117 -0
  26. package/dist/closest-IiRz1GIJ.cjs +176 -0
  27. package/dist/collection-CJU0oDtX.js +1295 -0
  28. package/dist/collection-CwzUJwBJ.cjs +1342 -0
  29. package/dist/collection.cjs +15 -0
  30. package/dist/collection.d.cts +34 -0
  31. package/dist/collection.d.ts +34 -0
  32. package/dist/collection.js +3 -0
  33. package/dist/color-CsugZjq6.d.cts +60 -0
  34. package/dist/color-CsugZjq6.d.ts +60 -0
  35. package/dist/color-utils-DzeOVYlL.cjs +662 -0
  36. package/dist/color-utils-lDDg9FEh.js +639 -0
  37. package/dist/color-utils.cjs +6 -0
  38. package/dist/color-utils.d.cts +18 -0
  39. package/dist/color-utils.d.ts +18 -0
  40. package/dist/color-utils.js +2 -0
  41. package/dist/computed-style-B1MKlCoo.js +9 -0
  42. package/dist/computed-style-DLArEFNw.cjs +14 -0
  43. package/dist/controller-B8E8ZJCI.cjs +133 -0
  44. package/dist/controller-Dv7lWHDr.js +92 -0
  45. package/dist/core-BF6G2RiC.d.cts +1 -0
  46. package/dist/core-BNMw-JId.cjs +372 -0
  47. package/dist/core-BdeZuSX6.d.ts +1 -0
  48. package/dist/core-CJ0MZr3D.js +289 -0
  49. package/dist/core.cjs +19 -0
  50. package/dist/core.d.cts +3 -0
  51. package/dist/core.d.ts +3 -0
  52. package/dist/core.js +3 -0
  53. package/dist/create-anatomy-B2q3wiaw.js +22 -0
  54. package/dist/create-anatomy-BwDn25ph.cjs +27 -0
  55. package/dist/create-props-CgtcN_Qu.js +4 -0
  56. package/dist/create-props-CjLx2oS8.cjs +9 -0
  57. package/dist/data-url-C-Uk31Q9.cjs +42 -0
  58. package/dist/data-url-DHUHj7UF.js +37 -0
  59. package/dist/data-url-Gx_SWG-k.d.cts +10 -0
  60. package/dist/data-url-Gx_SWG-k.d.ts +10 -0
  61. package/dist/date-utils-D-JJHedx.cjs +868 -0
  62. package/dist/date-utils-D5zXW-Cs.js +569 -0
  63. package/dist/date-utils.cjs +52 -0
  64. package/dist/date-utils.d.cts +7 -0
  65. package/dist/date-utils.d.ts +7 -0
  66. package/dist/date-utils.js +2 -0
  67. package/dist/dismissable-C0bixtzl.cjs +348 -0
  68. package/dist/dismissable-KM1jPtNQ.js +337 -0
  69. package/dist/dismissable-layer-BTX5EvXw.d.ts +40 -0
  70. package/dist/dismissable-layer-Ch5niVaq.d.cts +40 -0
  71. package/dist/dismissable.cjs +4 -0
  72. package/dist/dismissable.d.cts +3 -0
  73. package/dist/dismissable.d.ts +3 -0
  74. package/dist/dismissable.js +2 -0
  75. package/dist/dom-query-CQzY93XU.cjs +488 -0
  76. package/dist/dom-query-e7fh0TEH.js +243 -0
  77. package/dist/dom-query.cjs +180 -0
  78. package/dist/dom-query.d.cts +142 -0
  79. package/dist/dom-query.d.ts +142 -0
  80. package/dist/dom-query.js +43 -0
  81. package/dist/equal-C927y7MN.cjs +30 -0
  82. package/dist/equal-DtrP8DPh.js +25 -0
  83. package/dist/event-DDz-mMhM.cjs +242 -0
  84. package/dist/event-bTItRgiw.js +117 -0
  85. package/dist/file-utils-6EXCdfHx.js +116 -0
  86. package/dist/file-utils-B7OJigQq.cjs +151 -0
  87. package/dist/file-utils.cjs +92 -0
  88. package/dist/file-utils.d.cts +40 -0
  89. package/dist/file-utils.d.ts +40 -0
  90. package/dist/file-utils.js +82 -0
  91. package/dist/focus-trap-89E5I9nm.js +487 -0
  92. package/dist/focus-trap-D7jKsfHW.cjs +498 -0
  93. package/dist/focus-trap.cjs +4 -0
  94. package/dist/focus-trap.d.cts +89 -0
  95. package/dist/focus-trap.d.ts +89 -0
  96. package/dist/focus-trap.js +2 -0
  97. package/dist/focus-visible-DWdQf__4.js +176 -0
  98. package/dist/focus-visible-G4cmlWqq.cjs +217 -0
  99. package/dist/focus-visible.cjs +9 -0
  100. package/dist/focus-visible.d.cts +32 -0
  101. package/dist/focus-visible.d.ts +32 -0
  102. package/dist/focus-visible.js +2 -0
  103. package/dist/form-B1DW_w_3.js +89 -0
  104. package/dist/form-CoupKpuP.cjs +130 -0
  105. package/dist/from-window-5ZhzSURC.js +68 -0
  106. package/dist/from-window-B9DKtaoR.cjs +115 -0
  107. package/dist/functions-isw5Ovcx.d.cts +16 -0
  108. package/dist/functions-isw5Ovcx.d.ts +16 -0
  109. package/dist/highlight-word.cjs +95 -0
  110. package/dist/highlight-word.d.cts +24 -0
  111. package/dist/highlight-word.d.ts +24 -0
  112. package/dist/highlight-word.js +94 -0
  113. package/dist/hotkeys.cjs +1183 -0
  114. package/dist/hotkeys.d.cts +199 -0
  115. package/dist/hotkeys.d.ts +199 -0
  116. package/dist/hotkeys.js +1173 -0
  117. package/dist/i18n-utils-BD4VtonY.cjs +345 -0
  118. package/dist/i18n-utils-C4FQZ39m.js +280 -0
  119. package/dist/i18n-utils.cjs +216 -0
  120. package/dist/i18n-utils.d.cts +71 -0
  121. package/dist/i18n-utils.d.ts +71 -0
  122. package/dist/i18n-utils.js +204 -0
  123. package/dist/index-3tNJficI.d.cts +117 -0
  124. package/dist/index-3tNJficI.d.ts +117 -0
  125. package/dist/index-BEfvdGE2.d.cts +116 -0
  126. package/dist/index-BEfvdGE2.d.ts +116 -0
  127. package/dist/index-BF6G2RiC.d.cts +1 -0
  128. package/dist/index-BKgxIVbE.d.cts +285 -0
  129. package/dist/index-BMtpmaRD.d.cts +16 -0
  130. package/dist/index-BMtpmaRD.d.ts +16 -0
  131. package/dist/index-BWiYePx8.d.cts +216 -0
  132. package/dist/index-BXfunVyD.d.cts +1342 -0
  133. package/dist/index-BXfunVyD.d.ts +1342 -0
  134. package/dist/index-BdeZuSX6.d.ts +1 -0
  135. package/dist/index-C2865AJq.d.cts +25 -0
  136. package/dist/index-C2865AJq.d.ts +25 -0
  137. package/dist/index-CFoN0L3C.d.ts +285 -0
  138. package/dist/index-vPrqYDHu.d.ts +216 -0
  139. package/dist/index.cjs +19 -0
  140. package/dist/index.d.cts +3 -0
  141. package/dist/index.d.ts +3 -0
  142. package/dist/index.js +3 -0
  143. package/dist/initial-focus-BQxRRFPa.cjs +37 -0
  144. package/dist/initial-focus-BrN5tT2X.js +26 -0
  145. package/dist/interact-outside-BjqIunFx.js +211 -0
  146. package/dist/interact-outside-Dphjr2Zh.cjs +216 -0
  147. package/dist/interact-outside.cjs +3 -0
  148. package/dist/interact-outside.d.cts +2 -0
  149. package/dist/interact-outside.d.ts +2 -0
  150. package/dist/interact-outside.js +2 -0
  151. package/dist/json-tree-utils.cjs +1518 -0
  152. package/dist/json-tree-utils.d.cts +117 -0
  153. package/dist/json-tree-utils.d.ts +117 -0
  154. package/dist/json-tree-utils.js +1469 -0
  155. package/dist/list-collection-D_eNKrot.d.cts +60 -0
  156. package/dist/list-collection-RqYEWHb4.d.ts +60 -0
  157. package/dist/live-region-BD0OgmrH.cjs +68 -0
  158. package/dist/live-region-F8YMmbrY.js +63 -0
  159. package/dist/live-region.cjs +3 -0
  160. package/dist/live-region.d.cts +2 -0
  161. package/dist/live-region.d.ts +2 -0
  162. package/dist/live-region.js +2 -0
  163. package/dist/machines/accordion/index.cjs +328 -0
  164. package/dist/machines/accordion/index.d.cts +83 -0
  165. package/dist/machines/accordion/index.d.ts +83 -0
  166. package/dist/machines/accordion/index.js +321 -0
  167. package/dist/machines/angle-slider/index.cjs +420 -0
  168. package/dist/machines/angle-slider/index.d.cts +84 -0
  169. package/dist/machines/angle-slider/index.d.ts +84 -0
  170. package/dist/machines/angle-slider/index.js +415 -0
  171. package/dist/machines/async-list/index.cjs +310 -0
  172. package/dist/machines/async-list/index.d.cts +90 -0
  173. package/dist/machines/async-list/index.d.ts +90 -0
  174. package/dist/machines/async-list/index.js +308 -0
  175. package/dist/machines/avatar/index.cjs +165 -0
  176. package/dist/machines/avatar/index.d.cts +63 -0
  177. package/dist/machines/avatar/index.d.ts +63 -0
  178. package/dist/machines/avatar/index.js +160 -0
  179. package/dist/machines/carousel/index.cjs +929 -0
  180. package/dist/machines/carousel/index.d.cts +146 -0
  181. package/dist/machines/carousel/index.d.ts +146 -0
  182. package/dist/machines/carousel/index.js +920 -0
  183. package/dist/machines/cascade-select/index.cjs +1426 -0
  184. package/dist/machines/cascade-select/index.d.cts +167 -0
  185. package/dist/machines/cascade-select/index.d.ts +167 -0
  186. package/dist/machines/cascade-select/index.js +1419 -0
  187. package/dist/machines/checkbox/index.cjs +316 -0
  188. package/dist/machines/checkbox/index.d.cts +81 -0
  189. package/dist/machines/checkbox/index.d.ts +81 -0
  190. package/dist/machines/checkbox/index.js +311 -0
  191. package/dist/machines/clipboard/index.cjs +228 -0
  192. package/dist/machines/clipboard/index.d.cts +72 -0
  193. package/dist/machines/clipboard/index.d.ts +72 -0
  194. package/dist/machines/clipboard/index.js +221 -0
  195. package/dist/machines/collapsible/index.cjs +363 -0
  196. package/dist/machines/collapsible/index.d.cts +82 -0
  197. package/dist/machines/collapsible/index.d.ts +82 -0
  198. package/dist/machines/collapsible/index.js +358 -0
  199. package/dist/machines/color-picker/index.cjs +1534 -0
  200. package/dist/machines/color-picker/index.d.cts +207 -0
  201. package/dist/machines/color-picker/index.d.ts +207 -0
  202. package/dist/machines/color-picker/index.js +1518 -0
  203. package/dist/machines/combobox/index.cjs +1554 -0
  204. package/dist/machines/combobox/index.d.cts +219 -0
  205. package/dist/machines/combobox/index.d.ts +219 -0
  206. package/dist/machines/combobox/index.js +1542 -0
  207. package/dist/machines/date-input/index.cjs +1974 -0
  208. package/dist/machines/date-input/index.d.cts +230 -0
  209. package/dist/machines/date-input/index.d.ts +230 -0
  210. package/dist/machines/date-input/index.js +1958 -0
  211. package/dist/machines/date-picker/index.cjs +2424 -0
  212. package/dist/machines/date-picker/index.d.cts +378 -0
  213. package/dist/machines/date-picker/index.d.ts +378 -0
  214. package/dist/machines/date-picker/index.js +2408 -0
  215. package/dist/machines/dialog/index.cjs +378 -0
  216. package/dist/machines/dialog/index.d.cts +94 -0
  217. package/dist/machines/dialog/index.d.ts +94 -0
  218. package/dist/machines/dialog/index.js +373 -0
  219. package/dist/machines/drawer/index.cjs +2066 -0
  220. package/dist/machines/drawer/index.d.cts +334 -0
  221. package/dist/machines/drawer/index.d.ts +334 -0
  222. package/dist/machines/drawer/index.js +2059 -0
  223. package/dist/machines/editable/index.cjs +550 -0
  224. package/dist/machines/editable/index.d.cts +114 -0
  225. package/dist/machines/editable/index.d.ts +114 -0
  226. package/dist/machines/editable/index.js +545 -0
  227. package/dist/machines/file-upload/index.cjs +648 -0
  228. package/dist/machines/file-upload/index.d.cts +150 -0
  229. package/dist/machines/file-upload/index.d.ts +150 -0
  230. package/dist/machines/file-upload/index.js +641 -0
  231. package/dist/machines/floating-panel/index.cjs +1020 -0
  232. package/dist/machines/floating-panel/index.d.cts +149 -0
  233. package/dist/machines/floating-panel/index.d.ts +149 -0
  234. package/dist/machines/floating-panel/index.js +1012 -0
  235. package/dist/machines/hover-card/index.cjs +441 -0
  236. package/dist/machines/hover-card/index.d.cts +82 -0
  237. package/dist/machines/hover-card/index.d.ts +82 -0
  238. package/dist/machines/hover-card/index.js +436 -0
  239. package/dist/machines/image-cropper/index.cjs +2082 -0
  240. package/dist/machines/image-cropper/index.d.cts +182 -0
  241. package/dist/machines/image-cropper/index.d.ts +182 -0
  242. package/dist/machines/image-cropper/index.js +2076 -0
  243. package/dist/machines/listbox/index.cjs +873 -0
  244. package/dist/machines/listbox/index.d.cts +175 -0
  245. package/dist/machines/listbox/index.d.ts +175 -0
  246. package/dist/machines/listbox/index.js +860 -0
  247. package/dist/machines/marquee/index.cjs +387 -0
  248. package/dist/machines/marquee/index.d.cts +102 -0
  249. package/dist/machines/marquee/index.d.ts +102 -0
  250. package/dist/machines/marquee/index.js +382 -0
  251. package/dist/machines/menu/index.cjs +1562 -0
  252. package/dist/machines/menu/index.d.cts +188 -0
  253. package/dist/machines/menu/index.d.ts +188 -0
  254. package/dist/machines/menu/index.js +1549 -0
  255. package/dist/machines/navigation-menu/index.cjs +860 -0
  256. package/dist/machines/navigation-menu/index.d.cts +131 -0
  257. package/dist/machines/navigation-menu/index.d.ts +131 -0
  258. package/dist/machines/navigation-menu/index.js +855 -0
  259. package/dist/machines/number-input/index.cjs +1014 -0
  260. package/dist/machines/number-input/index.d.cts +136 -0
  261. package/dist/machines/number-input/index.d.ts +136 -0
  262. package/dist/machines/number-input/index.js +1009 -0
  263. package/dist/machines/pagination/index.cjs +413 -0
  264. package/dist/machines/pagination/index.d.cts +139 -0
  265. package/dist/machines/pagination/index.d.ts +139 -0
  266. package/dist/machines/pagination/index.js +404 -0
  267. package/dist/machines/password-input/index.cjs +224 -0
  268. package/dist/machines/password-input/index.d.cts +71 -0
  269. package/dist/machines/password-input/index.d.ts +71 -0
  270. package/dist/machines/password-input/index.js +219 -0
  271. package/dist/machines/pin-input/index.cjs +595 -0
  272. package/dist/machines/pin-input/index.d.cts +107 -0
  273. package/dist/machines/pin-input/index.d.ts +107 -0
  274. package/dist/machines/pin-input/index.js +590 -0
  275. package/dist/machines/popover/index.cjs +516 -0
  276. package/dist/machines/popover/index.d.cts +107 -0
  277. package/dist/machines/popover/index.d.ts +107 -0
  278. package/dist/machines/popover/index.js +511 -0
  279. package/dist/machines/presence/index.cjs +193 -0
  280. package/dist/machines/presence/index.d.cts +44 -0
  281. package/dist/machines/presence/index.d.ts +44 -0
  282. package/dist/machines/presence/index.js +190 -0
  283. package/dist/machines/progress/index.cjs +282 -0
  284. package/dist/machines/progress/index.d.cts +96 -0
  285. package/dist/machines/progress/index.d.ts +96 -0
  286. package/dist/machines/progress/index.js +277 -0
  287. package/dist/machines/qr-code/index.cjs +167 -0
  288. package/dist/machines/qr-code/index.d.cts +71 -0
  289. package/dist/machines/qr-code/index.d.ts +71 -0
  290. package/dist/machines/qr-code/index.js +162 -0
  291. package/dist/machines/radio-group/index.cjs +465 -0
  292. package/dist/machines/radio-group/index.d.cts +218 -0
  293. package/dist/machines/radio-group/index.d.ts +218 -0
  294. package/dist/machines/radio-group/index.js +458 -0
  295. package/dist/machines/rating-group/index.cjs +405 -0
  296. package/dist/machines/rating-group/index.d.cts +101 -0
  297. package/dist/machines/rating-group/index.d.ts +101 -0
  298. package/dist/machines/rating-group/index.js +398 -0
  299. package/dist/machines/scroll-area/index.cjs +865 -0
  300. package/dist/machines/scroll-area/index.d.cts +126 -0
  301. package/dist/machines/scroll-area/index.d.ts +126 -0
  302. package/dist/machines/scroll-area/index.js +860 -0
  303. package/dist/machines/select/index.cjs +1226 -0
  304. package/dist/machines/select/index.d.cts +190 -0
  305. package/dist/machines/select/index.d.ts +190 -0
  306. package/dist/machines/select/index.js +1214 -0
  307. package/dist/machines/signature-pad/index.cjs +337 -0
  308. package/dist/machines/signature-pad/index.d.cts +108 -0
  309. package/dist/machines/signature-pad/index.d.ts +108 -0
  310. package/dist/machines/signature-pad/index.js +330 -0
  311. package/dist/machines/slider/index.cjs +1103 -0
  312. package/dist/machines/slider/index.d.cts +154 -0
  313. package/dist/machines/slider/index.d.ts +154 -0
  314. package/dist/machines/slider/index.js +1094 -0
  315. package/dist/machines/splitter/index.cjs +1686 -0
  316. package/dist/machines/splitter/index.d.cts +282 -0
  317. package/dist/machines/splitter/index.d.ts +282 -0
  318. package/dist/machines/splitter/index.js +1675 -0
  319. package/dist/machines/steps/index.cjs +330 -0
  320. package/dist/machines/steps/index.d.cts +109 -0
  321. package/dist/machines/steps/index.d.ts +109 -0
  322. package/dist/machines/steps/index.js +325 -0
  323. package/dist/machines/switch/index.cjs +307 -0
  324. package/dist/machines/switch/index.d.cts +80 -0
  325. package/dist/machines/switch/index.d.ts +80 -0
  326. package/dist/machines/switch/index.js +302 -0
  327. package/dist/machines/tabs/index.cjs +542 -0
  328. package/dist/machines/tabs/index.d.cts +113 -0
  329. package/dist/machines/tabs/index.d.ts +113 -0
  330. package/dist/machines/tabs/index.js +533 -0
  331. package/dist/machines/tags-input/index.cjs +1151 -0
  332. package/dist/machines/tags-input/index.d.cts +182 -0
  333. package/dist/machines/tags-input/index.d.ts +182 -0
  334. package/dist/machines/tags-input/index.js +1144 -0
  335. package/dist/machines/timer/index.cjs +329 -0
  336. package/dist/machines/timer/index.d.cts +102 -0
  337. package/dist/machines/timer/index.d.ts +102 -0
  338. package/dist/machines/timer/index.js +323 -0
  339. package/dist/machines/toast/index.cjs +1185 -0
  340. package/dist/machines/toast/index.d.cts +204 -0
  341. package/dist/machines/toast/index.d.ts +204 -0
  342. package/dist/machines/toast/index.js +1180 -0
  343. package/dist/machines/toc/index.cjs +358 -0
  344. package/dist/machines/toc/index.d.cts +98 -0
  345. package/dist/machines/toc/index.d.ts +98 -0
  346. package/dist/machines/toc/index.js +351 -0
  347. package/dist/machines/toggle/index.cjs +99 -0
  348. package/dist/machines/toggle/index.d.cts +46 -0
  349. package/dist/machines/toggle/index.d.ts +46 -0
  350. package/dist/machines/toggle/index.js +94 -0
  351. package/dist/machines/toggle-group/index.cjs +329 -0
  352. package/dist/machines/toggle-group/index.d.cts +81 -0
  353. package/dist/machines/toggle-group/index.d.ts +81 -0
  354. package/dist/machines/toggle-group/index.js +322 -0
  355. package/dist/machines/tooltip/index.cjs +638 -0
  356. package/dist/machines/tooltip/index.d.cts +84 -0
  357. package/dist/machines/tooltip/index.d.ts +84 -0
  358. package/dist/machines/tooltip/index.js +633 -0
  359. package/dist/machines/tour/index.cjs +1123 -0
  360. package/dist/machines/tour/index.d.cts +207 -0
  361. package/dist/machines/tour/index.d.ts +207 -0
  362. package/dist/machines/tour/index.js +1115 -0
  363. package/dist/machines/tree-view/index.cjs +1288 -0
  364. package/dist/machines/tree-view/index.d.cts +221 -0
  365. package/dist/machines/tree-view/index.d.ts +221 -0
  366. package/dist/machines/tree-view/index.js +1279 -0
  367. package/dist/mutation-observer-_LbwtN3W.cjs +61 -0
  368. package/dist/mutation-observer-qObPUo3D.js +50 -0
  369. package/dist/navigate-CJOaL3vx.js +31 -0
  370. package/dist/navigate-uJG-006f.cjs +42 -0
  371. package/dist/overflow-BBihfMxX.cjs +67 -0
  372. package/dist/overflow-C-zO1CWA.js +44 -0
  373. package/dist/platform-BDB0wXUk.js +26 -0
  374. package/dist/platform-BZS-dkZN.cjs +109 -0
  375. package/dist/point-C9A4dk1i.js +27 -0
  376. package/dist/point-DxnCrJBy.cjs +32 -0
  377. package/dist/pointer-lock-BvfSjt_s.cjs +31 -0
  378. package/dist/pointer-lock-WezxTqu-.js +26 -0
  379. package/dist/pointer-move-CGzan38r.cjs +42 -0
  380. package/dist/pointer-move-Tijb8Ptk.js +37 -0
  381. package/dist/polygon-BvdwYRBw.js +76 -0
  382. package/dist/polygon-CTR1kEoU.cjs +93 -0
  383. package/dist/popper-DkAAS9VE.cjs +487 -0
  384. package/dist/popper-DzBZzAe4.js +464 -0
  385. package/dist/popper.cjs +6 -0
  386. package/dist/popper.d.cts +2 -0
  387. package/dist/popper.d.ts +2 -0
  388. package/dist/popper.js +2 -0
  389. package/dist/press-B7XLrLGR.js +65 -0
  390. package/dist/press-BdD5suLQ.cjs +70 -0
  391. package/dist/proxy-tab-focus-DWMXvAfO.js +54 -0
  392. package/dist/proxy-tab-focus-NthYgHdY.cjs +59 -0
  393. package/dist/raf-BSDcY4UD.cjs +85 -0
  394. package/dist/raf-DgINgykK.d.cts +15 -0
  395. package/dist/raf-DgINgykK.d.ts +15 -0
  396. package/dist/raf-Dhvm7f1e.js +62 -0
  397. package/dist/rect-utils-DiT4k3jS.cjs +548 -0
  398. package/dist/rect-utils-d_3gZVsc.js +459 -0
  399. package/dist/rect-utils.cjs +165 -0
  400. package/dist/rect-utils.d.cts +197 -0
  401. package/dist/rect-utils.d.ts +197 -0
  402. package/dist/rect-utils.js +116 -0
  403. package/dist/remove-scroll-DTVA5f4w.cjs +86 -0
  404. package/dist/remove-scroll-WEheFCiq.js +81 -0
  405. package/dist/remove-scroll.cjs +3 -0
  406. package/dist/remove-scroll.d.cts +4 -0
  407. package/dist/remove-scroll.d.ts +4 -0
  408. package/dist/remove-scroll.js +2 -0
  409. package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
  410. package/dist/scale-C5BBHVgH.js +17 -0
  411. package/dist/scale-C7iiUGhS.cjs +22 -0
  412. package/dist/scope-CysKlKe9.cjs +28 -0
  413. package/dist/scope-D1873Mzi.js +23 -0
  414. package/dist/scroll-CVJ40w2e.js +46 -0
  415. package/dist/scroll-Dyd1QLrc.cjs +63 -0
  416. package/dist/scroll-snap-Cuaqdevf.cjs +224 -0
  417. package/dist/scroll-snap-DqMiFASa.js +201 -0
  418. package/dist/scroll-snap.cjs +6 -0
  419. package/dist/scroll-snap.d.cts +14 -0
  420. package/dist/scroll-snap.d.ts +14 -0
  421. package/dist/scroll-snap.js +2 -0
  422. package/dist/selection-ClKhnWit.d.cts +49 -0
  423. package/dist/selection-DzLiSVkg.d.ts +49 -0
  424. package/dist/selection-map-962WvX2k.js +45 -0
  425. package/dist/selection-map-BwlZr1LH.cjs +68 -0
  426. package/dist/set-CFNGOW5W.js +50 -0
  427. package/dist/set-DrtWCLFb.cjs +73 -0
  428. package/dist/store-BLpJlMxz.js +257 -0
  429. package/dist/store-Btfrm2bs.cjs +47 -0
  430. package/dist/store-C5HvdLyc.js +42 -0
  431. package/dist/store-Wg8KVwNv.cjs +298 -0
  432. package/dist/store.cjs +9 -0
  433. package/dist/store.d.cts +26 -0
  434. package/dist/store.d.ts +26 -0
  435. package/dist/store.js +2 -0
  436. package/dist/stringify-state.cjs +48 -0
  437. package/dist/stringify-state.d.cts +8 -0
  438. package/dist/stringify-state.d.ts +8 -0
  439. package/dist/stringify-state.js +44 -0
  440. package/dist/tabbable-Bz1-1GAY.cjs +206 -0
  441. package/dist/tabbable-CDA1YMjZ.js +147 -0
  442. package/dist/text-selection-B3OQpQGy.cjs +75 -0
  443. package/dist/text-selection-DXvWvm6k.js +64 -0
  444. package/dist/timers-BRyPrXIX.js +82 -0
  445. package/dist/timers-Beu4SfAj.cjs +99 -0
  446. package/dist/tree-collection-3QX3EIhq.d.ts +77 -0
  447. package/dist/tree-collection-C6oDQGUJ.d.cts +77 -0
  448. package/dist/typeahead-DremEgML.d.cts +45 -0
  449. package/dist/typeahead-DremEgML.d.ts +45 -0
  450. package/dist/types-BFuHIo7S.js +10 -0
  451. package/dist/types-CczqoQLL.d.cts +57 -0
  452. package/dist/types-CczqoQLL.d.ts +57 -0
  453. package/dist/types-CjocssbC.d.cts +13 -0
  454. package/dist/types-CjocssbC.d.ts +13 -0
  455. package/dist/types-D7oF7eWh.d.cts +54 -0
  456. package/dist/types-D7oF7eWh.d.ts +54 -0
  457. package/dist/types-HCvp3Bhv.cjs +21 -0
  458. package/dist/types.cjs +14 -0
  459. package/dist/types.d.cts +6 -0
  460. package/dist/types.d.ts +6 -0
  461. package/dist/types.js +12 -0
  462. package/dist/utils-BH-oBBz2.cjs +614 -0
  463. package/dist/utils-Cht5XaHf.js +267 -0
  464. package/dist/utils.cjs +95 -0
  465. package/dist/utils.d.cts +144 -0
  466. package/dist/utils.d.ts +144 -0
  467. package/dist/utils.js +7 -0
  468. package/dist/visually-hidden-BgSCFLz_.cjs +29 -0
  469. package/dist/visually-hidden-yDJ517KZ.js +18 -0
  470. package/dist/wait-for-3n85JcCU.d.cts +15 -0
  471. package/dist/wait-for-3n85JcCU.d.ts +15 -0
  472. package/dist/wait-for-CI5Ye-Lo.js +69 -0
  473. package/dist/wait-for-Db73VpZQ.cjs +86 -0
  474. package/dist/warning-CrzBpWT1.js +19 -0
  475. package/dist/warning-HAmFXLHm.cjs +42 -0
  476. package/package.json +349 -6
@@ -0,0 +1,1958 @@
1
+ import { t as createAnatomy } from "../../create-anatomy-B2q3wiaw.js";
2
+ import { L as ariaAttr, f as queryAll, p as contains, z as dataAttr } from "../../dom-query-e7fh0TEH.js";
3
+ import { c as getNativeEvent, l as isComposingEvent, r as getEventKey } from "../../event-bTItRgiw.js";
4
+ import { i as raf } from "../../raf-Dhvm7f1e.js";
5
+ import { n as visuallyHiddenStyle } from "../../visually-hidden-yDJ517KZ.js";
6
+ import { n as createSplitProps } from "../../utils-Cht5XaHf.js";
7
+ import { p as memo, r as createMachine } from "../../core-CJ0MZr3D.js";
8
+ import { J as constrainSegments, R as isDateEqual, a as isValidCharacter, g as getTodayDate, i as getLocaleSeparator } from "../../date-utils-D5zXW-Cs.js";
9
+ import { t as createLiveRegion } from "../../live-region-F8YMmbrY.js";
10
+ import { t as createProps } from "../../create-props-CgtcN_Qu.js";
11
+ import { CalendarDate, DateFormatter, parseDate, toCalendar, toCalendarDateTime } from "@internationalized/date";
12
+ //#region src/machines/date-input/anatomy.ts
13
+ const anatomy = createAnatomy("date-input").parts("root", "label", "control", "segmentGroup", "segment", "hiddenInput");
14
+ const parts = anatomy.build();
15
+ //#endregion
16
+ //#region src/machines/date-input/dom.ts
17
+ const getRootId = (ctx) => ctx.ids?.root ?? `date-input:${ctx.id}`;
18
+ const getLabelId = (ctx, index) => ctx.ids?.label?.(index) ?? `date-input:${ctx.id}:label:${index}`;
19
+ const getControlId = (ctx) => ctx.ids?.control ?? `date-input:${ctx.id}:control`;
20
+ const getSegmentGroupId = (ctx, index) => ctx.ids?.segmentGroup?.(index) ?? `date-input:${ctx.id}:segment-group:${index}`;
21
+ const getHiddenInputId = (ctx, index) => ctx.ids?.hiddenInput?.(index) ?? `date-input:${ctx.id}:hidden-input:${index}`;
22
+ const getControlEl = (ctx) => ctx.getById(getControlId(ctx));
23
+ const getSegmentEls = (ctx) => queryAll(getControlEl(ctx), `[data-part=segment]`);
24
+ //#endregion
25
+ //#region src/machines/date-input/utils/segments.ts
26
+ function needsTimeGranularity(granularity) {
27
+ return granularity === "hour" || granularity === "minute" || granularity === "second";
28
+ }
29
+ function getFormatterOptions(opts) {
30
+ const { granularity, digitStyle, hourCycle, timeZone, hasTimeZone, hideTimeZone } = opts;
31
+ const options = {
32
+ timeZone,
33
+ day: digitStyle,
34
+ month: digitStyle,
35
+ year: "numeric",
36
+ hourCycle
37
+ };
38
+ if (needsTimeGranularity(granularity)) options.hour = digitStyle;
39
+ if (granularity === "minute" || granularity === "second") options.minute = "2-digit";
40
+ if (granularity === "second") options.second = "2-digit";
41
+ if (hasTimeZone && !hideTimeZone) options.timeZoneName = "short";
42
+ return options;
43
+ }
44
+ function resolveAllSegments(formatter) {
45
+ const segs = formatter.formatToParts(/* @__PURE__ */ new Date()).filter((seg) => EDITABLE_SEGMENTS[seg.type]).reduce((p, seg) => {
46
+ const key = TYPE_MAPPING[seg.type] || seg.type;
47
+ p[key] = true;
48
+ return p;
49
+ }, {});
50
+ if (segs.year) segs.era = true;
51
+ return segs;
52
+ }
53
+ const EDITABLE_SEGMENTS = {
54
+ year: true,
55
+ month: true,
56
+ day: true,
57
+ hour: true,
58
+ minute: true,
59
+ second: true,
60
+ dayPeriod: true,
61
+ era: true,
62
+ literal: false,
63
+ timeZoneName: false,
64
+ weekday: false,
65
+ unknown: false,
66
+ fractionalSecond: false
67
+ };
68
+ const PAGE_STEP = {
69
+ year: 5,
70
+ month: 2,
71
+ day: 7,
72
+ hour: 2,
73
+ minute: 15,
74
+ second: 15,
75
+ dayPeriod: void 0,
76
+ era: void 0,
77
+ literal: void 0,
78
+ timeZoneName: void 0,
79
+ weekday: void 0,
80
+ unknown: void 0,
81
+ fractionalSecond: void 0
82
+ };
83
+ const SEGMENT_LABELS = {
84
+ era: "Era",
85
+ year: "Year",
86
+ month: "Month",
87
+ day: "Day",
88
+ hour: "Hour",
89
+ minute: "Minute",
90
+ second: "Second",
91
+ dayPeriod: "AM/PM",
92
+ timeZoneName: "Time zone"
93
+ };
94
+ function getSegmentLabel(type) {
95
+ return SEGMENT_LABELS[type] ?? type;
96
+ }
97
+ const TYPE_MAPPING = {
98
+ dayperiod: "dayPeriod",
99
+ relatedYear: "year",
100
+ yearName: "literal",
101
+ unknown: "literal"
102
+ };
103
+ function getSafeType(type) {
104
+ return TYPE_MAPPING[type] ?? type;
105
+ }
106
+ function getPlaceholder(type, translations, locale) {
107
+ return translations.placeholder(locale)[type];
108
+ }
109
+ function isEditableSegment(type) {
110
+ return EDITABLE_SEGMENTS[type] === true;
111
+ }
112
+ /**
113
+ * Calls formatter.formatToParts(dateValue), with a fallback for environments
114
+ * where very old dates (e.g. year < 100 CE) throw RangeError in Intl.DateTimeFormat.
115
+ */
116
+ function getSafeFormatParts(formatter, dateValue, displayValue) {
117
+ try {
118
+ return formatter.formatToParts(dateValue);
119
+ } catch {
120
+ return formatter.formatToParts(/* @__PURE__ */ new Date()).map((part) => {
121
+ switch (part.type) {
122
+ case "year":
123
+ case "relatedYear": return {
124
+ ...part,
125
+ value: String(displayValue.year ?? 0)
126
+ };
127
+ case "month": return {
128
+ ...part,
129
+ value: String(displayValue.month ?? 0)
130
+ };
131
+ case "day": return {
132
+ ...part,
133
+ value: String(displayValue.day ?? 0)
134
+ };
135
+ }
136
+ return part;
137
+ });
138
+ }
139
+ }
140
+ function processSegments({ dateValue, displayValue, formatter, locale, translations, granularity }) {
141
+ const timeValue = [
142
+ "hour",
143
+ "minute",
144
+ "second"
145
+ ];
146
+ const segments = getSafeFormatParts(formatter, dateValue, displayValue);
147
+ const processedSegments = [];
148
+ for (const segment of segments) {
149
+ const type = getSafeType(segment.type);
150
+ let isEditable = isEditableSegment(type);
151
+ if (type === "era" && displayValue.calendar.getEras().length === 1) isEditable = false;
152
+ const isPlaceholder = isEditable && displayValue[type] == null;
153
+ let placeholder = isEditableSegment(type) ? getPlaceholder(type, translations, locale) : null;
154
+ if ((type === "dayPeriod" || type === "era") && segment.value) placeholder = segment.value;
155
+ const dateSegment = {
156
+ type,
157
+ text: isPlaceholder ? placeholder : segment.value,
158
+ ...displayValue.getSegmentLimits(type),
159
+ isPlaceholder,
160
+ placeholder,
161
+ isEditable
162
+ };
163
+ if (type === "hour") {
164
+ processedSegments.push({
165
+ type: "literal",
166
+ text: "⁦",
167
+ isPlaceholder: false,
168
+ placeholder: "",
169
+ isEditable: false
170
+ });
171
+ processedSegments.push(dateSegment);
172
+ if (type === granularity) processedSegments.push({
173
+ type: "literal",
174
+ text: "⁩",
175
+ isPlaceholder: false,
176
+ placeholder: "",
177
+ isEditable: false
178
+ });
179
+ } else if (timeValue.includes(type) && type === granularity) {
180
+ processedSegments.push(dateSegment);
181
+ processedSegments.push({
182
+ type: "literal",
183
+ text: "⁩",
184
+ isPlaceholder: false,
185
+ placeholder: "",
186
+ isEditable: false
187
+ });
188
+ } else processedSegments.push(dateSegment);
189
+ }
190
+ return processedSegments;
191
+ }
192
+ //#endregion
193
+ //#region src/machines/date-input/utils/validity.ts
194
+ const isFocusableSegment = (segment) => segment.type !== "literal";
195
+ function getGroupCount(selectionMode) {
196
+ return selectionMode === "range" ? 2 : 1;
197
+ }
198
+ function getGroupOffset(allSegments, index) {
199
+ return allSegments.slice(0, index).reduce((acc, segs) => acc + segs.length, 0);
200
+ }
201
+ function resolveActiveSegment(ctx) {
202
+ const { context, computed } = ctx;
203
+ const index = context.get("activeIndex");
204
+ const activeSegmentIndex = context.get("activeSegmentIndex");
205
+ const allSegments = computed("segments");
206
+ const offset = getGroupOffset(allSegments, index);
207
+ return {
208
+ allSegments,
209
+ segments: allSegments[index],
210
+ offset,
211
+ localIndex: activeSegmentIndex - offset
212
+ };
213
+ }
214
+ function getActiveSegment(ctx) {
215
+ const { allSegments, localIndex } = resolveActiveSegment(ctx);
216
+ return allSegments[ctx.context.get("activeIndex")]?.[localIndex];
217
+ }
218
+ function goToNextSegment(ctx, predicate = isFocusableSegment) {
219
+ const { context } = ctx;
220
+ const index = context.get("activeIndex");
221
+ const { allSegments, segments, offset, localIndex } = resolveActiveSegment(ctx);
222
+ const nextLocalIndex = segments.findIndex((s, i) => i > localIndex && predicate(s));
223
+ if (nextLocalIndex !== -1) {
224
+ context.set("activeSegmentIndex", offset + nextLocalIndex);
225
+ return;
226
+ }
227
+ const nextGroupSegments = allSegments[index + 1];
228
+ if (!nextGroupSegments) return;
229
+ const firstNextGroupLocalIndex = nextGroupSegments.findIndex(predicate);
230
+ if (firstNextGroupLocalIndex === -1) return;
231
+ context.set("activeIndex", index + 1);
232
+ context.set("activeSegmentIndex", offset + segments.length + firstNextGroupLocalIndex);
233
+ }
234
+ function goToPreviousSegment(ctx, predicate = isFocusableSegment) {
235
+ const { context } = ctx;
236
+ const index = context.get("activeIndex");
237
+ const { allSegments, segments, offset, localIndex } = resolveActiveSegment(ctx);
238
+ const prevLocalIndex = segments.findLastIndex((s, i) => i < localIndex && predicate(s));
239
+ if (prevLocalIndex !== -1) {
240
+ context.set("activeSegmentIndex", offset + prevLocalIndex);
241
+ return;
242
+ }
243
+ const prevGroupIndex = index - 1;
244
+ if (prevGroupIndex < 0) return;
245
+ const prevGroupSegments = allSegments[prevGroupIndex];
246
+ if (!prevGroupSegments) return;
247
+ const lastPrevGroupLocalIndex = prevGroupSegments.findLastIndex(predicate);
248
+ if (lastPrevGroupLocalIndex === -1) return;
249
+ context.set("activeIndex", prevGroupIndex);
250
+ context.set("activeSegmentIndex", getGroupOffset(allSegments, prevGroupIndex) + lastPrevGroupLocalIndex);
251
+ }
252
+ function getActiveDisplayValue(ctx) {
253
+ const index = ctx.context.get("activeIndex");
254
+ return ctx.context.get("displayValues")[index];
255
+ }
256
+ function setDisplayValue(ctx, index, dv) {
257
+ const displayValues = [...ctx.context.get("displayValues")];
258
+ displayValues[index] = dv;
259
+ ctx.context.set("displayValues", displayValues);
260
+ }
261
+ //#endregion
262
+ //#region src/machines/date-input/connect.ts
263
+ function connect(service, normalize) {
264
+ const { state, context, prop, send, computed, scope } = service;
265
+ const disabled = Boolean(prop("disabled"));
266
+ const readOnly = Boolean(prop("readOnly"));
267
+ const isDateUnavailableFn = prop("isDateUnavailable");
268
+ const value = context.get("value");
269
+ const valueAsDate = value.filter((date) => date != null).map((date) => date.toDate(prop("timeZone")));
270
+ const isDateUnavailable = isDateUnavailableFn ? value.some((date) => date != null && isDateUnavailableFn(date, prop("locale"))) : false;
271
+ const invalid = prop("invalid") ?? isDateUnavailable;
272
+ const focused = state.matches("focused");
273
+ const locale = prop("locale");
274
+ const separator = getLocaleSeparator(locale);
275
+ function getSegmentState(props) {
276
+ const { segment, index = 0 } = props;
277
+ const isEditable = !disabled && !readOnly && segment.isEditable;
278
+ const activeIndex = context.get("activeIndex");
279
+ return {
280
+ editable: isEditable,
281
+ focused: focused && activeIndex === index,
282
+ readonly: !segment.isEditable || readOnly
283
+ };
284
+ }
285
+ return {
286
+ focused,
287
+ disabled,
288
+ invalid,
289
+ value,
290
+ valueAsDate,
291
+ valueAsString: computed("valueAsString"),
292
+ placeholderValue: context.get("placeholderValue"),
293
+ displayValues: context.get("displayValues"),
294
+ focus() {
295
+ getSegmentEls(scope)[0]?.focus();
296
+ },
297
+ setValue(values) {
298
+ send({
299
+ type: "VALUE.SET",
300
+ value: values
301
+ });
302
+ },
303
+ clearValue() {
304
+ send({ type: "VALUE.CLEAR" });
305
+ },
306
+ getSegments(props = {}) {
307
+ const { index = 0 } = props;
308
+ const allSegments = computed("segments");
309
+ const segments = allSegments[index] ?? [];
310
+ const enteredKeys = context.get("enteredKeys");
311
+ const activeIndex = context.get("activeIndex");
312
+ const activeSegmentIndex = context.get("activeSegmentIndex");
313
+ if (focused && enteredKeys && index === activeIndex && activeSegmentIndex >= 0) {
314
+ const localActiveSegmentIndex = activeSegmentIndex - getGroupOffset(allSegments, index);
315
+ return segments.map((segment, index) => {
316
+ if (index !== localActiveSegmentIndex) return segment;
317
+ return {
318
+ ...segment,
319
+ text: enteredKeys,
320
+ isPlaceholder: false
321
+ };
322
+ });
323
+ }
324
+ return segments;
325
+ },
326
+ getSegmentState,
327
+ getRootProps() {
328
+ return normalize.element({
329
+ ...parts.root.attrs,
330
+ dir: prop("dir"),
331
+ id: getRootId(scope),
332
+ "data-disabled": dataAttr(disabled),
333
+ "data-readonly": dataAttr(readOnly),
334
+ "data-invalid": dataAttr(invalid)
335
+ });
336
+ },
337
+ getLabelProps(props = {}) {
338
+ const { index = 0 } = props;
339
+ return normalize.label({
340
+ ...parts.label.attrs,
341
+ id: getLabelId(scope, index),
342
+ dir: prop("dir"),
343
+ htmlFor: getHiddenInputId(scope, index),
344
+ "data-disabled": dataAttr(disabled),
345
+ "data-readonly": dataAttr(readOnly),
346
+ "data-invalid": dataAttr(invalid),
347
+ onClick() {
348
+ if (disabled) return;
349
+ getSegmentEls(scope)[0]?.focus();
350
+ }
351
+ });
352
+ },
353
+ getControlProps() {
354
+ return normalize.element({
355
+ ...parts.control.attrs,
356
+ dir: prop("dir"),
357
+ id: getControlId(scope),
358
+ "data-disabled": dataAttr(disabled),
359
+ "data-readonly": dataAttr(readOnly),
360
+ "data-invalid": dataAttr(invalid),
361
+ "data-focus": dataAttr(focused)
362
+ });
363
+ },
364
+ getSegmentGroupProps(props = {}) {
365
+ const { index = 0 } = props;
366
+ const activeIndex = context.get("activeIndex");
367
+ return normalize.element({
368
+ ...parts.segmentGroup.attrs,
369
+ id: getSegmentGroupId(scope, index),
370
+ dir: prop("dir"),
371
+ role: "group",
372
+ "aria-labelledby": getLabelId(scope, index),
373
+ "data-disabled": dataAttr(disabled),
374
+ "data-readonly": dataAttr(readOnly),
375
+ "data-invalid": dataAttr(invalid),
376
+ "data-focus": dataAttr(focused && activeIndex === index),
377
+ style: { unicodeBidi: "isolate" }
378
+ });
379
+ },
380
+ getSegmentProps(props) {
381
+ const { segment, index = 0 } = props;
382
+ const segmentState = getSegmentState(props);
383
+ if (segment.type === "literal") return normalize.element({
384
+ ...parts.segment.attrs,
385
+ dir: prop("dir"),
386
+ "aria-hidden": true,
387
+ "data-type": segment.type,
388
+ "data-readonly": "",
389
+ "data-disabled": ""
390
+ });
391
+ return normalize.element({
392
+ ...parts.segment.attrs,
393
+ dir: prop("dir"),
394
+ role: "spinbutton",
395
+ tabIndex: disabled ? void 0 : 0,
396
+ autoComplete: "off",
397
+ spellCheck: segmentState.editable ? "false" : void 0,
398
+ autoCorrect: segmentState.editable ? "off" : void 0,
399
+ contentEditable: segmentState.editable,
400
+ suppressContentEditableWarning: segmentState.editable,
401
+ inputMode: disabled || segment.type === "dayPeriod" || segment.type === "era" || !segmentState.editable ? void 0 : "numeric",
402
+ enterKeyHint: "next",
403
+ "aria-label": getSegmentLabel(segment.type),
404
+ "aria-valuenow": segment.isPlaceholder ? void 0 : segment.value,
405
+ "aria-valuetext": segment.isPlaceholder ? segment.placeholder : segment.text,
406
+ "aria-valuemin": segment.minValue,
407
+ "aria-valuemax": segment.maxValue,
408
+ "aria-invalid": ariaAttr(invalid),
409
+ "aria-readonly": ariaAttr(segmentState.readonly),
410
+ "aria-disabled": ariaAttr(disabled),
411
+ "data-value": segment.value,
412
+ "data-type": segment.type,
413
+ "data-readonly": dataAttr(segmentState.readonly),
414
+ "data-disabled": dataAttr(disabled),
415
+ "data-editable": dataAttr(segment.isEditable && !readOnly && !disabled),
416
+ "data-placeholder-shown": dataAttr(segment.isPlaceholder),
417
+ style: { caretColor: "transparent" },
418
+ onFocus(event) {
419
+ const segmentEls = getSegmentEls(scope);
420
+ const target = event.currentTarget;
421
+ const segmentIndex = segmentEls.indexOf(target);
422
+ send({
423
+ type: "SEGMENT.FOCUS",
424
+ dateIndex: index,
425
+ segmentIndex
426
+ });
427
+ const selection = target.ownerDocument?.getSelection?.();
428
+ if (selection && target) selection.collapse(target);
429
+ },
430
+ onBlur(event) {
431
+ const next = event.relatedTarget;
432
+ if (contains(getControlEl(scope), next)) return;
433
+ send({
434
+ type: "SEGMENT.BLUR",
435
+ index: -1
436
+ });
437
+ },
438
+ onKeyDown(event) {
439
+ if (event.defaultPrevented || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey || readOnly || isComposingEvent(event)) return;
440
+ const exec = {
441
+ ArrowLeft() {
442
+ send({ type: "SEGMENT.ARROW_LEFT" });
443
+ },
444
+ ArrowRight() {
445
+ send({ type: "SEGMENT.ARROW_RIGHT" });
446
+ },
447
+ ArrowUp() {
448
+ send({
449
+ type: "SEGMENT.ADJUST",
450
+ segment,
451
+ amount: 1
452
+ });
453
+ },
454
+ ArrowDown() {
455
+ send({
456
+ type: "SEGMENT.ADJUST",
457
+ segment,
458
+ amount: -1
459
+ });
460
+ },
461
+ PageUp() {
462
+ send({
463
+ type: "SEGMENT.ADJUST",
464
+ segment,
465
+ amount: PAGE_STEP[segment.type] ?? 1
466
+ });
467
+ },
468
+ PageDown() {
469
+ send({
470
+ type: "SEGMENT.ADJUST",
471
+ segment,
472
+ amount: -(PAGE_STEP[segment.type] ?? 1)
473
+ });
474
+ },
475
+ Backspace() {
476
+ send({
477
+ type: "SEGMENT.BACKSPACE",
478
+ segment
479
+ });
480
+ },
481
+ Delete() {
482
+ send({
483
+ type: "SEGMENT.BACKSPACE",
484
+ segment
485
+ });
486
+ },
487
+ Home() {
488
+ send({
489
+ type: "SEGMENT.HOME",
490
+ segment
491
+ });
492
+ },
493
+ End() {
494
+ send({
495
+ type: "SEGMENT.END",
496
+ segment
497
+ });
498
+ }
499
+ }[getEventKey(event, { dir: prop("dir") })];
500
+ if (exec) {
501
+ exec(event);
502
+ event.preventDefault();
503
+ event.stopPropagation();
504
+ }
505
+ },
506
+ onPointerDown(event) {
507
+ event.stopPropagation();
508
+ },
509
+ onMouseDown(event) {
510
+ event.stopPropagation();
511
+ },
512
+ onBeforeInput(event) {
513
+ const { data, inputType } = getNativeEvent(event);
514
+ if (ALLOWED_INPUT_TYPES.includes(inputType)) {
515
+ event.preventDefault();
516
+ return;
517
+ }
518
+ if (inputType === "insertFromPaste") {
519
+ event.preventDefault();
520
+ return;
521
+ }
522
+ if (inputType === "insertCompositionText") {
523
+ if (event.currentTarget || event.target) {
524
+ event.preventDefault();
525
+ if (data != null) send({
526
+ type: "SEGMENT.INPUT",
527
+ segment,
528
+ input: data
529
+ });
530
+ }
531
+ return;
532
+ }
533
+ const isTextSegment = segment.type === "dayPeriod" || segment.type === "era";
534
+ if (data && (isTextSegment || isValidCharacter(data, separator, locale))) {
535
+ event.preventDefault();
536
+ send({
537
+ type: "SEGMENT.INPUT",
538
+ segment,
539
+ input: data
540
+ });
541
+ } else event.preventDefault();
542
+ },
543
+ onPaste(event) {
544
+ event.preventDefault();
545
+ const text = event.clipboardData?.getData("text/plain")?.trim();
546
+ if (text) send({
547
+ type: "SEGMENT.PASTE",
548
+ value: text
549
+ });
550
+ }
551
+ });
552
+ },
553
+ getHiddenInputProps(props = {}) {
554
+ const { index = 0, name } = props;
555
+ const value = context.get("value");
556
+ const inputName = name || prop("name");
557
+ return normalize.input({
558
+ ...parts.hiddenInput.attrs,
559
+ type: "hidden",
560
+ id: getHiddenInputId(scope, index),
561
+ name: inputName ? value.length > 1 ? `${inputName}[${index}]` : inputName : void 0,
562
+ form: prop("form"),
563
+ required: prop("required"),
564
+ disabled,
565
+ readOnly,
566
+ value: computed("valueAsString")[index] ?? "",
567
+ style: visuallyHiddenStyle
568
+ });
569
+ }
570
+ };
571
+ }
572
+ const ALLOWED_INPUT_TYPES = [
573
+ "deleteContentBackward",
574
+ "deleteContentForward",
575
+ "deleteByCut",
576
+ "deleteByDrag"
577
+ ];
578
+ //#endregion
579
+ //#region src/machines/date-input/parse.ts
580
+ function parse(value) {
581
+ if (Array.isArray(value)) return value.map((v) => parse(v));
582
+ if (value instanceof Date) return new CalendarDate(value.getFullYear(), value.getMonth() + 1, value.getDate());
583
+ return parseDate(value);
584
+ }
585
+ //#endregion
586
+ //#region src/machines/date-input/utils/formatting.ts
587
+ function toFormatterDate(date, formatter) {
588
+ return date.toDate(formatter.resolvedOptions().timeZone);
589
+ }
590
+ function getValueAsString(value, prop) {
591
+ return value.map((date) => {
592
+ if (date == null) return "";
593
+ try {
594
+ return prop("format")(date, {
595
+ locale: prop("locale"),
596
+ timeZone: prop("timeZone")
597
+ });
598
+ } catch {
599
+ return "";
600
+ }
601
+ });
602
+ }
603
+ function resolveHourCycleProp(hourCycle) {
604
+ if (hourCycle === 12) return "h12";
605
+ if (hourCycle === 24) return "h23";
606
+ }
607
+ function resolvePlaceholderValue(options, timeZone, granularity, value, defaultValue, calendar) {
608
+ let placeholder = options.placeholderValue || options.defaultPlaceholderValue || value?.[0] || defaultValue?.[0] || getTodayDate(timeZone, calendar);
609
+ placeholder = constrainSegments(placeholder, options.min, options.max);
610
+ if (needsTimeGranularity(granularity) && !("hour" in placeholder)) placeholder = toCalendarDateTime(placeholder);
611
+ return placeholder;
612
+ }
613
+ function createFormatFn(formatter) {
614
+ return (date) => {
615
+ if (date.calendar?.identifier === "gregory" && date.era === "BC") {
616
+ const jsd = date.toDate("UTC");
617
+ const prolYear = jsd.getUTCFullYear();
618
+ const safeDate = new Date(Date.UTC(2e3, jsd.getUTCMonth(), jsd.getUTCDate()));
619
+ return formatter.formatToParts(safeDate).map((p) => p.type === "year" ? String(prolYear) : p.value).join("");
620
+ }
621
+ return formatter.format(toFormatterDate(date, formatter));
622
+ };
623
+ }
624
+ //#endregion
625
+ //#region src/machines/date-input/utils/incomplete-date.ts
626
+ function resolvedHourCycle(formatter) {
627
+ const hc = formatter.resolvedOptions().hourCycle;
628
+ if (hc === "h11" || hc === "h12" || hc === "h23" || hc === "h24") return hc;
629
+ return "h23";
630
+ }
631
+ function incompleteDateHash(dv) {
632
+ return `${dv.year}|${dv.month}|${dv.day}|${dv.hour}|${dv.dayPeriod}|${dv.minute}|${dv.second}|${dv.era}`;
633
+ }
634
+ function incompleteDateEqual(a, b) {
635
+ return incompleteDateHash(a) === incompleteDateHash(b);
636
+ }
637
+ function initDisplayValues(value, placeholderValue, hourCycle, count) {
638
+ const calendar = placeholderValue.calendar;
639
+ if (value?.length) return Array.from({ length: count }, (_, i) => value[i] ? new IncompleteDate(calendar, hourCycle, value[i]) : new IncompleteDate(calendar, hourCycle));
640
+ return Array.from({ length: count }, () => new IncompleteDate(calendar, hourCycle));
641
+ }
642
+ var IncompleteDate = class IncompleteDate {
643
+ calendar;
644
+ era;
645
+ year;
646
+ month;
647
+ day;
648
+ hour;
649
+ hourCycle;
650
+ dayPeriod;
651
+ minute;
652
+ second;
653
+ millisecond;
654
+ offset;
655
+ constructor(calendar, hourCycle, dateValue) {
656
+ this.era = dateValue?.era ?? null;
657
+ this.calendar = calendar;
658
+ this.year = dateValue?.year ?? null;
659
+ this.month = dateValue?.month ?? null;
660
+ this.day = dateValue?.day ?? null;
661
+ this.hour = dateValue?.hour ?? null;
662
+ this.hourCycle = hourCycle;
663
+ this.dayPeriod = null;
664
+ this.minute = dateValue?.minute ?? null;
665
+ this.second = dateValue?.second ?? null;
666
+ this.millisecond = dateValue?.millisecond ?? null;
667
+ this.offset = "offset" in (dateValue ?? {}) ? dateValue.offset : null;
668
+ if (this.hour != null) {
669
+ const [dayPeriod, hour] = toHourCycle(this.hour, hourCycle);
670
+ this.dayPeriod = dayPeriod;
671
+ this.hour = hour;
672
+ }
673
+ }
674
+ copy() {
675
+ const res = new IncompleteDate(this.calendar, this.hourCycle);
676
+ res.era = this.era;
677
+ res.year = this.year;
678
+ res.month = this.month;
679
+ res.day = this.day;
680
+ res.hour = this.hour;
681
+ res.dayPeriod = this.dayPeriod;
682
+ res.minute = this.minute;
683
+ res.second = this.second;
684
+ res.millisecond = this.millisecond;
685
+ res.offset = this.offset;
686
+ return res;
687
+ }
688
+ withHourCycle(nextHourCycle) {
689
+ if (nextHourCycle === this.hourCycle) return this;
690
+ const hour24 = this.hour != null ? fromHourCycle(this.hour, this.dayPeriod ?? 0, this.hourCycle) : null;
691
+ const res = new IncompleteDate(this.calendar, nextHourCycle, {
692
+ era: this.era,
693
+ year: this.year,
694
+ month: this.month,
695
+ day: this.day,
696
+ hour: hour24,
697
+ minute: this.minute,
698
+ second: this.second,
699
+ millisecond: this.millisecond
700
+ });
701
+ res.offset = this.offset;
702
+ if (this.hour == null && this.dayPeriod != null && (nextHourCycle === "h12" || nextHourCycle === "h11")) res.dayPeriod = this.dayPeriod;
703
+ return res;
704
+ }
705
+ isComplete(segments) {
706
+ return segments.every((segment) => this[segment] != null);
707
+ }
708
+ isCleared(segments) {
709
+ return segments.every((segment) => this[segment] === null);
710
+ }
711
+ set(field, value, placeholder) {
712
+ const result = this.copy();
713
+ result[field] = value;
714
+ if (field === "hour" && result.dayPeriod == null && "hour" in placeholder) result.dayPeriod = toHourCycle(placeholder.hour, this.hourCycle)[0];
715
+ if (field === "year" && result.era == null) result.era = placeholder.era;
716
+ if (field !== "second" && field !== "literal" && field !== "timeZoneName") result.offset = null;
717
+ return result;
718
+ }
719
+ clear(field) {
720
+ const result = this.copy();
721
+ result[field] = null;
722
+ if (field === "year") result.era = null;
723
+ result.offset = null;
724
+ return result;
725
+ }
726
+ cycle(field, amount, placeholder, displaySegments) {
727
+ const res = this.copy();
728
+ if (res[field] == null && field !== "dayPeriod" && field !== "era") {
729
+ if (field === "hour" && "hour" in placeholder) {
730
+ const [dayPeriod, hour] = toHourCycle(placeholder.hour, this.hourCycle);
731
+ res.dayPeriod = dayPeriod;
732
+ res.hour = hour;
733
+ } else res[field] = placeholder[field];
734
+ if (field === "year" && res.era == null) res.era = placeholder.era;
735
+ return res;
736
+ }
737
+ switch (field) {
738
+ case "era": {
739
+ const eras = this.calendar.getEras();
740
+ let index = eras.indexOf(res.era);
741
+ index = cycleValue(index, amount, 0, eras.length - 1);
742
+ res.era = eras[index];
743
+ break;
744
+ }
745
+ case "year": {
746
+ let date = new CalendarDate(this.calendar, this.era ?? placeholder.era, this.year ?? placeholder.year, this.month ?? 1, this.day ?? 1);
747
+ date = date.cycle(field, amount, { round: field === "year" });
748
+ res.era = date.era;
749
+ res.year = date.year;
750
+ break;
751
+ }
752
+ case "month":
753
+ res.month = cycleValue(res.month ?? 1, amount, 1, this.calendar.getMaximumMonthsInYear());
754
+ break;
755
+ case "day":
756
+ res.day = cycleValue(res.day ?? 1, amount, 1, this.calendar.getMaximumDaysInMonth());
757
+ break;
758
+ case "hour": {
759
+ const hasDateSegments = displaySegments.some((s) => [
760
+ "year",
761
+ "month",
762
+ "day"
763
+ ].includes(s));
764
+ if ("timeZone" in placeholder && (!hasDateSegments || res.year != null && res.month != null && res.day != null)) {
765
+ let date = this.toValue(placeholder);
766
+ date = date.cycle("hour", amount, {
767
+ hourCycle: this.hourCycle === "h12" ? 12 : 24,
768
+ round: false
769
+ });
770
+ const [dayPeriod, adjustedHour] = toHourCycle(date.hour, this.hourCycle);
771
+ res.hour = adjustedHour;
772
+ res.dayPeriod = dayPeriod;
773
+ res.offset = date.offset;
774
+ } else {
775
+ const hours = res.hour ?? 0;
776
+ const limits = this.getSegmentLimits("hour");
777
+ res.hour = cycleValue(hours, amount, limits.minValue, limits.maxValue);
778
+ if (res.dayPeriod == null && "hour" in placeholder) res.dayPeriod = toHourCycle(placeholder.hour, this.hourCycle)[0];
779
+ }
780
+ break;
781
+ }
782
+ case "dayPeriod":
783
+ res.dayPeriod = cycleValue(res.dayPeriod ?? 0, amount, 0, 1);
784
+ break;
785
+ case "minute":
786
+ res.minute = cycleValue(res.minute ?? 0, amount, 0, 59, true);
787
+ break;
788
+ case "second":
789
+ res.second = cycleValue(res.second ?? 0, amount, 0, 59, true);
790
+ break;
791
+ }
792
+ return res;
793
+ }
794
+ toValue(value) {
795
+ if ("hour" in value) {
796
+ let hour = this.hour;
797
+ if (hour != null) hour = fromHourCycle(hour, this.dayPeriod ?? 0, this.hourCycle);
798
+ else if (this.hourCycle === "h12" || this.hourCycle === "h11") hour = this.dayPeriod === 1 ? 12 : 0;
799
+ const res = value.set({
800
+ era: this.era ?? value.era,
801
+ year: this.year ?? value.year,
802
+ month: this.month ?? value.month,
803
+ day: this.day ?? value.day,
804
+ hour: hour ?? value.hour,
805
+ minute: this.minute ?? value.minute,
806
+ second: this.second ?? value.second,
807
+ millisecond: this.millisecond ?? value.millisecond
808
+ });
809
+ if ("offset" in res && this.offset != null && res.offset !== this.offset) return res.add({ milliseconds: res.offset - this.offset });
810
+ return res;
811
+ } else return value.set({
812
+ era: this.era ?? value.era,
813
+ year: this.year ?? value.year,
814
+ month: this.month ?? value.month,
815
+ day: this.day ?? value.day
816
+ });
817
+ }
818
+ getSegmentLimits(type) {
819
+ switch (type) {
820
+ case "era": {
821
+ const eras = this.calendar.getEras();
822
+ return {
823
+ value: this.era != null ? eras.indexOf(this.era) : eras.length - 1,
824
+ minValue: 0,
825
+ maxValue: eras.length - 1
826
+ };
827
+ }
828
+ case "year": return {
829
+ value: this.year,
830
+ minValue: 1,
831
+ maxValue: 9999
832
+ };
833
+ case "month": return {
834
+ value: this.month,
835
+ minValue: 1,
836
+ maxValue: this.calendar.getMaximumMonthsInYear()
837
+ };
838
+ case "day": return {
839
+ value: this.day,
840
+ minValue: 1,
841
+ maxValue: this.calendar.getMaximumDaysInMonth()
842
+ };
843
+ case "dayPeriod": return {
844
+ value: this.dayPeriod,
845
+ minValue: 0,
846
+ maxValue: 1
847
+ };
848
+ case "hour": {
849
+ let minValue = 0;
850
+ let maxValue = 23;
851
+ if (this.hourCycle === "h12") {
852
+ minValue = 1;
853
+ maxValue = 12;
854
+ } else if (this.hourCycle === "h11") {
855
+ minValue = 0;
856
+ maxValue = 11;
857
+ }
858
+ return {
859
+ value: this.hour,
860
+ minValue,
861
+ maxValue
862
+ };
863
+ }
864
+ case "minute": return {
865
+ value: this.minute,
866
+ minValue: 0,
867
+ maxValue: 59
868
+ };
869
+ case "second": return {
870
+ value: this.second,
871
+ minValue: 0,
872
+ maxValue: 59
873
+ };
874
+ }
875
+ }
876
+ toString() {
877
+ const fields = {
878
+ era: this.era,
879
+ year: this.year,
880
+ month: this.month,
881
+ day: this.day,
882
+ hour: this.hour,
883
+ dayPeriod: this.dayPeriod,
884
+ minute: this.minute,
885
+ second: this.second
886
+ };
887
+ const parts = Object.entries(fields).filter(([, v]) => v != null).map(([k, v]) => `${k}=${v}`);
888
+ return parts.length > 0 ? parts.join(",") : "-";
889
+ }
890
+ };
891
+ function cycleValue(value, amount, min, max, round = false) {
892
+ if (round) {
893
+ value += Math.sign(amount);
894
+ if (value < min) value = max;
895
+ const div = Math.abs(amount);
896
+ if (amount > 0) value = Math.ceil(value / div) * div;
897
+ else value = Math.floor(value / div) * div;
898
+ if (value > max) value = min;
899
+ } else {
900
+ value += amount;
901
+ if (value < min) value = max - (min - value - 1);
902
+ else if (value > max) value = min + (value - max - 1);
903
+ }
904
+ return value;
905
+ }
906
+ function toHourCycle(hour, hourCycle) {
907
+ let dayPeriod = hour >= 12 ? 1 : 0;
908
+ switch (hourCycle) {
909
+ case "h11":
910
+ if (hour >= 12) hour -= 12;
911
+ break;
912
+ case "h12":
913
+ if (hour === 0) hour = 12;
914
+ else if (hour > 12) hour -= 12;
915
+ break;
916
+ case "h23":
917
+ dayPeriod = null;
918
+ break;
919
+ case "h24":
920
+ hour += 1;
921
+ dayPeriod = null;
922
+ }
923
+ return [dayPeriod, hour];
924
+ }
925
+ function fromHourCycle(hour, dayPeriod, hourCycle) {
926
+ switch (hourCycle) {
927
+ case "h11":
928
+ if (dayPeriod === 1) hour += 12;
929
+ break;
930
+ case "h12":
931
+ if (hour === 12) hour = 0;
932
+ if (dayPeriod === 1) hour += 12;
933
+ break;
934
+ case "h24":
935
+ hour -= 1;
936
+ break;
937
+ }
938
+ return hour;
939
+ }
940
+ //#endregion
941
+ //#region src/machines/date-input/utils/input.ts
942
+ function isNumberString(value) {
943
+ return !Number.isNaN(Number.parseInt(value));
944
+ }
945
+ function updateSegmentValue(ctx, segment, input) {
946
+ const { context, prop } = ctx;
947
+ const type = segment.type;
948
+ const index = context.get("activeIndex");
949
+ const formatter = prop("formatter");
950
+ const enteredKeys = context.get("enteredKeys");
951
+ const placeholderValue = context.get("placeholderValue");
952
+ let dv = getActiveDisplayValue(ctx);
953
+ let next;
954
+ switch (type) {
955
+ case "dayPeriod": {
956
+ if (!("hour" in dv.toValue(placeholderValue))) return;
957
+ const amPmFormatter = new DateFormatter(prop("locale"), {
958
+ hour: "numeric",
959
+ hour12: true
960
+ });
961
+ const amDate = /* @__PURE__ */ new Date();
962
+ amDate.setHours(0);
963
+ const pmDate = /* @__PURE__ */ new Date();
964
+ pmDate.setHours(12);
965
+ const am = amPmFormatter.formatToParts(amDate).find((p) => p.type === "dayPeriod")?.value || "AM";
966
+ const pm = amPmFormatter.formatToParts(pmDate).find((p) => p.type === "dayPeriod")?.value || "PM";
967
+ const lowerInput = input.toLowerCase();
968
+ if (am.toLowerCase().startsWith(lowerInput)) next = dv.set("dayPeriod", 0, placeholderValue);
969
+ else if (pm.toLowerCase().startsWith(lowerInput)) next = dv.set("dayPeriod", 1, placeholderValue);
970
+ else break;
971
+ setDisplayValue(ctx, index, next);
972
+ goToNextSegment(ctx);
973
+ break;
974
+ }
975
+ case "era": {
976
+ const eras = dv.calendar.getEras();
977
+ const eraFormatter = new DateFormatter(prop("locale"), { era: "short" });
978
+ const lowerInput = input.toLowerCase();
979
+ for (let i = 0; i < eras.length; i++) {
980
+ const eraDate = dv.toValue(placeholderValue).set({ year: 1 }).toDate(prop("timeZone"));
981
+ const formattedEra = eraFormatter.formatToParts(eraDate).find((p) => p.type === "era")?.value;
982
+ if (formattedEra && formattedEra.toLowerCase().startsWith(lowerInput)) {
983
+ next = dv.set("era", eras[i], placeholderValue);
984
+ setDisplayValue(ctx, index, next);
985
+ goToNextSegment(ctx);
986
+ break;
987
+ }
988
+ }
989
+ break;
990
+ }
991
+ case "day":
992
+ case "hour":
993
+ case "minute":
994
+ case "second":
995
+ case "month":
996
+ case "year": {
997
+ let newValue = enteredKeys + input;
998
+ let numberValue = Number.parseInt(newValue);
999
+ let segmentValue = numberValue;
1000
+ let allowsZero = segment.minValue === 0;
1001
+ if (!isNumberString(input)) return;
1002
+ if (segment.type === "hour" && formatter.resolvedOptions().hour12) {
1003
+ switch (formatter.resolvedOptions().hourCycle) {
1004
+ case "h11":
1005
+ if (numberValue > 11) segmentValue = Number.parseInt(input);
1006
+ break;
1007
+ case "h12":
1008
+ allowsZero = false;
1009
+ if (numberValue > 12) segmentValue = Number.parseInt(input);
1010
+ break;
1011
+ }
1012
+ if (segment.value !== void 0 && segment.value >= 12 && numberValue > 1) numberValue += 12;
1013
+ } else if (segment.maxValue !== void 0 && numberValue > segment.maxValue) segmentValue = Number.parseInt(input);
1014
+ if (isNaN(numberValue)) return;
1015
+ const shouldSetValue = segmentValue !== 0 || allowsZero;
1016
+ if (shouldSetValue) {
1017
+ dv = dv.set(type, segmentValue, placeholderValue);
1018
+ next = dv;
1019
+ setDisplayValue(ctx, index, dv);
1020
+ }
1021
+ if (segment.maxValue !== void 0 && (Number(numberValue + "0") > segment.maxValue || newValue.length >= String(segment.maxValue).length)) {
1022
+ context.set("enteredKeys", "");
1023
+ if (shouldSetValue) goToNextSegment(ctx);
1024
+ } else context.set("enteredKeys", newValue);
1025
+ break;
1026
+ }
1027
+ }
1028
+ return next;
1029
+ }
1030
+ //#endregion
1031
+ //#region src/machines/date-input/utils/placeholders.ts
1032
+ const LOCALE_PLACEHOLDERS = {
1033
+ ach: [
1034
+ "mwaka",
1035
+ "dwe",
1036
+ "nino"
1037
+ ],
1038
+ af: [
1039
+ "jjjj",
1040
+ "mm",
1041
+ "dd"
1042
+ ],
1043
+ am: [
1044
+ "ዓዓዓዓ",
1045
+ "ሚሜ",
1046
+ "ቀቀ"
1047
+ ],
1048
+ an: [
1049
+ "aaaa",
1050
+ "mm",
1051
+ "dd"
1052
+ ],
1053
+ ar: [
1054
+ "سنة",
1055
+ "شهر",
1056
+ "يوم"
1057
+ ],
1058
+ ast: [
1059
+ "aaaa",
1060
+ "mm",
1061
+ "dd"
1062
+ ],
1063
+ az: [
1064
+ "iiii",
1065
+ "aa",
1066
+ "gg"
1067
+ ],
1068
+ be: [
1069
+ "гггг",
1070
+ "мм",
1071
+ "дд"
1072
+ ],
1073
+ bg: [
1074
+ "гггг",
1075
+ "мм",
1076
+ "дд"
1077
+ ],
1078
+ bn: [
1079
+ "yyyy",
1080
+ "মিমি",
1081
+ "dd"
1082
+ ],
1083
+ br: [
1084
+ "bbbb",
1085
+ "mm",
1086
+ "dd"
1087
+ ],
1088
+ bs: [
1089
+ "gggg",
1090
+ "mm",
1091
+ "dd"
1092
+ ],
1093
+ ca: [
1094
+ "aaaa",
1095
+ "mm",
1096
+ "dd"
1097
+ ],
1098
+ cak: [
1099
+ "jjjj",
1100
+ "ii",
1101
+ "q'q'"
1102
+ ],
1103
+ ckb: [
1104
+ "ساڵ",
1105
+ "مانگ",
1106
+ "ڕۆژ"
1107
+ ],
1108
+ cs: [
1109
+ "rrrr",
1110
+ "mm",
1111
+ "dd"
1112
+ ],
1113
+ cy: [
1114
+ "bbbb",
1115
+ "mm",
1116
+ "dd"
1117
+ ],
1118
+ da: [
1119
+ "åååå",
1120
+ "mm",
1121
+ "dd"
1122
+ ],
1123
+ de: [
1124
+ "jjjj",
1125
+ "mm",
1126
+ "tt"
1127
+ ],
1128
+ dsb: [
1129
+ "llll",
1130
+ "mm",
1131
+ "źź"
1132
+ ],
1133
+ el: [
1134
+ "εεεε",
1135
+ "μμ",
1136
+ "ηη"
1137
+ ],
1138
+ en: [
1139
+ "yyyy",
1140
+ "mm",
1141
+ "dd"
1142
+ ],
1143
+ eo: [
1144
+ "jjjj",
1145
+ "mm",
1146
+ "tt"
1147
+ ],
1148
+ es: [
1149
+ "aaaa",
1150
+ "mm",
1151
+ "dd"
1152
+ ],
1153
+ et: [
1154
+ "aaaa",
1155
+ "kk",
1156
+ "pp"
1157
+ ],
1158
+ eu: [
1159
+ "uuuu",
1160
+ "hh",
1161
+ "ee"
1162
+ ],
1163
+ fa: [
1164
+ "سال",
1165
+ "ماه",
1166
+ "روز"
1167
+ ],
1168
+ ff: [
1169
+ "hhhh",
1170
+ "ll",
1171
+ "ññ"
1172
+ ],
1173
+ fi: [
1174
+ "vvvv",
1175
+ "kk",
1176
+ "pp"
1177
+ ],
1178
+ fr: [
1179
+ "aaaa",
1180
+ "mm",
1181
+ "jj"
1182
+ ],
1183
+ fy: [
1184
+ "jjjj",
1185
+ "mm",
1186
+ "dd"
1187
+ ],
1188
+ ga: [
1189
+ "bbbb",
1190
+ "mm",
1191
+ "ll"
1192
+ ],
1193
+ gd: [
1194
+ "bbbb",
1195
+ "mm",
1196
+ "ll"
1197
+ ],
1198
+ gl: [
1199
+ "aaaa",
1200
+ "mm",
1201
+ "dd"
1202
+ ],
1203
+ he: [
1204
+ "שנה",
1205
+ "חודש",
1206
+ "יום"
1207
+ ],
1208
+ hr: [
1209
+ "gggg",
1210
+ "mm",
1211
+ "dd"
1212
+ ],
1213
+ hsb: [
1214
+ "llll",
1215
+ "mm",
1216
+ "dd"
1217
+ ],
1218
+ hu: [
1219
+ "éééé",
1220
+ "hh",
1221
+ "nn"
1222
+ ],
1223
+ ia: [
1224
+ "aaaa",
1225
+ "mm",
1226
+ "dd"
1227
+ ],
1228
+ id: [
1229
+ "tttt",
1230
+ "bb",
1231
+ "hh"
1232
+ ],
1233
+ it: [
1234
+ "aaaa",
1235
+ "mm",
1236
+ "gg"
1237
+ ],
1238
+ ja: [
1239
+ "年",
1240
+ "月",
1241
+ "日"
1242
+ ],
1243
+ ka: [
1244
+ "წწწწ",
1245
+ "თთ",
1246
+ "რრ"
1247
+ ],
1248
+ kk: [
1249
+ "жжжж",
1250
+ "аа",
1251
+ "кк"
1252
+ ],
1253
+ kn: [
1254
+ "ವವವವ",
1255
+ "ಮಿಮೀ",
1256
+ "ದಿದಿ"
1257
+ ],
1258
+ ko: [
1259
+ "연도",
1260
+ "월",
1261
+ "일"
1262
+ ],
1263
+ lb: [
1264
+ "jjjj",
1265
+ "mm",
1266
+ "dd"
1267
+ ],
1268
+ lo: [
1269
+ "ປປປປ",
1270
+ "ດດ",
1271
+ "ວວ"
1272
+ ],
1273
+ lt: [
1274
+ "mmmm",
1275
+ "mm",
1276
+ "dd"
1277
+ ],
1278
+ lv: [
1279
+ "gggg",
1280
+ "mm",
1281
+ "dd"
1282
+ ],
1283
+ meh: [
1284
+ "aaaa",
1285
+ "mm",
1286
+ "dd"
1287
+ ],
1288
+ ml: [
1289
+ "വർഷം",
1290
+ "മാസം",
1291
+ "തീയതി"
1292
+ ],
1293
+ ms: [
1294
+ "tttt",
1295
+ "mm",
1296
+ "hh"
1297
+ ],
1298
+ nl: [
1299
+ "jjjj",
1300
+ "mm",
1301
+ "dd"
1302
+ ],
1303
+ nn: [
1304
+ "åååå",
1305
+ "mm",
1306
+ "dd"
1307
+ ],
1308
+ no: [
1309
+ "åååå",
1310
+ "mm",
1311
+ "dd"
1312
+ ],
1313
+ oc: [
1314
+ "aaaa",
1315
+ "mm",
1316
+ "jj"
1317
+ ],
1318
+ pl: [
1319
+ "rrrr",
1320
+ "mm",
1321
+ "dd"
1322
+ ],
1323
+ pt: [
1324
+ "aaaa",
1325
+ "mm",
1326
+ "dd"
1327
+ ],
1328
+ rm: [
1329
+ "oooo",
1330
+ "mm",
1331
+ "dd"
1332
+ ],
1333
+ ro: [
1334
+ "aaaa",
1335
+ "ll",
1336
+ "zz"
1337
+ ],
1338
+ ru: [
1339
+ "гггг",
1340
+ "мм",
1341
+ "дд"
1342
+ ],
1343
+ sc: [
1344
+ "aaaa",
1345
+ "mm",
1346
+ "dd"
1347
+ ],
1348
+ scn: [
1349
+ "aaaa",
1350
+ "mm",
1351
+ "jj"
1352
+ ],
1353
+ sk: [
1354
+ "rrrr",
1355
+ "mm",
1356
+ "dd"
1357
+ ],
1358
+ sl: [
1359
+ "llll",
1360
+ "mm",
1361
+ "dd"
1362
+ ],
1363
+ sr: [
1364
+ "гггг",
1365
+ "мм",
1366
+ "дд"
1367
+ ],
1368
+ sv: [
1369
+ "åååå",
1370
+ "mm",
1371
+ "dd"
1372
+ ],
1373
+ szl: [
1374
+ "rrrr",
1375
+ "mm",
1376
+ "dd"
1377
+ ],
1378
+ tg: [
1379
+ "сссс",
1380
+ "мм",
1381
+ "рр"
1382
+ ],
1383
+ th: [
1384
+ "ปปปป",
1385
+ "ดด",
1386
+ "วว"
1387
+ ],
1388
+ tr: [
1389
+ "yyyy",
1390
+ "aa",
1391
+ "gg"
1392
+ ],
1393
+ uk: [
1394
+ "рррр",
1395
+ "мм",
1396
+ "дд"
1397
+ ],
1398
+ "sr-Latn": [
1399
+ "gggg",
1400
+ "mm",
1401
+ "dd"
1402
+ ],
1403
+ "zh-CN": [
1404
+ "年",
1405
+ "月",
1406
+ "日"
1407
+ ],
1408
+ "zh-TW": [
1409
+ "年",
1410
+ "月",
1411
+ "日"
1412
+ ]
1413
+ };
1414
+ function getLocaleLanguage(locale) {
1415
+ if (typeof Intl !== "undefined" && Intl.Locale) return new Intl.Locale(locale).language;
1416
+ return locale.split("-")[0];
1417
+ }
1418
+ function getLocaleScript(locale) {
1419
+ if (typeof Intl !== "undefined" && Intl.Locale) return new Intl.Locale(locale).script || void 0;
1420
+ const script = locale.split("-").find((part) => part.length === 4);
1421
+ if (!script) return void 0;
1422
+ return script.charAt(0).toUpperCase() + script.slice(1).toLowerCase();
1423
+ }
1424
+ function getLocalePlaceholders(locale) {
1425
+ const exact = LOCALE_PLACEHOLDERS[locale];
1426
+ if (exact) return exact;
1427
+ const lang = getLocaleLanguage(locale);
1428
+ const script = getLocaleScript(locale);
1429
+ if (script) {
1430
+ const langScript = `${lang}-${script}`;
1431
+ const langScriptPlaceholder = LOCALE_PLACEHOLDERS[langScript];
1432
+ if (langScriptPlaceholder) return langScriptPlaceholder;
1433
+ }
1434
+ return LOCALE_PLACEHOLDERS[lang] || LOCALE_PLACEHOLDERS.en;
1435
+ }
1436
+ const defaultTranslations = { placeholder(locale) {
1437
+ const [year, month, day] = getLocalePlaceholders(locale);
1438
+ return {
1439
+ day,
1440
+ month,
1441
+ year,
1442
+ hour: "––",
1443
+ minute: "––",
1444
+ second: "––",
1445
+ dayPeriod: "AM/PM",
1446
+ era: "era",
1447
+ timeZoneName: "timeZone",
1448
+ weekday: "weekday",
1449
+ unknown: "unknown",
1450
+ fractionalSecond: "ff"
1451
+ };
1452
+ } };
1453
+ //#endregion
1454
+ //#region src/machines/date-input/machine.ts
1455
+ const machine = createMachine({
1456
+ props({ props }) {
1457
+ const locale = props.locale || "en-US";
1458
+ const timeZone = props.timeZone || "UTC";
1459
+ const selectionMode = props.selectionMode || "single";
1460
+ const granularity = props.granularity || "day";
1461
+ const translations = {
1462
+ ...defaultTranslations,
1463
+ ...props.translations
1464
+ };
1465
+ const calendar = resolveCalendar(locale, props.createCalendar);
1466
+ const defaultValue = props.defaultValue ? props.defaultValue.map((date) => constrainSegments(toTargetCalendar(date, calendar), props.min, props.max)) : [];
1467
+ const value = props.value ? props.value.map((date) => constrainSegments(toTargetCalendar(date, calendar), props.min, props.max)) : void 0;
1468
+ const placeholderValue = resolvePlaceholderValue(props, timeZone, granularity, value, defaultValue, calendar);
1469
+ const hourCycle = resolveHourCycleProp(props.hourCycle);
1470
+ const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? false;
1471
+ const digitStyle = shouldForceLeadingZeros ? "2-digit" : "numeric";
1472
+ const firstValue = value?.[0] ?? defaultValue?.[0] ?? placeholderValue;
1473
+ const hasTimeZone = firstValue != null && "timeZone" in firstValue;
1474
+ const formatter = props.formatter ?? new DateFormatter(locale, getFormatterOptions({
1475
+ granularity,
1476
+ digitStyle,
1477
+ hourCycle,
1478
+ timeZone,
1479
+ hasTimeZone,
1480
+ hideTimeZone: props.hideTimeZone
1481
+ }));
1482
+ const allSegments = props.allSegments ?? resolveAllSegments(formatter);
1483
+ return {
1484
+ locale,
1485
+ timeZone,
1486
+ selectionMode,
1487
+ format: createFormatFn(formatter),
1488
+ ...props,
1489
+ translations,
1490
+ value,
1491
+ defaultValue,
1492
+ granularity,
1493
+ shouldForceLeadingZeros,
1494
+ formatter,
1495
+ placeholderValue: typeof props.placeholderValue === "undefined" ? void 0 : placeholderValue,
1496
+ defaultPlaceholderValue: placeholderValue,
1497
+ allSegments
1498
+ };
1499
+ },
1500
+ initialState() {
1501
+ return "idle";
1502
+ },
1503
+ refs() {
1504
+ return {
1505
+ announcer: null,
1506
+ segmentToAnnounceIndex: null
1507
+ };
1508
+ },
1509
+ effects: ["setupLiveRegion"],
1510
+ context({ prop, bindable }) {
1511
+ const hourCycle = resolvedHourCycle(prop("formatter"));
1512
+ const placeholderValue = prop("defaultPlaceholderValue");
1513
+ const initialValue = prop("value") || prop("defaultValue");
1514
+ const groupCount = getGroupCount(prop("selectionMode"));
1515
+ return {
1516
+ value: bindable(() => ({
1517
+ defaultValue: prop("defaultValue"),
1518
+ value: prop("value"),
1519
+ isEqual(a, b) {
1520
+ if (a?.length !== b?.length) return false;
1521
+ const len = Math.max(a.length, b.length);
1522
+ for (let i = 0; i < len; i++) if (!isDateEqual(a[i], b[i])) return false;
1523
+ return true;
1524
+ },
1525
+ hash: (v) => v.map((date) => date?.toString() ?? "").join(","),
1526
+ onChange(value) {
1527
+ const valueAsString = getValueAsString(value, prop);
1528
+ prop("onValueChange")?.({
1529
+ value,
1530
+ valueAsString
1531
+ });
1532
+ }
1533
+ })),
1534
+ activeIndex: bindable(() => ({
1535
+ defaultValue: 0,
1536
+ sync: true
1537
+ })),
1538
+ activeSegmentIndex: bindable(() => ({
1539
+ defaultValue: -1,
1540
+ sync: true
1541
+ })),
1542
+ placeholderValue: bindable(() => ({
1543
+ defaultValue: prop("defaultPlaceholderValue"),
1544
+ isEqual: isDateEqual,
1545
+ hash: (v) => v.toString(),
1546
+ onChange(placeholderValue) {
1547
+ prop("onPlaceholderChange")?.({
1548
+ value: prop("value") ?? [],
1549
+ valueAsString: [],
1550
+ placeholderValue
1551
+ });
1552
+ }
1553
+ })),
1554
+ displayValues: bindable(() => ({
1555
+ defaultValue: initDisplayValues(initialValue, placeholderValue ?? getTodayDate(prop("timeZone")), hourCycle, groupCount),
1556
+ isEqual: (a, b) => b != null && a.length === b.length && a.every((d, i) => incompleteDateEqual(d, b[i])),
1557
+ hash: (v) => v.map(incompleteDateHash).join("||")
1558
+ })),
1559
+ enteredKeys: bindable(() => ({
1560
+ defaultValue: "",
1561
+ sync: true
1562
+ }))
1563
+ };
1564
+ },
1565
+ computed: {
1566
+ isInteractive: ({ prop }) => !prop("disabled") && !prop("readOnly"),
1567
+ groupCount: ({ prop }) => getGroupCount(prop("selectionMode")),
1568
+ valueAsString: ({ context, prop }) => getValueAsString(context.get("value"), prop),
1569
+ segments: memo(({ context, prop }) => [
1570
+ context.hash("value"),
1571
+ prop("selectionMode"),
1572
+ context.hash("placeholderValue"),
1573
+ context.hash("displayValues"),
1574
+ prop("allSegments"),
1575
+ prop("timeZone"),
1576
+ prop("translations"),
1577
+ prop("granularity"),
1578
+ JSON.stringify(prop("formatter").resolvedOptions()),
1579
+ prop("locale")
1580
+ ], (_deps, { context, prop, computed }) => {
1581
+ const value = context.get("value");
1582
+ const placeholderValue = context.get("placeholderValue");
1583
+ const displayValues = context.get("displayValues");
1584
+ const allSegments = prop("allSegments");
1585
+ const translations = prop("translations") || defaultTranslations;
1586
+ const granularity = prop("granularity");
1587
+ const formatter = prop("formatter");
1588
+ const locale = prop("locale");
1589
+ const allSegmentTypes = Object.keys(allSegments);
1590
+ return Array.from({ length: computed("groupCount") }, (_, i) => {
1591
+ const displayValue = displayValues[i] ?? new IncompleteDate(placeholderValue.calendar, resolvedHourCycle(formatter));
1592
+ const committedValue = value?.[i];
1593
+ const displayDate = committedValue && displayValue.isComplete(allSegmentTypes) ? committedValue : displayValue.toValue(placeholderValue);
1594
+ const segmentFormatter = displayValue.era === "BC" && displayValue.calendar.identifier === "gregory" ? new DateFormatter(locale, {
1595
+ ...formatter.resolvedOptions(),
1596
+ era: "short"
1597
+ }) : formatter;
1598
+ return processSegments({
1599
+ dateValue: toFormatterDate(displayDate, segmentFormatter),
1600
+ displayValue,
1601
+ formatter: segmentFormatter,
1602
+ locale,
1603
+ translations,
1604
+ granularity
1605
+ });
1606
+ });
1607
+ })
1608
+ },
1609
+ watch({ track, context, prop, action }) {
1610
+ track([() => context.hash("value")], () => {
1611
+ action(["syncDisplayValues"]);
1612
+ });
1613
+ track([() => resolvedHourCycle(prop("formatter"))], () => {
1614
+ action(["syncDisplayValueHourCycle"]);
1615
+ });
1616
+ track([() => context.get("activeSegmentIndex")], () => {
1617
+ action(["focusActiveSegment"]);
1618
+ });
1619
+ track([() => prop("placeholderValue")?.toString()], () => {
1620
+ action(["syncPlaceholderProp"]);
1621
+ });
1622
+ track([() => prop("defaultPlaceholderValue")?.toString()], () => {
1623
+ action(["syncDefaultPlaceholderValue"]);
1624
+ });
1625
+ },
1626
+ on: {
1627
+ "VALUE.SET": { actions: ["setDateValue"] },
1628
+ "VALUE.CLEAR": { actions: [
1629
+ "clearDateValue",
1630
+ "clearDisplayValues",
1631
+ "clearEnteredKeys"
1632
+ ] }
1633
+ },
1634
+ states: {
1635
+ idle: { on: { "SEGMENT.FOCUS": {
1636
+ target: "focused",
1637
+ actions: ["setActiveSegmentIndex", "invokeOnFocus"]
1638
+ } } },
1639
+ focused: { on: {
1640
+ "SEGMENT.FOCUS": { actions: ["setActiveSegmentIndex", "clearEnteredKeys"] },
1641
+ "SEGMENT.BLUR": {
1642
+ target: "idle",
1643
+ actions: [
1644
+ "confirmPlaceholder",
1645
+ "clearEnteredKeys",
1646
+ "invokeOnBlur"
1647
+ ]
1648
+ },
1649
+ "SEGMENT.INPUT": { actions: ["setSegmentValue", "announceSegmentValue"] },
1650
+ "SEGMENT.ADJUST": { actions: [
1651
+ "invokeOnSegmentAdjust",
1652
+ "clearEnteredKeys",
1653
+ "announceSegmentValue"
1654
+ ] },
1655
+ "SEGMENT.ARROW_LEFT": { actions: ["setPreviousActiveSegmentIndex", "clearEnteredKeys"] },
1656
+ "SEGMENT.ARROW_RIGHT": { actions: ["setNextActiveSegmentIndex", "clearEnteredKeys"] },
1657
+ "SEGMENT.BACKSPACE": [{
1658
+ guard: "isActiveSegmentPlaceholder",
1659
+ actions: ["setPreviousActiveSegmentIndex", "clearEnteredKeys"]
1660
+ }, { actions: ["clearSegmentValue", "announceSegmentValue"] }],
1661
+ "SEGMENT.HOME": { actions: [
1662
+ "setSegmentToLowestValue",
1663
+ "clearEnteredKeys",
1664
+ "announceSegmentValue"
1665
+ ] },
1666
+ "SEGMENT.END": { actions: [
1667
+ "setSegmentToHighestValue",
1668
+ "clearEnteredKeys",
1669
+ "announceSegmentValue"
1670
+ ] },
1671
+ "SEGMENT.PASTE": { actions: ["setPastedValue", "clearEnteredKeys"] }
1672
+ } }
1673
+ },
1674
+ implementations: {
1675
+ effects: { setupLiveRegion({ scope, refs }) {
1676
+ const liveRegion = createLiveRegion({
1677
+ level: "assertive",
1678
+ document: scope.getDoc()
1679
+ });
1680
+ refs.set("announcer", liveRegion);
1681
+ return () => liveRegion.destroy();
1682
+ } },
1683
+ guards: { isActiveSegmentPlaceholder: (ctx) => {
1684
+ if (ctx.context.get("enteredKeys") !== "") return false;
1685
+ return getActiveSegment(ctx)?.isPlaceholder === true;
1686
+ } },
1687
+ actions: {
1688
+ invokeOnFocus({ prop }) {
1689
+ prop("onFocusChange")?.({ focused: true });
1690
+ },
1691
+ invokeOnBlur({ prop }) {
1692
+ prop("onFocusChange")?.({ focused: false });
1693
+ },
1694
+ setActiveSegmentIndex({ context, event }) {
1695
+ if (event.dateIndex != null) context.set("activeIndex", event.dateIndex);
1696
+ context.set("activeSegmentIndex", event.segmentIndex);
1697
+ },
1698
+ clearDisplayValues({ context, prop, computed }) {
1699
+ const hourCycle = resolvedHourCycle(prop("formatter"));
1700
+ const placeholderValue = context.get("placeholderValue");
1701
+ context.set("displayValues", Array.from({ length: computed("groupCount") }, () => new IncompleteDate(placeholderValue.calendar, hourCycle)));
1702
+ },
1703
+ clearEnteredKeys({ context }) {
1704
+ context.set("enteredKeys", "");
1705
+ },
1706
+ setPreviousActiveSegmentIndex(ctx) {
1707
+ goToPreviousSegment(ctx);
1708
+ },
1709
+ setNextActiveSegmentIndex(ctx) {
1710
+ goToNextSegment(ctx);
1711
+ },
1712
+ focusActiveSegment({ scope, context }) {
1713
+ raf(() => {
1714
+ getSegmentEls(scope)[context.get("activeSegmentIndex")]?.focus({ preventScroll: true });
1715
+ });
1716
+ },
1717
+ clearSegmentValue(params) {
1718
+ const { context, prop, event } = params;
1719
+ const index = context.get("activeIndex");
1720
+ const allSegments = prop("allSegments");
1721
+ const allSegmentTypes = Object.keys(allSegments);
1722
+ const placeholderValue = context.get("placeholderValue");
1723
+ const segment = getActiveSegment(params) ?? event.segment;
1724
+ const type = segment.type;
1725
+ let displayValue = getActiveDisplayValue(params);
1726
+ if (type === "dayPeriod") {
1727
+ const cleared = displayValue.clear(type);
1728
+ setDisplayValue(params, index, cleared);
1729
+ if (cleared.isCleared(allSegmentTypes)) commitClear(params, index);
1730
+ return;
1731
+ }
1732
+ if (type === "hour") {
1733
+ const cleared = displayValue.clear(type);
1734
+ setDisplayValue(params, index, cleared);
1735
+ if (cleared.isCleared(allSegmentTypes)) commitClear(params, index);
1736
+ return;
1737
+ }
1738
+ const enteredKeys = context.get("enteredKeys");
1739
+ const newValue = (enteredKeys !== "" ? enteredKeys : segment.text).slice(0, -1);
1740
+ if (newValue === "" || newValue === "0") {
1741
+ context.set("enteredKeys", "");
1742
+ const cleared = displayValue.clear(type);
1743
+ setDisplayValue(params, index, cleared);
1744
+ if (cleared.isCleared(allSegmentTypes)) commitClear(params, index);
1745
+ } else {
1746
+ context.set("enteredKeys", newValue);
1747
+ displayValue = displayValue.set(type, Number(newValue), placeholderValue);
1748
+ setDisplayValue(params, index, displayValue);
1749
+ }
1750
+ },
1751
+ invokeOnSegmentAdjust(params) {
1752
+ const { context, prop, event } = params;
1753
+ const { segment, amount } = event;
1754
+ const type = segment.type;
1755
+ const index = context.get("activeIndex");
1756
+ const allSegments = prop("allSegments");
1757
+ const allSegmentTypes = Object.keys(allSegments);
1758
+ const placeholderValue = context.get("placeholderValue");
1759
+ const displaySegmentTypes = allSegmentTypes;
1760
+ const next = getActiveDisplayValue(params).cycle(type, amount, placeholderValue, displaySegmentTypes);
1761
+ setDisplayValue(params, index, next);
1762
+ if (next.isComplete(allSegmentTypes)) commitValue(params, index, next);
1763
+ },
1764
+ setSegmentValue(params) {
1765
+ const { event, context, refs } = params;
1766
+ const { segment, input } = event;
1767
+ refs.set("segmentToAnnounceIndex", context.get("activeSegmentIndex"));
1768
+ const index = context.get("activeIndex");
1769
+ const displayValue = updateSegmentValue(params, segment, input);
1770
+ const allSegmentTypes = Object.keys(params.prop("allSegments"));
1771
+ if (displayValue && displayValue.isComplete(allSegmentTypes) && context.get("enteredKeys") === "") commitValue(params, index, displayValue);
1772
+ },
1773
+ setSegmentToLowestValue(params) {
1774
+ const { event, context, prop } = params;
1775
+ const { segment } = event;
1776
+ const index = context.get("activeIndex");
1777
+ const allSegmentTypes = Object.keys(prop("allSegments"));
1778
+ const placeholderValue = context.get("placeholderValue");
1779
+ if (segment.minValue == null) return;
1780
+ const displayValue = getActiveDisplayValue(params).set(segment.type, segment.minValue, placeholderValue);
1781
+ setDisplayValue(params, index, displayValue);
1782
+ if (displayValue.isComplete(allSegmentTypes)) commitValue(params, index, displayValue);
1783
+ },
1784
+ setSegmentToHighestValue(params) {
1785
+ const { event, context, prop } = params;
1786
+ const { segment } = event;
1787
+ const index = context.get("activeIndex");
1788
+ const allSegmentTypes = Object.keys(prop("allSegments"));
1789
+ const placeholderValue = context.get("placeholderValue");
1790
+ if (segment.maxValue == null) return;
1791
+ const displayValue = getActiveDisplayValue(params).set(segment.type, segment.maxValue, placeholderValue);
1792
+ setDisplayValue(params, index, displayValue);
1793
+ if (displayValue.isComplete(allSegmentTypes)) commitValue(params, index, displayValue);
1794
+ },
1795
+ setDateValue({ context, event, prop }) {
1796
+ if (!Array.isArray(event.value)) return;
1797
+ const value = event.value.map((date) => constrainSegments(date, prop("min"), prop("max")));
1798
+ context.set("value", value);
1799
+ },
1800
+ clearDateValue({ context }) {
1801
+ context.set("value", []);
1802
+ },
1803
+ setPastedValue({ context, event, prop }) {
1804
+ try {
1805
+ const constrained = constrainSegments(parse(event.value), prop("min"), prop("max"));
1806
+ const index = context.get("activeIndex");
1807
+ const values = Array.from(context.get("value"));
1808
+ values[index] = constrained;
1809
+ context.set("value", values);
1810
+ } catch {}
1811
+ },
1812
+ syncDisplayValues({ context, prop, computed }) {
1813
+ const value = context.get("value");
1814
+ const hourCycle = resolvedHourCycle(prop("formatter"));
1815
+ const placeholderValue = context.get("placeholderValue");
1816
+ context.set("displayValues", initDisplayValues(value?.length ? value : void 0, placeholderValue, hourCycle, computed("groupCount")));
1817
+ },
1818
+ syncDisplayValueHourCycle({ context, prop }) {
1819
+ const hourCycle = resolvedHourCycle(prop("formatter"));
1820
+ const dvs = context.get("displayValues");
1821
+ context.set("displayValues", dvs.map((dv) => dv.withHourCycle(hourCycle)));
1822
+ },
1823
+ syncDefaultPlaceholderValue({ prop, context }) {
1824
+ if (prop("placeholderValue") != null) return;
1825
+ const defaultPlaceholder = prop("defaultPlaceholderValue");
1826
+ if (!defaultPlaceholder) return;
1827
+ context.set("placeholderValue", defaultPlaceholder);
1828
+ },
1829
+ syncPlaceholderProp({ prop, context, computed }) {
1830
+ const propValue = prop("placeholderValue");
1831
+ if (propValue) {
1832
+ context.set("placeholderValue", propValue);
1833
+ const value = context.get("value");
1834
+ if (value?.length) {
1835
+ const hourCycle = resolvedHourCycle(prop("formatter"));
1836
+ context.set("displayValues", initDisplayValues(value, propValue, hourCycle, computed("groupCount")));
1837
+ }
1838
+ }
1839
+ },
1840
+ announceSegmentValue({ refs, computed, context }) {
1841
+ const announcer = refs.get("announcer");
1842
+ if (!announcer) return;
1843
+ const index = context.get("activeIndex");
1844
+ const activeSegmentIndex = context.get("activeSegmentIndex");
1845
+ const segmentIndexToUse = refs.get("segmentToAnnounceIndex") ?? activeSegmentIndex;
1846
+ refs.set("segmentToAnnounceIndex", null);
1847
+ const allSegments = computed("segments");
1848
+ const segment = allSegments[index]?.[segmentIndexToUse - getGroupOffset(allSegments, index)];
1849
+ if (!segment || segment.type === "literal") return;
1850
+ const valueText = segment.isPlaceholder ? "Empty" : segment.text;
1851
+ announcer.announce(`${getSegmentLabel(segment.type)}, ${valueText}`);
1852
+ },
1853
+ confirmPlaceholder(params) {
1854
+ const { context, prop, computed } = params;
1855
+ const allSegments = prop("allSegments");
1856
+ const allSegmentTypes = Object.keys(allSegments);
1857
+ const dateCount = computed("groupCount");
1858
+ const placeholderValue = context.get("placeholderValue");
1859
+ let values = Array.from(context.get("value"));
1860
+ let shouldUpdateValue = false;
1861
+ for (let i = 0; i < dateCount; i++) {
1862
+ const displayValue = context.get("displayValues")[i];
1863
+ if (!displayValue) continue;
1864
+ const allExceptDayPeriod = allSegmentTypes.filter((s) => s !== "dayPeriod");
1865
+ if (allSegments.dayPeriod && displayValue.isComplete(allExceptDayPeriod) && displayValue.dayPeriod == null) {
1866
+ const filled = displayValue.set("dayPeriod", placeholderValue && "hour" in placeholderValue ? placeholderValue.hour >= 12 ? 1 : 0 : 0, placeholderValue);
1867
+ setDisplayValue(params, i, filled);
1868
+ values[i] = filled.toValue(placeholderValue);
1869
+ shouldUpdateValue = true;
1870
+ } else if (displayValue.isComplete(allSegmentTypes)) {
1871
+ values[i] = displayValue.toValue(placeholderValue);
1872
+ shouldUpdateValue = true;
1873
+ }
1874
+ }
1875
+ const min = prop("min");
1876
+ const max = prop("max");
1877
+ if ((min || max) && values.length > 0) {
1878
+ values = values.map((d) => constrainSegments(d, min, max));
1879
+ shouldUpdateValue = true;
1880
+ }
1881
+ if (shouldUpdateValue) context.set("value", values);
1882
+ }
1883
+ }
1884
+ }
1885
+ });
1886
+ function commitValue(params, index, displayValue) {
1887
+ const { context } = params;
1888
+ const placeholderValue = context.get("placeholderValue");
1889
+ const date = displayValue.toValue(placeholderValue);
1890
+ const values = Array.from(context.get("value"));
1891
+ values[index] = date;
1892
+ context.set("value", values);
1893
+ }
1894
+ function commitClear(params, index) {
1895
+ const { context } = params;
1896
+ const values = context.get("value");
1897
+ if (index < values.length) context.set("value", values.slice(0, index));
1898
+ }
1899
+ function toTargetCalendar(date, calendar) {
1900
+ if (!calendar) return date;
1901
+ if (date.calendar.identifier === calendar.identifier) return date;
1902
+ return toCalendar(date, calendar);
1903
+ }
1904
+ function resolveCalendar(locale, createCalendar) {
1905
+ if (!createCalendar) return void 0;
1906
+ const calendarId = new Intl.DateTimeFormat(locale).resolvedOptions().calendar;
1907
+ if (calendarId === "gregory" || calendarId === "iso8601") return void 0;
1908
+ return createCalendar(calendarId);
1909
+ }
1910
+ //#endregion
1911
+ //#region src/machines/date-input/props.ts
1912
+ const props = createProps()([
1913
+ "createCalendar",
1914
+ "dir",
1915
+ "disabled",
1916
+ "format",
1917
+ "getRootNode",
1918
+ "id",
1919
+ "ids",
1920
+ "invalid",
1921
+ "isDateUnavailable",
1922
+ "locale",
1923
+ "max",
1924
+ "min",
1925
+ "name",
1926
+ "form",
1927
+ "onFocusChange",
1928
+ "onPlaceholderChange",
1929
+ "onValueChange",
1930
+ "readOnly",
1931
+ "required",
1932
+ "selectionMode",
1933
+ "timeZone",
1934
+ "translations",
1935
+ "value",
1936
+ "defaultValue",
1937
+ "hourCycle",
1938
+ "hideTimeZone",
1939
+ "granularity",
1940
+ "shouldForceLeadingZeros",
1941
+ "allSegments",
1942
+ "formatter",
1943
+ "placeholderValue",
1944
+ "defaultPlaceholderValue"
1945
+ ]);
1946
+ const splitProps = createSplitProps(props);
1947
+ const segmentProps = createProps()(["segment", "index"]);
1948
+ const splitSegmentProps = createSplitProps(segmentProps);
1949
+ const segmentGroupProps = createProps()(["index"]);
1950
+ const splitSegmentGroupProps = createSplitProps(segmentGroupProps);
1951
+ const segmentsProps = createProps()(["index"]);
1952
+ const splitSegmentsProps = createSplitProps(segmentsProps);
1953
+ const labelProps = createProps()(["index"]);
1954
+ const splitLabelProps = createSplitProps(labelProps);
1955
+ const hiddenInputProps = createProps()(["index", "name"]);
1956
+ const splitHiddenInputProps = createSplitProps(hiddenInputProps);
1957
+ //#endregion
1958
+ export { anatomy, connect, hiddenInputProps, labelProps, machine, parse, props, segmentGroupProps, segmentProps, segmentsProps, splitHiddenInputProps, splitLabelProps, splitProps, splitSegmentGroupProps, splitSegmentProps, splitSegmentsProps };