@infinilabs/discover 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/{common-CelpNJ_P.cjs → common-DFB-Krii.cjs} +6 -6
  2. package/dist/{common-6ueRhcZj.js → common-JxI0fO97.js} +273 -268
  3. package/dist/{components-BZTcWo0D.js → components-BtZfYCUr.js} +216 -148
  4. package/dist/{components-DzA4fVqH.cjs → components-w0oW3GpQ.cjs} +46 -44
  5. package/dist/{filter_label-DALDJinr.js → filter_label-BOgCXkdp.js} +2 -2
  6. package/dist/{filter_label-306D4xEc.cjs → filter_label-BVGFM735.cjs} +1 -1
  7. package/dist/{filter_operators-B5A15sKd.cjs → filter_operators-C_4il2ok.cjs} +1 -1
  8. package/dist/{filter_operators-DuazgKuH.js → filter_operators-f_RipGT3.js} +1 -1
  9. package/dist/index.cjs +2 -2
  10. package/dist/index.js +4 -4
  11. package/dist/public-BfModHE8.cjs +3 -0
  12. package/dist/public-seOSIZPc.js +1772 -0
  13. package/dist/{query_bar_top_row-DaHCNARQ.js → query_bar_top_row-D5J6N5L2.js} +2 -2
  14. package/dist/{query_bar_top_row-hkYli4mo.cjs → query_bar_top_row-DigJljNX.cjs} +1 -1
  15. package/dist/{query_bar_top_row-Dzd1EBWC.js → query_bar_top_row-Dp4-frN1.js} +5 -5
  16. package/dist/query_bar_top_row-GViVxtYa.cjs +1 -0
  17. package/dist/{query_string_input-o_vEPSg2.js → query_string_input-BP2qq9Lf.js} +3 -3
  18. package/dist/{query_string_input-jELi9JGI.cjs → query_string_input-DpPUCiXF.cjs} +1 -1
  19. package/dist/query_string_input-DvXZHDE9.cjs +1 -0
  20. package/dist/{query_string_input-B6lvPXEY.js → query_string_input-uI_z3PwX.js} +1 -1
  21. package/dist/{search_bar-aRdyo2C0.cjs → search_bar-BcYGmNoo.cjs} +1 -1
  22. package/dist/{search_bar-Ho9D93zT.js → search_bar-DZMeLETx.js} +6 -6
  23. package/package.json +1 -1
  24. package/dist/public-BWdftR10.cjs +0 -3
  25. package/dist/public-kDgoH8_s.js +0 -1781
  26. package/dist/query_bar_top_row-DFBab9DF.cjs +0 -1
  27. package/dist/query_string_input-wee-LHxT.cjs +0 -1
@@ -1,1781 +0,0 @@
1
- import { n as __esmMin, o as __toESM } from "./chunk-D-4zIDrl.js";
2
- import { f as withKibana, p as toMountPoint, r as getUiSettings, s as require_query_string } from "./services-C8UxrSbr.js";
3
- import { t as require_lodash } from "./lodash-Gv_ptthU.js";
4
- import { a as ILLEGAL_CHARACTERS_VISIBLE, i as ILLEGAL_CHARACTERS_KEY, l as IndexPatternMissingIndices, n as CONTAINS_SPACES_KEY, o as isDefault, r as ILLEGAL_CHARACTERS, s as getFromSavedObject, t as validateIndexPattern } from "./lib-Cdf3LT56.js";
5
- import { A as formatHitProvider, B as nodeTypes, C as intervalOptions, D as COMPARE_ALL_OPTIONS, E as uniqFilters, F as baseFormatters, G as isQueryStringFilter, H as toElasticsearchQuery, I as FieldFormat, K as FilterStateStore, L as KBN_FIELD_TYPES, M as isFilterable, N as isNestedField, O as compareFilters, R as FIELD_FORMAT_IDS, T as getTime, V as fromKueryExpression, W as FILTERS, X as isFilterPinned, _ as isValidEsInterval, _t as buildFilter, a as termsAggFilter, at as isScriptedRangeFilter, b as InvalidEsIntervalFormatError, bt as init_moment, c as isType, ct as getPhraseFilterValue, d as propFilter, f as Ipv4Address, g as isValidInterval, h as parseInterval, ht as isExistsFilter, i as parentPipelineType, it as isRangeFilter, j as flattenHitWrapper, l as CidrMask, lt as isPhraseFilter, m as toAbsoluteDates, mt as isGeoBoundingBoxFilter, n as tabifyGetColumns, o as isNumberType, ot as isPhrasesFilter, p as getFormatWithAggs, pt as isGeoPolygonFilter, r as siblingPipelineType, rt as isMissingFilter, s as isStringType, st as getPhraseFilterField, t as tabifyAggResponse, tt as isMatchAllFilter, u as isDateHistogramBucketAggConfig, ut as isScriptedPhraseFilter, v as dateHistogramInterval, vt as UI_SETTINGS, w as calculateBounds, x as InvalidEsCalendarIntervalError, xt as moment_default, y as parseEsInterval } from "./common-6ueRhcZj.js";
6
- import React, { useEffect, useRef, useState } from "react";
7
- import { theme } from "antd";
8
- import { EuiButton, EuiCallOut, EuiCodeBlock, EuiFlexGroup, EuiFlexItem, EuiSpacer } from "@elastic/eui";
9
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
- import dateMath from "@elastic/datemath";
11
- function __extends(f, V) {
12
- if (typeof V != "function" && V !== null) throw TypeError("Class extends value " + String(V) + " is not a constructor or null");
13
- extendStatics(f, V);
14
- function H() {
15
- this.constructor = f;
16
- }
17
- f.prototype = V === null ? Object.create(V) : (H.prototype = V.prototype, new H());
18
- }
19
- function __values(f) {
20
- var V = typeof Symbol == "function" && Symbol.iterator, H = V && f[V], U = 0;
21
- if (H) return H.call(f);
22
- if (f && typeof f.length == "number") return { next: function() {
23
- return f && U >= f.length && (f = void 0), {
24
- value: f && f[U++],
25
- done: !f
26
- };
27
- } };
28
- throw TypeError(V ? "Object is not iterable." : "Symbol.iterator is not defined.");
29
- }
30
- function __read(f, V) {
31
- var H = typeof Symbol == "function" && f[Symbol.iterator];
32
- if (!H) return f;
33
- var U = H.call(f), W, G = [], K;
34
- try {
35
- for (; (V === void 0 || V-- > 0) && !(W = U.next()).done;) G.push(W.value);
36
- } catch (f) {
37
- K = { error: f };
38
- } finally {
39
- try {
40
- W && !W.done && (H = U.return) && H.call(U);
41
- } finally {
42
- if (K) throw K.error;
43
- }
44
- }
45
- return G;
46
- }
47
- function __spreadArray(f, V, H) {
48
- if (H || arguments.length === 2) for (var U = 0, W = V.length, G; U < W; U++) (G || !(U in V)) && (G ||= Array.prototype.slice.call(V, 0, U), G[U] = V[U]);
49
- return f.concat(G || Array.prototype.slice.call(V));
50
- }
51
- var extendStatics, init_tslib_es6 = __esmMin((() => {
52
- extendStatics = function(f, V) {
53
- return extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(f, V) {
54
- f.__proto__ = V;
55
- } || function(f, V) {
56
- for (var H in V) Object.prototype.hasOwnProperty.call(V, H) && (f[H] = V[H]);
57
- }, extendStatics(f, V);
58
- };
59
- }));
60
- function isFunction(f) {
61
- return typeof f == "function";
62
- }
63
- function createErrorClass(f) {
64
- var V = f(function(f) {
65
- Error.call(f), f.stack = (/* @__PURE__ */ Error()).stack;
66
- });
67
- return V.prototype = Object.create(Error.prototype), V.prototype.constructor = V, V;
68
- }
69
- var UnsubscriptionError = createErrorClass(function(f) {
70
- return function(V) {
71
- f(this), this.message = V ? V.length + " errors occurred during unsubscription:\n" + V.map(function(f, V) {
72
- return V + 1 + ") " + f.toString();
73
- }).join("\n ") : "", this.name = "UnsubscriptionError", this.errors = V;
74
- };
75
- });
76
- function arrRemove(f, V) {
77
- if (f) {
78
- var H = f.indexOf(V);
79
- 0 <= H && f.splice(H, 1);
80
- }
81
- }
82
- init_tslib_es6();
83
- var Subscription = function() {
84
- function f(f) {
85
- this.initialTeardown = f, this.closed = !1, this._parentage = null, this._finalizers = null;
86
- }
87
- return f.prototype.unsubscribe = function() {
88
- var f, V, H, U, W;
89
- if (!this.closed) {
90
- this.closed = !0;
91
- var G = this._parentage;
92
- if (G) if (this._parentage = null, Array.isArray(G)) try {
93
- for (var K = __values(G), q = K.next(); !q.done; q = K.next()) q.value.remove(this);
94
- } catch (V) {
95
- f = { error: V };
96
- } finally {
97
- try {
98
- q && !q.done && (V = K.return) && V.call(K);
99
- } finally {
100
- if (f) throw f.error;
101
- }
102
- }
103
- else G.remove(this);
104
- var J = this.initialTeardown;
105
- if (isFunction(J)) try {
106
- J();
107
- } catch (f) {
108
- W = f instanceof UnsubscriptionError ? f.errors : [f];
109
- }
110
- var Y = this._finalizers;
111
- if (Y) {
112
- this._finalizers = null;
113
- try {
114
- for (var X = __values(Y), Z = X.next(); !Z.done; Z = X.next()) {
115
- var Q = Z.value;
116
- try {
117
- execFinalizer(Q);
118
- } catch (f) {
119
- W ??= [], f instanceof UnsubscriptionError ? W = __spreadArray(__spreadArray([], __read(W)), __read(f.errors)) : W.push(f);
120
- }
121
- }
122
- } catch (f) {
123
- H = { error: f };
124
- } finally {
125
- try {
126
- Z && !Z.done && (U = X.return) && U.call(X);
127
- } finally {
128
- if (H) throw H.error;
129
- }
130
- }
131
- }
132
- if (W) throw new UnsubscriptionError(W);
133
- }
134
- }, f.prototype.add = function(V) {
135
- if (V && V !== this) if (this.closed) execFinalizer(V);
136
- else {
137
- if (V instanceof f) {
138
- if (V.closed || V._hasParent(this)) return;
139
- V._addParent(this);
140
- }
141
- (this._finalizers = this._finalizers ?? []).push(V);
142
- }
143
- }, f.prototype._hasParent = function(f) {
144
- var V = this._parentage;
145
- return V === f || Array.isArray(V) && V.includes(f);
146
- }, f.prototype._addParent = function(f) {
147
- var V = this._parentage;
148
- this._parentage = Array.isArray(V) ? (V.push(f), V) : V ? [V, f] : f;
149
- }, f.prototype._removeParent = function(f) {
150
- var V = this._parentage;
151
- V === f ? this._parentage = null : Array.isArray(V) && arrRemove(V, f);
152
- }, f.prototype.remove = function(V) {
153
- var H = this._finalizers;
154
- H && arrRemove(H, V), V instanceof f && V._removeParent(this);
155
- }, f.EMPTY = (function() {
156
- var V = new f();
157
- return V.closed = !0, V;
158
- })(), f;
159
- }(), EMPTY_SUBSCRIPTION = Subscription.EMPTY;
160
- function isSubscription(f) {
161
- return f instanceof Subscription || f && "closed" in f && isFunction(f.remove) && isFunction(f.add) && isFunction(f.unsubscribe);
162
- }
163
- function execFinalizer(f) {
164
- isFunction(f) ? f() : f.unsubscribe();
165
- }
166
- var config = {
167
- onUnhandledError: null,
168
- onStoppedNotification: null,
169
- Promise: void 0,
170
- useDeprecatedSynchronousErrorHandling: !1,
171
- useDeprecatedNextContext: !1
172
- };
173
- init_tslib_es6();
174
- var timeoutProvider = {
175
- setTimeout: function(f, V) {
176
- var H = [...arguments].slice(2), U = timeoutProvider.delegate;
177
- return U?.setTimeout ? U.setTimeout.apply(U, __spreadArray([f, V], __read(H))) : setTimeout.apply(void 0, __spreadArray([f, V], __read(H)));
178
- },
179
- clearTimeout: function(f) {
180
- return (timeoutProvider.delegate?.clearTimeout || clearTimeout)(f);
181
- },
182
- delegate: void 0
183
- };
184
- function reportUnhandledError(f) {
185
- timeoutProvider.setTimeout(function() {
186
- var V = config.onUnhandledError;
187
- if (V) V(f);
188
- else throw f;
189
- });
190
- }
191
- function noop$3() {}
192
- var COMPLETE_NOTIFICATION = (function() {
193
- return createNotification("C", void 0, void 0);
194
- })();
195
- function errorNotification(f) {
196
- return createNotification("E", void 0, f);
197
- }
198
- function nextNotification(f) {
199
- return createNotification("N", f, void 0);
200
- }
201
- function createNotification(f, V, H) {
202
- return {
203
- kind: f,
204
- value: V,
205
- error: H
206
- };
207
- }
208
- var context = null;
209
- function errorContext(f) {
210
- if (config.useDeprecatedSynchronousErrorHandling) {
211
- var V = !context;
212
- if (V && (context = {
213
- errorThrown: !1,
214
- error: null
215
- }), f(), V) {
216
- var H = context, U = H.errorThrown, W = H.error;
217
- if (context = null, U) throw W;
218
- }
219
- } else f();
220
- }
221
- function captureError(f) {
222
- config.useDeprecatedSynchronousErrorHandling && context && (context.errorThrown = !0, context.error = f);
223
- }
224
- init_tslib_es6();
225
- var Subscriber = function(f) {
226
- __extends(V, f);
227
- function V(V) {
228
- var H = f.call(this) || this;
229
- return H.isStopped = !1, V ? (H.destination = V, isSubscription(V) && V.add(H)) : H.destination = EMPTY_OBSERVER, H;
230
- }
231
- return V.create = function(f, V, H) {
232
- return new SafeSubscriber(f, V, H);
233
- }, V.prototype.next = function(f) {
234
- this.isStopped ? handleStoppedNotification(nextNotification(f), this) : this._next(f);
235
- }, V.prototype.error = function(f) {
236
- this.isStopped ? handleStoppedNotification(errorNotification(f), this) : (this.isStopped = !0, this._error(f));
237
- }, V.prototype.complete = function() {
238
- this.isStopped ? handleStoppedNotification(COMPLETE_NOTIFICATION, this) : (this.isStopped = !0, this._complete());
239
- }, V.prototype.unsubscribe = function() {
240
- this.closed || (this.isStopped = !0, f.prototype.unsubscribe.call(this), this.destination = null);
241
- }, V.prototype._next = function(f) {
242
- this.destination.next(f);
243
- }, V.prototype._error = function(f) {
244
- try {
245
- this.destination.error(f);
246
- } finally {
247
- this.unsubscribe();
248
- }
249
- }, V.prototype._complete = function() {
250
- try {
251
- this.destination.complete();
252
- } finally {
253
- this.unsubscribe();
254
- }
255
- }, V;
256
- }(Subscription), _bind = Function.prototype.bind;
257
- function bind(f, V) {
258
- return _bind.call(f, V);
259
- }
260
- var ConsumerObserver = function() {
261
- function f(f) {
262
- this.partialObserver = f;
263
- }
264
- return f.prototype.next = function(f) {
265
- var V = this.partialObserver;
266
- if (V.next) try {
267
- V.next(f);
268
- } catch (f) {
269
- handleUnhandledError(f);
270
- }
271
- }, f.prototype.error = function(f) {
272
- var V = this.partialObserver;
273
- if (V.error) try {
274
- V.error(f);
275
- } catch (f) {
276
- handleUnhandledError(f);
277
- }
278
- else handleUnhandledError(f);
279
- }, f.prototype.complete = function() {
280
- var f = this.partialObserver;
281
- if (f.complete) try {
282
- f.complete();
283
- } catch (f) {
284
- handleUnhandledError(f);
285
- }
286
- }, f;
287
- }(), SafeSubscriber = function(f) {
288
- __extends(V, f);
289
- function V(V, H, U) {
290
- var W = f.call(this) || this, G;
291
- if (isFunction(V) || !V) G = {
292
- next: V ?? void 0,
293
- error: H ?? void 0,
294
- complete: U ?? void 0
295
- };
296
- else {
297
- var K;
298
- W && config.useDeprecatedNextContext ? (K = Object.create(V), K.unsubscribe = function() {
299
- return W.unsubscribe();
300
- }, G = {
301
- next: V.next && bind(V.next, K),
302
- error: V.error && bind(V.error, K),
303
- complete: V.complete && bind(V.complete, K)
304
- }) : G = V;
305
- }
306
- return W.destination = new ConsumerObserver(G), W;
307
- }
308
- return V;
309
- }(Subscriber);
310
- function handleUnhandledError(f) {
311
- config.useDeprecatedSynchronousErrorHandling ? captureError(f) : reportUnhandledError(f);
312
- }
313
- function defaultErrorHandler(f) {
314
- throw f;
315
- }
316
- function handleStoppedNotification(f, V) {
317
- var H = config.onStoppedNotification;
318
- H && timeoutProvider.setTimeout(function() {
319
- return H(f, V);
320
- });
321
- }
322
- var EMPTY_OBSERVER = {
323
- closed: !0,
324
- next: noop$3,
325
- error: defaultErrorHandler,
326
- complete: noop$3
327
- }, observable = (function() {
328
- return typeof Symbol == "function" && Symbol.observable || "@@observable";
329
- })();
330
- function identity$1(f) {
331
- return f;
332
- }
333
- function pipeFromArray(f) {
334
- return f.length === 0 ? identity$1 : f.length === 1 ? f[0] : function(V) {
335
- return f.reduce(function(f, V) {
336
- return V(f);
337
- }, V);
338
- };
339
- }
340
- var Observable = function() {
341
- function f(f) {
342
- f && (this._subscribe = f);
343
- }
344
- return f.prototype.lift = function(V) {
345
- var H = new f();
346
- return H.source = this, H.operator = V, H;
347
- }, f.prototype.subscribe = function(f, V, H) {
348
- var U = this, W = isSubscriber(f) ? f : new SafeSubscriber(f, V, H);
349
- return errorContext(function() {
350
- var f = U, V = f.operator, H = f.source;
351
- W.add(V ? V.call(W, H) : H ? U._subscribe(W) : U._trySubscribe(W));
352
- }), W;
353
- }, f.prototype._trySubscribe = function(f) {
354
- try {
355
- return this._subscribe(f);
356
- } catch (V) {
357
- f.error(V);
358
- }
359
- }, f.prototype.forEach = function(f, V) {
360
- var H = this;
361
- return V = getPromiseCtor(V), new V(function(V, U) {
362
- var W = new SafeSubscriber({
363
- next: function(V) {
364
- try {
365
- f(V);
366
- } catch (f) {
367
- U(f), W.unsubscribe();
368
- }
369
- },
370
- error: U,
371
- complete: V
372
- });
373
- H.subscribe(W);
374
- });
375
- }, f.prototype._subscribe = function(f) {
376
- return this.source?.subscribe(f);
377
- }, f.prototype[observable] = function() {
378
- return this;
379
- }, f.prototype.pipe = function() {
380
- return pipeFromArray([...arguments])(this);
381
- }, f.prototype.toPromise = function(f) {
382
- var V = this;
383
- return f = getPromiseCtor(f), new f(function(f, H) {
384
- var U;
385
- V.subscribe(function(f) {
386
- return U = f;
387
- }, function(f) {
388
- return H(f);
389
- }, function() {
390
- return f(U);
391
- });
392
- });
393
- }, f.create = function(V) {
394
- return new f(V);
395
- }, f;
396
- }();
397
- function getPromiseCtor(f) {
398
- return f ?? config.Promise ?? Promise;
399
- }
400
- function isObserver(f) {
401
- return f && isFunction(f.next) && isFunction(f.error) && isFunction(f.complete);
402
- }
403
- function isSubscriber(f) {
404
- return f && f instanceof Subscriber || isObserver(f) && isSubscription(f);
405
- }
406
- function hasLift(f) {
407
- return isFunction(f?.lift);
408
- }
409
- function operate(f) {
410
- return function(V) {
411
- if (hasLift(V)) return V.lift(function(V) {
412
- try {
413
- return f(V, this);
414
- } catch (f) {
415
- this.error(f);
416
- }
417
- });
418
- throw TypeError("Unable to lift unknown Observable type");
419
- };
420
- }
421
- init_tslib_es6();
422
- function createOperatorSubscriber(f, V, H, U, W) {
423
- return new OperatorSubscriber(f, V, H, U, W);
424
- }
425
- var OperatorSubscriber = function(f) {
426
- __extends(V, f);
427
- function V(V, H, U, W, G, K) {
428
- var q = f.call(this, V) || this;
429
- return q.onFinalize = G, q.shouldUnsubscribe = K, q._next = H ? function(f) {
430
- try {
431
- H(f);
432
- } catch (f) {
433
- V.error(f);
434
- }
435
- } : f.prototype._next, q._error = W ? function(f) {
436
- try {
437
- W(f);
438
- } catch (f) {
439
- V.error(f);
440
- } finally {
441
- this.unsubscribe();
442
- }
443
- } : f.prototype._error, q._complete = U ? function() {
444
- try {
445
- U();
446
- } catch (f) {
447
- V.error(f);
448
- } finally {
449
- this.unsubscribe();
450
- }
451
- } : f.prototype._complete, q;
452
- }
453
- return V.prototype.unsubscribe = function() {
454
- var V;
455
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
456
- var H = this.closed;
457
- f.prototype.unsubscribe.call(this), !H && ((V = this.onFinalize) == null || V.call(this));
458
- }
459
- }, V;
460
- }(Subscriber), ObjectUnsubscribedError = createErrorClass(function(f) {
461
- return function() {
462
- f(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
463
- };
464
- });
465
- init_tslib_es6();
466
- var Subject = function(f) {
467
- __extends(V, f);
468
- function V() {
469
- var V = f.call(this) || this;
470
- return V.closed = !1, V.currentObservers = null, V.observers = [], V.isStopped = !1, V.hasError = !1, V.thrownError = null, V;
471
- }
472
- return V.prototype.lift = function(f) {
473
- var V = new AnonymousSubject(this, this);
474
- return V.operator = f, V;
475
- }, V.prototype._throwIfClosed = function() {
476
- if (this.closed) throw new ObjectUnsubscribedError();
477
- }, V.prototype.next = function(f) {
478
- var V = this;
479
- errorContext(function() {
480
- var H, U;
481
- if (V._throwIfClosed(), !V.isStopped) {
482
- V.currentObservers ||= Array.from(V.observers);
483
- try {
484
- for (var W = __values(V.currentObservers), G = W.next(); !G.done; G = W.next()) G.value.next(f);
485
- } catch (f) {
486
- H = { error: f };
487
- } finally {
488
- try {
489
- G && !G.done && (U = W.return) && U.call(W);
490
- } finally {
491
- if (H) throw H.error;
492
- }
493
- }
494
- }
495
- });
496
- }, V.prototype.error = function(f) {
497
- var V = this;
498
- errorContext(function() {
499
- if (V._throwIfClosed(), !V.isStopped) {
500
- V.hasError = V.isStopped = !0, V.thrownError = f;
501
- for (var H = V.observers; H.length;) H.shift().error(f);
502
- }
503
- });
504
- }, V.prototype.complete = function() {
505
- var f = this;
506
- errorContext(function() {
507
- if (f._throwIfClosed(), !f.isStopped) {
508
- f.isStopped = !0;
509
- for (var V = f.observers; V.length;) V.shift().complete();
510
- }
511
- });
512
- }, V.prototype.unsubscribe = function() {
513
- this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
514
- }, Object.defineProperty(V.prototype, "observed", {
515
- get: function() {
516
- return this.observers?.length > 0;
517
- },
518
- enumerable: !1,
519
- configurable: !0
520
- }), V.prototype._trySubscribe = function(V) {
521
- return this._throwIfClosed(), f.prototype._trySubscribe.call(this, V);
522
- }, V.prototype._subscribe = function(f) {
523
- return this._throwIfClosed(), this._checkFinalizedStatuses(f), this._innerSubscribe(f);
524
- }, V.prototype._innerSubscribe = function(f) {
525
- var V = this, H = this, U = H.hasError, W = H.isStopped, G = H.observers;
526
- return U || W ? EMPTY_SUBSCRIPTION : (this.currentObservers = null, G.push(f), new Subscription(function() {
527
- V.currentObservers = null, arrRemove(G, f);
528
- }));
529
- }, V.prototype._checkFinalizedStatuses = function(f) {
530
- var V = this, H = V.hasError, U = V.thrownError, W = V.isStopped;
531
- H ? f.error(U) : W && f.complete();
532
- }, V.prototype.asObservable = function() {
533
- var f = new Observable();
534
- return f.source = this, f;
535
- }, V.create = function(f, V) {
536
- return new AnonymousSubject(f, V);
537
- }, V;
538
- }(Observable), AnonymousSubject = function(f) {
539
- __extends(V, f);
540
- function V(V, H) {
541
- var U = f.call(this) || this;
542
- return U.destination = V, U.source = H, U;
543
- }
544
- return V.prototype.next = function(f) {
545
- var V, H;
546
- (H = (V = this.destination)?.next) == null || H.call(V, f);
547
- }, V.prototype.error = function(f) {
548
- var V, H;
549
- (H = (V = this.destination)?.error) == null || H.call(V, f);
550
- }, V.prototype.complete = function() {
551
- var f, V;
552
- (V = (f = this.destination)?.complete) == null || V.call(f);
553
- }, V.prototype._subscribe = function(f) {
554
- return this.source?.subscribe(f) ?? EMPTY_SUBSCRIPTION;
555
- }, V;
556
- }(Subject);
557
- init_tslib_es6();
558
- var BehaviorSubject = function(f) {
559
- __extends(V, f);
560
- function V(V) {
561
- var H = f.call(this) || this;
562
- return H._value = V, H;
563
- }
564
- return Object.defineProperty(V.prototype, "value", {
565
- get: function() {
566
- return this.getValue();
567
- },
568
- enumerable: !1,
569
- configurable: !0
570
- }), V.prototype._subscribe = function(V) {
571
- var H = f.prototype._subscribe.call(this, V);
572
- return !H.closed && V.next(this._value), H;
573
- }, V.prototype.getValue = function() {
574
- var f = this, V = f.hasError, H = f.thrownError, U = f._value;
575
- if (V) throw H;
576
- return this._throwIfClosed(), U;
577
- }, V.prototype.next = function(V) {
578
- f.prototype.next.call(this, this._value = V);
579
- }, V;
580
- }(Subject);
581
- function map(f, V) {
582
- return operate(function(H, U) {
583
- var W = 0;
584
- H.subscribe(createOperatorSubscriber(U, function(H) {
585
- U.next(f.call(V, H, W++));
586
- }));
587
- });
588
- }
589
- let QuerySuggestionTypes = /* @__PURE__ */ function(f) {
590
- return f.Field = "field", f.Value = "value", f.Operator = "operator", f.Conjunction = "conjunction", f.RecentSearch = "recentSearch", f;
591
- }({});
592
- var import_lodash$30 = require_lodash();
593
- function resolver(f, V, H, U) {
594
- return [
595
- Math.floor(Date.now() / 1e3 / 60),
596
- H,
597
- f,
598
- V.name,
599
- JSON.stringify(U)
600
- ].join("|");
601
- }
602
- const getEmptyValueSuggestions = (() => Promise.resolve([])), setupValueSuggestionProvider = (f) => {
603
- let V = (0, import_lodash$30.memoize)((V, H, U, W = [], G) => {
604
- let { onSuggestions: K } = f;
605
- return K(V, {
606
- size: 0,
607
- query: { bool: { filter: W } },
608
- aggs: { suggestions: { terms: {
609
- field: H.name,
610
- include: U + ".*",
611
- execution_hint: "map",
612
- shard_size: 10
613
- } } }
614
- }).then((f) => {
615
- let V = [], H = f?.aggregations?.suggestions;
616
- return H?.buckets && Array.isArray(H.buckets) && H.buckets.forEach((f) => {
617
- V.push(f.key);
618
- }), V;
619
- });
620
- }, resolver);
621
- return async ({ indexPattern: f, field: H, query: U, boolFilter: W, signal: G }) => {
622
- let { title: K } = f;
623
- return H.type === "boolean" ? [!0, !1] : !H.aggregatable || H.type !== "string" ? [] : await V(K, H, U, W, G);
624
- };
625
- };
626
- var import_lodash$29 = require_lodash();
627
- function escapeQuotes(f) {
628
- return f.replace(/[\\"]/g, "\\$&");
629
- }
630
- const escapeKuery = (0, import_lodash$29.flow)(escapeSpecialCharacters, escapeAndOr, escapeNot, escapeWhitespace);
631
- function escapeSpecialCharacters(f) {
632
- return f.replace(/[\\():<>"*]/g, "\\$&");
633
- }
634
- function escapeAndOr(f) {
635
- return f.replace(/(\s+)(and|or)(\s+)/gi, "$1\\$2$3");
636
- }
637
- function escapeNot(f) {
638
- return f.replace(/not(\s+)/gi, "\\$&");
639
- }
640
- function escapeWhitespace(f) {
641
- return f.replace(/\t/g, "\\t").replace(/\r/g, "\\r").replace(/\n/g, "\\n");
642
- }
643
- var import_lodash$28 = require_lodash();
644
- function sortPrefixFirst(f, V, H) {
645
- if (!V) return f;
646
- let U = ("" + V).toLowerCase(), W = (0, import_lodash$28.partition)(f, (f) => ("" + (H ? f[H] : f)).toLowerCase().startsWith(U));
647
- return [...W[0], ...W[1]];
648
- }
649
- function getRequestInspectorStats(f) {
650
- let V = {}, H = f.getField("index");
651
- return H && (V.indexPattern = {
652
- label: "Index pattern",
653
- value: H.title,
654
- description: "The index pattern that connected to the Elasticsearch indices."
655
- }, V.indexPatternId = {
656
- label: "Index pattern ID",
657
- value: H.id,
658
- description: "The ID in the .kibana index."
659
- }), V;
660
- }
661
- function getResponseInspectorStats(f, V) {
662
- let H = V?.history && V.history[V.history.length - 1], U = {};
663
- return f && f.took && (U.queryTime = {
664
- label: "Query time",
665
- value: `${f.took}ms`,
666
- description: "The time it took to process the query. Does not include the time to send the request or parse it in the browser."
667
- }), f && f.hits && (U.hitsTotal = {
668
- label: "Hits (total)",
669
- value: `${f.hits.total}`,
670
- description: "The number of documents that match the query."
671
- }, U.hits = {
672
- label: "Hits",
673
- value: `${f.hits.hits.length}`,
674
- description: "The number of documents returned by the query."
675
- }), H && (H.ms === 0 || H.ms) && (U.requestTime = {
676
- label: "Request time",
677
- value: `${H.ms}ms`,
678
- description: "The time of the request from the browser to Elasticsearch and back. Does not include the time the requested waited in the queue."
679
- }), U;
680
- }
681
- var import_lodash$27 = require_lodash(), indexPatternsUtils = { isFilterable }, getDescription$1 = (f) => /* @__PURE__ */ jsxs("p", { children: ["Filter results that contain ", /* @__PURE__ */ jsx("span", {
682
- className: "kbnSuggestionItem__callout",
683
- children: f.name
684
- })] }), keywordComparator = (f, V) => {
685
- let H = ["raw", "keyword"];
686
- return H.map((V) => `${f.name}.${V}`).includes(V.name) ? 1 : H.map((f) => `${V.name}.${f}`).includes(f.name) ? -1 : f.name.localeCompare(V.name);
687
- };
688
- const setupGetFieldSuggestions = (f) => ({ indexPatterns: f }, { start: V, end: H, prefix: U, suffix: W, nestedPath: G = "" }) => {
689
- let K = (0, import_lodash$27.flatten)(f.map((f) => f.fields.filter(indexPatternsUtils.isFilterable))), q = `${U}${W}`.trim().toLowerCase(), J = sortPrefixFirst(K.filter((f) => (!G || G && f.subType && f.subType.nested && f.subType.nested.path.includes(G)) && f.name.toLowerCase().includes(q)).sort(keywordComparator), q, "name").map((f) => {
690
- let U = f.subType && f.subType.nested ? f.subType.nested.path.slice(G ? G.length + 1 : 0) : "", W = f.subType && f.subType.nested && U.length > 0 ? `${escapeKuery(U)}:{ ${escapeKuery(f.name.slice(f.subType.nested.path.length + 1))} }` : `${escapeKuery(f.name.slice(G ? G.length + 1 : 0))} `, K = getDescription$1(f), q = f.subType && f.subType.nested && U.length > 0 ? W.length - 2 : W.length;
691
- return {
692
- type: QuerySuggestionTypes.Field,
693
- text: W,
694
- description: K,
695
- start: V,
696
- end: H,
697
- cursorIndex: q,
698
- field: f
699
- };
700
- });
701
- return Promise.resolve(J);
702
- };
703
- var import_lodash$26 = require_lodash(), wrapAsSuggestions = (f, V, H, U) => (U || []).filter((f) => f.toLowerCase().includes(H.toLowerCase())).map((H) => ({
704
- type: QuerySuggestionTypes.Value,
705
- text: `${H} `,
706
- start: f,
707
- end: V
708
- }));
709
- const setupGetValueSuggestions = (f) => {
710
- let { onSuggestions: V } = f;
711
- return async ({ indexPatterns: f, boolFilter: H, useTimeRange: U, signal: W }, { start: G, end: K, prefix: q, suffix: J, fieldName: Y, nestedPath: X }) => {
712
- let Z = X ? `${X}.${Y}` : Y, Q = [];
713
- f.forEach((f) => {
714
- f.fields.filter((f) => f.name === Z).forEach((V) => Q.push([f, V]));
715
- });
716
- let $ = `${q}${J}`.trim();
717
- return (0, import_lodash$26.flatten)(await Promise.all(Q.map(([f, U]) => {
718
- let W = {
719
- size: 0,
720
- query: { bool: { filter: H } },
721
- aggs: { suggestions: { terms: {
722
- field: U.name,
723
- include: $ + ".*",
724
- execution_hint: "map",
725
- shard_size: 10
726
- } } }
727
- };
728
- return V(f.title, W).then((f) => {
729
- let V = [], H = f?.aggregations?.suggestions;
730
- H?.buckets && Array.isArray(H.buckets) && H.buckets.forEach((f) => {
731
- V.push(f.key);
732
- });
733
- let U = V?.map((f) => typeof f == "string" ? `"${escapeQuotes(f)}"` : `${f}`);
734
- return wrapAsSuggestions(G, K, $, U);
735
- });
736
- })));
737
- };
738
- };
739
- var import_lodash$25 = require_lodash(), equalsText = "equals", lessThanOrEqualToText = "less than or equal to", greaterThanOrEqualToText = "greater than or equal to", lessThanText = "less than", greaterThanText = "greater than", existsText = "exists", operators = {
740
- ":": {
741
- description: `${/* @__PURE__ */ jsx("span", {
742
- className: "kbnSuggestionItem__callout",
743
- children: equalsText
744
- })} some value`,
745
- fieldTypes: [
746
- "string",
747
- "number",
748
- "number_range",
749
- "date",
750
- "date_range",
751
- "ip",
752
- "ip_range",
753
- "geo_point",
754
- "geo_shape",
755
- "boolean"
756
- ]
757
- },
758
- "<=": {
759
- description: `is ${/* @__PURE__ */ jsx("span", {
760
- className: "kbnSuggestionItem__callout",
761
- children: lessThanOrEqualToText
762
- })} some value`,
763
- fieldTypes: [
764
- "number",
765
- "number_range",
766
- "date",
767
- "date_range",
768
- "ip",
769
- "ip_range"
770
- ]
771
- },
772
- ">=": {
773
- description: `is ${/* @__PURE__ */ jsx("span", {
774
- className: "kbnSuggestionItem__callout",
775
- children: greaterThanOrEqualToText
776
- })} some value`,
777
- fieldTypes: [
778
- "number",
779
- "number_range",
780
- "date",
781
- "date_range",
782
- "ip",
783
- "ip_range"
784
- ]
785
- },
786
- "<": {
787
- description: `is ${/* @__PURE__ */ jsx("span", {
788
- className: "kbnSuggestionItem__callout",
789
- children: lessThanText
790
- })} some value`,
791
- fieldTypes: [
792
- "number",
793
- "number_range",
794
- "date",
795
- "date_range",
796
- "ip",
797
- "ip_range"
798
- ]
799
- },
800
- ">": {
801
- description: `is ${/* @__PURE__ */ jsx("span", {
802
- className: "kbnSuggestionItem__callout",
803
- children: greaterThanText
804
- })} some value`,
805
- fieldTypes: [
806
- "number",
807
- "number_range",
808
- "date",
809
- "date_range",
810
- "ip",
811
- "ip_range"
812
- ]
813
- },
814
- ": *": {
815
- description: `${/* @__PURE__ */ jsx("span", {
816
- className: "kbnSuggestionItem__callout",
817
- children: existsText
818
- })} in any form`,
819
- fieldTypes: void 0
820
- }
821
- }, getOperatorByName = (f) => operators[f], getDescription = (f) => /* @__PURE__ */ jsx("p", { children: getOperatorByName(f).description });
822
- const setupGetOperatorSuggestions = () => ({ indexPatterns: f }, { end: V, fieldName: H, nestedPath: U }) => {
823
- let W = (0, import_lodash$25.flatten)(f.map((f) => f.fields.slice())), G = U ? `${U}.${H}` : H, K = W.filter((f) => f.name === G).map((f) => Object.keys(operators).filter((V) => {
824
- let { fieldTypes: H } = getOperatorByName(V);
825
- return !H || H.includes(f.type);
826
- }).map((f) => ({
827
- type: QuerySuggestionTypes.Operator,
828
- text: f + " ",
829
- description: getDescription(f),
830
- start: V,
831
- end: V
832
- })));
833
- return Promise.resolve((0, import_lodash$25.flatten)(K));
834
- };
835
- var conjunctions = {
836
- and: /* @__PURE__ */ jsxs("p", { children: [
837
- "Requires ",
838
- /* @__PURE__ */ jsx("span", {
839
- className: "kbnSuggestionItem__callout",
840
- children: "both arguments"
841
- }),
842
- " to be true"
843
- ] }),
844
- or: /* @__PURE__ */ jsxs("p", { children: [
845
- "Requires ",
846
- /* @__PURE__ */ jsx("span", {
847
- className: "kbnSuggestionItem__callout",
848
- children: "one or more arguments"
849
- }),
850
- " to be true"
851
- ] })
852
- };
853
- const setupGetConjunctionSuggestions = (f) => (f, { text: V, end: H }) => {
854
- let U = [];
855
- return V.endsWith(" ") && (U = Object.keys(conjunctions).map((f) => ({
856
- type: QuerySuggestionTypes.Conjunction,
857
- text: `${f} `,
858
- description: conjunctions[f],
859
- start: H,
860
- end: H
861
- }))), Promise.resolve(U);
862
- };
863
- var import_lodash$24 = require_lodash(), esKuery = {
864
- nodeTypes,
865
- fromKueryExpression,
866
- toElasticsearchQuery
867
- }, cursorSymbol = "@kuery-cursor@", dedup = (f) => (0, import_lodash$24.uniqBy)(f, ({ type: f, text: V, start: H, end: U }) => [
868
- f,
869
- V,
870
- H,
871
- U
872
- ].join("|"));
873
- const setupKqlQuerySuggestionProvider = (f) => {
874
- let V = {
875
- field: setupGetFieldSuggestions(f),
876
- value: setupGetValueSuggestions(f),
877
- operator: setupGetOperatorSuggestions(f),
878
- conjunction: setupGetConjunctionSuggestions(f)
879
- }, H = (f, H) => {
880
- try {
881
- let U = esKuery.fromKueryExpression(f, {
882
- cursorSymbol,
883
- parseCursor: !0
884
- });
885
- return U.suggestionTypes.map((f) => V[f](H, U));
886
- } catch {
887
- return [];
888
- }
889
- };
890
- return (f) => {
891
- let { query: V, selectionStart: U, selectionEnd: W } = f, G = `${V.substr(0, U)}${cursorSymbol}${V.substr(W)}`;
892
- return Promise.all(H(G, f)).then((f) => dedup((0, import_lodash$24.flatten)(f)));
893
- };
894
- };
895
- var AutocompleteService = class {
896
- autocompleteConfig;
897
- constructor(f) {
898
- this.autocompleteConfig = f;
899
- }
900
- querySuggestionProviders = /* @__PURE__ */ new Map();
901
- getValueSuggestions;
902
- addQuerySuggestionProvider = (f, V) => {
903
- f && V && this.autocompleteConfig.querySuggestions.enabled && this.querySuggestionProviders.set(f, V);
904
- };
905
- getQuerySuggestions = (f) => {
906
- let { language: V } = f, H = this.querySuggestionProviders.get(V);
907
- if (H) return H(f);
908
- };
909
- hasQuerySuggestions = (f) => this.querySuggestionProviders.has(f);
910
- setup(f) {
911
- return this.getValueSuggestions = this.autocompleteConfig.valueSuggestions.enabled && f.onSuggestions ? setupValueSuggestionProvider(f) : getEmptyValueSuggestions, this.autocompleteConfig.querySuggestions.enabled && this.querySuggestionProviders.set("kuery", setupKqlQuerySuggestionProvider(f)), {
912
- addQuerySuggestionProvider: this.addQuerySuggestionProvider,
913
- getQuerySuggestions: this.getQuerySuggestions
914
- };
915
- }
916
- start() {
917
- return {
918
- getQuerySuggestions: this.getQuerySuggestions,
919
- hasQuerySuggestions: this.hasQuerySuggestions,
920
- getValueSuggestions: this.getValueSuggestions
921
- };
922
- }
923
- clearProviders() {
924
- this.querySuggestionProviders.clear();
925
- }
926
- };
927
- const sortFilters = ({ $state: f }, { $state: V }) => f.store === V.store ? 0 : f.store === FilterStateStore.GLOBAL_STATE && V.store !== FilterStateStore.GLOBAL_STATE ? -1 : 1, mapSpatialFilter = (f) => {
928
- if (f.meta && f.meta.key && f.meta.alias && f.meta.type === FILTERS.SPATIAL_FILTER) return {
929
- key: f.meta.key,
930
- type: f.meta.type,
931
- value: ""
932
- };
933
- throw f;
934
- }, mapMatchAll = (f) => {
935
- if (isMatchAllFilter(f)) return {
936
- type: FILTERS.MATCH_ALL,
937
- key: f.meta.field,
938
- value: f.meta.formattedValue || "all"
939
- };
940
- throw f;
941
- };
942
- var import_lodash$23 = require_lodash(), getScriptedPhraseValue = (f) => (0, import_lodash$23.get)(f, [
943
- "script",
944
- "script",
945
- "params",
946
- "value"
947
- ]), getFormattedValueFn$3 = (f) => (V) => V ? V.convert(f) : f, getParams$3 = (f) => {
948
- let V = getScriptedPhraseValue(f), H = V ? f.meta.field || "" : getPhraseFilterField(f), U = V || getPhraseFilterValue(f);
949
- return {
950
- key: H,
951
- params: { query: U },
952
- type: FILTERS.PHRASE,
953
- value: getFormattedValueFn$3(U)
954
- };
955
- };
956
- const isMapPhraseFilter = (f) => isPhraseFilter(f) || isScriptedPhraseFilter(f), mapPhrase = (f) => {
957
- if (!isMapPhraseFilter(f)) throw f;
958
- return getParams$3(f);
959
- }, mapPhrases = (f) => {
960
- if (!isPhrasesFilter(f)) throw f;
961
- let { type: V, key: H, value: U, params: W } = f.meta;
962
- return {
963
- type: V,
964
- key: H,
965
- value: U,
966
- params: W
967
- };
968
- };
969
- var import_lodash$22 = require_lodash(), getFormattedValueFn$2 = (f, V) => (H) => {
970
- let U = `${f} to ${V}`;
971
- if (H) {
972
- let W = H.getConverterFor("text");
973
- U = `${W(f)} to ${W(V)}`;
974
- }
975
- return U;
976
- }, getFirstRangeKey = (f) => f.range && Object.keys(f.range)[0], getRangeByKey = (f, V) => (0, import_lodash$22.get)(f, ["range", V]);
977
- function getParams$2(f) {
978
- let V = isScriptedRangeFilter(f), H = (V ? f.meta.field : getFirstRangeKey(f)) || "", U = V ? (0, import_lodash$22.get)(f, "script.script.params") : getRangeByKey(f, H), W = (0, import_lodash$22.hasIn)(U, "gte") ? U.gte : U.gt;
979
- W ??= -Infinity;
980
- let G = (0, import_lodash$22.hasIn)(U, "lte") ? U.lte : U.lt;
981
- G ??= Infinity;
982
- let K = getFormattedValueFn$2(W, G);
983
- return {
984
- type: FILTERS.RANGE,
985
- key: H,
986
- value: K,
987
- params: U
988
- };
989
- }
990
- const isMapRangeFilter = (f) => isRangeFilter(f) || isScriptedRangeFilter(f), mapRange = (f) => {
991
- if (!isMapRangeFilter(f)) throw f;
992
- return getParams$2(f);
993
- };
994
- var import_lodash$21 = require_lodash();
995
- const mapExists = (f) => {
996
- if (isExistsFilter(f)) return {
997
- type: FILTERS.EXISTS,
998
- value: FILTERS.EXISTS,
999
- key: (0, import_lodash$21.get)(f, "exists.field")
1000
- };
1001
- throw f;
1002
- }, mapMissing = (f) => {
1003
- if (isMissingFilter(f)) return {
1004
- type: FILTERS.MISSING,
1005
- value: FILTERS.MISSING,
1006
- key: f.missing.field
1007
- };
1008
- throw f;
1009
- }, mapQueryString = (f) => {
1010
- if (isQueryStringFilter(f)) return {
1011
- type: FILTERS.QUERY_STRING,
1012
- key: "query",
1013
- value: f.query.query_string.query
1014
- };
1015
- throw f;
1016
- };
1017
- var getFormattedValueFn$1 = (f) => (V) => {
1018
- let H = V ? {
1019
- topLeft: V.convert(f.top_left),
1020
- bottomRight: V.convert(f.bottom_right)
1021
- } : {
1022
- topLeft: JSON.stringify(f.top_left),
1023
- bottomRight: JSON.stringify(f.bottom_right)
1024
- };
1025
- return H.topLeft + " to " + H.bottomRight;
1026
- }, getParams$1 = (f) => {
1027
- let V = Object.keys(f.geo_bounding_box).filter((f) => f !== "ignore_unmapped")[0], H = f.geo_bounding_box[V];
1028
- return {
1029
- key: V,
1030
- params: H,
1031
- type: FILTERS.GEO_BOUNDING_BOX,
1032
- value: getFormattedValueFn$1(H)
1033
- };
1034
- };
1035
- const mapGeoBoundingBox = (f) => {
1036
- if (!isGeoBoundingBoxFilter(f)) throw f;
1037
- return getParams$1(f);
1038
- };
1039
- var POINTS_SEPARATOR = ", ", getFormattedValueFn = (f) => (V) => f.map((f) => V ? V.convert(f) : JSON.stringify(f)).join(POINTS_SEPARATOR);
1040
- function getParams(f) {
1041
- let V = Object.keys(f.geo_polygon).filter((f) => f !== "ignore_unmapped")[0], H = f.geo_polygon[V];
1042
- return {
1043
- key: V,
1044
- params: H,
1045
- type: FILTERS.GEO_POLYGON,
1046
- value: getFormattedValueFn(H.points || [])
1047
- };
1048
- }
1049
- function mapGeoPolygon(f) {
1050
- if (!isGeoPolygonFilter(f)) throw f;
1051
- return getParams(f);
1052
- }
1053
- var import_lodash$20 = require_lodash();
1054
- const mapDefault = (f) => {
1055
- let V = /(^\$|meta)/, H = (0, import_lodash$20.find)((0, import_lodash$20.keys)(f), (f) => !f.match(V));
1056
- if (H) return {
1057
- type: FILTERS.CUSTOM,
1058
- key: H,
1059
- value: JSON.stringify((0, import_lodash$20.get)(f, H, {}))
1060
- };
1061
- throw f;
1062
- };
1063
- var noop$2 = () => {
1064
- throw Error("No mappings have been found for filter.");
1065
- };
1066
- const generateMappingChain = (f, V = noop$2) => (H) => {
1067
- try {
1068
- return f(H);
1069
- } catch (f) {
1070
- if (f === H) return V(H);
1071
- throw f;
1072
- }
1073
- };
1074
- var import_lodash$19 = require_lodash();
1075
- function mapFilter(f) {
1076
- let V = [
1077
- mapSpatialFilter,
1078
- mapMatchAll,
1079
- mapRange,
1080
- mapPhrase,
1081
- mapPhrases,
1082
- mapExists,
1083
- mapMissing,
1084
- mapQueryString,
1085
- mapGeoBoundingBox,
1086
- mapGeoPolygon,
1087
- mapDefault
1088
- ], H = (0, import_lodash$19.reduceRight)(V, (f, V) => generateMappingChain(V, f), () => {
1089
- throw Error("No mappings have been found for filter.");
1090
- })(f);
1091
- return f.meta = f.meta || {}, f.meta.type = H.type, f.meta.key = H.key, f.meta.value = H.value, f.meta.params = H.params, f.meta.disabled = !!f.meta.disabled, f.meta.negate = !!f.meta.negate, f.meta.alias = f.meta.alias || null, f;
1092
- }
1093
- var import_lodash$18 = require_lodash();
1094
- const mapAndFlattenFilters = (f) => (0, import_lodash$18.compact)((0, import_lodash$18.flatten)(f)).map((f) => mapFilter(f));
1095
- var import_lodash$17 = require_lodash(), isEnabled = (f) => f && f.meta && !f.meta.disabled;
1096
- const onlyDisabledFiltersChanged = (f, V) => {
1097
- let H = (0, import_lodash$17.filter)(f || [], isEnabled);
1098
- return compareFilters((0, import_lodash$17.filter)(V || [], isEnabled), H, COMPARE_ALL_OPTIONS);
1099
- };
1100
- var import_lodash$16 = /* @__PURE__ */ __toESM(require_lodash(), 1), FilterManager = class f {
1101
- filters = [];
1102
- updated$ = new Subject();
1103
- fetch$ = new Subject();
1104
- uiSettings;
1105
- constructor(f) {
1106
- this.uiSettings = f;
1107
- }
1108
- mergeIncomingFilters(V) {
1109
- let H = V.globalFilters, U = V.appFilters, W = [];
1110
- return import_lodash$16.default.each(U, function(f, V) {
1111
- let U = import_lodash$16.default.find(H, function(V) {
1112
- return compareFilters(V, f);
1113
- });
1114
- if (!U) return W.push(f);
1115
- import_lodash$16.default.assignIn(U.meta, f.meta);
1116
- }), f.mergeFilters(W, H);
1117
- }
1118
- static mergeFilters(f, V) {
1119
- return uniqFilters(f.reverse().concat(V.reverse())).reverse();
1120
- }
1121
- static partitionFilters(f) {
1122
- let [V, H] = import_lodash$16.default.partition(f, isFilterPinned);
1123
- return {
1124
- globalFilters: V,
1125
- appFilters: H
1126
- };
1127
- }
1128
- handleStateUpdate(f) {
1129
- f.sort(sortFilters);
1130
- let V = !compareFilters(this.filters, f, COMPARE_ALL_OPTIONS), H = onlyDisabledFiltersChanged(f, this.filters);
1131
- this.filters = f, V && (this.updated$.next(), H || this.fetch$.next());
1132
- }
1133
- getFilters() {
1134
- return import_lodash$16.default.cloneDeep(this.filters);
1135
- }
1136
- getAppFilters() {
1137
- let { appFilters: f } = this.getPartitionedFilters();
1138
- return f;
1139
- }
1140
- getGlobalFilters() {
1141
- let { globalFilters: f } = this.getPartitionedFilters();
1142
- return f;
1143
- }
1144
- getPartitionedFilters() {
1145
- return f.partitionFilters(this.getFilters());
1146
- }
1147
- getUpdates$() {
1148
- return this.updated$.asObservable();
1149
- }
1150
- getFetches$() {
1151
- return this.fetch$.asObservable();
1152
- }
1153
- addFilters(V, H = !0) {
1154
- if (Array.isArray(V) || (V = [V]), V.length === 0) return;
1155
- let U = H ? FilterStateStore.GLOBAL_STATE : FilterStateStore.APP_STATE;
1156
- f.setFiltersStore(V, U);
1157
- let W = mapAndFlattenFilters(V), G = f.partitionFilters(W), K = this.getPartitionedFilters();
1158
- K.appFilters.push(...G.appFilters), K.globalFilters.push(...G.globalFilters);
1159
- let q = this.mergeIncomingFilters(K);
1160
- this.handleStateUpdate(q);
1161
- }
1162
- setFilters(V, H = !0) {
1163
- let U = H ? FilterStateStore.GLOBAL_STATE : FilterStateStore.APP_STATE;
1164
- f.setFiltersStore(V, U);
1165
- let W = mapAndFlattenFilters(V), G = f.partitionFilters(W), K = this.mergeIncomingFilters(G);
1166
- this.handleStateUpdate(K);
1167
- }
1168
- setGlobalFilters(V) {
1169
- V = mapAndFlattenFilters(V), f.setFiltersStore(V, FilterStateStore.GLOBAL_STATE, !0);
1170
- let { appFilters: H } = this.getPartitionedFilters(), U = this.mergeIncomingFilters({
1171
- appFilters: H,
1172
- globalFilters: V
1173
- });
1174
- this.handleStateUpdate(U);
1175
- }
1176
- setAppFilters(V) {
1177
- V = mapAndFlattenFilters(V), f.setFiltersStore(V, FilterStateStore.APP_STATE, !0);
1178
- let { globalFilters: H } = this.getPartitionedFilters(), U = this.mergeIncomingFilters({
1179
- globalFilters: H,
1180
- appFilters: V
1181
- });
1182
- this.handleStateUpdate(U);
1183
- }
1184
- removeFilter(f) {
1185
- let V = import_lodash$16.default.findIndex(this.filters, (V) => import_lodash$16.default.isEqual(V.meta, f.meta) && import_lodash$16.default.isEqual(V.query, f.query));
1186
- if (V >= 0) {
1187
- let f = import_lodash$16.default.cloneDeep(this.filters);
1188
- f.splice(V, 1), this.handleStateUpdate(f);
1189
- }
1190
- }
1191
- removeAll() {
1192
- this.setFilters([]);
1193
- }
1194
- static setFiltersStore(f, V, H = !1) {
1195
- import_lodash$16.default.map(f, (f) => {
1196
- (H || f.$state === void 0) && (f.$state = { store: V });
1197
- });
1198
- }
1199
- }, import_lodash$15 = /* @__PURE__ */ __toESM(require_lodash(), 1), valueOf = function(f) {
1200
- if (f) return f.valueOf();
1201
- };
1202
- function areRefreshIntervalsDifferent(f, V) {
1203
- if (import_lodash$15.default.isObject(f) && import_lodash$15.default.isObject(V)) {
1204
- if (valueOf(f.value) !== valueOf(V.value) || valueOf(f.pause) !== valueOf(V.pause)) return !0;
1205
- } else return !import_lodash$15.default.isEqual(f, V);
1206
- return !1;
1207
- }
1208
- function areTimeRangesDifferent(f, V) {
1209
- if (f && V && import_lodash$15.default.isObject(f) && import_lodash$15.default.isObject(V)) {
1210
- if (valueOf(f.to) !== valueOf(V.to) || valueOf(f.from) !== valueOf(V.from)) return !0;
1211
- } else return !import_lodash$15.default.isEqual(f, V);
1212
- return !1;
1213
- }
1214
- var import_query_string = require_query_string();
1215
- function parseQueryString() {
1216
- let f = window.location.href.split("?");
1217
- return f.length <= 1 ? {} : (0, import_query_string.parse)(f[1], { sort: !1 });
1218
- }
1219
- function getForceNow() {
1220
- let f = parseQueryString().forceNow;
1221
- if (!f) return;
1222
- let V = Date.parse(f);
1223
- if (isNaN(V)) throw Error(`forceNow query parameter, ${f}, can't be parsed by Date.parse`);
1224
- return new Date(V);
1225
- }
1226
- var import_lodash$14 = /* @__PURE__ */ __toESM(require_lodash(), 1);
1227
- init_moment();
1228
- var Timefilter = class {
1229
- enabledUpdated$ = new BehaviorSubject(!1);
1230
- timeUpdate$ = new Subject();
1231
- refreshIntervalUpdate$ = new Subject();
1232
- autoRefreshFetch$ = new Subject();
1233
- fetch$ = new Subject();
1234
- _time;
1235
- _refreshInterval;
1236
- _history;
1237
- _isTimeRangeSelectorEnabled = !1;
1238
- _isAutoRefreshSelectorEnabled = !1;
1239
- _autoRefreshIntervalId = 0;
1240
- timeDefaults;
1241
- refreshIntervalDefaults;
1242
- constructor(f, V) {
1243
- this._history = V, this.timeDefaults = f.timeDefaults, this.refreshIntervalDefaults = f.refreshIntervalDefaults, this._time = f.timeDefaults, this.setRefreshInterval(f.refreshIntervalDefaults);
1244
- }
1245
- isTimeRangeSelectorEnabled() {
1246
- return this._isTimeRangeSelectorEnabled;
1247
- }
1248
- isAutoRefreshSelectorEnabled() {
1249
- return this._isAutoRefreshSelectorEnabled;
1250
- }
1251
- getEnabledUpdated$ = () => this.enabledUpdated$.asObservable();
1252
- getTimeUpdate$ = () => this.timeUpdate$.asObservable();
1253
- getRefreshIntervalUpdate$ = () => this.refreshIntervalUpdate$.asObservable();
1254
- getAutoRefreshFetch$ = () => this.autoRefreshFetch$.asObservable();
1255
- getFetch$ = () => this.fetch$.asObservable();
1256
- getTime = () => {
1257
- let { from: f, to: V } = this._time;
1258
- return {
1259
- ...this._time,
1260
- from: moment_default.isMoment(f) ? f.toISOString() : f,
1261
- to: moment_default.isMoment(V) ? V.toISOString() : V
1262
- };
1263
- };
1264
- setTime = (f) => {
1265
- let V = Object.assign(this.getTime(), f);
1266
- areTimeRangesDifferent(this.getTime(), V) && (this._time = {
1267
- from: V.from,
1268
- to: V.to
1269
- }, this._history?.add?.(this._time), this.timeUpdate$.next(), this.fetch$.next());
1270
- };
1271
- getRefreshInterval = () => import_lodash$14.default.clone(this._refreshInterval);
1272
- setRefreshInterval = (f) => {
1273
- let V = this.getRefreshInterval(), H = {
1274
- ...V,
1275
- ...f
1276
- };
1277
- H.value <= 0 && (H.value = 0, H.pause = !0), this._refreshInterval = {
1278
- value: H.value,
1279
- pause: H.pause
1280
- }, V && areRefreshIntervalsDifferent(V, H) && (this.refreshIntervalUpdate$.next(), !H.pause && H.value !== 0 && this.fetch$.next()), clearInterval(this._autoRefreshIntervalId), H.pause || (this._autoRefreshIntervalId = window.setInterval(() => this.autoRefreshFetch$.next(), H.value));
1281
- };
1282
- createFilter = (f, V) => getTime(f, V || this._time, { forceNow: this.getForceNow() });
1283
- getBounds() {
1284
- return this.calculateBounds(this._time);
1285
- }
1286
- calculateBounds(f) {
1287
- return typeof calculateBounds != "function" && console.log(typeof calculateBounds, calculateBounds), calculateBounds(f, { forceNow: this.getForceNow() });
1288
- }
1289
- getActiveBounds() {
1290
- if (this.isTimeRangeSelectorEnabled()) return this.getBounds();
1291
- }
1292
- enableTimeRangeSelector = () => {
1293
- this._isTimeRangeSelectorEnabled = !0, this.enabledUpdated$.next(!0);
1294
- };
1295
- disableTimeRangeSelector = () => {
1296
- this._isTimeRangeSelectorEnabled = !1, this.enabledUpdated$.next(!1);
1297
- };
1298
- enableAutoRefreshSelector = () => {
1299
- this._isAutoRefreshSelectorEnabled = !0, this.enabledUpdated$.next(!0);
1300
- };
1301
- disableAutoRefreshSelector = () => {
1302
- this._isAutoRefreshSelectorEnabled = !1, this.enabledUpdated$.next(!1);
1303
- };
1304
- getTimeDefaults() {
1305
- return import_lodash$14.default.cloneDeep(this.timeDefaults);
1306
- }
1307
- getRefreshIntervalDefaults() {
1308
- return import_lodash$14.default.cloneDeep(this.refreshIntervalDefaults);
1309
- }
1310
- getForceNow = () => getForceNow();
1311
- }, import_lodash$13 = /* @__PURE__ */ __toESM(require_lodash(), 1), defaultIsDuplicate = (f, V) => import_lodash$13.default.isEqual(f, V), PersistedLog = class {
1312
- name;
1313
- maxLength;
1314
- filterDuplicates;
1315
- isDuplicate;
1316
- storage;
1317
- items;
1318
- update$ = new BehaviorSubject(void 0);
1319
- constructor(f, V = {}, H) {
1320
- this.name = f, this.maxLength = typeof V.maxLength == "string" ? this.maxLength = parseInt(V.maxLength, 10) : V.maxLength, this.filterDuplicates = V.filterDuplicates || !1, this.isDuplicate = V.isDuplicate || defaultIsDuplicate, this.storage = H, this.items = this.storage.get(this.name) || [], this.maxLength !== void 0 && !isNaN(this.maxLength) && (this.items = import_lodash$13.default.take(this.items, this.maxLength));
1321
- }
1322
- add(f) {
1323
- return f == null ? this.items : (this.filterDuplicates && import_lodash$13.default.remove(this.items, (V) => this.isDuplicate(V, f)), this.items.unshift(f), this.maxLength && !isNaN(this.maxLength) && (this.items = import_lodash$13.default.take(this.items, this.maxLength)), this.storage.set(this.name, this.items), this.update$.next(void 0), this.items);
1324
- }
1325
- get() {
1326
- return import_lodash$13.default.cloneDeep(this.items);
1327
- }
1328
- get$() {
1329
- return this.update$.pipe(map(() => this.get()));
1330
- }
1331
- };
1332
- init_moment();
1333
- var TimeHistory = class {
1334
- history;
1335
- constructor(f) {
1336
- this.history = new PersistedLog("infini.timepicker.timeHistory", {
1337
- maxLength: 10,
1338
- filterDuplicates: !0,
1339
- isDuplicate: (f, V) => f.from === V.from && f.to === V.to
1340
- }, f);
1341
- }
1342
- add(f) {
1343
- if (!f || !f.from || !f.to) return;
1344
- let V = {
1345
- from: moment_default.isMoment(f.from) ? f.from.toISOString() : f.from,
1346
- to: moment_default.isMoment(f.to) ? f.to.toISOString() : f.to
1347
- };
1348
- this.history.add(V);
1349
- }
1350
- get() {
1351
- return this.history.get();
1352
- }
1353
- };
1354
- init_moment(), require_lodash(), require_lodash();
1355
- var bannerId;
1356
- const onRedirectNoIndexPattern = (f, V, H) => () => {
1357
- let W = f.management.kibana.indexPatterns ? "/management/kibana/indexPatterns" : "/home", G;
1358
- G && clearTimeout(G);
1359
- let K = "To visualize and explore data in Kibana, you must create an index pattern to retrieve data from Elasticsearch.";
1360
- return bannerId = H.banners.replace(bannerId, toMountPoint(/* @__PURE__ */ jsx(EuiCallOut, {
1361
- color: "warning",
1362
- iconType: "iInCircle",
1363
- title: K
1364
- }))), G = setTimeout(() => {
1365
- H.banners.remove(bannerId), G = void 0;
1366
- }, 15e3), W === "/home" ? V("home") : V("management", { path: `/kibana/indexPatterns?bannerMessage=${K}` }), new Promise(() => {});
1367
- }, onUnsupportedTimePattern = (f, V) => ({ id: H, title: W, index: G }) => {
1368
- let K = `Currently querying all indices matching ${G}. ${W} should be migrated to a wildcard-based index pattern.`;
1369
- f.addWarning({
1370
- title: "Support for time interval index patterns removed",
1371
- text: toMountPoint(/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", { children: K }), /* @__PURE__ */ jsx(EuiFlexGroup, {
1372
- justifyContent: "flexEnd",
1373
- gutterSize: "s",
1374
- children: /* @__PURE__ */ jsx(EuiFlexItem, {
1375
- grow: !1,
1376
- children: /* @__PURE__ */ jsx(EuiButton, {
1377
- size: "s",
1378
- onClick: () => V("management", { path: `/kibana/index_patterns/index_pattern/${H || ""}` }),
1379
- children: "Edit index pattern"
1380
- })
1381
- })
1382
- })] }))
1383
- });
1384
- };
1385
- var API_BASE_URL = "/view/", IndexPatternsApiClient = class {
1386
- http;
1387
- constructor(f) {
1388
- this.http = f;
1389
- }
1390
- _request(f, V) {
1391
- return this.http.fetch(f, { query: V }).catch((f) => {
1392
- throw f.body.statusCode === 404 && f.body.attributes?.code === "no_matching_indices" ? new IndexPatternMissingIndices(f.body.message) : Error(f.body.message || f.body.error || `${f.body.statusCode} Response`);
1393
- });
1394
- }
1395
- _getUrl(f) {
1396
- return this.http.getServerBasePath() + API_BASE_URL + f.filter(Boolean).map(encodeURIComponent).join("/");
1397
- }
1398
- getFieldsForTimePattern(f = {}) {
1399
- let { pattern: V, lookBack: H, metaFields: U } = f, W = this._getUrl(["_fields_for_time_pattern"]);
1400
- return this._request(W, {
1401
- pattern: V,
1402
- look_back: H,
1403
- meta_fields: U
1404
- }).then((f) => f.fields);
1405
- }
1406
- getFieldsForWildcard(f = {}) {
1407
- let { pattern: V, metaFields: H, type: U, params: W } = f, G, K;
1408
- return G = this._getUrl(["_fields_for_wildcard"]), K = {
1409
- pattern: V,
1410
- meta_fields: H
1411
- }, this._request(G, K).then((f) => f.fields);
1412
- }
1413
- }, import_lodash$10 = require_lodash(), simpleSavedObjectToSavedObject = (f) => ({
1414
- version: f._version,
1415
- ...(0, import_lodash$10.omit)(f, "_version")
1416
- }), SavedObjectsClientPublicToCommon = class {
1417
- savedObjectClient;
1418
- constructor(f) {
1419
- this.savedObjectClient = f;
1420
- }
1421
- async find(f) {
1422
- return (await this.savedObjectClient.find(f)).savedObjects.map(simpleSavedObjectToSavedObject);
1423
- }
1424
- async get(f, V) {
1425
- return simpleSavedObjectToSavedObject(await this.savedObjectClient.get(f, V));
1426
- }
1427
- async update(f, V, H, U) {
1428
- return simpleSavedObjectToSavedObject(await this.savedObjectClient.update(f, V, H, U));
1429
- }
1430
- async create(f, V, H) {
1431
- return simpleSavedObjectToSavedObject(await this.savedObjectClient.create(f, V, H));
1432
- }
1433
- delete(f, V) {
1434
- return this.savedObjectClient.delete(f, V);
1435
- }
1436
- }, import_lodash$9 = require_lodash(), getConfig = (f, V) => getUiSettings().get(f, V), DefaultFieldFormat = FieldFormat.from(import_lodash$9.identity);
1437
- const deserializeFieldFormat = function(f) {
1438
- return f ? getFormatWithAggs((f) => {
1439
- let { id: V, params: H = {} } = f;
1440
- if (V) {
1441
- let f = this.getType(V);
1442
- if (f) return new f(H, getConfig);
1443
- }
1444
- return new DefaultFieldFormat();
1445
- })(f) : new DefaultFieldFormat();
1446
- };
1447
- function getTimezone() {
1448
- return Intl.DateTimeFormat().resolvedOptions().timeZone;
1449
- }
1450
- var import_lodash$8 = require_lodash();
1451
- init_moment();
1452
- var ISO_FORMAT = "YYYY-MM-DDTHH:mm:ss.SSSZ", tz = getTimezone(), DateFormat = class extends FieldFormat {
1453
- static id = FIELD_FORMAT_IDS.DATE;
1454
- static title = "Date";
1455
- static fieldType = KBN_FIELD_TYPES.DATE;
1456
- memoizedConverter = import_lodash$8.noop;
1457
- memoizedPattern = "";
1458
- timeZone = "";
1459
- getParamDefaults() {
1460
- return {
1461
- pattern: this.getConfig("dateFormat") ?? ISO_FORMAT,
1462
- timezone: this.getConfig("dateFormat:tz") ?? tz
1463
- };
1464
- }
1465
- textConvert = (f) => {
1466
- let V = this.param("pattern"), H = this.param("timezone"), U = this.timeZone !== H, W = this.memoizedPattern !== V;
1467
- return (U || W) && (this.timeZone = H, this.memoizedPattern = V, this.memoizedConverter = (0, import_lodash$8.memoize)(function(f) {
1468
- if (f == null) return "-";
1469
- let U = moment_default(f).tz(H, !0);
1470
- return U.isValid() ? U.format(V) : f;
1471
- })), this.memoizedConverter(f);
1472
- };
1473
- }, import_lodash$7 = require_lodash();
1474
- init_moment();
1475
- function analysePatternForFract(f) {
1476
- let V = f.match("S+"), H = V ? V[0] : "";
1477
- return {
1478
- length: H.length,
1479
- patternNanos: H,
1480
- pattern: f,
1481
- patternEscaped: H ? f.replace(V, `[${V}]`) : ""
1482
- };
1483
- }
1484
- function formatWithNanos(f, V, H) {
1485
- if (H.length <= 3) return f.format(H.pattern);
1486
- {
1487
- let U = f.format(H.patternEscaped), W = V.substr(20, V.length - 21).padEnd(9, "0").substr(0, H.patternNanos.length);
1488
- return U.replace(H.patternNanos, W);
1489
- }
1490
- }
1491
- const baseFormattersPublic = [
1492
- DateFormat,
1493
- class extends FieldFormat {
1494
- static id = FIELD_FORMAT_IDS.DATE_NANOS;
1495
- static title = "Date nanos";
1496
- static fieldType = KBN_FIELD_TYPES.DATE;
1497
- memoizedConverter = import_lodash$7.noop;
1498
- memoizedPattern = "";
1499
- timeZone = "";
1500
- getParamDefaults() {
1501
- return {
1502
- pattern: this.getConfig("dateNanosFormat"),
1503
- fallbackPattern: this.getConfig("dateFormat"),
1504
- timezone: this.getConfig("dateFormat:tz")
1505
- };
1506
- }
1507
- textConvert = (f) => {
1508
- let V = this.param("pattern"), H = this.param("timezone"), U = analysePatternForFract(V), W = this.param("patternFallback"), G = this.timeZone !== H, K = this.memoizedPattern !== V;
1509
- return (G || K) && (this.timeZone = H, this.memoizedPattern = V, this.memoizedConverter = (0, import_lodash$7.memoize)(function(f) {
1510
- if (f == null) return "-";
1511
- let V = moment_default(f);
1512
- return typeof f != "string" && V.isValid() ? V.format(W) : V.isValid() ? formatWithNanos(V, f, U) : f;
1513
- })), this.memoizedConverter(f);
1514
- };
1515
- },
1516
- ...baseFormatters
1517
- ];
1518
- var Fallback$2 = () => /* @__PURE__ */ jsx("div", {}), LazySearchBar = React.lazy(() => import("./search_bar-Ho9D93zT.js"));
1519
- const SearchBar = withKibana((f) => /* @__PURE__ */ jsx(React.Suspense, {
1520
- fallback: /* @__PURE__ */ jsx(Fallback$2, {}),
1521
- children: /* @__PURE__ */ jsx(LazySearchBar, { ...f })
1522
- })), useFilterManager = (f) => {
1523
- let [V, H] = useState(f.filters || f.filterManager.getFilters());
1524
- return useEffect(() => {
1525
- let V = new Subscription();
1526
- return V.add(f.filterManager.getUpdates$().subscribe({ next: () => {
1527
- H(f.filterManager.getFilters());
1528
- } })), () => {
1529
- V.unsubscribe();
1530
- };
1531
- }, [f.filterManager]), { filters: V };
1532
- }, useTimefilter = (f) => {
1533
- let V = {
1534
- from: f.dateRangeFrom || f.timefilter.getTime().from,
1535
- to: f.dateRangeTo || f.timefilter.getTime().to
1536
- }, H = {
1537
- value: f.refreshInterval || f.timefilter.getRefreshInterval().value,
1538
- pause: f.isRefreshPaused || f.timefilter.getRefreshInterval().pause
1539
- }, [U, W] = useState(V), [G, K] = useState(H);
1540
- return useEffect(() => {
1541
- let V = new Subscription();
1542
- return V.add(f.timefilter.getRefreshIntervalUpdate$().subscribe({ next: () => {
1543
- K(f.timefilter.getRefreshInterval());
1544
- } })), V.add(f.timefilter.getTimeUpdate$().subscribe({ next: () => {
1545
- W(f.timefilter.getTime());
1546
- } })), () => {
1547
- V.unsubscribe();
1548
- };
1549
- }, [f.timefilter]), {
1550
- refreshInterval: G,
1551
- timeRange: U
1552
- };
1553
- }, useQueryStringManager = (f) => {
1554
- let [V, H] = useState(f.query || f.queryStringManager.getQuery());
1555
- return useEffect(() => {
1556
- let V = new Subscription();
1557
- return V.add(f.queryStringManager.getUpdates$().subscribe({ next: () => {
1558
- H(f.queryStringManager.getQuery());
1559
- } })), () => {
1560
- V.unsubscribe();
1561
- };
1562
- }, [f.queryStringManager]), { query: V };
1563
- };
1564
- var import_lodash$6 = /* @__PURE__ */ __toESM(require_lodash(), 1), defaultFiltersUpdated = (f) => (V) => {
1565
- f.filterManager.setFilters(V), f.onQuerySubmit && f.onQuerySubmit();
1566
- }, defaultOnRefreshChange = (f) => {
1567
- let V = f.timefilter;
1568
- return (f) => {
1569
- V.setRefreshInterval({
1570
- value: f.refreshInterval,
1571
- pause: f.isPaused
1572
- });
1573
- };
1574
- }, defaultOnQuerySubmit = (f, V) => {
1575
- if (!f.useDefaultBehaviors) return f.onQuerySubmit;
1576
- let H = f.timefilter;
1577
- return (U) => {
1578
- !import_lodash$6.default.isEqual(H.getTime(), U.dateRange) || !import_lodash$6.default.isEqual(U.query, V) ? (H.setTime(U.dateRange), U.query ? f.queryString.setQuery(U.query) : f.queryString.clearQuery(), f.onQuerySubmit && f.onQuerySubmit({
1579
- dateRange: U.dateRange,
1580
- query: U.query || V
1581
- }, !0)) : f.onQuerySubmit && f.onQuerySubmit({
1582
- dateRange: H.getTime(),
1583
- query: V
1584
- }, !1);
1585
- };
1586
- }, overrideDefaultBehaviors = (f) => f.useDefaultBehaviors ? {} : f;
1587
- function createSearchBar() {
1588
- return (f) => {
1589
- let { useDefaultBehaviors: V, indexPatterns: H } = f, U = useRef(f.onQuerySubmit), { filters: W } = useFilterManager({
1590
- filters: f.filters,
1591
- filterManager: f.filterManager
1592
- }), { query: G } = useQueryStringManager({
1593
- query: f.query,
1594
- queryStringManager: f.queryStringManager
1595
- }), { timeRange: K, refreshInterval: q } = useTimefilter({
1596
- dateRangeFrom: f.dateRangeFrom,
1597
- dateRangeTo: f.dateRangeTo,
1598
- refreshInterval: f.refreshInterval,
1599
- isRefreshPaused: f.isRefreshPaused,
1600
- timefilter: f.timefilter
1601
- });
1602
- return useEffect(() => {
1603
- !V || U.current;
1604
- }, [
1605
- G,
1606
- K,
1607
- V
1608
- ]), /* @__PURE__ */ jsx(SearchBar, {
1609
- showAutoRefreshOnly: f.showAutoRefreshOnly,
1610
- showDatePicker: f.showDatePicker,
1611
- showFilterBar: f.showFilterBar,
1612
- showQueryBar: f.showQueryBar,
1613
- showQueryInput: f.showQueryInput,
1614
- showSaveQuery: f.showSaveQuery,
1615
- screenTitle: f.screenTitle,
1616
- indexPatterns: f.indexPatterns,
1617
- indicateNoData: f.indicateNoData,
1618
- timeHistory: f.timefilter.history,
1619
- dateRangeFrom: K.from,
1620
- dateRangeTo: K.to,
1621
- refreshInterval: q.value,
1622
- isRefreshPaused: q.pause,
1623
- filters: W,
1624
- query: G,
1625
- onFiltersUpdated: defaultFiltersUpdated(f),
1626
- onRefreshChange: defaultOnRefreshChange(f),
1627
- onQuerySubmit: defaultOnQuerySubmit(f, G),
1628
- ...overrideDefaultBehaviors(f),
1629
- storage: f.storage,
1630
- services: f.services,
1631
- selectedIndexPattern: f.selectedIndexPattern,
1632
- setIndexPattern: f.setIndexPattern,
1633
- indices: f.indices,
1634
- renderTimeField: f.renderTimeField,
1635
- histogramData: f.histogramData,
1636
- timefilterUpdateHandler: f.timefilterUpdateHandler,
1637
- histogramOpts: f.histogramOpts,
1638
- timeSetting: f.timeSetting,
1639
- locale: f.locale,
1640
- theme: f.theme
1641
- });
1642
- };
1643
- }
1644
- var import_lodash$5 = /* @__PURE__ */ __toESM(require_lodash(), 1);
1645
- function getExistingFilter(f, V, H) {
1646
- return import_lodash$5.default.find(f, function(f) {
1647
- if (f) {
1648
- if (V === "_exists_" && isExistsFilter(f)) return f.exists.field === H;
1649
- if (isPhraseFilter(f)) return getPhraseFilterField(f) === V && getPhraseFilterValue(f) === H;
1650
- if (isScriptedPhraseFilter(f)) return f.meta.field === V && f.script.script.params.value === H;
1651
- }
1652
- });
1653
- }
1654
- function updateExistingFilter(f, V) {
1655
- f.meta.disabled = !1, f.meta.negate !== V && (f.meta.negate = !f.meta.negate);
1656
- }
1657
- function generateFilters(f, V, H, U, W) {
1658
- H = Array.isArray(H) ? H : [H];
1659
- let G = import_lodash$5.default.isObject(V) ? V : { name: V }, K = G.name, q = [], J = f.getAppFilters(), Y = U === "-", X;
1660
- return import_lodash$5.default.each(H, function(f) {
1661
- let V = getExistingFilter(J, K, f);
1662
- if (V) updateExistingFilter(V, Y), X = V;
1663
- else {
1664
- let V = { id: W }, H = K === "_exists_" ? FILTERS.EXISTS : FILTERS.PHRASE, U = K === "_exists_" ? { name: f } : G, q = f == null;
1665
- X = buildFilter(V, U, q ? FILTERS.EXISTS : H, q ? !Y : Y, !1, f, null, FilterStateStore.APP_STATE);
1666
- }
1667
- q.push(X);
1668
- }), q;
1669
- }
1670
- var Fallback$1 = () => /* @__PURE__ */ jsx("div", {}), LazyFilterLabel = React.lazy(() => import("./filter_label-DALDJinr.js"));
1671
- const FilterLabel = (f) => /* @__PURE__ */ jsx(React.Suspense, {
1672
- fallback: /* @__PURE__ */ jsx(Fallback$1, {}),
1673
- children: /* @__PURE__ */ jsx(LazyFilterLabel, { ...f })
1674
- });
1675
- React.lazy(() => import("./query_bar_top_row-Dzd1EBWC.js")), withKibana(React.lazy(() => import("./query_string_input-o_vEPSg2.js")));
1676
- var { useToken } = theme, Fallback = () => /* @__PURE__ */ jsx("div", {}), LazySuggestionsComponent = React.lazy(() => import("./suggestions_component-D52Ar73h.js"));
1677
- const SuggestionsComponent = (f) => {
1678
- let { token: V } = useToken(), H = {
1679
- border: 0,
1680
- background: V.colorBgElevated,
1681
- boxShadow: V.boxShadowSecondary,
1682
- borderRadius: V.borderRadiusLG
1683
- };
1684
- return /* @__PURE__ */ jsx(React.Suspense, {
1685
- fallback: /* @__PURE__ */ jsx(Fallback, {}),
1686
- children: /* @__PURE__ */ jsx(LazySuggestionsComponent, {
1687
- ...f,
1688
- style: H
1689
- })
1690
- });
1691
- };
1692
- function getQueryLog(f, V, H, U) {
1693
- return new PersistedLog(`typeahead:${H}-${U}`, {
1694
- maxLength: f.get(UI_SETTINGS.HISTORY_LIMIT),
1695
- filterDuplicates: !0
1696
- }, V);
1697
- }
1698
- var import_lodash$4 = /* @__PURE__ */ __toESM(require_lodash(), 1);
1699
- function fromUser(f) {
1700
- if (import_lodash$4.default.isEmpty(f)) return "";
1701
- if (import_lodash$4.default.isObject(f)) return f;
1702
- if (f ||= "", typeof f == "string") {
1703
- let V = f.trim();
1704
- if (V.length === 0) return "";
1705
- if (V[0] === "{") try {
1706
- return JSON.parse(V);
1707
- } catch {
1708
- return f;
1709
- }
1710
- else return f;
1711
- }
1712
- }
1713
- var pairs = [
1714
- "()",
1715
- "[]",
1716
- "{}",
1717
- "''",
1718
- "\"\""
1719
- ], openers = pairs.map((f) => f[0]), closers = pairs.map((f) => f[1]);
1720
- function matchPairs({ value: f, selectionStart: V, selectionEnd: H, key: U, metaKey: W, updateQuery: G, preventDefault: K }) {
1721
- shouldMoveCursorForward(U, f, V, H) ? (K(), G(f, V + 1, H + 1)) : shouldInsertMatchingCloser(U, f, V, H) ? (K(), G(f.substr(0, V) + U + f.substring(V, H) + closers[openers.indexOf(U)] + f.substr(H), V + 1, H + 1)) : shouldRemovePair(U, W, f, V, H) && (K(), G(f.substr(0, H - 1) + f.substr(H + 1), V - 1, H - 1));
1722
- }
1723
- function shouldMoveCursorForward(f, V, H, U) {
1724
- return !closers.includes(f) || H !== U ? !1 : V.charAt(U) === f;
1725
- }
1726
- function shouldInsertMatchingCloser(f, V, H, U) {
1727
- if (!openers.includes(f)) return !1;
1728
- if (H !== U) return !0;
1729
- let W = V.charAt(H - 1), G = V.charAt(H + 1);
1730
- return W === "\\" ? !1 : !(["\"", "'"].includes(f) && (isAlphanumeric(W) || isAlphanumeric(G)));
1731
- }
1732
- function shouldRemovePair(f, V, H, U, W) {
1733
- return f !== "Backspace" || V || U !== W ? !1 : pairs.includes(H.substr(W - 1, 2));
1734
- }
1735
- function isAlphanumeric(f = "") {
1736
- return f.match(/[a-zA-Z0-9_]/);
1737
- }
1738
- function toUser(f) {
1739
- return f == null ? "" : typeof f == "object" ? f.query_string ? toUser(f.query_string.query) : JSON.stringify(f) : "" + f;
1740
- }
1741
- require_lodash(), React.lazy(() => import("./shard_failure_open_modal_button-ziUHpSxf.js")), require_lodash(), require_lodash(), require_lodash(), React.lazy(() => import("./index_pattern_select-Ct7oi9xn.js"));
1742
- const indexPatterns = {
1743
- ILLEGAL_CHARACTERS_KEY,
1744
- CONTAINS_SPACES_KEY,
1745
- ILLEGAL_CHARACTERS_VISIBLE,
1746
- ILLEGAL_CHARACTERS,
1747
- isDefault,
1748
- isFilterable,
1749
- isNestedField,
1750
- validate: validateIndexPattern,
1751
- getFromSavedObject,
1752
- flattenHitWrapper,
1753
- formatHitProvider
1754
- }, search = {
1755
- aggs: {
1756
- CidrMask,
1757
- dateHistogramInterval,
1758
- intervalOptions,
1759
- InvalidEsCalendarIntervalError,
1760
- InvalidEsIntervalFormatError,
1761
- Ipv4Address,
1762
- isDateHistogramBucketAggConfig,
1763
- isNumberType,
1764
- isStringType,
1765
- isType,
1766
- isValidEsInterval,
1767
- isValidInterval,
1768
- parentPipelineType,
1769
- parseEsInterval,
1770
- parseInterval,
1771
- propFilter,
1772
- siblingPipelineType,
1773
- termsAggFilter,
1774
- toAbsoluteDates
1775
- },
1776
- getRequestInspectorStats,
1777
- getResponseInspectorStats,
1778
- tabifyAggResponse,
1779
- tabifyGetColumns
1780
- };
1781
- export { BehaviorSubject as C, Subscription as E, QuerySuggestionTypes as S, operate as T, onRedirectNoIndexPattern as _, fromUser as a, FilterManager as b, FilterLabel as c, baseFormattersPublic as d, getTimezone as f, onUnsupportedTimePattern as g, IndexPatternsApiClient as h, matchPairs as i, generateFilters as l, SavedObjectsClientPublicToCommon as m, search as n, getQueryLog as o, deserializeFieldFormat as p, toUser as r, SuggestionsComponent as s, indexPatterns as t, createSearchBar as u, TimeHistory as v, createOperatorSubscriber as w, AutocompleteService as x, Timefilter as y };