@indxsearch/intrface 3.1.1 → 3.2.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/CHANGELOG.md +13 -0
- package/dist/context/IndxApiError.d.ts +27 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +258 -238
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -114,56 +114,76 @@ function D({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebugL
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
//#endregion
|
|
117
|
+
//#region src/context/IndxApiError.ts
|
|
118
|
+
var O = class e extends Error {
|
|
119
|
+
status;
|
|
120
|
+
code;
|
|
121
|
+
problem;
|
|
122
|
+
retryAfterSeconds;
|
|
123
|
+
constructor(e, t, n, r) {
|
|
124
|
+
let i = n?.detail ?? n?.title;
|
|
125
|
+
super(`${e} failed: HTTP ${t}${i ? ` — ${i}` : ""}`), this.name = "IndxApiError", this.status = t, this.code = n?.code, this.problem = n, this.retryAfterSeconds = r;
|
|
126
|
+
}
|
|
127
|
+
get retryable() {
|
|
128
|
+
return this.code === "invalidState" && this.problem?.retryable === !0;
|
|
129
|
+
}
|
|
130
|
+
static async fromResponse(t, n) {
|
|
131
|
+
let r;
|
|
132
|
+
try {
|
|
133
|
+
let e = await n.json();
|
|
134
|
+
e && typeof e == "object" && typeof e.code == "string" ? r = e : e && typeof e == "object" && (r = {
|
|
135
|
+
...e,
|
|
136
|
+
code: ""
|
|
137
|
+
});
|
|
138
|
+
} catch {}
|
|
139
|
+
let i = n.headers?.get?.("Retry-After"), a = i != null && /^\d+$/.test(i) ? Number(i) : void 0;
|
|
140
|
+
return new e(t, n.status, r, a);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
//#endregion
|
|
117
144
|
//#region src/context/buildFilterProxy.ts
|
|
118
|
-
async function
|
|
145
|
+
async function k(e, t, n, r, i, a, o) {
|
|
119
146
|
let s = await o(`${r}/api/teams/${i}/datasets/${a}/filters/${e}`, {
|
|
120
147
|
method: "POST",
|
|
121
148
|
headers: { "Content-Type": "application/json" },
|
|
122
149
|
body: JSON.stringify(t)
|
|
123
150
|
});
|
|
124
|
-
if (!s.ok)
|
|
125
|
-
let e = "";
|
|
126
|
-
try {
|
|
127
|
-
let t = await s.json();
|
|
128
|
-
e = t?.detail ?? t?.title ?? "";
|
|
129
|
-
} catch {}
|
|
130
|
-
throw Error(`${n} failed: HTTP ${s.status}${e ? ` — ${e}` : ""}`);
|
|
131
|
-
}
|
|
151
|
+
if (!s.ok) throw await O.fromResponse(n, s);
|
|
132
152
|
let c = await s.json();
|
|
133
153
|
if (!c || typeof c.hashString != "string") throw Error(`${n} failed: server returned no filter token`);
|
|
134
154
|
return c;
|
|
135
155
|
}
|
|
136
|
-
async function
|
|
156
|
+
async function A(e, t, n, r, i, a) {
|
|
137
157
|
if (e.length === 0) return null;
|
|
138
158
|
if (e.length === 1) return e[0];
|
|
139
159
|
let o = e[0];
|
|
140
|
-
for (let s = 1; s < e.length; s++) o = await
|
|
160
|
+
for (let s = 1; s < e.length; s++) o = await k("combine", {
|
|
141
161
|
a: o,
|
|
142
162
|
b: e[s],
|
|
143
163
|
useAndOperation: t === "and"
|
|
144
164
|
}, "CombineFilters", n, r, i, a);
|
|
145
165
|
return o;
|
|
146
166
|
}
|
|
147
|
-
async function
|
|
148
|
-
let s = Object.entries(e ?? {}).filter(([, e]) => e.length > 0), c = Object.entries(t ?? {}), [l, u] = await Promise.all([Promise.all(s.map(async ([e, t]) =>
|
|
167
|
+
async function j(e, t, n, r, i, a, o = {}) {
|
|
168
|
+
let s = Object.entries(e ?? {}).filter(([, e]) => e.length > 0), c = Object.entries(t ?? {}), [l, u] = await Promise.all([Promise.all(s.map(async ([e, t]) => A(await Promise.all(t.map((t) => k("value", {
|
|
149
169
|
fieldName: e,
|
|
150
170
|
value: t
|
|
151
|
-
}, `Value filter '${e}'`, n, r, i, a))), o[e] === "any" ? "or" : "and", n, r, i, a))), Promise.all(c.map(([e, { min: t, max: o }]) =>
|
|
171
|
+
}, `Value filter '${e}'`, n, r, i, a))), o[e] === "any" ? "or" : "and", n, r, i, a))), Promise.all(c.map(([e, { min: t, max: o }]) => k("range", {
|
|
152
172
|
fieldName: e,
|
|
153
173
|
lowerLimit: t,
|
|
154
174
|
upperLimit: o
|
|
155
175
|
}, `Range filter '${e}'`, n, r, i, a)))]);
|
|
156
|
-
return
|
|
176
|
+
return A([...l, ...u], "and", n, r, i, a);
|
|
157
177
|
}
|
|
158
178
|
//#endregion
|
|
159
179
|
//#region src/context/useSearchExecution.ts
|
|
160
|
-
function
|
|
180
|
+
function M(e, t) {
|
|
161
181
|
let n, r = (...r) => {
|
|
162
182
|
clearTimeout(n), n = setTimeout(() => e(...r), t);
|
|
163
183
|
};
|
|
164
184
|
return r.cancel = () => clearTimeout(n), r;
|
|
165
185
|
}
|
|
166
|
-
function
|
|
186
|
+
function N({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team: s, dataset: u, allowEmptySearch: d, facetsEnabled: f, enableDebugLogs: p, filtersChangedByUser: m, shouldFetchMore: h }) {
|
|
167
187
|
let g = c(0), _ = c(void 0), v = c(!1), [y, b] = l({}), [x, S] = l(""), [C, w] = l("");
|
|
168
188
|
o(() => {
|
|
169
189
|
r.isFetchingInitial || t((e) => ({
|
|
@@ -184,7 +204,7 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
184
204
|
r.sortableFields,
|
|
185
205
|
t
|
|
186
206
|
]);
|
|
187
|
-
let T = e.searchSettings.maxNumberOfRecordsToReturn, E = e.searchSettings.enableCoverage, D = e.searchSettings.removeDuplicates,
|
|
207
|
+
let T = e.searchSettings.maxNumberOfRecordsToReturn, E = e.searchSettings.enableCoverage, D = e.searchSettings.removeDuplicates, k = e.searchSettings.coverageDepth, A = e.searchSettings.minimumScore, N = e.searchSettings.coverageSetup, P = e.sortBy, F = e.sortAscending, I = i(async ({ enableFacets: i }) => {
|
|
188
208
|
if (!r.token) return;
|
|
189
209
|
let o = ++g.current;
|
|
190
210
|
if (t((e) => ({
|
|
@@ -195,17 +215,17 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
195
215
|
i = !0;
|
|
196
216
|
}
|
|
197
217
|
try {
|
|
198
|
-
let c = await
|
|
218
|
+
let c = await j(e.filters, e.rangeFilters, a, s, u, n, e.valueMatch), l = d || e.query.trim() !== "", f = {
|
|
199
219
|
text: e.query,
|
|
200
220
|
maxNumberOfRecordsToReturn: l ? T : 0,
|
|
201
221
|
enableFacets: i,
|
|
202
222
|
...c ? { filter: c } : {},
|
|
203
|
-
...
|
|
204
|
-
...
|
|
223
|
+
...P ? { sortBy: P } : {},
|
|
224
|
+
...F === void 0 ? {} : { sortAscending: F },
|
|
205
225
|
enableCoverage: E,
|
|
206
226
|
removeDuplicates: D,
|
|
207
|
-
coverageDepth:
|
|
208
|
-
coverageSetup:
|
|
227
|
+
coverageDepth: k,
|
|
228
|
+
coverageSetup: N
|
|
209
229
|
};
|
|
210
230
|
p && console.log("[performSearch] request body:", JSON.stringify(f, null, 2));
|
|
211
231
|
let m = await n(`${a}/api/teams/${s}/datasets/${u}/search`, {
|
|
@@ -213,67 +233,67 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
213
233
|
headers: { "Content-Type": "application/json" },
|
|
214
234
|
body: JSON.stringify(f)
|
|
215
235
|
});
|
|
216
|
-
if (!m.ok) throw
|
|
217
|
-
let h = await m.json(), _ = h.truncationIndex ?? -1, v = h.records || [],
|
|
218
|
-
if (l &&
|
|
236
|
+
if (!m.ok) throw await O.fromResponse("Search", m);
|
|
237
|
+
let h = await m.json(), _ = h.truncationIndex ?? -1, v = h.records || [], M = v.map((e) => e.documentKey), I = v.map((e) => e.score), L = [];
|
|
238
|
+
if (l && M.length > 0) {
|
|
219
239
|
let e = await n(`${a}/api/teams/${s}/datasets/${u}/documents/lookup`, {
|
|
220
240
|
method: "POST",
|
|
221
241
|
headers: { "Content-Type": "application/json" },
|
|
222
|
-
body: JSON.stringify(
|
|
242
|
+
body: JSON.stringify(M)
|
|
223
243
|
});
|
|
224
|
-
if (!e.ok) throw
|
|
225
|
-
|
|
244
|
+
if (!e.ok) throw await O.fromResponse("Document lookup", e);
|
|
245
|
+
L = (await e.json()).map((e, t) => ({
|
|
226
246
|
document: e,
|
|
227
|
-
documentKey:
|
|
228
|
-
score:
|
|
247
|
+
documentKey: M[t],
|
|
248
|
+
score: I[t]
|
|
229
249
|
}));
|
|
230
250
|
}
|
|
231
|
-
let
|
|
251
|
+
let R = {};
|
|
232
252
|
if (i && h.facets) {
|
|
233
253
|
for (let [e, t] of Object.entries(h.facets)) if (Array.isArray(t) && t.length > 0) {
|
|
234
254
|
let n = t.map((e) => Number(e.key)).filter((e) => !isNaN(e));
|
|
235
|
-
n.length > 0 && (
|
|
255
|
+
n.length > 0 && (R[e] = {
|
|
236
256
|
min: Math.min(...n),
|
|
237
257
|
max: Math.max(...n)
|
|
238
258
|
});
|
|
239
259
|
}
|
|
240
260
|
}
|
|
241
|
-
|
|
242
|
-
|
|
261
|
+
if (o !== g.current) return;
|
|
262
|
+
let z = e.query !== x, B = e.query !== C, V = e.facetStats ?? {};
|
|
263
|
+
if (z ? (V = {
|
|
243
264
|
...r.initialFacetStats,
|
|
244
|
-
...
|
|
245
|
-
}, b(
|
|
265
|
+
...R
|
|
266
|
+
}, b(V), S(e.query)) : V = {
|
|
246
267
|
...y,
|
|
247
|
-
...
|
|
248
|
-
},
|
|
268
|
+
...R
|
|
269
|
+
}, B && i) {
|
|
249
270
|
let n = { ...e.rangeBounds };
|
|
250
|
-
for (let [e, t] of Object.entries(
|
|
271
|
+
for (let [e, t] of Object.entries(R)) n[e] = t;
|
|
251
272
|
t((e) => ({
|
|
252
273
|
...e,
|
|
253
274
|
rangeBounds: n
|
|
254
275
|
})), w(e.query);
|
|
255
276
|
}
|
|
256
|
-
let
|
|
257
|
-
if (i && (!
|
|
258
|
-
|
|
259
|
-
for (let [e, t] of Object.entries(r.initialFacetKeys))
|
|
277
|
+
let H = h.facets;
|
|
278
|
+
if (i && (!H || Object.keys(H).length === 0)) {
|
|
279
|
+
H = {};
|
|
280
|
+
for (let [e, t] of Object.entries(r.initialFacetKeys)) H[e] = t.map((e) => ({
|
|
260
281
|
key: e,
|
|
261
282
|
value: null
|
|
262
283
|
}));
|
|
263
284
|
}
|
|
264
|
-
|
|
265
|
-
let H = I.filter((t) => {
|
|
285
|
+
let U = L.filter((t) => {
|
|
266
286
|
let n = e.query.trim();
|
|
267
|
-
return n === "" || n.length === 1 ? !0 : t.score >=
|
|
287
|
+
return n === "" || n.length === 1 ? !0 : t.score >= A;
|
|
268
288
|
});
|
|
269
289
|
t((e) => ({
|
|
270
290
|
...e,
|
|
271
|
-
results:
|
|
291
|
+
results: U,
|
|
272
292
|
error: void 0,
|
|
273
293
|
resultsSuppressed: !l,
|
|
274
294
|
...i ? {
|
|
275
|
-
facets:
|
|
276
|
-
facetStats:
|
|
295
|
+
facets: H,
|
|
296
|
+
facetStats: V
|
|
277
297
|
} : {},
|
|
278
298
|
isLoading: !1,
|
|
279
299
|
truncationIndex: _
|
|
@@ -294,14 +314,14 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
294
314
|
e.valueMatch,
|
|
295
315
|
e.rangeFilters,
|
|
296
316
|
e.facetStats,
|
|
297
|
-
N,
|
|
298
317
|
P,
|
|
318
|
+
F,
|
|
299
319
|
T,
|
|
300
320
|
E,
|
|
301
321
|
D,
|
|
302
|
-
O,
|
|
303
|
-
M,
|
|
304
322
|
k,
|
|
323
|
+
N,
|
|
324
|
+
A,
|
|
305
325
|
n,
|
|
306
326
|
r.initialFacetStats,
|
|
307
327
|
r.initialFacetKeys,
|
|
@@ -318,13 +338,13 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
318
338
|
t
|
|
319
339
|
]);
|
|
320
340
|
o(() => {
|
|
321
|
-
_.current =
|
|
322
|
-
}, [
|
|
323
|
-
let
|
|
324
|
-
o(() => (
|
|
341
|
+
_.current = I;
|
|
342
|
+
}, [I]);
|
|
343
|
+
let L = c(null);
|
|
344
|
+
o(() => (L.current?.cancel(), L.current = M(() => {
|
|
325
345
|
p && console.log("Debounced searchWithFacets fired"), _.current?.({ enableFacets: !0 });
|
|
326
346
|
}, e.facetDebounceDelayMillis ?? 500), () => {
|
|
327
|
-
|
|
347
|
+
L.current?.cancel();
|
|
328
348
|
}), [e.facetDebounceDelayMillis]), o(() => {
|
|
329
349
|
!r.isFetchingInitial && r.token && !v.current && (d && _.current?.({ enableFacets: f }), v.current = !0);
|
|
330
350
|
}, [
|
|
@@ -342,8 +362,8 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
342
362
|
}));
|
|
343
363
|
return;
|
|
344
364
|
}
|
|
345
|
-
return i ? (
|
|
346
|
-
|
|
365
|
+
return i ? (L.current?.cancel(), _.current?.({ enableFacets: f })) : f ? (p && console.log("Search fired"), _.current?.({ enableFacets: !1 }), L.current?.()) : _.current?.({ enableFacets: !1 }), () => {
|
|
366
|
+
L.current?.cancel();
|
|
347
367
|
};
|
|
348
368
|
}, [
|
|
349
369
|
e.query,
|
|
@@ -358,14 +378,14 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
358
378
|
if (!v.current || !r.token) return;
|
|
359
379
|
let t = e.query.trim();
|
|
360
380
|
!d && t === "" || _.current?.({ enableFacets: f });
|
|
361
|
-
}, [
|
|
362
|
-
let
|
|
381
|
+
}, [P, F]);
|
|
382
|
+
let R = c(!0), z = c(e.query);
|
|
363
383
|
o(() => {
|
|
364
|
-
if (
|
|
365
|
-
|
|
384
|
+
if (R.current) {
|
|
385
|
+
R.current = !1;
|
|
366
386
|
return;
|
|
367
387
|
}
|
|
368
|
-
if (
|
|
388
|
+
if (z.current !== e.query || !v.current || !r.token) return;
|
|
369
389
|
if (h.current) {
|
|
370
390
|
h.current = !1, _.current?.({ enableFacets: !1 });
|
|
371
391
|
return;
|
|
@@ -376,16 +396,16 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
376
396
|
T,
|
|
377
397
|
E,
|
|
378
398
|
D,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
399
|
+
k,
|
|
400
|
+
N,
|
|
401
|
+
A
|
|
382
402
|
]), o(() => {
|
|
383
|
-
|
|
403
|
+
z.current = e.query;
|
|
384
404
|
}, [e.query]);
|
|
385
405
|
}
|
|
386
406
|
//#endregion
|
|
387
407
|
//#region src/context/SearchContext.tsx
|
|
388
|
-
var
|
|
408
|
+
var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySearch: a = !1, maxResults: s = 10, facetDebounceDelayMillis: u = 500, enableFacets: d = !0, coverageDepth: p = 500, removeDuplicates: m = !0, enableCoverage: h = !0, initialCoverageSetup: g = {}, enableDebugLogs: _ = !1, preAuthenticatedToken: v }) => {
|
|
389
409
|
let y = c(!1), b = c(!1), x = c(s), [S, C] = l({
|
|
390
410
|
query: "",
|
|
391
411
|
results: null,
|
|
@@ -449,7 +469,7 @@ var N = n(void 0), P = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
449
469
|
}
|
|
450
470
|
});
|
|
451
471
|
}, [T.token]);
|
|
452
|
-
|
|
472
|
+
N({
|
|
453
473
|
state: S,
|
|
454
474
|
setState: C,
|
|
455
475
|
authenticatedFetch: E,
|
|
@@ -504,7 +524,7 @@ var N = n(void 0), P = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
504
524
|
maxNumberOfRecordsToReturn: e
|
|
505
525
|
}
|
|
506
526
|
}));
|
|
507
|
-
}, []),
|
|
527
|
+
}, []), M = i((e, t) => {
|
|
508
528
|
y.current = !0, C((n) => {
|
|
509
529
|
let r = { ...n.filters }, i = r[e] || [], a = i.includes(t) ? i.filter((e) => e !== t) : [...i, t];
|
|
510
530
|
return a.length ? r[e] = a : delete r[e], {
|
|
@@ -560,7 +580,7 @@ var N = n(void 0), P = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
560
580
|
sortAscending: e ? t : void 0
|
|
561
581
|
}));
|
|
562
582
|
}, []);
|
|
563
|
-
return /* @__PURE__ */ f(
|
|
583
|
+
return /* @__PURE__ */ f(P.Provider, {
|
|
564
584
|
value: {
|
|
565
585
|
state: S,
|
|
566
586
|
isFetchingInitial: T.isFetchingInitial,
|
|
@@ -571,7 +591,7 @@ var N = n(void 0), P = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
571
591
|
dataset: r,
|
|
572
592
|
authenticatedFetch: E,
|
|
573
593
|
setQuery: O,
|
|
574
|
-
toggleFilter:
|
|
594
|
+
toggleFilter: M,
|
|
575
595
|
setValueMatch: F,
|
|
576
596
|
setRangeFilter: I,
|
|
577
597
|
resetFilters: L,
|
|
@@ -584,12 +604,12 @@ var N = n(void 0), P = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
584
604
|
},
|
|
585
605
|
children: e
|
|
586
606
|
});
|
|
587
|
-
},
|
|
588
|
-
let e = a(
|
|
607
|
+
}, I = () => {
|
|
608
|
+
let e = a(P);
|
|
589
609
|
if (!e) throw Error("useSearchContext must be used within a SearchProvider");
|
|
590
610
|
return e;
|
|
591
|
-
},
|
|
592
|
-
let { state: { query: o, filters: s, rangeFilters: c, searchSettings: l }, setQuery: u } =
|
|
611
|
+
}, L = ({ className: e = "", autoFocus: t = !1, inputSize: n = "default", showClear: r = !0, showFocus: i = !1, ...a }) => {
|
|
612
|
+
let { state: { query: o, filters: s, rangeFilters: c, searchSettings: l }, setQuery: u } = I();
|
|
593
613
|
Object.keys(s).length > 0 || Object.keys(c).length;
|
|
594
614
|
let d = o.length > 0;
|
|
595
615
|
return /* @__PURE__ */ f(y, {
|
|
@@ -611,10 +631,10 @@ var N = n(void 0), P = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
611
631
|
children: "Clear"
|
|
612
632
|
})
|
|
613
633
|
});
|
|
614
|
-
},
|
|
634
|
+
}, R = {
|
|
615
635
|
placeholder: "_placeholder_ee9qi_1",
|
|
616
636
|
invalid: "_invalid_ee9qi_11"
|
|
617
|
-
},
|
|
637
|
+
}, z = {
|
|
618
638
|
row: "_row_1i201_1",
|
|
619
639
|
content: "_content_1i201_19",
|
|
620
640
|
indexNumber: "_indexNumber_1i201_31",
|
|
@@ -623,25 +643,25 @@ var N = n(void 0), P = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
623
643
|
skeletonBarLg: "_skeletonBarLg_1i201_59",
|
|
624
644
|
fade: "_fade_1i201_1",
|
|
625
645
|
skeletonBarSm: "_skeletonBarSm_1i201_66"
|
|
626
|
-
},
|
|
627
|
-
className:
|
|
646
|
+
}, B = ({ skeleton: e = !1, index: t, score: n, showScore: r = !1, children: i, skeletonDelay: a = 0, skeletonWidths: o = [62, 38] }) => /* @__PURE__ */ p("div", {
|
|
647
|
+
className: z.row,
|
|
628
648
|
children: [
|
|
629
649
|
t !== void 0 && /* @__PURE__ */ f("div", {
|
|
630
|
-
className:
|
|
650
|
+
className: z.indexNumber,
|
|
631
651
|
children: t
|
|
632
652
|
}),
|
|
633
653
|
/* @__PURE__ */ f("div", {
|
|
634
|
-
className:
|
|
654
|
+
className: z.content,
|
|
635
655
|
children: e ? /* @__PURE__ */ p("div", {
|
|
636
|
-
className:
|
|
656
|
+
className: z.skeletonBars,
|
|
637
657
|
children: [/* @__PURE__ */ f("div", {
|
|
638
|
-
className:
|
|
658
|
+
className: z.skeletonBarLg,
|
|
639
659
|
style: {
|
|
640
660
|
width: `${o[0]}%`,
|
|
641
661
|
animationDelay: `${a}s`
|
|
642
662
|
}
|
|
643
663
|
}), /* @__PURE__ */ f("div", {
|
|
644
|
-
className:
|
|
664
|
+
className: z.skeletonBarSm,
|
|
645
665
|
style: {
|
|
646
666
|
width: `${o[1]}%`,
|
|
647
667
|
animationDelay: `${a + .05}s`
|
|
@@ -650,14 +670,14 @@ var N = n(void 0), P = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
650
670
|
}) : i
|
|
651
671
|
}),
|
|
652
672
|
r && n !== void 0 && /* @__PURE__ */ f("div", {
|
|
653
|
-
className:
|
|
673
|
+
className: z.scoreNumber,
|
|
654
674
|
children: n
|
|
655
675
|
})
|
|
656
676
|
]
|
|
657
|
-
}),
|
|
677
|
+
}), V = {
|
|
658
678
|
wrapper: "_wrapper_81m3c_6",
|
|
659
679
|
skeletonAppear: "_skeletonAppear_81m3c_1"
|
|
660
|
-
},
|
|
680
|
+
}, H = [
|
|
661
681
|
[62, 38],
|
|
662
682
|
[75, 45],
|
|
663
683
|
[58, 33],
|
|
@@ -666,28 +686,28 @@ var N = n(void 0), P = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
666
686
|
[55, 35],
|
|
667
687
|
[72, 40],
|
|
668
688
|
[60, 30]
|
|
669
|
-
],
|
|
670
|
-
className:
|
|
671
|
-
children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ f(
|
|
689
|
+
], U = ({ rows: e = 6 }) => /* @__PURE__ */ f("div", {
|
|
690
|
+
className: V.wrapper,
|
|
691
|
+
children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ f(B, {
|
|
672
692
|
skeleton: !0,
|
|
673
693
|
skeletonDelay: t * .1,
|
|
674
|
-
skeletonWidths:
|
|
694
|
+
skeletonWidths: H[t % H.length]
|
|
675
695
|
}, t))
|
|
676
|
-
}),
|
|
677
|
-
function
|
|
696
|
+
}), W = /^\[\s*(?:'[^']*'(?:\s*,\s*'[^']*')*)?\s*\]$/;
|
|
697
|
+
function G(e) {
|
|
678
698
|
let t = e.trim();
|
|
679
699
|
if (!t.startsWith("[") || !t.endsWith("]")) return;
|
|
680
700
|
try {
|
|
681
701
|
let e = JSON.parse(t);
|
|
682
702
|
if (Array.isArray(e)) return e.map((e) => String(e));
|
|
683
703
|
} catch {}
|
|
684
|
-
if (!
|
|
704
|
+
if (!W.test(t)) return;
|
|
685
705
|
let n = [], r = /'([^']*)'/g, i;
|
|
686
706
|
for (; (i = r.exec(t)) !== null;) n.push(i[1]);
|
|
687
707
|
return n;
|
|
688
708
|
}
|
|
689
|
-
var
|
|
690
|
-
let { state: { results: i, resultsSuppressed: a, searchSettings: s, truncationIndex: u, query: h, error: g }, isFetchingInitial: _, authError: v, allowEmptySearch: y, fetchMoreResults: b } =
|
|
709
|
+
var K = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r }) => {
|
|
710
|
+
let { state: { results: i, resultsSuppressed: a, searchSettings: s, truncationIndex: u, query: h, error: g }, isFetchingInitial: _, authError: v, allowEmptySearch: y, fetchMoreResults: b } = I(), x = t ?? 30, [S, C] = l(x), w = c(0), E = c("");
|
|
691
711
|
o(() => {
|
|
692
712
|
let e = h !== E.current;
|
|
693
713
|
(!i || i.length < w.current || e) && C(x), w.current = i?.length ?? 0, E.current = h;
|
|
@@ -700,8 +720,8 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
700
720
|
let e = S + x;
|
|
701
721
|
C(e), i && e >= i.length && (!u || u === -1 || u > i.length) && b(i.length + x);
|
|
702
722
|
};
|
|
703
|
-
if (_) return y ? /* @__PURE__ */ f(
|
|
704
|
-
className:
|
|
723
|
+
if (_) return y ? /* @__PURE__ */ f(U, { rows: x }) : /* @__PURE__ */ f("div", {
|
|
724
|
+
className: R.placeholder,
|
|
705
725
|
children: /* @__PURE__ */ f(T, {
|
|
706
726
|
size: 200,
|
|
707
727
|
color: "var(--lv5)"
|
|
@@ -709,17 +729,17 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
709
729
|
});
|
|
710
730
|
let k = v ?? g;
|
|
711
731
|
return k ? /* @__PURE__ */ f("div", {
|
|
712
|
-
className:
|
|
732
|
+
className: R.invalid,
|
|
713
733
|
role: "alert",
|
|
714
734
|
children: /* @__PURE__ */ f("p", { children: k })
|
|
715
735
|
}) : a || i === null ? /* @__PURE__ */ f("div", {
|
|
716
|
-
className:
|
|
736
|
+
className: R.placeholder,
|
|
717
737
|
children: /* @__PURE__ */ f(T, {
|
|
718
738
|
size: 200,
|
|
719
739
|
color: "var(--lv5)"
|
|
720
740
|
})
|
|
721
741
|
}) : i.length === 0 ? /* @__PURE__ */ f("div", {
|
|
722
|
-
className:
|
|
742
|
+
className: R.invalid,
|
|
723
743
|
children: /* @__PURE__ */ f("p", { children: "No results found." })
|
|
724
744
|
}) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", { children: (i ?? []).slice(0, S).map((t, i) => {
|
|
725
745
|
let a = t.document, o = t.score, c;
|
|
@@ -727,7 +747,7 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
727
747
|
c = typeof a == "string" ? JSON.parse(a) : a;
|
|
728
748
|
} catch {
|
|
729
749
|
return /* @__PURE__ */ f("div", {
|
|
730
|
-
className:
|
|
750
|
+
className: R.invalid,
|
|
731
751
|
children: /* @__PURE__ */ f("p", { children: "Invalid JSON" })
|
|
732
752
|
}, i);
|
|
733
753
|
}
|
|
@@ -739,11 +759,11 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
739
759
|
if (n) for (let e in l) {
|
|
740
760
|
let t = l[e];
|
|
741
761
|
if (typeof t == "string") {
|
|
742
|
-
let n =
|
|
762
|
+
let n = G(t);
|
|
743
763
|
n && (l[e] = n);
|
|
744
764
|
}
|
|
745
765
|
}
|
|
746
|
-
return /* @__PURE__ */ f(
|
|
766
|
+
return /* @__PURE__ */ f(B, {
|
|
747
767
|
index: i,
|
|
748
768
|
score: o,
|
|
749
769
|
showScore: s.showScore,
|
|
@@ -761,13 +781,13 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
761
781
|
children: h.trim() === "" ? "Load more" : u !== -1 && u !== void 0 && u > 0 ? `Load results ${S + 1}-${Math.min(S + x, i.length, u)} of ${u}` : "Load more"
|
|
762
782
|
})
|
|
763
783
|
})] });
|
|
764
|
-
},
|
|
784
|
+
}, q = {
|
|
765
785
|
row: "_row_ujwhc_1",
|
|
766
786
|
title: "_title_ujwhc_8"
|
|
767
|
-
},
|
|
768
|
-
className: [
|
|
787
|
+
}, ee = ({ variant: e = "default", children: t }) => /* @__PURE__ */ f("div", {
|
|
788
|
+
className: [q.row, e === "title" ? q.title : ""].filter(Boolean).join(" "),
|
|
769
789
|
children: t
|
|
770
|
-
}),
|
|
790
|
+
}), J = {
|
|
771
791
|
bar: "_bar_145f5_12",
|
|
772
792
|
skeletonAppear: "_skeletonAppear_145f5_1",
|
|
773
793
|
fade: "_fade_145f5_1",
|
|
@@ -776,7 +796,7 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
776
796
|
sliderTrack: "_sliderTrack_145f5_32",
|
|
777
797
|
inputRow: "_inputRow_145f5_40",
|
|
778
798
|
inputBar: "_inputBar_145f5_45"
|
|
779
|
-
},
|
|
799
|
+
}, te = [
|
|
780
800
|
65,
|
|
781
801
|
80,
|
|
782
802
|
55,
|
|
@@ -785,41 +805,41 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
785
805
|
75,
|
|
786
806
|
50,
|
|
787
807
|
68
|
|
788
|
-
],
|
|
808
|
+
], ne = ({ title: e, rows: t = 5, variant: n = "list", collapsible: r = !0, startCollapsed: i = !1 }) => /* @__PURE__ */ f(g, {
|
|
789
809
|
title: e,
|
|
790
810
|
collapsible: r,
|
|
791
811
|
collapsed: i,
|
|
792
812
|
children: n === "slider" ? /* @__PURE__ */ p("div", {
|
|
793
|
-
className:
|
|
794
|
-
children: [/* @__PURE__ */ f("div", { className:
|
|
795
|
-
className:
|
|
813
|
+
className: J.sliderArea,
|
|
814
|
+
children: [/* @__PURE__ */ f("div", { className: J.sliderTrack }), /* @__PURE__ */ p("div", {
|
|
815
|
+
className: J.inputRow,
|
|
796
816
|
children: [/* @__PURE__ */ f("div", {
|
|
797
|
-
className:
|
|
817
|
+
className: J.inputBar,
|
|
798
818
|
style: { animationDelay: "0.1s" }
|
|
799
819
|
}), /* @__PURE__ */ f("div", {
|
|
800
|
-
className:
|
|
820
|
+
className: J.inputBar,
|
|
801
821
|
style: { animationDelay: "0.15s" }
|
|
802
822
|
})]
|
|
803
823
|
})]
|
|
804
824
|
}) : /* @__PURE__ */ f("div", {
|
|
805
|
-
className:
|
|
825
|
+
className: J.listRows,
|
|
806
826
|
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ f("div", {
|
|
807
|
-
className:
|
|
827
|
+
className: J.bar,
|
|
808
828
|
style: {
|
|
809
|
-
width: `${
|
|
829
|
+
width: `${te[t % te.length]}%`,
|
|
810
830
|
animationDelay: `${t * .05}s`
|
|
811
831
|
}
|
|
812
832
|
}, t))
|
|
813
833
|
})
|
|
814
|
-
}),
|
|
834
|
+
}), Y = {
|
|
815
835
|
list: "_list_m82u6_2",
|
|
816
836
|
count: "_count_m82u6_7",
|
|
817
837
|
countValue: "_countValue_m82u6_17",
|
|
818
838
|
chip: "_chip_m82u6_22",
|
|
819
839
|
chipLabel: "_chipLabel_m82u6_32",
|
|
820
840
|
grid: "_grid_m82u6_40"
|
|
821
|
-
},
|
|
822
|
-
let { state: { facets: T, filterableFields: E, facetableFields: D, filters: O, query: k }, toggleFilter: A, setValueMatch: j, isFetchingInitial: M, allowEmptySearch: N } =
|
|
841
|
+
}, X = ({ field: e, label: t, preserveBlankFacetState: n = !1, preserveBlankFacetStateOrder: r = !1, sortFacetsBy: i = "histogram", limit: a = 10, collapsible: s = !0, startCollapsed: u = !1, displayType: d = "checkbox", layout: _ = "list", showActivePanel: v = !1, showCount: y = !0, showNull: b = !1, match: x = "all", displayIfEmptyQuery: C = !0, displayCondition: w = (e) => !0 }) => {
|
|
842
|
+
let { state: { facets: T, filterableFields: E, facetableFields: D, filters: O, query: k }, toggleFilter: A, setValueMatch: j, isFetchingInitial: M, allowEmptySearch: N } = I();
|
|
823
843
|
o(() => {
|
|
824
844
|
j(e, x);
|
|
825
845
|
}, [
|
|
@@ -827,14 +847,14 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
827
847
|
x,
|
|
828
848
|
j
|
|
829
849
|
]);
|
|
830
|
-
let P = c(null), [
|
|
850
|
+
let P = c(null), [F, L] = l(a);
|
|
831
851
|
if (o(() => {
|
|
832
852
|
L(a);
|
|
833
853
|
}, [T?.[e], a]), !N && !k) return null;
|
|
834
|
-
if (M || !T) return d === "toggle" ? /* @__PURE__ */ f(
|
|
854
|
+
if (M || !T) return d === "toggle" ? /* @__PURE__ */ f(ne, {
|
|
835
855
|
rows: 1,
|
|
836
856
|
collapsible: !1
|
|
837
|
-
}) : /* @__PURE__ */ f(
|
|
857
|
+
}) : /* @__PURE__ */ f(ne, {
|
|
838
858
|
title: t,
|
|
839
859
|
rows: Math.min(a, 6),
|
|
840
860
|
collapsible: s,
|
|
@@ -878,15 +898,15 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
878
898
|
"true",
|
|
879
899
|
"false",
|
|
880
900
|
"null"
|
|
881
|
-
]), H = Array.from(B.keys()),
|
|
882
|
-
if (
|
|
901
|
+
]), H = Array.from(B.keys()), U = d === "toggle" && (H.length > 0 && H.every((e) => V.has(e)) || H.length === 0 && z.length > 0);
|
|
902
|
+
if (U && B.has("null")) {
|
|
883
903
|
let e = B.get("null") ?? 0, t = B.get("false") ?? 0;
|
|
884
904
|
B.set("false", t + e), B.delete("null");
|
|
885
905
|
}
|
|
886
|
-
if (d === "toggle" && !
|
|
906
|
+
if (d === "toggle" && !U) return /* @__PURE__ */ f(g, {
|
|
887
907
|
collapsible: !1,
|
|
888
908
|
children: /* @__PURE__ */ f("div", {
|
|
889
|
-
className:
|
|
909
|
+
className: Y.count,
|
|
890
910
|
children: /* @__PURE__ */ f(S, {
|
|
891
911
|
label: t,
|
|
892
912
|
checked: !1,
|
|
@@ -895,12 +915,12 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
895
915
|
})
|
|
896
916
|
})
|
|
897
917
|
});
|
|
898
|
-
if (
|
|
918
|
+
if (U) {
|
|
899
919
|
let n = B.get("true"), r = typeof n == "number" ? n : null, i = z.includes("true"), a = r === 0 && !i, o = y && (r ?? 0) > 0 ? `${r}` : "";
|
|
900
920
|
return /* @__PURE__ */ f(g, {
|
|
901
921
|
collapsible: !1,
|
|
902
922
|
children: /* @__PURE__ */ p("div", {
|
|
903
|
-
className:
|
|
923
|
+
className: Y.count,
|
|
904
924
|
children: [
|
|
905
925
|
/* @__PURE__ */ f(S, {
|
|
906
926
|
label: t,
|
|
@@ -914,39 +934,39 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
914
934
|
})
|
|
915
935
|
});
|
|
916
936
|
}
|
|
917
|
-
let
|
|
918
|
-
if (b || (
|
|
937
|
+
let W = Array.from(B.entries());
|
|
938
|
+
if (b || (W = W.filter(([e]) => e !== "null")), W.length === 0 && !n) return null;
|
|
919
939
|
if (!r) if (i === "alphabetical") {
|
|
920
|
-
let e =
|
|
921
|
-
|
|
940
|
+
let e = W.filter(([, e]) => typeof e == "number" && e > 0).sort(([e], [t]) => e.localeCompare(t)), t = W.filter(([, e]) => e === 0 || e === null).sort(([e], [t]) => e.localeCompare(t));
|
|
941
|
+
W = [...e, ...t];
|
|
922
942
|
} else if (i === "numeric") {
|
|
923
943
|
let e = (e, t) => {
|
|
924
944
|
let n = Number(e), r = Number(t);
|
|
925
945
|
return !isNaN(n) && !isNaN(r) ? n - r : e.localeCompare(t);
|
|
926
|
-
}, t =
|
|
927
|
-
|
|
946
|
+
}, t = W.filter(([, e]) => typeof e == "number" && e > 0).sort(([t], [n]) => e(t, n)), n = W.filter(([, e]) => e === 0 || e === null).sort(([t], [n]) => e(t, n));
|
|
947
|
+
W = [...t, ...n];
|
|
928
948
|
} else {
|
|
929
|
-
let e =
|
|
930
|
-
|
|
949
|
+
let e = W.filter(([, e]) => typeof e == "number" && e > 0), t = W.filter(([, e]) => e === 0 || e === null);
|
|
950
|
+
W = [...e, ...t];
|
|
931
951
|
}
|
|
932
|
-
let
|
|
952
|
+
let G = typeof a == "number" && W.length > a, K = G ? W.slice(0, F) : W, q = (t, n) => {
|
|
933
953
|
let r = z.includes(t), i = n === 0, a = y && (n ?? 0) > 0 ? ` (${n})` : "", o = y && (n ?? 0) > 0 ? n : "";
|
|
934
954
|
switch (d) {
|
|
935
955
|
case "button": return _ === "list" ? /* @__PURE__ */ p("div", {
|
|
936
|
-
className:
|
|
956
|
+
className: Y.count,
|
|
937
957
|
children: [/* @__PURE__ */ f(m, {
|
|
938
958
|
variant: r ? "primary" : "secondary",
|
|
939
959
|
onClick: () => A(e, t),
|
|
940
960
|
disabled: i,
|
|
941
961
|
size: "micro",
|
|
942
|
-
className:
|
|
962
|
+
className: Y.chip,
|
|
943
963
|
title: t,
|
|
944
964
|
children: /* @__PURE__ */ f("span", {
|
|
945
|
-
className:
|
|
965
|
+
className: Y.chipLabel,
|
|
946
966
|
children: t
|
|
947
967
|
})
|
|
948
968
|
}), /* @__PURE__ */ f("span", {
|
|
949
|
-
className:
|
|
969
|
+
className: Y.countValue,
|
|
950
970
|
children: o
|
|
951
971
|
})]
|
|
952
972
|
}) : /* @__PURE__ */ f(m, {
|
|
@@ -954,10 +974,10 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
954
974
|
onClick: () => A(e, t),
|
|
955
975
|
disabled: i,
|
|
956
976
|
size: "micro",
|
|
957
|
-
className:
|
|
977
|
+
className: Y.chip,
|
|
958
978
|
title: `${t}${a}`,
|
|
959
979
|
children: /* @__PURE__ */ f("span", {
|
|
960
|
-
className:
|
|
980
|
+
className: Y.chipLabel,
|
|
961
981
|
children: `${t}${a}`
|
|
962
982
|
})
|
|
963
983
|
});
|
|
@@ -968,7 +988,7 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
968
988
|
disabled: i
|
|
969
989
|
});
|
|
970
990
|
default: return _ === "list" ? /* @__PURE__ */ p("div", {
|
|
971
|
-
className:
|
|
991
|
+
className: Y.count,
|
|
972
992
|
children: [/* @__PURE__ */ f(h, {
|
|
973
993
|
label: t,
|
|
974
994
|
score: "",
|
|
@@ -990,50 +1010,50 @@ var W = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
990
1010
|
collapsible: s,
|
|
991
1011
|
collapsed: s ? u : !1,
|
|
992
1012
|
children: /* @__PURE__ */ p("ul", {
|
|
993
|
-
className: _ === "grid" ?
|
|
1013
|
+
className: _ === "grid" ? Y.grid : Y.list,
|
|
994
1014
|
style: {
|
|
995
1015
|
listStyle: "none",
|
|
996
1016
|
padding: 0,
|
|
997
1017
|
margin: 0
|
|
998
1018
|
},
|
|
999
|
-
children: [
|
|
1000
|
-
let e =
|
|
1019
|
+
children: [K.map(([e, t]) => /* @__PURE__ */ f("li", { children: q(e, t) }, e)), G && F < W.length && (() => {
|
|
1020
|
+
let e = W.length - F, t = Math.min(50, e);
|
|
1001
1021
|
return /* @__PURE__ */ f("li", {
|
|
1002
|
-
className:
|
|
1022
|
+
className: Y.toggleItem,
|
|
1003
1023
|
children: /* @__PURE__ */ f(m, {
|
|
1004
1024
|
variant: "ghost",
|
|
1005
1025
|
size: "micro",
|
|
1006
1026
|
onClick: () => L((e) => e + 50),
|
|
1007
|
-
children: `Show ${t} more of ${
|
|
1027
|
+
children: `Show ${t} more of ${W.length} total`
|
|
1008
1028
|
})
|
|
1009
1029
|
});
|
|
1010
1030
|
})()]
|
|
1011
1031
|
})
|
|
1012
1032
|
});
|
|
1013
|
-
},
|
|
1033
|
+
}, re = {
|
|
1014
1034
|
disabledMessage: "_disabledMessage_uci6n_1",
|
|
1015
1035
|
histogram: "_histogram_uci6n_6",
|
|
1016
1036
|
histogramBar: "_histogramBar_uci6n_15"
|
|
1017
1037
|
};
|
|
1018
1038
|
//#endregion
|
|
1019
1039
|
//#region src/components/RangeFilterPanel.tsx
|
|
1020
|
-
function
|
|
1040
|
+
function ie(e) {
|
|
1021
1041
|
if (!Number.isFinite(e)) return 0;
|
|
1022
1042
|
let t = String(e), n = t.indexOf(".");
|
|
1023
1043
|
return n === -1 ? 0 : Math.min(6, t.length - n - 1);
|
|
1024
1044
|
}
|
|
1025
|
-
function
|
|
1045
|
+
function ae(e, t, n) {
|
|
1026
1046
|
let r = t + Math.round((e - t) / n) * n;
|
|
1027
|
-
return Number(r.toFixed(
|
|
1047
|
+
return Number(r.toFixed(ie(n)));
|
|
1028
1048
|
}
|
|
1029
|
-
var
|
|
1030
|
-
let { state: { rangeFilters: d, rangeBounds: m, facetStats: h, facets: v, filterableFields: y, facetableFields: b, query: S, facetDebounceDelayMillis: C }, setRangeFilter: w, resetRangeFilter: T, allowEmptySearch: E, isFetchingInitial: D } =
|
|
1049
|
+
var oe = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, displayType: a = "input", collapsible: o = !0, startCollapsed: s = !1, showHistogram: c = !1, resolution: l, step: u }) => {
|
|
1050
|
+
let { state: { rangeFilters: d, rangeBounds: m, facetStats: h, facets: v, filterableFields: y, facetableFields: b, query: S, facetDebounceDelayMillis: C }, setRangeFilter: w, resetRangeFilter: T, allowEmptySearch: E, isFetchingInitial: D } = I(), O = m?.[t] !== void 0, k = m?.[t] ?? {
|
|
1031
1051
|
min: r,
|
|
1032
1052
|
max: i
|
|
1033
|
-
}, A = k.min, j = k.max, M = h?.[t] ?? k, N = Math.max(A, Math.min(j, M.min)), P = Math.max(A, Math.min(j, M.max)),
|
|
1053
|
+
}, A = k.min, j = k.max, M = h?.[t] ?? k, N = Math.max(A, Math.min(j, M.min)), P = Math.max(A, Math.min(j, M.max)), F = e.useMemo(() => {
|
|
1034
1054
|
if (u) return u;
|
|
1035
|
-
let e = Math.max(
|
|
1036
|
-
if (Array.isArray(n)) for (let t of n) e = Math.max(e,
|
|
1055
|
+
let e = Math.max(ie(A), ie(j)), n = v?.[t];
|
|
1056
|
+
if (Array.isArray(n)) for (let t of n) e = Math.max(e, ie(Number(t.key)));
|
|
1037
1057
|
return e === 0 ? 1 : Number((10 ** -e).toFixed(e));
|
|
1038
1058
|
}, [
|
|
1039
1059
|
u,
|
|
@@ -1041,12 +1061,12 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1041
1061
|
j,
|
|
1042
1062
|
v,
|
|
1043
1063
|
t
|
|
1044
|
-
]), L = O && A === j, R = L ? r : A, z = L ? i : j, B = d?.[t], V = B ? B.min : A, H = B ? B.max : j,
|
|
1064
|
+
]), L = O && A === j, R = L ? r : A, z = L ? i : j, B = d?.[t], V = B ? B.min : A, H = B ? B.max : j, U = B !== void 0, W = N !== A || P !== j, [G, K] = e.useState([V, H]), [q, ee] = e.useState(!1), [J, te] = e.useState(!1), [Y, X] = e.useState(String(V)), [oe, Z] = e.useState(String(H));
|
|
1045
1065
|
e.useEffect(() => {
|
|
1046
|
-
|
|
1047
|
-
}, [
|
|
1066
|
+
X(String(G[0])), Z(String(G[1]));
|
|
1067
|
+
}, [G]);
|
|
1048
1068
|
let { finalMin: Q, finalMax: $, isValidMin: se, isValidMax: ce } = e.useMemo(() => {
|
|
1049
|
-
let [e, t] =
|
|
1069
|
+
let [e, t] = G, n = Math.max(A, Math.min(j, e)), r = Math.max(A, Math.min(j, t)), i = Math.min(n, r), a = Math.max(n, r);
|
|
1050
1070
|
return {
|
|
1051
1071
|
finalMin: i,
|
|
1052
1072
|
finalMax: a,
|
|
@@ -1054,18 +1074,18 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1054
1074
|
isValidMax: a <= j && a > i
|
|
1055
1075
|
};
|
|
1056
1076
|
}, [
|
|
1057
|
-
|
|
1077
|
+
G,
|
|
1058
1078
|
A,
|
|
1059
1079
|
j
|
|
1060
1080
|
]);
|
|
1061
1081
|
e.useEffect(() => {
|
|
1062
1082
|
if (L) return;
|
|
1063
|
-
if (
|
|
1064
|
-
|
|
1083
|
+
if (G[0] === A && G[1] === j) {
|
|
1084
|
+
ee(!1), te(!1);
|
|
1065
1085
|
return;
|
|
1066
1086
|
}
|
|
1067
1087
|
let e = C ?? 500, n = setTimeout(() => {
|
|
1068
|
-
|
|
1088
|
+
ee(!se), te(!ce);
|
|
1069
1089
|
}, 300), r = setTimeout(() => {
|
|
1070
1090
|
se && ce && (Q === A && $ === j ? T(t, !1) : w(t, Q, $));
|
|
1071
1091
|
}, e);
|
|
@@ -1085,14 +1105,14 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1085
1105
|
C,
|
|
1086
1106
|
L
|
|
1087
1107
|
]), e.useEffect(() => {
|
|
1088
|
-
|
|
1108
|
+
K([V, H]), ee(!1), te(!1);
|
|
1089
1109
|
}, [
|
|
1090
1110
|
V,
|
|
1091
1111
|
H,
|
|
1092
1112
|
t
|
|
1093
1113
|
]);
|
|
1094
1114
|
let le = e.useCallback((e) => {
|
|
1095
|
-
L ||
|
|
1115
|
+
L || K([Math.max(A, Math.min(P, e[0])), Math.max(N, Math.min(j, e[1]))]);
|
|
1096
1116
|
}, [
|
|
1097
1117
|
L,
|
|
1098
1118
|
A,
|
|
@@ -1102,7 +1122,7 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1102
1122
|
]), ue = e.useCallback((e) => {
|
|
1103
1123
|
if (L) return;
|
|
1104
1124
|
let n = Math.max(A, Math.min(P, e[0])), r = Math.max(N, Math.min(j, e[1]));
|
|
1105
|
-
n === A && r === j ? (
|
|
1125
|
+
n === A && r === j ? (K([A, j]), T(t, !0)) : K([n, r]);
|
|
1106
1126
|
}, [
|
|
1107
1127
|
L,
|
|
1108
1128
|
A,
|
|
@@ -1113,32 +1133,32 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1113
1133
|
T
|
|
1114
1134
|
]), de = e.useCallback(() => {
|
|
1115
1135
|
if (L) return;
|
|
1116
|
-
let e =
|
|
1136
|
+
let e = Y.trim(), t = e === "" ? NaN : Number(e);
|
|
1117
1137
|
if (isNaN(t)) {
|
|
1118
|
-
|
|
1138
|
+
X(String(G[0]));
|
|
1119
1139
|
return;
|
|
1120
1140
|
}
|
|
1121
1141
|
let n = Math.max(A, Math.min(P, t));
|
|
1122
|
-
n <
|
|
1142
|
+
n < G[1] ? K([n, G[1]]) : K([A, G[1]]), X(String(n < G[1] ? n : A));
|
|
1123
1143
|
}, [
|
|
1124
1144
|
L,
|
|
1125
|
-
|
|
1126
|
-
|
|
1145
|
+
Y,
|
|
1146
|
+
G,
|
|
1127
1147
|
A,
|
|
1128
1148
|
P
|
|
1129
1149
|
]), fe = e.useCallback(() => {
|
|
1130
1150
|
if (L) return;
|
|
1131
|
-
let e =
|
|
1151
|
+
let e = oe.trim(), t = e === "" ? NaN : Number(e);
|
|
1132
1152
|
if (isNaN(t)) {
|
|
1133
|
-
Z(String(
|
|
1153
|
+
Z(String(G[1]));
|
|
1134
1154
|
return;
|
|
1135
1155
|
}
|
|
1136
1156
|
let n = Math.max(N, Math.min(j, t));
|
|
1137
|
-
n >
|
|
1157
|
+
n > G[0] ? K([G[0], n]) : K([G[0], j]), Z(String(n > G[0] ? n : j));
|
|
1138
1158
|
}, [
|
|
1139
1159
|
L,
|
|
1140
|
-
|
|
1141
|
-
|
|
1160
|
+
oe,
|
|
1161
|
+
G,
|
|
1142
1162
|
N,
|
|
1143
1163
|
j
|
|
1144
1164
|
]), pe = (e) => (t) => {
|
|
@@ -1185,7 +1205,7 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1185
1205
|
j,
|
|
1186
1206
|
l
|
|
1187
1207
|
]), ve = e.useMemo(() => Math.max(..._e.map((e) => e.count), 1), [_e]);
|
|
1188
|
-
return c && !D && !b?.includes(t) && console.warn(`RangeFilterPanel: showHistogram=true but field "${t}" is not facetable. Add .Facetable = true to this field.`), D ? /* @__PURE__ */ f(
|
|
1208
|
+
return c && !D && !b?.includes(t) && console.warn(`RangeFilterPanel: showHistogram=true but field "${t}" is not facetable. Add .Facetable = true to this field.`), D ? /* @__PURE__ */ f(ne, {
|
|
1189
1209
|
title: n,
|
|
1190
1210
|
variant: "slider",
|
|
1191
1211
|
collapsible: o,
|
|
@@ -1196,7 +1216,7 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1196
1216
|
collapsible: o,
|
|
1197
1217
|
children: [
|
|
1198
1218
|
L && /* @__PURE__ */ p("div", {
|
|
1199
|
-
className:
|
|
1219
|
+
className: re.disabledMessage,
|
|
1200
1220
|
children: [
|
|
1201
1221
|
"No adjustable range (all results have the same value: ",
|
|
1202
1222
|
A,
|
|
@@ -1204,13 +1224,13 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1204
1224
|
]
|
|
1205
1225
|
}),
|
|
1206
1226
|
c && _e.length > 0 && /* @__PURE__ */ f("div", {
|
|
1207
|
-
className:
|
|
1227
|
+
className: re.histogram,
|
|
1208
1228
|
children: (() => {
|
|
1209
1229
|
let e = typeof N == "number" && typeof P == "number" && P > N && (N > A || P < j);
|
|
1210
1230
|
return _e.map((t, n) => {
|
|
1211
1231
|
let r = Math.max(1, Math.ceil(t.count / ve * 20)), i = e ? t.bucketEnd > N && t.bucketStart < P : t.bucketEnd > Q && t.bucketStart < $;
|
|
1212
1232
|
return /* @__PURE__ */ f("div", {
|
|
1213
|
-
className:
|
|
1233
|
+
className: re.histogramBar,
|
|
1214
1234
|
"data-testid": "histogram-bar",
|
|
1215
1235
|
"data-active": i,
|
|
1216
1236
|
style: {
|
|
@@ -1226,16 +1246,16 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1226
1246
|
children: /* @__PURE__ */ f(x, {
|
|
1227
1247
|
min: R,
|
|
1228
1248
|
max: z,
|
|
1229
|
-
step:
|
|
1230
|
-
value: L ? [R, z] : [
|
|
1249
|
+
step: F,
|
|
1250
|
+
value: L ? [R, z] : [ae(Q, R, F), ae($, R, F)],
|
|
1231
1251
|
isRange: !0,
|
|
1232
1252
|
onChange: (e) => le(e),
|
|
1233
1253
|
onFinalChange: (e) => ue(e),
|
|
1234
1254
|
disabled: L,
|
|
1235
1255
|
activeMin: N,
|
|
1236
1256
|
activeMax: P,
|
|
1237
|
-
isFaceted:
|
|
1238
|
-
highlightFaceted:
|
|
1257
|
+
isFaceted: W,
|
|
1258
|
+
highlightFaceted: U,
|
|
1239
1259
|
"aria-label": n || `Filter by ${t}`
|
|
1240
1260
|
})
|
|
1241
1261
|
}),
|
|
@@ -1250,32 +1270,32 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1250
1270
|
children: [/* @__PURE__ */ f(_, {
|
|
1251
1271
|
label: "Min:",
|
|
1252
1272
|
type: "number",
|
|
1253
|
-
value: L ? String(A) :
|
|
1273
|
+
value: L ? String(A) : Y,
|
|
1254
1274
|
min: A,
|
|
1255
|
-
max: Math.min(P,
|
|
1256
|
-
onChange: (e) =>
|
|
1275
|
+
max: Math.min(P, G[1] - 1),
|
|
1276
|
+
onChange: (e) => X(e.target.value),
|
|
1257
1277
|
onBlur: de,
|
|
1258
1278
|
onKeyDown: pe(de),
|
|
1259
1279
|
disabled: L,
|
|
1260
|
-
isValid: L || !
|
|
1280
|
+
isValid: L || !q
|
|
1261
1281
|
}), /* @__PURE__ */ f(_, {
|
|
1262
1282
|
label: "Max:",
|
|
1263
1283
|
type: "number",
|
|
1264
|
-
value: L ? String(j) :
|
|
1265
|
-
min: Math.max(N,
|
|
1284
|
+
value: L ? String(j) : oe,
|
|
1285
|
+
min: Math.max(N, G[0] + 1),
|
|
1266
1286
|
max: j,
|
|
1267
1287
|
onChange: (e) => Z(e.target.value),
|
|
1268
1288
|
onBlur: fe,
|
|
1269
1289
|
onKeyDown: pe(fe),
|
|
1270
1290
|
disabled: L,
|
|
1271
|
-
isValid: L || !
|
|
1291
|
+
isValid: L || !J
|
|
1272
1292
|
})]
|
|
1273
1293
|
})
|
|
1274
1294
|
]
|
|
1275
1295
|
}) : /* @__PURE__ */ p(g, {
|
|
1276
1296
|
title: n,
|
|
1277
1297
|
children: [L && /* @__PURE__ */ p("div", {
|
|
1278
|
-
className:
|
|
1298
|
+
className: re.disabledMessage,
|
|
1279
1299
|
children: [
|
|
1280
1300
|
"No adjustable range (all results have the same value: ",
|
|
1281
1301
|
A,
|
|
@@ -1290,25 +1310,25 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1290
1310
|
children: [/* @__PURE__ */ f(_, {
|
|
1291
1311
|
label: "Min:",
|
|
1292
1312
|
type: "number",
|
|
1293
|
-
value: L ? String(A) :
|
|
1313
|
+
value: L ? String(A) : Y,
|
|
1294
1314
|
min: A,
|
|
1295
|
-
max: Math.min(P,
|
|
1296
|
-
onChange: (e) =>
|
|
1315
|
+
max: Math.min(P, G[1] - 1),
|
|
1316
|
+
onChange: (e) => X(e.target.value),
|
|
1297
1317
|
onBlur: de,
|
|
1298
1318
|
onKeyDown: pe(de),
|
|
1299
1319
|
disabled: L,
|
|
1300
|
-
isValid: L || !
|
|
1320
|
+
isValid: L || !q
|
|
1301
1321
|
}), /* @__PURE__ */ f(_, {
|
|
1302
1322
|
label: "Max:",
|
|
1303
1323
|
type: "number",
|
|
1304
|
-
value: L ? String(j) :
|
|
1305
|
-
min: Math.max(N,
|
|
1324
|
+
value: L ? String(j) : oe,
|
|
1325
|
+
min: Math.max(N, G[0] + 1),
|
|
1306
1326
|
max: j,
|
|
1307
1327
|
onChange: (e) => Z(e.target.value),
|
|
1308
1328
|
onBlur: fe,
|
|
1309
1329
|
onKeyDown: pe(fe),
|
|
1310
1330
|
disabled: L,
|
|
1311
|
-
isValid: L || !
|
|
1331
|
+
isValid: L || !J
|
|
1312
1332
|
})]
|
|
1313
1333
|
})]
|
|
1314
1334
|
}) : /* @__PURE__ */ f(g, {
|
|
@@ -1325,34 +1345,34 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1325
1345
|
]
|
|
1326
1346
|
})
|
|
1327
1347
|
});
|
|
1328
|
-
},
|
|
1348
|
+
}, Z = {
|
|
1329
1349
|
grid: "_grid_xm2uh_2",
|
|
1330
1350
|
chip: "_chip_xm2uh_17",
|
|
1331
1351
|
chipLabel: "_chipLabel_xm2uh_28"
|
|
1332
|
-
},
|
|
1352
|
+
}, Q = r(({ field: e, value: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(m, {
|
|
1333
1353
|
onClick: n,
|
|
1334
1354
|
iconRight: /* @__PURE__ */ f(E, {}),
|
|
1335
1355
|
variant: "primary",
|
|
1336
1356
|
size: "micro",
|
|
1337
|
-
className:
|
|
1357
|
+
className: Z.chip,
|
|
1338
1358
|
title: `${e}: ${t}`,
|
|
1339
1359
|
children: /* @__PURE__ */ p("span", {
|
|
1340
|
-
className:
|
|
1360
|
+
className: Z.chipLabel,
|
|
1341
1361
|
children: [
|
|
1342
1362
|
e,
|
|
1343
1363
|
": ",
|
|
1344
1364
|
t
|
|
1345
1365
|
]
|
|
1346
1366
|
})
|
|
1347
|
-
}) })),
|
|
1367
|
+
}) })), $ = r(({ field: e, min: t, max: n, onReset: r }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(m, {
|
|
1348
1368
|
onClick: r,
|
|
1349
1369
|
iconRight: /* @__PURE__ */ f(E, {}),
|
|
1350
1370
|
variant: "primary",
|
|
1351
1371
|
size: "micro",
|
|
1352
|
-
className:
|
|
1372
|
+
className: Z.chip,
|
|
1353
1373
|
title: `${e}: ${t} – ${n}`,
|
|
1354
1374
|
children: /* @__PURE__ */ p("span", {
|
|
1355
|
-
className:
|
|
1375
|
+
className: Z.chipLabel,
|
|
1356
1376
|
children: [
|
|
1357
1377
|
e,
|
|
1358
1378
|
": ",
|
|
@@ -1362,8 +1382,8 @@ var Y = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, display
|
|
|
1362
1382
|
]
|
|
1363
1383
|
})
|
|
1364
1384
|
}) }));
|
|
1365
|
-
function
|
|
1366
|
-
let { state: { filters: e, rangeFilters: t }, resetFilters: n, resetSingleFilter: r, resetRangeFilter: i } =
|
|
1385
|
+
function se() {
|
|
1386
|
+
let { state: { filters: e, rangeFilters: t }, resetFilters: n, resetSingleFilter: r, resetRangeFilter: i } = I(), a = s(() => Object.entries(e).map(([e, t]) => t.map((t) => ({
|
|
1367
1387
|
field: e,
|
|
1368
1388
|
value: t
|
|
1369
1389
|
}))).flat(), [e]), o = s(() => Object.entries(t).map(([e, { min: t, max: n }]) => ({
|
|
@@ -1375,14 +1395,14 @@ function $() {
|
|
|
1375
1395
|
collapsible: !1,
|
|
1376
1396
|
title: "Active filters",
|
|
1377
1397
|
children: /* @__PURE__ */ p("ul", {
|
|
1378
|
-
className:
|
|
1398
|
+
className: Z.grid,
|
|
1379
1399
|
children: [
|
|
1380
|
-
a.map(({ field: e, value: t }) => /* @__PURE__ */ f(
|
|
1400
|
+
a.map(({ field: e, value: t }) => /* @__PURE__ */ f(Q, {
|
|
1381
1401
|
field: e,
|
|
1382
1402
|
value: t,
|
|
1383
1403
|
onReset: () => r(e, t)
|
|
1384
1404
|
}, `${e}-${t}`)),
|
|
1385
|
-
o.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ f(
|
|
1405
|
+
o.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ f($, {
|
|
1386
1406
|
field: e,
|
|
1387
1407
|
min: t,
|
|
1388
1408
|
max: n,
|
|
@@ -1398,12 +1418,12 @@ function $() {
|
|
|
1398
1418
|
})
|
|
1399
1419
|
}) : null;
|
|
1400
1420
|
}
|
|
1401
|
-
var
|
|
1421
|
+
var ce = {
|
|
1402
1422
|
select: "_select_nwf7i_1",
|
|
1403
1423
|
radioGroup: "_radioGroup_nwf7i_6"
|
|
1404
|
-
},
|
|
1405
|
-
let { state: { sortableFields: r, sortBy: i, sortAscending: a }, setSort: o, isFetchingInitial: s } =
|
|
1406
|
-
if (s) return /* @__PURE__ */ f(
|
|
1424
|
+
}, le = ({ displayType: e = "dropdown", collapsible: t = !0, startCollapsed: n = !1 }) => {
|
|
1425
|
+
let { state: { sortableFields: r, sortBy: i, sortAscending: a }, setSort: o, isFetchingInitial: s } = I();
|
|
1426
|
+
if (s) return /* @__PURE__ */ f(ne, {
|
|
1407
1427
|
title: "Sort by",
|
|
1408
1428
|
rows: e === "radio" ? 3 : 1,
|
|
1409
1429
|
collapsible: t,
|
|
@@ -1437,7 +1457,7 @@ var se = {
|
|
|
1437
1457
|
placeholder: "Select sort...",
|
|
1438
1458
|
"aria-label": "Sort by"
|
|
1439
1459
|
}) : /* @__PURE__ */ f("div", {
|
|
1440
|
-
className:
|
|
1460
|
+
className: ce.radioGroup,
|
|
1441
1461
|
children: l.map((e) => /* @__PURE__ */ f(v, {
|
|
1442
1462
|
id: `sort-${e.value}`,
|
|
1443
1463
|
name: "sort-by",
|
|
@@ -1448,11 +1468,11 @@ var se = {
|
|
|
1448
1468
|
}, e.value))
|
|
1449
1469
|
})
|
|
1450
1470
|
});
|
|
1451
|
-
},
|
|
1471
|
+
}, ue = { list: "_list_1y4fk_1" };
|
|
1452
1472
|
//#endregion
|
|
1453
1473
|
//#region src/components/SearchSettingsPanel.tsx
|
|
1454
|
-
function
|
|
1455
|
-
let { state: { searchSettings: e }, setSearchSettings: t } =
|
|
1474
|
+
function de() {
|
|
1475
|
+
let { state: { searchSettings: e }, setSearchSettings: t } = I(), [n, r] = l(!1), i = (e, n) => {
|
|
1456
1476
|
let r = parseInt(n, 10);
|
|
1457
1477
|
isNaN(r) || t({ [e]: r });
|
|
1458
1478
|
}, a = (e, n) => {
|
|
@@ -1473,7 +1493,7 @@ function ue() {
|
|
|
1473
1493
|
collapsed: !0,
|
|
1474
1494
|
title: "Settings",
|
|
1475
1495
|
children: /* @__PURE__ */ p("ul", {
|
|
1476
|
-
className:
|
|
1496
|
+
className: ue.list,
|
|
1477
1497
|
children: [
|
|
1478
1498
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(_, {
|
|
1479
1499
|
label: "Max Results",
|
|
@@ -1607,7 +1627,7 @@ function ue() {
|
|
|
1607
1627
|
}
|
|
1608
1628
|
//#endregion
|
|
1609
1629
|
//#region src/components/SearchErrorBoundary.tsx
|
|
1610
|
-
var
|
|
1630
|
+
var fe = class extends t {
|
|
1611
1631
|
constructor(e) {
|
|
1612
1632
|
super(e), this.state = {
|
|
1613
1633
|
hasError: !1,
|
|
@@ -1689,8 +1709,8 @@ var de = class extends t {
|
|
|
1689
1709
|
};
|
|
1690
1710
|
//#endregion
|
|
1691
1711
|
//#region src/hooks/useVectorSearch.ts
|
|
1692
|
-
function
|
|
1693
|
-
let { url: n, team: r, dataset: a, authenticatedFetch: o } =
|
|
1712
|
+
function pe(e, t) {
|
|
1713
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: o } = I(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
1694
1714
|
return {
|
|
1695
1715
|
results: s,
|
|
1696
1716
|
isLoading: u,
|
|
@@ -1709,7 +1729,7 @@ function fe(e, t) {
|
|
|
1709
1729
|
headers: { "Content-Type": "application/json" },
|
|
1710
1730
|
body: JSON.stringify(l)
|
|
1711
1731
|
});
|
|
1712
|
-
if (!u.ok) throw
|
|
1732
|
+
if (!u.ok) throw await O.fromResponse("VectorSearch", u);
|
|
1713
1733
|
let d = await u.json();
|
|
1714
1734
|
if (d.length === 0) {
|
|
1715
1735
|
c([]);
|
|
@@ -1720,7 +1740,7 @@ function fe(e, t) {
|
|
|
1720
1740
|
headers: { "Content-Type": "application/json" },
|
|
1721
1741
|
body: JSON.stringify(f)
|
|
1722
1742
|
});
|
|
1723
|
-
if (!p.ok) throw
|
|
1743
|
+
if (!p.ok) throw await O.fromResponse("GetJson", p);
|
|
1724
1744
|
c((await p.json()).map((e, t) => ({
|
|
1725
1745
|
document: e,
|
|
1726
1746
|
documentKey: f[t],
|
|
@@ -1745,8 +1765,8 @@ function fe(e, t) {
|
|
|
1745
1765
|
}
|
|
1746
1766
|
//#endregion
|
|
1747
1767
|
//#region src/hooks/useHybridSearch.ts
|
|
1748
|
-
function
|
|
1749
|
-
let { url: n, team: r, dataset: a, authenticatedFetch: o } =
|
|
1768
|
+
function me(e, t) {
|
|
1769
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: o } = I(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
1750
1770
|
return {
|
|
1751
1771
|
results: s,
|
|
1752
1772
|
isLoading: u,
|
|
@@ -1767,7 +1787,7 @@ function pe(e, t) {
|
|
|
1767
1787
|
headers: { "Content-Type": "application/json" },
|
|
1768
1788
|
body: JSON.stringify(l)
|
|
1769
1789
|
});
|
|
1770
|
-
if (!u.ok) throw
|
|
1790
|
+
if (!u.ok) throw await O.fromResponse("HybridSearch", u);
|
|
1771
1791
|
let d = await u.json();
|
|
1772
1792
|
if (d.length === 0) {
|
|
1773
1793
|
c([]);
|
|
@@ -1778,7 +1798,7 @@ function pe(e, t) {
|
|
|
1778
1798
|
headers: { "Content-Type": "application/json" },
|
|
1779
1799
|
body: JSON.stringify(f)
|
|
1780
1800
|
});
|
|
1781
|
-
if (!p.ok) throw
|
|
1801
|
+
if (!p.ok) throw await O.fromResponse("GetJson", p);
|
|
1782
1802
|
c((await p.json()).map((e, t) => ({
|
|
1783
1803
|
document: e,
|
|
1784
1804
|
documentKey: f[t],
|
|
@@ -1804,4 +1824,4 @@ function pe(e, t) {
|
|
|
1804
1824
|
};
|
|
1805
1825
|
}
|
|
1806
1826
|
//#endregion
|
|
1807
|
-
export {
|
|
1827
|
+
export { se as ActiveFiltersPanel, ne as FilterPanelSkeleton, O as IndxApiError, oe as RangeFilterPanel, P as SearchContext, fe as SearchErrorBoundary, L as SearchInput, F as SearchProvider, B as SearchResult, ee as SearchResultRow, K as SearchResults, U as SearchResultsSkeleton, de as SearchSettingsPanel, le as SortByPanel, X as ValueFilterPanel, me as useHybridSearch, I as useSearch, I as useSearchContext, pe as useVectorSearch };
|