book-index-ui 0.2.13 → 0.2.14

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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { e as Vt, a as gn } from "./storage-entry-UQLfmeLb.js";
2
2
  import { B as Ei, b as $i, c as Ai, d as Pi, f as Mi, C as Hi, G as Oi, I as Di, g as ji, L as Fi, M as Ui, S as Vi, h as Ni, i as Ki, j as Yi, k as Gi, l as Ji, m as qi, n as Zi, o as Xi, p as Qi, q as el, s as tl, v as nl } from "./storage-entry-UQLfmeLb.js";
3
- import { jsx as t, jsxs as i, Fragment as j } from "react/jsx-runtime";
4
- import rt, { createContext as Nt, useMemo as ce, useContext as Ve, useState as w, useEffect as $, useCallback as F, useRef as Q } from "react";
3
+ import { jsx as t, jsxs as i, Fragment as F } from "react/jsx-runtime";
4
+ import rt, { createContext as Nt, useMemo as ce, useContext as Ve, useState as w, useEffect as A, useCallback as U, useRef as q } from "react";
5
5
  import { createPortal as hn } from "react-dom";
6
6
  const xn = (e) => `/book-index?id=${e}`, Kt = Nt(xn);
7
7
  function Si({ buildUrl: e, children: n }) {
@@ -619,13 +619,13 @@ const _n = "zh-Hant", wi = ({
619
619
  children: o
620
620
  }) => {
621
621
  const [r, a] = w(e ?? _n), l = e ?? r;
622
- $(() => {
622
+ A(() => {
623
623
  if (e) return;
624
624
  const g = Sn();
625
625
  g && g !== r && a(g);
626
626
  }, []);
627
627
  const [c, s] = w(null);
628
- $(() => {
628
+ A(() => {
629
629
  l === "zh-Hans" ? import("opencc-js/t2cn").then((g) => {
630
630
  const f = g.Converter({ from: "tw", to: "cn" });
631
631
  s(() => f);
@@ -633,7 +633,7 @@ const _n = "zh-Hant", wi = ({
633
633
  s(() => (g) => g);
634
634
  }) : s(null);
635
635
  }, [l]);
636
- const d = F((g) => {
636
+ const d = U((g) => {
637
637
  a(g), wn(g), n == null || n(g);
638
638
  }, [n]), u = ce(() => ({
639
639
  locale: l,
@@ -643,15 +643,15 @@ const _n = "zh-Hant", wi = ({
643
643
  }), [l, d, c]);
644
644
  return /* @__PURE__ */ t(Ne.Provider, { value: u, children: o });
645
645
  };
646
- function H() {
646
+ function D() {
647
647
  const e = Ve(Ne);
648
648
  return (e == null ? void 0 : e.messages) ?? Gt;
649
649
  }
650
650
  const zn = 2e3;
651
- function Y() {
652
- const e = Ve(Ne), n = (e == null ? void 0 : e.locale) ?? "zh-Hant", o = (e == null ? void 0 : e.converter) ?? null, r = Q(/* @__PURE__ */ new Map()), a = Q(n);
651
+ function N() {
652
+ const e = Ve(Ne), n = (e == null ? void 0 : e.locale) ?? "zh-Hant", o = (e == null ? void 0 : e.converter) ?? null, r = q(/* @__PURE__ */ new Map()), a = q(n);
653
653
  a.current !== n && (r.current.clear(), a.current = n);
654
- const l = F((c) => {
654
+ const l = U((c) => {
655
655
  if (!c) return "";
656
656
  if (!o) return c;
657
657
  const s = r.current.get(c);
@@ -701,7 +701,7 @@ const st = ({
701
701
  downloadStatuses: r,
702
702
  filterType: a
703
703
  }) => {
704
- const l = H(), [c, s] = w(null), d = [
704
+ const l = D(), [c, s] = w(null), d = [
705
705
  { value: "text", label: l.resourceTypeShort.text },
706
706
  { value: "image", label: l.resourceTypeShort.image },
707
707
  { value: "text+image", label: l.resourceTypeShort.textImage },
@@ -719,25 +719,25 @@ const st = ({
719
719
  }, p = (m) => {
720
720
  n(e.filter((v, k) => k !== m)), s(null);
721
721
  }, b = (m, v, k) => {
722
- const I = [...e];
723
- if (I[m] = { ...I[m], [v]: k }, v === "url" && !I[m].id) {
724
- const _ = Cn(k);
725
- _ && (I[m].id = _);
722
+ const T = [...e];
723
+ if (T[m] = { ...T[m], [v]: k }, v === "url" && !T[m].id) {
724
+ const z = Cn(k);
725
+ z && (T[m].id = z);
726
726
  }
727
- n(I);
727
+ n(T);
728
728
  }, S = (m, v, k) => {
729
- const _ = { ...e[m].metadata || {} };
730
- k ? _[v] = k : delete _[v], b(m, "metadata", Object.keys(_).length > 0 ? _ : void 0);
729
+ const z = { ...e[m].metadata || {} };
730
+ k ? z[v] = k : delete z[v], b(m, "metadata", Object.keys(z).length > 0 ? z : void 0);
731
731
  }, h = (m, v) => {
732
- const k = v.trim() ? v.split(/[,,、]/).map((I) => I.trim()).filter(Boolean) : void 0;
732
+ const k = v.trim() ? v.split(/[,,、]/).map((T) => T.trim()).filter(Boolean) : void 0;
733
733
  b(m, "structure", k);
734
- }, z = (m, v, k) => {
735
- const _ = e[m].coverage || { level: 1, ranges: "" };
736
- v === "level" ? _.level = parseInt(k) || 1 : _.ranges = k, b(m, "coverage", _.ranges ? _ : void 0);
734
+ }, _ = (m, v, k) => {
735
+ const z = e[m].coverage || { level: 1, ranges: "" };
736
+ v === "level" ? z.level = parseInt(k) || 1 : z.ranges = k, b(m, "coverage", z.ranges ? z : void 0);
737
737
  };
738
738
  return /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
739
739
  f.map(({ item: m, originalIndex: v }) => {
740
- var k, I, _;
740
+ var k, T, z;
741
741
  return /* @__PURE__ */ i(
742
742
  "div",
743
743
  {
@@ -886,8 +886,8 @@ const st = ({
886
886
  {
887
887
  type: "number",
888
888
  min: 1,
889
- value: ((I = m.coverage) == null ? void 0 : I.level) ?? "",
890
- onChange: (y) => z(v, "level", y.target.value),
889
+ value: ((T = m.coverage) == null ? void 0 : T.level) ?? "",
890
+ onChange: (y) => _(v, "level", y.target.value),
891
891
  placeholder: "1",
892
892
  style: { ...ge, width: "60px" }
893
893
  }
@@ -899,8 +899,8 @@ const st = ({
899
899
  "input",
900
900
  {
901
901
  type: "text",
902
- value: ((_ = m.coverage) == null ? void 0 : _.ranges) || "",
903
- onChange: (y) => z(v, "ranges", y.target.value),
902
+ value: ((z = m.coverage) == null ? void 0 : z.ranges) || "",
903
+ onChange: (y) => _(v, "ranges", y.target.value),
904
904
  placeholder: l.editor.coverageRangePlaceholder,
905
905
  style: { ...ge, flex: 1 }
906
906
  }
@@ -1102,7 +1102,7 @@ const qt = ({
1102
1102
  onNavigate: o,
1103
1103
  renderLink: r
1104
1104
  }) => {
1105
- const a = H(), l = ce(() => $n(e || []), [e]), c = {
1105
+ const a = D(), l = ce(() => $n(e || []), [e]), c = {
1106
1106
  text: a.resourceType.text,
1107
1107
  image: a.resourceType.image,
1108
1108
  "text+image": a.resourceType.textImage,
@@ -1154,7 +1154,7 @@ const qt = ({
1154
1154
  const n = e.volumes && e.volumes.length > 0;
1155
1155
  return e.details && !n || e.structure || e.coverage || e.metadata && Object.keys(e.metadata).length > 0;
1156
1156
  }, Zt = ({ value: e }) => {
1157
- const o = H().checkType[e];
1157
+ const o = D().checkType[e];
1158
1158
  return o ? /* @__PURE__ */ t("span", { style: {
1159
1159
  display: "inline-block",
1160
1160
  padding: "1px 6px",
@@ -1201,7 +1201,7 @@ const On = {
1201
1201
  color: { label: "", bg: "#fff8e1", fg: "#f57f17" }
1202
1202
  }, ft = ({ item: e, onNavigate: n, renderLink: o }) => {
1203
1203
  var S;
1204
- const r = H(), { convert: a } = Y(), l = de(), [c, s] = w(!1), d = ce(() => (e.url ? Wn(e.url) : void 0) || a(e.name), [e.url, e.name, a]), u = ce(() => !e.volumes || e.volumes.length === 0 ? null : e.volumes.map((h) => ({
1204
+ const r = D(), { convert: a } = N(), l = de(), [c, s] = w(!1), d = ce(() => (e.url ? Wn(e.url) : void 0) || a(e.name), [e.url, e.name, a]), u = ce(() => !e.volumes || e.volumes.length === 0 ? null : e.volumes.map((h) => ({
1205
1205
  ...h,
1206
1206
  url: h.url || Hn(h)
1207
1207
  })), [e.volumes]), g = u && u.length > 0, f = g ? new Set(u.filter((h) => h.status !== "missing").map((h) => h.volume)).size : 0, x = g ? new Set(u.filter((h) => h.status === "missing").map((h) => h.volume)).size : 0, p = e.expected_volumes ?? (g ? f + x : 0), b = e.color_mode ? {
@@ -1282,10 +1282,10 @@ const On = {
1282
1282
  )
1283
1283
  ] }),
1284
1284
  ut(e) && /* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "var(--bim-desc-fg, #717171)", display: "flex", gap: "12px", flexWrap: "wrap" }, children: [
1285
- e.metadata && Object.entries(e.metadata).filter(([h]) => h !== "check_type").map(([h, z]) => /* @__PURE__ */ i("span", { children: [
1285
+ e.metadata && Object.entries(e.metadata).filter(([h]) => h !== "check_type").map(([h, _]) => /* @__PURE__ */ i("span", { children: [
1286
1286
  r.metadata[h] || h,
1287
1287
  ": ",
1288
- An(h, z, r, a)
1288
+ An(h, _, r, a)
1289
1289
  ] }, h)),
1290
1290
  e.details && !g && /* @__PURE__ */ t("span", { children: a(e.details) }),
1291
1291
  e.structure && /* @__PURE__ */ i("span", { children: [
@@ -1302,15 +1302,15 @@ const On = {
1302
1302
  ] })
1303
1303
  ] }),
1304
1304
  g && c && (() => {
1305
- const h = u.some((v) => v.group), z = [];
1305
+ const h = u.some((v) => v.group), _ = [];
1306
1306
  if (h) {
1307
1307
  let v = null;
1308
1308
  for (const k of u) {
1309
- const I = k.group || "";
1310
- (!v || v.title !== I) && (v = { title: I, group_id: k.group_id, vols: [] }, z.push(v)), v.vols.push(k);
1309
+ const T = k.group || "";
1310
+ (!v || v.title !== T) && (v = { title: T, group_id: k.group_id, vols: [] }, _.push(v)), v.vols.push(k);
1311
1311
  }
1312
1312
  } else
1313
- z.push({ vols: u });
1313
+ _.push({ vols: u });
1314
1314
  const m = (v) => {
1315
1315
  const k = v.status === "missing";
1316
1316
  return v.url && !k ? /* @__PURE__ */ t(
@@ -1352,10 +1352,10 @@ const On = {
1352
1352
  display: "flex",
1353
1353
  flexDirection: "column",
1354
1354
  gap: "8px"
1355
- }, children: z.map((v, k) => {
1356
- const I = v.title ? a(v.title) : "";
1357
- let _ = I;
1358
- return v.title && v.group_id && (o ? _ = o(v.group_id, I) : n && (_ = /* @__PURE__ */ t(
1355
+ }, children: _.map((v, k) => {
1356
+ const T = v.title ? a(v.title) : "";
1357
+ let z = T;
1358
+ return v.title && v.group_id && (o ? z = o(v.group_id, T) : n && (z = /* @__PURE__ */ t(
1359
1359
  "a",
1360
1360
  {
1361
1361
  href: l(v.group_id),
@@ -1370,7 +1370,7 @@ const On = {
1370
1370
  },
1371
1371
  onMouseEnter: (y) => y.currentTarget.style.borderBottomStyle = "solid",
1372
1372
  onMouseLeave: (y) => y.currentTarget.style.borderBottomStyle = "dashed",
1373
- children: I
1373
+ children: T
1374
1374
  }
1375
1375
  ))), /* @__PURE__ */ i("div", { children: [
1376
1376
  v.title && /* @__PURE__ */ i("div", { style: {
@@ -1379,7 +1379,7 @@ const On = {
1379
1379
  color: "var(--bim-fg, #333)",
1380
1380
  marginBottom: "4px"
1381
1381
  }, children: [
1382
- _,
1382
+ z,
1383
1383
  /* @__PURE__ */ i("span", { style: { color: "var(--bim-desc-fg, #999)", fontWeight: 400, marginLeft: "6px" }, children: [
1384
1384
  "(",
1385
1385
  v.vols.length,
@@ -1400,7 +1400,7 @@ const On = {
1400
1400
  onConfigurePath: l,
1401
1401
  onSelectFolder: c
1402
1402
  }) => {
1403
- const s = H(), d = e === "local", u = (n == null ? void 0 : n.isDraft) ?? !0, g = (n == null ? void 0 : n.repoPath) || "", f = g ? g.split(/[/\\]/).pop() || g : "", x = {
1403
+ const s = D(), d = e === "local", u = (n == null ? void 0 : n.isDraft) ?? !0, g = (n == null ? void 0 : n.repoPath) || "", f = g ? g.split(/[/\\]/).pop() || g : "", x = {
1404
1404
  display: "flex",
1405
1405
  alignItems: "center",
1406
1406
  gap: "6px",
@@ -1558,96 +1558,96 @@ const Vn = ({
1558
1558
  onEntrySelect: a,
1559
1559
  placeholder: l
1560
1560
  }) => {
1561
- const c = H(), s = l ?? c.search.placeholder, d = {
1561
+ const c = D(), s = l ?? c.search.placeholder, d = {
1562
1562
  work: c.indexType.work,
1563
1563
  book: c.indexType.book,
1564
1564
  collection: c.indexType.collection,
1565
1565
  entity: c.indexType.entity
1566
- }, [u, g] = w(!1), [f, x] = w([]), [p, b] = w(-1), [S, h] = w(null), [z, m] = w($e), v = Q(null), k = Q(null), I = Q(null), _ = Q(!1), y = F(() => {
1567
- _.current || !e.getAllEntries || (_.current = !0, e.getAllEntries().then((T) => {
1568
- h(T);
1566
+ }, [u, g] = w(!1), [f, x] = w([]), [p, b] = w(-1), [S, h] = w(null), [_, m] = w($e), v = q(null), k = q(null), T = q(null), z = q(!1), y = U(() => {
1567
+ z.current || !e.getAllEntries || (z.current = !0, e.getAllEntries().then((C) => {
1568
+ h(C);
1569
1569
  }).catch(() => {
1570
- _.current = !1;
1570
+ z.current = !1;
1571
1571
  }));
1572
- }, [e]), B = F((T) => {
1573
- if (!T.trim())
1574
- return z.map((P) => ({ type: "history", text: P }));
1572
+ }, [e]), B = U((C) => {
1573
+ if (!C.trim())
1574
+ return _.map((P) => ({ type: "history", text: P }));
1575
1575
  if (!S) return [];
1576
- const D = T.toLowerCase(), C = [], R = [];
1576
+ const M = C.toLowerCase(), I = [], R = [];
1577
1577
  for (const P of S) {
1578
- if (C.length + R.length >= ht * 2) break;
1579
- const J = (P.title ?? "").toLowerCase();
1580
- if (J.startsWith(D))
1581
- C.push({ type: "entry", text: P.title, entry: P });
1582
- else if (J.includes(D))
1578
+ if (I.length + R.length >= ht * 2) break;
1579
+ const $ = (P.title ?? "").toLowerCase();
1580
+ if ($.startsWith(M))
1581
+ I.push({ type: "entry", text: P.title, entry: P });
1582
+ else if ($.includes(M))
1583
1583
  R.push({ type: "entry", text: P.title, entry: P });
1584
1584
  else {
1585
- const V = [...P.additional_titles || [], ...P.attached_texts || []];
1586
- for (const ee of V) {
1587
- const te = typeof ee == "string" ? ee : ee == null ? void 0 : ee.book_title;
1588
- if (te != null && te.toLowerCase().includes(D)) {
1589
- C.push({ type: "entry", text: `${P.title}`, entry: P });
1585
+ const j = [...P.additional_titles || [], ...P.attached_texts || []];
1586
+ for (const Z of j) {
1587
+ const te = typeof Z == "string" ? Z : Z == null ? void 0 : Z.book_title;
1588
+ if (te != null && te.toLowerCase().includes(M)) {
1589
+ I.push({ type: "entry", text: `${P.title}`, entry: P });
1590
1590
  break;
1591
1591
  }
1592
1592
  }
1593
1593
  }
1594
1594
  }
1595
- return [...C, ...R].slice(0, ht);
1596
- }, [S, z]);
1597
- $(() => {
1595
+ return [...I, ...R].slice(0, ht);
1596
+ }, [S, _]);
1597
+ A(() => {
1598
1598
  x(B(n)), b(-1);
1599
- }, [n, B]), $(() => {
1600
- const T = (D) => {
1601
- I.current && !I.current.contains(D.target) && g(!1);
1599
+ }, [n, B]), A(() => {
1600
+ const C = (M) => {
1601
+ T.current && !T.current.contains(M.target) && g(!1);
1602
1602
  };
1603
- return document.addEventListener("mousedown", T), () => document.removeEventListener("mousedown", T);
1604
- }, []), $(() => {
1605
- const T = (D) => {
1606
- var C, R;
1607
- if (D.key === "/" && document.activeElement !== v.current) {
1608
- const P = (C = document.activeElement) == null ? void 0 : C.tagName;
1603
+ return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
1604
+ }, []), A(() => {
1605
+ const C = (M) => {
1606
+ var I, R;
1607
+ if (M.key === "/" && document.activeElement !== v.current) {
1608
+ const P = (I = document.activeElement) == null ? void 0 : I.tagName;
1609
1609
  if (P === "INPUT" || P === "TEXTAREA" || P === "SELECT") return;
1610
- D.preventDefault(), (R = v.current) == null || R.focus();
1610
+ M.preventDefault(), (R = v.current) == null || R.focus();
1611
1611
  }
1612
1612
  };
1613
- return document.addEventListener("keydown", T), () => document.removeEventListener("keydown", T);
1613
+ return document.addEventListener("keydown", C), () => document.removeEventListener("keydown", C);
1614
1614
  }, []);
1615
- const W = F((T) => {
1616
- T.trim() && (jn(T.trim()), m($e())), r(T), g(!1);
1617
- }, [r]), E = F((T) => {
1618
- T.type === "history" ? (o(T.text), W(T.text)) : T.entry && (a ? (a(T.entry), g(!1)) : (o(T.text), W(T.text)));
1619
- }, [o, W, a]), O = F((T) => {
1615
+ const W = U((C) => {
1616
+ C.trim() && (jn(C.trim()), m($e())), r(C), g(!1);
1617
+ }, [r]), E = U((C) => {
1618
+ C.type === "history" ? (o(C.text), W(C.text)) : C.entry && (a ? (a(C.entry), g(!1)) : (o(C.text), W(C.text)));
1619
+ }, [o, W, a]), H = U((C) => {
1620
1620
  if (!u || f.length === 0) {
1621
- T.key === "Enter" && W(n);
1621
+ C.key === "Enter" && W(n);
1622
1622
  return;
1623
1623
  }
1624
- switch (T.key) {
1624
+ switch (C.key) {
1625
1625
  case "ArrowDown":
1626
- T.preventDefault(), b((D) => (D + 1) % f.length);
1626
+ C.preventDefault(), b((M) => (M + 1) % f.length);
1627
1627
  break;
1628
1628
  case "ArrowUp":
1629
- T.preventDefault(), b((D) => (D - 1 + f.length) % f.length);
1629
+ C.preventDefault(), b((M) => (M - 1 + f.length) % f.length);
1630
1630
  break;
1631
1631
  case "Enter":
1632
- T.preventDefault(), p >= 0 && p < f.length ? E(f[p]) : W(n);
1632
+ C.preventDefault(), p >= 0 && p < f.length ? E(f[p]) : W(n);
1633
1633
  break;
1634
1634
  case "Escape":
1635
- T.preventDefault(), g(!1);
1635
+ C.preventDefault(), g(!1);
1636
1636
  break;
1637
1637
  }
1638
- }, [u, f, p, n, W, E]), A = F((T, D) => {
1639
- D.stopPropagation(), Fn(T), m($e()), x((C) => C.filter((R) => !(R.type === "history" && R.text === T)));
1640
- }, []), N = F((T) => {
1641
- T.stopPropagation(), Un(), m([]), x([]);
1638
+ }, [u, f, p, n, W, E]), K = U((C, M) => {
1639
+ M.stopPropagation(), Fn(C), m($e()), x((I) => I.filter((R) => !(R.type === "history" && R.text === C)));
1640
+ }, []), J = U((C) => {
1641
+ C.stopPropagation(), Un(), m([]), x([]);
1642
1642
  }, []);
1643
- $(() => {
1643
+ A(() => {
1644
1644
  if (p >= 0 && k.current) {
1645
- const T = k.current.children;
1646
- T[p] && T[p].scrollIntoView({ block: "nearest" });
1645
+ const C = k.current.children;
1646
+ C[p] && C[p].scrollIntoView({ block: "nearest" });
1647
1647
  }
1648
1648
  }, [p]);
1649
- const U = !n.trim() && z.length > 0;
1650
- return /* @__PURE__ */ i("div", { ref: I, style: { position: "relative", flex: 1 }, children: [
1649
+ const Y = !n.trim() && _.length > 0;
1650
+ return /* @__PURE__ */ i("div", { ref: T, style: { position: "relative", flex: 1 }, children: [
1651
1651
  /* @__PURE__ */ t(
1652
1652
  "input",
1653
1653
  {
@@ -1655,13 +1655,13 @@ const Vn = ({
1655
1655
  type: "text",
1656
1656
  placeholder: s,
1657
1657
  value: n,
1658
- onChange: (T) => {
1659
- o(T.target.value), g(!0), y();
1658
+ onChange: (C) => {
1659
+ o(C.target.value), g(!0), y();
1660
1660
  },
1661
1661
  onFocus: () => {
1662
1662
  g(!0), y();
1663
1663
  },
1664
- onKeyDown: O,
1664
+ onKeyDown: H,
1665
1665
  style: {
1666
1666
  width: "100%",
1667
1667
  padding: "8px 12px",
@@ -1693,7 +1693,7 @@ const Vn = ({
1693
1693
  overflow: "auto"
1694
1694
  },
1695
1695
  children: [
1696
- U && /* @__PURE__ */ i("div", { style: {
1696
+ Y && /* @__PURE__ */ i("div", { style: {
1697
1697
  display: "flex",
1698
1698
  justifyContent: "space-between",
1699
1699
  alignItems: "center",
@@ -1706,7 +1706,7 @@ const Vn = ({
1706
1706
  /* @__PURE__ */ t(
1707
1707
  "button",
1708
1708
  {
1709
- onClick: N,
1709
+ onClick: J,
1710
1710
  style: {
1711
1711
  border: "none",
1712
1712
  background: "transparent",
@@ -1719,10 +1719,10 @@ const Vn = ({
1719
1719
  }
1720
1720
  )
1721
1721
  ] }),
1722
- f.map((T, D) => /* @__PURE__ */ i(
1722
+ f.map((C, M) => /* @__PURE__ */ i(
1723
1723
  "div",
1724
1724
  {
1725
- onClick: () => E(T),
1725
+ onClick: () => E(C),
1726
1726
  style: {
1727
1727
  display: "flex",
1728
1728
  alignItems: "center",
@@ -1731,20 +1731,20 @@ const Vn = ({
1731
1731
  cursor: "pointer",
1732
1732
  fontSize: "13px",
1733
1733
  color: "var(--bim-fg, #333)",
1734
- background: D === p ? "var(--bim-list-active-bg, #e8f0fe)" : "transparent"
1734
+ background: M === p ? "var(--bim-list-active-bg, #e8f0fe)" : "transparent"
1735
1735
  },
1736
1736
  children: [
1737
- /* @__PURE__ */ t("span", { style: { fontSize: "12px", opacity: 0.5, width: "16px", textAlign: "center" }, children: T.type === "history" ? "🕐" : "🔍" }),
1738
- /* @__PURE__ */ t("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: T.text }),
1739
- T.entry && /* @__PURE__ */ i("span", { style: { fontSize: "11px", color: "var(--bim-desc-fg, #717171)", flexShrink: 0 }, children: [
1740
- d[T.entry.type],
1741
- T.entry.edition && ` · ${T.entry.edition}`,
1742
- T.entry.author && ` · ${T.entry.author}`
1737
+ /* @__PURE__ */ t("span", { style: { fontSize: "12px", opacity: 0.5, width: "16px", textAlign: "center" }, children: C.type === "history" ? "🕐" : "🔍" }),
1738
+ /* @__PURE__ */ t("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: C.text }),
1739
+ C.entry && /* @__PURE__ */ i("span", { style: { fontSize: "11px", color: "var(--bim-desc-fg, #717171)", flexShrink: 0 }, children: [
1740
+ d[C.entry.type],
1741
+ C.entry.edition && ` · ${C.entry.edition}`,
1742
+ C.entry.author && ` · ${C.entry.author}`
1743
1743
  ] }),
1744
- T.type === "history" && /* @__PURE__ */ t(
1744
+ C.type === "history" && /* @__PURE__ */ t(
1745
1745
  "button",
1746
1746
  {
1747
- onClick: (C) => A(T.text, C),
1747
+ onClick: (I) => K(C.text, I),
1748
1748
  style: {
1749
1749
  border: "none",
1750
1750
  background: "transparent",
@@ -1760,7 +1760,7 @@ const Vn = ({
1760
1760
  )
1761
1761
  ]
1762
1762
  },
1763
- `${T.type}-${T.text}-${D}`
1763
+ `${C.type}-${C.text}-${M}`
1764
1764
  ))
1765
1765
  ]
1766
1766
  }
@@ -1821,51 +1821,51 @@ const qn = {
1821
1821
  onQueryChange: f,
1822
1822
  headerRight: x
1823
1823
  }) => {
1824
- const p = H(), b = [
1824
+ const p = D(), b = [
1825
1825
  { type: "work", icon: "✍️", name: p.indexType.work, key: "works" },
1826
1826
  { type: "book", icon: "📖", name: p.indexType.book, key: "books" },
1827
1827
  { type: "collection", icon: "📚", name: p.indexType.collection, key: "collections" },
1828
1828
  { type: "entity", icon: "👤", name: p.indexType.entity, key: "entities" }
1829
- ], [S, h] = w(g ?? ""), [z, m] = w(null), [v, k] = w(null), [I, _] = w(!1), [y, B] = w(null), [W, E] = w(""), [O, A] = w(!g), [N, U] = w(Ae), [T, D] = w([]), [C, R] = w(!1), [P, J] = w(!1), [V, ee] = w(null), [te, pe] = w(null), ve = Q(void 0), ye = Q(!1), ne = F(async (M, Z) => {
1830
- if (!M.trim()) {
1831
- A(!0), m(null), k(null);
1829
+ ], [S, h] = w(g ?? ""), [_, m] = w(null), [v, k] = w(null), [T, z] = w(!1), [y, B] = w(null), [W, E] = w(""), [H, K] = w(!g), [J, Y] = w(Ae), [C, M] = w([]), [I, R] = w(!1), [P, $] = w(!1), [j, Z] = w(null), [te, pe] = w(null), ve = q(void 0), ye = q(!1), ne = U(async (O, Q) => {
1830
+ if (!O.trim()) {
1831
+ K(!0), m(null), k(null);
1832
1832
  return;
1833
1833
  }
1834
- A(!1), _(!0), E("");
1834
+ K(!1), z(!0), E("");
1835
1835
  try {
1836
1836
  if (e.searchAll) {
1837
- const G = await e.searchAll(M, Z ?? Xe);
1837
+ const G = await e.searchAll(O, Q ?? Xe);
1838
1838
  m(G);
1839
1839
  } else {
1840
- const G = ["work", "book", "collection", "entity"], q = await Promise.all(
1841
- G.map((oe) => e.search(M, oe, { page: 1, pageSize: Z ?? Xe }))
1840
+ const G = ["work", "book", "collection", "entity"], X = await Promise.all(
1841
+ G.map((oe) => e.search(O, oe, { page: 1, pageSize: Q ?? Xe }))
1842
1842
  );
1843
1843
  m({
1844
- works: q[0].entries,
1845
- books: q[1].entries,
1846
- collections: q[2].entries,
1847
- entities: q[3].entries,
1848
- totalWorks: q[0].total,
1849
- totalBooks: q[1].total,
1850
- totalCollections: q[2].total,
1851
- totalEntities: q[3].total
1844
+ works: X[0].entries,
1845
+ books: X[1].entries,
1846
+ collections: X[2].entries,
1847
+ entities: X[3].entries,
1848
+ totalWorks: X[0].total,
1849
+ totalBooks: X[1].total,
1850
+ totalCollections: X[2].total,
1851
+ totalEntities: X[3].total
1852
1852
  });
1853
1853
  }
1854
1854
  } catch (G) {
1855
1855
  E(G instanceof Error ? G.message : String(G)), m(null);
1856
1856
  } finally {
1857
- _(!1);
1857
+ z(!1);
1858
1858
  }
1859
1859
  }, [e]);
1860
- $(() => {
1861
- let M = !1;
1862
- const Z = () => {
1863
- var K, ie;
1864
- const G = ["work", "book", "collection", "entity"], q = Promise.all(
1860
+ A(() => {
1861
+ let O = !1;
1862
+ const Q = () => {
1863
+ var V, ie;
1864
+ const G = ["work", "book", "collection", "entity"], X = Promise.all(
1865
1865
  G.map((ue) => e.loadEntries(ue, { page: 1, pageSize: 1 }).catch(() => ({ total: 0 })))
1866
- ), oe = ((K = e.getResourceCounts) == null ? void 0 : K.call(e).catch(() => null)) ?? Promise.resolve(null), L = ((ie = e.getSubtypeStats) == null ? void 0 : ie.call(e).catch(() => null)) ?? Promise.resolve(null);
1867
- Promise.all([q, oe, L]).then(([ue, fe, ct]) => {
1868
- M || (ee({
1866
+ ), oe = ((V = e.getResourceCounts) == null ? void 0 : V.call(e).catch(() => null)) ?? Promise.resolve(null), L = ((ie = e.getSubtypeStats) == null ? void 0 : ie.call(e).catch(() => null)) ?? Promise.resolve(null);
1867
+ Promise.all([X, oe, L]).then(([ue, fe, ct]) => {
1868
+ O || (Z({
1869
1869
  works: ue[0].total,
1870
1870
  books: ue[1].total,
1871
1871
  collections: ue[2].total,
@@ -1876,80 +1876,80 @@ const qn = {
1876
1876
  });
1877
1877
  };
1878
1878
  return e.getCounts ? e.getCounts().then((G) => {
1879
- var q, oe;
1880
- M || (ee({
1879
+ var X, oe;
1880
+ O || (Z({
1881
1881
  works: G.works,
1882
1882
  books: G.books,
1883
1883
  collections: G.collections,
1884
1884
  entities: G.entities,
1885
- hasText: (q = G.resourceCounts) == null ? void 0 : q.hasText,
1885
+ hasText: (X = G.resourceCounts) == null ? void 0 : X.hasText,
1886
1886
  hasImage: (oe = G.resourceCounts) == null ? void 0 : oe.hasImage
1887
1887
  }), G.subtypeStats && pe(G.subtypeStats));
1888
1888
  }).catch(() => {
1889
- M || Z();
1890
- }) : Z(), () => {
1891
- M = !0;
1889
+ O || Q();
1890
+ }) : Q(), () => {
1891
+ O = !0;
1892
1892
  };
1893
- }, [e]), $(() => {
1893
+ }, [e]), A(() => {
1894
1894
  ye.current || !(g != null && g.trim()) || (ye.current = !0, ne(g));
1895
1895
  }, [g, ne]);
1896
- const X = F((M) => {
1897
- if (h(M), f == null || f(M), !M.trim()) {
1898
- A(!0), m(null), k(null);
1896
+ const ee = U((O) => {
1897
+ if (h(O), f == null || f(O), !O.trim()) {
1898
+ K(!0), m(null), k(null);
1899
1899
  return;
1900
1900
  }
1901
1901
  ve.current && clearTimeout(ve.current), ve.current = setTimeout(() => {
1902
- k(null), ne(M);
1902
+ k(null), ne(O);
1903
1903
  }, Kn);
1904
- }, [ne, f]), Ge = F((M) => {
1905
- ve.current && clearTimeout(ve.current), f == null || f(M), ne(M);
1906
- }, [ne, f]), Je = F((M) => {
1907
- k(M), ne(S, Nn);
1904
+ }, [ne, f]), Ge = U((O) => {
1905
+ ve.current && clearTimeout(ve.current), f == null || f(O), ne(O);
1906
+ }, [ne, f]), Je = U((O) => {
1907
+ k(O), ne(S, Nn);
1908
1908
  }, [S, ne]);
1909
- $(() => {
1910
- if (!N.length) {
1911
- D([]);
1909
+ A(() => {
1910
+ if (!J.length) {
1911
+ M([]);
1912
1912
  return;
1913
1913
  }
1914
- let M = !1;
1914
+ let O = !1;
1915
1915
  return R(!0), Promise.all(
1916
- N.slice(0, 10).map(async (Z) => {
1917
- var G, q, oe;
1916
+ J.slice(0, 10).map(async (Q) => {
1917
+ var G, X, oe;
1918
1918
  try {
1919
1919
  if (e.getEntry) {
1920
- const K = await e.getEntry(Z);
1921
- if (K) return K;
1920
+ const V = await e.getEntry(Q);
1921
+ if (V) return V;
1922
1922
  }
1923
- const L = await e.getItem(Z);
1923
+ const L = await e.getItem(Q);
1924
1924
  if (L) {
1925
- const K = L.authors;
1925
+ const V = L.authors;
1926
1926
  return {
1927
- id: Z,
1928
- title: L.title || Z,
1927
+ id: Q,
1928
+ title: L.title || Q,
1929
1929
  type: L.type || "work",
1930
- author: (G = K == null ? void 0 : K[0]) == null ? void 0 : G.name,
1931
- dynasty: (q = K == null ? void 0 : K[0]) == null ? void 0 : q.dynasty,
1932
- role: (oe = K == null ? void 0 : K[0]) == null ? void 0 : oe.role,
1930
+ author: (G = V == null ? void 0 : V[0]) == null ? void 0 : G.name,
1931
+ dynasty: (X = V == null ? void 0 : V[0]) == null ? void 0 : X.dynasty,
1932
+ role: (oe = V == null ? void 0 : V[0]) == null ? void 0 : oe.role,
1933
1933
  edition: L.edition || void 0
1934
1934
  };
1935
1935
  }
1936
1936
  } catch {
1937
1937
  }
1938
- return { id: Z, title: Z, type: "work", notFound: !0 };
1938
+ return { id: Q, title: Q, type: "work", notFound: !0 };
1939
1939
  })
1940
- ).then((Z) => {
1941
- M || (D(Z), R(!1));
1940
+ ).then((Q) => {
1941
+ O || (M(Q), R(!1));
1942
1942
  }), () => {
1943
- M = !0;
1943
+ O = !0;
1944
1944
  };
1945
- }, [N, e]);
1946
- const Te = (M) => {
1947
- B(M.id), Yn(M.id), U(Ae()), r == null || r(M);
1948
- }, Re = (M) => {
1949
- Gn(M), U(Ae());
1945
+ }, [J, e]);
1946
+ const Te = (O) => {
1947
+ B(O.id), Yn(O.id), Y(Ae()), r == null || r(O);
1948
+ }, Re = (O) => {
1949
+ Gn(O), Y(Ae());
1950
1950
  }, qe = () => {
1951
- Jn(), U([]);
1952
- }, He = (M) => b.find((Z) => Z.type === M), Ze = z && (z.works.length > 0 || z.books.length > 0 || z.collections.length > 0);
1951
+ Jn(), Y([]);
1952
+ }, He = (O) => b.find((Q) => Q.type === O), Ze = _ && (_.works.length > 0 || _.books.length > 0 || _.collections.length > 0);
1953
1953
  return /* @__PURE__ */ i("div", { className: "bim-browser-container", children: [
1954
1954
  /* @__PURE__ */ t("header", { style: { padding: "12px 20px", borderBottom: "1px solid var(--bim-widget-border, #e0e0e0)" }, children: /* @__PURE__ */ i("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
1955
1955
  /* @__PURE__ */ t("h1", { style: { margin: 0, fontSize: "18px", color: "var(--bim-fg, #333)" }, children: p.browser.title }),
@@ -1975,7 +1975,7 @@ const qn = {
1975
1975
  {
1976
1976
  transport: e,
1977
1977
  value: S,
1978
- onChange: X,
1978
+ onChange: ee,
1979
1979
  onSearch: Ge,
1980
1980
  onEntrySelect: Te
1981
1981
  }
@@ -1997,7 +1997,7 @@ const qn = {
1997
1997
  }
1998
1998
  )
1999
1999
  ] }),
2000
- V && O && /* @__PURE__ */ i("div", { style: {
2000
+ j && H && /* @__PURE__ */ i("div", { style: {
2001
2001
  padding: "0 20px 8px",
2002
2002
  fontSize: "12px",
2003
2003
  color: "var(--bim-desc-fg, #999)",
@@ -2006,21 +2006,21 @@ const qn = {
2006
2006
  flexWrap: "wrap",
2007
2007
  gap: "4px"
2008
2008
  }, children: [
2009
- /* @__PURE__ */ t("span", { children: te ? /* @__PURE__ */ i(j, { children: [
2010
- (te.book ?? 0) > 0 && /* @__PURE__ */ i(j, { children: [
2009
+ /* @__PURE__ */ t("span", { children: te ? /* @__PURE__ */ i(F, { children: [
2010
+ (te.book ?? 0) > 0 && /* @__PURE__ */ i(F, { children: [
2011
2011
  "書 ",
2012
2012
  /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: te.book.toLocaleString() }),
2013
2013
  " 部 ,",
2014
- /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: V.books.toLocaleString() }),
2014
+ /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: j.books.toLocaleString() }),
2015
2015
  " 本"
2016
2016
  ] }),
2017
- te.article ? /* @__PURE__ */ i(j, { children: [
2017
+ te.article ? /* @__PURE__ */ i(F, { children: [
2018
2018
  /* @__PURE__ */ t("span", { style: { margin: "0 6px" }, children: "·" }),
2019
2019
  "文章 ",
2020
2020
  /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: te.article.toLocaleString() }),
2021
2021
  " 篇"
2022
2022
  ] }) : null,
2023
- te.poem ? /* @__PURE__ */ i(j, { children: [
2023
+ te.poem ? /* @__PURE__ */ i(F, { children: [
2024
2024
  /* @__PURE__ */ t("span", { style: { margin: "0 6px" }, children: "·" }),
2025
2025
  "詩詞 ",
2026
2026
  /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: te.poem.toLocaleString() }),
@@ -2028,42 +2028,42 @@ const qn = {
2028
2028
  ] }) : null,
2029
2029
  /* @__PURE__ */ t("span", { style: { margin: "0 6px" }, children: "·" }),
2030
2030
  "叢編 ",
2031
- /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: V.collections.toLocaleString() })
2032
- ] }) : /* @__PURE__ */ i(j, { children: [
2031
+ /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: j.collections.toLocaleString() })
2032
+ ] }) : /* @__PURE__ */ i(F, { children: [
2033
2033
  p.indexType.work,
2034
2034
  " ",
2035
- /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: V.works.toLocaleString() }),
2035
+ /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: j.works.toLocaleString() }),
2036
2036
  /* @__PURE__ */ t("span", { style: { margin: "0 6px" }, children: "·" }),
2037
2037
  p.indexType.book,
2038
2038
  " ",
2039
- /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: V.books.toLocaleString() }),
2039
+ /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: j.books.toLocaleString() }),
2040
2040
  /* @__PURE__ */ t("span", { style: { margin: "0 6px" }, children: "·" }),
2041
2041
  p.indexType.collection,
2042
2042
  " ",
2043
- /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: V.collections.toLocaleString() }),
2044
- V.entities > 0 && /* @__PURE__ */ i(j, { children: [
2043
+ /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: j.collections.toLocaleString() }),
2044
+ j.entities > 0 && /* @__PURE__ */ i(F, { children: [
2045
2045
  /* @__PURE__ */ t("span", { style: { margin: "0 6px" }, children: "·" }),
2046
2046
  p.indexType.entity,
2047
2047
  " ",
2048
- /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: V.entities.toLocaleString() })
2048
+ /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: j.entities.toLocaleString() })
2049
2049
  ] })
2050
2050
  ] }) }),
2051
- V.hasImage != null && V.hasText != null && /* @__PURE__ */ i("span", { children: [
2051
+ j.hasImage != null && j.hasText != null && /* @__PURE__ */ i("span", { children: [
2052
2052
  p.resourceType.image,
2053
2053
  " ",
2054
- /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: V.hasImage.toLocaleString() }),
2054
+ /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: j.hasImage.toLocaleString() }),
2055
2055
  /* @__PURE__ */ t("span", { style: { margin: "0 6px" }, children: "·" }),
2056
2056
  p.resourceType.text,
2057
2057
  " ",
2058
- /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: V.hasText.toLocaleString() })
2058
+ /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #555)" }, children: j.hasText.toLocaleString() })
2059
2059
  ] })
2060
2060
  ] }),
2061
- /* @__PURE__ */ t("div", { style: { padding: "0 20px 20px", flex: 1, display: "flex", flexDirection: "column", overflow: "auto" }, children: I ? /* @__PURE__ */ t("div", { style: { textAlign: "center", padding: "40px", color: "var(--bim-desc-fg, #717171)" }, children: p.search.searching }) : W ? /* @__PURE__ */ i("div", { style: { textAlign: "center", padding: "40px" }, children: [
2061
+ /* @__PURE__ */ t("div", { style: { padding: "0 20px 20px", flex: 1, display: "flex", flexDirection: "column", overflow: "auto" }, children: T ? /* @__PURE__ */ t("div", { style: { textAlign: "center", padding: "40px", color: "var(--bim-desc-fg, #717171)" }, children: p.search.searching }) : W ? /* @__PURE__ */ i("div", { style: { textAlign: "center", padding: "40px" }, children: [
2062
2062
  /* @__PURE__ */ t("div", { style: { fontSize: "24px", marginBottom: "8px" }, children: "⚠️" }),
2063
2063
  /* @__PURE__ */ t("p", { style: { color: "var(--bim-desc-fg, #717171)" }, children: W })
2064
- ] }) : O ? (
2064
+ ] }) : H ? (
2065
2065
  /* Recent entries view */
2066
- /* @__PURE__ */ t("div", { style: { flex: 1 }, children: C ? /* @__PURE__ */ t("div", { style: { textAlign: "center", padding: "40px", color: "var(--bim-desc-fg, #717171)" }, children: p.search.loading }) : T.length > 0 ? /* @__PURE__ */ i(j, { children: [
2066
+ /* @__PURE__ */ t("div", { style: { flex: 1 }, children: I ? /* @__PURE__ */ t("div", { style: { textAlign: "center", padding: "40px", color: "var(--bim-desc-fg, #717171)" }, children: p.search.loading }) : C.length > 0 ? /* @__PURE__ */ i(F, { children: [
2067
2067
  /* @__PURE__ */ i("div", { style: { padding: "8px 0", fontSize: "12px", color: "var(--bim-desc-fg, #717171)", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
2068
2068
  /* @__PURE__ */ t("span", { children: p.search.recentBrowse }),
2069
2069
  /* @__PURE__ */ t(
@@ -2082,29 +2082,29 @@ const qn = {
2082
2082
  }
2083
2083
  )
2084
2084
  ] }),
2085
- /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: T.slice(0, P ? 10 : 3).map((M) => M.notFound ? /* @__PURE__ */ t(
2085
+ /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: C.slice(0, P ? 10 : 3).map((O) => O.notFound ? /* @__PURE__ */ t(
2086
2086
  Zn,
2087
2087
  {
2088
- id: M.id,
2088
+ id: O.id,
2089
2089
  onRemove: Re,
2090
2090
  t: p
2091
2091
  },
2092
- M.id
2092
+ O.id
2093
2093
  ) : /* @__PURE__ */ t(
2094
2094
  yt,
2095
2095
  {
2096
- entry: M,
2097
- selected: y === M.id,
2096
+ entry: O,
2097
+ selected: y === O.id,
2098
2098
  onClick: Te,
2099
2099
  getConfig: He,
2100
2100
  onRemove: Re
2101
2101
  },
2102
- M.id
2102
+ O.id
2103
2103
  )) }),
2104
- !P && T.length > 3 && /* @__PURE__ */ t(
2104
+ !P && C.length > 3 && /* @__PURE__ */ t(
2105
2105
  "button",
2106
2106
  {
2107
- onClick: () => J(!0),
2107
+ onClick: () => $(!0),
2108
2108
  style: {
2109
2109
  display: "block",
2110
2110
  margin: "8px auto 0",
@@ -2126,10 +2126,10 @@ const qn = {
2126
2126
  ] }) })
2127
2127
  ) : Ze ? (
2128
2128
  /* Grouped search results */
2129
- /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: b.map(({ type: M, icon: Z, name: G, key: q }) => {
2130
- const oe = z[q] ?? [], L = qn[q], K = z[L] ?? 0;
2129
+ /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: b.map(({ type: O, icon: Q, name: G, key: X }) => {
2130
+ const oe = _[X] ?? [], L = qn[X], V = _[L] ?? 0;
2131
2131
  if (oe.length === 0) return null;
2132
- const ue = !(v === M) && K > Xe;
2132
+ const ue = !(v === O) && V > Xe;
2133
2133
  return /* @__PURE__ */ i("div", { children: [
2134
2134
  /* @__PURE__ */ i("div", { style: {
2135
2135
  display: "flex",
@@ -2140,11 +2140,11 @@ const qn = {
2140
2140
  marginBottom: "6px"
2141
2141
  }, children: [
2142
2142
  /* @__PURE__ */ i("span", { style: { fontSize: "13px", fontWeight: 600, color: "var(--bim-fg, #333)" }, children: [
2143
- Z,
2143
+ Q,
2144
2144
  " ",
2145
2145
  G,
2146
2146
  /* @__PURE__ */ i("span", { style: { fontWeight: 400, color: "var(--bim-desc-fg, #717171)", marginLeft: "6px" }, children: [
2147
- K,
2147
+ V,
2148
2148
  " ",
2149
2149
  p.unit.items
2150
2150
  ] })
@@ -2152,7 +2152,7 @@ const qn = {
2152
2152
  ue && /* @__PURE__ */ t(
2153
2153
  "button",
2154
2154
  {
2155
- onClick: () => Je(M),
2155
+ onClick: () => Je(O),
2156
2156
  style: {
2157
2157
  border: "none",
2158
2158
  background: "transparent",
@@ -2175,7 +2175,7 @@ const qn = {
2175
2175
  },
2176
2176
  fe.id
2177
2177
  )) })
2178
- ] }, M);
2178
+ ] }, O);
2179
2179
  }) })
2180
2180
  ) : /* @__PURE__ */ i("div", { style: { textAlign: "center", padding: "40px" }, children: [
2181
2181
  /* @__PURE__ */ t("div", { style: { fontSize: "32px", marginBottom: "8px" }, children: "📚" }),
@@ -2184,7 +2184,7 @@ const qn = {
2184
2184
  ] }) })
2185
2185
  ] });
2186
2186
  }, yt = ({ entry: e, selected: n, onClick: o, getConfig: r, query: a, onRemove: l }) => {
2187
- const c = H(), { convert: s } = Y(), d = [...e.additional_titles || [], ...e.attached_texts || []], u = a && d.length ? d.find((g) => {
2187
+ const c = D(), { convert: s } = N(), d = [...e.additional_titles || [], ...e.attached_texts || []], u = a && d.length ? d.find((g) => {
2188
2188
  const f = typeof g == "string" ? g : g == null ? void 0 : g.book_title;
2189
2189
  return f == null ? void 0 : f.toLowerCase().includes(a.toLowerCase());
2190
2190
  }) : void 0;
@@ -2311,7 +2311,7 @@ function Xn(e) {
2311
2311
  return !e.dynasty && !e.birth_year && !e.death_year && (!e.alt_names || e.alt_names.length === 0) && !((n = e.description) != null && n.text);
2312
2312
  }
2313
2313
  function Qn({ data: e }) {
2314
- const { convert: n } = Y(), { dynasty: o, birth_year: r, death_year: a } = e, l = [];
2314
+ const { convert: n } = N(), { dynasty: o, birth_year: r, death_year: a } = e, l = [];
2315
2315
  return o && l.push(`〔${n(o)}〕`), r !== void 0 && a !== void 0 ? l.push(`${r}—${a}`) : r !== void 0 ? l.push(`${r}—?`) : a !== void 0 && l.push(`?—${a}`), l.length === 0 ? null : /* @__PURE__ */ t("span", { style: {
2316
2316
  fontSize: "14px",
2317
2317
  color: "var(--bim-desc-fg, #717171)",
@@ -2320,7 +2320,7 @@ function Qn({ data: e }) {
2320
2320
  }, children: l.join(" ") });
2321
2321
  }
2322
2322
  function eo({ alt_names: e }) {
2323
- const { convert: n } = Y(), o = /* @__PURE__ */ new Map();
2323
+ const { convert: n } = N(), o = /* @__PURE__ */ new Map();
2324
2324
  for (const l of e) {
2325
2325
  const c = l.type || "別名";
2326
2326
  o.has(c) || o.set(c, []), o.get(c).push(l.name);
@@ -2408,8 +2408,8 @@ function to({ data: e }) {
2408
2408
  }, children: o });
2409
2409
  }
2410
2410
  function no({ works: e, transport: n, onNavigate: o, renderLink: r }) {
2411
- const a = H(), { convert: l } = Y(), c = de(), [s, d] = w(/* @__PURE__ */ new Map());
2412
- $(() => {
2411
+ const a = D(), { convert: l } = N(), c = de(), [s, d] = w(/* @__PURE__ */ new Map());
2412
+ A(() => {
2413
2413
  if (!n) return;
2414
2414
  let x = !1;
2415
2415
  const p = e.map((S) => S.work_id);
@@ -2419,39 +2419,39 @@ function no({ works: e, transport: n, onNavigate: o, renderLink: r }) {
2419
2419
  try {
2420
2420
  const v = await n.getEntriesByIds(p);
2421
2421
  let k = !0;
2422
- for (let I = 0; I < p.length; I++) {
2423
- const _ = v[I];
2424
- _ != null && _.title ? S.set(p[I], _.title) : _ != null && _.primary_name ? S.set(p[I], _.primary_name) : k = !1;
2422
+ for (let T = 0; T < p.length; T++) {
2423
+ const z = v[T];
2424
+ z != null && z.title ? S.set(p[T], z.title) : z != null && z.primary_name ? S.set(p[T], z.primary_name) : k = !1;
2425
2425
  }
2426
2426
  if (k) return S;
2427
2427
  } catch {
2428
2428
  }
2429
2429
  if (n.getAllEntries)
2430
2430
  try {
2431
- const v = await n.getAllEntries(), k = new Map(v.map((_) => [_.id, _.title || _.primary_name || _.id]));
2432
- let I = !0;
2433
- for (const _ of p) {
2434
- const y = k.get(_);
2435
- y ? S.set(_, y) : I = !1;
2431
+ const v = await n.getAllEntries(), k = new Map(v.map((z) => [z.id, z.title || z.primary_name || z.id]));
2432
+ let T = !0;
2433
+ for (const z of p) {
2434
+ const y = k.get(z);
2435
+ y ? S.set(z, y) : T = !1;
2436
2436
  }
2437
- if (I) return S;
2437
+ if (T) return S;
2438
2438
  } catch {
2439
2439
  }
2440
- const h = [...p], z = 8, m = new Array(z).fill(0).map(async () => {
2440
+ const h = [...p], _ = 8, m = new Array(_).fill(0).map(async () => {
2441
2441
  for (; h.length; ) {
2442
2442
  const v = h.shift();
2443
2443
  if (!v) break;
2444
2444
  if (!S.has(v))
2445
2445
  try {
2446
2446
  if (n.getEntry) {
2447
- const _ = await n.getEntry(v);
2448
- if (_ != null && _.title) {
2449
- S.set(v, _.title);
2447
+ const z = await n.getEntry(v);
2448
+ if (z != null && z.title) {
2449
+ S.set(v, z.title);
2450
2450
  continue;
2451
2451
  }
2452
2452
  }
2453
- const k = await n.getItem(v), I = k && (k.title || k.primary_name) || v;
2454
- S.set(v, I);
2453
+ const k = await n.getItem(v), T = k && (k.title || k.primary_name) || v;
2454
+ S.set(v, T);
2455
2455
  } catch {
2456
2456
  S.set(v, v);
2457
2457
  }
@@ -2522,8 +2522,8 @@ function no({ works: e, transport: n, onNavigate: o, renderLink: r }) {
2522
2522
  "a",
2523
2523
  {
2524
2524
  href: c(b.work_id),
2525
- onClick: (z) => {
2526
- z.metaKey || z.ctrlKey || (z.preventDefault(), o(b.work_id));
2525
+ onClick: (_) => {
2526
+ _.metaKey || _.ctrlKey || (_.preventDefault(), o(b.work_id));
2527
2527
  },
2528
2528
  style: {
2529
2529
  color: "var(--bim-link-fg, #0066cc)",
@@ -2546,7 +2546,7 @@ const oo = ({
2546
2546
  headerExtra: a
2547
2547
  }) => {
2548
2548
  var g;
2549
- const l = H(), { convert: c } = Y();
2549
+ const l = D(), { convert: c } = N();
2550
2550
  let s = !1;
2551
2551
  try {
2552
2552
  s = Vt(e.id) === "draft";
@@ -2644,7 +2644,7 @@ function Xt(e) {
2644
2644
  return r;
2645
2645
  }
2646
2646
  function Qt({ type: e }) {
2647
- const n = H(), o = {
2647
+ const n = D(), o = {
2648
2648
  book: "#c0392b",
2649
2649
  work: "#8e6f3e",
2650
2650
  collection: "#2471a3",
@@ -2663,7 +2663,7 @@ function Qt({ type: e }) {
2663
2663
  }, children: n.indexType[e] });
2664
2664
  }
2665
2665
  function io({ isDraft: e }) {
2666
- const n = H();
2666
+ const n = D();
2667
2667
  return /* @__PURE__ */ t("span", { style: {
2668
2668
  display: "inline-block",
2669
2669
  padding: "1px 6px",
@@ -2677,7 +2677,7 @@ function io({ isDraft: e }) {
2677
2677
  }, children: e ? n.status.draft : n.status.official });
2678
2678
  }
2679
2679
  function lo({ id: e }) {
2680
- const n = H(), [o, r] = rt.useState(!1), a = () => {
2680
+ const n = D(), [o, r] = rt.useState(!1), a = () => {
2681
2681
  navigator.clipboard.writeText(e).then(() => {
2682
2682
  r(!0), setTimeout(() => r(!1), 1500);
2683
2683
  });
@@ -2742,7 +2742,7 @@ function xe({ label: e, children: n }) {
2742
2742
  ] });
2743
2743
  }
2744
2744
  function en({ authors: e, type: n, onNavigate: o, renderLink: r }) {
2745
- const { convert: a } = Y();
2745
+ const { convert: a } = N();
2746
2746
  return /* @__PURE__ */ t("span", { style: {
2747
2747
  fontSize: "14px",
2748
2748
  color: "var(--bim-fg, #333)",
@@ -2773,7 +2773,7 @@ function en({ authors: e, type: n, onNavigate: o, renderLink: r }) {
2773
2773
  }
2774
2774
  function se({ id: e, label: n, onNavigate: o, renderLink: r }) {
2775
2775
  const a = de();
2776
- return r ? /* @__PURE__ */ t(j, { children: r(e, n) }) : o ? /* @__PURE__ */ t(
2776
+ return r ? /* @__PURE__ */ t(F, { children: r(e, n) }) : o ? /* @__PURE__ */ t(
2777
2777
  "a",
2778
2778
  {
2779
2779
  href: a(e),
@@ -2847,10 +2847,10 @@ function ao({ id: e, title: n, edition: o, type: r, isDraft: a, authors: l, volu
2847
2847
  ] });
2848
2848
  }
2849
2849
  function tn({ items: e, label: n, showMeta: o, onNavigate: r, renderLink: a }) {
2850
- const l = H(), { convert: c } = Y();
2850
+ const l = D(), { convert: c } = N();
2851
2851
  if (!e.length) return null;
2852
2852
  const [s, d] = w(null);
2853
- return /* @__PURE__ */ i(j, { children: [
2853
+ return /* @__PURE__ */ i(F, { children: [
2854
2854
  /* @__PURE__ */ t(le, { children: n }),
2855
2855
  /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: e.map((u, g) => {
2856
2856
  const f = s === g;
@@ -2988,16 +2988,16 @@ function tn({ items: e, label: n, showMeta: o, onNavigate: r, renderLink: a }) {
2988
2988
  ] });
2989
2989
  }
2990
2990
  function co({ items: e, onNavigate: n, renderLink: o }) {
2991
- const r = H();
2991
+ const r = D();
2992
2992
  return /* @__PURE__ */ t(tn, { items: e, label: r.section.indexed, showMeta: !0, onNavigate: n, renderLink: o });
2993
2993
  }
2994
2994
  function so({ items: e, onNavigate: n, renderLink: o }) {
2995
- const r = H();
2995
+ const r = D();
2996
2996
  return /* @__PURE__ */ t(tn, { items: e, label: r.section.emendated, onNavigate: n, renderLink: o });
2997
2997
  }
2998
2998
  function nn({ label: e, items: n }) {
2999
- const { convert: o } = Y();
3000
- return n.length ? /* @__PURE__ */ i(j, { children: [
2999
+ const { convert: o } = N();
3000
+ return n.length ? /* @__PURE__ */ i(F, { children: [
3001
3001
  /* @__PURE__ */ t(le, { children: e }),
3002
3002
  /* @__PURE__ */ t("div", { style: {
3003
3003
  display: "flex",
@@ -3020,16 +3020,16 @@ function nn({ label: e, items: n }) {
3020
3020
  ] }) : null;
3021
3021
  }
3022
3022
  function po({ items: e }) {
3023
- const n = H();
3023
+ const n = D();
3024
3024
  return /* @__PURE__ */ t(nn, { label: n.section.aliases, items: e });
3025
3025
  }
3026
3026
  function uo({ items: e }) {
3027
- const n = H();
3027
+ const n = D();
3028
3028
  return /* @__PURE__ */ t(nn, { label: n.section.attachedTexts, items: e });
3029
3029
  }
3030
3030
  function fo({ items: e }) {
3031
- const n = H(), { convert: o } = Y();
3032
- return e.length ? /* @__PURE__ */ i(j, { children: [
3031
+ const n = D(), { convert: o } = N();
3032
+ return e.length ? /* @__PURE__ */ i(F, { children: [
3033
3033
  /* @__PURE__ */ t(le, { children: n.section.appendix }),
3034
3034
  /* @__PURE__ */ t("div", { style: {
3035
3035
  display: "flex",
@@ -3057,8 +3057,8 @@ function fo({ items: e }) {
3057
3057
  ] }) : null;
3058
3058
  }
3059
3059
  function go({ items: e }) {
3060
- const n = H(), { convert: o } = Y();
3061
- return e.length ? /* @__PURE__ */ i(j, { children: [
3060
+ const n = D(), { convert: o } = N();
3061
+ return e.length ? /* @__PURE__ */ i(F, { children: [
3062
3062
  /* @__PURE__ */ t(le, { children: n.section.locationHistory }),
3063
3063
  /* @__PURE__ */ i("div", { style: { position: "relative", paddingLeft: "18px" }, children: [
3064
3064
  /* @__PURE__ */ t("div", { style: {
@@ -3087,8 +3087,8 @@ function go({ items: e }) {
3087
3087
  ] }) : null;
3088
3088
  }
3089
3089
  function ho({ items: e }) {
3090
- const n = H(), { convert: o } = Y();
3091
- return e.length ? /* @__PURE__ */ i(j, { children: [
3090
+ const n = D(), { convert: o } = N();
3091
+ return e.length ? /* @__PURE__ */ i(F, { children: [
3092
3092
  /* @__PURE__ */ t(le, { children: n.section.historyOverview }),
3093
3093
  /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: e.map((r, a) => /* @__PURE__ */ i("div", { style: {
3094
3094
  fontSize: "13px",
@@ -3108,8 +3108,8 @@ function ho({ items: e }) {
3108
3108
  ] }) : null;
3109
3109
  }
3110
3110
  function kt({ title: e, ids: n, transport: o, onNavigate: r, renderLink: a }) {
3111
- const { convert: l } = Y(), [c, s] = w([]);
3112
- return $(() => {
3111
+ const { convert: l } = N(), [c, s] = w([]);
3112
+ return A(() => {
3113
3113
  if (!n.length) {
3114
3114
  s([]);
3115
3115
  return;
@@ -3133,7 +3133,7 @@ function kt({ title: e, ids: n, transport: o, onNavigate: r, renderLink: a }) {
3133
3133
  }), () => {
3134
3134
  d = !0;
3135
3135
  };
3136
- }, [n, o]), n.length ? /* @__PURE__ */ i(j, { children: [
3136
+ }, [n, o]), n.length ? /* @__PURE__ */ i(F, { children: [
3137
3137
  /* @__PURE__ */ i(le, { children: [
3138
3138
  e,
3139
3139
  /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "var(--bim-desc-fg, #aaa)", fontWeight: 400 }, children: [
@@ -3163,7 +3163,7 @@ function kt({ title: e, ids: n, transport: o, onNavigate: r, renderLink: a }) {
3163
3163
  ] }) : null;
3164
3164
  }
3165
3165
  function xo({ book: e, onNavigate: n, renderLink: o }) {
3166
- const r = H(), { convert: a } = Y(), [l, c] = w(!1), s = e.resources && e.resources.length > 0, d = e.edition ? a(e.edition) : a(e.title) || void 0;
3166
+ const r = D(), { convert: a } = N(), [l, c] = w(!1), s = e.resources && e.resources.length > 0, d = e.edition ? a(e.edition) : a(e.title) || void 0;
3167
3167
  return /* @__PURE__ */ i("div", { style: {
3168
3168
  border: "1px solid var(--bim-widget-border, #e0e0e0)",
3169
3169
  borderRadius: "6px",
@@ -3200,8 +3200,8 @@ function xo({ book: e, onNavigate: n, renderLink: o }) {
3200
3200
  ] });
3201
3201
  }
3202
3202
  function bo({ ids: e, transport: n, onNavigate: o, renderLink: r }) {
3203
- const a = H(), [l, c] = w([]);
3204
- return $(() => {
3203
+ const a = D(), [l, c] = w([]);
3204
+ return A(() => {
3205
3205
  if (!e.length) {
3206
3206
  c([]);
3207
3207
  return;
@@ -3225,7 +3225,7 @@ function bo({ ids: e, transport: n, onNavigate: o, renderLink: r }) {
3225
3225
  }), () => {
3226
3226
  s = !0;
3227
3227
  };
3228
- }, [e, n]), e.length ? /* @__PURE__ */ i(j, { children: [
3228
+ }, [e, n]), e.length ? /* @__PURE__ */ i(F, { children: [
3229
3229
  /* @__PURE__ */ i(le, { children: [
3230
3230
  a.section.relatedVersions,
3231
3231
  /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "var(--bim-desc-fg, #aaa)", fontWeight: 400 }, children: [
@@ -3239,7 +3239,7 @@ function bo({ ids: e, transport: n, onNavigate: o, renderLink: r }) {
3239
3239
  }
3240
3240
  function mo({ workData: e, onNavigate: n, renderLink: o }) {
3241
3241
  var l, c, s;
3242
- const r = H(), { convert: a } = Y();
3242
+ const r = D(), { convert: a } = N();
3243
3243
  return /* @__PURE__ */ i("div", { style: {
3244
3244
  border: "1px solid var(--bim-widget-border, #e0e0e0)",
3245
3245
  borderRadius: "8px",
@@ -3286,7 +3286,7 @@ function mo({ workData: e, onNavigate: n, renderLink: o }) {
3286
3286
  ] });
3287
3287
  }
3288
3288
  function yo({ items: e, onNavigate: n, renderLink: o }) {
3289
- const r = H(), { convert: a } = Y();
3289
+ const r = D(), { convert: a } = N();
3290
3290
  return e.length ? /* @__PURE__ */ t("div", { style: {
3291
3291
  display: "flex",
3292
3292
  flexWrap: "wrap",
@@ -3321,53 +3321,53 @@ const on = ({
3321
3321
  className: c,
3322
3322
  style: s
3323
3323
  }) => {
3324
- var O, A, N, U, T, D;
3325
- const d = H(), { convert: u } = Y(), [g, f] = w(null), [x, p] = w(!1), [b, S] = w(null), [h, z] = w(null), [m, v] = w([]), k = e || g;
3326
- if ($(() => {
3324
+ var H, K, J, Y, C, M;
3325
+ const d = D(), { convert: u } = N(), [g, f] = w(null), [x, p] = w(!1), [b, S] = w(null), [h, _] = w(null), [m, v] = w([]), k = e || g;
3326
+ if (A(() => {
3327
3327
  if (e || !n || !o) return;
3328
- let C = !1;
3328
+ let I = !1;
3329
3329
  return p(!0), S(null), o.getItem(n).then((R) => {
3330
- C || (R ? f(R) : S(d.misc.notFoundEntry));
3330
+ I || (R ? f(R) : S(d.misc.notFoundEntry));
3331
3331
  }).catch((R) => {
3332
- C || S(R instanceof Error ? R.message : d.misc.loadFailed);
3332
+ I || S(R instanceof Error ? R.message : d.misc.loadFailed);
3333
3333
  }).finally(() => {
3334
- C || p(!1);
3334
+ I || p(!1);
3335
3335
  }), () => {
3336
- C = !0;
3336
+ I = !0;
3337
3337
  };
3338
- }, [e, n, o]), $(() => {
3338
+ }, [e, n, o]), A(() => {
3339
3339
  if (!k || !o) {
3340
- z(null), v([]);
3340
+ _(null), v([]);
3341
3341
  return;
3342
3342
  }
3343
- let C = !1;
3343
+ let I = !1;
3344
3344
  const R = k.type === "book" || k.type === "collection" ? k.work_id : void 0;
3345
3345
  if (R ? o.getItem(R).then((P) => {
3346
- !C && P && P.type === "work" && z(P);
3346
+ !I && P && P.type === "work" && _(P);
3347
3347
  }).catch(() => {
3348
- }) : z(null), k.type === "book") {
3348
+ }) : _(null), k.type === "book") {
3349
3349
  const P = k;
3350
3350
  P.contained_in && P.contained_in.length > 0 ? Promise.all(
3351
- P.contained_in.map((J) => {
3352
- const V = typeof J == "string" ? J : J.id, ee = typeof J == "string" ? void 0 : J.volume_index;
3353
- return o.getItem(V).then((te) => ({
3354
- id: V,
3355
- title: te && te.title || V,
3356
- volume_index: ee
3357
- })).catch(() => ({ id: V, title: V, volume_index: ee }));
3351
+ P.contained_in.map(($) => {
3352
+ const j = typeof $ == "string" ? $ : $.id, Z = typeof $ == "string" ? void 0 : $.volume_index;
3353
+ return o.getItem(j).then((te) => ({
3354
+ id: j,
3355
+ title: te && te.title || j,
3356
+ volume_index: Z
3357
+ })).catch(() => ({ id: j, title: j, volume_index: Z }));
3358
3358
  })
3359
- ).then((J) => {
3360
- C || v(J);
3359
+ ).then(($) => {
3360
+ I || v($);
3361
3361
  }) : v([]);
3362
3362
  } else
3363
3363
  v([]);
3364
3364
  return () => {
3365
- C = !0;
3365
+ I = !0;
3366
3366
  };
3367
3367
  }, [k, o]), x)
3368
- return /* @__PURE__ */ t("div", { className: c, style: { ...s, padding: "24px" }, children: /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [180, 260, 160].map((C, R) => /* @__PURE__ */ t("div", { style: {
3368
+ return /* @__PURE__ */ t("div", { className: c, style: { ...s, padding: "24px" }, children: /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [180, 260, 160].map((I, R) => /* @__PURE__ */ t("div", { style: {
3369
3369
  height: R === 1 ? "32px" : "16px",
3370
- width: `${C}px`,
3370
+ width: `${I}px`,
3371
3371
  background: "var(--bim-widget-border, #e0e0e0)",
3372
3372
  borderRadius: "4px",
3373
3373
  opacity: 0.4
@@ -3392,22 +3392,22 @@ const on = ({
3392
3392
  headerExtra: l
3393
3393
  }
3394
3394
  ) });
3395
- const I = k.type === "book" ? k : null, _ = k.type === "collection" ? k : null, y = k.type === "work" ? k : null;
3395
+ const T = k.type === "book" ? k : null, z = k.type === "collection" ? k : null, y = k.type === "work" ? k : null;
3396
3396
  let B = !1;
3397
3397
  try {
3398
3398
  B = Vt(k.id) === "draft";
3399
3399
  } catch {
3400
3400
  }
3401
3401
  let W = "";
3402
- k.measure_info ? W = u(k.measure_info) : (O = k.juan_count) != null && O.number ? W = Xt(k.juan_count.number) + d.unit.juan : (A = k.juan_count) != null && A.description && (W = u(k.juan_count.description));
3402
+ k.measure_info ? W = u(k.measure_info) : (H = k.juan_count) != null && H.number ? W = Xt(k.juan_count.number) + d.unit.juan : (K = k.juan_count) != null && K.description && (W = u(k.juan_count.description));
3403
3403
  const E = [];
3404
- return (N = k.publication_info) != null && N.year && E.push(/* @__PURE__ */ t(xe, { label: d.label.year, children: k.publication_info.year }, "year")), (U = k.current_location) != null && U.name && E.push(/* @__PURE__ */ t(xe, { label: d.label.currentLocation, children: u(k.current_location.name) }, "loc")), (T = k.page_count) != null && T.description && E.push(/* @__PURE__ */ t(xe, { label: d.label.pageCount, children: k.page_count.description }, "page")), I != null && I.edition && E.push(/* @__PURE__ */ t(xe, { label: d.label.edition, children: u(I.edition) }, "ver")), y != null && y.parent_work && E.push(
3404
+ return (J = k.publication_info) != null && J.year && E.push(/* @__PURE__ */ t(xe, { label: d.label.year, children: k.publication_info.year }, "year")), (Y = k.current_location) != null && Y.name && E.push(/* @__PURE__ */ t(xe, { label: d.label.currentLocation, children: u(k.current_location.name) }, "loc")), (C = k.page_count) != null && C.description && E.push(/* @__PURE__ */ t(xe, { label: d.label.pageCount, children: k.page_count.description }, "page")), T != null && T.edition && E.push(/* @__PURE__ */ t(xe, { label: d.label.edition, children: u(T.edition) }, "ver")), y != null && y.parent_work && E.push(
3405
3405
  /* @__PURE__ */ t(xe, { label: d.label.parentWork, children: /* @__PURE__ */ t(se, { id: y.parent_work.id, label: u(y.parent_work.title), onNavigate: r, renderLink: a }) }, "pw")
3406
3406
  ), y != null && y.parent_works && y.parent_works.length > 0 && !y.parent_work && E.push(
3407
- /* @__PURE__ */ t(xe, { label: d.label.parentWork, children: y.parent_works.map((C, R) => /* @__PURE__ */ i("span", { children: [
3407
+ /* @__PURE__ */ t(xe, { label: d.label.parentWork, children: y.parent_works.map((I, R) => /* @__PURE__ */ i("span", { children: [
3408
3408
  R > 0 && "、",
3409
- /* @__PURE__ */ t(se, { id: C, onNavigate: r, renderLink: a })
3410
- ] }, C)) }, "pws")
3409
+ /* @__PURE__ */ t(se, { id: I, onNavigate: r, renderLink: a })
3410
+ ] }, I)) }, "pws")
3411
3411
  ), /* @__PURE__ */ i("div", { className: c, style: s, children: [
3412
3412
  /* @__PURE__ */ t(
3413
3413
  ao,
@@ -3425,18 +3425,18 @@ const on = ({
3425
3425
  renderLink: a
3426
3426
  }
3427
3427
  ),
3428
- ((D = k.description) == null ? void 0 : D.text) && /* @__PURE__ */ t("p", { style: {
3428
+ ((M = k.description) == null ? void 0 : M.text) && /* @__PURE__ */ t("p", { style: {
3429
3429
  fontSize: "14px",
3430
3430
  color: "var(--bim-fg, #444)",
3431
3431
  lineHeight: 1.9,
3432
3432
  margin: "0 0 4px",
3433
3433
  textAlign: "justify"
3434
3434
  }, children: u(k.description.text) }),
3435
- m.length > 0 && /* @__PURE__ */ i(j, { children: [
3435
+ m.length > 0 && /* @__PURE__ */ i(F, { children: [
3436
3436
  /* @__PURE__ */ t(le, { children: d.section.containedIn }),
3437
3437
  /* @__PURE__ */ t(yo, { items: m, onNavigate: r, renderLink: a })
3438
3438
  ] }),
3439
- h && /* @__PURE__ */ i(j, { children: [
3439
+ h && /* @__PURE__ */ i(F, { children: [
3440
3440
  /* @__PURE__ */ t(le, { children: d.section.belongsToWork }),
3441
3441
  /* @__PURE__ */ t(mo, { workData: h, onNavigate: r, renderLink: a })
3442
3442
  ] }),
@@ -3445,24 +3445,24 @@ const on = ({
3445
3445
  k.attached_texts && k.attached_texts.length > 0 && /* @__PURE__ */ t(uo, { items: k.attached_texts }),
3446
3446
  k.indexed_by && k.indexed_by.length > 0 && /* @__PURE__ */ t(co, { items: k.indexed_by, onNavigate: r, renderLink: a }),
3447
3447
  k.emendated_by && k.emendated_by.length > 0 && /* @__PURE__ */ t(so, { items: k.emendated_by, onNavigate: r, renderLink: a }),
3448
- k.resources && k.resources.length > 0 && /* @__PURE__ */ i(j, { children: [
3448
+ k.resources && k.resources.length > 0 && /* @__PURE__ */ i(F, { children: [
3449
3449
  /* @__PURE__ */ t(le, { children: d.section.resources }),
3450
3450
  /* @__PURE__ */ t(qt, { items: k.resources, groupByType: !0, onNavigate: r, renderLink: a })
3451
3451
  ] }),
3452
- (I == null ? void 0 : I.location_history) && I.location_history.length > 0 && /* @__PURE__ */ t(go, { items: I.location_history }),
3453
- (_ == null ? void 0 : _.history) && _.history.length > 0 && /* @__PURE__ */ t(ho, { items: _.history }),
3454
- (I == null ? void 0 : I.related_books) && I.related_books.length > 0 && /* @__PURE__ */ t(kt, { title: d.section.relatedVersions, ids: I.related_books, transport: o, onNavigate: r, renderLink: a }),
3455
- (_ == null ? void 0 : _.books) && _.books.length > 0 && /* @__PURE__ */ t(kt, { title: d.section.containedBooks, ids: _.books, transport: o, onNavigate: r, renderLink: a }),
3456
- (_ == null ? void 0 : _.contained_works) && _.contained_works.length > 0 && /* @__PURE__ */ i("div", { children: [
3452
+ (T == null ? void 0 : T.location_history) && T.location_history.length > 0 && /* @__PURE__ */ t(go, { items: T.location_history }),
3453
+ (z == null ? void 0 : z.history) && z.history.length > 0 && /* @__PURE__ */ t(ho, { items: z.history }),
3454
+ (T == null ? void 0 : T.related_books) && T.related_books.length > 0 && /* @__PURE__ */ t(kt, { title: d.section.relatedVersions, ids: T.related_books, transport: o, onNavigate: r, renderLink: a }),
3455
+ (z == null ? void 0 : z.books) && z.books.length > 0 && /* @__PURE__ */ t(kt, { title: d.section.containedBooks, ids: z.books, transport: o, onNavigate: r, renderLink: a }),
3456
+ (z == null ? void 0 : z.contained_works) && z.contained_works.length > 0 && /* @__PURE__ */ i("div", { children: [
3457
3457
  /* @__PURE__ */ i(le, { children: [
3458
3458
  d.section.containedWorks,
3459
3459
  /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "var(--bim-desc-fg, #aaa)", fontWeight: 400 }, children: [
3460
3460
  "(",
3461
- _.contained_works.length,
3461
+ z.contained_works.length,
3462
3462
  ")"
3463
3463
  ] })
3464
3464
  ] }),
3465
- /* @__PURE__ */ t("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: _.contained_works.map((C) => /* @__PURE__ */ t("span", { style: {
3465
+ /* @__PURE__ */ t("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: z.contained_works.map((I) => /* @__PURE__ */ t("span", { style: {
3466
3466
  display: "inline-flex",
3467
3467
  alignItems: "center",
3468
3468
  gap: "4px",
@@ -3471,21 +3471,21 @@ const on = ({
3471
3471
  border: "1px solid var(--bim-widget-border, #e0e0e0)",
3472
3472
  borderRadius: "4px",
3473
3473
  background: "var(--bim-input-bg, #fff)"
3474
- }, children: /* @__PURE__ */ t(se, { id: C.id, label: u(C.title), onNavigate: r, renderLink: a }) }, C.id)) })
3474
+ }, children: /* @__PURE__ */ t(se, { id: I.id, label: u(I.title), onNavigate: r, renderLink: a }) }, I.id)) })
3475
3475
  ] }),
3476
3476
  (y == null ? void 0 : y.books) && y.books.length > 0 && /* @__PURE__ */ t(bo, { ids: y.books, transport: o, onNavigate: r, renderLink: a }),
3477
3477
  (y == null ? void 0 : y.related_works) && y.related_works.length > 0 && (() => {
3478
- const C = [], R = y.related_works.filter((V) => V.relation === "part_of"), P = y.related_works.filter((V) => V.relation === "has_part"), J = y.related_works.filter((V) => !V.relation);
3479
- return R.length > 0 && C.push({ label: d.section.belongsToWork, items: R }), P.length > 0 && C.push({ label: d.section.containedWorks, items: P }), J.length > 0 && C.push({ label: d.section.relatedWorks, items: J }), C.map((V) => /* @__PURE__ */ i("div", { children: [
3478
+ const I = [], R = y.related_works.filter((j) => j.relation === "part_of"), P = y.related_works.filter((j) => j.relation === "has_part"), $ = y.related_works.filter((j) => !j.relation);
3479
+ return R.length > 0 && I.push({ label: d.section.belongsToWork, items: R }), P.length > 0 && I.push({ label: d.section.containedWorks, items: P }), $.length > 0 && I.push({ label: d.section.relatedWorks, items: $ }), I.map((j) => /* @__PURE__ */ i("div", { children: [
3480
3480
  /* @__PURE__ */ i(le, { children: [
3481
- V.label,
3481
+ j.label,
3482
3482
  /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "var(--bim-desc-fg, #aaa)", fontWeight: 400 }, children: [
3483
3483
  "(",
3484
- V.items.length,
3484
+ j.items.length,
3485
3485
  ")"
3486
3486
  ] })
3487
3487
  ] }),
3488
- /* @__PURE__ */ t("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: V.items.map((ee) => /* @__PURE__ */ t("span", { style: {
3488
+ /* @__PURE__ */ t("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: j.items.map((Z) => /* @__PURE__ */ t("span", { style: {
3489
3489
  display: "inline-flex",
3490
3490
  alignItems: "center",
3491
3491
  gap: "4px",
@@ -3494,13 +3494,13 @@ const on = ({
3494
3494
  border: "1px solid var(--bim-widget-border, #e0e0e0)",
3495
3495
  borderRadius: "4px",
3496
3496
  background: "var(--bim-input-bg, #fff)"
3497
- }, children: /* @__PURE__ */ t(se, { id: ee.id, label: u(ee.title), onNavigate: r, renderLink: a }) }, ee.id)) })
3498
- ] }, V.label));
3497
+ }, children: /* @__PURE__ */ t(se, { id: Z.id, label: u(Z.title), onNavigate: r, renderLink: a }) }, Z.id)) })
3498
+ ] }, j.label));
3499
3499
  })()
3500
3500
  ] });
3501
3501
  };
3502
3502
  function vo({ data: e }) {
3503
- const n = H(), { convert: o } = Y(), { stats: r } = e, a = r.processed_volumes ?? r.total_found_volumes, l = a != null && e.total_volumes > 0 ? Math.round(a / e.total_volumes * 100) : null;
3503
+ const n = D(), { convert: o } = N(), { stats: r } = e, a = r.processed_volumes ?? r.total_found_volumes, l = a != null && e.total_volumes > 0 ? Math.round(a / e.total_volumes * 100) : null;
3504
3504
  return /* @__PURE__ */ i("div", { style: { marginBottom: "24px" }, children: [
3505
3505
  /* @__PURE__ */ t("h2", { style: {
3506
3506
  fontSize: "18px",
@@ -3567,7 +3567,7 @@ function ko({
3567
3567
  activeSection: n,
3568
3568
  onSelect: o
3569
3569
  }) {
3570
- const r = H();
3570
+ const r = D();
3571
3571
  return /* @__PURE__ */ i("div", { style: {
3572
3572
  display: "flex",
3573
3573
  flexWrap: "wrap",
@@ -3618,7 +3618,7 @@ function St(e) {
3618
3618
  }
3619
3619
  function So({ id: e, label: n, onNavigate: o, renderLink: r }) {
3620
3620
  const a = de();
3621
- return r ? /* @__PURE__ */ t(j, { children: r(e, n) }) : o ? /* @__PURE__ */ t(
3621
+ return r ? /* @__PURE__ */ t(F, { children: r(e, n) }) : o ? /* @__PURE__ */ t(
3622
3622
  "a",
3623
3623
  {
3624
3624
  href: a(e),
@@ -3646,7 +3646,7 @@ function wo(e, n) {
3646
3646
  return r - o + 1 === e.length ? `${o}–${r}` : e.length <= 3 ? e.join(", ") : `${o}–${r} (${e.length}${n})`;
3647
3647
  }
3648
3648
  function wt({ book: e, onNavigate: n, renderLink: o, showVolumes: r }) {
3649
- const a = H(), { convert: l } = Y(), c = e.book_id || e.work_id, s = r && e.volumes.length > 0 ? wo(e.volumes, a.unit.volume) : null, d = e.missing_volumes && e.missing_volumes.length > 0;
3649
+ const a = D(), { convert: l } = N(), c = e.book_id || e.work_id, s = r && e.volumes.length > 0 ? wo(e.volumes, a.unit.volume) : null, d = e.missing_volumes && e.missing_volumes.length > 0;
3650
3650
  return /* @__PURE__ */ i("div", { style: {
3651
3651
  display: "flex",
3652
3652
  alignItems: "baseline",
@@ -3721,8 +3721,8 @@ const _o = ({
3721
3721
  className: l,
3722
3722
  style: c
3723
3723
  }) => {
3724
- const s = H(), [d, u] = w(null), [g, f] = w(!1), [x, p] = w(null), [b, S] = w(null), [h, z] = w(""), m = e || d;
3725
- $(() => {
3724
+ const s = D(), [d, u] = w(null), [g, f] = w(!1), [x, p] = w(null), [b, S] = w(null), [h, _] = w(""), m = e || d;
3725
+ A(() => {
3726
3726
  if (e || !n || !(o != null && o.getCollectionCatalog)) return;
3727
3727
  let y = !1;
3728
3728
  return f(!0), p(null), o.getCollectionCatalog(n).then((B) => {
@@ -3740,7 +3740,7 @@ const _o = ({
3740
3740
  if (m.volume_index && Object.keys(m.volume_index).length > 0) return !0;
3741
3741
  const y = m.books.map((W) => W.volumes[0]).filter((W) => W != null);
3742
3742
  return new Set(y).size < y.length;
3743
- }, [m]), I = ce(() => {
3743
+ }, [m]), T = ce(() => {
3744
3744
  if (!m) return [];
3745
3745
  let y = m.books;
3746
3746
  if (b && (y = y.filter((B) => B.section === b)), h.trim()) {
@@ -3750,19 +3750,19 @@ const _o = ({
3750
3750
  );
3751
3751
  }
3752
3752
  return y;
3753
- }, [m, b, h]), _ = ce(() => {
3753
+ }, [m, b, h]), z = ce(() => {
3754
3754
  if (!k) return null;
3755
3755
  const y = [], B = /* @__PURE__ */ new Map();
3756
- for (const E of I) {
3756
+ for (const E of T) {
3757
3757
  if (!E.volumes || E.volumes.length === 0) continue;
3758
- const O = E.volumes[0];
3759
- B.has(O) || B.set(O, []), B.get(O).push(E);
3758
+ const H = E.volumes[0];
3759
+ B.has(H) || B.set(H, []), B.get(H).push(E);
3760
3760
  }
3761
- const W = [...B.keys()].sort((E, O) => E - O);
3761
+ const W = [...B.keys()].sort((E, H) => E - H);
3762
3762
  for (const E of W)
3763
3763
  y.push({ volume: E, books: B.get(E) });
3764
3764
  return y;
3765
- }, [I, k]);
3765
+ }, [T, k]);
3766
3766
  return g ? /* @__PURE__ */ t("div", { className: l, style: { ...c, padding: "24px" }, children: /* @__PURE__ */ t("div", { style: { color: "var(--bim-desc-fg, #717171)", fontSize: "13px" }, children: s.catalog.loading }) }) : x ? /* @__PURE__ */ t("div", { className: l, style: {
3767
3767
  ...c,
3768
3768
  padding: "24px",
@@ -3786,7 +3786,7 @@ const _o = ({
3786
3786
  type: "text",
3787
3787
  placeholder: s.search.searchBookName,
3788
3788
  value: h,
3789
- onChange: (y) => z(y.target.value),
3789
+ onChange: (y) => _(y.target.value),
3790
3790
  style: {
3791
3791
  width: "100%",
3792
3792
  maxWidth: "320px",
@@ -3805,7 +3805,7 @@ const _o = ({
3805
3805
  fontSize: "12px",
3806
3806
  color: "var(--bim-desc-fg, #999)"
3807
3807
  }, children: [
3808
- I.length,
3808
+ T.length,
3809
3809
  " ",
3810
3810
  s.unit.bu
3811
3811
  ] })
@@ -3815,9 +3815,9 @@ const _o = ({
3815
3815
  borderRadius: "6px",
3816
3816
  overflow: "hidden"
3817
3817
  }, children: [
3818
- _ ? (
3818
+ z ? (
3819
3819
  /* 按册分组模式 */
3820
- _.map((y, B) => /* @__PURE__ */ i("div", { children: [
3820
+ z.map((y, B) => /* @__PURE__ */ i("div", { children: [
3821
3821
  /* @__PURE__ */ t("div", { style: {
3822
3822
  padding: "4px 12px",
3823
3823
  background: "var(--bim-bg, #f8f8f8)",
@@ -3842,7 +3842,7 @@ const _o = ({
3842
3842
  ] }, `${y.volume}-${B}`))
3843
3843
  ) : (
3844
3844
  /* 平铺模式(百衲本等,每本书独立行) */
3845
- I.map((y, B) => /* @__PURE__ */ t(
3845
+ T.map((y, B) => /* @__PURE__ */ t(
3846
3846
  wt,
3847
3847
  {
3848
3848
  book: y,
@@ -3853,7 +3853,7 @@ const _o = ({
3853
3853
  B
3854
3854
  ))
3855
3855
  ),
3856
- I.length === 0 && /* @__PURE__ */ t("div", { style: {
3856
+ T.length === 0 && /* @__PURE__ */ t("div", { style: {
3857
3857
  padding: "32px",
3858
3858
  textAlign: "center",
3859
3859
  color: "var(--bim-desc-fg, #999)",
@@ -3863,7 +3863,7 @@ const _o = ({
3863
3863
  ] }) : null;
3864
3864
  }, Se = () => {
3865
3865
  const [e, n] = w(1);
3866
- return $(() => {
3866
+ return A(() => {
3867
3867
  const o = setInterval(() => n((r) => r >= 3 ? 1 : r + 1), 500);
3868
3868
  return () => clearInterval(o);
3869
3869
  }, []), /* @__PURE__ */ t("div", { style: { textAlign: "center", padding: "32px 0", color: "var(--bim-desc-fg, #717171)", fontSize: "14px" }, children: "加载中" + ".".repeat(e) });
@@ -3875,27 +3875,27 @@ const _o = ({
3875
3875
  maxWidth: a = 280,
3876
3876
  wrapperStyle: l
3877
3877
  }) => {
3878
- const [c, s] = w(!1), [d, u] = w(null), g = Q(null), f = Q(null), x = Q(null), p = F(() => {
3879
- const h = f.current, z = x.current;
3880
- if (!h || !z) return;
3881
- const m = h.getBoundingClientRect(), v = z.getBoundingClientRect(), k = window.innerHeight, I = document.documentElement.clientWidth;
3882
- let _ = o;
3883
- o === "top" && m.top - v.height - Oe < 8 && (_ = "bottom"), o === "bottom" && m.bottom + v.height + Oe > k - 8 && (_ = "top");
3884
- const y = _ === "top" ? m.top - v.height - Oe : m.bottom + Oe;
3878
+ const [c, s] = w(!1), [d, u] = w(null), g = q(null), f = q(null), x = q(null), p = U(() => {
3879
+ const h = f.current, _ = x.current;
3880
+ if (!h || !_) return;
3881
+ const m = h.getBoundingClientRect(), v = _.getBoundingClientRect(), k = window.innerHeight, T = document.documentElement.clientWidth;
3882
+ let z = o;
3883
+ o === "top" && m.top - v.height - Oe < 8 && (z = "bottom"), o === "bottom" && m.bottom + v.height + Oe > k - 8 && (z = "top");
3884
+ const y = z === "top" ? m.top - v.height - Oe : m.bottom + Oe;
3885
3885
  let B = m.left + m.width / 2 - v.width / 2;
3886
- B = Math.max(8, Math.min(B, I - v.width - 8)), u({ left: B, top: y, placement: _ });
3887
- }, [o]), b = F(() => {
3886
+ B = Math.max(8, Math.min(B, T - v.width - 8)), u({ left: B, top: y, placement: z });
3887
+ }, [o]), b = U(() => {
3888
3888
  g.current && clearTimeout(g.current), g.current = setTimeout(() => s(!0), r);
3889
- }, [r]), S = F(() => {
3889
+ }, [r]), S = U(() => {
3890
3890
  g.current && clearTimeout(g.current), s(!1), u(null);
3891
3891
  }, []);
3892
- return $(() => {
3892
+ return A(() => {
3893
3893
  if (!c) return;
3894
3894
  const h = requestAnimationFrame(p);
3895
3895
  return () => cancelAnimationFrame(h);
3896
- }, [c, p]), $(() => () => {
3896
+ }, [c, p]), A(() => () => {
3897
3897
  g.current && clearTimeout(g.current);
3898
- }, []), /* @__PURE__ */ i(j, { children: [
3898
+ }, []), /* @__PURE__ */ i(F, { children: [
3899
3899
  /* @__PURE__ */ t(
3900
3900
  "span",
3901
3901
  {
@@ -3936,7 +3936,7 @@ const _o = ({
3936
3936
  },
3937
3937
  children: [
3938
3938
  e,
3939
- d && /* @__PURE__ */ i(j, { children: [
3939
+ d && /* @__PURE__ */ i(F, { children: [
3940
3940
  /* @__PURE__ */ t(
3941
3941
  "span",
3942
3942
  {
@@ -4034,7 +4034,7 @@ function Lo() {
4034
4034
  }
4035
4035
  function me() {
4036
4036
  const [, e] = w(0);
4037
- return $(() => {
4037
+ return A(() => {
4038
4038
  if (Pe) return;
4039
4039
  const n = () => e((o) => o + 1);
4040
4040
  return Ue.add(n), Lo(), () => {
@@ -4064,7 +4064,7 @@ function Ie(e, n, o) {
4064
4064
  /* @__PURE__ */ t("mark", { style: { background: it, padding: 0, color: "inherit" }, children: e.slice(d, d + r.length) }, s++)
4065
4065
  ), c = d + r.length;
4066
4066
  }
4067
- return /* @__PURE__ */ t(j, { children: l });
4067
+ return /* @__PURE__ */ t(F, { children: l });
4068
4068
  }
4069
4069
  function lt(e, n, o, r) {
4070
4070
  if (!n) return !0;
@@ -4159,12 +4159,12 @@ function $o(e, n) {
4159
4159
  function sn({ group: e, activeFile: n, onSelect: o, depth: r = 0, juanMeta: a, matchStates: l }) {
4160
4160
  var b;
4161
4161
  const c = an(e, n || ""), s = $o(e, l), d = typeof s == "number" && s > 0, u = s === 0, [g, f] = w(c || d), x = cn(e), p = !!((b = e.children) != null && b.length);
4162
- if ($(() => {
4162
+ if (A(() => {
4163
4163
  c && f(!0);
4164
- }, [c]), $(() => {
4164
+ }, [c]), A(() => {
4165
4165
  d && f(!0);
4166
4166
  }, [d]), e.files.length === 1 && !p) {
4167
- const S = e.files[0], h = n === S, z = l[S], m = z === 0, v = z === "loading", k = typeof z == "number" && z > 0;
4167
+ const S = e.files[0], h = n === S, _ = l[S], m = _ === 0, v = _ === "loading", k = typeof _ == "number" && _ > 0;
4168
4168
  return /* @__PURE__ */ i(
4169
4169
  "button",
4170
4170
  {
@@ -4189,7 +4189,7 @@ function sn({ group: e, activeFile: n, onSelect: o, depth: r = 0, juanMeta: a, m
4189
4189
  },
4190
4190
  children: [
4191
4191
  e.label,
4192
- k && /* @__PURE__ */ t("span", { style: { marginLeft: "5px", fontSize: "11px", fontWeight: 600, color: "#b78900" }, children: z }),
4192
+ k && /* @__PURE__ */ t("span", { style: { marginLeft: "5px", fontSize: "11px", fontWeight: 600, color: "#b78900" }, children: _ }),
4193
4193
  v && /* @__PURE__ */ t("span", { style: { marginLeft: "5px", fontSize: "11px", color: "var(--bim-desc-fg, #aaa)" }, children: "…" })
4194
4194
  ]
4195
4195
  }
@@ -4234,7 +4234,7 @@ function sn({ group: e, activeFile: n, onSelect: o, depth: r = 0, juanMeta: a, m
4234
4234
  ]
4235
4235
  }
4236
4236
  ),
4237
- g && /* @__PURE__ */ i(j, { children: [
4237
+ g && /* @__PURE__ */ i(F, { children: [
4238
4238
  e.files.length > 0 && /* @__PURE__ */ t("div", { style: {
4239
4239
  display: "flex",
4240
4240
  flexWrap: "wrap",
@@ -4279,12 +4279,12 @@ function Po({ type: e }) {
4279
4279
  }, children: e });
4280
4280
  }
4281
4281
  function Mo({ section: e, onNavigate: n, highlightQuery: o = "" }) {
4282
- const { convert: r } = Y(), a = de(), l = me(), c = (S) => {
4282
+ const { convert: r } = N(), a = de(), l = me(), c = (S) => {
4283
4283
  if (!S) return "";
4284
4284
  const h = r(S);
4285
4285
  return o ? Ie(h, o, l) : h;
4286
4286
  }, [s, d] = w(!1), u = !!e.summary, g = !!e.comment, f = !!e.additional_comment, x = !!(e.content && e.content.length > 60), p = u || g || f || x;
4287
- $(() => {
4287
+ A(() => {
4288
4288
  o && d(!0);
4289
4289
  }, [o]);
4290
4290
  const b = !s && x ? e.content.replace(/\n/g, " ").slice(0, 80) + "…" : null;
@@ -4322,7 +4322,7 @@ function Mo({ section: e, onNavigate: n, highlightQuery: o = "" }) {
4322
4322
  fontWeight: 500,
4323
4323
  color: "var(--bim-fg, #1a1a1a)"
4324
4324
  }, children: [
4325
- e.book_title ? /* @__PURE__ */ i(j, { children: [
4325
+ e.book_title ? /* @__PURE__ */ i(F, { children: [
4326
4326
  "《",
4327
4327
  c(e.book_title),
4328
4328
  "》"
@@ -4466,7 +4466,7 @@ function Mo({ section: e, onNavigate: n, highlightQuery: o = "" }) {
4466
4466
  ] });
4467
4467
  }
4468
4468
  function Ho({ section: e, highlightQuery: n = "" }) {
4469
- const { convert: o } = Y(), r = me(), a = (d) => {
4469
+ const { convert: o } = N(), r = me(), a = (d) => {
4470
4470
  if (!d) return "";
4471
4471
  const u = o(d);
4472
4472
  return n ? Ie(u, n, r) : u;
@@ -4517,7 +4517,7 @@ function Ho({ section: e, highlightQuery: n = "" }) {
4517
4517
  ] });
4518
4518
  }
4519
4519
  function Oo({ section: e, highlightQuery: n = "" }) {
4520
- const { convert: o } = Y(), r = me();
4520
+ const { convert: o } = N(), r = me();
4521
4521
  if (!e.content && !e.title) return null;
4522
4522
  const a = o((e.content || e.title || "").replace(/\n{2,}/g, `
4523
4523
  `)), l = n ? Ie(a, n, r) : a, c = at[e.type] || "#717171", s = e.type === "序" || e.type === "结语";
@@ -4550,7 +4550,7 @@ function Oo({ section: e, highlightQuery: n = "" }) {
4550
4550
  }
4551
4551
  function Do(e, n, o) {
4552
4552
  const [r, a] = w({});
4553
- return $(() => {
4553
+ return A(() => {
4554
4554
  var u;
4555
4555
  if (!n || e.length === 0) return;
4556
4556
  let l = !1;
@@ -4592,19 +4592,19 @@ function Do(e, n, o) {
4592
4592
  }, [e.join(","), n]), r;
4593
4593
  }
4594
4594
  function jo({ section: e, onNavigate: n, transport: o, workLabelCache: r, highlightQuery: a = "" }) {
4595
- const { convert: l } = Y(), c = de(), s = me(), d = (m) => {
4595
+ const { convert: l } = N(), c = de(), s = me(), d = (m) => {
4596
4596
  if (!m) return "";
4597
4597
  const v = l(m);
4598
4598
  return a ? Ie(v, a, s) : v;
4599
4599
  }, [u, g] = w(!1);
4600
- $(() => {
4600
+ A(() => {
4601
4601
  a && g(!0);
4602
4602
  }, [a]);
4603
4603
  const f = e.type, x = Wo[f] || "#717171", p = !!e.content, b = e.work_ids || [], S = b.length > 1, h = Do(
4604
4604
  S ? b : [],
4605
4605
  o,
4606
4606
  r
4607
- ), z = p && !u && e.content.length > 80 ? e.content.slice(0, 80) + "……" : null;
4607
+ ), _ = p && !u && e.content.length > 80 ? e.content.slice(0, 80) + "……" : null;
4608
4608
  return /* @__PURE__ */ i("div", { style: {
4609
4609
  borderBottom: "1px solid var(--bim-widget-border, #f0f0f0)",
4610
4610
  padding: "10px 0"
@@ -4637,12 +4637,12 @@ function jo({ section: e, onNavigate: n, transport: o, workLabelCache: r, highli
4637
4637
  color: "var(--bim-fg, #1a1a1a)",
4638
4638
  lineHeight: 1.6
4639
4639
  }, children: e.header_line ? d(e.header_line) : d(e.title) }),
4640
- !u && z && /* @__PURE__ */ t("p", { style: {
4640
+ !u && _ && /* @__PURE__ */ t("p", { style: {
4641
4641
  margin: "4px 0 0",
4642
4642
  fontSize: "12px",
4643
4643
  color: "var(--bim-desc-fg, #aaa)",
4644
4644
  lineHeight: 1.7
4645
- }, children: d(z) })
4645
+ }, children: d(_) })
4646
4646
  ] }),
4647
4647
  /* @__PURE__ */ i("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexShrink: 0 }, children: [
4648
4648
  b.length === 1 && n && /* @__PURE__ */ t(
@@ -4696,8 +4696,8 @@ function jo({ section: e, onNavigate: n, transport: o, workLabelCache: r, highli
4696
4696
  "a",
4697
4697
  {
4698
4698
  href: c(m),
4699
- onClick: (I) => {
4700
- I.metaKey || I.ctrlKey || (I.preventDefault(), I.stopPropagation(), n(m));
4699
+ onClick: (T) => {
4700
+ T.metaKey || T.ctrlKey || (T.preventDefault(), T.stopPropagation(), n(m));
4701
4701
  },
4702
4702
  style: {
4703
4703
  fontSize: "12px",
@@ -4749,7 +4749,7 @@ function Fo({
4749
4749
  transport: r,
4750
4750
  workLabelCache: a
4751
4751
  }) {
4752
- const { convert: l } = Y(), c = me(), s = n.trim(), d = ce(() => s ? e.sections.filter((f) => lt(f, s, !0, c)) : e.sections, [e.sections, s, c]), u = e.sections.filter((f) => f.type === "考证").length, g = d.filter((f) => f.type === "考证").length;
4752
+ const { convert: l } = N(), c = me(), s = n.trim(), d = ce(() => s ? e.sections.filter((f) => lt(f, s, !0, c)) : e.sections, [e.sections, s, c]), u = e.sections.filter((f) => f.type === "考证").length, g = d.filter((f) => f.type === "考证").length;
4753
4753
  return /* @__PURE__ */ i("div", { children: [
4754
4754
  /* @__PURE__ */ i("div", { style: {
4755
4755
  display: "flex",
@@ -4795,7 +4795,7 @@ function Fo({
4795
4795
  ] });
4796
4796
  }
4797
4797
  function Uo({ text: e, highlightQuery: n = "" }) {
4798
- const { convert: o } = Y(), r = me(), a = (c) => {
4798
+ const { convert: o } = N(), r = me(), a = (c) => {
4799
4799
  const s = o(c);
4800
4800
  return n ? Ie(s, n, r) : s;
4801
4801
  }, l = e.split(`
@@ -4816,7 +4816,7 @@ function Uo({ text: e, highlightQuery: n = "" }) {
4816
4816
  }) });
4817
4817
  }
4818
4818
  function Vo({ sections: e, onNavigate: n, highlightQuery: o = "" }) {
4819
- const { convert: r } = Y(), a = de(), l = me(), c = (u) => {
4819
+ const { convert: r } = N(), a = de(), l = me(), c = (u) => {
4820
4820
  if (!u) return "";
4821
4821
  const g = r(u);
4822
4822
  return o ? Ie(g, o, l) : g;
@@ -4852,7 +4852,7 @@ function No({
4852
4852
  searchQuery: o,
4853
4853
  onNavigate: r
4854
4854
  }) {
4855
- const { convert: a } = Y(), l = me(), [c, s] = w("catalog"), d = o.trim(), u = ce(() => d ? e.sections.filter((p) => lt(p, d, !1, l)) : e.sections, [e.sections, d, l]), g = e.sections.filter((p) => p.type === "书").length, f = e.sections.filter((p) => p.type === "詩").length, x = d ? u.filter((p) => p.type === "书" || p.type === "詩").length : null;
4855
+ const { convert: a } = N(), l = me(), [c, s] = w("catalog"), d = o.trim(), u = ce(() => d ? e.sections.filter((p) => lt(p, d, !1, l)) : e.sections, [e.sections, d, l]), g = e.sections.filter((p) => p.type === "书").length, f = e.sections.filter((p) => p.type === "詩").length, x = d ? u.filter((p) => p.type === "书" || p.type === "詩").length : null;
4856
4856
  return /* @__PURE__ */ i("div", { children: [
4857
4857
  /* @__PURE__ */ i("div", { style: {
4858
4858
  display: "flex",
@@ -4907,20 +4907,20 @@ function Ct(e) {
4907
4907
  return n.length > 0 ? n[0] : null;
4908
4908
  }
4909
4909
  function Ko(e) {
4910
- const { workId: n, transport: o, files: r, activeFile: a, activeJuan: l, activeRawText: c, query: s, isKaozhen: d } = e, u = me(), g = Q(/* @__PURE__ */ new Map()), [f, x] = w({});
4911
- $(() => {
4910
+ const { workId: n, transport: o, files: r, activeFile: a, activeJuan: l, activeRawText: c, query: s, isKaozhen: d } = e, u = me(), g = q(/* @__PURE__ */ new Map()), [f, x] = w({});
4911
+ A(() => {
4912
4912
  a && l && g.current.set(a, { juan: l, rawText: c });
4913
- }, [a, l, c]), $(() => {
4913
+ }, [a, l, c]), A(() => {
4914
4914
  g.current.clear(), x({});
4915
4915
  }, [n]);
4916
- const p = F((b, S) => {
4916
+ const p = U((b, S) => {
4917
4917
  let h = 0;
4918
4918
  if (b.juan)
4919
- for (const z of b.juan.sections)
4920
- lt(z, S, d, u) && h++;
4919
+ for (const _ of b.juan.sections)
4920
+ lt(_, S, d, u) && h++;
4921
4921
  return h === 0 && b.rawText && Bo(b.rawText, S, u) && (h = 1), h;
4922
4922
  }, [d, u]);
4923
- return $(() => {
4923
+ return A(() => {
4924
4924
  const b = s.trim();
4925
4925
  if (!b) {
4926
4926
  x({});
@@ -4928,33 +4928,33 @@ function Ko(e) {
4928
4928
  }
4929
4929
  if (!n || !(o != null && o.getCollatedJuan) || r.length === 0) return;
4930
4930
  let S = !1;
4931
- const h = {}, z = [];
4932
- for (const _ of r) {
4933
- const y = g.current.get(_);
4934
- y ? h[_] = p(y, b) : (h[_] = "loading", z.push(_));
4931
+ const h = {}, _ = [];
4932
+ for (const z of r) {
4933
+ const y = g.current.get(z);
4934
+ y ? h[z] = p(y, b) : (h[z] = "loading", _.push(z));
4935
4935
  }
4936
4936
  x(h);
4937
4937
  const m = 8;
4938
4938
  let v = 0;
4939
4939
  const k = async () => {
4940
- var _;
4941
- for (; v < z.length; ) {
4940
+ var z;
4941
+ for (; v < _.length; ) {
4942
4942
  if (S) return;
4943
- const y = v++, B = z[y];
4943
+ const y = v++, B = _[y];
4944
4944
  try {
4945
4945
  const [W, E] = await Promise.all([
4946
4946
  o.getCollatedJuan(n, B),
4947
- ((_ = o.getCollatedJuanText) == null ? void 0 : _.call(o, n, B)) ?? Promise.resolve(null)
4948
- ]), O = { juan: W, rawText: E };
4949
- if (g.current.set(B, O), S) return;
4950
- x((A) => ({ ...A, [B]: p(O, b) }));
4947
+ ((z = o.getCollatedJuanText) == null ? void 0 : z.call(o, n, B)) ?? Promise.resolve(null)
4948
+ ]), H = { juan: W, rawText: E };
4949
+ if (g.current.set(B, H), S) return;
4950
+ x((K) => ({ ...K, [B]: p(H, b) }));
4951
4951
  } catch {
4952
4952
  if (S) return;
4953
4953
  x((W) => ({ ...W, [B]: 0 }));
4954
4954
  }
4955
4955
  }
4956
- }, I = Array.from({ length: Math.min(m, z.length) }, () => k());
4957
- return Promise.all(I), () => {
4956
+ }, T = Array.from({ length: Math.min(m, _.length) }, () => k());
4957
+ return Promise.all(T), () => {
4958
4958
  S = !0;
4959
4959
  };
4960
4960
  }, [s, n, o, r.join(","), p, u]), { matchStates: f };
@@ -4969,16 +4969,16 @@ const Yo = ({
4969
4969
  className: c,
4970
4970
  style: s
4971
4971
  }) => {
4972
- const [d, u] = w(null), [g, f] = w(!1), [x, p] = w(null), [b, S] = w(null), [h, z] = w(null), [m, v] = w(!1), [k, I] = w(null), [_, y] = w(""), B = Q(/* @__PURE__ */ new Map()), W = a ?? b, E = F((C) => {
4973
- S(C), l == null || l(C);
4974
- }, [l]), O = e || d;
4975
- $(() => {
4972
+ const [d, u] = w(null), [g, f] = w(!1), [x, p] = w(null), [b, S] = w(null), [h, _] = w(null), [m, v] = w(!1), [k, T] = w(null), [z, y] = w(""), B = q(/* @__PURE__ */ new Map()), W = a ?? b, E = U((I) => {
4973
+ S(I), l == null || l(I);
4974
+ }, [l]), H = e || d;
4975
+ A(() => {
4976
4976
  e && (f(!1), p(null));
4977
- }, [e]), $(() => {
4977
+ }, [e]), A(() => {
4978
4978
  if (e || !n || !(o != null && o.getCollatedEditionIndex)) return;
4979
- let C = !1;
4979
+ let I = !1;
4980
4980
  return f(!0), p(null), o.getCollatedEditionIndex(n).then((R) => {
4981
- if (!C)
4981
+ if (!I)
4982
4982
  if (!R)
4983
4983
  p("未找到整理本数据");
4984
4984
  else {
@@ -4987,41 +4987,41 @@ const Yo = ({
4987
4987
  !a && P && E(P);
4988
4988
  }
4989
4989
  }).catch((R) => {
4990
- C || p(R instanceof Error ? R.message : "加载失败");
4990
+ I || p(R instanceof Error ? R.message : "加载失败");
4991
4991
  }).finally(() => {
4992
- C || f(!1);
4992
+ I || f(!1);
4993
4993
  }), () => {
4994
- C = !0;
4994
+ I = !0;
4995
4995
  };
4996
- }, [e, n, o, a, E]), $(() => {
4997
- const C = e || d;
4998
- if (C && !W) {
4999
- const R = Ct(C);
4996
+ }, [e, n, o, a, E]), A(() => {
4997
+ const I = e || d;
4998
+ if (I && !W) {
4999
+ const R = Ct(I);
5000
5000
  R && E(R);
5001
5001
  }
5002
5002
  }, [e, d, W, E]);
5003
- const A = n || (O == null ? void 0 : O.work_id), N = F(async (C) => {
5003
+ const K = n || (H == null ? void 0 : H.work_id), J = U(async (I) => {
5004
5004
  var R;
5005
- if (!(!A || !(o != null && o.getCollatedJuan))) {
5006
- v(!0), z(null), I(null);
5005
+ if (!(!K || !(o != null && o.getCollatedJuan))) {
5006
+ v(!0), _(null), T(null);
5007
5007
  try {
5008
- const [P, J] = await Promise.all([
5009
- o.getCollatedJuan(A, C),
5010
- ((R = o.getCollatedJuanText) == null ? void 0 : R.call(o, A, C)) ?? Promise.resolve(null)
5008
+ const [P, $] = await Promise.all([
5009
+ o.getCollatedJuan(K, I),
5010
+ ((R = o.getCollatedJuanText) == null ? void 0 : R.call(o, K, I)) ?? Promise.resolve(null)
5011
5011
  ]);
5012
- z(P), I(J);
5012
+ _(P), T($);
5013
5013
  } catch {
5014
- z(null), I(null);
5014
+ _(null), T(null);
5015
5015
  } finally {
5016
5016
  v(!1);
5017
5017
  }
5018
5018
  }
5019
- }, [A, o]);
5020
- $(() => {
5021
- W && N(W);
5022
- }, [W, N]);
5023
- const U = (C) => {
5024
- E(C);
5019
+ }, [K, o]);
5020
+ A(() => {
5021
+ W && J(W);
5022
+ }, [W, J]);
5023
+ const Y = (I) => {
5024
+ E(I);
5025
5025
  };
5026
5026
  if (g)
5027
5027
  return /* @__PURE__ */ t("div", { className: c, style: { ...s, padding: "24px" }, children: /* @__PURE__ */ t("div", { style: { color: "var(--bim-desc-fg, #717171)", fontSize: "13px" }, children: "加载整理本..." }) });
@@ -5033,24 +5033,24 @@ const Yo = ({
5033
5033
  color: "var(--bim-desc-fg, #717171)",
5034
5034
  fontSize: "13px"
5035
5035
  }, children: x });
5036
- if (!O) return null;
5037
- const T = O.type === "kaozhen", D = dn(O);
5036
+ if (!H) return null;
5037
+ const C = H.type === "kaozhen", M = dn(H);
5038
5038
  return /* @__PURE__ */ t(
5039
5039
  Go,
5040
5040
  {
5041
5041
  className: c,
5042
5042
  style: s,
5043
- index: O,
5044
- allFiles: D,
5045
- isKaozhen: T,
5046
- effectiveWorkId: A,
5043
+ index: H,
5044
+ allFiles: M,
5045
+ isKaozhen: C,
5046
+ effectiveWorkId: K,
5047
5047
  transport: o,
5048
5048
  activeFile: W,
5049
- handleSelectFile: U,
5049
+ handleSelectFile: Y,
5050
5050
  juanData: h,
5051
5051
  juanRawText: k,
5052
5052
  juanLoading: m,
5053
- searchQuery: _,
5053
+ searchQuery: z,
5054
5054
  setSearchQuery: y,
5055
5055
  onNavigate: r,
5056
5056
  workLabelCacheRef: B
@@ -5091,7 +5091,7 @@ const Yo = ({
5091
5091
  type: "text",
5092
5092
  placeholder: a ? "搜索全部章节(条目、考证内容)..." : "搜索全部册(书名、作者、正文)...",
5093
5093
  value: x,
5094
- onChange: (z) => p(z.target.value),
5094
+ onChange: (_) => p(_.target.value),
5095
5095
  style: {
5096
5096
  width: "100%",
5097
5097
  maxWidth: "420px",
@@ -5106,7 +5106,7 @@ const Yo = ({
5106
5106
  }
5107
5107
  ) }),
5108
5108
  /* @__PURE__ */ i("div", { style: { marginBottom: "16px", display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: "13px", color: "var(--bim-desc-fg, #717171)" }, children: [
5109
- /* @__PURE__ */ t("div", { children: a ? /* @__PURE__ */ i(j, { children: [
5109
+ /* @__PURE__ */ t("div", { children: a ? /* @__PURE__ */ i(F, { children: [
5110
5110
  o.target_source && /* @__PURE__ */ i("span", { children: [
5111
5111
  "考證對象:",
5112
5112
  /* @__PURE__ */ t("strong", { style: { color: "var(--bim-fg, #333)" }, children: o.target_source }),
@@ -5121,10 +5121,10 @@ const Yo = ({
5121
5121
  " 卷"
5122
5122
  ] }) }),
5123
5123
  o.text_quality && (() => {
5124
- const z = Co(o.text_quality.grade);
5125
- return z ? /* @__PURE__ */ i("div", { style: { fontSize: "12px", display: "flex", alignItems: "center", gap: "4px" }, children: [
5124
+ const _ = Co(o.text_quality.grade);
5125
+ return _ ? /* @__PURE__ */ i("div", { style: { fontSize: "12px", display: "flex", alignItems: "center", gap: "4px" }, children: [
5126
5126
  /* @__PURE__ */ t("span", { children: "文本質量:" }),
5127
- /* @__PURE__ */ t(zo, { content: mn[z], children: /* @__PURE__ */ t(
5127
+ /* @__PURE__ */ t(zo, { content: mn[_], children: /* @__PURE__ */ t(
5128
5128
  "span",
5129
5129
  {
5130
5130
  style: {
@@ -5136,10 +5136,10 @@ const Yo = ({
5136
5136
  fontWeight: 600,
5137
5137
  fontSize: "12px",
5138
5138
  color: "#fff",
5139
- background: yn[z],
5139
+ background: yn[_],
5140
5140
  cursor: "help"
5141
5141
  },
5142
- children: Yt[z]
5142
+ children: Yt[_]
5143
5143
  }
5144
5144
  ) }),
5145
5145
  o.text_quality.source_note && /* @__PURE__ */ i("span", { style: { marginLeft: "4px" }, children: [
@@ -5195,7 +5195,7 @@ const Yo = ({
5195
5195
  marginBottom: "8px",
5196
5196
  letterSpacing: "2px"
5197
5197
  }, children: "參考文獻" }),
5198
- o.references.map((z, m) => /* @__PURE__ */ i("div", { style: {
5198
+ o.references.map((_, m) => /* @__PURE__ */ i("div", { style: {
5199
5199
  fontSize: "12px",
5200
5200
  color: "var(--bim-desc-fg, #999)",
5201
5201
  lineHeight: 1.8,
@@ -5205,10 +5205,10 @@ const Yo = ({
5205
5205
  m + 1,
5206
5206
  ". "
5207
5207
  ] }),
5208
- z.url ? /* @__PURE__ */ t(
5208
+ _.url ? /* @__PURE__ */ t(
5209
5209
  "a",
5210
5210
  {
5211
- href: z.url,
5211
+ href: _.url,
5212
5212
  target: "_blank",
5213
5213
  rel: "noopener noreferrer",
5214
5214
  style: {
@@ -5217,16 +5217,16 @@ const Yo = ({
5217
5217
  textDecorationColor: "var(--bim-widget-border, #ddd)",
5218
5218
  textUnderlineOffset: "2px"
5219
5219
  },
5220
- children: z.title
5220
+ children: _.title
5221
5221
  }
5222
- ) : /* @__PURE__ */ t("span", { children: z.title }),
5223
- z.author && /* @__PURE__ */ i("span", { children: [
5222
+ ) : /* @__PURE__ */ t("span", { children: _.title }),
5223
+ _.author && /* @__PURE__ */ i("span", { children: [
5224
5224
  ",",
5225
- z.author
5225
+ _.author
5226
5226
  ] }),
5227
- z.note && /* @__PURE__ */ i("span", { children: [
5227
+ _.note && /* @__PURE__ */ i("span", { children: [
5228
5228
  "。",
5229
- z.note
5229
+ _.note
5230
5230
  ] })
5231
5231
  ] }, m))
5232
5232
  ] })
@@ -5328,120 +5328,146 @@ const Xo = ({ items: e, loading: n }) => {
5328
5328
  onTabChange: a,
5329
5329
  feedbackApiUrl: l
5330
5330
  }) => {
5331
- const c = H(), [s, d] = w(null), [u, g] = w([]), [f, x] = w("recommend"), [p, b] = w([]), [S, h] = w(!1), z = r ?? f, m = (A) => {
5332
- x(A), a == null || a(A);
5333
- }, [v, k] = w(!0), [I, _] = w(null), [y, B] = w(null), [W, E] = w(null);
5334
- $(() => {
5335
- let A = !1;
5336
- const N = (T) => {
5337
- A || d(T);
5338
- }, U = () => {
5339
- e.getAllEntries && e.getAllEntries().then((T) => {
5340
- N({
5341
- works: T.filter((D) => D.type === "work").length,
5342
- books: T.filter((D) => D.type === "book").length,
5343
- collections: T.filter((D) => D.type === "collection").length
5331
+ const c = D(), [s, d] = w(null), [u, g] = w([]), [f, x] = w("recommend"), [p, b] = w([]), [S, h] = w(!1), _ = r ?? f, m = (C) => {
5332
+ x(C), a == null || a(C);
5333
+ }, [v, k] = w(!0), [T, z] = w(null), [y, B] = w(null), [W, E] = w(null);
5334
+ A(() => {
5335
+ let C = !1;
5336
+ const M = (R) => {
5337
+ C || d(R);
5338
+ }, I = () => {
5339
+ e.getAllEntries && e.getAllEntries().then((R) => {
5340
+ M({
5341
+ works: R.filter((P) => P.type === "work").length,
5342
+ books: R.filter((P) => P.type === "book").length,
5343
+ collections: R.filter((P) => P.type === "collection").length
5344
5344
  });
5345
5345
  }).catch(() => {
5346
5346
  });
5347
5347
  };
5348
- return e.getCounts ? e.getCounts().then((T) => N({ works: T.works, books: T.books, collections: T.collections })).catch(U) : U(), () => {
5349
- A = !0;
5348
+ return e.getCounts ? e.getCounts().then((R) => M({ works: R.works, books: R.books, collections: R.collections })).catch(I) : I(), () => {
5349
+ C = !0;
5350
5350
  };
5351
- }, [e]), $(() => {
5352
- let A = !1;
5351
+ }, [e]), A(() => {
5352
+ let C = !1;
5353
5353
  return (async () => {
5354
5354
  if (o) return o;
5355
5355
  if (e.getRecommended)
5356
5356
  try {
5357
- const U = await e.getRecommended();
5358
- if (U != null && U.groups)
5359
- return U.groups.flatMap(
5360
- (T) => T.items.map((D) => ({ ...D, group: T.name }))
5357
+ const I = await e.getRecommended();
5358
+ if (I != null && I.groups)
5359
+ return I.groups.flatMap(
5360
+ (R) => R.items.map((P) => ({ ...P, group: R.name }))
5361
5361
  );
5362
5362
  } catch {
5363
5363
  }
5364
5364
  return [];
5365
- })().then(async (U) => {
5366
- if (A) return;
5367
- const T = U.filter((C) => C.id);
5368
- if (T.length === 0) {
5365
+ })().then(async (I) => {
5366
+ if (C) return;
5367
+ const R = I.filter(($) => $.id);
5368
+ if (R.length === 0) {
5369
5369
  k(!1);
5370
5370
  return;
5371
5371
  }
5372
- const D = await Promise.all(
5373
- T.map(async (C) => {
5372
+ const P = await Promise.all(
5373
+ R.map(async ($) => {
5374
+ if ($.type)
5375
+ return {
5376
+ id: $.id,
5377
+ title: $.title,
5378
+ type: $.type,
5379
+ author: $.author,
5380
+ dynasty: $.dynasty,
5381
+ role: $.role,
5382
+ edition: $.edition,
5383
+ has_text: $.has_text,
5384
+ has_image: $.has_image,
5385
+ has_collated: $.has_collated,
5386
+ subtype: $.subtype,
5387
+ primary_name: $.primary_name,
5388
+ group: $.group,
5389
+ fallbackDescription: $.description
5390
+ };
5374
5391
  try {
5375
- let R = null;
5392
+ let j = null;
5376
5393
  if (e.getEntry)
5377
- R = await e.getEntry(C.id);
5394
+ j = await e.getEntry($.id);
5378
5395
  else {
5379
- const P = await e.getItem(C.id);
5380
- P && (R = {
5381
- id: C.id,
5382
- title: P.title || C.id,
5383
- type: P.type || "work"
5396
+ const Z = await e.getItem($.id);
5397
+ Z && (j = {
5398
+ id: $.id,
5399
+ title: Z.title || $.id,
5400
+ type: Z.type || "work"
5384
5401
  });
5385
5402
  }
5386
- if (R)
5387
- return { ...R, group: C.group, fallbackDescription: C.description };
5403
+ if (j)
5404
+ return { ...j, group: $.group, fallbackDescription: $.description };
5388
5405
  } catch {
5389
5406
  }
5390
5407
  return {
5391
- id: C.id,
5392
- title: C.title,
5393
- type: gn(C.id),
5394
- group: C.group,
5395
- fallbackDescription: C.description
5408
+ id: $.id,
5409
+ title: $.title,
5410
+ type: gn($.id),
5411
+ group: $.group,
5412
+ fallbackDescription: $.description
5396
5413
  };
5397
5414
  })
5398
5415
  );
5399
- A || (g(D.filter((C) => C !== null)), k(!1));
5416
+ C || (g(P.filter(($) => $ !== null)), k(!1));
5400
5417
  }), () => {
5401
- A = !0;
5418
+ C = !0;
5402
5419
  };
5403
- }, [e, o]), $(() => {
5404
- let A = !1;
5405
- const N = e.getCatalogProgress ?? e.getResourceProgress;
5406
- if (N)
5407
- return N.call(e).then((U) => {
5408
- A || _(U);
5409
- }).catch(() => {
5410
- }), () => {
5411
- A = !0;
5412
- };
5413
- }, [e]), $(() => {
5414
- if (!e.getCollectionProgress) return;
5415
- let A = !1;
5416
- return e.getCollectionProgress().then((N) => {
5417
- A || B(N);
5420
+ }, [e, o]);
5421
+ const H = q(!1), K = q(!1), J = q(!1);
5422
+ A(() => {
5423
+ if (_ !== "catalog" || H.current) return;
5424
+ const C = e.getCatalogProgress ?? e.getResourceProgress;
5425
+ if (!C) return;
5426
+ H.current = !0;
5427
+ let M = !1;
5428
+ return C.call(e).then((I) => {
5429
+ M || z(I);
5430
+ }).catch(() => {
5431
+ H.current = !1;
5432
+ }), () => {
5433
+ M = !0;
5434
+ };
5435
+ }, [e, _]), A(() => {
5436
+ if (_ !== "collection" || K.current || !e.getCollectionProgress) return;
5437
+ K.current = !0;
5438
+ let C = !1;
5439
+ return e.getCollectionProgress().then((M) => {
5440
+ C || B(M);
5418
5441
  }).catch(() => {
5442
+ K.current = !1;
5419
5443
  }), () => {
5420
- A = !0;
5444
+ C = !0;
5421
5445
  };
5422
- }, [e]), $(() => {
5423
- if (!e.getSiteProgress) return;
5424
- let A = !1;
5425
- return e.getSiteProgress().then((N) => {
5426
- A || E(N);
5446
+ }, [e, _]), A(() => {
5447
+ if (_ !== "site" || J.current || !e.getSiteProgress) return;
5448
+ J.current = !0;
5449
+ let C = !1;
5450
+ return e.getSiteProgress().then((M) => {
5451
+ C || E(M);
5427
5452
  }).catch(() => {
5453
+ J.current = !1;
5428
5454
  }), () => {
5429
- A = !0;
5455
+ C = !0;
5430
5456
  };
5431
- }, [e]), $(() => {
5432
- if (!l || z !== "feedback") return;
5433
- let A = !1;
5434
- return h(!0), fetch(l).then((N) => N.json()).then((N) => {
5435
- !A && N.success && b(N.items || []);
5457
+ }, [e, _]), A(() => {
5458
+ if (!l || _ !== "feedback") return;
5459
+ let C = !1;
5460
+ return h(!0), fetch(l).then((M) => M.json()).then((M) => {
5461
+ !C && M.success && b(M.items || []);
5436
5462
  }).catch(() => {
5437
5463
  }).finally(() => {
5438
- A || h(!1);
5464
+ C || h(!1);
5439
5465
  }), () => {
5440
- A = !0;
5466
+ C = !0;
5441
5467
  };
5442
- }, [l, z]);
5443
- const O = (A) => {
5444
- switch (A) {
5468
+ }, [l, _]);
5469
+ const Y = (C) => {
5470
+ switch (C) {
5445
5471
  case "work":
5446
5472
  return "✍️";
5447
5473
  case "book":
@@ -5471,7 +5497,7 @@ const Xo = ({ items: e, loading: n }) => {
5471
5497
  We,
5472
5498
  {
5473
5499
  label: c.home.recommendTab,
5474
- active: z === "recommend",
5500
+ active: _ === "recommend",
5475
5501
  onClick: () => m("recommend")
5476
5502
  }
5477
5503
  ),
@@ -5479,7 +5505,7 @@ const Xo = ({ items: e, loading: n }) => {
5479
5505
  We,
5480
5506
  {
5481
5507
  label: c.home.catalogTab,
5482
- active: z === "catalog",
5508
+ active: _ === "catalog",
5483
5509
  onClick: () => m("catalog")
5484
5510
  }
5485
5511
  ),
@@ -5487,7 +5513,7 @@ const Xo = ({ items: e, loading: n }) => {
5487
5513
  We,
5488
5514
  {
5489
5515
  label: c.home.collectionTab,
5490
- active: z === "collection",
5516
+ active: _ === "collection",
5491
5517
  onClick: () => m("collection")
5492
5518
  }
5493
5519
  ),
@@ -5495,7 +5521,7 @@ const Xo = ({ items: e, loading: n }) => {
5495
5521
  We,
5496
5522
  {
5497
5523
  label: c.home.siteTab,
5498
- active: z === "site",
5524
+ active: _ === "site",
5499
5525
  onClick: () => m("site")
5500
5526
  }
5501
5527
  ),
@@ -5503,25 +5529,25 @@ const Xo = ({ items: e, loading: n }) => {
5503
5529
  We,
5504
5530
  {
5505
5531
  label: c.home.feedbackTab,
5506
- active: z === "feedback",
5532
+ active: _ === "feedback",
5507
5533
  onClick: () => m("feedback")
5508
5534
  }
5509
5535
  )
5510
5536
  ] }),
5511
- z === "recommend" && /* @__PURE__ */ t(
5537
+ _ === "recommend" && /* @__PURE__ */ t(
5512
5538
  ar,
5513
5539
  {
5514
5540
  recommended: u,
5515
5541
  loading: v,
5516
5542
  onNavigate: n,
5517
- getIcon: O,
5543
+ getIcon: Y,
5518
5544
  t: c
5519
5545
  }
5520
5546
  ),
5521
- z === "catalog" && /* @__PURE__ */ t(Lt, { progress: I, t: c, onNavigate: n }),
5522
- z === "collection" && /* @__PURE__ */ t(Lt, { progress: y, t: c, onNavigate: n }),
5523
- z === "site" && /* @__PURE__ */ t(sr, { progress: W, t: c, totalWorks: (s == null ? void 0 : s.works) ?? 0 }),
5524
- z === "feedback" && l && /* @__PURE__ */ t(Xo, { items: p, loading: S })
5547
+ _ === "catalog" && /* @__PURE__ */ t(Lt, { progress: T, t: c, onNavigate: n }),
5548
+ _ === "collection" && /* @__PURE__ */ t(Lt, { progress: y, t: c, onNavigate: n }),
5549
+ _ === "site" && /* @__PURE__ */ t(sr, { progress: W, t: c, totalWorks: (s == null ? void 0 : s.works) ?? 0 }),
5550
+ _ === "feedback" && l && /* @__PURE__ */ t(Xo, { items: p, loading: S })
5525
5551
  ] }) });
5526
5552
  }, We = ({ label: e, active: n, onClick: o }) => /* @__PURE__ */ t(
5527
5553
  "button",
@@ -5550,7 +5576,7 @@ const Xo = ({ items: e, loading: n }) => {
5550
5576
  const d = s.group || a.home.recommendedBrowse;
5551
5577
  c.has(d) || c.set(d, []), c.get(d).push(s);
5552
5578
  }
5553
- return /* @__PURE__ */ t(j, { children: Array.from(c.entries()).map(([s, d]) => /* @__PURE__ */ i("div", { style: { marginBottom: "20px" }, children: [
5579
+ return /* @__PURE__ */ t(F, { children: Array.from(c.entries()).map(([s, d]) => /* @__PURE__ */ i("div", { style: { marginBottom: "20px" }, children: [
5554
5580
  /* @__PURE__ */ t("div", { style: {
5555
5581
  fontSize: "13px",
5556
5582
  fontWeight: 500,
@@ -5779,7 +5805,7 @@ const Xo = ({ items: e, loading: n }) => {
5779
5805
  }, Wt = "(max-width: 768px)";
5780
5806
  function dr() {
5781
5807
  const [e, n] = w(() => typeof window > "u" ? !1 : window.matchMedia(Wt).matches);
5782
- return $(() => {
5808
+ return A(() => {
5783
5809
  const o = window.matchMedia(Wt), r = (a) => n(a.matches);
5784
5810
  return o.addEventListener("change", r), () => o.removeEventListener("change", r);
5785
5811
  }, []), e;
@@ -5791,72 +5817,72 @@ const _i = ({
5791
5817
  recommendedIds: r,
5792
5818
  headerRight: a
5793
5819
  }) => {
5794
- var D;
5795
- const l = H(), { convert: c } = Y(), s = dr(), [d, u] = w(null), [g, f] = w(null), [x, p] = w(!1), [b, S] = w("detail"), [h, z] = w([]), [m, v] = w(!1), [k, I] = w(null), [_, y] = w(!1), B = F(async (C) => {
5820
+ var M;
5821
+ const l = D(), { convert: c } = N(), s = dr(), [d, u] = w(null), [g, f] = w(null), [x, p] = w(!1), [b, S] = w("detail"), [h, _] = w([]), [m, v] = w(!1), [k, T] = w(null), [z, y] = w(!1), B = U(async (I) => {
5796
5822
  if (!e.getCollatedEditionIndex) {
5797
- I(null);
5823
+ T(null);
5798
5824
  return;
5799
5825
  }
5800
5826
  y(!0);
5801
5827
  try {
5802
- const R = await e.getCollatedEditionIndex(C);
5803
- I(R);
5828
+ const R = await e.getCollatedEditionIndex(I);
5829
+ T(R);
5804
5830
  } catch {
5805
- I(null);
5831
+ T(null);
5806
5832
  } finally {
5807
5833
  y(!1);
5808
5834
  }
5809
- }, [e]), W = F(async (C) => {
5835
+ }, [e]), W = U(async (I) => {
5810
5836
  if (!e.getCollectionCatalogs && !e.getCollectionCatalog) {
5811
- z([]);
5837
+ _([]);
5812
5838
  return;
5813
5839
  }
5814
5840
  v(!0);
5815
5841
  try {
5816
5842
  if (e.getCollectionCatalogs) {
5817
- const R = await e.getCollectionCatalogs(C);
5818
- z(R || []);
5843
+ const R = await e.getCollectionCatalogs(I);
5844
+ _(R || []);
5819
5845
  } else if (e.getCollectionCatalog) {
5820
- const R = await e.getCollectionCatalog(C);
5821
- z(R ? [{ resource_id: "", data: R }] : []);
5846
+ const R = await e.getCollectionCatalog(I);
5847
+ _(R ? [{ resource_id: "", data: R }] : []);
5822
5848
  }
5823
5849
  } catch {
5824
- z([]);
5850
+ _([]);
5825
5851
  } finally {
5826
5852
  v(!1);
5827
5853
  }
5828
- }, [e]), E = F(async (C) => {
5854
+ }, [e]), E = U(async (I) => {
5829
5855
  if (o) {
5830
- o(C);
5856
+ o(I);
5831
5857
  return;
5832
5858
  }
5833
- u(C), f(null), z([]), I(null), S("detail"), p(!0);
5859
+ u(I), f(null), _([]), T(null), S("detail"), p(!0);
5834
5860
  try {
5835
- const R = await e.getItem(C.id);
5836
- R && (f(R), R.type === "collection" ? W(C.id) : R.type === "work" && R.has_collated && B(C.id));
5861
+ const R = await e.getItem(I.id);
5862
+ R && (f(R), R.type === "collection" ? W(I.id) : R.type === "work" && R.has_collated && B(I.id));
5837
5863
  } catch (R) {
5838
5864
  console.error("加载详情失败:", R);
5839
5865
  } finally {
5840
5866
  p(!1);
5841
5867
  }
5842
- }, [e, o, W, B]), O = F(async (C) => {
5843
- f(null), z([]), I(null), S("detail"), p(!0);
5868
+ }, [e, o, W, B]), H = U(async (I) => {
5869
+ f(null), _([]), T(null), S("detail"), p(!0);
5844
5870
  try {
5845
- const R = await e.getItem(C);
5871
+ const R = await e.getItem(I);
5846
5872
  R && (f(R), u({
5847
- id: C,
5848
- title: R.title || C,
5873
+ id: I,
5874
+ title: R.title || I,
5849
5875
  type: R.type || "book"
5850
- }), R.type === "collection" ? W(C) : R.type === "work" && R.has_collated && B(C));
5876
+ }), R.type === "collection" ? W(I) : R.type === "work" && R.has_collated && B(I));
5851
5877
  } catch (R) {
5852
5878
  console.error("导航失败:", R);
5853
5879
  } finally {
5854
5880
  p(!1);
5855
5881
  }
5856
- }, [e, W, B]), A = (g == null ? void 0 : g.type) === "collection" && (h.length > 0 || m) || (g == null ? void 0 : g.type) === "work" && (k || _), N = s && (x || g), U = F(() => {
5857
- u(null), f(null), z([]), I(null), S("detail");
5858
- }, []), T = /* @__PURE__ */ t(j, { children: x ? /* @__PURE__ */ t(Se, {}) : g ? /* @__PURE__ */ i(j, { children: [
5859
- (A || a) && /* @__PURE__ */ i("div", { style: {
5882
+ }, [e, W, B]), K = (g == null ? void 0 : g.type) === "collection" && (h.length > 0 || m) || (g == null ? void 0 : g.type) === "work" && (k || z), J = s && (x || g), Y = U(() => {
5883
+ u(null), f(null), _([]), T(null), S("detail");
5884
+ }, []), C = /* @__PURE__ */ t(F, { children: x ? /* @__PURE__ */ t(Se, {}) : g ? /* @__PURE__ */ i(F, { children: [
5885
+ (K || a) && /* @__PURE__ */ i("div", { style: {
5860
5886
  display: "flex",
5861
5887
  alignItems: "center",
5862
5888
  borderBottom: "1px solid var(--bim-widget-border, #e0e0e0)",
@@ -5865,7 +5891,7 @@ const _i = ({
5865
5891
  flexShrink: 0,
5866
5892
  overflowX: s ? "auto" : void 0
5867
5893
  }, children: [
5868
- A && /* @__PURE__ */ i(j, { children: [
5894
+ K && /* @__PURE__ */ i(F, { children: [
5869
5895
  /* @__PURE__ */ t(
5870
5896
  "button",
5871
5897
  {
@@ -5886,23 +5912,23 @@ const _i = ({
5886
5912
  ]
5887
5913
  }
5888
5914
  ),
5889
- g.type === "collection" && h.map((C) => /* @__PURE__ */ t(
5915
+ g.type === "collection" && h.map((I) => /* @__PURE__ */ t(
5890
5916
  "button",
5891
5917
  {
5892
- onClick: () => S(`catalog:${C.resource_id}`),
5893
- style: je(b === `catalog:${C.resource_id}`),
5894
- children: C.short_name ? `${c(C.short_name)}${l.detailTab.catalogSuffix}` : l.detailTab.collectionCatalog
5918
+ onClick: () => S(`catalog:${I.resource_id}`),
5919
+ style: je(b === `catalog:${I.resource_id}`),
5920
+ children: I.short_name ? `${c(I.short_name)}${l.detailTab.catalogSuffix}` : l.detailTab.collectionCatalog
5895
5921
  },
5896
- C.resource_id
5922
+ I.resource_id
5897
5923
  )),
5898
- g.type === "work" && (k || _) && /* @__PURE__ */ i(
5924
+ g.type === "work" && (k || z) && /* @__PURE__ */ i(
5899
5925
  "button",
5900
5926
  {
5901
5927
  onClick: () => S("collated"),
5902
5928
  style: je(b === "collated"),
5903
5929
  children: [
5904
5930
  l.detailTab.collatedEdition,
5905
- _ && /* @__PURE__ */ t("span", { style: { marginLeft: "4px", fontSize: "11px", opacity: 0.6 }, children: "..." })
5931
+ z && /* @__PURE__ */ t("span", { style: { marginLeft: "4px", fontSize: "11px", opacity: 0.6 }, children: "..." })
5906
5932
  ]
5907
5933
  }
5908
5934
  )
@@ -5914,13 +5940,13 @@ const _i = ({
5914
5940
  {
5915
5941
  data: g,
5916
5942
  transport: e,
5917
- onNavigate: O
5943
+ onNavigate: H
5918
5944
  }
5919
5945
  ) : b.startsWith("catalog:") ? /* @__PURE__ */ t(
5920
5946
  _o,
5921
5947
  {
5922
- data: (D = h.find((C) => `catalog:${C.resource_id}` === b)) == null ? void 0 : D.data,
5923
- onNavigate: O
5948
+ data: (M = h.find((I) => `catalog:${I.resource_id}` === b)) == null ? void 0 : M.data,
5949
+ onNavigate: H
5924
5950
  }
5925
5951
  ) : b === "collated" ? /* @__PURE__ */ t(
5926
5952
  Yo,
@@ -5928,14 +5954,14 @@ const _i = ({
5928
5954
  index: k || void 0,
5929
5955
  workId: g.id,
5930
5956
  transport: e,
5931
- onNavigate: O
5957
+ onNavigate: H
5932
5958
  }
5933
5959
  ) : null })
5934
5960
  ] }) : /* @__PURE__ */ t(
5935
5961
  Rt,
5936
5962
  {
5937
5963
  transport: e,
5938
- onNavigate: O,
5964
+ onNavigate: H,
5939
5965
  recommendedIds: r
5940
5966
  }
5941
5967
  ) });
@@ -5946,7 +5972,7 @@ const _i = ({
5946
5972
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif',
5947
5973
  background: "var(--bim-bg, #f5f5f5)",
5948
5974
  color: "var(--bim-fg, #333)"
5949
- }, children: N ? /* @__PURE__ */ i(j, { children: [
5975
+ }, children: J ? /* @__PURE__ */ i(F, { children: [
5950
5976
  /* @__PURE__ */ t("div", { style: {
5951
5977
  padding: "8px 12px",
5952
5978
  borderBottom: "1px solid var(--bim-widget-border, #e0e0e0)",
@@ -5955,7 +5981,7 @@ const _i = ({
5955
5981
  }, children: /* @__PURE__ */ i(
5956
5982
  "button",
5957
5983
  {
5958
- onClick: U,
5984
+ onClick: Y,
5959
5985
  style: {
5960
5986
  padding: "4px 12px",
5961
5987
  border: "1px solid var(--bim-widget-border, #e0e0e0)",
@@ -5971,7 +5997,7 @@ const _i = ({
5971
5997
  ]
5972
5998
  }
5973
5999
  ) }),
5974
- /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", display: "flex", flexDirection: "column" }, children: T })
6000
+ /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", display: "flex", flexDirection: "column" }, children: C })
5975
6001
  ] }) : /* @__PURE__ */ i("div", { style: { flex: 1, overflow: "auto" }, children: [
5976
6002
  /* @__PURE__ */ t(
5977
6003
  mt,
@@ -5985,7 +6011,7 @@ const _i = ({
5985
6011
  Rt,
5986
6012
  {
5987
6013
  transport: e,
5988
- onNavigate: O,
6014
+ onNavigate: H,
5989
6015
  recommendedIds: r
5990
6016
  }
5991
6017
  )
@@ -6012,7 +6038,7 @@ const _i = ({
6012
6038
  hideModeIndicator: n
6013
6039
  }
6014
6040
  ) }) }),
6015
- /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", background: "var(--bim-bg, #f5f5f5)", display: "flex", flexDirection: "column" }, children: T })
6041
+ /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", background: "var(--bim-bg, #f5f5f5)", display: "flex", flexDirection: "column" }, children: C })
6016
6042
  ] });
6017
6043
  };
6018
6044
  function je(e) {
@@ -6034,7 +6060,7 @@ const zi = ({
6034
6060
  style: r
6035
6061
  }) => {
6036
6062
  var g;
6037
- const a = H(), { convert: l } = Y(), [c, s] = w(((g = e.divisions[0]) == null ? void 0 : g.name) ?? null), [d, u] = w(null);
6063
+ const a = D(), { convert: l } = N(), [c, s] = w(((g = e.divisions[0]) == null ? void 0 : g.name) ?? null), [d, u] = w(null);
6038
6064
  return /* @__PURE__ */ i("div", { className: o, style: r, children: [
6039
6065
  /* @__PURE__ */ i("div", { style: { marginBottom: "16px" }, children: [
6040
6066
  /* @__PURE__ */ t("h2", { style: { fontSize: "18px", fontWeight: 600, color: "var(--bim-fg, #1a1a1a)", margin: "0 0 8px" }, children: l(e.title) }),
@@ -6078,7 +6104,7 @@ const zi = ({
6078
6104
  )) })
6079
6105
  ] });
6080
6106
  }, pr = ({ division: e, expanded: n, onToggle: o, expandedCat: r, onCatToggle: a, onNavigate: l }) => {
6081
- const { convert: c } = Y(), s = e.categories.reduce((d, u) => {
6107
+ const { convert: c } = N(), s = e.categories.reduce((d, u) => {
6082
6108
  const g = u.stats || { zhulu: 0, cunmu: 0 };
6083
6109
  return d + (g.zhulu || 0) + (g.cunmu || 0);
6084
6110
  }, 0);
@@ -6133,7 +6159,7 @@ const zi = ({
6133
6159
  ] });
6134
6160
  }, ur = ({ category: e, expanded: n, onToggle: o, onNavigate: r }) => {
6135
6161
  var d, u, g, f;
6136
- const { convert: a } = Y(), l = ((d = e.books) == null ? void 0 : d.zhulu) || [], c = ((u = e.books) == null ? void 0 : u.cunmu) || [], s = (((g = e.stats) == null ? void 0 : g.zhulu) || l.length) + (((f = e.stats) == null ? void 0 : f.cunmu) || c.length);
6162
+ const { convert: a } = N(), l = ((d = e.books) == null ? void 0 : d.zhulu) || [], c = ((u = e.books) == null ? void 0 : u.cunmu) || [], s = (((g = e.stats) == null ? void 0 : g.zhulu) || l.length) + (((f = e.stats) == null ? void 0 : f.cunmu) || c.length);
6137
6163
  return /* @__PURE__ */ i("div", { children: [
6138
6164
  /* @__PURE__ */ i(
6139
6165
  "button",
@@ -6174,7 +6200,7 @@ const zi = ({
6174
6200
  ] })
6175
6201
  ] });
6176
6202
  }, Et = ({ label: e, books: n, onNavigate: o }) => {
6177
- const { convert: r } = Y(), a = de(), [l, c] = w(n.length <= 20), s = l ? n : n.slice(0, 10);
6203
+ const { convert: r } = N(), a = de(), [l, c] = w(n.length <= 20), s = l ? n : n.slice(0, 10);
6178
6204
  return /* @__PURE__ */ i("div", { style: { marginBottom: "8px" }, children: [
6179
6205
  /* @__PURE__ */ i("div", { style: { fontSize: "11px", color: "var(--bim-desc-fg, #999)", marginBottom: "4px", fontWeight: 500 }, children: [
6180
6206
  e,
@@ -6220,7 +6246,7 @@ const zi = ({
6220
6246
  )
6221
6247
  ] });
6222
6248
  }, he = ({ title: e, onSave: n, onAskAI: o, extraButtons: r, children: a }) => {
6223
- const l = H();
6249
+ const l = D();
6224
6250
  return /* @__PURE__ */ i("div", { style: {
6225
6251
  background: "var(--bim-bg, #fff)",
6226
6252
  border: "1px solid var(--bim-widget-border, #e0e0e0)",
@@ -6291,8 +6317,8 @@ const zi = ({
6291
6317
  }
6292
6318
  )
6293
6319
  ] }), ze = ({ value: e, onChange: n, placeholder: o }) => {
6294
- const r = Q(null);
6295
- return $(() => {
6320
+ const r = q(null);
6321
+ return A(() => {
6296
6322
  r.current && (r.current.style.height = "auto", r.current.style.height = `${r.current.scrollHeight}px`);
6297
6323
  }, [e]), /* @__PURE__ */ t(
6298
6324
  "textarea",
@@ -6335,8 +6361,8 @@ function hr(e) {
6335
6361
  return n ? { name: n[1], id: n[2] } : null;
6336
6362
  }
6337
6363
  const Qe = ({ value: e, onChange: n, label: o }) => {
6338
- const [r, a] = w(!1), l = Q(null), c = hr(e || "");
6339
- return $(() => {
6364
+ const [r, a] = w(!1), l = q(null), c = hr(e || "");
6365
+ return A(() => {
6340
6366
  r && l.current && l.current.focus();
6341
6367
  }, [r]), !r && c ? /* @__PURE__ */ i("div", { style: { marginBottom: "16px" }, children: [
6342
6368
  /* @__PURE__ */ t("label", { style: $t, children: o }),
@@ -6413,7 +6439,7 @@ function br(e) {
6413
6439
  }
6414
6440
  }
6415
6441
  const mr = ({ items: e, onChange: n, onOpenEntityPicker: o }) => {
6416
- const r = H(), [a, l] = w(null), c = () => {
6442
+ const r = D(), [a, l] = w(null), c = () => {
6417
6443
  n([...e, { id: "", name: "", type: "", details: "", position: "", version: "", processor_version: "" }]), l(e.length);
6418
6444
  }, s = (f) => {
6419
6445
  n(e.filter((x, p) => p !== f)), a === f && l(null);
@@ -6478,7 +6504,7 @@ const mr = ({ items: e, onChange: n, onOpenEntityPicker: o }) => {
6478
6504
  ] })
6479
6505
  ] })
6480
6506
  ] }),
6481
- f.type === "bookID" && /* @__PURE__ */ t(j, { children: /* @__PURE__ */ i("div", { children: [
6507
+ f.type === "bookID" && /* @__PURE__ */ t(F, { children: /* @__PURE__ */ i("div", { children: [
6482
6508
  /* @__PURE__ */ i("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
6483
6509
  /* @__PURE__ */ t("label", { style: be, children: r.action.selectBookOrWork }),
6484
6510
  /* @__PURE__ */ t("button", { onClick: () => {
@@ -6498,7 +6524,7 @@ const mr = ({ items: e, onChange: n, onOpenEntityPicker: o }) => {
6498
6524
  /* @__PURE__ */ t("span", { children: r.action.clickToSelectBookOrWork })
6499
6525
  ] })
6500
6526
  ] }) }),
6501
- f.type === "url" && /* @__PURE__ */ i(j, { children: [
6527
+ f.type === "url" && /* @__PURE__ */ i(F, { children: [
6502
6528
  /* @__PURE__ */ i("div", { children: [
6503
6529
  /* @__PURE__ */ i("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
6504
6530
  /* @__PURE__ */ t("label", { style: be, children: r.label.sourceName }),
@@ -6514,7 +6540,7 @@ const mr = ({ items: e, onChange: n, onOpenEntityPicker: o }) => {
6514
6540
  /* @__PURE__ */ t("input", { type: "text", value: f.id, onChange: (p) => d(x, "id", p.target.value), placeholder: "https://...", style: we })
6515
6541
  ] })
6516
6542
  ] }),
6517
- f.type && /* @__PURE__ */ i(j, { children: [
6543
+ f.type && /* @__PURE__ */ i(F, { children: [
6518
6544
  /* @__PURE__ */ t("div", { style: { borderTop: "1px dashed var(--bim-widget-border, #e0e0e0)", paddingTop: "12px", marginTop: "4px" }, children: /* @__PURE__ */ t("label", { style: { ...be, opacity: 0.7 }, children: r.label.optionalInfo }) }),
6519
6545
  /* @__PURE__ */ i("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "8px" }, children: [
6520
6546
  /* @__PURE__ */ i("div", { children: [
@@ -6633,7 +6659,7 @@ const kr = ({
6633
6659
  onCreateAndLink: b,
6634
6660
  onSaveRelations: S
6635
6661
  }) => {
6636
- const h = H();
6662
+ const h = D();
6637
6663
  return /* @__PURE__ */ i("div", { style: {
6638
6664
  background: "var(--bim-bg, #fff)",
6639
6665
  border: "1px solid var(--bim-widget-border, #e0e0e0)",
@@ -6658,7 +6684,7 @@ const kr = ({
6658
6684
  S && /* @__PURE__ */ t("button", { onClick: S, style: Sr, children: h.action.save })
6659
6685
  ] }),
6660
6686
  /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
6661
- e === "book" && /* @__PURE__ */ i(j, { children: [
6687
+ e === "book" && /* @__PURE__ */ i(F, { children: [
6662
6688
  /* @__PURE__ */ t(
6663
6689
  Ee,
6664
6690
  {
@@ -6707,7 +6733,7 @@ const kr = ({
6707
6733
  }
6708
6734
  )
6709
6735
  ] }),
6710
- e === "work" && /* @__PURE__ */ i(j, { children: [
6736
+ e === "work" && /* @__PURE__ */ i(F, { children: [
6711
6737
  /* @__PURE__ */ t(
6712
6738
  Ee,
6713
6739
  {
@@ -6765,7 +6791,7 @@ const kr = ({
6765
6791
  }
6766
6792
  )
6767
6793
  ] }),
6768
- e === "collection" && /* @__PURE__ */ i(j, { children: [
6794
+ e === "collection" && /* @__PURE__ */ i(F, { children: [
6769
6795
  /* @__PURE__ */ t(
6770
6796
  Ee,
6771
6797
  {
@@ -6926,7 +6952,7 @@ const Sr = {
6926
6952
  excludeId: u
6927
6953
  }) => {
6928
6954
  const [g, f] = w(""), x = u ? c.filter((h) => h.id !== u) : c;
6929
- $(() => {
6955
+ A(() => {
6930
6956
  e && (f(""), s(""));
6931
6957
  }, [e]);
6932
6958
  const p = (h) => {
@@ -7044,8 +7070,8 @@ const Sr = {
7044
7070
  onConfirm: a,
7045
7071
  onCancel: l
7046
7072
  }) => {
7047
- const [c, s] = w(""), d = Q(null);
7048
- $(() => {
7073
+ const [c, s] = w(""), d = q(null);
7074
+ A(() => {
7049
7075
  e && (s((r == null ? void 0 : r.title) || ""), setTimeout(() => {
7050
7076
  var x, p;
7051
7077
  (x = d.current) == null || x.focus(), (p = d.current) == null || p.select();
@@ -7217,10 +7243,10 @@ const Or = ({
7217
7243
  onCreate: u,
7218
7244
  onSearch: g
7219
7245
  }) => {
7220
- const [f, x] = w(""), [p, b] = w([]), [S, h] = w(!1), [z, m] = w("recent");
7221
- $(() => {
7246
+ const [f, x] = w(""), [p, b] = w([]), [S, h] = w(!1), [_, m] = w("recent");
7247
+ A(() => {
7222
7248
  e && (x(""), b([]), m(r.length > 0 ? "recent" : "search"));
7223
- }, [e, r.length]), $(() => {
7249
+ }, [e, r.length]), A(() => {
7224
7250
  if (!f.trim()) {
7225
7251
  b([]);
7226
7252
  return;
@@ -7237,14 +7263,14 @@ const Or = ({
7237
7263
  }, 300);
7238
7264
  return () => clearTimeout(B);
7239
7265
  }, [f, o, g]);
7240
- const v = F((B) => {
7266
+ const v = U((B) => {
7241
7267
  x(B.target.value), B.target.value.trim() && m("search");
7242
- }, []), k = F((B) => a ? B.filter((W) => W.id !== a) : B, [a]);
7268
+ }, []), k = U((B) => a ? B.filter((W) => W.id !== a) : B, [a]);
7243
7269
  if (!e) return null;
7244
- const I = n || (o === "all" ? "选择实体" : `选择${un(o)}`), _ = k(r), y = k(p);
7270
+ const T = n || (o === "all" ? "选择实体" : `选择${un(o)}`), z = k(r), y = k(p);
7245
7271
  return /* @__PURE__ */ t("div", { style: jr, children: /* @__PURE__ */ i("div", { style: Fr, children: [
7246
7272
  /* @__PURE__ */ i("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", padding: "16px 20px", borderBottom: "1px solid var(--bim-widget-border, #e0e0e0)" }, children: [
7247
- /* @__PURE__ */ t("div", { style: { fontSize: "15px", fontWeight: 600 }, children: I }),
7273
+ /* @__PURE__ */ t("div", { style: { fontSize: "15px", fontWeight: 600 }, children: T }),
7248
7274
  /* @__PURE__ */ t("button", { onClick: d, style: Ur, children: "✕" })
7249
7275
  ] }),
7250
7276
  /* @__PURE__ */ t("div", { style: { padding: "16px 20px 12px" }, children: /* @__PURE__ */ i("div", { style: { position: "relative" }, children: [
@@ -7262,18 +7288,18 @@ const Or = ({
7262
7288
  /* @__PURE__ */ t("span", { style: { position: "absolute", left: "14px", top: "50%", transform: "translateY(-50%)", opacity: 0.5, fontSize: "14px" }, children: "🔍" }),
7263
7289
  S && /* @__PURE__ */ t("span", { style: { position: "absolute", right: "14px", top: "50%", transform: "translateY(-50%)", fontSize: "12px", opacity: 0.6 }, children: "搜索中..." })
7264
7290
  ] }) }),
7265
- _.length > 0 && /* @__PURE__ */ i("div", { style: { display: "flex", padding: "0 20px", gap: "4px", borderBottom: "1px solid var(--bim-widget-border, #e0e0e0)" }, children: [
7266
- /* @__PURE__ */ i(Ot, { active: z === "recent", onClick: () => m("recent"), children: [
7291
+ z.length > 0 && /* @__PURE__ */ i("div", { style: { display: "flex", padding: "0 20px", gap: "4px", borderBottom: "1px solid var(--bim-widget-border, #e0e0e0)" }, children: [
7292
+ /* @__PURE__ */ i(Ot, { active: _ === "recent", onClick: () => m("recent"), children: [
7267
7293
  "最近使用 (",
7268
- _.length,
7294
+ z.length,
7269
7295
  ")"
7270
7296
  ] }),
7271
- /* @__PURE__ */ i(Ot, { active: z === "search", onClick: () => m("search"), children: [
7297
+ /* @__PURE__ */ i(Ot, { active: _ === "search", onClick: () => m("search"), children: [
7272
7298
  "搜索结果 ",
7273
7299
  y.length > 0 && `(${y.length})`
7274
7300
  ] })
7275
7301
  ] }),
7276
- /* @__PURE__ */ t("div", { style: { flex: 1, overflowY: "auto", padding: "12px 20px", minHeight: "200px", maxHeight: "400px" }, children: z === "recent" && _.length > 0 ? /* @__PURE__ */ t(Dt, { entities: _, onSelect: s }) : f.trim() ? S ? /* @__PURE__ */ t(tt, { message: "搜索中..." }) : y.length > 0 ? /* @__PURE__ */ t(Dt, { entities: y, onSelect: s }) : /* @__PURE__ */ t(tt, { message: "未找到匹配的结果" }) : /* @__PURE__ */ t(tt, { message: "输入关键词开始搜索" }) }),
7302
+ /* @__PURE__ */ t("div", { style: { flex: 1, overflowY: "auto", padding: "12px 20px", minHeight: "200px", maxHeight: "400px" }, children: _ === "recent" && z.length > 0 ? /* @__PURE__ */ t(Dt, { entities: z, onSelect: s }) : f.trim() ? S ? /* @__PURE__ */ t(tt, { message: "搜索中..." }) : y.length > 0 ? /* @__PURE__ */ t(Dt, { entities: y, onSelect: s }) : /* @__PURE__ */ t(tt, { message: "未找到匹配的结果" }) : /* @__PURE__ */ t(tt, { message: "输入关键词开始搜索" }) }),
7277
7303
  l && u && /* @__PURE__ */ i("div", { style: { padding: "12px 20px", borderTop: "1px solid var(--bim-widget-border, #e0e0e0)", display: "flex", alignItems: "center", gap: "8px" }, children: [
7278
7304
  /* @__PURE__ */ t("span", { style: { fontSize: "12px", opacity: 0.7 }, children: "找不到?" }),
7279
7305
  /* @__PURE__ */ t("button", { onClick: u, style: Nr, children: c || "创建新实体" })
@@ -7387,41 +7413,41 @@ const Or = ({
7387
7413
  onRelationsChange: x
7388
7414
  }) => {
7389
7415
  var oe;
7390
- const p = H(), [b, S] = w(!1), [h, z] = w("work"), [m, v] = w(""), [k, I] = w(""), [_, y] = w([]), [B, W] = w(!1), [E, O] = w(!1), [A, N] = w("work"), [U, T] = w(""), [D, C] = w(), [R, P] = w(!1), [J, V] = w(null), [ee, te] = w([]);
7391
- Q(null);
7392
- const pe = e.type, ve = pe === "work", ye = pe === "collection", ne = pe === "book", X = F((L, K) => {
7393
- n({ ...e, [L]: K });
7394
- }, [e, n]), Ge = F((L, K) => {
7395
- v(L), z(K), I(p.editor.selectToLink + p.indexType[K]), y([]), S(!0);
7396
- }, [p]), Je = F((L) => {
7416
+ const p = D(), [b, S] = w(!1), [h, _] = w("work"), [m, v] = w(""), [k, T] = w(""), [z, y] = w([]), [B, W] = w(!1), [E, H] = w(!1), [K, J] = w("work"), [Y, C] = w(""), [M, I] = w(), [R, P] = w(!1), [$, j] = w(null), [Z, te] = w([]);
7417
+ q(null);
7418
+ const pe = e.type, ve = pe === "work", ye = pe === "collection", ne = pe === "book", ee = U((L, V) => {
7419
+ n({ ...e, [L]: V });
7420
+ }, [e, n]), Ge = U((L, V) => {
7421
+ v(L), _(V), T(p.editor.selectToLink + p.indexType[V]), y([]), S(!0);
7422
+ }, [p]), Je = U((L) => {
7397
7423
  r != null && r.unlinkEntity && r.unlinkEntity(e.id, L);
7398
- }, [r, e.id]), Te = F((L) => {
7424
+ }, [r, e.id]), Te = U((L) => {
7399
7425
  a == null || a(L.id, L.type);
7400
- }, [a]), Re = F((L, K, ie) => {
7426
+ }, [a]), Re = U((L, V, ie) => {
7401
7427
  const ue = { ...ie, author: (ie == null ? void 0 : ie.author) || e.author, dynasty: (ie == null ? void 0 : ie.dynasty) || e.dynasty };
7402
- N(K), T(L), C(ue), O(!0);
7403
- }, [e.author, e.dynasty]), qe = F((L, K) => {
7404
- r != null && r.createAndLink && r.createAndLink(e.id, U, { type: A, title: L, inheritData: K }), O(!1);
7405
- }, [r, e.id, U, A]), He = F((L) => {
7428
+ J(V), C(L), I(ue), H(!0);
7429
+ }, [e.author, e.dynasty]), qe = U((L, V) => {
7430
+ r != null && r.createAndLink && r.createAndLink(e.id, Y, { type: K, title: L, inheritData: V }), H(!1);
7431
+ }, [r, e.id, Y, K]), He = U((L) => {
7406
7432
  if (!L.trim()) {
7407
7433
  y([]);
7408
7434
  return;
7409
7435
  }
7410
- W(!0), r != null && r.searchEntities && r.searchEntities(L, h).then((K) => {
7411
- y(K), W(!1);
7436
+ W(!0), r != null && r.searchEntities && r.searchEntities(L, h).then((V) => {
7437
+ y(V), W(!1);
7412
7438
  }).catch(() => {
7413
7439
  y([]), W(!1);
7414
7440
  });
7415
- }, [r, h]), Ze = F((L) => {
7441
+ }, [r, h]), Ze = U((L) => {
7416
7442
  r != null && r.linkEntity && r.linkEntity(e.id, m, L.id), S(!1);
7417
- }, [r, e.id, m]), M = F(() => {
7443
+ }, [r, e.id, m]), O = U(() => {
7418
7444
  o();
7419
- }, [o]), Z = F((L) => {
7420
- V(() => L), P(!0), r != null && r.getRecentEntities && r.getRecentEntities().then(te).catch(() => {
7445
+ }, [o]), Q = U((L) => {
7446
+ j(() => L), P(!0), r != null && r.getRecentEntities && r.getRecentEntities().then(te).catch(() => {
7421
7447
  });
7422
- }, [r]), G = F((L, K) => r != null && r.searchEntities ? r.searchEntities(L, K === "all" ? void 0 : K) : Promise.resolve([]), [r]), q = F((L) => {
7423
- r != null && r.addRecentEntity && r.addRecentEntity(L), te((K) => [L, ...K.filter((ie) => ie.id !== L.id)].slice(0, 10)), J == null || J(L), P(!1), V(null);
7424
- }, [r, J]);
7448
+ }, [r]), G = U((L, V) => r != null && r.searchEntities ? r.searchEntities(L, V === "all" ? void 0 : V) : Promise.resolve([]), [r]), X = U((L) => {
7449
+ r != null && r.addRecentEntity && r.addRecentEntity(L), te((V) => [L, ...V.filter((ie) => ie.id !== L.id)].slice(0, 10)), $ == null || $(L), P(!1), j(null);
7450
+ }, [r, $]);
7425
7451
  return /* @__PURE__ */ i("div", { style: { padding: "16px", maxWidth: "900px", margin: "0 auto" }, children: [
7426
7452
  /* @__PURE__ */ t("div", { style: {
7427
7453
  display: "flex",
@@ -7449,46 +7475,46 @@ const Or = ({
7449
7475
  {
7450
7476
  label: ve ? p.editor.workTitle : ye ? p.editor.collectionTitle : p.editor.bookTitle,
7451
7477
  value: e.title,
7452
- onChange: (L) => X("title", L)
7478
+ onChange: (L) => ee("title", L)
7453
7479
  }
7454
7480
  ),
7455
- ne && /* @__PURE__ */ t(Qe, { label: p.editor.belongsToWork, value: e.workName || "", onChange: (L) => X("workName", L) }),
7456
- /* @__PURE__ */ t(ae, { label: p.editor.authorLabel, value: e.author || "", onChange: (L) => X("author", L) }),
7457
- /* @__PURE__ */ t(ae, { label: p.editor.dynastyLabel, value: e.dynasty || "", onChange: (L) => X("dynasty", L) }),
7458
- (ne || ye) && /* @__PURE__ */ t(Qe, { label: p.editor.containedIn, value: e.collection || "", onChange: (L) => X("collection", L) }),
7459
- (ne || ye) && /* @__PURE__ */ t(ae, { label: p.editor.holderLabel, value: e.holder || "", onChange: (L) => X("holder", L) }),
7460
- (ne || ye) && /* @__PURE__ */ t(ae, { label: ne ? p.editor.pageLabel : p.editor.volumeLabel, value: e.pages || "", onChange: (L) => X("pages", L) }),
7461
- /* @__PURE__ */ t("div", { style: { gridColumn: "1 / -1" }, children: /* @__PURE__ */ t(ae, { label: p.editor.firstImageLabel, value: e.firstImage || "", onChange: (L) => X("firstImage", L) }) })
7481
+ ne && /* @__PURE__ */ t(Qe, { label: p.editor.belongsToWork, value: e.workName || "", onChange: (L) => ee("workName", L) }),
7482
+ /* @__PURE__ */ t(ae, { label: p.editor.authorLabel, value: e.author || "", onChange: (L) => ee("author", L) }),
7483
+ /* @__PURE__ */ t(ae, { label: p.editor.dynastyLabel, value: e.dynasty || "", onChange: (L) => ee("dynasty", L) }),
7484
+ (ne || ye) && /* @__PURE__ */ t(Qe, { label: p.editor.containedIn, value: e.collection || "", onChange: (L) => ee("collection", L) }),
7485
+ (ne || ye) && /* @__PURE__ */ t(ae, { label: p.editor.holderLabel, value: e.holder || "", onChange: (L) => ee("holder", L) }),
7486
+ (ne || ye) && /* @__PURE__ */ t(ae, { label: ne ? p.editor.pageLabel : p.editor.volumeLabel, value: e.pages || "", onChange: (L) => ee("pages", L) }),
7487
+ /* @__PURE__ */ t("div", { style: { gridColumn: "1 / -1" }, children: /* @__PURE__ */ t(ae, { label: p.editor.firstImageLabel, value: e.firstImage || "", onChange: (L) => ee("firstImage", L) }) })
7462
7488
  ] })
7463
7489
  }
7464
7490
  ),
7465
- /* @__PURE__ */ t(he, { title: p.section.description, onSave: o, onAskAI: s ? () => s("介绍") : void 0, children: /* @__PURE__ */ t(ze, { value: e.description || "", onChange: (L) => X("description", L), placeholder: p.editor.descriptionPlaceholder }) }),
7491
+ /* @__PURE__ */ t(he, { title: p.section.description, onSave: o, onAskAI: s ? () => s("介绍") : void 0, children: /* @__PURE__ */ t(ze, { value: e.description || "", onChange: (L) => ee("description", L), placeholder: p.editor.descriptionPlaceholder }) }),
7466
7492
  (((oe = e.additional_works) == null ? void 0 : oe.length) || 0) > 0 && /* @__PURE__ */ t(he, { title: p.section.additionalWorks, onSave: o, children: /* @__PURE__ */ t(
7467
7493
  Jr,
7468
7494
  {
7469
7495
  items: e.additional_works || [],
7470
- onChange: (L) => X("additional_works", L)
7496
+ onChange: (L) => ee("additional_works", L)
7471
7497
  }
7472
7498
  ) }),
7473
7499
  /* @__PURE__ */ t(he, { title: p.section.indexedBy, onSave: o, onAskAI: s ? () => s("收录于") : void 0, children: /* @__PURE__ */ t(
7474
7500
  qr,
7475
7501
  {
7476
7502
  items: e.indexed_by || [],
7477
- onChange: (L) => X("indexed_by", L)
7503
+ onChange: (L) => ee("indexed_by", L)
7478
7504
  }
7479
7505
  ) }),
7480
7506
  /* @__PURE__ */ t(he, { title: p.section.emendatedBy, onSave: o, onAskAI: s ? () => s("考证") : void 0, children: /* @__PURE__ */ t(
7481
7507
  Zr,
7482
7508
  {
7483
7509
  items: e.emendated_by || [],
7484
- onChange: (L) => X("emendated_by", L)
7510
+ onChange: (L) => ee("emendated_by", L)
7485
7511
  }
7486
7512
  ) }),
7487
7513
  /* @__PURE__ */ t(he, { title: p.section.textResources, onSave: o, onAskAI: s ? () => s("资源") : void 0, children: /* @__PURE__ */ t(
7488
7514
  st,
7489
7515
  {
7490
7516
  items: e.resources || [],
7491
- onChange: (L) => X("resources", L),
7517
+ onChange: (L) => ee("resources", L),
7492
7518
  onDownload: u,
7493
7519
  downloadStatuses: g,
7494
7520
  filterType: "text"
@@ -7498,7 +7524,7 @@ const Or = ({
7498
7524
  st,
7499
7525
  {
7500
7526
  items: e.resources || [],
7501
- onChange: (L) => X("resources", L),
7527
+ onChange: (L) => ee("resources", L),
7502
7528
  onDownload: u,
7503
7529
  downloadStatuses: g,
7504
7530
  filterType: "image"
@@ -7508,12 +7534,12 @@ const Or = ({
7508
7534
  mr,
7509
7535
  {
7510
7536
  items: yr(e.sources || ""),
7511
- onChange: (L) => X("sources", vr(L)),
7512
- onOpenEntityPicker: Z
7537
+ onChange: (L) => ee("sources", vr(L)),
7538
+ onOpenEntityPicker: Q
7513
7539
  }
7514
7540
  ) }),
7515
- (ne || ye) && /* @__PURE__ */ t(he, { title: p.section.provenance, onSave: o, onAskAI: s ? () => s("收藏历史") : void 0, children: /* @__PURE__ */ t(ze, { value: e.provenance || "", onChange: (L) => X("provenance", L), placeholder: p.editor.provenancePlaceholder }) }),
7516
- ne && /* @__PURE__ */ t(he, { title: p.section.otherEditions, onSave: o, onAskAI: s ? () => s("其他版本") : void 0, children: /* @__PURE__ */ t(ze, { value: e.otherEditions || "", onChange: (L) => X("otherEditions", L), placeholder: p.editor.otherEditionsPlaceholder }) }),
7541
+ (ne || ye) && /* @__PURE__ */ t(he, { title: p.section.provenance, onSave: o, onAskAI: s ? () => s("收藏历史") : void 0, children: /* @__PURE__ */ t(ze, { value: e.provenance || "", onChange: (L) => ee("provenance", L), placeholder: p.editor.provenancePlaceholder }) }),
7542
+ ne && /* @__PURE__ */ t(he, { title: p.section.otherEditions, onSave: o, onAskAI: s ? () => s("其他版本") : void 0, children: /* @__PURE__ */ t(ze, { value: e.otherEditions || "", onChange: (L) => ee("otherEditions", L), placeholder: p.editor.otherEditionsPlaceholder }) }),
7517
7543
  /* @__PURE__ */ t(
7518
7544
  kr,
7519
7545
  {
@@ -7532,7 +7558,7 @@ const Or = ({
7532
7558
  onUnlinkEntity: Je,
7533
7559
  onViewEntity: Te,
7534
7560
  onCreateAndLink: Re,
7535
- onSaveRelations: M
7561
+ onSaveRelations: O
7536
7562
  }
7537
7563
  ),
7538
7564
  l && c && /* @__PURE__ */ i("div", { style: {
@@ -7565,7 +7591,7 @@ const Or = ({
7565
7591
  onCreate: () => {
7566
7592
  S(!1), Re(m, h);
7567
7593
  },
7568
- searchResults: _,
7594
+ searchResults: z,
7569
7595
  onSearch: He,
7570
7596
  isLoading: B,
7571
7597
  excludeId: e.id
@@ -7575,11 +7601,11 @@ const Or = ({
7575
7601
  Br,
7576
7602
  {
7577
7603
  isOpen: E,
7578
- entityType: A,
7579
- relationField: U,
7580
- inheritData: D,
7604
+ entityType: K,
7605
+ relationField: Y,
7606
+ inheritData: M,
7581
7607
  onConfirm: qe,
7582
- onCancel: () => O(!1)
7608
+ onCancel: () => H(!1)
7583
7609
  }
7584
7610
  ),
7585
7611
  /* @__PURE__ */ t(
@@ -7588,11 +7614,11 @@ const Or = ({
7588
7614
  isOpen: R,
7589
7615
  title: p.action.selectBookOrWork,
7590
7616
  filterType: "all",
7591
- recentEntities: ee,
7617
+ recentEntities: Z,
7592
7618
  excludeId: e.id,
7593
- onSelect: q,
7619
+ onSelect: X,
7594
7620
  onCancel: () => {
7595
- P(!1), V(null);
7621
+ P(!1), j(null);
7596
7622
  },
7597
7623
  onSearch: G
7598
7624
  }
@@ -7600,7 +7626,7 @@ const Or = ({
7600
7626
  ] });
7601
7627
  };
7602
7628
  function Jr({ items: e, onChange: n }) {
7603
- const o = H(), r = (c, s, d) => {
7629
+ const o = D(), r = (c, s, d) => {
7604
7630
  const u = e.map((g, f) => f === c ? { ...g, [s]: d } : g);
7605
7631
  n(u);
7606
7632
  }, a = (c) => n(e.filter((s, d) => d !== c)), l = () => n([...e, { book_title: "" }]);
@@ -7632,7 +7658,7 @@ function Jr({ items: e, onChange: n }) {
7632
7658
  ] });
7633
7659
  }
7634
7660
  function fn({ items: e, onChange: n, showMeta: o, addLabel: r }) {
7635
- const a = H(), [l, c] = rt.useState(null), s = (g, f, x) => {
7661
+ const a = D(), [l, c] = rt.useState(null), s = (g, f, x) => {
7636
7662
  const p = e.map((b, S) => S === g ? { ...b, [f]: x || void 0 } : b);
7637
7663
  n(p);
7638
7664
  }, d = (g) => {
@@ -7686,7 +7712,7 @@ function fn({ items: e, onChange: n, showMeta: o, addLabel: r }) {
7686
7712
  /* @__PURE__ */ t(ae, { label: a.label.sourceName, value: g.source, onChange: (p) => s(f, "source", p) }),
7687
7713
  /* @__PURE__ */ t(ae, { label: a.label.sourceBid, value: g.source_bid || "", onChange: (p) => s(f, "source_bid", p) })
7688
7714
  ] }),
7689
- o && /* @__PURE__ */ i(j, { children: [
7715
+ o && /* @__PURE__ */ i(F, { children: [
7690
7716
  /* @__PURE__ */ i("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "8px" }, children: [
7691
7717
  /* @__PURE__ */ t(ae, { label: a.label.titleInfo, value: g.title_info || "", onChange: (p) => s(f, "title_info", p) }),
7692
7718
  /* @__PURE__ */ t(ae, { label: a.label.authorInfo, value: g.author_info || "", onChange: (p) => s(f, "author_info", p) })
@@ -7712,11 +7738,11 @@ function fn({ items: e, onChange: n, showMeta: o, addLabel: r }) {
7712
7738
  ] });
7713
7739
  }
7714
7740
  function qr({ items: e, onChange: n }) {
7715
- const o = H();
7741
+ const o = D();
7716
7742
  return /* @__PURE__ */ t(fn, { items: e, onChange: n, showMeta: !0, addLabel: o.action.addIndexedBy });
7717
7743
  }
7718
7744
  function Zr({ items: e, onChange: n }) {
7719
- const o = H();
7745
+ const o = D();
7720
7746
  return /* @__PURE__ */ t(fn, { items: e, onChange: n, addLabel: o.action.addEmendatedBy });
7721
7747
  }
7722
7748
  function Xr(e) {
@@ -7783,25 +7809,25 @@ const Ii = (e) => {
7783
7809
  downloadStatuses: b,
7784
7810
  relations: S,
7785
7811
  onRelationsChange: h,
7786
- headerExtra: z,
7812
+ headerExtra: _,
7787
7813
  className: m,
7788
7814
  style: v
7789
7815
  } = e;
7790
- H();
7791
- const [k, I] = w(a), _ = l ? a : k;
7792
- $(() => {
7793
- a !== k && I(a);
7816
+ D();
7817
+ const [k, T] = w(a), z = l ? a : k;
7818
+ A(() => {
7819
+ a !== k && T(a);
7794
7820
  }, [a]);
7795
- const y = F(() => {
7796
- const U = _ === "view" ? "edit" : "view";
7797
- l ? l(U) : I(U);
7798
- }, [_, l]), [B, W] = w(null);
7799
- $(() => {
7800
- o && r && r.getItem(o).then((U) => {
7801
- U && W(U);
7821
+ const y = U(() => {
7822
+ const Y = z === "view" ? "edit" : "view";
7823
+ l ? l(Y) : T(Y);
7824
+ }, [z, l]), [B, W] = w(null);
7825
+ A(() => {
7826
+ o && r && r.getItem(o).then((Y) => {
7827
+ Y && W(Y);
7802
7828
  });
7803
7829
  }, [o, r]);
7804
- const E = n || B, O = ce(() => E ? Xr(E) : null, [E]), N = /* @__PURE__ */ i(j, { children: [
7830
+ const E = n || B, H = ce(() => E ? Xr(E) : null, [E]), J = /* @__PURE__ */ i(F, { children: [
7805
7831
  l || !n ? /* @__PURE__ */ t(
7806
7832
  "button",
7807
7833
  {
@@ -7811,36 +7837,36 @@ const Ii = (e) => {
7811
7837
  fontSize: "12px",
7812
7838
  border: "1px solid var(--bim-widget-border, #d0d0d0)",
7813
7839
  borderRadius: "4px",
7814
- background: _ === "edit" ? "var(--bim-accent-bg, #1976d2)" : "transparent",
7815
- color: _ === "edit" ? "#fff" : "var(--bim-fg, #333)",
7840
+ background: z === "edit" ? "var(--bim-accent-bg, #1976d2)" : "transparent",
7841
+ color: z === "edit" ? "#fff" : "var(--bim-fg, #333)",
7816
7842
  cursor: "pointer",
7817
7843
  display: "inline-flex",
7818
7844
  alignItems: "center",
7819
7845
  gap: "4px"
7820
7846
  },
7821
- title: _ === "view" ? "切换到编辑模式" : "切换到查看模式",
7822
- children: _ === "view" ? "✏️ 编辑" : "👁 查看"
7847
+ title: z === "view" ? "切换到编辑模式" : "切换到查看模式",
7848
+ children: z === "view" ? "✏️ 编辑" : "👁 查看"
7823
7849
  }
7824
7850
  ) : null,
7825
- z
7851
+ _
7826
7852
  ] });
7827
- return !E && !O ? /* @__PURE__ */ t(Se, {}) : _ === "view" ? /* @__PURE__ */ t(
7853
+ return !E && !H ? /* @__PURE__ */ t(Se, {}) : z === "view" ? /* @__PURE__ */ t(
7828
7854
  on,
7829
7855
  {
7830
7856
  data: E,
7831
7857
  transport: r,
7832
- onNavigate: u ? (U) => u(U) : void 0,
7858
+ onNavigate: u ? (Y) => u(Y) : void 0,
7833
7859
  renderLink: g,
7834
- headerExtra: N,
7860
+ headerExtra: J,
7835
7861
  className: m,
7836
7862
  style: v
7837
7863
  }
7838
- ) : O ? /* @__PURE__ */ i("div", { className: m, style: v, children: [
7839
- N && /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "flex-end", padding: "8px 0", gap: "8px" }, children: N }),
7864
+ ) : H ? /* @__PURE__ */ i("div", { className: m, style: v, children: [
7865
+ J && /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "flex-end", padding: "8px 0", gap: "8px" }, children: J }),
7840
7866
  /* @__PURE__ */ t(
7841
7867
  Gr,
7842
7868
  {
7843
- data: O,
7869
+ data: H,
7844
7870
  onChange: c || (() => {
7845
7871
  }),
7846
7872
  onSave: s || (() => {
@@ -7862,23 +7888,23 @@ const Ii = (e) => {
7862
7888
  { value: "bug", label: "反馈错误", icon: "🐛", placeholder: "请描述您发现的错误,包括页面位置和具体内容" },
7863
7889
  { value: "resource", label: "添加资源", icon: "📚", placeholder: "请提供完整资源链接和简要版本说明" }
7864
7890
  ], Qr = ({ isOpen: e, onClose: n, onSubmit: o, feedbackListUrl: r }) => {
7865
- const [a, l] = w(null), [c, s] = w(""), [d, u] = w("idle"), [g, f] = w(""), x = Q(null);
7866
- $(() => {
7891
+ const [a, l] = w(null), [c, s] = w(""), [d, u] = w("idle"), [g, f] = w(""), x = q(null);
7892
+ A(() => {
7867
7893
  e && (l(null), s(""), u("idle"), f(""));
7868
- }, [e]), $(() => {
7894
+ }, [e]), A(() => {
7869
7895
  a && setTimeout(() => {
7870
7896
  var h;
7871
7897
  return (h = x.current) == null ? void 0 : h.focus();
7872
7898
  }, 100);
7873
- }, [a]), $(() => {
7899
+ }, [a]), A(() => {
7874
7900
  if (d === "success") {
7875
7901
  const h = setTimeout(n, 2e3);
7876
7902
  return () => clearTimeout(h);
7877
7903
  }
7878
- }, [d, n]), $(() => {
7904
+ }, [d, n]), A(() => {
7879
7905
  if (!e) return;
7880
- const h = (z) => {
7881
- z.key === "Escape" && n();
7906
+ const h = (_) => {
7907
+ _.key === "Escape" && n();
7882
7908
  };
7883
7909
  return document.addEventListener("keydown", h), () => document.removeEventListener("keydown", h);
7884
7910
  }, [e, n]);
@@ -7905,7 +7931,7 @@ const Ii = (e) => {
7905
7931
  /* @__PURE__ */ t("span", { style: { fontSize: "32px" }, children: "✓" }),
7906
7932
  /* @__PURE__ */ t("div", { style: { fontSize: "15px", fontWeight: 500 }, children: "感谢您的反馈!" }),
7907
7933
  r && /* @__PURE__ */ t("a", { href: r, style: { fontSize: "13px", color: "var(--bim-primary, #2563eb)", marginTop: "8px" }, children: "查看反馈列表 →" })
7908
- ] }) : /* @__PURE__ */ i(j, { children: [
7934
+ ] }) : /* @__PURE__ */ i(F, { children: [
7909
7935
  /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", marginBottom: "16px" }, children: jt.map((h) => /* @__PURE__ */ i(
7910
7936
  "button",
7911
7937
  {
@@ -8050,7 +8076,7 @@ const Ii = (e) => {
8050
8076
  feedbackListUrl: o
8051
8077
  }) => {
8052
8078
  const [r, a] = w(!1);
8053
- return /* @__PURE__ */ i(j, { children: [
8079
+ return /* @__PURE__ */ i(F, { children: [
8054
8080
  /* @__PURE__ */ t(
8055
8081
  "button",
8056
8082
  {
@@ -8086,8 +8112,8 @@ const Ii = (e) => {
8086
8112
  { value: "bug", label: "反馈错误", icon: "🐛", placeholder: "请描述您发现的错误,包括页面位置和具体内容" },
8087
8113
  { value: "resource", label: "添加资源", icon: "📚", placeholder: "请提供完整资源链接和简要版本说明" }
8088
8114
  ], Ri = ({ onSubmit: e }) => {
8089
- const [n, o] = w("bug"), [r, a] = w(""), [l, c] = w("idle"), [s, d] = w(""), u = Q(null);
8090
- $(() => {
8115
+ const [n, o] = w("bug"), [r, a] = w(""), [l, c] = w("idle"), [s, d] = w(""), u = q(null);
8116
+ A(() => {
8091
8117
  n && setTimeout(() => {
8092
8118
  var p;
8093
8119
  return (p = u.current) == null ? void 0 : p.focus();
@@ -8327,7 +8353,7 @@ export {
8327
8353
  tl as smartDecode,
8328
8354
  vr as stringifySources,
8329
8355
  de as useBidUrl,
8330
- Y as useConvert,
8331
- H as useT,
8356
+ N as useConvert,
8357
+ D as useT,
8332
8358
  nl as validateResource
8333
8359
  };