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