col-browser 2.2.1 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/es/chunks/DatasetlogoWithFallback-B9WXvNCA.js +24 -0
- package/es/chunks/DatasetlogoWithFallback-B9WXvNCA.js.map +1 -0
- package/es/chunks/Distributions-CLwWAH98.js +1139 -0
- package/es/chunks/{Distributions-CXIEJ6e6.js.map → Distributions-CLwWAH98.js.map} +1 -1
- package/es/chunks/{MetricsPresentation-U_CO8JoH.js → MetricsPresentation-DKCJQOtf.js} +2 -2
- package/es/chunks/{MetricsPresentation-U_CO8JoH.js.map → MetricsPresentation-DKCJQOtf.js.map} +1 -1
- package/es/chunks/{DatasetlogoWithFallback-CbP7vRs_.js → PresentationItem-C4yZ555-.js} +243 -262
- package/es/chunks/PresentationItem-C4yZ555-.js.map +1 -0
- package/es/sourceDataset.js +57 -56
- package/es/sourceDataset.js.map +1 -1
- package/es/sourceDatasetList.js +5 -4
- package/es/sourceDatasetList.js.map +1 -1
- package/es/taxon.js +18 -13
- package/es/taxon.js.map +1 -1
- package/es/taxonDistribution.js +1 -1
- package/es/tree.js +60 -57
- package/es/tree.js.map +1 -1
- package/package.json +2 -2
- package/types/index.d.ts +6 -0
- package/umd/col-browser.js +139 -128
- package/umd/col-browser.js.map +1 -1
- package/umd/col-browser.min.js +4 -4
- package/umd/col-browser.min.js.map +1 -1
- package/es/chunks/DatasetlogoWithFallback-CbP7vRs_.js.map +0 -1
- package/es/chunks/Distributions-CXIEJ6e6.js +0 -1131
|
@@ -1,1131 +0,0 @@
|
|
|
1
|
-
var tt = Object.defineProperty;
|
|
2
|
-
var nt = (e, n, r) => n in e ? tt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
|
|
3
|
-
var Z = (e, n, r) => nt(e, typeof n != "symbol" ? n + "" : n, r);
|
|
4
|
-
import { j as s } from "./jsx-runtime-BzflLqGi.js";
|
|
5
|
-
import * as Ne from "react";
|
|
6
|
-
import rt, { useState as L, useRef as G, useMemo as ne, useEffect as N } from "react";
|
|
7
|
-
import { Spin as st, Popover as ot, Radio as le } from "antd";
|
|
8
|
-
import { isArray as we, get as $, keyBy as it, startCase as at } from "lodash-es";
|
|
9
|
-
import { c as te, p as ct } from "./router-CssZk5qZ.js";
|
|
10
|
-
import { c as A } from "./config-BPRXv9x8.js";
|
|
11
|
-
import { E as lt } from "./ErrorMsg-K8k5PPTp.js";
|
|
12
|
-
import { I as dt } from "./AntdIcon-B1nMlqyh.js";
|
|
13
|
-
import { M as ut } from "./MergedDataBadge-DsTsn5Xu.js";
|
|
14
|
-
import D from "maplibre-gl";
|
|
15
|
-
import "maplibre-gl/dist/maplibre-gl.css";
|
|
16
|
-
import { r as pt, w as ft } from "./storage-BgdCo9fV.js";
|
|
17
|
-
var ht = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-260 72h96v209.9L621.5 312 572 347.4V136zm220 752H232V136h280v296.9c0 3.3 1 6.6 3 9.3a15.9 15.9 0 0022.3 3.7l83.8-59.9 81.4 59.4c2.7 2 6 3.1 9.4 3.1 8.8 0 16-7.2 16-16V136h64v752z" } }] }, name: "book", theme: "outlined" };
|
|
18
|
-
function fe() {
|
|
19
|
-
return fe = Object.assign ? Object.assign.bind() : function(e) {
|
|
20
|
-
for (var n = 1; n < arguments.length; n++) {
|
|
21
|
-
var r = arguments[n];
|
|
22
|
-
for (var i in r)
|
|
23
|
-
Object.prototype.hasOwnProperty.call(r, i) && (e[i] = r[i]);
|
|
24
|
-
}
|
|
25
|
-
return e;
|
|
26
|
-
}, fe.apply(this, arguments);
|
|
27
|
-
}
|
|
28
|
-
const gt = (e, n) => /* @__PURE__ */ Ne.createElement(dt, fe({}, e, {
|
|
29
|
-
ref: n,
|
|
30
|
-
icon: ht
|
|
31
|
-
})), _e = /* @__PURE__ */ Ne.forwardRef(gt);
|
|
32
|
-
process.env.NODE_ENV !== "production" && (_e.displayName = "BookOutlined");
|
|
33
|
-
class mt extends rt.Component {
|
|
34
|
-
constructor(r) {
|
|
35
|
-
super(r);
|
|
36
|
-
Z(this, "getData", () => {
|
|
37
|
-
const { referenceId: r, datasetKey: i, references: o } = this.props;
|
|
38
|
-
if (r) {
|
|
39
|
-
const c = we(r) ? r : [r], f = [];
|
|
40
|
-
this.setState({ loading: !0 }), Promise.allSettled(
|
|
41
|
-
c.map(
|
|
42
|
-
(u) => $(o, u) ? Promise.resolve(f.push(o[u])) : te(
|
|
43
|
-
`${A.dataApi}dataset/${i}/reference/${u}`
|
|
44
|
-
).then((a) => f.push(a.data)).catch((a) => this.setState({ error: a }))
|
|
45
|
-
)
|
|
46
|
-
).then(() => this.setState({ reference: f, loading: !1 }));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
Z(this, "getContent", () => {
|
|
50
|
-
const { error: r, reference: i, loading: o } = this.state;
|
|
51
|
-
return o ? /* @__PURE__ */ s.jsx(st, {}) : r ? /* @__PURE__ */ s.jsx(lt, { error: r }) : i.length === 1 ? i[0].citation : /* @__PURE__ */ s.jsx("ul", { children: i.map((c) => /* @__PURE__ */ s.jsx("li", { children: c.citation }, c.id)) });
|
|
52
|
-
});
|
|
53
|
-
Z(this, "scrollToReference", (r, i) => {
|
|
54
|
-
const o = document.getElementById(`col-reference-${i}`);
|
|
55
|
-
o && (r.preventDefault(), o.scrollIntoView({ behavior: "smooth", block: "start" }));
|
|
56
|
-
});
|
|
57
|
-
Z(this, "render", () => {
|
|
58
|
-
const { referenceId: r, referenceIndexMap: i, trigger: o } = this.props, c = we(r) ? r : [r];
|
|
59
|
-
let f = i && $(i, c[0]) ? c.map((u) => /* @__PURE__ */ s.jsx(
|
|
60
|
-
"a",
|
|
61
|
-
{
|
|
62
|
-
className: "col-reference-link",
|
|
63
|
-
href: `#col-reference-${u}`,
|
|
64
|
-
onClick: (a) => this.scrollToReference(a, u),
|
|
65
|
-
children: `[${i[u]}]`
|
|
66
|
-
},
|
|
67
|
-
u
|
|
68
|
-
)) : /* @__PURE__ */ s.jsx(_e, { style: { cursor: "pointer" } });
|
|
69
|
-
return r ? /* @__PURE__ */ s.jsx("div", { id: `reference_${r}`, style: this.props.style, children: /* @__PURE__ */ s.jsx(
|
|
70
|
-
ot,
|
|
71
|
-
{
|
|
72
|
-
getPopupContainer: () => document.getElementById(`reference_${r}`),
|
|
73
|
-
placement: this.props.placement || "left",
|
|
74
|
-
title: "Reference",
|
|
75
|
-
onOpenChange: (u) => u && this.getData(),
|
|
76
|
-
content: /* @__PURE__ */ s.jsx("div", { style: { maxWidth: "500px" }, children: this.getContent() }),
|
|
77
|
-
trigger: o || "hover",
|
|
78
|
-
children: f
|
|
79
|
-
}
|
|
80
|
-
) }, `reference_${r}`) : "";
|
|
81
|
-
});
|
|
82
|
-
this.state = {
|
|
83
|
-
reference: [],
|
|
84
|
-
loading: !1,
|
|
85
|
-
error: null
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const se = [
|
|
90
|
-
"subspecies",
|
|
91
|
-
"variety",
|
|
92
|
-
"subvariety",
|
|
93
|
-
"form",
|
|
94
|
-
"subform",
|
|
95
|
-
"infraspecific name"
|
|
96
|
-
], $e = (e, n) => {
|
|
97
|
-
const r = n.indexOf(e);
|
|
98
|
-
return r === -1 ? [] : se.filter((i) => n.indexOf(i) > r);
|
|
99
|
-
}, yt = 16, bt = (e) => {
|
|
100
|
-
var n, r;
|
|
101
|
-
return ((n = e == null ? void 0 : e.area) == null ? void 0 : n.gazetteer) !== "text" && !!((r = e == null ? void 0 : e.area) != null && r.globalId);
|
|
102
|
-
}, xt = async (e, n, r) => {
|
|
103
|
-
const i = new Array(e.length);
|
|
104
|
-
let o = 0;
|
|
105
|
-
const c = Array.from({ length: Math.min(r, e.length) }, async () => {
|
|
106
|
-
for (; ; ) {
|
|
107
|
-
const f = o++;
|
|
108
|
-
if (f >= e.length) return;
|
|
109
|
-
i[f] = await n(e[f], f);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
return await Promise.all(c), i;
|
|
113
|
-
}, vt = async (e, n, r) => {
|
|
114
|
-
var u;
|
|
115
|
-
if (r.length === 0) return [];
|
|
116
|
-
const i = new URLSearchParams();
|
|
117
|
-
i.append("TAXON_ID", n), r.forEach((a) => i.append("rank", a)), ["accepted", "provisionally accepted"].forEach(
|
|
118
|
-
(a) => i.append("status", a)
|
|
119
|
-
), i.append("limit", "1000");
|
|
120
|
-
const o = `${A.dataApi}dataset/${e}/nameusage/search?${i}`, c = await te(o);
|
|
121
|
-
return (((u = c == null ? void 0 : c.data) == null ? void 0 : u.result) || []).filter((a) => {
|
|
122
|
-
var p;
|
|
123
|
-
return (p = a == null ? void 0 : a.usage) == null ? void 0 : p.id;
|
|
124
|
-
}).map((a) => {
|
|
125
|
-
var p, w, j, k, C, S;
|
|
126
|
-
return {
|
|
127
|
-
id: a.usage.id,
|
|
128
|
-
scientificName: ((w = (p = a.usage) == null ? void 0 : p.name) == null ? void 0 : w.scientificName) || ((j = a.usage) == null ? void 0 : j.label) || a.usage.id,
|
|
129
|
-
rank: (C = (k = a.usage) == null ? void 0 : k.name) == null ? void 0 : C.rank,
|
|
130
|
-
parentId: (S = a.usage) == null ? void 0 : S.parentId
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
}, jt = async (e, n) => {
|
|
134
|
-
const r = `${A.dataApi}dataset/${e}/taxon/${encodeURIComponent(n)}/distribution`;
|
|
135
|
-
try {
|
|
136
|
-
const i = await te(r);
|
|
137
|
-
return Array.isArray(i == null ? void 0 : i.data) ? i.data : [];
|
|
138
|
-
} catch {
|
|
139
|
-
return [];
|
|
140
|
-
}
|
|
141
|
-
}, St = async ({ datasetKey: e, focalTaxon: n, rankOrder: r }) => {
|
|
142
|
-
var a;
|
|
143
|
-
const i = $e((a = n == null ? void 0 : n.name) == null ? void 0 : a.rank, r);
|
|
144
|
-
let o = !1, c = [];
|
|
145
|
-
try {
|
|
146
|
-
c = await vt(e, n.id, i);
|
|
147
|
-
} catch {
|
|
148
|
-
return o = !0, { taxa: [], descendantsFailed: o };
|
|
149
|
-
}
|
|
150
|
-
const f = await xt(
|
|
151
|
-
c,
|
|
152
|
-
(p) => jt(e, p.id),
|
|
153
|
-
yt
|
|
154
|
-
);
|
|
155
|
-
return { taxa: c.map((p, w) => {
|
|
156
|
-
const j = f[w] || [];
|
|
157
|
-
return { ...p, distributions: j, mappable: j.filter(bt) };
|
|
158
|
-
}), descendantsFailed: o };
|
|
159
|
-
}, Le = [
|
|
160
|
-
"#E58606",
|
|
161
|
-
"#5D69B1",
|
|
162
|
-
"#52BCA3",
|
|
163
|
-
"#99C945",
|
|
164
|
-
"#CC61B0",
|
|
165
|
-
"#24796C",
|
|
166
|
-
"#DAA51B",
|
|
167
|
-
"#2F8AC4",
|
|
168
|
-
"#764E9F",
|
|
169
|
-
"#ED645A",
|
|
170
|
-
"#CC3A8E",
|
|
171
|
-
"#A5AA99"
|
|
172
|
-
], ke = (e, n) => {
|
|
173
|
-
const r = n.indexOf(e);
|
|
174
|
-
return r === -1 ? n.length : r;
|
|
175
|
-
}, It = (e, n) => {
|
|
176
|
-
const r = [...e].sort((o, c) => {
|
|
177
|
-
const f = ke(o.rank, n), u = ke(c.rank, n);
|
|
178
|
-
return f !== u ? f - u : o.scientificName.localeCompare(c.scientificName);
|
|
179
|
-
}), i = {};
|
|
180
|
-
return r.forEach((o, c) => {
|
|
181
|
-
i[o.id] = Le[c % Le.length];
|
|
182
|
-
}), i;
|
|
183
|
-
}, wt = {
|
|
184
|
-
position: "absolute",
|
|
185
|
-
bottom: 8,
|
|
186
|
-
left: 8,
|
|
187
|
-
zIndex: 1e3,
|
|
188
|
-
background: "#fff",
|
|
189
|
-
borderRadius: 4,
|
|
190
|
-
boxShadow: "0 1px 4px rgba(0,0,0,0.2)",
|
|
191
|
-
padding: "6px 8px",
|
|
192
|
-
fontSize: 12,
|
|
193
|
-
lineHeight: 1.5,
|
|
194
|
-
maxWidth: 260
|
|
195
|
-
}, Lt = {
|
|
196
|
-
maxHeight: 240,
|
|
197
|
-
overflowY: "auto"
|
|
198
|
-
}, Ae = {
|
|
199
|
-
fontWeight: 600,
|
|
200
|
-
marginTop: 4
|
|
201
|
-
}, kt = {
|
|
202
|
-
...Ae,
|
|
203
|
-
marginTop: 0
|
|
204
|
-
}, Pe = {
|
|
205
|
-
display: "flex",
|
|
206
|
-
alignItems: "center",
|
|
207
|
-
gap: 6,
|
|
208
|
-
paddingLeft: 4
|
|
209
|
-
}, Ct = (e) => ({
|
|
210
|
-
display: "inline-block",
|
|
211
|
-
width: 12,
|
|
212
|
-
height: 12,
|
|
213
|
-
background: e,
|
|
214
|
-
border: "1px solid rgba(0,0,0,0.15)",
|
|
215
|
-
borderRadius: 2,
|
|
216
|
-
flex: "0 0 auto"
|
|
217
|
-
}), Rt = {
|
|
218
|
-
marginTop: 6,
|
|
219
|
-
cursor: "pointer",
|
|
220
|
-
color: "#1890ff",
|
|
221
|
-
fontSize: 11
|
|
222
|
-
}, Et = {
|
|
223
|
-
marginTop: 4,
|
|
224
|
-
borderTop: "1px solid #eee",
|
|
225
|
-
paddingTop: 4,
|
|
226
|
-
color: "#666"
|
|
227
|
-
}, Oe = {
|
|
228
|
-
fontWeight: 600,
|
|
229
|
-
marginTop: 4
|
|
230
|
-
}, Bt = {
|
|
231
|
-
...Oe,
|
|
232
|
-
marginTop: 0
|
|
233
|
-
}, Ft = {
|
|
234
|
-
fontStyle: "italic",
|
|
235
|
-
paddingLeft: 4
|
|
236
|
-
}, Ce = (e) => e.reduce((n, r) => n + r.taxa.length, 0), Gt = () => /* @__PURE__ */ s.jsxs("div", { style: Pe, children: [
|
|
237
|
-
/* @__PURE__ */ s.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ s.jsx(
|
|
238
|
-
"polygon",
|
|
239
|
-
{
|
|
240
|
-
points: "3,1 9,1 11,6 9,11 3,11 1,6",
|
|
241
|
-
fill: "#de1e6e",
|
|
242
|
-
stroke: "rgba(0,0,0,0.25)",
|
|
243
|
-
strokeWidth: "0.75"
|
|
244
|
-
}
|
|
245
|
-
) }),
|
|
246
|
-
/* @__PURE__ */ s.jsx("span", { children: "GBIF occurrences" })
|
|
247
|
-
] }), Mt = ({ visibleGroups: e, unmappableGroups: n, showGbif: r }) => {
|
|
248
|
-
const [i, o] = L(!1), c = Ce(e), f = Ce(n);
|
|
249
|
-
return c === 0 && f === 0 && !r ? null : /* @__PURE__ */ s.jsxs("div", { style: wt, children: [
|
|
250
|
-
/* @__PURE__ */ s.jsxs("div", { style: Lt, children: [
|
|
251
|
-
e.map((u, a) => /* @__PURE__ */ s.jsxs("div", { children: [
|
|
252
|
-
/* @__PURE__ */ s.jsx("div", { style: a === 0 ? kt : Ae, children: u.label }),
|
|
253
|
-
u.taxa.map((p) => /* @__PURE__ */ s.jsxs("div", { style: Pe, children: [
|
|
254
|
-
/* @__PURE__ */ s.jsx("span", { style: Ct(p.color) }),
|
|
255
|
-
/* @__PURE__ */ s.jsx("span", { style: { fontStyle: "italic" }, children: p.displayName || p.scientificName })
|
|
256
|
-
] }, p.id))
|
|
257
|
-
] }, u.rank)),
|
|
258
|
-
r && /* @__PURE__ */ s.jsx(Gt, {})
|
|
259
|
-
] }),
|
|
260
|
-
f > 0 && /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
261
|
-
/* @__PURE__ */ s.jsxs(
|
|
262
|
-
"div",
|
|
263
|
-
{
|
|
264
|
-
style: Rt,
|
|
265
|
-
onClick: () => o((u) => !u),
|
|
266
|
-
children: [
|
|
267
|
-
i ? "− Hide" : "+",
|
|
268
|
-
" ",
|
|
269
|
-
f,
|
|
270
|
-
" without map data"
|
|
271
|
-
]
|
|
272
|
-
}
|
|
273
|
-
),
|
|
274
|
-
i && /* @__PURE__ */ s.jsx("div", { style: Et, children: n.map((u, a) => /* @__PURE__ */ s.jsxs("div", { children: [
|
|
275
|
-
/* @__PURE__ */ s.jsx(
|
|
276
|
-
"div",
|
|
277
|
-
{
|
|
278
|
-
style: a === 0 ? Bt : Oe,
|
|
279
|
-
children: u.label
|
|
280
|
-
}
|
|
281
|
-
),
|
|
282
|
-
u.taxa.map((p) => /* @__PURE__ */ s.jsx("div", { style: Ft, children: p.displayName || p.scientificName }, p.id))
|
|
283
|
-
] }, u.rank)) })
|
|
284
|
-
] })
|
|
285
|
-
] });
|
|
286
|
-
}, Nt = [
|
|
287
|
-
"establishmentMeans",
|
|
288
|
-
"degreeOfEstablishment",
|
|
289
|
-
"pathway",
|
|
290
|
-
"threatStatus",
|
|
291
|
-
"year",
|
|
292
|
-
"lifeStage"
|
|
293
|
-
], De = [
|
|
294
|
-
{ key: "nativeendemic", label: "Native endemic", color: "#0F8554" },
|
|
295
|
-
{ key: "native", label: "Native", color: "#87C55F" },
|
|
296
|
-
{ key: "nativereintroduced", label: "Native reintroduced", color: "#C9DB74" },
|
|
297
|
-
{ key: "introduced", label: "Introduced", color: "#FE88B1" },
|
|
298
|
-
{
|
|
299
|
-
key: "introducedassistedcolonisation",
|
|
300
|
-
label: "Introduced assisted colonisation",
|
|
301
|
-
color: "#DCB0F2"
|
|
302
|
-
},
|
|
303
|
-
{ key: "vagrant", label: "Vagrant", color: "#F6CF71" },
|
|
304
|
-
{ key: "uncertain", label: "Uncertain", color: "#8BE0A4" }
|
|
305
|
-
], ze = Object.fromEntries(
|
|
306
|
-
De.map((e) => [e.key, e.color])
|
|
307
|
-
), oe = "#66C5CC", _t = (e) => String(e || "").toLowerCase().replace(/[^a-z]/g, ""), He = (e) => {
|
|
308
|
-
const n = e == null ? void 0 : e.establishmentMeans;
|
|
309
|
-
if (n == null || n === "") return null;
|
|
310
|
-
const r = _t(n);
|
|
311
|
-
return ze[r] ? r : "uncertain";
|
|
312
|
-
}, $t = (e) => {
|
|
313
|
-
const n = He(e);
|
|
314
|
-
return n == null ? oe : ze[n];
|
|
315
|
-
}, At = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json", Ve = "gbif-visible", Pt = (e) => pt(Ve, e), Re = (e) => ft(Ve, e), Ot = "/v2/map/occurrence/density/{z}/{x}/{y}@1x.png?srs=EPSG%3A3857&style=iNaturalist.poly&bin=hex&hexPerTile=64&hasCoordinate=true&hasGeospatialIssue=false&occurrenceStatus=PRESENT&checklistKey={checklistKey}&taxonKey={taxonKey}", X = "col-focal-distributions", U = "col-focal-fill", de = "col-focal-line", re = "col-gbif-occurrences", M = "col-gbif-occurrences", ue = (e) => `col-descendant-${e}`, J = (e) => `col-descendant-fill-${e}`, Q = (e) => `col-descendant-line-${e}`, pe = /* @__PURE__ */ new Map(), Ee = (e, n) => {
|
|
316
|
-
const r = `${e}:${n}`;
|
|
317
|
-
if (pe.has(r)) return pe.get(r);
|
|
318
|
-
const i = `${A.dataApi}vocab/area/${r}`, o = te(i, {
|
|
319
|
-
headers: { Accept: "application/geo+json" }
|
|
320
|
-
}).then(
|
|
321
|
-
(c) => c.data,
|
|
322
|
-
() => null
|
|
323
|
-
);
|
|
324
|
-
return pe.set(r, o), o;
|
|
325
|
-
}, ee = (e) => String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), Ue = (e) => {
|
|
326
|
-
var i, o;
|
|
327
|
-
const n = ((i = e == null ? void 0 : e.area) == null ? void 0 : i.name) || ((o = e == null ? void 0 : e.area) == null ? void 0 : o.globalId) || "", r = Nt.map((c) => [c, e == null ? void 0 : e[c]]).filter(([, c]) => c != null && c !== "").map(
|
|
328
|
-
([c, f]) => `<div><strong>${ee(c)}:</strong> ${ee(f)}</div>`
|
|
329
|
-
).join("");
|
|
330
|
-
return `<div style="min-width:180px"><div style="font-weight:600;margin-bottom:4px">${ee(
|
|
331
|
-
n
|
|
332
|
-
)}</div>${r}</div>`;
|
|
333
|
-
}, Dt = (e, n) => `<div style="font-weight:600;font-style:italic;margin-bottom:4px">${ee(
|
|
334
|
-
e.scientificName
|
|
335
|
-
)}</div><div style="color:#888;margin-bottom:4px">${ee(e.rank || "")}</div>` + Ue(n), zt = {
|
|
336
|
-
subspecies: "subspecies",
|
|
337
|
-
variety: "varieties",
|
|
338
|
-
subvariety: "subvarieties",
|
|
339
|
-
form: "forms",
|
|
340
|
-
subform: "subforms",
|
|
341
|
-
"infraspecific name": "infraspecific names"
|
|
342
|
-
}, Be = (e) => zt[e] || e, We = (e) => {
|
|
343
|
-
if (!e) return "";
|
|
344
|
-
const n = e.trim().split(/\s+/);
|
|
345
|
-
return n[n.length - 1];
|
|
346
|
-
}, Ht = () => /* @__PURE__ */ s.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
347
|
-
/* @__PURE__ */ s.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ s.jsx(
|
|
348
|
-
"polygon",
|
|
349
|
-
{
|
|
350
|
-
points: "3,1 9,1 11,6 9,11 3,11 1,6",
|
|
351
|
-
fill: "#de1e6e",
|
|
352
|
-
stroke: "rgba(0,0,0,0.25)",
|
|
353
|
-
strokeWidth: "0.75"
|
|
354
|
-
}
|
|
355
|
-
) }),
|
|
356
|
-
/* @__PURE__ */ s.jsx("span", { children: "GBIF occurrences" })
|
|
357
|
-
] }), Vt = (e) => {
|
|
358
|
-
var f;
|
|
359
|
-
let n = 1 / 0, r = 1 / 0, i = -1 / 0, o = -1 / 0;
|
|
360
|
-
const c = (u) => {
|
|
361
|
-
if (typeof u[0] == "number") {
|
|
362
|
-
const [a, p] = u;
|
|
363
|
-
a < n && (n = a), a > i && (i = a), p < r && (r = p), p > o && (o = p);
|
|
364
|
-
} else
|
|
365
|
-
for (let a = 0; a < u.length; a++) c(u[a]);
|
|
366
|
-
};
|
|
367
|
-
for (let u = 0; u < e.length; u++) {
|
|
368
|
-
const a = (f = e[u]) == null ? void 0 : f.geometry;
|
|
369
|
-
a != null && a.coordinates && c(a.coordinates);
|
|
370
|
-
}
|
|
371
|
-
return n === 1 / 0 ? null : [
|
|
372
|
-
[n, r],
|
|
373
|
-
[i, o]
|
|
374
|
-
];
|
|
375
|
-
}, Fe = (e) => e ? e.type === "FeatureCollection" ? e.features || [] : [e] : [], Ge = () => {
|
|
376
|
-
var e;
|
|
377
|
-
return typeof ((e = D) == null ? void 0 : e.supported) == "function" ? D.supported() : typeof WebGLRenderingContext < "u";
|
|
378
|
-
}, Ut = ({
|
|
379
|
-
records: e,
|
|
380
|
-
onUnmappable: n,
|
|
381
|
-
datasetKey: r,
|
|
382
|
-
focalTaxon: i,
|
|
383
|
-
rankOrder: o,
|
|
384
|
-
gbifChecklistKey: c,
|
|
385
|
-
// true | null → show GBIF layer; false → GBIF API returned 0 occurrences,
|
|
386
|
-
// grey out the toggle and skip loading tiles. Defaults to true so the
|
|
387
|
-
// component works without the count check.
|
|
388
|
-
gbifAvailable: f = !0
|
|
389
|
-
}) => {
|
|
390
|
-
var Ie;
|
|
391
|
-
const u = G(null), a = G(null), p = G(null), w = G(/* @__PURE__ */ new Map()), j = G(/* @__PURE__ */ new Map()), k = G(/* @__PURE__ */ new Map()), C = G(!1), S = G(!1), R = G(/* @__PURE__ */ new Set()), [I, P] = L(!1), [E, _] = L(!1), [y, m] = L({
|
|
392
|
-
status: "idle",
|
|
393
|
-
// idle | loading | ready | empty | error
|
|
394
|
-
taxa: []
|
|
395
|
-
}), [z, O] = L(!0), W = !!c && (!e || e.length === 0), [B, he] = L(
|
|
396
|
-
() => Pt(!0)
|
|
397
|
-
), [K, ge] = L(/* @__PURE__ */ new Set()), [Ke, me] = L(!1), ie = G(!1), Te = () => {
|
|
398
|
-
he((t) => {
|
|
399
|
-
const d = !t;
|
|
400
|
-
return Re(d), d;
|
|
401
|
-
});
|
|
402
|
-
}, ye = () => {
|
|
403
|
-
he(!0), Re(!0);
|
|
404
|
-
}, be = ne(() => {
|
|
405
|
-
if (!(e != null && e.length)) return [];
|
|
406
|
-
const t = /* @__PURE__ */ new Set();
|
|
407
|
-
return e.forEach((d) => {
|
|
408
|
-
const l = He(d);
|
|
409
|
-
l != null && t.add(l);
|
|
410
|
-
}), De.filter((d) => t.has(d.key));
|
|
411
|
-
}, [e]), T = ne(() => y.status !== "ready" ? {} : It(
|
|
412
|
-
y.taxa.filter((t) => t.mappable.length > 0),
|
|
413
|
-
o || []
|
|
414
|
-
), [y, o]), ae = ne(() => {
|
|
415
|
-
if (y.status !== "ready")
|
|
416
|
-
return { visibleGroups: [], unmappableGroups: [] };
|
|
417
|
-
const t = (h) => ({
|
|
418
|
-
...h,
|
|
419
|
-
color: T[h.id],
|
|
420
|
-
displayName: We(h.scientificName)
|
|
421
|
-
}), d = (h) => {
|
|
422
|
-
const x = {};
|
|
423
|
-
return h.forEach((b) => {
|
|
424
|
-
(x[b.rank] = x[b.rank] || []).push(t(b));
|
|
425
|
-
}), se.filter((b) => x[b]).map((b) => ({
|
|
426
|
-
rank: b,
|
|
427
|
-
label: Be(b),
|
|
428
|
-
taxa: x[b]
|
|
429
|
-
}));
|
|
430
|
-
}, l = d(
|
|
431
|
-
y.taxa.filter(
|
|
432
|
-
(h) => h.mappable.length > 0 && K.has(h.id)
|
|
433
|
-
)
|
|
434
|
-
), g = d(
|
|
435
|
-
y.taxa.filter((h) => h.mappable.length === 0)
|
|
436
|
-
);
|
|
437
|
-
return { visibleGroups: l, unmappableGroups: g };
|
|
438
|
-
}, [y, T, K]), xe = ae.visibleGroups.length > 0;
|
|
439
|
-
N(() => {
|
|
440
|
-
if (!u.current || a.current || !Ge()) return;
|
|
441
|
-
const t = new D.Map({
|
|
442
|
-
container: u.current,
|
|
443
|
-
style: At,
|
|
444
|
-
center: [0, 20],
|
|
445
|
-
zoom: 1,
|
|
446
|
-
minZoom: 0,
|
|
447
|
-
attributionControl: !1,
|
|
448
|
-
renderWorldCopies: !0
|
|
449
|
-
});
|
|
450
|
-
t.addControl(
|
|
451
|
-
new D.AttributionControl({ compact: !0 }),
|
|
452
|
-
"bottom-right"
|
|
453
|
-
), t.addControl(
|
|
454
|
-
new D.NavigationControl({ showCompass: !1 }),
|
|
455
|
-
"top-left"
|
|
456
|
-
), a.current = t, t.on("load", () => {
|
|
457
|
-
P(!0);
|
|
458
|
-
const l = t.getContainer().querySelector(".maplibregl-ctrl-attrib");
|
|
459
|
-
l && l.classList.remove("maplibregl-compact-show");
|
|
460
|
-
});
|
|
461
|
-
const d = typeof ResizeObserver < "u" ? new ResizeObserver(() => t.resize()) : null;
|
|
462
|
-
return d && d.observe(u.current), () => {
|
|
463
|
-
d && d.disconnect(), p.current && (p.current.remove(), p.current = null), t.remove(), a.current = null, C.current = !1, S.current = !1, R.current = /* @__PURE__ */ new Set();
|
|
464
|
-
};
|
|
465
|
-
}, []), N(() => {
|
|
466
|
-
if (!I || !(e != null && e.length)) return;
|
|
467
|
-
const t = a.current;
|
|
468
|
-
if (!t) return;
|
|
469
|
-
let d = !1;
|
|
470
|
-
return _(!1), Promise.allSettled(
|
|
471
|
-
e.map(
|
|
472
|
-
(l) => Ee(l.area.gazetteer, l.area.id).then((g) => ({
|
|
473
|
-
record: l,
|
|
474
|
-
geojson: g
|
|
475
|
-
}))
|
|
476
|
-
)
|
|
477
|
-
).then((l) => {
|
|
478
|
-
if (d) return;
|
|
479
|
-
const g = [], h = /* @__PURE__ */ new Map();
|
|
480
|
-
let x = 0;
|
|
481
|
-
l.forEach((v, F) => {
|
|
482
|
-
if (v.status !== "fulfilled" || !v.value.geojson) {
|
|
483
|
-
x += 1;
|
|
484
|
-
return;
|
|
485
|
-
}
|
|
486
|
-
const { record: H, geojson: V } = v.value, ce = $t(H), Y = `focal-${F}`;
|
|
487
|
-
h.set(Y, H), Fe(V).forEach((q) => {
|
|
488
|
-
g.push({
|
|
489
|
-
...q,
|
|
490
|
-
properties: {
|
|
491
|
-
...q.properties || {},
|
|
492
|
-
_recordKey: Y,
|
|
493
|
-
_color: ce
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
});
|
|
497
|
-
}), w.current = h;
|
|
498
|
-
const b = { type: "FeatureCollection", features: g };
|
|
499
|
-
if (t.getSource(X))
|
|
500
|
-
t.getSource(X).setData(b);
|
|
501
|
-
else {
|
|
502
|
-
const v = t.getLayer(M) ? M : void 0;
|
|
503
|
-
t.addSource(X, { type: "geojson", data: b }), t.addLayer(
|
|
504
|
-
{
|
|
505
|
-
id: U,
|
|
506
|
-
type: "fill",
|
|
507
|
-
source: X,
|
|
508
|
-
paint: {
|
|
509
|
-
"fill-color": ["coalesce", ["get", "_color"], oe],
|
|
510
|
-
"fill-opacity": 0.65
|
|
511
|
-
}
|
|
512
|
-
},
|
|
513
|
-
v
|
|
514
|
-
), t.addLayer(
|
|
515
|
-
{
|
|
516
|
-
id: de,
|
|
517
|
-
type: "line",
|
|
518
|
-
source: X,
|
|
519
|
-
paint: {
|
|
520
|
-
"line-color": ["coalesce", ["get", "_color"], oe],
|
|
521
|
-
"line-width": 1
|
|
522
|
-
}
|
|
523
|
-
},
|
|
524
|
-
v
|
|
525
|
-
), t.on("click", U, Ye), t.on("mouseenter", U, ve), t.on("mouseleave", U, je), C.current = !0;
|
|
526
|
-
}
|
|
527
|
-
if (g.length > 0) {
|
|
528
|
-
const v = Vt(g);
|
|
529
|
-
v && t.fitBounds(v, { padding: 20, animate: !1 });
|
|
530
|
-
}
|
|
531
|
-
typeof n == "function" && n(x), _(!0);
|
|
532
|
-
}), () => {
|
|
533
|
-
d = !0;
|
|
534
|
-
};
|
|
535
|
-
}, [I, e]);
|
|
536
|
-
const Ye = (t) => {
|
|
537
|
-
var x, b;
|
|
538
|
-
const d = a.current;
|
|
539
|
-
if (!d) return;
|
|
540
|
-
const l = (x = t.features) == null ? void 0 : x[0], g = (b = l == null ? void 0 : l.properties) == null ? void 0 : b._recordKey, h = g ? w.current.get(g) : null;
|
|
541
|
-
h && (p.current && p.current.remove(), p.current = new D.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(Ue(h)).addTo(d));
|
|
542
|
-
}, ve = () => {
|
|
543
|
-
const t = a.current;
|
|
544
|
-
t && (t.getCanvas().style.cursor = "pointer");
|
|
545
|
-
}, je = () => {
|
|
546
|
-
const t = a.current;
|
|
547
|
-
t && (t.getCanvas().style.cursor = "");
|
|
548
|
-
};
|
|
549
|
-
N(() => {
|
|
550
|
-
const t = a.current;
|
|
551
|
-
if (!t || !C.current) return;
|
|
552
|
-
const d = z ? "visible" : "none";
|
|
553
|
-
t.getLayer(U) && t.setLayoutProperty(U, "visibility", d), t.getLayer(de) && t.setLayoutProperty(de, "visibility", d);
|
|
554
|
-
}, [z, E]), N(() => {
|
|
555
|
-
if (!I) return;
|
|
556
|
-
const t = a.current;
|
|
557
|
-
if (!t || ((() => {
|
|
558
|
-
t.getLayer(M) && t.removeLayer(M), t.getSource(re) && t.removeSource(re), S.current = !1;
|
|
559
|
-
})(), !c || !(i != null && i.id)) || f === !1) return;
|
|
560
|
-
const l = (A.gbifApi + Ot).replace("{checklistKey}", encodeURIComponent(c)).replace("{taxonKey}", encodeURIComponent(i.id)), g = A.gbifPortal + "/occurrence/search?checklist_key=" + encodeURIComponent(c) + "&taxon_key=" + encodeURIComponent(i.id);
|
|
561
|
-
t.addSource(re, {
|
|
562
|
-
type: "raster",
|
|
563
|
-
tiles: [l],
|
|
564
|
-
tileSize: 256,
|
|
565
|
-
attribution: '<a href="' + g + '" target="_blank" rel="noopener">GBIF</a> occurrence data'
|
|
566
|
-
}), t.addLayer({
|
|
567
|
-
id: M,
|
|
568
|
-
type: "raster",
|
|
569
|
-
source: re,
|
|
570
|
-
paint: { "raster-opacity": 0.9 },
|
|
571
|
-
layout: { visibility: B ? "visible" : "none" }
|
|
572
|
-
}), S.current = !0;
|
|
573
|
-
}, [I, c, i == null ? void 0 : i.id, f]), N(() => {
|
|
574
|
-
const t = a.current;
|
|
575
|
-
if (!t || !S.current) return;
|
|
576
|
-
const d = B ? "visible" : "none";
|
|
577
|
-
t.getLayer(M) && t.setLayoutProperty(M, "visibility", d);
|
|
578
|
-
}, [B]), N(() => {
|
|
579
|
-
if (!I) return;
|
|
580
|
-
const t = a.current;
|
|
581
|
-
if (!t || (R.current.forEach((l) => {
|
|
582
|
-
t.getLayer(J(l)) && t.removeLayer(J(l)), t.getLayer(Q(l)) && t.removeLayer(Q(l)), t.getSource(ue(l)) && t.removeSource(ue(l));
|
|
583
|
-
}), R.current = /* @__PURE__ */ new Set(), j.current = /* @__PURE__ */ new Map(), k.current = /* @__PURE__ */ new Map(), y.status !== "ready")) return;
|
|
584
|
-
const d = T;
|
|
585
|
-
y.taxa.forEach((l) => {
|
|
586
|
-
l.mappable.length !== 0 && (j.current.set(l.id, l), Promise.allSettled(
|
|
587
|
-
l.mappable.map(
|
|
588
|
-
(g) => Ee(g.area.gazetteer, g.area.id).then((h) => ({
|
|
589
|
-
record: g,
|
|
590
|
-
geojson: h
|
|
591
|
-
}))
|
|
592
|
-
)
|
|
593
|
-
).then((g) => {
|
|
594
|
-
if (!a.current) return;
|
|
595
|
-
const h = [];
|
|
596
|
-
g.forEach((F, H) => {
|
|
597
|
-
if (F.status !== "fulfilled" || !F.value.geojson) return;
|
|
598
|
-
const { record: V, geojson: ce } = F.value, Y = `desc-${l.id}-${H}`;
|
|
599
|
-
k.current.set(Y, { taxon: l, record: V }), Fe(ce).forEach((q) => {
|
|
600
|
-
h.push({
|
|
601
|
-
...q,
|
|
602
|
-
properties: {
|
|
603
|
-
...q.properties || {},
|
|
604
|
-
_recordKey: Y
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
});
|
|
608
|
-
});
|
|
609
|
-
const x = d[l.id] || oe, b = { type: "FeatureCollection", features: h }, v = ue(l.id);
|
|
610
|
-
if (a.current.getSource(v))
|
|
611
|
-
a.current.getSource(v).setData(b);
|
|
612
|
-
else {
|
|
613
|
-
a.current.addSource(v, { type: "geojson", data: b });
|
|
614
|
-
const F = J(l.id), H = Q(l.id), V = a.current.getLayer(M) ? M : void 0;
|
|
615
|
-
a.current.addLayer(
|
|
616
|
-
{
|
|
617
|
-
id: F,
|
|
618
|
-
type: "fill",
|
|
619
|
-
source: v,
|
|
620
|
-
paint: { "fill-color": x, "fill-opacity": 0.55 },
|
|
621
|
-
layout: { visibility: "none" }
|
|
622
|
-
},
|
|
623
|
-
V
|
|
624
|
-
), a.current.addLayer(
|
|
625
|
-
{
|
|
626
|
-
id: H,
|
|
627
|
-
type: "line",
|
|
628
|
-
source: v,
|
|
629
|
-
paint: { "line-color": x, "line-width": 2 },
|
|
630
|
-
layout: { visibility: "none" }
|
|
631
|
-
},
|
|
632
|
-
V
|
|
633
|
-
), a.current.on("click", F, qe), a.current.on("mouseenter", F, ve), a.current.on("mouseleave", F, je), R.current.add(l.id);
|
|
634
|
-
}
|
|
635
|
-
}));
|
|
636
|
-
});
|
|
637
|
-
}, [I, y, T]);
|
|
638
|
-
const qe = (t) => {
|
|
639
|
-
var x, b;
|
|
640
|
-
const d = a.current;
|
|
641
|
-
if (!d) return;
|
|
642
|
-
const l = (x = t.features) == null ? void 0 : x[0], g = (b = l == null ? void 0 : l.properties) == null ? void 0 : b._recordKey, h = g ? k.current.get(g) : null;
|
|
643
|
-
h && (p.current && p.current.remove(), p.current = new D.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(Dt(h.taxon, h.record)).addTo(d));
|
|
644
|
-
};
|
|
645
|
-
N(() => {
|
|
646
|
-
const t = a.current;
|
|
647
|
-
t && R.current.forEach((d) => {
|
|
648
|
-
const l = K.has(d) ? "visible" : "none";
|
|
649
|
-
t.getLayer(J(d)) && t.setLayoutProperty(J(d), "visibility", l), t.getLayer(Q(d)) && t.setLayoutProperty(Q(d), "visibility", l);
|
|
650
|
-
});
|
|
651
|
-
}, [K, y]);
|
|
652
|
-
const Se = () => {
|
|
653
|
-
var l;
|
|
654
|
-
if (ie.current || !r || !i || !o) return;
|
|
655
|
-
const t = (l = i == null ? void 0 : i.name) == null ? void 0 : l.rank;
|
|
656
|
-
!t || t !== "species" && !se.includes(t) || $e(t, o).length === 0 || (ie.current = !0, m({ status: "loading", taxa: [] }), St({ datasetKey: r, focalTaxon: i, rankOrder: o }).then(
|
|
657
|
-
({ taxa: g, descendantsFailed: h }) => {
|
|
658
|
-
if (h) {
|
|
659
|
-
m({ status: "error", taxa: [] });
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
|
-
if (g.length === 0) {
|
|
663
|
-
m({ status: "empty", taxa: [] });
|
|
664
|
-
return;
|
|
665
|
-
}
|
|
666
|
-
m({ status: "ready", taxa: g });
|
|
667
|
-
}
|
|
668
|
-
));
|
|
669
|
-
}, Ze = () => {
|
|
670
|
-
me(!0), Se();
|
|
671
|
-
}, Xe = ne(() => {
|
|
672
|
-
if (y.status !== "ready") return [];
|
|
673
|
-
const t = {};
|
|
674
|
-
return y.taxa.filter((d) => d.mappable.length > 0).forEach((d) => {
|
|
675
|
-
(t[d.rank] = t[d.rank] || []).push(d);
|
|
676
|
-
}), se.filter((d) => t[d]).map((d) => ({
|
|
677
|
-
rank: d,
|
|
678
|
-
label: Be(d),
|
|
679
|
-
taxa: t[d].slice().sort(
|
|
680
|
-
(l, g) => l.scientificName.localeCompare(g.scientificName)
|
|
681
|
-
)
|
|
682
|
-
}));
|
|
683
|
-
}, [y]), Je = (t) => {
|
|
684
|
-
ge((d) => {
|
|
685
|
-
const l = new Set(d);
|
|
686
|
-
return l.has(t) ? l.delete(t) : l.add(t), l;
|
|
687
|
-
});
|
|
688
|
-
}, Qe = (t) => {
|
|
689
|
-
ge((d) => {
|
|
690
|
-
const l = new Set(d), g = t.every((h) => d.has(h.id));
|
|
691
|
-
return t.forEach((h) => {
|
|
692
|
-
g ? l.delete(h.id) : l.add(h.id);
|
|
693
|
-
}), l;
|
|
694
|
-
});
|
|
695
|
-
};
|
|
696
|
-
if (!Ge())
|
|
697
|
-
return /* @__PURE__ */ s.jsx(
|
|
698
|
-
"div",
|
|
699
|
-
{
|
|
700
|
-
style: {
|
|
701
|
-
padding: 12,
|
|
702
|
-
background: "#fafafa",
|
|
703
|
-
border: "1px solid #eee",
|
|
704
|
-
borderRadius: 4,
|
|
705
|
-
color: "#666",
|
|
706
|
-
fontSize: 12
|
|
707
|
-
},
|
|
708
|
-
children: "Maps require WebGL, which your browser doesn't support."
|
|
709
|
-
}
|
|
710
|
-
);
|
|
711
|
-
if (W && !B)
|
|
712
|
-
return /* @__PURE__ */ s.jsxs(
|
|
713
|
-
"div",
|
|
714
|
-
{
|
|
715
|
-
className: "col-distributions-map col-distributions-map--collapsed",
|
|
716
|
-
style: {
|
|
717
|
-
display: "flex",
|
|
718
|
-
alignItems: "center",
|
|
719
|
-
gap: 6,
|
|
720
|
-
padding: "8px 12px",
|
|
721
|
-
background: "#fafafa",
|
|
722
|
-
border: "1px solid #eee",
|
|
723
|
-
borderRadius: 4,
|
|
724
|
-
color: "#666",
|
|
725
|
-
fontSize: 12
|
|
726
|
-
},
|
|
727
|
-
children: [
|
|
728
|
-
/* @__PURE__ */ s.jsx("span", { children: "No curated distribution data." }),
|
|
729
|
-
/* @__PURE__ */ s.jsx(
|
|
730
|
-
"a",
|
|
731
|
-
{
|
|
732
|
-
role: "button",
|
|
733
|
-
tabIndex: 0,
|
|
734
|
-
style: { cursor: "pointer" },
|
|
735
|
-
onClick: ye,
|
|
736
|
-
onKeyDown: (t) => {
|
|
737
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), ye());
|
|
738
|
-
},
|
|
739
|
-
children: "Show GBIF occurrences"
|
|
740
|
-
}
|
|
741
|
-
)
|
|
742
|
-
]
|
|
743
|
-
}
|
|
744
|
-
);
|
|
745
|
-
const et = ((Ie = i == null ? void 0 : i.name) == null ? void 0 : Ie.scientificName) || "This taxon";
|
|
746
|
-
return /* @__PURE__ */ s.jsxs("div", { className: "col-distributions-map", style: { position: "relative" }, children: [
|
|
747
|
-
/* @__PURE__ */ s.jsx(
|
|
748
|
-
"div",
|
|
749
|
-
{
|
|
750
|
-
ref: u,
|
|
751
|
-
style: { height: 360, width: "100%", background: "#f5f5f5" }
|
|
752
|
-
}
|
|
753
|
-
),
|
|
754
|
-
/* @__PURE__ */ s.jsx(
|
|
755
|
-
Wt,
|
|
756
|
-
{
|
|
757
|
-
open: Ke,
|
|
758
|
-
onOpen: Ze,
|
|
759
|
-
onClose: () => me(!1),
|
|
760
|
-
focalName: et,
|
|
761
|
-
focalReady: E,
|
|
762
|
-
focalVisible: z,
|
|
763
|
-
onToggleFocal: () => O((t) => !t),
|
|
764
|
-
gbifEnabled: !!c,
|
|
765
|
-
gbifVisible: B,
|
|
766
|
-
gbifAvailable: f,
|
|
767
|
-
onToggleGbif: Te,
|
|
768
|
-
descendantStatus: y.status,
|
|
769
|
-
descendantsByRank: Xe,
|
|
770
|
-
descendantColors: T,
|
|
771
|
-
visibleTaxonIds: K,
|
|
772
|
-
onToggleTaxon: Je,
|
|
773
|
-
onToggleRankGroup: Qe,
|
|
774
|
-
onRetry: () => {
|
|
775
|
-
ie.current = !1, m({ status: "idle", taxa: [] }), Se();
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
),
|
|
779
|
-
!xe && (be.length > 0 || c && f !== !1 && B) && /* @__PURE__ */ s.jsxs(
|
|
780
|
-
"div",
|
|
781
|
-
{
|
|
782
|
-
style: {
|
|
783
|
-
position: "absolute",
|
|
784
|
-
bottom: 8,
|
|
785
|
-
left: 8,
|
|
786
|
-
zIndex: 1,
|
|
787
|
-
background: "#fff",
|
|
788
|
-
borderRadius: 4,
|
|
789
|
-
boxShadow: "0 1px 4px rgba(0,0,0,0.2)",
|
|
790
|
-
padding: "6px 8px",
|
|
791
|
-
fontSize: 12,
|
|
792
|
-
lineHeight: 1.5
|
|
793
|
-
},
|
|
794
|
-
children: [
|
|
795
|
-
be.map((t) => /* @__PURE__ */ s.jsxs(
|
|
796
|
-
"div",
|
|
797
|
-
{
|
|
798
|
-
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
799
|
-
children: [
|
|
800
|
-
/* @__PURE__ */ s.jsx(
|
|
801
|
-
"span",
|
|
802
|
-
{
|
|
803
|
-
style: {
|
|
804
|
-
display: "inline-block",
|
|
805
|
-
width: 12,
|
|
806
|
-
height: 12,
|
|
807
|
-
background: t.color,
|
|
808
|
-
border: "1px solid rgba(0,0,0,0.15)",
|
|
809
|
-
borderRadius: 2
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
),
|
|
813
|
-
/* @__PURE__ */ s.jsx("span", { children: t.label })
|
|
814
|
-
]
|
|
815
|
-
},
|
|
816
|
-
t.key
|
|
817
|
-
)),
|
|
818
|
-
c && f !== !1 && B && /* @__PURE__ */ s.jsx(Ht, {})
|
|
819
|
-
]
|
|
820
|
-
}
|
|
821
|
-
),
|
|
822
|
-
xe && /* @__PURE__ */ s.jsx(
|
|
823
|
-
Mt,
|
|
824
|
-
{
|
|
825
|
-
visibleGroups: ae.visibleGroups,
|
|
826
|
-
unmappableGroups: ae.unmappableGroups,
|
|
827
|
-
showGbif: !!c && f !== !1 && B
|
|
828
|
-
}
|
|
829
|
-
)
|
|
830
|
-
] });
|
|
831
|
-
}, Wt = ({
|
|
832
|
-
open: e,
|
|
833
|
-
onOpen: n,
|
|
834
|
-
onClose: r,
|
|
835
|
-
focalName: i,
|
|
836
|
-
focalReady: o,
|
|
837
|
-
focalVisible: c,
|
|
838
|
-
onToggleFocal: f,
|
|
839
|
-
gbifEnabled: u,
|
|
840
|
-
gbifVisible: a,
|
|
841
|
-
gbifAvailable: p,
|
|
842
|
-
onToggleGbif: w,
|
|
843
|
-
descendantStatus: j,
|
|
844
|
-
descendantsByRank: k,
|
|
845
|
-
descendantColors: C,
|
|
846
|
-
visibleTaxonIds: S,
|
|
847
|
-
onToggleTaxon: R,
|
|
848
|
-
onToggleRankGroup: I,
|
|
849
|
-
onRetry: P
|
|
850
|
-
}) => e ? /* @__PURE__ */ s.jsxs(
|
|
851
|
-
"div",
|
|
852
|
-
{
|
|
853
|
-
style: {
|
|
854
|
-
position: "absolute",
|
|
855
|
-
top: 10,
|
|
856
|
-
right: 10,
|
|
857
|
-
zIndex: 2,
|
|
858
|
-
background: "#fff",
|
|
859
|
-
borderRadius: 4,
|
|
860
|
-
boxShadow: "0 1px 4px rgba(0,0,0,0.2)",
|
|
861
|
-
padding: "6px 10px",
|
|
862
|
-
fontSize: 12,
|
|
863
|
-
lineHeight: 1.5,
|
|
864
|
-
maxHeight: 320,
|
|
865
|
-
overflowY: "auto",
|
|
866
|
-
minWidth: 160
|
|
867
|
-
},
|
|
868
|
-
onMouseLeave: r,
|
|
869
|
-
children: [
|
|
870
|
-
/* @__PURE__ */ s.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
871
|
-
/* @__PURE__ */ s.jsx(
|
|
872
|
-
"input",
|
|
873
|
-
{
|
|
874
|
-
type: "checkbox",
|
|
875
|
-
checked: c,
|
|
876
|
-
disabled: !o,
|
|
877
|
-
onChange: f
|
|
878
|
-
}
|
|
879
|
-
),
|
|
880
|
-
/* @__PURE__ */ s.jsx("span", { style: { fontStyle: "italic" }, children: i })
|
|
881
|
-
] }),
|
|
882
|
-
u && /* @__PURE__ */ s.jsxs(
|
|
883
|
-
"div",
|
|
884
|
-
{
|
|
885
|
-
style: {
|
|
886
|
-
display: "flex",
|
|
887
|
-
alignItems: "center",
|
|
888
|
-
gap: 6,
|
|
889
|
-
opacity: p === !1 ? 0.5 : 1
|
|
890
|
-
},
|
|
891
|
-
title: p === !1 ? "GBIF has no occurrence records for this taxon." : void 0,
|
|
892
|
-
children: [
|
|
893
|
-
/* @__PURE__ */ s.jsx(
|
|
894
|
-
"input",
|
|
895
|
-
{
|
|
896
|
-
type: "checkbox",
|
|
897
|
-
checked: p === !1 ? !1 : a,
|
|
898
|
-
disabled: p === !1,
|
|
899
|
-
onChange: w
|
|
900
|
-
}
|
|
901
|
-
),
|
|
902
|
-
/* @__PURE__ */ s.jsx("span", { children: "GBIF occurrences" })
|
|
903
|
-
]
|
|
904
|
-
}
|
|
905
|
-
),
|
|
906
|
-
j === "loading" && /* @__PURE__ */ s.jsx("div", { style: { marginTop: 6, color: "#888" }, children: "Loading descendants…" }),
|
|
907
|
-
j === "error" && /* @__PURE__ */ s.jsxs("div", { style: { marginTop: 6, color: "#888" }, children: [
|
|
908
|
-
"Couldn't load descendants.",
|
|
909
|
-
" ",
|
|
910
|
-
/* @__PURE__ */ s.jsx("a", { onClick: P, style: { cursor: "pointer" }, children: "Retry" })
|
|
911
|
-
] }),
|
|
912
|
-
j === "ready" && k.map((E) => {
|
|
913
|
-
const _ = E.taxa.every((m) => S.has(m.id)), y = E.taxa.some((m) => S.has(m.id));
|
|
914
|
-
return /* @__PURE__ */ s.jsxs("div", { style: { marginTop: 6 }, children: [
|
|
915
|
-
/* @__PURE__ */ s.jsxs(
|
|
916
|
-
"label",
|
|
917
|
-
{
|
|
918
|
-
style: {
|
|
919
|
-
display: "flex",
|
|
920
|
-
alignItems: "center",
|
|
921
|
-
gap: 6,
|
|
922
|
-
fontWeight: 600
|
|
923
|
-
},
|
|
924
|
-
children: [
|
|
925
|
-
/* @__PURE__ */ s.jsx(
|
|
926
|
-
"input",
|
|
927
|
-
{
|
|
928
|
-
type: "checkbox",
|
|
929
|
-
checked: _,
|
|
930
|
-
ref: (m) => {
|
|
931
|
-
m && (m.indeterminate = !_ && y);
|
|
932
|
-
},
|
|
933
|
-
onChange: () => I(E.taxa)
|
|
934
|
-
}
|
|
935
|
-
),
|
|
936
|
-
E.label
|
|
937
|
-
]
|
|
938
|
-
}
|
|
939
|
-
),
|
|
940
|
-
/* @__PURE__ */ s.jsx("div", { style: { paddingLeft: 18 }, children: E.taxa.map((m) => /* @__PURE__ */ s.jsxs(
|
|
941
|
-
"label",
|
|
942
|
-
{
|
|
943
|
-
style: {
|
|
944
|
-
display: "flex",
|
|
945
|
-
alignItems: "center",
|
|
946
|
-
gap: 6
|
|
947
|
-
},
|
|
948
|
-
children: [
|
|
949
|
-
/* @__PURE__ */ s.jsx(
|
|
950
|
-
"input",
|
|
951
|
-
{
|
|
952
|
-
type: "checkbox",
|
|
953
|
-
checked: S.has(m.id),
|
|
954
|
-
onChange: () => R(m.id)
|
|
955
|
-
}
|
|
956
|
-
),
|
|
957
|
-
/* @__PURE__ */ s.jsx(
|
|
958
|
-
"span",
|
|
959
|
-
{
|
|
960
|
-
style: {
|
|
961
|
-
display: "inline-block",
|
|
962
|
-
width: 10,
|
|
963
|
-
height: 10,
|
|
964
|
-
background: C[m.id],
|
|
965
|
-
border: "1px solid rgba(0,0,0,0.15)",
|
|
966
|
-
borderRadius: 2
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
),
|
|
970
|
-
/* @__PURE__ */ s.jsx("span", { style: { fontStyle: "italic" }, children: We(m.scientificName) })
|
|
971
|
-
]
|
|
972
|
-
},
|
|
973
|
-
m.id
|
|
974
|
-
)) })
|
|
975
|
-
] }, E.rank);
|
|
976
|
-
})
|
|
977
|
-
]
|
|
978
|
-
}
|
|
979
|
-
) : /* @__PURE__ */ s.jsx(
|
|
980
|
-
"button",
|
|
981
|
-
{
|
|
982
|
-
type: "button",
|
|
983
|
-
onClick: n,
|
|
984
|
-
onMouseEnter: n,
|
|
985
|
-
title: "Layers",
|
|
986
|
-
style: {
|
|
987
|
-
position: "absolute",
|
|
988
|
-
top: 10,
|
|
989
|
-
right: 10,
|
|
990
|
-
zIndex: 2,
|
|
991
|
-
width: 30,
|
|
992
|
-
height: 30,
|
|
993
|
-
background: "#fff",
|
|
994
|
-
border: "1px solid rgba(0,0,0,0.2)",
|
|
995
|
-
borderRadius: 4,
|
|
996
|
-
cursor: "pointer",
|
|
997
|
-
fontSize: 18,
|
|
998
|
-
lineHeight: "26px",
|
|
999
|
-
padding: 0,
|
|
1000
|
-
boxShadow: "0 1px 4px rgba(0,0,0,0.2)"
|
|
1001
|
-
},
|
|
1002
|
-
children: "+"
|
|
1003
|
-
}
|
|
1004
|
-
), Kt = (e) => {
|
|
1005
|
-
var n, r;
|
|
1006
|
-
return ((n = e == null ? void 0 : e.area) == null ? void 0 : n.gazetteer) !== "text" && !!((r = e == null ? void 0 : e.area) != null && r.globalId);
|
|
1007
|
-
}, Me = ({ datasetKey: e, data: n }) => {
|
|
1008
|
-
const [r, i] = L({});
|
|
1009
|
-
return N(() => {
|
|
1010
|
-
let o = !1;
|
|
1011
|
-
for (let c = 0; c < n.length; c++)
|
|
1012
|
-
if (n[c].gazetteer === "iso") {
|
|
1013
|
-
o = !0;
|
|
1014
|
-
break;
|
|
1015
|
-
}
|
|
1016
|
-
o && te(`${A.dataApi}vocab/country`).then((c) => {
|
|
1017
|
-
i(it(c.data, "alpha3"));
|
|
1018
|
-
});
|
|
1019
|
-
}, []), /* @__PURE__ */ s.jsx("div", { children: n.map((o, c) => /* @__PURE__ */ s.jsxs("span", { children: [
|
|
1020
|
-
(o == null ? void 0 : o.merged) && /* @__PURE__ */ s.jsx(
|
|
1021
|
-
ut,
|
|
1022
|
-
{
|
|
1023
|
-
createdBy: o == null ? void 0 : o.createdBy,
|
|
1024
|
-
datasetKey: o.datasetKey,
|
|
1025
|
-
sourceDatasetKey: o == null ? void 0 : o.sourceDatasetKey,
|
|
1026
|
-
verbatimSourceKey: o == null ? void 0 : o.verbatimSourceKey,
|
|
1027
|
-
style: { marginRight: "4px" }
|
|
1028
|
-
}
|
|
1029
|
-
),
|
|
1030
|
-
($(r, `[${$(o, "area.name")}].name`) ? at($(r, `[${$(o, "area.name")}].name`)) : null) || $(o, "area.name") || $(o, "area.globalId"),
|
|
1031
|
-
" ",
|
|
1032
|
-
o.referenceId && /* @__PURE__ */ s.jsx(
|
|
1033
|
-
mt,
|
|
1034
|
-
{
|
|
1035
|
-
datasetKey: e,
|
|
1036
|
-
referenceId: o.referenceId,
|
|
1037
|
-
placement: "bottom"
|
|
1038
|
-
}
|
|
1039
|
-
),
|
|
1040
|
-
c < n.length - 1 && ", "
|
|
1041
|
-
] }, c)) });
|
|
1042
|
-
}, an = ({
|
|
1043
|
-
datasetKey: e,
|
|
1044
|
-
data: n,
|
|
1045
|
-
style: r,
|
|
1046
|
-
showDistributionMap: i,
|
|
1047
|
-
focalTaxon: o,
|
|
1048
|
-
rankOrder: c,
|
|
1049
|
-
gbifChecklistKey: f
|
|
1050
|
-
}) => {
|
|
1051
|
-
const u = n.filter(Kt), a = n.length - u.length, p = !!f, w = n.length > 0, [j, k] = L("map"), [C, S] = L(0), [R, I] = L(null);
|
|
1052
|
-
N(() => {
|
|
1053
|
-
if (!f || !(o != null && o.id)) {
|
|
1054
|
-
I(null);
|
|
1055
|
-
return;
|
|
1056
|
-
}
|
|
1057
|
-
I(null);
|
|
1058
|
-
let O = !1;
|
|
1059
|
-
return ct.get(`${A.gbifApi}/v1/occurrence/search`, {
|
|
1060
|
-
params: {
|
|
1061
|
-
checklistKey: f,
|
|
1062
|
-
taxonKey: o.id,
|
|
1063
|
-
hasCoordinate: !0,
|
|
1064
|
-
hasGeospatialIssue: !1,
|
|
1065
|
-
occurrenceStatus: "PRESENT",
|
|
1066
|
-
limit: 0
|
|
1067
|
-
}
|
|
1068
|
-
}).then(
|
|
1069
|
-
(W) => {
|
|
1070
|
-
var B;
|
|
1071
|
-
O || I(((B = W == null ? void 0 : W.data) == null ? void 0 : B.count) ?? 0);
|
|
1072
|
-
},
|
|
1073
|
-
() => {
|
|
1074
|
-
O || I(null);
|
|
1075
|
-
}
|
|
1076
|
-
), () => {
|
|
1077
|
-
O = !0;
|
|
1078
|
-
};
|
|
1079
|
-
}, [f, o == null ? void 0 : o.id]);
|
|
1080
|
-
const P = p ? R === null || R > 0 : !1, E = u.length > 0 && C >= u.length, _ = i && (u.length > 0 || P) && !(u.length > 0 && E && !P);
|
|
1081
|
-
if (!_ && p && u.length === 0 && R === 0)
|
|
1082
|
-
return /* @__PURE__ */ s.jsx("div", { style: r, children: /* @__PURE__ */ s.jsx("span", { style: { color: "#888" }, children: "No occurrence data on GBIF for this taxon." }) });
|
|
1083
|
-
if (!_)
|
|
1084
|
-
return w ? /* @__PURE__ */ s.jsx("div", { style: r, children: /* @__PURE__ */ s.jsx(Me, { datasetKey: e, data: n }) }) : null;
|
|
1085
|
-
const y = a + C, m = w, z = m ? j : "map";
|
|
1086
|
-
return /* @__PURE__ */ s.jsxs("div", { style: r, children: [
|
|
1087
|
-
m ? /* @__PURE__ */ s.jsxs(
|
|
1088
|
-
le.Group,
|
|
1089
|
-
{
|
|
1090
|
-
size: "small",
|
|
1091
|
-
value: z,
|
|
1092
|
-
onChange: (O) => k(O.target.value),
|
|
1093
|
-
style: { marginBottom: 8 },
|
|
1094
|
-
children: [
|
|
1095
|
-
/* @__PURE__ */ s.jsx(le.Button, { value: "map", children: "Map" }),
|
|
1096
|
-
/* @__PURE__ */ s.jsx(le.Button, { value: "list", children: "List" })
|
|
1097
|
-
]
|
|
1098
|
-
}
|
|
1099
|
-
) : (
|
|
1100
|
-
// Reserve the vertical space the Map/List toggle would occupy so the
|
|
1101
|
-
// map's top edge lines up with the "Distributions" label.
|
|
1102
|
-
/* @__PURE__ */ s.jsx("div", { style: { height: 24, marginBottom: 8 } })
|
|
1103
|
-
),
|
|
1104
|
-
z === "map" ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
1105
|
-
/* @__PURE__ */ s.jsx(
|
|
1106
|
-
Ut,
|
|
1107
|
-
{
|
|
1108
|
-
records: u,
|
|
1109
|
-
onUnmappable: S,
|
|
1110
|
-
datasetKey: e,
|
|
1111
|
-
focalTaxon: o,
|
|
1112
|
-
rankOrder: c,
|
|
1113
|
-
gbifChecklistKey: f,
|
|
1114
|
-
gbifAvailable: P
|
|
1115
|
-
}
|
|
1116
|
-
),
|
|
1117
|
-
m && y > 0 && /* @__PURE__ */ s.jsx("div", { style: { marginTop: 6 }, children: /* @__PURE__ */ s.jsxs("a", { onClick: () => k("list"), style: { cursor: "pointer" }, children: [
|
|
1118
|
-
"+",
|
|
1119
|
-
y,
|
|
1120
|
-
" distribution",
|
|
1121
|
-
y === 1 ? "" : "s",
|
|
1122
|
-
" not on map"
|
|
1123
|
-
] }) })
|
|
1124
|
-
] }) : /* @__PURE__ */ s.jsx(Me, { datasetKey: e, data: n })
|
|
1125
|
-
] });
|
|
1126
|
-
};
|
|
1127
|
-
export {
|
|
1128
|
-
an as D,
|
|
1129
|
-
mt as R
|
|
1130
|
-
};
|
|
1131
|
-
//# sourceMappingURL=Distributions-CXIEJ6e6.js.map
|