@sinequa/atomic 0.0.121 → 0.0.122

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