col-browser 2.1.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/tree.js CHANGED
@@ -1,29 +1,30 @@
1
- var Z = Object.defineProperty;
2
- var q = (C, y, e) => y in C ? Z(C, y, { enumerable: !0, configurable: !0, writable: !0, value: e }) : C[y] = e;
3
- var c = (C, y, e) => q(C, typeof y != "symbol" ? y + "" : y, e);
4
- import { a as J } from "./chunks/withDatasetKey-BgMY05XE.js";
5
- import { c as T, w as Q } from "./chunks/config-BPRXv9x8.js";
1
+ var J = Object.defineProperty;
2
+ var Q = (C, y, e) => y in C ? J(C, y, { enumerable: !0, configurable: !0, writable: !0, value: e }) : C[y] = e;
3
+ var c = (C, y, e) => Q(C, typeof y != "symbol" ? y + "" : y, e);
4
+ import { a as X } from "./chunks/withDatasetKey-BgMY05XE.js";
5
+ import { c as S, w as Y } from "./chunks/config-BPRXv9x8.js";
6
6
  import { j as t } from "./chunks/jsx-runtime-BzflLqGi.js";
7
- import j, { createContext as X } from "react";
8
- import { Popover as Y, Divider as ee, Spin as M, Tag as te, Alert as b, Skeleton as se, Tree as ae, Button as oe, Row as ie, Col as w, Checkbox as $ } from "antd";
9
- import { sortBy as N, get as m, isUndefined as I, flatten as ne, isArray as A } from "lodash-es";
10
- import { L, c as D, R as B, s as re, b as le } from "./chunks/router-CssZk5qZ.js";
11
- import S from "dataloader";
12
- import { c as R, b as U, g as de } from "./chunks/dataset-DvQG4NjA.js";
13
- import { M as he } from "./chunks/MergedDataBadge-DsTsn5Xu.js";
14
- import { E as ce } from "./chunks/ErrorMsg-K8k5PPTp.js";
15
- import { g as pe } from "./chunks/sector-BnVzMnMO.js";
16
- import { C as F, N as ue } from "./chunks/DatasetCitation-bkPmDDYB.js";
17
- const P = X({
7
+ import j, { createContext as ee } from "react";
8
+ import { Popover as te, Divider as se, Spin as R, Tag as ae, Alert as b, Skeleton as oe, Tree as ie, Button as ne, Row as re, Col as v, Checkbox as $ } from "antd";
9
+ import { sortBy as N, get as m, isUndefined as I, flatten as le, isArray as A } from "lodash-es";
10
+ import { L, c as D, R as U, s as de, b as he } from "./chunks/router-CssZk5qZ.js";
11
+ import T from "dataloader";
12
+ import { c as W, b as H, g as ce } from "./chunks/dataset-DvQG4NjA.js";
13
+ import { M as pe } from "./chunks/MergedDataBadge-DsTsn5Xu.js";
14
+ import { E as ue } from "./chunks/ErrorMsg-K8k5PPTp.js";
15
+ import { g as fe } from "./chunks/sector-BnVzMnMO.js";
16
+ import { C as F, N as xe } from "./chunks/DatasetCitation-bkPmDDYB.js";
17
+ import { r as O, w as M } from "./chunks/storage-BgdCo9fV.js";
18
+ const w = ee({
18
19
  datasetLoader: null,
19
20
  publisherLoader: null
20
- }), O = (C) => ({
21
- datasetLoader: new S((y) => U(y, C)),
22
- publisherLoader: new S(
23
- (y) => R(y, C)
21
+ }), B = (C) => ({
22
+ datasetLoader: new T((y) => H(y, C)),
23
+ publisherLoader: new T(
24
+ (y) => W(y, C)
24
25
  )
25
26
  });
26
- class W extends j.Component {
27
+ class V extends j.Component {
27
28
  constructor(e) {
28
29
  super(e);
29
30
  // Returns the shared cache from TreeCacheContext if available, or a
@@ -33,15 +34,15 @@ class W extends j.Component {
33
34
  c(this, "getDatasetLoader", () => {
34
35
  var s;
35
36
  const { datasetKey: e } = this.props;
36
- return (s = this.context) != null && s.datasetLoader ? this.context.datasetLoader : (this._localDatasetLoader || (this._localDatasetLoader = new S(
37
- (o) => U(o, e)
37
+ return (s = this.context) != null && s.datasetLoader ? this.context.datasetLoader : (this._localDatasetLoader || (this._localDatasetLoader = new T(
38
+ (o) => H(o, e)
38
39
  )), this._localDatasetLoader);
39
40
  });
40
41
  c(this, "getPublisherLoader", () => {
41
42
  var s;
42
43
  const { datasetKey: e } = this.props;
43
- return (s = this.context) != null && s.publisherLoader ? this.context.publisherLoader : (this._localPublisherLoader || (this._localPublisherLoader = new S(
44
- (o) => R(o, e)
44
+ return (s = this.context) != null && s.publisherLoader ? this.context.publisherLoader : (this._localPublisherLoader || (this._localPublisherLoader = new T(
45
+ (o) => W(o, e)
45
46
  )), this._localPublisherLoader);
46
47
  });
47
48
  c(this, "componentDidMount", () => {
@@ -79,26 +80,26 @@ class W extends j.Component {
79
80
  });
80
81
  });
81
82
  c(this, "render", () => {
82
- const { data: e, showInNode: s, popOverVisible: o, loading: r } = this.state, { taxon: l, datasetKey: h } = this.props, i = { color: "orange", fontSize: "11px" }, u = (a) => `${T.clbPortal}/dataset/${h}/publisher/${a}`;
83
+ const { data: e, showInNode: s, popOverVisible: o, loading: r } = this.state, { taxon: l, datasetKey: h } = this.props, n = { color: "orange", fontSize: "11px" }, u = (a) => `${S.clbPortal}/dataset/${h}/publisher/${a}`;
83
84
  return s ? e.filter((a) => !!a).map((a, d) => /* @__PURE__ */ t.jsx(
84
85
  L,
85
86
  {
86
87
  to: "source",
87
88
  args: a.key,
88
89
  className: "col-tree-data-source",
89
- style: i,
90
+ style: n,
90
91
  children: (d ? ", " : "") + (a.alias || a.key)
91
92
  },
92
93
  a.key
93
94
  )) : /* @__PURE__ */ t.jsx("div", { style: { display: "inline" }, id: `taxon_sources_${l.id}`, children: /* @__PURE__ */ t.jsx(
94
- Y,
95
+ te,
95
96
  {
96
97
  getPopupContainer: () => document.getElementById(`taxon_sources_${l.id}`),
97
98
  content: r || e.length === 0 ? /* @__PURE__ */ t.jsx(
98
99
  "div",
99
100
  {
100
101
  style: { minWidth: "200px", textAlign: "center", padding: "8px 0" },
101
- children: /* @__PURE__ */ t.jsx(M, { size: "small" })
102
+ children: /* @__PURE__ */ t.jsx(R, { size: "small" })
102
103
  }
103
104
  ) : /* @__PURE__ */ t.jsxs("div", { style: { maxWidth: "500px" }, children: [
104
105
  e.length > 0 && /* @__PURE__ */ t.jsx("div", { children: e.filter((a) => !!a).map((a, d) => /* @__PURE__ */ t.jsx(
@@ -107,7 +108,7 @@ class W extends j.Component {
107
108
  to: "source",
108
109
  args: a.key,
109
110
  className: "col-tree-data-source",
110
- style: i,
111
+ style: n,
111
112
  children: (d ? ", " : "") + (a.alias || a.key)
112
113
  },
113
114
  a.key
@@ -122,7 +123,7 @@ class W extends j.Component {
122
123
  href: u(a.id),
123
124
  target: "_blank",
124
125
  rel: "noopener noreferrer",
125
- style: i,
126
+ style: n,
126
127
  children: [
127
128
  (d ? ", " : "") + (a.alias || a.id),
128
129
  (f = a.datasets) != null && f.length ? ` (${a.datasets.length.toLocaleString("en-GB")})` : ""
@@ -136,7 +137,7 @@ class W extends j.Component {
136
137
  title: /* @__PURE__ */ t.jsxs("div", { style: { padding: "4px 0" }, children: [
137
138
  /* @__PURE__ */ t.jsx("span", { style: { fontWeight: 500 }, children: "Sources for " }),
138
139
  /* @__PURE__ */ t.jsx("em", { children: l == null ? void 0 : l.name }),
139
- /* @__PURE__ */ t.jsx(ee, { style: { margin: "8px 0 0" } })
140
+ /* @__PURE__ */ t.jsx(se, { style: { margin: "8px 0 0" } })
140
141
  ] }),
141
142
  open: o,
142
143
  onOpenChange: (a) => this.setState({ popOverVisible: a }, () => {
@@ -165,8 +166,8 @@ class W extends j.Component {
165
166
  };
166
167
  }
167
168
  }
168
- c(W, "contextType", P);
169
- const H = j.createContext();
169
+ c(V, "contextType", w);
170
+ const z = j.createContext();
170
171
  class k extends j.Component {
171
172
  constructor(e) {
172
173
  super(e);
@@ -176,21 +177,21 @@ class k extends j.Component {
176
177
  taxon: e,
177
178
  taxon: { sector: s, sourceDatasetKeys: o, publisherDatasetKeys: r },
178
179
  datasetKey: l
179
- } = this.props, h = m(s, "dataset"), i = (o || []).filter((a) => (s == null ? void 0 : s.subjectDatasetKey) !== a).length > 0;
180
+ } = this.props, h = m(s, "dataset"), n = (o || []).filter((a) => (s == null ? void 0 : s.subjectDatasetKey) !== a).length > 0;
180
181
  e.estimate && e.estimates && e.estimates.find((a) => a.estimate === e.estimate);
181
182
  const u = typeof e.id == "string" && e.id.indexOf("incertae-sedis") > -1;
182
- return /* @__PURE__ */ t.jsx(H.Consumer, { children: ({ showInfo: a }) => /* @__PURE__ */ t.jsxs("div", { id: e.id, children: [
183
+ return /* @__PURE__ */ t.jsx(z.Consumer, { children: ({ showInfo: a }) => /* @__PURE__ */ t.jsxs("div", { id: e.id, children: [
183
184
  /* @__PURE__ */ t.jsxs("span", { children: [
184
185
  /* @__PURE__ */ t.jsxs("span", { className: "tree-node-rank", children: [
185
186
  e.rank,
186
187
  ": "
187
188
  ] }),
188
189
  u ? /* @__PURE__ */ t.jsx("span", { dangerouslySetInnerHTML: { __html: e.labelHtml } }) : /* @__PURE__ */ t.jsx(L, { to: "taxon", args: e.id, children: /* @__PURE__ */ t.jsx("span", { dangerouslySetInnerHTML: { __html: e.labelHtml } }) }),
189
- (e == null ? void 0 : e.merged) && /* @__PURE__ */ t.jsx(he, { style: { marginLeft: "4px" }, datasetKey: e == null ? void 0 : e.datasetKey, verbatimSourceKey: e == null ? void 0 : e.verbatimSourceKey })
190
+ (e == null ? void 0 : e.merged) && /* @__PURE__ */ t.jsx(pe, { style: { marginLeft: "4px" }, datasetKey: e == null ? void 0 : e.datasetKey, verbatimSourceKey: e == null ? void 0 : e.verbatimSourceKey })
190
191
  ] }),
191
192
  a && e.status === "provisionally accepted" && /* @__PURE__ */ t.jsxs(j.Fragment, { children: [
192
193
  " • ",
193
- /* @__PURE__ */ t.jsx(te, { color: "warning", style: { marginRight: 0 }, children: "prov." })
194
+ /* @__PURE__ */ t.jsx(ae, { color: "warning", style: { marginRight: 0 }, children: "prov." })
194
195
  ] }),
195
196
  !I(e.count) && this.rankIsAboveSpecies(e == null ? void 0 : e.rank) && /* @__PURE__ */ t.jsxs("span", { children: [
196
197
  " ",
@@ -217,19 +218,19 @@ class k extends j.Component {
217
218
  {
218
219
  to: "source",
219
220
  args: s.subjectDatasetKey,
220
- style: i ? { fontWeight: "bold" } : null,
221
+ style: n ? { fontWeight: "bold" } : null,
221
222
  className: "col-tree-data-source",
222
223
  children: [
223
224
  m(h, "alias") || s.subjectDatasetKey,
224
- i && ", "
225
+ n && ", "
225
226
  ]
226
227
  }
227
228
  )
228
229
  ] }),
229
- a && i && /* @__PURE__ */ t.jsxs(j.Fragment, { children: [
230
+ a && n && /* @__PURE__ */ t.jsxs(j.Fragment, { children: [
230
231
  " ",
231
232
  /* @__PURE__ */ t.jsx(
232
- W,
233
+ V,
233
234
  {
234
235
  sourceDatasetKeys: o,
235
236
  publisherDatasetKeys: r,
@@ -248,7 +249,7 @@ class k extends j.Component {
248
249
  }
249
250
  }
250
251
  const K = 1e3;
251
- class fe extends j.Component {
252
+ class ge extends j.Component {
252
253
  constructor(e) {
253
254
  super(e);
254
255
  c(this, "onClick", () => {
@@ -260,20 +261,20 @@ class fe extends j.Component {
260
261
  c(this, "render", () => {
261
262
  const { loading: e } = this.state;
262
263
  return /* @__PURE__ */ t.jsxs(j.Fragment, { children: [
263
- e && /* @__PURE__ */ t.jsx(M, {}),
264
+ e && /* @__PURE__ */ t.jsx(R, {}),
264
265
  !e && /* @__PURE__ */ t.jsx("a", { onClick: this.onClick, children: /* @__PURE__ */ t.jsx("strong", { children: "Load more..." }) })
265
266
  ] });
266
267
  });
267
268
  this.state = { loading: !1 };
268
269
  }
269
270
  }
270
- class V extends j.Component {
271
+ class G extends j.Component {
271
272
  constructor(e) {
272
273
  super(e);
273
274
  c(this, "componentDidMount", () => {
274
275
  const { datasetKey: e } = this.props;
275
- this.loadRoot(), this.sectorLoader = new S(
276
- (o) => pe(o, e)
276
+ this.loadRoot(), this.sectorLoader = new T(
277
+ (o) => fe(o, e)
277
278
  ), this.getRank();
278
279
  const { treeRef: s } = this.props;
279
280
  s(this);
@@ -282,7 +283,7 @@ class V extends j.Component {
282
283
  (e.defaultExpandKey !== this.props.defaultExpandKey || e.hideExtinct !== this.props.hideExtinct || e.insertPlaceholder !== this.props.insertPlaceholder) && this.reloadRoot();
283
284
  });
284
285
  c(this, "getRank", () => {
285
- D(`${T.dataApi}vocab/rank`).then(
286
+ D(`${S.dataApi}vocab/rank`).then(
286
287
  (e) => this.setState({ rank: e.data.map((s) => s.name) })
287
288
  );
288
289
  });
@@ -305,12 +306,12 @@ class V extends j.Component {
305
306
  insertPlaceholder: r,
306
307
  type: l,
307
308
  expandedTaxonKey: h
308
- } = this.props, i = h, { defaultTaxonKey: u } = this.props;
309
+ } = this.props, n = h, { defaultTaxonKey: u } = this.props;
309
310
  return this.setState({ rootLoading: !0, treeData: [] }), D(
310
- `${T.dataApi}dataset/${s}/tree?projectKey=${s}${l ? "&type=" + l : ""}&limit=${K}&offset=${this.state.treeData.length}${o ? "&extinct=false&extinct=" : ""}${r ? "&insertPlaceholder=true" : ""}`
311
+ `${S.dataApi}dataset/${s}/tree?projectKey=${s}${l ? "&type=" + l : ""}&limit=${K}&offset=${this.state.treeData.length}${o ? "&extinct=false&extinct=" : ""}${r ? "&insertPlaceholder=true" : ""}`
311
312
  ).then(this.decorateWithSectorsAndDataset).then((a) => {
312
313
  const d = a.data.result || [], f = a.data.total, x = d.map((p) => {
313
- let n = {
314
+ let i = {
314
315
  taxon: p,
315
316
  key: p.id,
316
317
  datasetKey: s,
@@ -318,16 +319,16 @@ class V extends j.Component {
318
319
  isLeaf: p.childCount === 0,
319
320
  childOffset: 0
320
321
  };
321
- return n.title = /* @__PURE__ */ t.jsx(
322
+ return i.title = /* @__PURE__ */ t.jsx(
322
323
  k,
323
324
  {
324
325
  taxon: p,
325
326
  datasetKey: s,
326
327
  showSourceTaxon: e,
327
- reloadChildren: () => this.fetchChildPage(n, !0),
328
+ reloadChildren: () => this.fetchChildPage(i, !0),
328
329
  rank: this.state.rank
329
330
  }
330
- ), n.ref = n, n;
331
+ ), i.ref = i, i;
331
332
  });
332
333
  this.setState(
333
334
  {
@@ -338,8 +339,8 @@ class V extends j.Component {
338
339
  error: null
339
340
  },
340
341
  () => {
341
- if (i)
342
- return this.expandToTaxon(i);
342
+ if (n)
343
+ return this.expandToTaxon(n);
343
344
  if (u)
344
345
  return this.expandToTaxon(u);
345
346
  }
@@ -365,7 +366,7 @@ class V extends j.Component {
365
366
  /* , treeData: [] */
366
367
  });
367
368
  const { data: h } = await D(
368
- `${T.dataApi}dataset/${o}/tree/${e}?projectKey=${o}&insertPlaceholder=true${l ? "&type=" + l : ""}${r ? "&extinct=false" : ""}`
369
+ `${S.dataApi}dataset/${o}/tree/${e}?projectKey=${o}&insertPlaceholder=true${l ? "&type=" + l : ""}${r ? "&extinct=false" : ""}`
369
370
  ).then(
370
371
  (p) => this.decorateWithSectorsAndDataset({
371
372
  data: { result: p.data }
@@ -380,19 +381,19 @@ class V extends j.Component {
380
381
  },
381
382
  this.loadRoot
382
383
  );
383
- const i = h[h.length - 1];
384
+ const n = h[h.length - 1];
384
385
  let u = {
385
- taxon: i,
386
- key: i.id,
386
+ taxon: n,
387
+ key: n.id,
387
388
  datasetKey: o,
388
- childCount: i.childCount,
389
- isLeaf: i.childCount === 0,
389
+ childCount: n.childCount,
390
+ isLeaf: n.childCount === 0,
390
391
  childOffset: 0
391
392
  };
392
393
  u.title = /* @__PURE__ */ t.jsx(
393
394
  k,
394
395
  {
395
- taxon: i,
396
+ taxon: n,
396
397
  datasetKey: o,
397
398
  showSourceTaxon: s,
398
399
  rank: this.state.rank,
@@ -401,18 +402,18 @@ class V extends j.Component {
401
402
  ), u.ref = u;
402
403
  const a = u;
403
404
  for (let p = h.length - 2; p >= 0; p--) {
404
- const n = h[p], g = {
405
- taxon: n,
406
- key: n.id,
405
+ const i = h[p], g = {
406
+ taxon: i,
407
+ key: i.id,
407
408
  datasetKey: o,
408
- childCount: n.childCount,
409
- isLeaf: n.childCount === 0,
409
+ childCount: i.childCount,
410
+ isLeaf: i.childCount === 0,
410
411
  childOffset: 0
411
412
  };
412
413
  g.ref = g, g.title = /* @__PURE__ */ t.jsx(
413
414
  k,
414
415
  {
415
- taxon: n,
416
+ taxon: i,
416
417
  datasetKey: o,
417
418
  showSourceTaxon: s,
418
419
  rank: this.state.rank,
@@ -434,29 +435,29 @@ class V extends j.Component {
434
435
  showSourceTaxon: r,
435
436
  datasetKey: l,
436
437
  hideExtinct: h,
437
- insertPlaceholder: i,
438
+ insertPlaceholder: n,
438
439
  type: u
439
440
  } = this.props, { treeData: a } = this.state;
440
441
  m(e, "childCount");
441
442
  const d = K, f = m(e, "childOffset"), x = await D(
442
- `${T.dataApi}dataset/${l}/tree/${e.taxon.id}/children?limit=${d}&offset=${f}&projectKey=${l}${u ? "&type=" + u : ""}${h ? "&extinct=false" : ""}${i ? "&insertPlaceholder=true" : ""}`
443
+ `${S.dataApi}dataset/${l}/tree/${e.taxon.id}/children?limit=${d}&offset=${f}&projectKey=${l}${u ? "&type=" + u : ""}${h ? "&extinct=false" : ""}${n ? "&insertPlaceholder=true" : ""}`
443
444
  );
444
445
  await this.decorateWithSectorsAndDataset(x);
445
- const p = x.data.result ? x.data.result.map((n) => {
446
+ const p = x.data.result ? x.data.result.map((i) => {
446
447
  let g = {
447
- taxon: n,
448
- key: n.id,
448
+ taxon: i,
449
+ key: i.id,
449
450
  datasetKey: l,
450
- childCount: n.childCount,
451
- isLeaf: n.childCount === 0,
451
+ childCount: i.childCount,
452
+ isLeaf: i.childCount === 0,
452
453
  childOffset: 0,
453
454
  parent: e,
454
- name: n.name
455
+ name: i.name
455
456
  };
456
457
  return g.title = /* @__PURE__ */ t.jsx(
457
458
  k,
458
459
  {
459
- taxon: n,
460
+ taxon: i,
460
461
  datasetKey: l,
461
462
  showSourceTaxon: r,
462
463
  rank: this.state.rank,
@@ -465,14 +466,14 @@ class V extends j.Component {
465
466
  ), g.ref = g, g;
466
467
  }) : [];
467
468
  if (e.children = e.children && f !== 0 && !s ? [...e.children, ...p] : p, x.data.last && e.childCount > e.children.length && (e.childCount = e.children.length), !x.data.last) {
468
- const n = () => (e.childOffset += K, e.children[e.children.length - 1].key === "__loadMoreBTN__" && (e.children = e.children.slice(0, -1)), this.fetchChildPage(e, !1));
469
+ const i = () => (e.childOffset += K, e.children[e.children.length - 1].key === "__loadMoreBTN__" && (e.children = e.children.slice(0, -1)), this.fetchChildPage(e, !1));
469
470
  e.children = [
470
471
  ...e.children,
471
472
  {
472
473
  title: /* @__PURE__ */ t.jsx(
473
- fe,
474
+ ge,
474
475
  {
475
- onClick: n
476
+ onClick: i
476
477
  },
477
478
  "__loadMoreBTN__"
478
479
  ),
@@ -504,7 +505,7 @@ class V extends j.Component {
504
505
  if (o = s.find((r) => m(r, "taxon.id") === e), o)
505
506
  return o;
506
507
  {
507
- const r = s.map((h) => m(h, "children") || []), l = ne(r);
508
+ const r = s.map((h) => m(h, "children") || []), l = le(r);
508
509
  return l.length === 0 ? null : this.findNode(e, l);
509
510
  }
510
511
  });
@@ -520,15 +521,15 @@ class V extends j.Component {
520
521
  this.setState({ rootLoading: !0 });
521
522
  const { loadedKeys: r } = this.state;
522
523
  let { treeData: l } = this.state;
523
- const h = s ? this.findNode(s, l) : null, i = e ? [...e] : [...r];
524
- for (let a = 0; a < i.length; a++) {
525
- let d = this.findNode(i[a], l);
526
- if (!d && h && i[a - 1]) {
527
- const f = this.findNode(i[a - 1], l);
524
+ const h = s ? this.findNode(s, l) : null, n = e ? [...e] : [...r];
525
+ for (let a = 0; a < n.length; a++) {
526
+ let d = this.findNode(n[a], l);
527
+ if (!d && h && n[a - 1]) {
528
+ const f = this.findNode(n[a - 1], l);
528
529
  f && A(m(f, "children")) && f.children.length > 0 && (d = await this.pageThroughChildrenUntilTaxonFound(
529
530
  f,
530
- i[a]
531
- ), d ? i.splice(a, 0, d.taxon.id) : this.setState(
531
+ n[a]
532
+ ), d ? n.splice(a, 0, d.taxon.id) : this.setState(
532
533
  {
533
534
  nodeNotFoundErr: /* @__PURE__ */ t.jsxs("span", { children: [
534
535
  "Cannot find taxon ",
@@ -553,7 +554,7 @@ class V extends j.Component {
553
554
  let f = d.children.find(
554
555
  (x) => m(x, "taxon.id") === m(h, "taxon.id")
555
556
  );
556
- h && a === i.length - 2 && m(d, "taxon.id") !== m(h, "taxon.id") && A(d.children) && !f && d.children.length < d.childCount && (f = await this.pageThroughChildrenUntilTaxonFound(
557
+ h && a === n.length - 2 && m(d, "taxon.id") !== m(h, "taxon.id") && A(d.children) && !f && d.children.length < d.childCount && (f = await this.pageThroughChildrenUntilTaxonFound(
557
558
  d,
558
559
  m(h, "taxon.id")
559
560
  ), f ? this.setState({ treeData: [...this.state.treeData] }, () => {
@@ -575,8 +576,8 @@ class V extends j.Component {
575
576
  ));
576
577
  }
577
578
  }
578
- const u = { loadedKeys: i, rootLoading: !1 };
579
- o && (u.expandedKeys = i), this.setState(u, () => {
579
+ const u = { loadedKeys: n, rootLoading: !1 };
580
+ o && (u.expandedKeys = n), this.setState(u, () => {
580
581
  s && setTimeout(() => {
581
582
  document.getElementById(s).scrollIntoView({ behavior: "smooth", block: "center" });
582
583
  }, 100);
@@ -607,7 +608,7 @@ class V extends j.Component {
607
608
  treeData: r,
608
609
  defaultExpandAll: l,
609
610
  nodeNotFoundErr: h,
610
- loadedKeys: i,
611
+ loadedKeys: n,
611
612
  expandedKeys: u
612
613
  } = this.state, { treeType: a, dataset: d, height: f, expandedTaxonKey: x } = this.props, p = x;
613
614
  return /* @__PURE__ */ t.jsxs("div", { children: [
@@ -617,7 +618,7 @@ class V extends j.Component {
617
618
  closable: !0,
618
619
  onClose: () => this.setState({ error: null }),
619
620
  style: { marginTop: "8px" },
620
- message: /* @__PURE__ */ t.jsx(ce, { error: e }),
621
+ message: /* @__PURE__ */ t.jsx(ue, { error: e }),
621
622
  type: "error"
622
623
  }
623
624
  ) : /* @__PURE__ */ t.jsx(
@@ -648,47 +649,47 @@ class V extends j.Component {
648
649
  type: "warning"
649
650
  }
650
651
  ),
651
- o && /* @__PURE__ */ t.jsx(se, { paragraph: { rows: 10 }, active: !0 }),
652
+ o && /* @__PURE__ */ t.jsx(oe, { paragraph: { rows: 10 }, active: !0 }),
652
653
  !o && r.length > 0 && /* @__PURE__ */ t.jsx(
653
- ae,
654
+ ie,
654
655
  {
655
656
  ref: this.treeRef,
656
657
  defaultExpandAll: l,
657
658
  loadData: this.onLoadData,
658
- onLoad: (n) => this.setState({ loadedKeys: n }),
659
- loadedKeys: i,
659
+ onLoad: (i) => this.setState({ loadedKeys: i }),
660
+ loadedKeys: n,
660
661
  expandedKeys: u,
661
662
  treeData: r,
662
- filterTreeNode: (n) => n.key === p,
663
- onExpand: (n, g) => {
664
- this.setState({ expandedKeys: n }), this.props.onExpandedTaxonKeyChange && this.props.onExpandedTaxonKeyChange(
663
+ filterTreeNode: (i) => i.key === p,
664
+ onExpand: (i, g) => {
665
+ this.setState({ expandedKeys: i }), this.props.onExpandedTaxonKeyChange && this.props.onExpandedTaxonKeyChange(
665
666
  g.expanded ? g.node.key : null
666
667
  );
667
668
  }
668
669
  }
669
670
  ),
670
- !e && r.length < s && /* @__PURE__ */ t.jsxs(oe, { loading: o, onClick: this.loadRoot, children: [
671
+ !e && r.length < s && /* @__PURE__ */ t.jsxs(ne, { loading: o, onClick: this.loadRoot, children: [
671
672
  "Load more",
672
673
  " "
673
674
  ] })
674
675
  ] });
675
676
  }
676
677
  }
677
- c(V, "contextType", P);
678
- const xe = [
678
+ c(G, "contextType", w);
679
+ const ye = [
679
680
  "infraspecific name",
680
681
  "species",
681
682
  "variety",
682
683
  "form"
683
684
  ];
684
- class z extends j.Component {
685
+ class Z extends j.Component {
685
686
  constructor(e) {
686
687
  super(e);
687
688
  c(this, "componentDidMount", async () => {
688
689
  const { datasetKey: e, citation: s } = this.props;
689
690
  if (s)
690
691
  try {
691
- const { data: o } = await de(e);
692
+ const { data: o } = await ce(e);
692
693
  this.setState({ dataset: o });
693
694
  } catch {
694
695
  }
@@ -701,27 +702,27 @@ class z extends j.Component {
701
702
  onExpandedTaxonKeyChange: r,
702
703
  showTreeOptions: l,
703
704
  linkToSpeciesPage: h,
704
- citation: i,
705
+ citation: n,
705
706
  type: u,
706
707
  insertPlaceholder: a = !0
707
- } = this.props, { hideExtinct: d, dataset: f } = this.state, x = (n) => {
708
- var _, v;
709
- const g = m(n, "key");
708
+ } = this.props, { hideExtinct: d, dataset: f } = this.state, x = (i) => {
709
+ var P, _;
710
+ const g = m(i, "key");
710
711
  if (!g) return;
711
- const G = m(n, "rank");
712
- if (h && xe.includes(G)) {
713
- const E = (v = (_ = this.context) == null ? void 0 : _.taxon) == null ? void 0 : v.onNavigate;
712
+ const q = m(i, "rank");
713
+ if (h && ye.includes(q)) {
714
+ const E = (_ = (P = this.context) == null ? void 0 : P.taxon) == null ? void 0 : _.onNavigate;
714
715
  E && E(g);
715
716
  } else r && (r(g), this.treeRef && this.treeRef.reloadRoot && this.treeRef.reloadRoot());
716
717
  }, p = () => {
717
718
  r && r(null);
718
719
  };
719
720
  return /* @__PURE__ */ t.jsxs("div", { className: "catalogue-of-life", children: [
720
- i === "top" && f && /* @__PURE__ */ t.jsx(F, { dataset: f }),
721
- /* @__PURE__ */ t.jsx(P.Provider, { value: this.cache, children: /* @__PURE__ */ t.jsxs(H.Provider, { value: this.state, children: [
722
- /* @__PURE__ */ t.jsxs(ie, { children: [
723
- /* @__PURE__ */ t.jsx(w, { flex: "auto", children: /* @__PURE__ */ t.jsx(
724
- ue,
721
+ n === "top" && f && /* @__PURE__ */ t.jsx(F, { dataset: f }),
722
+ /* @__PURE__ */ t.jsx(w.Provider, { value: this.cache, children: /* @__PURE__ */ t.jsxs(z.Provider, { value: this.state, children: [
723
+ /* @__PURE__ */ t.jsxs(re, { children: [
724
+ /* @__PURE__ */ t.jsx(v, { flex: "auto", children: /* @__PURE__ */ t.jsx(
725
+ xe,
725
726
  {
726
727
  hideExtinct: d,
727
728
  datasetKey: e,
@@ -735,12 +736,13 @@ class z extends j.Component {
735
736
  onResetSearch: p
736
737
  }
737
738
  ) }),
738
- l && /* @__PURE__ */ t.jsxs(w, { style: { paddingLeft: "8px" }, children: [
739
+ l && /* @__PURE__ */ t.jsxs(v, { style: { paddingLeft: "8px" }, children: [
739
740
  /* @__PURE__ */ t.jsx(
740
741
  $,
741
742
  {
742
- onChange: ({ target: { checked: n } }) => {
743
- this.setState({ showInfo: n });
743
+ defaultChecked: this.state.showInfo,
744
+ onChange: ({ target: { checked: i } }) => {
745
+ this.setState({ showInfo: i }), M("tree-show-source", i);
744
746
  },
745
747
  children: "Source"
746
748
  }
@@ -748,9 +750,9 @@ class z extends j.Component {
748
750
  /* @__PURE__ */ t.jsx(
749
751
  $,
750
752
  {
751
- defaultChecked: !1,
752
- onChange: ({ target: { checked: n } }) => {
753
- this.setState({ hideExtinct: n });
753
+ defaultChecked: this.state.hideExtinct,
754
+ onChange: ({ target: { checked: i } }) => {
755
+ this.setState({ hideExtinct: i }), M("tree-extant-only", i);
754
756
  },
755
757
  children: "Extant only"
756
758
  }
@@ -758,7 +760,7 @@ class z extends j.Component {
758
760
  ] })
759
761
  ] }),
760
762
  /* @__PURE__ */ t.jsx(
761
- V,
763
+ G,
762
764
  {
763
765
  insertPlaceholder: a,
764
766
  hideExtinct: d,
@@ -766,26 +768,26 @@ class z extends j.Component {
766
768
  defaultTaxonKey: s,
767
769
  expandedTaxonKey: o,
768
770
  onExpandedTaxonKeyChange: r,
769
- treeRef: (n) => this.treeRef = n,
771
+ treeRef: (i) => this.treeRef = i,
770
772
  type: u
771
773
  }
772
774
  )
773
775
  ] }) }),
774
- i === "bottom" && f && /* @__PURE__ */ t.jsx(F, { dataset: f })
776
+ n === "bottom" && f && /* @__PURE__ */ t.jsx(F, { dataset: f })
775
777
  ] });
776
778
  });
777
- re(this.props.auth), this.state = {
778
- hideExtinct: !1,
779
- showInfo: !1,
779
+ de(this.props.auth), this.state = {
780
+ hideExtinct: O("tree-extant-only", !1),
781
+ showInfo: O("tree-show-source", !1),
780
782
  dataset: null
781
- }, this.cache = O(this.props.datasetKey);
783
+ }, this.cache = B(this.props.datasetKey);
782
784
  }
783
785
  componentDidUpdate(e) {
784
- e.datasetKey !== this.props.datasetKey && (this.cache = O(this.props.datasetKey));
786
+ e.datasetKey !== this.props.datasetKey && (this.cache = B(this.props.datasetKey));
785
787
  }
786
788
  }
787
- c(z, "contextType", B);
788
- function ge({
789
+ c(Z, "contextType", U);
790
+ function me({
789
791
  datasetKey: C,
790
792
  defaultTaxonKey: y,
791
793
  expandedTaxonKey: e,
@@ -794,12 +796,12 @@ function ge({
794
796
  linkToSpeciesPage: r,
795
797
  citation: l,
796
798
  type: h,
797
- insertPlaceholder: i,
799
+ insertPlaceholder: n,
798
800
  auth: u,
799
801
  ...a
800
802
  }) {
801
- return /* @__PURE__ */ t.jsx(B.Provider, { value: le(a), children: /* @__PURE__ */ t.jsx(
802
- z,
803
+ return /* @__PURE__ */ t.jsx(U.Provider, { value: he(a), children: /* @__PURE__ */ t.jsx(
804
+ Z,
803
805
  {
804
806
  datasetKey: C,
805
807
  defaultTaxonKey: y,
@@ -809,13 +811,13 @@ function ge({
809
811
  linkToSpeciesPage: r,
810
812
  citation: l,
811
813
  type: h,
812
- insertPlaceholder: i,
814
+ insertPlaceholder: n,
813
815
  auth: u
814
816
  }
815
817
  ) });
816
818
  }
817
- const Ee = Q(J(ge));
819
+ const Ne = Y(X(me));
818
820
  export {
819
- Ee as Tree
821
+ Ne as Tree
820
822
  };
821
823
  //# sourceMappingURL=tree.js.map