@awc-ui/core 1.0.0-beta.2 → 1.0.0-beta.3

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 (698) hide show
  1. package/README.md +18 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
  3. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  4. package/dist/cjs/engine.wasm-9JtXME10.js +12 -0
  5. package/dist/cjs/engine.wasm-9JtXME10.js.map +1 -0
  6. package/dist/cjs/{index-DlQ_5_Mv.js → index-Bm07YAg9.js} +4 -15
  7. package/dist/cjs/index-Bm07YAg9.js.map +1 -0
  8. package/dist/cjs/loader.cjs.js +3 -2
  9. package/dist/cjs/loader.cjs.js.map +1 -1
  10. package/dist/cjs/md-accordion-item.cjs.entry.js +1 -1
  11. package/dist/cjs/md-accordion.cjs.entry.js +1 -1
  12. package/dist/cjs/md-app-bar.cjs.entry.js +1 -1
  13. package/dist/cjs/md-area-chart.cjs.entry.js +1 -1
  14. package/dist/cjs/md-autocomplete.cjs.entry.js +2 -2
  15. package/dist/cjs/md-avatar_2.cjs.entry.js +1 -1
  16. package/dist/cjs/md-badge.cjs.entry.js +1 -1
  17. package/dist/cjs/md-bar-chart.cjs.entry.js +1 -1
  18. package/dist/cjs/md-bottom-sheet.cjs.entry.js +1 -1
  19. package/dist/cjs/md-breadcrumb-item.cjs.entry.js +1 -1
  20. package/dist/cjs/md-breadcrumbs.cjs.entry.js +1 -1
  21. package/dist/cjs/md-button-group.cjs.entry.js +1 -1
  22. package/dist/cjs/md-button_7.cjs.entry.js +1 -1
  23. package/dist/cjs/md-checkbox.cjs.entry.js +1 -1
  24. package/dist/cjs/md-chip.cjs.entry.js +1 -1
  25. package/dist/cjs/md-color-picker.cjs.entry.js +1 -1
  26. package/dist/cjs/md-date-picker.cjs.entry.js +1 -1
  27. package/dist/cjs/md-dialog.cjs.entry.js +1 -1
  28. package/dist/cjs/md-divider.cjs.entry.js +1 -1
  29. package/dist/cjs/md-fab-menu-item.cjs.entry.js +1 -1
  30. package/dist/cjs/md-fab-menu.cjs.entry.js +1 -1
  31. package/dist/cjs/md-fab.cjs.entry.js +1 -1
  32. package/dist/cjs/md-line-chart.cjs.entry.js +1 -1
  33. package/dist/cjs/md-list-item.cjs.entry.js +1 -1
  34. package/dist/cjs/md-list.cjs.entry.js +1 -1
  35. package/dist/cjs/md-menu-item-group.cjs.entry.js +1 -1
  36. package/dist/cjs/md-menu_2.cjs.entry.js +1 -1
  37. package/dist/cjs/md-meter.cjs.entry.js +1 -1
  38. package/dist/cjs/md-multi-select.cjs.entry.js +2 -2
  39. package/dist/cjs/md-navigation-bar.cjs.entry.js +1 -1
  40. package/dist/cjs/md-navigation-rail-tab.cjs.entry.js +1 -1
  41. package/dist/cjs/md-navigation-rail.cjs.entry.js +1 -1
  42. package/dist/cjs/md-navigation-tab.cjs.entry.js +1 -1
  43. package/dist/cjs/md-number-field.cjs.entry.js +1 -1
  44. package/dist/cjs/md-organization-chart.cjs.entry.js +1 -1
  45. package/dist/cjs/md-otp-field.cjs.entry.js +1 -1
  46. package/dist/cjs/md-pie-chart.cjs.entry.js +1 -1
  47. package/dist/cjs/md-progress-indicator.cjs.entry.js +1 -1
  48. package/dist/cjs/md-rating.cjs.entry.js +1 -1
  49. package/dist/cjs/md-search.cjs.entry.js +1 -1
  50. package/dist/cjs/md-segmented-button-set.cjs.entry.js +1 -1
  51. package/dist/cjs/md-segmented-button.cjs.entry.js +1 -1
  52. package/dist/cjs/md-select-option.cjs.entry.js +1 -1
  53. package/dist/cjs/md-select.cjs.entry.js +2 -2
  54. package/dist/cjs/md-side-sheet.cjs.entry.js +1 -1
  55. package/dist/cjs/md-skeleton.cjs.entry.js +1 -1
  56. package/dist/cjs/md-slider.cjs.entry.js +1 -1
  57. package/dist/cjs/md-sparkline.cjs.entry.js +1 -1
  58. package/dist/cjs/md-split-button.cjs.entry.js +1 -1
  59. package/dist/cjs/md-status-dot.cjs.entry.js +1 -1
  60. package/dist/cjs/md-step.cjs.entry.js +1 -1
  61. package/dist/cjs/md-stepper.cjs.entry.js +1 -1
  62. package/dist/cjs/md-sub-menu-item.cjs.entry.js +1 -1
  63. package/dist/cjs/md-switch.cjs.entry.js +1 -1
  64. package/dist/cjs/md-tab-panel.cjs.entry.js +1 -1
  65. package/dist/cjs/md-tab-panels.cjs.entry.js +1 -1
  66. package/dist/cjs/md-tab.cjs.entry.js +1 -1
  67. package/dist/cjs/md-table-body.cjs.entry.js +1 -1
  68. package/dist/cjs/md-table-cell.cjs.entry.js +1 -1
  69. package/dist/cjs/md-table-container.cjs.entry.js +1 -1
  70. package/dist/cjs/md-table-expand-toggle.cjs.entry.js +1 -1
  71. package/dist/cjs/md-table-foot.cjs.entry.js +1 -1
  72. package/dist/cjs/md-table-head.cjs.entry.js +1 -1
  73. package/dist/cjs/md-table-pagination.cjs.entry.js +1 -1
  74. package/dist/cjs/md-table-row.cjs.entry.js +1 -1
  75. package/dist/cjs/md-table-sort-label.cjs.entry.js +1 -1
  76. package/dist/cjs/md-table-toolbar.cjs.entry.js +1 -1
  77. package/dist/cjs/md-table.cjs.entry.js +1 -1
  78. package/dist/cjs/md-tabs.cjs.entry.js +1 -1
  79. package/dist/cjs/md-text-field.cjs.entry.js +1 -1
  80. package/dist/cjs/md-time-picker.cjs.entry.js +1 -1
  81. package/dist/cjs/md-toolbar.cjs.entry.js +1 -1
  82. package/dist/cjs/md-transfer-list.cjs.entry.js +1 -1
  83. package/dist/cjs/md3.cjs.js +3 -2
  84. package/dist/cjs/md3.cjs.js.map +1 -1
  85. package/dist/cjs/{virtual-select-controller-CqriaZgm.js → virtual-select-controller-C5cSoKfB.js} +10 -9
  86. package/dist/cjs/virtual-select-controller-C5cSoKfB.js.map +1 -0
  87. package/dist/collection/wasm/engine-abi.js +8 -2
  88. package/dist/collection/wasm/engine-abi.js.map +1 -1
  89. package/dist/components/index.js +1 -1
  90. package/dist/components/md-accordion-item.js +1 -1
  91. package/dist/components/md-accordion.js +1 -1
  92. package/dist/components/md-app-bar.js +1 -1
  93. package/dist/components/md-area-chart.js +1 -1
  94. package/dist/components/md-area-chart.js.map +1 -1
  95. package/dist/components/md-autocomplete.js +1 -1
  96. package/dist/components/md-avatar.js +1 -1
  97. package/dist/components/md-badge.js +1 -1
  98. package/dist/components/md-bar-chart.js +1 -1
  99. package/dist/components/md-bottom-sheet.js +1 -1
  100. package/dist/components/md-breadcrumb-item.js +1 -1
  101. package/dist/components/md-breadcrumbs.js +1 -1
  102. package/dist/components/md-button-group.js +1 -1
  103. package/dist/components/md-button.js +1 -1
  104. package/dist/components/md-card.js +1 -1
  105. package/dist/components/md-checkbox.js +1 -1
  106. package/dist/components/md-chip.js +1 -1
  107. package/dist/components/md-color-picker.js +1 -1
  108. package/dist/components/md-date-picker.js +1 -1
  109. package/dist/components/md-dialog.js +1 -1
  110. package/dist/components/md-divider.js +1 -1
  111. package/dist/components/md-fab-menu-item.js +1 -1
  112. package/dist/components/md-fab-menu.js +1 -1
  113. package/dist/components/md-fab.js +1 -1
  114. package/dist/components/md-icon-button.js +1 -1
  115. package/dist/components/md-line-chart.js +1 -1
  116. package/dist/components/md-list-item.js +1 -1
  117. package/dist/components/md-list.js +1 -1
  118. package/dist/components/md-loading-indicator.js +1 -1
  119. package/dist/components/md-menu-item-group.js +1 -1
  120. package/dist/components/md-menu-item.js +1 -1
  121. package/dist/components/md-menu.js +1 -1
  122. package/dist/components/md-meter.js +1 -1
  123. package/dist/components/md-multi-select.js +1 -1
  124. package/dist/components/md-navigation-bar.js +1 -1
  125. package/dist/components/md-navigation-rail-tab.js +1 -1
  126. package/dist/components/md-navigation-rail.js +1 -1
  127. package/dist/components/md-navigation-tab.js +1 -1
  128. package/dist/components/md-number-field.js +1 -1
  129. package/dist/components/md-organization-chart.js +1 -1
  130. package/dist/components/md-otp-field.js +1 -1
  131. package/dist/components/md-pie-chart.js +1 -1
  132. package/dist/components/md-progress-indicator.js +1 -1
  133. package/dist/components/md-radio.js +1 -1
  134. package/dist/components/md-rating.js +1 -1
  135. package/dist/components/md-ripple.js +1 -1
  136. package/dist/components/md-search.js +1 -1
  137. package/dist/components/md-segmented-button-set.js +1 -1
  138. package/dist/components/md-segmented-button.js +1 -1
  139. package/dist/components/md-select-option.js +1 -1
  140. package/dist/components/md-select.js +1 -1
  141. package/dist/components/md-side-sheet.js +1 -1
  142. package/dist/components/md-skeleton.js +1 -1
  143. package/dist/components/md-slider.js +1 -1
  144. package/dist/components/md-snackbar.js +1 -1
  145. package/dist/components/md-sparkline.js +1 -1
  146. package/dist/components/md-split-button.js +1 -1
  147. package/dist/components/md-status-dot.js +1 -1
  148. package/dist/components/md-step.js +1 -1
  149. package/dist/components/md-stepper.js +1 -1
  150. package/dist/components/md-sub-menu-item.js +1 -1
  151. package/dist/components/md-switch.js +1 -1
  152. package/dist/components/md-tab-panel.js +1 -1
  153. package/dist/components/md-tab-panels.js +1 -1
  154. package/dist/components/md-tab.js +1 -1
  155. package/dist/components/md-table-body.js +1 -1
  156. package/dist/components/md-table-cell.js +1 -1
  157. package/dist/components/md-table-container.js +1 -1
  158. package/dist/components/md-table-expand-toggle.js +1 -1
  159. package/dist/components/md-table-foot.js +1 -1
  160. package/dist/components/md-table-head.js +1 -1
  161. package/dist/components/md-table-pagination.js +1 -1
  162. package/dist/components/md-table-row.js +1 -1
  163. package/dist/components/md-table-sort-label.js +1 -1
  164. package/dist/components/md-table-toolbar.js +1 -1
  165. package/dist/components/md-table.js +1 -1
  166. package/dist/components/md-tabs.js +1 -1
  167. package/dist/components/md-text-field.js +1 -1
  168. package/dist/components/md-time-picker.js +1 -1
  169. package/dist/components/md-toolbar.js +1 -1
  170. package/dist/components/md-tooltip.js +1 -1
  171. package/dist/components/md-transfer-list.js +1 -1
  172. package/dist/components/p-B-JfuA2g.js +2 -0
  173. package/dist/components/p-B-JfuA2g.js.map +1 -0
  174. package/dist/components/p-B-iHDK5h.js +2 -0
  175. package/dist/components/p-B-iHDK5h.js.map +1 -0
  176. package/dist/components/p-BA2v4IuG.js +2 -0
  177. package/dist/components/p-BA2v4IuG.js.map +1 -0
  178. package/dist/components/p-BADA63mI.js +2 -0
  179. package/dist/components/p-BADA63mI.js.map +1 -0
  180. package/dist/components/p-BR6gfOQH.js +2 -0
  181. package/dist/components/p-BR6gfOQH.js.map +1 -0
  182. package/dist/components/p-Bz-JaJcA.js +2 -0
  183. package/dist/components/p-Bz-JaJcA.js.map +1 -0
  184. package/dist/components/p-CCMritCA.js +2 -0
  185. package/dist/components/p-CCMritCA.js.map +1 -0
  186. package/dist/components/p-CTC8XAB6.js +2 -0
  187. package/dist/components/p-CTC8XAB6.js.map +1 -0
  188. package/dist/components/p-CfBPnYW7.js +2 -0
  189. package/dist/components/p-CfBPnYW7.js.map +1 -0
  190. package/dist/components/p-CtVItLby.js +2 -0
  191. package/dist/components/p-CtVItLby.js.map +1 -0
  192. package/dist/components/p-D8oM1Kr3.js +2 -0
  193. package/dist/components/p-D8oM1Kr3.js.map +1 -0
  194. package/dist/components/{p-Ddiw2Kjw.js → p-DEzb9xsY.js} +2 -2
  195. package/dist/components/p-DEzb9xsY.js.map +1 -0
  196. package/dist/components/p-DYL-8C5C.js +2 -0
  197. package/dist/components/p-DYL-8C5C.js.map +1 -0
  198. package/dist/components/p-DfU4xY2F.js +2 -0
  199. package/dist/components/p-DfU4xY2F.js.map +1 -0
  200. package/dist/components/p-Eb44PPZa.js +2 -0
  201. package/dist/components/p-Eb44PPZa.js.map +1 -0
  202. package/dist/components/{p-UdGDg2oJ.js → p-Lsoo1B-2.js} +2 -2
  203. package/dist/components/p-Lsoo1B-2.js.map +1 -0
  204. package/dist/components/p-tSoecrcz.js +2 -0
  205. package/dist/components/p-tSoecrcz.js.map +1 -0
  206. package/dist/components-csr/index.js +2 -0
  207. package/dist/components-csr/index.js.map +1 -0
  208. package/dist/components-csr/md-accordion-item.js +2 -0
  209. package/dist/components-csr/md-accordion-item.js.map +1 -0
  210. package/dist/components-csr/md-accordion.js +2 -0
  211. package/dist/components-csr/md-accordion.js.map +1 -0
  212. package/dist/components-csr/md-app-bar.js +2 -0
  213. package/dist/components-csr/md-app-bar.js.map +1 -0
  214. package/dist/components-csr/md-area-chart.js +2 -0
  215. package/dist/components-csr/md-area-chart.js.map +1 -0
  216. package/dist/components-csr/md-autocomplete.js +2 -0
  217. package/dist/components-csr/md-autocomplete.js.map +1 -0
  218. package/dist/components-csr/md-avatar.js +2 -0
  219. package/dist/components-csr/md-avatar.js.map +1 -0
  220. package/dist/components-csr/md-badge.js +2 -0
  221. package/dist/components-csr/md-badge.js.map +1 -0
  222. package/dist/components-csr/md-bar-chart.js +2 -0
  223. package/dist/components-csr/md-bar-chart.js.map +1 -0
  224. package/dist/components-csr/md-bottom-sheet.js +2 -0
  225. package/dist/components-csr/md-bottom-sheet.js.map +1 -0
  226. package/dist/components-csr/md-breadcrumb-item.js +2 -0
  227. package/dist/components-csr/md-breadcrumb-item.js.map +1 -0
  228. package/dist/components-csr/md-breadcrumbs.js +2 -0
  229. package/dist/components-csr/md-breadcrumbs.js.map +1 -0
  230. package/dist/components-csr/md-button-group.js +2 -0
  231. package/dist/components-csr/md-button-group.js.map +1 -0
  232. package/dist/components-csr/md-button.js +2 -0
  233. package/dist/components-csr/md-button.js.map +1 -0
  234. package/dist/components-csr/md-card.js +2 -0
  235. package/dist/components-csr/md-card.js.map +1 -0
  236. package/dist/components-csr/md-checkbox.js +2 -0
  237. package/dist/components-csr/md-checkbox.js.map +1 -0
  238. package/dist/components-csr/md-chip.js +2 -0
  239. package/dist/components-csr/md-chip.js.map +1 -0
  240. package/dist/components-csr/md-color-picker.js +2 -0
  241. package/dist/components-csr/md-color-picker.js.map +1 -0
  242. package/dist/components-csr/md-date-picker.js +2 -0
  243. package/dist/components-csr/md-date-picker.js.map +1 -0
  244. package/dist/components-csr/md-dialog.js +2 -0
  245. package/dist/components-csr/md-dialog.js.map +1 -0
  246. package/dist/components-csr/md-divider.js +2 -0
  247. package/dist/components-csr/md-divider.js.map +1 -0
  248. package/dist/components-csr/md-fab-menu-item.js +2 -0
  249. package/dist/components-csr/md-fab-menu-item.js.map +1 -0
  250. package/dist/components-csr/md-fab-menu.js +2 -0
  251. package/dist/components-csr/md-fab-menu.js.map +1 -0
  252. package/dist/components-csr/md-fab.js +2 -0
  253. package/dist/components-csr/md-fab.js.map +1 -0
  254. package/dist/components-csr/md-icon-button.js +2 -0
  255. package/dist/components-csr/md-icon-button.js.map +1 -0
  256. package/dist/components-csr/md-line-chart.js +2 -0
  257. package/dist/components-csr/md-line-chart.js.map +1 -0
  258. package/dist/components-csr/md-list-item.js +2 -0
  259. package/dist/components-csr/md-list-item.js.map +1 -0
  260. package/dist/components-csr/md-list.js +2 -0
  261. package/dist/components-csr/md-list.js.map +1 -0
  262. package/dist/components-csr/md-loading-indicator.js +2 -0
  263. package/dist/components-csr/md-loading-indicator.js.map +1 -0
  264. package/dist/components-csr/md-menu-item-group.js +2 -0
  265. package/dist/components-csr/md-menu-item-group.js.map +1 -0
  266. package/dist/components-csr/md-menu-item.js +2 -0
  267. package/dist/components-csr/md-menu-item.js.map +1 -0
  268. package/dist/components-csr/md-menu.js +2 -0
  269. package/dist/components-csr/md-menu.js.map +1 -0
  270. package/dist/components-csr/md-meter.js +2 -0
  271. package/dist/components-csr/md-meter.js.map +1 -0
  272. package/dist/components-csr/md-multi-select.js +2 -0
  273. package/dist/components-csr/md-multi-select.js.map +1 -0
  274. package/dist/components-csr/md-navigation-bar.js +2 -0
  275. package/dist/components-csr/md-navigation-bar.js.map +1 -0
  276. package/dist/components-csr/md-navigation-rail-tab.js +2 -0
  277. package/dist/components-csr/md-navigation-rail-tab.js.map +1 -0
  278. package/dist/components-csr/md-navigation-rail.js +2 -0
  279. package/dist/components-csr/md-navigation-rail.js.map +1 -0
  280. package/dist/components-csr/md-navigation-tab.js +2 -0
  281. package/dist/components-csr/md-navigation-tab.js.map +1 -0
  282. package/dist/components-csr/md-number-field.js +2 -0
  283. package/dist/components-csr/md-number-field.js.map +1 -0
  284. package/dist/components-csr/md-organization-chart.js +2 -0
  285. package/dist/components-csr/md-organization-chart.js.map +1 -0
  286. package/dist/components-csr/md-otp-field.js +2 -0
  287. package/dist/components-csr/md-otp-field.js.map +1 -0
  288. package/dist/components-csr/md-pie-chart.js +2 -0
  289. package/dist/components-csr/md-pie-chart.js.map +1 -0
  290. package/dist/components-csr/md-progress-indicator.js +2 -0
  291. package/dist/components-csr/md-progress-indicator.js.map +1 -0
  292. package/dist/components-csr/md-radio.js +2 -0
  293. package/dist/components-csr/md-radio.js.map +1 -0
  294. package/dist/components-csr/md-rating.js +2 -0
  295. package/dist/components-csr/md-rating.js.map +1 -0
  296. package/dist/components-csr/md-ripple.js +2 -0
  297. package/dist/components-csr/md-ripple.js.map +1 -0
  298. package/dist/components-csr/md-search.js +2 -0
  299. package/dist/components-csr/md-search.js.map +1 -0
  300. package/dist/components-csr/md-segmented-button-set.js +2 -0
  301. package/dist/components-csr/md-segmented-button-set.js.map +1 -0
  302. package/dist/components-csr/md-segmented-button.js +2 -0
  303. package/dist/components-csr/md-segmented-button.js.map +1 -0
  304. package/dist/components-csr/md-select-option.js +2 -0
  305. package/dist/components-csr/md-select-option.js.map +1 -0
  306. package/dist/components-csr/md-select.js +2 -0
  307. package/dist/components-csr/md-select.js.map +1 -0
  308. package/dist/components-csr/md-side-sheet.js +2 -0
  309. package/dist/components-csr/md-side-sheet.js.map +1 -0
  310. package/dist/components-csr/md-skeleton.js +2 -0
  311. package/dist/components-csr/md-skeleton.js.map +1 -0
  312. package/dist/components-csr/md-slider.js +2 -0
  313. package/dist/components-csr/md-slider.js.map +1 -0
  314. package/dist/components-csr/md-snackbar.js +2 -0
  315. package/dist/components-csr/md-snackbar.js.map +1 -0
  316. package/dist/components-csr/md-sparkline.js +2 -0
  317. package/dist/components-csr/md-sparkline.js.map +1 -0
  318. package/dist/components-csr/md-split-button.js +2 -0
  319. package/dist/components-csr/md-split-button.js.map +1 -0
  320. package/dist/components-csr/md-status-dot.js +2 -0
  321. package/dist/components-csr/md-status-dot.js.map +1 -0
  322. package/dist/components-csr/md-step.js +2 -0
  323. package/dist/components-csr/md-step.js.map +1 -0
  324. package/dist/components-csr/md-stepper.js +2 -0
  325. package/dist/components-csr/md-stepper.js.map +1 -0
  326. package/dist/components-csr/md-sub-menu-item.js +2 -0
  327. package/dist/components-csr/md-sub-menu-item.js.map +1 -0
  328. package/dist/components-csr/md-switch.js +2 -0
  329. package/dist/components-csr/md-switch.js.map +1 -0
  330. package/dist/components-csr/md-tab-panel.js +2 -0
  331. package/dist/components-csr/md-tab-panel.js.map +1 -0
  332. package/dist/components-csr/md-tab-panels.js +2 -0
  333. package/dist/components-csr/md-tab-panels.js.map +1 -0
  334. package/dist/components-csr/md-tab.js +2 -0
  335. package/dist/components-csr/md-tab.js.map +1 -0
  336. package/dist/components-csr/md-table-body.js +2 -0
  337. package/dist/components-csr/md-table-body.js.map +1 -0
  338. package/dist/components-csr/md-table-cell.js +2 -0
  339. package/dist/components-csr/md-table-cell.js.map +1 -0
  340. package/dist/components-csr/md-table-container.js +2 -0
  341. package/dist/components-csr/md-table-container.js.map +1 -0
  342. package/dist/components-csr/md-table-expand-toggle.js +2 -0
  343. package/dist/components-csr/md-table-expand-toggle.js.map +1 -0
  344. package/dist/components-csr/md-table-foot.js +2 -0
  345. package/dist/components-csr/md-table-foot.js.map +1 -0
  346. package/dist/components-csr/md-table-head.js +2 -0
  347. package/dist/components-csr/md-table-head.js.map +1 -0
  348. package/dist/components-csr/md-table-pagination.js +2 -0
  349. package/dist/components-csr/md-table-pagination.js.map +1 -0
  350. package/dist/components-csr/md-table-row.js +2 -0
  351. package/dist/components-csr/md-table-row.js.map +1 -0
  352. package/dist/components-csr/md-table-sort-label.js +2 -0
  353. package/dist/components-csr/md-table-sort-label.js.map +1 -0
  354. package/dist/components-csr/md-table-toolbar.js +2 -0
  355. package/dist/components-csr/md-table-toolbar.js.map +1 -0
  356. package/dist/components-csr/md-table.js +2 -0
  357. package/dist/components-csr/md-table.js.map +1 -0
  358. package/dist/components-csr/md-tabs.js +2 -0
  359. package/dist/components-csr/md-tabs.js.map +1 -0
  360. package/dist/components-csr/md-text-field.js +2 -0
  361. package/dist/components-csr/md-text-field.js.map +1 -0
  362. package/dist/components-csr/md-time-picker.js +2 -0
  363. package/dist/components-csr/md-time-picker.js.map +1 -0
  364. package/dist/components-csr/md-toolbar.js +2 -0
  365. package/dist/components-csr/md-toolbar.js.map +1 -0
  366. package/dist/components-csr/md-tooltip.js +2 -0
  367. package/dist/components-csr/md-tooltip.js.map +1 -0
  368. package/dist/components-csr/md-transfer-list.js +2 -0
  369. package/dist/components-csr/md-transfer-list.js.map +1 -0
  370. package/dist/{components/p-DXXUoRSH.js → components-csr/p--OUYjgKN.js} +2 -2
  371. package/dist/{components/p-Dp-w93ot.js → components-csr/p--TCJgZnE.js} +2 -2
  372. package/dist/components-csr/p-BdEoSBtL.js +2 -0
  373. package/dist/components-csr/p-BdEoSBtL.js.map +1 -0
  374. package/dist/components-csr/p-Bmu7RqHM.js +2 -0
  375. package/dist/components-csr/p-Bx6--dQF.js +2 -0
  376. package/dist/components-csr/p-Bx6--dQF.js.map +1 -0
  377. package/dist/components-csr/p-Bz-JaJcA.js +2 -0
  378. package/dist/components-csr/p-Bz-JaJcA.js.map +1 -0
  379. package/dist/{components/p-uTEkf0sE.js → components-csr/p-C0DlKmRg.js} +2 -2
  380. package/dist/{components/p-Ch2-tttM.js → components-csr/p-C4_7YnHT.js} +2 -2
  381. package/dist/{components/p-BwXpiUsu.js → components-csr/p-CG6FaRlt.js} +2 -2
  382. package/dist/{components/p-B0Opn6dK.js → components-csr/p-CSrxeWwL.js} +2 -2
  383. package/dist/components-csr/p-C_ogF68H.js +2 -0
  384. package/dist/components-csr/p-C_ogF68H.js.map +1 -0
  385. package/dist/components-csr/p-Cch_V1vi.js +2 -0
  386. package/dist/components-csr/p-Cch_V1vi.js.map +1 -0
  387. package/dist/components-csr/p-CfBPnYW7.js +2 -0
  388. package/dist/components-csr/p-CfBPnYW7.js.map +1 -0
  389. package/dist/{components/p-B3MWYEEJ.js → components-csr/p-CrbzXk64.js} +2 -2
  390. package/dist/components-csr/p-CxhZdOPw.js +2 -0
  391. package/dist/components-csr/p-CxhZdOPw.js.map +1 -0
  392. package/dist/{components/p-7fN_yCXW.js → components-csr/p-DF19mmLl.js} +2 -2
  393. package/dist/components-csr/p-DWxN44zD.js +2 -0
  394. package/dist/components-csr/p-DWxN44zD.js.map +1 -0
  395. package/dist/components-csr/p-DYBUr7K_.js +2 -0
  396. package/dist/components-csr/p-DYBUr7K_.js.map +1 -0
  397. package/dist/{components/p-e2HRV63Y.js → components-csr/p-DfcpeJAu.js} +2 -2
  398. package/dist/components-csr/p-DvOKnoqK.js +2 -0
  399. package/dist/components-csr/p-DvOKnoqK.js.map +1 -0
  400. package/dist/{components/p-C8EP4S21.js → components-csr/p-DvXQXhgu.js} +2 -2
  401. package/dist/components-csr/p-DzPKu-Ma.js +2 -0
  402. package/dist/components-csr/p-DzPKu-Ma.js.map +1 -0
  403. package/dist/{components/p-stybaFzj.js → components-csr/p-Hm3X1iai.js} +2 -2
  404. package/dist/{components/p-6wZSqm_2.js → components-csr/p-IWA0yIjJ.js} +2 -2
  405. package/dist/components-csr/p-RLxbNqRv.js +2 -0
  406. package/dist/components-csr/p-RLxbNqRv.js.map +1 -0
  407. package/dist/components-csr/p-bSpXNc5J.js +2 -0
  408. package/dist/components-csr/p-bSpXNc5J.js.map +1 -0
  409. package/dist/components-csr/p-uZbtHo-A.js +2 -0
  410. package/dist/components-csr/package.json +3 -0
  411. package/dist/esm/app-globals-DQuL1Twl.js +6 -0
  412. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  413. package/dist/esm/engine.wasm-CfBPnYW7.js +10 -0
  414. package/dist/esm/engine.wasm-CfBPnYW7.js.map +1 -0
  415. package/dist/esm/{index-DTaX19_O.js → index-WmvQpZnM.js} +5 -15
  416. package/dist/esm/index-WmvQpZnM.js.map +1 -0
  417. package/dist/esm/loader.js +3 -2
  418. package/dist/esm/loader.js.map +1 -1
  419. package/dist/esm/md-accordion-item.entry.js +1 -1
  420. package/dist/esm/md-accordion.entry.js +1 -1
  421. package/dist/esm/md-app-bar.entry.js +1 -1
  422. package/dist/esm/md-area-chart.entry.js +1 -1
  423. package/dist/esm/md-autocomplete.entry.js +2 -2
  424. package/dist/esm/md-avatar_2.entry.js +1 -1
  425. package/dist/esm/md-badge.entry.js +1 -1
  426. package/dist/esm/md-bar-chart.entry.js +1 -1
  427. package/dist/esm/md-bottom-sheet.entry.js +1 -1
  428. package/dist/esm/md-breadcrumb-item.entry.js +1 -1
  429. package/dist/esm/md-breadcrumbs.entry.js +1 -1
  430. package/dist/esm/md-button-group.entry.js +1 -1
  431. package/dist/esm/md-button_7.entry.js +1 -1
  432. package/dist/esm/md-checkbox.entry.js +1 -1
  433. package/dist/esm/md-chip.entry.js +1 -1
  434. package/dist/esm/md-color-picker.entry.js +1 -1
  435. package/dist/esm/md-date-picker.entry.js +1 -1
  436. package/dist/esm/md-dialog.entry.js +1 -1
  437. package/dist/esm/md-divider.entry.js +1 -1
  438. package/dist/esm/md-fab-menu-item.entry.js +1 -1
  439. package/dist/esm/md-fab-menu.entry.js +1 -1
  440. package/dist/esm/md-fab.entry.js +1 -1
  441. package/dist/esm/md-line-chart.entry.js +1 -1
  442. package/dist/esm/md-list-item.entry.js +1 -1
  443. package/dist/esm/md-list.entry.js +1 -1
  444. package/dist/esm/md-menu-item-group.entry.js +1 -1
  445. package/dist/esm/md-menu_2.entry.js +1 -1
  446. package/dist/esm/md-meter.entry.js +1 -1
  447. package/dist/esm/md-multi-select.entry.js +2 -2
  448. package/dist/esm/md-navigation-bar.entry.js +1 -1
  449. package/dist/esm/md-navigation-rail-tab.entry.js +1 -1
  450. package/dist/esm/md-navigation-rail.entry.js +1 -1
  451. package/dist/esm/md-navigation-tab.entry.js +1 -1
  452. package/dist/esm/md-number-field.entry.js +1 -1
  453. package/dist/esm/md-organization-chart.entry.js +1 -1
  454. package/dist/esm/md-otp-field.entry.js +1 -1
  455. package/dist/esm/md-pie-chart.entry.js +1 -1
  456. package/dist/esm/md-progress-indicator.entry.js +1 -1
  457. package/dist/esm/md-rating.entry.js +1 -1
  458. package/dist/esm/md-search.entry.js +1 -1
  459. package/dist/esm/md-segmented-button-set.entry.js +1 -1
  460. package/dist/esm/md-segmented-button.entry.js +1 -1
  461. package/dist/esm/md-select-option.entry.js +1 -1
  462. package/dist/esm/md-select.entry.js +2 -2
  463. package/dist/esm/md-side-sheet.entry.js +1 -1
  464. package/dist/esm/md-skeleton.entry.js +1 -1
  465. package/dist/esm/md-slider.entry.js +1 -1
  466. package/dist/esm/md-sparkline.entry.js +1 -1
  467. package/dist/esm/md-split-button.entry.js +1 -1
  468. package/dist/esm/md-status-dot.entry.js +1 -1
  469. package/dist/esm/md-step.entry.js +1 -1
  470. package/dist/esm/md-stepper.entry.js +1 -1
  471. package/dist/esm/md-sub-menu-item.entry.js +1 -1
  472. package/dist/esm/md-switch.entry.js +1 -1
  473. package/dist/esm/md-tab-panel.entry.js +1 -1
  474. package/dist/esm/md-tab-panels.entry.js +1 -1
  475. package/dist/esm/md-tab.entry.js +1 -1
  476. package/dist/esm/md-table-body.entry.js +1 -1
  477. package/dist/esm/md-table-cell.entry.js +1 -1
  478. package/dist/esm/md-table-container.entry.js +1 -1
  479. package/dist/esm/md-table-expand-toggle.entry.js +1 -1
  480. package/dist/esm/md-table-foot.entry.js +1 -1
  481. package/dist/esm/md-table-head.entry.js +1 -1
  482. package/dist/esm/md-table-pagination.entry.js +1 -1
  483. package/dist/esm/md-table-row.entry.js +1 -1
  484. package/dist/esm/md-table-sort-label.entry.js +1 -1
  485. package/dist/esm/md-table-toolbar.entry.js +1 -1
  486. package/dist/esm/md-table.entry.js +1 -1
  487. package/dist/esm/md-tabs.entry.js +1 -1
  488. package/dist/esm/md-text-field.entry.js +1 -1
  489. package/dist/esm/md-time-picker.entry.js +1 -1
  490. package/dist/esm/md-toolbar.entry.js +1 -1
  491. package/dist/esm/md-transfer-list.entry.js +1 -1
  492. package/dist/esm/md3.js +3 -2
  493. package/dist/esm/md3.js.map +1 -1
  494. package/dist/esm/{virtual-select-controller-BEWIC0pC.js → virtual-select-controller-CR60w6DO.js} +10 -9
  495. package/dist/esm/virtual-select-controller-CR60w6DO.js.map +1 -0
  496. package/dist/md3/md3.css +1 -1
  497. package/dist/md3/md3.esm.js +1 -1
  498. package/dist/md3/md3.esm.js.map +1 -1
  499. package/dist/md3/{p-2e9503d7.entry.js → p-0a599351.entry.js} +2 -2
  500. package/dist/md3/p-1d7e0203.entry.js +2 -0
  501. package/dist/md3/{p-fb61868c.entry.js.map → p-1d7e0203.entry.js.map} +1 -1
  502. package/dist/md3/p-1e85b8a8.entry.js +2 -0
  503. package/dist/md3/{p-aaec2698.entry.js.map → p-1e85b8a8.entry.js.map} +1 -1
  504. package/dist/md3/{p-396089fd.entry.js → p-1edb5a0d.entry.js} +2 -2
  505. package/dist/md3/{p-c00f7514.entry.js → p-21c89d1d.entry.js} +2 -2
  506. package/dist/md3/p-22633b2d.entry.js +2 -0
  507. package/dist/md3/{p-6b2871a0.entry.js.map → p-22633b2d.entry.js.map} +1 -1
  508. package/dist/md3/{p-2e09a7b7.entry.js → p-27135a6b.entry.js} +2 -2
  509. package/dist/md3/{p-c063c823.entry.js → p-2befc42c.entry.js} +2 -2
  510. package/dist/md3/p-2dda08b2.entry.js +2 -0
  511. package/dist/md3/{p-21772851.entry.js.map → p-2dda08b2.entry.js.map} +1 -1
  512. package/dist/md3/p-3508d0e0.entry.js +2 -0
  513. package/dist/md3/{p-f31ab454.entry.js.map → p-3508d0e0.entry.js.map} +1 -1
  514. package/dist/md3/{p-b34d385b.entry.js → p-35b05b45.entry.js} +2 -2
  515. package/dist/md3/{p-c2dd8c8c.entry.js → p-38e9a583.entry.js} +2 -2
  516. package/dist/md3/{p-3cce1de3.entry.js → p-38f82d34.entry.js} +2 -2
  517. package/dist/md3/p-3a4bd4eb.entry.js +2 -0
  518. package/dist/md3/{p-72457a85.entry.js.map → p-3a4bd4eb.entry.js.map} +1 -1
  519. package/dist/md3/{p-be02624e.entry.js → p-3c0469aa.entry.js} +2 -2
  520. package/dist/md3/{p-63b8c8d1.entry.js → p-408ee4be.entry.js} +2 -2
  521. package/dist/md3/{p-3015c7e3.entry.js → p-4770b534.entry.js} +2 -2
  522. package/dist/md3/p-4aed552f.entry.js +2 -0
  523. package/dist/md3/{p-6c44cf13.entry.js.map → p-4aed552f.entry.js.map} +1 -1
  524. package/dist/md3/{p-c5af701b.entry.js → p-4ba3623e.entry.js} +2 -2
  525. package/dist/md3/{p-7b463fbe.entry.js → p-4f2e82cb.entry.js} +2 -2
  526. package/dist/md3/{p-be412e3f.entry.js → p-501bf161.entry.js} +2 -2
  527. package/dist/md3/{p-81843ff7.entry.js → p-5929e59c.entry.js} +2 -2
  528. package/dist/md3/{p-32bdd439.entry.js → p-5c35f916.entry.js} +2 -2
  529. package/dist/md3/{p-ac35ac5f.entry.js → p-5db87a9d.entry.js} +2 -2
  530. package/dist/md3/{p-6038b907.entry.js → p-5f39b49d.entry.js} +2 -2
  531. package/dist/md3/p-637baee1.entry.js +2 -0
  532. package/dist/md3/{p-47af9819.entry.js.map → p-637baee1.entry.js.map} +1 -1
  533. package/dist/md3/{p-05ae91b6.entry.js → p-6bf632c7.entry.js} +2 -2
  534. package/dist/md3/{p-4e3d6e40.entry.js → p-6ea7117d.entry.js} +2 -2
  535. package/dist/md3/{p-9ddbf247.entry.js → p-7112374d.entry.js} +2 -2
  536. package/dist/md3/{p-1a8ec5bc.entry.js → p-7858833e.entry.js} +2 -2
  537. package/dist/md3/p-7c8842bf.entry.js +2 -0
  538. package/dist/md3/{p-ba2ebde1.entry.js.map → p-7c8842bf.entry.js.map} +1 -1
  539. package/dist/md3/{p-4d82132d.entry.js → p-7f53a423.entry.js} +2 -2
  540. package/dist/md3/{p-b0431a5c.entry.js → p-8135c606.entry.js} +2 -2
  541. package/dist/md3/{p-4dda4cb0.entry.js → p-845ca9cc.entry.js} +2 -2
  542. package/dist/md3/{p-5b74694e.entry.js → p-89d47130.entry.js} +2 -2
  543. package/dist/md3/p-8a6fed13.entry.js +2 -0
  544. package/dist/md3/{p-a803da99.entry.js.map → p-8a6fed13.entry.js.map} +1 -1
  545. package/dist/md3/{p-e3124e1e.entry.js → p-8b1ea5dc.entry.js} +2 -2
  546. package/dist/md3/{p-c10a33c2.entry.js → p-8e7df348.entry.js} +2 -2
  547. package/dist/md3/{p-65195996.entry.js → p-925768ac.entry.js} +2 -2
  548. package/dist/md3/p-944e69e0.entry.js +2 -0
  549. package/dist/md3/{p-a3308c40.entry.js.map → p-944e69e0.entry.js.map} +1 -1
  550. package/dist/md3/{p-ac8762e5.entry.js → p-96c06b24.entry.js} +2 -2
  551. package/dist/md3/p-9b9677cc.entry.js +2 -0
  552. package/dist/md3/{p-e7dc5a32.entry.js.map → p-9b9677cc.entry.js.map} +1 -1
  553. package/dist/md3/p-Bz-JaJcA.js +2 -0
  554. package/dist/md3/p-Bz-JaJcA.js.map +1 -0
  555. package/dist/md3/p-CfBPnYW7.js +2 -0
  556. package/dist/md3/p-CfBPnYW7.js.map +1 -0
  557. package/dist/md3/p-DQuL1Twl.js +2 -0
  558. package/dist/md3/p-DQuL1Twl.js.map +1 -0
  559. package/dist/md3/p-WmvQpZnM.js +3 -0
  560. package/dist/md3/p-WmvQpZnM.js.map +1 -0
  561. package/dist/md3/p-a3623653.entry.js +2 -0
  562. package/dist/md3/{p-19ee9c33.entry.js.map → p-a3623653.entry.js.map} +1 -1
  563. package/dist/md3/{p-a5fee424.entry.js → p-a49df43d.entry.js} +2 -2
  564. package/dist/md3/{p-da4e27d4.entry.js → p-a4d4cfed.entry.js} +2 -2
  565. package/dist/md3/{p-5394254f.entry.js → p-a976498b.entry.js} +2 -2
  566. package/dist/md3/{p-bf7842f8.entry.js → p-adf8a415.entry.js} +2 -2
  567. package/dist/md3/{p-c861d774.entry.js → p-ae360663.entry.js} +2 -2
  568. package/dist/md3/{p-8eb0b6a4.entry.js → p-b243284b.entry.js} +2 -2
  569. package/dist/md3/{p-45280bf4.entry.js → p-b2d88292.entry.js} +2 -2
  570. package/dist/md3/{p-796f79f8.entry.js → p-b3b5247b.entry.js} +2 -2
  571. package/dist/md3/{p-5b799707.entry.js → p-b4266f6b.entry.js} +2 -2
  572. package/dist/md3/p-b5586b66.entry.js +2 -0
  573. package/dist/md3/{p-04e97f5d.entry.js.map → p-b5586b66.entry.js.map} +1 -1
  574. package/dist/md3/{p-a7ffb779.entry.js → p-b7602557.entry.js} +2 -2
  575. package/dist/md3/{p-6ba63c73.entry.js → p-bc24f0c9.entry.js} +2 -2
  576. package/dist/md3/{p-edb34a6d.entry.js → p-bed8dfec.entry.js} +2 -2
  577. package/dist/md3/{p-50555bb7.entry.js → p-c0476406.entry.js} +2 -2
  578. package/dist/md3/{p-0c2e824d.entry.js → p-c20fbb9e.entry.js} +2 -2
  579. package/dist/md3/{p-4e45b2ff.entry.js → p-c58c68d0.entry.js} +2 -2
  580. package/dist/md3/{p-fc0b325d.entry.js → p-cdcea99f.entry.js} +2 -2
  581. package/dist/md3/{p-0f764a1e.entry.js → p-d2e39c6e.entry.js} +2 -2
  582. package/dist/md3/p-d7e99f9e.entry.js +2 -0
  583. package/dist/md3/{p-cf07e761.entry.js.map → p-d7e99f9e.entry.js.map} +1 -1
  584. package/dist/md3/{p-c1ca6f6c.entry.js → p-da0c36d9.entry.js} +2 -2
  585. package/dist/md3/{p-77a01bcc.entry.js → p-e3c37222.entry.js} +2 -2
  586. package/dist/md3/{p-39cb7c24.entry.js → p-e6b09e71.entry.js} +2 -2
  587. package/dist/md3/{p-b4631a55.entry.js → p-eddae19a.entry.js} +2 -2
  588. package/dist/md3/{p-c6a12344.entry.js → p-ef7b1826.entry.js} +2 -2
  589. package/dist/md3/p-f1b69181.entry.js +2 -0
  590. package/dist/md3/{p-a986fd24.entry.js.map → p-f1b69181.entry.js.map} +1 -1
  591. package/dist/md3/{p-e6d7f0ff.entry.js → p-f403ad20.entry.js} +2 -2
  592. package/dist/md3/{p-708a9313.entry.js → p-f5fd9a0b.entry.js} +2 -2
  593. package/dist/md3/{p-aa0e7d4d.entry.js → p-f71af38f.entry.js} +2 -2
  594. package/dist/md3/{p-757e3aaf.entry.js → p-fac6da4c.entry.js} +2 -2
  595. package/dist/md3/{p-134b670a.entry.js → p-fc864f96.entry.js} +2 -2
  596. package/dist/types/wasm/engine-abi.d.ts +14 -0
  597. package/hydrate/index.js +19 -7
  598. package/hydrate/index.mjs +19 -7
  599. package/package.json +14 -3
  600. package/dist/cjs/index-DlQ_5_Mv.js.map +0 -1
  601. package/dist/cjs/virtual-select-controller-CqriaZgm.js.map +0 -1
  602. package/dist/components/p-BEWIC0pC.js +0 -2
  603. package/dist/components/p-BEWIC0pC.js.map +0 -1
  604. package/dist/components/p-MWBNn6Lj.js +0 -2
  605. package/dist/components/p-MWBNn6Lj.js.map +0 -1
  606. package/dist/esm/index-DTaX19_O.js.map +0 -1
  607. package/dist/esm/virtual-select-controller-BEWIC0pC.js.map +0 -1
  608. package/dist/md3/p-04e97f5d.entry.js +0 -2
  609. package/dist/md3/p-19ee9c33.entry.js +0 -2
  610. package/dist/md3/p-21772851.entry.js +0 -2
  611. package/dist/md3/p-47af9819.entry.js +0 -2
  612. package/dist/md3/p-6b2871a0.entry.js +0 -2
  613. package/dist/md3/p-6c44cf13.entry.js +0 -2
  614. package/dist/md3/p-72457a85.entry.js +0 -2
  615. package/dist/md3/p-BEWIC0pC.js +0 -2
  616. package/dist/md3/p-BEWIC0pC.js.map +0 -1
  617. package/dist/md3/p-DTaX19_O.js +0 -3
  618. package/dist/md3/p-DTaX19_O.js.map +0 -1
  619. package/dist/md3/p-a3308c40.entry.js +0 -2
  620. package/dist/md3/p-a803da99.entry.js +0 -2
  621. package/dist/md3/p-a986fd24.entry.js +0 -2
  622. package/dist/md3/p-aaec2698.entry.js +0 -2
  623. package/dist/md3/p-ba2ebde1.entry.js +0 -2
  624. package/dist/md3/p-cf07e761.entry.js +0 -2
  625. package/dist/md3/p-e7dc5a32.entry.js +0 -2
  626. package/dist/md3/p-f31ab454.entry.js +0 -2
  627. package/dist/md3/p-fb61868c.entry.js +0 -2
  628. /package/dist/{components/p-DXXUoRSH.js.map → components-csr/p--OUYjgKN.js.map} +0 -0
  629. /package/dist/{components/p-Dp-w93ot.js.map → components-csr/p--TCJgZnE.js.map} +0 -0
  630. /package/dist/{components/p-UdGDg2oJ.js.map → components-csr/p-Bmu7RqHM.js.map} +0 -0
  631. /package/dist/{components/p-uTEkf0sE.js.map → components-csr/p-C0DlKmRg.js.map} +0 -0
  632. /package/dist/{components/p-Ch2-tttM.js.map → components-csr/p-C4_7YnHT.js.map} +0 -0
  633. /package/dist/{components/p-BwXpiUsu.js.map → components-csr/p-CG6FaRlt.js.map} +0 -0
  634. /package/dist/{components/p-B0Opn6dK.js.map → components-csr/p-CSrxeWwL.js.map} +0 -0
  635. /package/dist/{components/p-B3MWYEEJ.js.map → components-csr/p-CrbzXk64.js.map} +0 -0
  636. /package/dist/{components/p-7fN_yCXW.js.map → components-csr/p-DF19mmLl.js.map} +0 -0
  637. /package/dist/{components/p-e2HRV63Y.js.map → components-csr/p-DfcpeJAu.js.map} +0 -0
  638. /package/dist/{components/p-C8EP4S21.js.map → components-csr/p-DvXQXhgu.js.map} +0 -0
  639. /package/dist/{components/p-stybaFzj.js.map → components-csr/p-Hm3X1iai.js.map} +0 -0
  640. /package/dist/{components/p-6wZSqm_2.js.map → components-csr/p-IWA0yIjJ.js.map} +0 -0
  641. /package/dist/{components/p-Ddiw2Kjw.js.map → components-csr/p-uZbtHo-A.js.map} +0 -0
  642. /package/dist/md3/{p-2e9503d7.entry.js.map → p-0a599351.entry.js.map} +0 -0
  643. /package/dist/md3/{p-396089fd.entry.js.map → p-1edb5a0d.entry.js.map} +0 -0
  644. /package/dist/md3/{p-c00f7514.entry.js.map → p-21c89d1d.entry.js.map} +0 -0
  645. /package/dist/md3/{p-2e09a7b7.entry.js.map → p-27135a6b.entry.js.map} +0 -0
  646. /package/dist/md3/{p-c063c823.entry.js.map → p-2befc42c.entry.js.map} +0 -0
  647. /package/dist/md3/{p-b34d385b.entry.js.map → p-35b05b45.entry.js.map} +0 -0
  648. /package/dist/md3/{p-c2dd8c8c.entry.js.map → p-38e9a583.entry.js.map} +0 -0
  649. /package/dist/md3/{p-3cce1de3.entry.js.map → p-38f82d34.entry.js.map} +0 -0
  650. /package/dist/md3/{p-be02624e.entry.js.map → p-3c0469aa.entry.js.map} +0 -0
  651. /package/dist/md3/{p-63b8c8d1.entry.js.map → p-408ee4be.entry.js.map} +0 -0
  652. /package/dist/md3/{p-3015c7e3.entry.js.map → p-4770b534.entry.js.map} +0 -0
  653. /package/dist/md3/{p-c5af701b.entry.js.map → p-4ba3623e.entry.js.map} +0 -0
  654. /package/dist/md3/{p-7b463fbe.entry.js.map → p-4f2e82cb.entry.js.map} +0 -0
  655. /package/dist/md3/{p-be412e3f.entry.js.map → p-501bf161.entry.js.map} +0 -0
  656. /package/dist/md3/{p-81843ff7.entry.js.map → p-5929e59c.entry.js.map} +0 -0
  657. /package/dist/md3/{p-32bdd439.entry.js.map → p-5c35f916.entry.js.map} +0 -0
  658. /package/dist/md3/{p-ac35ac5f.entry.js.map → p-5db87a9d.entry.js.map} +0 -0
  659. /package/dist/md3/{p-6038b907.entry.js.map → p-5f39b49d.entry.js.map} +0 -0
  660. /package/dist/md3/{p-05ae91b6.entry.js.map → p-6bf632c7.entry.js.map} +0 -0
  661. /package/dist/md3/{p-4e3d6e40.entry.js.map → p-6ea7117d.entry.js.map} +0 -0
  662. /package/dist/md3/{p-9ddbf247.entry.js.map → p-7112374d.entry.js.map} +0 -0
  663. /package/dist/md3/{p-1a8ec5bc.entry.js.map → p-7858833e.entry.js.map} +0 -0
  664. /package/dist/md3/{p-4d82132d.entry.js.map → p-7f53a423.entry.js.map} +0 -0
  665. /package/dist/md3/{p-b0431a5c.entry.js.map → p-8135c606.entry.js.map} +0 -0
  666. /package/dist/md3/{p-4dda4cb0.entry.js.map → p-845ca9cc.entry.js.map} +0 -0
  667. /package/dist/md3/{p-5b74694e.entry.js.map → p-89d47130.entry.js.map} +0 -0
  668. /package/dist/md3/{p-e3124e1e.entry.js.map → p-8b1ea5dc.entry.js.map} +0 -0
  669. /package/dist/md3/{p-c10a33c2.entry.js.map → p-8e7df348.entry.js.map} +0 -0
  670. /package/dist/md3/{p-65195996.entry.js.map → p-925768ac.entry.js.map} +0 -0
  671. /package/dist/md3/{p-ac8762e5.entry.js.map → p-96c06b24.entry.js.map} +0 -0
  672. /package/dist/md3/{p-a5fee424.entry.js.map → p-a49df43d.entry.js.map} +0 -0
  673. /package/dist/md3/{p-da4e27d4.entry.js.map → p-a4d4cfed.entry.js.map} +0 -0
  674. /package/dist/md3/{p-5394254f.entry.js.map → p-a976498b.entry.js.map} +0 -0
  675. /package/dist/md3/{p-bf7842f8.entry.js.map → p-adf8a415.entry.js.map} +0 -0
  676. /package/dist/md3/{p-c861d774.entry.js.map → p-ae360663.entry.js.map} +0 -0
  677. /package/dist/md3/{p-8eb0b6a4.entry.js.map → p-b243284b.entry.js.map} +0 -0
  678. /package/dist/md3/{p-45280bf4.entry.js.map → p-b2d88292.entry.js.map} +0 -0
  679. /package/dist/md3/{p-796f79f8.entry.js.map → p-b3b5247b.entry.js.map} +0 -0
  680. /package/dist/md3/{p-5b799707.entry.js.map → p-b4266f6b.entry.js.map} +0 -0
  681. /package/dist/md3/{p-a7ffb779.entry.js.map → p-b7602557.entry.js.map} +0 -0
  682. /package/dist/md3/{p-6ba63c73.entry.js.map → p-bc24f0c9.entry.js.map} +0 -0
  683. /package/dist/md3/{p-edb34a6d.entry.js.map → p-bed8dfec.entry.js.map} +0 -0
  684. /package/dist/md3/{p-50555bb7.entry.js.map → p-c0476406.entry.js.map} +0 -0
  685. /package/dist/md3/{p-0c2e824d.entry.js.map → p-c20fbb9e.entry.js.map} +0 -0
  686. /package/dist/md3/{p-4e45b2ff.entry.js.map → p-c58c68d0.entry.js.map} +0 -0
  687. /package/dist/md3/{p-fc0b325d.entry.js.map → p-cdcea99f.entry.js.map} +0 -0
  688. /package/dist/md3/{p-0f764a1e.entry.js.map → p-d2e39c6e.entry.js.map} +0 -0
  689. /package/dist/md3/{p-c1ca6f6c.entry.js.map → p-da0c36d9.entry.js.map} +0 -0
  690. /package/dist/md3/{p-77a01bcc.entry.js.map → p-e3c37222.entry.js.map} +0 -0
  691. /package/dist/md3/{p-39cb7c24.entry.js.map → p-e6b09e71.entry.js.map} +0 -0
  692. /package/dist/md3/{p-b4631a55.entry.js.map → p-eddae19a.entry.js.map} +0 -0
  693. /package/dist/md3/{p-c6a12344.entry.js.map → p-ef7b1826.entry.js.map} +0 -0
  694. /package/dist/md3/{p-e6d7f0ff.entry.js.map → p-f403ad20.entry.js.map} +0 -0
  695. /package/dist/md3/{p-708a9313.entry.js.map → p-f5fd9a0b.entry.js.map} +0 -0
  696. /package/dist/md3/{p-aa0e7d4d.entry.js.map → p-f71af38f.entry.js.map} +0 -0
  697. /package/dist/md3/{p-757e3aaf.entry.js.map → p-fac6da4c.entry.js.map} +0 -0
  698. /package/dist/md3/{p-134b670a.entry.js.map → p-fc864f96.entry.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ import{p as t,H as s,c as i,f as e,h as a,d as n,t as r}from"./p-bSpXNc5J.js";import{V as o,i as l,n as h,r as d,c,l as m}from"./p-Bz-JaJcA.js";import{s as p,a as u,g as f,c as g,r as y}from"./p-DWxN44zD.js";import{p as b}from"./p-CxhZdOPw.js";import{d as _}from"./p-IWA0yIjJ.js";import{d as x}from"./p-CG6FaRlt.js";import{d as v}from"./p-CSrxeWwL.js";import{d as w}from"./p-DF19mmLl.js";import{d as k}from"./p-DfcpeJAu.js";import{d as z}from"./p-Hm3X1iai.js";import{d as C}from"./p-CrbzXk64.js";const V=()=>`:host{--md-text-field-padding-inline-end:var(--md-sys-spacing-inset-lg, 16px);display:inline-block;inline-size:var(--md-select-width, 100%);min-inline-size:var(--md-select-min-width, 0);box-sizing:border-box;font-family:var(--md-sys-typescale-body-large-font-family, Roboto, sans-serif)}.md-select__field{inline-size:100%;cursor:pointer;--md-text-field-cursor:pointer}.md-select__field::part(input){cursor:pointer}:host(.md-select--disabled) .md-select__field::part(input){cursor:not-allowed}.md-select__field .md-select__trailing{display:inline-flex;align-items:center;gap:var(--md-select-trailing-gap, 2px);width:auto;height:auto}.md-select__caret{font-size:var(--md-select-caret-size, 24px);line-height:1;color:var(--md-select-caret-color, var(--md-sys-color-on-surface-variant, #49454F));transition:transform var(--md-sys-motion-duration-short4, 200ms) var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1))}:host(.md-select--open) .md-select__caret{transform:rotate(180deg)}@media (prefers-reduced-motion: reduce){.md-select__caret{transition:none}}.md-select__loader{display:inline-flex;align-items:center;justify-content:center;inline-size:24px;block-size:24px;--md-loading-indicator-size:var(--md-select-spinner-size, 22px);--md-loading-indicator-shape-size:var(--md-select-spinner-size, 22px)}:host([full-width]){display:block;inline-size:100%}.md-select__loading{display:flex;align-items:center;padding-block:var(--md-sys-spacing-inset-lg, 16px);padding-inline:var(--md-sys-spacing-inset-lg, 16px)}.md-select__loading md-progress-indicator{inline-size:100%}.md-select__field .md-select__clear{--_clear-color:var(--md-select-clear-color, var(--md-select-caret-color, var(--md-sys-color-on-surface-variant, #49454F)));--md-icon-button-container-width:24px;--md-icon-button-container-height:24px;--md-icon-button-icon-size:18px;--md-icon-button-icon-color:var(--_clear-color);--md-icon-button-state-layer-color:var(--_clear-color)}.md-select__option-icon{font-size:20px;line-height:1;color:var(--md-select-option-icon-color, var(--md-sys-color-on-surface-variant, #49454F))}:host(.md-select--disabled){cursor:default}:host(.md-select--disabled) .md-select__field{--md-text-field-cursor:not-allowed}.material-symbols-outlined{font-family:var(--md-sys-icon-font-family, 'Material Symbols Outlined', 'Material Icons');font-weight:normal;font-style:normal;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;overflow-wrap:normal;direction:ltr;font-feature-settings:'liga';-webkit-font-smoothing:antialiased}.md-select__vspacer{display:block;flex:none;pointer-events:none}.md-select__search-wrap{position:relative;display:block}.md-select__search{box-sizing:border-box;width:100%;border:none;outline:none;padding:12px 44px 12px 16px;font:inherit;color:var(--md-sys-color-on-surface, #1d1b20);background:var(--md-sys-color-surface-container, #f3edf7);border-bottom:1px solid var(--md-sys-color-outline-variant, #cac4d0)}.md-select__search::placeholder{color:var(--md-sys-color-on-surface-variant, #49454f)}.md-select__search-spinner{position:absolute;inset-block-start:50%;inset-inline-end:12px;margin-block-start:-12px;--md-loading-indicator-size:24px;--md-loading-indicator-shape-size:18px;pointer-events:none}:host([density='-1']){--md-sys-density-scale:-1}:host([density='-2']){--md-sys-density-scale:-2}:host([density='-3']){--md-sys-density-scale:-3}:host([density='-4']){--md-sys-density-scale:-4}`;let O=0;const M=200;const T=180;const $=t(class t extends s{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.mdChange=i(this,"mdChange",7);this.mdOpen=i(this,"mdOpen",7);this.mdClose=i(this,"mdClose",7);this.mdValidityChange=i(this,"mdValidityChange",5);this.internals=this.attachInternals();this.valueMissingLabel="Please select an item in the list.";this.reserveSupportingSpace=false;this.customValidityMessage="";this.variant="outlined";this.label="";this.placeholder="";this.value="";this.disabled=false;this.required=false;this.error=false;this.errorText="";this.supportingText="";this.density=0;this.clearable=false;this.matchTriggerWidth=true;this.placement="bottom-start";this.options=[];this.virtualize="auto";this.filterable=false;this.filterMode="substring";this.name="";this.searchPlaceholder="Search…";this.filterLabel="";this.noResultsText="No results";this.noOptionsText="No options";this.clearLabel="Clear selection";this.searchingLabel="Searching";this.loadingText="Loading…";this.clearIcon="close";this.dropdownIcon="arrow_drop_down";this.loading=false;this.fullWidth=false;this.open=false;this.optionsData=[];this.triggerId=`md-select-${++O}`;this.vc=new o({queryItem:t=>this.el.shadowRoot?.querySelector(`md-menu-item[data-vindex="${t}"]`)??null,requestRender:()=>e(this)});this.providerSet=false;this.selectedLabel="";this.query="";this.searching=false;this.queryText=null;this.defaultValue="";this.lastValidityKey=null;this._syncGuard=false;this._lastEmit=null;this.toggleOpen=()=>{if(this.disabled)return;this.open=!this.open};this.selectValue=t=>{if(this.value===t){this.open=false;return}this.value=t;this.mdChange.emit(t);this.open=false;this.fieldEl?.focus?.()};this.clearValue=t=>{t.stopPropagation();if(this.disabled||!this.value)return;this.value="";this.mdChange.emit("")};this.vpWired=false;this.handleMenuOpen=()=>{this._syncGuard=true;this.open=true;this._syncGuard=false;if(this._lastEmit!=="open"){this._lastEmit="open";this.mdOpen.emit()}if(this.vc.active){this.wireViewport();if(this.filterable){requestAnimationFrame((()=>{const t=this.el.shadowRoot?.querySelector(".md-select__search");t?.focus();void this.menuEl?.setComboboxElement?.(t)}))}}};this.handleMenuClose=()=>{this._syncGuard=true;this.open=false;this._syncGuard=false;if(this.query)this.query="";if(this._lastEmit!=="close"){this._lastEmit="close";this.mdClose.emit()}void this.menuEl?.setComboboxElement?.(null);this.vc.detachViewport();this.vpWired=false};this.onSearchInput=t=>{const s=t.target.value;this.queryText=null;if(!this.vc.active){this.query=s;return}if(!this.searching){this.searching=true;e(this)}clearTimeout(this.searchDebounce);this.searchDebounce=setTimeout((()=>{this.vc.setQuery(s);this.searching=false;e(this)}),T)}}get optionList(){return b(this.options,"md-select","options")}async show(){if(this.disabled)return;this.open=true}async close(){this.open=false}async focusTrigger(){this.fieldEl?.focus?.()}async reset(){if(!this.value)return;this.value="";this.mdChange.emit("")}async loadOptions(t){if(this.virtualize==="never"||!l()){this.vc.reset();this.optionsData=h(d(t));return}this.optionsData=[];this.vc.setFixedRowHeight(this.rowHeight);this.vc.setFilterMode(this.filterMode);const s=await this.vc.load(t);if(!s){this.vc.reset();this.optionsData=h(d(t))}else{this.updateSelectedLabel()}e(this)}async setQuery(t){this.vc.setQuery(t);if(!this.vc.active)this.query=t;this.queryText=t;this.syncSearchField();e(this)}syncSearchField(){if(this.queryText===null)return;const t=this.el.shadowRoot?.querySelector(".md-select__search");if(!t)return;t.value=this.queryText;this.queryText=null}async getLabels(t){return Object.fromEntries(this.vc.getLabels(t))}componentWillLoad(){this.refreshOptions();if(!this.value){const t=this.optionsData.find((t=>t.selected&&!t.disabled));if(t)this.value=t.value}this.defaultValue=this.value;this.syncFormValue()}syncFormValue(){p(this.internals,this.value||null);this.updateSelectedLabel();this.syncValidity()}syncValidity(){u(this.internals,{missing:this.required&&!this.value,missingMessage:this.valueMissingLabel,customMessage:this.customValidityMessage});this.emitValidityChange()}async getValidity(){return f(this.internals)}emitValidityChange(){const t=f(this.internals);const s=`${t.valid}|${t.validationMessage}`;if(this.lastValidityKey===s)return;const i=this.lastValidityKey!==null;this.lastValidityKey=s;if(i)this.mdValidityChange.emit(t)}async checkValidity(){return g(this.internals)}async reportValidity(){return y(this.internals)}async setCustomValidity(t){this.customValidityMessage=t;this.syncValidity()}formResetCallback(){this.value=this.defaultValue}refreshOptions(){const t=c(this.el,this.optionList);const s=this.virtualize==="always"||this.virtualize==="auto"&&t.length>M;if(s&&l()&&t.length>0){this.optionsData=[];this.vc.setFixedRowHeight(this.rowHeight);this.vc.setFilterMode(this.filterMode);void this.vc.load(t).then((s=>{if(!s){this.optionsData=t;e(this)}else{this.updateSelectedLabel()}}))}else{this.vc.reset();this.optionsData=t}}updateSelectedLabel(){if(!this.value){this.selectedLabel=""}else if(this.vc.active){this.selectedLabel=this.vc.getLabels([this.value]).get(this.value)??this.selectedLabel}e(this)}onOptionChange(t){t.stopPropagation();this.refreshOptions()}syncMenu(t){if(this._syncGuard||!this.menuEl)return;if(t){this.menuEl.show?.({autoFocus:!(this.filterable&&this.vc.active)})}else{this.menuEl.close?.()}}handleKeyDown(t){if(this.disabled)return;if(!this.open&&(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")){t.preventDefault();this.open=true}else if(this.open&&t.key==="Escape"){t.preventDefault();this.open=false;this.fieldEl?.focus?.()}}wireViewport(){void(async()=>{const t=await(this.menuEl?.getScrollViewport?.())??null;if(!t||this.vpWired)return;this.vpWired=true;await this.vc.attachViewport((async()=>t))})()}componentDidRender(){this.syncSearchField();if(!this.menuEl)return;if(this.vc.active&&!this.providerSet){void this.menuEl.setVirtualProvider?.(this.vc.provider);this.providerSet=true}else if(!this.vc.active&&this.providerSet){void this.menuEl.setVirtualProvider?.(null);this.providerSet=false}if(this.open&&this.vc.active&&!this.vpWired)this.wireViewport()}disconnectedCallback(){clearTimeout(this.searchDebounce);this.vc.detachViewport()}get accessibleName(){if(this.label)return this.label;const t=this.el.getAttribute("aria-label");if(t&&t.trim())return t.trim();const s=this.el.getAttribute("aria-labelledby");if(s){const t=this.el.getRootNode();const i=s.trim().split(/\s+/).map((s=>t.getElementById?.(s)?.textContent?.trim()??"")).filter(Boolean).join(" ");if(i)return i}return""}renderTrigger(){const t=this.vc.active?this.selectedLabel:m(this.optionsData,this.value);const s=!!this.value&&!!t;const i=this.clearable&&s&&!this.disabled;const e=this.label?undefined:this.accessibleName||undefined;return a("md-text-field",{ref:t=>this.fieldEl=t,id:this.triggerId,class:"md-select__field",part:"field",exportparts:"container:field-container",variant:this.variant,label:this.label,"aria-label":e,placeholder:s?"":this.placeholder,value:t,readOnly:true,disabled:this.disabled,required:this.required,error:this.error,errorText:this.errorText,reserveSupportingSpace:this.reserveSupportingSpace,supportingText:this.supportingText,density:this.density,appearFocused:this.open,onClick:this.toggleOpen},a("span",{slot:"trailing-icon",class:"md-select__trailing",part:"trailing","aria-hidden":"true"},this.loading?a("span",{class:"md-select__loader",part:"loading-spinner"},a("slot",{name:"loader"},a("md-loading-indicator",{label:this.loadingText}))):[i&&a("md-icon-button",{class:"md-select__clear",part:"clear",size:"xs",icon:this.clearIcon,"aria-label":this.clearLabel,shapeMorph:false,groupTabindex:-1,onClick:this.clearValue}),a("span",{class:"md-select__caret material-symbols-outlined",part:"caret"},a("slot",{name:"dropdown-icon"},this.dropdownIcon))]))}renderVirtualOptions(){return a("div",{class:"md-select__listbox",role:"listbox",id:`${this.triggerId}-listbox`,"aria-label":this.accessibleName||"Options"},a("div",{class:"md-select__vspacer",style:{height:`${this.vc.topPad}px`},"aria-hidden":"true"}),this.vc.windowRows.map(((t,s)=>{const i=this.vc.windowStart+s;const e=t.value===this.value;return a("md-menu-item",{key:t.index,id:`${this.triggerId}-opt-${i}`,"data-vindex":i,presentation:"option",type:"radio","check-position":"start","keep-open":true,part:e?"option option-selected":"option",disabled:t.disabled,selected:e,headline:t.label,"supporting-text":t.supportingText||"","aria-setsize":this.vc.filteredLength,"aria-posinset":i+1,onMdClick:()=>this.selectValue(t.value)},t.icon?a("span",{slot:"leading-icon",part:"option-icon",class:"material-symbols-outlined md-select__option-icon","aria-hidden":"true"},t.icon):null,t.label)})),a("div",{class:"md-select__vspacer",style:{height:`${this.vc.bottomPad}px`},"aria-hidden":"true"}))}renderMenu(){const t=this.vc.active;const s=this.filterable&&!t?this.query.trim().toLowerCase():"";const i=s?this.optionsData.filter((t=>t.label.toLowerCase().includes(s)||(t.supportingText||"").toLowerCase().includes(s))):this.optionsData;const e=this.loading?"":t?this.vc.filteredLength===0?this.noResultsText:"":this.optionsData.length===0?this.noOptionsText:s&&i.length===0?this.noResultsText:"";const n=t?this.maxHeight??320:this.maxHeight;return a("md-menu",{ref:t=>this.menuEl=t,anchor:this.triggerId,placement:this.placement,"match-anchor-width":this.matchTriggerWidth||this.fullWidth,"max-height":n,"empty-text":e,listbox:true,"list-label":this.accessibleName||"Options",part:"menu",onMdOpen:this.handleMenuOpen,onMdClose:this.handleMenuClose},this.filterable&&!this.loading&&a("div",{slot:"header",class:"md-select__search-wrap",part:"search-wrap"},a("input",{class:"md-select__search",part:"search",type:"text",role:"combobox","aria-haspopup":"listbox","aria-expanded":String(this.open),"aria-controls":`${this.triggerId}-listbox`,"aria-autocomplete":"list",autocomplete:"off",placeholder:this.searchPlaceholder,"aria-label":this.filterLabel||(this.label?`Filter ${this.label}`:"Filter options"),onInput:this.onSearchInput,onClick:t=>t.stopPropagation()}),this.searching&&a("md-loading-indicator",{class:"md-select__search-spinner",part:"search-spinner",label:this.searchingLabel,"aria-hidden":"true"})),this.loading?a("div",{class:"md-select__loading",part:"loading-bar",role:"status","aria-label":this.loadingText},a("md-progress-indicator",{variant:"linear",indeterminate:true,wave:true,part:"loading-progress",label:this.loadingText})):t?this.renderVirtualOptions():a("div",{class:"md-select__listbox",role:"listbox",id:`${this.triggerId}-listbox`,"aria-label":this.accessibleName||"Options"},i.map((t=>a("md-menu-item",{key:t.value,id:`${this.triggerId}-opt-${t.value}`,presentation:"option",type:"radio","check-position":"start","keep-open":true,part:t.value===this.value?"option option-selected":"option",disabled:t.disabled,selected:t.value===this.value,headline:t.label,"supporting-text":t.supportingText||"",onMdClick:()=>this.selectValue(t.value)},t.icon?a("span",{slot:"leading-icon",part:"option-icon",class:"material-symbols-outlined md-select__option-icon",style:t.iconColor?{color:t.iconColor}:undefined,"aria-hidden":"true"},t.icon):null)))))}render(){return a(n,{key:"9673c714adf54a5c44d38754a7539d75a530e750",class:{"md-select":true,[`md-select--${this.variant}`]:true,"md-select--open":this.open,"md-select--disabled":this.disabled,"md-select--loading":this.loading},"aria-haspopup":"listbox","aria-busy":this.loading?"true":undefined},this.renderTrigger(),this.renderMenu(),a("div",{key:"4d83d5a2e165c72dfeddb87ad9679ecaaf964d44",class:"md-select__options",hidden:true},a("slot",{key:"0dbc2ee39737fc9fa38af8c0c2da4ca154807777",onSlotchange:()=>this.refreshOptions()})))}static get formAssociated(){return true}get el(){return this}static get watchers(){return{value:[{syncFormValue:0}],required:[{syncValidity:0}],valueMissingLabel:[{syncValidity:0}],options:[{refreshOptions:0}],open:[{syncMenu:0}]}}static get style(){return V()}},[321,"md-select",{valueMissingLabel:[1,"value-missing-label"],reserveSupportingSpace:[4,"reserve-supporting-space"],variant:[513],label:[1],placeholder:[1],value:[1537],disabled:[516],required:[516],error:[516],errorText:[1,"error-text"],supportingText:[1,"supporting-text"],density:[514],clearable:[516],matchTriggerWidth:[516,"match-trigger-width"],placement:[1],maxHeight:[8,"max-height"],options:[1],virtualize:[1],filterable:[4],filterMode:[1,"filter-mode"],rowHeight:[2,"row-height"],name:[513],searchPlaceholder:[1,"search-placeholder"],filterLabel:[1,"filter-label"],noResultsText:[1,"no-results-text"],noOptionsText:[1,"no-options-text"],clearLabel:[1,"clear-label"],searchingLabel:[1,"searching-label"],loadingText:[1,"loading-text"],clearIcon:[1,"clear-icon"],dropdownIcon:[1,"dropdown-icon"],loading:[516],fullWidth:[516,"full-width"],open:[1540],optionsData:[32],triggerId:[32],query:[32],show:[64],close:[64],focusTrigger:[64],reset:[64],loadOptions:[64],setQuery:[64],getLabels:[64],getValidity:[64],checkValidity:[64],reportValidity:[64],setCustomValidity:[64]},[[0,"mdSelectOptionChange","onOptionChange"],[0,"keydown","handleKeyDown"]],{value:[{syncFormValue:0}],required:[{syncValidity:0}],valueMissingLabel:[{syncValidity:0}],options:[{refreshOptions:0}],open:[{syncMenu:0}]}]);function j(){if(typeof customElements==="undefined"){return}const t=["md-select","md-icon-button","md-loading-indicator","md-menu","md-menu-item","md-progress-indicator","md-ripple","md-text-field"];t.forEach((t=>{switch(t){case"md-select":if(!customElements.get(r(t))){customElements.define(r(t),$)}break;case"md-icon-button":if(!customElements.get(r(t))){_()}break;case"md-loading-indicator":if(!customElements.get(r(t))){x()}break;case"md-menu":if(!customElements.get(r(t))){v()}break;case"md-menu-item":if(!customElements.get(r(t))){w()}break;case"md-progress-indicator":if(!customElements.get(r(t))){k()}break;case"md-ripple":if(!customElements.get(r(t))){z()}break;case"md-text-field":if(!customElements.get(r(t))){C()}break}}))}j();export{$ as M,j as d};
2
+ //# sourceMappingURL=p-Bmu7RqHM.js.map
@@ -0,0 +1,2 @@
1
+ import{v as t,x as s,y as i,z as n,A as e,B as o,C as h,D as c,E as a,F as r,G as l,H as f,I as u,J as d,K as x,w as m,c as y,e as M,f as p,i as b,s as g,g as v,h as w,L as k,l as I,M as A,n as z,m as F,N as S}from"./p-DvOKnoqK.js";import{n as $}from"./p-DzPKu-Ma.js";function L(t,s){return t.length*s*.58}function T(t,s){const i=t[1];const n=s[1];if(!(i>0)||!(n>0))return[t,s];const e=t[0]<0?-t[0]/i:0;const o=s[0]<0?-s[0]/n:0;const h=Math.max(e,o);if(h<=0)return[t,s];return[[-h*i,i],[-h*n,n]]}function B(t,s,i){if(s<=0||L(t,i)<=s)return t;const n=i*.58;const e=Math.floor(s/n)-1;return e>=1?`${t.slice(0,e)}…`:""}function q(t,s){const i=t.categories.length||Math.max(0,...t.series.map((t=>(t.range??t.data??[]).length)));const n=t.stack!=="none";const e=t.series.map((t=>n&&!t.range?t.stack||"stacked":"__unstacked__"));const o=h(t.series.map((t=>t.hidden||t.range?[]:t.data??[])),t.stack,e);t.series.forEach(((t,s)=>{if(!t.range||t.hidden)return;o[s]=t.range.map((t=>t?[Math.min(t[0],t[1]),Math.max(t[0],t[1])]:t))}));const d=[];t.series.forEach(((t,s)=>{if(t.hidden)return;o[s].forEach((t=>{if(t)d.push(t[0],t[1])}))}));const x=s=>(t.series[s].axisIndex??0)===1;const m=!!t.valueAxis2&&t.series.some(((t,s)=>!t.hidden&&x(s)));const y=[];if(m){d.length=0;t.series.forEach(((t,s)=>{if(t.hidden)return;o[s].forEach((t=>{if(t)(x(s)?y:d).push(t[0],t[1])}))}))}let M=l(d,{min:t.valueMin,max:t.valueMax,scale:t.valueScale,includeZero:true});let p=m?l(y,{min:t.valueAxis2.min,max:t.valueAxis2.max,scale:t.valueScale,includeZero:true}):M;if(m&&t.valueScale==="value"&&t.valueMin==null&&t.valueMax==null&&t.valueAxis2.min==null&&t.valueAxis2.max==null){[M,p]=T(M,p)}const b=c(t.valueBreaks,d,t.valueScale);const g={...b,ranges:a(r(b.ranges,M),M,t.valueScale)};const v=f(M,g.ranges,t.valueScale,6).filter((t=>!u(g.ranges,t)));const w=v.map((s=>(t.valueTickFormatter??t.valueFormatter)(s)));const k=t.valueAxis2?.formatter??t.valueTickFormatter??t.valueFormatter;const I=m&&!t.valueAxis2.hidden?f(p,[],t.valueScale,6):[];const A=I.map((t=>k(t)));const z=Math.max(0,...A.map((t=>L(t,s.labelSize))));const F=[];for(let s=0;s<i;s++)F.push(t.categoryFormatter(t.categories[s]??s));return{C:i,stacked:n,stackKeys:e,bands:o,onAxis2:x,hasAxis2:m,vDomain:M,vDomain2:p,vBreaks:g,vTickVals:v,vTickLabels:w,v2TickVals:I,v2TickLabels:A,maxV2LabelW:z,catLabels:F}}function D(t,s,i,n,e,o,h){const c=i?s.y:s.x;const a=i?s.height:s.width;const r=t.series.find((t=>!t.hidden&&t.pointWidths))?.pointWidths;const l=t=>{const s=r?.[t];return typeof s==="number"&&Number.isFinite(s)&&s>0?s:1};let f=0;const u=[];for(let t=0;t<n;t++){u.push(f);f+=l(t)}if(f<=0)f=Math.max(1,n);const d=t=>n>0?a*l(t)/f:a;const x=t=>c+a*u[t]/f;const m=t=>x(t)+d(t)/2;const y=s=>d(s)*(1-t.categoryGapRatio);const M=t.series.map(((t,s)=>s)).filter((s=>!t.series[s].hidden&&!t.series[s].overlay));const p=[];for(const t of M){const s=o[t];if(!p.includes(s))p.push(s)}const b=e?Math.max(1,p.length):Math.max(1,M.length);const g=s=>y(s)/(b+(b-1)*t.barGapRatio);const v=new Map;const w=new Map;if(e){for(let s=0;s<n;s++){const i=new Map;const n=new Map;t.series.forEach(((t,e)=>{if(t.hidden)return;const c=h[e][s];if(!c)return;const a=`${o[e]}|${s}`;if(c[1]>(i.get(a)??-Infinity)){i.set(a,c[1]);v.set(a,e)}if(c[0]<(n.get(a)??Infinity)){n.set(a,c[0]);w.set(a,e)}}))}}return{sizeAt:d,bandCenter:m,groupInnerAt:y,barWAt:g,groupNames:p,visibleIdx:M,topSeriesFor:v,botSeriesFor:w,mainLen:a}}function C(t,s,i,n,e,o,h,c,a){const r=t.subtitle?s.labelSize+4:0;const l=t.title?s.titleSize+10+r:0;const f=t.valueHidden||t.valueHideTicks?0:Math.max(0,...h.map((t=>L(t,s.labelSize))));const u=t.categoryHidden||t.categoryHideTicks?0:Math.max(0,...c.map((t=>L(t,s.labelSize))));const x=t.showLabels?Math.max(0,...t.series.flatMap((i=>i.range?i.range.flatMap((i=>i?[L(t.valueFormatter(i[0]),s.labelSize),L(t.valueFormatter(i[1]),s.labelSize)]:[])):(i.data??[]).map((i=>typeof i==="number"?L(t.valueFormatter(i),s.labelSize):0))))):0;const m=t.valueLabel?s.labelSize+6:0;const y=t.categoryLabel?s.labelSize+6:0;const M=s.labelSize+8;const p=!e?t.categoryLabelRotation??0:0;const b=Math.abs(p)*Math.PI/180;const g=p?u*Math.sin(b)+s.labelSize*Math.cos(b)+8:M;const v=!!t.legend&&t.legend!=="none"&&t.series.length>1;const w=v&&(t.legend==="left"||t.legend==="right");const k=v&&!w&&t.legend.startsWith("bottom");const I=v&&!w&&!k;const A=I||k?d(t.series.map((t=>t.label)),s.labelSize,i*.86):1;const z=t.legendExtent!=null&&(I||k)?t.legendExtent+8:A*(s.labelSize+8)+6;const F=I?z:0;const S=k?z:0;const $=w?t.legendExtent!=null?t.legendExtent+16:Math.max(0,...t.series.map((t=>L(t.label,s.labelSize))))+34:0;const T=t.legend==="left"?$:0;const B=t.legend==="right"?$:0;const q=(t.showLabels||t.showTotals)&&t.series.some((t=>!t.hidden&&(!!t.range||(t.data??[]).some((t=>typeof t==="number"&&t<0)))));const D=!!t.categoryLabelsMirrored&&e&&!t.categoryHidden&&!t.categoryHideTicks;const C=!!t.compact;const R=q?e?x+8:s.labelSize+4:0;let W;let E;let P;let V;if(C){W=E=P=V=2}else if(e){W=l+8+F;V=u+12+y+T+(q?x+8:0);P=(t.valueHidden||t.valueHideTicks?0:M)+m+6+S;E=12+(t.showLabels?x+8:0)+B+(D?u+12:0)}else{W=l+8+F+(t.showLabels?s.labelSize+4:0);E=12+B+(t.showLabels?x/2:0)+(o?a+10+(t.valueAxis2.label?s.labelSize+6:0):0);V=f+10+m+T;P=(t.categoryHidden||t.categoryHideTicks?0:g)+y+6+S+(q?s.labelSize+4:0)}const K={x:V,y:W,width:Math.max(1,i-V-E),height:Math.max(1,n-W-P)};return{plot:K,compact:C,legendBandTop:F,legendBandBottom:S,lowEndRoom:R,mirrorCats:D,maxDataLabelW:x,catRot:p,catRotRad:b}}function R(h,c,a,r){const l=h.horizontal;const{C:f,stacked:u,stackKeys:d,bands:m,onAxis2:y,hasAxis2:M,vDomain:p,vDomain2:b,vBreaks:g,vTickVals:v,vTickLabels:w,v2TickVals:k,v2TickLabels:I,maxV2LabelW:A,catLabels:z}=q(h,c);if(h.polar)return W(h,c,a,r,m,p,z,f);const{plot:F,compact:S,legendBandTop:$,legendBandBottom:T,lowEndRoom:R,mirrorCats:E,maxDataLabelW:P,catRot:V,catRotRad:K}=C(h,c,a,r,l,M,w,z,A);const N=l?F.width:F.height;const _=t(p,N,h.valueScale,g.ranges,g.sizing);const j=Math.min(p[1],Math.max(p[0],0));const G=M?t(b,N,h.valueScale,[],g.sizing):_;const H=t=>l?F.x+_.scale(t):F.y+F.height-_.scale(t);const O=t=>l?F.x+G.scale(t):F.y+F.height-G.scale(t);const Z=(t,s)=>M&&y(t)?O(s):H(s);const J=H(j);const U=(_.breaks??[]).map((t=>l?{lo:F.x+t.px,hi:F.x+t.px+t.gap}:{lo:F.y+F.height-t.px-t.gap,hi:F.y+F.height-t.px}));const Q=t=>{if(!U.length)return[t];const s=l?t.x:t.y;const i=s+(l?t.w:t.h);let n=[{lo:s,hi:i}];for(const t of U){const s=[];for(const i of n){if(t.hi<=i.lo||t.lo>=i.hi){s.push(i);continue}if(t.lo>i.lo)s.push({lo:i.lo,hi:t.lo});if(t.hi<i.hi)s.push({lo:t.hi,hi:i.hi})}n=s}if(n.length===1&&n[0].lo===s&&n[0].hi===i)return[t];return n.filter((t=>t.hi-t.lo>.5)).map(((s,i,n)=>({...t,radius:i===(l?n.length-1:0)?t.radius:[0,0,0,0],...l?{x:s.lo,w:s.hi-s.lo}:{y:s.lo,h:s.hi-s.lo}})))};const{sizeAt:X,bandCenter:Y,groupInnerAt:tt,barWAt:st,groupNames:it,visibleIdx:nt,topSeriesFor:et,botSeriesFor:ot,mainLen:ht}=D(h,F,l,f,u,d,m);const ct=[];const at=[];const rt=[];const lt=[];const ft=h.cornerRadius;h.series.forEach(((t,i)=>{if(t.hidden)return;const n=u?Math.max(0,it.indexOf(d[i])):Math.max(0,nt.indexOf(i));const e={};for(let o=0;o<f;o++){const a=m[i][o];if(!a)continue;const r=!!t.range;const f=r?null:t.data[o];const y=typeof f==="number"?f:a[1];const M=Z(i,a[0]);const p=Z(i,a[1]);const b=t.overlay?X(o)*(t.widthRatio??.45):st(o);const g=b*h.barGapRatio;const v=h.barWidth!=null&&!t.overlay?Math.min(Math.max(1,h.barWidth),b):b;const w=t.overlay?Y(o)-b/2:Y(o)-tt(o)/2+n*(b+g);const k=w+(b-v)/2;const I=y>=0;const A=`${d[i]}|${o}`;const z=I?a[0]===0:a[1]===0;const F=r||!u||(I?et.get(A)===i:ot.get(A)===i);const S=h.chevron?Math.min(v*.03,5,Math.abs(p-M)*.35):0;const $=h.chevron?x(v)-S/2:0;let T;if(l){const s=Math.min(M,p)+S/2;const n=Math.abs(p-M)-S;const c=r?[ft,ft,ft,ft]:F?I?[0,ft,ft,0]:[ft,0,0,ft]:[0,0,0,0];T={x:s,y:k,w:n,h:v,color:t.pointColors?.[o]??t.color,radius:c,seriesIndex:i,dataIndex:o,horizontal:true,arrow:h.chevron?I?1:-1:undefined,notch:h.chevron?!z:undefined};e[o]={x:I?Math.max(M,p)+$:Math.min(M,p)-$,y:k+v/2,value:y,color:T.color,...r?{low:a[0],high:a[1]}:null}}else{const s=Math.min(M,p)+S/2;const n=Math.abs(p-M)-S;const c=r?[ft,ft,ft,ft]:F?I?[ft,ft,0,0]:[0,0,ft,ft]:[0,0,0,0];T={x:k,y:s,w:v,h:n,color:t.pointColors?.[o]??t.color,radius:c,seriesIndex:i,dataIndex:o,horizontal:false,arrow:h.chevron?I?1:-1:undefined,notch:h.chevron?!z:undefined};e[o]={x:k+v/2,y:I?Math.min(M,p)-$:Math.max(M,p)+$,value:y,color:T.color,...r?{low:a[0],high:a[1]}:null}}ct.push(...Q(T));if(h.showLabels&&r){lt.push({seriesIndex:i,dataIndex:o,text:h.valueFormatter(a[0]),color:c.textColor,size:c.labelSize,atLowEnd:true},{seriesIndex:i,dataIndex:o,text:h.valueFormatter(a[1]),color:c.textColor,size:c.labelSize,atLowEnd:false})}else if(h.showLabels&&u&&typeof f==="number"){const t=h.stack==="percentage"?Math.abs(a[1]-a[0])*(f<0?-1:1):f;const n=h.valueFormatter(t);const e=l?T.w>L(n,c.labelSize)+8&&T.h>c.labelSize:T.h>c.labelSize+6&&T.w>L(n,c.labelSize)+4;if(e){lt.push({seriesIndex:i,dataIndex:o,text:n,color:s(T.color),size:c.labelSize,fontWeight:600,inside:true})}}else if(h.showLabels&&typeof f==="number"){lt.push({seriesIndex:i,dataIndex:o,text:h.valueFormatter(f),color:c.textColor,size:c.labelSize,atLowEnd:!I})}}at.push({seriesIndex:i,color:t.color,label:t.label,byIndex:e,values:t.range?m[i].map((t=>t?t[1]:null)):t.data})}));if(h.showTotals&&u&&h.stack!=="percentage"){for(let t=0;t<f;t++){for(const s of it){let i=-Infinity;let n=Infinity;let e=0;let o=false;h.series.forEach(((h,c)=>{if(h.hidden||d[c]!==s)return;const a=m[c][t];const r=h.data?.[t];if(!a)return;o=true;i=Math.max(i,a[1]);n=Math.min(n,a[0]);if(typeof r==="number")e+=r}));if(!o)continue;const a=h.valueFormatter(e);const r=i>0||n>=0;const l=r?et.get(`${s}|${t}`):ot.get(`${s}|${t}`);if(l==null)continue;lt.push({seriesIndex:l,dataIndex:t,text:a,color:c.textColor,size:c.labelSize,fontWeight:600,atLowEnd:!r})}}}const ut=[];const dt=[];const xt=5;const mt=F.y+F.height;const yt=i(h.valueDash);const Mt=i(h.valueGridDash);const pt=i(h.categoryDash);if(!h.valueHidden&&!S){for(const t of v){const s=H(t);if(l){ut.push({x1:s,y1:F.y,x2:s,y2:mt,color:c.gridLineColor,width:1,dash:Mt});if(h.axisTicks)dt.push({x1:s,y1:mt,x2:s,y2:mt+xt,color:c.axisLineColor,width:1,dash:yt})}else{ut.push({x1:F.x,y1:s,x2:F.x+F.width,y2:s,color:c.gridLineColor,width:1,dash:Mt});if(h.axisTicks)dt.push({x1:F.x-xt,y1:s,x2:F.x,y2:s,color:c.axisLineColor,width:1,dash:yt})}}}if(!S){const t=h.categoryAxisLine!==false;const s=h.valueAxisLine!==false;const i=_.breaks??[];if(t){dt.push(l?{x1:F.x,y1:F.y,x2:F.x,y2:F.y+F.height,color:c.axisLineColor,width:1,dash:pt}:{x1:F.x,y1:F.y+F.height,x2:F.x+F.width,y2:F.y+F.height,color:c.axisLineColor,width:1,dash:pt})}if(s){if(l){const t=i.map((t=>({px:t.px,gap:t.gap})));dt.push(...n("x",F.x,F.x+F.width,F.y+F.height,t,c.axisLineColor,yt));for(const s of t)dt.push(...e("x",F.x+s.px,F.x+s.px+s.gap,F.y,F.y+F.height,c.axisLineColor))}else{const t=i.map((t=>({px:F.height-t.px-t.gap,gap:t.gap})));dt.push(...n("y",F.y,F.y+F.height,F.x,t,c.axisLineColor,yt));for(const s of t)dt.push(...e("y",F.y+s.px,F.y+s.px+s.gap,F.x,F.x+F.width,c.axisLineColor))}}}if(h.title&&!S){const t=o(h.titleAlign,F.x,F.width);rt.push({x:t.x,y:$+6,text:h.title,color:c.textColor,fontSize:c.titleSize,fontWeight:600,align:t.align,baseline:"top",key:"title"});if(h.subtitle){rt.push({x:t.x,y:$+6+c.titleSize+4,text:h.subtitle,color:c.textColorMuted,fontSize:c.labelSize,align:t.align,baseline:"top",key:"subtitle"})}}if(M&&!h.valueAxis2.hidden&&!S&&!l){const t=F.x+F.width;dt.push({x1:t,y1:F.y,x2:t,y2:F.y+F.height,color:c.axisLineColor,width:1,dash:yt});k.forEach(((s,i)=>{const n=O(s);if(h.axisTicks)dt.push({x1:t,y1:n,x2:t+xt,y2:n,color:c.axisLineColor,width:1,dash:yt});rt.push({x:t+8,y:n,text:I[i],color:c.textColorMuted,fontSize:c.labelSize,align:"start",baseline:"middle",key:`v2t-${i}`})}));if(h.valueAxis2.label){rt.push({x:a-4,y:F.y+F.height/2,text:h.valueAxis2.label,color:c.textColor,fontSize:c.labelSize,align:"center",baseline:"bottom",rotate:-90,key:"val2-axis-title"})}}if(!h.valueHidden&&!h.valueHideTicks&&!S){v.forEach(((t,s)=>{const i=H(t);if(l){rt.push({x:i,y:F.y+F.height+6,text:w[s],color:c.textColorMuted,fontSize:c.labelSize,align:"center",baseline:"top",key:`vt-${s}`})}else{rt.push({x:F.x-8,y:i,text:w[s],color:c.textColorMuted,fontSize:c.labelSize,align:"end",baseline:"middle",key:`vt-${s}`})}}))}const bt=[];const gt=l?c.labelSize+6:48;const vt=Math.max(1,Math.ceil(f/Math.max(1,Math.floor(ht/gt))));for(let t=0;t<f;t++){const s=Y(t);bt.push(s);const i=t%vt===0;if(h.axisTicks&&!S&&i&&!h.categoryHidden){if(l)dt.push({x1:F.x-xt,y1:s,x2:F.x,y2:s,color:c.axisLineColor,width:1});else dt.push({x1:s,y1:mt,x2:s,y2:mt+xt,color:c.axisLineColor,width:1})}if(h.categoryHidden||h.categoryHideTicks||S||!i)continue;if(l){rt.push({x:F.x-8-R,y:s,text:z[t],color:c.textColorMuted,fontSize:c.labelSize,align:"end",baseline:"middle",key:`ct-${t}`});if(E){rt.push({x:F.x+F.width+8+(h.showLabels?P+4:0),y:s,text:z[t],color:c.textColorMuted,fontSize:c.labelSize,align:"start",baseline:"middle",key:`ctm-${t}`})}}else if(V){const i=L(z[t],c.labelSize);const n=V<0?-1:1;rt.push({x:s+n*i*Math.cos(K)/2,y:F.y+F.height+6+R+i*Math.sin(K)/2,text:z[t],color:c.textColorMuted,fontSize:c.labelSize,align:"center",baseline:"middle",rotate:V,key:`ct-${t}`})}else{const i=t+vt<f?Y(t+vt):s+vt*X(t);const n=t-vt>=0?Y(t-vt):s-vt*X(t);const e=Math.min(i-s,s-n)-6;rt.push({x:s,y:F.y+F.height+6+R,text:B(z[t],e,c.labelSize),color:c.textColorMuted,fontSize:c.labelSize,align:"center",baseline:"top",key:`ct-${t}`})}}if(!S){const t=h.categoryLabel;const s=h.valueLabel;if(l){if(t)rt.push({x:4,y:F.y+F.height/2,text:t,color:c.textColor,fontSize:c.labelSize,align:"center",baseline:"top",rotate:-90,key:"cat-axis-title"});if(s)rt.push({x:F.x+F.width/2,y:r-2-T,text:s,color:c.textColor,fontSize:c.labelSize,align:"center",baseline:"bottom",key:"val-axis-title"})}else{if(s)rt.push({x:4,y:F.y+F.height/2,text:s,color:c.textColor,fontSize:c.labelSize,align:"center",baseline:"top",rotate:-90,key:"val-axis-title"});if(t)rt.push({x:F.x+F.width/2,y:r-2-T,text:t,color:c.textColor,fontSize:c.labelSize,align:"center",baseline:"bottom",key:"cat-axis-title"})}}const wt=h.legend==="none"||S?[]:h.series.map(((t,s)=>({label:t.label,color:t.color,seriesIndex:s,hidden:t.hidden,x:0,y:0})));return{width:a,height:r,plot:F,background:c.background==="transparent"?undefined:c.background,gridlines:ut,axisLines:dt,areas:[],bars:ct,slices:[],lines:[],markers:[],texts:rt,barLabels:lt,legend:wt,legendPosition:h.legend,xPositions:bt,xValues:h.categories,xLabels:z,barBaseline:J,hoverPoints:at}}function W(t,s,i,n,e,h,c,a){const r=[];const l=t.subtitle?s.labelSize+4:0;const u=t.title?s.titleSize+10+l:0;const x=!!t.legend&&t.legend!=="none"&&t.series.length>1;const m=x&&t.legend.startsWith("bottom");const y=x&&!m&&!(t.legend==="left"||t.legend==="right");const M=x?d(t.series.map((t=>t.label)),s.labelSize,i*.86):1;const p=t.legendExtent!=null&&(y||m)?t.legendExtent+8:M*(s.labelSize+8)+6;const b=y?p:0;const g=m?p:0;const v=t.categoryHidden||t.categoryHideTicks?0:Math.max(0,...c.map((t=>L(t,s.labelSize))))+12;const w={x:v,y:u+b,width:Math.max(1,i-v),height:Math.max(1,n-u-b-g)};const k=w.x+w.width/2;const I=w.y+w.height/2;const A=t.valueTickFormatter??t.valueFormatter;const z=t.valueHidden||t.valueHideTicks?[]:f(h,[],t.valueScale,8).filter((t=>t>=h[0]-1e-9&&t<=h[1]+1e-9));const F=Math.max(0,...z.map((t=>L(A(t),s.labelSize))));const S=z.length?F+18:0;const $=Math.max(8,Math.min(w.width,w.height)/2-8-S);const T=$*Math.max(0,Math.min(.9,t.polarHole??.22));const B=a>0?($-T)/a:$-T;const q=Math.max(1,B*(1-t.categoryGapRatio));const D=-Math.PI/2;const C=2*Math.PI*Math.max(.1,Math.min(1,t.polarSweep??.75));const[R,W]=h;const E=W-R||1;const P=t=>D+(t-R)/E*C;const V=[];const K=[];const N=[];for(let t=0;t<a;t++){const s=$-t*B;N.push(s-q/2)}t.series.forEach(((t,s)=>{if(t.hidden)return;const i={};for(let n=0;n<a;n++){const o=e[s][n];if(!o)continue;const h=$-n*B;const c=h-q;const a=P(o[0]);const r=P(o[1]);if(Math.abs(r-a)<1e-6)continue;V.push({cx:k,cy:I,innerR:c,outerR:h,startAngle:Math.min(a,r),endAngle:Math.max(a,r),color:t.pointColors?.[n]??t.color,dataIndex:n,seriesIndex:s,pill:true,capStart:false,capEnd:false});const l=(a+r)/2;const f=(c+h)/2;i[n]={x:k+f*Math.cos(l),y:I+f*Math.sin(l),value:typeof t.data?.[n]==="number"?t.data[n]:o[1]}}K.push({seriesIndex:s,color:t.color,label:t.label,byIndex:i,values:t.data??[]})}));for(let t=0;t<a;t++){const s=V.filter((s=>s.dataIndex===t));if(!s.length)continue;let i=s[0];let n=s[0];for(const t of s){if(t.startAngle<i.startAngle)i=t;if(t.endAngle>n.endAngle)n=t}i.capStart=true;n.capEnd=true}const _=$+16;for(const t of z){const i=P(t);const n=Math.cos(i);const e=Math.sin(i);r.push({x:k+_*n,y:I+_*e,text:A(t),color:s.textColorMuted,fontSize:s.labelSize,align:n>.35?"start":n<-.35?"end":"center",baseline:e>.35?"top":e<-.35?"bottom":"middle",key:`vt-${t}`})}if(!t.categoryHidden&&!t.categoryHideTicks){for(let t=0;t<a;t++){r.push({x:k-q/2-12,y:I-N[t],text:c[t],color:s.textColorMuted,fontSize:s.labelSize,align:"end",baseline:"middle",key:`ct-${t}`})}}if(t.title){const i=o(t.titleAlign,w.x,w.width);r.push({x:i.x,y:b+6,text:t.title,color:s.textColor,fontSize:s.titleSize,fontWeight:600,align:i.align,baseline:"top",key:"title"});if(t.subtitle){r.push({x:i.x,y:b+6+s.titleSize+6,text:t.subtitle,color:s.textColorMuted,fontSize:s.labelSize,align:i.align,baseline:"top",key:"subtitle"})}}const j=t.legend==="none"?[]:t.series.map(((t,s)=>({label:t.label,color:t.color,seriesIndex:s,hidden:t.hidden,x:0,y:0})));return{width:i,height:n,plot:w,background:s.background==="transparent"?undefined:s.background,gridlines:[],axisLines:[],areas:[],bars:[],slices:V,lines:[],markers:[],texts:r,legend:j,legendPosition:t.legend,polar:true,xPositions:N,xValues:t.categories,xLabels:c,hoverPoints:K}}function E(t,s,i){const n=t-i.cx;const e=s-i.cy;const o=Math.hypot(n,e);if(o<i.innerR||o>i.outerR)return false;const h=Math.min(i.startAngle,i.endAngle);const c=Math.max(i.startAngle,i.endAngle);const a=Math.PI*2;let r=(Math.atan2(e,n)-h)%a;if(r<0)r+=a;return r<=c-h}function P(t,s,i){for(const n of t)if(n.endAngle!==n.startAngle&&E(s,i,n))return n;return null}const V=.62;const K=200;const N=220;const _=(t,s)=>`${t}:${s??-1}`;function j(t,s,i){return{...t,slices:t.slices.map((t=>{const n=s.get(_(t.dataIndex,t.seriesIndex))??0;return n>.002?{...t,color:S(t.color,i,V*n)}:t}))}}const G=(t,s,i)=>t+(s-t)*i;const H=260;function O(t){const s=(t.xValues??[]).map((t=>t==null?"":String(t)));const i=s.length>0&&new Set(s).size===s.length;return i?t=>`${t.seriesIndex}::${s[t.dataIndex]??t.dataIndex}`:t=>`${t.seriesIndex}#${t.dataIndex}`}function Z(t,s){return O(t)(s)}function J(t){const s=O(t);const i=new Map;return t.bars.map((t=>{const n=s(t);const e=i.get(n)??0;i.set(n,e+1);return e===0?n:`${n}~${e}`}))}function U(t){const s=J(t);const i=new Map;t.bars.forEach(((t,n)=>i.set(s[n],t)));return i}function Q(t,s,i){return{...s,x:G(t.x,s.x,i),y:G(t.y,s.y,i),w:G(t.w,s.w,i),h:G(t.h,s.h,i)}}function X(t,s){if(t.bars.length!==s.bars.length)return true;const i=U(t);for(const t of s.bars){const n=i.get(Z(s,t));if(!n)return true;if(Math.abs(n.x-t.x)>.5||Math.abs(n.y-t.y)>.5||Math.abs(n.w-t.w)>.5||Math.abs(n.h-t.h)>.5)return true}return false}class Y{constructor(t){this.container=t;this.ctx=null;this.spec=null;this.theme=null;this.scene=null;this.cb={};this.hoverRaf=0;this.lastHoverIndex=-2;this.hoverEnabled=true;this.clickable=false;this.hoverOpts={};this.hasRendered=false;this.introRaf=0;this.lastDpr=1;this.followRaf=0;this.followLast=0;this.hoverSlice=null;this.dimAnim=new Map;this.dimRaf=0;this.dimLast=0;this.lastPointer={x:0,y:0};this.tooltipTimer=0;this.tooltipShown=false;this.displayed=null;this.pendingDrill=null;this.drillArmRaf=0;this.lastW=0;this.lastH=0;this.dprWatch=m((()=>this.render()));this.rtl=false;this.dirWatch=y((()=>{if(b(this.container)!==this.rtl)this.render()}));this.followStep=t=>{if(!this.scene){this.followRaf=0;return}const s=this.followLast?t-this.followLast:16;this.followLast=t;const i=this.renderFollow(Math.min(1,s/H));this.followRaf=i?requestAnimationFrame(this.followStep):0};this.stepDim=t=>{if(!this.scene||!this.theme){this.dimRaf=0;return}const s=this.dimLast?t-this.dimLast:16;this.dimLast=t;let i=false;for(const t of this.scene.slices){const n=_(t.dataIndex,t.seriesIndex);const e=this.dimTarget(t);const o=this.dimAnim.get(n)??0;let h=o+Math.sign(e-o)*(s/K);if((e-o)*(e-h)<=0)h=e;this.dimAnim.set(n,h);if(h!==e)i=true}this.drawGeometry(j(this.scene,this.dimAnim,this.theme.surface),this.lastDpr);this.dimRaf=i?requestAnimationFrame(this.stepDim):0};this.handlePointerMove=t=>{if(!this.scene||!this.spec||!this.hoverEnabled)return;const s=this.canvas.getBoundingClientRect();const i=t.clientX-s.left;const n=t.clientY-s.top;if(this.spec.polar){const t=P(this.scene.slices,i,n);const s=t?{dataIndex:t.dataIndex,seriesIndex:t.seriesIndex??-1}:null;this.lastPointer={x:i,y:n};if(this.hoverRaf)cancelAnimationFrame(this.hoverRaf);this.hoverRaf=requestAnimationFrame((()=>{this.hoverRaf=0;if(!this.scene||!this.spec||!this.theme)return;this.canvas.style.cursor=s?"pointer":"";const t=s?.dataIndex!==this.hoverSlice?.dataIndex||s?.seriesIndex!==this.hoverSlice?.seriesIndex;if(t){this.hoverSlice=s;this.startDim();this.armTooltip(s)}else if(this.tooltipShown&&s){this.showPolarTooltip(s)}const i=s?s.dataIndex:-1;if(i!==this.lastHoverIndex){this.lastHoverIndex=i;this.cb.onHover?.(i)}}));return}const e=$(this.scene.xPositions,this.spec.horizontal?n:i);if(this.hoverRaf)cancelAnimationFrame(this.hoverRaf);this.hoverRaf=requestAnimationFrame((()=>{this.hoverRaf=0;if(!this.scene||!this.spec||!this.theme)return;this.canvas.style.cursor=this.clickable&&this.overBar(i,n)?"pointer":"";M(this.hoverLayer,this.scene,e,this.spec.valueFormatter,this.theme.fontFamily,{x:i,y:n},this.spec.horizontal?"horizontal":"vertical",-1,this.hoverOpts);if(e!==this.lastHoverIndex){this.lastHoverIndex=e;this.cb.onHover?.(e)}}))};this.handlePointerLeave=()=>{if(this.hoverRaf){cancelAnimationFrame(this.hoverRaf);this.hoverRaf=0}this.canvas.style.cursor="";p(this.hoverLayer);if(this.spec?.polar&&this.scene){clearTimeout(this.tooltipTimer);this.tooltipShown=false;this.canvas.style.cursor="";if(this.hoverSlice){this.hoverSlice=null;this.startDim()}}if(this.lastHoverIndex!==-1){this.lastHoverIndex=-1;this.cb.onHover?.(-1)}};this.handleClick=t=>{if(!this.scene||!this.cb.onPointClick)return;const s=this.canvas.getBoundingClientRect();const i=t.clientX-s.left;const n=t.clientY-s.top;for(const s of this.scene.bars){if(i>=s.x&&i<=s.x+s.w&&n>=s.y&&n<=s.y+s.h){this.cb.onPointClick(s.seriesIndex,s.dataIndex,t);return}}};this.onLegendToggle=t=>{if(this.spec){this.spec.series[t.seriesIndex].hidden=!this.spec.series[t.seriesIndex].hidden;this.hasRendered=false;this.render();this.cb.onLegendClick?.({...t,hidden:this.spec.series[t.seriesIndex].hidden})}else{this.cb.onLegendClick?.(t)}};if(getComputedStyle(t).position==="static")t.style.position="relative";this.canvas=document.createElement("canvas");this.canvas.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:block";this.canvas.setAttribute("part","plot-canvas");this.overlay=document.createElement("div");this.overlay.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden";this.legendLayer=document.createElement("div");this.legendLayer.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:visible";this.barLabelLayer=document.createElement("div");this.barLabelLayer.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden";this.hoverLayer=document.createElement("div");this.hoverLayer.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden";t.append(this.canvas,this.overlay,this.legendLayer,this.barLabelLayer,this.hoverLayer);this.ctx=this.canvas.getContext("2d");this.canvas.addEventListener("pointermove",this.handlePointerMove);this.canvas.addEventListener("pointerleave",this.handlePointerLeave);this.canvas.addEventListener("click",this.handleClick)}getScene(){return this.scene}setHoverEnabled(t){this.hoverEnabled=t;if(!t)p(this.hoverLayer)}setClickable(t){this.clickable=t;if(!t)this.canvas.style.cursor=""}overBar(t,s){return!!this.scene?.bars.some((i=>t>=i.x&&t<=i.x+i.w&&s>=i.y&&s<=i.y+i.h))}setTooltip(t){this.hoverOpts=t}setSpec(t,s,i={},n={}){this.spec=t;this.theme=s;this.cb=i;this.render(n)}resize(){const t=this.container.getBoundingClientRect();if(Math.round(t.width)===this.lastW&&Math.round(t.height)===this.lastH)return;this.render()}toDataURL(t="image/png"){return typeof this.canvas.toDataURL==="function"?this.canvas.toDataURL(t):""}dispose(){if(this.hoverRaf)cancelAnimationFrame(this.hoverRaf);this.stopIntro();cancelAnimationFrame(this.drillArmRaf);cancelAnimationFrame(this.dimRaf);cancelAnimationFrame(this.followRaf);clearTimeout(this.tooltipTimer);this.canvas.removeEventListener("pointermove",this.handlePointerMove);this.canvas.removeEventListener("pointerleave",this.handlePointerLeave);this.canvas.removeEventListener("click",this.handleClick);this.dprWatch.dispose();this.dirWatch.dispose();this.canvas.remove();this.overlay.remove();this.barLabelLayer.remove();this.hoverLayer.remove();this.spec=null;this.scene=null}render(t={}){if(!this.spec||!this.theme)return;this.dprWatch.update();const s=this.container.getBoundingClientRect();const i=Math.round(s.width);const n=Math.round(s.height);if(i<2||n<2)return;const e=this.scene;const o=i!==this.lastW||n!==this.lastH;this.lastW=i;this.lastH=n;const h=Math.min(window.devicePixelRatio||1,4);this.lastDpr=h;this.hoverSlice=null;this.dimAnim.clear();cancelAnimationFrame(this.dimRaf);this.dimRaf=0;if(this.hoverRaf){cancelAnimationFrame(this.hoverRaf);this.hoverRaf=0}clearTimeout(this.tooltipTimer);this.tooltipShown=false;this.canvas.width=i*h;this.canvas.height=n*h;const c=this.scene?.xPositions.length??0;this.rtl=b(this.container);const a=()=>{const t=R(this.spec,this.theme,i,n);return this.rtl?F(t):t};this.scene=a();if(this.lastHoverIndex>=0){if(this.lastHoverIndex<this.scene.xPositions.length&&c===this.scene.xPositions.length){this.focusIndexInternal(this.lastHoverIndex)}else{p(this.hoverLayer);this.lastHoverIndex=-1}}g(this.overlay,this.scene,this.theme.fontFamily,{onLegendClick:this.onLegendToggle},this.rtl,this.legendLayer);const r=this.legendLayer.querySelector('[part="legend"]');if(r&&this.spec.legend&&this.spec.legend!=="none"){const t=this.spec.legend==="left"||this.spec.legend==="right";const s=t?r.offsetWidth:r.offsetHeight;if(s>0&&Math.abs((this.spec.legendExtent??-1)-s)>2){this.spec.legendExtent=s;this.scene=a();g(this.overlay,this.scene,this.theme.fontFamily,{onLegendClick:this.onLegendToggle},this.rtl,this.legendLayer)}}const{variant:l,duration:f}=w(this.spec);const u=this.pendingDrill;const d=v();const x=l!=="none"&&!d;const m=this.scene.bars.length>0||this.scene.slices.length>0;const y=!this.hasRendered&&x;if(u&&x){this.hasRendered=true;this.playDrill(h,u,f);return}if(y){this.hasRendered=m;this.playIntro(h,l,f);return}this.hasRendered=this.hasRendered||m;const M=!!e&&X(e,this.scene);if(t.animate!==false&&!d&&!o&&e&&(M||this.followRaf)){this.stopIntro();this.ensureFollow();return}this.stopIntro();cancelAnimationFrame(this.followRaf);this.followRaf=0;this.paint(this.scene,h);this.displayed=U(this.scene)}drill(t,s="down"){const i=this.scene;if(!i)return;const n=!!this.spec?.horizontal;if(s==="up"){this.arm(n?{from:i.plot.y,size:i.plot.height,split:false}:{from:i.plot.x,size:i.plot.width,split:false});return}const e=i.bars.filter((s=>s.dataIndex===t));if(!e.length){this.arm(null);return}const o=Math.min(...e.map((t=>n?t.y:t.x)));const h=Math.max(...e.map((t=>n?t.y+t.h:t.x+t.w)));this.arm({from:o,size:Math.max(1,h-o),split:true})}arm(t){this.pendingDrill=t;cancelAnimationFrame(this.drillArmRaf);if(!t)return;this.drillArmRaf=requestAnimationFrame((()=>{this.pendingDrill=null}))}clearIntroOpacity(){this.canvas.style.opacity="";this.barLabelLayer.style.opacity=""}stopIntro(){cancelAnimationFrame(this.introRaf);this.introRaf=0;this.clearIntroOpacity()}playDrill(t,s,i){const n=this.scene;if(!n)return;this.stopIntro();this.paint(k(n,s.from,s.size,0,s.split),t);let e=0;const o=h=>{if(!e)e=h;const c=(h-e)/i;if(c>=1){this.displayed=U(n);this.paint(n,t);return}this.paint(k(n,s.from,s.size,c,s.split),t);this.introRaf=requestAnimationFrame(o)};this.introRaf=requestAnimationFrame(o)}replay(){this.hasRendered=false;this.render()}drawGeometry(t,s){if(this.ctx){this.ctx.setTransform(s,0,0,s,0,0);I(this.ctx,t)}}paint(t,s){this.drawGeometry(t,s);A(this.barLabelLayer,t,this.theme?.fontFamily)}playIntro(t,s,i){const n=this.scene;if(!n)return;this.stopIntro();const e=t=>{const s=t<1?String(t):"";this.canvas.style.opacity=s;this.barLabelLayer.style.opacity=s};const o=z(s,n,0);e(o.alpha);this.paint(o.scene,t);let h=0;const c=o=>{if(!h)h=o;const a=(o-h)/i;if(a>=1){e(1);this.displayed=U(n);this.paint(n,t);return}const{scene:r,alpha:l}=z(s,n,a);e(l);this.paint(r,t);this.introRaf=requestAnimationFrame(c)};this.introRaf=requestAnimationFrame(c)}ensureFollow(){if(!this.scene)return;if(v()){cancelAnimationFrame(this.followRaf);this.followRaf=0;this.displayed=U(this.scene);this.paint(this.scene,this.lastDpr);return}const t=this.renderFollow(0);if(t&&!this.followRaf){this.followLast=0;this.followRaf=requestAnimationFrame(this.followStep)}}renderFollow(t){const s=this.scene;if(!s)return false;const i=J(s);const n=this.displayed??U(s);const e=new Map;const o=[];let h=false;s.bars.forEach(((s,c)=>{const a=i[c];const r=n.get(a);const l=r?Q(r,s,t):s;e.set(a,l);o.push(l);if(Math.abs(l.x-s.x)>.3||Math.abs(l.y-s.y)>.3||Math.abs(l.w-s.w)>.3||Math.abs(l.h-s.h)>.3)h=true}));this.displayed=e;this.paint({...s,bars:o},this.lastDpr);return h}focusIndex(t){this.lastHoverIndex=t;this.focusIndexInternal(t)}focusIndexInternal(t){if(!this.scene||!this.spec||!this.theme)return;if(this.spec.polar){const s=t<0?null:{dataIndex:t,seriesIndex:-1};if(s?.dataIndex!==this.hoverSlice?.dataIndex||s?.seriesIndex!==this.hoverSlice?.seriesIndex){this.hoverSlice=s;this.startDim()}}if(t<0){p(this.hoverLayer);return}const s=!!this.spec.horizontal;const i=this.scene.hoverPoints.map((s=>s.byIndex[t])).find(Boolean);const n=this.scene.xPositions[t]??0;const e=i?{x:i.x,y:i.y}:{x:s?this.scene.plot.x:n,y:s?n:this.scene.plot.y};M(this.hoverLayer,this.scene,t,this.spec.valueFormatter,this.theme.fontFamily,e,this.spec.polar?"none":s?"horizontal":"vertical",-1,this.hoverOpts)}dimTarget(t){const s=this.hoverSlice;if(!s)return 0;if(s.seriesIndex<0)return t.dataIndex===s.dataIndex?0:1;return t.dataIndex===s.dataIndex&&t.seriesIndex===s.seriesIndex?0:1}startDim(){if(!this.scene||!this.theme)return;if(v()){cancelAnimationFrame(this.dimRaf);this.dimRaf=0;for(const t of this.scene.slices)this.dimAnim.set(_(t.dataIndex,t.seriesIndex),this.dimTarget(t));this.drawGeometry(j(this.scene,this.dimAnim,this.theme.surface),this.lastDpr);return}if(!this.dimRaf){this.dimLast=0;this.dimRaf=requestAnimationFrame(this.stepDim)}}armTooltip(t){clearTimeout(this.tooltipTimer);p(this.hoverLayer);this.tooltipShown=false;if(!t)return;this.tooltipTimer=window.setTimeout((()=>{const s=this.hoverSlice;if(s&&s.dataIndex===t.dataIndex&&s.seriesIndex===t.seriesIndex){this.showPolarTooltip(t);this.tooltipShown=true}}),N)}showPolarTooltip(t){if(!this.scene||!this.spec||!this.theme)return;M(this.hoverLayer,this.scene,t.dataIndex,this.spec.valueFormatter,this.theme.fontFamily,this.lastPointer,"none",t.seriesIndex,{...this.hoverOpts,trigger:"item"})}}export{Y as B};
2
+ //# sourceMappingURL=p-Bx6--dQF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["approxWidth","text","fontSize","length","alignZeroAxes","a","b","topA","topB","rA","rB","share","Math","max","ellipsize","maxW","per","n","floor","slice","computeValueAxes","spec","theme","C","categories","series","map","s","range","data","stacked","stack","stackKeys","bands","stackSeries","hidden","forEach","si","d","min","vVals","push","onAxis2","axisIndex","hasAxis2","valueAxis2","some","sr","vVals2","vDomain","computeDomain","valueMin","valueMax","scale","valueScale","includeZero","vDomain2","vFound","resolveAxisBreaks","valueBreaks","vBreaks","ranges","openTopSection","normalizeBreaks","vTickVals","sectionedTicks","filter","t","inBreak","vTickLabels","v","valueTickFormatter","valueFormatter","v2Fmt","formatter","v2TickVals","v2TickLabels","maxV2LabelW","labelSize","catLabels","i","categoryFormatter","computeBandGeometry","plot","horizontal","mainStart","y","x","mainLen","height","width","widthWeights","find","pointWidths","weightAt","w","Number","isFinite","weightSum","bandStarts","sizeAt","startAt","bandCenter","groupInnerAt","categoryGapRatio","visibleIdx","_","overlay","groupNames","k","includes","groupCount","barWAt","barGapRatio","topSeriesFor","Map","botSeriesFor","r","topV","botV","get","Infinity","set","computeGutters","subtitleH","subtitle","titleH","title","titleSize","maxVLabelW","valueHidden","valueHideTicks","maxCatLabelW","categoryHidden","categoryHideTicks","maxDataLabelW","showLabels","flatMap","axisTitleV","valueLabel","axisTitleC","categoryLabel","labelRowH","catRot","categoryLabelRotation","catRotRad","abs","PI","catLabelRowH","sin","cos","legendActive","legend","legendSide","legendAtBottom","startsWith","legendTopRow","legendRows","estimateLegendRows","label","legendBandH","legendExtent","legendBandTop","legendBandBottom","legendSideW","legendLeftW","legendRightW","labelsAtLowEnd","showTotals","mirrorCats","categoryLabelsMirrored","compact","lowEndRoom","padTop","padRight","padBottom","padLeft","computeBarLayout","polar","radialScene","crossLen","vScale","makeBrokenScale","sizing","baselineVal","vScale2","valPx","valPx2","valPxFor","basePx","breakStrips","breaks","lo","px","hi","gap","splitBar","bar","h","pieces","strip","next","p","idx","all","radius","bars","hoverPoints","texts","barLabels","cornerRadius","groupPos","indexOf","byIndex","band","isRange","raw","rawNum","p0","p1","autoW","widthRatio","barGap","barW","barWidth","slotStart","barStart","positive","stackCell","atBaseline","isTop","chevInset","chevron","chevLead","chevronTipDepth","color","pointColors","seriesIndex","dataIndex","arrow","undefined","notch","value","low","high","textColor","size","atLowEnd","shown","txt","fits","onColorFor","fontWeight","inside","values","g","top","bottom","sum","any","outerSeg","gridlines","axisLines","TICK","yb","valueDash","dashPattern","gridDash","valueGridDash","categoryDash","pv","x1","y1","x2","y2","gridLineColor","dash","axisTicks","axisLineColor","catLine","categoryAxisLine","valLine","valueAxisLine","valBreaks","cuts","axisLineWithBreaks","c","breakBandSegments","tt","titlePlacement","titleAlign","align","baseline","key","textColorMuted","rx","rotate","mainPositions","minSpacing","step","ceil","bc","atTick","dir","nextC","prevC","room","catTitle","valTitle","background","areas","slices","lines","markers","legendPosition","xPositions","xValues","xLabels","barBaseline","nameGutter","cx","cy","vFmt","vTicks","vTickMaxW","valueGutter","R","hole","polarHole","ring","thickness","START","sweep","polarSweep","span","angleOf","midRadii","outerR","innerR","a0","a1","startAngle","endAngle","pill","capStart","capEnd","mid","midR","ringSlices","first","last","labelR","pointInSlice","py","dx","dy","hypot","twoPi","atan2","sliceAt","POLAR_DIM","POLAR_FADE_MS","POLAR_DWELL_MS","sliceKey","emphasizePolar","scene","dimByKey","surface","mixColor","lerp","e","FOLLOW_MS","keyerFor","cats","String","unique","Set","barKey","barKeys","base","seen","barsByKey","keys","m","lerpBar","from","to","barsDiffer","am","nb","ob","BarChartEngine","constructor","container","this","ctx","cb","hoverRaf","lastHoverIndex","hoverEnabled","clickable","hoverOpts","hasRendered","introRaf","lastDpr","followRaf","followLast","hoverSlice","dimAnim","dimRaf","dimLast","lastPointer","tooltipTimer","tooltipShown","displayed","pendingDrill","drillArmRaf","lastW","lastH","dprWatch","watchDevicePixelRatio","render","rtl","dirWatch","watchDirection","isRtl","followStep","now","dt","moving","renderFollow","requestAnimationFrame","stepDim","target","dimTarget","cur","sign","drawGeometry","handlePointerMove","rect","canvas","getBoundingClientRect","clientX","left","clientY","hovered","cancelAnimationFrame","style","cursor","changed","startDim","armTooltip","showPolarTooltip","onHover","nearestIndex","overBar","renderHover","hoverLayer","fontFamily","handlePointerLeave","clearHover","clearTimeout","handleClick","onPointClick","onLegendToggle","item","onLegendClick","getComputedStyle","position","document","createElement","cssText","setAttribute","legendLayer","barLabelLayer","append","getContext","addEventListener","getScene","setHoverEnabled","enabled","setClickable","setTooltip","opts","setSpec","resize","round","toDataURL","type","dispose","stopIntro","removeEventListener","remove","update","oldScene","sizeChanged","dpr","window","devicePixelRatio","clear","hadCategories","layout","mirrorScene","focusIndexInternal","syncOverlay","legendEl","querySelector","side","extent","offsetWidth","offsetHeight","variant","duration","resolveIntro","drill","reduce","prefersReducedMotion","motion","hasContent","animate","playDrill","playIntro","ensureFollow","paint","index","direction","arm","split","clearIntroOpacity","opacity","drillScene","start","frame","replay","setTransform","drawSceneCanvas","renderBarLabels","setOpacity","stepAnimation","alpha","tRaw","rate","prev","focusIndex","pt","hp","Boolean","pos","setTimeout","trigger"],"sources":["src/utils/charts/engine/bar-layout.ts","src/utils/charts/engine/bar-chart.ts"],"sourcesContent":["/*\n * Chart engine — bar layout (spec → RenderScene)\n * ===========================================================\n * The bar-chart sibling of layout.ts. Turns a resolved bar-chart\n * spec + theme + pixel size into a backend-agnostic RenderScene\n * whose `bars` array the Canvas2D backend draws. Handles\n * vertical + horizontal orientation, grouped / stacked / percentage\n * modes, category + bar gaps, rounded outer corners and optional\n * value labels. Pure — no DOM — so it's unit-tested on its numbers.\n * ===========================================================\n */\n\nimport type { MdChartAnimation, MdChartAxisBreaks, MdChartAxisValue, MdChartDataPoint, MdChartLegendPosition, MdChartLineStyle, MdChartScaleType, MdChartStackMode, MdChartTitleAlign } from '../types';\nimport { computeDomain, inBreak, makeBrokenScale, normalizeBreaks, openTopSection, resolveAxisBreaks, sectionedTicks, type Domain, type Scale } from './scale';\nimport { stackSeries } from './geometry';\nimport type { BarLabel, HoverPoint, HoverSeries, LegendItem, Rect, RenderScene, SceneBar, SceneSegment, TextItem } from './scene';\nimport { axisLineWithBreaks, breakBandSegments, dashPattern, estimateLegendRows, titlePlacement, type EngineTheme } from './layout';\nimport { onColorFor } from './color';\nimport { chevronTipDepth } from './renderer-canvas';\n\nexport interface BarSeriesSpec {\n label: string;\n color: string;\n data: MdChartDataPoint[];\n hidden: boolean;\n /** `[low, high]` pairs instead of `data` — a bar that FLOATS between two\n * values rather than growing from the baseline. Both ends are free, so both\n * are rounded and both are labelled. A range never joins a stack.\n * Normalised by the component, same as the line/area layout's. */\n range?: ([number, number] | null | undefined)[];\n /** Per-datum band WIDTH weights, keyed by data index — a variwide chart,\n * where a column's width carries a second variable. A category band is\n * shared by every series, so the first series to supply these sets the\n * widths for the whole axis. */\n pointWidths?: Record<number, number>;\n /** Which value axis this series is measured against: 0 (default, the left /\n * bottom one) or 1 (the opposite gutter). See {@link BarChartSpec.valueAxis2}. */\n axisIndex?: number;\n /** Ignore the group slotting and draw this series centred on the category\n * band, at {@link widthRatio} of it — a column IN FRONT of the others rather\n * than beside them. Fixed placement, in Highcharts' terms. */\n overlay?: boolean;\n /** Width of an overlaid series' bar as a fraction of the FULL category band\n * (not the gapped inner width — so it does not compound with\n * {@link BarChartSpec.categoryGapRatio}, and `0.5` really is half the band).\n * Ignored unless {@link overlay} is set. Default 0.45. */\n widthRatio?: number;\n /** Named stack group. Series sharing a name stack together; different names\n * sit SIDE BY SIDE, so one category can carry several stacks. Ignored when\n * the chart is not stacked. */\n stack?: string;\n /** Per-datum colour overrides, keyed by data index. A bar not named here\n * keeps the series colour. This is what a bar race needs: one series whose\n * every bar is a different entity. */\n pointColors?: Record<number, string>;\n}\n\nexport interface BarChartSpec {\n series: BarSeriesSpec[];\n title?: string;\n /** Horizontal alignment of the title over the plot. Default 'start'. */\n titleAlign?: MdChartTitleAlign;\n categories: MdChartAxisValue[];\n categoryFormatter: (v: MdChartAxisValue) => string;\n categoryLabel?: string;\n categoryHidden?: boolean;\n categoryHideTicks?: boolean;\n /** Stroke style for the category axis' line + tick marks. Default solid. */\n categoryDash?: MdChartLineStyle;\n /** Rotate the category tick labels by this many degrees. Negative leans the\n * text up to the right with its END under the tick, which is the convention\n * for long names on a bottom axis. 0 (default) leaves them upright, in which\n * case a label wider than its band is truncated with an ellipsis. Applies to\n * the bottom axis of a vertical chart; a horizontal chart's names already\n * have the whole gutter to run into. */\n categoryLabelRotation?: number;\n /** Repeat the category names in the opposite gutter as well. A population\n * pyramid is the case: the rows run out from a centre line in both\n * directions, so a name on one side only is a long way from half its data.\n * Horizontal charts (names in the side gutters). */\n categoryLabelsMirrored?: boolean;\n valueScale: MdChartScaleType;\n /** Ranges cut out of the value axis, so far-apart bars stay comparable. */\n valueBreaks?: MdChartAxisBreaks;\n valueMin?: number;\n valueMax?: number;\n valueFormatter: (v: number) => string;\n /** Formats the value AXIS ticks, when they want to read differently from the\n * values themselves — `300k` on the axis, `300,000` in the tooltip. */\n valueTickFormatter?: (v: number) => string;\n valueLabel?: string;\n /** A SECOND value axis, drawn in the opposite gutter and used by any series\n * whose `axisIndex` is 1. Two quantities on one category axis — a count and\n * a rate, a volume and a price — that share no scale. */\n valueAxis2?: {\n min?: number;\n max?: number;\n label?: string;\n formatter?: (v: number) => string;\n hidden?: boolean;\n };\n valueHidden?: boolean;\n valueHideTicks?: boolean;\n /** Draw the category axis' own line (the frame edge). Default true. */\n categoryAxisLine?: boolean;\n /** Draw the value axis' own line (the frame edge). Default true. Ticks +\n * gridlines are unaffected — a force diagram wants the grid but not the box. */\n valueAxisLine?: boolean;\n /** Stroke style for the value axis' line + tick marks. Default solid. */\n valueDash?: MdChartLineStyle;\n /** Stroke style for the gridlines drawn off the value ticks. Default solid. */\n valueGridDash?: MdChartLineStyle;\n stack: MdChartStackMode;\n horizontal: boolean;\n /** Fraction of the category band that is whitespace (0..1). */\n categoryGapRatio: number;\n /** Gap between sibling grouped bars, as a fraction of bar width (0..1). */\n barGapRatio: number;\n /** Fixed bar WIDTH in px, centred in each slot. Undefined = auto (fill the slot). */\n barWidth?: number;\n cornerRadius: number;\n /** Wrap the bars around a circle: one concentric RING per category, the value\n * axis running as an angle. A radial (polar) bar chart. */\n polar?: boolean;\n /** Radius of the hole at the centre of a polar chart, as a fraction of the\n * full radius. Default 0.22. */\n polarHole?: number;\n /** How much of the circle the value axis spans, as a fraction. Default 0.75 —\n * the remaining quarter is where the category names go. */\n polarSweep?: number;\n /** Draw the bars as CHEVRONS pointing away from the baseline, interlocking\n * along a stack — a force diagram, where each segment hands its contribution\n * on to the next rather than merely sitting on it. */\n chevron?: boolean;\n showLabels: boolean;\n /** Print each stack's TOTAL past the end of the column, on top of the\n * per-segment labels. Stacked charts only — an unstacked bar IS its total. */\n showTotals?: boolean;\n /** A quieter line under the title. */\n subtitle?: string;\n /** Legend anchor, or `'none'` to hide it. */\n legend?: MdChartLegendPosition | 'none';\n /** Measured legend extent (px) from the engine's two-pass render — reserves the\n * gutter to the legend's REAL wrapped size instead of an estimate, so a\n * many-series legend can't spill onto the plot. Set by the engine, not authors. */\n legendExtent?: number;\n /** Sparkline mode: edge-to-edge, no axes / grid / title / legend. */\n compact?: boolean;\n /** Small perpendicular tick marks on the value + category axes. Default false. */\n axisTicks?: boolean;\n /** Entry-animation variant played on first render. Default 'expressive'. */\n animation?: MdChartAnimation;\n /** Entry-animation duration override (ms); ≤ 0 disables. */\n animationDuration?: number;\n /** Legacy on/off flag (pre-variant). `false` → no animation. */\n animate?: boolean;\n}\n\nfunction approxWidth(text: string, fontSize: number): number {\n return text.length * fontSize * 0.58;\n}\n\n/**\n * Extend whichever value axis has the smaller below-zero share so both axes'\n * ZERO lands on the same pixel — the shared baseline a dual-axis bar chart needs\n * so bars from either axis grow from one line and a negative on either opens the\n * same below-zero band. The axis that already has the larger share is untouched\n * (nothing is squashed); the other's negative side is stretched to match. Left\n * alone when an axis has no positive extent, or both are already zero-based.\n */\nfunction alignZeroAxes(a: Domain, b: Domain): [Domain, Domain] {\n const topA = a[1];\n const topB = b[1];\n if (!(topA > 0) || !(topB > 0)) return [a, b];\n const rA = a[0] < 0 ? -a[0] / topA : 0;\n const rB = b[0] < 0 ? -b[0] / topB : 0;\n const share = Math.max(rA, rB);\n if (share <= 0) return [a, b];\n return [\n [-share * topA, topA],\n [-share * topB, topB],\n ];\n}\n\n/** Cut `text` to `maxW` pixels, ending in an ellipsis. Same width estimate as\n * {@link approxWidth}, so the two agree about what fits. */\nfunction ellipsize(text: string, maxW: number, fontSize: number): string {\n if (maxW <= 0 || approxWidth(text, fontSize) <= maxW) return text;\n const per = fontSize * 0.58;\n const n = Math.floor(maxW / per) - 1;\n return n >= 1 ? `${text.slice(0, n)}…` : '';\n}\n\n/**\n * Phase 1 of the bar layout: turn the series into value BANDS (`[base, top]`\n * per datum, stacked if asked), derive the value domain(s), and resolve the\n * axis ticks / breaks / category labels off them. Pure `(spec, theme) → bundle`\n * with no pixel geometry — the plot rect doesn't exist yet. Everything a later\n * phase needs from here is returned; nothing here reads the box size.\n */\nfunction computeValueAxes(spec: BarChartSpec, theme: EngineTheme) {\n const C = spec.categories.length || Math.max(0, ...spec.series.map((s) => (s.range ?? s.data ?? []).length));\n const stacked = spec.stack !== 'none';\n\n // A range series is never stacked — it already carries both its edges, and\n // piling one onto a cumulative baseline would put its low somewhere that is\n // not a value anyone measured.\n const stackKeys = spec.series.map((s) => (stacked && !s.range ? s.stack || 'stacked' : '__unstacked__'));\n // Hidden series contribute empty data so they don't reserve a stack band.\n const bands = stackSeries(\n spec.series.map((s) => (s.hidden || s.range ? [] : (s.data ?? []))),\n spec.stack,\n stackKeys,\n );\n // Range bands are the datum itself, low edge first so the band is always\n // [base, top] like every other one downstream.\n spec.series.forEach((s, si) => {\n if (!s.range || s.hidden) return;\n bands[si] = s.range.map((d) => (d ? ([Math.min(d[0], d[1]), Math.max(d[0], d[1])] as [number, number]) : d));\n });\n const vVals: number[] = [];\n spec.series.forEach((s, si) => {\n if (s.hidden) return;\n bands[si].forEach((b) => {\n if (b) vVals.push(b[0], b[1]);\n });\n });\n const onAxis2 = (si: number) => (spec.series[si].axisIndex ?? 0) === 1;\n const hasAxis2 = !!spec.valueAxis2 && spec.series.some((sr, si) => !sr.hidden && onAxis2(si));\n const vVals2: number[] = [];\n if (hasAxis2) {\n // Split the collected values by axis — a series on the right-hand scale\n // must not stretch the left one's domain, which is the whole point of\n // having two.\n vVals.length = 0;\n spec.series.forEach((sr, si) => {\n if (sr.hidden) return;\n bands[si].forEach((b) => {\n if (b) (onAxis2(si) ? vVals2 : vVals).push(b[0], b[1]);\n });\n });\n }\n let vDomain = computeDomain(vVals, {\n min: spec.valueMin,\n max: spec.valueMax,\n scale: spec.valueScale,\n includeZero: true,\n });\n let vDomain2 = hasAxis2\n ? computeDomain(vVals2, { min: spec.valueAxis2!.min, max: spec.valueAxis2!.max, scale: spec.valueScale, includeZero: true })\n : vDomain;\n // Zero-align the two value axes so a dual-axis chart shares ONE baseline (see\n // alignZeroAxes). Only for the linear, auto-ranged case — a pinned min/max is\n // the author's own call, and a log axis has no zero to share. Both axes then\n // tick across their aligned range, so the below-zero band carries gridlines and\n // labels on the primary axis instead of reading as empty space.\n if (hasAxis2 && spec.valueScale === 'value' && spec.valueMin == null && spec.valueMax == null && spec.valueAxis2!.min == null && spec.valueAxis2!.max == null) {\n [vDomain, vDomain2] = alignZeroAxes(vDomain, vDomain2);\n }\n\n // Value-axis breaks: same treatment as the line chart's y axis — the cut\n // costs its gap in pixels, and each surviving section gets its own ticks.\n // Normalised against the axis domain straight away (see computeLayout): a cut\n // the domain rejects must not section the ticks either.\n const vFound = resolveAxisBreaks(spec.valueBreaks, vVals, spec.valueScale);\n // Open a top-edge cut (an outlier pinned to the axis top) into a real section so\n // it carries ticks + gridlines instead of a blank band above the break.\n const vBreaks = { ...vFound, ranges: openTopSection(normalizeBreaks(vFound.ranges, vDomain), vDomain, spec.valueScale) };\n const vTickVals = sectionedTicks(vDomain, vBreaks.ranges, spec.valueScale, 6).filter(\n (t) => !inBreak(vBreaks.ranges, t),\n );\n const vTickLabels = vTickVals.map((v) => (spec.valueTickFormatter ?? spec.valueFormatter)(v));\n const v2Fmt = spec.valueAxis2?.formatter ?? spec.valueTickFormatter ?? spec.valueFormatter;\n const v2TickVals = hasAxis2 && !spec.valueAxis2!.hidden ? sectionedTicks(vDomain2, [], spec.valueScale, 6) : [];\n const v2TickLabels = v2TickVals.map((v) => v2Fmt(v));\n const maxV2LabelW = Math.max(0, ...v2TickLabels.map((t) => approxWidth(t, theme.labelSize)));\n const catLabels: string[] = [];\n for (let i = 0; i < C; i++) catLabels.push(spec.categoryFormatter(spec.categories[i] ?? i));\n\n return { C, stacked, stackKeys, bands, onAxis2, hasAxis2, vDomain, vDomain2, vBreaks, vTickVals, vTickLabels, v2TickVals, v2TickLabels, maxV2LabelW, catLabels };\n}\n\n/**\n * Phase 4: category band geometry along the MAIN axis (x for a vertical chart,\n * y for a horizontal one). Needs the plot rect, so it runs after the gutters are\n * known. Returns closures — `sizeAt`/`bandCenter`/`groupInnerAt`/`barWAt` — plus\n * the slot bookkeeping (`groupNames`, `visibleIdx`) and the per-stack outermost-\n * segment maps (`topSeriesFor`/`botSeriesFor`) used to round only the free end.\n */\nfunction computeBandGeometry(\n spec: BarChartSpec,\n plot: { x: number; y: number; width: number; height: number },\n horizontal: boolean,\n C: number,\n stacked: boolean,\n stackKeys: string[],\n bands: ReturnType<typeof computeValueAxes>['bands'],\n) {\n const mainStart = horizontal ? plot.y : plot.x;\n const mainLen = horizontal ? plot.height : plot.width;\n // Category bands are equal unless a series supplies width weights, in which\n // case each band takes a share of the main axis proportional to its weight —\n // a variwide chart, where the column's width is a second variable. The bands\n // are shared by every series, so the first series to ask decides for all.\n const widthWeights = spec.series.find((s) => !s.hidden && s.pointWidths)?.pointWidths;\n const weightAt = (i: number) => {\n const w = widthWeights?.[i];\n return typeof w === 'number' && Number.isFinite(w) && w > 0 ? w : 1;\n };\n let weightSum = 0;\n const bandStarts: number[] = [];\n for (let i = 0; i < C; i++) {\n bandStarts.push(weightSum);\n weightSum += weightAt(i);\n }\n if (weightSum <= 0) weightSum = Math.max(1, C);\n const sizeAt = (i: number) => (C > 0 ? (mainLen * weightAt(i)) / weightSum : mainLen);\n const startAt = (i: number) => mainStart + (mainLen * bandStarts[i]) / weightSum;\n const bandCenter = (i: number) => startAt(i) + sizeAt(i) / 2;\n const groupInnerAt = (i: number) => sizeAt(i) * (1 - spec.categoryGapRatio);\n\n // An overlaid series is drawn ON the band rather than in a slot of it, so it\n // is left out of the slot count — otherwise it would reserve a place it never\n // stands in and narrow every other bar for nothing.\n const visibleIdx = spec.series.map((_, i) => i).filter((i) => !spec.series[i].hidden && !spec.series[i].overlay);\n // Slots along the category band. Unstacked, every visible series gets one.\n // Stacked, every distinct stack GROUP gets one — so a chart mixing\n // `stack: 'a'` and `stack: 'b'` draws two stacks side by side rather than\n // piling all six series into one column.\n const groupNames: string[] = [];\n for (const i of visibleIdx) {\n const k = stackKeys[i];\n if (!groupNames.includes(k)) groupNames.push(k);\n }\n const groupCount = stacked ? Math.max(1, groupNames.length) : Math.max(1, visibleIdx.length);\n // barW: split the group among sibling bars, leaving barGapRatio between them.\n const barWAt = (i: number) => groupInnerAt(i) / (groupCount + (groupCount - 1) * spec.barGapRatio);\n\n // Outermost segment per category, per sign, for rounding the free (outer) end:\n // the top of the highest positive segment (max band[1]) and the bottom of the\n // lowest negative segment (min band[0]).\n // Keyed `${group}|${category}` — the outermost segment is per STACK, not per\n // category, or only one of two side-by-side stacks would get a rounded cap.\n const topSeriesFor = new Map<string, number>();\n const botSeriesFor = new Map<string, number>();\n if (stacked) {\n for (let r = 0; r < C; r++) {\n const topV = new Map<string, number>();\n const botV = new Map<string, number>();\n spec.series.forEach((s, si) => {\n if (s.hidden) return;\n const b = bands[si][r];\n if (!b) return;\n const k = `${stackKeys[si]}|${r}`;\n if (b[1] > (topV.get(k) ?? -Infinity)) {\n topV.set(k, b[1]);\n topSeriesFor.set(k, si);\n }\n if (b[0] < (botV.get(k) ?? Infinity)) {\n botV.set(k, b[0]);\n botSeriesFor.set(k, si);\n }\n });\n }\n }\n\n return { sizeAt, bandCenter, groupInnerAt, barWAt, groupNames, visibleIdx, topSeriesFor, botSeriesFor, mainLen };\n}\n\n/**\n * Phase 2: reserve gutters for the chrome — title, legend, axis tick labels,\n * axis titles, and the room a free-end / low-end data label needs — then derive\n * the plot rect from what's left. Returns the plot plus the handful of label /\n * legend metrics the later text phase still needs (`compact`, the legend band\n * heights, `lowEndRoom`, the rotation, `mirrorCats`, `maxDataLabelW`).\n */\nfunction computeGutters(\n spec: BarChartSpec,\n theme: EngineTheme,\n width: number,\n height: number,\n horizontal: boolean,\n hasAxis2: boolean,\n vTickLabels: string[],\n catLabels: string[],\n maxV2LabelW: number,\n) {\n const subtitleH = spec.subtitle ? theme.labelSize + 4 : 0;\n const titleH = spec.title ? theme.titleSize + 10 + subtitleH : 0;\n const maxVLabelW = spec.valueHidden || spec.valueHideTicks ? 0 : Math.max(0, ...vTickLabels.map((t) => approxWidth(t, theme.labelSize)));\n const maxCatLabelW = spec.categoryHidden || spec.categoryHideTicks ? 0 : Math.max(0, ...catLabels.map((t) => approxWidth(t, theme.labelSize)));\n /**\n * Room the value labels need past the end of a bar.\n *\n * Estimated from the widest one the chart will actually print, not a flat\n * margin: \"8\" and \"4,695\" are the same reservation under a constant, and the\n * long one then ran off the plot — on a horizontal chart the longest bar is\n * also the one whose label has least room, so it is always the value that\n * matters most that gets clipped.\n */\n // Widest label that will actually be printed — a range series prints both of\n // its edges, an ordinary one its value.\n const maxDataLabelW = spec.showLabels\n ? Math.max(\n 0,\n ...spec.series.flatMap((sr) =>\n sr.range\n ? sr.range.flatMap((d) => (d ? [approxWidth(spec.valueFormatter(d[0]), theme.labelSize), approxWidth(spec.valueFormatter(d[1]), theme.labelSize)] : []))\n : (sr.data ?? []).map((v) => (typeof v === 'number' ? approxWidth(spec.valueFormatter(v), theme.labelSize) : 0)),\n ),\n )\n : 0;\n const axisTitleV = spec.valueLabel ? theme.labelSize + 6 : 0;\n const axisTitleC = spec.categoryLabel ? theme.labelSize + 6 : 0;\n const labelRowH = theme.labelSize + 8;\n // Rotated category labels take a taller row: the text's own length now runs\n // partly DOWN the page, so the row has to hold its vertical projection.\n const catRot = !horizontal ? (spec.categoryLabelRotation ?? 0) : 0;\n const catRotRad = (Math.abs(catRot) * Math.PI) / 180;\n const catLabelRowH = catRot\n ? maxCatLabelW * Math.sin(catRotRad) + theme.labelSize * Math.cos(catRotRad) + 8\n : labelRowH;\n\n // A top/bottom legend gets a reserved band; a left/right legend gets a\n // reserved side gutter (a vertically-centred column) so it never overlaps the\n // plot or the axis labels.\n const legendActive = !!spec.legend && spec.legend !== 'none' && spec.series.length > 1;\n const legendSide = legendActive && (spec.legend === 'left' || spec.legend === 'right');\n const legendAtBottom = legendActive && !legendSide && spec.legend!.startsWith('bottom');\n const legendTopRow = legendActive && !legendSide && !legendAtBottom;\n const legendRows = legendTopRow || legendAtBottom ? estimateLegendRows(spec.series.map((s) => s.label), theme.labelSize, width * 0.86) : 1;\n // Prefer the engine's MEASURED legend extent (two-pass render) over the estimate.\n const legendBandH = spec.legendExtent != null && (legendTopRow || legendAtBottom) ? spec.legendExtent + 8 : legendRows * (theme.labelSize + 8) + 6;\n const legendBandTop = legendTopRow ? legendBandH : 0;\n const legendBandBottom = legendAtBottom ? legendBandH : 0;\n const legendSideW = legendSide ? (spec.legendExtent != null ? spec.legendExtent + 16 : Math.max(0, ...spec.series.map((s) => approxWidth(s.label, theme.labelSize))) + 34) : 0;\n const legendLeftW = spec.legend === 'left' ? legendSideW : 0;\n const legendRightW = spec.legend === 'right' ? legendSideW : 0;\n\n // Sparkline mode fills its host edge-to-edge — no gutters for chrome.\n // Does any data label land at the LOW end of a bar (left on a horizontal\n // chart, below on a vertical one)? A range prints both edges; an ordinary\n // series prints below the baseline only where it goes negative. Without this\n // the gutter is sized for the high side alone and the low label runs into the\n // category names.\n const labelsAtLowEnd =\n (spec.showLabels || spec.showTotals) &&\n spec.series.some((sr) => !sr.hidden && (!!sr.range || (sr.data ?? []).some((v) => typeof v === 'number' && v < 0)));\n\n const mirrorCats = !!spec.categoryLabelsMirrored && horizontal && !spec.categoryHidden && !spec.categoryHideTicks;\n const compact = !!spec.compact;\n // Both the category name and a low-end data label are anchored to the plot's\n // edge, so widening the gutter alone just makes them overlap further out.\n // The category name steps back past the data label's lane.\n const lowEndRoom = labelsAtLowEnd ? (horizontal ? maxDataLabelW + 8 : theme.labelSize + 4) : 0;\n let padTop: number;\n let padRight: number;\n let padBottom: number;\n let padLeft: number;\n if (compact) {\n padTop = padRight = padBottom = padLeft = 2;\n } else if (horizontal) {\n // categories on the y (left) gutter, values on the x (bottom) gutter\n padTop = titleH + 8 + legendBandTop;\n padLeft = maxCatLabelW + 12 + axisTitleC + legendLeftW + (labelsAtLowEnd ? maxDataLabelW + 8 : 0);\n padBottom = (spec.valueHidden || spec.valueHideTicks ? 0 : labelRowH) + axisTitleV + 6 + legendBandBottom;\n padRight = 12 + (spec.showLabels ? maxDataLabelW + 8 : 0) + legendRightW + (mirrorCats ? maxCatLabelW + 12 : 0);\n } else {\n padTop = titleH + 8 + legendBandTop + (spec.showLabels ? theme.labelSize + 4 : 0);\n // A vertical chart's labels sit ABOVE the bar, so their width is not the\n // constraint — but the outermost columns' labels still overhang sideways.\n padRight = 12 + legendRightW + (spec.showLabels ? maxDataLabelW / 2 : 0) + (hasAxis2 ? maxV2LabelW + 10 + (spec.valueAxis2!.label ? theme.labelSize + 6 : 0) : 0);\n padLeft = maxVLabelW + 10 + axisTitleV + legendLeftW;\n padBottom = (spec.categoryHidden || spec.categoryHideTicks ? 0 : catLabelRowH) + axisTitleC + 6 + legendBandBottom + (labelsAtLowEnd ? theme.labelSize + 4 : 0);\n }\n\n const plot = {\n x: padLeft,\n y: padTop,\n width: Math.max(1, width - padLeft - padRight),\n height: Math.max(1, height - padTop - padBottom),\n };\n\n return { plot, compact, legendBandTop, legendBandBottom, lowEndRoom, mirrorCats, maxDataLabelW, catRot, catRotRad };\n}\n\nexport function computeBarLayout(spec: BarChartSpec, theme: EngineTheme, width: number, height: number): RenderScene {\n const horizontal = spec.horizontal;\n // Phase 1: value bands, domains, ticks, breaks, category labels (no pixels yet).\n const { C, stacked, stackKeys, bands, onAxis2, hasAxis2, vDomain, vDomain2, vBreaks, vTickVals, vTickLabels, v2TickVals, v2TickLabels, maxV2LabelW, catLabels } =\n computeValueAxes(spec, theme);\n\n if (spec.polar) return radialScene(spec, theme, width, height, bands, vDomain, catLabels, C);\n\n // Phase 2: reserve gutters for the chrome (title, legend, axis labels) and\n // derive the plot rect + the label metrics later phases still need.\n const { plot, compact, legendBandTop, legendBandBottom, lowEndRoom, mirrorCats, maxDataLabelW, catRot, catRotRad } =\n computeGutters(spec, theme, width, height, horizontal, hasAxis2, vTickLabels, catLabels, maxV2LabelW);\n\n // ── value scale maps onto the cross length ──\n const crossLen = horizontal ? plot.width : plot.height;\n const vScale: Scale = makeBrokenScale(vDomain, crossLen, spec.valueScale, vBreaks.ranges, vBreaks.sizing);\n // Bars grow from zero; clamp it into the (zero-including) domain.\n const baselineVal = Math.min(vDomain[1], Math.max(vDomain[0], 0));\n // pixel of a value along the cross axis\n const vScale2: Scale = hasAxis2 ? makeBrokenScale(vDomain2, crossLen, spec.valueScale, [], vBreaks.sizing) : vScale;\n const valPx = (v: number) => (horizontal ? plot.x + vScale.scale(v) : plot.y + plot.height - vScale.scale(v));\n const valPx2 = (v: number) => (horizontal ? plot.x + vScale2.scale(v) : plot.y + plot.height - vScale2.scale(v));\n /** Project a value for the axis THIS series is measured against. */\n const valPxFor = (si: number, v: number) => (hasAxis2 && onAxis2(si) ? valPx2(v) : valPx(v));\n const basePx = valPx(baselineVal);\n\n /**\n * The pixel strips the cuts occupy, along the value axis. A bar drawn\n * straight through one would hide the very discontinuity the break exists to\n * show — every bar grows from the baseline, so every bar crosses it.\n */\n // Taken from each cut's own pixel span rather than by re-scaling its\n // endpoints: a cut whose top section holds a single value has zero data\n // width, so scaling `to` would return the far end of that section and the\n // \"strip\" would swallow half the axis.\n const breakStrips = ((vScale as { breaks?: readonly { px: number; gap: number }[] }).breaks ?? []).map((b) =>\n horizontal\n ? { lo: plot.x + b.px, hi: plot.x + b.px + b.gap }\n : { lo: plot.y + plot.height - b.px - b.gap, hi: plot.y + plot.height - b.px },\n );\n\n /** A bar with any strip removed from it — one rect per surviving piece. */\n const splitBar = (bar: SceneBar): SceneBar[] => {\n if (!breakStrips.length) return [bar];\n const lo = horizontal ? bar.x : bar.y;\n const hi = lo + (horizontal ? bar.w : bar.h);\n let pieces: { lo: number; hi: number }[] = [{ lo, hi }];\n for (const strip of breakStrips) {\n const next: { lo: number; hi: number }[] = [];\n for (const p of pieces) {\n if (strip.hi <= p.lo || strip.lo >= p.hi) {\n next.push(p);\n continue;\n }\n if (strip.lo > p.lo) next.push({ lo: p.lo, hi: strip.lo });\n if (strip.hi < p.hi) next.push({ lo: strip.hi, hi: p.hi });\n }\n pieces = next;\n }\n if (pieces.length === 1 && pieces[0].lo === lo && pieces[0].hi === hi) return [bar];\n return pieces\n .filter((p) => p.hi - p.lo > 0.5)\n .map((p, idx, all) => ({\n ...bar,\n // Only the outermost piece keeps the rounded cap.\n radius: (idx === (horizontal ? all.length - 1 : 0) ? bar.radius : [0, 0, 0, 0]) as SceneBar['radius'],\n ...(horizontal ? { x: p.lo, w: p.hi - p.lo } : { y: p.lo, h: p.hi - p.lo }),\n }));\n };\n\n // Phase 4: category band geometry — where each band sits along the main axis,\n // how the group splits into sibling bar slots, and which segment caps a stack.\n const { sizeAt, bandCenter, groupInnerAt, barWAt, groupNames, visibleIdx, topSeriesFor, botSeriesFor, mainLen } =\n computeBandGeometry(spec, plot, horizontal, C, stacked, stackKeys, bands);\n\n const bars: SceneBar[] = [];\n const hoverPoints: HoverSeries[] = [];\n const texts: TextItem[] = [];\n // Value labels bound to their bar rather than to a fixed pixel, so the bar-\n // label overlay can re-derive their position from the (animating) bar tip\n // every frame instead of leaving them stranded at the final geometry.\n const barLabels: BarLabel[] = [];\n const r = spec.cornerRadius;\n\n spec.series.forEach((s, si) => {\n if (s.hidden) return;\n const groupPos = stacked ? Math.max(0, groupNames.indexOf(stackKeys[si])) : Math.max(0, visibleIdx.indexOf(si));\n const byIndex: Record<number, HoverPoint> = {};\n for (let i = 0; i < C; i++) {\n const band = bands[si][i];\n if (!band) continue;\n const isRange = !!s.range;\n const raw = isRange ? null : s.data[i];\n const rawNum = typeof raw === 'number' ? raw : band[1];\n const p0 = valPxFor(si, band[0]);\n const p1 = valPxFor(si, band[1]);\n // Overlaid: centred on the band at its own width, in front of whatever\n // the slotted series drew. Otherwise: one slot of the group.\n // Overlay width is a fraction of the FULL band, so widthRatio doesn't\n // silently compound with the category gap (which made it read far thinner\n // than the number suggests). A slotted bar still lives inside the gap.\n const autoW = s.overlay ? sizeAt(i) * (s.widthRatio ?? 0.45) : barWAt(i);\n const barGap = autoW * spec.barGapRatio;\n // A configured `barWidth` (px) narrows each bar and CENTRES it in its slot,\n // leaving the slot geometry (so grouped bars stay put) alone, clamped to the\n // slot so it can't overrun a neighbour. Undefined → auto (fills the slot).\n const barW = spec.barWidth != null && !s.overlay ? Math.min(Math.max(1, spec.barWidth), autoW) : autoW;\n const slotStart = s.overlay\n ? bandCenter(i) - autoW / 2\n : bandCenter(i) - groupInnerAt(i) / 2 + groupPos * (autoW + barGap);\n const barStart = slotStart + (autoW - barW) / 2;\n // Direction comes from the raw value's sign — stacked bands are always\n // stored [base, top] so band[1] >= band[0] would misread negatives.\n const positive = rawNum >= 0;\n const stackCell = `${stackKeys[si]}|${i}`;\n // The segment sitting ON the baseline has nothing behind it to fill a\n // notch — two stacks meeting at zero would leave a hole between them.\n const atBaseline = positive ? band[0] === 0 : band[1] === 0;\n // A range bar has TWO free ends, so both get the cap.\n const isTop = isRange || !stacked || (positive ? topSeriesFor.get(stackCell) === si : botSeriesFor.get(stackCell) === si);\n\n // Chevron force diagram: recede each segment from its shared boundaries so\n // the interlocking arrows read as SEPARATE areas rather than one continuous\n // ribbon. The tip/notch depth comes from the (unchanged) thickness, so both\n // edges pull back together and the V-shaped gap between neighbours stays\n // uniform. Clamped so a short segment keeps most of its length.\n const chevInset = spec.chevron ? Math.min(barW * 0.03, 5, Math.abs(p1 - p0) * 0.35) : 0;\n // A chevron's drawn point overflows its rect by the tip depth, and the\n // rect is itself pulled back by half the inset. The hover marker belongs\n // ON that point: left at the plain value edge it floats behind the arrow,\n // reading as though it marks nothing.\n const chevLead = spec.chevron ? chevronTipDepth(barW) - chevInset / 2 : 0;\n\n let bar: SceneBar;\n if (horizontal) {\n const x = Math.min(p0, p1) + chevInset / 2;\n const w = Math.abs(p1 - p0) - chevInset;\n const radius: [number, number, number, number] = isRange\n ? [r, r, r, r]\n : isTop\n ? positive\n ? [0, r, r, 0]\n : [r, 0, 0, r]\n : [0, 0, 0, 0];\n bar = { x, y: barStart, w, h: barW, color: s.pointColors?.[i] ?? s.color, radius, seriesIndex: si, dataIndex: i, horizontal: true, arrow: spec.chevron ? (positive ? 1 : -1) : undefined, notch: spec.chevron ? !atBaseline : undefined };\n byIndex[i] = { x: (positive ? Math.max(p0, p1) + chevLead : Math.min(p0, p1) - chevLead), y: barStart + barW / 2, value: rawNum, color: bar.color, ...(isRange ? { low: band[0], high: band[1] } : null) };\n } else {\n const y = Math.min(p0, p1) + chevInset / 2;\n const h = Math.abs(p1 - p0) - chevInset;\n const radius: [number, number, number, number] = isRange\n ? [r, r, r, r]\n : isTop\n ? positive\n ? [r, r, 0, 0]\n : [0, 0, r, r]\n : [0, 0, 0, 0];\n bar = { x: barStart, y, w: barW, h, color: s.pointColors?.[i] ?? s.color, radius, seriesIndex: si, dataIndex: i, horizontal: false, arrow: spec.chevron ? (positive ? 1 : -1) : undefined, notch: spec.chevron ? !atBaseline : undefined };\n byIndex[i] = { x: barStart + barW / 2, y: (positive ? Math.min(p0, p1) - chevLead : Math.max(p0, p1) + chevLead), value: rawNum, color: bar.color, ...(isRange ? { low: band[0], high: band[1] } : null) };\n }\n bars.push(...splitBar(bar));\n\n if (spec.showLabels && isRange) {\n // Both edges, each bound to its OWN free end of the floating bar, so they\n // ride out from the baseline (zero line) with the bar as it opens during\n // the intro instead of sitting frozen at the final low/high.\n barLabels.push(\n { seriesIndex: si, dataIndex: i, text: spec.valueFormatter(band[0]), color: theme.textColor, size: theme.labelSize, atLowEnd: true },\n { seriesIndex: si, dataIndex: i, text: spec.valueFormatter(band[1]), color: theme.textColor, size: theme.labelSize, atLowEnd: false },\n );\n } else if (spec.showLabels && stacked && typeof raw === 'number') {\n // A stacked segment has no free end to hang a label off — every segment\n // but the outermost is boxed in by its neighbours. The value goes INSIDE\n // the segment, in whichever of black/white reads on that fill, and is\n // dropped when the segment is too small to hold it rather than spilling\n // over the segments either side.\n // In percentage mode the SHARE is what the column shows, and it is\n // already what the band holds — labelling `raw` would print the\n // un-normalised figure against a percent formatter (33600%).\n const shown = spec.stack === 'percentage' ? Math.abs(band[1] - band[0]) * (raw < 0 ? -1 : 1) : raw;\n const txt = spec.valueFormatter(shown);\n const fits = horizontal\n ? bar.w > approxWidth(txt, theme.labelSize) + 8 && bar.h > theme.labelSize\n : bar.h > theme.labelSize + 6 && bar.w > approxWidth(txt, theme.labelSize) + 4;\n if (fits) {\n // Bound to the bar so it stays centred as the segment grows in — the\n // overlay recomputes its position from the bar each frame.\n barLabels.push({ seriesIndex: si, dataIndex: i, text: txt, color: onColorFor(bar.color), size: theme.labelSize, fontWeight: 600, inside: true });\n }\n } else if (spec.showLabels && typeof raw === 'number') {\n // Free-end value label. Bound to the bar (not a fixed pixel) so it rides\n // out to the tip with the bar during the entry animation instead of\n // snapping to the final position. The overlay derives the exact anchor +\n // alignment from the bar's live geometry and orientation.\n barLabels.push({ seriesIndex: si, dataIndex: i, text: spec.valueFormatter(raw), color: theme.textColor, size: theme.labelSize, atLowEnd: !positive });\n }\n }\n hoverPoints.push({ seriesIndex: si, color: s.color, label: s.label, byIndex, values: s.range ? bands[si].map((b) => (b ? b[1] : null)) : s.data });\n });\n\n // ── stack totals ──\n // One label per stack per category, past its free end. Read off the bands\n // rather than re-summing the data, so a hidden series drops out of the total\n // the same way it drops out of the column.\n // Percentage mode has nothing to total: every column is 100 by construction.\n if (spec.showTotals && stacked && spec.stack !== 'percentage') {\n for (let i = 0; i < C; i++) {\n for (const g of groupNames) {\n let top = -Infinity;\n let bottom = Infinity;\n let sum = 0;\n let any = false;\n spec.series.forEach((s, si) => {\n if (s.hidden || stackKeys[si] !== g) return;\n const b = bands[si][i];\n const v = s.data?.[i];\n if (!b) return;\n any = true;\n top = Math.max(top, b[1]);\n bottom = Math.min(bottom, b[0]);\n if (typeof v === 'number') sum += v;\n });\n if (!any) continue;\n // Percentage mode normalises every column to 100, so the interesting\n // total is the raw one the percentages were taken from.\n const txt = spec.valueFormatter(sum);\n // Past whichever end the stack actually reaches — an all-negative\n // column's free end is the bottom.\n const positive = top > 0 || bottom >= 0;\n // Bind the total to the stack's OUTERMOST segment (the one that carries\n // the free end), so the overlay tracks it past the column top as the\n // stack grows in — a fixed `texts` label would hang at the final total\n // while the column rose into it.\n const outerSeg = positive ? topSeriesFor.get(`${g}|${i}`) : botSeriesFor.get(`${g}|${i}`);\n if (outerSeg == null) continue;\n barLabels.push({ seriesIndex: outerSeg, dataIndex: i, text: txt, color: theme.textColor, size: theme.labelSize, fontWeight: 600, atLowEnd: !positive });\n }\n }\n }\n\n // ── gridlines (value axis) + axis frame ──\n const gridlines: SceneSegment[] = [];\n const axisLines: SceneSegment[] = [];\n const TICK = 5;\n const yb = plot.y + plot.height;\n // Stroke styles for the chrome. The value axis owns the gridlines (they are\n // drawn off its ticks); the two frame lines take the dash of the axis that\n // runs along them, which swaps with `horizontal`.\n const valueDash = dashPattern(spec.valueDash);\n const gridDash = dashPattern(spec.valueGridDash);\n const categoryDash = dashPattern(spec.categoryDash);\n if (!spec.valueHidden && !compact) {\n for (const t of vTickVals) {\n const pv = valPx(t);\n if (horizontal) {\n gridlines.push({ x1: pv, y1: plot.y, x2: pv, y2: yb, color: theme.gridLineColor, width: 1, dash: gridDash });\n if (spec.axisTicks) axisLines.push({ x1: pv, y1: yb, x2: pv, y2: yb + TICK, color: theme.axisLineColor, width: 1, dash: valueDash });\n } else {\n gridlines.push({ x1: plot.x, y1: pv, x2: plot.x + plot.width, y2: pv, color: theme.gridLineColor, width: 1, dash: gridDash });\n if (spec.axisTicks) axisLines.push({ x1: plot.x - TICK, y1: pv, x2: plot.x, y2: pv, color: theme.axisLineColor, width: 1, dash: valueDash });\n }\n }\n }\n if (!compact) {\n const catLine = spec.categoryAxisLine !== false;\n const valLine = spec.valueAxisLine !== false;\n const valBreaks = (vScale as { breaks?: readonly { px: number; gap: number }[] }).breaks ?? [];\n // horizontal: the category axis runs up the LEFT edge, the value axis along\n // the BOTTOM. vertical: value up the left, category along the bottom. The\n // VALUE axis is interrupted (with a zigzag) around each break; the category\n // axis is always a plain line.\n if (catLine) {\n axisLines.push(\n horizontal\n ? { x1: plot.x, y1: plot.y, x2: plot.x, y2: plot.y + plot.height, color: theme.axisLineColor, width: 1, dash: categoryDash }\n : { x1: plot.x, y1: plot.y + plot.height, x2: plot.x + plot.width, y2: plot.y + plot.height, color: theme.axisLineColor, width: 1, dash: categoryDash },\n );\n }\n if (valLine) {\n if (horizontal) {\n // Value axis along the bottom (x). A cut sits `px` from the left. The\n // tear runs vertically, up the plot's whole height, at the cut.\n const cuts = valBreaks.map((b) => ({ px: b.px, gap: b.gap }));\n axisLines.push(...axisLineWithBreaks('x', plot.x, plot.x + plot.width, plot.y + plot.height, cuts, theme.axisLineColor, valueDash));\n for (const c of cuts) axisLines.push(...breakBandSegments('x', plot.x + c.px, plot.x + c.px + c.gap, plot.y, plot.y + plot.height, theme.axisLineColor));\n } else {\n // Value axis up the left (y), bottom-up: a cut at offset `px` sits\n // `plot.height - px - gap` above the bottom. The tear runs horizontally,\n // across the plot's whole width, at the cut.\n const cuts = valBreaks.map((b) => ({ px: plot.height - b.px - b.gap, gap: b.gap }));\n axisLines.push(...axisLineWithBreaks('y', plot.y, plot.y + plot.height, plot.x, cuts, theme.axisLineColor, valueDash));\n for (const c of cuts) axisLines.push(...breakBandSegments('y', plot.y + c.px, plot.y + c.px + c.gap, plot.x, plot.x + plot.width, theme.axisLineColor));\n }\n }\n }\n\n // ── overlay text (title, value ticks, category ticks, axis titles) ──\n if (spec.title && !compact) {\n const tt = titlePlacement(spec.titleAlign, plot.x, plot.width);\n texts.push({ x: tt.x, y: legendBandTop + 6, text: spec.title, color: theme.textColor, fontSize: theme.titleSize, fontWeight: 600, align: tt.align, baseline: 'top', key: 'title' });\n // Under the title and sharing its alignment — a source line, a unit, the\n // caveat a title should not have to carry.\n if (spec.subtitle) {\n texts.push({\n x: tt.x,\n y: legendBandTop + 6 + theme.titleSize + 4,\n text: spec.subtitle,\n color: theme.textColorMuted,\n fontSize: theme.labelSize,\n align: tt.align,\n baseline: 'top',\n key: 'subtitle',\n });\n }\n }\n // The second value axis: its own line down the right-hand gutter, its own\n // ticks, no gridlines. Two sets of gridlines at two spacings turn the plot\n // into a mesh nobody can read a value off.\n if (hasAxis2 && !spec.valueAxis2!.hidden && !compact && !horizontal) {\n const rx = plot.x + plot.width;\n axisLines.push({ x1: rx, y1: plot.y, x2: rx, y2: plot.y + plot.height, color: theme.axisLineColor, width: 1, dash: valueDash });\n v2TickVals.forEach((t, i) => {\n const pv = valPx2(t);\n if (spec.axisTicks) axisLines.push({ x1: rx, y1: pv, x2: rx + TICK, y2: pv, color: theme.axisLineColor, width: 1, dash: valueDash });\n texts.push({ x: rx + 8, y: pv, text: v2TickLabels[i], color: theme.textColorMuted, fontSize: theme.labelSize, align: 'start', baseline: 'middle', key: `v2t-${i}` });\n });\n if (spec.valueAxis2!.label) {\n texts.push({ x: width - 4, y: plot.y + plot.height / 2, text: spec.valueAxis2!.label, color: theme.textColor, fontSize: theme.labelSize, align: 'center', baseline: 'bottom', rotate: -90, key: 'val2-axis-title' });\n }\n }\n if (!spec.valueHidden && !spec.valueHideTicks && !compact) {\n vTickVals.forEach((t, i) => {\n const pv = valPx(t);\n if (horizontal) {\n texts.push({ x: pv, y: plot.y + plot.height + 6, text: vTickLabels[i], color: theme.textColorMuted, fontSize: theme.labelSize, align: 'center', baseline: 'top', key: `vt-${i}` });\n } else {\n texts.push({ x: plot.x - 8, y: pv, text: vTickLabels[i], color: theme.textColorMuted, fontSize: theme.labelSize, align: 'end', baseline: 'middle', key: `vt-${i}` });\n }\n });\n }\n const mainPositions: number[] = [];\n // Category labels along y (horizontal) stack tightly; along x (vertical) they\n // need more room. Thin them to the available spacing per orientation.\n const minSpacing = horizontal ? theme.labelSize + 6 : 48;\n const step = Math.max(1, Math.ceil(C / Math.max(1, Math.floor(mainLen / minSpacing))));\n for (let i = 0; i < C; i++) {\n const bc = bandCenter(i);\n mainPositions.push(bc);\n const atTick = i % step === 0;\n if (spec.axisTicks && !compact && atTick && !spec.categoryHidden) {\n if (horizontal) axisLines.push({ x1: plot.x - TICK, y1: bc, x2: plot.x, y2: bc, color: theme.axisLineColor, width: 1 });\n else axisLines.push({ x1: bc, y1: yb, x2: bc, y2: yb + TICK, color: theme.axisLineColor, width: 1 });\n }\n if (spec.categoryHidden || spec.categoryHideTicks || compact || !atTick) continue;\n if (horizontal) {\n texts.push({ x: plot.x - 8 - lowEndRoom, y: bc, text: catLabels[i], color: theme.textColorMuted, fontSize: theme.labelSize, align: 'end', baseline: 'middle', key: `ct-${i}` });\n if (mirrorCats) {\n texts.push({ x: plot.x + plot.width + 8 + (spec.showLabels ? maxDataLabelW + 4 : 0), y: bc, text: catLabels[i], color: theme.textColorMuted, fontSize: theme.labelSize, align: 'start', baseline: 'middle', key: `ctm-${i}` });\n }\n } else if (catRot) {\n // Rotated about the label's own centre by the overlay, so the centre is\n // placed where the tilted box's END lands on the tick: step back along the\n // text direction by half its length, in both axes.\n const w = approxWidth(catLabels[i], theme.labelSize);\n const dir = catRot < 0 ? -1 : 1;\n texts.push({\n x: bc + (dir * w * Math.cos(catRotRad)) / 2,\n y: plot.y + plot.height + 6 + lowEndRoom + (w * Math.sin(catRotRad)) / 2,\n text: catLabels[i],\n color: theme.textColorMuted,\n fontSize: theme.labelSize,\n align: 'center',\n baseline: 'middle',\n rotate: catRot,\n key: `ct-${i}`,\n });\n } else {\n // Upright, a label may use the room up to its neighbouring SHOWN labels —\n // when the axis is thinned (every `step`-th band labelled), the skipped\n // bands between them are free, so a many-category axis isn't truncated to\n // its bare band width (…which turned \"Day 1\", \"Day 2\"… all into \"D…\").\n // step === 1 collapses to the old own-band width, so a variwide column's\n // name still can't run over its neighbours'.\n const nextC = i + step < C ? bandCenter(i + step) : bc + step * sizeAt(i);\n const prevC = i - step >= 0 ? bandCenter(i - step) : bc - step * sizeAt(i);\n const room = Math.min(nextC - bc, bc - prevC) - 6;\n texts.push({ x: bc, y: plot.y + plot.height + 6 + lowEndRoom, text: ellipsize(catLabels[i], room, theme.labelSize), color: theme.textColorMuted, fontSize: theme.labelSize, align: 'center', baseline: 'top', key: `ct-${i}` });\n }\n }\n\n // ── axis titles (gutters reserved above) — category runs along the main axis\n // (x for vertical, y for horizontal), value along the cross axis ──\n if (!compact) {\n const catTitle = spec.categoryLabel;\n const valTitle = spec.valueLabel;\n if (horizontal) {\n // categories on y (left, rotated), values on x (bottom, centred)\n if (catTitle) texts.push({ x: 4, y: plot.y + plot.height / 2, text: catTitle, color: theme.textColor, fontSize: theme.labelSize, align: 'center', baseline: 'top', rotate: -90, key: 'cat-axis-title' });\n if (valTitle) texts.push({ x: plot.x + plot.width / 2, y: height - 2 - legendBandBottom, text: valTitle, color: theme.textColor, fontSize: theme.labelSize, align: 'center', baseline: 'bottom', key: 'val-axis-title' });\n } else {\n // values on y (left, rotated), categories on x (bottom, centred)\n if (valTitle) texts.push({ x: 4, y: plot.y + plot.height / 2, text: valTitle, color: theme.textColor, fontSize: theme.labelSize, align: 'center', baseline: 'top', rotate: -90, key: 'val-axis-title' });\n if (catTitle) texts.push({ x: plot.x + plot.width / 2, y: height - 2 - legendBandBottom, text: catTitle, color: theme.textColor, fontSize: theme.labelSize, align: 'center', baseline: 'bottom', key: 'cat-axis-title' });\n }\n }\n\n const legend: LegendItem[] =\n spec.legend === 'none' || compact ? [] : spec.series.map((s, si) => ({ label: s.label, color: s.color, seriesIndex: si, hidden: s.hidden, x: 0, y: 0 }));\n\n return {\n width,\n height,\n plot,\n background: theme.background === 'transparent' ? undefined : theme.background,\n gridlines,\n axisLines,\n areas: [],\n bars,\n slices: [],\n lines: [],\n markers: [],\n texts,\n barLabels,\n legend,\n legendPosition: spec.legend,\n xPositions: mainPositions,\n xValues: spec.categories,\n xLabels: catLabels,\n barBaseline: basePx,\n hoverPoints,\n };\n}\n\n/**\n * The polar form: one concentric RING per category, with the value axis running\n * as an angle instead of a length.\n *\n * It reuses everything above it — the same stacked bands, the same domain — and\n * only changes how a band becomes geometry: `[base, top]` becomes a pair of\n * angles rather than a pair of pixels, and the category index picks a radius\n * instead of a position along an axis. That keeps stacking, hiding a series\n * from the legend, and percentage normalisation working unchanged.\n *\n * The value axis deliberately spans less than the full circle. A ring that\n * closes on itself has no readable start or end, and the quarter it gives up is\n * where the category names go.\n */\nfunction radialScene(\n spec: BarChartSpec,\n theme: EngineTheme,\n width: number,\n height: number,\n bands: ([number, number] | null | undefined)[][],\n vDomain: Domain,\n catLabels: string[],\n C: number,\n): RenderScene {\n const texts: TextItem[] = [];\n const subtitleH = spec.subtitle ? theme.labelSize + 4 : 0;\n const titleH = spec.title ? theme.titleSize + 10 + subtitleH : 0;\n\n const legendActive = !!spec.legend && spec.legend !== 'none' && spec.series.length > 1;\n const legendAtBottom = legendActive && spec.legend!.startsWith('bottom');\n const legendTopRow = legendActive && !legendAtBottom && !(spec.legend === 'left' || spec.legend === 'right');\n const legendRows = legendActive ? estimateLegendRows(spec.series.map((s) => s.label), theme.labelSize, width * 0.86) : 1;\n const legendBandH = spec.legendExtent != null && (legendTopRow || legendAtBottom) ? spec.legendExtent + 8 : legendRows * (theme.labelSize + 8) + 6;\n const legendBandTop = legendTopRow ? legendBandH : 0;\n const legendBandBottom = legendAtBottom ? legendBandH : 0;\n\n // The names hang off the left of the circle, so they get a gutter of their\n // own — otherwise the rings are centred in the full width and the whole chart\n // reads as pushed to the right by however long the longest name is.\n const nameGutter =\n spec.categoryHidden || spec.categoryHideTicks\n ? 0\n : Math.max(0, ...catLabels.map((t) => approxWidth(t, theme.labelSize))) + 12;\n const plot: Rect = {\n x: nameGutter,\n y: titleH + legendBandTop,\n width: Math.max(1, width - nameGutter),\n height: Math.max(1, height - titleH - legendBandTop - legendBandBottom),\n };\n const cx = plot.x + plot.width / 2;\n const cy = plot.y + plot.height / 2;\n // The value axis wraps around the OUTSIDE as tick labels, so reserve a ring of\n // gutter for them before sizing the plot radius.\n const vFmt = spec.valueTickFormatter ?? spec.valueFormatter;\n const vTicks = spec.valueHidden || spec.valueHideTicks ? [] : sectionedTicks(vDomain, [], spec.valueScale, 8).filter((t) => t >= vDomain[0] - 1e-9 && t <= vDomain[1] + 1e-9);\n const vTickMaxW = Math.max(0, ...vTicks.map((t) => approxWidth(vFmt(t), theme.labelSize)));\n const valueGutter = vTicks.length ? vTickMaxW + 18 : 0;\n const R = Math.max(8, Math.min(plot.width, plot.height) / 2 - 8 - valueGutter);\n const hole = R * Math.max(0, Math.min(0.9, spec.polarHole ?? 0.22));\n const ring = C > 0 ? (R - hole) / C : R - hole;\n const thickness = Math.max(1, ring * (1 - spec.categoryGapRatio));\n\n const START = -Math.PI / 2; // 12 o'clock\n const sweep = 2 * Math.PI * Math.max(0.1, Math.min(1, spec.polarSweep ?? 0.75));\n const [lo, hi] = vDomain;\n const span = hi - lo || 1;\n const angleOf = (v: number) => START + ((v - lo) / span) * sweep;\n\n const slices: RenderScene['slices'] = [];\n const hoverPoints: HoverSeries[] = [];\n const midRadii: number[] = [];\n for (let i = 0; i < C; i++) {\n // Category 0 takes the OUTSIDE ring: a reader's eye lands on the outermost\n // band first, and the first category is the one the data leads with.\n const outerR = R - i * ring;\n midRadii.push(outerR - thickness / 2);\n }\n\n spec.series.forEach((s, si) => {\n if (s.hidden) return;\n const byIndex: Record<number, HoverPoint> = {};\n for (let i = 0; i < C; i++) {\n const band = bands[si][i];\n if (!band) continue;\n const outerR = R - i * ring;\n const innerR = outerR - thickness;\n const a0 = angleOf(band[0]);\n const a1 = angleOf(band[1]);\n if (Math.abs(a1 - a0) < 1e-6) continue;\n slices.push({\n cx,\n cy,\n innerR,\n outerR,\n startAngle: Math.min(a0, a1),\n endAngle: Math.max(a0, a1),\n color: s.pointColors?.[i] ?? s.color,\n dataIndex: i,\n seriesIndex: si,\n // A stroked band with flat internal joins; the ring's head + tail get a\n // round cap in the post-pass below, so stacked segments blend into one\n // band rather than each rounding its own corners into a split.\n pill: true,\n capStart: false,\n capEnd: false,\n });\n // The hover anchor is the middle of this segment's arc, so the tooltip\n // and its marker land ON the band rather than at the plot centre.\n const mid = (a0 + a1) / 2;\n const midR = (innerR + outerR) / 2;\n byIndex[i] = { x: cx + midR * Math.cos(mid), y: cy + midR * Math.sin(mid), value: typeof s.data?.[i] === 'number' ? (s.data[i] as number) : band[1] };\n }\n hoverPoints.push({ seriesIndex: si, color: s.color, label: s.label, byIndex, values: s.data ?? [] });\n });\n\n // Round only the OUTERMOST ends of each ring: the segment that opens the ring\n // gets a round head, the one that closes it a round tail; every internal join\n // stays flat so the colours blend into a single band.\n for (let i = 0; i < C; i++) {\n const ringSlices = slices.filter((s) => s.dataIndex === i);\n if (!ringSlices.length) continue;\n let first = ringSlices[0];\n let last = ringSlices[0];\n for (const s of ringSlices) {\n if (s.startAngle < first.startAngle) first = s;\n if (s.endAngle > last.endAngle) last = s;\n }\n first.capStart = true;\n last.capEnd = true;\n }\n\n // Value-axis scale wrapped around the outside: each tick sits at its own angle\n // just beyond the outermost ring, so the reader can trace a band back to a value.\n // Anchor each label by the EDGE facing the centre (via align/baseline chosen\n // from the tick's direction) so the gap to the ring is EVEN regardless of how\n // wide the number is — centring made a long number crowd the band while a short\n // one sat off it.\n const labelR = R + 16;\n for (const t of vTicks) {\n const a = angleOf(t);\n const cos = Math.cos(a);\n const sin = Math.sin(a);\n texts.push({\n x: cx + labelR * cos,\n y: cy + labelR * sin,\n text: vFmt(t),\n color: theme.textColorMuted,\n fontSize: theme.labelSize,\n align: cos > 0.35 ? 'start' : cos < -0.35 ? 'end' : 'center',\n baseline: sin > 0.35 ? 'top' : sin < -0.35 ? 'bottom' : 'middle',\n key: `vt-${t}`,\n });\n }\n\n // Category names in the quarter the value axis gives up, each on its own\n // ring's centre line, right-aligned to the 12 o'clock radius they start at.\n if (!spec.categoryHidden && !spec.categoryHideTicks) {\n for (let i = 0; i < C; i++) {\n texts.push({\n // Clear of the bars: a band starts at 12 o'clock reaching left to\n // cx - thickness/2, so hold the name a gap short of that.\n x: cx - thickness / 2 - 12,\n y: cy - midRadii[i],\n text: catLabels[i],\n color: theme.textColorMuted,\n fontSize: theme.labelSize,\n align: 'end',\n baseline: 'middle',\n key: `ct-${i}`,\n });\n }\n }\n\n if (spec.title) {\n const tt = titlePlacement(spec.titleAlign, plot.x, plot.width);\n texts.push({ x: tt.x, y: legendBandTop + 6, text: spec.title, color: theme.textColor, fontSize: theme.titleSize, fontWeight: 600, align: tt.align, baseline: 'top', key: 'title' });\n if (spec.subtitle) {\n texts.push({ x: tt.x, y: legendBandTop + 6 + theme.titleSize + 6, text: spec.subtitle, color: theme.textColorMuted, fontSize: theme.labelSize, align: tt.align, baseline: 'top', key: 'subtitle' });\n }\n }\n\n const legend: LegendItem[] =\n spec.legend === 'none' ? [] : spec.series.map((s, si) => ({ label: s.label, color: s.color, seriesIndex: si, hidden: s.hidden, x: 0, y: 0 }));\n\n return {\n width,\n height,\n plot,\n background: theme.background === 'transparent' ? undefined : theme.background,\n gridlines: [],\n axisLines: [],\n areas: [],\n bars: [],\n slices,\n lines: [],\n markers: [],\n texts,\n legend,\n legendPosition: spec.legend,\n polar: true,\n // Radii, not positions along an axis: the engine resolves a polar hover by\n // how far the pointer is from the centre, which is exactly which ring it is\n // over.\n xPositions: midRadii,\n xValues: spec.categories,\n xLabels: catLabels,\n hoverPoints,\n };\n}\n","/*\n * Chart engine — BarChartEngine\n * ===========================================================\n * The bar-chart sibling of LineChartEngine. Same canvas +\n * DOM-overlay plumbing and the same render pipeline, but drives\n * computeBarLayout and adds bar-appropriate interaction: hover\n * resolves the nearest category along the main axis (x for vertical,\n * y for horizontal) and clicks hit-test the actual bar rectangles.\n * ===========================================================\n */\n\nimport { computeBarLayout, type BarChartSpec } from './bar-layout';\nimport type { EngineTheme } from './layout';\nimport { drawSceneCanvas } from './renderer-canvas';\nimport { syncOverlay, renderBarLabels } from './overlay';\nimport { clearHover, renderHover, type HoverOptions } from './hover';\nimport { watchDevicePixelRatio, type DprWatcher } from './dpr';\nimport { resolveIntro, stepAnimation, prefersReducedMotion, drillScene } from './animate';\nimport { mixColor } from './color';\nimport { nearestIndex } from './hit-test';\nimport { isRtl, mirrorScene, watchDirection, type DirectionWatcher } from './rtl';\nimport type { MdChartAnimation } from '../types';\nimport type { EngineCallbacks } from './chart';\nimport type { LegendItem, RenderScene, SceneBar, SceneSlice } from './scene';\n\n/** A pointer's hit-test against one annular segment: inside its radius band AND\n * its angular span (folded so a rotated / negative range still works). */\nfunction pointInSlice(px: number, py: number, s: SceneSlice): boolean {\n const dx = px - s.cx;\n const dy = py - s.cy;\n const r = Math.hypot(dx, dy);\n if (r < s.innerR || r > s.outerR) return false;\n const lo = Math.min(s.startAngle, s.endAngle);\n const hi = Math.max(s.startAngle, s.endAngle);\n const twoPi = Math.PI * 2;\n let d = (Math.atan2(dy, dx) - lo) % twoPi;\n if (d < 0) d += twoPi;\n return d <= hi - lo;\n}\n\n/** The polar ring segment under the pointer, or null in the hole / gaps / outside\n * the rings — which is what lets the tooltip appear ONLY over a segment. */\nexport function sliceAt(slices: SceneSlice[], px: number, py: number): SceneSlice | null {\n for (const s of slices) if (s.endAngle !== s.startAngle && pointInSlice(px, py, s)) return s;\n return null;\n}\n\n/** How far a faded-out ring segment recedes toward the surface at full dim. */\nconst POLAR_DIM = 0.62;\n/** Fade in / out of the spotlight, ms. */\nconst POLAR_FADE_MS = 200;\n/** Dwell before the tooltip appears on a freshly-hovered segment, ms. */\nconst POLAR_DWELL_MS = 220;\n\nconst sliceKey = (dataIndex: number, seriesIndex: number | undefined): string => `${dataIndex}:${seriesIndex ?? -1}`;\n\n/** Apply the per-segment dim (0 = full colour, 1 = fully faded to the surface) so\n * the spotlight can fade in and out rather than snapping. */\nexport function emphasizePolar(scene: RenderScene, dimByKey: Map<string, number>, surface: string): RenderScene {\n return {\n ...scene,\n slices: scene.slices.map((s) => {\n const d = dimByKey.get(sliceKey(s.dataIndex, s.seriesIndex)) ?? 0;\n return d > 0.002 ? { ...s, color: mixColor(s.color, surface, POLAR_DIM * d) } : s;\n }),\n };\n}\n\nconst lerp = (a: number, b: number, e: number): number => a + (b - a) * e;\n\n/** Time constant of the bar-race follow: a bar closes ~1 frame's worth of\n * `dt/FOLLOW_MS` of its remaining gap each frame (an exponential ease-out). */\nconst FOLLOW_MS = 260;\n\n/**\n * A stable-identity keyer for a scene's bars.\n *\n * When categories are UNIQUE, identity is the series + CATEGORY value: a bar race\n * reorders the categories every step, so the entity (\"ATL\") that was in slot 0\n * moves to slot 1 and stays the same bar sliding between ranks. When categories\n * REPEAT (a rolling window with labels like Q1,Q2,Q3,Q4,Q1), the category is not\n * an identity — the two \"Q1\" bars would collide onto one key and one would draw\n * on top of the other (flicker) — so identity falls back to the SLOT index.\n */\nfunction keyerFor(scene: RenderScene): (b: SceneBar) => string {\n const cats = (scene.xValues ?? []).map((c) => (c == null ? '' : String(c)));\n const unique = cats.length > 0 && new Set(cats).size === cats.length;\n return unique ? (b) => `${b.seriesIndex}::${cats[b.dataIndex] ?? b.dataIndex}` : (b) => `${b.seriesIndex}#${b.dataIndex}`;\n}\n\nexport function barKey(scene: RenderScene, b: SceneBar): string {\n return keyerFor(scene)(b);\n}\n\n/**\n * A key for EVERY bar in the scene, in order — occurrence-aware, so pieces that\n * would otherwise collide keep distinct identities.\n *\n * A value-axis BREAK splits one bar into several pieces that all carry the same\n * (series, category) — and so the same base key. Keyed only by that, they\n * collapse onto one entry in `displayed`, and the follow loop drops every piece\n * but the last: a broken-axis bar loses the piece past the break (its free end),\n * leaving the outlier stuck at the break line. The 2nd+ piece of a colliding key\n * gets a `~n` suffix so all pieces survive and each eases to its own target.\n */\nfunction barKeys(scene: RenderScene): string[] {\n const base = keyerFor(scene);\n const seen = new Map<string, number>();\n return scene.bars.map((b) => {\n const k = base(b);\n const n = seen.get(k) ?? 0;\n seen.set(k, n + 1);\n return n === 0 ? k : `${k}~${n}`;\n });\n}\n\nexport function barsByKey(scene: RenderScene): Map<string, SceneBar> {\n const keys = barKeys(scene);\n const m = new Map<string, SceneBar>();\n scene.bars.forEach((b, i) => m.set(keys[i], b));\n return m;\n}\n\n/** A bar mid-slide between its old and new rank/length. */\nexport function lerpBar(from: SceneBar, to: SceneBar, e: number): SceneBar {\n return { ...to, x: lerp(from.x, to.x, e), y: lerp(from.y, to.y, e), w: lerp(from.w, to.w, e), h: lerp(from.h, to.h, e) };\n}\n\n/** True if any bar moved / resized / entered / left between two scenes. */\nexport function barsDiffer(a: RenderScene, b: RenderScene): boolean {\n if (a.bars.length !== b.bars.length) return true;\n const am = barsByKey(a);\n for (const nb of b.bars) {\n const ob = am.get(barKey(b, nb));\n if (!ob) return true;\n if (Math.abs(ob.x - nb.x) > 0.5 || Math.abs(ob.y - nb.y) > 0.5 || Math.abs(ob.w - nb.w) > 0.5 || Math.abs(ob.h - nb.h) > 0.5) return true;\n }\n return false;\n}\n\nexport class BarChartEngine {\n private canvas: HTMLCanvasElement;\n private overlay: HTMLDivElement;\n /** Legend lives here: same box, but NOT clipped, so a focus ring keeps its\n * outer pixels where the legend hugs the plot edge. */\n private legendLayer: HTMLDivElement;\n /** Bar value labels get their own layer so they can be re-rendered from the\n * bars' geometry each animation frame — the static overlay above is synced\n * only once per render. */\n private barLabelLayer: HTMLDivElement;\n private hoverLayer: HTMLDivElement;\n private ctx: CanvasRenderingContext2D | null = null;\n private spec: BarChartSpec | null = null;\n private theme: EngineTheme | null = null;\n private scene: RenderScene | null = null;\n private cb: EngineCallbacks = {};\n private hoverRaf = 0;\n private lastHoverIndex = -2;\n private hoverEnabled = true;\n /** When true, the pointer shows a `pointer` (hand) cursor over a bar, signalling\n * the bar is actionable (e.g. drillable). Set by the component's `clickable`. */\n private clickable = false;\n private hoverOpts: HoverOptions = {};\n private hasRendered = false;\n private introRaf = 0;\n /** The DPR the last frame was drawn at, so a hover re-draw matches it. */\n private lastDpr = 1;\n /** The bar-race follow loop (eases bars toward the live target each frame). */\n private followRaf = 0;\n private followLast = 0;\n /** The polar segment currently spotlighted (category + series), or null. */\n private hoverSlice: { dataIndex: number; seriesIndex: number } | null = null;\n /** Per-segment dim strength (0..1), eased toward its target so the spotlight\n * fades in and out. */\n private dimAnim = new Map<string, number>();\n private dimRaf = 0;\n private dimLast = 0;\n /** The pointer's last position, so a delayed tooltip opens where the mouse is. */\n private lastPointer = { x: 0, y: 0 };\n private tooltipTimer = 0;\n private tooltipShown = false;\n /** The bars currently ON SCREEN, keyed by identity — the start state a data\n * update tweens FROM (mid-flight if one update interrupts another, so a race\n * re-fed every frame follows smoothly). */\n private displayed: Map<string, SceneBar> | null = null;\n /** Armed by {@link drill}: the band along the category axis that the NEXT\n * scene should unfold out of. Consumed by the first render after it. */\n private pendingDrill: { from: number; size: number; split: boolean } | null = null;\n private drillArmRaf = 0;\n private lastW = 0;\n private lastH = 0;\n private dprWatch: DprWatcher = watchDevicePixelRatio(() => this.render());\n /** Host is laid out right-to-left — the finished scene is mirrored. */\n private rtl = false;\n /** Re-render when the page (or an ancestor) flips direction, but only if THIS\n * chart's own computed direction actually changed. */\n private dirWatch: DirectionWatcher = watchDirection(() => {\n if (isRtl(this.container) !== this.rtl) this.render();\n });\n\n constructor(private container: HTMLElement) {\n if (getComputedStyle(container).position === 'static') container.style.position = 'relative';\n\n this.canvas = document.createElement('canvas');\n this.canvas.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;display:block';\n this.canvas.setAttribute('part', 'plot-canvas');\n\n this.overlay = document.createElement('div');\n this.overlay.style.cssText = 'position:absolute;inset:0;pointer-events:none;overflow:hidden';\n\n this.legendLayer = document.createElement('div');\n this.legendLayer.style.cssText = 'position:absolute;inset:0;pointer-events:none;overflow:visible';\n\n this.barLabelLayer = document.createElement('div');\n this.barLabelLayer.style.cssText = 'position:absolute;inset:0;pointer-events:none;overflow:hidden';\n\n this.hoverLayer = document.createElement('div');\n this.hoverLayer.style.cssText = 'position:absolute;inset:0;pointer-events:none;overflow:hidden';\n\n container.append(this.canvas, this.overlay, this.legendLayer, this.barLabelLayer, this.hoverLayer);\n this.ctx = this.canvas.getContext('2d');\n\n this.canvas.addEventListener('pointermove', this.handlePointerMove);\n this.canvas.addEventListener('pointerleave', this.handlePointerLeave);\n this.canvas.addEventListener('click', this.handleClick);\n }\n\n /** The current render scene — for diagnostics/tests. */\n getScene(): RenderScene | null {\n return this.scene;\n }\n\n /** Enable/disable the hover crosshair + tooltip. */\n setHoverEnabled(enabled: boolean): void {\n this.hoverEnabled = enabled;\n if (!enabled) clearHover(this.hoverLayer);\n }\n\n /** Show a hand cursor over bars to signal they're actionable (drillable). */\n setClickable(enabled: boolean): void {\n this.clickable = enabled;\n if (!enabled) this.canvas.style.cursor = '';\n }\n\n /** True when (cx, cy) — canvas-relative px — is inside any drawn bar rect. */\n private overBar(cx: number, cy: number): boolean {\n return !!this.scene?.bars.some((b) => cx >= b.x && cx <= b.x + b.w && cy >= b.y && cy <= b.y + b.h);\n }\n\n /** Install the tooltip extras (custom content renderer / missing-value\n * formatter). Presentation only — it never re-runs layout. */\n setTooltip(opts: HoverOptions): void {\n this.hoverOpts = opts;\n }\n\n\n\n /**\n * Feed the engine a new spec. `opts.animate === false` SNAPS to the new scene\n * instead of easing into it — for a zoom / pan, where the whole category layout\n * changes at once and easing the bars across it reads as them sliding together\n * (a view change is direct manipulation; it must track, not animate).\n */\n setSpec(spec: BarChartSpec, theme: EngineTheme, cb: EngineCallbacks = {}, opts: { animate?: boolean } = {}): void {\n this.spec = spec;\n this.theme = theme;\n this.cb = cb;\n this.render(opts);\n }\n\n resize(): void {\n // Skip the ResizeObserver's initial same-size callback so it can't cancel\n // the intro animation (see LineChartEngine.resize for the full rationale).\n const rect = this.container.getBoundingClientRect();\n if (Math.round(rect.width) === this.lastW && Math.round(rect.height) === this.lastH) return;\n this.render();\n }\n\n toDataURL(type = 'image/png'): string {\n // Guard for canvases that can't export (mock-doc / SSR): return '' rather\n // than throwing, so the host's toDataURL() degrades gracefully (matches the\n // line engine).\n return typeof this.canvas.toDataURL === 'function' ? this.canvas.toDataURL(type) : '';\n }\n\n dispose(): void {\n if (this.hoverRaf) cancelAnimationFrame(this.hoverRaf);\n // stopIntro rather than a bare cancel. Nothing depends on the clear here —\n // dispose() removes the canvas a few lines down — but routing EVERY cancel\n // of introRaf through stopIntro is what makes the invariant hold: the\n // inline opacity is only ever non-empty while the entrance loop is live.\n // The bug this fixes was one cancel site that forgot the clear.\n this.stopIntro();\n cancelAnimationFrame(this.drillArmRaf);\n cancelAnimationFrame(this.dimRaf);\n cancelAnimationFrame(this.followRaf);\n clearTimeout(this.tooltipTimer);\n this.canvas.removeEventListener('pointermove', this.handlePointerMove);\n this.canvas.removeEventListener('pointerleave', this.handlePointerLeave);\n this.canvas.removeEventListener('click', this.handleClick);\n this.dprWatch.dispose();\n this.dirWatch.dispose();\n this.canvas.remove();\n this.overlay.remove();\n this.barLabelLayer.remove();\n this.hoverLayer.remove();\n this.spec = null;\n this.scene = null;\n }\n\n private render(opts: { animate?: boolean } = {}): void {\n if (!this.spec || !this.theme) return;\n this.dprWatch.update();\n const rect = this.container.getBoundingClientRect();\n const w = Math.round(rect.width);\n const h = Math.round(rect.height);\n if (w < 2 || h < 2) return;\n // Capture the previous scene + size BEFORE they are overwritten: a data\n // update at the SAME size tweens the bars to their new ranks; a resize / dpr\n // change snaps (sliding bars on a resize would be nonsense).\n const oldScene = this.scene;\n const sizeChanged = w !== this.lastW || h !== this.lastH;\n this.lastW = w;\n this.lastH = h;\n\n const dpr = Math.min(window.devicePixelRatio || 1, 4);\n this.lastDpr = dpr;\n // A fresh scene invalidates any spotlight / pending tooltip, and a hover\n // callback queued against the OLD scene must not paint over the new one.\n this.hoverSlice = null;\n this.dimAnim.clear();\n cancelAnimationFrame(this.dimRaf);\n this.dimRaf = 0;\n if (this.hoverRaf) {\n cancelAnimationFrame(this.hoverRaf);\n this.hoverRaf = 0;\n }\n clearTimeout(this.tooltipTimer);\n this.tooltipShown = false;\n this.canvas.width = w * dpr;\n this.canvas.height = h * dpr;\n\n const hadCategories = this.scene?.xPositions.length ?? 0;\n // Layout runs left-to-right; an RTL host gets the finished frame mirrored, so\n // no part of the geometry / animation pipeline needs to know about direction.\n this.rtl = isRtl(this.container);\n const layout = (): RenderScene => {\n const s = computeBarLayout(this.spec!, this.theme!, w, h);\n return this.rtl ? mirrorScene(s) : s;\n };\n this.scene = layout();\n // A tooltip open over the OLD data must not survive a swap that replaced it:\n // after a drill it would name the level that just left. Re-resolving at the\n // same index keeps a live chart (a race re-feeding every frame) showing a\n // correct tooltip under a stationary pointer, and drops it when the index it\n // was on no longer exists.\n if (this.lastHoverIndex >= 0) {\n if (this.lastHoverIndex < this.scene.xPositions.length && hadCategories === this.scene.xPositions.length) {\n this.focusIndexInternal(this.lastHoverIndex);\n } else {\n clearHover(this.hoverLayer);\n this.lastHoverIndex = -1;\n }\n }\n syncOverlay(this.overlay, this.scene, this.theme.fontFamily, { onLegendClick: this.onLegendToggle }, this.rtl, this.legendLayer);\n // Two-pass legend: a wrapped legend's real extent isn't known until it's in\n // the DOM. Re-reserve the gutter to its measured height/width and re-lay-out\n // so a many-series legend never spills onto the plot.\n const legendEl = this.legendLayer.querySelector('[part=\"legend\"]') as HTMLElement | null;\n if (legendEl && this.spec.legend && this.spec.legend !== 'none') {\n const side = this.spec.legend === 'left' || this.spec.legend === 'right';\n const extent = side ? legendEl.offsetWidth : legendEl.offsetHeight;\n if (extent > 0 && Math.abs((this.spec.legendExtent ?? -1) - extent) > 2) {\n this.spec.legendExtent = extent;\n this.scene = layout();\n syncOverlay(this.overlay, this.scene, this.theme.fontFamily, { onLegendClick: this.onLegendToggle }, this.rtl, this.legendLayer);\n }\n }\n const { variant, duration } = resolveIntro(this.spec);\n const drill = this.pendingDrill;\n const reduce = prefersReducedMotion();\n const motion = variant !== 'none' && !reduce;\n // An EMPTY scene is not a chart that has been shown. A host that hydrates\n // before its data lands (props assigned after upgrade — the docs/demo\n // pattern) renders once with no series at all; counting that as \"rendered\"\n // spent the entrance on nothing and left the real data to arrive\n // un-animated, on the FOLLOW path below. So the first render that actually\n // has geometry is the one that owns the entrance.\n const hasContent = this.scene.bars.length > 0 || this.scene.slices.length > 0;\n const animate = !this.hasRendered && motion;\n if (drill && motion) {\n this.hasRendered = true;\n this.playDrill(dpr, drill, duration);\n return;\n }\n if (animate) {\n this.hasRendered = hasContent;\n this.playIntro(dpr, variant, duration);\n return;\n }\n this.hasRendered = this.hasRendered || hasContent;\n // A data update at the same size → FOLLOW the new ranks/lengths (see\n // ensureFollow). Runs even with the ENTRY animation off (a race turns the\n // intro off but still wants ranks to slide) — gated on reduced-motion alone.\n // `|| this.followRaf` keeps the loop alive through a race's intermediate\n // no-change renders instead of the static branch resetting it.\n // `opts.animate === false` (a zoom / pan) skips the follow ease and snaps to\n // the windowed layout below — easing bars across a whole-layout change reads\n // as them sliding together.\n const changed = !!oldScene && barsDiffer(oldScene, this.scene);\n if (opts.animate !== false && !reduce && !sizeChanged && oldScene && (changed || this.followRaf)) {\n // Stop any intro/drill loop first — otherwise it keeps painting the same\n // canvas as the follow loop until it ends, and its terminal frame stomps\n // `displayed` mid-tween (flicker/jump). stopIntro (not a bare cancel):\n // the follow loop only paints geometry, so a cancel that left the\n // entrance's fade behind pinned this chart at opacity 0 forever.\n this.stopIntro();\n this.ensureFollow();\n return;\n }\n this.stopIntro();\n cancelAnimationFrame(this.followRaf);\n this.followRaf = 0;\n this.paint(this.scene, dpr);\n this.displayed = barsByKey(this.scene);\n }\n\n /**\n * Arm a drill transition for the NEXT scene: it will unfold out of the band\n * `index` occupies right now, rather than playing the ordinary entry\n * animation. Call this BEFORE swapping the data.\n *\n * `direction: 'up'` pivots on the whole plot instead of one column, which is\n * the visual inverse — the level being returned to opens out of everything\n * the level being left was filling.\n */\n drill(index: number, direction: 'down' | 'up' = 'down'): void {\n const scene = this.scene;\n if (!scene) return;\n const horizontal = !!this.spec?.horizontal;\n if (direction === 'up') {\n // Merge: the parent level opens out of the whole plot (grows from the axis).\n this.arm(horizontal ? { from: scene.plot.y, size: scene.plot.height, split: false } : { from: scene.plot.x, size: scene.plot.width, split: false });\n return;\n }\n const bars = scene.bars.filter((b) => b.dataIndex === index);\n if (!bars.length) {\n this.arm(null);\n return;\n }\n // Split: the children part out of the clicked column's band, at full height.\n const lo = Math.min(...bars.map((b) => (horizontal ? b.y : b.x)));\n const hi = Math.max(...bars.map((b) => (horizontal ? b.y + b.h : b.x + b.w)));\n this.arm({ from: lo, size: Math.max(1, hi - lo), split: true });\n }\n\n /**\n * Hold the drill until the NEXT FRAME rather than until the next render.\n *\n * A bar chart's level lives in two props — the series and the categories —\n * and each assignment re-renders synchronously. Consuming the arm on the\n * first render would animate the old data against the new categories and\n * leave the real swap un-animated, so it survives every render in the same\n * turn; the last one to run is the one that animates.\n */\n private arm(band: { from: number; size: number; split: boolean } | null): void {\n this.pendingDrill = band;\n cancelAnimationFrame(this.drillArmRaf);\n if (!band) return;\n this.drillArmRaf = requestAnimationFrame(() => {\n this.pendingDrill = null;\n });\n }\n\n /**\n * Clear the inline opacity the entrance fades the layers in with.\n *\n * The entrance is the ONLY thing that writes it, and the only thing that\n * clears it is the loop's own terminal frame — so every path that ends the\n * entrance early has to undo it here. Skipping this leaves a chart whose bars\n * are drawn into a canvas pinned at `opacity: 0`: fully rendered, invisible,\n * and with nothing left to write style again (it never self-heals).\n */\n private clearIntroOpacity(): void {\n this.canvas.style.opacity = '';\n this.barLabelLayer.style.opacity = '';\n }\n\n /** End the entrance/drill loop AND undo the fade it applied. Use this instead\n * of a bare `cancelAnimationFrame(this.introRaf)` everywhere outside the loop\n * itself. */\n private stopIntro(): void {\n cancelAnimationFrame(this.introRaf);\n this.introRaf = 0;\n this.clearIntroOpacity();\n }\n\n private playDrill(dpr: number, band: { from: number; size: number; split: boolean }, duration: number): void {\n const target = this.scene;\n if (!target) return;\n this.stopIntro();\n // drillScene takes the RAW timeline — it eases each child itself so the split\n // can cascade (stagger per category) with a spring.\n this.paint(drillScene(target, band.from, band.size, 0, band.split), dpr);\n let start = 0;\n const frame = (now: number): void => {\n if (!start) start = now;\n const t = (now - start) / duration;\n if (t >= 1) {\n this.displayed = barsByKey(target);\n this.paint(target, dpr);\n return;\n }\n this.paint(drillScene(target, band.from, band.size, t, band.split), dpr);\n this.introRaf = requestAnimationFrame(frame);\n };\n this.introRaf = requestAnimationFrame(frame);\n }\n\n /** Replay the entry animation from the start (uses the current spec's variant). */\n replay(): void {\n this.hasRendered = false;\n this.render();\n }\n\n private drawGeometry(scene: RenderScene, dpr: number): void {\n if (this.ctx) {\n this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n drawSceneCanvas(this.ctx, scene);\n }\n }\n\n /** Draw the plot geometry (canvas) + the bar value labels (their own layer)\n * for a scene — both animate together, so the numbers ride out to the bar\n * tips as the bars grow instead of snapping to the final position. */\n private paint(scene: RenderScene, dpr: number): void {\n this.drawGeometry(scene, dpr);\n renderBarLabels(this.barLabelLayer, scene, this.theme?.fontFamily);\n }\n\n private playIntro(dpr: number, variant: MdChartAnimation, duration: number): void {\n const target = this.scene;\n if (!target) return;\n this.stopIntro();\n // Grow + fade share one layer opacity: `alpha` < 1 fades the canvas (and its\n // bar-label overlay) in; an empty string restores the stylesheet default once\n // the entrance settles. draw/stagger report alpha 1, so their layer stays\n // fully opaque and only the geometry animates.\n const setOpacity = (a: number): void => {\n const v = a < 1 ? String(a) : '';\n this.canvas.style.opacity = v;\n this.barLabelLayer.style.opacity = v;\n };\n // Draw t=0 NOW rather than waiting for the first frame. Setting the canvas\n // size in render() cleared it, so deferring the first draw leaves one frame\n // of blank canvas under a DOM overlay that has already painted its labels —\n // the chart appears to blink before it starts.\n const first = stepAnimation(variant, target, 0);\n setOpacity(first.alpha);\n this.paint(first.scene, dpr);\n let start = 0;\n const frame = (now: number): void => {\n if (!start) start = now;\n const tRaw = (now - start) / duration;\n if (tRaw >= 1) {\n setOpacity(1);\n this.displayed = barsByKey(target);\n this.paint(target, dpr);\n return;\n }\n const { scene, alpha } = stepAnimation(variant, target, tRaw);\n setOpacity(alpha);\n this.paint(scene, dpr);\n this.introRaf = requestAnimationFrame(frame);\n };\n this.introRaf = requestAnimationFrame(frame);\n }\n\n /**\n * A persistent FOLLOW loop for data updates — the bar-race reorder. Every frame\n * it eases each bar a fraction of the way toward the LATEST target (`this.scene`),\n * matched by CATEGORY (so an entity slides between ranks, not slots).\n *\n * Why a follow and not a fixed tween: a race re-feeds every frame AND reassigns\n * several props per feed (xAxis, yAxis, series), so several renders land per\n * frame. A fixed tween restarted on each render — and reset by the static branch\n * of the intermediate no-change render — never accumulated, so the ranks\n * snapped. This loop reads the live target and survives those renders, so the\n * bars slide up and down smoothly. A one-off update just converges then stops.\n */\n private ensureFollow(): void {\n if (!this.scene) return;\n if (prefersReducedMotion()) {\n cancelAnimationFrame(this.followRaf);\n this.followRaf = 0;\n this.displayed = barsByKey(this.scene);\n this.paint(this.scene, this.lastDpr);\n return;\n }\n // render() just CLEARED the canvas by resizing it, so repaint the current\n // follow state NOW (rate 0 = no easing step) — otherwise the frame composites\n // blank, because the rAF step runs before the NEXT render's clear, not after\n // this one. The rAF loop then advances the easing once per frame.\n const moving = this.renderFollow(0);\n if (moving && !this.followRaf) {\n this.followLast = 0;\n this.followRaf = requestAnimationFrame(this.followStep);\n }\n }\n\n /** Ease each bar `rate` of the way toward the live target (matched by category),\n * paint the frame, and report whether anything is still moving. */\n private renderFollow(rate: number): boolean {\n const target = this.scene;\n if (!target) return false;\n const keys = barKeys(target); // occurrence-aware: split-bar pieces stay distinct (see barKeys)\n const from = this.displayed ?? barsByKey(target);\n const displayed = new Map<string, SceneBar>();\n const bars: SceneBar[] = [];\n let moving = false;\n target.bars.forEach((b, i) => {\n const k = keys[i];\n const prev = from.get(k);\n const bar = prev ? lerpBar(prev, b, rate) : b; // a survivor eases in; a new entity lands at its slot\n displayed.set(k, bar);\n bars.push(bar);\n if (Math.abs(bar.x - b.x) > 0.3 || Math.abs(bar.y - b.y) > 0.3 || Math.abs(bar.w - b.w) > 0.3 || Math.abs(bar.h - b.h) > 0.3) moving = true;\n });\n this.displayed = displayed;\n this.paint({ ...target, bars }, this.lastDpr);\n return moving;\n }\n\n private followStep = (now: number): void => {\n if (!this.scene) {\n this.followRaf = 0;\n return;\n }\n const dt = this.followLast ? now - this.followLast : 16;\n this.followLast = now;\n const moving = this.renderFollow(Math.min(1, dt / FOLLOW_MS)); // exponential ease-out\n this.followRaf = moving ? requestAnimationFrame(this.followStep) : 0;\n };\n\n /**\n * Show the hover UI at a category index without a pointer — the keyboard\n * path, mirroring {@link LineChartEngine.focusIndex}. A sighted keyboard\n * user has to see the same tooltip a mouse user gets. `-1` clears.\n */\n focusIndex(index: number): void {\n this.lastHoverIndex = index;\n this.focusIndexInternal(index);\n }\n\n private focusIndexInternal(index: number): void {\n if (!this.scene || !this.spec || !this.theme) return;\n // Polar: spotlight the focused RING (seriesIndex -1 = the whole ring), so a\n // keyboard user sees the same emphasis a mouse hover gives, not just a card.\n if (this.spec.polar) {\n const next = index < 0 ? null : { dataIndex: index, seriesIndex: -1 };\n if (next?.dataIndex !== this.hoverSlice?.dataIndex || next?.seriesIndex !== this.hoverSlice?.seriesIndex) {\n this.hoverSlice = next;\n this.startDim();\n }\n }\n if (index < 0) {\n clearHover(this.hoverLayer);\n return;\n }\n const horizontal = !!this.spec.horizontal;\n const pt = this.scene.hoverPoints.map((hp) => hp.byIndex[index]).find(Boolean);\n const pos = this.scene.xPositions[index] ?? 0;\n const cursor = pt\n ? { x: pt.x, y: pt.y }\n : { x: horizontal ? this.scene.plot.x : pos, y: horizontal ? pos : this.scene.plot.y };\n renderHover(\n this.hoverLayer,\n this.scene,\n index,\n this.spec.valueFormatter,\n this.theme.fontFamily,\n cursor,\n this.spec.polar ? 'none' : horizontal ? 'horizontal' : 'vertical',\n -1,\n this.hoverOpts,\n );\n }\n\n /** The dim a segment heads toward: 0 for the hovered one, 1 for the rest while\n * something is hovered, 0 for everything when nothing is. */\n private dimTarget(s: SceneSlice): number {\n const h = this.hoverSlice;\n if (!h) return 0;\n // seriesIndex < 0 spotlights the WHOLE ring (keyboard focus); otherwise the\n // single segment under the pointer.\n if (h.seriesIndex < 0) return s.dataIndex === h.dataIndex ? 0 : 1;\n return s.dataIndex === h.dataIndex && s.seriesIndex === h.seriesIndex ? 0 : 1;\n }\n\n /** Kick the spotlight fade toward the current `hoverSlice` (reduced-motion snaps). */\n private startDim(): void {\n if (!this.scene || !this.theme) return;\n if (prefersReducedMotion()) {\n cancelAnimationFrame(this.dimRaf);\n this.dimRaf = 0;\n for (const s of this.scene.slices) this.dimAnim.set(sliceKey(s.dataIndex, s.seriesIndex), this.dimTarget(s));\n this.drawGeometry(emphasizePolar(this.scene, this.dimAnim, this.theme.surface), this.lastDpr);\n return;\n }\n // A running loop already re-reads the new targets each frame — just start one\n // if idle (resetting dimLast only then, so the dt stays continuous).\n if (!this.dimRaf) {\n this.dimLast = 0;\n this.dimRaf = requestAnimationFrame(this.stepDim);\n }\n }\n\n private stepDim = (now: number): void => {\n if (!this.scene || !this.theme) {\n this.dimRaf = 0;\n return;\n }\n const dt = this.dimLast ? now - this.dimLast : 16;\n this.dimLast = now;\n let moving = false;\n for (const s of this.scene.slices) {\n const key = sliceKey(s.dataIndex, s.seriesIndex);\n const target = this.dimTarget(s);\n const cur = this.dimAnim.get(key) ?? 0;\n let next = cur + Math.sign(target - cur) * (dt / POLAR_FADE_MS);\n if ((target - cur) * (target - next) <= 0) next = target; // reached / crossed\n this.dimAnim.set(key, next);\n if (next !== target) moving = true;\n }\n this.drawGeometry(emphasizePolar(this.scene, this.dimAnim, this.theme.surface), this.lastDpr);\n this.dimRaf = moving ? requestAnimationFrame(this.stepDim) : 0;\n };\n\n /** (Re)arm the dwell before a segment's tooltip appears; a miss / switch hides\n * the current card and restarts the wait. */\n private armTooltip(hovered: { dataIndex: number; seriesIndex: number } | null): void {\n clearTimeout(this.tooltipTimer);\n clearHover(this.hoverLayer);\n this.tooltipShown = false;\n if (!hovered) return;\n this.tooltipTimer = window.setTimeout(() => {\n const h = this.hoverSlice;\n if (h && h.dataIndex === hovered.dataIndex && h.seriesIndex === hovered.seriesIndex) {\n this.showPolarTooltip(hovered);\n this.tooltipShown = true;\n }\n }, POLAR_DWELL_MS);\n }\n\n private showPolarTooltip(hovered: { dataIndex: number; seriesIndex: number }): void {\n if (!this.scene || !this.spec || !this.theme) return;\n renderHover(this.hoverLayer, this.scene, hovered.dataIndex, this.spec.valueFormatter, this.theme.fontFamily, this.lastPointer, 'none', hovered.seriesIndex, { ...this.hoverOpts, trigger: 'item' });\n }\n\n private handlePointerMove = (e: PointerEvent): void => {\n if (!this.scene || !this.spec || !this.hoverEnabled) return;\n const rect = this.canvas.getBoundingClientRect();\n const px = e.clientX - rect.left;\n const py = e.clientY - rect.top;\n // Polar: hit-test the exact ring SEGMENT (like the pie), so the tooltip +\n // spotlight appear only when the pointer is actually on a band — the hole,\n // the angular gaps and the space beyond the rings all miss and clear.\n if (this.spec.polar) {\n const slice = sliceAt(this.scene.slices, px, py);\n const hovered = slice ? { dataIndex: slice.dataIndex, seriesIndex: slice.seriesIndex ?? -1 } : null;\n this.lastPointer = { x: px, y: py };\n if (this.hoverRaf) cancelAnimationFrame(this.hoverRaf);\n this.hoverRaf = requestAnimationFrame(() => {\n this.hoverRaf = 0;\n if (!this.scene || !this.spec || !this.theme) return;\n this.canvas.style.cursor = hovered ? 'pointer' : '';\n const changed = hovered?.dataIndex !== this.hoverSlice?.dataIndex || hovered?.seriesIndex !== this.hoverSlice?.seriesIndex;\n if (changed) {\n this.hoverSlice = hovered;\n this.startDim(); // fade the spotlight toward the new segment\n this.armTooltip(hovered); // restart the dwell before the tooltip shows\n } else if (this.tooltipShown && hovered) {\n this.showPolarTooltip(hovered); // same segment, card up → follow the cursor\n }\n const idx = hovered ? hovered.dataIndex : -1;\n if (idx !== this.lastHoverIndex) {\n this.lastHoverIndex = idx;\n this.cb.onHover?.(idx);\n }\n });\n return;\n }\n const idx = nearestIndex(this.scene.xPositions, this.spec.horizontal ? py : px);\n if (this.hoverRaf) cancelAnimationFrame(this.hoverRaf);\n this.hoverRaf = requestAnimationFrame(() => {\n this.hoverRaf = 0;\n if (!this.scene || !this.spec || !this.theme) return;\n // A hand cursor over a bar (hit-tested exactly as a click is) signals it's\n // actionable — only inside the bar itself, not the empty column above it.\n this.canvas.style.cursor = this.clickable && this.overBar(px, py) ? 'pointer' : '';\n renderHover(this.hoverLayer, this.scene, idx, this.spec.valueFormatter, this.theme.fontFamily, { x: px, y: py }, this.spec.horizontal ? 'horizontal' : 'vertical', -1, this.hoverOpts);\n if (idx !== this.lastHoverIndex) {\n this.lastHoverIndex = idx;\n this.cb.onHover?.(idx);\n }\n });\n };\n\n private handlePointerLeave = (): void => {\n if (this.hoverRaf) {\n cancelAnimationFrame(this.hoverRaf);\n this.hoverRaf = 0;\n }\n this.canvas.style.cursor = ''; // drop the hand when the pointer leaves the plot\n clearHover(this.hoverLayer);\n // Drop the polar spotlight — fade the rings back to full colour.\n if (this.spec?.polar && this.scene) {\n clearTimeout(this.tooltipTimer);\n this.tooltipShown = false;\n this.canvas.style.cursor = '';\n if (this.hoverSlice) {\n this.hoverSlice = null;\n this.startDim();\n }\n }\n if (this.lastHoverIndex !== -1) {\n this.lastHoverIndex = -1;\n this.cb.onHover?.(-1);\n }\n };\n\n private handleClick = (e: MouseEvent): void => {\n if (!this.scene || !this.cb.onPointClick) return;\n const rect = this.canvas.getBoundingClientRect();\n const px = e.clientX - rect.left;\n const py = e.clientY - rect.top;\n // Only fire when the click actually lands inside a bar — a click on empty\n // plot whitespace should not emit a bar click.\n for (const b of this.scene.bars) {\n if (px >= b.x && px <= b.x + b.w && py >= b.y && py <= b.y + b.h) {\n this.cb.onPointClick(b.seriesIndex, b.dataIndex, e as PointerEvent);\n return;\n }\n }\n };\n\n private onLegendToggle = (item: LegendItem): void => {\n if (this.spec) {\n this.spec.series[item.seriesIndex].hidden = !this.spec.series[item.seriesIndex].hidden;\n // Re-play the entry motion so the chart animates into its new\n // configuration (respects the variant + reduced-motion / 'none').\n this.hasRendered = false;\n this.render();\n this.cb.onLegendClick?.({ ...item, hidden: this.spec.series[item.seriesIndex].hidden });\n } else {\n this.cb.onLegendClick?.(item);\n }\n };\n}\n\n"],"mappings":"4QA8JA,SAASA,EAAYC,EAAcC,GACjC,OAAOD,EAAKE,OAASD,EAAW,GAClC,CAUA,SAASE,EAAcC,EAAWC,GAChC,MAAMC,EAAOF,EAAE,GACf,MAAMG,EAAOF,EAAE,GACf,KAAMC,EAAO,MAAQC,EAAO,GAAI,MAAO,CAACH,EAAGC,GAC3C,MAAMG,EAAKJ,EAAE,GAAK,GAAKA,EAAE,GAAKE,EAAO,EACrC,MAAMG,EAAKJ,EAAE,GAAK,GAAKA,EAAE,GAAKE,EAAO,EACrC,MAAMG,EAAQC,KAAKC,IAAIJ,EAAIC,GAC3B,GAAIC,GAAS,EAAG,MAAO,CAACN,EAAGC,GAC3B,MAAO,CACL,EAAEK,EAAQJ,EAAMA,GAChB,EAAEI,EAAQH,EAAMA,GAEpB,CAIA,SAASM,EAAUb,EAAcc,EAAcb,GAC7C,GAAIa,GAAQ,GAAKf,EAAYC,EAAMC,IAAaa,EAAM,OAAOd,EAC7D,MAAMe,EAAMd,EAAW,IACvB,MAAMe,EAAIL,KAAKM,MAAMH,EAAOC,GAAO,EACnC,OAAOC,GAAK,EAAI,GAAGhB,EAAKkB,MAAM,EAAGF,MAAQ,EAC3C,CASA,SAASG,EAAiBC,EAAoBC,GAC5C,MAAMC,EAAIF,EAAKG,WAAWrB,QAAUS,KAAKC,IAAI,KAAMQ,EAAKI,OAAOC,KAAKC,IAAOA,EAAEC,OAASD,EAAEE,MAAQ,IAAI1B,UACpG,MAAM2B,EAAUT,EAAKU,QAAU,OAK/B,MAAMC,EAAYX,EAAKI,OAAOC,KAAK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,YAAW,KACpC,MAAM9V,EAAIoM,KAAKa,WACf,GAAIjN,GAAKA,EAAEwC,YAAc+M,EAAQ/M,WAAaxC,EAAEuC,cAAgBgN,EAAQhN,YAAa,CACnF6J,KAAK0D,iBAAiBP,GACtBnD,KAAKmB,aAAe,I,IAErBnD,E,CAGG,gBAAA0F,CAAiBP,GACvB,IAAKnD,KAAK7B,QAAU6B,KAAKrX,OAASqX,KAAKpX,MAAO,OAC9Ckb,EAAY9D,KAAK+D,WAAY/D,KAAK7B,MAAOgF,EAAQ/M,UAAW4J,KAAKrX,KAAKmD,eAAgBkU,KAAKpX,MAAMob,WAAYhE,KAAKiB,YAAa,OAAQkC,EAAQhN,YAAa,IAAK6J,KAAKO,UAAWoJ,QAAS,Q","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ function t(t){const s=(t.label||t.getAttribute("label")||t.textContent||"").trim();return{value:t.value??t.getAttribute("value")??"",label:s,disabled:t.disabled??t.hasAttribute("disabled"),icon:t.icon||t.getAttribute("icon")||undefined,iconColor:t.iconColor||t.getAttribute("icon-color")||undefined,supportingText:t.supportingText||t.getAttribute("supporting-text")||undefined,selected:t.selected??t.hasAttribute("selected")}}function s(t){return{value:t.value,label:t.label??t.value,disabled:!!t.disabled,icon:t.icon,iconColor:t.iconColor,supportingText:t.supportingText,selected:!!t.selected}}function i(t){return!Array.isArray(t)}function n(t){if(!i(t))return t.slice();const s=new Array(t.count);for(let i=0;i<t.count;i++)s[i]=t.getRow(i);return s}function e(t){return t.map(s)}function h(i,n){const e=Array.from(i.children).filter((t=>t.tagName.toLowerCase()==="md-select-option"));if(e.length>0){return e.map(t)}return(n??[]).map(s)}function o(t,s){return t.find((t=>t.value===s))?.label??""}const r=15e5;function c(t,s,i,n,e,h=r,o=-1){if(n<=0||i<=0||s<=0){const t=n>0&&i>0?n*i:0;return{start:0,end:0,topPad:0,bottomPad:t,scrollHeight:t,scrollTop:0}}const c=n*i;const a=Math.ceil(s/i);if(c<=h){const h=Math.min(Math.max(0,t),Math.max(0,c-s));const o=Math.floor(h/i);const r=Math.min(n,Math.max(0,o-e));const u=Math.min(n,Math.max(r,o+a+e));return{start:r,end:u,topPad:r*i,bottomPad:Math.max(0,(n-u)*i),scrollHeight:c,scrollTop:h}}const u=h;const f=Math.max(1,u-s);const l=Math.max(0,n-a);if(o>=0){const t=Math.min(l,o);const s=Math.min(e,t);const h=t-s;const r=Math.min(n,t+a+e);const c=(r-h)*i;const d=s*i;const M=Math.round(t/Math.max(1,l)*f);const m=Math.max(d,Math.min(f,M));const b=m-s*i;const p=Math.max(0,u-b-c);return{start:h,end:r,topPad:b,bottomPad:p,scrollHeight:u,scrollTop:m}}const d=Math.min(Math.max(0,t),f);const M=Math.round(d/f*l);const m=Math.min(e,M,Math.floor(d/i));const b=M-m;const p=Math.min(n,M+a+e);const w=(p-b)*i;const y=Math.max(0,u-w);let A=d-m*i;if(A<0)A=0;else if(A>y)A=y;const g=Math.max(0,u-A-w);return{start:b,end:p,topPad:A,bottomPad:g,scrollHeight:u,scrollTop:d}}const a=0;function u(t){if(typeof atob==="function"){const s=atob(t);const i=new Uint8Array(s.length);for(let t=0;t<s.length;t++)i[t]=s.charCodeAt(t);return i}return Uint8Array.from(Buffer.from(t,"base64"))}let f;async function l(){f??(f=import("./p-CfBPnYW7.js").then((({WASM_BASE64:t})=>WebAssembly.compile(u(t)))));const t=await f;const s={env:{abort(){},trace(){},seed(){return Date.now()}}};const i=await WebAssembly.instantiate(t,s);return i.exports}const d={substring:0,prefix:1,fuzzy:2};const M=1;const m=6;const b=2048;const p=typeof performance!=="undefined"&&typeof performance.now==="function"?()=>performance.now():()=>Date.now();function w(){const t=globalThis.scheduler;if(t?.yield)return t.yield();return new Promise((t=>setTimeout(t,0)))}const y=12;async function A(t){if(typeof requestAnimationFrame==="function"&&p()-t.t>=y){await new Promise((t=>{requestAnimationFrame((()=>setTimeout(t,0)))}));t.t=p();return}await w()}function g(){return typeof WebAssembly!=="undefined"&&typeof WebAssembly.instantiate==="function"}function P(t){let s=0;for(let i=0;i<t.length;i++){const n=t.charCodeAt(i);if(n<128){s+=1}else if(n<2048){s+=2}else if(n>=55296&&n<=56319){const n=t.charCodeAt(i+1);if(n>=56320&&n<=57343){s+=4;i++}else{s+=3}}else{s+=3}}return s}class x{constructor(){this.enc=new TextEncoder;this.dec=new TextDecoder;this._length=0;this._total=0;this.mode=a}ensureReady(){if(!this.ready){this.ready=g()?l().then((t=>{this.engine=t})):Promise.reject(new Error("WebAssembly is not available in this environment"))}return this.ready}get ready$(){return!!this.engine}get length(){return this._length}get total(){return this._total}setFilterMode(t){this.mode=d[t]??a}mem(){return new Uint8Array(this.engine.memory.buffer)}async load(t){await this.ensureReady();const s=this.engine;let n;let e;if(i(t)){n=t.count;e=t.getRow}else{n=t.length;e=s=>t[s]}const h={t:p()};let o=0;let r=0;let c=0;let a=0;for(let t=0;t<n;){const s=p();do{const s=Math.min(n,t+b);for(;t<s;t++){const s=e(t);o+=P(s.value);r+=P(s.label??s.value);if(s.icon)c+=P(s.icon);if(s.supportingText)a+=P(s.supportingText)}}while(t<n&&p()-s<m);if(t<n)await A(h)}s.reserve(n,o,r,c,a);for(let t=0;t<n;){const i=p();const o=this.mem();do{const i=Math.min(n,t+b);for(;t<i;t++){const i=e(t);const n=s.valueWritePtr();const h=this.enc.encodeInto(i.value,o.subarray(n));const r=s.labelWritePtr();const u=this.enc.encodeInto(i.label??i.value,o.subarray(r));const f=s.iconWritePtr();const l=c>0?this.enc.encodeInto(i.icon??"",o.subarray(f)):null;const d=s.supportWritePtr();const m=a>0?this.enc.encodeInto(i.supportingText??"",o.subarray(d)):null;s.appendRow(h.written??0,u.written??0,l?.written??0,m?.written??0,i.disabled?M:0)}}while(t<n&&p()-i<m);if(t<n)await A(h)}s.finalizeLoad();this._total=s.totalCount();this._length=s.filteredCount()}writeScratch(t){const s=this.engine;const i=s.queryCapacity();const n=s.queryPtr();const{written:e}=this.enc.encodeInto(t,this.mem().subarray(n,n+i));return e??0}setQuery(t){if(!this.engine)return 0;const s=this.writeScratch(t);this._length=this.engine.setQuery(s,this.mode);return this._length}decodeRow(t,s){const i=this.engine;const n=i.valuePtr(t);const e=i.valueLen(t);const h=i.labelPtr(t);const o=i.labelLen(t);const r=i.iconPtr(t);const c=i.iconLen(t);const a=i.supportPtr(t);const u=i.supportLen(t);return{index:t,value:this.dec.decode(s.subarray(n,n+e)),label:this.dec.decode(s.subarray(h,h+o)),disabled:(i.rowFlags(t)&M)!==0,icon:c>0?this.dec.decode(s.subarray(r,r+c)):"",supportingText:u>0?this.dec.decode(s.subarray(a,a+u)):""}}getWindow(t,s){if(!this.engine)return[];const i=this.engine;const n=this.mem();const e=[];const h=Math.max(0,t);const o=Math.min(this._length,t+s);for(let t=h;t<o;t++){const s=i.rowAt(t);if(s>=0)e.push(this.decodeRow(s,n))}return e}getRow(t){if(!this.engine)return null;const s=this.engine.rowAt(t);if(s<0)return null;return this.decodeRow(s,this.mem())}rowAt(t){return this.engine?this.engine.rowAt(t):-1}disabledAt(t){if(!this.engine)return false;const s=this.engine.rowAt(t);if(s<0)return false;return(this.engine.rowFlags(s)&M)!==0}labelAt(t){if(!this.engine)return"";const s=this.engine.rowAt(t);if(s<0)return"";const i=this.engine.labelPtr(s);const n=this.engine.labelLen(s);return this.dec.decode(this.mem().subarray(i,i+n))}getLabels(t){const s=new Map;if(!this.engine)return s;const i=this.engine;for(const n of t){const t=this.writeScratch(n);const e=i.indexOfValue(t);if(e>=0){const t=i.labelPtr(e);const h=i.labelLen(e);s.set(n,this.dec.decode(this.mem().subarray(t,t+h)))}}return s}has(t){if(!this.engine)return false;return this.engine.indexOfValue(this.writeScratch(t))>=0}findLabelPrefix(t,s){if(!this.engine)return-1;const i=this.writeScratch(t);return this.engine.findLabelPrefix(i,s)}reset(){this.engine?.reset();this._length=0;this._total=0}}const F=1e6;const T=8;const v=48;const W=320;const q=0;class H{constructor(t){this.host=t;this.store=new x;this.active=false;this.windowStart=0;this.windowRows=[];this.topPad=0;this.bottomPad=0;this.filteredLength=0;this.rowHeight=v;this.scrollRaf=0;this.browserMaxScroll=Infinity;this.intendedScrollHeight=0;this.detectRaf=0;this.detectRetries=0;this.navAnchorFirstRow=-1;this.usedScrollTop=0;this.onScroll=()=>{if(this.scrollRaf)return;this.scrollRaf=requestAnimationFrame((()=>{this.scrollRaf=0;const t=this.viewportEl;if(!t)return;if(this.navAnchorFirstRow>=0&&Math.abs(t.scrollTop-this.usedScrollTop)<=1){return}this.navAnchorFirstRow=-1;this.recompute(t.scrollTop)}))};this.provider={count:()=>this.filteredLength,labelAt:t=>this.store.labelAt(t),isDisabledAt:t=>this.store.disabledAt(t),ensureVisible:t=>this.ensureVisible(t),domItemForIndex:t=>this.host.queryItem(t),findPrefix:(t,s)=>this.store.findLabelPrefix(t,s)}}effectiveMaxScroll(){return Math.min(r,this.browserMaxScroll)}setFixedRowHeight(t){this.fixedRowHeight=t&&t>0?t:undefined;if(this.fixedRowHeight)this.rowHeight=this.fixedRowHeight}setFilterMode(t){this.store.setFilterMode(t)}async load(t){const s=i(t)?t.count:t.length;if(!g()||s===0)return false;try{await this.store.ensureReady()}catch{return false}await this.store.load(t);this.active=true;this.filteredLength=this.store.length;this.recompute(this.viewportEl?.scrollTop??0);return true}setQuery(t){if(!this.active)return;this.filteredLength=this.store.setQuery(t);this.navAnchorFirstRow=-1;if(this.viewportEl)this.viewportEl.scrollTop=0;this.recompute(0)}getLabels(t){return this.store.getLabels(t)}reset(){this.store.reset();this.active=false;this.windowRows=[];this.filteredLength=0;this.windowStart=0;this.topPad=0;this.bottomPad=0;this.navAnchorFirstRow=-1}async attachViewport(t){this.detachViewport();const s=await t();this.viewportEl=s??undefined;if(this.viewportEl){this.viewportEl.addEventListener("scroll",this.onScroll,{passive:true});this.measureRowHeight();this.recompute(this.viewportEl.scrollTop);this.detectRetries=60;this.detectScrollCap()}}detachViewport(){if(this.scrollRaf){cancelAnimationFrame(this.scrollRaf);this.scrollRaf=0}if(this.detectRaf){cancelAnimationFrame(this.detectRaf);this.detectRaf=0}this.viewportEl?.removeEventListener("scroll",this.onScroll);this.viewportEl=undefined}measureRowHeight(){if(this.fixedRowHeight){this.rowHeight=this.fixedRowHeight;return}const t=this.host.queryItem(this.windowStart);const s=t?.offsetHeight??0;if(s>0&&s!==this.rowHeight){this.rowHeight=s;if(this.viewportEl)this.recompute(this.viewportEl.scrollTop)}}recompute(t){const s=this.viewportEl?.clientHeight||W;const i=c(t,s,this.rowHeight,this.filteredLength,T,this.effectiveMaxScroll(),this.navAnchorFirstRow);this.windowStart=i.start;this.topPad=i.topPad;this.bottomPad=i.bottomPad;this.intendedScrollHeight=i.scrollHeight;this.usedScrollTop=i.scrollTop;this.windowRows=this.store.getWindow(i.start,i.end-i.start);this.host.requestRender()}detectScrollCap(){if(this.detectRaf)cancelAnimationFrame(this.detectRaf);this.detectRaf=requestAnimationFrame((()=>{this.detectRaf=requestAnimationFrame((()=>{this.detectRaf=0;const t=this.viewportEl;if(!t)return;const s=t.scrollHeight;if(s>0&&s+2<this.intendedScrollHeight&&s<this.browserMaxScroll){if(s<F){if(this.detectRetries-- >0)this.detectScrollCap();return}this.browserMaxScroll=s;this.recompute(t.scrollTop)}}))}))}async ensureVisible(t){const s=this.viewportEl;if(!s)return;const i=s.clientHeight||W;const n=this.filteredLength*this.rowHeight;if(n<=this.effectiveMaxScroll()){this.navAnchorFirstRow=-1;const n=t*this.rowHeight;const e=n+this.rowHeight;const h=Math.max(0,s.scrollHeight-i);if(n-q<s.scrollTop){s.scrollTop=Math.max(0,n-q)}else if(e+q>s.scrollTop+i){s.scrollTop=Math.min(h,e+q-i)}this.recompute(s.scrollTop)}else{const n=Math.max(1,Math.floor(i/this.rowHeight));const e=Math.ceil(i/this.rowHeight);const h=Math.max(0,this.filteredLength-e);const o=this.navAnchorFirstRow>=0?this.navAnchorFirstRow:this.windowStart+Math.max(0,Math.round((s.scrollTop-this.topPad)/this.rowHeight));const r=o+n-1;const c=Math.ceil(q/this.rowHeight);if(t<o+c||t>r-c){this.navAnchorFirstRow=Math.min(h,Math.max(0,t<o+c?t-c:t-n+1+c))}this.recompute(s.scrollTop);if(this.navAnchorFirstRow>=0){const t=Math.max(0,s.scrollHeight-i);const n=Math.min(Math.round(this.usedScrollTop),t);if(n!==Math.round(s.scrollTop)){s.scrollTop=n}this.usedScrollTop=s.scrollTop}}for(let s=0;s<8;s++){await new Promise((t=>requestAnimationFrame((()=>t()))));if(this.host.queryItem(t))return}}}export{H as V,h as c,g as i,o as l,e as n,n as r};
2
+ //# sourceMappingURL=p-Bz-JaJcA.js.map