col-browser 2.3.3 → 2.3.5

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