| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414 | 1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
162×
162×
162×
162×
162×
162×
162×
10×
10×
10×
10×
1×
162×
162×
1×
162×
3×
159×
159×
1×
153×
153×
153×
6424×
150×
308×
153×
1×
458×
458×
458×
1×
598×
598×
598×
145×
145×
145×
1×
144×
144×
144×
1×
1×
1×
21×
21×
21×
21×
11×
10×
1×
1×
10×
2×
8×
8×
8×
8×
8×
141×
3031×
141×
141×
1×
140×
140×
140×
1×
145×
145×
145×
343×
145×
145×
6380×
145×
1×
144×
144×
144×
144×
1×
143×
94×
94×
94×
1×
93×
142×
4×
6×
2×
2×
2×
1×
4×
3×
2×
2×
4×
1×
5×
4×
7×
3×
4×
2×
2×
4×
3×
2×
1×
2×
2×
2×
8×
8×
1×
2×
2×
3×
5×
4×
4×
2×
9×
6×
6×
1×
1×
1×
1×
2×
55×
55×
55×
1×
162×
162×
162×
7×
7×
162×
1×
16380×
1×
89×
1×
56×
1×
94×
94×
94×
94×
1×
94×
94×
94×
94×
1×
4×
4×
4×
6×
4×
1×
6×
6×
4×
4×
4×
1×
3×
3×
12×
15×
3×
1×
2×
2×
1×
1×
1×
2×
1×
1×
1×
1×
1×
1×
2×
2×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
903×
903×
1×
4×
4×
3×
1×
2×
2×
2×
1×
3×
3×
3×
3×
1×
2×
2×
2×
2×
1×
2×
2×
2×
2×
1×
1×
1×
2×
2×
2×
2×
1×
1×
1×
4×
4×
4×
1×
3×
3×
1×
2×
2×
1×
1×
1×
1×
1×
5×
5×
5×
1×
4×
1×
4×
3×
3×
3×
4×
4×
4×
1×
3×
2×
2×
1×
2×
2×
1×
1×
1×
1×
2×
2×
1×
4×
4×
4×
4×
3×
2×
1×
1×
2×
1×
1×
2×
2×
1×
1×
1×
1×
1×
2×
2×
2×
2×
1×
7×
7×
7×
7×
7×
7×
6×
2×
2×
6×
1×
5×
2×
4×
1×
3×
3×
3×
3×
3×
1×
3×
3×
3×
3×
3×
3×
2×
2×
2×
1×
2×
2×
2×
1×
1×
1×
1×
1×
4×
4×
4×
3×
1×
2×
2×
2×
2×
2×
2×
1×
1×
2×
2×
2×
2×
1×
2×
2×
2×
2×
2×
2×
1×
1×
1×
1×
1×
1×
1×
1×
2×
2×
2×
2×
2×
1×
1×
4×
4×
4×
4×
4×
1×
3×
3×
3×
6×
6×
6×
36×
36×
36×
36×
36×
36×
36×
5×
5×
3×
1×
2×
1×
3×
3×
3×
5×
5×
1×
4×
1×
3×
3×
3×
1×
2×
3×
1×
2×
2×
2×
4×
3×
18×
2×
1×
1×
1×
1×
2×
1×
1×
2×
2×
1×
1×
2×
2×
2×
2×
2×
2×
1×
2×
2×
2×
1×
8×
8×
8×
8×
5×
5×
4×
3×
3×
3×
7×
7×
7×
10×
10×
10×
10×
10×
10×
7×
1×
8×
8×
8×
8×
2×
6×
6×
4×
4×
4×
3×
3×
3×
4×
1×
2×
1×
4×
4×
4×
4×
4×
7×
7×
7×
4×
3×
1×
2×
1×
2×
1×
2×
3×
3×
3×
3×
1×
1×
1×
1×
1×
1×
2×
2×
2×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
2×
2×
2×
1×
1×
1×
1×
1×
1×
1×
3×
3×
3×
1×
2×
2×
2×
1×
5×
5×
5×
4×
4×
3×
3×
3×
3×
1×
4×
4×
4×
1×
3×
1×
1×
1×
1×
2×
1×
1×
1×
1×
1×
1×
2×
2×
2×
3×
2×
1×
4×
4×
4×
4×
1×
3×
3×
3×
1×
2×
1×
1×
1×
1×
1×
1×
1×
1×
2×
2×
2×
2×
2×
1×
9×
9×
9×
9×
9×
11×
11×
1×
10×
1×
9×
7×
7×
7×
1×
6×
1×
5×
1×
4×
4×
1×
4×
4×
4×
4×
4×
6×
6×
5×
1×
4×
4×
2×
2×
2×
1×
6×
6×
1×
5×
5×
5×
2×
5×
5×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
2×
2×
2×
1×
1×
1×
1×
6×
3×
3×
3×
1×
8×
8×
4×
4×
2×
2×
2×
1×
4×
7×
1×
10×
1×
26×
2×
24×
1×
13×
13×
1×
87×
1×
51×
9×
1×
29×
2×
1×
77×
1×
9×
9×
1×
1×
29×
35×
29×
5×
1×
14×
14×
1×
11×
11×
21×
21×
21×
1×
10×
1×
254×
4×
1×
78×
78×
78×
225×
222×
222×
56×
1×
22×
19×
19×
1×
18×
18×
1×
1×
3×
1×
2×
2×
1×
1×
7×
7×
7×
7×
7×
1×
26×
1×
3×
1×
1×
1×
1×
1×
| var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/* istanbul ignore next */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
/* istanbul ignore next */
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
define(["require", "exports", "@syncfusion/ej2-base", "../../common/model/constants"], function (require, exports, ej2_base_1, constants_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var outputSchema = {
type: 'object',
properties: {
success: { type: 'boolean' },
data: { type: 'object' },
message: { type: 'string' }
},
required: ['success', 'data', 'message']
};
var webMcpTools = [
{
name: 'inspectChart',
description: 'Returns a JSON-safe snapshot of the chart configuration and series metadata. ' +
'Use it before chart operations when the current chart state is unknown.',
inputSchema: {
type: 'object',
properties: {
includeSeries: {
type: 'boolean',
description: 'Include per-series metadata. Defaults to true.'
}
},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: true
}
},
{
name: 'getSeriesData',
description: 'Returns JSON-safe point data for a chart series. Use a bounded maxPoints value for large series.',
inputSchema: {
type: 'object',
properties: {
seriesIndex: {
type: 'integer',
minimum: 0,
description: 'Zero-based chart series index.'
},
maxPoints: {
type: 'integer',
minimum: 1,
maximum: 10000,
description: 'Maximum number of points to return. Defaults to 100.'
},
includeHiddenPoints: {
type: 'boolean',
description: 'Include points marked invisible. Defaults to false.'
}
},
required: ['seriesIndex']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: true
}
},
{
name: 'getAxisValueAtPosition',
description: 'Converts chart-local coordinates inside the plot area into axis values.',
inputSchema: {
type: 'object',
properties: {
x: {
type: 'number',
description: 'Chart-local horizontal coordinate.'
},
y: {
type: 'number',
description: 'Chart-local vertical coordinate.'
}
},
required: ['x', 'y']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: false
}
},
{
name: 'addChartSeries',
description: 'Adds JSON-serializable series definitions to the chart and rerenders it.',
inputSchema: {
type: 'object',
properties: {
series: {
type: 'array',
items: { type: 'object' },
description: 'SeriesModel definitions.'
}
},
required: ['series']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'removeChartSeries',
description: 'Removes one chart series by index. This changes chart state and requires confirmation.',
inputSchema: {
type: 'object',
properties: {
seriesIndex: {
type: 'integer',
minimum: 0,
description: 'Zero-based chart series index.'
}
},
required: ['seriesIndex']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'clearChartSeries',
description: 'Removes all chart series. This destructive operation requires confirmation.',
inputSchema: {
type: 'object',
properties: {},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'updateChartAnnotation',
description: 'Updates the content of an existing chart annotation and rerenders it.',
inputSchema: {
type: 'object',
properties: {
annotationIndex: {
type: 'integer',
minimum: 0,
description: 'Zero-based annotation index.'
},
content: {
type: 'string',
description: 'New annotation content.'
}
},
required: ['annotationIndex', 'content']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'showChartTooltip',
description: 'Displays the chart tooltip at chart-local coordinates or at a matching data point.',
inputSchema: {
type: 'object',
properties: {
x: {
type: ['number', 'string'],
description: 'Point x value or chart-local x coordinate.'
},
y: {
type: 'number',
description: 'Point y value or chart-local y coordinate.'
},
isPoint: {
type: 'boolean',
description: 'Treat x and y as data-point values.'
}
},
required: ['x', 'y']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: false
}
},
{
name: 'showChartCrosshair',
description: 'Displays the chart crosshair at chart-local coordinates.',
inputSchema: {
type: 'object',
properties: {
x: {
type: 'number',
description: 'Chart-local horizontal coordinate.'
},
y: {
type: 'number',
description: 'Chart-local vertical coordinate.'
}
},
required: ['x', 'y']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: false
}
},
{
name: 'exportChart',
description: 'Exports the current chart in PNG, JPEG, SVG, PDF, XLSX, or CSV format.',
inputSchema: {
type: 'object',
properties: {
type: {
type: 'string',
enum: ['PNG', 'JPEG', 'SVG', 'PDF', 'XLSX', 'CSV'],
description: 'Export format.'
},
fileName: {
type: 'string',
minLength: 1,
maxLength: 255,
description: 'Safe output file name.'
}
},
required: ['type', 'fileName']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'printChart',
description: 'Sends the chart or selected chart element IDs to the browser print workflow.',
inputSchema: {
type: 'object',
properties: {
elementIds: {
description: 'Optional chart element ID or array of element IDs.'
}
},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'refreshChartData',
description: 'Reprocesses the current chart data and rerenders the chart for live updates.',
inputSchema: {
type: 'object',
properties: {},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'updateChartDataSource',
description: 'Updates the chart data source or one or more series data sources. ' +
'Use series entries with an index to target a specific series, such as series index 0.',
inputSchema: {
type: 'object',
properties: {
dataSource: {
type: 'array',
items: { type: 'object' },
description: 'Optional chart-level data records.'
},
series: {
type: 'array',
items: {
type: 'object',
properties: {
index: {
type: 'integer',
minimum: 0,
description: 'Zero-based series index.'
},
dataSource: {
type: 'array',
items: { type: 'object' },
description: 'Data records for the selected series.'
}
},
required: ['index', 'dataSource']
},
description: 'Optional targeted series data-source updates.'
}
},
required: [],
anyOf: [{ required: ['dataSource'] }, { required: ['series'] }]
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'toggleChartSeriesVisibility',
description: 'Shows or hides one chart series without deleting its configuration.',
inputSchema: {
type: 'object',
properties: {
seriesIndex: {
type: 'integer',
minimum: 0,
description: 'Zero-based chart series index.'
},
visible: {
type: 'boolean',
description: 'Desired visibility state.'
}
},
required: ['seriesIndex', 'visible']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'configureChartZoom',
description: 'Updates the zoom factor and position of a primary axis or named secondary axis.',
inputSchema: {
type: 'object',
properties: {
axis: {
type: 'string',
enum: ['x', 'y'],
description: 'Primary-axis orientation or secondary-axis orientation.'
},
axisName: {
type: 'string',
minLength: 1,
maxLength: 255,
description: 'Optional secondary-axis name. Omit it to update the selected primary axis.'
},
zoomFactor: {
type: 'number',
minimum: 0,
maximum: 1,
description: 'Visible proportion.'
},
zoomPosition: {
type: 'number',
minimum: 0,
maximum: 1,
description: 'Start position.'
}
},
required: ['axis', 'zoomFactor', 'zoomPosition']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'resetChartZoom',
description: 'Resets zoom on a primary axis, named secondary axis, or all chart axes.',
inputSchema: {
type: 'object',
properties: {
axis: {
type: 'string',
enum: ['x', 'y'],
description: 'Optional primary axis to reset when axisName is not provided.'
},
axisName: {
type: 'string',
minLength: 1,
maxLength: 255,
description: 'Optional named secondary axis to reset.'
}
},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'selectChartPoints',
description: 'Sets selected series and point indexes when the configured selection mode supports them.',
inputSchema: {
type: 'object',
properties: {
indexes: {
type: 'array',
items: { type: 'object' },
description: 'Objects containing series and point indexes.'
},
selectionMode: {
type: 'string',
enum: ['Point', 'Series', 'Cluster'],
description: 'Optional compatible selection mode.'
}
},
required: ['indexes']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'clearChartSelection',
description: 'Clears all selected chart points, series, or clusters.',
inputSchema: {
type: 'object',
properties: {},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'addChartAxis',
description: 'Adds one or more named secondary axes. Use updateChartSeries to bind a series to an added axis.',
inputSchema: {
type: 'object',
properties: {
axes: {
type: 'array',
minItems: 1,
items: { type: 'object' },
description: 'AxisModel definitions. Every secondary axis must have a unique name.'
}
},
required: ['axes']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'updateChartAxis',
description: 'Updates the x-axis or y-axis configuration without removing the axis. ' +
'Use axisName to target a named secondary axis; omit it to update the primary axis.',
inputSchema: {
type: 'object',
properties: {
axis: {
type: 'string',
enum: ['x', 'y'],
description: 'Selects the x-axis or y-axis.'
},
axisName: {
type: 'string',
description: 'Optional secondary axis name, such as webmcpAxis.'
},
properties: {
type: 'object',
description: 'Axis properties such as title, minimum, maximum, interval, opposedPosition, or labelIntersectAction.'
}
},
required: ['axis', 'properties']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'updateChartTitle',
description: 'Updates the chart title and optional subtitle.',
inputSchema: {
type: 'object',
properties: {
title: {
type: 'string',
maxLength: 500,
description: 'New chart title.'
},
subTitle: {
type: 'string',
maxLength: 500,
description: 'New subtitle or an empty string.'
}
},
required: ['title']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
},
{
name: 'hideChartTooltip',
description: 'Hides the currently displayed chart tooltip.',
inputSchema: {
type: 'object',
properties: {},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: false
}
},
{
name: 'hideChartCrosshair',
description: 'Hides the currently displayed chart crosshair.',
inputSchema: {
type: 'object',
properties: {},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: false
}
},
{
name: 'getChartPersistedState',
description: 'Returns the chart persisted state string for diagnostics or application-managed storage.',
inputSchema: {
type: 'object',
properties: {},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: true
}
},
{
name: 'updateChart',
description: 'Updates supported chart-level properties including axes, legend, tooltip, crosshair, zoom, selection, title, and appearance.',
inputSchema: {
type: 'object',
properties: {
properties: {
type: 'object',
minProperties: 1,
description: 'Supported Chart properties to apply.'
}
},
required: ['properties']
},
outputSchema: outputSchema,
annotations: { readOnlyHint: false, untrustedContentHint: false }
},
{
name: 'updateChartSeries',
description: 'Updates an existing series including its type, data, mappings, axes, style, marker, data labels, visibility, and animation.',
inputSchema: {
type: 'object',
properties: {
seriesIndex: { type: 'integer', minimum: 0, description: 'Zero-based series index.' },
properties: { type: 'object', minProperties: 1, description: 'Supported SeriesModel properties to apply.' }
},
required: ['seriesIndex', 'properties']
},
outputSchema: outputSchema,
annotations: { readOnlyHint: false, untrustedContentHint: false }
},
{
name: 'updateChartPoint',
description: 'Updates one chart data record including its value, color, visibility, and custom fields.',
inputSchema: {
type: 'object',
properties: {
seriesIndex: { type: 'integer', minimum: 0, description: 'Zero-based series index.' },
pointIndex: { type: 'integer', minimum: 0, description: 'Zero-based point index.' },
properties: { type: 'object', minProperties: 1, description: 'Data-record fields to update.' }
},
required: ['seriesIndex', 'pointIndex', 'properties']
},
outputSchema: outputSchema,
annotations: { readOnlyHint: false, untrustedContentHint: false }
},
{
name: 'appendChartData',
description: 'Appends records to a chart series and optionally removes older records to preserve a maximum point count.',
inputSchema: {
type: 'object',
properties: {
seriesIndex: { type: 'integer', minimum: 0, description: 'Zero-based series index.' },
data: { type: 'array', minItems: 1, items: { type: 'object' }, description: 'Data records to append.' },
maxPoints: { type: 'integer', minimum: 1, maximum: 100000, description: 'Maximum records to retain.' }
},
required: ['seriesIndex', 'data']
},
outputSchema: outputSchema,
annotations: { readOnlyHint: false, untrustedContentHint: false }
},
{
name: 'removeChartPoints',
description: 'Removes a bounded number of data records from a chart series beginning at the specified point index.',
inputSchema: {
type: 'object',
properties: {
seriesIndex: { type: 'integer', minimum: 0, description: 'Zero-based series index.' },
startIndex: { type: 'integer', minimum: 0, description: 'First data-record index to remove.' },
count: { type: 'integer', minimum: 1, description: 'Number of records to remove.' }
},
required: ['seriesIndex', 'startIndex', 'count']
},
outputSchema: outputSchema,
annotations: { readOnlyHint: false, untrustedContentHint: false }
},
{
name: 'getChartPoint',
description: 'Returns JSON-safe information for one chart point identified by its series and point indexes.',
inputSchema: {
type: 'object',
properties: {
seriesIndex: { type: 'integer', minimum: 0, description: 'Zero-based series index.' },
pointIndex: { type: 'integer', minimum: 0, description: 'Zero-based point index.' }
},
required: ['seriesIndex', 'pointIndex']
},
outputSchema: outputSchema,
annotations: { readOnlyHint: true, untrustedContentHint: true }
},
{
name: 'getChartPointAtPosition',
description: 'Returns the chart point nearest to chart-local coordinates within an optional maximum pixel distance.',
inputSchema: {
type: 'object',
properties: {
x: { type: 'number', description: 'Chart-local horizontal coordinate.' },
y: { type: 'number', description: 'Chart-local vertical coordinate.' },
maxDistance: { type: 'number', minimum: 0, description: 'Maximum distance in pixels. Defaults to 30.' }
},
required: ['x', 'y']
},
outputSchema: outputSchema,
annotations: { readOnlyHint: true, untrustedContentHint: true }
},
{
name: 'getSelectedChartData',
description: 'Returns the currently selected chart points with their indexes, series metadata, and values.',
inputSchema: { type: 'object', properties: {}, required: [] },
outputSchema: outputSchema,
annotations: { readOnlyHint: true, untrustedContentHint: true }
},
{
name: 'getChartVisibleSeries',
description: 'Returns JSON-safe metadata and rendered point data for all computed visible chart series.',
inputSchema: {
type: 'object',
properties: {},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: true
}
},
{
name: 'getChartAxes',
description: 'Returns JSON-safe metadata for the primary axes and all configured secondary axes.',
inputSchema: { type: 'object', properties: {}, required: [] },
outputSchema: outputSchema,
annotations: { readOnlyHint: true, untrustedContentHint: true }
},
{
name: 'getChartIndicators',
description: 'Returns JSON-safe metadata for all technical indicators configured in the chart.',
inputSchema: { type: 'object', properties: {}, required: [] },
outputSchema: outputSchema,
annotations: { readOnlyHint: true, untrustedContentHint: true }
},
{
name: 'getChartStriplines',
description: 'Returns JSON-safe stripline metadata from all chart axes or one specified axis.',
inputSchema: {
type: 'object',
properties: {
axisName: {
type: 'string',
minLength: 1,
maxLength: 255,
description: 'Optional primaryXAxis, primaryYAxis, or secondary-axis name.'
}
},
required: []
},
outputSchema: outputSchema,
annotations: { readOnlyHint: true, untrustedContentHint: true }
},
{
name: 'removeChartAxis',
description: 'Removes a secondary axis by name or zero-based index and optionally resets referencing series bindings.',
inputSchema: {
type: 'object',
properties: {
axisName: { type: 'string', minLength: 1, maxLength: 255, description: 'Optional secondary-axis name.' },
axisIndex: { type: 'integer', minimum: 0, description: 'Optional zero-based secondary-axis index.' },
resetSeriesBindings: { type: 'boolean', description: 'Reset affected bindings. Defaults to true.' }
},
required: [],
oneOf: [{ required: ['axisName'] }, { required: ['axisIndex'] }]
},
outputSchema: outputSchema,
annotations: { readOnlyHint: false, untrustedContentHint: false }
},
{
name: 'getChartAnnotations',
description: 'Returns JSON-safe metadata for all configured chart annotations.',
inputSchema: { type: 'object', properties: {}, required: [] },
outputSchema: outputSchema,
annotations: { readOnlyHint: true, untrustedContentHint: true }
},
{
name: 'addChartAnnotation',
description: 'Adds one or more JSON-serializable chart annotations after sanitizing their content.',
inputSchema: {
type: 'object',
properties: {
annotations: { type: 'array', minItems: 1, items: { type: 'object' }, description: 'Annotations to add.' }
},
required: ['annotations']
},
outputSchema: outputSchema,
annotations: { readOnlyHint: false, untrustedContentHint: false }
},
{
name: 'removeChartAnnotation',
description: 'Removes one chart annotation using its zero-based annotation index.',
inputSchema: {
type: 'object',
properties: {
annotationIndex: { type: 'integer', minimum: 0, description: 'Zero-based annotation index.' }
},
required: ['annotationIndex']
},
outputSchema: outputSchema,
annotations: { readOnlyHint: false, untrustedContentHint: false }
},
{
name: 'animateChart',
description: 'Requests chart animation using an optional duration in milliseconds.',
inputSchema: {
type: 'object',
properties: {
duration: {
type: 'integer',
minimum: 0,
maximum: 60000,
description: 'Animation duration in milliseconds.'
}
},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: false
}
},
{
name: 'getChartLegend',
description: 'Returns configured legend settings and metadata for the rendered legend items.',
inputSchema: {
type: 'object',
properties: {},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: true
}
},
{
name: 'getChartLocalization',
description: 'Returns the localized Chart label resolved for a supplied resource key.',
inputSchema: {
type: 'object',
properties: {
key: {
type: 'string',
minLength: 1,
maxLength: 255,
description: 'Localization resource key to resolve.'
}
},
required: ['key']
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: true,
untrustedContentHint: true
}
},
{
name: 'refreshChartSize',
description: 'Recalculates the chart size after its containing element is resized.',
inputSchema: {
type: 'object',
properties: {},
required: []
},
outputSchema: outputSchema,
annotations: {
readOnlyHint: false,
untrustedContentHint: false
}
}
];
var WebMcpAdapter = (function () {
function WebMcpAdapter(parent) {
var _this = this;
this.webMcpAbortController = null;
this.registrationTimer = null;
this.parent = parent;
this.addEventListener();
var registrationArgs = this.parent.webMcpRegistrationArgs;
if (registrationArgs) {
this.registrationTimer = window.setTimeout(function () {
_this.registrationTimer = null;
Eif (_this.parent && !_this.parent.isDestroyed) {
_this.registerTools(registrationArgs);
}
}, 0);
}
}
WebMcpAdapter.prototype.addEventListener = function () {
this.parent.on(constants_1.webMcpGetTools, this.getTools, this);
this.parent.on(constants_1.webMcpRegisterTools, this.registerTools, this);
};
WebMcpAdapter.prototype.removeEventListener = function () {
if (!this.parent || this.parent.isDestroyed) {
return;
}
this.parent.off(constants_1.webMcpGetTools, this.getTools);
this.parent.off(constants_1.webMcpRegisterTools, this.registerTools);
};
WebMcpAdapter.prototype.getTools = function (args) {
var _this = this;
var toolNames = args.toolNames || [];
args.tools = toolNames.length
? webMcpTools
.filter(function (tool) { return toolNames.indexOf(tool.name) !== -1; })
.map(function (tool) { return _this.createExecutableToolCopy(tool); })
: webMcpTools.map(function (tool) { return _this.createExecutableToolCopy(tool); });
return args.tools;
};
WebMcpAdapter.prototype.createExecutableToolCopy = function (tool) {
var copy = JSON.parse(JSON.stringify(tool));
copy.execute = this.createBuiltInExecuteHandler(tool.name);
return copy;
};
WebMcpAdapter.prototype.createBuiltInExecuteHandler = function (command) {
var _this = this;
var chart = this.getActiveChart();
return function (input) { return __awaiter(_this, void 0, void 0, function () {
var adapter;
return __generator(this, function (_a) {
if (!chart || chart.isDestroyed) {
return [2, this.createUnavailableChartResponse(command)];
}
adapter = chart.webMcpAdapterModule;
Iif (!adapter) {
return [2, this.createUnavailableChartResponse(command)];
}
return [2, adapter.executeHandler(command, input || {})];
});
}); };
};
WebMcpAdapter.prototype.createUnavailableChartResponse = function (command) {
return {
content: [
{
type: 'text',
text: JSON.stringify({
success: false,
data: {},
message: "Tool \"" + command + "\" failed: The chart instance is unavailable."
})
}
],
isError: true
};
};
WebMcpAdapter.prototype.registerTools = function (args) {
var _this = this;
var chart = this.getActiveChart();
var modelContext = document.modelContext;
if (!modelContext || typeof modelContext.registerTool !== 'function') {
return;
}
if (this.webMcpAbortController) {
this.webMcpAbortController.abort();
this.webMcpAbortController = null;
}
if (args.tools && args.tools.length === 0) {
return;
}
var abortController = new AbortController();
this.webMcpAbortController = abortController;
var prefix = ej2_base_1.isNullOrUndefined(args.prefix) ? chart.element.id : args.prefix;
var tools = args.tools && args.tools.length && typeof args.tools[0] === 'object'
? args.tools
: this.getTools({ toolNames: args.tools });
tools.forEach(function (tool) {
var baseName = tool.name;
var builtInTool = webMcpTools.some(function (item) { return item.name === baseName; });
var execute = builtInTool ? _this.createBuiltInExecuteHandler(baseName) : tool.execute;
if (typeof execute !== 'function') {
return;
}
var registeredTool = __assign({}, tool, { inputSchema: tool.inputSchema ? JSON.parse(JSON.stringify(tool.inputSchema)) : tool.inputSchema, outputSchema: tool.outputSchema ? JSON.parse(JSON.stringify(tool.outputSchema)) : tool.outputSchema, name: prefix ? prefix + "_" + baseName : baseName, execute: execute });
try {
modelContext.registerTool(registeredTool, {
signal: abortController.signal,
exposedTo: args.exposedTo
});
}
catch (error) {
}
});
};
WebMcpAdapter.prototype.executeHandler = function (command, args) {
return __awaiter(this, void 0, void 0, function () {
var chart, tool, annotations, eventArgs, summary, error_1, message;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 4]);
chart = this.getActiveChart();
tool = webMcpTools.filter(function (item) { return item.name === command; })[0];
if (!tool) {
return [2, this.error("Tool \"" + command + "\" not found.")];
}
annotations = tool.annotations;
eventArgs = {
toolName: command,
toolArgs: args,
showConfirmationDialog: !annotations || annotations.readOnlyHint !== true
};
chart.trigger('beforeWebMcpToolExecute', eventArgs);
if (eventArgs.cancel) {
return [2, this.message({
action: command,
cancelled: true,
message: eventArgs.cancellationResponse || "[USER_CANCELLED] Tool \"" + command + "\" was cancelled. This is final. Do NOT retry."
})];
}
if (!eventArgs.showConfirmationDialog) return [3, 2];
summary = this.buildConfirmationMessage(command, args);
return [4, this.requestConfirmation(command, args, summary)];
case 1:
if (!(_a.sent())) {
return [2, this.message({
action: command,
cancelled: true,
message: eventArgs.cancellationResponse || "[USER_CANCELLED] User denied: \"" + summary + "\". This is final. Do NOT retry."
})];
}
_a.label = 2;
case 2:
switch (command) {
case 'inspectChart':
return [2, this.handleInspectChart(args)];
case 'getSeriesData':
return [2, this.handleGetSeriesData(args)];
case 'getAxisValueAtPosition':
return [2, this.handleGetAxisValueAtPosition(args)];
case 'addChartSeries':
return [2, this.handleAddChartSeries(args)];
case 'removeChartSeries':
return [2, this.handleRemoveChartSeries(args)];
case 'clearChartSeries':
return [2, this.handleClearChartSeries()];
case 'updateChartAnnotation':
return [2, this.handleUpdateChartAnnotation(args)];
case 'showChartTooltip':
return [2, this.handleShowChartTooltip(args)];
case 'showChartCrosshair':
return [2, this.handleShowChartCrosshair(args)];
case 'exportChart':
return [2, this.handleExportChart(args)];
case 'printChart':
return [2, this.handlePrintChart(args)];
case 'refreshChartData':
return [2, this.handleRefreshChartData()];
case 'updateChartDataSource':
return [2, this.handleUpdateChartDataSource(args)];
case 'updateChart':
return [2, this.handleUpdateChart(args)];
case 'updateChartSeries':
return [2, this.handleUpdateChartSeries(args)];
case 'updateChartPoint':
return [2, this.handleUpdateChartPoint(args)];
case 'appendChartData':
return [2, this.handleAppendChartData(args)];
case 'removeChartPoints':
return [2, this.handleRemoveChartPoints(args)];
case 'getChartPoint':
return [2, this.handleGetChartPoint(args)];
case 'getChartPointAtPosition':
return [2, this.handleGetChartPointAtPosition(args)];
case 'getSelectedChartData':
return [2, this.handleGetSelectedChartData()];
case 'getChartVisibleSeries':
return [2, this.handleGetChartVisibleSeries()];
case 'getChartLegend':
return [2, this.handleGetChartLegend()];
case 'getChartLocalization':
return [2, this.handleGetChartLocalization(args)];
case 'getChartAxes':
return [2, this.handleGetChartAxes()];
case 'getChartIndicators':
return [2, this.handleGetChartIndicators()];
case 'getChartStriplines':
return [2, this.handleGetChartStriplines(args)];
case 'removeChartAxis':
return [2, this.handleRemoveChartAxis(args)];
case 'getChartAnnotations':
return [2, this.handleGetChartAnnotations()];
case 'addChartAnnotation':
return [2, this.handleAddChartAnnotation(args)];
case 'removeChartAnnotation':
return [2, this.handleRemoveChartAnnotation(args)];
case 'toggleChartSeriesVisibility':
return [2, this.handleToggleChartSeriesVisibility(args)];
case 'configureChartZoom':
return [2, this.handleConfigureChartZoom(args)];
case 'resetChartZoom':
return [2, this.handleResetChartZoom(args)];
case 'selectChartPoints':
return [2, this.handleSelectChartPoints(args)];
case 'clearChartSelection':
return [2, this.handleClearChartSelection()];
case 'addChartAxis':
return [2, this.handleAddChartAxis(args)];
case 'updateChartAxis':
return [2, this.handleUpdateChartAxis(args)];
case 'updateChartTitle':
return [2, this.handleUpdateChartTitle(args)];
case 'hideChartTooltip':
return [2, this.handleHideChartTooltip()];
case 'hideChartCrosshair':
return [2, this.handleHideChartCrosshair()];
case 'getChartPersistedState':
return [2, this.handleGetChartPersistedState()];
case 'refreshChartSize':
return [2, this.handleRefreshChartSize()];
case 'animateChart':
return [2, this.handleAnimateChart(args)];
default:
return [2, this.error("Tool \"" + command + "\" not found.")];
}
return [3, 4];
case 3:
error_1 = _a.sent();
message = error_1 instanceof Error ? error_1.message : 'The operation failed.';
return [2, this.error("Tool \"" + command + "\" failed: " + message)];
case 4: return [2];
}
});
});
};
WebMcpAdapter.prototype.destroy = function () {
this.removeEventListener();
Iif (this.registrationTimer !== null) {
window.clearTimeout(this.registrationTimer);
this.registrationTimer = null;
}
if (this.webMcpAbortController) {
this.webMcpAbortController.abort();
this.webMcpAbortController = null;
}
this.parent = null;
};
WebMcpAdapter.prototype.getModuleName = function () {
return 'WebMcpAdapter';
};
WebMcpAdapter.prototype.message = function (data) {
return { content: [{ type: 'text', text: JSON.stringify(data) }] };
};
WebMcpAdapter.prototype.error = function (text) {
return {
content: [{ type: 'text', text: JSON.stringify({ success: false, data: {}, message: text }) }],
isError: true
};
};
WebMcpAdapter.prototype.buildConfirmationMessage = function (command, args) {
var details = '';
try {
details = JSON.stringify(args).substring(0, 300);
}
catch (error) {
details = '[arguments unavailable]';
}
return "Confirm chart operation \"" + command + "\"" + (details ? " with " + details : '');
};
WebMcpAdapter.prototype.requestConfirmation = function (command, args, message) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
Iif (typeof window === 'undefined' || typeof window.confirm !== 'function') {
return [2, false];
}
return [2, window.confirm(message)];
});
});
};
WebMcpAdapter.prototype.handleInspectChart = function (args) {
var chart = this.getActiveChart();
var includeSeries = args.includeSeries !== false;
var series = includeSeries
? chart.series.map(function (item, index) { return ({
index: ej2_base_1.isNullOrUndefined(item.index) ? index : item.index,
name: item.name,
type: item.type,
visible: item.visible,
xName: item.xName,
yName: item.yName,
pointCount: item.points ? item.points.length : 0
}); })
: [];
return this.success({
id: chart.element && chart.element.id,
title: chart.title,
subTitle: chart.subTitle,
width: chart.width,
height: chart.height,
theme: chart.theme,
enableCanvas: chart.enableCanvas,
enableExport: chart.enableExport,
allowExport: chart.allowExport,
tooltipEnabled: chart.tooltip && chart.tooltip.enable,
crosshairEnabled: chart.crosshair && chart.crosshair.enable,
legendVisible: chart.legendSettings && chart.legendSettings.visible,
highlightEnabled: chart.highlightMode !== 'None',
highlightMode: chart.highlightMode,
selectionMode: chart.selectionMode,
selectedDataCount: chart.selectedDataIndexes ? chart.selectedDataIndexes.length : 0,
indicatorCount: chart.indicators ? chart.indicators.length : 0,
rangeColorSettingsCount: chart.rangeColorSettings ? chart.rangeColorSettings.length : 0,
hasStriplines: this.hasChartStriplines(chart),
zoomSettings: chart.zoomSettings
? {
enableSelectionZooming: chart.zoomSettings.enableSelectionZooming,
enablePinchZooming: chart.zoomSettings.enablePinchZooming,
enableMouseWheelZooming: chart.zoomSettings.enableMouseWheelZooming,
enablePan: chart.zoomSettings.enablePan,
mode: chart.zoomSettings.mode
}
: null,
primaryXAxis: this.serializeAxis(chart.primaryXAxis),
primaryYAxis: this.serializeAxis(chart.primaryYAxis),
secondaryAxisCount: chart.axes ? chart.axes.length : 0,
series: series
}, 'Chart snapshot retrieved successfully.');
};
WebMcpAdapter.prototype.handleGetSeriesData = function (args) {
var chart = this.getActiveChart();
this.validateIndex(args.seriesIndex, chart.series.length, 'seriesIndex');
var series = chart.series[args.seriesIndex];
var maxPoints = ej2_base_1.isNullOrUndefined(args.maxPoints) ? 100 : args.maxPoints;
if (!this.isInteger(maxPoints) || maxPoints < 1 || maxPoints > 10000) {
throw new Error('maxPoints must be an integer between 1 and 10000.');
}
var allPoints = series.points || [];
var visiblePoints = args.includeHiddenPoints
? allPoints
: allPoints.filter(function (point) { return point.visible !== false; });
var points = visiblePoints.slice(0, maxPoints).map(function (point, index) { return ({
index: ej2_base_1.isNullOrUndefined(point.index) ? index : point.index,
x: point.x,
xValue: point.xValue,
y: point.y,
yValue: point.yValue,
high: point.high,
low: point.low,
open: point.open,
close: point.close,
visible: point.visible
}); });
return this.success({
seriesIndex: args.seriesIndex,
name: series.name,
type: series.type,
visible: series.visible,
totalPoints: visiblePoints.length,
points: points,
truncated: visiblePoints.length > points.length
}, 'Series data retrieved successfully.');
};
WebMcpAdapter.prototype.handleGetAxisValueAtPosition = function (args) {
var chart = this.getActiveChart();
this.validateFiniteNumber(args.x, 'x');
this.validateFiniteNumber(args.y, 'y');
return this.success({ axisValues: chart.FindXYPointValue(args.x, args.y) }, 'Axis values calculated successfully.');
};
WebMcpAdapter.prototype.handleAddChartSeries = function (args) {
this.validateObjectArray(args.series, 'series');
var chart = this.getActiveChart();
var addedCount = args.series.length;
var response = this.success({
addedCount: addedCount,
seriesCount: chart.series.length + addedCount
}, 'Chart series added successfully.');
chart.addSeries(args.series);
return response;
};
WebMcpAdapter.prototype.handleRemoveChartSeries = function (args) {
var chart = this.getActiveChart();
this.validateIndex(args.seriesIndex, chart.series.length, 'seriesIndex');
var response = this.success({
removedIndex: args.seriesIndex,
seriesCount: chart.series.length - 1
}, 'Chart series removed successfully.');
chart.removeSeries(args.seriesIndex);
return response;
};
WebMcpAdapter.prototype.handleClearChartSeries = function () {
var chart = this.getActiveChart();
var clearedCount = chart.series.length;
var response = this.success({
clearedCount: clearedCount,
seriesCount: 0,
visibleSeriesCount: 0
}, 'Chart series cleared successfully.');
chart.clearSeries();
return response;
};
WebMcpAdapter.prototype.getActiveChart = function () {
Iif (!this.parent || this.parent.isDestroyed) {
throw new Error('The chart instance is unavailable.');
}
return this.parent;
};
WebMcpAdapter.prototype.handleUpdateChartAnnotation = function (args) {
var chart = this.getActiveChart();
this.validateIndex(args.annotationIndex, chart.annotations.length, 'annotationIndex');
if (typeof args.content !== 'string') {
throw new Error('content must be a string.');
}
Iif (!chart.annotationModule) {
throw new Error('The annotation module is not enabled.');
}
chart.setAnnotationValue(args.annotationIndex, ej2_base_1.SanitizeHtmlHelper.sanitize(args.content));
return this.success({
annotationIndex: args.annotationIndex,
contentUpdated: true
}, 'Chart annotation updated successfully.');
};
WebMcpAdapter.prototype.handleShowChartTooltip = function (args) {
var chart = this.getActiveChart();
Iif (!chart.tooltipModule || !chart.markerRender) {
throw new Error('The tooltip module is not enabled.');
}
this.validateFiniteNumber(args.y, 'y');
if (!args.isPoint && typeof args.x !== 'number') {
throw new Error('x must be a number when isPoint is false.');
}
Eif (typeof args.x === 'number') {
this.validateFiniteNumber(args.x, 'x');
}
chart.showTooltip(args.x, args.y, args.isPoint === true);
return this.success({
isPoint: args.isPoint === true,
tooltipRequested: true
}, 'Chart tooltip requested successfully.');
};
WebMcpAdapter.prototype.handleShowChartCrosshair = function (args) {
var chart = this.getActiveChart();
Iif (!chart.crosshairModule || !chart.chartAxisLayoutPanel) {
throw new Error('The crosshair module is not enabled.');
}
this.validateFiniteNumber(args.x, 'x');
this.validateFiniteNumber(args.y, 'y');
chart.showCrosshair(args.x, args.y);
return this.success({
x: args.x,
y: args.y,
crosshairRequested: true
}, 'Chart crosshair requested successfully.');
};
WebMcpAdapter.prototype.handleExportChart = function (args) {
var chart = this.getActiveChart();
Iif (!chart.exportModule || (!chart.enableExport && !chart.allowExport)) {
throw new Error('The export module is not enabled.');
}
var supportedTypes = ['PNG', 'JPEG', 'SVG', 'PDF', 'XLSX', 'CSV'];
if (supportedTypes.indexOf(args.type) === -1) {
throw new Error('type must be PNG, JPEG, SVG, PDF, XLSX, or CSV.');
}
this.validateFileName(args.fileName);
chart.export(args.type, args.fileName);
return this.success({
type: args.type,
fileName: args.fileName,
exportRequested: true
}, 'Chart export requested successfully.');
};
WebMcpAdapter.prototype.handlePrintChart = function (args) {
var chart = this.getActiveChart();
Eif (!ej2_base_1.isNullOrUndefined(args.elementIds)) {
if (typeof args.elementIds !== 'string' && !Array.isArray(args.elementIds)) {
throw new Error('elementIds must be a string or an array of strings.');
}
var ids = typeof args.elementIds === 'string' ? [args.elementIds] : args.elementIds;
if (ids.some(function (id) { return typeof id !== 'string' || !id || id.length > 255; })) {
throw new Error('elementIds must contain non-empty strings of 255 characters or fewer.');
}
}
chart.print(args.elementIds);
return this.success({ printRequested: true }, 'Chart print requested successfully.');
};
WebMcpAdapter.prototype.handleRefreshChartData = function () {
var chart = this.getActiveChart();
chart.refreshLiveData();
return this.success({ refreshed: true }, 'Chart data refreshed successfully.');
};
WebMcpAdapter.prototype.handleUpdateChartDataSource = function (args) {
var chart = this.getActiveChart();
var dataSource = args.dataSource;
if (ej2_base_1.isNullOrUndefined(dataSource) && !args.series) {
throw new Error('dataSource or series must be provided.');
}
if (!ej2_base_1.isNullOrUndefined(dataSource)) {
this.validateObjectArray(dataSource, 'dataSource', true);
}
if (args.series) {
this.validateObjectArray(args.series, 'series');
var indexes = [];
for (var _i = 0, _a = args.series; _i < _a.length; _i++) {
var update = _a[_i];
this.validateIndex(update.index, chart.series.length, 'series index');
if (indexes.indexOf(update.index) !== -1) {
throw new Error("Series index " + update.index + " is duplicated.");
}
this.validateObjectArray(update.dataSource, "series." + update.index + ".dataSource", true);
indexes.push(update.index);
}
}
if (!ej2_base_1.isNullOrUndefined(dataSource)) {
chart.dataSource = dataSource;
}
var updatedSeriesCount = 0;
if (args.series) {
for (var _b = 0, _c = args.series; _b < _c.length; _b++) {
var update = _c[_b];
chart.series[update.index].dataSource = update.dataSource;
updatedSeriesCount++;
}
}
chart.dataBind();
return this.success({
recordCount: dataSource ? dataSource.length : 0,
updatedSeriesCount: updatedSeriesCount
}, 'Chart data source updated successfully.');
};
WebMcpAdapter.prototype.handleUpdateChart = function (args) {
var chart = this.getActiveChart();
this.validateProperties(args.properties, 'properties');
var allowedProperties = [
'title',
'subTitle',
'titleStyle',
'subTitleStyle',
'width',
'height',
'background',
'backgroundImage',
'theme',
'margin',
'border',
'chartArea',
'primaryXAxis',
'primaryYAxis',
'rows',
'columns',
'axes',
'annotations',
'tooltip',
'crosshair',
'legendSettings',
'zoomSettings',
'selectionMode',
'highlightMode',
'selectedDataIndexes',
'isMultiSelect',
'enableAnimation',
'animationMode',
'enableCanvas',
'enableExport',
'allowExport',
'enableAutoIntervalOnBothAxis',
'enableSideBySidePlacement',
'enableRtl',
'locale',
'currencyCode',
'useGroupingSeparator',
'description',
'tabIndex',
'highlightColor',
'highlightPattern',
'selectionPattern',
'indicators',
'rangeColorSettings'
];
var updatedProperties = this.validateAllowedProperties(args.properties, allowedProperties, 'Chart');
var properties = this.cloneProperties(args.properties);
if (!ej2_base_1.isNullOrUndefined(properties.title)) {
this.validateString(properties.title, 'title', 500, true);
properties.title = ej2_base_1.SanitizeHtmlHelper.sanitize(properties.title);
}
if (!ej2_base_1.isNullOrUndefined(properties.subTitle)) {
this.validateString(properties.subTitle, 'subTitle', 500, true);
properties.subTitle = ej2_base_1.SanitizeHtmlHelper.sanitize(properties.subTitle);
}
Iif (Array.isArray(properties.annotations)) {
properties.annotations = properties.annotations.map(function (annotation) {
var copy = __assign({}, annotation);
if (typeof copy.content === 'string') {
copy.content = ej2_base_1.SanitizeHtmlHelper.sanitize(copy.content);
}
return copy;
});
}
if (Array.isArray(properties.indicators)) {
properties.indicators = properties.indicators.map(function (indicator) {
var copy = __assign({}, indicator);
Eif (typeof copy.seriesName === 'string') {
copy.seriesName = ej2_base_1.SanitizeHtmlHelper.sanitize(copy.seriesName);
}
return copy;
});
}
var response = this.success({ updatedProperties: updatedProperties }, 'Chart configuration updated successfully.');
chart.setProperties(properties, true);
chart.refresh();
return response;
};
WebMcpAdapter.prototype.handleUpdateChartSeries = function (args) {
var chart = this.getActiveChart();
this.validateIndex(args.seriesIndex, chart.series.length, 'seriesIndex');
this.validateProperties(args.properties, 'properties');
var allowedProperties = [
'type',
'name',
'dataSource',
'xName',
'yName',
'high',
'low',
'open',
'close',
'volume',
'size',
'fill',
'width',
'opacity',
'dashArray',
'visible',
'xAxisName',
'yAxisName',
'zOrder',
'marker',
'dataLabel',
'animation',
'border',
'cornerRadius',
'columnWidth',
'columnSpacing',
'emptyPointSettings',
'errorBar',
'trendlines',
'tooltipMappingName',
'pointColorMapping',
'selectionStyle',
'unSelectedStyle',
'enableTooltip',
'legendShape',
'legendImageUrl',
'minRadius',
'maxRadius',
'splineType',
'cardinalSplineTension',
'step',
'binInterval',
'showNormalDistribution',
'connector',
'neckWidth',
'neckHeight',
'gapRatio',
'groupMode',
'groupTo',
'explode',
'explodeIndex',
'explodeOffset',
'explodeAll',
'startAngle',
'endAngle',
'radius',
'innerRadius',
'pyramidMode',
'drawType'
];
var updatedProperties = this.validateAllowedProperties(args.properties, allowedProperties, 'Series');
var properties = this.cloneProperties(args.properties);
if (!ej2_base_1.isNullOrUndefined(properties.name)) {
this.validateString(properties.name, 'name', 500, true);
properties.name = ej2_base_1.SanitizeHtmlHelper.sanitize(properties.name);
}
if (!ej2_base_1.isNullOrUndefined(properties.xAxisName)) {
this.validateAxisName(properties.xAxisName, 'xAxisName', chart);
}
if (!ej2_base_1.isNullOrUndefined(properties.yAxisName)) {
this.validateAxisName(properties.yAxisName, 'yAxisName', chart);
}
if (!ej2_base_1.isNullOrUndefined(properties.dataSource)) {
this.validateObjectArray(properties.dataSource, 'dataSource', true);
}
var response = this.success({
seriesIndex: args.seriesIndex,
updatedProperties: updatedProperties
}, 'Chart series updated successfully.');
var series = chart.series[args.seriesIndex];
ej2_base_1.extend(series, properties, null, true);
chart.refresh();
return response;
};
WebMcpAdapter.prototype.handleUpdateChartPoint = function (args) {
var chart = this.getActiveChart();
this.validateIndex(args.seriesIndex, chart.series.length, 'seriesIndex');
this.validateProperties(args.properties, 'properties');
var series = chart.series[args.seriesIndex];
var dataSource = this.getSeriesDataSource(series, chart);
this.validateIndex(args.pointIndex, dataSource.length, 'pointIndex');
var updatedProperties = Object.keys(args.properties);
var currentRecord = dataSource[args.pointIndex];
var properties = this.cloneProperties(args.properties);
for (var _i = 0, updatedProperties_1 = updatedProperties; _i < updatedProperties_1.length; _i++) {
var key = updatedProperties_1[_i];
this.validateSafePropertyName(key, 'Point');
Object.defineProperty(currentRecord, key, {
configurable: true,
enumerable: true,
writable: true,
value: Object.prototype.hasOwnProperty.call(properties, key) ? properties[key] : undefined
});
}
var response = this.success({
seriesIndex: args.seriesIndex,
pointIndex: args.pointIndex,
updatedProperties: updatedProperties
}, 'Chart point updated successfully.');
series.dataSource = dataSource;
chart.refresh();
return response;
};
WebMcpAdapter.prototype.handleAppendChartData = function (args) {
var chart = this.getActiveChart();
this.validateIndex(args.seriesIndex, chart.series.length, 'seriesIndex');
this.validateObjectArray(args.data, 'data');
if (!ej2_base_1.isNullOrUndefined(args.maxPoints) && (!this.isInteger(args.maxPoints) || args.maxPoints < 1)) {
throw new Error('maxPoints must be a positive integer.');
}
var series = chart.series[args.seriesIndex];
var dataSource = this.getSeriesDataSource(series, chart);
var appendedData = this.cloneProperties(args.data);
dataSource.push.apply(dataSource, appendedData);
var removedCount = 0;
if (!ej2_base_1.isNullOrUndefined(args.maxPoints) && dataSource.length > args.maxPoints) {
removedCount = dataSource.length - args.maxPoints;
dataSource.splice(0, removedCount);
}
var response = this.success({
seriesIndex: args.seriesIndex,
appendedCount: appendedData.length,
removedCount: removedCount,
totalPoints: dataSource.length
}, 'Chart data appended successfully.');
series.dataSource = dataSource;
chart.refresh();
return response;
};
WebMcpAdapter.prototype.handleRemoveChartPoints = function (args) {
var chart = this.getActiveChart();
this.validateIndex(args.seriesIndex, chart.series.length, 'seriesIndex');
var series = chart.series[args.seriesIndex];
var dataSource = this.getSeriesDataSource(series, chart);
this.validateIndex(args.startIndex, dataSource.length, 'startIndex');
if (!this.isInteger(args.count) || args.count < 1) {
throw new Error('count must be a positive integer.');
}
var removedCount = Math.min(args.count, dataSource.length - args.startIndex);
dataSource.splice(args.startIndex, removedCount);
var response = this.success({
seriesIndex: args.seriesIndex,
startIndex: args.startIndex,
removedCount: removedCount,
totalPoints: dataSource.length
}, 'Chart points removed successfully.');
series.dataSource = dataSource;
chart.refresh();
return response;
};
WebMcpAdapter.prototype.handleGetChartPoint = function (args) {
var chart = this.getActiveChart();
this.validateIndex(args.seriesIndex, chart.series.length, 'seriesIndex');
var series = chart.series[args.seriesIndex];
var points = series.points || [];
this.validateIndex(args.pointIndex, points.length, 'pointIndex');
return this.success({
seriesIndex: args.seriesIndex,
pointIndex: args.pointIndex,
seriesName: series.name,
seriesType: series.type,
point: this.serializePoint(points[args.pointIndex])
}, 'Chart point retrieved successfully.');
};
WebMcpAdapter.prototype.handleGetChartPointAtPosition = function (args) {
var chart = this.getActiveChart();
this.validateFiniteNumber(args.x, 'x');
this.validateFiniteNumber(args.y, 'y');
var maxDistance = ej2_base_1.isNullOrUndefined(args.maxDistance) ? 30 : args.maxDistance;
if (!isFinite(maxDistance) || maxDistance < 0) {
throw new Error('maxDistance must be a non-negative finite number.');
}
var nearestPoint = null;
var nearestDistance = Number.POSITIVE_INFINITY;
for (var seriesIndex = 0; seriesIndex < chart.series.length; seriesIndex++) {
var series = chart.series[seriesIndex];
var points = series.points || [];
for (var pointIndex = 0; pointIndex < points.length; pointIndex++) {
var point = points[pointIndex];
var location_1 = point.symbolLocations && point.symbolLocations.length ? point.symbolLocations[0] : null;
Iif (!location_1 || !series.clipRect) {
continue;
}
var pointX = location_1.x + series.clipRect.x;
var pointY = location_1.y + series.clipRect.y;
var distance = Math.sqrt(Math.pow(pointX - args.x, 2) + Math.pow(pointY - args.y, 2));
if (distance < nearestDistance) {
nearestDistance = distance;
nearestPoint = {
seriesIndex: seriesIndex,
pointIndex: pointIndex,
seriesName: series.name,
seriesType: series.type,
distance: distance,
point: this.serializePoint(point)
};
}
}
}
if (!nearestPoint || nearestDistance > maxDistance) {
return this.success({ point: null }, 'No chart point was found within the specified distance.');
}
return this.success({ point: nearestPoint }, 'Nearest chart point retrieved successfully.');
};
WebMcpAdapter.prototype.handleGetSelectedChartData = function () {
var chart = this.getActiveChart();
var selectedPoints = [];
for (var _i = 0, _a = chart.selectedDataIndexes; _i < _a.length; _i++) {
var index = _a[_i];
if (!this.isInteger(index.series) || !this.isInteger(index.point) || index.series < 0 || index.point < 0) {
continue;
}
if (index.series >= chart.series.length) {
continue;
}
var series = chart.series[index.series];
var points = series.points || [];
if (index.point >= points.length) {
continue;
}
selectedPoints.push({
seriesIndex: index.series,
pointIndex: index.point,
seriesName: series.name,
seriesType: series.type,
point: this.serializePoint(points[index.point])
});
}
return this.success({ selectedCount: selectedPoints.length, selectedPoints: selectedPoints }, 'Selected chart data retrieved successfully.');
};
WebMcpAdapter.prototype.handleGetChartVisibleSeries = function () {
var _this = this;
var chart = this.getActiveChart();
var visibleSeries = (chart.visibleSeries || [])
.filter(function (series) { return series.visible !== false; })
.map(function (series, index) { return ({
index: ej2_base_1.isNullOrUndefined(series.index) ? index : series.index,
name: series.name,
type: series.type,
visible: series.visible,
xName: series.xName,
yName: series.yName,
xAxisName: series.xAxisName,
yAxisName: series.yAxisName,
pointCount: series.points ? series.points.length : 0,
points: (series.points || []).map(function (point) { return _this.serializePoint(point); })
}); });
return this.success({
visibleSeriesCount: visibleSeries.length,
visibleSeries: visibleSeries
}, 'Visible chart series retrieved successfully.');
};
WebMcpAdapter.prototype.handleGetChartLegend = function () {
var chart = this.getActiveChart();
var legendModule = chart.legendModule;
var legendCollections = legendModule && Array.isArray(legendModule.legendCollections) ? legendModule.legendCollections : [];
var items = legendCollections.map(function (item, index) { return ({
index: index,
text: item.text,
fill: item.fill,
shape: item.shape,
visible: item.visible,
seriesIndex: item.seriesIndex,
pointIndex: item.pointIndex
}); });
return this.success({
visible: chart.legendSettings.visible,
position: chart.legendSettings.position,
alignment: chart.legendSettings.alignment,
title: chart.legendSettings.title,
itemCount: items.length,
items: items
}, 'Chart legend retrieved successfully.');
};
WebMcpAdapter.prototype.handleGetChartLocalization = function (args) {
var chart = this.getActiveChart();
this.validateString(args.key, 'key', 255);
return this.success({ key: args.key, value: chart.getLocalizedLabel(args.key) }, 'Chart localization label retrieved successfully.');
};
WebMcpAdapter.prototype.handleGetChartAxes = function () {
var _this = this;
var chart = this.getActiveChart();
var primaryXAxis = __assign({ isSecondary: false }, this.serializeAxis(chart.primaryXAxis));
var primaryYAxis = __assign({ isSecondary: false }, this.serializeAxis(chart.primaryYAxis));
var secondaryAxes = chart.axes.map(function (axis, index) { return (__assign({ index: index, isSecondary: true }, _this.serializeAxis(axis))); });
return this.success({ primaryXAxis: primaryXAxis, primaryYAxis: primaryYAxis, secondaryAxes: secondaryAxes }, 'Chart axes retrieved successfully.');
};
WebMcpAdapter.prototype.handleGetChartIndicators = function () {
var chart = this.getActiveChart();
var indicators = (chart.indicators || []).map(function (indicator, index) { return ({
index: index,
type: indicator.type,
seriesName: indicator.seriesName,
xName: indicator.xName,
open: indicator.open,
high: indicator.high,
low: indicator.low,
close: indicator.close,
volume: indicator.volume,
period: indicator.period,
field: indicator.field,
fastPeriod: indicator.fastPeriod,
slowPeriod: indicator.slowPeriod,
macdType: indicator.macdType,
standardDeviation: indicator.standardDeviation,
overBought: indicator.overBought,
overSold: indicator.overSold,
visible: indicator.visible,
xAxisName: indicator.xAxisName,
yAxisName: indicator.yAxisName,
fill: indicator.fill,
width: indicator.width,
dashArray: indicator.dashArray
}); });
return this.success({ indicatorCount: indicators.length, indicators: indicators }, 'Chart indicators retrieved successfully.');
};
WebMcpAdapter.prototype.handleGetChartStriplines = function (args) {
var _this = this;
var chart = this.getActiveChart();
var axes = [];
if (!ej2_base_1.isNullOrUndefined(args.axisName)) {
this.validateString(args.axisName, 'axisName', 255);
var axis = this.getAxisByName(chart, args.axisName);
axes.push({ name: args.axisName, axis: axis });
}
else {
axes.push({ name: 'primaryXAxis', axis: chart.primaryXAxis });
axes.push({ name: 'primaryYAxis', axis: chart.primaryYAxis });
for (var index = 0; index < chart.axes.length; index++) {
axes.push({ name: chart.axes[index].name || "secondaryAxis" + index, axis: chart.axes[index] });
}
}
var striplineAxes = [];
var striplineCount = 0;
for (var _i = 0, axes_1 = axes; _i < axes_1.length; _i++) {
var axisEntry = axes_1[_i];
var stripLines = axisEntry.axis && Array.isArray(axisEntry.axis.stripLines) ? axisEntry.axis.stripLines : [];
var striplines = stripLines.map(function (stripline, index) {
return _this.serializeStripline(stripline, index);
});
striplineCount += striplines.length;
striplineAxes.push({ axisName: axisEntry.name, striplineCount: striplines.length, striplines: striplines });
}
return this.success({ striplineCount: striplineCount, axes: striplineAxes }, 'Chart striplines retrieved successfully.');
};
WebMcpAdapter.prototype.handleRemoveChartAxis = function (args) {
var chart = this.getActiveChart();
var hasAxisName = !ej2_base_1.isNullOrUndefined(args.axisName);
var hasAxisIndex = !ej2_base_1.isNullOrUndefined(args.axisIndex);
if (hasAxisName === hasAxisIndex) {
throw new Error('Provide exactly one of axisName or axisIndex.');
}
var axisIndex;
if (hasAxisName) {
this.validateString(args.axisName, 'axisName', 255);
axisIndex = -1;
for (var index = 0; index < chart.axes.length; index++) {
Eif (chart.axes[index].name === args.axisName) {
axisIndex = index;
break;
}
}
if (axisIndex === -1) {
throw new Error("Axis \"" + args.axisName + "\" was not found.");
}
}
else {
this.validateIndex(args.axisIndex, chart.axes.length, 'axisIndex');
axisIndex = args.axisIndex;
}
var targetAxis = chart.axes.slice(axisIndex, axisIndex + 1)[0];
var axisName = targetAxis.name;
var resetBindings = args.resetSeriesBindings !== false;
var affectedSeriesIndexes = [];
chart.series.forEach(function (series, index) {
var usesXAxis = series.xAxisName === axisName;
var usesYAxis = series.yAxisName === axisName;
if (!usesXAxis && !usesYAxis) {
return;
}
if (!resetBindings) {
throw new Error("Axis \"" + axisName + "\" is used by series index " + index + ".");
}
if (usesXAxis) {
series.xAxisName = '';
}
if (usesYAxis) {
series.yAxisName = '';
}
affectedSeriesIndexes.push(index);
});
var response = this.success({ removedAxisName: axisName, removedAxisIndex: axisIndex, affectedSeriesIndexes: affectedSeriesIndexes, axisCount: chart.axes.length - 1 }, 'Chart axis removed successfully.');
chart.axes.splice(axisIndex, 1);
chart.refresh();
return response;
};
WebMcpAdapter.prototype.handleGetChartAnnotations = function () {
var _this = this;
var chart = this.getActiveChart();
var annotations = chart.annotations.map(function (annotation, index) { return (__assign({ index: index }, _this.serializeAnnotation(annotation))); });
return this.success({ annotationCount: annotations.length, annotations: annotations }, 'Chart annotations retrieved successfully.');
};
WebMcpAdapter.prototype.handleAddChartAnnotation = function (args) {
var _this = this;
var chart = this.getActiveChart();
this.validateObjectArray(args.annotations, 'annotations');
var annotations = this.cloneProperties(args.annotations);
for (var _i = 0, _a = annotations; _i < _a.length; _i++) {
var annotation = _a[_i];
Eif (typeof annotation.content === 'string') {
annotation.content = ej2_base_1.SanitizeHtmlHelper.sanitize(annotation.content);
}
}
var existingAnnotations = chart.annotations.map(function (annotation) { return _this.serializeAnnotation(annotation); });
var response = this.success({
addedCount: annotations.length,
annotationCount: existingAnnotations.length + annotations.length
}, 'Chart annotations added successfully.');
chart.setProperties({ annotations: existingAnnotations.concat(annotations) }, true);
chart.refresh();
return response;
};
WebMcpAdapter.prototype.handleRemoveChartAnnotation = function (args) {
var _this = this;
var chart = this.getActiveChart();
this.validateIndex(args.annotationIndex, chart.annotations.length, 'annotationIndex');
var annotations = chart.annotations.map(function (annotation) { return _this.serializeAnnotation(annotation); });
annotations.splice(args.annotationIndex, 1);
var response = this.success({
removedIndex: args.annotationIndex,
annotationCount: annotations.length
}, 'Chart annotation removed successfully.');
chart.setProperties({ annotations: annotations }, true);
chart.refresh();
return response;
};
WebMcpAdapter.prototype.handleToggleChartSeriesVisibility = function (args) {
var chart = this.getActiveChart();
this.validateIndex(args.seriesIndex, chart.series.length, 'seriesIndex');
if (typeof args.visible !== 'boolean') {
throw new Error('visible must be a boolean.');
}
chart.series[args.seriesIndex].visible = args.visible;
chart.dataBind();
return this.success({
seriesIndex: args.seriesIndex,
visible: args.visible
}, 'Series visibility updated successfully.');
};
WebMcpAdapter.prototype.handleConfigureChartZoom = function (args) {
var chart = this.getActiveChart();
Iif (args.axis !== 'x' && args.axis !== 'y') {
throw new Error('axis must be x or y.');
}
this.validateRange(args.zoomFactor, 'zoomFactor');
this.validateRange(args.zoomPosition, 'zoomPosition');
var axis = this.getZoomAxis(chart, args.axis, args.axisName);
axis.zoomFactor = args.zoomFactor;
axis.zoomPosition = args.zoomPosition;
chart.dataBind();
return this.success({
axis: args.axis,
axisName: args.axisName || (args.axis === 'x' ? 'primaryXAxis' : 'primaryYAxis'),
zoomFactor: args.zoomFactor,
zoomPosition: args.zoomPosition
}, 'Chart zoom updated successfully.');
};
WebMcpAdapter.prototype.handleResetChartZoom = function (args) {
var chart = this.getActiveChart();
var resetAxisNames = [];
if (!ej2_base_1.isNullOrUndefined(args.axis) && args.axis !== 'x' && args.axis !== 'y') {
throw new Error('axis must be x or y.');
}
if (!ej2_base_1.isNullOrUndefined(args.axisName)) {
var axis = this.getZoomAxis(chart, args.axis || 'x', args.axisName);
axis.zoomFactor = 1;
axis.zoomPosition = 0;
resetAxisNames.push(args.axisName);
}
else if (args.axis) {
var axis = this.getZoomAxis(chart, args.axis);
axis.zoomFactor = 1;
axis.zoomPosition = 0;
resetAxisNames.push(args.axis === 'x' ? 'primaryXAxis' : 'primaryYAxis');
}
else {
var axes = [chart.primaryXAxis, chart.primaryYAxis].concat(chart.axes);
for (var index = 0; index < axes.length; index++) {
axes[index].zoomFactor = 1;
axes[index].zoomPosition = 0;
resetAxisNames.push(index === 0 ? 'primaryXAxis' : index === 1 ? 'primaryYAxis' : axes[index].name || "secondaryAxis" + (index - 2));
}
}
chart.dataBind();
return this.success({ resetAxisNames: resetAxisNames, resetCount: resetAxisNames.length }, 'Chart zoom reset successfully.');
};
WebMcpAdapter.prototype.handleSelectChartPoints = function (args) {
var chart = this.getActiveChart();
this.validateObjectArray(args.indexes, 'indexes');
var validModes = ['Point', 'Series', 'Cluster'];
if (args.selectionMode && validModes.indexOf(args.selectionMode) === -1) {
throw new Error('selectionMode must be Point, Series, or Cluster.');
}
for (var _i = 0, _a = args.indexes; _i < _a.length; _i++) {
var item = _a[_i];
if (!this.isInteger(item.series) || !this.isInteger(item.point) || item.series < 0 || item.point < 0) {
throw new Error('Each selection index must contain non-negative integer series and point values.');
}
this.validateIndex(item.series, chart.series.length, 'selection series index');
var points = chart.series[item.series].points || [];
this.validateIndex(item.point, points.length, 'selection point index');
}
Eif (args.selectionMode) {
chart.selectionMode = args.selectionMode;
}
chart.selectedDataIndexes = args.indexes;
chart.dataBind();
return this.success({ selectedCount: args.indexes.length }, 'Chart points selected successfully.');
};
WebMcpAdapter.prototype.handleClearChartSelection = function () {
var chart = this.getActiveChart();
var clearedCount = chart.selectedDataIndexes ? chart.selectedDataIndexes.length : 0;
chart.selectedDataIndexes = [];
chart.dataBind();
return this.success({ clearedCount: clearedCount, selectedCount: 0 }, 'Chart selection cleared successfully.');
};
WebMcpAdapter.prototype.handleAddChartAxis = function (args) {
this.validateObjectArray(args.axes, 'axes');
var chart = this.getActiveChart();
var existingAxisNames = chart.axes
.map(function (axis) { return axis.name; })
.filter(function (name) { return !!name; });
var newAxisNames = [];
for (var _i = 0, _a = args.axes; _i < _a.length; _i++) {
var axisModel = _a[_i];
if (typeof axisModel.name !== 'string' || !axisModel.name.trim()) {
throw new Error('Each secondary axis must have a non-empty name.');
}
if (existingAxisNames.indexOf(axisModel.name) !== -1 || newAxisNames.indexOf(axisModel.name) !== -1) {
throw new Error("Axis \"" + axisModel.name + "\" already exists.");
}
newAxisNames.push(axisModel.name);
}
var response = this.success({
addedCount: args.axes.length,
axisCount: chart.axes.length + args.axes.length,
addedAxisNames: newAxisNames
}, 'Chart axes added successfully.');
chart.addAxes(args.axes);
return response;
};
WebMcpAdapter.prototype.handleUpdateChartAxis = function (args) {
if (args.axis !== 'x' && args.axis !== 'y') {
throw new Error('axis must be x or y.');
}
if (!args.properties || typeof args.properties !== 'object' || Array.isArray(args.properties)) {
throw new Error('properties must be an object.');
}
var chart = this.getActiveChart();
var targetAxis = args.axisName
? chart.axes.filter(function (axis) { return axis.name === args.axisName; })[0]
: args.axis === 'x'
? chart.primaryXAxis
: chart.primaryYAxis;
var axisName = args.axisName || (args.axis === 'x' ? 'primaryXAxis' : 'primaryYAxis');
Iif (!targetAxis) {
throw new Error("Axis \"" + axisName + "\" was not found.");
}
var allowedProperties = [
'title',
'minimum',
'maximum',
'interval',
'opposedPosition',
'isInversed',
'labelIntersectAction',
'labelRotation',
'edgeLabelPlacement',
'majorGridLines',
'minorGridLines',
'lineStyle',
'plotOffset',
'rowIndex',
'columnIndex',
'span',
'labelPlacement',
'valueType',
'crossesAt',
'labelFormat',
'visible'
];
var updatedProperties = [];
for (var _i = 0, _a = Object.keys(args.properties); _i < _a.length; _i++) {
var key = _a[_i];
this.validateSafePropertyName(key, 'Axis');
if (allowedProperties.indexOf(key) === -1) {
throw new Error("Axis property \"" + key + "\" is not supported.");
}
Object.defineProperty(targetAxis, key, {
configurable: true,
enumerable: true,
writable: true,
value: Object.prototype.hasOwnProperty.call(args.properties, key) ? args.properties[key] : undefined
});
updatedProperties.push(key);
}
var response = this.success({
axis: args.axis,
axisName: axisName,
updatedProperties: updatedProperties
}, 'Chart axis updated successfully.');
chart.refresh();
return response;
};
WebMcpAdapter.prototype.handleUpdateChartTitle = function (args) {
var chart = this.getActiveChart();
if (typeof args.title !== 'string' || args.title.length > 500) {
throw new Error('title must be a string of 500 characters or fewer.');
}
Iif (!ej2_base_1.isNullOrUndefined(args.subTitle) && (typeof args.subTitle !== 'string' || args.subTitle.length > 500)) {
throw new Error('subTitle must be a string of 500 characters or fewer.');
}
chart.title = ej2_base_1.SanitizeHtmlHelper.sanitize(args.title);
if (!ej2_base_1.isNullOrUndefined(args.subTitle)) {
chart.subTitle = ej2_base_1.SanitizeHtmlHelper.sanitize(args.subTitle);
}
chart.dataBind();
return this.success({
title: chart.title,
subTitle: chart.subTitle
}, 'Chart title updated successfully.');
};
WebMcpAdapter.prototype.handleHideChartTooltip = function () {
var chart = this.getActiveChart();
Iif (!chart.tooltipModule) {
throw new Error('The tooltip module is not enabled.');
}
chart.hideTooltip();
return this.success({ hidden: true }, 'Chart tooltip hidden successfully.');
};
WebMcpAdapter.prototype.handleHideChartCrosshair = function () {
var chart = this.getActiveChart();
Iif (!chart.crosshairModule) {
throw new Error('The crosshair module is not enabled.');
}
chart.hideCrosshair();
return this.success({ hidden: true }, 'Chart crosshair hidden successfully.');
};
WebMcpAdapter.prototype.handleGetChartPersistedState = function () {
var chart = this.getActiveChart();
return this.success({ persistedState: chart.getPersistData() }, 'Persisted chart state retrieved successfully.');
};
WebMcpAdapter.prototype.handleRefreshChartSize = function () {
var chart = this.getActiveChart();
chart.chartResize();
return this.success({ resized: true, width: chart.availableSize.width, height: chart.availableSize.height }, 'Chart size refreshed successfully.');
};
WebMcpAdapter.prototype.handleAnimateChart = function (args) {
var chart = this.getActiveChart();
var duration = args.duration;
if (typeof duration === 'number' && (!this.isInteger(duration) || duration < 0 || duration > 60000)) {
throw new Error('duration must be an integer between 0 and 60000.');
}
chart.animate(duration);
return this.success({
duration: ej2_base_1.isNullOrUndefined(duration) ? 1000 : duration
}, 'Chart animation requested successfully.');
};
WebMcpAdapter.prototype.getZoomAxis = function (chart, axis, axisName) {
if (!ej2_base_1.isNullOrUndefined(axisName)) {
this.validateString(axisName, 'axisName', 255);
return this.getAxisByName(chart, axisName);
}
return axis === 'x' ? chart.primaryXAxis : chart.primaryYAxis;
};
WebMcpAdapter.prototype.getAxisByName = function (chart, axisName) {
Iif (axisName === 'primaryXAxis') {
return chart.primaryXAxis;
}
if (axisName === 'primaryYAxis') {
return chart.primaryYAxis;
}
for (var index = 0; index < chart.axes.length; index++) {
Eif (chart.axes[index].name === axisName) {
return chart.axes[index];
}
}
throw new Error("Axis \"" + axisName + "\" was not found.");
};
WebMcpAdapter.prototype.hasChartStriplines = function (chart) {
var axes = [chart.primaryXAxis, chart.primaryYAxis].concat(chart.axes);
return axes.some(function (axis) { return !!(axis && axis.stripLines && axis.stripLines.length); });
};
WebMcpAdapter.prototype.serializeStripline = function (stripline, index) {
return {
index: index,
start: stripline.start,
end: stripline.end,
size: stripline.size,
isRepeat: stripline.isRepeat,
repeatEvery: stripline.repeatEvery,
repeatUntil: stripline.repeatUntil,
color: stripline.color,
opacity: stripline.opacity,
visible: stripline.visible,
text: stripline.text,
rotation: stripline.rotation,
horizontalAlignment: stripline.horizontalAlignment,
verticalAlignment: stripline.verticalAlignment,
startFromAxis: stripline.startFromAxis,
zIndex: stripline.zIndex
};
};
WebMcpAdapter.prototype.serializeRange = function (range) {
if (!range) {
return null;
}
return { min: range.min, max: range.max, interval: range.interval, delta: range.delta };
};
WebMcpAdapter.prototype.serializeAxis = function (axis) {
Iif (!axis) {
return null;
}
return {
name: axis.name,
valueType: axis.valueType,
title: axis.title,
minimum: axis.minimum,
maximum: axis.maximum,
interval: axis.interval,
zoomFactor: axis.zoomFactor,
zoomPosition: axis.zoomPosition,
isInversed: axis.isInversed,
opposedPosition: axis.opposedPosition,
visible: axis.visible,
actualRange: this.serializeRange(axis.actualRange),
visibleRange: this.serializeRange(axis.visibleRange)
};
};
WebMcpAdapter.prototype.success = function (data, message) {
return this.message({ success: true, data: data, message: message });
};
WebMcpAdapter.prototype.validateIndex = function (value, length, name) {
if (!this.isInteger(value) || value < 0 || value >= length) {
throw new Error(name + " must be an integer between 0 and " + Math.max(length - 1, 0) + ".");
}
};
WebMcpAdapter.prototype.validateFiniteNumber = function (value, name) {
if (typeof value !== 'number' || !isFinite(value)) {
throw new Error(name + " must be a finite number.");
}
};
WebMcpAdapter.prototype.isInteger = function (value) {
return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
};
WebMcpAdapter.prototype.validateRange = function (value, name) {
this.validateFiniteNumber(value, name);
if (value < 0 || value > 1) {
throw new Error(name + " must be between 0 and 1.");
}
};
WebMcpAdapter.prototype.validateObjectArray = function (value, name, allowEmpty) {
if (allowEmpty === void 0) { allowEmpty = false; }
var hasInvalidItem = Array.isArray(value) && value.some(function (item) { return !item || typeof item !== 'object' || Array.isArray(item); });
if (!Array.isArray(value) || (!allowEmpty && value.length === 0) || hasInvalidItem) {
throw new Error(name + " must be an array of objects" + (allowEmpty ? '' : ' with at least one item') + ".");
}
};
WebMcpAdapter.prototype.validateProperties = function (properties, name) {
Iif (!properties || typeof properties !== 'object' || Array.isArray(properties)) {
throw new Error(name + " must be an object.");
}
Iif (Object.keys(properties).length === 0) {
throw new Error(name + " must contain at least one property.");
}
};
WebMcpAdapter.prototype.validateAllowedProperties = function (properties, allowedProperties, target) {
var propertyNames = Object.keys(properties);
for (var _i = 0, propertyNames_1 = propertyNames; _i < propertyNames_1.length; _i++) {
var propertyName = propertyNames_1[_i];
this.validateSafePropertyName(propertyName, target);
if (allowedProperties.indexOf(propertyName) === -1) {
throw new Error(target + " property \"" + propertyName + "\" is not supported.");
}
}
return propertyNames;
};
WebMcpAdapter.prototype.validateSafePropertyName = function (propertyName, target) {
if (propertyName === '__proto__' || propertyName === 'prototype' || propertyName === 'constructor') {
throw new Error(target + " property \"" + propertyName + "\" is not allowed.");
}
};
WebMcpAdapter.prototype.validateSafeObject = function (value, target) {
var _this = this;
Iif (!value || typeof value !== 'object') {
return;
}
Object.keys(value).forEach(function (propertyName) {
_this.validateSafePropertyName(propertyName, target);
var propertyValue = Object.prototype.hasOwnProperty.call(value, propertyName)
? value[propertyName]
: undefined;
if (propertyValue && typeof propertyValue === 'object') {
_this.validateSafeObject(propertyValue, target);
}
});
};
WebMcpAdapter.prototype.cloneProperties = function (properties) {
this.validateSafeObject(properties, 'Input');
try {
return JSON.parse(JSON.stringify(properties));
}
catch (error) {
throw new Error('The supplied value must contain only JSON-serializable data.');
}
};
WebMcpAdapter.prototype.validateString = function (value, name, maximumLength, allowEmpty) {
if (allowEmpty === void 0) { allowEmpty = false; }
if (typeof value !== 'string' || (!allowEmpty && !value.trim()) || value.length > maximumLength) {
throw new Error(name + " must be a " + (allowEmpty ? '' : 'non-empty ') + "string of " + maximumLength + " characters or fewer.");
}
};
WebMcpAdapter.prototype.validateAxisName = function (axisName, propertyName, chart) {
if (typeof axisName !== 'string') {
throw new Error(propertyName + " must be a string.");
}
Iif (!axisName) {
return;
}
if (!chart.axes.some(function (axis) { return axis.name === axisName; })) {
throw new Error("Axis \"" + axisName + "\" was not found.");
}
};
WebMcpAdapter.prototype.getSeriesDataSource = function (series, chart) {
var seriesSource = series.dataSource;
var chartSource = chart.dataSource;
var source = Array.isArray(seriesSource) && seriesSource.length ? seriesSource : chartSource;
Iif (!Array.isArray(source)) {
throw new Error('The selected series does not use an array data source.');
}
return this.cloneProperties(source);
};
WebMcpAdapter.prototype.serializePoint = function (point) {
return {
index: point.index,
x: point.x,
xValue: point.xValue,
y: point.y,
yValue: point.yValue,
high: point.high,
low: point.low,
open: point.open,
close: point.close,
volume: point.volume,
size: point.size,
color: point.color,
visible: point.visible
};
};
WebMcpAdapter.prototype.serializeAnnotation = function (annotation) {
return {
content: annotation.content,
x: annotation.x,
y: annotation.y,
coordinateUnits: annotation.coordinateUnits,
region: annotation.region,
horizontalAlignment: annotation.horizontalAlignment,
verticalAlignment: annotation.verticalAlignment,
description: annotation.description
};
};
WebMcpAdapter.prototype.validateFileName = function (fileName) {
Eif (typeof fileName !== 'string' ||
!fileName ||
fileName.length > 255 ||
/[\\/\0\r\n]/.test(fileName) ||
fileName === '.' ||
fileName === '..') {
throw new Error('fileName must be a safe file name without path separators or control characters.');
}
};
return WebMcpAdapter;
}());
exports.WebMcpAdapter = WebMcpAdapter;
});
|