boardplot 0.56.0 → 0.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (552) hide show
  1. package/CHANGELOG.md +408 -0
  2. package/README.md +49 -15
  3. package/dist/{DiagnosticDetails-JFBBXOT2.js → DiagnosticDetails-VGSL4NJK.js} +1 -1
  4. package/dist/{ReaderBox-GLCKYXBU.js → ReaderBox-MHMXIDAJ.js} +8 -7
  5. package/dist/{annotateEngine-QVNAE3EH.js → annotateEngine-753KQBNN.js} +2 -1
  6. package/dist/build-identity.json +3 -3
  7. package/dist/{chunk-HZUAEMN5.js → chunk-2CQBBN7M.js} +4 -4
  8. package/dist/{chunk-K3VZ5QJK.js → chunk-2ETK5TSA.js} +4 -4
  9. package/dist/{chunk-HHXIVFAU.js → chunk-2ETSI2EL.js} +11 -9
  10. package/dist/{chunk-ECBUFKCP.js → chunk-2GRXHWRH.js} +3 -3
  11. package/dist/{chunk-ZVM5TFGR.js → chunk-2HII2B6S.js} +6 -2
  12. package/dist/{chunk-WBETBGSC.js → chunk-2LC2H3ZM.js} +1003 -907
  13. package/dist/chunk-2NX7EO7H.js +23 -0
  14. package/dist/{chunk-52WNCUIN.js → chunk-2QI2PK2O.js} +1 -1
  15. package/dist/{chunk-QWCLWFKC.js → chunk-2VKQQLP7.js} +180 -58
  16. package/dist/chunk-3DOVXJ6K.js +602 -0
  17. package/dist/{chunk-CAJ54IEP.js → chunk-3E6NLODZ.js} +1 -1
  18. package/dist/{chunk-MOS6WFWM.js → chunk-3HA4IJTO.js} +9 -9
  19. package/dist/{chunk-JCIXYOND.js → chunk-3HPPTQEW.js} +4 -4
  20. package/dist/{chunk-7VVHTOE7.js → chunk-3KT2647F.js} +4 -2
  21. package/dist/{chunk-O6ZTIDWB.js → chunk-3MFVJMP6.js} +3 -2
  22. package/dist/{chunk-KQCKK3LD.js → chunk-3P3FKPFN.js} +170 -73
  23. package/dist/{chunk-WI5VOSQX.js → chunk-3XAJSMYD.js} +2 -2
  24. package/dist/{chunk-CPGASWNN.js → chunk-42QKUSHJ.js} +13 -3
  25. package/dist/{chunk-QB5HV4IY.js → chunk-44JU3VOT.js} +7 -8
  26. package/dist/{chunk-BYCJ6TKI.js → chunk-44K75CYE.js} +3 -3
  27. package/dist/{chunk-MS7O3KDJ.js → chunk-4FNM4D57.js} +6 -6
  28. package/dist/{chunk-BVYIKLQ5.js → chunk-4ROZ4TFL.js} +1 -1
  29. package/dist/{chunk-3V62N3Z7.js → chunk-4VV3KUFT.js} +7 -8
  30. package/dist/{chunk-MAFPVR4G.js → chunk-54YO56IK.js} +10 -5
  31. package/dist/{chunk-JMGB444D.js → chunk-5ACFYNA4.js} +8 -4
  32. package/dist/{chunk-6AMN7IKJ.js → chunk-5JEU6MWC.js} +49 -28
  33. package/dist/{chunk-NCLRZQR6.js → chunk-5JIB4VJA.js} +18 -10
  34. package/dist/{chunk-SXD3OYAR.js → chunk-5OP3E2ZD.js} +205 -96
  35. package/dist/{chunk-SS4YGK3E.js → chunk-5SLBD4BT.js} +72 -304
  36. package/dist/{chunk-XMP2DNLI.js → chunk-5SVGTQTW.js} +4 -4
  37. package/dist/chunk-5U567TYU.js +23 -0
  38. package/dist/chunk-5ZLF4S7X.js +40 -0
  39. package/dist/{chunk-T2YDWT54.js → chunk-5ZMTQATF.js} +261 -147
  40. package/dist/{chunk-WXJ5MHLH.js → chunk-62BDQTO6.js} +2 -2
  41. package/dist/chunk-64K3V4VN.js +25 -0
  42. package/dist/{chunk-BK6P6KMW.js → chunk-67YJJJIB.js} +1 -1
  43. package/dist/{chunk-32LLDRPI.js → chunk-6DJNFT2K.js} +42 -32
  44. package/dist/{chunk-JYAZPMSA.js → chunk-6IUK6PAH.js} +7 -6
  45. package/dist/{chunk-7STMIK2X.js → chunk-6JFQCVNN.js} +4 -4
  46. package/dist/chunk-6JXBLQJ2.js +32 -0
  47. package/dist/{chunk-5TWY3ZIC.js → chunk-6XPV6M3Q.js} +5 -5
  48. package/dist/{chunk-MPO5TVGF.js → chunk-6ZDSEITW.js} +3 -3
  49. package/dist/{chunk-75WIUG2W.js → chunk-72HVDLMT.js} +172 -78
  50. package/dist/chunk-75NU5RLX.js +24 -0
  51. package/dist/chunk-76GPN6AT.js +72 -0
  52. package/dist/chunk-7BQK2UDV.js +13 -0
  53. package/dist/{chunk-CF4NMRN7.js → chunk-7CAYRPJV.js} +45 -25
  54. package/dist/{chunk-U3A6FMSI.js → chunk-7GWWBHVQ.js} +7 -7
  55. package/dist/{chunk-CHAS5A5B.js → chunk-7NYUFMLJ.js} +149 -86
  56. package/dist/{chunk-D2B3KP35.js → chunk-7VWXXBTC.js} +4 -0
  57. package/dist/chunk-A65B23JK.js +113 -0
  58. package/dist/{chunk-4KMZAK6J.js → chunk-A7R6FUS6.js} +4 -4
  59. package/dist/{chunk-E2ZUBP4Q.js → chunk-AEVGUOPB.js} +7 -8
  60. package/dist/chunk-AHIK2N72.js +53 -0
  61. package/dist/{chunk-KLB2QC24.js → chunk-AICO24HJ.js} +5 -2
  62. package/dist/{chunk-7KSUMFBK.js → chunk-AJGSCVVW.js} +5 -1
  63. package/dist/{chunk-RSCRIWAH.js → chunk-AL62JJTB.js} +10 -3
  64. package/dist/{chunk-E7V3OHQQ.js → chunk-AN2V2LC4.js} +37 -22
  65. package/dist/{chunk-JIEVDGAF.js → chunk-AOFUA5XP.js} +1 -1
  66. package/dist/chunk-B5A7X2BA.js +44 -0
  67. package/dist/{chunk-2HTYGMMG.js → chunk-BCMEGJRX.js} +2 -2
  68. package/dist/{chunk-KD5GOR2K.js → chunk-BDIKWR45.js} +124 -69
  69. package/dist/{chunk-FNRPQIQE.js → chunk-BG6AIWAK.js} +4 -6
  70. package/dist/{chunk-ZMPH2OC4.js → chunk-BOT6W3VB.js} +7 -8
  71. package/dist/{chunk-DRHQG44U.js → chunk-BQBD6Q5J.js} +6 -2
  72. package/dist/{chunk-2DOEZ5QY.js → chunk-BZ67BJBH.js} +11 -10
  73. package/dist/{chunk-UBCVBBJJ.js → chunk-C47POAC5.js} +4 -3
  74. package/dist/{chunk-O7REHICC.js → chunk-C5OBPO4Z.js} +36 -28
  75. package/dist/{chunk-IGNBQT23.js → chunk-CCAAI56H.js} +121 -10
  76. package/dist/{chunk-RPIKNMZA.js → chunk-CDUR3KWV.js} +7 -2
  77. package/dist/{chunk-MZACASZY.js → chunk-CMPHT2LS.js} +14 -2
  78. package/dist/{chunk-FHA3KMFC.js → chunk-CQBPNE7Z.js} +5 -1
  79. package/dist/{chunk-IVRYF7QA.js → chunk-CR5FP5SF.js} +1 -1
  80. package/dist/{chunk-DD6RVD3S.js → chunk-D2TQX7UJ.js} +5 -1
  81. package/dist/{chunk-VVXKFU72.js → chunk-DEANHDXU.js} +62 -41
  82. package/dist/{chunk-GM3EGUYW.js → chunk-DHGE46UK.js} +1 -1
  83. package/dist/{chunk-UZTQUPTB.js → chunk-DIHX6NUB.js} +5 -5
  84. package/dist/{chunk-MD6DCQMA.js → chunk-DILQ34NW.js} +37 -37
  85. package/dist/{chunk-YMTXTQCN.js → chunk-DJKRYJP7.js} +6 -6
  86. package/dist/{chunk-JCAGVAB3.js → chunk-DKLC6QLF.js} +1200 -21
  87. package/dist/{chunk-SRAV6FPB.js → chunk-DNHTMCUP.js} +3 -3
  88. package/dist/{chunk-CKGSGRP7.js → chunk-DORE2RHL.js} +21 -5
  89. package/dist/{chunk-SMHZXHHD.js → chunk-DZYTXZNS.js} +15 -5
  90. package/dist/chunk-E262NRFP.js +39 -0
  91. package/dist/{chunk-V5JQQMFQ.js → chunk-E5YF236N.js} +4 -1
  92. package/dist/{chunk-IGJ2G5C6.js → chunk-EBUK7HJP.js} +6 -6
  93. package/dist/{chunk-ZL6IHMOW.js → chunk-ECBHC272.js} +198 -119
  94. package/dist/{chunk-SA46CNMS.js → chunk-ED7GLWTF.js} +4 -1
  95. package/dist/chunk-EFW43JQJ.js +24 -0
  96. package/dist/{chunk-5P2TTHBZ.js → chunk-EHRRHSPV.js} +2 -2
  97. package/dist/{chunk-JXBZIJCG.js → chunk-EILNJQMN.js} +32 -12
  98. package/dist/{chunk-GELSK76Y.js → chunk-ERDKMZ7O.js} +3 -3
  99. package/dist/{chunk-T2CYNDYU.js → chunk-ETRAPN5G.js} +366 -130
  100. package/dist/{chunk-JEUL777U.js → chunk-ETUKDEGL.js} +21 -12
  101. package/dist/chunk-F2ET5ZTT.js +49 -0
  102. package/dist/{chunk-2YO4WRJN.js → chunk-F3XOBFS4.js} +40 -29
  103. package/dist/{chunk-SPSGUFTI.js → chunk-FB6X7QHA.js} +1 -1
  104. package/dist/{chunk-5PPQIF4D.js → chunk-FGW54I23.js} +7 -8
  105. package/dist/{chunk-JTC5SEAQ.js → chunk-FP5B5XIL.js} +7 -3
  106. package/dist/{chunk-RJGCYGC3.js → chunk-FRHQGA5Q.js} +86 -250
  107. package/dist/{chunk-YZZLIYPA.js → chunk-FRR7BJ3B.js} +5 -1
  108. package/dist/{chunk-4DZFR52I.js → chunk-FVWHEM2N.js} +7 -5
  109. package/dist/{chunk-YPYD6OJ3.js → chunk-FWSMENKH.js} +2 -2
  110. package/dist/{chunk-YYJORENB.js → chunk-FWTUGNSF.js} +8 -8
  111. package/dist/{chunk-GIHH6VC2.js → chunk-FZKDZQ6U.js} +10 -6
  112. package/dist/{chunk-S7NRL66K.js → chunk-G4FF6G3I.js} +26 -17
  113. package/dist/{chunk-PQLAZEQV.js → chunk-GB6BZSTL.js} +248 -92
  114. package/dist/chunk-GCIHRRDJ.js +24 -0
  115. package/dist/{chunk-X3KCQEYZ.js → chunk-GHCU6OSE.js} +9 -1
  116. package/dist/chunk-GKDUIDU6.js +138 -0
  117. package/dist/chunk-GO66OCN7.js +24 -0
  118. package/dist/chunk-GOFS336W.js +24 -0
  119. package/dist/{chunk-AGDDH6XY.js → chunk-GQYT7G4F.js} +5 -1
  120. package/dist/{chunk-WN3HEU3P.js → chunk-GUTLXO7Q.js} +140 -89
  121. package/dist/chunk-H3VICNTN.js +47 -0
  122. package/dist/{chunk-GC4WOLV3.js → chunk-HAG3K6PQ.js} +14 -2
  123. package/dist/{chunk-CB4CERXZ.js → chunk-HBQHSZ6S.js} +11 -2
  124. package/dist/chunk-HTQGJQZN.js +124 -0
  125. package/dist/{chunk-F77TMAUY.js → chunk-HUQRO6VF.js} +39 -36
  126. package/dist/{chunk-4KQHKPB3.js → chunk-I5VDW2XZ.js} +543 -509
  127. package/dist/{chunk-43GGVT7W.js → chunk-I5VNHDPR.js} +11 -4
  128. package/dist/{chunk-4LTN7SND.js → chunk-IDXYHDQY.js} +1 -1
  129. package/dist/{chunk-Y54LU4CU.js → chunk-IIWZJ5ZM.js} +1 -1
  130. package/dist/{chunk-FMDNJ6PC.js → chunk-IPBOREIY.js} +2 -2
  131. package/dist/chunk-IU335UO7.js +27 -0
  132. package/dist/{chunk-JVZTKQFS.js → chunk-IVDTP6SV.js} +9 -5
  133. package/dist/{chunk-BDGLMWPO.js → chunk-IXOBDDMW.js} +11 -2
  134. package/dist/{chunk-EIL3KHAL.js → chunk-J4QRB6DQ.js} +5 -5
  135. package/dist/{chunk-3465633G.js → chunk-JCMGKQVS.js} +3 -3
  136. package/dist/{chunk-YK2KWNTU.js → chunk-JM7UTLF3.js} +28 -14
  137. package/dist/{chunk-CXETOLPX.js → chunk-JNDWRV34.js} +4 -4
  138. package/dist/{chunk-DLUNQHFO.js → chunk-JSRQTDZZ.js} +26 -24
  139. package/dist/{chunk-WTQAG2OT.js → chunk-JT3UTEWZ.js} +8 -3
  140. package/dist/{chunk-GQT2SY2S.js → chunk-JUYRDZSV.js} +291 -151
  141. package/dist/{chunk-LKMFMNQX.js → chunk-JVGL2SCN.js} +1 -1
  142. package/dist/{chunk-4JC3SE4G.js → chunk-JY4LTPOV.js} +1 -1
  143. package/dist/chunk-K7XPTQBJ.js +267 -0
  144. package/dist/{chunk-P4SMC4BY.js → chunk-KGBUXMFP.js} +120 -86
  145. package/dist/{chunk-XC5IRUEL.js → chunk-KIE5V3DA.js} +2 -2
  146. package/dist/{chunk-RT66UTLJ.js → chunk-KU4PCG4W.js} +2 -2
  147. package/dist/{chunk-VPL3JYC6.js → chunk-KVBLTAO7.js} +52 -10
  148. package/dist/{chunk-XCROSJ2Z.js → chunk-KW4JXWHO.js} +1 -1
  149. package/dist/{chunk-PJBEJR2U.js → chunk-KWIP5YRA.js} +24 -7
  150. package/dist/{chunk-JYBT2JNY.js → chunk-LE3LSEUL.js} +27 -2
  151. package/dist/{chunk-R2IKOLBK.js → chunk-LG6M2JTH.js} +3 -3
  152. package/dist/{chunk-DF3XEFQ7.js → chunk-LIE2WSB4.js} +21 -18
  153. package/dist/{chunk-Z55DXFWS.js → chunk-LJDATBPB.js} +26 -16
  154. package/dist/{chunk-KLIZXSBK.js → chunk-LMMS675D.js} +10 -9
  155. package/dist/{chunk-MRAP2UVV.js → chunk-LPKGZ664.js} +286 -35
  156. package/dist/{chunk-JFFREZGT.js → chunk-LPMSGO7L.js} +6 -2
  157. package/dist/chunk-LQWINE7K.js +211 -0
  158. package/dist/{chunk-6MJUW5R5.js → chunk-MKMMQDIY.js} +139 -71
  159. package/dist/{chunk-F5BYLT3M.js → chunk-MQ4IEDM5.js} +462 -138
  160. package/dist/{chunk-QGFKSDQO.js → chunk-MRM4KJ2O.js} +2 -2
  161. package/dist/{chunk-ETMHDCEH.js → chunk-MX2OZHIT.js} +102 -42
  162. package/dist/{chunk-6EYTD777.js → chunk-MXUPMGRY.js} +2 -2
  163. package/dist/{chunk-2FKEF2AC.js → chunk-NHU26HQ7.js} +58 -35
  164. package/dist/{chunk-KBJMLXNW.js → chunk-NQVJ4FPY.js} +161 -78
  165. package/dist/chunk-NZ7FX3AE.js +65 -0
  166. package/dist/chunk-OALBVELJ.js +23 -0
  167. package/dist/{chunk-5S3JQ5AT.js → chunk-OGZ4UPYK.js} +183 -137
  168. package/dist/{chunk-6WHWXCHJ.js → chunk-OMNB27GM.js} +7 -3
  169. package/dist/{chunk-EGGDPDYJ.js → chunk-OO63YP35.js} +1 -1
  170. package/dist/{chunk-ZYQYX66L.js → chunk-OPYDTW5Q.js} +6 -6
  171. package/dist/{chunk-A2GAWGVJ.js → chunk-OSJN7KDS.js} +68 -39
  172. package/dist/{chunk-RMC4OONA.js → chunk-OSJXIW6I.js} +1030 -1123
  173. package/dist/{chunk-X23SZHV5.js → chunk-OVVE42P4.js} +6 -6
  174. package/dist/{chunk-CCJP6QZO.js → chunk-OZA7HA6L.js} +1 -1
  175. package/dist/chunk-OZLKEBCD.js +54 -0
  176. package/dist/{chunk-TE4M52AA.js → chunk-P6DEFCMQ.js} +18 -2
  177. package/dist/{chunk-AMR4SUAN.js → chunk-PDTIQL3B.js} +6 -6
  178. package/dist/{chunk-BIVL764T.js → chunk-PJ5BYZPN.js} +2 -2
  179. package/dist/{chunk-BISJK67O.js → chunk-PK7Z7WRJ.js} +98 -46
  180. package/dist/{chunk-7VMEM3LN.js → chunk-PL6NWB5U.js} +178 -113
  181. package/dist/chunk-PMT75APP.js +94 -0
  182. package/dist/chunk-PP6A4X55.js +11 -0
  183. package/dist/{chunk-I7H5DU34.js → chunk-PPCH3PLO.js} +25 -13
  184. package/dist/{chunk-BIGQKCU7.js → chunk-PPE6S7WU.js} +42 -24
  185. package/dist/{chunk-2NSQIPAA.js → chunk-PT7KSIEO.js} +23 -36
  186. package/dist/{chunk-KZJ5VM6E.js → chunk-PZ3TQFSY.js} +15 -1
  187. package/dist/{chunk-ZJFJ2IKQ.js → chunk-QAUGRVRU.js} +122 -23
  188. package/dist/{chunk-BTDGWHGJ.js → chunk-QMFWZG2P.js} +39 -19
  189. package/dist/{chunk-L6YVK6VC.js → chunk-QZGGCE45.js} +2 -2
  190. package/dist/{chunk-67QSW5RW.js → chunk-R2RJQ3BM.js} +4 -4
  191. package/dist/{chunk-ZY72LSQK.js → chunk-R7HBIQ63.js} +102 -61
  192. package/dist/{chunk-4JHMCXOB.js → chunk-RBNDZLYS.js} +77 -36
  193. package/dist/chunk-RCSY4CT4.js +2170 -0
  194. package/dist/{chunk-NGA7ICG4.js → chunk-RDJ3ZU6O.js} +16 -13
  195. package/dist/{chunk-2NN676RI.js → chunk-RHQRPJHS.js} +7 -8
  196. package/dist/chunk-RI6XQKWJ.js +26 -0
  197. package/dist/{chunk-YOOHNQ3L.js → chunk-RJICOOB3.js} +18 -8
  198. package/dist/{chunk-5DTCOOLU.js → chunk-RLAVNCQJ.js} +2 -2
  199. package/dist/{chunk-CYKXROFG.js → chunk-ROPPWJQB.js} +23 -12
  200. package/dist/{chunk-54ROMBU7.js → chunk-SELOV32X.js} +105 -50
  201. package/dist/{chunk-TUW5IYGA.js → chunk-SQI4NWTQ.js} +9 -9
  202. package/dist/{chunk-ZEYBI47P.js → chunk-SRJ74CMG.js} +11 -3
  203. package/dist/{chunk-NHC2ADGI.js → chunk-STWOURLG.js} +253 -144
  204. package/dist/chunk-SWMFXSVW.js +23 -0
  205. package/dist/chunk-SXAZDIGM.js +84 -0
  206. package/dist/{chunk-EMFUZKYK.js → chunk-SZ5VGWDY.js} +3 -3
  207. package/dist/{chunk-R5MEBBAA.js → chunk-T26G23RS.js} +442 -119
  208. package/dist/{chunk-QHRE2M6V.js → chunk-T2L5H2WW.js} +4 -3
  209. package/dist/chunk-T7GPIJ4L.js +89 -0
  210. package/dist/{chunk-MJPXHCBW.js → chunk-TAEB3RU6.js} +5 -5
  211. package/dist/{chunk-V7F4F6JA.js → chunk-TBDIMTRD.js} +37 -16
  212. package/dist/{chunk-63Y3ROZ7.js → chunk-TFFPEWNP.js} +102 -64
  213. package/dist/{chunk-EZZ533MH.js → chunk-TMEUK2WS.js} +6 -2
  214. package/dist/{chunk-37PKNVLS.js → chunk-TVOMGNFQ.js} +1 -1
  215. package/dist/{chunk-HJRNBKIT.js → chunk-TX5FSNAU.js} +436 -30
  216. package/dist/{chunk-V634AXDM.js → chunk-U52PNFPX.js} +1 -1
  217. package/dist/{chunk-QLANK3VN.js → chunk-U74AWJ3X.js} +6 -6
  218. package/dist/chunk-UC7LBW7N.js +26 -0
  219. package/dist/{chunk-PZ46S2SY.js → chunk-UCKUAKYQ.js} +2 -2
  220. package/dist/{chunk-KF7HD3EH.js → chunk-UCYL3YA7.js} +77 -55
  221. package/dist/{chunk-HOU2MZHC.js → chunk-UD2GI3CS.js} +11 -4
  222. package/dist/{chunk-SNQ7D5R7.js → chunk-UIHGGWES.js} +51 -11
  223. package/dist/{chunk-LGNJCPFP.js → chunk-ULQIC76A.js} +10 -13
  224. package/dist/{chunk-KTHFHD6C.js → chunk-UY34DDUM.js} +11 -6
  225. package/dist/{chunk-6QDMRPXI.js → chunk-UYMFLWM6.js} +215 -258
  226. package/dist/{chunk-KDSYZLF6.js → chunk-V5IFI3FV.js} +8 -1
  227. package/dist/{chunk-JTFKRDDA.js → chunk-V7FV66KL.js} +1 -1
  228. package/dist/{chunk-27OIGDRK.js → chunk-V7NUJEJE.js} +1 -1
  229. package/dist/{chunk-CCDXK5NA.js → chunk-VESSIKBG.js} +8 -3
  230. package/dist/{chunk-QSMGZOT5.js → chunk-VRFJAF3R.js} +7 -8
  231. package/dist/chunk-VS2R3OGN.js +34 -0
  232. package/dist/{chunk-RLMC5CUP.js → chunk-VS5B4J2D.js} +7 -8
  233. package/dist/{chunk-7M2GK7XQ.js → chunk-W4R6SGU3.js} +252 -121
  234. package/dist/{chunk-JKOEHRGV.js → chunk-WDLWWEHZ.js} +1 -1
  235. package/dist/{chunk-7DAH2E4T.js → chunk-WFBN2HXR.js} +2 -2
  236. package/dist/{chunk-DLDDRXAI.js → chunk-WJS6SAWA.js} +296 -145
  237. package/dist/{chunk-WWGPTEQB.js → chunk-WQYNKF33.js} +73 -22
  238. package/dist/{chunk-64LJDGJH.js → chunk-WUP6C4ZD.js} +4 -2
  239. package/dist/{chunk-F2EVCJ4U.js → chunk-X24WAHHV.js} +87 -43
  240. package/dist/{chunk-OJ5CQV7H.js → chunk-X3UCQPVV.js} +209 -96
  241. package/dist/{chunk-7FKY6YWU.js → chunk-X46PSAJ7.js} +6 -6
  242. package/dist/{chunk-H3IBJQ5A.js → chunk-XD5XB22R.js} +2 -2
  243. package/dist/chunk-XDIAQEYK.js +28 -0
  244. package/dist/{chunk-7PPMT5EJ.js → chunk-XFPNYHX3.js} +372 -105
  245. package/dist/{chunk-FCECYJVA.js → chunk-XIBVAKCO.js} +1 -1
  246. package/dist/{chunk-OG2YUVBW.js → chunk-XMX4PCFL.js} +8 -3
  247. package/dist/{chunk-2NRHD2G7.js → chunk-XRRG4MBM.js} +12 -4
  248. package/dist/{chunk-FNMH5WEY.js → chunk-XTFO6D4L.js} +1 -1
  249. package/dist/chunk-XWRI3N5O.js +70 -0
  250. package/dist/{chunk-ZKJ5L35C.js → chunk-XXPLPSOE.js} +36 -25
  251. package/dist/{chunk-XQMYQ4TN.js → chunk-XZXZNI7A.js} +1 -1
  252. package/dist/{chunk-E555EDOQ.js → chunk-YEJZ2OYS.js} +490 -182
  253. package/dist/chunk-YGZEG3JV.js +123 -0
  254. package/dist/{chunk-F6OLHND5.js → chunk-Z3WQXVFV.js} +2 -2
  255. package/dist/{chunk-FFJGC2DX.js → chunk-Z6DUNKFU.js} +173 -40
  256. package/dist/{chunk-N5HN5QGH.js → chunk-Z6H5ED2I.js} +1 -1
  257. package/dist/{chunk-7Q37C6GZ.js → chunk-ZBOOMLHD.js} +1 -1
  258. package/dist/{chunk-MOK3ZS6P.js → chunk-ZDJ7C64T.js} +1 -1
  259. package/dist/{chunk-GLQ3KCTY.js → chunk-ZGZLEUKM.js} +7 -8
  260. package/dist/{chunk-YHD2FZFP.js → chunk-ZHRGX225.js} +6 -6
  261. package/dist/{chunk-76Q7E3TM.js → chunk-ZIVCPXXL.js} +510 -646
  262. package/dist/{chunk-BSATR6ZO.js → chunk-ZNRSYS76.js} +21 -3
  263. package/dist/{chunk-DMAMWUYY.js → chunk-ZSLTSCTI.js} +5 -5
  264. package/dist/{chunk-IGVAWAOK.js → chunk-ZSYFQSPF.js} +43 -9
  265. package/dist/cli/index.js +8 -3
  266. package/dist/{core-7Y5BZZON.js → core-43GLGBOY.js} +8 -1
  267. package/dist/{core-7S3XMW5O.js → core-5GI3ERXO.js} +4 -1
  268. package/dist/{core-K3JX5WPM.js → core-5L7TMK7I.js} +6 -1
  269. package/dist/{core-LB5M7XL4.js → core-7TO4OVY5.js} +6 -1
  270. package/dist/{core-ILPXXC2Z.js → core-BJVENHFQ.js} +7 -1
  271. package/dist/{core-JDFUZFRH.js → core-BX4MFWKC.js} +6 -1
  272. package/dist/{core-XW7UJFJZ.js → core-C3KXTOIZ.js} +7 -1
  273. package/dist/{core-WJNK7F2J.js → core-C5Y6BFLL.js} +7 -1
  274. package/dist/{core-WZ4CHVYL.js → core-CLUSJ2SK.js} +5 -1
  275. package/dist/{core-TCSW24N6.js → core-E3IN2VVH.js} +5 -1
  276. package/dist/{core-MU4ALRR7.js → core-FD67NQOV.js} +6 -1
  277. package/dist/{core-YMXYUGF5.js → core-FDKMLRAK.js} +5 -1
  278. package/dist/{core-VKZSQFRG.js → core-FL6Z3VVX.js} +5 -1
  279. package/dist/{core-5UF44NDI.js → core-JC7JUFPY.js} +8 -1
  280. package/dist/{core-RR2CAZC5.js → core-JF33TADA.js} +8 -1
  281. package/dist/{core-4RR6VSXM.js → core-JH32ZAKM.js} +4 -1
  282. package/dist/{core-G3LXHW73.js → core-JYYZPPQV.js} +7 -1
  283. package/dist/{core-4HFVG4CP.js → core-KJTKCV4U.js} +4 -1
  284. package/dist/{core-GSILPKUR.js → core-LCQPE5Y6.js} +8 -1
  285. package/dist/{core-GLOZY6Z7.js → core-LHVGWE54.js} +6 -1
  286. package/dist/{core-J2JD5ODO.js → core-OVSNBOCE.js} +9 -1
  287. package/dist/{core-BLHEJ5OK.js → core-PPEC236B.js} +5 -1
  288. package/dist/{core-ZLSQHZ3I.js → core-QTJZDK5H.js} +5 -1
  289. package/dist/{core-TKZZZ6UW.js → core-R3YZCOUZ.js} +7 -1
  290. package/dist/{core-HTD5RHE7.js → core-RIBW5XU4.js} +7 -1
  291. package/dist/{core-AR2T32Y3.js → core-RJFILBWL.js} +8 -1
  292. package/dist/{core-A5AKUB7H.js → core-RWSXEKTE.js} +4 -1
  293. package/dist/{core-DD62MWEW.js → core-SOPPZLEH.js} +5 -1
  294. package/dist/{core-HDNWVLJW.js → core-TBUZCXLX.js} +5 -1
  295. package/dist/{core-BOG33BFD.js → core-TZ5QLTAX.js} +5 -1
  296. package/dist/{core-H5HO2CED.js → core-U7E5W4MY.js} +3 -1
  297. package/dist/{core-QPSAYRFT.js → core-UBNVSL44.js} +7 -1
  298. package/dist/{core-E2XOSHPR.js → core-UDRD4WIU.js} +6 -1
  299. package/dist/{core-DFZMOO7E.js → core-UVJZ4HY2.js} +7 -1
  300. package/dist/{core-LGJZUP6H.js → core-X7WWYQH4.js} +8 -1
  301. package/dist/{core-BBNY2BX4.js → core-XP56X47I.js} +5 -1
  302. package/dist/{core-3KLQSYWB.js → core-XQG54CYG.js} +6 -1
  303. package/dist/{dataTable-CNDRVGA5.js → dataTable-U7W4I6IF.js} +15 -2
  304. package/dist/{engine-FVEIM3WV.js → engine-O5V26MGR.js} +32 -19
  305. package/dist/fixtures.js +4 -1
  306. package/dist/flags-BVLSAXT3.js +10 -0
  307. package/dist/{fontTables-ZPZQ6IR3.js → fontTables-JUW7ZTQY.js} +3 -1
  308. package/dist/fonts.js +1 -1
  309. package/dist/geo/dach.js +1 -1
  310. package/dist/geo/de-states.js +1 -1
  311. package/dist/geo/eu27.js +1 -1
  312. package/dist/geo/europe.js +1 -1
  313. package/dist/geo/index.js +2 -2
  314. package/dist/geo/us-states.js +1 -1
  315. package/dist/geo/world.js +1 -1
  316. package/dist/index.js +41 -22
  317. package/dist/{main-THU6VIVU.js → main-35GS47XC.js} +68 -123
  318. package/dist/mcp/server.js +131 -118
  319. package/dist/react/bar.js +10 -1
  320. package/dist/react/bartable.js +10 -1
  321. package/dist/react/box.js +8 -1
  322. package/dist/react/bullet.js +10 -1
  323. package/dist/react/butterfly.js +10 -1
  324. package/dist/react/choropleth.js +10 -1
  325. package/dist/react/cohort.js +11 -1
  326. package/dist/react/column.js +10 -1
  327. package/dist/react/combo.js +10 -1
  328. package/dist/react/creative.js +11 -1
  329. package/dist/react/diagram.js +10 -1
  330. package/dist/react/dimswitch.js +11 -1
  331. package/dist/react/dot.js +9 -1
  332. package/dist/react/export.js +36 -18
  333. package/dist/react/funnel.js +9 -1
  334. package/dist/react/gantt.js +9 -1
  335. package/dist/react/grid.js +10 -1
  336. package/dist/react/heatmap.js +9 -1
  337. package/dist/react/histogram.js +11 -1
  338. package/dist/react/index.js +101 -85
  339. package/dist/react/kpi.js +10 -1
  340. package/dist/react/likert.js +11 -1
  341. package/dist/react/line.js +9 -1
  342. package/dist/react/mekko.js +10 -1
  343. package/dist/react/pareto.js +11 -1
  344. package/dist/react/pie.js +9 -1
  345. package/dist/react/prepare.js +49 -21
  346. package/dist/react/pvm.js +12 -1
  347. package/dist/react/pyramid.js +10 -1
  348. package/dist/react/sankey.js +10 -1
  349. package/dist/react/scatter.js +8 -1
  350. package/dist/react/slope.js +10 -1
  351. package/dist/react/sparkline.js +10 -1
  352. package/dist/react/spec.js +24 -14
  353. package/dist/react/status.js +9 -1
  354. package/dist/react/story.js +5 -2
  355. package/dist/react/table.js +9 -1
  356. package/dist/react/theme.js +10 -3
  357. package/dist/react/tilemap.js +9 -1
  358. package/dist/react/treemap.js +9 -1
  359. package/dist/react/variance.js +10 -1
  360. package/dist/react/waffle.js +9 -1
  361. package/dist/react/waterfall.js +11 -1
  362. package/dist/{resvg-VB7S5HRF.js → resvg-ZYEZTSUO.js} +3 -1
  363. package/dist/rows.js +3 -2
  364. package/dist/{rowsModule-LI6KOS46.js → rowsModule-H2S6WW4D.js} +2 -1
  365. package/dist/{schema-CGQID64D.js → schema-2R32F6AW.js} +1 -1
  366. package/dist/{schema-H2EC4GAQ.js → schema-2TPGJGVR.js} +1 -1
  367. package/dist/{schema-THXXFY6I.js → schema-47BG2TZA.js} +1 -3
  368. package/dist/{schema-AMT7P7KB.js → schema-56MOEOVR.js} +1 -1
  369. package/dist/{schema-GNTKL5DN.js → schema-5MSR4LNN.js} +1 -1
  370. package/dist/{schema-5ZTGVQAJ.js → schema-5RIYEWE6.js} +1 -1
  371. package/dist/{schema-LOQ3AFC7.js → schema-A26ZNGTZ.js} +1 -3
  372. package/dist/{schema-MMVPMJEF.js → schema-ALBF6V7Y.js} +1 -3
  373. package/dist/{schema-BKUFZLLI.js → schema-BA6WP5YZ.js} +1 -1
  374. package/dist/{schema-PQZWO3BP.js → schema-CBL2SMVR.js} +1 -3
  375. package/dist/{schema-BBTXTWYI.js → schema-CWKGLDSR.js} +1 -3
  376. package/dist/{schema-5KDEQBBT.js → schema-DBIQFL56.js} +1 -1
  377. package/dist/{schema-KPEPBGAX.js → schema-DL7V6NN2.js} +1 -1
  378. package/dist/{schema-PL3EU6EQ.js → schema-DUVJMFKQ.js} +4 -2
  379. package/dist/{schema-L5U4OROI.js → schema-ECJERHKF.js} +2 -1
  380. package/dist/{schema-YLE4XXQQ.js → schema-EDSEKZDJ.js} +1 -1
  381. package/dist/{schema-HH5HOORE.js → schema-ESR6ZIK4.js} +1 -3
  382. package/dist/{schema-5DUTAVO7.js → schema-F7TWGLRZ.js} +1 -3
  383. package/dist/{schema-B2GCEYXD.js → schema-FGB6IGZM.js} +1 -3
  384. package/dist/{schema-7NSV542V.js → schema-FKGGTM4Z.js} +2 -1
  385. package/dist/{schema-72EEMYS3.js → schema-FU2AFIEE.js} +1 -1
  386. package/dist/{schema-QORUB6EK.js → schema-JNJFCYBM.js} +18 -1
  387. package/dist/{schema-JH57NFXJ.js → schema-JYZ4RF6S.js} +2 -1
  388. package/dist/{schema-25INXAMY.js → schema-K7F6TEDK.js} +1 -2
  389. package/dist/{schema-OU35XA3Z.js → schema-KAK6DZX4.js} +1 -1
  390. package/dist/{schema-R5Y6NVBH.js → schema-MOKWIGF7.js} +1 -1
  391. package/dist/{schema-ZQSIR5UC.js → schema-MQT6BMNK.js} +1 -3
  392. package/dist/{schema-FDFQKIO5.js → schema-MR3BPPQR.js} +1 -1
  393. package/dist/{schema-VYECMPON.js → schema-OPXZYIW7.js} +1 -3
  394. package/dist/{schema-ZEVJMFLV.js → schema-PV7JGX5H.js} +1 -1
  395. package/dist/{schema-QPOBZUAR.js → schema-PWPQF5RC.js} +1 -1
  396. package/dist/{schema-GN6GAIU5.js → schema-PYQEUC5P.js} +1 -3
  397. package/dist/{schema-M5JBHQIV.js → schema-QPIC5MAG.js} +9 -2
  398. package/dist/{schema-QCIE6M2P.js → schema-R42VXFIS.js} +1 -1
  399. package/dist/{schema-J7TNCZIP.js → schema-TVUJNEX7.js} +1 -1
  400. package/dist/{schema-AXRDF6ND.js → schema-Y4TI2T3T.js} +1 -1
  401. package/dist/{schema-ZG6ZKFRZ.js → schema-ZU2EU2VP.js} +1 -1
  402. package/dist/{specValidation-VHLGDEME.js → specValidation-2NHJT7TQ.js} +4 -1
  403. package/dist/theme.js +7 -2
  404. package/dist/{themeShapeRules-PW4BQHKL.js → themeShapeRules-G7UZX6GJ.js} +1 -1
  405. package/dist/types/core/annotate.d.ts +27 -2
  406. package/dist/types/core/annotateArms.d.ts +3 -1
  407. package/dist/types/core/annotateTargets.d.ts +4 -0
  408. package/dist/types/core/annotationOrigin.d.ts +13 -0
  409. package/dist/types/core/axis.d.ts +2 -2
  410. package/dist/types/core/charts/band/stacks.d.ts +7 -1
  411. package/dist/types/core/charts/bartable/types.d.ts +14 -1
  412. package/dist/types/core/charts/box/types.d.ts +3 -1
  413. package/dist/types/core/charts/choropleth/layout.d.ts +1 -5
  414. package/dist/types/core/charts/choropleth/types.d.ts +19 -0
  415. package/dist/types/core/charts/cohort/types.d.ts +16 -3
  416. package/dist/types/core/charts/column/model.d.ts +13 -0
  417. package/dist/types/core/charts/combo/layout.d.ts +7 -0
  418. package/dist/types/core/charts/creative/types.d.ts +21 -0
  419. package/dist/types/core/charts/dimswitch/compile.d.ts +15 -2
  420. package/dist/types/core/charts/dimswitch/types.d.ts +24 -1
  421. package/dist/types/core/charts/gantt/calendar.d.ts +24 -0
  422. package/dist/types/core/charts/gantt/columns.d.ts +56 -0
  423. package/dist/types/core/charts/gantt/layout.d.ts +8 -2
  424. package/dist/types/core/charts/gantt/model.d.ts +296 -0
  425. package/dist/types/core/charts/grid/metricStack.d.ts +9 -0
  426. package/dist/types/core/charts/grid/metricStackSchema.d.ts +13 -0
  427. package/dist/types/core/charts/grid/normalize.d.ts +5 -0
  428. package/dist/types/core/charts/grid/schema.d.ts +2 -2
  429. package/dist/types/core/charts/histogram/types.d.ts +8 -0
  430. package/dist/types/core/charts/likert/layout.d.ts +10 -8
  431. package/dist/types/core/charts/pareto/layout.d.ts +2 -0
  432. package/dist/types/core/charts/pvm/types.d.ts +10 -1
  433. package/dist/types/core/charts/pyramid/types.d.ts +3 -1
  434. package/dist/types/core/charts/sankey/types.d.ts +5 -1
  435. package/dist/types/core/charts/scatter/clamp.d.ts +2 -1
  436. package/dist/types/core/charts/scatter/model.d.ts +5 -0
  437. package/dist/types/core/charts/scatter/valueLines.d.ts +3 -1
  438. package/dist/types/core/charts/status/layout.d.ts +3 -0
  439. package/dist/types/core/charts/table/resolve.d.ts +22 -3
  440. package/dist/types/core/charts/table/view.d.ts +24 -1
  441. package/dist/types/core/claims/browser.d.ts +2 -0
  442. package/dist/types/core/claims/ids.d.ts +38 -0
  443. package/dist/types/core/deferred.d.ts +1 -0
  444. package/dist/types/core/doc/diagnostics.d.ts +3 -2
  445. package/dist/types/core/footer.d.ts +2 -0
  446. package/dist/types/core/formatSpec.d.ts +43 -14
  447. package/dist/types/core/frame.d.ts +26 -59
  448. package/dist/types/core/frameText.d.ts +203 -0
  449. package/dist/types/core/geo/types.d.ts +2 -0
  450. package/dist/types/core/geometry.d.ts +3 -1
  451. package/dist/types/core/label/categoryRow.d.ts +19 -2
  452. package/dist/types/core/label/solver.d.ts +23 -2
  453. package/dist/types/core/normalize/shared.d.ts +14 -2
  454. package/dist/types/core/notes.d.ts +15 -2
  455. package/dist/types/core/reading.d.ts +12 -1
  456. package/dist/types/core/registry.d.ts +4 -5
  457. package/dist/types/core/request.d.ts +7 -1
  458. package/dist/types/core/schema/capability.d.ts +32 -7
  459. package/dist/types/core/schema/generatedColumns.d.ts +168 -0
  460. package/dist/types/core/seriesIdentity.d.ts +4 -1
  461. package/dist/types/core/sizing.d.ts +32 -1
  462. package/dist/types/core/structureCounts.d.ts +3 -1
  463. package/dist/types/core/text.d.ts +16 -0
  464. package/dist/types/core/theme.d.ts +33 -4
  465. package/dist/types/core/themeGeometry.d.ts +9 -0
  466. package/dist/types/core/themeRules.d.ts +2 -0
  467. package/dist/types/core/timeAxis.d.ts +6 -1
  468. package/dist/types/core/types/annotations.d.ts +74 -4
  469. package/dist/types/core/types/diagram.d.ts +7 -0
  470. package/dist/types/core/types/options.d.ts +118 -15
  471. package/dist/types/core/types/scene.d.ts +30 -2
  472. package/dist/types/core/types/table.d.ts +27 -3
  473. package/dist/types/core/types/theme.d.ts +23 -0
  474. package/dist/types/index.d.ts +2 -0
  475. package/dist/types/react/TableChart.d.ts +5 -0
  476. package/dist/types/react/barrelCharts.d.ts +16 -5
  477. package/dist/types/react/charts/butterfly.d.ts +2 -2
  478. package/dist/types/react/charts/dot.d.ts +7 -1
  479. package/dist/types/react/charts/pareto.d.ts +4 -1
  480. package/dist/types/react/charts/variance.d.ts +3 -1
  481. package/dist/types/react/hover/labelCard.d.ts +11 -2
  482. package/dist/types/react/prepare.d.ts +7 -1
  483. package/dist/types/theme.d.ts +2 -0
  484. package/dist/validate.js +23 -6
  485. package/docs/TELEMETRY.md +2 -2
  486. package/docs/manual.md +283 -65
  487. package/docs/reference/bar.md +15 -4
  488. package/docs/reference/bartable.md +17 -2
  489. package/docs/reference/box.md +15 -4
  490. package/docs/reference/bullet.md +21 -6
  491. package/docs/reference/butterfly.md +17 -6
  492. package/docs/reference/choropleth.md +16 -5
  493. package/docs/reference/cohort.md +25 -5
  494. package/docs/reference/column.md +19 -4
  495. package/docs/reference/combo.md +11 -5
  496. package/docs/reference/creative.md +17 -8
  497. package/docs/reference/diagram.md +6 -1
  498. package/docs/reference/dimswitch.md +71 -118
  499. package/docs/reference/dot.md +16 -7
  500. package/docs/reference/fixtures.md +94 -1
  501. package/docs/reference/funnel.md +14 -5
  502. package/docs/reference/gantt.md +17 -16
  503. package/docs/reference/grid.md +13 -3
  504. package/docs/reference/heatmap.md +16 -6
  505. package/docs/reference/histogram.md +2 -2
  506. package/docs/reference/kpi.md +5 -1
  507. package/docs/reference/likert.md +17 -4
  508. package/docs/reference/line.md +18 -5
  509. package/docs/reference/mekko.md +10 -5
  510. package/docs/reference/options.md +20 -15
  511. package/docs/reference/pareto.md +9 -5
  512. package/docs/reference/pie.md +9 -5
  513. package/docs/reference/pvm.md +16 -6
  514. package/docs/reference/pyramid.md +14 -4
  515. package/docs/reference/react.md +6 -7
  516. package/docs/reference/sankey.md +7 -3
  517. package/docs/reference/scatter.md +8 -4
  518. package/docs/reference/slope.md +15 -5
  519. package/docs/reference/sparkline.md +1 -1
  520. package/docs/reference/status.md +7 -1
  521. package/docs/reference/table.md +41 -110
  522. package/docs/reference/theme.md +12 -4
  523. package/docs/reference/tilemap.md +2 -4
  524. package/docs/reference/treemap.md +1 -1
  525. package/docs/reference/variance.md +12 -6
  526. package/docs/reference/waffle.md +1 -1
  527. package/docs/reference/warnings.md +1077 -0
  528. package/docs/reference/waterfall.md +20 -5
  529. package/docs/use-cases.md +25 -13
  530. package/llms.txt +19 -6
  531. package/package.json +18 -3
  532. package/dist/chunk-6364WO5D.js +0 -47
  533. package/dist/chunk-DQ7YMQVX.js +0 -26
  534. package/dist/chunk-EBB4PYBN.js +0 -24
  535. package/dist/chunk-FG5L2LUK.js +0 -89
  536. package/dist/chunk-IFQN4GKK.js +0 -1852
  537. package/dist/chunk-IRXVV65V.js +0 -24
  538. package/dist/chunk-JGFHNAHS.js +0 -22
  539. package/dist/chunk-JHWYG7V5.js +0 -24
  540. package/dist/chunk-M4SPKUZE.js +0 -7
  541. package/dist/chunk-O36WX56O.js +0 -13
  542. package/dist/chunk-QJWLNP64.js +0 -24
  543. package/dist/chunk-QZIHKQRH.js +0 -26
  544. package/dist/chunk-SE7MJ2LQ.js +0 -24
  545. package/dist/chunk-TXBO2LWM.js +0 -25
  546. package/dist/chunk-UPTXFTKH.js +0 -25
  547. package/dist/chunk-UREXN6WG.js +0 -25
  548. package/dist/chunk-UZLR25BW.js +0 -24
  549. package/dist/chunk-WIVFIVFZ.js +0 -27
  550. package/dist/chunk-WZL4EEBS.js +0 -11
  551. package/dist/chunk-XHRUXZD7.js +0 -28
  552. package/dist/chunk-ZWNRLIFT.js +0 -24
@@ -6,34 +6,45 @@ import {
6
6
  normalizeMetricStack,
7
7
  stackError,
8
8
  stackRange
9
- } from "./chunk-5P2TTHBZ.js";
9
+ } from "./chunk-EHRRHSPV.js";
10
+ import {
11
+ rebaseRefusal,
12
+ rebaseWarning,
13
+ sameField
14
+ } from "./chunk-NZ7FX3AE.js";
10
15
  import {
11
16
  scalePanelSemantics
12
- } from "./chunk-JCIXYOND.js";
17
+ } from "./chunk-3HPPTQEW.js";
13
18
  import {
14
19
  STACK_ROOM
15
- } from "./chunk-EMFUZKYK.js";
20
+ } from "./chunk-SZ5VGWDY.js";
16
21
  import {
17
22
  normalizeGridData,
18
23
  parseGridLegendPanelData,
19
24
  parseGridTextPanelData
20
- } from "./chunk-V7F4F6JA.js";
25
+ } from "./chunk-TBDIMTRD.js";
21
26
  import {
22
27
  categoryBandFromCenters
23
28
  } from "./chunk-CDZHNLO6.js";
24
29
  import {
25
30
  structureCount
26
- } from "./chunk-XCROSJ2Z.js";
31
+ } from "./chunk-KW4JXWHO.js";
32
+ import {
33
+ lineBoxes
34
+ } from "./chunk-B5A7X2BA.js";
27
35
  import {
28
36
  isRecord
29
37
  } from "./chunk-MCYM3RNF.js";
30
38
  import {
31
- emptyIdRecord
32
- } from "./chunk-LINZPU5D.js";
39
+ generatedIdWarnings
40
+ } from "./chunk-SXAZDIGM.js";
33
41
  import {
34
42
  CARD_CLASS_WIDTH,
43
+ CARD_HEIGHT_MEMO,
35
44
  CARD_MIN_WIDTH,
36
45
  DIGIT_SEAT,
46
+ LAYOUT_CALL,
47
+ NARROW_FORM,
37
48
  NARROW_SHARE_WIDTH,
38
49
  PLOT_FLOOR_RECT,
39
50
  VARIANCE_TIER,
@@ -47,19 +58,19 @@ import {
47
58
  keysNeedNames,
48
59
  legendIsCovered,
49
60
  normalizedName,
61
+ optionKey,
50
62
  prepareFitLayout,
63
+ requestMemo,
51
64
  resolveSizing,
52
65
  sizeRefusal,
53
66
  stackedColumnPlotPx,
54
67
  varianceTierWeights,
55
68
  withCalendarLabels
56
- } from "./chunk-T2CYNDYU.js";
69
+ } from "./chunk-ETRAPN5G.js";
57
70
  import {
58
71
  LEFT_OUT_OF_NOTE,
59
72
  PRIORITY,
60
- boundsOf,
61
73
  collectSeriesIdentities,
62
- createOccupiedIndex,
63
74
  frameTextOptions,
64
75
  identityAppearance,
65
76
  labelCtx,
@@ -73,16 +84,28 @@ import {
73
84
  solveFrame,
74
85
  solveLabels,
75
86
  stringsIn,
76
- valueNoteLine
77
- } from "./chunk-4KQHKPB3.js";
87
+ unprintedClaims,
88
+ valueNoteLine,
89
+ withUnprintedClaims
90
+ } from "./chunk-I5VDW2XZ.js";
78
91
  import {
79
92
  disclosureNote,
80
- disclosuresShown
81
- } from "./chunk-SMHZXHHD.js";
93
+ disclosuresShown,
94
+ slotDemandHeight
95
+ } from "./chunk-DZYTXZNS.js";
96
+ import {
97
+ withAnnotationOrigins,
98
+ withoutAnnotationOrigins
99
+ } from "./chunk-F2ET5ZTT.js";
100
+ import {
101
+ emptyIdRecord
102
+ } from "./chunk-LINZPU5D.js";
103
+ import {
104
+ unitMagnitude
105
+ } from "./chunk-Z6DUNKFU.js";
82
106
  import {
83
107
  authoredStrings,
84
108
  chartStrings,
85
- currentSmallValues,
86
109
  localeStrings,
87
110
  notApplicableGlyph
88
111
  } from "./chunk-MSYTF3DZ.js";
@@ -95,9 +118,12 @@ import {
95
118
  KPI_HOST_TEXT,
96
119
  KPI_VALUE_SIZE,
97
120
  WIDE_CANVAS_MIN_WIDTH,
121
+ boundsOf,
98
122
  canvasMargin,
123
+ createOccupiedIndex,
99
124
  dashToken,
100
125
  emphasisWeight,
126
+ layoutStepKey,
101
127
  markRolePaint,
102
128
  panelTypeClass,
103
129
  resolveTheme,
@@ -107,33 +133,34 @@ import {
107
133
  themeForWidth,
108
134
  themeRegistrations,
109
135
  typeWidthClass
110
- } from "./chunk-HJRNBKIT.js";
136
+ } from "./chunk-TX5FSNAU.js";
111
137
  import {
112
138
  requireChartCores
113
- } from "./chunk-DRHQG44U.js";
139
+ } from "./chunk-BQBD6Q5J.js";
114
140
  import {
115
141
  fmtPathNumber
116
- } from "./chunk-JYAZPMSA.js";
142
+ } from "./chunk-6IUK6PAH.js";
117
143
  import {
118
144
  DEFAULT_TARGET,
119
145
  NormalizeError,
120
146
  TARGET_SIZE,
121
147
  accessibleTitle,
148
+ floorTextScale,
122
149
  normalizeCategory,
123
150
  normalizeSeriesValues,
124
151
  resolveCanvasOptions,
125
152
  resolveHighlight,
126
153
  resolveSize
127
- } from "./chunk-YOOHNQ3L.js";
154
+ } from "./chunk-RJICOOB3.js";
155
+ import {
156
+ defaultMeasurer,
157
+ wrapText
158
+ } from "./chunk-UIHGGWES.js";
128
159
  import {
129
160
  maxOf,
130
161
  minOf,
131
162
  pushAll
132
163
  } from "./chunk-WYJEOMNY.js";
133
- import {
134
- defaultMeasurer,
135
- wrapText
136
- } from "./chunk-SNQ7D5R7.js";
137
164
 
138
165
  // src/core/grid/gridKey.ts
139
166
  var GRID_KEY_ONLY = /* @__PURE__ */ Symbol("gridKeyOnly");
@@ -251,7 +278,7 @@ function gridRequiredKey(baseline, data, options, fitKeyed) {
251
278
  let names = keyed === candidate ? [] : (keyed.legend?.items ?? []).map((item) => keyName(keyed, item.labelId) || item.id);
252
279
  return hidden && keyed.warnings.push({
253
280
  code: "grid-legend-required",
254
- severity: "info",
281
+ severity: "warn",
255
282
  message: names.length > 0 ? `grid legend cannot be hidden: no direct label names ${names.join(", ")}, so the key row lists ${names.length === 1 ? "that series" : "those series"} only` : "grid legend cannot be hidden because no direct label names the colours and markers it keys"
256
283
  }), keyed;
257
284
  }
@@ -318,8 +345,16 @@ var EN = {
318
345
  legendName: "Legend",
319
346
  legendItemsCount: "{v1} legend items.",
320
347
  stackChangeMethod: "Change: average per {v1}, {v2} \u2192 {v3}; rates use volume weighting",
348
+ stackAverageMethod: "Average per {v1}, {v2} \u2192 {v3}; rates use volume weighting",
321
349
  stackLeftMethod: "Left: volume-weighted mature rates and remaining per 100",
350
+ stackRightMethod: "Right: volume-weighted mature rates and remaining per 100",
322
351
  stackAboveMethod: "Above each panel: volume-weighted mature rates and remaining per 100",
352
+ stackLeftRates: "Left: volume-weighted mature rates",
353
+ stackRightRates: "Right: volume-weighted mature rates",
354
+ stackAboveRates: "Above each panel: volume-weighted mature rates",
355
+ stackLeftRemaining: "Left: remaining per 100",
356
+ stackRightRemaining: "Right: remaining per 100",
357
+ stackAboveRemaining: "Above each panel: remaining per 100",
323
358
  notYetMature: "Not yet mature",
324
359
  labelsShowTotals: "Labels show totals"
325
360
  }, DE = {
@@ -341,42 +376,68 @@ var EN = {
341
376
  legendName: "Legende",
342
377
  legendItemsCount: "{v1} {v1|Legendeneintrag|Legendeneintr\xE4ge}.",
343
378
  stackChangeMethod: "\xC4nderung: Mittelwert je {v1}, {v2} \u2192 {v3}; Raten sind nach Volumen gewichtet",
379
+ stackAverageMethod: "Mittelwert je {v1}, {v2} \u2192 {v3}; Raten sind nach Volumen gewichtet",
344
380
  stackLeftMethod: "Links: nach Volumen gewichtete ausgereifte Raten und Rest je 100",
381
+ stackRightMethod: "Rechts: nach Volumen gewichtete ausgereifte Raten und Rest je 100",
345
382
  stackAboveMethod: "\xDCber jedem Feld: nach Volumen gewichtete ausgereifte Raten und Rest je 100",
383
+ stackLeftRates: "Links: nach Volumen gewichtete ausgereifte Raten",
384
+ stackRightRates: "Rechts: nach Volumen gewichtete ausgereifte Raten",
385
+ stackAboveRates: "\xDCber jedem Feld: nach Volumen gewichtete ausgereifte Raten",
386
+ stackLeftRemaining: "Links: Rest je 100",
387
+ stackRightRemaining: "Rechts: Rest je 100",
388
+ stackAboveRemaining: "\xDCber jedem Feld: Rest je 100",
346
389
  notYetMature: "Noch nicht ausgereift",
347
390
  labelsShowTotals: "Beschriftungen zeigen Summen"
348
391
  }, { chartString } = chartStrings(EN, DE);
349
392
 
350
393
  // src/core/charts/grid/metricStackLayout.ts
351
- var neutral = { token: "markInk" }, muted = { token: "inkMuted" }, accent = { token: "focus" }, wash = (base, weight, pageFloor) => ({ token: "markInk", theme: { kind: "mix", from: base, to: { token: "background" }, weight, ...pageFloor === void 0 ? {} : { pageFloor } } }), NO_WIDER_SEARCH = /* @__PURE__ */ Symbol("boardplot.metricStackNoWiderSearch"), COMPACT_READOUT = /* @__PURE__ */ Symbol("boardplot.metricStackCompactReadout");
352
- function widerThatPlaces(raw, options, size, automatic) {
353
- let draws = (width) => {
354
- try {
355
- return layoutMetricStack(raw, { ...options, size: automatic ? { width } : { width, height: size.height }, [NO_WIDER_SEARCH]: !0 }).scene.length > 0;
356
- } catch (error) {
357
- if (error instanceof NormalizeError) return !1;
358
- throw error;
359
- }
360
- }, base = Math.floor(size.width), low = base, high;
361
- for (let step = 4; step <= 512; step *= 2) {
362
- if (draws(base + step)) {
363
- high = base + step;
364
- break;
365
- }
366
- low = base + step;
367
- }
368
- if (high !== void 0) {
369
- for (; high - low > 1; ) {
370
- let mid = Math.floor((low + high) / 2);
371
- draws(mid) ? high = mid : low = mid;
372
- }
373
- return high;
374
- }
394
+ var neutral = { token: "markInk" }, muted = { token: "inkMuted" }, accent = { token: "focus" }, wash = (base, weight, pageFloor) => ({ token: "markInk", theme: { kind: "mix", from: base, to: { token: "background" }, weight, ...pageFloor === void 0 ? {} : { pageFloor } } }), GUTTER_PROBE = /* @__PURE__ */ Symbol("boardplot.metricStackGutterProbe"), COMPACT_READOUT = /* @__PURE__ */ Symbol("boardplot.metricStackCompactReadout"), GUTTER_LIMIT = /* @__PURE__ */ Symbol("boardplot.metricStackGutterLimit");
395
+ function printedReadout(readout, showHeadline, showSpan) {
396
+ if (showHeadline && showSpan) return readout;
397
+ let byId = new Map(readout.claims.map((claim) => [claim.id, claim])), kept = /* @__PURE__ */ new Set(), keep = (id) => {
398
+ let claim = byId.get(id);
399
+ !claim || kept.has(id) || (kept.add(id), claim.inputs.forEach((input) => keep(input.ref)));
400
+ }, panel = `stack:${readout.panelId}`;
401
+ return showHeadline && (keep(`${panel}:headline`), keep(`${panel}:rate`)), showSpan && (keep(`${panel}:before`), keep(`${panel}:after`)), {
402
+ ...readout,
403
+ claims: readout.claims.filter((claim) => kept.has(claim.id)),
404
+ ...showHeadline ? {} : { headline: null, headlineText: "" },
405
+ ...showSpan ? {} : { before: null, after: null, spanText: "" }
406
+ };
407
+ }
408
+ function stackColumnWarnings(stack, narrow, floored, capped) {
409
+ let inStack = (key, authored, drawn) => generatedIdWarnings("grid", key, authored, drawn).map((warning) => ({ ...warning, field: ["options", "stack", ...(warning.field ?? []).slice(1)] })), warnings = [
410
+ ...inStack("columnVisibility", stack.columnVisibility, ["name", "unit", "headline", "span"]),
411
+ ...inStack("columnOverrides", stack.columnOverrides, ["gutter"]),
412
+ ...inStack("columnOrder", stack.columnOrder, ["gutter", "plot"])
413
+ ], ignored = (key, what) => ({
414
+ code: "option-ignored",
415
+ severity: "warn",
416
+ field: ["options", "stack", key],
417
+ message: `this canvas seats each readout above its panel, with no gutter track, so ${what} does nothing here`,
418
+ suggest: "Widen the chart to draw the gutter."
419
+ });
420
+ return narrow && stack.columnOverrides?.gutter && warnings.push(ignored("columnOverrides", "the gutter override")), narrow && stack.columnOrder?.length && warnings.push(ignored("columnOrder", "columnOrder")), floored && warnings.push({
421
+ code: "generated-column-width-floored",
422
+ severity: "warn",
423
+ field: ["options", "stack", "columnOverrides", "gutter", "width"],
424
+ message: "the gutter width is under what its readouts need, so the gutter stays as wide as they need",
425
+ suggest: "Raise the width, or shorten the panel titles."
426
+ }), capped && warnings.push({
427
+ code: "generated-column-width-capped",
428
+ severity: "warn",
429
+ field: ["options", "stack", "columnOverrides", "gutter", "width"],
430
+ message: "the gutter width leaves too little room for the values on this canvas, so it gave way",
431
+ suggest: "Lower the width, or widen the chart."
432
+ }), warnings;
375
433
  }
376
434
  function layoutMetricStack(raw, options) {
377
435
  let data = normalizeMetricStack(raw);
378
436
  options.stack || stackError("options.stack", "Shared measures require options.stack: {}"), (options.sharedAxis === "none" || options.sharedScale === !0 || options.columns !== void 0 || options.gutters !== void 0 || options.anchors !== void 0 || options.alignmentRules !== void 0 || options.panelOrder !== void 0) && stackError("options", "A metric stack owns top-down order, shared categories, spacing and independent scales; remove conflicting grid controls");
379
- let stack = options.stack;
437
+ let stack = options.stack, showUnit = stack.columnVisibility?.unit !== !1, showHeadline = stack.columnVisibility?.headline !== !1, showSpan = stack.columnVisibility?.span !== !1, gutterAfter = (() => {
438
+ let order = stack.columnOrder ?? [], plotAt = order.indexOf("plot"), gutterAt2 = order.indexOf("gutter");
439
+ return plotAt >= 0 && (gutterAt2 < 0 || plotAt < gutterAt2);
440
+ })();
380
441
  stack.heights && options.rows && stackError("options", "Use stack.heights or rows, not both"), (stack.heights && stack.heights.length !== data.panels.length || options.rows && options.rows.length !== data.panels.length) && stackError("options", "Supply one height or row weight per panel");
381
442
  let theme = themeForWidth(resolveTheme(options.theme), resolveSize(options.size).width), measure = options.measure ?? defaultMeasurer, na = notApplicableGlyph(options.strings), computed = computeMetricStack(data, options.locale?.language, na), font = (role, weight) => ({ family: theme.type.family, ...theme.type[role], ...weight ? { weight } : {} }), valueFont = font("label", 700), nameFont = font("label", 700), unitFont = font("axis"), heroFont = font("title", 700), axisFont = font("axis"), noteFont = font("footnote"), keyFont = secondaryFont(theme), heightOf = (f) => f.size * (f.lineHeight ?? 1.2), textBox = (text, f, width) => {
382
443
  let lines = wrapText(text, f, width, Number.MAX_SAFE_INTEGER, measure).lines;
@@ -384,11 +445,11 @@ function layoutMetricStack(raw, options) {
384
445
  }, spacingError = (field, message, fix) => {
385
446
  throw new NormalizeError("metric-stack-spacing", field, message, "Increase the named dimension; the engine does not shrink or overlap required labels.", fix);
386
447
  }, heightFix = (i, px) => stack.heights ? [{ op: "replace", path: `/options/stack/heights/${i}`, value: px }] : void 0, minGap = Math.ceil(heightOf(axisFont) + 8), compactReadout = options[COMPACT_READOUT] === !0, gap = compactReadout && !computed.maturing.length ? 10 : Math.max(26, minGap), arrowWidth = Math.max(unitFont.size, measure("\u2192", unitFont).width), spanSpace = measure(" ", unitFont).width, spanWidths = computed.panels.map((p) => measure(p.readout.spanText, unitFont).width + arrowWidth - measure("\u2192", unitFont).width), minGutter = Math.ceil(Math.max(120, maxOf(computed.panels.map((p, i) => Math.max(
387
- spanWidths[i],
388
- measure(p.readout.headlineText, heroFont).width,
389
- ...`${p.panel.title} ${p.panel.unit}`.split(/\s+/).map((word) => measure(word, nameFont).width)
448
+ showSpan ? spanWidths[i] : 0,
449
+ showHeadline ? measure(p.readout.headlineText, heroFont).width : 0,
450
+ ...(showUnit ? `${p.panel.title} ${p.panel.unit}` : p.panel.title).split(/\s+/).map((word) => measure(word, nameFont).width)
390
451
  )))) + 4), nameWidth = Math.ceil(maxOf(computed.panels.flatMap((p) => p.panel.title.split(`
391
- `).map((line) => measure(line, nameFont).width)))) + 4, heroBlock = Math.max(heroFont.size, heightOf(heroFont) / 2 + heightOf(unitFont) / 2 + 0.36 * (heroFont.size - unitFont.size)), oneLine = (p, i) => measure(p.readout.headlineText, heroFont).width + 3 * spanSpace + spanWidths[i], gutter = Math.max(170, minGutter, Math.min(320, nameWidth), compactReadout ? Math.ceil(maxOf(computed.panels.map(oneLine)) + 4) : 0), gutterGap = Math.max(28, heightOf(axisFont)), partial = partialIds(data.categories), notes = [...options.footnotes || []], listed = [], stateNotes = {}, engineNumbers = [], notesOff = frameTextOptions(options).footnotesOff, stateNote = (state, authored, engine) => {
452
+ `).map((line) => measure(line, nameFont).width)))) + 4, heroBlock = showHeadline ? showSpan ? Math.max(heroFont.size, heightOf(heroFont) / 2 + heightOf(unitFont) / 2 + 0.36 * (heroFont.size - unitFont.size)) : heroFont.size : showSpan ? heightOf(unitFont) : 0, oneLine = (p, i) => showHeadline ? showSpan ? measure(p.readout.headlineText, heroFont).width + 3 * spanSpace + spanWidths[i] : measure(p.readout.headlineText, heroFont).width : showSpan ? spanWidths[i] : 0, compactFloor = compactReadout ? Math.ceil(maxOf(computed.panels.map(oneLine)) + 4) : 0, defaultGutter = Math.max(170, minGutter, Math.min(320, nameWidth), compactFloor), gutterGap = Math.max(28, heightOf(axisFont)), partial = partialIds(data.categories), notes = [...options.footnotes || []], listed = [], stateNotes = {}, engineNumbers = [], notesOff = frameTextOptions(options).footnotesOff, stateNote = (state, authored, engine) => {
392
453
  if (authored === void 0 && (!disclosuresShown(options) || notesOff)) {
393
454
  listed.push(disclosureNote(engine()));
394
455
  return;
@@ -396,10 +457,19 @@ function layoutMetricStack(raw, options) {
396
457
  stateNotes[state] = notes.length + 1, authored === void 0 && engineNumbers.push(notes.length + 1), notes.push(authored ?? engine());
397
458
  };
398
459
  computed.maturing.length && stateNote("maturing", data.states?.maturing?.footnote, () => chartString(options, "maturingCohortNote")), partial.size && stateNote("partial", data.states?.partial?.footnote, () => partialFootnotes(data.categories, options.strings)[0]);
399
- let marker = (value) => value === void 0 || notesOff ? "" : String(value).split("").map((c) => "\u2070\xB9\xB2\xB3\u2074\u2075\u2076\u2077\u2078\u2079"[Number(c)]).join(""), visibleValue = (p, i) => p.values[i] !== null, hasProvisional = computed.panels.some((p) => p.states.some((state, i) => state !== "mature" && visibleValue(p, i))), hasMatureLine = (p) => p.panel.type === "line" && p.states.some((state, i) => i > 0 && state === "mature" && p.states[i - 1] === "mature" && visibleValue(p, i) && visibleValue(p, i - 1)), measureIndexes = /* @__PURE__ */ new Map(), emphasizedMeasures = /* @__PURE__ */ new Set();
460
+ let marker = (value) => value === void 0 || notesOff ? "" : String(value).split("").map((c) => "\u2070\xB9\xB2\xB3\u2074\u2075\u2076\u2077\u2078\u2079"[Number(c)]).join(""), visibleValue = (p, i) => p.values[i] !== null, hasProvisional = computed.panels.some((p) => p.states.some((state, i) => state !== "mature" && visibleValue(p, i))), hasMatureLine = (p) => p.panel.type === "line" && p.states.some((state, i) => i > 0 && state === "mature" && p.states[i - 1] === "mature" && visibleValue(p, i) && visibleValue(p, i - 1)), measureIndexes = /* @__PURE__ */ new Map(), emphasizedMeasures = /* @__PURE__ */ new Set(), companions = /* @__PURE__ */ new Map();
400
461
  for (let p of computed.panels) if (p.panel.type === "column" && "sum" in p.panel.measure && p.parts.length > 1)
401
- for (let id of p.panel.measure.sum)
402
- measureIndexes.has(id) || measureIndexes.set(id, measureIndexes.size), p.panel.emphasis && emphasizedMeasures.add(id);
462
+ for (let id of p.panel.measure.sum) {
463
+ let set = companions.get(id) ?? /* @__PURE__ */ new Set();
464
+ p.panel.measure.sum.forEach((other) => {
465
+ other !== id && set.add(other);
466
+ }), companions.set(id, set), p.panel.emphasis && emphasizedMeasures.add(id);
467
+ }
468
+ for (let [id, others] of companions) {
469
+ let taken = new Set([...others].flatMap((other) => measureIndexes.has(other) ? [measureIndexes.get(other)] : [])), i = 0;
470
+ for (; taken.has(i); ) i++;
471
+ measureIndexes.set(id, i);
472
+ }
403
473
  let columnFill = seriesPaint(0, options.palette), emphasizedFill = markRolePaint("focus", !0), measurePaints = new Map([...measureIndexes].map(([id, i]) => {
404
474
  let base2 = emphasizedMeasures.has(id) ? emphasizedFill : columnFill;
405
475
  return [id, {
@@ -459,10 +529,20 @@ function layoutMetricStack(raw, options) {
459
529
  return { occupied: occupied2, frame: frame2 };
460
530
  };
461
531
  automatic && (size = { ...size, height: Math.max(size.height, 1600) });
462
- let { occupied, frame } = frameAt(), valueWidth = maxOf(computed.panels.flatMap((p) => p.values.map((v) => v === null ? measure(na, valueFont).width : measure(formatPanelValue(p.panel, v, options.locale?.language), valueFont).width))) + 4, categoryWidth = maxOf(data.categories.flatMap((c) => c.label.split(/\s+/).map((word) => measure(word, keyFont).width))) + 3, valueRoom = Math.max(20, valueWidth, categoryWidth) * data.categories.length, gutterBoxes = computed.panels.map((p) => {
463
- let name = textBox(p.panel.title, nameFont, gutter), unit = textBox(p.panel.unit, keyFont, gutter), beside = compactReadout && name.lines.length === 1 && unit.lines.length === 1 && name.w + 2 * spanSpace + unit.w <= gutter;
464
- return { name, unit, beside, top: beside ? Math.max(name.h, unit.h) : name.h + 2 + unit.h };
465
- }), gutterKeys = computed.panels.map((_, i) => keyLayout(i, gutter, !compactReadout)), gutterHeights = gutterBoxes.map((box, i) => compactReadout ? box.top + 4 + heroBlock + gutterKeys[i].h : box.name.h + box.unit.h + heightOf(heroFont) + heightOf(unitFont) + 18 + (gutterKeys[i].h ? gutterKeys[i].h + 6 : 0)), narrow = frame.plot.w - gutter - gutterGap < valueRoom || gutterHeights.some((h, i) => stack.heights !== void 0 && Math.ceil(h) > stack.heights[i]), thin = narrow && frame.plot.w < valueRoom, lastIndex = data.categories.length - 1, named = (ci) => !thin || ci % 2 === lastIndex % 2, plotX = narrow ? frame.plot.x : frame.plot.x + gutter + gutterGap, plotW = narrow ? frame.plot.w : frame.plot.w - gutter - gutterGap, step = plotW / data.categories.length, minimumWidth = Math.ceil(size.width - plotW + (thin ? valueRoom / 2 : valueRoom)), needsWidth = (width) => ({
532
+ let { occupied, frame } = frameAt(), valueWidth = maxOf(computed.panels.flatMap((p) => p.values.map((v) => v === null ? measure(na, valueFont).width : measure(formatPanelValue(p.panel, v, options.locale?.language), valueFont).width))) + 4, categoryWidth = maxOf(data.categories.flatMap((c) => c.label.split(/\s+/).map((word) => measure(word, keyFont).width))) + 3, valueRoom = Math.max(20, valueWidth, categoryWidth) * data.categories.length, NO_BOX = { lines: [], w: 0, h: 0 }, unitBox = (p, width) => showUnit ? textBox(p.panel.unit, keyFont, width) : NO_BOX, gutterAt = (width) => {
533
+ let boxes = computed.panels.map((p) => {
534
+ let name = textBox(p.panel.title, nameFont, width), unit = unitBox(p, width), beside = showUnit && compactReadout && name.lines.length === 1 && unit.lines.length === 1 && name.w + 2 * spanSpace + unit.w <= width;
535
+ return { name, unit, beside, top: beside ? Math.max(name.h, unit.h) : showUnit ? name.h + 2 + unit.h : name.h };
536
+ }), keys = computed.panels.map((_, i) => keyLayout(i, width, !compactReadout)), heights2 = boxes.map((box, i) => {
537
+ if (compactReadout) return box.top + 4 + heroBlock + keys[i].h - (heroBlock ? 0 : 4);
538
+ let keyed = keys[i].h ? keys[i].h + 6 : 0;
539
+ return showUnit && showHeadline && showSpan ? box.name.h + box.unit.h + heightOf(heroFont) + heightOf(unitFont) + 18 + keyed : box.top + (showHeadline ? 10 + heightOf(heroFont) : 0) + (showSpan ? (showHeadline ? 6 : 10) + heightOf(unitFont) : 0) + keyed;
540
+ });
541
+ return { boxes, keys, heights: heights2 };
542
+ }, atDefault = gutterAt(defaultGutter), narrow = frame.plot.w - defaultGutter - gutterGap < valueRoom || atDefault.heights.some((h, i) => stack.heights !== void 0 && Math.ceil(h) > stack.heights[i]), authoredGutter = narrow ? void 0 : stack.columnOverrides?.gutter?.width, widest = frame.plot.w - gutterGap - valueRoom, heldHeight = !automatic || stack.heights !== void 0 || options.rows !== void 0, fitGutter = (width) => {
543
+ let at = gutterAt(width);
544
+ return !heldHeight || at.heights.every((h, i) => h <= atDefault.heights[i]) ? at : void 0;
545
+ }, wanted = authoredGutter === void 0 ? defaultGutter : Math.min(Math.max(authoredGutter, minGutter, compactFloor), widest, options[GUTTER_LIMIT] ?? 1 / 0), fitted = wanted === defaultGutter ? atDefault : fitGutter(wanted), gutter = fitted ? wanted : defaultGutter, { boxes: gutterBoxes, keys: gutterKeys, heights: gutterHeights } = fitted ?? atDefault, gutterFloored = authoredGutter !== void 0 && gutter > authoredGutter, gutterCapped = authoredGutter !== void 0 && gutter < authoredGutter, thin = narrow && frame.plot.w < valueRoom, lastIndex = data.categories.length - 1, named = (ci) => !thin || ci % 2 === lastIndex % 2, onRight = gutterAfter && !narrow, plotX = narrow || onRight ? frame.plot.x : frame.plot.x + gutter + gutterGap, plotW = narrow ? frame.plot.w : frame.plot.w - gutter - gutterGap, trackX = onRight ? frame.plot.x + plotW + gutterGap : frame.plot.x, trackW = narrow ? frame.plot.w : gutter, trackAlign = narrow ? void 0 : stack.columnOverrides?.gutter?.align, seat = (w) => trackAlign === "right" ? trackX + trackW - w : trackAlign === "center" ? trackX + (trackW - w) / 2 : trackX, step = plotW / data.categories.length, minimumWidth = Math.ceil(size.width - plotW + (thin ? valueRoom / 2 : valueRoom)), needsWidth = (width) => ({
466
546
  type: "grid",
467
547
  size,
468
548
  plot: frame.plot,
@@ -480,20 +560,22 @@ function layoutMetricStack(raw, options) {
480
560
  });
481
561
  if (size.width < minimumWidth) return needsWidth(minimumWidth);
482
562
  let heads = narrow ? computed.panels.map((p, i) => {
483
- let name = textBox(p.panel.title, nameFont, frame.plot.w), unit = textBox(p.panel.unit, keyFont, frame.plot.w), unitBeside = name.lines.length === 1 && unit.lines.length === 1 && name.w + 2 * spanSpace + unit.w <= frame.plot.w, spanBeside = measure(p.readout.headlineText, heroFont).width + 3 * spanSpace + spanWidths[i] + 2 * spanSpace <= frame.plot.w, top = unitBeside ? Math.max(name.h, unit.h) : name.h + 2 + unit.h, key = keyLayout(i, frame.plot.w, !1), body = top + 8 + heightOf(heroFont) + (spanBeside ? 0 : 6 + heightOf(unitFont)) + 6;
563
+ let name = textBox(p.panel.title, nameFont, frame.plot.w), unit = unitBox(p, frame.plot.w), unitBeside = showUnit && name.lines.length === 1 && unit.lines.length === 1 && name.w + 2 * spanSpace + unit.w <= frame.plot.w, hero = measure(p.readout.headlineText, heroFont).width, spanBeside = showHeadline && showSpan && hero + 3 * spanSpace + spanWidths[i] + 2 * spanSpace <= frame.plot.w, top = unitBeside ? Math.max(name.h, unit.h) : showUnit ? name.h + 2 + unit.h : name.h, block = showHeadline ? showSpan ? heightOf(heroFont) + (spanBeside ? 0 : 6 + heightOf(unitFont)) : heightOf(heroFont) : showSpan ? heightOf(unitFont) : 0, key = keyLayout(i, frame.plot.w, !1), body = block ? showHeadline && showSpan ? top + 8 + heightOf(heroFont) + (spanBeside ? 0 : 6 + heightOf(unitFont)) + 6 : top + 8 + block + 6 : top + 6;
484
564
  return { name, unit, unitBeside, spanBeside, top, key, body, h: body + (key.h ? key.h + 4 : 0) };
485
565
  }) : void 0, minimumHeights = gutterHeights.map((h) => Math.ceil(Math.max(narrow ? 0 : h, 3 * heightOf(valueFont) + 20))), heights = computed.panels.map((p, i) => stack.heights?.[i] ?? Math.max(minimumHeights[i], p.panel.type === "column" ? p.parts.length > 1 ? narrow ? 110 : 150 : narrow ? 120 : 200 : narrow ? 90 : 130));
486
566
  if (options.rows) {
487
567
  let factor = maxOf(minimumHeights.map((h, i) => h / options.rows[i]));
488
568
  heights = options.rows.map((w) => w * factor);
489
569
  }
490
- heights.forEach((h, i) => {
491
- (!Number.isFinite(h) || h < minimumHeights[i]) && spacingError(`options.stack.heights.${i}`, `Panel '${data.panels[i].id}' needs at least ${minimumHeights[i]} px for its readout and value labels`, heightFix(i, minimumHeights[i]));
492
- });
570
+ let short = heights.flatMap((h, i) => !Number.isFinite(h) || h < minimumHeights[i] ? [i] : []);
571
+ if (short.length) {
572
+ let fix = stack.heights ? short.flatMap((i) => heightFix(i, minimumHeights[i])) : void 0;
573
+ spacingError(`options.stack.heights.${short[0]}`, `${short.map((i) => `Panel '${data.panels[i].id}' needs at least ${minimumHeights[i]} px`).join(", ")} for its readout and value labels`, fix);
574
+ }
493
575
  let headRoom = heads?.reduce((sum2, head) => sum2 + head.h, 0) ?? 0, partialOnValues = computed.panels.some((p) => p.panel.type === "column" && computed.partial.some((i) => p.values[i] !== null)), partialMark = marker(stateNotes.partial), toDate = ` ${options.strings?.toDate ?? localeStrings(options.locale?.language).toDate}`, categoryName = (c) => c.label + (c.partial ? partialMark ? partialOnValues ? "" : partialMark : saysToDate(c.label, toDate.trim()) ? "" : toDate : ""), categoryBoxes = data.categories.map((c) => textBox(categoryName(c), keyFont, (thin ? 2 : 1) * step - 3)), categoryHeight = maxOf(categoryBoxes.map((b) => b.h)), periodBoxes = data.periods?.map((period) => {
494
576
  let indexes = stackRange(data, period), bold = data.windows ? [data.windows.base, data.windows.compare].some((w) => w.from === period.from && w.to === period.to) : indexes.every((i) => computed.mature.includes(i)), f = { ...keyFont, weight: bold ? 700 : keyFont.weight };
495
577
  return { ...textBox(period.label, f, indexes.length * step - 4), indexes, bold, font: f };
496
- }), axisHeight = (compactReadout ? 8 : 12) + categoryHeight + (periodBoxes ? 10 + maxOf(periodBoxes.map((b) => b.h)) : 0) + (compactReadout ? 4 : 10), bandFirstIndex = data.states?.maturing ? data.panels.findIndex((p) => data.states.maturing.panels.includes(p.id)) : -1, firstOverhang = computed.maturing.length ? gap : 0, readLogic = data.panels.some((p) => p.readout === "change") && data.windows ? chartString(options, "stackChangeMethod", { v1: metricStackGrain(data), v2: data.windows.base.label, v3: data.windows.compare.label }) : chartString(options, narrow ? "stackAboveMethod" : "stackLeftMethod"), readLogicBox = textBox(readLogic, keyFont, frame.plot.w), topRoom = readLogicBox.h + 12 + (compactReadout ? 4 : 30) + (bandFirstIndex === 0 ? firstOverhang : 0), neededPlotHeight = topRoom + headRoom + heights.reduce((a, b) => a + b, 0) + gap * (heights.length - 1) + axisHeight, overhead = size.height - frame.plot.h, naturalHeight = Math.ceil(overhead + neededPlotHeight), shrinks = !stack.heights && !options.rows, floorPlotHeight = neededPlotHeight - heights.reduce((a, b) => a + b, 0) + minimumHeights.reduce((a, b) => a + b, 0), floorHeight = shrinks ? Math.ceil(overhead + floorPlotHeight) : naturalHeight, minHeight = naturalHeight;
578
+ }), axisHeight = (compactReadout ? 8 : 12) + categoryHeight + (periodBoxes ? 10 + maxOf(periodBoxes.map((b) => b.h)) : 0) + (compactReadout ? 4 : 10), bandFirstIndex = data.states?.maturing ? data.panels.findIndex((p) => data.states.maturing.panels.includes(p.id)) : -1, firstOverhang = computed.maturing.length ? gap : 0, hasMethod = showHeadline || showSpan, readLogic = data.panels.some((p) => p.readout === "change") && data.windows ? chartString(options, showHeadline ? "stackChangeMethod" : "stackAverageMethod", { v1: metricStackGrain(data), v2: data.windows.base.label, v3: data.windows.compare.label }) : chartString(options, `stack${narrow ? "Above" : onRight ? "Right" : "Left"}${showSpan ? showHeadline ? "Method" : "Remaining" : "Rates"}`), readLogicBox = hasMethod ? textBox(readLogic, keyFont, frame.plot.w) : NO_BOX, topRoom = (hasMethod ? readLogicBox.h + 12 + (compactReadout ? 4 : 30) : 0) + (bandFirstIndex === 0 ? firstOverhang : 0), neededPlotHeight = topRoom + headRoom + heights.reduce((a, b) => a + b, 0) + gap * (heights.length - 1) + axisHeight, overhead = size.height - frame.plot.h, naturalHeight = Math.ceil(overhead + neededPlotHeight), shrinks = !stack.heights && !options.rows, floorPlotHeight = neededPlotHeight - heights.reduce((a, b) => a + b, 0) + minimumHeights.reduce((a, b) => a + b, 0), floorHeight = shrinks ? Math.ceil(overhead + floorPlotHeight) : naturalHeight, minHeight = naturalHeight;
497
579
  if (automatic)
498
580
  size = { ...size, height: naturalHeight }, { occupied, frame } = frameAt();
499
581
  else if (frame.plot.h < neededPlotHeight - 0.01)
@@ -532,18 +614,18 @@ function layoutMetricStack(raw, options) {
532
614
  let scene = [...frame.nodes], requests = [], inks = /* @__PURE__ */ new Map(), put = (id, text, f, rect, owner, ink, role = "label", kind = "point", lines = [text], claimId, below) => {
533
615
  if (rect.w > 0 && rect.h > 0) {
534
616
  let candidates = [{ slot: "fixed", rect, penalty: 0 }, ...below === void 0 ? [] : [{ slot: "fixed", rect: { ...rect, y: below }, penalty: 1 }]];
535
- requests.push({ id, kind, owner, text, lines, font: f, typeRole: role, priority: PRIORITY.total, pad: 0, candidates, ...claimId ? { claimId } : {} }), inks.set(id, ink);
617
+ requests.push({ id, kind, owner, text, lines, font: f, typeRole: role, priority: PRIORITY.total, pad: 0, candidates, ...claimId ? { claimIds: [claimId] } : {} }), inks.set(id, ink);
536
618
  }
537
619
  }, centerText = (id, text, f, x, y2, owner, ink, role = "label", kind = "point", claimId, below) => {
538
620
  let box = measure(text, f);
539
621
  put(id, text, f, { x: x - box.width / 2, y: y2, w: box.width, h: heightOf(f) }, owner, ink, role, kind, [text], claimId, below);
540
622
  };
541
- put("stack:read-logic", readLogic, keyFont, { x: frame.plot.x, y: frame.plot.y, w: readLogicBox.w, h: readLogicBox.h }, {}, muted, "secondary", "annotation", readLogicBox.lines), scene.push({ t: "line", id: "stack:header-rule", x1: frame.plot.x, x2: frame.plot.x + frame.plot.w, y1: frame.plot.y + readLogicBox.h + 10, y2: frame.plot.y + readLogicBox.h + 10, stroke: { token: "grid" }, width: strokeToken(theme, "hair"), owner: {}, part: "headerRule" });
623
+ put("stack:read-logic", readLogic, keyFont, { x: frame.plot.x, y: frame.plot.y, w: readLogicBox.w, h: readLogicBox.h }, {}, muted, "secondary", "annotation", readLogicBox.lines), hasMethod && scene.push({ t: "line", id: "stack:header-rule", x1: frame.plot.x, x2: frame.plot.x + frame.plot.w, y1: frame.plot.y + readLogicBox.h + 10, y2: frame.plot.y + readLogicBox.h + 10, stroke: { token: "grid" }, width: strokeToken(theme, "hair"), owner: {}, part: "headerRule" });
542
624
  let plots = [], tops = [], y = frame.plot.y + topRoom;
543
625
  heights.forEach((h, i) => {
544
626
  tops.push(y), y += heads?.[i].h ?? 0, plots.push({ x: plotX, y, w: plotW, h }), y += h + gap;
545
627
  });
546
- let derived = { gap, gutterWidth: narrow ? 0 : gutter, axisOwner: data.panels.at(-1).id, readouts: computed.panels.map((p) => p.readout), panels: [] }, bandLabelHeight = 0;
628
+ let derived = { gap, gutterWidth: narrow ? 0 : gutter, axisOwner: data.panels.at(-1).id, readouts: computed.panels.map((p) => printedReadout(p.readout, showHeadline, showSpan)), panels: [] }, bandLabelHeight = 0;
547
629
  if (computed.maturing.length) {
548
630
  let scope = data.states.maturing, indexes = scope.panels.map((id) => data.panels.findIndex((p) => p.id === id)).sort((a, b) => a - b), first = plots[indexes[0]], last = plots[indexes.at(-1)], firstTop = tops[indexes[0]], bandAt = categoryBandFromCenters(data.categories.map((c) => c.id), first, (i) => plotX + (i + 0.5) * step, "x"), left = bandAt(scope.from), right = bandAt(scope.to), rect = { x: left.x, y: firstTop - firstOverhang, w: right.x + right.w - left.x, h: last.y + last.h - firstTop + firstOverhang }, nodeId = "stack:maturing:band";
549
631
  derived.band = { rect, panels: indexes.map((i) => data.panels[i].id), categoryIds: computed.maturing.map((i) => data.categories[i].id), nodeId }, scene.push({ t: "rect", id: nodeId, rect, fill: wash(neutral, 0.035), owner: { annotationId: "stack:maturing" }, part: "band" });
@@ -558,15 +640,16 @@ function layoutMetricStack(raw, options) {
558
640
  scene.push(node), ci !== void 0 && nodeIds[ci].push(node.id);
559
641
  };
560
642
  marks.panels.push({ id: p.panel.id, type: p.panel.type, plot, content: { x: frame.plot.x, y: plot.y, w: frame.plot.w, h: plot.h }, title: p.panel.title, row: pi, column: 0 }), derived.panels.push({ id: p.panel.id, domain: [0, domainMax], plot, values: p.values, states: p.states, displayed, nodeIds });
561
- let boxes = heads?.[pi] ?? gutterBoxes[pi], head = heads?.[pi], gy = tops[pi];
562
- put(`${p.panel.id}:name`, p.panel.title, nameFont, { x: frame.plot.x, y: gy, w: boxes.name.w, h: boxes.name.h }, owner, { token: "ink" }, "label", "category", boxes.name.lines);
563
- let unitBeside = head ? head.unitBeside : gutterBoxes[pi].beside;
564
- unitBeside ? put(`${p.panel.id}:unit`, p.panel.unit, keyFont, { x: frame.plot.x + boxes.name.w + 2 * spanSpace, y: gy + boxes.name.h - boxes.unit.h, w: boxes.unit.w, h: boxes.unit.h }, owner, muted, "secondary", "category", boxes.unit.lines) : (gy += boxes.name.h + 2, put(`${p.panel.id}:unit`, p.panel.unit, keyFont, { x: frame.plot.x, y: gy, w: boxes.unit.w, h: boxes.unit.h }, owner, muted, "secondary", "category", boxes.unit.lines)), gy = head ? tops[pi] + head.top + 8 : unitBeside ? tops[pi] + gutterBoxes[pi].top + 4 : gy + boxes.unit.h + (compactReadout ? 4 : 10);
565
- let hero = measure(p.readout.headlineText, heroFont), headlineClaim = p.readout.claims.find((c) => c.id === `stack:${p.panel.id}:headline` || c.id === `stack:${p.panel.id}:rate`);
566
- put(`${p.panel.id}:headline`, p.readout.headlineText, heroFont, { x: frame.plot.x, y: gy, w: hero.width, h: compactReadout ? heroFont.size : heightOf(heroFont) }, owner, color, "title", "point", [p.readout.headlineText], headlineClaim.id);
567
- let before = p.readout.claims.find((c) => c.id === `stack:${p.panel.id}:before`), after = p.readout.claims.find((c) => c.id === `stack:${p.panel.id}:after`), gx = frame.plot.x, heroTop = gy;
568
- head?.spanBeside || !head && compactReadout ? (gx += hero.width + 3 * spanSpace, gy += heightOf(heroFont) / 2 - heightOf(unitFont) / 2 + 0.36 * (heroFont.size - unitFont.size)) : gy += heightOf(heroFont) + 6;
569
- for (let [suffix, text, claim] of [["before", before.output.displayed, before.id], ["arrow", "\u2192", void 0], ["after", after.output.displayed, after.id]]) {
643
+ let boxes = heads?.[pi] ?? gutterBoxes[pi], head = heads?.[pi], gy = tops[pi], lineAlign = trackAlign === "right" ? "end" : trackAlign === "center" ? "middle" : void 0, putLines = (...args) => {
644
+ put(...args);
645
+ let last = requests.at(-1);
646
+ lineAlign && last?.id === args[0] && (last.align = lineAlign);
647
+ }, unitBeside = head ? head.unitBeside : gutterBoxes[pi].beside, nameX = seat(unitBeside ? boxes.name.w + 2 * spanSpace + boxes.unit.w : boxes.name.w);
648
+ putLines(`${p.panel.id}:name`, p.panel.title, nameFont, { x: nameX, y: gy, w: boxes.name.w, h: boxes.name.h }, owner, { token: "ink" }, "label", "category", boxes.name.lines), unitBeside ? put(`${p.panel.id}:unit`, p.panel.unit, keyFont, { x: nameX + boxes.name.w + 2 * spanSpace, y: gy + boxes.name.h - boxes.unit.h, w: boxes.unit.w, h: boxes.unit.h }, owner, muted, "secondary", "category", boxes.unit.lines) : showUnit ? (gy += boxes.name.h + 2, putLines(`${p.panel.id}:unit`, p.panel.unit, keyFont, { x: seat(boxes.unit.w), y: gy, w: boxes.unit.w, h: boxes.unit.h }, owner, muted, "secondary", "category", boxes.unit.lines)) : gy += boxes.name.h, gy = head ? tops[pi] + head.top + 8 : unitBeside ? tops[pi] + gutterBoxes[pi].top + 4 : gy + boxes.unit.h + (compactReadout ? 4 : 10);
649
+ let hero = measure(p.readout.headlineText, heroFont), headlineClaim = p.readout.claims.find((c) => c.id === `stack:${p.panel.id}:headline` || c.id === `stack:${p.panel.id}:rate`), sideBySide = showHeadline && showSpan && (head?.spanBeside || !head && compactReadout), heroX = seat(sideBySide ? hero.width + 3 * spanSpace + spanWidths[pi] : hero.width);
650
+ showHeadline && put(`${p.panel.id}:headline`, p.readout.headlineText, heroFont, { x: heroX, y: gy, w: hero.width, h: compactReadout ? heroFont.size : heightOf(heroFont) }, owner, color, "title", "point", [p.readout.headlineText], headlineClaim.id);
651
+ let before = p.readout.claims.find((c) => c.id === `stack:${p.panel.id}:before`), after = p.readout.claims.find((c) => c.id === `stack:${p.panel.id}:after`), gx = sideBySide ? heroX : seat(spanWidths[pi]), heroTop = gy;
652
+ if (sideBySide ? (gx += hero.width + 3 * spanSpace, gy += heightOf(heroFont) / 2 - heightOf(unitFont) / 2 + 0.36 * (heroFont.size - unitFont.size)) : showHeadline && (gy += heightOf(heroFont) + 6), showSpan) for (let [suffix, text, claim] of [["before", before.output.displayed, before.id], ["arrow", "\u2192", void 0], ["after", after.output.displayed, after.id]]) {
570
653
  suffix === "arrow" && (gx += spanSpace);
571
654
  let width = suffix === "arrow" ? arrowWidth : measure(text, unitFont).width;
572
655
  put(`${p.panel.id}:${suffix}`, text, unitFont, { x: gx, y: gy, w: width, h: heightOf(unitFont) }, owner, muted, "axis", "point", [text], claim), gx += width + (suffix === "arrow" ? spanSpace : 0);
@@ -574,10 +657,10 @@ function layoutMetricStack(raw, options) {
574
657
  let barWidth = step * 0.64, segmentLabels = stacked(p) && !thin && data.categories.every((_, ci) => {
575
658
  let part = p.parts[0][ci];
576
659
  return !visible(ci) || !part || part / domainMax * plot.h >= heightOf(valueFont) + 10 && measure(formatValue(part), valueFont).width < barWidth - 6;
577
- }), key = head ? head.key : gutterKeys[pi], keyTop = head ? tops[pi] + head.body : compactReadout ? heroTop + heroBlock : gy + heightOf(unitFont) + 6;
660
+ }), key = head ? head.key : gutterKeys[pi], keyTop = head ? tops[pi] + head.body : compactReadout ? heroTop + heroBlock : gy + (showSpan ? heightOf(unitFont) + 6 : 0);
578
661
  for (let item of key.placed) {
579
662
  if (item.id === "stack:totals" && segmentLabels) continue;
580
- let kx = frame.plot.x + item.dx, ky = keyTop + item.dy;
663
+ let rowW = maxOf(key.placed.filter((other) => other.dy === item.dy && !(other.id === "stack:totals" && segmentLabels)).map((other) => other.dx + other.w)), kx = seat(rowW) + item.dx, ky = keyTop + item.dy;
581
664
  item.paint && scene.push({ t: "rect", id: `${p.panel.id}:key:${item.id}`, rect: { x: kx, y: ky + (keyRow - keySwatch) / 2, w: keySwatch, h: keySwatch }, fill: item.paint, owner: { seriesId: item.id }, part: "swatch" });
582
665
  let tx = item.paint ? kx + keySwatch + 5 : kx;
583
666
  put(`${p.panel.id}:key:${item.id}:label`, item.label, keyFont, { x: tx, y: ky + (keyRow - heightOf(keyFont)) / 2, w: item.textW, h: heightOf(keyFont) * item.lines.length }, { seriesId: item.id }, muted, "secondary", "category", item.lines);
@@ -625,6 +708,8 @@ function layoutMetricStack(raw, options) {
625
708
  } else
626
709
  emit({ t: "circle", id: `${p.panel.id}:point:${category.id}`, cx: x, cy: top, r: 4.5, fill: provisional ? { token: "background" } : color, ...provisional ? { stroke: muted, strokeWidth: strokeToken(theme, "mark") } : {}, owner: cellOwner, part: provisional ? "provisionalPoint" : "point" }, ci), occupied.claim({ x: x - 4.5, y: top - 4.5, w: 9, h: 9 }, "mark", cellOwner, "point");
627
710
  valued(ci) && centerText(`${p.panel.id}:value:${category.id}`, labelText, valueFont, x, top - labelGap - heightOf(valueFont), cellOwner, provisional ? muted : { token: "ink" }, "label", "point", void 0, p.panel.type === "line" && top + labelGap + heightOf(valueFont) < baseline - 2 ? top + labelGap : void 0);
711
+ let valueRequest = requests.at(-1);
712
+ p.panel.type === "line" && valueRequest?.id === `${p.panel.id}:value:${category.id}` && (valueRequest.priority = ci === latest ? PRIORITY.endpoint : PRIORITY.interior);
628
713
  }), emit({ t: "line", id: `${p.panel.id}:baseline`, x1: plotX, x2: plotX + plotW, y1: baseline, y2: baseline, stroke: { token: "axis" }, width: strokeToken(theme, "rule"), owner, part: "baseline" }), occupied.claim({ x: plotX, y: baseline - 0.5, w: plotW, h: 1 }, "axis", owner, "baseline");
629
714
  });
630
715
  let axisY = plots.at(-1).y + plots.at(-1).h + 8;
@@ -640,18 +725,28 @@ function layoutMetricStack(raw, options) {
640
725
  put(`stack:period:${i}`, period.label, f, { x: x + 2, y: y2 + 4, w: box.w, h: box.h }, { categoryId: period.from }, bold ? { token: "ink" } : muted, "secondary", "category", box.lines), scene.push({ t: "line", id: `stack:period:rule:${i}`, x1: x + 1.5, x2: x + indexes.length * step - 1.5, y1: y2, y2, stroke: bold ? { token: "ink" } : { token: "grid" }, width: strokeToken(theme, bold ? "data" : "rule"), owner: {}, part: "periodRule" });
641
726
  });
642
727
  for (let request of requests) yielding.has(request.id) && (request.priority = PRIORITY.interior);
643
- let solved = solveLabels(requests, occupied, { density: "full", pins: options.labelPlacements ?? {}, measure, plot: frame.plot, canvas: { x: 0, y: 0, w: size.width, h: size.height }, darkInk: theme.color.ink, lightInk: theme.color.inkInverse, labelPad: 0 }), fonts = new Map(requests.map((request) => [request.id, request.font]));
728
+ let solved = solveLabels(requests, occupied, { focus: options.focus, density: options.labelDensity ?? "full", pins: options.labelPlacements ?? {}, labelOffsets: options.labelOffsets, measure, plot: frame.plot, canvas: { x: 0, y: 0, w: size.width, h: size.height }, darkInk: theme.color.ink, lightInk: theme.color.inkInverse, labelPad: 0 }), fonts = new Map(requests.map((request) => [request.id, request.font]));
644
729
  for (let label of solved.placed)
645
730
  label.ink = inks.get(label.id) ?? label.ink, label.font = fonts.get(label.id);
646
- let hidden = solved.placed.filter((l) => l.hidden && !yielding.has(l.id));
647
- if (hidden.length) {
648
- let width = options[NO_WIDER_SEARCH] ? void 0 : widerThatPlaces(raw, options, size, automatic);
649
- if (width !== void 0) return needsWidth(width);
650
- spacingError("options.size", `Metric stack cannot place ${hidden.map((l) => `'${l.text}'`).join(", ")} at ${size.width} \xD7 ${size.height} px`);
731
+ let hidden = solved.placed.filter((l) => (l.hidden === "collision" || l.hidden === "tooSmall") && !yielding.has(l.id)), probe = options[GUTTER_PROBE] === !0;
732
+ if (hidden.length && probe && spacingError("options.size", `Metric stack cannot place ${hidden.map((l) => `'${l.text}'`).join(", ")} at ${size.width} \xD7 ${size.height} px`), hidden.length && gutter > defaultGutter) {
733
+ let places = (width) => {
734
+ try {
735
+ return layoutMetricStack(raw, { ...options, [GUTTER_LIMIT]: width, [GUTTER_PROBE]: !0 }).scene.length > 0;
736
+ } catch (error) {
737
+ if (error instanceof NormalizeError) return !1;
738
+ throw error;
739
+ }
740
+ }, low = defaultGutter, high = gutter;
741
+ for (; high - low > 1; ) {
742
+ let mid = Math.floor((low + high) / 2);
743
+ places(mid) ? low = mid : high = mid;
744
+ }
745
+ return layoutMetricStack(raw, { ...options, [GUTTER_LIMIT]: low });
651
746
  }
652
747
  pushAll(scene, labelsToNodes(theme, solved.placed, () => valueFont));
653
- let counts = [structureCount("panels", data.panels.length, void 0, options), structureCount("categories", data.categories.length, void 0, options), structureCount("series", data.measures.length, chartString(options, "sourceMeasures", { v1: data.measures.length }))];
654
- return {
748
+ let counts = [structureCount("panels", data.panels.length, void 0, options), structureCount("categories", data.categories.length, void 0, options), structureCount("series", data.measures.length, chartString(options, "sourceMeasures", { v1: data.measures.length }))], requested = new Set(requests.flatMap((request) => request.claimIds ?? [])), unprinted = derived.readouts.flatMap((readout) => readout.claims.filter((claim) => !requested.has(claim.id)).map((claim) => claim.id));
749
+ return withUnprintedClaims({
655
750
  type: "grid",
656
751
  size,
657
752
  plot: frame.plot,
@@ -664,10 +759,10 @@ function layoutMetricStack(raw, options) {
664
759
  marks,
665
760
  derived: { metricStack: derived, sharedPlotX: plotX, sharedPlotW: plotW, tierGap: gap },
666
761
  sizing: { aspect: "content", fit: "content", minWidth: size.width, minHeight, measuredMinWidth: size.width, measuredMinHeight: minHeight, naturalWidth: size.width, naturalHeight, comfortableWidth: size.width, comfortableHeight: naturalHeight },
667
- a11y: { title: accessibleTitle(options.title, chartString(options, "metricStackTitle", { v1: data.panels.length })), counts, desc: chartString(options, "metricStackDesc", { v1: counts.map((c) => c.text).join(", "), v2: data.panels.map((p) => p.title).join("; "), v3: computed.panels.map((p) => `${p.panel.title}: ${p.readout.headlineText}; ${p.readout.spanText}.`).join(" ") }) },
668
- warnings: solved.warnings,
762
+ a11y: { title: accessibleTitle(options.title, chartString(options, "metricStackTitle", { v1: data.panels.length })), counts, desc: chartString(options, "metricStackDesc", { v1: counts.map((c) => c.text).join(", "), v2: data.panels.map((p) => p.title).join("; "), v3: hasMethod ? computed.panels.map((p) => `${p.panel.title}: ${[...showHeadline ? [p.readout.headlineText] : [], ...showSpan ? [p.readout.spanText] : []].join("; ")}.`).join(" ") : "" }) },
763
+ warnings: [...solved.warnings, ...stackColumnWarnings(stack, narrow, gutterFloored, gutterCapped)],
669
764
  debug: { occupied: occupied.snapshot(), decisions: solved.decisions }
670
- };
765
+ }, unprinted);
671
766
  }
672
767
 
673
768
  // src/core/strings/layoutGrid.ts
@@ -699,7 +794,34 @@ function smallestKpiValueSize(children) {
699
794
  let figures = (child) => child.scene.filter((node) => (child.type === "kpi" ? node.id === "label:total:value" : node.id.startsWith("label:total:")) && node.t === "text"), sizes = children.filter((child) => hasKpiFigure(child.type)).map((child) => ({ type: child.type, nodes: figures(child) })).filter(({ type, nodes }) => type !== "waffle" || nodes.length <= 1).flatMap(({ nodes }) => nodes.map((node) => node.t === "text" ? node.font.size : 1 / 0));
700
795
  return sizes.length > 1 && maxOf(sizes) > minOf(sizes) ? minOf(sizes) : void 0;
701
796
  }
702
- function layoutChildChart(data, options, layout) {
797
+ var namesUnit = (value) => Array.isArray(value) ? value.some(namesUnit) : typeof value == "object" && value !== null && Object.entries(value).some(([key, entry]) => key === "unit" ? typeof entry == "string" : namesUnit(entry));
798
+ function inheritedScaleUnit(panelOptions, panelData, gridUnit) {
799
+ return panelOptions.unit === void 0 && !namesUnit(panelData) && unitMagnitude(gridUnit) !== void 0 ? { unit: gridUnit, unitShown: !0 } : {};
800
+ }
801
+ var refusedPanels = /* @__PURE__ */ new WeakMap();
802
+ function takeRefusedPanel(error) {
803
+ let panel = refusedPanels.get(error);
804
+ return refusedPanels.delete(error), panel;
805
+ }
806
+ function panelAnnotations(panel) {
807
+ if (panel.annotations) return { annotations: withAnnotationOrigins(panel.annotations, ["annotations"]) };
808
+ let own = panel.options?.annotations;
809
+ return Array.isArray(own) ? { annotations: withAnnotationOrigins(own, ["options", "annotations"]) } : {};
810
+ }
811
+ function recordedPanelOptions(options) {
812
+ let { measure: _measure, ...rest } = options;
813
+ return withoutAnnotationOrigins(rest);
814
+ }
815
+ var laidOutPanels = /* @__PURE__ */ new WeakMap(), panelInput = (geometry) => laidOutPanels.get(geometry);
816
+ function layoutChildChart(data, options, layout, panelId) {
817
+ try {
818
+ let geometry = childLayout(data, options, layout);
819
+ return geometry.warnings.some((warning) => warning.field || warning.fix) && laidOutPanels.set(geometry, { data, options }), geometry;
820
+ } catch (error) {
821
+ throw error instanceof NormalizeError && !refusedPanels.has(error) && refusedPanels.set(error, { panelId, data, options }), error;
822
+ }
823
+ }
824
+ function childLayout(data, options, layout) {
703
825
  let geometry = layout(data, options);
704
826
  if (geometry.refused) return geometry;
705
827
  if (geometry.sizing?.fit === "content") {
@@ -740,21 +862,21 @@ function gridRowHeights(height, children, rows, gaps) {
740
862
  let flexibleWeight = sum(rows.filter((_, row) => fixed[row] === void 0)), remaining = Math.max(0, height - sum(gaps) - sum(fixed.map((value) => value ?? 0)));
741
863
  return rows.map((weight, row) => fixed[row] ?? remaining * weight / flexibleWeight);
742
864
  }
743
- function gridSizing(size, area, children, rows, columns, rowGaps, columnGaps, automaticRows = !1) {
744
- let fixed = contentRows(children, rows, rowGaps, automaticRows), required = (axis, weights, gaps, natural = !1) => {
865
+ function gridSizing(size, area, children, rows, columns, rowGaps, columnGaps, automaticRows = !1, minimumRows = rows, askedRows, slotsFirst = !1) {
866
+ let fixed = contentRows(children, rows, rowGaps, automaticRows), required = (axis, weights, gaps, mode = "minimum") => {
745
867
  let heights = weights.map((_, row) => axis === "row" ? fixed[row] : void 0), flexible = weights.map((weight, row) => heights[row] === void 0 ? weight : 0), total = sum(flexible);
746
868
  return sum(gaps) + sum(heights.map((value) => value ?? 0)) + Math.max(0, maxOf(children.map((child) => {
747
- let start = child[axis], span = axis === "row" ? child.rowSpan : child.columnSpan, g = child.geometry, need = axis === "column" ? g.sizing?.minWidth ?? 0 : (natural ? g.sizing?.naturalHeight : g.sizing?.minHeight) ?? (g.refused ? 0 : Math.max(g.frame.minHeight ?? 0, g.frame.plotMinHeight ?? 0)), weight = sum(flexible.slice(start, start + span)), held = sum(heights.slice(start, start + span).map((value) => value ?? 0));
869
+ let start = child[axis], span = axis === "row" ? child.rowSpan : child.columnSpan, g = child.geometry, need = axis === "column" ? g.sizing?.minWidth ?? 0 : (mode === "natural" ? g.sizing?.naturalHeight : mode === "asked" ? Math.max(g.sizing?.minHeight ?? 0, g.refused ? 0 : g.frame.plotMinHeight ?? 0) : g.sizing?.minHeight) ?? (g.refused ? 0 : Math.max(g.frame.minHeight ?? 0, g.frame.plotMinHeight ?? 0)), weight = sum(flexible.slice(start, start + span)), held = sum(heights.slice(start, start + span).map((value) => value ?? 0));
748
870
  return weight === 0 ? 0 : Math.max(0, need - held - sum(gaps.slice(start, start + span - 1))) * total / weight;
749
871
  })));
750
- }, hasContentRows = fixed.some((value) => value !== void 0), content = hasContentRows || children.length > 0 && children.every((child) => child.geometry.sizing?.fit === "content"), policy = chartSizing("grid"), chrome = size.height - area.h, minimumRows = required("row", rows, rowGaps), naturalRows = hasContentRows ? Math.max(
751
- minimumRows,
872
+ }, hasContentRows = fixed.some((value) => value !== void 0), content = hasContentRows || children.length > 0 && children.every((child) => child.geometry.sizing?.fit === "content"), policy = chartSizing("grid"), chrome = size.height - area.h, slotMinimum = required("row", rows, rowGaps), minimumHeight = minimumRows === rows ? slotMinimum : required("row", minimumRows, rowGaps), naturalRows = hasContentRows ? Math.max(
873
+ slotMinimum,
752
874
  sum(rowGaps) + sum(fixed.map((value) => value ?? 0)) + Math.max(0, resolveSizing(policy, size).naturalHeight - chrome - sum(rowGaps)) * sum(rows.filter((_, row) => fixed[row] === void 0)) / sum(rows)
753
- ) : required("row", rows, rowGaps, !0);
875
+ ) : required("row", rows, rowGaps, "natural");
754
876
  return resolveSizing(content ? { ...policy, fit: "content", aspect: "content", minHeight: 0 } : policy, size, {
755
877
  minWidth: size.width - area.w + required("column", columns, columnGaps),
756
- minHeight: chrome + minimumRows,
757
- ...content ? { naturalHeight: chrome + naturalRows } : {}
878
+ minHeight: chrome + (slotsFirst ? slotMinimum : Math.min(minimumHeight, slotMinimum)),
879
+ ...content ? { naturalHeight: chrome + naturalRows } : minimumHeight < slotMinimum ? { naturalHeight: Math.max(resolveSizing(policy, size).naturalHeight, chrome + slotMinimum, askedRows && size.height >= chrome + minimumHeight ? chrome + required("row", askedRows, rowGaps, "asked") : 0) } : {}
758
880
  });
759
881
  }
760
882
  var GridChildRefusal = class extends Error {
@@ -779,11 +901,7 @@ var GridChildRefusal = class extends Error {
779
901
  };
780
902
 
781
903
  // src/core/grid/layoutGrid.ts
782
- function serializableOptions(options) {
783
- let { measure: _measure, ...rest } = options;
784
- return rest;
785
- }
786
- var TIER_WEIGHT_FIRST = 2.2, TIER_SLACK_PASSES = 32, TIER_SLACK_BACKOFFS = 8;
904
+ var TIER_WEIGHT_FIRST = 2.2, TIER_SLACK_PASSES = 32, TIER_SLACK_BACKOFFS = 8, TIER_PLOT_FLOOR = 10.5, DROPPED_VALUE_WARNINGS = /* @__PURE__ */ new Set(["label-hidden", "values-in-note", "value-labels-dropped-series"]);
787
905
  function sharedYGroup(panels) {
788
906
  let group = null;
789
907
  for (let p of panels) {
@@ -810,14 +928,17 @@ function measuredCaption(text, font, width, measure) {
810
928
  };
811
929
  }
812
930
  function sharedCategoryLabelOwner(panels) {
813
- return panels.findIndex((panel) => {
931
+ let labelled = (panel) => {
814
932
  let options = isRecord(panel.options) ? panel.options : {};
815
933
  return options.labels === !1 ? !1 : !isRecord(options.labels) || options.labels.category !== !1;
816
- });
934
+ }, column = varianceTierWeights(panels) ? panels.findIndex((panel) => panel.type === "column" && labelled(panel)) : -1;
935
+ return column >= 0 ? column : panels.findIndex(labelled);
817
936
  }
818
- function bottomUpTierOrder(panels) {
819
- let owner = sharedCategoryLabelOwner(panels), indexes = panels.map((_, index) => index);
820
- return owner < 0 ? indexes : [owner, ...indexes.filter((index) => index !== owner)];
937
+ function bottomUpTierOrder(panels, position = "above") {
938
+ let owner = sharedCategoryLabelOwner(panels), indexes = panels.map((_, index) => index), anchor = owner >= 0 ? owner : position === "below" ? panels.findIndex((panel) => panel.type === "column") : -1;
939
+ if (anchor < 0) return indexes;
940
+ let others = indexes.filter((index) => index !== anchor);
941
+ return position === "below" ? [...others.reverse(), anchor] : [anchor, ...others];
821
942
  }
822
943
  function gridShare(panels, share) {
823
944
  return share ?? (varianceTierWeights(panels) ? "category" : "none");
@@ -889,7 +1010,7 @@ function layoutGridPass(data, options = {}) {
889
1010
  measure
890
1011
  },
891
1012
  occupied
892
- ), area = frameResult.plot, n = data.panels.length, categoryOwner = compactTiers ? sharedCategoryLabelOwner(data.panels) : -1, bottomUpOrder = bottomUpTierOrder(data.panels), columns = share === "category" ? 1 : Math.max(1, options.columns ?? 1), rows = Math.ceil(n / columns), facetGaps = options[FACET_GAPS], gap = columns === 1 ? theme.space.tierGap : facetGaps?.column ?? theme.space.facetGap, rowGap = columns === 1 ? gap : facetGaps?.row ?? gap, slots = [];
1013
+ ), area = frameResult.plot, n = data.panels.length, categoryOwner = compactTiers ? sharedCategoryLabelOwner(data.panels) : -1, bottomUpOrder = bottomUpTierOrder(data.panels, options.variancePosition), columns = share === "category" ? 1 : Math.max(1, options.columns ?? 1), rows = Math.ceil(n / columns), facetGaps = options[FACET_GAPS], gap = columns === 1 ? theme.space.tierGap : facetGaps?.column ?? theme.space.facetGap, rowGap = columns === 1 ? gap : facetGaps?.row ?? gap, slots = [];
893
1014
  if (share === "category") {
894
1015
  let gap2 = theme.space.tierGap, weights = tierWeights(data.panels), wSum = weights.reduce((a, b) => a + b, 0), usable = area.h - gap2 * (n - 1), y = area.y + area.h;
895
1016
  for (let i of bottomUpOrder) {
@@ -929,9 +1050,10 @@ function layoutGridPass(data, options = {}) {
929
1050
  // The value is the panel count, so a tier knows whether it is the only one (isSingleVarianceTier).
930
1051
  ...varianceTiers && def.type === "variance" ? { [VARIANCE_TIER]: data.panels.length } : {},
931
1052
  ...compactTiers ? { ...suppressTitle ? { title: "" } : {}, ...labels !== void 0 ? { labels } : {} } : {},
932
- ...panel.annotations ? { annotations: panel.annotations } : {},
1053
+ ...panelAnnotations(panel),
933
1054
  ...legendInput && def.type === "column" ? { [/* @__PURE__ */ Symbol.for("boardplot.panelKeyed")]: !0 } : {},
934
1055
  ...uniformLineEndpointLegend && def.type === "line" ? { gridEndpointIdentity: "legend" } : {},
1056
+ ...inheritedScaleUnit(panelOpts, panel.data, options.unit),
935
1057
  target: options.target,
936
1058
  theme: panelOpts.theme ?? options.theme,
937
1059
  locale: panelOpts.locale ?? options.locale,
@@ -941,21 +1063,21 @@ function layoutGridPass(data, options = {}) {
941
1063
  ...marginLR ? { margin: { ...panelOpts.margin, ...marginLR } } : {},
942
1064
  measure,
943
1065
  typeClass: panelTypeClass(options) ?? typeWidthClass(resolveSize(options.size).width)
944
- }, probe = layoutChildChart(panel.data, opts, def.layout);
1066
+ }, probe = layoutChildChart(panel.data, opts, def.layout, panel.id);
945
1067
  if (probe.refused) throw new GridChildRefusal(panel.id, probe);
946
- let autoTierName = probe.derived.tierName, tierCaption = compactTiers && panelOpts.title !== !1 ? authoredTitle ?? (typeof autoTierName == "string" ? autoTierName : void 0) : void 0, tierFont = { family: theme.type.family, ...theme.type.axis }, tierReserve = compactTiers ? (tierCaption ? measuredCaption(tierCaption, tierFont, slot.w, measure).height : 0) + (tierCaption && tierDetail ? theme.space.labelPad : 0) + (tierDetail ? measuredCaption(tierDetail, tierFont, slot.w, measure).height : 0) + (tierCaption || tierDetail ? theme.space.labelPad : 0) : 0, childMargin = isRecord(opts.margin) ? opts.margin : {}, marginTop = typeof childMargin.top == "number" ? childMargin.top : 20, finalOptions = tierReserve > 0 ? { ...opts, margin: { ...childMargin, top: Math.max(marginTop, tierReserve) } } : opts, geo = tierReserve > marginTop ? layoutChildChart(panel.data, finalOptions, def.layout) : probe;
1068
+ let autoTierName = probe.derived.tierName, tierCaption = compactTiers && panelOpts.title !== !1 ? authoredTitle ?? (typeof autoTierName == "string" ? autoTierName : void 0) : void 0, tierFont = { family: theme.type.family, ...theme.type.axis }, tierReserve = compactTiers ? (tierCaption ? measuredCaption(tierCaption, tierFont, slot.w, measure).height : 0) + (tierCaption && tierDetail ? theme.space.labelPad : 0) + (tierDetail ? measuredCaption(tierDetail, tierFont, slot.w, measure).height : 0) + (tierCaption || tierDetail ? theme.space.labelPad : 0) : 0, childMargin = isRecord(opts.margin) ? opts.margin : {}, marginTop = typeof childMargin.top == "number" ? childMargin.top : 20, finalOptions = tierReserve > 0 ? { ...opts, margin: { ...childMargin, top: Math.max(marginTop, tierReserve) } } : opts, geo = tierReserve > marginTop ? layoutChildChart(panel.data, finalOptions, def.layout, panel.id) : probe;
947
1069
  if (geo.refused) throw new GridChildRefusal(panel.id, geo);
948
1070
  if (options.target && tierReserve > 0)
949
1071
  for (let pass = 0; pass < 3; pass++) {
950
- let missing = Math.ceil(tierReserve - occupiedBounds(geo).y);
1072
+ let missing = Math.ceil(tierReserve - occupiedBounds(geo, measure).y);
951
1073
  if (missing <= 0) break;
952
1074
  let margin2 = finalOptions.margin;
953
- if (finalOptions = { ...finalOptions, margin: { ...margin2, top: (margin2?.top ?? marginTop) + missing } }, geo = layoutChildChart(panel.data, finalOptions, def.layout), geo.refused) throw new GridChildRefusal(panel.id, geo);
1075
+ if (finalOptions = { ...finalOptions, margin: { ...margin2, top: (margin2?.top ?? marginTop) + missing } }, geo = layoutChildChart(panel.data, finalOptions, def.layout, panel.id), geo.refused) throw new GridChildRefusal(panel.id, geo);
954
1076
  }
955
1077
  return {
956
1078
  def,
957
1079
  geo,
958
- recordOptions: serializableOptions(finalOptions),
1080
+ recordOptions: recordedPanelOptions(finalOptions),
959
1081
  tierCaption,
960
1082
  ...tierDetail ? { tierDetail } : {}
961
1083
  };
@@ -996,7 +1118,7 @@ function layoutGridPass(data, options = {}) {
996
1118
  let children = data.panels.map((p, i) => layoutPanel(p, i, slots[i]));
997
1119
  return !uniformLineEndpointLegend && !keepEndNames && landsOnEndpointLegend(children) && (uniformLineEndpointLegend = !0, children = data.panels.map((p, i) => layoutPanel(p, i, slots[i]))), alignSharedValues(children);
998
1120
  }, measureTierContents = (laidOut) => {
999
- let childContent = laidOut.map((child) => occupiedBounds(child.geo)), tierLabels = laidOut.map((child, index) => {
1121
+ let childContent = laidOut.map((child) => occupiedBounds(child.geo, measure)), tierLabels = laidOut.map((child, index) => {
1000
1122
  if (!child.tierCaption && !child.tierDetail) return;
1001
1123
  let font = { family: theme.type.family, ...theme.type.axis }, titleSize = child.tierCaption ? measuredCaption(child.tierCaption, font, child.geo.size.width, measure) : void 0, detailSize = child.tierDetail ? measuredCaption(child.tierDetail, font, child.geo.size.width, measure) : void 0, lineGap = titleSize && detailSize ? theme.space.labelPad : 0, height = (titleSize?.height ?? 0) + lineGap + (detailSize?.height ?? 0), y = childContent[index].y - theme.space.labelPad - height, title = titleSize ? { x: 0, y, w: titleSize.width, h: titleSize.height } : void 0;
1002
1124
  y += (titleSize?.height ?? 0) + lineGap;
@@ -1070,15 +1192,38 @@ function layoutGridPass(data, options = {}) {
1070
1192
  rowGaps,
1071
1193
  Array(columns - 1).fill(gap),
1072
1194
  !0
1073
- );
1074
- if (packedTiers && requirements().minHeight <= size.height) {
1075
- let weights = tierWeights(data.panels), wSum = weights.reduce((sum2, weight) => sum2 + weight, 0), gapFloor = Math.min(4, theme.space.tierGap), gapCapacity = (theme.space.tierGap - gapFloor) * (n - 1);
1195
+ ), tierRepaired = !1, plainFits = () => !0, packTiers = (repair) => {
1196
+ let weights = tierWeights(data.panels), wSum = weights.reduce((sum2, weight) => sum2 + weight, 0), gapFloor = Math.min(4, theme.space.tierGap), gapCapacity = (theme.space.tierGap - gapFloor) * (n - 1), contentTotal = () => tierContents.localContent.reduce((sum2, bounds) => sum2 + bounds.h, 0), tierMinimums = () => children.map((child) => child.geo.sizing?.minHeight ?? 0), settle = (heights2) => {
1197
+ slots.forEach((slot, index) => {
1198
+ slots[index] = { ...slot, h: heights2[index] };
1199
+ });
1200
+ let y = area.y + area.h;
1201
+ for (let i of bottomUpOrder)
1202
+ y -= slots[i].h, slots[i] = { ...slots[i], y }, y -= theme.space.tierGap;
1203
+ children = balanceVarianceTierPlots(slots, layoutChildren(), varianceWeights, layoutChildren), tierContents = measureTierContents(children);
1204
+ }, minimums = tierMinimums(), usable = area.h - theme.space.tierGap * (n - 1);
1205
+ repair && !varianceWeights && slots.some((slot, i) => slot.h + 0.5 < minimums[i] && children[i].geo.plot.h < (children[i].geo.frame.plotMinHeight ?? 0)) && minimums.reduce((a, b) => a + b, 0) <= usable && (tierRepaired = !0, settle(heightsHoldingMinimums(usable, weights, minimums)));
1206
+ let squeeze = (deficit) => {
1207
+ let give = children.map((child, i) => child.geo.plot.h > TIER_PLOT_FLOOR ? weights[i] : 0), giveSum = give.reduce((a, b) => a + b, 0);
1208
+ if (giveSum === 0) return !1;
1209
+ let before = { slots: slots.map((slot) => ({ ...slot })), children, tierContents, total: contentTotal(), sharedX, sharedW };
1210
+ tierRepaired = !0;
1211
+ let floors = tierMinimums();
1212
+ return settle(slots.map((slot, i) => Math.max(Math.min(slot.h, floors[i]), slot.h - deficit * give[i] / giveSum))), contentTotal() < before.total - 0.5 ? !0 : (before.slots.forEach((slot, i) => {
1213
+ slots[i] = slot;
1214
+ }), { children, tierContents, sharedX, sharedW } = before, !1);
1215
+ }, slackNow = () => area.h - packReserve - theme.space.tierGap * (n - 1) - contentTotal();
1216
+ plainFits = () => slackNow() >= -gapCapacity - 1;
1076
1217
  for (let pass = 0; pass < TIER_SLACK_PASSES; pass++) {
1077
- let slack = area.h - packReserve - theme.space.tierGap * (n - 1) - tierContents.localContent.reduce((sum2, bounds) => sum2 + bounds.h, 0);
1218
+ let slack = slackNow();
1078
1219
  if (slack < 0 && slack >= -gapCapacity) {
1079
1220
  effectiveTierGap = theme.space.tierGap + slack / (n - 1);
1080
1221
  break;
1081
1222
  }
1223
+ if (slack < -gapCapacity) {
1224
+ if (!repair || !squeeze(-slack - gapCapacity)) break;
1225
+ continue;
1226
+ }
1082
1227
  if (slack <= theme.space.tierGap) break;
1083
1228
  let previousSlots = slots.map((slot) => ({ ...slot })), previousChildren = children, previousTierContents = tierContents, previousSharedX = sharedX, previousSharedW = sharedW, growth = Math.max(slack, wSum * theme.space.tierGap), accepted = !1;
1084
1229
  for (let backoff = 0; backoff < TIER_SLACK_BACKOFFS; backoff++) {
@@ -1102,6 +1247,25 @@ function layoutGridPass(data, options = {}) {
1102
1247
  break;
1103
1248
  }
1104
1249
  }
1250
+ repair && slackNow() < -gapCapacity - 1 && warnings.push({
1251
+ code: "grid-panel-too-short",
1252
+ severity: "warn",
1253
+ message: `the tiers need ${Math.ceil(-slackNow() - gapCapacity)} px more height than the canvas gives, so the top tier runs into the frame above it`,
1254
+ suggest: "increase the grid height"
1255
+ });
1256
+ };
1257
+ if (packedTiers && requirements().minHeight <= size.height) {
1258
+ let state = () => ({ slots: slots.map((slot) => ({ ...slot })), children, tierContents, sharedX, sharedW, gap: effectiveTierGap, warnings: warnings.slice() }), restore = (saved) => {
1259
+ saved.slots.forEach((slot, i) => {
1260
+ slots[i] = slot;
1261
+ }), { children, tierContents, sharedX, sharedW } = saved, effectiveTierGap = saved.gap, warnings.length = 0, warnings.push(...saved.warnings);
1262
+ }, start = state();
1263
+ if (tierRepaired = !1, packTiers(!0), tierRepaired) {
1264
+ let repaired = state(), raised = requirements().minHeight > size.height, droppedValues = () => children.reduce((sum2, child) => sum2 + child.geo.warnings.filter((warning) => DROPPED_VALUE_WARNINGS.has(warning.code)).length, 0), repairedDrops = droppedValues();
1265
+ restore(start), packTiers(!1);
1266
+ let fits = plainFits();
1267
+ !raised && !(fits && droppedValues() < repairedDrops) && restore(repaired);
1268
+ }
1105
1269
  }
1106
1270
  let sizing = requirements(), { tierLabels, localContent } = tierContents, panelY = slots.map((slot) => slot.y);
1107
1271
  if (packedTiers) {
@@ -1123,7 +1287,7 @@ function layoutGridPass(data, options = {}) {
1123
1287
  ...noteText === void 0 ? {} : { noteText },
1124
1288
  ...noteTexts.leftOut.has(label.id) ? { [LEFT_OUT_OF_NOTE]: !0 } : {},
1125
1289
  id: prefix + label.id,
1126
- ...label.claimId ? { claimId: prefix + label.claimId } : {},
1290
+ ...label.claimIds ? { claimIds: label.claimIds.map((id) => prefix + id) } : {},
1127
1291
  nodeId: label.nodeId ? prefix + label.nodeId : void 0,
1128
1292
  rect: { ...label.rect, x: label.rect.x + dx, y: label.rect.y + dy },
1129
1293
  backing: label.backing ? { ...label.backing, x: label.backing.x + dx, y: label.backing.y + dy } : void 0
@@ -1163,13 +1327,13 @@ function layoutGridPass(data, options = {}) {
1163
1327
  decisions.push({ ...d, labelId: prefix + d.labelId });
1164
1328
  let warningOffset = warnings.length;
1165
1329
  for (let w of geo.warnings)
1166
- warnings.push({ ...w, message: `[${panel.id}] ${w.message}` });
1330
+ warnings.push({ ...w, message: `[${panel.id}] ${w.message}`, detail: { ...w.detail, panelId: panel.id } });
1167
1331
  let tier = tierLabels[i], titleNodeId, captionNodeId;
1168
1332
  for (let label of tier?.solved.placed ?? []) {
1169
1333
  let moved = {
1170
1334
  ...label,
1171
1335
  id: prefix + label.id,
1172
- ...label.claimId ? { claimId: prefix + label.claimId } : {},
1336
+ ...label.claimIds ? { claimIds: label.claimIds.map((id) => prefix + id) } : {},
1173
1337
  rect: { ...label.rect, x: label.rect.x + dx, y: label.rect.y + dy }
1174
1338
  };
1175
1339
  if (label.hidden) {
@@ -1271,8 +1435,19 @@ function appendPanelScene(scene, geometry, panelId, prefix, dx, dy) {
1271
1435
  function withoutCategoryLabels(labels) {
1272
1436
  return labels === !1 ? !1 : { ...isRecord(labels) ? labels : {}, category: !1 };
1273
1437
  }
1274
- function occupiedBounds(geometry) {
1438
+ function heightsHoldingMinimums(usable, weights, minimums) {
1439
+ let held = /* @__PURE__ */ new Set();
1440
+ for (; ; ) {
1441
+ let free = usable - [...held].reduce((sum2, i) => sum2 + minimums[i], 0), open = weights.reduce((sum2, weight, i) => sum2 + (held.has(i) ? 0 : weight), 0), heights = weights.map((weight, i) => held.has(i) ? minimums[i] : free * weight / open), under = heights.flatMap((height, i) => !held.has(i) && height < minimums[i] ? [i] : []);
1442
+ if (under.length === 0) return heights;
1443
+ under.forEach((i) => held.add(i));
1444
+ }
1445
+ }
1446
+ function occupiedBounds(geometry, measure) {
1275
1447
  let rects = geometry.debug.occupied.filter((item) => item.kind !== "reserved").map((item) => item.rect);
1448
+ for (let node of geometry.scene)
1449
+ if (!(node.t !== "text" || !node.rotate || node.opacity === 0))
1450
+ for (let box of lineBoxes(node, measure)) rects.push({ x: box.x0, y: box.y0, w: box.x1 - box.x0, h: box.y1 - box.y0 });
1276
1451
  if (rects.length === 0) return geometry.plot;
1277
1452
  let x1 = minOf(rects.map((rect) => rect.x)), y1 = minOf(rects.map((rect) => rect.y)), x2 = maxOf(rects.map((rect) => rect.x + rect.w)), y2 = maxOf(rects.map((rect) => rect.y + rect.h));
1278
1453
  return { x: x1, y: y1, w: x2 - x1, h: y2 - y1 };
@@ -1309,24 +1484,75 @@ function normalizeGridWithTheme(data, options) {
1309
1484
  return normalizeGridData(data, { palette: options.palette, themeFacts });
1310
1485
  }
1311
1486
  function layoutGrid2(data, options = {}) {
1312
- options = resolveCanvasOptions(options), assertTrackLimits(options);
1313
- let metricStack = isMetricStackData(data), formatWarnings = options.format === void 0 ? [] : [{
1314
- code: "format-unused",
1315
- severity: "warn",
1316
- field: ["options", "format"],
1317
- message: "Grid-level options.format is ignored",
1318
- suggest: metricStack ? "Set decimals and divisor on each metric stack panel; remove the grid-level format." : "Set format on each numeric panel in data.panels[].options.format; remove the grid-level format.",
1319
- fix: [{ op: "remove", path: "/options/format" }]
1320
- }];
1321
- if (metricStack)
1322
- return requireChartCores(data.panels.map((panel) => panel.type), (type) => getChart(type) !== void 0), withWarnings(layoutMetricStack(data, options), formatWarnings);
1487
+ try {
1488
+ return layoutGridOnce(data, options);
1489
+ } catch (error) {
1490
+ throw error instanceof NormalizeError && authoredPanelRefusal(error, data, options), error;
1491
+ }
1492
+ }
1493
+ var GRID_HANDED_DOWN = /* @__PURE__ */ new Set(["palette", "colorblindSafe", "theme", "unit", "hatchStrength"]);
1494
+ function authoredPanelRebase(child, data, options) {
1495
+ let grid = data, panels = Object.hasOwn(grid, "panels") && grid.repeated !== !0 && Array.isArray(grid.panels) ? grid.panels : [], matches = panels.filter((panel2) => panel2.id === child.panelId), panel = matches.length === 1 ? matches[0] : void 0, at = ["data", "panels", panels.indexOf(panel)], childOptions = child.options;
1496
+ return (segments) => {
1497
+ if (!panel) return;
1498
+ let [head, ...rest] = segments;
1499
+ if (head === "data") return sameField(child.data, panel.data, rest) ? [...at, ...segments] : void 0;
1500
+ if (head === "annotations" || head === "options" && rest[0] === "annotations") {
1501
+ let own = head === "annotations", list = own ? panel.annotations : panel.options?.annotations, field = own ? rest : rest.slice(1);
1502
+ return own === Object.hasOwn(panel, "annotations") && sameField(childOptions.annotations, list, field) ? [...at, ...segments] : void 0;
1503
+ }
1504
+ let path = head === "options" ? rest : void 0;
1505
+ if (!(!path || path[0] === "size"))
1506
+ return sameField(childOptions, panel.options, path) ? [...at, "options", ...path] : GRID_HANDED_DOWN.has(path[0]) && sameField(childOptions, options, path) ? ["options", ...path] : void 0;
1507
+ };
1508
+ }
1509
+ function authoredPanelRefusal(error, data, options) {
1510
+ let child = takeRefusedPanel(error);
1511
+ child && (rebaseRefusal(error, authoredPanelRebase(child, data, options)), error.path = `panels[${child.panelId}]${error.path ? `.${error.path}` : ""}`);
1512
+ }
1513
+ function panelSizeNeed(fix) {
1514
+ for (let operation of fix ?? []) {
1515
+ if (operation.op !== "replace" && operation.op !== "add") continue;
1516
+ let value = operation.value, size = operation.path === "/options/size" ? value : operation.path === "/options/size/width" ? { width: value } : operation.path === "/options/size/height" ? { height: value } : void 0, width = typeof size?.width == "number" ? size.width : void 0, height = typeof size?.height == "number" ? size.height : void 0;
1517
+ if (width !== void 0 && height !== void 0) return `${width} \xD7 ${height} px`;
1518
+ if (width !== void 0) return `a width of ${width} px`;
1519
+ if (height !== void 0) return `a height of ${height} px`;
1520
+ }
1521
+ }
1522
+ function authoredPanelWarnings(geometry, data, options) {
1523
+ if (geometry.refused || !geometry.warnings.some((warning) => warning.detail?.panelId !== void 0 && (warning.field || warning.fix))) return geometry;
1524
+ let spans = /* @__PURE__ */ new Map();
1525
+ for (let panel of geometry.marks.panels) {
1526
+ let chart = panel.chart;
1527
+ if (chart?.warningOffset === void 0) continue;
1528
+ let input = panelInput(chart.geometry), rebase = input ? authoredPanelRebase({ panelId: panel.id, ...input }, data, options) : () => {
1529
+ };
1530
+ for (let index = 0; index < chart.geometry.warnings.length; index++) spans.set(chart.warningOffset + index, rebase);
1531
+ }
1532
+ return { ...geometry, warnings: geometry.warnings.map((warning, index) => {
1533
+ let panelId = warning.detail?.panelId;
1534
+ if (panelId === void 0 || !warning.field && !warning.fix) return warning;
1535
+ let moved = rebaseWarning(warning, spans.get(index) ?? (() => {
1536
+ }));
1537
+ if (moved.fix && geometry.marks.panels.length > 1 && !moved.fix.every((operation) => operation.path.startsWith("/data/panels/"))) {
1538
+ let { fix: _dropped, ...rest } = moved;
1539
+ moved = rest;
1540
+ }
1541
+ let need = moved.fix ? void 0 : panelSizeNeed(warning.fix);
1542
+ return need ? { ...moved, suggest: `Panel ${String(panelId)} needs ${need}. Give the grid more room.` } : moved;
1543
+ }) };
1544
+ }
1545
+ function layoutGridOnce(data, options) {
1546
+ let authoredOptions = options;
1547
+ if (options = resolveCanvasOptions(options), assertTrackLimits(options), isMetricStackData(data))
1548
+ return requireChartCores(data.panels.map((panel) => panel.type), (type) => getChart(type) !== void 0), layoutMetricStack(data, options);
1323
1549
  options.stack && stackError("data", "Metric stack mode needs shared categories and measures");
1324
1550
  let normalized = normalizeGridWithTheme(data, options);
1325
1551
  requireChartCores(normalized.panels.map((panel) => panel.type), (type) => getChart(type) !== void 0), assertTrackLimits(options, normalized.panels), normalized.panels = normalized.panels.map((panel) => panel.options ? { ...panel, options: resolveCanvasOptions(panel.options) } : panel);
1326
1552
  let authored = usesAuthoredLayout(normalized.panels, options);
1327
1553
  authored && normalized.rowCaption && (normalized.panels = normalized.panels.map((panel) => ({ ...panel, caption: panel.caption ?? normalized.rowCaption })), delete normalized.rowCaption), options = { ...options, sharedAxis: gridShare(normalized.panels, options.sharedAxis) };
1328
1554
  let ordered = orderPanels(normalized.panels, options, authored);
1329
- if (pushAll(ordered.warnings, formatWarnings), options.sharedScale === !0) {
1555
+ if (options.sharedScale === !0) {
1330
1556
  let charts = ordered.panels.filter((panel) => panel.type !== "text" && panel.type !== "legend"), semantics = charts.map(panelScaleSemantics), first = semantics[0], matching = first != null && semantics.every((candidate) => candidate !== null && candidate.unit === first.unit && candidate.format === first.format);
1331
1557
  if (charts.length > 1 && !matching)
1332
1558
  throw new NormalizeError(
@@ -1336,24 +1562,49 @@ function layoutGrid2(data, options = {}) {
1336
1562
  "drop sharedScale, set sharedScale:false, or give every panel the same unit and format"
1337
1563
  );
1338
1564
  }
1339
- let legacy = (at) => layoutLegacyGrid({ ...normalized, panels: ordered.panels }, at), legacyGrid = (at) => withSliverRoom(withOnePanelContent(withTierPlot(legacy(at), ordered.panels, at), legacy, ordered.panels, at), legacy, at, data), geometry = withWarnings(authored ? layoutAuthoredGrid(ordered.panels, options, normalized.repeatFacet === !0) : legacyGrid(reflowed(legacyGrid, ordered.panels, options, data)), ordered.warnings);
1340
- return !geometry.refused && heightOmitted(options.size) && geometry.sizing?.fit === "content" && Math.abs(geometry.size.height - geometry.sizing.naturalHeight) > 1 ? layoutGrid2(data, { ...options, size: { width: geometry.size.width, height: geometry.sizing.naturalHeight } }) : withCardFloor(geometry, ordered.panels.map((panel) => panel.type), options);
1565
+ let legacy = (at) => layoutLegacyGrid({ ...normalized, panels: ordered.panels }, at), legacyGrid = (at) => withNoteRoom(withSliverRoom(withOnePanelContent(withTierPlot(legacy(at), ordered.panels, at), legacy, ordered.panels, at), legacy, at, data), legacy, ordered.panels, at), geometry = withWarnings(authored ? layoutAuthoredGrid(ordered.panels, options, normalized.repeatFacet === !0) : legacyGrid(reflowed(legacyGrid, ordered.panels, options, data)), ordered.warnings);
1566
+ if (!geometry.refused && heightOmitted(options.size) && geometry.sizing?.fit === "content" && Math.abs(geometry.size.height - geometry.sizing.naturalHeight) > 1)
1567
+ return layoutGrid2(data, { ...options, size: { width: geometry.size.width, height: geometry.sizing.naturalHeight } });
1568
+ let floored = withCardFloor(authoredPanelWarnings(geometry, data, authoredOptions), ordered.panels.map((panel) => panel.type), options);
1569
+ return floored.refused ? floored : withUnprintedClaims(floored, floored.marks.panels.flatMap((panel) => panel.chart ? unprintedClaims(panel.chart.geometry).map((id) => `${panel.id}/${id}`) : []));
1570
+ }
1571
+ function withNoteRoom(geometry, relayout, panels, options) {
1572
+ let sizing = geometry.sizing, open = options[TARGET_SIZE]?.fixed.height === !1, authored = panels.some((panel) => [...panel.annotations ?? [], ...panel.options?.annotations ?? []].some((annotation) => ["callout", "note"].includes(annotation.kind ?? "")));
1573
+ if (!open || !authored || !sizing || geometry.refused) return geometry;
1574
+ let hidden = (layout) => layout.refused ? [] : layout.labels.filter((label) => label.hidden === "collision" && label.id.includes("/annotation:")), at = (height2) => relayout({ ...options, size: { ...resolveSize(options.size), width: geometry.size.width, height: height2 } }), notes = hidden(geometry), content = (naturalHeight) => ({ ...geometry, sizing: { ...sizing, fit: "content", naturalHeight } });
1575
+ if (notes.length === 0) {
1576
+ if (heightOmitted(options.size) || geometry.size.height <= sizing.naturalHeight + 1) return geometry;
1577
+ let natural = at(sizing.naturalHeight), settles = natural.refused ? void 0 : natural.sizing?.naturalHeight;
1578
+ return hidden(natural).length > 0 || settles !== void 0 && Math.abs(settles - sizing.naturalHeight) > 1 && settles < geometry.size.height && hidden(at(settles)).length > 0 ? content(geometry.size.height) : geometry;
1579
+ }
1580
+ if (geometry.size.height < sizing.naturalHeight - 1) return geometry;
1581
+ let plots = geometry.marks.panels.map((panel) => panel.chart?.geometry.plot.h ?? 0), total = plots.reduce((sum2, plot) => sum2 + plot, 0), need = Math.max(...notes.map((label) => {
1582
+ let plot = plots[panels.findIndex((panel) => label.id.startsWith(`${panel.id}/`))] ?? 0;
1583
+ return plot > 0 ? (2 * label.rect.h + 8) * total / plot : 0;
1584
+ }));
1585
+ if (!(need > 0)) return geometry;
1586
+ let height = Math.ceil(Math.max(geometry.size.height, sizing.naturalHeight) + need), probe = at(height);
1587
+ return probe.refused || hidden(probe).length > 0 ? geometry : content(height);
1341
1588
  }
1342
1589
  var seats = (geometry, height) => !geometry.refused && (geometry.sizing?.minHeight ?? 0) <= height, strideLosses = (geometry) => geometry.refused ? Number.POSITIVE_INFINITY : geometry.warnings.filter((warning) => warning.code === "category-stride").length;
1343
1590
  function reflowed(relayout, panels, options, data) {
1344
1591
  let columns = options.columns, width = resolveSize(options.size).width;
1345
- if (options.reflow === !1 || typeof columns != "number" || columns < 3 || panels.length <= columns || width >= CARD_CLASS_WIDTH || legacyGridForm(panels, options) !== "facets") return options;
1592
+ if (options.reflow === !1 || typeof columns != "number" || columns < 3 || panels.length <= columns || !cardForm(width, options) || legacyGridForm(panels, options) !== "facets") return options;
1346
1593
  let height = options[TARGET_SIZE]?.fixed.height ?? !heightOmitted(options.size) ? resolveSize(options.size).height : void 0, choose = () => {
1347
1594
  let open = (count) => strideLosses(relayout({ ...options, columns: count, size: { width } }));
1348
1595
  if (open(columns) === 0) return columns;
1349
1596
  for (let fewer = columns - 1; fewer >= 2; fewer--)
1350
1597
  if (open(fewer) === 0 && (height === void 0 || seats(relayout({ ...options, columns: fewer }), height))) return fewer;
1351
1598
  return columns;
1352
- }, { size: _size, measure, ...rest } = options, key = `${width}:${height ?? "auto"}:${currentSmallValues()}:${themeRegistrations()}:${JSON.stringify(rest)}:${JSON.stringify(data)}`, cache = REFLOW_CACHE.get(measure ?? DEFAULT_MEASURER);
1599
+ }, { measure } = options, key = `${width}:${height ?? "auto"}:${layoutCacheKey(options)}:${JSON.stringify(data)}`, cache = REFLOW_CACHE.get(measure ?? DEFAULT_MEASURER);
1353
1600
  cache || REFLOW_CACHE.set(measure ?? DEFAULT_MEASURER, cache = /* @__PURE__ */ new Map()), cache.has(key) || (cache.size >= REFLOW_CACHE_SIZE && cache.delete(cache.keys().next().value), cache.set(key, choose()));
1354
1601
  let chosen = cache.get(key);
1355
1602
  return chosen === columns ? options : { ...options, columns: chosen };
1356
1603
  }
1604
+ function layoutCacheKey(options) {
1605
+ let { size: _size, measure: _measure, [CARD_HEIGHT_MEMO]: _card, [LAYOUT_CALL]: _call, ...rest } = options;
1606
+ return `${layoutStepKey()}:${themeRegistrations()}:${optionKey(rest)}`;
1607
+ }
1357
1608
  var REFLOW_CACHE = /* @__PURE__ */ new WeakMap(), DEFAULT_MEASURER = {}, REFLOW_CACHE_SIZE = 64, SLIVER_HIDDEN = "sliver-labels-hidden";
1358
1609
  function sliversHidden(probe) {
1359
1610
  return probe.warnings.some((warning) => warning.code === SLIVER_HIDDEN) || (probe.labels ?? []).some((label) => label[DIGIT_SEAT] !== void 0);
@@ -1362,7 +1613,7 @@ var SLIVER_ROOM_STEP = 4, SLIVER_ROOM_MAX = 1.3;
1362
1613
  function withSliverRoom(geometry, relayout, options, data) {
1363
1614
  let sizing = geometry.sizing, hides = sliversHidden;
1364
1615
  if (!sizing || sizing.fit === "content" || geometry.refused || !hides(geometry) || (options.sharedAxis === "category" || options.sharedAxis === void 0 ? 1 : Math.max(1, Number(options.columns ?? 1))) > 1 || geometry.marks.panels.filter((panel) => panel.chart).length !== 1) return geometry;
1365
- let { width, height } = geometry.size, at = (h) => relayout({ ...options, size: { ...resolveSize(options.size), width, height: h } }), start = Math.max(height, sizing.naturalHeight), withNatural = (found) => found === void 0 ? geometry : { ...geometry, sizing: { ...sizing, naturalHeight: found } }, { size: _size, measure, ...rest } = options, key = `${width}:${start}:${currentSmallValues()}:${themeRegistrations()}:${JSON.stringify(rest)}:${JSON.stringify(data)}`, cache = SLIVER_ROOM_CACHE.get(measure ?? DEFAULT_MEASURER);
1616
+ let { width, height } = geometry.size, at = (h) => relayout({ ...options, size: { ...resolveSize(options.size), width, height: h } }), start = Math.max(height, sizing.naturalHeight), withNatural = (found) => found === void 0 ? geometry : { ...geometry, sizing: { ...sizing, naturalHeight: found } }, { measure } = options, key = `${width}:${start}:${layoutCacheKey(options)}:${JSON.stringify(data)}`, cache = SLIVER_ROOM_CACHE.get(measure ?? DEFAULT_MEASURER);
1366
1617
  return cache || SLIVER_ROOM_CACHE.set(measure ?? DEFAULT_MEASURER, cache = /* @__PURE__ */ new Map()), cache.has(key) || (cache.size >= SLIVER_ROOM_CACHE_SIZE && cache.delete(cache.keys().next().value), cache.set(key, sliverRoomHeight(start, height, at, hides))), withNatural(cache.get(key));
1367
1618
  }
1368
1619
  var SLIVER_ROOM_CACHE = /* @__PURE__ */ new WeakMap(), SLIVER_ROOM_CACHE_SIZE = 64;
@@ -1384,15 +1635,18 @@ var STANDALONE_COMPACT = /* @__PURE__ */ new Set(["bullet", "pie", "slope"]), pa
1384
1635
  function withCardFloor(geometry, types, options) {
1385
1636
  if (geometry.refused) return geometry;
1386
1637
  let sizing = geometry.sizing;
1387
- if (sizing && options.mode === "compact" && geometry.size.width < CARD_CLASS_WIDTH && sizing.minWidth > Math.max(CARD_MIN_WIDTH, sizing.measuredMinWidth)) {
1638
+ if (sizing && options.mode === "compact" && cardForm(geometry.size.width, options) && sizing.minWidth > Math.max(CARD_MIN_WIDTH, sizing.measuredMinWidth)) {
1388
1639
  let minWidth = Math.max(CARD_MIN_WIDTH, sizing.measuredMinWidth);
1389
1640
  return { ...geometry, sizing: { ...sizing, minWidth, comfortableWidth: Math.ceil(minWidth * 1.25) } };
1390
1641
  }
1391
1642
  let charts = types.filter((type) => type !== "text" && type !== "legend");
1392
1643
  return !sizing || sizing.minWidth <= CARD_MIN_WIDTH || charts.length === 0 || !charts.every(panelCompacts) ? geometry : { ...geometry, sizing: { ...sizing, minWidth: CARD_MIN_WIDTH, measuredMinWidth: Math.min(sizing.measuredMinWidth, CARD_MIN_WIDTH), comfortableWidth: Math.ceil(CARD_MIN_WIDTH * 1.25) } };
1393
1644
  }
1394
- function compactPanelMode(panel, canvasWidth) {
1395
- return panel.type === "text" || panel.type === "legend" || panel.options?.mode !== void 0 ? {} : panelCompacts(panel.type) && canvasWidth < CARD_CLASS_WIDTH ? { mode: "compact" } : {};
1645
+ function compactPanelMode(panel, canvasWidth, options) {
1646
+ return panel.type === "text" || panel.type === "legend" || panel.options?.mode !== void 0 ? {} : panelCompacts(panel.type) && cardForm(canvasWidth, options) ? { mode: "compact" } : {};
1647
+ }
1648
+ function cardForm(width, options) {
1649
+ return width < CARD_CLASS_WIDTH || options[NARROW_FORM] === !0;
1396
1650
  }
1397
1651
  function withWarnings(geometry, warnings) {
1398
1652
  return warnings.length === 0 ? geometry : { ...geometry, warnings: [...geometry.warnings ?? [], ...warnings] };
@@ -1415,7 +1669,7 @@ function orderPanels(panels, options, authored) {
1415
1669
  let key = (panel) => {
1416
1670
  let data = panel.data, series = data?.series;
1417
1671
  if (!Array.isArray(series)) return null;
1418
- let categories = Array.isArray(data?.categories) ? data.categories.map(normalizeCategory) : void 0, normalized = categories ? series.map((entry, si) => ({ ...entry, values: normalizeSeriesValues(entry, categories, si) })) : series;
1672
+ let categories = Array.isArray(data?.categories) ? data.categories.map(normalizeCategory) : void 0, normalized = categories ? series.map((entry, si) => ({ ...entry, values: normalizeSeriesValues(entry, categories, si, "values", null) })) : series;
1419
1673
  categories && (panel.data = { ...data, categories, series: normalized });
1420
1674
  let measured = normalized.filter((entry) => entry?.role !== "reference"), total = null;
1421
1675
  for (let entry of measured) {
@@ -1546,11 +1800,11 @@ function layoutLegacyGrid(normalized, options, headPull = FACET_HEAD_PULL) {
1546
1800
  ...sharedAxis ? { valueAxis: { ...axis, gridlines: axis.gridlines ?? !0, ...index % columns === 0 ? {} : { show: !1 } } } : {},
1547
1801
  ...compactTiers && panelOptions.title === void 0 && panelTitle ? { title: panelTitle } : {},
1548
1802
  ...options.palette !== void 0 && panelOptions.palette === void 0 ? { palette: options.palette } : {},
1549
- ...compactPanelMode(panel, canvasWidth),
1803
+ ...compactPanelMode(panel, canvasWidth, options),
1550
1804
  // Facets: the grid's canvas margin and gutter are the panel's side margins; a
1551
1805
  // facet adds none of its own, so its plot spans the panel.
1552
1806
  // A compact panel on a narrow card spends no width on side margins either.
1553
- margin: { ...facets ? { left: 0, right: 0, bottom: 0 } : compactPanelMode(panel, canvasWidth).mode ? { left: 0, right: 0 } : {}, ...margin, top: numeric(margin.top, firstRow && rowCaptionHeight > 0 ? ROW_CAPTION_TOP : headTop) + captionHeight + (firstRow ? rowCaptionHeight : 0) - pull }
1807
+ margin: { ...facets ? { left: 0, right: 0, bottom: 0 } : compactPanelMode(panel, canvasWidth, options).mode ? { left: 0, right: 0 } : {}, ...margin, top: numeric(margin.top, firstRow && rowCaptionHeight > 0 ? ROW_CAPTION_TOP : headTop) + captionHeight + (firstRow ? rowCaptionHeight : 0) - pull }
1554
1808
  }
1555
1809
  };
1556
1810
  }), members = Object.fromEntries(Object.entries(groupResult.members).filter(([group]) => group !== DEFAULT_Y_GROUP && groupResult.domains[group])), composeOptions = { ...options, [SCALE_GROUP_MEMBERS]: members, ...headedGaps ? { [FACET_GAPS]: headedGaps } : {} }, geometry = layoutGrid(
@@ -1619,13 +1873,13 @@ function layoutLegacyGrid(normalized, options, headPull = FACET_HEAD_PULL) {
1619
1873
  }
1620
1874
  };
1621
1875
  }
1622
- var TIER_PLOT_FLOOR = 10.5, TIER_HEIGHT_STEP = 16;
1876
+ var TIER_PLOT_FLOOR2 = 10.5, TIER_HEIGHT_STEP = 16;
1623
1877
  function withTierPlot(geometry, panels, options) {
1624
1878
  let sizing = geometry.sizing, weights = options.sharedAxis === "category" && sharedYGroup(panels) === null ? varianceTierWeights(panels) : void 0;
1625
1879
  if (!weights || !sizing || geometry.refused) return geometry;
1626
1880
  let column = panels.findIndex((panel) => panel.type === "column"), columnOptions = panels[column].options;
1627
1881
  if (columnOptions?.variant !== "stacked") return geometry;
1628
- let open = options[TARGET_SIZE]?.fixed.height === !1, hides = open && sliversHidden(geometry), { width, height } = geometry.size, plots = geometry.marks.panels.map((panel) => panel.chart?.geometry.plot.h ?? 0), share = weights.reduce((sum2, weight) => sum2 + weight, 0) / weights[column], need = autoPlotPx(options.target ?? DEFAULT_TARGET, width) * share, reservePlot = stackedColumnPlotPx("column", columnOptions, width), reserve = Math.ceil(reservePlot * share), reach = need / share + reservePlot, squashed = plots.some((plot) => plot <= TIER_PLOT_FLOOR), id = panels[column].id, columnData = panels[column].data, withheld = new Set(columnData?.series?.flatMap((series) => series.values.flatMap((cell, index) => cellMeta(cell)?.label === !1 ? [`${id}/segment:${series.id}:${columnData.categories?.[index]?.id}`] : [])) ?? []), needs = hides ? geometry.labels.filter((label) => label.id.startsWith(`${id}/segment:`) && !withheld.has(label.id)).map((label) => {
1882
+ let open = options[TARGET_SIZE]?.fixed.height === !1, hides = open && sliversHidden(geometry), { width, height } = geometry.size, plots = geometry.marks.panels.map((panel) => panel.chart?.geometry.plot.h ?? 0), share = weights.reduce((sum2, weight) => sum2 + weight, 0) / weights[column], need = autoPlotPx(options.target ?? DEFAULT_TARGET, width) * share, reservePlot = stackedColumnPlotPx("column", columnOptions, width), reserve = Math.ceil(reservePlot * share), reach = need / share + reservePlot, squashed = plots.some((plot) => plot <= TIER_PLOT_FLOOR2), id = panels[column].id, columnData = panels[column].data, withheld = new Set(columnData?.series?.flatMap((series) => series.values.flatMap((cell, index) => cellMeta(cell)?.label === !1 ? [`${id}/segment:${series.id}:${columnData.categories?.[index]?.id}`] : [])) ?? []), needs = hides ? geometry.labels.filter((label) => label.id.startsWith(`${id}/segment:`) && !withheld.has(label.id)).map((label) => {
1629
1883
  let mark = geometry.scene.find((node) => node.id === label.id.replace("/segment:", "/mark:"));
1630
1884
  return plots[column] * ((label[DIGIT_SEAT]?.lineH ?? label.rect.h) + STACK_ROOM) / (mark?.rect?.h ?? 0);
1631
1885
  }) : [], wanted = Math.max(0, maxOf(needs.filter((plot) => plot <= reach))), drawn = plots[column] + (sizing.naturalHeight - height) / share;
@@ -1671,7 +1925,7 @@ function isAuthoredVarianceStack(panels, options) {
1671
1925
  function layoutAuthoredGrid(rawPanels, options, repeatFacet) {
1672
1926
  let theme = themeForWidth(resolveTheme(options.theme), gridTypeClass(options)), size = resolveSize(options.size), measure = options.measure ?? defaultMeasurer, warnings = [], automaticRows = options.rows === void 0, naturalTierWeights = options.sharedAxis === "category" && options.rows === void 0 && sharedYGroup(rawPanels) === null ? varianceTierWeights(rawPanels) : void 0;
1673
1927
  if (options.sharedAxis === "category") {
1674
- let bottomUp = bottomUpTierOrder(rawPanels), weights = tierWeights(rawPanels);
1928
+ let bottomUp = bottomUpTierOrder(rawPanels, options.variancePosition), weights = tierWeights(rawPanels);
1675
1929
  (((Array.isArray(options.columns) ? options.columns.length : options.columns) ?? 1) !== 1 || options.panelOrder !== void 0 || rawPanels.some((panel) => panel.row !== void 0 || panel.column !== void 0 || panel.span !== void 0) || options.rows !== void 0 && options.rows.length !== rawPanels.length) && warnings.push({
1676
1930
  code: "grid-tier-order",
1677
1931
  severity: "warn",
@@ -1735,7 +1989,9 @@ function layoutAuthoredGrid(rawPanels, options, repeatFacet) {
1735
1989
  "grid-cell-overlap",
1736
1990
  `panels[${index}]`,
1737
1991
  `panels '${rawPanels[first].id}' and '${rawPanels[index].id}' both occupy row ${r}, column ${c}`,
1738
- "move a panel or reduce its span"
1992
+ "move a panel or reduce its span",
1993
+ void 0,
1994
+ ["data", "panels", index]
1739
1995
  );
1740
1996
  occupant.set(`${r}:${c}`, index);
1741
1997
  }
@@ -1841,6 +2097,7 @@ function layoutAuthoredGrid(rawPanels, options, repeatFacet) {
1841
2097
  ), child.panel.align)), child.relayout ? { ...child, geometry: child.relayout(child.margin, valueSize) } : layoutAuthoredChild(child.panel, child.placement, child.slot, panels, options, legendItems, theme, measure)));
1842
2098
  }
1843
2099
  }
2100
+ let sizingRows = rowWeights, sizedRows = rowWeights, askedRows, packedTiers = !1, typeStepsFirst = options.target !== void 0 && floorTextScale(options.target) !== void 0 && options.textScale === void 0 && options.textSize === void 0 && options.belowMinimum !== "refuse";
1844
2101
  if (naturalTierWeights) {
1845
2102
  let wrap = () => children.map((child) => ({ child, geo: child.geometry })), tierSlots = children.map((child) => child.slot);
1846
2103
  for (let pass = 0; pass < 3; pass++)
@@ -1848,7 +2105,14 @@ function layoutAuthoredGrid(rawPanels, options, repeatFacet) {
1848
2105
  for (let child of children) child.geometry = child.relayout(child.margin);
1849
2106
  return wrap();
1850
2107
  });
1851
- let contentHeight = () => children.reduce((sum2, child) => sum2 + authoredOccupiedBounds(child.geometry).h, 0), available = area.h - rowGaps.reduce((sum2, gap) => sum2 + gap, 0), weight = naturalTierWeights.reduce((sum2, value) => sum2 + value, 0), packed = children.every((child) => !child.panel.align) && !options.anchors?.baselines;
2108
+ let contentHeight = () => children.reduce((sum2, child) => sum2 + occupiedBounds(child.geometry, measure).h, 0), available = area.h - rowGaps.reduce((sum2, gap) => sum2 + gap, 0), weight = naturalTierWeights.reduce((sum2, value) => sum2 + value, 0), packed = children.every((child) => !child.panel.align) && !options.anchors?.baselines, reportedRows, minimums = children.map((child) => child.geometry.sizing?.minHeight ?? 0);
2109
+ if (packed && !typeStepsFirst && children.some((child, index) => child.slot.h + 0.5 < minimums[index] && child.geometry.plot.h < (child.geometry.frame.plotMinHeight ?? 0)) && minimums.reduce((sum2, value) => sum2 + value, 0) <= available) {
2110
+ reportedRows = rowWeights.map((_, row) => tierSlots[provisional.findIndex((p) => p.row === row)].h);
2111
+ let heights = heightsHoldingMinimums(available, naturalTierWeights, minimums);
2112
+ children.forEach((child, index) => {
2113
+ child.slot.h = heights[index], child.geometry = child.relayout(child.margin);
2114
+ });
2115
+ }
1852
2116
  if (packed && children.every((child) => child.slot.h >= (child.geometry.sizing?.minHeight ?? 0)))
1853
2117
  for (let pass = 0; pass < 8; pass++) {
1854
2118
  let slack = available - contentHeight();
@@ -1871,17 +2135,22 @@ function layoutAuthoredGrid(rawPanels, options, repeatFacet) {
1871
2135
  break;
1872
2136
  }
1873
2137
  }
1874
- rowWeights = rowWeights.map((_, row) => tierSlots[provisional.findIndex((p) => p.row === row)].h), rowBands = trackBands(area.y, area.h, rowWeights, rowGaps, options.gutters?.rows !== void 0), tierSlots.forEach((slot, index) => {
2138
+ if (rowWeights = rowWeights.map((_, row) => tierSlots[provisional.findIndex((p) => p.row === row)].h), sizedRows = reportedRows ?? rowWeights, sizingRows = sizedRows, packed) {
2139
+ packedTiers = !0;
2140
+ let rowChild = (row) => children.find((child) => child.placement.row === row)?.geometry;
2141
+ sizingRows = sizedRows.map((weight2, row) => rowChild(row)?.sizing?.minHeight ?? weight2), children.some((child) => child.geometry.size.height + 1e-6 < (child.geometry.frame.plotMinHeight ?? 0)) && (askedRows = sizingRows.map((height, row) => Math.max(height, rowChild(row)?.frame.plotMinHeight ?? 0)));
2142
+ }
2143
+ rowBands = trackBands(area.y, area.h, rowWeights, rowGaps, options.gutters?.rows !== void 0), tierSlots.forEach((slot, index) => {
1875
2144
  slot.y = rowBands[provisional[index].row].start;
1876
2145
  });
1877
2146
  let bottom = area.y + area.h;
1878
- for (let index of packed ? bottomUpTierOrder(panels) : []) {
1879
- let child = children[index], bounds = authoredOccupiedBounds(child.geometry);
2147
+ for (let index of packed ? bottomUpTierOrder(panels, options.variancePosition) : []) {
2148
+ let child = children[index], bounds = occupiedBounds(child.geometry, measure);
1880
2149
  child.slot.y = bottom - bounds.y - bounds.h, rowBands[child.placement.row] = { start: bottom - bounds.h, size: bounds.h }, bottom -= bounds.h + (rowGaps[child.placement.row - 1] ?? 0);
1881
2150
  }
1882
2151
  }
1883
2152
  let rowRects = rowBands.map((band) => ({ x: area.x, y: band.start, w: area.w, h: band.size }));
1884
- (options.anchors?.categories === "column" || options.anchors?.categories === "all") && recordCategoryColumnAnchors(children, columnBands, sharedAnchors, warnings), options.anchors?.baselines && (children = alignBaselines(children, options.anchors.baselines, sharedAnchors));
2153
+ (options.anchors?.categories === "column" || options.anchors?.categories === "all") && recordCategoryColumnAnchors(children, columnBands, sharedAnchors, warnings), options.anchors?.baselines && (children = alignBaselines(children, options.anchors.baselines, sharedAnchors, warnings));
1885
2154
  let keepBaselines = options.anchors?.baselines ? {
1886
2155
  top: (child) => child.margin.top ?? numeric(isRecord(child.panel.options?.margin) ? child.panel.options.margin.top : void 0, 20),
1887
2156
  above: (child) => {
@@ -1959,12 +2228,13 @@ function layoutAuthoredGrid(rawPanels, options, repeatFacet) {
1959
2228
  }
1960
2229
  marks.alignmentRules.push({ id: rule.id, nodeId, orientation: rule.orientation });
1961
2230
  }
2231
+ packedTiers && slotDemandHeight.add(frameResult.frame);
1962
2232
  let compactNotes = children.flatMap((child) => child.geometry.a11y.compactNotes ?? []);
1963
2233
  return {
1964
2234
  type: "grid",
1965
2235
  size,
1966
2236
  sizing: withReadoutPlotHeight(
1967
- gridSizing(size, area, children.map((child) => ({ geometry: child.geometry, ...child.placement })), rowWeights, columnWeights, rowGaps, columnGaps, automaticRows),
2237
+ gridSizing(size, area, children.map((child) => ({ geometry: child.geometry, ...child.placement })), sizedRows, columnWeights, rowGaps, columnGaps, automaticRows, sizingRows, askedRows, typeStepsFirst),
1968
2238
  size,
1969
2239
  automaticRows ? children : []
1970
2240
  ),
@@ -2053,24 +2323,24 @@ function layoutAuthoredChild(panel, placement, slot, panels, parentOptions, allL
2053
2323
  ...hasKpiFigure(panel.type) && kpiValueSize !== void 0 ? { [KPI_VALUE_SIZE]: kpiValueSize } : {},
2054
2324
  ...panel.type === "kpi" ? { [KPI_HOST_TEXT]: stringsIn([panel.title, panel.caption, parentOptions.title, parentOptions.subtitle, parentOptions.footnotes, parentOptions.source]) } : {},
2055
2325
  ...panel.type === "variance" && isAuthoredVarianceStack(panels, parentOptions) ? { [VARIANCE_TIER]: panels.length } : {},
2056
- ...panel.annotations ? { annotations: panel.annotations } : {},
2326
+ ...panelAnnotations(panel),
2057
2327
  ...parentOptions.palette !== void 0 && panelOptions.palette === void 0 ? { palette: parentOptions.palette } : {},
2058
2328
  ...parentOptions.colorblindSafe !== void 0 && panelOptions.colorblindSafe === void 0 ? { colorblindSafe: parentOptions.colorblindSafe } : {},
2059
2329
  // A status panel resolves its hatch strength in its own layout.
2060
2330
  ...hatchStrengthFor(panelOptions, parentOptions),
2331
+ ...inheritedScaleUnit(panelOptions, panel.data, parentOptions.unit),
2061
2332
  theme: panelOptions.theme ?? parentOptions.theme,
2062
2333
  target: parentOptions.target,
2063
2334
  size: { width: slot.w, height: slot.h },
2064
2335
  margin: { ...authoredMargin, ...margin2, top: compactTiers ? Math.max(marginTop, captionHeight()) : marginTop + measureCaptionBand({ ...panel, options: { ...panelOptions, margin: { ...authoredMargin, ...margin2 } } }, theme, measure, slot.w) },
2065
2336
  measure,
2066
2337
  typeClass: gridTypeClass(parentOptions)
2067
- }, geometry = layoutChildChart(panel.data, resolvedOptions, definition.layout);
2338
+ }, geometry = layoutChildChart(panel.data, resolvedOptions, definition.layout, panel.id);
2068
2339
  if (geometry.refused) throw new GridChildRefusal(panel.id, geometry);
2069
2340
  let tierName = geometry.derived.tierName;
2070
- if (compactTiers && panelOptions.title !== !1 && !captionPanel.title && tierName && (captionPanel.title = tierName, captionHeight() > resolvedOptions.margin.top && (resolvedOptions.margin.top = captionHeight(), geometry = layoutChildChart(panel.data, resolvedOptions, definition.layout), geometry.refused)))
2341
+ if (compactTiers && panelOptions.title !== !1 && !captionPanel.title && tierName && (captionPanel.title = tierName, captionHeight() > resolvedOptions.margin.top && (resolvedOptions.margin.top = captionHeight(), geometry = layoutChildChart(panel.data, resolvedOptions, definition.layout, panel.id), geometry.refused)))
2071
2342
  throw new GridChildRefusal(panel.id, geometry);
2072
- let { measure: _measure, ...serializable } = resolvedOptions;
2073
- recordOptions = serializable;
2343
+ recordOptions = recordedPanelOptions(resolvedOptions);
2074
2344
  let captionY = compactTiers && isAuthoredVarianceStack(panels, parentOptions) ? authoredOccupiedBounds(geometry).y - resolvedOptions.margin.top - theme.space.labelPad : 0, band = panelCaptionBand({ ...captionPanel, options: resolvedOptions }, theme, measure, { x: 0, y: captionY, w: slot.w, h: slot.h }, new Set(resolveHighlight(parentOptions.highlight)), compactTiers);
2075
2345
  return pushAll(geometry.scene, band.nodes), pushAll(geometry.debug.occupied, band.claims), geometry;
2076
2346
  }, margin = { ...authoredMargin };
@@ -2090,7 +2360,7 @@ function readoutIndents(children, columns) {
2090
2360
  }
2091
2361
  function stackNarrowReadouts(panels, options, theme, measure, width) {
2092
2362
  let anchored = options.anchors?.categories === "column" || options.anchors?.categories === "all", columns = Array.isArray(options.columns) ? options.columns.length : typeof options.columns == "number" ? options.columns : void 0;
2093
- if (!anchored || columns === void 0 || columns < 2 || width >= CARD_CLASS_WIDTH) return { panels, options };
2363
+ if (!anchored || columns === void 0 || columns < 2 || !cardForm(width, options)) return { panels, options };
2094
2364
  let chart = panels.find((panel) => panel.type !== "text" && panel.type !== "legend" && (panel.column ?? 0) === 0 && panel.span?.columns === columns && (panel.span?.rows ?? 1) === 1), categories = chart && isRecord(chart.data) && Array.isArray(chart.data.categories) ? chart.data.categories : [];
2095
2365
  if (!chart || categories.length !== columns) return { panels, options };
2096
2366
  let readouts = panels.filter((panel) => panel.type === "text" && panel.row !== void 0 && panel.row > (chart.row ?? 0) && panel.column !== void 0 && (panel.span?.columns ?? 1) === 1 && (panel.span?.rows ?? 1) === 1), row = readouts[0]?.row, inRow = readouts.filter((panel) => panel.row === row);
@@ -2115,7 +2385,7 @@ function stackNarrowReadouts(panels, options, theme, measure, width) {
2115
2385
  }
2116
2386
  function stackCompactPanels(panels, options, width) {
2117
2387
  let authored = Array.isArray(options.columns) ? options.columns.length : options.columns ?? (options.rows ? Math.ceil(panels.length / options.rows.length) : Math.ceil(Math.sqrt(panels.length))), columns = Math.max(authored, ...panels.map((panel) => (panel.column ?? 0) + (panel.span?.columns ?? 1)));
2118
- if (options.mode !== "compact" || panelTypeClass(options) !== void 0 || width >= CARD_CLASS_WIDTH || columns < 2 || options.anchors !== void 0 || options.alignmentRules !== void 0) return { panels, options };
2388
+ if (options.mode !== "compact" || panelTypeClass(options) !== void 0 || !cardForm(width, options) || columns < 2 || options.anchors !== void 0 || options.alignmentRules !== void 0) return { panels, options };
2119
2389
  let { rows: _rows, columns: _gutterColumns, ...gutters } = options.gutters ?? {};
2120
2390
  return {
2121
2391
  options: { ...options, columns: 1, rows: void 0, gutters },
@@ -2296,13 +2566,30 @@ function alignInside(raw, align) {
2296
2566
  let horizontal = align.horizontal ?? "stretch", vertical = align.vertical ?? "stretch", w = horizontal === "stretch" ? raw.w : Math.min(raw.w, align.width ?? raw.w), h = vertical === "stretch" ? raw.h : Math.min(raw.h, align.height ?? raw.h), x = horizontal === "end" ? raw.x + raw.w - w : horizontal === "center" ? raw.x + (raw.w - w) / 2 : raw.x, y = vertical === "end" ? raw.y + raw.h - h : vertical === "center" ? raw.y + (raw.h - h) / 2 : raw.y;
2297
2567
  return { x, y, w, h };
2298
2568
  }
2299
- function scopeGroups(children, scope) {
2569
+ function scopeGroups(children, scope, skipped) {
2300
2570
  if (scope === "all") return [children];
2301
- let groups = /* @__PURE__ */ new Map();
2571
+ let startOf = (child) => scope === "row" ? child.placement.row : child.placement.column, spanOf = (child) => scope === "row" ? child.placement.rowSpan : child.placement.columnSpan, groups = /* @__PURE__ */ new Map();
2302
2572
  for (let child of children) {
2303
- let key = scope === "row" ? child.placement.row : child.placement.column, members = groups.get(key) ?? [];
2573
+ let key = `${startOf(child)}:${spanOf(child)}`, members = groups.get(key) ?? [];
2304
2574
  members.push(child), groups.set(key, members);
2305
2575
  }
2576
+ if (skipped) {
2577
+ let tracks = (child) => spanOf(child) === 1 ? `${scope} ${startOf(child) + 1}` : `${scope}s ${startOf(child) + 1}\u2013${startOf(child) + spanOf(child)}`, first = /* @__PURE__ */ new Map();
2578
+ for (let group of groups.values()) {
2579
+ let lead = group.find(skipped.eligible);
2580
+ if (!lead) continue;
2581
+ let other = first.get(startOf(lead));
2582
+ if (!other) {
2583
+ first.set(startOf(lead), lead);
2584
+ continue;
2585
+ }
2586
+ skipped.warnings.push({
2587
+ code: "grid-anchor-incompatible",
2588
+ severity: "warn",
2589
+ message: `${scope} ${skipped.anchor} alignment leaves panel '${lead.panel.id}' (${tracks(lead)}) out of the group of panel '${other.panel.id}' (${tracks(other)}) \u2014 only panels that cover the same ${scope}s are aligned`
2590
+ });
2591
+ }
2592
+ }
2306
2593
  return [...groups.values()];
2307
2594
  }
2308
2595
  function categoryColumnBands(children, columnBands, columnGaps, warnings) {
@@ -2368,9 +2655,9 @@ function recordCategoryColumnAnchors(children, columnBands, derived, warnings) {
2368
2655
  }
2369
2656
  }
2370
2657
  function alignPlotEdges(input, scope, derived, warnings, theme) {
2371
- let children = [...input];
2372
- for (let [groupIndex, group] of scopeGroups(children, scope).entries()) {
2373
- let candidates = group.filter((child) => child.relayout !== void 0);
2658
+ let children = [...input], eligible = (child) => child.relayout !== void 0;
2659
+ for (let [groupIndex, group] of scopeGroups(children, scope, { anchor: "plot-edge", warnings, eligible }).entries()) {
2660
+ let candidates = group.filter(eligible);
2374
2661
  if (candidates.length < 2) continue;
2375
2662
  let left = maxOf(candidates.map((child) => child.slot.x + child.geometry.plot.x)), right = minOf(candidates.map((child) => child.slot.x + child.geometry.plot.x + child.geometry.plot.w));
2376
2663
  if (!(right > left)) {
@@ -2389,9 +2676,9 @@ function alignPlotEdges(input, scope, derived, warnings, theme) {
2389
2676
  }
2390
2677
  return children;
2391
2678
  }
2392
- function alignBaselines(input, scope, derived) {
2393
- let children = [...input];
2394
- for (let [groupIndex, group] of scopeGroups(children, scope).entries()) {
2679
+ function alignBaselines(input, scope, derived, warnings) {
2680
+ let children = [...input], eligible = (child) => child.relayout !== void 0 && baselineY(child.geometry) !== null;
2681
+ for (let [groupIndex, group] of scopeGroups(children, scope, { anchor: "baseline", warnings, eligible }).entries()) {
2395
2682
  let candidates = group.flatMap((child) => {
2396
2683
  let baseline = baselineY(child.geometry);
2397
2684
  return baseline === null || !child.relayout ? [] : [{ child, baseline: child.slot.y + baseline }];
@@ -2488,9 +2775,10 @@ function appendAuthoredChild(child, scene, labels, axes, annotations, occupied,
2488
2775
  let warningOffset = warnings.length;
2489
2776
  pushAll(
2490
2777
  warnings,
2491
- child.geometry.warnings.map(({ field: _field, fix: _fix, ...warning }) => ({
2778
+ child.geometry.warnings.map((warning) => ({
2492
2779
  ...warning,
2493
2780
  message: `[${child.panel.id}] ${warning.message}`,
2781
+ detail: { ...warning.detail, panelId: child.panel.id },
2494
2782
  owner: warning.owner ? prefixPanelOwner(warning.owner, prefix) : void 0
2495
2783
  }))
2496
2784
  );
@@ -2518,7 +2806,7 @@ function translatePlacedLabel(label, prefix, dx, dy) {
2518
2806
  return {
2519
2807
  ...label,
2520
2808
  id: prefix + label.id,
2521
- ...label.claimId ? { claimId: prefix + label.claimId } : {},
2809
+ ...label.claimIds ? { claimIds: label.claimIds.map((id) => prefix + id) } : {},
2522
2810
  nodeId: label.nodeId ? prefix + label.nodeId : void 0,
2523
2811
  owner: prefixPanelOwner(label.owner, prefix),
2524
2812
  rect: translateRect(label.rect, dx, dy),
@@ -2599,13 +2887,33 @@ function probePanelGeometry(panel, options, valueAxis) {
2599
2887
  return layoutChildChart(panel.data, {
2600
2888
  ...definition.defaults,
2601
2889
  ...panelOptions,
2602
- ...panel.annotations ? { annotations: panel.annotations } : {},
2890
+ ...panelAnnotations(panel),
2603
2891
  theme: panelOptions.theme ?? options.theme,
2604
2892
  size: { width: 720, height: 405 },
2605
2893
  valueAxis,
2606
2894
  measure: options.measure,
2607
2895
  typeClass: gridTypeClass(options)
2608
- }, definition.layout);
2896
+ }, definition.layout, panel.id);
2897
+ }
2898
+ function probedPanelDomain(panel, options, valueAxis) {
2899
+ let key = optionKey({
2900
+ type: panel.type,
2901
+ data: panel.data,
2902
+ options: panel.options,
2903
+ annotations: panel.annotations,
2904
+ theme: options.theme,
2905
+ measure: options.measure,
2906
+ typeClass: gridTypeClass(options),
2907
+ valueAxis
2908
+ });
2909
+ return requestMemo(probedPanelDomain, key, () => {
2910
+ let probe = probePanelGeometry(panel, options, valueAxis);
2911
+ return probe && !probe.refused ? inferLinearYDomain(probe, panelValueAxis(panel)) : null;
2912
+ });
2913
+ }
2914
+ function panelValueAxis(panel) {
2915
+ let type = getChart(panel.type)?.type, variant = panel.options?.variant;
2916
+ return type === "dot" || type === "bar" && variant !== "tornado" && variant !== "football-field" ? "x" : "y";
2609
2917
  }
2610
2918
  function panelValueAxisBreak(panel) {
2611
2919
  let valueAxis = isRecord(panel.options?.valueAxis) ? panel.options.valueAxis : void 0, raw = valueAxis && isRecord(valueAxis.break) ? valueAxis.break : null;
@@ -2635,7 +2943,7 @@ function groupHonorsSharedBreak(panels, indexes, domain, axisBreak, options) {
2635
2943
  } catch {
2636
2944
  return !1;
2637
2945
  }
2638
- if (!geometry || geometry.refused || !geometry.axes.some((axis) => axis.axis === "y" && axis.break !== void 0)) return !1;
2946
+ if (!geometry || geometry.refused || !geometry.axes.some((axis) => axis.axis === panelValueAxis(panel) && axis.break !== void 0)) return !1;
2639
2947
  }
2640
2948
  return !0;
2641
2949
  }
@@ -2648,8 +2956,8 @@ function resolveSharedYDomains(panels, options, repeatFacet) {
2648
2956
  members.push(index), groups.set(scaleGroup.y, members);
2649
2957
  });
2650
2958
  let panelDomains = panels.map((panel) => {
2651
- let panelOptions = panel.options ?? {}, valueAxis = isRecord(panelOptions.valueAxis) ? panelOptions.valueAxis : {}, { break: _ignoredBreak, ...axisWithoutBreak } = valueAxis, probe = probePanelGeometry(panel, options, { ...axisWithoutBreak, show: !0 });
2652
- return probe && !probe.refused ? inferLinearYDomain(probe) : null;
2959
+ let panelOptions = panel.options ?? {}, valueAxis = isRecord(panelOptions.valueAxis) ? panelOptions.valueAxis : {}, { break: _ignoredBreak, ...axisWithoutBreak } = valueAxis, domain = probedPanelDomain(panel, options, { ...axisWithoutBreak, show: !0 });
2960
+ return domain && [domain[0], domain[1]];
2653
2961
  }), authoredGroups = groups.size > 0, semantics = panels.map(panelScaleSemantics), firstSemantics = semantics[0], matchingSemantics = firstSemantics != null && semantics.every(
2654
2962
  (candidate) => candidate !== null && candidate.unit === firstSemantics.unit && candidate.format === firstSemantics.format
2655
2963
  ), sameMeasure = options.sharedScale === !0 || repeatFacet || firstSemantics?.unit != null || !!options.unit?.trim(), defaultShareEligible = panels.length > 1 && panelDomains.every((domain) => domain !== null) && matchingSemantics && sameMeasure;
@@ -2705,7 +3013,7 @@ function unionSharedYGroups(groups, panels, panelDomains, options) {
2705
3013
  }
2706
3014
  if (memberDomains.length !== indexes.length) {
2707
3015
  group !== DEFAULT_Y_GROUP && warnings.push({
2708
- code: "scale-mix",
3016
+ code: "scale-group-not-numeric",
2709
3017
  severity: "warn",
2710
3018
  message: `y scale group '${group}' contains a panel without a numeric linear y scale`
2711
3019
  });