react-semaphor 0.1.366 → 0.1.367

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.
@@ -1,307 +1,435 @@
1
- import { t as x, a as g, b as O, c as K, d as T, e as $, n as _, f as b, h as E } from "../chunks/validation-WGWJOQsV.js";
2
- import { k as dt, g as pt, i as yt, j as ft, v as mt } from "../chunks/validation-WGWJOQsV.js";
3
- import { j as P } from "../chunks/index-CuHybtft.js";
4
- import { createContext as U, useContext as w, useMemo as p, useState as k, useCallback as f, useRef as q, useEffect as C } from "react";
1
+ import { t as k, a as q, b as C, c as w, d as _, e as T, n as K, f as P, h as E } from "../chunks/validation-CrUjNWby.js";
2
+ import { k as Ie, g as Ee, i as xe, j as Re, v as Oe } from "../chunks/validation-CrUjNWby.js";
3
+ import { j as $ } from "../chunks/index-CuHybtft.js";
4
+ import { createContext as j, useContext as N, useMemo as d, useState as R, useCallback as y, useRef as x, useEffect as U } from "react";
5
5
  import { jsx as B } from "react/jsx-runtime";
6
- import { v as L } from "../chunks/validators-Bxc1OmZK.js";
7
- function M() {
6
+ import { v as L } from "../chunks/validators-L0xEXtjf.js";
7
+ const z = [
8
+ "records",
9
+ "changes",
10
+ "drivers",
11
+ "largestNegativeChanges",
12
+ "largestPositiveChanges",
13
+ "largestNegativeDrivers",
14
+ "largestPositiveDrivers"
15
+ ], M = [
16
+ "records",
17
+ "changes",
18
+ "drivers",
19
+ "largestNegativeChanges",
20
+ "largestPositiveChanges",
21
+ "largestNegativeDrivers",
22
+ "largestPositiveDrivers"
23
+ ];
24
+ function O(t) {
25
+ if (!t)
26
+ return {};
27
+ const e = H(t.executionResult), n = V(t, e), o = J(n);
8
28
  return {
9
- executeAnalysis: (e, t, o) => h(e, t, o ?? {}),
10
- executeMetric: (e, t) => h(e, t),
11
- executeRecords: (e, t) => h(e, t),
12
- executeInputOptions: (e, t) => h(e, t)
29
+ ...t,
30
+ ...Object.keys(n).length ? { resultSets: n } : {},
31
+ ...o && !t.columns ? { columns: o.columns } : {},
32
+ ...o && !t.records ? { records: o.records } : {},
33
+ ...o && t.rowCount === void 0 ? { rowCount: o.rowCount } : {}
13
34
  };
14
35
  }
15
- async function h(e, t, o) {
16
- if (!t.token)
36
+ function V(t, e) {
37
+ const n = {
38
+ ...t.resultSets || {}
39
+ };
40
+ for (const r of z) {
41
+ if (n[r]) {
42
+ n[r] = Q(n[r]);
43
+ continue;
44
+ }
45
+ const a = W(t[r]);
46
+ if (!a.length)
47
+ continue;
48
+ const s = e.length ? e : F(a);
49
+ n[r] = {
50
+ records: I(a, s),
51
+ columns: s,
52
+ rowCount: a.length
53
+ };
54
+ }
55
+ const o = Y(t.executionResult);
56
+ return o && o.records.length > 0 && !n.records && (n.records = o), n;
57
+ }
58
+ function Q(t) {
59
+ var e;
60
+ return {
61
+ ...t,
62
+ records: I(
63
+ t.records || [],
64
+ t.columns || []
65
+ ),
66
+ rowCount: t.rowCount ?? ((e = t.records) == null ? void 0 : e.length) ?? 0
67
+ };
68
+ }
69
+ function J(t) {
70
+ var e;
71
+ for (const n of M)
72
+ if ((e = t[n]) != null && e.records.length)
73
+ return t[n];
74
+ return Object.values(t).find((n) => n.records.length) || Object.values(t)[0];
75
+ }
76
+ function Y(t) {
77
+ const e = t == null ? void 0 : t.result;
78
+ if (!(!e || e.kind !== "records" && e.kind !== "sql"))
79
+ return {
80
+ records: I(e.records, e.columns),
81
+ columns: e.columns,
82
+ rowCount: e.rowCount ?? e.records.length
83
+ };
84
+ }
85
+ function H(t) {
86
+ const e = t == null ? void 0 : t.result;
87
+ return !e || e.kind !== "records" && e.kind !== "sql" ? [] : e.columns;
88
+ }
89
+ function W(t) {
90
+ return Array.isArray(t) ? t.filter(
91
+ (e) => !!(e && typeof e == "object" && !Array.isArray(e))
92
+ ) : [];
93
+ }
94
+ function I(t, e) {
95
+ return e.length ? t.map((n) => {
96
+ const o = {};
97
+ return e.forEach((r, a) => {
98
+ const s = G(n, {
99
+ name: r.key,
100
+ label: r.label,
101
+ fallbackNames: [r.name, Object.keys(n)[a]]
102
+ });
103
+ s !== void 0 && (o[r.key] = s);
104
+ }), Object.keys(o).length ? o : n;
105
+ }) : t;
106
+ }
107
+ function F(t) {
108
+ return Array.from(
109
+ new Set(t.flatMap((n) => Object.keys(n)))
110
+ ).map((n) => ({
111
+ key: n,
112
+ name: n,
113
+ label: n
114
+ }));
115
+ }
116
+ function G(t, e) {
117
+ const n = [
118
+ e.name,
119
+ e.label,
120
+ ...e.fallbackNames || []
121
+ ].filter((o) => !!o);
122
+ for (const o of n)
123
+ if (Object.prototype.hasOwnProperty.call(t, o))
124
+ return t[o];
125
+ }
126
+ function X() {
127
+ return {
128
+ executeAnalysis: (t, e, n) => h(
129
+ t,
130
+ e,
131
+ n ?? {}
132
+ ).then(O),
133
+ executeMetric: (t, e) => h(t, e),
134
+ executeRecords: (t, e) => h(t, e),
135
+ executeInputOptions: (t, e) => h(t, e)
136
+ };
137
+ }
138
+ async function h(t, e, n) {
139
+ if (!e.token)
17
140
  throw new Error("SemaphorDataAppProvider needs a token to execute queries.");
18
- const n = await fetch(Q(t), {
141
+ const o = await fetch(te(e), {
19
142
  method: "POST",
20
143
  headers: {
21
144
  "Content-Type": "application/json",
22
- Authorization: `Bearer ${t.token}`
145
+ Authorization: `Bearer ${e.token}`
23
146
  },
24
147
  body: JSON.stringify({
25
- intent: e,
26
- activeInputs: t.activeInputs,
27
- ...o ? { analysisOptions: o } : {},
28
- resultShape: e.kind
148
+ intent: t,
149
+ activeInputs: e.activeInputs,
150
+ ...n ? { analysisOptions: n } : {},
151
+ resultShape: t.kind
29
152
  })
30
- }), r = await V(n);
31
- if (!n.ok || r.error)
153
+ }), r = await Z(o);
154
+ if (!o.ok || r.error)
32
155
  throw new Error(
33
- r.error || `Semaphor Data App execution failed with status ${n.status}.`
156
+ r.error || `Semaphor Data App execution failed with status ${o.status}.`
34
157
  );
35
158
  return r;
36
159
  }
37
- async function V(e) {
38
- const t = await e.text().catch(() => "");
39
- if (!t.trim())
40
- return e.ok ? {
160
+ async function Z(t) {
161
+ const e = await t.text().catch(() => "");
162
+ if (!e.trim())
163
+ return t.ok ? {
41
164
  error: "Semaphor Data App execution returned an empty response."
42
165
  } : {};
43
166
  try {
44
- return JSON.parse(t);
167
+ return JSON.parse(e);
45
168
  } catch {
46
- return e.ok ? {
169
+ return t.ok ? {
47
170
  error: "Semaphor Data App execution returned invalid JSON.",
48
- details: t
171
+ details: e
49
172
  } : {
50
- error: N(e, t),
51
- details: t
173
+ error: ee(t, e),
174
+ details: e
52
175
  };
53
176
  }
54
177
  }
55
- function N(e, t) {
56
- const o = e.statusText ? ` ${e.statusText}` : "", n = t.replace(/\s+/g, " ").trim();
57
- return n ? `Semaphor Data App execution failed with status ${e.status}${o}: ${n.slice(0, 240)}` : `Semaphor Data App execution failed with status ${e.status}${o}.`;
178
+ function ee(t, e) {
179
+ const n = t.statusText ? ` ${t.statusText}` : "", o = e.replace(/\s+/g, " ").trim();
180
+ return o ? `Semaphor Data App execution failed with status ${t.status}${n}: ${o.slice(0, 240)}` : `Semaphor Data App execution failed with status ${t.status}${n}.`;
58
181
  }
59
- function Q(e) {
60
- const t = j(e).replace(/\/+$/, "");
61
- return t ? t.endsWith("/api") ? `${t}/v1/data-app/execute` : `${t}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
182
+ function te(t) {
183
+ const e = re(t).replace(/\/+$/, "");
184
+ return e ? e.endsWith("/api") ? `${e}/v1/data-app/execute` : `${e}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
62
185
  }
63
- function j(e) {
64
- if (e.apiBaseUrl)
65
- return e.apiBaseUrl;
66
- if (!e.token)
186
+ function re(t) {
187
+ if (t.apiBaseUrl)
188
+ return t.apiBaseUrl;
189
+ if (!t.token)
67
190
  return "";
68
191
  try {
69
- return P(e.token).apiServiceUrl || "";
192
+ return $(t.token).apiServiceUrl || "";
70
193
  } catch {
71
194
  return "";
72
195
  }
73
196
  }
74
- const R = U({});
75
- function z() {
197
+ const b = j({});
198
+ function ne() {
76
199
  if (!(typeof window > "u"))
77
200
  return window.__SEMAPHOR_DATA_APP_RUNTIME__;
78
201
  }
79
- function J() {
80
- return w(R);
202
+ function oe() {
203
+ return N(b);
81
204
  }
82
- function nt({
83
- token: e,
84
- apiBaseUrl: t,
85
- executor: o,
86
- children: n
205
+ function me({
206
+ token: t,
207
+ apiBaseUrl: e,
208
+ executor: n,
209
+ children: o
87
210
  }) {
88
211
  var l;
89
- const r = z(), i = ((l = r == null ? void 0 : r.authToken) == null ? void 0 : l.accessToken) || e, a = (r == null ? void 0 : r.dataApiBaseUrl) || (r == null ? void 0 : r.apiBaseUrl) || t, c = p(() => M(), []), u = o || c, d = p(
212
+ const r = ne(), a = ((l = r == null ? void 0 : r.authToken) == null ? void 0 : l.accessToken) || t, s = (r == null ? void 0 : r.dataApiBaseUrl) || (r == null ? void 0 : r.apiBaseUrl) || e, c = d(() => X(), []), i = n || c, p = d(
90
213
  () => ({
91
- token: i,
92
- apiBaseUrl: a,
93
- executor: u
214
+ token: a,
215
+ apiBaseUrl: s,
216
+ executor: i
94
217
  }),
95
- [a, u, i]
218
+ [s, i, a]
96
219
  );
97
- return /* @__PURE__ */ B(R.Provider, { value: d, children: n });
220
+ return /* @__PURE__ */ B(b.Provider, { value: p, children: o });
98
221
  }
99
- const A = { value: null }, I = {}, H = { records: [] }, D = { options: [] };
100
- function W(e) {
101
- const t = x(e.inputs), o = g(e);
222
+ const A = { value: null }, g = {}, se = { records: [] }, D = { options: [] };
223
+ function ae(t) {
224
+ const e = k(t.inputs), n = q(t);
102
225
  try {
103
- const n = O(e), r = v(n);
226
+ const o = C(t), r = v(o);
104
227
  return r ? {
105
228
  error: r,
106
- activeInputs: t,
107
- analysisOptions: o,
108
- queryKey: s(void 0, t, r, o),
109
- idleData: I
229
+ activeInputs: e,
230
+ analysisOptions: n,
231
+ queryKey: u(void 0, e, r, n),
232
+ idleData: g
110
233
  } : {
111
- intent: n,
234
+ intent: o,
112
235
  error: null,
113
- activeInputs: t,
114
- analysisOptions: o,
115
- queryKey: s(n, t, void 0, o),
116
- idleData: I
236
+ activeInputs: e,
237
+ analysisOptions: n,
238
+ queryKey: u(o, e, void 0, n),
239
+ idleData: g
117
240
  };
118
- } catch (n) {
119
- const r = m(n);
241
+ } catch (o) {
242
+ const r = m(o);
120
243
  return {
121
244
  error: r,
122
- activeInputs: t,
123
- analysisOptions: o,
124
- queryKey: s(void 0, t, r, o),
125
- idleData: I
245
+ activeInputs: e,
246
+ analysisOptions: n,
247
+ queryKey: u(void 0, e, r, n),
248
+ idleData: g
126
249
  };
127
250
  }
128
251
  }
129
- function Y(e) {
130
- const t = x(e.inputs);
252
+ function ie(t) {
253
+ const e = k(t.inputs);
131
254
  try {
132
- const o = K(e), n = v(o);
133
- return n ? {
134
- error: n,
135
- activeInputs: t,
136
- queryKey: s(void 0, t, n),
255
+ const n = w(t), o = v(n);
256
+ return o ? {
257
+ error: o,
258
+ activeInputs: e,
259
+ queryKey: u(void 0, e, o),
137
260
  idleData: A
138
261
  } : {
139
- intent: o,
262
+ intent: n,
140
263
  error: null,
141
- activeInputs: t,
142
- queryKey: s(o, t),
264
+ activeInputs: e,
265
+ queryKey: u(n, e),
143
266
  idleData: A
144
267
  };
145
- } catch (o) {
146
- const n = m(o);
268
+ } catch (n) {
269
+ const o = m(n);
147
270
  return {
148
- error: n,
149
- activeInputs: t,
150
- queryKey: s(void 0, t, n),
271
+ error: o,
272
+ activeInputs: e,
273
+ queryKey: u(void 0, e, o),
151
274
  idleData: A
152
275
  };
153
276
  }
154
277
  }
155
- function F(e) {
156
- const t = x(e.inputs), o = H;
278
+ function ue(t) {
279
+ const e = k(t.inputs), n = se;
157
280
  try {
158
- const n = T(e), r = v(n);
281
+ const o = _(t), r = v(o);
159
282
  return r ? {
160
283
  error: r,
161
- activeInputs: t,
162
- queryKey: s(void 0, t, r),
163
- idleData: o
284
+ activeInputs: e,
285
+ queryKey: u(void 0, e, r),
286
+ idleData: n
164
287
  } : {
165
- intent: n,
288
+ intent: o,
166
289
  error: null,
167
- activeInputs: t,
168
- queryKey: s(n, t),
169
- idleData: o
290
+ activeInputs: e,
291
+ queryKey: u(o, e),
292
+ idleData: n
170
293
  };
171
- } catch (n) {
172
- const r = m(n);
294
+ } catch (o) {
295
+ const r = m(o);
173
296
  return {
174
297
  error: r,
175
- activeInputs: t,
176
- queryKey: s(void 0, t, r),
177
- idleData: o
298
+ activeInputs: e,
299
+ queryKey: u(void 0, e, r),
300
+ idleData: n
178
301
  };
179
302
  }
180
303
  }
181
- function G(e) {
304
+ function ce(t) {
182
305
  try {
183
- const t = $(e), o = v(t);
184
- return o ? {
185
- error: o,
186
- queryKey: s(void 0, void 0, o),
306
+ const e = T(t), n = v(e);
307
+ return n ? {
308
+ error: n,
309
+ queryKey: u(void 0, void 0, n),
187
310
  idleData: D
188
311
  } : {
189
- intent: t,
312
+ intent: e,
190
313
  error: null,
191
- queryKey: s(t),
314
+ queryKey: u(e),
192
315
  idleData: D
193
316
  };
194
- } catch (t) {
195
- const o = m(t);
317
+ } catch (e) {
318
+ const n = m(e);
196
319
  return {
197
- error: o,
198
- queryKey: s(void 0, void 0, o),
320
+ error: n,
321
+ queryKey: u(void 0, void 0, n),
199
322
  idleData: D
200
323
  };
201
324
  }
202
325
  }
203
- function m(e) {
204
- return e instanceof Error ? e : new Error(String(e));
326
+ function m(t) {
327
+ return t instanceof Error ? t : new Error(String(t));
205
328
  }
206
- function v(e) {
207
- const t = L(e);
208
- if (t.ok)
329
+ function v(t) {
330
+ const e = L(t);
331
+ if (e.ok)
209
332
  return null;
210
- const o = t.errors.map(
211
- (n) => n.path ? `${n.code} at ${n.path}: ${n.message}` : `${n.code}: ${n.message}`
333
+ const n = e.errors.map(
334
+ (o) => o.path ? `${o.code} at ${o.path}: ${o.message}` : `${o.code}: ${o.message}`
212
335
  ).join("; ");
213
- return new Error(`Invalid Semaphor analytics intent. ${o}`);
336
+ return new Error(`Invalid Semaphor analytics intent. ${n}`);
214
337
  }
215
- function s(e, t, o, n) {
338
+ function u(t, e, n, o) {
216
339
  return JSON.stringify({
217
- intent: e,
218
- activeInputs: t,
219
- analysisOptions: n,
220
- error: o == null ? void 0 : o.message
340
+ intent: t,
341
+ activeInputs: e,
342
+ analysisOptions: o,
343
+ error: n == null ? void 0 : n.message
221
344
  });
222
345
  }
223
- function ot(e) {
224
- const [t, o] = k(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), r = n ? e.value : t, i = p(
225
- () => _(e.options),
226
- [e.options]
227
- ), a = f(
228
- (u) => {
346
+ function he(t) {
347
+ const [e, n] = R(t.defaultValue), o = Object.prototype.hasOwnProperty.call(t, "value"), r = o ? t.value : e, a = d(
348
+ () => K(t.options),
349
+ [t.options]
350
+ ), s = y(
351
+ (i) => {
229
352
  var l;
230
- const d = u;
231
- (l = e.onValueChange) == null || l.call(e, d), n || o(d);
353
+ const p = i;
354
+ (l = t.onValueChange) == null || l.call(t, p), o || n(p);
232
355
  },
233
- [n, e]
234
- ), c = f(() => a(void 0), [a]);
235
- return p(() => {
236
- const u = b(e);
356
+ [o, t]
357
+ ), c = y(() => s(void 0), [s]);
358
+ return d(() => {
359
+ const i = P(t);
237
360
  return {
238
- id: e.id,
239
- kind: e.kind,
240
- label: e.label,
241
- field: u.field,
242
- operator: u.operator,
243
- controlRole: e.kind === "control" ? e.role : void 0,
361
+ id: t.id,
362
+ kind: t.kind,
363
+ label: t.label,
364
+ field: i.field,
365
+ operator: i.operator,
366
+ controlRole: t.kind === "control" ? t.role : void 0,
244
367
  value: r,
245
- options: i,
368
+ options: a,
246
369
  isActive: E(r),
247
- setValue: a,
370
+ setValue: s,
248
371
  clear: c,
249
372
  toAnalyticsInput: () => ({
250
- inputId: u.inputId,
251
- field: u.field,
252
- kind: e.kind,
253
- label: e.label,
373
+ inputId: i.inputId,
374
+ field: i.field,
375
+ kind: t.kind,
376
+ label: t.label,
254
377
  value: r,
255
378
  isActive: E(r),
256
- operator: u.operator,
257
- controlRole: e.kind === "control" ? e.role : void 0
379
+ operator: i.operator,
380
+ controlRole: t.kind === "control" ? t.role : void 0
258
381
  })
259
382
  };
260
- }, [c, i, a, e, r]);
383
+ }, [c, a, s, t, r]);
261
384
  }
262
- function at(e) {
263
- const t = p(() => W(e), [e]), o = f(
264
- (i) => {
265
- var a, c;
266
- return t.intent ? (c = (a = i.executor) == null ? void 0 : a.executeAnalysis) == null ? void 0 : c.call(
385
+ function ve(t) {
386
+ const e = d(() => ae(t), [t]), n = y(
387
+ (a) => {
388
+ var s, c;
389
+ return e.intent ? (c = (s = a.executor) == null ? void 0 : s.executeAnalysis) == null ? void 0 : c.call(
390
+ s,
391
+ e.intent,
267
392
  a,
268
- t.intent,
269
- i,
270
- t.analysisOptions
393
+ e.analysisOptions
271
394
  ) : void 0;
272
395
  },
273
- [t.analysisOptions, t.intent]
274
- ), n = S(
275
- t.queryKey,
276
- o,
277
- t.idleData,
278
- t.activeInputs
279
- ), r = t.error ? t.idleData : n.data;
396
+ [e.analysisOptions, e.intent]
397
+ ), o = S(
398
+ e.queryKey,
399
+ n,
400
+ e.idleData,
401
+ e.activeInputs
402
+ ), r = d(
403
+ () => O(
404
+ e.error ? e.idleData : o.data
405
+ ),
406
+ [e.error, e.idleData, o.data]
407
+ );
280
408
  return {
281
- id: e.id,
282
- intent: t.intent,
409
+ id: t.id,
410
+ intent: e.intent,
283
411
  ...r || {},
284
- status: t.error ? "error" : n.status,
285
- isLoading: !t.error && n.status === "loading",
286
- error: t.error || n.error
412
+ status: e.error ? "error" : o.status,
413
+ isLoading: !e.error && o.status === "loading",
414
+ error: e.error || o.error
287
415
  };
288
416
  }
289
- function it(e) {
290
- const t = p(() => Y(e), [e]), o = f(
291
- (i) => {
292
- var a;
293
- return t.intent ? (a = i.executor) == null ? void 0 : a.executeMetric(t.intent, i) : void 0;
417
+ function Se(t) {
418
+ const e = d(() => ie(t), [t]), n = y(
419
+ (a) => {
420
+ var s;
421
+ return e.intent ? (s = a.executor) == null ? void 0 : s.executeMetric(e.intent, a) : void 0;
294
422
  },
295
- [t.intent]
296
- ), n = S(
297
- t.queryKey,
298
- o,
299
- t.idleData,
300
- t.activeInputs
301
- ), r = t.error ? t.idleData : n.data;
423
+ [e.intent]
424
+ ), o = S(
425
+ e.queryKey,
426
+ n,
427
+ e.idleData,
428
+ e.activeInputs
429
+ ), r = e.error ? e.idleData : o.data;
302
430
  return {
303
- id: e.id,
304
- intent: t.intent,
431
+ id: t.id,
432
+ intent: e.intent,
305
433
  value: (r == null ? void 0 : r.value) ?? null,
306
434
  metrics: r == null ? void 0 : r.metrics,
307
435
  comparisonValue: r == null ? void 0 : r.comparisonValue,
@@ -309,124 +437,125 @@ function it(e) {
309
437
  deltaPercent: r == null ? void 0 : r.deltaPercent,
310
438
  records: r == null ? void 0 : r.records,
311
439
  executionResult: r == null ? void 0 : r.executionResult,
312
- status: t.error ? "error" : n.status,
313
- isLoading: !t.error && n.status === "loading",
314
- error: t.error || n.error
440
+ status: e.error ? "error" : o.status,
441
+ isLoading: !e.error && o.status === "loading",
442
+ error: e.error || o.error
315
443
  };
316
444
  }
317
- function ut(e) {
318
- const t = p(() => F(e), [e]), o = f(
319
- (i) => {
320
- var a;
321
- return t.intent ? (a = i.executor) == null ? void 0 : a.executeRecords(t.intent, i) : void 0;
445
+ function Ae(t) {
446
+ const e = d(() => ue(t), [t]), n = y(
447
+ (a) => {
448
+ var s;
449
+ return e.intent ? (s = a.executor) == null ? void 0 : s.executeRecords(e.intent, a) : void 0;
322
450
  },
323
- [t.intent]
324
- ), n = S(
325
- t.queryKey,
326
- o,
327
- t.idleData,
328
- t.activeInputs
329
- ), r = t.error ? t.idleData : n.data;
451
+ [e.intent]
452
+ ), o = S(
453
+ e.queryKey,
454
+ n,
455
+ e.idleData,
456
+ e.activeInputs
457
+ ), r = e.error ? e.idleData : o.data;
330
458
  return {
331
- id: e.id,
332
- intent: t.intent,
459
+ id: t.id,
460
+ intent: e.intent,
333
461
  records: (r == null ? void 0 : r.records) || [],
334
462
  columns: r == null ? void 0 : r.columns,
335
463
  rowCount: r == null ? void 0 : r.rowCount,
336
464
  executionResult: r == null ? void 0 : r.executionResult,
337
- status: t.error ? "error" : n.status,
338
- isLoading: !t.error && n.status === "loading",
339
- error: t.error || n.error
465
+ status: e.error ? "error" : o.status,
466
+ isLoading: !e.error && o.status === "loading",
467
+ error: e.error || o.error
340
468
  };
341
469
  }
342
- function st(e) {
343
- const t = p(() => G(e), [e]), o = f(
344
- (i) => {
345
- var a;
346
- return t.intent ? (a = i.executor) == null ? void 0 : a.executeInputOptions(t.intent, i) : void 0;
470
+ function ge(t) {
471
+ const e = d(() => ce(t), [t]), n = y(
472
+ (a) => {
473
+ var s;
474
+ return e.intent ? (s = a.executor) == null ? void 0 : s.executeInputOptions(e.intent, a) : void 0;
347
475
  },
348
- [t.intent]
349
- ), n = S(
350
- t.queryKey,
351
- o,
352
- t.idleData
353
- ), r = t.error ? t.idleData : n.data;
476
+ [e.intent]
477
+ ), o = S(
478
+ e.queryKey,
479
+ n,
480
+ e.idleData
481
+ ), r = e.error ? e.idleData : o.data;
354
482
  return {
355
- id: e.id,
356
- intent: t.intent,
483
+ id: t.id,
484
+ intent: e.intent,
357
485
  options: (r == null ? void 0 : r.options) || [],
358
486
  executionResult: r == null ? void 0 : r.executionResult,
359
- status: t.error ? "error" : n.status,
360
- isLoading: !t.error && n.status === "loading",
361
- error: t.error || n.error
487
+ status: e.error ? "error" : o.status,
488
+ isLoading: !e.error && o.status === "loading",
489
+ error: e.error || o.error
362
490
  };
363
491
  }
364
- function S(e, t, o, n) {
365
- const r = J(), i = q(t), a = q(n), [c, u] = k({
492
+ function S(t, e, n, o) {
493
+ const r = oe(), a = x(e), s = x(o), [c, i] = R({
366
494
  status: "idle",
367
- data: o,
495
+ data: n,
368
496
  error: null
369
497
  });
370
- return i.current = t, a.current = n, C(() => {
371
- let d;
498
+ return a.current = e, s.current = o, U(() => {
499
+ let p;
372
500
  try {
373
- d = i.current({
501
+ p = a.current({
374
502
  ...r,
375
- activeInputs: a.current
503
+ activeInputs: s.current
376
504
  });
377
- } catch (y) {
378
- u({
505
+ } catch (f) {
506
+ i({
379
507
  status: "error",
380
- data: o,
381
- error: m(y)
508
+ data: n,
509
+ error: m(f)
382
510
  });
383
511
  return;
384
512
  }
385
- if (!d) {
386
- u({ status: "idle", data: o, error: null });
513
+ if (!p) {
514
+ i({ status: "idle", data: n, error: null });
387
515
  return;
388
516
  }
389
517
  let l = !1;
390
- return u((y) => ({
518
+ return i((f) => ({
391
519
  status: "loading",
392
- data: y.data,
520
+ data: f.data,
393
521
  error: null
394
- })), d.then((y) => {
395
- l || u({ status: "success", data: y, error: null });
396
- }).catch((y) => {
397
- l || u({
522
+ })), p.then((f) => {
523
+ l || i({ status: "success", data: f, error: null });
524
+ }).catch((f) => {
525
+ l || i({
398
526
  status: "error",
399
- data: o,
400
- error: m(y)
527
+ data: n,
528
+ error: m(f)
401
529
  });
402
530
  }), () => {
403
531
  l = !0;
404
532
  };
405
- }, [o, e, r]), c;
533
+ }, [n, t, r]), c;
406
534
  }
407
535
  export {
408
- R as SemaphorDataAppContext,
409
- nt as SemaphorDataAppProvider,
410
- M as createSemaphorQueryExecutor,
536
+ b as SemaphorDataAppContext,
537
+ me as SemaphorDataAppProvider,
538
+ X as createSemaphorQueryExecutor,
411
539
  E as hasSemaphorInputValue,
412
- dt as normalizeSemaphorAnalysisQueryOptions,
413
- _ as normalizeSemaphorInputOptions,
414
- z as readWindowRuntime,
415
- x as toSemaphorActiveInputSnapshots,
416
- O as toSemaphorAnalysisIntent,
417
- g as toSemaphorAnalysisQueryOptions,
418
- pt as toSemaphorInputBinding,
419
- yt as toSemaphorInputBindings,
420
- $ as toSemaphorInputOptionsIntent,
421
- ft as toSemaphorInputSnapshots,
422
- b as toSemaphorInputSpec,
423
- K as toSemaphorMetricIntent,
424
- T as toSemaphorRecordsIntent,
425
- at as useSemaphorAnalysis,
426
- J as useSemaphorDataAppRuntime,
427
- ot as useSemaphorInput,
428
- st as useSemaphorInputOptions,
429
- it as useSemaphorMetric,
430
- ut as useSemaphorRecords,
431
- mt as validateSemaphorDataAppHookSpecs
540
+ O as normalizeSemaphorAnalysisPayload,
541
+ Ie as normalizeSemaphorAnalysisQueryOptions,
542
+ K as normalizeSemaphorInputOptions,
543
+ ne as readWindowRuntime,
544
+ k as toSemaphorActiveInputSnapshots,
545
+ C as toSemaphorAnalysisIntent,
546
+ q as toSemaphorAnalysisQueryOptions,
547
+ Ee as toSemaphorInputBinding,
548
+ xe as toSemaphorInputBindings,
549
+ T as toSemaphorInputOptionsIntent,
550
+ Re as toSemaphorInputSnapshots,
551
+ P as toSemaphorInputSpec,
552
+ w as toSemaphorMetricIntent,
553
+ _ as toSemaphorRecordsIntent,
554
+ ve as useSemaphorAnalysis,
555
+ oe as useSemaphorDataAppRuntime,
556
+ he as useSemaphorInput,
557
+ ge as useSemaphorInputOptions,
558
+ Se as useSemaphorMetric,
559
+ Ae as useSemaphorRecords,
560
+ Oe as validateSemaphorDataAppHookSpecs
432
561
  };