@sinequa/atomic 0.0.129 → 0.0.139

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/atomic.js CHANGED
@@ -1,7 +1,4 @@
1
- var ie = Object.defineProperty;
2
- var le = (e, t, r) => t in e ? ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var Y = (e, t, r) => le(e, typeof t != "symbol" ? t + "" : t, r);
4
- function w(e) {
1
+ function p(e) {
5
2
  const t = new CustomEvent("authenticated", {
6
3
  bubbles: !0,
7
4
  cancelable: !1,
@@ -9,121 +6,119 @@ function w(e) {
9
6
  });
10
7
  dispatchEvent(t);
11
8
  }
12
- const d = {
9
+ const u = {
13
10
  loginPath: "/login",
14
11
  createRoutes: !1
15
12
  };
16
13
  function k(e) {
17
- Object.assign(d, e);
14
+ Object.assign(u, e);
18
15
  }
19
- function L(e) {
20
- const t = W(), r = new Headers(e);
16
+ function x(e) {
17
+ const t = H(), r = new Headers(e);
21
18
  r.append("Sinequa-Force-Camel-Case", "true"), r.append("accept", "application/json"), t && r.append("Sinequa-csrf-token", t);
22
- const { userOverride: n, userOverrideActive: a, bearerToken: s } = d;
23
- return s && r.append("Authorization", `Bearer ${s}`), n && a && (r.append("sinequa-override-user", n.username), r.append("sinequa-override-domain", n.domain)), r;
24
- }
25
- class b extends Error {
26
- constructor(r, n) {
27
- super(r);
28
- Y(this, "status");
29
- this.name = "ApiError", this.status = n;
19
+ const { userOverride: n, userOverrideActive: a, bearerToken: o } = u;
20
+ return o && r.append("Authorization", `Bearer ${o}`), n && a && (r.append("sinequa-override-user", n.username), r.append("sinequa-override-domain", n.domain)), r;
21
+ }
22
+ class v extends Error {
23
+ status;
24
+ constructor(t, r) {
25
+ super(t), this.name = "ApiError", this.status = r;
30
26
  }
31
27
  }
32
- class K extends b {
28
+ class J extends v {
33
29
  constructor(t = "Server error") {
34
30
  super(t, 500), this.name = "ServerError";
35
31
  }
36
32
  }
37
- class ue extends b {
33
+ class ae extends v {
38
34
  constructor(t = "Request timed out") {
39
35
  super(t, 408), this.name = "TimeoutError";
40
36
  }
41
37
  }
42
- class G extends b {
38
+ class j extends v {
43
39
  constructor(t = "Unauthorized access") {
44
40
  super(t, 401), this.name = "UnauthorizedError";
45
41
  }
46
42
  }
47
- const de = /.*\:\(?([><=\d\-\.AND ]+)\)?/;
48
- function nt(e, t) {
49
- var a;
50
- return !(e != null && e.items) || ((a = e == null ? void 0 : e.items) == null ? void 0 : a.length) === 0 ? [] : e.items.reduce((s, i) => {
51
- if (!i.value || i.value === "") return s;
52
- const o = fe(i, e.column);
53
- return s.push({
54
- operator: o.operator,
55
- value: o.value,
56
- display: i.display || o.display,
57
- filters: o.filters,
58
- disabled: i.count === 0,
59
- hidden: i.count === 0 && e.isDistribution ? !t : !1
60
- }), s;
43
+ const oe = /.*\:\(?([><=\d\-\.AND ]+)\)?/;
44
+ function ot(e, t) {
45
+ return !e?.items || e?.items?.length === 0 ? [] : e.items.reduce((a, o) => {
46
+ if (!o.value || o.value === "") return a;
47
+ const s = se(o, e.column);
48
+ return a.push({
49
+ operator: s.operator,
50
+ value: s.value,
51
+ display: o.display || s.display,
52
+ filters: s.filters,
53
+ disabled: o.count === 0,
54
+ hidden: o.count === 0 && e.isDistribution ? !t : !1
55
+ }), a;
61
56
  }, []);
62
57
  }
63
- function fe(e, t) {
64
- const r = t, n = e.value.match(de);
65
- if (n != null && n[1]) {
66
- const s = (n == null ? void 0 : n[1].split(" AND ")).map((i) => {
67
- const o = i.indexOf(">=") !== -1 ? "gte" : "lt";
68
- let c = i.substring(i.indexOf(" ") + 1);
69
- return { field: r, operator: o, value: c, display: e.display || e.value };
58
+ function se(e, t) {
59
+ const r = t, n = e.value.match(oe);
60
+ if (n?.[1]) {
61
+ const o = (n?.[1].split(" AND ")).map((s) => {
62
+ const c = s.indexOf(">=") !== -1 ? "gte" : "lt";
63
+ let i = s.substring(s.indexOf(" ") + 1);
64
+ return { field: r, operator: c, value: i, display: e.display || e.value };
70
65
  });
71
- if (s.length === 2)
72
- return { field: r, operator: "and", filters: s, value: e.value, display: s[0].display || s[0].value };
73
- if (s.length === 1)
74
- return { ...s[0], field: r };
66
+ if (o.length === 2)
67
+ return { field: r, operator: "and", filters: o, value: e.value, display: o[0].display || o[0].value };
68
+ if (o.length === 1)
69
+ return { ...o[0], field: r };
75
70
  throw new Error("Failed to parse distribution expression");
76
71
  }
77
72
  return { field: r, operator: "eq", value: e.value, display: e.display };
78
73
  }
79
- function at(e, t, r) {
74
+ function st(e, t, r) {
80
75
  return e.valuesAreExpressions ? t.display === r.display : t.value === r.value;
81
76
  }
82
- function he(e) {
83
- return e.items && (e.items = e.items.map((t) => he(t))), e.items && e.items.some((t) => t.$selected || t.$opened) && (e.$opened = !0), e;
77
+ function ie(e) {
78
+ return e.items && (e.items = e.items.map((t) => ie(t))), e.items && e.items.some((t) => t.$selected || t.$opened) && (e.$opened = !0), e;
84
79
  }
85
- function st(e, t) {
80
+ function it(e, t) {
86
81
  const r = [];
87
82
  if (e.length > 0) {
88
- const n = /* @__PURE__ */ new Map(), s = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").normalize("NFD").replace(/[\u0300-\u036f]/g, ""), i = new RegExp("\\b" + s, "i");
89
- e.forEach((o) => {
90
- if (o.display.length > 1) {
91
- const c = o.display.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), l = i.exec(c);
92
- re(r, n, "/", o.display, +(o.frequency || 0), 1, ((l == null ? void 0 : l.index) || 0) + t.length);
83
+ const n = /* @__PURE__ */ new Map(), o = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").normalize("NFD").replace(/[\u0300-\u036f]/g, ""), s = new RegExp("\\b" + o, "i");
84
+ e.forEach((c) => {
85
+ if (c.display.length > 1) {
86
+ const i = c.display.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), d = s.exec(i);
87
+ Z(r, n, "/", c.display, +(c.frequency || 0), 1, (d?.index || 0) + t.length);
93
88
  }
94
89
  });
95
90
  }
96
91
  return r;
97
92
  }
98
- function re(e, t, r, n, a, s, i) {
99
- const o = n.indexOf("/", r.length), c = n.substring(0, o + 1);
100
- let l = t.get(c);
101
- if (!l) {
102
- const f = c.replace(/^\/|\/$/g, "");
103
- l = {
104
- value: n.substring(r.length, o),
93
+ function Z(e, t, r, n, a, o, s) {
94
+ const c = n.indexOf("/", r.length), i = n.substring(0, c + 1);
95
+ let d = t.get(i);
96
+ if (!d) {
97
+ const _ = i.replace(/^\/|\/$/g, "");
98
+ d = {
99
+ value: n.substring(r.length, c),
105
100
  count: a,
106
101
  items: [],
107
102
  hasChildren: !1,
108
- $level: s,
109
- $opened: i >= c.length,
110
- $path: f
111
- }, t.set(c, l), e.push(l);
103
+ $level: o,
104
+ $opened: s >= i.length,
105
+ $path: _
106
+ }, t.set(i, d), e.push(d);
112
107
  }
113
- c.length < n.length && (l.hasChildren = !0, re(l.items, t, c, n, a, s + 1, i));
108
+ i.length < n.length && (d.hasChildren = !0, Z(d.items, t, i, n, a, o + 1, s));
114
109
  }
115
- function ot(e, t) {
110
+ function ct(e, t) {
116
111
  return e.reduce((r, n) => (t(n) ? r.true.push(n) : r.false.push(n), r), { true: [], false: [] });
117
112
  }
118
- const me = /(([\+\-])?\(([^\)]+)\))|(([\+\-])?\[([^\]]+)\])|(([\+\-])?\"([^\"]+)\")|(([\+\-])?\/([^\/]+)\/)|(([\+\-])?(\S+))/g, _e = 2, Z = 3, we = 5, E = 6, ge = 8, T = 9, Se = 11, ee = 12, ke = 14, te = 15;
119
- function I(e) {
113
+ const ce = /(([\+\-])?\(([^\)]+)\))|(([\+\-])?\[([^\]]+)\])|(([\+\-])?\"([^\"]+)\")|(([\+\-])?\/([^\/]+)\/)|(([\+\-])?(\S+))/g, le = 2, W = 3, ue = 5, M = 6, de = 8, X = 9, fe = 11, Y = 12, he = 14, K = 15;
114
+ function D(e) {
120
115
  if (!e) return [];
121
- const t = [], r = e.matchAll(me);
116
+ const t = [], r = e.matchAll(ce);
122
117
  for (let n of r)
123
- n[Z] ? t.push({ type: "group", value: n[Z], op: n[_e] }) : n[E] ? t.push({ type: "adjacent", value: n[E], op: n[we] }) : n[T] ? t.push({ type: "exact", value: n[T], op: n[ge] }) : n[ee] ? t.push({ type: "regex", value: n[ee], op: n[Se] }) : n[te] && t.push({ type: "token", value: n[te], op: n[ke] });
118
+ n[W] ? t.push({ type: "group", value: n[W], op: n[le] }) : n[M] ? t.push({ type: "adjacent", value: n[M], op: n[ue] }) : n[X] ? t.push({ type: "exact", value: n[X], op: n[de] }) : n[Y] ? t.push({ type: "regex", value: n[Y], op: n[fe] }) : n[K] && t.push({ type: "token", value: n[K], op: n[he] });
124
119
  return t;
125
120
  }
126
- function j(e) {
121
+ function Q(e) {
127
122
  return e.map((t) => {
128
123
  const r = t.op || "";
129
124
  switch (t.type) {
@@ -140,28 +135,28 @@ function j(e) {
140
135
  }
141
136
  }).join(" ");
142
137
  }
143
- function ct(e, t, r) {
144
- let n = I(e);
138
+ function lt(e, t, r) {
139
+ let n = D(e);
145
140
  for (let a of t)
146
141
  n.push({ type: "adjacent", value: a, op: r });
147
- return j(n);
142
+ return Q(n);
148
143
  }
149
- function it(e, t) {
150
- const r = I(t), n = r.findIndex((a) => a.value === e);
151
- return n !== -1 ? (r.splice(n, 1), t = j(r)) : t;
144
+ function ut(e, t) {
145
+ const r = D(t), n = r.findIndex((a) => a.value === e);
146
+ return n !== -1 ? (r.splice(n, 1), t = Q(r)) : t;
152
147
  }
153
- function lt(e) {
154
- const t = I(e).filter((r) => r.type !== "adjacent");
155
- return j(t);
148
+ function dt(e) {
149
+ const t = D(e).filter((r) => r.type !== "adjacent");
150
+ return Q(t);
156
151
  }
157
- function ut(e) {
158
- return I(e).filter((t) => t.type === "adjacent").map((t) => t.value);
152
+ function ft(e) {
153
+ return D(e).filter((t) => t.type === "adjacent").map((t) => t.value);
159
154
  }
160
- function dt(e, t, r) {
161
- const n = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: a, unit: s, isFuture: i } = pe(t, r);
162
- return n.format(a * (i ? 1 : -1), s);
155
+ function ht(e, t, r) {
156
+ const n = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: a, unit: o, isFuture: s } = me(t, r);
157
+ return n.format(a * (s ? 1 : -1), o);
163
158
  }
164
- function pe(e, t) {
159
+ function me(e, t) {
165
160
  const r = new Date(e), n = t ? new Date(t) : /* @__PURE__ */ new Date(), a = Math.abs(n.getTime() - r.getTime());
166
161
  return {
167
162
  offset: Math.floor(a / (1e3 * 60 * 60 * 24)),
@@ -169,37 +164,37 @@ function pe(e, t) {
169
164
  isFuture: r > n
170
165
  };
171
166
  }
172
- function ft(e) {
167
+ function mt(e) {
173
168
  const t = e.target;
174
169
  return t && t.nodeName !== "INPUT" && t.nodeName !== "TEXTAREA";
175
170
  }
176
- function ht(e) {
171
+ function pt(e) {
177
172
  if (e === void 0) return;
178
- const { q: t, f: r, p: n, s: a, t: s, n: i, b: o } = R(e), [c] = e.split("?");
173
+ const { q: t, f: r, p: n, s: a, t: o, n: s, b: c } = R(e), [i] = e.split("?");
179
174
  return {
180
- path: c,
175
+ path: i,
181
176
  text: t,
182
- filters: r ? ne(r) : void 0,
177
+ filters: r ? E(r) : void 0,
183
178
  page: n ? parseInt(n, 10) : void 0,
184
179
  sort: a,
185
- tab: s,
186
- name: i,
187
- basket: o
180
+ tab: o,
181
+ name: s,
182
+ basket: c
188
183
  };
189
184
  }
190
- function mt(e) {
185
+ function gt(e) {
191
186
  if (!e) return "";
192
- const { text: t, filters: r, page: n, sort: a, tab: s, name: i, basket: o } = e, c = {};
193
- t && (c.q = t), r && (c.f = JSON.stringify(r)), n && (c.p = n.toString()), a && (c.s = a), s && (c.t = s), i && (c.n = i), o && (c.b = o);
194
- const l = new URLSearchParams(c).toString();
195
- return l || "";
187
+ const { text: t, filters: r, page: n, sort: a, tab: o, name: s, basket: c } = e, i = {};
188
+ t && (i.q = t), r && (i.f = JSON.stringify(r)), n && (i.p = n.toString()), a && (i.s = a), o && (i.t = o), s && (i.n = s), c && (i.b = c);
189
+ const d = new URLSearchParams(i).toString();
190
+ return d || "";
196
191
  }
197
- function _t(e) {
192
+ function wt(e) {
198
193
  if (e === void 0) return [];
199
194
  const { f: t } = R(e);
200
- return ne(t);
195
+ return E(t);
201
196
  }
202
- function ne(e) {
197
+ function E(e) {
203
198
  const t = decodeURIComponent(e);
204
199
  try {
205
200
  return JSON.parse(t ?? "[]");
@@ -213,23 +208,23 @@ function R(e) {
213
208
  const r = new URLSearchParams(t);
214
209
  return Object.fromEntries(r);
215
210
  }
216
- function wt(e) {
211
+ function _t(e) {
217
212
  const { q: t = "" } = R(e);
218
213
  return t;
219
214
  }
220
- function gt(e) {
215
+ function St(e) {
221
216
  const { id: t } = R(e);
222
217
  return decodeURIComponent(t);
223
218
  }
224
- function St(e) {
219
+ function kt(e) {
225
220
  const { p: t = "0" } = R(e);
226
221
  return parseInt(t, 10);
227
222
  }
228
- function kt(e) {
223
+ function bt(e) {
229
224
  const { t } = R(e);
230
225
  return t;
231
226
  }
232
- function pt(e, t) {
227
+ function vt(e, t) {
233
228
  if (!e)
234
229
  return e;
235
230
  let r = 0;
@@ -240,21 +235,21 @@ function pt(e, t) {
240
235
  a++;
241
236
  e[a] === "]" && (r = a + 1);
242
237
  }
243
- const s = B(e, r, !1);
244
- if (!s)
238
+ const o = N(e, r, !1);
239
+ if (!o)
245
240
  return e;
246
- const i = t.charCodeAt(0), o = t.charCodeAt(1);
247
- let c = s;
248
- for (; c; )
249
- if (i === c.lang1 && o === c.lang2) {
250
- const f = B(e, c.end + 4, !0);
251
- return e.substring(f.start, f.end);
241
+ const s = t.charCodeAt(0), c = t.charCodeAt(1);
242
+ let i = o;
243
+ for (; i; )
244
+ if (s === i.lang1 && c === i.lang2) {
245
+ const _ = N(e, i.end + 4, !0);
246
+ return e.substring(_.start, _.end);
252
247
  } else
253
- c = B(e, c.end + 4, !1);
254
- const l = e.substring(s.start, s.end);
255
- return l || e;
248
+ i = N(e, i.end + 4, !1);
249
+ const d = e.substring(o.start, o.end);
250
+ return d || e;
256
251
  }
257
- function B(e, t, r) {
252
+ function N(e, t, r) {
258
253
  for (let n = t, a = e.length - 3; n < a; n++)
259
254
  if (e[n] === "[" && e[n + 3] === "]")
260
255
  return {
@@ -271,9 +266,9 @@ function B(e, t, r) {
271
266
  lang2: -1
272
267
  };
273
268
  }
274
- function vt(e, t) {
275
- const { useLocale: r, useLocaleAsPrefix: n, indexFile: a, path: s, folder: i } = t, o = r ? `${e}/` : null, c = n ? `${e}.${a}` : a ?? "";
276
- return [s, i, `${o || ""}${c}`].filter((l) => l !== void 0).join("/");
269
+ function Ct(e, t) {
270
+ const { useLocale: r, useLocaleAsPrefix: n, indexFile: a, path: o, folder: s } = t, c = r ? `${e}/` : null, i = n ? `${e}.${a}` : a ?? "";
271
+ return [o, s, `${c || ""}${i}`].filter((d) => d !== void 0).join("/");
277
272
  }
278
273
  function O(e) {
279
274
  const t = new CustomEvent("notification", {
@@ -283,7 +278,7 @@ function O(e) {
283
278
  });
284
279
  dispatchEvent(t);
285
280
  }
286
- const bt = {
281
+ const Rt = {
287
282
  success: (e, t) => {
288
283
  O({
289
284
  type: "success",
@@ -313,17 +308,17 @@ const bt = {
313
308
  });
314
309
  }
315
310
  };
316
- var ae = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e[e.NONE = 4] = "NONE", e))(ae || {});
311
+ var T = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e[e.NONE = 4] = "NONE", e))(T || {});
317
312
  let $ = {
318
313
  level: 1,
319
314
  enableConsoleOutput: !0
320
315
  };
321
- function Ct(e) {
316
+ function yt(e) {
322
317
  $ = { ...$, ...e };
323
318
  }
324
- function D(e, t, r) {
319
+ function I(e, t, r) {
325
320
  if (e < $.level) return;
326
- const a = `${`[${ae[e]}]`} ${t}`;
321
+ const a = `${`[${T[e]}]`} ${t}`;
327
322
  if ($.enableConsoleOutput)
328
323
  switch (e) {
329
324
  case 0:
@@ -340,17 +335,17 @@ function D(e, t, r) {
340
335
  break;
341
336
  }
342
337
  }
343
- function x(e, t) {
344
- D(0, e, t);
338
+ function y(e, t) {
339
+ I(0, e, t);
345
340
  }
346
341
  function S(e, t) {
347
- D(1, e, t);
342
+ I(1, e, t);
348
343
  }
349
344
  function P(e, t) {
350
- D(2, e, t);
345
+ I(2, e, t);
351
346
  }
352
- function h(e, t) {
353
- D(3, e, t);
347
+ function f(e, t) {
348
+ I(3, e, t);
354
349
  }
355
350
  async function C(e, t = "json") {
356
351
  const r = e.headers.get("sinequa-jwt-refresh");
@@ -366,98 +361,99 @@ async function C(e, t = "json") {
366
361
  return await e.json();
367
362
  }
368
363
  if (e.status === 401) {
369
- if (d.userOverrideActive)
364
+ if (u.userOverrideActive)
370
365
  throw P("Unauthorized access attempt with user override", {
371
366
  endpoint: e.url
372
- }), new G("Unauthorized... User override failed.");
367
+ }), new j("Unauthorized... User override failed.");
373
368
  return await q(e, 401);
374
369
  }
375
- return e.status === 500 ? (h("Server error occurred", { endpoint: e.url }), await q(e, 500)) : (P(`Unexpected response status: ${e.status}`, {
370
+ return e.status === 500 ? (f("Server error occurred", { endpoint: e.url }), await q(e, 500)) : (P(`Unexpected response status: ${e.status}`, {
376
371
  endpoint: e.url
377
372
  }), await q(e, e.status));
378
373
  }
379
374
  async function q(e, t) {
380
- var r;
381
375
  try {
382
- const { done: n, value: a } = await ((r = e.body) == null ? void 0 : r.getReader().read()) || {
376
+ const { done: r, value: n } = await e.body?.getReader().read() || {
383
377
  done: !0,
384
378
  value: void 0
385
379
  };
386
- if (n || !a)
387
- throw t === 401 ? new G() : t === 500 ? new K() : new b(`Request failed with status ${t}`, t);
388
- const s = JSON.parse(new TextDecoder().decode(a));
380
+ if (r || !n)
381
+ throw t === 401 ? new j() : t === 500 ? new J() : new v(`Request failed with status ${t}`, t);
382
+ const a = JSON.parse(new TextDecoder().decode(n));
389
383
  throw new Error(
390
- s.errorMessage || s.message || `Request failed with status ${t}`,
384
+ a.errorMessage || a.message || `Request failed with status ${t}`,
391
385
  {
392
386
  cause: {
393
- errorCode: s.errorCode,
394
- errorCodeTest: s.errorCodeTest
387
+ errorCode: a.errorCode,
388
+ errorCodeTest: a.errorCodeTest
395
389
  }
396
390
  }
397
391
  );
398
- } catch (n) {
399
- throw n instanceof b ? n : t === 401 ? new G(n.message) : t === 500 ? new K(n.message) : new b(
400
- n.message ?? `Request failed with status ${t}`,
392
+ } catch (r) {
393
+ throw r instanceof v ? r : t === 401 ? new j(r.message) : t === 500 ? new J(r.message) : new v(
394
+ r.message ?? `Request failed with status ${t}`,
401
395
  t
402
396
  );
403
397
  }
404
398
  }
405
- async function Rt(e, t, r) {
406
- const n = L(r == null ? void 0 : r.headers), { backendUrl: a } = d, s = t ? `?${new URLSearchParams(t)}` : "", i = a ? `${a}/${e}${s}` : `${e}${s}`;
407
- x(`Making DELETE request to: ${i}`);
399
+ async function pe(e, t, r) {
400
+ const n = x(r?.headers), { backendUrl: a } = u, o = t ? `?${new URLSearchParams(t)}` : "", s = a ? `${a}/${e}${o}` : `${e}${o}`;
401
+ y(`Making DELETE request to: ${s}`);
408
402
  try {
409
- const o = await fetch(i, {
403
+ const c = await fetch(s, {
410
404
  method: "DELETE",
411
405
  credentials: "include",
412
406
  headers: n
413
407
  });
414
- return C(o, r == null ? void 0 : r.responseType);
415
- } catch (o) {
416
- throw h("Error making DELETE request:", o), o;
408
+ return C(c, r?.responseType);
409
+ } catch (c) {
410
+ throw f("Error making DELETE request:", c), c;
417
411
  }
418
412
  }
419
- async function p(e, t, r) {
420
- const n = L(r == null ? void 0 : r.headers), { backendUrl: a } = d, s = t ? `?${new URLSearchParams(t)}` : "";
413
+ async function w(e, t, r) {
414
+ const n = x(r?.headers), { backendUrl: a } = u, o = t ? `?${new URLSearchParams(t)}` : "";
421
415
  e.startsWith("plugin") && (e = `api/v1/${e}`);
422
- const i = a ? `${a}/${e}${s}` : `${e}${s}`;
423
- x(`Making GET request to: ${i}`);
416
+ const s = a ? `${a}/${e}${o}` : `${e}${o}`;
417
+ y(`Making GET request to: ${s}`);
424
418
  try {
425
- const o = await fetch(i, {
419
+ const c = await fetch(s, {
426
420
  method: "GET",
427
421
  credentials: "include",
428
422
  headers: n,
429
- signal: r == null ? void 0 : r.signal
423
+ signal: r?.signal
430
424
  });
431
- return C(o, r == null ? void 0 : r.responseType);
432
- } catch (o) {
433
- throw h("Error making GET request:", o), o;
425
+ return C(c, r?.responseType);
426
+ } catch (c) {
427
+ throw f("Error making GET request:", c), c;
434
428
  }
435
429
  }
436
- async function xt(e, t, r) {
437
- const n = L(r == null ? void 0 : r.headers), { app: a, backendUrl: s } = d, i = {
430
+ async function ge(e, t, r) {
431
+ const n = x(r?.headers);
432
+ n.append("content-type", "application/json");
433
+ const { app: a, backendUrl: o } = u, s = {
438
434
  app: a,
439
435
  ...t,
440
436
  locale: t.locale || navigator.language,
441
437
  noUserOverride: !0,
442
438
  noAutoAuthentication: !0
443
- }, o = s ? `${s}/${e}` : `${e}`;
444
- x(`Making PATCH request to: ${o}`);
439
+ }, c = o ? `${o}/${e}` : `${e}`;
440
+ y(`Making PATCH request to: ${c}`);
445
441
  try {
446
- const c = await fetch(o, {
442
+ const i = await fetch(c, {
447
443
  method: "PATCH",
448
444
  headers: n,
449
445
  credentials: "include",
450
- body: JSON.stringify(i)
446
+ body: JSON.stringify(s)
451
447
  });
452
- return C(c, r == null ? void 0 : r.responseType);
453
- } catch (c) {
454
- throw h("Error making PATCH request:", c), c;
448
+ return C(i, r?.responseType);
449
+ } catch (i) {
450
+ throw f("Error making PATCH request:", i), i;
455
451
  }
456
452
  }
457
- async function u(e, t, r) {
458
- const n = L(r == null ? void 0 : r.headers), { app: a, backendUrl: s } = d;
453
+ async function l(e, t, r) {
454
+ const n = x(r?.headers), { app: a, backendUrl: o } = u;
459
455
  n.has("Content-Type") || n.set("Content-Type", "application/json");
460
- const i = {
456
+ const s = {
461
457
  app: a,
462
458
  ...t,
463
459
  locale: t.locale || navigator.language,
@@ -465,137 +461,130 @@ async function u(e, t, r) {
465
461
  noAutoAuthentication: !0
466
462
  };
467
463
  e.startsWith("plugin") && (e = `api/v1/${e}`);
468
- const o = s ? `${s}/${e}` : `${e}`;
469
- x(`Making POST request to: ${o}`);
464
+ const c = o ? `${o}/${e}` : `${e}`;
465
+ y(`Making POST request to: ${c}`);
470
466
  try {
471
- const c = await fetch(o, {
467
+ const i = await fetch(c, {
472
468
  method: "POST",
473
469
  headers: n,
474
470
  credentials: "include",
475
- body: JSON.stringify(i),
476
- signal: r == null ? void 0 : r.signal
471
+ body: JSON.stringify(s),
472
+ signal: r?.signal
477
473
  });
478
- return C(c, r == null ? void 0 : r.responseType);
479
- } catch (c) {
480
- throw h("Error making POST request:", c), c;
474
+ return C(i, r?.responseType);
475
+ } catch (i) {
476
+ throw f("Error making POST request:", i), i;
481
477
  }
482
478
  }
483
479
  async function Pt(e, t, r) {
484
- const n = L(r == null ? void 0 : r.headers), { app: a, backendUrl: s } = d, i = {
480
+ const n = x(r?.headers), { app: a, backendUrl: o } = u, s = {
485
481
  app: a,
486
482
  ...t,
487
483
  locale: t.locale || navigator.language,
488
484
  noUserOverride: !0,
489
485
  noAutoAuthentication: !0
490
- }, o = `${s}/${e}`;
491
- x(`Making PUT request to: ${o}`);
486
+ }, c = `${o}/${e}`;
487
+ y(`Making PUT request to: ${c}`);
492
488
  try {
493
- const c = await fetch(o, {
489
+ const i = await fetch(c, {
494
490
  method: "PUT",
495
491
  headers: n,
496
492
  credentials: "include",
497
- body: JSON.stringify(i)
493
+ body: JSON.stringify(s)
498
494
  });
499
- return C(c, r == null ? void 0 : r.responseType);
500
- } catch (c) {
501
- throw h("Error making PUT request:", c), c;
495
+ return C(i, r?.responseType);
496
+ } catch (i) {
497
+ throw f("Error making PUT request:", i), i;
502
498
  }
503
499
  }
504
- function Lt(e) {
500
+ function xt(e) {
505
501
  const t = new AbortController(), { signal: r } = t;
506
502
  return e && setTimeout(() => {
507
- r.aborted || t.abort(new ue(`Request timed out after ${e}ms`));
503
+ r.aborted || t.abort(new ae(`Request timed out after ${e}ms`));
508
504
  }, e), { controller: t, signal: r };
509
505
  }
510
- function se(e) {
506
+ function ee(e) {
511
507
  if (!e) return;
512
508
  const t = new Date(e);
513
509
  return Number.isNaN(t.getTime()) ? void 0 : t;
514
510
  }
515
- function yt(e) {
516
- const t = se(e);
511
+ function Lt(e) {
512
+ const t = ee(e);
517
513
  return !!t && t.getTime() <= Date.now();
518
514
  }
519
515
  function Ot(e, t = 7) {
520
- const r = se(e);
516
+ const r = ee(e);
521
517
  if (!r) return !1;
522
- const n = Date.now(), a = n + t * 24 * 60 * 60 * 1e3, s = r.getTime();
523
- return s > n && s <= a;
518
+ const n = Date.now(), a = n + t * 24 * 60 * 60 * 1e3, o = r.getTime();
519
+ return o > n && o <= a;
524
520
  }
525
521
  async function $t(e, t = 0, r = 1e3) {
526
522
  let n;
527
523
  for (let a = 0; a <= t; a++)
528
524
  try {
529
525
  return await e();
530
- } catch (s) {
531
- if (n = s, s instanceof b && s.status >= 400 && s.status < 500 && s.status !== 429 || s instanceof DOMException && s.name === "AbortError")
532
- throw s;
533
- a < t && (P(`Retrying request (${a + 1}/${t})`, { error: s }), await new Promise((i) => setTimeout(i, r)));
526
+ } catch (o) {
527
+ if (n = o, o instanceof v && o.status >= 400 && o.status < 500 && o.status !== 429 || o instanceof DOMException && o.name === "AbortError")
528
+ throw o;
529
+ a < t && (P(`Retrying request (${a + 1}/${t})`, { error: o }), await new Promise((s) => setTimeout(s, r)));
534
530
  }
535
531
  throw n;
536
532
  }
537
533
  function Ut(e, t, r) {
538
- var s, i, o, c;
539
534
  if (!e || !t) return;
540
535
  if (r) {
541
- const l = Object.keys(t.queries).find((F) => F === (r == null ? void 0 : r.toLowerCase()));
542
- let f;
543
- l && (f = t.queries[l]);
544
- const N = (i = ((s = f == null ? void 0 : f.columnsInfo) == null ? void 0 : s.columns) || []) == null ? void 0 : i.find((F) => {
545
- var X, M;
546
- return (M = (X = F.aliases) == null ? void 0 : X.split(",")) == null ? void 0 : M.includes(e);
547
- });
548
- if (N) return N.name;
536
+ const o = Object.keys(t.queries).find((i) => i === r?.toLowerCase());
537
+ let s;
538
+ o && (s = t.queries[o]);
539
+ const c = (s?.columnsInfo?.columns || [])?.find((i) => i.aliases?.split(",")?.includes(e));
540
+ if (c) return c.name;
549
541
  }
550
- const n = (c = (o = t.indexes) == null ? void 0 : o._) == null ? void 0 : c.columns, a = Object.entries(n).find((l) => {
551
- var f;
552
- return (f = l[1].aliases) == null ? void 0 : f.includes(e);
553
- });
542
+ const n = t.indexes?._?.columns, a = Object.entries(n).find((o) => o[1].aliases?.includes(e));
554
543
  if (a) return a[0];
555
544
  }
556
- var v = /* @__PURE__ */ ((e) => (e.None = "None", e.Search_FirstPage = "Search_FirstPage", e.Search_Text = "Search_Text", e.Search_Refine = "Search_Refine", e.Search_Select_Item = "Search_Select_Item", e.Search_Select_Custom = "Search_Select_Custom", e.Search_Select_Concept = "Search_Select_Concept", e.Search_Select_Correction = "Search_Select_Correction", e.Search_GotoPage = "Search_GotoPage", e.Search_GotoTab = "Search_GotoTab", e.Search_DisplayResult = "Search_DisplayResult", e.Search_RemoveResult = "Search_RemoveResult", e.Search_RemoveAdvanced = "Search_RemoveAdvanced", e.Search_SavedQuery = "Search_SavedQuery", e.Search_WebService = "Search_WebService", e.Search_DidYouMean_Original = "Search_DidYouMean_Original", e.Search_DidYouMean_Correction = "Search_DidYouMean_Correction", e.Search_ExportCSV = "Search_ExportCSV", e.Search_SavedQuery_ExportCSV = "Search_SavedQuery_ExportCSV", e.Search_Selection_ExportCSV = "Search_Selection_ExportCSV", e.Search_AlertQuery = "Search_AlertQuery", e.Search_Select_AnalyticsItem = "Search_Select_AnalyticsItem", e.Search_Sort = "Search_Sort", e.Search_Exit_Logout = "Search_Exit_Logout", e.Search_Timeline_Usage = "Search_Timeline_Usage", e.Search_AutoComplete = "Search_Autocomplete", e.Search_Login_Success = "Login_Success_Form", e.Search_QueryIntent_Detected = "Search_QueryIntent_Detected", e.SavedQuery_Add = "SavedQuery_Add", e.SavedQuery_Delete = "SavedQuery_Delete", e.SavedQuery_DeleteAll = "SavedQuery_DeleteAll", e.SavedQuery_Rename = "SavedQuery_Rename", e.Alert_Edit = "Alert_Edit", e.Alert_Delete = "Alert_Delete", e.Alert_DeleteAll = "Alert_DeleteAll", e.Link_Display = "Link_Display", e.Link_Click = "Link_Click", e.Basket_Add = "Basket_Add", e.Basket_Delete = "Basket_Delete", e.Basket_DeleteAll = "Basket_DeleteAll", e.Basket_Rename = "Basket_Rename", e.Basket_AddDoc = "Basket_AddDoc", e.Basket_RemoveDoc = "Basket_RemoveDoc", e.Basket_Open = "Basket_Open", e.Basket_ExportCSV = "Basket_ExportCSV", e.Label_Add = "Label_Add", e.Label_Delete = "Label_Delete", e.Label_Rename = "Label_Rename", e.Label_Open = "Label_Open", e.Label_AddDoc = "Label_AddDoc", e.Label_RemoveDoc = "Label_RemoveDoc", e.Label_ExportCSV = "Label_ExportCSV", e.Label_Menu_ExportCSV = "Label_Menu_ExportCSV", e.Rating_Set = "Rating_Set", e.Rating_Delete = "Rating_Delete", e.Doc_Preview = "Doc_Preview", e.Doc_CacheHtml = "Doc_CacheHtml", e.Doc_CachePdf = "Doc_CachePdf", e.Doc_CacheOriginal = "Doc_CacheOriginal", e.Doc_Url1 = "Doc_Url1", e.Doc_Url2 = "Doc_Url2", e.Preview_Close = "Preview_Close", e.Click_ResultLink = "Click_ResultLink", e.Click_ResultLink1 = "Click_ResultLink1", e.Click_ResultLink2 = "Click_ResultLink2", e.Click_ResultLink3 = "Click_ResultLink3", e.Click_ResultLink4 = "Click_ResultLink4", e.Click_ResultLink5 = "Click_ResultLink5", e.Click_ResultLink6 = "Click_ResultLink6", e.Click_ResultLink7 = "Click_ResultLink7", e.Click_ResultLink8 = "Click_ResultLink8", e.Click_ResultLink9 = "Click_ResultLink9", e.Click_ResultLink10 = "Click_ResultLink10", e.Click_PreviewLink1 = "Click_PreviewLink1", e.Click_PreviewLink2 = "Click_PreviewLink2", e.Click_PreviewLink3 = "Click_PreviewLink3", e.Click_PreviewLink4 = "Click_PreviewLink4", e.Click_PreviewLink5 = "Click_PreviewLink5", e.Click_PreviewLink6 = "Click_PreviewLink6", e.Click_PreviewLink7 = "Click_PreviewLink7", e.Click_PreviewLink8 = "Click_PreviewLink8", e.Click_PreviewLink9 = "Click_PreviewLink9", e.Click_PreviewLink10 = "Click_PreviewLink10", e.RFM_ClickSet = "RFM_ClickSet", e.RFM_ClickReset = "RFM_ClickReset", e.RFM_Like = "RFM_Like", e.RFM_LikeReset = "RFM_LikeReset", e.RFM_Dislike = "RFM_Dislike", e.RFM_Important = "RFM_Important", e.RFM_ImportantReset = "RFM_ImportantReset", e.RFM_Ban = "RFM_Ban", e.Navigation_Exit = "Navigation_Exit", e.Navigation_Return = "Navigation_Return", e.Navigation_Route = "Navigation_Route", e.Answer_Display = "Answer_Display", e.Answer_Click = "Answer_Click", e.Answer_Result = "Answer_Result", e.Answer_Liked = "Answer_Liked", e.Answer_Disliked = "Answer_Disliked", e.Answer_Liked_Cancelled = "Answer_Liked_Cancelled", e.Answer_Disliked_Cancelled = "Answer_Disliked_Cancelled", e.TopPassages_Display = "TopPassages_Display", e.TopPassages_Click = "TopPassages_Click", e.UserSettings_Reset = "UserSettings_Reset", e))(v || {}), m = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.bool = 1] = "bool", e[e.date = 2] = "date", e[e.dateTime = 3] = "dateTime", e[e.time = 4] = "time", e[e.unsigned = 5] = "unsigned", e[e.integer = 6] = "integer", e[e.float = 7] = "float", e[e.double = 8] = "double", e[e.dates = 9] = "dates", e[e.dateTimes = 10] = "dateTimes", e[e.times = 11] = "times", e[e.varchar = 12] = "varchar", e[e.binary = 13] = "binary", e[e.string = 14] = "string", e[e.csv = 15] = "csv", e))(m || {}), g = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.a = 2053] = "a", e[e.c = 4] = "c", e[e.d = 8] = "d", e[e.e = 2068] = "e", e[e.i = 256] = "i", e[e.l = 2052] = "l", e[e.n = 8192] = "n", e[e.t = 524292] = "t", e[e.x = 8388608] = "x", e[e.z = 33554432] = "z", e[e.f_ordinal = 8192] = "f_ordinal", e[e.f_multidates = 8192] = "f_multidates", e[e.f_varchar = 33554432] = "f_varchar", e[e.f_binary = 33562624] = "f_binary", e[e.f_string = 33562888] = "f_string", e[e.f_csv = 42477853] = "f_csv", e[e.f_overridable = 33554696] = "f_overridable", e))(g || {});
557
- const It = "1.0";
558
- var ve = /* @__PURE__ */ ((e) => (e[e.Original = 0] = "Original", e[e.Corrected = 1] = "Corrected", e))(ve || {}), be = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.positiveRate = 1] = "positiveRate", e[e.mainlyPosRate = 2] = "mainlyPosRate", e[e.unrate = 4] = "unrate", e[e.mainlyNegRate = 8] = "mainlyNegRate", e[e.negativeRate = 16] = "negativeRate", e[e.all = 31] = "all", e[e.positiveOnly = 7] = "positiveOnly", e[e.negativeOnly = 28] = "negativeOnly", e[e.personalAll = 21] = "personalAll", e[e.personalPosOnly = 5] = "personalPosOnly", e[e.personalNegOnly = 20] = "personalNegOnly", e))(be || {});
559
- function Ce(e) {
545
+ var b = /* @__PURE__ */ ((e) => (e.None = "None", e.Search_FirstPage = "Search_FirstPage", e.Search_Text = "Search_Text", e.Search_Refine = "Search_Refine", e.Search_Select_Item = "Search_Select_Item", e.Search_Select_Custom = "Search_Select_Custom", e.Search_Select_Concept = "Search_Select_Concept", e.Search_Select_Correction = "Search_Select_Correction", e.Search_GotoPage = "Search_GotoPage", e.Search_GotoTab = "Search_GotoTab", e.Search_DisplayResult = "Search_DisplayResult", e.Search_RemoveResult = "Search_RemoveResult", e.Search_RemoveAdvanced = "Search_RemoveAdvanced", e.Search_SavedQuery = "Search_SavedQuery", e.Search_WebService = "Search_WebService", e.Search_DidYouMean_Original = "Search_DidYouMean_Original", e.Search_DidYouMean_Correction = "Search_DidYouMean_Correction", e.Search_ExportCSV = "Search_ExportCSV", e.Search_SavedQuery_ExportCSV = "Search_SavedQuery_ExportCSV", e.Search_Selection_ExportCSV = "Search_Selection_ExportCSV", e.Search_AlertQuery = "Search_AlertQuery", e.Search_Select_AnalyticsItem = "Search_Select_AnalyticsItem", e.Search_Sort = "Search_Sort", e.Search_Exit_Logout = "Search_Exit_Logout", e.Search_Timeline_Usage = "Search_Timeline_Usage", e.Search_AutoComplete = "Search_Autocomplete", e.Search_Login_Success = "Login_Success_Form", e.Search_QueryIntent_Detected = "Search_QueryIntent_Detected", e.SavedQuery_Add = "SavedQuery_Add", e.SavedQuery_Delete = "SavedQuery_Delete", e.SavedQuery_DeleteAll = "SavedQuery_DeleteAll", e.SavedQuery_Rename = "SavedQuery_Rename", e.Alert_Edit = "Alert_Edit", e.Alert_Delete = "Alert_Delete", e.Alert_DeleteAll = "Alert_DeleteAll", e.Link_Display = "Link_Display", e.Link_Click = "Link_Click", e.Basket_Add = "Basket_Add", e.Basket_Delete = "Basket_Delete", e.Basket_DeleteAll = "Basket_DeleteAll", e.Basket_Rename = "Basket_Rename", e.Basket_AddDoc = "Basket_AddDoc", e.Basket_RemoveDoc = "Basket_RemoveDoc", e.Basket_Open = "Basket_Open", e.Basket_ExportCSV = "Basket_ExportCSV", e.Label_Add = "Label_Add", e.Label_Delete = "Label_Delete", e.Label_Rename = "Label_Rename", e.Label_Open = "Label_Open", e.Label_AddDoc = "Label_AddDoc", e.Label_RemoveDoc = "Label_RemoveDoc", e.Label_ExportCSV = "Label_ExportCSV", e.Label_Menu_ExportCSV = "Label_Menu_ExportCSV", e.Rating_Set = "Rating_Set", e.Rating_Delete = "Rating_Delete", e.Doc_Preview = "Doc_Preview", e.Doc_CacheHtml = "Doc_CacheHtml", e.Doc_CachePdf = "Doc_CachePdf", e.Doc_CacheOriginal = "Doc_CacheOriginal", e.Doc_Url1 = "Doc_Url1", e.Doc_Url2 = "Doc_Url2", e.Preview_Close = "Preview_Close", e.Click_ResultLink = "Click_ResultLink", e.Click_ResultLink1 = "Click_ResultLink1", e.Click_ResultLink2 = "Click_ResultLink2", e.Click_ResultLink3 = "Click_ResultLink3", e.Click_ResultLink4 = "Click_ResultLink4", e.Click_ResultLink5 = "Click_ResultLink5", e.Click_ResultLink6 = "Click_ResultLink6", e.Click_ResultLink7 = "Click_ResultLink7", e.Click_ResultLink8 = "Click_ResultLink8", e.Click_ResultLink9 = "Click_ResultLink9", e.Click_ResultLink10 = "Click_ResultLink10", e.Click_PreviewLink1 = "Click_PreviewLink1", e.Click_PreviewLink2 = "Click_PreviewLink2", e.Click_PreviewLink3 = "Click_PreviewLink3", e.Click_PreviewLink4 = "Click_PreviewLink4", e.Click_PreviewLink5 = "Click_PreviewLink5", e.Click_PreviewLink6 = "Click_PreviewLink6", e.Click_PreviewLink7 = "Click_PreviewLink7", e.Click_PreviewLink8 = "Click_PreviewLink8", e.Click_PreviewLink9 = "Click_PreviewLink9", e.Click_PreviewLink10 = "Click_PreviewLink10", e.RFM_ClickSet = "RFM_ClickSet", e.RFM_ClickReset = "RFM_ClickReset", e.RFM_Like = "RFM_Like", e.RFM_LikeReset = "RFM_LikeReset", e.RFM_Dislike = "RFM_Dislike", e.RFM_Important = "RFM_Important", e.RFM_ImportantReset = "RFM_ImportantReset", e.RFM_Ban = "RFM_Ban", e.Navigation_Exit = "Navigation_Exit", e.Navigation_Return = "Navigation_Return", e.Navigation_Route = "Navigation_Route", e.Answer_Display = "Answer_Display", e.Answer_Click = "Answer_Click", e.Answer_Result = "Answer_Result", e.Answer_Liked = "Answer_Liked", e.Answer_Disliked = "Answer_Disliked", e.Answer_Liked_Cancelled = "Answer_Liked_Cancelled", e.Answer_Disliked_Cancelled = "Answer_Disliked_Cancelled", e.TopPassages_Display = "TopPassages_Display", e.TopPassages_Click = "TopPassages_Click", e.UserSettings_Reset = "UserSettings_Reset", e))(b || {}), h = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.bool = 1] = "bool", e[e.date = 2] = "date", e[e.dateTime = 3] = "dateTime", e[e.time = 4] = "time", e[e.unsigned = 5] = "unsigned", e[e.integer = 6] = "integer", e[e.float = 7] = "float", e[e.double = 8] = "double", e[e.dates = 9] = "dates", e[e.dateTimes = 10] = "dateTimes", e[e.times = 11] = "times", e[e.varchar = 12] = "varchar", e[e.binary = 13] = "binary", e[e.string = 14] = "string", e[e.csv = 15] = "csv", e))(h || {}), g = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.a = 2053] = "a", e[e.c = 4] = "c", e[e.d = 8] = "d", e[e.e = 2068] = "e", e[e.i = 256] = "i", e[e.l = 2052] = "l", e[e.n = 8192] = "n", e[e.t = 524292] = "t", e[e.x = 8388608] = "x", e[e.z = 33554432] = "z", e[e.f_ordinal = 8192] = "f_ordinal", e[e.f_multidates = 8192] = "f_multidates", e[e.f_varchar = 33554432] = "f_varchar", e[e.f_binary = 33562624] = "f_binary", e[e.f_string = 33562888] = "f_string", e[e.f_csv = 42477853] = "f_csv", e[e.f_overridable = 33554696] = "f_overridable", e))(g || {});
546
+ const Dt = "1.0";
547
+ var we = /* @__PURE__ */ ((e) => (e[e.Original = 0] = "Original", e[e.Corrected = 1] = "Corrected", e))(we || {}), _e = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.positiveRate = 1] = "positiveRate", e[e.mainlyPosRate = 2] = "mainlyPosRate", e[e.unrate = 4] = "unrate", e[e.mainlyNegRate = 8] = "mainlyNegRate", e[e.negativeRate = 16] = "negativeRate", e[e.all = 31] = "all", e[e.positiveOnly = 7] = "positiveOnly", e[e.negativeOnly = 28] = "negativeOnly", e[e.personalAll = 21] = "personalAll", e[e.personalPosOnly = 5] = "personalPosOnly", e[e.personalNegOnly = 20] = "personalNegOnly", e))(_e || {});
548
+ function Se(e) {
560
549
  if (!e)
561
- return m.none;
550
+ return h.none;
562
551
  switch (e.toLocaleLowerCase()) {
563
552
  case "bool":
564
553
  case "boolean":
565
- return m.bool;
554
+ return h.bool;
566
555
  case "date":
567
- return m.date;
556
+ return h.date;
568
557
  case "datetime":
569
- return m.dateTime;
558
+ return h.dateTime;
570
559
  case "time":
571
- return m.time;
560
+ return h.time;
572
561
  case "unsigned":
573
- return m.unsigned;
562
+ return h.unsigned;
574
563
  case "integer":
575
- return m.integer;
564
+ return h.integer;
576
565
  case "float":
577
- return m.float;
566
+ return h.float;
578
567
  case "double":
579
- return m.double;
568
+ return h.double;
580
569
  case "dates":
581
- return m.dates;
570
+ return h.dates;
582
571
  case "datetimes":
583
- return m.dateTimes;
572
+ return h.dateTimes;
584
573
  case "times":
585
- return m.times;
574
+ return h.times;
586
575
  case "varchar":
587
- return m.varchar;
576
+ return h.varchar;
588
577
  case "binary":
589
- return m.binary;
578
+ return h.binary;
590
579
  case "string":
591
- return m.string;
580
+ return h.string;
592
581
  case "csv":
593
- return m.csv;
582
+ return h.csv;
594
583
  default:
595
- return m.none;
584
+ return h.none;
596
585
  }
597
586
  }
598
- function Re(e) {
587
+ function ke(e) {
599
588
  switch (e) {
600
589
  case "a":
601
590
  return g.a;
@@ -621,41 +610,41 @@ function Re(e) {
621
610
  return g.none;
622
611
  }
623
612
  }
624
- function xe(e) {
613
+ function be(e) {
625
614
  let t = g.none;
626
615
  if (e)
627
616
  for (const r of e)
628
- t |= Re(r);
617
+ t |= ke(r);
629
618
  return t;
630
619
  }
631
- function _(e, t, r, n) {
632
- const a = Ce(t), s = xe(r || "");
620
+ function m(e, t, r, n) {
621
+ const a = Se(t), o = be(r || "");
633
622
  return {
634
623
  name: e,
635
624
  type: t,
636
625
  typeModifier: r,
637
626
  eType: a,
638
- eTypeModifier: s,
627
+ eTypeModifier: o,
639
628
  aliases: n
640
629
  };
641
630
  }
642
- const Dt = {
643
- id: _("id", "string"),
644
- text: _("text", "varchar"),
645
- documentlanguages: _("documentlanguages", "csv", "ci", ["language"]),
646
- databasealias: _("databasealias", "varchar"),
647
- globalrelevance: _("globalrelevance", "double"),
648
- matchingpartnames: _("matchingpartnames", "csv"),
649
- matchlocations: _("matchlocations", "csv"),
650
- matchlocationsperpartname: _("matchlocationsperpartname", "varchar"),
631
+ const It = {
632
+ id: m("id", "string"),
633
+ text: m("text", "varchar"),
634
+ documentlanguages: m("documentlanguages", "csv", "ci", ["language"]),
635
+ databasealias: m("databasealias", "varchar"),
636
+ globalrelevance: m("globalrelevance", "double"),
637
+ matchingpartnames: m("matchingpartnames", "csv"),
638
+ matchlocations: m("matchlocations", "csv"),
639
+ matchlocationsperpartname: m("matchlocationsperpartname", "varchar"),
651
640
  // json
652
- extracts: _("extracts", "csv"),
653
- extractsperpartname: _("extractsperpartname", "varchar"),
641
+ extracts: m("extracts", "csv"),
642
+ extractsperpartname: m("extractsperpartname", "varchar"),
654
643
  // json
655
- extractslocations: _("extractslocations", "csv"),
656
- documentweight: _("documentweight", "varchar"),
657
- groupcount: _("groupcount", "integer"),
658
- accesslists: _("accesslists", "varchar", void 0, ["accessLists"])
644
+ extractslocations: m("extractslocations", "csv"),
645
+ documentweight: m("documentweight", "varchar"),
646
+ groupcount: m("groupcount", "integer"),
647
+ accesslists: m("accesslists", "varchar", void 0, ["accessLists"])
659
648
  // json
660
649
  };
661
650
  function At(e, t) {
@@ -674,8 +663,8 @@ function Nt(e, t) {
674
663
  if (typeof a == "string")
675
664
  return { display: a.trim(), value: a.trim() };
676
665
  if (typeof a == "object" && a !== null && "display" in a) {
677
- const s = a.display.trim(), i = "value" in a ? String(a.value).trim() : s;
678
- return { display: s, value: i };
666
+ const o = a.display.trim(), s = "value" in a ? String(a.value).trim() : o;
667
+ return { display: o, value: s };
679
668
  }
680
669
  }).filter(
681
670
  (a) => a !== void 0
@@ -686,30 +675,36 @@ function Nt(e, t) {
686
675
  function A(e) {
687
676
  return e !== null && typeof e == "object";
688
677
  }
689
- function Pe(e) {
678
+ function ve(e) {
690
679
  return A(e) && Object.prototype.toString.call(e) === "[object ArrayBuffer]";
691
680
  }
692
- function Le(e) {
681
+ function Ce(e) {
693
682
  return A(e) && Object.prototype.toString.call(e) === "[object Blob]";
694
683
  }
684
+ function Re(e) {
685
+ return Object.prototype.toString.call(e) === "[object Date]";
686
+ }
695
687
  function ye(e) {
696
688
  return typeof e == "string";
697
689
  }
698
- function Ft(e) {
699
- return (A(e) || Array.isArray(e)) && !Pe(e) && !Le(e) && !ye(e);
690
+ function qt(e) {
691
+ return (A(e) || Array.isArray(e)) && !ve(e) && !Ce(e) && !ye(e);
700
692
  }
701
- function Oe(e = !0) {
693
+ function Pe(e) {
694
+ return e ? (e.getHours() * 60 * 60 + e.getMinutes() * 60 + e.getSeconds()) * 1e3 + e.getMilliseconds() : 0;
695
+ }
696
+ function xe(e = !0) {
702
697
  let t = Date.now();
703
698
  return (e ? "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" : "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx").replace(/[xy]/g, (n) => {
704
699
  const a = (t + Math.random() * 16) % 16 | 0;
705
700
  return t = Math.floor(t / 16), (n === "x" ? a : a & 3 | 8).toString(16);
706
701
  });
707
702
  }
708
- function Bt(e) {
703
+ function Ft(e) {
709
704
  if (!e)
710
705
  return "``";
711
706
  if (e = String(e), e.search(/[\\`]/) === -1)
712
- return "`" + e + "`";
707
+ return `\`${e}\``;
713
708
  const t = ["`"];
714
709
  for (let r = 0, n = e.length; r < n; r++) {
715
710
  const a = e[r];
@@ -717,28 +712,30 @@ function Bt(e) {
717
712
  }
718
713
  return t.push("`"), t.join("");
719
714
  }
720
- function qt(e) {
715
+ function Bt(e) {
721
716
  if (typeof crypto < "u" && crypto.subtle && typeof crypto.subtle.digest == "function")
722
717
  try {
723
- return crypto.subtle.digest("SHA-512", new TextEncoder().encode(e)).then((t) => Array.prototype.map.call(new Uint8Array(t), (r) => ("00" + r.toString(16)).slice(-2)).join("")).catch(() => Promise.resolve(Q(e)));
718
+ return crypto.subtle.digest("SHA-512", new TextEncoder().encode(e)).then(
719
+ (t) => Array.prototype.map.call(new Uint8Array(t), (r) => `00${r.toString(16)}`.slice(-2)).join("")
720
+ ).catch(() => Promise.resolve(F(e)));
724
721
  } catch {
725
- return Promise.resolve(Q(e));
722
+ return Promise.resolve(F(e));
726
723
  }
727
- return Promise.resolve(Q(e));
724
+ return Promise.resolve(F(e));
728
725
  }
729
- function Q(e) {
726
+ function F(e) {
730
727
  let n = 2166136261;
731
- for (let f = 0; f < e.length; f++)
732
- n ^= e.charCodeAt(f), n = n * 16777619 >>> 0;
733
- const a = n.toString(16).padStart(8, "0"), s = ((n ^ 2863311530) >>> 0).toString(16).padStart(8, "0"), i = ((n ^ 1431655765) >>> 0).toString(16).padStart(8, "0"), o = ((n ^ 3435973836) >>> 0).toString(16).padStart(8, "0"), c = a + s + i + o;
734
- return (c + c + c + c).substring(0, 128);
728
+ for (let _ = 0; _ < e.length; _++)
729
+ n ^= e.charCodeAt(_), n = n * 16777619 >>> 0;
730
+ const a = n.toString(16).padStart(8, "0"), o = ((n ^ 2863311530) >>> 0).toString(16).padStart(8, "0"), s = ((n ^ 1431655765) >>> 0).toString(16).padStart(8, "0"), c = ((n ^ 3435973836) >>> 0).toString(16).padStart(8, "0"), i = a + o + s + c;
731
+ return (i + i + i + i).substring(0, 128);
735
732
  }
736
- let V, oe;
737
- function y(e, t = !0) {
738
- let r = $e(e.$auditRecord);
739
- r && (Ue(r), t && Ie(r)), e.$auditRecord = r;
733
+ let B, te;
734
+ function L(e, t = !0) {
735
+ let r = Le(e.$auditRecord);
736
+ r && (Oe(r), t && $e(r)), e.$auditRecord = r;
740
737
  }
741
- function $e(e) {
738
+ function Le(e) {
742
739
  if (!e)
743
740
  return;
744
741
  let t;
@@ -752,57 +749,54 @@ function $e(e) {
752
749
  }
753
750
  return { auditEvents: t };
754
751
  }
755
- function Ue(e) {
756
- var r;
757
- const t = De();
758
- return (r = e.auditEvents) == null || r.forEach((n) => {
759
- n.detail || (n.detail = {}), n.detail.sessionid = t;
752
+ function Oe(e) {
753
+ const t = Ue();
754
+ return e.auditEvents?.forEach((r) => {
755
+ r.detail || (r.detail = {}), r.detail.sessionid = t;
760
756
  }), e;
761
757
  }
762
- function Ie(e) {
763
- var r;
758
+ function $e(e) {
764
759
  const t = typeof window < "u" ? decodeURIComponent(window.location.href) : "http://localhost";
765
- return (r = e == null ? void 0 : e.auditEvents) == null || r.forEach((n) => {
766
- n.detail || (n.detail = {}), n.detail.url = t;
760
+ return e?.auditEvents?.forEach((r) => {
761
+ r.detail || (r.detail = {}), r.detail.url = t;
767
762
  }), e;
768
763
  }
769
- function De() {
770
- return (!V || Ae()) && (V = Oe()), oe = /* @__PURE__ */ new Date(), V;
764
+ function Ue() {
765
+ return (!B || De()) && (B = xe()), te = /* @__PURE__ */ new Date(), B;
771
766
  }
772
- function Ae() {
773
- return (/* @__PURE__ */ new Date()).getTime() - oe.getTime() > 10 * 60 * 1e3;
767
+ function De() {
768
+ return (/* @__PURE__ */ new Date()).getTime() - te.getTime() > 600 * 1e3;
774
769
  }
775
- async function Ne(e, t = !0) {
770
+ async function Ie(e, t = !0) {
776
771
  const r = {
777
- event: v.None,
772
+ event: b.None,
778
773
  $auditRecord: e
779
774
  };
780
- return y(r, t), u("api/v1/audit.notify", r);
775
+ return L(r, t), l("api/v1/audit.notify", r);
781
776
  }
782
- const Qt = { notify: Ne };
783
- async function Vt(e, t, r) {
784
- var f;
785
- const n = ((f = e.items) == null ? void 0 : f.length) || 0, a = 10, s = {
777
+ const jt = { notify: Ie };
778
+ async function Qt(e, t, r) {
779
+ const n = e.items?.length || 0, a = 10, o = {
786
780
  query: { ...t, action: "aggregate", aggregations: { [e.name]: { skip: n, count: a } } },
787
781
  $auditRecord: { auditEvents: [r] }
788
782
  };
789
- y(s);
790
- const i = await u("api/v1/query", s), o = await C(i), { aggregations: c } = o, l = c[0];
791
- return l.$hasMore = l.items.length > a, l.items = [...e.items, ...l.items], Promise.resolve(l);
783
+ L(o);
784
+ const s = await l("api/v1/query", o), c = await C(s), { aggregations: i } = c, d = i[0];
785
+ return d.$hasMore = d.items.length > a, d.items = [...e.items, ...d.items], Promise.resolve(d);
792
786
  }
793
- async function Gt() {
794
- const { app: e } = d, t = new URLSearchParams({ app: e || "" });
795
- return p("api/v1/app", t);
787
+ async function Vt() {
788
+ const { app: e } = u, t = new URLSearchParams({ app: e || "" });
789
+ return w("api/v1/app", t);
796
790
  }
797
- async function Fe() {
798
- const { app: e } = d, t = new URLSearchParams({
791
+ async function Ae() {
792
+ const { app: e } = u, t = new URLSearchParams({
799
793
  app: e || "",
800
794
  preLogin: "true"
801
795
  });
802
- return p("api/v1/app", t);
796
+ return w("api/v1/app", t);
803
797
  }
804
- function jt() {
805
- let { backendUrl: e, app: t, useCredentials: r } = d;
798
+ function Gt() {
799
+ let { backendUrl: e, app: t, useCredentials: r } = u;
806
800
  if (typeof window < "u") {
807
801
  if (e || (e = window.location.origin), !t) {
808
802
  const n = window.location.pathname.match(
@@ -811,48 +805,48 @@ function jt() {
811
805
  n && (t = n[1]);
812
806
  }
813
807
  k({
814
- ...d,
808
+ ...u,
815
809
  backendUrl: e,
816
810
  app: t
817
811
  });
818
812
  }
819
813
  return r ? (k({
820
- ...d,
814
+ ...u,
821
815
  useCredentials: !0,
822
816
  useSSO: !1,
823
817
  autoOAuthProvider: void 0,
824
818
  autoSAMLProvider: void 0,
825
819
  bearerToken: void 0,
826
820
  useSAML: void 0
827
- }), Promise.resolve({})) : Fe().then((n) => {
828
- const { autoOAuthProvider: a, autoSAMLProvider: s } = d, i = !a && !n.autoOAuthProvider && !s && !n.autoSAMLProvider;
821
+ }), Promise.resolve({})) : Ae().then((n) => {
822
+ const { autoOAuthProvider: a, autoSAMLProvider: o } = u, s = !a && !n.autoOAuthProvider && !o && !n.autoSAMLProvider;
829
823
  return k({
830
- ...d,
824
+ ...u,
831
825
  autoOAuthProvider: a || n.autoOAuthProvider,
832
- autoSAMLProvider: s || n.autoSAMLProvider,
833
- useCredentials: i,
834
- useSSO: i
826
+ autoSAMLProvider: o || n.autoSAMLProvider,
827
+ useCredentials: s,
828
+ useSSO: s
835
829
  }), n;
836
830
  }).catch((n) => {
837
- throw h("atomic:fetchAppPreLogin error", n), n;
831
+ throw f("atomic:fetchAppPreLogin error", n), n;
838
832
  });
839
833
  }
840
834
  async function zt(e, t, r = {}) {
841
- const n = `api/v1/search.dataset/${e}/${t}`, a = await u(n, { parameters: r }), s = t[0].toLowerCase() + t.slice(1), i = a.datasets[s];
842
- if ("errorCode" in i && "errorMessage" in i)
843
- throw new Error(i.errorMessage);
844
- return i;
835
+ const n = `api/v1/search.dataset/${e}/${t}`, a = await l(n, { parameters: r }), o = t[0].toLowerCase() + t.slice(1), s = a.datasets[o];
836
+ if ("errorCode" in s && "errorMessage" in s)
837
+ throw new Error(s.errorMessage);
838
+ return s;
845
839
  }
846
840
  async function Ht(e, t) {
847
841
  const r = `api/v1/search.dataset/${e}`, { parameters: n = {}, datasets: a = [] } = t;
848
- return (await u(r, { parameters: n, datasets: a })).datasets;
842
+ return (await l(r, { parameters: n, datasets: a })).datasets;
849
843
  }
850
844
  async function Jt(e) {
851
- return await p(`api/v1/search.dataset/${e}`);
845
+ return await w(`api/v1/search.dataset/${e}`);
852
846
  }
853
847
  async function Wt(e, t = !0, r) {
854
848
  try {
855
- return (await u("api/v1/labels", {
849
+ return (await l("api/v1/labels", {
856
850
  action: "list",
857
851
  q: e,
858
852
  public: t,
@@ -860,18 +854,18 @@ async function Wt(e, t = !0, r) {
860
854
  localize: !1
861
855
  })).labels;
862
856
  } catch (n) {
863
- throw h("Error in fetchLabels", n), n;
857
+ throw f("Error in fetchLabels", n), n;
864
858
  }
865
859
  }
866
- async function Be() {
860
+ async function Ne() {
867
861
  try {
868
- const { app: e = "" } = d, t = new URLSearchParams({
862
+ const { app: e = "" } = u, t = new URLSearchParams({
869
863
  app: e,
870
864
  action: "getUserRights"
871
865
  });
872
- return p("api/v1/labels", t);
866
+ return w("api/v1/labels", t);
873
867
  } catch (e) {
874
- throw h("Error in getUserRights", e), e;
868
+ throw f("Error in getUserRights", e), e;
875
869
  }
876
870
  }
877
871
  async function qe(e, t, r = !0) {
@@ -884,7 +878,7 @@ async function qe(e, t, r = !0) {
884
878
  $auditRecord: {
885
879
  auditEvents: [
886
880
  {
887
- type: v.Label_AddDoc,
881
+ type: b.Label_AddDoc,
888
882
  detail: {
889
883
  public: r,
890
884
  label: e ? e.toString() : null,
@@ -900,12 +894,12 @@ async function qe(e, t, r = !0) {
900
894
  ]
901
895
  }
902
896
  };
903
- return u("api/v1/labels", n);
897
+ return l("api/v1/labels", n);
904
898
  } catch (n) {
905
- throw h("Error in add", n), n;
899
+ throw f("Error in add", n), n;
906
900
  }
907
901
  }
908
- async function Qe(e, t, r = !0) {
902
+ async function Fe(e, t, r = !0) {
909
903
  try {
910
904
  const n = {
911
905
  action: "remove",
@@ -915,7 +909,7 @@ async function Qe(e, t, r = !0) {
915
909
  $auditRecord: {
916
910
  auditEvents: [
917
911
  {
918
- type: v.Label_RemoveDoc,
912
+ type: b.Label_RemoveDoc,
919
913
  detail: {
920
914
  public: r,
921
915
  label: e ? e.toString() : null,
@@ -931,12 +925,12 @@ async function Qe(e, t, r = !0) {
931
925
  ]
932
926
  }
933
927
  };
934
- return u("api/v1/labels", n);
928
+ return l("api/v1/labels", n);
935
929
  } catch (n) {
936
- throw h("Error in remove", n), n;
930
+ throw f("Error in remove", n), n;
937
931
  }
938
932
  }
939
- async function Ve(e, t, r = !0) {
933
+ async function Be(e, t, r = !0) {
940
934
  try {
941
935
  const n = {
942
936
  action: "rename",
@@ -944,7 +938,7 @@ async function Ve(e, t, r = !0) {
944
938
  newLabel: t,
945
939
  public: r,
946
940
  auditEvents: {
947
- type: v.Label_Rename,
941
+ type: b.Label_Rename,
948
942
  detail: {
949
943
  public: r,
950
944
  oldlabel: e ? e.toString() : null,
@@ -952,31 +946,31 @@ async function Ve(e, t, r = !0) {
952
946
  }
953
947
  }
954
948
  };
955
- return u("api/v1/labels", n);
949
+ return l("api/v1/labels", n);
956
950
  } catch (n) {
957
- throw h("Error in rename", n), n;
951
+ throw f("Error in rename", n), n;
958
952
  }
959
953
  }
960
- async function Ge(e, t = !0) {
954
+ async function je(e, t = !0) {
961
955
  try {
962
956
  const r = {
963
957
  action: "delete",
964
958
  labels: e,
965
959
  public: t,
966
960
  auditEvents: {
967
- type: v.Label_Delete,
961
+ type: b.Label_Delete,
968
962
  detail: {
969
963
  public: t,
970
964
  label: e ? e.toString() : null
971
965
  }
972
966
  }
973
967
  };
974
- return u("api/v1/labels", r);
968
+ return l("api/v1/labels", r);
975
969
  } catch (r) {
976
- throw h("Error in deleteLabels", r), r;
970
+ throw f("Error in deleteLabels", r), r;
977
971
  }
978
972
  }
979
- async function je(e, t, r = !0) {
973
+ async function Qe(e, t, r = !0) {
980
974
  try {
981
975
  const n = {
982
976
  action: "bulkAdd",
@@ -984,7 +978,7 @@ async function je(e, t, r = !0) {
984
978
  query: t,
985
979
  public: r,
986
980
  auditEvents: {
987
- type: v.Label_Add,
981
+ type: b.Label_Add,
988
982
  detail: {
989
983
  public: r,
990
984
  label: e ? e.toString() : null,
@@ -992,12 +986,12 @@ async function je(e, t, r = !0) {
992
986
  }
993
987
  }
994
988
  };
995
- return u("api/v1/labels", n);
989
+ return l("api/v1/labels", n);
996
990
  } catch (n) {
997
- throw h("Error in bulkAdd", n), n;
991
+ throw f("Error in bulkAdd", n), n;
998
992
  }
999
993
  }
1000
- async function ze(e, t, r = !0) {
994
+ async function Ve(e, t, r = !0) {
1001
995
  try {
1002
996
  const n = {
1003
997
  action: "bulkRemove",
@@ -1005,7 +999,7 @@ async function ze(e, t, r = !0) {
1005
999
  query: t,
1006
1000
  public: r,
1007
1001
  auditEvents: {
1008
- type: v.Label_Delete,
1002
+ type: b.Label_Delete,
1009
1003
  detail: {
1010
1004
  public: r,
1011
1005
  label: e ? e.toString() : null,
@@ -1013,29 +1007,29 @@ async function ze(e, t, r = !0) {
1013
1007
  }
1014
1008
  }
1015
1009
  };
1016
- return u("api/v1/labels", n);
1010
+ return l("api/v1/labels", n);
1017
1011
  } catch (n) {
1018
- throw h("Error in bulkRemove", n), n;
1012
+ throw f("Error in bulkRemove", n), n;
1019
1013
  }
1020
1014
  }
1021
- const Xt = {
1022
- getUserRights: Be,
1015
+ const Mt = {
1016
+ getUserRights: Ne,
1023
1017
  add: qe,
1024
- remove: Qe,
1025
- rename: Ve,
1026
- delete: Ge,
1027
- bulkAdd: je,
1028
- bulkRemove: ze
1018
+ remove: Fe,
1019
+ rename: Be,
1020
+ delete: je,
1021
+ bulkAdd: Qe,
1022
+ bulkRemove: Ve
1029
1023
  };
1030
- async function Mt(e, t) {
1024
+ async function Xt(e, t) {
1031
1025
  if (typeof window > "u")
1032
- return u("api/v1/preview", {
1026
+ return l("api/v1/preview", {
1033
1027
  action: "get",
1034
1028
  id: e,
1035
1029
  query: t
1036
1030
  });
1037
- const r = `${window.location.origin}${window.location.pathname}`, n = { name: t == null ? void 0 : t.name, text: t == null ? void 0 : t.text };
1038
- return u("api/v1/preview", {
1031
+ const r = `${window.location.origin}${window.location.pathname}`, n = { name: t?.name, text: t?.text };
1032
+ return l("api/v1/preview", {
1039
1033
  action: "get",
1040
1034
  id: e,
1041
1035
  query: n,
@@ -1054,68 +1048,99 @@ async function Yt(e) {
1054
1048
  );
1055
1049
  C(r);
1056
1050
  }
1057
- async function He() {
1051
+ async function re() {
1058
1052
  const e = new URLSearchParams({
1059
1053
  action: "get",
1060
1054
  noAutoAuthentication: "true"
1061
1055
  });
1062
- return p("api/v1/principal", e);
1056
+ return w("api/v1/principal", e);
1063
1057
  }
1064
- const ce = 11;
1065
- async function Kt(e, t, r) {
1066
- var i;
1067
- const a = await u("api/v1/query", {
1058
+ async function Ge(e) {
1059
+ const t = {
1060
+ noAutoAuthentication: "true",
1061
+ ...e
1062
+ }, r = new URLSearchParams();
1063
+ return Object.entries(t).forEach(([n, a]) => {
1064
+ a !== void 0 && r.append(n, String(a));
1065
+ }), w("api/v1/principal/list", r);
1066
+ }
1067
+ async function ze(e) {
1068
+ if (!e)
1069
+ return Promise.reject(new Error("userid is required"));
1070
+ const t = new URLSearchParams({
1071
+ action: "userid",
1072
+ noAutoAuthentication: "true",
1073
+ userid: e
1074
+ });
1075
+ return w("api/v1/principal", t);
1076
+ }
1077
+ async function He(e) {
1078
+ if (e.length === 0)
1079
+ return Promise.reject(new Error("userids is required"));
1080
+ const t = new URLSearchParams({
1081
+ noAutoAuthentication: "true",
1082
+ userids: [...e].join(",")
1083
+ });
1084
+ return w("api/v1/principal/userids", t);
1085
+ }
1086
+ const Kt = {
1087
+ principal: {
1088
+ get: re,
1089
+ list: Ge,
1090
+ userid: ze,
1091
+ userids: He
1092
+ }
1093
+ }, ne = 11;
1094
+ async function Zt(e, t, r) {
1095
+ const a = await l("api/v1/query", {
1068
1096
  query: e,
1069
1097
  $auditRecord: t,
1070
1098
  queryIntentData: r
1071
1099
  });
1072
- a.aggregations.forEach((o) => {
1073
- o.$hasMore = !1, !o.isDistribution && !o.isTree && o.items && (o.$hasMore = o.items.length === ce), o.isTree && o.items && z(o);
1074
- }), (i = a.records) == null || i.map((o) => Object.assign(o, { value: o.title, type: "default" }));
1075
- const s = { ...a, nextPage: a.page < Math.ceil(a.rowCount / a.pageSize) ? a.page + 1 : void 0, previousPage: a.page > 1 ? a.page - 1 : void 0 };
1076
- return Promise.resolve(s);
1077
- }
1078
- async function Zt(e, t, r) {
1079
- const { app: n = "" } = d, a = {
1100
+ a.aggregations.forEach((s) => {
1101
+ s.$hasMore = !1, !s.isDistribution && !s.isTree && s.items && (s.$hasMore = s.items.length === ne), s.isTree && s.items && V(s);
1102
+ }), a.records?.map((s) => Object.assign(s, { value: s.title, type: "default" }));
1103
+ const o = { ...a, nextPage: a.page < Math.ceil(a.rowCount / a.pageSize) ? a.page + 1 : void 0, previousPage: a.page > 1 ? a.page - 1 : void 0 };
1104
+ return Promise.resolve(o);
1105
+ }
1106
+ async function Et(e, t, r) {
1107
+ const { app: n = "" } = u, a = {
1080
1108
  methods: [],
1081
1109
  mode: t,
1082
1110
  propagateErrors: !0,
1083
1111
  $auditRecord: { auditEvents: [r] }
1084
1112
  };
1085
- for (const o of e)
1113
+ for (const c of e)
1086
1114
  a.methods.push({
1087
1115
  method: "query",
1088
1116
  app: n,
1089
- query: o
1117
+ query: c
1090
1118
  });
1091
- const s = await u("api/v1/multi", a);
1092
- s.results.forEach((o) => {
1093
- o.aggregations.forEach((c) => {
1094
- c.$hasMore = !1, !c.isDistribution && !c.isTree && c.items && (c.$hasMore = c.items.length === ce), c.isTree && z(c);
1119
+ const o = await l("api/v1/multi", a);
1120
+ o.results.forEach((c) => {
1121
+ c.aggregations.forEach((i) => {
1122
+ i.$hasMore = !1, !i.isDistribution && !i.isTree && i.items && (i.$hasMore = i.items.length === ne), i.isTree && V(i);
1095
1123
  });
1096
- }), s.results.forEach((o) => {
1097
- var c;
1098
- return (c = o.records) == null ? void 0 : c.map((l) => Object.assign(l, { value: l.title, type: "default" }));
1099
- });
1100
- const i = s.results.map((o) => ({ ...o, nextPage: o.page < Math.ceil(o.rowCount / o.pageSize) ? o.page + 1 : void 0, previousPage: o.page > 1 ? o.page - 1 : void 0 }));
1101
- return Promise.resolve(i);
1124
+ }), o.results.forEach((c) => c.records?.map((i) => Object.assign(i, { value: i.title, type: "default" })));
1125
+ const s = o.results.map((c) => ({ ...c, nextPage: c.page < Math.ceil(c.rowCount / c.pageSize) ? c.page + 1 : void 0, previousPage: c.page > 1 ? c.page - 1 : void 0 }));
1126
+ return Promise.resolve(s);
1102
1127
  }
1103
- function z(e, t = "", r = 0) {
1128
+ function V(e, t = "", r = 0) {
1104
1129
  let n = [];
1105
1130
  return e.items && e.items.forEach((a) => {
1106
- let s = t ? `${t}/${a.value}` : a.value, i = r + 1;
1107
- n.push({ path: s, level: i }), a.$path = s, a.$level = i, a.hasChildren ? n = n.concat(z(a, s, i)) : a.hasChildren = !1;
1131
+ let o = t ? `${t}/${a.value}` : a.value, s = r + 1;
1132
+ n.push({ path: o, level: s }), a.$path = o, a.$level = s, a.hasChildren ? n = n.concat(V(a, o, s)) : a.hasChildren = !1;
1108
1133
  }), n;
1109
1134
  }
1110
- async function Et({ model: e, appName: t, query: r, article: n }) {
1111
- const { webservice: a, format: s, maxcount: i, exportedColumns: o, export: c } = e, l = {
1135
+ async function Tt({ model: e, appName: t, query: r, article: n }) {
1136
+ const { webservice: a, format: o, maxcount: s, exportedColumns: c, export: i } = e, d = {
1112
1137
  app: t,
1113
1138
  webservice: a,
1114
1139
  query: r,
1115
- type: c,
1116
- format: s,
1117
- maxcount: i,
1118
- exportedColumns: o,
1140
+ type: i,
1141
+ format: o,
1142
+ maxcount: s,
1143
+ exportedColumns: c,
1119
1144
  $auditRecord: {
1120
1145
  auditEvents: [{
1121
1146
  type: "Search_ExportCSV",
@@ -1125,16 +1150,15 @@ async function Et({ model: e, appName: t, query: r, article: n }) {
1125
1150
  }]
1126
1151
  }
1127
1152
  };
1128
- return y(l), await u("api/v1/search.queryexport", l, { responseType: "blob" });
1153
+ return L(d), await l("api/v1/search.queryexport", d, { responseType: "blob" });
1129
1154
  }
1130
- async function Tt(e) {
1131
- const r = await u("api/v1/queryintent", {
1155
+ async function er(e) {
1156
+ return (await l("api/v1/queryintent", {
1132
1157
  query: e
1133
- });
1134
- return r == null ? void 0 : r.intents;
1158
+ }))?.intents;
1135
1159
  }
1136
- async function er(e, t, r) {
1137
- return (await u(
1160
+ async function tr(e, t, r) {
1161
+ return (await l(
1138
1162
  "api/v1/similardocuments",
1139
1163
  {
1140
1164
  sourceDocumentId: e,
@@ -1145,17 +1169,55 @@ async function er(e, t, r) {
1145
1169
  { signal: r }
1146
1170
  )).data;
1147
1171
  }
1148
- async function tr(e, t) {
1149
- var a;
1150
- const n = await u("api/v1/query.links", {
1172
+ async function rr(e, t) {
1173
+ return (await l("api/v1/query.links", {
1151
1174
  webservice: e,
1152
1175
  query: t
1153
- });
1154
- return (a = n == null ? void 0 : n.links) == null ? void 0 : a.map((s) => ({ ...s, query: t }));
1176
+ }))?.links?.map((a) => ({ ...a, query: t }));
1177
+ }
1178
+ function Je(e, t) {
1179
+ if (typeof e == "number")
1180
+ return `${e}`;
1181
+ if (Re(e))
1182
+ return We(e);
1183
+ if (typeof e == "boolean")
1184
+ return e ? "true" : "false";
1185
+ if (e === null)
1186
+ return "null";
1187
+ if (Array.isArray(e)) {
1188
+ const r = [];
1189
+ return e.forEach((n) => {
1190
+ r.length > 0 && r.push(","), n ? typeof n == "string" ? r.push(n) : r.push(n.display || n.value || "") : r.push("null");
1191
+ }), r.splice(0, 0, "["), r.push("]"), r.join("");
1192
+ }
1193
+ return e;
1194
+ }
1195
+ function We(e) {
1196
+ if (!e)
1197
+ return "";
1198
+ try {
1199
+ if (Pe(e) === 0)
1200
+ return new Intl.DateTimeFormat("en-CA", {
1201
+ year: "numeric",
1202
+ month: "2-digit",
1203
+ day: "2-digit"
1204
+ }).format(e);
1205
+ {
1206
+ const t = new Intl.DateTimeFormat("en-CA").format(e), r = new Intl.DateTimeFormat("en-CA", {
1207
+ hour: "2-digit",
1208
+ minute: "2-digit",
1209
+ second: "2-digit",
1210
+ hour12: !1
1211
+ }).format(e);
1212
+ return `${t} ${r}`;
1213
+ }
1214
+ } catch {
1215
+ return "Invalid date";
1216
+ }
1155
1217
  }
1156
- async function rr(e, t, r, n, a) {
1157
- const { app: s } = d, i = {
1158
- app: s || "",
1218
+ async function nr(e, t, r, n, a) {
1219
+ const { app: o } = u, s = {
1220
+ app: o || "",
1159
1221
  suggestQuery: e,
1160
1222
  text: t,
1161
1223
  filter: r,
@@ -1163,55 +1225,66 @@ async function rr(e, t, r, n, a) {
1163
1225
  showSource: a
1164
1226
  };
1165
1227
  try {
1166
- return (await u("api/v1/search.suggest", i)).suggests;
1167
- } catch (o) {
1168
- throw console.error("Error fetching suggestions:", o), o;
1228
+ return (await l(
1229
+ "api/v1/search.suggest",
1230
+ s
1231
+ )).suggests;
1232
+ } catch (c) {
1233
+ throw console.error("Error fetching suggestions:", c), c;
1169
1234
  }
1170
1235
  }
1171
- async function nr(e, t, r, n) {
1172
- const { app: a } = d;
1173
- return (await u("api/v1/suggestquery", {
1174
- app: a || "",
1175
- suggestQuery: e,
1176
- text: t,
1177
- query: r,
1178
- kinds: n
1179
- })).suggests;
1236
+ async function ar(e, t, r, n) {
1237
+ const { app: a } = u;
1238
+ return (await l(
1239
+ "api/v1/suggestquery",
1240
+ {
1241
+ app: a || "",
1242
+ suggestQuery: e,
1243
+ text: t,
1244
+ query: r,
1245
+ kinds: n
1246
+ }
1247
+ )).suggests;
1180
1248
  }
1181
- async function ar(e, t) {
1249
+ async function or(e, t, r) {
1182
1250
  if (!t) return Promise.resolve([]);
1183
- const { app: r } = d;
1184
- return (await u("api/v1/suggestfield", {
1185
- app: r || "",
1186
- text: e,
1187
- action: "suggests",
1188
- fields: t
1189
- })).suggests;
1190
- }
1191
- async function sr(e, t, r, n, a, s) {
1192
- return u("api/v1/doc.textchunks", {
1251
+ const { app: n } = u, o = await l(
1252
+ "api/v1/suggestfield",
1253
+ {
1254
+ app: n || "",
1255
+ text: e,
1256
+ fields: t,
1257
+ query: r
1258
+ }
1259
+ );
1260
+ return o.suggests.forEach((s) => {
1261
+ s.display = Je(s.display);
1262
+ }), o.suggests;
1263
+ }
1264
+ async function sr(e, t, r, n, a, o) {
1265
+ return l("api/v1/doc.textchunks", {
1193
1266
  id: e,
1194
1267
  textChunks: t,
1195
1268
  highlights: r,
1196
1269
  query: n,
1197
1270
  leftSentencesCount: a,
1198
- rightSentencesCount: s
1271
+ rightSentencesCount: o
1199
1272
  });
1200
1273
  }
1201
- async function or() {
1202
- const { app: e } = d, t = new URLSearchParams({
1274
+ async function ir() {
1275
+ const { app: e } = u, t = new URLSearchParams({
1203
1276
  app: e || "",
1204
1277
  action: "load"
1205
1278
  });
1206
- return p("api/v1/usersettings", t);
1279
+ return w("api/v1/usersettings", t);
1207
1280
  }
1208
- async function Je(e, t) {
1281
+ async function Me(e, t) {
1209
1282
  const r = {
1210
1283
  action: "save",
1211
1284
  userSettings: e,
1212
1285
  $auditRecord: { auditEvents: [t] }
1213
1286
  };
1214
- return y(r), u("api/v1/usersettings", r);
1287
+ return L(r), l("api/v1/usersettings", r);
1215
1288
  }
1216
1289
  async function cr(e, t) {
1217
1290
  const n = {
@@ -1219,28 +1292,49 @@ async function cr(e, t) {
1219
1292
  userSettings: e,
1220
1293
  $auditRecord: t ? { auditEvents: [t] } : void 0
1221
1294
  };
1222
- return y(n), u("api/v1/usersettings", n);
1295
+ return L(n), l("api/v1/usersettings", n);
1223
1296
  }
1224
- async function ir() {
1225
- return Je({}, { type: "UserSettings_Reset" });
1297
+ async function lr() {
1298
+ return Me({}, { type: "UserSettings_Reset" });
1226
1299
  }
1227
- async function lr(e, t) {
1228
- return u("api/v2/security/password/change", { newPassword: e, currentPassword: t });
1300
+ async function ur(e, t) {
1301
+ return l("api/v2/security/password/change", { newPassword: e, currentPassword: t });
1229
1302
  }
1230
- async function ur(e) {
1303
+ async function dr(e) {
1231
1304
  const t = "api/v2/security/password/ask-reset-email", n = {
1232
1305
  changePasswordRedirectUrl: `${window.location.origin}/login?mode=changepassword`,
1233
1306
  userName: e
1234
1307
  };
1235
- return u(t, n);
1308
+ return l(t, n);
1309
+ }
1310
+ async function fr(e) {
1311
+ return await w(`api/v2/user-profile/${e}`);
1312
+ }
1313
+ async function hr(e) {
1314
+ return await l("api/v2/user-profile", e);
1315
+ }
1316
+ async function mr(e, t, r) {
1317
+ return await ge(
1318
+ `api/v2/user-profile/${e.data?.id}/${t}/${r}`,
1319
+ e
1320
+ );
1236
1321
  }
1237
- async function dr() {
1238
- return await p("api/v2/version");
1322
+ async function pr(e, t, r) {
1323
+ try {
1324
+ return (await pe(
1325
+ `api/v2/user-profile/${e.data?.id}/${t}/${r}`
1326
+ )).success === !0;
1327
+ } catch {
1328
+ return !1;
1329
+ }
1330
+ }
1331
+ async function gr() {
1332
+ return await w("api/v2/version");
1239
1333
  }
1240
- const We = async () => {
1241
- const { autoOAuthProvider: e } = d;
1334
+ const Xe = async () => {
1335
+ const { autoOAuthProvider: e } = u;
1242
1336
  if (typeof window > "u")
1243
- return u("security.oauth", {
1337
+ return l("security.oauth", {
1244
1338
  action: "getcode",
1245
1339
  provider: e,
1246
1340
  tokenInCookie: !0,
@@ -1253,7 +1347,7 @@ const We = async () => {
1253
1347
  originalUrl: window.location.href
1254
1348
  };
1255
1349
  try {
1256
- const r = await u(
1350
+ const r = await l(
1257
1351
  "api/v1/security.oauth",
1258
1352
  t
1259
1353
  );
@@ -1261,10 +1355,10 @@ const We = async () => {
1261
1355
  } catch (r) {
1262
1356
  throw console.error("Failed to authenticate with OAuth", r), r;
1263
1357
  }
1264
- }, Xe = async () => {
1265
- const { autoSAMLProvider: e } = d;
1358
+ }, Ye = async () => {
1359
+ const { autoSAMLProvider: e } = u;
1266
1360
  if (typeof window > "u")
1267
- return u("security.saml", {
1361
+ return l("security.saml", {
1268
1362
  action: "getresponse",
1269
1363
  provider: e,
1270
1364
  tokenInCookie: !0,
@@ -1277,7 +1371,7 @@ const We = async () => {
1277
1371
  originalUrl: window.location.href
1278
1372
  };
1279
1373
  try {
1280
- const r = await u(
1374
+ const r = await l(
1281
1375
  "api/v1/security.saml",
1282
1376
  t
1283
1377
  );
@@ -1285,7 +1379,7 @@ const We = async () => {
1285
1379
  } catch (r) {
1286
1380
  throw console.error("Failed to authenticate with SAML", r), r;
1287
1381
  }
1288
- }, H = {
1382
+ }, G = {
1289
1383
  store: {},
1290
1384
  getItem(e) {
1291
1385
  return this.store[e] ?? null;
@@ -1299,36 +1393,36 @@ const We = async () => {
1299
1393
  clear() {
1300
1394
  this.store = {};
1301
1395
  }
1302
- }, J = H;
1303
- function Me(e) {
1304
- return typeof window > "u" || !window.localStorage ? H.getItem(e) : window.localStorage.getItem(e);
1305
- }
1306
- function Ye(e) {
1307
- typeof window > "u" || !window.localStorage ? H.removeItem(e) : window.localStorage.removeItem(e);
1308
- }
1396
+ }, z = G;
1309
1397
  function Ke(e) {
1310
- return typeof window > "u" || !window.sessionStorage ? J.getItem(e) : window.sessionStorage.getItem(e);
1398
+ return typeof window > "u" || !window.localStorage ? G.getItem(e) : window.localStorage.getItem(e);
1311
1399
  }
1312
- function Ze(e, t) {
1313
- typeof window > "u" || !window.sessionStorage ? J.setItem(e, t) : window.sessionStorage.setItem(e, t);
1400
+ function Ze(e) {
1401
+ typeof window > "u" || !window.localStorage ? G.removeItem(e) : window.localStorage.removeItem(e);
1314
1402
  }
1315
1403
  function Ee(e) {
1316
- typeof window > "u" || !window.sessionStorage ? J.removeItem(e) : window.sessionStorage.removeItem(e);
1404
+ return typeof window > "u" || !window.sessionStorage ? z.getItem(e) : window.sessionStorage.getItem(e);
1405
+ }
1406
+ function Te(e, t) {
1407
+ typeof window > "u" || !window.sessionStorage ? z.setItem(e, t) : window.sessionStorage.setItem(e, t);
1317
1408
  }
1318
- const U = (e) => Ze(
1409
+ function et(e) {
1410
+ typeof window > "u" || !window.sessionStorage ? z.removeItem(e) : window.sessionStorage.removeItem(e);
1411
+ }
1412
+ const U = (e) => Te(
1319
1413
  "sinequa-credentials",
1320
1414
  JSON.stringify({ data: { csrfToken: e } })
1321
- ), Te = async () => {
1415
+ ), tt = async () => {
1322
1416
  try {
1323
- const e = await p(
1417
+ const e = await w(
1324
1418
  "api/v1/challenge?action=getCsrfToken&suppressErrors=true"
1325
1419
  );
1326
- return e != null && e.csrfToken ? (U(e.csrfToken), e.csrfToken) : null;
1420
+ return e?.csrfToken ? (U(e.csrfToken), e.csrfToken) : null;
1327
1421
  } catch (e) {
1328
- throw h("Failed to get CSRF token", e), e;
1422
+ throw f("Failed to get CSRF token", e), e;
1329
1423
  }
1330
1424
  };
1331
- async function et(e) {
1425
+ async function rt(e) {
1332
1426
  if (e) {
1333
1427
  const { username: t, password: r } = e, n = {
1334
1428
  action: "get",
@@ -1339,11 +1433,11 @@ async function et(e) {
1339
1433
  noAutoAuthentication: !0
1340
1434
  };
1341
1435
  try {
1342
- const a = await u(
1436
+ const a = await l(
1343
1437
  "api/v1/security.webtoken",
1344
1438
  n
1345
1439
  );
1346
- return a != null && a.csrfToken ? (U(a.csrfToken), a.csrfToken) : null;
1440
+ return a?.csrfToken ? (U(a.csrfToken), a.csrfToken) : null;
1347
1441
  } catch (a) {
1348
1442
  throw console.error("Failed to get JWT", a), a;
1349
1443
  }
@@ -1354,7 +1448,7 @@ async function et(e) {
1354
1448
  noUserOverride: !0,
1355
1449
  noAutoAuthentication: !1
1356
1450
  // Allow auto authentication for credentialless requests
1357
- }, { bearerToken: r } = d;
1451
+ }, { bearerToken: r } = u;
1358
1452
  if (!r)
1359
1453
  throw new Error(
1360
1454
  "Bearer token is required in globalConfig for credentialless JWT retrieval."
@@ -1362,7 +1456,7 @@ async function et(e) {
1362
1456
  const n = new Headers();
1363
1457
  n.append("Sinequa-Force-Camel-Case", "true"), n.append("accept", "application/json"), n.append("Content-Type", "application/json"), n.append("Authorization", `Bearer ${r}`);
1364
1458
  try {
1365
- const a = await u(
1459
+ const a = await l(
1366
1460
  "api/v1/security.webtoken",
1367
1461
  t,
1368
1462
  { headers: n }
@@ -1373,195 +1467,204 @@ async function et(e) {
1373
1467
  }
1374
1468
  }
1375
1469
  }
1376
- const W = () => {
1377
- var r;
1378
- const e = Ke("sinequa-credentials");
1470
+ const H = () => {
1471
+ const e = Ee("sinequa-credentials");
1379
1472
  if (e)
1380
1473
  try {
1381
- const a = (r = JSON.parse(e).data) == null ? void 0 : r.csrfToken;
1382
- if (a !== void 0) return a;
1474
+ const n = JSON.parse(e).data?.csrfToken;
1475
+ if (n !== void 0) return n;
1383
1476
  } catch {
1384
1477
  }
1385
- const t = Me("csrfToken");
1478
+ const t = Ke("csrfToken");
1386
1479
  return t !== null ? t : null;
1387
- }, fr = async (e) => {
1480
+ }, wr = async (e) => {
1388
1481
  if (e)
1389
1482
  S("Attempting authentication using credentials"), k({ useCredentials: !0, useSSO: !1 });
1390
1483
  else {
1391
- let o = null;
1484
+ let c = null;
1392
1485
  try {
1393
- S("Attempting to retrieve CSRF token from the backend"), o = await Te(), x("CSRF token retrieval result", o ? "success" : "failed");
1394
- } catch (c) {
1395
- h("Failed to retrieve CSRF token", c);
1486
+ S("Attempting to retrieve CSRF token from the backend"), c = await tt(), y("CSRF token retrieval result", c ? "success" : "failed");
1487
+ } catch (i) {
1488
+ f("Failed to retrieve CSRF token", i);
1396
1489
  }
1397
1490
  try {
1398
- if (o === null) {
1399
- const { autoOAuthProvider: c, autoSAMLProvider: l, useSAML: f } = d;
1400
- if (c && !f)
1401
- return S("Initiating OAuth authentication flow"), await We(), P("OAuth authentication flow did not redirect as expected"), w(!1), !1;
1402
- if (l)
1403
- return S("Initiating SAML authentication flow"), await Xe(), P("SAML authentication flow did not redirect as expected"), w(!1), !1;
1491
+ if (c === null) {
1492
+ const { autoOAuthProvider: i, autoSAMLProvider: d, useSAML: _ } = u;
1493
+ if (i && !_)
1494
+ return S("Initiating OAuth authentication flow"), await Xe(), P("OAuth authentication flow did not redirect as expected"), p(!1), !1;
1495
+ if (d)
1496
+ return S("Initiating SAML authentication flow"), await Ye(), P("SAML authentication flow did not redirect as expected"), p(!1), !1;
1404
1497
  S(
1405
1498
  "No direct authentication method available, will try SSO then credentials"
1406
1499
  ), k({ useCredentials: !0, useSSO: !0 });
1407
1500
  } else
1408
- return S("User authenticated via existing token"), w(!0), !0;
1409
- } catch (c) {
1410
- throw h("Unexpected error during authentication", c), w(!1), c;
1501
+ return S("User authenticated via existing token"), p(!0), !0;
1502
+ } catch (i) {
1503
+ throw f("Unexpected error during authentication", i), p(!1), i;
1411
1504
  }
1412
1505
  }
1413
- if (d.useCredentials && d.useSSO)
1506
+ if (u.useCredentials && u.useSSO)
1414
1507
  try {
1415
- if (S("Checking if user is authenticated via SSO"), await He())
1416
- return S("User authenticated using SSO"), k({ useCredentials: !1, useSSO: !0 }), w(!0), !0;
1417
- } catch (o) {
1418
- if ((o == null ? void 0 : o.status) === 401)
1508
+ if (S("Checking if user is authenticated via SSO"), await re())
1509
+ return S("User authenticated using SSO"), k({ useCredentials: !1, useSSO: !0 }), p(!0), !0;
1510
+ } catch (c) {
1511
+ if (c?.status === 401)
1419
1512
  return S("SSO authentication failed with 401, falling back to credentials"), k({ useCredentials: !0, useSSO: !1 }), !1;
1420
- throw h("SSO authentication failed with unexpected error", o), w(!1), h;
1513
+ throw f("SSO authentication failed with unexpected error", c), p(!1), f;
1421
1514
  }
1422
- const { useSSO: r } = d, n = W();
1515
+ const { useSSO: r } = u, n = H();
1423
1516
  if (n && n !== null || r)
1424
- return S("user already authenticated", n), k({ isRedirectUrl: !1 }), w(!0), !0;
1425
- const { useCredentials: a } = d, { username: s, password: i } = e || {};
1426
- if (a && !s && !i)
1427
- return h("Credentials are required for authentication"), w(!1), !1;
1428
- if (s && i)
1517
+ return S("user already authenticated", n), k({ isRedirectUrl: !1 }), p(!0), !0;
1518
+ const { useCredentials: a } = u, { username: o, password: s } = e || {};
1519
+ if (a && !o && !s)
1520
+ return f("Credentials are required for authentication"), p(!1), !1;
1521
+ if (o && s)
1429
1522
  try {
1430
1523
  S("authentication using credentials..."), k({ useCredentials: !0, useSSO: !1 });
1431
- const { userOverrideActive: o, useroverride: c } = d;
1432
- return k({ userOverrideActive: !1, useroverride: void 0 }), await et({ username: s, password: i }), k({ userOverrideActive: o, useroverride: c }), w(!0), !0;
1433
- } catch (o) {
1434
- throw w(!1), o;
1524
+ const { userOverrideActive: c, useroverride: i } = u;
1525
+ return k({ userOverrideActive: !1, useroverride: void 0 }), await rt({ username: o, password: s }), k({ userOverrideActive: c, useroverride: i }), p(!0), !0;
1526
+ } catch (c) {
1527
+ throw p(!1), c;
1435
1528
  }
1436
- return w(!1), h(
1529
+ return p(!1), f(
1437
1530
  "No authentication method available. Please provide credentials or configure OAuth/SAML."
1438
1531
  ), !1;
1439
- }, tt = async () => {
1532
+ }, nt = async () => {
1440
1533
  const e = new URLSearchParams({
1441
1534
  action: "deleteWebTokenCookie",
1442
1535
  noUserOverride: "true",
1443
1536
  noAutoAuthentication: "true"
1444
1537
  });
1445
- return p("api/v1/challenge", e);
1446
- }, hr = async () => {
1447
- const { useCredentials: e, userOverrideActive: t } = d;
1448
- Ye("csrfToken"), Ee("sinequa-credentials"), e && !t ? (await tt()).methodresult === "ok" ? w(!1) : console.error("logout failed") : w(!1);
1449
- }, mr = () => !!W();
1538
+ return w("api/v1/challenge", e);
1539
+ }, _r = async () => {
1540
+ const { useCredentials: e, userOverrideActive: t } = u;
1541
+ Ze("csrfToken"), et("sinequa-credentials"), e && !t ? (await nt()).methodresult === "ok" ? p(!1) : console.error("logout failed") : p(!1);
1542
+ }, Sr = () => !!H();
1450
1543
  export {
1451
- b as ApiError,
1452
- Qt as Audit,
1453
- v as AuditEventType,
1454
- ve as DidYouMeanKind,
1455
- m as EngineType,
1544
+ Kt as API,
1545
+ v as ApiError,
1546
+ jt as Audit,
1547
+ b as AuditEventType,
1548
+ we as DidYouMeanKind,
1549
+ h as EngineType,
1456
1550
  g as EngineTypeModifier,
1457
- ae as LogLevel,
1458
- It as MINIMUM_COMPATIBLE_SERVER_API_VERSION,
1459
- be as RFMDisplay,
1460
- K as ServerError,
1461
- ue as TimeoutError,
1462
- G as UnauthorizedError,
1463
- y as addAuditAdditionalInfo,
1464
- ct as addConcepts,
1465
- Ue as addSessionId,
1466
- Ie as addUrl,
1467
- de as aggItemRegex,
1468
- at as aggregationItemStrictCompare,
1469
- jt as appInitializerFn,
1470
- ot as bisect,
1471
- z as buildPathsAndLevels,
1472
- Ct as configureLogger,
1473
- L as createHeaders,
1474
- Lt as createTimeoutController,
1475
- x as debug,
1476
- Rt as del,
1477
- ir as deleteUserSettings,
1478
- tt as deleteWebTokenCookie,
1479
- w as emitAuthenticatedEvent,
1480
- h as error,
1481
- Bt as escapeExpr,
1551
+ T as LogLevel,
1552
+ Dt as MINIMUM_COMPATIBLE_SERVER_API_VERSION,
1553
+ _e as RFMDisplay,
1554
+ J as ServerError,
1555
+ ae as TimeoutError,
1556
+ j as UnauthorizedError,
1557
+ L as addAuditAdditionalInfo,
1558
+ lt as addConcepts,
1559
+ Oe as addSessionId,
1560
+ $e as addUrl,
1561
+ oe as aggItemRegex,
1562
+ st as aggregationItemStrictCompare,
1563
+ Gt as appInitializerFn,
1564
+ ct as bisect,
1565
+ V as buildPathsAndLevels,
1566
+ yt as configureLogger,
1567
+ x as createHeaders,
1568
+ xt as createTimeoutController,
1569
+ hr as createUserProfile,
1570
+ y as debug,
1571
+ pe as del,
1572
+ pr as deleteUserProfileProperty,
1573
+ lr as deleteUserSettings,
1574
+ nt as deleteWebTokenCookie,
1575
+ p as emitAuthenticatedEvent,
1576
+ f as error,
1577
+ Ft as escapeExpr,
1482
1578
  Ot as expiresSoon,
1483
- Dt as extraColumns,
1484
- Vt as fetchAggregation,
1485
- Gt as fetchApp,
1486
- Fe as fetchAppPreLogin,
1487
- Zt as fetchBulkQuery,
1488
- lr as fetchChangePassword,
1579
+ It as extraColumns,
1580
+ Qt as fetchAggregation,
1581
+ Vt as fetchApp,
1582
+ Ae as fetchAppPreLogin,
1583
+ Et as fetchBulkQuery,
1584
+ ur as fetchChangePassword,
1489
1585
  zt as fetchDataset,
1490
1586
  Jt as fetchDatasetList,
1491
1587
  Ht as fetchDatasets,
1492
1588
  Wt as fetchLabels,
1493
- Mt as fetchPreview,
1589
+ Xt as fetchPreview,
1494
1590
  Yt as fetchPreviewUrl,
1495
- He as fetchPrincipal,
1496
- Kt as fetchQuery,
1497
- Et as fetchQueryExport,
1498
- Tt as fetchQueryIntent,
1499
- ur as fetchSendPasswordResetEmail,
1500
- er as fetchSimilarDocuments,
1501
- tr as fetchSponsoredLinks,
1502
- rr as fetchSuggest,
1503
- ar as fetchSuggestField,
1504
- nr as fetchSuggestQuery,
1591
+ re as fetchPrincipal,
1592
+ Ge as fetchPrincipalList,
1593
+ ze as fetchPrincipalUserid,
1594
+ He as fetchPrincipalUserids,
1595
+ Zt as fetchQuery,
1596
+ Tt as fetchQueryExport,
1597
+ er as fetchQueryIntent,
1598
+ dr as fetchSendPasswordResetEmail,
1599
+ tr as fetchSimilarDocuments,
1600
+ rr as fetchSponsoredLinks,
1601
+ nr as fetchSuggest,
1602
+ or as fetchSuggestField,
1603
+ ar as fetchSuggestQuery,
1505
1604
  sr as fetchTextChunks,
1506
- or as fetchUserSettings,
1507
- dr as fetchVersion,
1508
- p as get,
1509
- ut as getConcepts,
1510
- Te as getCsrfToken,
1511
- ne as getFiltersFromURI,
1512
- _t as getFiltersFromUrl,
1513
- vt as getHelpIndexUrl,
1514
- gt as getIdFromUrl,
1515
- et as getJWToken,
1605
+ fr as fetchUserProfile,
1606
+ ir as fetchUserSettings,
1607
+ gr as fetchVersion,
1608
+ w as get,
1609
+ ft as getConcepts,
1610
+ tt as getCsrfToken,
1611
+ E as getFiltersFromURI,
1612
+ wt as getFiltersFromUrl,
1613
+ Ct as getHelpIndexUrl,
1614
+ St as getIdFromUrl,
1615
+ rt as getJWToken,
1516
1616
  At as getMetadata,
1517
1617
  Nt as getMetadataWithValues,
1518
- pe as getOffsetFromDates,
1519
- St as getQueryPageFromUrl,
1520
- ht as getQueryParamsFromUrl,
1521
- kt as getQueryTabFromUrl,
1522
- wt as getQueryTextFromUrl,
1523
- dt as getRelativeDate,
1524
- W as getToken,
1525
- mt as getUrlParamsFromQueryParams,
1526
- d as globalConfig,
1527
- Oe as guid,
1618
+ me as getOffsetFromDates,
1619
+ kt as getQueryPageFromUrl,
1620
+ pt as getQueryParamsFromUrl,
1621
+ bt as getQueryTabFromUrl,
1622
+ _t as getQueryTextFromUrl,
1623
+ ht as getRelativeDate,
1624
+ Pe as getTime,
1625
+ H as getToken,
1626
+ gt as getUrlParamsFromQueryParams,
1627
+ u as globalConfig,
1628
+ xe as guid,
1528
1629
  C as handleResponse,
1529
1630
  S as info,
1530
- Pe as isArrayBuffer,
1531
- mr as isAuthenticated,
1532
- Le as isBlob,
1533
- yt as isExpired,
1534
- Ft as isJsonable,
1535
- ft as isNotInputEvent,
1631
+ ve as isArrayBuffer,
1632
+ Sr as isAuthenticated,
1633
+ Ce as isBlob,
1634
+ Re as isDate,
1635
+ Lt as isExpired,
1636
+ qt as isJsonable,
1637
+ mt as isNotInputEvent,
1536
1638
  A as isObject,
1537
1639
  ye as isString,
1538
- Xt as labels,
1539
- fr as login,
1540
- hr as logout,
1541
- _ as makeColumn,
1542
- bt as notify,
1543
- he as openParentNodes,
1544
- I as parseText,
1545
- fe as parseValueAndOperatorFromItem,
1546
- xt as patch,
1640
+ Mt as labels,
1641
+ wr as login,
1642
+ _r as logout,
1643
+ m as makeColumn,
1644
+ Rt as notify,
1645
+ ie as openParentNodes,
1646
+ D as parseText,
1647
+ se as parseValueAndOperatorFromItem,
1648
+ ge as patch,
1649
+ mr as patchUserProfile,
1547
1650
  cr as patchUserSettings,
1548
- u as post,
1651
+ l as post,
1549
1652
  Pt as put,
1550
1653
  R as queryParamsFromUrl,
1551
- it as removeConcept,
1552
- lt as removeConcepts,
1654
+ ut as removeConcept,
1655
+ dt as removeConcepts,
1553
1656
  Ut as resolveToColumnName,
1554
- j as rewriteText,
1555
- Je as saveUserSettings,
1657
+ Q as rewriteText,
1658
+ Me as saveUserSettings,
1556
1659
  k as setGlobalConfig,
1557
1660
  U as setToken,
1558
- qt as sha512,
1559
- st as suggestionsToTreeAggregationNodes,
1560
- pt as sysLang,
1561
- se as toDate,
1562
- nt as translateAggregationToDateOptions,
1563
- We as tryOAuthAuthentication,
1564
- Xe as trySAMLAuthentication,
1661
+ Bt as sha512,
1662
+ it as suggestionsToTreeAggregationNodes,
1663
+ vt as sysLang,
1664
+ ee as toDate,
1665
+ ot as translateAggregationToDateOptions,
1666
+ Xe as tryOAuthAuthentication,
1667
+ Ye as trySAMLAuthentication,
1565
1668
  P as warn,
1566
1669
  $t as withRetry
1567
1670
  };