boardplot 0.52.5 → 0.54.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 (388) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +13 -12
  3. package/dist/{ReaderBox-VUNSFKZY.js → ReaderBox-YXC5XK7D.js} +6 -5
  4. package/dist/{annotateEngine-H7OW4H3W.js → annotateEngine-5O3IRSQL.js} +3 -1
  5. package/dist/build-identity.json +3 -3
  6. package/dist/{chunk-ZSLGN6CO.js → chunk-23RWLBZF.js} +1 -1
  7. package/dist/{chunk-HAAUJDGB.js → chunk-24BHMKDD.js} +2 -2
  8. package/dist/{chunk-MDYLOIS2.js → chunk-26P4WRQC.js} +1 -1
  9. package/dist/{chunk-EWVKBRLV.js → chunk-2DR5MMDY.js} +2 -2
  10. package/dist/{chunk-3ZCKEANJ.js → chunk-2HXKW6U6.js} +3 -3
  11. package/dist/{chunk-GWQIXU37.js → chunk-2IXDYW6O.js} +30 -28
  12. package/dist/{chunk-OLNORNCT.js → chunk-2THWIKRB.js} +4 -4
  13. package/dist/{chunk-JRPI64AQ.js → chunk-32X7JGH3.js} +18 -15
  14. package/dist/{chunk-PUVGWJQ5.js → chunk-35ZTANEK.js} +4 -4
  15. package/dist/{chunk-FOKEGVPB.js → chunk-3CLLHMFF.js} +3 -3
  16. package/dist/{chunk-XYONCO5Q.js → chunk-3FNY7ZCG.js} +19 -16
  17. package/dist/{chunk-X7TXGKRX.js → chunk-3P4PJJND.js} +6 -6
  18. package/dist/{chunk-4DNOEV3Q.js → chunk-3RMTPAEJ.js} +79 -2
  19. package/dist/{chunk-NYEY6W5R.js → chunk-3UBTO342.js} +8 -8
  20. package/dist/{chunk-MCOIEWW6.js → chunk-3V7AA3IZ.js} +1 -1
  21. package/dist/{chunk-RJQ5YS3Q.js → chunk-43OQ26TL.js} +10 -6
  22. package/dist/{chunk-V422EKLW.js → chunk-46ZPFJAM.js} +3 -3
  23. package/dist/{chunk-W7UZXD5D.js → chunk-47BO6MYI.js} +18 -15
  24. package/dist/{chunk-5T5YW52S.js → chunk-4FFCIQDG.js} +1 -1
  25. package/dist/{chunk-KU4YS6HN.js → chunk-4MREJWRM.js} +1 -1
  26. package/dist/{chunk-IDTLHPTK.js → chunk-4TPHMIE5.js} +2 -2
  27. package/dist/{chunk-2MTWKMEG.js → chunk-4WK3CNW5.js} +13 -6
  28. package/dist/{chunk-ORUJI3VB.js → chunk-4WQ2MBE7.js} +1 -1
  29. package/dist/chunk-4ZGN4ZUN.js +164 -0
  30. package/dist/{chunk-YQ2B3YVF.js → chunk-53OYF4ZT.js} +1 -1
  31. package/dist/{chunk-JL5BRMDT.js → chunk-57ZGVAU3.js} +1 -1
  32. package/dist/{chunk-VYMGZ27S.js → chunk-5A6MO4AR.js} +3 -2
  33. package/dist/{chunk-WHSTEAVP.js → chunk-5PCCSSII.js} +1 -1
  34. package/dist/{chunk-Z256ACGC.js → chunk-5SJQOPL7.js} +2 -2
  35. package/dist/{chunk-RNOD2UWF.js → chunk-6BJQULXR.js} +12 -12
  36. package/dist/{chunk-2DHJJ2EN.js → chunk-6BWSF5PS.js} +3 -3
  37. package/dist/{chunk-CAE2HK2G.js → chunk-6I7YZTY7.js} +3 -11
  38. package/dist/{chunk-XW5J5JAX.js → chunk-6K2TMVPF.js} +2 -2
  39. package/dist/{chunk-IZ35GMGB.js → chunk-6NLH6TEP.js} +13 -10
  40. package/dist/{chunk-TTR7EWNH.js → chunk-6TJDWMZV.js} +4 -4
  41. package/dist/{chunk-KSYVTEKR.js → chunk-6ZXMA4TY.js} +3 -3
  42. package/dist/{chunk-OH7FA4TF.js → chunk-7EOLHBI6.js} +1 -1
  43. package/dist/{chunk-3W23F7EY.js → chunk-7EVIIADO.js} +1 -1
  44. package/dist/{chunk-EC2NAYPQ.js → chunk-7HFUG25L.js} +3 -3
  45. package/dist/{chunk-DLC23CKC.js → chunk-7JQAUJOL.js} +1 -1
  46. package/dist/{chunk-3I6RANBJ.js → chunk-7NWFKHSG.js} +36 -32
  47. package/dist/{chunk-RNXITK5M.js → chunk-7R5EV5MS.js} +3 -3
  48. package/dist/{chunk-ELYU6TRQ.js → chunk-7X3UZM7F.js} +1 -1
  49. package/dist/{chunk-UZF3G2FN.js → chunk-A5TY7H5T.js} +5 -5
  50. package/dist/{chunk-XEGRWWNO.js → chunk-AA4U62G6.js} +2 -2
  51. package/dist/{chunk-TXINIAFL.js → chunk-AG2CJ4JY.js} +10 -5
  52. package/dist/{chunk-R5SWC3EW.js → chunk-AHQ4L3BE.js} +1 -1
  53. package/dist/{chunk-35DZP2R2.js → chunk-AJHYXD5U.js} +2 -2
  54. package/dist/{chunk-TPYV2FTV.js → chunk-ATUZTGZI.js} +3 -3
  55. package/dist/{chunk-S53OGZL6.js → chunk-AVMKRVNP.js} +1 -1
  56. package/dist/{chunk-R3WI7ZLE.js → chunk-AZIRTSVP.js} +14 -11
  57. package/dist/{chunk-II7652VA.js → chunk-B3F4TS3V.js} +47 -20
  58. package/dist/{chunk-DCCJRLAJ.js → chunk-B6LHZLLK.js} +5 -0
  59. package/dist/{chunk-M6KTNAND.js → chunk-BRPOSOK5.js} +17 -11
  60. package/dist/{chunk-EQT3EPTB.js → chunk-BWTX7LUG.js} +1 -1
  61. package/dist/{chunk-BVWU6GOB.js → chunk-BXEM2CVW.js} +2 -2
  62. package/dist/{chunk-A7A4PDG5.js → chunk-BYD7VLAI.js} +3 -3
  63. package/dist/{chunk-JFG4DHKQ.js → chunk-C3O45JWU.js} +1 -1
  64. package/dist/{chunk-BKYMLFUG.js → chunk-C54QLNE4.js} +1 -1
  65. package/dist/{chunk-7JVAQX6C.js → chunk-CEY646NZ.js} +4 -4
  66. package/dist/{chunk-GZ4RHGIW.js → chunk-CICWSCLC.js} +19 -19
  67. package/dist/{chunk-QHFQHQDC.js → chunk-CPKHL7FK.js} +2 -2
  68. package/dist/{chunk-NXNQQ3DS.js → chunk-D3D7XHBI.js} +7 -14
  69. package/dist/{chunk-RSWVH7DB.js → chunk-D7GZPMHW.js} +3 -3
  70. package/dist/chunk-DAVHGK27.js +657 -0
  71. package/dist/{chunk-7VXZDB45.js → chunk-DDI2W4TR.js} +1 -1
  72. package/dist/{chunk-JLCAWQ3H.js → chunk-DHWCFQNO.js} +3 -3
  73. package/dist/{chunk-GQS46LC3.js → chunk-DSZUV3TM.js} +11 -3
  74. package/dist/{chunk-H57TJD3B.js → chunk-E42JZ2DA.js} +1 -1
  75. package/dist/{chunk-YTSSXSZR.js → chunk-E64MTTBC.js} +3 -3
  76. package/dist/{chunk-NT3HAZYT.js → chunk-EHDWWFNV.js} +1 -1
  77. package/dist/{chunk-FT3F72C3.js → chunk-EHVESNLV.js} +1 -1
  78. package/dist/{chunk-W2RGSGRR.js → chunk-ELPQZIGR.js} +13 -10
  79. package/dist/{chunk-7IFLQMJL.js → chunk-ENOCOA3F.js} +5 -4
  80. package/dist/{chunk-KPMGGE4W.js → chunk-EP54VZI5.js} +1 -1
  81. package/dist/{chunk-QG6MOQLI.js → chunk-EYLWVI26.js} +17 -14
  82. package/dist/{chunk-NEVSQGOI.js → chunk-EYZ6SLF3.js} +2 -2
  83. package/dist/{chunk-HFG76JTS.js → chunk-F35DA442.js} +3 -3
  84. package/dist/{chunk-A372DLQX.js → chunk-F7X53SZM.js} +3 -3
  85. package/dist/{chunk-PTVOXB5T.js → chunk-FHA3KMFC.js} +6 -2
  86. package/dist/{chunk-S4F27M7N.js → chunk-FILDYFT4.js} +2 -2
  87. package/dist/{chunk-WMJPFLF3.js → chunk-FMFCGYCE.js} +29 -25
  88. package/dist/{chunk-TPZB2YWR.js → chunk-FPPN5NAR.js} +2 -2
  89. package/dist/{chunk-5DJXJXDE.js → chunk-FV32N6AF.js} +1 -1
  90. package/dist/{chunk-MJMJEURO.js → chunk-G57ZO7DB.js} +10 -10
  91. package/dist/{chunk-WDUNR2VI.js → chunk-G63ROSY5.js} +22 -19
  92. package/dist/{chunk-V4VC25UL.js → chunk-G6XCUX3I.js} +4 -4
  93. package/dist/{chunk-JLZM7XMZ.js → chunk-GEBGBJBD.js} +14 -11
  94. package/dist/{chunk-FT47HQ5U.js → chunk-GGO43PHB.js} +4 -4
  95. package/dist/{chunk-XDLQRSSH.js → chunk-GSMWHKOW.js} +2 -2
  96. package/dist/{chunk-2JAWQ7VV.js → chunk-GVKFFJ23.js} +11 -10
  97. package/dist/{chunk-Q6XJOJTY.js → chunk-GYNZ72GO.js} +2 -2
  98. package/dist/{chunk-WRHFBCVY.js → chunk-H4SYN3QA.js} +3 -3
  99. package/dist/{chunk-MEISCROL.js → chunk-HC4NDND6.js} +3 -3
  100. package/dist/{chunk-I322G5UG.js → chunk-HDZGZJKR.js} +17 -14
  101. package/dist/{chunk-3GZECHOK.js → chunk-HGGLJYPZ.js} +12 -12
  102. package/dist/{chunk-B67K5X4M.js → chunk-HHS6333D.js} +1 -1
  103. package/dist/{chunk-6UBEGKIQ.js → chunk-HNVW3YDS.js} +3 -3
  104. package/dist/{chunk-GZ2VNM4L.js → chunk-HW7BPJNQ.js} +3 -3
  105. package/dist/{chunk-NG5IGZXC.js → chunk-HZG5NB7Q.js} +23 -20
  106. package/dist/{chunk-S7VDRUED.js → chunk-HZZH3MQI.js} +1 -1
  107. package/dist/{chunk-CS4DHFNG.js → chunk-I2E3YDNZ.js} +3 -3
  108. package/dist/{chunk-YAYRRKC7.js → chunk-I5L3QTKQ.js} +3 -3
  109. package/dist/{chunk-KYELSLDJ.js → chunk-IDT7DJ7F.js} +1 -1
  110. package/dist/{chunk-JETXFF3M.js → chunk-IK4BHOPZ.js} +1 -1
  111. package/dist/{chunk-GDQ3NGDZ.js → chunk-IM4WUIR7.js} +2 -2
  112. package/dist/chunk-IMJXJHFW.js +88 -0
  113. package/dist/{chunk-5C7TWNYZ.js → chunk-ISWU5YB3.js} +1 -1
  114. package/dist/{chunk-5KWXRYAT.js → chunk-J2ROMB7J.js} +17 -11
  115. package/dist/{chunk-WJMUMN3I.js → chunk-J33RA3YO.js} +2 -2
  116. package/dist/{chunk-627P6T25.js → chunk-JAKRPSWP.js} +21 -18
  117. package/dist/{chunk-PEN2DK7T.js → chunk-JB4YPOMT.js} +2 -2
  118. package/dist/{chunk-YP3I6W7T.js → chunk-JDEVGTSX.js} +3 -3
  119. package/dist/{chunk-JSX3C6LL.js → chunk-JEL6665C.js} +5 -5
  120. package/dist/{chunk-DFKTS6XJ.js → chunk-JEYJRJ7M.js} +1 -1
  121. package/dist/{chunk-JA755JHN.js → chunk-JJJ2KAHR.js} +10 -7
  122. package/dist/{chunk-SGSPYHFE.js → chunk-JTJNQKPM.js} +8 -5
  123. package/dist/{chunk-DGDOGOTQ.js → chunk-K2KU4HHT.js} +3 -3
  124. package/dist/{chunk-CRZKGHZ6.js → chunk-K4K6KGEF.js} +17 -19
  125. package/dist/{chunk-QVABTUDS.js → chunk-K4RCWNLC.js} +7 -7
  126. package/dist/{chunk-GULJ6KVT.js → chunk-KAQH75T6.js} +14 -14
  127. package/dist/{chunk-2UVTHU7A.js → chunk-KBFPMESI.js} +37 -27
  128. package/dist/{chunk-S5ADHIZK.js → chunk-KFWEO4UA.js} +28 -25
  129. package/dist/{chunk-MIXKQJ64.js → chunk-KJEZFOO6.js} +18 -18
  130. package/dist/{chunk-NLOMCLKI.js → chunk-KL2XJQAA.js} +8 -8
  131. package/dist/{chunk-2AKWCMS4.js → chunk-KNZD53L4.js} +3 -3
  132. package/dist/{chunk-DVKBU23L.js → chunk-KORHKDJW.js} +1 -1
  133. package/dist/{chunk-NMCOUVN5.js → chunk-KSQEG6DX.js} +3 -3
  134. package/dist/{chunk-TVHLKVUO.js → chunk-KVSJ2O4Q.js} +3 -3
  135. package/dist/{chunk-XTNV2YMB.js → chunk-L3JWM7FR.js} +1 -1
  136. package/dist/{chunk-IZCOG3FS.js → chunk-L7FSCT4M.js} +4 -4
  137. package/dist/{chunk-Z5VSLLNY.js → chunk-L7RHB734.js} +1 -1
  138. package/dist/{chunk-B2EBEXIS.js → chunk-LFX7W4B7.js} +1 -1
  139. package/dist/chunk-LINZPU5D.js +8 -0
  140. package/dist/{chunk-COKHNEJP.js → chunk-LMPZKCDM.js} +3 -3
  141. package/dist/{chunk-ZVTFZF4V.js → chunk-LTMF75MR.js} +8 -8
  142. package/dist/{chunk-A6XCAQ52.js → chunk-LVXOY5WL.js} +7 -6
  143. package/dist/{chunk-3HHNQPAH.js → chunk-LYVOL4TQ.js} +1 -1
  144. package/dist/{chunk-HJXXFPOL.js → chunk-MBVXROCI.js} +2 -2
  145. package/dist/{chunk-76ANFJOI.js → chunk-MCYM3RNF.js} +1 -1
  146. package/dist/{chunk-F77BNDAT.js → chunk-MEG4NMSI.js} +2 -2
  147. package/dist/{chunk-C64FBRJO.js → chunk-MKVV7GVJ.js} +5 -5
  148. package/dist/{chunk-XPWRD424.js → chunk-MONVTUHR.js} +3 -3
  149. package/dist/{chunk-YI2ZVTCB.js → chunk-MT4MP3UZ.js} +1 -1
  150. package/dist/{chunk-V4DYVLOO.js → chunk-MYCLO35J.js} +5 -5
  151. package/dist/{chunk-4SM2ONUC.js → chunk-MZJBPDIL.js} +1 -1
  152. package/dist/{chunk-CYDZP5W6.js → chunk-NGRIT3CY.js} +26 -23
  153. package/dist/{chunk-2SGIHKKU.js → chunk-NQSDIDRO.js} +1 -1
  154. package/dist/{chunk-WVSNSWBJ.js → chunk-NRF223FR.js} +1 -1
  155. package/dist/{chunk-QXILAMAU.js → chunk-NRHTC2SQ.js} +1 -1
  156. package/dist/{chunk-H7UZZ7KP.js → chunk-NWQTSZYC.js} +3 -3
  157. package/dist/{chunk-OAPCJO6W.js → chunk-O3VN6BTL.js} +1 -0
  158. package/dist/{chunk-LO2DANS6.js → chunk-OD3IH6FG.js} +5 -5
  159. package/dist/{chunk-S62M63LU.js → chunk-OM67S6S4.js} +3 -3
  160. package/dist/{chunk-UEU46Q3D.js → chunk-OMNQXHFF.js} +7 -7
  161. package/dist/{chunk-HZQEQ34U.js → chunk-OMVYFSOM.js} +3 -3
  162. package/dist/{chunk-COYPDRJK.js → chunk-OTW5SEFS.js} +2 -2
  163. package/dist/{chunk-GH3ZMBFX.js → chunk-OU5K2JPF.js} +11 -11
  164. package/dist/{chunk-AZOUSKZD.js → chunk-OURX73UJ.js} +1 -1
  165. package/dist/{chunk-27QQEWNV.js → chunk-OZUTYDV4.js} +2 -2
  166. package/dist/{chunk-TSR5YDPS.js → chunk-P52JHUUM.js} +23 -20
  167. package/dist/{chunk-YFG4E3N2.js → chunk-PBYUJSEY.js} +14 -14
  168. package/dist/{chunk-A3ULWR5N.js → chunk-PDG4IM3L.js} +1 -1
  169. package/dist/{chunk-AFK47A6O.js → chunk-PGV25HTX.js} +3 -3
  170. package/dist/{chunk-A5JWFZVU.js → chunk-PJWLKCFX.js} +80 -81
  171. package/dist/{chunk-MNJ2DHU6.js → chunk-QJ4WGAC6.js} +8 -8
  172. package/dist/{chunk-VB2MJLET.js → chunk-QQNPU27R.js} +1 -1
  173. package/dist/{chunk-6JUJ2DU3.js → chunk-QR35TD2B.js} +37 -37
  174. package/dist/{chunk-LC3PSQJJ.js → chunk-QY5ZKUWY.js} +1 -1
  175. package/dist/{chunk-ASAON7G4.js → chunk-RGZGLKFB.js} +4 -4
  176. package/dist/{chunk-S4ONWRJE.js → chunk-RK4S3VPS.js} +2 -2
  177. package/dist/{chunk-TXZBBZOG.js → chunk-RKITD2UJ.js} +2 -2
  178. package/dist/{chunk-ETHWK2RZ.js → chunk-RNOJSEES.js} +1 -1
  179. package/dist/{chunk-PGIQMQRU.js → chunk-RZB4RPPD.js} +228 -95
  180. package/dist/{chunk-XO5ONLVM.js → chunk-S32YYDIB.js} +1 -1
  181. package/dist/{chunk-QN6JHMGU.js → chunk-S4QSJAGY.js} +1 -1
  182. package/dist/{chunk-IXSZ7OKR.js → chunk-S6CRZKPO.js} +1 -1
  183. package/dist/{chunk-YHTO46W2.js → chunk-SFQ5ADIG.js} +35 -31
  184. package/dist/{chunk-Y4PXIJMD.js → chunk-SHH2AHIU.js} +14 -14
  185. package/dist/{chunk-HUF6TQ2J.js → chunk-SZCPKGYG.js} +3 -3
  186. package/dist/{chunk-K2HNV4LE.js → chunk-T3PNYRDM.js} +12 -12
  187. package/dist/{chunk-QNHZXFRA.js → chunk-T7ZCYYQZ.js} +3 -3
  188. package/dist/{chunk-JY4R3GML.js → chunk-TKQKXBGC.js} +1 -1
  189. package/dist/{chunk-XDS4UZGR.js → chunk-TNHD4UTC.js} +3 -3
  190. package/dist/{chunk-FGAGGPFF.js → chunk-TNNK4IIY.js} +8 -8
  191. package/dist/{chunk-LC6DYCTG.js → chunk-TSPWXAAI.js} +1 -1
  192. package/dist/{chunk-HX3MQ3H4.js → chunk-U2ES66IN.js} +3 -3
  193. package/dist/{chunk-MFLH5ZDQ.js → chunk-U2HQELXL.js} +2 -2
  194. package/dist/{chunk-SXGTRZFN.js → chunk-U4P6TQRW.js} +3 -2
  195. package/dist/{chunk-KFFNCDX6.js → chunk-U6CJPTOB.js} +3 -3
  196. package/dist/{chunk-GQPESFAF.js → chunk-U7LLQ7XM.js} +11 -11
  197. package/dist/{chunk-IN4QT33I.js → chunk-ULTSSIOU.js} +1 -1
  198. package/dist/{chunk-HUFCSX2Y.js → chunk-UTQGZF37.js} +17 -6
  199. package/dist/{chunk-CCQNL33L.js → chunk-UYNAL3Y3.js} +9 -9
  200. package/dist/{chunk-7QDAHY5M.js → chunk-V7RAPZHX.js} +2 -2
  201. package/dist/{chunk-6XE3GVGU.js → chunk-VAEC53B3.js} +3 -2
  202. package/dist/{chunk-YKO3VCTF.js → chunk-VDVXGAIP.js} +3 -3
  203. package/dist/{chunk-WYJMV62X.js → chunk-VGWWUCAB.js} +3 -3
  204. package/dist/{chunk-5ENRZX6I.js → chunk-VNLSTZES.js} +19 -16
  205. package/dist/{chunk-D4BIV6WG.js → chunk-VWYUUBBP.js} +19 -16
  206. package/dist/{chunk-JMH5MD5A.js → chunk-WDONXBQE.js} +1 -1
  207. package/dist/{chunk-62FR4FYJ.js → chunk-WEPAE4KG.js} +2 -2
  208. package/dist/{chunk-A5LZUYK4.js → chunk-WGIO6AHP.js} +3 -2
  209. package/dist/{chunk-UQSVWO7Z.js → chunk-WJKVNRCR.js} +8 -7
  210. package/dist/{chunk-24WB3HMB.js → chunk-WKWMOZNE.js} +22 -7
  211. package/dist/{chunk-V667FCIJ.js → chunk-WMZCOGD6.js} +1 -1
  212. package/dist/{chunk-33CBPK5Q.js → chunk-WQ55QPEB.js} +51 -45
  213. package/dist/{chunk-SLTMRTXV.js → chunk-WUKSZNHL.js} +15 -12
  214. package/dist/{chunk-QETGGFH2.js → chunk-WZBMTZBM.js} +3 -3
  215. package/dist/{chunk-XY5O74BH.js → chunk-X4U6PT3Z.js} +3 -3
  216. package/dist/{chunk-E2HEVF23.js → chunk-XNA6DATU.js} +10 -10
  217. package/dist/{chunk-ALKTNXMR.js → chunk-XTGWCYAR.js} +37 -37
  218. package/dist/{chunk-3XQ635KD.js → chunk-XXNLNZ7E.js} +3 -3
  219. package/dist/{chunk-YEDYBMCW.js → chunk-YF2PYLC4.js} +1 -1
  220. package/dist/{chunk-ZJKOLOVF.js → chunk-YS56RSTZ.js} +26 -20
  221. package/dist/{chunk-RTJXOIIQ.js → chunk-YWP7XFKD.js} +1 -1
  222. package/dist/{chunk-ATTE3FYC.js → chunk-ZBJNEJSL.js} +3 -3
  223. package/dist/{chunk-A2FHZH7E.js → chunk-ZNHF2XCP.js} +35 -21
  224. package/dist/{chunk-ERAIVAK5.js → chunk-ZTH6YSVA.js} +37 -4
  225. package/dist/{chunk-KS7DXCXH.js → chunk-ZWJTHFWB.js} +3 -3
  226. package/dist/{chunk-EKQMYG2B.js → chunk-ZXOD37BE.js} +18 -18
  227. package/dist/cli/index.js +2 -2
  228. package/dist/{core-5Z6UW5DS.js → core-34KIMTK6.js} +2 -1
  229. package/dist/{core-XXIOJY2X.js → core-3CWPIFAL.js} +3 -1
  230. package/dist/{core-WLVU2HWX.js → core-7R3ARYNI.js} +3 -1
  231. package/dist/{core-DU77ZYPR.js → core-7YKLT7KY.js} +3 -1
  232. package/dist/{core-QUYSNTC7.js → core-AEYGGH7X.js} +3 -1
  233. package/dist/{core-CPN2HF75.js → core-ASBJZZTP.js} +2 -1
  234. package/dist/{core-JQV7STNF.js → core-CJ7FFPDU.js} +3 -1
  235. package/dist/{core-PL64QPOH.js → core-CJZXX2V3.js} +3 -1
  236. package/dist/{core-T5Q4DSH2.js → core-DAFZ7YJW.js} +2 -1
  237. package/dist/{core-RUA3EWW3.js → core-DJPGSTXB.js} +3 -1
  238. package/dist/{core-KBH3EJZV.js → core-DKJUX7Q4.js} +2 -1
  239. package/dist/{core-FFLPH5XK.js → core-EAIFSTDE.js} +3 -1
  240. package/dist/{core-E6YD7VU4.js → core-GEUPUZUY.js} +3 -1
  241. package/dist/{core-OK2ZY5OJ.js → core-JLJTP7P6.js} +2 -1
  242. package/dist/{core-RY6IFRKM.js → core-JLXFDYHX.js} +3 -1
  243. package/dist/{core-ZH7XTJTD.js → core-KCORN7F7.js} +3 -1
  244. package/dist/{core-IZVZ2B7Y.js → core-KF6GJOGW.js} +2 -1
  245. package/dist/{core-DBRILYNB.js → core-KII4CH3W.js} +2 -1
  246. package/dist/{core-TJX3I7KH.js → core-KZK3WCUG.js} +3 -1
  247. package/dist/{core-RE3L6YCM.js → core-L5KTPXHC.js} +2 -1
  248. package/dist/{core-CS7AKNME.js → core-L7Y7YXWR.js} +2 -1
  249. package/dist/{core-IV26EL5C.js → core-MN45UFF4.js} +3 -1
  250. package/dist/{core-PVINU5JJ.js → core-MNUVP5IJ.js} +3 -1
  251. package/dist/{core-OW5V74Q4.js → core-O2K4BDYH.js} +3 -1
  252. package/dist/{core-ZHE7N4NS.js → core-ONNGSKWQ.js} +3 -1
  253. package/dist/{core-KFBW5PRT.js → core-PFXIBWLD.js} +3 -1
  254. package/dist/{core-ZJYLJWZQ.js → core-QXIAQFHM.js} +2 -1
  255. package/dist/{core-KWGXHBJE.js → core-R27R6J5M.js} +3 -1
  256. package/dist/{core-OV5MPTZP.js → core-RCFFJANI.js} +3 -1
  257. package/dist/{core-WQPHNVNY.js → core-RGLOYY73.js} +3 -1
  258. package/dist/{core-SE67HHFG.js → core-V7I4F6JW.js} +3 -1
  259. package/dist/{core-6LLJNZ4O.js → core-W7AZNHOX.js} +3 -1
  260. package/dist/{core-MZMR2DF4.js → core-WHI4ABF2.js} +2 -1
  261. package/dist/{core-6ANZ2OWO.js → core-WJSKT5XM.js} +2 -1
  262. package/dist/{core-EE55P6XK.js → core-XKV7GMPG.js} +3 -1
  263. package/dist/{core-ULUA5ZB2.js → core-YPH723Z7.js} +3 -1
  264. package/dist/{core-SCWEVNUY.js → core-YVNOHIQ4.js} +3 -1
  265. package/dist/{dataTable-IL7HVDHL.js → dataTable-VKEHFLJM.js} +3 -2
  266. package/dist/{engine-MYLZI5VH.js → engine-PPXKJJFI.js} +12 -11
  267. package/dist/fixtures.js +3 -1
  268. package/dist/{fontTables-ZYBUCJ5N.js → fontTables-WYCZNRE7.js} +1 -1
  269. package/dist/fonts.js +1 -1
  270. package/dist/index.js +21 -19
  271. package/dist/{main-ISJ53IS5.js → main-53MXACOU.js} +12 -10
  272. package/dist/mcp/server.js +18 -15
  273. package/dist/react/bar.js +3 -1
  274. package/dist/react/bartable.js +2 -1
  275. package/dist/react/box.js +3 -1
  276. package/dist/react/bullet.js +3 -1
  277. package/dist/react/butterfly.js +3 -1
  278. package/dist/react/choropleth.js +2 -1
  279. package/dist/react/cohort.js +3 -1
  280. package/dist/react/column.js +3 -1
  281. package/dist/react/combo.js +3 -1
  282. package/dist/react/creative.js +2 -1
  283. package/dist/react/diagram.js +2 -1
  284. package/dist/react/dimswitch.js +3 -1
  285. package/dist/react/dot.js +3 -1
  286. package/dist/react/export.js +20 -18
  287. package/dist/react/funnel.js +3 -1
  288. package/dist/react/gantt.js +2 -1
  289. package/dist/react/grid.js +3 -1
  290. package/dist/react/heatmap.js +3 -1
  291. package/dist/react/histogram.js +3 -1
  292. package/dist/react/index.js +86 -84
  293. package/dist/react/kpi.js +2 -1
  294. package/dist/react/likert.js +3 -1
  295. package/dist/react/line.js +3 -1
  296. package/dist/react/mekko.js +3 -1
  297. package/dist/react/pareto.js +3 -1
  298. package/dist/react/pie.js +3 -1
  299. package/dist/react/prepare.js +20 -18
  300. package/dist/react/pvm.js +3 -1
  301. package/dist/react/pyramid.js +3 -1
  302. package/dist/react/sankey.js +2 -1
  303. package/dist/react/scatter.js +3 -1
  304. package/dist/react/slope.js +3 -1
  305. package/dist/react/sparkline.js +2 -1
  306. package/dist/react/spec.js +36 -26
  307. package/dist/react/status.js +2 -1
  308. package/dist/react/story.js +4 -3
  309. package/dist/react/table.js +3 -1
  310. package/dist/react/theme.js +4 -3
  311. package/dist/react/tilemap.js +2 -1
  312. package/dist/react/treemap.js +2 -1
  313. package/dist/react/variance.js +3 -1
  314. package/dist/react/waffle.js +2 -1
  315. package/dist/react/waterfall.js +3 -1
  316. package/dist/rows.js +2 -2
  317. package/dist/{rowsModule-3Y4I3M3E.js → rowsModule-L3MBGPBH.js} +2 -1
  318. package/dist/{schema-STGL44TL.js → schema-26YUL3MG.js} +4 -1
  319. package/dist/{schema-5YTNQ6JY.js → schema-33ZF6WKL.js} +4 -1
  320. package/dist/{schema-E6YOSOWB.js → schema-3W7IFXVN.js} +3 -1
  321. package/dist/{schema-G4KFMQBL.js → schema-4ZXJCRZR.js} +4 -1
  322. package/dist/{schema-QJJPRRE7.js → schema-5E5J43CF.js} +4 -1
  323. package/dist/{schema-34ZELWRQ.js → schema-6ZV532RM.js} +4 -1
  324. package/dist/{schema-P63S63GE.js → schema-733PO52K.js} +4 -1
  325. package/dist/{schema-QEVSIMGO.js → schema-AQD3H5VV.js} +4 -1
  326. package/dist/{schema-EVLLL5UF.js → schema-B4GFRYIP.js} +4 -1
  327. package/dist/{schema-EQQB43AY.js → schema-CMXL5F5L.js} +4 -1
  328. package/dist/{schema-IF5N3J56.js → schema-FT37ZEYY.js} +4 -1
  329. package/dist/{schema-2GUBWOBC.js → schema-GK6MD4EG.js} +4 -1
  330. package/dist/{schema-MEAFRXVH.js → schema-GSE3QXUK.js} +4 -2
  331. package/dist/{schema-4735XAZX.js → schema-GVHM2HEF.js} +4 -1
  332. package/dist/{schema-E2ISJ65D.js → schema-H7RKVTVO.js} +4 -1
  333. package/dist/{schema-XYYDUUHS.js → schema-HGUBNXUY.js} +4 -1
  334. package/dist/{schema-KFC4WYH4.js → schema-HRHNGOFC.js} +3 -1
  335. package/dist/{schema-PNC3Z7AH.js → schema-HWU55RJL.js} +4 -1
  336. package/dist/{schema-3BHL2B76.js → schema-IOKAZVL7.js} +4 -1
  337. package/dist/{schema-7J3NAIN2.js → schema-IOWE3RQO.js} +4 -1
  338. package/dist/{schema-2BMZOHXI.js → schema-KFXLS67Q.js} +4 -1
  339. package/dist/{schema-EYQ5IBLF.js → schema-KH62LDYK.js} +4 -1
  340. package/dist/{schema-S3EQKVOT.js → schema-KHCLVE2V.js} +4 -1
  341. package/dist/{schema-PA2MXYY4.js → schema-KORNUIC6.js} +4 -1
  342. package/dist/{schema-AOJJ7JZB.js → schema-LYBOPAGQ.js} +4 -1
  343. package/dist/{schema-GH7IKSOU.js → schema-MNG24WU2.js} +4 -1
  344. package/dist/{schema-PDZ6256H.js → schema-NOPOI5G2.js} +4 -1
  345. package/dist/{schema-T4NE2EAO.js → schema-PNUC54GC.js} +4 -1
  346. package/dist/{schema-P7LJFJAJ.js → schema-Q4IPIR6W.js} +4 -1
  347. package/dist/{schema-TQYTESG3.js → schema-QLH2DZFI.js} +4 -1
  348. package/dist/{schema-D3RCMN3T.js → schema-QNI6MNQ2.js} +4 -1
  349. package/dist/{schema-W376PAJG.js → schema-SLQPM32G.js} +4 -1
  350. package/dist/{schema-EYZVD73N.js → schema-SY3MKF5S.js} +4 -1
  351. package/dist/{schema-JJYJOQTT.js → schema-WAKLKLBB.js} +4 -1
  352. package/dist/{schema-IG7JIR4H.js → schema-WCDYWS4K.js} +4 -1
  353. package/dist/{schema-CVMV4LRA.js → schema-ZCZCY34J.js} +4 -1
  354. package/dist/{schema-L7263JMT.js → schema-ZSYX76MO.js} +4 -1
  355. package/dist/{specValidation-NVBIZMEE.js → specValidation-H5B4MQST.js} +3 -1
  356. package/dist/theme.js +3 -2
  357. package/dist/{themeShapeRules-5C2463YH.js → themeShapeRules-54U5EIZR.js} +1 -1
  358. package/dist/types/core/annotateEngine.d.ts +14 -0
  359. package/dist/types/core/charts/gantt/layout.d.ts +7 -0
  360. package/dist/types/core/charts/grid/schema.d.ts +1 -1
  361. package/dist/types/core/deferred.d.ts +6 -1
  362. package/dist/types/core/formatSpec.d.ts +2 -0
  363. package/dist/types/core/label/solver.d.ts +5 -1
  364. package/dist/types/core/rows.d.ts +2 -0
  365. package/dist/types/core/theme.d.ts +3 -1
  366. package/dist/types/core/themeShape.d.ts +3 -3
  367. package/dist/types/core/themeValidate.d.ts +3 -3
  368. package/dist/types/core/types/annotations.d.ts +6 -2
  369. package/dist/types/core/types/data.d.ts +8 -3
  370. package/dist/types/core/types/theme.d.ts +2 -1
  371. package/dist/types/react/rowsStore.d.ts +5 -0
  372. package/dist/types/react/spec.d.ts +17 -0
  373. package/dist/types/rows.d.ts +6 -1
  374. package/dist/validate.js +8 -6
  375. package/docs/manual.md +19 -5
  376. package/docs/reference/box.md +1 -1
  377. package/docs/reference/fixtures.md +1 -0
  378. package/docs/reference/gantt.md +11 -5
  379. package/docs/reference/histogram.md +1 -1
  380. package/docs/reference/line.md +1 -1
  381. package/docs/reference/react.md +3 -0
  382. package/docs/reference/table.md +1 -1
  383. package/docs/reference/theme.md +2 -3
  384. package/docs/use-cases.md +198 -0
  385. package/llms.txt +4 -3
  386. package/package.json +2 -1
  387. package/dist/chunk-2GELJH37.js +0 -88
  388. package/dist/chunk-4GB7TBY7.js +0 -373
@@ -0,0 +1,657 @@
1
+ import {
2
+ isBareChart
3
+ } from "./chunk-YWP7XFKD.js";
4
+ import {
5
+ closestKey
6
+ } from "./chunk-XB4KZ6WO.js";
7
+ import {
8
+ claimedRegionIds,
9
+ geoRegionIdIndex,
10
+ resolveGeoRegionId
11
+ } from "./chunk-IYEFEBRN.js";
12
+ import {
13
+ WRITTEN_NUMBER,
14
+ adaptNamedColumns
15
+ } from "./chunk-33PLBIMA.js";
16
+ import {
17
+ getGeoPack
18
+ } from "./chunk-IDDA5INB.js";
19
+ import {
20
+ receivedDescription
21
+ } from "./chunk-RZNYW7UP.js";
22
+ import {
23
+ cellValue,
24
+ isNumberCell,
25
+ isPctCell
26
+ } from "./chunk-O3VN6BTL.js";
27
+ import {
28
+ NormalizeError
29
+ } from "./chunk-SGD3ZHID.js";
30
+
31
+ // src/core/inputError.ts
32
+ var InputError = class extends Error {
33
+ constructor(code, message, details = {}) {
34
+ super(message);
35
+ this.code = code;
36
+ this.details = details;
37
+ this.name = "InputError";
38
+ }
39
+ code;
40
+ details;
41
+ };
42
+ function assertSpecObject(spec) {
43
+ if (typeof spec == "string")
44
+ throw new InputError("spec-must-be-object", "pass the spec as a JSON object, not a string", {
45
+ path: "/spec",
46
+ expected: { types: ["object"] },
47
+ suggest: "Send the parsed spec object in spec, without JSON.stringify."
48
+ });
49
+ if (spec === null || typeof spec != "object" || Array.isArray(spec))
50
+ throw new InputError("spec-must-be-object", "pass the spec as a JSON object", {
51
+ path: "/spec",
52
+ expected: { types: ["object"] },
53
+ suggest: "Send an object with type and data, or an envelope with version and charts."
54
+ });
55
+ }
56
+
57
+ // src/core/rowsTypes.ts
58
+ var CHART_TYPE_OF = /* @__PURE__ */ new Map([
59
+ ["age-pyramid", "pyramid"],
60
+ ["bar", "bar"],
61
+ ["bar-mekko", "mekko"],
62
+ ["bar-table", "bartable"],
63
+ ["bartable", "bartable"],
64
+ ["box", "box"],
65
+ ["box-and-whisker", "box"],
66
+ ["boxplot", "box"],
67
+ ["bridge", "waterfall"],
68
+ ["bubble", "scatter"],
69
+ ["bullet", "bullet"],
70
+ ["butterfly", "butterfly"],
71
+ ["choropleth", "choropleth"],
72
+ ["cleveland", "dot"],
73
+ ["cohort", "cohort"],
74
+ ["column", "column"],
75
+ ["combo", "combo"],
76
+ ["creative", "creative"],
77
+ ["deviation", "variance"],
78
+ ["diagram", "diagram"],
79
+ ["dim-switch", "dimswitch"],
80
+ ["dim-switch-table", "dimswitch"],
81
+ ["dimswitch", "dimswitch"],
82
+ ["distribution", "histogram"],
83
+ ["diverging-stacked", "likert"],
84
+ ["donut", "pie"],
85
+ ["dot", "dot"],
86
+ ["doughnut", "pie"],
87
+ ["dumbbell", "dot"],
88
+ ["facets", "grid"],
89
+ ["frequency", "histogram"],
90
+ ["funnel", "funnel"],
91
+ ["gantt", "gantt"],
92
+ ["grid", "grid"],
93
+ ["heatmap", "heatmap"],
94
+ ["histogram", "histogram"],
95
+ ["kpi", "kpi"],
96
+ ["likert", "likert"],
97
+ ["line", "line"],
98
+ ["lollipop", "dot"],
99
+ ["marimekko", "mekko"],
100
+ ["matrix", "heatmap"],
101
+ ["mekko", "mekko"],
102
+ ["pareto", "pareto"],
103
+ ["pareto-chart", "pareto"],
104
+ ["pie", "pie"],
105
+ ["population-pyramid", "pyramid"],
106
+ ["price-volume-mix", "pvm"],
107
+ ["profile", "line"],
108
+ ["pvm", "pvm"],
109
+ ["pyramid", "pyramid"],
110
+ ["retention", "cohort"],
111
+ ["sankey", "sankey"],
112
+ ["scatter", "scatter"],
113
+ ["slope", "slope"],
114
+ ["sparkline", "sparkline"],
115
+ ["status", "status"],
116
+ ["table", "table"],
117
+ ["table-bars", "bartable"],
118
+ ["tbl", "table"],
119
+ ["tilemap", "tilemap"],
120
+ ["timeline", "gantt"],
121
+ ["treemap", "treemap"],
122
+ ["variance", "variance"],
123
+ ["voronoi-treemap", "treemap"],
124
+ ["waffle", "waffle"],
125
+ ["waterfall", "waterfall"]
126
+ ]), ROWS_SHAPES = /* @__PURE__ */ new Map([
127
+ ["bar", "category"],
128
+ ["bartable", "category"],
129
+ ["box", "box"],
130
+ ["butterfly", "category"],
131
+ ["choropleth", "map"],
132
+ ["column", "category"],
133
+ ["combo", "category"],
134
+ ["dot", "category"],
135
+ ["funnel", "category"],
136
+ ["heatmap", "category"],
137
+ ["histogram", "histogram"],
138
+ ["line", "category"],
139
+ ["mekko", "category"],
140
+ ["pie", "category"],
141
+ ["sankey", "flow"],
142
+ ["scatter", "scatter"],
143
+ ["slope", "category"],
144
+ ["table", "table"],
145
+ ["tilemap", "map"],
146
+ ["variance", "category"],
147
+ ["waffle", "category"],
148
+ ["waterfall", "waterfall"]
149
+ ]);
150
+
151
+ // src/core/rows.ts
152
+ var VALUE_KINDS = ["number", "percent", "fraction"], CATEGORY_ROLES = ["category", "series", "value", "categoryLabel", "seriesLabel", "unit", "date", "state"], COLUMN_ROLES = [...CATEGORY_ROLES, "label", "type", "x", "y", "size", "group", "source", "target", "sourceStage", "targetStage", "id"], SHAPE_ROLES = {
153
+ category: { required: ["category", "series", "value"], roles: CATEGORY_ROLES },
154
+ map: { required: ["category", "value"], roles: ["category", "value", "state"] },
155
+ waterfall: { required: ["label", "value"], roles: ["label", "value", "type"] },
156
+ scatter: { required: ["x", "y"], roles: ["x", "y", "size", "label", "group"] },
157
+ flow: { required: ["source", "target", "value"], roles: ["source", "target", "value", "sourceStage", "targetStage"] },
158
+ table: { required: [], roles: ["label", "id"] },
159
+ histogram: { required: ["value"], roles: ["value"] },
160
+ box: { required: ["category", "value"], roles: ["category", "value", "categoryLabel", "date"] }
161
+ }, NUMBER_ONLY_SHAPES = ["table", "histogram", "box"], TABLE_INPUT_KINDS = /* @__PURE__ */ new Set(["value", "text", "status", "date"]);
162
+ function isRecord(value) {
163
+ return value !== null && typeof value == "object" && !Array.isArray(value);
164
+ }
165
+ function readColumns(columns, shape) {
166
+ let { required, roles } = SHAPE_ROLES[shape];
167
+ if (columns === void 0 && !required.length && (columns = {}), !isRecord(columns))
168
+ throw new InputError("invalid-argument", `rows need columns: { ${required.join(", ")} } naming the source columns`, {
169
+ path: "/columns",
170
+ expected: { types: ["object"] },
171
+ suggest: `Pass columns with ${required.join(", ")} naming the source columns.`
172
+ });
173
+ let { valueKind = "number", ...contract } = columns;
174
+ if (!VALUE_KINDS.includes(valueKind))
175
+ throw new InputError("invalid-argument", `valueKind must be one of ${VALUE_KINDS.join(", ")}`, {
176
+ path: "/columns/valueKind",
177
+ expected: { values: [...VALUE_KINDS] },
178
+ suggest: "fraction when a share of one half arrives as 0.5, percent when it arrives as 50, number otherwise."
179
+ });
180
+ if (shape === "flow" && valueKind !== "number")
181
+ throw new InputError("invalid-argument", "sankey flows are plain numbers; valueKind must be number", {
182
+ path: "/columns/valueKind",
183
+ expected: { values: ["number"] },
184
+ fix: [{ op: "remove", path: "/columns/valueKind" }],
185
+ suggest: "Remove valueKind. To show shares, keep the counts as values and set options.nodeValue to share."
186
+ });
187
+ if (valueKind !== "number" && NUMBER_ONLY_SHAPES.includes(shape))
188
+ throw new InputError("invalid-argument", `${shape} rows take valueKind number only`, {
189
+ path: "/columns/valueKind",
190
+ expected: { values: ["number"] },
191
+ fix: [{ op: "remove", path: "/columns/valueKind" }],
192
+ suggest: shape === "table" ? "Set the format on the table column instead: a percent column is written in points, 12.5 with format 1.2% prints 12.5%." : "Pass the observations as plain numbers and set the number format in the spec options."
193
+ });
194
+ let unknown = Object.keys(contract).find((key) => !roles.includes(key));
195
+ if (unknown !== void 0)
196
+ throw new InputError("invalid-argument", `columns has no role '${unknown}'`, {
197
+ path: `/columns/${unknown}`,
198
+ expected: { values: [...roles, "valueKind"] },
199
+ fix: [{ op: "remove", path: `/columns/${unknown}` }]
200
+ });
201
+ let missing = [...required, ...Object.keys(contract)].find((role) => typeof contract[role] != "string" || !contract[role].trim());
202
+ if (missing !== void 0)
203
+ throw new InputError("invalid-argument", `columns.${missing} must name the source column that holds the ${missing}`, {
204
+ path: `/columns/${missing}`,
205
+ expected: { types: ["string"] }
206
+ });
207
+ return { contract, valueKind };
208
+ }
209
+ function valueCell(value, kind, decimalComma, path) {
210
+ if (decimalComma && typeof value == "string" && /^\s*-?[1-9]\d{0,2}\.\d{3}\s*$/.test(value))
211
+ throw new InputError("invalid-value", `${path}: '${value.trim()}' in a semicolon CSV is either ${value.trim().replace(/\./g, "")} with a thousands dot or ${value.trim()} with a decimal point`, {
212
+ path: "/rowsFile",
213
+ received: receivedDescription(value),
214
+ suggest: "Write the number without the thousands dot, or with a decimal comma."
215
+ });
216
+ return decimalComma && typeof value == "string" && /^\s*-?\d+,\d+\s*$/.test(value) && (value = value.replace(",", ".")), typeof value == "string" && /^\s*-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?\s*$/.test(value) ? value = Number(value) : value === "" && (value = null), typeof value != "number" || kind === "number" ? value : { pct: kind === "fraction" ? Number((value * 100).toPrecision(15)) : value };
217
+ }
218
+ function plainNumberAdvice(cell, kind, decimalComma) {
219
+ let advice = `Write the number alone, without grouping marks or a currency sign, with ${decimalComma ? "a decimal comma, as in 1234,5" : "a dot as the decimal mark, as in 1234.5"}.`;
220
+ return cell.includes("%") ? kind === "fraction" ? `${advice} valueKind is fraction, so 12% is written ${decimalComma ? "0,12" : "0.12"}; or set valueKind to percent and write 12.` : `${advice} Drop the percent sign${kind === "number" ? " and set valueKind to percent" : ""}; valueKind percent reads 12 as 12%.` : advice;
221
+ }
222
+ function argumentPath(path, rowsArgument, contract) {
223
+ let row = /^rows\[(\d+)\](?:\.(.*))?$/.exec(path);
224
+ if (row) return rowsArgument === "/rows" ? `/rows/${row[1]}${row[2] ? `/${row[2].replace(/~/g, "~0").replace(/\//g, "~1")}` : ""}` : "/rowsFile";
225
+ let named = /^contract\.(.+)$/.exec(path)?.[1];
226
+ if (named === void 0) return path === "contract" ? "/columns" : rowsArgument;
227
+ let role = Object.hasOwn(contract, named) ? named : Object.keys(contract).find((key) => contract[key] === named);
228
+ return role === void 0 ? "/columns" : `/columns/${role}`;
229
+ }
230
+ function byId(list) {
231
+ let entries = Array.isArray(list) ? list : [];
232
+ return new Map(entries.flatMap((entry) => typeof entry == "string" ? [[entry, { id: entry }]] : isRecord(entry) && typeof entry.id == "string" ? [[entry.id, entry]] : []));
233
+ }
234
+ function adaptItemRows(shape, rows, contract, data, valueKind, decimalComma, rowsArgument) {
235
+ if (!rows.length) throw new InputError("rows-empty", "rows contain no data row", { path: rowsArgument });
236
+ let columns = Object.values(contract), duplicate = columns.find((column, index) => columns.indexOf(column) !== index);
237
+ if (duplicate) throw new InputError("invalid-contract", `column '${duplicate}' is named for more than one role`, { path: "/columns" });
238
+ let present = new Set(rows.flatMap((row) => Object.keys(row)));
239
+ for (let [role, column] of Object.entries(contract))
240
+ if (!present.has(column)) throw new InputError("missing-column", `'${column}' is named in columns but no row provides it`, {
241
+ path: `/columns/${role}`,
242
+ suggest: `Columns present: ${[...present].sort().join(", ")}.`
243
+ });
244
+ let pathMap = /* @__PURE__ */ new Map(), field = shape === "waterfall" ? "items" : shape === "flow" ? "links" : "points", groups = /* @__PURE__ */ new Map(), templates = byId(data.groups), entries = rows.map((row, index) => {
245
+ let entry = shape === "flow" ? {} : { id: `row-${index + 1}` };
246
+ for (let [role, column] of Object.entries(contract)) {
247
+ let source = { path: argumentPath(`rows[${index}].${column}`, rowsArgument, contract), displayPath: `${rowsArgument.slice(1)} row ${index + 1}.${column}` };
248
+ pathMap.set(`/data/${field}/${index}/${role}`, source);
249
+ let raw = row[column];
250
+ if (!((role === "type" || role === "group" || role === "size") && (raw == null || raw === "")) && !(role === "label" && shape === "scatter" && raw == null)) {
251
+ if (["value", "x", "y", "size"].includes(role)) {
252
+ let kind = role === "size" ? "number" : valueKind, value = valueCell(raw, kind, decimalComma, `rows[${index}].${column}`);
253
+ if (typeof value == "string") throw new InputError("invalid-value", `${source.displayPath}: '${value}' is not a numeric cell`, {
254
+ ...source,
255
+ received: receivedDescription(raw),
256
+ ...WRITTEN_NUMBER.test(value) ? { suggest: plainNumberAdvice(value, kind, decimalComma) } : {}
257
+ });
258
+ entry[role] = value;
259
+ } else if (shape === "flow" && typeof raw == "number")
260
+ entry[role] = String(raw);
261
+ else {
262
+ if (role === "label" && shape === "waterfall" && (typeof raw != "string" || !raw))
263
+ throw new InputError("invalid-identity", `${source.displayPath}: item label must be a non-empty string`, source);
264
+ entry[role] = raw;
265
+ }
266
+ role === "group" && typeof raw == "string" && raw && !groups.has(raw) && (pathMap.set(`/data/groups/${groups.size}/id`, source), groups.set(raw, { ...templates.get(raw), id: raw }));
267
+ }
268
+ }
269
+ return entry;
270
+ });
271
+ return {
272
+ data: { ...data, [field]: entries, ...shape === "scatter" && contract.group ? { groups: [...groups.values()] } : {} },
273
+ pathMap,
274
+ ignoredColumns: [...present].filter((column) => !columns.includes(column)).sort()
275
+ };
276
+ }
277
+ function sourceField(rowsArgument, contract, index, column) {
278
+ return { path: argumentPath(`rows[${index}].${column}`, rowsArgument, contract), displayPath: `${rowsArgument.slice(1)} row ${index + 1}.${column}` };
279
+ }
280
+ var pointerSegment = (key) => key.replace(/~/g, "~0").replace(/\//g, "~1"), own = (row, key) => Object.hasOwn(row, key) ? row[key] : void 0;
281
+ function tableTemplateRows(list) {
282
+ let rows = /* @__PURE__ */ new Map(), walk = (entries, path, parentId) => {
283
+ Array.isArray(entries) && entries.forEach((entry, index) => {
284
+ if (!isRecord(entry) || typeof entry.id != "string") return;
285
+ let at = `${path}/${index}`;
286
+ if (rows.has(entry.id))
287
+ throw new InputError("duplicate-row-id", `spec data.rows: row id '${entry.id}' appears more than once`, {
288
+ path: `${at}/id`,
289
+ suggest: "Give each spec row its own id."
290
+ });
291
+ let { children, ...row } = entry;
292
+ if (parentId !== void 0 && row.parentId !== void 0 && row.parentId !== parentId)
293
+ throw new InputError("parent-conflict", `spec data.rows: row '${entry.id}' is nested under '${parentId}' but declares parentId '${String(row.parentId)}'`, {
294
+ path: `${at}/parentId`,
295
+ suggest: "Remove the parentId of the nested row, or move the row out of the children."
296
+ });
297
+ rows.set(entry.id, {
298
+ row: parentId === void 0 || row.parentId !== void 0 ? row : { ...row, parentId },
299
+ path: at,
300
+ parentPath: row.parentId !== void 0 ? `${at}/parentId` : at
301
+ }), walk(children, `${at}/children`, entry.id);
302
+ });
303
+ };
304
+ return walk(list, "/spec/data/rows"), rows;
305
+ }
306
+ function calcRowRefs(calc, found = []) {
307
+ return Array.isArray(calc) ? calc.forEach((entry) => calcRowRefs(entry, found)) : isRecord(calc) && (typeof calc.row == "string" && found.push(calc.row), Object.values(calc).forEach((entry) => calcRowRefs(entry, found))), found;
308
+ }
309
+ function checkTableLinks(data, drawn, templates) {
310
+ let advice = (id) => `Add a source row with the id '${id}', or remove the reference to it from the spec.`;
311
+ for (let id of drawn) {
312
+ let template = templates.get(id);
313
+ if (!template) continue;
314
+ let parentId = template.row.parentId;
315
+ if (typeof parentId == "string" && !drawn.has(parentId))
316
+ throw new InputError("parent-missing", `spec data.rows: row '${id}' has the parent '${parentId}', which no source row provides`, {
317
+ path: template.parentPath,
318
+ suggest: advice(parentId)
319
+ });
320
+ let missing = calcRowRefs(template.row.calc).find((ref) => !drawn.has(ref));
321
+ if (missing !== void 0)
322
+ throw new InputError("calc-ref-missing", `spec data.rows: the calc of row '${id}' names row '${missing}', which no source row provides`, {
323
+ path: `${template.path}/calc`,
324
+ suggest: advice(missing)
325
+ });
326
+ }
327
+ (Array.isArray(data.columns) ? data.columns : []).forEach((column, index) => {
328
+ let missing = isRecord(column) ? calcRowRefs(column.calc).find((ref) => !drawn.has(ref)) : void 0;
329
+ if (missing !== void 0)
330
+ throw new InputError("calc-ref-missing", `spec data.columns: the calc of column '${String(column.id)}' names row '${missing}', which no source row provides`, {
331
+ path: `/spec/data/columns/${index}/calc`,
332
+ suggest: advice(missing)
333
+ });
334
+ });
335
+ }
336
+ function tableInputColumns(data) {
337
+ if (!Array.isArray(data.columns))
338
+ throw new InputError("invalid-argument", "table rows need data.columns in the spec: the columns declare which source field fills each cell", {
339
+ path: "/spec/data/columns",
340
+ expected: { types: ["array"] },
341
+ suggest: "Write data.columns in the spec: one rowLabel column, and a value, text, status or date column whose id names each source field."
342
+ });
343
+ return data.columns.flatMap((column, index) => isRecord(column) && typeof column.id == "string" && TABLE_INPUT_KINDS.has(column.kind) ? [{ id: column.id, kind: column.kind, index }] : []);
344
+ }
345
+ function adaptTableRows(rows, contract, data, inputs, decimalComma, rowsArgument) {
346
+ if (!rows.length) throw new InputError("rows-empty", "rows contain no data row", { path: rowsArgument });
347
+ if (contract.label !== void 0 && contract.label === contract.id)
348
+ throw new InputError("invalid-contract", `column '${contract.id}' is named for more than one role`, { path: "/columns" });
349
+ let present = new Set(rows.flatMap((row) => Object.keys(row)));
350
+ for (let [role, column] of Object.entries(contract))
351
+ if (!present.has(column)) throw new InputError("missing-column", `'${column}' is named in columns but no row provides it`, {
352
+ path: `/columns/${role}`,
353
+ suggest: `Columns present: ${[...present].sort().join(", ")}.`
354
+ });
355
+ for (let input of inputs)
356
+ if (!present.has(input.id)) throw new InputError("missing-column", `table column '${input.id}' takes its cells from the source field '${input.id}', and no row provides it`, {
357
+ path: `/spec/data/columns/${input.index}/id`,
358
+ suggest: `Rename the column or the source field so they match, or remove the column. Columns present: ${[...present].sort().join(", ")}.`
359
+ });
360
+ let pathMap = /* @__PURE__ */ new Map(), templates = tableTemplateRows(data.rows), seen = /* @__PURE__ */ new Map(), entries = rows.map((row, index) => {
361
+ let id = `row-${index + 1}`;
362
+ if (contract.id !== void 0) {
363
+ let raw = own(row, contract.id), source = sourceField(rowsArgument, contract, index, contract.id);
364
+ if (typeof raw != "string" || !raw.trim())
365
+ throw new InputError("invalid-identity", `${source.displayPath}: a row id must be non-empty text, received ${JSON.stringify(raw ?? null)}`, {
366
+ ...source,
367
+ received: receivedDescription(raw, raw !== void 0)
368
+ });
369
+ let first = seen.get(raw);
370
+ if (first !== void 0)
371
+ throw new InputError("duplicate-id", `${source.displayPath}: row id '${raw}' repeats row ${first + 1}`, {
372
+ ...source,
373
+ suggest: "Give each row its own id, or leave out the id role so the rows are numbered row-1, row-2, ..."
374
+ });
375
+ seen.set(raw, index), id = raw, pathMap.set(`/data/rows/${index}/id`, source);
376
+ }
377
+ let cells = {}, cellSources = [];
378
+ for (let input of inputs) {
379
+ let raw = own(row, input.id), source = sourceField(rowsArgument, contract, index, input.id);
380
+ if (raw != null && typeof raw != "number" && typeof raw != "string" && !isRecord(raw))
381
+ throw new InputError("invalid-value", `${source.displayPath}: a table cell takes a number, text, null or a cell object, not ${receivedDescription(raw)}`, {
382
+ ...source,
383
+ received: receivedDescription(raw),
384
+ suggest: 'Write the value as text, such as "yes" or "no", or as a number.'
385
+ });
386
+ let cell = raw === void 0 || raw === "" && input.kind !== "text" ? null : input.kind === "value" ? valueCell(raw, "number", decimalComma, `rows[${index}].${input.id}`) : raw;
387
+ if (input.kind === "value" && typeof cell == "string")
388
+ throw new InputError("invalid-value", `${source.displayPath}: '${cell}' is not a numeric cell`, {
389
+ ...source,
390
+ received: receivedDescription(raw),
391
+ // A table takes no valueKind, so a percent sign is fixed in the column format, not with valueKind percent.
392
+ ...WRITTEN_NUMBER.test(cell) ? { suggest: cell.includes("%") ? `${plainNumberAdvice(cell.replace(/%/g, ""), "number", decimalComma)} Drop the percent sign and give the column a percent format such as 1.2%: a table writes percents in points, 12 for 12%.` : plainNumberAdvice(cell, "number", decimalComma) } : {}
393
+ });
394
+ Object.defineProperty(cells, input.id, { value: cell, enumerable: !0, writable: !0, configurable: !0 }), pathMap.set(`/data/rows/${index}/cells/${pointerSegment(input.id)}`, source), cellSources.push([input.id, source]);
395
+ }
396
+ let label = contract.label === void 0 ? void 0 : own(row, contract.label), labelled = label != null && label !== "";
397
+ labelled && pathMap.set(`/data/rows/${index}/label`, sourceField(rowsArgument, contract, index, contract.label));
398
+ for (let [column, source] of cellSources) pathMap.set(`rows[${id}].cells[${column}]`, source);
399
+ let template = templates.get(id)?.row;
400
+ return {
401
+ ...template,
402
+ id,
403
+ ...labelled ? { label } : {},
404
+ cells: { ...isRecord(template?.cells) ? template.cells : {}, ...cells }
405
+ };
406
+ });
407
+ checkTableLinks(data, new Set(entries.map((entry) => entry.id)), templates);
408
+ let read = /* @__PURE__ */ new Set([...inputs.map((input) => input.id), ...Object.values(contract)]);
409
+ return { data: { ...data, rows: entries }, pathMap, ignoredColumns: [...present].filter((column) => !read.has(column)).sort() };
410
+ }
411
+ function readObservation(shape, row, index, contract, decimalComma, rowsArgument) {
412
+ let column = contract.value, raw = own(row, column), source = sourceField(rowsArgument, contract, index, column), received = receivedDescription(raw, raw !== void 0), value = raw === void 0 || typeof raw == "string" && !raw.trim() ? null : valueCell(raw, "number", decimalComma, `rows[${index}].${column}`);
413
+ if (value === null)
414
+ throw new InputError("missing-value", `${source.displayPath}: the observation is missing; a ${shape} draws every row and takes no missing value`, {
415
+ ...source,
416
+ received,
417
+ suggest: `Remove the rows without a ${column} before the call, or fill in their values.`
418
+ });
419
+ if (typeof value != "number" || !Number.isFinite(value)) {
420
+ let written = typeof value == "string" && WRITTEN_NUMBER.test(value);
421
+ throw new InputError("invalid-value", `${source.displayPath}: ${typeof value == "number" ? `${value} is not a finite number` : `${JSON.stringify(value)} is not a number`}`, {
422
+ ...source,
423
+ received,
424
+ suggest: written ? plainNumberAdvice(value, "number", decimalComma) : "Fix or filter this value: an observation is a plain finite number."
425
+ });
426
+ }
427
+ return value;
428
+ }
429
+ function boxTemplateGroups(list) {
430
+ let groups = /* @__PURE__ */ new Map();
431
+ return (Array.isArray(list) ? list : []).forEach((entry, index) => {
432
+ if (!(!isRecord(entry) || typeof entry.id != "string")) {
433
+ if (groups.has(entry.id))
434
+ throw new InputError("invalid-data", `spec data.groups: group id '${entry.id}' appears more than once`, {
435
+ path: `/spec/data/groups/${index}/id`,
436
+ suggest: "Give each spec group its own id."
437
+ });
438
+ groups.set(entry.id, entry);
439
+ }
440
+ }), groups;
441
+ }
442
+ function adaptObservationRows(shape, rows, contract, data, decimalComma, rowsArgument) {
443
+ if (!rows.length) throw new InputError("rows-empty", "rows contain no data row", { path: rowsArgument });
444
+ let columns = Object.entries(contract).filter(([role, column]) => role !== "date" || column !== contract.category).map(([, column]) => column), duplicate = columns.find((column, index) => columns.indexOf(column) !== index);
445
+ if (duplicate) throw new InputError("invalid-contract", `column '${duplicate}' is named for more than one role`, { path: "/columns" });
446
+ let present = new Set(rows.flatMap((row) => Object.keys(row)));
447
+ for (let [role, column] of Object.entries(contract))
448
+ if (!present.has(column)) throw new InputError("missing-column", `'${column}' is named in columns but no row provides it`, {
449
+ path: `/columns/${role}`,
450
+ suggest: `Columns present: ${[...present].sort().join(", ")}.`
451
+ });
452
+ let pathMap = /* @__PURE__ */ new Map(), ignoredColumns = [...present].filter((column) => !Object.values(contract).includes(column)).sort();
453
+ if (shape === "histogram") {
454
+ let observations = rows.map((row, index) => (pathMap.set(`/data/observations/${index}`, sourceField(rowsArgument, contract, index, contract.value)), readObservation(shape, row, index, contract, decimalComma, rowsArgument)));
455
+ return { data: { ...data, observations }, pathMap, ignoredColumns };
456
+ }
457
+ let templates = boxTemplateGroups(data.groups), groups = /* @__PURE__ */ new Map();
458
+ return rows.forEach((row, index) => {
459
+ let category = contract.category, raw = own(row, category), source = sourceField(rowsArgument, contract, index, category);
460
+ if (typeof raw != "string" || !raw)
461
+ throw new InputError("invalid-identity", `${source.displayPath}: a group id must be non-empty text, received ${JSON.stringify(raw ?? null)}`, {
462
+ ...source,
463
+ received: receivedDescription(raw, raw !== void 0)
464
+ });
465
+ let group = groups.get(raw);
466
+ group || (group = { index: groups.size, observations: [] }, groups.set(raw, group), pathMap.set(`/data/groups/${group.index}/id`, source)), pathMap.set(`/data/groups/${group.index}/observations/${group.observations.length}`, sourceField(rowsArgument, contract, index, contract.value)), group.observations.push(readObservation(shape, row, index, contract, decimalComma, rowsArgument));
467
+ for (let field of ["label", "date"]) {
468
+ let column = contract[field === "label" ? "categoryLabel" : "date"], value = column === void 0 ? void 0 : own(row, column);
469
+ if (column === void 0 || value === void 0 || value === null || value === "") continue;
470
+ let at = sourceField(rowsArgument, contract, index, column);
471
+ if (typeof value != "string")
472
+ throw new InputError("invalid-value", `${at.displayPath}: a group ${field} must be text, received ${JSON.stringify(value)}`, { ...at, received: receivedDescription(value) });
473
+ let first = group[field];
474
+ if (first === void 0)
475
+ group[field] = { value, row: index }, pathMap.set(`/data/groups/${group.index}/${field}`, at);
476
+ else if (first.value !== value)
477
+ throw new InputError("ambiguous-mapping", `${at.displayPath}: group '${raw}' has the ${field} '${first.value}' in row ${first.row + 1} and '${value}' here; one ${field} per group is required`, {
478
+ ...at,
479
+ received: receivedDescription(value)
480
+ });
481
+ }
482
+ }), {
483
+ data: {
484
+ ...data,
485
+ groups: [...groups].map(([id, group]) => {
486
+ let { observations: _authored, ...template } = templates.get(id) ?? {};
487
+ return {
488
+ ...template,
489
+ id,
490
+ ...group.label ? { label: group.label.value } : {},
491
+ ...group.date ? { date: group.date.value } : {},
492
+ observations: group.observations
493
+ };
494
+ })
495
+ },
496
+ pathMap,
497
+ ignoredColumns
498
+ };
499
+ }
500
+ function adaptRows(spec, columns, source) {
501
+ if (assertSpecObject(spec), !isRecord(spec) || !isBareChart(spec))
502
+ throw new InputError("rows-need-one-chart", "rows fill the data of one chart; send a bare chart spec, not an envelope", {
503
+ path: "/spec",
504
+ suggest: "Render each chart of the envelope in its own call with its rows."
505
+ });
506
+ let type = typeof spec.type == "string" ? CHART_TYPE_OF.get(spec.type) : void 0;
507
+ if (type !== void 0 && !ROWS_SHAPES.has(type))
508
+ throw new InputError("rows-unsupported-type", `'${spec.type}' has no rows mapping`, {
509
+ path: "/spec/type",
510
+ expected: { values: [...ROWS_SHAPES.keys()].sort() },
511
+ suggest: `Write the ${spec.type} data in the spec, or draw the rows with one of the listed types.`
512
+ });
513
+ let shape = (type === void 0 ? void 0 : ROWS_SHAPES.get(type)) ?? "category", map = shape === "map", { contract: rowContract, valueKind } = readColumns(columns, shape), rowsArgument = source.argument, template = isRecord(spec.data) ? spec.data : {}, tableInputs = shape === "table" ? tableInputColumns(template) : [], loaded = source.load();
514
+ if (!Array.isArray(loaded.rows) || !loaded.rows.every(isRecord))
515
+ throw new InputError("invalid-rows", "rows must be an array of objects", { path: rowsArgument });
516
+ let decimalComma = loaded.decimalComma === !0;
517
+ if (shape === "waterfall" || shape === "scatter" || shape === "flow" || shape === "table" || shape === "histogram" || shape === "box") {
518
+ let adapted2 = shape === "table" ? adaptTableRows(loaded.rows, rowContract, template, tableInputs, decimalComma, rowsArgument) : shape === "histogram" || shape === "box" ? adaptObservationRows(shape, loaded.rows, rowContract, template, decimalComma, rowsArgument) : adaptItemRows(shape, loaded.rows, rowContract, template, valueKind, decimalComma, rowsArgument);
519
+ return { spec: { ...spec, data: adapted2.data }, pathMap: adapted2.pathMap, rows: loaded.rows.length, ignoredColumns: adapted2.ignoredColumns, states: [] };
520
+ }
521
+ let contract = rowContract, rows = loaded.rows.map((row, index) => Object.hasOwn(row, contract.value) ? { ...row, [contract.value]: valueCell(row[contract.value], valueKind, decimalComma, `rows[${index}].${contract.value}`) } : row), mapSeriesColumn = "__map_measure";
522
+ for (; rows.some((row) => Object.hasOwn(row, mapSeriesColumn)) || Object.values(contract).includes(mapSeriesColumn); ) mapSeriesColumn += "_";
523
+ let adaptedContract = map ? { ...contract, series: mapSeriesColumn } : contract, adaptedRows = map ? rows.map((row) => ({ ...row, [mapSeriesColumn]: "value" })) : rows, adapted;
524
+ try {
525
+ adapted = adaptNamedColumns({ contract: adaptedContract, rows: adaptedRows });
526
+ } catch (error) {
527
+ if (!(error instanceof NormalizeError)) throw error;
528
+ let [, row, column] = /^rows\[(\d+)\]\.(.+)$/.exec(error.path) ?? [], source2 = row === void 0 ? void 0 : loaded.rows[Number(row)], cell = source2 && Object.hasOwn(source2, column) ? source2[column] : void 0, suggest = column === contract.value && typeof cell == "string" && WRITTEN_NUMBER.test(cell) ? plainNumberAdvice(cell, valueKind, decimalComma) : error.suggest;
529
+ throw new InputError(error.code, `${error.path ? `${error.path}: ` : ""}${error.message}`, {
530
+ path: argumentPath(map ? error.path.replace(`.${mapSeriesColumn}`, `.${contract.category}`) : error.path, rowsArgument, contract),
531
+ ...suggest ? { suggest } : {},
532
+ ...source2 && Object.hasOwn(source2, column) ? { received: receivedDescription(cell) } : {}
533
+ });
534
+ }
535
+ let data = isRecord(spec.data) ? spec.data : {};
536
+ map && adapted.data.series[0]?.values.forEach((cell, index) => {
537
+ if (cell !== null && typeof cell == "object" && "date" in cell)
538
+ throw new InputError("invalid-value", `rows[${index}].${contract.value}: a map needs a number or null, not a date`, {
539
+ path: argumentPath(`rows[${index}].${contract.value}`, rowsArgument, contract)
540
+ });
541
+ });
542
+ let bartable = type === "bartable", pathMap = /* @__PURE__ */ new Map(), sourceField2 = (generated, row, column) => {
543
+ !column || pathMap.has(generated) || pathMap.set(generated, {
544
+ path: argumentPath(`rows[${row}].${column}`, rowsArgument, contract),
545
+ displayPath: `${rowsArgument.slice(1)} row ${row + 1}.${column}`
546
+ });
547
+ };
548
+ if (!map) {
549
+ let categoryIndices = new Map(adapted.data.categories.map((entry, i) => [entry.id, i])), seriesIndices = new Map(adapted.data.series.map((entry, i) => [entry.id, i]));
550
+ rows.forEach((row, i) => {
551
+ let category = categoryIndices.get(String(row[contract.category])), series2 = seriesIndices.get(String(row[contract.series])), cell = bartable ? `/data/panels/0/values/${adapted.data.series[series2].id.replace(/~/g, "~0").replace(/\//g, "~1")}/${category}` : `/data/series/${series2}/values/${category}`;
552
+ sourceField2(cell, i, contract.value), sourceField2(`${cell}/state`, i, contract.state ?? contract.value), sourceField2(`/data/categories/${category}/id`, i, contract.category), sourceField2(`/data/categories/${category}/label`, i, contract.categoryLabel), sourceField2(`/data/categories/${category}/date`, i, contract.date), sourceField2(`/data/series/${series2}/id`, i, contract.series), sourceField2(`/data/series/${series2}/label`, i, contract.seriesLabel), sourceField2(`/data/series/${series2}/unit`, i, contract.unit);
553
+ });
554
+ }
555
+ if (map) {
556
+ let pack;
557
+ try {
558
+ pack = spec.type === "tilemap" ? source.tilePack?.(data.pack) : getGeoPack(data.pack);
559
+ } catch {
560
+ }
561
+ if (pack) {
562
+ let index = geoRegionIdIndex(pack.regions), claimed = /* @__PURE__ */ new Set();
563
+ adapted.data.categories.forEach((category, generated) => {
564
+ let source2 = rows.findIndex((row) => String(row[contract.category]) === category.id), sourcePath = argumentPath(`rows[${source2}].${contract.category}`, rowsArgument, contract), displayPath = `${rowsArgument.slice(1)} row ${source2 + 1}.${contract.category}`;
565
+ pathMap.set(`/data/regions/${generated}/id`, { path: sourcePath, displayPath }), pathMap.set(`/data/regions/${generated}/value`, { path: argumentPath(`rows[${source2}].${contract.value}`, rowsArgument, contract), displayPath: `${rowsArgument.slice(1)} row ${source2 + 1}.${contract.value}` });
566
+ let resolution = resolveGeoRegionId(index, category.id), ids = claimedRegionIds(resolution);
567
+ if (ids.some((id) => claimed.has(id))) throw new InputError("duplicate-id", `${displayPath}: region '${category.id}' repeats a pack member`, { path: sourcePath, displayPath, suggest: "Keep one source row per pack member, using its canonical id." });
568
+ if (ids.forEach((id) => claimed.add(id)), resolution.kind === "unknown") {
569
+ let nearest = closestKey(category.id, [...index.canonical.keys()]), hint = nearest?.near ? `; did you mean '${index.canonical.get(nearest.key)}'?` : "";
570
+ throw new InputError(`${spec.type}-unknown-region`, `${displayPath}: region '${category.id}' is not in pack '${data.pack}'${hint}`, { path: sourcePath, displayPath, suggest: "Use a canonical region id or an unambiguous pack alias." });
571
+ }
572
+ });
573
+ }
574
+ }
575
+ let categories = byId(data.categories), series = byId(data.series), named = (key) => contract[key] !== void 0, labelled = new Set(contract.categoryLabel === void 0 ? [] : rows.filter((row) => ![void 0, null, ""].includes(row[contract.categoryLabel])).map((row) => String(row[contract.category])));
576
+ return {
577
+ spec: {
578
+ ...spec,
579
+ data: {
580
+ // The rows replace every per-row list of a bar table template: its number columns (bartablePanel).
581
+ ...bartable ? Object.fromEntries(Object.entries(data).filter(([key]) => key !== "columns")) : data,
582
+ ...map ? { regions: adapted.data.categories.map((category, index) => {
583
+ let state = adapted.states.find((entry) => entry.categoryId === category.id)?.state;
584
+ return { id: category.id, value: cellValue(adapted.data.series[0].values[index]), ...state ? { state } : {} };
585
+ }) } : {
586
+ categories: adapted.data.categories.map(({ label, ...category }) => {
587
+ let authored = labelled.has(category.id) ? { label } : {}, template2 = categories.get(category.id);
588
+ return template2 ? { ...template2, id: category.id, ...authored, ...named("date") && category.date !== void 0 ? { date: category.date } : {} } : { ...category, ...authored };
589
+ }),
590
+ ...bartable ? bartablePanel(data, adapted.data.series, series, contract.value, (generated) => pathMap.get(generated)) : {
591
+ series: adapted.data.series.map((entry) => ({ ...series.get(entry.id), ...entry }))
592
+ }
593
+ }
594
+ }
595
+ },
596
+ pathMap,
597
+ rows: rows.length,
598
+ ignoredColumns: adapted.ignoredColumns,
599
+ states: adapted.states
600
+ };
601
+ }
602
+ function bartablePanel(data, adapted, templates, valueColumn, sourceOf) {
603
+ let [template] = Array.isArray(data.panels) ? data.panels.filter(isRecord) : [], { values: _values, ends: _ends, ...panel } = template ?? {}, cellPath = (segment, row) => `/data/panels/0/values/${segment.replace(/~/g, "~0").replace(/\//g, "~1")}/${row}`, refuse = (generated, message, suggest) => {
604
+ let source = sourceOf(generated);
605
+ throw new InputError("invalid-value", `${source ? `${source.displayPath}: ` : ""}${message}`, { ...source ?? { path: "/rows" }, suggest });
606
+ }, unitAt = adapted.findIndex((entry) => entry.unit !== void 0), otherUnit = adapted.findIndex((entry) => entry.unit !== void 0 && entry.unit !== adapted[unitAt].unit);
607
+ otherUnit >= 0 && refuse(
608
+ `/data/series/${otherUnit}/unit`,
609
+ `unit '${adapted[otherUnit].unit}' beside '${adapted[unitAt].unit}': a bar table stacks every segment in one panel with one unit, so it would add values in different units`,
610
+ "Convert the values to one unit, or draw one bar table per unit."
611
+ );
612
+ let firstKind;
613
+ adapted.forEach((entry) => entry.values.forEach((cell, row) => {
614
+ if (cell === null || typeof cell != "object") return;
615
+ let extra = Object.keys(cell).filter((key) => key !== "number" && key !== "pct");
616
+ extra.length > 0 && refuse(
617
+ cellPath(entry.id, row),
618
+ `a bar table cell holds a plain number; '${extra.join("', '")}' has no place in its panel and would be lost`,
619
+ "Send the value alone, and set the format on the spec's panel."
620
+ );
621
+ let kind = isPctCell(cell) ? "pct" : "number";
622
+ firstKind ??= kind, kind !== firstKind && refuse(
623
+ cellPath(entry.id, row),
624
+ "percent and number values in one bar table: its one panel would add shares to amounts under one unit",
625
+ "Send every value as a number or every value as a percent."
626
+ );
627
+ }));
628
+ let unit = unitAt >= 0 ? adapted[unitAt].unit : panel.unit ?? (firstKind === "pct" ? "%" : void 0);
629
+ return {
630
+ series: adapted.map(({ values: _cells, unit: _unit, ...entry }) => ({ ...templates.get(entry.id), ...entry })),
631
+ panels: [{
632
+ id: valueColumn,
633
+ ...panel,
634
+ ...unit !== void 0 ? { unit } : {},
635
+ values: Object.fromEntries(adapted.map((entry) => [entry.id, entry.values.map((cell) => isPctCell(cell) || isNumberCell(cell) ? cellValue(cell) : cell)]))
636
+ }]
637
+ };
638
+ }
639
+ function rewriteRowsDiagnostics(findings, pathMap) {
640
+ let sourceFor = (path) => {
641
+ for (let prefix = path; prefix; prefix = prefix.slice(0, prefix.lastIndexOf("/"))) {
642
+ let source = pathMap?.get(prefix);
643
+ if (source) return source;
644
+ }
645
+ };
646
+ return findings.map((finding) => {
647
+ let owner = isRecord(finding.owner) && typeof finding.owner.rowId == "string" && typeof finding.owner.colId == "string" ? `rows[${finding.owner.rowId}].cells[${finding.owner.colId}]` : void 0, source = sourceFor(finding.path) ?? (finding.displayPath === void 0 ? void 0 : pathMap?.get(finding.displayPath)) ?? (owner === void 0 ? void 0 : pathMap?.get(owner)), fix = finding.fix?.map((operation) => ({ ...operation, path: sourceFor(operation.path)?.path ?? operation.path }));
648
+ return { ...finding, ...source || {}, ...fix ? { fix } : {} };
649
+ });
650
+ }
651
+
652
+ export {
653
+ InputError,
654
+ assertSpecObject,
655
+ adaptRows,
656
+ rewriteRowsDiagnostics
657
+ };