@museumwnf/viewer-layout 2.14.0 → 2.15.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.
@@ -0,0 +1,1220 @@
1
+ import { a as e, c as t, d as n, f as r, g as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as ee, t as te, u as ne } from "./TimelineEventList-BmfLBaTT.js";
2
+ import { Fragment as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createSlots as re, createTextVNode as y, createVNode as b, guardReactiveProps as x, isRef as S, mergeProps as C, normalizeClass as w, normalizeProps as T, openBlock as E, reactive as D, ref as O, renderList as k, renderSlot as A, resolveDynamicComponent as j, toDisplayString as M, unref as N, useSlots as P, vModelCheckbox as F, vModelRadio as I, vModelSelect as L, vModelText as R, withCtx as z, withDirectives as B } from "vue";
3
+ import { I18nText as V, NotFoundView as H, byId as U, centuryPresets as ie, citation as W, dateRange as ae, entityRef as oe, eventDateLabel as se, groupByCountry as G, languageLabels as ce, md as K, partnerHierarchy as q, renderBlock as J, renderInline as Y, renderPlain as X, sheetRows as le, sortChronological as Z, sourceUrl as Q, useDataPackage as ue, useFacets as de, useGlossaryPopup as fe, useI18n as pe, useListQuery as me, useLocale as he, usePagination as $, useProjects as ge, useRecordSheet as _e, useRelatedRecords as ve, useSearchLanguage as ye, useTimelineEvents as be, yearBuckets as xe } from "@museumwnf/viewer-core";
4
+ import { useRoute as Se, useRouter as Ce } from "vue-router";
5
+ //#region src/views/CatalogueResultsView.vue
6
+ var we = { class: "mwnf-catalogue" }, Te = {
7
+ key: 0,
8
+ class: "mwnf-catalogue__title"
9
+ }, Ee = {
10
+ key: 0,
11
+ class: "mwnf-facet"
12
+ }, De = {
13
+ key: 0,
14
+ class: "mwnf-facet__label"
15
+ }, Oe = [
16
+ "value",
17
+ "placeholder",
18
+ "onInput"
19
+ ], ke = {
20
+ key: 1,
21
+ class: "mwnf-facet"
22
+ }, Ae = {
23
+ key: 0,
24
+ class: "mwnf-facet__label"
25
+ }, je = [
26
+ "value",
27
+ "placeholder",
28
+ "onInput"
29
+ ], Me = {
30
+ key: 2,
31
+ class: "mwnf-facet mwnf-facet--checkbox"
32
+ }, Ne = ["checked", "onChange"], Pe = {
33
+ key: 0,
34
+ class: "mwnf-facet__label"
35
+ }, Fe = { class: "mwnf-catalogue__body" }, Ie = { class: "mwnf-catalogue__results" }, Le = {
36
+ key: 0,
37
+ class: "mwnf-catalogue__aside"
38
+ }, Re = {
39
+ __name: "CatalogueResultsView",
40
+ props: {
41
+ spec: {
42
+ type: Object,
43
+ required: !0
44
+ },
45
+ entity: {
46
+ type: String,
47
+ default: ""
48
+ }
49
+ },
50
+ setup(e) {
51
+ let t = e, { t: i, locale: o } = pe(), s = ue(), l = t.spec.entity ?? t.entity, u = m(() => t.spec), f = oe(l);
52
+ l && s.loadTranslations(l, "en");
53
+ let ee = m(() => u.value.keys ?? [...Object.keys(u.value.facets ?? {}), ...te()]);
54
+ function te() {
55
+ let e = u.value.dates;
56
+ return e ? [e.begin ?? "begin", e.end ?? "end"] : [];
57
+ }
58
+ let { filters: S, page: C, active: w, apply: D, reset: O, goToPage: P } = me({ keys: ee.value }), F = {
59
+ t: i,
60
+ locale: o,
61
+ tr: (e, t) => s.tr(e, t, o.value, "en"),
62
+ renderInline: Y,
63
+ renderPlain: X
64
+ };
65
+ function I(e, t) {
66
+ if (typeof t.values == "function") return [t.values(e)].flat();
67
+ let n = e?.[t.field];
68
+ return Array.isArray(n) ? n : [n];
69
+ }
70
+ let L = m(() => {
71
+ let e = u.value, t = f.value ?? [];
72
+ e.scope && (t = t.filter((t) => e.scope(t, S, F)));
73
+ for (let [n, r] of Object.entries(e.facets ?? {})) {
74
+ let e = S[n];
75
+ e && (t = t.filter((t) => I(t, r).map(String).includes(String(e))));
76
+ }
77
+ e.match && (t = t.filter((t) => e.match(t, S, F))), e.narrow && (t = e.narrow(t, S, F)), e.dates && (t = ae(t, {
78
+ begin: S[e.dates.begin ?? "begin"],
79
+ end: S[e.dates.end ?? "end"],
80
+ mode: e.dates.mode ?? "overlap",
81
+ fields: e.dates.fields
82
+ }));
83
+ let n = e.sort ?? "chronological";
84
+ return typeof n == "function" ? n(t) : n === "chronological" ? Z(t) : n && typeof n == "object" ? Z(t, n) : t;
85
+ }), R = m(() => u.value.facetScope === "matching" ? L.value : f.value ?? []), B = de(R, () => u.value.facets ?? {}), V = $(L, {
86
+ page: C,
87
+ size: () => u.value.pageSize ?? 20
88
+ }), H = m(() => u.value.recordRoute ?? (t.entity ? `${t.entity}-detail` : "item"));
89
+ function U(e) {
90
+ let t = F.tr(l, e.id).name ?? e.internal_name ?? e.id;
91
+ return {
92
+ id: e.id,
93
+ image: e.images?.[0]?.url ?? "",
94
+ imageAlt: X(String(t)),
95
+ name: Y(String(t)),
96
+ meta: [],
97
+ badge: e.type ?? "",
98
+ to: {
99
+ name: H.value,
100
+ params: { id: e.id }
101
+ }
102
+ };
103
+ }
104
+ let ie = m(() => V.value.rows.map((e) => (u.value.record ?? U)(e, F))), W = m(() => ({
105
+ filters: S,
106
+ active: w.value,
107
+ apply: D,
108
+ reset: O,
109
+ goToPage: P,
110
+ matching: L.value,
111
+ pageInfo: V.value,
112
+ options: B.value
113
+ })), se = m(() => {
114
+ let e = u.value;
115
+ return e.summary ? e.summary({
116
+ ...W.value,
117
+ t: i,
118
+ total: (f.value ?? []).length
119
+ }) : [{
120
+ label: i(e.summaryLabel ?? "catalogue.results.itemsFound"),
121
+ count: V.value.total
122
+ }];
123
+ }), G = m(() => u.value.filterMode ?? "apply"), ce = m(() => u.value.controls ?? []), K = m(() => ce.value.length > 0 || !!u.value.panel);
124
+ function q(e, t) {
125
+ G.value === "immediate" ? D({ [e]: t }) : S[e] = t;
126
+ }
127
+ let J = m(() => i(u.value.empty ?? "catalogue.results.noResultsFilter")), le = m(() => u.value.variant === "grid"), Q = m(() => ({
128
+ window: 5,
129
+ jump: !1,
130
+ ends: !0,
131
+ ...u.value.pagination ?? {}
132
+ }));
133
+ return (e, t) => (E(), _("section", we, [
134
+ A(e.$slots, "before", T(x(W.value))),
135
+ u.value.title ? (E(), _("h1", Te, M(N(i)(u.value.title)), 1)) : g("", !0),
136
+ K.value || e.$slots.filters ? (E(), h(n, {
137
+ key: 1,
138
+ class: "mwnf-catalogue__filters",
139
+ mode: G.value,
140
+ title: u.value.filterTitle ? N(i)(u.value.filterTitle) : "",
141
+ "reset-label": u.value.resetLabel ? N(i)(u.value.resetLabel) : "",
142
+ onApply: t[2] ||= (e) => N(D)(),
143
+ onReset: t[3] ||= (e) => N(O)()
144
+ }, {
145
+ default: z(() => [(E(!0), _(p, null, k(ce.value, (e) => (E(), _(p, { key: e.key }, [e.type === "year" ? (E(), _("label", Ee, [e.label ? (E(), _("span", De, M(N(i)(e.label)), 1)) : g("", !0), v("input", {
146
+ type: "number",
147
+ class: "mwnf-facet__select",
148
+ value: N(S)[e.key],
149
+ placeholder: e.placeholder ? N(i)(e.placeholder) : "",
150
+ onInput: (t) => N(S)[e.key] = t.target.value,
151
+ onChange: t[0] ||= (e) => G.value === "immediate" ? N(D)() : null
152
+ }, null, 40, Oe)])) : e.type === "query" ? (E(), _("label", ke, [e.label ? (E(), _("span", Ae, M(N(i)(e.label)), 1)) : g("", !0), v("input", {
153
+ type: "text",
154
+ class: "mwnf-facet__select",
155
+ value: N(S)[e.key],
156
+ placeholder: e.placeholder ? N(i)(e.placeholder) : "",
157
+ onInput: (t) => N(S)[e.key] = t.target.value,
158
+ onChange: t[1] ||= (e) => G.value === "immediate" ? N(D)() : null
159
+ }, null, 40, je)])) : e.type === "checkbox" ? (E(), _("label", Me, [v("input", {
160
+ type: "checkbox",
161
+ class: "mwnf-facet__checkbox",
162
+ checked: N(S)[e.key] === "1",
163
+ onChange: (t) => q(e.key, t.target.checked ? "1" : "")
164
+ }, null, 40, Ne), e.label ? (E(), _("span", Pe, M(N(i)(e.label)), 1)) : g("", !0)])) : (E(), h(r, {
165
+ key: 3,
166
+ "model-value": N(S)[e.key],
167
+ label: e.label ? N(i)(e.label) : "",
168
+ options: N(B)[e.key] ?? [],
169
+ placeholder: e.placeholder ? N(i)(e.placeholder) : "",
170
+ "any-label": e.anyLabel ? N(i)(e.anyLabel) : "",
171
+ "hide-empty": !!e.hideEmpty,
172
+ "onUpdate:modelValue": (t) => q(e.key, t)
173
+ }, null, 8, [
174
+ "model-value",
175
+ "label",
176
+ "options",
177
+ "placeholder",
178
+ "any-label",
179
+ "hide-empty",
180
+ "onUpdate:modelValue"
181
+ ]))], 64))), 128)), A(e.$slots, "filters", T(x(W.value)))]),
182
+ _: 3
183
+ }, 8, [
184
+ "mode",
185
+ "title",
186
+ "reset-label"
187
+ ])) : g("", !0),
188
+ b(ne, { parts: se.value }, re({ _: 2 }, [e.$slots.actions ? {
189
+ name: "actions",
190
+ fn: z(() => [A(e.$slots, "actions", T(x(W.value)))]),
191
+ key: "0"
192
+ } : void 0]), 1032, ["parts"]),
193
+ v("div", Fe, [v("div", Ie, [(E(), h(j(le.value ? c : a), {
194
+ records: ie.value,
195
+ "action-label": u.value.actionLabel ? N(i)(u.value.actionLabel) : ""
196
+ }, {
197
+ empty: z(() => [A(e.$slots, "empty", T(x(W.value)), () => [y(M(J.value), 1)])]),
198
+ _: 3
199
+ }, 8, ["records", "action-label"])), b(d, {
200
+ "page-info": N(V),
201
+ window: Q.value.window,
202
+ jump: Q.value.jump,
203
+ ends: Q.value.ends,
204
+ onNavigate: N(P)
205
+ }, null, 8, [
206
+ "page-info",
207
+ "window",
208
+ "jump",
209
+ "ends",
210
+ "onNavigate"
211
+ ])]), e.$slots.aside ? (E(), _("aside", Le, [A(e.$slots, "aside", T(x(W.value)))])) : g("", !0)]),
212
+ A(e.$slots, "after", T(x(W.value)))
213
+ ]));
214
+ }
215
+ }, ze = ["dir", "innerHTML"], Be = { class: "mwnf-record__body" }, Ve = { class: "mwnf-record__main" }, He = {
216
+ key: 1,
217
+ class: "mwnf-record__status"
218
+ }, Ue = {
219
+ key: 0,
220
+ class: "mwnf-record__aside"
221
+ }, We = {
222
+ key: 2,
223
+ class: "mwnf-record__status"
224
+ }, Ge = {
225
+ __name: "RecordView",
226
+ props: {
227
+ spec: {
228
+ type: Object,
229
+ required: !0
230
+ },
231
+ id: {
232
+ type: String,
233
+ required: !0
234
+ },
235
+ entity: {
236
+ type: String,
237
+ default: ""
238
+ }
239
+ },
240
+ setup(n) {
241
+ let r = n, { t: a, locale: c } = pe(), d = ue(), te = ge(), ne = P(), S = Se(), C = r.spec.entity ?? r.entity, w = m(() => r.spec), D = oe(C), O = U(C), j = m(() => O.value.get(r.id) ?? null), F = m(() => D.value !== null), { language: I, languages: L, dir: R, select: B, text: V, ready: ie, terms: ae, glossary: se, attribution: G } = _e(j, {
242
+ entity: C,
243
+ translations: r.spec.translations ?? [],
244
+ attribution: r.spec.attribution ?? []
245
+ }), K = m(() => ce(L.value)), { active: q, onClick: Z, close: de } = fe(ae), me = m(() => q.value ? J(q.value.definition, { breaks: !0 }) : ""), he = (e, t) => d.tr(e, t, I.value, "en"), $ = m(() => ({
246
+ record: j.value,
247
+ text: V.value,
248
+ language: I.value,
249
+ languages: K.value,
250
+ select: B,
251
+ dir: R.value,
252
+ glossary: se.value,
253
+ ready: ie.value,
254
+ attribution: G.value,
255
+ t: a,
256
+ tr: he
257
+ }));
258
+ function ye(e) {
259
+ return ((typeof e == "function" ? e($.value) : e) ?? []).map((e) => ({
260
+ ...e,
261
+ label: e.label ? a(e.label) : ""
262
+ }));
263
+ }
264
+ let be = m(() => j.value ? le(ye(w.value.fields), $.value) : []), xe = m(() => j.value ? le(ye(w.value.sections).map((e) => ({
265
+ render: "block",
266
+ ...e
267
+ })), $.value) : []), Ce = m(() => w.value.shortDescription === !1 ? "" : w.value.shortDescription ?? "short_description"), we = m(() => {
268
+ let e = Ce.value ? V.value[Ce.value] : "";
269
+ return e ? { html: J(String(e), {
270
+ breaks: !0,
271
+ glossary: se.value
272
+ }) } : null;
273
+ }), Te = m(() => {
274
+ if (!j.value) return "";
275
+ if (w.value.title) return w.value.title($.value);
276
+ let e = V.value.name ?? j.value.internal_name ?? j.value.id;
277
+ return Y(String(e), { glossary: se.value });
278
+ }), Ee = m(() => {
279
+ if (!j.value) return [];
280
+ if (w.value.media) return w.value.media(j.value, $.value);
281
+ let e = X(String(V.value.name ?? j.value.internal_name ?? ""));
282
+ return (j.value.images ?? []).map((t) => ({
283
+ url: t.url,
284
+ alt: t.captions?.[I.value] ?? e,
285
+ caption: t.captions?.[I.value] ?? t.captions?.en ?? "",
286
+ photographer: t.photographer ?? "",
287
+ copyright: t.copyright ?? ""
288
+ }));
289
+ }), De = [
290
+ {
291
+ field: "author",
292
+ label: "sheet.field.preparedBy"
293
+ },
294
+ {
295
+ field: "copy_editor",
296
+ label: "sheet.field.copyeditedBy"
297
+ },
298
+ {
299
+ field: "translator",
300
+ label: "sheet.field.translationBy"
301
+ },
302
+ {
303
+ field: "translation_copy_editor",
304
+ label: "sheet.field.translationCopyeditedBy"
305
+ }
306
+ ], Oe = m(() => (w.value.credits ?? De).map(({ field: e, label: t }) => ({
307
+ label: a(t),
308
+ value: V.value[e] ?? G.value[e] ?? ""
309
+ })).filter((e) => e.value)), ke = m(() => String(j.value?.[w.value.workingNumber ?? "mwnf_reference"] ?? "")), Ae = m(() => {
310
+ let e = w.value.citation;
311
+ if (!j.value || e === !1) return "";
312
+ let t = typeof e?.project == "function" ? null : e?.project ?? j.value.project_id, n = typeof e?.project == "function" ? e.project(j.value, $.value) : te.label(t), r = e?.permalink === !1 ? void 0 : typeof e?.permalink == "string" ? e.permalink : Q(S) ?? void 0;
313
+ return W({
314
+ author: V.value.author ?? G.value.author,
315
+ name: V.value.name ?? j.value.internal_name ?? "",
316
+ project: n,
317
+ permalink: r,
318
+ inWord: a("record.citation.in")
319
+ });
320
+ }), je = ve(j, {
321
+ entity: C,
322
+ language: I
323
+ }), Me = m(() => w.value.related === !1 ? null : w.value.related ?? {}), Ne = m(() => {
324
+ if (!Me.value) return [];
325
+ let e = Me.value.record ?? Pe;
326
+ return je.value.inPackage.map((t) => e(t, $.value));
327
+ });
328
+ function Pe({ record: e, justification: t }) {
329
+ let n = he(C, e.id).name ?? e.internal_name ?? e.id;
330
+ return {
331
+ id: e.id,
332
+ image: e.images?.[0]?.url ?? "",
333
+ imageAlt: X(String(n)),
334
+ name: Y(String(n)),
335
+ meta: t ? [t] : [],
336
+ badge: e.type ?? "",
337
+ to: {
338
+ name: w.value.route ?? (r.entity ? `${r.entity}-detail` : "item"),
339
+ params: { id: e.id }
340
+ }
341
+ };
342
+ }
343
+ let Fe = /* @__PURE__ */ new Set([
344
+ "header",
345
+ "before-sheet",
346
+ "after-sheet",
347
+ "aside",
348
+ "source",
349
+ "related",
350
+ "after",
351
+ "default"
352
+ ]), Ie = m(() => Object.keys(ne).filter((e) => !Fe.has(e)));
353
+ return (n, r) => F.value && !j.value ? (E(), h(N(H), { key: 0 })) : j.value ? (E(), _("article", {
354
+ key: 1,
355
+ class: "mwnf-record",
356
+ onClick: r[0] ||= (...e) => N(Z) && N(Z)(...e)
357
+ }, [
358
+ A(n.$slots, "header", T(x($.value)), () => [
359
+ w.value.back ? (E(), h(i, {
360
+ key: 0,
361
+ class: "mwnf-record__back",
362
+ to: w.value.back.to,
363
+ href: w.value.back.href
364
+ }, {
365
+ default: z(() => [y("← " + M(N(a)(w.value.back.label)), 1)]),
366
+ _: 1
367
+ }, 8, ["to", "href"])) : g("", !0),
368
+ b(s, {
369
+ languages: K.value,
370
+ language: N(I),
371
+ onSelect: N(B)
372
+ }, null, 8, [
373
+ "languages",
374
+ "language",
375
+ "onSelect"
376
+ ]),
377
+ v("h1", {
378
+ class: "mwnf-record__title",
379
+ dir: N(R) || void 0,
380
+ innerHTML: Te.value
381
+ }, null, 8, ze)
382
+ ]),
383
+ v("div", Be, [v("div", Ve, [
384
+ Ee.value.length ? (E(), h(f, {
385
+ key: 0,
386
+ images: Ee.value,
387
+ variant: w.value.mediaVariant ?? ""
388
+ }, null, 8, ["images", "variant"])) : g("", !0),
389
+ N(ie) ? g("", !0) : (E(), _("p", He, M(N(a)("core.status.loading")), 1)),
390
+ A(n.$slots, "before-sheet", T(x($.value))),
391
+ b(t, {
392
+ rows: be.value,
393
+ layout: w.value.layout ?? "table",
394
+ dir: N(R),
395
+ "short-description": we.value,
396
+ "short-description-after": w.value.shortDescriptionAfter ?? "description"
397
+ }, re({ _: 2 }, [k(Ie.value, (e) => ({
398
+ name: e,
399
+ fn: z((t) => [A(n.$slots, e, T(x({
400
+ ...t,
401
+ ...$.value
402
+ })))])
403
+ }))]), 1032, [
404
+ "rows",
405
+ "layout",
406
+ "dir",
407
+ "short-description",
408
+ "short-description-after"
409
+ ]),
410
+ (E(!0), _(p, null, k(xe.value, (e) => (E(), h(ee, {
411
+ key: e.key,
412
+ heading: e.label,
413
+ html: e.html,
414
+ dir: N(R)
415
+ }, null, 8, [
416
+ "heading",
417
+ "html",
418
+ "dir"
419
+ ]))), 128)),
420
+ A(n.$slots, "after-sheet", T(x($.value))),
421
+ b(u, {
422
+ credits: Oe.value,
423
+ "working-number": ke.value,
424
+ "working-number-label": N(a)("sheet.field.workingNumber"),
425
+ citation: Ae.value,
426
+ "citation-heading": w.value.citation?.heading ? N(a)(w.value.citation.heading) : ""
427
+ }, null, 8, [
428
+ "credits",
429
+ "working-number",
430
+ "working-number-label",
431
+ "citation",
432
+ "citation-heading"
433
+ ]),
434
+ A(n.$slots, "source", T(x($.value)), () => [b(e)]),
435
+ A(n.$slots, "related", T(x({
436
+ ...$.value,
437
+ records: Ne.value,
438
+ outside: N(je).outside
439
+ })), () => [Me.value ? (E(), h(o, {
440
+ key: 0,
441
+ heading: N(a)(Me.value.heading ?? "record.related.items"),
442
+ records: Ne.value,
443
+ variant: Me.value.variant ?? "list",
444
+ "action-label": Me.value.actionLabel ? N(a)(Me.value.actionLabel) : ""
445
+ }, null, 8, [
446
+ "heading",
447
+ "records",
448
+ "variant",
449
+ "action-label"
450
+ ])) : g("", !0)])
451
+ ]), n.$slots.aside ? (E(), _("aside", Ue, [A(n.$slots, "aside", T(x($.value)))])) : g("", !0)]),
452
+ A(n.$slots, "after", T(x($.value))),
453
+ b(l, {
454
+ term: N(q),
455
+ html: me.value,
456
+ dir: N(R),
457
+ onClose: N(de)
458
+ }, null, 8, [
459
+ "term",
460
+ "html",
461
+ "dir",
462
+ "onClose"
463
+ ])
464
+ ])) : (E(), _("p", We, M(N(a)("core.status.loading")), 1));
465
+ }
466
+ }, Ke = { class: "mwnf-partner-list" }, qe = {
467
+ key: 0,
468
+ class: "mwnf-partner-list__title"
469
+ }, Je = {
470
+ key: 1,
471
+ class: "mwnf-partner-list__count"
472
+ }, Ye = {
473
+ key: 2,
474
+ class: "mwnf-partner-list__toggle"
475
+ }, Xe = {
476
+ key: 3,
477
+ class: "mwnf-partner-list__groups"
478
+ }, Ze = {
479
+ key: 0,
480
+ class: "mwnf-partner-list__group-title"
481
+ }, Qe = { class: "mwnf-partner-list__tier" }, $e = { class: "mwnf-partner-list__row" }, et = ["src", "alt"], tt = ["innerHTML"], nt = { key: 0 }, rt = {
482
+ key: 1,
483
+ class: "mwnf-partner-list__meta"
484
+ }, it = {
485
+ key: 0,
486
+ class: "mwnf-partner-list__children"
487
+ }, at = ["src", "alt"], ot = ["innerHTML"], st = { key: 0 }, ct = {
488
+ key: 1,
489
+ class: "mwnf-partner-list__meta"
490
+ }, lt = {
491
+ key: 0,
492
+ class: "mwnf-partner-list__tier mwnf-partner-list__tier--associated"
493
+ }, ut = { class: "mwnf-partner-list__tier-label" }, dt = ["src", "alt"], ft = ["innerHTML"], pt = { key: 0 }, mt = {
494
+ key: 1,
495
+ class: "mwnf-partner-list__meta"
496
+ }, ht = {
497
+ key: 4,
498
+ class: "mwnf-partner-list__empty"
499
+ }, gt = {
500
+ __name: "PartnerListView",
501
+ props: { spec: {
502
+ type: Object,
503
+ required: !0
504
+ } },
505
+ setup(e) {
506
+ let t = e, { t: n, locale: r } = pe(), a = ue(), o = m(() => t.spec), s = m(() => o.value.entity ?? "partners"), c = oe(s.value);
507
+ s.value && a.loadTranslations(s.value, "en");
508
+ let l = {
509
+ t: n,
510
+ locale: r,
511
+ tr: (e) => a.tr(s.value, e, r.value, "en"),
512
+ renderInline: Y,
513
+ renderPlain: X
514
+ }, { filters: u, apply: d } = me({
515
+ keys: ["order"],
516
+ page: !1
517
+ }), f = m(() => u.order === "desc" ? "desc" : "asc");
518
+ function ee() {
519
+ d({ order: f.value === "asc" ? "desc" : "asc" });
520
+ }
521
+ let te = m(() => {
522
+ let e = o.value, t = c.value ?? [];
523
+ return e.scope ? t.filter((t) => e.scope(t, l)) : t;
524
+ }), ne = m(() => o.value.route);
525
+ function re(e) {
526
+ let t = ne.value;
527
+ return t ? typeof t == "function" ? t(e, l) : {
528
+ name: t,
529
+ params: { id: e.id }
530
+ } : null;
531
+ }
532
+ function y(e, t) {
533
+ let n = t.tr(e.id), r = n.name ?? e.internal_name ?? e.id;
534
+ return {
535
+ name: t.renderInline(String(r)),
536
+ city: n.city ?? "",
537
+ logo: e.logos?.[0]?.url ?? "",
538
+ count: e.item_count ?? 0,
539
+ route: re(e)
540
+ };
541
+ }
542
+ function b(e) {
543
+ return (o.value.record ?? y)(e, l);
544
+ }
545
+ function S(e) {
546
+ return String(e ?? "").replace(/<[^>]*>/g, "");
547
+ }
548
+ let w = m(() => o.value.nested ? q(te.value) : null), D = m(() => {
549
+ let e = o.value, t = e.group?.tier ?? !1, n = (e.group?.order ?? "country") === "name", r = n ? te.value.map((e) => ({
550
+ ...e,
551
+ country_id: "\0"
552
+ })) : te.value, i = G(r, {
553
+ label: n ? () => "" : (t) => e.label ? e.label(t, l) : t,
554
+ tier: t,
555
+ order: f.value
556
+ }), a = (e, t) => S(e.row.name).localeCompare(S(t.row.name));
557
+ return i.map((t) => {
558
+ let r = t.main.map((e) => ({
559
+ partner: e,
560
+ row: b(e)
561
+ })).sort(a), i = t.associated.map((e) => ({
562
+ partner: e,
563
+ row: b(e)
564
+ })).sort(a);
565
+ if (n && f.value === "desc" && (r.reverse(), i.reverse()), e.nested && w.value) {
566
+ let e = new Set(i.map((e) => e.partner.id));
567
+ r = r.map((t) => {
568
+ let n = w.value.children(t.partner.id).filter((t) => e.has(t.id));
569
+ for (let t of n) e.delete(t.id);
570
+ return {
571
+ ...t,
572
+ children: n.map((e) => ({
573
+ partner: e,
574
+ row: b(e)
575
+ }))
576
+ };
577
+ }), i = i.filter((t) => e.has(t.partner.id));
578
+ }
579
+ return {
580
+ country: t.country,
581
+ label: t.label,
582
+ main: r,
583
+ associated: i
584
+ };
585
+ });
586
+ }), O = m(() => D.value.some((e) => e.main.length > 0 || e.associated.length > 0)), N = m(() => n(o.value.associatedLabel ?? "partner.list.associated")), P = m(() => n(o.value.objectsLabel ?? "partner.item.objectsInSite")), F = m(() => n(o.value.foundLabel ?? "partner.list.partnersFound")), I = m(() => n(o.value.sortAscendingLabel ?? "partner.list.sortAscending")), L = m(() => n(o.value.sortDescendingLabel ?? "partner.list.sortDescending")), R = m(() => n(o.value.empty ?? "catalogue.results.noResults")), B = m(() => o.value.title ? n(o.value.title) : ""), V = m(() => D.value.reduce((e, t) => e + t.main.length + t.associated.length, 0)), H = m(() => o.value.variant ?? "accordion"), U = m(() => ({
587
+ t: n,
588
+ locale: r,
589
+ groups: D.value,
590
+ orderDir: f.value,
591
+ toggleOrder: ee
592
+ }));
593
+ return (e, t) => (E(), _("section", Ke, [
594
+ B.value ? (E(), _("h1", qe, M(B.value), 1)) : g("", !0),
595
+ o.value.count ? (E(), _("div", Je, M(F.value) + ": " + M(V.value), 1)) : g("", !0),
596
+ A(e.$slots, "before", T(x(U.value))),
597
+ o.value.orderToggle ? (E(), _("div", Ye, [v("button", {
598
+ type: "button",
599
+ class: "mwnf-partner-list__toggle-button",
600
+ onClick: ee
601
+ }, M(f.value === "asc" ? L.value : I.value), 1)])) : g("", !0),
602
+ O.value ? (E(), _("div", Xe, [(E(!0), _(p, null, k(D.value, (t) => (E(), h(j(H.value === "accordion" ? "details" : "section"), C({
603
+ key: t.country ?? "",
604
+ class: "mwnf-partner-list__group"
605
+ }, { ref_for: !0 }, H.value === "accordion" ? { open: !0 } : {}), {
606
+ default: z(() => [
607
+ (E(), h(j(H.value === "accordion" ? "summary" : "div"), { class: "mwnf-partner-list__group-heading" }, {
608
+ default: z(() => [A(e.$slots, "group-heading", C({ group: t }, { ref_for: !0 }, U.value), () => [t.label ? (E(), _("h2", Ze, M(t.label), 1)) : g("", !0)])]),
609
+ _: 2
610
+ }, 1024)),
611
+ v("div", Qe, [(E(!0), _(p, null, k(t.main, (n) => (E(), _("div", {
612
+ key: n.partner.id,
613
+ class: "mwnf-partner-list__row-block"
614
+ }, [v("div", $e, [A(e.$slots, "row", C({
615
+ group: t,
616
+ partner: n.partner,
617
+ row: n.row
618
+ }, { ref_for: !0 }, U.value), () => [
619
+ n.row.logo ? (E(), _("img", {
620
+ key: 0,
621
+ class: "mwnf-partner-list__logo",
622
+ src: n.row.logo,
623
+ alt: S(n.row.name),
624
+ loading: "lazy"
625
+ }, null, 8, et)) : g("", !0),
626
+ (E(), h(j(n.row.route ? i : "span"), {
627
+ class: "mwnf-partner-list__name",
628
+ to: n.row.route
629
+ }, {
630
+ default: z(() => [v("span", { innerHTML: n.row.name }, null, 8, tt), n.row.city ? (E(), _("span", nt, ", " + M(n.row.city), 1)) : g("", !0)]),
631
+ _: 2
632
+ }, 1032, ["to"])),
633
+ n.row.count ? (E(), _("span", rt, M(n.row.count) + " " + M(P.value), 1)) : g("", !0)
634
+ ])]), n.children?.length ? (E(), _("div", it, [(E(!0), _(p, null, k(n.children, (n) => (E(), _("div", {
635
+ key: n.partner.id,
636
+ class: "mwnf-partner-list__row mwnf-partner-list__row--child"
637
+ }, [A(e.$slots, "row", C({
638
+ group: t,
639
+ partner: n.partner,
640
+ row: n.row
641
+ }, { ref_for: !0 }, U.value), () => [
642
+ n.row.logo ? (E(), _("img", {
643
+ key: 0,
644
+ class: "mwnf-partner-list__logo",
645
+ src: n.row.logo,
646
+ alt: S(n.row.name),
647
+ loading: "lazy"
648
+ }, null, 8, at)) : g("", !0),
649
+ (E(), h(j(n.row.route ? i : "span"), {
650
+ class: "mwnf-partner-list__name",
651
+ to: n.row.route
652
+ }, {
653
+ default: z(() => [v("span", { innerHTML: n.row.name }, null, 8, ot), n.row.city ? (E(), _("span", st, ", " + M(n.row.city), 1)) : g("", !0)]),
654
+ _: 2
655
+ }, 1032, ["to"])),
656
+ n.row.count ? (E(), _("span", ct, M(n.row.count) + " " + M(P.value), 1)) : g("", !0)
657
+ ])]))), 128))])) : g("", !0)]))), 128))]),
658
+ t.associated.length ? (E(), _("div", lt, [v("p", ut, M(N.value), 1), (E(!0), _(p, null, k(t.associated, (n) => (E(), _("div", {
659
+ key: n.partner.id,
660
+ class: "mwnf-partner-list__row"
661
+ }, [A(e.$slots, "row", C({
662
+ group: t,
663
+ partner: n.partner,
664
+ row: n.row
665
+ }, { ref_for: !0 }, U.value), () => [
666
+ n.row.logo ? (E(), _("img", {
667
+ key: 0,
668
+ class: "mwnf-partner-list__logo",
669
+ src: n.row.logo,
670
+ alt: S(n.row.name),
671
+ loading: "lazy"
672
+ }, null, 8, dt)) : g("", !0),
673
+ (E(), h(j(n.row.route ? i : "span"), {
674
+ class: "mwnf-partner-list__name",
675
+ to: n.row.route
676
+ }, {
677
+ default: z(() => [v("span", { innerHTML: n.row.name }, null, 8, ft), n.row.city ? (E(), _("span", pt, ", " + M(n.row.city), 1)) : g("", !0)]),
678
+ _: 2
679
+ }, 1032, ["to"])),
680
+ n.row.count ? (E(), _("span", mt, M(n.row.count) + " " + M(P.value), 1)) : g("", !0)
681
+ ])]))), 128))])) : g("", !0)
682
+ ]),
683
+ _: 2
684
+ }, 1040))), 128))])) : (E(), _("p", ht, M(R.value), 1)),
685
+ A(e.$slots, "after", T(x(U.value)))
686
+ ]));
687
+ }
688
+ }, _t = { class: "mwnf-text-page" }, vt = {
689
+ key: 0,
690
+ class: "mwnf-text-page__back"
691
+ }, yt = {
692
+ key: 1,
693
+ class: "mwnf-text-page__heading"
694
+ }, bt = { class: "mwnf-prose" }, xt = ["innerHTML"], St = {
695
+ __name: "TextPageView",
696
+ props: { spec: {
697
+ type: Object,
698
+ required: !0
699
+ } },
700
+ setup(e) {
701
+ let t = e, { t: n } = pe(), r = ue(), a = he(), o = m(() => t.spec.heading ? n(t.spec.heading) : ""), s = m(() => typeof t.spec.body == "string"), c = m(() => s.value ? t.spec.body : null), l = m(() => ({
702
+ t: n,
703
+ tr: (e, t) => r.tr(e, t, a.value, "en"),
704
+ language: a.value
705
+ })), u = m(() => s.value ? null : typeof t.spec.body == "function" ? K(t.spec.body(l.value)) : null), d = m(() => t.spec.back === !1 ? null : t.spec.back === !0 ? n("core.action.back") : t.spec.back?.label ? n(t.spec.back.label) : null);
706
+ return (e, n) => (E(), _("div", _t, [
707
+ d.value && (t.spec.back === !0 || t.spec.back?.to || t.spec.back?.href) ? (E(), _("div", vt, [b(i, {
708
+ to: t.spec.back === !0 ? {} : t.spec.back?.to,
709
+ href: t.spec.back === !0 ? "#" : t.spec.back?.href
710
+ }, {
711
+ default: z(() => [y(" ← " + M(d.value), 1)]),
712
+ _: 1
713
+ }, 8, ["to", "href"])])) : g("", !0),
714
+ o.value ? (E(), _("h1", yt, M(o.value), 1)) : g("", !0),
715
+ v("div", bt, [s.value ? (E(), h(N(V), {
716
+ key: 0,
717
+ keypath: c.value
718
+ }, null, 8, ["keypath"])) : u.value ? (E(), _("div", {
719
+ key: 1,
720
+ innerHTML: u.value
721
+ }, null, 8, xt)) : g("", !0)])
722
+ ]));
723
+ }
724
+ }, Ct = { class: "mwnf-search-form__row-label" }, wt = ["onUpdate:modelValue"], Tt = ["value"], Et = ["onUpdate:modelValue"], Dt = ["value"], Ot = ["onUpdate:modelValue", "placeholder"], kt = {
725
+ key: 0,
726
+ class: "mwnf-search-form__dates"
727
+ }, At = {
728
+ key: 1,
729
+ class: "mwnf-facet"
730
+ }, jt = { class: "mwnf-facet__label" }, Mt = { value: "" }, Nt = ["value"], Pt = {
731
+ key: 0,
732
+ class: "mwnf-search-form__dates"
733
+ }, Ft = { class: "mwnf-search-form__radio-choice" }, It = ["value"], Lt = ["onUpdate:modelValue", "disabled"], Rt = ["onUpdate:modelValue"], zt = { class: "mwnf-facet__label" }, Bt = {
734
+ key: 0,
735
+ class: "mwnf-search-form__how-to"
736
+ }, Vt = {
737
+ __name: "SearchFormView",
738
+ props: { spec: {
739
+ type: Object,
740
+ required: !0
741
+ } },
742
+ setup(e) {
743
+ let t = e, { t: a } = pe(), o = Ce(), s = m(() => t.spec), c = m(() => s.value.mode), l = m(() => s.value.entity ? oe(s.value.entity).value ?? [] : []), u = m(() => s.value.dates === "buckets"), d = m(() => {
744
+ let e = s.value.dates;
745
+ if (!e || e === "buckets") return null;
746
+ let t = e.presets;
747
+ return typeof t == "function" ? t() : t ?? ie();
748
+ });
749
+ function f(e) {
750
+ return (e ?? []).map((e) => ({
751
+ value: e,
752
+ label: String(e)
753
+ }));
754
+ }
755
+ let ee = m(() => u.value ? xe(l.value, a) : []), te = m(() => u.value ? ee.value : f(d.value?.from)), ne = m(() => u.value ? ee.value : f(d.value?.to)), re = m(() => !!s.value.dates), C = O(""), j = O(""), P = s.value.language ? ye(s.value.language) : null, V = m(() => P?.languages.value ?? []), H = P?.language ?? O(""), U = m(() => Object.fromEntries((s.value.facets ?? []).filter((e) => !e.options && e.type !== "year").map((e) => [e.key, { field: e.field ?? e.key }]))), W = de(l, U), ae = m(() => {
756
+ let e = {};
757
+ for (let t of s.value.facets ?? []) e[t.key] = t.options ?? W.value[t.key] ?? [];
758
+ return e;
759
+ }), se = [{
760
+ key: "AND",
761
+ label: "catalogue.search.and"
762
+ }, {
763
+ key: "OR",
764
+ label: "catalogue.search.or"
765
+ }], G = [
766
+ "catalogue.search.keywordOne",
767
+ "catalogue.search.keywordTwo",
768
+ "catalogue.search.keywordThree"
769
+ ], ce = m(() => s.value.operators ?? se), K = O(Array.from({ length: s.value.rows ?? 3 }, () => ({
770
+ keyword: "",
771
+ field: s.value.fields?.[0]?.key ?? "",
772
+ cond: (s.value.operators ?? se)[0].key
773
+ })));
774
+ function q(e) {
775
+ return G[e] ? a(G[e]) : "";
776
+ }
777
+ let J = O(s.value.facets?.[0]?.key ?? ""), Y = D(Object.fromEntries((s.value.facets ?? []).map((e) => [e.key, ""]))), X = D(Object.fromEntries((s.value.extras ?? []).map((e) => [e.key, !1])));
778
+ function le() {
779
+ let e = {};
780
+ for (let t of s.value.extras ?? []) X[t.key] && (e[t.key] = "1");
781
+ return e;
782
+ }
783
+ function Z(e) {
784
+ return o.push({
785
+ name: s.value.target,
786
+ query: e
787
+ });
788
+ }
789
+ function Q() {
790
+ let e = {};
791
+ if (c.value === "rows") K.value.forEach((t, n) => {
792
+ if (t.keyword) {
793
+ if (n === 0) e.q = t.keyword, t.field && (e.field = t.field);
794
+ else {
795
+ let r = n + 1;
796
+ e[`q${r}`] = t.keyword, t.field && (e[`field${r}`] = t.field), e[`op${r}`] = t.cond;
797
+ }
798
+ }
799
+ }), C.value && (e.from = String(C.value)), j.value && (e.to = String(j.value)), H.value && (e.lang = H.value);
800
+ else if (c.value === "radio") {
801
+ let t = J.value, n = t ? Y[t] : "";
802
+ n && (e[t] = String(n));
803
+ }
804
+ return Object.assign(e, le()), Z(e);
805
+ }
806
+ function ue(e, t) {
807
+ if (t !== "" && t != null) return Z({
808
+ [e]: String(t),
809
+ ...le()
810
+ });
811
+ }
812
+ function fe() {
813
+ return Z(le());
814
+ }
815
+ let me = m(() => c.value === "facets" ? "immediate" : "apply"), he = m(() => c.value === "radio" ? "core.action.browse" : "core.action.search"), $ = m(() => a(s.value.submitLabel ?? he.value)), ge = m(() => a(s.value.showAllLabel ?? "core.action.reset")), _e = m(() => ({
816
+ mode: c.value,
817
+ submit: Q,
818
+ showAll: fe
819
+ }));
820
+ return (e, t) => (E(), _("section", { class: w(["mwnf-search-form", `mwnf-search-form--${c.value}`]) }, [
821
+ A(e.$slots, "intro", T(x(_e.value))),
822
+ A(e.$slots, "before", T(x(_e.value))),
823
+ b(n, {
824
+ class: "mwnf-search-form__panel",
825
+ mode: me.value,
826
+ "apply-label": $.value,
827
+ "reset-label": ge.value,
828
+ onApply: Q,
829
+ onReset: fe
830
+ }, {
831
+ default: z(() => [
832
+ c.value === "rows" ? (E(), _(p, { key: 0 }, [
833
+ (E(!0), _(p, null, k(K.value, (e, t) => (E(), _("div", {
834
+ key: t,
835
+ class: "mwnf-search-form__row"
836
+ }, [
837
+ v("span", Ct, M(q(t)), 1),
838
+ t > 0 ? B((E(), _("select", {
839
+ key: 0,
840
+ "onUpdate:modelValue": (t) => e.cond = t,
841
+ class: "mwnf-facet__select mwnf-search-form__operator"
842
+ }, [(E(!0), _(p, null, k(ce.value, (e) => (E(), _("option", {
843
+ key: e.key,
844
+ value: e.key
845
+ }, M(N(a)(e.label)), 9, Tt))), 128))], 8, wt)), [[L, e.cond]]) : g("", !0),
846
+ B(v("select", {
847
+ "onUpdate:modelValue": (t) => e.field = t,
848
+ class: "mwnf-facet__select mwnf-search-form__field"
849
+ }, [(E(!0), _(p, null, k(s.value.fields ?? [], (e) => (E(), _("option", {
850
+ key: e.key,
851
+ value: e.key
852
+ }, M(N(a)(e.label)), 9, Dt))), 128))], 8, Et), [[L, e.field]]),
853
+ B(v("input", {
854
+ "onUpdate:modelValue": (t) => e.keyword = t,
855
+ type: "text",
856
+ class: "mwnf-search-form__keyword",
857
+ placeholder: N(a)("catalogue.search.keywordPlaceholder")
858
+ }, null, 8, Ot), [[R, e.keyword]])
859
+ ]))), 128)),
860
+ re.value ? (E(), _("div", kt, [b(r, {
861
+ modelValue: C.value,
862
+ "onUpdate:modelValue": t[0] ||= (e) => C.value = e,
863
+ label: N(a)("catalogue.facet.dateFrom"),
864
+ options: te.value,
865
+ "any-label": "—"
866
+ }, null, 8, [
867
+ "modelValue",
868
+ "label",
869
+ "options"
870
+ ]), b(r, {
871
+ modelValue: j.value,
872
+ "onUpdate:modelValue": t[1] ||= (e) => j.value = e,
873
+ label: N(a)("catalogue.facet.dateTo"),
874
+ options: ne.value,
875
+ "any-label": "—"
876
+ }, null, 8, [
877
+ "modelValue",
878
+ "label",
879
+ "options"
880
+ ])])) : g("", !0),
881
+ s.value.language ? (E(), _("label", At, [v("span", jt, M(N(a)("catalogue.search.language")), 1), B(v("select", {
882
+ "onUpdate:modelValue": t[2] ||= (e) => S(H) ? H.value = e : null,
883
+ class: "mwnf-facet__select mwnf-search-form__language"
884
+ }, [v("option", Mt, M(N(a)("catalogue.search.anyLanguage")), 1), (E(!0), _(p, null, k(V.value, (e) => (E(), _("option", {
885
+ key: e,
886
+ value: e
887
+ }, M(e.toUpperCase()), 9, Nt))), 128))], 512), [[L, N(H)]])])) : g("", !0)
888
+ ], 64)) : c.value === "facets" ? (E(), _(p, { key: 1 }, [(E(!0), _(p, null, k(s.value.facets ?? [], (e) => (E(), h(r, {
889
+ key: e.key,
890
+ label: e.label ? N(a)(e.label) : "",
891
+ options: ae.value[e.key] ?? [],
892
+ "model-value": Y[e.key],
893
+ "onUpdate:modelValue": (t) => ue(e.key, t)
894
+ }, null, 8, [
895
+ "label",
896
+ "options",
897
+ "model-value",
898
+ "onUpdate:modelValue"
899
+ ]))), 128)), re.value ? (E(), _("div", Pt, [b(r, {
900
+ "model-value": C.value,
901
+ label: N(a)("catalogue.facet.startDate"),
902
+ options: te.value,
903
+ "onUpdate:modelValue": t[3] ||= (e) => {
904
+ C.value = e, ue("from", e);
905
+ }
906
+ }, null, 8, [
907
+ "model-value",
908
+ "label",
909
+ "options"
910
+ ]), b(r, {
911
+ "model-value": j.value,
912
+ label: N(a)("catalogue.facet.endDate"),
913
+ options: ne.value,
914
+ "onUpdate:modelValue": t[4] ||= (e) => {
915
+ j.value = e, ue("to", e);
916
+ }
917
+ }, null, 8, [
918
+ "model-value",
919
+ "label",
920
+ "options"
921
+ ])])) : g("", !0)], 64)) : c.value === "radio" ? (E(!0), _(p, { key: 2 }, k(s.value.facets ?? [], (e) => (E(), _("div", {
922
+ key: e.key,
923
+ class: "mwnf-search-form__radio-row"
924
+ }, [v("label", Ft, [B(v("input", {
925
+ "onUpdate:modelValue": t[5] ||= (e) => J.value = e,
926
+ type: "radio",
927
+ name: "mwnf-search-form-filter",
928
+ value: e.key
929
+ }, null, 8, It), [[I, J.value]]), y(" " + M(e.label ? N(a)(e.label) : ""), 1)]), e.type === "year" ? B((E(), _("input", {
930
+ key: 1,
931
+ "onUpdate:modelValue": (t) => Y[e.key] = t,
932
+ type: "number",
933
+ class: "mwnf-search-form__year",
934
+ disabled: J.value !== e.key
935
+ }, null, 8, Lt)), [[R, Y[e.key]]]) : (E(), h(r, {
936
+ key: 0,
937
+ modelValue: Y[e.key],
938
+ "onUpdate:modelValue": (t) => Y[e.key] = t,
939
+ options: ae.value[e.key] ?? [],
940
+ disabled: J.value !== e.key
941
+ }, null, 8, [
942
+ "modelValue",
943
+ "onUpdate:modelValue",
944
+ "options",
945
+ "disabled"
946
+ ]))]))), 128)) : g("", !0),
947
+ (E(!0), _(p, null, k(s.value.extras ?? [], (e) => (E(), _("label", {
948
+ key: e.key,
949
+ class: "mwnf-facet mwnf-facet--checkbox"
950
+ }, [B(v("input", {
951
+ "onUpdate:modelValue": (t) => X[e.key] = t,
952
+ type: "checkbox",
953
+ class: "mwnf-facet__checkbox"
954
+ }, null, 8, Rt), [[F, X[e.key]]]), v("span", zt, M(N(a)(e.label)), 1)]))), 128)),
955
+ A(e.$slots, "extras", T(x(_e.value)))
956
+ ]),
957
+ _: 3
958
+ }, 8, [
959
+ "mode",
960
+ "apply-label",
961
+ "reset-label"
962
+ ]),
963
+ s.value.howTo ? (E(), _("p", Bt, [b(i, { to: { name: s.value.howTo } }, {
964
+ default: z(() => [y(M(N(a)("catalogue.search.howTo")), 1)]),
965
+ _: 1
966
+ }, 8, ["to"])])) : g("", !0),
967
+ A(e.$slots, "actions", T(x(_e.value)))
968
+ ], 2));
969
+ }
970
+ }, Ht = { class: "mwnf-timeline" }, Ut = {
971
+ key: 0,
972
+ class: "mwnf-timeline__title"
973
+ }, Wt = {
974
+ key: 3,
975
+ class: "mwnf-facet"
976
+ }, Gt = { class: "mwnf-facet__label" }, Kt = [
977
+ "value",
978
+ "placeholder",
979
+ "onInput"
980
+ ], qt = {
981
+ key: 1,
982
+ class: "mwnf-timeline__error"
983
+ }, Jt = {
984
+ __name: "TimelineResultsView",
985
+ props: { spec: {
986
+ type: Object,
987
+ required: !0
988
+ } },
989
+ setup(e) {
990
+ let t = e, { t: a } = pe(), o = Ce(), s = m(() => t.spec), c = m(() => !!s.value.entrance), l = be({
991
+ scope: t.spec.scope ?? "country",
992
+ countryLabel: t.spec.countryLabel,
993
+ countryIdForCode: t.spec.countryIdForCode,
994
+ tr: t.spec.tr,
995
+ timelinesEntity: t.spec.timelinesEntity,
996
+ eventsEntity: t.spec.eventsEntity
997
+ }), u = m(() => s.value.controls ?? []), f = m(() => s.value.keys ?? u.value.map((e) => e.key)), ee = (e) => u.value.some((t) => t.key === e), re = m(() => ({
998
+ t: a,
999
+ tr: t.spec.tr,
1000
+ years: {
1001
+ min: R.value[0],
1002
+ max: R.value[1]
1003
+ }
1004
+ })), S = D(Object.fromEntries(f.value.map((e) => [e, ""]))), C = O(""), w = c.value ? null : me({ keys: f.value }), j = c.value ? S : w.filters;
1005
+ function P(e) {
1006
+ if (ee("collection") && e !== "" && e != null) return e === "pc" ? null : e;
1007
+ }
1008
+ function F() {
1009
+ for (let e of f.value) S[e] = "";
1010
+ C.value = "";
1011
+ }
1012
+ function I() {
1013
+ C.value = "";
1014
+ let e = !!j.begin && !!j.end;
1015
+ if (e && Number(j.begin) >= Number(j.end)) {
1016
+ C.value = a(s.value.errorPeriod ?? "timeline.form.errorPeriod");
1017
+ return;
1018
+ }
1019
+ if (!j.country && !e) {
1020
+ C.value = a(s.value.errorSelect ?? "timeline.form.errorSelect");
1021
+ return;
1022
+ }
1023
+ let t = {};
1024
+ for (let e of f.value) j[e] && (t[e] = j[e]);
1025
+ o.push({
1026
+ name: s.value.route,
1027
+ query: t
1028
+ });
1029
+ }
1030
+ let L = m(() => {
1031
+ if (c.value) return [];
1032
+ let e = j;
1033
+ return l.findEvents({
1034
+ country: e.country || void 0,
1035
+ collection: P(e.collection),
1036
+ begin: e.begin,
1037
+ end: e.end
1038
+ });
1039
+ }), R = m(() => {
1040
+ let e = l.findEvents({
1041
+ country: void 0,
1042
+ collection: void 0
1043
+ }).map((e) => e.year_from).filter((e) => Number.isFinite(e) && e !== 0);
1044
+ return e.length ? [Math.min(...e), Math.max(...e)] : [null, null];
1045
+ }), B = $(L, {
1046
+ page: () => w ? w.page.value : 1,
1047
+ size: () => s.value.pageSize ?? 15
1048
+ });
1049
+ function V(e) {
1050
+ let t = s.value.countryLabel && e.country_id ? s.value.countryLabel(e.country_id) : "";
1051
+ return {
1052
+ id: e.id,
1053
+ date: se(e, e.text, a),
1054
+ caption: t ? Y(String(t)) : "",
1055
+ description: e.text?.description ? J(String(e.text.description), { breaks: !0 }) : ""
1056
+ };
1057
+ }
1058
+ let H = m(() => B.value.rows.map((e) => (s.value.event ?? V)(e, re.value))), U = m(() => (l.countries.value ?? []).map((e) => ({
1059
+ value: e.value,
1060
+ label: e.value === "all" ? a("timeline.form.allCountries") : e.label
1061
+ }))), ie = m(() => s.value.collections?.(re.value) ?? []), W = m(() => {
1062
+ let e = {};
1063
+ for (let t of u.value) (t.key === "begin" || t.key === "end") && t.options && (typeof t.options == "function" ? e[t.key] = t.options(re.value) : e[t.key] = t.options);
1064
+ return e;
1065
+ }), ae = m(() => ({
1066
+ filters: j,
1067
+ active: f.value.some((e) => j[e]),
1068
+ apply: c.value ? I : (e) => w.apply(e),
1069
+ reset: c.value ? F : w.reset,
1070
+ goToPage: c.value ? () => {} : w.goToPage,
1071
+ events: L.value,
1072
+ pageInfo: B.value,
1073
+ countries: U.value,
1074
+ collections: ie.value,
1075
+ t: a,
1076
+ tr: s.value.tr
1077
+ })), oe = m(() => {
1078
+ let e = s.value.gallery;
1079
+ return !e || c.value ? null : !e.items || e.items(ae.value);
1080
+ }), G = m(() => {
1081
+ let e = oe.value;
1082
+ return e == null ? !1 : Array.isArray(e) ? e.length > 0 : !!e;
1083
+ }), ce = m(() => {
1084
+ let e = oe.value;
1085
+ return Array.isArray(e) ? e.length : typeof e == "number" ? e : null;
1086
+ }), K = m(() => {
1087
+ if (!G.value) return null;
1088
+ let e = {};
1089
+ for (let t of f.value) j[t] && (e[t] = j[t]);
1090
+ return {
1091
+ to: {
1092
+ name: s.value.gallery.route,
1093
+ query: e
1094
+ },
1095
+ count: ce.value,
1096
+ label: a(s.value.gallery.label ?? "timeline.nav.seeGallery")
1097
+ };
1098
+ }), q = m(() => ({
1099
+ ...ae.value,
1100
+ gallery: K.value
1101
+ })), X = m(() => s.value.summary ? s.value.summary(q.value) : [{
1102
+ label: a(s.value.summaryLabel ?? "timeline.results.eventsFound"),
1103
+ count: B.value.total
1104
+ }]), le = m(() => a(s.value.empty ?? "timeline.results.noResults")), Z = m(() => ({
1105
+ window: 5,
1106
+ jump: !1,
1107
+ ends: !0,
1108
+ ...s.value.pagination ?? {}
1109
+ }));
1110
+ function Q(e, t) {
1111
+ return e.label ? a(e.label) : t ? a(t) : "";
1112
+ }
1113
+ return (e, t) => (E(), _("section", Ht, [
1114
+ A(e.$slots, "before", T(x(q.value))),
1115
+ s.value.title ? (E(), _("h1", Ut, M(N(a)(s.value.title)), 1)) : g("", !0),
1116
+ b(n, {
1117
+ class: "mwnf-timeline__filters",
1118
+ title: s.value.filterTitle ? N(a)(s.value.filterTitle) : "",
1119
+ "apply-label": c.value ? N(a)(s.value.submitLabel ?? "core.action.search") : s.value.applyLabel ? N(a)(s.value.applyLabel) : "",
1120
+ "reset-label": s.value.resetLabel ? N(a)(s.value.resetLabel) : "",
1121
+ onApply: t[2] ||= (e) => c.value ? I() : N(w).apply(),
1122
+ onReset: t[3] ||= (e) => c.value ? F() : N(w).reset()
1123
+ }, {
1124
+ default: z(() => [(E(!0), _(p, null, k(u.value, (e) => (E(), _(p, { key: e.key }, [e.key === "country" ? (E(), h(r, {
1125
+ key: 0,
1126
+ "model-value": N(j).country,
1127
+ label: Q(e, "catalogue.facet.country"),
1128
+ options: U.value,
1129
+ placeholder: e.placeholder ? N(a)(e.placeholder) : N(a)("timeline.form.selectCountry"),
1130
+ "any-label": e.anyLabel ? N(a)(e.anyLabel) : "",
1131
+ "hide-empty": !!e.hideEmpty,
1132
+ "onUpdate:modelValue": t[0] ||= (e) => N(j).country = e
1133
+ }, null, 8, [
1134
+ "model-value",
1135
+ "label",
1136
+ "options",
1137
+ "placeholder",
1138
+ "any-label",
1139
+ "hide-empty"
1140
+ ])) : e.key === "collection" ? (E(), h(r, {
1141
+ key: 1,
1142
+ "model-value": N(j).collection,
1143
+ label: Q(e),
1144
+ options: ie.value,
1145
+ placeholder: e.placeholder ? N(a)(e.placeholder) : "",
1146
+ "any-label": e.anyLabel ? N(a)(e.anyLabel) : "",
1147
+ "hide-empty": !!e.hideEmpty,
1148
+ "onUpdate:modelValue": t[1] ||= (e) => N(j).collection = e
1149
+ }, null, 8, [
1150
+ "model-value",
1151
+ "label",
1152
+ "options",
1153
+ "placeholder",
1154
+ "any-label",
1155
+ "hide-empty"
1156
+ ])) : (e.key === "begin" || e.key === "end") && W.value[e.key] ? (E(), h(r, {
1157
+ key: 2,
1158
+ "model-value": N(j)[e.key],
1159
+ label: Q(e, e.key === "begin" ? "timeline.form.startDate" : "timeline.form.endDate"),
1160
+ options: W.value[e.key],
1161
+ placeholder: e.placeholder ? N(a)(e.placeholder) : N(a)(e.key === "begin" ? "timeline.form.fromYearHint" : "timeline.form.toYearHint"),
1162
+ "any-label": e.anyLabel ? N(a)(e.anyLabel) : "",
1163
+ "hide-empty": !!e.hideEmpty,
1164
+ "onUpdate:modelValue": (t) => N(j)[e.key] = t
1165
+ }, null, 8, [
1166
+ "model-value",
1167
+ "label",
1168
+ "options",
1169
+ "placeholder",
1170
+ "any-label",
1171
+ "hide-empty",
1172
+ "onUpdate:modelValue"
1173
+ ])) : (E(), _("label", Wt, [v("span", Gt, M(Q(e, e.key === "begin" ? "timeline.form.startDate" : "timeline.form.endDate")), 1), v("input", {
1174
+ type: "number",
1175
+ class: "mwnf-facet__select",
1176
+ value: N(j)[e.key],
1177
+ placeholder: e.placeholder ? N(a)(e.placeholder) : N(a)(e.key === "begin" ? "timeline.form.fromYearHint" : "timeline.form.toYearHint"),
1178
+ onInput: (t) => N(j)[e.key] = t.target.value
1179
+ }, null, 40, Kt)]))], 64))), 128))]),
1180
+ _: 1
1181
+ }, 8, [
1182
+ "title",
1183
+ "apply-label",
1184
+ "reset-label"
1185
+ ]),
1186
+ c.value && C.value ? (E(), _("p", qt, M(C.value), 1)) : g("", !0),
1187
+ c.value ? g("", !0) : (E(), _(p, { key: 2 }, [
1188
+ A(e.$slots, "summary", T(x(q.value)), () => [b(ne, { parts: X.value }, null, 8, ["parts"])]),
1189
+ K.value ? (E(), h(i, {
1190
+ key: 0,
1191
+ class: "mwnf-timeline__gallery",
1192
+ to: K.value.to
1193
+ }, {
1194
+ default: z(() => [A(e.$slots, "cross-link", T(x(q.value)), () => [y(M(K.value.label), 1), K.value.count == null ? g("", !0) : (E(), _(p, { key: 0 }, [y(" (" + M(K.value.count) + ")", 1)], 64))])]),
1195
+ _: 3
1196
+ }, 8, ["to"])) : g("", !0),
1197
+ A(e.$slots, "event", T(x(q.value)), () => [b(te, { events: H.value }, {
1198
+ empty: z(() => [A(e.$slots, "empty", T(x(q.value)), () => [y(M(le.value), 1)])]),
1199
+ _: 3
1200
+ }, 8, ["events"])]),
1201
+ b(d, {
1202
+ "page-info": N(B),
1203
+ window: Z.value.window,
1204
+ jump: Z.value.jump,
1205
+ ends: Z.value.ends,
1206
+ onNavigate: N(w).goToPage
1207
+ }, null, 8, [
1208
+ "page-info",
1209
+ "window",
1210
+ "jump",
1211
+ "ends",
1212
+ "onNavigate"
1213
+ ])
1214
+ ], 64)),
1215
+ A(e.$slots, "after", T(x(q.value)))
1216
+ ]));
1217
+ }
1218
+ };
1219
+ //#endregion
1220
+ export { Ge as a, gt as i, Vt as n, Re as o, St as r, Jt as t };