@sisense/mcp-server 0.2.9 → 0.3.1

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,83 +1,82 @@
1
1
  import {
2
- $i,
2
+ $p,
3
3
  Ap,
4
- Bd,
5
4
  Bi,
6
- C,
7
- Ci,
8
5
  Ct,
9
- Dh,
6
+ Dn,
10
7
  E,
11
- Fd,
12
- Fi,
8
+ En,
9
+ Ep,
10
+ Fp,
11
+ Gd,
12
+ Gi,
13
+ Gs,
13
14
  Hd,
14
- Hi,
15
+ Ip,
15
16
  J,
16
17
  Ke,
17
- Ld,
18
- Ln,
19
- Lp,
20
- Md,
21
- Mp,
22
- Nt,
18
+ Li,
19
+ Lt,
20
+ N,
21
+ Np,
23
22
  Oe,
24
- Pd,
23
+ Op,
25
24
  Rn,
26
25
  Rp,
26
+ Rt,
27
27
  Se,
28
28
  Sp,
29
29
  Tp,
30
- Ud,
30
+ Up,
31
+ Vd,
32
+ Vi,
33
+ Wd,
34
+ Wi,
35
+ Ws,
31
36
  X,
32
- Xp,
33
- Yt,
34
37
  Zt,
35
- ap,
38
+ _p,
39
+ _s,
36
40
  be,
37
41
  bp,
38
- cp,
39
42
  dp,
40
- ed,
41
- fp,
42
43
  g,
44
+ gm,
43
45
  gp,
44
- gt,
45
46
  h1 as h,
47
+ hm,
46
48
  hp,
47
- ip,
48
- jd,
49
- ji,
50
- jn,
51
- lp,
49
+ ht,
50
+ kd,
51
+ ki,
52
52
  m,
53
53
  mp,
54
- op,
54
+ nn,
55
+ od,
55
56
  pp,
57
+ qd,
56
58
  re,
57
- rp,
58
- sp,
59
- up,
60
- vn,
61
- vs,
62
- wn,
63
- wp,
64
- xp,
59
+ sm,
60
+ vp,
61
+ ws,
62
+ xs,
65
63
  ye,
64
+ yp,
66
65
  zd,
67
66
  zi
68
- } from "./sse-server-r50cemee.js";
67
+ } from "./sse-server-j22b9cb0.js";
69
68
 
70
- // node_modules/@sisense/sdk-ui/dist/dimensions-C1R5YRt-.js
71
- class y extends vn {
72
- constructor(t, e, r, o, d, m2, l, c, a, g2) {
73
- if (super(t, d || E.Dimension, m2, c, a), this.__serializable = "DimensionalDimension", this._dimensions = [], this._attributes = [], this._sort = C.None, !a && e) {
74
- const { table: D, column: s } = Oe(e);
75
- this.composeCode = `${Ci}.${gt(D)}.${gt(s)}`;
69
+ // node_modules/@sisense/sdk-ui/dist/parse-compose-code-DfZskSng.js
70
+ class g2 extends En {
71
+ constructor(i, e, n, s, r, a, h2, c, d, f) {
72
+ if (super(i, r || E.Dimension, a, c, d), this.__serializable = "DimensionalDimension", this._dimensions = [], this._attributes = [], this._sort = N.None, !d && e) {
73
+ const { table: p, column: o } = Oe(e);
74
+ this.composeCode = `${Li}.${ht(p)}.${ht(o)}`;
76
75
  }
77
- this._sort = l || C.None, this._expression = e, this.setDimensions(o || []), this.setAttributes(r), g2 && (this.defaultAttribute = g2);
76
+ this._sort = h2 || N.None, this._expression = e, this.setDimensions(s || []), this.setAttributes(n), f && (this.defaultAttribute = f);
78
77
  }
79
- static parseType(t) {
80
- switch (t) {
78
+ static parseType(i) {
79
+ switch (i) {
81
80
  case "datetime":
82
81
  case E.DateDimension:
83
82
  return E.DateDimension;
@@ -90,23 +89,23 @@ class y extends vn {
90
89
  }
91
90
  return E.TextDimension;
92
91
  }
93
- getAttachedName(t, e) {
94
- let r = t;
95
- const o = be(t);
96
- return (o === "id" || o === "name" || Object.getOwnPropertyDescriptor(this, o) !== undefined || this[o] !== undefined) && (r = e), r;
92
+ getAttachedName(i, e) {
93
+ let n = i;
94
+ const s = be(i);
95
+ return (s === "id" || s === "name" || Object.getOwnPropertyDescriptor(this, s) !== undefined || this[s] !== undefined) && (n = e), n;
97
96
  }
98
- setDimensions(t) {
99
- this._dimensions = t;
100
- for (let e = 0;e < t.length; e++) {
101
- const r = this.getAttachedName(t[e].name, t[e].attributes[0].expression);
102
- this[be(r)] = t[e], r != t[e].name && (t[e].name = r);
97
+ setDimensions(i) {
98
+ this._dimensions = i;
99
+ for (let e = 0;e < i.length; e++) {
100
+ const n = this.getAttachedName(i[e].name, i[e].attributes[0].expression);
101
+ this[be(n)] = i[e], n != i[e].name && (i[e].name = n);
103
102
  }
104
103
  }
105
- setAttributes(t) {
106
- this._attributes = t || [];
107
- for (let e = 0;e < t.length; e++) {
108
- const r = this.getAttachedName(t[e].name, t[e].expression);
109
- this[be(r)] = t[e], t[e].name != r && (t[e].name = r);
104
+ setAttributes(i) {
105
+ this._attributes = i || [];
106
+ for (let e = 0;e < i.length; e++) {
107
+ const n = this.getAttachedName(i[e].name, i[e].expression);
108
+ this[be(n)] = i[e], i[e].name != n && (i[e].name = n);
110
109
  }
111
110
  }
112
111
  get id() {
@@ -124,35 +123,35 @@ class y extends vn {
124
123
  getSort() {
125
124
  return this._sort;
126
125
  }
127
- sort(t) {
128
- return new y(this.name, this.expression, this.attributes, this.dimensions, this.type, this.description, t, this.dataSource, this.composeCode, this.defaultAttribute);
126
+ sort(i) {
127
+ return new g2(this.name, this.expression, this.attributes, this.dimensions, this.type, this.description, i, this.dataSource, this.composeCode, this.defaultAttribute);
129
128
  }
130
129
  serialize() {
131
- const t = super.serialize();
132
- return t.expression = this.expression, this.getSort() !== undefined && (t.sort = this.getSort()), t.attributes = this._attributes.map((e) => e.serialize()), t.dimensions = this._dimensions.map((e) => e.serialize()), this.defaultAttribute && (t.defaultAttribute = this.defaultAttribute.serialize()), t;
130
+ const i = super.serialize();
131
+ return i.expression = this.expression, this.getSort() !== undefined && (i.sort = this.getSort()), i.attributes = this._attributes.map((e) => e.serialize()), i.dimensions = this._dimensions.map((e) => e.serialize()), this.defaultAttribute && (i.defaultAttribute = this.defaultAttribute.serialize()), i;
133
132
  }
134
- jaql(t) {
133
+ jaql(i) {
135
134
  if (this.defaultAttribute)
136
- return this.defaultAttribute.jaql(t);
135
+ return this.defaultAttribute.jaql(i);
137
136
  if (this.dimensions.length > 0)
138
- return this.dimensions[0].jaql(t);
137
+ return this.dimensions[0].jaql(i);
139
138
  const e = {
140
139
  jaql: {
141
140
  title: this.name,
142
141
  dim: this.expression,
143
- datatype: vs(this.type)
142
+ datatype: xs(this.type)
144
143
  }
145
144
  };
146
- return this._sort != C.None && (e.jaql.sort = this._sort == C.Ascending ? "asc" : "desc"), t === true ? e.jaql : e;
145
+ return this._sort != N.None && (e.jaql.sort = this._sort == N.Ascending ? "asc" : "desc"), i === true ? e.jaql : e;
147
146
  }
148
147
  }
149
- var z = (i) => i && i.__serializable === "DimensionalDimension";
148
+ var L = (t) => t && t.__serializable === "DimensionalDimension";
150
149
 
151
- class p extends y {
152
- constructor(t, e, r, o, d, m2, l, c) {
153
- super(t, e, [], [], E.DateDimension, r, o, d, m2), this.__serializable = "DimensionalDateDimension";
154
- const a = [r, o, d, undefined, undefined, l, c];
155
- this.defaultLevel = g.Years, this.Years = new J(g.Years, e, g.Years, "yyyy", ...a), this.Quarters = new J(g.Quarters, e, g.Quarters, "Q yyyy", ...a), this.Months = new J(g.Months, e, g.Months, "yyyy-MM", ...a), this.Weeks = new J(g.Weeks, e, g.Weeks, "ww yyyy", ...a), this.Days = new J(g.Days, e, g.Days, "yyyy-MM-dd", ...a), this.Hours = new J(g.Hours, e, g.Hours, "yyyy-MM-dd HH:mm", ...a), this.MinutesRoundTo30 = new J(g.MinutesRoundTo30, e, g.MinutesRoundTo30, "yyyy-MM-dd HH:mm", r, o, d), this.MinutesRoundTo15 = new J(g.MinutesRoundTo15, e, g.MinutesRoundTo15, "yyyy-MM-dd HH:mm", ...a), this.Minutes = new J(g.Minutes, e, g.Minutes, "yyyy-MM-dd HH:mm", ...a), this.Seconds = new J(g.Seconds, e, g.Seconds, "yyyy-MM-dd HH:mm:ss", r, o, d), this.AggHours = new J(g.AggHours, e, g.AggHours, "HH:mm", ...a), this.AggMinutesRoundTo30 = new J(g.AggMinutesRoundTo30, e, g.AggMinutesRoundTo30, "HH:mm", r, o, d), this.AggMinutesRoundTo15 = new J(g.AggMinutesRoundTo15, e, g.AggMinutesRoundTo15, "HH:mm", ...a), this.AggMinutesRoundTo1 = new J(g.AggMinutesRoundTo1, e, g.AggMinutesRoundTo1, "HH:mm", ...a), this.setAttributes([
150
+ class D extends g2 {
151
+ constructor(i, e, n, s, r, a, h2, c) {
152
+ super(i, e, [], [], E.DateDimension, n, s, r, a), this.__serializable = "DimensionalDateDimension";
153
+ const d = [n, s, r, undefined, undefined, h2, c];
154
+ this.defaultLevel = g.Years, this.Years = new J(g.Years, e, g.Years, "yyyy", ...d), this.Quarters = new J(g.Quarters, e, g.Quarters, "Q yyyy", ...d), this.Months = new J(g.Months, e, g.Months, "yyyy-MM", ...d), this.Weeks = new J(g.Weeks, e, g.Weeks, "ww yyyy", ...d), this.Days = new J(g.Days, e, g.Days, "yyyy-MM-dd", ...d), this.Hours = new J(g.Hours, e, g.Hours, "yyyy-MM-dd HH:mm", ...d), this.MinutesRoundTo30 = new J(g.MinutesRoundTo30, e, g.MinutesRoundTo30, "yyyy-MM-dd HH:mm", n, s, r), this.MinutesRoundTo15 = new J(g.MinutesRoundTo15, e, g.MinutesRoundTo15, "yyyy-MM-dd HH:mm", ...d), this.Minutes = new J(g.Minutes, e, g.Minutes, "yyyy-MM-dd HH:mm", ...d), this.Seconds = new J(g.Seconds, e, g.Seconds, "yyyy-MM-dd HH:mm:ss", n, s, r), this.AggHours = new J(g.AggHours, e, g.AggHours, "HH:mm", ...d), this.AggMinutesRoundTo30 = new J(g.AggMinutesRoundTo30, e, g.AggMinutesRoundTo30, "HH:mm", n, s, r), this.AggMinutesRoundTo15 = new J(g.AggMinutesRoundTo15, e, g.AggMinutesRoundTo15, "HH:mm", ...d), this.AggMinutesRoundTo1 = new J(g.AggMinutesRoundTo1, e, g.AggMinutesRoundTo1, "HH:mm", ...d), this.setAttributes([
156
155
  this.Years,
157
156
  this.Quarters,
158
157
  this.Months,
@@ -173,74 +172,219 @@ class p extends y {
173
172
  return this.expression;
174
173
  }
175
174
  setDimensions() {}
176
- setAttributes(t) {
177
- this._attributes = t;
175
+ setAttributes(i) {
176
+ this._attributes = i;
178
177
  }
179
178
  getSort() {
180
179
  return this._sort;
181
180
  }
182
- sort(t) {
183
- return new p(this.name, this.expression, this.description, t, this.dataSource, this.composeCode, this.indexed, this.merged);
181
+ sort(i) {
182
+ return new D(this.name, this.expression, this.description, i, this.dataSource, this.composeCode, this.indexed, this.merged);
184
183
  }
185
184
  serialize() {
186
185
  return super.serialize();
187
186
  }
188
- jaql(t) {
187
+ jaql(i) {
189
188
  const e = this[this.defaultLevel].jaql();
190
- return e.jaql.title = this.name, t ? e.jaql : e;
191
- }
192
- }
193
- var S = (i) => i && i.__serializable === "DimensionalDateDimension";
194
- function N(i) {
195
- const t = i.name || i.title, e = i.desc || i.description, r = i.expression || i.dim, o = y.parseType(i.dimtype || i.type), d = i.sort, m2 = i.dataSource, l = i.indexed, c = i.merged;
196
- if (o == E.DateDimension)
197
- return new p(t, r, e, d, m2, undefined, l, c);
198
- const a = Object.getOwnPropertyNames(i).map((s) => i[s]).filter((s) => E.isAttribute(s == null ? undefined : s.type));
199
- if (a.length == 0)
200
- if (i.attributes) {
201
- let s;
202
- for (let M = 0;M < i.attributes.length; M++)
203
- s = i.attributes[M], a.push(new Ke(s.name, s.expression, s.type, s.description, s.sort, s.dataSource, undefined, undefined, s.indexed, s.merged));
189
+ return e.jaql.title = this.name, i ? e.jaql : e;
190
+ }
191
+ }
192
+ var I = (t) => t && t.__serializable === "DimensionalDateDimension";
193
+ function z(t) {
194
+ const i = t.name || t.title, e = t.desc || t.description, n = t.expression || t.dim, s = g2.parseType(t.dimtype || t.type), r = t.sort, a = t.dataSource, h2 = t.indexed, c = t.merged;
195
+ if (s == E.DateDimension)
196
+ return new D(i, n, e, r, a, undefined, h2, c);
197
+ const d = Object.getOwnPropertyNames(t).map((o) => t[o]).filter((o) => E.isAttribute(o == null ? undefined : o.type));
198
+ if (d.length == 0)
199
+ if (t.attributes) {
200
+ let o;
201
+ for (let M = 0;M < t.attributes.length; M++)
202
+ o = t.attributes[M], d.push(new Ke(o.name, o.expression, o.type, o.description, o.sort, o.dataSource, undefined, undefined, o.indexed, o.merged));
204
203
  } else
205
- r && a.push(new Ke(t, r, o, e, d, m2, undefined, undefined, l, c));
206
- const g2 = Object.getOwnPropertyNames(i).map((s) => i[s]).filter((s) => E.isDimension(s == null ? undefined : s.type));
207
- if (g2.length == 0 && i.dimensions)
208
- for (let s = 0;s < i.dimensions.length; s++)
209
- g2.push(N(i.dimensions[s]));
210
- const D = new y(t, r, a, g2, o, e, d, m2);
211
- return i.defaultAttribute && (D.defaultAttribute = a.find((s) => s.name === i.defaultAttribute)), D;
212
- }
213
- function q(i) {
214
- const t = i.name || i.title, e = i.expression || i.dim, r = i.desc || i.description, o = i.sort, d = i.dataSource;
215
- return new p(t, e, r, o, d, undefined, i.indexed, i.merged);
204
+ n && d.push(new Ke(i, n, s, e, r, a, undefined, undefined, h2, c));
205
+ const f = Object.getOwnPropertyNames(t).map((o) => t[o]).filter((o) => E.isDimension(o == null ? undefined : o.type));
206
+ if (f.length == 0 && t.dimensions)
207
+ for (let o = 0;o < t.dimensions.length; o++)
208
+ f.push(z(t.dimensions[o]));
209
+ const p = new g2(i, n, d, f, s, e, r, a);
210
+ return t.defaultAttribute && (p.defaultAttribute = d.find((o) => o.name === t.defaultAttribute)), p;
211
+ }
212
+ function Q(t) {
213
+ const i = t.name || t.title, e = t.expression || t.dim, n = t.desc || t.description, s = t.sort, r = t.dataSource;
214
+ return new D(i, e, n, s, r, undefined, t.indexed, t.merged);
215
+ }
216
+ function T(t, i) {
217
+ const e = [];
218
+ let n = "", s = 0, r = false, a = null;
219
+ for (let h2 = 0;h2 < t.length; h2++) {
220
+ const c = t[h2], d = t[h2 + 1];
221
+ if (r) {
222
+ if (c !== a) {
223
+ n += c;
224
+ continue;
225
+ }
226
+ if (d === a) {
227
+ n += c + d, h2++;
228
+ continue;
229
+ }
230
+ r = false, a = null, n += c;
231
+ continue;
232
+ } else {
233
+ if (c === "'" || c === '"') {
234
+ r = true, a = c, n += c;
235
+ continue;
236
+ }
237
+ if ("([{".includes(c) && s++, ")]}".includes(c) && s--, c === i && s === 0) {
238
+ e.push(n.trim()), n = "";
239
+ continue;
240
+ }
241
+ }
242
+ n += c;
243
+ }
244
+ return n.trim() && e.push(n.trim()), e;
245
+ }
246
+ function N2(t, i) {
247
+ let e = 0, n = false, s = null;
248
+ for (let r = 0;r < t.length; r++) {
249
+ const a = t[r], h2 = t[r + 1];
250
+ if (n) {
251
+ if (a !== s)
252
+ continue;
253
+ if (h2 === s) {
254
+ r++;
255
+ continue;
256
+ }
257
+ n = false, s = null;
258
+ } else {
259
+ if (a === "'" || a === '"') {
260
+ n = true, s = a;
261
+ continue;
262
+ }
263
+ if ("([{".includes(a) && e++, ")]}".includes(a) && e--, a === i && e === 0)
264
+ return r;
265
+ }
266
+ }
267
+ return -1;
268
+ }
269
+ function Y(t, i) {
270
+ if (t[i] !== "(")
271
+ return -1;
272
+ let e = 1, n = i + 1, s = false, r = null;
273
+ for (;n < t.length; ) {
274
+ const a = t[n], h2 = t[n + 1];
275
+ if (s) {
276
+ if (a !== r) {
277
+ n++;
278
+ continue;
279
+ }
280
+ if (h2 === r) {
281
+ n += 2;
282
+ continue;
283
+ }
284
+ s = false, r = null, n++;
285
+ } else {
286
+ if (a === "'" || a === '"') {
287
+ s = true, r = a, n++;
288
+ continue;
289
+ }
290
+ if ("([{".includes(a) && e++, ")]}".includes(a) && --e === 0)
291
+ return n;
292
+ n++;
293
+ }
294
+ }
295
+ return -1;
296
+ }
297
+ function C(t) {
298
+ return t.startsWith("'") && t.endsWith("'") || t.startsWith('"') && t.endsWith('"') ? t.slice(1, -1) : t;
299
+ }
300
+ function q(t) {
301
+ if (!t || typeof t != "string")
302
+ throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof t}`);
303
+ const i = t.trim();
304
+ if (!i)
305
+ throw new Error("Invalid composeCode: empty string");
306
+ const e = i.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
307
+ if (!e)
308
+ throw new Error(`Invalid composeCode format: expected function call, got '${i}'`);
309
+ const n = e[1], s = e[2], r = _(s);
310
+ return {
311
+ function: n,
312
+ args: r
313
+ };
314
+ }
315
+ function _(t) {
316
+ return t.trim() ? T(t, ",").map(H) : [];
317
+ }
318
+ function H(t) {
319
+ if (!t)
320
+ throw new Error("Cannot parse empty argument value");
321
+ if (t === "null")
322
+ return null;
323
+ if (t === "undefined")
324
+ return;
325
+ if (t === "true")
326
+ return true;
327
+ if (t === "false")
328
+ return false;
329
+ if (t.match(/^-?\d+(\.\d+)?$/))
330
+ return parseFloat(t);
331
+ if (t.startsWith("'") && t.endsWith("'") || t.startsWith('"') && t.endsWith('"')) {
332
+ const e = t[0];
333
+ return t.slice(1, -1).replace(new RegExp(`${e}${e}`, "g"), e);
334
+ }
335
+ if (t.startsWith("[") && t.endsWith("]")) {
336
+ const e = t.slice(1, -1).trim();
337
+ if (!e)
338
+ return [];
339
+ const n = _(e);
340
+ return n.every((s) => typeof s == "string"), n;
341
+ }
342
+ if (t.startsWith("{") && t.endsWith("}")) {
343
+ const e = t.slice(1, -1).trim();
344
+ return e ? $(e) : {};
345
+ }
346
+ return t.includes("(") && t.includes(")") ? q(t) : (t.startsWith("DM."), t);
347
+ }
348
+ function E2(t) {
349
+ const i = N2(t, ":");
350
+ if (i === -1)
351
+ throw new Error(`Invalid object property: expected 'key: value', got '${t}'`);
352
+ const e = C(t.slice(0, i).trim()), n = H(t.slice(i + 1).trim());
353
+ return [e, n];
354
+ }
355
+ function $(t) {
356
+ if (!t.trim())
357
+ return {};
358
+ const i = T(t, ",").map(E2).filter(([, e]) => e !== null);
359
+ return Object.fromEntries(i);
216
360
  }
217
361
 
218
362
  // node_modules/@sisense/sdk-ui/dist/analytics-composer/node.js
219
- var Vt = Object.defineProperty;
220
- var Wt = Object.defineProperties;
221
- var jt = Object.getOwnPropertyDescriptors;
222
- var Ue = Object.getOwnPropertySymbols;
223
- var Kt = Object.prototype.hasOwnProperty;
224
- var Gt = Object.prototype.propertyIsEnumerable;
225
- var _e = (e, t, r) => (t in e) ? Vt(e, t, { enumerable: true, configurable: true, writable: true, value: r }) : e[t] = r;
226
- var y2 = (e, t) => {
363
+ var Lt2 = Object.defineProperty;
364
+ var Ut = Object.defineProperties;
365
+ var _t = Object.getOwnPropertyDescriptors;
366
+ var Pe = Object.getOwnPropertySymbols;
367
+ var Vt = Object.prototype.hasOwnProperty;
368
+ var jt = Object.prototype.propertyIsEnumerable;
369
+ var ke = (e, t, r) => (t in e) ? Lt2(e, t, { enumerable: true, configurable: true, writable: true, value: r }) : e[t] = r;
370
+ var y = (e, t) => {
227
371
  for (var r in t || (t = {}))
228
- Kt.call(t, r) && _e(e, r, t[r]);
229
- if (Ue)
230
- for (var r of Ue(t))
231
- Gt.call(t, r) && _e(e, r, t[r]);
372
+ Vt.call(t, r) && ke(e, r, t[r]);
373
+ if (Pe)
374
+ for (var r of Pe(t))
375
+ jt.call(t, r) && ke(e, r, t[r]);
232
376
  return e;
233
377
  };
234
- var F = (e, t) => Wt(e, jt(t));
235
- function Yr(e, t) {
236
- const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i, o) => Array.from({ length: s + 1 }, (a, u) => o === 0 ? u : u === 0 ? o : 0));
378
+ var A = (e, t) => Ut(e, _t(t));
379
+ function Gr(e, t) {
380
+ const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i, a) => Array.from({ length: s + 1 }, (o, u) => a === 0 ? u : u === 0 ? a : 0));
237
381
  for (let i = 1;i <= r; i++)
238
- for (let o = 1;o <= s; o++)
239
- n[i][o] = Math.min(n[i - 1][o] + 1, n[i][o - 1] + 1, n[i - 1][o - 1] + (e[i - 1] === t[o - 1] ? 0 : 1));
382
+ for (let a = 1;a <= s; a++)
383
+ n[i][a] = Math.min(n[i - 1][a] + 1, n[i][a - 1] + 1, n[i - 1][a - 1] + (e[i - 1] === t[a - 1] ? 0 : 1));
240
384
  return n[r][s];
241
385
  }
242
386
 
243
- class Jr {
387
+ class Yr {
244
388
  constructor() {
245
389
  this.keyToValue = /* @__PURE__ */ new Map, this.valueToKey = /* @__PURE__ */ new Map;
246
390
  }
@@ -258,9 +402,9 @@ class Jr {
258
402
  }
259
403
  }
260
404
 
261
- class ot {
405
+ class it {
262
406
  constructor(t) {
263
- this.generateIdentifier = t, this.kv = new Jr;
407
+ this.generateIdentifier = t, this.kv = new Yr;
264
408
  }
265
409
  register(t, r) {
266
410
  this.kv.getByValue(t) || (r || (r = this.generateIdentifier(t)), this.kv.set(r, t));
@@ -276,7 +420,7 @@ class ot {
276
420
  }
277
421
  }
278
422
 
279
- class Hr extends ot {
423
+ class Jr extends it {
280
424
  constructor() {
281
425
  super((t) => t.name), this.classToAllowedProps = /* @__PURE__ */ new Map;
282
426
  }
@@ -287,7 +431,7 @@ class Hr extends ot {
287
431
  return this.classToAllowedProps.get(t);
288
432
  }
289
433
  }
290
- function Qr(e) {
434
+ function Hr(e) {
291
435
  if ("values" in Object)
292
436
  return Object.values(e);
293
437
  const t = [];
@@ -295,8 +439,8 @@ function Qr(e) {
295
439
  e.hasOwnProperty(r) && t.push(e[r]);
296
440
  return t;
297
441
  }
298
- function Xr(e, t) {
299
- const r = Qr(e);
442
+ function Qr(e, t) {
443
+ const r = Hr(e);
300
444
  if ("find" in r)
301
445
  return r.find(t);
302
446
  const s = r;
@@ -312,7 +456,7 @@ function V(e, t) {
312
456
  function ee(e, t) {
313
457
  return e.indexOf(t) !== -1;
314
458
  }
315
- function We(e, t) {
459
+ function ze(e, t) {
316
460
  for (let r = 0;r < e.length; r++) {
317
461
  const s = e[r];
318
462
  if (t(s))
@@ -320,7 +464,7 @@ function We(e, t) {
320
464
  }
321
465
  }
322
466
 
323
- class Zr {
467
+ class Xr {
324
468
  constructor() {
325
469
  this.transfomers = {};
326
470
  }
@@ -328,36 +472,36 @@ class Zr {
328
472
  this.transfomers[t.name] = t;
329
473
  }
330
474
  findApplicable(t) {
331
- return Xr(this.transfomers, (r) => r.isApplicable(t));
475
+ return Qr(this.transfomers, (r) => r.isApplicable(t));
332
476
  }
333
477
  findByName(t) {
334
478
  return this.transfomers[t];
335
479
  }
336
480
  }
337
- var es = (e) => Object.prototype.toString.call(e).slice(8, -1);
481
+ var Zr = (e) => Object.prototype.toString.call(e).slice(8, -1);
338
482
  var at = (e) => typeof e == "undefined";
339
- var ts = (e) => e === null;
483
+ var es = (e) => e === null;
340
484
  var G = (e) => typeof e != "object" || e === null || e === Object.prototype ? false : Object.getPrototypeOf(e) === null ? true : Object.getPrototypeOf(e) === Object.prototype;
341
- var pe = (e) => G(e) && Object.keys(e).length === 0;
342
- var I = (e) => Array.isArray(e);
343
- var rs = (e) => typeof e == "string";
344
- var ss = (e) => typeof e == "number" && !isNaN(e);
345
- var ns = (e) => typeof e == "boolean";
346
- var is = (e) => e instanceof RegExp;
347
- var Y = (e) => e instanceof Map;
485
+ var de = (e) => G(e) && Object.keys(e).length === 0;
486
+ var I2 = (e) => Array.isArray(e);
487
+ var ts = (e) => typeof e == "string";
488
+ var rs = (e) => typeof e == "number" && !isNaN(e);
489
+ var ss = (e) => typeof e == "boolean";
490
+ var ns = (e) => e instanceof RegExp;
491
+ var Y2 = (e) => e instanceof Map;
348
492
  var J2 = (e) => e instanceof Set;
349
- var ut = (e) => es(e) === "Symbol";
350
- var os = (e) => e instanceof Date && !isNaN(e.valueOf());
493
+ var ot = (e) => Zr(e) === "Symbol";
494
+ var is = (e) => e instanceof Date && !isNaN(e.valueOf());
351
495
  var as = (e) => e instanceof Error;
352
- var je = (e) => typeof e == "number" && isNaN(e);
353
- var us = (e) => ns(e) || ts(e) || at(e) || ss(e) || rs(e) || ut(e);
354
- var cs = (e) => typeof e == "bigint";
496
+ var Le = (e) => typeof e == "number" && isNaN(e);
497
+ var os = (e) => ss(e) || es(e) || at(e) || rs(e) || ts(e) || ot(e);
498
+ var us = (e) => typeof e == "bigint";
355
499
  var ls = (e) => e === 1 / 0 || e === -1 / 0;
356
- var fs = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView);
357
- var ds = (e) => e instanceof URL;
358
- var ct = (e) => e.replace(/\./g, "\\.");
359
- var ce = (e) => e.map(String).map(ct).join(".");
360
- var K = (e) => {
500
+ var cs = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView);
501
+ var fs = (e) => e instanceof URL;
502
+ var ut = (e) => e.replace(/\./g, "\\.");
503
+ var oe = (e) => e.map(String).map(ut).join(".");
504
+ var W = (e) => {
361
505
  const t = [];
362
506
  let r = "";
363
507
  for (let n = 0;n < e.length; n++) {
@@ -375,7 +519,7 @@ var K = (e) => {
375
519
  const s = r;
376
520
  return t.push(s), t;
377
521
  };
378
- function v(e, t, r, s) {
522
+ function R(e, t, r, s) {
379
523
  return {
380
524
  isApplicable: e,
381
525
  annotation: t,
@@ -384,10 +528,10 @@ function v(e, t, r, s) {
384
528
  };
385
529
  }
386
530
  var lt = [
387
- v(at, "undefined", () => null, () => {}),
388
- v(cs, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
389
- v(os, "Date", (e) => e.toISOString(), (e) => new Date(e)),
390
- v(as, "Error", (e, t) => {
531
+ R(at, "undefined", () => null, () => {}),
532
+ R(us, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
533
+ R(is, "Date", (e) => e.toISOString(), (e) => new Date(e)),
534
+ R(as, "Error", (e, t) => {
391
535
  const r = {
392
536
  name: e.name,
393
537
  message: e.message
@@ -401,17 +545,17 @@ var lt = [
401
545
  r[s] = e[s];
402
546
  }), r;
403
547
  }),
404
- v(is, "regexp", (e) => "" + e, (e) => {
548
+ R(ns, "regexp", (e) => "" + e, (e) => {
405
549
  const t = e.slice(1, e.lastIndexOf("/")), r = e.slice(e.lastIndexOf("/") + 1);
406
550
  return new RegExp(t, r);
407
551
  }),
408
- v(J2, "set", (e) => [...e.values()], (e) => new Set(e)),
409
- v(Y, "map", (e) => [...e.entries()], (e) => new Map(e)),
410
- v((e) => je(e) || ls(e), "number", (e) => je(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
411
- v((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
412
- v(ds, "URL", (e) => e.toString(), (e) => new URL(e))
552
+ R(J2, "set", (e) => [...e.values()], (e) => new Set(e)),
553
+ R(Y2, "map", (e) => [...e.entries()], (e) => new Map(e)),
554
+ R((e) => Le(e) || ls(e), "number", (e) => Le(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
555
+ R((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
556
+ R(fs, "URL", (e) => e.toString(), (e) => new URL(e))
413
557
  ];
414
- function ie(e, t, r, s) {
558
+ function se(e, t, r, s) {
415
559
  return {
416
560
  isApplicable: e,
417
561
  annotation: t,
@@ -419,13 +563,13 @@ function ie(e, t, r, s) {
419
563
  untransform: s
420
564
  };
421
565
  }
422
- var ft = ie((e, t) => ut(e) ? !!t.symbolRegistry.getIdentifier(e) : false, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
566
+ var ct = se((e, t) => ot(e) ? !!t.symbolRegistry.getIdentifier(e) : false, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
423
567
  const s = r.symbolRegistry.getValue(t[1]);
424
568
  if (!s)
425
569
  throw new Error("Trying to deserialize unknown symbol");
426
570
  return s;
427
571
  });
428
- var ms = [
572
+ var ds = [
429
573
  Int8Array,
430
574
  Uint8Array,
431
575
  Int16Array,
@@ -436,19 +580,19 @@ var ms = [
436
580
  Float64Array,
437
581
  Uint8ClampedArray
438
582
  ].reduce((e, t) => (e[t.name] = t, e), {});
439
- var dt = ie(fs, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
440
- const r = ms[t[1]];
583
+ var ft = se(cs, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
584
+ const r = ds[t[1]];
441
585
  if (!r)
442
586
  throw new Error("Trying to deserialize unknown typed array");
443
587
  return new r(e);
444
588
  });
445
- function mt(e, t) {
589
+ function dt(e, t) {
446
590
  return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : false;
447
591
  }
448
- var pt = ie(mt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
592
+ var mt = se(dt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
449
593
  const r = t.classRegistry.getAllowedProps(e.constructor);
450
594
  if (!r)
451
- return y2({}, e);
595
+ return y({}, e);
452
596
  const s = {};
453
597
  return r.forEach((n) => {
454
598
  s[n] = e[n];
@@ -459,53 +603,53 @@ var pt = ie(mt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)
459
603
  throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
460
604
  return Object.assign(Object.create(s.prototype), e);
461
605
  });
462
- var gt2 = ie((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, r) => {
606
+ var pt = se((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, r) => {
463
607
  const s = r.customTransformerRegistry.findByName(t[1]);
464
608
  if (!s)
465
609
  throw new Error("Trying to deserialize unknown custom value");
466
610
  return s.deserialize(e);
467
611
  });
468
- var ps = [pt, ft, gt2, dt];
469
- var Ke2 = (e, t) => {
470
- const r = We(ps, (n) => n.isApplicable(e, t));
612
+ var ms = [mt, ct, pt, ft];
613
+ var Ue = (e, t) => {
614
+ const r = ze(ms, (n) => n.isApplicable(e, t));
471
615
  if (r)
472
616
  return {
473
617
  value: r.transform(e, t),
474
618
  type: r.annotation(e, t)
475
619
  };
476
- const s = We(lt, (n) => n.isApplicable(e, t));
620
+ const s = ze(lt, (n) => n.isApplicable(e, t));
477
621
  if (s)
478
622
  return {
479
623
  value: s.transform(e, t),
480
624
  type: s.annotation
481
625
  };
482
626
  };
483
- var yt = {};
627
+ var gt = {};
484
628
  lt.forEach((e) => {
485
- yt[e.annotation] = e;
629
+ gt[e.annotation] = e;
486
630
  });
487
- var gs = (e, t, r) => {
488
- if (I(t))
631
+ var ps = (e, t, r) => {
632
+ if (I2(t))
489
633
  switch (t[0]) {
490
634
  case "symbol":
491
- return ft.untransform(e, t, r);
635
+ return ct.untransform(e, t, r);
492
636
  case "class":
493
- return pt.untransform(e, t, r);
637
+ return mt.untransform(e, t, r);
494
638
  case "custom":
495
- return gt2.untransform(e, t, r);
639
+ return pt.untransform(e, t, r);
496
640
  case "typed-array":
497
- return dt.untransform(e, t, r);
641
+ return ft.untransform(e, t, r);
498
642
  default:
499
643
  throw new Error("Unknown transformation: " + t);
500
644
  }
501
645
  else {
502
- const s = yt[t];
646
+ const s = gt[t];
503
647
  if (!s)
504
648
  throw new Error("Unknown transformation: " + t);
505
649
  return s.untransform(e, r);
506
650
  }
507
651
  };
508
- var L = (e, t) => {
652
+ var L2 = (e, t) => {
509
653
  if (t > e.size)
510
654
  throw new Error("index out of bounds");
511
655
  const r = e.keys();
@@ -513,7 +657,7 @@ var L = (e, t) => {
513
657
  r.next(), t--;
514
658
  return r.next().value;
515
659
  };
516
- function ht(e) {
660
+ function yt(e) {
517
661
  if (ee(e, "__proto__"))
518
662
  throw new Error("__proto__ is not allowed as a property");
519
663
  if (ee(e, "prototype"))
@@ -521,20 +665,20 @@ function ht(e) {
521
665
  if (ee(e, "constructor"))
522
666
  throw new Error("constructor is not allowed as a property");
523
667
  }
524
- var ys = (e, t) => {
525
- ht(t);
668
+ var gs = (e, t) => {
669
+ yt(t);
526
670
  for (let r = 0;r < t.length; r++) {
527
671
  const s = t[r];
528
672
  if (J2(e))
529
- e = L(e, +s);
530
- else if (Y(e)) {
531
- const n = +s, i = +t[++r] == 0 ? "key" : "value", o = L(e, n);
673
+ e = L2(e, +s);
674
+ else if (Y2(e)) {
675
+ const n = +s, i = +t[++r] == 0 ? "key" : "value", a = L2(e, n);
532
676
  switch (i) {
533
677
  case "key":
534
- e = o;
678
+ e = a;
535
679
  break;
536
680
  case "value":
537
- e = e.get(o);
681
+ e = e.get(a);
538
682
  break;
539
683
  }
540
684
  } else
@@ -542,159 +686,159 @@ var ys = (e, t) => {
542
686
  }
543
687
  return e;
544
688
  };
545
- var ge = (e, t, r) => {
546
- if (ht(t), t.length === 0)
689
+ var me = (e, t, r) => {
690
+ if (yt(t), t.length === 0)
547
691
  return r(e);
548
692
  let s = e;
549
693
  for (let i = 0;i < t.length - 1; i++) {
550
- const o = t[i];
551
- if (I(s)) {
552
- const a = +o;
553
- s = s[a];
554
- } else if (G(s))
694
+ const a = t[i];
695
+ if (I2(s)) {
696
+ const o = +a;
555
697
  s = s[o];
698
+ } else if (G(s))
699
+ s = s[a];
556
700
  else if (J2(s)) {
557
- const a = +o;
558
- s = L(s, a);
559
- } else if (Y(s)) {
701
+ const o = +a;
702
+ s = L2(s, o);
703
+ } else if (Y2(s)) {
560
704
  if (i === t.length - 2)
561
705
  break;
562
- const u = +o, c = +t[++i] == 0 ? "key" : "value", p2 = L(s, u);
563
- switch (c) {
706
+ const u = +a, l = +t[++i] == 0 ? "key" : "value", p = L2(s, u);
707
+ switch (l) {
564
708
  case "key":
565
- s = p2;
709
+ s = p;
566
710
  break;
567
711
  case "value":
568
- s = s.get(p2);
712
+ s = s.get(p);
569
713
  break;
570
714
  }
571
715
  }
572
716
  }
573
717
  const n = t[t.length - 1];
574
- if (I(s) ? s[+n] = r(s[+n]) : G(s) && (s[n] = r(s[n])), J2(s)) {
575
- const i = L(s, +n), o = r(i);
576
- i !== o && (s.delete(i), s.add(o));
718
+ if (I2(s) ? s[+n] = r(s[+n]) : G(s) && (s[n] = r(s[n])), J2(s)) {
719
+ const i = L2(s, +n), a = r(i);
720
+ i !== a && (s.delete(i), s.add(a));
577
721
  }
578
- if (Y(s)) {
579
- const i = +t[t.length - 2], o = L(s, i);
722
+ if (Y2(s)) {
723
+ const i = +t[t.length - 2], a = L2(s, i);
580
724
  switch (+n == 0 ? "key" : "value") {
581
725
  case "key": {
582
- const u = r(o);
583
- s.set(u, s.get(o)), u !== o && s.delete(o);
726
+ const u = r(a);
727
+ s.set(u, s.get(a)), u !== a && s.delete(a);
584
728
  break;
585
729
  }
586
730
  case "value": {
587
- s.set(o, r(s.get(o)));
731
+ s.set(a, r(s.get(a)));
588
732
  break;
589
733
  }
590
734
  }
591
735
  }
592
736
  return e;
593
737
  };
594
- function ye2(e, t, r = []) {
738
+ function pe(e, t, r = []) {
595
739
  if (!e)
596
740
  return;
597
- if (!I(e)) {
598
- V(e, (i, o) => ye2(i, t, [...r, ...K(o)]));
741
+ if (!I2(e)) {
742
+ V(e, (i, a) => pe(i, t, [...r, ...W(a)]));
599
743
  return;
600
744
  }
601
745
  const [s, n] = e;
602
- n && V(n, (i, o) => {
603
- ye2(i, t, [...r, ...K(o)]);
746
+ n && V(n, (i, a) => {
747
+ pe(i, t, [...r, ...W(a)]);
604
748
  }), t(s, r);
605
749
  }
606
- function hs(e, t, r) {
607
- return ye2(t, (s, n) => {
608
- e = ge(e, n, (i) => gs(i, s, r));
750
+ function ys(e, t, r) {
751
+ return pe(t, (s, n) => {
752
+ e = me(e, n, (i) => ps(i, s, r));
609
753
  }), e;
610
754
  }
611
- function bs(e, t) {
755
+ function hs(e, t) {
612
756
  function r(s, n) {
613
- const i = ys(e, K(n));
614
- s.map(K).forEach((o) => {
615
- e = ge(e, o, () => i);
757
+ const i = gs(e, W(n));
758
+ s.map(W).forEach((a) => {
759
+ e = me(e, a, () => i);
616
760
  });
617
761
  }
618
- if (I(t)) {
762
+ if (I2(t)) {
619
763
  const [s, n] = t;
620
764
  s.forEach((i) => {
621
- e = ge(e, K(i), () => e);
765
+ e = me(e, W(i), () => e);
622
766
  }), n && V(n, r);
623
767
  } else
624
768
  V(t, r);
625
769
  return e;
626
770
  }
627
- var As = (e, t) => G(e) || I(e) || Y(e) || J2(e) || mt(e, t);
771
+ var bs = (e, t) => G(e) || I2(e) || Y2(e) || J2(e) || dt(e, t);
628
772
  function Fs(e, t, r) {
629
773
  const s = r.get(e);
630
774
  s ? s.push(t) : r.set(e, [t]);
631
775
  }
632
- function ws(e, t) {
776
+ function As(e, t) {
633
777
  const r = {};
634
778
  let s;
635
779
  return e.forEach((n) => {
636
780
  if (n.length <= 1)
637
781
  return;
638
- t || (n = n.map((a) => a.map(String)).sort((a, u) => a.length - u.length));
639
- const [i, ...o] = n;
640
- i.length === 0 ? s = o.map(ce) : r[ce(i)] = o.map(ce);
641
- }), s ? pe(r) ? [s] : [s, r] : pe(r) ? undefined : r;
782
+ t || (n = n.map((o) => o.map(String)).sort((o, u) => o.length - u.length));
783
+ const [i, ...a] = n;
784
+ i.length === 0 ? s = a.map(oe) : r[oe(i)] = a.map(oe);
785
+ }), s ? de(r) ? [s] : [s, r] : de(r) ? undefined : r;
642
786
  }
643
- var bt = (e, t, r, s, n = [], i = [], o = /* @__PURE__ */ new Map) => {
787
+ var ht2 = (e, t, r, s, n = [], i = [], a = /* @__PURE__ */ new Map) => {
644
788
  var b2;
645
- const a = us(e);
646
- if (!a) {
789
+ const o = os(e);
790
+ if (!o) {
647
791
  Fs(e, n, t);
648
- const g2 = o.get(e);
649
- if (g2)
792
+ const g3 = a.get(e);
793
+ if (g3)
650
794
  return s ? {
651
795
  transformedValue: null
652
- } : g2;
796
+ } : g3;
653
797
  }
654
- if (!As(e, r)) {
655
- const g2 = Ke2(e, r), m2 = g2 ? {
656
- transformedValue: g2.value,
657
- annotations: [g2.type]
798
+ if (!bs(e, r)) {
799
+ const g3 = Ue(e, r), m2 = g3 ? {
800
+ transformedValue: g3.value,
801
+ annotations: [g3.type]
658
802
  } : {
659
803
  transformedValue: e
660
804
  };
661
- return a || o.set(e, m2), m2;
805
+ return o || a.set(e, m2), m2;
662
806
  }
663
807
  if (ee(i, e))
664
808
  return {
665
809
  transformedValue: null
666
810
  };
667
- const u = Ke2(e, r), c = (b2 = u == null ? undefined : u.value) != null ? b2 : e, p2 = I(c) ? [] : {}, l = {};
668
- V(c, (g2, m2) => {
811
+ const u = Ue(e, r), l = (b2 = u == null ? undefined : u.value) != null ? b2 : e, p = I2(l) ? [] : {}, c = {};
812
+ V(l, (g3, m2) => {
669
813
  if (m2 === "__proto__" || m2 === "constructor" || m2 === "prototype")
670
814
  throw new Error(`Detected property ${m2}. This is a prototype pollution risk, please remove it from your object.`);
671
- const A = bt(g2, t, r, s, [...n, m2], [...i, e], o);
672
- p2[m2] = A.transformedValue, I(A.annotations) ? l[m2] = A.annotations : G(A.annotations) && V(A.annotations, (C2, N2) => {
673
- l[ct(m2) + "." + N2] = C2;
815
+ const F = ht2(g3, t, r, s, [...n, m2], [...i, e], a);
816
+ p[m2] = F.transformedValue, I2(F.annotations) ? c[m2] = F.annotations : G(F.annotations) && V(F.annotations, (C2, N3) => {
817
+ c[ut(m2) + "." + N3] = C2;
674
818
  });
675
819
  });
676
- const d = pe(l) ? {
677
- transformedValue: p2,
820
+ const d = de(c) ? {
821
+ transformedValue: p,
678
822
  annotations: u ? [u.type] : undefined
679
823
  } : {
680
- transformedValue: p2,
681
- annotations: u ? [u.type, l] : l
824
+ transformedValue: p,
825
+ annotations: u ? [u.type, c] : c
682
826
  };
683
- return a || o.set(e, d), d;
827
+ return o || a.set(e, d), d;
684
828
  };
685
- function At(e) {
829
+ function bt(e) {
686
830
  return Object.prototype.toString.call(e).slice(8, -1);
687
831
  }
688
- function Ge(e) {
689
- return At(e) === "Array";
832
+ function _e(e) {
833
+ return bt(e) === "Array";
690
834
  }
691
- function Es(e) {
692
- if (At(e) !== "Object")
835
+ function ws2(e) {
836
+ if (bt(e) !== "Object")
693
837
  return false;
694
838
  const t = Object.getPrototypeOf(e);
695
839
  return !!t && t.constructor === Object && t === Object.prototype;
696
840
  }
697
- function Cs(e, t, r, s, n) {
841
+ function Es(e, t, r, s, n) {
698
842
  const i = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
699
843
  i === "enumerable" && (e[t] = r), n && i === "nonenumerable" && Object.defineProperty(e, t, {
700
844
  value: r,
@@ -703,43 +847,43 @@ function Cs(e, t, r, s, n) {
703
847
  configurable: true
704
848
  });
705
849
  }
706
- function he(e, t = {}) {
707
- if (Ge(e))
708
- return e.map((n) => he(n, t));
709
- if (!Es(e))
850
+ function ge(e, t = {}) {
851
+ if (_e(e))
852
+ return e.map((n) => ge(n, t));
853
+ if (!ws2(e))
710
854
  return e;
711
855
  const r = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
712
856
  return [...r, ...s].reduce((n, i) => {
713
- if (Ge(t.props) && !t.props.includes(i))
857
+ if (_e(t.props) && !t.props.includes(i))
714
858
  return n;
715
- const o = e[i], a = he(o, t);
716
- return Cs(n, i, a, e, t.nonenumerable), n;
859
+ const a = e[i], o = ge(a, t);
860
+ return Es(n, i, o, e, t.nonenumerable), n;
717
861
  }, {});
718
862
  }
719
863
 
720
864
  class h2 {
721
865
  constructor({ dedupe: t = false } = {}) {
722
- this.classRegistry = new Hr, this.symbolRegistry = new ot((r) => {
866
+ this.classRegistry = new Jr, this.symbolRegistry = new it((r) => {
723
867
  var s;
724
868
  return (s = r.description) != null ? s : "";
725
- }), this.customTransformerRegistry = new Zr, this.allowedErrorProps = [], this.dedupe = t;
869
+ }), this.customTransformerRegistry = new Xr, this.allowedErrorProps = [], this.dedupe = t;
726
870
  }
727
871
  serialize(t) {
728
- const r = /* @__PURE__ */ new Map, s = bt(t, r, this, this.dedupe), n = {
872
+ const r = /* @__PURE__ */ new Map, s = ht2(t, r, this, this.dedupe), n = {
729
873
  json: s.transformedValue
730
874
  };
731
- s.annotations && (n.meta = F(y2({}, n.meta), {
875
+ s.annotations && (n.meta = A(y({}, n.meta), {
732
876
  values: s.annotations
733
877
  }));
734
- const i = ws(r, this.dedupe);
735
- return i && (n.meta = F(y2({}, n.meta), {
878
+ const i = As(r, this.dedupe);
879
+ return i && (n.meta = A(y({}, n.meta), {
736
880
  referentialEqualities: i
737
881
  })), n;
738
882
  }
739
883
  deserialize(t) {
740
884
  const { json: r, meta: s } = t;
741
- let n = he(r);
742
- return s != null && s.values && (n = hs(n, s.values, this)), s != null && s.referentialEqualities && (n = bs(n, s.referentialEqualities)), n;
885
+ let n = ge(r);
886
+ return s != null && s.values && (n = ys(n, s.values, this)), s != null && s.referentialEqualities && (n = hs(n, s.referentialEqualities)), n;
743
887
  }
744
888
  stringify(t) {
745
889
  return JSON.stringify(this.serialize(t));
@@ -754,7 +898,7 @@ class h2 {
754
898
  this.symbolRegistry.register(t, r);
755
899
  }
756
900
  registerCustom(t, r) {
757
- this.customTransformerRegistry.register(y2({
901
+ this.customTransformerRegistry.register(y({
758
902
  name: r
759
903
  }, t));
760
904
  }
@@ -771,45 +915,45 @@ h2.registerClass = h2.defaultInstance.registerClass.bind(h2.defaultInstance);
771
915
  h2.registerSymbol = h2.defaultInstance.registerSymbol.bind(h2.defaultInstance);
772
916
  h2.registerCustom = h2.defaultInstance.registerCustom.bind(h2.defaultInstance);
773
917
  h2.allowErrorProps = h2.defaultInstance.allowErrorProps.bind(h2.defaultInstance);
774
- var z2 = (e) => e === undefined ? C.None : e;
775
- var Ts = (e) => new m(e.metadataItem, e.type);
776
- var Ee = (e) => new Ke(e.name, e.expression, e.type, e.description, z2(e.sort), e.dataSource, e.composeCode);
777
- var Ce = (e) => new J(e.name, e.expression, e.granularity, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
918
+ var z2 = (e) => e === undefined ? N.None : e;
919
+ var Cs = (e) => new m(e.metadataItem, e.type);
920
+ var Ae = (e) => new Ke(e.name, e.expression, e.type, e.description, z2(e.sort), e.dataSource, e.composeCode);
921
+ var we = (e) => new J(e.name, e.expression, e.granularity, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
778
922
  var O = (e) => {
779
923
  switch (e.__serializable) {
780
924
  case "DimensionalAttribute":
781
- return Ee(e);
925
+ return Ae(e);
782
926
  case "DimensionalLevelAttribute":
783
- return Ce(e);
927
+ return we(e);
784
928
  default:
785
929
  return e;
786
930
  }
787
931
  };
788
- var Ft = (e) => new y(e.name, e.expression, e.attributes.map(O), e.dimensions.map(qs), e.type, e.description, z2(e.sort), e.dataSource, e.composeCode, e.defaultAttribute ? O(e.defaultAttribute) : undefined);
789
- var wt = (e) => new p(e.name, e.expression, e.description, z2(e.sort), e.dataSource, e.composeCode, e.indexed, e.merged);
790
- var qs = (e) => {
932
+ var Ft = (e) => new g2(e.name, e.expression, e.attributes.map(O), e.dimensions.map(Ts), e.type, e.description, z2(e.sort), e.dataSource, e.composeCode, e.defaultAttribute ? O(e.defaultAttribute) : undefined);
933
+ var At = (e) => new D(e.name, e.expression, e.description, z2(e.sort), e.dataSource, e.composeCode, e.indexed, e.merged);
934
+ var Ts = (e) => {
791
935
  switch (e.__serializable) {
792
936
  case "DimensionalDimension":
793
937
  return Ft(e);
794
938
  case "DimensionalDateDimension":
795
- return wt(e);
939
+ return At(e);
796
940
  default:
797
941
  return e;
798
942
  }
799
943
  };
800
- var Te = (e) => new ye(e.name, O(e.attribute), e.aggregation, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
801
- var qe = (e) => {
944
+ var Ee = (e) => new ye(e.name, O(e.attribute), e.aggregation, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
945
+ var Ce = (e) => {
802
946
  const t = Object.fromEntries(Object.entries(e.context).map(([r, s]) => {
803
947
  if (s && typeof s == "object" && "__serializable" in s)
804
948
  switch (s.__serializable) {
805
949
  case "DimensionalAttribute":
806
- return [r, Ee(s)];
950
+ return [r, Ae(s)];
807
951
  case "DimensionalLevelAttribute":
808
- return [r, Ce(s)];
952
+ return [r, we(s)];
809
953
  case "DimensionalBaseMeasure":
810
- return [r, Te(s)];
954
+ return [r, Ee(s)];
811
955
  case "DimensionalCalculatedMeasure":
812
- return [r, qe(s)];
956
+ return [r, Ce(s)];
813
957
  default:
814
958
  return [r, s];
815
959
  }
@@ -817,47 +961,47 @@ var qe = (e) => {
817
961
  }));
818
962
  return new X(e.name, e.expression, t, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
819
963
  };
820
- var Et = (e) => new Yt(e.name, O(e.attribute), e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
821
- var le = (e) => {
964
+ var wt = (e) => new Zt(e.name, O(e.attribute), e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
965
+ var ue = (e) => {
822
966
  switch (e.__serializable) {
823
967
  case "DimensionalBaseMeasure":
824
- return Te(e);
968
+ return Ee(e);
825
969
  case "DimensionalCalculatedMeasure":
826
- return qe(e);
970
+ return Ce(e);
827
971
  case "DimensionalMeasureTemplate":
828
- return Et(e);
972
+ return wt(e);
829
973
  default:
830
974
  return e;
831
975
  }
832
976
  };
833
- var T2 = (e) => {
977
+ var T3 = (e) => {
834
978
  switch (e.__serializable) {
835
979
  case "MembersFilter":
836
- return new jd(O(e.attribute), e.members, e.config.backgroundFilter ? F(y2({}, e.config), { backgroundFilter: T2(e.config.backgroundFilter) }) : e.config, e.composeCode);
980
+ return new zd(O(e.attribute), e.members, e.config.backgroundFilter ? A(y({}, e.config), { backgroundFilter: T3(e.config.backgroundFilter) }) : e.config, e.composeCode);
837
981
  case "LogicalAttributeFilter":
838
- return new Bi(e.filters.map((r) => T2(r)), e.operator, e.config, e.composeCode);
982
+ return new Wi(e.filters.map((r) => T3(r)), e.operator, e.config, e.composeCode);
839
983
  case "CascadingFilter":
840
- return new Pd(e._filters.map((r) => T2(r)), e.config, e.composeCode);
984
+ return new Hd(e._filters.map((r) => T3(r)), e.config, e.composeCode);
841
985
  case "ExcludeFilter":
842
- return new Fd(T2(e.filter), e.input ? T2(e.input) : undefined, e.config, e.composeCode);
986
+ return new kd(T3(e.filter), e.input ? T3(e.input) : undefined, e.config, e.composeCode);
843
987
  case "MeasureFilter":
844
- return new Ud(O(e.attribute), le(e.measure), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
988
+ return new qd(O(e.attribute), ue(e.measure), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
845
989
  case "RankingFilter":
846
- return new zi(O(e.attribute), le(e.measure), e.operator, e.count, e.config, e.composeCode);
990
+ return new Gi(O(e.attribute), ue(e.measure), e.operator, e.count, e.config, e.composeCode);
847
991
  case "MeasureRankingFilter":
848
- return new Hi(le(e.measure), e.operator, e.count, e.config, e.composeCode);
992
+ return new Vi(ue(e.measure), e.operator, e.count, e.config, e.composeCode);
849
993
  case "NumericFilter":
850
- return new Bd(O(e.attribute), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
994
+ return new Wd(O(e.attribute), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
851
995
  case "TextFilter":
852
996
  return new re(O(e.attribute), e.operatorA, e.valueA, e.config, e.composeCode);
853
997
  case "DateRangeFilter": {
854
998
  const { valueA: r, valueB: s } = e;
855
- return new zd(O(e.attribute), r, s, e.config, e.composeCode);
999
+ return new Gd(O(e.attribute), r, s, e.config, e.composeCode);
856
1000
  }
857
1001
  case "RelativeDateFilter":
858
- return new wn(O(e.attribute), e.offset, e.count, e.operator, e.anchor, e.config, e.composeCode);
1002
+ return new Rn(O(e.attribute), e.offset, e.count, e.operator, e.anchor, e.config, e.composeCode);
859
1003
  case "CustomFilter":
860
- return new Hd(O(e.attribute), e.jaqlExpression, e.config, e.composeCode);
1004
+ return new Vd(O(e.attribute), e.jaqlExpression, e.config, e.composeCode);
861
1005
  default:
862
1006
  return e;
863
1007
  }
@@ -865,157 +1009,157 @@ var T2 = (e) => {
865
1009
  h2.registerCustom({
866
1010
  isApplicable: h,
867
1011
  serialize: (e) => e.serialize(),
868
- deserialize: (e) => Ts(e)
1012
+ deserialize: (e) => Cs(e)
869
1013
  }, "JaqlElement");
870
1014
  h2.registerCustom({
871
- isApplicable: xp,
1015
+ isApplicable: Ip,
872
1016
  serialize: (e) => e.serialize(),
873
- deserialize: (e) => Ee(e)
1017
+ deserialize: (e) => Ae(e)
874
1018
  }, "DimensionalAttribute");
875
1019
  h2.registerCustom({
876
- isApplicable: wp,
1020
+ isApplicable: $p,
877
1021
  serialize: (e) => e.serialize(),
878
- deserialize: (e) => Ce(e)
1022
+ deserialize: (e) => we(e)
879
1023
  }, "DimensionalLevelAttribute");
880
1024
  h2.registerCustom({
881
- isApplicable: z,
1025
+ isApplicable: L,
882
1026
  serialize: (e) => e.serialize(),
883
1027
  deserialize: (e) => Ft(e)
884
1028
  }, "DimensionalDimension");
885
1029
  h2.registerCustom({
886
- isApplicable: S,
1030
+ isApplicable: I,
887
1031
  serialize: (e) => e.serialize(),
888
- deserialize: (e) => wt(e)
1032
+ deserialize: (e) => At(e)
889
1033
  }, "DimensionalDateDimension");
890
1034
  h2.registerCustom({
891
- isApplicable: $i,
1035
+ isApplicable: Bi,
892
1036
  serialize: (e) => e.serialize(),
893
- deserialize: (e) => Te(e)
1037
+ deserialize: (e) => Ee(e)
894
1038
  }, "DimensionalBaseMeasure");
895
1039
  h2.registerCustom({
896
- isApplicable: ji,
1040
+ isApplicable: zi,
897
1041
  serialize: (e) => e.serialize(),
898
- deserialize: (e) => qe(e)
1042
+ deserialize: (e) => Ce(e)
899
1043
  }, "DimensionalCalculatedMeasure");
900
1044
  h2.registerCustom({
901
- isApplicable: ip,
1045
+ isApplicable: gp,
902
1046
  serialize: (e) => e.serialize(),
903
- deserialize: (e) => Et(e)
1047
+ deserialize: (e) => wt(e)
904
1048
  }, "DimensionalMeasureTemplate");
905
1049
  h2.registerCustom({
906
- isApplicable: ap,
1050
+ isApplicable: pp,
907
1051
  serialize: (e) => e.serialize(),
908
- deserialize: (e) => T2(e)
1052
+ deserialize: (e) => T3(e)
909
1053
  }, "MembersFilter");
910
1054
  h2.registerCustom({
911
- isApplicable: dp,
1055
+ isApplicable: Ap,
912
1056
  serialize: (e) => e.serialize(),
913
- deserialize: (e) => T2(e)
1057
+ deserialize: (e) => T3(e)
914
1058
  }, "LogicalAttributeFilter");
915
1059
  h2.registerCustom({
916
- isApplicable: Nt,
1060
+ isApplicable: Ct,
917
1061
  serialize: (e) => e.serialize(),
918
- deserialize: (e) => T2(e)
1062
+ deserialize: (e) => T3(e)
919
1063
  }, "CascadingFilter");
920
1064
  h2.registerCustom({
921
- isApplicable: fp,
1065
+ isApplicable: vp,
922
1066
  serialize: (e) => e.serialize(),
923
- deserialize: (e) => T2(e)
1067
+ deserialize: (e) => T3(e)
924
1068
  }, "ExcludeFilter");
925
1069
  h2.registerCustom({
926
- isApplicable: lp,
1070
+ isApplicable: Sp,
927
1071
  serialize: (e) => e.serialize(),
928
- deserialize: (e) => T2(e)
1072
+ deserialize: (e) => T3(e)
929
1073
  }, "MeasureFilter");
930
1074
  h2.registerCustom({
931
- isApplicable: up,
1075
+ isApplicable: bp,
932
1076
  serialize: (e) => e.serialize(),
933
- deserialize: (e) => T2(e)
1077
+ deserialize: (e) => T3(e)
934
1078
  }, "RankingFilter");
935
1079
  h2.registerCustom({
936
- isApplicable: cp,
1080
+ isApplicable: yp,
937
1081
  serialize: (e) => e.serialize(),
938
- deserialize: (e) => T2(e)
1082
+ deserialize: (e) => T3(e)
939
1083
  }, "MeasureRankingFilter");
940
1084
  h2.registerCustom({
941
- isApplicable: op,
1085
+ isApplicable: mp,
942
1086
  serialize: (e) => e.serialize(),
943
- deserialize: (e) => T2(e)
1087
+ deserialize: (e) => T3(e)
944
1088
  }, "NumericFilter");
945
1089
  h2.registerCustom({
946
- isApplicable: hp,
1090
+ isApplicable: Ep,
947
1091
  serialize: (e) => e.serialize(),
948
- deserialize: (e) => T2(e)
1092
+ deserialize: (e) => T3(e)
949
1093
  }, "TextFilter");
950
1094
  h2.registerCustom({
951
- isApplicable: pp,
1095
+ isApplicable: _p,
952
1096
  serialize: (e) => e.serialize(),
953
- deserialize: (e) => T2(e)
1097
+ deserialize: (e) => T3(e)
954
1098
  }, "DateRangeFilter");
955
1099
  h2.registerCustom({
956
- isApplicable: gp,
1100
+ isApplicable: Tp,
957
1101
  serialize: (e) => e.serialize(),
958
- deserialize: (e) => T2(e)
1102
+ deserialize: (e) => T3(e)
959
1103
  }, "RelativeDateFilter");
960
1104
  h2.registerCustom({
961
- isApplicable: sp,
1105
+ isApplicable: hp,
962
1106
  serialize: (e) => e.serialize(),
963
- deserialize: (e) => T2(e)
1107
+ deserialize: (e) => T3(e)
964
1108
  }, "CustomFilter");
965
- var ni = h2;
966
- var E3 = "DM.";
967
- function S2(e) {
1109
+ var Yn = h2;
1110
+ var E4 = "DM.";
1111
+ function S(e) {
968
1112
  return typeof e == "object" && e !== null;
969
1113
  }
970
1114
  function q3(e) {
971
1115
  return typeof e == "object" && e !== null && "function" in e && "args" in e;
972
1116
  }
973
- function Ct2(e) {
1117
+ function Et(e) {
974
1118
  return e.every(q3);
975
1119
  }
976
- function oe(e) {
1120
+ function ne(e) {
977
1121
  return "attribute" in e && "config" in e;
978
1122
  }
979
1123
  function Z(e) {
980
1124
  return "left" in e && "right" in e && "operator" in e;
981
1125
  }
982
- function xe(e) {
983
- return !oe(e) && !Z(e);
1126
+ function Te(e) {
1127
+ return !ne(e) && !Z(e);
984
1128
  }
985
- function xs(e) {
986
- return S2(e) && "column" in e && typeof e.column == "string" && !(("function" in e) && ("args" in e));
1129
+ function qs(e) {
1130
+ return S(e) && "column" in e && typeof e.column == "string" && !(("function" in e) && ("args" in e));
987
1131
  }
988
- function $s(e) {
989
- return !S2(e) || !("column" in e) ? false : q3(e.column);
1132
+ function xs2(e) {
1133
+ return !S(e) || !("column" in e) ? false : q3(e.column);
990
1134
  }
991
1135
  var x = 3;
992
- function R(e, t, r) {
1136
+ function v(e, t, r) {
993
1137
  if (t.length === 0)
994
1138
  return;
995
1139
  let s = Number.MAX_SAFE_INTEGER, n;
996
1140
  for (const i of t) {
997
- const o = r(i), a = Yr(e, o);
998
- a < s && (s = a, n = i);
1141
+ const a = r(i), o = Gr(e, a);
1142
+ o < s && (s = o, n = i);
999
1143
  }
1000
1144
  return n !== undefined ? { best: n, distance: s } : undefined;
1001
1145
  }
1002
- var Tt = "en";
1003
- function fe(e, t) {
1004
- return e.localeCompare(t, Tt, { sensitivity: "accent" }) === 0;
1146
+ var Ct2 = "en";
1147
+ function le(e, t) {
1148
+ return e.localeCompare(t, Ct2, { sensitivity: "accent" }) === 0;
1005
1149
  }
1006
- function Ye(e, t) {
1007
- return t.length <= e.length && e.slice(0, t.length).localeCompare(t, Tt, { sensitivity: "accent" }) === 0;
1150
+ function Ve(e, t) {
1151
+ return t.length <= e.length && e.slice(0, t.length).localeCompare(t, Ct2, { sensitivity: "accent" }) === 0;
1008
1152
  }
1009
- function $e(e) {
1010
- const t = [...e].sort((i, o) => o.name.length - i.name.length), r = /* @__PURE__ */ new Map, s = /* @__PURE__ */ new Map, n = /* @__PURE__ */ new Map;
1153
+ function qe(e) {
1154
+ const t = [...e].sort((i, a) => a.name.length - i.name.length), r = /* @__PURE__ */ new Map, s = /* @__PURE__ */ new Map, n = /* @__PURE__ */ new Map;
1011
1155
  for (const i of e) {
1012
1156
  r.set(i.name, i);
1013
- const o = [...i.columns].sort((u, c) => c.name.length - u.name.length);
1014
- n.set(i.name, o);
1015
- const a = /* @__PURE__ */ new Map;
1157
+ const a = [...i.columns].sort((u, l) => l.name.length - u.name.length);
1158
+ n.set(i.name, a);
1159
+ const o = /* @__PURE__ */ new Map;
1016
1160
  for (const u of i.columns)
1017
- a.set(u.name, u);
1018
- s.set(i.name, a);
1161
+ o.set(u.name, u);
1162
+ s.set(i.name, o);
1019
1163
  }
1020
1164
  return {
1021
1165
  sortedTables: t,
@@ -1024,138 +1168,138 @@ function $e(e) {
1024
1168
  columnMap: s
1025
1169
  };
1026
1170
  }
1027
- function Se2(e, t) {
1028
- if (!e.startsWith(E3))
1029
- throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E3}TableName.ColumnName[.Level]'`);
1030
- const r = e.slice(E3.length);
1171
+ function xe(e, t) {
1172
+ if (!e.startsWith(E4))
1173
+ throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E4}TableName.ColumnName[.Level]'`);
1174
+ const r = e.slice(E4.length);
1031
1175
  if (!r)
1032
- throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E3}TableName.ColumnName[.Level]'`);
1176
+ throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E4}TableName.ColumnName[.Level]'`);
1033
1177
  let s, n;
1034
1178
  for (const m2 of t.sortedTables)
1035
- if (Ye(r, m2.name + ".")) {
1036
- const A = r.slice(m2.name.length + 1);
1037
- if (!A)
1038
- throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E3}TableName.ColumnName[.Level]'`);
1039
- s = m2, n = A;
1179
+ if (Ve(r, m2.name + ".")) {
1180
+ const F = r.slice(m2.name.length + 1);
1181
+ if (!F)
1182
+ throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E4}TableName.ColumnName[.Level]'`);
1183
+ s = m2, n = F;
1040
1184
  break;
1041
1185
  }
1042
1186
  if (!s) {
1043
1187
  const m2 = r.indexOf(".");
1044
1188
  if (m2 === -1)
1045
- throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E3}TableName.ColumnName[.Level]'`);
1046
- const A = r.slice(0, m2), C2 = R(A, t.sortedTables, (ue) => ue.name), N2 = C2 && C2.distance <= x ? ` Did you mean '${C2.best.name}'?` : "";
1047
- throw new Error(`Table '${A}' not found in the data model.${N2}`);
1189
+ throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E4}TableName.ColumnName[.Level]'`);
1190
+ const F = r.slice(0, m2), C2 = v(F, t.sortedTables, (ae) => ae.name), N3 = C2 && C2.distance <= x ? ` Did you mean '${C2.best.name}'?` : "";
1191
+ throw new Error(`Table '${F}' not found in the data model.${N3}`);
1048
1192
  }
1049
1193
  const i = t.tableColumnMap.get(s.name);
1050
1194
  if (!i)
1051
1195
  throw new Error(`Table '${s.name}' found but has no columns`);
1052
- let o, a;
1196
+ let a, o;
1053
1197
  const u = g.all;
1054
1198
  for (const m2 of i) {
1055
- if (fe(n, m2.name))
1199
+ if (le(n, m2.name))
1056
1200
  return { table: s, column: m2 };
1057
- if (!Ye(n, m2.name + "."))
1201
+ if (!Ve(n, m2.name + "."))
1058
1202
  continue;
1059
- const A = n.slice(m2.name.length + 1);
1060
- if (!A)
1203
+ const F = n.slice(m2.name.length + 1);
1204
+ if (!F)
1061
1205
  continue;
1062
- const C2 = u.includes(A), N2 = Rn(m2.dataType);
1206
+ const C2 = u.includes(F), N3 = Lt(m2.dataType);
1063
1207
  if (C2) {
1064
- if (N2)
1065
- return { table: s, column: m2, level: A };
1066
- o || (o = m2, a = A);
1208
+ if (N3)
1209
+ return { table: s, column: m2, level: F };
1210
+ a || (a = m2, o = F);
1067
1211
  continue;
1068
1212
  }
1069
- N2 && !o && (o = m2, a = A);
1213
+ N3 && !a && (a = m2, o = F);
1070
1214
  }
1071
- if (o && a) {
1072
- if (u.includes(a))
1073
- throw new Error(`Invalid date level '${a}' in dimensional element '${e}'. Column '${s.name}.${o.name}' is not a datetime column`);
1074
- const m2 = R(a, u, (C2) => C2), A = m2 && m2.distance <= x ? ` Did you mean '${m2.best}'?` : "";
1075
- throw new Error(`Invalid date level '${a}' in dimensional element '${e}'. Valid levels are: ${u.join(", ")}.${A}`);
1215
+ if (a && o) {
1216
+ if (u.includes(o))
1217
+ throw new Error(`Invalid date level '${o}' in dimensional element '${e}'. Column '${s.name}.${a.name}' is not a datetime column`);
1218
+ const m2 = v(o, u, (C2) => C2), F = m2 && m2.distance <= x ? ` Did you mean '${m2.best}'?` : "";
1219
+ throw new Error(`Invalid date level '${o}' in dimensional element '${e}'. Valid levels are: ${u.join(", ")}.${F}`);
1076
1220
  }
1077
- const c = n.indexOf("."), p2 = c === -1 ? n : n.slice(0, c), l = R(n, i, (m2) => m2.name), d = l && l.distance <= x && !fe(l.best.name, p2), b2 = d ? ` Did you mean '${l.best.name}'?` : "", g2 = !d && n.endsWith(".") && l !== undefined && fe(l.best.name, p2) ? ` Use '${p2}' without a trailing dot.` : "";
1078
- throw new Error(`Column '${p2}' not found in table '${s.name}'.${b2}${g2}`);
1221
+ const l = n.indexOf("."), p = l === -1 ? n : n.slice(0, l), c = v(n, i, (m2) => m2.name), d = c && c.distance <= x && !le(c.best.name, p), b2 = d ? ` Did you mean '${c.best.name}'?` : "", g3 = !d && n.endsWith(".") && c !== undefined && le(c.best.name, p) ? ` Use '${p}' without a trailing dot.` : "";
1222
+ throw new Error(`Column '${p}' not found in table '${s.name}'.${b2}${g3}`);
1079
1223
  }
1080
- function Ss(e, t) {
1081
- const { table: r, column: s, level: n } = Se2(e, t);
1224
+ function $s(e, t) {
1225
+ const { table: r, column: s, level: n } = xe(e, t);
1082
1226
  if (n) {
1083
- if (!Rn(s.dataType))
1227
+ if (!Lt(s.dataType))
1084
1228
  throw new Error(`Invalid date level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is not a datetime column`);
1085
1229
  const i = g.all;
1086
1230
  if (!i.includes(n))
1087
1231
  throw new Error(`Invalid date level '${n}' in dimensional element '${e}'. Valid levels are: ${i.join(", ")}`);
1088
- const o = g.dateOnly;
1089
- if (s.dataType === "date" && !o.includes(n))
1232
+ const a = g.dateOnly;
1233
+ if (s.dataType === "date" && !a.includes(n))
1090
1234
  throw new Error(`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a date column, not a datetime column`);
1091
- const a = g.timeOnly;
1092
- if (s.dataType === "time" && !a.includes(n))
1235
+ const o = g.timeOnly;
1236
+ if (s.dataType === "time" && !o.includes(n))
1093
1237
  throw new Error(`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a time column, not a date column`);
1094
1238
  }
1095
1239
  return { table: r, column: s, level: n };
1096
1240
  }
1097
- function H(e, t, r, s) {
1098
- const { table: n, column: i, level: o } = Ss(e, r);
1099
- let a = o;
1100
- if (Rn(i.dataType) && a === undefined && (s != null && s.inferredDateLevel)) {
1101
- const u = s.inferredDateLevel, c = g.all;
1102
- if (!c.includes(u))
1103
- throw new Error(`Invalid inferred date level '${u}'. Valid levels are: ${c.join(", ")}`);
1104
- const p2 = `${e}.${u}`, l = g.dateOnly;
1105
- if (i.dataType === "date" && !l.includes(u))
1106
- throw new Error(`Invalid level '${u}' in dimensional element '${p2}'. Column '${n.name}.${i.name}' is only a date column, not a datetime column`);
1241
+ function H2(e, t, r, s) {
1242
+ const { table: n, column: i, level: a } = $s(e, r);
1243
+ let o = a;
1244
+ if (Lt(i.dataType) && o === undefined && (s != null && s.inferredDateLevel)) {
1245
+ const u = s.inferredDateLevel, l = g.all;
1246
+ if (!l.includes(u))
1247
+ throw new Error(`Invalid inferred date level '${u}'. Valid levels are: ${l.join(", ")}`);
1248
+ const p = `${e}.${u}`, c = g.dateOnly;
1249
+ if (i.dataType === "date" && !c.includes(u))
1250
+ throw new Error(`Invalid level '${u}' in dimensional element '${p}'. Column '${n.name}.${i.name}' is only a date column, not a datetime column`);
1107
1251
  const d = g.timeOnly;
1108
1252
  if (i.dataType === "time" && !d.includes(u))
1109
- throw new Error(`Invalid level '${u}' in dimensional element '${p2}'. Column '${n.name}.${i.name}' is only a time column, not a date column`);
1110
- a = u;
1253
+ throw new Error(`Invalid level '${u}' in dimensional element '${p}'. Column '${n.name}.${i.name}' is only a time column, not a date column`);
1254
+ o = u;
1111
1255
  }
1112
- return Ln({
1256
+ return Dn({
1113
1257
  expression: i.expression,
1114
1258
  dataType: i.dataType,
1115
- granularity: a,
1259
+ granularity: o,
1116
1260
  format: undefined,
1117
1261
  sort: undefined,
1118
1262
  dataSource: t
1119
1263
  });
1120
1264
  }
1121
- function Os(e, t, r) {
1122
- const { column: s, level: n } = Se2(e, r);
1265
+ function Ss(e, t, r) {
1266
+ const { column: s, level: n } = xe(e, r);
1123
1267
  if (n)
1124
- throw new Error(`Invalid DateDimension name format: '${e}'. Expected format: '${E3}TableName.ColumnName'`);
1125
- if (!Rn(s.dataType))
1268
+ throw new Error(`Invalid DateDimension name format: '${e}'. Expected format: '${E4}TableName.ColumnName'`);
1269
+ if (!Lt(s.dataType))
1126
1270
  throw new Error(`Invalid DateDimension name '${e}'. Column '${s.name}' is not a datetime column (got ${s.dataType}).`);
1127
- return q({
1271
+ return Q({
1128
1272
  name: s.name,
1129
1273
  expression: s.expression,
1130
1274
  dataSource: t
1131
1275
  });
1132
1276
  }
1133
- var Ds = (e, t) => {
1277
+ var Os = (e, t) => {
1134
1278
  if (!e)
1135
1279
  return;
1136
1280
  const r = typeof e == "object" ? e.direction : e;
1137
- if (!Lp(r))
1138
- return F(y2({}, t), {
1281
+ if (!ws(r))
1282
+ return A(y({}, t), {
1139
1283
  message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${r}'.`
1140
1284
  });
1141
1285
  };
1142
- var Ms = (e, t, r, s) => {
1143
- const n = Ds(e.sortType, s);
1286
+ var Ds = (e, t, r, s) => {
1287
+ const n = Os(e.sortType, s);
1144
1288
  if (n)
1145
1289
  return {
1146
- attribute: H(e.column, t, r),
1290
+ attribute: H2(e.column, t, r),
1147
1291
  style: {},
1148
1292
  error: n
1149
1293
  };
1150
- const i = H(e.column, t, r), o = ed(e, "column");
1151
- return { attribute: i, style: o };
1294
+ const i = H2(e.column, t, r), a = od(e, "column");
1295
+ return { attribute: i, style: a };
1152
1296
  };
1153
- var Ns = (e, t, r, s) => typeof e == "string" ? { attribute: H(e, t, r) } : xs(e) ? Ms(e, t, r, s) : {
1154
- error: F(y2({}, s), {
1297
+ var Ms = (e, t, r, s) => typeof e == "string" ? { attribute: H2(e, t, r) } : qs(e) ? Ds(e, t, r, s) : {
1298
+ error: A(y({}, s), {
1155
1299
  message: "Invalid dimension item. Expected a string (composeCode) or object with 'column' and optional 'sortType'."
1156
1300
  })
1157
1301
  };
1158
- var qt = (e) => {
1302
+ var Tt = (e) => {
1159
1303
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
1160
1304
  if (!t)
1161
1305
  return { success: true, data: [] };
@@ -1172,61 +1316,61 @@ var qt = (e) => {
1172
1316
  ]
1173
1317
  };
1174
1318
  const n = [], i = [];
1175
- return t.forEach((o, a) => {
1319
+ return t.forEach((a, o) => {
1176
1320
  const u = {
1177
1321
  category: "dimensions",
1178
- index: a,
1179
- input: o
1322
+ index: o,
1323
+ input: a
1180
1324
  };
1181
1325
  try {
1182
- const c = Ns(o, r, s, u);
1183
- if (c.error) {
1184
- i.push(c.error);
1326
+ const l = Ms(a, r, s, u);
1327
+ if (l.error) {
1328
+ i.push(l.error);
1185
1329
  return;
1186
1330
  }
1187
- c.attribute && n.push(c.style !== undefined ? { attribute: c.attribute, style: c.style } : { attribute: c.attribute });
1188
- } catch (c) {
1189
- const p2 = c instanceof Error ? c.message : "Unknown error";
1190
- i.push(F(y2({}, u), { message: p2 }));
1331
+ l.attribute && n.push(l.style !== undefined ? { attribute: l.attribute, style: l.style } : { attribute: l.attribute });
1332
+ } catch (l) {
1333
+ const p = l instanceof Error ? l.message : "Unknown error";
1334
+ i.push(A(y({}, u), { message: p }));
1191
1335
  }
1192
1336
  }), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
1193
1337
  };
1194
- function Oe2(e, t) {
1338
+ function $e(e, t) {
1195
1339
  const r = Reflect.get(e, t);
1196
1340
  if (typeof r != "function")
1197
1341
  throw new Error(`Function '${t}' not found or is not a function`);
1198
1342
  return r;
1199
1343
  }
1200
- function Rs(e, t) {
1201
- const r = e.replace("measureFactory.", ""), n = Oe2(rp, r)(...t);
1202
- if (!xe(n))
1344
+ function Ns(e, t) {
1345
+ const r = e.replace("measureFactory.", ""), n = $e(dp, r)(...t);
1346
+ if (!Te(n))
1203
1347
  throw new Error(`Function '${e}' did not return a valid Measure`);
1204
1348
  return n;
1205
1349
  }
1206
- function vs2(e, t) {
1207
- const r = e.replace("filterFactory.logic.", ""), n = Oe2(Se, r)(...t);
1350
+ function vs(e, t) {
1351
+ const r = e.replace("filterFactory.logic.", ""), n = $e(Se, r)(...t);
1208
1352
  if (!Z(n))
1209
1353
  throw new Error(`Function '${e}' did not return a valid FilterRelations`);
1210
1354
  return n;
1211
1355
  }
1212
- function Is(e, t) {
1356
+ function Rs(e, t) {
1213
1357
  if (e.startsWith("filterFactory.logic."))
1214
- return vs2(e, t);
1215
- const r = e.replace("filterFactory.", ""), n = Oe2(mp, r)(...t);
1216
- if (!oe(n) && !Z(n))
1358
+ return vs(e, t);
1359
+ const r = e.replace("filterFactory.", ""), n = $e(Op, r)(...t);
1360
+ if (!ne(n) && !Z(n))
1217
1361
  throw new Error(`Function '${e}' did not return a valid Filter or FilterRelations`);
1218
1362
  return n;
1219
1363
  }
1220
- function Ps(e, t) {
1364
+ function Is(e, t) {
1221
1365
  const s = e.split(".")[0];
1222
1366
  if (s === "measureFactory")
1223
- return Rs(e, t);
1367
+ return Ns(e, t);
1224
1368
  if (s === "filterFactory")
1225
- return Is(e, t);
1369
+ return Rs(e, t);
1226
1370
  throw new Error(`Unsupported factory: '${s}'. Supported factories: measureFactory, filterFactory`);
1227
1371
  }
1228
- var f2 = (e, t, r, s) => y2({ category: e, minArgs: t, maxArgs: r }, s);
1229
- var ks = /* @__PURE__ */ new Set([
1372
+ var f2 = (e, t, r, s) => y({ category: e, minArgs: t, maxArgs: r }, s);
1373
+ var Ps = /* @__PURE__ */ new Set([
1230
1374
  "CORREL",
1231
1375
  "COVARP",
1232
1376
  "COVAR",
@@ -1353,164 +1497,19 @@ var te = {
1353
1497
  SQRT: f2("scalar", 1, 1),
1354
1498
  TAN: f2("scalar", 1, 1)
1355
1499
  };
1356
- var Bs = Object.keys(te).filter((e) => te[e].category === "xdiff");
1357
- function xt() {
1358
- return Bs;
1500
+ var ks = Object.keys(te).filter((e) => te[e].category === "xdiff");
1501
+ function qt() {
1502
+ return ks;
1359
1503
  }
1360
- function $t(e) {
1504
+ function xt(e) {
1361
1505
  const t = te[e.toUpperCase()];
1362
1506
  return t == null ? undefined : t.requiredDateLevel;
1363
1507
  }
1364
- function zs(e, t) {
1508
+ function Bs(e, t) {
1365
1509
  return e === t ? e === 1 ? "1 parameter" : `${e} parameters` : t === Number.POSITIVE_INFINITY ? e <= 1 ? "any number of parameters" : `at least ${e} parameters` : `${e} or ${t} parameters`;
1366
1510
  }
1367
- function De(e, t) {
1368
- const r = [];
1369
- let s = "", n = 0, i = false, o = null;
1370
- for (let a = 0;a < e.length; a++) {
1371
- const u = e[a], c = e[a + 1];
1372
- if (i) {
1373
- if (u !== o) {
1374
- s += u;
1375
- continue;
1376
- }
1377
- if (c === o) {
1378
- s += u + c, a++;
1379
- continue;
1380
- }
1381
- i = false, o = null, s += u;
1382
- continue;
1383
- } else {
1384
- if (u === "'" || u === '"') {
1385
- i = true, o = u, s += u;
1386
- continue;
1387
- }
1388
- if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === t && n === 0) {
1389
- r.push(s.trim()), s = "";
1390
- continue;
1391
- }
1392
- }
1393
- s += u;
1394
- }
1395
- return s.trim() && r.push(s.trim()), r;
1396
- }
1397
- function Ls(e, t) {
1398
- let r = 0, s = false, n = null;
1399
- for (let i = 0;i < e.length; i++) {
1400
- const o = e[i], a = e[i + 1];
1401
- if (s) {
1402
- if (o !== n)
1403
- continue;
1404
- if (a === n) {
1405
- i++;
1406
- continue;
1407
- }
1408
- s = false, n = null;
1409
- } else {
1410
- if (o === "'" || o === '"') {
1411
- s = true, n = o;
1412
- continue;
1413
- }
1414
- if ("([{".includes(o) && r++, ")]}".includes(o) && r--, o === t && r === 0)
1415
- return i;
1416
- }
1417
- }
1418
- return -1;
1419
- }
1420
- function Us(e, t) {
1421
- if (e[t] !== "(")
1422
- return -1;
1423
- let r = 1, s = t + 1, n = false, i = null;
1424
- for (;s < e.length; ) {
1425
- const o = e[s], a = e[s + 1];
1426
- if (n) {
1427
- if (o !== i) {
1428
- s++;
1429
- continue;
1430
- }
1431
- if (a === i) {
1432
- s += 2;
1433
- continue;
1434
- }
1435
- n = false, i = null, s++;
1436
- } else {
1437
- if (o === "'" || o === '"') {
1438
- n = true, i = o, s++;
1439
- continue;
1440
- }
1441
- if ("([{".includes(o) && r++, ")]}".includes(o) && --r === 0)
1442
- return s;
1443
- s++;
1444
- }
1445
- }
1446
- return -1;
1447
- }
1448
- function _s(e) {
1449
- return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
1450
- }
1451
- function W(e) {
1452
- if (!e || typeof e != "string")
1453
- throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof e}`);
1454
- const t = e.trim();
1455
- if (!t)
1456
- throw new Error("Invalid composeCode: empty string");
1457
- const r = t.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
1458
- if (!r)
1459
- throw new Error(`Invalid composeCode format: expected function call, got '${t}'`);
1460
- const s = r[1], n = r[2], i = St(n);
1461
- return {
1462
- function: s,
1463
- args: i
1464
- };
1465
- }
1466
- function St(e) {
1467
- return e.trim() ? De(e, ",").map(Ot) : [];
1468
- }
1469
- function Ot(e) {
1470
- if (!e)
1471
- throw new Error("Cannot parse empty argument value");
1472
- if (e === "null")
1473
- return null;
1474
- if (e === "undefined")
1475
- return;
1476
- if (e === "true")
1477
- return true;
1478
- if (e === "false")
1479
- return false;
1480
- if (e.match(/^-?\d+(\.\d+)?$/))
1481
- return parseFloat(e);
1482
- if (e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"')) {
1483
- const r = e[0];
1484
- return e.slice(1, -1).replace(new RegExp(`${r}${r}`, "g"), r);
1485
- }
1486
- if (e.startsWith("[") && e.endsWith("]")) {
1487
- const r = e.slice(1, -1).trim();
1488
- if (!r)
1489
- return [];
1490
- const s = St(r);
1491
- return s.every((n) => typeof n == "string"), s;
1492
- }
1493
- if (e.startsWith("{") && e.endsWith("}")) {
1494
- const r = e.slice(1, -1).trim();
1495
- return r ? Ws(r) : {};
1496
- }
1497
- return e.includes("(") && e.includes(")") ? W(e) : (e.startsWith("DM."), e);
1498
- }
1499
- function Vs(e) {
1500
- const t = Ls(e, ":");
1501
- if (t === -1)
1502
- throw new Error(`Invalid object property: expected 'key: value', got '${e}'`);
1503
- const r = _s(e.slice(0, t).trim()), s = Ot(e.slice(t + 1).trim());
1504
- return [r, s];
1505
- }
1506
- function Ws(e) {
1507
- if (!e.trim())
1508
- return {};
1509
- const t = De(e, ",").map(Vs).filter(([, r]) => r !== null);
1510
- return Object.fromEntries(t);
1511
- }
1512
- var js = /\[(\w[\w.-]*)\]/g;
1513
- var Dt = /* @__PURE__ */ new Set([
1511
+ var zs = /\[(\w[\w.-]*)\]/g;
1512
+ var $t = /* @__PURE__ */ new Set([
1514
1513
  "AVG",
1515
1514
  "COUNT",
1516
1515
  "DUPCOUNT",
@@ -1528,28 +1527,28 @@ var Dt = /* @__PURE__ */ new Set([
1528
1527
  "YTDAVG",
1529
1528
  "YTDSUM"
1530
1529
  ]);
1531
- var Ks = new RegExp(`\\b(${Array.from(Dt).join("|")})\\s*\\(`, "i");
1532
- function Mt(e) {
1533
- return q3(e) ? true : typeof e == "string" && e.startsWith(E3) ? false : S2(e) && ("kind" in e) ? e.kind === "measure" : true;
1530
+ var Ls = new RegExp(`\\b(${Array.from($t).join("|")})\\s*\\(`, "i");
1531
+ function St(e) {
1532
+ return q3(e) ? true : typeof e == "string" && e.startsWith(E4) ? false : S(e) && ("kind" in e) ? e.kind === "measure" : true;
1534
1533
  }
1535
- function Gs(e) {
1534
+ function Us(e) {
1536
1535
  const t = /\b(\w+)\s*\(/g, r = /* @__PURE__ */ new Set;
1537
1536
  let s;
1538
1537
  for (;(s = t.exec(e)) !== null; ) {
1539
1538
  const n = s[1];
1540
- Dt.has(n.toUpperCase()) || r.add(n);
1539
+ $t.has(n.toUpperCase()) || r.add(n);
1541
1540
  }
1542
1541
  return Array.from(r);
1543
1542
  }
1544
- function Ys(e) {
1543
+ function _s2(e) {
1545
1544
  return e.length === 1 ? `[${e[0]}]` : e.map((t) => `[${t}]`).join(", ");
1546
1545
  }
1547
- function Js(e) {
1546
+ function Vs(e) {
1548
1547
  return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
1549
1548
  }
1550
1549
  var j2 = (e) => e.startsWith("[") ? e : `[${e}]`;
1551
- var Nt2 = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
1552
- function Rt(e, t) {
1550
+ var Ot = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
1551
+ function Dt(e, t) {
1553
1552
  if (t.length === 0)
1554
1553
  return [];
1555
1554
  const r = t.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), s = new RegExp(`\\b(${r})\\s*\\(\\s*\\[([^\\]]+)\\]\\s*,\\s*\\[([^\\]]+)\\]\\s*\\)`, "gi");
@@ -1559,16 +1558,16 @@ function Rt(e, t) {
1559
1558
  ref2: n[3].trim()
1560
1559
  }));
1561
1560
  }
1562
- function Hs(e, t, r) {
1563
- var o, a, u;
1564
- const s = Object.keys(t), n = ((o = r.errorPrefix) != null ? o : "customFormula validation").trim(), i = n === "" ? "" : n.endsWith(" ") ? n : `${n} `;
1561
+ function js(e, t, r) {
1562
+ var a, o, u;
1563
+ const s = Object.keys(t), n = ((a = r.errorPrefix) != null ? a : "customFormula validation").trim(), i = n === "" ? "" : n.endsWith(" ") ? n : `${n} `;
1565
1564
  return {
1566
1565
  formula: e,
1567
1566
  context: t,
1568
1567
  contextKeys: s,
1569
1568
  canonicalContextKeys: new Set(s.map(j2)),
1570
1569
  errorPrefix: i,
1571
- warnUnusedContext: (a = r.warnUnusedContext) != null ? a : true,
1570
+ warnUnusedContext: (o = r.warnUnusedContext) != null ? o : true,
1572
1571
  errorOnUnusedContext: (u = r.errorOnUnusedContext) != null ? u : true,
1573
1572
  schemaIndex: r.schemaIndex,
1574
1573
  result: { isValid: true, errors: [], warnings: [], references: [], unusedContextKeys: [] }
@@ -1577,12 +1576,12 @@ function Hs(e, t, r) {
1577
1576
  function M(e, t) {
1578
1577
  e.result.errors.push(t), e.result.isValid = false;
1579
1578
  }
1580
- var Qs = /* @__PURE__ */ new Set(["CASE", "WHEN", "THEN", "ELSE", "END", "AND", "OR"]);
1581
- function Xs(e) {
1582
- const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find((s) => !Qs.has(s[1].toUpperCase()));
1579
+ var Ws2 = /* @__PURE__ */ new Set(["CASE", "WHEN", "THEN", "ELSE", "END", "AND", "OR"]);
1580
+ function Ks(e) {
1581
+ const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find((s) => !Ws2.has(s[1].toUpperCase()));
1583
1582
  r && M(e, `${e.errorPrefix}args[1]: Invalid syntax: '${r[1]}' - operator cannot be used before bracket reference without parentheses`);
1584
1583
  }
1585
- function Zs(e, t) {
1584
+ function Gs2(e, t) {
1586
1585
  const r = e[t];
1587
1586
  let s = t + 1;
1588
1587
  for (;s < e.length; ) {
@@ -1599,27 +1598,27 @@ function Zs(e, t) {
1599
1598
  }
1600
1599
  return e.length;
1601
1600
  }
1602
- function en(e) {
1603
- return De(e, ",").filter((t) => t.trim().length > 0).length;
1601
+ function Ys(e) {
1602
+ return T(e, ",").filter((t) => t.trim().length > 0).length;
1604
1603
  }
1605
- function tn(e, t, r, s) {
1604
+ function Js(e, t, r, s) {
1606
1605
  for (;t < e.length && /\s/.test(e[t]); )
1607
1606
  t++;
1608
1607
  if (e[t] !== "(")
1609
1608
  return t;
1610
- const n = t, i = Us(e, n);
1609
+ const n = t, i = Y(e, n);
1611
1610
  if (i === -1)
1612
1611
  return n + 1;
1613
- const o = e.slice(n + 1, i);
1614
- return s.push({ name: r.toUpperCase(), argCount: en(o) }), s.push(...vt(o)), i + 1;
1612
+ const a = e.slice(n + 1, i);
1613
+ return s.push({ name: r.toUpperCase(), argCount: Ys(a) }), s.push(...Mt(a)), i + 1;
1615
1614
  }
1616
- function vt(e) {
1615
+ function Mt(e) {
1617
1616
  const t = [];
1618
1617
  let r = 0;
1619
1618
  for (;r < e.length; ) {
1620
1619
  const s = e[r];
1621
1620
  if (s === "'" || s === '"') {
1622
- r = Zs(e, r);
1621
+ r = Gs2(e, r);
1623
1622
  continue;
1624
1623
  }
1625
1624
  if (/[A-Za-z_]/.test(s)) {
@@ -1627,203 +1626,203 @@ function vt(e) {
1627
1626
  for (r++;r < e.length && /[A-Za-z0-9_]/.test(e[r]); )
1628
1627
  r++;
1629
1628
  const i = e.slice(n, r);
1630
- r = tn(e, r, i, t);
1629
+ r = Js(e, r, i, t);
1631
1630
  continue;
1632
1631
  }
1633
1632
  r++;
1634
1633
  }
1635
1634
  return t;
1636
1635
  }
1637
- function rn(e) {
1638
- const t = vt(e.formula), r = /* @__PURE__ */ new Set, s = /* @__PURE__ */ new Set;
1636
+ function Hs(e) {
1637
+ const t = Mt(e.formula), r = /* @__PURE__ */ new Set, s = /* @__PURE__ */ new Set;
1639
1638
  for (const { name: n, argCount: i } of t) {
1640
- if (ks.has(n)) {
1639
+ if (Ps.has(n)) {
1641
1640
  r.has(n) || (r.add(n), M(e, `${e.errorPrefix}args[1]: Function ${n} is not supported in custom formulas`));
1642
1641
  continue;
1643
1642
  }
1644
- const o = te[n];
1645
- if (o && (i < o.minArgs || i > o.maxArgs) && !s.has(n)) {
1643
+ const a = te[n];
1644
+ if (a && (i < a.minArgs || i > a.maxArgs) && !s.has(n)) {
1646
1645
  s.add(n);
1647
- const a = zs(o.minArgs, o.maxArgs);
1648
- M(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${a}`);
1646
+ const o = Bs(a.minArgs, a.maxArgs);
1647
+ M(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${o}`);
1649
1648
  }
1650
1649
  }
1651
1650
  }
1652
- function sn(e) {
1651
+ function Qs(e) {
1653
1652
  return [
1654
- ...new Set([...e.matchAll(new RegExp(js.source, "g"))].map((t) => t[1]))
1653
+ ...new Set([...e.matchAll(new RegExp(zs.source, "g"))].map((t) => t[1]))
1655
1654
  ];
1656
1655
  }
1657
- function nn(e) {
1656
+ function Xs(e) {
1658
1657
  const t = e.result.references.filter((n) => !e.canonicalContextKeys.has(j2(n)));
1659
1658
  if (t.length === 0)
1660
1659
  return;
1661
- const r = e.contextKeys.map((n) => `[${Nt2(n)}]`).join(", "), s = t.length === 1 ? `Reference [${t[0]}]` : `References [${t.join("], [")}]`;
1660
+ const r = e.contextKeys.map((n) => `[${Ot(n)}]`).join(", "), s = t.length === 1 ? `Reference [${t[0]}]` : `References [${t.join("], [")}]`;
1662
1661
  M(e, `${e.errorPrefix}args[1]: ${s} not found in context. Available keys: ${r}`);
1663
1662
  }
1664
- function on(e) {
1665
- if (Ks.test(e.formula))
1663
+ function Zs(e) {
1664
+ if (Ls.test(e.formula))
1666
1665
  return;
1667
1666
  const t = e.result.references.filter((r) => {
1668
1667
  var n;
1669
1668
  const s = (n = e.context[j2(r)]) != null ? n : e.context[r];
1670
- return s !== undefined && !Mt(s);
1669
+ return s !== undefined && !St(s);
1671
1670
  });
1672
- t.length !== 0 && M(e, `${e.errorPrefix}args[1]: ${Js(Gs(e.formula))}Bracket reference(s) ${Ys(t)} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`);
1671
+ t.length !== 0 && M(e, `${e.errorPrefix}args[1]: ${Vs(Us(e.formula))}Bracket reference(s) ${_s2(t)} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`);
1673
1672
  }
1674
- function an(e) {
1673
+ function en(e) {
1675
1674
  if (!e.warnUnusedContext && !e.errorOnUnusedContext || e.contextKeys.length === 0)
1676
1675
  return;
1677
1676
  const t = new Set(e.result.references.map(j2)), r = e.contextKeys.filter((i) => !t.has(j2(i)));
1678
1677
  if (e.result.unusedContextKeys = r, r.length === 0)
1679
1678
  return;
1680
- const s = r.map((i) => `[${Nt2(i)}]`).join(", "), n = `${e.errorPrefix}args[2]: Context keys ${s} are defined but not used in formula`;
1679
+ const s = r.map((i) => `[${Ot(i)}]`).join(", "), n = `${e.errorPrefix}args[2]: Context keys ${s} are defined but not used in formula`;
1681
1680
  e.errorOnUnusedContext ? M(e, n) : e.warnUnusedContext && e.result.warnings.push(n);
1682
1681
  }
1683
- function Je(e, t, r, s) {
1684
- var o;
1685
- const n = (o = s.context[j2(e)]) != null ? o : s.context[e];
1682
+ function je(e, t, r, s) {
1683
+ var a;
1684
+ const n = (a = s.context[j2(e)]) != null ? a : s.context[e];
1686
1685
  if (n === undefined)
1687
1686
  return;
1688
- if (!(typeof n == "string" && n.startsWith(E3))) {
1689
- Mt(n) && M(s, `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${E3}Table.Column.Level).`);
1687
+ if (!(typeof n == "string" && n.startsWith(E4))) {
1688
+ St(n) && M(s, `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${E4}Table.Column.Level).`);
1690
1689
  return;
1691
1690
  }
1692
1691
  if (s.schemaIndex)
1693
1692
  try {
1694
- const a = Se2(n, s.schemaIndex);
1695
- Rn(a.column.dataType) ? r && a.level && a.level !== r && M(s, `${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${a.level}'.`) : M(s, `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${a.column.name}'.`);
1696
- } catch (a) {
1697
- const u = a instanceof Error ? a.message : "Unknown error";
1693
+ const o = xe(n, s.schemaIndex);
1694
+ Lt(o.column.dataType) ? r && o.level && o.level !== r && M(s, `${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${o.level}'.`) : M(s, `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${o.column.name}'.`);
1695
+ } catch (o) {
1696
+ const u = o instanceof Error ? o.message : "Unknown error";
1698
1697
  M(s, `${s.errorPrefix}args[1]: ${t.functionName} reference [${e}]: ${u}`);
1699
1698
  }
1700
1699
  }
1701
- function un(e) {
1702
- const t = xt(), r = Rt(e.formula, t);
1700
+ function tn(e) {
1701
+ const t = qt(), r = Dt(e.formula, t);
1703
1702
  for (const s of r) {
1704
- const n = $t(s.functionName);
1705
- Je(s.ref1, s, n, e), Je(s.ref2, s, n, e);
1703
+ const n = xt(s.functionName);
1704
+ je(s.ref1, s, n, e), je(s.ref2, s, n, e);
1706
1705
  }
1707
1706
  }
1708
- function cn(e, t, r = {}) {
1707
+ function rn(e, t, r = {}) {
1709
1708
  var n;
1710
- const s = Hs(e, t, r);
1711
- return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || M(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (Xs(s), rn(s), s.result.references = sn(e), s.result.references.length === 0 ? (s.result.warnings.push(`${s.errorPrefix}args[1]: No bracket references found in formula - ensure this is intentional`), s.result) : s.contextKeys.length === 0 ? (M(s, `${s.errorPrefix}args[2]: Context cannot be empty - custom formulas require context definitions`), s.result) : (nn(s), on(s), an(s), un(s), s.result));
1709
+ const s = js(e, t, r);
1710
+ return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || M(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (Ks(s), Hs(s), s.result.references = Qs(e), s.result.references.length === 0 ? (s.result.warnings.push(`${s.errorPrefix}args[1]: No bracket references found in formula - ensure this is intentional`), s.result) : s.contextKeys.length === 0 ? (M(s, `${s.errorPrefix}args[2]: Context cannot be empty - custom formulas require context definitions`), s.result) : (Xs(s), Zs(s), en(s), tn(s), s.result));
1712
1711
  }
1713
- function ln(e, t, r = {}) {
1714
- const s = cn(e, t, r);
1712
+ function sn(e, t, r = {}) {
1713
+ const s = rn(e, t, r);
1715
1714
  if (!s.isValid)
1716
1715
  throw new Error(s.errors.join("; "));
1717
1716
  s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
1718
1717
  }
1719
- function fn(e, t) {
1718
+ function nn2(e, t) {
1720
1719
  if (e.length < 3 || e.length > 5)
1721
1720
  throw new Error(`${t.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`);
1722
1721
  const r = e[1];
1723
1722
  if (typeof r != "string")
1724
1723
  throw new Error(`${t.pathPrefix}args[1]: Expected formula string, got ${typeof r}`);
1725
1724
  const s = r, n = e[2];
1726
- if (!S2(n))
1725
+ if (!S(n))
1727
1726
  throw new Error(`${t.pathPrefix}args[2]: Expected context object, got ${n === null ? "null" : typeof n}`);
1728
1727
  const i = n;
1729
- ln(s, i, {
1728
+ sn(s, i, {
1730
1729
  errorPrefix: `${t.pathPrefix}`,
1731
1730
  errorOnUnusedContext: true,
1732
1731
  allowEmptyFormula: false,
1733
1732
  schemaIndex: t.schemaIndex
1734
1733
  });
1735
- const o = dn(s), a = {};
1736
- for (const [u, c] of Object.entries(i)) {
1737
- const p2 = `args[2].${u}`;
1738
- if (q3(c))
1739
- a[`${u}`] = D({
1740
- data: c,
1734
+ const a = an(s), o = {};
1735
+ for (const [u, l] of Object.entries(i)) {
1736
+ const p = `args[2].${u}`;
1737
+ if (q3(l))
1738
+ o[`${u}`] = D2({
1739
+ data: l,
1741
1740
  context: {
1742
1741
  dataSource: t.dataSource,
1743
1742
  schemaIndex: t.schemaIndex,
1744
- pathPrefix: p2
1743
+ pathPrefix: p
1745
1744
  }
1746
1745
  });
1747
- else if (typeof c == "string" && c.startsWith(E3)) {
1748
- const l = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u, d = o[l];
1746
+ else if (typeof l == "string" && l.startsWith(E4)) {
1747
+ const c = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u, d = a[c];
1749
1748
  try {
1750
- a[`${u}`] = H(c, t.dataSource, t.schemaIndex, d !== undefined ? { inferredDateLevel: d } : undefined);
1749
+ o[`${u}`] = H2(l, t.dataSource, t.schemaIndex, d !== undefined ? { inferredDateLevel: d } : undefined);
1751
1750
  } catch (b2) {
1752
- const g2 = b2 instanceof Error ? b2.message : "Unknown error";
1753
- throw new Error(`${p2}: ${g2}`);
1751
+ const g3 = b2 instanceof Error ? b2.message : "Unknown error";
1752
+ throw new Error(`${p}: ${g3}`);
1754
1753
  }
1755
- } else if (c && typeof c == "object" && "kind" in c)
1756
- a[`${u}`] = c;
1754
+ } else if (l && typeof l == "object" && "kind" in l)
1755
+ o[`${u}`] = l;
1757
1756
  else
1758
- throw new Error(`${p2}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${E3}...), but got: ${typeof c}`);
1757
+ throw new Error(`${p}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${E4}...), but got: ${typeof l}`);
1759
1758
  }
1760
- e[2] = a;
1759
+ e[2] = o;
1761
1760
  }
1762
- function dn(e) {
1763
- const t = xt(), r = Rt(e, t), s = {};
1761
+ function an(e) {
1762
+ const t = qt(), r = Dt(e, t), s = {};
1764
1763
  for (const n of r) {
1765
- const i = $t(n.functionName);
1764
+ const i = xt(n.functionName);
1766
1765
  if (i !== undefined)
1767
- for (const o of [n.ref1, n.ref2]) {
1768
- const a = s[o];
1769
- if (a !== undefined && a !== i)
1770
- throw new Error(`Reference [${o}] is used in xdiff functions with conflicting date levels ('${a}' and '${i}'). Specify the date level in the context (e.g. DM.Table.Column.${i}).`);
1771
- s[o] = i;
1766
+ for (const a of [n.ref1, n.ref2]) {
1767
+ const o = s[a];
1768
+ if (o !== undefined && o !== i)
1769
+ throw new Error(`Reference [${a}] is used in xdiff functions with conflicting date levels ('${o}' and '${i}'). Specify the date level in the context (e.g. DM.Table.Column.${i}).`);
1770
+ s[a] = i;
1772
1771
  }
1773
1772
  }
1774
1773
  return s;
1775
1774
  }
1776
- function It(e) {
1775
+ function Nt(e) {
1777
1776
  return e.type === E.TextAttribute;
1778
1777
  }
1779
- function Pt(e) {
1778
+ function vt(e) {
1780
1779
  return e.type === E.NumericAttribute;
1781
1780
  }
1782
- function mn(e) {
1781
+ function on(e) {
1783
1782
  return e.type === E.DateLevel;
1784
1783
  }
1785
- function pn(e) {
1786
- return It(e) || Pt(e);
1784
+ function un(e) {
1785
+ return Nt(e) || vt(e);
1787
1786
  }
1788
- function ae(e) {
1787
+ function ie(e) {
1789
1788
  return e.type === E.TextAttribute ? "text" : e.type === E.NumericAttribute ? "numeric" : e.type === E.DateLevel ? "date/datetime" : "unknown";
1790
1789
  }
1791
- function Me(e, t) {
1790
+ function Se2(e, t) {
1792
1791
  const r = e[0];
1793
1792
  if (!r || typeof r != "object" || !("type" in r))
1794
1793
  throw new Error(`${t.pathPrefix}args[0]: Expected attribute as first argument`);
1795
1794
  return r;
1796
1795
  }
1797
- function He(e, t) {
1798
- const r = Me(e, t);
1799
- if (!pn(r))
1800
- throw new Error(`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${ae(r)} attribute`);
1796
+ function We(e, t) {
1797
+ const r = Se2(e, t);
1798
+ if (!un(r))
1799
+ throw new Error(`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${ie(r)} attribute`);
1801
1800
  }
1802
1801
  function P(e, t) {
1803
- const r = Me(e, t);
1804
- if (!Pt(r))
1805
- throw new Error(`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${ae(r)} attribute`);
1802
+ const r = Se2(e, t);
1803
+ if (!vt(r))
1804
+ throw new Error(`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${ie(r)} attribute`);
1806
1805
  }
1807
1806
  function k(e, t) {
1808
- const r = Me(e, t);
1809
- if (!It(r))
1810
- throw new Error(`${t.pathPrefix}args[0]: Attribute must be string type, got ${ae(r)} attribute`);
1807
+ const r = Se2(e, t);
1808
+ if (!Nt(r))
1809
+ throw new Error(`${t.pathPrefix}args[0]: Attribute must be string type, got ${ie(r)} attribute`);
1811
1810
  }
1812
- function gn(e, t) {
1811
+ function ln(e, t) {
1813
1812
  const r = e[0];
1814
1813
  if (!r || typeof r != "object" || !("attribute" in r))
1815
1814
  throw new Error(`${t.pathPrefix}args[0]: Expected filter as first argument`);
1816
1815
  return r;
1817
1816
  }
1818
- function yn(e, t) {
1819
- const r = gn(e, t);
1820
- if (!ap(r))
1817
+ function cn(e, t) {
1818
+ const r = ln(e, t);
1819
+ if (!pp(r))
1821
1820
  throw new Error(`${t.pathPrefix}args[0]: exclude filter only accepts members filter, got ${r.__serializable || "unknown"} filter`);
1822
1821
  }
1823
- var hn = {
1824
- "measureFactory.customFormula": fn,
1825
- "filterFactory.equals": He,
1826
- "filterFactory.doesntEqual": He,
1822
+ var fn = {
1823
+ "measureFactory.customFormula": nn2,
1824
+ "filterFactory.equals": We,
1825
+ "filterFactory.doesntEqual": We,
1827
1826
  "filterFactory.greaterThan": P,
1828
1827
  "filterFactory.greaterThanOrEqual": P,
1829
1828
  "filterFactory.lessThan": P,
@@ -1838,12 +1837,12 @@ var hn = {
1838
1837
  "filterFactory.endsWith": k,
1839
1838
  "filterFactory.doesntEndWith": k,
1840
1839
  "filterFactory.like": k,
1841
- "filterFactory.exclude": yn
1840
+ "filterFactory.exclude": cn
1842
1841
  };
1843
- function bn(e) {
1844
- return hn[`${e}`];
1842
+ function dn(e) {
1843
+ return fn[`${e}`];
1845
1844
  }
1846
- var kt = {
1845
+ var Rt2 = {
1847
1846
  "measureFactory.sum": [
1848
1847
  { type: "Attribute", required: true },
1849
1848
  { type: "string", required: false },
@@ -2262,18 +2261,18 @@ var kt = {
2262
2261
  { type: "FilterRelationsNode", required: true }
2263
2262
  ]
2264
2263
  };
2265
- function Ne(e) {
2266
- return kt[`${e}`];
2264
+ function Oe2(e) {
2265
+ return Rt2[`${e}`];
2267
2266
  }
2268
- function An(e) {
2269
- const t = Ne(e);
2267
+ function mn(e) {
2268
+ const t = Oe2(e);
2270
2269
  return t ? t.filter((r) => r.required).length : 0;
2271
2270
  }
2272
- function Fn(e) {
2273
- const t = Ne(e);
2271
+ function pn(e) {
2272
+ const t = Oe2(e);
2274
2273
  return t ? t.length : 0;
2275
2274
  }
2276
- function wn2(e) {
2275
+ function gn(e) {
2277
2276
  if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
2278
2277
  return false;
2279
2278
  const r = Date.parse(e);
@@ -2282,185 +2281,185 @@ function wn2(e) {
2282
2281
  const s = new Date(e);
2283
2282
  return !isNaN(s.getTime());
2284
2283
  }
2285
- function de(e, t, r, s) {
2286
- if (e.startsWith(E3))
2284
+ function ce(e, t, r, s) {
2285
+ if (e.startsWith(E4))
2287
2286
  try {
2288
- return H(e, t, r);
2287
+ return H2(e, t, r);
2289
2288
  } catch (n) {
2290
2289
  const i = n instanceof Error ? n.message : "Unknown error";
2291
2290
  throw new Error(`${s}: ${i}`);
2292
2291
  }
2293
- throw new Error(`${s}: Invalid attribute '${e}'. Expected format: '${E3}TableName.ColumnName[.Level]'`);
2292
+ throw new Error(`${s}: Invalid attribute '${e}'. Expected format: '${E4}TableName.ColumnName[.Level]'`);
2294
2293
  }
2295
- function En(e, t, r, s) {
2296
- if (e.startsWith(E3))
2294
+ function yn(e, t, r, s) {
2295
+ if (e.startsWith(E4))
2297
2296
  try {
2298
- return Os(e, t, r);
2297
+ return Ss(e, t, r);
2299
2298
  } catch (n) {
2300
2299
  const i = n instanceof Error ? n.message : "Unknown error";
2301
2300
  throw new Error(`${s}: ${i}`);
2302
2301
  }
2303
- throw new Error(`${s}: Invalid date dimension string '${e}'. Expected format: '${E3}TableName.ColumnName'`);
2302
+ throw new Error(`${s}: Invalid date dimension string '${e}'. Expected format: '${E4}TableName.ColumnName'`);
2304
2303
  }
2305
- function Cn(e) {
2306
- const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context, o = i;
2304
+ function hn(e) {
2305
+ const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context, a = i;
2307
2306
  if (t === undefined) {
2308
2307
  if (r.required)
2309
- throw new Error(`${o}: Required argument is missing (expected ${r.type})`);
2308
+ throw new Error(`${a}: Required argument is missing (expected ${r.type})`);
2310
2309
  return;
2311
2310
  }
2312
2311
  if (!(t === null && !r.required))
2313
2312
  switch (r.type) {
2314
2313
  case "string":
2315
2314
  if (typeof t != "string")
2316
- throw new Error(`${o}: Expected string, got ${typeof t}`);
2315
+ throw new Error(`${a}: Expected string, got ${typeof t}`);
2317
2316
  return t;
2318
2317
  case "number":
2319
2318
  if (typeof t != "number")
2320
- throw new Error(`${o}: Expected number, got ${typeof t}`);
2319
+ throw new Error(`${a}: Expected number, got ${typeof t}`);
2321
2320
  return t;
2322
2321
  case "boolean":
2323
2322
  if (typeof t != "boolean")
2324
- throw new Error(`${o}: Expected boolean, got ${typeof t}`);
2323
+ throw new Error(`${a}: Expected boolean, got ${typeof t}`);
2325
2324
  return t;
2326
2325
  case "string[]":
2327
2326
  if (!Array.isArray(t))
2328
- throw new Error(`${o}: Expected array of strings, got ${typeof t}. Example: ['value1', 'value2']`);
2329
- if (!t.every((a) => typeof a == "string"))
2330
- throw new Error(`${o}: Expected array of strings, but contains non-string values`);
2327
+ throw new Error(`${a}: Expected array of strings, got ${typeof t}. Example: ['value1', 'value2']`);
2328
+ if (!t.every((o) => typeof o == "string"))
2329
+ throw new Error(`${a}: Expected array of strings, but contains non-string values`);
2331
2330
  return t;
2332
2331
  case "number[]":
2333
2332
  if (!Array.isArray(t))
2334
- throw new Error(`${o}: Expected array of numbers, got ${typeof t}. Example: [10, 20]`);
2335
- if (!t.every((a) => typeof a == "number"))
2336
- throw new Error(`${o}: Expected array of numbers, but contains non-number values`);
2333
+ throw new Error(`${a}: Expected array of numbers, got ${typeof t}. Example: [10, 20]`);
2334
+ if (!t.every((o) => typeof o == "number"))
2335
+ throw new Error(`${a}: Expected array of numbers, but contains non-number values`);
2337
2336
  return t;
2338
2337
  case "Attribute":
2339
2338
  if (typeof t != "string")
2340
- throw new Error(`${o}: Expected attribute string, got ${typeof t}. Example: 'DM.Commerce.Revenue'`);
2341
- return de(t, s, n, o);
2339
+ throw new Error(`${a}: Expected attribute string, got ${typeof t}. Example: 'DM.Commerce.Revenue'`);
2340
+ return ce(t, s, n, a);
2342
2341
  case "Attribute[]":
2343
2342
  if (!Array.isArray(t))
2344
- throw new Error(`${o}: Expected array of attributes, got ${typeof t}. Example: ['DM.Commerce.AgeRange']`);
2345
- return t.map((a, u) => {
2346
- if (typeof a != "string")
2347
- throw new Error(`${o}[${u}]: Expected attribute string, got ${typeof a}`);
2348
- return de(a, s, n, `${o}[${u}]`);
2343
+ throw new Error(`${a}: Expected array of attributes, got ${typeof t}. Example: ['DM.Commerce.AgeRange']`);
2344
+ return t.map((o, u) => {
2345
+ if (typeof o != "string")
2346
+ throw new Error(`${a}[${u}]: Expected attribute string, got ${typeof o}`);
2347
+ return ce(o, s, n, `${a}[${u}]`);
2349
2348
  });
2350
2349
  case "Measure":
2351
2350
  case "BaseMeasure":
2352
2351
  if (!q3(t))
2353
- throw new Error(`${o}: Expected measure function call, got ${typeof t}. Example: {'function': 'measureFactory.sum', 'args': ['DM.Commerce.Revenue']}`);
2354
- return D({
2352
+ throw new Error(`${a}: Expected measure function call, got ${typeof t}. Example: {'function': 'measureFactory.sum', 'args': ['DM.Commerce.Revenue']}`);
2353
+ return D2({
2355
2354
  data: t,
2356
- context: { dataSource: s, schemaIndex: n, pathPrefix: o }
2355
+ context: { dataSource: s, schemaIndex: n, pathPrefix: a }
2357
2356
  });
2358
2357
  case "Measure[]":
2359
2358
  if (!Array.isArray(t))
2360
- throw new Error(`${o}: Expected array of measure function calls, got ${typeof t}`);
2361
- return t.map((a, u) => {
2362
- if (!q3(a))
2363
- throw new Error(`${o}[${u}]: Expected measure function call, got ${typeof a}`);
2364
- return D({
2365
- data: a,
2366
- context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
2359
+ throw new Error(`${a}: Expected array of measure function calls, got ${typeof t}`);
2360
+ return t.map((o, u) => {
2361
+ if (!q3(o))
2362
+ throw new Error(`${a}[${u}]: Expected measure function call, got ${typeof o}`);
2363
+ return D2({
2364
+ data: o,
2365
+ context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
2367
2366
  });
2368
2367
  });
2369
2368
  case "Filter":
2370
2369
  if (!q3(t))
2371
- throw new Error(`${o}: Expected filter function call, got ${typeof t}. Example: {'function': 'filterFactory.contains', 'args': ['DM.Brand.Brand', 'Apple']}`);
2372
- return D({
2370
+ throw new Error(`${a}: Expected filter function call, got ${typeof t}. Example: {'function': 'filterFactory.contains', 'args': ['DM.Brand.Brand', 'Apple']}`);
2371
+ return D2({
2373
2372
  data: t,
2374
- context: { dataSource: s, schemaIndex: n, pathPrefix: o }
2373
+ context: { dataSource: s, schemaIndex: n, pathPrefix: a }
2375
2374
  });
2376
2375
  case "Filter[]":
2377
2376
  if (!Array.isArray(t))
2378
- throw new Error(`${o}: Expected array of filter function calls, got ${typeof t}`);
2379
- return t.map((a, u) => {
2380
- if (!q3(a))
2381
- throw new Error(`${o}[${u}]: Expected filter function call, got ${typeof a}`);
2382
- return D({
2383
- data: a,
2384
- context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
2377
+ throw new Error(`${a}: Expected array of filter function calls, got ${typeof t}`);
2378
+ return t.map((o, u) => {
2379
+ if (!q3(o))
2380
+ throw new Error(`${a}[${u}]: Expected filter function call, got ${typeof o}`);
2381
+ return D2({
2382
+ data: o,
2383
+ context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
2385
2384
  });
2386
2385
  });
2387
2386
  case "FilterRelationsNode":
2388
2387
  if (Array.isArray(t))
2389
- return t.map((a, u) => {
2390
- if (!q3(a))
2391
- throw new Error(`${o}[${u}]: Expected filter function call, got ${typeof a}`);
2392
- return D({
2393
- data: a,
2394
- context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
2388
+ return t.map((o, u) => {
2389
+ if (!q3(o))
2390
+ throw new Error(`${a}[${u}]: Expected filter function call, got ${typeof o}`);
2391
+ return D2({
2392
+ data: o,
2393
+ context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
2395
2394
  });
2396
2395
  });
2397
2396
  if (q3(t))
2398
- return D({
2397
+ return D2({
2399
2398
  data: t,
2400
- context: { dataSource: s, schemaIndex: n, pathPrefix: o }
2399
+ context: { dataSource: s, schemaIndex: n, pathPrefix: a }
2401
2400
  });
2402
- throw new Error(`${o}: Expected filter function call or array of filters, got ${typeof t}`);
2401
+ throw new Error(`${a}: Expected filter function call or array of filters, got ${typeof t}`);
2403
2402
  case "DateDimension":
2404
2403
  if (typeof t != "string")
2405
- throw new Error(`${o}: Expected date dimension string, got ${typeof t}. Example: 'DM.Commerce.Date'`);
2406
- return En(t, s, n, o);
2404
+ throw new Error(`${a}: Expected date dimension string, got ${typeof t}. Example: 'DM.Commerce.Date'`);
2405
+ return yn(t, s, n, a);
2407
2406
  case "LevelAttribute": {
2408
2407
  if (typeof t != "string")
2409
- throw new Error(`${o}: Expected date attribute string, got ${typeof t}. Example: 'DM.Commerce.Date.Years'`);
2410
- const a = de(t, s, n, o);
2411
- if (!mn(a))
2412
- throw new Error(`${o}: Attribute must be date/datetime type, got ${ae(a)} attribute`);
2413
- return a;
2408
+ throw new Error(`${a}: Expected date attribute string, got ${typeof t}. Example: 'DM.Commerce.Date.Years'`);
2409
+ const o = ce(t, s, n, a);
2410
+ if (!on(o))
2411
+ throw new Error(`${a}: Attribute must be date/datetime type, got ${ie(o)} attribute`);
2412
+ return o;
2414
2413
  }
2415
2414
  case "Measure | number":
2416
2415
  if (typeof t == "number")
2417
2416
  return t;
2418
2417
  if (q3(t))
2419
- return D({
2418
+ return D2({
2420
2419
  data: t,
2421
- context: { dataSource: s, schemaIndex: n, pathPrefix: o }
2420
+ context: { dataSource: s, schemaIndex: n, pathPrefix: a }
2422
2421
  });
2423
- throw new Error(`${o}: Expected measure function call or number, got ${typeof t}`);
2422
+ throw new Error(`${a}: Expected measure function call or number, got ${typeof t}`);
2424
2423
  case "Date | string":
2425
2424
  if (typeof t == "string") {
2426
- if (wn2(t))
2425
+ if (gn(t))
2427
2426
  return t;
2428
- throw new Error(`${o}: Expected valid ISO date string or Date object, got invalid date string '${t}'`);
2427
+ throw new Error(`${a}: Expected valid ISO date string or Date object, got invalid date string '${t}'`);
2429
2428
  } else {
2430
2429
  if (t instanceof Date)
2431
2430
  return t;
2432
- throw new Error(`${o}: Expected date string or Date object, got ${typeof t}`);
2431
+ throw new Error(`${a}: Expected date string or Date object, got ${typeof t}`);
2433
2432
  }
2434
2433
  case "string | number":
2435
2434
  if (typeof t == "string" || typeof t == "number")
2436
2435
  return t;
2437
- throw new Error(`${o}: Expected string or number, got ${typeof t}`);
2436
+ throw new Error(`${a}: Expected string or number, got ${typeof t}`);
2438
2437
  case "BaseFilterConfig":
2439
2438
  case "MembersFilterConfig":
2440
2439
  case "CustomFormulaContext":
2441
2440
  case "any":
2442
2441
  if (t == null && r.required)
2443
- throw new Error(`${o}: Required argument is null/undefined`);
2442
+ throw new Error(`${a}: Required argument is null/undefined`);
2444
2443
  return t;
2445
2444
  default:
2446
2445
  return t;
2447
2446
  }
2448
2447
  }
2449
- function D(e) {
2450
- const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: o } = t, a = n ? `${n}.` : "", u = Ne(i);
2448
+ function D2(e) {
2449
+ const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: a } = t, o = n ? `${n}.` : "", u = Oe2(i);
2451
2450
  if (!u) {
2452
- const g2 = Object.keys(kt), m2 = R(i, g2, (C2) => C2), A = m2 && m2.distance <= x ? ` Did you mean '${m2.best}'?` : "";
2453
- throw new Error(`${a}function: Unknown function '${i}'.${A}`);
2454
- }
2455
- const c = An(i), p2 = Fn(i);
2456
- if (o.length < c)
2457
- throw new Error(`${a}function: Expected at least ${c} arguments, got ${o.length}`);
2458
- if (o.length > p2)
2459
- throw new Error(`${a}function: Expected at most ${p2} arguments, got ${o.length}`);
2460
- const l = [], d = [];
2461
- for (let g2 = 0;g2 < Math.max(o.length, u.length); g2++) {
2462
- const m2 = u[`${g2}`], A = o[`${g2}`], C2 = a ? `${a}args[${g2}]` : `args[${g2}]`;
2463
- if (A === undefined) {
2451
+ const g3 = Object.keys(Rt2), m2 = v(i, g3, (C2) => C2), F = m2 && m2.distance <= x ? ` Did you mean '${m2.best}'?` : "";
2452
+ throw new Error(`${o}function: Unknown function '${i}'.${F}`);
2453
+ }
2454
+ const l = mn(i), p = pn(i);
2455
+ if (a.length < l)
2456
+ throw new Error(`${o}function: Expected at least ${l} arguments, got ${a.length}`);
2457
+ if (a.length > p)
2458
+ throw new Error(`${o}function: Expected at most ${p} arguments, got ${a.length}`);
2459
+ const c = [], d = [];
2460
+ for (let g3 = 0;g3 < Math.max(a.length, u.length); g3++) {
2461
+ const m2 = u[`${g3}`], F = a[`${g3}`], C2 = o ? `${o}args[${g3}]` : `args[${g3}]`;
2462
+ if (F === undefined) {
2464
2463
  m2 != null && m2.required && d.push(`${C2}: Missing required argument (expected ${m2.type})`);
2465
2464
  continue;
2466
2465
  }
@@ -2469,8 +2468,8 @@ function D(e) {
2469
2468
  continue;
2470
2469
  }
2471
2470
  try {
2472
- const N2 = Cn({
2473
- data: A,
2471
+ const N3 = hn({
2472
+ data: F,
2474
2473
  context: {
2475
2474
  dataSource: r,
2476
2475
  schemaIndex: s,
@@ -2478,67 +2477,67 @@ function D(e) {
2478
2477
  argSchema: m2
2479
2478
  }
2480
2479
  });
2481
- l.push(N2);
2482
- } catch (N2) {
2483
- const ue = N2 instanceof Error ? N2.message : "Unknown error";
2484
- d.push(ue);
2480
+ c.push(N3);
2481
+ } catch (N3) {
2482
+ const ae = N3 instanceof Error ? N3.message : "Unknown error";
2483
+ d.push(ae);
2485
2484
  }
2486
2485
  }
2487
2486
  if (d.length > 0) {
2488
- const g2 = d.join("; ");
2489
- throw new Error(g2);
2487
+ const g3 = d.join("; ");
2488
+ throw new Error(g3);
2490
2489
  }
2491
- const b2 = bn(i);
2490
+ const b2 = dn(i);
2492
2491
  if (b2)
2493
2492
  try {
2494
- b2(l, {
2493
+ b2(c, {
2495
2494
  dataSource: r,
2496
2495
  schemaIndex: s,
2497
- pathPrefix: a
2496
+ pathPrefix: o
2498
2497
  });
2499
- } catch (g2) {
2500
- const m2 = g2 instanceof Error ? g2.message : "Unknown validation error";
2498
+ } catch (g3) {
2499
+ const m2 = g3 instanceof Error ? g3.message : "Unknown validation error";
2501
2500
  throw new Error(m2);
2502
2501
  }
2503
- return Ps(i, l);
2502
+ return Is(i, c);
2504
2503
  }
2505
- function Bt(e) {
2504
+ function It(e) {
2506
2505
  const { attribute: t, config: r } = e;
2507
- if (ap(e) && Rp(t)) {
2508
- const { granularity: s } = t, n = e.members.map((a) => s === "Years" && !isNaN(Number(a)) ? `${a}-01-01T00:00:00` : a), i = Fi(r), o = Object.keys(i).length === 0 ? undefined : i;
2509
- return Ct(t, n, o);
2506
+ if (pp(e) && Fp(t)) {
2507
+ const { granularity: s } = t, n = e.members.map((o) => s === "Years" && !isNaN(Number(o)) ? `${o}-01-01T00:00:00` : o), i = ki(r), a = Object.keys(i).length === 0 ? undefined : i;
2508
+ return Rt(t, n, a);
2510
2509
  }
2511
2510
  return e;
2512
2511
  }
2513
- function Tn(e) {
2512
+ function bn(e) {
2514
2513
  let t = [];
2515
2514
  for (const r of e)
2516
- Z(r) ? t = Mp(r, t) : t = Mp([Bt(r)], t);
2515
+ Z(r) ? t = Up(r, t) : t = Up([It(r)], t);
2517
2516
  return t != null ? t : [];
2518
2517
  }
2519
- var qn = (e) => {
2518
+ var Fn2 = (e) => {
2520
2519
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
2521
- return t.forEach((o, a) => {
2520
+ return t.forEach((a, o) => {
2522
2521
  const u = {
2523
2522
  category: "filters",
2524
- index: a,
2525
- input: o
2523
+ index: o,
2524
+ input: a
2526
2525
  };
2527
2526
  try {
2528
- const c = D({
2529
- data: o,
2527
+ const l = D2({
2528
+ data: a,
2530
2529
  context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
2531
2530
  });
2532
- !Z(c) && !oe(c) ? i.push(F(y2({}, u), { message: "Invalid filter JSON" })) : n.push(c);
2533
- } catch (c) {
2534
- const p2 = c instanceof Error ? c.message : "Unknown error";
2535
- i.push(F(y2({}, u), { message: p2 }));
2531
+ !Z(l) && !ne(l) ? i.push(A(y({}, u), { message: "Invalid filter JSON" })) : n.push(l);
2532
+ } catch (l) {
2533
+ const p = l instanceof Error ? l.message : "Unknown error";
2534
+ i.push(A(y({}, u), { message: p }));
2536
2535
  }
2537
- }), i.length > 0 ? { success: false, errors: i } : { success: true, data: Tn(n) };
2536
+ }), i.length > 0 ? { success: false, errors: i } : { success: true, data: bn(n) };
2538
2537
  };
2539
- var Re = (e) => {
2538
+ var De = (e) => {
2540
2539
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
2541
- return t ? Ct2(t) ? qn({
2540
+ return t ? Et(t) ? Fn2({
2542
2541
  data: t,
2543
2542
  context: { dataSource: r, schemaIndex: s }
2544
2543
  }) : {
@@ -2553,29 +2552,29 @@ var Re = (e) => {
2553
2552
  ]
2554
2553
  } : { success: true, data: [] };
2555
2554
  };
2556
- var xn = (e) => {
2555
+ var An = (e) => {
2557
2556
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
2558
- return t.forEach((o, a) => {
2557
+ return t.forEach((a, o) => {
2559
2558
  const u = {
2560
2559
  category: "highlights",
2561
- index: a,
2562
- input: o
2560
+ index: o,
2561
+ input: a
2563
2562
  };
2564
2563
  try {
2565
- const c = D({
2566
- data: o,
2564
+ const l = D2({
2565
+ data: a,
2567
2566
  context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
2568
2567
  });
2569
- oe(c) ? n.push(Bt(c)) : i.push(F(y2({}, u), { message: "Invalid filter JSON" }));
2570
- } catch (c) {
2571
- const p2 = c instanceof Error ? c.message : "Unknown error";
2572
- i.push(F(y2({}, u), { message: p2 }));
2568
+ ne(l) ? n.push(It(l)) : i.push(A(y({}, u), { message: "Invalid filter JSON" }));
2569
+ } catch (l) {
2570
+ const p = l instanceof Error ? l.message : "Unknown error";
2571
+ i.push(A(y({}, u), { message: p }));
2573
2572
  }
2574
2573
  }), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
2575
2574
  };
2576
- var ve = (e) => {
2575
+ var Me = (e) => {
2577
2576
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
2578
- return t ? Ct2(t) ? xn({
2577
+ return t ? Et(t) ? An({
2579
2578
  data: t,
2580
2579
  context: { dataSource: r, schemaIndex: s }
2581
2580
  }) : {
@@ -2590,63 +2589,63 @@ var ve = (e) => {
2590
2589
  ]
2591
2590
  } : { success: true, data: [] };
2592
2591
  };
2593
- var $n = (e, t) => {
2594
- if (e && !Lp(e))
2595
- return F(y2({}, t), {
2592
+ var wn = (e, t) => {
2593
+ if (e && !ws(e))
2594
+ return A(y({}, t), {
2596
2595
  message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${e}'.`
2597
2596
  });
2598
2597
  };
2599
- var Sn = (e, t, r) => {
2598
+ var En2 = (e, t, r) => {
2600
2599
  const { dataSource: s, schemaIndex: n } = t;
2601
2600
  try {
2602
- const i = D({
2601
+ const i = D2({
2603
2602
  data: e,
2604
2603
  context: { dataSource: s, schemaIndex: n, pathPrefix: "" }
2605
2604
  });
2606
- return xe(i) ? { success: true, data: i } : {
2605
+ return Te(i) ? { success: true, data: i } : {
2607
2606
  success: false,
2608
- errors: [F(y2({}, r), { message: "Invalid measure JSON" })]
2607
+ errors: [A(y({}, r), { message: "Invalid measure JSON" })]
2609
2608
  };
2610
2609
  } catch (i) {
2611
- const o = i instanceof Error ? i.message : "Unknown error";
2610
+ const a = i instanceof Error ? i.message : "Unknown error";
2612
2611
  return {
2613
2612
  success: false,
2614
- errors: [F(y2({}, r), { message: o })]
2613
+ errors: [A(y({}, r), { message: a })]
2615
2614
  };
2616
2615
  }
2617
2616
  };
2618
- var On = (e, t, r, s) => {
2619
- const n = D({
2617
+ var Cn = (e, t, r, s) => {
2618
+ const n = D2({
2620
2619
  data: e.column,
2621
2620
  context: { dataSource: t, schemaIndex: r, pathPrefix: "" }
2622
2621
  });
2623
- if (!xe(n))
2622
+ if (!Te(n))
2624
2623
  return {
2625
2624
  style: {},
2626
- error: F(y2({}, s), { message: "Invalid measure JSON" })
2625
+ error: A(y({}, s), { message: "Invalid measure JSON" })
2627
2626
  };
2628
- const i = $n(e.sortType, s);
2627
+ const i = wn(e.sortType, s);
2629
2628
  if (i) {
2630
- const a = ed(e, "column");
2631
- return { measure: n, style: a, error: i };
2629
+ const o = od(e, "column");
2630
+ return { measure: n, style: o, error: i };
2632
2631
  }
2633
- const o = ed(e, "column");
2634
- return { measure: n, style: o };
2632
+ const a = od(e, "column");
2633
+ return { measure: n, style: a };
2635
2634
  };
2636
- var Dn = (e, t, r, s) => {
2637
- if ($s(e))
2638
- return On(e, t, r, s);
2635
+ var Tn = (e, t, r, s) => {
2636
+ if (xs2(e))
2637
+ return Cn(e, t, r, s);
2639
2638
  if (q3(e)) {
2640
- const n = Sn(e, { dataSource: t, schemaIndex: r }, s);
2639
+ const n = En2(e, { dataSource: t, schemaIndex: r }, s);
2641
2640
  return n.success ? { measure: n.data } : { error: n.errors[0] };
2642
2641
  }
2643
2642
  return {
2644
- error: F(y2({}, s), {
2643
+ error: A(y({}, s), {
2645
2644
  message: "Invalid measure item. Expected a function call (function/args) or object with 'column' and optional 'sortType'."
2646
2645
  })
2647
2646
  };
2648
2647
  };
2649
- var zt = (e) => {
2648
+ var Pt = (e) => {
2650
2649
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
2651
2650
  if (!t)
2652
2651
  return { success: true, data: [] };
@@ -2663,27 +2662,27 @@ var zt = (e) => {
2663
2662
  ]
2664
2663
  };
2665
2664
  const n = [], i = [];
2666
- return t.forEach((o, a) => {
2665
+ return t.forEach((a, o) => {
2667
2666
  const u = {
2668
2667
  category: "measures",
2669
- index: a,
2670
- input: o
2668
+ index: o,
2669
+ input: a
2671
2670
  };
2672
2671
  try {
2673
- const c = Dn(o, r, s, u);
2674
- if (c.error) {
2675
- i.push(c.error);
2672
+ const l = Tn(a, r, s, u);
2673
+ if (l.error) {
2674
+ i.push(l.error);
2676
2675
  return;
2677
2676
  }
2678
- c.measure && n.push(c.style !== undefined ? { measure: c.measure, style: c.style } : { measure: c.measure });
2679
- } catch (c) {
2680
- const p2 = c instanceof Error ? c.message : "Unknown error";
2681
- i.push(F(y2({}, u), { message: p2 }));
2677
+ l.measure && n.push(l.style !== undefined ? { measure: l.measure, style: l.style } : { measure: l.measure });
2678
+ } catch (l) {
2679
+ const p = l instanceof Error ? l.message : "Unknown error";
2680
+ i.push(A(y({}, u), { message: p }));
2682
2681
  }
2683
2682
  }), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
2684
2683
  };
2685
- function Q(e) {
2686
- return typeof e == "string" ? e.replace(/\[\[([^\]]+)\]\]/g, "$1") : Array.isArray(e) ? e.map(Q) : e !== null && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([t, r]) => [t, Q(r)])) : e;
2684
+ function Q2(e) {
2685
+ return typeof e == "string" ? e.replace(/\[\[([^\]]+)\]\]/g, "$1") : Array.isArray(e) ? e.map(Q2) : e !== null && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([t, r]) => [t, Q2(r)])) : e;
2687
2686
  }
2688
2687
  function w(e, t, r) {
2689
2688
  const s = e();
@@ -2693,47 +2692,19 @@ function w(e, t, r) {
2693
2692
  }
2694
2693
  return s.data;
2695
2694
  }
2696
- var Ie = "$trend";
2697
- var Pe = "$forecast";
2698
- function Mn(e) {
2699
- return e.map(({ attribute: t, style: r }) => {
2700
- const s = r == null ? undefined : r.sortType;
2701
- if (!s)
2702
- return t;
2703
- const n = typeof s == "object" ? s.direction : s;
2704
- return Lp(n) ? t.sort(Ap(n)) : t;
2705
- });
2706
- }
2707
- function Nn(e) {
2708
- var t, r;
2709
- return (r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false;
2710
- }
2711
- function Rn2(e) {
2712
- var t, r;
2713
- return (r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false;
2714
- }
2715
- function vn2(e) {
2716
- var r, s;
2717
- const t = [];
2718
- for (const { measure: n, style: i } of e) {
2719
- const o = i == null ? undefined : i.sortType, a = o && Lp(o) ? n.sort(Ap(o)) : n;
2720
- t.push(a), i != null && i.trend && !Nn(n) && t.push(Ld(n, `${Ie}_${(r = n.name) != null ? r : "Measure"}`, i.trend)), i != null && i.forecast && !Rn2(n) && t.push(Md(n, `${Pe}_${(s = n.name) != null ? s : "Measure"}`, i.forecast));
2721
- }
2722
- return t;
2723
- }
2724
- var ii = (e) => {
2725
- const { data: t } = e, { dataSource: r, tables: s } = e.context, n = $e(s), i = [], o = w(() => qt({
2695
+ var Jn = (e) => {
2696
+ const { data: t } = e, { dataSource: r, tables: s } = e.context, n = qe(s), i = [], a = w(() => Tt({
2726
2697
  data: t.dimensions || [],
2727
2698
  context: { dataSource: r, schemaIndex: n }
2728
- }), i), a = w(() => zt({
2699
+ }), i), o = w(() => Pt({
2729
2700
  data: t.measures || [],
2730
2701
  context: { dataSource: r, schemaIndex: n }
2731
- }), i), u = w(() => Re({
2702
+ }), i), u = w(() => De({
2732
2703
  data: t.filters || [],
2733
2704
  context: { dataSource: r, schemaIndex: n }
2734
2705
  }), i);
2735
- let c = null;
2736
- return t.highlights && (c = w(() => ve({
2706
+ let l = null;
2707
+ return t.highlights && (l = w(() => Me({
2737
2708
  data: t.highlights || [],
2738
2709
  context: { dataSource: r, schemaIndex: n }
2739
2710
  }), i)), i.length > 0 ? {
@@ -2741,56 +2712,56 @@ var ii = (e) => {
2741
2712
  errors: i
2742
2713
  } : {
2743
2714
  success: true,
2744
- data: y2({
2745
- dataSource: Sp(r),
2746
- dimensions: o ? Mn(o) : [],
2747
- measures: a ? vn2(a) : [],
2715
+ data: y({
2716
+ dataSource: Np(r),
2717
+ dimensions: a ? gm(a) : [],
2718
+ measures: o ? hm(o) : [],
2748
2719
  filters: u || []
2749
- }, c && { highlights: c })
2720
+ }, l && { highlights: l })
2750
2721
  };
2751
2722
  };
2752
- function Qe(e) {
2723
+ function Ke2(e) {
2753
2724
  return typeof e == "object" && e !== null && "column" in e && e.column !== undefined;
2754
2725
  }
2755
- function ke(e) {
2726
+ function Ne(e) {
2756
2727
  const t = [], r = [];
2757
2728
  return e.forEach((s, n) => {
2758
- var l, d, b2;
2759
- const i = Qe(s) ? s.column : s, o = Qe(s) ? s : undefined, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
2729
+ var c, d, b2;
2730
+ const i = Ke2(s) ? s.column : s, a = Ke2(s) ? s : undefined, o = () => typeof i.toJSON == "function" ? i.toJSON() : i;
2760
2731
  if (!i.composeCode) {
2761
2732
  r.push({
2762
2733
  category: "dimensions",
2763
2734
  index: n,
2764
- input: a(),
2735
+ input: o(),
2765
2736
  message: `Dimension at index ${n} (${i.name || "unnamed"}) is missing composeCode`
2766
2737
  });
2767
2738
  return;
2768
2739
  }
2769
- if (!i.composeCode.startsWith(E3)) {
2740
+ if (!i.composeCode.startsWith(E4)) {
2770
2741
  r.push({
2771
2742
  category: "dimensions",
2772
2743
  index: n,
2773
- input: a(),
2774
- message: `Expected composeCode to start with '${E3}' for dimension at index ${n} (${i.name || "unnamed"}). Got: '${i.composeCode}'`
2744
+ input: o(),
2745
+ message: `Expected composeCode to start with '${E4}' for dimension at index ${n} (${i.name || "unnamed"}). Got: '${i.composeCode}'`
2775
2746
  });
2776
2747
  return;
2777
2748
  }
2778
- const u = (b2 = o != null && o.sortType ? Ap(o.sortType) : undefined) != null ? b2 : ((l = i.getSort) == null ? undefined : l.call(i)) !== undefined && ((d = i.getSort) == null ? undefined : d.call(i)) !== C.None ? i.getSort() : undefined, c = o ? ed(o, "column") : {};
2779
- if (u !== undefined && u !== C.None || o && Object.keys(c).length > 0) {
2780
- const g2 = y2(y2({
2749
+ const u = (b2 = a != null && a.sortType ? _s(a.sortType) : undefined) != null ? b2 : ((c = i.getSort) == null ? undefined : c.call(i)) !== undefined && ((d = i.getSort) == null ? undefined : d.call(i)) !== N.None ? i.getSort() : undefined, l = a ? od(a, "column") : {};
2750
+ if (u !== undefined && u !== N.None || a && Object.keys(l).length > 0) {
2751
+ const g3 = y(y({
2781
2752
  column: i.composeCode
2782
- }, u !== undefined && u !== C.None && { sortType: Tp(u) }), c);
2783
- t.push(g2);
2753
+ }, u !== undefined && u !== N.None && { sortType: Rp(u) }), l);
2754
+ t.push(g3);
2784
2755
  } else
2785
2756
  t.push(i.composeCode);
2786
2757
  }), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
2787
2758
  }
2788
- var be2 = "Unknown error";
2789
- function Be(e) {
2759
+ var ye2 = "Unknown error";
2760
+ function ve(e) {
2790
2761
  if (!e)
2791
2762
  return { success: true, data: [] };
2792
2763
  const t = [];
2793
- if (Zt(e)) {
2764
+ if (nn(e)) {
2794
2765
  if (!e.composeCode)
2795
2766
  return {
2796
2767
  success: false,
@@ -2804,9 +2775,9 @@ function Be(e) {
2804
2775
  ]
2805
2776
  };
2806
2777
  try {
2807
- return { success: true, data: [W(e.composeCode)] };
2778
+ return { success: true, data: [q(e.composeCode)] };
2808
2779
  } catch (s) {
2809
- const n = s instanceof Error ? s.message : be2;
2780
+ const n = s instanceof Error ? s.message : ye2;
2810
2781
  return {
2811
2782
  success: false,
2812
2783
  errors: [
@@ -2833,20 +2804,20 @@ function Be(e) {
2833
2804
  return;
2834
2805
  }
2835
2806
  try {
2836
- const o = W(s.composeCode);
2837
- r.push(o);
2838
- } catch (o) {
2839
- const a = o instanceof Error ? o.message : be2;
2807
+ const a = q(s.composeCode);
2808
+ r.push(a);
2809
+ } catch (a) {
2810
+ const o = a instanceof Error ? a.message : ye2;
2840
2811
  t.push({
2841
2812
  category: "filters",
2842
2813
  index: n,
2843
2814
  input: s,
2844
- message: `Failed to parse composeCode for filter at index ${n}: ${a}. ComposeCode: '${s.composeCode}'`
2815
+ message: `Failed to parse composeCode for filter at index ${n}: ${o}. ComposeCode: '${s.composeCode}'`
2845
2816
  });
2846
2817
  }
2847
2818
  }), t.length > 0 ? { success: false, errors: t } : { success: true, data: r };
2848
2819
  }
2849
- function ze(e) {
2820
+ function Re(e) {
2850
2821
  if (!e)
2851
2822
  return { success: true, data: [] };
2852
2823
  const t = [], r = [];
@@ -2862,135 +2833,120 @@ function ze(e) {
2862
2833
  return;
2863
2834
  }
2864
2835
  try {
2865
- const o = W(s.composeCode);
2866
- t.push(o);
2867
- } catch (o) {
2868
- const a = o instanceof Error ? o.message : be2;
2836
+ const a = q(s.composeCode);
2837
+ t.push(a);
2838
+ } catch (a) {
2839
+ const o = a instanceof Error ? a.message : ye2;
2869
2840
  r.push({
2870
2841
  category: "highlights",
2871
2842
  index: n,
2872
2843
  input: s,
2873
- message: `Failed to parse composeCode for highlight filter at index ${n}: ${a}. ComposeCode: '${s.composeCode}'`
2844
+ message: `Failed to parse composeCode for highlight filter at index ${n}: ${o}. ComposeCode: '${s.composeCode}'`
2874
2845
  });
2875
2846
  }
2876
2847
  }), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
2877
2848
  }
2878
- function Xe(e) {
2849
+ function Ge(e) {
2879
2850
  return typeof e == "object" && e !== null && "column" in e && e.column !== undefined;
2880
2851
  }
2881
- function Le(e) {
2852
+ function Ie(e) {
2882
2853
  const t = [], r = [];
2883
2854
  return e.forEach((s, n) => {
2884
- var u, c, p2;
2885
- const i = Xe(s) ? s.column : s, o = Xe(s) ? s : undefined, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
2855
+ var u, l, p;
2856
+ const i = Ge(s) ? s.column : s, a = Ge(s) ? s : undefined, o = () => typeof i.toJSON == "function" ? i.toJSON() : i;
2886
2857
  if (!i.composeCode) {
2887
2858
  r.push({
2888
2859
  category: "measures",
2889
2860
  index: n,
2890
- input: a(),
2861
+ input: o(),
2891
2862
  message: `Measure at index ${n} (${i.name || "unnamed"}) is missing composeCode`
2892
2863
  });
2893
2864
  return;
2894
2865
  }
2895
2866
  try {
2896
- const l = W(i.composeCode), d = (p2 = o != null && o.sortType ? Ap(o.sortType) : undefined) != null ? p2 : ((u = i.getSort) == null ? undefined : u.call(i)) !== undefined && ((c = i.getSort) == null ? undefined : c.call(i)) !== C.None ? i.getSort() : undefined;
2897
- if (d !== undefined && d !== C.None || o && Object.keys(ed(o, "column")).length > 0) {
2898
- const g2 = o ? ed(o, "column") : {}, m2 = y2(y2({
2899
- column: l
2900
- }, d !== undefined && d !== C.None && { sortType: Tp(d) }), g2);
2867
+ const c = q(i.composeCode), d = (p = a != null && a.sortType ? _s(a.sortType) : undefined) != null ? p : ((u = i.getSort) == null ? undefined : u.call(i)) !== undefined && ((l = i.getSort) == null ? undefined : l.call(i)) !== N.None ? i.getSort() : undefined;
2868
+ if (d !== undefined && d !== N.None || a && Object.keys(od(a, "column")).length > 0) {
2869
+ const g3 = a ? od(a, "column") : {}, m2 = y(y({
2870
+ column: c
2871
+ }, d !== undefined && d !== N.None && { sortType: Rp(d) }), g3);
2901
2872
  t.push(m2);
2902
2873
  } else
2903
- t.push(l);
2904
- } catch (l) {
2905
- const d = l instanceof Error ? l.message : "Unknown error";
2874
+ t.push(c);
2875
+ } catch (c) {
2876
+ const d = c instanceof Error ? c.message : "Unknown error";
2906
2877
  r.push({
2907
2878
  category: "measures",
2908
2879
  index: n,
2909
- input: a(),
2880
+ input: o(),
2910
2881
  message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${d}. ComposeCode: '${i.composeCode}'`
2911
2882
  });
2912
2883
  }
2913
2884
  }), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
2914
2885
  }
2915
- function Ze(e) {
2886
+ function Ye(e) {
2916
2887
  var t, r, s, n;
2917
- return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(Ie)) != null ? n : false);
2888
+ return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(Ws)) != null ? n : false);
2918
2889
  }
2919
- function et(e) {
2890
+ function Je(e) {
2920
2891
  var t, r, s, n;
2921
- return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(Pe)) != null ? n : false);
2892
+ return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(Gs)) != null ? n : false);
2922
2893
  }
2923
- function tt(e) {
2894
+ function He(e) {
2924
2895
  try {
2925
- const t = W(e.trim());
2896
+ const t = q(e.trim());
2926
2897
  return t.args[2] != null && typeof t.args[2] == "object" ? t.args[2] : undefined;
2927
2898
  } catch (t) {
2928
2899
  return;
2929
2900
  }
2930
2901
  }
2931
- function In(e) {
2902
+ function qn(e) {
2932
2903
  var s, n, i;
2933
2904
  if (!(e != null && e.length))
2934
2905
  return [];
2935
2906
  const t = /* @__PURE__ */ new Set, r = [];
2936
- for (let o = 0;o < e.length; o++) {
2937
- if (t.has(o))
2907
+ for (let a = 0;a < e.length; a++) {
2908
+ if (t.has(a))
2938
2909
  continue;
2939
- const a = e[o];
2940
- if (Ze(a) || et(a)) {
2941
- r.push(a);
2910
+ const o = e[a];
2911
+ if (Ye(o) || Je(o)) {
2912
+ r.push(o);
2942
2913
  continue;
2943
2914
  }
2944
- const u = (s = a.name) != null ? s : "Measure", c = `${Ie}_${u}`, p2 = `${Pe}_${u}`;
2945
- let l, d, b2 = o + 1;
2946
- if (b2 < e.length && !t.has(b2) && Ze(e[b2]) && e[b2].name === c) {
2947
- const g2 = (n = e[b2].composeCode) == null ? undefined : n.trim();
2948
- g2 && (l = tt(g2), t.add(b2), b2++);
2915
+ const u = (s = o.name) != null ? s : "Measure", l = `${Ws}_${u}`, p = `${Gs}_${u}`;
2916
+ let c, d, b2 = a + 1;
2917
+ if (b2 < e.length && !t.has(b2) && Ye(e[b2]) && e[b2].name === l) {
2918
+ const g3 = (n = e[b2].composeCode) == null ? undefined : n.trim();
2919
+ g3 && (c = He(g3), t.add(b2), b2++);
2949
2920
  }
2950
- if (b2 < e.length && !t.has(b2) && et(e[b2]) && e[b2].name === p2) {
2951
- const g2 = (i = e[b2].composeCode) == null ? undefined : i.trim();
2952
- g2 && (d = tt(g2), t.add(b2));
2921
+ if (b2 < e.length && !t.has(b2) && Je(e[b2]) && e[b2].name === p) {
2922
+ const g3 = (i = e[b2].composeCode) == null ? undefined : i.trim();
2923
+ g3 && (d = He(g3), t.add(b2));
2953
2924
  }
2954
- l !== undefined || d !== undefined ? r.push(y2(y2({
2955
- column: a
2956
- }, l && Object.keys(l).length > 0 && { trend: l }), d && Object.keys(d).length > 0 && { forecast: d })) : r.push(a);
2925
+ c !== undefined || d !== undefined ? r.push(y(y({
2926
+ column: o
2927
+ }, c && Object.keys(c).length > 0 && { trend: c }), d && Object.keys(d).length > 0 && { forecast: d })) : r.push(o);
2957
2928
  }
2958
2929
  return r;
2959
2930
  }
2960
- function oi(e) {
2961
- const t = [], r = w(() => ke(e.dimensions || []), t), s = In(e.measures || []), n = w(() => Le(s), t), i = w(() => Be(e.filters), t);
2962
- let o = null;
2963
- if (e.highlights && e.highlights.length > 0 && (o = w(() => ze(e.highlights), t)), t.length > 0)
2931
+ function Hn(e) {
2932
+ const t = [], r = w(() => Ne(e.dimensions || []), t), s = qn(e.measures || []), n = w(() => Ie(s), t), i = w(() => ve(e.filters), t);
2933
+ let a = null;
2934
+ if (e.highlights && e.highlights.length > 0 && (a = w(() => Re(e.highlights), t)), t.length > 0)
2964
2935
  return {
2965
2936
  success: false,
2966
2937
  errors: t
2967
2938
  };
2968
- const a = y2({
2939
+ const o = y({
2969
2940
  dimensions: r || [],
2970
2941
  measures: n || [],
2971
2942
  filters: i || []
2972
- }, o && { highlights: o });
2943
+ }, a && { highlights: a });
2973
2944
  return {
2974
2945
  success: true,
2975
- data: Q(a)
2946
+ data: Q2(o)
2976
2947
  };
2977
2948
  }
2978
- var Lt = new Set(Xp.filter((e) => e !== "image"));
2979
- var rt = Object.freeze([...Lt]);
2980
- function Zn(e) {
2981
- const { filters: t, relations: r } = bp(e.filters || []);
2982
- return {
2983
- dataSource: e.dataSource,
2984
- dimensions: e.dimensions,
2985
- measures: e.measures,
2986
- filters: t,
2987
- filterRelations: r,
2988
- highlights: e.highlights
2989
- };
2990
- }
2991
- function fi(e, t, r = false) {
2992
- const s = Zn(e), n = jn(s, t);
2993
- return Dh(n, r);
2994
- }
2949
+ var kt = new Set(sm.filter((e) => e !== "image"));
2950
+ var Qe = Object.freeze([...kt]);
2995
2951
 
2996
- export { y, N, q, ni, ii, oi, fi };
2952
+ export { g2 as g, z, Q, q, Yn, Jn, Hn };