col-browser 2.3.2 → 2.3.4

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