@museumwnf/viewer-layout 3.91.0 → 3.92.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/dist/globalDatabase-DwTGcqXU.js +262 -0
- package/dist/index.js +2 -1
- package/dist/standalone.js +994 -654
- package/dist/viewer-layout.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
// src/search/globalDatabase.js
|
|
2
|
+
var e = [
|
|
3
|
+
"object",
|
|
4
|
+
"monument",
|
|
5
|
+
"detail"
|
|
6
|
+
], t = Object.freeze({
|
|
7
|
+
keyword: null,
|
|
8
|
+
name: ["name", "names"],
|
|
9
|
+
location: ["location", "country"],
|
|
10
|
+
provenance: ["provenance"],
|
|
11
|
+
dynasty: ["dynasty"],
|
|
12
|
+
patron: ["patron"],
|
|
13
|
+
artist: ["artist"],
|
|
14
|
+
material: ["materials"],
|
|
15
|
+
other: [
|
|
16
|
+
"description",
|
|
17
|
+
"short_description",
|
|
18
|
+
"history",
|
|
19
|
+
"type",
|
|
20
|
+
"holder",
|
|
21
|
+
"dates",
|
|
22
|
+
"production_place",
|
|
23
|
+
"tags"
|
|
24
|
+
]
|
|
25
|
+
}), n = Object.freeze({
|
|
26
|
+
keyword: "catalogue.field.keywords",
|
|
27
|
+
name: "catalogue.field.name",
|
|
28
|
+
location: "catalogue.field.location",
|
|
29
|
+
provenance: "catalogue.field.provenance",
|
|
30
|
+
dynasty: "catalogue.facet.periodDynasty",
|
|
31
|
+
patron: "catalogue.field.patron",
|
|
32
|
+
artist: "catalogue.field.artist",
|
|
33
|
+
material: "catalogue.field.material",
|
|
34
|
+
other: "catalogue.field.other"
|
|
35
|
+
}), r = [
|
|
36
|
+
"keyword",
|
|
37
|
+
"material",
|
|
38
|
+
"type",
|
|
39
|
+
"artist",
|
|
40
|
+
"dynasty",
|
|
41
|
+
"subject",
|
|
42
|
+
"theme"
|
|
43
|
+
], i = 3, a = 1e3, o = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, s = /^[a-z]{3}$/, c = /^[a-z0-9]+(-[a-z0-9]+)*$/, l = /^[a-z]{2}$/, u = /^-?\d{1,6}$/, d = /^[a-z0-9-]{1,40}$/, f = (e) => Array.isArray(e) ? e[0] : e, p = (e) => typeof f(e) == "string" ? f(e) : "", m = (e) => {
|
|
44
|
+
let t = p(e).trim();
|
|
45
|
+
return u.test(t) ? String(Number(t) || 0) : "";
|
|
46
|
+
}, h = (e) => (Array.isArray(e) ? e : typeof e == "string" && e ? e.split(",") : []).filter((e) => typeof e == "string");
|
|
47
|
+
function g(n = {}, { languages: r = [], sites: i, options: a = [] } = {}) {
|
|
48
|
+
let u = [];
|
|
49
|
+
for (let e = 1; e <= 3; e++) {
|
|
50
|
+
let r = e === 1 ? "" : String(e), i = p(n[`in${r}`]);
|
|
51
|
+
u.push({
|
|
52
|
+
q: p(n[`q${r}`]).slice(0, 200),
|
|
53
|
+
field: Object.hasOwn(t, i) ? i : "keyword",
|
|
54
|
+
op: e === 1 ? "AND" : p(n[`op${r}`]) === "OR" ? "OR" : "AND"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
let f = m(n.since), g = m(n.until);
|
|
58
|
+
f && g && Number(f) > Number(g) && ([f, g] = [g, f]);
|
|
59
|
+
let _ = p(n.searchlang), v = p(n.site), y = p(n.type), b = p(n.country), x = p(n.partner), S = p(n.dynasty);
|
|
60
|
+
return {
|
|
61
|
+
rows: u,
|
|
62
|
+
since: f,
|
|
63
|
+
until: g,
|
|
64
|
+
searchlang: l.test(_) && r.includes(_) ? _ : "",
|
|
65
|
+
site: c.test(v) && (!i || i.has(v)) ? v : "",
|
|
66
|
+
type: e.includes(y) ? y : "",
|
|
67
|
+
country: s.test(b) ? b : "",
|
|
68
|
+
partner: o.test(x) ? x : "",
|
|
69
|
+
dynasty: o.test(S) ? S : "",
|
|
70
|
+
tags: [...new Set(h(n.tags).filter((e) => o.test(e)))].slice(0, 10),
|
|
71
|
+
all: p(n.all) === "1",
|
|
72
|
+
options: [...new Set(h(n.opt).filter((e) => d.test(e) && a.includes(e)))]
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function _(e) {
|
|
76
|
+
let t = {};
|
|
77
|
+
e.rows.forEach((e, n) => {
|
|
78
|
+
let r = n === 0 ? "" : String(n + 1);
|
|
79
|
+
e.q && (t[`q${r}`] = e.q, e.field !== "keyword" && (t[`in${r}`] = e.field), n > 0 && e.op === "OR" && (t[`op${r}`] = "OR"));
|
|
80
|
+
});
|
|
81
|
+
for (let n of [
|
|
82
|
+
"since",
|
|
83
|
+
"until",
|
|
84
|
+
"searchlang",
|
|
85
|
+
"site",
|
|
86
|
+
"type",
|
|
87
|
+
"country",
|
|
88
|
+
"partner",
|
|
89
|
+
"dynasty"
|
|
90
|
+
]) e[n] && (t[n] = e[n]);
|
|
91
|
+
return e.tags.length && (t.tags = e.tags.join(",")), e.all && (t.all = "1"), e.options.length && (t.opt = e.options.join(",")), t;
|
|
92
|
+
}
|
|
93
|
+
function v(e) {
|
|
94
|
+
return e.rows.some((e) => e.q) || !!(e.country || e.partner || e.dynasty || e.tags.length || e.since || e.until || e.type || e.site);
|
|
95
|
+
}
|
|
96
|
+
function y(e, t = {}) {
|
|
97
|
+
let n = [];
|
|
98
|
+
if (!e.all && t.site && (n.push(`sites.site = "${t.site}"`), t.subset)) {
|
|
99
|
+
let r = (t.options ?? []).filter((t) => e.options.includes(t.key)).map((e) => e.filter);
|
|
100
|
+
n.push(r.length ? [t.subset, ...r] : t.subset);
|
|
101
|
+
}
|
|
102
|
+
e.searchlang && n.push(`languages = "${e.searchlang}"`), e.site && n.push(`sites.site = "${e.site}"`), e.type && n.push(`type = "${e.type}"`), e.since && n.push(`date_to >= ${e.since}`), e.until && n.push(`start_date <= ${e.until}`), e.country && n.push(`country_id = "${e.country}"`), e.partner && n.push(`partner_id = "${e.partner}"`), e.dynasty && n.push(`dynasty_ids = "${e.dynasty}"`);
|
|
103
|
+
for (let t of e.tags) n.push(`tag_ids = "${t}"`);
|
|
104
|
+
return n;
|
|
105
|
+
}
|
|
106
|
+
function b(e, n) {
|
|
107
|
+
let r = t[e];
|
|
108
|
+
return r ? n.flatMap((e) => r.map((t) => `texts.${e}.${t}`)) : null;
|
|
109
|
+
}
|
|
110
|
+
async function x(e, t, { fetch: n = fetch, signal: r } = {}) {
|
|
111
|
+
let i = await n(`${e}/indexes/items/search`, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
headers: { "Content-Type": "application/json" },
|
|
114
|
+
body: JSON.stringify(t),
|
|
115
|
+
signal: r
|
|
116
|
+
});
|
|
117
|
+
if (!i.ok) throw Error(`search answered ${i.status}`);
|
|
118
|
+
return i.json();
|
|
119
|
+
}
|
|
120
|
+
async function S(e, t, n, { languages: r, locale: i, ...o }) {
|
|
121
|
+
let s = await Promise.all(t.map((t) => {
|
|
122
|
+
let s = b(t.field, r);
|
|
123
|
+
return x(e, {
|
|
124
|
+
q: t.q,
|
|
125
|
+
limit: a,
|
|
126
|
+
matchingStrategy: "all",
|
|
127
|
+
attributesToRetrieve: ["id"],
|
|
128
|
+
showRankingScore: !0,
|
|
129
|
+
filter: n,
|
|
130
|
+
...s ? { attributesToSearchOn: s } : {},
|
|
131
|
+
...i ? { locales: [i] } : {}
|
|
132
|
+
}, o);
|
|
133
|
+
})), c = /* @__PURE__ */ new Map(), l = null;
|
|
134
|
+
return s.forEach((e, n) => {
|
|
135
|
+
let r = /* @__PURE__ */ new Set();
|
|
136
|
+
for (let t of Array.isArray(e?.hits) ? e.hits : []) typeof t?.id == "string" && (r.add(t.id), c.set(t.id, Math.max(c.get(t.id) ?? 0, Number(t._rankingScore) || 0)));
|
|
137
|
+
l = l === null ? r : t[n].op === "OR" ? /* @__PURE__ */ new Set([...l, ...r]) : new Set([...l].filter((e) => r.has(e)));
|
|
138
|
+
}), [...l ?? []].sort((e, t) => c.get(t) - c.get(e) || (e < t ? -1 : +(e > t)));
|
|
139
|
+
}
|
|
140
|
+
async function C(e, t, { offset: n = 0, limit: r = 20, scope: i = {}, languages: a = [], locales: o = {}, fetch: s, signal: c, cache: l } = {}) {
|
|
141
|
+
let u = {
|
|
142
|
+
fetch: s,
|
|
143
|
+
signal: c
|
|
144
|
+
}, d = y(t, i), f = t.rows.filter((e) => e.q), p = t.searchlang ? o[t.searchlang] : void 0;
|
|
145
|
+
if (f.length <= 1) {
|
|
146
|
+
let t = f[0] ?? {
|
|
147
|
+
q: "",
|
|
148
|
+
field: "keyword"
|
|
149
|
+
}, i = b(t.field, a), o = await x(e, {
|
|
150
|
+
q: t.q,
|
|
151
|
+
offset: n,
|
|
152
|
+
limit: r,
|
|
153
|
+
matchingStrategy: "all",
|
|
154
|
+
filter: d,
|
|
155
|
+
...i ? { attributesToSearchOn: i } : {},
|
|
156
|
+
...p ? { locales: [p] } : {}
|
|
157
|
+
}, u);
|
|
158
|
+
return {
|
|
159
|
+
hits: Array.isArray(o?.hits) ? o.hits : [],
|
|
160
|
+
total: Number(o?.estimatedTotalHits ?? 0)
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
f[0] = {
|
|
164
|
+
...f[0],
|
|
165
|
+
op: "AND"
|
|
166
|
+
};
|
|
167
|
+
let m = JSON.stringify([f, d]), h = l?.get(m);
|
|
168
|
+
h || (h = await S(e, f, d, {
|
|
169
|
+
languages: a,
|
|
170
|
+
locale: p,
|
|
171
|
+
...u
|
|
172
|
+
}), l?.clear(), l?.set(m, h));
|
|
173
|
+
let g = h.slice(n, n + r);
|
|
174
|
+
if (g.length === 0) return {
|
|
175
|
+
hits: [],
|
|
176
|
+
total: h.length
|
|
177
|
+
};
|
|
178
|
+
let _ = await x(e, {
|
|
179
|
+
q: "",
|
|
180
|
+
limit: g.length,
|
|
181
|
+
filter: [`id IN [${g.map((e) => `"${e}"`).join(", ")}]`]
|
|
182
|
+
}, u), v = new Map((Array.isArray(_?.hits) ? _.hits : []).map((e) => [e.id, e]));
|
|
183
|
+
return {
|
|
184
|
+
hits: g.map((e) => v.get(e)).filter(Boolean),
|
|
185
|
+
total: h.length
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function w(e, t) {
|
|
189
|
+
let n = e?.texts ?? {}, r = n[t]?.name ? t : n.en?.name ? "en" : (e?.languages ?? []).find((e) => n[e]?.name), i = r ? n[r] : null;
|
|
190
|
+
return {
|
|
191
|
+
language: r ?? t,
|
|
192
|
+
name: i?.name ?? "",
|
|
193
|
+
partner: i?.partner?.[0] ?? "",
|
|
194
|
+
dates: i?.dates?.[0] ?? "",
|
|
195
|
+
country: i?.country ?? ""
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function T(e, t) {
|
|
199
|
+
let n = e?.labels ?? {};
|
|
200
|
+
return n[t] ?? n.en ?? Object.values(n)[0] ?? "";
|
|
201
|
+
}
|
|
202
|
+
function E(e) {
|
|
203
|
+
return String(e ?? "").normalize("NFD").replace(/[̀-ًͯ-ٰٟـ]/g, "").replace(/[آأإٱ]/g, "ا").replace(/ى/g, "ي").replace(/ة/g, "ه").toLowerCase().trim();
|
|
204
|
+
}
|
|
205
|
+
function D(e, t, n = 10) {
|
|
206
|
+
let r = E(t);
|
|
207
|
+
if (!r) return [];
|
|
208
|
+
let i = [];
|
|
209
|
+
for (let t of e) {
|
|
210
|
+
let e = E(t.label), n = e.indexOf(r);
|
|
211
|
+
if (n < 0) continue;
|
|
212
|
+
let a = n === 0 ? 0 : /[\s\-/(،,]/.test(e.charAt(n - 1)) ? 1 : 2;
|
|
213
|
+
i.push({
|
|
214
|
+
option: t,
|
|
215
|
+
rank: a
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return i.sort((e, t) => e.rank - t.rank || t.option.count - e.option.count || e.option.label.localeCompare(t.option.label)), i.slice(0, n).map((e) => e.option);
|
|
219
|
+
}
|
|
220
|
+
var O = "https://search.metanull.eu", k = "https://museumwithnofrontiers.github.io/search/data/";
|
|
221
|
+
function A(e, t, { fetch: n = fetch, cache: r = j } = {}) {
|
|
222
|
+
let i = `${e}${t}`;
|
|
223
|
+
return r.has(i) || r.set(i, n(i).then((e) => {
|
|
224
|
+
if (!e.ok) throw Error(`${t}: ${e.status}`);
|
|
225
|
+
return e.json();
|
|
226
|
+
}).catch((e) => {
|
|
227
|
+
throw r.delete(i), e;
|
|
228
|
+
})), r.get(i);
|
|
229
|
+
}
|
|
230
|
+
var j = /* @__PURE__ */ new Map();
|
|
231
|
+
function M(e, t) {
|
|
232
|
+
return l.test(e) && r.includes(t) ? `filters/tags-${e}-${t}.json` : null;
|
|
233
|
+
}
|
|
234
|
+
function N(e, t, n) {
|
|
235
|
+
let r = [];
|
|
236
|
+
for (let i of Array.isArray(e?.sites) ? e.sites : []) {
|
|
237
|
+
if (typeof i?.site != "string" || typeof i.path != "string" || !i.path.startsWith("/") || i.path.startsWith("//")) continue;
|
|
238
|
+
let e = t.get(i.site), a = typeof i.name == "string" && i.name ? i.name : e?.name ?? i.site;
|
|
239
|
+
if (n && i.site === n) r.unshift({
|
|
240
|
+
site: i.site,
|
|
241
|
+
name: a,
|
|
242
|
+
route: i.path,
|
|
243
|
+
href: null
|
|
244
|
+
});
|
|
245
|
+
else if (e) {
|
|
246
|
+
let t = `${e.origin}/#${i.path}`;
|
|
247
|
+
(i.url === void 0 || i.url === t) && r.push({
|
|
248
|
+
site: i.site,
|
|
249
|
+
name: a,
|
|
250
|
+
route: null,
|
|
251
|
+
href: t
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return r;
|
|
256
|
+
}
|
|
257
|
+
function P(e) {
|
|
258
|
+
let t = /* @__PURE__ */ new Map();
|
|
259
|
+
for (let n of Array.isArray(e?.sites) ? e.sites : []) typeof n?.slug == "string" && c.test(n.slug) && typeof n.origin == "string" && /^https:\/\/[^/?#@\s]+(\/[^/?#\s]+)*$/.test(n.origin) && t.set(n.slug, n);
|
|
260
|
+
return t;
|
|
261
|
+
}
|
|
262
|
+
export { _ as S, A as _, i as a, D as b, r as c, E as d, v as f, w as g, N as h, k as i, y as l, g as m, n, a as o, T as p, O as r, e as s, t, b as u, C as v, M as x, P as y };
|
package/dist/index.js
CHANGED
|
@@ -6,4 +6,5 @@ import { a as E, i as D, n as O, o as k, r as A, t as j } from "./TimelineEventL
|
|
|
6
6
|
import { t as M } from "./GlossaryPopover-DbQKXhx9.js";
|
|
7
7
|
import { a as N, i as P, n as F, o as I, r as L, s as R, t as z } from "./OnDisplayIn-Ct8xxMwQ.js";
|
|
8
8
|
import { t as B } from "./content-B1458eb-.js";
|
|
9
|
-
|
|
9
|
+
import { S as V, _ as H, a as U, b as W, c as G, d as K, f as q, g as J, h as Y, i as X, l as Z, m as Q, n as $, o as ee, p as te, r as ne, s as re, t as ie, u as ae, v as oe, x as se, y as ce } from "./globalDatabase-DwTGcqXU.js";
|
|
10
|
+
export { i as AppBanner, c as AppContent, a as AppFooter, u as AppHeader, o as AppHyperlinks, t as AppNavigation, e as AppSponsors, R as BackLink, ie as DATABASE_FIELDS, $ as DATABASE_FIELD_LABELS, P as DynastyList, N as DynastyPopout, E as FacetSelect, h as FeaturedRecord, D as FilterPanel, ne as GLOBAL_SEARCH_API, X as GLOBAL_SEARCH_DATA_URL, n as GlobalSearchBox, M as GlossaryPopover, I as GlossaryTool, b as MediaGallery, z as OnDisplayIn, l as PageShell, k as Pagination, w as PartnerMap, O as PartnerPanel, U as ROW_COUNT, ee as ROW_LIMIT, g as RecordCredits, y as RecordGrid, _ as RecordLanguages, T as RecordList, C as RecordSheet, F as RelatedMedia, S as RelatedRecords, A as ResultsSummary, re as SEARCH_TYPES, m as SectionCards, x as SheetSection, s as SocialLinks, v as SourceCredit, B as SpecialFeatures, G as TAG_CATEGORIES, j as TimelineEventList, L as TimelineLookup, p as chromeAsset, d as chromePicture, f as chromeSource, Z as databaseFilter, ae as fieldAttributes, K as foldText, q as isDatabaseSearch, te as labelOf, r as mwnfSocialLinks, Q as parseDatabaseQuery, Y as resultLinks, J as resultTexts, H as searchDataFile, oe as searchDatabase, ce as sitesBySlug, W as suggest, se as tagListFile, V as toDatabaseQuery };
|