@splunk/visualizations 26.1.2 → 26.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/Area.config.js +2 -1
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +1562 -433
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +1 -0
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +1555 -430
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +1 -0
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +1580 -455
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +1 -0
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +1421 -352
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +2 -1
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +1564 -435
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +1 -0
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +1342 -297
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +4 -0
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +1503 -489
  28. package/Events.js.map +1 -1
  29. package/FEATUREFLAGS.md +3 -0
  30. package/FillerGauge.config.js +1 -0
  31. package/FillerGauge.config.js.map +1 -1
  32. package/FillerGauge.js +1406 -345
  33. package/FillerGauge.js.map +1 -1
  34. package/Image.config.js +1 -0
  35. package/Image.config.js.map +1 -1
  36. package/Image.js +2355 -1183
  37. package/Image.js.map +1 -1
  38. package/Line.config.js +2 -1
  39. package/Line.config.js.map +1 -1
  40. package/Line.js +1562 -433
  41. package/Line.js.map +1 -1
  42. package/LinkGraph.config.js +1 -0
  43. package/LinkGraph.config.js.map +1 -1
  44. package/LinkGraph.js +18499 -24296
  45. package/LinkGraph.js.map +1 -1
  46. package/Map.config.js +1 -0
  47. package/Map.config.js.map +1 -1
  48. package/Map.js +2556 -1527
  49. package/Map.js.map +1 -1
  50. package/Markdown.config.js +1 -0
  51. package/Markdown.config.js.map +1 -1
  52. package/Markdown.js +1952 -883
  53. package/Markdown.js.map +1 -1
  54. package/MarkerGauge.config.js +1 -0
  55. package/MarkerGauge.config.js.map +1 -1
  56. package/MarkerGauge.js +4049 -2965
  57. package/MarkerGauge.js.map +1 -1
  58. package/ParallelCoordinates.config.js +1 -0
  59. package/ParallelCoordinates.config.js.map +1 -1
  60. package/ParallelCoordinates.js +3286 -2215
  61. package/ParallelCoordinates.js.map +1 -1
  62. package/Pie.config.js +1 -0
  63. package/Pie.config.js.map +1 -1
  64. package/Pie.js +2187 -1036
  65. package/Pie.js.map +1 -1
  66. package/Punchcard.config.js +1 -0
  67. package/Punchcard.config.js.map +1 -1
  68. package/Punchcard.js +3397 -2299
  69. package/Punchcard.js.map +1 -1
  70. package/Rectangle.config.js +1 -0
  71. package/Rectangle.config.js.map +1 -1
  72. package/Rectangle.js +2181 -1112
  73. package/Rectangle.js.map +1 -1
  74. package/Sankey.config.js +1 -0
  75. package/Sankey.config.js.map +1 -1
  76. package/Sankey.js +3275 -2199
  77. package/Sankey.js.map +1 -1
  78. package/Scatter.config.js +1 -0
  79. package/Scatter.config.js.map +1 -1
  80. package/Scatter.js +3551 -2400
  81. package/Scatter.js.map +1 -1
  82. package/SingleValue.config.js +27 -0
  83. package/SingleValue.config.js.map +1 -1
  84. package/SingleValue.js +5551 -4397
  85. package/SingleValue.js.map +1 -1
  86. package/SingleValueBasic.js +1227 -1209
  87. package/SingleValueBasic.js.map +1 -1
  88. package/SingleValueIcon.config.js +27 -0
  89. package/SingleValueIcon.config.js.map +1 -1
  90. package/SingleValueIcon.js +2850 -1696
  91. package/SingleValueIcon.js.map +1 -1
  92. package/SingleValueRadial.config.js +1 -0
  93. package/SingleValueRadial.config.js.map +1 -1
  94. package/SingleValueRadial.js +6334 -5215
  95. package/SingleValueRadial.js.map +1 -1
  96. package/SparkLine.js +96 -96
  97. package/SparkLine.js.map +1 -1
  98. package/Table.config.js +172 -7
  99. package/Table.config.js.map +1 -1
  100. package/Table.js +3500 -2195
  101. package/Table.js.map +1 -1
  102. package/common/Charting.js +1009 -82
  103. package/common/Charting.js.map +1 -1
  104. package/common/ChartingApi.js +4 -4
  105. package/common/ChartingApi.js.map +1 -1
  106. package/common/DocExampleWithVizSandbox.js +54 -57
  107. package/common/DocExampleWithVizSandbox.js.map +1 -1
  108. package/common/EventsDoc.js +40 -40
  109. package/common/EventsDoc.js.map +1 -1
  110. package/common/GaugeMajorTicks.js +15 -13
  111. package/common/GaugeMajorTicks.js.map +1 -1
  112. package/common/GaugeValueMarker.js +12 -12
  113. package/common/GaugeValueMarker.js.map +1 -1
  114. package/common/OptionsDoc.js +34 -34
  115. package/common/OptionsDoc.js.map +1 -1
  116. package/common/OverviewDoc.js +124 -103
  117. package/common/OverviewDoc.js.map +1 -1
  118. package/common/SplunkVisualization.js +49 -49
  119. package/common/SplunkVisualization.js.map +1 -1
  120. package/common/SplunkVisualizationApi.js +4 -4
  121. package/common/SplunkVisualizationApi.js.map +1 -1
  122. package/common/ThemesDoc.js +31 -31
  123. package/common/ThemesDoc.js.map +1 -1
  124. package/common/chartingUtils.js +24 -8
  125. package/common/chartingUtils.js.map +1 -1
  126. package/common/docUtils.js +4 -4
  127. package/common/docUtils.js.map +1 -1
  128. package/common/gaugeUtils.js +16 -16
  129. package/common/gaugeUtils.js.map +1 -1
  130. package/common/shapeUtils.js +36 -36
  131. package/common/shapeUtils.js.map +1 -1
  132. package/common/utils/configUtils.js +48 -47
  133. package/common/utils/configUtils.js.map +1 -1
  134. package/common/utils/dataUtils.js +832 -6
  135. package/common/utils/dataUtils.js.map +1 -1
  136. package/common/utils/featureFlagUtils.js +139 -0
  137. package/common/utils/featureFlagUtils.js.map +1 -0
  138. package/common/utils/hocUtils.js +2 -2
  139. package/common/utils/hocUtils.js.map +1 -1
  140. package/common/utils/layoutUtils.js +2 -2
  141. package/common/utils/layoutUtils.js.map +1 -1
  142. package/common/utils/mapUtils.js +77 -54
  143. package/common/utils/mapUtils.js.map +1 -1
  144. package/common/utils/singleValueUtils.js +28 -19
  145. package/common/utils/singleValueUtils.js.map +1 -1
  146. package/common/utils/testHelper.js +10 -10
  147. package/common/utils/testHelper.js.map +1 -1
  148. package/common/utils/trellisUtils.js +6 -6
  149. package/common/utils/trellisUtils.js.map +1 -1
  150. package/common/utils/urlUtils.js +2 -2
  151. package/common/utils/urlUtils.js.map +1 -1
  152. package/common/withDashboardViz.js +1313 -235
  153. package/common/withDashboardViz.js.map +1 -1
  154. package/package.json +14 -13
  155. package/__mocks__/fileMock.js +0 -2
  156. package/__mocks__/styleMock.js +0 -2
  157. package/babel.config.js +0 -11
  158. package/jest.config.js +0 -8
  159. package/loki.config.js +0 -14
package/ChoroplethSvg.js CHANGED
@@ -87,20 +87,20 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 186);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 208);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
94
94
  /* 0 */
95
95
  /***/ (function(module, exports) {
96
96
 
97
- module.exports = require("prop-types");
97
+ module.exports = require("react");
98
98
 
99
99
  /***/ }),
100
100
  /* 1 */
101
101
  /***/ (function(module, exports) {
102
102
 
103
- module.exports = require("react");
103
+ module.exports = require("prop-types");
104
104
 
105
105
  /***/ }),
106
106
  /* 2 */
@@ -148,6 +148,7 @@ var VizBehavior;
148
148
  */
149
149
  VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
150
150
  VizBehavior["EVENTS"] = "events";
151
+ VizBehavior["DOWNSAMPLING"] = "downsampling";
151
152
  /**
152
153
  * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
153
154
  * missing.
@@ -163,7 +164,7 @@ var VizBehavior;
163
164
  /* 7 */
164
165
  /***/ (function(module, exports) {
165
166
 
166
- module.exports = require("@babel/runtime/helpers/defineProperty");
167
+ module.exports = require("@babel/runtime/helpers/slicedToArray");
167
168
 
168
169
  /***/ }),
169
170
  /* 8 */
@@ -175,46 +176,540 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
175
176
  /* 9 */
176
177
  /***/ (function(module, exports) {
177
178
 
178
- module.exports = require("@babel/runtime/helpers/classCallCheck");
179
+ module.exports = require("@babel/runtime/helpers/defineProperty");
179
180
 
180
181
  /***/ }),
181
182
  /* 10 */
182
183
  /***/ (function(module, exports) {
183
184
 
184
- module.exports = require("@splunk/visualizations-shared/Message");
185
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
185
186
 
186
187
  /***/ }),
187
188
  /* 11 */
188
189
  /***/ (function(module, exports) {
189
190
 
190
- module.exports = require("@splunk/themes/variables");
191
+ module.exports = require("@splunk/visualizations-shared/numberUtils");
191
192
 
192
193
  /***/ }),
193
194
  /* 12 */
194
195
  /***/ (function(module, exports) {
195
196
 
196
- module.exports = require("@splunk/visualizations-shared/colorUtils");
197
+ module.exports = require("@splunk/visualizations-shared/Message");
197
198
 
198
199
  /***/ }),
199
200
  /* 13 */
201
+ /***/ (function(module, exports) {
202
+
203
+ module.exports = require("@splunk/themes/variables");
204
+
205
+ /***/ }),
206
+ /* 14 */
207
+ /***/ (function(module, exports, __webpack_require__) {
208
+
209
+ "use strict";
210
+
211
+
212
+ Object.defineProperty(exports, "__esModule", {
213
+ value: true
214
+ });
215
+ exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
216
+
217
+ var numberUtils_1 = __webpack_require__(11);
218
+
219
+ var interfaces_1 = __webpack_require__(40); // TODO: utilize this fn in ParallelCoordinates
220
+
221
+
222
+ var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
223
+ if (!columns || !columns[0] || !columns[0].length) return [];
224
+ var data = [];
225
+
226
+ var _loop = function _loop(i) {
227
+ var newObj = {};
228
+ fields.forEach(function (field, index) {
229
+ var fieldName = typeof field === 'string' ? field : field.name;
230
+
231
+ if (columns[index][i] === '') {
232
+ newObj[fieldName] = null;
233
+ } else {
234
+ newObj[fieldName] = columns[index][i];
235
+ }
236
+ });
237
+ data.push(newObj);
238
+ };
239
+
240
+ for (var i = 0; i < columns[0].length; i += 1) {
241
+ _loop(i);
242
+ }
243
+
244
+ return data;
245
+ };
246
+
247
+ exports.convertToArrOfObjects = convertToArrOfObjects; // LTTB algorithm which can be used to downsample time series data while striving to maintain
248
+ // the spikes and overall shape of the chart
249
+ // Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js
250
+ // Modifications include:
251
+ // 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)
252
+ // 2) Convert to camel case
253
+ // 3) Convert to TS and also return the indices of the points that are in the downsampled result.
254
+ // 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points
255
+ // that should be used in case of a tie of the max area in a bucket
256
+
257
+ var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, threshold, preferredDownsampleIndices) {
258
+ var dataLength = data.length;
259
+ var downsampledIndices = [];
260
+
261
+ if (threshold >= dataLength || threshold === 0) {
262
+ var allIndices = data.map(function (values, index) {
263
+ return index;
264
+ });
265
+ return {
266
+ downsampledData: data,
267
+ downsampledIndices: allIndices
268
+ }; // Nothing to do
269
+ }
270
+
271
+ var sampled = [];
272
+ var sampledIndex = 0; // Bucket size. Leave room for start and end data points
273
+
274
+ var every = (dataLength - 2) / (threshold - 2);
275
+ var a = 0; // Initially a is the first point in the triangle
276
+
277
+ var maxAreaPoint;
278
+ var maxArea;
279
+ var area;
280
+ var nextA;
281
+ sampled.push(data[a]); // Always add the first point
282
+
283
+ downsampledIndices.push(0); // eslint-disable-next-line no-plusplus
284
+
285
+ for (var i = 0; i < threshold - 2; i++) {
286
+ // Calculate point average for next bucket (containing c)
287
+ var avgX = 0;
288
+ var avgY = 0;
289
+ var avgRangeStart = Math.floor((i + 1) * every) + 1;
290
+ var avgRangeEnd = Math.floor((i + 2) * every) + 1;
291
+ avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
292
+ var avgRangeLength = avgRangeEnd - avgRangeStart; // eslint-disable-next-line no-plusplus
293
+
294
+ for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
295
+ avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)
296
+
297
+ avgY += data[avgRangeStart][1] * 1;
298
+ }
299
+
300
+ avgX /= avgRangeLength;
301
+ avgY /= avgRangeLength; // Get the range for this bucket
302
+
303
+ var rangeOffs = Math.floor((i + 0) * every) + 1;
304
+ var rangeTo = Math.floor((i + 1) * every) + 1; // Point a
305
+
306
+ var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
307
+
308
+ var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
309
+
310
+ maxArea = area = -1;
311
+ var maxAreaIndex = rangeOffs; // eslint-disable-next-line no-plusplus
312
+
313
+ for (; rangeOffs < rangeTo; rangeOffs++) {
314
+ // Calculate triangle area over three buckets
315
+ area = Math.abs((pointAX - avgX) * (data[rangeOffs][1] - pointAY) - (pointAX - Number(data[rangeOffs][0])) * (avgY - pointAY)) * 0.5; // Modification: try to downsample the least amount of points possible when there are multiple series
316
+ // If all points in a bucket have the same area, prioritize the one with an x index
317
+ // that also existed from another series so we don't add another point unnecessarily.
318
+ // By default LTTB picks the leftmost point in the bucket
319
+
320
+ if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
321
+ maxArea = area;
322
+ maxAreaPoint = data[rangeOffs];
323
+ nextA = rangeOffs; // Next a is this b
324
+ // Modification: save the index of the point with the most area
325
+
326
+ maxAreaIndex = rangeOffs;
327
+ }
328
+ } // eslint-disable-next-line no-plusplus
329
+
330
+
331
+ sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
332
+
333
+ downsampledIndices.push(maxAreaIndex);
334
+ a = nextA; // This a is the next a (chosen b)
335
+ } // eslint-disable-next-line no-plusplus
336
+
337
+
338
+ sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
339
+
340
+ downsampledIndices.push(dataLength - 1);
341
+ return {
342
+ downsampledData: sampled,
343
+ downsampledIndices: downsampledIndices
344
+ };
345
+ };
346
+ /**
347
+ * Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines
348
+ * if at least one of the values in the column can be loosely coerced to a number.
349
+ * If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and
350
+ * returns that it cannot downsample the column.
351
+ */
352
+
353
+
354
+ var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
355
+ // Splunk charting allows for numbers in formats such as negative hex that
356
+ // Number() does not support and also allows loose coercion of hex numbers (but not other formats)
357
+ // We want to identify columns which contain at least one value that can be loosely coerced
358
+ var canLooselyCoerceSomeValues = column.findIndex(function (value) {
359
+ return (0, numberUtils_1.startsWithNumber)("".concat(value));
360
+ }) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
361
+
362
+ var coercedColumn = [];
363
+ var canDownsampleColumn = !column.some(function (value) {
364
+ var coercedValue = Number(value); // if it can't be parsed or isn't safe, fail
365
+
366
+ if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
367
+ return true;
368
+ } // save value and continue to next
369
+
370
+
371
+ coercedColumn.push(coercedValue);
372
+ return false;
373
+ });
374
+ return {
375
+ canDownsampleColumn: canDownsampleColumn,
376
+ canLooselyCoerceSomeValues: canLooselyCoerceSomeValues,
377
+ coercedColumn: canDownsampleColumn ? coercedColumn : []
378
+ };
379
+ };
380
+ /**
381
+ * Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.
382
+ * Only strictly increasing x-columns are eligible for downsampling.
383
+ * If the column is not eligible for downsampling, returns an empty array.
384
+ */
385
+
386
+
387
+ var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
388
+ if (fieldType === 'number') {
389
+ var coercedXColumn = column.map(function (xValue) {
390
+ return Number(xValue);
391
+ });
392
+
393
+ if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
394
+ return coercedXColumn;
395
+ }
396
+ } else if (fieldType === 'time') {
397
+ var _coercedXColumn = column.map(function (xValue) {
398
+ return new Date(xValue);
399
+ });
400
+
401
+ if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
402
+ return _coercedXColumn;
403
+ }
404
+ }
405
+
406
+ return [];
407
+ };
408
+
409
+ var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
410
+ var vizConfig = _ref.vizConfig;
411
+
412
+ var _a;
413
+
414
+ return (_a = vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(interfaces_1.VizBehavior.DOWNSAMPLING);
415
+ };
416
+
417
+ exports.isDownsamplingEnabledForViz = isDownsamplingEnabledForViz;
418
+
419
+ var calculateThresholdOnRangeSelect = function calculateThresholdOnRangeSelect(_ref2) {
420
+ var firstIndex = _ref2.firstIndex,
421
+ lastIndex = _ref2.lastIndex,
422
+ dataSources = _ref2.dataSources,
423
+ width = _ref2.width;
424
+
425
+ var _a, _b, _c;
426
+
427
+ var window = lastIndex - firstIndex + 1;
428
+ var ratio = Math.round(Number(((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns[0]) === null || _c === void 0 ? void 0 : _c.length) / window) * 10) / 10;
429
+ return Math.round(ratio * Number(width));
430
+ };
431
+
432
+ exports.calculateThresholdOnRangeSelect = calculateThresholdOnRangeSelect;
433
+ /**
434
+ * Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,
435
+ * then returns the width of the visualization.
436
+ *
437
+ * Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled
438
+ * data sources. Returns null if the chart event's dataset does not match the passed in primary data source or if the chart is zoomed
439
+ * in for a categorical chart.
440
+ */
441
+
442
+ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
443
+ var enableSearchZoom = _ref3.enableSearchZoom,
444
+ dataSources = _ref3.dataSources,
445
+ selectChartEvent = _ref3.selectChartEvent,
446
+ width = _ref3.width,
447
+ xField = _ref3.xField,
448
+ y2Fields = _ref3.y2Fields;
449
+
450
+ var _a, _b, _c;
451
+
452
+ if (enableSearchZoom || !selectChartEvent) {
453
+ return Number(width);
454
+ }
455
+
456
+ var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
457
+
458
+ if (!primaryDataSource) {
459
+ return null;
460
+ }
461
+
462
+ var startXIndex = selectChartEvent.startXIndex,
463
+ endXIndex = selectChartEvent.endXIndex,
464
+ currentTarget = selectChartEvent.currentTarget;
465
+
466
+ try {
467
+ var xFieldIndex = (_a = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _a === void 0 ? void 0 : _a.fields.findIndex(function (field) {
468
+ return field.name === xField;
469
+ });
470
+ var downsampledXFieldIndex = (_b = currentTarget.dataSet) === null || _b === void 0 ? void 0 : _b.fields.findIndex(function (field) {
471
+ return field === xField;
472
+ });
473
+
474
+ if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
475
+ return null;
476
+ }
477
+
478
+ var fullSeries = (_c = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _c === void 0 ? void 0 : _c.columns[xFieldIndex];
479
+ var downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
480
+ var firstIndex = fullSeries.findIndex(function (x) {
481
+ return downsampledSeries[startXIndex] === x;
482
+ });
483
+ var lastIndex = fullSeries.findIndex(function (x) {
484
+ return downsampledSeries[endXIndex] === x;
485
+ }); // For charts with categorical x-axis (charts with an xField that isn't _time), do not support
486
+ // re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
487
+ // Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
488
+ // until SPL-259611 is fixed
489
+
490
+ if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
491
+ return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
492
+ }
493
+
494
+ if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
495
+ return (0, exports.calculateThresholdOnRangeSelect)({
496
+ firstIndex: firstIndex,
497
+ lastIndex: lastIndex,
498
+ dataSources: dataSources,
499
+ width: width
500
+ });
501
+ }
502
+ } catch (e) {
503
+ console.error('Error occurred while setting downsample threshold on range select event', e);
504
+ }
505
+
506
+ return null;
507
+ };
508
+
509
+ exports.calculateDownsamplingThreshold = calculateDownsamplingThreshold;
510
+
511
+ var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fieldType) {
512
+ return column.every(function (value, index) {
513
+ if (fieldType === 'number') {
514
+ if (Number.isNaN(value)) {
515
+ return false;
516
+ }
517
+ }
518
+
519
+ if (fieldType === 'time') {
520
+ if (Number.isNaN(value.getTime())) {
521
+ return false;
522
+ }
523
+ }
524
+
525
+ if (index === 0) {
526
+ return true;
527
+ }
528
+
529
+ return value > column[index - 1];
530
+ });
531
+ };
532
+ /**
533
+ * Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be
534
+ * displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.
535
+ *
536
+ * If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
537
+ * If not all columns can be downsampled, then returns empty arrays for both x and y
538
+ */
539
+
540
+
541
+ var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
542
+ var xColumn = [];
543
+ var yColumns = [];
544
+ var canDownsample = !ds.data.fields.some(function (field, index) {
545
+ var _a, _b;
546
+
547
+ var fieldName = (_a = field.name) !== null && _a !== void 0 ? _a : field;
548
+ var fieldType = (_b = fieldTypes[index]) !== null && _b !== void 0 ? _b : 'unknown';
549
+ var column = ds.data.columns[index];
550
+ var hasDisplayedColumnThatCantBeDownsampled = false;
551
+
552
+ if (fieldName === xField) {
553
+ xColumn = strictlyCoerceXColumn(column, fieldType);
554
+ } else if (yFields.has(fieldName)) {
555
+ var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
556
+ coercedColumn = _strictlyCoerceYColum.coercedColumn,
557
+ canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
558
+ canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
559
+ // be downsampled using LTTB
560
+
561
+
562
+ hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
563
+
564
+ if (hasDisplayedColumnThatCantBeDownsampled) {
565
+ return true;
566
+ }
567
+
568
+ if (canDownsampleColumn) {
569
+ yColumns.push(coercedColumn);
570
+ }
571
+ }
572
+
573
+ return false;
574
+ });
575
+
576
+ if (canDownsample) {
577
+ return {
578
+ xColumn: xColumn,
579
+ yColumns: yColumns
580
+ };
581
+ }
582
+
583
+ return {
584
+ xColumn: [],
585
+ yColumns: []
586
+ };
587
+ };
588
+
589
+ var pickIndicesFromDataSource = function pickIndicesFromDataSource(ds, indices) {
590
+ var sortedIndices = Array.from(indices).sort(function (a, b) {
591
+ return a - b;
592
+ });
593
+ var slicedColumns = [];
594
+ ds.data.columns.forEach(function (column) {
595
+ var slicedColumn = [];
596
+ sortedIndices.forEach(function (index) {
597
+ slicedColumn.push(column[index]);
598
+ });
599
+ slicedColumns.push(slicedColumn);
600
+ }); // update data columns with downsampled columns
601
+
602
+ return Object.assign(Object.assign({}, ds), {
603
+ data: Object.assign(Object.assign({}, ds.data), {
604
+ columns: slicedColumns
605
+ })
606
+ });
607
+ };
608
+
609
+ var downsampleDataSources = function downsampleDataSources(_ref4) {
610
+ var dataSources = _ref4.dataSources,
611
+ threshold = _ref4.threshold,
612
+ options = _ref4.options;
613
+
614
+ var _a, _b, _c;
615
+
616
+ var primaryDS = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary; // only downsample time series when number of data points are over threshold
617
+
618
+ var numPoints = (_c = (_b = (_a = primaryDS === null || primaryDS === void 0 ? void 0 : primaryDS.data) === null || _a === void 0 ? void 0 : _a.columns[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
619
+
620
+ if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
621
+ return dataSources;
622
+ }
623
+
624
+ var xField = options.xField,
625
+ yFields = options.yFields,
626
+ fieldTypes = options.fieldTypes;
627
+
628
+ if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
629
+ return dataSources;
630
+ }
631
+
632
+ var nonInternalYFields = new Set(yFields.filter(function (yField) {
633
+ return !yField.startsWith('_');
634
+ }));
635
+ var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
636
+ // At the worst case, each series has non-overlapping downsampled pts
637
+ // which will mean that all points will be included in the downsampled result
638
+ // This will just lead to additional overhead due to coercing each
639
+ // x and y field to number
640
+
641
+ if (maxPointsInDownsample >= numPoints) {
642
+ return dataSources;
643
+ }
644
+
645
+ var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
646
+ xColumn = _tryToCoerceAllDispla.xColumn,
647
+ yColumns = _tryToCoerceAllDispla.yColumns;
648
+
649
+ if (!yColumns.length || !xColumn.length) {
650
+ return dataSources;
651
+ }
652
+
653
+ var downsampledDataSources = Object.assign({}, dataSources);
654
+ var downsampledIndices = new Set();
655
+ yColumns.forEach(function (yColumn, columnIndex) {
656
+ // perform LTTB downsampling for current series, LTTB takes an [x, y] pair
657
+ var xyPair = yColumn.map(function (yValue, index) {
658
+ return [xColumn[index], yValue];
659
+ });
660
+
661
+ try {
662
+ var _largestTriangleThree = largestTriangleThreeBuckets(xyPair, threshold, downsampledIndices),
663
+ downsampledIndicesForSeries = _largestTriangleThree.downsampledIndices;
664
+
665
+ downsampledIndicesForSeries.forEach(function (downsampleIndex) {
666
+ return downsampledIndices.add(downsampleIndex);
667
+ });
668
+ } catch (e) {
669
+ console.error("Error occurred while downsampling column ".concat(columnIndex), e);
670
+ }
671
+ }); // update data columns with downsampled columns
672
+
673
+ downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
674
+ return downsampledDataSources;
675
+ };
676
+
677
+ exports.downsampleDataSources = downsampleDataSources;
678
+
679
+ /***/ }),
680
+ /* 15 */
681
+ /***/ (function(module, exports) {
682
+
683
+ module.exports = require("@splunk/visualizations-shared/colorUtils");
684
+
685
+ /***/ }),
686
+ /* 16 */
687
+ /***/ (function(module, exports) {
688
+
689
+ module.exports = require("@splunk/visualization-encoding/Options");
690
+
691
+ /***/ }),
692
+ /* 17 */
200
693
  /***/ (function(module, exports, __webpack_require__) {
201
694
 
202
695
  "use strict";
203
696
 
204
697
 
698
+ var _slicedToArray = __webpack_require__(7);
699
+
205
700
  Object.defineProperty(exports, "__esModule", {
206
701
  value: true
207
702
  });
208
703
 
209
- var React = __webpack_require__(1);
704
+ var React = __webpack_require__(0);
210
705
 
211
706
  var styled_components_1 = __webpack_require__(4);
212
707
 
213
- var SizeAwareWrapper_1 = __webpack_require__(19);
708
+ var style_1 = __webpack_require__(18);
214
709
 
215
- var style_1 = __webpack_require__(14);
710
+ var colorUtils_1 = __webpack_require__(15);
216
711
 
217
- var colorUtils_1 = __webpack_require__(12);
712
+ var SizeAwareWrapper_1 = __webpack_require__(26);
218
713
 
219
714
  var Item = styled_components_1.default.div.attrs(function (_ref) {
220
715
  var width = _ref.width;
@@ -260,6 +755,20 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
260
755
  var width = props.width,
261
756
  height = props.height,
262
757
  backgroundColor = props.backgroundColor;
758
+ var cachedHandleResize = React.useCallback(function (w, h) {
759
+ setContainerWidth(w);
760
+ setContainerHeight(h);
761
+ }, []);
762
+
763
+ var _React$useState = React.useState(Number(props.width)),
764
+ _React$useState2 = _slicedToArray(_React$useState, 2),
765
+ containerWidth = _React$useState2[0],
766
+ setContainerWidth = _React$useState2[1];
767
+
768
+ var _React$useState3 = React.useState(Number(props.height)),
769
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
770
+ containerHeight = _React$useState4[0],
771
+ setContainerHeight = _React$useState4[1];
263
772
 
264
773
  if (!height) {
265
774
  return React.createElement(Item, {
@@ -271,18 +780,18 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
271
780
 
272
781
  return React.createElement(FixSizeItem, {
273
782
  "data-test": "fix-size-item",
274
- "data-splunk-visualization-version": "26.1.2 - 9c7479612",
783
+ "data-splunk-visualization-version": "26.2.1 - 714383dbb",
275
784
  width: width,
276
785
  height: height,
277
786
  backgroundColor: backgroundColor
278
- }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
279
- var newWidth = _ref3.width,
280
- newHeight = _ref3.height;
281
- return React.createElement(Viz, Object.assign({}, props, {
282
- width: newWidth,
283
- height: newHeight
284
- }));
285
- })));
787
+ }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, {
788
+ width: width,
789
+ height: height,
790
+ onResize: cachedHandleResize
791
+ }), React.createElement(Viz, Object.assign({}, props, {
792
+ width: containerWidth,
793
+ height: containerHeight
794
+ }))));
286
795
  };
287
796
 
288
797
  FixedSizeContainer.displayName = 'withFixedSizeContainer';
@@ -292,13 +801,94 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
292
801
  exports.default = withFixedSizeContainer;
293
802
 
294
803
  /***/ }),
295
- /* 14 */
804
+ /* 18 */
296
805
  /***/ (function(module, exports) {
297
806
 
298
807
  module.exports = require("@splunk/visualizations-shared/style");
299
808
 
300
809
  /***/ }),
301
- /* 15 */
810
+ /* 19 */
811
+ /***/ (function(module, exports, __webpack_require__) {
812
+
813
+ "use strict";
814
+
815
+
816
+ Object.defineProperty(exports, "__esModule", {
817
+ value: true
818
+ });
819
+ exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
820
+ exports.validSortDirs = ['asc', 'desc', 'none'];
821
+ exports.validSegmentationModes = ['none', 'inner'];
822
+ exports.validOutputModes = ['json_cols', 'json'];
823
+
824
+ /***/ }),
825
+ /* 20 */,
826
+ /* 21 */
827
+ /***/ (function(module, exports, __webpack_require__) {
828
+
829
+ "use strict";
830
+
831
+
832
+ var _classCallCheck = __webpack_require__(10);
833
+
834
+ var _createClass = __webpack_require__(25);
835
+
836
+ Object.defineProperty(exports, "__esModule", {
837
+ value: true
838
+ });
839
+ exports.DefaultVizActionHandler = void 0;
840
+
841
+ var DefaultVizActionHandler = /*#__PURE__*/function () {
842
+ function DefaultVizActionHandler() {
843
+ _classCallCheck(this, DefaultVizActionHandler);
844
+ }
845
+
846
+ _createClass(DefaultVizActionHandler, [{
847
+ key: "focus",
848
+ value: function focus() {// noop
849
+ }
850
+ }, {
851
+ key: "snapshot",
852
+ value: function snapshot() {
853
+ return null; // noop
854
+ }
855
+ }]);
856
+
857
+ return DefaultVizActionHandler;
858
+ }();
859
+
860
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
861
+
862
+ /***/ }),
863
+ /* 22 */
864
+ /***/ (function(module, exports, __webpack_require__) {
865
+
866
+ "use strict";
867
+
868
+
869
+ Object.defineProperty(exports, "__esModule", {
870
+ value: true
871
+ });
872
+ exports.VizCategory = void 0;
873
+ var VizCategory;
874
+
875
+ (function (VizCategory) {
876
+ VizCategory["SINGLE_VALUE"] = "Single Value";
877
+ VizCategory["TRENDS"] = "Trends";
878
+ VizCategory["COMPARISONS"] = "Comparisons";
879
+ VizCategory["TABLE"] = "Table";
880
+ VizCategory["GAUGE"] = "Gauge";
881
+ VizCategory["DISTRIBUTIONS"] = "Distributions";
882
+ VizCategory["CHOROPLETH"] = "Choropleth Maps";
883
+ VizCategory["SHAPES"] = "Shapes";
884
+ VizCategory["MISC"] = "misc";
885
+ VizCategory["FLOW"] = "Flow";
886
+ VizCategory["CORRELATION"] = "Correlation";
887
+ VizCategory["SPATIAL"] = "Spatial";
888
+ })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
889
+
890
+ /***/ }),
891
+ /* 23 */
302
892
  /***/ (function(module, exports, __webpack_require__) {
303
893
 
304
894
  "use strict";
@@ -330,31 +920,25 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
330
920
  exports.extendStaticWrapperProps = extendStaticWrapperProps;
331
921
 
332
922
  /***/ }),
333
- /* 16 */
923
+ /* 24 */
334
924
  /***/ (function(module, exports) {
335
925
 
336
926
  module.exports = require("@splunk/visualizations-shared/schemaUtils");
337
927
 
338
928
  /***/ }),
339
- /* 17 */
340
- /***/ (function(module, exports) {
341
-
342
- module.exports = require("@babel/runtime/helpers/slicedToArray");
343
-
344
- /***/ }),
345
- /* 18 */
929
+ /* 25 */
346
930
  /***/ (function(module, exports) {
347
931
 
348
932
  module.exports = require("@babel/runtime/helpers/createClass");
349
933
 
350
934
  /***/ }),
351
- /* 19 */
935
+ /* 26 */
352
936
  /***/ (function(module, exports) {
353
937
 
354
938
  module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
355
939
 
356
940
  /***/ }),
357
- /* 20 */
941
+ /* 27 */
358
942
  /***/ (function(module, exports, __webpack_require__) {
359
943
 
360
944
  "use strict";
@@ -362,7 +946,7 @@ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
362
946
 
363
947
  var _toConsumableArray = __webpack_require__(8);
364
948
 
365
- var _defineProperty = __webpack_require__(7);
949
+ var _defineProperty = __webpack_require__(9);
366
950
 
367
951
  var __rest = this && this.__rest || function (s, e) {
368
952
  var t = {};
@@ -384,7 +968,7 @@ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig
384
968
 
385
969
  var lodash_1 = __webpack_require__(3);
386
970
 
387
- var schemaUtils_1 = __webpack_require__(16);
971
+ var schemaUtils_1 = __webpack_require__(24);
388
972
 
389
973
  var VizBehavior_1 = __webpack_require__(6);
390
974
 
@@ -590,58 +1174,73 @@ var insertLayout = function insertLayout(layout, index) {
590
1174
  exports.insertLayout = insertLayout;
591
1175
 
592
1176
  /***/ }),
593
- /* 21 */
1177
+ /* 28 */
594
1178
  /***/ (function(module, exports) {
595
1179
 
596
1180
  module.exports = require("@splunk/visualization-context/FeatureFlagContext");
597
1181
 
598
1182
  /***/ }),
599
- /* 22 */
1183
+ /* 29 */
600
1184
  /***/ (function(module, exports) {
601
1185
 
602
1186
  module.exports = require("@splunk/visualizations-shared/configUtils");
603
1187
 
604
1188
  /***/ }),
605
- /* 23 */
1189
+ /* 30 */
606
1190
  /***/ (function(module, exports) {
607
1191
 
608
1192
  module.exports = require("@splunk/themes/pick");
609
1193
 
610
1194
  /***/ }),
611
- /* 24 */,
612
- /* 25 */
1195
+ /* 31 */
613
1196
  /***/ (function(module, exports) {
614
1197
 
615
1198
  module.exports = require("@splunk/ui-utils/id");
616
1199
 
617
1200
  /***/ }),
618
- /* 26 */
1201
+ /* 32 */
619
1202
  /***/ (function(module, exports) {
620
1203
 
621
- module.exports = require("@splunk/visualization-context/TimezoneContext");
1204
+ module.exports = require("@splunk/visualization-context/TimezoneContext");
1205
+
1206
+ /***/ }),
1207
+ /* 33 */
1208
+ /***/ (function(module, exports, __webpack_require__) {
1209
+
1210
+ "use strict";
1211
+
1212
+
1213
+ Object.defineProperty(exports, "__esModule", {
1214
+ value: true
1215
+ });
1216
+
1217
+ var react_1 = __webpack_require__(0);
1218
+
1219
+ function usePrevious(value) {
1220
+ var ref = (0, react_1.useRef)();
1221
+ (0, react_1.useEffect)(function () {
1222
+ ref.current = value;
1223
+ });
1224
+ return ref.current;
1225
+ }
1226
+
1227
+ exports.default = usePrevious;
622
1228
 
623
1229
  /***/ }),
624
- /* 27 */
1230
+ /* 34 */
625
1231
  /***/ (function(module, exports) {
626
1232
 
627
1233
  module.exports = require("@splunk/visualizations-shared/hocUtils");
628
1234
 
629
1235
  /***/ }),
630
- /* 28 */
1236
+ /* 35 */
631
1237
  /***/ (function(module, exports) {
632
1238
 
633
1239
  module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
634
1240
 
635
1241
  /***/ }),
636
- /* 29 */,
637
- /* 30 */
638
- /***/ (function(module, exports) {
639
-
640
- module.exports = require("@splunk/visualization-encoding/Options");
641
-
642
- /***/ }),
643
- /* 31 */,
644
- /* 32 */
1242
+ /* 36 */,
1243
+ /* 37 */
645
1244
  /***/ (function(module, exports, __webpack_require__) {
646
1245
 
647
1246
  "use strict";
@@ -652,17 +1251,17 @@ Object.defineProperty(exports, "__esModule", {
652
1251
  });
653
1252
  exports.shouldShowIconPlaceholder = void 0;
654
1253
 
655
- var React = __webpack_require__(1);
1254
+ var React = __webpack_require__(0);
656
1255
 
657
- var T = __webpack_require__(0);
1256
+ var T = __webpack_require__(1);
658
1257
 
659
1258
  var lodash_1 = __webpack_require__(3);
660
1259
 
661
1260
  var i18n_1 = __webpack_require__(2);
662
1261
 
663
- var Message_1 = __webpack_require__(10);
1262
+ var Message_1 = __webpack_require__(12);
664
1263
 
665
- var FixedSizeContainer_1 = __webpack_require__(13);
1264
+ var FixedSizeContainer_1 = __webpack_require__(17);
666
1265
  /**
667
1266
  * @method shouldShowIconPlaceholder
668
1267
  * @param {object} dataSources
@@ -733,24 +1332,24 @@ IconPlaceholder.defaultProps = {
733
1332
  exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
734
1333
 
735
1334
  /***/ }),
736
- /* 33 */
1335
+ /* 38 */
737
1336
  /***/ (function(module, exports, __webpack_require__) {
738
1337
 
739
1338
  "use strict";
740
1339
 
741
1340
 
742
- var _defineProperty = __webpack_require__(7);
1341
+ var _defineProperty = __webpack_require__(9);
743
1342
 
744
1343
  Object.defineProperty(exports, "__esModule", {
745
1344
  value: true
746
1345
  });
747
1346
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
748
1347
 
749
- var T = __webpack_require__(0);
1348
+ var T = __webpack_require__(1);
750
1349
 
751
1350
  var lodash_1 = __webpack_require__(3);
752
1351
 
753
- var DataSource_1 = __webpack_require__(34);
1352
+ var DataSource_1 = __webpack_require__(19);
754
1353
 
755
1354
  exports.SortParamsPropTypes = T.shape({
756
1355
  currentSortKey: T.string,
@@ -803,22 +1402,7 @@ var getSortingParams = function getSortingParams(_ref) {
803
1402
  exports.getSortingParams = getSortingParams;
804
1403
 
805
1404
  /***/ }),
806
- /* 34 */
807
- /***/ (function(module, exports, __webpack_require__) {
808
-
809
- "use strict";
810
-
811
-
812
- Object.defineProperty(exports, "__esModule", {
813
- value: true
814
- });
815
- exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
816
- exports.validSortDirs = ['asc', 'desc', 'none'];
817
- exports.validSegmentationModes = ['none', 'inner'];
818
- exports.validOutputModes = ['json_cols', 'json'];
819
-
820
- /***/ }),
821
- /* 35 */
1405
+ /* 39 */
822
1406
  /***/ (function(module, exports, __webpack_require__) {
823
1407
 
824
1408
  "use strict";
@@ -829,7 +1413,7 @@ Object.defineProperty(exports, "__esModule", {
829
1413
  });
830
1414
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
831
1415
 
832
- var T = __webpack_require__(0);
1416
+ var T = __webpack_require__(1);
833
1417
 
834
1418
  var lodash_1 = __webpack_require__(3);
835
1419
 
@@ -882,87 +1466,307 @@ var getPaginationParams = function getPaginationParams(_ref) {
882
1466
  exports.getPaginationParams = getPaginationParams;
883
1467
 
884
1468
  /***/ }),
885
- /* 36 */
1469
+ /* 40 */
886
1470
  /***/ (function(module, exports, __webpack_require__) {
887
1471
 
888
1472
  "use strict";
889
1473
 
890
1474
 
1475
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1476
+ if (k2 === undefined) k2 = k;
1477
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1478
+
1479
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1480
+ desc = {
1481
+ enumerable: true,
1482
+ get: function get() {
1483
+ return m[k];
1484
+ }
1485
+ };
1486
+ }
1487
+
1488
+ Object.defineProperty(o, k2, desc);
1489
+ } : function (o, m, k, k2) {
1490
+ if (k2 === undefined) k2 = k;
1491
+ o[k2] = m[k];
1492
+ });
1493
+
1494
+ var __exportStar = this && this.__exportStar || function (m, exports) {
1495
+ for (var p in m) {
1496
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1497
+ }
1498
+ };
1499
+
891
1500
  Object.defineProperty(exports, "__esModule", {
892
1501
  value: true
893
1502
  });
894
- exports.VizCategory = void 0;
895
- var VizCategory;
896
1503
 
897
- (function (VizCategory) {
898
- VizCategory["SINGLE_VALUE"] = "Single Value";
899
- VizCategory["TRENDS"] = "Trends";
900
- VizCategory["COMPARISONS"] = "Comparisons";
901
- VizCategory["TABLE"] = "Table";
902
- VizCategory["GAUGE"] = "Gauge";
903
- VizCategory["DISTRIBUTIONS"] = "Distributions";
904
- VizCategory["CHOROPLETH"] = "Choropleth Maps";
905
- VizCategory["SHAPES"] = "Shapes";
906
- VizCategory["MISC"] = "misc";
907
- VizCategory["FLOW"] = "Flow";
908
- VizCategory["CORRELATION"] = "Correlation";
909
- VizCategory["SPATIAL"] = "Spatial";
910
- })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
1504
+ __exportStar(__webpack_require__(41), exports);
1505
+
1506
+ __exportStar(__webpack_require__(42), exports);
1507
+
1508
+ __exportStar(__webpack_require__(19), exports);
1509
+
1510
+ __exportStar(__webpack_require__(43), exports);
1511
+
1512
+ __exportStar(__webpack_require__(44), exports);
1513
+
1514
+ __exportStar(__webpack_require__(45), exports);
1515
+
1516
+ __exportStar(__webpack_require__(46), exports);
1517
+
1518
+ __exportStar(__webpack_require__(47), exports);
1519
+
1520
+ __exportStar(__webpack_require__(48), exports);
1521
+
1522
+ __exportStar(__webpack_require__(49), exports);
1523
+
1524
+ __exportStar(__webpack_require__(21), exports);
1525
+
1526
+ __exportStar(__webpack_require__(6), exports);
1527
+
1528
+ __exportStar(__webpack_require__(22), exports);
1529
+
1530
+ __exportStar(__webpack_require__(50), exports);
1531
+
1532
+ __exportStar(__webpack_require__(51), exports);
1533
+
1534
+ __exportStar(__webpack_require__(52), exports);
1535
+
1536
+ __exportStar(__webpack_require__(53), exports);
1537
+
1538
+ __exportStar(__webpack_require__(54), exports);
1539
+
1540
+ __exportStar(__webpack_require__(55), exports);
911
1541
 
912
1542
  /***/ }),
913
- /* 37 */
1543
+ /* 41 */
1544
+ /***/ (function(module, exports, __webpack_require__) {
1545
+
1546
+ "use strict";
1547
+
1548
+
1549
+ Object.defineProperty(exports, "__esModule", {
1550
+ value: true
1551
+ });
1552
+
1553
+ /***/ }),
1554
+ /* 42 */
1555
+ /***/ (function(module, exports, __webpack_require__) {
1556
+
1557
+ "use strict";
1558
+
1559
+ /**
1560
+ * A data structure used at runtime to wire up a visualization.
1561
+ */
1562
+
1563
+ Object.defineProperty(exports, "__esModule", {
1564
+ value: true
1565
+ });
1566
+
1567
+ /***/ }),
1568
+ /* 43 */
1569
+ /***/ (function(module, exports, __webpack_require__) {
1570
+
1571
+ "use strict";
1572
+
1573
+
1574
+ Object.defineProperty(exports, "__esModule", {
1575
+ value: true
1576
+ });
1577
+
1578
+ /***/ }),
1579
+ /* 44 */
1580
+ /***/ (function(module, exports, __webpack_require__) {
1581
+
1582
+ "use strict";
1583
+
1584
+
1585
+ Object.defineProperty(exports, "__esModule", {
1586
+ value: true
1587
+ });
1588
+
1589
+ /***/ }),
1590
+ /* 45 */
1591
+ /***/ (function(module, exports, __webpack_require__) {
1592
+
1593
+ "use strict";
1594
+
1595
+
1596
+ Object.defineProperty(exports, "__esModule", {
1597
+ value: true
1598
+ });
1599
+
1600
+ /***/ }),
1601
+ /* 46 */
1602
+ /***/ (function(module, exports, __webpack_require__) {
1603
+
1604
+ "use strict";
1605
+
1606
+
1607
+ Object.defineProperty(exports, "__esModule", {
1608
+ value: true
1609
+ });
1610
+
1611
+ /***/ }),
1612
+ /* 47 */
1613
+ /***/ (function(module, exports, __webpack_require__) {
1614
+
1615
+ "use strict";
1616
+
1617
+
1618
+ Object.defineProperty(exports, "__esModule", {
1619
+ value: true
1620
+ });
1621
+
1622
+ /***/ }),
1623
+ /* 48 */
1624
+ /***/ (function(module, exports, __webpack_require__) {
1625
+
1626
+ "use strict";
1627
+
1628
+
1629
+ Object.defineProperty(exports, "__esModule", {
1630
+ value: true
1631
+ });
1632
+
1633
+ /***/ }),
1634
+ /* 49 */
1635
+ /***/ (function(module, exports, __webpack_require__) {
1636
+
1637
+ "use strict";
1638
+
1639
+
1640
+ Object.defineProperty(exports, "__esModule", {
1641
+ value: true
1642
+ });
1643
+
1644
+ /***/ }),
1645
+ /* 50 */
1646
+ /***/ (function(module, exports, __webpack_require__) {
1647
+
1648
+ "use strict";
1649
+
1650
+
1651
+ Object.defineProperty(exports, "__esModule", {
1652
+ value: true
1653
+ });
1654
+
1655
+ /***/ }),
1656
+ /* 51 */
1657
+ /***/ (function(module, exports, __webpack_require__) {
1658
+
1659
+ "use strict";
1660
+
1661
+
1662
+ Object.defineProperty(exports, "__esModule", {
1663
+ value: true
1664
+ });
1665
+
1666
+ /***/ }),
1667
+ /* 52 */
1668
+ /***/ (function(module, exports, __webpack_require__) {
1669
+
1670
+ "use strict";
1671
+
1672
+
1673
+ Object.defineProperty(exports, "__esModule", {
1674
+ value: true
1675
+ });
1676
+
1677
+ /***/ }),
1678
+ /* 53 */
1679
+ /***/ (function(module, exports, __webpack_require__) {
1680
+
1681
+ "use strict";
1682
+
1683
+
1684
+ Object.defineProperty(exports, "__esModule", {
1685
+ value: true
1686
+ });
1687
+
1688
+ /***/ }),
1689
+ /* 54 */
1690
+ /***/ (function(module, exports, __webpack_require__) {
1691
+
1692
+ "use strict";
1693
+
1694
+
1695
+ Object.defineProperty(exports, "__esModule", {
1696
+ value: true
1697
+ });
1698
+
1699
+ /***/ }),
1700
+ /* 55 */
1701
+ /***/ (function(module, exports, __webpack_require__) {
1702
+
1703
+ "use strict";
1704
+
1705
+
1706
+ Object.defineProperty(exports, "__esModule", {
1707
+ value: true
1708
+ });
1709
+
1710
+ /***/ }),
1711
+ /* 56 */
914
1712
  /***/ (function(module, exports, __webpack_require__) {
915
1713
 
916
1714
  "use strict";
917
1715
 
918
1716
 
919
- var _slicedToArray = __webpack_require__(17);
1717
+ var _slicedToArray = __webpack_require__(7);
920
1718
 
921
1719
  Object.defineProperty(exports, "__esModule", {
922
1720
  value: true
923
1721
  });
924
1722
 
925
- var React = __webpack_require__(1);
1723
+ var React = __webpack_require__(0);
926
1724
 
927
1725
  var lodash_1 = __webpack_require__(3);
928
1726
 
929
- var getSettingsFromThemedProps_1 = __webpack_require__(38);
1727
+ var getSettingsFromThemedProps_1 = __webpack_require__(57);
930
1728
 
931
- var Options_1 = __webpack_require__(30);
1729
+ var Options_1 = __webpack_require__(16);
932
1730
 
933
- var SanitizeProps_1 = __webpack_require__(39);
1731
+ var SanitizeProps_1 = __webpack_require__(58);
934
1732
 
935
- var TimezoneContext_1 = __webpack_require__(26);
1733
+ var TimezoneContext_1 = __webpack_require__(32);
936
1734
 
937
- var moment_1 = __webpack_require__(40);
1735
+ var moment_1 = __webpack_require__(59);
938
1736
 
939
- var FeatureFlagContext_1 = __webpack_require__(21);
1737
+ var FeatureFlagContext_1 = __webpack_require__(28);
940
1738
 
941
1739
  var styled_components_1 = __webpack_require__(4);
942
1740
 
943
- var hocUtils_1 = __webpack_require__(27);
1741
+ var hocUtils_1 = __webpack_require__(34);
944
1742
 
945
- var JSONSchemaUtils_1 = __webpack_require__(28);
1743
+ var JSONSchemaUtils_1 = __webpack_require__(35);
946
1744
 
947
- var async_dynamic_options_evaluator_1 = __webpack_require__(41);
1745
+ var async_dynamic_options_evaluator_1 = __webpack_require__(60);
948
1746
 
949
- var id_1 = __webpack_require__(25);
1747
+ var id_1 = __webpack_require__(31);
950
1748
 
951
- var SplunkVisualization_1 = __webpack_require__(42);
1749
+ var SplunkVisualization_1 = __webpack_require__(61);
952
1750
 
953
1751
  var VizBehavior_1 = __webpack_require__(6);
954
1752
 
955
- var getSorting_1 = __webpack_require__(33);
1753
+ var getSorting_1 = __webpack_require__(38);
1754
+
1755
+ var getPagination_1 = __webpack_require__(39);
1756
+
1757
+ var useDeepMemo_1 = __webpack_require__(62);
1758
+
1759
+ var MissingPropsMessage_1 = __webpack_require__(63);
956
1760
 
957
- var getPagination_1 = __webpack_require__(35);
1761
+ var withEditModeCover_1 = __webpack_require__(64);
958
1762
 
959
- var useDeepMemo_1 = __webpack_require__(44);
1763
+ var withPlaceholder_1 = __webpack_require__(65);
960
1764
 
961
- var MissingPropsMessage_1 = __webpack_require__(45);
1765
+ var useDownsampleDataSources_1 = __webpack_require__(66);
962
1766
 
963
- var withEditModeCover_1 = __webpack_require__(46);
1767
+ var dataUtils_1 = __webpack_require__(14);
964
1768
 
965
- var withPlaceholder_1 = __webpack_require__(47);
1769
+ var featureFlagUtils_1 = __webpack_require__(68);
966
1770
  /**
967
1771
  * hoc that wraps a pure react visualization in a Dashboard visualization
968
1772
  * @param {DashboardVizOpts} opts
@@ -1053,25 +1857,61 @@ var withDashboardViz = function withDashboardViz(opts) {
1053
1857
  dataFramesInState = _React$useState8[0],
1054
1858
  setDataFramesInState = _React$useState8[1];
1055
1859
 
1056
- var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
1860
+ var _React$useState9 = React.useState(Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_useWebWorkersForDSL'))),
1057
1861
  _React$useState10 = _slicedToArray(_React$useState9, 2),
1058
1862
  useAsyncEvaluatedOptions = _React$useState10[0],
1059
1863
  setUseAsyncEvaluatedOptions = _React$useState10[1];
1060
1864
 
1865
+ var isDownsamplingEnabledByFeatureFlag = Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_enableDownsampling);
1061
1866
  var isMounted = React.useRef(true);
1867
+ var optionsToEvaluate = React.useMemo(function () {
1868
+ return {
1869
+ context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1870
+ options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
1871
+ };
1872
+ }, [options, context]);
1873
+
1874
+ var _React$useState11 = React.useState(Number(width)),
1875
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
1876
+ threshold = _React$useState12[0],
1877
+ setThreshold = _React$useState12[1];
1878
+
1879
+ var onDownsamplingThresholdChange = React.useCallback(function (newThreshold) {
1880
+ setThreshold(newThreshold);
1881
+ }, []);
1882
+ var isDownsamplingEnabled = React.useMemo(function () {
1883
+ return isDownsamplingEnabledByFeatureFlag && (0, dataUtils_1.isDownsamplingEnabledForViz)({
1884
+ vizConfig: vizConfig
1885
+ });
1886
+ }, [isDownsamplingEnabledByFeatureFlag]);
1887
+ var downsamplingProps = React.useMemo(function () {
1888
+ if (!isDownsamplingEnabled) {
1889
+ return {};
1890
+ }
1891
+
1892
+ return {
1893
+ onDownsamplingThresholdChange: onDownsamplingThresholdChange,
1894
+ originalDataSources: dataSources
1895
+ };
1896
+ }, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
1897
+ var downsampledDataSources = (0, useDownsampleDataSources_1.default)({
1898
+ options: optionsToEvaluate.options,
1899
+ context: optionsToEvaluate.context,
1900
+ dataSources: dataSources,
1901
+ threshold: threshold,
1902
+ isDownsamplingEnabled: isDownsamplingEnabled
1903
+ });
1062
1904
  evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
1063
1905
  try {
1064
1906
  if (useAsyncEvaluatedOptions) {
1065
- var optionsToEvaluate = {
1066
- context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1067
- options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
1068
- };
1069
1907
  var asyncDynamicOptionsEvaluatorParams = {
1070
1908
  visualizationID: visualizationID,
1071
1909
  props: props,
1072
1910
  options: optionsToEvaluate,
1073
- dataSources: dataSources,
1074
- theme: vizConfig.themes
1911
+ dataSources: downsampledDataSources,
1912
+ theme: vizConfig.themes,
1913
+ bypassCloneDeepOptionScope: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope')),
1914
+ lazyLoadingDataFrame: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'))
1075
1915
  };
1076
1916
  async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
1077
1917
  setEvaluatedOptionsAsync(results.results);
@@ -1083,16 +1923,14 @@ var withDashboardViz = function withDashboardViz(opts) {
1083
1923
  } else {
1084
1924
  var dataFrames = dataFramesInState;
1085
1925
 
1086
- if (dataSources !== dataSourcesInState) {
1087
- setDataSourcesInState(dataSources);
1088
- dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
1926
+ if (downsampledDataSources !== dataSourcesInState) {
1927
+ setDataSourcesInState(downsampledDataSources);
1928
+ dataFrames = Options_1.Options.dataFrameFromDataSource(downsampledDataSources, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'));
1089
1929
  setDataFramesInState(dataFrames);
1090
1930
  }
1091
1931
 
1092
- return Options_1.Options.evaluate({
1093
- context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1094
- options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
1095
- }, dataSources, themeFunc, dataFrames);
1932
+ var result = Options_1.Options.evaluate(optionsToEvaluate, downsampledDataSources, themeFunc, dataFrames, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope'));
1933
+ return result;
1096
1934
  }
1097
1935
  } catch (e) {
1098
1936
  // eslint-disable-next-line no-console
@@ -1101,7 +1939,7 @@ var withDashboardViz = function withDashboardViz(opts) {
1101
1939
  }
1102
1940
 
1103
1941
  return {};
1104
- }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
1942
+ }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, optionsToEvaluate, downsampledDataSources, serializedTimezone, useAsyncEvaluatedOptions]);
1105
1943
  var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
1106
1944
  // if trellis is enabled following these three criteria - 1) trellis feature flag is enabled 2) vizConfig supports array has 'trellis' 3) option 'splitByLayout' is set to 'trellis
1107
1945
  // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
@@ -1243,7 +2081,7 @@ var withDashboardViz = function withDashboardViz(opts) {
1243
2081
  mode: mode,
1244
2082
  width: width,
1245
2083
  height: height
1246
- }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
2084
+ }, downsamplingProps, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
1247
2085
  };
1248
2086
 
1249
2087
  DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
@@ -1260,37 +2098,37 @@ var withDashboardViz = function withDashboardViz(opts) {
1260
2098
  exports.default = withDashboardViz;
1261
2099
 
1262
2100
  /***/ }),
1263
- /* 38 */
2101
+ /* 57 */
1264
2102
  /***/ (function(module, exports) {
1265
2103
 
1266
2104
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1267
2105
 
1268
2106
  /***/ }),
1269
- /* 39 */
2107
+ /* 58 */
1270
2108
  /***/ (function(module, exports) {
1271
2109
 
1272
2110
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1273
2111
 
1274
2112
  /***/ }),
1275
- /* 40 */
2113
+ /* 59 */
1276
2114
  /***/ (function(module, exports) {
1277
2115
 
1278
2116
  module.exports = require("@splunk/moment");
1279
2117
 
1280
2118
  /***/ }),
1281
- /* 41 */
2119
+ /* 60 */
1282
2120
  /***/ (function(module, exports) {
1283
2121
 
1284
2122
  module.exports = require("@splunk/async-dynamic-options-evaluator");
1285
2123
 
1286
2124
  /***/ }),
1287
- /* 42 */
2125
+ /* 61 */
1288
2126
  /***/ (function(module, exports, __webpack_require__) {
1289
2127
 
1290
2128
  "use strict";
1291
2129
 
1292
2130
 
1293
- var _classCallCheck = __webpack_require__(9);
2131
+ var _classCallCheck = __webpack_require__(10);
1294
2132
 
1295
2133
  Object.defineProperty(exports, "__esModule", {
1296
2134
  value: true
@@ -1298,11 +2136,11 @@ Object.defineProperty(exports, "__esModule", {
1298
2136
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1299
2137
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1300
2138
 
1301
- var T = __webpack_require__(0);
2139
+ var T = __webpack_require__(1);
1302
2140
 
1303
2141
  var lodash_1 = __webpack_require__(3);
1304
2142
 
1305
- var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
2143
+ var VizActionHandler_1 = __webpack_require__(21); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1306
2144
 
1307
2145
 
1308
2146
  exports.INITIAL_WIDTH = 250;
@@ -1435,44 +2273,7 @@ SplunkVisualization.defaultProps = {
1435
2273
  exports.default = SplunkVisualization;
1436
2274
 
1437
2275
  /***/ }),
1438
- /* 43 */
1439
- /***/ (function(module, exports, __webpack_require__) {
1440
-
1441
- "use strict";
1442
-
1443
-
1444
- var _classCallCheck = __webpack_require__(9);
1445
-
1446
- var _createClass = __webpack_require__(18);
1447
-
1448
- Object.defineProperty(exports, "__esModule", {
1449
- value: true
1450
- });
1451
- exports.DefaultVizActionHandler = void 0;
1452
-
1453
- var DefaultVizActionHandler = /*#__PURE__*/function () {
1454
- function DefaultVizActionHandler() {
1455
- _classCallCheck(this, DefaultVizActionHandler);
1456
- }
1457
-
1458
- _createClass(DefaultVizActionHandler, [{
1459
- key: "focus",
1460
- value: function focus() {// noop
1461
- }
1462
- }, {
1463
- key: "snapshot",
1464
- value: function snapshot() {
1465
- return null; // noop
1466
- }
1467
- }]);
1468
-
1469
- return DefaultVizActionHandler;
1470
- }();
1471
-
1472
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
1473
-
1474
- /***/ }),
1475
- /* 44 */
2276
+ /* 62 */
1476
2277
  /***/ (function(module, exports, __webpack_require__) {
1477
2278
 
1478
2279
  "use strict";
@@ -1483,7 +2284,7 @@ Object.defineProperty(exports, "__esModule", {
1483
2284
  });
1484
2285
  exports.useDeepMemo = void 0;
1485
2286
 
1486
- var react_1 = __webpack_require__(1);
2287
+ var react_1 = __webpack_require__(0);
1487
2288
 
1488
2289
  var lodash_1 = __webpack_require__(3);
1489
2290
  /**
@@ -1517,7 +2318,7 @@ var useDeepMemo = function useDeepMemo(fn, dependencies) {
1517
2318
  exports.useDeepMemo = useDeepMemo;
1518
2319
 
1519
2320
  /***/ }),
1520
- /* 45 */
2321
+ /* 63 */
1521
2322
  /***/ (function(module, exports, __webpack_require__) {
1522
2323
 
1523
2324
  "use strict";
@@ -1528,15 +2329,15 @@ Object.defineProperty(exports, "__esModule", {
1528
2329
  });
1529
2330
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1530
2331
 
1531
- var React = __webpack_require__(1);
2332
+ var React = __webpack_require__(0);
1532
2333
 
1533
- var T = __webpack_require__(0);
2334
+ var T = __webpack_require__(1);
1534
2335
 
1535
2336
  var i18n_1 = __webpack_require__(2);
1536
2337
 
1537
- var Message_1 = __webpack_require__(10);
2338
+ var Message_1 = __webpack_require__(12);
1538
2339
 
1539
- var FixedSizeContainer_1 = __webpack_require__(13);
2340
+ var FixedSizeContainer_1 = __webpack_require__(17);
1540
2341
  /**
1541
2342
  * @method isMissing
1542
2343
  * @param {any} v
@@ -1597,7 +2398,7 @@ exports.MissingPropsMessage.defaultProps = {
1597
2398
  exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
1598
2399
 
1599
2400
  /***/ }),
1600
- /* 46 */
2401
+ /* 64 */
1601
2402
  /***/ (function(module, exports, __webpack_require__) {
1602
2403
 
1603
2404
  "use strict";
@@ -1607,18 +2408,18 @@ Object.defineProperty(exports, "__esModule", {
1607
2408
  value: true
1608
2409
  });
1609
2410
 
1610
- var React = __webpack_require__(1);
2411
+ var React = __webpack_require__(0);
1611
2412
 
1612
2413
  var styled_components_1 = __webpack_require__(4);
1613
2414
 
1614
- var hocUtils_1 = __webpack_require__(15);
2415
+ var hocUtils_1 = __webpack_require__(23);
1615
2416
 
1616
2417
  var Cover = styled_components_1.default.div.withConfig({
1617
2418
  displayName: "withEditModeCover__Cover",
1618
2419
  componentId: "sc-1gsbnxb-0"
1619
2420
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1620
2421
  var Blocker = styled_components_1.default.div.attrs({
1621
- 'data-splunk-visualization-version': "26.1.2 - 9c7479612"
2422
+ 'data-splunk-visualization-version': "26.2.1 - 714383dbb"
1622
2423
  }).withConfig({
1623
2424
  displayName: "withEditModeCover__Blocker",
1624
2425
  componentId: "sc-1gsbnxb-1"
@@ -1649,7 +2450,7 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
1649
2450
  exports.default = withEditModeCover;
1650
2451
 
1651
2452
  /***/ }),
1652
- /* 47 */
2453
+ /* 65 */
1653
2454
  /***/ (function(module, exports, __webpack_require__) {
1654
2455
 
1655
2456
  "use strict";
@@ -1659,17 +2460,17 @@ Object.defineProperty(exports, "__esModule", {
1659
2460
  value: true
1660
2461
  });
1661
2462
 
1662
- var React = __webpack_require__(1);
2463
+ var React = __webpack_require__(0);
1663
2464
 
1664
- var colorUtils_1 = __webpack_require__(12);
2465
+ var colorUtils_1 = __webpack_require__(15);
1665
2466
 
1666
- var variables_1 = __webpack_require__(11);
2467
+ var variables_1 = __webpack_require__(13);
1667
2468
 
1668
- var IconPlaceholder_1 = __webpack_require__(32);
2469
+ var IconPlaceholder_1 = __webpack_require__(37);
1669
2470
 
1670
2471
  var VizBehavior_1 = __webpack_require__(6);
1671
2472
 
1672
- var hocUtils_1 = __webpack_require__(15);
2473
+ var hocUtils_1 = __webpack_require__(23);
1673
2474
 
1674
2475
  var withPlaceholder = function withPlaceholder(Visualization) {
1675
2476
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
@@ -1713,62 +2514,307 @@ var withPlaceholder = function withPlaceholder(Visualization) {
1713
2514
  exports.default = withPlaceholder;
1714
2515
 
1715
2516
  /***/ }),
1716
- /* 48 */,
1717
- /* 49 */,
1718
- /* 50 */
2517
+ /* 66 */
2518
+ /***/ (function(module, exports, __webpack_require__) {
2519
+
2520
+ "use strict";
2521
+
2522
+
2523
+ var _slicedToArray = __webpack_require__(7);
2524
+
2525
+ Object.defineProperty(exports, "__esModule", {
2526
+ value: true
2527
+ });
2528
+
2529
+ var react_1 = __webpack_require__(0);
2530
+
2531
+ var lodash_1 = __webpack_require__(3);
2532
+
2533
+ var dataUtils_1 = __webpack_require__(14);
2534
+
2535
+ var usePrevious_1 = __webpack_require__(33);
2536
+
2537
+ var useGetXAndYFields_1 = __webpack_require__(67);
2538
+
2539
+ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
2540
+ var dataSources = _ref.dataSources,
2541
+ options = _ref.options,
2542
+ context = _ref.context,
2543
+ threshold = _ref.threshold,
2544
+ isDownsamplingEnabled = _ref.isDownsamplingEnabled;
2545
+ var isFirstUseEffectCall = (0, react_1.useRef)(true);
2546
+ var xAndYFieldsWithTypes = (0, useGetXAndYFields_1.default)({
2547
+ shouldEvaluateDSL: isDownsamplingEnabled,
2548
+ options: options,
2549
+ context: context,
2550
+ dataSources: dataSources
2551
+ });
2552
+ var previousXAndYFieldsWithTypes = (0, usePrevious_1.default)(xAndYFieldsWithTypes);
2553
+ var previousDataSources = (0, usePrevious_1.default)(dataSources);
2554
+ var previousThreshold = (0, usePrevious_1.default)(threshold);
2555
+
2556
+ var _ref2 = (0, react_1.useState)(function () {
2557
+ return isDownsamplingEnabled ? (0, dataUtils_1.downsampleDataSources)({
2558
+ dataSources: dataSources,
2559
+ threshold: threshold,
2560
+ options: xAndYFieldsWithTypes
2561
+ }) : dataSources;
2562
+ }),
2563
+ _ref3 = _slicedToArray(_ref2, 2),
2564
+ downsampledDataSources = _ref3[0],
2565
+ setDownsampledDataSources = _ref3[1];
2566
+
2567
+ var debouncedDownsampleDataSources = (0, react_1.useMemo)(function () {
2568
+ return (0, lodash_1.debounce)(function (downsampleOptions) {
2569
+ var downsampledResult = (0, dataUtils_1.downsampleDataSources)(downsampleOptions);
2570
+ setDownsampledDataSources(downsampledResult);
2571
+ }, 100, {
2572
+ trailing: true
2573
+ });
2574
+ }, []);
2575
+ (0, react_1.useEffect)(function () {
2576
+ // don't downsample again on the use effect call that happened due to the initial render
2577
+ // this is since we already downsampled as part of the useState call
2578
+ if (isFirstUseEffectCall.current) {
2579
+ isFirstUseEffectCall.current = false;
2580
+ return;
2581
+ }
2582
+
2583
+ if (!isDownsamplingEnabled) {
2584
+ setDownsampledDataSources(dataSources);
2585
+ return;
2586
+ }
2587
+
2588
+ if ((0, lodash_1.isEqual)(previousXAndYFieldsWithTypes, xAndYFieldsWithTypes) && previousDataSources === dataSources && previousThreshold === threshold) {
2589
+ return;
2590
+ } // Debounce the downsampling so we don't have to downsample and execute DSL multiple times
2591
+ // while the viz is being resized
2592
+
2593
+
2594
+ debouncedDownsampleDataSources({
2595
+ dataSources: dataSources,
2596
+ options: xAndYFieldsWithTypes,
2597
+ threshold: threshold
2598
+ }); // need to detect if this runs as part of the initial render
2599
+ }, [dataSources, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousXAndYFieldsWithTypes, previousDataSources, previousThreshold]);
2600
+ return downsampledDataSources;
2601
+ };
2602
+
2603
+ exports.default = useDownsampleDataSources;
2604
+
2605
+ /***/ }),
2606
+ /* 67 */
2607
+ /***/ (function(module, exports, __webpack_require__) {
2608
+
2609
+ "use strict";
2610
+
2611
+
2612
+ var _toConsumableArray = __webpack_require__(8);
2613
+
2614
+ Object.defineProperty(exports, "__esModule", {
2615
+ value: true
2616
+ });
2617
+
2618
+ var react_1 = __webpack_require__(0);
2619
+
2620
+ var Options_1 = __webpack_require__(16);
2621
+ /**
2622
+ * Hook that evaluates the DSL for subset of a viz's options needed to determine
2623
+ * its x and y fields as well as the types of all its fields.
2624
+ */
2625
+
2626
+
2627
+ var useGetXAndYFields = function useGetXAndYFields(_ref) {
2628
+ var shouldEvaluateDSL = _ref.shouldEvaluateDSL,
2629
+ options = _ref.options,
2630
+ context = _ref.context,
2631
+ dataSources = _ref.dataSources;
2632
+
2633
+ var _ref2 = (0, react_1.useMemo)(function () {
2634
+ var _a, _b, _c;
2635
+
2636
+ if (!shouldEvaluateDSL) {
2637
+ return {
2638
+ dataSourcesWithOnlyOnePoint: null,
2639
+ dataFrameWithOnlyOnePoint: null
2640
+ };
2641
+ }
2642
+
2643
+ if (!((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns) === null || _c === void 0 ? void 0 : _c.length)) {
2644
+ return {
2645
+ dataSourcesWithOnlyOnePoint: null,
2646
+ dataFrameWithOnlyOnePoint: null
2647
+ };
2648
+ }
2649
+
2650
+ var primaryDS = dataSources.primary;
2651
+ var columnsWithOnlyOnePoint = primaryDS.data.columns.map(function (column) {
2652
+ return [column[0]];
2653
+ });
2654
+ var filteredDataSources = {
2655
+ primary: Object.assign(Object.assign({}, primaryDS), {
2656
+ data: Object.assign(Object.assign({}, primaryDS.data), {
2657
+ columns: columnsWithOnlyOnePoint
2658
+ })
2659
+ })
2660
+ };
2661
+ return {
2662
+ dataSourcesWithOnlyOnePoint: filteredDataSources,
2663
+ dataFrameWithOnlyOnePoint: Options_1.Options.dataFrameFromDataSource(filteredDataSources)
2664
+ };
2665
+ }, [dataSources, shouldEvaluateDSL]),
2666
+ dataSourcesWithOnlyOnePoint = _ref2.dataSourcesWithOnlyOnePoint,
2667
+ dataFrameWithOnlyOnePoint = _ref2.dataFrameWithOnlyOnePoint;
2668
+
2669
+ var xAndYFieldsWithTypes = (0, react_1.useMemo)(function () {
2670
+ try {
2671
+ if (!dataSourcesWithOnlyOnePoint || !dataFrameWithOnlyOnePoint) {
2672
+ return options;
2673
+ }
2674
+
2675
+ if (!(options === null || options === void 0 ? void 0 : options.x) || !(options === null || options === void 0 ? void 0 : options.y) && !(options === null || options === void 0 ? void 0 : options.y2)) {
2676
+ return options;
2677
+ }
2678
+
2679
+ var optionsToEvaluate = {
2680
+ x: options.x,
2681
+ xField: '> x | getField()',
2682
+ y: options.y,
2683
+ yFields: options.y ? '> y | getField()' : undefined,
2684
+ y2: options.y2,
2685
+ y2Fields: options.y2 ? '> y2 | getField()' : undefined,
2686
+ fieldTypes: '> primary | getType()'
2687
+ };
2688
+
2689
+ var _Options_1$Options$ev = Options_1.Options.evaluate({
2690
+ options: optionsToEvaluate,
2691
+ context: context
2692
+ }, dataSourcesWithOnlyOnePoint, function () {}, dataFrameWithOnlyOnePoint),
2693
+ _Options_1$Options$ev2 = _Options_1$Options$ev.xField,
2694
+ xField = _Options_1$Options$ev2 === void 0 ? '' : _Options_1$Options$ev2,
2695
+ _Options_1$Options$ev3 = _Options_1$Options$ev.yFields,
2696
+ yFields = _Options_1$Options$ev3 === void 0 ? [] : _Options_1$Options$ev3,
2697
+ _Options_1$Options$ev4 = _Options_1$Options$ev.y2Fields,
2698
+ y2Fields = _Options_1$Options$ev4 === void 0 ? [] : _Options_1$Options$ev4,
2699
+ fieldTypes = _Options_1$Options$ev.fieldTypes;
2700
+
2701
+ return {
2702
+ xField: xField,
2703
+ yFields: [].concat(_toConsumableArray(yFields), _toConsumableArray(y2Fields)),
2704
+ fieldTypes: fieldTypes
2705
+ };
2706
+ } catch (e) {
2707
+ return {
2708
+ xField: undefined,
2709
+ yFields: [],
2710
+ fieldTypes: []
2711
+ };
2712
+ }
2713
+ }, [options, context, dataSourcesWithOnlyOnePoint, dataFrameWithOnlyOnePoint]);
2714
+ return xAndYFieldsWithTypes;
2715
+ };
2716
+
2717
+ exports.default = useGetXAndYFields;
2718
+
2719
+ /***/ }),
2720
+ /* 68 */
2721
+ /***/ (function(module, exports, __webpack_require__) {
2722
+
2723
+ "use strict";
2724
+
2725
+
2726
+ Object.defineProperty(exports, "__esModule", {
2727
+ value: true
2728
+ });
2729
+ exports.getFeatureFlag = void 0;
2730
+
2731
+ var FeatureFlags_1 = __webpack_require__(69);
2732
+
2733
+ var getFeatureFlag = function getFeatureFlag(context, flagName) {
2734
+ // look for feature flag in context first
2735
+ if (context && Object.keys(context).find(function (key) {
2736
+ return key === flagName;
2737
+ })) {
2738
+ return context[flagName];
2739
+ } // fall back to defaults
2740
+
2741
+
2742
+ if (Object.keys(FeatureFlags_1.default).find(function (key) {
2743
+ return key === flagName;
2744
+ })) {
2745
+ return FeatureFlags_1.default[flagName];
2746
+ } // fall back to false
2747
+
2748
+
2749
+ return false;
2750
+ };
2751
+
2752
+ exports.getFeatureFlag = getFeatureFlag;
2753
+
2754
+ /***/ }),
2755
+ /* 69 */
2756
+ /***/ (function(module, exports) {
2757
+
2758
+ module.exports = require("@splunk/visualization-context/FeatureFlags");
2759
+
2760
+ /***/ }),
2761
+ /* 70 */,
2762
+ /* 71 */,
2763
+ /* 72 */
1719
2764
  /***/ (function(module, exports) {
1720
2765
 
1721
2766
  module.exports = require("@splunk/visualization-icons/placeholders");
1722
2767
 
1723
2768
  /***/ }),
1724
- /* 51 */,
1725
- /* 52 */
2769
+ /* 73 */,
2770
+ /* 74 */
1726
2771
  /***/ (function(module, exports) {
1727
2772
 
1728
2773
  module.exports = require("@splunk/visualization-icons");
1729
2774
 
1730
2775
  /***/ }),
1731
- /* 53 */,
1732
- /* 54 */,
1733
- /* 55 */,
1734
- /* 56 */,
1735
- /* 57 */,
1736
- /* 58 */,
1737
- /* 59 */,
1738
- /* 60 */,
1739
- /* 61 */
2776
+ /* 75 */,
2777
+ /* 76 */,
2778
+ /* 77 */,
2779
+ /* 78 */,
2780
+ /* 79 */,
2781
+ /* 80 */,
2782
+ /* 81 */,
2783
+ /* 82 */,
2784
+ /* 83 */
1740
2785
  /***/ (function(module, exports) {
1741
2786
 
1742
2787
  module.exports = require("@splunk/visualization-color-palettes/editors/PresetPalettes");
1743
2788
 
1744
2789
  /***/ }),
1745
- /* 62 */,
1746
- /* 63 */
2790
+ /* 84 */,
2791
+ /* 85 */
1747
2792
  /***/ (function(module, exports) {
1748
2793
 
1749
2794
  module.exports = require("@babel/runtime/helpers/getPrototypeOf");
1750
2795
 
1751
2796
  /***/ }),
1752
- /* 64 */,
1753
- /* 65 */,
1754
- /* 66 */,
1755
- /* 67 */,
1756
- /* 68 */,
1757
- /* 69 */,
1758
- /* 70 */,
1759
- /* 71 */
2797
+ /* 86 */,
2798
+ /* 87 */,
2799
+ /* 88 */,
2800
+ /* 89 */,
2801
+ /* 90 */,
2802
+ /* 91 */,
2803
+ /* 92 */,
2804
+ /* 93 */,
2805
+ /* 94 */
1760
2806
  /***/ (function(module, exports) {
1761
2807
 
1762
2808
  module.exports = require("@babel/runtime/helpers/inherits");
1763
2809
 
1764
2810
  /***/ }),
1765
- /* 72 */
2811
+ /* 95 */
1766
2812
  /***/ (function(module, exports) {
1767
2813
 
1768
2814
  module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
1769
2815
 
1770
2816
  /***/ }),
1771
- /* 73 */
2817
+ /* 96 */
1772
2818
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1773
2819
 
1774
2820
  "use strict";
@@ -1792,31 +2838,31 @@ VizStyleWrapper.displayName = 'VizStyleWrapper';
1792
2838
  /* harmony default export */ __webpack_exports__["default"] = (VizStyleWrapper);
1793
2839
 
1794
2840
  /***/ }),
1795
- /* 74 */,
1796
- /* 75 */,
1797
- /* 76 */,
1798
- /* 77 */,
1799
- /* 78 */,
1800
- /* 79 */,
1801
- /* 80 */,
1802
- /* 81 */,
1803
- /* 82 */,
1804
- /* 83 */,
1805
- /* 84 */,
1806
- /* 85 */,
1807
- /* 86 */,
1808
- /* 87 */,
1809
- /* 88 */,
1810
- /* 89 */,
1811
- /* 90 */,
1812
- /* 91 */
2841
+ /* 97 */,
2842
+ /* 98 */,
2843
+ /* 99 */,
2844
+ /* 100 */,
2845
+ /* 101 */,
2846
+ /* 102 */,
2847
+ /* 103 */,
2848
+ /* 104 */,
2849
+ /* 105 */,
2850
+ /* 106 */,
2851
+ /* 107 */,
2852
+ /* 108 */,
2853
+ /* 109 */,
2854
+ /* 110 */,
2855
+ /* 111 */,
2856
+ /* 112 */,
2857
+ /* 113 */,
2858
+ /* 114 */
1813
2859
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1814
2860
 
1815
2861
  "use strict";
1816
2862
  __webpack_require__.r(__webpack_exports__);
1817
2863
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
1818
2864
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__);
1819
- /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
2865
+ /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29);
1820
2866
  /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__);
1821
2867
 
1822
2868
 
@@ -1832,29 +2878,6 @@ var StaticBackgroundColorEditor = {
1832
2878
  /* harmony default export */ __webpack_exports__["default"] = (StaticBackgroundColorEditor);
1833
2879
 
1834
2880
  /***/ }),
1835
- /* 92 */,
1836
- /* 93 */,
1837
- /* 94 */,
1838
- /* 95 */,
1839
- /* 96 */,
1840
- /* 97 */,
1841
- /* 98 */,
1842
- /* 99 */,
1843
- /* 100 */,
1844
- /* 101 */,
1845
- /* 102 */,
1846
- /* 103 */,
1847
- /* 104 */,
1848
- /* 105 */,
1849
- /* 106 */,
1850
- /* 107 */,
1851
- /* 108 */,
1852
- /* 109 */,
1853
- /* 110 */,
1854
- /* 111 */,
1855
- /* 112 */,
1856
- /* 113 */,
1857
- /* 114 */,
1858
2881
  /* 115 */,
1859
2882
  /* 116 */,
1860
2883
  /* 117 */,
@@ -1887,21 +2910,43 @@ var StaticBackgroundColorEditor = {
1887
2910
  /* 144 */,
1888
2911
  /* 145 */,
1889
2912
  /* 146 */,
1890
- /* 147 */
2913
+ /* 147 */,
2914
+ /* 148 */,
2915
+ /* 149 */,
2916
+ /* 150 */,
2917
+ /* 151 */,
2918
+ /* 152 */,
2919
+ /* 153 */,
2920
+ /* 154 */,
2921
+ /* 155 */,
2922
+ /* 156 */,
2923
+ /* 157 */,
2924
+ /* 158 */,
2925
+ /* 159 */,
2926
+ /* 160 */,
2927
+ /* 161 */,
2928
+ /* 162 */,
2929
+ /* 163 */,
2930
+ /* 164 */,
2931
+ /* 165 */,
2932
+ /* 166 */,
2933
+ /* 167 */,
2934
+ /* 168 */,
2935
+ /* 169 */
1891
2936
  /***/ (function(module, exports, __webpack_require__) {
1892
2937
 
1893
2938
  "use strict";
1894
2939
 
1895
2940
 
1896
- var _classCallCheck = __webpack_require__(9);
2941
+ var _classCallCheck = __webpack_require__(10);
1897
2942
 
1898
- var _createClass = __webpack_require__(18);
2943
+ var _createClass = __webpack_require__(25);
1899
2944
 
1900
- var _inherits = __webpack_require__(71);
2945
+ var _inherits = __webpack_require__(94);
1901
2946
 
1902
- var _possibleConstructorReturn = __webpack_require__(72);
2947
+ var _possibleConstructorReturn = __webpack_require__(95);
1903
2948
 
1904
- var _getPrototypeOf = __webpack_require__(63);
2949
+ var _getPrototypeOf = __webpack_require__(85);
1905
2950
 
1906
2951
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1907
2952
 
@@ -1911,11 +2956,11 @@ Object.defineProperty(exports, "__esModule", {
1911
2956
  value: true
1912
2957
  });
1913
2958
 
1914
- var React = __webpack_require__(1);
2959
+ var React = __webpack_require__(0);
1915
2960
 
1916
2961
  var lodash_1 = __webpack_require__(3);
1917
2962
 
1918
- var SvgMutator_1 = __webpack_require__(191);
2963
+ var SvgMutator_1 = __webpack_require__(213);
1919
2964
  /**
1920
2965
  * This react component simply take an SVG document, and mutates it by applying data to the document according to
1921
2966
  * dataBindings. The data (data prop) is processed by performing the mutation once for each 'row' of the data even though the data is formatted as columns.
@@ -1958,7 +3003,8 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
1958
3003
  };
1959
3004
 
1960
3005
  _this.state = {
1961
- svgNode: null
3006
+ svgNode: null,
3007
+ renderCT: 0
1962
3008
  };
1963
3009
  _this.node = null;
1964
3010
  return _this;
@@ -1995,12 +3041,10 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
1995
3041
  var svg = this.props.svg;
1996
3042
 
1997
3043
  if (svg) {
1998
- var m = new SvgMutator_1.SvgMutator(this.props);
1999
-
2000
3044
  try {
2001
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
2002
3045
  this.setState({
2003
- svgNode: m.mutate()
3046
+ svgNode: new SvgMutator_1.SvgMutator(this.props).mutate(),
3047
+ renderCT: Date.now()
2004
3048
  });
2005
3049
  } catch (e) {
2006
3050
  console.error(e);
@@ -2015,7 +3059,9 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
2015
3059
  width = _this$props$width === void 0 ? '100%' : _this$props$width,
2016
3060
  _this$props$height = _this$props.height,
2017
3061
  height = _this$props$height === void 0 ? '100%' : _this$props$height;
2018
- var svgNode = this.state.svgNode;
3062
+ var _this$state = this.state,
3063
+ svgNode = _this$state.svgNode,
3064
+ renderCT = _this$state.renderCT;
2019
3065
 
2020
3066
  if (svgNode) {
2021
3067
  return React.createElement("div", {
@@ -2023,7 +3069,8 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
2023
3069
  width: width,
2024
3070
  height: height
2025
3071
  },
2026
- ref: this.areaClickRef
3072
+ ref: this.areaClickRef,
3073
+ key: renderCT
2027
3074
  }, svgNode);
2028
3075
  }
2029
3076
 
@@ -2040,28 +3087,6 @@ SvgChoroplethDynamic.defaultProps = {
2040
3087
  };
2041
3088
 
2042
3089
  /***/ }),
2043
- /* 148 */,
2044
- /* 149 */,
2045
- /* 150 */,
2046
- /* 151 */,
2047
- /* 152 */,
2048
- /* 153 */,
2049
- /* 154 */,
2050
- /* 155 */,
2051
- /* 156 */,
2052
- /* 157 */,
2053
- /* 158 */,
2054
- /* 159 */,
2055
- /* 160 */,
2056
- /* 161 */,
2057
- /* 162 */,
2058
- /* 163 */,
2059
- /* 164 */,
2060
- /* 165 */,
2061
- /* 166 */,
2062
- /* 167 */,
2063
- /* 168 */,
2064
- /* 169 */,
2065
3090
  /* 170 */,
2066
3091
  /* 171 */,
2067
3092
  /* 172 */,
@@ -2078,7 +3103,29 @@ SvgChoroplethDynamic.defaultProps = {
2078
3103
  /* 183 */,
2079
3104
  /* 184 */,
2080
3105
  /* 185 */,
2081
- /* 186 */
3106
+ /* 186 */,
3107
+ /* 187 */,
3108
+ /* 188 */,
3109
+ /* 189 */,
3110
+ /* 190 */,
3111
+ /* 191 */,
3112
+ /* 192 */,
3113
+ /* 193 */,
3114
+ /* 194 */,
3115
+ /* 195 */,
3116
+ /* 196 */,
3117
+ /* 197 */,
3118
+ /* 198 */,
3119
+ /* 199 */,
3120
+ /* 200 */,
3121
+ /* 201 */,
3122
+ /* 202 */,
3123
+ /* 203 */,
3124
+ /* 204 */,
3125
+ /* 205 */,
3126
+ /* 206 */,
3127
+ /* 207 */,
3128
+ /* 208 */
2082
3129
  /***/ (function(module, exports, __webpack_require__) {
2083
3130
 
2084
3131
  "use strict";
@@ -2102,33 +3149,33 @@ Object.defineProperty(exports, "__esModule", {
2102
3149
  });
2103
3150
  exports.useIconPlaceholder = exports.createProtocolHandlers = exports.PureSvgChoroplethDynamic = exports.PureChoroplethSvg = exports.config = void 0;
2104
3151
 
2105
- var React = __webpack_require__(1);
3152
+ var React = __webpack_require__(0);
2106
3153
 
2107
- var T = __webpack_require__(0);
3154
+ var T = __webpack_require__(1);
2108
3155
 
2109
3156
  var lodash_1 = __webpack_require__(3);
2110
3157
 
2111
- var FeatureFlagContext_1 = __webpack_require__(21);
3158
+ var FeatureFlagContext_1 = __webpack_require__(28);
2112
3159
 
2113
- var ImageContext_1 = __webpack_require__(187);
3160
+ var ImageContext_1 = __webpack_require__(209);
2114
3161
 
2115
- var FileDownloader_1 = __webpack_require__(188);
3162
+ var FileDownloader_1 = __webpack_require__(210);
2116
3163
 
2117
- var Downloader_1 = __webpack_require__(189);
3164
+ var Downloader_1 = __webpack_require__(211);
2118
3165
 
2119
- var withDashboardViz_1 = __webpack_require__(37);
3166
+ var withDashboardViz_1 = __webpack_require__(56);
2120
3167
 
2121
- var PureChoroplethSvg_1 = __webpack_require__(190);
3168
+ var PureChoroplethSvg_1 = __webpack_require__(212);
2122
3169
 
2123
- var SvgChoroplethDynamic_1 = __webpack_require__(147);
3170
+ var SvgChoroplethDynamic_1 = __webpack_require__(169);
2124
3171
 
2125
- var config_1 = __webpack_require__(195);
3172
+ var config_1 = __webpack_require__(217);
2126
3173
 
2127
- var IconPlaceholder_1 = __webpack_require__(32);
3174
+ var IconPlaceholder_1 = __webpack_require__(37);
2128
3175
 
2129
- var urlUtils_1 = __webpack_require__(196);
3176
+ var urlUtils_1 = __webpack_require__(218);
2130
3177
 
2131
- var ErrorMessage_1 = __webpack_require__(197);
3178
+ var ErrorMessage_1 = __webpack_require__(219);
2132
3179
 
2133
3180
  exports.config = config_1.default;
2134
3181
  exports.PureChoroplethSvg = PureChoroplethSvg_1.default; // todo: need remove when deleting @splunk/react-visualizations package
@@ -2234,30 +3281,32 @@ var platformViz = (0, withDashboardViz_1.default)({
2234
3281
  exports.default = platformViz;
2235
3282
 
2236
3283
  /***/ }),
2237
- /* 187 */
3284
+ /* 209 */
2238
3285
  /***/ (function(module, exports) {
2239
3286
 
2240
3287
  module.exports = require("@splunk/visualization-context/ImageContext");
2241
3288
 
2242
3289
  /***/ }),
2243
- /* 188 */
3290
+ /* 210 */
2244
3291
  /***/ (function(module, exports) {
2245
3292
 
2246
3293
  module.exports = require("@splunk/visualizations-shared/FileDownloader");
2247
3294
 
2248
3295
  /***/ }),
2249
- /* 189 */
3296
+ /* 211 */
2250
3297
  /***/ (function(module, exports) {
2251
3298
 
2252
3299
  module.exports = require("@splunk/visualizations-shared/Downloader");
2253
3300
 
2254
3301
  /***/ }),
2255
- /* 190 */
3302
+ /* 212 */
2256
3303
  /***/ (function(module, exports, __webpack_require__) {
2257
3304
 
2258
3305
  "use strict";
2259
3306
 
2260
3307
 
3308
+ var _slicedToArray = __webpack_require__(7);
3309
+
2261
3310
  var __rest = this && this.__rest || function (s, e) {
2262
3311
  var t = {};
2263
3312
 
@@ -2276,19 +3325,19 @@ Object.defineProperty(exports, "__esModule", {
2276
3325
  });
2277
3326
  exports.computeSvgDynamicProps = void 0;
2278
3327
 
2279
- var React = __webpack_require__(1);
3328
+ var React = __webpack_require__(0);
2280
3329
 
2281
3330
  var styled_components_1 = __webpack_require__(4);
2282
3331
 
2283
3332
  var lodash_1 = __webpack_require__(3);
2284
3333
 
2285
- var style_1 = __webpack_require__(14);
3334
+ var style_1 = __webpack_require__(18);
2286
3335
 
2287
- var SizeAwareWrapper_1 = __webpack_require__(19);
3336
+ var SizeAwareWrapper_1 = __webpack_require__(26);
2288
3337
 
2289
- var SvgChoroplethDynamic_1 = __webpack_require__(147);
3338
+ var SvgChoroplethDynamic_1 = __webpack_require__(169);
2290
3339
 
2291
- var VizStyleWrapper_1 = __webpack_require__(73);
3340
+ var VizStyleWrapper_1 = __webpack_require__(96);
2292
3341
 
2293
3342
  var Container = styled_components_1.default.div.withConfig({
2294
3343
  displayName: "PureChoroplethSvg__Container",
@@ -2328,10 +3377,26 @@ var PureChoroplethSvg = function PureChoroplethSvg(_a) {
2328
3377
  var width = props.width,
2329
3378
  height = props.height,
2330
3379
  backgroundColor = props.backgroundColor;
3380
+ var cachedHandleResize = React.useCallback(function (w, h) {
3381
+ setContainerWidth(w);
3382
+ setContainerHeight(h);
3383
+ }, []);
3384
+
3385
+ var _React$useState = React.useState(Number(width)),
3386
+ _React$useState2 = _slicedToArray(_React$useState, 2),
3387
+ containerWidth = _React$useState2[0],
3388
+ setContainerWidth = _React$useState2[1];
3389
+
3390
+ var _React$useState3 = React.useState(Number(height)),
3391
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
3392
+ containerHeight = _React$useState4[0],
3393
+ setContainerHeight = _React$useState4[1];
3394
+
3395
+ var renderVisualization = function renderVisualization() {
3396
+ if (!containerWidth || !containerHeight) {
3397
+ return null;
3398
+ }
2331
3399
 
2332
- var renderVisualization = function renderVisualization(_ref) {
2333
- var containerWidth = _ref.width,
2334
- containerHeight = _ref.height;
2335
3400
  var svgProps = (0, exports.computeSvgDynamicProps)(Object.assign(Object.assign({}, props), {
2336
3401
  width: containerWidth,
2337
3402
  height: containerHeight
@@ -2345,9 +3410,11 @@ var PureChoroplethSvg = function PureChoroplethSvg(_a) {
2345
3410
  return React.createElement(Container, {
2346
3411
  width: width,
2347
3412
  height: height
2348
- }, React.createElement(ChoroplethSvgWrapper, null, React.createElement(SizeAwareWrapper_1.default, null, function (containerDimension) {
2349
- return renderVisualization(containerDimension);
2350
- })));
3413
+ }, React.createElement(ChoroplethSvgWrapper, null, React.createElement(SizeAwareWrapper_1.default, {
3414
+ width: width,
3415
+ height: height,
3416
+ onResize: cachedHandleResize
3417
+ }), renderVisualization()));
2351
3418
  };
2352
3419
 
2353
3420
  PureChoroplethSvg.defaultProps = {
@@ -2358,15 +3425,15 @@ PureChoroplethSvg.defaultProps = {
2358
3425
  exports.default = (0, styled_components_1.withTheme)(PureChoroplethSvg);
2359
3426
 
2360
3427
  /***/ }),
2361
- /* 191 */
3428
+ /* 213 */
2362
3429
  /***/ (function(module, exports, __webpack_require__) {
2363
3430
 
2364
3431
  "use strict";
2365
3432
 
2366
3433
 
2367
- var _classCallCheck = __webpack_require__(9);
3434
+ var _classCallCheck = __webpack_require__(10);
2368
3435
 
2369
- var _createClass = __webpack_require__(18);
3436
+ var _createClass = __webpack_require__(25);
2370
3437
 
2371
3438
  Object.defineProperty(exports, "__esModule", {
2372
3439
  value: true
@@ -2374,13 +3441,13 @@ Object.defineProperty(exports, "__esModule", {
2374
3441
  exports.SvgMutator = exports.ERROR_NON_ATTRIBUTE_MUTATION = void 0;
2375
3442
  /* eslint-disable no-param-reassign */
2376
3443
 
2377
- var React = __webpack_require__(1);
3444
+ var React = __webpack_require__(0);
2378
3445
 
2379
- var XPath = __webpack_require__(192);
3446
+ var XPath = __webpack_require__(214);
2380
3447
 
2381
- var xmldom_1 = __webpack_require__(193);
3448
+ var xmldom_1 = __webpack_require__(215);
2382
3449
 
2383
- var jexl = __webpack_require__(194);
3450
+ var jexl = __webpack_require__(216);
2384
3451
  /**
2385
3452
  * An error message indicating that a mutation has attempted to target anything other than SVG attribute(s)
2386
3453
  * @type {string}
@@ -2528,7 +3595,8 @@ var SvgMutator = /*#__PURE__*/function () {
2528
3595
  },
2529
3596
  frameBorder: 0,
2530
3597
  sandbox: 'allow-scripts',
2531
- id: 'svgChoroplethIframe'
3598
+ id: 'svgChoroplethIframe',
3599
+ 'data-test': 'svgChoroplethIframe'
2532
3600
  });
2533
3601
  var intervalID = null;
2534
3602
  var messageListener = null;
@@ -2541,6 +3609,7 @@ var SvgMutator = /*#__PURE__*/function () {
2541
3609
  position: 'absolute'
2542
3610
  },
2543
3611
  id: 'svgDiv',
3612
+ 'data-test': 'svgDiv',
2544
3613
  ref: function ref(div) {
2545
3614
  if (!div) {
2546
3615
  // called on unmount
@@ -2785,25 +3854,25 @@ exports.SvgMutator = SvgMutator;
2785
3854
  SvgMutator.serializer = new xmldom_1.XMLSerializer();
2786
3855
 
2787
3856
  /***/ }),
2788
- /* 192 */
3857
+ /* 214 */
2789
3858
  /***/ (function(module, exports) {
2790
3859
 
2791
3860
  module.exports = require("xpath");
2792
3861
 
2793
3862
  /***/ }),
2794
- /* 193 */
3863
+ /* 215 */
2795
3864
  /***/ (function(module, exports) {
2796
3865
 
2797
3866
  module.exports = require("@xmldom/xmldom");
2798
3867
 
2799
3868
  /***/ }),
2800
- /* 194 */
3869
+ /* 216 */
2801
3870
  /***/ (function(module, exports) {
2802
3871
 
2803
3872
  module.exports = require("jexl");
2804
3873
 
2805
3874
  /***/ }),
2806
- /* 195 */
3875
+ /* 217 */
2807
3876
  /***/ (function(module, exports, __webpack_require__) {
2808
3877
 
2809
3878
  "use strict";
@@ -2815,25 +3884,25 @@ Object.defineProperty(exports, "__esModule", {
2815
3884
 
2816
3885
  var i18n_1 = __webpack_require__(2);
2817
3886
 
2818
- var pick_1 = __webpack_require__(23);
3887
+ var pick_1 = __webpack_require__(30);
2819
3888
 
2820
- var variables_1 = __webpack_require__(11);
3889
+ var variables_1 = __webpack_require__(13);
2821
3890
 
2822
- var schemaUtils_1 = __webpack_require__(16);
3891
+ var schemaUtils_1 = __webpack_require__(24);
2823
3892
 
2824
- var PresetPalettes_1 = __webpack_require__(61);
3893
+ var PresetPalettes_1 = __webpack_require__(83);
2825
3894
 
2826
- var visualization_icons_1 = __webpack_require__(52);
3895
+ var visualization_icons_1 = __webpack_require__(74);
2827
3896
 
2828
- var placeholders_1 = __webpack_require__(50);
3897
+ var placeholders_1 = __webpack_require__(72);
2829
3898
 
2830
3899
  var VizBehavior_1 = __webpack_require__(6);
2831
3900
 
2832
- var configUtils_1 = __webpack_require__(20);
3901
+ var configUtils_1 = __webpack_require__(27);
2833
3902
 
2834
- var VizCategory_1 = __webpack_require__(36);
3903
+ var VizCategory_1 = __webpack_require__(22);
2835
3904
 
2836
- var StaticBackgroundColorEditor_1 = __webpack_require__(91);
3905
+ var StaticBackgroundColorEditor_1 = __webpack_require__(114);
2837
3906
 
2838
3907
  var dataContract = {
2839
3908
  requiredDataSources: [],
@@ -3033,7 +4102,7 @@ var config = {
3033
4102
  exports.default = (0, configUtils_1.enhanceConfig)(config);
3034
4103
 
3035
4104
  /***/ }),
3036
- /* 196 */
4105
+ /* 218 */
3037
4106
  /***/ (function(module, exports, __webpack_require__) {
3038
4107
 
3039
4108
  "use strict";
@@ -3056,7 +4125,7 @@ var isValidUrl = function isValidUrl(value) {
3056
4125
  exports.isValidUrl = isValidUrl;
3057
4126
 
3058
4127
  /***/ }),
3059
- /* 197 */
4128
+ /* 219 */
3060
4129
  /***/ (function(module, exports, __webpack_require__) {
3061
4130
 
3062
4131
  "use strict";
@@ -3079,11 +4148,11 @@ Object.defineProperty(exports, "__esModule", {
3079
4148
  value: true
3080
4149
  });
3081
4150
 
3082
- var React = __webpack_require__(1);
4151
+ var React = __webpack_require__(0);
3083
4152
 
3084
4153
  var styled_components_1 = __webpack_require__(4);
3085
4154
 
3086
- var visualization_icons_1 = __webpack_require__(52);
4155
+ var visualization_icons_1 = __webpack_require__(74);
3087
4156
 
3088
4157
  var Container = styled_components_1.default.div.withConfig({
3089
4158
  displayName: "ErrorMessage__Container",