boardplot 0.0.0-stage → 0.52.5

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 (817) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE.md +180 -0
  4. package/README.md +208 -2
  5. package/THIRD_PARTY_NOTICES.md +1110 -0
  6. package/dist/DiagnosticDetails-UNYNYCAH.js +69 -0
  7. package/dist/ReaderBox-VUNSFKZY.js +137 -0
  8. package/dist/annotateEngine-H7OW4H3W.js +30 -0
  9. package/dist/build-identity.json +6 -0
  10. package/dist/chunk-24WB3HMB.js +621 -0
  11. package/dist/chunk-263SZKIL.js +8 -0
  12. package/dist/chunk-27QQEWNV.js +18 -0
  13. package/dist/chunk-2AKWCMS4.js +24 -0
  14. package/dist/chunk-2DHJJ2EN.js +24 -0
  15. package/dist/chunk-2EQE4E3I.js +22 -0
  16. package/dist/chunk-2GELJH37.js +88 -0
  17. package/dist/chunk-2JAWQ7VV.js +3874 -0
  18. package/dist/chunk-2LMCD3ZR.js +6 -0
  19. package/dist/chunk-2MTWKMEG.js +841 -0
  20. package/dist/chunk-2SGIHKKU.js +33 -0
  21. package/dist/chunk-2UVTHU7A.js +1146 -0
  22. package/dist/chunk-33CBPK5Q.js +2800 -0
  23. package/dist/chunk-33PLBIMA.js +176 -0
  24. package/dist/chunk-35DZP2R2.js +22 -0
  25. package/dist/chunk-3D3D3D23.js +25 -0
  26. package/dist/chunk-3EZRM4YM.js +92 -0
  27. package/dist/chunk-3GZECHOK.js +802 -0
  28. package/dist/chunk-3HHNQPAH.js +68 -0
  29. package/dist/chunk-3I6RANBJ.js +1058 -0
  30. package/dist/chunk-3SIRPKMP.js +12 -0
  31. package/dist/chunk-3W23F7EY.js +185 -0
  32. package/dist/chunk-3XQ635KD.js +24 -0
  33. package/dist/chunk-3ZCKEANJ.js +24 -0
  34. package/dist/chunk-4DNOEV3Q.js +25857 -0
  35. package/dist/chunk-4GB7TBY7.js +373 -0
  36. package/dist/chunk-4SM2ONUC.js +18 -0
  37. package/dist/chunk-5C7TWNYZ.js +79 -0
  38. package/dist/chunk-5DJXJXDE.js +58 -0
  39. package/dist/chunk-5ENRZX6I.js +687 -0
  40. package/dist/chunk-5KWXRYAT.js +294 -0
  41. package/dist/chunk-5T5YW52S.js +47 -0
  42. package/dist/chunk-627P6T25.js +936 -0
  43. package/dist/chunk-62FR4FYJ.js +23 -0
  44. package/dist/chunk-6JUJ2DU3.js +67 -0
  45. package/dist/chunk-6KWIQ5KF.js +18 -0
  46. package/dist/chunk-6UBEGKIQ.js +25 -0
  47. package/dist/chunk-6XE3GVGU.js +116 -0
  48. package/dist/chunk-76ANFJOI.js +227 -0
  49. package/dist/chunk-7IFLQMJL.js +160 -0
  50. package/dist/chunk-7JVAQX6C.js +28 -0
  51. package/dist/chunk-7QDAHY5M.js +63 -0
  52. package/dist/chunk-7VXZDB45.js +149 -0
  53. package/dist/chunk-7X65ZQN4.js +38 -0
  54. package/dist/chunk-A2FHZH7E.js +1410 -0
  55. package/dist/chunk-A372DLQX.js +54 -0
  56. package/dist/chunk-A3ULWR5N.js +76 -0
  57. package/dist/chunk-A4QZXLXF.js +7 -0
  58. package/dist/chunk-A5JWFZVU.js +1467 -0
  59. package/dist/chunk-A5LZUYK4.js +59 -0
  60. package/dist/chunk-A6XCAQ52.js +89 -0
  61. package/dist/chunk-A7A4PDG5.js +24 -0
  62. package/dist/chunk-A7IEVBYI.js +35 -0
  63. package/dist/chunk-ACXX2JNL.js +6 -0
  64. package/dist/chunk-AFK47A6O.js +25 -0
  65. package/dist/chunk-ALKTNXMR.js +3650 -0
  66. package/dist/chunk-AOQ6VF5H.js +6 -0
  67. package/dist/chunk-ASAON7G4.js +648 -0
  68. package/dist/chunk-ATTE3FYC.js +24 -0
  69. package/dist/chunk-AZOUSKZD.js +728 -0
  70. package/dist/chunk-B2EBEXIS.js +113 -0
  71. package/dist/chunk-B67K5X4M.js +58 -0
  72. package/dist/chunk-BBL3R5YZ.js +186 -0
  73. package/dist/chunk-BIDIGDGH.js +6 -0
  74. package/dist/chunk-BKYMLFUG.js +69 -0
  75. package/dist/chunk-BLFWUMTD.js +12 -0
  76. package/dist/chunk-BM6SFFWF.js +6 -0
  77. package/dist/chunk-BUPLB3EX.js +129 -0
  78. package/dist/chunk-BVWU6GOB.js +47 -0
  79. package/dist/chunk-BW5VLBSZ.js +15 -0
  80. package/dist/chunk-C64FBRJO.js +290 -0
  81. package/dist/chunk-CAE2HK2G.js +295 -0
  82. package/dist/chunk-CCQNL33L.js +446 -0
  83. package/dist/chunk-CDZHNLO6.js +42 -0
  84. package/dist/chunk-COKHNEJP.js +24 -0
  85. package/dist/chunk-COYPDRJK.js +21 -0
  86. package/dist/chunk-CRZKGHZ6.js +1810 -0
  87. package/dist/chunk-CS4DHFNG.js +128 -0
  88. package/dist/chunk-CYDZP5W6.js +1589 -0
  89. package/dist/chunk-D4BIV6WG.js +1072 -0
  90. package/dist/chunk-D4SOADBD.js +19 -0
  91. package/dist/chunk-DCCJRLAJ.js +422 -0
  92. package/dist/chunk-DFKTS6XJ.js +75 -0
  93. package/dist/chunk-DGDOGOTQ.js +25 -0
  94. package/dist/chunk-DLC23CKC.js +53 -0
  95. package/dist/chunk-DRTA6JG5.js +160 -0
  96. package/dist/chunk-DVKBU23L.js +97 -0
  97. package/dist/chunk-E2HEVF23.js +692 -0
  98. package/dist/chunk-EC2NAYPQ.js +24 -0
  99. package/dist/chunk-EKQK5D6G.js +14 -0
  100. package/dist/chunk-EKQMYG2B.js +2353 -0
  101. package/dist/chunk-ELYU6TRQ.js +98 -0
  102. package/dist/chunk-EQT3EPTB.js +203 -0
  103. package/dist/chunk-ERAIVAK5.js +1359 -0
  104. package/dist/chunk-ETHWK2RZ.js +16 -0
  105. package/dist/chunk-EWVKBRLV.js +72 -0
  106. package/dist/chunk-F77BNDAT.js +43 -0
  107. package/dist/chunk-FGAGGPFF.js +566 -0
  108. package/dist/chunk-FIANWJXX.js +19 -0
  109. package/dist/chunk-FIWNDOMO.js +6 -0
  110. package/dist/chunk-FOKEGVPB.js +24 -0
  111. package/dist/chunk-FT3F72C3.js +30 -0
  112. package/dist/chunk-FT47HQ5U.js +47 -0
  113. package/dist/chunk-GDOW2KNP.js +19 -0
  114. package/dist/chunk-GDQ3NGDZ.js +17 -0
  115. package/dist/chunk-GH3ZMBFX.js +563 -0
  116. package/dist/chunk-GQPESFAF.js +3378 -0
  117. package/dist/chunk-GQS46LC3.js +50 -0
  118. package/dist/chunk-GULJ6KVT.js +587 -0
  119. package/dist/chunk-GWQIXU37.js +2774 -0
  120. package/dist/chunk-GZ2VNM4L.js +24 -0
  121. package/dist/chunk-GZ4RHGIW.js +836 -0
  122. package/dist/chunk-H4H4O62O.js +46 -0
  123. package/dist/chunk-H57TJD3B.js +72 -0
  124. package/dist/chunk-H7UZZ7KP.js +24 -0
  125. package/dist/chunk-HAAUJDGB.js +83 -0
  126. package/dist/chunk-HFG76JTS.js +296 -0
  127. package/dist/chunk-HJXXFPOL.js +211 -0
  128. package/dist/chunk-HTYFQHRC.js +24 -0
  129. package/dist/chunk-HUF6TQ2J.js +24 -0
  130. package/dist/chunk-HUFCSX2Y.js +89 -0
  131. package/dist/chunk-HX3MQ3H4.js +26 -0
  132. package/dist/chunk-HZQEQ34U.js +296 -0
  133. package/dist/chunk-I322G5UG.js +888 -0
  134. package/dist/chunk-IDDA5INB.js +60 -0
  135. package/dist/chunk-IDTLHPTK.js +60 -0
  136. package/dist/chunk-II7652VA.js +2918 -0
  137. package/dist/chunk-IN4QT33I.js +38 -0
  138. package/dist/chunk-IV2UXZXX.js +16 -0
  139. package/dist/chunk-IXSZ7OKR.js +133 -0
  140. package/dist/chunk-IYEFEBRN.js +41 -0
  141. package/dist/chunk-IZ35GMGB.js +2543 -0
  142. package/dist/chunk-IZCOG3FS.js +28 -0
  143. package/dist/chunk-JA755JHN.js +379 -0
  144. package/dist/chunk-JETXFF3M.js +33 -0
  145. package/dist/chunk-JFBEAUJ6.js +24 -0
  146. package/dist/chunk-JFG4DHKQ.js +48 -0
  147. package/dist/chunk-JL5BRMDT.js +179 -0
  148. package/dist/chunk-JLCAWQ3H.js +195 -0
  149. package/dist/chunk-JLZM7XMZ.js +525 -0
  150. package/dist/chunk-JMH5MD5A.js +19 -0
  151. package/dist/chunk-JRPI64AQ.js +3066 -0
  152. package/dist/chunk-JSX3C6LL.js +344 -0
  153. package/dist/chunk-JY4R3GML.js +83 -0
  154. package/dist/chunk-JYBT2JNY.js +61 -0
  155. package/dist/chunk-K2HNV4LE.js +2008 -0
  156. package/dist/chunk-KAXJFL7N.js +43 -0
  157. package/dist/chunk-KDMKHR5A.js +32 -0
  158. package/dist/chunk-KFFNCDX6.js +19 -0
  159. package/dist/chunk-KKWZWP67.js +24 -0
  160. package/dist/chunk-KOJ5QETJ.js +8 -0
  161. package/dist/chunk-KPMGGE4W.js +51 -0
  162. package/dist/chunk-KS7DXCXH.js +27 -0
  163. package/dist/chunk-KSYVTEKR.js +24 -0
  164. package/dist/chunk-KU4YS6HN.js +61 -0
  165. package/dist/chunk-KYELSLDJ.js +40 -0
  166. package/dist/chunk-LC3PSQJJ.js +383 -0
  167. package/dist/chunk-LC6DYCTG.js +85 -0
  168. package/dist/chunk-LNKY5Z2X.js +23 -0
  169. package/dist/chunk-LO2DANS6.js +302 -0
  170. package/dist/chunk-M4SPKUZE.js +7 -0
  171. package/dist/chunk-M4YLED7M.js +17 -0
  172. package/dist/chunk-M6KTNAND.js +746 -0
  173. package/dist/chunk-MCOIEWW6.js +54 -0
  174. package/dist/chunk-MDYLOIS2.js +48 -0
  175. package/dist/chunk-MEISCROL.js +24 -0
  176. package/dist/chunk-MFLH5ZDQ.js +69 -0
  177. package/dist/chunk-MIXKQJ64.js +935 -0
  178. package/dist/chunk-MJMJEURO.js +359 -0
  179. package/dist/chunk-MNJ2DHU6.js +526 -0
  180. package/dist/chunk-NEVSQGOI.js +63 -0
  181. package/dist/chunk-NG5IGZXC.js +1179 -0
  182. package/dist/chunk-NLOMCLKI.js +3303 -0
  183. package/dist/chunk-NMCOUVN5.js +24 -0
  184. package/dist/chunk-NT3HAZYT.js +51 -0
  185. package/dist/chunk-NXNQQ3DS.js +382 -0
  186. package/dist/chunk-NYEY6W5R.js +569 -0
  187. package/dist/chunk-OAPCJO6W.js +23 -0
  188. package/dist/chunk-OH7FA4TF.js +251 -0
  189. package/dist/chunk-OLNORNCT.js +331 -0
  190. package/dist/chunk-OQEBOVUO.js +30 -0
  191. package/dist/chunk-ORUJI3VB.js +83 -0
  192. package/dist/chunk-PEN2DK7T.js +49 -0
  193. package/dist/chunk-PGIQMQRU.js +1650 -0
  194. package/dist/chunk-PTVOXB5T.js +39 -0
  195. package/dist/chunk-PUVGWJQ5.js +24 -0
  196. package/dist/chunk-PWROWDZS.js +137 -0
  197. package/dist/chunk-Q6XJOJTY.js +29 -0
  198. package/dist/chunk-QBR6IKIX.js +50 -0
  199. package/dist/chunk-QETGGFH2.js +30 -0
  200. package/dist/chunk-QG6MOQLI.js +2934 -0
  201. package/dist/chunk-QGCEHR6S.js +13 -0
  202. package/dist/chunk-QHFQHQDC.js +43 -0
  203. package/dist/chunk-QHRE2M6V.js +26 -0
  204. package/dist/chunk-QKL7IY42.js +38 -0
  205. package/dist/chunk-QN6JHMGU.js +44 -0
  206. package/dist/chunk-QNHZXFRA.js +347 -0
  207. package/dist/chunk-QPWRHDLZ.js +17 -0
  208. package/dist/chunk-QVABTUDS.js +80 -0
  209. package/dist/chunk-QXILAMAU.js +28 -0
  210. package/dist/chunk-QZAT46PP.js +95 -0
  211. package/dist/chunk-R3WI7ZLE.js +545 -0
  212. package/dist/chunk-R5SWC3EW.js +30 -0
  213. package/dist/chunk-RJQ5YS3Q.js +40 -0
  214. package/dist/chunk-RNOD2UWF.js +613 -0
  215. package/dist/chunk-RNXITK5M.js +24 -0
  216. package/dist/chunk-ROXO4R3J.js +16 -0
  217. package/dist/chunk-RQ5DNYLG.js +10 -0
  218. package/dist/chunk-RSWVH7DB.js +24 -0
  219. package/dist/chunk-RTJXOIIQ.js +12 -0
  220. package/dist/chunk-RZNYW7UP.js +133 -0
  221. package/dist/chunk-S4F27M7N.js +37 -0
  222. package/dist/chunk-S4ONWRJE.js +28 -0
  223. package/dist/chunk-S53OGZL6.js +168 -0
  224. package/dist/chunk-S5ADHIZK.js +2508 -0
  225. package/dist/chunk-S62M63LU.js +19 -0
  226. package/dist/chunk-S7VDRUED.js +62 -0
  227. package/dist/chunk-SGD3ZHID.js +250 -0
  228. package/dist/chunk-SGSPYHFE.js +40 -0
  229. package/dist/chunk-SLTMRTXV.js +597 -0
  230. package/dist/chunk-SXGTRZFN.js +26 -0
  231. package/dist/chunk-SZPTTNW7.js +16 -0
  232. package/dist/chunk-T3IGJARD.js +22 -0
  233. package/dist/chunk-TA3TFKYZ.js +86 -0
  234. package/dist/chunk-TNEHPP3H.js +18 -0
  235. package/dist/chunk-TPYV2FTV.js +25 -0
  236. package/dist/chunk-TPZB2YWR.js +25 -0
  237. package/dist/chunk-TSR5YDPS.js +1266 -0
  238. package/dist/chunk-TTR7EWNH.js +170 -0
  239. package/dist/chunk-TVHLKVUO.js +24 -0
  240. package/dist/chunk-TXINIAFL.js +198 -0
  241. package/dist/chunk-TXZBBZOG.js +58 -0
  242. package/dist/chunk-UEU46Q3D.js +300 -0
  243. package/dist/chunk-UMDEWWXT.js +33 -0
  244. package/dist/chunk-UQSVWO7Z.js +334 -0
  245. package/dist/chunk-UZF3G2FN.js +942 -0
  246. package/dist/chunk-V422EKLW.js +24 -0
  247. package/dist/chunk-V4DYVLOO.js +433 -0
  248. package/dist/chunk-V4VC25UL.js +128 -0
  249. package/dist/chunk-V667FCIJ.js +12 -0
  250. package/dist/chunk-VABRPZVC.js +43 -0
  251. package/dist/chunk-VB2MJLET.js +19 -0
  252. package/dist/chunk-VDAKTZQP.js +18 -0
  253. package/dist/chunk-VDAZPGR2.js +79 -0
  254. package/dist/chunk-VXZFQKBJ.js +21 -0
  255. package/dist/chunk-VYMGZ27S.js +133 -0
  256. package/dist/chunk-W2RGSGRR.js +131 -0
  257. package/dist/chunk-W7UZXD5D.js +1109 -0
  258. package/dist/chunk-WDUNR2VI.js +2718 -0
  259. package/dist/chunk-WHSTEAVP.js +229 -0
  260. package/dist/chunk-WJMUMN3I.js +127 -0
  261. package/dist/chunk-WLZ54FWG.js +120 -0
  262. package/dist/chunk-WMJPFLF3.js +2980 -0
  263. package/dist/chunk-WRHFBCVY.js +24 -0
  264. package/dist/chunk-WVSNSWBJ.js +47 -0
  265. package/dist/chunk-WYJEOMNY.js +31 -0
  266. package/dist/chunk-WYJMV62X.js +24 -0
  267. package/dist/chunk-WZGJSQKN.js +29 -0
  268. package/dist/chunk-WZL4EEBS.js +11 -0
  269. package/dist/chunk-X7TXGKRX.js +272 -0
  270. package/dist/chunk-XB4KZ6WO.js +81 -0
  271. package/dist/chunk-XDLQRSSH.js +266 -0
  272. package/dist/chunk-XDS4UZGR.js +113 -0
  273. package/dist/chunk-XEGRWWNO.js +30 -0
  274. package/dist/chunk-XO5ONLVM.js +420 -0
  275. package/dist/chunk-XPWRD424.js +24 -0
  276. package/dist/chunk-XTNV2YMB.js +50 -0
  277. package/dist/chunk-XW5J5JAX.js +42 -0
  278. package/dist/chunk-XY5O74BH.js +33 -0
  279. package/dist/chunk-XYONCO5Q.js +984 -0
  280. package/dist/chunk-Y4PXIJMD.js +829 -0
  281. package/dist/chunk-YAYRRKC7.js +24 -0
  282. package/dist/chunk-YEDYBMCW.js +210 -0
  283. package/dist/chunk-YFG4E3N2.js +1161 -0
  284. package/dist/chunk-YHTO46W2.js +2670 -0
  285. package/dist/chunk-YI2ZVTCB.js +38 -0
  286. package/dist/chunk-YKO3VCTF.js +24 -0
  287. package/dist/chunk-YP3I6W7T.js +24 -0
  288. package/dist/chunk-YQ2B3YVF.js +687 -0
  289. package/dist/chunk-YS6KMYM4.js +91 -0
  290. package/dist/chunk-YTSSXSZR.js +197 -0
  291. package/dist/chunk-Z256ACGC.js +27 -0
  292. package/dist/chunk-Z2MGTKDR.js +20 -0
  293. package/dist/chunk-Z5VSLLNY.js +23 -0
  294. package/dist/chunk-Z7X3RGGA.js +22 -0
  295. package/dist/chunk-ZF43WRG3.js +29 -0
  296. package/dist/chunk-ZJKOLOVF.js +1754 -0
  297. package/dist/chunk-ZQ4VFQID.js +76 -0
  298. package/dist/chunk-ZSLGN6CO.js +89 -0
  299. package/dist/chunk-ZVTFZF4V.js +542 -0
  300. package/dist/cli/index.js +9 -0
  301. package/dist/core-5Z6UW5DS.js +31 -0
  302. package/dist/core-6ANZ2OWO.js +40 -0
  303. package/dist/core-6LLJNZ4O.js +37 -0
  304. package/dist/core-CPN2HF75.js +33 -0
  305. package/dist/core-CS7AKNME.js +37 -0
  306. package/dist/core-DBRILYNB.js +38 -0
  307. package/dist/core-DU77ZYPR.js +34 -0
  308. package/dist/core-E6YD7VU4.js +32 -0
  309. package/dist/core-EE55P6XK.js +56 -0
  310. package/dist/core-FFLPH5XK.js +41 -0
  311. package/dist/core-IV26EL5C.js +32 -0
  312. package/dist/core-IZVZ2B7Y.js +34 -0
  313. package/dist/core-JQV7STNF.js +34 -0
  314. package/dist/core-KBH3EJZV.js +32 -0
  315. package/dist/core-KFBW5PRT.js +36 -0
  316. package/dist/core-KWGXHBJE.js +37 -0
  317. package/dist/core-MZMR2DF4.js +32 -0
  318. package/dist/core-OK2ZY5OJ.js +29 -0
  319. package/dist/core-OV5MPTZP.js +43 -0
  320. package/dist/core-OW5V74Q4.js +40 -0
  321. package/dist/core-PL64QPOH.js +57 -0
  322. package/dist/core-PVINU5JJ.js +33 -0
  323. package/dist/core-QUYSNTC7.js +34 -0
  324. package/dist/core-RE3L6YCM.js +29 -0
  325. package/dist/core-RUA3EWW3.js +39 -0
  326. package/dist/core-RY6IFRKM.js +35 -0
  327. package/dist/core-SCWEVNUY.js +34 -0
  328. package/dist/core-SE67HHFG.js +55 -0
  329. package/dist/core-T5Q4DSH2.js +32 -0
  330. package/dist/core-TJX3I7KH.js +37 -0
  331. package/dist/core-ULUA5ZB2.js +55 -0
  332. package/dist/core-WLVU2HWX.js +46 -0
  333. package/dist/core-WQPHNVNY.js +51 -0
  334. package/dist/core-XXIOJY2X.js +52 -0
  335. package/dist/core-ZH7XTJTD.js +39 -0
  336. package/dist/core-ZHE7N4NS.js +50 -0
  337. package/dist/core-ZJYLJWZQ.js +38 -0
  338. package/dist/dataTable-IL7HVDHL.js +58 -0
  339. package/dist/engine-MYLZI5VH.js +961 -0
  340. package/dist/fixtures.d.ts +1 -0
  341. package/dist/fixtures.js +40 -0
  342. package/dist/fontTables-ZYBUCJ5N.js +18 -0
  343. package/dist/fonts.d.ts +1 -0
  344. package/dist/fonts.js +19 -0
  345. package/dist/geo/dach.d.ts +1 -0
  346. package/dist/geo/dach.js +14 -0
  347. package/dist/geo/de-states.d.ts +1 -0
  348. package/dist/geo/de-states.js +14 -0
  349. package/dist/geo/eu27.d.ts +1 -0
  350. package/dist/geo/eu27.js +14 -0
  351. package/dist/geo/europe.d.ts +1 -0
  352. package/dist/geo/europe.js +14 -0
  353. package/dist/geo/index.d.ts +1 -0
  354. package/dist/geo/index.js +41 -0
  355. package/dist/geo/us-states.d.ts +1 -0
  356. package/dist/geo/us-states.js +14 -0
  357. package/dist/geo/world.d.ts +1 -0
  358. package/dist/geo/world.js +14 -0
  359. package/dist/index.d.ts +1 -0
  360. package/dist/index.js +363 -0
  361. package/dist/main-ISJ53IS5.js +568 -0
  362. package/dist/mcp/server.js +1023 -0
  363. package/dist/module-SVEW5ZUE.js +137233 -0
  364. package/dist/react/bar.d.ts +1 -0
  365. package/dist/react/bar.js +80 -0
  366. package/dist/react/bartable.d.ts +1 -0
  367. package/dist/react/bartable.js +70 -0
  368. package/dist/react/box.d.ts +1 -0
  369. package/dist/react/box.js +64 -0
  370. package/dist/react/bullet.d.ts +1 -0
  371. package/dist/react/bullet.js +71 -0
  372. package/dist/react/butterfly.d.ts +1 -0
  373. package/dist/react/butterfly.js +65 -0
  374. package/dist/react/choropleth.d.ts +1 -0
  375. package/dist/react/choropleth.js +67 -0
  376. package/dist/react/cohort.d.ts +1 -0
  377. package/dist/react/cohort.js +69 -0
  378. package/dist/react/column.d.ts +1 -0
  379. package/dist/react/column.js +85 -0
  380. package/dist/react/combo.d.ts +1 -0
  381. package/dist/react/combo.js +85 -0
  382. package/dist/react/creative.d.ts +1 -0
  383. package/dist/react/creative.js +61 -0
  384. package/dist/react/diagram.d.ts +1 -0
  385. package/dist/react/diagram.js +60 -0
  386. package/dist/react/dimswitch.d.ts +1 -0
  387. package/dist/react/dimswitch.js +71 -0
  388. package/dist/react/dot.d.ts +1 -0
  389. package/dist/react/dot.js +69 -0
  390. package/dist/react/export.d.ts +1 -0
  391. package/dist/react/export.js +657 -0
  392. package/dist/react/funnel.d.ts +1 -0
  393. package/dist/react/funnel.js +62 -0
  394. package/dist/react/gantt.d.ts +1 -0
  395. package/dist/react/gantt.js +62 -0
  396. package/dist/react/grid.d.ts +1 -0
  397. package/dist/react/grid.js +66 -0
  398. package/dist/react/heatmap.d.ts +1 -0
  399. package/dist/react/heatmap.js +67 -0
  400. package/dist/react/histogram.d.ts +1 -0
  401. package/dist/react/histogram.js +85 -0
  402. package/dist/react/index.d.ts +1 -0
  403. package/dist/react/index.js +503 -0
  404. package/dist/react/kpi.d.ts +1 -0
  405. package/dist/react/kpi.js +67 -0
  406. package/dist/react/likert.d.ts +1 -0
  407. package/dist/react/likert.js +82 -0
  408. package/dist/react/line.d.ts +1 -0
  409. package/dist/react/line.js +80 -0
  410. package/dist/react/mekko.d.ts +1 -0
  411. package/dist/react/mekko.js +70 -0
  412. package/dist/react/pareto.d.ts +1 -0
  413. package/dist/react/pareto.js +89 -0
  414. package/dist/react/pie.d.ts +1 -0
  415. package/dist/react/pie.js +63 -0
  416. package/dist/react/prepare.d.ts +1 -0
  417. package/dist/react/prepare.js +277 -0
  418. package/dist/react/pvm.d.ts +1 -0
  419. package/dist/react/pvm.js +67 -0
  420. package/dist/react/pyramid.d.ts +1 -0
  421. package/dist/react/pyramid.js +66 -0
  422. package/dist/react/sankey.d.ts +1 -0
  423. package/dist/react/sankey.js +59 -0
  424. package/dist/react/scatter.d.ts +1 -0
  425. package/dist/react/scatter.js +62 -0
  426. package/dist/react/slope.d.ts +1 -0
  427. package/dist/react/slope.js +63 -0
  428. package/dist/react/sparkline.d.ts +1 -0
  429. package/dist/react/sparkline.js +59 -0
  430. package/dist/react/spec.d.ts +1 -0
  431. package/dist/react/spec.js +370 -0
  432. package/dist/react/status.d.ts +1 -0
  433. package/dist/react/status.js +64 -0
  434. package/dist/react/story.d.ts +1 -0
  435. package/dist/react/story.js +140 -0
  436. package/dist/react/table.d.ts +1 -0
  437. package/dist/react/table.js +68 -0
  438. package/dist/react/theme.d.ts +1 -0
  439. package/dist/react/theme.js +53 -0
  440. package/dist/react/tilemap.d.ts +1 -0
  441. package/dist/react/tilemap.js +66 -0
  442. package/dist/react/treemap.d.ts +1 -0
  443. package/dist/react/treemap.js +61 -0
  444. package/dist/react/variance.d.ts +1 -0
  445. package/dist/react/variance.js +64 -0
  446. package/dist/react/waffle.d.ts +1 -0
  447. package/dist/react/waffle.js +62 -0
  448. package/dist/react/waterfall.d.ts +1 -0
  449. package/dist/react/waterfall.js +67 -0
  450. package/dist/resvg-ZOVDIZTV.js +23 -0
  451. package/dist/rows.d.ts +1 -0
  452. package/dist/rows.js +23 -0
  453. package/dist/rowsModule-3Y4I3M3E.js +27 -0
  454. package/dist/schema-2BMZOHXI.js +22 -0
  455. package/dist/schema-2GUBWOBC.js +26 -0
  456. package/dist/schema-34ZELWRQ.js +25 -0
  457. package/dist/schema-3BHL2B76.js +22 -0
  458. package/dist/schema-4735XAZX.js +29 -0
  459. package/dist/schema-5YTNQ6JY.js +22 -0
  460. package/dist/schema-7J3NAIN2.js +27 -0
  461. package/dist/schema-AOJJ7JZB.js +22 -0
  462. package/dist/schema-CVMV4LRA.js +22 -0
  463. package/dist/schema-D3RCMN3T.js +22 -0
  464. package/dist/schema-E2ISJ65D.js +23 -0
  465. package/dist/schema-E6YOSOWB.js +28 -0
  466. package/dist/schema-EQQB43AY.js +22 -0
  467. package/dist/schema-EVLLL5UF.js +22 -0
  468. package/dist/schema-EYQ5IBLF.js +23 -0
  469. package/dist/schema-EYZVD73N.js +22 -0
  470. package/dist/schema-G4KFMQBL.js +22 -0
  471. package/dist/schema-GH7IKSOU.js +23 -0
  472. package/dist/schema-IF5N3J56.js +42 -0
  473. package/dist/schema-IG7JIR4H.js +23 -0
  474. package/dist/schema-JJYJOQTT.js +23 -0
  475. package/dist/schema-KFC4WYH4.js +32 -0
  476. package/dist/schema-L7263JMT.js +25 -0
  477. package/dist/schema-MEAFRXVH.js +53 -0
  478. package/dist/schema-P63S63GE.js +23 -0
  479. package/dist/schema-P7LJFJAJ.js +22 -0
  480. package/dist/schema-PA2MXYY4.js +23 -0
  481. package/dist/schema-PDZ6256H.js +23 -0
  482. package/dist/schema-PNC3Z7AH.js +25 -0
  483. package/dist/schema-QEVSIMGO.js +22 -0
  484. package/dist/schema-QJJPRRE7.js +22 -0
  485. package/dist/schema-S3EQKVOT.js +23 -0
  486. package/dist/schema-STGL44TL.js +22 -0
  487. package/dist/schema-T4NE2EAO.js +22 -0
  488. package/dist/schema-TQYTESG3.js +22 -0
  489. package/dist/schema-W376PAJG.js +22 -0
  490. package/dist/schema-XYYDUUHS.js +26 -0
  491. package/dist/specValidation-NVBIZMEE.js +48 -0
  492. package/dist/theme.d.ts +1 -0
  493. package/dist/theme.js +24 -0
  494. package/dist/themeShapeRules-5C2463YH.js +11 -0
  495. package/dist/types/core/a11y/accessibility.d.ts +43 -0
  496. package/dist/types/core/a11y/recordsShared.d.ts +44 -0
  497. package/dist/types/core/a11y/structuralRecords.d.ts +6 -0
  498. package/dist/types/core/a11y/types.d.ts +116 -0
  499. package/dist/types/core/annotate.d.ts +300 -0
  500. package/dist/types/core/annotateArms.d.ts +37 -0
  501. package/dist/types/core/annotateFields.d.ts +30 -0
  502. package/dist/types/core/annotateGapBracket.d.ts +66 -0
  503. package/dist/types/core/annotateLinks.d.ts +47 -0
  504. package/dist/types/core/annotateTargets.d.ts +90 -0
  505. package/dist/types/core/axis.d.ts +179 -0
  506. package/dist/types/core/bandSelect.d.ts +10 -0
  507. package/dist/types/core/bands.d.ts +14 -0
  508. package/dist/types/core/calendarLabels.d.ts +101 -0
  509. package/dist/types/core/charts/band/stacks.d.ts +155 -0
  510. package/dist/types/core/charts/bar/fixtures.d.ts +9 -0
  511. package/dist/types/core/charts/bar/layout.d.ts +95 -0
  512. package/dist/types/core/charts/bartable/fixtures.d.ts +4 -0
  513. package/dist/types/core/charts/bartable/types.d.ts +192 -0
  514. package/dist/types/core/charts/box/fixtures.d.ts +12 -0
  515. package/dist/types/core/charts/box/types.d.ts +110 -0
  516. package/dist/types/core/charts/bullet/fixtures.d.ts +11 -0
  517. package/dist/types/core/charts/butterfly/fixtures.d.ts +9 -0
  518. package/dist/types/core/charts/choropleth/fixtures.d.ts +3 -0
  519. package/dist/types/core/charts/choropleth/overlayTypes.d.ts +68 -0
  520. package/dist/types/core/charts/choropleth/types.d.ts +117 -0
  521. package/dist/types/core/charts/cohort/fixtures.d.ts +12 -0
  522. package/dist/types/core/charts/cohort/types.d.ts +165 -0
  523. package/dist/types/core/charts/column/anomaly.d.ts +204 -0
  524. package/dist/types/core/charts/column/fixtures.d.ts +12 -0
  525. package/dist/types/core/charts/column/layout.d.ts +116 -0
  526. package/dist/types/core/charts/column/model.d.ts +295 -0
  527. package/dist/types/core/charts/column/types.d.ts +56 -0
  528. package/dist/types/core/charts/combo/endpoints.d.ts +165 -0
  529. package/dist/types/core/charts/combo/fixtures.d.ts +12 -0
  530. package/dist/types/core/charts/combo/layout.d.ts +48 -0
  531. package/dist/types/core/charts/creative/fixtures.d.ts +4 -0
  532. package/dist/types/core/charts/creative/types.d.ts +73 -0
  533. package/dist/types/core/charts/diagram/fixtures.d.ts +3 -0
  534. package/dist/types/core/charts/dimswitch/compile.d.ts +20 -0
  535. package/dist/types/core/charts/dimswitch/fixtures.d.ts +3 -0
  536. package/dist/types/core/charts/dimswitch/types.d.ts +152 -0
  537. package/dist/types/core/charts/dot/fixtures.d.ts +11 -0
  538. package/dist/types/core/charts/funnel/fixtures.d.ts +11 -0
  539. package/dist/types/core/charts/gantt/fixtures.d.ts +9 -0
  540. package/dist/types/core/charts/gantt/layout.d.ts +56 -0
  541. package/dist/types/core/charts/grid/fixtures.d.ts +3 -0
  542. package/dist/types/core/charts/grid/metricStack.d.ts +108 -0
  543. package/dist/types/core/charts/grid/metricStackSchema.d.ts +74 -0
  544. package/dist/types/core/charts/grid/normalize.d.ts +99 -0
  545. package/dist/types/core/charts/grid/schema.d.ts +168 -0
  546. package/dist/types/core/charts/heatmap/fixtures.d.ts +11 -0
  547. package/dist/types/core/charts/histogram/fixtures.d.ts +15 -0
  548. package/dist/types/core/charts/histogram/types.d.ts +98 -0
  549. package/dist/types/core/charts/kpi/fixtures.d.ts +9 -0
  550. package/dist/types/core/charts/likert/fixtures.d.ts +11 -0
  551. package/dist/types/core/charts/likert/layout.d.ts +111 -0
  552. package/dist/types/core/charts/line/fixtures.d.ts +16 -0
  553. package/dist/types/core/charts/line/types.d.ts +6 -0
  554. package/dist/types/core/charts/mekko/fixtures.d.ts +13 -0
  555. package/dist/types/core/charts/pareto/fixtures.d.ts +5 -0
  556. package/dist/types/core/charts/pareto/layout.d.ts +68 -0
  557. package/dist/types/core/charts/pie/fixtures.d.ts +14 -0
  558. package/dist/types/core/charts/pvm/fixtures.d.ts +13 -0
  559. package/dist/types/core/charts/pvm/types.d.ts +118 -0
  560. package/dist/types/core/charts/pyramid/fixtures.d.ts +4 -0
  561. package/dist/types/core/charts/pyramid/types.d.ts +92 -0
  562. package/dist/types/core/charts/sankey/fixtures.d.ts +4 -0
  563. package/dist/types/core/charts/sankey/types.d.ts +116 -0
  564. package/dist/types/core/charts/scatter/fixtures.d.ts +12 -0
  565. package/dist/types/core/charts/scatter/types.d.ts +58 -0
  566. package/dist/types/core/charts/slope/fixtures.d.ts +13 -0
  567. package/dist/types/core/charts/sparkline/fixtures.d.ts +9 -0
  568. package/dist/types/core/charts/status/fixtures.d.ts +8 -0
  569. package/dist/types/core/charts/status/layout.d.ts +71 -0
  570. package/dist/types/core/charts/table/fitFormats.d.ts +67 -0
  571. package/dist/types/core/charts/table/fixtures.d.ts +7 -0
  572. package/dist/types/core/charts/table/resolve.d.ts +72 -0
  573. package/dist/types/core/charts/table/view.d.ts +156 -0
  574. package/dist/types/core/charts/tilemap/fixtures.d.ts +3 -0
  575. package/dist/types/core/charts/tilemap/types.d.ts +94 -0
  576. package/dist/types/core/charts/treemap/fixtures.d.ts +4 -0
  577. package/dist/types/core/charts/treemap/types.d.ts +78 -0
  578. package/dist/types/core/charts/variance/fixtures.d.ts +12 -0
  579. package/dist/types/core/charts/waffle/fixtures.d.ts +5 -0
  580. package/dist/types/core/charts/waffle/types.d.ts +117 -0
  581. package/dist/types/core/charts/waterfall/fixtures.d.ts +9 -0
  582. package/dist/types/core/claims/browser.d.ts +49 -0
  583. package/dist/types/core/claims/manifest.d.ts +22 -0
  584. package/dist/types/core/dateFormat.d.ts +39 -0
  585. package/dist/types/core/deferred.d.ts +121 -0
  586. package/dist/types/core/diagnostics/describe.d.ts +149 -0
  587. package/dist/types/core/diagnostics/jsonPatch.d.ts +36 -0
  588. package/dist/types/core/doc/bareChart.d.ts +2 -0
  589. package/dist/types/core/doc/diagnostics.d.ts +124 -0
  590. package/dist/types/core/doc/docExpand.d.ts +39 -0
  591. package/dist/types/core/doc/document.d.ts +43 -0
  592. package/dist/types/core/doc/ownedDocumentCopy.d.ts +5 -0
  593. package/dist/types/core/doc/specError.d.ts +6 -0
  594. package/dist/types/core/emptyData.d.ts +27 -0
  595. package/dist/types/core/eventLane.d.ts +208 -0
  596. package/dist/types/core/fontMetrics/index.d.ts +47 -0
  597. package/dist/types/core/fontMetrics/injected.d.ts +40 -0
  598. package/dist/types/core/fontMetrics/tableDocument.d.ts +73 -0
  599. package/dist/types/core/fontMetrics/tables.generated.d.ts +17 -0
  600. package/dist/types/core/footer.d.ts +59 -0
  601. package/dist/types/core/format.d.ts +149 -0
  602. package/dist/types/core/formatPrecision.d.ts +136 -0
  603. package/dist/types/core/formatSpec.d.ts +302 -0
  604. package/dist/types/core/frame.d.ts +583 -0
  605. package/dist/types/core/geo/packs/all.d.ts +7 -0
  606. package/dist/types/core/geo/packs/dach.d.ts +16 -0
  607. package/dist/types/core/geo/packs/de-states.d.ts +16 -0
  608. package/dist/types/core/geo/packs/eu27.d.ts +16 -0
  609. package/dist/types/core/geo/packs/europe.d.ts +16 -0
  610. package/dist/types/core/geo/packs/index.d.ts +22 -0
  611. package/dist/types/core/geo/packs/registry.d.ts +37 -0
  612. package/dist/types/core/geo/packs/us-states.d.ts +16 -0
  613. package/dist/types/core/geo/packs/world.d.ts +16 -0
  614. package/dist/types/core/geo/tiles/eu27.generated.d.ts +412 -0
  615. package/dist/types/core/geo/tiles/europe.generated.d.ts +842 -0
  616. package/dist/types/core/geo/tiles/index.d.ts +8 -0
  617. package/dist/types/core/geo/tiles/types.d.ts +36 -0
  618. package/dist/types/core/geo/tiles/us-states.generated.d.ts +952 -0
  619. package/dist/types/core/geo/tiles/world.generated.d.ts +968 -0
  620. package/dist/types/core/geo/types.d.ts +146 -0
  621. package/dist/types/core/geometry.d.ts +102 -0
  622. package/dist/types/core/grid/sharedScale.d.ts +82 -0
  623. package/dist/types/core/icons.d.ts +227 -0
  624. package/dist/types/core/inputError.d.ts +14 -0
  625. package/dist/types/core/isoDate.d.ts +2 -0
  626. package/dist/types/core/isoTime.d.ts +7 -0
  627. package/dist/types/core/label/categoryRow.d.ts +332 -0
  628. package/dist/types/core/label/occupied.d.ts +41 -0
  629. package/dist/types/core/label/ownership.d.ts +83 -0
  630. package/dist/types/core/label/solver.d.ts +380 -0
  631. package/dist/types/core/label/tickRow.d.ts +78 -0
  632. package/dist/types/core/live/types.d.ts +50 -0
  633. package/dist/types/core/normalize/shared.d.ts +56 -0
  634. package/dist/types/core/notes.d.ts +174 -0
  635. package/dist/types/core/othersShade.d.ts +9 -0
  636. package/dist/types/core/periodYears.d.ts +9 -0
  637. package/dist/types/core/polyline.d.ts +11 -0
  638. package/dist/types/core/rangeRules.d.ts +19 -0
  639. package/dist/types/core/ratioTier.d.ts +120 -0
  640. package/dist/types/core/readerStrings.d.ts +13 -0
  641. package/dist/types/core/reading.d.ts +120 -0
  642. package/dist/types/core/registry.d.ts +178 -0
  643. package/dist/types/core/repaintGeometry.d.ts +19 -0
  644. package/dist/types/core/request.d.ts +124 -0
  645. package/dist/types/core/rows.d.ts +45 -0
  646. package/dist/types/core/scale.d.ts +106 -0
  647. package/dist/types/core/schema/capability.d.ts +229 -0
  648. package/dist/types/core/schema/namedColumns.d.ts +45 -0
  649. package/dist/types/core/schema/reference.d.ts +31 -0
  650. package/dist/types/core/schema/refusals.d.ts +45 -0
  651. package/dist/types/core/schema/unknownKeys.d.ts +45 -0
  652. package/dist/types/core/seriesIdentity.d.ts +120 -0
  653. package/dist/types/core/shareRounding.d.ts +49 -0
  654. package/dist/types/core/sizing.d.ts +330 -0
  655. package/dist/types/core/staticFooter.d.ts +6 -0
  656. package/dist/types/core/story.d.ts +41 -0
  657. package/dist/types/core/structureCounts.d.ts +10 -0
  658. package/dist/types/core/svg/renderSvg.d.ts +51 -0
  659. package/dist/types/core/target.d.ts +89 -0
  660. package/dist/types/core/text.d.ts +113 -0
  661. package/dist/types/core/theme.d.ts +478 -0
  662. package/dist/types/core/themeFields.d.ts +11 -0
  663. package/dist/types/core/themeRules.d.ts +111 -0
  664. package/dist/types/core/themeShape.d.ts +87 -0
  665. package/dist/types/core/themeValidate.d.ts +15 -0
  666. package/dist/types/core/timeAxis.d.ts +106 -0
  667. package/dist/types/core/types/annotations.d.ts +223 -0
  668. package/dist/types/core/types/cell.d.ts +82 -0
  669. package/dist/types/core/types/data.d.ts +309 -0
  670. package/dist/types/core/types/diagram.d.ts +234 -0
  671. package/dist/types/core/types/index.d.ts +8 -0
  672. package/dist/types/core/types/options.d.ts +1583 -0
  673. package/dist/types/core/types/scene.d.ts +990 -0
  674. package/dist/types/core/types/sizing.d.ts +51 -0
  675. package/dist/types/core/types/table.d.ts +873 -0
  676. package/dist/types/core/types/theme.d.ts +806 -0
  677. package/dist/types/core/zoom.d.ts +106 -0
  678. package/dist/types/fixtures/index.d.ts +40 -0
  679. package/dist/types/fixtures/registry.d.ts +15 -0
  680. package/dist/types/fonts.d.ts +10 -0
  681. package/dist/types/index.d.ts +70 -0
  682. package/dist/types/react/BoardplotTheme.d.ts +9 -0
  683. package/dist/types/react/DimSwitchChart.d.ts +36 -0
  684. package/dist/types/react/ScaleGroup.d.ts +31 -0
  685. package/dist/types/react/SceneRenderer.d.ts +23 -0
  686. package/dist/types/react/SizePlaceholder.d.ts +51 -0
  687. package/dist/types/react/StoryFrame.d.ts +42 -0
  688. package/dist/types/react/TableChart.d.ts +220 -0
  689. package/dist/types/react/a11ySurface.d.ts +20 -0
  690. package/dist/types/react/barrelCharts.d.ts +1023 -0
  691. package/dist/types/react/charts/bar.d.ts +28 -0
  692. package/dist/types/react/charts/bartable.d.ts +27 -0
  693. package/dist/types/react/charts/box.d.ts +27 -0
  694. package/dist/types/react/charts/bullet.d.ts +28 -0
  695. package/dist/types/react/charts/butterfly.d.ts +28 -0
  696. package/dist/types/react/charts/choropleth.d.ts +27 -0
  697. package/dist/types/react/charts/cohort.d.ts +52 -0
  698. package/dist/types/react/charts/column.d.ts +27 -0
  699. package/dist/types/react/charts/combo.d.ts +7 -0
  700. package/dist/types/react/charts/creative.d.ts +27 -0
  701. package/dist/types/react/charts/diagram.d.ts +162 -0
  702. package/dist/types/react/charts/dimswitch.d.ts +6 -0
  703. package/dist/types/react/charts/dot.d.ts +28 -0
  704. package/dist/types/react/charts/funnel.d.ts +28 -0
  705. package/dist/types/react/charts/gantt.d.ts +28 -0
  706. package/dist/types/react/charts/grid.d.ts +29 -0
  707. package/dist/types/react/charts/heatmap.d.ts +28 -0
  708. package/dist/types/react/charts/histogram.d.ts +27 -0
  709. package/dist/types/react/charts/kpi.d.ts +28 -0
  710. package/dist/types/react/charts/likert.d.ts +27 -0
  711. package/dist/types/react/charts/line.d.ts +28 -0
  712. package/dist/types/react/charts/mekko.d.ts +28 -0
  713. package/dist/types/react/charts/pareto.d.ts +28 -0
  714. package/dist/types/react/charts/pie.d.ts +28 -0
  715. package/dist/types/react/charts/pvm.d.ts +27 -0
  716. package/dist/types/react/charts/pyramid.d.ts +27 -0
  717. package/dist/types/react/charts/sankey.d.ts +27 -0
  718. package/dist/types/react/charts/scatter.d.ts +28 -0
  719. package/dist/types/react/charts/slope.d.ts +28 -0
  720. package/dist/types/react/charts/sparkline.d.ts +28 -0
  721. package/dist/types/react/charts/status.d.ts +27 -0
  722. package/dist/types/react/charts/table.d.ts +6 -0
  723. package/dist/types/react/charts/tilemap.d.ts +27 -0
  724. package/dist/types/react/charts/treemap.d.ts +27 -0
  725. package/dist/types/react/charts/variance.d.ts +28 -0
  726. package/dist/types/react/charts/waffle.d.ts +28 -0
  727. package/dist/types/react/charts/waterfall.d.ts +28 -0
  728. package/dist/types/react/createChartComponent.d.ts +135 -0
  729. package/dist/types/react/export/clipboard.d.ts +8 -0
  730. package/dist/types/react/export/csv.d.ts +2 -0
  731. package/dist/types/react/export/frame.d.ts +35 -0
  732. package/dist/types/react/export/index.d.ts +7 -0
  733. package/dist/types/react/export/png.d.ts +14 -0
  734. package/dist/types/react/export/svg.d.ts +5 -0
  735. package/dist/types/react/export/types.d.ts +69 -0
  736. package/dist/types/react/export/useExport.d.ts +17 -0
  737. package/dist/types/react/exportLink.d.ts +49 -0
  738. package/dist/types/react/footerFrame.d.ts +25 -0
  739. package/dist/types/react/hover/dataTable.d.ts +13 -0
  740. package/dist/types/react/hover/engine.d.ts +210 -0
  741. package/dist/types/react/hover/keyboard.d.ts +44 -0
  742. package/dist/types/react/hover/labelCard.d.ts +170 -0
  743. package/dist/types/react/hover/placement.d.ts +49 -0
  744. package/dist/types/react/index.d.ts +16 -0
  745. package/dist/types/react/parseChartSpec.d.ts +16 -0
  746. package/dist/types/react/prepare.d.ts +32 -0
  747. package/dist/types/react/prepared.d.ts +53 -0
  748. package/dist/types/react/preparedTable.d.ts +15 -0
  749. package/dist/types/react/rowsInput.d.ts +55 -0
  750. package/dist/types/react/rowsModule.d.ts +18 -0
  751. package/dist/types/react/rowsStore.d.ts +50 -0
  752. package/dist/types/react/scale-group.d.ts +2 -0
  753. package/dist/types/react/scaleGroupContext.d.ts +22 -0
  754. package/dist/types/react/scenePaint.d.ts +10 -0
  755. package/dist/types/react/scrollState.d.ts +26 -0
  756. package/dist/types/react/spec.d.ts +65 -0
  757. package/dist/types/react/specValidation.d.ts +45 -0
  758. package/dist/types/react/story.d.ts +15 -0
  759. package/dist/types/react/theme.d.ts +9 -0
  760. package/dist/types/react/themeContext.d.ts +44 -0
  761. package/dist/types/react/useChartLayout.d.ts +22 -0
  762. package/dist/types/react/useContainerSize.d.ts +57 -0
  763. package/dist/types/react/useHover.d.ts +100 -0
  764. package/dist/types/react/useZoom.d.ts +50 -0
  765. package/dist/types/rows.d.ts +58 -0
  766. package/dist/types/tableLooks.d.ts +6 -0
  767. package/dist/types/theme.d.ts +3 -0
  768. package/dist/types/validate.d.ts +3 -0
  769. package/dist/validate.d.ts +1 -0
  770. package/dist/validate.js +222 -0
  771. package/docs/FONTS.md +68 -0
  772. package/docs/TELEMETRY.md +94 -0
  773. package/docs/manual.md +838 -0
  774. package/docs/reference/bar.md +222 -0
  775. package/docs/reference/bartable.md +143 -0
  776. package/docs/reference/box.md +93 -0
  777. package/docs/reference/bullet.md +118 -0
  778. package/docs/reference/butterfly.md +117 -0
  779. package/docs/reference/choropleth.md +148 -0
  780. package/docs/reference/cohort.md +149 -0
  781. package/docs/reference/column.md +275 -0
  782. package/docs/reference/combo.md +219 -0
  783. package/docs/reference/creative.md +147 -0
  784. package/docs/reference/diagram.md +191 -0
  785. package/docs/reference/dimswitch.md +1395 -0
  786. package/docs/reference/dot.md +117 -0
  787. package/docs/reference/fixtures.md +1088 -0
  788. package/docs/reference/funnel.md +121 -0
  789. package/docs/reference/gantt.md +132 -0
  790. package/docs/reference/grid.md +302 -0
  791. package/docs/reference/heatmap.md +127 -0
  792. package/docs/reference/histogram.md +77 -0
  793. package/docs/reference/kpi.md +115 -0
  794. package/docs/reference/likert.md +113 -0
  795. package/docs/reference/line.md +436 -0
  796. package/docs/reference/mekko.md +114 -0
  797. package/docs/reference/options.md +313 -0
  798. package/docs/reference/pareto.md +102 -0
  799. package/docs/reference/pie.md +114 -0
  800. package/docs/reference/pvm.md +114 -0
  801. package/docs/reference/pyramid.md +99 -0
  802. package/docs/reference/react.md +703 -0
  803. package/docs/reference/reading.md +28 -0
  804. package/docs/reference/sankey.md +110 -0
  805. package/docs/reference/scatter.md +211 -0
  806. package/docs/reference/slope.md +126 -0
  807. package/docs/reference/sparkline.md +74 -0
  808. package/docs/reference/status.md +107 -0
  809. package/docs/reference/table.md +673 -0
  810. package/docs/reference/theme.md +361 -0
  811. package/docs/reference/tilemap.md +121 -0
  812. package/docs/reference/treemap.md +86 -0
  813. package/docs/reference/variance.md +126 -0
  814. package/docs/reference/waffle.md +106 -0
  815. package/docs/reference/waterfall.md +164 -0
  816. package/llms.txt +57 -0
  817. package/package.json +437 -4
@@ -0,0 +1,2508 @@
1
+ import {
2
+ MARKER_MAX_CATS,
3
+ bandHatch,
4
+ emitForecastDividers,
5
+ fillShadingKinds,
6
+ fillShadings,
7
+ markerPath,
8
+ pathFor,
9
+ placeForecastHeaders,
10
+ planLineStyle,
11
+ regroundOnShadings,
12
+ screenEdges,
13
+ seatValuesOnGround,
14
+ shadesFills,
15
+ withoutEvents
16
+ } from "./chunk-JRPI64AQ.js";
17
+ import {
18
+ unitConflict,
19
+ unitConflictRefusal
20
+ } from "./chunk-WZGJSQKN.js";
21
+ import {
22
+ preparePolyline
23
+ } from "./chunk-ELYU6TRQ.js";
24
+ import {
25
+ FORCE_CATEGORY_RANKS,
26
+ STAIRCASE,
27
+ STAIRCASE_MAX_PAD,
28
+ categoryNotesDiffer,
29
+ categoryRanksLint,
30
+ chartString as chartString2,
31
+ nextStaircase,
32
+ rankNotes,
33
+ runStaircase,
34
+ seatStaircase,
35
+ staircaseDirection,
36
+ staircaseOn,
37
+ staircaseRoom,
38
+ staircaseState,
39
+ withCategoryRanks
40
+ } from "./chunk-X7TXGKRX.js";
41
+ import {
42
+ ANOMALY_FLAG_GAP,
43
+ ANOMALY_FLAG_H,
44
+ anomalyA11y,
45
+ anomalyCorridor,
46
+ anomalyLegendItems,
47
+ anomalyModel,
48
+ anomalyReceipt,
49
+ anomalyRuleLines,
50
+ anomalyRuleReserve,
51
+ columnCorridorPaint,
52
+ lineAnomalyFurniture,
53
+ refuseAnomalySpec,
54
+ seatFlaggedValues
55
+ } from "./chunk-V4DYVLOO.js";
56
+ import {
57
+ applyCategoryViewport,
58
+ liveWindowOptions,
59
+ viewportMeanSpan
60
+ } from "./chunk-EQT3EPTB.js";
61
+ import {
62
+ stackSegmentCandidates
63
+ } from "./chunk-Q6XJOJTY.js";
64
+ import {
65
+ REFERENCE_MARKER_R,
66
+ rankValueLabels,
67
+ referenceCasing,
68
+ referenceMarkerKey,
69
+ referenceMarkerPaint,
70
+ referenceTickGeometry,
71
+ withBandValueNotes
72
+ } from "./chunk-XDS4UZGR.js";
73
+ import {
74
+ cellFields,
75
+ normalizeCategorySeries
76
+ } from "./chunk-QN6JHMGU.js";
77
+ import {
78
+ haloOverRules,
79
+ linesSize,
80
+ raiseOverRules,
81
+ valueRowCrowded,
82
+ valueShareLines,
83
+ warnShareParts
84
+ } from "./chunk-HJXXFPOL.js";
85
+ import {
86
+ roundingUnavailable,
87
+ sumConsistentShares
88
+ } from "./chunk-HAAUJDGB.js";
89
+ import {
90
+ averageMarkerLine,
91
+ averageMarkerScope,
92
+ averageOfUnaddedSums,
93
+ onePartDrawn,
94
+ sk,
95
+ stackParts,
96
+ warnIncompleteStacks
97
+ } from "./chunk-TTR7EWNH.js";
98
+ import {
99
+ valueLineExtent
100
+ } from "./chunk-QPWRHDLZ.js";
101
+ import {
102
+ isIncomplete
103
+ } from "./chunk-7QDAHY5M.js";
104
+ import {
105
+ emitEventLane,
106
+ percentLevels,
107
+ runAnnotatePass,
108
+ settleEventLane
109
+ } from "./chunk-GQS46LC3.js";
110
+ import {
111
+ stepDownFont
112
+ } from "./chunk-EWVKBRLV.js";
113
+ import {
114
+ breakUnsupported,
115
+ chartPalette,
116
+ chartTheme
117
+ } from "./chunk-SXGTRZFN.js";
118
+ import {
119
+ NO_STACK_MEAN,
120
+ NO_STACK_TOTAL,
121
+ stackAdds
122
+ } from "./chunk-6KWIQ5KF.js";
123
+ import {
124
+ categoryTargetFields,
125
+ spliceAnnotationNodes
126
+ } from "./chunk-CDZHNLO6.js";
127
+ import {
128
+ BAND_PAD,
129
+ VALUE_LINE_RESERVE,
130
+ hiddenValueLineReserve,
131
+ namedLineText
132
+ } from "./chunk-5C7TWNYZ.js";
133
+ import {
134
+ structureCount
135
+ } from "./chunk-B2EBEXIS.js";
136
+ import {
137
+ CATEGORY_ROW_FROM_END,
138
+ CATEGORY_ROW_VERTICAL,
139
+ MONTH_START,
140
+ ROTATED_NAME_AIR,
141
+ applyAxisBounds,
142
+ bandScale,
143
+ bandSizing,
144
+ calendarLike,
145
+ categoryLineAlign,
146
+ categoryRowTop,
147
+ hangingLabelReserve,
148
+ isDateNumericTickSequence,
149
+ layoutValueAxis,
150
+ linearScale,
151
+ longDayMonths,
152
+ measureValueAxisWidth,
153
+ niceDomain,
154
+ noteName,
155
+ planCategoryRow,
156
+ plotFloorRows,
157
+ rotatedClaimRect,
158
+ rotatedLeftOverhang,
159
+ sweepHide,
160
+ tickFormatter,
161
+ verticalNameRect,
162
+ yearRowRequests
163
+ } from "./chunk-GQPESFAF.js";
164
+ import {
165
+ AREA_FILL_PART,
166
+ DEFER_DENSITY_NOTES,
167
+ DENSITY_LAYOUT_OPTIONS,
168
+ DENSITY_VALUES,
169
+ LAST_RESORT_PENALTY,
170
+ PARTIAL_KEY,
171
+ POINTED_NOTES,
172
+ PRIORITY,
173
+ authoredFootnoteCount,
174
+ authoredNotes,
175
+ categoryLabelsAndMarks,
176
+ composedTextRole,
177
+ createOccupiedIndex,
178
+ defaultAnnotationId,
179
+ frameTextOptions,
180
+ labelsToNodes,
181
+ normalizeLegendOption,
182
+ noteCap,
183
+ noteLine,
184
+ partialAxisWords,
185
+ partialFootnotes,
186
+ partialIds,
187
+ partialKeyForced,
188
+ partialLegendKeys,
189
+ partialPattern,
190
+ plotHeightAfter,
191
+ rectContains,
192
+ rectSeriesAdjacentWarnings,
193
+ rectsOverlap,
194
+ round2,
195
+ saysToDate,
196
+ scenarioLegendKeys,
197
+ sideAwayFrom,
198
+ solveFrame,
199
+ solveLabels,
200
+ textCarriesUnit,
201
+ toDateFits,
202
+ toDateLabel,
203
+ toDateRoom,
204
+ withAuthoredFootnotes,
205
+ withCategoryNoteNames
206
+ } from "./chunk-2JAWQ7VV.js";
207
+ import {
208
+ copyFrame,
209
+ disclosureNote,
210
+ disclosuresShown,
211
+ knownPartsLead,
212
+ rankKeyShown,
213
+ recordFreedChrome,
214
+ wrapFootnote
215
+ } from "./chunk-YTSSXSZR.js";
216
+ import {
217
+ formatStatWithSpec,
218
+ formatterFromExample,
219
+ memoFormatterFromExample,
220
+ percentRasterFormatter,
221
+ sameUnit,
222
+ seriesRasterFormatter
223
+ } from "./chunk-ASAON7G4.js";
224
+ import {
225
+ autoDecimals,
226
+ chartString,
227
+ formatAutomaticNumber,
228
+ formatAutomaticPercent,
229
+ formatShare,
230
+ withLocaleStrings
231
+ } from "./chunk-YQ2B3YVF.js";
232
+ import {
233
+ canvasMargin,
234
+ dashToken,
235
+ effectiveFill,
236
+ emphasisWeight,
237
+ labelsOffKeepsNames,
238
+ markOutlineOff,
239
+ markRolePaint,
240
+ markRoleToken,
241
+ mutedMarkPaint,
242
+ namesOnly,
243
+ paintColor,
244
+ panelTypeClass,
245
+ recedingSeriesId,
246
+ secondaryFont,
247
+ segmentSeparationStroke,
248
+ seriesPaint,
249
+ seriesTextPaint,
250
+ strokeToken,
251
+ textScaleOf,
252
+ withSegmentSeams
253
+ } from "./chunk-II7652VA.js";
254
+ import {
255
+ curvePathFromSegments,
256
+ drawnStroke,
257
+ monotoneSegments,
258
+ splitCurveSegmentsAtX
259
+ } from "./chunk-WLZ54FWG.js";
260
+ import {
261
+ NormalizeError,
262
+ accessibleTitle,
263
+ normalizeScenario,
264
+ resolveHighlight,
265
+ resolveSize,
266
+ resolveSubtitle,
267
+ scaleTextPx
268
+ } from "./chunk-SGD3ZHID.js";
269
+ import {
270
+ maxOf,
271
+ minOf,
272
+ pushAll
273
+ } from "./chunk-WYJEOMNY.js";
274
+ import {
275
+ defaultMeasurer,
276
+ wrapText
277
+ } from "./chunk-TXINIAFL.js";
278
+
279
+ // src/core/charts/combo/axisTitles.ts
280
+ var ROW_GAP = 18, SWATCH_BOX = 10, SWATCH_LINE = 14, SWATCH_GAP = 5, TITLE_GAP = 4, TITLE_TOP = 4;
281
+ function planComboAxisTitles(input) {
282
+ let result = { height: 0, requests: [], paints: /* @__PURE__ */ new Map(), swatches: /* @__PURE__ */ new Map(), warnings: [] }, titles = ["primary", "secondary"].flatMap((side) => {
283
+ let text = input.active[side] ? input.titles?.[side] : void 0;
284
+ if (!text?.trim()) return [];
285
+ let series = input.series.filter((item) => item.axis === side);
286
+ return [{ side, unique: series.length === 1 ? series[0] : void 0, text }];
287
+ }), maxWidth = Math.max(1, (input.frame.w - (titles.length > 1 ? 12 : 0)) / Math.max(1, titles.length)), height = input.measure("0", input.font).height, swatchRoom = (unique) => {
288
+ let swatch = unique && input.swatchOf ? input.swatchOf(unique) : void 0;
289
+ return swatch ? (swatch.kind === "box" ? SWATCH_BOX : SWATCH_LINE) + SWATCH_GAP : 0;
290
+ }, rowWidths = titles.map(({ unique, text }) => swatchRoom(unique) + input.measure(text, input.font).width), inRow = input.row === !0 && titles.length > 1 && rowWidths.reduce((sum, w) => sum + w, 0) + ROW_GAP * (titles.length - 1) <= input.frame.w, rowX = input.frame.x;
291
+ for (let { side, unique, text } of titles) {
292
+ let id = `axis:${side}:title`, swatch = unique && input.swatchOf ? input.swatchOf(unique) : void 0, offset = swatch ? (swatch.kind === "box" ? SWATCH_BOX : SWATCH_LINE) + SWATCH_GAP : 0;
293
+ swatch && result.swatches.set(id, { ...swatch, offset });
294
+ let lines = inRow ? [text] : wrapFootnote(text, input.font, Math.max(1, maxWidth - offset), input.measure), width = Math.max(...lines.map((line) => input.measure(line, input.font).width)), x = inRow ? rowX + offset : side === "primary" ? input.frame.x + offset : input.frame.x + input.frame.w - width;
295
+ rowX += offset + width + ROW_GAP;
296
+ let titleHeight = height * lines.length, owner = unique ? { seriesId: unique.id } : {};
297
+ result.height = Math.max(result.height, titleHeight + TITLE_GAP + Math.max(0, input.tickHalf - input.below)), result.requests.push({
298
+ id,
299
+ kind: "axisTitle",
300
+ owner,
301
+ text,
302
+ lines,
303
+ typeRole: input.typeRole ?? "axis",
304
+ font: input.font,
305
+ fontStep: input.font,
306
+ // A title with a swatch is the key of its series: its name outranks a value it touches.
307
+ priority: swatch ? PRIORITY.grandTotal + PRIORITY.highlightBonus : PRIORITY.grandTotal,
308
+ candidates: [{
309
+ slot: "above",
310
+ penalty: 0,
311
+ rect: { x, y: input.frame.y + TITLE_TOP, w: width, h: titleHeight }
312
+ }]
313
+ }), result.paints.set(id, swatch || input.swatchOf && !unique ? { token: "inkMuted" } : unique ? input.paintOf(unique) : { token: "ink" });
314
+ }
315
+ return result;
316
+ }
317
+ var PRIMARY_AXIS_TITLE_ID = "axis:primary:title";
318
+ function anchorComboAxisTitles(titles, columns, frame) {
319
+ return titles.requests.map((request) => {
320
+ let candidate = request.candidates[0], { w } = candidate.rect, offset = titles.swatches.get(request.id)?.offset ?? 0, x = request.id === PRIMARY_AXIS_TITLE_ID ? columns.left === void 0 ? void 0 : columns.left + offset : offset > 0 && columns.rightStart !== void 0 ? columns.rightStart + offset : columns.right === void 0 ? void 0 : columns.right - w;
321
+ if (x === void 0) return request;
322
+ let anchored = { ...candidate, rect: { ...candidate.rect, x: Math.max(frame.x + offset, Math.min(x, frame.x + frame.w - w)) } };
323
+ return { ...request, candidates: [anchored, ...request.candidates.slice(1)] };
324
+ });
325
+ }
326
+ function comboAxisTitleSwatches(theme, labels, titles, occupied) {
327
+ let nodes = [];
328
+ for (let label of labels) {
329
+ let swatch = titles.swatches.get(label.id);
330
+ if (!swatch || label.hidden) continue;
331
+ let x = label.rect.x - swatch.offset, cy = label.rect.y + label.rect.h / Math.max(1, label.lines.length) / 2, owner = label.owner;
332
+ if (swatch.kind === "box") {
333
+ let rect = { x, y: cy - SWATCH_BOX / 2, w: SWATCH_BOX, h: SWATCH_BOX };
334
+ nodes.push({ t: "rect", id: `${label.id}:swatch`, rect, fill: swatch.paint, owner, part: "axisTitleSwatch" }), occupied.claim(rect, "axis", {}, "axisTitle");
335
+ } else
336
+ nodes.push({ t: "line", id: `${label.id}:swatch`, x1: x, y1: cy, x2: x + SWATCH_LINE, y2: cy, stroke: swatch.paint, width: swatch.width ?? strokeToken(theme, "data"), ...swatch.dash ? { dash: swatch.dash, lineCap: swatch.lineCap } : {}, owner, part: "axisTitleSwatch" }), swatch.hollow && nodes.push({
337
+ t: "line",
338
+ id: `${label.id}:swatch:inner`,
339
+ x1: x,
340
+ y1: cy,
341
+ x2: x + SWATCH_LINE,
342
+ y2: cy,
343
+ stroke: { token: "background" },
344
+ width: strokeToken(theme, "hair"),
345
+ ...swatch.dash ? { dash: swatch.dash, lineCap: swatch.lineCap } : {},
346
+ owner,
347
+ part: "axisTitleSwatch"
348
+ }), nodes.push({ t: "circle", id: `${label.id}:swatch:dot`, cx: x + SWATCH_LINE / 2, cy, r: 2.5, fill: swatch.hollow ? { token: "background" } : swatch.paint, ...swatch.hollow ? { stroke: swatch.paint, strokeWidth: strokeToken(theme, "mark") } : {}, owner, part: "axisTitleSwatch" }), occupied.claim({ x, y: cy - 3, w: SWATCH_LINE, h: 6 }, "axis", {}, "axisTitle");
349
+ }
350
+ return nodes;
351
+ }
352
+ function applyComboAxisTitlePaint(labels, titles) {
353
+ for (let label of labels) {
354
+ let paint = titles.paints.get(label.id);
355
+ paint && (label.ink = paint);
356
+ }
357
+ }
358
+
359
+ // src/core/charts/combo/endpoints.ts
360
+ function comboValueLabels(options, anatomy = !1, categoryCount = 1 / 0) {
361
+ return options.valueLabels ?? (anatomy ? categoryCount <= ANATOMY_ALL_MAX_CATEGORIES ? "all" : "ends" : "last");
362
+ }
363
+ var ANATOMY_ALL_MAX_CATEGORIES = 8;
364
+ function prepareComboEndpointTexts(series, textOf, engine) {
365
+ let first = /* @__PURE__ */ new Map(), last = /* @__PURE__ */ new Map(), add = (target, item, ci) => {
366
+ let authoredOnly = !(target === first ? typeof engine.first == "function" ? engine.first(item) : engine.first : engine.last), value = item.vals[ci];
367
+ if (authoredOnly && typeof value.labelOverride != "string") return;
368
+ let composed = textOf(item, ci), text = typeof value.labelOverride == "string" ? value.labelOverride.replace(/\$\{value\}/g, composed) : composed;
369
+ (text || value.labelOverride === !1) && target.set(item.id, { text, ci, suppressed: value.labelOverride === !1 });
370
+ };
371
+ for (let item of series) {
372
+ let firstCi = item.vals.findIndex((value) => value.v !== null);
373
+ if (firstCi < 0) continue;
374
+ let lastCi = firstCi;
375
+ for (let ci = firstCi + 1; ci < item.vals.length; ci++) item.vals[ci].v !== null && (lastCi = ci);
376
+ add(last, item, lastCi), firstCi !== lastCi && add(first, item, firstCi);
377
+ }
378
+ return { first, last };
379
+ }
380
+ var ENDPOINT_MAX_GAP = 20, INSIDE_ENDPOINT_IDS = /* @__PURE__ */ Symbol("insideEndpointIds"), SIDE_GAP = 5;
381
+ function insideEndpointGutters(input) {
382
+ if (!input.ids) return { first: 0, last: 0 };
383
+ let selected = (ends) => new Map([...ends].filter(([id, end]) => input.ids.has(`point:${id}:${input.cats[end.ci].id}`))), room = endpointGutters({
384
+ first: selected(input.first),
385
+ last: selected(input.last),
386
+ count: input.cats.length,
387
+ width: input.width,
388
+ adjacent: { first: !1, last: !1 },
389
+ font: input.font,
390
+ measure: input.measure,
391
+ markerR: input.markerR
392
+ });
393
+ return room.first + room.last > input.width / 2 ? { first: 0, last: 0 } : room;
394
+ }
395
+ function endpointGutters(input) {
396
+ let side = (texts, fromEnd, width) => {
397
+ let gutter = 0;
398
+ for (let end of texts.values()) {
399
+ if (end.suppressed) continue;
400
+ let reach = input.markerR + SIDE_GAP + input.measure(end.text || "0", input.font).width, k = (0.55 + (fromEnd ? input.count - 1 - end.ci : end.ci)) / (input.count + 0.1), needed = (reach - k * width) / (1 - k);
401
+ needed > 0 && (gutter = Math.max(gutter, Math.ceil(needed) + 1));
402
+ }
403
+ return Math.min(gutter, Math.floor(input.width / 4));
404
+ }, gutters = { first: 0, last: 0 };
405
+ for (let round = 0; round < 64; round++) {
406
+ let first = input.adjacent.first ? 0 : side(input.first, !1, input.width - gutters.last), last = input.adjacent.last ? 0 : side(input.last, !0, input.width - first);
407
+ if (first === gutters.first && last === gutters.last) break;
408
+ gutters = { first, last };
409
+ }
410
+ return gutters;
411
+ }
412
+ function unusedEndpointGutters(gutters, solved, plot) {
413
+ let shown = solved.placed.filter((label) => label.kind === "point" && !label.hidden), first = shown.some((label) => label.rect.x < plot.x - 0.5) ? gutters.first : 0, last = shown.some((label) => label.rect.x + label.rect.w > plot.x + plot.w + 0.5) ? gutters.last : 0;
414
+ return first === gutters.first && last === gutters.last ? void 0 : { first, last };
415
+ }
416
+ function flagDroppedEndpointLabels(solved) {
417
+ for (let warning of solved.warnings)
418
+ warning.code !== "label-hidden" || !warning.message.startsWith("label 'point:") || (warning.severity = "warn", warning.message += `; nothing within ${ENDPOINT_MAX_GAP}px of its point is free`);
419
+ }
420
+ var STROKE_CLEAR = 2;
421
+ function clearOfStrokes(candidates, strokes) {
422
+ return candidates.filter(({ rect }) => !strokes.some((stroke) => stroke.hits(rect, STROKE_CLEAR)));
423
+ }
424
+ function clearLift(rect, strokes, max) {
425
+ let at = (dy) => clearOfStrokes([{ slot: "probe", rect: { ...rect, y: rect.y - dy }, penalty: 0 }], strokes).length > 0;
426
+ if (!at(0)) {
427
+ for (let dy = 1; dy <= max; dy++) if (at(dy)) return dy;
428
+ }
429
+ }
430
+ function nearerOwnLine(candidates, own, others) {
431
+ return others.length === 0 ? candidates.slice() : candidates.filter(({ rect }) => {
432
+ let gap = 1 / 0;
433
+ for (let line of own) gap = Math.min(gap, line.distance(rect));
434
+ return !others.some((line) => line.closerThan(rect, gap));
435
+ });
436
+ }
437
+ function withinOneFill(candidates, fills) {
438
+ let crosses = (candidate) => crossesFill(candidate, fills);
439
+ return [...candidates.filter((candidate) => !crosses(candidate)), ...candidates.filter(crosses)];
440
+ }
441
+ function crossesFill(candidate, fills) {
442
+ return candidate.overColumns === !0 && fills.some((fill) => rectsOverlap(fill, candidate.rect) && !rectContains(fill, candidate.rect, 1));
443
+ }
444
+ var firstSlots = {
445
+ aboveCenter: "aboveCenter",
446
+ aboveLifted: "aboveLifted",
447
+ belowCenter: "belowCenter",
448
+ right: "left",
449
+ rightShiftedUp: "leftShiftedUp",
450
+ rightShiftedDown: "leftShiftedDown",
451
+ rightNudgedUp: "leftNudgedUp",
452
+ rightNudgedDown: "leftNudgedDown",
453
+ rightClear: "leftClear",
454
+ rightPastColumn: "leftPastColumn",
455
+ rightPastColumnUp: "leftPastColumnUp",
456
+ rightPastColumnDown: "leftPastColumnDown",
457
+ rightPastColumnClear: "leftPastColumnClear",
458
+ rightPastColumnShiftedUp: "leftPastColumnShiftedUp",
459
+ rightPastColumnShiftedDown: "leftPastColumnShiftedDown",
460
+ belowEndDeep: "belowStartDeep",
461
+ aboveEnd: "aboveStart",
462
+ belowEnd: "belowStart",
463
+ aboveEndLeft: "aboveStartRight",
464
+ belowEndLeft: "belowStartRight",
465
+ outsideRight: "outsideLeft"
466
+ }, ON_COLUMN_ORDER = ["aboveEnd", "belowEnd", "right", "aboveEndLeft", "belowEndLeft", "rightShiftedUp", "rightShiftedDown"], FIRST_END_BELOW_TOTALS = /* @__PURE__ */ Symbol("firstEndBelowTotals"), ANATOMY_ABOVE_GAP = 5;
467
+ function markerGap(rect, point, r) {
468
+ let nx = Math.max(rect.x, Math.min(point.x, rect.x + rect.w)), ny = Math.max(rect.y, Math.min(point.y, rect.y + rect.h));
469
+ return Math.max(0, Math.hypot(nx - point.x, ny - point.y) - r);
470
+ }
471
+ function atThePoint(candidates, point, r, h, bounds) {
472
+ return candidates.flatMap((candidate) => {
473
+ let { rect } = candidate;
474
+ if (rect.x < bounds.x0 - 0.5 || rect.x + rect.w > bounds.x1 + 0.5) return [];
475
+ let gap = markerGap(rect, point, r);
476
+ return gap > ENDPOINT_MAX_GAP + (candidate.leaderVertical ? h + 4 : 0) ? [] : gap <= h || candidate.leaderFrom ? [candidate] : [{ ...candidate, leaderFrom: { x: point.x + (rect.x + rect.w / 2 < point.x ? -r : r), y: point.y } }];
477
+ });
478
+ }
479
+ function seatsAtThePoint(candidates, point, r, h, bounds, w) {
480
+ let wide = { ...bounds, x0: bounds.x0 - w, x1: bounds.x1 + w };
481
+ return candidates.flatMap((c) => atThePoint([c], point, r, h, c.slot.includes("PastColumn") ? wide : bounds));
482
+ }
483
+ var TICK_AIR = 4;
484
+ function leavesPlot(candidate, bounds) {
485
+ return candidate.slot.includes("PastColumn") && (candidate.rect.x < bounds.x0 - 0.5 || candidate.rect.x + candidate.rect.w > bounds.x1 + 0.5);
486
+ }
487
+ function rankedSeats(seats, strokes, fills) {
488
+ return withinOneFill(clearOfStrokes(seats, strokes), fills);
489
+ }
490
+ function comboEndpointRequest(input) {
491
+ let { s, last, lastCat, text, measure, MARKER_R, hasColumns, band, adjacentAxisActive, highlights, anatomy } = input, labelFont = anatomy ? { ...input.labelFont } : input.labelFont, tsize = measure(text || "0", labelFont), w = tsize.width, h = tsize.height, beside = last.x + MARKER_R + SIDE_GAP, right = { slot: "right", rect: { x: beside, y: last.y - h / 2, w, h }, penalty: 0 }, rightUp = { slot: "rightShiftedUp", rect: { x: beside, y: last.y - h / 2 - h - 3, w, h }, penalty: 1 }, rightDown = { slot: "rightShiftedDown", rect: { x: beside, y: last.y + h / 2 + 3, w, h }, penalty: 1 }, rightNudgedDown = { slot: "rightNudgedDown", rect: { x: beside, y: last.y - h / 2 + 3, w, h }, penalty: 0.5 }, rightNudgedUp = { slot: "rightNudgedUp", rect: { x: beside, y: last.y - h / 2 - 3, w, h }, penalty: 0.5 }, edgeAir = 3, clearY = Math.min(Math.max(last.y - h / 2, (input.bounds.y0 ?? -1 / 0) + edgeAir), (input.bounds.y1 ?? 1 / 0) - h - edgeAir), rightClear = Math.abs(clearY - (last.y - h / 2)) > 3 && Math.abs(clearY - (last.y - h / 2)) < h ? [{ slot: "rightClear", rect: { x: beside, y: clearY, w, h }, penalty: 0.75 }] : [], ownColumnEdge = Math.max(-1 / 0, maxOf(input.fills.filter((fill) => fill.x <= last.x && last.x <= fill.x + fill.w).map((fill) => fill.x + fill.w))), past = ownColumnEdge + edgeAir, rightPast = s.kind === "line" && input.sharesOnColumns !== !0 && hasColumns && Number.isFinite(ownColumnEdge) && past > beside && past - beside < w ? [
492
+ { slot: "rightPastColumn", rect: { x: past, y: last.y - h / 2, w, h }, penalty: 0.6 },
493
+ { slot: "rightPastColumnUp", rect: { x: past, y: last.y - h / 2 - 3, w, h }, penalty: 0.7 },
494
+ { slot: "rightPastColumnDown", rect: { x: past, y: last.y - h / 2 + 3, w, h }, penalty: 0.7 },
495
+ ...rightClear.map((seat) => ({ ...seat, slot: "rightPastColumnClear", rect: { ...seat.rect, x: past }, penalty: 0.8 })),
496
+ { slot: "rightPastColumnShiftedUp", rect: { x: past, y: last.y - h / 2 - h - 3, w, h }, penalty: 1.1 },
497
+ { slot: "rightPastColumnShiftedDown", rect: { x: past, y: last.y + h / 2 + 3, w, h }, penalty: 1.1 }
498
+ ] : [], aboveEnd = { slot: "aboveEnd", rect: { x: last.x - w + 2, y: last.y - h - MARKER_R - 4, w, h }, penalty: 2 }, belowEnd = { slot: "belowEnd", rect: { x: last.x - w + 2, y: last.y + MARKER_R + 4, w, h }, penalty: 2 }, belowEndDeep = { slot: "belowEndDeep", rect: { x: last.x - w + 2, y: last.y + MARKER_R + 4 + h / 2, w, h }, penalty: 2 }, aboveEndLeft = { slot: "aboveEndLeft", rect: { x: last.x - MARKER_R - 12 - w, y: last.y - h - MARKER_R - 4, w, h }, penalty: 3 }, belowEndLeft = { slot: "belowEndLeft", rect: { x: last.x - MARKER_R - 12 - w, y: last.y + MARKER_R + 4, w, h }, penalty: 3 }, outsideRight = {
499
+ slot: "outsideRight",
500
+ rect: { x: (hasColumns ? band.position(last.ci) + band.bandwidth : last.x) + 8, y: last.y - h / 2, w, h },
501
+ penalty: 4,
502
+ leaderFrom: { x: last.x + MARKER_R, y: last.y }
503
+ }, clearsColumns = s.kind === "line" && input.sharesOnColumns !== !0, centredX = clearsColumns ? Math.max(input.bounds.x0, Math.min(last.x - w / 2, input.bounds.x1 - w)) : last.x - w / 2, aboveCenter = { slot: "aboveCenter", rect: { x: centredX, y: last.y - h - (anatomy ? ANATOMY_ABOVE_GAP : MARKER_R + 4), w, h }, penalty: 0 }, aboveRaised = { ...aboveCenter, slot: "aboveRaised", rect: { ...aboveCenter.rect, y: aboveCenter.rect.y - 4 }, penalty: 0.5, ...anatomy ? { needsBacking: !0 } : {} }, lift = anatomy ? clearLift(aboveCenter.rect, input.strokes, h) : void 0, aboveLifted = lift === void 0 ? [] : [{ ...aboveCenter, slot: "aboveLifted", rect: { ...aboveCenter.rect, y: aboveCenter.rect.y - lift } }], belowCenter = { slot: "belowCenter", rect: { x: centredX, y: last.y + MARKER_R + 4, w, h }, penalty: 1 }, belowLowered = { ...belowCenter, slot: "belowLowered", rect: { ...belowCenter.rect, y: belowCenter.rect.y + 4 }, penalty: 1.5 }, pastXs = [0, 2, 4, 6].map((k) => last.x - w / 2 + (last.x - w / 2 > centredX ? -k : k)).filter((x) => Math.abs(x - centredX) > 0.5 && (x - centredX) * (last.x - w / 2 - centredX) > 0), centredPast = clearsColumns && hasColumns ? pastXs.flatMap((x, k) => [
504
+ { ...belowCenter, slot: `belowPastColumn${k || ""}`, rect: { ...belowCenter.rect, x } },
505
+ { ...aboveCenter, slot: `abovePastColumn${k || ""}`, rect: { ...aboveCenter.rect, x } }
506
+ ]) : [], ordered = anatomy ? [aboveCenter, ...aboveLifted, aboveEnd, belowCenter, belowEnd, aboveEndLeft, belowEndLeft, right, rightUp, rightDown].map((c) => ({ ...c, needsBacking: !0 })) : s.kind === "area" ? [belowEnd, belowEndDeep, belowEndLeft, belowCenter, right, rightDown, aboveEnd, aboveEndLeft, rightUp, outsideRight] : adjacentAxisActive ? [aboveEnd, belowEnd, aboveEndLeft, belowEndLeft, right, rightNudgedUp, rightNudgedDown, ...rightClear, ...rightPast, rightUp, rightDown, outsideRight] : [right, rightNudgedUp, rightNudgedDown, ...rightClear, ...rightPast, rightUp, rightDown, aboveEnd, belowEnd, aboveEndLeft, belowEndLeft, outsideRight], mirrored = input.first ? ordered.map((candidate) => ({
507
+ ...candidate,
508
+ slot: firstSlots[candidate.slot],
509
+ rect: { ...candidate.rect, x: 2 * last.x - candidate.rect.x - candidate.rect.w },
510
+ ...candidate.leaderFrom ? { leaderFrom: { ...candidate.leaderFrom, x: 2 * last.x - candidate.leaderFrom.x } } : {}
511
+ })) : ordered, onColumn = hasColumns && (!anatomy || input.allowOnColumn) && (!clearsColumns || input.allowOnColumn) ? [
512
+ ...ON_COLUMN_ORDER.flatMap((slot) => mirrored.filter((c) => c.slot === (input.first ? firstSlots[slot] : slot))),
513
+ // Centred on the point, the seat most likely to lie wholly on its column.
514
+ aboveCenter,
515
+ aboveRaised,
516
+ belowCenter,
517
+ belowLowered
518
+ ].map((c) => ({ ...c, slot: `${c.slot}OnColumn`, penalty: c.penalty + 10, needsBacking: !0, overColumns: !0 })).filter((c) => !(input.segmentSeats ?? []).some((seat) => rectsOverlap(seat, c.rect, 2))) : [], bandX = band.position(last.ci), ownColumn = input.fills.some((fill) => fill.x < bandX + band.bandwidth - 0.5 && fill.x + fill.w > bandX + 0.5), partialFirst = !input.first && !anatomy && clearsColumns && ownColumn && lastCat.partial === !0 ? [{ ...belowCenter, penalty: 0 }, { ...belowLowered, penalty: 0.5 }] : [], aboveColumns = [], totalOnLeader = !1;
519
+ if (clearsColumns && hasColumns) {
520
+ let x = Math.max(input.bounds.x0, Math.min(last.x - w / 2, input.bounds.x1 - w)), across = (rect) => rect.x < x + w + 2 && rect.x + rect.w > x - 2, crossed = input.fills.filter(across);
521
+ if (totalOnLeader = last.ci === 0 && (input.totalSeats ?? []).some((seat) => seat.x < last.x && seat.x + seat.w > last.x && seat.y < last.y), crossed.length > 0) {
522
+ let top = Math.min(minOf(crossed.map((fill) => fill.y)), minOf((input.totalSeats ?? []).filter(across).map((seat) => seat.y)));
523
+ for (let step = 0; step < 3; step++) for (let raise of [0, 4]) aboveColumns.push({
524
+ slot: `aboveColumn${step}${raise ? "Raised" : ""}`,
525
+ rect: { x, y: top - h - 4 - step * (h + 4) - raise, w, h },
526
+ penalty: (totalOnLeader ? LAST_RESORT_PENALTY : 0) + 5 + step + raise / 8,
527
+ // A point under the label's own span still gets its leader, straight down to it.
528
+ leaderFrom: { x: last.x, y: last.y },
529
+ leaderVertical: !0
530
+ });
531
+ }
532
+ }
533
+ return {
534
+ id: `point:${s.id}:${lastCat.id}`,
535
+ kind: "point",
536
+ owner: { seriesId: s.id, categoryId: lastCat.id },
537
+ text,
538
+ lines: [text],
539
+ typeRole: "label",
540
+ font: labelFont,
541
+ ...anatomy ? { fontStep: labelFont } : {},
542
+ // A line's end value seats before an area's, which has its fill to sit on.
543
+ priority: s.vals[last.ci].priority ?? (input.first && input.firstBelowTotals ? PRIORITY.endpoint : PRIORITY.reference) + (s.kind === "area" ? 0 : 0.5) + (highlights.has(s.id) ? PRIORITY.highlightBonus : 0),
544
+ redundant: s.vals[last.ci].labelOverride === !1,
545
+ // A Pareto's first share repeats its first bar: without a seat beside the total it drops as density.
546
+ ...input.first && input.firstBelowTotals && s.vals[last.ci].labelOverride === void 0 ? { quietWhenCrowded: !0 } : {},
547
+ // A line end's leader keeps its end clear of later labels.
548
+ // Over a running column the hollow marker is the mark the value names, so the nearest-mark
549
+ // rule measures from its edge: the line's own last segment beside the seat is no rival.
550
+ ...s.kind === "area" ? {} : { anchor: partialFirst.length > 0 ? { x: last.x - MARKER_R, y: last.y - MARKER_R, w: 2 * MARKER_R, h: 2 * MARKER_R } : { x: last.x, y: last.y } },
551
+ // A value lifted over the columns hangs on a long leader: no column total sits on it, and it
552
+ // crosses none (a total on the leader stacks two numbers on one vertical).
553
+ ...aboveColumns.length > 0 ? { leaderClear: !0 } : {},
554
+ candidates: rankedSeats(seatsAtThePoint([...partialFirst, ...mirrored, ...clearsColumns ? [aboveCenter, aboveRaised, ...partialFirst.length > 0 ? [] : [belowCenter, belowLowered]] : [], ...totalOnLeader ? [] : aboveColumns, ...onColumn, ...centredPast, ...totalOnLeader ? aboveColumns : []], last, MARKER_R, h, input.bounds, w), input.strokes, input.fills).filter((candidate) => !(input.totalSeats ?? []).some((seat) => rectsOverlap(seat, candidate.rect, 2))).filter((candidate) => !clearsColumns || candidate.overColumns || !input.fills.some((fill) => rectsOverlap(fill, candidate.rect, 2)) && (input.bounds.y0 === void 0 || candidate.rect.y >= input.bounds.y0) && (input.bounds.y1 === void 0 || candidate.rect.y + candidate.rect.h <= input.bounds.y1)).filter((candidate) => !clearsColumns || !candidate.overColumns || input.bounds.y1 === void 0 || candidate.rect.y + candidate.rect.h <= input.bounds.y1).map((candidate) => ({ ...candidate, outsidePlot: !clearsColumns && /^(right|left|outsideRight|outsideLeft)/.test(candidate.slot) })).filter((candidate) => !(leavesPlot(candidate, input.bounds) && candidate.slot.includes("Shifted"))).map((candidate, i, all) => [candidate, leavesPlot(candidate, input.bounds) ? all.length + i : i]).sort((a, b) => a[1] - b[1]).map(([candidate]) => leavesPlot(candidate, input.bounds) ? { ...candidate, penalty: candidate.penalty + LAST_RESORT_PENALTY, tickAir: TICK_AIR } : candidate)
555
+ };
556
+ }
557
+
558
+ // src/core/charts/combo/domain.ts
559
+ function resolveComboEnv(options, warnings) {
560
+ breakUnsupported("combo", options, warnings);
561
+ let theme = chartTheme(options), paletteRamp = chartPalette(theme, options.palette, warnings);
562
+ return {
563
+ theme,
564
+ palette: paletteRamp ? options.palette : void 0,
565
+ size: resolveSize(options.size),
566
+ byExample: memoFormatterFromExample(),
567
+ measure: options.measure ?? defaultMeasurer,
568
+ highlights: new Set(resolveHighlight(options.highlight)),
569
+ density: options.labelDensity ?? "smart"
570
+ };
571
+ }
572
+ function normalizeComboData(data) {
573
+ let { cats, series } = normalizeCategorySeries("combo", data, (s, cells) => ({
574
+ id: s.id,
575
+ label: s.label ?? s.id,
576
+ role: s.role ?? "data",
577
+ kind: s.kind ?? "column",
578
+ axis: s.axis ?? "primary",
579
+ scenario: normalizeScenario(s.scenario, `series[${s.id}].scenario`),
580
+ colorRole: s.colorRole,
581
+ fill: s.fill,
582
+ format: s.format,
583
+ unit: s.unit,
584
+ lineStyle: s.lineStyle,
585
+ marker: s.marker,
586
+ smooth: s.smooth,
587
+ interpolateGaps: s.interpolateGaps ?? !1,
588
+ vals: cells.map((cell, ci) => cellFields(cell, `series[${s.id}].values[${ci}]`))
589
+ }));
590
+ return { cats, seriesNorm: series };
591
+ }
592
+ function comboAxisGate(options, seriesNorm, columns, lines, warnings) {
593
+ let secOpt = options.secondaryAxis, rulerRequested = secOpt?.ruler, acknowledged = secOpt?.acknowledge === !0, ruler;
594
+ rulerRequested && acknowledged ? (acknowledged = !1, warnings.push({
595
+ code: "combo-ruler-conflict",
596
+ severity: "error",
597
+ message: "secondaryAxis.acknowledge (an independent second scale) and secondaryAxis.ruler (a relabelling of the primary scale) contradict each other \u2014 both refused",
598
+ suggest: "choose one: acknowledge for genuinely independent units, ruler for a share of a total"
599
+ })) : rulerRequested && (!Number.isFinite(rulerRequested.total) || rulerRequested.total <= 0 ? warnings.push({
600
+ code: "combo-ruler-total-invalid",
601
+ severity: "error",
602
+ message: `secondaryAxis.ruler.total must be positive and finite (got ${String(rulerRequested.total)}) \u2014 ruler not drawn`,
603
+ suggest: "pass the grand total the percentages refer to"
604
+ }) : ruler = { total: rulerRequested.total, intervals: Math.max(1, Math.round(rulerRequested.ticks ?? 5)) });
605
+ for (let s of columns)
606
+ s.axis === "secondary" && (s.axis = "primary", warnings.push({
607
+ code: "dual-axis",
608
+ severity: "warn",
609
+ message: `column series '${s.id}' cannot use the secondary axis \u2014 treated as primary`,
610
+ owner: { seriesId: s.id }
611
+ }));
612
+ let secondaryRequested = lines.filter((s) => s.axis === "secondary"), secondaryActive = !1;
613
+ if (secondaryRequested.length > 0)
614
+ if (acknowledged)
615
+ secondaryActive = !0, warnings.push({
616
+ code: "dual-axis",
617
+ severity: "warn",
618
+ message: `secondary axis in use \u2014 dual-axis charts invite misreading; ${secOpt?.domain ? "the secondary scale follows its authored domain" : "tick rows are synced to the primary axis"}`
619
+ });
620
+ else {
621
+ for (let s of secondaryRequested) s.axis = "primary";
622
+ let ids = secondaryRequested.map((s) => `'${s.id}'`).join(", ");
623
+ warnings.push({
624
+ code: "dual-axis",
625
+ severity: "error",
626
+ message: `series ${ids} ${secondaryRequested.length === 1 ? "requests" : "request"} the secondary axis without options.secondaryAxis.acknowledge \u2014 a dual-axis chart is refused unless acknowledged`,
627
+ suggest: `for genuinely independent units, set options.secondaryAxis = { acknowledge: true }; for a share of a total, remove axis: 'secondary' from ${ids} and set options.secondaryAxis.ruler`,
628
+ field: ["data", "series", seriesNorm.indexOf(secondaryRequested[0]), "axis"]
629
+ });
630
+ }
631
+ return { secOpt, ruler, secondaryRequested, secondaryActive };
632
+ }
633
+ function comboDrawsSecondaryAxis(data, options) {
634
+ let series = (data.series ?? []).filter((s) => (s.role ?? "data") !== "reference").map((s) => ({ ...s, kind: s.kind ?? "column" }));
635
+ return comboAxisGate(options, series, series.filter((s) => s.kind === "column"), series.filter((s) => s.kind !== "column"), []).secondaryActive;
636
+ }
637
+ function primaryLinesUnlabelled(options, lines, secondaryActive) {
638
+ let onPrimary = lines.some((s) => !(secondaryActive && s.axis === "secondary")), pointsOff = typeof options.labels == "object" && options.labels?.point === !1;
639
+ return onPrimary && (pointsOff || comboValueLabels(options) !== "all");
640
+ }
641
+ function comboUnitConflicts(options, seriesNorm, dataSeries, secondaryActive, warnings) {
642
+ let scales = [
643
+ { series: dataSeries.filter((s) => !secondaryActive || s.axis !== "secondary"), unit: options.unit, name: "the primary axis", secondary: !1 },
644
+ { series: secondaryActive ? dataSeries.filter((s) => s.axis === "secondary") : [], unit: void 0, name: "the secondary axis", secondary: !0 }
645
+ ];
646
+ for (let scale of scales) {
647
+ let conflict = unitConflict(scale.series, scale.unit);
648
+ if (!conflict) continue;
649
+ let s = scale.series[conflict.index];
650
+ warnings.push(unitConflictRefusal(conflict, s.id, seriesNorm.indexOf(s), scale.name, s.kind === "column" || scale.secondary ? `give the ${scale.secondary ? "secondary" : "column"} series one unit, or show the measure in its own chart` : `move series '${s.id}' to the secondary axis (axis: 'secondary', secondaryAxis: { acknowledge: true }) and title it in axisTitles.secondary`, scale.unit));
651
+ }
652
+ }
653
+ function ladderStepUp(raw) {
654
+ if (!(raw > 0) || !Number.isFinite(raw)) return 1;
655
+ let base = Math.pow(10, Math.floor(Math.log10(raw)));
656
+ for (let m of [1, 2, 2.5, 3, 5, 10])
657
+ if (m * base >= raw - base * 1e-9) return m * base;
658
+ return 10 * base;
659
+ }
660
+ function roundTick(v) {
661
+ return Number(v.toFixed(10));
662
+ }
663
+ function primaryLineMean(plans, secondaryActive) {
664
+ let sum = 0, n = 0;
665
+ for (let p of plans)
666
+ if (!(secondaryActive && p.s.axis === "secondary"))
667
+ for (let val of p.s.vals)
668
+ val.v !== null && (sum += val.v, n++);
669
+ return n > 0 ? sum / n : void 0;
670
+ }
671
+ function comboStacks(cats, columnSeries) {
672
+ let stackTotals = {}, posTop = [], negBot = [], anyByCat = [], lo = 0, hi = 0;
673
+ return cats.forEach((c, ci) => {
674
+ let p = 0, n = 0;
675
+ for (let s of columnSeries) {
676
+ let v = s.vals[ci].v;
677
+ v !== null && (v >= 0 ? p += v : n += v);
678
+ }
679
+ posTop[ci] = p, negBot[ci] = n, anyByCat[ci] = columnSeries.some((s) => s.vals[ci].v !== null), columnSeries.length > 0 && (stackTotals[c.id] = p + n), lo = Math.min(lo, n), hi = Math.max(hi, p);
680
+ }), { stackTotals, posTop, negBot, anyByCat, lo, hi };
681
+ }
682
+ function axisValueLines(annotations, axis) {
683
+ return valueLineExtent(annotations, axis);
684
+ }
685
+ function primaryDomain(options, gate, extent, fmt, warnings) {
686
+ let { lo, hi, dataHi } = extent, { ruler } = gate, va = options.valueAxis ?? {}, lo2 = lo < 0 ? lo * 1.08 : 0, hi2 = hi > 0 ? hi * 1.08 : 0;
687
+ lo2 === 0 && hi2 === 0 && (hi2 = 1);
688
+ let [dLo, dHi] = niceDomain(lo2, hi2, 5, { dataExtent: [lo, hi], maxWasteFraction: 0.15 });
689
+ [dLo, dHi] = applyAxisBounds([dLo, dHi], [Math.min(lo, 0), Math.max(hi, 0)], va, warnings), ruler && (dLo = Math.min(0, lo), dHi = Math.max(ruler.total, hi), dataHi > ruler.total && warnings.push({
690
+ code: "combo-ruler-total-exceeded",
691
+ severity: "warn",
692
+ message: `plotted values reach ${fmt(dataHi)}, above the declared ruler total ${fmt(ruler.total)} \u2014 the percent ladder continues past 100%`,
693
+ suggest: "pass the true grand total as secondaryAxis.ruler.total"
694
+ }));
695
+ let pticks = linearScale([dLo, dHi], [0, 1]).ticks(5);
696
+ return pticks.length < 2 && (pticks = [dLo, dHi]), ruler && (pticks = Array.from(
697
+ { length: ruler.intervals + 1 },
698
+ (_, i) => roundTick(dLo + (dHi - dLo) * i / ruler.intervals)
699
+ )), { dLo, dHi, pticks };
700
+ }
701
+ function rightAxis(options, gate, raw, primary, secondarySpec, fixed) {
702
+ let { secOpt, ruler, secondaryActive, secondaryRequested } = gate, { pticks } = primary, nTicks = pticks.length, lang = options.locale?.language, secondaryDomain, secStep = 1;
703
+ if (secondaryActive && secOpt?.domain) {
704
+ let lo = Math.min(secOpt.domain[0], raw.lo), hi = Math.max(secOpt.domain[1], raw.hi), even = (hi - lo) / (nTicks - 1) || 1;
705
+ secStep = ladderSteps(even / 2, even * 2, PRIMARY_MANTISSAS).filter((step) => Math.abs((hi - lo) / step - Math.round((hi - lo) / step)) < 1e-9).reduce((best, step) => {
706
+ if (best === void 0) return step;
707
+ let off = Math.abs((hi - lo) / step - (nTicks - 1)), bestOff = Math.abs((hi - lo) / best - (nTicks - 1));
708
+ return off < bestOff - 1e-9 || Math.abs(off - bestOff) <= 1e-9 && step < best ? step : best;
709
+ }, void 0) ?? even, secondaryDomain = [roundTick(lo), roundTick(hi)];
710
+ } else if (secondaryActive && fixed !== void 0)
711
+ secStep = fixed.step, secondaryDomain = [roundTick(fixed.start), roundTick(fixed.start + fixed.step * (nTicks - 1))];
712
+ else if (secondaryActive) {
713
+ let step2 = ladderStepUp((raw.hi - raw.lo) / (nTicks - 1) || 1), s0 = Math.floor(raw.lo / step2 + 1e-9) * step2;
714
+ for (let i = 0; i < 12 && s0 + step2 * (nTicks - 1) < raw.hi - step2 * 1e-9; i++)
715
+ step2 = ladderStepUp(step2 * 1.2), s0 = Math.floor(raw.lo / step2 + 1e-9) * step2;
716
+ secStep = step2, secondaryDomain = [roundTick(s0), roundTick(s0 + step2 * (nTicks - 1))];
717
+ }
718
+ let secFmtSrc = secondaryRequested.find((s) => s.format)?.format, secAxisFmtSrc = secondaryActive ? secOpt?.format : void 0, secondaryAllPct = !secAxisFmtSrc && !secFmtSrc && secondaryRequested.length > 0 && secondaryRequested.every((s) => s.unit === "%" || s.vals.every((val) => val.v === null || val.isPct)) && secondaryRequested.some((s) => s.unit === "%" || s.vals.some((val) => val.isPct));
719
+ if (secondaryDomain) {
720
+ let rows = Math.round((secondaryDomain[1] - secondaryDomain[0]) / secStep), secTickValues = Array.from({ length: rows + 1 }, (_, i) => roundTick(secondaryDomain[0] + secStep * i)), pctDecimals = secondaryAllPct ? Math.max(0, ...secTickValues.map((tv) => {
721
+ for (let d = 0; d <= 3; d++)
722
+ if (Math.abs(tv - Number(tv.toFixed(d))) < 1e-9) return d;
723
+ return 3;
724
+ })) : 0, secTickFmt = secAxisFmtSrc ? formatterFromExample(secAxisFmtSrc, options.locale?.language) : secFmtSrc ? formatterFromExample(secFmtSrc, options.locale?.language) : secondaryAllPct ? (tv) => formatAutomaticPercent(tv, pctDecimals, !1, lang) : tickFormatter(secondarySpec.spec, secTickValues);
725
+ return secOpt?.show === !1 ? { secFmtSrc, secondaryDomain, rightTicks: [] } : { secFmtSrc, secondaryDomain, rightTicks: secTickValues.map((tv) => ({ at: tv, text: secTickFmt(tv) })) };
726
+ }
727
+ if (ruler) {
728
+ let pct = pticks.map((t) => roundTick(t / ruler.total * 100)), decimals = pct.some((p) => Math.abs(p - Math.round(p)) > 1e-9) ? 1 : 0;
729
+ return { secFmtSrc, secondaryDomain, rightTicks: pct.map((p) => ({ at: p, text: formatAutomaticPercent(p, decimals, !1, lang) })) };
730
+ }
731
+ return { secFmtSrc, secondaryDomain, rightTicks: [] };
732
+ }
733
+ var PRIMARY_MANTISSAS = [1, 2, 2.5, 5], SECONDARY_MANTISSAS = [1, 1.5, 2, 2.5, 3, 4, 5, 6, 8], LINE_CLEARANCE = 0.03;
734
+ function ladderSteps(lo, hi, mantissas) {
735
+ let out = [];
736
+ for (let exp = Math.floor(Math.log10(lo)) - 1; exp <= Math.ceil(Math.log10(hi)) + 1; exp++)
737
+ for (let m of mantissas) {
738
+ let step = roundTick(m * Math.pow(10, exp));
739
+ step >= lo - 1e-9 && step <= hi + 1e-9 && out.push(step);
740
+ }
741
+ return out;
742
+ }
743
+ function dualAxisScales(input) {
744
+ let { columnTops, primaryHi, lines, secondaryHi } = input;
745
+ if (input.columnBottoms.some((v) => v < 0) || lines.some((row) => row.some((v) => v !== null && v < 0)) || !(primaryHi > 0) || !(secondaryHi > 0)) return;
746
+ let half = input.bandFraction / 2, best;
747
+ for (let n2 of [3, 4, 5, 6])
748
+ for (let p2 of ladderSteps(primaryHi / n2, primaryHi * 3 / n2, PRIMARY_MANTISSAS))
749
+ for (let s2 of ladderSteps(secondaryHi * 1.01 / n2, secondaryHi * 1.6 / n2, SECONDARY_MANTISSAS)) {
750
+ let colAt = (ci) => (columnTops[ci] ?? 0) / (n2 * p2), lineAt = (v) => v / (n2 * s2);
751
+ if (!lines.every((row) => row.every((v, ci) => {
752
+ if (v === null) return !0;
753
+ if (lineAt(v) - colAt(ci) < (input.clearance ?? LINE_CLEARANCE)) return !1;
754
+ for (let next of [ci - 1, ci + 1]) {
755
+ let w = row[next];
756
+ if (w == null) continue;
757
+ if (lineAt(v) + (lineAt(w) - lineAt(v)) * half - colAt(ci) < (input.clearance ?? LINE_CLEARANCE)) return !1;
758
+ }
759
+ return !0;
760
+ }))) continue;
761
+ let fill = maxOf(columnTops) / (n2 * p2), lineFill = secondaryHi / (n2 * s2);
762
+ (!best || fill > best.fill + 1e-9 || Math.abs(fill - best.fill) <= 1e-9 && (lineFill > best.lineFill + 1e-9 || Math.abs(lineFill - best.lineFill) <= 1e-9 && n2 < best.n)) && (best = { n: n2, p: p2, s: s2, fill, lineFill });
763
+ }
764
+ if (!best) return;
765
+ let { n, p, s } = best;
766
+ return { pticks: Array.from({ length: n + 1 }, (_, i) => roundTick(i * p)), secondaryStep: s };
767
+ }
768
+ function zeroAlignedAxes(primary, secondary) {
769
+ let { pticks } = primary, n = pticks.length, zero = pticks.findIndex((t) => Math.abs(t) < 1e-9), p = n > 1 ? pticks[1] - pticks[0] : 0;
770
+ if (zero < 0 || !(p > 0) || pticks.some((t, i) => Math.abs(t - pticks[0] - i * p) > p * 1e-6)) return;
771
+ let range = secondary.hi - secondary.lo;
772
+ if (!(range > 0)) return;
773
+ let best;
774
+ for (let step2 of ladderSteps(range / (n + 1), range * 4 / Math.max(1, n - 1), [1, 2, 2.5, 5])) {
775
+ let below2 = Math.max(zero, Math.ceil(-secondary.lo / step2 - 1e-9)), above2 = Math.max(n - 1 - zero, Math.ceil(secondary.hi / step2 - 1e-9));
776
+ (!best || below2 + above2 < best.below + best.above) && (best = { below: below2, above: above2, step: step2 });
777
+ }
778
+ if (!best) return;
779
+ let { below, above, step } = best, ticks = Array.from({ length: below + above + 1 }, (_, i) => roundTick((i - below) * p));
780
+ return {
781
+ primary: { dLo: Math.min(primary.dLo, ticks[0]), dHi: Math.max(primary.dHi, ticks[ticks.length - 1]), pticks: ticks },
782
+ secondary: { step, start: roundTick(-below * step) }
783
+ };
784
+ }
785
+ function dualAxisAnatomy(options, secondaryActive, theme) {
786
+ let pinned = options.secondaryAxis?.domain !== void 0;
787
+ return !secondaryActive || pinned ? !1 : options.dualAxis?.anatomy ?? theme?.valueAxis?.dualAxis === !0;
788
+ }
789
+ function averageMarkerMean(options, cats, columns, lines, warnings, adds) {
790
+ let scope = averageMarkerScope(options.averageMarker);
791
+ if (scope === void 0) return;
792
+ let lineIds = scope === "all" ? [] : scope.filter((id) => lines.some((s) => s.id === id));
793
+ lineIds.length > 0 && warnings.push({
794
+ code: "average-marker-scope",
795
+ severity: "warn",
796
+ message: `averageMarker on a combo averages its column stacks; the line${lineIds.length === 1 ? "" : "s"} ${lineIds.map((id) => `'${id}'`).join(", ")} ${lineIds.length === 1 ? "is" : "are"} left out`,
797
+ suggest: "scope the marker to column series; a valueLine annotation draws a line at any value"
798
+ });
799
+ let selected = columns.filter((s) => scope === "all" || scope.includes(s.id));
800
+ if (averageOfUnaddedSums(adds(selected), warnings)) return;
801
+ let stacks = cats.flatMap((_, ci) => {
802
+ let values = selected.flatMap((s) => s.vals[ci]?.v == null ? [] : [s.vals[ci].v]);
803
+ return values.length > 0 ? [values.reduce((sum, v) => sum + v, 0)] : [];
804
+ });
805
+ if (stacks.length === 0) {
806
+ warnings.push({ code: "average-marker-empty", severity: "warn", message: "averageMarker scope has no plotted values; marker omitted" });
807
+ return;
808
+ }
809
+ return stacks.reduce((sum, v) => sum + v, 0) / stacks.length;
810
+ }
811
+ function comboAnomalyModel(spec, cats, lines, secondary, primary, pctFmt, locale, warnings, strings) {
812
+ let lineSeries = lines.filter((s) => s.kind === "line");
813
+ if (lineSeries.length !== 1)
814
+ throw new NormalizeError(
815
+ "anomaly-single-series",
816
+ "options.anomaly",
817
+ `anomaly on a combo judges its one line series; got ${lineSeries.length} \u2014 a robust score across two different measures is meaningless`,
818
+ "give exactly one series kind 'line', or chart the measure on its own line chart"
819
+ );
820
+ refuseAnomalySpec(spec);
821
+ let series = lineSeries[0], onSecondary = series.axis === "secondary" && secondary !== primary, raster = onSecondary ? secondary : primary, isPct = series.vals.some((val) => val.isPct), fmt = isPct ? pctFmt : raster.fmt, statFmt = isPct ? (v) => formatAutomaticPercent(v, 2, !1, locale) : (v) => formatStatWithSpec(v, raster.spec), present = cats.flatMap((c, ci) => {
822
+ let value = series.vals[ci]?.v;
823
+ return value == null || !Number.isFinite(value) ? [] : [{ categoryId: c.id, value }];
824
+ });
825
+ return { ...anomalyModel(spec, present, fmt, statFmt, locale, warnings, strings), seriesId: series.id, statFmt, onSecondary };
826
+ }
827
+ var TOTALS_AXIS = /* @__PURE__ */ Symbol("boardplot.comboTotalsAxis"), SECONDARY_FULL_DOMAIN = /* @__PURE__ */ Symbol("boardplot.secondaryFullDomain"), LINE_BAND_CLEARANCE = /* @__PURE__ */ Symbol("boardplot.lineBandClearance");
828
+ function secondaryPrimaryRange(options, secondary, fallback) {
829
+ let mapped = options[SECONDARY_FULL_DOMAIN], authored = options.secondaryAxis?.domain;
830
+ if (!mapped || !authored) return [fallback[0], fallback[fallback.length - 1]];
831
+ let scale = linearScale(authored, [mapped[0], mapped[1]]);
832
+ return [scale(secondary[0]), scale(secondary[1])];
833
+ }
834
+ var OPEN_BAND_MIN_STEP = 40;
835
+ function comboBandFraction(options, count) {
836
+ return options.bandFraction !== void 0 ? options.bandFraction : options[FIRST_END_BELOW_TOTALS] === !0 ? 0.7 : (resolveSize(options.size, options.target).width - 64) / Math.max(1, count) >= OPEN_BAND_MIN_STEP ? 0.55 : 0.7;
837
+ }
838
+ function resolveComboDomain(data, options, warnings, theme) {
839
+ let { cats, seriesNorm } = normalizeComboData(data), dataSeries = seriesNorm.filter((s) => s.role !== "reference"), refs = seriesNorm.filter((s) => s.role === "reference");
840
+ if (dataSeries.length === 0)
841
+ throw new NormalizeError("empty-data", "series", "combo requires at least one data-role series");
842
+ let columns = dataSeries.filter((s) => s.kind === "column"), lines = dataSeries.filter((s) => s.kind !== "column"), chartInterpolation = options.interpolate ?? "linear", gate = comboAxisGate(options, seriesNorm, columns, lines, warnings), { secondaryActive } = gate;
843
+ comboUnitConflicts(options, seriesNorm, dataSeries, secondaryActive, warnings);
844
+ let rasterFor = (axis) => {
845
+ let group = seriesNorm.filter((s) => (s.axis ?? "primary") === axis), units = new Set(group.map((s) => s.unit)), shared2 = units.size === 1 ? [...units][0] : void 0;
846
+ return seriesRasterFormatter(
847
+ axis === "primary" ? options.format : void 0,
848
+ group.flatMap((s) => s.vals.filter((val) => !val.isPct).map((val) => val.v)),
849
+ options.locale?.language,
850
+ axis === "primary" ? options.unit ?? shared2 : shared2,
851
+ options.target,
852
+ axis === "primary" ? options.defaultFormat : void 0,
853
+ columns.length > 1
854
+ );
855
+ }, valueSpec = rasterFor("primary"), fmt = valueSpec.fmt, secondarySpec = secondaryActive ? rasterFor("secondary") : valueSpec, pctFmt = percentRasterFormatter(seriesNorm.flatMap((s) => s.vals.filter((val) => val.isPct).map((val) => val.v)), options.locale?.language), sourceMean = options.viewDomain || options.window ? columns.length > 0 && cats.length > 0 ? columns.reduce((sum, series) => sum + series.vals.reduce((n, value) => n + (value.v ?? 0), 0), 0) / cats.length : primaryLineMean(lines.map((s) => ({ s, pts: [] })), secondaryActive) : void 0, addsOver = (series) => stackAdds(series.map((s) => ({ label: s.label, unit: s.unit, pctCells: s.vals.some((val) => val.isPct) })), options.unit, void 0), columnsAdd = addsOver(columns), averageMean = averageMarkerMean(options, cats, columns, lines, warnings, addsOver), anomalyRun = options.anomaly ? comboAnomalyModel(options.anomaly, cats, lines, secondarySpec, valueSpec, pctFmt, options.locale?.language, warnings, options.strings) : void 0, population = applyCategoryViewport({
856
+ domain: options.viewDomain,
857
+ window: options.window,
858
+ categories: cats,
859
+ series: seriesNorm,
860
+ plotted: [],
861
+ basis: [],
862
+ targets: [],
863
+ annotations: options.annotations
864
+ }), meanSpan = viewportMeanSpan(population), shown = population ? population.annotations : options.annotations, marker = averageMean === void 0 ? void 0 : { ...averageMarkerLine(shown ?? [], averageMean, (v) => formatStatWithSpec(v, valueSpec.spec), meanSpan(), options.strings?.average), side: "right" }, averageMarkerId = marker?.id, annotations = marker ? [...shown ?? [], marker] : shown, effective = population ? liveWindowOptions({ ...options, annotations }, population.sampling) : marker ? { ...options, annotations } : options, { stackTotals, posTop, negBot, anyByCat, lo: stackLo, hi: stackHi } = comboStacks(cats, columns), incompleteCats = new Set(cats.filter((_, ci) => anyByCat[ci] && columns.some((s) => s.vals[ci].v === null)).map((c) => c.id));
865
+ columnsAdd && warnIncompleteStacks(
866
+ "stacked",
867
+ cats,
868
+ incompleteCats,
869
+ options.labels !== !1 && options.labels?.grandTotal !== !1,
870
+ !1,
871
+ "columns",
872
+ warnings,
873
+ disclosuresShown(options)
874
+ );
875
+ let shareTexts = /* @__PURE__ */ new Map(), roundingAdjustments = [];
876
+ options.rounding !== "nearest" && columns.length > 1 && cats.forEach((c, ci) => {
877
+ if (!anyByCat[ci] || negBot[ci] < 0 || !(posTop[ci] > 0) || incompleteCats.has(c.id) || columns.some((s) => s.vals[ci].isPct)) return;
878
+ let shares = columns.map((s) => s.vals[ci].v / posTop[ci] * 100), rounded = sumConsistentShares(shares, options.locale?.language);
879
+ rounded?.warning ? warnings.push(roundingUnavailable(c.label ?? c.id, rounded.warning)) : rounded && columns.forEach((s, si) => {
880
+ shareTexts.set(`${c.id}\0${s.id}`, rounded.texts[si]), rounded.moved[si] && roundingAdjustments.push({
881
+ whole: c.label ?? c.id,
882
+ part: s.label,
883
+ share: Math.round(shares[si] * 1e4) / 1e4,
884
+ nearest: formatShare(shares[si], options.locale?.language),
885
+ printed: rounded.texts[si]
886
+ });
887
+ });
888
+ });
889
+ let lo = stackLo, hi = stackHi, sLoRaw = 0, sHiRaw = 0;
890
+ for (let s of [...lines, ...refs]) {
891
+ let secondary = s.axis === "secondary" && secondaryActive && s.role !== "reference";
892
+ for (let val of s.vals)
893
+ val.v !== null && (secondary ? (sLoRaw = Math.min(sLoRaw, val.v), sHiRaw = Math.max(sHiRaw, val.v)) : (lo = Math.min(lo, val.v), hi = Math.max(hi, val.v)));
894
+ }
895
+ secondaryActive && sLoRaw === 0 && sHiRaw === 0 && (sHiRaw = 1);
896
+ let dataHi = hi, primaryLine = axisValueLines(effective.annotations, "primary");
897
+ primaryLine && (lo = Math.min(lo, primaryLine.lo), hi = Math.max(hi, primaryLine.hi));
898
+ let secondaryLine = secondaryActive ? axisValueLines(effective.annotations, "secondary") : null;
899
+ if (secondaryLine && (sLoRaw = Math.min(sLoRaw, secondaryLine.lo), sHiRaw = Math.max(sHiRaw, secondaryLine.hi)), options[SECONDARY_FULL_DOMAIN]) {
900
+ let mapped = secondaryPrimaryRange(options, [sLoRaw, sHiRaw], [lo, hi]);
901
+ lo = Math.min(lo, mapped[0]), hi = Math.max(hi, mapped[1]);
902
+ }
903
+ let primary = primaryDomain(effective, gate, { lo, hi, dataHi }, fmt, warnings), anatomyRequested = dualAxisAnatomy(options, secondaryActive, theme), pinnedBy = [options.valueAxis?.min !== void 0 ? "valueAxis.min" : "", options.valueAxis?.max !== void 0 ? "valueAxis.max" : ""].filter(Boolean), negative = lo < 0 || sLoRaw < 0, anatomy = anatomyRequested && pinnedBy.length === 0 && !negative;
904
+ anatomyRequested && !anatomy && warnings.push({
905
+ code: "dual-axis-anatomy-off",
906
+ severity: "info",
907
+ message: pinnedBy.length > 0 ? `dual-axis anatomy not drawn: ${pinnedBy.join(" and ")} pin the primary scale the anatomy chooses` : "dual-axis anatomy not drawn: a negative value keeps a scale from starting at zero",
908
+ suggest: pinnedBy.length > 0 ? `drop ${pinnedBy.join(" and ")} to let the anatomy choose both scales` : "the plain dual axis is drawn"
909
+ });
910
+ let bandEligible = secondaryActive && columns.length > 0 && !gate.secOpt?.domain && pinnedBy.length === 0 && !negative && options.dualAxis?.anatomy !== !1, defaultPrimary = primary, lineBandScaleInput = bandEligible ? {
911
+ columnTops: posTop,
912
+ columnBottoms: negBot,
913
+ primaryHi: hi,
914
+ lines: lines.filter((s) => s.axis === "secondary").map((s) => s.vals.map((val) => val.v)),
915
+ secondaryHi: sHiRaw,
916
+ bandFraction: comboBandFraction(options, cats.length),
917
+ clearance: options[LINE_BAND_CLEARANCE]
918
+ } : void 0, shared = lineBandScaleInput ? dualAxisScales(lineBandScaleInput) : void 0;
919
+ shared && (primary = { dLo: 0, dHi: shared.pticks[shared.pticks.length - 1], pticks: shared.pticks });
920
+ let aligned = secondaryActive && !shared && !gate.secOpt?.domain && pinnedBy.length === 0 && negative ? zeroAlignedAxes(primary, { lo: sLoRaw, hi: sHiRaw }) : void 0;
921
+ aligned && (primary = aligned.primary);
922
+ let right = rightAxis(
923
+ effective,
924
+ gate,
925
+ { lo: sLoRaw, hi: sHiRaw },
926
+ primary,
927
+ secondarySpec,
928
+ shared ? { step: shared.secondaryStep, start: 0 } : aligned?.secondary
929
+ ), fmtSecondary = secondarySpec.fmt, beforeCorridor = warnings.slice(), anomalyFor = (left, rightDomain, out) => {
930
+ let extent = anomalyRun?.onSecondary ? rightDomain : [left.dLo, left.dHi];
931
+ return anomalyRun && extent && {
932
+ model: anomalyRun.anomaly,
933
+ seriesId: anomalyRun.seriesId,
934
+ statFmt: anomalyRun.statFmt,
935
+ ...anomalyCorridor(anomalyRun.anomaly, anomalyRun.values, extent[0], extent[1], anomalyRun.statFmt, out, options.strings)
936
+ };
937
+ }, ticksFromLabels = anatomy && shared !== void 0 && columns.length > 0 && anomalyRun === void 0 && comboValueLabels(options, !0, cats.length) === "all" && options.labels !== !1 && (options.labels === void 0 || options.labels.grandTotal !== !1) && options[TOTALS_AXIS] !== !0 && options.valueAxis?.show === void 0 && options.secondaryAxis?.show === void 0, resolved = {
938
+ anomaly: anomalyFor(primary, right.secondaryDomain, warnings),
939
+ options: effective,
940
+ cats,
941
+ data: dataSeries,
942
+ columns,
943
+ lines,
944
+ refs,
945
+ secondaryActive,
946
+ secondaryTicksHidden: secondaryActive && (options.secondaryAxis?.show === !1 || ticksFromLabels),
947
+ ticksFromLabels,
948
+ anatomy,
949
+ lineBand: shared !== void 0,
950
+ // Column totals already state the scale. An explicit axis still wins, and the axis comes
951
+ // back when a total found no seat (TOTALS_AXIS): then the totals no longer state it.
952
+ showPrimaryAxis: options.valueAxis?.show ?? (ticksFromLabels ? !1 : secondaryActive || options.labels === !1 || options[TOTALS_AXIS] === !0 || (columns.length > 0 && columnsAdd && (options.labels === void 0 || options.labels.grandTotal !== !1) ? !1 : primaryLinesUnlabelled(options, lines, secondaryActive))),
953
+ interpolationFor: (series) => series.smooth === !0 ? "monotone" : series.smooth === !1 ? "linear" : chartInterpolation,
954
+ fmt,
955
+ valueSpec: valueSpec.spec,
956
+ pctFmt,
957
+ // A secondary '%' series prints its '%' like the right axis does.
958
+ scaleFmtOf: (s) => s.axis === "secondary" && secondaryActive ? s.unit === "%" ? secondarySpec.fmtPercent : fmtSecondary : fmt,
959
+ explicitFormatOf: (s, value) => value.format ?? s.format ?? (s.axis === "secondary" && secondaryActive ? void 0 : options.format),
960
+ // Fallback is the SECONDARY scale group's raster, not the primary fmt: the
961
+ // right axis is a different unit, and integer revenue must not strip the
962
+ // decimal off a 48.3-units marker display (the per-scale raster).
963
+ secFmt: right.secFmtSrc ? formatterFromExample(right.secFmtSrc, options.locale?.language) : fmtSecondary,
964
+ sourceMean,
965
+ meanSpan,
966
+ averageMarkerId,
967
+ stackTotals,
968
+ shareTexts,
969
+ roundingAdjustments,
970
+ incompleteCats,
971
+ columnsAdd,
972
+ posTop,
973
+ negBot,
974
+ anyByCat,
975
+ ...primary,
976
+ secondaryDomain: right.secondaryDomain,
977
+ rightTicks: ticksFromLabels ? [] : right.rightTicks
978
+ };
979
+ return lineBandScaleInput && (resolved.withLineBandClearance = (clearance) => {
980
+ let next = dualAxisScales({ ...lineBandScaleInput, clearance });
981
+ if (shared?.secondaryStep === next?.secondaryStep && shared?.pticks.length === next?.pticks.length && !shared?.pticks.some((tick, i) => tick !== next.pticks[i])) return;
982
+ let left = next ? { dLo: 0, dHi: next.pticks[next.pticks.length - 1], pticks: next.pticks } : defaultPrimary, right2 = rightAxis(
983
+ effective,
984
+ gate,
985
+ { lo: sLoRaw, hi: sHiRaw },
986
+ left,
987
+ secondarySpec,
988
+ next ? { step: next.secondaryStep, start: 0 } : void 0
989
+ ), nextWarnings = [...beforeCorridor], axes = next || !resolved.ticksFromLabels ? {} : {
990
+ ticksFromLabels: !1,
991
+ showPrimaryAxis: !0,
992
+ secondaryTicksHidden: options.secondaryAxis?.show === !1
993
+ };
994
+ return { domain: {
995
+ ...resolved,
996
+ ...left,
997
+ ...axes,
998
+ lineBand: next !== void 0,
999
+ secondaryDomain: right2.secondaryDomain,
1000
+ rightTicks: next && resolved.ticksFromLabels ? [] : right2.rightTicks,
1001
+ anomaly: anomalyFor(left, right2.secondaryDomain, nextWarnings)
1002
+ }, warnings: nextWarnings };
1003
+ }), resolved;
1004
+ }
1005
+
1006
+ // src/core/charts/combo/plot.ts
1007
+ var RIGHT_TICK_GAP = 8, GROWTH_GAP = 12, GROWTH_NOTE_BELOW = 600, GROWTH_ONE_LINE_SHARE = 0.2;
1008
+ function growthItems(domain, lang) {
1009
+ let { cats, columns, lines, stackTotals, anyByCat } = domain, items = [], label = (ci) => cats[ci].label ?? cats[ci].id, growth = (values, name) => {
1010
+ let at = values.flatMap((v, ci) => v !== null && cats[ci].partial !== !0 ? [ci] : []);
1011
+ if (at.length < 2) return;
1012
+ let a = at[0], b = at[at.length - 1], first = values[a], last = values[b];
1013
+ if (!(first > 0)) return;
1014
+ let span = a === 0 && b === cats.length - 1 ? "" : `${label(a)}\u2013${label(b)}`, head = name.split(",")[0].trim();
1015
+ return { text: formatAutomaticPercent((last / first - 1) * 100, 0, !0, lang), name: [name, span].filter(Boolean).join(", "), short: [head, span].filter(Boolean).join(", "), last };
1016
+ }, line = lines.find((s) => s.axis === "secondary" && s.kind === "line"), lineGrowth = line && growth(line.vals.map((val) => val.v), line.label);
1017
+ line && lineGrowth && items.push({ seriesId: line.id, ...lineGrowth, axis: "secondary", ink: "ink" });
1018
+ let columnGrowth = columns.length > 0 ? growth(cats.map((c, ci) => anyByCat[ci] ? stackTotals[c.id] : null), columns.length === 1 ? columns[0].label : "") : void 0;
1019
+ return columnGrowth && items.push({ seriesId: columns[0].id, ...columnGrowth, axis: "primary", ink: "inkMuted" }), items;
1020
+ }
1021
+ function growthStatements(env, domain) {
1022
+ let { options } = domain, { theme, measure, size } = env, valueFont = { ...{ family: theme.type.family, ...theme.type.label }, weight: emphasisWeight(theme) }, nameFont = valueFont, items = domain.anatomy && options.dualAxis?.growth ? growthItems(domain, options.locale?.language) : [], oneLineW = items.length > 0 ? GROWTH_GAP + maxOf(items.map((item) => measure(growthLine(item), valueFont).width)) : 0, oneLine = items.length > 0 && oneLineW <= size.width * GROWTH_ONE_LINE_SHARE, reserve = items.length === 0 ? 0 : oneLine ? oneLineW : GROWTH_GAP + maxOf(items.flatMap((item) => {
1023
+ let name = item.short;
1024
+ return [measure(item.text, valueFont).width, name ? measure(name, nameFont).width : 0];
1025
+ })), inNote = items.length > 0 && size.width < GROWTH_NOTE_BELOW;
1026
+ if (!inNote) return { items, valueFont, nameFont, reserve, inNote, oneLine };
1027
+ let { cats } = domain, period = items.every((item) => !item.name.includes("\u2013")) && cats.length > 1 ? `, ${cats[0].label ?? cats[0].id}\u2013${cats[cats.length - 1].label ?? cats[cats.length - 1].id}` : "", note = `${items.map((item) => `${item.name} ${item.text}`.trim()).join(", ")}${period}.`;
1028
+ return { items, valueFont, nameFont, reserve, inNote, oneLine, note };
1029
+ }
1030
+ function growthLine(item) {
1031
+ return item.short ? `${item.text} ${item.short}` : item.text;
1032
+ }
1033
+ var STACK_RAMP = [1, 45 / 26, 70 / 26, 100 / 26];
1034
+ function stackTint(tint, count, index) {
1035
+ let fromTop = count - 1 - Math.max(0, index);
1036
+ if (fromTop <= 0) return tint;
1037
+ let alpha = Math.min(1, (1 - tint) * STACK_RAMP[Math.min(fromTop, STACK_RAMP.length - 1)]);
1038
+ return Math.round((1 - alpha) * 100) / 100;
1039
+ }
1040
+ function inkLeadLine(env, s, li) {
1041
+ return env.theme.marks?.comboLine === "ink" && li === 0 && s.kind === "line" && !s.fill && !s.colorRole && !env.highlights.has(s.id) && !env.palette && s.scenario !== "PY";
1042
+ }
1043
+ function comboLineMarkers(env, domain, s) {
1044
+ let shape = s.marker ?? (s.kind === "line" ? "circle" : "none"), anatomyDots = domain.anatomy && s.marker === void 0 && s.kind === "line" && s.axis === "secondary", themeDrops = !anatomyDots && s.marker === void 0 && (env.theme.marks?.lineMarkers === "none" || domain.cats.length > MARKER_MAX_CATS);
1045
+ return { shape, anatomyDots, full: shape !== "none" && !themeDrops };
1046
+ }
1047
+ function comboPaints(env, domain) {
1048
+ let { theme, palette, highlights } = env, { columns, cats } = domain, css = (p) => paintColor(theme, p), columnTint = theme.marks?.comboColumnTint, tinted = (s, scenario) => {
1049
+ if (columnTint === void 0 || palette || s.fill || s.colorRole || scenario === "PY") return;
1050
+ if (scenario === "PL" || scenario === "FC") return { token: "focus" };
1051
+ if (columns.length === 1) return { token: "focus", tint: columnTint };
1052
+ let amount = stackTint(columnTint, columns.length, columns.indexOf(s));
1053
+ return amount > 0 ? { token: "focus", tint: amount } : { token: "focus" };
1054
+ }, receding = recedingSeriesId([...columns, ...domain.lines], highlights), column = (s, colIdx) => {
1055
+ if (s.fill) return { css: s.fill };
1056
+ if (s.colorRole) return markRolePaint(s.colorRole, !0);
1057
+ if (s.id === receding) return mutedMarkPaint();
1058
+ let themed = tinted(s, s.scenario);
1059
+ return themed || (columns.length === 1 ? seriesPaint(colIdx, palette, s.scenario) : seriesPaint(colIdx, palette));
1060
+ }, derived = domain.options[HIGHLIGHT_KEY] !== void 0, cell = (s, val, cat, colIdx) => {
1061
+ if (val.fill) return { css: val.fill };
1062
+ if (highlights.has(cat.id) || highlights.has(s.id)) return derived ? seriesPaint(0, palette) : { token: "focus" };
1063
+ if (derived && !val.scenario && !s.fill && !s.colorRole) return { token: "rest" };
1064
+ if (val.scenario) {
1065
+ let themed = tinted(s, val.scenario);
1066
+ return themed || (columns.length === 1 ? seriesPaint(colIdx, palette, val.scenario) : column(s, colIdx));
1067
+ }
1068
+ return column(s, colIdx);
1069
+ }, pattern = (s, val, cat) => partialPattern(cat, scenarioPattern(s, val)), inside = (s, val, cat, colIdx) => effectiveFill(css(cell(s, val, cat, colIdx)), pattern(s, val, cat), theme), top = (ci, above) => {
1070
+ for (let k = columns.length - 1; k >= 0; k--) {
1071
+ let s = columns[k], val = s.vals[ci];
1072
+ if (val.v !== null && (above ? val.v > 0 : val.v < 0))
1073
+ return { insideFill: inside(s, val, cats[ci], k), insidePaint: cell(s, val, cats[ci], k), insidePattern: pattern(s, val, cats[ci]) };
1074
+ }
1075
+ return { insideFill: paintColor(theme, { token: "neutralMark" }), insidePaint: { token: "neutralMark" } };
1076
+ }, tickHighlight = (domain.options.referenceStyle ?? "tick") === "tick" && domain.options.referenceTick?.color === "highlight", planStyle = (s) => s.kind === "line" ? planLineStyle(s.scenario, theme) : void 0, lineHollow = (s) => planStyle(s) !== void 0;
1077
+ return { edge: (fill, pattern2) => {
1078
+ if (pattern2 || "tint" in fill && fill.tint !== void 0) return {};
1079
+ let outline = segmentSeparationStroke(fill, theme.color.background, theme);
1080
+ return {
1081
+ ...outline ? { stroke: outline.stroke, width: outline.strokeWidth } : {},
1082
+ separation: { fillStep: !0, fill, backing: { token: "background" } }
1083
+ };
1084
+ }, css, column, cell, pattern, inside, top, line: (s, li) => {
1085
+ if (s.fill) return { css: s.fill };
1086
+ if (s.colorRole) return markRolePaint(s.colorRole);
1087
+ if (highlights.has(s.id)) return { token: "focus" };
1088
+ if (s.id === receding) return mutedMarkPaint();
1089
+ let plan = planStyle(s);
1090
+ return plan ? { token: plan.ink } : s.scenario === "PY" ? mutedMarkPaint() : inkLeadLine(env, s, li) ? { token: "markInk" } : palette ? seriesPaint(li, palette) : seriesPaint(columns.length + li);
1091
+ }, lineHollow, lineWidth: (s) => highlights.has(s.id) ? strokeToken(theme, "focus") : planStyle(s)?.width ?? strokeToken(theme, "data"), dash: (s) => {
1092
+ if (s.scenario === "FC") return dashToken(theme, "reference");
1093
+ if (s.lineStyle === "dashed") return dashToken(theme, "reference");
1094
+ if (s.lineStyle === "dotted") return dashToken(theme, "dotted");
1095
+ if (s.scenario === "PL" && !lineHollow(s)) return dashToken(theme, "reference");
1096
+ }, ref: (s) => tickHighlight ? { token: "highlight" } : s.fill ? { css: s.fill } : s.colorRole ? { token: markRoleToken(s.colorRole) } : { token: "ink" } };
1097
+ }
1098
+ function scenarioPattern(s, val) {
1099
+ let sc = val.scenario ?? s.scenario;
1100
+ return sc === "FC" ? "hatch45" : sc === "PL" ? "outline" : void 0;
1101
+ }
1102
+ var HIGHLIGHT_KEY = /* @__PURE__ */ Symbol("highlightKey");
1103
+ function comboLegend(env, domain, paints) {
1104
+ let { theme } = env, { options, columns, lines, refs, cats } = domain, highlightKey = options[HIGHLIGHT_KEY], keyMarker = (s) => {
1105
+ let { shape, full } = comboLineMarkers(env, domain, s);
1106
+ return s.kind === "line" && full && shape !== "none" ? { marker: { shape, ...paints.lineHollow(s) ? { hollow: !0 } : {} } } : {};
1107
+ };
1108
+ if (highlightKey && columns.length > 0)
1109
+ return {
1110
+ options: highlightKey.legend,
1111
+ items: [
1112
+ ...columns.flatMap((s, i) => cats.flatMap((cat, ci) => s.vals[ci].v === null ? [] : [{
1113
+ id: `key:${s.id}:${cat.id}`,
1114
+ label: (Array.isArray(options.highlight) ? options.highlight : [options.highlight]).includes(cat.id) ? highlightKey.highlighted : highlightKey.rest,
1115
+ paint: paints.cell(s, s.vals[ci], cat, i),
1116
+ ...paints.edge(paints.cell(s, s.vals[ci], cat, i), paints.pattern(s, s.vals[ci], cat))
1117
+ }])),
1118
+ ...highlightKey.line === void 0 ? [] : lines.flatMap((s, i) => s.kind !== "line" || s.vals.every((val) => val.v === null) ? [] : [{
1119
+ id: s.id,
1120
+ label: highlightKey.line,
1121
+ paint: paints.line(s, i),
1122
+ key: "line",
1123
+ width: paints.lineWidth(s, i),
1124
+ ...keyMarker(s),
1125
+ ...paints.dash(s) ? { dash: paints.dash(s) } : {}
1126
+ }])
1127
+ ]
1128
+ };
1129
+ let anomalyKeys = domain.anomaly ? anomalyLegendItems(theme, domain.anomaly.model, domain.anomaly.corridorShown, domain.anomaly.statFmt, columnCorridorPaint(options.colorblindSafe), options.strings, options.locale?.language) : [], referenceDrawn = panelTypeClass(options) === void 0 && refs.some((s) => s.vals.some((val) => val.v !== null)), position = (anomalyKeys.length > 0 || referenceDrawn) && options.legend === void 0 ? "top" : options.legend;
1130
+ if (!position || position === "none" || position === "auto") return;
1131
+ let legendOpts = normalizeLegendOption(position), columnItems = columns.map((s, i) => ({
1132
+ id: s.id,
1133
+ label: s.label,
1134
+ paint: paints.column(s, i),
1135
+ pattern: s.scenario === "FC" ? "hatch45" : s.scenario === "PL" ? "outline" : void 0,
1136
+ ...paints.edge(paints.column(s, i), scenarioPattern(s, {}))
1137
+ })), painted = columns.flatMap((s) => s.vals.flatMap((val) => val.v === null || val.v === 0 ? [] : [scenarioPattern(s, val)])), partialHatchPainted = columns.some(
1138
+ (s) => s.vals.some((val, ci) => val.v !== null && val.v !== 0 && paints.pattern(s, val, cats[ci]) !== scenarioPattern(s, val))
1139
+ ), axisKeyed = axisKeyedSeries(domain), undrawn = new Set([...columns, ...lines, ...refs].filter((s) => s.vals.every((val) => val.v === null)).map((s) => s.id)), items = [
1140
+ ...columnItems,
1141
+ ...lines.map((s, i) => ({
1142
+ id: s.id,
1143
+ label: s.label,
1144
+ paint: paints.line(s, i),
1145
+ key: s.kind === "line" ? "line" : "box",
1146
+ ...s.kind === "line" ? { width: paints.lineWidth(s, i) } : {},
1147
+ ...keyMarker(s),
1148
+ ...paints.lineHollow(s) ? { hollow: !0, width: paints.lineWidth(s, i) } : {},
1149
+ ...s.kind === "line" && paints.dash(s) ? { dash: paints.dash(s), lineCap: paints.dash(s)?.join(",") === dashToken(theme, "dotted").join(",") ? "round" : "butt" } : {}
1150
+ })),
1151
+ ...refs.map((s) => ({
1152
+ id: s.id,
1153
+ label: s.label,
1154
+ paint: paints.ref(s),
1155
+ key: "line",
1156
+ ...options.referenceStyle === "line" ? { dash: dashToken(theme, "dotted"), lineCap: "round", width: strokeToken(theme, "rule") } : { width: options.referenceTick?.width ?? strokeToken(theme, "rule") },
1157
+ ...options.referenceStyle === "marker" ? referenceMarkerKey(theme, paints.ref(s)) : {}
1158
+ })),
1159
+ ...scenarioLegendKeys({ markPatterns: painted, keyPatterns: columnItems.map((item) => item.pattern), paint: { token: "neutralMark" }, strings: options.strings }),
1160
+ ...partialLegendKeys(partialHatchPainted && !partialNamedOnTotals(env, domain), options.strings, cats),
1161
+ // A line that turns dashed at its forecast cells keys that dash, 5 on 3 as marks.ts draws it.
1162
+ ...lines.some((s) => s.scenario !== "FC" && s.vals.some((val) => val.v !== null && val.scenario === "FC")) ? [{ id: "__scenarioFCLine", label: options.strings.forecast, paint: { token: "neutralMark" }, key: "line", width: strokeToken(theme, "data"), dash: dashToken(theme, "reference") }] : [],
1163
+ ...anomalyKeys
1164
+ ].filter((item) => !axisKeyed.has(item.id) && !undrawn.has(item.id)), fcLine = items.find((item) => item.id === "__scenarioFCLine"), fcBox = items.find((item) => item.id === "__scenarioFC");
1165
+ if (fcLine && fcBox && (items = items.flatMap((item) => item === fcLine ? [] : item === fcBox ? [{ ...fcBox, withLine: { paint: fcLine.paint, dash: fcLine.dash, width: fcLine.width, lineCap: fcLine.lineCap } }] : [item])), items.length !== 0) {
1166
+ if (legendOpts.order) {
1167
+ let oi = (id) => {
1168
+ let k = legendOpts.order.indexOf(id);
1169
+ return k === -1 ? Number.MAX_SAFE_INTEGER : k;
1170
+ };
1171
+ items = [...items].sort((a, b) => oi(a.id) - oi(b.id));
1172
+ }
1173
+ return { options: legendOpts, items };
1174
+ }
1175
+ }
1176
+ function axisKeyedSeries(domain) {
1177
+ let keyed = /* @__PURE__ */ new Set(), highlightKeyed = domain.options[HIGHLIGHT_KEY] !== void 0;
1178
+ if (!domain.secondaryActive || kindSetting(domain, "axisTitle") === !1) return keyed;
1179
+ let active = { primary: domain.showPrimaryAxis || domain.ticksFromLabels === !0, secondary: domain.rightTicks.length > 0 || domain.secondaryTicksHidden };
1180
+ for (let side of ["primary", "secondary"]) {
1181
+ if (!active[side] || !domain.options.axisTitles?.[side]) continue;
1182
+ let series = domain.data.filter((s) => s.axis === side);
1183
+ series.length === 1 && !(highlightKeyed && series[0].kind === "column") && keyed.add(series[0].id);
1184
+ }
1185
+ return keyed;
1186
+ }
1187
+ function comboFrameMargins(env, domain) {
1188
+ let { theme, size, measure } = env, { options, dLo, dHi, fmt, secondaryActive } = domain, leftAxisReserve = domain.showPrimaryAxis ? measureValueAxisWidth([dLo, dHi], fmt, theme, measure, 5, domain.valueSpec) : 0, margin = { ...canvasMargin(theme, size.width), ...options.margin }, axisFont = { family: theme.type.family, ...theme.type.axis }, categoryWidth = Math.max(0, maxOf(domain.cats.map((c) => measure(c.label ?? c.id, axisFont).width))) + 4;
1189
+ if (domain.cats.length > 0 && categoryWidth > (size.width - margin.left - margin.right - leftAxisReserve) / domain.cats.length) {
1190
+ let gutter = measure("0", axisFont).height;
1191
+ options.margin?.left === void 0 && (margin.left = Math.min(margin.left, gutter)), options.margin?.right === void 0 && (margin.right = Math.min(margin.right, gutter));
1192
+ }
1193
+ let leftLineLabelW = Math.max(
1194
+ 0,
1195
+ maxOf((options.annotations ?? []).flatMap(
1196
+ (a) => a.kind === "valueLine" && a.side === "left" && typeof a.label == "string" && a.label && (a.axis !== "secondary" || secondaryActive && a.value !== "mean" && a.value !== void 0) ? [measure(a.label, { family: theme.type.family, ...theme.type.label }).width] : []
1197
+ ))
1198
+ );
1199
+ return margin.left += leftLineLabelW > 0 ? Math.max(0, leftLineLabelW + 4 - leftAxisReserve) : 0, { margin, leftAxisReserve };
1200
+ }
1201
+ function refitComboFrame(env, before, domain, framed) {
1202
+ let next = comboFrameMargins(env, domain);
1203
+ if (!(["left", "right", "top", "bottom"].some((side) => next.margin[side] !== framed.margin[side]) || before.anomaly?.corridorNote !== domain.anomaly?.corridorNote || before.anomaly?.corridorShown.low !== domain.anomaly?.corridorShown.low || before.anomaly?.corridorShown.high !== domain.anomaly?.corridorShown.high || before.rightTicks.length > 0 != domain.rightTicks.length > 0))
1204
+ return { ...framed, ...next };
1205
+ }
1206
+ function solveComboFrame(env, domain, paints, warnings, eventKey) {
1207
+ let { theme, size, measure } = env, { options } = domain;
1208
+ domain.anomaly && options.legend === "none" && warnings.push({
1209
+ code: "legend-suppressed-encoding",
1210
+ severity: "warn",
1211
+ message: "legend: 'none' suppressed the only key naming this exhibit's encodings (the anomaly corridor and flag marker) \u2014 the reader is left to infer them",
1212
+ suggest: "drop legend: 'none', or drop anomaly"
1213
+ });
1214
+ let { margin, leftAxisReserve } = comboFrameMargins(env, domain), claims = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), legend = comboLegend(env, domain, paints), growthNote = growthStatements(env, domain).note, frameOptions = options[CATEGORY_ROW_FROM_END] === !1 ? options : withCategoryNoteNames(options, domain.cats);
1215
+ return { frame: solveFrame(
1216
+ {
1217
+ size,
1218
+ margin,
1219
+ ...frameTextOptions(frameOptions),
1220
+ // The subtitle names the unit only when every plotted series is in it ("in $m" beside a series in k).
1221
+ ...options.unit && domain.data.some((s) => s.unit !== void 0 && !sameUnit(s.unit, options.unit)) ? { subtitle: resolveSubtitle(options.subtitle), unit: void 0 } : {},
1222
+ footnotes: [
1223
+ ...partialFootnotes(domain.cats, options.strings, legend?.items.some((item) => item.id === "__partial") || partialNamedOnTotals(env, domain)),
1224
+ ...authoredNotes(frameOptions),
1225
+ ...noteLine(knownPartsLead(options), domain.columnsAdd ? domain.cats.flatMap((c, ci) => {
1226
+ if (!domain.incompleteCats.has(c.id)) return [];
1227
+ let missing = domain.columns.filter((s) => s.vals[ci].v === null).map((s) => s.label);
1228
+ return [`${c.label ?? c.id} ${options.strings.without} ${missing.join(` ${options.strings.and} `)}`];
1229
+ }) : [], options.notes?.maxListed === void 0 ? void 0 : options),
1230
+ // The anomaly rule, stated on the exhibit (column prints it over the plot).
1231
+ ...domain.anomaly ? [disclosureNote(`${domain.anomaly.model.rule}${domain.anomaly.corridorNote}`)] : [],
1232
+ // The growth statements on a card, where the column beside the plot would cost it the width.
1233
+ ...growthNote === void 0 ? [] : [growthNote],
1234
+ // Two scales without tick columns: the note says each series reads on its own.
1235
+ ...domain.secondaryActive && domain.ticksFromLabels === !0 ? [disclosureNote(chartString2(options, "comboOwnScale"))] : []
1236
+ ],
1237
+ legend,
1238
+ ...eventKey ? { eventKey } : {},
1239
+ theme,
1240
+ measure
1241
+ },
1242
+ claims
1243
+ ), claims, leftAxisReserve, margin };
1244
+ }
1245
+ function contentOf(domain, kind, dflt) {
1246
+ let s = kindSetting(domain, kind);
1247
+ return s === !1 ? null : Array.isArray(s) ? s : dflt;
1248
+ }
1249
+ function toDateOnTotals(env, domain) {
1250
+ let ids = /* @__PURE__ */ new Set();
1251
+ if (partialKeyForced(domain.options)) return ids;
1252
+ let toDateWords = domain.options.strings?.toDate ?? chartString2(domain.options, "toDate");
1253
+ if (!toDateFits(toDateWords, env.theme, env.measure, env.size.width / Math.max(1, domain.cats.length))) return ids;
1254
+ let segments = domain.columns.length > 1 && contentOf(domain, "segment", ["absolute"]) !== null;
1255
+ return domain.columns.length === 0 || !domain.columnsAdd || segments || domain.anatomy || !contentOf(domain, "grandTotal", ["absolute"])?.includes("absolute") || domain.cats.forEach((c, ci) => {
1256
+ if (c.partial !== !0 || !domain.anyByCat[ci] || saysToDate(c.label ?? c.id, toDateWords)) return;
1257
+ let populated = domain.columns.filter((column) => column.vals[ci].v !== null), override = populated.length === 1 ? populated[0].vals[ci].labelOverride : void 0;
1258
+ override === !1 || typeof override == "string" && override.trim() === "" || ids.add(c.id);
1259
+ }), ids;
1260
+ }
1261
+ function partialNamedOnTotals(env, domain) {
1262
+ let named = toDateOnTotals(env, domain), drawn = (ci) => domain.anyByCat[ci] || domain.lines.some((s) => s.vals[ci].v !== null);
1263
+ return named.size > 0 && domain.cats.every((c, ci) => c.partial !== !0 || !drawn(ci) || named.has(c.id));
1264
+ }
1265
+ function kindSetting(domain, kind) {
1266
+ let l = domain.options.labels;
1267
+ if (l === !1) return kind === "axisTitle" || kind === "category" && labelsOffKeepsNames(domain.options);
1268
+ let v = l?.[kind];
1269
+ return v === void 0 ? !0 : v;
1270
+ }
1271
+ function composeLines(domain, content, value, catLabel, serLabel, serFmt) {
1272
+ let { abs, isPct, share } = value, explicit = value.format ? formatterFromExample(value.format, domain.options.locale?.language) : void 0, parts = [];
1273
+ for (let c of content)
1274
+ c === "absolute" && abs !== null ? parts.push([c, explicit ? explicit(abs) : isPct ? domain.pctFmt(abs) : serFmt(abs)]) : c === "percent" && abs !== null && isPct ? parts.push([c, explicit ? explicit(abs) : domain.pctFmt(abs)]) : c === "percent" && share !== void 0 && share !== null ? parts.push([c, value.shareText ?? formatShare(share, domain.options.locale?.language)]) : c === "category" && catLabel ? parts.push([c, catLabel]) : c === "series" && serLabel && parts.push([c, serLabel]);
1275
+ return valueShareLines(parts);
1276
+ }
1277
+ function composeText(...args) {
1278
+ return composeLines(...args).join(" ");
1279
+ }
1280
+ function comboPlotArea(env, domain, paints, framed, gutterOverride, warnings) {
1281
+ let { theme, measure, highlights, size } = env, { frame, leftAxisReserve } = framed, { options, cats, columns, lines, showPrimaryAxis, rightTicks } = domain, rightAxisActive = rightTicks.length > 0, tickFont = { family: theme.type.family, ...theme.type.axis }, labelFont = { family: theme.type.family, ...theme.type.label }, strongFont = { family: theme.type.family, ...theme.type.label, weight: emphasisWeight(theme) }, gtH = measure("0", strongFont).height, gtContent = columns.length > 0 && domain.columnsAdd ? contentOf(domain, "grandTotal", ["absolute"]) : null, tallest = Math.max(0, maxOf(domain.posTop)), estPlotH = frame.plot.h - 8 - 4 * gtH, totalsAirInScale = domain.dHi > domain.dLo && tallest > 0 && (domain.dHi - tallest) / (domain.dHi - domain.dLo) * estPlotH >= gtH + 6 + 4 && frame.plot.w / Math.max(1, cats.length) * 0.6 >= Math.max(0, maxOf(cats.map((c) => measure(composeText(
1282
+ domain,
1283
+ gtContent ?? ["absolute"],
1284
+ { abs: domain.stackTotals[c.id] ?? 0, isPct: !1, format: domain.options.format },
1285
+ c.label ?? c.id,
1286
+ "",
1287
+ domain.fmt
1288
+ ), strongFont).width))) + 8, totalsRow = gtContent && !(domain.anatomy && columns.length === 1) && !totalsAirInScale ? gtH + 6 : 0, columnTitlePaint = (paint) => "tint" in paint && paint.tint !== void 0 ? { token: "ink" } : paint, titles = { ...domain.options.axisTitles };
1289
+ if (domain.secondaryActive) for (let side of ["primary", "secondary"]) {
1290
+ let group = domain.data.filter((s) => s.axis === side), units = new Set(group.map((s) => s.unit).filter(Boolean)), unit = side === "primary" ? options.unit ?? (units.size === 1 ? [...units][0] : void 0) : units.size === 1 ? [...units][0] : void 0;
1291
+ unit && !textCarriesUnit(titles[side] ?? "", unit) && (titles[side] = titles[side] ? `${titles[side]}, ${unit}` : unit);
1292
+ }
1293
+ let axisTitles = planComboAxisTitles({
1294
+ series: domain.data,
1295
+ titles,
1296
+ active: {
1297
+ primary: (showPrimaryAxis || domain.ticksFromLabels === !0) && kindSetting(domain, "axisTitle") !== !1,
1298
+ secondary: (rightAxisActive || domain.secondaryTicksHidden) && kindSetting(domain, "axisTitle") !== !1
1299
+ },
1300
+ // The anatomy titles its axes in the axis face at 500, as line,
1301
+ // column and bar do; the plain dual axis keeps the label face.
1302
+ frame: frame.plot,
1303
+ font: domain.anatomy ? secondaryFont(theme) : labelFont,
1304
+ ...domain.anatomy ? { typeRole: "secondary" } : {},
1305
+ measure,
1306
+ below: totalsRow,
1307
+ tickHalf: domain.ticksFromLabels ? 0 : measure("0", tickFont).height / 2,
1308
+ // With no tick column to stand over, the titles key their series in one row from the left.
1309
+ ...domain.ticksFromLabels ? { row: !0 } : {},
1310
+ paintOf: (s) => s.kind === "column" ? highlights.has(s.id) ? { token: "focus" } : columnTitlePaint(paints.column(s, columns.indexOf(s))) : paints.line(s, lines.indexOf(s)),
1311
+ ...domain.anatomy || axisKeyedSeries(domain).size > 0 ? {
1312
+ swatchOf: (s) => !domain.anatomy && !axisKeyedSeries(domain).has(s.id) ? void 0 : s.kind === "line" ? {
1313
+ kind: "line",
1314
+ paint: paints.line(s, lines.indexOf(s)),
1315
+ width: paints.lineWidth(s, lines.indexOf(s)),
1316
+ dash: paints.dash(s),
1317
+ lineCap: paints.dash(s)?.join(",") === dashToken(theme, "dotted").join(",") ? "round" : "butt",
1318
+ ...paints.lineHollow(s) ? { hollow: !0 } : {}
1319
+ } : { kind: "box", paint: s.kind === "column" && highlights.has(s.id) ? { token: "focus" } : s.kind === "column" ? paints.column(s, columns.indexOf(s)) : paints.line(s, lines.indexOf(s)) }
1320
+ } : {}
1321
+ });
1322
+ pushAll(warnings, axisTitles.warnings);
1323
+ let hasCagr = (domain.options.annotations ?? []).some((a) => a.kind === "cagr"), forecast = comboForecastBoundaries(domain), forecastRow = forecast.length > 0 ? measure(options.strings.forecastHeader, secondaryFont(theme)).height + 8 : 0, stair = staircaseOn(options.categoryLabels, options) && columns.length > 0 && kindSetting(domain, "category") !== !1 && cats.length > 1, cagrRoom = Math.max(16, 39 - axisTitles.height), topPad = 8 + axisTitles.height + forecastRow + totalsRow + (hasCagr ? cagrRoom : 0) + (stair ? staircaseState(options).pad : 0);
1324
+ hasCagr && cagrRoom < 30 && recordFreedChrome(frame.frame, "cagr-headroom", 30 - cagrRoom);
1325
+ let pointContent = contentOf(domain, "point", ["absolute"]), valueLabels = comboValueLabels(options, domain.anatomy, domain.cats.length), texts = prepareComboEndpointTexts(
1326
+ lines,
1327
+ (series, ci) => {
1328
+ let value = series.vals[ci];
1329
+ return composeText(
1330
+ domain,
1331
+ pointContent ?? ["absolute"],
1332
+ { abs: value.v, isPct: value.isPct, format: domain.explicitFormatOf(series, value) },
1333
+ cats[ci].label ?? cats[ci].id,
1334
+ series.label,
1335
+ series.format ? env.byExample(series.format) : domain.scaleFmtOf(series)
1336
+ );
1337
+ },
1338
+ {
1339
+ first: (s) => pointContent !== null && (["ends", "extremes", "all"].includes(valueLabels) || options.valueLabels === void 0 && domain.secondaryActive && s.axis === "secondary"),
1340
+ last: pointContent !== null && valueLabels !== "none"
1341
+ }
1342
+ ), rightAxisReserve = rightAxisActive ? Math.max(maxOf(rightTicks.map((tick) => measure(tick.text, secondaryFont(theme)).width)), 1) + 10 : 0, growthPlan = growthStatements(env, domain), growthList = growthPlan.inNote ? [] : growthPlan.items, { valueFont: growthValueFont, nameFont: growthNameFont } = growthPlan, growthReserve = growthList.length > 0 ? growthPlan.reserve : 0, axisW = showPrimaryAxis ? Math.max(10, frame.plot.w - leftAxisReserve) : frame.plot.w, sharesOnColumns = domain.options[FIRST_END_BELOW_TOTALS] === !0, gutters = gutterOverride ?? endpointGutters({
1343
+ // A combo line end stays inside the plot; Pareto's share curve keeps its gutter.
1344
+ first: new Map([...texts.first].filter(([id]) => sharesOnColumns || lines.find((s) => s.id === id)?.kind !== "line")),
1345
+ last: new Map([...texts.last].filter(([id]) => sharesOnColumns || lines.find((s) => s.id === id)?.kind !== "line")),
1346
+ count: cats.length,
1347
+ font: labelFont,
1348
+ measure,
1349
+ markerR: 2.75,
1350
+ width: axisW - rightAxisReserve - growthReserve,
1351
+ adjacent: { first: showPrimaryAxis, last: rightAxisActive }
1352
+ }), anomalyReserve = domain.anomaly ? anomalyRuleReserve(anomalyRuleLines(theme, domain.anomaly.model, domain.anomaly.corridorShown, domain.anomaly.statFmt, { token: "warn" }, options.strings), labelFont, measure) : 0, valueLineFont = { ...labelFont, weight: emphasisWeight(theme) }, rightLineLabels = (domain.options.annotations ?? []).filter((a) => a.kind !== "event").flatMap((annotation, index) => {
1353
+ if (annotation.kind !== "valueLine" || annotation.label === !1 || (annotation.side ?? "right") !== "right") return [];
1354
+ let value = typeof annotation.value == "number" ? annotation.value : domain.columnsAdd ? domain.sourceMean ?? (columns.length > 0 && cats.length > 0 ? cats.reduce((sum, _, ci) => sum + domain.posTop[ci] + domain.negBot[ci], 0) / cats.length : primaryLineMean(domain.lines.map((s) => ({ s, pts: [] })), domain.secondaryActive)) : void 0;
1355
+ if (value === void 0) return [];
1356
+ let example = annotation.format ?? domain.options.format, fmt = example ? formatterFromExample(example, domain.options.locale?.language) : (v) => formatAutomaticNumber(v, { locale: domain.options.locale?.language, decimals: autoDecimals(v), signed: !1 }), span = domain.meanSpan({ from: annotation.from, to: annotation.to }), text = typeof annotation.label == "string" ? namedLineText(annotation.label, fmt(value), value, annotation.id ?? "") : `${options.strings.average} ${fmt(value)}${span ? ` (${span})` : ""}`;
1357
+ return [{
1358
+ id: defaultAnnotationId(annotation, index),
1359
+ text,
1360
+ width: measure(text, valueLineFont).width + 8,
1361
+ mean: annotation.value === "mean" || annotation.value === void 0 || annotation.id === domain.averageMarkerId
1362
+ }];
1363
+ }), lineBudget = Math.max(0, axisW - rightAxisReserve - growthReserve - anomalyReserve - gutters.first - gutters.last) / 2, valueLineRows = /* @__PURE__ */ new Map(), rowY = frame.plot.y + axisTitles.height + forecastRow + 8;
1364
+ for (let line of rightLineLabels.filter((line2) => line2.mean && line2.width > lineBudget)) {
1365
+ let lines2 = wrapText(line.text, valueLineFont, frame.plot.w, Math.max(1, line.text.length), measure).lines, h = measure("0", valueLineFont).height * lines2.length;
1366
+ valueLineRows.set(line.id, { x: frame.plot.x, y: rowY, w: frame.plot.w, h }), rowY += h + 8, topPad += h + 8;
1367
+ }
1368
+ let lineLabelReserve = options[VALUE_LINE_RESERVE] ?? 0, rightReserve = rightAxisReserve + Math.max(gutters.last + growthReserve + anomalyReserve, lineLabelReserve), plotX0 = frame.plot.x + (showPrimaryAxis ? leftAxisReserve : 0) + gutters.first, plotW0 = Math.max(10, axisW - rightReserve - gutters.first), endpointWidth = plotW0, insideIds = options[INSIDE_ENDPOINT_IDS], inside = insideEndpointGutters({
1369
+ ids: insideIds,
1370
+ first: texts.first,
1371
+ last: texts.last,
1372
+ cats,
1373
+ width: endpointWidth,
1374
+ font: labelFont,
1375
+ measure,
1376
+ markerR: 2.75
1377
+ }), bandFraction = comboBandFraction(domain.options, cats.length), bandFor = (x0, w) => bandScale(cats.length, [x0 + inside.first, x0 + w - inside.last], { paddingInner: 1 - bandFraction, paddingOuter: (1 - bandFraction) / 2 + 0.05 });
1378
+ if (stair) {
1379
+ let direction = staircaseDirection(domain.posTop), room = staircaseRoom({
1380
+ names: cats.map((c) => c.label ?? c.id),
1381
+ font: tickFont,
1382
+ measure,
1383
+ direction,
1384
+ edge: direction === "right" ? plotX0 + plotW0 : plotX0,
1385
+ width: plotW0,
1386
+ centers: (r) => {
1387
+ let b = bandFor(direction === "right" ? plotX0 : plotX0 + r, plotW0 - r);
1388
+ return cats.map((_, ci) => b.center(ci));
1389
+ }
1390
+ });
1391
+ direction === "left" && (plotX0 += room), plotW0 -= room;
1392
+ }
1393
+ let band = bandFor(plotX0, plotW0), categoryNames = cats.map((category) => category.label ?? category.id), periodRow = cats.some((category) => category.calendar) || isDateNumericTickSequence(categoryNames) || calendarLike(categoryNames) || categoryNames.every((label) => /^[MWT]\d+$/i.test(label)), planRow = (b, ticked2) => {
1394
+ let row = categoryLabelsAndMarks(cats, { count: authoredFootnoteCount(options), warnings }, partialAxisWords(options.strings, options, frame.legend?.items.some((item) => item.id === "__partial") || partialNamedOnTotals(env, domain)));
1395
+ return ticked2?.name(row), withCategoryRanks(planCategoryRow({
1396
+ rotate: !cats.every((c) => MONTH_START.exec((c.label ?? c.id).trim())?.[0] === (c.label ?? c.id).trim()),
1397
+ target: options.target,
1398
+ textScale: textScaleOf(options),
1399
+ ...row,
1400
+ // A ranked row (pareto) is not a timeline: its dates are not a calendar tick row.
1401
+ ...options[CATEGORY_ROW_FROM_END] === !1 ? { dates: void 0 } : { reference: { x: frame.plot.x, width: frame.plot.w } },
1402
+ strideFromEnd: periodRow && options[CATEGORY_ROW_FROM_END] !== !1,
1403
+ rotate90: options[CATEGORY_ROW_VERTICAL] === !0,
1404
+ centers: cats.map((_, ci) => b.center(ci)),
1405
+ step: b.step,
1406
+ fonts: [tickFont, { ...tickFont, size: tickFont.size - scaleTextPx(1, textScaleOf(options)) }, { family: theme.type.family, ...theme.type.footnote }],
1407
+ secondary: secondaryFont(theme),
1408
+ periods: periodRow,
1409
+ padding: 4,
1410
+ measure,
1411
+ plotHeight: frame.plot.h,
1412
+ // A name the rotated row cuts takes the next note number after the author's.
1413
+ // A cut name takes a note mark only where its note prints.
1414
+ // Without the rank key, nominal names keep one name per column (rotate, then ellipsis).
1415
+ // Under notes.show 'ranks' alone a cut name takes no mark, since its note does not print.
1416
+ ...disclosuresShown(options) ? { cutMarkFrom: authoredFootnoteCount(options) + 1 } : rankKeyShown(options) ? {} : { everyName: !0 },
1417
+ ...ticked2?.plan
1418
+ }), measure, cats.map((c) => c.label ?? c.id), options[FORCE_CATEGORY_RANKS] === !0, rankKeyShown(options));
1419
+ }, catPlan = planRow(band), ticked = options[CATEGORY_ROW_FROM_END] === !1 ? void 0 : longDayMonths(cats, catPlan.stride, options.locale?.language);
1420
+ ticked && (catPlan = planRow(band, ticked));
1421
+ let catOverhang = stair ? 0 : rotatedLeftOverhang(catPlan, cats.map((_, ci) => band.center(ci)), 4);
1422
+ catOverhang > 0 && (plotX0 += catOverhang, plotW0 -= catOverhang, band = bandFor(plotX0, plotW0), catPlan = planRow(band, ticked));
1423
+ let showCatTickRow = kindSetting(domain, "category") !== !1 && cats.length > 0 && !stair;
1424
+ showCatTickRow && (pushAll(warnings, catPlan.warnings), catPlan.step === "ranks" && warnings.push(categoryRanksLint(cats.map((c) => c.label ?? c.id), band.step)));
1425
+ let catBandH = showCatTickRow ? catPlan.rowHeight + 8 : 0, hangingRoom = showCatTickRow && domain.options.labels !== !1 ? Math.max(measure("0", labelFont).height, gtH) + 4 : 0, lowest = Math.min(0, minOf(domain.negBot)), hangingEnd = Math.min(0, minOf(domain.negBot.map((bottom, ci) => domain.posTop[ci] <= 0 ? bottom : 0))), rawBandPad = options[BAND_PAD] ?? 0, baseTopPad = topPad, plotH0NoBand = frame.plot.h - catBandH - baseTopPad, hangingReserveNoBand = hangingLabelReserve(plotH0NoBand, [domain.dLo, domain.dHi], hangingEnd, hangingRoom), minRawH = Math.max(10, options.mode === "compact" ? 80 : 0), bandPad = rawBandPad > 0 ? Math.max(0, Math.min(rawBandPad, Math.floor(plotH0NoBand - hangingReserveNoBand - minRawH))) : 0;
1426
+ for (; bandPad > 0 && frame.plot.h - catBandH - (baseTopPad + bandPad) - hangingLabelReserve(frame.plot.h - catBandH - (baseTopPad + bandPad), [domain.dLo, domain.dHi], hangingEnd, hangingRoom) < minRawH; )
1427
+ bandPad--;
1428
+ topPad = baseTopPad + bandPad;
1429
+ let plotH0 = frame.plot.h - catBandH - topPad, hangingReserve = hangingLabelReserve(plotH0, [domain.dLo, domain.dHi], hangingEnd, hangingRoom), plot = {
1430
+ x: frame.plot.x + gutters.first,
1431
+ y: frame.plot.y + topPad,
1432
+ w: Math.max(10, frame.plot.w - gutters.first),
1433
+ h: plotHeightAfter(frame, size.height, plotH0 - hangingReserve)
1434
+ }, minPlot = plotFloorRows(options) * measure("0", labelFont).height + 8;
1435
+ frame.frame.plotMinHeight = Math.max(frame.frame.plotMinHeight ?? 0, size.height + (frame.deficit ?? 0) + minPlot - (plotH0NoBand - hangingReserveNoBand)), showPrimaryAxis && (plot.x += leftAxisReserve, plot.w = Math.max(10, plot.w - leftAxisReserve)), plot.w = Math.max(10, plot.w - rightReserve);
1436
+ let { dLo, dHi, pticks, secondaryDomain } = domain, secondaryRange = secondaryDomain ? secondaryPrimaryRange(options, secondaryDomain, pticks) : void 0, endpointAir = columns.length === 0 || !(dHi > dLo) || sharesOnColumns ? 0 : Math.max(
1437
+ 0,
1438
+ maxOf([...texts.first, ...texts.last].flatMap(([id, end]) => {
1439
+ let series = lines.find((s) => s.id === id);
1440
+ if (series?.kind !== "line" || end.suppressed) return [];
1441
+ let raw = series.vals[end.ci].v ?? dLo, lower = secondaryRange?.[0] ?? pticks[0], upper = secondaryRange?.[1] ?? pticks[pticks.length - 1], plotted = series.axis === "secondary" && secondaryDomain && secondaryDomain[1] > secondaryDomain[0] ? lower + (raw - secondaryDomain[0]) / (secondaryDomain[1] - secondaryDomain[0]) * (upper - lower) : raw, value = Math.max(plotted, domain.posTop[end.ci]), share = Math.max(0, Math.min(1, (dHi - value) / (dHi - dLo))), room = measure(end.text, labelFont).height + 2.75 + 4;
1442
+ return share < 1 ? [Math.ceil((room - share * plot.h) / (1 - share))] : [];
1443
+ }))
1444
+ ), y = linearScale([dLo, dHi], [plot.y + plot.h, plot.y + Math.min(endpointAir, plot.h / 3)]), dateNumericTicks = catPlan.dateNumeric || isDateNumericTickSequence(cats.map((c) => c.label ?? c.id));
1445
+ return {
1446
+ frame,
1447
+ leftAxisReserve,
1448
+ rightAxisReserve,
1449
+ axisTitles,
1450
+ topPad,
1451
+ tickFont,
1452
+ labelFont,
1453
+ strongFont,
1454
+ gtH,
1455
+ valueLineRows,
1456
+ first: texts.first,
1457
+ last: texts.last,
1458
+ gutters,
1459
+ endpointWidth,
1460
+ band,
1461
+ catPlan,
1462
+ dateNumericTicks,
1463
+ // A date row stays at the plot's bottom band; prose reads under the
1464
+ // lowest column and the value or total hanging under it.
1465
+ catRowY: dateNumericTicks ? plot.y + plot.h + hangingReserve : categoryRowTop(y, lowest, hangingEnd, hangingRoom),
1466
+ showCatTickRow,
1467
+ catBandH,
1468
+ plot,
1469
+ // The names may rise to the frame top, under the axis titles.
1470
+ ...stair ? { stairTop: frame.plot.y + axisTitles.height } : {},
1471
+ rightTickX: plot.x + plot.w + RIGHT_TICK_GAP,
1472
+ anomalyLabelX: plot.x + plot.w + rightAxisReserve + gutters.last + growthReserve + 4,
1473
+ y,
1474
+ y0: y(0),
1475
+ y2: secondaryDomain ? linearScale(secondaryDomain, [y(secondaryRange[0]), y(secondaryRange[1])]) : y,
1476
+ ...growthList.length > 0 ? {
1477
+ growth: {
1478
+ x: plot.x + plot.w + rightAxisReserve + GROWTH_GAP - 2,
1479
+ valueFont: growthValueFont,
1480
+ nameFont: growthNameFont,
1481
+ oneLine: growthPlan.oneLine,
1482
+ // Each statement takes its series' text twin: the line's ink, or the single column's.
1483
+ items: growthList.map((item) => {
1484
+ let line = lines.find((s) => s.id === item.seriesId), paint = line ? paints.line(line, lines.indexOf(line)) : columns.length === 1 ? paints.column(columns[0], 0) : void 0;
1485
+ return paint ? { ...item, textPaint: seriesTextPaint(paint) } : item;
1486
+ })
1487
+ }
1488
+ } : {},
1489
+ forecast,
1490
+ forecastHeaderY: plot.y - totalsRow - forecastRow
1491
+ };
1492
+ }
1493
+ function comboForecastBoundaries(domain) {
1494
+ let starts = /* @__PURE__ */ new Map();
1495
+ for (let s of domain.data) {
1496
+ if (s.scenario === "FC") continue;
1497
+ let start = s.vals.findIndex((val) => val.v !== null && val.scenario === "FC");
1498
+ if (start > 0 && s.vals.slice(0, start).some((val) => val.v !== null)) {
1499
+ let actual = start - 1;
1500
+ if (s.kind === "line" || s.kind === "area") for (; actual > 0 && s.vals[actual].v === null; ) actual--;
1501
+ starts.set(`${actual}:${start}`, { categoryIndex: start, lastActualIndex: actual });
1502
+ }
1503
+ }
1504
+ let transitions = [...starts.values()].sort((a, b) => a.categoryIndex + a.lastActualIndex - b.categoryIndex - b.lastActualIndex), usedIds = new Set(domain.cats.map((category) => category.id));
1505
+ return transitions.map(({ categoryIndex, lastActualIndex }) => {
1506
+ let categoryId = domain.cats[categoryIndex].id, id = categoryId;
1507
+ if (transitions.filter((item) => item.categoryIndex === categoryIndex).length > 1) {
1508
+ for (id = `${categoryId}:from:${lastActualIndex}`; usedIds.has(id); ) id += ":2";
1509
+ usedIds.add(id);
1510
+ }
1511
+ return { categoryIndex, categoryId, id, lastActualIndex, labelled: !1, divided: !1 };
1512
+ });
1513
+ }
1514
+
1515
+ // src/core/charts/combo/labels.ts
1516
+ function comboStrokes(geometry) {
1517
+ return geometry.plans.flatMap((plan) => plan.runs.filter((run) => run.length > 1).map((run) => drawnStroke(run, plan.interpolation)));
1518
+ }
1519
+ var STROKE_CLEAR2 = 1.5 + 2, SHIFTED_TOTAL_GAP = 6, ABOVE_POINT_GAP = 5, SLIVER_MIN_H = 8;
1520
+ function segmentLabels(env, domain, area, geometry, paints, requests, warnings) {
1521
+ if (domain.columns.length < 2) return;
1522
+ let content = contentOf(domain, "segment", ["absolute"]);
1523
+ if (!content) return;
1524
+ let totalValueAlone = domain.columnsAdd && contentOf(domain, "grandTotal", ["absolute"])?.join() === "absolute", { labelFont, band, y0 } = area, shareAsked = content.includes("percent"), mixedSigns = [], unavailable = [], shareBasis = domain.cats.map((c, ci) => {
1525
+ if (!shareAsked || !domain.anyByCat[ci]) return 0;
1526
+ let name = c.label ?? c.id;
1527
+ if (domain.negBot[ci] < 0) mixedSigns.push(name);
1528
+ else if (domain.posTop[ci] <= 0 || isIncomplete(domain.columns.map((s) => s.vals[ci].v))) unavailable.push(name);
1529
+ else return domain.posTop[ci];
1530
+ return 0;
1531
+ });
1532
+ warnShareParts(warnings, mixedSigns, unavailable);
1533
+ let tooWide = !1, first = requests.length;
1534
+ for (let { s, si, ci, v, rect } of geometry.segments) {
1535
+ let c = domain.cats[ci], val = s.vals[ci], serFmt = s.format ? env.byExample(s.format) : domain.scaleFmtOf(s), share = shareBasis[ci] > 0 ? v / shareBasis[ci] * 100 : null, lines = composeLines(domain, content, { abs: v, isPct: val.isPct, share, shareText: domain.shareTexts.get(`${c.id}\0${s.id}`), format: val.format ?? s.format ?? domain.options.format }, c.label ?? c.id, s.label, serFmt), text = lines.join(" "), single = v !== 0 && onePartDrawn(domain.columns.map((column) => column.vals[ci].v)), printed = val.isPct || share !== null ? content : content.filter((part) => part !== "percent");
1536
+ if (typeof val.labelOverride == "string" && (text = val.labelOverride.replace(/\$\{value\}/g, text), lines = [text]), !text && val.labelOverride !== !1) continue;
1537
+ let tsize = linesSize(lines, labelFont, env.measure), fits = tsize.height + 2 <= rect.h && tsize.width + 4 <= band.bandwidth, sliver = env.density !== "full" && rect.h < SLIVER_MIN_H, hl = env.highlights.has(c.id) || env.highlights.has(s.id), priority = val.priority ?? PRIORITY.interior + Math.min(99, Math.abs(v)) + (hl ? PRIORITY.highlightBonus : 0);
1538
+ typeof val.labelOverride != "string" && val.labelOverride !== !1 && !sliver && !single && env.density !== "full" && tsize.width > rect.w && (tooWide = !0), requests.push({
1539
+ id: `segment:${s.id}:${c.id}`,
1540
+ kind: "segment",
1541
+ ...namesOnly(printed, val.labelOverride),
1542
+ // A label that prints more than the value (a name, a share) keeps its seat. An authored text
1543
+ // yields only to a total that carries it: one that prints the value alone, for this column's cell.
1544
+ ...single && printed.length === 1 && printed[0] === "absolute" && (typeof val.labelOverride != "string" || totalValueAlone && totalColumn(domain, ci) === s) ? { printedIn: `grandTotal:${c.id}` } : {},
1545
+ owner: { seriesId: s.id, categoryId: c.id },
1546
+ text,
1547
+ lines,
1548
+ ...lines.length > 1 ? { align: "middle" } : {},
1549
+ typeRole: "label",
1550
+ font: labelFont,
1551
+ priority,
1552
+ redundant: val.labelOverride === !1 || sliver,
1553
+ // A value prints inside its own segment or nowhere. Beside the column
1554
+ // the value would stand in the gap between two stacks, as near the next
1555
+ // one, with no leader at that distance. A value its segment cannot hold
1556
+ // is named in the note line (layout.ts), and so is a value that fits its
1557
+ // segment but loses its seat to another label.
1558
+ ...val.labelOverride !== !1 ? { noteText: `${s.label} ${text} (${noteName(c)})` } : {},
1559
+ candidates: insideSeats(stackSegmentCandidates(rect, tsize, fits, paints.inside(s, val, c, si), { baselineY: y0 }), rect, tsize.height).map((candidate) => ({ ...candidate, insidePaint: paints.cell(s, val, c, si), insidePattern: paints.pattern(s, val, c) }))
1560
+ });
1561
+ }
1562
+ if (tooWide) for (let request of requests.slice(first)) {
1563
+ let ci = domain.cats.findIndex((c) => c.id === request.owner.categoryId);
1564
+ typeof domain.columns.find((column) => column.id === request.owner.seriesId)?.vals[ci]?.labelOverride != "string" && (request.redundant = !0);
1565
+ }
1566
+ }
1567
+ var SEGMENT_EDGE_AIR = 3;
1568
+ function insideSeats(candidates, rect, labelH) {
1569
+ let inside = candidates.filter((candidate) => candidate.slot.startsWith("inside")), centre = inside.find((candidate) => candidate.slot === "insideCenter");
1570
+ if (!centre) return inside;
1571
+ let edges = [
1572
+ { ...centre, slot: "insideUpper", rect: { ...centre.rect, y: rect.y + SEGMENT_EDGE_AIR }, penalty: centre.penalty + 1 },
1573
+ { ...centre, slot: "insideLower", rect: { ...centre.rect, y: rect.y + rect.h - labelH - SEGMENT_EDGE_AIR }, penalty: centre.penalty + 1.5 }
1574
+ ].filter((seat) => Math.abs(seat.rect.y - centre.rect.y) >= 1 && seat.rect.y >= rect.y && seat.rect.y + labelH <= rect.y + rect.h);
1575
+ return [...inside, ...edges];
1576
+ }
1577
+ function totalColumn(domain, ci) {
1578
+ let populated = domain.columns.filter((column) => column.vals[ci].v !== null), drawn = populated.filter((column) => column.vals[ci].v !== 0);
1579
+ return populated.length === 1 ? populated[0] : drawn.length === 1 ? drawn[0] : void 0;
1580
+ }
1581
+ function grandTotalLabels(env, domain, area, paints, requests, lineYs, strokes = []) {
1582
+ let gtContent = domain.columns.length > 0 && domain.columnsAdd ? contentOf(domain, "grandTotal", ["absolute"]) : null;
1583
+ if (!gtContent) return;
1584
+ let { posTop, negBot } = domain, { y, band, strongFont } = area, authored = /* @__PURE__ */ new Set(), bare = /* @__PURE__ */ new Set(), linked = new Map(requests.flatMap((req) => req.printedIn ? [[req.printedIn, req.id]] : [])), valueAlone = gtContent.join() === "absolute", backLink = (id, words) => !words && valueAlone && linked.has(id) ? { printedIn: linked.get(id) } : {}, crossesRules = domain.averageMarkerId !== void 0 || (domain.options.annotations ?? []).some((annotation) => annotation.kind === "valueLine"), texts = domain.cats.map((c, ci) => {
1585
+ if (!domain.anyByCat[ci]) return null;
1586
+ let single = totalColumn(domain, ci), cell = single?.vals[ci], composed = composeText(domain, gtContent, { abs: domain.stackTotals[c.id], isPct: cell?.isPct ?? !1, format: cell?.format ?? single?.format ?? domain.options.format }, c.label ?? c.id, "", domain.fmt), override = cell?.labelOverride;
1587
+ return override === !1 ? null : (typeof override == "string" && authored.add(c.id), namesOnly(cell?.isPct ? gtContent : gtContent.filter((part) => part !== "percent"), override).printsFor && bare.add(c.id), (typeof override == "string" ? override.replace(/\$\{value\}/g, composed) : composed) || null);
1588
+ }), anatomyFont = domain.anatomy && domain.columns.length === 1 ? { ...strongFont } : void 0, insideFont = anatomyFont && texts.every((text) => text === null || env.measure(text, anatomyFont).width + 4 <= band.bandwidth) ? anatomyFont : void 0, toDateIds = insideFont ? /* @__PURE__ */ new Set() : toDateOnTotals(env, domain), toDate = domain.options.strings?.toDate ?? chartString(domain.options, "toDate"), wordsAt = (ci, text, font) => {
1589
+ let id = domain.cats[ci].id, words = toDateIds.has(id) ? toDate : !insideFont && domain.columnsAdd && domain.incompleteCats.has(id) && disclosuresShown(domain.options) ? domain.options.strings.incomplete : void 0;
1590
+ return words ? toDateLabel(text, font, words, env.theme, env.measure) : void 0;
1591
+ }, outerSeat = (font) => (text, ci) => {
1592
+ if (text === null) return null;
1593
+ let size = wordsAt(ci, text, font)?.size ?? env.measure(text, font), above = posTop[ci] > 0 || negBot[ci] === 0, edgeY = y(above ? posTop[ci] : negBot[ci]);
1594
+ return { x: band.center(ci) - size.width / 2, y: above ? edgeY - size.height - 4 : edgeY + 4, w: size.width, h: size.height };
1595
+ }, rowFont = !insideFont && valueRowCrowded(texts.map(outerSeat(strongFont))) ? stepDownFont(env.theme, strongFont, "label", domain.options.target, textScaleOf(domain.options)) : void 0, outerFont = rowFont ?? strongFont, thinned = !insideFont && domain.columns.length > 1 && valueRowCrowded(texts.map(outerSeat(outerFont))), shiftedTop = (ci) => {
1596
+ let above = posTop[ci] > 0 || negBot[ci] === 0, h = env.measure(texts[ci], outerFont).height;
1597
+ return above ? y(posTop[ci]) - 2 * h - 8 : y(negBot[ci]) + h + 8;
1598
+ }, apart = (ci) => [ci - 1, ci + 1].every((n) => {
1599
+ let other = texts[n];
1600
+ if (other == null) return !0;
1601
+ let own = env.measure(texts[ci], outerFont);
1602
+ return Math.abs(shiftedTop(n) - shiftedTop(ci)) >= own.height ? !0 : Math.abs(band.center(n) - band.center(ci)) - (env.measure(other, outerFont).width + own.width) / 2 >= SHIFTED_TOTAL_GAP;
1603
+ }), shiftedClear = (seat, ci) => strokes.length > 0 && apart(ci) && strokes.every((stroke) => !stroke.hits(seat.rect, STROKE_CLEAR2)) ? { ...seat, pad: 0 } : seat;
1604
+ domain.cats.forEach((c, ci) => {
1605
+ let text = texts[ci];
1606
+ if (text == null) return;
1607
+ let words = wordsAt(ci, text, outerFont), tsize = words?.size ?? env.measure(text, insideFont ?? outerFont), above = posTop[ci] > 0 || negBot[ci] === 0, edgeY = y(above ? posTop[ci] : negBot[ci]), cx = band.center(ci), at = (slot, ry, penalty) => ({ slot, rect: { x: Math.max(area.plot.x, Math.min(cx - tsize.width / 2, area.plot.x + area.plot.w - tsize.width)), y: ry, w: tsize.width, h: tsize.height }, penalty }), insideDepth = tsize.width + 4 > band.bandwidth ? 0 : (() => {
1608
+ let top = [...domain.columns].reverse().find((s) => {
1609
+ let v = s.vals[ci].v;
1610
+ return v !== null && (above ? v > 0 : v < 0);
1611
+ });
1612
+ return top === void 0 ? 0 : Math.abs(y(top.vals[ci].v) - y(0));
1613
+ })(), inside = (dy, slot) => insideDepth >= tsize.height + dy ? { ...at(slot, above ? edgeY + dy : edgeY - tsize.height - dy, 2), ...paints.top(ci, above) } : void 0, named = { noteText: `${domain.columns.length === 1 ? noteName(domain.columns[0]) : chartString(domain.options, "total")} ${text}${words ? ` ${words.lines[1]}` : ""} (${noteName(c)})` };
1614
+ if (insideFont && above && edgeY + 4 + tsize.height <= y(0)) {
1615
+ requests.push({
1616
+ id: `grandTotal:${c.id}`,
1617
+ ...named,
1618
+ kind: "grandTotal",
1619
+ ...authored.has(c.id) ? { keepWhenDense: !0 } : {},
1620
+ ...bare.has(c.id) ? { printsFor: [] } : {},
1621
+ ...backLink(`grandTotal:${c.id}`, void 0),
1622
+ owner: { categoryId: c.id },
1623
+ text,
1624
+ lines: [text],
1625
+ typeRole: "label",
1626
+ font: insideFont,
1627
+ fontStep: insideFont,
1628
+ priority: PRIORITY.grandTotal + (env.highlights.has(c.id) ? PRIORITY.highlightBonus : 0),
1629
+ candidates: [{ ...at("insideTop", edgeY + 4, 0), ...paints.top(ci, !0) }]
1630
+ });
1631
+ return;
1632
+ }
1633
+ requests.push({
1634
+ id: `grandTotal:${c.id}`,
1635
+ ...named,
1636
+ kind: "grandTotal",
1637
+ ...authored.has(c.id) ? { keepWhenDense: !0 } : {},
1638
+ ...bare.has(c.id) ? { printsFor: [] } : {},
1639
+ ...backLink(`grandTotal:${c.id}`, words),
1640
+ owner: { categoryId: c.id },
1641
+ text,
1642
+ lines: words?.lines ?? [text],
1643
+ ...words?.request,
1644
+ typeRole: "label",
1645
+ font: outerFont,
1646
+ ...rowFont ? { fontStep: rowFont } : {},
1647
+ ...thinned && ci % 2 !== (domain.cats.length - 1) % 2 && !env.highlights.has(c.id) ? { redundant: !0, suppressedAs: "density", owed: !0 } : {},
1648
+ priority: PRIORITY.grandTotal + (env.highlights.has(c.id) ? PRIORITY.highlightBonus : 0),
1649
+ candidates: nearestOwnMarkFirst(
1650
+ [
1651
+ // An average marker across this seat does not move the total: it
1652
+ // crosses the rule on a halo, as on column.
1653
+ { ...at(above ? "aboveStack" : "belowStack", above ? edgeY - tsize.height - 4 : edgeY + 4, 0), ...crossesRules ? { overRules: !0 } : {} },
1654
+ { ...shiftedClear(at(above ? "aboveStackShifted" : "belowStackShifted", above ? edgeY - 2 * tsize.height - 8 : edgeY + tsize.height + 8, 1), ci), ...crossesRules ? { overRules: !0 } : {} },
1655
+ // Type steps: a line that rises from this column's top runs right of its centre;
1656
+ // the total then stands left of the line's start, level with its usual seat (pareto at 320: '120').
1657
+ // Only the first column (left of any other the total would stand over its neighbour), and only
1658
+ // one too narrow to hold its total inside.
1659
+ ...ci === 0 && tsize.width + 4 > band.bandwidth && strokes.length > 0 && above && cx - LEFT_SEAT_AIR - tsize.width >= LEFT_SEAT_MIN_X ? [{ slot: "aboveStackLeft", rect: { x: cx - LEFT_SEAT_AIR - tsize.width, y: edgeY - tsize.height - 4, w: tsize.width, h: tsize.height }, penalty: 2 }] : []
1660
+ ],
1661
+ edgeY,
1662
+ lineYs(ci),
1663
+ inside(8, "insideEnd"),
1664
+ domain.columns.length > 1,
1665
+ // Last of all, one step further in: a line marker just inside the column top blocks the inside end by a fraction of a pixel.
1666
+ inside(12, "insideEndLowered")
1667
+ )
1668
+ });
1669
+ });
1670
+ }
1671
+ var LEFT_SEAT_AIR = 6, LEFT_SEAT_MIN_X = 8;
1672
+ function referenceLabels(env, domain, area, requests) {
1673
+ let content = contentOf(domain, "tick", ["absolute", "series"]);
1674
+ if (!content) return;
1675
+ let { band, y, tickFont } = area, marker = domain.options.referenceStyle === "marker";
1676
+ for (let s of domain.refs) domain.cats.forEach((c, ci) => {
1677
+ let val = s.vals[ci];
1678
+ if (val.v === null) return;
1679
+ let text = composeText(domain, content, { abs: val.v, isPct: val.isPct, format: val.format ?? s.format ?? domain.options.format }, c.label ?? c.id, s.label, s.format ? formatterFromExample(s.format, domain.options.locale?.language) : domain.fmt), { width: w, height: h } = env.measure(text, tickFont), ry = y(val.v), seat = (slot, x, top, penalty) => ({ slot, rect: { x, y: top, w, h }, penalty }), cx = band.center(ci), right = band.position(ci) + band.bandwidth + 5;
1680
+ requests.push({
1681
+ id: `tick:${s.id}:${c.id}`,
1682
+ kind: "tick",
1683
+ owner: { seriesId: s.id, categoryId: c.id },
1684
+ text,
1685
+ lines: [text],
1686
+ typeRole: "label",
1687
+ font: tickFont,
1688
+ priority: PRIORITY.reference,
1689
+ candidates: [
1690
+ ...marker ? [seat("rightOfMarker", cx + REFERENCE_MARKER_R + 4, ry - h / 2, 0), seat("leftOfMarker", cx - REFERENCE_MARKER_R - 4 - w, ry - h / 2, 0.5)] : [],
1691
+ seat("rightOfTick", right, ry - h / 2, 1),
1692
+ seat("rightOfTickAbove", right, ry - h - 4, 2),
1693
+ seat("rightOfTickBelow", right, ry + 4, 3),
1694
+ seat("leftOfTick", band.position(ci) - 7 - w, ry - h / 2, 4),
1695
+ // Where the gaps are taken, on the column above or below its tick, on a halo.
1696
+ { ...seat("aboveTickOnColumn", cx - w / 2, ry - h - 3, 5), overColumns: !0, needsBacking: !0 },
1697
+ { ...seat("belowTickOnColumn", cx - w / 2, ry + 3, 6), overColumns: !0, needsBacking: !0 }
1698
+ ]
1699
+ });
1700
+ });
1701
+ }
1702
+ function nearestOwnMarkFirst(outer, edgeY, lineYs, inside, tieIsOwn, insideLast) {
1703
+ let own = (c) => {
1704
+ let cy = c.rect.y + c.rect.h / 2;
1705
+ return lineYs.every((ly) => tieIsOwn && Math.abs(ly - edgeY) < 0.5 || Math.abs(cy - ly) > Math.abs(cy - edgeY));
1706
+ };
1707
+ return [
1708
+ ...outer.filter(own),
1709
+ ...inside ? [inside] : [],
1710
+ ...outer.filter((c) => !own(c)).map((c) => ({ ...c, lastResort: !0 })),
1711
+ ...insideLast ? [insideLast] : []
1712
+ ].map((c, penalty) => ({ ...c, penalty }));
1713
+ }
1714
+ function categoryLabels(domain, area, requests) {
1715
+ let { catPlan, band, gtH, dateNumericTicks } = area, rotated = catPlan.rotation !== 0;
1716
+ domain.cats.forEach((c, ci) => {
1717
+ let info = catPlan.infos[ci], at = (slot, ry, penalty) => ({ slot, rect: { x: catPlan.x(ci), y: ry, w: info.w, h: info.h }, penalty });
1718
+ requests.push({
1719
+ id: `category:${c.id}`,
1720
+ kind: "category",
1721
+ owner: { categoryId: c.id },
1722
+ text: c.label ?? c.id,
1723
+ lines: info.lines,
1724
+ ...categoryLineAlign(catPlan, ci),
1725
+ ...info.title !== void 0 ? { title: info.title } : {},
1726
+ typeRole: catPlan.typeRole,
1727
+ font: catPlan.font,
1728
+ priority: PRIORITY.endpoint,
1729
+ // A stride-hidden date label is the row's decision (one info lint), not a loss.
1730
+ redundant: !catPlan.keep[ci],
1731
+ ...rotated ? { rotate: catPlan.rotation === 90 ? -90 : -45 } : {},
1732
+ candidates: catPlan.rotation === 90 ? [{ slot: "below", rect: verticalNameRect(band.center(ci), area.catRowY, info.w, catPlan.font), penalty: 0 }] : rotated ? [{ slot: "below", rect: rotatedClaimRect(band.center(ci), area.catRowY + Math.max(8, info.h * Math.SQRT1_2 / 2 + ROTATED_NAME_AIR), info.h), penalty: 0 }] : [
1733
+ at("below", area.catRowY + 6, 0),
1734
+ // A date/numeric tick row is ONE row, never the stagger tier.
1735
+ ...dateNumericTicks ? [] : [at("belowShifted", area.catRowY + 6 + gtH + 4, 1)]
1736
+ ]
1737
+ });
1738
+ }), pushAll(requests, yearRowRequests(catPlan, area.catRowY + 6));
1739
+ }
1740
+ function linePointLabels(env, domain, area, geometry, requests, strokes, fills) {
1741
+ let { labelFont, frame } = area, labelH = env.measure("0", labelFont).height, mode = comboValueLabels(domain.options, domain.anatomy, domain.cats.length), content = mode === "all" || mode === "extremes" ? contentOf(domain, "point", ["absolute"]) : null, flaggedContent = contentOf(domain, "point", ["absolute"]), anomaly = domain.anomaly, flaggedAt = (s, ci) => anomaly?.seriesId === s.id && anomaly.model.flagByCategory.has(domain.cats[ci].id), strokesOf = new Map(geometry.plans.map((plan) => [plan.s.id, plan.runs.filter((run) => run.length > 0).map((run) => drawnStroke(run, plan.interpolation))])), queriesOf = new Map([...strokesOf.values()].flat().map((stroke) => [stroke, preparePolyline(stroke)]));
1742
+ for (let { s, pts } of geometry.plans) {
1743
+ let own = strokesOf.get(s.id), others = [...strokesOf].flatMap(([id, runs]) => id === s.id ? [] : runs), ownQueries = own.map((stroke) => queriesOf.get(stroke)), otherQueries = others.map((stroke) => queriesOf.get(stroke)), values = pts.map((point) => s.vals[point.ci].v), [min, max] = [minOf(values), maxOf(values)];
1744
+ for (let point of pts) {
1745
+ if (area.first.get(s.id)?.ci === point.ci || area.last.get(s.id)?.ci === point.ci) continue;
1746
+ let cell = s.vals[point.ci], override = cell.labelOverride, extreme = cell.v === min || cell.v === max, flagged = flaggedContent !== null && override === void 0 && flaggedAt(s, point.ci), engine = content !== null && override === void 0 && (mode === "all" || extreme) || flagged;
1747
+ if (typeof override != "string" && !engine) continue;
1748
+ let category = domain.cats[point.ci], serFmt = s.format ? env.byExample(s.format) : domain.scaleFmtOf(s), text = typeof override == "string" ? override.replace(/\$\{value\}/g, composeText(domain, ["absolute"], { abs: cell.v ?? 0, isPct: cell.isPct, format: domain.explicitFormatOf(s, cell) }, category.label ?? category.id, s.label, serFmt)) : composeText(domain, content ?? flaggedContent, { abs: cell.v, isPct: cell.isPct, format: domain.explicitFormatOf(s, cell) }, category.label ?? category.id, s.label, serFmt);
1749
+ if (!text) continue;
1750
+ let size = env.measure(text, labelFont), below = sideAwayFrom(point, others) === "below", centeredX = Math.max(frame.plot.x, Math.min(point.x - size.width / 2, frame.plot.x + frame.plot.w - size.width)), aboveY = point.y - labelH - ABOVE_POINT_GAP, lift = domain.anatomy ? clearLift({ x: centeredX, y: aboveY, w: size.width, h: labelH }, strokes, labelH) : void 0, free = [
1751
+ { slot: "above", y: aboveY, penalty: below ? 1 : 0 },
1752
+ ...lift ? [{ slot: "aboveLifted", y: aboveY - lift, penalty: (below ? 1 : 0) + 0.25 }] : [],
1753
+ { slot: "below", y: point.y + 5, penalty: below ? 0 : 1 },
1754
+ { slot: "leftRaised", x: point.x - 2.75 - 5 - size.width, y: point.y - labelH / 2 - 8, penalty: 1.5 },
1755
+ { slot: "rightRaised", x: point.x + 2.75 + 5, y: point.y - labelH / 2 - 8, penalty: 1.5 },
1756
+ { slot: "aboveShifted", y: point.y - 2 * labelH - 9, penalty: 2 }
1757
+ ].sort((a, b) => a.penalty - b.penalty).flatMap(({ slot, x = centeredX, y, penalty }) => x >= frame.plot.x && x + size.width <= frame.plot.x + frame.plot.w && y >= frame.plot.y && y + labelH <= frame.plot.y + frame.plot.h ? [{ slot, rect: { x, y, w: size.width, h: labelH }, penalty }] : []), clear = nearerOwnLine(clearOfStrokes(free, strokes), ownQueries, otherQueries), slots = domain.columns.length > 0 ? [...clear, ...clear.map((candidate) => ({ ...candidate, slot: `${candidate.slot}OnColumn`, penalty: candidate.penalty + 10, needsBacking: !0, overColumns: !0 }))] : clear;
1758
+ requests.push({
1759
+ id: `point:${s.id}:${category.id}`,
1760
+ kind: "point",
1761
+ role: composedTextRole(text),
1762
+ owner: { seriesId: s.id, categoryId: category.id },
1763
+ text,
1764
+ lines: [text],
1765
+ typeRole: "label",
1766
+ font: labelFont,
1767
+ priority: cell.priority ?? (engine && extreme ? PRIORITY.extreme : PRIORITY.interior) + (env.highlights.has(s.id) || env.highlights.has(category.id) ? PRIORITY.highlightBonus : 0),
1768
+ candidates: withinOneFill(slots, fills)
1769
+ });
1770
+ }
1771
+ }
1772
+ }
1773
+ function growthLabels(env, area, requests) {
1774
+ let growth = area.growth;
1775
+ if (!growth) return;
1776
+ let valueH = env.measure("0", growth.valueFont).height, nameH = env.measure("0", growth.nameFont).height, blockH = growth.oneLine ? valueH : valueH + 2 + nameH, placed = growth.items.map((item) => ({ item, y: (item.axis === "secondary" ? area.y2 : area.y)(item.last) - valueH / 2 })).sort((a, b) => a.y - b.y), floor = -1 / 0;
1777
+ for (let entry of placed)
1778
+ entry.y = Math.max(entry.y, floor), floor = entry.y + blockH + 4;
1779
+ for (let { item, y } of placed) {
1780
+ let text = growth.oneLine ? growthLine(item) : item.text, valueW = env.measure(text, growth.valueFont).width;
1781
+ requests.push({
1782
+ // A figure with its name is prose; the figure alone a value.
1783
+ id: `growth:${item.seriesId}`,
1784
+ kind: "annotation",
1785
+ role: growth.oneLine ? composedTextRole(text) : "value",
1786
+ owner: { seriesId: item.seriesId },
1787
+ text,
1788
+ lines: [text],
1789
+ typeRole: "label",
1790
+ font: growth.valueFont,
1791
+ fontStep: growth.valueFont,
1792
+ priority: PRIORITY.grandTotal,
1793
+ candidates: [{ slot: "growth", rect: { x: growth.x, y, w: valueW, h: valueH }, penalty: 0 }]
1794
+ });
1795
+ let name = item.textPaint ? item.short : item.name;
1796
+ if (growth.oneLine || !name) continue;
1797
+ let nameW = env.measure(name, growth.nameFont).width;
1798
+ requests.push({
1799
+ id: `growth:${item.seriesId}:name`,
1800
+ kind: "annotation",
1801
+ owner: { seriesId: item.seriesId },
1802
+ text: name,
1803
+ lines: [name],
1804
+ typeRole: "label",
1805
+ font: growth.nameFont,
1806
+ fontStep: growth.nameFont,
1807
+ priority: PRIORITY.grandTotal,
1808
+ candidates: [{ slot: "growthName", rect: { x: growth.x, y: y + valueH + 2, w: nameW, h: nameH }, penalty: 0 }]
1809
+ });
1810
+ }
1811
+ }
1812
+ function applyGrowthInk(labels, area) {
1813
+ let items = area.growth?.items ?? [], twinOf = new Map(items.flatMap((item) => item.textPaint ? [[item.seriesId, item.textPaint]] : [])), inkOf = new Map(items.map((item) => [`growth:${item.seriesId}`, item.ink]));
1814
+ for (let label of labels) {
1815
+ if (!label.id.startsWith("growth:")) continue;
1816
+ let twin = label.owner?.seriesId !== void 0 ? twinOf.get(label.owner.seriesId) : void 0;
1817
+ label.ink = twin ?? { token: inkOf.get(label.id) ?? "inkMuted" };
1818
+ }
1819
+ }
1820
+ function planComboLabels(env, domain, area, geometry, paints, warnings) {
1821
+ let { frame, labelFont, band } = area, rightAxisActive = domain.rightTicks.length > 0, requests = anchorComboAxisTitles(area.axisTitles, {
1822
+ left: Number.isFinite(geometry.leftTickX) ? geometry.leftTickX : void 0,
1823
+ right: rightAxisActive ? area.rightTickX + area.rightAxisReserve - 10 : void 0,
1824
+ rightStart: rightAxisActive ? area.rightTickX : void 0
1825
+ }, frame.plot);
1826
+ segmentLabels(env, domain, area, geometry, paints, requests, warnings);
1827
+ let strokes = comboStrokes(geometry).map(preparePolyline), lineYsByCat;
1828
+ grandTotalLabels(env, domain, area, paints, requests, (ci) => {
1829
+ if (!lineYsByCat) {
1830
+ lineYsByCat = domain.cats.map(() => []);
1831
+ for (let plan of geometry.plans) for (let point of plan.pts) lineYsByCat[point.ci].push(point.y);
1832
+ }
1833
+ return lineYsByCat[ci];
1834
+ }, strokes);
1835
+ let fills = geometry.segments.map((segment) => segment.rect), segmentSeats = requests.flatMap((r) => r.kind === "segment" && !r.redundant && r.candidates[0]?.slot === "insideCenter" ? [r.candidates[0].rect] : []), totalSeats = requests.flatMap((r) => r.kind === "grandTotal" && !r.redundant && r.candidates[0] ? [r.candidates[0].rect] : []);
1836
+ for (let { s, pts } of geometry.plans)
1837
+ for (let endpoint of [
1838
+ { point: pts[pts.length - 1], end: area.last.get(s.id), first: !1 },
1839
+ { point: pts[0], end: area.first.get(s.id), first: !0 }
1840
+ ])
1841
+ endpoint.end !== void 0 && requests.push(comboEndpointRequest({
1842
+ s,
1843
+ last: endpoint.point,
1844
+ lastCat: domain.cats[endpoint.point.ci],
1845
+ text: endpoint.end.text,
1846
+ labelFont,
1847
+ measure: env.measure,
1848
+ MARKER_R: 2.75,
1849
+ hasColumns: domain.columns.length > 0,
1850
+ band,
1851
+ adjacentAxisActive: endpoint.first ? domain.showPrimaryAxis : rightAxisActive,
1852
+ highlights: env.highlights,
1853
+ first: endpoint.first,
1854
+ firstBelowTotals: domain.options[FIRST_END_BELOW_TOTALS] === !0,
1855
+ sharesOnColumns: domain.options[FIRST_END_BELOW_TOTALS] === !0,
1856
+ allowOnColumn: !domain.lineBand,
1857
+ bounds: s.kind === "line" && domain.options[FIRST_END_BELOW_TOTALS] !== !0 ? { x0: area.plot.x, x1: area.plot.x + area.plot.w, y0: area.plot.y, y1: area.plot.y + area.plot.h } : { x0: frame.plot.x, x1: frame.plot.x + frame.plot.w },
1858
+ strokes,
1859
+ fills,
1860
+ segmentSeats,
1861
+ totalSeats,
1862
+ anatomy: domain.anatomy
1863
+ }));
1864
+ return linePointLabels(env, domain, area, geometry, requests, strokes, fills), seatValuesOnGround(requests, geometry.areaGrounds, 2, (ground) => paints.css(ground.paint), !shadesFills(domain.options.annotations ?? []), ["point", "grandTotal"]), referenceLabels(env, domain, area, requests), growthLabels(env, area, requests), area.showCatTickRow && categoryLabels(domain, area, requests), rankValueLabels(
1865
+ requests,
1866
+ (request) => request.kind === "grandTotal" && request.owner.categoryId !== void 0 ? domain.stackTotals[request.owner.categoryId] : void 0,
1867
+ env.density,
1868
+ domain.options.labelPlacements,
1869
+ { categories: domain.cats.length, last: domain.options.mode === "compact" ? domain.cats.at(-1)?.id : void 0, pitch: band.step, orientation: "vertical", measure: env.measure }
1870
+ ), requests;
1871
+ }
1872
+
1873
+ // src/core/charts/combo/marks.ts
1874
+ function comboAxes(ctx) {
1875
+ let { env, domain, area, g } = ctx, { plot, y, y0 } = area, tickFont = secondaryFont(env.theme), { nodes, claims } = g, primaryDrawn;
1876
+ if (domain.showPrimaryAxis) {
1877
+ let axisResult = layoutValueAxis(
1878
+ { scale: y, plot, orient: "y", gridlines: domain.options.valueAxis?.gridlines ?? domain.anatomy, format: domain.fmt, formatSpec: domain.valueSpec, theme: env.theme, measure: env.measure, ticks: domain.pticks },
1879
+ claims
1880
+ );
1881
+ pushAll(nodes, axisResult.nodes), g.axes.push(axisResult.axis), primaryDrawn = new Set(axisResult.axis.ticks.flatMap((t) => typeof t.at == "number" ? [t.at] : [])), g.leftTickX = minOf(axisResult.nodes.map((node) => node.t === "text" ? node.x : 1 / 0));
1882
+ }
1883
+ if (domain.rightTicks.length > 0) {
1884
+ let axis2 = { axis: "y", ticks: [] }, replacing = domain.secondaryDomain ? (domain.options.annotations ?? []).filter((a) => a.kind !== "event").flatMap((a, n) => a.kind === "valueLine" && a.axis === "secondary" && (a.side ?? "right") === "right" && typeof a.value == "number" && typeof a.label == "string" ? [{ id: defaultAnnotationId(a, n), value: a.value, text: a.label }] : []) : [], synced = domain.rightTicks.length === domain.pticks.length && domain.rightTicks.every(({ at }, i) => Math.abs((domain.secondaryDomain ? area.y2(at) : y(domain.pticks[i])) - y(domain.pticks[i])) < 0.5), lockstep = primaryDrawn !== void 0 && synced, keep = lockstep ? domain.rightTicks.map((_, i) => primaryDrawn.has(domain.pticks[i])) : sweepHide(domain.rightTicks.map(({ at, text }, i) => {
1885
+ let h = env.measure(text, tickFont).height;
1886
+ return { start: (domain.secondaryDomain ? area.y2(at) : y(domain.pticks[i])) - h / 2, size: h, priority: i === 0 || i === domain.rightTicks.length - 1 ? 1 : 0 };
1887
+ }), 4);
1888
+ if (!lockstep) {
1889
+ if (domain.secondaryDomain && !domain.options.secondaryAxis?.domain && domain.showPrimaryAxis)
1890
+ keep = domain.rightTicks.map(({ at }) => g.axes[0].ticks.some((tick) => Math.abs(tick.pos - area.y2(at)) < 0.01));
1891
+ else if (!domain.options.secondaryAxis || !domain.options.secondaryAxis.domain)
1892
+ for (let stride = 1; stride <= keep.length; stride++) {
1893
+ let selected = keep.map((_, i) => i % stride === 0), rows = domain.rightTicks.filter((_, i) => selected[i]).map(({ at, text }, i) => {
1894
+ let pos = domain.secondaryDomain ? area.y2(at) : y(domain.pticks[i * stride]), h = env.measure(text, tickFont).height;
1895
+ return { start: pos - h / 2, size: h, priority: 0 };
1896
+ });
1897
+ if (sweepHide(rows, 4).every(Boolean)) {
1898
+ keep = selected;
1899
+ break;
1900
+ }
1901
+ }
1902
+ }
1903
+ domain.rightTicks.forEach(({ at: tv, text }, i) => {
1904
+ if (!keep[i]) return;
1905
+ let pos = domain.secondaryDomain ? area.y2(tv) : y(domain.pticks[i]), tsize = env.measure(text, tickFont), rect = { x: area.rightTickX, y: pos - tsize.height / 2, w: tsize.width, h: tsize.height }, labelId = `axis:y2:tick:${i}`;
1906
+ nodes.push({ t: "text", id: labelId, x: rect.x, y: rect.y, lines: [text], align: "start", typeRole: "secondary", font: tickFont, ink: { token: "inkMuted" }, owner: {}, part: "tick" });
1907
+ let by = replacing.find((r) => r.text === text && Math.abs(r.value - tv) < 1e-9);
1908
+ by ? (claims.claim(rect, "annotation", { annotationId: by.id }), g.yieldingTicks.push({ labelId, annotationId: by.id, rect })) : claims.claim(rect, "axis", {}), axis2.ticks.push({ at: tv, pos, labelId });
1909
+ }), g.axes.push(axis2);
1910
+ }
1911
+ nodes.push({ t: "line", id: "axis:baseline", x1: plot.x, y1: y0, x2: plot.x + plot.w, y2: y0, stroke: { token: "axis" }, width: strokeToken(env.theme, "rule"), owner: {}, part: "baseline" }), claims.claim({ x: plot.x, y: y0 - 0.5, w: plot.w, h: 1 }, "axis", {});
1912
+ }
1913
+ function columnMarks(ctx) {
1914
+ let { env, domain, area, paints, g } = ctx, { cats, columns, refs } = domain, { band, y } = area, { nodes, claims } = g;
1915
+ if (columns.length > 0) {
1916
+ cats.forEach((c, ci) => {
1917
+ let bx = band.position(ci), bw = band.bandwidth, pos = 0, neg = 0, segs = [];
1918
+ columns.forEach((s, si) => {
1919
+ let val = s.vals[ci], v = val.v;
1920
+ if (v === null) return;
1921
+ let v0 = v >= 0 ? pos : neg, v1 = v0 + v;
1922
+ if (v >= 0 ? pos = v1 : neg = v1, g.segEdges.set(sk(s.id, c.id), { v0, v1, v }), v === 0) return;
1923
+ let rect = { x: bx, y: y(Math.max(v0, v1)), w: bw, h: Math.max(Math.abs(y(v0) - y(v1)), 0.5) }, nodeId = `mark:${s.id}:${c.id}`, cellFill = paints.cell(s, val, c, si), cellPat = paints.pattern(s, val, c), washed = "tint" in cellFill && cellFill.tint !== void 0, cellSep = cellPat || washed || markOutlineOff(cellFill, env.theme) ? void 0 : segmentSeparationStroke(cellFill, env.theme.color.background, env.theme);
1924
+ nodes.push({
1925
+ t: "rect",
1926
+ id: nodeId,
1927
+ rect,
1928
+ fill: cellFill,
1929
+ pattern: cellPat,
1930
+ ...cellSep ?? {},
1931
+ ...washed ? {} : { separation: { fillStep: !0, fill: cellFill, backing: { token: "background" }, pattern: cellPat } },
1932
+ owner: { seriesId: s.id, categoryId: c.id },
1933
+ part: "segment",
1934
+ display: { value: val.format ?? s.format ?? domain.options.format ? env.byExample(val.format ?? s.format ?? domain.options.format)(v) : val.isPct ? domain.pctFmt(v) : domain.fmt(v) }
1935
+ }), claims.claim(rect, "mark", { seriesId: s.id, categoryId: c.id }, "segment"), segs.push({ seriesId: s.id, rect, nodeId }), g.segments.push({ s, si, ci, v, rect });
1936
+ });
1937
+ let stackTop = y(pos), stackBot = y(neg);
1938
+ g.marks.columns.push({ categoryId: c.id, rect: { x: bx, y: stackTop, w: bw, h: Math.max(stackBot - stackTop, 0.5) }, segments: segs });
1939
+ });
1940
+ let { plot, y0 } = area;
1941
+ nodes.push({ t: "line", id: "axis:baseline:over", x1: plot.x, y1: y0, x2: plot.x + plot.w, y2: y0, stroke: { token: "axis" }, width: strokeToken(env.theme, "rule"), owner: {}, part: "baseline" });
1942
+ }
1943
+ let style = domain.options.referenceStyle ?? "tick";
1944
+ for (let s of refs)
1945
+ cats.forEach((c, ci) => {
1946
+ let v = s.vals[ci].v;
1947
+ if (v === null) return;
1948
+ let ry = y(v), bx = band.position(ci), bw = band.bandwidth, owner = { seriesId: s.id, categoryId: c.id }, id = `ref:${s.id}:${c.id}`, display = { value: s.vals[ci].format ?? s.format ?? domain.options.format ? formatterFromExample(s.vals[ci].format ?? s.format ?? domain.options.format, domain.options.locale?.language)(v) : s.vals[ci].isPct ? domain.pctFmt(v) : domain.fmt(v) };
1949
+ if (style === "marker") {
1950
+ let cx = band.center(ci);
1951
+ nodes.push({ t: "circle", id, cx, cy: ry, ...referenceMarkerPaint(env.theme, paints.ref(s)), owner, part: "referenceMarker", display });
1952
+ let mr = REFERENCE_MARKER_R + 1;
1953
+ claims.claim({ x: cx - mr, y: ry - mr, w: mr * 2, h: mr * 2 }, "mark", owner);
1954
+ return;
1955
+ }
1956
+ let tick = referenceTickGeometry("vertical", bx, ry, -2, bw + 2), tickWidth = style === "line" ? strokeToken(env.theme, "rule") : domain.options.referenceTick?.width ?? strokeToken(env.theme, "rule");
1957
+ nodes.push(referenceCasing(id, tick.line, tickWidth, owner)), nodes.push({
1958
+ t: "line",
1959
+ id,
1960
+ ...tick.line,
1961
+ stroke: paints.ref(s),
1962
+ width: tickWidth,
1963
+ ...style === "line" ? { dash: dashToken(env.theme, "dotted"), lineCap: "round" } : {},
1964
+ owner,
1965
+ part: style === "line" ? "referenceLine" : "referenceTick",
1966
+ display
1967
+ }), claims.claim(tick.claim, "mark", owner, style === "line" ? "referenceLine" : void 0);
1968
+ });
1969
+ }
1970
+ function pathFor2(points, interpolation, curve = []) {
1971
+ return interpolation === "monotone" ? curvePathFromSegments(curve) : pathFor(points, interpolation);
1972
+ }
1973
+ function linePlans(domain, area) {
1974
+ let { cats, secondaryActive } = domain;
1975
+ return domain.lines.map((s, li) => {
1976
+ let yFor = s.axis === "secondary" && secondaryActive ? area.y2 : area.y, pts = [], runs = [], run = [];
1977
+ cats.forEach((_c, ci) => {
1978
+ let v = s.vals[ci].v;
1979
+ if (v === null) {
1980
+ !s.interpolateGaps && run.length > 0 && (runs.push(run), run = []);
1981
+ return;
1982
+ }
1983
+ let p = { ci, x: area.band.center(ci), y: yFor(v) };
1984
+ pts.push(p), run.push(p);
1985
+ }), run.length > 0 && runs.push(run);
1986
+ let interpolation = domain.interpolationFor(s), drawableRuns = s.interpolateGaps ? [pts] : runs;
1987
+ return {
1988
+ s,
1989
+ li,
1990
+ interpolation,
1991
+ pts,
1992
+ runs: drawableRuns,
1993
+ curveRuns: interpolation === "monotone" ? drawableRuns.map((drawableRun) => monotoneSegments(drawableRun)) : []
1994
+ };
1995
+ }).filter((p) => p.pts.length > 0);
1996
+ }
1997
+ function areaMarks(ctx, plans) {
1998
+ let { domain, area, paints, g } = ctx, areaIds = /* @__PURE__ */ new Map();
1999
+ for (let plan of plans) {
2000
+ if (plan.s.kind !== "area") continue;
2001
+ let y0 = plan.s.axis === "secondary" && domain.secondaryActive ? area.y2(0) : area.y0, d = plan.runs.filter((r) => r.length > 0).map((r, runIndex) => {
2002
+ let top = pathFor2(r, plan.interpolation, plan.curveRuns[runIndex]), first = r[0], last = r[r.length - 1];
2003
+ return `${top}L${round2(last.x)} ${round2(y0)}L${round2(first.x)} ${round2(y0)}Z`;
2004
+ }).join(""), areaNodeId = `mark:area:${plan.s.id}`;
2005
+ g.nodes.push({ t: "path", id: areaNodeId, d, fill: paints.line(plan.s, plan.li), owner: { seriesId: plan.s.id }, part: "area" });
2006
+ for (let r of plan.runs)
2007
+ r.length > 1 && g.areaGrounds.push({ seriesId: plan.s.id, ...screenEdges(drawnStroke(r, plan.interpolation), [{ x: r[0].x, y: y0 }, { x: r[r.length - 1].x, y: y0 }]), paint: paints.line(plan.s, plan.li) });
2008
+ for (let r of plan.runs)
2009
+ for (let i = 0; i + 1 < r.length; i++) {
2010
+ let a = r[i], b = r[i + 1], top = Math.min(a.y, b.y, y0), bot = Math.max(a.y, b.y, y0), half = (b.x - a.x) / 2;
2011
+ for (let [x, ci] of [[a.x, a.ci], [a.x + half, b.ci]])
2012
+ g.claims.claim({ x, y: top, w: half, h: Math.max(bot - top, 3) }, "mark", { seriesId: plan.s.id, categoryId: domain.cats[ci].id }, AREA_FILL_PART);
2013
+ }
2014
+ areaIds.set(plan, areaNodeId);
2015
+ }
2016
+ return areaIds;
2017
+ }
2018
+ function claimLine(claims, plan, catId) {
2019
+ let { s, runs, interpolation } = plan;
2020
+ for (let r of runs)
2021
+ for (let i = 0; i + 1 < r.length; i++) {
2022
+ let a = r[i], b = r[i + 1], owner = { seriesId: s.id, categoryId: catId(a.ci) };
2023
+ if (interpolation === "monotone") {
2024
+ claims.claim({ x: a.x, y: Math.min(a.y, b.y) - 1.5, w: b.x - a.x, h: Math.abs(b.y - a.y) + 3 }, "mark", owner);
2025
+ continue;
2026
+ }
2027
+ let claimPoints = interpolation === "linear" ? [a, b] : [a, interpolation === "step-after" ? { ci: a.ci, x: b.x, y: a.y } : { ci: a.ci, x: a.x, y: b.y }, b];
2028
+ for (let pair = 0; pair + 1 < claimPoints.length; pair++) {
2029
+ let from = claimPoints[pair], to = claimPoints[pair + 1], slices = 6;
2030
+ for (let k = 0; k < slices; k++) {
2031
+ let t0 = k / slices, t1 = (k + 1) / slices, sy0 = from.y + (to.y - from.y) * t0, sy1 = from.y + (to.y - from.y) * t1;
2032
+ claims.claim(
2033
+ {
2034
+ x: Math.min(from.x + (to.x - from.x) * t0, from.x + (to.x - from.x) * t1),
2035
+ y: Math.min(sy0, sy1) - 1.5,
2036
+ w: Math.max(Math.abs((to.x - from.x) * 1 / slices), 1),
2037
+ h: Math.abs(sy1 - sy0) + 3
2038
+ },
2039
+ "mark",
2040
+ owner
2041
+ );
2042
+ }
2043
+ }
2044
+ }
2045
+ }
2046
+ var ANATOMY_DOT_R = 3;
2047
+ function latestPointRing(theme, g, s, point, cats) {
2048
+ if (point === void 0) return;
2049
+ let owner = { seriesId: s.id, categoryId: cats[point.ci].id };
2050
+ g.nodes.push({ t: "circle", id: `latest-ring:${s.id}`, cx: point.x, cy: point.y, r: 4.5, fill: { token: "background" }, stroke: { token: "highlight" }, strokeWidth: strokeToken(theme, "mark"), owner, part: "marker" }), g.nodes.push({ t: "circle", id: `latest-dot:${s.id}`, cx: point.x, cy: point.y, r: 2, fill: { token: "markInk" }, owner, part: "marker" }), g.claims.claim({ x: point.x - 4.5, y: point.y - 4.5, w: 9, h: 9 }, "mark", owner);
2051
+ }
2052
+ function ringedSeries(plans) {
2053
+ let lines = plans.filter((p) => p.s.kind === "line");
2054
+ return (lines.find((p) => p.s.scenario === void 0 || p.s.scenario === "AC") ?? lines[0])?.s.id;
2055
+ }
2056
+ function lineMark(ctx, plan, areaNodeId, ringed) {
2057
+ let { env, domain, paints, g } = ctx, { s, li, pts, runs, interpolation } = plan, { cats } = domain, paint = paints.line(s, li), solidRuns = [], forecastRuns = [];
2058
+ for (let [runIndex, run] of runs.entries()) {
2059
+ let solidCurve = plan.curveRuns[runIndex] ?? [], forecastCurve = [], fcStart = s.scenario === "FC" ? 0 : run.findIndex((point) => s.vals[point.ci].scenario === "FC");
2060
+ fcStart === -1 ? solidRuns.push({ points: run, curve: solidCurve }) : fcStart === 0 ? forecastRuns.push({ points: run, curve: solidCurve }) : (interpolation === "monotone" && ([solidCurve, forecastCurve] = splitCurveSegmentsAtX(solidCurve, run[fcStart - 1].x)), solidRuns.push({ points: run.slice(0, fcStart), curve: solidCurve }), forecastRuns.push({ points: run.slice(fcStart - 1), curve: forecastCurve }));
2061
+ }
2062
+ let drawable = (list) => list.filter((run) => interpolation === "monotone" ? run.curve.length > 0 : run.points.length > 1).map((run) => pathFor2(run.points, interpolation, run.curve)).join(""), d = drawable(solidRuns), fcD = drawable(forecastRuns), nodeId = `mark:line:${s.id}`, fcNodeId = `mark:line:${s.id}:fc`, inkLead = inkLeadLine(env, s, li), lineWidth = paints.lineWidth(s, li), casingWidth = strokeToken(env.theme, "casing"), emitLine = (path, id, forecast) => {
2063
+ if (!path) return;
2064
+ g.nodes.push({ t: "path", id: forecast ? `casing:line:${s.id}:fc` : `casing:line:${s.id}`, d: path, stroke: { token: "background" }, width: casingWidth, owner: { seriesId: s.id }, part: "lineCasing", ...domain.columns.length > 0 ? { overFills: !0 } : {} });
2065
+ let dash = forecast ? dashToken(env.theme, "reference") : paints.dash(s);
2066
+ g.nodes.push({ t: "path", id, d: path, stroke: paint, width: lineWidth, dash, lineCap: dash?.join(",") === dashToken(env.theme, "dotted").join(",") ? "round" : "butt", owner: { seriesId: s.id }, part: "line" }), paints.lineHollow(s) && g.nodes.push({
2067
+ t: "path",
2068
+ id: `${id}:inner`,
2069
+ d: path,
2070
+ stroke: { token: "background" },
2071
+ width: strokeToken(env.theme, "hair"),
2072
+ dash,
2073
+ lineCap: dash?.join(",") === dashToken(env.theme, "dotted").join(",") ? "round" : "butt",
2074
+ owner: { seriesId: s.id },
2075
+ part: "lineInterior"
2076
+ });
2077
+ };
2078
+ emitLine(d, nodeId, !1), emitLine(fcD, fcNodeId, !0), claimLine(g.claims, plan, (ci) => cats[ci].id);
2079
+ let { shape: markerShape, anatomyDots, full } = comboLineMarkers(env, domain, s), markPoints = [];
2080
+ for (let p of pts) {
2081
+ let c = cats[p.ci], markerNodeId;
2082
+ if (markerShape !== "none" && (full || c.partial === !0)) {
2083
+ markerNodeId = `marker:${s.id}:${c.id}`;
2084
+ let hollow = c.partial === !0 || paints.lineHollow(s), markerFill = hollow ? { token: "background" } : paint, owner = { seriesId: s.id, categoryId: c.id }, value = s.vals[p.ci], example = domain.explicitFormatOf(s, value), display = { value: example ? env.byExample(example)(value.v) : value.isPct ? domain.pctFmt(value.v) : domain.scaleFmtOf(s)(value.v) };
2085
+ g.nodes.push(anatomyDots && !hollow ? { t: "circle", id: markerNodeId, cx: p.x, cy: p.y, r: ANATOMY_DOT_R, fill: markerFill, stroke: { token: "background" }, strokeWidth: strokeToken(env.theme, "mark"), owner, part: "marker", display } : markerShape === "square" ? { t: "rect", id: markerNodeId, rect: { x: p.x - 2.75, y: p.y - 2.75, w: 2.75 * 2, h: 2.75 * 2 }, fill: markerFill, ...hollow ? { stroke: paint, strokeWidth: strokeToken(env.theme, "mark") } : {}, owner, part: "marker", display } : markerShape === "triangle" || markerShape === "diamond" ? { t: "path", id: markerNodeId, d: markerPath(markerShape, p), fill: markerFill, ...hollow ? { stroke: paint, width: strokeToken(env.theme, "mark") } : {}, owner, part: "marker", display } : { t: "circle", id: markerNodeId, cx: p.x, cy: p.y, r: 2.75, fill: markerFill, stroke: hollow ? paint : { token: "background" }, strokeWidth: strokeToken(env.theme, "mark"), owner, part: "marker", display });
2086
+ let claimR = markerShape === "triangle" || markerShape === "diamond" ? 4 + (hollow ? strokeToken(env.theme, "mark") / 2 : 0) : 2.75 + 1;
2087
+ g.claims.claim({ x: p.x - claimR, y: p.y - claimR, w: claimR * 2, h: claimR * 2 }, "mark", { seriesId: s.id, categoryId: c.id });
2088
+ }
2089
+ markPoints.push({ categoryId: c.id, x: p.x, y: p.y, markerNodeId });
2090
+ }
2091
+ let latest = domain.options.latestPoint;
2092
+ (latest === void 0 ? inkLead : latest === "ring" && s.id === ringed) && latestPointRing(env.theme, g, s, pts.filter((p) => {
2093
+ let scenario = s.vals[p.ci].scenario ?? s.scenario;
2094
+ return scenario !== "FC" && scenario !== "PL";
2095
+ }).pop(), cats), g.marks.lines.push({
2096
+ seriesId: s.id,
2097
+ kind: s.kind === "area" ? "area" : "line",
2098
+ axis: s.axis === "secondary" && domain.secondaryActive ? "secondary" : "primary",
2099
+ nodeId: d ? nodeId : fcNodeId,
2100
+ ...fcD ? { fcNodeId } : {},
2101
+ areaNodeId,
2102
+ points: markPoints
2103
+ });
2104
+ }
2105
+ function layoutComboMarks(env, domain, area, paints) {
2106
+ let g = {
2107
+ nodes: [],
2108
+ claims: createOccupiedIndex({ x: 0, y: 0, w: env.size.width, h: env.size.height }),
2109
+ axes: [],
2110
+ leftTickX: 1 / 0,
2111
+ marks: { columns: [], lines: [] },
2112
+ segEdges: /* @__PURE__ */ new Map(),
2113
+ yieldingTicks: [],
2114
+ areaGrounds: [],
2115
+ segments: [],
2116
+ plans: [],
2117
+ meanValue: void 0
2118
+ }, ctx = { env, domain, area, paints, g };
2119
+ comboAxes(ctx);
2120
+ let columnStart = g.nodes.length;
2121
+ columnMarks(ctx), g.plans = linePlans(domain, area);
2122
+ let areaStart = g.nodes.length, areaIds = areaMarks(ctx, g.plans);
2123
+ g.nodes.splice(columnStart, 0, ...g.nodes.splice(areaStart));
2124
+ let ringed = domain.options.latestPoint === "ring" ? ringedSeries(g.plans) : void 0;
2125
+ for (let plan of g.plans) lineMark(ctx, plan, areaIds.get(plan), ringed);
2126
+ let { cats, columns, posTop, negBot } = domain;
2127
+ return g.meanValue = domain.columnsAdd ? domain.sourceMean ?? (columns.length > 0 && cats.length > 0 ? cats.reduce((a, _, ci) => a + posTop[ci] + negBot[ci], 0) / cats.length : primaryLineMean(g.plans, domain.secondaryActive)) : void 0, (domain.options.annotations ?? []).forEach((ann, n) => {
2128
+ if (ann.kind !== "valueLine") return;
2129
+ let annId = ann.id ?? `valueLine-${n + 1}`, v = ann.value === "mean" || ann.value === void 0 ? g.meanValue : ann.value;
2130
+ if (v === void 0) return;
2131
+ let ry = ann.axis === "secondary" && domain.secondaryDomain ? area.y2(v) : area.y(v);
2132
+ g.claims.claim(
2133
+ { x: area.plot.x, y: ry - 1, w: area.plot.w, h: 2 },
2134
+ "annotation",
2135
+ { annotationId: annId },
2136
+ "referenceLine"
2137
+ );
2138
+ }), g;
2139
+ }
2140
+
2141
+ // src/core/charts/combo/layout.ts
2142
+ function comboAnomalyMarks(env, domain, anomaly, area, geometry) {
2143
+ let line = geometry.marks.lines.find((mark) => mark.seriesId === anomaly.seriesId), onSecondary = line?.axis === "secondary", series = domain.lines.find((s) => s.id === anomaly.seriesId);
2144
+ return lineAnomalyFurniture(env.theme, {
2145
+ strings: domain.options.strings,
2146
+ anomaly: anomaly.model,
2147
+ corridorShown: anomaly.corridorShown,
2148
+ statFmt: anomaly.statFmt,
2149
+ fmt: domain.scaleFmtOf(series),
2150
+ corridorPaint: columnCorridorPaint(domain.options.colorblindSafe),
2151
+ plot: area.plot,
2152
+ y: onSecondary ? area.y2 : area.y,
2153
+ labelX: area.anomalyLabelX,
2154
+ seriesId: anomaly.seriesId,
2155
+ points: line?.points ?? [],
2156
+ font: area.labelFont,
2157
+ measure: env.measure,
2158
+ nodes: geometry.nodes,
2159
+ claims: geometry.claims
2160
+ });
2161
+ }
2162
+ function annotateCombo(env, domain, area, geometry, occupied, solveCtx, labelRequests) {
2163
+ let { cats, columns, secondaryActive, secondaryDomain } = domain, secondarySeries = domain.lines.filter((series) => series.axis === "secondary"), { band, y, y0, y2, plot } = area, catIndex = new Map(cats.map((c, i) => [c.id, i])), lineById = new Map(domain.lines.map((s) => [s.id, s])), resolveAnchor = (ref) => {
2164
+ let norm = typeof ref == "string" ? { categoryId: ref, edge: "total" } : ref;
2165
+ if (!("categoryId" in norm)) return null;
2166
+ let ci = catIndex.get(norm.categoryId);
2167
+ if (ci === void 0) return null;
2168
+ let c = cats[ci];
2169
+ if (norm.seriesId) {
2170
+ let owner = { categoryId: c.id, seriesId: norm.seriesId }, named = [...columns, ...domain.lines, ...domain.refs].find((s) => s.id === norm.seriesId), series = { format: named?.format, ...named && columns.length + domain.lines.length > 1 ? { series: { id: named.id, label: named.label } } : {} }, reference = domain.refs.find((s) => s.id === norm.seriesId);
2171
+ if (reference && geometry.nodes.some((node) => node.id === `ref:${reference.id}:${c.id}`)) {
2172
+ let v = reference.vals[ci].v;
2173
+ return v === null ? null : { x: band.center(ci), y: y(v), value: v, date: c.date, label: c.label, owner, ...series };
2174
+ }
2175
+ let ls = lineById.get(norm.seriesId);
2176
+ if (ls) {
2177
+ let v = ls.vals[ci].v;
2178
+ if (v === null) return null;
2179
+ let yFor = ls.axis === "secondary" && secondaryActive ? y2 : y;
2180
+ return { x: band.center(ci), y: norm.edge === "start" ? y0 : yFor(v), value: v, date: c.date, label: c.label, owner, lineAnchored: !0, ...series };
2181
+ }
2182
+ let e = geometry.segEdges.get(sk(norm.seriesId, c.id));
2183
+ if (!e) return null;
2184
+ let edge = norm.edge ?? "end", yy = y(edge === "start" ? e.v0 : edge === "end" ? e.v1 : Math.max(e.v0, e.v1));
2185
+ return { x: band.center(ci), y: yy, value: e.v, date: c.date, label: c.label, owner, ...series };
2186
+ }
2187
+ if (columns.length === 0) return null;
2188
+ let topPlotted = domain.posTop[ci] > 0 ? domain.posTop[ci] : domain.negBot[ci];
2189
+ return { x: band.center(ci), y: norm.edge === "start" ? y0 : y(topPlotted), value: domain.stackTotals[c.id], format: columns.length === 1 ? columns[0].format : void 0, ...domain.columnsAdd ? {} : { noValue: NO_STACK_TOTAL }, date: c.date, label: c.label, owner: { categoryId: c.id } };
2190
+ }, lift = area.topPad - area.axisTitles.height - 8, annPlot = { x: plot.x, y: plot.y - lift, w: plot.w, h: plot.h + lift }, ceilingRects = [
2191
+ ...area.axisTitles.height > 0 ? [{ x: area.frame.plot.x, y: area.frame.plot.y, w: area.frame.plot.w, h: area.axisTitles.height }] : [],
2192
+ ...area.valueLineRows.values()
2193
+ ];
2194
+ return runAnnotatePass({
2195
+ target: domain.options.target,
2196
+ // The growth bracket seats its label on its run.
2197
+ cagrLabelOnArm: !0,
2198
+ // Events belong to the event lane.
2199
+ annotations: withoutEvents(domain.options.annotations ?? []),
2200
+ resolve: resolveAnchor,
2201
+ defaultSpan: cats.length >= 2 && columns.length > 0 ? { from: cats[0].id, to: cats[cats.length - 1].id } : void 0,
2202
+ occupied,
2203
+ plot: annPlot,
2204
+ bandCeiling: area.frame.plot.y,
2205
+ ceilingRects,
2206
+ valueLineRows: area.valueLineRows,
2207
+ theme: env.theme,
2208
+ measure: env.measure,
2209
+ format: domain.options.format,
2210
+ locale: domain.options.locale?.language,
2211
+ strings: domain.options.strings,
2212
+ valueLinePercentLevels: domain.options.unit === "%" || percentLevels([...columns, ...domain.lines.filter((series) => series.axis === "primary")]),
2213
+ secondaryPercentLevels: !!domain.options.secondaryAxis?.ruler || secondarySeries.length > 0 && secondarySeries.every((series) => series.unit === "%" || percentLevels([series])),
2214
+ secondaryFormat: secondarySeries.every((series) => series.format === secondarySeries[0]?.format) ? secondarySeries[0]?.format : void 0,
2215
+ solveCtx,
2216
+ labelRequests,
2217
+ yScale: y,
2218
+ ...secondaryDomain ? { ySecondaryScale: y2 } : {},
2219
+ meanValue: geometry.meanValue,
2220
+ ...domain.columnsAdd ? {} : { meanMissing: NO_STACK_MEAN },
2221
+ meanSpan: domain.meanSpan,
2222
+ partialCategories: partialIds(cats),
2223
+ // Category bands for the band annotation, as on column.
2224
+ ...categoryTargetFields(cats.map((c) => c.id), plot, (i) => band.center(i), "x")
2225
+ });
2226
+ }
2227
+ function assembleComboGeometry(input) {
2228
+ let { env, domain, area, geometry, solved, annotated, warnings, lane } = input, { cats, columns, lines, refs, fmt, stackTotals, secondaryDomain } = domain, { frame, catPlan, band, plot, showCatTickRow, strongFont, labelFont, tickFont } = area, catFont = catPlan.font, allLabels = [...solved.placed, ...annotated.labels], nodes = [...frame.nodes, ...geometry.nodes];
2229
+ spliceAnnotationNodes(nodes, annotated.nodes);
2230
+ let lastFill = nodes.reduce((at, node, i) => node.part === "area" ? i : at, -1);
2231
+ if (lastFill >= 0) {
2232
+ let outlines = geometry.areaGrounds.map((ground, k) => ({ id: `${ground.seriesId}:${k}`, seriesId: ground.seriesId, top: [...ground.top], bottom: [...ground.bottom], paint: ground.paint, forecast: !1 })), shaded = fillShadings(nodes, outlines, fillShadingKinds(withoutEvents(domain.options.annotations ?? [])), area.plot, strokeToken(env.theme, "rule"), bandHatch(env.theme, domain.options.hatchStrength)), gap = strokeToken(env.theme, "rule"), gaps = geometry.marks.columns.filter((column) => column.segments.length > 0).map(({ categoryId, rect }) => ({
2233
+ t: "rect",
2234
+ id: `columnGap:${categoryId}`,
2235
+ rect: { x: rect.x - gap, y: rect.y - gap, w: rect.w + 2 * gap, h: rect.h + 2 * gap },
2236
+ fill: { token: "background" },
2237
+ owner: {},
2238
+ part: "columnGap"
2239
+ }));
2240
+ nodes.splice(lastFill + 1, 0, ...shaded.nodes, ...gaps), regroundOnShadings(allLabels, shaded.grounds);
2241
+ }
2242
+ let bandLabelIds = new Set(annotated.placed.filter((ann) => ann.kind === "band").map((ann) => ann.labelId));
2243
+ pushAll(nodes, labelsToNodes(
2244
+ env.theme,
2245
+ allLabels,
2246
+ (l) => l.id.startsWith("forecast:") ? secondaryFont(env.theme) : bandLabelIds.has(l.id) || l.id.startsWith("tick:") ? tickFont : l.kind === "grandTotal" || l.kind === "total" ? strongFont : l.kind === "category" ? area.stairTop !== void 0 ? tickFont : catFont : l.kind === "annotation" || l.kind === "valueLine" ? { ...labelFont, weight: emphasisWeight(env.theme) } : labelFont,
2247
+ nodes
2248
+ )), lane && pushAll(nodes, lane.nodes);
2249
+ let axes = [
2250
+ {
2251
+ axis: "x",
2252
+ baselineNodeId: "axis:baseline",
2253
+ ticks: cats.map((c, i) => ({ at: c.id, pos: band.center(i), labelId: showCatTickRow || area.stairTop !== void 0 ? `category:${c.id}` : void 0 }))
2254
+ },
2255
+ ...geometry.axes
2256
+ ], partsDesc = [
2257
+ columns.length > 0 ? chartString2(domain.options, "stackedColumnSeriesDesc", { v1: columns.length, v2: columns.map((s) => s.label).join(", ") }) : "",
2258
+ lines.length > 0 ? chartString2(domain.options, "lineAreaSeriesDesc", { v1: lines.length, v2: lines.map((s) => s.label).join(", ") }) : "",
2259
+ refs.length > 0 ? chartString2(domain.options, "referenceSeriesCount", { v1: refs.length }) : ""
2260
+ ].filter(Boolean).join(chartString2(domain.options, "plusClause")), totalsAdd = columns.length > 0 && domain.columnsAdd, a11yDesc = chartString2(domain.options, "comboDescStart", { v1: cats.length, v2: partsDesc }) + (domain.secondaryActive ? chartString2(domain.options, "secondaryAxisDesc") : "") + (totalsAdd ? chartString2(domain.options, "columnTotalsSentence", { v1: cats.map((c) => `${c.label ?? c.id} ${fmt(stackTotals[c.id])}`).join(", ") }) : ".") + anomalyA11y({ options: domain.options, anomaly: domain.anomaly, fmt: domain.anomaly ? domain.scaleFmtOf(domain.lines.find((s) => s.id === domain.anomaly.seriesId)) : fmt, cats }), paintWarningRules = [];
2261
+ pushAll(warnings, rectSeriesAdjacentWarnings(nodes, input.paints.css, "vertical", env.highlights, env.theme, { rules: paintWarningRules, before: warnings.filter((warning) => !["pie-ramp-crowded", "likert-ramp-invisible", "band-lightness-insufficient", "series-adjacent-similar", "highlight-reads-as-loss"].includes(warning.code)).length }));
2262
+ let catTickMaxLines = catPlan.maxLines, clearance = domain.options[LINE_BAND_CLEARANCE];
2263
+ return {
2264
+ type: "combo",
2265
+ ...clearance === void 0 ? {} : { [DENSITY_LAYOUT_OPTIONS]: { [LINE_BAND_CLEARANCE]: clearance } },
2266
+ size: env.size,
2267
+ // Bands stretch to the frame, so the layout reports the width its
2268
+ // categories actually want and a host can shrink the canvas to it.
2269
+ sizing: bandSizing("combo", env.size, plot.w, band.step),
2270
+ plot,
2271
+ ...annotated.bandNeed > 0 ? { [BAND_PAD]: annotated.bandNeed } : {},
2272
+ scene: withSegmentSeams(nodes, env.theme),
2273
+ labels: lane ? [...allLabels, ...lane.labels] : allLabels,
2274
+ axes,
2275
+ annotations: lane ? [...annotated.placed, ...lane.placed] : annotated.placed,
2276
+ legend: frame.legend,
2277
+ frame: frame.frame,
2278
+ marks: geometry.marks,
2279
+ derived: {
2280
+ stackTotals: totalsAdd ? stackTotals : {},
2281
+ stackParts: totalsAdd ? stackParts(stackTotals, cats, columns, (si, ci) => columns[si].vals[ci].v) : {},
2282
+ ...domain.roundingAdjustments.length > 0 && contentOf(domain, "segment", ["absolute"])?.includes("percent") ? { roundingAdjustments: domain.roundingAdjustments } : {},
2283
+ ...domain.anomaly ? { anomaly: anomalyReceipt(domain.anomaly.model) } : {},
2284
+ ...secondaryDomain ? { secondaryDomain } : {},
2285
+ ...showCatTickRow ? {
2286
+ tickBand: {
2287
+ reserved: area.catBandH,
2288
+ measuredLines: catTickMaxLines,
2289
+ lineHeight: catFont.size * 1.2,
2290
+ extra: catPlan.rowHeight - catTickMaxLines * catFont.size * 1.2,
2291
+ dateNumeric: area.dateNumericTicks,
2292
+ position: "below"
2293
+ }
2294
+ } : {}
2295
+ },
2296
+ a11y: {
2297
+ title: accessibleTitle(domain.options.title, chartString2(domain.options, "comboTitle", { v1: domain.data.map((s) => s.label).join(", "), v2: cats.length })),
2298
+ counts: [
2299
+ ...domain.anomaly?.model?.counts ?? [],
2300
+ structureCount("categories", cats.length, void 0, domain.options),
2301
+ ...columns.length ? [structureCount("series", columns.length, chartString2(domain.options, "stackedColumnSeriesCount", { v1: columns.length }))] : [],
2302
+ ...lines.length ? [structureCount("series", lines.length, chartString2(domain.options, "lineAreaSeriesCount", { v1: lines.length }))] : [],
2303
+ ...refs.length ? [structureCount("reference-series", refs.length, chartString2(domain.options, "referenceSeriesCount", { v1: refs.length }))] : []
2304
+ ],
2305
+ desc: a11yDesc
2306
+ },
2307
+ warnings,
2308
+ paintWarningRules,
2309
+ debug: {
2310
+ occupied: input.occupied.snapshot(),
2311
+ decisions: [...solved.decisions, ...annotated.decisions]
2312
+ }
2313
+ };
2314
+ }
2315
+ function commitClaims(occupied, phase) {
2316
+ for (let c of phase.snapshot()) occupied.claim(c.rect, c.kind, c.owner, c.part);
2317
+ phase.tickColumns && (occupied.tickColumns = phase.tickColumns);
2318
+ }
2319
+ var CATEGORY_NOTED = /* @__PURE__ */ Symbol("categoryNoted"), UNPRINTED = /* @__PURE__ */ Symbol("unprintedValues");
2320
+ function layoutCombo(data, options = {}, gutterOverride) {
2321
+ let geo = withBandValueNotes(data, withLocaleStrings(options), (next) => {
2322
+ let cur = next, geometry = layoutComboPass(data, cur, gutterOverride);
2323
+ for (let step = 0; step < 2; step++) {
2324
+ let bandNeed = Math.ceil(geometry[BAND_PAD] ?? 0);
2325
+ if (bandNeed <= 0) break;
2326
+ let prevBandPad = cur[BAND_PAD] ?? 0;
2327
+ cur = { ...cur, [BAND_PAD]: prevBandPad + bandNeed }, geometry = layoutComboPass(data, cur, gutterOverride);
2328
+ }
2329
+ return delete geometry[BAND_PAD], geometry;
2330
+ });
2331
+ return Object.assign(geo, { [DEFER_DENSITY_NOTES]: !0 });
2332
+ }
2333
+ function sameMarkArea(a, b) {
2334
+ return ["x", "y", "w", "h"].every((key) => a.plot[key] === b.plot[key]) && a.rightTickX === b.rightTickX && a.band.range.every((value, i) => value === b.band.range[i]) && a.band.bandwidth === b.band.bandwidth && a.band.step === b.band.step && a.y.domain.every((value, i) => value === b.y.domain[i]) && a.y.range.every((value, i) => value === b.y.range[i]) && a.y2.domain.every((value, i) => value === b.y2.domain[i]) && a.y2.range.every((value, i) => value === b.y2.range[i]);
2335
+ }
2336
+ function layoutComboPass(data, options = {}, gutterOverride, noteMarks) {
2337
+ let warnings = [], env = resolveComboEnv(options, warnings), domain = resolveComboDomain(data, options, warnings, env.theme), paints = comboPaints(env, domain);
2338
+ return layoutComboFramePass(data, options, gutterOverride, env, domain, paints, warnings, void 0, noteMarks);
2339
+ }
2340
+ function layoutComboFramePass(data, options, gutterOverride, env, domain, paints, domainWarnings, frameSeed, noteMarks) {
2341
+ let warnings = [...domainWarnings], { size } = env, hasEvents = domain.options.annotations?.some((annotation) => annotation.kind === "event"), solve = (key, out) => {
2342
+ if (hasEvents) return solveComboFrame(env, domain, paints, out, key);
2343
+ let retained = frameSeed && refitComboFrame(env, frameSeed.domain, domain, frameSeed.framed);
2344
+ if (retained)
2345
+ frameSeed = { ...frameSeed, domain, framed: retained };
2346
+ else {
2347
+ let frameWarnings = [];
2348
+ frameSeed = { domain, framed: solveComboFrame(env, domain, paints, frameWarnings, key), warnings: frameWarnings };
2349
+ }
2350
+ pushAll(out, frameSeed.warnings);
2351
+ let framed = frameSeed.framed;
2352
+ return { ...framed, frame: { ...framed.frame, frame: copyFrame(framed.frame.frame) } };
2353
+ }, settle = () => settleEventLane({
2354
+ annotations: domain.options.annotations ?? [],
2355
+ categories: domain.cats,
2356
+ events: options.events,
2357
+ language: options.locale?.language,
2358
+ inline: !1,
2359
+ footnotesOff: options.footnotesOff,
2360
+ theme: env.theme,
2361
+ measure: env.measure,
2362
+ size,
2363
+ compact: options.mode === "compact",
2364
+ solve,
2365
+ area: (framed, w) => comboPlotArea(env, domain, paints, framed, gutterOverride, w),
2366
+ axis: (area2) => ({ x: (ci) => area2.band.center(ci), step: area2.band.step, plot: area2.plot }),
2367
+ warnings
2368
+ }), settled = settle(), area = settled.area;
2369
+ if (options[LINE_BAND_CLEARANCE] === void 0) {
2370
+ let scaleH = area.y(domain.dLo) - area.y(domain.dHi), mode = comboValueLabels(options, domain.anatomy, domain.cats.length), interiorValues = mode === "all" || mode === "extremes" || domain.anomaly !== void 0, clearance = domain.anatomy && domain.columns.length === 1 && !domain.anomaly && domain.cats.every((c) => env.measure(domain.fmt(domain.stackTotals[c.id] ?? 0), area.labelFont).width + 4 <= area.band.bandwidth) ? 2.75 + 8 : area.gtH + (interiorValues ? env.measure("0", area.labelFont).height + 14 : 8) + (domain.anomaly ? ANOMALY_FLAG_GAP + ANOMALY_FLAG_H : 0);
2371
+ if (scaleH > 0 && domain.secondaryActive && domain.columns.length > 0) {
2372
+ let measured = clearance / scaleH, next = domain.withLineBandClearance?.(measured);
2373
+ options = { ...options, [LINE_BAND_CLEARANCE]: measured }, next && (domain = next.domain, domainWarnings = next.warnings, warnings.length = 0, pushAll(warnings, domainWarnings)), domain.options = { ...domain.options, [LINE_BAND_CLEARANCE]: measured }, next && (settled = settle(), area = settled.area);
2374
+ }
2375
+ }
2376
+ let occupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height });
2377
+ commitClaims(occupied, settled.framed.claims);
2378
+ let categoryNotes = area.showCatTickRow ? area.catPlan.step === "ranks" ? rankNotes(domain.cats.map((c) => c.label ?? c.id), domain.options) : area.catPlan.cutNotes : [], noted = options[CATEGORY_NOTED] === !0, printed = options[POINTED_NOTES] ?? [];
2379
+ if (categoryNotes.length > 0 && !noted) {
2380
+ let current = authoredNotes(options), authored = options.authoredFootnotes ?? current;
2381
+ return layoutComboPass(data, { ...withAuthoredFootnotes(options, [...current, ...categoryNotes], authored), [CATEGORY_NOTED]: !0, [POINTED_NOTES]: categoryNotes, ...area.catPlan.step === "ranks" ? { [FORCE_CATEGORY_RANKS]: !0 } : {} }, gutterOverride);
2382
+ }
2383
+ if (noted && categoryNotesDiffer(categoryNotes, printed) && options[FORCE_CATEGORY_RANKS] !== !0) {
2384
+ let keyed = rankNotes(domain.cats.map((c) => c.label ?? c.id), domain.options), current = authoredNotes(options).filter((note) => !printed.includes(note)), authored = options.authoredFootnotes ?? current;
2385
+ return layoutComboPass(data, { ...withAuthoredFootnotes(options, [...current, ...keyed], authored), [POINTED_NOTES]: keyed, [FORCE_CATEGORY_RANKS]: !0 }, gutterOverride);
2386
+ }
2387
+ let marks = noteMarks && sameMarkArea(noteMarks.area, area) ? {
2388
+ ...noteMarks.geometry,
2389
+ // The note retry normalizes fresh series. Paint decisions can use
2390
+ // series identity, so retained positions must refer to those series.
2391
+ segments: noteMarks.geometry.segments.map((segment) => ({ ...segment, s: domain.columns[segment.si] })),
2392
+ plans: noteMarks.geometry.plans.map((plan) => ({ ...plan, s: domain.lines[plan.li] }))
2393
+ } : layoutComboMarks(env, domain, area, paints), geometry = { ...marks, nodes: [...marks.nodes] };
2394
+ domain.anomaly && (geometry.claims = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), commitClaims(geometry.claims, marks.claims));
2395
+ let anomalyMarks = domain.anomaly ? comboAnomalyMarks(env, domain, domain.anomaly, area, geometry) : void 0;
2396
+ commitClaims(occupied, geometry.claims);
2397
+ let requests = planComboLabels(env, domain, area, geometry, paints, warnings), stair = area.stairTop === void 0 ? void 0 : seatStaircase({
2398
+ categories: domain.cats,
2399
+ band: area.band,
2400
+ top: area.stairTop,
2401
+ left: area.plot.x,
2402
+ right: area.plot.x + area.plot.w,
2403
+ floor: area.y0,
2404
+ above: domain.options.labels !== !1 ? area.gtH + 4 : 0,
2405
+ font: area.tickFont,
2406
+ measure: env.measure,
2407
+ tops: domain.posTop,
2408
+ options,
2409
+ cap: STAIRCASE_MAX_PAD * area.frame.plot.h,
2410
+ occupied,
2411
+ requests
2412
+ }), centre = (ci) => area.band.center(ci), dividerTop = area.forecastHeaderY + env.measure(options.strings.forecastHeader, secondaryFont(env.theme)).height + 8, divided = { ...area.plot, y: dividerTop, h: area.plot.y + area.plot.h - dividerTop };
2413
+ placeForecastHeaders(area.forecast, centre, divided, area.forecastHeaderY, secondaryFont(env.theme), env.measure, requests, occupied, options.strings.forecastHeader, "band"), emitForecastDividers(env.theme, area.forecast, centre, divided, geometry.nodes, "band"), anomalyMarks && seatFlaggedValues(requests, domain.anomaly.seriesId, anomalyMarks, geometry.segments.map((segment) => segment.rect));
2414
+ let densityValues = options[DENSITY_VALUES];
2415
+ for (let request of requests) densityValues?.has(request.id) && ["point", "grandTotal"].includes(request.kind) && (request.redundant = !0, request.suppressedAs = "density");
2416
+ let solveCtx = {
2417
+ focus: options.focus,
2418
+ density: env.density,
2419
+ pins: options.labelPlacements ?? {},
2420
+ measure: env.measure,
2421
+ plot: area.plot,
2422
+ canvas: { x: 0, y: 0, w: size.width, h: size.height },
2423
+ darkInk: env.theme.color.ink,
2424
+ lightInk: env.theme.color.inkInverse,
2425
+ labelPad: 2,
2426
+ // A line or area value reads as its own point's (label/ownership.ts).
2427
+ pointOwnership: {
2428
+ points: geometry.plans.flatMap((plan) => plan.pts.map((p) => ({ seriesId: plan.s.id, categoryId: domain.cats[p.ci].id, x: p.x, y: p.y }))),
2429
+ categoryX: new Map(domain.cats.map((c, ci) => [c.id, area.band.center(ci)]))
2430
+ }
2431
+ }, annotatedFirst = (domain.options.annotations ?? []).some((annotation) => annotation.kind === "valueLine") ? annotateCombo(env, domain, area, geometry, occupied, solveCtx, requests) : void 0, chartIds = new Set(requests.map((request) => request.id)), solved = annotatedFirst ? { placed: annotatedFirst.labels.filter((label) => chartIds.has(label.id)), decisions: annotatedFirst.decisions.filter((decision) => chartIds.has(decision.labelId)), warnings: [] } : solveLabels(requests, occupied, solveCtx);
2432
+ annotatedFirst && (annotatedFirst.labels = annotatedFirst.labels.filter((label) => !chartIds.has(label.id)), annotatedFirst.decisions = annotatedFirst.decisions.filter((decision) => !chartIds.has(decision.labelId)));
2433
+ let staircase = runStaircase(env.theme, options.categoryLabels, options, stair, solved.placed, occupied, geometry.nodes, warnings), nextStair = nextStaircase(options, staircase);
2434
+ if (nextStair) return layoutComboPass(data, { ...options, [STAIRCASE]: nextStair }, gutterOverride);
2435
+ let toDate = toDateOnTotals(env, domain);
2436
+ if (toDate.size > 0 && (!toDateFits(options.strings?.toDate ?? chartString2(options, "toDate"), env.theme, env.measure, toDateRoom(area.band.bandwidth)) || solved.placed.some((l) => l.kind === "grandTotal" && l.hidden !== void 0 && toDate.has(l.owner.categoryId ?? ""))))
2437
+ return layoutComboPass(data, { ...options, [PARTIAL_KEY]: !0 }, gutterOverride);
2438
+ if (!domain.showPrimaryAxis && domain.options.valueAxis?.show === void 0 && solved.placed.some((l) => (l.kind === "grandTotal" || domain.ticksFromLabels === !0 && l.kind === "point") && l.hidden !== void 0 && l.hidden !== "redundant"))
2439
+ return layoutComboPass(data, { ...options, [TOTALS_AXIS]: !0 }, gutterOverride);
2440
+ if (!options[FIRST_END_BELOW_TOTALS] && options[INSIDE_ENDPOINT_IDS] === void 0) {
2441
+ let ends = new Set([...area.first, ...area.last].map(([id, end]) => `point:${id}:${domain.cats[end.ci].id}`)), pastPlot = (label) => label.hidden === void 0 && String(label.slot).includes("PastColumn") && (label.rect.x < area.plot.x - 0.5 || label.rect.x + label.rect.w > area.plot.x + area.plot.w + 0.5), missing = solved.placed.filter((label) => ends.has(label.id) && (label.hidden === "collision" || pastPlot(label))).map((label) => label.id);
2442
+ if (missing.length) {
2443
+ let ids = new Set(missing), room = insideEndpointGutters({
2444
+ ids,
2445
+ first: area.first,
2446
+ last: area.last,
2447
+ cats: domain.cats,
2448
+ width: area.endpointWidth,
2449
+ font: area.labelFont,
2450
+ measure: env.measure,
2451
+ markerR: 2.75
2452
+ });
2453
+ if (options = { ...options, [INSIDE_ENDPOINT_IDS]: ids }, domain.options = { ...domain.options, [INSIDE_ENDPOINT_IDS]: ids }, room.first > 0 || room.last > 0) return layoutComboFramePass(data, options, gutterOverride, env, domain, paints, domainWarnings, frameSeed);
2454
+ }
2455
+ }
2456
+ let gutters = gutterOverride ? void 0 : unusedEndpointGutters(area.gutters, solved, area.plot);
2457
+ if (gutters) return layoutComboPass(data, domain.options, gutters);
2458
+ let catIndex = (l) => domain.cats.findIndex((c) => c.id === l.owner.categoryId), segmentOwed = (l) => l.id.startsWith("segment:") && l.hidden !== void 0 && l.noteText !== void 0 && l.printedIn === void 0, unprinted = solved.placed.filter((l) => l.id.startsWith("tick:") && l.hidden !== void 0 && l.hidden !== "redundant" || segmentOwed(l));
2459
+ if (unprinted.length > 0 && options.footnotesOff !== !0) {
2460
+ let catLabel = (id) => domain.cats.find((c) => c.id === id)?.label ?? id, prior = options[UNPRINTED] ?? { named: /* @__PURE__ */ new Map(), runs: 0 }, named = new Map(prior.named);
2461
+ for (let l of unprinted) named.has(l.id) || named.set(l.id, [catIndex(l), l.noteText ?? `${l.text} (${catLabel(l.owner.categoryId)})`]);
2462
+ if (named.size > prior.named.size && prior.runs < 3) {
2463
+ let current = authoredNotes(options).filter((line) => !line.startsWith(options.strings.valuesNotBesideMarks)), valueCount = solved.placed.filter((l) => l.id.startsWith("tick:") || l.id.startsWith("segment:")).length, note = noteLine(options.strings.valuesNotBesideMarks, [...named.values()].sort((a, b) => a[0] - b[0]).map(([, item]) => item), options, valueCount), authored = options.authoredFootnotes ?? current;
2464
+ return layoutComboPass(data, { ...withAuthoredFootnotes(options, [...current, ...note], authored), [UNPRINTED]: { named, runs: prior.runs + 1 } }, gutterOverride, { area, geometry: marks });
2465
+ }
2466
+ let inNote = new Set(unprinted.filter((l) => prior.named.has(l.id)).map((l) => `label '${l.id}'`));
2467
+ solved.warnings = solved.warnings.filter((w) => !(w.code === "label-hidden" && [...inNote].some((key) => w.message.startsWith(key))));
2468
+ }
2469
+ let notedIds = options[UNPRINTED]?.named, countedIds = notedIds ? new Set([...notedIds].sort((a, b) => a[1][0] - b[1][0]).slice(noteCap(options, notedIds.size)).map(([id]) => id)) : void 0;
2470
+ for (let label of solved.placed) notedIds?.has(label.id) && (label.hidden === void 0 && (label.hidden = "note"), label.noted = !0, countedIds?.has(label.id) && (label.noteCounted = !0));
2471
+ flagDroppedEndpointLabels(solved);
2472
+ for (let label of solved.placed) label.id.startsWith("tick:") && !label.hidden && (label.ink = { token: "inkMuted" });
2473
+ let crossed = haloOverRules(solved.placed, occupied, /* @__PURE__ */ new Set(["referenceLine", "valueLine"]));
2474
+ applyComboAxisTitlePaint(solved.placed, area.axisTitles), geometry.nodes.push(...comboAxisTitleSwatches(env.theme, solved.placed, area.axisTitles, occupied)), applyGrowthInk(solved.placed, area), pushAll(warnings, solved.warnings);
2475
+ let annotated = annotatedFirst ?? annotateCombo(env, domain, area, geometry, occupied, solveCtx);
2476
+ for (let id of haloOverRules(solved.placed, occupied, /* @__PURE__ */ new Set(["referenceLine", "valueLine"]))) crossed.add(id);
2477
+ if (!(VALUE_LINE_RESERVE in options)) {
2478
+ let reserve = hiddenValueLineReserve(annotated.labels.filter((l) => l.slots.includes("insideStart")), (text) => env.measure(text, { ...area.labelFont, weight: emphasisWeight(env.theme) }).width, size.width);
2479
+ if (reserve > 0) return layoutComboPass(data, { ...options, [VALUE_LINE_RESERVE]: reserve }, gutterOverride);
2480
+ }
2481
+ pushAll(warnings, annotated.warnings);
2482
+ for (let tick of geometry.yieldingTicks) {
2483
+ let label = annotated.labels.find((l) => l.id === `valueLine:${tick.annotationId}` && !l.hidden);
2484
+ if (!(!label || !rectsOverlap(label.rect, tick.rect))) {
2485
+ geometry.nodes = geometry.nodes.filter((node) => node.id !== tick.labelId);
2486
+ for (let axis of geometry.axes) for (let t of axis.ticks) t.labelId === tick.labelId && delete t.labelId;
2487
+ }
2488
+ }
2489
+ let lane = settled.lane ? emitEventLane(env.theme, {
2490
+ ...settled.lane,
2491
+ axis: { x: (ci) => area.band.center(ci), step: area.band.step, plot: area.plot },
2492
+ mode: "stop",
2493
+ baseline: area.plot.y + area.plot.h,
2494
+ occupied,
2495
+ solveCtx
2496
+ }) : void 0;
2497
+ lane && pushAll(warnings, lane.warnings);
2498
+ let assembled = assembleComboGeometry({ env, domain, area, paints, geometry, solved, annotated, occupied, warnings, lane });
2499
+ return assembled.scene = raiseOverRules(assembled.scene, crossed), assembled;
2500
+ }
2501
+
2502
+ export {
2503
+ FIRST_END_BELOW_TOTALS,
2504
+ comboDrawsSecondaryAxis,
2505
+ SECONDARY_FULL_DOMAIN,
2506
+ HIGHLIGHT_KEY,
2507
+ layoutCombo
2508
+ };