col-browser 2.2.2 → 2.2.3

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