@grafana/scenes 4.26.3 → 4.27.0--canary.766.9369774725.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/CHANGELOG.md +0 -41
  2. package/README.md +0 -2
  3. package/dist/esm/components/SceneTimeRangeCompare.js +1 -55
  4. package/dist/esm/components/SceneTimeRangeCompare.js.map +1 -1
  5. package/dist/esm/components/VizPanel/VizPanel.js +0 -3
  6. package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
  7. package/dist/esm/core/types.js.map +1 -1
  8. package/dist/esm/index.js +1 -4
  9. package/dist/esm/index.js.map +1 -1
  10. package/dist/esm/querying/SceneQueryRunner.js +88 -85
  11. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  12. package/dist/esm/querying/timeShiftQueryResponseOperator.js +60 -0
  13. package/dist/esm/querying/timeShiftQueryResponseOperator.js.map +1 -0
  14. package/dist/esm/utils/writeSceneLog.js +1 -5
  15. package/dist/esm/utils/writeSceneLog.js.map +1 -1
  16. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +37 -3
  17. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  18. package/dist/esm/variables/components/VariableValueSelect.js +11 -11
  19. package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
  20. package/dist/esm/variables/components/getOptionSearcher.js +1 -8
  21. package/dist/esm/variables/components/getOptionSearcher.js.map +1 -1
  22. package/dist/esm/variables/groupby/GroupByVariable.js +2 -2
  23. package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
  24. package/dist/esm/variables/interpolation/sceneInterpolator.js +3 -3
  25. package/dist/esm/variables/interpolation/sceneInterpolator.js.map +1 -1
  26. package/dist/esm/variables/utils.js.map +1 -1
  27. package/dist/esm/variables/variants/query/QueryVariable.js.map +1 -1
  28. package/dist/index.d.ts +146 -256
  29. package/dist/index.js +936 -1130
  30. package/dist/index.js.map +1 -1
  31. package/package.json +8 -5
  32. package/dist/esm/core/PanelBuilders/VizConfigBuilder.js +0 -78
  33. package/dist/esm/core/PanelBuilders/VizConfigBuilder.js.map +0 -1
  34. package/dist/esm/core/PanelBuilders/VizConfigBuilders.js +0 -114
  35. package/dist/esm/core/PanelBuilders/VizConfigBuilders.js.map +0 -1
  36. package/dist/esm/querying/ExtraQueryProvider.js +0 -6
  37. package/dist/esm/querying/ExtraQueryProvider.js.map +0 -1
  38. package/dist/esm/querying/extraQueryProcessingOperator.js +0 -46
  39. package/dist/esm/querying/extraQueryProcessingOperator.js.map +0 -1
package/dist/index.js CHANGED
@@ -11,8 +11,8 @@ var uuid = require('uuid');
11
11
  var lodash = require('lodash');
12
12
  var schema = require('@grafana/schema');
13
13
  var ui = require('@grafana/ui');
14
- var e2eSelectors = require('@grafana/e2e-selectors');
15
14
  var css = require('@emotion/css');
15
+ var e2eSelectors = require('@grafana/e2e-selectors');
16
16
  var uFuzzy = require('@leeoniya/ufuzzy');
17
17
  var reactUse = require('react-use');
18
18
  var operators = require('rxjs/operators');
@@ -77,8 +77,8 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
77
77
  }
78
78
 
79
79
  var __defProp$J = Object.defineProperty;
80
- var __defProps$t = Object.defineProperties;
81
- var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
80
+ var __defProps$s = Object.defineProperties;
81
+ var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
82
82
  var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
83
83
  var __hasOwnProp$J = Object.prototype.hasOwnProperty;
84
84
  var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
@@ -94,13 +94,13 @@ var __spreadValues$J = (a, b) => {
94
94
  }
95
95
  return a;
96
96
  };
97
- var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
97
+ var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
98
98
  const runtimePanelPlugins = /* @__PURE__ */ new Map();
99
99
  function registerRuntimePanelPlugin({ pluginId, plugin }) {
100
100
  if (runtimePanelPlugins.has(pluginId)) {
101
101
  throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
102
102
  }
103
- plugin.meta = __spreadProps$t(__spreadValues$J({}, plugin.meta), {
103
+ plugin.meta = __spreadProps$s(__spreadValues$J({}, plugin.meta), {
104
104
  id: pluginId,
105
105
  name: pluginId,
106
106
  module: "runtime plugin",
@@ -129,8 +129,8 @@ function loadPanelPluginSync(pluginId) {
129
129
  }
130
130
 
131
131
  var __defProp$I = Object.defineProperty;
132
- var __defProps$s = Object.defineProperties;
133
- var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
132
+ var __defProps$r = Object.defineProperties;
133
+ var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
134
134
  var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
135
135
  var __hasOwnProp$I = Object.prototype.hasOwnProperty;
136
136
  var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
@@ -146,7 +146,7 @@ var __spreadValues$I = (a, b) => {
146
146
  }
147
147
  return a;
148
148
  };
149
- var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
149
+ var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
150
150
  var __objRest$4 = (source, exclude) => {
151
151
  var target = {};
152
152
  for (var prop in source)
@@ -172,7 +172,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
172
172
  if (!model.isActive) {
173
173
  return null;
174
174
  }
175
- return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$s(__spreadValues$I({}, otherProps), {
175
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$r(__spreadValues$I({}, otherProps), {
176
176
  model
177
177
  }));
178
178
  }
@@ -1347,7 +1347,7 @@ function sceneInterpolator(sceneObject, target, scopedVars, format, interpolatio
1347
1347
  }
1348
1348
  return match;
1349
1349
  }
1350
- const value = formatValue(sceneObject, variable, variable.getValue(fieldPath), fmt);
1350
+ const value = formatValue(variable, variable.getValue(fieldPath), fmt);
1351
1351
  if (interpolations) {
1352
1352
  interpolations.push({ match, variableName, fieldPath, format: fmt, value, found: value !== match });
1353
1353
  }
@@ -1368,12 +1368,12 @@ function lookupFormatVariable(name, match, scopedVars, sceneObject) {
1368
1368
  }
1369
1369
  return null;
1370
1370
  }
1371
- function formatValue(context, variable, value, formatNameOrFn) {
1371
+ function formatValue(variable, value, formatNameOrFn) {
1372
1372
  if (value === null || value === void 0) {
1373
1373
  return "";
1374
1374
  }
1375
1375
  if (isCustomVariableValue(value)) {
1376
- return sceneInterpolator(context, value.formatter(formatNameOrFn));
1376
+ return value.formatter(formatNameOrFn);
1377
1377
  }
1378
1378
  if (!Array.isArray(value) && typeof value === "object") {
1379
1379
  value = `${value}`;
@@ -1749,8 +1749,8 @@ function collectAllVariables(sceneObject, record = {}) {
1749
1749
  }
1750
1750
 
1751
1751
  var __defProp$D = Object.defineProperty;
1752
- var __defProps$r = Object.defineProperties;
1753
- var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
1752
+ var __defProps$q = Object.defineProperties;
1753
+ var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
1754
1754
  var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
1755
1755
  var __hasOwnProp$D = Object.prototype.hasOwnProperty;
1756
1756
  var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
@@ -1766,7 +1766,7 @@ var __spreadValues$D = (a, b) => {
1766
1766
  }
1767
1767
  return a;
1768
1768
  };
1769
- var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
1769
+ var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
1770
1770
  function getTemplateProxyForField(field, frame, frames) {
1771
1771
  return new Proxy(
1772
1772
  {},
@@ -1782,7 +1782,7 @@ function getTemplateProxyForField(field, frame, frames) {
1782
1782
  if (!field.labels) {
1783
1783
  return "";
1784
1784
  }
1785
- return __spreadProps$r(__spreadValues$D({}, field.labels), {
1785
+ return __spreadProps$q(__spreadValues$D({}, field.labels), {
1786
1786
  __values: Object.values(field.labels).sort().join(", "),
1787
1787
  toString: () => {
1788
1788
  return data.formatLabels(field.labels, "", true);
@@ -2071,11 +2071,7 @@ async function getDataSource(datasource, scopedVars) {
2071
2071
  }
2072
2072
 
2073
2073
  function writeSceneLog(logger, message, ...rest) {
2074
- let loggingEnabled = false;
2075
- if (typeof window !== "undefined") {
2076
- loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
2077
- }
2078
- if (loggingEnabled) {
2074
+ if (window.grafanaSceneLogging) {
2079
2075
  console.log(`${logger}: `, message, ...rest);
2080
2076
  }
2081
2077
  }
@@ -2259,13 +2255,7 @@ class VariableValueRecorder {
2259
2255
  }
2260
2256
  }
2261
2257
 
2262
- function isExtraQueryProvider(obj) {
2263
- return typeof obj === "object" && "getExtraQueries" in obj;
2264
- }
2265
-
2266
2258
  var __defProp$C = Object.defineProperty;
2267
- var __defProps$q = Object.defineProperties;
2268
- var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
2269
2259
  var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
2270
2260
  var __hasOwnProp$C = Object.prototype.hasOwnProperty;
2271
2261
  var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
@@ -2281,29 +2271,166 @@ var __spreadValues$C = (a, b) => {
2281
2271
  }
2282
2272
  return a;
2283
2273
  };
2284
- var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
2285
- const passthroughProcessor = (_, secondary) => rxjs.of(secondary);
2286
- const extraQueryProcessingOperator = (processors) => (data) => {
2287
- return data.pipe(
2288
- rxjs.mergeMap(([primary, ...secondaries]) => {
2289
- const processedSecondaries = secondaries.flatMap((s) => {
2290
- var _a, _b;
2291
- return (_b = (_a = processors.get(s.request.requestId)) == null ? void 0 : _a(primary, s)) != null ? _b : rxjs.of(s);
2292
- });
2293
- return rxjs.forkJoin([rxjs.of(primary), ...processedSecondaries]);
2294
- }),
2295
- rxjs.map(([primary, ...processedSecondaries]) => {
2296
- var _a;
2297
- return __spreadProps$q(__spreadValues$C({}, primary), {
2298
- series: [...primary.series, ...processedSecondaries.flatMap((s) => s.series)],
2299
- annotations: [...(_a = primary.annotations) != null ? _a : [], ...processedSecondaries.flatMap((s) => {
2300
- var _a2;
2301
- return (_a2 = s.annotations) != null ? _a2 : [];
2302
- })]
2274
+ const PREVIOUS_PERIOD_VALUE = "__previousPeriod";
2275
+ const NO_PERIOD_VALUE = "__noPeriod";
2276
+ const PREVIOUS_PERIOD_COMPARE_OPTION = {
2277
+ label: "Previous period",
2278
+ value: PREVIOUS_PERIOD_VALUE
2279
+ };
2280
+ const NO_COMPARE_OPTION = {
2281
+ label: "No comparison",
2282
+ value: NO_PERIOD_VALUE
2283
+ };
2284
+ const DEFAULT_COMPARE_OPTIONS = [
2285
+ { label: "Day before", value: "24h" },
2286
+ { label: "Week before", value: "1w" },
2287
+ { label: "Month before", value: "1M" }
2288
+ ];
2289
+ class SceneTimeRangeCompare extends SceneObjectBase {
2290
+ constructor(state) {
2291
+ super(__spreadValues$C({ compareOptions: DEFAULT_COMPARE_OPTIONS }, state));
2292
+ this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["compareWith"] });
2293
+ this._onActivate = () => {
2294
+ const sceneTimeRange = sceneGraph.getTimeRange(this);
2295
+ this.setState({ compareOptions: this.getCompareOptions(sceneTimeRange.state.value) });
2296
+ this._subs.add(
2297
+ sceneTimeRange.subscribeToState((timeRange) => {
2298
+ const compareOptions = this.getCompareOptions(timeRange.value);
2299
+ const stateUpdate = { compareOptions };
2300
+ if (Boolean(this.state.compareWith) && !compareOptions.find(({ value }) => value === this.state.compareWith)) {
2301
+ stateUpdate.compareWith = PREVIOUS_PERIOD_VALUE;
2302
+ }
2303
+ this.setState(stateUpdate);
2304
+ })
2305
+ );
2306
+ };
2307
+ this.getCompareOptions = (timeRange) => {
2308
+ const diffDays = Math.ceil(timeRange.to.diff(timeRange.from));
2309
+ const matchIndex = DEFAULT_COMPARE_OPTIONS.findIndex(({ value }) => {
2310
+ const intervalInMs = data.rangeUtil.intervalToMs(value);
2311
+ return intervalInMs >= diffDays;
2303
2312
  });
2313
+ return [
2314
+ NO_COMPARE_OPTION,
2315
+ PREVIOUS_PERIOD_COMPARE_OPTION,
2316
+ ...DEFAULT_COMPARE_OPTIONS.slice(matchIndex).map(({ label, value }) => ({ label, value }))
2317
+ ];
2318
+ };
2319
+ this.onCompareWithChanged = (compareWith) => {
2320
+ if (compareWith === NO_PERIOD_VALUE) {
2321
+ this.onClearCompare();
2322
+ } else {
2323
+ this.setState({ compareWith });
2324
+ }
2325
+ };
2326
+ this.onClearCompare = () => {
2327
+ this.setState({ compareWith: void 0 });
2328
+ };
2329
+ this.addActivationHandler(this._onActivate);
2330
+ }
2331
+ getCompareTimeRange(timeRange) {
2332
+ let compareFrom;
2333
+ let compareTo;
2334
+ if (this.state.compareWith) {
2335
+ if (this.state.compareWith === PREVIOUS_PERIOD_VALUE) {
2336
+ const diffMs = timeRange.to.diff(timeRange.from);
2337
+ compareFrom = data.dateTime(timeRange.from).subtract(diffMs);
2338
+ compareTo = data.dateTime(timeRange.to).subtract(diffMs);
2339
+ } else {
2340
+ compareFrom = data.dateTime(timeRange.from).subtract(data.rangeUtil.intervalToMs(this.state.compareWith));
2341
+ compareTo = data.dateTime(timeRange.to).subtract(data.rangeUtil.intervalToMs(this.state.compareWith));
2342
+ }
2343
+ return {
2344
+ from: compareFrom,
2345
+ to: compareTo,
2346
+ raw: {
2347
+ from: compareFrom,
2348
+ to: compareTo
2349
+ }
2350
+ };
2351
+ }
2352
+ return void 0;
2353
+ }
2354
+ getUrlState() {
2355
+ return {
2356
+ compareWith: this.state.compareWith
2357
+ };
2358
+ }
2359
+ updateFromUrl(values) {
2360
+ if (!values.compareWith) {
2361
+ return;
2362
+ }
2363
+ const compareWith = parseUrlParam(values.compareWith);
2364
+ if (compareWith) {
2365
+ const compareOptions = this.getCompareOptions(sceneGraph.getTimeRange(this).state.value);
2366
+ if (compareOptions.find(({ value }) => value === compareWith)) {
2367
+ this.setState({
2368
+ compareWith
2369
+ });
2370
+ } else {
2371
+ this.setState({
2372
+ compareWith: "__previousPeriod"
2373
+ });
2374
+ }
2375
+ }
2376
+ }
2377
+ }
2378
+ SceneTimeRangeCompare.Component = SceneTimeRangeCompareRenderer;
2379
+ function SceneTimeRangeCompareRenderer({ model }) {
2380
+ var _a;
2381
+ const styles = ui.useStyles2(getStyles$9);
2382
+ const { compareWith, compareOptions } = model.useState();
2383
+ const [previousCompare, setPreviousCompare] = React__default["default"].useState(compareWith);
2384
+ const previousValue = (_a = compareOptions.find(({ value: value2 }) => value2 === previousCompare)) != null ? _a : PREVIOUS_PERIOD_COMPARE_OPTION;
2385
+ const value = compareOptions.find(({ value: value2 }) => value2 === compareWith);
2386
+ const enabled = Boolean(value);
2387
+ const onClick = () => {
2388
+ if (enabled) {
2389
+ setPreviousCompare(compareWith);
2390
+ model.onClearCompare();
2391
+ } else if (!enabled) {
2392
+ model.onCompareWithChanged(previousValue.value);
2393
+ }
2394
+ };
2395
+ return /* @__PURE__ */ React__default["default"].createElement(ui.ButtonGroup, null, /* @__PURE__ */ React__default["default"].createElement(ui.ToolbarButton, {
2396
+ variant: "canvas",
2397
+ tooltip: "Enable time frame comparison",
2398
+ onClick: (e) => {
2399
+ e.stopPropagation();
2400
+ e.preventDefault();
2401
+ onClick();
2402
+ }
2403
+ }, /* @__PURE__ */ React__default["default"].createElement(ui.Checkbox, {
2404
+ label: " ",
2405
+ value: enabled,
2406
+ onClick
2407
+ }), "Comparison"), enabled ? /* @__PURE__ */ React__default["default"].createElement(ui.ButtonSelect, {
2408
+ variant: "canvas",
2409
+ value,
2410
+ options: compareOptions,
2411
+ onChange: (v) => {
2412
+ model.onCompareWithChanged(v.value);
2413
+ }
2414
+ }) : /* @__PURE__ */ React__default["default"].createElement(ui.ToolbarButton, {
2415
+ className: styles.previewButton,
2416
+ disabled: true,
2417
+ variant: "canvas",
2418
+ isOpen: false
2419
+ }, previousValue.label));
2420
+ }
2421
+ function getStyles$9(theme) {
2422
+ return {
2423
+ previewButton: css.css({
2424
+ "&:disabled": {
2425
+ border: `1px solid ${theme.colors.secondary.border}`,
2426
+ color: theme.colors.text.disabled,
2427
+ opacity: 1
2428
+ }
2304
2429
  })
2305
- );
2306
- };
2430
+ };
2431
+ }
2432
+
2433
+ const getCompareSeriesRefId = (refId) => `${refId}-compare`;
2307
2434
 
2308
2435
  var __defProp$B = Object.defineProperty;
2309
2436
  var __defProps$p = Object.defineProperties;
@@ -2324,6 +2451,59 @@ var __spreadValues$B = (a, b) => {
2324
2451
  return a;
2325
2452
  };
2326
2453
  var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
2454
+ function timeShiftQueryResponseOperator(data$1) {
2455
+ return data$1.pipe(
2456
+ rxjs.map(([p, s]) => {
2457
+ const diff = s.timeRange.from.diff(p.timeRange.from);
2458
+ s.series.forEach((series) => {
2459
+ series.refId = getCompareSeriesRefId(series.refId || "");
2460
+ series.meta = __spreadProps$p(__spreadValues$B({}, series.meta), {
2461
+ timeCompare: {
2462
+ diffMs: diff,
2463
+ isTimeShiftQuery: true
2464
+ }
2465
+ });
2466
+ series.fields.forEach((field) => {
2467
+ if (field.type === data.FieldType.time) {
2468
+ field.values = field.values.map((v) => {
2469
+ return diff < 0 ? v - diff : v + diff;
2470
+ });
2471
+ }
2472
+ field.config = __spreadProps$p(__spreadValues$B({}, field.config), {
2473
+ color: {
2474
+ mode: "fixed",
2475
+ fixedColor: runtime.config.theme.palette.gray60
2476
+ }
2477
+ });
2478
+ return field;
2479
+ });
2480
+ });
2481
+ return __spreadProps$p(__spreadValues$B({}, p), {
2482
+ series: [...p.series, ...s.series]
2483
+ });
2484
+ })
2485
+ );
2486
+ }
2487
+
2488
+ var __defProp$A = Object.defineProperty;
2489
+ var __defProps$o = Object.defineProperties;
2490
+ var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
2491
+ var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
2492
+ var __hasOwnProp$A = Object.prototype.hasOwnProperty;
2493
+ var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
2494
+ var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2495
+ var __spreadValues$A = (a, b) => {
2496
+ for (var prop in b || (b = {}))
2497
+ if (__hasOwnProp$A.call(b, prop))
2498
+ __defNormalProp$A(a, prop, b[prop]);
2499
+ if (__getOwnPropSymbols$A)
2500
+ for (var prop of __getOwnPropSymbols$A(b)) {
2501
+ if (__propIsEnum$A.call(b, prop))
2502
+ __defNormalProp$A(a, prop, b[prop]);
2503
+ }
2504
+ return a;
2505
+ };
2506
+ var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
2327
2507
  function filterAnnotations(data, filters) {
2328
2508
  var _a;
2329
2509
  if (!Array.isArray(data) || data.length === 0) {
@@ -2374,11 +2554,11 @@ function filterAnnotations(data, filters) {
2374
2554
  continue;
2375
2555
  }
2376
2556
  }
2377
- fields.push(__spreadProps$p(__spreadValues$B({}, field), {
2557
+ fields.push(__spreadProps$o(__spreadValues$A({}, field), {
2378
2558
  values: buffer
2379
2559
  }));
2380
2560
  }
2381
- processed.push(__spreadProps$p(__spreadValues$B({}, frame), {
2561
+ processed.push(__spreadProps$o(__spreadValues$A({}, frame), {
2382
2562
  fields,
2383
2563
  length: frameLength
2384
2564
  }));
@@ -2765,20 +2945,13 @@ class CustomAllValue {
2765
2945
  }
2766
2946
  }
2767
2947
 
2768
- function getOptionSearcher(options, includeAll, value, text) {
2948
+ function getOptionSearcher(options, includeAll, limit = 1e4) {
2769
2949
  const ufuzzy = new uFuzzy__default["default"]();
2770
2950
  let allOptions = options;
2771
2951
  const haystack = [];
2772
- const limit = 1e4;
2773
2952
  if (includeAll) {
2774
2953
  allOptions = [{ value: ALL_VARIABLE_VALUE, label: ALL_VARIABLE_TEXT }, ...allOptions];
2775
2954
  }
2776
- if (!Array.isArray(value)) {
2777
- const current = options.find((x) => x.value === value);
2778
- if (!current) {
2779
- allOptions = [{ value, label: String(text) }, ...allOptions];
2780
- }
2781
- }
2782
2955
  return (search) => {
2783
2956
  if (search === "") {
2784
2957
  if (allOptions.length > limit) {
@@ -2810,33 +2983,33 @@ function getOptionSearcher(options, includeAll, value, text) {
2810
2983
  };
2811
2984
  }
2812
2985
 
2813
- var __defProp$A = Object.defineProperty;
2814
- var __defProps$o = Object.defineProperties;
2815
- var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
2816
- var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
2817
- var __hasOwnProp$A = Object.prototype.hasOwnProperty;
2818
- var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
2819
- var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2820
- var __spreadValues$A = (a, b) => {
2986
+ var __defProp$z = Object.defineProperty;
2987
+ var __defProps$n = Object.defineProperties;
2988
+ var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
2989
+ var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
2990
+ var __hasOwnProp$z = Object.prototype.hasOwnProperty;
2991
+ var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
2992
+ var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2993
+ var __spreadValues$z = (a, b) => {
2821
2994
  for (var prop in b || (b = {}))
2822
- if (__hasOwnProp$A.call(b, prop))
2823
- __defNormalProp$A(a, prop, b[prop]);
2824
- if (__getOwnPropSymbols$A)
2825
- for (var prop of __getOwnPropSymbols$A(b)) {
2826
- if (__propIsEnum$A.call(b, prop))
2827
- __defNormalProp$A(a, prop, b[prop]);
2995
+ if (__hasOwnProp$z.call(b, prop))
2996
+ __defNormalProp$z(a, prop, b[prop]);
2997
+ if (__getOwnPropSymbols$z)
2998
+ for (var prop of __getOwnPropSymbols$z(b)) {
2999
+ if (__propIsEnum$z.call(b, prop))
3000
+ __defNormalProp$z(a, prop, b[prop]);
2828
3001
  }
2829
3002
  return a;
2830
3003
  };
2831
- var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
3004
+ var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
2832
3005
  var __objRest$3 = (source, exclude) => {
2833
3006
  var target = {};
2834
3007
  for (var prop in source)
2835
- if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
3008
+ if (__hasOwnProp$z.call(source, prop) && exclude.indexOf(prop) < 0)
2836
3009
  target[prop] = source[prop];
2837
- if (source != null && __getOwnPropSymbols$A)
2838
- for (var prop of __getOwnPropSymbols$A(source)) {
2839
- if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
3010
+ if (source != null && __getOwnPropSymbols$z)
3011
+ for (var prop of __getOwnPropSymbols$z(source)) {
3012
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$z.call(source, prop))
2840
3013
  target[prop] = source[prop];
2841
3014
  }
2842
3015
  return target;
@@ -2847,8 +3020,8 @@ function VariableValueSelect({ model }) {
2847
3020
  const [inputValue, setInputValue] = React.useState("");
2848
3021
  const [hasCustomValue, setHasCustomValue] = React.useState(false);
2849
3022
  const optionSearcher = React.useMemo(
2850
- () => getOptionSearcher(options, includeAll, value, text),
2851
- [options, includeAll, value, text]
3023
+ () => getOptionSearcher(options, includeAll),
3024
+ [options, includeAll]
2852
3025
  );
2853
3026
  const onInputChange = (value2, { action }) => {
2854
3027
  if (action === "input-change") {
@@ -2871,6 +3044,7 @@ function VariableValueSelect({ model }) {
2871
3044
  };
2872
3045
  return /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
2873
3046
  id: key,
3047
+ isValidNewOption: (inputValue2) => inputValue2.trim().length > 0,
2874
3048
  placeholder: "Select value",
2875
3049
  width: "auto",
2876
3050
  value,
@@ -2893,13 +3067,13 @@ function VariableValueSelect({ model }) {
2893
3067
  });
2894
3068
  }
2895
3069
  function VariableValueSelectMulti({ model }) {
2896
- const { value, text, options, key, maxVisibleValues, noValueOnClear, includeAll } = model.useState();
3070
+ const { value, options, key, maxVisibleValues, noValueOnClear, includeAll } = model.useState();
2897
3071
  const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
2898
3072
  const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
2899
3073
  const [inputValue, setInputValue] = React.useState("");
2900
3074
  const optionSearcher = React.useMemo(
2901
- () => getOptionSearcher(options, includeAll, value, text),
2902
- [options, includeAll, value, text]
3075
+ () => getOptionSearcher(options, includeAll),
3076
+ [options, includeAll]
2903
3077
  );
2904
3078
  React.useEffect(() => {
2905
3079
  setUncommittedValue(arrayValue);
@@ -2959,26 +3133,25 @@ const OptionWithCheckbox = ({
2959
3133
  isSelected,
2960
3134
  renderOptionLabel
2961
3135
  }) => {
2962
- var _b;
2963
3136
  const _a = innerProps, rest = __objRest$3(_a, ["onMouseMove", "onMouseOver"]);
2964
3137
  const theme = ui.useTheme2();
2965
3138
  const selectStyles = ui.getSelectStyles(theme);
2966
3139
  const optionStyles = ui.useStyles2(getOptionStyles);
2967
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({
3140
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$n(__spreadValues$z({
2968
3141
  ref: innerRef,
2969
3142
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
2970
3143
  }, rest), {
2971
- "data-testid": e2eSelectors.selectors.components.Select.option,
3144
+ "aria-label": "Select option",
3145
+ "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(
3146
+ data.label || String(data.value)
3147
+ ),
2972
3148
  title: data.title
2973
3149
  }), /* @__PURE__ */ React__default["default"].createElement("div", {
2974
3150
  className: optionStyles.checkbox
2975
3151
  }, /* @__PURE__ */ React__default["default"].createElement(ui.Checkbox, {
2976
3152
  value: isSelected
2977
3153
  })), /* @__PURE__ */ React__default["default"].createElement("div", {
2978
- className: selectStyles.optionBody,
2979
- "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(
2980
- (_b = data.label) != null ? _b : String(data.value)
2981
- )
3154
+ className: selectStyles.optionBody
2982
3155
  }, /* @__PURE__ */ React__default["default"].createElement("span", null, children)));
2983
3156
  };
2984
3157
  OptionWithCheckbox.displayName = "SelectMenuOptions";
@@ -3058,28 +3231,28 @@ function fromUrlValues(urlValues) {
3058
3231
  );
3059
3232
  }
3060
3233
 
3061
- var __defProp$z = Object.defineProperty;
3062
- var __defProps$n = Object.defineProperties;
3063
- var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
3064
- var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
3065
- var __hasOwnProp$z = Object.prototype.hasOwnProperty;
3066
- var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
3067
- var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3068
- var __spreadValues$z = (a, b) => {
3234
+ var __defProp$y = Object.defineProperty;
3235
+ var __defProps$m = Object.defineProperties;
3236
+ var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
3237
+ var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
3238
+ var __hasOwnProp$y = Object.prototype.hasOwnProperty;
3239
+ var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
3240
+ var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3241
+ var __spreadValues$y = (a, b) => {
3069
3242
  for (var prop in b || (b = {}))
3070
- if (__hasOwnProp$z.call(b, prop))
3071
- __defNormalProp$z(a, prop, b[prop]);
3072
- if (__getOwnPropSymbols$z)
3073
- for (var prop of __getOwnPropSymbols$z(b)) {
3074
- if (__propIsEnum$z.call(b, prop))
3075
- __defNormalProp$z(a, prop, b[prop]);
3243
+ if (__hasOwnProp$y.call(b, prop))
3244
+ __defNormalProp$y(a, prop, b[prop]);
3245
+ if (__getOwnPropSymbols$y)
3246
+ for (var prop of __getOwnPropSymbols$y(b)) {
3247
+ if (__propIsEnum$y.call(b, prop))
3248
+ __defNormalProp$y(a, prop, b[prop]);
3076
3249
  }
3077
3250
  return a;
3078
3251
  };
3079
- var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
3252
+ var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
3080
3253
  class GroupByVariable extends MultiValueVariable {
3081
3254
  constructor(initialState) {
3082
- super(__spreadProps$n(__spreadValues$z({
3255
+ super(__spreadProps$m(__spreadValues$y({
3083
3256
  isMulti: true,
3084
3257
  name: "",
3085
3258
  value: [],
@@ -3197,8 +3370,8 @@ function GroupByVariableRenderer({ model }) {
3197
3370
  const [inputValue, setInputValue] = React.useState("");
3198
3371
  const [uncommittedValue, setUncommittedValue] = React.useState(values);
3199
3372
  const optionSearcher = React.useMemo(
3200
- () => getOptionSearcher(options, includeAll, value, text),
3201
- [options, includeAll, value, text]
3373
+ () => getOptionSearcher(options, includeAll),
3374
+ [options, includeAll]
3202
3375
  );
3203
3376
  React.useEffect(() => {
3204
3377
  setUncommittedValue(values);
@@ -3278,7 +3451,7 @@ function LoadingIndicator(props) {
3278
3451
  }
3279
3452
 
3280
3453
  function ControlsLabel(props) {
3281
- const styles = ui.useStyles2(getStyles$9);
3454
+ const styles = ui.useStyles2(getStyles$8);
3282
3455
  const theme = ui.useTheme2();
3283
3456
  const isVertical = props.layout === "vertical";
3284
3457
  const loadingIndicator = Boolean(props.isLoading) ? /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -3341,7 +3514,7 @@ function ControlsLabel(props) {
3341
3514
  }
3342
3515
  return labelElement;
3343
3516
  }
3344
- const getStyles$9 = (theme) => ({
3517
+ const getStyles$8 = (theme) => ({
3345
3518
  horizontalLabel: css.css({
3346
3519
  background: theme.isDark ? theme.colors.background.primary : theme.colors.background.secondary,
3347
3520
  display: `flex`,
@@ -3376,6 +3549,13 @@ const getStyles$9 = (theme) => ({
3376
3549
  })
3377
3550
  });
3378
3551
 
3552
+ function selectableValueToVariableValueOption(value) {
3553
+ var _a;
3554
+ return {
3555
+ label: (_a = value.label) != null ? _a : String(value.value),
3556
+ value: value.value
3557
+ };
3558
+ }
3379
3559
  function keyLabelToOption(key, label) {
3380
3560
  return key !== "" ? {
3381
3561
  value: key,
@@ -3384,16 +3564,30 @@ function keyLabelToOption(key, label) {
3384
3564
  }
3385
3565
  function AdHocFilterRenderer({ filter, model }) {
3386
3566
  var _a, _b;
3387
- const styles = ui.useStyles2(getStyles$8);
3567
+ const styles = ui.useStyles2(getStyles$7);
3388
3568
  const [keys, setKeys] = React.useState([]);
3389
3569
  const [values, setValues] = React.useState([]);
3390
3570
  const [isKeysLoading, setIsKeysLoading] = React.useState(false);
3391
3571
  const [isValuesLoading, setIsValuesLoading] = React.useState(false);
3392
3572
  const [isKeysOpen, setIsKeysOpen] = React.useState(false);
3393
3573
  const [isValuesOpen, setIsValuesOpen] = React.useState(false);
3574
+ const [valueInputValue, setValueInputValue] = React.useState("");
3575
+ const [valueHasCustomValue, setValueHasCustomValue] = React.useState(false);
3394
3576
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
3395
3577
  const valueValue = keyLabelToOption(filter.value, filter.valueLabel);
3578
+ const optionSearcher = React.useMemo(
3579
+ () => getOptionSearcher(values.map(selectableValueToVariableValueOption), void 0, 1e3),
3580
+ [values]
3581
+ );
3582
+ const onValueInputChange = (value, { action }) => {
3583
+ if (action === "input-change") {
3584
+ setValueInputValue(value);
3585
+ }
3586
+ return value;
3587
+ };
3588
+ const filteredValueOptions = optionSearcher(valueInputValue);
3396
3589
  const valueSelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
3590
+ virtualized: true,
3397
3591
  allowCustomValue: true,
3398
3592
  isValidNewOption: (inputValue) => inputValue.trim().length > 0,
3399
3593
  allowCreateWhileLoading: true,
@@ -3403,21 +3597,33 @@ function AdHocFilterRenderer({ filter, model }) {
3403
3597
  width: "auto",
3404
3598
  value: valueValue,
3405
3599
  placeholder: "Select value",
3406
- options: values,
3407
- onChange: (v) => model._updateFilter(filter, "value", v),
3600
+ options: filteredValueOptions,
3601
+ inputValue: valueInputValue,
3602
+ onInputChange: onValueInputChange,
3603
+ onChange: (v) => {
3604
+ model._updateFilter(filter, "value", v);
3605
+ if (valueHasCustomValue !== v.__isNew__) {
3606
+ setValueHasCustomValue(v.__isNew__);
3607
+ }
3608
+ },
3408
3609
  isOpen: isValuesOpen && !isValuesLoading,
3409
3610
  isLoading: isValuesLoading,
3410
3611
  autoFocus: filter.key !== "" && filter.value === "",
3411
3612
  openMenuOnFocus: true,
3412
3613
  onOpenMenu: async () => {
3614
+ var _a2;
3413
3615
  setIsValuesLoading(true);
3414
3616
  setIsValuesOpen(true);
3415
3617
  const values2 = await model._getValuesFor(filter);
3416
3618
  setIsValuesLoading(false);
3417
3619
  setValues(values2);
3620
+ if (valueHasCustomValue) {
3621
+ setValueInputValue((_a2 = valueValue == null ? void 0 : valueValue.label) != null ? _a2 : "");
3622
+ }
3418
3623
  },
3419
3624
  onCloseMenu: () => {
3420
3625
  setIsValuesOpen(false);
3626
+ setValueInputValue("");
3421
3627
  }
3422
3628
  });
3423
3629
  const keySelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
@@ -3489,7 +3695,7 @@ function AdHocFilterRenderer({ filter, model }) {
3489
3695
  onClick: () => model._removeFilter(filter)
3490
3696
  }));
3491
3697
  }
3492
- const getStyles$8 = (theme) => ({
3698
+ const getStyles$7 = (theme) => ({
3493
3699
  field: css.css({
3494
3700
  marginBottom: 0
3495
3701
  }),
@@ -3627,29 +3833,29 @@ function isFilter(filter) {
3627
3833
  return filter !== null && typeof filter.key === "string" && typeof filter.value === "string";
3628
3834
  }
3629
3835
 
3630
- var __defProp$y = Object.defineProperty;
3631
- var __defProps$m = Object.defineProperties;
3632
- var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
3633
- var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
3634
- var __hasOwnProp$y = Object.prototype.hasOwnProperty;
3635
- var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
3636
- var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3637
- var __spreadValues$y = (a, b) => {
3836
+ var __defProp$x = Object.defineProperty;
3837
+ var __defProps$l = Object.defineProperties;
3838
+ var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
3839
+ var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
3840
+ var __hasOwnProp$x = Object.prototype.hasOwnProperty;
3841
+ var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
3842
+ var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3843
+ var __spreadValues$x = (a, b) => {
3638
3844
  for (var prop in b || (b = {}))
3639
- if (__hasOwnProp$y.call(b, prop))
3640
- __defNormalProp$y(a, prop, b[prop]);
3641
- if (__getOwnPropSymbols$y)
3642
- for (var prop of __getOwnPropSymbols$y(b)) {
3643
- if (__propIsEnum$y.call(b, prop))
3644
- __defNormalProp$y(a, prop, b[prop]);
3845
+ if (__hasOwnProp$x.call(b, prop))
3846
+ __defNormalProp$x(a, prop, b[prop]);
3847
+ if (__getOwnPropSymbols$x)
3848
+ for (var prop of __getOwnPropSymbols$x(b)) {
3849
+ if (__propIsEnum$x.call(b, prop))
3850
+ __defNormalProp$x(a, prop, b[prop]);
3645
3851
  }
3646
3852
  return a;
3647
3853
  };
3648
- var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
3854
+ var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
3649
3855
  class AdHocFiltersVariable extends SceneObjectBase {
3650
3856
  constructor(state) {
3651
3857
  var _a, _b;
3652
- super(__spreadValues$y({
3858
+ super(__spreadValues$x({
3653
3859
  type: "adhoc",
3654
3860
  name: (_a = state.name) != null ? _a : "Filters",
3655
3861
  filters: [],
@@ -3686,15 +3892,15 @@ class AdHocFiltersVariable extends SceneObjectBase {
3686
3892
  const propLabelKey = `${prop}Label`;
3687
3893
  if (filter === _wip) {
3688
3894
  if (prop === "value") {
3689
- this.setState({ filters: [...filters, __spreadProps$m(__spreadValues$y({}, _wip), { [prop]: value, [propLabelKey]: label })], _wip: void 0 });
3895
+ this.setState({ filters: [...filters, __spreadProps$l(__spreadValues$x({}, _wip), { [prop]: value, [propLabelKey]: label })], _wip: void 0 });
3690
3896
  } else {
3691
- this.setState({ _wip: __spreadProps$m(__spreadValues$y({}, filter), { [prop]: value, [propLabelKey]: label }) });
3897
+ this.setState({ _wip: __spreadProps$l(__spreadValues$x({}, filter), { [prop]: value, [propLabelKey]: label }) });
3692
3898
  }
3693
3899
  return;
3694
3900
  }
3695
3901
  const updatedFilters = this.state.filters.map((f) => {
3696
3902
  if (f === filter) {
3697
- const updatedFilter = __spreadProps$m(__spreadValues$y({}, f), { [prop]: value, [propLabelKey]: label });
3903
+ const updatedFilter = __spreadProps$l(__spreadValues$x({}, f), { [prop]: value, [propLabelKey]: label });
3698
3904
  if (prop === "key" && filter[prop] !== value) {
3699
3905
  updatedFilter.value = "";
3700
3906
  updatedFilter.valueLabel = "";
@@ -3775,7 +3981,7 @@ function renderExpression(builder, filters) {
3775
3981
  }
3776
3982
  function AdHocFiltersVariableRenderer({ model }) {
3777
3983
  const { filters, readOnly, addFilterButtonText } = model.useState();
3778
- const styles = ui.useStyles2(getStyles$7);
3984
+ const styles = ui.useStyles2(getStyles$6);
3779
3985
  return /* @__PURE__ */ React__default["default"].createElement("div", {
3780
3986
  className: styles.wrapper
3781
3987
  }, filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
@@ -3789,7 +3995,7 @@ function AdHocFiltersVariableRenderer({ model }) {
3789
3995
  addFilterButtonText
3790
3996
  }));
3791
3997
  }
3792
- const getStyles$7 = (theme) => ({
3998
+ const getStyles$6 = (theme) => ({
3793
3999
  wrapper: css.css({
3794
4000
  display: "flex",
3795
4001
  flexWrap: "wrap",
@@ -3873,25 +4079,25 @@ function areDifferentLayers(a, b) {
3873
4079
  return false;
3874
4080
  }
3875
4081
 
3876
- var __defProp$x = Object.defineProperty;
3877
- var __defProps$l = Object.defineProperties;
3878
- var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
3879
- var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
3880
- var __hasOwnProp$x = Object.prototype.hasOwnProperty;
3881
- var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
3882
- var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3883
- var __spreadValues$x = (a, b) => {
4082
+ var __defProp$w = Object.defineProperty;
4083
+ var __defProps$k = Object.defineProperties;
4084
+ var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
4085
+ var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
4086
+ var __hasOwnProp$w = Object.prototype.hasOwnProperty;
4087
+ var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
4088
+ var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4089
+ var __spreadValues$w = (a, b) => {
3884
4090
  for (var prop in b || (b = {}))
3885
- if (__hasOwnProp$x.call(b, prop))
3886
- __defNormalProp$x(a, prop, b[prop]);
3887
- if (__getOwnPropSymbols$x)
3888
- for (var prop of __getOwnPropSymbols$x(b)) {
3889
- if (__propIsEnum$x.call(b, prop))
3890
- __defNormalProp$x(a, prop, b[prop]);
4091
+ if (__hasOwnProp$w.call(b, prop))
4092
+ __defNormalProp$w(a, prop, b[prop]);
4093
+ if (__getOwnPropSymbols$w)
4094
+ for (var prop of __getOwnPropSymbols$w(b)) {
4095
+ if (__propIsEnum$w.call(b, prop))
4096
+ __defNormalProp$w(a, prop, b[prop]);
3891
4097
  }
3892
4098
  return a;
3893
4099
  };
3894
- var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
4100
+ var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
3895
4101
  let counter$1 = 100;
3896
4102
  function getNextRequestId$1() {
3897
4103
  return "SQR" + counter$1++;
@@ -3908,6 +4114,70 @@ class SceneQueryRunner extends SceneObjectBase {
3908
4114
  onVariableUpdateCompleted: this.onVariableUpdatesCompleted.bind(this),
3909
4115
  onAnyVariableChanged: this.onAnyVariableChanged.bind(this)
3910
4116
  });
4117
+ this.prepareRequests = (timeRange, ds) => {
4118
+ const comparer = this.getTimeCompare();
4119
+ const { minInterval, queries } = this.state;
4120
+ let secondaryRequest;
4121
+ let request = __spreadValues$w({
4122
+ app: "scenes",
4123
+ requestId: getNextRequestId$1(),
4124
+ timezone: timeRange.getTimeZone(),
4125
+ panelId: 1,
4126
+ range: timeRange.state.value,
4127
+ interval: "1s",
4128
+ intervalMs: 1e3,
4129
+ targets: lodash.cloneDeep(queries),
4130
+ maxDataPoints: this.getMaxDataPoints(),
4131
+ scopedVars: this._scopedVars,
4132
+ startTime: Date.now(),
4133
+ liveStreaming: this.state.liveStreaming,
4134
+ rangeRaw: {
4135
+ from: timeRange.state.from,
4136
+ to: timeRange.state.to
4137
+ },
4138
+ cacheTimeout: this.state.cacheTimeout,
4139
+ queryCachingTTL: this.state.queryCachingTTL
4140
+ }, getEnrichedDataRequest(this));
4141
+ if (this._adhocFiltersVar) {
4142
+ request.filters = this._adhocFiltersVar.state.filters.filter(isFilterComplete);
4143
+ }
4144
+ if (this._groupByVar) {
4145
+ request.groupByKeys = this._groupByVar.state.value;
4146
+ }
4147
+ request.targets = request.targets.map((query) => {
4148
+ var _a;
4149
+ if (!query.datasource || query.datasource.uid !== ds.uid && !((_a = ds.meta) == null ? void 0 : _a.mixed) && runtime.isExpressionReference && !runtime.isExpressionReference(query.datasource)) {
4150
+ query.datasource = ds.getRef();
4151
+ }
4152
+ return query;
4153
+ });
4154
+ const lowerIntervalLimit = minInterval ? minInterval : ds.interval;
4155
+ const norm = data.rangeUtil.calculateInterval(timeRange.state.value, request.maxDataPoints, lowerIntervalLimit);
4156
+ request.scopedVars = Object.assign({}, request.scopedVars, {
4157
+ __interval: { text: norm.interval, value: norm.interval },
4158
+ __interval_ms: { text: norm.intervalMs.toString(), value: norm.intervalMs }
4159
+ });
4160
+ request.interval = norm.interval;
4161
+ request.intervalMs = norm.intervalMs;
4162
+ const primaryTimeRange = timeRange.state.value;
4163
+ if (comparer) {
4164
+ const secondaryTimeRange = comparer.getCompareTimeRange(primaryTimeRange);
4165
+ if (secondaryTimeRange) {
4166
+ const secondaryTargets = request.targets.filter((query) => query.timeRangeCompare !== false);
4167
+ if (secondaryTargets.length) {
4168
+ secondaryRequest = __spreadProps$k(__spreadValues$w({}, request), {
4169
+ targets: secondaryTargets,
4170
+ range: secondaryTimeRange,
4171
+ requestId: getNextRequestId$1()
4172
+ });
4173
+ }
4174
+ request = __spreadProps$k(__spreadValues$w({}, request), {
4175
+ range: primaryTimeRange
4176
+ });
4177
+ }
4178
+ }
4179
+ return [request, secondaryRequest];
4180
+ };
3911
4181
  this.onDataReceived = (data$1) => {
3912
4182
  const preProcessedData = data.preProcessPanelData(data$1, this.state.data);
3913
4183
  this._resultAnnotations = data$1.annotations;
@@ -3926,11 +4196,11 @@ class SceneQueryRunner extends SceneObjectBase {
3926
4196
  }
3927
4197
  _onActivate() {
3928
4198
  const timeRange = sceneGraph.getTimeRange(this);
3929
- const providers = this.getClosestExtraQueryProviders();
3930
- for (const provider of providers) {
4199
+ const comparer = this.getTimeCompare();
4200
+ if (comparer) {
3931
4201
  this._subs.add(
3932
- provider.subscribeToState((n, p) => {
3933
- if (provider.shouldRerun(p, n)) {
4202
+ comparer.subscribeToState((n, p) => {
4203
+ if (n.compareWith !== p.compareWith) {
3934
4204
  this.runQueries();
3935
4205
  }
3936
4206
  })
@@ -3989,9 +4259,9 @@ class SceneQueryRunner extends SceneObjectBase {
3989
4259
  return;
3990
4260
  }
3991
4261
  this._layerAnnotations = annotations;
3992
- const baseStateUpdate = this.state.data ? this.state.data : __spreadProps$l(__spreadValues$x({}, emptyPanelData), { timeRange: timeRange.state.value });
4262
+ const baseStateUpdate = this.state.data ? this.state.data : __spreadProps$k(__spreadValues$w({}, emptyPanelData), { timeRange: timeRange.state.value });
3993
4263
  this.setState({
3994
- data: __spreadProps$l(__spreadValues$x({}, baseStateUpdate), {
4264
+ data: __spreadProps$k(__spreadValues$w({}, baseStateUpdate), {
3995
4265
  annotations: [...(_d = this._resultAnnotations) != null ? _d : [], ...annotations],
3996
4266
  alertState: alertState != null ? alertState : (_e = this.state.data) == null ? void 0 : _e.alertState
3997
4267
  })
@@ -4110,7 +4380,7 @@ class SceneQueryRunner extends SceneObjectBase {
4110
4380
  this._dataLayersSub = void 0;
4111
4381
  }
4112
4382
  this.setState({
4113
- data: __spreadProps$l(__spreadValues$x({}, this.state.data), { state: schema.LoadingState.Done })
4383
+ data: __spreadProps$k(__spreadValues$w({}, this.state.data), { state: schema.LoadingState.Done })
4114
4384
  });
4115
4385
  }
4116
4386
  async runWithTimeRange(timeRange) {
@@ -4124,7 +4394,6 @@ class SceneQueryRunner extends SceneObjectBase {
4124
4394
  (_a = this._querySub) == null ? void 0 : _a.unsubscribe();
4125
4395
  if (this._variableDependency.hasDependencyInLoadingState()) {
4126
4396
  writeSceneLog("SceneQueryRunner", "Variable dependency is in loading state, skipping query execution");
4127
- this.setState({ data: __spreadProps$l(__spreadValues$x({}, this.state.data), { state: schema.LoadingState.Loading }) });
4128
4397
  return;
4129
4398
  }
4130
4399
  const { queries } = this.state;
@@ -4137,18 +4406,16 @@ class SceneQueryRunner extends SceneObjectBase {
4137
4406
  const ds = await getDataSource(datasource, this._scopedVars);
4138
4407
  this.findAndSubscribeToAdHocFilters(datasource == null ? void 0 : datasource.uid);
4139
4408
  const runRequest = runtime.getRunRequest();
4140
- const { primary, secondaries, processors } = this.prepareRequests(timeRange, ds);
4409
+ const [request, secondaryRequest] = this.prepareRequests(timeRange, ds);
4141
4410
  writeSceneLog("SceneQueryRunner", "Starting runRequest", this.state.key);
4142
- let stream = runRequest(ds, primary);
4143
- if (secondaries.length > 0) {
4144
- const secondaryStreams = secondaries.map((r) => runRequest(ds, r));
4145
- const op = extraQueryProcessingOperator(processors);
4146
- stream = rxjs.forkJoin([stream, ...secondaryStreams]).pipe(op);
4411
+ let stream = runRequest(ds, request);
4412
+ if (secondaryRequest) {
4413
+ stream = rxjs.forkJoin([stream, runRequest(ds, secondaryRequest)]).pipe(timeShiftQueryResponseOperator);
4147
4414
  }
4148
4415
  stream = stream.pipe(
4149
4416
  registerQueryWithController({
4150
4417
  type: "data",
4151
- request: primary,
4418
+ request,
4152
4419
  origin: this,
4153
4420
  cancel: () => this.cancelQuery()
4154
4421
  })
@@ -4156,7 +4423,7 @@ class SceneQueryRunner extends SceneObjectBase {
4156
4423
  this._querySub = stream.subscribe(this.onDataReceived);
4157
4424
  } catch (err) {
4158
4425
  console.error("PanelQueryRunner Error", err);
4159
- this.onDataReceived(__spreadProps$l(__spreadValues$x(__spreadValues$x({}, emptyPanelData), this.state.data), {
4426
+ this.onDataReceived(__spreadProps$k(__spreadValues$w(__spreadValues$w({}, emptyPanelData), this.state.data), {
4160
4427
  state: schema.LoadingState.Error,
4161
4428
  errors: [runtime.toDataQueryError(err)]
4162
4429
  }));
@@ -4166,73 +4433,16 @@ class SceneQueryRunner extends SceneObjectBase {
4166
4433
  var _a;
4167
4434
  const clone = super.clone(withState);
4168
4435
  if (this._resultAnnotations) {
4169
- clone["_resultAnnotations"] = this._resultAnnotations.map((frame) => __spreadValues$x({}, frame));
4436
+ clone["_resultAnnotations"] = this._resultAnnotations.map((frame) => __spreadValues$w({}, frame));
4170
4437
  }
4171
4438
  if (this._layerAnnotations) {
4172
- clone["_layerAnnotations"] = this._layerAnnotations.map((frame) => __spreadValues$x({}, frame));
4439
+ clone["_layerAnnotations"] = this._layerAnnotations.map((frame) => __spreadValues$w({}, frame));
4173
4440
  }
4174
4441
  clone["_variableValueRecorder"] = this._variableValueRecorder.cloneAndRecordCurrentValuesForSceneObject(this);
4175
4442
  clone["_containerWidth"] = this._containerWidth;
4176
4443
  clone["_results"].next({ origin: this, data: (_a = this.state.data) != null ? _a : emptyPanelData });
4177
4444
  return clone;
4178
4445
  }
4179
- prepareRequests(timeRange, ds) {
4180
- var _a;
4181
- const { minInterval, queries } = this.state;
4182
- let request = __spreadValues$x({
4183
- app: "scenes",
4184
- requestId: getNextRequestId$1(),
4185
- timezone: timeRange.getTimeZone(),
4186
- panelId: 1,
4187
- range: timeRange.state.value,
4188
- interval: "1s",
4189
- intervalMs: 1e3,
4190
- targets: lodash.cloneDeep(queries),
4191
- maxDataPoints: this.getMaxDataPoints(),
4192
- scopedVars: this._scopedVars,
4193
- startTime: Date.now(),
4194
- liveStreaming: this.state.liveStreaming,
4195
- rangeRaw: {
4196
- from: timeRange.state.from,
4197
- to: timeRange.state.to
4198
- },
4199
- cacheTimeout: this.state.cacheTimeout,
4200
- queryCachingTTL: this.state.queryCachingTTL
4201
- }, getEnrichedDataRequest(this));
4202
- if (this._adhocFiltersVar) {
4203
- request.filters = this._adhocFiltersVar.state.filters.filter(isFilterComplete);
4204
- }
4205
- if (this._groupByVar) {
4206
- request.groupByKeys = this._groupByVar.state.value;
4207
- }
4208
- request.targets = request.targets.map((query) => {
4209
- var _a2;
4210
- if (!query.datasource || query.datasource.uid !== ds.uid && !((_a2 = ds.meta) == null ? void 0 : _a2.mixed) && runtime.isExpressionReference && !runtime.isExpressionReference(query.datasource)) {
4211
- query.datasource = ds.getRef();
4212
- }
4213
- return query;
4214
- });
4215
- const lowerIntervalLimit = minInterval ? minInterval : ds.interval;
4216
- const norm = data.rangeUtil.calculateInterval(timeRange.state.value, request.maxDataPoints, lowerIntervalLimit);
4217
- request.scopedVars = Object.assign({}, request.scopedVars, {
4218
- __interval: { text: norm.interval, value: norm.interval },
4219
- __interval_ms: { text: norm.intervalMs.toString(), value: norm.intervalMs }
4220
- });
4221
- request.interval = norm.interval;
4222
- request.intervalMs = norm.intervalMs;
4223
- const primaryTimeRange = timeRange.state.value;
4224
- let secondaryRequests = [];
4225
- let secondaryProcessors = /* @__PURE__ */ new Map();
4226
- for (const provider of (_a = this.getClosestExtraQueryProviders()) != null ? _a : []) {
4227
- for (const { req, processor } of provider.getExtraQueries(request)) {
4228
- const requestId = getNextRequestId$1();
4229
- secondaryRequests.push(__spreadProps$l(__spreadValues$x({}, req), { requestId }));
4230
- secondaryProcessors.set(requestId, processor != null ? processor : passthroughProcessor);
4231
- }
4232
- }
4233
- request.range = primaryTimeRange;
4234
- return { primary: request, secondaries: secondaryRequests, processors: secondaryProcessors };
4235
- }
4236
4446
  _combineDataLayers(data) {
4237
4447
  if (this._layerAnnotations && this._layerAnnotations.length > 0) {
4238
4448
  data.annotations = (data.annotations || []).concat(this._layerAnnotations);
@@ -4247,23 +4457,22 @@ class SceneQueryRunner extends SceneObjectBase {
4247
4457
  this.setState({ data: emptyPanelData });
4248
4458
  }
4249
4459
  }
4250
- getClosestExtraQueryProviders() {
4251
- const found = /* @__PURE__ */ new Map();
4460
+ getTimeCompare() {
4252
4461
  if (!this.parent) {
4253
- return [];
4462
+ return null;
4254
4463
  }
4255
- getClosest(this.parent, (s) => {
4256
- if (isExtraQueryProvider(s) && !found.has(s.constructor)) {
4257
- found.set(s.constructor, s);
4464
+ return getClosest(this.parent, (s) => {
4465
+ let found = null;
4466
+ if (s instanceof SceneTimeRangeCompare) {
4467
+ return s;
4258
4468
  }
4259
4469
  s.forEachChild((child) => {
4260
- if (isExtraQueryProvider(child) && !found.has(child.constructor)) {
4261
- found.set(child.constructor, child);
4470
+ if (child instanceof SceneTimeRangeCompare) {
4471
+ found = child;
4262
4472
  }
4263
4473
  });
4264
- return null;
4474
+ return found;
4265
4475
  });
4266
- return Array.from(found.values());
4267
4476
  }
4268
4477
  findAndSubscribeToAdHocFilters(uid) {
4269
4478
  const filtersVar = findActiveAdHocFilterVariableByUid(uid);
@@ -4462,28 +4671,28 @@ class ActWhenVariableChanged extends SceneObjectBase {
4462
4671
  }
4463
4672
  }
4464
4673
 
4465
- var __defProp$w = Object.defineProperty;
4466
- var __defProps$k = Object.defineProperties;
4467
- var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
4468
- var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
4469
- var __hasOwnProp$w = Object.prototype.hasOwnProperty;
4470
- var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
4471
- var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4472
- var __spreadValues$w = (a, b) => {
4674
+ var __defProp$v = Object.defineProperty;
4675
+ var __defProps$j = Object.defineProperties;
4676
+ var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
4677
+ var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
4678
+ var __hasOwnProp$v = Object.prototype.hasOwnProperty;
4679
+ var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
4680
+ var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4681
+ var __spreadValues$v = (a, b) => {
4473
4682
  for (var prop in b || (b = {}))
4474
- if (__hasOwnProp$w.call(b, prop))
4475
- __defNormalProp$w(a, prop, b[prop]);
4476
- if (__getOwnPropSymbols$w)
4477
- for (var prop of __getOwnPropSymbols$w(b)) {
4478
- if (__propIsEnum$w.call(b, prop))
4479
- __defNormalProp$w(a, prop, b[prop]);
4683
+ if (__hasOwnProp$v.call(b, prop))
4684
+ __defNormalProp$v(a, prop, b[prop]);
4685
+ if (__getOwnPropSymbols$v)
4686
+ for (var prop of __getOwnPropSymbols$v(b)) {
4687
+ if (__propIsEnum$v.call(b, prop))
4688
+ __defNormalProp$v(a, prop, b[prop]);
4480
4689
  }
4481
4690
  return a;
4482
4691
  };
4483
- var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
4692
+ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
4484
4693
  class CursorSync extends SceneObjectBase {
4485
4694
  constructor(state) {
4486
- super(__spreadProps$k(__spreadValues$w({}, state), {
4695
+ super(__spreadProps$j(__spreadValues$v({}, state), {
4487
4696
  sync: state.sync || schema.DashboardCursorSync.Off
4488
4697
  }));
4489
4698
  this.getEventsBus = (panel) => {
@@ -4747,25 +4956,25 @@ const getAlertStateStyles = (theme) => {
4747
4956
  };
4748
4957
  };
4749
4958
 
4750
- var __defProp$v = Object.defineProperty;
4751
- var __defProps$j = Object.defineProperties;
4752
- var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
4753
- var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
4754
- var __hasOwnProp$v = Object.prototype.hasOwnProperty;
4755
- var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
4756
- var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4757
- var __spreadValues$v = (a, b) => {
4959
+ var __defProp$u = Object.defineProperty;
4960
+ var __defProps$i = Object.defineProperties;
4961
+ var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
4962
+ var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
4963
+ var __hasOwnProp$u = Object.prototype.hasOwnProperty;
4964
+ var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
4965
+ var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4966
+ var __spreadValues$u = (a, b) => {
4758
4967
  for (var prop in b || (b = {}))
4759
- if (__hasOwnProp$v.call(b, prop))
4760
- __defNormalProp$v(a, prop, b[prop]);
4761
- if (__getOwnPropSymbols$v)
4762
- for (var prop of __getOwnPropSymbols$v(b)) {
4763
- if (__propIsEnum$v.call(b, prop))
4764
- __defNormalProp$v(a, prop, b[prop]);
4968
+ if (__hasOwnProp$u.call(b, prop))
4969
+ __defNormalProp$u(a, prop, b[prop]);
4970
+ if (__getOwnPropSymbols$u)
4971
+ for (var prop of __getOwnPropSymbols$u(b)) {
4972
+ if (__propIsEnum$u.call(b, prop))
4973
+ __defNormalProp$u(a, prop, b[prop]);
4765
4974
  }
4766
4975
  return a;
4767
4976
  };
4768
- var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
4977
+ var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
4769
4978
  const displayOverrideRef = "hideSeriesFrom";
4770
4979
  const isHideSeriesOverride = data.isSystemOverrideWithRef(displayOverrideRef);
4771
4980
  function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
@@ -4775,13 +4984,13 @@ function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
4775
4984
  if (currentIndex < 0) {
4776
4985
  if (mode === ui.SeriesVisibilityChangeMode.ToggleSelection) {
4777
4986
  const override3 = createOverride$1([displayName, ...getNamesOfHiddenFields(overrides, data)]);
4778
- return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
4987
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4779
4988
  overrides: [...fieldConfig.overrides, override3]
4780
4989
  });
4781
4990
  }
4782
4991
  const displayNames = getDisplayNames(data, displayName);
4783
4992
  const override2 = createOverride$1(displayNames);
4784
- return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
4993
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4785
4994
  overrides: [...fieldConfig.overrides, override2]
4786
4995
  });
4787
4996
  }
@@ -4794,22 +5003,22 @@ function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
4794
5003
  existing = existing.filter((el) => nameOfHiddenFields.indexOf(el) < 0);
4795
5004
  }
4796
5005
  if (existing[0] === displayName && existing.length === 1) {
4797
- return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5006
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4798
5007
  overrides: overridesCopy
4799
5008
  });
4800
5009
  }
4801
5010
  const override2 = createOverride$1([displayName, ...nameOfHiddenFields]);
4802
- return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5011
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4803
5012
  overrides: [...overridesCopy, override2]
4804
5013
  });
4805
5014
  }
4806
5015
  const override = createExtendedOverride(current, displayName);
4807
5016
  if (allFieldsAreExcluded(override, data)) {
4808
- return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5017
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4809
5018
  overrides: overridesCopy
4810
5019
  });
4811
5020
  }
4812
- return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5021
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4813
5022
  overrides: [...overridesCopy, override]
4814
5023
  });
4815
5024
  }
@@ -4834,7 +5043,7 @@ function createOverride$1(names, mode = data.ByNamesMatcherMode.exclude, propert
4834
5043
  }
4835
5044
  },
4836
5045
  properties: [
4837
- __spreadProps$j(__spreadValues$v({}, property), {
5046
+ __spreadProps$i(__spreadValues$u({}, property), {
4838
5047
  value: {
4839
5048
  viz: true,
4840
5049
  legend: false,
@@ -4906,32 +5115,32 @@ const getNamesOfHiddenFields = (overrides, data$1) => {
4906
5115
  return names;
4907
5116
  };
4908
5117
 
4909
- var __defProp$u = Object.defineProperty;
4910
- var __defProps$i = Object.defineProperties;
4911
- var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
4912
- var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
4913
- var __hasOwnProp$u = Object.prototype.hasOwnProperty;
4914
- var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
4915
- var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4916
- var __spreadValues$u = (a, b) => {
5118
+ var __defProp$t = Object.defineProperty;
5119
+ var __defProps$h = Object.defineProperties;
5120
+ var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
5121
+ var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
5122
+ var __hasOwnProp$t = Object.prototype.hasOwnProperty;
5123
+ var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
5124
+ var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5125
+ var __spreadValues$t = (a, b) => {
4917
5126
  for (var prop in b || (b = {}))
4918
- if (__hasOwnProp$u.call(b, prop))
4919
- __defNormalProp$u(a, prop, b[prop]);
4920
- if (__getOwnPropSymbols$u)
4921
- for (var prop of __getOwnPropSymbols$u(b)) {
4922
- if (__propIsEnum$u.call(b, prop))
4923
- __defNormalProp$u(a, prop, b[prop]);
5127
+ if (__hasOwnProp$t.call(b, prop))
5128
+ __defNormalProp$t(a, prop, b[prop]);
5129
+ if (__getOwnPropSymbols$t)
5130
+ for (var prop of __getOwnPropSymbols$t(b)) {
5131
+ if (__propIsEnum$t.call(b, prop))
5132
+ __defNormalProp$t(a, prop, b[prop]);
4924
5133
  }
4925
5134
  return a;
4926
5135
  };
4927
- var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
5136
+ var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
4928
5137
  const changeSeriesColorConfigFactory = (label, color, fieldConfig) => {
4929
5138
  const { overrides } = fieldConfig;
4930
5139
  const currentIndex = fieldConfig.overrides.findIndex((override) => {
4931
5140
  return override.matcher.id === data.FieldMatcherID.byName && override.matcher.options === label;
4932
5141
  });
4933
5142
  if (currentIndex < 0) {
4934
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5143
+ return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4935
5144
  overrides: [...fieldConfig.overrides, createOverride(label, color)]
4936
5145
  });
4937
5146
  }
@@ -4939,19 +5148,19 @@ const changeSeriesColorConfigFactory = (label, color, fieldConfig) => {
4939
5148
  const existing = overridesCopy[currentIndex];
4940
5149
  const propertyIndex = existing.properties.findIndex((p) => p.id === "color");
4941
5150
  if (propertyIndex < 0) {
4942
- overridesCopy[currentIndex] = __spreadProps$i(__spreadValues$u({}, existing), {
5151
+ overridesCopy[currentIndex] = __spreadProps$h(__spreadValues$t({}, existing), {
4943
5152
  properties: [...existing.properties, createProperty(color)]
4944
5153
  });
4945
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5154
+ return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4946
5155
  overrides: overridesCopy
4947
5156
  });
4948
5157
  }
4949
5158
  const propertiesCopy = Array.from(existing.properties);
4950
5159
  propertiesCopy[propertyIndex] = createProperty(color);
4951
- overridesCopy[currentIndex] = __spreadProps$i(__spreadValues$u({}, existing), {
5160
+ overridesCopy[currentIndex] = __spreadProps$h(__spreadValues$t({}, existing), {
4952
5161
  properties: propertiesCopy
4953
5162
  });
4954
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5163
+ return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4955
5164
  overrides: overridesCopy
4956
5165
  });
4957
5166
  };
@@ -4974,29 +5183,29 @@ const createProperty = (color) => {
4974
5183
  };
4975
5184
  };
4976
5185
 
4977
- var __defProp$t = Object.defineProperty;
4978
- var __defProps$h = Object.defineProperties;
4979
- var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
4980
- var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
4981
- var __hasOwnProp$t = Object.prototype.hasOwnProperty;
4982
- var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
4983
- var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4984
- var __spreadValues$t = (a, b) => {
5186
+ var __defProp$s = Object.defineProperty;
5187
+ var __defProps$g = Object.defineProperties;
5188
+ var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
5189
+ var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
5190
+ var __hasOwnProp$s = Object.prototype.hasOwnProperty;
5191
+ var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
5192
+ var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5193
+ var __spreadValues$s = (a, b) => {
4985
5194
  for (var prop in b || (b = {}))
4986
- if (__hasOwnProp$t.call(b, prop))
4987
- __defNormalProp$t(a, prop, b[prop]);
4988
- if (__getOwnPropSymbols$t)
4989
- for (var prop of __getOwnPropSymbols$t(b)) {
4990
- if (__propIsEnum$t.call(b, prop))
4991
- __defNormalProp$t(a, prop, b[prop]);
5195
+ if (__hasOwnProp$s.call(b, prop))
5196
+ __defNormalProp$s(a, prop, b[prop]);
5197
+ if (__getOwnPropSymbols$s)
5198
+ for (var prop of __getOwnPropSymbols$s(b)) {
5199
+ if (__propIsEnum$s.call(b, prop))
5200
+ __defNormalProp$s(a, prop, b[prop]);
4992
5201
  }
4993
5202
  return a;
4994
5203
  };
4995
- var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
5204
+ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
4996
5205
  class VizPanel extends SceneObjectBase {
4997
5206
  constructor(state) {
4998
5207
  var _a;
4999
- super(__spreadValues$t({
5208
+ super(__spreadValues$s({
5000
5209
  options: {},
5001
5210
  fieldConfig: { defaults: {}, overrides: [] },
5002
5211
  title: "Title",
@@ -5109,7 +5318,7 @@ class VizPanel extends SceneObjectBase {
5109
5318
  };
5110
5319
  this._onInstanceStateChange = (state) => {
5111
5320
  if (this._panelContext) {
5112
- this._panelContext = __spreadProps$h(__spreadValues$t({}, this._panelContext), {
5321
+ this._panelContext = __spreadProps$g(__spreadValues$s({}, this._panelContext), {
5113
5322
  instanceState: state
5114
5323
  });
5115
5324
  }
@@ -5133,8 +5342,8 @@ class VizPanel extends SceneObjectBase {
5133
5342
  sortBy = sortKey;
5134
5343
  }
5135
5344
  this.onOptionsChange(
5136
- __spreadProps$h(__spreadValues$t({}, this.state.options), {
5137
- legend: __spreadProps$h(__spreadValues$t({}, legendOptions), { sortBy, sortDesc })
5345
+ __spreadProps$g(__spreadValues$s({}, this.state.options), {
5346
+ legend: __spreadProps$g(__spreadValues$s({}, legendOptions), { sortBy, sortDesc })
5138
5347
  }),
5139
5348
  true
5140
5349
  );
@@ -5218,9 +5427,6 @@ class VizPanel extends SceneObjectBase {
5218
5427
  (_a = this._panelContext) != null ? _a : this._panelContext = this.buildPanelContext();
5219
5428
  return this._panelContext;
5220
5429
  }
5221
- clearFieldConfigCache() {
5222
- this._dataWithFieldConfig = void 0;
5223
- }
5224
5430
  applyFieldConfig(rawData) {
5225
5431
  var _a, _b, _c, _d;
5226
5432
  const plugin = this._plugin;
@@ -5244,7 +5450,7 @@ class VizPanel extends SceneObjectBase {
5244
5450
  if (!data.compareArrayValues(newFrames, prevFrames, data.compareDataFrameStructures)) {
5245
5451
  this._structureRev++;
5246
5452
  }
5247
- this._dataWithFieldConfig = __spreadProps$h(__spreadValues$t({}, rawData), {
5453
+ this._dataWithFieldConfig = __spreadProps$g(__spreadValues$s({}, rawData), {
5248
5454
  structureRev: this._structureRev,
5249
5455
  series: newFrames
5250
5456
  });
@@ -5387,25 +5593,25 @@ function getMessageFromError(err) {
5387
5593
  return JSON.stringify(err);
5388
5594
  }
5389
5595
 
5390
- var __defProp$s = Object.defineProperty;
5391
- var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
5392
- var __hasOwnProp$s = Object.prototype.hasOwnProperty;
5393
- var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
5394
- var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5395
- var __spreadValues$s = (a, b) => {
5596
+ var __defProp$r = Object.defineProperty;
5597
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
5598
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
5599
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
5600
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5601
+ var __spreadValues$r = (a, b) => {
5396
5602
  for (var prop in b || (b = {}))
5397
- if (__hasOwnProp$s.call(b, prop))
5398
- __defNormalProp$s(a, prop, b[prop]);
5399
- if (__getOwnPropSymbols$s)
5400
- for (var prop of __getOwnPropSymbols$s(b)) {
5401
- if (__propIsEnum$s.call(b, prop))
5402
- __defNormalProp$s(a, prop, b[prop]);
5603
+ if (__hasOwnProp$r.call(b, prop))
5604
+ __defNormalProp$r(a, prop, b[prop]);
5605
+ if (__getOwnPropSymbols$r)
5606
+ for (var prop of __getOwnPropSymbols$r(b)) {
5607
+ if (__propIsEnum$r.call(b, prop))
5608
+ __defNormalProp$r(a, prop, b[prop]);
5403
5609
  }
5404
5610
  return a;
5405
5611
  };
5406
5612
  class SceneDataLayerBase extends SceneObjectBase {
5407
5613
  constructor(initialState, variableDependencyStatePaths = []) {
5408
- super(__spreadValues$s({
5614
+ super(__spreadValues$r({
5409
5615
  isEnabled: true
5410
5616
  }, initialState));
5411
5617
  this._results = new rxjs.ReplaySubject(1);
@@ -5527,33 +5733,33 @@ function DataLayerControlSwitch({ layer }) {
5527
5733
  }
5528
5734
  const containerStyle$1 = css.css({ display: "flex" });
5529
5735
 
5530
- var __defProp$r = Object.defineProperty;
5531
- var __defProps$g = Object.defineProperties;
5532
- var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
5533
- var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
5534
- var __hasOwnProp$r = Object.prototype.hasOwnProperty;
5535
- var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
5536
- var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5537
- var __spreadValues$r = (a, b) => {
5736
+ var __defProp$q = Object.defineProperty;
5737
+ var __defProps$f = Object.defineProperties;
5738
+ var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
5739
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
5740
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
5741
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
5742
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5743
+ var __spreadValues$q = (a, b) => {
5538
5744
  for (var prop in b || (b = {}))
5539
- if (__hasOwnProp$r.call(b, prop))
5540
- __defNormalProp$r(a, prop, b[prop]);
5541
- if (__getOwnPropSymbols$r)
5542
- for (var prop of __getOwnPropSymbols$r(b)) {
5543
- if (__propIsEnum$r.call(b, prop))
5544
- __defNormalProp$r(a, prop, b[prop]);
5745
+ if (__hasOwnProp$q.call(b, prop))
5746
+ __defNormalProp$q(a, prop, b[prop]);
5747
+ if (__getOwnPropSymbols$q)
5748
+ for (var prop of __getOwnPropSymbols$q(b)) {
5749
+ if (__propIsEnum$q.call(b, prop))
5750
+ __defNormalProp$q(a, prop, b[prop]);
5545
5751
  }
5546
5752
  return a;
5547
5753
  };
5548
- var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
5754
+ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
5549
5755
  var __objRest$2 = (source, exclude) => {
5550
5756
  var target = {};
5551
5757
  for (var prop in source)
5552
- if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
5758
+ if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
5553
5759
  target[prop] = source[prop];
5554
- if (source != null && __getOwnPropSymbols$r)
5555
- for (var prop of __getOwnPropSymbols$r(source)) {
5556
- if (exclude.indexOf(prop) < 0 && __propIsEnum$r.call(source, prop))
5760
+ if (source != null && __getOwnPropSymbols$q)
5761
+ for (var prop of __getOwnPropSymbols$q(source)) {
5762
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$q.call(source, prop))
5557
5763
  target[prop] = source[prop];
5558
5764
  }
5559
5765
  return target;
@@ -5562,7 +5768,7 @@ const standardAnnotationSupport = {
5562
5768
  prepareAnnotation: (json) => {
5563
5769
  if (lodash.isString(json == null ? void 0 : json.query)) {
5564
5770
  const _a = json, { query } = _a, rest = __objRest$2(_a, ["query"]);
5565
- return __spreadProps$g(__spreadValues$r({}, rest), {
5771
+ return __spreadProps$f(__spreadValues$q({}, rest), {
5566
5772
  target: {
5567
5773
  refId: "annotation_query",
5568
5774
  query
@@ -5730,25 +5936,25 @@ function shouldUseLegacyRunner(datasource) {
5730
5936
  return !datasource.annotations || legacyRunner.includes(type);
5731
5937
  }
5732
5938
 
5733
- var __defProp$q = Object.defineProperty;
5734
- var __defProps$f = Object.defineProperties;
5735
- var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
5736
- var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
5737
- var __hasOwnProp$q = Object.prototype.hasOwnProperty;
5738
- var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
5739
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5740
- var __spreadValues$q = (a, b) => {
5939
+ var __defProp$p = Object.defineProperty;
5940
+ var __defProps$e = Object.defineProperties;
5941
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
5942
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
5943
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
5944
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
5945
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5946
+ var __spreadValues$p = (a, b) => {
5741
5947
  for (var prop in b || (b = {}))
5742
- if (__hasOwnProp$q.call(b, prop))
5743
- __defNormalProp$q(a, prop, b[prop]);
5744
- if (__getOwnPropSymbols$q)
5745
- for (var prop of __getOwnPropSymbols$q(b)) {
5746
- if (__propIsEnum$q.call(b, prop))
5747
- __defNormalProp$q(a, prop, b[prop]);
5948
+ if (__hasOwnProp$p.call(b, prop))
5949
+ __defNormalProp$p(a, prop, b[prop]);
5950
+ if (__getOwnPropSymbols$p)
5951
+ for (var prop of __getOwnPropSymbols$p(b)) {
5952
+ if (__propIsEnum$p.call(b, prop))
5953
+ __defNormalProp$p(a, prop, b[prop]);
5748
5954
  }
5749
5955
  return a;
5750
5956
  };
5751
- var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
5957
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
5752
5958
  let counter = 100;
5753
5959
  function getNextRequestId() {
5754
5960
  return "AQ" + counter++;
@@ -5771,8 +5977,8 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
5771
5977
  }))
5772
5978
  );
5773
5979
  }
5774
- const processor = __spreadValues$q(__spreadValues$q({}, standardAnnotationSupport), datasource.annotations);
5775
- const annotationWithDefaults = __spreadValues$q(__spreadValues$q({}, (_a = processor.getDefaultQuery) == null ? void 0 : _a.call(processor)), query);
5980
+ const processor = __spreadValues$p(__spreadValues$p({}, standardAnnotationSupport), datasource.annotations);
5981
+ const annotationWithDefaults = __spreadValues$p(__spreadValues$p({}, (_a = processor.getDefaultQuery) == null ? void 0 : _a.call(processor)), query);
5776
5982
  const annotation = processor.prepareAnnotation(annotationWithDefaults);
5777
5983
  if (!annotation) {
5778
5984
  return rxjs.of({
@@ -5795,7 +6001,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
5795
6001
  __annotation: { text: annotation.name, value: annotation },
5796
6002
  __sceneObject: { text: "__sceneObject", value: layer }
5797
6003
  };
5798
- const queryRequest = __spreadValues$q(__spreadProps$f(__spreadValues$q({
6004
+ const queryRequest = __spreadValues$p(__spreadProps$e(__spreadValues$p({
5799
6005
  startTime: Date.now(),
5800
6006
  requestId: getNextRequestId(),
5801
6007
  range: timeRange.state.value,
@@ -5805,7 +6011,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
5805
6011
  app: data.CoreApp.Dashboard,
5806
6012
  timezone: timeRange.getTimeZone(),
5807
6013
  targets: [
5808
- __spreadProps$f(__spreadValues$q({}, processedQuery), {
6014
+ __spreadProps$e(__spreadValues$p({}, processedQuery), {
5809
6015
  refId: "Anno"
5810
6016
  })
5811
6017
  ]
@@ -5823,7 +6029,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
5823
6029
  data$1.forEach((frame) => {
5824
6030
  var _a2;
5825
6031
  if (!((_a2 = frame.meta) == null ? void 0 : _a2.dataTopic)) {
5826
- frame.meta = __spreadProps$f(__spreadValues$q({}, frame.meta || {}), { dataTopic: data.DataTopic.Annotations });
6032
+ frame.meta = __spreadProps$e(__spreadValues$p({}, frame.meta || {}), { dataTopic: data.DataTopic.Annotations });
5827
6033
  }
5828
6034
  });
5829
6035
  return processor.processEvents(annotation, data$1).pipe(
@@ -5838,19 +6044,19 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
5838
6044
  );
5839
6045
  }
5840
6046
 
5841
- var __defProp$p = Object.defineProperty;
5842
- var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
5843
- var __hasOwnProp$p = Object.prototype.hasOwnProperty;
5844
- var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
5845
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5846
- var __spreadValues$p = (a, b) => {
6047
+ var __defProp$o = Object.defineProperty;
6048
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
6049
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
6050
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
6051
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6052
+ var __spreadValues$o = (a, b) => {
5847
6053
  for (var prop in b || (b = {}))
5848
- if (__hasOwnProp$p.call(b, prop))
5849
- __defNormalProp$p(a, prop, b[prop]);
5850
- if (__getOwnPropSymbols$p)
5851
- for (var prop of __getOwnPropSymbols$p(b)) {
5852
- if (__propIsEnum$p.call(b, prop))
5853
- __defNormalProp$p(a, prop, b[prop]);
6054
+ if (__hasOwnProp$o.call(b, prop))
6055
+ __defNormalProp$o(a, prop, b[prop]);
6056
+ if (__getOwnPropSymbols$o)
6057
+ for (var prop of __getOwnPropSymbols$o(b)) {
6058
+ if (__propIsEnum$o.call(b, prop))
6059
+ __defNormalProp$o(a, prop, b[prop]);
5854
6060
  }
5855
6061
  return a;
5856
6062
  };
@@ -5861,7 +6067,7 @@ function postProcessQueryResult(annotation, results) {
5861
6067
  }
5862
6068
  const processed = results.map((item) => {
5863
6069
  var _a;
5864
- const processedItem = __spreadValues$p({}, item);
6070
+ const processedItem = __spreadValues$o({}, item);
5865
6071
  processedItem.source = annotation;
5866
6072
  processedItem.color = runtime.config.theme2.visualization.getColorByName(annotation.iconColor);
5867
6073
  processedItem.type = annotation.name;
@@ -5910,29 +6116,29 @@ function isPanelAlert(event) {
5910
6116
  return event.eventType === "panel-alert";
5911
6117
  }
5912
6118
 
5913
- var __defProp$o = Object.defineProperty;
5914
- var __defProps$e = Object.defineProperties;
5915
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
5916
- var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
5917
- var __hasOwnProp$o = Object.prototype.hasOwnProperty;
5918
- var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
5919
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5920
- var __spreadValues$o = (a, b) => {
6119
+ var __defProp$n = Object.defineProperty;
6120
+ var __defProps$d = Object.defineProperties;
6121
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
6122
+ var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
6123
+ var __hasOwnProp$n = Object.prototype.hasOwnProperty;
6124
+ var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
6125
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6126
+ var __spreadValues$n = (a, b) => {
5921
6127
  for (var prop in b || (b = {}))
5922
- if (__hasOwnProp$o.call(b, prop))
5923
- __defNormalProp$o(a, prop, b[prop]);
5924
- if (__getOwnPropSymbols$o)
5925
- for (var prop of __getOwnPropSymbols$o(b)) {
5926
- if (__propIsEnum$o.call(b, prop))
5927
- __defNormalProp$o(a, prop, b[prop]);
6128
+ if (__hasOwnProp$n.call(b, prop))
6129
+ __defNormalProp$n(a, prop, b[prop]);
6130
+ if (__getOwnPropSymbols$n)
6131
+ for (var prop of __getOwnPropSymbols$n(b)) {
6132
+ if (__propIsEnum$n.call(b, prop))
6133
+ __defNormalProp$n(a, prop, b[prop]);
5928
6134
  }
5929
6135
  return a;
5930
6136
  };
5931
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
6137
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
5932
6138
  class AnnotationsDataLayer extends SceneDataLayerBase {
5933
6139
  constructor(initialState) {
5934
6140
  super(
5935
- __spreadValues$o({
6141
+ __spreadValues$n({
5936
6142
  isEnabled: true
5937
6143
  }, initialState),
5938
6144
  ["query"]
@@ -5980,7 +6186,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
5980
6186
  this.publishResults(stateUpdate);
5981
6187
  });
5982
6188
  } catch (e) {
5983
- this.publishResults(__spreadProps$e(__spreadValues$o({}, emptyPanelData), {
6189
+ this.publishResults(__spreadProps$d(__spreadValues$n({}, emptyPanelData), {
5984
6190
  state: schema.LoadingState.Error,
5985
6191
  errors: [
5986
6192
  {
@@ -5997,9 +6203,9 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
5997
6203
  processEvents(query, events) {
5998
6204
  let processedEvents = postProcessQueryResult(query, events.events || []);
5999
6205
  processedEvents = dedupAnnotations(processedEvents);
6000
- const stateUpdate = __spreadProps$e(__spreadValues$o({}, emptyPanelData), { state: events.state });
6206
+ const stateUpdate = __spreadProps$d(__spreadValues$n({}, emptyPanelData), { state: events.state });
6001
6207
  const df = data.arrayToDataFrame(processedEvents);
6002
- df.meta = __spreadProps$e(__spreadValues$o({}, df.meta), {
6208
+ df.meta = __spreadProps$d(__spreadValues$n({}, df.meta), {
6003
6209
  dataTopic: data.DataTopic.Annotations
6004
6210
  });
6005
6211
  stateUpdate.series = [df];
@@ -6052,28 +6258,28 @@ class SceneTimeRangeTransformerBase extends SceneObjectBase {
6052
6258
  }
6053
6259
  }
6054
6260
 
6055
- var __defProp$n = Object.defineProperty;
6056
- var __defProps$d = Object.defineProperties;
6057
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
6058
- var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
6059
- var __hasOwnProp$n = Object.prototype.hasOwnProperty;
6060
- var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
6061
- var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6062
- var __spreadValues$n = (a, b) => {
6261
+ var __defProp$m = Object.defineProperty;
6262
+ var __defProps$c = Object.defineProperties;
6263
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
6264
+ var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
6265
+ var __hasOwnProp$m = Object.prototype.hasOwnProperty;
6266
+ var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
6267
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6268
+ var __spreadValues$m = (a, b) => {
6063
6269
  for (var prop in b || (b = {}))
6064
- if (__hasOwnProp$n.call(b, prop))
6065
- __defNormalProp$n(a, prop, b[prop]);
6066
- if (__getOwnPropSymbols$n)
6067
- for (var prop of __getOwnPropSymbols$n(b)) {
6068
- if (__propIsEnum$n.call(b, prop))
6069
- __defNormalProp$n(a, prop, b[prop]);
6270
+ if (__hasOwnProp$m.call(b, prop))
6271
+ __defNormalProp$m(a, prop, b[prop]);
6272
+ if (__getOwnPropSymbols$m)
6273
+ for (var prop of __getOwnPropSymbols$m(b)) {
6274
+ if (__propIsEnum$m.call(b, prop))
6275
+ __defNormalProp$m(a, prop, b[prop]);
6070
6276
  }
6071
6277
  return a;
6072
6278
  };
6073
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
6279
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
6074
6280
  class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6075
6281
  constructor(state) {
6076
- super(__spreadProps$d(__spreadValues$n({}, state), {
6282
+ super(__spreadProps$c(__spreadValues$m({}, state), {
6077
6283
  timeZone: state.timeZone,
6078
6284
  from: "now-6h",
6079
6285
  to: "now",
@@ -6081,7 +6287,7 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6081
6287
  }));
6082
6288
  }
6083
6289
  ancestorTimeRangeChanged(timeRange) {
6084
- this.setState(__spreadProps$d(__spreadValues$n({}, timeRange), {
6290
+ this.setState(__spreadProps$c(__spreadValues$m({}, timeRange), {
6085
6291
  timeZone: this.state.timeZone,
6086
6292
  value: evaluateTimeRange(
6087
6293
  timeRange.from,
@@ -6109,25 +6315,25 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6109
6315
  }
6110
6316
  }
6111
6317
 
6112
- var __defProp$m = Object.defineProperty;
6113
- var __defProps$c = Object.defineProperties;
6114
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
6115
- var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
6116
- var __hasOwnProp$m = Object.prototype.hasOwnProperty;
6117
- var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
6118
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6119
- var __spreadValues$m = (a, b) => {
6318
+ var __defProp$l = Object.defineProperty;
6319
+ var __defProps$b = Object.defineProperties;
6320
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
6321
+ var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
6322
+ var __hasOwnProp$l = Object.prototype.hasOwnProperty;
6323
+ var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
6324
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6325
+ var __spreadValues$l = (a, b) => {
6120
6326
  for (var prop in b || (b = {}))
6121
- if (__hasOwnProp$m.call(b, prop))
6122
- __defNormalProp$m(a, prop, b[prop]);
6123
- if (__getOwnPropSymbols$m)
6124
- for (var prop of __getOwnPropSymbols$m(b)) {
6125
- if (__propIsEnum$m.call(b, prop))
6126
- __defNormalProp$m(a, prop, b[prop]);
6327
+ if (__hasOwnProp$l.call(b, prop))
6328
+ __defNormalProp$l(a, prop, b[prop]);
6329
+ if (__getOwnPropSymbols$l)
6330
+ for (var prop of __getOwnPropSymbols$l(b)) {
6331
+ if (__propIsEnum$l.call(b, prop))
6332
+ __defNormalProp$l(a, prop, b[prop]);
6127
6333
  }
6128
6334
  return a;
6129
6335
  };
6130
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
6336
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
6131
6337
  class SceneDataLayerSetBase extends SceneObjectBase {
6132
6338
  constructor() {
6133
6339
  super(...arguments);
@@ -6151,7 +6357,7 @@ class SceneDataLayerSetBase extends SceneObjectBase {
6151
6357
  series = series.concat(result.data.series);
6152
6358
  }
6153
6359
  }
6154
- const combinedData = __spreadProps$c(__spreadValues$m({}, emptyPanelData), { series });
6360
+ const combinedData = __spreadProps$b(__spreadValues$l({}, emptyPanelData), { series });
6155
6361
  this._results.next({ origin: this, data: combinedData });
6156
6362
  this.setStateHelper({ data: combinedData });
6157
6363
  }
@@ -6200,25 +6406,25 @@ SceneDataLayerSet.Component = ({ model }) => {
6200
6406
  })));
6201
6407
  };
6202
6408
 
6203
- var __defProp$l = Object.defineProperty;
6204
- var __defProps$b = Object.defineProperties;
6205
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
6206
- var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
6207
- var __hasOwnProp$l = Object.prototype.hasOwnProperty;
6208
- var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
6209
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6210
- var __spreadValues$l = (a, b) => {
6409
+ var __defProp$k = Object.defineProperty;
6410
+ var __defProps$a = Object.defineProperties;
6411
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
6412
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
6413
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
6414
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
6415
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6416
+ var __spreadValues$k = (a, b) => {
6211
6417
  for (var prop in b || (b = {}))
6212
- if (__hasOwnProp$l.call(b, prop))
6213
- __defNormalProp$l(a, prop, b[prop]);
6214
- if (__getOwnPropSymbols$l)
6215
- for (var prop of __getOwnPropSymbols$l(b)) {
6216
- if (__propIsEnum$l.call(b, prop))
6217
- __defNormalProp$l(a, prop, b[prop]);
6418
+ if (__hasOwnProp$k.call(b, prop))
6419
+ __defNormalProp$k(a, prop, b[prop]);
6420
+ if (__getOwnPropSymbols$k)
6421
+ for (var prop of __getOwnPropSymbols$k(b)) {
6422
+ if (__propIsEnum$k.call(b, prop))
6423
+ __defNormalProp$k(a, prop, b[prop]);
6218
6424
  }
6219
6425
  return a;
6220
6426
  };
6221
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
6427
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
6222
6428
  class SceneDataTransformer extends SceneObjectBase {
6223
6429
  constructor(state) {
6224
6430
  super(state);
@@ -6295,7 +6501,7 @@ class SceneDataTransformer extends SceneObjectBase {
6295
6501
  const { series, annotations } = this._prevDataFromSource;
6296
6502
  if (data.series === series && data.annotations === annotations) {
6297
6503
  if (this.state.data && data.state !== this.state.data.state) {
6298
- this.setState({ data: __spreadProps$b(__spreadValues$l({}, this.state.data), { state: data.state }) });
6504
+ this.setState({ data: __spreadProps$a(__spreadValues$k({}, this.state.data), { state: data.state }) });
6299
6505
  }
6300
6506
  return true;
6301
6507
  }
@@ -6343,7 +6549,7 @@ class SceneDataTransformer extends SceneObjectBase {
6343
6549
  rxjs.map((values) => {
6344
6550
  const transformedSeries = values[0];
6345
6551
  const transformedAnnotations = values[1];
6346
- return __spreadProps$b(__spreadValues$l({}, data$1), {
6552
+ return __spreadProps$a(__spreadValues$k({}, data$1), {
6347
6553
  series: transformedSeries,
6348
6554
  annotations: transformedAnnotations != null ? transformedAnnotations : data$1.annotations
6349
6555
  });
@@ -6354,7 +6560,7 @@ class SceneDataTransformer extends SceneObjectBase {
6354
6560
  const sourceErr = ((_a2 = this.getSourceData().state.data) == null ? void 0 : _a2.errors) || [];
6355
6561
  const transformationError = runtime.toDataQueryError(err);
6356
6562
  transformationError.message = `Error transforming data: ${transformationError.message}`;
6357
- const result = __spreadProps$b(__spreadValues$l({}, data$1), {
6563
+ const result = __spreadProps$a(__spreadValues$k({}, data$1), {
6358
6564
  state: data.LoadingState.Error,
6359
6565
  errors: [...sourceErr, transformationError]
6360
6566
  });
@@ -6687,28 +6893,28 @@ class SceneVariableSetVariableDependencyHandler {
6687
6893
  }
6688
6894
  }
6689
6895
 
6690
- var __defProp$k = Object.defineProperty;
6691
- var __defProps$a = Object.defineProperties;
6692
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
6693
- var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
6694
- var __hasOwnProp$k = Object.prototype.hasOwnProperty;
6695
- var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
6696
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6697
- var __spreadValues$k = (a, b) => {
6698
- for (var prop in b || (b = {}))
6699
- if (__hasOwnProp$k.call(b, prop))
6700
- __defNormalProp$k(a, prop, b[prop]);
6701
- if (__getOwnPropSymbols$k)
6702
- for (var prop of __getOwnPropSymbols$k(b)) {
6703
- if (__propIsEnum$k.call(b, prop))
6704
- __defNormalProp$k(a, prop, b[prop]);
6896
+ var __defProp$j = Object.defineProperty;
6897
+ var __defProps$9 = Object.defineProperties;
6898
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
6899
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
6900
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
6901
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
6902
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6903
+ var __spreadValues$j = (a, b) => {
6904
+ for (var prop in b || (b = {}))
6905
+ if (__hasOwnProp$j.call(b, prop))
6906
+ __defNormalProp$j(a, prop, b[prop]);
6907
+ if (__getOwnPropSymbols$j)
6908
+ for (var prop of __getOwnPropSymbols$j(b)) {
6909
+ if (__propIsEnum$j.call(b, prop))
6910
+ __defNormalProp$j(a, prop, b[prop]);
6705
6911
  }
6706
6912
  return a;
6707
6913
  };
6708
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
6914
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
6709
6915
  class ConstantVariable extends SceneObjectBase {
6710
6916
  constructor(initialState) {
6711
- super(__spreadProps$a(__spreadValues$k({
6917
+ super(__spreadProps$9(__spreadValues$j({
6712
6918
  type: "constant",
6713
6919
  value: "",
6714
6920
  name: ""
@@ -6721,25 +6927,25 @@ class ConstantVariable extends SceneObjectBase {
6721
6927
  }
6722
6928
  }
6723
6929
 
6724
- var __defProp$j = Object.defineProperty;
6725
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
6726
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
6727
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
6728
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6729
- var __spreadValues$j = (a, b) => {
6930
+ var __defProp$i = Object.defineProperty;
6931
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6932
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
6933
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
6934
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6935
+ var __spreadValues$i = (a, b) => {
6730
6936
  for (var prop in b || (b = {}))
6731
- if (__hasOwnProp$j.call(b, prop))
6732
- __defNormalProp$j(a, prop, b[prop]);
6733
- if (__getOwnPropSymbols$j)
6734
- for (var prop of __getOwnPropSymbols$j(b)) {
6735
- if (__propIsEnum$j.call(b, prop))
6736
- __defNormalProp$j(a, prop, b[prop]);
6937
+ if (__hasOwnProp$i.call(b, prop))
6938
+ __defNormalProp$i(a, prop, b[prop]);
6939
+ if (__getOwnPropSymbols$i)
6940
+ for (var prop of __getOwnPropSymbols$i(b)) {
6941
+ if (__propIsEnum$i.call(b, prop))
6942
+ __defNormalProp$i(a, prop, b[prop]);
6737
6943
  }
6738
6944
  return a;
6739
6945
  };
6740
6946
  class CustomVariable extends MultiValueVariable {
6741
6947
  constructor(initialState) {
6742
- super(__spreadValues$j({
6948
+ super(__spreadValues$i({
6743
6949
  type: "custom",
6744
6950
  query: "",
6745
6951
  value: "",
@@ -6773,25 +6979,25 @@ CustomVariable.Component = ({ model }) => {
6773
6979
  return renderSelectForVariable(model);
6774
6980
  };
6775
6981
 
6776
- var __defProp$i = Object.defineProperty;
6777
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6778
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
6779
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
6780
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6781
- var __spreadValues$i = (a, b) => {
6982
+ var __defProp$h = Object.defineProperty;
6983
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
6984
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
6985
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
6986
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6987
+ var __spreadValues$h = (a, b) => {
6782
6988
  for (var prop in b || (b = {}))
6783
- if (__hasOwnProp$i.call(b, prop))
6784
- __defNormalProp$i(a, prop, b[prop]);
6785
- if (__getOwnPropSymbols$i)
6786
- for (var prop of __getOwnPropSymbols$i(b)) {
6787
- if (__propIsEnum$i.call(b, prop))
6788
- __defNormalProp$i(a, prop, b[prop]);
6989
+ if (__hasOwnProp$h.call(b, prop))
6990
+ __defNormalProp$h(a, prop, b[prop]);
6991
+ if (__getOwnPropSymbols$h)
6992
+ for (var prop of __getOwnPropSymbols$h(b)) {
6993
+ if (__propIsEnum$h.call(b, prop))
6994
+ __defNormalProp$h(a, prop, b[prop]);
6789
6995
  }
6790
6996
  return a;
6791
6997
  };
6792
6998
  class DataSourceVariable extends MultiValueVariable {
6793
6999
  constructor(initialState) {
6794
- super(__spreadValues$i({
7000
+ super(__spreadValues$h({
6795
7001
  type: "datasource",
6796
7002
  value: "",
6797
7003
  text: "",
@@ -6875,25 +7081,25 @@ const hasCustomVariableSupport = (datasource) => {
6875
7081
  return "query" in variableSupport && "editor" in variableSupport && Boolean(variableSupport.query) && Boolean(variableSupport.editor);
6876
7082
  };
6877
7083
 
6878
- var __defProp$h = Object.defineProperty;
6879
- var __defProps$9 = Object.defineProperties;
6880
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
6881
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
6882
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
6883
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
6884
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6885
- var __spreadValues$h = (a, b) => {
7084
+ var __defProp$g = Object.defineProperty;
7085
+ var __defProps$8 = Object.defineProperties;
7086
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
7087
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
7088
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
7089
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
7090
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7091
+ var __spreadValues$g = (a, b) => {
6886
7092
  for (var prop in b || (b = {}))
6887
- if (__hasOwnProp$h.call(b, prop))
6888
- __defNormalProp$h(a, prop, b[prop]);
6889
- if (__getOwnPropSymbols$h)
6890
- for (var prop of __getOwnPropSymbols$h(b)) {
6891
- if (__propIsEnum$h.call(b, prop))
6892
- __defNormalProp$h(a, prop, b[prop]);
7093
+ if (__hasOwnProp$g.call(b, prop))
7094
+ __defNormalProp$g(a, prop, b[prop]);
7095
+ if (__getOwnPropSymbols$g)
7096
+ for (var prop of __getOwnPropSymbols$g(b)) {
7097
+ if (__propIsEnum$g.call(b, prop))
7098
+ __defNormalProp$g(a, prop, b[prop]);
6893
7099
  }
6894
7100
  return a;
6895
7101
  };
6896
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
7102
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
6897
7103
  class StandardQueryRunner {
6898
7104
  constructor(datasource, _runRequest = runtime.getRunRequest()) {
6899
7105
  this.datasource = datasource;
@@ -6930,7 +7136,7 @@ class LegacyQueryRunner {
6930
7136
  return getEmptyMetricFindValueObservable();
6931
7137
  }
6932
7138
  return rxjs.from(
6933
- this.datasource.metricFindQuery(variable.state.query, __spreadProps$9(__spreadValues$h({}, request), {
7139
+ this.datasource.metricFindQuery(variable.state.query, __spreadProps$8(__spreadValues$g({}, request), {
6934
7140
  variable: {
6935
7141
  name: variable.state.name,
6936
7142
  type: variable.state.type
@@ -6992,7 +7198,7 @@ function ensureVariableQueryModelIsADataQuery(variable) {
6992
7198
  return { query, refId: `variable-${variable.state.name}` };
6993
7199
  }
6994
7200
  if (query.refId == null) {
6995
- return __spreadProps$9(__spreadValues$h({}, query), { refId: `variable-${variable.state.name}` });
7201
+ return __spreadProps$8(__spreadValues$g({}, query), { refId: `variable-${variable.state.name}` });
6996
7202
  }
6997
7203
  return variable.state.query;
6998
7204
  }
@@ -7207,25 +7413,25 @@ function areMetricFindValues(data$1) {
7207
7413
  return false;
7208
7414
  }
7209
7415
 
7210
- var __defProp$g = Object.defineProperty;
7211
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
7212
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
7213
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
7214
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7215
- var __spreadValues$g = (a, b) => {
7416
+ var __defProp$f = Object.defineProperty;
7417
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
7418
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
7419
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
7420
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7421
+ var __spreadValues$f = (a, b) => {
7216
7422
  for (var prop in b || (b = {}))
7217
- if (__hasOwnProp$g.call(b, prop))
7218
- __defNormalProp$g(a, prop, b[prop]);
7219
- if (__getOwnPropSymbols$g)
7220
- for (var prop of __getOwnPropSymbols$g(b)) {
7221
- if (__propIsEnum$g.call(b, prop))
7222
- __defNormalProp$g(a, prop, b[prop]);
7423
+ if (__hasOwnProp$f.call(b, prop))
7424
+ __defNormalProp$f(a, prop, b[prop]);
7425
+ if (__getOwnPropSymbols$f)
7426
+ for (var prop of __getOwnPropSymbols$f(b)) {
7427
+ if (__propIsEnum$f.call(b, prop))
7428
+ __defNormalProp$f(a, prop, b[prop]);
7223
7429
  }
7224
7430
  return a;
7225
7431
  };
7226
7432
  class QueryVariable extends MultiValueVariable {
7227
7433
  constructor(initialState) {
7228
- super(__spreadValues$g({
7434
+ super(__spreadValues$f({
7229
7435
  type: "query",
7230
7436
  name: "",
7231
7437
  value: "",
@@ -7378,25 +7584,25 @@ function queryMetricTree(query) {
7378
7584
  return queryTree(children, query.split("."), 0);
7379
7585
  }
7380
7586
 
7381
- var __defProp$f = Object.defineProperty;
7382
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
7383
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
7384
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
7385
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7386
- var __spreadValues$f = (a, b) => {
7587
+ var __defProp$e = Object.defineProperty;
7588
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
7589
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
7590
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
7591
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7592
+ var __spreadValues$e = (a, b) => {
7387
7593
  for (var prop in b || (b = {}))
7388
- if (__hasOwnProp$f.call(b, prop))
7389
- __defNormalProp$f(a, prop, b[prop]);
7390
- if (__getOwnPropSymbols$f)
7391
- for (var prop of __getOwnPropSymbols$f(b)) {
7392
- if (__propIsEnum$f.call(b, prop))
7393
- __defNormalProp$f(a, prop, b[prop]);
7594
+ if (__hasOwnProp$e.call(b, prop))
7595
+ __defNormalProp$e(a, prop, b[prop]);
7596
+ if (__getOwnPropSymbols$e)
7597
+ for (var prop of __getOwnPropSymbols$e(b)) {
7598
+ if (__propIsEnum$e.call(b, prop))
7599
+ __defNormalProp$e(a, prop, b[prop]);
7394
7600
  }
7395
7601
  return a;
7396
7602
  };
7397
7603
  class TestVariable extends MultiValueVariable {
7398
7604
  constructor(initialState, isLazy = false) {
7399
- super(__spreadValues$f({
7605
+ super(__spreadValues$e({
7400
7606
  type: "custom",
7401
7607
  name: "Test",
7402
7608
  value: "Value",
@@ -7505,25 +7711,25 @@ function VariableValueInput({ model }) {
7505
7711
  });
7506
7712
  }
7507
7713
 
7508
- var __defProp$e = Object.defineProperty;
7509
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
7510
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
7511
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
7512
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7513
- var __spreadValues$e = (a, b) => {
7714
+ var __defProp$d = Object.defineProperty;
7715
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
7716
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
7717
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
7718
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7719
+ var __spreadValues$d = (a, b) => {
7514
7720
  for (var prop in b || (b = {}))
7515
- if (__hasOwnProp$e.call(b, prop))
7516
- __defNormalProp$e(a, prop, b[prop]);
7517
- if (__getOwnPropSymbols$e)
7518
- for (var prop of __getOwnPropSymbols$e(b)) {
7519
- if (__propIsEnum$e.call(b, prop))
7520
- __defNormalProp$e(a, prop, b[prop]);
7721
+ if (__hasOwnProp$d.call(b, prop))
7722
+ __defNormalProp$d(a, prop, b[prop]);
7723
+ if (__getOwnPropSymbols$d)
7724
+ for (var prop of __getOwnPropSymbols$d(b)) {
7725
+ if (__propIsEnum$d.call(b, prop))
7726
+ __defNormalProp$d(a, prop, b[prop]);
7521
7727
  }
7522
7728
  return a;
7523
7729
  };
7524
7730
  class TextBoxVariable extends SceneObjectBase {
7525
7731
  constructor(initialState) {
7526
- super(__spreadValues$e({
7732
+ super(__spreadValues$d({
7527
7733
  type: "textbox",
7528
7734
  value: "",
7529
7735
  name: ""
@@ -7560,28 +7766,28 @@ TextBoxVariable.Component = ({ model }) => {
7560
7766
  });
7561
7767
  };
7562
7768
 
7563
- var __defProp$d = Object.defineProperty;
7564
- var __defProps$8 = Object.defineProperties;
7565
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
7566
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
7567
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
7568
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
7569
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7570
- var __spreadValues$d = (a, b) => {
7769
+ var __defProp$c = Object.defineProperty;
7770
+ var __defProps$7 = Object.defineProperties;
7771
+ var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
7772
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7773
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7774
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7775
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7776
+ var __spreadValues$c = (a, b) => {
7571
7777
  for (var prop in b || (b = {}))
7572
- if (__hasOwnProp$d.call(b, prop))
7573
- __defNormalProp$d(a, prop, b[prop]);
7574
- if (__getOwnPropSymbols$d)
7575
- for (var prop of __getOwnPropSymbols$d(b)) {
7576
- if (__propIsEnum$d.call(b, prop))
7577
- __defNormalProp$d(a, prop, b[prop]);
7778
+ if (__hasOwnProp$c.call(b, prop))
7779
+ __defNormalProp$c(a, prop, b[prop]);
7780
+ if (__getOwnPropSymbols$c)
7781
+ for (var prop of __getOwnPropSymbols$c(b)) {
7782
+ if (__propIsEnum$c.call(b, prop))
7783
+ __defNormalProp$c(a, prop, b[prop]);
7578
7784
  }
7579
7785
  return a;
7580
7786
  };
7581
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
7787
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
7582
7788
  class LocalValueVariable extends SceneObjectBase {
7583
7789
  constructor(initialState) {
7584
- super(__spreadProps$8(__spreadValues$d({
7790
+ super(__spreadProps$7(__spreadValues$c({
7585
7791
  type: "system",
7586
7792
  value: "",
7587
7793
  text: "",
@@ -7613,25 +7819,25 @@ class LocalValueVariable extends SceneObjectBase {
7613
7819
  }
7614
7820
  }
7615
7821
 
7616
- var __defProp$c = Object.defineProperty;
7617
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7618
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7619
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7620
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7621
- var __spreadValues$c = (a, b) => {
7822
+ var __defProp$b = Object.defineProperty;
7823
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7824
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
7825
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
7826
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7827
+ var __spreadValues$b = (a, b) => {
7622
7828
  for (var prop in b || (b = {}))
7623
- if (__hasOwnProp$c.call(b, prop))
7624
- __defNormalProp$c(a, prop, b[prop]);
7625
- if (__getOwnPropSymbols$c)
7626
- for (var prop of __getOwnPropSymbols$c(b)) {
7627
- if (__propIsEnum$c.call(b, prop))
7628
- __defNormalProp$c(a, prop, b[prop]);
7829
+ if (__hasOwnProp$b.call(b, prop))
7830
+ __defNormalProp$b(a, prop, b[prop]);
7831
+ if (__getOwnPropSymbols$b)
7832
+ for (var prop of __getOwnPropSymbols$b(b)) {
7833
+ if (__propIsEnum$b.call(b, prop))
7834
+ __defNormalProp$b(a, prop, b[prop]);
7629
7835
  }
7630
7836
  return a;
7631
7837
  };
7632
7838
  class IntervalVariable extends SceneObjectBase {
7633
7839
  constructor(initialState) {
7634
- super(__spreadValues$c({
7840
+ super(__spreadValues$b({
7635
7841
  type: "interval",
7636
7842
  value: "",
7637
7843
  intervals: ["1m", "10m", "30m", "1h", "6h", "12h", "1d", "7d", "14d", "30d"],
@@ -7839,7 +8045,7 @@ class EmbeddedScene extends SceneObjectBase {
7839
8045
  EmbeddedScene.Component = EmbeddedSceneRenderer;
7840
8046
  function EmbeddedSceneRenderer({ model }) {
7841
8047
  const { body, controls } = model.useState();
7842
- const styles = ui.useStyles2(getStyles$6);
8048
+ const styles = ui.useStyles2(getStyles$5);
7843
8049
  return /* @__PURE__ */ React__default["default"].createElement("div", {
7844
8050
  className: styles.container
7845
8051
  }, controls && /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -7853,7 +8059,7 @@ function EmbeddedSceneRenderer({ model }) {
7853
8059
  model: body
7854
8060
  })));
7855
8061
  }
7856
- const getStyles$6 = (theme) => {
8062
+ const getStyles$5 = (theme) => {
7857
8063
  return {
7858
8064
  container: css.css({
7859
8065
  flexGrow: 1,
@@ -7956,30 +8162,30 @@ function isSceneGridLayout(child) {
7956
8162
  return child instanceof SceneGridLayout;
7957
8163
  }
7958
8164
 
7959
- var __defProp$b = Object.defineProperty;
7960
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7961
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
7962
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
7963
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7964
- var __spreadValues$b = (a, b) => {
8165
+ var __defProp$a = Object.defineProperty;
8166
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8167
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8168
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8169
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8170
+ var __spreadValues$a = (a, b) => {
7965
8171
  for (var prop in b || (b = {}))
7966
- if (__hasOwnProp$b.call(b, prop))
7967
- __defNormalProp$b(a, prop, b[prop]);
7968
- if (__getOwnPropSymbols$b)
7969
- for (var prop of __getOwnPropSymbols$b(b)) {
7970
- if (__propIsEnum$b.call(b, prop))
7971
- __defNormalProp$b(a, prop, b[prop]);
8172
+ if (__hasOwnProp$a.call(b, prop))
8173
+ __defNormalProp$a(a, prop, b[prop]);
8174
+ if (__getOwnPropSymbols$a)
8175
+ for (var prop of __getOwnPropSymbols$a(b)) {
8176
+ if (__propIsEnum$a.call(b, prop))
8177
+ __defNormalProp$a(a, prop, b[prop]);
7972
8178
  }
7973
8179
  return a;
7974
8180
  };
7975
8181
  var __objRest$1 = (source, exclude) => {
7976
8182
  var target = {};
7977
8183
  for (var prop in source)
7978
- if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
8184
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
7979
8185
  target[prop] = source[prop];
7980
- if (source != null && __getOwnPropSymbols$b)
7981
- for (var prop of __getOwnPropSymbols$b(source)) {
7982
- if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
8186
+ if (source != null && __getOwnPropSymbols$a)
8187
+ for (var prop of __getOwnPropSymbols$a(source)) {
8188
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
7983
8189
  target[prop] = source[prop];
7984
8190
  }
7985
8191
  return target;
@@ -8019,7 +8225,7 @@ const LazyLoader = React__default["default"].forwardRef(
8019
8225
  }
8020
8226
  };
8021
8227
  });
8022
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$b({
8228
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$a({
8023
8229
  id,
8024
8230
  ref: innerRef
8025
8231
  }, rest), loaded && (typeof children === "function" ? children({ isInView }) : children));
@@ -8037,33 +8243,33 @@ LazyLoader.observer = new IntersectionObserver(
8037
8243
  { rootMargin: "100px" }
8038
8244
  );
8039
8245
 
8040
- var __defProp$a = Object.defineProperty;
8041
- var __defProps$7 = Object.defineProperties;
8042
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
8043
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8044
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8045
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8046
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8047
- var __spreadValues$a = (a, b) => {
8246
+ var __defProp$9 = Object.defineProperty;
8247
+ var __defProps$6 = Object.defineProperties;
8248
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
8249
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8250
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8251
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8252
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8253
+ var __spreadValues$9 = (a, b) => {
8048
8254
  for (var prop in b || (b = {}))
8049
- if (__hasOwnProp$a.call(b, prop))
8050
- __defNormalProp$a(a, prop, b[prop]);
8051
- if (__getOwnPropSymbols$a)
8052
- for (var prop of __getOwnPropSymbols$a(b)) {
8053
- if (__propIsEnum$a.call(b, prop))
8054
- __defNormalProp$a(a, prop, b[prop]);
8255
+ if (__hasOwnProp$9.call(b, prop))
8256
+ __defNormalProp$9(a, prop, b[prop]);
8257
+ if (__getOwnPropSymbols$9)
8258
+ for (var prop of __getOwnPropSymbols$9(b)) {
8259
+ if (__propIsEnum$9.call(b, prop))
8260
+ __defNormalProp$9(a, prop, b[prop]);
8055
8261
  }
8056
8262
  return a;
8057
8263
  };
8058
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
8264
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
8059
8265
  var __objRest = (source, exclude) => {
8060
8266
  var target = {};
8061
8267
  for (var prop in source)
8062
- if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
8268
+ if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
8063
8269
  target[prop] = source[prop];
8064
- if (source != null && __getOwnPropSymbols$a)
8065
- for (var prop of __getOwnPropSymbols$a(source)) {
8066
- if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
8270
+ if (source != null && __getOwnPropSymbols$9)
8271
+ for (var prop of __getOwnPropSymbols$9(source)) {
8272
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
8067
8273
  target[prop] = source[prop];
8068
8274
  }
8069
8275
  return target;
@@ -8122,7 +8328,7 @@ const GridItemWrapper = React__default["default"].forwardRef((props, ref) => {
8122
8328
  key: sceneChild.state.key
8123
8329
  });
8124
8330
  if (isLazy) {
8125
- return /* @__PURE__ */ React__default["default"].createElement(LazyLoader, __spreadProps$7(__spreadValues$a({}, divProps), {
8331
+ return /* @__PURE__ */ React__default["default"].createElement(LazyLoader, __spreadProps$6(__spreadValues$9({}, divProps), {
8126
8332
  key: sceneChild.state.key,
8127
8333
  "data-griditem-key": sceneChild.state.key,
8128
8334
  className: css.cx(className, props.className),
@@ -8130,7 +8336,7 @@ const GridItemWrapper = React__default["default"].forwardRef((props, ref) => {
8130
8336
  ref
8131
8337
  }), innerContent, children);
8132
8338
  }
8133
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$7(__spreadValues$a({}, divProps), {
8339
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$6(__spreadValues$9({}, divProps), {
8134
8340
  ref,
8135
8341
  key: sceneChild.state.key,
8136
8342
  "data-griditem-key": sceneChild.state.key,
@@ -8160,7 +8366,7 @@ function updateAnimationClass(ref, isDraggable, retry) {
8160
8366
  const ResizeHandle = React__default["default"].forwardRef((_a, ref) => {
8161
8367
  var _b = _a, divProps = __objRest(_b, ["handleAxis"]);
8162
8368
  const customCssClass = ui.useStyles2(getResizeHandleStyles);
8163
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$7(__spreadValues$a({
8369
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$6(__spreadValues$9({
8164
8370
  ref
8165
8371
  }, divProps), {
8166
8372
  className: `${customCssClass} scene-resize-handle`
@@ -8200,60 +8406,60 @@ function getResizeHandleStyles(theme) {
8200
8406
  });
8201
8407
  }
8202
8408
 
8203
- var __defProp$9 = Object.defineProperty;
8204
- var __defProps$6 = Object.defineProperties;
8205
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
8206
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8207
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8208
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8209
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8210
- var __spreadValues$9 = (a, b) => {
8409
+ var __defProp$8 = Object.defineProperty;
8410
+ var __defProps$5 = Object.defineProperties;
8411
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
8412
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8413
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8414
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8415
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8416
+ var __spreadValues$8 = (a, b) => {
8211
8417
  for (var prop in b || (b = {}))
8212
- if (__hasOwnProp$9.call(b, prop))
8213
- __defNormalProp$9(a, prop, b[prop]);
8214
- if (__getOwnPropSymbols$9)
8215
- for (var prop of __getOwnPropSymbols$9(b)) {
8216
- if (__propIsEnum$9.call(b, prop))
8217
- __defNormalProp$9(a, prop, b[prop]);
8418
+ if (__hasOwnProp$8.call(b, prop))
8419
+ __defNormalProp$8(a, prop, b[prop]);
8420
+ if (__getOwnPropSymbols$8)
8421
+ for (var prop of __getOwnPropSymbols$8(b)) {
8422
+ if (__propIsEnum$8.call(b, prop))
8423
+ __defNormalProp$8(a, prop, b[prop]);
8218
8424
  }
8219
8425
  return a;
8220
8426
  };
8221
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
8427
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
8222
8428
  function fitPanelsInHeight(cells, height) {
8223
8429
  const visibleHeight = height - GRID_CELL_VMARGIN * 4;
8224
8430
  const currentGridHeight = Math.max(...cells.map((cell) => cell.h + cell.y));
8225
8431
  const visibleGridHeight = Math.floor(visibleHeight / (GRID_CELL_HEIGHT + GRID_CELL_VMARGIN));
8226
8432
  const scaleFactor = currentGridHeight / visibleGridHeight;
8227
8433
  return cells.map((cell) => {
8228
- return __spreadProps$6(__spreadValues$9({}, cell), {
8434
+ return __spreadProps$5(__spreadValues$8({}, cell), {
8229
8435
  y: Math.round(cell.y / scaleFactor) || 0,
8230
8436
  h: Math.round(cell.h / scaleFactor) || 1
8231
8437
  });
8232
8438
  });
8233
8439
  }
8234
8440
 
8235
- var __defProp$8 = Object.defineProperty;
8236
- var __defProps$5 = Object.defineProperties;
8237
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
8238
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8239
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8240
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8241
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8242
- var __spreadValues$8 = (a, b) => {
8441
+ var __defProp$7 = Object.defineProperty;
8442
+ var __defProps$4 = Object.defineProperties;
8443
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
8444
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8445
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8446
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8447
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8448
+ var __spreadValues$7 = (a, b) => {
8243
8449
  for (var prop in b || (b = {}))
8244
- if (__hasOwnProp$8.call(b, prop))
8245
- __defNormalProp$8(a, prop, b[prop]);
8246
- if (__getOwnPropSymbols$8)
8247
- for (var prop of __getOwnPropSymbols$8(b)) {
8248
- if (__propIsEnum$8.call(b, prop))
8249
- __defNormalProp$8(a, prop, b[prop]);
8450
+ if (__hasOwnProp$7.call(b, prop))
8451
+ __defNormalProp$7(a, prop, b[prop]);
8452
+ if (__getOwnPropSymbols$7)
8453
+ for (var prop of __getOwnPropSymbols$7(b)) {
8454
+ if (__propIsEnum$7.call(b, prop))
8455
+ __defNormalProp$7(a, prop, b[prop]);
8250
8456
  }
8251
8457
  return a;
8252
8458
  };
8253
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
8459
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
8254
8460
  const _SceneGridLayout = class extends SceneObjectBase {
8255
8461
  constructor(state) {
8256
- super(__spreadProps$5(__spreadValues$8({}, state), {
8462
+ super(__spreadProps$4(__spreadValues$7({}, state), {
8257
8463
  children: sortChildrenByPosition(state.children)
8258
8464
  }));
8259
8465
  this._skipOnLayoutChange = false;
@@ -8277,7 +8483,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8277
8483
  height: item.h
8278
8484
  };
8279
8485
  if (!isItemSizeEqual(child.state, nextSize)) {
8280
- child.setState(__spreadValues$8({}, nextSize));
8486
+ child.setState(__spreadValues$7({}, nextSize));
8281
8487
  }
8282
8488
  }
8283
8489
  this.setState({ children: sortChildrenByPosition(this.state.children) });
@@ -8351,7 +8557,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8351
8557
  const yDiff = firstPanelYPos - (rowY + 1);
8352
8558
  let yMax = rowY;
8353
8559
  for (const panel of rowChildren) {
8354
- const newSize = __spreadValues$8({}, panel.state);
8560
+ const newSize = __spreadValues$7({}, panel.state);
8355
8561
  newSize.y = (_b = newSize.y) != null ? _b : rowY;
8356
8562
  newSize.y -= yDiff;
8357
8563
  if (newSize.y !== panel.state.y) {
@@ -8478,7 +8684,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8478
8684
  }
8479
8685
  if (width < 768) {
8480
8686
  this._skipOnLayoutChange = true;
8481
- return cells.map((cell) => __spreadProps$5(__spreadValues$8({}, cell), { w: 24 }));
8687
+ return cells.map((cell) => __spreadProps$4(__spreadValues$7({}, cell), { w: 24 }));
8482
8688
  }
8483
8689
  this._skipOnLayoutChange = false;
8484
8690
  return cells;
@@ -8503,28 +8709,28 @@ function sortGridLayout(layout) {
8503
8709
  return [...layout].sort((a, b) => a.y - b.y || a.x - b.x);
8504
8710
  }
8505
8711
 
8506
- var __defProp$7 = Object.defineProperty;
8507
- var __defProps$4 = Object.defineProperties;
8508
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
8509
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8510
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8511
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8512
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8513
- var __spreadValues$7 = (a, b) => {
8712
+ var __defProp$6 = Object.defineProperty;
8713
+ var __defProps$3 = Object.defineProperties;
8714
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8715
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8716
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8717
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8718
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8719
+ var __spreadValues$6 = (a, b) => {
8514
8720
  for (var prop in b || (b = {}))
8515
- if (__hasOwnProp$7.call(b, prop))
8516
- __defNormalProp$7(a, prop, b[prop]);
8517
- if (__getOwnPropSymbols$7)
8518
- for (var prop of __getOwnPropSymbols$7(b)) {
8519
- if (__propIsEnum$7.call(b, prop))
8520
- __defNormalProp$7(a, prop, b[prop]);
8721
+ if (__hasOwnProp$6.call(b, prop))
8722
+ __defNormalProp$6(a, prop, b[prop]);
8723
+ if (__getOwnPropSymbols$6)
8724
+ for (var prop of __getOwnPropSymbols$6(b)) {
8725
+ if (__propIsEnum$6.call(b, prop))
8726
+ __defNormalProp$6(a, prop, b[prop]);
8521
8727
  }
8522
8728
  return a;
8523
8729
  };
8524
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
8730
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
8525
8731
  class SceneGridRow extends SceneObjectBase {
8526
8732
  constructor(state) {
8527
- super(__spreadProps$4(__spreadValues$7({
8733
+ super(__spreadProps$3(__spreadValues$6({
8528
8734
  children: state.children || [],
8529
8735
  isCollapsible: state.isCollapsible || true,
8530
8736
  title: state.title || ""
@@ -8689,7 +8895,7 @@ NestedScene.Component = NestedSceneRenderer;
8689
8895
  function NestedSceneRenderer({ model }) {
8690
8896
  const { title, isCollapsed, canCollapse, canRemove, body, controls } = model.useState();
8691
8897
  const gridRow = ui.useStyles2(getSceneGridRowStyles);
8692
- const styles = ui.useStyles2(getStyles$5);
8898
+ const styles = ui.useStyles2(getStyles$4);
8693
8899
  const toolbarControls = (controls != null ? controls : []).map((action) => /* @__PURE__ */ React__default["default"].createElement(action.Component, {
8694
8900
  key: action.state.key,
8695
8901
  model: action
@@ -8724,7 +8930,7 @@ function NestedSceneRenderer({ model }) {
8724
8930
  model: body
8725
8931
  }));
8726
8932
  }
8727
- const getStyles$5 = (theme) => ({
8933
+ const getStyles$4 = (theme) => ({
8728
8934
  wrapper: css.css({
8729
8935
  display: "flex",
8730
8936
  flexDirection: "column",
@@ -8891,30 +9097,30 @@ function getShiftedTimeRange(dir, timeRange, upperLimit) {
8891
9097
  };
8892
9098
  }
8893
9099
 
8894
- var __defProp$6 = Object.defineProperty;
8895
- var __defProps$3 = Object.defineProperties;
8896
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8897
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8898
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8899
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8900
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8901
- var __spreadValues$6 = (a, b) => {
9100
+ var __defProp$5 = Object.defineProperty;
9101
+ var __defProps$2 = Object.defineProperties;
9102
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9103
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
9104
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
9105
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9106
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9107
+ var __spreadValues$5 = (a, b) => {
8902
9108
  for (var prop in b || (b = {}))
8903
- if (__hasOwnProp$6.call(b, prop))
8904
- __defNormalProp$6(a, prop, b[prop]);
8905
- if (__getOwnPropSymbols$6)
8906
- for (var prop of __getOwnPropSymbols$6(b)) {
8907
- if (__propIsEnum$6.call(b, prop))
8908
- __defNormalProp$6(a, prop, b[prop]);
9109
+ if (__hasOwnProp$5.call(b, prop))
9110
+ __defNormalProp$5(a, prop, b[prop]);
9111
+ if (__getOwnPropSymbols$5)
9112
+ for (var prop of __getOwnPropSymbols$5(b)) {
9113
+ if (__propIsEnum$5.call(b, prop))
9114
+ __defNormalProp$5(a, prop, b[prop]);
8909
9115
  }
8910
9116
  return a;
8911
9117
  };
8912
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
9118
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8913
9119
  const DEFAULT_INTERVALS = ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"];
8914
9120
  class SceneRefreshPicker extends SceneObjectBase {
8915
9121
  constructor(state) {
8916
9122
  var _a, _b, _c;
8917
- super(__spreadProps$3(__spreadValues$6({
9123
+ super(__spreadProps$2(__spreadValues$5({
8918
9124
  refresh: ""
8919
9125
  }, state), {
8920
9126
  autoValue: void 0,
@@ -8991,287 +9197,59 @@ class SceneRefreshPicker extends SceneObjectBase {
8991
9197
  }
8992
9198
  (_a2 = this._autoTimeRangeListener) == null ? void 0 : _a2.unsubscribe();
8993
9199
  };
8994
- });
8995
- }
8996
- getUrlState() {
8997
- return {
8998
- refresh: this.state.refresh
8999
- };
9000
- }
9001
- updateFromUrl(values) {
9002
- const refresh = values.refresh;
9003
- if (refresh && typeof refresh === "string") {
9004
- this.setState({
9005
- refresh
9006
- });
9007
- }
9008
- }
9009
- }
9010
- SceneRefreshPicker.Component = SceneRefreshPickerRenderer;
9011
- function SceneRefreshPickerRenderer({ model }) {
9012
- var _a;
9013
- const { refresh, intervals, autoEnabled, autoValue, isOnCanvas, primary, withText } = model.useState();
9014
- const isRunning = useQueryControllerState(model);
9015
- let text = refresh === ((_a = ui.RefreshPicker.autoOption) == null ? void 0 : _a.value) ? autoValue : withText ? "Refresh" : void 0;
9016
- let tooltip;
9017
- let width;
9018
- if (isRunning) {
9019
- tooltip = "Cancel all queries";
9020
- if (withText) {
9021
- text = "Cancel";
9022
- }
9023
- }
9024
- if (withText) {
9025
- width = "96px";
9026
- }
9027
- return /* @__PURE__ */ React__default["default"].createElement(ui.RefreshPicker, {
9028
- showAutoInterval: autoEnabled,
9029
- value: refresh,
9030
- intervals,
9031
- tooltip,
9032
- width,
9033
- text,
9034
- onRefresh: model.onRefresh,
9035
- primary,
9036
- onIntervalChanged: model.onIntervalChanged,
9037
- isLoading: isRunning,
9038
- isOnCanvas: isOnCanvas != null ? isOnCanvas : true
9039
- });
9040
- }
9041
- function useQueryControllerState(model) {
9042
- const queryController = sceneGraph.getQueryController(model);
9043
- if (!queryController) {
9044
- return false;
9045
- }
9046
- return queryController.useState().isRunning;
9047
- }
9048
-
9049
- const getCompareSeriesRefId = (refId) => `${refId}-compare`;
9050
-
9051
- var __defProp$5 = Object.defineProperty;
9052
- var __defProps$2 = Object.defineProperties;
9053
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9054
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
9055
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
9056
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9057
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9058
- var __spreadValues$5 = (a, b) => {
9059
- for (var prop in b || (b = {}))
9060
- if (__hasOwnProp$5.call(b, prop))
9061
- __defNormalProp$5(a, prop, b[prop]);
9062
- if (__getOwnPropSymbols$5)
9063
- for (var prop of __getOwnPropSymbols$5(b)) {
9064
- if (__propIsEnum$5.call(b, prop))
9065
- __defNormalProp$5(a, prop, b[prop]);
9066
- }
9067
- return a;
9068
- };
9069
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
9070
- const PREVIOUS_PERIOD_VALUE = "__previousPeriod";
9071
- const NO_PERIOD_VALUE = "__noPeriod";
9072
- const PREVIOUS_PERIOD_COMPARE_OPTION = {
9073
- label: "Previous period",
9074
- value: PREVIOUS_PERIOD_VALUE
9075
- };
9076
- const NO_COMPARE_OPTION = {
9077
- label: "No comparison",
9078
- value: NO_PERIOD_VALUE
9079
- };
9080
- const DEFAULT_COMPARE_OPTIONS = [
9081
- { label: "Day before", value: "24h" },
9082
- { label: "Week before", value: "1w" },
9083
- { label: "Month before", value: "1M" }
9084
- ];
9085
- class SceneTimeRangeCompare extends SceneObjectBase {
9086
- constructor(state) {
9087
- super(__spreadValues$5({ compareOptions: DEFAULT_COMPARE_OPTIONS }, state));
9088
- this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["compareWith"] });
9089
- this._onActivate = () => {
9090
- const sceneTimeRange = sceneGraph.getTimeRange(this);
9091
- this.setState({ compareOptions: this.getCompareOptions(sceneTimeRange.state.value) });
9092
- this._subs.add(
9093
- sceneTimeRange.subscribeToState((timeRange) => {
9094
- const compareOptions = this.getCompareOptions(timeRange.value);
9095
- const stateUpdate = { compareOptions };
9096
- if (Boolean(this.state.compareWith) && !compareOptions.find(({ value }) => value === this.state.compareWith)) {
9097
- stateUpdate.compareWith = PREVIOUS_PERIOD_VALUE;
9098
- }
9099
- this.setState(stateUpdate);
9100
- })
9101
- );
9102
- };
9103
- this.getCompareOptions = (timeRange) => {
9104
- const diffDays = Math.ceil(timeRange.to.diff(timeRange.from));
9105
- const matchIndex = DEFAULT_COMPARE_OPTIONS.findIndex(({ value }) => {
9106
- const intervalInMs = data.rangeUtil.intervalToMs(value);
9107
- return intervalInMs >= diffDays;
9108
- });
9109
- return [
9110
- NO_COMPARE_OPTION,
9111
- PREVIOUS_PERIOD_COMPARE_OPTION,
9112
- ...DEFAULT_COMPARE_OPTIONS.slice(matchIndex).map(({ label, value }) => ({ label, value }))
9113
- ];
9114
- };
9115
- this.onCompareWithChanged = (compareWith) => {
9116
- if (compareWith === NO_PERIOD_VALUE) {
9117
- this.onClearCompare();
9118
- } else {
9119
- this.setState({ compareWith });
9120
- }
9121
- };
9122
- this.onClearCompare = () => {
9123
- this.setState({ compareWith: void 0 });
9124
- };
9125
- this.addActivationHandler(this._onActivate);
9126
- }
9127
- getExtraQueries(request) {
9128
- const extraQueries = [];
9129
- const compareRange = this.getCompareTimeRange(request.range);
9130
- if (!compareRange) {
9131
- return extraQueries;
9132
- }
9133
- const targets = request.targets.filter((query) => query.timeRangeCompare !== false);
9134
- if (targets.length) {
9135
- extraQueries.push({
9136
- req: __spreadProps$2(__spreadValues$5({}, request), {
9137
- targets,
9138
- range: compareRange
9139
- }),
9140
- processor: timeShiftAlignmentProcessor
9141
- });
9142
- }
9143
- return extraQueries;
9144
- }
9145
- shouldRerun(prev, next) {
9146
- return prev.compareWith !== next.compareWith;
9147
- }
9148
- getCompareTimeRange(timeRange) {
9149
- let compareFrom;
9150
- let compareTo;
9151
- if (this.state.compareWith) {
9152
- if (this.state.compareWith === PREVIOUS_PERIOD_VALUE) {
9153
- const diffMs = timeRange.to.diff(timeRange.from);
9154
- compareFrom = data.dateTime(timeRange.from).subtract(diffMs);
9155
- compareTo = data.dateTime(timeRange.to).subtract(diffMs);
9156
- } else {
9157
- compareFrom = data.dateTime(timeRange.from).subtract(data.rangeUtil.intervalToMs(this.state.compareWith));
9158
- compareTo = data.dateTime(timeRange.to).subtract(data.rangeUtil.intervalToMs(this.state.compareWith));
9159
- }
9160
- return {
9161
- from: compareFrom,
9162
- to: compareTo,
9163
- raw: {
9164
- from: compareFrom,
9165
- to: compareTo
9166
- }
9167
- };
9168
- }
9169
- return void 0;
9200
+ });
9170
9201
  }
9171
9202
  getUrlState() {
9172
9203
  return {
9173
- compareWith: this.state.compareWith
9204
+ refresh: this.state.refresh
9174
9205
  };
9175
9206
  }
9176
9207
  updateFromUrl(values) {
9177
- if (!values.compareWith) {
9178
- return;
9179
- }
9180
- const compareWith = parseUrlParam(values.compareWith);
9181
- if (compareWith) {
9182
- const compareOptions = this.getCompareOptions(sceneGraph.getTimeRange(this).state.value);
9183
- if (compareOptions.find(({ value }) => value === compareWith)) {
9184
- this.setState({
9185
- compareWith
9186
- });
9187
- } else {
9188
- this.setState({
9189
- compareWith: "__previousPeriod"
9190
- });
9191
- }
9208
+ const refresh = values.refresh;
9209
+ if (refresh && typeof refresh === "string") {
9210
+ this.setState({
9211
+ refresh
9212
+ });
9192
9213
  }
9193
9214
  }
9194
9215
  }
9195
- SceneTimeRangeCompare.Component = SceneTimeRangeCompareRenderer;
9196
- const timeShiftAlignmentProcessor = (primary, secondary) => {
9197
- const diff = secondary.timeRange.from.diff(primary.timeRange.from);
9198
- secondary.series.forEach((series) => {
9199
- series.refId = getCompareSeriesRefId(series.refId || "");
9200
- series.meta = __spreadProps$2(__spreadValues$5({}, series.meta), {
9201
- timeCompare: {
9202
- diffMs: diff,
9203
- isTimeShiftQuery: true
9204
- }
9205
- });
9206
- series.fields.forEach((field) => {
9207
- if (field.type === data.FieldType.time) {
9208
- field.values = field.values.map((v) => {
9209
- return diff < 0 ? v - diff : v + diff;
9210
- });
9211
- }
9212
- field.config = __spreadProps$2(__spreadValues$5({}, field.config), {
9213
- color: {
9214
- mode: "fixed",
9215
- fixedColor: runtime.config.theme.palette.gray60
9216
- }
9217
- });
9218
- return field;
9219
- });
9220
- });
9221
- return rxjs.of(secondary);
9222
- };
9223
- function SceneTimeRangeCompareRenderer({ model }) {
9216
+ SceneRefreshPicker.Component = SceneRefreshPickerRenderer;
9217
+ function SceneRefreshPickerRenderer({ model }) {
9224
9218
  var _a;
9225
- const styles = ui.useStyles2(getStyles$4);
9226
- const { compareWith, compareOptions } = model.useState();
9227
- const [previousCompare, setPreviousCompare] = React__default["default"].useState(compareWith);
9228
- const previousValue = (_a = compareOptions.find(({ value: value2 }) => value2 === previousCompare)) != null ? _a : PREVIOUS_PERIOD_COMPARE_OPTION;
9229
- const value = compareOptions.find(({ value: value2 }) => value2 === compareWith);
9230
- const enabled = Boolean(value);
9231
- const onClick = () => {
9232
- if (enabled) {
9233
- setPreviousCompare(compareWith);
9234
- model.onClearCompare();
9235
- } else if (!enabled) {
9236
- model.onCompareWithChanged(previousValue.value);
9237
- }
9238
- };
9239
- return /* @__PURE__ */ React__default["default"].createElement(ui.ButtonGroup, null, /* @__PURE__ */ React__default["default"].createElement(ui.ToolbarButton, {
9240
- variant: "canvas",
9241
- tooltip: "Enable time frame comparison",
9242
- onClick: (e) => {
9243
- e.stopPropagation();
9244
- e.preventDefault();
9245
- onClick();
9246
- }
9247
- }, /* @__PURE__ */ React__default["default"].createElement(ui.Checkbox, {
9248
- label: " ",
9249
- value: enabled,
9250
- onClick
9251
- }), "Comparison"), enabled ? /* @__PURE__ */ React__default["default"].createElement(ui.ButtonSelect, {
9252
- variant: "canvas",
9253
- value,
9254
- options: compareOptions,
9255
- onChange: (v) => {
9256
- model.onCompareWithChanged(v.value);
9219
+ const { refresh, intervals, autoEnabled, autoValue, isOnCanvas, primary, withText } = model.useState();
9220
+ const isRunning = useQueryControllerState(model);
9221
+ let text = refresh === ((_a = ui.RefreshPicker.autoOption) == null ? void 0 : _a.value) ? autoValue : withText ? "Refresh" : void 0;
9222
+ let tooltip;
9223
+ let width;
9224
+ if (isRunning) {
9225
+ tooltip = "Cancel all queries";
9226
+ if (withText) {
9227
+ text = "Cancel";
9257
9228
  }
9258
- }) : /* @__PURE__ */ React__default["default"].createElement(ui.ToolbarButton, {
9259
- className: styles.previewButton,
9260
- disabled: true,
9261
- variant: "canvas",
9262
- isOpen: false
9263
- }, previousValue.label));
9229
+ }
9230
+ if (withText) {
9231
+ width = "96px";
9232
+ }
9233
+ return /* @__PURE__ */ React__default["default"].createElement(ui.RefreshPicker, {
9234
+ showAutoInterval: autoEnabled,
9235
+ value: refresh,
9236
+ intervals,
9237
+ tooltip,
9238
+ width,
9239
+ text,
9240
+ onRefresh: model.onRefresh,
9241
+ primary,
9242
+ onIntervalChanged: model.onIntervalChanged,
9243
+ isLoading: isRunning,
9244
+ isOnCanvas: isOnCanvas != null ? isOnCanvas : true
9245
+ });
9264
9246
  }
9265
- function getStyles$4(theme) {
9266
- return {
9267
- previewButton: css.css({
9268
- "&:disabled": {
9269
- border: `1px solid ${theme.colors.secondary.border}`,
9270
- color: theme.colors.text.disabled,
9271
- opacity: 1
9272
- }
9273
- })
9274
- };
9247
+ function useQueryControllerState(model) {
9248
+ const queryController = sceneGraph.getQueryController(model);
9249
+ if (!queryController) {
9250
+ return false;
9251
+ }
9252
+ return queryController.useState().isRunning;
9275
9253
  }
9276
9254
 
9277
9255
  class SceneByFrameRepeater extends SceneObjectBase {
@@ -11138,174 +11116,6 @@ const PanelBuilders = {
11138
11116
  }
11139
11117
  };
11140
11118
 
11141
- class VizConfigBuilder {
11142
- constructor(pluginId, pluginVersion, defaultOptions, defaultFieldConfig) {
11143
- this._pluginId = pluginId;
11144
- this._pluginVersion = pluginVersion;
11145
- this._fieldConfigBuilder = new FieldConfigBuilder(defaultFieldConfig);
11146
- this._panelOptionsBuilder = new PanelOptionsBuilder(defaultOptions);
11147
- }
11148
- setColor(color) {
11149
- this._fieldConfigBuilder.setColor(color);
11150
- return this;
11151
- }
11152
- setDecimals(decimals) {
11153
- this._fieldConfigBuilder.setDecimals(decimals);
11154
- return this;
11155
- }
11156
- setDisplayName(displayName) {
11157
- this._fieldConfigBuilder.setDisplayName(displayName);
11158
- return this;
11159
- }
11160
- setFilterable(filterable) {
11161
- this._fieldConfigBuilder.setFilterable(filterable);
11162
- return this;
11163
- }
11164
- setLinks(links) {
11165
- this._fieldConfigBuilder.setLinks(links);
11166
- return this;
11167
- }
11168
- setMappings(mappings) {
11169
- this._fieldConfigBuilder.setMappings(mappings);
11170
- return this;
11171
- }
11172
- setMax(max) {
11173
- this._fieldConfigBuilder.setMax(max);
11174
- return this;
11175
- }
11176
- setMin(min) {
11177
- this._fieldConfigBuilder.setMin(min);
11178
- return this;
11179
- }
11180
- setNoValue(noValue) {
11181
- this._fieldConfigBuilder.setNoValue(noValue);
11182
- return this;
11183
- }
11184
- setThresholds(thresholds) {
11185
- this._fieldConfigBuilder.setThresholds(thresholds);
11186
- return this;
11187
- }
11188
- setUnit(unit) {
11189
- this._fieldConfigBuilder.setUnit(unit);
11190
- return this;
11191
- }
11192
- setCustomFieldConfig(id, value) {
11193
- this._fieldConfigBuilder.setCustomFieldConfig(id, value);
11194
- return this;
11195
- }
11196
- setOverrides(builder) {
11197
- this._fieldConfigBuilder.setOverrides(builder);
11198
- return this;
11199
- }
11200
- setOption(id, value) {
11201
- this._panelOptionsBuilder.setOption(id, value);
11202
- return this;
11203
- }
11204
- build() {
11205
- return {
11206
- pluginId: this._pluginId,
11207
- pluginVersion: this._pluginVersion,
11208
- options: this._panelOptionsBuilder.build(),
11209
- fieldConfig: this._fieldConfigBuilder.build()
11210
- };
11211
- }
11212
- }
11213
-
11214
- const VizConfigBuilders = {
11215
- barchart() {
11216
- return new VizConfigBuilder(
11217
- "barchart",
11218
- "10.0.0",
11219
- () => BarChartPanelCfg_types_gen.defaultOptions,
11220
- () => BarChartPanelCfg_types_gen.defaultFieldConfig
11221
- );
11222
- },
11223
- bargauge() {
11224
- return new VizConfigBuilder("bargauge", "10.0.0", () => BarGaugePanelCfg_types_gen.defaultOptions);
11225
- },
11226
- datagrid() {
11227
- return new VizConfigBuilder("datagrid", "10.0.0", () => DatagridPanelCfg_types_gen.defaultOptions);
11228
- },
11229
- flamegraph() {
11230
- return new VizConfigBuilder("flamegraph", "10.0.0");
11231
- },
11232
- gauge() {
11233
- return new VizConfigBuilder("gauge", "10.0.0", () => GaugePanelCfg_types_gen.defaultOptions);
11234
- },
11235
- geomap() {
11236
- return new VizConfigBuilder("geomap", "10.0.0", () => GeomapPanelCfg_types_gen.defaultOptions);
11237
- },
11238
- heatmap() {
11239
- return new VizConfigBuilder("heatmap", "10.0.0", () => HeatmapPanelCfg_types_gen.defaultOptions);
11240
- },
11241
- histogram() {
11242
- return new VizConfigBuilder(
11243
- "histogram",
11244
- "10.0.0",
11245
- () => HistogramPanelCfg_types_gen.defaultOptions,
11246
- () => HistogramPanelCfg_types_gen.defaultFieldConfig
11247
- );
11248
- },
11249
- logs() {
11250
- return new VizConfigBuilder("logs", "10.0.0");
11251
- },
11252
- news() {
11253
- return new VizConfigBuilder("news", "10.0.0", () => NewsPanelCfg_types_gen.defaultOptions);
11254
- },
11255
- nodegraph() {
11256
- return new VizConfigBuilder("nodeGraph", "10.0.0");
11257
- },
11258
- piechart() {
11259
- return new VizConfigBuilder(
11260
- "piechart",
11261
- "10.0.0",
11262
- () => PieChartPanelCfg_types_gen.defaultOptions
11263
- );
11264
- },
11265
- stat() {
11266
- return new VizConfigBuilder("stat", "10.0.0", () => StatPanelCfg_types_gen.defaultOptions);
11267
- },
11268
- statetimeline() {
11269
- return new VizConfigBuilder(
11270
- "state-timeline",
11271
- "10.0.0",
11272
- () => StateTimelinePanelCfg_types_gen.defaultOptions,
11273
- () => StateTimelinePanelCfg_types_gen.defaultFieldConfig
11274
- );
11275
- },
11276
- statushistory() {
11277
- return new VizConfigBuilder(
11278
- "status-history",
11279
- "10.0.0",
11280
- () => StatusHistoryPanelCfg_types_gen.defaultOptions,
11281
- () => StatusHistoryPanelCfg_types_gen.defaultFieldConfig
11282
- );
11283
- },
11284
- table() {
11285
- return new VizConfigBuilder("table", "10.0.0", () => TablePanelCfg_types_gen.defaultOptions);
11286
- },
11287
- text() {
11288
- return new VizConfigBuilder("text", "10.0.0", () => TextPanelCfg_types_gen.defaultOptions);
11289
- },
11290
- timeseries() {
11291
- return new VizConfigBuilder("timeseries", "10.0.0");
11292
- },
11293
- trend() {
11294
- return new VizConfigBuilder("trend", "10.0.0");
11295
- },
11296
- traces() {
11297
- return new VizConfigBuilder("traces", "10.0.0");
11298
- },
11299
- xychart() {
11300
- return new VizConfigBuilder(
11301
- "xychart",
11302
- "10.0.0",
11303
- () => XYChartPanelCfg_types_gen.defaultOptions,
11304
- () => XYChartPanelCfg_types_gen.defaultFieldConfig
11305
- );
11306
- }
11307
- };
11308
-
11309
11119
  const sceneUtils = {
11310
11120
  getUrlWithAppState,
11311
11121
  registerRuntimePanelPlugin,
@@ -11330,7 +11140,6 @@ exports.ConstantVariable = ConstantVariable;
11330
11140
  exports.CustomVariable = CustomVariable;
11331
11141
  exports.DataSourceVariable = DataSourceVariable;
11332
11142
  exports.EmbeddedScene = EmbeddedScene;
11333
- exports.FieldConfigBuilder = FieldConfigBuilder;
11334
11143
  exports.FieldConfigBuilders = FieldConfigBuilders;
11335
11144
  exports.FieldConfigOverridesBuilder = FieldConfigOverridesBuilder;
11336
11145
  exports.GroupByVariable = GroupByVariable;
@@ -11385,10 +11194,7 @@ exports.UrlSyncManager = UrlSyncManager;
11385
11194
  exports.UserActionEvent = UserActionEvent;
11386
11195
  exports.VariableDependencyConfig = VariableDependencyConfig;
11387
11196
  exports.VariableValueControl = VariableValueControl;
11388
- exports.VariableValueSelectWrapper = VariableValueSelectWrapper;
11389
11197
  exports.VariableValueSelectors = VariableValueSelectors;
11390
- exports.VizConfigBuilder = VizConfigBuilder;
11391
- exports.VizConfigBuilders = VizConfigBuilders;
11392
11198
  exports.VizPanel = VizPanel;
11393
11199
  exports.VizPanelBuilder = VizPanelBuilder;
11394
11200
  exports.VizPanelMenu = VizPanelMenu;