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.
Files changed (41) hide show
  1. package/README.md +9 -0
  2. package/es/bibtex.js +1 -1
  3. package/es/chunks/{BibTex-CyUpSmpY.js → BibTex-DRE71Hg-.js} +2 -2
  4. package/es/chunks/{BibTex-CyUpSmpY.js.map → BibTex-DRE71Hg-.js.map} +1 -1
  5. package/es/chunks/{DatasetCitation-BnOkKDTv.js → DatasetCitation-Cep2dces.js} +2 -2
  6. package/es/chunks/{DatasetCitation-BnOkKDTv.js.map → DatasetCitation-Cep2dces.js.map} +1 -1
  7. package/es/chunks/{DatasetlogoWithFallback-DJEkjMJ1.js → DatasetlogoWithFallback-Bb-kmHts.js} +2 -2
  8. package/es/chunks/{DatasetlogoWithFallback-DJEkjMJ1.js.map → DatasetlogoWithFallback-Bb-kmHts.js.map} +1 -1
  9. package/es/chunks/{Distributions-Dwjo7KhA.js → Distributions-Czffme5Y.js} +422 -410
  10. package/es/chunks/Distributions-Czffme5Y.js.map +1 -0
  11. package/es/chunks/{MergedDataBadge-FvHUdT7B.js → MergedDataBadge-DK53L3R8.js} +2 -2
  12. package/es/chunks/{MergedDataBadge-FvHUdT7B.js.map → MergedDataBadge-DK53L3R8.js.map} +1 -1
  13. package/es/chunks/{TaxonBreakdown-D9g3tYXL.js → TaxonBreakdown-DqdQ18QM.js} +2 -2
  14. package/es/chunks/{TaxonBreakdown-D9g3tYXL.js.map → TaxonBreakdown-DqdQ18QM.js.map} +1 -1
  15. package/es/chunks/{XrGutter-D3PMq-Dn.js → XrGutter-COJhHpia.js} +2 -2
  16. package/es/chunks/{XrGutter-D3PMq-Dn.js.map → XrGutter-COJhHpia.js.map} +1 -1
  17. package/es/chunks/{config-D4b3a4Yi.js → config--bs_09I6.js} +12 -7
  18. package/es/chunks/config--bs_09I6.js.map +1 -0
  19. package/es/chunks/{dataset-D_gmg2Zv.js → dataset-BZpjo3Yq.js} +2 -2
  20. package/es/chunks/{dataset-D_gmg2Zv.js.map → dataset-BZpjo3Yq.js.map} +1 -1
  21. package/es/chunks/{enumeration-B-nIqCor.js → enumeration-CV8i_q_O.js} +2 -2
  22. package/es/chunks/{enumeration-B-nIqCor.js.map → enumeration-CV8i_q_O.js.map} +1 -1
  23. package/es/chunks/{sector-CE-w32Gs.js → sector-ucUgPp75.js} +2 -2
  24. package/es/chunks/{sector-CE-w32Gs.js.map → sector-ucUgPp75.js.map} +1 -1
  25. package/es/config.js +1 -1
  26. package/es/index.js +1 -1
  27. package/es/search.js +5 -5
  28. package/es/sourceDataset.js +4 -4
  29. package/es/sourceDatasetList.js +4 -4
  30. package/es/taxon.js +9 -9
  31. package/es/taxonBreakdown.js +2 -2
  32. package/es/taxonDistribution.js +2 -2
  33. package/es/tree.js +5 -5
  34. package/package.json +1 -1
  35. package/types/index.d.ts +7 -0
  36. package/umd/col-browser.js +27 -3
  37. package/umd/col-browser.js.map +1 -1
  38. package/umd/col-browser.min.js +4 -4
  39. package/umd/col-browser.min.js.map +1 -1
  40. package/es/chunks/Distributions-Dwjo7KhA.js.map +0 -1
  41. package/es/chunks/config-D4b3a4Yi.js.map +0 -1
@@ -1,86 +1,86 @@
1
1
  var it = Object.defineProperty;
2
- var at = (e, r, s) => r in e ? it(e, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[r] = s;
3
- var X = (e, r, s) => at(e, typeof r != "symbol" ? r + "" : r, s);
4
- import { j as n } from "./jsx-runtime-BzflLqGi.js";
5
- import * as Pe from "react";
6
- import ct, { useState as k, useRef as C, useMemo as ie, useEffect as A } from "react";
7
- import { Spin as lt, Popover as dt, Radio as fe } from "antd";
8
- import { isArray as Re, get as H, keyBy as ut, startCase as pt } from "lodash-es";
9
- import { c as re, p as ft } from "./router-CssZk5qZ.js";
10
- import { c as P } from "./config-D4b3a4Yi.js";
11
- import { E as ht } from "./ErrorMsg-K8k5PPTp.js";
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 mt } from "./MergedDataBadge-FvHUdT7B.js";
14
- import { P as yt } from "./PresentationItem-C4yZ555-.js";
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 bt, w as xt } from "./storage-BgdCo9fV.js";
18
- var vt = { 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" };
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 r = 1; r < arguments.length; r++) {
22
- var s = arguments[r];
23
- for (var i in s)
24
- Object.prototype.hasOwnProperty.call(s, i) && (e[i] = s[i]);
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 St = (e, r) => /* @__PURE__ */ Pe.createElement(gt, ye({}, e, {
30
- ref: r,
31
- icon: vt
32
- })), De = /* @__PURE__ */ Pe.forwardRef(St);
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 jt extends ct.Component {
35
- constructor(s) {
36
- super(s);
34
+ class It extends lt.Component {
35
+ constructor(r) {
36
+ super(r);
37
37
  X(this, "getData", () => {
38
- const { referenceId: s, datasetKey: i, references: o } = this.props;
39
- if (s) {
40
- const c = Re(s) ? s : [s], u = [];
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
- `${P.dataApi}dataset/${i}/reference/${f}`
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: s, reference: i, loading: o } = this.state;
52
- return o ? /* @__PURE__ */ n.jsx(lt, {}) : s ? /* @__PURE__ */ n.jsx(ht, { error: s }) : i.length === 1 ? i[0].citation : /* @__PURE__ */ n.jsx("ul", { children: i.map((c) => /* @__PURE__ */ n.jsx("li", { children: c.citation }, c.id)) });
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", (s, i) => {
55
- const o = document.getElementById(`col-reference-${i}`);
56
- o && (s.preventDefault(), o.scrollIntoView({ behavior: "smooth", block: "start" }));
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: s, referenceIndexMap: i, trigger: o } = this.props, c = this.props.maxInline || 4, u = Re(s) ? s : [s];
60
- let f = i && H(i, u[0]) ? (() => {
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__ */ n.jsx(
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: `[${i[p]}]`
69
+ children: `[${a[p]}]`
70
70
  },
71
71
  p
72
72
  )),
73
- h > 0 ? /* @__PURE__ */ n.jsx("span", { className: "col-reference-link", children: ` +${h}` }, "overflow") : null
73
+ h > 0 ? /* @__PURE__ */ s.jsx("span", { className: "col-reference-link", children: ` +${h}` }, "overflow") : null
74
74
  ];
75
- })() : /* @__PURE__ */ n.jsx(De, { style: { cursor: "pointer" } });
76
- return s ? /* @__PURE__ */ n.jsx("div", { id: `reference_${s}`, style: this.props.style, children: /* @__PURE__ */ n.jsx(
77
- dt,
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_${s}`),
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__ */ n.jsx(
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_${s}`) : "";
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
- ], Oe = (e, r) => {
114
- const s = r.indexOf(e);
115
- return s === -1 ? [] : ce.filter((i) => r.indexOf(i) > s);
116
- }, It = 16, wt = (e) => {
117
- var r, s;
118
- return ((r = e == null ? void 0 : e.area) == null ? void 0 : r.gazetteer) !== "text" && !!((s = e == null ? void 0 : e.area) != null && s.globalId);
119
- }, Lt = async (e, r, s) => {
120
- const i = new Array(e.length);
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(s, e.length) }, async () => {
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
- i[u] = await r(e[u], u);
126
+ a[u] = await n(e[u], u);
127
127
  }
128
128
  });
129
- return await Promise.all(c), i;
130
- }, kt = async (e, r, s) => {
129
+ return await Promise.all(c), a;
130
+ }, Ct = async (e, n, r) => {
131
131
  var f;
132
- if (s.length === 0) return [];
133
- const i = new URLSearchParams();
134
- i.append("TAXON_ID", r), s.forEach((d) => i.append("rank", d)), ["accepted", "provisionally accepted"].forEach(
135
- (d) => i.append("status", d)
136
- ), i.append("limit", "1000");
137
- const o = `${P.dataApi}dataset/${e}/nameusage/search?${i}`, c = await re(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, B, R, L;
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: (R = (B = d.usage) == null ? void 0 : B.name) == null ? void 0 : R.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
- }, Ct = async (e, r) => {
151
- const s = `${P.dataApi}dataset/${e}/taxon/${encodeURIComponent(r)}/distribution`;
150
+ }, Rt = async (e, n) => {
151
+ const r = `${R.dataApi}dataset/${e}/taxon/${encodeURIComponent(n)}/distribution`;
152
152
  try {
153
- const i = await re(s);
154
- return Array.isArray(i == null ? void 0 : i.data) ? i.data : [];
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
- }, Rt = async ({ datasetKey: e, focalTaxon: r, rankOrder: s }) => {
158
+ }, Et = async ({ datasetKey: e, focalTaxon: n, rankOrder: r }) => {
159
159
  var d;
160
- const i = Oe((d = r == null ? void 0 : r.name) == null ? void 0 : d.rank, s);
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 kt(e, r.id, i);
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 Lt(
167
+ const u = await kt(
168
168
  c,
169
- (h) => Ct(e, h.id),
170
- It
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(wt) };
174
+ return { ...h, distributions: y, mappable: y.filter(Lt) };
175
175
  }), descendantsFailed: o };
176
- }, Ee = [
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
- ], Fe = (e, r) => {
190
- const s = r.indexOf(e);
191
- return s === -1 ? r.length : s;
192
- }, Et = (e, r) => {
193
- const s = [...e].sort((o, c) => {
194
- const u = Fe(o.rank, r), f = Fe(c.rank, r);
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
- }), i = {};
197
- return s.forEach((o, c) => {
198
- i[o.id] = Ee[c % Ee.length];
199
- }), i;
200
- }, Ft = (e) => e ?? P.basemapStyle, Bt = {
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
- }, Mt = {
223
+ }, $t = {
213
224
  maxHeight: 240,
214
225
  overflowY: "auto"
215
- }, ze = {
226
+ }, He = {
216
227
  fontWeight: 600,
217
228
  marginTop: 4
218
- }, Gt = {
219
- ...ze,
229
+ }, _t = {
230
+ ...He,
220
231
  marginTop: 0
221
- }, He = {
232
+ }, Ve = {
222
233
  display: "flex",
223
234
  alignItems: "center",
224
235
  gap: 6,
225
236
  paddingLeft: 4
226
- }, Nt = (e) => ({
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
- }), _t = {
245
+ }), Pt = {
235
246
  marginTop: 6,
236
247
  cursor: "pointer",
237
248
  color: "#1890ff",
238
249
  fontSize: 11
239
- }, $t = {
250
+ }, Ot = {
240
251
  marginTop: 4,
241
252
  borderTop: "1px solid #eee",
242
253
  paddingTop: 4,
243
254
  color: "#666"
244
- }, Ve = {
255
+ }, Ue = {
245
256
  fontWeight: 600,
246
257
  marginTop: 4
247
- }, At = {
248
- ...Ve,
258
+ }, Dt = {
259
+ ...Ue,
249
260
  marginTop: 0
250
- }, Pt = {
261
+ }, zt = {
251
262
  fontStyle: "italic",
252
263
  paddingLeft: 4
253
- }, Be = (e) => e.reduce((r, s) => r + s.taxa.length, 0), Dt = () => /* @__PURE__ */ n.jsxs("div", { style: He, children: [
254
- /* @__PURE__ */ n.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ n.jsx(
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__ */ n.jsx("span", { children: "GBIF occurrences" })
264
- ] }), Ot = ({ visibleGroups: e, unmappableGroups: r, showGbif: s }) => {
265
- const [i, o] = k(!1), c = Be(e), u = Be(r);
266
- return c === 0 && u === 0 && !s ? null : /* @__PURE__ */ n.jsxs("div", { style: Bt, children: [
267
- /* @__PURE__ */ n.jsxs("div", { style: Mt, children: [
268
- e.map((f, d) => /* @__PURE__ */ n.jsxs("div", { children: [
269
- /* @__PURE__ */ n.jsx("div", { style: d === 0 ? Gt : ze, children: f.label }),
270
- f.taxa.map((h) => /* @__PURE__ */ n.jsxs("div", { style: He, children: [
271
- /* @__PURE__ */ n.jsx("span", { style: Nt(h.color) }),
272
- /* @__PURE__ */ n.jsx("span", { style: { fontStyle: "italic" }, children: h.displayName || h.scientificName })
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
- s && /* @__PURE__ */ n.jsx(Dt, {})
286
+ r && /* @__PURE__ */ s.jsx(Ht, {})
276
287
  ] }),
277
- u > 0 && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
278
- /* @__PURE__ */ n.jsxs(
288
+ u > 0 && /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
289
+ /* @__PURE__ */ s.jsxs(
279
290
  "div",
280
291
  {
281
- style: _t,
292
+ style: Pt,
282
293
  onClick: () => o((f) => !f),
283
294
  children: [
284
- i ? "− Hide" : "+",
295
+ a ? "− Hide" : "+",
285
296
  " ",
286
297
  u,
287
298
  " without map data"
288
299
  ]
289
300
  }
290
301
  ),
291
- i && /* @__PURE__ */ n.jsx("div", { style: $t, children: r.map((f, d) => /* @__PURE__ */ n.jsxs("div", { children: [
292
- /* @__PURE__ */ n.jsx(
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 ? At : Ve,
306
+ style: d === 0 ? Dt : Ue,
296
307
  children: f.label
297
308
  }
298
309
  ),
299
- f.taxa.map((h) => /* @__PURE__ */ n.jsx("div", { style: Pt, children: h.displayName || h.scientificName }, h.id))
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
- }, zt = [
314
+ }, Ut = [
304
315
  "establishmentMeans",
305
316
  "degreeOfEstablishment",
306
317
  "pathway",
307
318
  "threatStatus",
308
319
  "year",
309
320
  "lifeStage"
310
- ], Ue = [
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
- Ue.map((e) => [e.key, e.color])
324
- ), le = "#66C5CC", Ht = (e) => String(e || "").toLowerCase().replace(/[^a-z]/g, ""), Ke = (e) => {
325
- const r = e == null ? void 0 : e.establishmentMeans;
326
- if (r == null || r === "") return null;
327
- const s = Ht(r);
328
- return We[s] ? s : "uncertain";
329
- }, Vt = (e) => {
330
- const r = Ke(e);
331
- return r == null ? le : We[r];
332
- }, Ye = "gbif-visible", Ut = (e) => bt(Ye, e), Me = (e) => xt(Ye, e), Wt = "/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", Y = "col-focal-fill", he = "col-focal-line", ae = "col-gbif-occurrences", $ = "col-gbif-occurrences", ge = (e) => `col-descendant-${e}`, ee = (e) => `col-descendant-fill-${e}`, te = (e) => `col-descendant-line-${e}`, me = /* @__PURE__ */ new Map(), Ge = (e, r) => {
333
- const s = `${e}:${r}`;
334
- if (me.has(s)) return me.get(s);
335
- const i = `${P.dataApi}vocab/area/${s}`, o = re(i, {
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 me.set(s, o), o;
342
- }, ne = (e) => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), Te = (e) => {
343
- var i, o;
344
- const r = ((i = e == null ? void 0 : e.area) == null ? void 0 : i.name) || ((o = e == null ? void 0 : e.area) == null ? void 0 : o.globalId) || "", s = zt.map((c) => [c, e == null ? void 0 : e[c]]).filter(([, c]) => c != null && c !== "").map(
352
+ return ge.set(r, o), o;
353
+ }, ne = (e) => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), 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
- r
349
- )}</div>${s}</div>`;
350
- }, Kt = (e, r) => `<div style="font-weight:600;font-style:italic;margin-bottom:4px">${ne(
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>` + Te(r), Yt = {
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
- }, Ne = (e) => Yt[e] || e, qe = (e) => {
370
+ }, $e = (e) => Zt[e] || e, Ze = (e) => {
360
371
  if (!e) return "";
361
- const r = e.trim().split(/\s+/);
362
- return r[r.length - 1];
363
- }, Tt = () => /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
364
- /* @__PURE__ */ n.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ n.jsx(
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__ */ n.jsx("span", { children: "GBIF occurrences" })
374
- ] }), qt = (e) => {
384
+ /* @__PURE__ */ s.jsx("span", { children: "GBIF occurrences" })
385
+ ] }), Xt = (e) => {
375
386
  var u;
376
- let r = 1 / 0, s = 1 / 0, i = -1 / 0, o = -1 / 0;
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 < r && (r = d), d > i && (i = d), h < s && (s = h), h > o && (o = h);
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 r === 1 / 0 ? null : [
389
- [r, s],
390
- [i, o]
399
+ return n === 1 / 0 ? null : [
400
+ [n, r],
401
+ [a, o]
391
402
  ];
392
- }, _e = (e) => e ? e.type === "FeatureCollection" ? e.features || [] : [e] : [], $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
- }, Zt = ({
406
+ }, Qt = ({
396
407
  records: e,
397
- onUnmappable: r,
398
- datasetKey: s,
399
- focalTaxon: i,
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 Ce;
411
- const d = C(null), h = C(null), p = C(null), y = C(null), B = C(/* @__PURE__ */ new Map()), R = C(/* @__PURE__ */ new Map()), L = C(/* @__PURE__ */ new Map()), D = C(!1), M = C(!1), G = C(/* @__PURE__ */ new Set()), [S, E] = k(null), [O, v] = k(!1), [x, N] = k({
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, T] = k(!0), se = !!c && (!e || e.length === 0), [I, z] = k(
416
- () => Ut(!0)
417
- ), [_, be] = k(/* @__PURE__ */ new Set()), [Ze, xe] = k(!1), de = C(!1), Je = () => {
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 Me(l), l;
431
+ return Ge(l), l;
421
432
  });
422
433
  }, ve = () => {
423
- z(!0), Me(!0);
424
- }, Se = ie(() => {
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 a = Ke(l);
429
- a != null && t.add(a);
430
- }), Ue.filter((l) => t.has(l.key));
431
- }, [e]), q = ie(() => x.status !== "ready" ? {} : Et(
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 = ie(() => {
445
+ ), [x, o]), ue = ae(() => {
435
446
  if (x.status !== "ready")
436
447
  return { visibleGroups: [], unmappableGroups: [] };
437
- const t = (g) => ({
438
- ...g,
439
- color: q[g.id],
440
- displayName: qe(g.scientificName)
441
- }), l = (g) => {
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 g.forEach((b) => {
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: Ne(b),
458
+ label: $e(b),
448
459
  taxa: j[b]
449
460
  }));
450
- }, a = l(
461
+ }, i = l(
451
462
  x.taxa.filter(
452
- (g) => g.mappable.length > 0 && _.has(g.id)
463
+ (m) => m.mappable.length > 0 && _.has(m.id)
453
464
  )
454
- ), m = l(
455
- x.taxa.filter((g) => g.mappable.length === 0)
465
+ ), g = l(
466
+ x.taxa.filter((m) => m.mappable.length === 0)
456
467
  );
457
- return { visibleGroups: a, unmappableGroups: m };
458
- }, [x, q, _]), je = ue.visibleGroups.length > 0, oe = Ft(f), Xe = typeof oe == "string" ? oe : JSON.stringify(oe);
459
- A(() => {
460
- if (!d.current || p.current || !$e()) return;
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
- E(t);
481
- const a = t.getContainer().querySelector(".maplibregl-ctrl-attrib");
482
- a && a.classList.remove("maplibregl-compact-show");
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, D.current = !1, M.current = !1, G.current = /* @__PURE__ */ new Set(), E(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
- }, [Xe]), A(() => {
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
- (a) => Ge(a.area.gazetteer, a.area.id).then((m) => ({
495
- record: a,
496
- geojson: m
506
+ (i) => Ne(i.area.gazetteer, i.area.id).then((g) => ({
507
+ record: i,
508
+ geojson: g
497
509
  }))
498
510
  )
499
- ).then((a) => {
511
+ ).then((i) => {
500
512
  if (l || p.current !== t) return;
501
- const m = [], g = /* @__PURE__ */ new Map();
513
+ const g = [], m = /* @__PURE__ */ new Map();
502
514
  let j = 0;
503
- a.forEach((w, F) => {
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: W, geojson: K } = w.value, pe = Vt(W), Z = `focal-${F}`;
509
- g.set(Z, W), _e(K).forEach((J) => {
510
- m.push({
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
- }), B.current = g;
520
- const b = { type: "FeatureCollection", features: m };
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($) ? $ : void 0;
536
+ const w = t.getLayer(A) ? A : void 0;
525
537
  t.addSource(Q, { type: "geojson", data: b }), t.addLayer(
526
538
  {
527
- id: Y,
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", Y, Qe), t.on("mouseenter", Y, Ie), t.on("mouseleave", Y, we), D.current = !0;
559
+ ), t.on("click", T, et), t.on("mouseenter", T, we), t.on("mouseleave", T, Le), O.current = !0;
548
560
  }
549
- if (m.length > 0) {
550
- const w = qt(m);
561
+ if (g.length > 0) {
562
+ const w = Xt(g);
551
563
  w && t.fitBounds(w, { padding: 20, animate: !1 });
552
564
  }
553
- typeof r == "function" && r(j), v(!0);
565
+ typeof n == "function" && n(j), v(!0);
554
566
  }), () => {
555
567
  l = !0;
556
568
  };
557
569
  }, [S, e]);
558
- const Qe = (t) => {
570
+ const et = (t) => {
559
571
  var j, b;
560
572
  const l = p.current;
561
573
  if (!l) return;
562
- const a = (j = t.features) == null ? void 0 : j[0], m = (b = a == null ? void 0 : a.properties) == null ? void 0 : b._recordKey, g = m ? B.current.get(m) : null;
563
- g && (y.current && y.current.remove(), y.current = new V.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(Te(g)).addTo(l));
564
- }, Ie = () => {
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
- }, we = () => {
579
+ }, Le = () => {
568
580
  const t = p.current;
569
581
  t && (t.getCanvas().style.cursor = "");
570
582
  };
571
- A(() => {
583
+ P(() => {
572
584
  const t = p.current;
573
- if (!t || !D.current) return;
585
+ if (!t || !O.current) return;
574
586
  const l = U ? "visible" : "none";
575
- t.getLayer(Y) && t.setLayoutProperty(Y, "visibility", l), t.getLayer(he) && t.setLayoutProperty(he, "visibility", l);
576
- }, [U, O]), A(() => {
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($) && t.removeLayer($), t.getSource(ae) && t.removeSource(ae), M.current = !1;
580
- })(), !c || !(i != null && i.id)) || u === !1) return;
581
- const a = (P.gbifApi + Wt).replace("{checklistKey}", encodeURIComponent(c)).replace("{taxonKey}", encodeURIComponent(i.id)), m = P.gbifPortal + "/occurrence/search?checklist_key=" + encodeURIComponent(c) + "&taxon_key=" + encodeURIComponent(i.id);
582
- t.addSource(ae, {
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: [a],
596
+ tiles: [i],
585
597
  tileSize: 256,
586
- attribution: '<a href="' + m + '" target="_blank" rel="noopener">GBIF</a> occurrence data'
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: ae,
602
+ source: ie,
591
603
  paint: { "raster-opacity": 0.9 },
592
604
  layout: { visibility: I ? "visible" : "none" }
593
- }), M.current = !0;
594
- }, [S, c, i == null ? void 0 : i.id, u]), A(() => {
605
+ }), G.current = !0;
606
+ }, [S, c, a == null ? void 0 : a.id, u]), P(() => {
595
607
  const t = p.current;
596
- if (!t || !M.current) return;
608
+ if (!t || !G.current) return;
597
609
  const l = I ? "visible" : "none";
598
- t.getLayer($) && t.setLayoutProperty($, "visibility", l);
610
+ t.getLayer(A) && t.setLayoutProperty(A, "visibility", l);
599
611
  }, [I]);
600
- const Le = (t) => _.has(t) ? "visible" : "none";
601
- A(() => {
612
+ const ke = (t) => _.has(t) ? "visible" : "none";
613
+ P(() => {
602
614
  const t = S;
603
- if (!t || (G.current.forEach((a) => {
604
- t.getLayer(ee(a)) && t.removeLayer(ee(a)), t.getLayer(te(a)) && t.removeLayer(te(a)), t.getSource(ge(a)) && t.removeSource(ge(a));
605
- }), G.current = /* @__PURE__ */ new Set(), R.current = /* @__PURE__ */ new Map(), L.current = /* @__PURE__ */ new Map(), x.status !== "ready")) return;
606
- const l = q;
607
- x.taxa.forEach((a) => {
608
- a.mappable.length !== 0 && (R.current.set(a.id, a), Promise.allSettled(
609
- a.mappable.map(
610
- (m) => Ge(m.area.gazetteer, m.area.id).then((g) => ({
611
- record: m,
612
- geojson: g
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((m) => {
627
+ ).then((g) => {
616
628
  if (p.current !== t) return;
617
- const g = [];
618
- m.forEach((F, W) => {
619
- if (F.status !== "fulfilled" || !F.value.geojson) return;
620
- const { record: K, geojson: pe } = F.value, Z = `desc-${a.id}-${W}`;
621
- L.current.set(Z, { taxon: a, record: K }), _e(pe).forEach((J) => {
622
- g.push({
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[a.id] || le, b = { type: "FeatureCollection", features: g }, w = ge(a.id);
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 F = ee(a.id), W = te(a.id), K = p.current.getLayer($) ? $ : void 0;
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: F,
651
+ id: B,
640
652
  type: "fill",
641
653
  source: w,
642
654
  paint: { "fill-color": j, "fill-opacity": 0.55 },
643
- layout: { visibility: Le(a.id) }
655
+ layout: { visibility: ke(i.id) }
644
656
  },
645
- K
657
+ W
646
658
  ), p.current.addLayer(
647
659
  {
648
- id: W,
660
+ id: K,
649
661
  type: "line",
650
662
  source: w,
651
663
  paint: { "line-color": j, "line-width": 2 },
652
- layout: { visibility: Le(a.id) }
664
+ layout: { visibility: ke(i.id) }
653
665
  },
654
- K
655
- ), p.current.on("click", F, et), p.current.on("mouseenter", F, Ie), p.current.on("mouseleave", F, we), G.current.add(a.id);
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, q]);
660
- const et = (t) => {
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 a = (j = t.features) == null ? void 0 : j[0], m = (b = a == null ? void 0 : a.properties) == null ? void 0 : b._recordKey, g = m ? L.current.get(m) : null;
665
- g && (y.current && y.current.remove(), y.current = new V.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(Kt(g.taxon, g.record)).addTo(l));
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
- A(() => {
679
+ P(() => {
668
680
  const t = p.current;
669
- t && G.current.forEach((l) => {
670
- const a = _.has(l) ? "visible" : "none";
671
- t.getLayer(ee(l)) && t.setLayoutProperty(ee(l), "visibility", a), t.getLayer(te(l)) && t.setLayoutProperty(te(l), "visibility", a);
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 ke = () => {
675
- var a;
676
- if (de.current || !s || !i || !o) return;
677
- const t = (a = i == null ? void 0 : i.name) == null ? void 0 : a.rank;
678
- !t || t !== "species" && !ce.includes(t) || Oe(t, o).length === 0 || (de.current = !0, N({ status: "loading", taxa: [] }), Rt({ datasetKey: s, focalTaxon: i, rankOrder: o }).then(
679
- ({ taxa: m, descendantsFailed: g }) => {
680
- if (g) {
681
- N({ status: "error", taxa: [] });
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 (m.length === 0) {
685
- N({ status: "empty", taxa: [] });
696
+ if (g.length === 0) {
697
+ $({ status: "empty", taxa: [] });
686
698
  return;
687
699
  }
688
- N({ status: "ready", taxa: m });
700
+ $({ status: "ready", taxa: g });
689
701
  }
690
702
  ));
691
- }, tt = () => {
692
- xe(!0), ke();
693
- }, nt = ie(() => {
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: Ne(l),
712
+ label: $e(l),
701
713
  taxa: t[l].slice().sort(
702
- (a, m) => a.scientificName.localeCompare(m.scientificName)
714
+ (i, g) => i.scientificName.localeCompare(g.scientificName)
703
715
  )
704
716
  }));
705
- }, [x]), rt = (t) => {
717
+ }, [x]), st = (t) => {
706
718
  be((l) => {
707
- const a = new Set(l);
708
- return a.has(t) ? a.delete(t) : a.add(t), a;
719
+ const i = new Set(l);
720
+ return i.has(t) ? i.delete(t) : i.add(t), i;
709
721
  });
710
- }, st = (t) => {
722
+ }, ot = (t) => {
711
723
  be((l) => {
712
- const a = new Set(l), m = t.every((g) => l.has(g.id));
713
- return t.forEach((g) => {
714
- m ? a.delete(g.id) : a.add(g.id);
715
- }), a;
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 (!$e())
719
- return /* @__PURE__ */ n.jsx(
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__ */ n.jsxs(
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__ */ n.jsx("span", { children: "No curated distribution data." }),
751
- /* @__PURE__ */ n.jsx(
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 ot = ((Ce = i == null ? void 0 : i.name) == null ? void 0 : Ce.scientificName) || "This taxon";
768
- return /* @__PURE__ */ n.jsxs(
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__ */ n.jsx(
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__ */ n.jsx(
784
- Jt,
795
+ /* @__PURE__ */ s.jsx(
796
+ en,
785
797
  {
786
- open: Ze,
787
- onOpen: tt,
798
+ open: Je,
799
+ onOpen: nt,
788
800
  onClose: () => xe(!1),
789
- focalName: ot,
790
- focalReady: O,
801
+ focalName: at,
802
+ focalReady: D,
791
803
  focalVisible: U,
792
- onToggleFocal: () => T((t) => !t),
804
+ onToggleFocal: () => q((t) => !t),
793
805
  gbifEnabled: !!c,
794
806
  gbifVisible: I,
795
807
  gbifAvailable: u,
796
- onToggleGbif: Je,
808
+ onToggleGbif: Xe,
797
809
  descendantStatus: x.status,
798
- descendantsByRank: nt,
799
- descendantColors: q,
810
+ descendantsByRank: rt,
811
+ descendantColors: Y,
800
812
  visibleTaxonIds: _,
801
- onToggleTaxon: rt,
802
- onToggleRankGroup: st,
813
+ onToggleTaxon: st,
814
+ onToggleRankGroup: ot,
803
815
  onRetry: () => {
804
- de.current = !1, N({ status: "idle", taxa: [] }), ke();
816
+ de.current = !1, $({ status: "idle", taxa: [] }), Ce();
805
817
  }
806
818
  }
807
819
  ),
808
- !je && (Se.length > 0 || c && u !== !1 && I) && /* @__PURE__ */ n.jsxs(
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__ */ n.jsxs(
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__ */ n.jsx(
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__ */ n.jsx("span", { children: t.label })
854
+ /* @__PURE__ */ s.jsx("span", { children: t.label })
843
855
  ]
844
856
  },
845
857
  t.key
846
858
  )),
847
- c && u !== !1 && I && /* @__PURE__ */ n.jsx(Tt, {})
859
+ c && u !== !1 && I && /* @__PURE__ */ s.jsx(Jt, {})
848
860
  ]
849
861
  }
850
862
  ),
851
- je && /* @__PURE__ */ n.jsx(
852
- Ot,
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
- }, Jt = ({
874
+ }, en = ({
863
875
  open: e,
864
- onOpen: r,
865
- onClose: s,
866
- focalName: i,
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: B,
876
- descendantColors: R,
887
+ descendantsByRank: M,
888
+ descendantColors: E,
877
889
  visibleTaxonIds: L,
878
- onToggleTaxon: D,
879
- onToggleRankGroup: M,
880
- onRetry: G
881
- }) => e ? /* @__PURE__ */ n.jsxs(
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: s,
912
+ onMouseLeave: r,
901
913
  children: [
902
- /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
903
- /* @__PURE__ */ n.jsx(
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__ */ n.jsx("span", { style: { fontStyle: "italic" }, children: i })
924
+ /* @__PURE__ */ s.jsx("span", { style: { fontStyle: "italic" }, children: a })
913
925
  ] }),
914
- f && /* @__PURE__ */ n.jsxs(
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__ */ n.jsx(
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__ */ n.jsx("span", { children: "GBIF occurrences" })
946
+ /* @__PURE__ */ s.jsx("span", { children: "GBIF occurrences" })
935
947
  ]
936
948
  }
937
949
  ),
938
- y === "loading" && /* @__PURE__ */ n.jsx("div", { style: { marginTop: 6, color: "#888" }, children: "Loading descendants…" }),
939
- y === "error" && /* @__PURE__ */ n.jsxs("div", { style: { marginTop: 6, color: "#888" }, children: [
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__ */ n.jsx("a", { onClick: G, style: { cursor: "pointer" }, children: "Retry" })
954
+ /* @__PURE__ */ s.jsx("a", { onClick: N, style: { cursor: "pointer" }, children: "Retry" })
943
955
  ] }),
944
- y === "ready" && B.map((S) => {
945
- const E = S.taxa.every((v) => L.has(v.id)), O = S.taxa.some((v) => L.has(v.id));
946
- return /* @__PURE__ */ n.jsxs("div", { style: { marginTop: 6 }, children: [
947
- /* @__PURE__ */ n.jsxs(
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__ */ n.jsx(
969
+ /* @__PURE__ */ s.jsx(
958
970
  "input",
959
971
  {
960
972
  type: "checkbox",
961
- checked: E,
973
+ checked: F,
962
974
  ref: (v) => {
963
- v && (v.indeterminate = !E && O);
975
+ v && (v.indeterminate = !F && D);
964
976
  },
965
- onChange: () => M(S.taxa)
977
+ onChange: () => G(S.taxa)
966
978
  }
967
979
  ),
968
980
  S.label
969
981
  ]
970
982
  }
971
983
  ),
972
- /* @__PURE__ */ n.jsx("div", { style: { paddingLeft: 18 }, children: S.taxa.map((v) => /* @__PURE__ */ n.jsxs(
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__ */ n.jsx(
993
+ /* @__PURE__ */ s.jsx(
982
994
  "input",
983
995
  {
984
996
  type: "checkbox",
985
997
  checked: L.has(v.id),
986
- onChange: () => D(v.id)
998
+ onChange: () => O(v.id)
987
999
  }
988
1000
  ),
989
- /* @__PURE__ */ n.jsx(
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: R[v.id],
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__ */ n.jsx("span", { style: { fontStyle: "italic" }, children: qe(v.scientificName) })
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__ */ n.jsx(
1023
+ ) : /* @__PURE__ */ s.jsx(
1012
1024
  "button",
1013
1025
  {
1014
1026
  type: "button",
1015
- onClick: r,
1016
- onMouseEnter: r,
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
- ), Xt = (e) => {
1038
- var r, s;
1039
- return ((r = e == null ? void 0 : e.area) == null ? void 0 : r.gazetteer) !== "text" && !!((s = e == null ? void 0 : e.area) != null && s.globalId);
1040
- }, Ae = ({ datasetKey: e, data: r }) => {
1041
- const [s, i] = k({});
1042
- return A(() => {
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 < r.length; c++)
1045
- if (r[c].gazetteer === "iso") {
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(`${P.dataApi}vocab/country`).then((c) => {
1050
- i(ut(c.data, "alpha3"));
1061
+ o && re(`${R.dataApi}vocab/country`).then((c) => {
1062
+ a(pt(c.data, "alpha3"));
1051
1063
  });
1052
- }, []), /* @__PURE__ */ n.jsx("div", { children: r.map((o, c) => /* @__PURE__ */ n.jsxs("span", { children: [
1053
- (o == null ? void 0 : o.merged) && /* @__PURE__ */ n.jsx(
1054
- mt,
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(s, `[${H(o, "area.name")}].name`) ? pt(H(s, `[${H(o, "area.name")}].name`)) : null) || H(o, "area.name") || H(o, "area.globalId"),
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__ */ n.jsx(
1066
- jt,
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 < r.length - 1 && ", "
1085
+ c < n.length - 1 && ", "
1074
1086
  ] }, c)) });
1075
- }, hn = ({
1087
+ }, yn = ({
1076
1088
  datasetKey: e,
1077
- data: r,
1078
- style: s,
1079
- showDistributionMap: i,
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 = r.filter(Xt), y = r.length - p.length, B = !!u, R = r.length > 0, [L, D] = k("map"), [M, G] = k(0), [S, E] = k(null);
1088
- A(() => {
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
- E(null);
1102
+ F(null);
1091
1103
  return;
1092
1104
  }
1093
- E(null);
1105
+ F(null);
1094
1106
  let I = !1;
1095
- return ft.get(`${P.gbifApi}/v1/occurrence/search`, {
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 || E(((_ = z == null ? void 0 : z.data) == null ? void 0 : _.count) ?? 0);
1119
+ I || F(((_ = z == null ? void 0 : z.data) == null ? void 0 : _.count) ?? 0);
1108
1120
  },
1109
1121
  () => {
1110
- I || E(null);
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 O = B ? S === null || S > 0 : !1, v = p.length > 0 && M >= p.length, x = i && (p.length > 0 || O) && !(p.length > 0 && v && !O);
1117
- if (!x && !R) return null;
1118
- const N = y + M, U = R;
1119
- let T;
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
- T = /* @__PURE__ */ n.jsx(Ae, { datasetKey: e, data: r });
1133
+ q = /* @__PURE__ */ s.jsx(Pe, { datasetKey: e, data: n });
1122
1134
  else {
1123
1135
  const I = U ? L : "map";
1124
- T = /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1125
- U ? /* @__PURE__ */ n.jsxs(
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) => D(z.target.value),
1142
+ onChange: (z) => O(z.target.value),
1131
1143
  style: { marginBottom: 8 },
1132
1144
  children: [
1133
- /* @__PURE__ */ n.jsx(fe.Button, { value: "map", children: "Map" }),
1134
- /* @__PURE__ */ n.jsx(fe.Button, { value: "list", children: "List" })
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__ */ n.jsx("div", { style: { height: 24, marginBottom: 8 } })
1152
+ /* @__PURE__ */ s.jsx("div", { style: { height: 24, marginBottom: 8 } })
1141
1153
  ),
1142
- I === "map" ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1143
- /* @__PURE__ */ n.jsx(
1144
- Zt,
1154
+ I === "map" ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
1155
+ /* @__PURE__ */ s.jsx(
1156
+ Qt,
1145
1157
  {
1146
1158
  records: p,
1147
- onUnmappable: G,
1159
+ onUnmappable: N,
1148
1160
  datasetKey: e,
1149
1161
  focalTaxon: o,
1150
1162
  rankOrder: c,
1151
1163
  gbifChecklistKey: u,
1152
- gbifAvailable: O,
1164
+ gbifAvailable: D,
1153
1165
  basemapStyle: f
1154
1166
  }
1155
1167
  ),
1156
- U && N > 0 && /* @__PURE__ */ n.jsx("div", { style: { marginTop: 6 }, children: /* @__PURE__ */ n.jsxs("a", { onClick: () => D("list"), style: { cursor: "pointer" }, children: [
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
- N,
1170
+ $,
1159
1171
  " distribution",
1160
- N === 1 ? "" : "s",
1172
+ $ === 1 ? "" : "s",
1161
1173
  " not on map"
1162
1174
  ] }) })
1163
- ] }) : /* @__PURE__ */ n.jsx(Ae, { datasetKey: e, data: r })
1175
+ ] }) : /* @__PURE__ */ s.jsx(Pe, { datasetKey: e, data: n })
1164
1176
  ] });
1165
1177
  }
1166
- const se = /* @__PURE__ */ n.jsx("div", { style: s, children: T });
1167
- return d ? /* @__PURE__ */ n.jsx(yt, { md: h, label: d, children: se }) : se;
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
- hn as D,
1171
- jt as R
1182
+ yn as D,
1183
+ It as R
1172
1184
  };
1173
- //# sourceMappingURL=Distributions-Dwjo7KhA.js.map
1185
+ //# sourceMappingURL=Distributions-Czffme5Y.js.map