@dcupl/common 2.0.0-beta.7 → 2.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,22 +1,22 @@
1
- import { cloneDeep as v, get as K, every as z, findIndex as C, size as W, isEqual as E, differenceBy as O, startsWith as L, endsWith as H, isEqualWith as S, isMatch as V, find as U } from "lodash-es";
2
- function N(n) {
3
- const e = Q(n);
4
- return J(e);
1
+ import { cloneDeep as v, get as I, every as z, findIndex as E, size as L, isEqual as $, differenceBy as O, startsWith as H, endsWith as U, isEqualWith as S, isMatch as V, find as J } from "lodash-es";
2
+ function K(n) {
3
+ const e = k(n);
4
+ return Z(e);
5
5
  }
6
- function Q(n) {
6
+ function k(n) {
7
7
  if (typeof n != "object" || n === null)
8
8
  return String(n);
9
9
  if (Array.isArray(n))
10
- return "[" + n.map(Q).join(",") + "]";
10
+ return "[" + n.map(k).join(",") + "]";
11
11
  const e = Object.keys(n).sort();
12
12
  let t = "{";
13
13
  for (let r = 0; r < e.length; r++) {
14
14
  const s = e[r];
15
- t += s + ":" + Q(n[s]), r < e.length - 1 && (t += ",");
15
+ t += s + ":" + k(n[s]), r < e.length - 1 && (t += ",");
16
16
  }
17
17
  return t += "}", t;
18
18
  }
19
- function J(n) {
19
+ function Z(n) {
20
20
  let e = 0;
21
21
  for (let t = 0; t < n.length; t++) {
22
22
  const r = n.charCodeAt(t);
@@ -41,7 +41,7 @@ const b = {
41
41
  return performance.getEntriesByType(n);
42
42
  }
43
43
  };
44
- class qe {
44
+ class Re {
45
45
  data;
46
46
  enabled = !1;
47
47
  constructor() {
@@ -69,9 +69,9 @@ class qe {
69
69
  const t = this.getKey(e.name, e.context), r = this.data.get(this.getKey(e.start, e.context)), s = this.data.get(this.getKey(e.end, e.context));
70
70
  if (!r || !s)
71
71
  return;
72
- const o = s.value - r.value, i = Math.round(o * 100) / 100, a = this.data.get(t);
72
+ const i = s.value - r.value, o = Math.round(i * 100) / 100, a = this.data.get(t);
73
73
  if (a && e.sum) {
74
- const c = a.value + i, f = {
74
+ const c = a.value + o, f = {
75
75
  ...a,
76
76
  value: c
77
77
  };
@@ -80,7 +80,7 @@ class qe {
80
80
  const u = {
81
81
  name: e.name,
82
82
  type: "measure",
83
- value: i,
83
+ value: o,
84
84
  createdAt: Date.now()
85
85
  };
86
86
  return e.detail && (u.detail = e.detail), this.data.set(t, u), u;
@@ -114,11 +114,11 @@ class qe {
114
114
  getKey(e, t) {
115
115
  if (!t)
116
116
  return e;
117
- const r = N(t);
117
+ const r = K(t);
118
118
  return e + "_" + r;
119
119
  }
120
120
  }
121
- let Z = class R {
121
+ let X = class _ {
122
122
  nodes;
123
123
  edges;
124
124
  nodeKinds = /* @__PURE__ */ new Map();
@@ -198,10 +198,10 @@ let Z = class R {
198
198
  if (t.has(s))
199
199
  return !0;
200
200
  t.add(s);
201
- const o = this.edges.get(s);
202
- if (o) {
203
- for (let i of o)
204
- if (r(i))
201
+ const i = this.edges.get(s);
202
+ if (i) {
203
+ for (let o of i)
204
+ if (r(o))
205
205
  return !0;
206
206
  }
207
207
  return t.delete(s), e.add(s), !1;
@@ -217,36 +217,36 @@ let Z = class R {
217
217
  * @returns {hasCycle: boolean, path?: string[]} - hasCycle is true if a cycle exists, path contains the cycle nodes
218
218
  */
219
219
  validateNoCycles() {
220
- const e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), r = [], s = (o) => {
221
- if (e.has(o))
220
+ const e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), r = [], s = (i) => {
221
+ if (e.has(i))
222
222
  return null;
223
- if (t.has(o)) {
224
- const a = r.indexOf(o);
225
- return r.slice(a).concat([o]);
223
+ if (t.has(i)) {
224
+ const a = r.indexOf(i);
225
+ return r.slice(a).concat([i]);
226
226
  }
227
- t.add(o), r.push(o);
228
- const i = this.edges.get(o);
229
- if (i)
230
- for (let a of i) {
227
+ t.add(i), r.push(i);
228
+ const o = this.edges.get(i);
229
+ if (o)
230
+ for (let a of o) {
231
231
  const u = s(a);
232
232
  if (u)
233
233
  return u;
234
234
  }
235
- return r.pop(), t.delete(o), e.add(o), null;
235
+ return r.pop(), t.delete(i), e.add(i), null;
236
236
  };
237
- for (let o of this.nodes) {
238
- const i = s(o);
239
- if (i)
240
- return { hasCycle: !0, path: i };
237
+ for (let i of this.nodes) {
238
+ const o = s(i);
239
+ if (o)
240
+ return { hasCycle: !0, path: o };
241
241
  }
242
242
  return { hasCycle: !1 };
243
243
  }
244
244
  order(e) {
245
- const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = [], o = e?.allowCycles ?? !1, i = (a) => {
245
+ const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = [], i = e?.allowCycles ?? !1, o = (a) => {
246
246
  if (t.has(a))
247
247
  return;
248
248
  if (r.has(a)) {
249
- if (o)
249
+ if (i)
250
250
  return;
251
251
  throw new Error("Graph has a cycle.");
252
252
  }
@@ -254,11 +254,11 @@ let Z = class R {
254
254
  const u = this.edges.get(a);
255
255
  if (u)
256
256
  for (let c of u)
257
- i(c);
257
+ o(c);
258
258
  r.delete(a), t.add(a), s.push(a);
259
259
  };
260
260
  for (let a of this.nodes)
261
- t.has(a) || i(a);
261
+ t.has(a) || o(a);
262
262
  return s;
263
263
  }
264
264
  clear() {
@@ -326,30 +326,30 @@ let Z = class R {
326
326
  */
327
327
  plan(e) {
328
328
  const t = /* @__PURE__ */ new Map();
329
- for (const i of this.nodes) t.set(i, 0);
330
- for (const i of this.edges.values())
331
- for (const a of i) t.set(a, (t.get(a) || 0) + 1);
329
+ for (const o of this.nodes) t.set(o, 0);
330
+ for (const o of this.edges.values())
331
+ for (const a of o) t.set(a, (t.get(a) || 0) + 1);
332
332
  const r = [];
333
- let s = Array.from(this.nodes).filter((i) => (t.get(i) || 0) === 0);
334
- const o = /* @__PURE__ */ new Set();
333
+ let s = Array.from(this.nodes).filter((o) => (t.get(o) || 0) === 0);
334
+ const i = /* @__PURE__ */ new Set();
335
335
  for (; s.length > 0; ) {
336
- const i = s.slice();
337
- r.push(i), s = [];
338
- for (const a of i) {
339
- if (o.has(a)) continue;
340
- o.add(a);
336
+ const o = s.slice();
337
+ r.push(o), s = [];
338
+ for (const a of o) {
339
+ if (i.has(a)) continue;
340
+ i.add(a);
341
341
  const u = this.edges.get(a);
342
342
  if (u)
343
343
  for (const c of u)
344
344
  t.set(c, (t.get(c) || 0) - 1), (t.get(c) || 0) === 0 && s.push(c);
345
345
  }
346
346
  }
347
- if (o.size !== this.nodes.size)
347
+ if (i.size !== this.nodes.size)
348
348
  throw new Error("Graph has a cycle.");
349
349
  if (e?.filterKinds && e.filterKinds.length > 0) {
350
- const i = new Set(e.filterKinds);
350
+ const o = new Set(e.filterKinds);
351
351
  return {
352
- batches: r.map((a) => a.filter((u) => i.has(this.nodeKinds.get(u))))
352
+ batches: r.map((a) => a.filter((u) => o.has(this.nodeKinds.get(u))))
353
353
  };
354
354
  }
355
355
  return { batches: r };
@@ -362,26 +362,26 @@ let Z = class R {
362
362
  * - 'both': union of upstream and downstream
363
363
  */
364
364
  getImpactedNodes(e, t = "downstream", r) {
365
- const s = new Set(e), o = (c) => !r || r.length === 0 || r.includes(this.nodeKinds.get(c) ?? void 0), i = () => {
365
+ const s = new Set(e), i = (c) => !r || r.length === 0 || r.includes(this.nodeKinds.get(c) ?? void 0), o = () => {
366
366
  const c = /* @__PURE__ */ new Set(), f = Array.from(s);
367
367
  for (; f.length; ) {
368
- const d = f.shift();
369
- for (const [l, h] of this.edges)
370
- h.has(d) && !c.has(l) && (c.add(l), f.push(l));
368
+ const l = f.shift();
369
+ for (const [d, h] of this.edges)
370
+ h.has(l) && !c.has(d) && (c.add(d), f.push(d));
371
371
  }
372
372
  return c;
373
373
  }, a = () => {
374
374
  const c = /* @__PURE__ */ new Set(), f = Array.from(s);
375
375
  for (; f.length; ) {
376
- const d = f.shift(), l = this.edges.get(d);
377
- if (l)
378
- for (const h of l)
376
+ const l = f.shift(), d = this.edges.get(l);
377
+ if (d)
378
+ for (const h of d)
379
379
  c.has(h) || (c.add(h), f.push(h));
380
380
  }
381
381
  return c;
382
382
  };
383
383
  let u;
384
- return t === "both" ? u = /* @__PURE__ */ new Set([...i(), ...a()]) : t === "upstream" ? u = a() : u = i(), Array.from(u).filter(o);
384
+ return t === "both" ? u = /* @__PURE__ */ new Set([...o(), ...a()]) : t === "upstream" ? u = a() : u = o(), Array.from(u).filter(i);
385
385
  }
386
386
  toJSON() {
387
387
  const e = Array.from(this.nodes).map((r) => ({
@@ -392,7 +392,7 @@ let Z = class R {
392
392
  return { nodes: e, edges: t };
393
393
  }
394
394
  static fromJSON(e) {
395
- const t = new R();
395
+ const t = new _();
396
396
  for (const r of e.nodes)
397
397
  t.addNode(r.name, { kind: r.kind, meta: r.meta });
398
398
  for (const r of e.edges)
@@ -400,19 +400,19 @@ let Z = class R {
400
400
  return t;
401
401
  }
402
402
  diff(e) {
403
- const t = new Set(this.getNodes()), r = new Set(e.getNodes()), s = Array.from(r).filter((d) => !t.has(d)), o = Array.from(t).filter((d) => !r.has(d)), i = new Set(this.getAllEdges().map((d) => d.join("→"))), a = new Set(e.getAllEdges().map((d) => d.join("→"))), u = Array.from(a).filter((d) => !i.has(d)).map((d) => d.split("→")), c = Array.from(i).filter((d) => !a.has(d)).map((d) => d.split("→")), f = [];
404
- for (const d of /* @__PURE__ */ new Set([...t, ...r])) {
405
- const l = this.nodeKinds.get(d), h = e.nodeKinds.get(d);
406
- l !== h && f.push({ name: d, from: l, to: h });
403
+ const t = new Set(this.getNodes()), r = new Set(e.getNodes()), s = Array.from(r).filter((l) => !t.has(l)), i = Array.from(t).filter((l) => !r.has(l)), o = new Set(this.getAllEdges().map((l) => l.join("→"))), a = new Set(e.getAllEdges().map((l) => l.join("→"))), u = Array.from(a).filter((l) => !o.has(l)).map((l) => l.split("→")), c = Array.from(o).filter((l) => !a.has(l)).map((l) => l.split("→")), f = [];
404
+ for (const l of /* @__PURE__ */ new Set([...t, ...r])) {
405
+ const d = this.nodeKinds.get(l), h = e.nodeKinds.get(l);
406
+ d !== h && f.push({ name: l, from: d, to: h });
407
407
  }
408
- return { addedNodes: s, removedNodes: o, addedEdges: u, removedEdges: c, kindChanges: f };
408
+ return { addedNodes: s, removedNodes: i, addedEdges: u, removedEdges: c, kindChanges: f };
409
409
  }
410
410
  };
411
- class $e {
411
+ class Te {
412
412
  graph;
413
413
  nodeIndex;
414
414
  constructor() {
415
- this.graph = new Z(), this.nodeIndex = /* @__PURE__ */ new Map();
415
+ this.graph = new X(), this.nodeIndex = /* @__PURE__ */ new Map();
416
416
  }
417
417
  /**
418
418
  * Creates a unique ID for an attribute node
@@ -454,10 +454,10 @@ class $e {
454
454
  * @returns Array of all impacted attribute nodes (including the changed ones)
455
455
  */
456
456
  getImpactedAttributes(e) {
457
- const t = e.map((a) => this.getNodeId(a.modelKey, a.attributeKey)), s = this.graph.getImpactedNodes(t, "downstream").map((a) => this.nodeIndex.get(a)).filter((a) => a !== void 0), o = [...e, ...s], i = /* @__PURE__ */ new Set();
458
- return o.filter((a) => {
457
+ const t = e.map((a) => this.getNodeId(a.modelKey, a.attributeKey)), s = this.graph.getImpactedNodes(t, "downstream").map((a) => this.nodeIndex.get(a)).filter((a) => a !== void 0), i = [...e, ...s], o = /* @__PURE__ */ new Set();
458
+ return i.filter((a) => {
459
459
  const u = this.getNodeId(a.modelKey, a.attributeKey);
460
- return i.has(u) ? !1 : (i.add(u), !0);
460
+ return o.has(u) ? !1 : (o.add(u), !0);
461
461
  });
462
462
  }
463
463
  /**
@@ -468,12 +468,12 @@ class $e {
468
468
  * @returns Map<modelKey, Map<processingStep, Set<attributeKeys>>>
469
469
  */
470
470
  getProcessingOrder(e) {
471
- const t = /* @__PURE__ */ new Map(), r = [...e].sort((s, o) => s.processingStep - o.processingStep);
471
+ const t = /* @__PURE__ */ new Map(), r = [...e].sort((s, i) => s.processingStep - i.processingStep);
472
472
  for (const s of r) {
473
- const { modelKey: o, attributeKey: i, processingStep: a } = s;
474
- t.has(o) || t.set(o, /* @__PURE__ */ new Map());
475
- const u = t.get(o);
476
- u.has(a) || u.set(a, /* @__PURE__ */ new Set()), u.get(a).add(i);
473
+ const { modelKey: i, attributeKey: o, processingStep: a } = s;
474
+ t.has(i) || t.set(i, /* @__PURE__ */ new Map());
475
+ const u = t.get(i);
476
+ u.has(a) || u.set(a, /* @__PURE__ */ new Set()), u.get(a).add(o);
477
477
  }
478
478
  return t;
479
479
  }
@@ -528,14 +528,14 @@ class $e {
528
528
  const t = (r, s = /* @__PURE__ */ new Set()) => {
529
529
  if (s.has(r)) return 0;
530
530
  s.add(r);
531
- const o = this.graph.getDependencies(r);
532
- if (o.length === 0) return 1;
533
- let i = 0;
534
- for (const a of o) {
531
+ const i = this.graph.getDependencies(r);
532
+ if (i.length === 0) return 1;
533
+ let o = 0;
534
+ for (const a of i) {
535
535
  const u = t(a, new Set(s));
536
- i = Math.max(i, u);
536
+ o = Math.max(o, u);
537
537
  }
538
- return i + 1;
538
+ return o + 1;
539
539
  };
540
540
  for (const r of this.graph.getNodes()) {
541
541
  const s = t(r);
@@ -554,9 +554,9 @@ class $e {
554
554
  validateCompleteness(e) {
555
555
  const t = [];
556
556
  for (const [r, s] of e)
557
- for (const o of s) {
558
- const i = this.getNodeId(r, o);
559
- this.hasNode(i) || t.push({ modelKey: r, attributeKey: o });
557
+ for (const i of s) {
558
+ const o = this.getNodeId(r, i);
559
+ this.hasNode(o) || t.push({ modelKey: r, attributeKey: i });
560
560
  }
561
561
  return {
562
562
  isComplete: t.length === 0,
@@ -667,19 +667,19 @@ class p {
667
667
  }
668
668
  formatMessage(e) {
669
669
  if (this.config.format === "json") {
670
- const i = {
670
+ const o = {
671
671
  timestamp: new Date(e.timestamp).toISOString(),
672
672
  level: e.level,
673
673
  message: e.message
674
674
  };
675
- return e.prefix && (i.module = e.prefix), e.context && (i.context = e.context), e.error && (i.error = {
675
+ return e.prefix && (o.module = e.prefix), e.context && (o.context = e.context), e.error && (o.error = {
676
676
  name: e.error.name,
677
677
  message: e.error.message,
678
678
  stack: e.error.stack
679
- }), JSON.stringify(i);
679
+ }), JSON.stringify(o);
680
680
  }
681
- const t = new Date(e.timestamp).toISOString().substring(11, 23), r = e.prefix ? `[${e.prefix}]` : "", s = this.getLevelIcon(e.level), o = e.context ? ` ${JSON.stringify(e.context)}` : "";
682
- return `${t} ${s} ${r} ${e.message}${o}`.trim();
681
+ const t = new Date(e.timestamp).toISOString().substring(11, 23), r = e.prefix ? `[${e.prefix}]` : "", s = this.getLevelIcon(e.level), i = e.context ? ` ${JSON.stringify(e.context)}` : "";
682
+ return `${t} ${s} ${r} ${e.message}${i}`.trim();
683
683
  }
684
684
  getLevelIcon(e) {
685
685
  switch (e) {
@@ -698,7 +698,7 @@ class p {
698
698
  log(e, t, r, s) {
699
699
  if (!this.shouldLog(e))
700
700
  return;
701
- const o = {
701
+ const i = {
702
702
  level: e,
703
703
  message: t,
704
704
  timestamp: Date.now(),
@@ -707,31 +707,31 @@ class p {
707
707
  error: s
708
708
  };
709
709
  if (this.config.onLog) {
710
- this.config.onLog(o);
710
+ this.config.onLog(i);
711
711
  return;
712
712
  }
713
- const i = this.formatMessage(o);
713
+ const o = this.formatMessage(i);
714
714
  if (typeof console < "u")
715
715
  switch (e) {
716
716
  case "error":
717
- s ? console.error(i, s) : console.error(i);
717
+ s ? console.error(o, s) : console.error(o);
718
718
  break;
719
719
  case "warn":
720
- console.warn(i);
720
+ console.warn(o);
721
721
  break;
722
722
  case "debug":
723
- console.debug ? console.debug(i) : console.log(i);
723
+ console.debug ? console.debug(o) : console.log(o);
724
724
  break;
725
725
  default:
726
- console.log(i);
726
+ console.log(o);
727
727
  }
728
728
  }
729
729
  /**
730
730
  * Log an error message
731
731
  */
732
732
  error(e, t, r) {
733
- const s = t instanceof Error ? t : void 0, o = t instanceof Error ? r : t;
734
- this.log("error", e, o, s);
733
+ const s = t instanceof Error ? t : void 0, i = t instanceof Error ? r : t;
734
+ this.log("error", e, i, s);
735
735
  }
736
736
  /**
737
737
  * Log and track an error (integrates with QualityController)
@@ -800,7 +800,7 @@ class p {
800
800
  }
801
801
  }
802
802
  const Y = new p();
803
- class Fe {
803
+ class Ge {
804
804
  constructor(e) {
805
805
  this.enabled = e, this.cache = /* @__PURE__ */ new Map(), this.cacheDependencies = /* @__PURE__ */ new Map();
806
806
  }
@@ -818,8 +818,8 @@ class Fe {
818
818
  }
819
819
  set(e, t, r, s) {
820
820
  if (!this.enabled) return;
821
- const o = this.getCacheName(e, t);
822
- this.cache.set(o, r), s ? this.cacheDependencies.set(o, s) : this.log.debug(
821
+ const i = this.getCacheName(e, t);
822
+ this.cache.set(i, r), s ? this.cacheDependencies.set(i, s) : this.log.debug(
823
823
  `Cache entry '${e}' stored without dependencies. This prevents granular invalidation and may cause stale data.`
824
824
  );
825
825
  }
@@ -837,21 +837,21 @@ class Fe {
837
837
  if (!this.enabled) return;
838
838
  const t = [];
839
839
  for (const [r, s] of this.cacheDependencies) {
840
- let o = !1;
841
- for (const [i, a] of e) {
842
- if (s.models.has(i))
843
- if (s.modelAttributes.has(i)) {
844
- const u = s.modelAttributes.get(i);
840
+ let i = !1;
841
+ for (const [o, a] of e) {
842
+ if (s.models.has(o))
843
+ if (s.modelAttributes.has(o)) {
844
+ const u = s.modelAttributes.get(o);
845
845
  for (const c of a)
846
846
  if (u.has(c)) {
847
- o = !0;
847
+ i = !0;
848
848
  break;
849
849
  }
850
850
  } else
851
- o = !0;
852
- if (o) break;
851
+ i = !0;
852
+ if (i) break;
853
853
  }
854
- o && t.push(r);
854
+ i && t.push(r);
855
855
  }
856
856
  for (const r of t)
857
857
  this.cache.delete(r), this.cacheDependencies.delete(r);
@@ -863,9 +863,9 @@ class Fe {
863
863
  invalidateByModels(e) {
864
864
  if (!this.enabled) return;
865
865
  const t = new Set(e), r = [];
866
- for (const [s, o] of this.cacheDependencies)
867
- for (const i of t)
868
- if (o.models.has(i)) {
866
+ for (const [s, i] of this.cacheDependencies)
867
+ for (const o of t)
868
+ if (i.models.has(o)) {
869
869
  r.push(s);
870
870
  break;
871
871
  }
@@ -921,7 +921,7 @@ class Fe {
921
921
  }
922
922
  }
923
923
  getCacheName(e, t) {
924
- const r = N(t);
924
+ const r = K(t);
925
925
  return e + "_" + r;
926
926
  }
927
927
  /**
@@ -939,42 +939,42 @@ class Fe {
939
939
  };
940
940
  }
941
941
  }
942
- const Te = (n, e = "") => `${n}#${e}`, Ge = (n) => `${n.gt}_${n.gte}_${n.lt}_${n.lte}_${n.eq}_${n.ne}`, ze = (n) => `${n.gt}_${n.gte}_${n.lt}_${n.lte}_${n.eq}_${n.ne}`, Re = (n, e) => {
942
+ const ze = (n, e = "") => `${n}#${e}`, _e = (n) => `${n.gt}_${n.gte}_${n.lt}_${n.lte}_${n.eq}_${n.ne}`, je = (n) => `${n.gt}_${n.gte}_${n.lt}_${n.lte}_${n.eq}_${n.ne}`, Be = (n, e) => {
943
943
  const t = typeof e == "function" ? e : (r) => r[e];
944
944
  return [
945
945
  ...n.reduce((r, s) => {
946
- const o = s == null ? s : t(s);
947
- return r.has(o) || r.set(o, s), r;
946
+ const i = s == null ? s : t(s);
947
+ return r.has(i) || r.set(i, s), r;
948
948
  }, /* @__PURE__ */ new Map()).values()
949
949
  ];
950
- }, je = (n, e) => n.reduce(function(t, r) {
950
+ }, Pe = (n, e) => n.reduce(function(t, r) {
951
951
  const s = typeof e == "function" ? e(r) : r[e];
952
952
  return Object.prototype.hasOwnProperty.call(t, s) || (t[s] = []), t[s].push(r), t;
953
953
  }, {});
954
- function X(n = 10) {
954
+ function ee(n = 10) {
955
955
  let e = "";
956
956
  const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
957
957
  for (let r = 0; r < n; r++) e += t.charAt(Math.floor(Math.random() * t.length));
958
958
  return e;
959
959
  }
960
- const Be = (n) => n.replace(/\/+$/, ""), ee = (n) => typeof n != "string" ? "" : n.replace(/[[\]{}()*+?.,\\^$|#]/g, "\\$&"), _e = (n) => typeof n != "string" ? "" : n.replace(/\\([[\]{}()*+?.,\\^$|#])/g, "$1"), Pe = (n, e) => {
960
+ const We = (n) => n.replace(/\/+$/, ""), te = (n) => typeof n != "string" ? "" : n.replace(/[[\]{}()*+?.,\\^$|#]/g, "\\$&"), Le = (n) => typeof n != "string" ? "" : n.replace(/\\([[\]{}()*+?.,\\^$|#])/g, "$1"), He = (n, e) => {
961
961
  try {
962
- return te(n, e) >= 0;
962
+ return re(n, e) >= 0;
963
963
  } catch {
964
964
  return !1;
965
965
  }
966
- }, te = (n, e) => {
967
- if (!$(n) || !$(e))
966
+ }, re = (n, e) => {
967
+ if (!F(n) || !F(e))
968
968
  throw new Error(`Invalid version format: v1="${n}", v2="${e}". Expected format: "x.y.z"`);
969
969
  const t = n.split(".").map(Number), r = e.split(".").map(Number);
970
970
  for (let s = 0; s < 3; s++) {
971
- const o = t[s] || 0, i = r[s] || 0;
972
- if (o > i) return 1;
973
- if (o < i) return -1;
971
+ const i = t[s] || 0, o = r[s] || 0;
972
+ if (i > o) return 1;
973
+ if (i < o) return -1;
974
974
  }
975
975
  return 0;
976
- }, $ = (n) => /^\d+(\.\d+){0,2}$/.test(n);
977
- class We {
976
+ }, F = (n) => /^\d+(\.\d+){0,2}$/.test(n);
977
+ class Ue {
978
978
  key;
979
979
  parentCd;
980
980
  dcuplInitOptions;
@@ -1010,17 +1010,17 @@ class We {
1010
1010
  };
1011
1011
  }
1012
1012
  }
1013
- const j = (n, e) => e ? typeof structuredClone < "u" ? structuredClone(n) : v(n) : n, F = (n, e, t, r, s, o) => {
1013
+ const j = (n, e) => e ? typeof structuredClone < "u" ? structuredClone(n) : v(n) : n, R = (n, e, t, r, s, i) => {
1014
1014
  try {
1015
- const i = !!e.dcuplInitOptions.performance?.clone?.enabled && !!t.cloneResult, a = j(o, i);
1015
+ const o = !!e.dcuplInitOptions.performance?.clone?.enabled && !!t.cloneResult, a = j(i, o);
1016
1016
  if (t.scope === "list" && (t.listKey = n.cdRef?.key || n.key, t.modelKey = n.model?.key || n.modelKey), t.type === "list_created" && t.args[0].listKey.startsWith("__global_list__") || t.listKey?.startsWith("__global_list__"))
1017
1017
  return a;
1018
1018
  const u = b.now(), c = u - r, f = Math.round(c * 1e3) / 1e3;
1019
1019
  t.duration = f, t.start = r, t.end = u;
1020
- const d = {
1020
+ const l = {
1021
1021
  duration: t.duration
1022
1022
  };
1023
- return t.modelKey && (d.model = t.modelKey), t.connectMessageResult && (t.result = a), t.args && (d.args = t.args), e?.trigger(t), e.analyticsController.mark({
1023
+ return t.modelKey && (l.model = t.modelKey), t.connectMessageResult && (t.result = a), t.args && (l.args = t.args), e?.trigger(t), e.analyticsController.mark({
1024
1024
  name: `${t.type}:end`,
1025
1025
  context: s
1026
1026
  }), e.analyticsController.measure({
@@ -1028,59 +1028,59 @@ const j = (n, e) => e ? typeof structuredClone < "u" ? structuredClone(n) : v(n)
1028
1028
  start: `${t.type}:start`,
1029
1029
  end: `${t.type}:end`,
1030
1030
  context: s,
1031
- detail: d
1031
+ detail: l
1032
1032
  }), a;
1033
1033
  } catch {
1034
- return o;
1034
+ return i;
1035
1035
  }
1036
- }, Le = (n) => (t, r, s) => {
1037
- const o = s.value;
1038
- return s.value = function(...i) {
1036
+ }, Ve = (n) => (t, r, s) => {
1037
+ const i = s.value;
1038
+ return s.value = function(...o) {
1039
1039
  const a = b.now(), u = this.cdRef, c = j(n, !0);
1040
1040
  c.key || (u.increaseCounter(), c.key = u.getCounter());
1041
- const f = X();
1041
+ const f = ee();
1042
1042
  u.analyticsController.mark({
1043
1043
  name: `${c.type}:start`,
1044
1044
  context: f
1045
1045
  });
1046
- const d = this.model?.key;
1047
- !c.originCdRefKey && u.key && (c.originCdRefKey = u.key), d && (c.modelKey = d);
1048
- const l = o.apply(this, i);
1049
- return c.method = r, c.args = i, l && typeof l == "object" && "then" in l ? l.then((h) => F(this, u, c, a, f, h)) : F(this, u, c, a, f, l);
1046
+ const l = this.model?.key;
1047
+ !c.originCdRefKey && u.key && (c.originCdRefKey = u.key), l && (c.modelKey = l);
1048
+ const d = i.apply(this, o);
1049
+ return c.method = r, c.args = o, d && typeof d == "object" && "then" in d ? d.then((h) => R(this, u, c, a, f, h)) : R(this, u, c, a, f, d);
1050
1050
  }, s;
1051
1051
  };
1052
- function He(n, e, t, r) {
1052
+ function Je(n, e, t, r) {
1053
1053
  t.max || (t.max = 20);
1054
- const s = [], o = t.transform ? r.transformValue(t.value, t.transform) : t.value;
1055
- for (const [i, a] of e.entries()) {
1056
- const u = Array.from(a).some((f) => n.has(f)), c = t.transform ? r.transformValue(i, t.transform) : i;
1057
- if (!(t.excludeUndefineds && typeof i > "u") && !(t.excludeNulls && i === null)) {
1058
- if (u && (o === "" || o === "//")) {
1054
+ const s = [], i = t.transform ? r.transformValue(t.value, t.transform) : t.value;
1055
+ for (const [o, a] of e.entries()) {
1056
+ const u = Array.from(a).some((f) => n.has(f)), c = t.transform ? r.transformValue(o, t.transform) : o;
1057
+ if (!(t.excludeUndefineds && typeof o > "u") && !(t.excludeNulls && o === null)) {
1058
+ if (u && (i === "" || i === "//")) {
1059
1059
  const f = {
1060
- value: i,
1060
+ value: o,
1061
1061
  keys: t.calculateResultKeys ? Array.from(a) : []
1062
1062
  };
1063
1063
  s.push(f);
1064
- } else if (u && typeof o == "string" && o.startsWith("/") && o.endsWith("/")) {
1065
- if (r.queryFind(c, o, "some")) {
1064
+ } else if (u && typeof i == "string" && i.startsWith("/") && i.endsWith("/")) {
1065
+ if (r.queryFind(c, i, "some")) {
1066
1066
  const f = {
1067
- value: i,
1067
+ value: o,
1068
1068
  keys: t.calculateResultKeys ? Array.from(a) : []
1069
1069
  };
1070
1070
  s.push(f);
1071
1071
  }
1072
- } else if (u && typeof o == "string") {
1073
- const f = String(c ?? ""), d = o;
1074
- if (f.toLowerCase().startsWith(d.toLowerCase())) {
1075
- const l = {
1076
- value: i,
1072
+ } else if (u && typeof i == "string") {
1073
+ const f = String(c ?? ""), l = i;
1074
+ if (f.toLowerCase().startsWith(l.toLowerCase())) {
1075
+ const d = {
1076
+ value: o,
1077
1077
  keys: t.calculateResultKeys ? Array.from(a) : []
1078
1078
  };
1079
- s.push(l);
1079
+ s.push(d);
1080
1080
  }
1081
- } else if (u && r.queryFind(c, o, "some")) {
1081
+ } else if (u && r.queryFind(c, i, "some")) {
1082
1082
  const f = {
1083
- value: i,
1083
+ value: o,
1084
1084
  keys: t.calculateResultKeys ? Array.from(a) : []
1085
1085
  };
1086
1086
  s.push(f);
@@ -1091,13 +1091,13 @@ function He(n, e, t, r) {
1091
1091
  }
1092
1092
  return s;
1093
1093
  }
1094
- function re(n) {
1094
+ function se(n) {
1095
1095
  return n instanceof Date;
1096
1096
  }
1097
- function se(n) {
1097
+ function ne(n) {
1098
1098
  return n instanceof Date && !isNaN(n.getTime());
1099
1099
  }
1100
- const ne = {
1100
+ const ie = {
1101
1101
  yyyy: { type: "year", pattern: "yyyy", regex: "(\\d{4})" },
1102
1102
  yy: { type: "year", pattern: "yy", regex: "(\\d{2})" },
1103
1103
  MM: { type: "month", pattern: "MM", regex: "(\\d{2})" },
@@ -1112,28 +1112,28 @@ const ne = {
1112
1112
  s: { type: "second", pattern: "s", regex: "(\\d{1,2})" },
1113
1113
  SSS: { type: "millisecond", pattern: "SSS", regex: "(\\d{3})" }
1114
1114
  };
1115
- function ie(n) {
1115
+ function oe(n) {
1116
1116
  let e = "^";
1117
1117
  const t = [];
1118
1118
  let r = n;
1119
- const s = Object.entries(ne).sort((o, i) => i[0].length - o[0].length);
1119
+ const s = Object.entries(ie).sort((i, o) => o[0].length - i[0].length);
1120
1120
  for (; r.length > 0; ) {
1121
- let o = !1;
1122
- for (const [i, a] of s)
1123
- if (r.startsWith(i)) {
1124
- e += a.regex, t.push({ type: a.type, pattern: i }), r = r.slice(i.length), o = !0;
1121
+ let i = !1;
1122
+ for (const [o, a] of s)
1123
+ if (r.startsWith(o)) {
1124
+ e += a.regex, t.push({ type: a.type, pattern: o }), r = r.slice(o.length), i = !0;
1125
1125
  break;
1126
1126
  }
1127
- if (!o) {
1128
- const i = r[0];
1129
- if (!i)
1127
+ if (!i) {
1128
+ const o = r[0];
1129
+ if (!o)
1130
1130
  break;
1131
- e += i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = r.slice(1);
1131
+ e += o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = r.slice(1);
1132
1132
  }
1133
1133
  }
1134
1134
  return e += "$", { regex: new RegExp(e), tokenOrder: t };
1135
1135
  }
1136
- function oe(n, e) {
1136
+ function ae(n, e) {
1137
1137
  const t = {
1138
1138
  year: 1970,
1139
1139
  month: 1,
@@ -1147,12 +1147,12 @@ function oe(n, e) {
1147
1147
  const s = n[r + 1];
1148
1148
  if (!s)
1149
1149
  continue;
1150
- const o = parseInt(s, 10), i = e[r];
1151
- i && (i.type === "year" && i.pattern === "yy" ? t.year = 2e3 + o : t[i.type] = o);
1150
+ const i = parseInt(s, 10), o = e[r];
1151
+ o && (o.type === "year" && o.pattern === "yy" ? t.year = 2e3 + i : t[o.type] = i);
1152
1152
  }
1153
1153
  return t;
1154
1154
  }
1155
- function ae(n) {
1155
+ function ue(n) {
1156
1156
  if (n.month < 1 || n.month > 12)
1157
1157
  return /* @__PURE__ */ new Date(NaN);
1158
1158
  if (n.day < 1 || n.day > 31)
@@ -1174,9 +1174,9 @@ function ae(n) {
1174
1174
  n.second,
1175
1175
  n.millisecond
1176
1176
  );
1177
- return se(e) ? e.getFullYear() !== n.year || e.getMonth() !== n.month - 1 || e.getDate() !== n.day ? /* @__PURE__ */ new Date(NaN) : e : /* @__PURE__ */ new Date(NaN);
1177
+ return ne(e) ? e.getFullYear() !== n.year || e.getMonth() !== n.month - 1 || e.getDate() !== n.day ? /* @__PURE__ */ new Date(NaN) : e : /* @__PURE__ */ new Date(NaN);
1178
1178
  }
1179
- function Ve(n, e, t) {
1179
+ function Ze(n, e, t) {
1180
1180
  if (n = n.trim(), e === "t") {
1181
1181
  const a = Number(n);
1182
1182
  return isNaN(a) ? /* @__PURE__ */ new Date(NaN) : new Date(a * 1e3);
@@ -1185,13 +1185,13 @@ function Ve(n, e, t) {
1185
1185
  const a = Number(n);
1186
1186
  return isNaN(a) ? /* @__PURE__ */ new Date(NaN) : new Date(a);
1187
1187
  }
1188
- const { regex: r, tokenOrder: s } = ie(e), o = n.match(r);
1189
- if (!o)
1188
+ const { regex: r, tokenOrder: s } = oe(e), i = n.match(r);
1189
+ if (!i)
1190
1190
  return /* @__PURE__ */ new Date(NaN);
1191
- const i = oe(o, s);
1192
- return ae(i);
1191
+ const o = ae(i, s);
1192
+ return ue(o);
1193
1193
  }
1194
- class ue {
1194
+ class ce {
1195
1195
  cache;
1196
1196
  maxSize;
1197
1197
  accessOrder;
@@ -1234,7 +1234,7 @@ class ue {
1234
1234
  };
1235
1235
  }
1236
1236
  }
1237
- class ce {
1237
+ class fe {
1238
1238
  graph;
1239
1239
  constructor() {
1240
1240
  this.graph = /* @__PURE__ */ new Map();
@@ -1244,25 +1244,25 @@ class ce {
1244
1244
  }
1245
1245
  hasCycle(e) {
1246
1246
  if (e.length === 0) return !1;
1247
- const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = (o) => {
1248
- t.add(o), r.add(o);
1249
- const i = this.graph.get(o);
1250
- if (i) {
1251
- for (const a of i)
1247
+ const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = (i) => {
1248
+ t.add(i), r.add(i);
1249
+ const o = this.graph.get(i);
1250
+ if (o) {
1251
+ for (const a of o)
1252
1252
  if (t.has(a)) {
1253
1253
  if (r.has(a))
1254
1254
  return !0;
1255
1255
  } else if (s(a))
1256
1256
  return !0;
1257
1257
  }
1258
- return r.delete(o), !1;
1258
+ return r.delete(i), !1;
1259
1259
  };
1260
- for (let o = 0; o < e.length - 1; o++) {
1261
- const i = e[o], a = e[o + 1];
1262
- i && a && this.addDependency(i, a);
1260
+ for (let i = 0; i < e.length - 1; i++) {
1261
+ const o = e[i], a = e[i + 1];
1262
+ o && a && this.addDependency(o, a);
1263
1263
  }
1264
- for (const o of e)
1265
- if (!t.has(o) && s(o))
1264
+ for (const i of e)
1265
+ if (!t.has(i) && s(i))
1266
1266
  return !0;
1267
1267
  return !1;
1268
1268
  }
@@ -1270,13 +1270,13 @@ class ce {
1270
1270
  this.graph.clear();
1271
1271
  }
1272
1272
  }
1273
- class fe {
1273
+ class le {
1274
1274
  parseCache;
1275
1275
  circularRefDetector;
1276
1276
  cacheHits = 0;
1277
1277
  cacheMisses = 0;
1278
1278
  constructor(e = 1e3) {
1279
- this.parseCache = new ue(e), this.circularRefDetector = new ce();
1279
+ this.parseCache = new ce(e), this.circularRefDetector = new fe();
1280
1280
  }
1281
1281
  /**
1282
1282
  * Parse an attribute string into its components
@@ -1301,9 +1301,9 @@ class fe {
1301
1301
  return this.cacheHits++, this.parseCache.get(e);
1302
1302
  this.cacheMisses++;
1303
1303
  let t, r;
1304
- const s = e.includes("."), o = e.includes("["), i = s || o;
1305
- if (i)
1306
- if (r = e.split(/[.[]/)[0], o) {
1304
+ const s = e.includes("."), i = e.includes("["), o = s || i;
1305
+ if (o)
1306
+ if (r = e.split(/[.[]/)[0], i) {
1307
1307
  const u = e.indexOf("]");
1308
1308
  if (u > -1) {
1309
1309
  const c = e.indexOf(".", u + 1);
@@ -1312,7 +1312,7 @@ class fe {
1312
1312
  } else s && (t = e.substring(e.indexOf(".") + 1));
1313
1313
  const a = {
1314
1314
  attribute: e,
1315
- isDeepQuery: i
1315
+ isDeepQuery: o
1316
1316
  };
1317
1317
  return r && (a.reference = r), typeof t < "u" && t !== "" && (a.referenceAttribute = t), this.parseCache.set(e, a), a;
1318
1318
  }
@@ -1365,11 +1365,11 @@ class fe {
1365
1365
  if (!e || e.trim().length === 0)
1366
1366
  return r.push("Attribute path cannot be empty"), { valid: !1, errors: r };
1367
1367
  (e.startsWith(".") || e.endsWith(".")) && r.push(`Invalid path: Leading or trailing dots are not allowed: ${e}`), e.includes("..") && r.push(`Invalid path: Consecutive dots are not allowed: ${e}`);
1368
- const s = (e.match(/\[/g) || []).length, o = (e.match(/]/g) || []).length;
1369
- s !== o && r.push(`Invalid bracket notation: Mismatched brackets in ${e}`), e.includes("[]") && r.push(`Invalid bracket notation: Empty brackets not allowed: ${e}`);
1370
- const i = /\[([^\]]+)\]/g;
1368
+ const s = (e.match(/\[/g) || []).length, i = (e.match(/]/g) || []).length;
1369
+ s !== i && r.push(`Invalid bracket notation: Mismatched brackets in ${e}`), e.includes("[]") && r.push(`Invalid bracket notation: Empty brackets not allowed: ${e}`);
1370
+ const o = /\[([^\]]+)\]/g;
1371
1371
  let a;
1372
- for (; (a = i.exec(e)) !== null; ) {
1372
+ for (; (a = o.exec(e)) !== null; ) {
1373
1373
  const f = a[1];
1374
1374
  f && f !== "*" && !/^\d+$/.test(f) && r.push(`Invalid bracket content: Must be a number or '*', got '${f}' in ${e}`);
1375
1375
  }
@@ -1435,10 +1435,10 @@ class fe {
1435
1435
  return this.getPathSegments(e).length;
1436
1436
  }
1437
1437
  }
1438
- const y = new fe();
1438
+ const y = new le();
1439
1439
  function x(n, e) {
1440
1440
  if (e.includes("[*]")) {
1441
- const o = e.indexOf("[*]"), i = e.substring(0, o), a = e.substring(o + 3), u = i ? K(n, i) : n;
1441
+ const i = e.indexOf("[*]"), o = e.substring(0, i), a = e.substring(i + 3), u = o ? I(n, o) : n;
1442
1442
  if (!Array.isArray(u)) return [];
1443
1443
  const c = [];
1444
1444
  for (const f of u)
@@ -1447,30 +1447,30 @@ function x(n, e) {
1447
1447
  }
1448
1448
  const t = e.split(".");
1449
1449
  let r = [n];
1450
- for (const o of t) {
1451
- const i = [];
1450
+ for (const i of t) {
1451
+ const o = [];
1452
1452
  for (const a of r)
1453
1453
  if (a != null)
1454
1454
  if (Array.isArray(a))
1455
1455
  for (const u of a) {
1456
1456
  if (u == null) continue;
1457
- const c = u[o];
1458
- c !== void 0 && i.push(c);
1457
+ const c = u[i];
1458
+ c !== void 0 && o.push(c);
1459
1459
  }
1460
1460
  else {
1461
- const u = a[o];
1462
- u !== void 0 && i.push(u);
1461
+ const u = a[i];
1462
+ u !== void 0 && o.push(u);
1463
1463
  }
1464
- if (r = i, r.length === 0) return [];
1464
+ if (r = o, r.length === 0) return [];
1465
1465
  }
1466
1466
  const s = [];
1467
- for (const o of r)
1468
- if (Array.isArray(o))
1469
- for (const i of o) i !== void 0 && s.push(i);
1470
- else o !== void 0 && s.push(o);
1467
+ for (const i of r)
1468
+ if (Array.isArray(i))
1469
+ for (const o of i) o !== void 0 && s.push(o);
1470
+ else i !== void 0 && s.push(i);
1471
1471
  return s;
1472
1472
  }
1473
- function I(n) {
1473
+ function Q(n) {
1474
1474
  let e = 0;
1475
1475
  for (let t of n) {
1476
1476
  const r = t.toString().split(".")[1];
@@ -1484,42 +1484,42 @@ function T(n, e, t) {
1484
1484
  function de(n, e, t) {
1485
1485
  return n * t / (e * t);
1486
1486
  }
1487
- const k = (n, e, t, r) => {
1487
+ const C = (n, e, t, r) => {
1488
1488
  if (!r)
1489
1489
  throw new Error("Attribute not found");
1490
1490
  const s = {
1491
1491
  attribute: r,
1492
1492
  types: n.types
1493
1493
  };
1494
- let o;
1495
- (s.types.includes("sum") || s.types.includes("avg")) && (o = ge(r, e));
1496
1494
  let i;
1497
- return (s.types.includes("min") || s.types.includes("max")) && (i = he(r, e)), n.types.forEach((a) => {
1498
- a === "sum" ? s.sum = o?.sum : a === "avg" ? s.avg = o?.average : a === "count" ? s.count = le(r, e) : a === "min" ? s.min = i && i[0] : a === "max" ? s.max = i && i[1] : a === "distinct" ? s.distinct = ye(n, e, t) : a === "group" && (s.group = pe(n, e));
1495
+ (s.types.includes("sum") || s.types.includes("avg")) && (i = ye(r, e));
1496
+ let o;
1497
+ return (s.types.includes("min") || s.types.includes("max")) && (o = pe(r, e)), n.types.forEach((a) => {
1498
+ a === "sum" ? s.sum = i?.sum : a === "avg" ? s.avg = i?.average : a === "count" ? s.count = he(r, e) : a === "min" ? s.min = o && o[0] : a === "max" ? s.max = o && o[1] : a === "distinct" ? s.distinct = me(n, e, t) : a === "group" && (s.group = ge(n, e));
1499
1499
  }), s;
1500
- }, le = (n, e) => {
1500
+ }, he = (n, e) => {
1501
1501
  const r = y.parse(n).isDeepQuery;
1502
1502
  let s = 0;
1503
- for (const o of e.values())
1504
- if (o)
1503
+ for (const i of e.values())
1504
+ if (i)
1505
1505
  if (r)
1506
- s += x(o, n).filter((i) => i != null).length;
1506
+ s += x(i, n).filter((o) => o != null).length;
1507
1507
  else {
1508
- const i = o[n];
1509
- if (i == null) continue;
1510
- Array.isArray(i) ? s += i.filter((a) => a != null).length : s++;
1508
+ const o = i[n];
1509
+ if (o == null) continue;
1510
+ Array.isArray(o) ? s += o.filter((a) => a != null).length : s++;
1511
1511
  }
1512
1512
  return s;
1513
- }, he = (n, e) => {
1513
+ }, pe = (n, e) => {
1514
1514
  let t, r;
1515
- const o = y.parse(n).isDeepQuery;
1516
- for (const i of e.values()) {
1517
- if (!i) continue;
1515
+ const i = y.parse(n).isDeepQuery;
1516
+ for (const o of e.values()) {
1517
+ if (!o) continue;
1518
1518
  let a;
1519
- if (o)
1520
- a = x(i, n);
1519
+ if (i)
1520
+ a = x(o, n);
1521
1521
  else {
1522
- const u = i[n];
1522
+ const u = o[n];
1523
1523
  u === void 0 ? a = [] : Array.isArray(u) ? a = u.filter((c) => c !== void 0) : a = [u];
1524
1524
  }
1525
1525
  for (const u of a)
@@ -1527,11 +1527,11 @@ const k = (n, e, t, r) => {
1527
1527
  }
1528
1528
  if (!(t === void 0 || r === void 0))
1529
1529
  return [t, r];
1530
- }, pe = (n, e) => {
1530
+ }, ge = (n, e) => {
1531
1531
  const t = [];
1532
- n.groupOptions?.groups?.forEach((i) => {
1532
+ n.groupOptions?.groups?.forEach((o) => {
1533
1533
  t.push({
1534
- option: i,
1534
+ option: o,
1535
1535
  count: 0,
1536
1536
  keys: []
1537
1537
  });
@@ -1540,24 +1540,24 @@ const k = (n, e, t, r) => {
1540
1540
  option: { value: ["$dcupl_not_found"] },
1541
1541
  count: 0,
1542
1542
  keys: []
1543
- }, o = y.parse(n.attribute).isDeepQuery;
1544
- for (const i of e.values()) {
1543
+ }, i = y.parse(n.attribute).isDeepQuery;
1544
+ for (const o of e.values()) {
1545
1545
  let a;
1546
- o ? a = x(i, n.attribute) : a = [i[n.attribute]];
1546
+ i ? a = x(o, n.attribute) : a = [o[n.attribute]];
1547
1547
  let u = !1;
1548
1548
  for (const c of a)
1549
1549
  for (const f of t)
1550
- (typeof f.option.value < "u" && f.option.value.includes(c) || typeof f.option.from < "u" && f.option.from < c && typeof f.option.to < "u" && f.option.to > c) && (f.keys.includes(i.key) || (f.count++, f.keys.push(i.key)), u = !0);
1551
- !u && n?.groupOptions?.calculateNotFound && (r.count++, r.keys.push(i.key));
1550
+ (typeof f.option.value < "u" && f.option.value.includes(c) || typeof f.option.from < "u" && f.option.from < c && typeof f.option.to < "u" && f.option.to > c) && (f.keys.includes(o.key) || (f.count++, f.keys.push(o.key)), u = !0);
1551
+ !u && n?.groupOptions?.calculateNotFound && (r.count++, r.keys.push(o.key));
1552
1552
  }
1553
1553
  return n?.groupOptions?.calculateNotFound && t.push(r), t;
1554
- }, ge = (n, e) => {
1554
+ }, ye = (n, e) => {
1555
1555
  let t = 0, r = 0;
1556
- const o = y.parse(n).isDeepQuery;
1556
+ const i = y.parse(n).isDeepQuery;
1557
1557
  for (const a of e.values()) {
1558
1558
  if (!a) continue;
1559
1559
  let u;
1560
- if (o)
1560
+ if (i)
1561
1561
  u = x(a, n);
1562
1562
  else {
1563
1563
  const c = a[n];
@@ -1566,23 +1566,23 @@ const k = (n, e, t, r) => {
1566
1566
  for (const c of u)
1567
1567
  if (Array.isArray(c))
1568
1568
  for (const f of c)
1569
- typeof f == "number" && (t = T(t, f, I([t, f])), r++);
1570
- else typeof c == "number" && (t = T(t, c, I([t, c])), r++);
1569
+ typeof f == "number" && (t = T(t, f, Q([t, f])), r++);
1570
+ else typeof c == "number" && (t = T(t, c, Q([t, c])), r++);
1571
1571
  }
1572
1572
  return r === 0 ? void 0 : {
1573
- average: de(t, r, I([t, r])),
1573
+ average: de(t, r, Q([t, r])),
1574
1574
  count: r,
1575
1575
  sum: t
1576
1576
  };
1577
- }, ye = (n, e, t) => {
1577
+ }, me = (n, e, t) => {
1578
1578
  const r = [];
1579
- for (const [s, o] of t)
1580
- if (!(n.excludeUndefineds && typeof s > "u") && Array.from(o).find((i) => e.has(i))) {
1581
- const i = {
1579
+ for (const [s, i] of t)
1580
+ if (!(n.excludeUndefineds && typeof s > "u") && Array.from(i).find((o) => e.has(o))) {
1581
+ const o = {
1582
1582
  value: s,
1583
- count: o.size
1583
+ count: i.size
1584
1584
  };
1585
- if (n.distinctOptions?.skipKeys || (i.keys = Array.from(o)), r.push(i), n.distinctOptions?.limit && r.length >= n.distinctOptions.limit)
1585
+ if (n.distinctOptions?.skipKeys || (o.keys = Array.from(i)), r.push(o), n.distinctOptions?.limit && r.length >= n.distinctOptions.limit)
1586
1586
  break;
1587
1587
  }
1588
1588
  return r;
@@ -1697,11 +1697,11 @@ class B {
1697
1697
  e.groupType && (r.groupType = e.groupType), t?.mode === "set" ? r.queries = e.queries : r.queries = [...r.queries, ...e.queries], this.applyOptions(e, "set");
1698
1698
  else if (this.isQuery(e)) {
1699
1699
  const s = r.queries.findIndex(
1700
- (o) => this.isQueryGroup(o) && o.groupKey === e.attribute
1700
+ (i) => this.isQueryGroup(i) && i.groupKey === e.attribute
1701
1701
  );
1702
1702
  if (s > -1) {
1703
- const o = r.queries[s];
1704
- t?.mode === "set" ? o.queries = [e] : o.queries.push(e);
1703
+ const i = r.queries[s];
1704
+ t?.mode === "set" ? i.queries = [e] : i.queries.push(e);
1705
1705
  } else
1706
1706
  r.queries.push({
1707
1707
  groupKey: e.attribute,
@@ -1710,11 +1710,11 @@ class B {
1710
1710
  });
1711
1711
  } else if (this.isQueryGroup(e)) {
1712
1712
  const s = r.queries.findIndex(
1713
- (o) => this.isQueryGroup(o) && o.groupKey === e.groupKey
1713
+ (i) => this.isQueryGroup(i) && i.groupKey === e.groupKey
1714
1714
  );
1715
1715
  if (s > -1) {
1716
- const o = r.queries[s];
1717
- e.groupType && (o.groupType = e.groupType), t?.mode === "set" ? r.queries[s] = e : o.queries = [...o.queries, ...e.queries];
1716
+ const i = r.queries[s];
1717
+ e.groupType && (i.groupType = e.groupType), t?.mode === "set" ? r.queries[s] = e : i.queries = [...i.queries, ...e.queries];
1718
1718
  } else
1719
1719
  r.queries.push({
1720
1720
  groupKey: e.groupKey,
@@ -1747,8 +1747,8 @@ class B {
1747
1747
  (s) => this.isQueryGroup(s) && s.groupKey === e.attribute
1748
1748
  );
1749
1749
  if (r > -1) {
1750
- const s = t.queries[r], o = C(s.queries, e);
1751
- o > -1 && s.queries.splice(o, 1), s.queries.length === 0 && t.queries.splice(r, 1);
1750
+ const s = t.queries[r], i = E(s.queries, e);
1751
+ i > -1 && s.queries.splice(i, 1), s.queries.length === 0 && t.queries.splice(r, 1);
1752
1752
  }
1753
1753
  } else if (this.isQueryGroup(e)) {
1754
1754
  const r = t.queries.findIndex(
@@ -1759,9 +1759,9 @@ class B {
1759
1759
  t.queries.splice(r, 1);
1760
1760
  else {
1761
1761
  const s = t.queries[r];
1762
- for (const o of e.queries) {
1763
- const i = C(s.queries, o);
1764
- i > -1 && s.queries.splice(i, 1);
1762
+ for (const i of e.queries) {
1763
+ const o = E(s.queries, i);
1764
+ o > -1 && s.queries.splice(o, 1);
1765
1765
  }
1766
1766
  s.queries.length === 0 && t.queries.splice(r, 1);
1767
1767
  }
@@ -1773,8 +1773,8 @@ class B {
1773
1773
  if (this.isQuery(e))
1774
1774
  return e.attribute || t.push(new A("Missing attribute", e)), e.operator || t.push(new A("Missing operator", e)), typeof e.value > "u" && t.push(new A("Missing value", e)), e.operator === "find" && Array.isArray(e.value) && t.push(new A("find operator cannot have array value", e)), t.length > 0 ? { valid: !1, errors: t } : { valid: !0 };
1775
1775
  if (this.isQueryGroup(e)) {
1776
- const o = e.queries.map((i) => this.validateQuery(i)).filter((i) => !i.valid).map((i) => i.errors).flat();
1777
- return o.length > 0 ? { valid: !1, errors: o } : { valid: !0 };
1776
+ const i = e.queries.map((o) => this.validateQuery(o)).filter((o) => !o.valid).map((o) => o.errors).flat();
1777
+ return i.length > 0 ? { valid: !1, errors: i } : { valid: !0 };
1778
1778
  }
1779
1779
  return t.push(new A("Invalid query definition", e)), { valid: !1, errors: t };
1780
1780
  }
@@ -1786,9 +1786,9 @@ class B {
1786
1786
  * @returns Array of attribute names
1787
1787
  */
1788
1788
  getQueryAttributes(e) {
1789
- const t = [], r = /* @__PURE__ */ new Set(), s = (o) => {
1790
- for (const i of o)
1791
- this.isQuery(i) ? i.attribute && !r.has(i.attribute) && (t.push(i.attribute), r.add(i.attribute)) : this.isQueryGroup(i) && s(i.queries);
1789
+ const t = [], r = /* @__PURE__ */ new Set(), s = (i) => {
1790
+ for (const o of i)
1791
+ this.isQuery(o) ? o.attribute && !r.has(o.attribute) && (t.push(o.attribute), r.add(o.attribute)) : this.isQueryGroup(o) && s(o.queries);
1792
1792
  };
1793
1793
  return s(e?.queries || this.currentQuery.queries), t;
1794
1794
  }
@@ -1800,14 +1800,14 @@ class B {
1800
1800
  * @returns Array of QueryAttributeEntry objects
1801
1801
  */
1802
1802
  extractQueryAttributes(e) {
1803
- const t = [], r = /* @__PURE__ */ new Set(), s = (o) => {
1804
- for (const i of o)
1805
- if (this.isQuery(i)) {
1806
- if (i.attribute && !r.has(i.attribute)) {
1807
- const a = this.getQueryAttributeForString(i.attribute);
1808
- t.push(a), r.add(i.attribute);
1803
+ const t = [], r = /* @__PURE__ */ new Set(), s = (i) => {
1804
+ for (const o of i)
1805
+ if (this.isQuery(o)) {
1806
+ if (o.attribute && !r.has(o.attribute)) {
1807
+ const a = this.getQueryAttributeForString(o.attribute);
1808
+ t.push(a), r.add(o.attribute);
1809
1809
  }
1810
- } else this.isQueryGroup(i) && s(i.queries);
1810
+ } else this.isQueryGroup(o) && s(o.queries);
1811
1811
  };
1812
1812
  return s(e?.queries || this.currentQuery.queries), t;
1813
1813
  }
@@ -1848,9 +1848,9 @@ class B {
1848
1848
  t[r.reference] || (t[r.reference] = { $: !0 });
1849
1849
  const s = this.deepQueryService.parse(r.referenceAttribute);
1850
1850
  if (s.isDeepQuery && r.reference) {
1851
- const o = this.getProjectionForAttributeEntries([s]);
1852
- Object.keys(o).forEach((i) => {
1853
- i !== "$" && r.reference && (t[r.reference][i] = o[i]);
1851
+ const i = this.getProjectionForAttributeEntries([s]);
1852
+ Object.keys(i).forEach((o) => {
1853
+ o !== "$" && r.reference && (t[r.reference][o] = i[o]);
1854
1854
  });
1855
1855
  } else r.reference && (t[r.reference][r.referenceAttribute] = !0);
1856
1856
  } else
@@ -2148,13 +2148,13 @@ class B {
2148
2148
  const t = (r) => {
2149
2149
  for (const s of r)
2150
2150
  if (this.isQuery(s)) {
2151
- let o = !0;
2152
- for (const i in e)
2153
- if (s[i] !== e[i]) {
2154
- o = !1;
2151
+ let i = !0;
2152
+ for (const o in e)
2153
+ if (s[o] !== e[o]) {
2154
+ i = !1;
2155
2155
  break;
2156
2156
  }
2157
- if (o) return !0;
2157
+ if (i) return !0;
2158
2158
  } else if (this.isQueryGroup(s) && t(s.queries))
2159
2159
  return !0;
2160
2160
  return !1;
@@ -2275,24 +2275,24 @@ class B {
2275
2275
  return e(this.currentQuery.queries);
2276
2276
  }
2277
2277
  }
2278
- const M = new B();
2279
- function Ue(n, e, t, r, s, o, i) {
2280
- const a = M.removeQuery({ groupKey: s }, v(r)), u = i.queryData(n, a, !1, o), c = e ? [...e.keys()] : [], f = new Set(c), d = o.get(s);
2278
+ const N = new B();
2279
+ function Xe(n, e, t, r, s, i, o) {
2280
+ const a = N.removeQuery({ groupKey: s }, v(r)), u = o.queryData(n, a, !1, i), c = e ? [...e.keys()] : [], f = new Set(c), l = i.get(s);
2281
2281
  if (!t.excludeUnresolved)
2282
- for (const h of d.keys())
2282
+ for (const h of l.keys())
2283
2283
  f.add(h);
2284
2284
  if (t.excludeUndefineds ? f.delete(void 0) : f.add(void 0), t.sort) {
2285
2285
  const h = [];
2286
2286
  for (const m of f.values())
2287
- h.push(G(m, d, u, e, s, r, !0));
2287
+ h.push(G(m, l, u, e, s, r, !0));
2288
2288
  const g = t.excludeZeros ? h.filter((m) => m.size > 0) : h;
2289
- return g.sort(me(t.sort)), t.count ? g.slice(0, t.count) : g;
2289
+ return g.sort(ve(t.sort)), t.count ? g.slice(0, t.count) : g;
2290
2290
  }
2291
- const l = [];
2291
+ const d = [];
2292
2292
  for (const h of f.values()) {
2293
2293
  const g = G(
2294
2294
  h,
2295
- d,
2295
+ l,
2296
2296
  u,
2297
2297
  e,
2298
2298
  s,
@@ -2300,24 +2300,24 @@ function Ue(n, e, t, r, s, o, i) {
2300
2300
  !!t?.calculateFacets
2301
2301
  );
2302
2302
  if (!(t?.excludeZeros && g.size === 0)) {
2303
- if (t?.count && l.length === t?.count)
2304
- return l;
2305
- l.push(g);
2303
+ if (t?.count && d.length === t?.count)
2304
+ return d;
2305
+ d.push(g);
2306
2306
  }
2307
2307
  }
2308
- return l;
2308
+ return d;
2309
2309
  }
2310
- function G(n, e, t, r, s, o, i) {
2310
+ function G(n, e, t, r, s, i, o) {
2311
2311
  const a = /* @__PURE__ */ new Map(), u = e.get(n) || /* @__PURE__ */ new Set();
2312
2312
  for (const c of u) {
2313
2313
  const f = t.get(c);
2314
- if (f && (a.set(c, f), !i))
2314
+ if (f && (a.set(c, f), !o))
2315
2315
  break;
2316
2316
  }
2317
2317
  return {
2318
2318
  key: String(n),
2319
2319
  value: n,
2320
- selected: ve(s, n, o),
2320
+ selected: we(s, n, i),
2321
2321
  enabled: a.size > 0,
2322
2322
  size: a.size,
2323
2323
  entry: r.get(n),
@@ -2332,10 +2332,10 @@ function D(n, e) {
2332
2332
  if (t !== r) return t < r ? -1 : 1;
2333
2333
  if (t === "number") return n - e;
2334
2334
  if (t === "string") return n.localeCompare(e);
2335
- const s = String(n), o = String(e);
2336
- return s < o ? -1 : s > o ? 1 : 0;
2335
+ const s = String(n), i = String(e);
2336
+ return s < i ? -1 : s > i ? 1 : 0;
2337
2337
  }
2338
- function me(n) {
2338
+ function ve(n) {
2339
2339
  switch (n) {
2340
2340
  case "size-desc":
2341
2341
  return (e, t) => t.size - e.size || D(e.value, t.value);
@@ -2347,17 +2347,17 @@ function me(n) {
2347
2347
  return (e, t) => e.value === void 0 && t.value === void 0 ? 0 : e.value === void 0 ? 1 : t.value === void 0 ? -1 : -D(e.value, t.value);
2348
2348
  }
2349
2349
  }
2350
- const ve = (n, e, t) => {
2351
- const r = t.queries.findIndex((s) => M.isQueryGroup(s) && s.groupKey === n);
2352
- return r > -1 ? !!t.queries[r].queries.find((o) => {
2353
- if (M.isQuery(o)) {
2354
- const i = o.value?.key || o.value;
2355
- return o.attribute === n && i === e;
2350
+ const we = (n, e, t) => {
2351
+ const r = t.queries.findIndex((s) => N.isQueryGroup(s) && s.groupKey === n);
2352
+ return r > -1 ? !!t.queries[r].queries.find((i) => {
2353
+ if (N.isQuery(i)) {
2354
+ const o = i.value?.key || i.value;
2355
+ return i.attribute === n && o === e;
2356
2356
  }
2357
2357
  return !1;
2358
2358
  }) : !1;
2359
2359
  };
2360
- class we {
2360
+ class xe {
2361
2361
  indexMap = /* @__PURE__ */ new Map();
2362
2362
  // Possible performance gain*
2363
2363
  dataMap = /* @__PURE__ */ new Map();
@@ -2371,33 +2371,33 @@ class we {
2371
2371
  let r = this.dataMap.get(e);
2372
2372
  r || (r = /* @__PURE__ */ new Map(), this.dataMap.set(e, r));
2373
2373
  for (const s of t) {
2374
- let o;
2374
+ let i;
2375
2375
  if (typeof s == "object" && s && s.key)
2376
- o = s.key;
2376
+ i = s.key;
2377
2377
  else if (Array.isArray(s)) {
2378
2378
  for (const a of s)
2379
2379
  this.fillDataMap(e, [a]);
2380
2380
  return;
2381
- } else s instanceof Date ? o = s.toISOString() : o = s;
2382
- let i = r.get(o);
2383
- i || (i = { key: o }, this.dataMap.get(e)?.set(o, i));
2381
+ } else s instanceof Date ? i = s.toISOString() : i = s;
2382
+ let o = r.get(i);
2383
+ o || (o = { key: i }, this.dataMap.get(e)?.set(i, o));
2384
2384
  }
2385
2385
  }
2386
2386
  fillInverseIndex(e, t, r) {
2387
2387
  if (!e || !t || !r || !Array.isArray(r))
2388
2388
  return;
2389
2389
  const s = this.indexMap.get(e) || /* @__PURE__ */ new Map();
2390
- for (const o of r) {
2391
- let i;
2392
- if (typeof o == "object" && o && o.key)
2393
- i = o.key;
2394
- else if (Array.isArray(o)) {
2395
- for (const u of o)
2390
+ for (const i of r) {
2391
+ let o;
2392
+ if (typeof i == "object" && i && i.key)
2393
+ o = i.key;
2394
+ else if (Array.isArray(i)) {
2395
+ for (const u of i)
2396
2396
  this.fillInverseIndex(e, t, [u]);
2397
2397
  return;
2398
- } else o instanceof Date ? i = o.toISOString() : i = o;
2399
- let a = s.get(i);
2400
- a || (a = /* @__PURE__ */ new Set(), s.set(i, a)), a.add(t);
2398
+ } else i instanceof Date ? o = i.toISOString() : o = i;
2399
+ let a = s.get(o);
2400
+ a || (a = /* @__PURE__ */ new Set(), s.set(o, a)), a.add(t);
2401
2401
  }
2402
2402
  this.indexMap.set(e, s);
2403
2403
  }
@@ -2411,11 +2411,11 @@ class we {
2411
2411
  }
2412
2412
  getOrCreateIndex(e, t, r) {
2413
2413
  const s = this.getIndexName(e, r);
2414
- let o = this.getIndex(s);
2415
- const i = this.indexMetadata.get(s);
2416
- if (i)
2417
- i.lastAccessedAt = Date.now();
2418
- else if (!o) {
2414
+ let i = this.getIndex(s);
2415
+ const o = this.indexMetadata.get(s);
2416
+ if (o)
2417
+ o.lastAccessedAt = Date.now();
2418
+ else if (!i) {
2419
2419
  const u = y.parse(e).isDeepQuery ?? !1;
2420
2420
  this.indexMetadata.set(s, {
2421
2421
  createdAt: Date.now(),
@@ -2424,19 +2424,19 @@ class we {
2424
2424
  type: u ? "deep" : "shallow"
2425
2425
  });
2426
2426
  }
2427
- if (!o) {
2427
+ if (!i) {
2428
2428
  this.reset(s), this.indexMap.set(s, /* @__PURE__ */ new Map());
2429
2429
  const u = y.parse(e).isDeepQuery;
2430
2430
  for (const c of t.values()) {
2431
2431
  let f;
2432
2432
  u ? (f = x(c, e), f.length === 0 && (f = [void 0])) : f = [c[e]], this.fillInverseIndex(s, c.key, f), this.fillDataMap(s, f);
2433
2433
  }
2434
- o = this.getIndex(s) || /* @__PURE__ */ new Map();
2434
+ i = this.getIndex(s) || /* @__PURE__ */ new Map();
2435
2435
  }
2436
- return o;
2436
+ return i;
2437
2437
  }
2438
2438
  getIndexName(e, t) {
2439
- return t ? e + "_" + N(t) : e;
2439
+ return t ? e + "_" + K(t) : e;
2440
2440
  }
2441
2441
  // ========== PARTIAL UPDATE METHODS ==========
2442
2442
  /**
@@ -2448,17 +2448,17 @@ class we {
2448
2448
  removeFromInverseIndex(e, t, r) {
2449
2449
  const s = this.indexMap.get(e);
2450
2450
  if (s)
2451
- for (const o of r) {
2452
- let i;
2453
- if (typeof o == "object" && o && o.key)
2454
- i = o.key;
2455
- else if (Array.isArray(o)) {
2456
- for (const u of o)
2451
+ for (const i of r) {
2452
+ let o;
2453
+ if (typeof i == "object" && i && i.key)
2454
+ o = i.key;
2455
+ else if (Array.isArray(i)) {
2456
+ for (const u of i)
2457
2457
  this.removeFromInverseIndex(e, t, [u]);
2458
2458
  return;
2459
- } else o instanceof Date ? i = o.toISOString() : i = o;
2460
- const a = s.get(i);
2461
- a && (a.delete(t), a.size === 0 && s.delete(i));
2459
+ } else i instanceof Date ? o = i.toISOString() : o = i;
2460
+ const a = s.get(o);
2461
+ a && (a.delete(t), a.size === 0 && s.delete(o));
2462
2462
  }
2463
2463
  }
2464
2464
  /**
@@ -2480,15 +2480,15 @@ class we {
2480
2480
  const r = this.dataMap.get(e);
2481
2481
  if (r)
2482
2482
  for (const s of t) {
2483
- let o;
2483
+ let i;
2484
2484
  if (typeof s == "object" && s && s.key)
2485
- o = s.key;
2485
+ i = s.key;
2486
2486
  else if (Array.isArray(s)) {
2487
- for (const i of s)
2488
- this.removeFromDataMap(e, [i]);
2487
+ for (const o of s)
2488
+ this.removeFromDataMap(e, [o]);
2489
2489
  return;
2490
- } else s instanceof Date ? o = s.toISOString() : o = s;
2491
- r.delete(o);
2490
+ } else s instanceof Date ? i = s.toISOString() : i = s;
2491
+ r.delete(i);
2492
2492
  }
2493
2493
  }
2494
2494
  /**
@@ -2580,8 +2580,8 @@ class we {
2580
2580
  cleanupStaleIndices(e = 300 * 1e3) {
2581
2581
  const t = Date.now();
2582
2582
  let r = 0;
2583
- for (const [s, o] of this.indexMetadata)
2584
- t - o.lastAccessedAt > e && (this.reset(s), r++);
2583
+ for (const [s, i] of this.indexMetadata)
2584
+ t - i.lastAccessedAt > e && (this.reset(s), r++);
2585
2585
  return r;
2586
2586
  }
2587
2587
  /**
@@ -2591,175 +2591,175 @@ class we {
2591
2591
  getStats() {
2592
2592
  const e = this.getIndexCount(), t = Date.now();
2593
2593
  let r = 0, s = 0;
2594
- for (const i of this.indexMetadata.values()) {
2595
- const a = t - i.createdAt;
2594
+ for (const o of this.indexMetadata.values()) {
2595
+ const a = t - o.createdAt;
2596
2596
  r += a, a > s && (s = a);
2597
2597
  }
2598
- const o = this.indexMetadata.size > 0 ? r / this.indexMetadata.size : 0;
2598
+ const i = this.indexMetadata.size > 0 ? r / this.indexMetadata.size : 0;
2599
2599
  return {
2600
2600
  shallow: e.shallow,
2601
2601
  deep: e.deep,
2602
2602
  total: e.total,
2603
2603
  oldestAge: s,
2604
- avgAge: o
2604
+ avgAge: i
2605
2605
  };
2606
2606
  }
2607
2607
  }
2608
2608
  const w = "__";
2609
- function _(n, e, t = { key: "root" }, r = "root", s = new we(), o) {
2610
- const i = o || n;
2609
+ function P(n, e, t = { key: "root" }, r = "root", s = new xe(), i) {
2610
+ const o = i || n;
2611
2611
  for (const a of e.columns)
2612
- a.attribute && (y.parse(a.attribute), s.getOrCreateIndex(a.attribute, i));
2612
+ a.attribute && (y.parse(a.attribute), s.getOrCreateIndex(a.attribute, o));
2613
2613
  for (const a of e.rows)
2614
- a.attribute && (y.parse(a.attribute), s.getOrCreateIndex(a.attribute, i));
2614
+ a.attribute && (y.parse(a.attribute), s.getOrCreateIndex(a.attribute, o));
2615
2615
  for (const a of e.values)
2616
- a.attribute && (y.parse(a.attribute), s.getOrCreateIndex(a.attribute, i));
2616
+ a.attribute && (y.parse(a.attribute), s.getOrCreateIndex(a.attribute, o));
2617
2617
  if (e.rows && e.rows.length > 0) {
2618
2618
  t.rows = t.rows || [];
2619
- const a = xe(n, e.rows[0], e, s, r, o);
2619
+ const a = Ae(n, e.rows[0], e, s, r, i);
2620
2620
  t.rows.push(a);
2621
2621
  }
2622
2622
  if (e.columns && e.columns.length > 0) {
2623
2623
  t.columns = t.columns || [];
2624
- const a = P(n, e.columns[0], e, s, r, o);
2624
+ const a = W(n, e.columns[0], e, s, r, i);
2625
2625
  t.columns.push(a);
2626
2626
  }
2627
2627
  if (t.key === "root")
2628
2628
  for (const a of e.values) {
2629
2629
  if (t.values = t.values || [], r === "root" && e.options?.calculateTotals === !1)
2630
2630
  continue;
2631
- const u = k(a, n, s.getIndex(a.attribute), a.attribute);
2631
+ const u = C(a, n, s.getIndex(a.attribute), a.attribute);
2632
2632
  t.values.push(u);
2633
2633
  }
2634
2634
  return t;
2635
2635
  }
2636
- function xe(n, e, t, r, s = "", o) {
2637
- const i = { key: e.attribute }, a = r.getIndex(e.attribute);
2636
+ function Ae(n, e, t, r, s = "", i) {
2637
+ const o = { key: e.attribute }, a = r.getIndex(e.attribute);
2638
2638
  if (!a)
2639
- return i;
2639
+ return o;
2640
2640
  for (const [u, c] of a.entries()) {
2641
2641
  const f = {
2642
2642
  key: u,
2643
2643
  value: u
2644
- }, d = /* @__PURE__ */ new Map();
2645
- for (const l of c)
2646
- n.has(l) && d.set(l, n.get(l));
2647
- if (d.size) {
2648
- for (const l of t.values) {
2644
+ }, l = /* @__PURE__ */ new Map();
2645
+ for (const d of c)
2646
+ n.has(d) && l.set(d, n.get(d));
2647
+ if (l.size) {
2648
+ for (const d of t.values) {
2649
2649
  if (f.values = f.values || [], s === "root" && e?.calculateTotals === !1)
2650
2650
  continue;
2651
- const h = k(l, d, r.getIndex(l.attribute), l.attribute);
2651
+ const h = C(d, l, r.getIndex(d.attribute), d.attribute);
2652
2652
  f.values.push(h);
2653
2653
  }
2654
- if (i.rows = i.rows || [], i.rows.push(f), t.rows.length > 1) {
2655
- const l = { ...t, rows: t.rows.slice(1) };
2656
- _(
2657
- d,
2654
+ if (o.rows = o.rows || [], o.rows.push(f), t.rows.length > 1) {
2655
+ const d = { ...t, rows: t.rows.slice(1) };
2656
+ P(
2658
2657
  l,
2658
+ d,
2659
2659
  f,
2660
2660
  s + w + e.attribute + w + u,
2661
2661
  r,
2662
- o
2662
+ i
2663
2663
  );
2664
2664
  } else if (t.columns)
2665
- for (const l of t.columns) {
2665
+ for (const d of t.columns) {
2666
2666
  f.columns = f.columns || [];
2667
- const h = P(
2668
- d,
2667
+ const h = W(
2669
2668
  l,
2669
+ d,
2670
2670
  t,
2671
2671
  r,
2672
2672
  s + w + e.attribute + w + u,
2673
- o
2673
+ i
2674
2674
  );
2675
2675
  f.columns.push(h);
2676
2676
  }
2677
2677
  }
2678
2678
  }
2679
- return i;
2679
+ return o;
2680
2680
  }
2681
- function P(n, e, t, r, s = "", o) {
2682
- const i = { key: e.attribute }, a = r.getIndex(e.attribute);
2681
+ function W(n, e, t, r, s = "", i) {
2682
+ const o = { key: e.attribute }, a = r.getIndex(e.attribute);
2683
2683
  if (!a)
2684
- return i;
2684
+ return o;
2685
2685
  for (const [u, c] of a.entries()) {
2686
2686
  const f = {
2687
2687
  key: u,
2688
2688
  value: u
2689
- }, d = /* @__PURE__ */ new Map();
2690
- for (const l of c)
2691
- n.has(l) && d.set(l, n.get(l));
2692
- if (d.size) {
2693
- for (const l of t.values) {
2689
+ }, l = /* @__PURE__ */ new Map();
2690
+ for (const d of c)
2691
+ n.has(d) && l.set(d, n.get(d));
2692
+ if (l.size) {
2693
+ for (const d of t.values) {
2694
2694
  if (f.values = f.values || [], s === "root" && e?.calculateTotals === !1)
2695
2695
  continue;
2696
- const h = k(l, d, r.getIndex(l.attribute), l.attribute);
2696
+ const h = C(d, l, r.getIndex(d.attribute), d.attribute);
2697
2697
  f.values.push(h);
2698
2698
  }
2699
- if (i.columns = i.columns || [], i.columns.push(f), t.columns.length > 1) {
2700
- const l = { ...t, columns: t.columns.slice(1) };
2701
- _(
2702
- d,
2699
+ if (o.columns = o.columns || [], o.columns.push(f), t.columns.length > 1) {
2700
+ const d = { ...t, columns: t.columns.slice(1) };
2701
+ P(
2703
2702
  l,
2703
+ d,
2704
2704
  f,
2705
2705
  s + w + e.attribute + w + u,
2706
2706
  r,
2707
- o
2707
+ i
2708
2708
  );
2709
2709
  }
2710
2710
  }
2711
2711
  }
2712
- return i;
2712
+ return o;
2713
2713
  }
2714
- const Ae = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?)?$/, be = /^-?\d+$/, Se = /^-?\d+\.\d+$/, De = /^\d{1,2}([/.-])\d{1,2}\1\d{2,4}$/, Ke = (n) => n === "true" || n === "false" ? "boolean" : be.test(n) ? "int" : Se.test(n) ? "float" : Ae.test(n) && !Number.isNaN(Date.parse(n)) ? "date" : "string", Ie = (n) => De.test(n), Qe = (n) => n == null || n === "", Me = (n) => {
2714
+ const be = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?)?$/, Se = /^-?\d+$/, De = /^-?\d+\.\d+$/, Ie = /^\d{1,2}([/.-])\d{1,2}\1\d{2,4}$/, Ke = (n) => n === "true" || n === "false" ? "boolean" : Se.test(n) ? "int" : De.test(n) ? "float" : be.test(n) && !Number.isNaN(Date.parse(n)) ? "date" : "string", Qe = (n) => Ie.test(n), Me = (n) => n == null || n === "", ke = (n) => {
2715
2715
  const e = [...n];
2716
2716
  return e.length <= 1 ? { type: e[0] ?? "any", conflict: !1 } : e.every((t) => t === "int" || t === "float") ? { type: "float", conflict: !1 } : { type: "any", conflict: !0 };
2717
2717
  }, Ne = (n, e = {}) => {
2718
- const r = e.deep ?? (e.sampleSize !== void 0 && e.sampleSize > 1) ? e.sampleSize ?? 1 / 0 : 1, s = e.coerceStrings ?? !0, o = /* @__PURE__ */ new Map(), i = [], a = Math.min(n.length, r);
2718
+ const r = e.deep ?? (e.sampleSize !== void 0 && e.sampleSize > 1) ? e.sampleSize ?? 1 / 0 : 1, s = e.coerceStrings ?? !0, i = /* @__PURE__ */ new Map(), o = [], a = Math.min(n.length, r);
2719
2719
  for (let f = 0; f < a; f++) {
2720
- const d = n[f];
2721
- if (d)
2722
- for (const [l, h] of Object.entries(d)) {
2723
- let g = o.get(l);
2724
- if (g || (g = { observed: /* @__PURE__ */ new Set(), empty: 0, scanned: 0 }, o.set(l, g), i.push(l)), g.scanned++, Qe(h)) {
2720
+ const l = n[f];
2721
+ if (l)
2722
+ for (const [d, h] of Object.entries(l)) {
2723
+ let g = i.get(d);
2724
+ if (g || (g = { observed: /* @__PURE__ */ new Set(), empty: 0, scanned: 0 }, i.set(d, g), o.push(d)), g.scanned++, Me(h)) {
2725
2725
  g.empty++;
2726
2726
  continue;
2727
2727
  }
2728
2728
  let m;
2729
- typeof h == "string" && s ? (m = Ke(h), m === "string" && !g.hint && Ie(h) && (g.hint = "column looks date-like (non-ISO) — review manually")) : m = Ee(h), g.observed.add(m);
2729
+ typeof h == "string" && s ? (m = Ke(h), m === "string" && !g.hint && Qe(h) && (g.hint = "column looks date-like (non-ISO) — review manually")) : m = $e(h), g.observed.add(m);
2730
2730
  }
2731
2731
  }
2732
2732
  const u = [], c = [];
2733
- for (const f of i) {
2734
- const d = o.get(f), { type: l, conflict: h } = Me(d.observed.size ? d.observed : /* @__PURE__ */ new Set(["string"]));
2735
- u.push({ key: f, type: l }), c.push({
2733
+ for (const f of o) {
2734
+ const l = i.get(f), { type: d, conflict: h } = ke(l.observed.size ? l.observed : /* @__PURE__ */ new Set(["string"]));
2735
+ u.push({ key: f, type: d }), c.push({
2736
2736
  column: f,
2737
- inferredType: l,
2738
- observedTypes: [...d.observed].sort(),
2739
- emptyRate: d.scanned === 0 ? 0 : d.empty / d.scanned,
2737
+ inferredType: d,
2738
+ observedTypes: [...l.observed].sort(),
2739
+ emptyRate: l.scanned === 0 ? 0 : l.empty / l.scanned,
2740
2740
  conflict: h,
2741
- hint: d.hint
2741
+ hint: l.hint
2742
2742
  });
2743
2743
  }
2744
2744
  return { properties: u, diagnostics: c };
2745
- }, Je = (n, e = !1) => Ne(n, typeof e == "boolean" ? { deep: e } : e).properties, ke = (n) => Number(n) === n && n % 1 === 0, Ce = (n) => Number(n) === n && n % 1 !== 0, Ee = (n) => {
2745
+ }, Ye = (n, e = !1) => Ne(n, typeof e == "boolean" ? { deep: e } : e).properties, Ce = (n) => Number(n) === n && n % 1 === 0, Ee = (n) => Number(n) === n && n % 1 !== 0, $e = (n) => {
2746
2746
  switch (typeof n) {
2747
2747
  case "string":
2748
2748
  return "string";
2749
2749
  case "number":
2750
- return ke(n) ? "int" : Ce(n) ? "float" : "any";
2750
+ return Ce(n) ? "int" : Ee(n) ? "float" : "any";
2751
2751
  case "boolean":
2752
2752
  return "boolean";
2753
2753
  case "object":
2754
- return re(n) ? "date" : "json";
2754
+ return se(n) ? "date" : "json";
2755
2755
  default:
2756
2756
  return "any";
2757
2757
  }
2758
- }, Ze = (n, e) => {
2759
- const t = ee(n.text || ""), r = e?.attributeKey || n.filterKey;
2758
+ }, et = (n, e) => {
2759
+ const t = te(n.text || ""), r = e?.attributeKey || n.filterKey;
2760
2760
  let s;
2761
- const o = e?.comparisonType || "containsIgnoreCase";
2762
- return o === "containsIgnoreCase" ? s = {
2761
+ const i = e?.comparisonType || "containsIgnoreCase";
2762
+ return i === "containsIgnoreCase" ? s = {
2763
2763
  groupKey: n.filterKey,
2764
2764
  queries: [
2765
2765
  {
@@ -2772,7 +2772,7 @@ const Ae = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?
2772
2772
  }
2773
2773
  }
2774
2774
  ]
2775
- } : o === "containsIgnoreCaseAndWhitespace" ? s = {
2775
+ } : i === "containsIgnoreCaseAndWhitespace" ? s = {
2776
2776
  groupKey: n.filterKey,
2777
2777
  queries: [
2778
2778
  {
@@ -2785,7 +2785,7 @@ const Ae = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?
2785
2785
  }
2786
2786
  }
2787
2787
  ]
2788
- } : o === "contains" ? s = {
2788
+ } : i === "contains" ? s = {
2789
2789
  groupKey: n.filterKey,
2790
2790
  queries: [
2791
2791
  {
@@ -2795,7 +2795,7 @@ const Ae = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?
2795
2795
  operator: "find"
2796
2796
  }
2797
2797
  ]
2798
- } : o === "equal" ? s = {
2798
+ } : i === "equal" ? s = {
2799
2799
  groupKey: n.filterKey,
2800
2800
  queries: [
2801
2801
  {
@@ -2805,7 +2805,7 @@ const Ae = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?
2805
2805
  operator: "eq"
2806
2806
  }
2807
2807
  ]
2808
- } : o === "equalIgnoreCase" && (s = {
2808
+ } : i === "equalIgnoreCase" && (s = {
2809
2809
  groupKey: n.filterKey,
2810
2810
  queries: [
2811
2811
  {
@@ -2819,7 +2819,7 @@ const Ae = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?
2819
2819
  }
2820
2820
  ]
2821
2821
  }), s;
2822
- }, Ye = (n, e) => {
2822
+ }, tt = (n, e) => {
2823
2823
  const t = e?.attributeKey || n.filterKey;
2824
2824
  return {
2825
2825
  groupKey: n.filterKey,
@@ -2832,7 +2832,7 @@ const Ae = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?
2832
2832
  }
2833
2833
  ]
2834
2834
  };
2835
- }, Xe = (n, e) => {
2835
+ }, rt = (n, e) => {
2836
2836
  const t = e?.attributeKey || n.filterKey, r = {
2837
2837
  groupKey: n.filterKey,
2838
2838
  queries: []
@@ -2847,7 +2847,7 @@ const Ae = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?
2847
2847
  operator: "eq",
2848
2848
  options: { invert: !0 }
2849
2849
  })), typeof n.gt < "u" && (r.groupType = "and", r.queries.push({ attribute: t, value: n.gt, operator: "gt" })), typeof n.lt < "u" && (r.groupType = "and", r.queries.push({ attribute: t, value: n.lt, operator: "lt" })), typeof n.gte < "u" && (r.groupType = "and", r.queries.push({ attribute: t, value: n.gte, operator: "gte" })), typeof n.lte < "u" && (r.groupType = "and", r.queries.push({ attribute: t, value: n.lte, operator: "lte" })), r;
2850
- }, et = (n, e) => {
2850
+ }, st = (n, e) => {
2851
2851
  const t = e?.attributeKey || n.filterKey, r = {
2852
2852
  groupKey: n.filterKey,
2853
2853
  queries: []
@@ -2860,8 +2860,8 @@ const Ae = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?
2860
2860
  operator: "eq"
2861
2861
  });
2862
2862
  }), r;
2863
- }, tt = (n) => !(typeof n.modelKey != "string" || !Array.isArray(n.queries));
2864
- class rt {
2863
+ }, nt = (n) => !(typeof n.modelKey != "string" || !Array.isArray(n.queries));
2864
+ class it {
2865
2865
  constructor(e, t, r) {
2866
2866
  this.scriptController = e, this.globalItemService = t, this.modelParser = r;
2867
2867
  }
@@ -2881,62 +2881,62 @@ class rt {
2881
2881
  }
2882
2882
  evaluateQuery(e, t) {
2883
2883
  let r, s = e.value;
2884
- const o = e.options?.arrayValueHandling || "some";
2885
- if (Array.isArray(e.options?.transform) && e.options.transform.length > 0 && (s = this.transformValue(s, e.options.transform)), e.attribute.includes(".") || e.attribute.includes("[") ? r = K(t, e.attribute) : r = t[e.attribute], Array.isArray(e.options?.transform) && e.options.transform.length > 0 && (r = this.transformValue(r, e.options.transform)), (typeof r > "u" || r === null) && !["typeof", "isTruthy", "eq"].includes(e.operator))
2884
+ const i = e.options?.arrayValueHandling || "some";
2885
+ if (Array.isArray(e.options?.transform) && e.options.transform.length > 0 && (s = this.transformValue(s, e.options.transform)), e.attribute.includes(".") || e.attribute.includes("[") ? r = I(t, e.attribute) : r = t[e.attribute], Array.isArray(e.options?.transform) && e.options.transform.length > 0 && (r = this.transformValue(r, e.options.transform)), (typeof r > "u" || r === null) && !["typeof", "isTruthy", "eq"].includes(e.operator))
2886
2886
  return !1;
2887
2887
  switch (e.operator) {
2888
2888
  case "eq":
2889
- return e.options?.invert ? !E(r, s) : E(r, s);
2889
+ return e.options?.invert ? !$(r, s) : $(r, s);
2890
2890
  case "find":
2891
- return e.options?.invert ? !this.queryFind(r, s, o) : this.queryFind(r, s, o);
2891
+ return e.options?.invert ? !this.queryFind(r, s, i) : this.queryFind(r, s, i);
2892
2892
  case "lt":
2893
- return Array.isArray(r) ? o === "some" ? r.some((i) => i < s) : r.every((i) => i < s) : r < s;
2893
+ return Array.isArray(r) ? i === "some" ? r.some((o) => o < s) : r.every((o) => o < s) : r < s;
2894
2894
  case "gt":
2895
- return Array.isArray(r) ? o === "some" ? r.some((i) => i > s) : r.every((i) => i > s) : r > s;
2895
+ return Array.isArray(r) ? i === "some" ? r.some((o) => o > s) : r.every((o) => o > s) : r > s;
2896
2896
  case "lte":
2897
- return Array.isArray(r) ? o === "some" ? r.some((i) => i <= s) : r.every((i) => i <= s) : r <= s;
2897
+ return Array.isArray(r) ? i === "some" ? r.some((o) => o <= s) : r.every((o) => o <= s) : r <= s;
2898
2898
  case "gte":
2899
- return Array.isArray(r) ? o === "some" ? r.some((i) => i >= s) : r.every((i) => i >= s) : r >= s;
2899
+ return Array.isArray(r) ? i === "some" ? r.some((o) => o >= s) : r.every((o) => o >= s) : r >= s;
2900
2900
  case "typeof":
2901
- return e.options?.invert ? typeof r !== s : Array.isArray(r) ? o === "some" ? r.some((i) => typeof i === s) : r.every((i) => typeof i === s) : typeof r === s;
2901
+ return e.options?.invert ? typeof r !== s : Array.isArray(r) ? i === "some" ? r.some((o) => typeof o === s) : r.every((o) => typeof o === s) : typeof r === s;
2902
2902
  case "isTruthy":
2903
- return s === !0 ? Array.isArray(r) ? o === "some" ? r.some((i) => typeof !!i) : r.every((i) => typeof !!i) : !!r : !r;
2903
+ return s === !0 ? Array.isArray(r) ? i === "some" ? r.some((o) => typeof !!o) : r.every((o) => typeof !!o) : !!r : !r;
2904
2904
  case "size":
2905
- return typeof r == "string" ? r.length === s : W(r) === s;
2905
+ return typeof r == "string" ? r.length === s : L(r) === s;
2906
2906
  default:
2907
2907
  if (this.scriptController.hasScript(e.operator))
2908
2908
  return this.scriptController.executeScript(e.operator, "operator", { query: e, item: t });
2909
2909
  if (this.registeredCustomOperator.has(e.operator)) {
2910
- const i = this.registeredCustomOperator.get(e.operator);
2911
- if (typeof i == "function")
2912
- return i(e, t);
2910
+ const o = this.registeredCustomOperator.get(e.operator);
2911
+ if (typeof o == "function")
2912
+ return o(e, t);
2913
2913
  }
2914
2914
  }
2915
2915
  return !1;
2916
2916
  }
2917
2917
  evaluateEqOperator(e, t, r, s) {
2918
- const o = /* @__PURE__ */ new Map(), i = s.get(t.attribute);
2919
- if (i) {
2918
+ const i = /* @__PURE__ */ new Map(), o = s.get(t.attribute);
2919
+ if (o) {
2920
2920
  let a;
2921
2921
  if (typeof t.value == "string" ? a = t.value : t.value?.key && Object.keys(t.value).length === 1 && (a = t.value.key), typeof a < "u") {
2922
- const u = i.get(a);
2922
+ const u = o.get(a);
2923
2923
  if (u)
2924
2924
  if (u.forEach((c) => {
2925
- r.has(c) && o.set(c, r.get(c));
2925
+ r.has(c) && i.set(c, r.get(c));
2926
2926
  }), t.options?.invert) {
2927
- const c = O(Array.from(r.values()), Array.from(o.values()), "key"), f = /* @__PURE__ */ new Map();
2928
- return c.forEach((d) => {
2929
- f.set(d.key, d);
2927
+ const c = O(Array.from(r.values()), Array.from(i.values()), "key"), f = /* @__PURE__ */ new Map();
2928
+ return c.forEach((l) => {
2929
+ f.set(l.key, l);
2930
2930
  }), f;
2931
2931
  } else
2932
- return o;
2932
+ return i;
2933
2933
  }
2934
2934
  }
2935
2935
  for (let [a, u] of r) {
2936
2936
  const c = this.queryBuilder.extractQueryAttributes({ queries: [t] });
2937
2937
  if (c.some((f) => f.isDeepQuery)) {
2938
2938
  const f = this.queryBuilder.getProjectionForAttributeEntries(
2939
- c.filter((d) => d.isDeepQuery)
2939
+ c.filter((l) => l.isDeepQuery)
2940
2940
  );
2941
2941
  u = this.globalItemService.getProjectedData(
2942
2942
  f,
@@ -2944,12 +2944,12 @@ class rt {
2944
2944
  u
2945
2945
  );
2946
2946
  }
2947
- this.evaluateQuery(t, u) && o.set(a, u);
2947
+ this.evaluateQuery(t, u) && i.set(a, u);
2948
2948
  }
2949
- return o;
2949
+ return i;
2950
2950
  }
2951
2951
  equalRegexFn(e, t) {
2952
- if (typeof t == "string" && L(t, "/") && H(t, "/"))
2952
+ if (typeof t == "string" && H(t, "/") && U(t, "/"))
2953
2953
  try {
2954
2954
  return new RegExp(t.slice(1, -1)).test(e);
2955
2955
  } catch {
@@ -2958,7 +2958,7 @@ class rt {
2958
2958
  else return Array.isArray(e) ? !!e.find((r) => S(r, t, this.equalRegexFn)) : typeof t == "object" ? V(e, t) : e === t;
2959
2959
  }
2960
2960
  queryFind(e, t, r) {
2961
- return Array.isArray(e) ? typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? r === "some" ? e.some((s) => S(s, t, this.equalRegexFn)) : e.every((s) => S(s, t, this.equalRegexFn)) : !!U(e, t) : S(e, t, this.equalRegexFn);
2961
+ return Array.isArray(e) ? typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? r === "some" ? e.some((s) => S(s, t, this.equalRegexFn)) : e.every((s) => S(s, t, this.equalRegexFn)) : !!J(e, t) : S(e, t, this.equalRegexFn);
2962
2962
  }
2963
2963
  validateQuery(e) {
2964
2964
  if (this.queryBuilder.isQuery(e)) {
@@ -2974,39 +2974,39 @@ class rt {
2974
2974
  }
2975
2975
  }
2976
2976
  getEvaluatedQueryDataset(e, t, r, s) {
2977
- const o = /* @__PURE__ */ new Map();
2977
+ const i = /* @__PURE__ */ new Map();
2978
2978
  if (t.attribute.includes("[*]")) {
2979
- const i = t.options?.invert === !0, a = /* @__PURE__ */ new Set();
2979
+ const o = t.options?.invert === !0, a = /* @__PURE__ */ new Set();
2980
2980
  for (let u of r.values()) {
2981
2981
  const c = this.queryBuilder.extractQueryAttributes({ queries: [t] });
2982
- if (c.some((l) => l.isDeepQuery)) {
2983
- const l = this.queryBuilder.getProjectionForAttributeEntries(
2982
+ if (c.some((d) => d.isDeepQuery)) {
2983
+ const d = this.queryBuilder.getProjectionForAttributeEntries(
2984
2984
  c.filter((h) => h.isDeepQuery)
2985
2985
  );
2986
2986
  u = this.globalItemService.getProjectedData(
2987
- l,
2987
+ d,
2988
2988
  this.modelParser.models.get(e.modelKey),
2989
2989
  u
2990
2990
  );
2991
2991
  }
2992
2992
  const f = this.handleArrayStarQuery(t, u);
2993
- let d = !1;
2994
- for (const l of f.queries) {
2995
- const h = { ...l, options: { ...l.options, invert: !1 } };
2993
+ let l = !1;
2994
+ for (const d of f.queries) {
2995
+ const h = { ...d, options: { ...d.options, invert: !1 } };
2996
2996
  if (this.evaluateQuery(h, u)) {
2997
- d = !0;
2997
+ l = !0;
2998
2998
  break;
2999
2999
  }
3000
3000
  }
3001
- d && (a.add(u.key), i || o.set(u.key, u));
3001
+ l && (a.add(u.key), o || i.set(u.key, u));
3002
3002
  }
3003
- if (i)
3003
+ if (o)
3004
3004
  for (const [u, c] of r)
3005
- a.has(u) || o.set(u, c);
3005
+ a.has(u) || i.set(u, c);
3006
3006
  } else {
3007
3007
  if (t.operator === "eq")
3008
3008
  return this.evaluateEqOperator(e, t, r, s);
3009
- for (let [i, a] of r) {
3009
+ for (let [o, a] of r) {
3010
3010
  const u = this.queryBuilder.extractQueryAttributes({ queries: [t] });
3011
3011
  if (u.some((c) => c.isDeepQuery)) {
3012
3012
  const c = this.queryBuilder.getProjectionForAttributeEntries(
@@ -3018,10 +3018,10 @@ class rt {
3018
3018
  a
3019
3019
  );
3020
3020
  }
3021
- this.evaluateQuery(t, a) && o.set(i, a);
3021
+ this.evaluateQuery(t, a) && i.set(o, a);
3022
3022
  }
3023
3023
  }
3024
- return o;
3024
+ return i;
3025
3025
  }
3026
3026
  handleArrayStarQuery(e, t) {
3027
3027
  const r = e.attribute.indexOf("[*]"), s = {
@@ -3030,9 +3030,9 @@ class rt {
3030
3030
  queries: []
3031
3031
  };
3032
3032
  if (r !== -1) {
3033
- const o = e.attribute.substring(0, r), i = o.includes(".") ? K(t, o) : t[o];
3034
- if (Array.isArray(i))
3035
- for (let a = 0; a < i.length; a++) {
3033
+ const i = e.attribute.substring(0, r), o = i.includes(".") ? I(t, i) : t[i];
3034
+ if (Array.isArray(o))
3035
+ for (let a = 0; a < o.length; a++) {
3036
3036
  const u = e.attribute.replace("[*]", `[${a}]`);
3037
3037
  s.queries.push({
3038
3038
  attribute: u,
@@ -3044,28 +3044,28 @@ class rt {
3044
3044
  }
3045
3045
  return s;
3046
3046
  }
3047
- evaluateQueryGroup(e, t, r, s, o) {
3048
- let i = /* @__PURE__ */ new Map(), a = r;
3047
+ evaluateQueryGroup(e, t, r, s, i) {
3048
+ let o = /* @__PURE__ */ new Map(), a = r;
3049
3049
  if (!t.queries || t.queries?.length === 0)
3050
3050
  return a;
3051
3051
  for (const u of t.queries) {
3052
3052
  let c = /* @__PURE__ */ new Map();
3053
- if (this.queryBuilder.isQuery(u) ? c = this.getEvaluatedQueryDataset(e, u, a, o) : c = this.evaluateQueryGroup(e, u, a, s, o), i.size === 0 && (i = c), t.groupType === "or")
3053
+ if (this.queryBuilder.isQuery(u) ? c = this.getEvaluatedQueryDataset(e, u, a, i) : c = this.evaluateQueryGroup(e, u, a, s, i), o.size === 0 && (o = c), t.groupType === "or")
3054
3054
  c.forEach((f) => {
3055
- i.set(f.key, f);
3055
+ o.set(f.key, f);
3056
3056
  });
3057
3057
  else {
3058
- const f = O(Array.from(i.values()), Array.from(c.values()), "key");
3059
- for (const d of f)
3060
- i.delete(d.key);
3058
+ const f = O(Array.from(o.values()), Array.from(c.values()), "key");
3059
+ for (const l of f)
3060
+ o.delete(l.key);
3061
3061
  }
3062
- t.groupType === "and" ? a = i : a = r;
3062
+ t.groupType === "and" ? a = o : a = r;
3063
3063
  }
3064
- return i;
3064
+ return o;
3065
3065
  }
3066
3066
  queryData(e, t, r, s) {
3067
- const o = new Map(e);
3068
- return t.queries.length === 0 ? e : (t.groupKey || (t.groupKey = "root"), t.groupType || (t.groupType = "and"), t.queries || (t.queries = []), this.validateQuery(t), this.evaluateQueryGroup(t, t, o, r, s));
3067
+ const i = new Map(e);
3068
+ return t.queries.length === 0 ? e : (t.groupKey || (t.groupKey = "root"), t.groupType || (t.groupType = "and"), t.queries || (t.queries = []), this.validateQuery(t), this.evaluateQueryGroup(t, t, i, r, s));
3069
3069
  }
3070
3070
  // public getRelevantQueryData(data: any, options: DcuplGlobalQueryOptions<any>, model: DcuplModel<ListItem>) {
3071
3071
  // // detect if any of the query attributes are a deep query.
@@ -3101,7 +3101,29 @@ class rt {
3101
3101
  // }
3102
3102
  // }
3103
3103
  }
3104
- class st {
3104
+ const Oe = "k:", qe = "h:";
3105
+ function M(n, e = 0) {
3106
+ if (n.key)
3107
+ return `${Oe}${n.key}`;
3108
+ const t = K({
3109
+ type: n.type,
3110
+ url: n.rawUrl ?? n.url,
3111
+ model: n.model ?? "",
3112
+ occurrence: e
3113
+ });
3114
+ return `${qe}${t}`;
3115
+ }
3116
+ function ot(n) {
3117
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
3118
+ return n.map((r) => {
3119
+ const s = `${r.key ?? ""}|${r.type}|${r.rawUrl ?? r.url}|${r.model ?? ""}`;
3120
+ let i = e.get(s) ?? 0, o = M(r, i);
3121
+ for (; t.has(o); )
3122
+ i += 1, o = r.key ? `${M(r)}#${i}` : M(r, i);
3123
+ return e.set(s, i + 1), t.add(o), o;
3124
+ });
3125
+ }
3126
+ class at {
3105
3127
  scripts = /* @__PURE__ */ new Map();
3106
3128
  scriptFunctions = /* @__PURE__ */ new Map();
3107
3129
  constructor() {
@@ -3127,8 +3149,8 @@ class st {
3127
3149
  const r = this.getScript(e);
3128
3150
  if (!r)
3129
3151
  throw new Error(`Script ${e} not found`);
3130
- const s = this.getWrapperScript(r), o = new Function("script_type", ...t, s);
3131
- return this.scriptFunctions.set(e, o), o;
3152
+ const s = this.getWrapperScript(r), i = new Function("script_type", ...t, s);
3153
+ return this.scriptFunctions.set(e, i), i;
3132
3154
  }
3133
3155
  getWrapperScript(e) {
3134
3156
  return `
@@ -3140,14 +3162,14 @@ class st {
3140
3162
  if (!this.getScript(e))
3141
3163
  throw new Error(`Script ${e} not found`);
3142
3164
  r.context || (r.context = r.options || {});
3143
- const o = Object.keys(r), i = Object.values(r);
3144
- return this.getScriptAsFn(e, o)(t, ...i);
3165
+ const i = Object.keys(r), o = Object.values(r);
3166
+ return this.getScriptAsFn(e, i)(t, ...o);
3145
3167
  }
3146
3168
  }
3147
- const nt = (n, e) => n ? (e || (e = {}), n.replace(/\$\{(.*?)\}/g, (t, r) => K(e, r.trim(), ""))) : "", it = (n) => {
3169
+ const ut = (n, e) => n ? (e || (e = {}), n.replace(/\$\{(.*?)\}/g, (t, r) => I(e, r.trim(), ""))) : "", ct = (n) => {
3148
3170
  const e = /* @__PURE__ */ new Set();
3149
3171
  return n.replace(/\$\{(.*?)\}/g, (r, s) => (e.add(s.trim()), "")), { variables: Array.from(e).map((r) => ({ name: r })) };
3150
- }, ot = [
3172
+ }, ft = [
3151
3173
  "any",
3152
3174
  "Array<date>",
3153
3175
  "Array<float>",
@@ -3159,7 +3181,7 @@ const nt = (n, e) => n ? (e || (e = {}), n.replace(/\$\{(.*?)\}/g, (t, r) => K(e
3159
3181
  "int",
3160
3182
  "json",
3161
3183
  "string"
3162
- ], at = ["int", "float", "Array<int>", "Array<float>"], ut = ["date", "Array<date>"], ct = [
3184
+ ], lt = ["int", "float", "Array<int>", "Array<float>"], dt = ["date", "Array<date>"], ht = [
3163
3185
  "eq",
3164
3186
  "find",
3165
3187
  "gt",
@@ -3171,60 +3193,64 @@ const nt = (n, e) => n ? (e || (e = {}), n.replace(/\$\{(.*?)\}/g, (t, r) => K(e
3171
3193
  "size"
3172
3194
  ];
3173
3195
  export {
3174
- qe as AnalyticsController,
3175
- $e as AttributeDependencyGraph,
3176
- Fe as CacheController,
3177
- We as ChangeDetector,
3178
- ut as DatePropertyTypes,
3196
+ Oe as AUTHORED_RESOURCE_ID_PREFIX,
3197
+ Re as AnalyticsController,
3198
+ Te as AttributeDependencyGraph,
3199
+ Ge as CacheController,
3200
+ Ue as ChangeDetector,
3201
+ qe as DERIVED_RESOURCE_ID_PREFIX,
3202
+ dt as DatePropertyTypes,
3179
3203
  B as DcuplQueryBuilder,
3180
- ct as DcuplQueryOperatorsAsArray,
3181
- fe as DeepQueryService,
3182
- Z as DependencyGraph,
3183
- we as IndicesController,
3204
+ ht as DcuplQueryOperatorsAsArray,
3205
+ le as DeepQueryService,
3206
+ X as DependencyGraph,
3207
+ xe as IndicesController,
3184
3208
  p as Logger,
3185
- at as NumberPropertyTypes,
3186
- ot as PropertyTypesAsArray,
3187
- rt as QueryManager,
3188
- st as ScriptController,
3209
+ lt as NumberPropertyTypes,
3210
+ ft as PropertyTypesAsArray,
3211
+ it as QueryManager,
3212
+ at as ScriptController,
3189
3213
  j as clone,
3190
3214
  Ke as coerceStringType,
3191
- te as compareVersions,
3192
- He as computeSuggestions,
3215
+ re as compareVersions,
3216
+ Je as computeSuggestions,
3193
3217
  y as deepQueryService,
3194
- ee as escapeRegExp,
3195
- nt as evaluateTemplate,
3196
- Ye as generateBooleanQuery,
3197
- X as generateKey,
3198
- Xe as generateNumberAndDateQuery,
3199
- et as generateReferenceQuery,
3200
- Ze as generateTextQuery,
3201
- k as getAggregation,
3202
- ze as getDateConstraintUid,
3203
- Ee as getDcuplPropertyTypeForNativeType,
3218
+ te as escapeRegExp,
3219
+ ut as evaluateTemplate,
3220
+ tt as generateBooleanQuery,
3221
+ ee as generateKey,
3222
+ rt as generateNumberAndDateQuery,
3223
+ st as generateReferenceQuery,
3224
+ et as generateTextQuery,
3225
+ C as getAggregation,
3226
+ je as getDateConstraintUid,
3227
+ $e as getDcuplPropertyTypeForNativeType,
3204
3228
  x as getDeepPathValues,
3205
- ye as getDistinct,
3206
- Ue as getFacets,
3207
- Te as getFilterEntryId,
3208
- Ge as getNumberConstraintUid,
3209
- Je as getPropertiesForData,
3210
- je as groupBy,
3211
- Pe as hasMinimumVersion,
3229
+ me as getDistinct,
3230
+ Xe as getFacets,
3231
+ ze as getFilterEntryId,
3232
+ _e as getNumberConstraintUid,
3233
+ Ye as getPropertiesForData,
3234
+ Pe as groupBy,
3235
+ He as hasMinimumVersion,
3212
3236
  Ne as inferModel,
3213
- re as isDateInstance,
3214
- Ce as isFloat,
3215
- ke as isInt,
3216
- se as isValidDate,
3217
- tt as isValidQueryStatement,
3218
- $ as isValidVersion,
3237
+ se as isDateInstance,
3238
+ Ee as isFloat,
3239
+ Ce as isInt,
3240
+ ne as isValidDate,
3241
+ nt as isValidQueryStatement,
3242
+ F as isValidVersion,
3219
3243
  Y as logger,
3220
- Ie as looksDateLike,
3221
- Ve as parseDate,
3222
- it as parseTemplate,
3244
+ Qe as looksDateLike,
3245
+ Ze as parseDate,
3246
+ ct as parseTemplate,
3223
3247
  b as perf,
3224
- _ as pivot,
3225
- Be as removeTrailingSlash,
3226
- Le as trigger,
3227
- _e as unescapeRegExp,
3228
- Re as uniqBy
3248
+ P as pivot,
3249
+ We as removeTrailingSlash,
3250
+ M as resolveResourceId,
3251
+ ot as resolveResourceIds,
3252
+ Ve as trigger,
3253
+ Le as unescapeRegExp,
3254
+ Be as uniqBy
3229
3255
  };
3230
3256
  //# sourceMappingURL=index.js.map