react-semaphor 0.1.344 → 0.1.346

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