@primeui/chart-core 0.0.1-alpha.1

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 (299) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +1 -0
  3. package/dist/animations/index.d.mts +136 -0
  4. package/dist/animations/index.mjs +18 -0
  5. package/dist/annotation.utils-Bm0lOO1o.d.mts +290 -0
  6. package/dist/borderRadius.utils-Cz73LLR_.d.mts +54 -0
  7. package/dist/canvas-D4vigq47.d.mts +34 -0
  8. package/dist/canvas.utils-D2WHi2gL.d.mts +167 -0
  9. package/dist/cartesian/index.d.mts +94 -0
  10. package/dist/cartesian/index.mjs +93 -0
  11. package/dist/chunk-22ST6YPP.mjs +304 -0
  12. package/dist/chunk-2QK2KOBN.mjs +10 -0
  13. package/dist/chunk-2QRS4YQ5.mjs +18 -0
  14. package/dist/chunk-3FFJEX4A.mjs +261 -0
  15. package/dist/chunk-3IYSJ2U7.mjs +567 -0
  16. package/dist/chunk-3OZLP4I4.mjs +190 -0
  17. package/dist/chunk-3WEMHXZI.mjs +198 -0
  18. package/dist/chunk-3Z62EUJN.mjs +138 -0
  19. package/dist/chunk-4C6EVJ54.mjs +362 -0
  20. package/dist/chunk-53HW45JB.mjs +102 -0
  21. package/dist/chunk-55Y3WI6S.mjs +186 -0
  22. package/dist/chunk-5JCI2DEB.mjs +97 -0
  23. package/dist/chunk-66T4MRC5.mjs +113 -0
  24. package/dist/chunk-6HSEJLSR.mjs +376 -0
  25. package/dist/chunk-6STOLMCA.mjs +187 -0
  26. package/dist/chunk-7CMVDIOU.mjs +54 -0
  27. package/dist/chunk-7QQ6ETB4.mjs +228 -0
  28. package/dist/chunk-A6ZQZFL2.mjs +272 -0
  29. package/dist/chunk-ADKLH73T.mjs +1 -0
  30. package/dist/chunk-AGU3NG6D.mjs +22 -0
  31. package/dist/chunk-AHYIS6EB.mjs +230 -0
  32. package/dist/chunk-AP3UYWYT.mjs +4 -0
  33. package/dist/chunk-ARB5T6MP.mjs +326 -0
  34. package/dist/chunk-ARRGOEFX.mjs +585 -0
  35. package/dist/chunk-AUF4CHDP.mjs +422 -0
  36. package/dist/chunk-B4FTADAZ.mjs +561 -0
  37. package/dist/chunk-BABQKA6K.mjs +339 -0
  38. package/dist/chunk-BETFQBM2.mjs +197 -0
  39. package/dist/chunk-BKP26M4K.mjs +413 -0
  40. package/dist/chunk-BZN2QHGP.mjs +200 -0
  41. package/dist/chunk-C36VWQ7A.mjs +86 -0
  42. package/dist/chunk-CHW4RKY3.mjs +16 -0
  43. package/dist/chunk-CINXJIRR.mjs +120 -0
  44. package/dist/chunk-DN6AXQYZ.mjs +667 -0
  45. package/dist/chunk-DP2IZNN3.mjs +92 -0
  46. package/dist/chunk-DTWTCFRG.mjs +119 -0
  47. package/dist/chunk-EAMUNLRU.mjs +172 -0
  48. package/dist/chunk-EDAKJLNA.mjs +17 -0
  49. package/dist/chunk-ERVQB2VZ.mjs +59 -0
  50. package/dist/chunk-FFMT6OCO.mjs +92 -0
  51. package/dist/chunk-FHTC2YDB.mjs +102 -0
  52. package/dist/chunk-FRST55HY.mjs +16 -0
  53. package/dist/chunk-HDFGCN2F.mjs +132 -0
  54. package/dist/chunk-IEGLX7VL.mjs +42 -0
  55. package/dist/chunk-ILUWFYGY.mjs +220 -0
  56. package/dist/chunk-IXOWSEHO.mjs +114 -0
  57. package/dist/chunk-J4RI2C2G.mjs +172 -0
  58. package/dist/chunk-J65DBT4R.mjs +13 -0
  59. package/dist/chunk-JGOVWSKH.mjs +179 -0
  60. package/dist/chunk-JO7VACY2.mjs +25 -0
  61. package/dist/chunk-JWFBOPM6.mjs +122 -0
  62. package/dist/chunk-KNDZP446.mjs +895 -0
  63. package/dist/chunk-KP2TWD4Z.mjs +90 -0
  64. package/dist/chunk-KQIFO5I3.mjs +225 -0
  65. package/dist/chunk-KVDEROP6.mjs +59 -0
  66. package/dist/chunk-LKC7MZKK.mjs +87 -0
  67. package/dist/chunk-LVMDQ4OJ.mjs +305 -0
  68. package/dist/chunk-M7B3JF43.mjs +90 -0
  69. package/dist/chunk-MTGMXRNF.mjs +136 -0
  70. package/dist/chunk-N3TIT3OH.mjs +1040 -0
  71. package/dist/chunk-NHRK5KU2.mjs +890 -0
  72. package/dist/chunk-NKUYIWAP.mjs +243 -0
  73. package/dist/chunk-NPDZLYIF.mjs +238 -0
  74. package/dist/chunk-O2X6FF45.mjs +499 -0
  75. package/dist/chunk-OGJ6IIBW.mjs +176 -0
  76. package/dist/chunk-OHGCZZPZ.mjs +403 -0
  77. package/dist/chunk-OWW3K55O.mjs +351 -0
  78. package/dist/chunk-OXTFAWSK.mjs +60 -0
  79. package/dist/chunk-PLSDU3C2.mjs +890 -0
  80. package/dist/chunk-PRDVPOZX.mjs +223 -0
  81. package/dist/chunk-Q6PPVIHU.mjs +21 -0
  82. package/dist/chunk-QQBXUDM4.mjs +885 -0
  83. package/dist/chunk-QS76E3TD.mjs +111 -0
  84. package/dist/chunk-QWQ6HY4I.mjs +209 -0
  85. package/dist/chunk-R6Y3R7EW.mjs +135 -0
  86. package/dist/chunk-RBLZRT5K.mjs +190 -0
  87. package/dist/chunk-RO4N6YFS.mjs +167 -0
  88. package/dist/chunk-RQ3CKQOX.mjs +984 -0
  89. package/dist/chunk-SALTGZFR.mjs +208 -0
  90. package/dist/chunk-SANZPAJ4.mjs +14 -0
  91. package/dist/chunk-SDBPQ5CF.mjs +624 -0
  92. package/dist/chunk-SSLTFJ3U.mjs +364 -0
  93. package/dist/chunk-SXHVDJGF.mjs +77 -0
  94. package/dist/chunk-TA4MVAEX.mjs +243 -0
  95. package/dist/chunk-TAHCOZHF.mjs +1772 -0
  96. package/dist/chunk-TQ6S34QZ.mjs +152 -0
  97. package/dist/chunk-UPRXABX5.mjs +90 -0
  98. package/dist/chunk-VGLSBZDN.mjs +71 -0
  99. package/dist/chunk-VN7CKCSE.mjs +364 -0
  100. package/dist/chunk-VVI3OBPJ.mjs +524 -0
  101. package/dist/chunk-VWF57TS3.mjs +62 -0
  102. package/dist/chunk-WA3OVISZ.mjs +179 -0
  103. package/dist/chunk-WCG35U6M.mjs +964 -0
  104. package/dist/chunk-WFTX4AQJ.mjs +194 -0
  105. package/dist/chunk-WFVOQ2QZ.mjs +18 -0
  106. package/dist/chunk-WH3C3Y7P.mjs +149 -0
  107. package/dist/chunk-WPFUV7K3.mjs +488 -0
  108. package/dist/chunk-WRULPWHD.mjs +492 -0
  109. package/dist/chunk-WS64BZXT.mjs +1 -0
  110. package/dist/chunk-WY4AURRE.mjs +2419 -0
  111. package/dist/chunk-WYLILAOO.mjs +167 -0
  112. package/dist/chunk-X4D7FKUS.mjs +62 -0
  113. package/dist/chunk-X7T34OLW.mjs +139 -0
  114. package/dist/chunk-XIHBK5D3.mjs +68 -0
  115. package/dist/chunk-XQQCGFYB.mjs +50 -0
  116. package/dist/chunk-XTVE4P3L.mjs +214 -0
  117. package/dist/chunk-XUAASRXW.mjs +579 -0
  118. package/dist/chunk-Y3L3D4GQ.mjs +685 -0
  119. package/dist/chunk-YBJ56XJS.mjs +132 -0
  120. package/dist/chunk-ZQFK6CAE.mjs +1 -0
  121. package/dist/chunk-ZT2Z7ERM.mjs +874 -0
  122. package/dist/chunk-ZTL2FQEW.mjs +714 -0
  123. package/dist/circular/arc/index.d.mts +8 -0
  124. package/dist/circular/arc/index.mjs +3 -0
  125. package/dist/circular/index.d.mts +44 -0
  126. package/dist/circular/index.mjs +13 -0
  127. package/dist/collect.utils-DiKB4ciO.d.mts +12 -0
  128. package/dist/computeChartState-BTVIqwyO.d.mts +304 -0
  129. package/dist/controller-BJE1AZ3q.d.mts +82 -0
  130. package/dist/controller-BoNigQJr.d.mts +63 -0
  131. package/dist/controllers/index.d.mts +16 -0
  132. package/dist/controllers/index.mjs +110 -0
  133. package/dist/datalabel.utils-CkjGeB8S.d.mts +122 -0
  134. package/dist/decimation.utils-CcvJVhI4.d.mts +244 -0
  135. package/dist/geometry-DUUQJXVM.d.mts +60 -0
  136. package/dist/index-DseIZa1j.d.mts +167 -0
  137. package/dist/index.d.mts +88 -0
  138. package/dist/index.mjs +110 -0
  139. package/dist/orchestrator/index.d.mts +264 -0
  140. package/dist/orchestrator/index.mjs +33 -0
  141. package/dist/plugins/index.d.mts +18 -0
  142. package/dist/plugins/index.mjs +1 -0
  143. package/dist/property-animations-D433wXzz.d.mts +580 -0
  144. package/dist/property-store-NORUWFND.d.mts +17 -0
  145. package/dist/radial/index.d.mts +14 -0
  146. package/dist/radial/index.mjs +37 -0
  147. package/dist/renderers/axis/index.d.mts +39 -0
  148. package/dist/renderers/axis/index.mjs +8 -0
  149. package/dist/renderers/circular/index.d.mts +13 -0
  150. package/dist/renderers/circular/index.mjs +13 -0
  151. package/dist/renderers/index.d.mts +83 -0
  152. package/dist/renderers/index.mjs +75 -0
  153. package/dist/renderers/navigator/index.d.mts +103 -0
  154. package/dist/renderers/navigator/index.mjs +8 -0
  155. package/dist/resize.utils-D_2qm6rv.d.mts +142 -0
  156. package/dist/ring.utils-DXvrxMkU.d.mts +138 -0
  157. package/dist/scale-KFv30jqZ.d.mts +307 -0
  158. package/dist/scales-Drf8AIhL.d.mts +75 -0
  159. package/dist/series/bar/canvas/index.d.mts +8 -0
  160. package/dist/series/bar/canvas/index.mjs +10 -0
  161. package/dist/series/bar/controller/index.d.mts +105 -0
  162. package/dist/series/bar/controller/index.mjs +44 -0
  163. package/dist/series/bar/controller-canvas/index.d.mts +7 -0
  164. package/dist/series/bar/controller-canvas/index.mjs +49 -0
  165. package/dist/series/bar/controller-svg/index.d.mts +7 -0
  166. package/dist/series/bar/controller-svg/index.mjs +49 -0
  167. package/dist/series/bar/index.d.mts +60 -0
  168. package/dist/series/bar/index.mjs +13 -0
  169. package/dist/series/bar/svg/index.d.mts +8 -0
  170. package/dist/series/bar/svg/index.mjs +11 -0
  171. package/dist/series/candlestick/canvas/index.d.mts +8 -0
  172. package/dist/series/candlestick/canvas/index.mjs +8 -0
  173. package/dist/series/candlestick/controller/index.d.mts +123 -0
  174. package/dist/series/candlestick/controller/index.mjs +40 -0
  175. package/dist/series/candlestick/controller-canvas/index.d.mts +7 -0
  176. package/dist/series/candlestick/controller-canvas/index.mjs +45 -0
  177. package/dist/series/candlestick/controller-svg/index.d.mts +7 -0
  178. package/dist/series/candlestick/controller-svg/index.mjs +45 -0
  179. package/dist/series/candlestick/index.d.mts +11 -0
  180. package/dist/series/candlestick/index.mjs +10 -0
  181. package/dist/series/candlestick/svg/index.d.mts +8 -0
  182. package/dist/series/candlestick/svg/index.mjs +8 -0
  183. package/dist/series/heatmap/canvas/index.d.mts +16 -0
  184. package/dist/series/heatmap/canvas/index.mjs +9 -0
  185. package/dist/series/heatmap/controller/index.d.mts +110 -0
  186. package/dist/series/heatmap/controller/index.mjs +23 -0
  187. package/dist/series/heatmap/controller-canvas/index.d.mts +7 -0
  188. package/dist/series/heatmap/controller-canvas/index.mjs +28 -0
  189. package/dist/series/heatmap/controller-svg/index.d.mts +7 -0
  190. package/dist/series/heatmap/controller-svg/index.mjs +28 -0
  191. package/dist/series/heatmap/index.d.mts +34 -0
  192. package/dist/series/heatmap/index.mjs +13 -0
  193. package/dist/series/heatmap/svg/index.d.mts +15 -0
  194. package/dist/series/heatmap/svg/index.mjs +10 -0
  195. package/dist/series/line/canvas/index.d.mts +6 -0
  196. package/dist/series/line/canvas/index.mjs +9 -0
  197. package/dist/series/line/controller/index.d.mts +111 -0
  198. package/dist/series/line/controller/index.mjs +47 -0
  199. package/dist/series/line/controller-canvas/index.d.mts +7 -0
  200. package/dist/series/line/controller-canvas/index.mjs +54 -0
  201. package/dist/series/line/controller-svg/index.d.mts +7 -0
  202. package/dist/series/line/controller-svg/index.mjs +54 -0
  203. package/dist/series/line/index.d.mts +49 -0
  204. package/dist/series/line/index.mjs +13 -0
  205. package/dist/series/line/svg/index.d.mts +6 -0
  206. package/dist/series/line/svg/index.mjs +9 -0
  207. package/dist/series/pie/canvas/index.d.mts +8 -0
  208. package/dist/series/pie/canvas/index.mjs +10 -0
  209. package/dist/series/pie/controller/index.d.mts +174 -0
  210. package/dist/series/pie/controller/index.mjs +110 -0
  211. package/dist/series/pie/controller-canvas/index.d.mts +8 -0
  212. package/dist/series/pie/controller-canvas/index.mjs +119 -0
  213. package/dist/series/pie/controller-svg/index.d.mts +8 -0
  214. package/dist/series/pie/controller-svg/index.mjs +118 -0
  215. package/dist/series/pie/index.d.mts +59 -0
  216. package/dist/series/pie/index.mjs +15 -0
  217. package/dist/series/pie/svg/index.d.mts +6 -0
  218. package/dist/series/pie/svg/index.mjs +11 -0
  219. package/dist/series/polar/canvas/index.d.mts +6 -0
  220. package/dist/series/polar/canvas/index.mjs +7 -0
  221. package/dist/series/polar/controller/index.d.mts +102 -0
  222. package/dist/series/polar/controller/index.mjs +46 -0
  223. package/dist/series/polar/controller-canvas/index.d.mts +8 -0
  224. package/dist/series/polar/controller-canvas/index.mjs +52 -0
  225. package/dist/series/polar/controller-svg/index.d.mts +8 -0
  226. package/dist/series/polar/controller-svg/index.mjs +52 -0
  227. package/dist/series/polar/index.d.mts +25 -0
  228. package/dist/series/polar/index.mjs +16 -0
  229. package/dist/series/polar/svg/index.d.mts +10 -0
  230. package/dist/series/polar/svg/index.mjs +8 -0
  231. package/dist/series/radar/canvas/index.d.mts +6 -0
  232. package/dist/series/radar/canvas/index.mjs +8 -0
  233. package/dist/series/radar/controller/index.d.mts +121 -0
  234. package/dist/series/radar/controller/index.mjs +43 -0
  235. package/dist/series/radar/controller-canvas/index.d.mts +8 -0
  236. package/dist/series/radar/controller-canvas/index.mjs +51 -0
  237. package/dist/series/radar/controller-svg/index.d.mts +8 -0
  238. package/dist/series/radar/controller-svg/index.mjs +51 -0
  239. package/dist/series/radar/index.d.mts +40 -0
  240. package/dist/series/radar/index.mjs +13 -0
  241. package/dist/series/radar/svg/index.d.mts +12 -0
  242. package/dist/series/radar/svg/index.mjs +9 -0
  243. package/dist/series/scatter/canvas/index.d.mts +8 -0
  244. package/dist/series/scatter/canvas/index.mjs +11 -0
  245. package/dist/series/scatter/controller/index.d.mts +124 -0
  246. package/dist/series/scatter/controller/index.mjs +44 -0
  247. package/dist/series/scatter/controller-canvas/index.d.mts +7 -0
  248. package/dist/series/scatter/controller-canvas/index.mjs +51 -0
  249. package/dist/series/scatter/controller-svg/index.d.mts +7 -0
  250. package/dist/series/scatter/controller-svg/index.mjs +51 -0
  251. package/dist/series/scatter/index.d.mts +25 -0
  252. package/dist/series/scatter/index.mjs +14 -0
  253. package/dist/series/scatter/svg/index.d.mts +8 -0
  254. package/dist/series/scatter/svg/index.mjs +12 -0
  255. package/dist/series/treemap/canvas/index.d.mts +50 -0
  256. package/dist/series/treemap/canvas/index.mjs +10 -0
  257. package/dist/series/treemap/controller/index.d.mts +130 -0
  258. package/dist/series/treemap/controller/index.mjs +20 -0
  259. package/dist/series/treemap/controller-canvas/index.d.mts +7 -0
  260. package/dist/series/treemap/controller-canvas/index.mjs +25 -0
  261. package/dist/series/treemap/controller-svg/index.d.mts +7 -0
  262. package/dist/series/treemap/controller-svg/index.mjs +25 -0
  263. package/dist/series/treemap/index.d.mts +15 -0
  264. package/dist/series/treemap/index.mjs +12 -0
  265. package/dist/series/treemap/svg/index.d.mts +15 -0
  266. package/dist/series/treemap/svg/index.mjs +9 -0
  267. package/dist/slices-DtewiwJx.d.mts +72 -0
  268. package/dist/spatialIndex.utils-B_GJkotZ.d.mts +5 -0
  269. package/dist/squarify.utils-B9CQBpa1.d.mts +50 -0
  270. package/dist/stacking-CChuAcLN.d.mts +319 -0
  271. package/dist/streaming.utils-DH-g1gNP.d.mts +49 -0
  272. package/dist/sync/index.d.mts +130 -0
  273. package/dist/sync/index.mjs +5 -0
  274. package/dist/tooltip.renderer-D5wpSlBa.d.mts +210 -0
  275. package/dist/utils/color/index.d.mts +58 -0
  276. package/dist/utils/color/index.mjs +4 -0
  277. package/dist/utils/data/index.d.mts +180 -0
  278. package/dist/utils/data/index.mjs +7 -0
  279. package/dist/utils/export/index.d.mts +14 -0
  280. package/dist/utils/export/index.mjs +6 -0
  281. package/dist/utils/index.d.mts +49 -0
  282. package/dist/utils/index.mjs +29 -0
  283. package/dist/utils/interaction/index.d.mts +255 -0
  284. package/dist/utils/interaction/index.mjs +9 -0
  285. package/dist/utils/layout/index.d.mts +3 -0
  286. package/dist/utils/layout/index.mjs +10 -0
  287. package/dist/utils/math/index.d.mts +162 -0
  288. package/dist/utils/math/index.mjs +1 -0
  289. package/dist/utils/render/index.d.mts +19 -0
  290. package/dist/utils/render/index.mjs +3 -0
  291. package/dist/utils/specialized/index.d.mts +37 -0
  292. package/dist/utils/specialized/index.mjs +66 -0
  293. package/dist/utils/text/index.d.mts +39 -0
  294. package/dist/utils/text/index.mjs +8 -0
  295. package/dist/utils/theme/index.d.mts +295 -0
  296. package/dist/utils/theme/index.mjs +5 -0
  297. package/dist/utils/zoom/index.d.mts +90 -0
  298. package/dist/utils/zoom/index.mjs +3 -0
  299. package/package.json +56 -0
@@ -0,0 +1,585 @@
1
+ import { resolveBackgroundColor, DARK_MODE_COLORS, LIGHT_MODE_COLORS } from './chunk-NKUYIWAP.mjs';
2
+ import { calculateLuminanceFromRGB } from './chunk-QS76E3TD.mjs';
3
+ import { resolveSwatchGradientStops } from './chunk-O2X6FF45.mjs';
4
+ import { parseColorToRGB } from './chunk-SSLTFJ3U.mjs';
5
+
6
+ // src/utils/export/svg-styles.ts
7
+ function inlineComputedStyles(element, rootStyles) {
8
+ if (element.nodeType !== Node.ELEMENT_NODE) return;
9
+ const tagName = element.tagName.toLowerCase();
10
+ if (["path", "rect", "circle", "ellipse", "line", "polyline", "polygon", "text", "tspan", "g"].includes(tagName)) {
11
+ const view = element.ownerDocument.defaultView;
12
+ if (!view) return;
13
+ const computed = view.getComputedStyle(element);
14
+ const svgEl = element;
15
+ const fillAttr = svgEl.getAttribute("fill");
16
+ if (fillAttr === "currentColor") {
17
+ svgEl.style.fill = rootStyles.textColor;
18
+ } else {
19
+ const fill = computed.fill;
20
+ if (fill && fill !== "none") {
21
+ svgEl.style.fill = fill;
22
+ }
23
+ }
24
+ const isText = tagName === "text" || tagName === "tspan";
25
+ if (isText && rootStyles.dropTextHalo) {
26
+ svgEl.style.stroke = "none";
27
+ } else {
28
+ const stroke = computed.stroke;
29
+ if (stroke && stroke !== "none") {
30
+ svgEl.style.stroke = stroke;
31
+ }
32
+ }
33
+ const strokeWidth = computed.strokeWidth;
34
+ if (strokeWidth && strokeWidth !== "0" && strokeWidth !== "0px") {
35
+ svgEl.style.strokeWidth = strokeWidth;
36
+ }
37
+ const opacity = computed.opacity;
38
+ if (opacity && opacity !== "1") {
39
+ svgEl.style.opacity = opacity;
40
+ }
41
+ }
42
+ if (["text", "tspan"].includes(tagName)) {
43
+ const view = element.ownerDocument.defaultView;
44
+ if (!view) return;
45
+ const computed = view.getComputedStyle(element);
46
+ const textEl = element;
47
+ const fontFamily = computed.fontFamily || rootStyles.fontFamily;
48
+ if (fontFamily) {
49
+ textEl.style.fontFamily = fontFamily;
50
+ }
51
+ const fontSize = computed.fontSize;
52
+ if (fontSize) {
53
+ textEl.style.fontSize = fontSize;
54
+ }
55
+ const fontWeight = computed.fontWeight;
56
+ if (fontWeight && fontWeight !== "normal" && fontWeight !== "400") {
57
+ textEl.style.fontWeight = fontWeight;
58
+ }
59
+ const textAnchor = textEl.getAttribute("text-anchor");
60
+ if (textAnchor) {
61
+ textEl.style.textAnchor = textAnchor;
62
+ }
63
+ const dominantBaseline = textEl.getAttribute("dominant-baseline");
64
+ if (dominantBaseline) {
65
+ textEl.style.dominantBaseline = dominantBaseline;
66
+ }
67
+ const fillRgb = parseColorToRGB(computed.fill);
68
+ if (fillRgb) {
69
+ const textLum = calculateLuminanceFromRGB(fillRgb.r, fillRgb.g, fillRgb.b);
70
+ const isLightText = textLum > 0.78;
71
+ const lowContrastWithBg = Math.abs(textLum - rootStyles.bgLuminance) < 0.25;
72
+ if (!isLightText && lowContrastWithBg) {
73
+ textEl.setAttribute("fill", rootStyles.textColor);
74
+ textEl.style.fill = rootStyles.textColor;
75
+ }
76
+ }
77
+ }
78
+ for (const child of element.children) {
79
+ inlineComputedStyles(child, rootStyles);
80
+ }
81
+ }
82
+ function isColorDark(color) {
83
+ const rgb = parseColorToRGB(color);
84
+ if (rgb) {
85
+ const luminance = calculateLuminanceFromRGB(rgb.r, rgb.g, rgb.b);
86
+ return luminance < 0.5;
87
+ }
88
+ return false;
89
+ }
90
+ function getTextColorForBackground(backgroundColor) {
91
+ if (backgroundColor === "transparent") {
92
+ return LIGHT_MODE_COLORS.text;
93
+ }
94
+ return isColorDark(backgroundColor) ? DARK_MODE_COLORS.text : LIGHT_MODE_COLORS.text;
95
+ }
96
+ function prepareSvgForExport(svg, width, height, backgroundColor, dropTextHalo = false) {
97
+ const clonedSvg = svg.cloneNode(true);
98
+ const view = svg.ownerDocument.defaultView;
99
+ const rootComputed = view ? view.getComputedStyle(svg) : { fontFamily: "", color: ""};
100
+ let textColor;
101
+ let bgLuminance;
102
+ if (backgroundColor === "transparent") {
103
+ const rootRgb = parseColorToRGB(rootComputed.color);
104
+ const isDarkMode = rootRgb ? calculateLuminanceFromRGB(rootRgb.r, rootRgb.g, rootRgb.b) > 0.5 : false;
105
+ textColor = isDarkMode ? DARK_MODE_COLORS.text : LIGHT_MODE_COLORS.text;
106
+ bgLuminance = isDarkMode ? 0 : 1;
107
+ } else {
108
+ textColor = getTextColorForBackground(backgroundColor);
109
+ const bgRgb = parseColorToRGB(backgroundColor);
110
+ bgLuminance = bgRgb ? calculateLuminanceFromRGB(bgRgb.r, bgRgb.g, bgRgb.b) : 1;
111
+ }
112
+ const rootStyles = {
113
+ fontFamily: rootComputed.fontFamily || "system-ui, -apple-system, sans-serif",
114
+ textColor,
115
+ dropTextHalo,
116
+ bgLuminance
117
+ };
118
+ clonedSvg.setAttribute("width", String(width));
119
+ clonedSvg.setAttribute("height", String(height));
120
+ if (backgroundColor !== "transparent") {
121
+ const bgRect = svg.ownerDocument.createElementNS("http://www.w3.org/2000/svg", "rect");
122
+ bgRect.setAttribute("width", "100%");
123
+ bgRect.setAttribute("height", "100%");
124
+ bgRect.setAttribute("fill", backgroundColor);
125
+ clonedSvg.insertBefore(bgRect, clonedSvg.firstChild);
126
+ }
127
+ clonedSvg.style.position = "absolute";
128
+ clonedSvg.style.left = "-9999px";
129
+ clonedSvg.style.top = "-9999px";
130
+ svg.ownerDocument.body.appendChild(clonedSvg);
131
+ inlineComputedStyles(clonedSvg, rootStyles);
132
+ svg.ownerDocument.body.removeChild(clonedSvg);
133
+ clonedSvg.style.position = "";
134
+ clonedSvg.style.left = "";
135
+ clonedSvg.style.top = "";
136
+ return clonedSvg;
137
+ }
138
+
139
+ // src/utils/export/dom.ts
140
+ function downloadFile(url, filename) {
141
+ if (typeof document === "undefined") return;
142
+ const link = document.createElement("a");
143
+ link.href = url;
144
+ link.download = filename;
145
+ document.body.appendChild(link);
146
+ link.click();
147
+ document.body.removeChild(link);
148
+ }
149
+ function getSvgElement(container) {
150
+ const svgs = Array.from(container.querySelectorAll("svg"));
151
+ return svgs.find((s) => s.getAttribute("aria-hidden") !== "true" && (typeof s.closest !== "function" || s.closest("button") === null)) ?? null;
152
+ }
153
+ function getCanvasElements(container) {
154
+ return Array.from(container.querySelectorAll("canvas"));
155
+ }
156
+ function createExportCanvas(width, height, scale, backgroundColor) {
157
+ if (typeof document === "undefined") throw new Error("createExportCanvas requires a browser environment");
158
+ const canvas = document.createElement("canvas");
159
+ canvas.width = width * scale;
160
+ canvas.height = height * scale;
161
+ const ctx = canvas.getContext("2d");
162
+ if (ctx && backgroundColor !== "transparent") {
163
+ ctx.fillStyle = backgroundColor;
164
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
165
+ }
166
+ return canvas;
167
+ }
168
+ async function renderSvgToCanvas(svg, canvas, width, height, backgroundColor, dropTextHalo = false) {
169
+ return new Promise((resolve, reject) => {
170
+ const ctx = canvas.getContext("2d");
171
+ if (!ctx) {
172
+ reject(new Error("Could not get canvas context"));
173
+ return;
174
+ }
175
+ const preparedSvg = prepareSvgForExport(svg, width, height, backgroundColor, dropTextHalo);
176
+ const serializer = new XMLSerializer();
177
+ const svgString = serializer.serializeToString(preparedSvg);
178
+ const blob = new Blob([svgString], { type: "image/svg+xml;charset=utf-8" });
179
+ const url = URL.createObjectURL(blob);
180
+ const img = new Image();
181
+ img.onload = () => {
182
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
183
+ URL.revokeObjectURL(url);
184
+ resolve();
185
+ };
186
+ img.onerror = () => {
187
+ URL.revokeObjectURL(url);
188
+ reject(new Error("Failed to load SVG image for export"));
189
+ };
190
+ img.src = url;
191
+ });
192
+ }
193
+ function copyCanvasToExport(sourceCanvas, exportCanvas) {
194
+ const ctx = exportCanvas.getContext("2d");
195
+ if (!ctx) return;
196
+ ctx.drawImage(sourceCanvas, 0, 0, exportCanvas.width, exportCanvas.height);
197
+ }
198
+
199
+ // src/utils/export/overlays.ts
200
+ function parseSwatchGradient(el) {
201
+ const raw = el.dataset?.chartGradient;
202
+ if (!raw) return null;
203
+ try {
204
+ const parsed = JSON.parse(raw);
205
+ return parsed && Array.isArray(parsed.stops) ? parsed : null;
206
+ } catch {
207
+ return null;
208
+ }
209
+ }
210
+ function escapeXml(s) {
211
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
212
+ }
213
+ function drawElementToCanvas(el, ctx, containerRect, scale) {
214
+ const rect = el.getBoundingClientRect();
215
+ const x = (rect.left - containerRect.left) * scale;
216
+ const y = (rect.top - containerRect.top) * scale;
217
+ const w = rect.width * scale;
218
+ const h = rect.height * scale;
219
+ if (w <= 0 || h <= 0) return;
220
+ const view = el.ownerDocument.defaultView;
221
+ if (!view) return;
222
+ const styles = view.getComputedStyle(el);
223
+ if (styles.visibility === "hidden" || styles.display === "none") return;
224
+ const opacity = parseFloat(styles.opacity);
225
+ ctx.save();
226
+ if (opacity < 1) {
227
+ ctx.globalAlpha = ctx.globalAlpha * opacity;
228
+ }
229
+ const gradientDef = parseSwatchGradient(el);
230
+ const gradientStops = gradientDef ? resolveSwatchGradientStops(gradientDef) : [];
231
+ const bg = styles.backgroundColor;
232
+ const hasBg = !!bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent";
233
+ if (gradientStops.length > 0 || hasBg) {
234
+ let fill = bg;
235
+ if (gradientStops.length > 0) {
236
+ let grad;
237
+ if (gradientDef.radialGradient) {
238
+ const cx = x + w / 2;
239
+ const cy = y + h / 2;
240
+ grad = ctx.createRadialGradient(cx, cy, 0, cx, cy, Math.max(w, h) / 2);
241
+ } else {
242
+ grad = ctx.createLinearGradient(x, y, x, y + h);
243
+ }
244
+ for (const s of gradientStops) {
245
+ grad.addColorStop(Math.min(1, Math.max(0, s.offset)), s.color);
246
+ }
247
+ fill = grad;
248
+ }
249
+ ctx.fillStyle = fill;
250
+ const br = parseFloat(styles.borderRadius) * scale;
251
+ if (br > 0 && typeof ctx.roundRect === "function") {
252
+ ctx.beginPath();
253
+ ctx.roundRect(x, y, w, h, br);
254
+ ctx.fill();
255
+ } else {
256
+ ctx.fillRect(x, y, w, h);
257
+ }
258
+ }
259
+ if (el.childElementCount === 0) {
260
+ const text = (el.textContent || "").trim();
261
+ if (text) {
262
+ const fontSize = parseFloat(styles.fontSize) * scale;
263
+ const paddingLeft = parseFloat(styles.paddingLeft) * scale;
264
+ const paddingRight = parseFloat(styles.paddingRight) * scale;
265
+ const fontStyle = styles.fontStyle !== "normal" ? `${styles.fontStyle} ` : "";
266
+ ctx.font = `${fontStyle}${styles.fontWeight} ${fontSize}px ${styles.fontFamily}`;
267
+ ctx.fillStyle = styles.color;
268
+ ctx.textBaseline = "middle";
269
+ const textAlign = styles.textAlign;
270
+ ctx.textAlign = textAlign || "left";
271
+ let textX;
272
+ switch (textAlign) {
273
+ case "center":
274
+ textX = x + w / 2;
275
+ break;
276
+ case "right":
277
+ case "end":
278
+ textX = x + w - paddingRight;
279
+ break;
280
+ default:
281
+ textX = x + paddingLeft;
282
+ }
283
+ ctx.fillText(text, textX, y + h / 2);
284
+ }
285
+ }
286
+ ctx.restore();
287
+ for (const child of el.children) {
288
+ drawElementToCanvas(child, ctx, containerRect, scale);
289
+ }
290
+ }
291
+ function drawHtmlOverlaysToCanvas(container, ctx, scale) {
292
+ const containerRect = container.getBoundingClientRect();
293
+ for (const selector of [".chart-title", ".chart-caption", ".chart-legend"]) {
294
+ const el = container.querySelector(selector);
295
+ if (el) {
296
+ drawElementToCanvas(el, ctx, containerRect, scale);
297
+ }
298
+ }
299
+ }
300
+ function generateSvgElementMarkup(el, containerRect, defs, idRef) {
301
+ const rect = el.getBoundingClientRect();
302
+ const x = rect.left - containerRect.left;
303
+ const y = rect.top - containerRect.top;
304
+ const w = rect.width;
305
+ const h = rect.height;
306
+ if (w <= 0 || h <= 0) return "";
307
+ const view = el.ownerDocument.defaultView;
308
+ if (!view) return "";
309
+ const styles = view.getComputedStyle(el);
310
+ if (styles.visibility === "hidden" || styles.display === "none") return "";
311
+ const opacity = parseFloat(styles.opacity);
312
+ const opacityAttr = opacity < 1 ? ` opacity="${opacity}"` : "";
313
+ let result = "";
314
+ const gradientDef = parseSwatchGradient(el);
315
+ const gradientStops = gradientDef ? resolveSwatchGradientStops(gradientDef) : [];
316
+ const bg = styles.backgroundColor;
317
+ const br = parseFloat(styles.borderRadius);
318
+ const rxAttr = br > 0 ? ` rx="${br}"` : "";
319
+ if (gradientStops.length > 0) {
320
+ const gradId = `p-chart-export-grad-${idRef.v++}`;
321
+ const stopEls = gradientStops.map((s) => `<stop offset="${Math.round(s.offset * 100)}%" stop-color="${s.color}"/>`).join("");
322
+ defs.push(gradientDef.radialGradient ? `<radialGradient id="${gradId}" cx="50%" cy="50%" r="50%">${stopEls}</radialGradient>` : `<linearGradient id="${gradId}" x1="0" y1="0" x2="0" y2="1">${stopEls}</linearGradient>`);
323
+ result += `<rect x="${x}" y="${y}" width="${w}" height="${h}" fill="url(#${gradId})"${rxAttr}${opacityAttr}/>`;
324
+ } else if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
325
+ result += `<rect x="${x}" y="${y}" width="${w}" height="${h}" fill="${bg}"${rxAttr}${opacityAttr}/>`;
326
+ }
327
+ if (el.childElementCount === 0) {
328
+ const text = (el.textContent || "").trim();
329
+ if (text) {
330
+ const fontSize = parseFloat(styles.fontSize);
331
+ const paddingLeft = parseFloat(styles.paddingLeft);
332
+ const paddingRight = parseFloat(styles.paddingRight);
333
+ const textAlign = styles.textAlign;
334
+ let textX;
335
+ let anchor;
336
+ const inLegend = typeof el.closest === "function" && el.closest(".chart-legend") !== null;
337
+ if (inLegend) {
338
+ textX = x + paddingLeft;
339
+ anchor = "start";
340
+ } else {
341
+ switch (textAlign) {
342
+ case "center":
343
+ textX = x + w / 2;
344
+ anchor = "middle";
345
+ break;
346
+ case "right":
347
+ case "end":
348
+ textX = x + w - paddingRight;
349
+ anchor = "end";
350
+ break;
351
+ default:
352
+ textX = x + paddingLeft;
353
+ anchor = "start";
354
+ }
355
+ }
356
+ const fontStyle = styles.fontStyle !== "normal" ? ` font-style="${styles.fontStyle}"` : "";
357
+ result += `<text x="${textX}" y="${y + h / 2}" dy="0.32em" font-size="${fontSize}" font-weight="${styles.fontWeight}"${fontStyle} font-family="${escapeXml(styles.fontFamily)}" fill="${styles.color}" text-anchor="${anchor}"${opacityAttr}>` + escapeXml(text) + `</text>`;
358
+ }
359
+ }
360
+ for (const child of el.children) {
361
+ result += generateSvgElementMarkup(child, containerRect, defs, idRef);
362
+ }
363
+ return result;
364
+ }
365
+ function generateHtmlOverlaySvgMarkup(container) {
366
+ const containerRect = container.getBoundingClientRect();
367
+ const defs = [];
368
+ const idRef = { v: 0 };
369
+ let markup = "";
370
+ for (const selector of [".chart-title", ".chart-caption", ".chart-legend"]) {
371
+ const el = container.querySelector(selector);
372
+ if (el) {
373
+ markup += generateSvgElementMarkup(el, containerRect, defs, idRef);
374
+ }
375
+ }
376
+ if (!markup) return "";
377
+ const defsBlock = defs.length > 0 ? `<defs>${defs.join("")}</defs>` : "";
378
+ return `<g class="chart-html-overlays">${defsBlock}${markup}</g>`;
379
+ }
380
+
381
+ // src/utils/export/pdf.ts
382
+ function base64ToUint8Array(base64) {
383
+ const binaryStr = atob(base64);
384
+ const bytes = new Uint8Array(binaryStr.length);
385
+ for (let i = 0; i < binaryStr.length; i++) {
386
+ bytes[i] = binaryStr.charCodeAt(i);
387
+ }
388
+ return bytes;
389
+ }
390
+ function uint8ArrayToBase64(bytes) {
391
+ let binaryStr = "";
392
+ const chunkSize = 8192;
393
+ for (let i = 0; i < bytes.length; i += chunkSize) {
394
+ const chunk = bytes.subarray(i, i + chunkSize);
395
+ binaryStr += String.fromCharCode(...chunk);
396
+ }
397
+ return btoa(binaryStr);
398
+ }
399
+ function buildPdfWithJpeg(jpegBytes, imagePxWidth, imagePxHeight, pageWidthPt, pageHeightPt) {
400
+ const enc = new TextEncoder();
401
+ const parts = [];
402
+ const offsets = [];
403
+ let pos = 0;
404
+ const push = (str) => {
405
+ const bytes = enc.encode(str);
406
+ parts.push(bytes);
407
+ pos += bytes.length;
408
+ };
409
+ const pushRaw = (bytes) => {
410
+ parts.push(bytes);
411
+ pos += bytes.length;
412
+ };
413
+ push("%PDF-1.4\n");
414
+ offsets[1] = pos;
415
+ push("1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n");
416
+ offsets[2] = pos;
417
+ push("2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n");
418
+ offsets[3] = pos;
419
+ push(`3 0 obj
420
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 ${pageWidthPt} ${pageHeightPt}] /Contents 4 0 R /Resources << /XObject << /img 5 0 R >> >> >>
421
+ endobj
422
+ `);
423
+ const contentStr = `q ${pageWidthPt} 0 0 ${pageHeightPt} 0 0 cm /img Do Q
424
+ `;
425
+ const contentBytes = enc.encode(contentStr);
426
+ offsets[4] = pos;
427
+ push(`4 0 obj
428
+ << /Length ${contentBytes.length} >>
429
+ stream
430
+ `);
431
+ pushRaw(contentBytes);
432
+ push("\nendstream\nendobj\n");
433
+ offsets[5] = pos;
434
+ push(`5 0 obj
435
+ << /Type /XObject /Subtype /Image /Width ${imagePxWidth} /Height ${imagePxHeight} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${jpegBytes.length} >>
436
+ stream
437
+ `);
438
+ pushRaw(jpegBytes);
439
+ push("\nendstream\nendobj\n");
440
+ const xrefOffset = pos;
441
+ push("xref\n");
442
+ push("0 6\n");
443
+ push("0000000000 65535 f \n");
444
+ for (let i = 1; i <= 5; i++) {
445
+ push(offsets[i].toString().padStart(10, "0") + " 00000 n \n");
446
+ }
447
+ push(`trailer
448
+ << /Size 6 /Root 1 0 R >>
449
+ startxref
450
+ ${xrefOffset}
451
+ %%EOF
452
+ `);
453
+ const total = parts.reduce((sum, p) => sum + p.length, 0);
454
+ const result = new Uint8Array(total);
455
+ let offset = 0;
456
+ for (const part of parts) {
457
+ result.set(part, offset);
458
+ offset += part.length;
459
+ }
460
+ return result;
461
+ }
462
+
463
+ // src/utils/export/create-exporter.ts
464
+ function createChartExporter(container, width, height, renderer) {
465
+ const toImage = async (options = {}) => {
466
+ const { format = "png", filename = "chart", quality = 0.92, scale = 2, backgroundColor = "auto", download = true } = options;
467
+ const resolvedBg = resolveBackgroundColor(container, backgroundColor);
468
+ let dataUrl;
469
+ let finalFilename;
470
+ if (format === "svg") {
471
+ const svg = renderer === "svg" ? getSvgElement(container) : null;
472
+ finalFilename = `${filename}.svg`;
473
+ let svgString;
474
+ if (svg) {
475
+ const preparedSvg = prepareSvgForExport(svg, width, height, resolvedBg, true);
476
+ const serializer = new XMLSerializer();
477
+ svgString = serializer.serializeToString(preparedSvg);
478
+ } else {
479
+ const canvases = getCanvasElements(container);
480
+ if (canvases.length === 0) {
481
+ throw new Error("No SVG or canvas element found in chart container.");
482
+ }
483
+ const compositeCanvas = createExportCanvas(width, height, 1, resolvedBg);
484
+ const compositeCtx = compositeCanvas.getContext("2d");
485
+ for (const c of canvases) {
486
+ compositeCtx.drawImage(c, 0, 0, compositeCanvas.width, compositeCanvas.height);
487
+ }
488
+ const pngDataUrl = compositeCanvas.toDataURL("image/png");
489
+ const bgRect = resolvedBg !== "transparent" ? `<rect width="100%" height="100%" fill="${resolvedBg}"/>` : "";
490
+ svgString = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${width}" height="${height}">` + bgRect + `<image href="${pngDataUrl}" width="${width}" height="${height}"/></svg>`;
491
+ }
492
+ const svgOverlayMarkup = generateHtmlOverlaySvgMarkup(container);
493
+ if (svgOverlayMarkup) {
494
+ const closeIdx = svgString.lastIndexOf("</svg>");
495
+ if (closeIdx !== -1) {
496
+ svgString = svgString.substring(0, closeIdx) + svgOverlayMarkup + "</svg>";
497
+ }
498
+ }
499
+ dataUrl = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svgString);
500
+ if (download) {
501
+ const blob = new Blob([svgString], { type: "image/svg+xml" });
502
+ const url = URL.createObjectURL(blob);
503
+ downloadFile(url, finalFilename);
504
+ URL.revokeObjectURL(url);
505
+ }
506
+ } else if (format === "pdf") {
507
+ const exportCanvas = createExportCanvas(width, height, scale, resolvedBg);
508
+ if (renderer === "svg") {
509
+ const svg = getSvgElement(container);
510
+ if (svg) {
511
+ await renderSvgToCanvas(svg, exportCanvas, width, height, resolvedBg, true);
512
+ }
513
+ } else {
514
+ for (const c of getCanvasElements(container)) {
515
+ copyCanvasToExport(c, exportCanvas);
516
+ }
517
+ }
518
+ const pdfOverlayCtx = exportCanvas.getContext("2d");
519
+ if (pdfOverlayCtx) {
520
+ drawHtmlOverlaysToCanvas(container, pdfOverlayCtx, scale);
521
+ }
522
+ const jpegDataUrl = exportCanvas.toDataURL("image/jpeg", quality);
523
+ const jpegBase64 = jpegDataUrl.replace(/^data:image\/jpeg;base64,/, "");
524
+ const jpegBytes = base64ToUint8Array(jpegBase64);
525
+ const pageWidthPt = Math.round(width * 0.75);
526
+ const pageHeightPt = Math.round(height * 0.75);
527
+ const pdfBytes = buildPdfWithJpeg(jpegBytes, exportCanvas.width, exportCanvas.height, pageWidthPt, pageHeightPt);
528
+ dataUrl = `data:application/pdf;base64,${uint8ArrayToBase64(pdfBytes)}`;
529
+ finalFilename = `${filename}.pdf`;
530
+ if (download) {
531
+ const blobUrl = URL.createObjectURL(new Blob([pdfBytes.buffer], { type: "application/pdf" }));
532
+ downloadFile(blobUrl, finalFilename);
533
+ URL.revokeObjectURL(blobUrl);
534
+ }
535
+ } else {
536
+ const exportCanvas = createExportCanvas(width, height, scale, resolvedBg);
537
+ if (renderer === "svg") {
538
+ const svg = getSvgElement(container);
539
+ if (svg) {
540
+ await renderSvgToCanvas(svg, exportCanvas, width, height, resolvedBg, true);
541
+ }
542
+ } else {
543
+ for (const c of getCanvasElements(container)) {
544
+ copyCanvasToExport(c, exportCanvas);
545
+ }
546
+ }
547
+ const rasterOverlayCtx = exportCanvas.getContext("2d");
548
+ if (rasterOverlayCtx) {
549
+ drawHtmlOverlaysToCanvas(container, rasterOverlayCtx, scale);
550
+ }
551
+ const mimeType = format === "jpeg" ? "image/jpeg" : "image/png";
552
+ dataUrl = exportCanvas.toDataURL(mimeType, quality);
553
+ finalFilename = `${filename}.${format}`;
554
+ if (download) {
555
+ downloadFile(dataUrl, finalFilename);
556
+ }
557
+ }
558
+ return { dataUrl, filename: finalFilename, format };
559
+ };
560
+ const toDataURL = async (format = "png") => {
561
+ const result = await toImage({ format, download: false });
562
+ return result.dataUrl;
563
+ };
564
+ const toBlob = async (format = "png") => {
565
+ const result = await toImage({ format, download: false });
566
+ if (format === "svg") {
567
+ const svgContent = decodeURIComponent(result.dataUrl.replace("data:image/svg+xml;charset=utf-8,", ""));
568
+ return new Blob([svgContent], { type: "image/svg+xml" });
569
+ }
570
+ if (format === "pdf") {
571
+ const base64 = result.dataUrl.replace("data:application/pdf;base64,", "");
572
+ const bytes = base64ToUint8Array(base64);
573
+ return new Blob([bytes.buffer], { type: "application/pdf" });
574
+ }
575
+ const response = await fetch(result.dataUrl);
576
+ return response.blob();
577
+ };
578
+ return {
579
+ toImage,
580
+ toDataURL,
581
+ toBlob
582
+ };
583
+ }
584
+
585
+ export { createChartExporter };