@grafana/scenes 6.2.0--canary.1062.13565845216.0 → 6.2.0--canary.1066.13575913588.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -41,19 +41,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
41
  var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
42
42
  var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
43
43
 
44
- var __defProp$S = Object.defineProperty;
45
- var __getOwnPropSymbols$S = Object.getOwnPropertySymbols;
46
- var __hasOwnProp$S = Object.prototype.hasOwnProperty;
47
- var __propIsEnum$S = Object.prototype.propertyIsEnumerable;
48
- var __defNormalProp$S = (obj, key, value) => key in obj ? __defProp$S(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
- var __spreadValues$S = (a, b) => {
44
+ var __defProp$R = Object.defineProperty;
45
+ var __getOwnPropSymbols$R = Object.getOwnPropertySymbols;
46
+ var __hasOwnProp$R = Object.prototype.hasOwnProperty;
47
+ var __propIsEnum$R = Object.prototype.propertyIsEnumerable;
48
+ var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
+ var __spreadValues$R = (a, b) => {
50
50
  for (var prop in b || (b = {}))
51
- if (__hasOwnProp$S.call(b, prop))
52
- __defNormalProp$S(a, prop, b[prop]);
53
- if (__getOwnPropSymbols$S)
54
- for (var prop of __getOwnPropSymbols$S(b)) {
55
- if (__propIsEnum$S.call(b, prop))
56
- __defNormalProp$S(a, prop, b[prop]);
51
+ if (__hasOwnProp$R.call(b, prop))
52
+ __defNormalProp$R(a, prop, b[prop]);
53
+ if (__getOwnPropSymbols$R)
54
+ for (var prop of __getOwnPropSymbols$R(b)) {
55
+ if (__propIsEnum$R.call(b, prop))
56
+ __defNormalProp$R(a, prop, b[prop]);
57
57
  }
58
58
  return a;
59
59
  };
@@ -62,7 +62,7 @@ function useAppQueryParams() {
62
62
  return runtime.locationSearchToObject(location.search || "");
63
63
  }
64
64
  function getUrlWithAppState(path, searchObject, preserveParams) {
65
- const paramsCopy = __spreadValues$S({}, searchObject);
65
+ const paramsCopy = __spreadValues$R({}, searchObject);
66
66
  if (preserveParams) {
67
67
  for (const key of Object.keys(paramsCopy)) {
68
68
  if (!preserveParams.includes(key)) {
@@ -92,21 +92,21 @@ function useSceneRouteMatch(path) {
92
92
  return match;
93
93
  }
94
94
 
95
- var __defProp$R = Object.defineProperty;
95
+ var __defProp$Q = Object.defineProperty;
96
96
  var __defProps$y = Object.defineProperties;
97
97
  var __getOwnPropDescs$y = Object.getOwnPropertyDescriptors;
98
- var __getOwnPropSymbols$R = Object.getOwnPropertySymbols;
99
- var __hasOwnProp$R = Object.prototype.hasOwnProperty;
100
- var __propIsEnum$R = Object.prototype.propertyIsEnumerable;
101
- var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
102
- var __spreadValues$R = (a, b) => {
98
+ var __getOwnPropSymbols$Q = Object.getOwnPropertySymbols;
99
+ var __hasOwnProp$Q = Object.prototype.hasOwnProperty;
100
+ var __propIsEnum$Q = Object.prototype.propertyIsEnumerable;
101
+ var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
102
+ var __spreadValues$Q = (a, b) => {
103
103
  for (var prop in b || (b = {}))
104
- if (__hasOwnProp$R.call(b, prop))
105
- __defNormalProp$R(a, prop, b[prop]);
106
- if (__getOwnPropSymbols$R)
107
- for (var prop of __getOwnPropSymbols$R(b)) {
108
- if (__propIsEnum$R.call(b, prop))
109
- __defNormalProp$R(a, prop, b[prop]);
104
+ if (__hasOwnProp$Q.call(b, prop))
105
+ __defNormalProp$Q(a, prop, b[prop]);
106
+ if (__getOwnPropSymbols$Q)
107
+ for (var prop of __getOwnPropSymbols$Q(b)) {
108
+ if (__propIsEnum$Q.call(b, prop))
109
+ __defNormalProp$Q(a, prop, b[prop]);
110
110
  }
111
111
  return a;
112
112
  };
@@ -116,7 +116,7 @@ function registerRuntimePanelPlugin({ pluginId, plugin }) {
116
116
  if (runtimePanelPlugins.has(pluginId)) {
117
117
  throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
118
118
  }
119
- plugin.meta = __spreadProps$y(__spreadValues$R({}, plugin.meta), {
119
+ plugin.meta = __spreadProps$y(__spreadValues$Q({}, plugin.meta), {
120
120
  id: pluginId,
121
121
  name: pluginId,
122
122
  module: "runtime plugin",
@@ -144,21 +144,21 @@ function loadPanelPluginSync(pluginId) {
144
144
  return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
145
145
  }
146
146
 
147
- var __defProp$Q = Object.defineProperty;
147
+ var __defProp$P = Object.defineProperty;
148
148
  var __defProps$x = Object.defineProperties;
149
149
  var __getOwnPropDescs$x = Object.getOwnPropertyDescriptors;
150
- var __getOwnPropSymbols$Q = Object.getOwnPropertySymbols;
151
- var __hasOwnProp$Q = Object.prototype.hasOwnProperty;
152
- var __propIsEnum$Q = Object.prototype.propertyIsEnumerable;
153
- var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
154
- var __spreadValues$Q = (a, b) => {
150
+ var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
151
+ var __hasOwnProp$P = Object.prototype.hasOwnProperty;
152
+ var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
153
+ var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
154
+ var __spreadValues$P = (a, b) => {
155
155
  for (var prop in b || (b = {}))
156
- if (__hasOwnProp$Q.call(b, prop))
157
- __defNormalProp$Q(a, prop, b[prop]);
158
- if (__getOwnPropSymbols$Q)
159
- for (var prop of __getOwnPropSymbols$Q(b)) {
160
- if (__propIsEnum$Q.call(b, prop))
161
- __defNormalProp$Q(a, prop, b[prop]);
156
+ if (__hasOwnProp$P.call(b, prop))
157
+ __defNormalProp$P(a, prop, b[prop]);
158
+ if (__getOwnPropSymbols$P)
159
+ for (var prop of __getOwnPropSymbols$P(b)) {
160
+ if (__propIsEnum$P.call(b, prop))
161
+ __defNormalProp$P(a, prop, b[prop]);
162
162
  }
163
163
  return a;
164
164
  };
@@ -166,11 +166,11 @@ var __spreadProps$x = (a, b) => __defProps$x(a, __getOwnPropDescs$x(b));
166
166
  var __objRest$5 = (source, exclude) => {
167
167
  var target = {};
168
168
  for (var prop in source)
169
- if (__hasOwnProp$Q.call(source, prop) && exclude.indexOf(prop) < 0)
169
+ if (__hasOwnProp$P.call(source, prop) && exclude.indexOf(prop) < 0)
170
170
  target[prop] = source[prop];
171
- if (source != null && __getOwnPropSymbols$Q)
172
- for (var prop of __getOwnPropSymbols$Q(source)) {
173
- if (exclude.indexOf(prop) < 0 && __propIsEnum$Q.call(source, prop))
171
+ if (source != null && __getOwnPropSymbols$P)
172
+ for (var prop of __getOwnPropSymbols$P(source)) {
173
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$P.call(source, prop))
174
174
  target[prop] = source[prop];
175
175
  }
176
176
  return target;
@@ -188,7 +188,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
188
188
  if (!model.isActive && !model.renderBeforeActivation) {
189
189
  return null;
190
190
  }
191
- return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$x(__spreadValues$Q({}, otherProps), {
191
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$x(__spreadValues$P({}, otherProps), {
192
192
  model
193
193
  }));
194
194
  }
@@ -234,19 +234,19 @@ class SceneObjectRef {
234
234
  }
235
235
  _ref = new WeakMap();
236
236
 
237
- var __defProp$P = Object.defineProperty;
238
- var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
239
- var __hasOwnProp$P = Object.prototype.hasOwnProperty;
240
- var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
241
- var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
242
- var __spreadValues$P = (a, b) => {
237
+ var __defProp$O = Object.defineProperty;
238
+ var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
239
+ var __hasOwnProp$O = Object.prototype.hasOwnProperty;
240
+ var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
241
+ var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
242
+ var __spreadValues$O = (a, b) => {
243
243
  for (var prop in b || (b = {}))
244
- if (__hasOwnProp$P.call(b, prop))
245
- __defNormalProp$P(a, prop, b[prop]);
246
- if (__getOwnPropSymbols$P)
247
- for (var prop of __getOwnPropSymbols$P(b)) {
248
- if (__propIsEnum$P.call(b, prop))
249
- __defNormalProp$P(a, prop, b[prop]);
244
+ if (__hasOwnProp$O.call(b, prop))
245
+ __defNormalProp$O(a, prop, b[prop]);
246
+ if (__getOwnPropSymbols$O)
247
+ for (var prop of __getOwnPropSymbols$O(b)) {
248
+ if (__propIsEnum$O.call(b, prop))
249
+ __defNormalProp$O(a, prop, b[prop]);
250
250
  }
251
251
  return a;
252
252
  };
@@ -313,7 +313,7 @@ class SceneObjectBase {
313
313
  }
314
314
  setState(update) {
315
315
  const prevState = this._state;
316
- const newState = __spreadValues$P(__spreadValues$P({}, this._state), update);
316
+ const newState = __spreadValues$O(__spreadValues$O({}, this._state), update);
317
317
  this._state = Object.freeze(newState);
318
318
  this._setParent(update);
319
319
  this._handleActivationOfChangedStateProps(prevState, newState);
@@ -509,19 +509,19 @@ function forEachChild(state, callback) {
509
509
  }
510
510
  }
511
511
 
512
- var __defProp$O = Object.defineProperty;
513
- var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
514
- var __hasOwnProp$O = Object.prototype.hasOwnProperty;
515
- var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
516
- var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
517
- var __spreadValues$O = (a, b) => {
512
+ var __defProp$N = Object.defineProperty;
513
+ var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
514
+ var __hasOwnProp$N = Object.prototype.hasOwnProperty;
515
+ var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
516
+ var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
517
+ var __spreadValues$N = (a, b) => {
518
518
  for (var prop in b || (b = {}))
519
- if (__hasOwnProp$O.call(b, prop))
520
- __defNormalProp$O(a, prop, b[prop]);
521
- if (__getOwnPropSymbols$O)
522
- for (var prop of __getOwnPropSymbols$O(b)) {
523
- if (__propIsEnum$O.call(b, prop))
524
- __defNormalProp$O(a, prop, b[prop]);
519
+ if (__hasOwnProp$N.call(b, prop))
520
+ __defNormalProp$N(a, prop, b[prop]);
521
+ if (__getOwnPropSymbols$N)
522
+ for (var prop of __getOwnPropSymbols$N(b)) {
523
+ if (__propIsEnum$N.call(b, prop))
524
+ __defNormalProp$N(a, prop, b[prop]);
525
525
  }
526
526
  return a;
527
527
  };
@@ -530,7 +530,7 @@ function cloneSceneObject(sceneObject, withState) {
530
530
  return new sceneObject.constructor(clonedState);
531
531
  }
532
532
  function cloneSceneObjectState(sceneState, withState) {
533
- const clonedState = __spreadValues$O({}, sceneState);
533
+ const clonedState = __spreadValues$N({}, sceneState);
534
534
  Object.assign(clonedState, withState);
535
535
  for (const key in clonedState) {
536
536
  if (withState && withState[key] !== void 0) {
@@ -811,21 +811,21 @@ function calculateNetworkTime(requests) {
811
811
  return totalNetworkTime;
812
812
  }
813
813
 
814
- var __defProp$N = Object.defineProperty;
814
+ var __defProp$M = Object.defineProperty;
815
815
  var __defProps$w = Object.defineProperties;
816
816
  var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
817
- var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
818
- var __hasOwnProp$N = Object.prototype.hasOwnProperty;
819
- var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
820
- var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
821
- var __spreadValues$N = (a, b) => {
817
+ var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
818
+ var __hasOwnProp$M = Object.prototype.hasOwnProperty;
819
+ var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
820
+ var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
821
+ var __spreadValues$M = (a, b) => {
822
822
  for (var prop in b || (b = {}))
823
- if (__hasOwnProp$N.call(b, prop))
824
- __defNormalProp$N(a, prop, b[prop]);
825
- if (__getOwnPropSymbols$N)
826
- for (var prop of __getOwnPropSymbols$N(b)) {
827
- if (__propIsEnum$N.call(b, prop))
828
- __defNormalProp$N(a, prop, b[prop]);
823
+ if (__hasOwnProp$M.call(b, prop))
824
+ __defNormalProp$M(a, prop, b[prop]);
825
+ if (__getOwnPropSymbols$M)
826
+ for (var prop of __getOwnPropSymbols$M(b)) {
827
+ if (__propIsEnum$M.call(b, prop))
828
+ __defNormalProp$M(a, prop, b[prop]);
829
829
  }
830
830
  return a;
831
831
  };
@@ -854,7 +854,7 @@ function isQueryController(s) {
854
854
  }
855
855
  class SceneQueryController extends SceneObjectBase {
856
856
  constructor(state = {}) {
857
- super(__spreadProps$w(__spreadValues$N({}, state), { isRunning: false }));
857
+ super(__spreadProps$w(__spreadValues$M({}, state), { isRunning: false }));
858
858
  this.isQueryController = true;
859
859
  this.profiler = new SceneRenderProfiler(this);
860
860
  __privateAdd$2(this, _running, /* @__PURE__ */ new Set());
@@ -935,25 +935,25 @@ function getQueryController(sceneObject) {
935
935
  return void 0;
936
936
  }
937
937
 
938
- var __defProp$M = Object.defineProperty;
939
- var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
940
- var __hasOwnProp$M = Object.prototype.hasOwnProperty;
941
- var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
942
- var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
943
- var __spreadValues$M = (a, b) => {
938
+ var __defProp$L = Object.defineProperty;
939
+ var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
940
+ var __hasOwnProp$L = Object.prototype.hasOwnProperty;
941
+ var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
942
+ var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
943
+ var __spreadValues$L = (a, b) => {
944
944
  for (var prop in b || (b = {}))
945
- if (__hasOwnProp$M.call(b, prop))
946
- __defNormalProp$M(a, prop, b[prop]);
947
- if (__getOwnPropSymbols$M)
948
- for (var prop of __getOwnPropSymbols$M(b)) {
949
- if (__propIsEnum$M.call(b, prop))
950
- __defNormalProp$M(a, prop, b[prop]);
945
+ if (__hasOwnProp$L.call(b, prop))
946
+ __defNormalProp$L(a, prop, b[prop]);
947
+ if (__getOwnPropSymbols$L)
948
+ for (var prop of __getOwnPropSymbols$L(b)) {
949
+ if (__propIsEnum$L.call(b, prop))
950
+ __defNormalProp$L(a, prop, b[prop]);
951
951
  }
952
952
  return a;
953
953
  };
954
954
  class SceneDataNode extends SceneObjectBase {
955
955
  constructor(state) {
956
- super(__spreadValues$M({
956
+ super(__spreadValues$L({
957
957
  data: emptyPanelData
958
958
  }, state));
959
959
  }
@@ -1087,19 +1087,19 @@ function isValid$1(value, roundUp, timeZone) {
1087
1087
  return parsed.isValid();
1088
1088
  }
1089
1089
 
1090
- var __defProp$L = Object.defineProperty;
1091
- var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
1092
- var __hasOwnProp$L = Object.prototype.hasOwnProperty;
1093
- var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
1094
- var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1095
- var __spreadValues$L = (a, b) => {
1090
+ var __defProp$K = Object.defineProperty;
1091
+ var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
1092
+ var __hasOwnProp$K = Object.prototype.hasOwnProperty;
1093
+ var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
1094
+ var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1095
+ var __spreadValues$K = (a, b) => {
1096
1096
  for (var prop in b || (b = {}))
1097
- if (__hasOwnProp$L.call(b, prop))
1098
- __defNormalProp$L(a, prop, b[prop]);
1099
- if (__getOwnPropSymbols$L)
1100
- for (var prop of __getOwnPropSymbols$L(b)) {
1101
- if (__propIsEnum$L.call(b, prop))
1102
- __defNormalProp$L(a, prop, b[prop]);
1097
+ if (__hasOwnProp$K.call(b, prop))
1098
+ __defNormalProp$K(a, prop, b[prop]);
1099
+ if (__getOwnPropSymbols$K)
1100
+ for (var prop of __getOwnPropSymbols$K(b)) {
1101
+ if (__propIsEnum$K.call(b, prop))
1102
+ __defNormalProp$K(a, prop, b[prop]);
1103
1103
  }
1104
1104
  return a;
1105
1105
  };
@@ -1118,7 +1118,7 @@ class SceneTimeRange extends SceneObjectBase {
1118
1118
  state.weekStart
1119
1119
  );
1120
1120
  const refreshOnActivate = (_a = state.refreshOnActivate) != null ? _a : { percent: 10 };
1121
- super(__spreadValues$L({ from, to, timeZone, value, refreshOnActivate }, state));
1121
+ super(__spreadValues$K({ from, to, timeZone, value, refreshOnActivate }, state));
1122
1122
  this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["from", "to", "timezone", "time", "time.window"] });
1123
1123
  this.onTimeRangeChange = (timeRange) => {
1124
1124
  const update = {};
@@ -2116,21 +2116,21 @@ function collectAllVariables(sceneObject, record = {}) {
2116
2116
  return record;
2117
2117
  }
2118
2118
 
2119
- var __defProp$K = Object.defineProperty;
2119
+ var __defProp$J = Object.defineProperty;
2120
2120
  var __defProps$v = Object.defineProperties;
2121
2121
  var __getOwnPropDescs$v = Object.getOwnPropertyDescriptors;
2122
- var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
2123
- var __hasOwnProp$K = Object.prototype.hasOwnProperty;
2124
- var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
2125
- var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2126
- var __spreadValues$K = (a, b) => {
2122
+ var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
2123
+ var __hasOwnProp$J = Object.prototype.hasOwnProperty;
2124
+ var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
2125
+ var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2126
+ var __spreadValues$J = (a, b) => {
2127
2127
  for (var prop in b || (b = {}))
2128
- if (__hasOwnProp$K.call(b, prop))
2129
- __defNormalProp$K(a, prop, b[prop]);
2130
- if (__getOwnPropSymbols$K)
2131
- for (var prop of __getOwnPropSymbols$K(b)) {
2132
- if (__propIsEnum$K.call(b, prop))
2133
- __defNormalProp$K(a, prop, b[prop]);
2128
+ if (__hasOwnProp$J.call(b, prop))
2129
+ __defNormalProp$J(a, prop, b[prop]);
2130
+ if (__getOwnPropSymbols$J)
2131
+ for (var prop of __getOwnPropSymbols$J(b)) {
2132
+ if (__propIsEnum$J.call(b, prop))
2133
+ __defNormalProp$J(a, prop, b[prop]);
2134
2134
  }
2135
2135
  return a;
2136
2136
  };
@@ -2150,7 +2150,7 @@ function getTemplateProxyForField(field, frame, frames) {
2150
2150
  if (!field.labels) {
2151
2151
  return "";
2152
2152
  }
2153
- return __spreadProps$v(__spreadValues$K({}, field.labels), {
2153
+ return __spreadProps$v(__spreadValues$J({}, field.labels), {
2154
2154
  __values: Object.values(field.labels).sort().join(", "),
2155
2155
  toString: () => {
2156
2156
  return data.formatLabels(field.labels, "", true);
@@ -2646,21 +2646,21 @@ function isExtraQueryProvider(obj) {
2646
2646
  return typeof obj === "object" && "getExtraQueries" in obj;
2647
2647
  }
2648
2648
 
2649
- var __defProp$J = Object.defineProperty;
2649
+ var __defProp$I = Object.defineProperty;
2650
2650
  var __defProps$u = Object.defineProperties;
2651
2651
  var __getOwnPropDescs$u = Object.getOwnPropertyDescriptors;
2652
- var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
2653
- var __hasOwnProp$J = Object.prototype.hasOwnProperty;
2654
- var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
2655
- var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2656
- var __spreadValues$J = (a, b) => {
2652
+ var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
2653
+ var __hasOwnProp$I = Object.prototype.hasOwnProperty;
2654
+ var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
2655
+ var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2656
+ var __spreadValues$I = (a, b) => {
2657
2657
  for (var prop in b || (b = {}))
2658
- if (__hasOwnProp$J.call(b, prop))
2659
- __defNormalProp$J(a, prop, b[prop]);
2660
- if (__getOwnPropSymbols$J)
2661
- for (var prop of __getOwnPropSymbols$J(b)) {
2662
- if (__propIsEnum$J.call(b, prop))
2663
- __defNormalProp$J(a, prop, b[prop]);
2658
+ if (__hasOwnProp$I.call(b, prop))
2659
+ __defNormalProp$I(a, prop, b[prop]);
2660
+ if (__getOwnPropSymbols$I)
2661
+ for (var prop of __getOwnPropSymbols$I(b)) {
2662
+ if (__propIsEnum$I.call(b, prop))
2663
+ __defNormalProp$I(a, prop, b[prop]);
2664
2664
  }
2665
2665
  return a;
2666
2666
  };
@@ -2677,7 +2677,7 @@ const extraQueryProcessingOperator = (processors) => (data) => {
2677
2677
  }),
2678
2678
  rxjs.map(([primary, ...processedSecondaries]) => {
2679
2679
  var _a;
2680
- return __spreadProps$u(__spreadValues$J({}, primary), {
2680
+ return __spreadProps$u(__spreadValues$I({}, primary), {
2681
2681
  series: [...primary.series, ...processedSecondaries.flatMap((s) => s.series)],
2682
2682
  annotations: [...(_a = primary.annotations) != null ? _a : [], ...processedSecondaries.flatMap((s) => {
2683
2683
  var _a2;
@@ -2688,21 +2688,21 @@ const extraQueryProcessingOperator = (processors) => (data) => {
2688
2688
  );
2689
2689
  };
2690
2690
 
2691
- var __defProp$I = Object.defineProperty;
2691
+ var __defProp$H = Object.defineProperty;
2692
2692
  var __defProps$t = Object.defineProperties;
2693
2693
  var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
2694
- var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
2695
- var __hasOwnProp$I = Object.prototype.hasOwnProperty;
2696
- var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
2697
- var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2698
- var __spreadValues$I = (a, b) => {
2694
+ var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
2695
+ var __hasOwnProp$H = Object.prototype.hasOwnProperty;
2696
+ var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
2697
+ var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2698
+ var __spreadValues$H = (a, b) => {
2699
2699
  for (var prop in b || (b = {}))
2700
- if (__hasOwnProp$I.call(b, prop))
2701
- __defNormalProp$I(a, prop, b[prop]);
2702
- if (__getOwnPropSymbols$I)
2703
- for (var prop of __getOwnPropSymbols$I(b)) {
2704
- if (__propIsEnum$I.call(b, prop))
2705
- __defNormalProp$I(a, prop, b[prop]);
2700
+ if (__hasOwnProp$H.call(b, prop))
2701
+ __defNormalProp$H(a, prop, b[prop]);
2702
+ if (__getOwnPropSymbols$H)
2703
+ for (var prop of __getOwnPropSymbols$H(b)) {
2704
+ if (__propIsEnum$H.call(b, prop))
2705
+ __defNormalProp$H(a, prop, b[prop]);
2706
2706
  }
2707
2707
  return a;
2708
2708
  };
@@ -2758,11 +2758,11 @@ function filterAnnotations(data, filters) {
2758
2758
  continue;
2759
2759
  }
2760
2760
  }
2761
- fields.push(__spreadProps$t(__spreadValues$I({}, field), {
2761
+ fields.push(__spreadProps$t(__spreadValues$H({}, field), {
2762
2762
  values: buffer
2763
2763
  }));
2764
2764
  }
2765
- processed.push(__spreadProps$t(__spreadValues$I({}, frame), {
2765
+ processed.push(__spreadProps$t(__spreadValues$H({}, frame), {
2766
2766
  fields,
2767
2767
  length: frameLength
2768
2768
  }));
@@ -2843,21 +2843,21 @@ function getOptionSearcher(options, includeAll = false) {
2843
2843
  return (search) => fuzzySearch(search).map((i) => allOptions[i]);
2844
2844
  }
2845
2845
 
2846
- var __defProp$H = Object.defineProperty;
2846
+ var __defProp$G = Object.defineProperty;
2847
2847
  var __defProps$s = Object.defineProperties;
2848
2848
  var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
2849
- var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
2850
- var __hasOwnProp$H = Object.prototype.hasOwnProperty;
2851
- var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
2852
- var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2853
- var __spreadValues$H = (a, b) => {
2849
+ var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
2850
+ var __hasOwnProp$G = Object.prototype.hasOwnProperty;
2851
+ var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
2852
+ var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2853
+ var __spreadValues$G = (a, b) => {
2854
2854
  for (var prop in b || (b = {}))
2855
- if (__hasOwnProp$H.call(b, prop))
2856
- __defNormalProp$H(a, prop, b[prop]);
2857
- if (__getOwnPropSymbols$H)
2858
- for (var prop of __getOwnPropSymbols$H(b)) {
2859
- if (__propIsEnum$H.call(b, prop))
2860
- __defNormalProp$H(a, prop, b[prop]);
2855
+ if (__hasOwnProp$G.call(b, prop))
2856
+ __defNormalProp$G(a, prop, b[prop]);
2857
+ if (__getOwnPropSymbols$G)
2858
+ for (var prop of __getOwnPropSymbols$G(b)) {
2859
+ if (__propIsEnum$G.call(b, prop))
2860
+ __defNormalProp$G(a, prop, b[prop]);
2861
2861
  }
2862
2862
  return a;
2863
2863
  };
@@ -2865,11 +2865,11 @@ var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
2865
2865
  var __objRest$4 = (source, exclude) => {
2866
2866
  var target = {};
2867
2867
  for (var prop in source)
2868
- if (__hasOwnProp$H.call(source, prop) && exclude.indexOf(prop) < 0)
2868
+ if (__hasOwnProp$G.call(source, prop) && exclude.indexOf(prop) < 0)
2869
2869
  target[prop] = source[prop];
2870
- if (source != null && __getOwnPropSymbols$H)
2871
- for (var prop of __getOwnPropSymbols$H(source)) {
2872
- if (exclude.indexOf(prop) < 0 && __propIsEnum$H.call(source, prop))
2870
+ if (source != null && __getOwnPropSymbols$G)
2871
+ for (var prop of __getOwnPropSymbols$G(source)) {
2872
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$G.call(source, prop))
2873
2873
  target[prop] = source[prop];
2874
2874
  }
2875
2875
  return target;
@@ -3030,7 +3030,7 @@ const OptionWithCheckbox = ({
3030
3030
  const theme = ui.useTheme2();
3031
3031
  const selectStyles = ui.getSelectStyles(theme);
3032
3032
  const optionStyles = ui.useStyles2(getOptionStyles);
3033
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$s(__spreadValues$H({
3033
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$s(__spreadValues$G({
3034
3034
  ref: innerRef,
3035
3035
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
3036
3036
  }, rest), {
@@ -3195,28 +3195,28 @@ function wrapInSafeSerializableSceneObject(sceneObject) {
3195
3195
  return { value: sceneObject, text: "__sceneObject" };
3196
3196
  }
3197
3197
 
3198
- var __defProp$G = Object.defineProperty;
3198
+ var __defProp$F = Object.defineProperty;
3199
3199
  var __defProps$r = Object.defineProperties;
3200
3200
  var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
3201
- var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
3202
- var __hasOwnProp$G = Object.prototype.hasOwnProperty;
3203
- var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
3204
- var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3205
- var __spreadValues$G = (a, b) => {
3201
+ var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
3202
+ var __hasOwnProp$F = Object.prototype.hasOwnProperty;
3203
+ var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
3204
+ var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3205
+ var __spreadValues$F = (a, b) => {
3206
3206
  for (var prop in b || (b = {}))
3207
- if (__hasOwnProp$G.call(b, prop))
3208
- __defNormalProp$G(a, prop, b[prop]);
3209
- if (__getOwnPropSymbols$G)
3210
- for (var prop of __getOwnPropSymbols$G(b)) {
3211
- if (__propIsEnum$G.call(b, prop))
3212
- __defNormalProp$G(a, prop, b[prop]);
3207
+ if (__hasOwnProp$F.call(b, prop))
3208
+ __defNormalProp$F(a, prop, b[prop]);
3209
+ if (__getOwnPropSymbols$F)
3210
+ for (var prop of __getOwnPropSymbols$F(b)) {
3211
+ if (__propIsEnum$F.call(b, prop))
3212
+ __defNormalProp$F(a, prop, b[prop]);
3213
3213
  }
3214
3214
  return a;
3215
3215
  };
3216
3216
  var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
3217
3217
  class GroupByVariable extends MultiValueVariable {
3218
3218
  constructor(initialState) {
3219
- super(__spreadProps$r(__spreadValues$G({
3219
+ super(__spreadProps$r(__spreadValues$F({
3220
3220
  isMulti: true,
3221
3221
  name: "",
3222
3222
  value: [],
@@ -3247,7 +3247,7 @@ class GroupByVariable extends MultiValueVariable {
3247
3247
  const queries = getQueriesForVariables(this);
3248
3248
  const otherFilters = this.state.baseFilters || [];
3249
3249
  const timeRange = sceneGraph.getTimeRange(this).state.value;
3250
- const response = await ds.getTagKeys(__spreadValues$G({
3250
+ const response = await ds.getTagKeys(__spreadValues$F({
3251
3251
  filters: otherFilters,
3252
3252
  queries,
3253
3253
  timeRange
@@ -3608,19 +3608,19 @@ function getAdhocOptionSearcher(options) {
3608
3608
  return (search) => fuzzySearch(search).map((i) => options[i]);
3609
3609
  }
3610
3610
 
3611
- var __defProp$F = Object.defineProperty;
3612
- var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
3613
- var __hasOwnProp$F = Object.prototype.hasOwnProperty;
3614
- var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
3615
- var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3616
- var __spreadValues$F = (a, b) => {
3611
+ var __defProp$E = Object.defineProperty;
3612
+ var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
3613
+ var __hasOwnProp$E = Object.prototype.hasOwnProperty;
3614
+ var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
3615
+ var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3616
+ var __spreadValues$E = (a, b) => {
3617
3617
  for (var prop in b || (b = {}))
3618
- if (__hasOwnProp$F.call(b, prop))
3619
- __defNormalProp$F(a, prop, b[prop]);
3620
- if (__getOwnPropSymbols$F)
3621
- for (var prop of __getOwnPropSymbols$F(b)) {
3622
- if (__propIsEnum$F.call(b, prop))
3623
- __defNormalProp$F(a, prop, b[prop]);
3618
+ if (__hasOwnProp$E.call(b, prop))
3619
+ __defNormalProp$E(a, prop, b[prop]);
3620
+ if (__getOwnPropSymbols$E)
3621
+ for (var prop of __getOwnPropSymbols$E(b)) {
3622
+ if (__propIsEnum$E.call(b, prop))
3623
+ __defNormalProp$E(a, prop, b[prop]);
3624
3624
  }
3625
3625
  return a;
3626
3626
  };
@@ -3632,7 +3632,7 @@ function keyLabelToOption(key, label) {
3632
3632
  }
3633
3633
  const filterNoOp = () => true;
3634
3634
  function AdHocFilterRenderer({ filter, model }) {
3635
- var _a, _b, _c, _d, _e;
3635
+ var _a, _b, _c;
3636
3636
  const styles = ui.useStyles2(getStyles$f);
3637
3637
  const [keys, setKeys] = React.useState([]);
3638
3638
  const [values, setValues] = React.useState([]);
@@ -3709,9 +3709,10 @@ function AdHocFilterRenderer({ filter, model }) {
3709
3709
  });
3710
3710
  }
3711
3711
  };
3712
- const valueSelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, __spreadValues$F({
3712
+ const valueSelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, __spreadValues$E({
3713
3713
  virtualized: true,
3714
- allowCustomValue: (_b = model.state.allowCustomValue) != null ? _b : true,
3714
+ allowCustomValue: model.state.allowCustomValue !== false,
3715
+ createOptionPosition: model.state.allowCustomValue === "first" ? "first" : "last",
3715
3716
  isValidNewOption: (inputValue) => inputValue.trim().length > 0,
3716
3717
  allowCreateWhileLoading: true,
3717
3718
  formatCreateLabel: (inputValue) => `Use custom value: ${inputValue}`,
@@ -3761,7 +3762,8 @@ function AdHocFilterRenderer({ filter, model }) {
3761
3762
  disabled: model.state.readOnly,
3762
3763
  className: css.cx(styles.key, isKeysOpen ? styles.widthWhenOpen : void 0),
3763
3764
  width: "auto",
3764
- allowCustomValue: (_c = model.state.allowCustomValue) != null ? _c : true,
3765
+ allowCustomValue: model.state.allowCustomValue !== false,
3766
+ createOptionPosition: model.state.allowCustomValue === "first" ? "first" : "last",
3765
3767
  value: keyValue,
3766
3768
  placeholder: "Select label",
3767
3769
  options: handleOptionGroups(keys),
@@ -3814,7 +3816,7 @@ function AdHocFilterRenderer({ filter, model }) {
3814
3816
  if (filter.key) {
3815
3817
  const label = /* @__PURE__ */ React__default["default"].createElement(ControlsLabel, {
3816
3818
  layout: "vertical",
3817
- label: (_d = filter.key) != null ? _d : "",
3819
+ label: (_b = filter.key) != null ? _b : "",
3818
3820
  onRemove: () => model._removeFilter(filter)
3819
3821
  });
3820
3822
  return /* @__PURE__ */ React__default["default"].createElement(ui.Field, {
@@ -3841,7 +3843,7 @@ function AdHocFilterRenderer({ filter, model }) {
3841
3843
  title: "Remove filter",
3842
3844
  className: styles.removeButton,
3843
3845
  icon: "times",
3844
- "data-testid": `AdHocFilter-remove-${(_e = filter.key) != null ? _e : ""}`,
3846
+ "data-testid": `AdHocFilter-remove-${(_c = filter.key) != null ? _c : ""}`,
3845
3847
  onClick: () => model._removeFilter(filter)
3846
3848
  }));
3847
3849
  }
@@ -3923,78 +3925,37 @@ function AdHocFilterBuilder({ model, addFilterButtonText }) {
3923
3925
  });
3924
3926
  }
3925
3927
 
3926
- var __defProp$E = Object.defineProperty;
3927
- var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
3928
- var __hasOwnProp$E = Object.prototype.hasOwnProperty;
3929
- var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
3930
- var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3931
- var __spreadValues$E = (a, b) => {
3932
- for (var prop in b || (b = {}))
3933
- if (__hasOwnProp$E.call(b, prop))
3934
- __defNormalProp$E(a, prop, b[prop]);
3935
- if (__getOwnPropSymbols$E)
3936
- for (var prop of __getOwnPropSymbols$E(b)) {
3937
- if (__propIsEnum$E.call(b, prop))
3938
- __defNormalProp$E(a, prop, b[prop]);
3939
- }
3940
- return a;
3941
- };
3942
3928
  class AdHocFiltersVariableUrlSyncHandler {
3943
3929
  constructor(_variable) {
3944
3930
  this._variable = _variable;
3945
3931
  }
3946
- getKey(isInjected) {
3947
- if (isInjected) {
3948
- return `var-injected-${this._variable.state.name}`;
3949
- }
3932
+ getKey() {
3950
3933
  return `var-${this._variable.state.name}`;
3951
3934
  }
3952
3935
  getKeys() {
3953
- return [this.getKey(), this.getKey(true)];
3936
+ return [this.getKey()];
3954
3937
  }
3955
3938
  getUrlState() {
3956
3939
  const filters = this._variable.state.filters;
3957
- const baseFilters = this._variable.state.baseFilters;
3958
- let value = [""];
3959
- let baseValues = [""];
3960
- if (filters.length === 0 && (baseFilters == null ? void 0 : baseFilters.length) === 0) {
3961
- return { [this.getKey()]: value };
3940
+ if (filters.length === 0) {
3941
+ return { [this.getKey()]: [""] };
3962
3942
  }
3963
- if (filters.length) {
3964
- value = filters.filter(isFilterComplete).filter((filter) => !filter.hidden).map((filter) => toArray(filter).map(escapeUrlPipeDelimiters).join("|"));
3965
- }
3966
- if (baseFilters == null ? void 0 : baseFilters.length) {
3967
- baseValues = baseFilters == null ? void 0 : baseFilters.filter(isFilterComplete).filter((filter) => !filter.hidden && filter.origin).map(
3968
- (filter) => {
3969
- var _a, _b;
3970
- return toArray(filter).map(escapeUrlPipeDelimiters).join("|").concat(`/${(_b = (_a = filter.originalValue) == null ? void 0 : _a.map(escapeUrlPipeDelimiters).join("|")) != null ? _b : ""}/${filter.origin}`);
3971
- }
3972
- );
3973
- }
3974
- return __spreadValues$E({
3975
- [this.getKey()]: value
3976
- }, (baseFilters == null ? void 0 : baseFilters.length) ? { [this.getKey(true)]: baseValues } : {});
3943
+ const value = filters.filter(isFilterComplete).filter((filter) => !filter.hidden).map((filter) => toArray(filter).map(escapeUrlPipeDelimiters).join("|"));
3944
+ return { [this.getKey()]: value };
3977
3945
  }
3978
3946
  updateFromUrl(values) {
3979
3947
  const urlValue = values[this.getKey()];
3980
- const urlValueBaseFilters = values[this.getKey(true)];
3981
- if (urlValue == null && urlValueBaseFilters == null) {
3948
+ if (urlValue == null) {
3982
3949
  return;
3983
3950
  }
3984
- if (urlValue) {
3985
- const filters = deserializeUrlToFilters(urlValue);
3986
- this._variable.setState({ filters });
3987
- }
3988
- if (urlValueBaseFilters) {
3989
- const baseFilters = deserializeUrlToFilters(urlValueBaseFilters);
3990
- this._variable.setState({ baseFilters });
3991
- }
3951
+ const filters = deserializeUrlToFilters(urlValue);
3952
+ this._variable.setState({ filters });
3992
3953
  }
3993
3954
  }
3994
3955
  function deserializeUrlToFilters(value) {
3995
3956
  if (Array.isArray(value)) {
3996
3957
  const values = value;
3997
- return values.map((value2) => toFilter(value2)).filter(isFilter);
3958
+ return values.map(toFilter).filter(isFilter);
3998
3959
  }
3999
3960
  const filter = toFilter(value);
4000
3961
  return filter === null ? [] : [filter];
@@ -4013,12 +3974,10 @@ function toArray(filter) {
4013
3974
  return result;
4014
3975
  }
4015
3976
  function toFilter(urlValue) {
4016
- var _a;
4017
3977
  if (typeof urlValue !== "string" || urlValue.length === 0) {
4018
3978
  return null;
4019
3979
  }
4020
- const [filter, originalValues, origin] = urlValue.split("/");
4021
- const [key, keyLabel, operator, _operatorLabel, ...values] = filter.split("|").reduce((acc, v) => {
3980
+ const [key, keyLabel, operator, _operatorLabel, ...values] = urlValue.split("|").reduce((acc, v) => {
4022
3981
  const [key2, label] = v.split(",");
4023
3982
  acc.push(key2, label != null ? label : key2);
4024
3983
  return acc;
@@ -4030,9 +3989,7 @@ function toFilter(urlValue) {
4030
3989
  value: values[0],
4031
3990
  values: isMultiValueOperator(operator) ? values.filter((_, index) => index % 2 === 0) : void 0,
4032
3991
  valueLabels: values.filter((_, index) => index % 2 === 1),
4033
- condition: "",
4034
- origin,
4035
- originalValue: originalValues && originalValues.length ? (_a = originalValues.split("|")) != null ? _a : [originalValues] : void 0
3992
+ condition: ""
4036
3993
  };
4037
3994
  }
4038
3995
  function isFilter(filter) {
@@ -4657,11 +4614,19 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4657
4614
  handleOptionGroups(optionsSearcher(preventFiltering ? "" : inputValue, filterInputType))
4658
4615
  );
4659
4616
  if (allowCustomValue && filterInputType !== "operator" && inputValue) {
4660
- filteredDropDownItems.push({
4661
- value: inputValue.trim(),
4662
- label: inputValue.trim(),
4663
- isCustom: true
4664
- });
4617
+ if (allowCustomValue === "first") {
4618
+ filteredDropDownItems.unshift({
4619
+ value: inputValue.trim(),
4620
+ label: inputValue.trim(),
4621
+ isCustom: true
4622
+ });
4623
+ } else {
4624
+ filteredDropDownItems.push({
4625
+ value: inputValue.trim(),
4626
+ label: inputValue.trim(),
4627
+ isCustom: true
4628
+ });
4629
+ }
4665
4630
  }
4666
4631
  const onAddCustomValue = model.state.onAddCustomValue;
4667
4632
  const maxOptionWidth = setupDropdownAccessibility(filteredDropDownItems, listRef, disabledIndicesRef);
@@ -5167,13 +5132,13 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
5167
5132
  const handleChangeViewMode = React.useCallback(
5168
5133
  (event, shouldFocusOnPillWrapperOverride) => {
5169
5134
  event == null ? void 0 : event.stopPropagation();
5170
- if (readOnly) {
5135
+ if (readOnly || filter.origin) {
5171
5136
  return;
5172
5137
  }
5173
5138
  setShouldFocusOnPillWrapper(shouldFocusOnPillWrapperOverride != null ? shouldFocusOnPillWrapperOverride : !viewMode);
5174
5139
  setViewMode(!viewMode);
5175
5140
  },
5176
- [readOnly, viewMode]
5141
+ [readOnly, viewMode, filter.origin]
5177
5142
  );
5178
5143
  React.useEffect(() => {
5179
5144
  var _a2;
@@ -5237,20 +5202,11 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
5237
5202
  size: "md",
5238
5203
  className: styles.pillIcon,
5239
5204
  tooltip: `Remove filter with key ${keyLabel}`
5240
- }) : null, filter.origin && !filter.originalValue && /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
5205
+ }) : null, filter.origin && /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
5241
5206
  name: "info-circle",
5242
5207
  size: "md",
5243
5208
  className: styles.pillIcon,
5244
5209
  tooltip: `This is a ${filter.origin} injected filter`
5245
- }), filter.origin && filter.originalValue && /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
5246
- onClick: (e) => {
5247
- e.stopPropagation();
5248
- model.restoreBaseFilter(filter);
5249
- },
5250
- name: "history",
5251
- size: "md",
5252
- className: styles.pillIcon,
5253
- tooltip: `Restore filter to its original value`
5254
5210
  }));
5255
5211
  }
5256
5212
  return /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
@@ -5465,13 +5421,9 @@ class AdHocFiltersVariable extends SceneObjectBase {
5465
5421
  }
5466
5422
  }
5467
5423
  setState(update) {
5468
- var _a, _b, _c;
5469
5424
  let filterExpressionChanged = false;
5470
- if ((update.filters && update.filters !== this.state.filters || update.baseFilters && update.baseFilters !== this.state.baseFilters) && !update.filterExpression) {
5471
- update.filterExpression = renderExpression(this.state.expressionBuilder, [
5472
- ...(_b = (_a = update.baseFilters) == null ? void 0 : _a.filter((filter) => filter.origin)) != null ? _b : [],
5473
- ...(_c = update.filters) != null ? _c : []
5474
- ]);
5425
+ if (update.filters && update.filters !== this.state.filters && !update.filterExpression) {
5426
+ update.filterExpression = renderExpression(this.state.expressionBuilder, update.filters);
5475
5427
  filterExpressionChanged = update.filterExpression !== this.state.filterExpression;
5476
5428
  }
5477
5429
  super.setState(update);
@@ -5494,36 +5446,11 @@ class AdHocFiltersVariable extends SceneObjectBase {
5494
5446
  this.publishEvent(new SceneVariableValueChangedEvent(this), true);
5495
5447
  }
5496
5448
  }
5497
- restoreBaseFilter(filter) {
5498
- if (filter) {
5499
- const originalBaseFilter = filter.originalValue;
5500
- if (originalBaseFilter == null ? void 0 : originalBaseFilter.length) {
5501
- this._updateFilter(filter, {
5502
- value: originalBaseFilter[0],
5503
- values: originalBaseFilter,
5504
- valueLabels: originalBaseFilter,
5505
- originalValue: void 0
5506
- });
5507
- }
5508
- }
5509
- }
5510
5449
  getValue() {
5511
5450
  return this.state.filterExpression;
5512
5451
  }
5513
5452
  _updateFilter(filter, update) {
5514
- var _a;
5515
- const { baseFilters, filters, _wip } = this.state;
5516
- const isBaseFilter = baseFilters == null ? void 0 : baseFilters.includes(filter);
5517
- if (isBaseFilter && filter.origin) {
5518
- if (!filter.originalValue) {
5519
- update.originalValue = filter.values ? filter.values : [filter.value];
5520
- }
5521
- const updatedBaseFilters = (_a = baseFilters == null ? void 0 : baseFilters.map((f) => {
5522
- return f === filter ? __spreadValues$z(__spreadValues$z({}, f), update) : f;
5523
- })) != null ? _a : [];
5524
- this.setState({ baseFilters: updatedBaseFilters });
5525
- return;
5526
- }
5453
+ const { filters, _wip } = this.state;
5527
5454
  if (filter === _wip) {
5528
5455
  if ("value" in update && update["value"] !== "") {
5529
5456
  this.setState({ filters: [...filters, __spreadValues$z(__spreadValues$z({}, _wip), update)], _wip: void 0 });
@@ -5609,7 +5536,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
5609
5536
  return keys.map(toSelectableValue);
5610
5537
  }
5611
5538
  async _getValuesFor(filter) {
5612
- var _a, _b, _c, _d;
5539
+ var _a, _b, _c;
5613
5540
  const override = await ((_b = (_a = this.state).getTagValuesProvider) == null ? void 0 : _b.call(_a, this, filter));
5614
5541
  if (override && override.replace) {
5615
5542
  return dataFromResponse(override.values).map(toSelectableValue);
@@ -5618,8 +5545,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
5618
5545
  if (!ds || !ds.getTagValues) {
5619
5546
  return [];
5620
5547
  }
5621
- const filteredBaseFilters = (_d = (_c = this.state.baseFilters) == null ? void 0 : _c.filter((f) => f.origin && f.key !== filter.key)) != null ? _d : [];
5622
- const otherFilters = this.state.filters.filter((f) => f.key !== filter.key).concat(filteredBaseFilters);
5548
+ const otherFilters = this.state.filters.filter((f) => f.key !== filter.key).concat((_c = this.state.baseFilters) != null ? _c : []);
5623
5549
  const timeRange = sceneGraph.getTimeRange(this).state.value;
5624
5550
  const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : void 0;
5625
5551
  const response = await ds.getTagValues(__spreadValues$z({