@jimka/typescript-ui 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/dist/lib/{AbstractInput-BxfrmD2W.js → AbstractInput-sRNPzWel.js} +2 -2
  2. package/dist/lib/{AbstractInput-BxfrmD2W.js.map → AbstractInput-sRNPzWel.js.map} +1 -1
  3. package/dist/lib/Anchor-CwRhdP2J.js +2 -0
  4. package/dist/lib/Anchor-CwRhdP2J.js.map +1 -0
  5. package/dist/lib/AnchorConstraints-Bfkt8019.js +2 -0
  6. package/dist/lib/AnchorConstraints-Bfkt8019.js.map +1 -0
  7. package/dist/lib/AnimatedDropdown-H3Rh-YMZ.js +2 -0
  8. package/dist/lib/AnimatedDropdown-H3Rh-YMZ.js.map +1 -0
  9. package/dist/lib/Border-0DJFDiij.js +2 -0
  10. package/dist/lib/Border-0DJFDiij.js.map +1 -0
  11. package/dist/lib/Button-MpMIYBYJ.js +2 -0
  12. package/dist/lib/Button-MpMIYBYJ.js.map +1 -0
  13. package/dist/lib/{Card-a4dzYrbX.js → Card-QYo27r5b.js} +2 -2
  14. package/dist/lib/{Card-a4dzYrbX.js.map → Card-QYo27r5b.js.map} +1 -1
  15. package/dist/lib/Checkbox-D0JYK-wc.js +2 -0
  16. package/dist/lib/Checkbox-D0JYK-wc.js.map +1 -0
  17. package/dist/lib/CheckboxMenuRow-CesLhSnp.js +2 -0
  18. package/dist/lib/CheckboxMenuRow-CesLhSnp.js.map +1 -0
  19. package/dist/lib/CodeEditor-N1FQodcF.js +2 -0
  20. package/dist/lib/CodeEditor-N1FQodcF.js.map +1 -0
  21. package/dist/lib/ComboBox-Dx8Tk9yg.js +2 -0
  22. package/dist/lib/ComboBox-Dx8Tk9yg.js.map +1 -0
  23. package/dist/lib/Component-B0ShfPVi.js +2 -0
  24. package/dist/lib/Component-B0ShfPVi.js.map +1 -0
  25. package/dist/lib/Container-abY5Ww3W.js +2 -0
  26. package/dist/lib/{Container-0bsG2Q8Z.js.map → Container-abY5Ww3W.js.map} +1 -1
  27. package/dist/lib/DOM-C-Edb3tA.js +2 -0
  28. package/dist/lib/DOM-C-Edb3tA.js.map +1 -0
  29. package/dist/lib/Dialog-cbA9V17e.js +2 -0
  30. package/dist/lib/Dialog-cbA9V17e.js.map +1 -0
  31. package/dist/lib/{FieldDecorator-Bpx8J8n9.js → FieldDecorator-BlYMfZ9L.js} +2 -2
  32. package/dist/lib/{FieldDecorator-Bpx8J8n9.js.map → FieldDecorator-BlYMfZ9L.js.map} +1 -1
  33. package/dist/lib/{Fit-CL1m1nIZ.js → Fit-BhlB-HAo.js} +2 -2
  34. package/dist/lib/{Fit-CL1m1nIZ.js.map → Fit-BhlB-HAo.js.map} +1 -1
  35. package/dist/lib/FloatingPanel-DkJXsZ2D.js +2 -0
  36. package/dist/lib/FloatingPanel-DkJXsZ2D.js.map +1 -0
  37. package/dist/lib/{Glyph-wN7bk7mg.js → Glyph-_VeBacS2.js} +2 -2
  38. package/dist/lib/{Glyph-wN7bk7mg.js.map → Glyph-_VeBacS2.js.map} +1 -1
  39. package/dist/lib/{Grid-DHHmaB-Y.js → Grid-Daiz7F5d.js} +2 -2
  40. package/dist/lib/Grid-Daiz7F5d.js.map +1 -0
  41. package/dist/lib/GridConstraints-C58LuTqM.js +2 -0
  42. package/dist/lib/{GridConstraints-DVc1BmlP.js.map → GridConstraints-C58LuTqM.js.map} +1 -1
  43. package/dist/lib/{Header-2hKwQo_u.js → Header-Dql3Zxc6.js} +2 -2
  44. package/dist/lib/{Header-2hKwQo_u.js.map → Header-Dql3Zxc6.js.map} +1 -1
  45. package/dist/lib/{IconText-DC7Xe34b.js → IconText-PUjhTLlp.js} +2 -2
  46. package/dist/lib/{IconText-DC7Xe34b.js.map → IconText-PUjhTLlp.js.map} +1 -1
  47. package/dist/lib/LanguageRegistry-CcVnbKuh.js +2 -0
  48. package/dist/lib/LanguageRegistry-CcVnbKuh.js.map +1 -0
  49. package/dist/lib/LayoutSerialization-CMxunLfV.js +2 -0
  50. package/dist/lib/LayoutSerialization-CMxunLfV.js.map +1 -0
  51. package/dist/lib/List-nx8220Fi.js +2 -0
  52. package/dist/lib/{List-CG4NvwuV.js.map → List-nx8220Fi.js.map} +1 -1
  53. package/dist/lib/MemoryStore-DhPoU-7X.js +2 -0
  54. package/dist/lib/MemoryStore-DhPoU-7X.js.map +1 -0
  55. package/dist/lib/Menu-Q0bpXXze.js +2 -0
  56. package/dist/lib/Menu-Q0bpXXze.js.map +1 -0
  57. package/dist/lib/{MenuButton-wy_0RskC.js → MenuButton-DCXi0tsP.js} +2 -2
  58. package/dist/lib/{MenuButton-wy_0RskC.js.map → MenuButton-DCXi0tsP.js.map} +1 -1
  59. package/dist/lib/OverlayFade-3pof2AJH.js +2 -0
  60. package/dist/lib/OverlayFade-3pof2AJH.js.map +1 -0
  61. package/dist/lib/Panel-Cy1pdlWO.js +2 -0
  62. package/dist/lib/{Panel-Rd9zkNXx.js.map → Panel-Cy1pdlWO.js.map} +1 -1
  63. package/dist/lib/{Position-Ck_KD4cR.js → Position-BwtxouxK.js} +2 -2
  64. package/dist/lib/{Position-Ck_KD4cR.js.map → Position-BwtxouxK.js.map} +1 -1
  65. package/dist/lib/{ProgressSpinner-yt-VXyCb.js → ProgressSpinner-DK8xEQ9y.js} +2 -2
  66. package/dist/lib/{ProgressSpinner-yt-VXyCb.js.map → ProgressSpinner-DK8xEQ9y.js.map} +1 -1
  67. package/dist/lib/RadioButton-BEwpqg1k.js +2 -0
  68. package/dist/lib/RadioButton-BEwpqg1k.js.map +1 -0
  69. package/dist/lib/RadioMenuRow-DP5qPyFR.js +2 -0
  70. package/dist/lib/RadioMenuRow-DP5qPyFR.js.map +1 -0
  71. package/dist/lib/{RovingTabIndex-DFJyoveq.js → RovingTabIndex-pHEv5oLD.js} +2 -2
  72. package/dist/lib/{RovingTabIndex-DFJyoveq.js.map → RovingTabIndex-pHEv5oLD.js.map} +1 -1
  73. package/dist/lib/Scrollbar-t8fFrUVQ.js +2 -0
  74. package/dist/lib/Scrollbar-t8fFrUVQ.js.map +1 -0
  75. package/dist/lib/Slider-CTbwR6HR.js +2 -0
  76. package/dist/lib/Slider-CTbwR6HR.js.map +1 -0
  77. package/dist/lib/{Spacer-qalSEJ5i.js → Spacer-srdN2d2b.js} +2 -2
  78. package/dist/lib/{Spacer-qalSEJ5i.js.map → Spacer-srdN2d2b.js.map} +1 -1
  79. package/dist/lib/TabButton-DLoMQzky.js +2 -0
  80. package/dist/lib/TabButton-DLoMQzky.js.map +1 -0
  81. package/dist/lib/TabCloseButton-CY7BGitY.js +2 -0
  82. package/dist/lib/TabCloseButton-CY7BGitY.js.map +1 -0
  83. package/dist/lib/Text-CMKnK9uB.js +2 -0
  84. package/dist/lib/Text-CMKnK9uB.js.map +1 -0
  85. package/dist/lib/{Tooltip-Dro4DOZs.js → Tooltip-CUOJOqQi.js} +3 -3
  86. package/dist/lib/Tooltip-CUOJOqQi.js.map +1 -0
  87. package/dist/lib/Tree-C64JNPWJ.js +2 -0
  88. package/dist/lib/Tree-C64JNPWJ.js.map +1 -0
  89. package/dist/lib/VBox-DfJPWXqc.js +2 -0
  90. package/dist/lib/VBox-DfJPWXqc.js.map +1 -0
  91. package/dist/lib/{Validator-Du8PqS5i.js → Validator-Cjs1EU5Q.js} +2 -2
  92. package/dist/lib/{Validator-Du8PqS5i.js.map → Validator-Cjs1EU5Q.js.map} +1 -1
  93. package/dist/lib/VirtualScroller-DTIn19o1.js +2 -0
  94. package/dist/lib/VirtualScroller-DTIn19o1.js.map +1 -0
  95. package/dist/lib/assets/StoreWorker-B5NwRM2I.js +2 -0
  96. package/dist/lib/assets/StoreWorker-B5NwRM2I.js.map +1 -0
  97. package/dist/lib/component/button.es.js +1 -1
  98. package/dist/lib/component/button.es.js.map +1 -1
  99. package/dist/lib/component/chart.es.js +1 -1
  100. package/dist/lib/component/chart.es.js.map +1 -1
  101. package/dist/lib/component/container.es.js +1 -1
  102. package/dist/lib/component/container.es.js.map +1 -1
  103. package/dist/lib/component/diagram.es.js +1 -1
  104. package/dist/lib/component/diagram.es.js.map +1 -1
  105. package/dist/lib/component/display.es.js +1 -1
  106. package/dist/lib/component/display.es.js.map +1 -1
  107. package/dist/lib/component/editor.es.js +3 -3
  108. package/dist/lib/component/editor.es.js.map +1 -1
  109. package/dist/lib/component/input.es.js +1 -1
  110. package/dist/lib/component/input.es.js.map +1 -1
  111. package/dist/lib/component/list.es.js +1 -1
  112. package/dist/lib/component/list.es.js.map +1 -1
  113. package/dist/lib/component/menubar.es.js +1 -1
  114. package/dist/lib/component/menubar.es.js.map +1 -1
  115. package/dist/lib/component/table.es.js +6 -3
  116. package/dist/lib/component/table.es.js.map +1 -1
  117. package/dist/lib/component/tree.es.js +1 -1
  118. package/dist/lib/component/tree.es.js.map +1 -1
  119. package/dist/lib/core.es.js +1 -1
  120. package/dist/lib/core.es.js.map +1 -1
  121. package/dist/lib/data.es.js +1 -1
  122. package/dist/lib/glyphs/solid/index.es.js +1 -1
  123. package/dist/lib/languages-Dl8qdL8a.js +2 -0
  124. package/dist/lib/languages-Dl8qdL8a.js.map +1 -0
  125. package/dist/lib/layout.es.js +1 -1
  126. package/dist/lib/layout.es.js.map +1 -1
  127. package/dist/lib/overlay.es.js +1 -1
  128. package/dist/lib/overlay.es.js.map +1 -1
  129. package/dist/lib/primitive.es.js +1 -1
  130. package/dist/lib/router.es.js +1 -1
  131. package/dist/lib/router.es.js.map +1 -1
  132. package/dist/lib/selectionsEqual-gMG7gCVI.js +2 -0
  133. package/dist/lib/selectionsEqual-gMG7gCVI.js.map +1 -0
  134. package/dist/lib/types/component/button/Button.d.ts +13 -0
  135. package/dist/lib/types/component/button/MenuButton.d.ts +1 -0
  136. package/dist/lib/types/component/button/PopupButton.d.ts +22 -0
  137. package/dist/lib/types/component/button/TabButton.d.ts +5 -1
  138. package/dist/lib/types/component/button/ToggleButton.d.ts +1 -1
  139. package/dist/lib/types/component/button/index.d.ts +2 -0
  140. package/dist/lib/types/component/chart/ChartLegend.d.ts +1 -1
  141. package/dist/lib/types/component/container/CheckboxMenuRow.d.ts +33 -0
  142. package/dist/lib/types/component/container/CollapseButton.d.ts +11 -3
  143. package/dist/lib/types/component/container/FloatingPanel.d.ts +23 -0
  144. package/dist/lib/types/component/container/MenuItem.d.ts +15 -5
  145. package/dist/lib/types/component/container/MenuRow.d.ts +24 -0
  146. package/dist/lib/types/component/container/MenuSeparator.d.ts +4 -2
  147. package/dist/lib/types/component/container/RadioMenuRow.d.ts +33 -0
  148. package/dist/lib/types/component/container/ScrollStrip.d.ts +1 -1
  149. package/dist/lib/types/component/container/Scrollbar.d.ts +6 -3
  150. package/dist/lib/types/component/container/SplitGutter.d.ts +7 -2
  151. package/dist/lib/types/component/container/TabBar.d.ts +3 -1
  152. package/dist/lib/types/component/container/WindowBorder.d.ts +1 -1
  153. package/dist/lib/types/component/container/index.d.ts +8 -1
  154. package/dist/lib/types/component/diagram/DiagramGroupNode.d.ts +1 -1
  155. package/dist/lib/types/component/display/Markdown.d.ts +42 -1
  156. package/dist/lib/types/component/display/MarkdownMinimap.d.ts +38 -0
  157. package/dist/lib/types/component/display/MarkdownViewer.d.ts +60 -0
  158. package/dist/lib/types/component/display/WebGLCanvas.d.ts +1 -0
  159. package/dist/lib/types/component/display/index.d.ts +6 -0
  160. package/dist/lib/types/component/editor/CodeEditor.d.ts +13 -0
  161. package/dist/lib/types/component/editor/index.d.ts +1 -1
  162. package/dist/lib/types/component/input/AbstractCalendarDropdown.d.ts +2 -0
  163. package/dist/lib/types/component/input/AbstractPickerField.d.ts +3 -2
  164. package/dist/lib/types/component/input/Checkbox.d.ts +1 -1
  165. package/dist/lib/types/component/input/RadioButton.d.ts +1 -1
  166. package/dist/lib/types/component/input/Slider.d.ts +1 -1
  167. package/dist/lib/types/component/input/Text.d.ts +0 -2
  168. package/dist/lib/types/component/input/Toggle.d.ts +1 -1
  169. package/dist/lib/types/component/list/AbstractSelectableList.d.ts +1 -1
  170. package/dist/lib/types/component/list/MultiSelectList.d.ts +2 -1
  171. package/dist/lib/types/component/menubar/MenuBar.d.ts +1 -1
  172. package/dist/lib/types/component/menubar/ToolBar.d.ts +1 -0
  173. package/dist/lib/types/component/shared/VirtualRowView.d.ts +2 -0
  174. package/dist/lib/types/component/table/Body.d.ts +23 -1
  175. package/dist/lib/types/component/table/Column.d.ts +3 -1
  176. package/dist/lib/types/component/table/ColumnConfig.d.ts +2 -0
  177. package/dist/lib/types/component/table/ColumnFilter.d.ts +27 -0
  178. package/dist/lib/types/component/table/Header.d.ts +30 -3
  179. package/dist/lib/types/component/table/Row.d.ts +4 -0
  180. package/dist/lib/types/component/table/Table.d.ts +29 -0
  181. package/dist/lib/types/component/table/TableExporter.d.ts +4 -3
  182. package/dist/lib/types/component/table/TreeBody.d.ts +2 -1
  183. package/dist/lib/types/component/table/cell/CellText.d.ts +9 -0
  184. package/dist/lib/types/component/table/cell/Filter.d.ts +54 -0
  185. package/dist/lib/types/component/table/cell/FilterClauseBadge.d.ts +21 -0
  186. package/dist/lib/types/component/table/cell/GroupSeparator.d.ts +9 -0
  187. package/dist/lib/types/component/table/cell/Header.d.ts +1 -0
  188. package/dist/lib/types/component/table/cell/SortPriorityBadge.d.ts +1 -1
  189. package/dist/lib/types/component/table/cell/editor/CellEditor.d.ts +1 -0
  190. package/dist/lib/types/component/table/cell/editor/CellEditorPool.d.ts +1 -0
  191. package/dist/lib/types/component/table/cell/editor/Date.d.ts +1 -0
  192. package/dist/lib/types/component/table/cell/editor/DateTime.d.ts +1 -0
  193. package/dist/lib/types/component/table/cell/editor/Time.d.ts +1 -0
  194. package/dist/lib/types/component/table/cell/renderer/CellRenderer.d.ts +1 -0
  195. package/dist/lib/types/component/table/cell/renderer/Combo.d.ts +2 -0
  196. package/dist/lib/types/component/table/cell/renderer/Date.d.ts +2 -0
  197. package/dist/lib/types/component/table/cell/renderer/DateTime.d.ts +2 -0
  198. package/dist/lib/types/component/table/cell/renderer/Filter.d.ts +16 -0
  199. package/dist/lib/types/component/table/cell/renderer/Glyph.d.ts +1 -0
  200. package/dist/lib/types/component/table/cell/renderer/Link.d.ts +2 -0
  201. package/dist/lib/types/component/table/cell/renderer/Number.d.ts +3 -1
  202. package/dist/lib/types/component/table/cell/renderer/String.d.ts +2 -0
  203. package/dist/lib/types/component/table/cell/renderer/Time.d.ts +2 -0
  204. package/dist/lib/types/component/table/cell/renderer/TreeCell.d.ts +1 -0
  205. package/dist/lib/types/component/table/index.d.ts +6 -0
  206. package/dist/lib/types/component/tree/Tree.d.ts +26 -2
  207. package/dist/lib/types/component/tree/index.d.ts +1 -1
  208. package/dist/lib/types/component/tree/renderer/Label.d.ts +1 -1
  209. package/dist/lib/types/core/AnimatedDropdown.d.ts +0 -9
  210. package/dist/lib/types/core/Body.d.ts +4 -0
  211. package/dist/lib/types/core/ClassStyleRules.d.ts +1 -0
  212. package/dist/lib/types/core/Component.d.ts +5 -0
  213. package/dist/lib/types/core/DOM.d.ts +10 -0
  214. package/dist/lib/types/core/Event.d.ts +11 -2
  215. package/dist/lib/types/core/OverlayFade.d.ts +12 -0
  216. package/dist/lib/types/core/OverlayPosition.d.ts +6 -0
  217. package/dist/lib/types/core/Theme.d.ts +12 -2
  218. package/dist/lib/types/core/index.d.ts +5 -3
  219. package/dist/lib/types/data/AbstractStore.d.ts +3 -0
  220. package/dist/lib/types/data/FilterDescriptor.d.ts +13 -0
  221. package/dist/lib/types/data/index.d.ts +2 -1
  222. package/dist/lib/types/data/temporalText.d.ts +2 -0
  223. package/dist/lib/types/layout/BoxLayout.d.ts +6 -1
  224. package/dist/lib/types/layout/Grid.d.ts +1 -0
  225. package/dist/lib/types/layout/HFlow.d.ts +1 -1
  226. package/dist/lib/types/layout/LayoutManager.d.ts +8 -0
  227. package/dist/lib/types/layout/Split.d.ts +10 -1
  228. package/dist/lib/types/layout/Tab.d.ts +7 -1
  229. package/dist/lib/types/layout/VFlow.d.ts +1 -1
  230. package/dist/lib/types/layout/index.d.ts +1 -1
  231. package/dist/lib/types/overlay/Dock.d.ts +1 -0
  232. package/dist/lib/types/overlay/Menu.d.ts +1 -1
  233. package/dist/lib/types/overlay/Popover.d.ts +3 -0
  234. package/dist/lib/types/overlay/PopupPanel.d.ts +17 -0
  235. package/dist/lib/types/overlay/Window.d.ts +2 -0
  236. package/dist/lib/types/overlay/index.d.ts +2 -0
  237. package/dist/lib/types/router/RoutePattern.d.ts +7 -0
  238. package/dist/lib/types/router/Router.d.ts +6 -2
  239. package/dist/lib/types/router/index.d.ts +1 -1
  240. package/dist/lib/validation.es.js +1 -1
  241. package/llms.txt +7 -0
  242. package/package.json +15 -15
  243. package/dist/lib/AbstractBooleanInput-DE5NNJT0.js +0 -2
  244. package/dist/lib/AbstractBooleanInput-DE5NNJT0.js.map +0 -1
  245. package/dist/lib/AnchorConstraints-DdDYSDkf.js +0 -2
  246. package/dist/lib/AnchorConstraints-DdDYSDkf.js.map +0 -1
  247. package/dist/lib/AnimatedDropdown-QLNasu_Y.js +0 -2
  248. package/dist/lib/AnimatedDropdown-QLNasu_Y.js.map +0 -1
  249. package/dist/lib/Border-CKKUk5G9.js +0 -2
  250. package/dist/lib/Border-CKKUk5G9.js.map +0 -1
  251. package/dist/lib/Button-MZDYJOMC.js +0 -2
  252. package/dist/lib/Button-MZDYJOMC.js.map +0 -1
  253. package/dist/lib/ComboBox-C04SfXAR.js +0 -2
  254. package/dist/lib/ComboBox-C04SfXAR.js.map +0 -1
  255. package/dist/lib/Component-fRQvgaEY.js +0 -2
  256. package/dist/lib/Component-fRQvgaEY.js.map +0 -1
  257. package/dist/lib/Container-0bsG2Q8Z.js +0 -2
  258. package/dist/lib/DOM-67StIm5G.js +0 -2
  259. package/dist/lib/DOM-67StIm5G.js.map +0 -1
  260. package/dist/lib/DragManager-DRor_-1x.js +0 -2
  261. package/dist/lib/DragManager-DRor_-1x.js.map +0 -1
  262. package/dist/lib/Grid-DHHmaB-Y.js.map +0 -1
  263. package/dist/lib/GridConstraints-DVc1BmlP.js +0 -2
  264. package/dist/lib/LayoutSerialization-D5bBas4W.js +0 -2
  265. package/dist/lib/LayoutSerialization-D5bBas4W.js.map +0 -1
  266. package/dist/lib/LayoutSizes-qNaURyiw.js +0 -2
  267. package/dist/lib/LayoutSizes-qNaURyiw.js.map +0 -1
  268. package/dist/lib/List-CG4NvwuV.js +0 -2
  269. package/dist/lib/MemoryStore-DT6iWWco.js +0 -2
  270. package/dist/lib/MemoryStore-DT6iWWco.js.map +0 -1
  271. package/dist/lib/Menu-CrZy2u0g.js +0 -2
  272. package/dist/lib/Menu-CrZy2u0g.js.map +0 -1
  273. package/dist/lib/Panel-Rd9zkNXx.js +0 -2
  274. package/dist/lib/RadioButton-D23rId-V.js +0 -2
  275. package/dist/lib/RadioButton-D23rId-V.js.map +0 -1
  276. package/dist/lib/Scrollbar-SOj9psiP.js +0 -2
  277. package/dist/lib/Scrollbar-SOj9psiP.js.map +0 -1
  278. package/dist/lib/Slider-DBnAZ-F7.js +0 -2
  279. package/dist/lib/Slider-DBnAZ-F7.js.map +0 -1
  280. package/dist/lib/TabButton-DKECTTk1.js +0 -2
  281. package/dist/lib/TabButton-DKECTTk1.js.map +0 -1
  282. package/dist/lib/Text-KB5LksJl.js +0 -2
  283. package/dist/lib/Text-KB5LksJl.js.map +0 -1
  284. package/dist/lib/Tooltip-Dro4DOZs.js.map +0 -1
  285. package/dist/lib/VBox-P3WFGkPc.js +0 -2
  286. package/dist/lib/VBox-P3WFGkPc.js.map +0 -1
  287. package/dist/lib/VirtualScroller-Bv4KXGKW.js +0 -2
  288. package/dist/lib/VirtualScroller-Bv4KXGKW.js.map +0 -1
  289. package/dist/lib/assets/StoreWorker-CgOBYoai.js +0 -2
  290. package/dist/lib/assets/StoreWorker-CgOBYoai.js.map +0 -1
  291. package/dist/lib/selectionsEqual-Ci3_uflt.js +0 -2
  292. package/dist/lib/selectionsEqual-Ci3_uflt.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualScroller-DTIn19o1.js","names":[],"sources":["../../src/typescript/lib/component/container/VirtualScroller.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Component } from \"~/core/Component.js\";\nimport { Util } from \"~/core/Util.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport type { Handle } from \"~/core/DOM.js\";\nimport { Event } from \"~/core/Event.js\";\nimport { SmoothScroller, consumeWheel } from \"~/core/SmoothScroller.js\";\nimport { Scrollbar } from \"~/component/container/Scrollbar.js\";\nimport { scrollShadowBoxShadow, scrollShadowEdgeValue, scrollShadowRamp } from \"~/core/ScrollShadow.js\";\n\n/** Per-edge scroll-shadow strength cache, quantised to a whole percent (0–100). */\ntype ScrollShadowEdges = { top: number; bottom: number; left: number; right: number };\n\n// VirtualScroller is a plain helper, not a Component: it owns and lays out raw\n// `clipBox` / `rowsContainer` `HTMLElement`s it creates directly, so the\n// Component style setters don't apply and direct `.style` writes are correct.\n\n/**\n * Callback fired by {@link VirtualScroller} whenever the scroll position\n * changes via user input (wheel, touch, momentum, scrollbar). The owner\n * should re-render its visible window in response.\n *\n * @category Components\n */\nexport type VirtualScrollerOnScroll = () => void;\n\n/**\n * Shared scroll machinery for transform-based virtual lists (e.g. table body,\n * tree). Owns the rows-container element, two custom {@link Scrollbar} overlays\n * (vertical + horizontal), and the wheel/touch handlers with 2-axis fling\n * momentum.\n *\n * The owner component:\n * 1. Constructs a VirtualScroller from its `init()` with the owner element and\n * a callback that re-renders the visible window.\n * 2. Appends pool rows into {@link getRowsContainer}.\n * 3. Reads {@link getScrollX} / {@link getScrollY} to determine the visible window.\n * 4. Calls {@link clampToContent} at the start of `renderWindow` (so scroll\n * positions are sane before being used).\n * 5. Calls {@link layoutScrollbars} at the end of `renderWindow` with the\n * current content sizes; the scroller applies the final clamp and positions\n * the scrollbars.\n *\n * @category Components\n */\nexport class VirtualScroller {\n\n private _owner : Component;\n private _onScroll : VirtualScrollerOnScroll;\n private _clipBox : Handle;\n private _rowsContainer : Handle;\n private _scrollbarV : Scrollbar;\n private _scrollbarH : Scrollbar;\n private _scrollX : number = 0;\n private _scrollY : number = 0;\n private _contentWidth : number = 0;\n private _contentHeight : number = 0;\n private _smooth : SmoothScroller;\n private _shadowOverlay : Handle;\n private _shadowEdges : ScrollShadowEdges = { top: 0, bottom: 0, left: 0, right: 0 };\n\n /**\n * Constructs a VirtualScroller and attaches it to the owner element.\n *\n * @param owner - The component being scrolled (used for `getContentBounds`).\n * @param element - The owner's root DOM element. Must already exist; call\n * this from the owner's `init()` after `super.init(element)`.\n * @param onScroll - Callback invoked when scroll position changes via\n * user input.\n */\n constructor(owner: Component, element: Handle, onScroll: VirtualScrollerOnScroll) {\n this._owner = owner;\n this._onScroll = onScroll;\n\n // Two-element wrapper: the outer `clipBox` carries `overflow:hidden`\n // sized to the effective viewport so the Scrollbar widgets — positioned\n // by `layoutScrollbars` at the far edge of the owner's content box —\n // sit in their own reserved band rather than overlaying the rightmost\n // column / bottom row. The inner `rowsContainer` carries the scroll\n // transform; the transform cannot sit on the same element as\n // `overflow:hidden` because CSS clipping happens in the element's own\n // LOCAL coordinate system before its transform applies — splitting\n // the two roles lets the transform shift the rows around inside a\n // stable clip.\n const clipBox = DOM.sink.createElement(\"div\");\n DOM.sink.apply(clipBox, { style: { position: \"absolute\", top: \"0\", left: \"0\", width: \"100%\", height: \"100%\", overflow: \"hidden\" } });\n DOM.sink.appendChild(element, clipBox);\n this._clipBox = clipBox;\n\n const container = DOM.sink.createElement(\"div\");\n DOM.sink.apply(container, { style: { position: \"absolute\", top: \"0\", left: \"0\", width: \"100%\", transform: \"translate3d(0, 0, 0)\", willChange: \"transform\" } });\n DOM.sink.appendChild(clipBox, container);\n this._rowsContainer = container;\n\n // Position-aware edge shadows, matching the native-scroll `Panel` cue.\n // The overlay is a sibling of `rowsContainer` inside the `clipBox`, so it\n // is clipped to the effective viewport and — being outside the scrolled\n // `rowsContainer` — is not shifted by the scroll transform; sizing it to\n // 100% tracks the clip box that `layoutScrollbars` resizes to the\n // effective viewport. It paints above the rows (appended last) and is\n // inert to the pointer. Each edge is a `box-shadow` layer gated by a\n // custom property; `updateShadows` flips the property per scroll/resize.\n const shadowOverlay = DOM.sink.createElement(\"div\");\n DOM.sink.apply(shadowOverlay, { style: {\n position: \"absolute\",\n top: \"0\",\n left: \"0\",\n width: \"100%\",\n height: \"100%\",\n pointerEvents: \"none\",\n boxShadow: scrollShadowBoxShadow(),\n } });\n DOM.sink.appendChild(clipBox, shadowOverlay);\n this._shadowOverlay = shadowOverlay;\n\n // Drives wheel-initiated scrolling through an eased RAF loop. The seam\n // delegates to the existing setScrollX/Y (which clamp, write the\n // transform, and fire onScroll, so the virtual window re-renders every\n // frame) and clamps targets against the same effective-viewport bounds.\n this._smooth = new SmoothScroller({\n read: (axis) => axis === \"x\" ? this._scrollX : this._scrollY,\n write: (axis, value) => axis === \"x\" ? this.setScrollX(value) : this.setScrollY(value),\n clamp: (axis, value) => this.clampAxis(axis, value),\n });\n\n this._scrollbarV = new Scrollbar(\"vertical\");\n DOM.sink.appendChild(element, this._scrollbarV.getElement(true)!);\n this._scrollbarV.on(\"scroll\", (p: number) => {\n this._smooth.reset();\n this.setScrollY(p);\n });\n\n this._scrollbarH = new Scrollbar(\"horizontal\");\n DOM.sink.appendChild(element, this._scrollbarH.getElement(true)!);\n this._scrollbarH.on(\"scroll\", (p: number) => {\n this._smooth.reset();\n this.setScrollX(p);\n });\n\n this._owner.setTouchAction(\"none\");\n\n // Subtree because wheel events fire on whichever descendant of the\n // owner the pointer is over (a row, a cell, …) — not the owner root.\n // passive: false so onWheel can preventDefault the native page scroll.\n Event.addSubtreeListener(\n this._owner,\n \"wheel\",\n { passive: false, handler: (e: WheelEvent) => this.onWheel(e) },\n );\n\n this.attachTouchHandlers();\n }\n\n /**\n * Disposes the two `Scrollbar` overlays this scroller owns. They are\n * appended straight onto the owner's element rather than registered as its\n * children, so the owner's `destructor()` recursion cannot reach them and\n * their per-instance stylesheet rules would otherwise survive teardown.\n * Called from `VirtualRowView.destructor()`.\n */\n dispose(): void {\n this._scrollbarV.dispose();\n this._scrollbarH.dispose();\n }\n\n /**\n * Returns the two created container handles (clip box and rows container).\n * The owning component tracks these via `trackHandle` so they are released\n * with the owner — on its destructor or, for a discarded owner, on GC — and\n * not left pinned in the registry. The scroller is not a `Component`, so it\n * cannot track its own handles.\n *\n * @returns The scroller's owned element handles.\n */\n ownedHandles(): readonly Handle[] {\n return [this._clipBox, this._rowsContainer, this._shadowOverlay];\n }\n\n /**\n * Returns the rows-container element. Owners append pool rows here so\n * they participate in the transform-based scroll.\n *\n * @returns The rows-container DOM element.\n */\n getRowsContainer(): Handle {\n return this._rowsContainer;\n }\n\n /**\n * Returns the current vertical scroll position in pixels.\n *\n * @returns The current `scrollY`.\n */\n getScrollY(): number {\n return this._scrollY;\n }\n\n /**\n * Returns the current horizontal scroll position in pixels.\n *\n * @returns The current `scrollX`.\n */\n getScrollX(): number {\n return this._scrollX;\n }\n\n /**\n * Sets the vertical scroll position. Clamped against the last-known\n * content height and the *effective* viewport height (the owner's\n * content-box height minus the horizontal scrollbar's reservation when\n * that bar is visible),\n * so the maximum reachable scroll position matches what the vertical\n * scrollbar's thumb tops out at. Triggers the owner's `onScroll` callback\n * if the position changed.\n *\n * @param y - The new scroll position in pixels.\n */\n setScrollY(y: number): this {\n const maxScroll = Math.max(0, this._contentHeight - this.effectiveViewportH());\n const next = Util.clamp(y, 0, maxScroll);\n\n if (next === this._scrollY) {\n return this;\n }\n\n this._scrollY = next;\n this.updateTransform();\n this._onScroll();\n\n return this;\n }\n\n /**\n * Sets the horizontal scroll position. Clamped against the last-known\n * content width and the *effective* viewport width (the owner's\n * content-box width minus the vertical scrollbar's reservation when that\n * bar is visible),\n * so the maximum reachable scroll position matches what the horizontal\n * scrollbar's thumb tops out at. Triggers the owner's `onScroll` callback\n * if the position changed.\n *\n * @param x - The new scroll position in pixels.\n */\n setScrollX(x: number): this {\n const maxScroll = Math.max(0, this._contentWidth - this.effectiveViewportW());\n const next = Util.clamp(x, 0, maxScroll);\n\n if (next === this._scrollX) {\n return this;\n }\n\n this._scrollX = next;\n this.updateTransform();\n this._onScroll();\n\n return this;\n }\n\n /**\n * Clamps a requested position for one axis to its `[0, max]` range, using\n * the same effective-viewport bounds as `setScrollX/Y` so the eased wheel\n * target converges exactly where the scrollbar thumb tops out.\n *\n * @param axis - The axis to clamp (`\"x\"` or `\"y\"`).\n * @param value - The requested position in pixels.\n *\n * @returns The clamped position in pixels.\n */\n private clampAxis(axis: \"x\" | \"y\", value: number): number {\n const max = axis === \"x\"\n ? Math.max(0, this._contentWidth - this.effectiveViewportW())\n : Math.max(0, this._contentHeight - this.effectiveViewportH());\n\n return Util.clamp(value, 0, max);\n }\n\n /**\n * Aborts any in-flight eased wheel animation and re-seeds it from the live\n * position. Call before a programmatic scroll jump (e.g. `scrollToRecord`)\n * so a lingering ease can't snap the position back afterward.\n */\n resetWheelEase(): void {\n this._smooth.reset();\n }\n\n /**\n * Decides whether each scrollbar should be visible given the current\n * content size, accounting for the mutual dependency between the two\n * axes — if one bar is visible, its track-width reservation shrinks\n * the cross-axis viewport, which can in turn force the other bar to\n * become visible. Two iterations are sufficient: each pass can only\n * promote one flag from false to true.\n *\n * The effective viewport is measured in the owner's content box, not its\n * outer box, so a bordered or padded owner reports the space actually\n * visible to rows.\n */\n private computeScrollbarVisibility(contentWidth: number, contentHeight: number): { vVisible: boolean, hVisible: boolean, effW: number, effH: number } {\n const box = this._owner.getContentBounds()\n ?? { x: 0, y: 0, width: this._owner.getWidth() || 0, height: this._owner.getHeight() || 0 };\n\n // `box.{width,height}` derive from the owner's committed `_width`/\n // `_height`, which are declared `NaN` and stay so until the owner is\n // first sized. The `?? …` fallback above covers the no-element case,\n // not that one — an element-bearing but unsized owner still yields a\n // non-null box whose extents are NaN — so `|| 0` stays, the same\n // coercion the outer-box reads it replaced already used.\n const outerH = box.height || 0;\n const outerW = box.width || 0;\n const trackW = this._scrollbarV.getTrackWidth();\n\n let vVisible = false;\n let hVisible = false;\n for (let i = 0; i < 2; i++) {\n const effH: number = outerH - (hVisible ? trackW : 0);\n const effW: number = outerW - (vVisible ? trackW : 0);\n\n vVisible = contentHeight > effH;\n hVisible = contentWidth > effW;\n }\n\n const effH = outerH - (hVisible ? trackW : 0);\n const effW = outerW - (vVisible ? trackW : 0);\n\n return { vVisible, hVisible, effW, effH };\n }\n\n /**\n * Effective vertical viewport — the owner's content-box height minus the\n * horizontal scrollbar's track-width reservation when that bar would be\n * visible.\n * Single source of truth so the clamps in `setScrollY` agree with what\n * the vertical scrollbar's `setMetrics` is fed.\n */\n private effectiveViewportH(): number {\n return this.computeScrollbarVisibility(this._contentWidth, this._contentHeight).effH;\n }\n\n /**\n * Effective horizontal viewport — see {@link effectiveViewportH}.\n */\n private effectiveViewportW(): number {\n return this.computeScrollbarVisibility(this._contentWidth, this._contentHeight).effW;\n }\n\n /**\n * Effective viewport width for the last-known content metrics — the owner's\n * content-box width minus the vertical scrollbar's track reservation when\n * that bar is visible. Owners that size fill-width rows (e.g. the\n * [`Tree`](/api/component/tree/classes/Tree)) base their row width on this so\n * content does not run under the vertical bar, which would otherwise force a\n * spurious horizontal bar for the reserved band. Reads the current\n * `_contentWidth` / `_contentHeight`; callers refresh those via\n * {@link clampToContent} at the top of their render pass before querying.\n * The public face of `effectiveViewportW` (same value; that stays the\n * internal clamp helper).\n *\n * @returns The effective viewport width in pixels.\n */\n getViewportWidth(): number {\n return this.effectiveViewportW();\n }\n\n /**\n * Clamps the current `scrollX` / `scrollY` against the new content size\n * and the *effective* viewport on each axis (which subtracts the\n * cross-axis scrollbar's track-width when that bar is visible). Call at\n * the start of `renderWindow` so scrollX/Y are within range before being\n * used for window calculations — important when content has shrunk since\n * the last frame. Uses the same effective-viewport reasoning as\n * `setScrollX/Y` so the clamps agree and scrollX/Y aren't pulled back to\n * a smaller bound than the scrollbar's own `setMetrics` expects (which\n * would leave the thumb stopping short of the end-arrow). Does not fire\n * `onScroll`.\n *\n * @param contentWidth - The total scrollable content width in pixels.\n * @param contentHeight - The total scrollable content height in pixels.\n */\n clampToContent(contentWidth: number, contentHeight: number): void {\n this._contentWidth = contentWidth;\n this._contentHeight = contentHeight;\n\n const maxY = Math.max(0, contentHeight - this.effectiveViewportH());\n const maxX = Math.max(0, contentWidth - this.effectiveViewportW());\n\n let changed = false;\n if (this._scrollY > maxY) {\n this._scrollY = maxY;\n changed = true;\n }\n if (this._scrollX > maxX) {\n this._scrollX = maxX;\n changed = true;\n }\n if (changed) {\n this.updateTransform();\n }\n }\n\n /**\n * Tight clamp using effective viewports (each axis subtracts the\n * cross-axis scrollbar's track width when it is visible), then positions\n * the scrollbars and pushes metrics. Call at end of `renderWindow`.\n *\n * Both bars and the clip box are placed in the owner's content box: a\n * child's containing block is already the owner's padding box, so\n * placing them against the outer box would run the far edge past where\n * `overflow: hidden` clips, by both border sides.\n *\n * @param contentWidth - The total scrollable content width in pixels.\n * @param contentHeight - The total scrollable content height in pixels.\n */\n layoutScrollbars(contentWidth: number, contentHeight: number): void {\n this._contentWidth = contentWidth;\n this._contentHeight = contentHeight;\n\n const box = this._owner.getContentBounds()\n ?? { x: 0, y: 0, width: this._owner.getWidth() || 0, height: this._owner.getHeight() || 0 };\n\n const trackW = this._scrollbarV.getTrackWidth();\n\n const { effW, effH } = this.computeScrollbarVisibility(contentWidth, contentHeight);\n\n const maxY = Math.max(0, contentHeight - effH);\n const maxX = Math.max(0, contentWidth - effW);\n if (this._scrollY > maxY || this._scrollX > maxX) {\n if (this._scrollY > maxY) this._scrollY = maxY;\n if (this._scrollX > maxX) this._scrollX = maxX;\n this.updateTransform();\n }\n\n this._scrollbarV.setX(box.x + Math.max(0, box.width - trackW));\n this._scrollbarV.setY(box.y);\n this._scrollbarV.setHeight(effH);\n this._scrollbarV.setMetrics(effH, contentHeight, this._scrollY);\n\n this._scrollbarH.setX(box.x);\n this._scrollbarH.setY(box.y + Math.max(0, box.height - trackW));\n this._scrollbarH.setWidth(effW);\n this._scrollbarH.setMetrics(effW, contentWidth, this._scrollX);\n\n // Resize the clip box to the effective viewport so cells translated\n // by the horizontal scroll can't bleed under the vertical scrollbar\n // (and rows beyond the bottom can't bleed under the horizontal\n // scrollbar). When neither bar is visible this collapses to the\n // full owner content box, matching the previous `width/height: 100%`\n // behaviour for a borderless, unpadded owner.\n DOM.sink.apply(this._clipBox, { style: { left: box.x + \"px\", top: box.y + \"px\", width: effW + \"px\", height: effH + \"px\" } });\n\n // Content size / viewport may have changed without the scroll position\n // moving (so `updateTransform` did not run above) — refresh the shadow\n // edges against the new extremes.\n this.updateShadows();\n }\n\n /**\n * Writes the current `scrollX` / `scrollY` into the rows-container\n * transform.\n */\n private updateTransform(): void {\n DOM.sink.apply(this._rowsContainer, { style: { transform: `translate3d(${-this._scrollX}px, ${-this._scrollY}px, 0)` } });\n this.updateShadows();\n }\n\n /**\n * Recomputes each scroll-shadow edge's strength from the current scroll\n * position, content size, and effective viewport, then lights only the\n * edges that have hidden content past them. Cheap on a no-op scroll: an\n * edge whose quantised strength is unchanged skips the DOM write (see\n * {@link setShadowEdge}). Called on every scroll ({@link updateTransform})\n * and whenever the content/viewport metrics change ({@link layoutScrollbars}).\n */\n private updateShadows(): void {\n const { effW, effH } = this.computeScrollbarVisibility(this._contentWidth, this._contentHeight);\n\n const maxX = Math.max(0, this._contentWidth - effW);\n const maxY = Math.max(0, this._contentHeight - effH);\n\n this.setShadowEdge(\"top\", \"--ts-ss-top\", scrollShadowRamp(this._scrollY));\n this.setShadowEdge(\"bottom\", \"--ts-ss-bottom\", scrollShadowRamp(maxY - this._scrollY));\n this.setShadowEdge(\"left\", \"--ts-ss-left\", scrollShadowRamp(this._scrollX));\n this.setShadowEdge(\"right\", \"--ts-ss-right\", scrollShadowRamp(maxX - this._scrollX));\n }\n\n /**\n * Sets a single edge's shadow strength by scaling the theme shadow colour\n * toward transparent. Strength is quantised to a whole percent so an\n * in-ramp scroll only repaints when the visible strength actually changes;\n * at zero the property is unset so the `box-shadow` layer falls back to\n * `transparent`.\n *\n * @param edge - The edge whose cached strength this updates.\n * @param property - The overlay custom property backing that edge's shadow.\n * @param strength - The target strength in the range 0–1.\n */\n private setShadowEdge(edge: keyof ScrollShadowEdges, property: string, strength: number): void {\n const percent = Math.round(strength * 100); // quantise: 0–1 → 0–100%\n\n if (this._shadowEdges[edge] === percent) {\n return;\n }\n\n this._shadowEdges[edge] = percent;\n DOM.sink.apply(this._shadowOverlay, { style: { [property]: scrollShadowEdgeValue(percent) } });\n }\n\n /**\n * Eases wheel input into the scroll position through the {@link SmoothScroller}.\n * Shift+wheel without an explicit deltaX is treated as horizontal scroll.\n * Claims the event so an ancestor scroll container doesn't also scroll it.\n *\n * @param e - The wheel event.\n */\n private onWheel(e: WheelEvent): Event.ListenerResult {\n if (!consumeWheel(e)) {\n return;\n }\n\n if (e.shiftKey && e.deltaY !== 0 && e.deltaX === 0) {\n this._smooth.scrollBy(e.deltaY, 0);\n\n return { prevent: true };\n }\n\n this._smooth.scrollBy(e.deltaX, e.deltaY);\n\n return { prevent: true };\n }\n\n /**\n * Installs the touch handlers: 1:1 finger drag scrolls both axes, and on\n * release a 2D fling momentum decays per frame until it falls below\n * threshold or hits a scroll boundary.\n */\n private attachTouchHandlers(): void {\n let touchActive = false;\n let touchStartY = 0;\n let touchStartX = 0;\n let touchStartScrollY = 0;\n let touchStartScrollX = 0;\n let touchSamples : Array<{ time: number, x: number, y: number }> = [];\n let momentumRaf : number | null = null;\n\n const cancelMomentum = (): void => {\n if (momentumRaf !== null) {\n DOM.sink.cancelAnimationFrame(momentumRaf);\n momentumRaf = null;\n }\n };\n\n // Subtree because touch events fire on descendants of the owner\n // (rows / cells) — not the owner root.\n Event.addSubtreeListener(this._owner, \"touchstart\", (e: TouchEvent) => {\n if (e.touches.length !== 1) {\n return;\n }\n cancelMomentum();\n this._smooth.reset();\n touchActive = true;\n touchStartY = e.touches[0].clientY;\n touchStartX = e.touches[0].clientX;\n touchStartScrollY = this._scrollY;\n touchStartScrollX = this._scrollX;\n touchSamples = [{ time: performance.now(), x: touchStartX, y: touchStartY }];\n });\n\n Event.addSubtreeListener(this._owner, \"touchmove\", (e: TouchEvent) => {\n if (!touchActive || e.touches.length !== 1) {\n return;\n }\n const y = e.touches[0].clientY;\n const x = e.touches[0].clientX;\n const now = performance.now();\n\n touchSamples.push({ time: now, x: x, y: y });\n while (touchSamples.length > 1 && touchSamples[0].time < now - 150) {\n touchSamples.shift();\n }\n\n this.setScrollY(touchStartScrollY + (touchStartY - y));\n this.setScrollX(touchStartScrollX + (touchStartX - x));\n });\n\n const startMomentum = (): void => {\n if (touchSamples.length < 2) {\n return;\n }\n\n const last = touchSamples[touchSamples.length - 1];\n\n const PAUSE_THRESHOLD = 50;\n if (performance.now() - last.time > PAUSE_THRESHOLD) {\n return;\n }\n\n const VELOCITY_WINDOW = 80;\n const cutoff = last.time - VELOCITY_WINDOW;\n let firstIdx = touchSamples.length - 1;\n while (firstIdx > 0 && touchSamples[firstIdx - 1].time >= cutoff) {\n firstIdx--;\n }\n const first = touchSamples[firstIdx];\n const dt = last.time - first.time;\n if (dt <= 0) {\n return;\n }\n\n let velocityY = (first.y - last.y) / dt;\n let velocityX = (first.x - last.x) / dt;\n\n const MIN_VELOCITY = 0.1;\n const FRICTION = 0.95;\n const STOP_VELOCITY = 0.02;\n\n const initialSpeed = Math.sqrt(velocityX * velocityX + velocityY * velocityY);\n if (initialSpeed < MIN_VELOCITY) {\n return;\n }\n\n let lastT = performance.now();\n const step = (): void => {\n const now = performance.now();\n const frame = now - lastT;\n lastT = now;\n\n const decay = Math.pow(FRICTION, frame / 16.667);\n velocityY *= decay;\n velocityX *= decay;\n\n const speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY);\n if (speed < STOP_VELOCITY) {\n momentumRaf = null;\n return;\n }\n\n const beforeY = this._scrollY;\n const beforeX = this._scrollX;\n this.setScrollY(this._scrollY + velocityY * frame);\n this.setScrollX(this._scrollX + velocityX * frame);\n if (this._scrollY === beforeY) {\n velocityY = 0;\n }\n if (this._scrollX === beforeX) {\n velocityX = 0;\n }\n if (velocityY === 0 && velocityX === 0) {\n momentumRaf = null;\n return;\n }\n\n momentumRaf = DOM.sink.requestAnimationFrame(step);\n };\n\n momentumRaf = DOM.sink.requestAnimationFrame(step);\n };\n\n Event.addSubtreeListener(this._owner, \"touchend\", () => {\n if (!touchActive) {\n return;\n }\n touchActive = false;\n startMomentum();\n });\n\n Event.addSubtreeListener(this._owner, \"touchcancel\", () => {\n touchActive = false;\n cancelMomentum();\n });\n }\n}\n"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ (function(){function e(e,t,n){switch(e){case`date`:return n.toLocaleDateString();case`time`:return n.toLocaleTimeString(void 0,t?{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}:{hour:`2-digit`,minute:`2-digit`});case`datetime`:return n.toLocaleString(void 0,t?{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}:{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}}function t(e,t){return e&&typeof e.get==`function`?e.get(t):e?e[t]:void 0}function n(n,r){let i=t(n,r.field);if(i==null)return null;let a=i instanceof Date&&r.temporal?e(r.temporal.type,r.temporal.showSeconds,i):String(i);return r.caseSensitive?{haystack:a,needle:r.value}:{haystack:a.toLowerCase(),needle:r.value.toLowerCase()}}function r(e,i){switch(i.type){case`eq`:{let n=t(e,i.field);return n instanceof Date&&i.value instanceof Date?n.getTime()===i.value.getTime():n===i.value}case`neq`:{let n=t(e,i.field);return n instanceof Date&&i.value instanceof Date?n.getTime()!==i.value.getTime():n!==i.value}case`contains`:{let t=n(e,i);return t!==null&&t.haystack.indexOf(t.needle)!==-1}case`startsWith`:{let t=n(e,i);return t!==null&&t.haystack.indexOf(t.needle)===0}case`endsWith`:{let t=n(e,i);return t!==null&&t.haystack.lastIndexOf(t.needle)===t.haystack.length-t.needle.length}case`gt`:return t(e,i.field)>i.value;case`gte`:return t(e,i.field)>=i.value;case`lt`:return t(e,i.field)<i.value;case`lte`:return t(e,i.field)<=i.value;case`in`:return i.values.indexOf(t(e,i.field))!==-1;case`and`:for(let t of i.filters)if(!r(e,t))return!1;return!0;case`or`:for(let t of i.filters)if(r(e,t))return!0;return!1;case`not`:return!r(e,i.filter)}}function i(e,t){return e<t?-1:+(e>t)}function a(e,t,n){return e==null&&t==null?0:e==null?1:t==null?-1:n===`string`||n===void 0&&typeof e==`string`&&typeof t==`string`?e.localeCompare(t):(n===`date`||n===`datetime`||n===`time`)&&e instanceof Date&&t instanceof Date?i(e.getTime(),t.getTime()):i(e,t)}let o=new Map;function s(e,t,n,r,i){t.sort((t,o)=>{let s=e[t]?e[t][n]:void 0,c=e[o]?e[o][n]:void 0,l=a(s,c,i);return s==null||c==null||r===`asc`?l:-l})}self.onmessage=e=>{let t=e.data;try{if(t.type===`snapshot`){o.set(t.storeId,t.records),self.postMessage({requestId:t.requestId});return}let e=o.get(t.storeId);if(!e){self.postMessage({requestId:t.requestId,error:`No snapshot for storeId `+t.storeId});return}let n=[];for(let t=0;t<e.length;t++)n.push(t);t.filter&&(n=n.filter(n=>r(e[n],t.filter))),t.sort&&s(e,n,t.sort.field,t.sort.direction,t.sort.fieldType),self.postMessage({requestId:t.requestId,indices:n})}catch(e){self.postMessage({requestId:t.requestId,error:String(e?.message??e)})}}})();
2
+ //# sourceMappingURL=StoreWorker-B5NwRM2I.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StoreWorker-B5NwRM2I.js","names":[],"sources":["../../src/typescript/lib/data/temporalText.ts","../../src/typescript/lib/data/FilterDescriptor.ts","../../src/typescript/lib/data/compareValues.ts","../../src/typescript/lib/data/StoreWorker.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\n/**\n * The three field types whose cells render a `Date` as locale-formatted text.\n *\n * @category Data\n */\nexport type TemporalFieldType = 'date' | 'time' | 'datetime';\n\n/**\n * Formats `value` exactly as a cell of this variant displays it — the same\n * `toLocaleDateString` / `toLocaleTimeString` / `toLocaleString` calls the\n * `Date` / `Time` / `DateTime` cell renderers use, so a substring filter over\n * a temporal column can match what the cell actually shows.\n *\n * @param type - The temporal field type, selecting which native formatter runs.\n * @param showSeconds - Whether to include seconds; ignored for `'date'`.\n * @param value - The value to format.\n * @returns The locale-formatted display text.\n *\n * @internal — not re-exported from the package barrel.\n */\nexport function temporalDisplayText(type: TemporalFieldType, showSeconds: boolean, value: Date): string {\n switch (type) {\n case 'date':\n return value.toLocaleDateString();\n\n case 'time':\n return value.toLocaleTimeString(undefined, showSeconds\n ? { hour: '2-digit', minute: '2-digit', second: '2-digit' }\n : { hour: '2-digit', minute: '2-digit' });\n\n case 'datetime':\n return value.toLocaleString(undefined, showSeconds\n ? { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit' }\n : { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' });\n }\n}\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport type { TemporalFieldType } from \"~/data/temporalText.js\";\nimport { temporalDisplayText } from \"~/data/temporalText.js\";\n\n/**\n * How a substring operator renders a `Date`-valued field before matching.\n * Absent means \"match the raw value\", which is the behaviour every descriptor\n * built before this member existed still gets.\n *\n * @category Data\n */\nexport interface TemporalDisplay {\n type: TemporalFieldType;\n showSeconds: boolean;\n}\n\n/**\n * Serializable filter algebra for {@link AbstractStore}. Descriptors are plain objects so\n * they can cross the worker boundary via structured clone (unlike arbitrary filter\n * functions, which can't). The same evaluator runs on either side.\n *\n * `eq` / `neq` compare two `Date` operands by instant (`getTime()`) rather than by\n * reference, since two distinct `Date` instances for the same moment are never `===`.\n *\n * A `contains` / `startsWith` / `endsWith` descriptor over a `Date`-valued field renders\n * the field through its optional `temporal` hint before matching, so the operator agrees\n * with what the cell displays; when the hint is absent, or the field's value is not a\n * `Date`, the raw value is matched unchanged, exactly as every descriptor built before\n * this member existed.\n *\n * @category Data\n */\nexport type FilterDescriptor =\n | { type: 'eq'; field: string; value: any }\n | { type: 'neq'; field: string; value: any }\n | { type: 'contains'; field: string; value: string; caseSensitive?: boolean; temporal?: TemporalDisplay }\n | { type: 'startsWith'; field: string; value: string; caseSensitive?: boolean; temporal?: TemporalDisplay }\n | { type: 'endsWith'; field: string; value: string; caseSensitive?: boolean; temporal?: TemporalDisplay }\n | { type: 'gt'; field: string; value: number | string | Date }\n | { type: 'gte'; field: string; value: number | string | Date }\n | { type: 'lt'; field: string; value: number | string | Date }\n | { type: 'lte'; field: string; value: number | string | Date }\n | { type: 'in'; field: string; values: any[] }\n | { type: 'and'; filters: FilterDescriptor[] }\n | { type: 'or'; filters: FilterDescriptor[] }\n | { type: 'not'; filter: FilterDescriptor };\n\n/**\n * Looks up a field's value from either a plain data object or a ModelRecord-like\n * object that exposes a `get(field)` method. Lets the same matcher run on both\n * sides of the worker boundary.\n */\nfunction readField(record: any, field: string): any {\n if (record && typeof record.get === 'function') {\n return record.get(field);\n }\n return record ? record[field] : undefined;\n}\n\n/** The three descriptor members a substring operator can appear as. */\ntype SubstringDescriptor = Extract<FilterDescriptor, { type: 'contains' | 'startsWith' | 'endsWith' }>;\n\n/**\n * The haystack/needle pair a substring operator compares, or `null` when the\n * field is nullish and no match is possible. A `Date` field is rendered\n * through `descriptor.temporal` when that hint is present; every other value\n * keeps the plain `String(raw)` coercion.\n */\nfunction substringOperands(record: any, descriptor: SubstringDescriptor): { haystack: string; needle: string } | null {\n const raw = readField(record, descriptor.field);\n\n if (raw == null) {\n return null;\n }\n\n const text = raw instanceof Date && descriptor.temporal\n ? temporalDisplayText(descriptor.temporal.type, descriptor.temporal.showSeconds, raw)\n : String(raw);\n\n return descriptor.caseSensitive\n ? { haystack: text, needle: descriptor.value }\n : { haystack: text.toLowerCase(), needle: descriptor.value.toLowerCase() };\n}\n\n/**\n * Evaluates a FilterDescriptor against a record. Returns true if the record\n * matches the filter. Works with both plain data objects (worker side) and\n * ModelRecord instances (main thread side).\n */\nexport function matchesFilter(record: any, descriptor: FilterDescriptor): boolean {\n switch (descriptor.type) {\n case 'eq': {\n const raw = readField(record, descriptor.field);\n\n if (raw instanceof Date && descriptor.value instanceof Date) {\n return raw.getTime() === descriptor.value.getTime();\n }\n\n return raw === descriptor.value;\n }\n\n case 'neq': {\n const raw = readField(record, descriptor.field);\n\n if (raw instanceof Date && descriptor.value instanceof Date) {\n return raw.getTime() !== descriptor.value.getTime();\n }\n\n return raw !== descriptor.value;\n }\n\n case 'contains': {\n const operands = substringOperands(record, descriptor);\n\n return operands !== null && operands.haystack.indexOf(operands.needle) !== -1;\n }\n\n case 'startsWith': {\n const operands = substringOperands(record, descriptor);\n\n return operands !== null && operands.haystack.indexOf(operands.needle) === 0;\n }\n\n case 'endsWith': {\n const operands = substringOperands(record, descriptor);\n\n return operands !== null\n && operands.haystack.lastIndexOf(operands.needle) === operands.haystack.length - operands.needle.length;\n }\n\n case 'gt':\n return readField(record, descriptor.field) > descriptor.value;\n\n case 'gte':\n return readField(record, descriptor.field) >= descriptor.value;\n\n case 'lt':\n return readField(record, descriptor.field) < descriptor.value;\n\n case 'lte':\n return readField(record, descriptor.field) <= descriptor.value;\n\n case 'in':\n return descriptor.values.indexOf(readField(record, descriptor.field)) !== -1;\n\n case 'and':\n for (const f of descriptor.filters) {\n if (!matchesFilter(record, f)) return false;\n }\n return true;\n\n case 'or':\n for (const f of descriptor.filters) {\n if (matchesFilter(record, f)) return true;\n }\n return false;\n\n case 'not':\n return !matchesFilter(record, descriptor.filter);\n }\n}\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport type { FieldType } from '~/data/Field.js';\n\n/**\n * Native ordering of two non-null values via `<` / `>`, returning the\n * ascending-sense sign. Used for numeric (and any non-string, non-date) fields.\n *\n * @param av - The left operand.\n * @param bv - The right operand.\n *\n * @returns A negative, zero, or positive number in ascending sense.\n */\nfunction nativeCompare(av: any, bv: any): number {\n return av < bv ? -1 : av > bv ? 1 : 0;\n}\n\n/**\n * Type-aware, locale-aware comparison of two raw field values, returning a\n * negative / zero / positive number in **ascending** sense. This is the single\n * comparator shared by the main thread ({@link AbstractStore}) and the\n * `StoreWorker`, so the two sort paths can never drift.\n *\n * @param av - The left value.\n * @param bv - The right value.\n * @param type - Optional. The field's {@link FieldType}, which selects the\n * comparison strategy (string → locale, date/time → timestamp, else native).\n * When omitted, two string operands still use the locale path.\n *\n * @returns The ascending-sense comparison result.\n *\n * @remarks\n * `null`/`undefined` sort **last**: both null compare equal (`0`), and a single\n * null returns the sign that places it after a non-null value. Callers must\n * leave a null-involving result un-negated (apply sort direction only to a\n * non-null comparison) so nulls stay last regardless of `'asc'`/`'desc'`.\n *\n * String fields (or two string operands when `type` is unknown) use\n * `localeCompare`, so `'Ä'` orders between `'a'` and `'Z'` rather than after\n * `'Z'` by code point. Date/time fields compare by `getTime()` when both\n * operands are `Date`, falling through to native comparison otherwise.\n *\n * @category Data\n */\nexport function compareValues(av: any, bv: any, type?: FieldType): number {\n if (av == null && bv == null) {\n return 0;\n }\n\n if (av == null) {\n return 1;\n }\n\n if (bv == null) {\n return -1;\n }\n\n if (type === 'string' || (type === undefined && typeof av === 'string' && typeof bv === 'string')) {\n return av.localeCompare(bv);\n }\n\n if (type === 'date' || type === 'datetime' || type === 'time') {\n if (av instanceof Date && bv instanceof Date) {\n return nativeCompare(av.getTime(), bv.getTime());\n }\n }\n\n return nativeCompare(av, bv);\n}\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n/* eslint-disable local/no-raw-dom -- Web Worker entry: self/postMessage are worker-scope messaging, not DOM. */\n//\n// Worker entry point for AbstractStore sort/filter offload. Runs in a Web Worker\n// context (Vite imports it via `?worker` query). Owns a per-store snapshot of\n// plain record data so sort/filter can run without re-shipping the dataset on\n// every operation. Returns sorted indices into the snapshot — main thread maps\n// them back to ModelRecord instances itself.\n\nimport { FilterDescriptor, matchesFilter } from \"~/data/FilterDescriptor.js\";\nimport { compareValues } from \"~/data/compareValues.js\";\nimport type { FieldType } from \"~/data/Field.js\";\n\ntype Direction = \"asc\" | \"desc\";\n\ntype StoreSnapshot = Array<Record<string, any>>;\n\ntype Request =\n | { type: \"snapshot\"; storeId: string; records: StoreSnapshot; requestId: number }\n | { type: \"sortFilter\"; storeId: string; sort?: { field: string; direction: Direction; fieldType?: FieldType };\n filter?: FilterDescriptor; requestId: number };\n\ntype Response = { requestId: number; indices?: number[]; error?: string };\n\nconst snapshots: Map<string, StoreSnapshot> = new Map();\n\nfunction sortIndices(records: StoreSnapshot, indices: number[], field: string, direction: Direction, fieldType?: FieldType): void {\n indices.sort((ai, bi) => {\n const av = records[ai] ? records[ai][field] : undefined;\n const bv = records[bi] ? records[bi][field] : undefined;\n\n const cmp = compareValues(av, bv, fieldType);\n\n // Nulls sort last regardless of direction: leave a null-involving result\n // un-negated, applying direction only to a non-null comparison. This\n // mirrors the main-thread comparator in AbstractStore.applyView().\n if (av == null || bv == null) {\n return cmp;\n }\n\n return direction === \"asc\" ? cmp : -cmp;\n });\n}\n\nself.onmessage = (e: MessageEvent<Request>) => {\n const msg = e.data;\n\n try {\n if (msg.type === \"snapshot\") {\n snapshots.set(msg.storeId, msg.records);\n (self as any).postMessage({ requestId: msg.requestId } as Response);\n return;\n }\n\n const records = snapshots.get(msg.storeId);\n if (!records) {\n (self as any).postMessage({ requestId: msg.requestId, error: \"No snapshot for storeId \" + msg.storeId } as Response);\n return;\n }\n\n let indices: number[] = [];\n for (let i = 0; i < records.length; i++) {\n indices.push(i);\n }\n\n if (msg.filter) {\n indices = indices.filter(i => matchesFilter(records[i], msg.filter!));\n }\n\n if (msg.sort) {\n sortIndices(records, indices, msg.sort.field, msg.sort.direction, msg.sort.fieldType);\n }\n\n (self as any).postMessage({ requestId: msg.requestId, indices } as Response);\n } catch (err: any) {\n (self as any).postMessage({ requestId: msg.requestId, error: String(err?.message ?? err) } as Response);\n }\n};\n"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"../DOM-67StIm5G.js";import{S as t,h as n}from"../Component-fRQvgaEY.js";import{t as r}from"../Glyph-wN7bk7mg.js";import{t as i}from"../Button-MZDYJOMC.js";import{n as a,r as o,t as s}from"../TabButton-DKECTTk1.js";import{t as c}from"../Menu-CrZy2u0g.js";import{t as l}from"../MenuButton-wy_0RskC.js";import{caret_down as u}from"../glyphs/solid/caret_down.es.js";r.register(u);var d=`caret-down`,f=16,SplitButton=class extends i{_chevron;_menu=null;_onChevronClick=()=>{this._toggleMenu()};constructor(e,n){super(e,n),this._menuItems??=[],this._chevron=new r(d),this._chevron.setPreferredSize({width:f,height:f}),this._chevron.setCursor(`pointer`),this._chevron.setPointerEvents(`auto`),this._chevron.setTransition(`transform 200ms ease`),this._content.addComponent(this._chevron),t.addSubtreeListener(this._chevron,`click`,this._onChevronClick)}destructor(){this._menu?.dispose(),super.destructor()}setMenuItems(e){return this._menuItems=e,this._options.menuItems=e,this}getMenuItems(){return this._menuItems}applyOptions(e){return super.applyOptions(e),e.menuItems!==void 0&&this.setMenuItems(e.menuItems),this}_afterRebuildContentRow(){this._chevron&&this._content.addComponent(this._chevron)}_toggleMenu(){if(!this.getElement())return;let t=e.source.getViewportRect(this);this._menu??=new c,this._setChevronOpen(!0),this._menu.toggleFor(this._chevron.getElement(!0),t,this._menuItems,()=>{this._setChevronOpen(!1)})}_setChevronOpen(e){this._chevron.setTransform(e?`rotate(180deg)`:`rotate(0deg)`)}},p=n(SplitButton);export{i as Button,l as MenuButton,p as SplitButton,s as TabButton,a as TabCloseButton,o as ToggleButton};
1
+ import{t as e}from"../DOM-C-Edb3tA.js";import{S as t,h as n}from"../Component-B0ShfPVi.js";import{t as r}from"../Glyph-_VeBacS2.js";import{t as i}from"../Button-MpMIYBYJ.js";import{n as a,t as o}from"../TabButton-DLoMQzky.js";import{t as s}from"../TabCloseButton-CY7BGitY.js";import{t as c}from"../Menu-Q0bpXXze.js";import{t as l}from"../MenuButton-DCXi0tsP.js";import{caret_down as u}from"../glyphs/solid/caret_down.es.js";r.register(u);var d=`caret-down`,f=16,SplitButton=class extends i{_chevron;_menu=null;_onChevronClick=()=>{this._toggleMenu()};constructor(e,n){super(e,n),this._menuItems??=[],this._chevron=new r(d),this._chevron.setPreferredSize({width:f,height:f}),this._chevron.setCursor(`pointer`),this._chevron.setPointerEvents(`auto`),this._chevron.setTransition(`transform 200ms ease`),this._content.addComponent(this._chevron),t.addSubtreeListener(this._chevron,`click`,this._onChevronClick)}destructor(){this._menu?.dispose(),super.destructor()}setMenuItems(e){return this._menuItems=e,this._options.menuItems=e,this}getMenuItems(){return this._menuItems}applyOptions(e){return super.applyOptions(e),e.menuItems!==void 0&&this.setMenuItems(e.menuItems),this}_afterRebuildContentRow(){this._chevron&&this._content.addComponent(this._chevron)}_toggleMenu(){if(!this.getElement())return;let t=e.source.getViewportRect(this);this._menu??=new c,this._setChevronOpen(!0),this._menu.toggleFor(this._chevron.getElement(!0),t,this._menuItems,()=>{this._setChevronOpen(!1)})}_setChevronOpen(e){this._chevron.setTransform(e?`rotate(180deg)`:`rotate(0deg)`)}},p=n(SplitButton),m=n(class PopupButton extends i{_boundTogglePopup=()=>{this.togglePopup()};_boundClosePopup=()=>{this.closePopup()};constructor(e,t,n){let r;typeof e==`string`?r=e:e!==void 0&&(t=e),super(r,t,n),this._resolvedPanel??=null,this.on(`action`,this._boundTogglePopup),this.getAria().setHasPopup(`dialog`),this.getAria().setExpanded(!1),Object.getPrototypeOf(this)===PopupButton.prototype&&this.applyListeners(t?.listeners)}destructor(){this._resolvedPanel?.dispose(),this._resolvedPanel=null,super.destructor()}setPanel(e){return this._resolvedPanel?.dispose(),this._resolvedPanel=null,this._options.panel=e,this}getPanel(){return this._options.panel??this._defaultOptions.panel??null}applyOptions(e){return super.applyOptions(e),e.panel!==void 0&&this.setPanel(e.panel),this}ensurePanel(){if(this._resolvedPanel)return this._resolvedPanel;let e=this.getPanel();if(!e)return null;let t=typeof e==`function`?e():e;return this._resolvedPanel=t,t.setCloseHandler(this._boundClosePopup),this.getAria().setControls(t.getId()),t}togglePopup(){let t=this.getElement();if(!t)return;let n=this.ensurePanel();n&&(n.toggleFor(t,e.source.getViewportRect(this)),this.getAria().setExpanded(n.isOpen()))}closePopup(){this._resolvedPanel?.hideAnimated(),this.getAria().setExpanded(!1)}});export{i as Button,l as MenuButton,m as PopupButton,p as SplitButton,o as TabButton,s as TabCloseButton,a as ToggleButton};
2
2
  //# sourceMappingURL=button.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.es.js","names":[],"sources":["../../../src/typescript/lib/component/button/SplitButton.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Event } from \"~/core/Event.js\";\nimport { Button, ButtonOptions } from \"~/component/button/Button.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport { Glyph } from \"~/component/display/Glyph.js\";\nimport { Menu } from \"~/overlay/Menu.js\";\nimport { MenuItemConfig } from \"~/component/container/MenuItem.js\";\nimport { callable } from \"~/core/Callable.js\";\nimport { caret_down } from \"~/glyphs/solid/caret_down.js\";\n\n// Register the trailing chevron eagerly at module load — same pattern as\n// `TabCloseButton` registering its `xmark` — so `new SplitButton()` always\n// resolves the chevron without the consumer pre-registering a glyph.\nGlyph.register(caret_down);\n\n/** Registry name of the trailing dropdown chevron glyph. */\nconst CHEVRON_GLYPH = \"caret-down\";\n\n/**\n * Square pixel size of the trailing chevron glyph. Pinned (not\n * line-height-tracked like the leading glyph) so the dropdown affordance stays\n * a constant, comfortably-clickable size across themes; 16px matches the\n * compact icon-button glyph size a flat toolbar uses.\n */\nconst CHEVRON_SIZE = 16;\n\n/**\n * Duration in milliseconds of the chevron's open/close spin. Matches the\n * framework's shared 200ms indicator transition (see `AccordionIndicator`) so\n * the caret animates at the same cadence as other dropdown / expand affordances.\n */\nconst CHEVRON_SPIN_MS = 200;\n\n/**\n * Construction-time options for {@link SplitButton}.\n *\n * @category Components\n */\nexport interface SplitButtonOptions extends ButtonOptions {\n /** Items shown in the dropdown opened by the trailing chevron. */\n menuItems?: MenuItemConfig[];\n}\n\n/**\n * A push button with a trailing dropdown chevron. The main button face fires\n * the primary `\"action\"` event exactly like [`Button`](/api/component/button/classes/Button);\n * clicking the chevron zone instead opens a rebuild-mode\n * [`Menu`](/api/overlay/classes/Menu) of [`MenuItemConfig`](/api/component/container/interfaces/MenuItemConfig)\n * rows anchored under the button.\n *\n * The chevron is a child [`Glyph`](/api/component/display/classes/Glyph) inside\n * Button's single `<button>` element (one DOM element per class is preserved):\n * it rides the content row beside the leading glyph and title. A subtree\n * listener on the chevron catches its click (which the SVG `<use>` retargets to\n * an id-less inner element), while the button face's exact-target `\"action\"`\n * only fires for a click on the `<button>` itself — distinguishing the dropdown\n * gesture from the primary action with no hit-testing coordinates.\n *\n * Dropping a `SplitButton` into a flat [`ToolBar`](/api/component/menubar/classes/ToolBar)\n * flattens it like any other `Button`; the chevron is part of the content row,\n * so it inherits the flat appearance with no extra wiring.\n *\n * @example\n * ```typescript\n * import { SplitButton } from '@jimka/typescript-ui/component/button';\n *\n * const save = new SplitButton('Save', {\n * menuItems: [\n * { text: 'Save As…', action: () => saveAs() },\n * { text: 'Save All', action: () => saveAll() },\n * ],\n * });\n * save.on('action', () => save());\n * toolbar.addComponent(save);\n * ```\n *\n * @category Components\n */\nclass SplitButton extends Button<SplitButtonOptions> {\n\n /**\n * The trailing dropdown chevron — a child of Button's `_content` row.\n * Clicks on it land on the id-less inner element the SVG `<use>` retargets\n * to, so they are caught with a *subtree* listener rather than an\n * exact-target one; that same retargeting is why a chevron click never\n * matches the button face's exact-target `\"action\"`, which is what\n * distinguishes the dropdown gesture from the primary action without\n * hit-testing.\n */\n private _chevron!: Glyph;\n\n /**\n * Lazily-created rebuild-mode dropdown, reused across opens. `null` until\n * the chevron is first clicked so a button whose dropdown is never opened\n * allocates no menu panel.\n */\n private _menu: Menu | null = null;\n\n /**\n * Cached dropdown items. `declare` rather than initialized: `setMenuItems`\n * can fire from the super-cascade via `applyOptions`, and an `= []`\n * initializer would run after `super()` returns and clobber the cascaded\n * value (the class-field super-cascade trap).\n */\n private declare _menuItems: MenuItemConfig[];\n\n /**\n * Bound chevron-click handler. Held on the instance so it is a stable\n * reference for the named-listener contract. Delegates to `_toggleMenu`,\n * which opens the dropdown or closes it if this chevron already opened it.\n */\n private readonly _onChevronClick: () => void = () => { this._toggleMenu(); };\n\n /**\n * Constructs a SplitButton.\n *\n * @param text - Optional button title.\n * @param options - Optional options bag, including `menuItems` for the dropdown.\n */\n constructor(text?: string, options?: SplitButtonOptions) {\n super(text, options);\n\n // Default the cache when neither the super-cascade nor a caller set it.\n this._menuItems ??= [];\n\n // Build the chevron after super() so the content row exists. It rides\n // the row like the leading glyph; appending it last places it after the\n // title in the single `<button>`. A *subtree* listener catches the click\n // the SVG `<use>` retargets to its id-less inner element — an\n // exact-target listener on the glyph would never match it — while that\n // same retargeting keeps the click off the button face's `\"action\"`.\n this._chevron = new Glyph(CHEVRON_GLYPH);\n this._chevron.setPreferredSize({ width: CHEVRON_SIZE, height: CHEVRON_SIZE });\n this._chevron.setCursor(\"pointer\");\n // Button sets its whole `_content` row to `pointer-events: none` so face\n // clicks fall through to the `<button>`; the chevron inherits that and\n // would never receive its own click. Re-enable it here — an outer\n // `<svg>` with `auto` is hittable across its full box (not just the\n // painted caret pixels) — so the chevron reliably catches the click.\n this._chevron.setPointerEvents(\"auto\");\n // Fixed transform transition; `_setChevronOpen` toggles the rotation so\n // the caret spins between its closed (down) and open (up) states.\n this._chevron.setTransition(\"transform \" + CHEVRON_SPIN_MS + \"ms ease\");\n\n this._content.addComponent(this._chevron);\n\n Event.addSubtreeListener(this._chevron, \"click\", this._onChevronClick);\n }\n\n /**\n * Disposes the lazily-created dropdown, then runs the inherited teardown.\n * `_menu` is a LayerManager-mounted panel, never a registered child (see\n * Menu.ts's class comment), so `super.destructor()`'s child recursion\n * cannot reach it.\n */\n protected destructor(): void {\n this._menu?.dispose();\n\n super.destructor();\n }\n\n /**\n * Replaces the dropdown items shown when the chevron is clicked.\n *\n * @param items - The new item configurations.\n *\n * @returns This button, for method chaining.\n */\n setMenuItems(items: MenuItemConfig[]): this {\n this._menuItems = items;\n this._options.menuItems = items;\n\n return this;\n }\n\n /**\n * Returns the current dropdown items.\n *\n * @returns The item configurations shown by the chevron dropdown.\n */\n getMenuItems(): MenuItemConfig[] {\n return this._menuItems;\n }\n\n /**\n * Applies a {@link SplitButtonOptions} bag, dispatching `menuItems` after\n * the inherited Button fields cascade.\n *\n * @param options - The options bag carrying the values to apply.\n *\n * @returns This button, for method chaining.\n */\n protected applyOptions(options: SplitButtonOptions): this {\n super.applyOptions(options);\n\n if (options.menuItems !== undefined) {\n this.setMenuItems(options.menuItems);\n }\n\n return this;\n }\n\n /**\n * Re-appends the trailing chevron after the inherited content-row rebuild.\n * Button's `_rebuildContentRow` empties `_content` wholesale (on a\n * `setGlyph` / `setDescription` / writing-mode change), which would detach\n * the chevron; re-appending it last keeps the dropdown affordance trailing\n * the title across those mutations.\n *\n * @remarks Guarded on `_chevron` because the rebuilds dispatched during the\n * super-cascade run before the constructor builds the chevron; those skip,\n * and the constructor appends it once afterwards.\n */\n protected override _afterRebuildContentRow(): void {\n if (this._chevron) {\n this._content.addComponent(this._chevron);\n }\n }\n\n /**\n * Toggles the rebuild-mode dropdown anchored under the button's bottom-left\n * corner: opens it, or closes it if this chevron already opened it. No-op\n * when there is no DOM element yet (the button is unattached) so an anchor\n * rect can always be read.\n */\n private _toggleMenu(): void {\n const el = this.getElement();\n if (!el) {\n return;\n }\n\n const rect = DOM.source.getViewportRect(this);\n\n this._menu ??= new Menu();\n\n // Optimistically spin the caret to its open state. `toggleFor` excludes\n // the chevron from the menu's outside-click dismissal and remembers it as\n // the opener, so a second chevron press closes the dropdown; on that\n // close the menu's onClose spins the caret back down, correcting this\n // optimistic spin-up when the press toggled shut rather than open.\n this._setChevronOpen(true);\n\n this._menu.toggleFor(\n this._chevron.getElement(true)!,\n rect,\n this._menuItems,\n () => { this._setChevronOpen(false); }\n );\n }\n\n /**\n * Rotates the chevron between its closed (caret-down) and open (caret-up)\n * states, animated by the transform transition set at construction.\n *\n * @param open - `true` to point the caret up (dropdown open), `false` down.\n */\n private _setChevronOpen(open: boolean): void {\n this._chevron.setTransform(open ? \"rotate(180deg)\" : \"rotate(0deg)\");\n }\n}\n\nconst SplitButtonCallable = callable(SplitButton);\ntype SplitButtonCallable = SplitButton;\nexport {\n SplitButton as _SplitButton,\n SplitButtonCallable as SplitButton\n};\n"],"mappings":"6XAcA,EAAM,SAAS,CAAU,EAGzB,IAAM,EAAgB,aAQhB,EAAe,GAsDf,YAAN,cAA0B,CAA2B,CAWjD,SAOA,MAA6B,KAe7B,oBAAqD,CAAE,KAAK,YAAY,CAAG,EAQ3E,YAAY,EAAe,EAA8B,CACrD,MAAM,EAAM,CAAO,EAGnB,KAAK,aAAe,CAAC,EAQrB,KAAK,SAAW,IAAI,EAAM,CAAa,EACvC,KAAK,SAAS,iBAAiB,CAAE,MAAO,EAAc,OAAQ,CAAa,CAAC,EAC5E,KAAK,SAAS,UAAU,SAAS,EAMjC,KAAK,SAAS,iBAAiB,MAAM,EAGrC,KAAK,SAAS,cAAc,sBAA0C,EAEtE,KAAK,SAAS,aAAa,KAAK,QAAQ,EAExC,EAAM,mBAAmB,KAAK,SAAU,QAAS,KAAK,eAAe,CACzE,CAQA,YAA6B,CACzB,KAAK,OAAO,QAAQ,EAEpB,MAAM,WAAW,CACrB,CASA,aAAa,EAA+B,CAIxC,MAHA,MAAK,WAAa,EAClB,KAAK,SAAS,UAAY,EAEnB,IACX,CAOA,cAAiC,CAC7B,OAAO,KAAK,UAChB,CAUA,aAAuB,EAAmC,CAOtD,OANA,MAAM,aAAa,CAAO,EAEtB,EAAQ,YAAc,IAAA,IACtB,KAAK,aAAa,EAAQ,SAAS,EAGhC,IACX,CAaA,yBAAmD,CAC3C,KAAK,UACL,KAAK,SAAS,aAAa,KAAK,QAAQ,CAEhD,CAQA,aAA4B,CAExB,GAAI,CADO,KAAK,WACX,EACD,OAGJ,IAAM,EAAO,EAAI,OAAO,gBAAgB,IAAI,EAE5C,KAAK,QAAU,IAAI,EAOnB,KAAK,gBAAgB,EAAI,EAEzB,KAAK,MAAM,UACP,KAAK,SAAS,WAAW,EAAI,EAC7B,EACA,KAAK,eACC,CAAE,KAAK,gBAAgB,EAAK,CAAG,CACzC,CACJ,CAQA,gBAAwB,EAAqB,CACzC,KAAK,SAAS,aAAa,EAAO,iBAAmB,cAAc,CACvE,CACJ,EAEM,EAAsB,EAAS,WAAW"}
1
+ {"version":3,"file":"button.es.js","names":[],"sources":["../../../src/typescript/lib/component/button/SplitButton.ts","../../../src/typescript/lib/component/button/PopupButton.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Event } from \"~/core/Event.js\";\nimport { Button, ButtonOptions } from \"~/component/button/Button.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport { Glyph } from \"~/component/display/Glyph.js\";\nimport { Menu } from \"~/overlay/Menu.js\";\nimport { MenuItemConfig } from \"~/component/container/MenuItem.js\";\nimport { callable } from \"~/core/Callable.js\";\nimport { caret_down } from \"~/glyphs/solid/caret_down.js\";\n\n// Register the trailing chevron eagerly at module load — same pattern as\n// `TabCloseButton` registering its `xmark` — so `new SplitButton()` always\n// resolves the chevron without the consumer pre-registering a glyph.\nGlyph.register(caret_down);\n\n/** Registry name of the trailing dropdown chevron glyph. */\nconst CHEVRON_GLYPH = \"caret-down\";\n\n/**\n * Square pixel size of the trailing chevron glyph. Pinned (not\n * line-height-tracked like the leading glyph) so the dropdown affordance stays\n * a constant, comfortably-clickable size across themes; 16px matches the\n * compact icon-button glyph size a flat toolbar uses.\n */\nconst CHEVRON_SIZE = 16;\n\n/**\n * Duration in milliseconds of the chevron's open/close spin. Matches the\n * framework's shared 200ms indicator transition (see `AccordionIndicator`) so\n * the caret animates at the same cadence as other dropdown / expand affordances.\n */\nconst CHEVRON_SPIN_MS = 200;\n\n/**\n * Construction-time options for {@link SplitButton}.\n *\n * @category Components\n */\nexport interface SplitButtonOptions extends ButtonOptions {\n /** Items shown in the dropdown opened by the trailing chevron. */\n menuItems?: MenuItemConfig[];\n}\n\n/**\n * A push button with a trailing dropdown chevron. The main button face fires\n * the primary `\"action\"` event exactly like [`Button`](/api/component/button/classes/Button);\n * clicking the chevron zone instead opens a rebuild-mode\n * [`Menu`](/api/overlay/classes/Menu) of [`MenuItemConfig`](/api/component/container/interfaces/MenuItemConfig)\n * rows anchored under the button.\n *\n * The chevron is a child [`Glyph`](/api/component/display/classes/Glyph) inside\n * Button's single `<button>` element (one DOM element per class is preserved):\n * it rides the content row beside the leading glyph and title. A subtree\n * listener on the chevron catches its click (which the SVG `<use>` retargets to\n * an id-less inner element), while the button face's exact-target `\"action\"`\n * only fires for a click on the `<button>` itself — distinguishing the dropdown\n * gesture from the primary action with no hit-testing coordinates.\n *\n * Dropping a `SplitButton` into a flat [`ToolBar`](/api/component/menubar/classes/ToolBar)\n * flattens it like any other `Button`; the chevron is part of the content row,\n * so it inherits the flat appearance with no extra wiring.\n *\n * @example\n * ```typescript\n * import { SplitButton } from '@jimka/typescript-ui/component/button';\n *\n * const save = new SplitButton('Save', {\n * menuItems: [\n * { text: 'Save As…', action: () => saveAs() },\n * { text: 'Save All', action: () => saveAll() },\n * ],\n * });\n * save.on('action', () => save());\n * toolbar.addComponent(save);\n * ```\n *\n * @category Components\n */\nclass SplitButton extends Button<SplitButtonOptions> {\n\n /**\n * The trailing dropdown chevron — a child of Button's `_content` row.\n * Clicks on it land on the id-less inner element the SVG `<use>` retargets\n * to, so they are caught with a *subtree* listener rather than an\n * exact-target one; that same retargeting is why a chevron click never\n * matches the button face's exact-target `\"action\"`, which is what\n * distinguishes the dropdown gesture from the primary action without\n * hit-testing.\n */\n private _chevron!: Glyph;\n\n /**\n * Lazily-created rebuild-mode dropdown, reused across opens. `null` until\n * the chevron is first clicked so a button whose dropdown is never opened\n * allocates no menu panel.\n */\n private _menu: Menu | null = null;\n\n /**\n * Cached dropdown items. `declare` rather than initialized: `setMenuItems`\n * can fire from the super-cascade via `applyOptions`, and an `= []`\n * initializer would run after `super()` returns and clobber the cascaded\n * value (the class-field super-cascade trap).\n */\n private declare _menuItems: MenuItemConfig[];\n\n /**\n * Bound chevron-click handler. Held on the instance so it is a stable\n * reference for the named-listener contract. Delegates to `_toggleMenu`,\n * which opens the dropdown or closes it if this chevron already opened it.\n */\n private readonly _onChevronClick: () => void = () => { this._toggleMenu(); };\n\n /**\n * Constructs a SplitButton.\n *\n * @param text - Optional button title.\n * @param options - Optional options bag, including `menuItems` for the dropdown.\n */\n constructor(text?: string, options?: SplitButtonOptions) {\n super(text, options);\n\n // Default the cache when neither the super-cascade nor a caller set it.\n this._menuItems ??= [];\n\n // Build the chevron after super() so the content row exists. It rides\n // the row like the leading glyph; appending it last places it after the\n // title in the single `<button>`. A *subtree* listener catches the click\n // the SVG `<use>` retargets to its id-less inner element — an\n // exact-target listener on the glyph would never match it — while that\n // same retargeting keeps the click off the button face's `\"action\"`.\n this._chevron = new Glyph(CHEVRON_GLYPH);\n this._chevron.setPreferredSize({ width: CHEVRON_SIZE, height: CHEVRON_SIZE });\n this._chevron.setCursor(\"pointer\");\n // Button sets its whole `_content` row to `pointer-events: none` so face\n // clicks fall through to the `<button>`; the chevron inherits that and\n // would never receive its own click. Re-enable it here — an outer\n // `<svg>` with `auto` is hittable across its full box (not just the\n // painted caret pixels) — so the chevron reliably catches the click.\n this._chevron.setPointerEvents(\"auto\");\n // Fixed transform transition; `_setChevronOpen` toggles the rotation so\n // the caret spins between its closed (down) and open (up) states.\n this._chevron.setTransition(\"transform \" + CHEVRON_SPIN_MS + \"ms ease\");\n\n this._content.addComponent(this._chevron);\n\n Event.addSubtreeListener(this._chevron, \"click\", this._onChevronClick);\n }\n\n /**\n * Disposes the lazily-created dropdown, then runs the inherited teardown.\n * `_menu` is a LayerManager-mounted panel, never a registered child (see\n * Menu.ts's class comment), so `super.destructor()`'s child recursion\n * cannot reach it.\n */\n protected destructor(): void {\n this._menu?.dispose();\n\n super.destructor();\n }\n\n /**\n * Replaces the dropdown items shown when the chevron is clicked.\n *\n * @param items - The new item configurations.\n *\n * @returns This button, for method chaining.\n */\n setMenuItems(items: MenuItemConfig[]): this {\n this._menuItems = items;\n this._options.menuItems = items;\n\n return this;\n }\n\n /**\n * Returns the current dropdown items.\n *\n * @returns The item configurations shown by the chevron dropdown.\n */\n getMenuItems(): MenuItemConfig[] {\n return this._menuItems;\n }\n\n /**\n * Applies a {@link SplitButtonOptions} bag, dispatching `menuItems` after\n * the inherited Button fields cascade.\n *\n * @param options - The options bag carrying the values to apply.\n *\n * @returns This button, for method chaining.\n */\n protected applyOptions(options: SplitButtonOptions): this {\n super.applyOptions(options);\n\n if (options.menuItems !== undefined) {\n this.setMenuItems(options.menuItems);\n }\n\n return this;\n }\n\n /**\n * Re-appends the trailing chevron after the inherited content-row rebuild.\n * Button's `_rebuildContentRow` empties `_content` wholesale (on a\n * `setGlyph` / `setDescription` / writing-mode change), which would detach\n * the chevron; re-appending it last keeps the dropdown affordance trailing\n * the title across those mutations.\n *\n * @remarks Guarded on `_chevron` because the rebuilds dispatched during the\n * super-cascade run before the constructor builds the chevron; those skip,\n * and the constructor appends it once afterwards.\n */\n protected override _afterRebuildContentRow(): void {\n if (this._chevron) {\n this._content.addComponent(this._chevron);\n }\n }\n\n /**\n * Toggles the rebuild-mode dropdown anchored under the button's bottom-left\n * corner: opens it, or closes it if this chevron already opened it. No-op\n * when there is no DOM element yet (the button is unattached) so an anchor\n * rect can always be read.\n */\n private _toggleMenu(): void {\n const el = this.getElement();\n if (!el) {\n return;\n }\n\n const rect = DOM.source.getViewportRect(this);\n\n this._menu ??= new Menu();\n\n // Optimistically spin the caret to its open state. `toggleFor` excludes\n // the chevron from the menu's outside-click dismissal and remembers it as\n // the opener, so a second chevron press closes the dropdown; on that\n // close the menu's onClose spins the caret back down, correcting this\n // optimistic spin-up when the press toggled shut rather than open.\n this._setChevronOpen(true);\n\n this._menu.toggleFor(\n this._chevron.getElement(true)!,\n rect,\n this._menuItems,\n () => { this._setChevronOpen(false); }\n );\n }\n\n /**\n * Rotates the chevron between its closed (caret-down) and open (caret-up)\n * states, animated by the transform transition set at construction.\n *\n * @param open - `true` to point the caret up (dropdown open), `false` down.\n */\n private _setChevronOpen(open: boolean): void {\n this._chevron.setTransform(open ? \"rotate(180deg)\" : \"rotate(0deg)\");\n }\n}\n\nconst SplitButtonCallable = callable(SplitButton);\ntype SplitButtonCallable = SplitButton;\nexport {\n SplitButton as _SplitButton,\n SplitButtonCallable as SplitButton\n};\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Button, ButtonOptions } from \"~/component/button/Button.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport { PopupPanel } from \"~/overlay/PopupPanel.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link PopupButton}.\n *\n * @category Components\n */\nexport interface PopupButtonOptions extends ButtonOptions {\n /** The popup to toggle: a built panel, or a factory called once on first open. */\n panel?: PopupPanel | (() => PopupPanel);\n}\n\n/**\n * A push button whose click toggles a {@link PopupPanel} anchored under its\n * bottom-left corner, mirroring [`MenuButton`](/api/component/button/classes/MenuButton)\n * with a `PopupPanel` in place of a `Menu`. The `panel` option accepts a\n * built panel or a factory invoked once on first open and reused across\n * opens — unlike a `Menu` provider, which rebuilds on every open, because a\n * panel is a live component with its own state.\n *\n * The button owns whichever panel it resolves: it installs itself as the\n * panel's close handler (so an outside dismissal returns `aria-expanded` to\n * `false`), and disposes the panel in its own destructor and whenever\n * {@link setPanel} replaces it. A panel shared between two buttons is\n * disposed by whichever button tears down first — the supported shape is one\n * panel per button.\n *\n * @example\n * ```typescript\n * import { PopupButton } from '@jimka/typescript-ui/component/button';\n * import { PopupPanel } from '@jimka/typescript-ui/overlay';\n * import { VBox } from '@jimka/typescript-ui/layout';\n * import { Checkbox } from '@jimka/typescript-ui/component/input';\n *\n * const filters = PopupButton('Filters', {\n * panel: () => PopupPanel({\n * layoutManager: VBox({ spacing: 4, stretching: true }),\n * components: [ Checkbox({ label: 'Show archived' }) ],\n * }),\n * });\n *\n * toolbar.addComponent(filters);\n * ```\n *\n * @category Components\n */\nclass PopupButton<TOptions extends PopupButtonOptions = PopupButtonOptions> extends Button<TOptions> {\n\n // `setPanel` is dispatched from `applyOptions` during the `super()`\n // cascade and writes this field — a plain initializer would run\n // afterwards and wipe it, so it is declared bare and seeded below.\n declare private _resolvedPanel: PopupPanel | null;\n\n private readonly _boundTogglePopup: () => void = () => { this.togglePopup(); };\n private readonly _boundClosePopup: () => void = () => { this.closePopup(); };\n\n /**\n * Constructs a PopupButton with an optional title and options bag (both\n * optional — an empty PopupButton renders as a chrome-shaped placeholder).\n *\n * @example\n * ```typescript\n * new PopupButton('Filters', { panel: () => new PopupPanel({ … }) });\n * PopupButton({ glyph: 'filter', panel: () => new PopupPanel({ … }) });\n * ```\n */\n constructor(text?: string, options?: TOptions, subclassDefaults?: Partial<TOptions>);\n constructor(options: TOptions);\n constructor(\n textOrOptions?: string | TOptions,\n options?: TOptions,\n subclassDefaults?: Partial<TOptions>,\n ) {\n // Normalise the overload: a non-string first argument is the options\n // bag. Copied from MenuButton.ts in shape.\n let text: string | undefined;\n\n if (typeof textOrOptions === \"string\") {\n text = textOrOptions;\n } else if (textOrOptions !== undefined) {\n options = textOrOptions;\n }\n\n super(text, options, subclassDefaults);\n\n this._resolvedPanel ??= null;\n\n this.on(\"action\", this._boundTogglePopup);\n this.getAria().setHasPopup(\"dialog\");\n this.getAria().setExpanded(false);\n\n // Button wires the listener bag only when it is the directly-\n // constructed class; mirror its instance-identity guard so a\n // PopupButton subclass wires its own bag once, from its own\n // constructor.\n if (Object.getPrototypeOf(this) === PopupButton.prototype) {\n this.applyListeners(options?.listeners);\n }\n }\n\n /**\n * Disposes the resolved panel, then runs the inherited teardown. The\n * panel is a `LayerManager`-mounted overlay, never a registered child\n * (see `Menu.ts`'s class comment for the same relationship), so\n * `super.destructor()`'s child recursion cannot reach it.\n */\n protected destructor(): void {\n this._resolvedPanel?.dispose();\n this._resolvedPanel = null;\n\n super.destructor();\n }\n\n /**\n * Replaces the configured popup — a built panel, or a factory invoked\n * once on first open. Disposes whichever panel was already resolved, so\n * the next open resolves the new configuration from scratch.\n *\n * @param panel - The new panel or panel factory.\n *\n * @returns This button, for method chaining.\n */\n setPanel(panel: PopupPanel | (() => PopupPanel)): this {\n this._resolvedPanel?.dispose();\n this._resolvedPanel = null;\n this._options.panel = panel;\n\n return this;\n }\n\n /**\n * Returns the configured panel or factory — the caller value, else the\n * class default, else `null` when neither is set.\n *\n * @returns The configured panel/factory, or `null`.\n */\n getPanel(): PopupPanel | (() => PopupPanel) | null {\n return this._options.panel ?? this._defaultOptions.panel ?? null;\n }\n\n /**\n * Applies a {@link PopupButtonOptions} bag, dispatching `panel` after the\n * inherited Button fields cascade.\n *\n * @param options - The options bag carrying the values to apply.\n *\n * @returns This button, for method chaining.\n */\n protected applyOptions(options: TOptions): this {\n super.applyOptions(options);\n\n if (options.panel !== undefined) {\n this.setPanel(options.panel);\n }\n\n return this;\n }\n\n /**\n * Resolves (and caches) the configured panel: the cached instance when\n * already resolved; otherwise invokes a configured factory exactly once\n * and caches its result, or uses a configured instance directly. Wires\n * this button as the panel's close handler and its id as the panel's\n * `aria-controls` target. Returns `null` when nothing is configured —\n * the caller stays a no-op beyond the `\"action\"` event.\n *\n * @returns The resolved panel, or `null` when none is configured.\n */\n protected ensurePanel(): PopupPanel | null {\n if (this._resolvedPanel) {\n return this._resolvedPanel;\n }\n\n const configured = this.getPanel();\n\n if (!configured) {\n return null;\n }\n\n const panel = typeof configured === \"function\" ? configured() : configured;\n\n this._resolvedPanel = panel;\n panel.setCloseHandler(this._boundClosePopup);\n this.getAria().setControls(panel.getId());\n\n return panel;\n }\n\n /**\n * Toggles the panel anchored under the button's bottom-left corner. A\n * no-op when the button is not yet attached (checked *before* resolving\n * the panel, so an unattached button constructs nothing — a factory is\n * not called) or when no panel is configured.\n */\n private togglePopup(): void {\n const el = this.getElement();\n\n if (!el) {\n return;\n }\n\n const panel = this.ensurePanel();\n\n if (!panel) {\n return;\n }\n\n panel.toggleFor(el, DOM.source.getViewportRect(this));\n this.getAria().setExpanded(panel.isOpen());\n }\n\n /**\n * The panel's close thunk, installed via {@link PopupPanel.setCloseHandler}\n * so an outside dismissal (or Escape) drives this button's own teardown\n * instead of only the panel's — `setCloseHandler` replaces the default\n * `hideAnimated`, it does not merely observe it.\n */\n private closePopup(): void {\n this._resolvedPanel?.hideAnimated();\n this.getAria().setExpanded(false);\n }\n}\n\nconst PopupButtonCallable = callable(PopupButton);\ntype PopupButtonCallable<TOptions extends PopupButtonOptions = PopupButtonOptions> = PopupButton<TOptions>;\nexport {\n PopupButton as _PopupButton,\n PopupButtonCallable as PopupButton,\n};\n"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"../DOM-67StIm5G.js";import{n as t}from"../Position-Ck_KD4cR.js";import{S as n,h as r,r as i,t as a}from"../Component-fRQvgaEY.js";import{t as o}from"../ListenerBag-WPdKuuds.js";import{t as s}from"../Panel-Rd9zkNXx.js";import{t as c}from"../Tooltip-Dro4DOZs.js";import{t as l}from"../Text-KB5LksJl.js";import{n as u,r as d}from"../VBox-P3WFGkPc.js";function constant_default$1(e){return function constant(){return e}}var f=Math.PI,p=2*f,m=1e-6,h=p-m;function append(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function appendRound(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return append;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var Path=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?append:appendRound(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>m)if(!(Math.abs(u*s-c*l)>m)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let p=n-a,h=r-o,g=s*s+c*c,_=p*p+h*h,v=Math.sqrt(g),b=Math.sqrt(d),S=i*Math.tan((f-Math.acos((g+d-_)/(2*v*b)))/2),C=S/b,w=S/v;Math.abs(C-1)>m&&this._append`L${e+C*l},${t+C*u}`,this._append`A${i},${i},0,0,${+(u*p>l*h)},${this._x1=e+w*s},${this._y1=t+w*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>m||Math.abs(this._y1-l)>m)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%p+p),d>h?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>m&&this._append`A${n},${n},0,${+(d>=f)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function path(){return new Path}path.prototype=Path.prototype;function withPath(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Path(t)}Array.prototype.slice;function array_default(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Linear(e){this._context=e}Linear.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function linear_default(e){return new Linear(e)}function x(e){return e[0]}function y(e){return e[1]}function line_default(e,t){var n=constant_default$1(!0),r=null,i=linear_default,a=null,o=withPath(line);e=typeof e==`function`?e:e===void 0?x:constant_default$1(e),t=typeof t==`function`?t:t===void 0?y:constant_default$1(t);function line(s){var c,l=(s=array_default(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return line.x=function(t){return arguments.length?(e=typeof t==`function`?t:constant_default$1(+t),line):e},line.y=function(e){return arguments.length?(t=typeof e==`function`?e:constant_default$1(+e),line):t},line.defined=function(e){return arguments.length?(n=typeof e==`function`?e:constant_default$1(!!e),line):n},line.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),line):i},line.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),line):r},line}function sign(e){return e<0?-1:1}function slope3(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(sign(a)+sign(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function slope2(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function point(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function MonotoneX(e){this._context=e}MonotoneX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:point(this,this._t0,slope2(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,point(this,slope2(this,n=slope3(this,e,t)),n);break;default:point(this,this._t0,n=slope3(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function MonotoneY(e){this._context=new ReflectContext(e)}(MonotoneY.prototype=Object.create(MonotoneX.prototype)).point=function(e,t){MonotoneX.prototype.point.call(this,t,e)};function ReflectContext(e){this._context=e}ReflectContext.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function monotoneX(e){return new MonotoneX(e)}function ascending(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function descending(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function bisector(e){let t,compare2,delta;e.length===2?(t=e===ascending||e===descending?e:zero$1,compare2=e,delta=e):(t=ascending,compare2=(t,n)=>ascending(e(t),n),delta=(t,n)=>e(t)-n);function left(e,n,r=0,i=e.length){if(r<i){if(t(n,n)!==0)return i;do{let t=r+i>>>1;compare2(e[t],n)<0?r=t+1:i=t}while(r<i)}return r}function right(e,n,r=0,i=e.length){if(r<i){if(t(n,n)!==0)return i;do{let t=r+i>>>1;compare2(e[t],n)<=0?r=t+1:i=t}while(r<i)}return r}function center(e,t,n=0,r=e.length){let i=left(e,t,n,r-1);return i>n&&delta(e[i-1],t)>-delta(e[i],t)?i-1:i}return{left,center,right}}function zero$1(){return 0}function number$2(e){return e===null?NaN:+e}var g=bisector(ascending),_=g.right;g.left,bisector(number$2).center;function extent(e,t){let n,r;if(t===void 0)for(let t of e)t!=null&&(n===void 0?t>=t&&(n=r=t):(n>t&&(n=t),r<t&&(r=t)));else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(n===void 0?a>=a&&(n=r=a):(n>a&&(n=a),r<a&&(r=a)))}return[n,r]}var InternMap=class extends Map{constructor(e,t=keyof){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(intern_get(this,e))}has(e){return super.has(intern_get(this,e))}set(e,t){return super.set(intern_set(this,e),t)}delete(e){return super.delete(intern_delete(this,e))}};function intern_get({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function intern_set({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function intern_delete({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function keyof(e){return typeof e==`object`&&e?e.valueOf():e}var v=Math.sqrt(50),b=Math.sqrt(10),S=Math.sqrt(2);function tickSpec(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=v?10:a>=b?5:a>=S?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?tickSpec(e,t,n*2):[s,c,l]}function ticks(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?tickSpec(t,e,n):tickSpec(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function tickIncrement(e,t,n){return t=+t,e=+e,n=+n,tickSpec(e,t,n)[2]}function tickStep(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?tickIncrement(t,e,n):tickIncrement(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function max(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function min(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function range(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function initRange(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var C=Symbol(`implicit`);function ordinal(){var e=new InternMap,t=[],n=[],r=C;function scale(i){let a=e.get(i);if(a===void 0){if(r!==C)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return scale.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new InternMap;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return scale},scale.range=function(e){return arguments.length?(n=Array.from(e),scale):n.slice()},scale.unknown=function(e){return arguments.length?(r=e,scale):r},scale.copy=function(){return ordinal(t,n).unknown(r)},initRange.apply(scale,arguments),scale}function band(){var e=ordinal().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function rescale(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=range(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),rescale()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,rescale()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,rescale()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,rescale()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),rescale()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),rescale()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,rescale()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),rescale()):u},e.copy=function(){return band(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},initRange.apply(rescale(),arguments)}function define_default(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function extend(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Color(){}var w=.7,T=1/w,E=`\\s*([+-]?\\d+)\\s*`,D=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,O=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,ee=/^#([0-9a-f]{3,8})$/,te=RegExp(`^rgb\\(${E},${E},${E}\\)$`),ne=RegExp(`^rgb\\(${O},${O},${O}\\)$`),re=RegExp(`^rgba\\(${E},${E},${E},${D}\\)$`),ie=RegExp(`^rgba\\(${O},${O},${O},${D}\\)$`),ae=RegExp(`^hsl\\(${D},${O},${O}\\)$`),oe=RegExp(`^hsla\\(${D},${O},${O},${D}\\)$`),se={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};define_default(Color,color,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:color_formatHex,formatHex:color_formatHex,formatHex8:color_formatHex8,formatHsl:color_formatHsl,formatRgb:color_formatRgb,toString:color_formatRgb});function color_formatHex(){return this.rgb().formatHex()}function color_formatHex8(){return this.rgb().formatHex8()}function color_formatHsl(){return hslConvert(this).formatHsl()}function color_formatRgb(){return this.rgb().formatRgb()}function color(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=ee.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?rgbn(t):n===3?new Rgb(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?rgba(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?rgba(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=te.exec(e))?new Rgb(t[1],t[2],t[3],1):(t=ne.exec(e))?new Rgb(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=re.exec(e))?rgba(t[1],t[2],t[3],t[4]):(t=ie.exec(e))?rgba(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ae.exec(e))?hsla(t[1],t[2]/100,t[3]/100,1):(t=oe.exec(e))?hsla(t[1],t[2]/100,t[3]/100,t[4]):se.hasOwnProperty(e)?rgbn(se[e]):e===`transparent`?new Rgb(NaN,NaN,NaN,0):null}function rgbn(e){return new Rgb(e>>16&255,e>>8&255,e&255,1)}function rgba(e,t,n,r){return r<=0&&(e=t=n=NaN),new Rgb(e,t,n,r)}function rgbConvert(e){return e instanceof Color||(e=color(e)),e?(e=e.rgb(),new Rgb(e.r,e.g,e.b,e.opacity)):new Rgb}function rgb(e,t,n,r){return arguments.length===1?rgbConvert(e):new Rgb(e,t,n,r??1)}function Rgb(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}define_default(Rgb,rgb,extend(Color,{brighter(e){return e=e==null?T:T**+e,new Rgb(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?w:w**+e,new Rgb(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Rgb(clampi(this.r),clampi(this.g),clampi(this.b),clampa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rgb_formatHex,formatHex:rgb_formatHex,formatHex8:rgb_formatHex8,formatRgb:rgb_formatRgb,toString:rgb_formatRgb}));function rgb_formatHex(){return`#${hex(this.r)}${hex(this.g)}${hex(this.b)}`}function rgb_formatHex8(){return`#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity)?1:this.opacity)*255)}`}function rgb_formatRgb(){let e=clampa(this.opacity);return`${e===1?`rgb(`:`rgba(`}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${e===1?`)`:`, ${e})`}`}function clampa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function clampi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function hex(e){return e=clampi(e),(e<16?`0`:``)+e.toString(16)}function hsla(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hsl(e,t,n,r)}function hslConvert(e){if(e instanceof Hsl)return new Hsl(e.h,e.s,e.l,e.opacity);if(e instanceof Color||(e=color(e)),!e)return new Hsl;if(e instanceof Hsl)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Hsl(o,s,c,e.opacity)}function hsl(e,t,n,r){return arguments.length===1?hslConvert(e):new Hsl(e,t,n,r??1)}function Hsl(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}define_default(Hsl,hsl,extend(Color,{brighter(e){return e=e==null?T:T**+e,new Hsl(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?w:w**+e,new Hsl(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Rgb(hsl2rgb(e>=240?e-240:e+120,i,r),hsl2rgb(e,i,r),hsl2rgb(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Hsl(clamph(this.h),clampt(this.s),clampt(this.l),clampa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=clampa(this.opacity);return`${e===1?`hsl(`:`hsla(`}${clamph(this.h)}, ${clampt(this.s)*100}%, ${clampt(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function clamph(e){return e=(e||0)%360,e<0?e+360:e}function clampt(e){return Math.max(0,Math.min(1,e||0))}function hsl2rgb(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var constant_default=e=>()=>e;function linear$1(e,t){return function(n){return e+n*t}}function exponential(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function gamma(e){return(e=+e)==1?nogamma:function(t,n){return n-t?exponential(t,n,e):constant_default(isNaN(t)?n:t)}}function nogamma(e,t){var n=t-e;return n?linear$1(e,n):constant_default(isNaN(e)?t:e)}var ce=(function rgbGamma(e){var t=gamma(e);function rgb$1(e,n){var r=t((e=rgb(e)).r,(n=rgb(n)).r),i=t(e.g,n.g),a=t(e.b,n.b),o=nogamma(e.opacity,n.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return rgb$1.gamma=rgbGamma,rgb$1})(1);function numberArray_default(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function isNumberArray(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function genericArray(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=value_default(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function date_default(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function number_default(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function object_default(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=value_default(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var le=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ue=new RegExp(le.source,`g`);function zero(e){return function(){return e}}function one(e){return function(t){return e(t)+``}}function string_default(e,t){var n=le.lastIndex=ue.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=le.exec(e))&&(i=ue.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:number_default(r,i)})),n=ue.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?one(c[0].x):zero(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function value_default(e,t){var n=typeof t,r;return t==null||n===`boolean`?constant_default(t):(n===`number`?number_default:n===`string`?(r=color(t))?(t=r,ce):string_default:t instanceof color?ce:t instanceof Date?date_default:isNumberArray(t)?numberArray_default:Array.isArray(t)?genericArray:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?object_default:number_default)(e,t)}function round_default(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function constants(e){return function(){return e}}function number$1(e){return+e}var de=[0,1];function identity(e){return e}function normalize(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:constants(isNaN(t)?NaN:.5)}function clamper(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function bimap(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=normalize(i,r),a=n(o,a)):(r=normalize(r,i),a=n(a,o)),function(e){return a(r(e))}}function polymap(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=normalize(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=_(e,t,1,r)-1;return a[n](i[n](t))}}function copy(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function transformer(){var e=de,t=de,n=value_default,r,i,a,o=identity,s,c,l;function rescale(){var n=Math.min(e.length,t.length);return o!==identity&&(o=clamper(e[0],e[n-1])),s=n>2?polymap:bimap,c=l=null,scale}function scale(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return scale.invert=function(n){return o(i((l||=s(t,e.map(r),number_default))(n)))},scale.domain=function(t){return arguments.length?(e=Array.from(t,number$1),rescale()):e.slice()},scale.range=function(e){return arguments.length?(t=Array.from(e),rescale()):t.slice()},scale.rangeRound=function(e){return t=Array.from(e),n=round_default,rescale()},scale.clamp=function(e){return arguments.length?(o=e?!0:identity,rescale()):o!==identity},scale.interpolate=function(e){return arguments.length?(n=e,rescale()):n},scale.unknown=function(e){return arguments.length?(a=e,scale):a},function(e,t){return r=e,i=t,rescale()}}function continuous(){return transformer()(identity,identity)}function formatDecimal_default(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function formatDecimalParts(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function exponent_default(e){return e=formatDecimalParts(Math.abs(e)),e?e[1]:NaN}function formatGroup_default(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function formatNumerals_default(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var fe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(e){if(!(t=fe.exec(e)))throw Error(`invalid format: `+e);var t;return new FormatSpecifier({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}formatSpecifier.prototype=FormatSpecifier.prototype;function FormatSpecifier(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function formatTrim_default(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var k;function formatPrefixAuto_default(e,t){var n=formatDecimalParts(e,t);if(!n)return k=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(k=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+formatDecimalParts(e,Math.max(0,t+a-1))[0]}function formatRounded_default(e,t){var n=formatDecimalParts(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var pe={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:formatDecimal_default,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>formatRounded_default(e*100,t),r:formatRounded_default,s:formatPrefixAuto_default,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function identity_default(e){return e}var me=Array.prototype.map,he=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function locale_default(e){var t=e.grouping===void 0||e.thousands===void 0?identity_default:formatGroup_default(me.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?identity_default:formatNumerals_default(me.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function newFormat(e,l){e=formatSpecifier(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,b=e.type;b===`n`?(g=!0,b=`g`):pe[b]||(_===void 0&&(_=12),v=!0,b=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var S=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(b)?`0`+b.toLowerCase():``),C=(p===`$`?r:/[%p]/.test(b)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),w=pe[b],T=/[defgprs%]/.test(b);_=_===void 0?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function format(e){var n=S,r=C,o,l,p;if(b===`c`)r=w(e)+r,e=``;else{e=+e;var E=e<0||1/e<0;if(e=isNaN(e)?c:w(Math.abs(e),_),v&&(e=formatTrim_default(e)),E&&+e==0&&f!==`+`&&(E=!1),n=(E?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(b===`s`&&!isNaN(e)&&k!==void 0?he[8+k/3]:``)+r+(E&&f===`(`?`)`:``),T){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var D=n.length+e.length+r.length,O=D<h?Array(h-D+1).join(u):``;switch(g&&m&&(e=t(O+e,O.length?h-r.length:1/0),O=``),d){case`<`:e=n+e+r+O;break;case`=`:e=n+O+e+r;break;case`^`:e=O.slice(0,D=O.length>>1)+n+e+r+O.slice(D);break;default:e=O+n+e+r;break}return a(e)}return format.toString=function(){return e+``},format}function formatPrefix(e,t){var n=Math.max(-8,Math.min(8,Math.floor(exponent_default(t)/3)))*3,r=10**-n,i=newFormat((e=formatSpecifier(e),e.type=`f`,e),{suffix:he[8+n/3]});return function(e){return i(r*e)}}return{format:newFormat,formatPrefix}}var A,ge,_e;defaultLocale$1({thousands:`,`,grouping:[3],currency:[`$`,``]});function defaultLocale$1(e){return A=locale_default(e),ge=A.format,_e=A.formatPrefix,A}function precisionFixed_default(e){return Math.max(0,-exponent_default(Math.abs(e)))}function precisionPrefix_default(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(exponent_default(t)/3)))*3-exponent_default(Math.abs(e)))}function precisionRound_default(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,exponent_default(t)-exponent_default(e))+1}function tickFormat(e,t,n,r){var i=tickStep(e,t,n),a;switch(r=formatSpecifier(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=precisionPrefix_default(i,o))&&(r.precision=a),_e(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=precisionRound_default(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=precisionFixed_default(i))&&(r.precision=a-(r.type===`%`)*2);break}return ge(r)}function linearish(e){var t=e.domain;return e.ticks=function(e){var n=t();return ticks(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return tickFormat(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-->0;){if(l=tickIncrement(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function linear(){var e=continuous();return e.copy=function(){return copy(e,linear())},initRange.apply(e,arguments),linearish(e)}function nice(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a<i&&(o=n,n=r,r=o,o=i,i=a,a=o),e[n]=t.floor(i),e[r]=t.ceil(a),e}var ve=new Date,ye=new Date;function timeInterval(e,t,n,r){function interval(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return interval.floor=t=>(e(t=new Date(+t)),t),interval.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),interval.round=e=>{let t=interval(e),n=interval.ceil(e);return e-t<n-e?t:n},interval.offset=(e,n)=>(t(e=new Date(+e),n==null?1:Math.floor(n)),e),interval.range=(n,r,i)=>{let a=[];if(n=interval.ceil(n),i=i==null?1:Math.floor(i),!(n<r)||!(i>0))return a;let o;do a.push(o=new Date(+n)),t(n,i),e(n);while(o<n&&n<r);return a},interval.filter=n=>timeInterval(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(interval.count=(t,r)=>(ve.setTime(+t),ye.setTime(+r),e(ve),e(ye),Math.floor(n(ve,ye))),interval.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?interval.filter(r?t=>r(t)%e===0:t=>interval.count(0,t)%e===0):interval)),interval}var j=timeInterval(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);j.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?timeInterval(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):j),j.range;var M=1e3,N=M*60,P=N*60,F=P*24,I=F*7,be=F*30,L=F*365,R=timeInterval(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*M)},(e,t)=>(t-e)/M,e=>e.getUTCSeconds());R.range;var xe=timeInterval(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*M)},(e,t)=>{e.setTime(+e+t*N)},(e,t)=>(t-e)/N,e=>e.getMinutes());xe.range;var Se=timeInterval(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*N)},(e,t)=>(t-e)/N,e=>e.getUTCMinutes());Se.range;var Ce=timeInterval(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*M-e.getMinutes()*N)},(e,t)=>{e.setTime(+e+t*P)},(e,t)=>(t-e)/P,e=>e.getHours());Ce.range;var we=timeInterval(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*P)},(e,t)=>(t-e)/P,e=>e.getUTCHours());we.range;var z=timeInterval(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*N)/F,e=>e.getDate()-1);z.range;var Te=timeInterval(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/F,e=>e.getUTCDate()-1);Te.range;var Ee=timeInterval(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/F,e=>Math.floor(e/F));Ee.range;function timeWeekday(e){return timeInterval(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*N)/I)}var B=timeWeekday(0),V=timeWeekday(1),De=timeWeekday(2),Oe=timeWeekday(3),H=timeWeekday(4),ke=timeWeekday(5),Ae=timeWeekday(6);B.range,V.range,De.range,Oe.range,H.range,ke.range,Ae.range;function utcWeekday(e){return timeInterval(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/I)}var je=utcWeekday(0),U=utcWeekday(1),Me=utcWeekday(2),Ne=utcWeekday(3),W=utcWeekday(4),Pe=utcWeekday(5),Fe=utcWeekday(6);je.range,U.range,Me.range,Ne.range,W.range,Pe.range,Fe.range;var Ie=timeInterval(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Ie.range;var Le=timeInterval(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Le.range;var G=timeInterval(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());G.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:timeInterval(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),G.range;var K=timeInterval(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());K.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:timeInterval(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),K.range;function ticker(e,t,n,r,i,a){let o=[[R,1,M],[R,5,5*M],[R,15,15*M],[R,30,30*M],[a,1,N],[a,5,5*N],[a,15,15*N],[a,30,30*N],[i,1,P],[i,3,3*P],[i,6,6*P],[i,12,12*P],[r,1,F],[r,2,2*F],[n,1,I],[t,1,be],[t,3,3*be],[e,1,L]];function ticks(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&typeof n.range==`function`?n:tickInterval(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a}function tickInterval(t,n,r){let i=Math.abs(n-t)/r,a=bisector(([,,e])=>e).right(o,i);if(a===o.length)return e.every(tickStep(t/L,n/L,r));if(a===0)return j.every(Math.max(tickStep(t,n,r),1));let[s,c]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(c)}return[ticks,tickInterval]}var[Re,ze]=ticker(K,Le,je,Ee,we,Se),[Be,Ve]=ticker(G,Ie,B,z,Ce,xe);function localDate(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function utcDate(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function newDate(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function formatLocale(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=formatRe(i),u=formatLookup(i),d=formatRe(a),f=formatLookup(a),p=formatRe(o),m=formatLookup(o),h=formatRe(s),g=formatLookup(s),_=formatRe(c),v=formatLookup(c),b={a:formatShortWeekday,A:formatWeekday,b:formatShortMonth,B:formatMonth,c:null,d:formatDayOfMonth,e:formatDayOfMonth,f:formatMicroseconds,g:formatYearISO,G:formatFullYearISO,H:formatHour24,I:formatHour12,j:formatDayOfYear,L:formatMilliseconds,m:formatMonthNumber,M:formatMinutes,p:formatPeriod,q:formatQuarter,Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatSeconds,u:formatWeekdayNumberMonday,U:formatWeekNumberSunday,V:formatWeekNumberISO,w:formatWeekdayNumberSunday,W:formatWeekNumberMonday,x:null,X:null,y:formatYear,Y:formatFullYear,Z:formatZone,"%":formatLiteralPercent},S={a:formatUTCShortWeekday,A:formatUTCWeekday,b:formatUTCShortMonth,B:formatUTCMonth,c:null,d:formatUTCDayOfMonth,e:formatUTCDayOfMonth,f:formatUTCMicroseconds,g:formatUTCYearISO,G:formatUTCFullYearISO,H:formatUTCHour24,I:formatUTCHour12,j:formatUTCDayOfYear,L:formatUTCMilliseconds,m:formatUTCMonthNumber,M:formatUTCMinutes,p:formatUTCPeriod,q:formatUTCQuarter,Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatUTCSeconds,u:formatUTCWeekdayNumberMonday,U:formatUTCWeekNumberSunday,V:formatUTCWeekNumberISO,w:formatUTCWeekdayNumberSunday,W:formatUTCWeekNumberMonday,x:null,X:null,y:formatUTCYear,Y:formatUTCFullYear,Z:formatUTCZone,"%":formatLiteralPercent},C={a:parseShortWeekday,A:parseWeekday,b:parseShortMonth,B:parseMonth,c:parseLocaleDateTime,d:parseDayOfMonth,e:parseDayOfMonth,f:parseMicroseconds,g:parseYear,G:parseFullYear,H:parseHour24,I:parseHour24,j:parseDayOfYear,L:parseMilliseconds,m:parseMonthNumber,M:parseMinutes,p:parsePeriod,q:parseQuarter,Q:parseUnixTimestamp,s:parseUnixTimestampSeconds,S:parseSeconds,u:parseWeekdayNumberMonday,U:parseWeekNumberSunday,V:parseWeekNumberISO,w:parseWeekdayNumberSunday,W:parseWeekNumberMonday,x:parseLocaleDate,X:parseLocaleTime,y:parseYear,Y:parseFullYear,Z:parseZone,"%":parseLiteralPercent};b.x=newFormat(n,b),b.X=newFormat(r,b),b.c=newFormat(t,b),S.x=newFormat(n,S),S.X=newFormat(r,S),S.c=newFormat(t,S);function newFormat(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i<o;)e.charCodeAt(i)===37&&(r.push(e.slice(a,i)),(c=He[s=e.charAt(++i)])==null?c=s===`e`?` `:`0`:s=e.charAt(++i),(l=t[s])&&(s=l(n,c)),r.push(s),a=i+1);return r.push(e.slice(a,i)),r.join(``)}}function newParse(e,t){return function(n){var r=newDate(1900,void 0,1),i=parseSpecifier(r,e,n+=``,0),a,o;if(i!=n.length)return null;if(`Q`in r)return new Date(r.Q);if(`s`in r)return new Date(r.s*1e3+(`L`in r?r.L:0));if(t&&!(`Z`in r)&&(r.Z=0),`p`in r&&(r.H=r.H%12+r.p*12),r.m===void 0&&(r.m=`q`in r?r.q:0),`V`in r){if(r.V<1||r.V>53)return null;`w`in r||(r.w=1),`Z`in r?(a=utcDate(newDate(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?U.ceil(a):U(a),a=Te.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=localDate(newDate(r.y,0,1)),o=a.getDay(),a=o>4||o===0?V.ceil(a):V(a),a=z.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?utcDate(newDate(r.y,0,1)).getUTCDay():localDate(newDate(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,utcDate(r)):localDate(r)}}function parseSpecifier(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=C[s in He?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function parsePeriod(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function parseShortWeekday(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function parseWeekday(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function parseShortMonth(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function parseMonth(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function parseLocaleDateTime(e,n,r){return parseSpecifier(e,t,n,r)}function parseLocaleDate(e,t,r){return parseSpecifier(e,n,t,r)}function parseLocaleTime(e,t,n){return parseSpecifier(e,r,t,n)}function formatShortWeekday(e){return o[e.getDay()]}function formatWeekday(e){return a[e.getDay()]}function formatShortMonth(e){return c[e.getMonth()]}function formatMonth(e){return s[e.getMonth()]}function formatPeriod(e){return i[+(e.getHours()>=12)]}function formatQuarter(e){return 1+~~(e.getMonth()/3)}function formatUTCShortWeekday(e){return o[e.getUTCDay()]}function formatUTCWeekday(e){return a[e.getUTCDay()]}function formatUTCShortMonth(e){return c[e.getUTCMonth()]}function formatUTCMonth(e){return s[e.getUTCMonth()]}function formatUTCPeriod(e){return i[+(e.getUTCHours()>=12)]}function formatUTCQuarter(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=newFormat(e+=``,b);return t.toString=function(){return e},t},parse:function(e){var t=newParse(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=newFormat(e+=``,S);return t.toString=function(){return e},t},utcParse:function(e){var t=newParse(e+=``,!0);return t.toString=function(){return e},t}}}var He={"-":``,_:` `,0:`0`},q=/^\s*\d+/,Ue=/^%/,We=/[\\^$*+?|[\]().{}]/g;function pad(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function requote(e){return e.replace(We,`\\$&`)}function formatRe(e){return RegExp(`^(?:`+e.map(requote).join(`|`)+`)`,`i`)}function formatLookup(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function parseWeekdayNumberSunday(e,t,n){var r=q.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function parseWeekdayNumberMonday(e,t,n){var r=q.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function parseWeekNumberSunday(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function parseWeekNumberISO(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function parseWeekNumberMonday(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function parseFullYear(e,t,n){var r=q.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function parseYear(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function parseZone(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function parseQuarter(e,t,n){var r=q.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function parseMonthNumber(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function parseDayOfMonth(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function parseDayOfYear(e,t,n){var r=q.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function parseHour24(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function parseMinutes(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function parseSeconds(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function parseMilliseconds(e,t,n){var r=q.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function parseMicroseconds(e,t,n){var r=q.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function parseLiteralPercent(e,t,n){var r=Ue.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function parseUnixTimestamp(e,t,n){var r=q.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function parseUnixTimestampSeconds(e,t,n){var r=q.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function formatDayOfMonth(e,t){return pad(e.getDate(),t,2)}function formatHour24(e,t){return pad(e.getHours(),t,2)}function formatHour12(e,t){return pad(e.getHours()%12||12,t,2)}function formatDayOfYear(e,t){return pad(1+z.count(G(e),e),t,3)}function formatMilliseconds(e,t){return pad(e.getMilliseconds(),t,3)}function formatMicroseconds(e,t){return formatMilliseconds(e,t)+`000`}function formatMonthNumber(e,t){return pad(e.getMonth()+1,t,2)}function formatMinutes(e,t){return pad(e.getMinutes(),t,2)}function formatSeconds(e,t){return pad(e.getSeconds(),t,2)}function formatWeekdayNumberMonday(e){var t=e.getDay();return t===0?7:t}function formatWeekNumberSunday(e,t){return pad(B.count(G(e)-1,e),t,2)}function dISO(e){var t=e.getDay();return t>=4||t===0?H(e):H.ceil(e)}function formatWeekNumberISO(e,t){return e=dISO(e),pad(H.count(G(e),e)+(G(e).getDay()===4),t,2)}function formatWeekdayNumberSunday(e){return e.getDay()}function formatWeekNumberMonday(e,t){return pad(V.count(G(e)-1,e),t,2)}function formatYear(e,t){return pad(e.getFullYear()%100,t,2)}function formatYearISO(e,t){return e=dISO(e),pad(e.getFullYear()%100,t,2)}function formatFullYear(e,t){return pad(e.getFullYear()%1e4,t,4)}function formatFullYearISO(e,t){var n=e.getDay();return e=n>=4||n===0?H(e):H.ceil(e),pad(e.getFullYear()%1e4,t,4)}function formatZone(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+pad(t/60|0,`0`,2)+pad(t%60,`0`,2)}function formatUTCDayOfMonth(e,t){return pad(e.getUTCDate(),t,2)}function formatUTCHour24(e,t){return pad(e.getUTCHours(),t,2)}function formatUTCHour12(e,t){return pad(e.getUTCHours()%12||12,t,2)}function formatUTCDayOfYear(e,t){return pad(1+Te.count(K(e),e),t,3)}function formatUTCMilliseconds(e,t){return pad(e.getUTCMilliseconds(),t,3)}function formatUTCMicroseconds(e,t){return formatUTCMilliseconds(e,t)+`000`}function formatUTCMonthNumber(e,t){return pad(e.getUTCMonth()+1,t,2)}function formatUTCMinutes(e,t){return pad(e.getUTCMinutes(),t,2)}function formatUTCSeconds(e,t){return pad(e.getUTCSeconds(),t,2)}function formatUTCWeekdayNumberMonday(e){var t=e.getUTCDay();return t===0?7:t}function formatUTCWeekNumberSunday(e,t){return pad(je.count(K(e)-1,e),t,2)}function UTCdISO(e){var t=e.getUTCDay();return t>=4||t===0?W(e):W.ceil(e)}function formatUTCWeekNumberISO(e,t){return e=UTCdISO(e),pad(W.count(K(e),e)+(K(e).getUTCDay()===4),t,2)}function formatUTCWeekdayNumberSunday(e){return e.getUTCDay()}function formatUTCWeekNumberMonday(e,t){return pad(U.count(K(e)-1,e),t,2)}function formatUTCYear(e,t){return pad(e.getUTCFullYear()%100,t,2)}function formatUTCYearISO(e,t){return e=UTCdISO(e),pad(e.getUTCFullYear()%100,t,2)}function formatUTCFullYear(e,t){return pad(e.getUTCFullYear()%1e4,t,4)}function formatUTCFullYearISO(e,t){var n=e.getUTCDay();return e=n>=4||n===0?W(e):W.ceil(e),pad(e.getUTCFullYear()%1e4,t,4)}function formatUTCZone(){return`+0000`}function formatLiteralPercent(){return`%`}function formatUnixTimestamp(e){return+e}function formatUnixTimestampSeconds(e){return Math.floor(e/1e3)}var J,Ge;defaultLocale({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function defaultLocale(e){return J=formatLocale(e),Ge=J.format,J.parse,J.utcFormat,J.utcParse,J}function date(e){return new Date(e)}function number(e){return e instanceof Date?+e:+new Date(+e)}function calendar(e,t,n,r,i,a,o,s,c,l){var u=continuous(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),b=l(`%B`),S=l(`%Y`);function tickFormat(e){return(c(e)<e?p:s(e)<e?m:o(e)<e?h:a(e)<e?g:r(e)<e?i(e)<e?_:v:n(e)<e?b:S)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?f(Array.from(e,number)):f().map(date)},u.ticks=function(t){var n=f();return e(n[0],n[n.length-1],t??10)},u.tickFormat=function(e,t){return t==null?tickFormat:l(t)},u.nice=function(e){var n=f();return(!e||typeof e.range!=`function`)&&(e=t(n[0],n[n.length-1],e??10)),e?f(nice(n,e)):u},u.copy=function(){return copy(u,calendar(e,t,n,r,i,a,o,s,c,l))},u}function time(){return initRange.apply(calendar(Be,Ve,G,Ie,B,z,Ce,xe,R,Ge).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}var Ke=.1;function linearScale(e,t){return linear().domain(e).range(t).nice()}function timeScale(e,t){return time().domain(e).range(t).nice()}function bandScale(e,t,n=Ke){return band().domain(e).range(t).paddingInner(n).paddingOuter(n/2)}function isBandScale(e){return typeof e.bandwidth==`function`}function scaleTicks(e,t){return isBandScale(e)?e.domain():e.ticks(t)}function tickPosition(e,t){return isBandScale(e)?(e(t)??0)+e.bandwidth()/2:e(t)}function tickFormatter(e,t){if(isBandScale(e))return e=>String(e);let n=e.tickFormat(t);return e=>n(e)}function pointsXExtent(e){let t=extent(e,e=>e.x);return[t[0]??0,t[1]??1]}function pointsYBounds(e,t=!0){if(e.length===0)return[0,1];let n=min(e,e=>e.y)??0,r=max(e,e=>e.y)??1,i=t?Math.min(0,n):n;return[i,r>i?r:i+1]}var Y=6,qe=4;function measureAxisMargin(t,n,r,i){let a=scaleTicks(n,i);if(t===`left`){let t=0;for(let n of a)t=Math.max(t,e.source.measureText(r(n)).width);return 10+Math.ceil(t)}let o=e.source.measureText(`0`).height;return 10+Math.ceil(o)}function drawAxis(e,t,n,r,i){let a={stroke:`var(--ts-ui-chart-axis)`,"stroke-width":`var(--ts-ui-chart-axis-width)`},o={stroke:`var(--ts-ui-chart-grid)`,"stroke-width":`var(--ts-ui-chart-axis-width)`},s={fill:`var(--ts-ui-chart-label)`},c=r.y+r.height,l=r.x+r.width;t===`left`?e(`line`,{setAttr:{x1:String(r.x),y1:String(r.y),x2:String(r.x),y2:String(c)},style:a}):e(`line`,{setAttr:{x1:String(r.x),y1:String(c),x2:String(l),y2:String(c)},style:a});for(let u of scaleTicks(n,i.tickCount)){let d=tickPosition(n,u),f=i.format(u);t===`left`?drawLeftTick(e,r,l,d,f,i.grid,o,a,s):drawBottomTick(e,r,c,d,f,i.grid,o,a,s)}}function drawLeftTick(e,t,n,r,i,a,o,s,c){a&&e(`line`,{setAttr:{x1:String(t.x),y1:String(r),x2:String(n),y2:String(r)},style:o}),e(`line`,{setAttr:{x1:String(t.x-Y),y1:String(r),x2:String(t.x),y2:String(r)},style:s}),e(`text`,{setAttr:{x:String(t.x-Y-qe),y:String(r),"text-anchor":`end`,"dominant-baseline":`middle`},style:c,text:i})}function drawBottomTick(e,t,n,r,i,a,o,s,c){a&&e(`line`,{setAttr:{x1:String(r),y1:String(t.y),x2:String(r),y2:String(n)},style:o}),e(`line`,{setAttr:{x1:String(r),y1:String(n),x2:String(r),y2:String(n+Y)},style:s}),e(`text`,{setAttr:{x:String(r),y:String(n+Y+qe),"text-anchor":`middle`,"dominant-baseline":`hanging`},style:c,text:i})}var X=12,Je=.4,ChartLegend=class extends s{_listeners=new o;_rows=[];_entries=[];_orientation=`vertical`;constructor(e){super(e),this.setBackgroundColor(`transparent`),this.clearInsets(),this.applyOrientationLayout(),this.dispatchLegendOptions(e),n.addSubtreeListener(this,`click`,this.handleRowClick)}dispatchLegendOptions(e){e&&(e.orientation!==void 0&&this.setOrientation(e.orientation),e.entries!==void 0&&this.setEntries(e.entries),this.applyListeners(e.listeners))}setOrientation(e){return this._orientation===e?this:(this._orientation=e,this.applyOrientationLayout(),this)}getOrientation(){return this._orientation}applyOrientationLayout(){this.setLayoutManager(this._orientation===`vertical`?new u({spacing:2,stretching:!1}):new d({spacing:10,stretching:!1}))}setEntries(e){if(this.entriesEqual(e))return this;this._entries=e.map(e=>({...e})),this.disposeAllComponents(),this._rows=[];for(let e of this._entries){let t=this.buildRow(e);this._rows.push(t),this.addComponent(t)}return this}getEntries(){return this._entries.map(e=>({...e}))}entriesEqual(e){if(e.length!==this._entries.length)return!1;for(let t=0;t<e.length;t++){let n=e[t],r=this._entries[t];if(n.name!==r.name||n.color!==r.color||(n.hidden??!1)!==(r.hidden??!1))return!1}return!0}buildRow(e){let n=new a({preferredSize:{width:X,height:X},minSize:{width:X,height:X},maxSize:{width:X,height:X},backgroundColor:e.color,borderRadius:`2px`}),r=new l(e.name);return new s({layoutManager:new d({spacing:6,stretching:!0}),insets:new t(2,4,2,4),cursor:`pointer`,opacity:e.hidden?Je:1,components:[n,r]})}handleRowClick=t=>{if(!e.source.isNode(t.target))return;let n=e.source.intern(t.target);for(let t=0;t<this._rows.length;t++){let r=this._rows[t].getElement();if(r&&e.source.contains(r,n)){this.emit(`toggle`,t);return}}};on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,t){this._listeners.fire(e,t)}},Ye=r(ChartLegend),Xe=`http://www.w3.org/2000/svg`,Ze=[`load`,`add`,`remove`,`datachange`],Qe=8,$e=10,et=12,Z=8,Q=18,tt=6,AbstractChart=class extends s{_listeners=new o;_series=[];_selectedPoint=null;_boundStore=null;_xField=`x`;_yField=`y`;_seriesField=void 0;_onStoreRefresh=()=>this.rebuildFromStore();_legend=new Ye;_themeCleanup=null;_svg=null;_axisGroup=null;_seriesGroup=null;_overlayGroup=null;_marks=[];_plot=null;_xScale=null;_yScale=null;constructor(e,t){super(e,t),this.setPreferredSize({width:400,height:300}),this.setMinSize({width:80,height:60}),this.addComponent(this._legend),this._legend.on(`toggle`,this.handleLegendToggle),n.addSubtreeListener(this,`mousemove`,this.handlePointerMove),n.addSubtreeListener(this,`mouseout`,this.handlePointerOut),n.addSubtreeListener(this,`click`,this.handlePointerClick),this._themeCleanup=i.onThemeChange(()=>this.scheduleLayout()),this.dispatchChartOptions(e)}dispatchChartOptions(e){e&&(e.store===void 0?e.series!==void 0&&this.setSeries(e.series):this.setStore(e.store,e.xField??`x`,e.yField??`y`,e.seriesField),e.showLegend!==void 0&&this.setShowLegend(e.showLegend),e.legendPosition!==void 0&&this.setLegendPosition(e.legendPosition),e.xAxisLabel!==void 0&&this.setXAxisLabel(e.xAxisLabel),e.yAxisLabel!==void 0&&this.setYAxisLabel(e.yAxisLabel),this.applyListeners(e.listeners))}setSeries(e){return this._series=this.resolveModel(e),this.scheduleLayout(),this}getSeries(){return this._series.map(e=>({name:e.name,data:e.points.map(e=>({x:e.x,y:e.y})),color:e.color}))}setStore(e,t,n,r){if(this._boundStore)for(let e of Ze)this._boundStore.off(e,this._onStoreRefresh);this._boundStore=e,this._xField=t,this._yField=n,this._seriesField=r;for(let t of Ze)e.on(t,this._onStoreRefresh);return this.rebuildFromStore(),this}getStore(){return this._boundStore}rebuildFromStore(){this._boundStore&&(this._series=this.resolveModel(this.seriesFromStore(this._boundStore)),this.scheduleLayout())}seriesFromStore(e){let t=e.getRecords();if(t.length===0)return[];if(this._seriesField===void 0)return[{name:this._yField,data:t.map(e=>({x:Number(e.get(this._xField)),y:Number(e.get(this._yField))}))}];let n=new Map;for(let e of t){let t=String(e.get(this._seriesField)),r={x:Number(e.get(this._xField)),y:Number(e.get(this._yField))},i=n.get(t);i?i.push(r):n.set(t,[r])}return Array.from(n,([e,t])=>({name:e,data:t}))}resolveModel(e){let t=new Map(this._series.map(e=>[e.name,e.hidden]));return e.map(e=>({name:e.name,points:e.data.map(e=>({x:e.x,y:e.y})),color:e.color,hidden:t.get(e.name)??!1}))}setShowLegend(e){return this._options.showLegend=e,this.scheduleLayout(),this}isShowLegend(){return this._options.showLegend??!0}setLegendPosition(e){return this._options.legendPosition=e,this.scheduleLayout(),this}getLegendPosition(){return this._options.legendPosition??`right`}setXAxisLabel(e){return this._options.xAxisLabel=e,this.scheduleLayout(),this}getXAxisLabel(){return this._options.xAxisLabel??null}setYAxisLabel(e){return this._options.yAxisLabel=e,this.scheduleLayout(),this}getYAxisLabel(){return this._options.yAxisLabel??null}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,t){this._listeners.fire(e,t)}createRootElement(){let t=super.createRootElement(),n=e.sink.createElementNS(Xe,`svg`);return e.sink.apply(n,{style:{position:`absolute`,left:`0`,top:`0`,overflow:`visible`}}),e.sink.appendChild(t,n),this.trackHandle(n),this._svg=n,this._axisGroup=this.createGroup(n),this._seriesGroup=this.createGroup(n),this._overlayGroup=this.createGroup(n),t}createGroup(t){let n=e.sink.createElementNS(Xe,`g`);return e.sink.appendChild(t,n),this.trackHandle(n),n}doLayout(){super.doLayout();let e=this.getInnerSize();if(!e||!this._svg)return this;let t=this.getPerimeterSize();this.sizeSurface(e);let n=this.reserveLegend(e,t),r=this.computePlot(n),i=this.buildScales(r);return this._plot=r,this._xScale=i.x,this._yScale=i.y,this.repaint(r,i.x,i.y),this}sizeSurface(t){let n=this.getPerimeterSize();e.sink.apply(this._svg,{setAttr:{width:String(t.width),height:String(t.height),viewBox:`0 0 ${t.width} ${t.height}`},style:{position:`absolute`,left:`${n.left}px`,top:`${n.top}px`,overflow:`visible`}})}reserveLegend(e,t){let n={x:0,y:0,width:e.width,height:e.height};if(!this.isShowLegend()||this._series.length===0)return this._legend.setVisible(!1),n;this._legend.setVisible(!0),this._legend.setOrientation(this.getLegendPosition()===`right`?`vertical`:`horizontal`),this._legend.setEntries(this._series.map((e,t)=>({name:e.name,color:this.seriesColor(t,e),hidden:e.hidden})));let r=this._legend.getPreferredSize()??{width:120,height:60},i=this.getLegendPosition();if(i===`right`){let n=Math.min(r.width,e.width/2);return this.placeLegend(t,e.width-n,0,n,e.height),{x:0,y:0,width:e.width-n-Z,height:e.height}}let a=Math.min(r.height,e.height/2);return i===`top`?(this.placeLegend(t,0,0,e.width,a),{x:0,y:a+Z,width:e.width,height:e.height-a-Z}):(this.placeLegend(t,0,e.height-a,e.width,a),{x:0,y:0,width:e.width,height:e.height-a-Z})}placeLegend(e,t,n,r,i){this._legend.setX(e.left+t),this._legend.setY(e.top+n),this._legend.setWidth(r),this._legend.setHeight(i),this._legend.doLayout()}computePlot(e){let t=this.buildScales(e),n=tickFormatter(t.x,8),r=tickFormatter(t.y,8),i=measureAxisMargin(`left`,t.y,r,8)+(this._options.yAxisLabel?Q:0),a=measureAxisMargin(`bottom`,t.x,n,8)+(this._options.xAxisLabel?Q:0);return{x:e.x+i,y:e.y+$e,width:Math.max(0,e.width-i-et),height:Math.max(0,e.height-a-$e)}}repaint(e,t,n){this.clearMarks();let r=this.markFactory(this._axisGroup);drawAxis(r,`left`,n,e,{tickCount:8,format:tickFormatter(n,8),grid:!0}),drawAxis(r,`bottom`,t,e,{tickCount:8,format:tickFormatter(t,8),grid:!1}),this.drawAxisTitles(r,e),this.drawSeries(e,t,n),this.drawSelection(e,t,n)}drawAxisTitles(e,t){let n={fill:`var(--ts-ui-chart-label)`};if(this._options.xAxisLabel&&e(`text`,{setAttr:{x:String(t.x+t.width/2),y:String(t.y+t.height+Q+$e),"text-anchor":`middle`,"dominant-baseline":`hanging`},style:n,text:this._options.xAxisLabel}),this._options.yAxisLabel){let r=t.x-Q*2,i=t.y+t.height/2;e(`text`,{setAttr:{x:String(r),y:String(i),"text-anchor":`middle`,"dominant-baseline":`middle`,transform:`rotate(-90 ${r} ${i})`},style:n,text:this._options.yAxisLabel})}}drawSelection(e,t,n){if(!this._selectedPoint)return;let r=this._series[this._selectedPoint.series];if(!r||r.hidden||this._selectedPoint.index>=r.points.length)return;let i=this.pointPixel(e,t,n,this._selectedPoint.series,this._selectedPoint.index);i&&this.createMark(this._overlayGroup,`circle`,{setAttr:{cx:String(i.x),cy:String(i.y),r:String(tt)},style:{fill:`none`,stroke:`var(--ts-ui-chart-selection)`,"stroke-width":`2`}})}markFactory(e){return(t,n)=>this.createMark(e,t,n)}createMark(t,n,r){let i=e.sink.createElementNS(Xe,n);return e.sink.apply(i,r),e.sink.appendChild(t,i),this._marks.push({parent:t,handle:i}),i}seriesMark(e,t){return this.createMark(this._seriesGroup,e,t)}clearMarks(){for(let{parent:t,handle:n}of this._marks)e.sink.removeChild(t,n),e.sink.release(n);this._marks.length=0}handlePointerMove=e=>{let t=this.resolveHit(e);if(!t){c.hide();return}let n=this._series[t.series],r=t.index===null?n.name:`${n.name}: (${n.points[t.index].x}, ${n.points[t.index].y})`;c.show(r,e.clientX,e.clientY)};handlePointerOut=t=>{let n=t.relatedTarget,r=this.getElement();r&&e.source.isNode(n)&&e.source.contains(r,e.source.intern(n))||c.hide()};handlePointerClick=e=>{let t=this.resolveHit(e);!t||t.index===null||this.selectPoint(t.series,t.index)};handleLegendToggle=e=>{let t=this._series[e];t&&(t.hidden=!t.hidden,this.scheduleLayout())};resolveHit(e){return this.hitMark(e)}clientToSurface(t,n){if(!this._svg)return null;let r=e.source.getElementRect(this._svg);return{x:t-r.x,y:n-r.y}}hitMark(t){if(!e.source.isNode(t.target))return null;let n=e.source.intern(t.target),r=e.source.getDataset(n,`series`);if(r===void 0)return null;let i=Number(r),a=this._series[i];if(!a||a.hidden)return null;let o=e.source.getDataset(n,`index`);if(o===void 0)return{series:i,index:null};let s=Number(o);return s>=a.points.length?null:{series:i,index:s}}selectPoint(e,t){this._selectedPoint={series:e,index:t},this.scheduleLayout();let n=this._series[e];this.emit(`selection`,{series:e,index:t,point:n.points[t],seriesName:n.name})}seriesColor(e,t){return t.color??`var(--ts-ui-chart-series-${e%Qe+1})`}destructor(){if(this._boundStore){for(let e of Ze)this._boundStore.off(e,this._onStoreRefresh);this._boundStore=null}this._themeCleanup&&=(this._themeCleanup(),null),this.clearMarks(),c.hide(),super.destructor()}},$=16,nt=24,CurveTape=class{segments=[];_x=0;_y=0;moveTo(e,t){this._x=e,this._y=t}lineTo(e,t){this.segments.push([this._x,this._y,this._x,this._y,e,t,e,t]),this._x=e,this._y=t}bezierCurveTo(e,t,n,r,i,a){this.segments.push([this._x,this._y,e,t,n,r,i,a]),this._x=i,this._y=a}closePath(){}};function cubicAt(e,t,n,r,i){let a=1-i;return a*a*a*e+3*a*a*i*t+3*a*i*i*n+i*i*i*r}var LineChart=class extends AbstractChart{constructor(e){super(e),this.dispatchLineOptions(e)}dispatchLineOptions(e){e&&(e.showPoints!==void 0&&this.setShowPoints(e.showPoints),e.curved!==void 0&&this.setCurved(e.curved),e.xScaleType!==void 0&&this.setXScaleType(e.xScaleType))}setShowPoints(e){return this._options.showPoints=e,this.scheduleLayout(),this}isShowPoints(){return this._options.showPoints??!0}setCurved(e){return this._options.curved=e,this.scheduleLayout(),this}isCurved(){return this._options.curved??!1}setXScaleType(e){return this._options.xScaleType=e,this.scheduleLayout(),this}getXScaleType(){return this._options.xScaleType??`linear`}visiblePoints(){return this._series.filter(e=>!e.hidden).flatMap(e=>e.points)}buildScales(e){let t=this.visiblePoints(),[n,r]=pointsXExtent(t),i=pointsYBounds(t),a=[e.x,e.x+e.width],o=[e.y+e.height,e.y];return{x:this.getXScaleType()===`time`?timeScale([new Date(n),new Date(r)],a):linearScale([n,r],a),y:linearScale(i,o)}}drawSeries(e,t,n){let r=this.projector(t,n),i=this.isCurved()?monotoneX:linear_default;this._series.forEach((e,t)=>{if(e.hidden)return;let n=this.seriesColor(t,e),a=line_default().x(e=>r.x(e.x)).y(e=>r.y(e.y)).curve(i)(e.points);this.seriesMark(`path`,{setAttr:{d:a??``,"data-series":String(t)},style:{fill:`none`,stroke:n,"stroke-width":`var(--ts-ui-chart-line-width)`}}),this.isShowPoints()&&this.drawPoints(e.points,t,n,r)})}drawPoints(e,t,n,r){e.forEach((e,i)=>{this.seriesMark(`circle`,{setAttr:{cx:String(r.x(e.x)),cy:String(r.y(e.y)),r:`var(--ts-ui-chart-point-radius)`,"data-series":String(t),"data-index":String(i)},style:{fill:n}})})}pointPixel(e,t,n,r,i){let a=this._series[r]?.points[i];if(!a)return null;let o=this.projector(t,n);return{x:o.x(a.x),y:o.y(a.y)}}resolveHit(e){if(!this._plot||!this._xScale||!this._yScale)return null;let t=this.clientToSurface(e.clientX,e.clientY);if(!t)return null;let n=this._plot;if(t.x<n.x||t.x>n.x+n.width||t.y<n.y-$||t.y>n.y+n.height+$)return null;let r=this.projector(this._xScale,this._yScale),i=-1,a=$;return this._series.forEach((e,n)=>{if(e.hidden||e.points.length===0)return;let o=this.curveYAt(e.points,t.x,r);if(o===null)return;let s=Math.abs(t.y-o);s<=a&&(a=s,i=n)}),i<0?null:{series:i,index:this.nearestPointIndex(this._series[i].points,t.x,r)}}curveYAt(e,t,n){let r=new CurveTape;line_default().x(e=>n.x(e.x)).y(e=>n.y(e.y)).curve(this.isCurved()?monotoneX:linear_default).context(r)(e);for(let[e,n,i,a,o,s,c,l]of r.segments){if(t<Math.min(e,c)||t>Math.max(e,c))continue;let r=c>=e,u=0,d=1;for(let n=0;n<nt;n++){let n=(u+d)/2;cubicAt(e,i,o,c,n)<=t===r?u=n:d=n}return cubicAt(n,a,s,l,(u+d)/2)}return null}nearestPointIndex(e,t,n){let r=0,i=1/0;return e.forEach((e,a)=>{let o=Math.abs(n.x(e.x)-t);o<i&&(i=o,r=a)}),r}projector(e,t){return{x:e,y:t}}},rt=r(LineChart),BarChart=class extends AbstractChart{constructor(e){super(e),e?.grouped!==void 0&&this.setGrouped(e.grouped)}setGrouped(e){return this._options.grouped=e,this.scheduleLayout(),this}isGrouped(){return this._options.grouped??this._series.length>1}categories(){let e=new Set;for(let t of this._series)if(!t.hidden)for(let n of t.points)e.add(n.x);return Array.from(e).sort((e,t)=>e-t).map(String)}visiblePoints(){return this._series.filter(e=>!e.hidden).flatMap(e=>e.points)}buildScales(e){return{x:bandScale(this.categories(),[e.x,e.x+e.width]),y:linearScale(pointsYBounds(this.visiblePoints()),[e.y+e.height,e.y])}}drawSeries(e,t,n){for(let e of this.computeBars(t,n)){let t=this.seriesColor(e.seriesIndex,this._series[e.seriesIndex]);this.seriesMark(`rect`,{setAttr:{x:String(e.x),y:String(e.y),width:String(e.width),height:String(e.height),"data-series":String(e.seriesIndex),"data-index":String(e.pointIndex)},style:{fill:t}})}}computeBars(e,t){if(!isBandScale(e))return[];let n=t,r=n(0),i=this.isGrouped(),a=this._series.map((e,t)=>({model:e,index:t})).filter(e=>!e.model.hidden),o=e.bandwidth(),s=i?o/Math.max(1,a.length):o,c=new Map,l=[];return a.forEach((t,a)=>{this.appendSeriesBars(l,t.model,t.index,a,e,n,r,i,s,c)}),l}appendSeriesBars(e,t,n,r,i,a,o,s,c,l){t.points.forEach((t,u)=>{let d=String(t.x),f=i(d)??0;if(s){let i=a(t.y);e.push({seriesIndex:n,pointIndex:u,x:f+r*c,y:Math.min(i,o),width:c,height:Math.abs(o-i)})}else{let r=l.get(d)??0,i=r+t.y,o=a(i),s=a(r);e.push({seriesIndex:n,pointIndex:u,x:f,y:Math.min(o,s),width:c,height:Math.abs(s-o)}),l.set(d,i)}})}pointPixel(e,t,n,r,i){let a=this.computeBars(t,n).find(e=>e.seriesIndex===r&&e.pointIndex===i);return a?{x:a.x+a.width/2,y:a.y}:null}},it=r(BarChart);export{AbstractChart,it as BarChart,Ye as ChartLegend,rt as LineChart};
1
+ import{t as e}from"../DOM-C-Edb3tA.js";import{n as t}from"../Position-BwtxouxK.js";import{S as n,h as r,r as i,t as a}from"../Component-B0ShfPVi.js";import{t as o}from"../ListenerBag-WPdKuuds.js";import{t as s}from"../Panel-Cy1pdlWO.js";import{t as c}from"../Tooltip-CUOJOqQi.js";import{t as l}from"../Text-CMKnK9uB.js";import{n as u,r as d}from"../VBox-DfJPWXqc.js";function constant_default$1(e){return function constant(){return e}}var f=Math.PI,p=2*f,m=1e-6,h=p-m;function append(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function appendRound(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return append;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var Path=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?append:appendRound(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>m){if(!(Math.abs(u*s-c*l)>m)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let p=n-a,h=r-o,g=s*s+c*c,_=p*p+h*h,v=Math.sqrt(g),b=Math.sqrt(d),S=i*Math.tan((f-Math.acos((g+d-_)/(2*v*b)))/2),C=S/b,w=S/v;Math.abs(C-1)>m&&this._append`L${e+C*l},${t+C*u}`,this._append`A${i},${i},0,0,${+(u*p>l*h)},${this._x1=e+w*s},${this._y1=t+w*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>m||Math.abs(this._y1-l)>m)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%p+p),d>h?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>m&&this._append`A${n},${n},0,${+(d>=f)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Path.prototype;function withPath(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Path(t)}Array.prototype.slice;function array_default(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Linear(e){this._context=e}Linear.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function linear_default(e){return new Linear(e)}function x(e){return e[0]}function y(e){return e[1]}function line_default(e,t){var n=constant_default$1(!0),r=null,i=linear_default,a=null,o=withPath(line);e=typeof e==`function`?e:e===void 0?x:constant_default$1(e),t=typeof t==`function`?t:t===void 0?y:constant_default$1(t);function line(s){var c,l=(s=array_default(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return line.x=function(t){return arguments.length?(e=typeof t==`function`?t:constant_default$1(+t),line):e},line.y=function(e){return arguments.length?(t=typeof e==`function`?e:constant_default$1(+e),line):t},line.defined=function(e){return arguments.length?(n=typeof e==`function`?e:constant_default$1(!!e),line):n},line.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),line):i},line.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),line):r},line}function sign(e){return e<0?-1:1}function slope3(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(sign(a)+sign(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function slope2(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function point(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function MonotoneX(e){this._context=e}MonotoneX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:point(this,this._t0,slope2(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,point(this,slope2(this,n=slope3(this,e,t)),n);break;default:point(this,this._t0,n=slope3(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},Object.create(MonotoneX.prototype).point=function(e,t){MonotoneX.prototype.point.call(this,t,e)};function monotoneX(e){return new MonotoneX(e)}function ascending(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function descending(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function bisector(e){let t,compare2,delta;e.length===2?(t=e===ascending||e===descending?e:zero$1,compare2=e,delta=e):(t=ascending,compare2=(t,n)=>ascending(e(t),n),delta=(t,n)=>e(t)-n);function left(e,n,r=0,i=e.length){if(r<i){if(t(n,n)!==0)return i;do{let t=r+i>>>1;compare2(e[t],n)<0?r=t+1:i=t}while(r<i)}return r}function right(e,n,r=0,i=e.length){if(r<i){if(t(n,n)!==0)return i;do{let t=r+i>>>1;compare2(e[t],n)<=0?r=t+1:i=t}while(r<i)}return r}function center(e,t,n=0,r=e.length){let i=left(e,t,n,r-1);return i>n&&delta(e[i-1],t)>-delta(e[i],t)?i-1:i}return{left,center,right}}function zero$1(){return 0}function number$2(e){return e===null?NaN:+e}var g=bisector(ascending),_=g.right;g.left,bisector(number$2).center;function extent(e,t){let n,r;if(t===void 0)for(let t of e)t!=null&&(n===void 0?t>=t&&(n=r=t):(n>t&&(n=t),r<t&&(r=t)));else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(n===void 0?a>=a&&(n=r=a):(n>a&&(n=a),r<a&&(r=a)))}return[n,r]}var InternMap=class extends Map{constructor(e,t=keyof){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(intern_get(this,e))}has(e){return super.has(intern_get(this,e))}set(e,t){return super.set(intern_set(this,e),t)}delete(e){return super.delete(intern_delete(this,e))}};function intern_get({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function intern_set({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function intern_delete({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function keyof(e){return typeof e==`object`&&e?e.valueOf():e}var v=Math.sqrt(50),b=Math.sqrt(10),S=Math.sqrt(2);function tickSpec(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=v?10:a>=b?5:a>=S?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?tickSpec(e,t,n*2):[s,c,l]}function ticks(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?tickSpec(t,e,n):tickSpec(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r){if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o}else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function tickIncrement(e,t,n){return t=+t,e=+e,n=+n,tickSpec(e,t,n)[2]}function tickStep(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?tickIncrement(t,e,n):tickIncrement(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function max(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function min(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function range(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function initRange(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}var C=Symbol(`implicit`);function ordinal(){var e=new InternMap,t=[],n=[],r=C;function scale(i){let a=e.get(i);if(a===void 0){if(r!==C)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return scale.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new InternMap;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return scale},scale.range=function(e){return arguments.length?(n=Array.from(e),scale):n.slice()},scale.unknown=function(e){return arguments.length?(r=e,scale):r},scale.copy=function(){return ordinal(t,n).unknown(r)},initRange.apply(scale,arguments),scale}function band(){var e=ordinal().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function rescale(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=range(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),rescale()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,rescale()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,rescale()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,rescale()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),rescale()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),rescale()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,rescale()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),rescale()):u},e.copy=function(){return band(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},initRange.apply(rescale(),arguments)}function define_default(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function extend(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Color(){}var w=.7,T=1/w,E=`\\s*([+-]?\\d+)\\s*`,D=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,O=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,ee=/^#([0-9a-f]{3,8})$/,te=RegExp(`^rgb\\(${E},${E},${E}\\)$`),ne=RegExp(`^rgb\\(${O},${O},${O}\\)$`),re=RegExp(`^rgba\\(${E},${E},${E},${D}\\)$`),ie=RegExp(`^rgba\\(${O},${O},${O},${D}\\)$`),ae=RegExp(`^hsl\\(${D},${O},${O}\\)$`),oe=RegExp(`^hsla\\(${D},${O},${O},${D}\\)$`),se={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};define_default(Color,color,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:color_formatHex,formatHex:color_formatHex,formatHex8:color_formatHex8,formatHsl:color_formatHsl,formatRgb:color_formatRgb,toString:color_formatRgb});function color_formatHex(){return this.rgb().formatHex()}function color_formatHex8(){return this.rgb().formatHex8()}function color_formatHsl(){return hslConvert(this).formatHsl()}function color_formatRgb(){return this.rgb().formatRgb()}function color(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=ee.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?rgbn(t):n===3?new Rgb(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?rgba(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?rgba(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=te.exec(e))?new Rgb(t[1],t[2],t[3],1):(t=ne.exec(e))?new Rgb(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=re.exec(e))?rgba(t[1],t[2],t[3],t[4]):(t=ie.exec(e))?rgba(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ae.exec(e))?hsla(t[1],t[2]/100,t[3]/100,1):(t=oe.exec(e))?hsla(t[1],t[2]/100,t[3]/100,t[4]):se.hasOwnProperty(e)?rgbn(se[e]):e===`transparent`?new Rgb(NaN,NaN,NaN,0):null}function rgbn(e){return new Rgb(e>>16&255,e>>8&255,e&255,1)}function rgba(e,t,n,r){return r<=0&&(e=t=n=NaN),new Rgb(e,t,n,r)}function rgbConvert(e){return e instanceof Color||(e=color(e)),e?(e=e.rgb(),new Rgb(e.r,e.g,e.b,e.opacity)):new Rgb}function rgb(e,t,n,r){return arguments.length===1?rgbConvert(e):new Rgb(e,t,n,r??1)}function Rgb(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}define_default(Rgb,rgb,extend(Color,{brighter(e){return e=e==null?T:T**+e,new Rgb(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?w:w**+e,new Rgb(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Rgb(clampi(this.r),clampi(this.g),clampi(this.b),clampa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rgb_formatHex,formatHex:rgb_formatHex,formatHex8:rgb_formatHex8,formatRgb:rgb_formatRgb,toString:rgb_formatRgb}));function rgb_formatHex(){return`#${hex(this.r)}${hex(this.g)}${hex(this.b)}`}function rgb_formatHex8(){return`#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity)?1:this.opacity)*255)}`}function rgb_formatRgb(){let e=clampa(this.opacity);return`${e===1?`rgb(`:`rgba(`}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${e===1?`)`:`, ${e})`}`}function clampa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function clampi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function hex(e){return e=clampi(e),(e<16?`0`:``)+e.toString(16)}function hsla(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hsl(e,t,n,r)}function hslConvert(e){if(e instanceof Hsl)return new Hsl(e.h,e.s,e.l,e.opacity);if(e instanceof Color||(e=color(e)),!e)return new Hsl;if(e instanceof Hsl)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Hsl(o,s,c,e.opacity)}function hsl(e,t,n,r){return arguments.length===1?hslConvert(e):new Hsl(e,t,n,r??1)}function Hsl(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}define_default(Hsl,hsl,extend(Color,{brighter(e){return e=e==null?T:T**+e,new Hsl(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?w:w**+e,new Hsl(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Rgb(hsl2rgb(e>=240?e-240:e+120,i,r),hsl2rgb(e,i,r),hsl2rgb(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Hsl(clamph(this.h),clampt(this.s),clampt(this.l),clampa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=clampa(this.opacity);return`${e===1?`hsl(`:`hsla(`}${clamph(this.h)}, ${clampt(this.s)*100}%, ${clampt(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function clamph(e){return e=(e||0)%360,e<0?e+360:e}function clampt(e){return Math.max(0,Math.min(1,e||0))}function hsl2rgb(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var constant_default=e=>()=>e;function linear$1(e,t){return function(n){return e+n*t}}function exponential(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function gamma(e){return(e=+e)==1?nogamma:function(t,n){return n-t?exponential(t,n,e):constant_default(isNaN(t)?n:t)}}function nogamma(e,t){var n=t-e;return n?linear$1(e,n):constant_default(isNaN(e)?t:e)}var ce=(function rgbGamma(e){var t=gamma(e);function rgb$1(e,n){var r=t((e=rgb(e)).r,(n=rgb(n)).r),i=t(e.g,n.g),a=t(e.b,n.b),o=nogamma(e.opacity,n.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return rgb$1.gamma=rgbGamma,rgb$1})(1);function numberArray_default(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function isNumberArray(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function genericArray(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=value_default(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function date_default(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function number_default(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function object_default(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=value_default(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var le=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ue=new RegExp(le.source,`g`);function zero(e){return function(){return e}}function one(e){return function(t){return e(t)+``}}function string_default(e,t){var n=le.lastIndex=ue.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=le.exec(e))&&(i=ue.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:number_default(r,i)})),n=ue.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?one(c[0].x):zero(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function value_default(e,t){var n=typeof t,r;return t==null||n===`boolean`?constant_default(t):(n===`number`?number_default:n===`string`?(r=color(t))?(t=r,ce):string_default:t instanceof color?ce:t instanceof Date?date_default:isNumberArray(t)?numberArray_default:Array.isArray(t)?genericArray:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?object_default:number_default)(e,t)}function round_default(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function constants(e){return function(){return e}}function number$1(e){return+e}var de=[0,1];function identity(e){return e}function normalize(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:constants(isNaN(t)?NaN:.5)}function clamper(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function bimap(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=normalize(i,r),a=n(o,a)):(r=normalize(r,i),a=n(a,o)),function(e){return a(r(e))}}function polymap(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=normalize(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=_(e,t,1,r)-1;return a[n](i[n](t))}}function copy(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function transformer(){var e=de,t=de,n=value_default,r,i,a,o=identity,s,c,l;function rescale(){var n=Math.min(e.length,t.length);return o!==identity&&(o=clamper(e[0],e[n-1])),s=n>2?polymap:bimap,c=l=null,scale}function scale(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return scale.invert=function(n){return o(i((l||=s(t,e.map(r),number_default))(n)))},scale.domain=function(t){return arguments.length?(e=Array.from(t,number$1),rescale()):e.slice()},scale.range=function(e){return arguments.length?(t=Array.from(e),rescale()):t.slice()},scale.rangeRound=function(e){return t=Array.from(e),n=round_default,rescale()},scale.clamp=function(e){return arguments.length?(o=e?!0:identity,rescale()):o!==identity},scale.interpolate=function(e){return arguments.length?(n=e,rescale()):n},scale.unknown=function(e){return arguments.length?(a=e,scale):a},function(e,t){return r=e,i=t,rescale()}}function continuous(){return transformer()(identity,identity)}function formatDecimal_default(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function formatDecimalParts(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function exponent_default(e){return e=formatDecimalParts(Math.abs(e)),e?e[1]:NaN}function formatGroup_default(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function formatNumerals_default(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var fe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(e){if(!(t=fe.exec(e)))throw Error(`invalid format: `+e);var t;return new FormatSpecifier({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}formatSpecifier.prototype=FormatSpecifier.prototype;function FormatSpecifier(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function formatTrim_default(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var k;function formatPrefixAuto_default(e,t){var n=formatDecimalParts(e,t);if(!n)return k=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(k=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+formatDecimalParts(e,Math.max(0,t+a-1))[0]}function formatRounded_default(e,t){var n=formatDecimalParts(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var pe={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:formatDecimal_default,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>formatRounded_default(e*100,t),r:formatRounded_default,s:formatPrefixAuto_default,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function identity_default(e){return e}var me=Array.prototype.map,he=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function locale_default(e){var t=e.grouping===void 0||e.thousands===void 0?identity_default:formatGroup_default(me.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?identity_default:formatNumerals_default(me.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function newFormat(e,l){e=formatSpecifier(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,b=e.type;b===`n`?(g=!0,b=`g`):pe[b]||(_===void 0&&(_=12),v=!0,b=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var S=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(b)?`0`+b.toLowerCase():``),C=(p===`$`?r:/[%p]/.test(b)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),w=pe[b],T=/[defgprs%]/.test(b);_=_===void 0?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function format(e){var n=S,r=C,o,l,p;if(b===`c`)r=w(e)+r,e=``;else{e=+e;var E=e<0||1/e<0;if(e=isNaN(e)?c:w(Math.abs(e),_),v&&(e=formatTrim_default(e)),E&&+e==0&&f!==`+`&&(E=!1),n=(E?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(b===`s`&&!isNaN(e)&&k!==void 0?he[8+k/3]:``)+r+(E&&f===`(`?`)`:``),T){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var D=n.length+e.length+r.length,O=D<h?Array(h-D+1).join(u):``;switch(g&&m&&(e=t(O+e,O.length?h-r.length:1/0),O=``),d){case`<`:e=n+e+r+O;break;case`=`:e=n+O+e+r;break;case`^`:e=O.slice(0,D=O.length>>1)+n+e+r+O.slice(D);break;default:e=O+n+e+r}return a(e)}return format.toString=function(){return e+``},format}function formatPrefix(e,t){var n=Math.max(-8,Math.min(8,Math.floor(exponent_default(t)/3)))*3,r=10**-n,i=newFormat((e=formatSpecifier(e),e.type=`f`,e),{suffix:he[8+n/3]});return function(e){return i(r*e)}}return{format:newFormat,formatPrefix}}var A,ge,_e;defaultLocale$1({thousands:`,`,grouping:[3],currency:[`$`,``]});function defaultLocale$1(e){return A=locale_default(e),ge=A.format,_e=A.formatPrefix,A}function precisionFixed_default(e){return Math.max(0,-exponent_default(Math.abs(e)))}function precisionPrefix_default(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(exponent_default(t)/3)))*3-exponent_default(Math.abs(e)))}function precisionRound_default(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,exponent_default(t)-exponent_default(e))+1}function tickFormat(e,t,n,r){var i=tickStep(e,t,n),a;switch(r=formatSpecifier(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=precisionPrefix_default(i,o))&&(r.precision=a),_e(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=precisionRound_default(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=precisionFixed_default(i))&&(r.precision=a-(r.type===`%`)*2)}return ge(r)}function linearish(e){var t=e.domain;return e.ticks=function(e){var n=t();return ticks(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return tickFormat(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-->0;){if(l=tickIncrement(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function linear(){var e=continuous();return e.copy=function(){return copy(e,linear())},initRange.apply(e,arguments),linearish(e)}function nice(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a<i&&(o=n,n=r,r=o,o=i,i=a,a=o),e[n]=t.floor(i),e[r]=t.ceil(a),e}var ve=new Date,ye=new Date;function timeInterval(e,t,n,r){function interval(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return interval.floor=t=>(e(t=new Date(+t)),t),interval.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),interval.round=e=>{let t=interval(e),n=interval.ceil(e);return e-t<n-e?t:n},interval.offset=(e,n)=>(t(e=new Date(+e),n==null?1:Math.floor(n)),e),interval.range=(n,r,i)=>{let a=[];if(n=interval.ceil(n),i=i==null?1:Math.floor(i),!(n<r)||!(i>0))return a;let o;do a.push(o=new Date(+n)),t(n,i),e(n);while(o<n&&n<r);return a},interval.filter=n=>timeInterval(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e){if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}}),n&&(interval.count=(t,r)=>(ve.setTime(+t),ye.setTime(+r),e(ve),e(ye),Math.floor(n(ve,ye))),interval.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?interval.filter(r?t=>r(t)%e===0:t=>interval.count(0,t)%e===0):interval)),interval}var j=timeInterval(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);j.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?timeInterval(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):j),j.range;var M=1e3,N=M*60,P=N*60,F=P*24,I=F*7,be=F*30,L=F*365,R=timeInterval(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*M)},(e,t)=>(t-e)/M,e=>e.getUTCSeconds());R.range;var xe=timeInterval(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*M)},(e,t)=>{e.setTime(+e+t*N)},(e,t)=>(t-e)/N,e=>e.getMinutes());xe.range;var Se=timeInterval(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*N)},(e,t)=>(t-e)/N,e=>e.getUTCMinutes());Se.range;var z=timeInterval(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*M-e.getMinutes()*N)},(e,t)=>{e.setTime(+e+t*P)},(e,t)=>(t-e)/P,e=>e.getHours());z.range;var Ce=timeInterval(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*P)},(e,t)=>(t-e)/P,e=>e.getUTCHours());Ce.range;var B=timeInterval(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*N)/F,e=>e.getDate()-1);B.range;var we=timeInterval(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/F,e=>e.getUTCDate()-1);we.range;var Te=timeInterval(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/F,e=>Math.floor(e/F));Te.range;function timeWeekday(e){return timeInterval(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*N)/I)}var V=timeWeekday(0),H=timeWeekday(1),Ee=timeWeekday(2),De=timeWeekday(3),U=timeWeekday(4),Oe=timeWeekday(5),ke=timeWeekday(6);V.range,H.range,Ee.range,De.range,U.range,Oe.range,ke.range;function utcWeekday(e){return timeInterval(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/I)}var Ae=utcWeekday(0),W=utcWeekday(1),je=utcWeekday(2),Me=utcWeekday(3),G=utcWeekday(4),Ne=utcWeekday(5),Pe=utcWeekday(6);Ae.range,W.range,je.range,Me.range,G.range,Ne.range,Pe.range;var Fe=timeInterval(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Fe.range;var Ie=timeInterval(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Ie.range;var K=timeInterval(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());K.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:timeInterval(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),K.range;var q=timeInterval(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());q.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:timeInterval(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),q.range;function ticker(e,t,n,r,i,a){let o=[[R,1,M],[R,5,5*M],[R,15,15*M],[R,30,30*M],[a,1,N],[a,5,5*N],[a,15,15*N],[a,30,30*N],[i,1,P],[i,3,3*P],[i,6,6*P],[i,12,12*P],[r,1,F],[r,2,2*F],[n,1,I],[t,1,be],[t,3,3*be],[e,1,L]];function ticks(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&typeof n.range==`function`?n:tickInterval(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a}function tickInterval(t,n,r){let i=Math.abs(n-t)/r,a=bisector(([,,e])=>e).right(o,i);if(a===o.length)return e.every(tickStep(t/L,n/L,r));if(a===0)return j.every(Math.max(tickStep(t,n,r),1));let[s,c]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(c)}return[ticks,tickInterval]}var[Le,Re]=ticker(q,Ie,Ae,Te,Ce,Se),[ze,Be]=ticker(K,Fe,V,B,z,xe);function localDate(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function utcDate(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function newDate(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function formatLocale(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=formatRe(i),u=formatLookup(i),d=formatRe(a),f=formatLookup(a),p=formatRe(o),m=formatLookup(o),h=formatRe(s),g=formatLookup(s),_=formatRe(c),v=formatLookup(c),b={a:formatShortWeekday,A:formatWeekday,b:formatShortMonth,B:formatMonth,c:null,d:formatDayOfMonth,e:formatDayOfMonth,f:formatMicroseconds,g:formatYearISO,G:formatFullYearISO,H:formatHour24,I:formatHour12,j:formatDayOfYear,L:formatMilliseconds,m:formatMonthNumber,M:formatMinutes,p:formatPeriod,q:formatQuarter,Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatSeconds,u:formatWeekdayNumberMonday,U:formatWeekNumberSunday,V:formatWeekNumberISO,w:formatWeekdayNumberSunday,W:formatWeekNumberMonday,x:null,X:null,y:formatYear,Y:formatFullYear,Z:formatZone,"%":formatLiteralPercent},S={a:formatUTCShortWeekday,A:formatUTCWeekday,b:formatUTCShortMonth,B:formatUTCMonth,c:null,d:formatUTCDayOfMonth,e:formatUTCDayOfMonth,f:formatUTCMicroseconds,g:formatUTCYearISO,G:formatUTCFullYearISO,H:formatUTCHour24,I:formatUTCHour12,j:formatUTCDayOfYear,L:formatUTCMilliseconds,m:formatUTCMonthNumber,M:formatUTCMinutes,p:formatUTCPeriod,q:formatUTCQuarter,Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatUTCSeconds,u:formatUTCWeekdayNumberMonday,U:formatUTCWeekNumberSunday,V:formatUTCWeekNumberISO,w:formatUTCWeekdayNumberSunday,W:formatUTCWeekNumberMonday,x:null,X:null,y:formatUTCYear,Y:formatUTCFullYear,Z:formatUTCZone,"%":formatLiteralPercent},C={a:parseShortWeekday,A:parseWeekday,b:parseShortMonth,B:parseMonth,c:parseLocaleDateTime,d:parseDayOfMonth,e:parseDayOfMonth,f:parseMicroseconds,g:parseYear,G:parseFullYear,H:parseHour24,I:parseHour24,j:parseDayOfYear,L:parseMilliseconds,m:parseMonthNumber,M:parseMinutes,p:parsePeriod,q:parseQuarter,Q:parseUnixTimestamp,s:parseUnixTimestampSeconds,S:parseSeconds,u:parseWeekdayNumberMonday,U:parseWeekNumberSunday,V:parseWeekNumberISO,w:parseWeekdayNumberSunday,W:parseWeekNumberMonday,x:parseLocaleDate,X:parseLocaleTime,y:parseYear,Y:parseFullYear,Z:parseZone,"%":parseLiteralPercent};b.x=newFormat(n,b),b.X=newFormat(r,b),b.c=newFormat(t,b),S.x=newFormat(n,S),S.X=newFormat(r,S),S.c=newFormat(t,S);function newFormat(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i<o;)e.charCodeAt(i)===37&&(r.push(e.slice(a,i)),(c=Ve[s=e.charAt(++i)])==null?c=s===`e`?` `:`0`:s=e.charAt(++i),(l=t[s])&&(s=l(n,c)),r.push(s),a=i+1);return r.push(e.slice(a,i)),r.join(``)}}function newParse(e,t){return function(n){var r=newDate(1900,void 0,1),i=parseSpecifier(r,e,n+=``,0),a,o;if(i!=n.length)return null;if(`Q`in r)return new Date(r.Q);if(`s`in r)return new Date(r.s*1e3+(`L`in r?r.L:0));if(t&&!(`Z`in r)&&(r.Z=0),`p`in r&&(r.H=r.H%12+r.p*12),r.m===void 0&&(r.m=`q`in r?r.q:0),`V`in r){if(r.V<1||r.V>53)return null;`w`in r||(r.w=1),`Z`in r?(a=utcDate(newDate(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?W.ceil(a):W(a),a=we.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=localDate(newDate(r.y,0,1)),o=a.getDay(),a=o>4||o===0?H.ceil(a):H(a),a=B.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?utcDate(newDate(r.y,0,1)).getUTCDay():localDate(newDate(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,utcDate(r)):localDate(r)}}function parseSpecifier(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=C[s in Ve?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function parsePeriod(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function parseShortWeekday(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function parseWeekday(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function parseShortMonth(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function parseMonth(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function parseLocaleDateTime(e,n,r){return parseSpecifier(e,t,n,r)}function parseLocaleDate(e,t,r){return parseSpecifier(e,n,t,r)}function parseLocaleTime(e,t,n){return parseSpecifier(e,r,t,n)}function formatShortWeekday(e){return o[e.getDay()]}function formatWeekday(e){return a[e.getDay()]}function formatShortMonth(e){return c[e.getMonth()]}function formatMonth(e){return s[e.getMonth()]}function formatPeriod(e){return i[+(e.getHours()>=12)]}function formatQuarter(e){return 1+~~(e.getMonth()/3)}function formatUTCShortWeekday(e){return o[e.getUTCDay()]}function formatUTCWeekday(e){return a[e.getUTCDay()]}function formatUTCShortMonth(e){return c[e.getUTCMonth()]}function formatUTCMonth(e){return s[e.getUTCMonth()]}function formatUTCPeriod(e){return i[+(e.getUTCHours()>=12)]}function formatUTCQuarter(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=newFormat(e+=``,b);return t.toString=function(){return e},t},parse:function(e){var t=newParse(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=newFormat(e+=``,S);return t.toString=function(){return e},t},utcParse:function(e){var t=newParse(e+=``,!0);return t.toString=function(){return e},t}}}var Ve={"-":``,_:` `,0:`0`},J=/^\s*\d+/,He=/^%/,Ue=/[\\^$*+?|[\]().{}]/g;function pad(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function requote(e){return e.replace(Ue,`\\$&`)}function formatRe(e){return RegExp(`^(?:`+e.map(requote).join(`|`)+`)`,`i`)}function formatLookup(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function parseWeekdayNumberSunday(e,t,n){var r=J.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function parseWeekdayNumberMonday(e,t,n){var r=J.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function parseWeekNumberSunday(e,t,n){var r=J.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function parseWeekNumberISO(e,t,n){var r=J.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function parseWeekNumberMonday(e,t,n){var r=J.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function parseFullYear(e,t,n){var r=J.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function parseYear(e,t,n){var r=J.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function parseZone(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function parseQuarter(e,t,n){var r=J.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function parseMonthNumber(e,t,n){var r=J.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function parseDayOfMonth(e,t,n){var r=J.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function parseDayOfYear(e,t,n){var r=J.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function parseHour24(e,t,n){var r=J.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function parseMinutes(e,t,n){var r=J.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function parseSeconds(e,t,n){var r=J.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function parseMilliseconds(e,t,n){var r=J.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function parseMicroseconds(e,t,n){var r=J.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function parseLiteralPercent(e,t,n){var r=He.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function parseUnixTimestamp(e,t,n){var r=J.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function parseUnixTimestampSeconds(e,t,n){var r=J.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function formatDayOfMonth(e,t){return pad(e.getDate(),t,2)}function formatHour24(e,t){return pad(e.getHours(),t,2)}function formatHour12(e,t){return pad(e.getHours()%12||12,t,2)}function formatDayOfYear(e,t){return pad(1+B.count(K(e),e),t,3)}function formatMilliseconds(e,t){return pad(e.getMilliseconds(),t,3)}function formatMicroseconds(e,t){return formatMilliseconds(e,t)+`000`}function formatMonthNumber(e,t){return pad(e.getMonth()+1,t,2)}function formatMinutes(e,t){return pad(e.getMinutes(),t,2)}function formatSeconds(e,t){return pad(e.getSeconds(),t,2)}function formatWeekdayNumberMonday(e){var t=e.getDay();return t===0?7:t}function formatWeekNumberSunday(e,t){return pad(V.count(K(e)-1,e),t,2)}function dISO(e){var t=e.getDay();return t>=4||t===0?U(e):U.ceil(e)}function formatWeekNumberISO(e,t){return e=dISO(e),pad(U.count(K(e),e)+(K(e).getDay()===4),t,2)}function formatWeekdayNumberSunday(e){return e.getDay()}function formatWeekNumberMonday(e,t){return pad(H.count(K(e)-1,e),t,2)}function formatYear(e,t){return pad(e.getFullYear()%100,t,2)}function formatYearISO(e,t){return e=dISO(e),pad(e.getFullYear()%100,t,2)}function formatFullYear(e,t){return pad(e.getFullYear()%1e4,t,4)}function formatFullYearISO(e,t){var n=e.getDay();return e=n>=4||n===0?U(e):U.ceil(e),pad(e.getFullYear()%1e4,t,4)}function formatZone(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+pad(t/60|0,`0`,2)+pad(t%60,`0`,2)}function formatUTCDayOfMonth(e,t){return pad(e.getUTCDate(),t,2)}function formatUTCHour24(e,t){return pad(e.getUTCHours(),t,2)}function formatUTCHour12(e,t){return pad(e.getUTCHours()%12||12,t,2)}function formatUTCDayOfYear(e,t){return pad(1+we.count(q(e),e),t,3)}function formatUTCMilliseconds(e,t){return pad(e.getUTCMilliseconds(),t,3)}function formatUTCMicroseconds(e,t){return formatUTCMilliseconds(e,t)+`000`}function formatUTCMonthNumber(e,t){return pad(e.getUTCMonth()+1,t,2)}function formatUTCMinutes(e,t){return pad(e.getUTCMinutes(),t,2)}function formatUTCSeconds(e,t){return pad(e.getUTCSeconds(),t,2)}function formatUTCWeekdayNumberMonday(e){var t=e.getUTCDay();return t===0?7:t}function formatUTCWeekNumberSunday(e,t){return pad(Ae.count(q(e)-1,e),t,2)}function UTCdISO(e){var t=e.getUTCDay();return t>=4||t===0?G(e):G.ceil(e)}function formatUTCWeekNumberISO(e,t){return e=UTCdISO(e),pad(G.count(q(e),e)+(q(e).getUTCDay()===4),t,2)}function formatUTCWeekdayNumberSunday(e){return e.getUTCDay()}function formatUTCWeekNumberMonday(e,t){return pad(W.count(q(e)-1,e),t,2)}function formatUTCYear(e,t){return pad(e.getUTCFullYear()%100,t,2)}function formatUTCYearISO(e,t){return e=UTCdISO(e),pad(e.getUTCFullYear()%100,t,2)}function formatUTCFullYear(e,t){return pad(e.getUTCFullYear()%1e4,t,4)}function formatUTCFullYearISO(e,t){var n=e.getUTCDay();return e=n>=4||n===0?G(e):G.ceil(e),pad(e.getUTCFullYear()%1e4,t,4)}function formatUTCZone(){return`+0000`}function formatLiteralPercent(){return`%`}function formatUnixTimestamp(e){return+e}function formatUnixTimestampSeconds(e){return Math.floor(e/1e3)}var Y,We;defaultLocale({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function defaultLocale(e){return Y=formatLocale(e),We=Y.format,Y.parse,Y.utcFormat,Y.utcParse,Y}function date(e){return new Date(e)}function number(e){return e instanceof Date?+e:+new Date(+e)}function calendar(e,t,n,r,i,a,o,s,c,l){var u=continuous(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),b=l(`%B`),S=l(`%Y`);function tickFormat(e){return(c(e)<e?p:s(e)<e?m:o(e)<e?h:a(e)<e?g:r(e)<e?i(e)<e?_:v:n(e)<e?b:S)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?f(Array.from(e,number)):f().map(date)},u.ticks=function(t){var n=f();return e(n[0],n[n.length-1],t??10)},u.tickFormat=function(e,t){return t==null?tickFormat:l(t)},u.nice=function(e){var n=f();return(!e||typeof e.range!=`function`)&&(e=t(n[0],n[n.length-1],e??10)),e?f(nice(n,e)):u},u.copy=function(){return copy(u,calendar(e,t,n,r,i,a,o,s,c,l))},u}function time(){return initRange.apply(calendar(ze,Be,K,Fe,V,B,z,xe,R,We).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}var Ge=.1;function linearScale(e,t){return linear().domain(e).range(t).nice()}function timeScale(e,t){return time().domain(e).range(t).nice()}function bandScale(e,t,n=Ge){return band().domain(e).range(t).paddingInner(n).paddingOuter(n/2)}function isBandScale(e){return typeof e.bandwidth==`function`}function scaleTicks(e,t){return isBandScale(e)?e.domain():e.ticks(t)}function tickPosition(e,t){return isBandScale(e)?(e(t)??0)+e.bandwidth()/2:e(t)}function tickFormatter(e,t){if(isBandScale(e))return e=>String(e);let n=e.tickFormat(t);return e=>n(e)}function pointsXExtent(e){let t=extent(e,e=>e.x);return[t[0]??0,t[1]??1]}function pointsYBounds(e,t=!0){if(e.length===0)return[0,1];let n=min(e,e=>e.y)??0,r=max(e,e=>e.y)??1,i=t?Math.min(0,n):n;return[i,r>i?r:i+1]}var X=6,Ke=4;function measureAxisMargin(t,n,r,i){let a=scaleTicks(n,i);if(t===`left`){let t=0;for(let n of a)t=Math.max(t,e.source.measureText(r(n)).width);return 10+Math.ceil(t)}let o=e.source.measureText(`0`).height;return 10+Math.ceil(o)}function drawAxis(e,t,n,r,i){let a={stroke:`var(--ts-ui-chart-axis)`,"stroke-width":`var(--ts-ui-chart-axis-width)`},o={stroke:`var(--ts-ui-chart-grid)`,"stroke-width":`var(--ts-ui-chart-axis-width)`},s={fill:`var(--ts-ui-chart-label)`},c=r.y+r.height,l=r.x+r.width;t===`left`?e(`line`,{setAttr:{x1:String(r.x),y1:String(r.y),x2:String(r.x),y2:String(c)},style:a}):e(`line`,{setAttr:{x1:String(r.x),y1:String(c),x2:String(l),y2:String(c)},style:a});for(let u of scaleTicks(n,i.tickCount)){let d=tickPosition(n,u),f=i.format(u);t===`left`?drawLeftTick(e,r,l,d,f,i.grid,o,a,s):drawBottomTick(e,r,c,d,f,i.grid,o,a,s)}}function drawLeftTick(e,t,n,r,i,a,o,s,c){a&&e(`line`,{setAttr:{x1:String(t.x),y1:String(r),x2:String(n),y2:String(r)},style:o}),e(`line`,{setAttr:{x1:String(t.x-X),y1:String(r),x2:String(t.x),y2:String(r)},style:s}),e(`text`,{setAttr:{x:String(t.x-X-Ke),y:String(r),"text-anchor":`end`,"dominant-baseline":`middle`},style:c,text:i})}function drawBottomTick(e,t,n,r,i,a,o,s,c){a&&e(`line`,{setAttr:{x1:String(r),y1:String(t.y),x2:String(r),y2:String(n)},style:o}),e(`line`,{setAttr:{x1:String(r),y1:String(n),x2:String(r),y2:String(n+X)},style:s}),e(`text`,{setAttr:{x:String(r),y:String(n+X+Ke),"text-anchor":`middle`,"dominant-baseline":`hanging`},style:c,text:i})}var Z=12,qe=.4,Je={backgroundColor:`transparent`},ChartLegend=class extends s{_listeners=new o;_rows=[];_entries=[];_orientation=`vertical`;constructor(e,t){super(e,{...Je,...t??{}}),this.clearInsets(),this.applyOrientationLayout(),this.dispatchLegendOptions(e),n.addSubtreeListener(this,`click`,this.handleRowClick)}dispatchLegendOptions(e){e&&(e.orientation!==void 0&&this.setOrientation(e.orientation),e.entries!==void 0&&this.setEntries(e.entries),this.applyListeners(e.listeners))}setOrientation(e){return this._orientation===e?this:(this._orientation=e,this.applyOrientationLayout(),this)}getOrientation(){return this._orientation}applyOrientationLayout(){this.setLayoutManager(this._orientation===`vertical`?new u({spacing:2,stretching:!1}):new d({spacing:10,stretching:!1}))}setEntries(e){if(this.entriesEqual(e))return this;this._entries=e.map(e=>({...e})),this.disposeAllComponents(),this._rows=[];for(let e of this._entries){let t=this.buildRow(e);this._rows.push(t),this.addComponent(t)}return this}getEntries(){return this._entries.map(e=>({...e}))}entriesEqual(e){if(e.length!==this._entries.length)return!1;for(let t=0;t<e.length;t++){let n=e[t],r=this._entries[t];if(n.name!==r.name||n.color!==r.color||(n.hidden??!1)!==(r.hidden??!1))return!1}return!0}buildRow(e){let n=new a({preferredSize:{width:Z,height:Z},minSize:{width:Z,height:Z},maxSize:{width:Z,height:Z},backgroundColor:e.color,borderRadius:`2px`}),r=new l(e.name);return new s({layoutManager:new d({spacing:6,stretching:!0}),insets:new t(2,4,2,4),cursor:`pointer`,opacity:e.hidden?qe:1,components:[n,r]})}handleRowClick=t=>{if(!e.source.isNode(t.target))return;let n=e.source.intern(t.target);for(let t=0;t<this._rows.length;t++){let r=this._rows[t].getElement();if(r&&e.source.contains(r,n)){this.emit(`toggle`,t);return}}};on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,t){this._listeners.fire(e,t)}},Ye=r(ChartLegend),Xe=`http://www.w3.org/2000/svg`,Ze=[`load`,`add`,`remove`,`datachange`],Qe=8,$e=10,et=12,Q=8,tt=18,nt=6,rt={preferredSize:{width:400,height:300},minSize:{width:80,height:60}},AbstractChart=class extends s{_listeners=new o;_series=[];_selectedPoint=null;_boundStore=null;_xField=`x`;_yField=`y`;_seriesField=void 0;_onStoreRefresh=()=>this.rebuildFromStore();_legend=new Ye;_themeCleanup=null;_svg=null;_axisGroup=null;_seriesGroup=null;_overlayGroup=null;_marks=[];_plot=null;_xScale=null;_yScale=null;constructor(e,t){super(e,{...rt,...t??{}}),this.addComponent(this._legend),this._legend.on(`toggle`,this.handleLegendToggle),n.addSubtreeListener(this,`mousemove`,this.handlePointerMove),n.addSubtreeListener(this,`mouseout`,this.handlePointerOut),n.addSubtreeListener(this,`click`,this.handlePointerClick),this._themeCleanup=i.onThemeChange(()=>this.scheduleLayout()),this.dispatchChartOptions(e)}dispatchChartOptions(e){e&&(e.store===void 0?e.series!==void 0&&this.setSeries(e.series):this.setStore(e.store,e.xField??`x`,e.yField??`y`,e.seriesField),e.showLegend!==void 0&&this.setShowLegend(e.showLegend),e.legendPosition!==void 0&&this.setLegendPosition(e.legendPosition),e.xAxisLabel!==void 0&&this.setXAxisLabel(e.xAxisLabel),e.yAxisLabel!==void 0&&this.setYAxisLabel(e.yAxisLabel),this.applyListeners(e.listeners))}setSeries(e){return this._series=this.resolveModel(e),this.scheduleLayout(),this}getSeries(){return this._series.map(e=>({name:e.name,data:e.points.map(e=>({x:e.x,y:e.y})),color:e.color}))}setStore(e,t,n,r){if(this._boundStore)for(let e of Ze)this._boundStore.off(e,this._onStoreRefresh);this._boundStore=e,this._xField=t,this._yField=n,this._seriesField=r;for(let t of Ze)e.on(t,this._onStoreRefresh);return this.rebuildFromStore(),this}getStore(){return this._boundStore}rebuildFromStore(){this._boundStore&&(this._series=this.resolveModel(this.seriesFromStore(this._boundStore)),this.scheduleLayout())}seriesFromStore(e){let t=e.getRecords();if(t.length===0)return[];if(this._seriesField===void 0)return[{name:this._yField,data:t.map(e=>({x:Number(e.get(this._xField)),y:Number(e.get(this._yField))}))}];let n=new Map;for(let e of t){let t=String(e.get(this._seriesField)),r={x:Number(e.get(this._xField)),y:Number(e.get(this._yField))},i=n.get(t);i?i.push(r):n.set(t,[r])}return Array.from(n,([e,t])=>({name:e,data:t}))}resolveModel(e){let t=new Map(this._series.map(e=>[e.name,e.hidden]));return e.map(e=>({name:e.name,points:e.data.map(e=>({x:e.x,y:e.y})),color:e.color,hidden:t.get(e.name)??!1}))}setShowLegend(e){return this._options.showLegend=e,this.scheduleLayout(),this}isShowLegend(){return this._options.showLegend??!0}setLegendPosition(e){return this._options.legendPosition=e,this.scheduleLayout(),this}getLegendPosition(){return this._options.legendPosition??`right`}setXAxisLabel(e){return this._options.xAxisLabel=e,this.scheduleLayout(),this}getXAxisLabel(){return this._options.xAxisLabel??null}setYAxisLabel(e){return this._options.yAxisLabel=e,this.scheduleLayout(),this}getYAxisLabel(){return this._options.yAxisLabel??null}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,t){this._listeners.fire(e,t)}createRootElement(){let t=super.createRootElement(),n=e.sink.createElementNS(Xe,`svg`);return e.sink.apply(n,{style:{position:`absolute`,left:`0`,top:`0`,overflow:`visible`}}),e.sink.appendChild(t,n),this.trackHandle(n),this._svg=n,this._axisGroup=this.createGroup(n),this._seriesGroup=this.createGroup(n),this._overlayGroup=this.createGroup(n),t}createGroup(t){let n=e.sink.createElementNS(Xe,`g`);return e.sink.appendChild(t,n),this.trackHandle(n),n}doLayout(){super.doLayout();let e=this.getInnerSize();if(!e||!this._svg)return this;let t=this.getPerimeterSize();this.sizeSurface(e);let n=this.reserveLegend(e,t),r=this.computePlot(n),i=this.buildScales(r);return this._plot=r,this._xScale=i.x,this._yScale=i.y,this.repaint(r,i.x,i.y),this}sizeSurface(t){let n=this.getPerimeterSize();e.sink.apply(this._svg,{setAttr:{width:String(t.width),height:String(t.height),viewBox:`0 0 ${t.width} ${t.height}`},style:{position:`absolute`,left:`${n.left}px`,top:`${n.top}px`,overflow:`visible`}})}reserveLegend(e,t){let n={x:0,y:0,width:e.width,height:e.height};if(!this.isShowLegend()||this._series.length===0)return this._legend.setVisible(!1),n;this._legend.setVisible(!0),this._legend.setOrientation(this.getLegendPosition()===`right`?`vertical`:`horizontal`),this._legend.setEntries(this._series.map((e,t)=>({name:e.name,color:this.seriesColor(t,e),hidden:e.hidden})));let r=this._legend.getPreferredSize()??{width:120,height:60},i=this.getLegendPosition();if(i===`right`){let n=Math.min(r.width,e.width/2);return this.placeLegend(t,e.width-n,0,n,e.height),{x:0,y:0,width:e.width-n-Q,height:e.height}}let a=Math.min(r.height,e.height/2);return i===`top`?(this.placeLegend(t,0,0,e.width,a),{x:0,y:a+Q,width:e.width,height:e.height-a-Q}):(this.placeLegend(t,0,e.height-a,e.width,a),{x:0,y:0,width:e.width,height:e.height-a-Q})}placeLegend(e,t,n,r,i){this._legend.setX(e.left+t),this._legend.setY(e.top+n),this._legend.setWidth(r),this._legend.setHeight(i),this._legend.doLayout()}computePlot(e){let t=this.buildScales(e),n=tickFormatter(t.x,8),r=tickFormatter(t.y,8),i=measureAxisMargin(`left`,t.y,r,8)+(this._options.yAxisLabel?tt:0),a=measureAxisMargin(`bottom`,t.x,n,8)+(this._options.xAxisLabel?tt:0);return{x:e.x+i,y:e.y+$e,width:Math.max(0,e.width-i-et),height:Math.max(0,e.height-a-$e)}}repaint(e,t,n){this.clearMarks();let r=this.markFactory(this._axisGroup);drawAxis(r,`left`,n,e,{tickCount:8,format:tickFormatter(n,8),grid:!0}),drawAxis(r,`bottom`,t,e,{tickCount:8,format:tickFormatter(t,8),grid:!1}),this.drawAxisTitles(r,e),this.drawSeries(e,t,n),this.drawSelection(e,t,n)}drawAxisTitles(e,t){let n={fill:`var(--ts-ui-chart-label)`};if(this._options.xAxisLabel&&e(`text`,{setAttr:{x:String(t.x+t.width/2),y:String(t.y+t.height+tt+$e),"text-anchor":`middle`,"dominant-baseline":`hanging`},style:n,text:this._options.xAxisLabel}),this._options.yAxisLabel){let r=t.x-36,i=t.y+t.height/2;e(`text`,{setAttr:{x:String(r),y:String(i),"text-anchor":`middle`,"dominant-baseline":`middle`,transform:`rotate(-90 ${r} ${i})`},style:n,text:this._options.yAxisLabel})}}drawSelection(e,t,n){if(!this._selectedPoint)return;let r=this._series[this._selectedPoint.series];if(!r||r.hidden||this._selectedPoint.index>=r.points.length)return;let i=this.pointPixel(e,t,n,this._selectedPoint.series,this._selectedPoint.index);i&&this.createMark(this._overlayGroup,`circle`,{setAttr:{cx:String(i.x),cy:String(i.y),r:String(nt)},style:{fill:`none`,stroke:`var(--ts-ui-chart-selection)`,"stroke-width":`2`}})}markFactory(e){return(t,n)=>this.createMark(e,t,n)}createMark(t,n,r){let i=e.sink.createElementNS(Xe,n);return e.sink.apply(i,r),e.sink.appendChild(t,i),this._marks.push({parent:t,handle:i}),i}seriesMark(e,t){return this.createMark(this._seriesGroup,e,t)}clearMarks(){for(let{parent:t,handle:n}of this._marks)e.sink.removeChild(t,n),e.sink.release(n);this._marks.length=0}handlePointerMove=e=>{let t=this.resolveHit(e);if(!t){c.hide();return}let n=this._series[t.series],r=t.index===null?n.name:`${n.name}: (${n.points[t.index].x}, ${n.points[t.index].y})`;c.show(r,e.clientX,e.clientY)};handlePointerOut=t=>{let n=t.relatedTarget,r=this.getElement();r&&e.source.isNode(n)&&e.source.contains(r,e.source.intern(n))||c.hide()};handlePointerClick=e=>{let t=this.resolveHit(e);!t||t.index===null||this.selectPoint(t.series,t.index)};handleLegendToggle=e=>{let t=this._series[e];t&&(t.hidden=!t.hidden,this.scheduleLayout())};resolveHit(e){return this.hitMark(e)}clientToSurface(t,n){if(!this._svg)return null;let r=e.source.getElementRect(this._svg);return{x:t-r.x,y:n-r.y}}hitMark(t){if(!e.source.isNode(t.target))return null;let n=e.source.intern(t.target),r=e.source.getDataset(n,`series`);if(r===void 0)return null;let i=Number(r),a=this._series[i];if(!a||a.hidden)return null;let o=e.source.getDataset(n,`index`);if(o===void 0)return{series:i,index:null};let s=Number(o);return s>=a.points.length?null:{series:i,index:s}}selectPoint(e,t){this._selectedPoint={series:e,index:t},this.scheduleLayout();let n=this._series[e];this.emit(`selection`,{series:e,index:t,point:n.points[t],seriesName:n.name})}seriesColor(e,t){return t.color??`var(--ts-ui-chart-series-${e%Qe+1})`}destructor(){if(this._boundStore){for(let e of Ze)this._boundStore.off(e,this._onStoreRefresh);this._boundStore=null}this._themeCleanup&&=(this._themeCleanup(),null),this.clearMarks(),c.hide(),super.destructor()}},$=16,it=24,CurveTape=class{segments=[];_x=0;_y=0;moveTo(e,t){this._x=e,this._y=t}lineTo(e,t){this.segments.push([this._x,this._y,this._x,this._y,e,t,e,t]),this._x=e,this._y=t}bezierCurveTo(e,t,n,r,i,a){this.segments.push([this._x,this._y,e,t,n,r,i,a]),this._x=i,this._y=a}closePath(){}};function cubicAt(e,t,n,r,i){let a=1-i;return a*a*a*e+3*a*a*i*t+3*a*i*i*n+i*i*i*r}var LineChart=class extends AbstractChart{constructor(e){super(e),this.dispatchLineOptions(e)}dispatchLineOptions(e){e&&(e.showPoints!==void 0&&this.setShowPoints(e.showPoints),e.curved!==void 0&&this.setCurved(e.curved),e.xScaleType!==void 0&&this.setXScaleType(e.xScaleType))}setShowPoints(e){return this._options.showPoints=e,this.scheduleLayout(),this}isShowPoints(){return this._options.showPoints??!0}setCurved(e){return this._options.curved=e,this.scheduleLayout(),this}isCurved(){return this._options.curved??!1}setXScaleType(e){return this._options.xScaleType=e,this.scheduleLayout(),this}getXScaleType(){return this._options.xScaleType??`linear`}visiblePoints(){return this._series.filter(e=>!e.hidden).flatMap(e=>e.points)}buildScales(e){let t=this.visiblePoints(),[n,r]=pointsXExtent(t),i=pointsYBounds(t),a=[e.x,e.x+e.width],o=[e.y+e.height,e.y];return{x:this.getXScaleType()===`time`?timeScale([new Date(n),new Date(r)],a):linearScale([n,r],a),y:linearScale(i,o)}}drawSeries(e,t,n){let r=this.projector(t,n),i=this.isCurved()?monotoneX:linear_default;this._series.forEach((e,t)=>{if(e.hidden)return;let n=this.seriesColor(t,e),a=line_default().x(e=>r.x(e.x)).y(e=>r.y(e.y)).curve(i)(e.points);this.seriesMark(`path`,{setAttr:{d:a??``,"data-series":String(t)},style:{fill:`none`,stroke:n,"stroke-width":`var(--ts-ui-chart-line-width)`}}),this.isShowPoints()&&this.drawPoints(e.points,t,n,r)})}drawPoints(e,t,n,r){e.forEach((e,i)=>{this.seriesMark(`circle`,{setAttr:{cx:String(r.x(e.x)),cy:String(r.y(e.y)),r:`var(--ts-ui-chart-point-radius)`,"data-series":String(t),"data-index":String(i)},style:{fill:n}})})}pointPixel(e,t,n,r,i){let a=this._series[r]?.points[i];if(!a)return null;let o=this.projector(t,n);return{x:o.x(a.x),y:o.y(a.y)}}resolveHit(e){if(!this._plot||!this._xScale||!this._yScale)return null;let t=this.clientToSurface(e.clientX,e.clientY);if(!t)return null;let n=this._plot;if(t.x<n.x||t.x>n.x+n.width||t.y<n.y-$||t.y>n.y+n.height+$)return null;let r=this.projector(this._xScale,this._yScale),i=-1,a=$;return this._series.forEach((e,n)=>{if(e.hidden||e.points.length===0)return;let o=this.curveYAt(e.points,t.x,r);if(o===null)return;let s=Math.abs(t.y-o);s<=a&&(a=s,i=n)}),i<0?null:{series:i,index:this.nearestPointIndex(this._series[i].points,t.x,r)}}curveYAt(e,t,n){let r=new CurveTape;line_default().x(e=>n.x(e.x)).y(e=>n.y(e.y)).curve(this.isCurved()?monotoneX:linear_default).context(r)(e);for(let[e,n,i,a,o,s,c,l]of r.segments){if(t<Math.min(e,c)||t>Math.max(e,c))continue;let r=c>=e,u=0,d=1;for(let n=0;n<it;n++){let n=(u+d)/2;cubicAt(e,i,o,c,n)<=t===r?u=n:d=n}return cubicAt(n,a,s,l,(u+d)/2)}return null}nearestPointIndex(e,t,n){let r=0,i=1/0;return e.forEach((e,a)=>{let o=Math.abs(n.x(e.x)-t);o<i&&(i=o,r=a)}),r}projector(e,t){return{x:e,y:t}}},at=r(LineChart),BarChart=class extends AbstractChart{constructor(e){super(e),e?.grouped!==void 0&&this.setGrouped(e.grouped)}setGrouped(e){return this._options.grouped=e,this.scheduleLayout(),this}isGrouped(){return this._options.grouped??this._series.length>1}categories(){let e=new Set;for(let t of this._series)if(!t.hidden)for(let n of t.points)e.add(n.x);return Array.from(e).sort((e,t)=>e-t).map(String)}visiblePoints(){return this._series.filter(e=>!e.hidden).flatMap(e=>e.points)}buildScales(e){return{x:bandScale(this.categories(),[e.x,e.x+e.width]),y:linearScale(pointsYBounds(this.visiblePoints()),[e.y+e.height,e.y])}}drawSeries(e,t,n){for(let e of this.computeBars(t,n)){let t=this.seriesColor(e.seriesIndex,this._series[e.seriesIndex]);this.seriesMark(`rect`,{setAttr:{x:String(e.x),y:String(e.y),width:String(e.width),height:String(e.height),"data-series":String(e.seriesIndex),"data-index":String(e.pointIndex)},style:{fill:t}})}}computeBars(e,t){if(!isBandScale(e))return[];let n=t,r=n(0),i=this.isGrouped(),a=this._series.map((e,t)=>({model:e,index:t})).filter(e=>!e.model.hidden),o=e.bandwidth(),s=i?o/Math.max(1,a.length):o,c=new Map,l=[];return a.forEach((t,a)=>{this.appendSeriesBars(l,t.model,t.index,a,e,n,r,i,s,c)}),l}appendSeriesBars(e,t,n,r,i,a,o,s,c,l){t.points.forEach((t,u)=>{let d=String(t.x),f=i(d)??0;if(s){let i=a(t.y);e.push({seriesIndex:n,pointIndex:u,x:f+r*c,y:Math.min(i,o),width:c,height:Math.abs(o-i)})}else{let r=l.get(d)??0,i=r+t.y,o=a(i),s=a(r);e.push({seriesIndex:n,pointIndex:u,x:f,y:Math.min(o,s),width:c,height:Math.abs(s-o)}),l.set(d,i)}})}pointPixel(e,t,n,r,i){let a=this.computeBars(t,n).find(e=>e.seriesIndex===r&&e.pointIndex===i);return a?{x:a.x+a.width/2,y:a.y}:null}},ot=r(BarChart);export{AbstractChart,ot as BarChart,Ye as ChartLegend,at as LineChart};
2
2
  //# sourceMappingURL=chart.es.js.map