@fxi/zartigl 0.10.2 → 0.10.4
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/catalog.d.ts +21 -0
- package/dist/catalog.js +24 -21
- package/dist/engine.d.ts +2 -0
- package/dist/{index-RrmAk1JY.js → index-CNtMu8AU.js} +161 -140
- package/dist/zartigl.d.ts +27 -0
- package/dist/zartigl.js +1275 -1170
- package/package.json +1 -1
package/dist/catalog.d.ts
CHANGED
|
@@ -138,6 +138,12 @@ export declare function compareVersions(a: string, b: string): number;
|
|
|
138
138
|
/** The keys of `style` whose value differs from `base`'s. */
|
|
139
139
|
export declare function diffStyle(style: LayerStyleInput, base: LayerStyle): LayerStyleInput;
|
|
140
140
|
|
|
141
|
+
/**
|
|
142
|
+
* The legend header of a layer: its title, the provider of the source
|
|
143
|
+
* `sourceId` (else of the first source naming one) and its description.
|
|
144
|
+
*/
|
|
145
|
+
export declare function entryHeader(entry: CatalogEntry, sourceId?: string, defaultLocale?: string): LegendHeader;
|
|
146
|
+
|
|
141
147
|
export declare function findCatalogEntries(selector: CatalogEntrySelector, data?: Catalog): CatalogEntry[];
|
|
142
148
|
|
|
143
149
|
export declare function formatTime(ms: number): string;
|
|
@@ -180,6 +186,13 @@ export declare interface LayerStyleInput {
|
|
|
180
186
|
raster?: Partial<RasterStyle>;
|
|
181
187
|
}
|
|
182
188
|
|
|
189
|
+
/** What a legend shows for a layer: its title, provider and description. */
|
|
190
|
+
export declare interface LegendHeader {
|
|
191
|
+
title: LocalizedText;
|
|
192
|
+
subtitle?: LocalizedText;
|
|
193
|
+
description?: LocalizedText;
|
|
194
|
+
}
|
|
195
|
+
|
|
183
196
|
/**
|
|
184
197
|
* The live catalog, or `fallback` (the bundled catalog) when it cannot be
|
|
185
198
|
* fetched or is not a schema 2 catalog. A catalog that needs a newer engine
|
|
@@ -262,6 +275,8 @@ export declare interface ParticleStyle {
|
|
|
262
275
|
grade: ParticleGrade;
|
|
263
276
|
/** Solid color under the trails; replaced as a whole, not merged. */
|
|
264
277
|
backdrop: BackdropStyle;
|
|
278
|
+
/** Halo of the trails' own color, [0, 1]; 0 is off. */
|
|
279
|
+
glow: number;
|
|
265
280
|
}
|
|
266
281
|
|
|
267
282
|
/** Partial particle style; a partial backdrop takes the defaults' keys. */
|
|
@@ -283,6 +298,12 @@ export declare function pickPreferredSource(entry: CatalogEntry, request?: Sourc
|
|
|
283
298
|
*/
|
|
284
299
|
export declare function pickSourceByPriority(entry: CatalogEntry, priority: readonly CatalogSource["type"][], request?: SourceTimeRequest): CatalogSource | undefined;
|
|
285
300
|
|
|
301
|
+
/** Display names of the `provenance.provider` slugs. */
|
|
302
|
+
export declare const PROVIDER_LABELS: Record<string, string>;
|
|
303
|
+
|
|
304
|
+
/** A provider's display name; an unknown slug is returned as is. */
|
|
305
|
+
export declare function providerLabel(provider: string): string;
|
|
306
|
+
|
|
286
307
|
/** A published catalog: the catalog plus the oldest engine that renders it all. */
|
|
287
308
|
export declare type PublishedCatalog = Catalog & {
|
|
288
309
|
minEngine?: string;
|
package/dist/catalog.js
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import { C as s, L as r, P as t,
|
|
1
|
+
import { C as s, L as r, P as t, h as o, R as l, i, j as y, g as L, k as S, l as E, n as c, o as g, q as T, t as d, m, a as n, p as C, e as R, d as _, u as f, v as p, r as A, w as v, c as Y, x as u, b as P, s as k } from "./index-CNtMu8AU.js";
|
|
2
2
|
export {
|
|
3
3
|
s as CATALOG_URL,
|
|
4
4
|
r as LAYER_STYLE_DEFAULTS,
|
|
5
5
|
t as PARTICLE_STYLE_KEYS,
|
|
6
|
-
o as
|
|
7
|
-
l as
|
|
8
|
-
i as
|
|
9
|
-
y as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
c as
|
|
14
|
-
g as
|
|
15
|
-
T as
|
|
16
|
-
|
|
6
|
+
o as PROVIDER_LABELS,
|
|
7
|
+
l as RASTER_STYLE_KEYS,
|
|
8
|
+
i as catalog,
|
|
9
|
+
y as compareVersions,
|
|
10
|
+
L as diffStyle,
|
|
11
|
+
S as entryHeader,
|
|
12
|
+
E as findCatalogEntries,
|
|
13
|
+
c as formatTime,
|
|
14
|
+
g as formatVertical,
|
|
15
|
+
T as getCatalogEntry,
|
|
16
|
+
d as loadCatalog,
|
|
17
|
+
m as mergeStyles,
|
|
18
|
+
n as migrateLegacyStyle,
|
|
17
19
|
C as parseLayerStyle,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
f as
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
R as pickPreferredSource,
|
|
21
|
+
_ as pickSourceByPriority,
|
|
22
|
+
f as providerLabel,
|
|
23
|
+
p as requireCatalogEntry,
|
|
24
|
+
A as resolveEntryStyle,
|
|
25
|
+
v as resolveLayerStyle,
|
|
26
|
+
Y as resolveLocalizedText,
|
|
27
|
+
u as searchCatalog,
|
|
28
|
+
P as sourceCoversTime,
|
|
29
|
+
k as styleForKind
|
|
27
30
|
};
|
package/dist/engine.d.ts
CHANGED
|
@@ -961,6 +961,8 @@ declare interface ParticleStyle {
|
|
|
961
961
|
grade: ParticleGrade;
|
|
962
962
|
/** Solid color under the trails; replaced as a whole, not merged. */
|
|
963
963
|
backdrop: BackdropStyle;
|
|
964
|
+
/** Halo of the trails' own color, [0, 1]; 0 is off. */
|
|
965
|
+
glow: number;
|
|
964
966
|
}
|
|
965
967
|
|
|
966
968
|
/** Partial particle style; a partial backdrop takes the defaults' keys. */
|
|
@@ -3,7 +3,7 @@ const O = 2, U = "en", G = /* @__PURE__ */ JSON.parse('[{"id":"61a81ddd-6c8e-402
|
|
|
3
3
|
schemaVersion: O,
|
|
4
4
|
defaultLocale: U,
|
|
5
5
|
layers: G
|
|
6
|
-
},
|
|
6
|
+
}, u = Object.freeze({
|
|
7
7
|
reversePalette: !1,
|
|
8
8
|
renderMode: "particles",
|
|
9
9
|
particles: Object.freeze({
|
|
@@ -11,7 +11,8 @@ const O = 2, U = "en", G = /* @__PURE__ */ JSON.parse('[{"id":"61a81ddd-6c8e-402
|
|
|
11
11
|
speed: 1,
|
|
12
12
|
fade: 0.7,
|
|
13
13
|
grade: "off",
|
|
14
|
-
backdrop: D
|
|
14
|
+
backdrop: D,
|
|
15
|
+
glow: 0
|
|
15
16
|
}),
|
|
16
17
|
raster: Object.freeze({
|
|
17
18
|
opacity: 1,
|
|
@@ -22,7 +23,7 @@ const O = 2, U = "en", G = /* @__PURE__ */ JSON.parse('[{"id":"61a81ddd-6c8e-402
|
|
|
22
23
|
alphaFadeHigh: 0,
|
|
23
24
|
alphaFadeCurve: "linear"
|
|
24
25
|
})
|
|
25
|
-
}), w = ["particles", "raster"],
|
|
26
|
+
}), w = ["particles", "raster"], g = (e) => Object.fromEntries(
|
|
26
27
|
Object.entries(e ?? {}).filter(([, a]) => a !== void 0)
|
|
27
28
|
), z = {
|
|
28
29
|
"heat-alert": { palette: "heat", raster: { alphaFadeLow: 0.25 } }
|
|
@@ -37,61 +38,62 @@ function A(e) {
|
|
|
37
38
|
}
|
|
38
39
|
function H(...e) {
|
|
39
40
|
const a = {
|
|
40
|
-
reversePalette:
|
|
41
|
-
renderMode:
|
|
42
|
-
particles: { ...
|
|
43
|
-
raster: { ...
|
|
41
|
+
reversePalette: u.reversePalette,
|
|
42
|
+
renderMode: u.renderMode,
|
|
43
|
+
particles: { ...u.particles },
|
|
44
|
+
raster: { ...u.raster }
|
|
44
45
|
};
|
|
45
|
-
for (const
|
|
46
|
-
const t = A(
|
|
47
|
-
t && (t.palette !== void 0 && (a.palette = t.palette), t.reversePalette !== void 0 && (a.reversePalette = t.reversePalette), t.renderMode !== void 0 && (a.renderMode = t.renderMode), Object.assign(a.particles,
|
|
46
|
+
for (const i of e) {
|
|
47
|
+
const t = A(i);
|
|
48
|
+
t && (t.palette !== void 0 && (a.palette = t.palette), t.reversePalette !== void 0 && (a.reversePalette = t.reversePalette), t.renderMode !== void 0 && (a.renderMode = t.renderMode), Object.assign(a.particles, g(t.particles)), Object.assign(a.raster, g(t.raster)));
|
|
48
49
|
}
|
|
49
|
-
const { grade:
|
|
50
|
-
return typeof
|
|
50
|
+
const { grade: o, backdrop: r } = a.particles;
|
|
51
|
+
return typeof o == "object" && (a.particles.grade = { ...o }), a.particles.backdrop = R(r), a;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function te(...e) {
|
|
53
54
|
const a = {};
|
|
54
|
-
for (const
|
|
55
|
-
const r = A(
|
|
55
|
+
for (const o of e) {
|
|
56
|
+
const r = A(o);
|
|
56
57
|
if (r) {
|
|
57
58
|
r.palette !== void 0 && (a.palette = r.palette), r.reversePalette !== void 0 && (a.reversePalette = r.reversePalette), r.renderMode !== void 0 && (a.renderMode = r.renderMode);
|
|
58
|
-
for (const
|
|
59
|
-
const t =
|
|
60
|
-
Object.keys(t).length && (a[
|
|
59
|
+
for (const i of w) {
|
|
60
|
+
const t = g(r[i]);
|
|
61
|
+
Object.keys(t).length && (a[i] = { ...a[i], ...t });
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
return a;
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
-
const
|
|
67
|
+
function ce(e, a) {
|
|
68
|
+
const o = (i, t) => JSON.stringify(i) === JSON.stringify(t), r = {};
|
|
68
69
|
e.palette !== void 0 && e.palette !== a.palette && (r.palette = e.palette), e.reversePalette !== void 0 && e.reversePalette !== a.reversePalette && (r.reversePalette = e.reversePalette), e.renderMode !== void 0 && e.renderMode !== a.renderMode && (r.renderMode = e.renderMode);
|
|
69
|
-
for (const
|
|
70
|
-
const t = Object.entries(
|
|
71
|
-
([c, n]) => !
|
|
70
|
+
for (const i of w) {
|
|
71
|
+
const t = Object.entries(g(e[i])).filter(
|
|
72
|
+
([c, n]) => !o(n, a[i][c])
|
|
72
73
|
);
|
|
73
|
-
t.length && (r[
|
|
74
|
+
t.length && (r[i] = Object.fromEntries(t));
|
|
74
75
|
}
|
|
75
76
|
return r;
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function de(e, a) {
|
|
78
79
|
if (a !== "scalar")
|
|
79
80
|
return e;
|
|
80
|
-
const { particles:
|
|
81
|
-
return r === "raster" ? { ...
|
|
81
|
+
const { particles: o, renderMode: r, ...i } = e;
|
|
82
|
+
return r === "raster" ? { ...i, renderMode: r } : i;
|
|
82
83
|
}
|
|
83
|
-
function
|
|
84
|
-
const
|
|
85
|
-
return e?.kind === "scalar" && (
|
|
84
|
+
function se(e, ...a) {
|
|
85
|
+
const o = H(e?.defaults, ...a);
|
|
86
|
+
return e?.kind === "scalar" && (o.renderMode = "raster"), o;
|
|
86
87
|
}
|
|
87
88
|
const M = [
|
|
88
89
|
"particles",
|
|
89
90
|
"raster",
|
|
90
91
|
"raster+particles"
|
|
91
|
-
], W = ["off", "vibrant"], E = ["linear", "log", "exp"], T = (e) => typeof e == "number" && Number.isFinite(e), p = (e, a,
|
|
92
|
+
], W = ["off", "vibrant"], E = ["linear", "log", "exp"], T = (e) => typeof e == "number" && Number.isFinite(e), p = (e, a, o = !1) => (r) => T(r) && (o ? r > e : r >= e) && r <= a, k = {
|
|
92
93
|
density: [p(0, 0.2, !0), "a number in (0, 0.2]"],
|
|
93
94
|
speed: [p(0, 10, !0), "a number in (0, 10]"],
|
|
94
95
|
fade: [p(0, 1), "a number in [0, 1]"],
|
|
96
|
+
glow: [p(0, 1), "a number in [0, 1]"],
|
|
95
97
|
grade: [
|
|
96
98
|
(e) => W.includes(e) || B(e),
|
|
97
99
|
`"off", "vibrant" or an object of ${Object.keys(v).join(", ")} in range`
|
|
@@ -118,57 +120,57 @@ const M = [
|
|
|
118
120
|
enabled: (e) => typeof e == "boolean",
|
|
119
121
|
color: x,
|
|
120
122
|
opacity: p(0, 1)
|
|
121
|
-
},
|
|
123
|
+
}, me = Object.keys(
|
|
122
124
|
k
|
|
123
|
-
),
|
|
125
|
+
), ne = Object.keys(
|
|
124
126
|
I
|
|
125
|
-
),
|
|
127
|
+
), h = (e) => typeof e == "object" && e !== null && !Array.isArray(e), B = (e) => h(e) && Object.entries(e).every(([a, o]) => {
|
|
126
128
|
const r = Object.prototype.hasOwnProperty.call(v, a) ? v[a] : void 0;
|
|
127
|
-
return r !== void 0 && p(r[0], r[1])(
|
|
128
|
-
}), V = (e) =>
|
|
129
|
-
([a,
|
|
129
|
+
return r !== void 0 && p(r[0], r[1])(o);
|
|
130
|
+
}), V = (e) => h(e) && Object.entries(e).every(
|
|
131
|
+
([a, o]) => Object.prototype.hasOwnProperty.call(P, a) && P[a](o)
|
|
130
132
|
);
|
|
131
133
|
function _(e) {
|
|
132
134
|
throw new Error(e);
|
|
133
135
|
}
|
|
134
|
-
function C(e, a,
|
|
135
|
-
|
|
136
|
+
function C(e, a, o, r, i) {
|
|
137
|
+
h(e) || _(`${a} must be an object`);
|
|
136
138
|
const t = {};
|
|
137
139
|
for (const [c, n] of Object.entries(e)) {
|
|
138
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
139
|
-
|
|
140
|
+
if (!Object.prototype.hasOwnProperty.call(o, c)) {
|
|
141
|
+
i(`${a}.${c}`);
|
|
140
142
|
continue;
|
|
141
143
|
}
|
|
142
144
|
r && !r.includes(c) && _(`${a}.${c} is not supported here`);
|
|
143
|
-
const [s, d] =
|
|
145
|
+
const [s, d] = o[c];
|
|
144
146
|
s(n) || _(`${a}.${c} must be ${d}`), t[c] = n;
|
|
145
147
|
}
|
|
146
148
|
return t;
|
|
147
149
|
}
|
|
148
|
-
function
|
|
149
|
-
const { kind: r, supports:
|
|
150
|
+
function _e(e, a, o = {}) {
|
|
151
|
+
const { kind: r, supports: i, unknownKeys: t = "throw" } = o, c = o.warn ?? ((d) => console.warn(d)), n = (d) => {
|
|
150
152
|
t === "throw" && _(`${d} is not a style key`), c(`${d} is not a style key of this zartigl version: ignored`);
|
|
151
153
|
};
|
|
152
|
-
|
|
154
|
+
h(e) || _(`${a} must be an object`);
|
|
153
155
|
const s = {};
|
|
154
156
|
for (const [d, l] of Object.entries(e)) {
|
|
155
157
|
const m = `${a}.${d}`;
|
|
156
158
|
switch (d) {
|
|
157
159
|
case "palette":
|
|
158
|
-
|
|
160
|
+
i && !i.palette && _(`${m} is not supported here`), (typeof l != "string" || !l) && _(`${m} must be a string`);
|
|
159
161
|
break;
|
|
160
162
|
case "reversePalette":
|
|
161
|
-
|
|
163
|
+
i && !i.palette && _(`${m} is not supported here`), typeof l != "boolean" && _(`${m} must be a boolean`);
|
|
162
164
|
break;
|
|
163
165
|
case "renderMode":
|
|
164
|
-
|
|
166
|
+
i && !i.renderMode && _(`${m} is not supported here`), M.includes(l) || _(`${m} must be one of ${M.join(", ")}`), r === "scalar" && l !== "raster" && _(`${m} must be "raster" on a scalar layer`);
|
|
165
167
|
break;
|
|
166
168
|
case "particles":
|
|
167
169
|
r === "scalar" && _(`${m} needs a vector layer`), s[d] = C(
|
|
168
170
|
l,
|
|
169
171
|
m,
|
|
170
172
|
k,
|
|
171
|
-
|
|
173
|
+
i && (i.particles ?? []),
|
|
172
174
|
n
|
|
173
175
|
);
|
|
174
176
|
continue;
|
|
@@ -177,7 +179,7 @@ function me(e, a, i = {}) {
|
|
|
177
179
|
l,
|
|
178
180
|
m,
|
|
179
181
|
I,
|
|
180
|
-
|
|
182
|
+
i && (i.raster ?? []),
|
|
181
183
|
n
|
|
182
184
|
);
|
|
183
185
|
continue;
|
|
@@ -189,28 +191,28 @@ function me(e, a, i = {}) {
|
|
|
189
191
|
}
|
|
190
192
|
return A(s);
|
|
191
193
|
}
|
|
192
|
-
const S = "0.10.
|
|
194
|
+
const S = "0.10.4", N = { "maplibre-gl": "^5.17.0" }, le = {
|
|
193
195
|
version: S,
|
|
194
196
|
devDependencies: N
|
|
195
197
|
}, F = "https://sos-ch-gva-2.exo.io/mapx-zartigl/catalog/v2/catalog.json";
|
|
196
198
|
function q(e, a) {
|
|
197
|
-
const
|
|
199
|
+
const o = (t) => t.split(/[.-]/).slice(0, 3).map((c) => Number(c) || 0), [r, i] = [o(e), o(a)];
|
|
198
200
|
for (let t = 0; t < 3; t++)
|
|
199
|
-
if (r[t] !==
|
|
200
|
-
return r[t] <
|
|
201
|
+
if (r[t] !== i[t])
|
|
202
|
+
return r[t] < i[t] ? -1 : 1;
|
|
201
203
|
return 0;
|
|
202
204
|
}
|
|
203
205
|
function j(e) {
|
|
204
206
|
const a = e;
|
|
205
207
|
return typeof a == "object" && a !== null && a.schemaVersion === 2 && Array.isArray(a.layers);
|
|
206
208
|
}
|
|
207
|
-
async function
|
|
209
|
+
async function pe(e = F, a = {}) {
|
|
208
210
|
const {
|
|
209
|
-
timeoutMs:
|
|
211
|
+
timeoutMs: o = 5e3,
|
|
210
212
|
fallback: r = L,
|
|
211
|
-
warn:
|
|
213
|
+
warn: i = (s) => console.warn(s),
|
|
212
214
|
fetch: t = globalThis.fetch
|
|
213
|
-
} = a, c = new AbortController(), n = setTimeout(() => c.abort(),
|
|
215
|
+
} = a, c = new AbortController(), n = setTimeout(() => c.abort(), o);
|
|
214
216
|
try {
|
|
215
217
|
const s = await t(e, { signal: c.signal });
|
|
216
218
|
if (!s.ok)
|
|
@@ -218,67 +220,83 @@ async function _e(e = F, a = {}) {
|
|
|
218
220
|
const d = await s.json();
|
|
219
221
|
if (!j(d))
|
|
220
222
|
throw new Error("not a schema 2 catalog");
|
|
221
|
-
return d.minEngine && q(S, d.minEngine) < 0 &&
|
|
223
|
+
return d.minEngine && q(S, d.minEngine) < 0 && i(
|
|
222
224
|
`[zartigl] the catalog at ${e} needs zartigl ${d.minEngine}; this is ${S}: newer style keys are ignored`
|
|
223
225
|
), { catalog: d, source: "remote" };
|
|
224
226
|
} catch (s) {
|
|
225
|
-
return
|
|
227
|
+
return i(
|
|
226
228
|
`[zartigl] live catalog unavailable (${s instanceof Error ? s.message : String(s)}): using the bundled catalog`
|
|
227
229
|
), { catalog: r, source: "bundled" };
|
|
228
230
|
} finally {
|
|
229
231
|
clearTimeout(n);
|
|
230
232
|
}
|
|
231
233
|
}
|
|
232
|
-
const
|
|
233
|
-
function
|
|
234
|
+
const f = L;
|
|
235
|
+
function b(e, a, o = "en") {
|
|
234
236
|
if (!e)
|
|
235
237
|
return "";
|
|
236
238
|
const r = a.toLowerCase().split("-")[0];
|
|
237
|
-
return e[a] ?? e[r] ?? e[
|
|
239
|
+
return e[a] ?? e[r] ?? e[o] ?? Object.values(e)[0] ?? "";
|
|
240
|
+
}
|
|
241
|
+
const Z = {
|
|
242
|
+
"copernicus-marine": "Copernicus Marine Service",
|
|
243
|
+
"copernicus-atmosphere": "Copernicus Atmosphere Monitoring Service",
|
|
244
|
+
"noaa-coral-reef-watch": "NOAA Coral Reef Watch"
|
|
245
|
+
};
|
|
246
|
+
function $(e) {
|
|
247
|
+
return Z[e] ?? e;
|
|
248
|
+
}
|
|
249
|
+
function fe(e, a = e.defaults.sourceId, o = f.defaultLocale) {
|
|
250
|
+
const r = (e.sources.find((i) => i.id === a)?.provenance ?? e.sources.find((i) => i.provenance)?.provenance)?.provider;
|
|
251
|
+
return {
|
|
252
|
+
title: e.title,
|
|
253
|
+
...r ? { subtitle: { [o]: $(r) } } : {},
|
|
254
|
+
...e.description ? { description: e.description } : {}
|
|
255
|
+
};
|
|
238
256
|
}
|
|
239
|
-
function
|
|
240
|
-
return a.layers.find((
|
|
257
|
+
function K(e, a = f) {
|
|
258
|
+
return a.layers.find((o) => o.id === e);
|
|
241
259
|
}
|
|
242
|
-
function
|
|
243
|
-
const
|
|
244
|
-
if (!
|
|
260
|
+
function ue(e, a = f) {
|
|
261
|
+
const o = K(e, a);
|
|
262
|
+
if (!o)
|
|
245
263
|
throw new Error(`Unknown zartigl catalog entry: ${e}`);
|
|
246
|
-
return
|
|
264
|
+
return o;
|
|
247
265
|
}
|
|
248
|
-
const
|
|
266
|
+
const J = [
|
|
249
267
|
"geovideo",
|
|
250
268
|
"zarr",
|
|
251
269
|
"wmts"
|
|
252
|
-
],
|
|
253
|
-
function
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
270
|
+
], X = ["geovideo", "zarr"];
|
|
271
|
+
function Q(e, a = {}) {
|
|
272
|
+
const o = e.temporal;
|
|
273
|
+
if (o?.mode !== "fixed")
|
|
256
274
|
return !0;
|
|
257
|
-
const r =
|
|
258
|
-
return a.time != null && (a.time < r || a.time >
|
|
275
|
+
const r = o.start ? Date.parse(o.start) : -1 / 0, i = o.end ? Date.parse(o.end) : 1 / 0;
|
|
276
|
+
return a.time != null && (a.time < r || a.time > i) ? !1 : (a.start ?? -1 / 0) <= i && (a.end ?? 1 / 0) >= r;
|
|
259
277
|
}
|
|
260
|
-
function
|
|
261
|
-
return
|
|
278
|
+
function be(e, a) {
|
|
279
|
+
return ee(
|
|
262
280
|
e,
|
|
263
|
-
e.kind === "vector" ?
|
|
281
|
+
e.kind === "vector" ? X : J,
|
|
264
282
|
a
|
|
265
283
|
) ?? e.sources[0];
|
|
266
284
|
}
|
|
267
|
-
function
|
|
285
|
+
function ee(e, a, o) {
|
|
268
286
|
const r = e.sources.filter(
|
|
269
|
-
(
|
|
287
|
+
(i) => Q(i, o)
|
|
270
288
|
);
|
|
271
|
-
for (const
|
|
289
|
+
for (const i of [r, e.sources])
|
|
272
290
|
for (const t of a) {
|
|
273
|
-
const c =
|
|
291
|
+
const c = i.filter((n) => n.type === t);
|
|
274
292
|
if (c.length)
|
|
275
|
-
return
|
|
293
|
+
return ae(c);
|
|
276
294
|
}
|
|
277
295
|
}
|
|
278
|
-
function
|
|
279
|
-
const a = (
|
|
296
|
+
function ae(e) {
|
|
297
|
+
const a = (o) => o.temporal?.mode === "fixed" && o.temporal.end ? Date.parse(o.temporal.end) : 1 / 0;
|
|
280
298
|
return e.reduce(
|
|
281
|
-
(
|
|
299
|
+
(o, r) => a(r) > a(o) ? r : o
|
|
282
300
|
);
|
|
283
301
|
}
|
|
284
302
|
function Y(e) {
|
|
@@ -289,46 +307,46 @@ function Y(e) {
|
|
|
289
307
|
(a) => !!a
|
|
290
308
|
);
|
|
291
309
|
}
|
|
292
|
-
function
|
|
293
|
-
return a.layers.filter((
|
|
294
|
-
([
|
|
310
|
+
function re(e, a = f) {
|
|
311
|
+
return a.layers.filter((o) => e.category && o.category !== e.category ? !1 : o.sources.some((r) => e.sourceType && r.type !== e.sourceType || e.provider && r.provenance?.provider !== e.provider || e.variableId && !Y(r).includes(e.variableId) ? !1 : !e.identifiers || Object.entries(e.identifiers).every(
|
|
312
|
+
([i, t]) => r.provenance?.identifiers?.[i] === t
|
|
295
313
|
)));
|
|
296
314
|
}
|
|
297
|
-
function
|
|
298
|
-
const r = e.sources.flatMap((
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
...Object.entries(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
...
|
|
307
|
-
...
|
|
315
|
+
function oe(e, a, o) {
|
|
316
|
+
const r = e.sources.flatMap((i) => [
|
|
317
|
+
i.id,
|
|
318
|
+
i.type,
|
|
319
|
+
b(i.title, a, o),
|
|
320
|
+
i.provenance?.provider,
|
|
321
|
+
...Object.entries(i.provenance?.identifiers ?? {}).flat(),
|
|
322
|
+
i.temporal?.cadence,
|
|
323
|
+
i.temporal?.mode,
|
|
324
|
+
...i.type === "zarr" ? Y(i) : [],
|
|
325
|
+
...i.type === "wmts" ? [i.layer] : []
|
|
308
326
|
]);
|
|
309
327
|
return [
|
|
310
328
|
e.id,
|
|
311
|
-
|
|
312
|
-
|
|
329
|
+
b(e.title, a, o),
|
|
330
|
+
b(e.description, a, o),
|
|
313
331
|
e.category,
|
|
314
332
|
...e.aliases ?? [],
|
|
315
333
|
...e.tags ?? [],
|
|
316
334
|
...r
|
|
317
335
|
].filter(Boolean).join(" ").toLocaleLowerCase(a);
|
|
318
336
|
}
|
|
319
|
-
function
|
|
320
|
-
const r = a.locale ??
|
|
321
|
-
return
|
|
322
|
-
const n =
|
|
323
|
-
if (!
|
|
337
|
+
function ge(e, a = {}, o = f) {
|
|
338
|
+
const r = a.locale ?? o.defaultLocale, i = e.trim().toLocaleLowerCase(r).split(/\s+/).filter(Boolean);
|
|
339
|
+
return re(a, o).map((t, c) => {
|
|
340
|
+
const n = oe(t, r, o.defaultLocale);
|
|
341
|
+
if (!i.every((m) => n.includes(m)))
|
|
324
342
|
return null;
|
|
325
|
-
const s =
|
|
343
|
+
const s = b(
|
|
326
344
|
t.title,
|
|
327
345
|
r,
|
|
328
|
-
|
|
346
|
+
o.defaultLocale
|
|
329
347
|
).toLocaleLowerCase(r), d = (t.aliases ?? []).map(
|
|
330
348
|
(m) => m.toLocaleLowerCase(r)
|
|
331
|
-
), l =
|
|
349
|
+
), l = i.reduce(
|
|
332
350
|
(m, y) => m + (s === y ? 100 : d.includes(y) ? 50 : s.includes(y) ? 20 : 1),
|
|
333
351
|
0
|
|
334
352
|
);
|
|
@@ -337,40 +355,43 @@ function fe(e, a = {}, i = h) {
|
|
|
337
355
|
(t) => !!t
|
|
338
356
|
).sort((t, c) => c.score - t.score || t.index - c.index).map(({ entry: t }) => t);
|
|
339
357
|
}
|
|
340
|
-
function
|
|
341
|
-
const a = new Date(e),
|
|
342
|
-
return `${a.getUTCFullYear()}-${
|
|
358
|
+
function he(e) {
|
|
359
|
+
const a = new Date(e), o = (r) => String(r).padStart(2, "0");
|
|
360
|
+
return `${a.getUTCFullYear()}-${o(a.getUTCMonth() + 1)}-${o(
|
|
343
361
|
a.getUTCDate()
|
|
344
|
-
)} ${
|
|
362
|
+
)} ${o(a.getUTCHours())}:${o(a.getUTCMinutes())} UTC`;
|
|
345
363
|
}
|
|
346
|
-
function
|
|
347
|
-
const r =
|
|
364
|
+
function ye(e, a, o) {
|
|
365
|
+
const r = o?.trim();
|
|
348
366
|
return a === "pressure" ? `${Math.round(e)} ${r || "hPa"}` : r && r !== "m" ? `${Number(e.toPrecision(5))} ${r}` : e < 10 ? `${e.toFixed(2)} m` : e < 100 ? `${e.toFixed(1)} m` : `${Math.round(e)} m`;
|
|
349
367
|
}
|
|
350
368
|
export {
|
|
351
369
|
F as C,
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
370
|
+
u as L,
|
|
371
|
+
me as P,
|
|
372
|
+
ne as R,
|
|
355
373
|
A as a,
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
h,
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
374
|
+
Q as b,
|
|
375
|
+
b as c,
|
|
376
|
+
ee as d,
|
|
377
|
+
be as e,
|
|
378
|
+
le as f,
|
|
379
|
+
ce as g,
|
|
380
|
+
Z as h,
|
|
381
|
+
f as i,
|
|
382
|
+
q as j,
|
|
383
|
+
fe as k,
|
|
384
|
+
re as l,
|
|
385
|
+
te as m,
|
|
386
|
+
he as n,
|
|
387
|
+
ye as o,
|
|
388
|
+
_e as p,
|
|
389
|
+
K as q,
|
|
390
|
+
se as r,
|
|
391
|
+
de as s,
|
|
392
|
+
pe as t,
|
|
393
|
+
$ as u,
|
|
394
|
+
ue as v,
|
|
395
|
+
H as w,
|
|
396
|
+
ge as x
|
|
376
397
|
};
|