@sinequa/atomic 0.0.123 → 0.0.129

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.
Files changed (33) hide show
  1. package/README.md +188 -36
  2. package/dist/atomic.js +826 -646
  3. package/dist/atomic.umd.cjs +1 -1
  4. package/dist/authentication/session/login.d.ts.map +1 -1
  5. package/dist/helpers/columns.d.ts +27 -0
  6. package/dist/helpers/columns.d.ts.map +1 -0
  7. package/dist/helpers/index.d.ts +5 -4
  8. package/dist/helpers/index.d.ts.map +1 -1
  9. package/dist/helpers/metadata.d.ts +32 -0
  10. package/dist/helpers/metadata.d.ts.map +1 -1
  11. package/dist/types/aggregations/AggregationItem.d.ts +4 -0
  12. package/dist/types/aggregations/AggregationItem.d.ts.map +1 -1
  13. package/dist/types/config/CCApp.d.ts +3 -1
  14. package/dist/types/config/CCApp.d.ts.map +1 -1
  15. package/dist/types/principal/Principal.d.ts +2 -0
  16. package/dist/types/principal/Principal.d.ts.map +1 -1
  17. package/dist/utils/notification.d.ts +6 -1
  18. package/dist/utils/notification.d.ts.map +1 -1
  19. package/dist/web-api/helpers/handle-response.d.ts +1 -1
  20. package/dist/web-api/helpers/handle-response.d.ts.map +1 -1
  21. package/dist/web-api/helpers/index.d.ts +9 -8
  22. package/dist/web-api/helpers/index.d.ts.map +1 -1
  23. package/dist/web-api/helpers/methods/post.d.ts.map +1 -1
  24. package/dist/web-api/helpers/utils/date-utils..d.ts +14 -0
  25. package/dist/web-api/helpers/utils/date-utils..d.ts.map +1 -0
  26. package/dist/web-api/index.d.ts +4 -2
  27. package/dist/web-api/index.d.ts.map +1 -1
  28. package/dist/web-api/v1/fetch-app.d.ts.map +1 -1
  29. package/dist/web-api/v2/fetch-change-password.d.ts +12 -2
  30. package/dist/web-api/v2/fetch-change-password.d.ts.map +1 -1
  31. package/dist/web-api/v2/fetch-forgot-password.d.ts +11 -0
  32. package/dist/web-api/v2/fetch-forgot-password.d.ts.map +1 -0
  33. package/package.json +1 -1
package/dist/atomic.js CHANGED
@@ -1,7 +1,7 @@
1
- var ne = Object.defineProperty;
2
- var ae = (e, t, r) => t in e ? ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var H = (e, t, r) => ae(e, typeof t != "symbol" ? t + "" : t, r);
4
- function _(e) {
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) {
5
5
  const t = new CustomEvent("authenticated", {
6
6
  bubbles: !0,
7
7
  cancelable: !1,
@@ -9,292 +9,121 @@ function _(e) {
9
9
  });
10
10
  dispatchEvent(t);
11
11
  }
12
- const f = {
12
+ const d = {
13
13
  loginPath: "/login",
14
14
  createRoutes: !1
15
15
  };
16
- function m(e) {
17
- Object.assign(f, e);
16
+ function k(e) {
17
+ Object.assign(d, e);
18
18
  }
19
- function Ee(e, t, r) {
20
- var o, i, s, c;
21
- if (!e || !t) return;
22
- if (r) {
23
- const l = Object.keys(t.queries).find((D) => D === (r == null ? void 0 : r.toLowerCase()));
24
- let d;
25
- l && (d = t.queries[l]);
26
- const I = (i = ((o = d == null ? void 0 : d.columnsInfo) == null ? void 0 : o.columns) || []) == null ? void 0 : i.find((D) => {
27
- var j, z;
28
- return (z = (j = D.aliases) == null ? void 0 : j.split(",")) == null ? void 0 : z.includes(e);
29
- });
30
- if (I) return I.name;
31
- }
32
- const n = (c = (s = t.indexes) == null ? void 0 : s._) == null ? void 0 : c.columns, a = Object.entries(n).find((l) => {
33
- var d;
34
- return (d = l[1].aliases) == null ? void 0 : d.includes(e);
35
- });
36
- if (a) return a[0];
37
- }
38
- function Te(e, t) {
39
- const r = e[t];
40
- return r === void 0 ? [] : Array.isArray(r) ? r.map((n) => {
41
- if (typeof n == "string")
42
- return n;
43
- if (typeof n == "object" && n !== null && "display" in n)
44
- return n.display;
45
- }).filter((n) => n !== void 0) : [String(r)];
46
- }
47
- function $(e) {
48
- return e !== null && typeof e == "object";
49
- }
50
- function oe(e) {
51
- return $(e) && Object.prototype.toString.call(e) === "[object ArrayBuffer]";
52
- }
53
- function se(e) {
54
- return $(e) && Object.prototype.toString.call(e) === "[object Blob]";
55
- }
56
- function ce(e) {
57
- return typeof e == "string";
58
- }
59
- function et(e) {
60
- return ($(e) || Array.isArray(e)) && !oe(e) && !se(e) && !ce(e);
61
- }
62
- function ie(e = !0) {
63
- let t = Date.now();
64
- return (e ? "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" : "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx").replace(/[xy]/g, (n) => {
65
- const a = (t + Math.random() * 16) % 16 | 0;
66
- return t = Math.floor(t / 16), (n === "x" ? a : a & 3 | 8).toString(16);
67
- });
68
- }
69
- function tt(e) {
70
- if (!e)
71
- return "``";
72
- if (e = String(e), e.search(/[\\`]/) === -1)
73
- return "`" + e + "`";
74
- const t = ["`"];
75
- for (let r = 0, n = e.length; r < n; r++) {
76
- const a = e[r];
77
- (a === "\\" || a === "`") && t.push("\\"), t.push(a);
78
- }
79
- return t.push("`"), t.join("");
80
- }
81
- function rt(e) {
82
- if (typeof crypto < "u" && crypto.subtle && typeof crypto.subtle.digest == "function")
83
- try {
84
- 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(A(e)));
85
- } catch {
86
- return Promise.resolve(A(e));
87
- }
88
- return Promise.resolve(A(e));
89
- }
90
- function A(e) {
91
- let n = 2166136261;
92
- for (let d = 0; d < e.length; d++)
93
- n ^= e.charCodeAt(d), n = n * 16777619 >>> 0;
94
- const a = n.toString(16).padStart(8, "0"), o = ((n ^ 2863311530) >>> 0).toString(16).padStart(8, "0"), i = ((n ^ 1431655765) >>> 0).toString(16).padStart(8, "0"), s = ((n ^ 3435973836) >>> 0).toString(16).padStart(8, "0"), c = a + o + i + s;
95
- return (c + c + c + c).substring(0, 128);
19
+ function L(e) {
20
+ const t = W(), r = new Headers(e);
21
+ 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;
96
24
  }
97
- var k = /* @__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))(k || {}), le = /* @__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))(le || {}), ue = /* @__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))(ue || {});
98
- const nt = "1.0";
99
- var fe = /* @__PURE__ */ ((e) => (e[e.Original = 0] = "Original", e[e.Corrected = 1] = "Corrected", e))(fe || {}), de = /* @__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))(de || {});
100
- class g extends Error {
25
+ class b extends Error {
101
26
  constructor(r, n) {
102
27
  super(r);
103
- H(this, "status");
28
+ Y(this, "status");
104
29
  this.name = "ApiError", this.status = n;
105
30
  }
106
31
  }
107
- class Z extends g {
108
- constructor(t = "Unauthorized access") {
109
- super(t, 401), this.name = "UnauthorizedError";
110
- }
111
- }
112
- class he extends g {
32
+ class K extends b {
113
33
  constructor(t = "Server error") {
114
34
  super(t, 500), this.name = "ServerError";
115
35
  }
116
36
  }
117
- class _e extends g {
37
+ class ue extends b {
118
38
  constructor(t = "Request timed out") {
119
39
  super(t, 408), this.name = "TimeoutError";
120
40
  }
121
41
  }
122
- function at(e) {
123
- const t = new AbortController(), { signal: r } = t;
124
- return e && setTimeout(() => {
125
- r.aborted || t.abort(new _e(`Request timed out after ${e}ms`));
126
- }, e), { controller: t, signal: r };
127
- }
128
- var E = /* @__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))(E || {});
129
- let L = {
130
- level: 1,
131
- enableConsoleOutput: !0
132
- };
133
- function ot(e) {
134
- L = { ...L, ...e };
135
- }
136
- function U(e, t, r) {
137
- if (e < L.level) return;
138
- const a = `${`[${E[e]}]`} ${t}`;
139
- if (L.enableConsoleOutput)
140
- switch (e) {
141
- case 0:
142
- console.debug(a, r || "");
143
- break;
144
- case 1:
145
- console.info(a, r || "");
146
- break;
147
- case 2:
148
- console.warn(a, r || "");
149
- break;
150
- case 3:
151
- console.error(a, r || "");
152
- break;
153
- }
154
- }
155
- function p(e, t) {
156
- U(0, e, t);
157
- }
158
- function w(e, t) {
159
- U(1, e, t);
160
- }
161
- function v(e, t) {
162
- U(2, e, t);
163
- }
164
- function h(e, t) {
165
- U(3, e, t);
166
- }
167
- async function st(e, t = 0, r = 1e3) {
168
- let n;
169
- for (let a = 0; a <= t; a++)
170
- try {
171
- return await e();
172
- } catch (o) {
173
- if (n = o, o instanceof g && o.status >= 400 && o.status < 500 && o.status !== 429 || o instanceof DOMException && o.name === "AbortError")
174
- throw o;
175
- a < t && (v(`Retrying request (${a + 1}/${t})`, { error: o }), await new Promise((i) => setTimeout(i, r)));
176
- }
177
- throw n;
178
- }
179
- function R(e) {
180
- const t = V(), r = new Headers(e);
181
- r.append("Sinequa-Force-Camel-Case", "true"), r.append("accept", "application/json"), t && r.append("Sinequa-csrf-token", t);
182
- const { userOverride: n, userOverrideActive: a, bearerToken: o } = f;
183
- return o && r.append("Authorization", `Bearer ${o}`), n && a && (r.append("sinequa-override-user", n.username), r.append("sinequa-override-domain", n.domain)), r;
184
- }
185
- async function b(e, t = "json") {
186
- const r = e.headers.get("sinequa-jwt-refresh");
187
- if (r !== null && O(r), e.status === 200)
188
- switch (t) {
189
- case "arraybuffer":
190
- return await e.arrayBuffer();
191
- case "blob":
192
- return await e.blob();
193
- case "text":
194
- return await e.text();
195
- case "json":
196
- default:
197
- return await e.json();
198
- }
199
- if (e.status === 401) {
200
- if (f.userOverrideActive)
201
- throw f.userOverrideActive = !1, v("Unauthorized access attempt with user override", { endpoint: e.url }), new Z("Unauthorized... User override failed.");
202
- await J(e, 401);
203
- }
204
- throw e.status === 500 && (h("Server error occurred", { endpoint: e.url }), await J(e, 500)), v(`Unexpected response status: ${e.status}`, { endpoint: e.url }), new g(`Request failed with status ${e.status}`, e.status);
205
- }
206
- async function J(e, t) {
207
- var r;
208
- try {
209
- const { done: n, value: a } = await ((r = e.body) == null ? void 0 : r.getReader().read()) || { done: !0, value: void 0 };
210
- if (n || !a)
211
- throw new g(`Request failed with status ${t}`, t);
212
- const o = JSON.parse(new TextDecoder().decode(a));
213
- throw o.status = t, o;
214
- } catch (n) {
215
- throw n instanceof g ? n : t === 401 ? new Z() : t === 500 ? new he() : new g(`Request failed with status ${t}`, t);
42
+ class G extends b {
43
+ constructor(t = "Unauthorized access") {
44
+ super(t, 401), this.name = "UnauthorizedError";
216
45
  }
217
46
  }
218
- const we = /.*\:\(?([><=\d\-\.AND ]+)\)?/;
219
- function ct(e, t) {
47
+ const de = /.*\:\(?([><=\d\-\.AND ]+)\)?/;
48
+ function nt(e, t) {
220
49
  var a;
221
- return !(e != null && e.items) || ((a = e == null ? void 0 : e.items) == null ? void 0 : a.length) === 0 ? [] : e.items.reduce((o, i) => {
222
- if (!i.value || i.value === "") return o;
223
- const s = Se(i, e.column);
224
- return o.push({
225
- operator: s.operator,
226
- value: s.value,
227
- display: i.display || s.display,
228
- filters: s.filters,
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,
229
58
  disabled: i.count === 0,
230
59
  hidden: i.count === 0 && e.isDistribution ? !t : !1
231
- }), o;
60
+ }), s;
232
61
  }, []);
233
62
  }
234
- function Se(e, t) {
235
- const r = t, n = e.value.match(we);
63
+ function fe(e, t) {
64
+ const r = t, n = e.value.match(de);
236
65
  if (n != null && n[1]) {
237
- const o = (n == null ? void 0 : n[1].split(" AND ")).map((i) => {
238
- const s = i.indexOf(">=") !== -1 ? "gte" : "lt";
66
+ const s = (n == null ? void 0 : n[1].split(" AND ")).map((i) => {
67
+ const o = i.indexOf(">=") !== -1 ? "gte" : "lt";
239
68
  let c = i.substring(i.indexOf(" ") + 1);
240
- return { field: r, operator: s, value: c, display: e.display || e.value };
69
+ return { field: r, operator: o, value: c, display: e.display || e.value };
241
70
  });
242
- if (o.length === 2)
243
- return { field: r, operator: "and", filters: o, value: e.value, display: o[0].display || o[0].value };
244
- if (o.length === 1)
245
- return { ...o[0], field: r };
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 };
246
75
  throw new Error("Failed to parse distribution expression");
247
76
  }
248
77
  return { field: r, operator: "eq", value: e.value, display: e.display };
249
78
  }
250
- function it(e, t, r) {
79
+ function at(e, t, r) {
251
80
  return e.valuesAreExpressions ? t.display === r.display : t.value === r.value;
252
81
  }
253
- function me(e) {
254
- return e.items && (e.items = e.items.map((t) => me(t))), e.items && e.items.some((t) => t.$selected || t.$opened) && (e.$opened = !0), e;
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;
255
84
  }
256
- function lt(e, t) {
85
+ function st(e, t) {
257
86
  const r = [];
258
87
  if (e.length > 0) {
259
- const n = /* @__PURE__ */ new Map(), o = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").normalize("NFD").replace(/[\u0300-\u036f]/g, ""), i = new RegExp("\\b" + o, "i");
260
- e.forEach((s) => {
261
- if (s.display.length > 1) {
262
- const c = s.display.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), l = i.exec(c);
263
- T(r, n, "/", s.display, +(s.frequency || 0), 1, ((l == null ? void 0 : l.index) || 0) + t.length);
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);
264
93
  }
265
94
  });
266
95
  }
267
96
  return r;
268
97
  }
269
- function T(e, t, r, n, a, o, i) {
270
- const s = n.indexOf("/", r.length), c = n.substring(0, s + 1);
98
+ function re(e, t, r, n, a, s, i) {
99
+ const o = n.indexOf("/", r.length), c = n.substring(0, o + 1);
271
100
  let l = t.get(c);
272
101
  if (!l) {
273
- const d = c.replace(/^\/|\/$/g, "");
102
+ const f = c.replace(/^\/|\/$/g, "");
274
103
  l = {
275
- value: n.substring(r.length, s),
104
+ value: n.substring(r.length, o),
276
105
  count: a,
277
106
  items: [],
278
107
  hasChildren: !1,
279
- $level: o,
108
+ $level: s,
280
109
  $opened: i >= c.length,
281
- $path: d
110
+ $path: f
282
111
  }, t.set(c, l), e.push(l);
283
112
  }
284
- c.length < n.length && (l.hasChildren = !0, T(l.items, t, c, n, a, o + 1, i));
113
+ c.length < n.length && (l.hasChildren = !0, re(l.items, t, c, n, a, s + 1, i));
285
114
  }
286
- function ut(e, t) {
115
+ function ot(e, t) {
287
116
  return e.reduce((r, n) => (t(n) ? r.true.push(n) : r.false.push(n), r), { true: [], false: [] });
288
117
  }
289
- const ge = /(([\+\-])?\(([^\)]+)\))|(([\+\-])?\[([^\]]+)\])|(([\+\-])?\"([^\"]+)\")|(([\+\-])?\/([^\/]+)\/)|(([\+\-])?(\S+))/g, ke = 2, W = 3, be = 5, X = 6, pe = 8, M = 9, Ce = 11, Y = 12, ve = 14, K = 15;
290
- function y(e) {
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) {
291
120
  if (!e) return [];
292
- const t = [], r = e.matchAll(ge);
121
+ const t = [], r = e.matchAll(me);
293
122
  for (let n of r)
294
- n[W] ? t.push({ type: "group", value: n[W], op: n[ke] }) : n[X] ? t.push({ type: "adjacent", value: n[X], op: n[be] }) : n[M] ? t.push({ type: "exact", value: n[M], op: n[pe] }) : n[Y] ? t.push({ type: "regex", value: n[Y], op: n[Ce] }) : n[K] && t.push({ type: "token", value: n[K], op: n[ve] });
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] });
295
124
  return t;
296
125
  }
297
- function B(e) {
126
+ function j(e) {
298
127
  return e.map((t) => {
299
128
  const r = t.op || "";
300
129
  switch (t.type) {
@@ -311,28 +140,28 @@ function B(e) {
311
140
  }
312
141
  }).join(" ");
313
142
  }
314
- function ft(e, t, r) {
315
- let n = y(e);
143
+ function ct(e, t, r) {
144
+ let n = I(e);
316
145
  for (let a of t)
317
146
  n.push({ type: "adjacent", value: a, op: r });
318
- return B(n);
147
+ return j(n);
319
148
  }
320
- function dt(e, t) {
321
- const r = y(t), n = r.findIndex((a) => a.value === e);
322
- return n !== -1 ? (r.splice(n, 1), t = B(r)) : t;
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;
323
152
  }
324
- function ht(e) {
325
- const t = y(e).filter((r) => r.type !== "adjacent");
326
- return B(t);
153
+ function lt(e) {
154
+ const t = I(e).filter((r) => r.type !== "adjacent");
155
+ return j(t);
327
156
  }
328
- function _t(e) {
329
- return y(e).filter((t) => t.type === "adjacent").map((t) => t.value);
157
+ function ut(e) {
158
+ return I(e).filter((t) => t.type === "adjacent").map((t) => t.value);
330
159
  }
331
- function wt(e, t, r) {
332
- const n = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: a, unit: o, isFuture: i } = Re(t, r);
333
- return n.format(a * (i ? 1 : -1), o);
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);
334
163
  }
335
- function Re(e, t) {
164
+ function pe(e, t) {
336
165
  const r = new Date(e), n = t ? new Date(t) : /* @__PURE__ */ new Date(), a = Math.abs(n.getTime() - r.getTime());
337
166
  return {
338
167
  offset: Math.floor(a / (1e3 * 60 * 60 * 24)),
@@ -340,37 +169,37 @@ function Re(e, t) {
340
169
  isFuture: r > n
341
170
  };
342
171
  }
343
- function St(e) {
172
+ function ft(e) {
344
173
  const t = e.target;
345
174
  return t && t.nodeName !== "INPUT" && t.nodeName !== "TEXTAREA";
346
175
  }
347
- function mt(e) {
176
+ function ht(e) {
348
177
  if (e === void 0) return;
349
- const { q: t, f: r, p: n, s: a, t: o, n: i, b: s } = C(e), [c] = e.split("?");
178
+ const { q: t, f: r, p: n, s: a, t: s, n: i, b: o } = R(e), [c] = e.split("?");
350
179
  return {
351
180
  path: c,
352
181
  text: t,
353
- filters: r ? ee(r) : void 0,
182
+ filters: r ? ne(r) : void 0,
354
183
  page: n ? parseInt(n, 10) : void 0,
355
184
  sort: a,
356
- tab: o,
185
+ tab: s,
357
186
  name: i,
358
- basket: s
187
+ basket: o
359
188
  };
360
189
  }
361
- function gt(e) {
190
+ function mt(e) {
362
191
  if (!e) return "";
363
- const { text: t, filters: r, page: n, sort: a, tab: o, name: i, basket: s } = e, c = {};
364
- t && (c.q = t), r && (c.f = JSON.stringify(r)), n && (c.p = n.toString()), a && (c.s = a), o && (c.t = o), i && (c.n = i), s && (c.b = s);
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);
365
194
  const l = new URLSearchParams(c).toString();
366
195
  return l || "";
367
196
  }
368
- function kt(e) {
197
+ function _t(e) {
369
198
  if (e === void 0) return [];
370
- const { f: t } = C(e);
371
- return ee(t);
199
+ const { f: t } = R(e);
200
+ return ne(t);
372
201
  }
373
- function ee(e) {
202
+ function ne(e) {
374
203
  const t = decodeURIComponent(e);
375
204
  try {
376
205
  return JSON.parse(t ?? "[]");
@@ -378,29 +207,29 @@ function ee(e) {
378
207
  return console.error(`Error parsing filters from URI: ${e}`), [];
379
208
  }
380
209
  }
381
- function C(e) {
210
+ function R(e) {
382
211
  const t = e.split("?")[1];
383
212
  if (t === void 0) return {};
384
213
  const r = new URLSearchParams(t);
385
214
  return Object.fromEntries(r);
386
215
  }
387
- function bt(e) {
388
- const { q: t = "" } = C(e);
216
+ function wt(e) {
217
+ const { q: t = "" } = R(e);
389
218
  return t;
390
219
  }
391
- function pt(e) {
392
- const { id: t } = C(e);
220
+ function gt(e) {
221
+ const { id: t } = R(e);
393
222
  return decodeURIComponent(t);
394
223
  }
395
- function Ct(e) {
396
- const { p: t = "0" } = C(e);
224
+ function St(e) {
225
+ const { p: t = "0" } = R(e);
397
226
  return parseInt(t, 10);
398
227
  }
399
- function vt(e) {
400
- const { t } = C(e);
228
+ function kt(e) {
229
+ const { t } = R(e);
401
230
  return t;
402
231
  }
403
- function Rt(e, t) {
232
+ function pt(e, t) {
404
233
  if (!e)
405
234
  return e;
406
235
  let r = 0;
@@ -411,21 +240,21 @@ function Rt(e, t) {
411
240
  a++;
412
241
  e[a] === "]" && (r = a + 1);
413
242
  }
414
- const o = N(e, r, !1);
415
- if (!o)
243
+ const s = B(e, r, !1);
244
+ if (!s)
416
245
  return e;
417
- const i = t.charCodeAt(0), s = t.charCodeAt(1);
418
- let c = o;
246
+ const i = t.charCodeAt(0), o = t.charCodeAt(1);
247
+ let c = s;
419
248
  for (; c; )
420
- if (i === c.lang1 && s === c.lang2) {
421
- const d = N(e, c.end + 4, !0);
422
- return e.substring(d.start, d.end);
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);
423
252
  } else
424
- c = N(e, c.end + 4, !1);
425
- const l = e.substring(o.start, o.end);
253
+ c = B(e, c.end + 4, !1);
254
+ const l = e.substring(s.start, s.end);
426
255
  return l || e;
427
256
  }
428
- function N(e, t, r) {
257
+ function B(e, t, r) {
429
258
  for (let n = t, a = e.length - 3; n < a; n++)
430
259
  if (e[n] === "[" && e[n + 3] === "]")
431
260
  return {
@@ -442,11 +271,11 @@ function N(e, t, r) {
442
271
  lang2: -1
443
272
  };
444
273
  }
445
- function xt(e, t) {
446
- const { useLocale: r, useLocaleAsPrefix: n, indexFile: a, path: o, folder: i } = t, s = r ? `${e}/` : null, c = n ? `${e}.${a}` : a ?? "";
447
- return [o, i, `${s || ""}${c}`].filter((l) => l !== void 0).join("/");
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("/");
448
277
  }
449
- function P(e) {
278
+ function O(e) {
450
279
  const t = new CustomEvent("notification", {
451
280
  bubbles: !0,
452
281
  cancelable: !1,
@@ -454,145 +283,468 @@ function P(e) {
454
283
  });
455
284
  dispatchEvent(t);
456
285
  }
457
- const Pt = {
286
+ const bt = {
458
287
  success: (e, t) => {
459
- P({
288
+ O({
460
289
  type: "success",
461
290
  message: e,
462
291
  options: t
463
292
  });
464
293
  },
465
294
  info: (e, t) => {
466
- P({
295
+ O({
467
296
  type: "info",
468
297
  message: e,
469
298
  options: t
470
299
  });
471
300
  },
472
301
  warning: (e, t) => {
473
- P({
302
+ O({
474
303
  type: "warning",
475
304
  message: e,
476
305
  options: t
477
306
  });
478
307
  },
479
308
  error: (e, t) => {
480
- P({
309
+ O({
481
310
  type: "error",
482
311
  message: e,
483
312
  options: t
484
313
  });
485
314
  }
486
315
  };
487
- async function u(e, t, r) {
488
- const n = R(r == null ? void 0 : r.headers), { app: a, backendUrl: o } = f, i = {
489
- app: a,
490
- ...t,
491
- locale: t.locale || navigator.language,
492
- noUserOverride: !0,
493
- noAutoAuthentication: !0
494
- };
495
- e.startsWith("plugin") && (e = `api/v1/${e}`);
496
- const s = o ? `${o}/${e}` : `${e}`;
497
- p(`Making POST request to: ${s}`);
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 || {});
317
+ let $ = {
318
+ level: 1,
319
+ enableConsoleOutput: !0
320
+ };
321
+ function Ct(e) {
322
+ $ = { ...$, ...e };
323
+ }
324
+ function D(e, t, r) {
325
+ if (e < $.level) return;
326
+ const a = `${`[${ae[e]}]`} ${t}`;
327
+ if ($.enableConsoleOutput)
328
+ switch (e) {
329
+ case 0:
330
+ console.debug(a, r || "");
331
+ break;
332
+ case 1:
333
+ console.info(a, r || "");
334
+ break;
335
+ case 2:
336
+ console.warn(a, r || "");
337
+ break;
338
+ case 3:
339
+ console.error(a, r || "");
340
+ break;
341
+ }
342
+ }
343
+ function x(e, t) {
344
+ D(0, e, t);
345
+ }
346
+ function S(e, t) {
347
+ D(1, e, t);
348
+ }
349
+ function P(e, t) {
350
+ D(2, e, t);
351
+ }
352
+ function h(e, t) {
353
+ D(3, e, t);
354
+ }
355
+ async function C(e, t = "json") {
356
+ const r = e.headers.get("sinequa-jwt-refresh");
357
+ if (r !== null && U(r), e.status === 200)
358
+ switch (t) {
359
+ case "arraybuffer":
360
+ return await e.arrayBuffer();
361
+ case "blob":
362
+ return await e.blob();
363
+ case "text":
364
+ return await e.text();
365
+ default:
366
+ return await e.json();
367
+ }
368
+ if (e.status === 401) {
369
+ if (d.userOverrideActive)
370
+ throw P("Unauthorized access attempt with user override", {
371
+ endpoint: e.url
372
+ }), new G("Unauthorized... User override failed.");
373
+ return await q(e, 401);
374
+ }
375
+ return e.status === 500 ? (h("Server error occurred", { endpoint: e.url }), await q(e, 500)) : (P(`Unexpected response status: ${e.status}`, {
376
+ endpoint: e.url
377
+ }), await q(e, e.status));
378
+ }
379
+ async function q(e, t) {
380
+ var r;
498
381
  try {
499
- const c = await fetch(s, {
500
- method: "POST",
501
- headers: n,
382
+ const { done: n, value: a } = await ((r = e.body) == null ? void 0 : r.getReader().read()) || {
383
+ done: !0,
384
+ value: void 0
385
+ };
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));
389
+ throw new Error(
390
+ s.errorMessage || s.message || `Request failed with status ${t}`,
391
+ {
392
+ cause: {
393
+ errorCode: s.errorCode,
394
+ errorCodeTest: s.errorCodeTest
395
+ }
396
+ }
397
+ );
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}`,
401
+ t
402
+ );
403
+ }
404
+ }
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}`);
408
+ try {
409
+ const o = await fetch(i, {
410
+ method: "DELETE",
502
411
  credentials: "include",
503
- body: JSON.stringify(i),
504
- signal: r == null ? void 0 : r.signal
412
+ headers: n
505
413
  });
506
- return b(c, r == null ? void 0 : r.responseType);
507
- } catch (c) {
508
- throw h("Error making POST request:", c), c;
414
+ return C(o, r == null ? void 0 : r.responseType);
415
+ } catch (o) {
416
+ throw h("Error making DELETE request:", o), o;
509
417
  }
510
418
  }
511
- async function S(e, t, r) {
512
- const n = R(r == null ? void 0 : r.headers), { backendUrl: a } = f, o = t ? `?${new URLSearchParams(t)}` : "";
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)}` : "";
513
421
  e.startsWith("plugin") && (e = `api/v1/${e}`);
514
- const i = a ? `${a}/${e}${o}` : `${e}${o}`;
515
- p(`Making GET request to: ${i}`);
422
+ const i = a ? `${a}/${e}${s}` : `${e}${s}`;
423
+ x(`Making GET request to: ${i}`);
516
424
  try {
517
- const s = await fetch(i, {
425
+ const o = await fetch(i, {
518
426
  method: "GET",
519
427
  credentials: "include",
520
428
  headers: n,
521
429
  signal: r == null ? void 0 : r.signal
522
430
  });
523
- return b(s, r == null ? void 0 : r.responseType);
524
- } catch (s) {
525
- throw h("Error making GET request:", s), s;
431
+ return C(o, r == null ? void 0 : r.responseType);
432
+ } catch (o) {
433
+ throw h("Error making GET request:", o), o;
526
434
  }
527
435
  }
528
- async function Lt(e, t, r) {
529
- const n = R(r == null ? void 0 : r.headers), { app: a, backendUrl: o } = f, i = {
436
+ async function xt(e, t, r) {
437
+ const n = L(r == null ? void 0 : r.headers), { app: a, backendUrl: s } = d, i = {
530
438
  app: a,
531
439
  ...t,
532
440
  locale: t.locale || navigator.language,
533
441
  noUserOverride: !0,
534
442
  noAutoAuthentication: !0
535
- }, s = `${o}/${e}`;
536
- p(`Making PUT request to: ${s}`);
443
+ }, o = s ? `${s}/${e}` : `${e}`;
444
+ x(`Making PATCH request to: ${o}`);
537
445
  try {
538
- const c = await fetch(s, {
539
- method: "PUT",
446
+ const c = await fetch(o, {
447
+ method: "PATCH",
540
448
  headers: n,
541
449
  credentials: "include",
542
450
  body: JSON.stringify(i)
543
451
  });
544
- return b(c, r == null ? void 0 : r.responseType);
452
+ return C(c, r == null ? void 0 : r.responseType);
545
453
  } catch (c) {
546
- throw h("Error making PUT request:", c), c;
454
+ throw h("Error making PATCH request:", c), c;
547
455
  }
548
456
  }
549
- async function Ot(e, t, r) {
550
- const n = R(r == null ? void 0 : r.headers), { backendUrl: a } = f, o = t ? `?${new URLSearchParams(t)}` : "", i = a ? `${a}/${e}${o}` : `${e}${o}`;
551
- p(`Making DELETE request to: ${i}`);
457
+ async function u(e, t, r) {
458
+ const n = L(r == null ? void 0 : r.headers), { app: a, backendUrl: s } = d;
459
+ n.has("Content-Type") || n.set("Content-Type", "application/json");
460
+ const i = {
461
+ app: a,
462
+ ...t,
463
+ locale: t.locale || navigator.language,
464
+ noUserOverride: !0,
465
+ noAutoAuthentication: !0
466
+ };
467
+ e.startsWith("plugin") && (e = `api/v1/${e}`);
468
+ const o = s ? `${s}/${e}` : `${e}`;
469
+ x(`Making POST request to: ${o}`);
552
470
  try {
553
- const s = await fetch(i, {
554
- method: "DELETE",
471
+ const c = await fetch(o, {
472
+ method: "POST",
473
+ headers: n,
555
474
  credentials: "include",
556
- headers: n
475
+ body: JSON.stringify(i),
476
+ signal: r == null ? void 0 : r.signal
557
477
  });
558
- return b(s, r == null ? void 0 : r.responseType);
559
- } catch (s) {
560
- throw h("Error making DELETE request:", s), s;
478
+ return C(c, r == null ? void 0 : r.responseType);
479
+ } catch (c) {
480
+ throw h("Error making POST request:", c), c;
561
481
  }
562
482
  }
563
- async function $t(e, t, r) {
564
- const n = R(r == null ? void 0 : r.headers), { app: a, backendUrl: o } = f, i = {
483
+ async function Pt(e, t, r) {
484
+ const n = L(r == null ? void 0 : r.headers), { app: a, backendUrl: s } = d, i = {
565
485
  app: a,
566
486
  ...t,
567
487
  locale: t.locale || navigator.language,
568
488
  noUserOverride: !0,
569
489
  noAutoAuthentication: !0
570
- }, s = o ? `${o}/${e}` : `${e}`;
571
- p(`Making PATCH request to: ${s}`);
490
+ }, o = `${s}/${e}`;
491
+ x(`Making PUT request to: ${o}`);
572
492
  try {
573
- const c = await fetch(s, {
574
- method: "PATCH",
493
+ const c = await fetch(o, {
494
+ method: "PUT",
575
495
  headers: n,
576
496
  credentials: "include",
577
497
  body: JSON.stringify(i)
578
498
  });
579
- return b(c, r == null ? void 0 : r.responseType);
499
+ return C(c, r == null ? void 0 : r.responseType);
580
500
  } catch (c) {
581
- throw h("Error making PATCH request:", c), c;
501
+ throw h("Error making PUT request:", c), c;
502
+ }
503
+ }
504
+ function Lt(e) {
505
+ const t = new AbortController(), { signal: r } = t;
506
+ return e && setTimeout(() => {
507
+ r.aborted || t.abort(new ue(`Request timed out after ${e}ms`));
508
+ }, e), { controller: t, signal: r };
509
+ }
510
+ function se(e) {
511
+ if (!e) return;
512
+ const t = new Date(e);
513
+ return Number.isNaN(t.getTime()) ? void 0 : t;
514
+ }
515
+ function yt(e) {
516
+ const t = se(e);
517
+ return !!t && t.getTime() <= Date.now();
518
+ }
519
+ function Ot(e, t = 7) {
520
+ const r = se(e);
521
+ 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;
524
+ }
525
+ async function $t(e, t = 0, r = 1e3) {
526
+ let n;
527
+ for (let a = 0; a <= t; a++)
528
+ try {
529
+ 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)));
534
+ }
535
+ throw n;
536
+ }
537
+ function Ut(e, t, r) {
538
+ var s, i, o, c;
539
+ if (!e || !t) return;
540
+ 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;
549
+ }
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
+ });
554
+ if (a) return a[0];
555
+ }
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) {
560
+ if (!e)
561
+ return m.none;
562
+ switch (e.toLocaleLowerCase()) {
563
+ case "bool":
564
+ case "boolean":
565
+ return m.bool;
566
+ case "date":
567
+ return m.date;
568
+ case "datetime":
569
+ return m.dateTime;
570
+ case "time":
571
+ return m.time;
572
+ case "unsigned":
573
+ return m.unsigned;
574
+ case "integer":
575
+ return m.integer;
576
+ case "float":
577
+ return m.float;
578
+ case "double":
579
+ return m.double;
580
+ case "dates":
581
+ return m.dates;
582
+ case "datetimes":
583
+ return m.dateTimes;
584
+ case "times":
585
+ return m.times;
586
+ case "varchar":
587
+ return m.varchar;
588
+ case "binary":
589
+ return m.binary;
590
+ case "string":
591
+ return m.string;
592
+ case "csv":
593
+ return m.csv;
594
+ default:
595
+ return m.none;
582
596
  }
583
597
  }
584
- let F, te;
585
- function x(e, t = !0) {
586
- let r = xe(e.$auditRecord);
587
- r && (Pe(r), t && Le(r)), e.$auditRecord = r;
598
+ function Re(e) {
599
+ switch (e) {
600
+ case "a":
601
+ return g.a;
602
+ case "c":
603
+ return g.c;
604
+ case "d":
605
+ return g.d;
606
+ case "e":
607
+ return g.e;
608
+ case "i":
609
+ return g.i;
610
+ case "l":
611
+ return g.l;
612
+ case "n":
613
+ return g.n;
614
+ case "t":
615
+ return g.t;
616
+ case "x":
617
+ return g.x;
618
+ case "z":
619
+ return g.z;
620
+ default:
621
+ return g.none;
622
+ }
588
623
  }
589
624
  function xe(e) {
625
+ let t = g.none;
626
+ if (e)
627
+ for (const r of e)
628
+ t |= Re(r);
629
+ return t;
630
+ }
631
+ function _(e, t, r, n) {
632
+ const a = Ce(t), s = xe(r || "");
633
+ return {
634
+ name: e,
635
+ type: t,
636
+ typeModifier: r,
637
+ eType: a,
638
+ eTypeModifier: s,
639
+ aliases: n
640
+ };
641
+ }
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"),
651
+ // json
652
+ extracts: _("extracts", "csv"),
653
+ extractsperpartname: _("extractsperpartname", "varchar"),
654
+ // json
655
+ extractslocations: _("extractslocations", "csv"),
656
+ documentweight: _("documentweight", "varchar"),
657
+ groupcount: _("groupcount", "integer"),
658
+ accesslists: _("accesslists", "varchar", void 0, ["accessLists"])
659
+ // json
660
+ };
661
+ function At(e, t) {
662
+ let r = e[t];
663
+ return r === void 0 ? [] : (typeof r == "string" && (r = String(r).split(",")), Array.isArray(r) ? r.map((n) => {
664
+ if (typeof n == "string") return n.trim();
665
+ if (typeof n == "object" && n !== null && "display" in n)
666
+ return n.display.trim();
667
+ }).filter((n) => n !== void 0) : [String(r).trim()]);
668
+ }
669
+ function Nt(e, t) {
670
+ let r = e[t];
671
+ if (r === void 0) return [];
672
+ if (typeof r == "string" && (r = String(r).split(",")), Array.isArray(r))
673
+ return r.map((a) => {
674
+ if (typeof a == "string")
675
+ return { display: a.trim(), value: a.trim() };
676
+ 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 };
679
+ }
680
+ }).filter(
681
+ (a) => a !== void 0
682
+ );
683
+ const n = String(r).trim();
684
+ return [{ display: n, value: n }];
685
+ }
686
+ function A(e) {
687
+ return e !== null && typeof e == "object";
688
+ }
689
+ function Pe(e) {
690
+ return A(e) && Object.prototype.toString.call(e) === "[object ArrayBuffer]";
691
+ }
692
+ function Le(e) {
693
+ return A(e) && Object.prototype.toString.call(e) === "[object Blob]";
694
+ }
695
+ function ye(e) {
696
+ return typeof e == "string";
697
+ }
698
+ function Ft(e) {
699
+ return (A(e) || Array.isArray(e)) && !Pe(e) && !Le(e) && !ye(e);
700
+ }
701
+ function Oe(e = !0) {
702
+ let t = Date.now();
703
+ return (e ? "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" : "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx").replace(/[xy]/g, (n) => {
704
+ const a = (t + Math.random() * 16) % 16 | 0;
705
+ return t = Math.floor(t / 16), (n === "x" ? a : a & 3 | 8).toString(16);
706
+ });
707
+ }
708
+ function Bt(e) {
709
+ if (!e)
710
+ return "``";
711
+ if (e = String(e), e.search(/[\\`]/) === -1)
712
+ return "`" + e + "`";
713
+ const t = ["`"];
714
+ for (let r = 0, n = e.length; r < n; r++) {
715
+ const a = e[r];
716
+ (a === "\\" || a === "`") && t.push("\\"), t.push(a);
717
+ }
718
+ return t.push("`"), t.join("");
719
+ }
720
+ function qt(e) {
721
+ if (typeof crypto < "u" && crypto.subtle && typeof crypto.subtle.digest == "function")
722
+ 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)));
724
+ } catch {
725
+ return Promise.resolve(Q(e));
726
+ }
727
+ return Promise.resolve(Q(e));
728
+ }
729
+ function Q(e) {
730
+ 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);
735
+ }
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;
740
+ }
741
+ function $e(e) {
590
742
  if (!e)
591
743
  return;
592
744
  let t;
593
745
  if (Array.isArray(e))
594
746
  t = e;
595
- else if ($(e)) {
747
+ else if (A(e)) {
596
748
  const r = e;
597
749
  if (r.auditEvents || r.mlAuditEvents)
598
750
  return r;
@@ -600,97 +752,105 @@ function xe(e) {
600
752
  }
601
753
  return { auditEvents: t };
602
754
  }
603
- function Pe(e) {
755
+ function Ue(e) {
604
756
  var r;
605
- const t = Oe();
757
+ const t = De();
606
758
  return (r = e.auditEvents) == null || r.forEach((n) => {
607
759
  n.detail || (n.detail = {}), n.detail.sessionid = t;
608
760
  }), e;
609
761
  }
610
- function Le(e) {
762
+ function Ie(e) {
611
763
  var r;
612
764
  const t = typeof window < "u" ? decodeURIComponent(window.location.href) : "http://localhost";
613
765
  return (r = e == null ? void 0 : e.auditEvents) == null || r.forEach((n) => {
614
766
  n.detail || (n.detail = {}), n.detail.url = t;
615
767
  }), e;
616
768
  }
617
- function Oe() {
618
- return (!F || $e()) && (F = ie()), te = /* @__PURE__ */ new Date(), F;
769
+ function De() {
770
+ return (!V || Ae()) && (V = Oe()), oe = /* @__PURE__ */ new Date(), V;
619
771
  }
620
- function $e() {
621
- return (/* @__PURE__ */ new Date()).getTime() - te.getTime() > 10 * 60 * 1e3;
772
+ function Ae() {
773
+ return (/* @__PURE__ */ new Date()).getTime() - oe.getTime() > 10 * 60 * 1e3;
622
774
  }
623
- async function Ue(e, t = !0) {
775
+ async function Ne(e, t = !0) {
624
776
  const r = {
625
- event: k.None,
777
+ event: v.None,
626
778
  $auditRecord: e
627
779
  };
628
- return x(r, t), u("api/v1/audit.notify", r);
780
+ return y(r, t), u("api/v1/audit.notify", r);
629
781
  }
630
- const Ut = { notify: Ue };
631
- async function yt(e, t, r) {
632
- var d;
633
- const n = ((d = e.items) == null ? void 0 : d.length) || 0, a = 10, o = {
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 = {
634
786
  query: { ...t, action: "aggregate", aggregations: { [e.name]: { skip: n, count: a } } },
635
787
  $auditRecord: { auditEvents: [r] }
636
788
  };
637
- x(o);
638
- const i = await u("api/v1/query", o), s = await b(i), { aggregations: c } = s, l = c[0];
789
+ y(s);
790
+ const i = await u("api/v1/query", s), o = await C(i), { aggregations: c } = o, l = c[0];
639
791
  return l.$hasMore = l.items.length > a, l.items = [...e.items, ...l.items], Promise.resolve(l);
640
792
  }
641
- async function It() {
642
- const { app: e } = f, t = new URLSearchParams({ app: e || "" });
643
- return S("api/v1/app", t);
793
+ async function Gt() {
794
+ const { app: e } = d, t = new URLSearchParams({ app: e || "" });
795
+ return p("api/v1/app", t);
644
796
  }
645
- async function ye() {
646
- const { app: e } = f, t = new URLSearchParams({
797
+ async function Fe() {
798
+ const { app: e } = d, t = new URLSearchParams({
647
799
  app: e || "",
648
800
  preLogin: "true"
649
801
  });
650
- return S("api/v1/app", t);
802
+ return p("api/v1/app", t);
651
803
  }
652
- function Dt() {
653
- let { backendUrl: e, app: t } = f;
804
+ function jt() {
805
+ let { backendUrl: e, app: t, useCredentials: r } = d;
654
806
  if (typeof window < "u") {
655
807
  if (e || (e = window.location.origin), !t) {
656
- const r = window.location.pathname.match(
808
+ const n = window.location.pathname.match(
657
809
  /\/app(?:-debug)?\/([^/#]+)/
658
810
  );
659
- r && (t = r[1]);
811
+ n && (t = n[1]);
660
812
  }
661
- m({
662
- ...f,
813
+ k({
814
+ ...d,
663
815
  backendUrl: e,
664
816
  app: t
665
817
  });
666
818
  }
667
- return ye().then((r) => {
668
- const { autoOAuthProvider: n, autoSAMLProvider: a } = f, o = !n && !r.autoOAuthProvider && !a && !r.autoSAMLProvider;
669
- return m({
670
- ...f,
671
- autoOAuthProvider: n || r.autoOAuthProvider,
672
- autoSAMLProvider: a || r.autoSAMLProvider,
673
- useCredentials: o,
674
- useSSO: o
675
- }), r;
676
- }).catch((r) => {
677
- throw h("atomic:fetchAppPreLogin error", r), r;
819
+ return r ? (k({
820
+ ...d,
821
+ useCredentials: !0,
822
+ useSSO: !1,
823
+ autoOAuthProvider: void 0,
824
+ autoSAMLProvider: void 0,
825
+ bearerToken: void 0,
826
+ useSAML: void 0
827
+ }), Promise.resolve({})) : Fe().then((n) => {
828
+ const { autoOAuthProvider: a, autoSAMLProvider: s } = d, i = !a && !n.autoOAuthProvider && !s && !n.autoSAMLProvider;
829
+ return k({
830
+ ...d,
831
+ autoOAuthProvider: a || n.autoOAuthProvider,
832
+ autoSAMLProvider: s || n.autoSAMLProvider,
833
+ useCredentials: i,
834
+ useSSO: i
835
+ }), n;
836
+ }).catch((n) => {
837
+ throw h("atomic:fetchAppPreLogin error", n), n;
678
838
  });
679
839
  }
680
- async function At(e, t, r = {}) {
681
- const n = `api/v1/search.dataset/${e}/${t}`, a = await u(n, { parameters: r }), o = t[0].toLowerCase() + t.slice(1), i = a.datasets[o];
840
+ 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];
682
842
  if ("errorCode" in i && "errorMessage" in i)
683
843
  throw new Error(i.errorMessage);
684
844
  return i;
685
845
  }
686
- async function Nt(e, t) {
846
+ async function Ht(e, t) {
687
847
  const r = `api/v1/search.dataset/${e}`, { parameters: n = {}, datasets: a = [] } = t;
688
848
  return (await u(r, { parameters: n, datasets: a })).datasets;
689
849
  }
690
- async function Ft(e) {
691
- return await S(`api/v1/search.dataset/${e}`);
850
+ async function Jt(e) {
851
+ return await p(`api/v1/search.dataset/${e}`);
692
852
  }
693
- async function Bt(e, t = !0, r) {
853
+ async function Wt(e, t = !0, r) {
694
854
  try {
695
855
  return (await u("api/v1/labels", {
696
856
  action: "list",
@@ -703,18 +863,18 @@ async function Bt(e, t = !0, r) {
703
863
  throw h("Error in fetchLabels", n), n;
704
864
  }
705
865
  }
706
- async function Ie() {
866
+ async function Be() {
707
867
  try {
708
- const { app: e = "" } = f, t = new URLSearchParams({
868
+ const { app: e = "" } = d, t = new URLSearchParams({
709
869
  app: e,
710
870
  action: "getUserRights"
711
871
  });
712
- return S("api/v1/labels", t);
872
+ return p("api/v1/labels", t);
713
873
  } catch (e) {
714
874
  throw h("Error in getUserRights", e), e;
715
875
  }
716
876
  }
717
- async function De(e, t, r = !0) {
877
+ async function qe(e, t, r = !0) {
718
878
  try {
719
879
  const n = {
720
880
  action: "add",
@@ -724,7 +884,7 @@ async function De(e, t, r = !0) {
724
884
  $auditRecord: {
725
885
  auditEvents: [
726
886
  {
727
- type: k.Label_AddDoc,
887
+ type: v.Label_AddDoc,
728
888
  detail: {
729
889
  public: r,
730
890
  label: e ? e.toString() : null,
@@ -745,7 +905,7 @@ async function De(e, t, r = !0) {
745
905
  throw h("Error in add", n), n;
746
906
  }
747
907
  }
748
- async function Ae(e, t, r = !0) {
908
+ async function Qe(e, t, r = !0) {
749
909
  try {
750
910
  const n = {
751
911
  action: "remove",
@@ -755,7 +915,7 @@ async function Ae(e, t, r = !0) {
755
915
  $auditRecord: {
756
916
  auditEvents: [
757
917
  {
758
- type: k.Label_RemoveDoc,
918
+ type: v.Label_RemoveDoc,
759
919
  detail: {
760
920
  public: r,
761
921
  label: e ? e.toString() : null,
@@ -776,7 +936,7 @@ async function Ae(e, t, r = !0) {
776
936
  throw h("Error in remove", n), n;
777
937
  }
778
938
  }
779
- async function Ne(e, t, r = !0) {
939
+ async function Ve(e, t, r = !0) {
780
940
  try {
781
941
  const n = {
782
942
  action: "rename",
@@ -784,7 +944,7 @@ async function Ne(e, t, r = !0) {
784
944
  newLabel: t,
785
945
  public: r,
786
946
  auditEvents: {
787
- type: k.Label_Rename,
947
+ type: v.Label_Rename,
788
948
  detail: {
789
949
  public: r,
790
950
  oldlabel: e ? e.toString() : null,
@@ -797,14 +957,14 @@ async function Ne(e, t, r = !0) {
797
957
  throw h("Error in rename", n), n;
798
958
  }
799
959
  }
800
- async function Fe(e, t = !0) {
960
+ async function Ge(e, t = !0) {
801
961
  try {
802
962
  const r = {
803
963
  action: "delete",
804
964
  labels: e,
805
965
  public: t,
806
966
  auditEvents: {
807
- type: k.Label_Delete,
967
+ type: v.Label_Delete,
808
968
  detail: {
809
969
  public: t,
810
970
  label: e ? e.toString() : null
@@ -816,7 +976,7 @@ async function Fe(e, t = !0) {
816
976
  throw h("Error in deleteLabels", r), r;
817
977
  }
818
978
  }
819
- async function Be(e, t, r = !0) {
979
+ async function je(e, t, r = !0) {
820
980
  try {
821
981
  const n = {
822
982
  action: "bulkAdd",
@@ -824,7 +984,7 @@ async function Be(e, t, r = !0) {
824
984
  query: t,
825
985
  public: r,
826
986
  auditEvents: {
827
- type: k.Label_Add,
987
+ type: v.Label_Add,
828
988
  detail: {
829
989
  public: r,
830
990
  label: e ? e.toString() : null,
@@ -837,7 +997,7 @@ async function Be(e, t, r = !0) {
837
997
  throw h("Error in bulkAdd", n), n;
838
998
  }
839
999
  }
840
- async function qe(e, t, r = !0) {
1000
+ async function ze(e, t, r = !0) {
841
1001
  try {
842
1002
  const n = {
843
1003
  action: "bulkRemove",
@@ -845,7 +1005,7 @@ async function qe(e, t, r = !0) {
845
1005
  query: t,
846
1006
  public: r,
847
1007
  auditEvents: {
848
- type: k.Label_Delete,
1008
+ type: v.Label_Delete,
849
1009
  detail: {
850
1010
  public: r,
851
1011
  label: e ? e.toString() : null,
@@ -858,16 +1018,16 @@ async function qe(e, t, r = !0) {
858
1018
  throw h("Error in bulkRemove", n), n;
859
1019
  }
860
1020
  }
861
- const qt = {
862
- getUserRights: Ie,
863
- add: De,
864
- remove: Ae,
865
- rename: Ne,
866
- delete: Fe,
867
- bulkAdd: Be,
868
- bulkRemove: qe
1021
+ const Xt = {
1022
+ getUserRights: Be,
1023
+ add: qe,
1024
+ remove: Qe,
1025
+ rename: Ve,
1026
+ delete: Ge,
1027
+ bulkAdd: je,
1028
+ bulkRemove: ze
869
1029
  };
870
- async function Qt(e, t) {
1030
+ async function Mt(e, t) {
871
1031
  if (typeof window > "u")
872
1032
  return u("api/v1/preview", {
873
1033
  action: "get",
@@ -882,7 +1042,7 @@ async function Qt(e, t) {
882
1042
  browserUrl: r
883
1043
  });
884
1044
  }
885
- async function Gt(e) {
1045
+ async function Yt(e) {
886
1046
  const t = new Headers();
887
1047
  t.append("content-type", "text");
888
1048
  const r = await fetch(
@@ -892,76 +1052,70 @@ async function Gt(e) {
892
1052
  headers: t
893
1053
  }
894
1054
  );
895
- b(r);
1055
+ C(r);
896
1056
  }
897
- async function Qe() {
1057
+ async function He() {
898
1058
  const e = new URLSearchParams({
899
1059
  action: "get",
900
1060
  noAutoAuthentication: "true"
901
1061
  });
902
- return S("api/v1/principal", e);
1062
+ return p("api/v1/principal", e);
903
1063
  }
904
- const re = 11;
905
- async function Vt(e, t, r) {
1064
+ const ce = 11;
1065
+ async function Kt(e, t, r) {
906
1066
  var i;
907
1067
  const a = await u("api/v1/query", {
908
1068
  query: e,
909
1069
  $auditRecord: t,
910
1070
  queryIntentData: r
911
1071
  });
912
- a.aggregations.forEach((s) => {
913
- s.$hasMore = !1, !s.isDistribution && !s.isTree && s.items && (s.$hasMore = s.items.length === re), s.isTree && s.items && q(s);
914
- }), (i = a.records) == null || i.map((s) => Object.assign(s, { value: s.title, type: "default" }));
915
- 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 };
916
- return Promise.resolve(o);
917
- }
918
- async function jt(e, t, r) {
919
- const { app: n = "" } = f, a = {
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 = {
920
1080
  methods: [],
921
1081
  mode: t,
922
1082
  propagateErrors: !0,
923
1083
  $auditRecord: { auditEvents: [r] }
924
1084
  };
925
- for (const s of e)
1085
+ for (const o of e)
926
1086
  a.methods.push({
927
1087
  method: "query",
928
1088
  app: n,
929
- query: s
1089
+ query: o
930
1090
  });
931
- const o = await u("api/v1/multi", a);
932
- o.results.forEach((s) => {
933
- s.aggregations.forEach((c) => {
934
- c.$hasMore = !1, !c.isDistribution && !c.isTree && c.items && (c.$hasMore = c.items.length === re), c.isTree && q(c);
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);
935
1095
  });
936
- }), o.results.forEach((s) => {
1096
+ }), s.results.forEach((o) => {
937
1097
  var c;
938
- return (c = s.records) == null ? void 0 : c.map((l) => Object.assign(l, { value: l.title, type: "default" }));
1098
+ return (c = o.records) == null ? void 0 : c.map((l) => Object.assign(l, { value: l.title, type: "default" }));
939
1099
  });
940
- const i = o.results.map((s) => ({ ...s, nextPage: s.page < Math.ceil(s.rowCount / s.pageSize) ? s.page + 1 : void 0, previousPage: s.page > 1 ? s.page - 1 : void 0 }));
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 }));
941
1101
  return Promise.resolve(i);
942
1102
  }
943
- function q(e, t = "", r = 0) {
1103
+ function z(e, t = "", r = 0) {
944
1104
  let n = [];
945
1105
  return e.items && e.items.forEach((a) => {
946
- let o = t ? `${t}/${a.value}` : a.value, i = r + 1;
947
- n.push({ path: o, level: i }), a.$path = o, a.$level = i, a.hasChildren ? n = n.concat(q(a, o, i)) : a.hasChildren = !1;
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;
948
1108
  }), n;
949
1109
  }
950
- async function zt(e) {
951
- const r = await u("api/v1/queryintent", {
952
- query: e
953
- });
954
- return r == null ? void 0 : r.intents;
955
- }
956
- async function Ht({ model: e, appName: t, query: r, article: n }) {
957
- const { webservice: a, format: o, maxcount: i, exportedColumns: s, export: c } = e, l = {
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 = {
958
1112
  app: t,
959
1113
  webservice: a,
960
1114
  query: r,
961
1115
  type: c,
962
- format: o,
1116
+ format: s,
963
1117
  maxcount: i,
964
- exportedColumns: s,
1118
+ exportedColumns: o,
965
1119
  $auditRecord: {
966
1120
  auditEvents: [{
967
1121
  type: "Search_ExportCSV",
@@ -971,9 +1125,15 @@ async function Ht({ model: e, appName: t, query: r, article: n }) {
971
1125
  }]
972
1126
  }
973
1127
  };
974
- return x(l), await u("api/v1/search.queryexport", l, { responseType: "blob" });
1128
+ return y(l), await u("api/v1/search.queryexport", l, { responseType: "blob" });
975
1129
  }
976
- async function Jt(e, t, r) {
1130
+ async function Tt(e) {
1131
+ const r = await u("api/v1/queryintent", {
1132
+ query: e
1133
+ });
1134
+ return r == null ? void 0 : r.intents;
1135
+ }
1136
+ async function er(e, t, r) {
977
1137
  return (await u(
978
1138
  "api/v1/similardocuments",
979
1139
  {
@@ -985,17 +1145,17 @@ async function Jt(e, t, r) {
985
1145
  { signal: r }
986
1146
  )).data;
987
1147
  }
988
- async function Wt(e, t) {
1148
+ async function tr(e, t) {
989
1149
  var a;
990
1150
  const n = await u("api/v1/query.links", {
991
1151
  webservice: e,
992
1152
  query: t
993
1153
  });
994
- return (a = n == null ? void 0 : n.links) == null ? void 0 : a.map((o) => ({ ...o, query: t }));
1154
+ return (a = n == null ? void 0 : n.links) == null ? void 0 : a.map((s) => ({ ...s, query: t }));
995
1155
  }
996
- async function Xt(e, t, r, n, a) {
997
- const { app: o } = f, i = {
998
- app: o || "",
1156
+ async function rr(e, t, r, n, a) {
1157
+ const { app: s } = d, i = {
1158
+ app: s || "",
999
1159
  suggestQuery: e,
1000
1160
  text: t,
1001
1161
  filter: r,
@@ -1004,12 +1164,12 @@ async function Xt(e, t, r, n, a) {
1004
1164
  };
1005
1165
  try {
1006
1166
  return (await u("api/v1/search.suggest", i)).suggests;
1007
- } catch (s) {
1008
- throw console.error("Error fetching suggestions:", s), s;
1167
+ } catch (o) {
1168
+ throw console.error("Error fetching suggestions:", o), o;
1009
1169
  }
1010
1170
  }
1011
- async function Mt(e, t, r, n) {
1012
- const { app: a } = f;
1171
+ async function nr(e, t, r, n) {
1172
+ const { app: a } = d;
1013
1173
  return (await u("api/v1/suggestquery", {
1014
1174
  app: a || "",
1015
1175
  suggestQuery: e,
@@ -1018,9 +1178,9 @@ async function Mt(e, t, r, n) {
1018
1178
  kinds: n
1019
1179
  })).suggests;
1020
1180
  }
1021
- async function Yt(e, t) {
1181
+ async function ar(e, t) {
1022
1182
  if (!t) return Promise.resolve([]);
1023
- const { app: r } = f;
1183
+ const { app: r } = d;
1024
1184
  return (await u("api/v1/suggestfield", {
1025
1185
  app: r || "",
1026
1186
  text: e,
@@ -1028,47 +1188,57 @@ async function Yt(e, t) {
1028
1188
  fields: t
1029
1189
  })).suggests;
1030
1190
  }
1031
- async function Kt(e, t, r, n, a, o) {
1191
+ async function sr(e, t, r, n, a, s) {
1032
1192
  return u("api/v1/doc.textchunks", {
1033
1193
  id: e,
1034
1194
  textChunks: t,
1035
1195
  highlights: r,
1036
1196
  query: n,
1037
1197
  leftSentencesCount: a,
1038
- rightSentencesCount: o
1198
+ rightSentencesCount: s
1039
1199
  });
1040
1200
  }
1041
- async function Zt() {
1042
- const { app: e } = f, t = new URLSearchParams({
1201
+ async function or() {
1202
+ const { app: e } = d, t = new URLSearchParams({
1043
1203
  app: e || "",
1044
1204
  action: "load"
1045
1205
  });
1046
- return S("api/v1/usersettings", t);
1206
+ return p("api/v1/usersettings", t);
1047
1207
  }
1048
- async function Ge(e, t) {
1208
+ async function Je(e, t) {
1049
1209
  const r = {
1050
1210
  action: "save",
1051
1211
  userSettings: e,
1052
1212
  $auditRecord: { auditEvents: [t] }
1053
1213
  };
1054
- return x(r), u("api/v1/usersettings", r);
1214
+ return y(r), u("api/v1/usersettings", r);
1055
1215
  }
1056
- async function Et(e, t) {
1216
+ async function cr(e, t) {
1057
1217
  const n = {
1058
1218
  action: "patch",
1059
1219
  userSettings: e,
1060
1220
  $auditRecord: t ? { auditEvents: [t] } : void 0
1061
1221
  };
1062
- return x(n), u("api/v1/usersettings", n);
1222
+ return y(n), u("api/v1/usersettings", n);
1223
+ }
1224
+ async function ir() {
1225
+ return Je({}, { type: "UserSettings_Reset" });
1063
1226
  }
1064
- async function Tt() {
1065
- return Ge({}, { type: "UserSettings_Reset" });
1227
+ async function lr(e, t) {
1228
+ return u("api/v2/security/password/change", { newPassword: e, currentPassword: t });
1229
+ }
1230
+ async function ur(e) {
1231
+ const t = "api/v2/security/password/ask-reset-email", n = {
1232
+ changePasswordRedirectUrl: `${window.location.origin}/login?mode=changepassword`,
1233
+ userName: e
1234
+ };
1235
+ return u(t, n);
1066
1236
  }
1067
- async function er() {
1068
- return await S("api/v2/version");
1237
+ async function dr() {
1238
+ return await p("api/v2/version");
1069
1239
  }
1070
- const Ve = async () => {
1071
- const { autoOAuthProvider: e } = f;
1240
+ const We = async () => {
1241
+ const { autoOAuthProvider: e } = d;
1072
1242
  if (typeof window > "u")
1073
1243
  return u("security.oauth", {
1074
1244
  action: "getcode",
@@ -1091,8 +1261,8 @@ const Ve = async () => {
1091
1261
  } catch (r) {
1092
1262
  throw console.error("Failed to authenticate with OAuth", r), r;
1093
1263
  }
1094
- }, je = async () => {
1095
- const { autoSAMLProvider: e } = f;
1264
+ }, Xe = async () => {
1265
+ const { autoSAMLProvider: e } = d;
1096
1266
  if (typeof window > "u")
1097
1267
  return u("security.saml", {
1098
1268
  action: "getresponse",
@@ -1115,7 +1285,7 @@ const Ve = async () => {
1115
1285
  } catch (r) {
1116
1286
  throw console.error("Failed to authenticate with SAML", r), r;
1117
1287
  }
1118
- }, Q = {
1288
+ }, H = {
1119
1289
  store: {},
1120
1290
  getItem(e) {
1121
1291
  return this.store[e] ?? null;
@@ -1129,36 +1299,36 @@ const Ve = async () => {
1129
1299
  clear() {
1130
1300
  this.store = {};
1131
1301
  }
1132
- }, G = Q;
1133
- function ze(e) {
1134
- return typeof window > "u" || !window.localStorage ? Q.getItem(e) : window.localStorage.getItem(e);
1302
+ }, J = H;
1303
+ function Me(e) {
1304
+ return typeof window > "u" || !window.localStorage ? H.getItem(e) : window.localStorage.getItem(e);
1135
1305
  }
1136
- function He(e) {
1137
- typeof window > "u" || !window.localStorage ? Q.removeItem(e) : window.localStorage.removeItem(e);
1306
+ function Ye(e) {
1307
+ typeof window > "u" || !window.localStorage ? H.removeItem(e) : window.localStorage.removeItem(e);
1138
1308
  }
1139
- function Je(e) {
1140
- return typeof window > "u" || !window.sessionStorage ? G.getItem(e) : window.sessionStorage.getItem(e);
1309
+ function Ke(e) {
1310
+ return typeof window > "u" || !window.sessionStorage ? J.getItem(e) : window.sessionStorage.getItem(e);
1141
1311
  }
1142
- function We(e, t) {
1143
- typeof window > "u" || !window.sessionStorage ? G.setItem(e, t) : window.sessionStorage.setItem(e, t);
1312
+ function Ze(e, t) {
1313
+ typeof window > "u" || !window.sessionStorage ? J.setItem(e, t) : window.sessionStorage.setItem(e, t);
1144
1314
  }
1145
- function Xe(e) {
1146
- typeof window > "u" || !window.sessionStorage ? G.removeItem(e) : window.sessionStorage.removeItem(e);
1315
+ function Ee(e) {
1316
+ typeof window > "u" || !window.sessionStorage ? J.removeItem(e) : window.sessionStorage.removeItem(e);
1147
1317
  }
1148
- const O = (e) => We(
1318
+ const U = (e) => Ze(
1149
1319
  "sinequa-credentials",
1150
1320
  JSON.stringify({ data: { csrfToken: e } })
1151
- ), Me = async () => {
1321
+ ), Te = async () => {
1152
1322
  try {
1153
- const e = await S(
1323
+ const e = await p(
1154
1324
  "api/v1/challenge?action=getCsrfToken&suppressErrors=true"
1155
1325
  );
1156
- return e != null && e.csrfToken ? (O(e.csrfToken), e.csrfToken) : null;
1326
+ return e != null && e.csrfToken ? (U(e.csrfToken), e.csrfToken) : null;
1157
1327
  } catch (e) {
1158
1328
  throw h("Failed to get CSRF token", e), e;
1159
1329
  }
1160
1330
  };
1161
- async function Ye(e) {
1331
+ async function et(e) {
1162
1332
  if (e) {
1163
1333
  const { username: t, password: r } = e, n = {
1164
1334
  action: "get",
@@ -1173,7 +1343,7 @@ async function Ye(e) {
1173
1343
  "api/v1/security.webtoken",
1174
1344
  n
1175
1345
  );
1176
- return a != null && a.csrfToken ? (O(a.csrfToken), a.csrfToken) : null;
1346
+ return a != null && a.csrfToken ? (U(a.csrfToken), a.csrfToken) : null;
1177
1347
  } catch (a) {
1178
1348
  throw console.error("Failed to get JWT", a), a;
1179
1349
  }
@@ -1184,7 +1354,7 @@ async function Ye(e) {
1184
1354
  noUserOverride: !0,
1185
1355
  noAutoAuthentication: !1
1186
1356
  // Allow auto authentication for credentialless requests
1187
- }, { bearerToken: r } = f;
1357
+ }, { bearerToken: r } = d;
1188
1358
  if (!r)
1189
1359
  throw new Error(
1190
1360
  "Bearer token is required in globalConfig for credentialless JWT retrieval."
@@ -1197,191 +1367,201 @@ async function Ye(e) {
1197
1367
  t,
1198
1368
  { headers: n }
1199
1369
  );
1200
- return a.csrfToken ? (O(a.csrfToken), a.csrfToken) : null;
1370
+ return a.csrfToken ? (U(a.csrfToken), a.csrfToken) : null;
1201
1371
  } catch (a) {
1202
1372
  throw console.error("Failed to get JWT without credentials", a), a;
1203
1373
  }
1204
1374
  }
1205
1375
  }
1206
- const V = () => {
1376
+ const W = () => {
1207
1377
  var r;
1208
- const e = Je("sinequa-credentials");
1378
+ const e = Ke("sinequa-credentials");
1209
1379
  if (e)
1210
1380
  try {
1211
1381
  const a = (r = JSON.parse(e).data) == null ? void 0 : r.csrfToken;
1212
1382
  if (a !== void 0) return a;
1213
1383
  } catch {
1214
1384
  }
1215
- const t = ze("csrfToken");
1385
+ const t = Me("csrfToken");
1216
1386
  return t !== null ? t : null;
1217
- }, tr = async (e) => {
1387
+ }, fr = async (e) => {
1218
1388
  if (e)
1219
- w("Attempting authentication using credentials"), m({ useCredentials: !0, useSSO: !1 });
1389
+ S("Attempting authentication using credentials"), k({ useCredentials: !0, useSSO: !1 });
1220
1390
  else {
1221
- let s = null;
1391
+ let o = null;
1222
1392
  try {
1223
- w("Attempting to retrieve CSRF token from the backend"), s = await Me(), p("CSRF token retrieval result", s ? "success" : "failed");
1393
+ S("Attempting to retrieve CSRF token from the backend"), o = await Te(), x("CSRF token retrieval result", o ? "success" : "failed");
1224
1394
  } catch (c) {
1225
1395
  h("Failed to retrieve CSRF token", c);
1226
1396
  }
1227
1397
  try {
1228
- if (s === null) {
1229
- const { autoOAuthProvider: c, autoSAMLProvider: l, useSAML: d } = f;
1230
- if (c && !d)
1231
- return w("Initiating OAuth authentication flow"), await Ve(), v("OAuth authentication flow did not redirect as expected"), _(!1), !1;
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;
1232
1402
  if (l)
1233
- return w("Initiating SAML authentication flow"), await je(), v("SAML authentication flow did not redirect as expected"), _(!1), !1;
1234
- w(
1403
+ return S("Initiating SAML authentication flow"), await Xe(), P("SAML authentication flow did not redirect as expected"), w(!1), !1;
1404
+ S(
1235
1405
  "No direct authentication method available, will try SSO then credentials"
1236
- ), m({ useCredentials: !0, useSSO: !0 });
1406
+ ), k({ useCredentials: !0, useSSO: !0 });
1237
1407
  } else
1238
- return w("User authenticated via existing token"), _(!0), !0;
1408
+ return S("User authenticated via existing token"), w(!0), !0;
1239
1409
  } catch (c) {
1240
- throw h("Unexpected error during authentication", c), _(!1), c;
1410
+ throw h("Unexpected error during authentication", c), w(!1), c;
1241
1411
  }
1242
1412
  }
1243
- if (f.useCredentials && f.useSSO)
1413
+ if (d.useCredentials && d.useSSO)
1244
1414
  try {
1245
- if (w("Checking if user is authenticated via SSO"), await Qe())
1246
- return w("User authenticated using SSO"), m({ useCredentials: !1, useSSO: !0 }), _(!0), !0;
1247
- } catch (s) {
1248
- if ((s == null ? void 0 : s.status) === 401)
1249
- return w("SSO authentication failed with 401, falling back to credentials"), m({ useCredentials: !0, useSSO: !1 }), !1;
1250
- throw h("SSO authentication failed with unexpected error", s), _(!1), h;
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)
1419
+ 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;
1251
1421
  }
1252
- const { useSSO: r } = f, n = V();
1422
+ const { useSSO: r } = d, n = W();
1253
1423
  if (n && n !== null || r)
1254
- return w("user already authenticated", n), m({ isRedirectUrl: !1 }), _(!0), !0;
1255
- const { useCredentials: a } = f, { username: o, password: i } = e || {};
1256
- if (a && !o && !i)
1257
- return h("Credentials are required for authentication"), _(!1), !1;
1258
- if (o && i)
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)
1259
1429
  try {
1260
- return w("authentication using credentials..."), m({ useCredentials: !0, useSSO: !1 }), await Ye({ username: o, password: i }), _(!0), !0;
1261
- } catch (s) {
1262
- throw _(!1), s;
1430
+ 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;
1263
1435
  }
1264
- return _(!1), h(
1436
+ return w(!1), h(
1265
1437
  "No authentication method available. Please provide credentials or configure OAuth/SAML."
1266
1438
  ), !1;
1267
- }, Ke = async () => {
1439
+ }, tt = async () => {
1268
1440
  const e = new URLSearchParams({
1269
1441
  action: "deleteWebTokenCookie",
1270
1442
  noUserOverride: "true",
1271
1443
  noAutoAuthentication: "true"
1272
1444
  });
1273
- return S("api/v1/challenge", e);
1274
- }, rr = async () => {
1275
- const { useCredentials: e, userOverrideActive: t } = f;
1276
- He("csrfToken"), Xe("sinequa-credentials"), e && !t ? (await Ke()).methodresult === "ok" ? _(!1) : console.error("logout failed") : _(!1);
1277
- }, nr = () => !!V();
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();
1278
1450
  export {
1279
- g as ApiError,
1280
- Ut as Audit,
1281
- k as AuditEventType,
1282
- fe as DidYouMeanKind,
1283
- le as EngineType,
1284
- ue as EngineTypeModifier,
1285
- E as LogLevel,
1286
- nt as MINIMUM_COMPATIBLE_SERVER_API_VERSION,
1287
- de as RFMDisplay,
1288
- he as ServerError,
1289
- _e as TimeoutError,
1290
- Z as UnauthorizedError,
1291
- x as addAuditAdditionalInfo,
1292
- ft as addConcepts,
1293
- Pe as addSessionId,
1294
- Le as addUrl,
1295
- we as aggItemRegex,
1296
- it as aggregationItemStrictCompare,
1297
- Dt as appInitializerFn,
1298
- ut as bisect,
1299
- q as buildPathsAndLevels,
1300
- ot as configureLogger,
1301
- R as createHeaders,
1302
- at as createTimeoutController,
1303
- p as debug,
1304
- Ot as del,
1305
- Tt as deleteUserSettings,
1306
- Ke as deleteWebTokenCookie,
1307
- _ as emitAuthenticatedEvent,
1451
+ b as ApiError,
1452
+ Qt as Audit,
1453
+ v as AuditEventType,
1454
+ ve as DidYouMeanKind,
1455
+ m as EngineType,
1456
+ 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,
1308
1480
  h as error,
1309
- tt as escapeExpr,
1310
- yt as fetchAggregation,
1311
- It as fetchApp,
1312
- ye as fetchAppPreLogin,
1313
- jt as fetchBulkQuery,
1314
- At as fetchDataset,
1315
- Ft as fetchDatasetList,
1316
- Nt as fetchDatasets,
1317
- Bt as fetchLabels,
1318
- Qt as fetchPreview,
1319
- Gt as fetchPreviewUrl,
1320
- Qe as fetchPrincipal,
1321
- Vt as fetchQuery,
1322
- Ht as fetchQueryExport,
1323
- zt as fetchQueryIntent,
1324
- Jt as fetchSimilarDocuments,
1325
- Wt as fetchSponsoredLinks,
1326
- Xt as fetchSuggest,
1327
- Yt as fetchSuggestField,
1328
- Mt as fetchSuggestQuery,
1329
- Kt as fetchTextChunks,
1330
- Zt as fetchUserSettings,
1331
- er as fetchVersion,
1332
- S as get,
1333
- _t as getConcepts,
1334
- Me as getCsrfToken,
1335
- ee as getFiltersFromURI,
1336
- kt as getFiltersFromUrl,
1337
- xt as getHelpIndexUrl,
1338
- pt as getIdFromUrl,
1339
- Ye as getJWToken,
1340
- Te as getMetadata,
1341
- Re as getOffsetFromDates,
1342
- Ct as getQueryPageFromUrl,
1343
- mt as getQueryParamsFromUrl,
1344
- vt as getQueryTabFromUrl,
1345
- bt as getQueryTextFromUrl,
1346
- wt as getRelativeDate,
1347
- V as getToken,
1348
- gt as getUrlParamsFromQueryParams,
1349
- f as globalConfig,
1350
- ie as guid,
1351
- b as handleResponse,
1352
- w as info,
1353
- oe as isArrayBuffer,
1354
- nr as isAuthenticated,
1355
- se as isBlob,
1356
- et as isJsonable,
1357
- St as isNotInputEvent,
1358
- $ as isObject,
1359
- ce as isString,
1360
- qt as labels,
1361
- tr as login,
1362
- rr as logout,
1363
- Pt as notify,
1364
- me as openParentNodes,
1365
- y as parseText,
1366
- Se as parseValueAndOperatorFromItem,
1367
- $t as patch,
1368
- Et as patchUserSettings,
1481
+ Bt as escapeExpr,
1482
+ 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,
1489
+ zt as fetchDataset,
1490
+ Jt as fetchDatasetList,
1491
+ Ht as fetchDatasets,
1492
+ Wt as fetchLabels,
1493
+ Mt as fetchPreview,
1494
+ 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,
1505
+ 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,
1516
+ At as getMetadata,
1517
+ 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,
1528
+ C as handleResponse,
1529
+ 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,
1536
+ A as isObject,
1537
+ 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,
1547
+ cr as patchUserSettings,
1369
1548
  u as post,
1370
- Lt as put,
1371
- C as queryParamsFromUrl,
1372
- dt as removeConcept,
1373
- ht as removeConcepts,
1374
- Ee as resolveToColumnName,
1375
- B as rewriteText,
1376
- Ge as saveUserSettings,
1377
- m as setGlobalConfig,
1378
- O as setToken,
1379
- rt as sha512,
1380
- lt as suggestionsToTreeAggregationNodes,
1381
- Rt as sysLang,
1382
- ct as translateAggregationToDateOptions,
1383
- Ve as tryOAuthAuthentication,
1384
- je as trySAMLAuthentication,
1385
- v as warn,
1386
- st as withRetry
1549
+ Pt as put,
1550
+ R as queryParamsFromUrl,
1551
+ it as removeConcept,
1552
+ lt as removeConcepts,
1553
+ Ut as resolveToColumnName,
1554
+ j as rewriteText,
1555
+ Je as saveUserSettings,
1556
+ k as setGlobalConfig,
1557
+ 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,
1565
+ P as warn,
1566
+ $t as withRetry
1387
1567
  };