@indxsearch/intrface 1.0.0
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/README.md +471 -0
- package/dist/index.es.js +1705 -0
- package/dist/index.umd.js +22 -0
- package/dist/intrface.css +1 -0
- package/package.json +41 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,1705 @@
|
|
|
1
|
+
var dt = Object.defineProperty;
|
|
2
|
+
var ht = (r, a, d) => a in r ? dt(r, a, { enumerable: !0, configurable: !0, writable: !0, value: d }) : r[a] = d;
|
|
3
|
+
var et = (r, a, d) => ht(r, typeof a != "symbol" ? a + "" : a, d);
|
|
4
|
+
import "@indxsearch/systm/styles.css";
|
|
5
|
+
import re, { createContext as ft, useRef as Ne, useState as X, useEffect as me, useCallback as te, useMemo as Ue, useContext as gt, memo as at, Component as mt } from "react";
|
|
6
|
+
import { SearchField as pt, Button as xe, FilterPanelBase as ve, ToggleSwitch as ne, Checkbox as tt, Slider as it, InputField as Y, Select as vt, RadioButton as xt } from "@indxsearch/systm";
|
|
7
|
+
var Le = { exports: {} }, Ie = {};
|
|
8
|
+
/**
|
|
9
|
+
* @license React
|
|
10
|
+
* react-jsx-runtime.production.js
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
var rt;
|
|
18
|
+
function bt() {
|
|
19
|
+
if (rt) return Ie;
|
|
20
|
+
rt = 1;
|
|
21
|
+
var r = Symbol.for("react.transitional.element"), a = Symbol.for("react.fragment");
|
|
22
|
+
function d(i, c, v) {
|
|
23
|
+
var R = null;
|
|
24
|
+
if (v !== void 0 && (R = "" + v), c.key !== void 0 && (R = "" + c.key), "key" in c) {
|
|
25
|
+
v = {};
|
|
26
|
+
for (var x in c)
|
|
27
|
+
x !== "key" && (v[x] = c[x]);
|
|
28
|
+
} else v = c;
|
|
29
|
+
return c = v.ref, {
|
|
30
|
+
$$typeof: r,
|
|
31
|
+
type: i,
|
|
32
|
+
key: R,
|
|
33
|
+
ref: c !== void 0 ? c : null,
|
|
34
|
+
props: v
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return Ie.Fragment = a, Ie.jsx = d, Ie.jsxs = d, Ie;
|
|
38
|
+
}
|
|
39
|
+
var $e = {};
|
|
40
|
+
/**
|
|
41
|
+
* @license React
|
|
42
|
+
* react-jsx-runtime.development.js
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/
|
|
49
|
+
var st;
|
|
50
|
+
function St() {
|
|
51
|
+
return st || (st = 1, process.env.NODE_ENV !== "production" && function() {
|
|
52
|
+
function r(t) {
|
|
53
|
+
if (t == null) return null;
|
|
54
|
+
if (typeof t == "function")
|
|
55
|
+
return t.$$typeof === G ? null : t.displayName || t.name || null;
|
|
56
|
+
if (typeof t == "string") return t;
|
|
57
|
+
switch (t) {
|
|
58
|
+
case p:
|
|
59
|
+
return "Fragment";
|
|
60
|
+
case H:
|
|
61
|
+
return "Profiler";
|
|
62
|
+
case q:
|
|
63
|
+
return "StrictMode";
|
|
64
|
+
case W:
|
|
65
|
+
return "Suspense";
|
|
66
|
+
case M:
|
|
67
|
+
return "SuspenseList";
|
|
68
|
+
case be:
|
|
69
|
+
return "Activity";
|
|
70
|
+
}
|
|
71
|
+
if (typeof t == "object")
|
|
72
|
+
switch (typeof t.tag == "number" && console.error(
|
|
73
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
74
|
+
), t.$$typeof) {
|
|
75
|
+
case Z:
|
|
76
|
+
return "Portal";
|
|
77
|
+
case h:
|
|
78
|
+
return (t.displayName || "Context") + ".Provider";
|
|
79
|
+
case s:
|
|
80
|
+
return (t._context.displayName || "Context") + ".Consumer";
|
|
81
|
+
case E:
|
|
82
|
+
var o = t.render;
|
|
83
|
+
return t = t.displayName, t || (t = o.displayName || o.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
84
|
+
case m:
|
|
85
|
+
return o = t.displayName || null, o !== null ? o : r(t.type) || "Memo";
|
|
86
|
+
case le:
|
|
87
|
+
o = t._payload, t = t._init;
|
|
88
|
+
try {
|
|
89
|
+
return r(t(o));
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
function a(t) {
|
|
96
|
+
return "" + t;
|
|
97
|
+
}
|
|
98
|
+
function d(t) {
|
|
99
|
+
try {
|
|
100
|
+
a(t);
|
|
101
|
+
var o = !1;
|
|
102
|
+
} catch {
|
|
103
|
+
o = !0;
|
|
104
|
+
}
|
|
105
|
+
if (o) {
|
|
106
|
+
o = console;
|
|
107
|
+
var u = o.error, j = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
108
|
+
return u.call(
|
|
109
|
+
o,
|
|
110
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
111
|
+
j
|
|
112
|
+
), a(t);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function i(t) {
|
|
116
|
+
if (t === p) return "<>";
|
|
117
|
+
if (typeof t == "object" && t !== null && t.$$typeof === le)
|
|
118
|
+
return "<...>";
|
|
119
|
+
try {
|
|
120
|
+
var o = r(t);
|
|
121
|
+
return o ? "<" + o + ">" : "<...>";
|
|
122
|
+
} catch {
|
|
123
|
+
return "<...>";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function c() {
|
|
127
|
+
var t = se.A;
|
|
128
|
+
return t === null ? null : t.getOwner();
|
|
129
|
+
}
|
|
130
|
+
function v() {
|
|
131
|
+
return Error("react-stack-top-frame");
|
|
132
|
+
}
|
|
133
|
+
function R(t) {
|
|
134
|
+
if (A.call(t, "key")) {
|
|
135
|
+
var o = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
136
|
+
if (o && o.isReactWarning) return !1;
|
|
137
|
+
}
|
|
138
|
+
return t.key !== void 0;
|
|
139
|
+
}
|
|
140
|
+
function x(t, o) {
|
|
141
|
+
function u() {
|
|
142
|
+
y || (y = !0, console.error(
|
|
143
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
144
|
+
o
|
|
145
|
+
));
|
|
146
|
+
}
|
|
147
|
+
u.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
148
|
+
get: u,
|
|
149
|
+
configurable: !0
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function n() {
|
|
153
|
+
var t = r(this.type);
|
|
154
|
+
return z[t] || (z[t] = !0, console.error(
|
|
155
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
156
|
+
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
157
|
+
}
|
|
158
|
+
function b(t, o, u, j, I, L, ue, oe) {
|
|
159
|
+
return u = L.ref, t = {
|
|
160
|
+
$$typeof: S,
|
|
161
|
+
type: t,
|
|
162
|
+
key: o,
|
|
163
|
+
props: L,
|
|
164
|
+
_owner: I
|
|
165
|
+
}, (u !== void 0 ? u : null) !== null ? Object.defineProperty(t, "ref", {
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
get: n
|
|
168
|
+
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
169
|
+
configurable: !1,
|
|
170
|
+
enumerable: !1,
|
|
171
|
+
writable: !0,
|
|
172
|
+
value: 0
|
|
173
|
+
}), Object.defineProperty(t, "_debugInfo", {
|
|
174
|
+
configurable: !1,
|
|
175
|
+
enumerable: !1,
|
|
176
|
+
writable: !0,
|
|
177
|
+
value: null
|
|
178
|
+
}), Object.defineProperty(t, "_debugStack", {
|
|
179
|
+
configurable: !1,
|
|
180
|
+
enumerable: !1,
|
|
181
|
+
writable: !0,
|
|
182
|
+
value: ue
|
|
183
|
+
}), Object.defineProperty(t, "_debugTask", {
|
|
184
|
+
configurable: !1,
|
|
185
|
+
enumerable: !1,
|
|
186
|
+
writable: !0,
|
|
187
|
+
value: oe
|
|
188
|
+
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
189
|
+
}
|
|
190
|
+
function O(t, o, u, j, I, L, ue, oe) {
|
|
191
|
+
var P = o.children;
|
|
192
|
+
if (P !== void 0)
|
|
193
|
+
if (j)
|
|
194
|
+
if (Se(P)) {
|
|
195
|
+
for (j = 0; j < P.length; j++)
|
|
196
|
+
w(P[j]);
|
|
197
|
+
Object.freeze && Object.freeze(P);
|
|
198
|
+
} else
|
|
199
|
+
console.error(
|
|
200
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
201
|
+
);
|
|
202
|
+
else w(P);
|
|
203
|
+
if (A.call(o, "key")) {
|
|
204
|
+
P = r(t);
|
|
205
|
+
var ae = Object.keys(o).filter(function(T) {
|
|
206
|
+
return T !== "key";
|
|
207
|
+
});
|
|
208
|
+
j = 0 < ae.length ? "{key: someKey, " + ae.join(": ..., ") + ": ...}" : "{key: someKey}", f[P + j] || (ae = 0 < ae.length ? "{" + ae.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
209
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
210
|
+
let props = %s;
|
|
211
|
+
<%s {...props} />
|
|
212
|
+
React keys must be passed directly to JSX without using spread:
|
|
213
|
+
let props = %s;
|
|
214
|
+
<%s key={someKey} {...props} />`,
|
|
215
|
+
j,
|
|
216
|
+
P,
|
|
217
|
+
ae,
|
|
218
|
+
P
|
|
219
|
+
), f[P + j] = !0);
|
|
220
|
+
}
|
|
221
|
+
if (P = null, u !== void 0 && (d(u), P = "" + u), R(o) && (d(o.key), P = "" + o.key), "key" in o) {
|
|
222
|
+
u = {};
|
|
223
|
+
for (var ye in o)
|
|
224
|
+
ye !== "key" && (u[ye] = o[ye]);
|
|
225
|
+
} else u = o;
|
|
226
|
+
return P && x(
|
|
227
|
+
u,
|
|
228
|
+
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
229
|
+
), b(
|
|
230
|
+
t,
|
|
231
|
+
P,
|
|
232
|
+
L,
|
|
233
|
+
I,
|
|
234
|
+
c(),
|
|
235
|
+
u,
|
|
236
|
+
ue,
|
|
237
|
+
oe
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
function w(t) {
|
|
241
|
+
typeof t == "object" && t !== null && t.$$typeof === S && t._store && (t._store.validated = 1);
|
|
242
|
+
}
|
|
243
|
+
var $ = re, S = Symbol.for("react.transitional.element"), Z = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), H = Symbol.for("react.profiler"), s = Symbol.for("react.consumer"), h = Symbol.for("react.context"), E = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), M = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), le = Symbol.for("react.lazy"), be = Symbol.for("react.activity"), G = Symbol.for("react.client.reference"), se = $.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, Se = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
244
|
+
return null;
|
|
245
|
+
};
|
|
246
|
+
$ = {
|
|
247
|
+
"react-stack-bottom-frame": function(t) {
|
|
248
|
+
return t();
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
var y, z = {}, pe = $["react-stack-bottom-frame"].bind(
|
|
252
|
+
$,
|
|
253
|
+
v
|
|
254
|
+
)(), ce = N(i(v)), f = {};
|
|
255
|
+
$e.Fragment = p, $e.jsx = function(t, o, u, j, I) {
|
|
256
|
+
var L = 1e4 > se.recentlyCreatedOwnerStacks++;
|
|
257
|
+
return O(
|
|
258
|
+
t,
|
|
259
|
+
o,
|
|
260
|
+
u,
|
|
261
|
+
!1,
|
|
262
|
+
j,
|
|
263
|
+
I,
|
|
264
|
+
L ? Error("react-stack-top-frame") : pe,
|
|
265
|
+
L ? N(i(t)) : ce
|
|
266
|
+
);
|
|
267
|
+
}, $e.jsxs = function(t, o, u, j, I) {
|
|
268
|
+
var L = 1e4 > se.recentlyCreatedOwnerStacks++;
|
|
269
|
+
return O(
|
|
270
|
+
t,
|
|
271
|
+
o,
|
|
272
|
+
u,
|
|
273
|
+
!0,
|
|
274
|
+
j,
|
|
275
|
+
I,
|
|
276
|
+
L ? Error("react-stack-top-frame") : pe,
|
|
277
|
+
L ? N(i(t)) : ce
|
|
278
|
+
);
|
|
279
|
+
};
|
|
280
|
+
}()), $e;
|
|
281
|
+
}
|
|
282
|
+
var nt;
|
|
283
|
+
function yt() {
|
|
284
|
+
return nt || (nt = 1, process.env.NODE_ENV === "production" ? Le.exports = bt() : Le.exports = St()), Le.exports;
|
|
285
|
+
}
|
|
286
|
+
var e = yt();
|
|
287
|
+
const lt = ft(void 0);
|
|
288
|
+
function jt(r, a) {
|
|
289
|
+
let d;
|
|
290
|
+
const i = (...c) => {
|
|
291
|
+
clearTimeout(d), d = setTimeout(() => r(...c), a);
|
|
292
|
+
};
|
|
293
|
+
return i.cancel = () => clearTimeout(d), i;
|
|
294
|
+
}
|
|
295
|
+
const Gt = ({
|
|
296
|
+
children: r,
|
|
297
|
+
email: a,
|
|
298
|
+
password: d,
|
|
299
|
+
url: i,
|
|
300
|
+
dataset: c,
|
|
301
|
+
allowEmptySearch: v = !1,
|
|
302
|
+
maxResults: R = 10,
|
|
303
|
+
facetDebounceDelayMillis: x = 500,
|
|
304
|
+
// debounce faceted searches only
|
|
305
|
+
enableFacets: n = !0,
|
|
306
|
+
coverageDepth: b = 500,
|
|
307
|
+
removeDuplicates: O = !0,
|
|
308
|
+
enableCoverage: w = !0,
|
|
309
|
+
initialCoverageSetup: $ = {},
|
|
310
|
+
enableDebugLogs: S = !1
|
|
311
|
+
}) => {
|
|
312
|
+
const Z = Ne(0), p = Ne(void 0), q = Ne(!1), H = Ne(!1), [s, h] = X({
|
|
313
|
+
query: "",
|
|
314
|
+
results: null,
|
|
315
|
+
isLoading: !1,
|
|
316
|
+
resultsSuppressed: !v,
|
|
317
|
+
// Show placeholder if empty search not allowed
|
|
318
|
+
facetDebounceDelayMillis: x,
|
|
319
|
+
filters: {},
|
|
320
|
+
rangeFilters: {},
|
|
321
|
+
facetStats: {},
|
|
322
|
+
searchSettings: {
|
|
323
|
+
maxNumberOfRecordsToReturn: R,
|
|
324
|
+
coverageDepth: b,
|
|
325
|
+
enableCoverage: w,
|
|
326
|
+
removeDuplicates: O,
|
|
327
|
+
minimumScore: 0,
|
|
328
|
+
showScore: !0,
|
|
329
|
+
placeholderText: "Type to search",
|
|
330
|
+
coverageSetup: {
|
|
331
|
+
// ALL DEFAULT VALUES
|
|
332
|
+
levenshteinMaxWordSize: 20,
|
|
333
|
+
minWordSize: 2,
|
|
334
|
+
coverageMinWordHitsAbs: 1,
|
|
335
|
+
coverageMinWordHitsRelative: 0,
|
|
336
|
+
coverageQLimitForErrorTolerance: 5,
|
|
337
|
+
coverageLcsErrorToleranceRelativeq: 0.2,
|
|
338
|
+
coverWholeQuery: !0,
|
|
339
|
+
coverWholeWords: !0,
|
|
340
|
+
coverFuzzyWords: !0,
|
|
341
|
+
coverJoinedWords: !0,
|
|
342
|
+
coverPrefixSuffix: !0,
|
|
343
|
+
truncate: !0,
|
|
344
|
+
...$
|
|
345
|
+
// Allow prop-based override
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
me(() => {
|
|
350
|
+
S && console.log("SearchContext mounted on client");
|
|
351
|
+
}, [S]), me(() => {
|
|
352
|
+
h((l) => ({
|
|
353
|
+
...l,
|
|
354
|
+
facetDebounceDelayMillis: x
|
|
355
|
+
}));
|
|
356
|
+
}, [x]);
|
|
357
|
+
const [E, W] = X(null), [M] = X(n), m = te((l, g = {}) => {
|
|
358
|
+
if (!E)
|
|
359
|
+
throw new Error("No authentication token available");
|
|
360
|
+
return fetch(l, {
|
|
361
|
+
...g,
|
|
362
|
+
credentials: "include",
|
|
363
|
+
headers: {
|
|
364
|
+
...g.headers,
|
|
365
|
+
Authorization: `Bearer ${E}`
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}, [E]), [le, be] = X([]), [G, se] = X([]), [A, Se] = X([]), [N, y] = X(!0), [z, pe] = X({}), [ce, f] = X({}), [t, o] = X({}), [u, j] = X(""), [I, L] = X(""), [ue, oe] = X({}), P = Ne(null), ae = te((l) => {
|
|
369
|
+
h((g) => ({
|
|
370
|
+
...g,
|
|
371
|
+
query: l,
|
|
372
|
+
filters: {},
|
|
373
|
+
rangeFilters: {}
|
|
374
|
+
}));
|
|
375
|
+
}, []), ye = te((l) => {
|
|
376
|
+
h((g) => ({
|
|
377
|
+
...g,
|
|
378
|
+
facetDebounceDelayMillis: l
|
|
379
|
+
}));
|
|
380
|
+
}, []), T = te((l) => {
|
|
381
|
+
h((g) => ({
|
|
382
|
+
...g,
|
|
383
|
+
searchSettings: {
|
|
384
|
+
...g.searchSettings,
|
|
385
|
+
...l,
|
|
386
|
+
coverageSetup: {
|
|
387
|
+
...g.searchSettings.coverageSetup,
|
|
388
|
+
...l.coverageSetup || {}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}));
|
|
392
|
+
}, []), _ = te((l, g) => {
|
|
393
|
+
h((C) => {
|
|
394
|
+
const k = { ...C.filters }, D = k[l] || [], U = D.includes(g) ? D.filter((B) => B !== g) : [...D, g];
|
|
395
|
+
return U.length ? k[l] = U : delete k[l], {
|
|
396
|
+
...C,
|
|
397
|
+
filters: k
|
|
398
|
+
};
|
|
399
|
+
});
|
|
400
|
+
}, []), J = te((l, g, C) => {
|
|
401
|
+
h((k) => ({
|
|
402
|
+
...k,
|
|
403
|
+
rangeFilters: {
|
|
404
|
+
...k.rangeFilters,
|
|
405
|
+
[l]: { min: g, max: C }
|
|
406
|
+
}
|
|
407
|
+
}));
|
|
408
|
+
}, []), Ae = te(() => {
|
|
409
|
+
h((l) => ({
|
|
410
|
+
...l,
|
|
411
|
+
filters: {},
|
|
412
|
+
rangeFilters: {}
|
|
413
|
+
}));
|
|
414
|
+
}, []), _e = te((l, g) => {
|
|
415
|
+
h((C) => {
|
|
416
|
+
const k = { ...C.filters }, D = { ...C.rangeFilters };
|
|
417
|
+
if (g !== void 0) {
|
|
418
|
+
const B = (k[l] || []).filter((K) => K !== g);
|
|
419
|
+
B.length > 0 ? k[l] = B : delete k[l];
|
|
420
|
+
} else
|
|
421
|
+
delete D[l];
|
|
422
|
+
return {
|
|
423
|
+
...C,
|
|
424
|
+
filters: k,
|
|
425
|
+
rangeFilters: D
|
|
426
|
+
};
|
|
427
|
+
});
|
|
428
|
+
}, []), Ve = te((l, g) => {
|
|
429
|
+
h((C) => ({
|
|
430
|
+
...C,
|
|
431
|
+
sortBy: l || void 0,
|
|
432
|
+
sortAscending: l ? g : void 0
|
|
433
|
+
}));
|
|
434
|
+
}, []), We = te(async (l, g, C) => {
|
|
435
|
+
if (l.length === 0) return null;
|
|
436
|
+
if (l.length === 1) return l[0];
|
|
437
|
+
let k = l[0];
|
|
438
|
+
for (let D = 1; D < l.length; D++) {
|
|
439
|
+
const U = await m(`${g}/api/CombineFilters/${C}`, {
|
|
440
|
+
// Combine the current filter with the next filter
|
|
441
|
+
method: "PUT",
|
|
442
|
+
headers: {
|
|
443
|
+
"Content-Type": "application/json"
|
|
444
|
+
},
|
|
445
|
+
body: JSON.stringify({ A: k, B: l[D], useAndOperation: !0 })
|
|
446
|
+
});
|
|
447
|
+
if (!U.ok) {
|
|
448
|
+
const B = await U.json();
|
|
449
|
+
throw console.error("CombineFilters failed:", B), new Error("CombineFilters failed");
|
|
450
|
+
}
|
|
451
|
+
k = await U.json();
|
|
452
|
+
}
|
|
453
|
+
return k;
|
|
454
|
+
}, [m]), De = s.searchSettings.maxNumberOfRecordsToReturn, Xe = s.searchSettings.enableCoverage, Je = s.searchSettings.removeDuplicates, Qe = s.searchSettings.coverageDepth, Ye = s.searchSettings.minimumScore, qe = s.sortBy, Be = s.sortAscending, Ze = Ue(() => s.searchSettings.coverageSetup, [
|
|
455
|
+
s.searchSettings.coverageSetup.levenshteinMaxWordSize,
|
|
456
|
+
s.searchSettings.coverageSetup.minWordSize,
|
|
457
|
+
s.searchSettings.coverageSetup.coverageMinWordHitsAbs,
|
|
458
|
+
s.searchSettings.coverageSetup.coverageMinWordHitsRelative,
|
|
459
|
+
s.searchSettings.coverageSetup.coverageQLimitForErrorTolerance,
|
|
460
|
+
s.searchSettings.coverageSetup.coverageLcsErrorToleranceRelativeq,
|
|
461
|
+
s.searchSettings.coverageSetup.coverWholeQuery,
|
|
462
|
+
s.searchSettings.coverageSetup.coverWholeWords,
|
|
463
|
+
s.searchSettings.coverageSetup.coverFuzzyWords,
|
|
464
|
+
s.searchSettings.coverageSetup.coverJoinedWords,
|
|
465
|
+
s.searchSettings.coverageSetup.coverPrefixSuffix,
|
|
466
|
+
s.searchSettings.coverageSetup.truncate
|
|
467
|
+
]), Ke = te(
|
|
468
|
+
async ({ enableFacets: l }) => {
|
|
469
|
+
if (!E) return;
|
|
470
|
+
const g = ++Z.current;
|
|
471
|
+
h((C) => ({ ...C, isLoading: !0 }));
|
|
472
|
+
try {
|
|
473
|
+
const C = Object.entries(s.filters ?? {}), D = (await Promise.all(
|
|
474
|
+
C.map(
|
|
475
|
+
async ([V, Q]) => Promise.all(
|
|
476
|
+
Q.map(
|
|
477
|
+
(ee) => m(`${i}/api/CreateValueFilter/${c}`, {
|
|
478
|
+
method: "PUT",
|
|
479
|
+
headers: {
|
|
480
|
+
"Content-Type": "application/json"
|
|
481
|
+
},
|
|
482
|
+
body: JSON.stringify({ FieldName: V, Value: ee })
|
|
483
|
+
}).then((ge) => ge.json())
|
|
484
|
+
)
|
|
485
|
+
)
|
|
486
|
+
)
|
|
487
|
+
)).flat(), U = Object.entries(s.rangeFilters ?? {}), B = await Promise.all(
|
|
488
|
+
U.map(
|
|
489
|
+
([V, { min: Q, max: ee }]) => m(`${i}/api/CreateRangeFilter/${c}`, {
|
|
490
|
+
method: "PUT",
|
|
491
|
+
headers: {
|
|
492
|
+
"Content-Type": "application/json"
|
|
493
|
+
},
|
|
494
|
+
body: JSON.stringify({ FieldName: V, LowerLimit: Q, UpperLimit: ee })
|
|
495
|
+
}).then((ge) => ge.json())
|
|
496
|
+
)
|
|
497
|
+
), K = [...D, ...B].filter(
|
|
498
|
+
(V) => V && typeof V.hashString == "string"
|
|
499
|
+
), de = await We(K, i, c), je = v || s.query.trim() !== "", we = {
|
|
500
|
+
text: s.query,
|
|
501
|
+
maxNumberOfRecordsToReturn: je ? De : 0,
|
|
502
|
+
enableFacets: l,
|
|
503
|
+
...de ? { filter: de } : {},
|
|
504
|
+
...qe ? { sortBy: qe } : {},
|
|
505
|
+
...Be !== void 0 ? { sortAscending: Be } : {},
|
|
506
|
+
enableCoverage: Xe,
|
|
507
|
+
removeDuplicates: Je,
|
|
508
|
+
coverageDepth: Qe,
|
|
509
|
+
coverageSetup: Ze
|
|
510
|
+
};
|
|
511
|
+
S && console.log("[performSearch] request body:", JSON.stringify(we, null, 2));
|
|
512
|
+
const ke = await (await m(`${i}/api/Search/${c}`, {
|
|
513
|
+
method: "POST",
|
|
514
|
+
headers: {
|
|
515
|
+
"Content-Type": "application/json"
|
|
516
|
+
},
|
|
517
|
+
body: JSON.stringify(we)
|
|
518
|
+
})).json(), Ge = ke.truncationIndex ?? -1, ze = ke.records || [], he = ze.map((V) => V.documentKey), Re = ze.map((V) => V.score);
|
|
519
|
+
let Oe = [];
|
|
520
|
+
je && he.length > 0 && (Oe = (await (await m(`${i}/api/GetJson/${c}`, {
|
|
521
|
+
method: "POST",
|
|
522
|
+
headers: {
|
|
523
|
+
"Content-Type": "application/json"
|
|
524
|
+
},
|
|
525
|
+
body: JSON.stringify(he)
|
|
526
|
+
})).json()).map((ee, ge) => ({
|
|
527
|
+
document: ee,
|
|
528
|
+
documentKey: he[ge],
|
|
529
|
+
score: Re[ge]
|
|
530
|
+
})));
|
|
531
|
+
let F = {};
|
|
532
|
+
if (l && ke.facets) {
|
|
533
|
+
for (const [V, Q] of Object.entries(ke.facets))
|
|
534
|
+
if (Array.isArray(Q) && Q.length > 0) {
|
|
535
|
+
const ee = Q.map((ge) => Number(ge.key)).filter((ge) => !isNaN(ge));
|
|
536
|
+
ee.length > 0 && (F[V] = {
|
|
537
|
+
min: Math.min(...ee),
|
|
538
|
+
max: Math.max(...ee)
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
const fe = s.query !== u, Ee = s.query !== I;
|
|
543
|
+
let Ce = s.facetStats ?? {};
|
|
544
|
+
if (fe ? (Ce = { ...z, ...F }, o(Ce), j(s.query)) : Ce = { ...t, ...F }, Ee && l) {
|
|
545
|
+
const V = { ...ue };
|
|
546
|
+
for (const [Q, ee] of Object.entries(F))
|
|
547
|
+
V[Q] = ee;
|
|
548
|
+
oe(V), L(s.query);
|
|
549
|
+
}
|
|
550
|
+
let He = ke.facets;
|
|
551
|
+
if (l && (!He || Object.keys(He).length === 0)) {
|
|
552
|
+
He = {};
|
|
553
|
+
for (const [V, Q] of Object.entries(ce))
|
|
554
|
+
He[V] = Q.map((ee) => ({ key: ee, value: null }));
|
|
555
|
+
}
|
|
556
|
+
if (g !== Z.current)
|
|
557
|
+
return;
|
|
558
|
+
const ut = Oe.filter((V) => {
|
|
559
|
+
const Q = s.query.trim();
|
|
560
|
+
return Q === "" || Q.length === 1 ? !0 : V.score >= Ye;
|
|
561
|
+
});
|
|
562
|
+
h((V) => ({
|
|
563
|
+
...V,
|
|
564
|
+
results: ut,
|
|
565
|
+
resultsSuppressed: !je,
|
|
566
|
+
...l ? {
|
|
567
|
+
facets: He,
|
|
568
|
+
facetStats: Ce
|
|
569
|
+
} : {},
|
|
570
|
+
isLoading: !1,
|
|
571
|
+
truncationIndex: Ge
|
|
572
|
+
}));
|
|
573
|
+
} catch (C) {
|
|
574
|
+
if (console.error("[Search] ❌ Search failed:", C), C instanceof TypeError && C.message.includes("fetch") ? (console.error("[Search] ❌ Network error - cannot reach INDX server"), console.error("[Search] 💡 Check if server is running at:", i)) : C instanceof Error && (C.message.includes("401") ? (console.error("[Search] ❌ Authentication failed"), console.error("[Search] 💡 Your token may have expired. Get a fresh token with:"), console.error('[Search] 💡 curl -X POST "' + i + `/api/Login" -H "Content-Type: application/json" -d '{"userEmail":"your@email.com","userPassWord":"yourpassword"}'`)) : C.message.includes("404") ? (console.error("[Search] ❌ Dataset not found"), console.error('[Search] 💡 Check that dataset "' + c + '" exists')) : console.error("[Search] 💡 Error:", C.message)), g !== Z.current)
|
|
575
|
+
return;
|
|
576
|
+
h((k) => ({
|
|
577
|
+
...k,
|
|
578
|
+
results: null,
|
|
579
|
+
isLoading: !1,
|
|
580
|
+
resultsSuppressed: !1,
|
|
581
|
+
error: C instanceof Error ? C.message : "Search failed"
|
|
582
|
+
}));
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
[
|
|
586
|
+
s.query,
|
|
587
|
+
s.filters,
|
|
588
|
+
s.rangeFilters,
|
|
589
|
+
qe,
|
|
590
|
+
Be,
|
|
591
|
+
De,
|
|
592
|
+
Xe,
|
|
593
|
+
Je,
|
|
594
|
+
Qe,
|
|
595
|
+
Ze,
|
|
596
|
+
Ye,
|
|
597
|
+
m,
|
|
598
|
+
We,
|
|
599
|
+
i,
|
|
600
|
+
c,
|
|
601
|
+
v,
|
|
602
|
+
E
|
|
603
|
+
]
|
|
604
|
+
);
|
|
605
|
+
me(() => {
|
|
606
|
+
p.current = Ke;
|
|
607
|
+
}, [Ke]), te(() => {
|
|
608
|
+
var l;
|
|
609
|
+
S && console.log("Search fired"), (l = p.current) == null || l.call(p, { enableFacets: !1 });
|
|
610
|
+
}, []);
|
|
611
|
+
const ie = Ne(null);
|
|
612
|
+
return me(() => {
|
|
613
|
+
var l;
|
|
614
|
+
return (l = ie.current) == null || l.cancel(), ie.current = jt(() => {
|
|
615
|
+
var g;
|
|
616
|
+
S && console.log("Debounced searchWithFacets fired"), (g = p.current) == null || g.call(p, { enableFacets: !0 });
|
|
617
|
+
}, s.facetDebounceDelayMillis ?? 500), () => {
|
|
618
|
+
var g;
|
|
619
|
+
(g = ie.current) == null || g.cancel();
|
|
620
|
+
};
|
|
621
|
+
}, [s.facetDebounceDelayMillis]), te(() => {
|
|
622
|
+
var l;
|
|
623
|
+
(l = ie.current) == null || l.call(ie);
|
|
624
|
+
}, []), me(() => {
|
|
625
|
+
var l;
|
|
626
|
+
!N && E && !q.current && (v && ((l = p.current) == null || l.call(p, { enableFacets: M })), q.current = !0);
|
|
627
|
+
}, [N, E, v, M]), me(() => {
|
|
628
|
+
var k, D, U, B, K;
|
|
629
|
+
if (!E || !q.current) return;
|
|
630
|
+
const l = s.query.trim(), g = l === "" && v;
|
|
631
|
+
if (l === "" && !v) {
|
|
632
|
+
s.resultsSuppressed || h((de) => ({
|
|
633
|
+
...de,
|
|
634
|
+
resultsSuppressed: !0
|
|
635
|
+
}));
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
return g ? ((k = ie.current) == null || k.cancel(), (D = p.current) == null || D.call(p, { enableFacets: M })) : M ? (S && console.log("Search fired"), (U = p.current) == null || U.call(p, { enableFacets: !1 }), (B = ie.current) == null || B.call(ie)) : (K = p.current) == null || K.call(p, { enableFacets: !1 }), () => {
|
|
639
|
+
var de;
|
|
640
|
+
(de = ie.current) == null || de.cancel();
|
|
641
|
+
};
|
|
642
|
+
}, [s.query, v, M]), me(() => {
|
|
643
|
+
var C;
|
|
644
|
+
if (!q.current || !E) return;
|
|
645
|
+
if (!H.current) {
|
|
646
|
+
H.current = !0, S && console.log("[Filter effect] First run, skipping");
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
if (s.query !== u) {
|
|
650
|
+
S && console.log("[Filter effect] Skipping because query changed");
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
const l = s.query.trim();
|
|
654
|
+
M && !(!v && l === "") && (S && console.log("[Filter effect] Firing search"), (C = p.current) == null || C.call(p, { enableFacets: !0 }));
|
|
655
|
+
}, [s.filters, s.rangeFilters]), me(() => {
|
|
656
|
+
var C;
|
|
657
|
+
if (!q.current || !E) return;
|
|
658
|
+
const l = s.query.trim();
|
|
659
|
+
M && !(!v && l === "") && ((C = p.current) == null || C.call(p, { enableFacets: !0 }));
|
|
660
|
+
}, [qe, Be]), me(() => {
|
|
661
|
+
(async () => {
|
|
662
|
+
try {
|
|
663
|
+
if (!a)
|
|
664
|
+
throw console.error("[Auth] ❌ Missing email"), console.error('[Auth] 💡 Pass email="your@email.com" to SearchProvider'), new Error("Email is required. Check console for instructions.");
|
|
665
|
+
if (!d)
|
|
666
|
+
throw console.error("[Auth] ❌ Missing password"), console.error('[Auth] 💡 Pass password="yourpassword" to SearchProvider'), new Error("Password is required. Check console for instructions.");
|
|
667
|
+
if (!i)
|
|
668
|
+
throw console.error("[Auth] ❌ Missing INDX server URL"), console.error("[Auth] 💡 Add NEXT_PUBLIC_INDX_URL to your .env.local file"), new Error("INDX server URL is required. Check console for instructions.");
|
|
669
|
+
if (!c)
|
|
670
|
+
throw console.error("[Auth] ❌ Missing dataset name"), console.error('[Auth] 💡 Pass dataset="your-dataset-name" to SearchProvider'), new Error("Dataset name is required. Check console for instructions.");
|
|
671
|
+
S && console.log("[Auth] 🔐 Logging in to get session token...");
|
|
672
|
+
const g = await fetch(`${i}/api/Login`, {
|
|
673
|
+
method: "POST",
|
|
674
|
+
headers: {
|
|
675
|
+
"Content-Type": "application/json",
|
|
676
|
+
accept: "*/*"
|
|
677
|
+
},
|
|
678
|
+
credentials: "include",
|
|
679
|
+
body: JSON.stringify({
|
|
680
|
+
userEmail: a,
|
|
681
|
+
userPassWord: d
|
|
682
|
+
})
|
|
683
|
+
});
|
|
684
|
+
if (!g.ok)
|
|
685
|
+
throw console.error("[Auth] ❌ Login failed:", g.status, await g.text()), new Error("Login failed. Check your email and password.");
|
|
686
|
+
const k = (await g.json()).token;
|
|
687
|
+
if (!k)
|
|
688
|
+
throw console.error("[Auth] ❌ No token received from login response"), new Error("No token received from login.");
|
|
689
|
+
S && console.log("[Auth] ✅ Login successful, token received (length:", k.length, ")"), W(k), S && console.log("[Auth] 🔓 Opening dataset session...");
|
|
690
|
+
const D = await fetch(`${i}/api/CreateOrOpen/${c}/400`, {
|
|
691
|
+
method: "PUT",
|
|
692
|
+
headers: {
|
|
693
|
+
"Content-Type": "application/json",
|
|
694
|
+
Authorization: `Bearer ${k}`
|
|
695
|
+
},
|
|
696
|
+
credentials: "include",
|
|
697
|
+
body: '""'
|
|
698
|
+
});
|
|
699
|
+
if (!D.ok)
|
|
700
|
+
throw console.error("[Auth] ❌ CreateOrOpen failed:", D.status, await D.text()), new Error("Failed to open dataset session.");
|
|
701
|
+
S && console.log("[Auth] ✅ Dataset session established");
|
|
702
|
+
const U = (F) => fetch(F, {
|
|
703
|
+
method: "GET",
|
|
704
|
+
headers: {
|
|
705
|
+
accept: "text/plain",
|
|
706
|
+
Authorization: `Bearer ${k}`
|
|
707
|
+
},
|
|
708
|
+
credentials: "include"
|
|
709
|
+
});
|
|
710
|
+
S && console.log("[Auth] 🔍 Checking dataset status...");
|
|
711
|
+
const B = await U(`${i}/api/GetStatus/${c}`);
|
|
712
|
+
if (!B.ok) {
|
|
713
|
+
if (B.status === 401)
|
|
714
|
+
throw console.error("[Auth] ❌ Authentication failed (401 Unauthorized)"), console.error("[Auth] 💡 Your token may be expired or invalid"), console.error('[Auth] 💡 Get a fresh token with: curl -X POST "' + i + `/api/Login" -H "Content-Type: application/json" -d '{"userEmail":"your@email.com","userPassWord":"yourpassword"}'`), new Error("Authentication failed (401). Token may be expired. Check console for instructions.");
|
|
715
|
+
if (B.status === 404)
|
|
716
|
+
throw console.error('[Auth] ❌ Dataset "' + c + '" not found (404)'), console.error('[Auth] 💡 Available datasets can be checked with: curl -X GET "' + i + '/api/GetUserDataSets" -H "Authorization: Bearer YOUR_TOKEN"'), console.error("[Auth] 💡 Make sure you spelled the dataset name correctly"), new Error('Dataset "' + c + '" not found. Check console for instructions.');
|
|
717
|
+
{
|
|
718
|
+
const F = await B.text();
|
|
719
|
+
throw console.error("[Auth] ❌ Failed to get dataset status:", B.status, F), console.error("[Auth] 💡 Check if your INDX server is running at:", i), new Error("Failed to connect to INDX server. Check console for details.");
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
const K = await B.json();
|
|
723
|
+
S && console.log("[Auth] 📊 Dataset status:", K), K.state && K.state !== "Ready" && (console.warn("[Auth] ⚠️ Dataset is not ready yet. Current state:", K.state), console.warn("[Auth] 💡 Wait for indexing to complete before searching"));
|
|
724
|
+
const de = K.documentCount ?? K.numberOfRecords ?? 0;
|
|
725
|
+
de === 0 ? (console.warn('[Auth] ⚠️ Dataset "' + c + '" is empty (0 records)'), console.warn("[Auth] 💡 Add documents to your dataset before searching"), console.warn("[Auth] 💡 Search will work but return no results")) : S && console.log("[Auth] ✅ Dataset has", de, "records");
|
|
726
|
+
const [je, we, Pe] = await Promise.all([
|
|
727
|
+
U(`${i}/api/GetFilterableFields/${c}`),
|
|
728
|
+
U(`${i}/api/GetFacetableFields/${c}`),
|
|
729
|
+
U(`${i}/api/GetSortableFields/${c}`)
|
|
730
|
+
]);
|
|
731
|
+
if (!je.ok)
|
|
732
|
+
throw console.error("[Auth] ❌ GetFilterableFields failed:", je.status, await je.text()), new Error("Failed to get filterable fields. Check console for details.");
|
|
733
|
+
if (!we.ok)
|
|
734
|
+
throw console.error("[Auth] ❌ GetFacetableFields failed:", we.status, await we.text()), new Error("Failed to get facetable fields. Check console for details.");
|
|
735
|
+
if (!Pe.ok)
|
|
736
|
+
throw console.error("[Auth] ❌ GetSortableFields failed:", Pe.status, await Pe.text()), new Error("Failed to get sortable fields. Check console for details.");
|
|
737
|
+
const ke = await je.json().catch((F) => (console.error("Failed to parse GetFilterableFields response:", F), [])), Ge = await we.json().catch((F) => (console.error("Failed to parse GetFacetableFields response:", F), [])), ze = await Pe.json().catch((F) => (console.error("Failed to parse GetSortableFields response:", F), []));
|
|
738
|
+
be(ke || []), se(Ge || []), Se(ze || []);
|
|
739
|
+
let he = { facets: {} };
|
|
740
|
+
try {
|
|
741
|
+
const F = await fetch(`${i}/api/Search/${c}`, {
|
|
742
|
+
method: "POST",
|
|
743
|
+
headers: {
|
|
744
|
+
"Content-Type": "application/json",
|
|
745
|
+
Authorization: `Bearer ${k}`
|
|
746
|
+
},
|
|
747
|
+
credentials: "include",
|
|
748
|
+
body: JSON.stringify({ text: "", maxNumberOfRecordsToReturn: 0, enableFacets: !0 })
|
|
749
|
+
});
|
|
750
|
+
F.ok ? he = await F.json().catch((fe) => (console.warn("Failed to parse blank search response:", fe), { facets: {} })) : (console.warn("Blank search failed:", F.status, F.statusText), console.warn("Continuing without initial facet data - facets will be populated after first search"));
|
|
751
|
+
} catch (F) {
|
|
752
|
+
console.warn("Blank search error:", F), console.warn("Continuing without initial facet data - facets will be populated after first search");
|
|
753
|
+
}
|
|
754
|
+
const Re = {};
|
|
755
|
+
if (he.facets) {
|
|
756
|
+
for (const [F, fe] of Object.entries(he.facets))
|
|
757
|
+
if (Array.isArray(fe) && fe.length > 0) {
|
|
758
|
+
const Ee = fe.map((Ce) => Number(Ce.key)).filter((Ce) => !isNaN(Ce));
|
|
759
|
+
Ee.length > 0 && (Re[F] = {
|
|
760
|
+
min: Math.min(...Ee),
|
|
761
|
+
max: Math.max(...Ee)
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
const Oe = {};
|
|
766
|
+
if (he.facets)
|
|
767
|
+
for (const [F, fe] of Object.entries(he.facets))
|
|
768
|
+
Array.isArray(fe) && (Oe[F] = fe.map((Ee) => Ee.key));
|
|
769
|
+
P.current = {
|
|
770
|
+
facets: he.facets,
|
|
771
|
+
facetStats: Re,
|
|
772
|
+
facetKeys: Oe
|
|
773
|
+
}, pe(Re), f(Oe), oe(Re), h((F) => ({
|
|
774
|
+
...F,
|
|
775
|
+
facetStats: Re
|
|
776
|
+
})), S && console.log("[Auth] ✅ Initialization complete");
|
|
777
|
+
} catch (g) {
|
|
778
|
+
throw console.error("[Auth] ❌ Initialization failed:", g), (g instanceof Error || typeof g == "object" && g !== null && "message" in g) && console.error("[Auth] 💡 Error:", g.message), g instanceof TypeError && g.message.includes("fetch") && (console.error("[Auth] ❌ Network error - cannot connect to INDX server"), console.error("[Auth] 💡 Check if the server is running at:", i), console.error("[Auth] 💡 Check your NEXT_PUBLIC_INDX_URL in .env.local"), console.error("[Auth] 💡 For local development, it should be: http://localhost:38171")), g;
|
|
779
|
+
} finally {
|
|
780
|
+
y(!1);
|
|
781
|
+
}
|
|
782
|
+
})();
|
|
783
|
+
}, [a, d, i, c]), /* @__PURE__ */ e.jsx(
|
|
784
|
+
lt.Provider,
|
|
785
|
+
{
|
|
786
|
+
value: {
|
|
787
|
+
state: {
|
|
788
|
+
...s,
|
|
789
|
+
filterableFields: le,
|
|
790
|
+
facetableFields: G,
|
|
791
|
+
sortableFields: A,
|
|
792
|
+
rangeBounds: ue
|
|
793
|
+
},
|
|
794
|
+
isFetchingInitial: N,
|
|
795
|
+
allowEmptySearch: v,
|
|
796
|
+
setQuery: ae,
|
|
797
|
+
toggleFilter: _,
|
|
798
|
+
setRangeFilter: J,
|
|
799
|
+
resetFilters: Ae,
|
|
800
|
+
resetSingleFilter: _e,
|
|
801
|
+
setSort: Ve,
|
|
802
|
+
setDebounceDelay: ye,
|
|
803
|
+
setSearchSettings: T
|
|
804
|
+
},
|
|
805
|
+
children: r
|
|
806
|
+
}
|
|
807
|
+
);
|
|
808
|
+
}, Te = () => {
|
|
809
|
+
const r = gt(lt);
|
|
810
|
+
if (!r)
|
|
811
|
+
throw new Error("useSearchContext must be used within a SearchProvider");
|
|
812
|
+
return r;
|
|
813
|
+
}, Xt = ({
|
|
814
|
+
className: r = "",
|
|
815
|
+
autoFocus: a = !1,
|
|
816
|
+
inputSize: d = "default",
|
|
817
|
+
showClear: i = !0,
|
|
818
|
+
showFocus: c = !1,
|
|
819
|
+
...v
|
|
820
|
+
}) => {
|
|
821
|
+
const { state: { query: R, filters: x, rangeFilters: n, searchSettings: b }, setQuery: O } = Te();
|
|
822
|
+
Object.keys(x).length > 0 || Object.keys(n).length > 0;
|
|
823
|
+
const w = R.length > 0;
|
|
824
|
+
return /* @__PURE__ */ e.jsx(
|
|
825
|
+
pt,
|
|
826
|
+
{
|
|
827
|
+
type: "text",
|
|
828
|
+
value: R,
|
|
829
|
+
onChange: ($) => O($.target.value),
|
|
830
|
+
placeholder: b.placeholderText,
|
|
831
|
+
autoFocus: a,
|
|
832
|
+
className: r,
|
|
833
|
+
showSearchIcon: !0,
|
|
834
|
+
inputSize: d,
|
|
835
|
+
showFocusBorder: c,
|
|
836
|
+
...v,
|
|
837
|
+
children: i && w && /* @__PURE__ */ e.jsx(
|
|
838
|
+
xe,
|
|
839
|
+
{
|
|
840
|
+
variant: "ghost",
|
|
841
|
+
size: "micro",
|
|
842
|
+
onClick: () => O(""),
|
|
843
|
+
"aria-label": "Clear search",
|
|
844
|
+
children: "Clear"
|
|
845
|
+
}
|
|
846
|
+
)
|
|
847
|
+
}
|
|
848
|
+
);
|
|
849
|
+
}, Ct = "_placeholder_bcpqa_1", wt = "_invalid_bcpqa_10", kt = "_row_bcpqa_14", Rt = "_indexNumber_bcpqa_42", Et = "_scoreNumber_bcpqa_49", Fe = {
|
|
850
|
+
placeholder: Ct,
|
|
851
|
+
invalid: wt,
|
|
852
|
+
row: kt,
|
|
853
|
+
indexNumber: Rt,
|
|
854
|
+
scoreNumber: Et
|
|
855
|
+
}, Ft = ({ color: r = "black", size: a = 21 }) => {
|
|
856
|
+
const d = 0.7142857142857143, i = a, c = typeof a == "number" ? a * d : `calc(${a} * 0.7142857142857143)`;
|
|
857
|
+
return e.jsx("svg", { width: i, height: c, viewBox: "0 0 7 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: e.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4 0H3V1V2V3H2V2H1V3H2V4H3V5H4V4H5V3H6V2H5V3H4V2V1V0ZM4 3V4H3V3H4Z", fill: r }) });
|
|
858
|
+
}, Mt = ({ color: r = "black", size: a = 21 }) => {
|
|
859
|
+
const d = 0.7142857142857143, i = a, c = typeof a == "number" ? a * d : `calc(${a} * 0.7142857142857143)`;
|
|
860
|
+
return e.jsx("svg", { width: i, height: c, viewBox: "0 0 7 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: e.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5 0H4V1H5V2H4H3H2H1V3H2H3H4H5V4H4V5H5V4H6V3H7V2H6V1H5V0ZM6 2H5V3H6V2Z", fill: r }) });
|
|
861
|
+
}, Nt = ({ color: r = "black", size: a = 21 }) => {
|
|
862
|
+
const d = 0.7142857142857143, i = a, c = typeof a == "number" ? a * d : `calc(${a} * 0.7142857142857143)`;
|
|
863
|
+
return e.jsx("svg", { width: i, height: c, viewBox: "0 0 7 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: e.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5 0H6V1H5V0ZM6 1H7V2H6V1ZM0 1H1V2H0V1ZM1 1V0H2V1H1ZM6 3H7V4H6V3ZM6 4V5H5V4H6ZM1 4H2V5H1V4ZM1 4H0V3H1V4ZM2 2H5V3H2V2Z", fill: r }) });
|
|
864
|
+
}, ct = ({ color: r = "black", size: a = 21 }) => {
|
|
865
|
+
const d = 0.7142857142857143, i = a, c = typeof a == "number" ? a * d : `calc(${a} * 0.7142857142857143)`;
|
|
866
|
+
return e.jsx("svg", { width: i, height: c, viewBox: "0 0 7 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: e.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1 0H2V1H1V0ZM3 2H2V1H3V2ZM4 2H3V3H2V4H1V5H2V4H3V3H4V4H5V5H6V4H5V3H4V2ZM5 1V2H4V1H5ZM5 1V0H6V1H5Z", fill: r }) });
|
|
867
|
+
}, Jt = ({ fields: r, resultsPerPage: a, children: d }) => {
|
|
868
|
+
const {
|
|
869
|
+
state: { results: i, resultsSuppressed: c, searchSettings: v, truncationIndex: R },
|
|
870
|
+
isFetchingInitial: x
|
|
871
|
+
} = Te(), n = a ?? 30, [b, O] = X(n);
|
|
872
|
+
me(() => {
|
|
873
|
+
O(n);
|
|
874
|
+
}, [i]);
|
|
875
|
+
const w = i && i.length > b, $ = () => {
|
|
876
|
+
O((S) => S + n);
|
|
877
|
+
};
|
|
878
|
+
return x || c ? /* @__PURE__ */ e.jsx("div", { className: Fe.placeholder, children: /* @__PURE__ */ e.jsx(Nt, { size: 350, color: "var(--lv5)" }) }) : !i || i.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: Fe.invalid, children: /* @__PURE__ */ e.jsx("p", { children: "No results found." }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
879
|
+
/* @__PURE__ */ e.jsx("div", { className: Fe.container, children: (i ?? []).slice(0, b).map((S, Z) => {
|
|
880
|
+
const p = S.document, q = S.score;
|
|
881
|
+
let H;
|
|
882
|
+
try {
|
|
883
|
+
H = typeof p == "string" ? JSON.parse(p) : p;
|
|
884
|
+
} catch {
|
|
885
|
+
return /* @__PURE__ */ e.jsx("div", { className: Fe.invalid, children: /* @__PURE__ */ e.jsx("p", { children: "Invalid JSON" }) }, Z);
|
|
886
|
+
}
|
|
887
|
+
let s;
|
|
888
|
+
if (r && r.length > 0) {
|
|
889
|
+
s = {};
|
|
890
|
+
for (const h of r)
|
|
891
|
+
h in H && (s[h] = H[h]);
|
|
892
|
+
} else
|
|
893
|
+
s = { ...H };
|
|
894
|
+
for (const h in s) {
|
|
895
|
+
const E = s[h];
|
|
896
|
+
if (typeof E == "string" && E.startsWith("[") && E.endsWith("]")) {
|
|
897
|
+
const M = E.replace(/^\[|\]$/g, "").split(",").map((m) => m.trim().replace(/^'|'$/g, "")).filter((m) => m.length > 0);
|
|
898
|
+
s[h] = M;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
return /* @__PURE__ */ e.jsxs("div", { className: Fe.row, children: [
|
|
902
|
+
/* @__PURE__ */ e.jsx("div", { className: Fe.indexNumber, children: Z }),
|
|
903
|
+
d(s),
|
|
904
|
+
v.showScore && /* @__PURE__ */ e.jsx("div", { className: Fe.scoreNumber, children: q })
|
|
905
|
+
] }, Z);
|
|
906
|
+
}) }),
|
|
907
|
+
w && /* @__PURE__ */ e.jsx("div", { style: { textAlign: "center", marginTop: "20px" }, children: /* @__PURE__ */ e.jsxs(
|
|
908
|
+
xe,
|
|
909
|
+
{
|
|
910
|
+
variant: "secondary",
|
|
911
|
+
size: "micro",
|
|
912
|
+
onClick: $,
|
|
913
|
+
children: [
|
|
914
|
+
"Load more ",
|
|
915
|
+
R
|
|
916
|
+
]
|
|
917
|
+
}
|
|
918
|
+
) })
|
|
919
|
+
] });
|
|
920
|
+
}, Tt = "_list_mwzqq_2", At = "_count_mwzqq_7", _t = "_grid_mwzqq_16", Me = {
|
|
921
|
+
list: Tt,
|
|
922
|
+
count: At,
|
|
923
|
+
grid: _t
|
|
924
|
+
}, Qt = ({
|
|
925
|
+
field: r,
|
|
926
|
+
label: a,
|
|
927
|
+
preserveBlankFacetState: d = !1,
|
|
928
|
+
preserveBlankFacetStateOrder: i = !1,
|
|
929
|
+
sortFacetsBy: c = "histogram",
|
|
930
|
+
limit: v = 10,
|
|
931
|
+
collapsible: R = !0,
|
|
932
|
+
startCollapsed: x = !1,
|
|
933
|
+
displayType: n = "checkbox",
|
|
934
|
+
layout: b = "list",
|
|
935
|
+
showActivePanel: O = !1,
|
|
936
|
+
showCount: w = !0,
|
|
937
|
+
showNull: $ = !1,
|
|
938
|
+
displayIfEmptyQuery: S = !0,
|
|
939
|
+
displayCondition: Z = (p) => !0
|
|
940
|
+
}) => {
|
|
941
|
+
const {
|
|
942
|
+
state: { facets: p, filterableFields: q, facetableFields: H, filters: s, query: h },
|
|
943
|
+
toggleFilter: E,
|
|
944
|
+
isFetchingInitial: W,
|
|
945
|
+
allowEmptySearch: M
|
|
946
|
+
} = Te(), m = Ne(null), [le, be] = X(!1);
|
|
947
|
+
if (!M && !h || W || !p || !Z({ query: h ?? "", filters: s, facets: p }) || !S && !h && Object.keys(s).length < 1)
|
|
948
|
+
return null;
|
|
949
|
+
if (!(q != null && q.includes(r)) || !(H != null && H.includes(r))) {
|
|
950
|
+
const f = [];
|
|
951
|
+
return q != null && q.includes(r) || f.push("filterable"), H != null && H.includes(r) || f.push("facetable"), /* @__PURE__ */ e.jsx(ve, { collapsible: !1, children: /* @__PURE__ */ e.jsxs("div", { style: { color: "red", fontSize: "12px" }, children: [
|
|
952
|
+
'Cannot render filter for "',
|
|
953
|
+
r,
|
|
954
|
+
'": missing ',
|
|
955
|
+
f.join(" and "),
|
|
956
|
+
"."
|
|
957
|
+
] }) });
|
|
958
|
+
}
|
|
959
|
+
const G = p == null ? void 0 : p[r];
|
|
960
|
+
if (!G || !Array.isArray(G)) return null;
|
|
961
|
+
const se = (s == null ? void 0 : s[r]) ?? [];
|
|
962
|
+
d && !m.current && G.length > 0 && (m.current = G.reduce(
|
|
963
|
+
(f, t) => (f[t.key] = t.value, f),
|
|
964
|
+
{}
|
|
965
|
+
));
|
|
966
|
+
const A = /* @__PURE__ */ new Map();
|
|
967
|
+
d && m.current ? (Object.keys(m.current).forEach((f) => {
|
|
968
|
+
A.set(f, 0);
|
|
969
|
+
}), G.forEach((f) => {
|
|
970
|
+
A.set(f.key, f.value);
|
|
971
|
+
})) : G.forEach((f) => {
|
|
972
|
+
A.set(f.key, f.value);
|
|
973
|
+
});
|
|
974
|
+
const Se = n === "toggle" && A.size === 2 && A.has("true") && (A.has("false") || A.has("null"));
|
|
975
|
+
if (A.has("null")) {
|
|
976
|
+
const f = A.get("null") ?? 0, t = A.get("false") ?? 0;
|
|
977
|
+
A.set("false", (t ?? 0) + f), A.delete("null");
|
|
978
|
+
}
|
|
979
|
+
if (n === "toggle" && !Se)
|
|
980
|
+
return /* @__PURE__ */ e.jsx(ve, { collapsible: !1, children: /* @__PURE__ */ e.jsx("div", { className: Me.count, children: /* @__PURE__ */ e.jsx(
|
|
981
|
+
ne,
|
|
982
|
+
{
|
|
983
|
+
label: a,
|
|
984
|
+
checked: !1,
|
|
985
|
+
onChange: () => {
|
|
986
|
+
},
|
|
987
|
+
disabled: !0
|
|
988
|
+
}
|
|
989
|
+
) }) });
|
|
990
|
+
if (Se) {
|
|
991
|
+
const f = A.get("true"), t = typeof f == "number" ? f : null, o = se.includes("true"), u = t === 0, j = w && (t ?? 0) > 0 ? `${t}` : "";
|
|
992
|
+
return /* @__PURE__ */ e.jsx(ve, { collapsible: !1, children: /* @__PURE__ */ e.jsxs("div", { className: Me.count, children: [
|
|
993
|
+
/* @__PURE__ */ e.jsx(
|
|
994
|
+
ne,
|
|
995
|
+
{
|
|
996
|
+
label: a,
|
|
997
|
+
checked: o,
|
|
998
|
+
onChange: () => E(r, "true"),
|
|
999
|
+
disabled: u
|
|
1000
|
+
}
|
|
1001
|
+
),
|
|
1002
|
+
" ",
|
|
1003
|
+
j
|
|
1004
|
+
] }) });
|
|
1005
|
+
}
|
|
1006
|
+
let N = Array.from(A.entries());
|
|
1007
|
+
if ($ || (N = N.filter(([f]) => f !== "null")), N.length === 0 && !d)
|
|
1008
|
+
return null;
|
|
1009
|
+
if (!i) if (c === "alphabetical") {
|
|
1010
|
+
const f = N.filter(([, o]) => typeof o == "number" && o > 0).sort(([o], [u]) => o.localeCompare(u)), t = N.filter(([, o]) => o === 0 || o === null).sort(([o], [u]) => o.localeCompare(u));
|
|
1011
|
+
N = [...f, ...t];
|
|
1012
|
+
} else if (c === "numeric") {
|
|
1013
|
+
const f = (u, j) => {
|
|
1014
|
+
const I = Number(u), L = Number(j), ue = !isNaN(I), oe = !isNaN(L);
|
|
1015
|
+
return ue && oe ? I - L : u.localeCompare(j);
|
|
1016
|
+
}, t = N.filter(([, u]) => typeof u == "number" && u > 0).sort(([u], [j]) => f(u, j)), o = N.filter(([, u]) => u === 0 || u === null).sort(([u], [j]) => f(u, j));
|
|
1017
|
+
N = [...t, ...o];
|
|
1018
|
+
} else {
|
|
1019
|
+
const f = N.filter(([, o]) => typeof o == "number" && o > 0), t = N.filter(([, o]) => o === 0 || o === null);
|
|
1020
|
+
N = [...f, ...t];
|
|
1021
|
+
}
|
|
1022
|
+
const y = typeof v == "number" && N.length > v, z = y && !le ? N.slice(0, v) : N, pe = (f, t) => {
|
|
1023
|
+
const o = se.includes(f), u = t === 0, j = w && (t ?? 0) > 0 ? ` (${t})` : "", I = w && (t ?? 0) > 0 ? t : "";
|
|
1024
|
+
switch (n) {
|
|
1025
|
+
case "button":
|
|
1026
|
+
return b === "list" ? /* @__PURE__ */ e.jsxs("div", { className: Me.count, children: [
|
|
1027
|
+
/* @__PURE__ */ e.jsx(
|
|
1028
|
+
xe,
|
|
1029
|
+
{
|
|
1030
|
+
variant: o ? "primary" : "secondary",
|
|
1031
|
+
onClick: () => E(r, f),
|
|
1032
|
+
disabled: u,
|
|
1033
|
+
size: "micro",
|
|
1034
|
+
children: f
|
|
1035
|
+
}
|
|
1036
|
+
),
|
|
1037
|
+
/* @__PURE__ */ e.jsx("span", { children: I })
|
|
1038
|
+
] }) : /* @__PURE__ */ e.jsx(
|
|
1039
|
+
xe,
|
|
1040
|
+
{
|
|
1041
|
+
variant: o ? "primary" : "secondary",
|
|
1042
|
+
onClick: () => E(r, f),
|
|
1043
|
+
disabled: u,
|
|
1044
|
+
size: "micro",
|
|
1045
|
+
children: `${f}${j}`
|
|
1046
|
+
}
|
|
1047
|
+
);
|
|
1048
|
+
case "toggle":
|
|
1049
|
+
return /* @__PURE__ */ e.jsx(
|
|
1050
|
+
ne,
|
|
1051
|
+
{
|
|
1052
|
+
label: f,
|
|
1053
|
+
checked: o,
|
|
1054
|
+
onChange: () => E(r, f),
|
|
1055
|
+
disabled: u
|
|
1056
|
+
}
|
|
1057
|
+
);
|
|
1058
|
+
case "checkbox":
|
|
1059
|
+
default:
|
|
1060
|
+
return b === "list" ? /* @__PURE__ */ e.jsxs("div", { className: Me.count, children: [
|
|
1061
|
+
/* @__PURE__ */ e.jsx(
|
|
1062
|
+
tt,
|
|
1063
|
+
{
|
|
1064
|
+
label: f,
|
|
1065
|
+
score: "",
|
|
1066
|
+
checked: o,
|
|
1067
|
+
onChange: () => E(r, f),
|
|
1068
|
+
disabled: u
|
|
1069
|
+
}
|
|
1070
|
+
),
|
|
1071
|
+
/* @__PURE__ */ e.jsx("span", { children: I })
|
|
1072
|
+
] }) : /* @__PURE__ */ e.jsx(
|
|
1073
|
+
tt,
|
|
1074
|
+
{
|
|
1075
|
+
label: f,
|
|
1076
|
+
score: j,
|
|
1077
|
+
checked: o,
|
|
1078
|
+
onChange: () => E(r, f),
|
|
1079
|
+
disabled: u
|
|
1080
|
+
}
|
|
1081
|
+
);
|
|
1082
|
+
}
|
|
1083
|
+
}, ce = R ? x : !1;
|
|
1084
|
+
return /* @__PURE__ */ e.jsx(
|
|
1085
|
+
ve,
|
|
1086
|
+
{
|
|
1087
|
+
title: a,
|
|
1088
|
+
collapsible: R,
|
|
1089
|
+
collapsed: ce,
|
|
1090
|
+
children: /* @__PURE__ */ e.jsxs(
|
|
1091
|
+
"ul",
|
|
1092
|
+
{
|
|
1093
|
+
className: b === "grid" ? Me.grid : Me.list,
|
|
1094
|
+
style: { listStyle: "none", padding: 0, margin: 0 },
|
|
1095
|
+
children: [
|
|
1096
|
+
z.map(([f, t]) => /* @__PURE__ */ e.jsx("li", { children: pe(f, t) }, f)),
|
|
1097
|
+
y && /* @__PURE__ */ e.jsx("li", { className: Me.toggleItem, children: /* @__PURE__ */ e.jsx(
|
|
1098
|
+
xe,
|
|
1099
|
+
{
|
|
1100
|
+
variant: "ghost",
|
|
1101
|
+
size: "micro",
|
|
1102
|
+
onClick: () => be((f) => !f),
|
|
1103
|
+
children: le ? "Show less" : `Show ${N.length - (v ?? 0)} more`
|
|
1104
|
+
}
|
|
1105
|
+
) })
|
|
1106
|
+
]
|
|
1107
|
+
}
|
|
1108
|
+
)
|
|
1109
|
+
}
|
|
1110
|
+
);
|
|
1111
|
+
}, Vt = "_disabledMessage_o89gh_1", ot = {
|
|
1112
|
+
disabledMessage: Vt
|
|
1113
|
+
}, Yt = ({
|
|
1114
|
+
field: r,
|
|
1115
|
+
label: a,
|
|
1116
|
+
expectedMin: d = 0,
|
|
1117
|
+
expectedMax: i = 1e3,
|
|
1118
|
+
displayType: c = "input",
|
|
1119
|
+
collapsible: v = !0,
|
|
1120
|
+
startCollapsed: R = !1
|
|
1121
|
+
}) => {
|
|
1122
|
+
const {
|
|
1123
|
+
state: { rangeFilters: x, rangeBounds: n, facetStats: b, query: O, facetDebounceDelayMillis: w },
|
|
1124
|
+
setRangeFilter: $,
|
|
1125
|
+
resetSingleFilter: S,
|
|
1126
|
+
allowEmptySearch: Z,
|
|
1127
|
+
isFetchingInitial: p
|
|
1128
|
+
} = Te(), q = (n == null ? void 0 : n[r]) !== void 0, H = (n == null ? void 0 : n[r]) ?? { min: d, max: i }, s = H.min, h = H.max, E = (b == null ? void 0 : b[r]) ?? H, W = E.min, M = E.max, m = q && s === h, le = m ? d : s, be = m ? i : h, G = x == null ? void 0 : x[r], se = G ? G.min : s, A = G ? G.max : h, Se = G !== void 0, N = W !== s || M !== h, [y, z] = re.useState([
|
|
1129
|
+
se,
|
|
1130
|
+
A
|
|
1131
|
+
]), [pe, ce] = re.useState(!1), [f, t] = re.useState(!1), { finalMin: o, finalMax: u, isValidMin: j, isValidMax: I } = re.useMemo(() => {
|
|
1132
|
+
const [T, _] = y, J = Math.max(s, Math.min(h, T)), Ae = Math.max(s, Math.min(h, _)), _e = Math.min(J, Ae), Ve = Math.max(J, Ae), We = _e >= s && _e < Ve, De = Ve <= h && Ve > _e;
|
|
1133
|
+
return { finalMin: _e, finalMax: Ve, isValidMin: We, isValidMax: De };
|
|
1134
|
+
}, [y, s, h]);
|
|
1135
|
+
re.useEffect(() => {
|
|
1136
|
+
if (m)
|
|
1137
|
+
return;
|
|
1138
|
+
if (y[0] === s && y[1] === h) {
|
|
1139
|
+
ce(!1), t(!1);
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
const _ = w ?? 500, J = setTimeout(() => {
|
|
1143
|
+
ce(!j), t(!I);
|
|
1144
|
+
}, 300), Ae = setTimeout(() => {
|
|
1145
|
+
j && I && (o === s && u === h ? S(r) : $(r, o, u));
|
|
1146
|
+
}, _);
|
|
1147
|
+
return () => {
|
|
1148
|
+
clearTimeout(J), clearTimeout(Ae);
|
|
1149
|
+
};
|
|
1150
|
+
}, [o, u, j, I, s, h, r, S, $, w, m]), re.useEffect(() => {
|
|
1151
|
+
z([se, A]), ce(!1), t(!1);
|
|
1152
|
+
}, [se, A, r]);
|
|
1153
|
+
const L = re.useCallback((T) => {
|
|
1154
|
+
if (m) return;
|
|
1155
|
+
const _ = Math.max(s, Math.min(M, T[0])), J = Math.max(W, Math.min(h, T[1]));
|
|
1156
|
+
z([_, J]);
|
|
1157
|
+
}, [m, s, h, W, M]), ue = re.useCallback((T) => {
|
|
1158
|
+
if (m) return;
|
|
1159
|
+
const _ = Math.max(s, Math.min(M, T[0])), J = Math.max(W, Math.min(h, T[1]));
|
|
1160
|
+
_ === s && J === h ? (z([s, h]), S(r)) : z([_, J]);
|
|
1161
|
+
}, [m, s, h, W, M, r, S]), oe = re.useCallback((T) => {
|
|
1162
|
+
if (m) return;
|
|
1163
|
+
const _ = Number(T.target.value);
|
|
1164
|
+
if (!isNaN(_)) {
|
|
1165
|
+
const J = Math.max(s, Math.min(M, _));
|
|
1166
|
+
z([J, y[1]]);
|
|
1167
|
+
}
|
|
1168
|
+
}, [m, y, s, M]), P = re.useCallback((T) => {
|
|
1169
|
+
if (m) return;
|
|
1170
|
+
const _ = Number(T.target.value);
|
|
1171
|
+
if (!isNaN(_)) {
|
|
1172
|
+
const J = Math.max(W, Math.min(h, _));
|
|
1173
|
+
z([y[0], J]);
|
|
1174
|
+
}
|
|
1175
|
+
}, [m, y, W, h]), ae = re.useCallback(() => {
|
|
1176
|
+
const T = y[0], _ = Math.max(s, Math.min(M, T));
|
|
1177
|
+
_ < y[1] ? z([_, y[1]]) : z([s, y[1]]);
|
|
1178
|
+
}, [y, s, M]), ye = re.useCallback(() => {
|
|
1179
|
+
const T = y[1], _ = Math.max(W, Math.min(h, T));
|
|
1180
|
+
_ > y[0] ? z([y[0], _]) : z([y[0], h]);
|
|
1181
|
+
}, [y, W, h]);
|
|
1182
|
+
return p || !Z && !O ? null : c === "slider" ? /* @__PURE__ */ e.jsxs(ve, { title: a, collapsed: R, collapsible: v, children: [
|
|
1183
|
+
m && /* @__PURE__ */ e.jsxs("div", { className: ot.disabledMessage, children: [
|
|
1184
|
+
"No adjustable range (all results have the same value: ",
|
|
1185
|
+
s,
|
|
1186
|
+
")."
|
|
1187
|
+
] }),
|
|
1188
|
+
/* @__PURE__ */ e.jsx("div", { style: { padding: "10px 10px 20px 10px" }, children: /* @__PURE__ */ e.jsx(
|
|
1189
|
+
it,
|
|
1190
|
+
{
|
|
1191
|
+
min: le,
|
|
1192
|
+
max: be,
|
|
1193
|
+
value: m ? [le, be] : [o, u],
|
|
1194
|
+
isRange: !0,
|
|
1195
|
+
onChange: (T) => L(T),
|
|
1196
|
+
onFinalChange: (T) => ue(T),
|
|
1197
|
+
disabled: m,
|
|
1198
|
+
activeMin: W,
|
|
1199
|
+
activeMax: M,
|
|
1200
|
+
isFaceted: N,
|
|
1201
|
+
highlightFaceted: Se
|
|
1202
|
+
}
|
|
1203
|
+
) }),
|
|
1204
|
+
/* @__PURE__ */ e.jsxs(
|
|
1205
|
+
"div",
|
|
1206
|
+
{
|
|
1207
|
+
style: {
|
|
1208
|
+
display: "flex",
|
|
1209
|
+
flex: "flex-grow",
|
|
1210
|
+
gap: "10px",
|
|
1211
|
+
alignItems: "flex-start",
|
|
1212
|
+
justifyContent: "space-between"
|
|
1213
|
+
},
|
|
1214
|
+
children: [
|
|
1215
|
+
/* @__PURE__ */ e.jsx(
|
|
1216
|
+
Y,
|
|
1217
|
+
{
|
|
1218
|
+
type: "number",
|
|
1219
|
+
value: m ? s : y[0],
|
|
1220
|
+
min: s,
|
|
1221
|
+
max: Math.min(M, y[1] - 1),
|
|
1222
|
+
onChange: oe,
|
|
1223
|
+
onBlur: ae,
|
|
1224
|
+
disabled: m,
|
|
1225
|
+
isValid: m || !pe
|
|
1226
|
+
}
|
|
1227
|
+
),
|
|
1228
|
+
/* @__PURE__ */ e.jsx(
|
|
1229
|
+
Y,
|
|
1230
|
+
{
|
|
1231
|
+
type: "number",
|
|
1232
|
+
value: m ? h : y[1],
|
|
1233
|
+
min: Math.max(W, y[0] + 1),
|
|
1234
|
+
max: h,
|
|
1235
|
+
onChange: P,
|
|
1236
|
+
onBlur: ye,
|
|
1237
|
+
disabled: m,
|
|
1238
|
+
isValid: m || !f
|
|
1239
|
+
}
|
|
1240
|
+
)
|
|
1241
|
+
]
|
|
1242
|
+
}
|
|
1243
|
+
)
|
|
1244
|
+
] }) : /* @__PURE__ */ e.jsxs(ve, { title: a, children: [
|
|
1245
|
+
m && /* @__PURE__ */ e.jsxs("div", { className: ot.disabledMessage, children: [
|
|
1246
|
+
"No adjustable range (all results have the same value: ",
|
|
1247
|
+
s,
|
|
1248
|
+
")."
|
|
1249
|
+
] }),
|
|
1250
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: "10px", alignItems: "flex-start" }, children: [
|
|
1251
|
+
/* @__PURE__ */ e.jsx(
|
|
1252
|
+
Y,
|
|
1253
|
+
{
|
|
1254
|
+
label: "Min:",
|
|
1255
|
+
type: "number",
|
|
1256
|
+
value: m ? s : y[0],
|
|
1257
|
+
min: s,
|
|
1258
|
+
max: Math.min(M, y[1] - 1),
|
|
1259
|
+
onChange: oe,
|
|
1260
|
+
onBlur: ae,
|
|
1261
|
+
disabled: m,
|
|
1262
|
+
isValid: m || !pe
|
|
1263
|
+
}
|
|
1264
|
+
),
|
|
1265
|
+
/* @__PURE__ */ e.jsx(
|
|
1266
|
+
Y,
|
|
1267
|
+
{
|
|
1268
|
+
label: "Max:",
|
|
1269
|
+
type: "number",
|
|
1270
|
+
value: m ? h : y[1],
|
|
1271
|
+
min: Math.max(W, y[0] + 1),
|
|
1272
|
+
max: h,
|
|
1273
|
+
onChange: P,
|
|
1274
|
+
onBlur: ye,
|
|
1275
|
+
disabled: m,
|
|
1276
|
+
isValid: m || !f
|
|
1277
|
+
}
|
|
1278
|
+
)
|
|
1279
|
+
] })
|
|
1280
|
+
] });
|
|
1281
|
+
}, Ot = "_grid_nvpmn_2", Pt = {
|
|
1282
|
+
grid: Ot
|
|
1283
|
+
}, Ht = at(({ field: r, value: a, onReset: d }) => /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsxs(
|
|
1284
|
+
xe,
|
|
1285
|
+
{
|
|
1286
|
+
onClick: d,
|
|
1287
|
+
iconRight: /* @__PURE__ */ e.jsx(ct, {}),
|
|
1288
|
+
variant: "primary",
|
|
1289
|
+
size: "micro",
|
|
1290
|
+
children: [
|
|
1291
|
+
r,
|
|
1292
|
+
": ",
|
|
1293
|
+
a
|
|
1294
|
+
]
|
|
1295
|
+
}
|
|
1296
|
+
) })), It = at(({ field: r, min: a, max: d, onReset: i }) => /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsxs(
|
|
1297
|
+
xe,
|
|
1298
|
+
{
|
|
1299
|
+
onClick: i,
|
|
1300
|
+
iconRight: /* @__PURE__ */ e.jsx(ct, {}),
|
|
1301
|
+
variant: "primary",
|
|
1302
|
+
size: "micro",
|
|
1303
|
+
children: [
|
|
1304
|
+
r,
|
|
1305
|
+
": ",
|
|
1306
|
+
a,
|
|
1307
|
+
" – ",
|
|
1308
|
+
d
|
|
1309
|
+
]
|
|
1310
|
+
}
|
|
1311
|
+
) }));
|
|
1312
|
+
function Zt() {
|
|
1313
|
+
const {
|
|
1314
|
+
state: { filters: r, rangeFilters: a },
|
|
1315
|
+
resetFilters: d,
|
|
1316
|
+
resetSingleFilter: i
|
|
1317
|
+
} = Te(), c = Ue(
|
|
1318
|
+
() => Object.entries(r).map(
|
|
1319
|
+
([x, n]) => n.map((b) => ({ field: x, value: b }))
|
|
1320
|
+
).flat(),
|
|
1321
|
+
[r]
|
|
1322
|
+
), v = Ue(
|
|
1323
|
+
() => Object.entries(a).map(([x, { min: n, max: b }]) => ({ field: x, min: n, max: b })),
|
|
1324
|
+
[a]
|
|
1325
|
+
);
|
|
1326
|
+
return Ue(
|
|
1327
|
+
() => Object.keys(r).length > 0 || Object.keys(a).length > 0,
|
|
1328
|
+
[r, a]
|
|
1329
|
+
) ? /* @__PURE__ */ e.jsx(ve, { collapsible: !1, title: "Active filters", children: /* @__PURE__ */ e.jsxs("ul", { className: Pt.grid, children: [
|
|
1330
|
+
c.map(({ field: x, value: n }) => /* @__PURE__ */ e.jsx(
|
|
1331
|
+
Ht,
|
|
1332
|
+
{
|
|
1333
|
+
field: x,
|
|
1334
|
+
value: n,
|
|
1335
|
+
onReset: () => i(x, n)
|
|
1336
|
+
},
|
|
1337
|
+
`${x}-${n}`
|
|
1338
|
+
)),
|
|
1339
|
+
v.map(({ field: x, min: n, max: b }) => /* @__PURE__ */ e.jsx(
|
|
1340
|
+
It,
|
|
1341
|
+
{
|
|
1342
|
+
field: x,
|
|
1343
|
+
min: n,
|
|
1344
|
+
max: b,
|
|
1345
|
+
onReset: () => i(x)
|
|
1346
|
+
},
|
|
1347
|
+
x
|
|
1348
|
+
)),
|
|
1349
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1350
|
+
xe,
|
|
1351
|
+
{
|
|
1352
|
+
onClick: d,
|
|
1353
|
+
size: "micro",
|
|
1354
|
+
variant: "ghost",
|
|
1355
|
+
children: "Reset"
|
|
1356
|
+
}
|
|
1357
|
+
) })
|
|
1358
|
+
] }) }) : null;
|
|
1359
|
+
}
|
|
1360
|
+
const $t = "_radioGroup_nwf7i_6", Wt = {
|
|
1361
|
+
radioGroup: $t
|
|
1362
|
+
}, Kt = ({ displayType: r = "dropdown", collapsible: a = !0, startCollapsed: d = !1 }) => {
|
|
1363
|
+
const {
|
|
1364
|
+
state: { sortableFields: i, sortBy: c, sortAscending: v },
|
|
1365
|
+
setSort: R
|
|
1366
|
+
} = Te();
|
|
1367
|
+
if (!i || i.length === 0) return null;
|
|
1368
|
+
const x = c ? `${c}:${v ? "asc" : "desc"}` : "none", n = [
|
|
1369
|
+
{ label: "None", value: "none" },
|
|
1370
|
+
...i.flatMap((w) => [
|
|
1371
|
+
{ label: `${w} (asc)`, value: `${w}:asc` },
|
|
1372
|
+
{ label: `${w} (desc)`, value: `${w}:desc` }
|
|
1373
|
+
])
|
|
1374
|
+
], b = (w) => {
|
|
1375
|
+
if (w === "none" || w === "")
|
|
1376
|
+
R(null, !0);
|
|
1377
|
+
else {
|
|
1378
|
+
const [$, S] = w.split(":");
|
|
1379
|
+
R($, S === "asc");
|
|
1380
|
+
}
|
|
1381
|
+
}, O = a ? d : !1;
|
|
1382
|
+
return /* @__PURE__ */ e.jsx(
|
|
1383
|
+
ve,
|
|
1384
|
+
{
|
|
1385
|
+
title: "Sort by",
|
|
1386
|
+
collapsible: a,
|
|
1387
|
+
collapsed: O,
|
|
1388
|
+
children: r === "dropdown" ? /* @__PURE__ */ e.jsx(
|
|
1389
|
+
vt,
|
|
1390
|
+
{
|
|
1391
|
+
value: x,
|
|
1392
|
+
onValueChange: b,
|
|
1393
|
+
options: n,
|
|
1394
|
+
placeholder: "Select sort..."
|
|
1395
|
+
}
|
|
1396
|
+
) : /* @__PURE__ */ e.jsx("div", { className: Wt.radioGroup, children: n.map((w) => /* @__PURE__ */ e.jsx(
|
|
1397
|
+
xt,
|
|
1398
|
+
{
|
|
1399
|
+
id: `sort-${w.value}`,
|
|
1400
|
+
name: "sort-by",
|
|
1401
|
+
value: w.value,
|
|
1402
|
+
label: w.label,
|
|
1403
|
+
checked: x === w.value,
|
|
1404
|
+
onChange: ($) => b($.target.value)
|
|
1405
|
+
},
|
|
1406
|
+
w.value
|
|
1407
|
+
)) })
|
|
1408
|
+
}
|
|
1409
|
+
);
|
|
1410
|
+
}, Dt = "_list_1y4fk_1", qt = {
|
|
1411
|
+
list: Dt
|
|
1412
|
+
};
|
|
1413
|
+
function er() {
|
|
1414
|
+
const {
|
|
1415
|
+
state: { searchSettings: r },
|
|
1416
|
+
setSearchSettings: a
|
|
1417
|
+
} = Te(), [d, i] = X(!1), c = (n, b) => {
|
|
1418
|
+
const O = parseInt(b, 10);
|
|
1419
|
+
isNaN(O) || a({
|
|
1420
|
+
[n]: O
|
|
1421
|
+
});
|
|
1422
|
+
}, v = (n, b) => {
|
|
1423
|
+
a({
|
|
1424
|
+
[n]: b
|
|
1425
|
+
});
|
|
1426
|
+
}, R = (n, b) => {
|
|
1427
|
+
const O = parseInt(b, 10);
|
|
1428
|
+
isNaN(O) || a({
|
|
1429
|
+
coverageSetup: {
|
|
1430
|
+
...r.coverageSetup,
|
|
1431
|
+
[n]: O
|
|
1432
|
+
}
|
|
1433
|
+
});
|
|
1434
|
+
}, x = (n, b) => {
|
|
1435
|
+
a({
|
|
1436
|
+
coverageSetup: {
|
|
1437
|
+
...r.coverageSetup,
|
|
1438
|
+
[n]: b
|
|
1439
|
+
}
|
|
1440
|
+
});
|
|
1441
|
+
};
|
|
1442
|
+
return /* @__PURE__ */ e.jsx(ve, { collapsed: !0, title: "Settings", children: /* @__PURE__ */ e.jsxs("ul", { className: qt.list, children: [
|
|
1443
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1444
|
+
Y,
|
|
1445
|
+
{
|
|
1446
|
+
label: "Max Results",
|
|
1447
|
+
type: "number",
|
|
1448
|
+
value: r.maxNumberOfRecordsToReturn.toString(),
|
|
1449
|
+
onChange: (n) => c("maxNumberOfRecordsToReturn", n.target.value)
|
|
1450
|
+
}
|
|
1451
|
+
) }),
|
|
1452
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1453
|
+
Y,
|
|
1454
|
+
{
|
|
1455
|
+
label: "Coverage Depth",
|
|
1456
|
+
type: "number",
|
|
1457
|
+
value: r.coverageDepth.toString(),
|
|
1458
|
+
onChange: (n) => c("coverageDepth", n.target.value)
|
|
1459
|
+
}
|
|
1460
|
+
) }),
|
|
1461
|
+
/* @__PURE__ */ e.jsxs("li", { children: [
|
|
1462
|
+
/* @__PURE__ */ e.jsx(
|
|
1463
|
+
Y,
|
|
1464
|
+
{
|
|
1465
|
+
label: "Minimum Score",
|
|
1466
|
+
type: "number",
|
|
1467
|
+
value: r.minimumScore.toString(),
|
|
1468
|
+
onChange: (n) => {
|
|
1469
|
+
const b = parseFloat(n.target.value);
|
|
1470
|
+
isNaN(b) || a({ minimumScore: b });
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
),
|
|
1474
|
+
/* @__PURE__ */ e.jsx("div", { style: { padding: "10px 10px 20px 10px" }, children: /* @__PURE__ */ e.jsx(
|
|
1475
|
+
it,
|
|
1476
|
+
{
|
|
1477
|
+
min: 0,
|
|
1478
|
+
max: 255,
|
|
1479
|
+
step: 1,
|
|
1480
|
+
value: r.minimumScore,
|
|
1481
|
+
onChange: (n) => {
|
|
1482
|
+
a({ minimumScore: n });
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
) })
|
|
1486
|
+
] }),
|
|
1487
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1488
|
+
Y,
|
|
1489
|
+
{
|
|
1490
|
+
label: "Placeholder text",
|
|
1491
|
+
type: "text",
|
|
1492
|
+
value: r.placeholderText,
|
|
1493
|
+
onChange: (n) => {
|
|
1494
|
+
a({ placeholderText: n.target.value });
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
) }),
|
|
1498
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1499
|
+
ne,
|
|
1500
|
+
{
|
|
1501
|
+
label: "Show score",
|
|
1502
|
+
checked: r.showScore,
|
|
1503
|
+
onChange: (n) => v("showScore", n)
|
|
1504
|
+
}
|
|
1505
|
+
) }),
|
|
1506
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1507
|
+
ne,
|
|
1508
|
+
{
|
|
1509
|
+
label: "Enable Coverage",
|
|
1510
|
+
checked: r.enableCoverage,
|
|
1511
|
+
onChange: (n) => v("enableCoverage", n)
|
|
1512
|
+
}
|
|
1513
|
+
) }),
|
|
1514
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1515
|
+
ne,
|
|
1516
|
+
{
|
|
1517
|
+
label: "Remove Duplicates",
|
|
1518
|
+
checked: r.removeDuplicates,
|
|
1519
|
+
onChange: (n) => v("removeDuplicates", n)
|
|
1520
|
+
}
|
|
1521
|
+
) }),
|
|
1522
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(xe, { variant: "ghost", size: "micro", iconRight: d ? /* @__PURE__ */ e.jsx(Ft, {}) : /* @__PURE__ */ e.jsx(Mt, {}), onClick: () => i((n) => !n), children: d ? "Hide Coverage Setup" : "Show Coverage Setup" }) }),
|
|
1523
|
+
d && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1524
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1525
|
+
ne,
|
|
1526
|
+
{
|
|
1527
|
+
label: "Cover Whole Query",
|
|
1528
|
+
checked: r.coverageSetup.coverWholeQuery,
|
|
1529
|
+
onChange: (n) => x("coverWholeQuery", n)
|
|
1530
|
+
}
|
|
1531
|
+
) }),
|
|
1532
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1533
|
+
ne,
|
|
1534
|
+
{
|
|
1535
|
+
label: "Cover Whole Words",
|
|
1536
|
+
checked: r.coverageSetup.coverWholeWords,
|
|
1537
|
+
onChange: (n) => x("coverWholeWords", n)
|
|
1538
|
+
}
|
|
1539
|
+
) }),
|
|
1540
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1541
|
+
ne,
|
|
1542
|
+
{
|
|
1543
|
+
label: "Cover Fuzzy Words",
|
|
1544
|
+
checked: r.coverageSetup.coverFuzzyWords,
|
|
1545
|
+
onChange: (n) => x("coverFuzzyWords", n)
|
|
1546
|
+
}
|
|
1547
|
+
) }),
|
|
1548
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1549
|
+
ne,
|
|
1550
|
+
{
|
|
1551
|
+
label: "Cover Joined Words",
|
|
1552
|
+
checked: r.coverageSetup.coverJoinedWords,
|
|
1553
|
+
onChange: (n) => x("coverJoinedWords", n)
|
|
1554
|
+
}
|
|
1555
|
+
) }),
|
|
1556
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1557
|
+
ne,
|
|
1558
|
+
{
|
|
1559
|
+
label: "Cover Prefix Suffix",
|
|
1560
|
+
checked: r.coverageSetup.coverPrefixSuffix,
|
|
1561
|
+
onChange: (n) => x("coverPrefixSuffix", n)
|
|
1562
|
+
}
|
|
1563
|
+
) }),
|
|
1564
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1565
|
+
ne,
|
|
1566
|
+
{
|
|
1567
|
+
label: "Truncate list",
|
|
1568
|
+
checked: r.coverageSetup.truncate,
|
|
1569
|
+
onChange: (n) => x("truncate", n)
|
|
1570
|
+
}
|
|
1571
|
+
) }),
|
|
1572
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1573
|
+
Y,
|
|
1574
|
+
{
|
|
1575
|
+
label: "Levenshtein Max Word Size",
|
|
1576
|
+
type: "number",
|
|
1577
|
+
value: r.coverageSetup.levenshteinMaxWordSize.toString(),
|
|
1578
|
+
onChange: (n) => R("levenshteinMaxWordSize", n.target.value)
|
|
1579
|
+
}
|
|
1580
|
+
) }),
|
|
1581
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1582
|
+
Y,
|
|
1583
|
+
{
|
|
1584
|
+
label: "Min Word Size",
|
|
1585
|
+
type: "number",
|
|
1586
|
+
value: r.coverageSetup.minWordSize.toString(),
|
|
1587
|
+
onChange: (n) => R("minWordSize", n.target.value)
|
|
1588
|
+
}
|
|
1589
|
+
) }),
|
|
1590
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1591
|
+
Y,
|
|
1592
|
+
{
|
|
1593
|
+
label: "Coverage Min Word Hits Abs",
|
|
1594
|
+
type: "number",
|
|
1595
|
+
value: r.coverageSetup.coverageMinWordHitsAbs.toString(),
|
|
1596
|
+
onChange: (n) => R("coverageMinWordHitsAbs", n.target.value)
|
|
1597
|
+
}
|
|
1598
|
+
) }),
|
|
1599
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1600
|
+
Y,
|
|
1601
|
+
{
|
|
1602
|
+
label: "Coverage Min Word Hits Relative",
|
|
1603
|
+
type: "number",
|
|
1604
|
+
value: r.coverageSetup.coverageMinWordHitsRelative.toString(),
|
|
1605
|
+
onChange: (n) => R("coverageMinWordHitsRelative", n.target.value)
|
|
1606
|
+
}
|
|
1607
|
+
) }),
|
|
1608
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1609
|
+
Y,
|
|
1610
|
+
{
|
|
1611
|
+
label: "Coverage Q Limit For Error Tolerance",
|
|
1612
|
+
type: "number",
|
|
1613
|
+
value: r.coverageSetup.coverageQLimitForErrorTolerance.toString(),
|
|
1614
|
+
onChange: (n) => R("coverageQLimitForErrorTolerance", n.target.value)
|
|
1615
|
+
}
|
|
1616
|
+
) }),
|
|
1617
|
+
/* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
|
|
1618
|
+
Y,
|
|
1619
|
+
{
|
|
1620
|
+
label: "Coverage LCS Error Tolerance Relative Q",
|
|
1621
|
+
type: "number",
|
|
1622
|
+
value: r.coverageSetup.coverageLcsErrorToleranceRelativeq.toString(),
|
|
1623
|
+
onChange: (n) => R("coverageLcsErrorToleranceRelativeq", n.target.value)
|
|
1624
|
+
}
|
|
1625
|
+
) })
|
|
1626
|
+
] })
|
|
1627
|
+
] }) });
|
|
1628
|
+
}
|
|
1629
|
+
class tr extends mt {
|
|
1630
|
+
constructor(d) {
|
|
1631
|
+
super(d);
|
|
1632
|
+
et(this, "reset", () => {
|
|
1633
|
+
this.setState({ hasError: !1, error: null });
|
|
1634
|
+
});
|
|
1635
|
+
this.state = { hasError: !1, error: null };
|
|
1636
|
+
}
|
|
1637
|
+
static getDerivedStateFromError(d) {
|
|
1638
|
+
return { hasError: !0, error: d };
|
|
1639
|
+
}
|
|
1640
|
+
componentDidCatch(d, i) {
|
|
1641
|
+
console.error("[SearchErrorBoundary] Caught error:", d, i);
|
|
1642
|
+
}
|
|
1643
|
+
render() {
|
|
1644
|
+
return this.state.hasError && this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : /* @__PURE__ */ e.jsxs("div", { style: {
|
|
1645
|
+
padding: "2rem",
|
|
1646
|
+
backgroundColor: "#fee",
|
|
1647
|
+
border: "2px solid #c33",
|
|
1648
|
+
borderRadius: "8px",
|
|
1649
|
+
maxWidth: "600px",
|
|
1650
|
+
margin: "2rem auto"
|
|
1651
|
+
}, children: [
|
|
1652
|
+
/* @__PURE__ */ e.jsx("h2", { style: { color: "#c33", marginTop: 0 }, children: "⚠️ Search Initialization Error" }),
|
|
1653
|
+
/* @__PURE__ */ e.jsxs("p", { style: { marginBottom: "1rem" }, children: [
|
|
1654
|
+
/* @__PURE__ */ e.jsx("strong", { children: "Error:" }),
|
|
1655
|
+
" ",
|
|
1656
|
+
this.state.error.message
|
|
1657
|
+
] }),
|
|
1658
|
+
/* @__PURE__ */ e.jsxs("div", { style: {
|
|
1659
|
+
backgroundColor: "#fff",
|
|
1660
|
+
padding: "1rem",
|
|
1661
|
+
borderRadius: "4px",
|
|
1662
|
+
marginBottom: "1rem",
|
|
1663
|
+
fontSize: "0.9rem"
|
|
1664
|
+
}, children: [
|
|
1665
|
+
/* @__PURE__ */ e.jsx("strong", { children: "💡 Common fixes:" }),
|
|
1666
|
+
/* @__PURE__ */ e.jsxs("ul", { style: { marginBottom: 0, paddingLeft: "1.5rem" }, children: [
|
|
1667
|
+
/* @__PURE__ */ e.jsx("li", { children: "Check browser console for detailed error messages" }),
|
|
1668
|
+
/* @__PURE__ */ e.jsx("li", { children: "Verify NEXT_PUBLIC_INDX_URL is correct in .env.local" }),
|
|
1669
|
+
/* @__PURE__ */ e.jsx("li", { children: "Verify NEXT_PUBLIC_INDX_EMAIL and NEXT_PUBLIC_INDX_PASSWORD are correct" }),
|
|
1670
|
+
/* @__PURE__ */ e.jsx("li", { children: "Ensure INDX server is running" }),
|
|
1671
|
+
/* @__PURE__ */ e.jsx("li", { children: "Check dataset name spelling" })
|
|
1672
|
+
] })
|
|
1673
|
+
] }),
|
|
1674
|
+
/* @__PURE__ */ e.jsx(
|
|
1675
|
+
"button",
|
|
1676
|
+
{
|
|
1677
|
+
onClick: this.reset,
|
|
1678
|
+
style: {
|
|
1679
|
+
padding: "0.5rem 1rem",
|
|
1680
|
+
backgroundColor: "#c33",
|
|
1681
|
+
color: "white",
|
|
1682
|
+
border: "none",
|
|
1683
|
+
borderRadius: "4px",
|
|
1684
|
+
cursor: "pointer",
|
|
1685
|
+
fontWeight: "bold"
|
|
1686
|
+
},
|
|
1687
|
+
children: "Try Again"
|
|
1688
|
+
}
|
|
1689
|
+
)
|
|
1690
|
+
] }) : this.props.children;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
export {
|
|
1694
|
+
Zt as ActiveFiltersPanel,
|
|
1695
|
+
Yt as RangeFilterPanel,
|
|
1696
|
+
tr as SearchErrorBoundary,
|
|
1697
|
+
Xt as SearchInput,
|
|
1698
|
+
Gt as SearchProvider,
|
|
1699
|
+
Jt as SearchResults,
|
|
1700
|
+
er as SearchSettingsPanel,
|
|
1701
|
+
Kt as SortByPanel,
|
|
1702
|
+
Qt as ValueFilterPanel,
|
|
1703
|
+
Te as useSearch,
|
|
1704
|
+
Te as useSearchContext
|
|
1705
|
+
};
|