@orangelogic/design-system 2.69.0 → 2.70.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 (220) hide show
  1. package/library/chunks/AxisLabelRadial.BTpA5dYy.js +11 -0
  2. package/library/chunks/BaseColumnSeries.hIO71GLG.js +304 -0
  3. package/library/chunks/CandlestickSeries.w9C0GR9v.js +362 -0
  4. package/library/chunks/Circle.tOnnO-F-.js +17 -0
  5. package/library/chunks/ColumnSeries.Ckz75x1M.js +54 -0
  6. package/library/chunks/EditableAxisLabel.CCMTJT7K.js +445 -0
  7. package/library/chunks/EditableLabel.DPmicdjK.js +119 -0
  8. package/library/chunks/Gradient.BrDBLm8v.js +40 -0
  9. package/library/chunks/LinearGradient.CxfXxvMw.js +37 -0
  10. package/library/chunks/MonotoneXTension.CJMEHHj3.js +139 -0
  11. package/library/chunks/Picture.BNASYM-P.js +49 -0
  12. package/library/chunks/Polygon.Dr-GV2hn.js +70 -0
  13. package/library/chunks/ProgressPie.4mPA6xqm.js +234 -0
  14. package/library/chunks/RadialLabel.HfsGiN4x.js +88 -0
  15. package/library/chunks/Scrollbar.Bgg-RhjP.js +118 -0
  16. package/library/chunks/Slice.Dm56LTKj.js +120 -0
  17. package/library/chunks/Slider.FKJwoPq2.js +19 -0
  18. package/library/chunks/SpriteResizer.-qJDgug8.js +446 -0
  19. package/library/chunks/Triangle.BECgi7mc.js +21 -0
  20. package/library/chunks/ZoomTools.cgwuIB0e.js +199 -0
  21. package/library/chunks/___vite-browser-external_commonjs-proxy.C2tf3HsQ.js +8 -0
  22. package/library/chunks/{_baseUniq.Df-fLIBx.js → _baseUniq.BUihBa8c.js} +56 -53
  23. package/library/chunks/{_commonjsHelpers.ByX85dGu.js → _commonjsHelpers.DQNKXVTB.js} +2 -2
  24. package/library/chunks/accessors.BHk36ecy.js +11 -0
  25. package/library/chunks/am-chart.oZVBmpnn.js +18435 -0
  26. package/library/chunks/{animation.DfUHRQry.js → animation.DU8t6mrk.js} +1 -1
  27. package/library/chunks/{button.SoX-7UYy.js → button.CAAJPQFu.js} +3 -3
  28. package/library/chunks/{capitalize.WSkCXkNE.js → capitalize.CNStXZBq.js} +1 -1
  29. package/library/chunks/cardinal.BCA_LB0u.js +64 -0
  30. package/library/chunks/{color-swatch-group.Dx1fbSJx.js → color-swatch-group.CKHyWM8K.js} +6 -6
  31. package/library/chunks/{color-swatch.B7XXHxx1.js → color-swatch.BkpPCXd6.js} +2 -2
  32. package/library/chunks/colorPicker.C4w_vDjh.js +527 -0
  33. package/library/chunks/{confirm-popover.327ATuQH.js → confirm-popover.ZD74yDWw.js} +3 -3
  34. package/library/chunks/{content-builder.Bxi6k2LA.js → content-builder.B4Tqoc6M.js} +40 -34
  35. package/library/chunks/{cropper.BraEEykE.js → cropper.CQB3_qqG.js} +6937 -6935
  36. package/library/chunks/{dialog.eN3RUbwx.js → dialog.qSV5AjOE.js} +2 -2
  37. package/library/chunks/{dom.CZrJ64Dm.js → dom.BQVKDNd8.js} +1 -1
  38. package/library/chunks/{dot-pagination.Bek4w4zz.js → dot-pagination.BN_0ljfc.js} +2 -2
  39. package/library/chunks/exporting.BdjsEGF8.js +1407 -0
  40. package/library/chunks/{file-on-demand.BiC4cymk.js → file-on-demand.CXE4zf0J.js} +448 -386
  41. package/library/chunks/flow.D0FqdfOy.js +1594 -0
  42. package/library/chunks/{folder-select.DVEFgexx.js → folder-select.CPALQK22.js} +4 -4
  43. package/library/chunks/{form.CO12-VK0.js → form.DgwYWi0O.js} +1 -1
  44. package/library/chunks/gantt.DfUM7Gvb.js +2459 -0
  45. package/library/chunks/{header.Da5yvwdy.js → header.DXZ_5gLY.js} +2 -2
  46. package/library/chunks/hierarchy.5kfBCoGt.js +3561 -0
  47. package/library/chunks/{hub-connection.CfARlehM.js → hub-connection.Ot2odiCz.js} +1 -1
  48. package/library/chunks/{i18n.BMRLOAZR.js → i18n.C0iakJkV.js} +19 -11
  49. package/library/chunks/{iframe.BJizUE1A.js → iframe.BlzVfeBc.js} +2 -2
  50. package/library/chunks/{image.bndP5q2c.js → image.B3WjaCXP.js} +2 -2
  51. package/library/chunks/index.BkoLctE9.js +533 -0
  52. package/library/chunks/index.CZJTjkLp.js +142 -0
  53. package/library/chunks/{index.Bhnf0N8Q.js → index.CmVKj_wl.js} +7 -7
  54. package/library/chunks/index.DU0XUO4k.js +176 -0
  55. package/library/chunks/index.DcjJFMlq.js +1520 -0
  56. package/library/chunks/isObjectLike.z36Fu426.js +34 -0
  57. package/library/chunks/{isSymbol.huJ_Cvxt.js → isSymbol.L0C2ND_U.js} +1 -1
  58. package/library/chunks/json.BjaT7cyo.js +119 -0
  59. package/library/chunks/{list-editor.Du1h2Ms0.js → list-editor.CIAAFPco.js} +251 -222
  60. package/library/chunks/map.DbgNAGxD.js +3037 -0
  61. package/library/chunks/markerjs2.esm.B_9kjmye.js +1912 -0
  62. package/library/chunks/{option.Ce_wlnZj.js → option.ByVbmxUQ.js} +2 -2
  63. package/library/chunks/{pagination.DXu-mFAk.js → pagination.DPQn2fKX.js} +4 -4
  64. package/library/chunks/pdfmake.Bs7cMDH0.js +41224 -0
  65. package/library/chunks/percent.DO4FjAdu.js +902 -0
  66. package/library/chunks/{purify.es.BGaRrCfO.js → purify.es.BIuh5IAZ.js} +115 -115
  67. package/library/chunks/radar.Dd5fJVMg.js +789 -0
  68. package/library/chunks/{responsive.DgQTIrna.js → responsive.DL-wBD4P.js} +1 -1
  69. package/library/chunks/sliceGrouper.DA3aeuJ-.js +93 -0
  70. package/library/chunks/stock.BfI5MUyK.js +12684 -0
  71. package/library/chunks/{string.Cp_XNbnV.js → string.B_rEG27K.js} +1 -1
  72. package/library/chunks/{tab-group.B2pW__9H.js → tab-group.1h51o_Ly.js} +4 -4
  73. package/library/chunks/{table.5eWm9FfN.js → table.wVHv1Xze.js} +348 -327
  74. package/library/chunks/timeline.BxMLjB5J.js +837 -0
  75. package/library/chunks/timer.B39XOBYL.js +123 -0
  76. package/library/chunks/{toString.CRT5zqEU.js → toString.CL_lYXbK.js} +3 -3
  77. package/library/chunks/transform.BuqENXeT.js +50 -0
  78. package/library/chunks/{tree.Zls5YZ8z.js → tree.Bx0IGsWm.js} +2 -2
  79. package/library/chunks/venn.CxFupTb9.js +966 -0
  80. package/library/chunks/vfs_fonts.VJpdcrR6.js +9 -0
  81. package/library/chunks/watch.BCJD77bD.js +547 -0
  82. package/library/chunks/wc.ThQubbN2.js +255 -0
  83. package/library/chunks/xlsx.v-qkA-dg.js +25118 -0
  84. package/library/chunks/xy.q6e68du3.js +333 -0
  85. package/library/components/alert.js +2 -2
  86. package/library/components/am-chart.d.ts +3 -0
  87. package/library/components/am-chart.js +11 -0
  88. package/library/components/animated-image.js +1 -1
  89. package/library/components/animation.js +2 -2
  90. package/library/components/array-line-clamp.js +1 -1
  91. package/library/components/asset-link-format.js +7 -7
  92. package/library/components/atoms.js +166 -162
  93. package/library/components/avatar.js +1 -1
  94. package/library/components/border-input-group.js +1 -1
  95. package/library/components/breadcrumb-item.js +1 -1
  96. package/library/components/breadcrumb.js +1 -1
  97. package/library/components/button.js +4 -4
  98. package/library/components/checkbox.js +2 -2
  99. package/library/components/color-picker.js +4 -4
  100. package/library/components/color-swatch-group.js +7 -7
  101. package/library/components/color-swatch.js +3 -3
  102. package/library/components/confirm-popover.js +4 -4
  103. package/library/components/copy-button.js +2 -2
  104. package/library/components/corner-position-input-group.js +2 -2
  105. package/library/components/cropper.js +1 -1
  106. package/library/components/details.js +3 -2
  107. package/library/components/dialog.js +3 -3
  108. package/library/components/divider.js +1 -1
  109. package/library/components/dot-pagination.js +3 -3
  110. package/library/components/drawer.js +3 -3
  111. package/library/components/dropdown.js +2 -2
  112. package/library/components/dynamic-select.js +32 -30
  113. package/library/components/e-chart.d.ts +3 -0
  114. package/library/components/e-chart.js +47908 -0
  115. package/library/components/element-clamp.js +3 -3
  116. package/library/components/file-on-demand.js +10 -10
  117. package/library/components/folder-select.js +4 -4
  118. package/library/components/format-bytes.js +1 -1
  119. package/library/components/format-date.js +1 -1
  120. package/library/components/format-number.js +1 -1
  121. package/library/components/format-time.js +2 -2
  122. package/library/components/grid-item.js +1 -1
  123. package/library/components/header.js +3 -3
  124. package/library/components/hub-connection.js +2 -2
  125. package/library/components/icon-button.js +1 -1
  126. package/library/components/icon.js +1 -1
  127. package/library/components/iframe.js +3 -3
  128. package/library/components/image-comparer.js +2 -2
  129. package/library/components/image.js +3 -3
  130. package/library/components/include.js +1 -1
  131. package/library/components/input.js +3 -3
  132. package/library/components/line-clamp.js +1 -1
  133. package/library/components/list-editor.js +11 -8
  134. package/library/components/markdown.js +2 -2
  135. package/library/components/masonry.js +2 -2
  136. package/library/components/menu-item.js +2 -2
  137. package/library/components/menu.js +1 -1
  138. package/library/components/molecules.js +5 -5
  139. package/library/components/mutation-observer.js +1 -1
  140. package/library/components/option.js +3 -3
  141. package/library/components/organisms.js +2 -2
  142. package/library/components/pagination.js +5 -5
  143. package/library/components/popup.js +1 -1
  144. package/library/components/position-picker.js +1 -1
  145. package/library/components/progress-bar.js +1 -1
  146. package/library/components/progress-ring.js +1 -1
  147. package/library/components/qr-code.js +1 -1
  148. package/library/components/radio-button.js +1 -1
  149. package/library/components/radio-card.js +1 -1
  150. package/library/components/radio-group.js +2 -2
  151. package/library/components/radio.js +1 -1
  152. package/library/components/range.js +3 -3
  153. package/library/components/rating.js +2 -2
  154. package/library/components/relative-time.js +1 -1
  155. package/library/components/resize-observer.js +1 -1
  156. package/library/components/select.js +4 -4
  157. package/library/components/share-option-list.js +3 -3
  158. package/library/components/sidebar.js +1 -1
  159. package/library/components/size-input-group.js +2 -2
  160. package/library/components/spinner.js +1 -1
  161. package/library/components/split-panel.js +2 -2
  162. package/library/components/stepper.js +1 -1
  163. package/library/components/switch.js +2 -2
  164. package/library/components/tab-group.js +5 -5
  165. package/library/components/tab-panel.js +1 -1
  166. package/library/components/tab.js +2 -2
  167. package/library/components/table.js +5 -5
  168. package/library/components/tag.js +1 -1
  169. package/library/components/textarea.js +2 -2
  170. package/library/components/timecode.js +2 -2
  171. package/library/components/tooltip.js +2 -2
  172. package/library/components/tree-item.js +3 -3
  173. package/library/components/tree.js +3 -3
  174. package/library/components/typeface.js +2 -2
  175. package/library/components/types.js +27684 -27970
  176. package/library/components/video.js +1107 -1110
  177. package/library/package.json +1 -1
  178. package/library/packages/atoms/src/components/am-chart/am-chart.d.ts +45 -0
  179. package/library/packages/atoms/src/components/am-chart/am-chart.styles.d.ts +2 -0
  180. package/library/packages/atoms/src/components/am-chart/am-chart.utils.d.ts +23 -0
  181. package/library/packages/atoms/src/components/e-chart/e-chart-controller.d.ts +30 -0
  182. package/library/packages/atoms/src/components/e-chart/e-chart.d.ts +38 -0
  183. package/library/packages/atoms/src/components/e-chart/e-chart.styles.d.ts +2 -0
  184. package/library/packages/atoms/src/components/table/table.d.ts +21 -0
  185. package/library/packages/atoms/src/components/table/tabulator-tables/core/Tabulator.d.ts +1 -0
  186. package/library/packages/atoms/src/components/table/tabulator-tables/core/tools/DataLoader.d.ts +3 -1
  187. package/library/packages/atoms/src/index.d.ts +2 -0
  188. package/library/packages/events/src/cx-chart-plan-change.d.ts +10 -0
  189. package/library/packages/events/src/cx-dashboard-filter-change.d.ts +6 -0
  190. package/library/packages/events/src/cx-dashboard-table-load-more.d.ts +9 -0
  191. package/library/packages/events/src/cx-e-chart-drill-down.d.ts +16 -0
  192. package/library/packages/events/src/events.d.ts +4 -0
  193. package/library/packages/molecules/src/index.d.ts +1 -0
  194. package/library/packages/molecules/src/list-editor/list-editor.d.ts +7 -0
  195. package/library/packages/molecules/src/stat-card/stat-card.d.ts +81 -0
  196. package/library/packages/molecules/src/stat-card/stat-card.styles.d.ts +2 -0
  197. package/library/packages/molecules/src/storybook/storybook.d.ts +1 -0
  198. package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +1 -1
  199. package/library/packages/organisms/src/content-builder/components/chart-plan-builder/chart-plan-builder.d.ts +88 -0
  200. package/library/packages/organisms/src/content-builder/components/chart-plan-builder/chart-plan-builder.styles.d.ts +2 -0
  201. package/library/packages/organisms/src/content-builder/components/chart-plan-builder/chart-plan-schema.d.ts +100 -0
  202. package/library/packages/organisms/src/content-builder/styleController.d.ts +2 -2
  203. package/library/packages/organisms/src/dashboard-filter/dashboard-filter.d.ts +83 -0
  204. package/library/packages/organisms/src/dashboard-filter/dashboard-filter.styles.d.ts +2 -0
  205. package/library/packages/organisms/src/dashboard-table/dashboard-table.d.ts +45 -0
  206. package/library/packages/organisms/src/dashboard-table/dashboard-table.styles.d.ts +2 -0
  207. package/library/packages/organisms/src/index.d.ts +3 -0
  208. package/library/packages/services/src/api/endpoints.d.ts +3 -0
  209. package/library/packages/types/src/am-chart.d.ts +22 -0
  210. package/library/packages/types/src/content-builder.d.ts +1 -0
  211. package/library/packages/types/src/stat-card.d.ts +19 -0
  212. package/library/packages/types/src/table.d.ts +4 -0
  213. package/library/packages/utils/src/custom-element/i18n.d.ts +8 -0
  214. package/library/react-web-component.d.ts +280 -4
  215. package/library/utils.js +8 -8
  216. package/package.json +1 -1
  217. package/library/chunks/_baseRest.ClTMQtN1.js +0 -67
  218. package/library/chunks/identity.ByMq8VxU.js +0 -6
  219. package/library/chunks/isObjectLike.D3cpZO39.js +0 -81
  220. package/library/chunks/watch.q1sEjPWL.js +0 -501
@@ -0,0 +1,1407 @@
1
+ import { E as F, a7 as V, z as O, _ as f, e as S, a8 as H, a9 as z, aa as D, a as W, ab as N, f as U, ac as x, ad as I, ae as J, M as q, s as G, c as w, g as K, af as j, ag as Q, ah as $, ai as Y, C as Z, x as T } from "./am-chart.oZVBmpnn.js";
2
+ import { P as tt } from "./Picture.BNASYM-P.js";
3
+ let L;
4
+ function et() {
5
+ return f(this, void 0, void 0, function* () {
6
+ let h = yield Promise.all([
7
+ import(
8
+ /* webpackChunkName: "pdfmake" */
9
+ "./pdfmake.Bs7cMDH0.js"
10
+ ).then((i) => i.p),
11
+ import(
12
+ /* webpackChunkName: "pdfmake" */
13
+ "./vfs_fonts.VJpdcrR6.js"
14
+ )
15
+ ]), t = h[0].default, e = h[1].default;
16
+ const s = window;
17
+ return s.pdfMake = s.pdfMake || {}, s.pdfMake.vfs = e, t.vfs = e, t;
18
+ });
19
+ }
20
+ class P extends F {
21
+ //public extraImages: Array<Root | IExportingImageSource> = [];
22
+ //public dataSources: any[] = [];
23
+ _afterNew() {
24
+ super._afterNew(), this._setRawDefault("filePrefix", "chart"), this._setRawDefault("charset", "utf-8"), this._setRawDefault("numericFields", []), this._setRawDefault("dateFields", []), this._setRawDefault("durationFields", []), this._setRawDefault("extraImages", []), this._setRawDefault("pngOptions", { quality: 1, maintainPixelRatio: !1 }), this._setRawDefault("jpgOptions", { quality: 0.8, maintainPixelRatio: !1 }), this._setRawDefault("printOptions", { quality: 1, maintainPixelRatio: !1, delay: 500, printMethod: "iframe", imageFormat: "png" }), this._setRawDefault("jsonOptions", { indent: 2, renameFields: !0 }), this._setRawDefault("csvOptions", { separator: ",", addColumnNames: !0, emptyAs: "", addBOM: !0 }), this._setRawDefault("htmlOptions", { emptyAs: "-", addColumnNames: !0 }), this._setRawDefault("xlsxOptions", { emptyAs: "", addColumnNames: !0 }), this._setRawDefault("pdfOptions", { fontSize: 14, imageFormat: "png", align: "left", addURL: !0 }), this._setRawDefault("pdfdataOptions", { emptyAs: "", addColumnNames: !0 }), this._root.addDisposer(this);
25
+ }
26
+ _beforeChanged() {
27
+ if (super._beforeChanged(), this.isDirty("menu")) {
28
+ const t = this.get("menu");
29
+ t && (t.set("exporting", this), this._disposers.push(t));
30
+ }
31
+ }
32
+ _getFormatOptions(t, e) {
33
+ const s = V(this.get(t + "Options", {}));
34
+ return e && O(e, (i, n) => {
35
+ s[i] = n;
36
+ }), s;
37
+ }
38
+ /**
39
+ * Triggers a download of the chart/data in specific format.
40
+ *
41
+ * @param format Format
42
+ * @param customOptions Format options
43
+ */
44
+ download(t, e) {
45
+ return f(this, void 0, void 0, function* () {
46
+ const s = t == "pdfdata" ? "pdf" : t, i = this.get("filePrefix", "chart") + "." + s, n = this._getFormatOptions(t, e);
47
+ this.events.dispatch("downloadstarted", {
48
+ type: "downloadstarted",
49
+ format: t,
50
+ options: n,
51
+ fileName: i,
52
+ target: this
53
+ });
54
+ const o = yield this.export(t, n);
55
+ this.streamFile(o, i, n && n.addBOM);
56
+ });
57
+ }
58
+ /**
59
+ * Triggers print of the chart.
60
+ *
61
+ * @param customOptions Print options
62
+ */
63
+ print(t) {
64
+ return f(this, void 0, void 0, function* () {
65
+ const e = this._getFormatOptions("print", t);
66
+ this.events.dispatch("printstarted", {
67
+ type: "printstarted",
68
+ format: "print",
69
+ options: e,
70
+ target: this
71
+ });
72
+ const s = yield this.export(e.imageFormat || "png", e);
73
+ this.initiatePrint(s, e, this.get("title"));
74
+ });
75
+ }
76
+ /**
77
+ * Returns data uri of the chart/data in specific format.
78
+ *
79
+ * @param format Format
80
+ * @param customOptions Format options
81
+ * @return Promise
82
+ */
83
+ export(t, e) {
84
+ return f(this, void 0, void 0, function* () {
85
+ const s = this._getFormatOptions(t, e);
86
+ this.events.dispatch("exportstarted", {
87
+ type: "exportstarted",
88
+ format: t,
89
+ options: s,
90
+ target: this
91
+ });
92
+ let i = "";
93
+ switch (t) {
94
+ case "png":
95
+ case "jpg":
96
+ this._root._runTickerNow(), i = this.exportImage(t, s);
97
+ break;
98
+ case "json":
99
+ i = this.exportJSON(s);
100
+ break;
101
+ case "csv":
102
+ i = this.exportCSV(s);
103
+ break;
104
+ case "html":
105
+ i = this.exportHTML(s);
106
+ break;
107
+ case "xlsx":
108
+ i = this.exportXLSX(s);
109
+ break;
110
+ case "pdf":
111
+ this._root._runTickerNow(), i = this.exportPDF(s);
112
+ break;
113
+ case "pdfdata":
114
+ i = this.exportPDFData(s);
115
+ break;
116
+ }
117
+ return this.events.dispatch("exportfinished", {
118
+ type: "exportfinished",
119
+ format: t,
120
+ options: s,
121
+ target: this
122
+ }), i;
123
+ });
124
+ }
125
+ /**
126
+ * ==========================================================================
127
+ * Images
128
+ * ==========================================================================
129
+ */
130
+ /**
131
+ * Returns chart image as a data:uri.
132
+ *
133
+ * @param format Image format
134
+ * @param customOptions Format options
135
+ * @return Promise
136
+ */
137
+ exportImage(t, e) {
138
+ return f(this, void 0, void 0, function* () {
139
+ const s = this._getFormatOptions(t, e), i = yield this.getCanvas(s), n = i.toDataURL(this.getContentType(t), s.quality || 1);
140
+ return this.disposeCanvas(i), n;
141
+ });
142
+ }
143
+ /**
144
+ * Returns canvas data.
145
+ *
146
+ * @param customOptions Image options
147
+ * @return Promise
148
+ */
149
+ exportCanvas(t) {
150
+ return f(this, void 0, void 0, function* () {
151
+ const e = this._getFormatOptions("canvas", t), s = yield this.getCanvas(e), i = s.toDataURL(this.getContentType("canvas"), e.quality || 1);
152
+ return this.disposeCanvas(s), i;
153
+ });
154
+ }
155
+ /**
156
+ * Returns a `<canvas>` element with snapshot of the chart.
157
+ *
158
+ * @param options Image options
159
+ * @return Promise
160
+ */
161
+ getCanvas(t) {
162
+ return f(this, void 0, void 0, function* () {
163
+ const e = this._root._renderer.getCanvas(this._root._rootContainer._display, t), s = this.get("extraImages", []);
164
+ let i = 0, n = 0, o = e.width, a = e.height, p = 0, l = 0;
165
+ const r = [];
166
+ S(s, (m) => {
167
+ let g;
168
+ m instanceof H ? g = {
169
+ source: m,
170
+ position: "bottom"
171
+ } : g = m, g.position = g.position || "bottom", g.marginTop = g.marginTop || 0, g.marginRight = g.marginRight || 0, g.marginBottom = g.marginBottom || 0, g.marginLeft = g.marginLeft || 0;
172
+ const A = g.source._renderer.getCanvas(g.source._rootContainer._display, t), k = A.width + g.marginLeft + g.marginRight, R = A.height + g.marginTop + g.marginBottom;
173
+ g.position == "top" ? (o = g.crop ? a : Math.max(o, k), n += R) : g.position == "right" ? (a = g.crop ? a : Math.max(a, R), p += k) : g.position == "left" ? (a = g.crop ? a : Math.max(a, R), i += k) : g.position === "bottom" && (o = g.crop ? a : Math.max(o, k), l += R), r.push({
174
+ canvas: A,
175
+ position: g.position,
176
+ left: g.marginLeft,
177
+ top: g.marginTop,
178
+ width: k,
179
+ height: R
180
+ });
181
+ });
182
+ const d = this.getDisposableCanvas();
183
+ d.width = i + o + p, d.height = n + a + l;
184
+ const u = d.getContext("2d"), _ = this.get("backgroundColor", this.findBackgroundColor(this._root.dom)), b = this.get("backgroundOpacity", 1);
185
+ _ && (u.fillStyle = _.toCSS(b), u.fillRect(0, 0, d.width, d.height));
186
+ let v = i, C = n, c = v + o, y = C + a;
187
+ return S(r, (m) => {
188
+ m.position == "top" ? (C -= m.height, u.drawImage(m.canvas, i + m.left, C + m.top)) : m.position == "right" ? (u.drawImage(m.canvas, c + m.left, n + m.top), c += m.width) : m.position == "left" ? (v -= m.width, u.drawImage(m.canvas, v + m.left, n + m.top)) : m.position === "bottom" && (u.drawImage(m.canvas, i + m.left, y + m.top), y += m.height);
189
+ }), u.drawImage(e, i, n), d;
190
+ });
191
+ }
192
+ /**
193
+ * ==========================================================================
194
+ * JSON
195
+ * ==========================================================================
196
+ */
197
+ /**
198
+ * Returns a data:uri representation of a JSON file with chart data.
199
+ *
200
+ * @param customOptions Format options
201
+ * @return Promise
202
+ */
203
+ exportJSON(t) {
204
+ return f(this, void 0, void 0, function* () {
205
+ return "data:" + this.getContentType("json") + ";" + this.get("charset", "utf-8") + "," + encodeURIComponent(yield this.getJSON(t));
206
+ });
207
+ }
208
+ /**
209
+ * Returns data in JSON format.
210
+ *
211
+ * @param customOptions Format options
212
+ * @return Promise
213
+ */
214
+ getJSON(t) {
215
+ return f(this, void 0, void 0, function* () {
216
+ const e = this._getFormatOptions("json", t);
217
+ return JSON.stringify(this.getData("json", t, e.renameFields), (s, i) => (z(i) && O(i, (n, o) => {
218
+ i[n] = this.convertToSpecialFormat(n, o, e);
219
+ }), i), e.indent);
220
+ });
221
+ }
222
+ /**
223
+ * ==========================================================================
224
+ * CSV
225
+ * ==========================================================================
226
+ */
227
+ /**
228
+ * Returns a data:uri representation of a CSV file with chart data.
229
+ *
230
+ * @param customOptions Format options
231
+ * @return Promise
232
+ */
233
+ exportCSV(t) {
234
+ return f(this, void 0, void 0, function* () {
235
+ return "data:" + this.getContentType("csv") + ";" + this.get("charset", "utf-8") + "," + encodeURIComponent(yield this.getCSV(t));
236
+ });
237
+ }
238
+ /**
239
+ * Returns a CSV with export data.
240
+ *
241
+ * @param customOptions CSV options
242
+ * @return Promise
243
+ */
244
+ getCSV(t) {
245
+ return f(this, void 0, void 0, function* () {
246
+ const e = this._getFormatOptions("csv", t);
247
+ let s = "", i = "";
248
+ const n = this.getData("csv", e), o = this.getDataFields(n);
249
+ if (e.pivot) {
250
+ const a = this.get("dataFieldsOrder", []);
251
+ D(o, (p, l) => {
252
+ let r = [];
253
+ e.addColumnNames && r.push(l);
254
+ for (let d = n.length, u = 0; u < d; u++) {
255
+ let _ = n[u][p];
256
+ r.push(this.convertToSpecialFormat(p, _, e, !0));
257
+ }
258
+ s += i + this.getCSVRow(r, e, void 0, !0), i = `
259
+ `;
260
+ }, (p, l) => {
261
+ let r = a.indexOf(p), d = a.indexOf(l);
262
+ return r > d ? -1 : r < d ? 1 : 0;
263
+ });
264
+ } else {
265
+ for (let a = n.length, p = 0; p < a; p++) {
266
+ let l = this.getCSVRow(n[p], e, o);
267
+ e.reverse ? s = l + i + s : s += i + l, i = `
268
+ `;
269
+ }
270
+ e.addColumnNames && (s = this.getCSVRow(o, e, void 0, !0) + i + s);
271
+ }
272
+ return s;
273
+ });
274
+ }
275
+ /**
276
+ * @ignore
277
+ */
278
+ getCSVRow(t, e, s, i = !1) {
279
+ let n = e.separator || ",", o = [];
280
+ s || (s = {}, O(t, (p, l) => {
281
+ s[p] = l;
282
+ }));
283
+ const a = this.get("dataFieldsOrder", []);
284
+ return D(s, (p, l) => {
285
+ let r = this.convertEmptyValue(p, t[p], e), d = i ? r : this.convertToSpecialFormat(p, r, e);
286
+ d = "" + d, d = d.replace(/"/g, '""'), (e.forceQuotes || d.search(new RegExp(`"|
287
+ |` + n, "g")) >= 0) && (d = '"' + d + '"'), o.push(d);
288
+ }, (p, l) => {
289
+ let r = a.indexOf(p), d = a.indexOf(l);
290
+ return r > d ? 1 : r < d ? -1 : 0;
291
+ }), o.join(n);
292
+ }
293
+ /**
294
+ * ==========================================================================
295
+ * HTML
296
+ * ==========================================================================
297
+ */
298
+ /**
299
+ * Returns a data:uri representation of an HTML file with chart data.
300
+ *
301
+ * @param customOptions Format options
302
+ * @return Promise
303
+ */
304
+ exportHTML(t) {
305
+ return f(this, void 0, void 0, function* () {
306
+ return "data:" + this.getContentType("html") + ";" + this.get("charset", "utf-8") + "," + encodeURIComponent(yield this.getHTML(t));
307
+ });
308
+ }
309
+ /**
310
+ * Returns an HTML with a table with export data.
311
+ *
312
+ * @param customOptions HTML options
313
+ * @return Promise
314
+ */
315
+ getHTML(t) {
316
+ return f(this, void 0, void 0, function* () {
317
+ const e = this._getFormatOptions("html", t);
318
+ let s = "<table>";
319
+ e.tableClass && (s = '<table class="' + e.tableClass + '">');
320
+ const i = this.getData("html", e), n = this.getDataFields(i);
321
+ if (e.pivot) {
322
+ const o = this.get("dataFieldsOrder", []);
323
+ s += `
324
+ <tbody>`, D(n, (a, p) => {
325
+ let l = [];
326
+ e.addColumnNames && l.push(p);
327
+ for (let r = i.length, d = 0; d < r; d++) {
328
+ let u = i[d][a];
329
+ l.push(this.convertToSpecialFormat(a, u, e, !0));
330
+ }
331
+ s += `
332
+ ` + this.getHTMLRow(l, e, void 0, !0);
333
+ }, (a, p) => {
334
+ let l = o.indexOf(a), r = o.indexOf(p);
335
+ return l > r ? -1 : l < r ? 1 : 0;
336
+ }), s += `
337
+ </tbody>`;
338
+ } else {
339
+ e.addColumnNames && (s += `
340
+ <thead>
341
+ ` + this.getHTMLRow(n, e, void 0, !0, !0) + `
342
+ </thead>`), s += `
343
+ <tbody>`;
344
+ for (let o = i.length, a = 0; a < o; a++)
345
+ s += `
346
+ ` + this.getHTMLRow(i[a], e, n);
347
+ s += `
348
+ </tbody>`;
349
+ }
350
+ return s += `
351
+ </table>`, s;
352
+ });
353
+ }
354
+ /**
355
+ * @ignore
356
+ */
357
+ getHTMLRow(t, e, s, i = !1, n = !1) {
358
+ let o = " <tr>";
359
+ e.rowClass && (o = ' <tr class="' + e.rowClass + '">'), s || (s = t);
360
+ const a = this.get("dataFieldsOrder", []), p = n ? "th" : "td";
361
+ let l = !0;
362
+ return D(s, (r, d) => {
363
+ let u = this.convertEmptyValue(r, t[r], e), _ = i ? u : this.convertToSpecialFormat(r, u, e);
364
+ _ = "" + _, _ = _.replace(/[\u00A0-\u9999<>\&]/gim, function(v) {
365
+ return "&#" + v.charCodeAt(0) + ";";
366
+ });
367
+ let b = p;
368
+ e.pivot && l && (b = "th"), e.cellClass ? o += `
369
+ <` + b + ' class="' + e.cellClass + '">' + _ + "</" + b + ">" : o += `
370
+ <` + b + ">" + _ + "</" + b + ">", l = !1;
371
+ }, (r, d) => {
372
+ let u = a.indexOf(r), _ = a.indexOf(d);
373
+ return u > _ ? 1 : u < _ ? -1 : 0;
374
+ }), o += `
375
+ </tr>`, o;
376
+ }
377
+ /**
378
+ * ==========================================================================
379
+ * XLSX
380
+ * ==========================================================================
381
+ */
382
+ /**
383
+ * Returns a data:uri representation of an XLSX file with chart data.
384
+ *
385
+ * @param customOptions Format options
386
+ * @return Promise
387
+ */
388
+ exportXLSX(t) {
389
+ return f(this, void 0, void 0, function* () {
390
+ return "data:" + this.getContentType("xlsx") + ";" + this.get("charset", "utf-8") + "," + encodeURIComponent(yield this.getXLSX(t));
391
+ });
392
+ }
393
+ /**
394
+ * Returns a data:uri of XLSX data.
395
+ *
396
+ * @param customOptions Format options
397
+ * @return Promise
398
+ */
399
+ getXLSX(t) {
400
+ return f(this, void 0, void 0, function* () {
401
+ const e = this._getFormatOptions("xlsx", t);
402
+ let s = yield this.getXLSXLib(), i = {
403
+ bookType: "xlsx",
404
+ bookSST: !1,
405
+ type: "base64"
406
+ //dateNF: 'yyyy-mm-dd'
407
+ }, n = this._normalizeExcelSheetName(this.get("title", this._t("Data"))), o = {
408
+ SheetNames: [n],
409
+ Sheets: {}
410
+ }, a = [];
411
+ const p = this.getData("html", e), l = this.getDataFields(p);
412
+ if (e.pivot) {
413
+ const r = this.get("dataFieldsOrder", []);
414
+ D(l, (d, u) => {
415
+ let _ = [];
416
+ e.addColumnNames && _.push(u);
417
+ for (let b = p.length, v = 0; v < b; v++) {
418
+ let C = p[v][d];
419
+ _.push(this.convertToSpecialFormat(d, C, e, !0));
420
+ }
421
+ a.push(this.getXLSXRow(_, e, void 0, !0));
422
+ }, (d, u) => {
423
+ let _ = r.indexOf(d), b = r.indexOf(u);
424
+ return _ > b ? 1 : _ < b ? -1 : 0;
425
+ });
426
+ } else {
427
+ e.addColumnNames && a.push(this.getXLSXRow(l, e, void 0, !0));
428
+ for (let r = p.length, d = 0; d < r; d++)
429
+ a.push(this.getXLSXRow(p[d], e, l));
430
+ }
431
+ return o.Sheets[n] = s.utils.aoa_to_sheet(a), this.events.dispatch("workbookready", {
432
+ type: "workbookready",
433
+ format: "xlsx",
434
+ options: e,
435
+ workbook: o,
436
+ workbookOptions: i,
437
+ xlsx: s,
438
+ target: this
439
+ }), s.write(o, i);
440
+ });
441
+ }
442
+ _normalizeExcelSheetName(t) {
443
+ return t = t.replace(/([:\\\/?*\[\]]+)/g, " "), t.length > 30 ? t.substr(0, 30) + "..." : t;
444
+ }
445
+ /**
446
+ * @ignore
447
+ */
448
+ getXLSXRow(t, e, s, i = !1) {
449
+ let n = [];
450
+ s || (s = t);
451
+ const o = this.get("dataFieldsOrder", []);
452
+ return D(s, (a, p) => {
453
+ let l = this.convertEmptyValue(a, t[a], e), r = i ? l : this.convertToSpecialFormat(a, l, e, !0);
454
+ n.push(r);
455
+ }, (a, p) => {
456
+ let l = o.indexOf(a), r = o.indexOf(p);
457
+ return l > r ? 1 : l < r ? -1 : 0;
458
+ }), n;
459
+ }
460
+ /**
461
+ * @ignore
462
+ */
463
+ _xlsx() {
464
+ return f(this, void 0, void 0, function* () {
465
+ return yield import(
466
+ /* webpackChunkName: "xlsx" */
467
+ "./xlsx.v-qkA-dg.js"
468
+ );
469
+ });
470
+ }
471
+ /**
472
+ * @ignore
473
+ */
474
+ getXLSXLib() {
475
+ return this._xlsx();
476
+ }
477
+ /**
478
+ * ==========================================================================
479
+ * PDF
480
+ * ==========================================================================
481
+ */
482
+ /**
483
+ * Returns a data:uri representation of a PDF file with chart image.
484
+ *
485
+ * @param customOptions Format options
486
+ * @return Promise
487
+ */
488
+ exportPDF(t) {
489
+ return f(this, void 0, void 0, function* () {
490
+ return "data:" + this.getContentType("pdf") + ";" + this.get("charset", "utf-8") + "," + encodeURIComponent(yield this.getPDF(t, !0));
491
+ });
492
+ }
493
+ /**
494
+ * Returns a data:uri representation of a PDF file with chart data.
495
+ *
496
+ * @param customOptions Format options
497
+ * @return Promise
498
+ */
499
+ exportPDFData(t) {
500
+ return f(this, void 0, void 0, function* () {
501
+ return "data:" + this.getContentType("pdf") + ";" + this.get("charset", "utf-8") + "," + encodeURIComponent(yield this.getPDF(t, !1, !0));
502
+ });
503
+ }
504
+ /**
505
+ * Returns Base64-encoded binary data for a PDF file.
506
+ * @param customOptions PDF options
507
+ * @param includeImage Include chart snapshot
508
+ * @param includeData Include data
509
+ * @return Promise
510
+ */
511
+ getPDF(t, e = !0, s = !1) {
512
+ return f(this, void 0, void 0, function* () {
513
+ const i = this._getFormatOptions("pdf", t), n = this._getFormatOptions("pdfdata", t), o = i.pageOrientation || "portrait";
514
+ let a;
515
+ const p = {
516
+ width: 0,
517
+ height: 0
518
+ };
519
+ if (e) {
520
+ const c = i.imageFormat || "png", y = this._getFormatOptions(c, i), m = yield this.getCanvas(y);
521
+ p.width = m.clientWidth, p.height = m.clientHeight, a = m.toDataURL(this.getContentType(c), i.quality || 1), this.disposeCanvas(m);
522
+ }
523
+ const l = yield this.getPdfmake(), r = [30, 30, 30, 30];
524
+ let d = {
525
+ pageSize: i.pageSize || "A4",
526
+ pageOrientation: o,
527
+ pageMargins: i.pageMargins || r,
528
+ defaultStyle: {
529
+ font: i.font ? i.font.name : void 0
530
+ },
531
+ //header: <any>[],
532
+ content: []
533
+ };
534
+ const u = this.get("title");
535
+ let _ = 0;
536
+ if (u && (d.content.push({
537
+ text: u,
538
+ fontSize: i.fontSize || 14,
539
+ bold: !0,
540
+ margin: [0, 0, 0, 15]
541
+ }), _ += 50), i.addURL && (d.content.push({
542
+ text: this._t("Saved from") + ": " + document.location.href,
543
+ fontSize: i.fontSize,
544
+ margin: [0, 0, 0, 15]
545
+ }), _ += 50), e && a) {
546
+ const c = this.getPageSizeFit(d.pageSize, d.pageMargins, _, o);
547
+ p.width > c[0] || p.height > c[1] ? d.content.push({
548
+ image: a,
549
+ alignment: i.align || "left",
550
+ fit: c
551
+ }) : d.content.push({
552
+ image: a,
553
+ alignment: i.align || "left"
554
+ });
555
+ }
556
+ (s || i.includeData) && this.hasData() && d.content.push({
557
+ table: yield this.getPDFData(n),
558
+ fontSize: i.fontSize || 14
559
+ });
560
+ let b = null, v = null;
561
+ function C(c) {
562
+ const y = {};
563
+ y.normal = c.normal.path, v[c.normal.path] = c.normal.bytes, c.bold ? (y.bold = c.bold.path, v[c.bold.path] = c.bold.bytes) : y.bold = c.normal.path, c.italics ? (y.italics = c.italics.path, v[c.italics.path] = c.italics.bytes) : y.italics = c.normal.path, c.bolditalics ? (y.bolditalics = c.bolditalics.path, v[c.bolditalics.path] = c.bolditalics.bytes) : y.bolditalics = c.normal.path, b[c.name] = y;
564
+ }
565
+ return i.font && (b = {}, v = {}, C(i.font), i.extraFonts && S(i.extraFonts, C)), this.events.dispatch("pdfdocready", {
566
+ type: "pdfdocready",
567
+ format: "pdf",
568
+ options: i,
569
+ doc: d,
570
+ target: this
571
+ }), new Promise((c, y) => {
572
+ l.createPdf(d, null, b, v).getBase64((m) => {
573
+ c(m);
574
+ });
575
+ });
576
+ });
577
+ }
578
+ /**
579
+ * @ignore
580
+ */
581
+ getPDFData(t) {
582
+ return f(this, void 0, void 0, function* () {
583
+ const e = this._getFormatOptions("pdfdata", t);
584
+ let s = {
585
+ body: []
586
+ };
587
+ const i = this.getData("html", e), n = this.getDataFields(i);
588
+ if (e.pivot) {
589
+ const o = this.get("dataFieldsOrder", []);
590
+ D(n, (a, p) => {
591
+ let l = [];
592
+ e.addColumnNames && l.push(p);
593
+ for (let r = i.length, d = 0; d < r; d++) {
594
+ let u = i[d][a];
595
+ l.push(this.convertToSpecialFormat(a, u, e, !0));
596
+ }
597
+ s.body.push(this.getPDFDataRow(l, e, void 0, !0));
598
+ }, (a, p) => {
599
+ let l = o.indexOf(a), r = o.indexOf(p);
600
+ return l > r ? 1 : l < r ? -1 : 0;
601
+ });
602
+ } else {
603
+ e.addColumnNames && (s.body.push(this.getPDFDataRow(n, e, void 0, !0)), s.headerRows = 1);
604
+ for (let o = i.length, a = 0; a < o; a++)
605
+ s.body.push(this.getPDFDataRow(i[a], e, n));
606
+ }
607
+ return s;
608
+ });
609
+ }
610
+ /**
611
+ * @ignore
612
+ */
613
+ getPDFDataRow(t, e, s, i = !1) {
614
+ let n = [];
615
+ s || (s = t);
616
+ const o = this.get("dataFieldsOrder", []);
617
+ return D(s, (a, p) => {
618
+ let l = this.convertEmptyValue(a, t[a], e), r = i ? l : this.convertToSpecialFormat(a, l, e);
619
+ r = "" + r, n.push(r);
620
+ }, (a, p) => {
621
+ let l = o.indexOf(a), r = o.indexOf(p);
622
+ return l > r ? 1 : l < r ? -1 : 0;
623
+ }), n;
624
+ }
625
+ /**
626
+ * Returns pdfmake instance.
627
+ *
628
+ * @ignore
629
+ * @return Instance of pdfmake
630
+ */
631
+ getPdfmake() {
632
+ return L === void 0 && (L = et()), L;
633
+ }
634
+ /**
635
+ * @ignore
636
+ */
637
+ getPageSizeFit(t, e, s = 0, i = "portrait") {
638
+ let n = [0, 0, 0, 0];
639
+ W(e) ? n = [e, e, e, e] : e.length == 2 ? n = [e[0], e[1], e[0], e[1]] : e.length == 4 && (n = e);
640
+ let a = {
641
+ "4A0": [4767.87, 6740.79],
642
+ "2A0": [3370.39, 4767.87],
643
+ A0: [2383.94, 3370.39],
644
+ A1: [1683.78, 2383.94],
645
+ A2: [1190.55, 1683.78],
646
+ A3: [841.89, 1190.55],
647
+ A4: [595.28, 841.89],
648
+ A5: [419.53, 595.28],
649
+ A6: [297.64, 419.53],
650
+ A7: [209.76, 297.64],
651
+ A8: [147.4, 209.76],
652
+ A9: [104.88, 147.4],
653
+ A10: [73.7, 104.88],
654
+ B0: [2834.65, 4008.19],
655
+ B1: [2004.09, 2834.65],
656
+ B2: [1417.32, 2004.09],
657
+ B3: [1000.63, 1417.32],
658
+ B4: [708.66, 1000.63],
659
+ B5: [498.9, 708.66],
660
+ B6: [354.33, 498.9],
661
+ B7: [249.45, 354.33],
662
+ B8: [175.75, 249.45],
663
+ B9: [124.72, 175.75],
664
+ B10: [87.87, 124.72],
665
+ C0: [2599.37, 3676.54],
666
+ C1: [1836.85, 2599.37],
667
+ C2: [1298.27, 1836.85],
668
+ C3: [918.43, 1298.27],
669
+ C4: [649.13, 918.43],
670
+ C5: [459.21, 649.13],
671
+ C6: [323.15, 459.21],
672
+ C7: [229.61, 323.15],
673
+ C8: [161.57, 229.61],
674
+ C9: [113.39, 161.57],
675
+ C10: [79.37, 113.39],
676
+ RA0: [2437.8, 3458.27],
677
+ RA1: [1729.13, 2437.8],
678
+ RA2: [1218.9, 1729.13],
679
+ RA3: [864.57, 1218.9],
680
+ RA4: [609.45, 864.57],
681
+ SRA0: [2551.18, 3628.35],
682
+ SRA1: [1814.17, 2551.18],
683
+ SRA2: [1275.59, 1814.17],
684
+ SRA3: [907.09, 1275.59],
685
+ SRA4: [637.8, 907.09],
686
+ EXECUTIVE: [521.86, 756],
687
+ FOLIO: [612, 936],
688
+ LEGAL: [612, 1008],
689
+ LETTER: [612, 792],
690
+ TABLOID: [792, 1224]
691
+ }[t];
692
+ return i == "landscape" && a.reverse(), a[0] -= n[0] + n[2], a[1] -= n[1] + n[3] + s, a;
693
+ }
694
+ /**
695
+ * ==========================================================================
696
+ * Data
697
+ * ==========================================================================
698
+ */
699
+ /**
700
+ * Returns `true` if `dataSource` is set, and the contents are proper
701
+ * data (array).
702
+ *
703
+ * @return Has data?
704
+ */
705
+ hasData() {
706
+ const t = this.get("dataSource");
707
+ return !!(N(t) && t.length);
708
+ }
709
+ /**
710
+ * Returns processed data according to format options.
711
+ *
712
+ * @param format Format
713
+ * @param customOptions Format options
714
+ * @param renameFields Should fields be renamed?
715
+ * @return Processed data
716
+ */
717
+ getData(t, e, s = !1) {
718
+ const i = this._getFormatOptions(t, e), n = this.get("dataSource", []);
719
+ let o = n;
720
+ const a = this.get("dataFields");
721
+ a && N(n) && (o = [], S(n, (l) => {
722
+ if (z(l)) {
723
+ const r = {};
724
+ O(a, (d, u) => {
725
+ a[d] != null && (r[s ? u : d] = this.convertToSpecialFormat(d, l[d], i));
726
+ }), o.push(r);
727
+ }
728
+ }));
729
+ const p = {
730
+ type: "dataprocessed",
731
+ format: t,
732
+ options: i,
733
+ data: o,
734
+ target: this
735
+ };
736
+ return this.events.dispatch("dataprocessed", p), p.data;
737
+ }
738
+ /**
739
+ * @ignore
740
+ */
741
+ getDataFields(t) {
742
+ let e = this.get("dataFields");
743
+ return e || (e = {}, N(t) && t.length && S(t, (s) => {
744
+ O(s, (i, n) => {
745
+ e[i] == null && (e[i] = i);
746
+ });
747
+ })), e;
748
+ }
749
+ /**
750
+ * @ignore
751
+ */
752
+ convertEmptyValue(t, e, s) {
753
+ return e ?? s.emptyAs;
754
+ }
755
+ /**
756
+ * @ignore
757
+ */
758
+ convertToSpecialFormat(t, e, s, i) {
759
+ if (typeof e == "number")
760
+ if (this.isDateField(t))
761
+ e = new Date(e);
762
+ else {
763
+ if (this.isNumericField(t) && this.get("numberFormat"))
764
+ return this._root.numberFormatter.format(e, this.get("numberFormat"));
765
+ if (this.isDurationField(t))
766
+ return this._root.durationFormatter.format(e, this.get("durationFormat"), this.get("durationUnit"));
767
+ }
768
+ return e instanceof Date && (s.useTimestamps ? e = e.getTime() : s.useLocale ? i || (e = e.toLocaleString()) : e = this._root.dateFormatter.format(e, this.get("dateFormat"))), e;
769
+ }
770
+ /**
771
+ * @ignore
772
+ */
773
+ isDateField(t) {
774
+ return this.get("dateFields").indexOf(t) !== -1;
775
+ }
776
+ /**
777
+ * @ignore
778
+ */
779
+ isNumericField(t) {
780
+ return this.get("numericFields").indexOf(t) !== -1;
781
+ }
782
+ /**
783
+ * @ignore
784
+ */
785
+ isDurationField(t) {
786
+ return this.get("durationFields").indexOf(t) !== -1;
787
+ }
788
+ /**
789
+ * @ignore
790
+ */
791
+ getContentType(t) {
792
+ let e = "";
793
+ switch (t) {
794
+ case "png":
795
+ e = "image/" + t;
796
+ break;
797
+ case "jpg":
798
+ e = "image/jpeg";
799
+ break;
800
+ case "csv":
801
+ e = "text/csv";
802
+ break;
803
+ case "json":
804
+ e = "application/json";
805
+ break;
806
+ case "html":
807
+ e = "text/html";
808
+ break;
809
+ case "pdf":
810
+ case "pdfdata":
811
+ e = "application/pdf";
812
+ break;
813
+ case "xlsx":
814
+ e = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
815
+ break;
816
+ default:
817
+ e = "application/octet-stream";
818
+ }
819
+ return e;
820
+ }
821
+ getDisposableCanvas() {
822
+ let t = document.createElement("canvas");
823
+ return t.style.position = "fixed", t.style.top = "-10000px", this._root.dom.appendChild(t), t;
824
+ }
825
+ disposeCanvas(t) {
826
+ this._root.dom.removeChild(t);
827
+ }
828
+ /**
829
+ * @ignore
830
+ */
831
+ findBackgroundColor(t) {
832
+ let e = 1, s = getComputedStyle(t, "background-color").getPropertyValue("background-color");
833
+ if ((s.match(/[^,]*,[^,]*,[^,]*,[ ]?0/) || s == "transparent") && (e = 0), e == 0) {
834
+ let i = t.parentElement;
835
+ return i ? this.findBackgroundColor(i) : U.fromHex(16777215);
836
+ } else
837
+ return U.fromCSS(s);
838
+ }
839
+ /**
840
+ * Triggers download of the file.
841
+ *
842
+ * @param uri data:uri with file content
843
+ * @param fileName File name
844
+ * @param addBOM Should download include byte order mark?
845
+ * @return Promise
846
+ */
847
+ streamFile(t, e, s = !1) {
848
+ if (this.blobDownloadSupport()) {
849
+ let i = document.createElement("a");
850
+ i.download = e, document.body.appendChild(i);
851
+ let n = t.split(";"), o = n.shift().replace(/data:/, "");
852
+ if (t = decodeURIComponent(n.join(";").replace(/^[^,]*,/, "")), ["image/svg+xml", "application/json", "text/csv", "text/html"].indexOf(o) == -1)
853
+ try {
854
+ t = atob(t);
855
+ } catch {
856
+ return !1;
857
+ }
858
+ else {
859
+ s && (t = "\uFEFF" + t);
860
+ let r = new Blob([t], { type: o }), d = window.URL.createObjectURL(r);
861
+ return i.href = d, i.download = e, i.click(), setTimeout(() => {
862
+ document.body.removeChild(i), window.URL.revokeObjectURL(d);
863
+ }, 100), !0;
864
+ }
865
+ let a = new Array(t.length);
866
+ for (let r = 0; r < t.length; ++r) {
867
+ let d = t.charCodeAt(r);
868
+ a[r] = d;
869
+ }
870
+ s && (a = [239, 187, 191].concat(a));
871
+ let p = new Blob([new Uint8Array(a)], { type: o }), l = window.URL.createObjectURL(p);
872
+ i.href = l, i.download = e, document.body.appendChild(i), i.click(), document.body.removeChild(i), setTimeout(() => {
873
+ window.URL.revokeObjectURL(l);
874
+ }, 100);
875
+ } else if (this.linkDownloadSupport()) {
876
+ let i = document.createElement("a");
877
+ i.download = e, i.href = t, document.body.appendChild(i), i.click(), document.body.removeChild(i);
878
+ } else
879
+ window.location.href = t;
880
+ return !0;
881
+ }
882
+ /**
883
+ * @ignore
884
+ */
885
+ downloadSupport() {
886
+ return this.linkDownloadSupport();
887
+ }
888
+ /**
889
+ * @ignore
890
+ */
891
+ linkDownloadSupport() {
892
+ return typeof document.createElement("a").download < "u";
893
+ }
894
+ /**
895
+ * @ignore
896
+ */
897
+ blobDownloadSupport() {
898
+ return window.Blob != null;
899
+ }
900
+ /**
901
+ * ==========================================================================
902
+ * Print
903
+ * ==========================================================================
904
+ */
905
+ /**
906
+ * Initiates print of the chart.
907
+ *
908
+ * @param data data:uri for the image
909
+ * @param options Options
910
+ * @param title Optional title to use (uses window's title by default)
911
+ * @return Promise
912
+ */
913
+ initiatePrint(t, e, s) {
914
+ const i = this._getFormatOptions("print", e);
915
+ i.printMethod == "css" ? this._printViaCSS(t, i, s) : this._printViaIframe(t, i, s);
916
+ }
917
+ _printViaCSS(t, e, s) {
918
+ let n = this._getFormatOptions("print", e).delay || 500, o = document.documentElement.scrollTop || document.body.scrollTop, a = new x(I(this._root.dom), "body > *", {
919
+ display: "none",
920
+ position: "fixed",
921
+ visibility: "hidden",
922
+ opacity: "0",
923
+ clipPath: "polygon(0px 0px,0px 0px,0px 0px,0px 0px);"
924
+ }, this._root.nonce), p = new x(I(this._root.dom), "body", {
925
+ padding: "0",
926
+ margin: "0"
927
+ }, this._root.nonce), l;
928
+ s && document && document.title && (l = document.title, document.title = s);
929
+ let r = new Image();
930
+ r.src = t, r.style.maxWidth = "100%", r.style.display = "block", r.style.position = "relative", r.style.visibility = "visible", r.style.opacity = "1", r.style.clipPath = "none", document.body.appendChild(r), this.setTimeout(() => {
931
+ window.print();
932
+ }, 50), /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && n < 1e3 ? n = 1e3 : n < 100 && (n = 100), this.setTimeout(() => {
933
+ document.body.removeChild(r), a.dispose(), p.dispose(), l && (document.title = document.title), document.documentElement.scrollTop = document.body.scrollTop = o;
934
+ }, n || 500);
935
+ }
936
+ _printViaIframe(t, e, s) {
937
+ let n = this._getFormatOptions("print", e).delay || 500;
938
+ const o = document.createElement("iframe");
939
+ o.style.visibility = "hidden", document.body.appendChild(o), o.contentWindow.document.open(), o.contentWindow.document.close();
940
+ let a = new Image();
941
+ a.src = t, a.style.maxWidth = "100%", a.style.height = "auto", s && (o.contentWindow.document.title = s), o.contentWindow.document.body.appendChild(a), o.load = function() {
942
+ o.contentWindow.document.body.appendChild(a);
943
+ }, this.setTimeout(() => {
944
+ try {
945
+ o.contentWindow.document.execCommand("print", !1, null) || o.contentWindow.print();
946
+ } catch {
947
+ o.contentWindow.print();
948
+ }
949
+ }, n || 50), /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && n < 1e3 ? n = 1e3 : n < 100 && (n = 100), this.setTimeout(() => {
950
+ document.body.removeChild(o);
951
+ }, n + 50 || 100);
952
+ }
953
+ /**
954
+ * Returns a list of formats that can be exported in current browser.
955
+ *
956
+ * @return Formats
957
+ */
958
+ supportedFormats() {
959
+ const t = [], e = this.hasData(), s = this.downloadSupport();
960
+ return S(["png", "jpg", "canvas", "pdf", "xlsx", "csv", "json", "html", "pdfdata", "print"], (i) => {
961
+ this._getFormatOptions(i).disabled !== !0 && (["xlsx", "csv", "json", "html", "pdfdata"].indexOf(i) == -1 || e && s) && t.push(i);
962
+ }), t;
963
+ }
964
+ /**
965
+ * Returns a list of supported export types: image or print.
966
+ *
967
+ * @return Supported types
968
+ */
969
+ supportedExportTypes() {
970
+ const t = ["image", "print"];
971
+ return this.downloadSupport() && this.hasData() && t.push("data"), t;
972
+ }
973
+ }
974
+ P.className = "Exporting";
975
+ P.classNames = F.classNames.concat([P.className]);
976
+ function X(h, t) {
977
+ const e = t.interfaceColors;
978
+ return new q([
979
+ new x(h, ".am5exporting-menu", {
980
+ color: e.get("secondaryButtonText").toCSS(),
981
+ "font-size": "0.8em"
982
+ }, t.nonce),
983
+ new x(h, ".am5exporting-menu *", {
984
+ "box-sizing": "border-box",
985
+ transition: "all 100ms ease-in-out"
986
+ }, t.nonce),
987
+ new x(h, ".am5exporting-menu a", {
988
+ display: "block",
989
+ cursor: "pointer"
990
+ }, t.nonce),
991
+ new x(h, ".am5exporting-type-separator", {
992
+ color: e.get("disabled").toCSS(),
993
+ "border-bottom": "1px solid " + e.get("secondaryButtonDown").toCSS()
994
+ }, t.nonce),
995
+ new x(h, ".am5exporting-label-alt", {
996
+ color: e.get("disabled").toCSS(),
997
+ "font-size": "0.8em"
998
+ }, t.nonce),
999
+ new x(h, ".am5exporting-menu .am5exporting-type-separator a", {
1000
+ cursor: "default"
1001
+ }, t.nonce),
1002
+ new x(h, ".am5exporting-menu .am5exporting-type-separator a:hover", {
1003
+ background: "initial"
1004
+ }, t.nonce),
1005
+ new x(h, ".am5exporting-menu", {
1006
+ position: "absolute",
1007
+ "z-index": "10"
1008
+ }, t.nonce),
1009
+ new x(h, ".am5exporting-icon", {
1010
+ width: "30px",
1011
+ height: "26px",
1012
+ position: "absolute",
1013
+ margin: "5px",
1014
+ padding: "3px 5px",
1015
+ "border-radius": "3px",
1016
+ opacity: "0.5",
1017
+ background: "rgba(255, 255, 255, 0.001)",
1018
+ "background-opacity": "0"
1019
+ }, t.nonce),
1020
+ new x(h, ".am5exporting-icon:focus, .am5exporting-icon:hover, .am5exporting-menu-open .am5exporting-icon", {
1021
+ background: e.get("secondaryButtonHover").toCSS(),
1022
+ opacity: "1"
1023
+ }, t.nonce),
1024
+ new x(h, ".am5exporting-menu path", {
1025
+ fill: e.get("secondaryButtonText").toCSS()
1026
+ }, t.nonce),
1027
+ new x(h, ".am5exporting-list", {
1028
+ display: "none",
1029
+ "list-style": "none",
1030
+ "list-style-type": "none",
1031
+ margin: "5px",
1032
+ background: e.get("secondaryButton").toCSS(),
1033
+ padding: "5px 0",
1034
+ border: "1px solid " + e.get("secondaryButtonStroke").toCSS(),
1035
+ "border-radius": "3px"
1036
+ }, t.nonce),
1037
+ new x(h, ".am5exporting-menu-open .am5exporting-list", {
1038
+ display: "block"
1039
+ }, t.nonce),
1040
+ new x(h, ".am5exporting-item", {}, t.nonce),
1041
+ new x(h, ".am5exporting-item a", {
1042
+ padding: "3px 15px"
1043
+ }, t.nonce),
1044
+ new x(h, ".am5exporting-item a:hover, .am5exporting-item a.am5exporting-item-active", {
1045
+ background: e.get("secondaryButtonHover").toCSS()
1046
+ }, t.nonce),
1047
+ new x(h, ".am5exporting-menu.am5exporting-align-left, .am5exporting-icon.am5exporting-align-left, .am5exporting-list.am5exporting-align-left", {
1048
+ left: "0"
1049
+ }, t.nonce),
1050
+ new x(h, ".am5exporting-menu.am5exporting-align-right, .am5exporting-icon.am5exporting-align-right, .am5exporting-list.am5exporting-align-right", {
1051
+ right: "0"
1052
+ }, t.nonce),
1053
+ new x(h, ".am5exporting-menu.am5exporting-valign-top, .am5exporting-icon.am5exporting-valign-top, .am5exporting-list.am5exporting-align-top", {
1054
+ top: "0"
1055
+ }, t.nonce),
1056
+ new x(h, ".am5exporting-menu.am5exporting-valign-bottom, .am5exporting-icon.am5exporting-valign-bottom, .am5exporting-list.am5exporting-align-bottom", {
1057
+ bottom: "0"
1058
+ }, t.nonce),
1059
+ new x(h, ".am5exporting-list.am5exporting-align-left", {
1060
+ "margin-left": "40px"
1061
+ }, t.nonce),
1062
+ new x(h, ".am5exporting-list.am5exporting-align-right", {
1063
+ "margin-right": "40px"
1064
+ }, t.nonce)
1065
+ // new StyleRule(element, ".${newPrefix}-menu-level-0", {
1066
+ // "position": "absolute",
1067
+ // "top": "5px",
1068
+ // "right": "5px",
1069
+ // })
1070
+ ]);
1071
+ }
1072
+ let E;
1073
+ function it(h, t, e) {
1074
+ if (h == null) {
1075
+ if (!E) {
1076
+ const s = X(h, t);
1077
+ E = new J(() => {
1078
+ E = void 0, s.dispose();
1079
+ });
1080
+ }
1081
+ return E.increment();
1082
+ } else
1083
+ return X(h, t);
1084
+ }
1085
+ class M extends F {
1086
+ constructor() {
1087
+ super(...arguments), this._itemElements = [], this._itemDisposers = [], this.isOpen = !1, this._isOver = !1;
1088
+ }
1089
+ _afterNew() {
1090
+ super._afterNew(), this._setRawDefault("container", this._root._inner), this._setRawDefault("align", "right"), this._setRawDefault("valign", "top"), this._setRawDefault("useDefaultCSS", !0), this._setRawDefault("autoClose", !0), this._setRawDefault("deactivateRoot", !0), this._setRawDefault("items", [{
1091
+ type: "separator",
1092
+ label: this._t("Export")
1093
+ }, {
1094
+ type: "format",
1095
+ format: "png",
1096
+ exportType: "image",
1097
+ label: this._t("PNG"),
1098
+ sublabel: this._t("Image")
1099
+ }, {
1100
+ type: "format",
1101
+ format: "jpg",
1102
+ exportType: "image",
1103
+ label: this._t("JPG"),
1104
+ sublabel: this._t("Image")
1105
+ }, {
1106
+ type: "format",
1107
+ format: "pdf",
1108
+ exportType: "image",
1109
+ label: this._t("PDF"),
1110
+ sublabel: this._t("Image")
1111
+ }, {
1112
+ type: "separator",
1113
+ exportType: "data"
1114
+ //label: this._t("Data")
1115
+ }, {
1116
+ type: "format",
1117
+ format: "json",
1118
+ exportType: "data",
1119
+ label: this._t("JSON"),
1120
+ sublabel: this._t("Data")
1121
+ }, {
1122
+ type: "format",
1123
+ format: "csv",
1124
+ exportType: "data",
1125
+ label: this._t("CSV"),
1126
+ sublabel: this._t("Data")
1127
+ }, {
1128
+ type: "format",
1129
+ format: "xlsx",
1130
+ exportType: "data",
1131
+ label: this._t("XLSX"),
1132
+ sublabel: this._t("Data")
1133
+ }, {
1134
+ type: "format",
1135
+ format: "pdfdata",
1136
+ exportType: "data",
1137
+ label: this._t("PDF"),
1138
+ sublabel: this._t("Data")
1139
+ }, {
1140
+ type: "format",
1141
+ format: "html",
1142
+ exportType: "data",
1143
+ label: this._t("HTML"),
1144
+ sublabel: this._t("Data")
1145
+ }, {
1146
+ type: "separator"
1147
+ }, {
1148
+ type: "format",
1149
+ format: "print",
1150
+ exportType: "print",
1151
+ label: this._t("Print")
1152
+ }]);
1153
+ const t = document.createElement("div");
1154
+ this._menuElement = t, this.setPrivate("menuElement", this._menuElement);
1155
+ const e = document.createElement("a");
1156
+ this._iconElement = e, this._listElement = document.createElement("ul"), this._listElement.setAttribute("role", "menu"), this.setPrivate("listElement", this._listElement), this._applyClassNames(), e.innerHTML = '<svg fill="none" height="20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z"/></svg>', e.setAttribute("tabindex", this._root.tabindex.toString()), e.setAttribute("aria-label", this.get("ariaLabel", this._t("Export") + "; " + this._t("Press ENTER to open"))), e.setAttribute("role", "button"), G("keyboardevents") && this._disposers.push(w(document, "keydown", (i) => {
1157
+ const n = K(i);
1158
+ if (document.activeElement == this._iconElement || this.isOpen) {
1159
+ if (n == "Escape")
1160
+ this.close();
1161
+ else if (n == "Enter")
1162
+ this._activeItem ? this._handleClick(this._activeItem) : this.toggle();
1163
+ else if (n == "ArrowUp" || n == "ArrowDown") {
1164
+ const o = this.get("items", []);
1165
+ let a = o.indexOf(this._activeItem);
1166
+ this.get("valign") == "top" && a == -1 && (a = o.length);
1167
+ const p = n == "ArrowUp" ? -1 : 1;
1168
+ let l = a + p, r;
1169
+ do
1170
+ l < 0 ? l = o.length - 1 : l > o.length - 1 && (l = 0), o[l].type == "separator" ? l += p : r = o[l];
1171
+ while (!r);
1172
+ r && this._handleItemFocus(r);
1173
+ }
1174
+ }
1175
+ })), this._disposers.push(w(e, "click", (i) => {
1176
+ i.stopImmediatePropagation(), this.toggle();
1177
+ })), t.appendChild(this._iconElement), t.appendChild(this._listElement);
1178
+ const s = this.get("container", this._root._inner);
1179
+ s.appendChild(this._menuElement), this._disposers.push(w(t, j("pointerover"), (i) => {
1180
+ this._isOver = !0, this.get("deactivateRoot") && (this._root._renderer.interactionsEnabled = !1);
1181
+ })), this._disposers.push(w(t, j("pointerout"), (i) => {
1182
+ this.get("deactivateRoot") && (this.isOpen || this._isOver) && (this._root._renderer.interactionsEnabled = !0), this._isOver = !1;
1183
+ })), this._disposers.push(new Q(() => {
1184
+ this._menuElement && s.removeChild(this._menuElement);
1185
+ })), this._disposers.push(w(document, "click", (i) => {
1186
+ this.isOpen && !this._isOver && this.close();
1187
+ })), this.loadDefaultCSS(), this._root.addDisposer(this), this.events.dispatch("menucreated", {
1188
+ type: "menucreated",
1189
+ target: this
1190
+ });
1191
+ }
1192
+ _afterChanged() {
1193
+ if (super._afterChanged(), this._itemElements.length == 0 && this.createItems(), this.isDirty("useDefaultCSS") && (this.get("useDefaultCSS") ? this.loadDefaultCSS() : this._cssDisposer && this._cssDisposer.dispose()), this.isDirty("exporting") && this.get("exporting") && this.createItems(), (this.isDirty("align") || this.isDirty("valign")) && this._applyClassNames(), this.isDirty("container")) {
1194
+ const t = this.get("container");
1195
+ t && t.appendChild(this._menuElement);
1196
+ }
1197
+ }
1198
+ _dispose() {
1199
+ super._dispose(), S(this._itemDisposers, (t) => {
1200
+ t.dispose();
1201
+ });
1202
+ }
1203
+ _applyClassNames() {
1204
+ const t = this.get("align", "right"), e = this.get("valign", "top"), s = this.isOpen ? "am5exporting-menu-open" : "am5exporting-menu-closed";
1205
+ this._menuElement.className = "am5exporting am5exporting-menu am5exporting-align-" + t + " am5exporting-valign-" + e + " " + s, this._iconElement.className = "am5exporting am5exporting-icon am5exporting-align-" + t + " am5exporting-valign-" + e, this._listElement.className = "am5exporting am5exporting-list am5exporting-align-" + t + " am5exporting-valign-" + e;
1206
+ }
1207
+ /**
1208
+ * @ignore
1209
+ */
1210
+ createItems() {
1211
+ const t = this.get("exporting");
1212
+ if (!t)
1213
+ return;
1214
+ this._listElement.innerHTML = "", this._itemElements = [];
1215
+ const e = this.get("items", []), s = t.supportedFormats(), i = t.supportedExportTypes();
1216
+ S(this._itemDisposers, (n) => {
1217
+ n.dispose();
1218
+ }), this._itemDisposers.length = 0, S(e, (n) => {
1219
+ if (n.format && s.indexOf(n.format) == -1 || n.exportType && i.indexOf(n.exportType) == -1)
1220
+ return;
1221
+ const o = document.createElement("li");
1222
+ o.setAttribute("role", "menuitem"), o.className = "am5exporting am5exporting-item am5exporting-type-" + n.type, n.format && (o.className += " am5exporting-format-" + n.format);
1223
+ const a = document.createElement("a");
1224
+ let p = this._t("Export ");
1225
+ n.label && (a.innerHTML = n.label, p += " " + n.label), n.sublabel && (a.innerHTML += ' <span class="am5exporting-label-alt">' + n.sublabel + "</span>", p += " (" + n.sublabel + ")"), n.callback ? (this._itemDisposers.push(w(a, "click", (l) => {
1226
+ n.callback.call(n.callbackTarget || this);
1227
+ })), a.setAttribute("tabindex", this._root.tabindex.toString())) : n.format && t && (this._itemDisposers.push(w(a, "click", (l) => {
1228
+ this._handleClick(n);
1229
+ })), this._itemDisposers.push(w(a, "focus", (l) => {
1230
+ this._handleItemFocus(n);
1231
+ })), this._itemDisposers.push(w(a, "blur", (l) => {
1232
+ this._handleItemBlur(n);
1233
+ })), a.setAttribute("tabindex", this._root.tabindex.toString()), a.setAttribute("aria-label", p)), n.element = a, o.appendChild(a), this._listElement.appendChild(o), this._itemElements.push(o);
1234
+ });
1235
+ }
1236
+ _handleClick(t) {
1237
+ const e = this.get("exporting");
1238
+ this.get("autoClose") && this.close(), t.format == "print" ? e.print() : e.download(t.format);
1239
+ }
1240
+ _handleItemFocus(t) {
1241
+ t != this._activeItem && (this._activeItem && (this._activeItem.element.className = ""), this._activeItem = t, t.element.className = "am5exporting-item-active", t.element.focus());
1242
+ }
1243
+ _handleItemBlur(t) {
1244
+ t.element.className = "", t == this._activeItem && (this._activeItem = void 0), this.setTimeout(() => {
1245
+ (!document.activeElement || !$(this.get("container"), document.activeElement)) && this.close();
1246
+ }, 10);
1247
+ }
1248
+ /**
1249
+ * Loads the default CSS.
1250
+ *
1251
+ * @ignore Exclude from docs
1252
+ */
1253
+ loadDefaultCSS() {
1254
+ const t = it(I(this._root.dom), this._root);
1255
+ this._disposers.push(t), this._cssDisposer = t;
1256
+ }
1257
+ /**
1258
+ * Opens menu.
1259
+ */
1260
+ open() {
1261
+ this.setTimeout(() => {
1262
+ this.isOpen = !0, this.get("deactivateRoot") && (this._root._renderer.interactionsEnabled = !1), this._applyClassNames(), this.events.dispatch("menuopened", {
1263
+ type: "menuopened",
1264
+ target: this
1265
+ });
1266
+ }, 1);
1267
+ }
1268
+ /**
1269
+ * Closes menu.
1270
+ */
1271
+ close() {
1272
+ this.isOpen = !1, this.get("deactivateRoot") && (this._root._renderer.interactionsEnabled = !0), Y(), this._applyClassNames(), this.events.dispatch("menuclosed", {
1273
+ type: "menuclosed",
1274
+ target: this
1275
+ });
1276
+ }
1277
+ /**
1278
+ * Toggles menu open and close.
1279
+ */
1280
+ toggle() {
1281
+ this.isOpen ? this.close() : this.open();
1282
+ }
1283
+ }
1284
+ M.className = "ExportingMenu";
1285
+ M.classNames = F.classNames.concat([M.className]);
1286
+ class B extends F {
1287
+ constructor() {
1288
+ super(...arguments), this._skipRender = !1;
1289
+ }
1290
+ //public extraImages: Array<Root | IAnnotatorImageSource> = [];
1291
+ //public dataSources: any[] = [];
1292
+ _afterNew() {
1293
+ super._afterNew(), this._setRawDefault("layer", 1e3), this._root.addDisposer(this);
1294
+ }
1295
+ _beforeChanged() {
1296
+ super._beforeChanged(), this.isDirty("markerState") && this._renderState();
1297
+ }
1298
+ /**
1299
+ * Triggers annotation mode on the chart. This will display UI toolbars and
1300
+ * disable all interactions on the chart itself.
1301
+ */
1302
+ open() {
1303
+ return f(this, void 0, void 0, function* () {
1304
+ this.setTimeout(() => {
1305
+ this._root._renderer.interactionsEnabled = !1;
1306
+ }, 100);
1307
+ const t = yield this.getMarkerArea();
1308
+ t.show(), this._picture.hide(0), this.get("markerState") && t.restoreState(this.get("markerState"));
1309
+ });
1310
+ }
1311
+ _renderState() {
1312
+ return f(this, void 0, void 0, function* () {
1313
+ const t = yield this.getMarkerArea();
1314
+ this.get("markerState") && (this._skipRender = !0, t.renderState(this.get("markerState")));
1315
+ });
1316
+ }
1317
+ /**
1318
+ * Exists from annotation mode. All annotations remain visible on the chart.
1319
+ */
1320
+ close() {
1321
+ return f(this, void 0, void 0, function* () {
1322
+ (yield this.getMarkerArea()).close(), this._markerArea = void 0;
1323
+ });
1324
+ }
1325
+ /**
1326
+ * Exits from annotation mode. Any changes made during last session of the
1327
+ * annotation editing are cancelled.
1328
+ */
1329
+ cancel() {
1330
+ return f(this, void 0, void 0, function* () {
1331
+ this._root._renderer.interactionsEnabled = !0;
1332
+ const t = yield this.getMarkerArea();
1333
+ this._picture.show(0), t.close(), this._markerArea = void 0;
1334
+ });
1335
+ }
1336
+ /**
1337
+ * All annotations are removed.
1338
+ */
1339
+ clear() {
1340
+ this.set("markerState", void 0), this._picture && this._picture.set("src", "");
1341
+ }
1342
+ toggle() {
1343
+ return f(this, void 0, void 0, function* () {
1344
+ (yield this.getMarkerArea()).isOpen ? this.close() : this.open();
1345
+ });
1346
+ }
1347
+ _dispose() {
1348
+ super._dispose(), this._markerArea && this._markerArea.isOpen && this._markerArea.close();
1349
+ }
1350
+ _maybeInit() {
1351
+ return f(this, void 0, void 0, function* () {
1352
+ if (this._container || (this._container = this._root.container.children.push(Z.new(this._root, {
1353
+ width: T,
1354
+ height: T,
1355
+ layer: this.get("layer"),
1356
+ interactiveChildren: !1
1357
+ })), this._picture = this._container.children.push(tt.new(this._root, {
1358
+ width: T,
1359
+ height: T
1360
+ }))), !this._markerArea) {
1361
+ const t = yield this._getMarkerJS(), e = this._container._display.getCanvas(), s = new t.MarkerArea(e);
1362
+ s.uiStyleSettings.logoPosition = "right", s.uiStyleSettings.zIndex = 20, s.targetRoot = e.parentElement;
1363
+ const i = this.get("markerSettings", {});
1364
+ O(i, (o, a) => {
1365
+ s.settings[o] = a;
1366
+ });
1367
+ const n = this.get("markerStyleSettings", {});
1368
+ O(n, (o, a) => {
1369
+ s.uiStyleSettings[o] = a;
1370
+ }), this._disposers.push(w(s, "close", () => {
1371
+ this._root._renderer.interactionsEnabled = !0, this._picture.show(0), this._markerArea = void 0;
1372
+ })), this._disposers.push(w(s, "render", (o) => {
1373
+ this._picture.set("src", o.dataUrl), this._skipRender || this.set("markerState", o.state), this._skipRender = !1;
1374
+ })), this._markerArea = s;
1375
+ }
1376
+ });
1377
+ }
1378
+ /**
1379
+ * @ignore
1380
+ */
1381
+ _getMarkerJS() {
1382
+ return f(this, void 0, void 0, function* () {
1383
+ return yield import(
1384
+ /* webpackChunkName: "markerjs2" */
1385
+ "./markerjs2.esm.B_9kjmye.js"
1386
+ );
1387
+ });
1388
+ }
1389
+ /**
1390
+ * An instance of MarkerJS's [[MarkerArea]].
1391
+ *
1392
+ * @see {@link https://markerjs.com/docs/getting-started} for more info
1393
+ * @return MarkerArea
1394
+ */
1395
+ getMarkerArea() {
1396
+ return f(this, void 0, void 0, function* () {
1397
+ return yield this._maybeInit(), this._markerArea;
1398
+ });
1399
+ }
1400
+ }
1401
+ B.className = "Annotator";
1402
+ B.classNames = F.classNames.concat([B.className]);
1403
+ export {
1404
+ B as Annotator,
1405
+ P as Exporting,
1406
+ M as ExportingMenu
1407
+ };