@splunk/visualizations 26.1.1 → 26.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +1418 -351
  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 +2013 -968
  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 +3517 -2212
  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 +13 -12
  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/Map.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 410);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 432);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -95,188 +95,1122 @@ module.exports =
95
95
  /***/ 0:
96
96
  /***/ (function(module, exports) {
97
97
 
98
- module.exports = require("prop-types");
98
+ module.exports = require("react");
99
99
 
100
100
  /***/ }),
101
101
 
102
102
  /***/ 1:
103
103
  /***/ (function(module, exports) {
104
104
 
105
- module.exports = require("react");
105
+ module.exports = require("prop-types");
106
106
 
107
107
  /***/ }),
108
108
 
109
109
  /***/ 10:
110
110
  /***/ (function(module, exports) {
111
111
 
112
- module.exports = require("@splunk/visualizations-shared/Message");
112
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
113
113
 
114
114
  /***/ }),
115
115
 
116
- /***/ 11:
116
+ /***/ 106:
117
117
  /***/ (function(module, exports) {
118
118
 
119
- module.exports = require("@splunk/themes/variables");
119
+ module.exports = require("@splunk/visualization-encoding/utils/types");
120
120
 
121
121
  /***/ }),
122
122
 
123
- /***/ 12:
123
+ /***/ 11:
124
124
  /***/ (function(module, exports) {
125
125
 
126
- module.exports = require("@splunk/visualizations-shared/colorUtils");
126
+ module.exports = require("@splunk/visualizations-shared/numberUtils");
127
127
 
128
128
  /***/ }),
129
129
 
130
- /***/ 121:
130
+ /***/ 115:
131
131
  /***/ (function(module, exports, __webpack_require__) {
132
132
 
133
133
  "use strict";
134
134
 
135
135
 
136
+ var _defineProperty = __webpack_require__(9);
137
+
138
+ var _slicedToArray = __webpack_require__(7);
139
+
140
+ var _toConsumableArray = __webpack_require__(8);
141
+
136
142
  Object.defineProperty(exports, "__esModule", {
137
143
  value: true
138
144
  });
139
- exports.convertToArrOfObjects = void 0; // TODO: utilize this fn in ParallelCoordinates
145
+ exports.formatMetadata = exports.compareBaseStyles = exports.getScaledOpacities = exports.getGlobalLayerBoundaries = exports.isValidLatLon = exports.bakeBubbleData = exports.sanitizeValues = exports.transposeArray = exports.matchBubbleSize = exports.getStaticColors = exports.getZoomLevelFromGeobin = exports.getZoomConstraintsFromTileConfig = exports.getMapStyle = exports.getTilePreset = exports.LAYER_TYPE = exports.DEFAULT_OPACITY = exports.MAX_BUBBLE_RADIUS = exports.MIN_BUBBLE_RADIUS = exports.MAP_STYLE_VERSION_NUMBER = exports.DEFAULT_SERIES_COLORS = exports.DEFAULT_CLUSTER_COLOR = exports.DEFAULT_RESULT_LIMIT = exports.MIN_LONGITUDE = exports.MAX_LONGITUDE = exports.MIN_LATITUDE = exports.MAX_LATITUDE = void 0;
140
146
 
141
- var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
142
- if (!columns || !columns[0] || !columns[0].length) return [];
143
- var data = [];
147
+ var lodash_1 = __webpack_require__(3);
144
148
 
145
- var _loop = function _loop(i) {
146
- var newObj = {};
147
- fields.forEach(function (field, index) {
148
- var fieldName = typeof field === 'string' ? field : field.name;
149
+ var d3_scale_1 = __webpack_require__(116);
149
150
 
150
- if (columns[index][i] === '') {
151
- newObj[fieldName] = null;
152
- } else {
153
- newObj[fieldName] = columns[index][i];
154
- }
155
- });
156
- data.push(newObj);
157
- };
151
+ var chroma = __webpack_require__(181);
158
152
 
159
- for (var i = 0; i < columns[0].length; i += 1) {
160
- _loop(i);
161
- }
153
+ var colorUtils_1 = __webpack_require__(15);
162
154
 
163
- return data;
164
- };
155
+ var visualization_color_palettes_1 = __webpack_require__(73);
165
156
 
166
- exports.convertToArrOfObjects = convertToArrOfObjects;
157
+ var types_1 = __webpack_require__(106);
167
158
 
168
- /***/ }),
159
+ exports.MAX_LATITUDE = 90;
160
+ exports.MIN_LATITUDE = -90;
161
+ exports.MAX_LONGITUDE = 180;
162
+ exports.MIN_LONGITUDE = -180;
163
+ exports.DEFAULT_RESULT_LIMIT = 1000;
164
+ exports.DEFAULT_CLUSTER_COLOR = '#909090';
165
+ exports.DEFAULT_SERIES_COLORS = visualization_color_palettes_1.VIZ_CATEGORICAL; // MapLibre requires a map style specification number which is always 8
169
166
 
170
- /***/ 13:
171
- /***/ (function(module, exports, __webpack_require__) {
167
+ exports.MAP_STYLE_VERSION_NUMBER = 8; // currently using one [min, max] value set for bubbles across all zoom levels
168
+ // TODO: design choices on [min, max] bubble size for different zoom levels
172
169
 
173
- "use strict";
170
+ exports.MIN_BUBBLE_RADIUS = 7.11; // 10px
174
171
 
172
+ exports.MAX_BUBBLE_RADIUS = 45.26; // 85px
175
173
 
176
- Object.defineProperty(exports, "__esModule", {
177
- value: true
178
- });
174
+ exports.DEFAULT_OPACITY = 0.8;
175
+ var LONGITUDE = 'longitude';
176
+ var LATITUDE = 'latitude';
177
+ var LAYER_TYPE;
179
178
 
180
- var React = __webpack_require__(1);
179
+ (function (LAYER_TYPE) {
180
+ LAYER_TYPE["Marker"] = "marker";
181
+ LAYER_TYPE["Bubble"] = "bubble";
182
+ LAYER_TYPE["Choropleth"] = "choropleth";
183
+ })(LAYER_TYPE = exports.LAYER_TYPE || (exports.LAYER_TYPE = {}));
184
+ /**
185
+ * Construct a tile preset {key: config} by combining the default + custom tile configs
186
+ * Also returns the default tile config for each theme - light/dark
187
+ * @param {MapContextInterface} args
188
+ * @param {BaseTileConfig[]} args.defaultTileConfig
189
+ * @param {BaseTileConfig[]} args.customTileConfig
190
+ * @returns {Object} tile preset
191
+ */
181
192
 
182
- var styled_components_1 = __webpack_require__(4);
183
193
 
184
- var SizeAwareWrapper_1 = __webpack_require__(19);
194
+ var getTilePreset = function getTilePreset(_ref) {
195
+ var _ref$defaultTileConfi = _ref.defaultTileConfig,
196
+ defaultTileConfig = _ref$defaultTileConfi === void 0 ? [] : _ref$defaultTileConfi,
197
+ _ref$customTileConfig = _ref.customTileConfig,
198
+ customTileConfig = _ref$customTileConfig === void 0 ? [] : _ref$customTileConfig;
185
199
 
186
- var style_1 = __webpack_require__(14);
200
+ var _a, _b;
187
201
 
188
- var colorUtils_1 = __webpack_require__(12);
202
+ var tilePreset = {};
203
+ var defaultTileLight = {};
204
+ var defaultTileDark = {};
205
+ var tileConfigs = [].concat(defaultTileConfig).concat(customTileConfig);
206
+ (0, lodash_1.forEach)(tileConfigs, function (tileConfig) {
207
+ var key = tileConfig === null || tileConfig === void 0 ? void 0 : tileConfig.key;
208
+ var updatedConfig = Object.assign(Object.assign({
209
+ theme: 'all'
210
+ }, tileConfig), {
211
+ version: exports.MAP_STYLE_VERSION_NUMBER
212
+ });
213
+ tilePreset[key] = updatedConfig;
214
+ });
189
215
 
190
- var Item = styled_components_1.default.div.attrs(function (_ref) {
191
- var width = _ref.width;
192
- return {
193
- style: {
194
- width: (0, style_1.toPx)(width)
195
- }
196
- };
197
- }).withConfig({
198
- displayName: "FixedSizeContainer__Item",
199
- componentId: "sc-1yhgpod-0"
200
- })(["position:relative;background-color:", "};"], function (props) {
201
- return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
202
- }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
216
+ if (defaultTileConfig.length > 0) {
217
+ defaultTileLight = (_a = defaultTileConfig.find(function (config) {
218
+ return config.theme === 'light';
219
+ })) !== null && _a !== void 0 ? _a : defaultTileConfig.find(function (config) {
220
+ return config.theme === undefined;
221
+ });
222
+ defaultTileDark = (_b = defaultTileConfig.find(function (config) {
223
+ return config.theme === 'dark';
224
+ })) !== null && _b !== void 0 ? _b : defaultTileConfig.find(function (config) {
225
+ return config.theme === undefined;
226
+ });
227
+ }
203
228
 
204
- var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
205
- var width = _ref2.width,
206
- height = _ref2.height;
207
229
  return {
208
- style: Object.assign(Object.assign({}, width && {
209
- width: (0, style_1.toPx)(width)
210
- }), height && {
211
- height: (0, style_1.toPx)(height)
212
- })
213
- };
214
- }).withConfig({
215
- displayName: "FixedSizeContainer__FixSizeItem",
216
- componentId: "sc-1yhgpod-1"
217
- })(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
218
- return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
219
- });
220
- var ItemContent = styled_components_1.default.div.withConfig({
221
- displayName: "FixedSizeContainer__ItemContent",
222
- componentId: "sc-1yhgpod-2"
223
- })(["position:relative;min-height:100px;width:100%;"]);
224
- var FixSizeItemContent = styled_components_1.default.div.withConfig({
225
- displayName: "FixedSizeContainer__FixSizeItemContent",
226
- componentId: "sc-1yhgpod-3"
227
- })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
228
-
229
- var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
230
- var FixedSizeContainer = function FixedSizeContainer(props) {
231
- var width = props.width,
232
- height = props.height,
233
- backgroundColor = props.backgroundColor;
234
-
235
- if (!height) {
236
- return React.createElement(Item, {
237
- "data-test": "item",
238
- width: width,
239
- backgroundColor: backgroundColor
240
- }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
241
- }
242
-
243
- return React.createElement(FixSizeItem, {
244
- "data-test": "fix-size-item",
245
- "data-splunk-visualization-version": "26.1.1 - b6df0a015",
246
- width: width,
247
- height: height,
248
- backgroundColor: backgroundColor
249
- }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
250
- var newWidth = _ref3.width,
251
- newHeight = _ref3.height;
252
- return React.createElement(Viz, Object.assign({}, props, {
253
- width: newWidth,
254
- height: newHeight
255
- }));
256
- })));
230
+ tilePreset: tilePreset,
231
+ defaultTileLight: defaultTileLight,
232
+ defaultTileDark: defaultTileDark
257
233
  };
258
-
259
- FixedSizeContainer.displayName = 'withFixedSizeContainer';
260
- return FixedSizeContainer;
261
234
  };
262
235
 
263
- exports.default = withFixedSizeContainer;
236
+ exports.getTilePreset = getTilePreset;
237
+ /**
238
+ * Check if baseLayerTileServer is in tilePreset and config matches current theme, if yes, return.
239
+ * If no, construct a mapStyle with baseLayerTilerServer and baseLayerTileServerType
240
+ * Else return default tile config based on current theme
241
+ * @param {Object} args
242
+ * @param {BaseTileConfig[]} args.tilePreset
243
+ * @param {String} args.baseLayerTilerServer
244
+ * @param {String} args.baseLayerTileServerType
245
+ * @param {String} args.colorScheme
246
+ * @param {BaseTileConfig} args.defaultTileDark
247
+ * @param {BaseTileConfig} args.defaultTileLight
248
+ * @returns {BaseTileConfig} mapStyle
249
+ */
264
250
 
265
- /***/ }),
251
+ var getMapStyle = function getMapStyle(_ref2) {
252
+ var showBaseLayer = _ref2.showBaseLayer,
253
+ _ref2$baseLayerTileSe = _ref2.baseLayerTileServer,
254
+ baseLayerTileServer = _ref2$baseLayerTileSe === void 0 ? '' : _ref2$baseLayerTileSe,
255
+ _ref2$baseLayerTileSe2 = _ref2.baseLayerTileServerType,
256
+ baseLayerTileServerType = _ref2$baseLayerTileSe2 === void 0 ? '' : _ref2$baseLayerTileSe2,
257
+ _ref2$tilePreset = _ref2.tilePreset,
258
+ tilePreset = _ref2$tilePreset === void 0 ? {} : _ref2$tilePreset,
259
+ _ref2$colorScheme = _ref2.colorScheme,
260
+ colorScheme = _ref2$colorScheme === void 0 ? 'light' : _ref2$colorScheme,
261
+ _ref2$defaultTileLigh = _ref2.defaultTileLight,
262
+ defaultTileLight = _ref2$defaultTileLigh === void 0 ? {} : _ref2$defaultTileLigh,
263
+ _ref2$defaultTileDark = _ref2.defaultTileDark,
264
+ defaultTileDark = _ref2$defaultTileDark === void 0 ? {} : _ref2$defaultTileDark;
266
265
 
267
- /***/ 131:
268
- /***/ (function(module, exports, __webpack_require__) {
266
+ if (!showBaseLayer) {
267
+ return {
268
+ version: exports.MAP_STYLE_VERSION_NUMBER,
269
+ sources: {
270
+ 'base-tiles': {
271
+ type: 'raster',
272
+ tiles: ['data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='],
273
+ tileSize: 256
274
+ }
275
+ },
276
+ layers: [{
277
+ id: 'base-layer',
278
+ type: 'raster',
279
+ source: 'base-tiles',
280
+ minzoom: 0,
281
+ maxzoom: 22
282
+ }]
283
+ };
284
+ }
269
285
 
270
- "use strict";
286
+ if (baseLayerTileServer && tilePreset[baseLayerTileServer] && (tilePreset[baseLayerTileServer].theme === colorScheme || tilePreset[baseLayerTileServer].theme === 'all')) {
287
+ return tilePreset[baseLayerTileServer];
288
+ }
271
289
 
290
+ if (baseLayerTileServer && baseLayerTileServerType) {
291
+ var tiles = [];
292
+ /**
293
+ * Tile Server URLs (eg: http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png) can specify the variable {s} which refers to a subdomain
294
+ * Subdomains are used to help with browser parallel requests per domain limitation. These subdomains are typically single letters 'a', 'b' and 'c'
295
+ * Refer to https://leafletjs.com/SlavaUkraini/reference.html#tilelayer and https://wiki.openstreetmap.org/wiki/Tile_servers
296
+ */
272
297
 
273
- var _slicedToArray = __webpack_require__(17);
298
+ if (baseLayerTileServer.match(/^(https?):\/\/{(s|S)}\../)) {
299
+ /**
300
+ * sXML (Leaflet) allows users to define their own tile server URLs + list of available subdomains
301
+ * In order to preserve this behavior during conversion to splunk.map,
302
+ * if the variable {s} or {S} is detected, replace it with 'a', 'b' and 'c' - default values for subdomains
303
+ * TODO: in the future, add an additional prop - baseLayerTileServerSubdomains: ['x', 'y', 'z'], default being ['a', 'b', 'c']
304
+ */
305
+ tiles = [baseLayerTileServer.replace(/{(s|S)}/, 'a'), baseLayerTileServer.replace(/{(s|S)}/, 'b'), baseLayerTileServer.replace(/{(s|S)}/, 'c')];
306
+ } else {
307
+ tiles = [baseLayerTileServer];
308
+ } // TODO: remove hardcoded style when we allow users to pass in layer style through Viz options
274
309
 
275
- var _defineProperty = __webpack_require__(7);
276
310
 
277
- var _toConsumableArray = __webpack_require__(8);
311
+ var mapStyle = {
312
+ version: exports.MAP_STYLE_VERSION_NUMBER,
313
+ sources: {
314
+ 'base-tiles': {
315
+ type: baseLayerTileServerType,
316
+ tiles: tiles,
317
+ tileSize: 256
318
+ }
319
+ },
320
+ layers: [{
321
+ id: 'base-layer',
322
+ type: 'raster',
323
+ source: 'base-tiles',
324
+ minzoom: 0,
325
+ maxzoom: 24 // https://maplibre.org/maplibre-gl-js-docs/api/map/
278
326
 
279
- var _taggedTemplateLiteral = __webpack_require__(59);
327
+ }]
328
+ };
329
+ return mapStyle;
330
+ } // if tile server is not present in the preset AND we can't construct a mapStyle, fall back on defaults
331
+
332
+
333
+ return colorScheme === 'light' ? defaultTileLight : defaultTileDark;
334
+ };
335
+
336
+ exports.getMapStyle = getMapStyle;
337
+
338
+ var getZoomConstraintsFromTileConfig = function getZoomConstraintsFromTileConfig(tileConfig, baseLayerTileServer) {
339
+ var sources = tileConfig.sources,
340
+ layers = tileConfig.layers;
341
+ var matchedBaseLayerTileServer = false; // check sources for minzoom maxzoom first
342
+
343
+ var sourceKeys = Object.keys(sources);
344
+
345
+ for (var i = 0; i < sourceKeys.length; i += 1) {
346
+ var _sources$sourceKeys$i = sources[sourceKeys[i]],
347
+ minzoom = _sources$sourceKeys$i.minzoom,
348
+ maxzoom = _sources$sourceKeys$i.maxzoom;
349
+
350
+ if (baseLayerTileServer && sources[sourceKeys[i]].tiles.indexOf(baseLayerTileServer) !== -1) {
351
+ matchedBaseLayerTileServer = true;
352
+ }
353
+
354
+ if ((baseLayerTileServer && matchedBaseLayerTileServer || !baseLayerTileServer) && (0, lodash_1.isNumber)(minzoom) && (0, lodash_1.isNumber)(maxzoom)) {
355
+ return {
356
+ minZoom: minzoom,
357
+ maxZoom: maxzoom
358
+ };
359
+ }
360
+ } // then check layers
361
+
362
+
363
+ for (var _i = 0; _i < layers.length; _i += 1) {
364
+ var _layers$_i = layers[_i],
365
+ _minzoom = _layers$_i.minzoom,
366
+ _maxzoom = _layers$_i.maxzoom;
367
+
368
+ if ((baseLayerTileServer && matchedBaseLayerTileServer || !baseLayerTileServer) && (0, lodash_1.isNumber)(_minzoom) && (0, lodash_1.isNumber)(_maxzoom)) {
369
+ return {
370
+ minZoom: _minzoom,
371
+ maxZoom: _maxzoom
372
+ };
373
+ }
374
+ } // Maplibre default - would reset previous min/maxZoom https://maplibre.org/maplibre-gl-js-docs/api/map/
375
+
376
+
377
+ return {
378
+ minZoom: 0,
379
+ maxZoom: 24
380
+ };
381
+ };
382
+
383
+ exports.getZoomConstraintsFromTileConfig = getZoomConstraintsFromTileConfig;
384
+
385
+ var getZoomLevelFromGeobin = function getZoomLevelFromGeobin(geobinStr) {
386
+ var _a;
387
+
388
+ if (!geobinStr) {
389
+ return null;
390
+ } // geostats cmds return geobin with zoom level 0-18, 0-99 in the geobinPattern covers the range
391
+
392
+
393
+ var geobinPattern = /bin_id_zl_([0-9]{0,2})?_y_/g;
394
+ var match = geobinPattern.exec(geobinStr);
395
+ return (_a = (match === null || match === void 0 ? void 0 : match.length) && parseInt(match[1], 10)) !== null && _a !== void 0 ? _a : null;
396
+ };
397
+
398
+ exports.getZoomLevelFromGeobin = getZoomLevelFromGeobin; // Bubble colors - static
399
+
400
+ var getStaticColors = function getStaticColors(colorCount, colorArray) {
401
+ if (colorCount < 0 || !colorCount) {
402
+ return [exports.DEFAULT_CLUSTER_COLOR];
403
+ }
404
+
405
+ if (!colorArray || !colorArray.length) {
406
+ return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
407
+ return exports.DEFAULT_SERIES_COLORS[i];
408
+ });
409
+ } // loop through colorArray to pick the first $colorCount colors
410
+ // start from begining again if colorCount > colorArray.length
411
+
412
+
413
+ return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
414
+ return (0, colorUtils_1.isColor)(colorArray[i % colorArray.length]) ? colorArray[i % colorArray.length] : exports.DEFAULT_CLUSTER_COLOR;
415
+ });
416
+ };
417
+
418
+ exports.getStaticColors = getStaticColors; // Bubble size
419
+
420
+ var matchBubbleSize = function matchBubbleSize(dataRange, data) {
421
+ var size = (0, d3_scale_1.scalePow)().exponent(0.2).domain(dataRange).range([exports.MIN_BUBBLE_RADIUS, exports.MAX_BUBBLE_RADIUS])(data);
422
+
423
+ if (size > exports.MAX_BUBBLE_RADIUS) {
424
+ return exports.MAX_BUBBLE_RADIUS;
425
+ }
426
+
427
+ if (size < exports.MIN_BUBBLE_RADIUS) {
428
+ return exports.MIN_BUBBLE_RADIUS;
429
+ }
430
+
431
+ return size;
432
+ };
433
+
434
+ exports.matchBubbleSize = matchBubbleSize;
435
+
436
+ var transposeArray = function transposeArray(array) {
437
+ if (!array || !array.length || !array[0] || !array[0].length) {
438
+ return [];
439
+ }
440
+
441
+ return array[0].map(function (_, i) {
442
+ return array.map(function (row) {
443
+ return row[i];
444
+ });
445
+ });
446
+ };
447
+
448
+ exports.transposeArray = transposeArray; // sanitize values: update all null, undefined, or negative values to 0
449
+
450
+ var sanitizeValues = function sanitizeValues(values) {
451
+ // null / undefined
452
+ if (!values) {
453
+ return 0;
454
+ } // number
455
+
456
+
457
+ if (!Array.isArray(values)) {
458
+ return values > 0 ? values : 0;
459
+ } // array
460
+
461
+
462
+ return values.map(function (arr) {
463
+ return (0, exports.sanitizeValues)(arr);
464
+ });
465
+ };
466
+
467
+ exports.sanitizeValues = sanitizeValues;
468
+
469
+ var bakeBubbleData = function bakeBubbleData(layer) {
470
+ var _a;
471
+
472
+ if (!layer || !((_a = layer.bubbleSize) === null || _a === void 0 ? void 0 : _a.length) || !layer.geobin || !layer.geobin.length || !layer.latitude || !layer.latitude.length || !layer.longitude || !layer.longitude.length) {
473
+ return null;
474
+ } // if bubbleSize is passed as an array of single number array (data series)
475
+ // e.g. [value0, value1, ...]
476
+ // format each value as an array to unify data operations for data series and frames
477
+
478
+
479
+ var sanitizedBubbleSize = (0, exports.sanitizeValues)(layer.bubbleSize);
480
+ var transposedBubbleSize;
481
+ var transposedSanitizedBubbleSize;
482
+ var isPie = false; // format array if bubbleSize is passed as an array of array (data frame)
483
+
484
+ if (Array.isArray(layer.bubbleSize[0])) {
485
+ // one-time array transpose,
486
+ // e.g. from [column0data, column0data] (multi series)
487
+ // to [[column0datum0, column1datum0], [column0datum1, column1data1], ...]
488
+ // or e.g. from [column0data] (single series)
489
+ // to [[column0data]]
490
+ // for easy access of values at each geo location,
491
+ // and min max pie size computation
492
+ transposedBubbleSize = (0, exports.transposeArray)(layer.bubbleSize);
493
+ transposedSanitizedBubbleSize = (0, exports.transposeArray)(sanitizedBubbleSize); // if multiple series in the dataframe, set isPie to true
494
+
495
+ if (layer.bubbleSize.length > 1) {
496
+ isPie = true;
497
+ }
498
+ } else {
499
+ transposedBubbleSize = layer.bubbleSize.map(function (n) {
500
+ return [n];
501
+ });
502
+ transposedSanitizedBubbleSize = sanitizedBubbleSize.map(function (n) {
503
+ return [n];
504
+ });
505
+ }
506
+
507
+ if (!transposedBubbleSize || !transposedBubbleSize.length) {
508
+ return null;
509
+ }
510
+
511
+ var data = layer.latitude.map(function (lat, i) {
512
+ return {
513
+ zoom: (0, exports.getZoomLevelFromGeobin)(layer.geobin[i]),
514
+ values: transposedBubbleSize[i],
515
+ sanitizedValues: transposedSanitizedBubbleSize[i],
516
+ coordinates: [layer.longitude[i], lat],
517
+ metadata: layer.metadata ? layer.metadata[i] : {}
518
+ };
519
+ }).filter(function (d) {
520
+ return Boolean(d.values);
521
+ }); // compute the min/max value to encode min/max pie or bubble size
522
+
523
+ var min = (0, lodash_1.sum)(transposedSanitizedBubbleSize[0]);
524
+ var max = (0, lodash_1.sum)(transposedSanitizedBubbleSize[1]);
525
+ transposedSanitizedBubbleSize.forEach(function (row) {
526
+ var bubbleSize = (0, lodash_1.sum)(row);
527
+ max = bubbleSize > max ? bubbleSize : max;
528
+ min = bubbleSize < min ? bubbleSize : min;
529
+ });
530
+ return {
531
+ data: data,
532
+ dataRange: [min, max],
533
+ isPie: isPie,
534
+ resultLimit: layer.resultLimit,
535
+ bubbleSizeFields: layer.bubbleSizeFields
536
+ };
537
+ };
538
+
539
+ exports.bakeBubbleData = bakeBubbleData;
540
+
541
+ var isValidLatLon = function isValidLatLon(latlon) {
542
+ if (!latlon || !Array.isArray(latlon) || latlon.length !== 2) {
543
+ return false;
544
+ }
545
+
546
+ var _latlon = _slicedToArray(latlon, 2),
547
+ lat = _latlon[0],
548
+ lon = _latlon[1];
549
+
550
+ if (!(0, types_1.isNumber)(lat) || !(lat >= exports.MIN_LATITUDE && lat <= exports.MAX_LATITUDE)) {
551
+ return false;
552
+ }
553
+
554
+ if (!(0, types_1.isNumber)(lon) || !(lon >= exports.MIN_LONGITUDE && lon <= exports.MAX_LONGITUDE)) {
555
+ return false;
556
+ }
557
+
558
+ return true;
559
+ };
560
+
561
+ exports.isValidLatLon = isValidLatLon;
562
+ /**
563
+ * Returns a list of all lat or lon coordinates used in a specified layer
564
+ * @param {LayerType[]} layer
565
+ * @param {string} field
566
+ * @returns {number[]} list of lat coordinates or lon coordinates
567
+ */
568
+
569
+ var getLatOrLonCoordinates = function getLatOrLonCoordinates(layer, field) {
570
+ var getClusterValues = function getClusterValues(clusterLayer) {
571
+ return (0, lodash_1.get)(clusterLayer, field, []).slice(0, clusterLayer.type === LAYER_TYPE.Marker && clusterLayer.resultLimit ? clusterLayer.resultLimit : exports.DEFAULT_RESULT_LIMIT);
572
+ };
573
+
574
+ var getChoroplethValues = function getChoroplethValues(choroplethLayer) {
575
+ var slicedGeomList = choroplethLayer.geom.slice(0, choroplethLayer.resultLimit);
576
+ var flatCoordinates = slicedGeomList.flatMap(function (geomObject) {
577
+ return geomObject.coordinates.flat(2);
578
+ });
579
+ return flatCoordinates.map(function (coord) {
580
+ return coord[field === LONGITUDE ? 0 : 1];
581
+ });
582
+ };
583
+
584
+ return layer.type === LAYER_TYPE.Choropleth ? getChoroplethValues(layer) : getClusterValues(layer);
585
+ };
586
+ /**
587
+ * Returns the min and max LongLat pairs to determine the layer boundaries to fit all markers/bubbles
588
+ * @param {LayerType[]} layers
589
+ * @returns {LngLatBoundsLike}
590
+ */
591
+
592
+
593
+ var getGlobalLayerBoundaries = function getGlobalLayerBoundaries(layers) {
594
+ var isLayerValid = function isLayerValid(field) {
595
+ return layers.every(function (layer) {
596
+ return layer[field] || layer.geom;
597
+ });
598
+ };
599
+
600
+ var getDefaultMax = function getDefaultMax(field) {
601
+ return field === LONGITUDE ? exports.MAX_LONGITUDE : exports.MAX_LATITUDE;
602
+ };
603
+
604
+ var getDefaultMin = function getDefaultMin(field) {
605
+ return field === LONGITUDE ? exports.MIN_LONGITUDE : exports.MIN_LATITUDE;
606
+ };
607
+
608
+ if (!layers || !Array.isArray(layers) || !layers.length) {
609
+ return null;
610
+ }
611
+
612
+ var getMin = function getMin(field) {
613
+ if (!isLayerValid(field)) {
614
+ return getDefaultMin(field);
615
+ }
616
+
617
+ return layers.reduce(function (prevVal, layer) {
618
+ var coordinatesNumArr = getLatOrLonCoordinates(layer, field).map(function (x) {
619
+ return +x;
620
+ });
621
+ return (0, lodash_1.min)([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
622
+ }, getDefaultMax(field));
623
+ };
624
+
625
+ var getMax = function getMax(field) {
626
+ if (!isLayerValid(field)) {
627
+ return getDefaultMax(field);
628
+ }
629
+
630
+ return layers.reduce(function (prevVal, layer) {
631
+ var coordinatesNumArr = getLatOrLonCoordinates(layer, field).map(Number);
632
+ return (0, lodash_1.max)([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
633
+ }, getDefaultMin(field));
634
+ };
635
+
636
+ return [[getMin(LONGITUDE), getMin(LATITUDE)], [getMax(LONGITUDE), getMax(LATITUDE)]];
637
+ };
638
+
639
+ exports.getGlobalLayerBoundaries = getGlobalLayerBoundaries;
640
+
641
+ var getScaledOpacities = function getScaledOpacities(colors, cfgOpacity) {
642
+ // extract opacity information from 8 digit hex codes
643
+ var opacities = colors === null || colors === void 0 ? void 0 : colors.map(function (color) {
644
+ var _a;
645
+
646
+ return (color === null || color === void 0 ? void 0 : color.length) === 9 ? (_a = chroma(color).alpha()) !== null && _a !== void 0 ? _a : 1 : 1;
647
+ }); // opacity cannot be greater than configured opacity
648
+
649
+ return opacities === null || opacities === void 0 ? void 0 : opacities.map(function (opacity) {
650
+ return opacity * cfgOpacity;
651
+ });
652
+ };
653
+
654
+ exports.getScaledOpacities = getScaledOpacities;
655
+
656
+ var compareBaseStyles = function compareBaseStyles(curr, next) {
657
+ var _a, _b, _c, _d;
658
+
659
+ var currBaseLayer = (_a = curr === null || curr === void 0 ? void 0 : curr.layers) === null || _a === void 0 ? void 0 : _a.find(function (layer) {
660
+ return (layer === null || layer === void 0 ? void 0 : layer.id) === 'base-layer';
661
+ });
662
+ var nextBaseLayer = (_b = next === null || next === void 0 ? void 0 : next.layers) === null || _b === void 0 ? void 0 : _b.find(function (layer) {
663
+ return (layer === null || layer === void 0 ? void 0 : layer.id) === 'base-layer';
664
+ });
665
+ var currBaseSource = (0, lodash_1.get)(curr === null || curr === void 0 ? void 0 : curr.sources, (_c = currBaseLayer === null || currBaseLayer === void 0 ? void 0 : currBaseLayer.source) !== null && _c !== void 0 ? _c : '');
666
+ var nextBaseSource = (0, lodash_1.get)(next === null || next === void 0 ? void 0 : next.sources, (_d = nextBaseLayer === null || nextBaseLayer === void 0 ? void 0 : nextBaseLayer.source) !== null && _d !== void 0 ? _d : '');
667
+
668
+ if (!currBaseLayer || !nextBaseLayer || !currBaseSource || !nextBaseSource) {
669
+ return false;
670
+ }
671
+
672
+ return (0, lodash_1.isEqual)(currBaseLayer, nextBaseLayer) && (0, lodash_1.isEqual)(currBaseSource, nextBaseSource);
673
+ };
674
+
675
+ exports.compareBaseStyles = compareBaseStyles;
676
+
677
+ var formatMetadata = function formatMetadata(choroplethLayer, i) {
678
+ if (!choroplethLayer || !choroplethLayer.areaIds || !choroplethLayer.areaValues) return {};
679
+ if (i >= choroplethLayer.areaIds.length) return {};
680
+ var metadata = choroplethLayer.metadata ? choroplethLayer.metadata[i] : {};
681
+ var name = choroplethLayer.areaIds[i];
682
+ var value = choroplethLayer.areaValues[i];
683
+ var base = {
684
+ name: name,
685
+ value: String(value)
686
+ };
687
+ return Object.keys(metadata).reduce(function (result, curr) {
688
+ var key = "row.".concat(curr, ".value");
689
+ var val = (0, lodash_1.isObject)(metadata[curr]) ? JSON.stringify(metadata[curr]) : String(metadata[curr]);
690
+ return Object.assign(Object.assign({}, result), _defineProperty({}, key, val));
691
+ }, base);
692
+ };
693
+
694
+ exports.formatMetadata = formatMetadata;
695
+
696
+ /***/ }),
697
+
698
+ /***/ 116:
699
+ /***/ (function(module, exports) {
700
+
701
+ module.exports = require("d3-scale");
702
+
703
+ /***/ }),
704
+
705
+ /***/ 12:
706
+ /***/ (function(module, exports) {
707
+
708
+ module.exports = require("@splunk/visualizations-shared/Message");
709
+
710
+ /***/ }),
711
+
712
+ /***/ 13:
713
+ /***/ (function(module, exports) {
714
+
715
+ module.exports = require("@splunk/themes/variables");
716
+
717
+ /***/ }),
718
+
719
+ /***/ 14:
720
+ /***/ (function(module, exports, __webpack_require__) {
721
+
722
+ "use strict";
723
+
724
+
725
+ Object.defineProperty(exports, "__esModule", {
726
+ value: true
727
+ });
728
+ exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
729
+
730
+ var numberUtils_1 = __webpack_require__(11);
731
+
732
+ var interfaces_1 = __webpack_require__(40); // TODO: utilize this fn in ParallelCoordinates
733
+
734
+
735
+ var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
736
+ if (!columns || !columns[0] || !columns[0].length) return [];
737
+ var data = [];
738
+
739
+ var _loop = function _loop(i) {
740
+ var newObj = {};
741
+ fields.forEach(function (field, index) {
742
+ var fieldName = typeof field === 'string' ? field : field.name;
743
+
744
+ if (columns[index][i] === '') {
745
+ newObj[fieldName] = null;
746
+ } else {
747
+ newObj[fieldName] = columns[index][i];
748
+ }
749
+ });
750
+ data.push(newObj);
751
+ };
752
+
753
+ for (var i = 0; i < columns[0].length; i += 1) {
754
+ _loop(i);
755
+ }
756
+
757
+ return data;
758
+ };
759
+
760
+ exports.convertToArrOfObjects = convertToArrOfObjects; // LTTB algorithm which can be used to downsample time series data while striving to maintain
761
+ // the spikes and overall shape of the chart
762
+ // Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js
763
+ // Modifications include:
764
+ // 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)
765
+ // 2) Convert to camel case
766
+ // 3) Convert to TS and also return the indices of the points that are in the downsampled result.
767
+ // 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points
768
+ // that should be used in case of a tie of the max area in a bucket
769
+
770
+ var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, threshold, preferredDownsampleIndices) {
771
+ var dataLength = data.length;
772
+ var downsampledIndices = [];
773
+
774
+ if (threshold >= dataLength || threshold === 0) {
775
+ var allIndices = data.map(function (values, index) {
776
+ return index;
777
+ });
778
+ return {
779
+ downsampledData: data,
780
+ downsampledIndices: allIndices
781
+ }; // Nothing to do
782
+ }
783
+
784
+ var sampled = [];
785
+ var sampledIndex = 0; // Bucket size. Leave room for start and end data points
786
+
787
+ var every = (dataLength - 2) / (threshold - 2);
788
+ var a = 0; // Initially a is the first point in the triangle
789
+
790
+ var maxAreaPoint;
791
+ var maxArea;
792
+ var area;
793
+ var nextA;
794
+ sampled.push(data[a]); // Always add the first point
795
+
796
+ downsampledIndices.push(0); // eslint-disable-next-line no-plusplus
797
+
798
+ for (var i = 0; i < threshold - 2; i++) {
799
+ // Calculate point average for next bucket (containing c)
800
+ var avgX = 0;
801
+ var avgY = 0;
802
+ var avgRangeStart = Math.floor((i + 1) * every) + 1;
803
+ var avgRangeEnd = Math.floor((i + 2) * every) + 1;
804
+ avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
805
+ var avgRangeLength = avgRangeEnd - avgRangeStart; // eslint-disable-next-line no-plusplus
806
+
807
+ for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
808
+ avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)
809
+
810
+ avgY += data[avgRangeStart][1] * 1;
811
+ }
812
+
813
+ avgX /= avgRangeLength;
814
+ avgY /= avgRangeLength; // Get the range for this bucket
815
+
816
+ var rangeOffs = Math.floor((i + 0) * every) + 1;
817
+ var rangeTo = Math.floor((i + 1) * every) + 1; // Point a
818
+
819
+ var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
820
+
821
+ var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
822
+
823
+ maxArea = area = -1;
824
+ var maxAreaIndex = rangeOffs; // eslint-disable-next-line no-plusplus
825
+
826
+ for (; rangeOffs < rangeTo; rangeOffs++) {
827
+ // Calculate triangle area over three buckets
828
+ 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
829
+ // If all points in a bucket have the same area, prioritize the one with an x index
830
+ // that also existed from another series so we don't add another point unnecessarily.
831
+ // By default LTTB picks the leftmost point in the bucket
832
+
833
+ if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
834
+ maxArea = area;
835
+ maxAreaPoint = data[rangeOffs];
836
+ nextA = rangeOffs; // Next a is this b
837
+ // Modification: save the index of the point with the most area
838
+
839
+ maxAreaIndex = rangeOffs;
840
+ }
841
+ } // eslint-disable-next-line no-plusplus
842
+
843
+
844
+ sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
845
+
846
+ downsampledIndices.push(maxAreaIndex);
847
+ a = nextA; // This a is the next a (chosen b)
848
+ } // eslint-disable-next-line no-plusplus
849
+
850
+
851
+ sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
852
+
853
+ downsampledIndices.push(dataLength - 1);
854
+ return {
855
+ downsampledData: sampled,
856
+ downsampledIndices: downsampledIndices
857
+ };
858
+ };
859
+ /**
860
+ * Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines
861
+ * if at least one of the values in the column can be loosely coerced to a number.
862
+ * If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and
863
+ * returns that it cannot downsample the column.
864
+ */
865
+
866
+
867
+ var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
868
+ // Splunk charting allows for numbers in formats such as negative hex that
869
+ // Number() does not support and also allows loose coercion of hex numbers (but not other formats)
870
+ // We want to identify columns which contain at least one value that can be loosely coerced
871
+ var canLooselyCoerceSomeValues = column.findIndex(function (value) {
872
+ return (0, numberUtils_1.startsWithNumber)("".concat(value));
873
+ }) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
874
+
875
+ var coercedColumn = [];
876
+ var canDownsampleColumn = !column.some(function (value) {
877
+ var coercedValue = Number(value); // if it can't be parsed or isn't safe, fail
878
+
879
+ if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
880
+ return true;
881
+ } // save value and continue to next
882
+
883
+
884
+ coercedColumn.push(coercedValue);
885
+ return false;
886
+ });
887
+ return {
888
+ canDownsampleColumn: canDownsampleColumn,
889
+ canLooselyCoerceSomeValues: canLooselyCoerceSomeValues,
890
+ coercedColumn: canDownsampleColumn ? coercedColumn : []
891
+ };
892
+ };
893
+ /**
894
+ * Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.
895
+ * Only strictly increasing x-columns are eligible for downsampling.
896
+ * If the column is not eligible for downsampling, returns an empty array.
897
+ */
898
+
899
+
900
+ var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
901
+ if (fieldType === 'number') {
902
+ var coercedXColumn = column.map(function (xValue) {
903
+ return Number(xValue);
904
+ });
905
+
906
+ if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
907
+ return coercedXColumn;
908
+ }
909
+ } else if (fieldType === 'time') {
910
+ var _coercedXColumn = column.map(function (xValue) {
911
+ return new Date(xValue);
912
+ });
913
+
914
+ if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
915
+ return _coercedXColumn;
916
+ }
917
+ }
918
+
919
+ return [];
920
+ };
921
+
922
+ var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
923
+ var vizConfig = _ref.vizConfig;
924
+
925
+ var _a;
926
+
927
+ return (_a = vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(interfaces_1.VizBehavior.DOWNSAMPLING);
928
+ };
929
+
930
+ exports.isDownsamplingEnabledForViz = isDownsamplingEnabledForViz;
931
+
932
+ var calculateThresholdOnRangeSelect = function calculateThresholdOnRangeSelect(_ref2) {
933
+ var firstIndex = _ref2.firstIndex,
934
+ lastIndex = _ref2.lastIndex,
935
+ dataSources = _ref2.dataSources,
936
+ width = _ref2.width;
937
+
938
+ var _a, _b, _c;
939
+
940
+ var window = lastIndex - firstIndex + 1;
941
+ 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;
942
+ return Math.round(ratio * Number(width));
943
+ };
944
+
945
+ exports.calculateThresholdOnRangeSelect = calculateThresholdOnRangeSelect;
946
+ /**
947
+ * Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,
948
+ * then returns the width of the visualization.
949
+ *
950
+ * Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled
951
+ * 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
952
+ * in for a categorical chart.
953
+ */
954
+
955
+ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
956
+ var enableSearchZoom = _ref3.enableSearchZoom,
957
+ dataSources = _ref3.dataSources,
958
+ selectChartEvent = _ref3.selectChartEvent,
959
+ width = _ref3.width,
960
+ xField = _ref3.xField,
961
+ y2Fields = _ref3.y2Fields;
962
+
963
+ var _a, _b, _c;
964
+
965
+ if (enableSearchZoom || !selectChartEvent) {
966
+ return Number(width);
967
+ }
968
+
969
+ var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
970
+
971
+ if (!primaryDataSource) {
972
+ return null;
973
+ }
974
+
975
+ var startXIndex = selectChartEvent.startXIndex,
976
+ endXIndex = selectChartEvent.endXIndex,
977
+ currentTarget = selectChartEvent.currentTarget;
978
+
979
+ try {
980
+ var xFieldIndex = (_a = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _a === void 0 ? void 0 : _a.fields.findIndex(function (field) {
981
+ return field.name === xField;
982
+ });
983
+ var downsampledXFieldIndex = (_b = currentTarget.dataSet) === null || _b === void 0 ? void 0 : _b.fields.findIndex(function (field) {
984
+ return field === xField;
985
+ });
986
+
987
+ if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
988
+ return null;
989
+ }
990
+
991
+ var fullSeries = (_c = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _c === void 0 ? void 0 : _c.columns[xFieldIndex];
992
+ var downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
993
+ var firstIndex = fullSeries.findIndex(function (x) {
994
+ return downsampledSeries[startXIndex] === x;
995
+ });
996
+ var lastIndex = fullSeries.findIndex(function (x) {
997
+ return downsampledSeries[endXIndex] === x;
998
+ }); // For charts with categorical x-axis (charts with an xField that isn't _time), do not support
999
+ // re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
1000
+ // Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
1001
+ // until SPL-259611 is fixed
1002
+
1003
+ if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
1004
+ return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
1005
+ }
1006
+
1007
+ if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
1008
+ return (0, exports.calculateThresholdOnRangeSelect)({
1009
+ firstIndex: firstIndex,
1010
+ lastIndex: lastIndex,
1011
+ dataSources: dataSources,
1012
+ width: width
1013
+ });
1014
+ }
1015
+ } catch (e) {
1016
+ console.error('Error occurred while setting downsample threshold on range select event', e);
1017
+ }
1018
+
1019
+ return null;
1020
+ };
1021
+
1022
+ exports.calculateDownsamplingThreshold = calculateDownsamplingThreshold;
1023
+
1024
+ var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fieldType) {
1025
+ return column.every(function (value, index) {
1026
+ if (fieldType === 'number') {
1027
+ if (Number.isNaN(value)) {
1028
+ return false;
1029
+ }
1030
+ }
1031
+
1032
+ if (fieldType === 'time') {
1033
+ if (Number.isNaN(value.getTime())) {
1034
+ return false;
1035
+ }
1036
+ }
1037
+
1038
+ if (index === 0) {
1039
+ return true;
1040
+ }
1041
+
1042
+ return value > column[index - 1];
1043
+ });
1044
+ };
1045
+ /**
1046
+ * Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be
1047
+ * displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.
1048
+ *
1049
+ * If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
1050
+ * If not all columns can be downsampled, then returns empty arrays for both x and y
1051
+ */
1052
+
1053
+
1054
+ var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
1055
+ var xColumn = [];
1056
+ var yColumns = [];
1057
+ var canDownsample = !ds.data.fields.some(function (field, index) {
1058
+ var _a, _b;
1059
+
1060
+ var fieldName = (_a = field.name) !== null && _a !== void 0 ? _a : field;
1061
+ var fieldType = (_b = fieldTypes[index]) !== null && _b !== void 0 ? _b : 'unknown';
1062
+ var column = ds.data.columns[index];
1063
+ var hasDisplayedColumnThatCantBeDownsampled = false;
1064
+
1065
+ if (fieldName === xField) {
1066
+ xColumn = strictlyCoerceXColumn(column, fieldType);
1067
+ } else if (yFields.has(fieldName)) {
1068
+ var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
1069
+ coercedColumn = _strictlyCoerceYColum.coercedColumn,
1070
+ canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
1071
+ canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
1072
+ // be downsampled using LTTB
1073
+
1074
+
1075
+ hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
1076
+
1077
+ if (hasDisplayedColumnThatCantBeDownsampled) {
1078
+ return true;
1079
+ }
1080
+
1081
+ if (canDownsampleColumn) {
1082
+ yColumns.push(coercedColumn);
1083
+ }
1084
+ }
1085
+
1086
+ return false;
1087
+ });
1088
+
1089
+ if (canDownsample) {
1090
+ return {
1091
+ xColumn: xColumn,
1092
+ yColumns: yColumns
1093
+ };
1094
+ }
1095
+
1096
+ return {
1097
+ xColumn: [],
1098
+ yColumns: []
1099
+ };
1100
+ };
1101
+
1102
+ var pickIndicesFromDataSource = function pickIndicesFromDataSource(ds, indices) {
1103
+ var sortedIndices = Array.from(indices).sort(function (a, b) {
1104
+ return a - b;
1105
+ });
1106
+ var slicedColumns = [];
1107
+ ds.data.columns.forEach(function (column) {
1108
+ var slicedColumn = [];
1109
+ sortedIndices.forEach(function (index) {
1110
+ slicedColumn.push(column[index]);
1111
+ });
1112
+ slicedColumns.push(slicedColumn);
1113
+ }); // update data columns with downsampled columns
1114
+
1115
+ return Object.assign(Object.assign({}, ds), {
1116
+ data: Object.assign(Object.assign({}, ds.data), {
1117
+ columns: slicedColumns
1118
+ })
1119
+ });
1120
+ };
1121
+
1122
+ var downsampleDataSources = function downsampleDataSources(_ref4) {
1123
+ var dataSources = _ref4.dataSources,
1124
+ threshold = _ref4.threshold,
1125
+ options = _ref4.options;
1126
+
1127
+ var _a, _b, _c;
1128
+
1129
+ var primaryDS = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary; // only downsample time series when number of data points are over threshold
1130
+
1131
+ 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;
1132
+
1133
+ if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
1134
+ return dataSources;
1135
+ }
1136
+
1137
+ var xField = options.xField,
1138
+ yFields = options.yFields,
1139
+ fieldTypes = options.fieldTypes;
1140
+
1141
+ if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
1142
+ return dataSources;
1143
+ }
1144
+
1145
+ var nonInternalYFields = new Set(yFields.filter(function (yField) {
1146
+ return !yField.startsWith('_');
1147
+ }));
1148
+ var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
1149
+ // At the worst case, each series has non-overlapping downsampled pts
1150
+ // which will mean that all points will be included in the downsampled result
1151
+ // This will just lead to additional overhead due to coercing each
1152
+ // x and y field to number
1153
+
1154
+ if (maxPointsInDownsample >= numPoints) {
1155
+ return dataSources;
1156
+ }
1157
+
1158
+ var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
1159
+ xColumn = _tryToCoerceAllDispla.xColumn,
1160
+ yColumns = _tryToCoerceAllDispla.yColumns;
1161
+
1162
+ if (!yColumns.length || !xColumn.length) {
1163
+ return dataSources;
1164
+ }
1165
+
1166
+ var downsampledDataSources = Object.assign({}, dataSources);
1167
+ var downsampledIndices = new Set();
1168
+ yColumns.forEach(function (yColumn, columnIndex) {
1169
+ // perform LTTB downsampling for current series, LTTB takes an [x, y] pair
1170
+ var xyPair = yColumn.map(function (yValue, index) {
1171
+ return [xColumn[index], yValue];
1172
+ });
1173
+
1174
+ try {
1175
+ var _largestTriangleThree = largestTriangleThreeBuckets(xyPair, threshold, downsampledIndices),
1176
+ downsampledIndicesForSeries = _largestTriangleThree.downsampledIndices;
1177
+
1178
+ downsampledIndicesForSeries.forEach(function (downsampleIndex) {
1179
+ return downsampledIndices.add(downsampleIndex);
1180
+ });
1181
+ } catch (e) {
1182
+ console.error("Error occurred while downsampling column ".concat(columnIndex), e);
1183
+ }
1184
+ }); // update data columns with downsampled columns
1185
+
1186
+ downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
1187
+ return downsampledDataSources;
1188
+ };
1189
+
1190
+ exports.downsampleDataSources = downsampleDataSources;
1191
+
1192
+ /***/ }),
1193
+
1194
+ /***/ 15:
1195
+ /***/ (function(module, exports) {
1196
+
1197
+ module.exports = require("@splunk/visualizations-shared/colorUtils");
1198
+
1199
+ /***/ }),
1200
+
1201
+ /***/ 153:
1202
+ /***/ (function(module, exports, __webpack_require__) {
1203
+
1204
+ "use strict";
1205
+
1206
+
1207
+ var _slicedToArray = __webpack_require__(7);
1208
+
1209
+ var _defineProperty = __webpack_require__(9);
1210
+
1211
+ var _toConsumableArray = __webpack_require__(8);
1212
+
1213
+ var _taggedTemplateLiteral = __webpack_require__(81);
280
1214
 
281
1215
  var _templateObject;
282
1216
 
@@ -285,17 +1219,17 @@ Object.defineProperty(exports, "__esModule", {
285
1219
  });
286
1220
  exports.Bubble = exports.PieSegment = exports.GEO_LAT_AND_LONG_FIELD = exports.GEO_BOUND_PREFIX = void 0;
287
1221
 
288
- var React = __webpack_require__(1);
1222
+ var React = __webpack_require__(0);
289
1223
 
290
1224
  var styled_components_1 = __webpack_require__(4);
291
1225
 
292
1226
  var lodash_1 = __webpack_require__(3);
293
1227
 
294
- var colorUtils_1 = __webpack_require__(12);
1228
+ var colorUtils_1 = __webpack_require__(15);
295
1229
 
296
- var MapUtils_1 = __webpack_require__(92);
1230
+ var MapUtils_1 = __webpack_require__(115);
297
1231
 
298
- var MarkerWrapper_1 = __webpack_require__(132);
1232
+ var MarkerWrapper_1 = __webpack_require__(154);
299
1233
 
300
1234
  exports.GEO_BOUND_PREFIX = '_geo_bounds_';
301
1235
  exports.GEO_LAT_AND_LONG_FIELD = ['_geo_long_field', '_geo_lat_field'];
@@ -536,13 +1470,13 @@ exports.default = BubbleLayer;
536
1470
 
537
1471
  /***/ }),
538
1472
 
539
- /***/ 132:
1473
+ /***/ 154:
540
1474
  /***/ (function(module, exports, __webpack_require__) {
541
1475
 
542
1476
  "use strict";
543
1477
 
544
1478
 
545
- var _slicedToArray = __webpack_require__(17);
1479
+ var _slicedToArray = __webpack_require__(7);
546
1480
 
547
1481
  var __rest = this && this.__rest || function (s, e) {
548
1482
  var t = {};
@@ -561,11 +1495,11 @@ Object.defineProperty(exports, "__esModule", {
561
1495
  value: true
562
1496
  });
563
1497
 
564
- var maplibre_gl_1 = __webpack_require__(160);
1498
+ var maplibre_gl_1 = __webpack_require__(182);
565
1499
 
566
- var React = __webpack_require__(1);
1500
+ var React = __webpack_require__(0);
567
1501
 
568
- var Tooltip_1 = __webpack_require__(416);
1502
+ var Tooltip_1 = __webpack_require__(438);
569
1503
 
570
1504
  var MarkerWrapper = function MarkerWrapper(_a) {
571
1505
  var longitude = _a.longitude,
@@ -650,94 +1584,174 @@ exports.default = MarkerWrapper;
650
1584
 
651
1585
  /***/ }),
652
1586
 
653
- /***/ 133:
1587
+ /***/ 155:
654
1588
  /***/ (function(module, exports) {
655
1589
 
656
1590
  module.exports = require("@splunk/visualization-encoding/utils/dsl");
657
1591
 
658
1592
  /***/ }),
659
1593
 
660
- /***/ 14:
1594
+ /***/ 16:
661
1595
  /***/ (function(module, exports) {
662
1596
 
663
- module.exports = require("@splunk/visualizations-shared/style");
1597
+ module.exports = require("@splunk/visualization-encoding/Options");
1598
+
1599
+ /***/ }),
1600
+
1601
+ /***/ 17:
1602
+ /***/ (function(module, exports, __webpack_require__) {
1603
+
1604
+ "use strict";
1605
+
1606
+
1607
+ var _slicedToArray = __webpack_require__(7);
1608
+
1609
+ Object.defineProperty(exports, "__esModule", {
1610
+ value: true
1611
+ });
1612
+
1613
+ var React = __webpack_require__(0);
1614
+
1615
+ var styled_components_1 = __webpack_require__(4);
1616
+
1617
+ var style_1 = __webpack_require__(18);
1618
+
1619
+ var colorUtils_1 = __webpack_require__(15);
1620
+
1621
+ var SizeAwareWrapper_1 = __webpack_require__(26);
1622
+
1623
+ var Item = styled_components_1.default.div.attrs(function (_ref) {
1624
+ var width = _ref.width;
1625
+ return {
1626
+ style: {
1627
+ width: (0, style_1.toPx)(width)
1628
+ }
1629
+ };
1630
+ }).withConfig({
1631
+ displayName: "FixedSizeContainer__Item",
1632
+ componentId: "sc-1yhgpod-0"
1633
+ })(["position:relative;background-color:", "};"], function (props) {
1634
+ return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
1635
+ }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
1636
+
1637
+ var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
1638
+ var width = _ref2.width,
1639
+ height = _ref2.height;
1640
+ return {
1641
+ style: Object.assign(Object.assign({}, width && {
1642
+ width: (0, style_1.toPx)(width)
1643
+ }), height && {
1644
+ height: (0, style_1.toPx)(height)
1645
+ })
1646
+ };
1647
+ }).withConfig({
1648
+ displayName: "FixedSizeContainer__FixSizeItem",
1649
+ componentId: "sc-1yhgpod-1"
1650
+ })(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
1651
+ return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
1652
+ });
1653
+ var ItemContent = styled_components_1.default.div.withConfig({
1654
+ displayName: "FixedSizeContainer__ItemContent",
1655
+ componentId: "sc-1yhgpod-2"
1656
+ })(["position:relative;min-height:100px;width:100%;"]);
1657
+ var FixSizeItemContent = styled_components_1.default.div.withConfig({
1658
+ displayName: "FixedSizeContainer__FixSizeItemContent",
1659
+ componentId: "sc-1yhgpod-3"
1660
+ })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
664
1661
 
665
- /***/ }),
1662
+ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
1663
+ var FixedSizeContainer = function FixedSizeContainer(props) {
1664
+ var width = props.width,
1665
+ height = props.height,
1666
+ backgroundColor = props.backgroundColor;
1667
+ var cachedHandleResize = React.useCallback(function (w, h) {
1668
+ setContainerWidth(w);
1669
+ setContainerHeight(h);
1670
+ }, []);
666
1671
 
667
- /***/ 15:
668
- /***/ (function(module, exports, __webpack_require__) {
1672
+ var _React$useState = React.useState(Number(props.width)),
1673
+ _React$useState2 = _slicedToArray(_React$useState, 2),
1674
+ containerWidth = _React$useState2[0],
1675
+ setContainerWidth = _React$useState2[1];
669
1676
 
670
- "use strict";
1677
+ var _React$useState3 = React.useState(Number(props.height)),
1678
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
1679
+ containerHeight = _React$useState4[0],
1680
+ setContainerHeight = _React$useState4[1];
671
1681
 
1682
+ if (!height) {
1683
+ return React.createElement(Item, {
1684
+ "data-test": "item",
1685
+ width: width,
1686
+ backgroundColor: backgroundColor
1687
+ }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
1688
+ }
672
1689
 
673
- Object.defineProperty(exports, "__esModule", {
674
- value: true
675
- });
676
- exports.extendStaticWrapperProps = void 0;
677
- /**
678
- * @method extendStaticWrapperProps
679
- * @param {Object} props
680
- * @param {DashboardVizType} props.Wrapper
681
- * @param {DashboardVizType} props.Visualization
682
- */
1690
+ return React.createElement(FixSizeItem, {
1691
+ "data-test": "fix-size-item",
1692
+ "data-splunk-visualization-version": "26.2.0 - 49b909915",
1693
+ width: width,
1694
+ height: height,
1695
+ backgroundColor: backgroundColor
1696
+ }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, {
1697
+ width: width,
1698
+ height: height,
1699
+ onResize: cachedHandleResize
1700
+ }), React.createElement(Viz, Object.assign({}, props, {
1701
+ width: containerWidth,
1702
+ height: containerHeight
1703
+ }))));
1704
+ };
683
1705
 
684
- var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
685
- var Wrapper = _ref.Wrapper,
686
- Visualization = _ref.Visualization;
687
- var extendProperties = ['propTypes', 'defaultProps', 'config'];
688
- extendProperties.forEach(function (prop) {
689
- if (Visualization[prop]) {
690
- // eslint-disable-next-line no-param-reassign
691
- Wrapper[prop] = Visualization[prop];
692
- }
693
- });
1706
+ FixedSizeContainer.displayName = 'withFixedSizeContainer';
1707
+ return FixedSizeContainer;
694
1708
  };
695
1709
 
696
- exports.extendStaticWrapperProps = extendStaticWrapperProps;
1710
+ exports.default = withFixedSizeContainer;
697
1711
 
698
1712
  /***/ }),
699
1713
 
700
- /***/ 159:
1714
+ /***/ 18:
701
1715
  /***/ (function(module, exports) {
702
1716
 
703
- module.exports = require("chroma-js");
1717
+ module.exports = require("@splunk/visualizations-shared/style");
704
1718
 
705
1719
  /***/ }),
706
1720
 
707
- /***/ 16:
1721
+ /***/ 181:
708
1722
  /***/ (function(module, exports) {
709
1723
 
710
- module.exports = require("@splunk/visualizations-shared/schemaUtils");
1724
+ module.exports = require("chroma-js");
711
1725
 
712
1726
  /***/ }),
713
1727
 
714
- /***/ 160:
1728
+ /***/ 182:
715
1729
  /***/ (function(module, exports) {
716
1730
 
717
1731
  module.exports = require("maplibre-gl");
718
1732
 
719
1733
  /***/ }),
720
1734
 
721
- /***/ 161:
1735
+ /***/ 183:
722
1736
  /***/ (function(module, exports, __webpack_require__) {
723
1737
 
724
1738
  "use strict";
725
1739
 
726
1740
 
727
- var _slicedToArray = __webpack_require__(17);
1741
+ var _slicedToArray = __webpack_require__(7);
728
1742
 
729
1743
  Object.defineProperty(exports, "__esModule", {
730
1744
  value: true
731
1745
  });
732
1746
  exports.Choropleth = exports.cleanupChoropleth = exports.compareChoropleth = exports.compareGeom = void 0;
733
1747
 
734
- var React = __webpack_require__(1);
1748
+ var React = __webpack_require__(0);
735
1749
 
736
1750
  var lodash_1 = __webpack_require__(3);
737
1751
 
738
- var MapUtils_1 = __webpack_require__(92);
1752
+ var MapUtils_1 = __webpack_require__(115);
739
1753
 
740
- var MarkerWrapper_1 = __webpack_require__(132);
1754
+ var MarkerWrapper_1 = __webpack_require__(154);
741
1755
 
742
1756
  var getShapeId = function getShapeId(id) {
743
1757
  return "shape-".concat(id);
@@ -991,35 +2005,151 @@ exports.default = ChoroplethLayer;
991
2005
 
992
2006
  /***/ }),
993
2007
 
994
- /***/ 17:
2008
+ /***/ 19:
2009
+ /***/ (function(module, exports, __webpack_require__) {
2010
+
2011
+ "use strict";
2012
+
2013
+
2014
+ Object.defineProperty(exports, "__esModule", {
2015
+ value: true
2016
+ });
2017
+ exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
2018
+ exports.validSortDirs = ['asc', 'desc', 'none'];
2019
+ exports.validSegmentationModes = ['none', 'inner'];
2020
+ exports.validOutputModes = ['json_cols', 'json'];
2021
+
2022
+ /***/ }),
2023
+
2024
+ /***/ 2:
995
2025
  /***/ (function(module, exports) {
996
2026
 
997
- module.exports = require("@babel/runtime/helpers/slicedToArray");
2027
+ module.exports = require("@splunk/ui-utils/i18n");
998
2028
 
999
2029
  /***/ }),
1000
2030
 
1001
- /***/ 18:
2031
+ /***/ 21:
2032
+ /***/ (function(module, exports, __webpack_require__) {
2033
+
2034
+ "use strict";
2035
+
2036
+
2037
+ var _classCallCheck = __webpack_require__(10);
2038
+
2039
+ var _createClass = __webpack_require__(25);
2040
+
2041
+ Object.defineProperty(exports, "__esModule", {
2042
+ value: true
2043
+ });
2044
+ exports.DefaultVizActionHandler = void 0;
2045
+
2046
+ var DefaultVizActionHandler = /*#__PURE__*/function () {
2047
+ function DefaultVizActionHandler() {
2048
+ _classCallCheck(this, DefaultVizActionHandler);
2049
+ }
2050
+
2051
+ _createClass(DefaultVizActionHandler, [{
2052
+ key: "focus",
2053
+ value: function focus() {// noop
2054
+ }
2055
+ }, {
2056
+ key: "snapshot",
2057
+ value: function snapshot() {
2058
+ return null; // noop
2059
+ }
2060
+ }]);
2061
+
2062
+ return DefaultVizActionHandler;
2063
+ }();
2064
+
2065
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
2066
+
2067
+ /***/ }),
2068
+
2069
+ /***/ 22:
2070
+ /***/ (function(module, exports, __webpack_require__) {
2071
+
2072
+ "use strict";
2073
+
2074
+
2075
+ Object.defineProperty(exports, "__esModule", {
2076
+ value: true
2077
+ });
2078
+ exports.VizCategory = void 0;
2079
+ var VizCategory;
2080
+
2081
+ (function (VizCategory) {
2082
+ VizCategory["SINGLE_VALUE"] = "Single Value";
2083
+ VizCategory["TRENDS"] = "Trends";
2084
+ VizCategory["COMPARISONS"] = "Comparisons";
2085
+ VizCategory["TABLE"] = "Table";
2086
+ VizCategory["GAUGE"] = "Gauge";
2087
+ VizCategory["DISTRIBUTIONS"] = "Distributions";
2088
+ VizCategory["CHOROPLETH"] = "Choropleth Maps";
2089
+ VizCategory["SHAPES"] = "Shapes";
2090
+ VizCategory["MISC"] = "misc";
2091
+ VizCategory["FLOW"] = "Flow";
2092
+ VizCategory["CORRELATION"] = "Correlation";
2093
+ VizCategory["SPATIAL"] = "Spatial";
2094
+ })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
2095
+
2096
+ /***/ }),
2097
+
2098
+ /***/ 23:
2099
+ /***/ (function(module, exports, __webpack_require__) {
2100
+
2101
+ "use strict";
2102
+
2103
+
2104
+ Object.defineProperty(exports, "__esModule", {
2105
+ value: true
2106
+ });
2107
+ exports.extendStaticWrapperProps = void 0;
2108
+ /**
2109
+ * @method extendStaticWrapperProps
2110
+ * @param {Object} props
2111
+ * @param {DashboardVizType} props.Wrapper
2112
+ * @param {DashboardVizType} props.Visualization
2113
+ */
2114
+
2115
+ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
2116
+ var Wrapper = _ref.Wrapper,
2117
+ Visualization = _ref.Visualization;
2118
+ var extendProperties = ['propTypes', 'defaultProps', 'config'];
2119
+ extendProperties.forEach(function (prop) {
2120
+ if (Visualization[prop]) {
2121
+ // eslint-disable-next-line no-param-reassign
2122
+ Wrapper[prop] = Visualization[prop];
2123
+ }
2124
+ });
2125
+ };
2126
+
2127
+ exports.extendStaticWrapperProps = extendStaticWrapperProps;
2128
+
2129
+ /***/ }),
2130
+
2131
+ /***/ 24:
1002
2132
  /***/ (function(module, exports) {
1003
2133
 
1004
- module.exports = require("@babel/runtime/helpers/createClass");
2134
+ module.exports = require("@splunk/visualizations-shared/schemaUtils");
1005
2135
 
1006
2136
  /***/ }),
1007
2137
 
1008
- /***/ 19:
2138
+ /***/ 25:
1009
2139
  /***/ (function(module, exports) {
1010
2140
 
1011
- module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
2141
+ module.exports = require("@babel/runtime/helpers/createClass");
1012
2142
 
1013
2143
  /***/ }),
1014
2144
 
1015
- /***/ 2:
2145
+ /***/ 26:
1016
2146
  /***/ (function(module, exports) {
1017
2147
 
1018
- module.exports = require("@splunk/ui-utils/i18n");
2148
+ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
1019
2149
 
1020
2150
  /***/ }),
1021
2151
 
1022
- /***/ 20:
2152
+ /***/ 27:
1023
2153
  /***/ (function(module, exports, __webpack_require__) {
1024
2154
 
1025
2155
  "use strict";
@@ -1027,7 +2157,7 @@ module.exports = require("@splunk/ui-utils/i18n");
1027
2157
 
1028
2158
  var _toConsumableArray = __webpack_require__(8);
1029
2159
 
1030
- var _defineProperty = __webpack_require__(7);
2160
+ var _defineProperty = __webpack_require__(9);
1031
2161
 
1032
2162
  var __rest = this && this.__rest || function (s, e) {
1033
2163
  var t = {};
@@ -1049,7 +2179,7 @@ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig
1049
2179
 
1050
2180
  var lodash_1 = __webpack_require__(3);
1051
2181
 
1052
- var schemaUtils_1 = __webpack_require__(16);
2182
+ var schemaUtils_1 = __webpack_require__(24);
1053
2183
 
1054
2184
  var VizBehavior_1 = __webpack_require__(6);
1055
2185
 
@@ -1256,56 +2386,73 @@ exports.insertLayout = insertLayout;
1256
2386
 
1257
2387
  /***/ }),
1258
2388
 
1259
- /***/ 21:
2389
+ /***/ 28:
1260
2390
  /***/ (function(module, exports) {
1261
2391
 
1262
2392
  module.exports = require("@splunk/visualization-context/FeatureFlagContext");
1263
2393
 
1264
2394
  /***/ }),
1265
2395
 
1266
- /***/ 25:
2396
+ /***/ 3:
1267
2397
  /***/ (function(module, exports) {
1268
2398
 
1269
- module.exports = require("@splunk/ui-utils/id");
2399
+ module.exports = require("lodash");
1270
2400
 
1271
2401
  /***/ }),
1272
2402
 
1273
- /***/ 26:
2403
+ /***/ 31:
1274
2404
  /***/ (function(module, exports) {
1275
2405
 
1276
- module.exports = require("@splunk/visualization-context/TimezoneContext");
2406
+ module.exports = require("@splunk/ui-utils/id");
1277
2407
 
1278
2408
  /***/ }),
1279
2409
 
1280
- /***/ 27:
2410
+ /***/ 32:
1281
2411
  /***/ (function(module, exports) {
1282
2412
 
1283
- module.exports = require("@splunk/visualizations-shared/hocUtils");
2413
+ module.exports = require("@splunk/visualization-context/TimezoneContext");
1284
2414
 
1285
2415
  /***/ }),
1286
2416
 
1287
- /***/ 28:
1288
- /***/ (function(module, exports) {
2417
+ /***/ 33:
2418
+ /***/ (function(module, exports, __webpack_require__) {
1289
2419
 
1290
- module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
2420
+ "use strict";
2421
+
2422
+
2423
+ Object.defineProperty(exports, "__esModule", {
2424
+ value: true
2425
+ });
2426
+
2427
+ var react_1 = __webpack_require__(0);
2428
+
2429
+ function usePrevious(value) {
2430
+ var ref = (0, react_1.useRef)();
2431
+ (0, react_1.useEffect)(function () {
2432
+ ref.current = value;
2433
+ });
2434
+ return ref.current;
2435
+ }
2436
+
2437
+ exports.default = usePrevious;
1291
2438
 
1292
2439
  /***/ }),
1293
2440
 
1294
- /***/ 3:
2441
+ /***/ 34:
1295
2442
  /***/ (function(module, exports) {
1296
2443
 
1297
- module.exports = require("lodash");
2444
+ module.exports = require("@splunk/visualizations-shared/hocUtils");
1298
2445
 
1299
2446
  /***/ }),
1300
2447
 
1301
- /***/ 30:
2448
+ /***/ 35:
1302
2449
  /***/ (function(module, exports) {
1303
2450
 
1304
- module.exports = require("@splunk/visualization-encoding/Options");
2451
+ module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
1305
2452
 
1306
2453
  /***/ }),
1307
2454
 
1308
- /***/ 32:
2455
+ /***/ 37:
1309
2456
  /***/ (function(module, exports, __webpack_require__) {
1310
2457
 
1311
2458
  "use strict";
@@ -1316,17 +2463,17 @@ Object.defineProperty(exports, "__esModule", {
1316
2463
  });
1317
2464
  exports.shouldShowIconPlaceholder = void 0;
1318
2465
 
1319
- var React = __webpack_require__(1);
2466
+ var React = __webpack_require__(0);
1320
2467
 
1321
- var T = __webpack_require__(0);
2468
+ var T = __webpack_require__(1);
1322
2469
 
1323
2470
  var lodash_1 = __webpack_require__(3);
1324
2471
 
1325
2472
  var i18n_1 = __webpack_require__(2);
1326
2473
 
1327
- var Message_1 = __webpack_require__(10);
2474
+ var Message_1 = __webpack_require__(12);
1328
2475
 
1329
- var FixedSizeContainer_1 = __webpack_require__(13);
2476
+ var FixedSizeContainer_1 = __webpack_require__(17);
1330
2477
  /**
1331
2478
  * @method shouldShowIconPlaceholder
1332
2479
  * @param {object} dataSources
@@ -1398,24 +2545,24 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
1398
2545
 
1399
2546
  /***/ }),
1400
2547
 
1401
- /***/ 33:
2548
+ /***/ 38:
1402
2549
  /***/ (function(module, exports, __webpack_require__) {
1403
2550
 
1404
2551
  "use strict";
1405
2552
 
1406
2553
 
1407
- var _defineProperty = __webpack_require__(7);
2554
+ var _defineProperty = __webpack_require__(9);
1408
2555
 
1409
2556
  Object.defineProperty(exports, "__esModule", {
1410
2557
  value: true
1411
2558
  });
1412
2559
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
1413
2560
 
1414
- var T = __webpack_require__(0);
2561
+ var T = __webpack_require__(1);
1415
2562
 
1416
2563
  var lodash_1 = __webpack_require__(3);
1417
2564
 
1418
- var DataSource_1 = __webpack_require__(34);
2565
+ var DataSource_1 = __webpack_require__(19);
1419
2566
 
1420
2567
  exports.SortParamsPropTypes = T.shape({
1421
2568
  currentSortKey: T.string,
@@ -1460,32 +2607,16 @@ var getSortingParams = function getSortingParams(_ref) {
1460
2607
 
1461
2608
  return {
1462
2609
  currentSortKey: currentSortKey,
1463
- currentSortDir: currentSortDir,
1464
- onSort: onSort
1465
- };
1466
- };
1467
-
1468
- exports.getSortingParams = getSortingParams;
1469
-
1470
- /***/ }),
1471
-
1472
- /***/ 34:
1473
- /***/ (function(module, exports, __webpack_require__) {
1474
-
1475
- "use strict";
1476
-
2610
+ currentSortDir: currentSortDir,
2611
+ onSort: onSort
2612
+ };
2613
+ };
1477
2614
 
1478
- Object.defineProperty(exports, "__esModule", {
1479
- value: true
1480
- });
1481
- exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
1482
- exports.validSortDirs = ['asc', 'desc', 'none'];
1483
- exports.validSegmentationModes = ['none', 'inner'];
1484
- exports.validOutputModes = ['json_cols', 'json'];
2615
+ exports.getSortingParams = getSortingParams;
1485
2616
 
1486
2617
  /***/ }),
1487
2618
 
1488
- /***/ 35:
2619
+ /***/ 39:
1489
2620
  /***/ (function(module, exports, __webpack_require__) {
1490
2621
 
1491
2622
  "use strict";
@@ -1496,7 +2627,7 @@ Object.defineProperty(exports, "__esModule", {
1496
2627
  });
1497
2628
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1498
2629
 
1499
- var T = __webpack_require__(0);
2630
+ var T = __webpack_require__(1);
1500
2631
 
1501
2632
  var lodash_1 = __webpack_require__(3);
1502
2633
 
@@ -1550,422 +2681,128 @@ exports.getPaginationParams = getPaginationParams;
1550
2681
 
1551
2682
  /***/ }),
1552
2683
 
1553
- /***/ 36:
1554
- /***/ (function(module, exports, __webpack_require__) {
1555
-
1556
- "use strict";
1557
-
1558
-
1559
- Object.defineProperty(exports, "__esModule", {
1560
- value: true
1561
- });
1562
- exports.VizCategory = void 0;
1563
- var VizCategory;
2684
+ /***/ 4:
2685
+ /***/ (function(module, exports) {
1564
2686
 
1565
- (function (VizCategory) {
1566
- VizCategory["SINGLE_VALUE"] = "Single Value";
1567
- VizCategory["TRENDS"] = "Trends";
1568
- VizCategory["COMPARISONS"] = "Comparisons";
1569
- VizCategory["TABLE"] = "Table";
1570
- VizCategory["GAUGE"] = "Gauge";
1571
- VizCategory["DISTRIBUTIONS"] = "Distributions";
1572
- VizCategory["CHOROPLETH"] = "Choropleth Maps";
1573
- VizCategory["SHAPES"] = "Shapes";
1574
- VizCategory["MISC"] = "misc";
1575
- VizCategory["FLOW"] = "Flow";
1576
- VizCategory["CORRELATION"] = "Correlation";
1577
- VizCategory["SPATIAL"] = "Spatial";
1578
- })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
2687
+ module.exports = require("styled-components");
1579
2688
 
1580
2689
  /***/ }),
1581
2690
 
1582
- /***/ 37:
2691
+ /***/ 40:
1583
2692
  /***/ (function(module, exports, __webpack_require__) {
1584
2693
 
1585
2694
  "use strict";
1586
2695
 
1587
2696
 
1588
- var _slicedToArray = __webpack_require__(17);
1589
-
1590
- Object.defineProperty(exports, "__esModule", {
1591
- value: true
1592
- });
1593
-
1594
- var React = __webpack_require__(1);
1595
-
1596
- var lodash_1 = __webpack_require__(3);
1597
-
1598
- var getSettingsFromThemedProps_1 = __webpack_require__(38);
1599
-
1600
- var Options_1 = __webpack_require__(30);
1601
-
1602
- var SanitizeProps_1 = __webpack_require__(39);
1603
-
1604
- var TimezoneContext_1 = __webpack_require__(26);
1605
-
1606
- var moment_1 = __webpack_require__(40);
1607
-
1608
- var FeatureFlagContext_1 = __webpack_require__(21);
1609
-
1610
- var styled_components_1 = __webpack_require__(4);
1611
-
1612
- var hocUtils_1 = __webpack_require__(27);
1613
-
1614
- var JSONSchemaUtils_1 = __webpack_require__(28);
1615
-
1616
- var async_dynamic_options_evaluator_1 = __webpack_require__(41);
1617
-
1618
- var id_1 = __webpack_require__(25);
1619
-
1620
- var SplunkVisualization_1 = __webpack_require__(42);
1621
-
1622
- var VizBehavior_1 = __webpack_require__(6);
1623
-
1624
- var getSorting_1 = __webpack_require__(33);
1625
-
1626
- var getPagination_1 = __webpack_require__(35);
1627
-
1628
- var useDeepMemo_1 = __webpack_require__(44);
1629
-
1630
- var MissingPropsMessage_1 = __webpack_require__(45);
1631
-
1632
- var withEditModeCover_1 = __webpack_require__(46);
1633
-
1634
- var withPlaceholder_1 = __webpack_require__(47);
1635
- /**
1636
- * hoc that wraps a pure react visualization in a Dashboard visualization
1637
- * @param {DashboardVizOpts} opts
1638
- * @returns {HOC}
1639
- */
1640
-
1641
-
1642
- var withDashboardViz = function withDashboardViz(opts) {
1643
- var ReactViz = opts.ReactViz,
1644
- vizConfig = opts.vizConfig,
1645
- _opts$computeVizProps = opts.computeVizProps,
1646
- computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
1647
- disableEditModeCover = opts.disableEditModeCover,
1648
- useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
1649
-
1650
- var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
1651
- var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
1652
-
1653
- var DashboardViz = function DashboardViz(props) {
1654
- var _a;
1655
-
1656
- var mode = props.mode,
1657
- hasEventHandlers = props.hasEventHandlers,
1658
- dataSources = props.dataSources,
1659
- options = props.options,
1660
- _props$context = props.context,
1661
- context = _props$context === void 0 ? {} : _props$context,
1662
- width = props.width,
1663
- height = props.height,
1664
- onComputedProps = props.onComputedProps,
1665
- onEventTrigger = props.onEventTrigger,
1666
- theme = props.theme,
1667
- onRequestParamsChange = props.onRequestParamsChange;
1668
-
1669
- var _React$useContext = React.useContext(TimezoneContext_1.default),
1670
- serializedTimezone = _React$useContext.serializedTimezone;
1671
-
1672
- if (serializedTimezone) {
1673
- /*
1674
- @splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
1675
- This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
1676
- will use it.
1677
- @TODO(pwied):
1678
- - remove when we moved away from @splunk/moment
1679
- - provide timezone context to dynamic option evaluation phase
1680
- */
1681
- if (!moment_1.default.getDefaultSplunkTimezone()) {
1682
- moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
1683
- }
1684
- }
1685
-
1686
- var themeFunc = function themeFunc(themeVar) {
1687
- var _a, _b;
1688
-
1689
- return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
1690
- };
1691
-
1692
- var bgColorFromTheme = themeFunc('defaultBackgroundColor');
1693
-
1694
- var _ref = (0, getSettingsFromThemedProps_1.default)({
1695
- theme: theme
1696
- }),
1697
- currentThemeFamily = _ref.family,
1698
- currentThemeColorScheme = _ref.colorScheme,
1699
- currentThemeDensity = _ref.density;
1700
-
1701
- var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
1702
-
1703
- var _React$useState = React.useState({}),
1704
- _React$useState2 = _slicedToArray(_React$useState, 2),
1705
- evaluatedOptionsAsync = _React$useState2[0],
1706
- setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
1707
-
1708
-
1709
- var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
1710
-
1711
- var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
1712
- _React$useState4 = _slicedToArray(_React$useState3, 1),
1713
- visualizationID = _React$useState4[0];
1714
-
1715
- var _React$useState5 = React.useState({}),
1716
- _React$useState6 = _slicedToArray(_React$useState5, 2),
1717
- dataSourcesInState = _React$useState6[0],
1718
- setDataSourcesInState = _React$useState6[1];
1719
-
1720
- var _React$useState7 = React.useState(),
1721
- _React$useState8 = _slicedToArray(_React$useState7, 2),
1722
- dataFramesInState = _React$useState8[0],
1723
- setDataFramesInState = _React$useState8[1];
1724
-
1725
- var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
1726
- _React$useState10 = _slicedToArray(_React$useState9, 2),
1727
- useAsyncEvaluatedOptions = _React$useState10[0],
1728
- setUseAsyncEvaluatedOptions = _React$useState10[1];
1729
-
1730
- var isMounted = React.useRef(true);
1731
- evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
1732
- try {
1733
- if (useAsyncEvaluatedOptions) {
1734
- var optionsToEvaluate = {
1735
- context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1736
- options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
1737
- };
1738
- var asyncDynamicOptionsEvaluatorParams = {
1739
- visualizationID: visualizationID,
1740
- props: props,
1741
- options: optionsToEvaluate,
1742
- dataSources: dataSources,
1743
- theme: vizConfig.themes
1744
- };
1745
- async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
1746
- setEvaluatedOptionsAsync(results.results);
1747
- }).catch(function () {
1748
- if (isMounted.current) {
1749
- setUseAsyncEvaluatedOptions(false);
1750
- }
1751
- });
1752
- } else {
1753
- var dataFrames = dataFramesInState;
1754
-
1755
- if (dataSources !== dataSourcesInState) {
1756
- setDataSourcesInState(dataSources);
1757
- dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
1758
- setDataFramesInState(dataFrames);
1759
- }
2697
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
2698
+ if (k2 === undefined) k2 = k;
2699
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1760
2700
 
1761
- return Options_1.Options.evaluate({
1762
- context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1763
- options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
1764
- }, dataSources, themeFunc, dataFrames);
1765
- }
1766
- } catch (e) {
1767
- // eslint-disable-next-line no-console
1768
- console.error("unexpected error evaluating options: ".concat(e.message));
1769
- return {};
2701
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2702
+ desc = {
2703
+ enumerable: true,
2704
+ get: function get() {
2705
+ return m[k];
1770
2706
  }
2707
+ };
2708
+ }
1771
2709
 
1772
- return {};
1773
- }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
1774
- var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
1775
- // 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
1776
- // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
1777
-
1778
- var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
1779
- var clonedEvaluatedOptions = evaluatedOptionsToUse;
1780
-
1781
- if (isTrellisFeatureFlagOn && ((_a = vizConfig === null || vizConfig === void 0 ? void 0 : vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(VizBehavior_1.VizBehavior.TRELLIS)) && (clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.splitByLayout) === VizBehavior_1.VizBehavior.TRELLIS) {
1782
- clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
1783
- backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
1784
- });
1785
- } // useEffect hook needs to be initialized before any early returns
1786
- // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
1787
-
1788
-
1789
- React.useEffect(function () {
1790
- onComputedProps(clonedEvaluatedOptions);
1791
- });
1792
- React.useEffect(function () {
1793
- return function () {
1794
- if (useAsyncEvaluatedOptions) {
1795
- isMounted.current = false;
1796
- async_dynamic_options_evaluator_1.default.reset(visualizationID);
1797
- }
1798
- }; // eslint-disable-next-line react-hooks/exhaustive-deps
1799
- }, []); // present warning message if any required props are missing
1800
-
1801
- var _vizConfig$requiredPr = vizConfig.requiredProps,
1802
- requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
1803
- supports = vizConfig.supports;
1804
- var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
1805
-
1806
- if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && vizConfig.key !== 'splunk.singlevalue' // For SV missing props msg is not displayed if required props majorValue is missing, instead this will be handled from the component, instead handled within component
1807
- ) {
1808
- return React.createElement(MissingPropsMessage_1.default, {
1809
- "data-test": "missing-props-message",
1810
- width: width,
1811
- height: height,
1812
- missingProps: missing,
1813
- backgroundColor: bgColorFromTheme
1814
- });
1815
- } // events
1816
-
1817
-
1818
- var eventCallbackProps = {};
1819
-
1820
- if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
1821
- var supportedEvents = vizConfig.events;
1822
- Object.keys(supportedEvents).forEach(function (eventName) {
1823
- var _supportedEvents$even = supportedEvents[eventName],
1824
- parentKeys = _supportedEvents$even.parentKeys,
1825
- payloadKeys = _supportedEvents$even.payloadKeys;
1826
- var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
1827
- // then remove these lines
1828
-
1829
- var payload = {};
1830
-
1831
- if (Array.isArray(payloadKeys) && payloadKeys.length) {
1832
- payloadKeys.forEach(function (p) {
1833
- payload[p] = evaluatedOptionsToUse[p];
1834
- });
1835
- }
1836
-
1837
- eventCallbackProps[eventCallbackPropName] = function (ev) {
1838
- if (ev && ev.payload) {
1839
- payload = ev.payload;
1840
- }
2710
+ Object.defineProperty(o, k2, desc);
2711
+ } : function (o, m, k, k2) {
2712
+ if (k2 === undefined) k2 = k;
2713
+ o[k2] = m[k];
2714
+ });
1841
2715
 
1842
- return onEventTrigger({
1843
- originalEvent: ev,
1844
- payload: payload,
1845
- type: eventName
1846
- });
1847
- };
2716
+ var __exportStar = this && this.__exportStar || function (m, exports) {
2717
+ for (var p in m) {
2718
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2719
+ }
2720
+ };
1848
2721
 
1849
- if (parentKeys) {
1850
- for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
1851
- var newObject = {};
1852
- newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
1853
- eventCallbackProps[eventCallbackPropName] = newObject;
1854
- }
1855
- }
1856
- });
1857
- } // compute pure viz props which are not from options
2722
+ Object.defineProperty(exports, "__esModule", {
2723
+ value: true
2724
+ });
1858
2725
 
2726
+ __exportStar(__webpack_require__(41), exports);
1859
2727
 
1860
- var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
1861
- themeFunc: themeFunc
1862
- }));
1863
- /**
1864
- * PAGE_AND_SORT behavior
1865
- *
1866
- * Some visualizations, like table, requires metadata about the datasource,
1867
- * like total number of results, current count, offset, and sort, for rendering
1868
- * paginator and sorting direction. In this approach, the visualization
1869
- * allow users to set 'paginateDataSourceKey' to select which datasource
1870
- * should the visualization extract the metadata from. It defaults to 'primary' datasource.
1871
- * The visualization config should set the PAGE_AND_SORT behavior to receive
1872
- * 'requestParams', 'meta' and onRequestParams callback as props.
1873
- *
1874
- * In future, we could automatically detect which all datasources are being used
1875
- * and bind those magically to pagination/sorting behavior.
1876
- */
2728
+ __exportStar(__webpack_require__(42), exports);
1877
2729
 
1878
- var dataSourceMetadata = {};
1879
- var OptionKey = 'paginateDataSourceKey';
1880
- var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
2730
+ __exportStar(__webpack_require__(19), exports);
1881
2731
 
1882
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
1883
- var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
1884
- var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
2732
+ __exportStar(__webpack_require__(43), exports);
1885
2733
 
1886
- var handleRequestParamsChange = function handleRequestParamsChange(payload) {
1887
- return onRequestParamsChange(paginateDataSourceKey, payload);
1888
- };
2734
+ __exportStar(__webpack_require__(44), exports);
1889
2735
 
1890
- var sortParams = (0, getSorting_1.getSortingParams)({
1891
- requestParams: requestParams,
1892
- meta: meta,
1893
- onRequestParamsChange: handleRequestParamsChange
1894
- });
1895
- var paginatorParams = (0, getPagination_1.getPaginationParams)({
1896
- requestParams: requestParams,
1897
- meta: meta,
1898
- onRequestParamsChange: handleRequestParamsChange
1899
- });
1900
- dataSourceMetadata = {
1901
- sortParams: sortParams,
1902
- paginatorParams: paginatorParams
1903
- };
1904
- } // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
2736
+ __exportStar(__webpack_require__(45), exports);
1905
2737
 
2738
+ __exportStar(__webpack_require__(46), exports);
1906
2739
 
1907
- if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
1908
- return null;
1909
- }
2740
+ __exportStar(__webpack_require__(47), exports);
1910
2741
 
1911
- return React.createElement(SanitizedReactViz, Object.assign({
1912
- mode: mode,
1913
- width: width,
1914
- height: height
1915
- }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
1916
- };
2742
+ __exportStar(__webpack_require__(48), exports);
1917
2743
 
1918
- DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
1919
- DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
1920
- // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
1921
- theme: {}
1922
- }); // attach viz config
2744
+ __exportStar(__webpack_require__(49), exports);
1923
2745
 
1924
- DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
2746
+ __exportStar(__webpack_require__(21), exports);
1925
2747
 
1926
- return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
1927
- };
2748
+ __exportStar(__webpack_require__(6), exports);
1928
2749
 
1929
- exports.default = withDashboardViz;
2750
+ __exportStar(__webpack_require__(22), exports);
1930
2751
 
1931
- /***/ }),
2752
+ __exportStar(__webpack_require__(50), exports);
1932
2753
 
1933
- /***/ 38:
1934
- /***/ (function(module, exports) {
2754
+ __exportStar(__webpack_require__(51), exports);
1935
2755
 
1936
- module.exports = require("@splunk/themes/getSettingsFromThemedProps");
2756
+ __exportStar(__webpack_require__(52), exports);
1937
2757
 
1938
- /***/ }),
2758
+ __exportStar(__webpack_require__(53), exports);
1939
2759
 
1940
- /***/ 39:
1941
- /***/ (function(module, exports) {
2760
+ __exportStar(__webpack_require__(54), exports);
1942
2761
 
1943
- module.exports = require("@splunk/visualizations-shared/SanitizeProps");
2762
+ __exportStar(__webpack_require__(55), exports);
1944
2763
 
1945
2764
  /***/ }),
1946
2765
 
1947
- /***/ 4:
1948
- /***/ (function(module, exports) {
2766
+ /***/ 41:
2767
+ /***/ (function(module, exports, __webpack_require__) {
1949
2768
 
1950
- module.exports = require("styled-components");
2769
+ "use strict";
2770
+
2771
+
2772
+ Object.defineProperty(exports, "__esModule", {
2773
+ value: true
2774
+ });
1951
2775
 
1952
2776
  /***/ }),
1953
2777
 
1954
- /***/ 40:
1955
- /***/ (function(module, exports) {
2778
+ /***/ 42:
2779
+ /***/ (function(module, exports, __webpack_require__) {
1956
2780
 
1957
- module.exports = require("@splunk/moment");
2781
+ "use strict";
2782
+
2783
+ /**
2784
+ * A data structure used at runtime to wire up a visualization.
2785
+ */
2786
+
2787
+ Object.defineProperty(exports, "__esModule", {
2788
+ value: true
2789
+ });
1958
2790
 
1959
2791
  /***/ }),
1960
2792
 
1961
- /***/ 41:
1962
- /***/ (function(module, exports) {
2793
+ /***/ 43:
2794
+ /***/ (function(module, exports, __webpack_require__) {
1963
2795
 
1964
- module.exports = require("@splunk/async-dynamic-options-evaluator");
2796
+ "use strict";
2797
+
2798
+
2799
+ Object.defineProperty(exports, "__esModule", {
2800
+ value: true
2801
+ });
1965
2802
 
1966
2803
  /***/ }),
1967
2804
 
1968
- /***/ 410:
2805
+ /***/ 432:
1969
2806
  /***/ (function(module, exports, __webpack_require__) {
1970
2807
 
1971
2808
  "use strict";
@@ -1990,29 +2827,29 @@ Object.defineProperty(exports, "__esModule", {
1990
2827
  exports.PureMap = exports.config = exports.themes = exports.useIconPlaceholder = exports.computeVizProps = void 0;
1991
2828
  /* eslint-disable no-sequences */
1992
2829
 
1993
- var React = __webpack_require__(1);
2830
+ var React = __webpack_require__(0);
1994
2831
 
1995
- var colorUtils_1 = __webpack_require__(12);
2832
+ var colorUtils_1 = __webpack_require__(15);
1996
2833
 
1997
- var hocUtils_1 = __webpack_require__(27);
2834
+ var hocUtils_1 = __webpack_require__(34);
1998
2835
 
1999
- var JSONSchemaUtils_1 = __webpack_require__(28);
2836
+ var JSONSchemaUtils_1 = __webpack_require__(35);
2000
2837
 
2001
- var PureMap_1 = __webpack_require__(411);
2838
+ var PureMap_1 = __webpack_require__(433);
2002
2839
 
2003
2840
  exports.PureMap = PureMap_1.default;
2004
2841
 
2005
- var config_1 = __webpack_require__(421);
2842
+ var config_1 = __webpack_require__(443);
2006
2843
 
2007
2844
  exports.config = config_1.default;
2008
2845
 
2009
- var withDashboardViz_1 = __webpack_require__(37);
2846
+ var withDashboardViz_1 = __webpack_require__(56);
2010
2847
 
2011
- var mapUtils_1 = __webpack_require__(422);
2848
+ var mapUtils_1 = __webpack_require__(444);
2012
2849
 
2013
- var BubbleLayer_1 = __webpack_require__(131);
2850
+ var BubbleLayer_1 = __webpack_require__(153);
2014
2851
 
2015
- var dataUtils_1 = __webpack_require__(121);
2852
+ var dataUtils_1 = __webpack_require__(14);
2016
2853
 
2017
2854
  var formatLayer = function formatLayer(l, dataFields, dataSourceData, transformedData) {
2018
2855
  // add key `geobin` to the layer object if the data is returned from geostats commands
@@ -2232,44 +3069,44 @@ exports.default = Map;
2232
3069
 
2233
3070
  /***/ }),
2234
3071
 
2235
- /***/ 411:
3072
+ /***/ 433:
2236
3073
  /***/ (function(module, exports, __webpack_require__) {
2237
3074
 
2238
3075
  "use strict";
2239
3076
 
2240
3077
 
2241
- var _slicedToArray = __webpack_require__(17);
3078
+ var _slicedToArray = __webpack_require__(7);
2242
3079
 
2243
3080
  Object.defineProperty(exports, "__esModule", {
2244
3081
  value: true
2245
3082
  });
2246
3083
  exports.isLatLng = exports.formatColor = exports.DEFAULT_ZOOM = exports.DEFAULT_SHOW_BASELAYER = exports.DEFAULT_SHOW_ZOOM_CONTROLS = exports.DEFAULT_SHOW_SCALE = exports.DEFAULT_SCALE_UNIT = exports.DEFAULT_CONTROL_FOREGROUND_COLOR = exports.DEFAULT_CONTROL_BACKGROUND_COLOR = exports.DEFAULT_CENTER = void 0;
2247
3084
 
2248
- var React = __webpack_require__(1);
3085
+ var React = __webpack_require__(0);
2249
3086
 
2250
3087
  var lodash_1 = __webpack_require__(3);
2251
3088
 
2252
- var react_1 = __webpack_require__(1);
3089
+ var react_1 = __webpack_require__(0);
2253
3090
 
2254
- var T = __webpack_require__(0);
3091
+ var T = __webpack_require__(1);
2255
3092
 
2256
- var chroma = __webpack_require__(159);
3093
+ var chroma = __webpack_require__(181);
2257
3094
 
2258
- var maplibre_gl_1 = __webpack_require__(160);
3095
+ var maplibre_gl_1 = __webpack_require__(182);
2259
3096
 
2260
3097
  var i18n_1 = __webpack_require__(2);
2261
3098
 
2262
- var MapContext_1 = __webpack_require__(412);
3099
+ var MapContext_1 = __webpack_require__(434);
2263
3100
 
2264
- var PureMapContainer_1 = __webpack_require__(413);
3101
+ var PureMapContainer_1 = __webpack_require__(435);
2265
3102
 
2266
- var MapUtils_1 = __webpack_require__(92);
3103
+ var MapUtils_1 = __webpack_require__(115);
2267
3104
 
2268
- var ClusterLayer_1 = __webpack_require__(415);
3105
+ var ClusterLayer_1 = __webpack_require__(437);
2269
3106
 
2270
- var ChoroplethLayer_1 = __webpack_require__(161);
3107
+ var ChoroplethLayer_1 = __webpack_require__(183);
2271
3108
 
2272
- var LocalChoroplethLayer_1 = __webpack_require__(418);
3109
+ var LocalChoroplethLayer_1 = __webpack_require__(440);
2273
3110
 
2274
3111
  exports.DEFAULT_CENTER = [0, 0];
2275
3112
  exports.DEFAULT_CONTROL_BACKGROUND_COLOR = '#2b3033';
@@ -2696,14 +3533,14 @@ exports.default = PureMap;
2696
3533
 
2697
3534
  /***/ }),
2698
3535
 
2699
- /***/ 412:
3536
+ /***/ 434:
2700
3537
  /***/ (function(module, exports) {
2701
3538
 
2702
3539
  module.exports = require("@splunk/visualization-context/MapContext");
2703
3540
 
2704
3541
  /***/ }),
2705
3542
 
2706
- /***/ 413:
3543
+ /***/ 435:
2707
3544
  /***/ (function(module, exports, __webpack_require__) {
2708
3545
 
2709
3546
  "use strict";
@@ -2717,9 +3554,9 @@ var styled_components_1 = __webpack_require__(4);
2717
3554
 
2718
3555
  var lodash_1 = __webpack_require__(3);
2719
3556
 
2720
- var style_1 = __webpack_require__(14);
3557
+ var style_1 = __webpack_require__(18);
2721
3558
 
2722
- var maplibre_gl_css_1 = __webpack_require__(414);
3559
+ var maplibre_gl_css_1 = __webpack_require__(436);
2723
3560
 
2724
3561
  var PureMapContainer = styled_components_1.default.div.attrs({
2725
3562
  'data-testid': 'puremap-container'
@@ -2757,7 +3594,7 @@ exports.default = PureMapContainer;
2757
3594
 
2758
3595
  /***/ }),
2759
3596
 
2760
- /***/ 414:
3597
+ /***/ 436:
2761
3598
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2762
3599
 
2763
3600
  "use strict";
@@ -2766,7 +3603,7 @@ __webpack_require__.r(__webpack_exports__);
2766
3603
 
2767
3604
  /***/ }),
2768
3605
 
2769
- /***/ 415:
3606
+ /***/ 437:
2770
3607
  /***/ (function(module, exports, __webpack_require__) {
2771
3608
 
2772
3609
  "use strict";
@@ -2776,13 +3613,13 @@ Object.defineProperty(exports, "__esModule", {
2776
3613
  value: true
2777
3614
  });
2778
3615
 
2779
- var React = __webpack_require__(1);
3616
+ var React = __webpack_require__(0);
2780
3617
 
2781
- var BubbleLayer_1 = __webpack_require__(131);
3618
+ var BubbleLayer_1 = __webpack_require__(153);
2782
3619
 
2783
- var MarkerLayer_1 = __webpack_require__(417);
3620
+ var MarkerLayer_1 = __webpack_require__(439);
2784
3621
 
2785
- var MapUtils_1 = __webpack_require__(92);
3622
+ var MapUtils_1 = __webpack_require__(115);
2786
3623
 
2787
3624
  var ClusterLayer = function ClusterLayer(_ref) {
2788
3625
  var clusterLayer = _ref.clusterLayer,
@@ -2821,13 +3658,13 @@ exports.default = ClusterLayer;
2821
3658
 
2822
3659
  /***/ }),
2823
3660
 
2824
- /***/ 416:
3661
+ /***/ 438:
2825
3662
  /***/ (function(module, exports, __webpack_require__) {
2826
3663
 
2827
3664
  "use strict";
2828
3665
 
2829
3666
 
2830
- var _taggedTemplateLiteral = __webpack_require__(59);
3667
+ var _taggedTemplateLiteral = __webpack_require__(81);
2831
3668
 
2832
3669
  var _templateObject;
2833
3670
 
@@ -2836,11 +3673,11 @@ Object.defineProperty(exports, "__esModule", {
2836
3673
  });
2837
3674
  exports.convertDegToDMS = void 0;
2838
3675
 
2839
- var React = __webpack_require__(1);
3676
+ var React = __webpack_require__(0);
2840
3677
 
2841
3678
  var styled_components_1 = __webpack_require__(4);
2842
3679
 
2843
- var Popover_1 = __webpack_require__(62);
3680
+ var Popover_1 = __webpack_require__(84);
2844
3681
 
2845
3682
  var i18n_1 = __webpack_require__(2);
2846
3683
 
@@ -2945,15 +3782,15 @@ exports.default = Tooltip;
2945
3782
 
2946
3783
  /***/ }),
2947
3784
 
2948
- /***/ 417:
3785
+ /***/ 439:
2949
3786
  /***/ (function(module, exports, __webpack_require__) {
2950
3787
 
2951
3788
  "use strict";
2952
3789
 
2953
3790
 
2954
- var _defineProperty = __webpack_require__(7);
3791
+ var _defineProperty = __webpack_require__(9);
2955
3792
 
2956
- var _taggedTemplateLiteral = __webpack_require__(59);
3793
+ var _taggedTemplateLiteral = __webpack_require__(81);
2957
3794
 
2958
3795
  var _templateObject;
2959
3796
 
@@ -2977,15 +3814,15 @@ exports.generateMarkerWrapperProps = exports.MarkerIcon = void 0;
2977
3814
 
2978
3815
  var styled_components_1 = __webpack_require__(4);
2979
3816
 
2980
- var React = __webpack_require__(1);
3817
+ var React = __webpack_require__(0);
2981
3818
 
2982
- var colorUtils_1 = __webpack_require__(12);
3819
+ var colorUtils_1 = __webpack_require__(15);
2983
3820
 
2984
3821
  var lodash_1 = __webpack_require__(3);
2985
3822
 
2986
- var MapUtils_1 = __webpack_require__(92);
3823
+ var MapUtils_1 = __webpack_require__(115);
2987
3824
 
2988
- var MarkerWrapper_1 = __webpack_require__(132);
3825
+ var MarkerWrapper_1 = __webpack_require__(154);
2989
3826
 
2990
3827
  var MarkerIcon = function MarkerIcon(_a) {
2991
3828
  var theme = _a.theme,
@@ -3111,29 +3948,41 @@ exports.default = MarkerLayer;
3111
3948
 
3112
3949
  /***/ }),
3113
3950
 
3114
- /***/ 418:
3951
+ /***/ 44:
3952
+ /***/ (function(module, exports, __webpack_require__) {
3953
+
3954
+ "use strict";
3955
+
3956
+
3957
+ Object.defineProperty(exports, "__esModule", {
3958
+ value: true
3959
+ });
3960
+
3961
+ /***/ }),
3962
+
3963
+ /***/ 440:
3115
3964
  /***/ (function(module, exports, __webpack_require__) {
3116
3965
 
3117
3966
  "use strict";
3118
3967
 
3119
3968
 
3120
- var _slicedToArray = __webpack_require__(17);
3969
+ var _slicedToArray = __webpack_require__(7);
3121
3970
 
3122
3971
  Object.defineProperty(exports, "__esModule", {
3123
3972
  value: true
3124
3973
  });
3125
3974
 
3126
- var React = __webpack_require__(1);
3975
+ var React = __webpack_require__(0);
3127
3976
 
3128
- var Message_1 = __webpack_require__(10);
3977
+ var Message_1 = __webpack_require__(12);
3129
3978
 
3130
- var GeoRegistry_1 = __webpack_require__(419);
3979
+ var GeoRegistry_1 = __webpack_require__(441);
3131
3980
 
3132
- var GeoJsonProvider_1 = __webpack_require__(420);
3981
+ var GeoJsonProvider_1 = __webpack_require__(442);
3133
3982
 
3134
- var MapUtils_1 = __webpack_require__(92);
3983
+ var MapUtils_1 = __webpack_require__(115);
3135
3984
 
3136
- var ChoroplethLayer_1 = __webpack_require__(161);
3985
+ var ChoroplethLayer_1 = __webpack_require__(183);
3137
3986
 
3138
3987
  var LocalChoroplethLayer = function LocalChoroplethLayer(props) {
3139
3988
  var _a, _b;
@@ -3312,184 +4161,32 @@ var LocalChoroplethLayer = function LocalChoroplethLayer(props) {
3312
4161
  handleMapClick: function handleMapClick(e) {
3313
4162
  return _handleMapClick(e, el.idx);
3314
4163
  },
3315
- isThemeChanged: isThemeChanged,
3316
- geomData: geoJson.features[i].geometry,
3317
- additionalFields: additionalFields[el.idx]
3318
- });
3319
- }));
3320
- };
3321
-
3322
- exports.default = LocalChoroplethLayer;
3323
-
3324
- /***/ }),
3325
-
3326
- /***/ 419:
3327
- /***/ (function(module, exports) {
3328
-
3329
- module.exports = require("@splunk/visualization-context/GeoRegistry");
3330
-
3331
- /***/ }),
3332
-
3333
- /***/ 42:
3334
- /***/ (function(module, exports, __webpack_require__) {
3335
-
3336
- "use strict";
3337
-
3338
-
3339
- var _classCallCheck = __webpack_require__(9);
3340
-
3341
- Object.defineProperty(exports, "__esModule", {
3342
- value: true
3343
- });
3344
- exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
3345
- /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
3346
-
3347
- var T = __webpack_require__(0);
3348
-
3349
- var lodash_1 = __webpack_require__(3);
3350
-
3351
- var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
3352
-
3353
-
3354
- exports.INITIAL_WIDTH = 250;
3355
- exports.INITIAL_HEIGHT = 250;
3356
- /**
3357
- * A Splunk visualization
3358
- */
3359
-
3360
- var SplunkVisualization = function SplunkVisualization() {
3361
- _classCallCheck(this, SplunkVisualization);
3362
- };
3363
-
3364
- SplunkVisualization.propTypes = {
3365
- /**
3366
- * display mode
3367
- */
3368
- mode: T.oneOf(['view', 'edit', 'export']).isRequired,
3369
-
3370
- /**
3371
- * width in pixel or string, defaults to 100%
3372
- */
3373
- width: T.oneOfType([T.string, T.number]).isRequired,
3374
-
3375
- /**
3376
- * height in pixel or string
3377
- */
3378
- height: T.oneOfType([T.string, T.number]).isRequired,
3379
-
3380
- /**
3381
- * visualization context used for dynamic option evaluation
3382
- */
3383
- context: T.object,
3384
-
3385
- /**
3386
- * visualization formatting options
3387
- */
3388
- options: T.object,
3389
-
3390
- /**
3391
- * A callback to update formatting options
3392
- */
3393
- onOptionsChange: T.func,
3394
-
3395
- /**
3396
- * datasource state which include data and request params, object key indicate the datasource type.
3397
- */
3398
- dataSources: T.objectOf(T.shape({
3399
- /**
3400
- * current request params
3401
- */
3402
- requestParams: T.object,
3403
-
3404
- /**
3405
- * current dataset
3406
- */
3407
- data: T.shape({
3408
- fields: T.array,
3409
- columns: T.array
3410
- }),
3411
-
3412
- /**
3413
- * error
3414
- */
3415
- error: T.shape({
3416
- level: T.string,
3417
- message: T.string
3418
- }),
3419
-
3420
- /**
3421
- * meta data that came with the dataset
3422
- */
3423
- meta: T.object
3424
- })),
3425
-
3426
- /**
3427
- * A callback to trigger event
3428
- */
3429
- onEventTrigger: T.func,
3430
-
3431
- /**
3432
- * Inform viz if there are handlers listening to events
3433
- */
3434
- hasEventHandlers: T.bool,
4164
+ isThemeChanged: isThemeChanged,
4165
+ geomData: geoJson.features[i].geometry,
4166
+ additionalFields: additionalFields[el.idx]
4167
+ });
4168
+ }));
4169
+ };
3435
4170
 
3436
- /**
3437
- * A callback to communicate computed props to a consumer
3438
- */
3439
- onComputedProps: T.func,
4171
+ exports.default = LocalChoroplethLayer;
3440
4172
 
3441
- /**
3442
- * A callback to obtain visualization api
3443
- */
3444
- vizActionHandlerRef: T.func,
3445
- loading: T.bool,
3446
- theme: T.object,
4173
+ /***/ }),
3447
4174
 
3448
- /**
3449
- * A callback to request new data with updated request params
3450
- */
3451
- onRequestParamsChange: T.func
3452
- };
3453
- /**
3454
- *
3455
- */
4175
+ /***/ 441:
4176
+ /***/ (function(module, exports) {
3456
4177
 
3457
- SplunkVisualization.defaultProps = {
3458
- // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
3459
- width: '100%',
3460
- height: exports.INITIAL_HEIGHT,
3461
- dataSources: {},
3462
- onEventTrigger: function onEventTrigger() {
3463
- return {};
3464
- },
3465
- mode: 'view',
3466
- hasEventHandlers: false,
3467
- options: {},
3468
- context: {},
3469
- onOptionsChange: function onOptionsChange() {
3470
- return {};
3471
- },
3472
- vizActionHandlerRef: function vizActionHandlerRef() {
3473
- return new VizActionHandler_1.DefaultVizActionHandler();
3474
- },
3475
- onComputedProps: function onComputedProps() {
3476
- return {};
3477
- },
3478
- loading: false,
3479
- onRequestParamsChange: lodash_1.noop
3480
- };
3481
- exports.default = SplunkVisualization;
4178
+ module.exports = require("@splunk/visualization-context/GeoRegistry");
3482
4179
 
3483
4180
  /***/ }),
3484
4181
 
3485
- /***/ 420:
4182
+ /***/ 442:
3486
4183
  /***/ (function(module, exports) {
3487
4184
 
3488
4185
  module.exports = require("@splunk/visualization-context/GeoJsonProvider");
3489
4186
 
3490
4187
  /***/ }),
3491
4188
 
3492
- /***/ 421:
4189
+ /***/ 443:
3493
4190
  /***/ (function(module, exports, __webpack_require__) {
3494
4191
 
3495
4192
  "use strict";
@@ -3499,27 +4196,27 @@ Object.defineProperty(exports, "__esModule", {
3499
4196
  value: true
3500
4197
  });
3501
4198
 
3502
- var visualization_icons_1 = __webpack_require__(52);
4199
+ var visualization_icons_1 = __webpack_require__(74);
3503
4200
 
3504
- var placeholders_1 = __webpack_require__(50);
4201
+ var placeholders_1 = __webpack_require__(72);
3505
4202
 
3506
- var schemaUtils_1 = __webpack_require__(16);
4203
+ var schemaUtils_1 = __webpack_require__(24);
3507
4204
 
3508
- var visualization_color_palettes_1 = __webpack_require__(51);
4205
+ var visualization_color_palettes_1 = __webpack_require__(73);
3509
4206
 
3510
- var themes_1 = __webpack_require__(60);
4207
+ var themes_1 = __webpack_require__(82);
3511
4208
 
3512
4209
  var i18n_1 = __webpack_require__(2);
3513
4210
 
3514
4211
  var VizBehavior_1 = __webpack_require__(6);
3515
4212
 
3516
- var VizCategory_1 = __webpack_require__(36);
4213
+ var VizCategory_1 = __webpack_require__(22);
3517
4214
 
3518
- var configUtils_1 = __webpack_require__(20);
4215
+ var configUtils_1 = __webpack_require__(27);
3519
4216
 
3520
- var MapUtils_1 = __webpack_require__(92);
4217
+ var MapUtils_1 = __webpack_require__(115);
3521
4218
 
3522
- var BackgroundColor_1 = __webpack_require__(53);
4219
+ var BackgroundColor_1 = __webpack_require__(75);
3523
4220
 
3524
4221
  var defaultContext = {
3525
4222
  colorRangeConfig: [{
@@ -4209,7 +4906,7 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
4209
4906
 
4210
4907
  /***/ }),
4211
4908
 
4212
- /***/ 422:
4909
+ /***/ 444:
4213
4910
  /***/ (function(module, exports, __webpack_require__) {
4214
4911
 
4215
4912
  "use strict";
@@ -4220,15 +4917,15 @@ Object.defineProperty(exports, "__esModule", {
4220
4917
  });
4221
4918
  exports.columnsNullToZeros = void 0;
4222
4919
 
4223
- var types_1 = __webpack_require__(83);
4920
+ var types_1 = __webpack_require__(106);
4224
4921
 
4225
- var dsl_1 = __webpack_require__(133);
4922
+ var dsl_1 = __webpack_require__(155);
4226
4923
 
4227
- var hocUtils_1 = __webpack_require__(27);
4924
+ var hocUtils_1 = __webpack_require__(34);
4228
4925
 
4229
- var JSONSchemaUtils_1 = __webpack_require__(28);
4926
+ var JSONSchemaUtils_1 = __webpack_require__(35);
4230
4927
 
4231
- var BubbleLayer_1 = __webpack_require__(131);
4928
+ var BubbleLayer_1 = __webpack_require__(153);
4232
4929
 
4233
4930
  var columnsNullToZeros = function columnsNullToZeros(config, dataSources, options) {
4234
4931
  var _a, _b;
@@ -4279,45 +4976,43 @@ exports.columnsNullToZeros = columnsNullToZeros;
4279
4976
 
4280
4977
  /***/ }),
4281
4978
 
4282
- /***/ 43:
4979
+ /***/ 45:
4283
4980
  /***/ (function(module, exports, __webpack_require__) {
4284
4981
 
4285
4982
  "use strict";
4286
4983
 
4287
4984
 
4288
- var _classCallCheck = __webpack_require__(9);
4985
+ Object.defineProperty(exports, "__esModule", {
4986
+ value: true
4987
+ });
4988
+
4989
+ /***/ }),
4990
+
4991
+ /***/ 46:
4992
+ /***/ (function(module, exports, __webpack_require__) {
4993
+
4994
+ "use strict";
4289
4995
 
4290
- var _createClass = __webpack_require__(18);
4291
4996
 
4292
4997
  Object.defineProperty(exports, "__esModule", {
4293
4998
  value: true
4294
4999
  });
4295
- exports.DefaultVizActionHandler = void 0;
4296
5000
 
4297
- var DefaultVizActionHandler = /*#__PURE__*/function () {
4298
- function DefaultVizActionHandler() {
4299
- _classCallCheck(this, DefaultVizActionHandler);
4300
- }
5001
+ /***/ }),
4301
5002
 
4302
- _createClass(DefaultVizActionHandler, [{
4303
- key: "focus",
4304
- value: function focus() {// noop
4305
- }
4306
- }, {
4307
- key: "snapshot",
4308
- value: function snapshot() {
4309
- return null; // noop
4310
- }
4311
- }]);
5003
+ /***/ 47:
5004
+ /***/ (function(module, exports, __webpack_require__) {
4312
5005
 
4313
- return DefaultVizActionHandler;
4314
- }();
5006
+ "use strict";
4315
5007
 
4316
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
5008
+
5009
+ Object.defineProperty(exports, "__esModule", {
5010
+ value: true
5011
+ });
4317
5012
 
4318
5013
  /***/ }),
4319
5014
 
4320
- /***/ 44:
5015
+ /***/ 48:
4321
5016
  /***/ (function(module, exports, __webpack_require__) {
4322
5017
 
4323
5018
  "use strict";
@@ -4326,298 +5021,502 @@ exports.DefaultVizActionHandler = DefaultVizActionHandler;
4326
5021
  Object.defineProperty(exports, "__esModule", {
4327
5022
  value: true
4328
5023
  });
4329
- exports.useDeepMemo = void 0;
4330
5024
 
4331
- var react_1 = __webpack_require__(1);
5025
+ /***/ }),
4332
5026
 
4333
- var lodash_1 = __webpack_require__(3);
4334
- /**
4335
- * This hook evaluates and stores the result of a passed function and only
4336
- * re-evaluates the function when passed dependencies change.
4337
- *
4338
- * It is different from the internal React useMemo in the following aspects:
4339
- * - it only stores the last evaluated result
4340
- * - it uses a deep equality check to determine if dependencies have changed
4341
- *
4342
- * Inspired by apollo-client's useDeepMemo
4343
- *
4344
- * @param fn the function to be executed and
4345
- * @param dependencies an array of dependencies
4346
- */
5027
+ /***/ 49:
5028
+ /***/ (function(module, exports, __webpack_require__) {
4347
5029
 
5030
+ "use strict";
4348
5031
 
4349
- var useDeepMemo = function useDeepMemo(fn, dependencies) {
4350
- var ref = (0, react_1.useRef)();
4351
5032
 
4352
- if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
4353
- ref.current = {
4354
- dependencies: dependencies,
4355
- value: fn()
4356
- };
4357
- }
5033
+ Object.defineProperty(exports, "__esModule", {
5034
+ value: true
5035
+ });
4358
5036
 
4359
- return ref.current.value;
4360
- };
5037
+ /***/ }),
4361
5038
 
4362
- exports.useDeepMemo = useDeepMemo;
5039
+ /***/ 50:
5040
+ /***/ (function(module, exports, __webpack_require__) {
5041
+
5042
+ "use strict";
5043
+
5044
+
5045
+ Object.defineProperty(exports, "__esModule", {
5046
+ value: true
5047
+ });
4363
5048
 
4364
5049
  /***/ }),
4365
5050
 
4366
- /***/ 45:
5051
+ /***/ 51:
5052
+ /***/ (function(module, exports, __webpack_require__) {
5053
+
5054
+ "use strict";
5055
+
5056
+
5057
+ Object.defineProperty(exports, "__esModule", {
5058
+ value: true
5059
+ });
5060
+
5061
+ /***/ }),
5062
+
5063
+ /***/ 52:
5064
+ /***/ (function(module, exports, __webpack_require__) {
5065
+
5066
+ "use strict";
5067
+
5068
+
5069
+ Object.defineProperty(exports, "__esModule", {
5070
+ value: true
5071
+ });
5072
+
5073
+ /***/ }),
5074
+
5075
+ /***/ 53:
5076
+ /***/ (function(module, exports, __webpack_require__) {
5077
+
5078
+ "use strict";
5079
+
5080
+
5081
+ Object.defineProperty(exports, "__esModule", {
5082
+ value: true
5083
+ });
5084
+
5085
+ /***/ }),
5086
+
5087
+ /***/ 54:
5088
+ /***/ (function(module, exports, __webpack_require__) {
5089
+
5090
+ "use strict";
5091
+
5092
+
5093
+ Object.defineProperty(exports, "__esModule", {
5094
+ value: true
5095
+ });
5096
+
5097
+ /***/ }),
5098
+
5099
+ /***/ 55:
5100
+ /***/ (function(module, exports, __webpack_require__) {
5101
+
5102
+ "use strict";
5103
+
5104
+
5105
+ Object.defineProperty(exports, "__esModule", {
5106
+ value: true
5107
+ });
5108
+
5109
+ /***/ }),
5110
+
5111
+ /***/ 56:
4367
5112
  /***/ (function(module, exports, __webpack_require__) {
4368
5113
 
4369
5114
  "use strict";
4370
5115
 
4371
5116
 
4372
- Object.defineProperty(exports, "__esModule", {
4373
- value: true
4374
- });
4375
- exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
5117
+ var _slicedToArray = __webpack_require__(7);
5118
+
5119
+ Object.defineProperty(exports, "__esModule", {
5120
+ value: true
5121
+ });
5122
+
5123
+ var React = __webpack_require__(0);
5124
+
5125
+ var lodash_1 = __webpack_require__(3);
5126
+
5127
+ var getSettingsFromThemedProps_1 = __webpack_require__(57);
5128
+
5129
+ var Options_1 = __webpack_require__(16);
5130
+
5131
+ var SanitizeProps_1 = __webpack_require__(58);
5132
+
5133
+ var TimezoneContext_1 = __webpack_require__(32);
5134
+
5135
+ var moment_1 = __webpack_require__(59);
5136
+
5137
+ var FeatureFlagContext_1 = __webpack_require__(28);
5138
+
5139
+ var styled_components_1 = __webpack_require__(4);
5140
+
5141
+ var hocUtils_1 = __webpack_require__(34);
5142
+
5143
+ var JSONSchemaUtils_1 = __webpack_require__(35);
5144
+
5145
+ var async_dynamic_options_evaluator_1 = __webpack_require__(60);
5146
+
5147
+ var id_1 = __webpack_require__(31);
5148
+
5149
+ var SplunkVisualization_1 = __webpack_require__(61);
5150
+
5151
+ var VizBehavior_1 = __webpack_require__(6);
5152
+
5153
+ var getSorting_1 = __webpack_require__(38);
5154
+
5155
+ var getPagination_1 = __webpack_require__(39);
5156
+
5157
+ var useDeepMemo_1 = __webpack_require__(62);
5158
+
5159
+ var MissingPropsMessage_1 = __webpack_require__(63);
5160
+
5161
+ var withEditModeCover_1 = __webpack_require__(64);
5162
+
5163
+ var withPlaceholder_1 = __webpack_require__(65);
5164
+
5165
+ var useDownsampleDataSources_1 = __webpack_require__(66);
5166
+
5167
+ var dataUtils_1 = __webpack_require__(14);
5168
+
5169
+ var featureFlagUtils_1 = __webpack_require__(68);
5170
+ /**
5171
+ * hoc that wraps a pure react visualization in a Dashboard visualization
5172
+ * @param {DashboardVizOpts} opts
5173
+ * @returns {HOC}
5174
+ */
5175
+
5176
+
5177
+ var withDashboardViz = function withDashboardViz(opts) {
5178
+ var ReactViz = opts.ReactViz,
5179
+ vizConfig = opts.vizConfig,
5180
+ _opts$computeVizProps = opts.computeVizProps,
5181
+ computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
5182
+ disableEditModeCover = opts.disableEditModeCover,
5183
+ useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
5184
+
5185
+ var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
5186
+ var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
5187
+
5188
+ var DashboardViz = function DashboardViz(props) {
5189
+ var _a;
5190
+
5191
+ var mode = props.mode,
5192
+ hasEventHandlers = props.hasEventHandlers,
5193
+ dataSources = props.dataSources,
5194
+ options = props.options,
5195
+ _props$context = props.context,
5196
+ context = _props$context === void 0 ? {} : _props$context,
5197
+ width = props.width,
5198
+ height = props.height,
5199
+ onComputedProps = props.onComputedProps,
5200
+ onEventTrigger = props.onEventTrigger,
5201
+ theme = props.theme,
5202
+ onRequestParamsChange = props.onRequestParamsChange;
5203
+
5204
+ var _React$useContext = React.useContext(TimezoneContext_1.default),
5205
+ serializedTimezone = _React$useContext.serializedTimezone;
5206
+
5207
+ if (serializedTimezone) {
5208
+ /*
5209
+ @splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
5210
+ This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
5211
+ will use it.
5212
+ @TODO(pwied):
5213
+ - remove when we moved away from @splunk/moment
5214
+ - provide timezone context to dynamic option evaluation phase
5215
+ */
5216
+ if (!moment_1.default.getDefaultSplunkTimezone()) {
5217
+ moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
5218
+ }
5219
+ }
4376
5220
 
4377
- var React = __webpack_require__(1);
5221
+ var themeFunc = function themeFunc(themeVar) {
5222
+ var _a, _b;
4378
5223
 
4379
- var T = __webpack_require__(0);
5224
+ return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
5225
+ };
4380
5226
 
4381
- var i18n_1 = __webpack_require__(2);
5227
+ var bgColorFromTheme = themeFunc('defaultBackgroundColor');
4382
5228
 
4383
- var Message_1 = __webpack_require__(10);
5229
+ var _ref = (0, getSettingsFromThemedProps_1.default)({
5230
+ theme: theme
5231
+ }),
5232
+ currentThemeFamily = _ref.family,
5233
+ currentThemeColorScheme = _ref.colorScheme,
5234
+ currentThemeDensity = _ref.density;
4384
5235
 
4385
- var FixedSizeContainer_1 = __webpack_require__(13);
4386
- /**
4387
- * @method isMissing
4388
- * @param {any} v
4389
- * @returns {boolean} true if the input value === null or undefined
4390
- */
5236
+ var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
4391
5237
 
5238
+ var _React$useState = React.useState({}),
5239
+ _React$useState2 = _slicedToArray(_React$useState, 2),
5240
+ evaluatedOptionsAsync = _React$useState2[0],
5241
+ setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
4392
5242
 
4393
- var isMissing = function isMissing(v) {
4394
- return v === null || v === undefined;
4395
- };
4396
5243
 
4397
- exports.isMissing = isMissing;
4398
- /**
4399
- * @method misskingKeys
4400
- * @param {string[]} keys
4401
- * @param {object} target
4402
- * @returns {string[]} the keys of missing required props
4403
- */
5244
+ var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
4404
5245
 
4405
- var missingKeys = function missingKeys(keys, target) {
4406
- return keys.filter(function (k) {
4407
- return (0, exports.isMissing)(target[k]);
4408
- });
4409
- };
5246
+ var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
5247
+ _React$useState4 = _slicedToArray(_React$useState3, 1),
5248
+ visualizationID = _React$useState4[0];
4410
5249
 
4411
- exports.missingKeys = missingKeys;
4412
- var propTypes = {
4413
- width: T.oneOfType([T.string, T.number]),
4414
- height: T.oneOfType([T.string, T.number]),
4415
- // eslint-disable-next-line react/no-unused-prop-types
4416
- backgroundColor: T.string,
4417
- missingProps: T.arrayOf(T.string)
4418
- };
4419
- /**
4420
- * @method MissingPropsMessage
4421
- * @param {MissingPropsProps} props
4422
- * @returns {React.ReactElement}
4423
- */
5250
+ var _React$useState5 = React.useState({}),
5251
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
5252
+ dataSourcesInState = _React$useState6[0],
5253
+ setDataSourcesInState = _React$useState6[1];
4424
5254
 
4425
- var MissingPropsMessage = function MissingPropsMessage(props) {
4426
- var width = props.width,
4427
- height = props.height,
4428
- missingProps = props.missingProps;
4429
- return React.createElement(Message_1.default, {
4430
- "data-test": "message",
4431
- width: width,
4432
- height: height,
4433
- message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
4434
- });
4435
- };
5255
+ var _React$useState7 = React.useState(),
5256
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
5257
+ dataFramesInState = _React$useState8[0],
5258
+ setDataFramesInState = _React$useState8[1];
4436
5259
 
4437
- exports.MissingPropsMessage = MissingPropsMessage;
4438
- exports.MissingPropsMessage.propTypes = propTypes;
4439
- exports.MissingPropsMessage.defaultProps = {
4440
- width: '100%',
4441
- height: 250
4442
- };
4443
- exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
5260
+ var _React$useState9 = React.useState(Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_useWebWorkersForDSL'))),
5261
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
5262
+ useAsyncEvaluatedOptions = _React$useState10[0],
5263
+ setUseAsyncEvaluatedOptions = _React$useState10[1];
4444
5264
 
4445
- /***/ }),
5265
+ var isDownsamplingEnabledByFeatureFlag = Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_enableDownsampling);
5266
+ var isMounted = React.useRef(true);
5267
+ var optionsToEvaluate = React.useMemo(function () {
5268
+ return {
5269
+ context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
5270
+ options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
5271
+ };
5272
+ }, [options, context]);
5273
+
5274
+ var _React$useState11 = React.useState(Number(width)),
5275
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
5276
+ threshold = _React$useState12[0],
5277
+ setThreshold = _React$useState12[1];
5278
+
5279
+ var onDownsamplingThresholdChange = React.useCallback(function (newThreshold) {
5280
+ setThreshold(newThreshold);
5281
+ }, []);
5282
+ var isDownsamplingEnabled = React.useMemo(function () {
5283
+ return isDownsamplingEnabledByFeatureFlag && (0, dataUtils_1.isDownsamplingEnabledForViz)({
5284
+ vizConfig: vizConfig
5285
+ });
5286
+ }, [isDownsamplingEnabledByFeatureFlag]);
5287
+ var downsamplingProps = React.useMemo(function () {
5288
+ if (!isDownsamplingEnabled) {
5289
+ return {};
5290
+ }
4446
5291
 
4447
- /***/ 46:
4448
- /***/ (function(module, exports, __webpack_require__) {
5292
+ return {
5293
+ onDownsamplingThresholdChange: onDownsamplingThresholdChange,
5294
+ originalDataSources: dataSources
5295
+ };
5296
+ }, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
5297
+ var downsampledDataSources = (0, useDownsampleDataSources_1.default)({
5298
+ options: optionsToEvaluate.options,
5299
+ context: optionsToEvaluate.context,
5300
+ dataSources: dataSources,
5301
+ threshold: threshold,
5302
+ isDownsamplingEnabled: isDownsamplingEnabled
5303
+ });
5304
+ evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
5305
+ try {
5306
+ if (useAsyncEvaluatedOptions) {
5307
+ var asyncDynamicOptionsEvaluatorParams = {
5308
+ visualizationID: visualizationID,
5309
+ props: props,
5310
+ options: optionsToEvaluate,
5311
+ dataSources: downsampledDataSources,
5312
+ theme: vizConfig.themes,
5313
+ bypassCloneDeepOptionScope: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope')),
5314
+ lazyLoadingDataFrame: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'))
5315
+ };
5316
+ async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
5317
+ setEvaluatedOptionsAsync(results.results);
5318
+ }).catch(function () {
5319
+ if (isMounted.current) {
5320
+ setUseAsyncEvaluatedOptions(false);
5321
+ }
5322
+ });
5323
+ } else {
5324
+ var dataFrames = dataFramesInState;
4449
5325
 
4450
- "use strict";
5326
+ if (downsampledDataSources !== dataSourcesInState) {
5327
+ setDataSourcesInState(downsampledDataSources);
5328
+ dataFrames = Options_1.Options.dataFrameFromDataSource(downsampledDataSources, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'));
5329
+ setDataFramesInState(dataFrames);
5330
+ }
4451
5331
 
5332
+ var result = Options_1.Options.evaluate(optionsToEvaluate, downsampledDataSources, themeFunc, dataFrames, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope'));
5333
+ return result;
5334
+ }
5335
+ } catch (e) {
5336
+ // eslint-disable-next-line no-console
5337
+ console.error("unexpected error evaluating options: ".concat(e.message));
5338
+ return {};
5339
+ }
4452
5340
 
4453
- Object.defineProperty(exports, "__esModule", {
4454
- value: true
4455
- });
5341
+ return {};
5342
+ }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, optionsToEvaluate, downsampledDataSources, serializedTimezone, useAsyncEvaluatedOptions]);
5343
+ var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
5344
+ // 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
5345
+ // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
4456
5346
 
4457
- var React = __webpack_require__(1);
5347
+ var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
5348
+ var clonedEvaluatedOptions = evaluatedOptionsToUse;
4458
5349
 
4459
- var styled_components_1 = __webpack_require__(4);
5350
+ if (isTrellisFeatureFlagOn && ((_a = vizConfig === null || vizConfig === void 0 ? void 0 : vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(VizBehavior_1.VizBehavior.TRELLIS)) && (clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.splitByLayout) === VizBehavior_1.VizBehavior.TRELLIS) {
5351
+ clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
5352
+ backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
5353
+ });
5354
+ } // useEffect hook needs to be initialized before any early returns
5355
+ // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
4460
5356
 
4461
- var hocUtils_1 = __webpack_require__(15);
4462
5357
 
4463
- var Cover = styled_components_1.default.div.withConfig({
4464
- displayName: "withEditModeCover__Cover",
4465
- componentId: "sc-1gsbnxb-0"
4466
- })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
4467
- var Blocker = styled_components_1.default.div.attrs({
4468
- 'data-splunk-visualization-version': "26.1.1 - b6df0a015"
4469
- }).withConfig({
4470
- displayName: "withEditModeCover__Blocker",
4471
- componentId: "sc-1gsbnxb-1"
4472
- })(["position:relative;width:100%;height:100%;"]);
4473
- /**
4474
- * HOC that renders a cover layer in edit mode
4475
- * @method withEditModeCover
4476
- * @param {ExtendedDashViz} Visualization
4477
- * @returns {ExtendedDashViz} Wrapper
4478
- */
5358
+ React.useEffect(function () {
5359
+ onComputedProps(clonedEvaluatedOptions);
5360
+ });
5361
+ React.useEffect(function () {
5362
+ return function () {
5363
+ if (useAsyncEvaluatedOptions) {
5364
+ isMounted.current = false;
5365
+ async_dynamic_options_evaluator_1.default.reset(visualizationID);
5366
+ }
5367
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
5368
+ }, []); // present warning message if any required props are missing
4479
5369
 
4480
- var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
4481
- var Wrapper = function Wrapper(props) {
4482
- var mode = props.mode;
4483
- var showEditCover = mode === 'edit' && !disableEditModeCover;
4484
- return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), showEditCover && React.createElement(Cover, {
4485
- "data-test": "edit-mode-cover"
4486
- }));
4487
- };
5370
+ var _vizConfig$requiredPr = vizConfig.requiredProps,
5371
+ requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
5372
+ supports = vizConfig.supports;
5373
+ var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
4488
5374
 
4489
- (0, hocUtils_1.extendStaticWrapperProps)({
4490
- Wrapper: Wrapper,
4491
- Visualization: Visualization
4492
- });
4493
- return Wrapper;
4494
- };
5375
+ if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && vizConfig.key !== 'splunk.singlevalue' // For SV missing props msg is not displayed if required props majorValue is missing, instead this will be handled from the component, instead handled within component
5376
+ ) {
5377
+ return React.createElement(MissingPropsMessage_1.default, {
5378
+ "data-test": "missing-props-message",
5379
+ width: width,
5380
+ height: height,
5381
+ missingProps: missing,
5382
+ backgroundColor: bgColorFromTheme
5383
+ });
5384
+ } // events
4495
5385
 
4496
- exports.default = withEditModeCover;
4497
5386
 
4498
- /***/ }),
5387
+ var eventCallbackProps = {};
4499
5388
 
4500
- /***/ 47:
4501
- /***/ (function(module, exports, __webpack_require__) {
5389
+ if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
5390
+ var supportedEvents = vizConfig.events;
5391
+ Object.keys(supportedEvents).forEach(function (eventName) {
5392
+ var _supportedEvents$even = supportedEvents[eventName],
5393
+ parentKeys = _supportedEvents$even.parentKeys,
5394
+ payloadKeys = _supportedEvents$even.payloadKeys;
5395
+ var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
5396
+ // then remove these lines
4502
5397
 
4503
- "use strict";
5398
+ var payload = {};
4504
5399
 
5400
+ if (Array.isArray(payloadKeys) && payloadKeys.length) {
5401
+ payloadKeys.forEach(function (p) {
5402
+ payload[p] = evaluatedOptionsToUse[p];
5403
+ });
5404
+ }
4505
5405
 
4506
- Object.defineProperty(exports, "__esModule", {
4507
- value: true
4508
- });
5406
+ eventCallbackProps[eventCallbackPropName] = function (ev) {
5407
+ if (ev && ev.payload) {
5408
+ payload = ev.payload;
5409
+ }
4509
5410
 
4510
- var React = __webpack_require__(1);
5411
+ return onEventTrigger({
5412
+ originalEvent: ev,
5413
+ payload: payload,
5414
+ type: eventName
5415
+ });
5416
+ };
4511
5417
 
4512
- var colorUtils_1 = __webpack_require__(12);
5418
+ if (parentKeys) {
5419
+ for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
5420
+ var newObject = {};
5421
+ newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
5422
+ eventCallbackProps[eventCallbackPropName] = newObject;
5423
+ }
5424
+ }
5425
+ });
5426
+ } // compute pure viz props which are not from options
4513
5427
 
4514
- var variables_1 = __webpack_require__(11);
4515
5428
 
4516
- var IconPlaceholder_1 = __webpack_require__(32);
5429
+ var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
5430
+ themeFunc: themeFunc
5431
+ }));
5432
+ /**
5433
+ * PAGE_AND_SORT behavior
5434
+ *
5435
+ * Some visualizations, like table, requires metadata about the datasource,
5436
+ * like total number of results, current count, offset, and sort, for rendering
5437
+ * paginator and sorting direction. In this approach, the visualization
5438
+ * allow users to set 'paginateDataSourceKey' to select which datasource
5439
+ * should the visualization extract the metadata from. It defaults to 'primary' datasource.
5440
+ * The visualization config should set the PAGE_AND_SORT behavior to receive
5441
+ * 'requestParams', 'meta' and onRequestParams callback as props.
5442
+ *
5443
+ * In future, we could automatically detect which all datasources are being used
5444
+ * and bind those magically to pagination/sorting behavior.
5445
+ */
4517
5446
 
4518
- var VizBehavior_1 = __webpack_require__(6);
5447
+ var dataSourceMetadata = {};
5448
+ var OptionKey = 'paginateDataSourceKey';
5449
+ var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
4519
5450
 
4520
- var hocUtils_1 = __webpack_require__(15);
5451
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
5452
+ var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
5453
+ var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
4521
5454
 
4522
- var withPlaceholder = function withPlaceholder(Visualization) {
4523
- var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
4524
- var config = Visualization.config;
4525
- var themes = config.themes;
5455
+ var handleRequestParamsChange = function handleRequestParamsChange(payload) {
5456
+ return onRequestParamsChange(paginateDataSourceKey, payload);
5457
+ };
4526
5458
 
4527
- var Wrapper = function Wrapper(props) {
4528
- var _a, _b;
5459
+ var sortParams = (0, getSorting_1.getSortingParams)({
5460
+ requestParams: requestParams,
5461
+ meta: meta,
5462
+ onRequestParamsChange: handleRequestParamsChange
5463
+ });
5464
+ var paginatorParams = (0, getPagination_1.getPaginationParams)({
5465
+ requestParams: requestParams,
5466
+ meta: meta,
5467
+ onRequestParamsChange: handleRequestParamsChange
5468
+ });
5469
+ dataSourceMetadata = {
5470
+ sortParams: sortParams,
5471
+ paginatorParams: paginatorParams
5472
+ };
5473
+ } // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
4529
5474
 
4530
- var dataSources = props.dataSources,
4531
- loading = props.loading,
4532
- options = props.options,
4533
- height = props.height,
4534
- width = props.width;
4535
- var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
4536
- var bgColorFromTheme = (0, colorUtils_1.isColor)(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
4537
- var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
4538
- var iconColor = variables_1.default.contentColorActive(props);
4539
5475
 
4540
- if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
4541
- return React.createElement(IconPlaceholder_1.default, {
4542
- "data-test": "icon-placeholder",
4543
- icon: icon,
4544
- width: width,
4545
- height: height,
4546
- backgroundColor: bgColorFromTheme,
4547
- iconColor: iconColor
4548
- });
5476
+ if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
5477
+ return null;
4549
5478
  }
4550
5479
 
4551
- return React.createElement(Visualization, Object.assign({}, props));
5480
+ return React.createElement(SanitizedReactViz, Object.assign({
5481
+ mode: mode,
5482
+ width: width,
5483
+ height: height
5484
+ }, downsamplingProps, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
4552
5485
  };
4553
5486
 
4554
- (0, hocUtils_1.extendStaticWrapperProps)({
4555
- Wrapper: Wrapper,
4556
- Visualization: Visualization
4557
- });
4558
- return Wrapper;
4559
- };
4560
-
4561
- exports.default = withPlaceholder;
5487
+ DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
5488
+ DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
5489
+ // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
5490
+ theme: {}
5491
+ }); // attach viz config
4562
5492
 
4563
- /***/ }),
5493
+ DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
4564
5494
 
4565
- /***/ 50:
4566
- /***/ (function(module, exports) {
5495
+ return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
5496
+ };
4567
5497
 
4568
- module.exports = require("@splunk/visualization-icons/placeholders");
5498
+ exports.default = withDashboardViz;
4569
5499
 
4570
5500
  /***/ }),
4571
5501
 
4572
- /***/ 51:
5502
+ /***/ 57:
4573
5503
  /***/ (function(module, exports) {
4574
5504
 
4575
- module.exports = require("@splunk/visualization-color-palettes");
5505
+ module.exports = require("@splunk/themes/getSettingsFromThemedProps");
4576
5506
 
4577
5507
  /***/ }),
4578
5508
 
4579
- /***/ 52:
5509
+ /***/ 58:
4580
5510
  /***/ (function(module, exports) {
4581
5511
 
4582
- module.exports = require("@splunk/visualization-icons");
4583
-
4584
- /***/ }),
4585
-
4586
- /***/ 53:
4587
- /***/ (function(module, exports, __webpack_require__) {
4588
-
4589
- "use strict";
4590
-
4591
-
4592
- Object.defineProperty(exports, "__esModule", {
4593
- value: true
4594
- });
4595
-
4596
- var i18n_1 = __webpack_require__(2);
4597
-
4598
- var background = function background(_ref) {
4599
- var label = _ref.label,
4600
- themes = _ref.themes,
4601
- labelPosition = _ref.labelPosition;
4602
- return [{
4603
- label: (0, i18n_1._)(label || 'Background'),
4604
- option: 'backgroundColor',
4605
- editor: 'editor.color',
4606
- editorProps: {
4607
- labelPosition: labelPosition || 'top',
4608
- themes: themes
4609
- }
4610
- }];
4611
- };
4612
-
4613
- exports.default = background;
5512
+ module.exports = require("@splunk/visualizations-shared/SanitizeProps");
4614
5513
 
4615
5514
  /***/ }),
4616
5515
 
4617
5516
  /***/ 59:
4618
5517
  /***/ (function(module, exports) {
4619
5518
 
4620
- module.exports = require("@babel/runtime/helpers/taggedTemplateLiteral");
5519
+ module.exports = require("@splunk/moment");
4621
5520
 
4622
5521
  /***/ }),
4623
5522
 
@@ -4647,6 +5546,7 @@ var VizBehavior;
4647
5546
  */
4648
5547
  VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
4649
5548
  VizBehavior["EVENTS"] = "events";
5549
+ VizBehavior["DOWNSAMPLING"] = "downsampling";
4650
5550
  /**
4651
5551
  * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
4652
5552
  * missing.
@@ -4663,617 +5563,746 @@ var VizBehavior;
4663
5563
  /***/ 60:
4664
5564
  /***/ (function(module, exports) {
4665
5565
 
4666
- module.exports = require("@splunk/themes");
5566
+ module.exports = require("@splunk/async-dynamic-options-evaluator");
4667
5567
 
4668
5568
  /***/ }),
4669
5569
 
4670
- /***/ 62:
4671
- /***/ (function(module, exports) {
5570
+ /***/ 61:
5571
+ /***/ (function(module, exports, __webpack_require__) {
5572
+
5573
+ "use strict";
5574
+
5575
+
5576
+ var _classCallCheck = __webpack_require__(10);
5577
+
5578
+ Object.defineProperty(exports, "__esModule", {
5579
+ value: true
5580
+ });
5581
+ exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
5582
+ /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
5583
+
5584
+ var T = __webpack_require__(1);
5585
+
5586
+ var lodash_1 = __webpack_require__(3);
5587
+
5588
+ var VizActionHandler_1 = __webpack_require__(21); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
5589
+
5590
+
5591
+ exports.INITIAL_WIDTH = 250;
5592
+ exports.INITIAL_HEIGHT = 250;
5593
+ /**
5594
+ * A Splunk visualization
5595
+ */
5596
+
5597
+ var SplunkVisualization = function SplunkVisualization() {
5598
+ _classCallCheck(this, SplunkVisualization);
5599
+ };
5600
+
5601
+ SplunkVisualization.propTypes = {
5602
+ /**
5603
+ * display mode
5604
+ */
5605
+ mode: T.oneOf(['view', 'edit', 'export']).isRequired,
5606
+
5607
+ /**
5608
+ * width in pixel or string, defaults to 100%
5609
+ */
5610
+ width: T.oneOfType([T.string, T.number]).isRequired,
5611
+
5612
+ /**
5613
+ * height in pixel or string
5614
+ */
5615
+ height: T.oneOfType([T.string, T.number]).isRequired,
5616
+
5617
+ /**
5618
+ * visualization context used for dynamic option evaluation
5619
+ */
5620
+ context: T.object,
5621
+
5622
+ /**
5623
+ * visualization formatting options
5624
+ */
5625
+ options: T.object,
5626
+
5627
+ /**
5628
+ * A callback to update formatting options
5629
+ */
5630
+ onOptionsChange: T.func,
5631
+
5632
+ /**
5633
+ * datasource state which include data and request params, object key indicate the datasource type.
5634
+ */
5635
+ dataSources: T.objectOf(T.shape({
5636
+ /**
5637
+ * current request params
5638
+ */
5639
+ requestParams: T.object,
5640
+
5641
+ /**
5642
+ * current dataset
5643
+ */
5644
+ data: T.shape({
5645
+ fields: T.array,
5646
+ columns: T.array
5647
+ }),
5648
+
5649
+ /**
5650
+ * error
5651
+ */
5652
+ error: T.shape({
5653
+ level: T.string,
5654
+ message: T.string
5655
+ }),
5656
+
5657
+ /**
5658
+ * meta data that came with the dataset
5659
+ */
5660
+ meta: T.object
5661
+ })),
5662
+
5663
+ /**
5664
+ * A callback to trigger event
5665
+ */
5666
+ onEventTrigger: T.func,
5667
+
5668
+ /**
5669
+ * Inform viz if there are handlers listening to events
5670
+ */
5671
+ hasEventHandlers: T.bool,
5672
+
5673
+ /**
5674
+ * A callback to communicate computed props to a consumer
5675
+ */
5676
+ onComputedProps: T.func,
5677
+
5678
+ /**
5679
+ * A callback to obtain visualization api
5680
+ */
5681
+ vizActionHandlerRef: T.func,
5682
+ loading: T.bool,
5683
+ theme: T.object,
5684
+
5685
+ /**
5686
+ * A callback to request new data with updated request params
5687
+ */
5688
+ onRequestParamsChange: T.func
5689
+ };
5690
+ /**
5691
+ *
5692
+ */
4672
5693
 
4673
- module.exports = require("@splunk/react-ui/Popover");
5694
+ SplunkVisualization.defaultProps = {
5695
+ // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
5696
+ width: '100%',
5697
+ height: exports.INITIAL_HEIGHT,
5698
+ dataSources: {},
5699
+ onEventTrigger: function onEventTrigger() {
5700
+ return {};
5701
+ },
5702
+ mode: 'view',
5703
+ hasEventHandlers: false,
5704
+ options: {},
5705
+ context: {},
5706
+ onOptionsChange: function onOptionsChange() {
5707
+ return {};
5708
+ },
5709
+ vizActionHandlerRef: function vizActionHandlerRef() {
5710
+ return new VizActionHandler_1.DefaultVizActionHandler();
5711
+ },
5712
+ onComputedProps: function onComputedProps() {
5713
+ return {};
5714
+ },
5715
+ loading: false,
5716
+ onRequestParamsChange: lodash_1.noop
5717
+ };
5718
+ exports.default = SplunkVisualization;
4674
5719
 
4675
5720
  /***/ }),
4676
5721
 
4677
- /***/ 7:
4678
- /***/ (function(module, exports) {
5722
+ /***/ 62:
5723
+ /***/ (function(module, exports, __webpack_require__) {
4679
5724
 
4680
- module.exports = require("@babel/runtime/helpers/defineProperty");
5725
+ "use strict";
4681
5726
 
4682
- /***/ }),
4683
5727
 
4684
- /***/ 8:
4685
- /***/ (function(module, exports) {
5728
+ Object.defineProperty(exports, "__esModule", {
5729
+ value: true
5730
+ });
5731
+ exports.useDeepMemo = void 0;
4686
5732
 
4687
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
5733
+ var react_1 = __webpack_require__(0);
4688
5734
 
4689
- /***/ }),
5735
+ var lodash_1 = __webpack_require__(3);
5736
+ /**
5737
+ * This hook evaluates and stores the result of a passed function and only
5738
+ * re-evaluates the function when passed dependencies change.
5739
+ *
5740
+ * It is different from the internal React useMemo in the following aspects:
5741
+ * - it only stores the last evaluated result
5742
+ * - it uses a deep equality check to determine if dependencies have changed
5743
+ *
5744
+ * Inspired by apollo-client's useDeepMemo
5745
+ *
5746
+ * @param fn the function to be executed and
5747
+ * @param dependencies an array of dependencies
5748
+ */
4690
5749
 
4691
- /***/ 83:
4692
- /***/ (function(module, exports) {
4693
5750
 
4694
- module.exports = require("@splunk/visualization-encoding/utils/types");
5751
+ var useDeepMemo = function useDeepMemo(fn, dependencies) {
5752
+ var ref = (0, react_1.useRef)();
4695
5753
 
4696
- /***/ }),
5754
+ if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
5755
+ ref.current = {
5756
+ dependencies: dependencies,
5757
+ value: fn()
5758
+ };
5759
+ }
4697
5760
 
4698
- /***/ 9:
4699
- /***/ (function(module, exports) {
5761
+ return ref.current.value;
5762
+ };
4700
5763
 
4701
- module.exports = require("@babel/runtime/helpers/classCallCheck");
5764
+ exports.useDeepMemo = useDeepMemo;
4702
5765
 
4703
5766
  /***/ }),
4704
5767
 
4705
- /***/ 92:
5768
+ /***/ 63:
4706
5769
  /***/ (function(module, exports, __webpack_require__) {
4707
5770
 
4708
5771
  "use strict";
4709
5772
 
4710
5773
 
4711
- var _defineProperty = __webpack_require__(7);
4712
-
4713
- var _slicedToArray = __webpack_require__(17);
4714
-
4715
- var _toConsumableArray = __webpack_require__(8);
4716
-
4717
5774
  Object.defineProperty(exports, "__esModule", {
4718
5775
  value: true
4719
5776
  });
4720
- exports.formatMetadata = exports.compareBaseStyles = exports.getScaledOpacities = exports.getGlobalLayerBoundaries = exports.isValidLatLon = exports.bakeBubbleData = exports.sanitizeValues = exports.transposeArray = exports.matchBubbleSize = exports.getStaticColors = exports.getZoomLevelFromGeobin = exports.getZoomConstraintsFromTileConfig = exports.getMapStyle = exports.getTilePreset = exports.LAYER_TYPE = exports.DEFAULT_OPACITY = exports.MAX_BUBBLE_RADIUS = exports.MIN_BUBBLE_RADIUS = exports.MAP_STYLE_VERSION_NUMBER = exports.DEFAULT_SERIES_COLORS = exports.DEFAULT_CLUSTER_COLOR = exports.DEFAULT_RESULT_LIMIT = exports.MIN_LONGITUDE = exports.MAX_LONGITUDE = exports.MIN_LATITUDE = exports.MAX_LATITUDE = void 0;
4721
-
4722
- var lodash_1 = __webpack_require__(3);
4723
-
4724
- var d3_scale_1 = __webpack_require__(93);
5777
+ exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
4725
5778
 
4726
- var chroma = __webpack_require__(159);
5779
+ var React = __webpack_require__(0);
4727
5780
 
4728
- var colorUtils_1 = __webpack_require__(12);
5781
+ var T = __webpack_require__(1);
4729
5782
 
4730
- var visualization_color_palettes_1 = __webpack_require__(51);
5783
+ var i18n_1 = __webpack_require__(2);
4731
5784
 
4732
- var types_1 = __webpack_require__(83);
5785
+ var Message_1 = __webpack_require__(12);
4733
5786
 
4734
- exports.MAX_LATITUDE = 90;
4735
- exports.MIN_LATITUDE = -90;
4736
- exports.MAX_LONGITUDE = 180;
4737
- exports.MIN_LONGITUDE = -180;
4738
- exports.DEFAULT_RESULT_LIMIT = 1000;
4739
- exports.DEFAULT_CLUSTER_COLOR = '#909090';
4740
- exports.DEFAULT_SERIES_COLORS = visualization_color_palettes_1.VIZ_CATEGORICAL; // MapLibre requires a map style specification number which is always 8
5787
+ var FixedSizeContainer_1 = __webpack_require__(17);
5788
+ /**
5789
+ * @method isMissing
5790
+ * @param {any} v
5791
+ * @returns {boolean} true if the input value === null or undefined
5792
+ */
4741
5793
 
4742
- exports.MAP_STYLE_VERSION_NUMBER = 8; // currently using one [min, max] value set for bubbles across all zoom levels
4743
- // TODO: design choices on [min, max] bubble size for different zoom levels
4744
5794
 
4745
- exports.MIN_BUBBLE_RADIUS = 7.11; // 10px
5795
+ var isMissing = function isMissing(v) {
5796
+ return v === null || v === undefined;
5797
+ };
4746
5798
 
4747
- exports.MAX_BUBBLE_RADIUS = 45.26; // 85px
5799
+ exports.isMissing = isMissing;
5800
+ /**
5801
+ * @method misskingKeys
5802
+ * @param {string[]} keys
5803
+ * @param {object} target
5804
+ * @returns {string[]} the keys of missing required props
5805
+ */
4748
5806
 
4749
- exports.DEFAULT_OPACITY = 0.8;
4750
- var LONGITUDE = 'longitude';
4751
- var LATITUDE = 'latitude';
4752
- var LAYER_TYPE;
5807
+ var missingKeys = function missingKeys(keys, target) {
5808
+ return keys.filter(function (k) {
5809
+ return (0, exports.isMissing)(target[k]);
5810
+ });
5811
+ };
4753
5812
 
4754
- (function (LAYER_TYPE) {
4755
- LAYER_TYPE["Marker"] = "marker";
4756
- LAYER_TYPE["Bubble"] = "bubble";
4757
- LAYER_TYPE["Choropleth"] = "choropleth";
4758
- })(LAYER_TYPE = exports.LAYER_TYPE || (exports.LAYER_TYPE = {}));
5813
+ exports.missingKeys = missingKeys;
5814
+ var propTypes = {
5815
+ width: T.oneOfType([T.string, T.number]),
5816
+ height: T.oneOfType([T.string, T.number]),
5817
+ // eslint-disable-next-line react/no-unused-prop-types
5818
+ backgroundColor: T.string,
5819
+ missingProps: T.arrayOf(T.string)
5820
+ };
4759
5821
  /**
4760
- * Construct a tile preset {key: config} by combining the default + custom tile configs
4761
- * Also returns the default tile config for each theme - light/dark
4762
- * @param {MapContextInterface} args
4763
- * @param {BaseTileConfig[]} args.defaultTileConfig
4764
- * @param {BaseTileConfig[]} args.customTileConfig
4765
- * @returns {Object} tile preset
5822
+ * @method MissingPropsMessage
5823
+ * @param {MissingPropsProps} props
5824
+ * @returns {React.ReactElement}
4766
5825
  */
4767
5826
 
5827
+ var MissingPropsMessage = function MissingPropsMessage(props) {
5828
+ var width = props.width,
5829
+ height = props.height,
5830
+ missingProps = props.missingProps;
5831
+ return React.createElement(Message_1.default, {
5832
+ "data-test": "message",
5833
+ width: width,
5834
+ height: height,
5835
+ message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
5836
+ });
5837
+ };
4768
5838
 
4769
- var getTilePreset = function getTilePreset(_ref) {
4770
- var _ref$defaultTileConfi = _ref.defaultTileConfig,
4771
- defaultTileConfig = _ref$defaultTileConfi === void 0 ? [] : _ref$defaultTileConfi,
4772
- _ref$customTileConfig = _ref.customTileConfig,
4773
- customTileConfig = _ref$customTileConfig === void 0 ? [] : _ref$customTileConfig;
5839
+ exports.MissingPropsMessage = MissingPropsMessage;
5840
+ exports.MissingPropsMessage.propTypes = propTypes;
5841
+ exports.MissingPropsMessage.defaultProps = {
5842
+ width: '100%',
5843
+ height: 250
5844
+ };
5845
+ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
4774
5846
 
4775
- var _a, _b;
5847
+ /***/ }),
4776
5848
 
4777
- var tilePreset = {};
4778
- var defaultTileLight = {};
4779
- var defaultTileDark = {};
4780
- var tileConfigs = [].concat(defaultTileConfig).concat(customTileConfig);
4781
- (0, lodash_1.forEach)(tileConfigs, function (tileConfig) {
4782
- var key = tileConfig === null || tileConfig === void 0 ? void 0 : tileConfig.key;
4783
- var updatedConfig = Object.assign(Object.assign({
4784
- theme: 'all'
4785
- }, tileConfig), {
4786
- version: exports.MAP_STYLE_VERSION_NUMBER
4787
- });
4788
- tilePreset[key] = updatedConfig;
4789
- });
5849
+ /***/ 64:
5850
+ /***/ (function(module, exports, __webpack_require__) {
4790
5851
 
4791
- if (defaultTileConfig.length > 0) {
4792
- defaultTileLight = (_a = defaultTileConfig.find(function (config) {
4793
- return config.theme === 'light';
4794
- })) !== null && _a !== void 0 ? _a : defaultTileConfig.find(function (config) {
4795
- return config.theme === undefined;
4796
- });
4797
- defaultTileDark = (_b = defaultTileConfig.find(function (config) {
4798
- return config.theme === 'dark';
4799
- })) !== null && _b !== void 0 ? _b : defaultTileConfig.find(function (config) {
4800
- return config.theme === undefined;
4801
- });
4802
- }
5852
+ "use strict";
4803
5853
 
4804
- return {
4805
- tilePreset: tilePreset,
4806
- defaultTileLight: defaultTileLight,
4807
- defaultTileDark: defaultTileDark
4808
- };
4809
- };
4810
5854
 
4811
- exports.getTilePreset = getTilePreset;
4812
- /**
4813
- * Check if baseLayerTileServer is in tilePreset and config matches current theme, if yes, return.
4814
- * If no, construct a mapStyle with baseLayerTilerServer and baseLayerTileServerType
4815
- * Else return default tile config based on current theme
4816
- * @param {Object} args
4817
- * @param {BaseTileConfig[]} args.tilePreset
4818
- * @param {String} args.baseLayerTilerServer
4819
- * @param {String} args.baseLayerTileServerType
4820
- * @param {String} args.colorScheme
4821
- * @param {BaseTileConfig} args.defaultTileDark
4822
- * @param {BaseTileConfig} args.defaultTileLight
4823
- * @returns {BaseTileConfig} mapStyle
4824
- */
5855
+ Object.defineProperty(exports, "__esModule", {
5856
+ value: true
5857
+ });
4825
5858
 
4826
- var getMapStyle = function getMapStyle(_ref2) {
4827
- var showBaseLayer = _ref2.showBaseLayer,
4828
- _ref2$baseLayerTileSe = _ref2.baseLayerTileServer,
4829
- baseLayerTileServer = _ref2$baseLayerTileSe === void 0 ? '' : _ref2$baseLayerTileSe,
4830
- _ref2$baseLayerTileSe2 = _ref2.baseLayerTileServerType,
4831
- baseLayerTileServerType = _ref2$baseLayerTileSe2 === void 0 ? '' : _ref2$baseLayerTileSe2,
4832
- _ref2$tilePreset = _ref2.tilePreset,
4833
- tilePreset = _ref2$tilePreset === void 0 ? {} : _ref2$tilePreset,
4834
- _ref2$colorScheme = _ref2.colorScheme,
4835
- colorScheme = _ref2$colorScheme === void 0 ? 'light' : _ref2$colorScheme,
4836
- _ref2$defaultTileLigh = _ref2.defaultTileLight,
4837
- defaultTileLight = _ref2$defaultTileLigh === void 0 ? {} : _ref2$defaultTileLigh,
4838
- _ref2$defaultTileDark = _ref2.defaultTileDark,
4839
- defaultTileDark = _ref2$defaultTileDark === void 0 ? {} : _ref2$defaultTileDark;
5859
+ var React = __webpack_require__(0);
4840
5860
 
4841
- if (!showBaseLayer) {
4842
- return {
4843
- version: exports.MAP_STYLE_VERSION_NUMBER,
4844
- sources: {
4845
- 'base-tiles': {
4846
- type: 'raster',
4847
- tiles: ['data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='],
4848
- tileSize: 256
4849
- }
4850
- },
4851
- layers: [{
4852
- id: 'base-layer',
4853
- type: 'raster',
4854
- source: 'base-tiles',
4855
- minzoom: 0,
4856
- maxzoom: 22
4857
- }]
4858
- };
4859
- }
5861
+ var styled_components_1 = __webpack_require__(4);
5862
+
5863
+ var hocUtils_1 = __webpack_require__(23);
5864
+
5865
+ var Cover = styled_components_1.default.div.withConfig({
5866
+ displayName: "withEditModeCover__Cover",
5867
+ componentId: "sc-1gsbnxb-0"
5868
+ })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
5869
+ var Blocker = styled_components_1.default.div.attrs({
5870
+ 'data-splunk-visualization-version': "26.2.0 - 49b909915"
5871
+ }).withConfig({
5872
+ displayName: "withEditModeCover__Blocker",
5873
+ componentId: "sc-1gsbnxb-1"
5874
+ })(["position:relative;width:100%;height:100%;"]);
5875
+ /**
5876
+ * HOC that renders a cover layer in edit mode
5877
+ * @method withEditModeCover
5878
+ * @param {ExtendedDashViz} Visualization
5879
+ * @returns {ExtendedDashViz} Wrapper
5880
+ */
4860
5881
 
4861
- if (baseLayerTileServer && tilePreset[baseLayerTileServer] && (tilePreset[baseLayerTileServer].theme === colorScheme || tilePreset[baseLayerTileServer].theme === 'all')) {
4862
- return tilePreset[baseLayerTileServer];
4863
- }
5882
+ var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
5883
+ var Wrapper = function Wrapper(props) {
5884
+ var mode = props.mode;
5885
+ var showEditCover = mode === 'edit' && !disableEditModeCover;
5886
+ return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), showEditCover && React.createElement(Cover, {
5887
+ "data-test": "edit-mode-cover"
5888
+ }));
5889
+ };
4864
5890
 
4865
- if (baseLayerTileServer && baseLayerTileServerType) {
4866
- var tiles = [];
4867
- /**
4868
- * Tile Server URLs (eg: http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png) can specify the variable {s} which refers to a subdomain
4869
- * Subdomains are used to help with browser parallel requests per domain limitation. These subdomains are typically single letters 'a', 'b' and 'c'
4870
- * Refer to https://leafletjs.com/SlavaUkraini/reference.html#tilelayer and https://wiki.openstreetmap.org/wiki/Tile_servers
4871
- */
5891
+ (0, hocUtils_1.extendStaticWrapperProps)({
5892
+ Wrapper: Wrapper,
5893
+ Visualization: Visualization
5894
+ });
5895
+ return Wrapper;
5896
+ };
4872
5897
 
4873
- if (baseLayerTileServer.match(/^(https?):\/\/{(s|S)}\../)) {
4874
- /**
4875
- * sXML (Leaflet) allows users to define their own tile server URLs + list of available subdomains
4876
- * In order to preserve this behavior during conversion to splunk.map,
4877
- * if the variable {s} or {S} is detected, replace it with 'a', 'b' and 'c' - default values for subdomains
4878
- * TODO: in the future, add an additional prop - baseLayerTileServerSubdomains: ['x', 'y', 'z'], default being ['a', 'b', 'c']
4879
- */
4880
- tiles = [baseLayerTileServer.replace(/{(s|S)}/, 'a'), baseLayerTileServer.replace(/{(s|S)}/, 'b'), baseLayerTileServer.replace(/{(s|S)}/, 'c')];
4881
- } else {
4882
- tiles = [baseLayerTileServer];
4883
- } // TODO: remove hardcoded style when we allow users to pass in layer style through Viz options
5898
+ exports.default = withEditModeCover;
4884
5899
 
5900
+ /***/ }),
4885
5901
 
4886
- var mapStyle = {
4887
- version: exports.MAP_STYLE_VERSION_NUMBER,
4888
- sources: {
4889
- 'base-tiles': {
4890
- type: baseLayerTileServerType,
4891
- tiles: tiles,
4892
- tileSize: 256
4893
- }
4894
- },
4895
- layers: [{
4896
- id: 'base-layer',
4897
- type: 'raster',
4898
- source: 'base-tiles',
4899
- minzoom: 0,
4900
- maxzoom: 24 // https://maplibre.org/maplibre-gl-js-docs/api/map/
5902
+ /***/ 65:
5903
+ /***/ (function(module, exports, __webpack_require__) {
4901
5904
 
4902
- }]
4903
- };
4904
- return mapStyle;
4905
- } // if tile server is not present in the preset AND we can't construct a mapStyle, fall back on defaults
5905
+ "use strict";
4906
5906
 
4907
5907
 
4908
- return colorScheme === 'light' ? defaultTileLight : defaultTileDark;
4909
- };
5908
+ Object.defineProperty(exports, "__esModule", {
5909
+ value: true
5910
+ });
4910
5911
 
4911
- exports.getMapStyle = getMapStyle;
5912
+ var React = __webpack_require__(0);
4912
5913
 
4913
- var getZoomConstraintsFromTileConfig = function getZoomConstraintsFromTileConfig(tileConfig, baseLayerTileServer) {
4914
- var sources = tileConfig.sources,
4915
- layers = tileConfig.layers;
4916
- var matchedBaseLayerTileServer = false; // check sources for minzoom maxzoom first
5914
+ var colorUtils_1 = __webpack_require__(15);
4917
5915
 
4918
- var sourceKeys = Object.keys(sources);
5916
+ var variables_1 = __webpack_require__(13);
4919
5917
 
4920
- for (var i = 0; i < sourceKeys.length; i += 1) {
4921
- var _sources$sourceKeys$i = sources[sourceKeys[i]],
4922
- minzoom = _sources$sourceKeys$i.minzoom,
4923
- maxzoom = _sources$sourceKeys$i.maxzoom;
5918
+ var IconPlaceholder_1 = __webpack_require__(37);
4924
5919
 
4925
- if (baseLayerTileServer && sources[sourceKeys[i]].tiles.indexOf(baseLayerTileServer) !== -1) {
4926
- matchedBaseLayerTileServer = true;
4927
- }
5920
+ var VizBehavior_1 = __webpack_require__(6);
4928
5921
 
4929
- if ((baseLayerTileServer && matchedBaseLayerTileServer || !baseLayerTileServer) && (0, lodash_1.isNumber)(minzoom) && (0, lodash_1.isNumber)(maxzoom)) {
4930
- return {
4931
- minZoom: minzoom,
4932
- maxZoom: maxzoom
4933
- };
4934
- }
4935
- } // then check layers
5922
+ var hocUtils_1 = __webpack_require__(23);
4936
5923
 
5924
+ var withPlaceholder = function withPlaceholder(Visualization) {
5925
+ var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
5926
+ var config = Visualization.config;
5927
+ var themes = config.themes;
4937
5928
 
4938
- for (var _i = 0; _i < layers.length; _i += 1) {
4939
- var _layers$_i = layers[_i],
4940
- _minzoom = _layers$_i.minzoom,
4941
- _maxzoom = _layers$_i.maxzoom;
5929
+ var Wrapper = function Wrapper(props) {
5930
+ var _a, _b;
4942
5931
 
4943
- if ((baseLayerTileServer && matchedBaseLayerTileServer || !baseLayerTileServer) && (0, lodash_1.isNumber)(_minzoom) && (0, lodash_1.isNumber)(_maxzoom)) {
4944
- return {
4945
- minZoom: _minzoom,
4946
- maxZoom: _maxzoom
4947
- };
4948
- }
4949
- } // Maplibre default - would reset previous min/maxZoom https://maplibre.org/maplibre-gl-js-docs/api/map/
5932
+ var dataSources = props.dataSources,
5933
+ loading = props.loading,
5934
+ options = props.options,
5935
+ height = props.height,
5936
+ width = props.width;
5937
+ var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
5938
+ var bgColorFromTheme = (0, colorUtils_1.isColor)(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
5939
+ var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
5940
+ var iconColor = variables_1.default.contentColorActive(props);
4950
5941
 
5942
+ if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
5943
+ return React.createElement(IconPlaceholder_1.default, {
5944
+ "data-test": "icon-placeholder",
5945
+ icon: icon,
5946
+ width: width,
5947
+ height: height,
5948
+ backgroundColor: bgColorFromTheme,
5949
+ iconColor: iconColor
5950
+ });
5951
+ }
4951
5952
 
4952
- return {
4953
- minZoom: 0,
4954
- maxZoom: 24
5953
+ return React.createElement(Visualization, Object.assign({}, props));
4955
5954
  };
5955
+
5956
+ (0, hocUtils_1.extendStaticWrapperProps)({
5957
+ Wrapper: Wrapper,
5958
+ Visualization: Visualization
5959
+ });
5960
+ return Wrapper;
4956
5961
  };
4957
5962
 
4958
- exports.getZoomConstraintsFromTileConfig = getZoomConstraintsFromTileConfig;
5963
+ exports.default = withPlaceholder;
4959
5964
 
4960
- var getZoomLevelFromGeobin = function getZoomLevelFromGeobin(geobinStr) {
4961
- var _a;
5965
+ /***/ }),
4962
5966
 
4963
- if (!geobinStr) {
4964
- return null;
4965
- } // geostats cmds return geobin with zoom level 0-18, 0-99 in the geobinPattern covers the range
5967
+ /***/ 66:
5968
+ /***/ (function(module, exports, __webpack_require__) {
4966
5969
 
5970
+ "use strict";
4967
5971
 
4968
- var geobinPattern = /bin_id_zl_([0-9]{0,2})?_y_/g;
4969
- var match = geobinPattern.exec(geobinStr);
4970
- return (_a = (match === null || match === void 0 ? void 0 : match.length) && parseInt(match[1], 10)) !== null && _a !== void 0 ? _a : null;
4971
- };
4972
5972
 
4973
- exports.getZoomLevelFromGeobin = getZoomLevelFromGeobin; // Bubble colors - static
5973
+ var _slicedToArray = __webpack_require__(7);
4974
5974
 
4975
- var getStaticColors = function getStaticColors(colorCount, colorArray) {
4976
- if (colorCount < 0 || !colorCount) {
4977
- return [exports.DEFAULT_CLUSTER_COLOR];
4978
- }
5975
+ Object.defineProperty(exports, "__esModule", {
5976
+ value: true
5977
+ });
4979
5978
 
4980
- if (!colorArray || !colorArray.length) {
4981
- return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
4982
- return exports.DEFAULT_SERIES_COLORS[i];
4983
- });
4984
- } // loop through colorArray to pick the first $colorCount colors
4985
- // start from begining again if colorCount > colorArray.length
5979
+ var react_1 = __webpack_require__(0);
5980
+
5981
+ var lodash_1 = __webpack_require__(3);
4986
5982
 
5983
+ var dataUtils_1 = __webpack_require__(14);
4987
5984
 
4988
- return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
4989
- return (0, colorUtils_1.isColor)(colorArray[i % colorArray.length]) ? colorArray[i % colorArray.length] : exports.DEFAULT_CLUSTER_COLOR;
5985
+ var usePrevious_1 = __webpack_require__(33);
5986
+
5987
+ var useGetXAndYFields_1 = __webpack_require__(67);
5988
+
5989
+ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
5990
+ var dataSources = _ref.dataSources,
5991
+ options = _ref.options,
5992
+ context = _ref.context,
5993
+ threshold = _ref.threshold,
5994
+ isDownsamplingEnabled = _ref.isDownsamplingEnabled;
5995
+ var isFirstUseEffectCall = (0, react_1.useRef)(true);
5996
+ var xAndYFieldsWithTypes = (0, useGetXAndYFields_1.default)({
5997
+ shouldEvaluateDSL: isDownsamplingEnabled,
5998
+ options: options,
5999
+ context: context,
6000
+ dataSources: dataSources
4990
6001
  });
4991
- };
6002
+ var previousXAndYFieldsWithTypes = (0, usePrevious_1.default)(xAndYFieldsWithTypes);
6003
+ var previousDataSources = (0, usePrevious_1.default)(dataSources);
6004
+ var previousThreshold = (0, usePrevious_1.default)(threshold);
4992
6005
 
4993
- exports.getStaticColors = getStaticColors; // Bubble size
6006
+ var _ref2 = (0, react_1.useState)(function () {
6007
+ return isDownsamplingEnabled ? (0, dataUtils_1.downsampleDataSources)({
6008
+ dataSources: dataSources,
6009
+ threshold: threshold,
6010
+ options: xAndYFieldsWithTypes
6011
+ }) : dataSources;
6012
+ }),
6013
+ _ref3 = _slicedToArray(_ref2, 2),
6014
+ downsampledDataSources = _ref3[0],
6015
+ setDownsampledDataSources = _ref3[1];
6016
+
6017
+ var debouncedDownsampleDataSources = (0, react_1.useMemo)(function () {
6018
+ return (0, lodash_1.debounce)(function (downsampleOptions) {
6019
+ var downsampledResult = (0, dataUtils_1.downsampleDataSources)(downsampleOptions);
6020
+ setDownsampledDataSources(downsampledResult);
6021
+ }, 100, {
6022
+ trailing: true
6023
+ });
6024
+ }, []);
6025
+ (0, react_1.useEffect)(function () {
6026
+ // don't downsample again on the use effect call that happened due to the initial render
6027
+ // this is since we already downsampled as part of the useState call
6028
+ if (isFirstUseEffectCall.current) {
6029
+ isFirstUseEffectCall.current = false;
6030
+ return;
6031
+ }
4994
6032
 
4995
- var matchBubbleSize = function matchBubbleSize(dataRange, data) {
4996
- var size = (0, d3_scale_1.scalePow)().exponent(0.2).domain(dataRange).range([exports.MIN_BUBBLE_RADIUS, exports.MAX_BUBBLE_RADIUS])(data);
6033
+ if (!isDownsamplingEnabled) {
6034
+ setDownsampledDataSources(dataSources);
6035
+ return;
6036
+ }
4997
6037
 
4998
- if (size > exports.MAX_BUBBLE_RADIUS) {
4999
- return exports.MAX_BUBBLE_RADIUS;
5000
- }
6038
+ if ((0, lodash_1.isEqual)(previousXAndYFieldsWithTypes, xAndYFieldsWithTypes) && previousDataSources === dataSources && previousThreshold === threshold) {
6039
+ return;
6040
+ } // Debounce the downsampling so we don't have to downsample and execute DSL multiple times
6041
+ // while the viz is being resized
5001
6042
 
5002
- if (size < exports.MIN_BUBBLE_RADIUS) {
5003
- return exports.MIN_BUBBLE_RADIUS;
5004
- }
5005
6043
 
5006
- return size;
6044
+ debouncedDownsampleDataSources({
6045
+ dataSources: dataSources,
6046
+ options: xAndYFieldsWithTypes,
6047
+ threshold: threshold
6048
+ }); // need to detect if this runs as part of the initial render
6049
+ }, [dataSources, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousXAndYFieldsWithTypes, previousDataSources, previousThreshold]);
6050
+ return downsampledDataSources;
5007
6051
  };
5008
6052
 
5009
- exports.matchBubbleSize = matchBubbleSize;
6053
+ exports.default = useDownsampleDataSources;
5010
6054
 
5011
- var transposeArray = function transposeArray(array) {
5012
- if (!array || !array.length || !array[0] || !array[0].length) {
5013
- return [];
5014
- }
6055
+ /***/ }),
5015
6056
 
5016
- return array[0].map(function (_, i) {
5017
- return array.map(function (row) {
5018
- return row[i];
6057
+ /***/ 67:
6058
+ /***/ (function(module, exports, __webpack_require__) {
6059
+
6060
+ "use strict";
6061
+
6062
+
6063
+ var _toConsumableArray = __webpack_require__(8);
6064
+
6065
+ Object.defineProperty(exports, "__esModule", {
6066
+ value: true
6067
+ });
6068
+
6069
+ var react_1 = __webpack_require__(0);
6070
+
6071
+ var Options_1 = __webpack_require__(16);
6072
+ /**
6073
+ * Hook that evaluates the DSL for subset of a viz's options needed to determine
6074
+ * its x and y fields as well as the types of all its fields.
6075
+ */
6076
+
6077
+
6078
+ var useGetXAndYFields = function useGetXAndYFields(_ref) {
6079
+ var shouldEvaluateDSL = _ref.shouldEvaluateDSL,
6080
+ options = _ref.options,
6081
+ context = _ref.context,
6082
+ dataSources = _ref.dataSources;
6083
+
6084
+ var _ref2 = (0, react_1.useMemo)(function () {
6085
+ var _a, _b, _c;
6086
+
6087
+ if (!shouldEvaluateDSL) {
6088
+ return {
6089
+ dataSourcesWithOnlyOnePoint: null,
6090
+ dataFrameWithOnlyOnePoint: null
6091
+ };
6092
+ }
6093
+
6094
+ 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)) {
6095
+ return {
6096
+ dataSourcesWithOnlyOnePoint: null,
6097
+ dataFrameWithOnlyOnePoint: null
6098
+ };
6099
+ }
6100
+
6101
+ var primaryDS = dataSources.primary;
6102
+ var columnsWithOnlyOnePoint = primaryDS.data.columns.map(function (column) {
6103
+ return [column[0]];
5019
6104
  });
5020
- });
5021
- };
6105
+ var filteredDataSources = {
6106
+ primary: Object.assign(Object.assign({}, primaryDS), {
6107
+ data: Object.assign(Object.assign({}, primaryDS.data), {
6108
+ columns: columnsWithOnlyOnePoint
6109
+ })
6110
+ })
6111
+ };
6112
+ return {
6113
+ dataSourcesWithOnlyOnePoint: filteredDataSources,
6114
+ dataFrameWithOnlyOnePoint: Options_1.Options.dataFrameFromDataSource(filteredDataSources)
6115
+ };
6116
+ }, [dataSources, shouldEvaluateDSL]),
6117
+ dataSourcesWithOnlyOnePoint = _ref2.dataSourcesWithOnlyOnePoint,
6118
+ dataFrameWithOnlyOnePoint = _ref2.dataFrameWithOnlyOnePoint;
5022
6119
 
5023
- exports.transposeArray = transposeArray; // sanitize values: update all null, undefined, or negative values to 0
6120
+ var xAndYFieldsWithTypes = (0, react_1.useMemo)(function () {
6121
+ try {
6122
+ if (!dataSourcesWithOnlyOnePoint || !dataFrameWithOnlyOnePoint) {
6123
+ return options;
6124
+ }
5024
6125
 
5025
- var sanitizeValues = function sanitizeValues(values) {
5026
- // null / undefined
5027
- if (!values) {
5028
- return 0;
5029
- } // number
6126
+ 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)) {
6127
+ return options;
6128
+ }
6129
+
6130
+ var optionsToEvaluate = {
6131
+ x: options.x,
6132
+ xField: '> x | getField()',
6133
+ y: options.y,
6134
+ yFields: options.y ? '> y | getField()' : undefined,
6135
+ y2: options.y2,
6136
+ y2Fields: options.y2 ? '> y2 | getField()' : undefined,
6137
+ fieldTypes: '> primary | getType()'
6138
+ };
6139
+
6140
+ var _Options_1$Options$ev = Options_1.Options.evaluate({
6141
+ options: optionsToEvaluate,
6142
+ context: context
6143
+ }, dataSourcesWithOnlyOnePoint, function () {}, dataFrameWithOnlyOnePoint),
6144
+ _Options_1$Options$ev2 = _Options_1$Options$ev.xField,
6145
+ xField = _Options_1$Options$ev2 === void 0 ? '' : _Options_1$Options$ev2,
6146
+ _Options_1$Options$ev3 = _Options_1$Options$ev.yFields,
6147
+ yFields = _Options_1$Options$ev3 === void 0 ? [] : _Options_1$Options$ev3,
6148
+ _Options_1$Options$ev4 = _Options_1$Options$ev.y2Fields,
6149
+ y2Fields = _Options_1$Options$ev4 === void 0 ? [] : _Options_1$Options$ev4,
6150
+ fieldTypes = _Options_1$Options$ev.fieldTypes;
6151
+
6152
+ return {
6153
+ xField: xField,
6154
+ yFields: [].concat(_toConsumableArray(yFields), _toConsumableArray(y2Fields)),
6155
+ fieldTypes: fieldTypes
6156
+ };
6157
+ } catch (e) {
6158
+ return {
6159
+ xField: undefined,
6160
+ yFields: [],
6161
+ fieldTypes: []
6162
+ };
6163
+ }
6164
+ }, [options, context, dataSourcesWithOnlyOnePoint, dataFrameWithOnlyOnePoint]);
6165
+ return xAndYFieldsWithTypes;
6166
+ };
5030
6167
 
6168
+ exports.default = useGetXAndYFields;
5031
6169
 
5032
- if (!Array.isArray(values)) {
5033
- return values > 0 ? values : 0;
5034
- } // array
6170
+ /***/ }),
5035
6171
 
6172
+ /***/ 68:
6173
+ /***/ (function(module, exports, __webpack_require__) {
5036
6174
 
5037
- return values.map(function (arr) {
5038
- return (0, exports.sanitizeValues)(arr);
5039
- });
5040
- };
6175
+ "use strict";
5041
6176
 
5042
- exports.sanitizeValues = sanitizeValues;
5043
6177
 
5044
- var bakeBubbleData = function bakeBubbleData(layer) {
5045
- var _a;
6178
+ Object.defineProperty(exports, "__esModule", {
6179
+ value: true
6180
+ });
6181
+ exports.getFeatureFlag = void 0;
5046
6182
 
5047
- if (!layer || !((_a = layer.bubbleSize) === null || _a === void 0 ? void 0 : _a.length) || !layer.geobin || !layer.geobin.length || !layer.latitude || !layer.latitude.length || !layer.longitude || !layer.longitude.length) {
5048
- return null;
5049
- } // if bubbleSize is passed as an array of single number array (data series)
5050
- // e.g. [value0, value1, ...]
5051
- // format each value as an array to unify data operations for data series and frames
6183
+ var FeatureFlags_1 = __webpack_require__(69);
5052
6184
 
6185
+ var getFeatureFlag = function getFeatureFlag(context, flagName) {
6186
+ // look for feature flag in context first
6187
+ if (context && Object.keys(context).find(function (key) {
6188
+ return key === flagName;
6189
+ })) {
6190
+ return context[flagName];
6191
+ } // fall back to defaults
5053
6192
 
5054
- var sanitizedBubbleSize = (0, exports.sanitizeValues)(layer.bubbleSize);
5055
- var transposedBubbleSize;
5056
- var transposedSanitizedBubbleSize;
5057
- var isPie = false; // format array if bubbleSize is passed as an array of array (data frame)
5058
6193
 
5059
- if (Array.isArray(layer.bubbleSize[0])) {
5060
- // one-time array transpose,
5061
- // e.g. from [column0data, column0data] (multi series)
5062
- // to [[column0datum0, column1datum0], [column0datum1, column1data1], ...]
5063
- // or e.g. from [column0data] (single series)
5064
- // to [[column0data]]
5065
- // for easy access of values at each geo location,
5066
- // and min max pie size computation
5067
- transposedBubbleSize = (0, exports.transposeArray)(layer.bubbleSize);
5068
- transposedSanitizedBubbleSize = (0, exports.transposeArray)(sanitizedBubbleSize); // if multiple series in the dataframe, set isPie to true
6194
+ if (Object.keys(FeatureFlags_1.default).find(function (key) {
6195
+ return key === flagName;
6196
+ })) {
6197
+ return FeatureFlags_1.default[flagName];
6198
+ } // fall back to false
5069
6199
 
5070
- if (layer.bubbleSize.length > 1) {
5071
- isPie = true;
5072
- }
5073
- } else {
5074
- transposedBubbleSize = layer.bubbleSize.map(function (n) {
5075
- return [n];
5076
- });
5077
- transposedSanitizedBubbleSize = sanitizedBubbleSize.map(function (n) {
5078
- return [n];
5079
- });
5080
- }
5081
6200
 
5082
- if (!transposedBubbleSize || !transposedBubbleSize.length) {
5083
- return null;
5084
- }
6201
+ return false;
6202
+ };
5085
6203
 
5086
- var data = layer.latitude.map(function (lat, i) {
5087
- return {
5088
- zoom: (0, exports.getZoomLevelFromGeobin)(layer.geobin[i]),
5089
- values: transposedBubbleSize[i],
5090
- sanitizedValues: transposedSanitizedBubbleSize[i],
5091
- coordinates: [layer.longitude[i], lat],
5092
- metadata: layer.metadata ? layer.metadata[i] : {}
5093
- };
5094
- }).filter(function (d) {
5095
- return Boolean(d.values);
5096
- }); // compute the min/max value to encode min/max pie or bubble size
6204
+ exports.getFeatureFlag = getFeatureFlag;
5097
6205
 
5098
- var min = (0, lodash_1.sum)(transposedSanitizedBubbleSize[0]);
5099
- var max = (0, lodash_1.sum)(transposedSanitizedBubbleSize[1]);
5100
- transposedSanitizedBubbleSize.forEach(function (row) {
5101
- var bubbleSize = (0, lodash_1.sum)(row);
5102
- max = bubbleSize > max ? bubbleSize : max;
5103
- min = bubbleSize < min ? bubbleSize : min;
5104
- });
5105
- return {
5106
- data: data,
5107
- dataRange: [min, max],
5108
- isPie: isPie,
5109
- resultLimit: layer.resultLimit,
5110
- bubbleSizeFields: layer.bubbleSizeFields
5111
- };
5112
- };
6206
+ /***/ }),
5113
6207
 
5114
- exports.bakeBubbleData = bakeBubbleData;
6208
+ /***/ 69:
6209
+ /***/ (function(module, exports) {
5115
6210
 
5116
- var isValidLatLon = function isValidLatLon(latlon) {
5117
- if (!latlon || !Array.isArray(latlon) || latlon.length !== 2) {
5118
- return false;
5119
- }
6211
+ module.exports = require("@splunk/visualization-context/FeatureFlags");
5120
6212
 
5121
- var _latlon = _slicedToArray(latlon, 2),
5122
- lat = _latlon[0],
5123
- lon = _latlon[1];
6213
+ /***/ }),
5124
6214
 
5125
- if (!(0, types_1.isNumber)(lat) || !(lat >= exports.MIN_LATITUDE && lat <= exports.MAX_LATITUDE)) {
5126
- return false;
5127
- }
6215
+ /***/ 7:
6216
+ /***/ (function(module, exports) {
5128
6217
 
5129
- if (!(0, types_1.isNumber)(lon) || !(lon >= exports.MIN_LONGITUDE && lon <= exports.MAX_LONGITUDE)) {
5130
- return false;
5131
- }
6218
+ module.exports = require("@babel/runtime/helpers/slicedToArray");
5132
6219
 
5133
- return true;
5134
- };
6220
+ /***/ }),
5135
6221
 
5136
- exports.isValidLatLon = isValidLatLon;
5137
- /**
5138
- * Returns a list of all lat or lon coordinates used in a specified layer
5139
- * @param {LayerType[]} layer
5140
- * @param {string} field
5141
- * @returns {number[]} list of lat coordinates or lon coordinates
5142
- */
6222
+ /***/ 72:
6223
+ /***/ (function(module, exports) {
5143
6224
 
5144
- var getLatOrLonCoordinates = function getLatOrLonCoordinates(layer, field) {
5145
- var getClusterValues = function getClusterValues(clusterLayer) {
5146
- return (0, lodash_1.get)(clusterLayer, field, []).slice(0, clusterLayer.type === LAYER_TYPE.Marker && clusterLayer.resultLimit ? clusterLayer.resultLimit : exports.DEFAULT_RESULT_LIMIT);
5147
- };
6225
+ module.exports = require("@splunk/visualization-icons/placeholders");
5148
6226
 
5149
- var getChoroplethValues = function getChoroplethValues(choroplethLayer) {
5150
- var slicedGeomList = choroplethLayer.geom.slice(0, choroplethLayer.resultLimit);
5151
- var flatCoordinates = slicedGeomList.flatMap(function (geomObject) {
5152
- return geomObject.coordinates.flat(2);
5153
- });
5154
- return flatCoordinates.map(function (coord) {
5155
- return coord[field === LONGITUDE ? 0 : 1];
5156
- });
5157
- };
6227
+ /***/ }),
5158
6228
 
5159
- return layer.type === LAYER_TYPE.Choropleth ? getChoroplethValues(layer) : getClusterValues(layer);
5160
- };
5161
- /**
5162
- * Returns the min and max LongLat pairs to determine the layer boundaries to fit all markers/bubbles
5163
- * @param {LayerType[]} layers
5164
- * @returns {LngLatBoundsLike}
5165
- */
6229
+ /***/ 73:
6230
+ /***/ (function(module, exports) {
5166
6231
 
6232
+ module.exports = require("@splunk/visualization-color-palettes");
5167
6233
 
5168
- var getGlobalLayerBoundaries = function getGlobalLayerBoundaries(layers) {
5169
- var isLayerValid = function isLayerValid(field) {
5170
- return layers.every(function (layer) {
5171
- return layer[field] || layer.geom;
5172
- });
5173
- };
6234
+ /***/ }),
5174
6235
 
5175
- var getDefaultMax = function getDefaultMax(field) {
5176
- return field === LONGITUDE ? exports.MAX_LONGITUDE : exports.MAX_LATITUDE;
5177
- };
6236
+ /***/ 74:
6237
+ /***/ (function(module, exports) {
5178
6238
 
5179
- var getDefaultMin = function getDefaultMin(field) {
5180
- return field === LONGITUDE ? exports.MIN_LONGITUDE : exports.MIN_LATITUDE;
5181
- };
6239
+ module.exports = require("@splunk/visualization-icons");
5182
6240
 
5183
- if (!layers || !Array.isArray(layers) || !layers.length) {
5184
- return null;
5185
- }
6241
+ /***/ }),
5186
6242
 
5187
- var getMin = function getMin(field) {
5188
- if (!isLayerValid(field)) {
5189
- return getDefaultMin(field);
5190
- }
6243
+ /***/ 75:
6244
+ /***/ (function(module, exports, __webpack_require__) {
5191
6245
 
5192
- return layers.reduce(function (prevVal, layer) {
5193
- var coordinatesNumArr = getLatOrLonCoordinates(layer, field).map(function (x) {
5194
- return +x;
5195
- });
5196
- return (0, lodash_1.min)([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
5197
- }, getDefaultMax(field));
5198
- };
6246
+ "use strict";
5199
6247
 
5200
- var getMax = function getMax(field) {
5201
- if (!isLayerValid(field)) {
5202
- return getDefaultMax(field);
5203
- }
5204
6248
 
5205
- return layers.reduce(function (prevVal, layer) {
5206
- var coordinatesNumArr = getLatOrLonCoordinates(layer, field).map(Number);
5207
- return (0, lodash_1.max)([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
5208
- }, getDefaultMin(field));
5209
- };
6249
+ Object.defineProperty(exports, "__esModule", {
6250
+ value: true
6251
+ });
5210
6252
 
5211
- return [[getMin(LONGITUDE), getMin(LATITUDE)], [getMax(LONGITUDE), getMax(LATITUDE)]];
6253
+ var i18n_1 = __webpack_require__(2);
6254
+
6255
+ var background = function background(_ref) {
6256
+ var label = _ref.label,
6257
+ themes = _ref.themes,
6258
+ labelPosition = _ref.labelPosition;
6259
+ return [{
6260
+ label: (0, i18n_1._)(label || 'Background'),
6261
+ option: 'backgroundColor',
6262
+ editor: 'editor.color',
6263
+ editorProps: {
6264
+ labelPosition: labelPosition || 'top',
6265
+ themes: themes
6266
+ }
6267
+ }];
5212
6268
  };
5213
6269
 
5214
- exports.getGlobalLayerBoundaries = getGlobalLayerBoundaries;
6270
+ exports.default = background;
5215
6271
 
5216
- var getScaledOpacities = function getScaledOpacities(colors, cfgOpacity) {
5217
- // extract opacity information from 8 digit hex codes
5218
- var opacities = colors === null || colors === void 0 ? void 0 : colors.map(function (color) {
5219
- var _a;
6272
+ /***/ }),
5220
6273
 
5221
- return (color === null || color === void 0 ? void 0 : color.length) === 9 ? (_a = chroma(color).alpha()) !== null && _a !== void 0 ? _a : 1 : 1;
5222
- }); // opacity cannot be greater than configured opacity
6274
+ /***/ 8:
6275
+ /***/ (function(module, exports) {
5223
6276
 
5224
- return opacities === null || opacities === void 0 ? void 0 : opacities.map(function (opacity) {
5225
- return opacity * cfgOpacity;
5226
- });
5227
- };
6277
+ module.exports = require("@babel/runtime/helpers/toConsumableArray");
5228
6278
 
5229
- exports.getScaledOpacities = getScaledOpacities;
6279
+ /***/ }),
5230
6280
 
5231
- var compareBaseStyles = function compareBaseStyles(curr, next) {
5232
- var _a, _b, _c, _d;
6281
+ /***/ 81:
6282
+ /***/ (function(module, exports) {
5233
6283
 
5234
- var currBaseLayer = (_a = curr === null || curr === void 0 ? void 0 : curr.layers) === null || _a === void 0 ? void 0 : _a.find(function (layer) {
5235
- return (layer === null || layer === void 0 ? void 0 : layer.id) === 'base-layer';
5236
- });
5237
- var nextBaseLayer = (_b = next === null || next === void 0 ? void 0 : next.layers) === null || _b === void 0 ? void 0 : _b.find(function (layer) {
5238
- return (layer === null || layer === void 0 ? void 0 : layer.id) === 'base-layer';
5239
- });
5240
- var currBaseSource = (0, lodash_1.get)(curr === null || curr === void 0 ? void 0 : curr.sources, (_c = currBaseLayer === null || currBaseLayer === void 0 ? void 0 : currBaseLayer.source) !== null && _c !== void 0 ? _c : '');
5241
- var nextBaseSource = (0, lodash_1.get)(next === null || next === void 0 ? void 0 : next.sources, (_d = nextBaseLayer === null || nextBaseLayer === void 0 ? void 0 : nextBaseLayer.source) !== null && _d !== void 0 ? _d : '');
6284
+ module.exports = require("@babel/runtime/helpers/taggedTemplateLiteral");
5242
6285
 
5243
- if (!currBaseLayer || !nextBaseLayer || !currBaseSource || !nextBaseSource) {
5244
- return false;
5245
- }
6286
+ /***/ }),
5246
6287
 
5247
- return (0, lodash_1.isEqual)(currBaseLayer, nextBaseLayer) && (0, lodash_1.isEqual)(currBaseSource, nextBaseSource);
5248
- };
6288
+ /***/ 82:
6289
+ /***/ (function(module, exports) {
5249
6290
 
5250
- exports.compareBaseStyles = compareBaseStyles;
6291
+ module.exports = require("@splunk/themes");
5251
6292
 
5252
- var formatMetadata = function formatMetadata(choroplethLayer, i) {
5253
- if (!choroplethLayer || !choroplethLayer.areaIds || !choroplethLayer.areaValues) return {};
5254
- if (i >= choroplethLayer.areaIds.length) return {};
5255
- var metadata = choroplethLayer.metadata ? choroplethLayer.metadata[i] : {};
5256
- var name = choroplethLayer.areaIds[i];
5257
- var value = choroplethLayer.areaValues[i];
5258
- var base = {
5259
- name: name,
5260
- value: String(value)
5261
- };
5262
- return Object.keys(metadata).reduce(function (result, curr) {
5263
- var key = "row.".concat(curr, ".value");
5264
- var val = (0, lodash_1.isObject)(metadata[curr]) ? JSON.stringify(metadata[curr]) : String(metadata[curr]);
5265
- return Object.assign(Object.assign({}, result), _defineProperty({}, key, val));
5266
- }, base);
5267
- };
6293
+ /***/ }),
5268
6294
 
5269
- exports.formatMetadata = formatMetadata;
6295
+ /***/ 84:
6296
+ /***/ (function(module, exports) {
6297
+
6298
+ module.exports = require("@splunk/react-ui/Popover");
5270
6299
 
5271
6300
  /***/ }),
5272
6301
 
5273
- /***/ 93:
6302
+ /***/ 9:
5274
6303
  /***/ (function(module, exports) {
5275
6304
 
5276
- module.exports = require("d3-scale");
6305
+ module.exports = require("@babel/runtime/helpers/defineProperty");
5277
6306
 
5278
6307
  /***/ })
5279
6308