@ai-matrx/associations 0.12.1 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,11 +42,13 @@ __export(react_exports, {
42
42
  DoorControlsSlot: () => DoorControlsSlot,
43
43
  DoorRef: () => DoorRef,
44
44
  PrimaryEntityProvider: () => PrimaryEntityProvider,
45
+ SearchFailureNotice: () => SearchFailureNotice,
45
46
  UniversalAssociationPicker: () => UniversalAssociationPicker,
46
47
  UnresolvedRef: () => UnresolvedRef,
47
48
  attachedKey: () => attachedKey,
48
49
  buildCommentTree: () => buildCommentTree,
49
50
  containerLinksArgs: () => containerLinksArgs,
51
+ describeSearchFailures: () => describeSearchFailures,
50
52
  getContentRoleMeta: () => getContentRoleMeta,
51
53
  lazyPickerOverride: () => lazyPickerOverride,
52
54
  lazyWindowShell: () => lazyWindowShell,
@@ -1682,7 +1684,6 @@ function useUniversalEntitySearch(args) {
1682
1684
  const {
1683
1685
  query,
1684
1686
  tokens,
1685
- ownerId,
1686
1687
  enabled = true,
1687
1688
  perTokenLimit = 5,
1688
1689
  emptyQueryMode = "recents"
@@ -1690,6 +1691,11 @@ function useUniversalEntitySearch(args) {
1690
1691
  const store = useAssociationsStore();
1691
1692
  const [results, setResults] = (0, import_react6.useState)([]);
1692
1693
  const [loading, setLoading] = (0, import_react6.useState)(false);
1694
+ const [failures, setFailures] = (0, import_react6.useState)([]);
1695
+ const [error, setError] = (0, import_react6.useState)(null);
1696
+ const [status, setStatus] = (0, import_react6.useState)(
1697
+ enabled ? "loading" : "ready"
1698
+ );
1693
1699
  const [source, setSource] = (0, import_react6.useState)(
1694
1700
  emptyQueryMode === "candidates" ? "candidates" : "recents"
1695
1701
  );
@@ -1702,41 +1708,72 @@ function useUniversalEntitySearch(args) {
1702
1708
  const timer = setTimeout(async () => {
1703
1709
  if (runRef.current !== run) return;
1704
1710
  setLoading(true);
1711
+ setStatus("loading");
1705
1712
  const activeTokens = tokensKey ? tokensKey.split(",") : store.registry.listableTokens();
1706
1713
  const browse = () => store.candidates.searchCandidatesAcrossTokens({
1707
1714
  tokens: activeTokens,
1708
1715
  search: trimmed,
1709
- ownerId: ownerId ?? null,
1710
1716
  perTokenLimit
1711
1717
  });
1718
+ const allFailed = (r) => activeTokens.length > 0 && r.failures.length >= activeTokens.length;
1712
1719
  let next = [];
1713
1720
  let nextSource;
1714
- if (trimmed) {
1715
- next = await browse();
1716
- nextSource = "search";
1717
- } else if (emptyQueryMode === "candidates") {
1718
- next = await browse();
1719
- nextSource = "candidates";
1721
+ const nextFailures = [];
1722
+ let nextError = null;
1723
+ if (trimmed || emptyQueryMode === "candidates") {
1724
+ const r = await browse();
1725
+ next = r.results;
1726
+ nextFailures.push(...r.failures);
1727
+ nextSource = trimmed ? "search" : "candidates";
1728
+ if (allFailed(r)) nextError = totalFailureMessage(store, r);
1720
1729
  } else {
1721
- next = await loadRecents(store, activeTokens);
1730
+ const recents = await loadRecents(store, activeTokens);
1722
1731
  nextSource = "recents";
1732
+ if (recents.ok) {
1733
+ next = recents.data;
1734
+ } else {
1735
+ nextFailures.push({ token: null, error: recents.error });
1736
+ }
1723
1737
  if (next.length === 0 && runRef.current === run) {
1724
- next = await browse();
1738
+ const r = await browse();
1739
+ next = r.results;
1740
+ nextFailures.push(...r.failures);
1725
1741
  nextSource = "candidates";
1742
+ if (allFailed(r)) {
1743
+ nextError = recents.ok ? totalFailureMessage(store, r) : `Couldn't load recent items (${recents.error}) or browse: ${totalFailureMessage(store, r)}`;
1744
+ }
1726
1745
  }
1727
1746
  }
1728
1747
  if (runRef.current !== run) return;
1729
1748
  setResults(next);
1730
1749
  setSource(nextSource);
1750
+ setFailures(nextFailures);
1751
+ setError(nextError);
1752
+ setStatus(nextError ? "error" : "ready");
1731
1753
  setLoading(false);
1732
1754
  }, DEBOUNCE_MS);
1733
1755
  return () => clearTimeout(timer);
1734
- }, [query, tokensKey, ownerId, enabled, perTokenLimit, emptyQueryMode, store]);
1735
- return { results, loading, isRecents: source === "recents", source };
1756
+ }, [query, tokensKey, enabled, perTokenLimit, emptyQueryMode, store]);
1757
+ return {
1758
+ results,
1759
+ loading,
1760
+ isRecents: source === "recents",
1761
+ source,
1762
+ failures,
1763
+ error,
1764
+ status
1765
+ };
1766
+ }
1767
+ function totalFailureMessage(store, r) {
1768
+ const labels = r.failures.map(
1769
+ (f) => store.registry.getEntityInfo(f.token).labelPlural
1770
+ );
1771
+ const first = r.failures[0]?.error;
1772
+ return `Couldn't search ${labels.join(", ")}${first ? `: ${first}` : ""}`;
1736
1773
  }
1737
1774
  async function loadRecents(store, tokens) {
1738
1775
  const res = await store.favorites.list();
1739
- if (!res.ok) return [];
1776
+ if (!res.ok) return { ok: false, error: res.error.message };
1740
1777
  const tokenSet = new Set(tokens);
1741
1778
  const rows = res.data.items.filter(
1742
1779
  (i) => tokenSet.has(i.entityType) && isEntityTypeToken(i.entityType) && (i.isFavorite || i.lastViewedAt)
@@ -1744,7 +1781,7 @@ async function loadRecents(store, tokens) {
1744
1781
  if (a.isFavorite !== b.isFavorite) return a.isFavorite ? -1 : 1;
1745
1782
  return (b.lastViewedAt ?? "").localeCompare(a.lastViewedAt ?? "");
1746
1783
  }).slice(0, RECENTS_LIMIT);
1747
- if (rows.length === 0) return [];
1784
+ if (rows.length === 0) return { ok: true, data: [] };
1748
1785
  const byToken = /* @__PURE__ */ new Map();
1749
1786
  for (const r of rows) {
1750
1787
  const list = byToken.get(r.entityType) ?? [];
@@ -1767,7 +1804,72 @@ async function loadRecents(store, tokens) {
1767
1804
  title
1768
1805
  });
1769
1806
  }
1770
- return out;
1807
+ return { ok: true, data: out };
1808
+ }
1809
+
1810
+ // src/react/components/SearchFailureNotice.tsx
1811
+ var import_design_system = require("@ai-matrx/design-system");
1812
+ var import_jsx_runtime2 = require("react/jsx-runtime");
1813
+ function describeSearchFailures(failures, labelFor) {
1814
+ const recentsFailed = failures.some((f) => f.token === null);
1815
+ const labels = [];
1816
+ for (const f of failures) {
1817
+ if (f.token === null) continue;
1818
+ const label = labelFor(f.token);
1819
+ if (!labels.includes(label)) labels.push(label);
1820
+ }
1821
+ const parts = [];
1822
+ if (recentsFailed) parts.push("Couldn't load recent items");
1823
+ if (labels.length > 0) {
1824
+ parts.push(
1825
+ `${recentsFailed ? "couldn't" : "Couldn't"} search ${labels.join(", ")}`
1826
+ );
1827
+ }
1828
+ return parts.join("; ");
1829
+ }
1830
+ function SearchFailureNotice(props) {
1831
+ const {
1832
+ error,
1833
+ failures,
1834
+ operation = "Search",
1835
+ origin = "associations/SearchFailureNotice",
1836
+ className
1837
+ } = props;
1838
+ const store = useAssociationsStore();
1839
+ if (error) {
1840
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1841
+ import_design_system.ErrorBox,
1842
+ {
1843
+ as: "div",
1844
+ className: (0, import_design_system.cn)(
1845
+ "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive",
1846
+ className
1847
+ ),
1848
+ message: error,
1849
+ operation,
1850
+ origin,
1851
+ children: [
1852
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "font-medium", children: "Couldn\u2019t load items" }),
1853
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "opacity-80", children: error })
1854
+ ]
1855
+ }
1856
+ );
1857
+ }
1858
+ if (failures.length === 0) return null;
1859
+ const summary = describeSearchFailures(
1860
+ failures,
1861
+ (token) => store.registry.getEntityInfo(token).labelPlural
1862
+ );
1863
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1864
+ import_design_system.ErrorBox,
1865
+ {
1866
+ className: (0, import_design_system.cn)("px-1 text-[11px] text-destructive", className),
1867
+ message: summary,
1868
+ error: failures.map((f) => `${f.token ?? "recents"}: ${f.error}`).join("\n"),
1869
+ operation,
1870
+ origin
1871
+ }
1872
+ );
1771
1873
  }
1772
1874
 
1773
1875
  // src/react/hooks/useAssociationCandidates.ts
@@ -1775,7 +1877,6 @@ var import_react7 = require("react");
1775
1877
  function useAssociationCandidates(args) {
1776
1878
  const { token, enabled = true, search, limit } = args;
1777
1879
  const store = useAssociationsStore();
1778
- const userId = currentUserIdOrNull(store);
1779
1880
  const [candidates, setCandidates] = (0, import_react7.useState)([]);
1780
1881
  const [loading, setLoading] = (0, import_react7.useState)(false);
1781
1882
  const [error, setError] = (0, import_react7.useState)(null);
@@ -1788,7 +1889,6 @@ function useAssociationCandidates(args) {
1788
1889
  setError(null);
1789
1890
  const res = await store.candidates.listAssociationCandidates({
1790
1891
  token,
1791
- ownerId: userId,
1792
1892
  ...search !== void 0 ? { search } : {},
1793
1893
  ...limit !== void 0 ? { limit } : {}
1794
1894
  });
@@ -1804,7 +1904,7 @@ function useAssociationCandidates(args) {
1804
1904
  return () => {
1805
1905
  cancelled = true;
1806
1906
  };
1807
- }, [token, enabled, userId, search, limit, tick, store]);
1907
+ }, [token, enabled, search, limit, tick, store]);
1808
1908
  return {
1809
1909
  candidates,
1810
1910
  loading,
@@ -1812,13 +1912,6 @@ function useAssociationCandidates(args) {
1812
1912
  reload: () => setTick((t) => t + 1)
1813
1913
  };
1814
1914
  }
1815
- function currentUserIdOrNull(store) {
1816
- try {
1817
- return store.identity.requireUserId();
1818
- } catch {
1819
- return null;
1820
- }
1821
- }
1822
1915
 
1823
1916
  // src/react/hooks/useComments.ts
1824
1917
  var import_react8 = require("react");
@@ -1962,13 +2055,13 @@ function useAssociationEntitySelectAdapter(args) {
1962
2055
 
1963
2056
  // src/react/components/PrimaryEntityContext.tsx
1964
2057
  var import_react10 = require("react");
1965
- var import_jsx_runtime2 = require("react/jsx-runtime");
2058
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1966
2059
  var PrimaryEntityCtx = (0, import_react10.createContext)(null);
1967
2060
  function PrimaryEntityProvider({
1968
2061
  value,
1969
2062
  children
1970
2063
  }) {
1971
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PrimaryEntityCtx.Provider, { value, children });
2064
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PrimaryEntityCtx.Provider, { value, children });
1972
2065
  }
1973
2066
  function usePrimaryEntity() {
1974
2067
  return (0, import_react10.useContext)(PrimaryEntityCtx);
@@ -1980,10 +2073,10 @@ var import_react12 = require("react");
1980
2073
  // src/react/components/DefaultWindowShell.tsx
1981
2074
  var import_react11 = require("react");
1982
2075
  var import_react_dom = require("react-dom");
1983
- var import_design_system = require("@ai-matrx/design-system");
2076
+ var import_design_system2 = require("@ai-matrx/design-system");
1984
2077
 
1985
2078
  // src/react/icons.tsx
1986
- var import_jsx_runtime3 = require("react/jsx-runtime");
2079
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1987
2080
  function base(props) {
1988
2081
  return {
1989
2082
  xmlns: "http://www.w3.org/2000/svg",
@@ -2000,129 +2093,129 @@ function base(props) {
2000
2093
  };
2001
2094
  }
2002
2095
  function SpinnerIcon(props) {
2003
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
2096
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
2004
2097
  }
2005
2098
  function PlusIcon(props) {
2006
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2007
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5 12h14" }),
2008
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 5v14" })
2099
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2100
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5 12h14" }),
2101
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 5v14" })
2009
2102
  ] });
2010
2103
  }
2011
2104
  function XIcon(props) {
2012
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2013
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M18 6 6 18" }),
2014
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m6 6 12 12" })
2105
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2106
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M18 6 6 18" }),
2107
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m6 6 12 12" })
2015
2108
  ] });
2016
2109
  }
2017
2110
  function CheckIcon(props) {
2018
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
2111
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
2019
2112
  }
2020
2113
  function SearchIcon(props) {
2021
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2022
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
2023
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m21 21-4.3-4.3" })
2114
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2115
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
2116
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m21 21-4.3-4.3" })
2024
2117
  ] });
2025
2118
  }
2026
2119
  function Link2Icon(props) {
2027
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2028
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M9 17H7A5 5 0 0 1 7 7h2" }),
2029
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M15 7h2a5 5 0 1 1 0 10h-2" }),
2030
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "8", x2: "16", y1: "12", y2: "12" })
2120
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2121
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9 17H7A5 5 0 0 1 7 7h2" }),
2122
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M15 7h2a5 5 0 1 1 0 10h-2" }),
2123
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "8", x2: "16", y1: "12", y2: "12" })
2031
2124
  ] });
2032
2125
  }
2033
2126
  function RefreshIcon(props) {
2034
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2035
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
2036
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 3v5h-5" }),
2037
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
2038
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 16H3v5" })
2127
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2128
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
2129
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 3v5h-5" }),
2130
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
2131
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 16H3v5" })
2039
2132
  ] });
2040
2133
  }
2041
2134
  function PinIcon(props) {
2042
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2043
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 17v5" }),
2044
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" })
2135
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2136
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 17v5" }),
2137
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" })
2045
2138
  ] });
2046
2139
  }
2047
2140
  function UploadIcon(props) {
2048
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2049
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
2050
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: "17 8 12 3 7 8" }),
2051
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "12", x2: "12", y1: "3", y2: "15" })
2141
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2142
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
2143
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "17 8 12 3 7 8" }),
2144
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "12", x2: "12", y1: "3", y2: "15" })
2052
2145
  ] });
2053
2146
  }
2054
2147
  function FolderOpenIcon(props) {
2055
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" }) });
2148
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" }) });
2056
2149
  }
2057
2150
  function ExternalLinkIcon(props) {
2058
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2059
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M15 3h6v6" }),
2060
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M10 14 21 3" }),
2061
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
2151
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2152
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M15 3h6v6" }),
2153
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M10 14 21 3" }),
2154
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
2062
2155
  ] });
2063
2156
  }
2064
2157
  function ChevronDownIcon(props) {
2065
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m6 9 6 6 6-6" }) });
2158
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m6 9 6 6 6-6" }) });
2066
2159
  }
2067
2160
  function ChevronsUpDownIcon(props) {
2068
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2069
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m7 15 5 5 5-5" }),
2070
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m7 9 5-5 5 5" })
2161
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2162
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m7 15 5 5 5-5" }),
2163
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m7 9 5-5 5 5" })
2071
2164
  ] });
2072
2165
  }
2073
2166
  function CornerDownRightIcon(props) {
2074
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2075
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: "15 10 20 15 15 20" }),
2076
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 4v7a4 4 0 0 0 4 4h12" })
2167
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2168
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "15 10 20 15 15 20" }),
2169
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 4v7a4 4 0 0 0 4 4h12" })
2077
2170
  ] });
2078
2171
  }
2079
2172
  function TagIcon(props) {
2080
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2081
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" }),
2082
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" })
2173
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2174
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" }),
2175
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" })
2083
2176
  ] });
2084
2177
  }
2085
2178
  function DefaultEntityIcon(props) {
2086
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2087
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z" }),
2088
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m7 16.5-4.74-2.85" }),
2089
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m7 16.5 5-3" }),
2090
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M7 16.5v5.17" }),
2091
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z" }),
2092
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m17 16.5-5-3" }),
2093
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m17 16.5 4.74-2.85" }),
2094
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M17 16.5v5.17" }),
2095
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z" }),
2096
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 8 7.26 5.15" }),
2097
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m12 8 4.74-2.85" }),
2098
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 13.5V8" })
2179
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2180
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z" }),
2181
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m7 16.5-4.74-2.85" }),
2182
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m7 16.5 5-3" }),
2183
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M7 16.5v5.17" }),
2184
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z" }),
2185
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m17 16.5-5-3" }),
2186
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m17 16.5 4.74-2.85" }),
2187
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M17 16.5v5.17" }),
2188
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z" }),
2189
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 8 7.26 5.15" }),
2190
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m12 8 4.74-2.85" }),
2191
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 13.5V8" })
2099
2192
  ] });
2100
2193
  }
2101
2194
  function MaximizeIcon(props) {
2102
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2103
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M15 3h6v6" }),
2104
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M9 21H3v-6" }),
2105
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 3l-7 7" }),
2106
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 21l7-7" })
2195
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2196
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M15 3h6v6" }),
2197
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9 21H3v-6" }),
2198
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 3l-7 7" }),
2199
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 21l7-7" })
2107
2200
  ] });
2108
2201
  }
2109
2202
  function RestoreIcon(props) {
2110
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2111
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 14h6v6" }),
2112
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M20 10h-6V4" }),
2113
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M14 10l7-7" }),
2114
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 21l7-7" })
2203
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2204
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 14h6v6" }),
2205
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M20 10h-6V4" }),
2206
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M14 10l7-7" }),
2207
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 21l7-7" })
2115
2208
  ] });
2116
2209
  }
2117
2210
  function GripResizeIcon(props) {
2118
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(props), children: [
2119
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 15 15 21" }),
2120
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 20 20 21" })
2211
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
2212
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 15 15 21" }),
2213
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 20 20 21" })
2121
2214
  ] });
2122
2215
  }
2123
2216
 
2124
2217
  // src/react/components/DefaultWindowShell.tsx
2125
- var import_jsx_runtime4 = require("react/jsx-runtime");
2218
+ var import_jsx_runtime5 = require("react/jsx-runtime");
2126
2219
  var DEFAULT_WIDTH = 440;
2127
2220
  var DEFAULT_HEIGHT = 580;
2128
2221
  var MIN_WIDTH = 330;
@@ -2245,7 +2338,7 @@ function DefaultWindowShell({
2245
2338
  height: rect.height
2246
2339
  };
2247
2340
  return (0, import_react_dom.createPortal)(
2248
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2341
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2249
2342
  "div",
2250
2343
  {
2251
2344
  ref: panelRef,
@@ -2253,7 +2346,7 @@ function DefaultWindowShell({
2253
2346
  "aria-labelledby": labelId,
2254
2347
  tabIndex: -1,
2255
2348
  style,
2256
- className: (0, import_design_system.cn)(
2349
+ className: (0, import_design_system2.cn)(
2257
2350
  // Non-modal by design: no backdrop element exists, so the page
2258
2351
  // behind keeps every click. `pointer-events-auto` re-asserts our
2259
2352
  // own subtree in case a Radix surface left <body> inert.
@@ -2262,7 +2355,7 @@ function DefaultWindowShell({
2262
2355
  className
2263
2356
  ),
2264
2357
  children: [
2265
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2358
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2266
2359
  "header",
2267
2360
  {
2268
2361
  onPointerDown: beginGesture("move"),
@@ -2272,24 +2365,24 @@ function DefaultWindowShell({
2272
2365
  onDoubleClick: () => {
2273
2366
  if (!isMobile) setMaximized((v) => !v);
2274
2367
  },
2275
- className: (0, import_design_system.cn)(
2368
+ className: (0, import_design_system2.cn)(
2276
2369
  "flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2 select-none",
2277
2370
  isMobile ? "" : "cursor-move touch-none"
2278
2371
  ),
2279
2372
  children: [
2280
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2373
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2281
2374
  "span",
2282
2375
  {
2283
2376
  id: labelId,
2284
2377
  className: "flex min-w-0 items-center gap-1.5 text-sm font-medium text-foreground",
2285
2378
  children: [
2286
2379
  icon,
2287
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "truncate", children: title })
2380
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate", children: title })
2288
2381
  ]
2289
2382
  }
2290
2383
  ),
2291
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "flex shrink-0 items-center gap-0.5", children: [
2292
- isMobile ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2384
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex shrink-0 items-center gap-0.5", children: [
2385
+ isMobile ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2293
2386
  "button",
2294
2387
  {
2295
2388
  type: "button",
@@ -2297,10 +2390,10 @@ function DefaultWindowShell({
2297
2390
  onClick: () => setMaximized((v) => !v),
2298
2391
  "aria-label": maximized ? "Restore window" : "Maximize window",
2299
2392
  className: "flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
2300
- children: maximized ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RestoreIcon, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MaximizeIcon, { className: "h-3.5 w-3.5" })
2393
+ children: maximized ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RestoreIcon, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MaximizeIcon, { className: "h-3.5 w-3.5" })
2301
2394
  }
2302
2395
  ),
2303
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2396
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2304
2397
  "button",
2305
2398
  {
2306
2399
  type: "button",
@@ -2308,15 +2401,15 @@ function DefaultWindowShell({
2308
2401
  onClick: onClose,
2309
2402
  "aria-label": "Close",
2310
2403
  className: "flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
2311
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(XIcon, { className: "h-3.5 w-3.5" })
2404
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(XIcon, { className: "h-3.5 w-3.5" })
2312
2405
  }
2313
2406
  )
2314
2407
  ] })
2315
2408
  ]
2316
2409
  }
2317
2410
  ),
2318
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "min-h-0 flex-1 overflow-hidden", children }),
2319
- isMobile || maximized ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2411
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "min-h-0 flex-1 overflow-hidden", children }),
2412
+ isMobile || maximized ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2320
2413
  "button",
2321
2414
  {
2322
2415
  type: "button",
@@ -2326,7 +2419,7 @@ function DefaultWindowShell({
2326
2419
  onPointerUp: endGesture,
2327
2420
  onPointerCancel: endGesture,
2328
2421
  className: "absolute bottom-0 right-0 flex h-4 w-4 cursor-nwse-resize touch-none items-center justify-center text-muted-foreground/60 hover:text-foreground",
2329
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GripResizeIcon, { className: "h-3 w-3" })
2422
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GripResizeIcon, { className: "h-3 w-3" })
2330
2423
  }
2331
2424
  )
2332
2425
  ]
@@ -2337,7 +2430,7 @@ function DefaultWindowShell({
2337
2430
  }
2338
2431
 
2339
2432
  // src/react/components/AssociationWindow.tsx
2340
- var import_jsx_runtime5 = require("react/jsx-runtime");
2433
+ var import_jsx_runtime6 = require("react/jsx-runtime");
2341
2434
  function AssociationWindow({
2342
2435
  open,
2343
2436
  onClose,
@@ -2350,16 +2443,16 @@ function AssociationWindow({
2350
2443
  const instanceId = (0, import_react12.useId)();
2351
2444
  const { windowShell } = useAssociationsUiPorts();
2352
2445
  if (!open) return null;
2353
- const body = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex h-full min-h-0 flex-col gap-2 p-3", children: [
2354
- subtitle ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "shrink-0 text-xs text-muted-foreground", children: subtitle }) : null,
2446
+ const body = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex h-full min-h-0 flex-col gap-2 p-3", children: [
2447
+ subtitle ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "shrink-0 text-xs text-muted-foreground", children: subtitle }) : null,
2355
2448
  children
2356
2449
  ] });
2357
2450
  const windowId = `association:${scopeId}:${instanceId}`;
2358
2451
  if (windowShell) {
2359
2452
  const HostWindow = windowShell.Window;
2360
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HostWindow, { id: windowId, title, onClose, children: body });
2453
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HostWindow, { id: windowId, title, onClose, children: body });
2361
2454
  }
2362
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2455
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2363
2456
  DefaultWindowShell,
2364
2457
  {
2365
2458
  id: windowId,
@@ -2373,28 +2466,28 @@ function AssociationWindow({
2373
2466
 
2374
2467
  // src/react/components/AssociationPicker.tsx
2375
2468
  var import_react13 = require("react");
2376
- var import_design_system2 = require("@ai-matrx/design-system");
2377
- var import_jsx_runtime6 = require("react/jsx-runtime");
2469
+ var import_design_system3 = require("@ai-matrx/design-system");
2470
+ var import_jsx_runtime7 = require("react/jsx-runtime");
2378
2471
  function AssociationPicker(props) {
2379
2472
  const store = useAssociationsStore();
2380
2473
  const { pickerOverrides } = useAssociationsUiPorts();
2381
2474
  const info = store.registry.getEntityInfo(props.token);
2382
2475
  const Icon = info.Icon ?? DefaultEntityIcon;
2383
2476
  const Override = pickerOverrides?.[props.token];
2384
- if (Override) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Override, { ...props });
2477
+ if (Override) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Override, { ...props });
2385
2478
  const title = `Add ${info.labelPlural}`;
2386
2479
  const subtitle = props.filing ? `File ${props.containerLabel ?? "this"} under a ${info.label.toLowerCase()}` : props.containerLabel ? `Attach to ${props.containerLabel}` : "Click an item to attach or detach it";
2387
2480
  if (!props.open) return null;
2388
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2481
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2389
2482
  AssociationWindow,
2390
2483
  {
2391
2484
  open: props.open,
2392
2485
  onClose: () => props.onOpenChange(false),
2393
2486
  scopeId: `picker:${props.token}`,
2394
2487
  title,
2395
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: "size-3.5 text-primary" }),
2488
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "size-3.5 text-primary" }),
2396
2489
  subtitle,
2397
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2490
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2398
2491
  AssociationCandidateBody,
2399
2492
  {
2400
2493
  token: props.token,
@@ -2419,7 +2512,7 @@ function AssociationCandidateBody({
2419
2512
  onClose
2420
2513
  }) {
2421
2514
  void onClose;
2422
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2515
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2423
2516
  EntityCandidateList,
2424
2517
  {
2425
2518
  token,
@@ -2450,7 +2543,11 @@ function EntityCandidateList({
2450
2543
  enabled,
2451
2544
  ...search.trim() ? { search: search.trim() } : {}
2452
2545
  });
2453
- const { results: recentCandidates, loading: recentsLoading } = useUniversalEntitySearch({
2546
+ const {
2547
+ results: recentCandidates,
2548
+ loading: recentsLoading,
2549
+ failures: recentsFailures
2550
+ } = useUniversalEntitySearch({
2454
2551
  query: "",
2455
2552
  tokens: [token],
2456
2553
  enabled: enabled && !search.trim()
@@ -2475,11 +2572,11 @@ function EntityCandidateList({
2475
2572
  setBusyId(null);
2476
2573
  }
2477
2574
  };
2478
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
2479
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative mb-2", children: [
2480
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SearchIcon, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
2481
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2482
- import_design_system2.Input,
2575
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2576
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative mb-2", children: [
2577
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchIcon, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
2578
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2579
+ import_design_system3.Input,
2483
2580
  {
2484
2581
  value: search,
2485
2582
  onChange: (e) => setSearch(e.target.value),
@@ -2489,46 +2586,58 @@ function EntityCandidateList({
2489
2586
  }
2490
2587
  )
2491
2588
  ] }),
2492
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto -mx-1 px-1", children: (loading || recentsLoading) && visibleCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ListMessage, { children: [
2493
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SpinnerIcon, { className: "h-4 w-4 animate-spin" }),
2494
- "Loading\u2026"
2495
- ] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
2496
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "font-medium", children: "Couldn\u2019t load items" }),
2497
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "opacity-80", children: error }),
2498
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2499
- "button",
2500
- {
2501
- type: "button",
2502
- onClick: reload,
2503
- className: "mt-1 underline hover:no-underline",
2504
- children: "Retry"
2505
- }
2506
- )
2507
- ] }) : visibleCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ListMessage, { children: canCreate ? `Nothing to attach yet \u2014 create a new ${info.label.toLowerCase()} below.` : "Nothing to attach." }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-2", children: [
2508
- visibleRecents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2509
- CandidateSection,
2589
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex-1 min-h-0 overflow-y-auto -mx-1 px-1", children: [
2590
+ !search.trim() && !error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2591
+ SearchFailureNotice,
2510
2592
  {
2511
- label: "Recent",
2512
- candidates: visibleRecents,
2513
- attachedIds,
2514
- busyId,
2515
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
2516
- onToggle: toggle
2593
+ error: null,
2594
+ failures: recentsFailures,
2595
+ operation: `Load recent ${info.labelPlural.toLowerCase()}`,
2596
+ origin: "associations/AssociationPicker",
2597
+ className: "mb-1"
2517
2598
  }
2518
2599
  ),
2519
- ordinaryCandidates.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2520
- CandidateSection,
2521
- {
2522
- label: visibleRecents.length > 0 ? `All ${info.labelPlural}` : null,
2523
- candidates: ordinaryCandidates,
2524
- attachedIds,
2525
- busyId,
2526
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
2527
- onToggle: toggle
2528
- }
2529
- )
2530
- ] }) }),
2531
- canCreate && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2600
+ (loading || recentsLoading) && visibleCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(ListMessage, { children: [
2601
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SpinnerIcon, { className: "h-4 w-4 animate-spin" }),
2602
+ "Loading\u2026"
2603
+ ] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
2604
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "font-medium", children: "Couldn\u2019t load items" }),
2605
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "opacity-80", children: error }),
2606
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2607
+ "button",
2608
+ {
2609
+ type: "button",
2610
+ onClick: reload,
2611
+ className: "mt-1 underline hover:no-underline",
2612
+ children: "Retry"
2613
+ }
2614
+ )
2615
+ ] }) : visibleCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ListMessage, { children: canCreate ? `Nothing to attach yet \u2014 create a new ${info.label.toLowerCase()} below.` : "Nothing to attach." }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
2616
+ visibleRecents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2617
+ CandidateSection,
2618
+ {
2619
+ label: "Recent",
2620
+ candidates: visibleRecents,
2621
+ attachedIds,
2622
+ busyId,
2623
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
2624
+ onToggle: toggle
2625
+ }
2626
+ ),
2627
+ ordinaryCandidates.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2628
+ CandidateSection,
2629
+ {
2630
+ label: visibleRecents.length > 0 ? `All ${info.labelPlural}` : null,
2631
+ candidates: ordinaryCandidates,
2632
+ attachedIds,
2633
+ busyId,
2634
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
2635
+ onToggle: toggle
2636
+ }
2637
+ )
2638
+ ] })
2639
+ ] }),
2640
+ canCreate && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2532
2641
  CreateAndAttachFooter,
2533
2642
  {
2534
2643
  token,
@@ -2548,33 +2657,33 @@ function CandidateSection({
2548
2657
  icon,
2549
2658
  onToggle
2550
2659
  }) {
2551
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "space-y-0.5", children: [
2552
- label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60", children: label }),
2553
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: "space-y-0.5", children: candidates.map((candidate) => {
2660
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "space-y-0.5", children: [
2661
+ label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60", children: label }),
2662
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "space-y-0.5", children: candidates.map((candidate) => {
2554
2663
  const attached = attachedIds.has(candidate.id);
2555
2664
  const busy = busyId === candidate.id;
2556
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
2665
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2557
2666
  "button",
2558
2667
  {
2559
2668
  type: "button",
2560
2669
  disabled: busy,
2561
2670
  onClick: () => void onToggle(candidate.id, candidate.title),
2562
- className: (0, import_design_system2.cn)(
2671
+ className: (0, import_design_system3.cn)(
2563
2672
  "group flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors md:min-h-0",
2564
2673
  "hover:bg-accent disabled:opacity-50",
2565
2674
  attached && "bg-accent/40"
2566
2675
  ),
2567
2676
  children: [
2568
2677
  icon,
2569
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "flex-1 min-w-0 truncate text-foreground", children: candidate.title }),
2570
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2678
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "flex-1 min-w-0 truncate text-foreground", children: candidate.title }),
2679
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2571
2680
  "span",
2572
2681
  {
2573
- className: (0, import_design_system2.cn)(
2682
+ className: (0, import_design_system3.cn)(
2574
2683
  "flex h-5 w-5 items-center justify-center rounded-full shrink-0",
2575
2684
  attached ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground group-hover:border-primary/60"
2576
2685
  ),
2577
- children: busy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : attached ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PlusIcon, { className: "h-3 w-3" })
2686
+ children: busy ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : attached ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PlusIcon, { className: "h-3 w-3" })
2578
2687
  }
2579
2688
  )
2580
2689
  ]
@@ -2630,7 +2739,7 @@ function CreateAndAttachFooter({
2630
2739
  }
2631
2740
  };
2632
2741
  if (!editing) {
2633
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
2742
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2634
2743
  "button",
2635
2744
  {
2636
2745
  type: "button",
@@ -2640,10 +2749,10 @@ function CreateAndAttachFooter({
2640
2749
  },
2641
2750
  className: "mt-2 flex min-h-11 w-full shrink-0 items-center justify-center gap-1.5 rounded-md border border-dashed border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground md:min-h-0",
2642
2751
  children: [
2643
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PlusIcon, { className: "h-4 w-4" }),
2752
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PlusIcon, { className: "h-4 w-4" }),
2644
2753
  "New ",
2645
2754
  info.label,
2646
- seed ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "max-w-40 truncate text-muted-foreground/70", children: [
2755
+ seed ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "max-w-40 truncate text-muted-foreground/70", children: [
2647
2756
  "\u201C",
2648
2757
  seed,
2649
2758
  "\u201D"
@@ -2652,9 +2761,9 @@ function CreateAndAttachFooter({
2652
2761
  }
2653
2762
  );
2654
2763
  }
2655
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mt-2 flex shrink-0 items-center gap-1.5", children: [
2656
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2657
- import_design_system2.Input,
2764
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mt-2 flex shrink-0 items-center gap-1.5", children: [
2765
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2766
+ import_design_system3.Input,
2658
2767
  {
2659
2768
  autoFocus: true,
2660
2769
  value: name,
@@ -2672,17 +2781,17 @@ function CreateAndAttachFooter({
2672
2781
  style: { fontSize: 16 }
2673
2782
  }
2674
2783
  ),
2675
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2784
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2676
2785
  "button",
2677
2786
  {
2678
2787
  type: "button",
2679
2788
  disabled: busy || !name.trim(),
2680
2789
  onClick: () => void submit(),
2681
2790
  className: "flex h-11 items-center gap-1 rounded-md bg-primary px-2.5 text-sm font-medium text-primary-foreground transition-opacity disabled:opacity-50 md:h-8",
2682
- children: busy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : "Create"
2791
+ children: busy ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : "Create"
2683
2792
  }
2684
2793
  ),
2685
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2794
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2686
2795
  "button",
2687
2796
  {
2688
2797
  type: "button",
@@ -2693,37 +2802,37 @@ function CreateAndAttachFooter({
2693
2802
  },
2694
2803
  title: "Cancel",
2695
2804
  className: "flex h-11 w-11 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50 md:h-8 md:w-8",
2696
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(XIcon, { className: "h-4 w-4" })
2805
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(XIcon, { className: "h-4 w-4" })
2697
2806
  }
2698
2807
  )
2699
2808
  ] });
2700
2809
  }
2701
2810
  function ListMessage({ children }) {
2702
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground", children });
2811
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground", children });
2703
2812
  }
2704
2813
 
2705
2814
  // src/react/components/UniversalAssociationPicker.tsx
2706
2815
  var import_react14 = require("react");
2707
- var import_design_system4 = require("@ai-matrx/design-system");
2816
+ var import_design_system5 = require("@ai-matrx/design-system");
2708
2817
 
2709
2818
  // src/react/components/entityDoors.tsx
2710
- var import_design_system3 = require("@ai-matrx/design-system");
2711
- var import_jsx_runtime7 = require("react/jsx-runtime");
2819
+ var import_design_system4 = require("@ai-matrx/design-system");
2820
+ var import_jsx_runtime8 = require("react/jsx-runtime");
2712
2821
  function DoorRef(props) {
2713
2822
  const { onOpen, ...refProps } = props;
2714
2823
  const { entityDoors } = useAssociationsUiPorts();
2715
2824
  const store = useAssociationsStore();
2716
2825
  const HostRef = entityDoors?.EntityRef;
2717
- if (HostRef) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HostRef, { ...refProps });
2826
+ if (HostRef) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HostRef, { ...refProps });
2718
2827
  const name = refProps.name ?? null;
2719
2828
  const href = store.registry.tryGetEntityInfo(refProps.token)?.hrefFor?.(refProps.id) ?? null;
2720
2829
  if (onOpen) {
2721
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2830
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2722
2831
  "button",
2723
2832
  {
2724
2833
  type: "button",
2725
2834
  onClick: onOpen,
2726
- className: (0, import_design_system3.cn)(
2835
+ className: (0, import_design_system4.cn)(
2727
2836
  "min-w-0 truncate text-left underline-offset-2 hover:underline",
2728
2837
  refProps.className
2729
2838
  ),
@@ -2732,30 +2841,30 @@ function DoorRef(props) {
2732
2841
  );
2733
2842
  }
2734
2843
  if (href) {
2735
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2844
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2736
2845
  "a",
2737
2846
  {
2738
2847
  href,
2739
2848
  target: refProps.openInNewTab === false ? void 0 : "_blank",
2740
2849
  rel: "noopener noreferrer",
2741
- className: (0, import_design_system3.cn)(
2850
+ className: (0, import_design_system4.cn)(
2742
2851
  "inline-flex min-w-0 items-center gap-1 truncate underline-offset-2 hover:underline",
2743
2852
  refProps.className
2744
2853
  ),
2745
2854
  children: [
2746
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "min-w-0 truncate", children: name }),
2747
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ExternalLinkIcon, { className: "h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-60" })
2855
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "min-w-0 truncate", children: name }),
2856
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ExternalLinkIcon, { className: "h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-60" })
2748
2857
  ]
2749
2858
  }
2750
2859
  );
2751
2860
  }
2752
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: (0, import_design_system3.cn)("min-w-0 truncate", refProps.className), children: name });
2861
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: (0, import_design_system4.cn)("min-w-0 truncate", refProps.className), children: name });
2753
2862
  }
2754
2863
  function UnresolvedRef({ token, id }) {
2755
2864
  const { entityDoors } = useAssociationsUiPorts();
2756
2865
  const HostUnresolved = entityDoors?.UnresolvedRef;
2757
- if (HostUnresolved) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HostUnresolved, { token, id });
2758
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2866
+ if (HostUnresolved) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HostUnresolved, { token, id });
2867
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2759
2868
  "span",
2760
2869
  {
2761
2870
  className: "inline-flex items-center rounded border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] text-muted-foreground",
@@ -2768,11 +2877,11 @@ function DoorControlsSlot(props) {
2768
2877
  const { entityDoors } = useAssociationsUiPorts();
2769
2878
  const store = useAssociationsStore();
2770
2879
  const HostControls = entityDoors?.DoorControls;
2771
- if (HostControls) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HostControls, { ...props });
2880
+ if (HostControls) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HostControls, { ...props });
2772
2881
  const href = store.registry.tryGetEntityInfo(props.token)?.hrefFor?.(props.id) ?? null;
2773
2882
  if (!href) return null;
2774
2883
  const label = props.name ? `Open ${props.name}` : `Open this ${props.token}`;
2775
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2884
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2776
2885
  "a",
2777
2886
  {
2778
2887
  href,
@@ -2780,17 +2889,17 @@ function DoorControlsSlot(props) {
2780
2889
  rel: "noopener noreferrer",
2781
2890
  "aria-label": label,
2782
2891
  title: label,
2783
- className: (0, import_design_system3.cn)(
2892
+ className: (0, import_design_system4.cn)(
2784
2893
  "inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
2785
2894
  props.className
2786
2895
  ),
2787
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ExternalLinkIcon, { className: "h-3 w-3" })
2896
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ExternalLinkIcon, { className: "h-3 w-3" })
2788
2897
  }
2789
2898
  );
2790
2899
  }
2791
2900
 
2792
2901
  // src/react/components/UniversalAssociationPicker.tsx
2793
- var import_jsx_runtime8 = require("react/jsx-runtime");
2902
+ var import_jsx_runtime9 = require("react/jsx-runtime");
2794
2903
  function attachedKey(token, id) {
2795
2904
  return `${token}:${id}`;
2796
2905
  }
@@ -2799,7 +2908,6 @@ function UniversalAssociationPicker(props) {
2799
2908
  attachedKeys,
2800
2909
  onAttach,
2801
2910
  onDetach,
2802
- ownerId,
2803
2911
  orgId,
2804
2912
  emptyQueryMode = "recents",
2805
2913
  className
@@ -2813,10 +2921,9 @@ function UniversalAssociationPicker(props) {
2813
2921
  const [busyKey, setBusyKey] = (0, import_react14.useState)(null);
2814
2922
  const [overrideOpen, setOverrideOpen] = (0, import_react14.useState)(false);
2815
2923
  const [overrideMount, setOverrideMount] = (0, import_react14.useState)(0);
2816
- const { results, loading, source } = useUniversalEntitySearch({
2924
+ const { results, loading, source, failures, error } = useUniversalEntitySearch({
2817
2925
  query,
2818
2926
  tokens,
2819
- ownerId: ownerId ?? null,
2820
2927
  enabled: browseToken === null,
2821
2928
  emptyQueryMode
2822
2929
  });
@@ -2847,11 +2954,11 @@ function UniversalAssociationPicker(props) {
2847
2954
  groups.set(r.token, list);
2848
2955
  }
2849
2956
  const BrowseOverride = browseToken ? pickerOverrides?.[browseToken] : void 0;
2850
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_design_system4.cn)("flex min-h-0 flex-1 flex-col gap-2", className), children: [
2851
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
2852
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SearchIcon, { className: "absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2853
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2854
- import_design_system4.Input,
2957
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_design_system5.cn)("flex min-h-0 flex-1 flex-col gap-2", className), children: [
2958
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
2959
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SearchIcon, { className: "absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2960
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2961
+ import_design_system5.Input,
2855
2962
  {
2856
2963
  value: query,
2857
2964
  onChange: (e) => {
@@ -2863,9 +2970,9 @@ function UniversalAssociationPicker(props) {
2863
2970
  style: { fontSize: 16 }
2864
2971
  }
2865
2972
  ),
2866
- loading && browseToken === null && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SpinnerIcon, { className: "absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin text-muted-foreground" })
2973
+ loading && browseToken === null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SpinnerIcon, { className: "absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin text-muted-foreground" })
2867
2974
  ] }),
2868
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2975
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2869
2976
  "div",
2870
2977
  {
2871
2978
  role: "group",
@@ -2875,18 +2982,18 @@ function UniversalAssociationPicker(props) {
2875
2982
  const info = store.registry.getEntityInfo(t);
2876
2983
  const ChipIcon = info.Icon ?? DefaultEntityIcon;
2877
2984
  const active = browseToken === t;
2878
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2985
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2879
2986
  "button",
2880
2987
  {
2881
2988
  type: "button",
2882
2989
  "aria-pressed": active,
2883
2990
  onClick: () => selectToken(active ? null : t),
2884
- className: (0, import_design_system4.cn)(
2991
+ className: (0, import_design_system5.cn)(
2885
2992
  "inline-flex shrink-0 items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] transition-colors",
2886
2993
  active ? "border-primary/50 bg-primary/10 text-foreground" : "border-border text-muted-foreground hover:text-foreground hover:bg-accent"
2887
2994
  ),
2888
2995
  children: [
2889
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChipIcon, { className: "h-3 w-3" }),
2996
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChipIcon, { className: "h-3 w-3" }),
2890
2997
  info.labelPlural
2891
2998
  ]
2892
2999
  },
@@ -2899,18 +3006,18 @@ function UniversalAssociationPicker(props) {
2899
3006
  // The token's canonical host picker (e.g. the stored-files browser)
2900
3007
  // owns per-token browsing when registered — never a plain list twin.
2901
3008
  // It opens in its own window; this body says where it went.
2902
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3009
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2903
3010
  "div",
2904
3011
  {
2905
3012
  role: "region",
2906
3013
  "aria-label": `${store.registry.getEntityInfo(browseToken).labelPlural} window`,
2907
3014
  className: "flex flex-1 flex-col items-center justify-center gap-3 px-4 py-8 text-center",
2908
3015
  children: [
2909
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-sm text-foreground", children: overrideOpen ? `The ${store.registry.getEntityInfo(browseToken).labelPlural.toLowerCase()} window is open.` : `The ${store.registry.getEntityInfo(browseToken).labelPlural.toLowerCase()} window is closed.` }),
2910
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "max-w-xs text-[12px] text-muted-foreground", children: overrideOpen ? "Check items there to attach them; uncheck to detach. Changes save as you go." : "Reopen it to pick more, or go back to search everything." }),
2911
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [
2912
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2913
- import_design_system4.Button,
3016
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm text-foreground", children: overrideOpen ? `The ${store.registry.getEntityInfo(browseToken).labelPlural.toLowerCase()} window is open.` : `The ${store.registry.getEntityInfo(browseToken).labelPlural.toLowerCase()} window is closed.` }),
3017
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "max-w-xs text-[12px] text-muted-foreground", children: overrideOpen ? "Check items there to attach them; uncheck to detach. Changes save as you go." : "Reopen it to pick more, or go back to search everything." }),
3018
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [
3019
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3020
+ import_design_system5.Button,
2914
3021
  {
2915
3022
  type: "button",
2916
3023
  size: "sm",
@@ -2920,13 +3027,13 @@ function UniversalAssociationPicker(props) {
2920
3027
  setOverrideMount((n) => n + 1);
2921
3028
  },
2922
3029
  children: [
2923
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MaximizeIcon, { className: "mr-1.5 h-3.5 w-3.5" }),
3030
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MaximizeIcon, { className: "mr-1.5 h-3.5 w-3.5" }),
2924
3031
  overrideOpen ? "Bring window to front" : "Reopen window"
2925
3032
  ]
2926
3033
  }
2927
3034
  ),
2928
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2929
- import_design_system4.Button,
3035
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3036
+ import_design_system5.Button,
2930
3037
  {
2931
3038
  type: "button",
2932
3039
  size: "sm",
@@ -2936,7 +3043,7 @@ function UniversalAssociationPicker(props) {
2936
3043
  }
2937
3044
  )
2938
3045
  ] }),
2939
- overrideOpen && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3046
+ overrideOpen && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2940
3047
  BrowseOverride,
2941
3048
  {
2942
3049
  open: true,
@@ -2956,7 +3063,7 @@ function UniversalAssociationPicker(props) {
2956
3063
  ]
2957
3064
  }
2958
3065
  )
2959
- ) : browseToken ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3066
+ ) : browseToken ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2960
3067
  AssociationCandidateBody,
2961
3068
  {
2962
3069
  token: browseToken,
@@ -2969,62 +3076,79 @@ function UniversalAssociationPicker(props) {
2969
3076
  onAttach: (id, title) => onAttach(browseToken, id, title),
2970
3077
  onDetach: (id) => onDetach(browseToken, id)
2971
3078
  }
2972
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3079
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2973
3080
  "div",
2974
3081
  {
2975
3082
  role: "region",
2976
3083
  "aria-label": "Association search results",
2977
3084
  className: "-mx-1 min-h-24 flex-1 overflow-y-auto overscroll-contain px-1",
2978
- children: results.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "py-6 text-center text-[12px] text-muted-foreground", children: loading ? "Searching\u2026" : query.trim() ? "No matches \u2014 narrow with a type chip to browse." : "Nothing to attach yet. Type to search, or pick a type to browse." }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2", children: [
2979
- source !== "search" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60", children: source === "recents" ? "Recent" : "Browse" }),
3085
+ children: error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3086
+ SearchFailureNotice,
3087
+ {
3088
+ error,
3089
+ failures,
3090
+ operation: "Search to attach",
3091
+ origin: "associations/UniversalAssociationPicker"
3092
+ }
3093
+ ) : results.length === 0 && failures.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "py-6 text-center text-[12px] text-muted-foreground", children: loading ? "Searching\u2026" : query.trim() ? "No matches \u2014 narrow with a type chip to browse." : "Nothing to attach yet. Type to search, or pick a type to browse." }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-2", children: [
3094
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3095
+ SearchFailureNotice,
3096
+ {
3097
+ error: null,
3098
+ failures,
3099
+ operation: "Search to attach",
3100
+ origin: "associations/UniversalAssociationPicker"
3101
+ }
3102
+ ),
3103
+ source !== "search" && results.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60", children: source === "recents" ? "Recent" : "Browse" }),
2980
3104
  [...groups.entries()].map(([token, items]) => {
2981
3105
  const info = store.registry.getEntityInfo(token);
2982
3106
  const GroupIcon = info.Icon ?? DefaultEntityIcon;
2983
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-0.5", children: [
2984
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "flex items-center gap-1 px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70", children: [
2985
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(GroupIcon, { className: "h-3 w-3" }),
3107
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-0.5", children: [
3108
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "flex items-center gap-1 px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70", children: [
3109
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GroupIcon, { className: "h-3 w-3" }),
2986
3110
  info.labelPlural
2987
3111
  ] }),
2988
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "space-y-0.5", children: items.map((c) => {
3112
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "space-y-0.5", children: items.map((c) => {
2989
3113
  const key = attachedKey(c.token, c.id);
2990
3114
  const attached = attachedKeys.has(key);
2991
3115
  const busy = busyKey === key;
2992
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3116
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2993
3117
  "li",
2994
3118
  {
2995
- className: (0, import_design_system4.cn)(
3119
+ className: (0, import_design_system5.cn)(
2996
3120
  "group/entity-ref group flex items-center gap-1 rounded-md pr-1.5 transition-colors",
2997
3121
  "hover:bg-accent",
2998
3122
  attached && "bg-accent/40"
2999
3123
  ),
3000
3124
  children: [
3001
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3125
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3002
3126
  "button",
3003
3127
  {
3004
3128
  type: "button",
3005
3129
  disabled: busy,
3006
3130
  onClick: () => toggle(c),
3007
3131
  title: attached ? `Detach "${c.title}"` : `Attach "${c.title}"`,
3008
- className: (0, import_design_system4.cn)(
3132
+ className: (0, import_design_system5.cn)(
3009
3133
  "flex min-w-0 flex-1 items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm",
3010
3134
  "disabled:opacity-50"
3011
3135
  ),
3012
3136
  children: [
3013
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "min-w-0 flex-1 truncate text-foreground", children: c.title }),
3014
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3137
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 flex-1 truncate text-foreground", children: c.title }),
3138
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3015
3139
  "span",
3016
3140
  {
3017
- className: (0, import_design_system4.cn)(
3141
+ className: (0, import_design_system5.cn)(
3018
3142
  "flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
3019
3143
  attached ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground group-hover:border-primary/60"
3020
3144
  ),
3021
- children: busy ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : attached ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PlusIcon, { className: "h-3 w-3" })
3145
+ children: busy ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : attached ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PlusIcon, { className: "h-3 w-3" })
3022
3146
  }
3023
3147
  )
3024
3148
  ]
3025
3149
  }
3026
3150
  ),
3027
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3151
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3028
3152
  DoorControlsSlot,
3029
3153
  {
3030
3154
  token: c.token,
@@ -3047,8 +3171,8 @@ function UniversalAssociationPicker(props) {
3047
3171
 
3048
3172
  // src/react/components/AttachedItemsSheet.tsx
3049
3173
  var import_react15 = require("react");
3050
- var import_design_system5 = require("@ai-matrx/design-system");
3051
- var import_jsx_runtime9 = require("react/jsx-runtime");
3174
+ var import_design_system6 = require("@ai-matrx/design-system");
3175
+ var import_jsx_runtime10 = require("react/jsx-runtime");
3052
3176
  function metadataIsPinned(metadata) {
3053
3177
  return metadata !== null && typeof metadata === "object" && !Array.isArray(metadata) && Reflect.get(metadata, "pinned") === true;
3054
3178
  }
@@ -3059,9 +3183,9 @@ function AttachedItemsSheet(props) {
3059
3183
  const title = info.labelPlural;
3060
3184
  const containerName = props.container?.label ?? props.containerLabel;
3061
3185
  const filing = props.container?.direction === "outgoing";
3062
- const subtitle = props.container ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "inline-flex min-w-0 max-w-full items-center gap-1", children: [
3186
+ const subtitle = props.container ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "inline-flex min-w-0 max-w-full items-center gap-1", children: [
3063
3187
  filing ? "What this is filed under:" : "Attached to",
3064
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3188
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3065
3189
  DoorRef,
3066
3190
  {
3067
3191
  token: props.container.type,
@@ -3072,16 +3196,16 @@ function AttachedItemsSheet(props) {
3072
3196
  )
3073
3197
  ] }) : props.containerLabel ? `Attached to ${props.containerLabel}` : "Attached items";
3074
3198
  if (!props.open) return null;
3075
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3199
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3076
3200
  AssociationWindow,
3077
3201
  {
3078
3202
  open: props.open,
3079
3203
  onClose: () => props.onOpenChange(false),
3080
3204
  scopeId: `attached:${props.token}`,
3081
3205
  title,
3082
- icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { className: "size-3.5 text-primary" }),
3206
+ icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { className: "size-3.5 text-primary" }),
3083
3207
  subtitle,
3084
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3208
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3085
3209
  AttachedItemsBody,
3086
3210
  {
3087
3211
  token: props.token,
@@ -3170,31 +3294,31 @@ function AttachedItemsBody({
3170
3294
  setBusyId(null);
3171
3295
  }
3172
3296
  };
3173
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
3174
- titleError ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
3297
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3298
+ titleError ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
3175
3299
  "Showing names recorded at attach time \u2014 they may be out of date.",
3176
3300
  " ",
3177
3301
  titleError
3178
3302
  ] }) : null,
3179
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto -mx-1 px-1", children: links.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center justify-center py-8 text-[13px] text-muted-foreground", children: "Nothing attached yet." }) : titles === null ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground", children: [
3180
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SpinnerIcon, { className: "h-4 w-4 animate-spin" }),
3303
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto -mx-1 px-1", children: links.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-center justify-center py-8 text-[13px] text-muted-foreground", children: "Nothing attached yet." }) : titles === null ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground", children: [
3304
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SpinnerIcon, { className: "h-4 w-4 animate-spin" }),
3181
3305
  "Loading\u2026"
3182
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "space-y-0.5", children: links.map((link) => {
3306
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "space-y-0.5", children: links.map((link) => {
3183
3307
  const resolved = titles.get(link.resourceId);
3184
3308
  const missing = !titles.has(link.resourceId);
3185
3309
  const name = resolved ?? link.label ?? (missing ? null : "Untitled");
3186
3310
  const busy = busyId === link.resourceId;
3187
3311
  const pinned = metadataIsPinned(link.metadata);
3188
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3312
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3189
3313
  "li",
3190
3314
  {
3191
3315
  className: "group/entity-ref group flex items-center gap-2 rounded-md px-2.5 py-2 text-sm transition-colors hover:bg-accent",
3192
3316
  children: [
3193
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
3194
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "flex-1 min-w-0 truncate", children: name === null ? (
3317
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
3318
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex-1 min-w-0 truncate", children: name === null ? (
3195
3319
  // The X beside the row stays the one-click detach.
3196
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(UnresolvedRef, { token, id: link.resourceId })
3197
- ) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3320
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UnresolvedRef, { token, id: link.resourceId })
3321
+ ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3198
3322
  DoorRef,
3199
3323
  {
3200
3324
  token,
@@ -3204,7 +3328,7 @@ function AttachedItemsBody({
3204
3328
  className: "text-foreground"
3205
3329
  }
3206
3330
  ) }),
3207
- onSetPinned ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3331
+ onSetPinned ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3208
3332
  "button",
3209
3333
  {
3210
3334
  type: "button",
@@ -3212,14 +3336,14 @@ function AttachedItemsBody({
3212
3336
  onClick: () => void setPinned(link, !pinned),
3213
3337
  title: pinned ? "Unpin (stops staying in agent context)" : "Pin \u2014 always in agent context",
3214
3338
  "aria-label": pinned ? "Unpin" : "Pin",
3215
- className: (0, import_design_system5.cn)(
3339
+ className: (0, import_design_system6.cn)(
3216
3340
  "flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",
3217
3341
  pinned ? "text-primary" : "text-muted-foreground"
3218
3342
  ),
3219
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3343
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3220
3344
  PinIcon,
3221
3345
  {
3222
- className: (0, import_design_system5.cn)(
3346
+ className: (0, import_design_system6.cn)(
3223
3347
  "h-3.5 w-3.5",
3224
3348
  pinned && "fill-primary/20"
3225
3349
  )
@@ -3227,18 +3351,18 @@ function AttachedItemsBody({
3227
3351
  )
3228
3352
  }
3229
3353
  ) : null,
3230
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3354
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3231
3355
  "button",
3232
3356
  {
3233
3357
  type: "button",
3234
3358
  disabled: busy,
3235
3359
  onClick: () => void detach(link),
3236
3360
  title: "Detach",
3237
- className: (0, import_design_system5.cn)(
3361
+ className: (0, import_design_system6.cn)(
3238
3362
  "flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors",
3239
3363
  "hover:bg-destructive/10 hover:text-destructive disabled:opacity-50"
3240
3364
  ),
3241
- children: busy ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(XIcon, { className: "h-3.5 w-3.5" })
3365
+ children: busy ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(XIcon, { className: "h-3.5 w-3.5" })
3242
3366
  }
3243
3367
  )
3244
3368
  ]
@@ -3246,14 +3370,14 @@ function AttachedItemsBody({
3246
3370
  link.edgeId
3247
3371
  );
3248
3372
  }) }) }),
3249
- onAdd ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3373
+ onAdd ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3250
3374
  "button",
3251
3375
  {
3252
3376
  type: "button",
3253
3377
  onClick: onAdd,
3254
3378
  className: "mt-2 flex w-full items-center justify-center gap-1.5 rounded-md border border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground",
3255
3379
  children: [
3256
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PlusIcon, { className: "h-4 w-4" }),
3380
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PlusIcon, { className: "h-4 w-4" }),
3257
3381
  "Attach ",
3258
3382
  info.labelPlural.toLowerCase()
3259
3383
  ]
@@ -3264,7 +3388,7 @@ function AttachedItemsBody({
3264
3388
 
3265
3389
  // src/react/components/AssociationCard.tsx
3266
3390
  var import_react16 = require("react");
3267
- var import_design_system6 = require("@ai-matrx/design-system");
3391
+ var import_design_system7 = require("@ai-matrx/design-system");
3268
3392
 
3269
3393
  // src/react/contentRoles.ts
3270
3394
  var CONTENT_ROLES = [
@@ -3314,7 +3438,7 @@ function getContentRoleMeta(role) {
3314
3438
  }
3315
3439
 
3316
3440
  // src/react/components/AssociationCard.tsx
3317
- var import_jsx_runtime10 = require("react/jsx-runtime");
3441
+ var import_jsx_runtime11 = require("react/jsx-runtime");
3318
3442
  function AssociationCard({
3319
3443
  token,
3320
3444
  container: containerProp,
@@ -3350,58 +3474,58 @@ function AssociationCard({
3350
3474
  const filing = container.direction === "outgoing";
3351
3475
  const canAttach = info.canListCandidates && (!filing || isAssociationTargetType(token));
3352
3476
  const canDrillIn = count > 0;
3353
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3354
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3477
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
3478
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3355
3479
  "div",
3356
3480
  {
3357
- className: (0, import_design_system6.cn)(
3481
+ className: (0, import_design_system7.cn)(
3358
3482
  "group relative flex items-center gap-3 overflow-hidden rounded-xl border border-border bg-card transition-all hover:border-primary/30 hover:bg-accent/40",
3359
3483
  className
3360
3484
  ),
3361
3485
  children: [
3362
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3486
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3363
3487
  "span",
3364
3488
  {
3365
- className: (0, import_design_system6.cn)(
3489
+ className: (0, import_design_system7.cn)(
3366
3490
  "absolute inset-x-0 top-0 h-0.5 opacity-60",
3367
3491
  role.accentBar
3368
3492
  )
3369
3493
  }
3370
3494
  ),
3371
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3495
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3372
3496
  "button",
3373
3497
  {
3374
3498
  type: "button",
3375
3499
  disabled: !canDrillIn,
3376
3500
  onClick: () => setListOpen(true),
3377
3501
  title: canDrillIn ? `View the ${info.labelPlural.toLowerCase()} attached to ${container.label ?? "this"}` : void 0,
3378
- className: (0, import_design_system6.cn)(
3502
+ className: (0, import_design_system7.cn)(
3379
3503
  "flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-left",
3380
3504
  canDrillIn ? "cursor-pointer" : "cursor-default"
3381
3505
  ),
3382
3506
  children: [
3383
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3507
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3384
3508
  "span",
3385
3509
  {
3386
- className: (0, import_design_system6.cn)(
3510
+ className: (0, import_design_system7.cn)(
3387
3511
  "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",
3388
3512
  role.accentBg,
3389
3513
  role.accentText
3390
3514
  ),
3391
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { className: "h-4 w-4" })
3515
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { className: "h-4 w-4" })
3392
3516
  }
3393
3517
  ),
3394
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "min-w-0 flex-1", children: [
3395
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "block truncate text-sm font-medium text-foreground", children: info.labelPlural }),
3396
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "block text-[11px] text-muted-foreground tabular-nums", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "inline-flex items-center gap-1", children: [
3397
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }),
3518
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "min-w-0 flex-1", children: [
3519
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "block truncate text-sm font-medium text-foreground", children: info.labelPlural }),
3520
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "block text-[11px] text-muted-foreground tabular-nums", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "inline-flex items-center gap-1", children: [
3521
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }),
3398
3522
  "Loading\u2026"
3399
3523
  ] }) : `${count} ${container.direction === "outgoing" ? "filed under" : "attached"}` })
3400
3524
  ] })
3401
3525
  ]
3402
3526
  }
3403
3527
  ),
3404
- canAttach && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3528
+ canAttach && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3405
3529
  "button",
3406
3530
  {
3407
3531
  type: "button",
@@ -3409,13 +3533,13 @@ function AssociationCard({
3409
3533
  "aria-label": `Attach ${info.labelPlural.toLowerCase()}`,
3410
3534
  title: `Attach ${info.labelPlural.toLowerCase()}`,
3411
3535
  className: "mr-2 flex h-11 w-11 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground lg:mr-3 lg:h-7 lg:w-7",
3412
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PlusIcon, { className: "h-4 w-4" })
3536
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PlusIcon, { className: "h-4 w-4" })
3413
3537
  }
3414
3538
  )
3415
3539
  ]
3416
3540
  }
3417
3541
  ),
3418
- listOpen && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3542
+ listOpen && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3419
3543
  AttachedItemsSheet,
3420
3544
  {
3421
3545
  open: listOpen,
@@ -3434,7 +3558,7 @@ function AssociationCard({
3434
3558
  onSetPinned: (resourceId, pinned, role2) => setPinned(token, resourceId, pinned, role2 ?? void 0)
3435
3559
  }
3436
3560
  ),
3437
- canAttach && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3561
+ canAttach && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3438
3562
  AssociationPicker,
3439
3563
  {
3440
3564
  open,
@@ -3452,8 +3576,8 @@ function AssociationCard({
3452
3576
  }
3453
3577
 
3454
3578
  // src/react/components/AssociationCardGrid.tsx
3455
- var import_design_system7 = require("@ai-matrx/design-system");
3456
- var import_jsx_runtime11 = require("react/jsx-runtime");
3579
+ var import_design_system8 = require("@ai-matrx/design-system");
3580
+ var import_jsx_runtime12 = require("react/jsx-runtime");
3457
3581
  function AssociationCardGrid({
3458
3582
  tokens,
3459
3583
  excludeTokens,
@@ -3479,42 +3603,42 @@ function AssociationCardGrid({
3479
3603
  const role = store.registry.getEntityInfo(token).contentRole;
3480
3604
  return !role || !roleIds.has(role);
3481
3605
  }) : [];
3482
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: (0, import_design_system7.cn)("space-y-5", className), children: [
3606
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_design_system8.cn)("space-y-5", className), children: [
3483
3607
  CONTENT_ROLES.map((role) => {
3484
3608
  const inRole = list.filter(
3485
3609
  (token) => store.registry.getEntityInfo(token).contentRole === role.id
3486
3610
  );
3487
3611
  if (inRole.length === 0) return null;
3488
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { children: [
3489
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
3490
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
3491
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3612
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { children: [
3613
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
3614
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
3615
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3492
3616
  "span",
3493
3617
  {
3494
- className: (0, import_design_system7.cn)("h-2.5 w-2.5 rounded-full", role.accentBar)
3618
+ className: (0, import_design_system8.cn)("h-2.5 w-2.5 rounded-full", role.accentBar)
3495
3619
  }
3496
3620
  ),
3497
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: role.title })
3621
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: role.title })
3498
3622
  ] }),
3499
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "hidden text-xs text-muted-foreground sm:block", children: role.tagline })
3623
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "hidden text-xs text-muted-foreground sm:block", children: role.tagline })
3500
3624
  ] }),
3501
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: inRole.map((token) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AssociationCard, { token }, token)) })
3625
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: inRole.map((token) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AssociationCard, { token }, token)) })
3502
3626
  ] }, role.id);
3503
3627
  }),
3504
- roleless.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { children: [
3505
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
3506
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: "Filed under" }),
3507
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "hidden text-xs text-muted-foreground sm:block", children: "Libraries, topics and other places this is kept." })
3628
+ roleless.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { children: [
3629
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
3630
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: "Filed under" }),
3631
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "hidden text-xs text-muted-foreground sm:block", children: "Libraries, topics and other places this is kept." })
3508
3632
  ] }),
3509
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: roleless.map((token) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AssociationCard, { token }, token)) })
3633
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: roleless.map((token) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AssociationCard, { token }, token)) })
3510
3634
  ] })
3511
3635
  ] });
3512
3636
  }
3513
3637
 
3514
3638
  // src/react/components/AssociationList.tsx
3515
3639
  var import_react17 = require("react");
3516
- var import_design_system8 = require("@ai-matrx/design-system");
3517
- var import_jsx_runtime12 = require("react/jsx-runtime");
3640
+ var import_design_system9 = require("@ai-matrx/design-system");
3641
+ var import_jsx_runtime13 = require("react/jsx-runtime");
3518
3642
  function metadataIsPinned2(metadata) {
3519
3643
  return metadata !== null && typeof metadata === "object" && !Array.isArray(metadata) && Reflect.get(metadata, "pinned") === true;
3520
3644
  }
@@ -3620,40 +3744,40 @@ function AssociationList(props) {
3620
3744
  const grouped = groupRows(store, visibleRows);
3621
3745
  const isLoading = adapter.status === "loading" || adapter.status === "idle";
3622
3746
  const attachableTokens = tokenFilter ?? store.registry.listableTokens();
3623
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_design_system8.cn)("flex flex-col gap-2 text-foreground", props.className), children: [
3624
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between gap-2 px-1", children: [
3625
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("h3", { className: "flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: [
3626
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Link2Icon, { className: "h-3.5 w-3.5" }),
3747
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: (0, import_design_system9.cn)("flex flex-col gap-2 text-foreground", props.className), children: [
3748
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between gap-2 px-1", children: [
3749
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("h3", { className: "flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: [
3750
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link2Icon, { className: "h-3.5 w-3.5" }),
3627
3751
  "Resources",
3628
- visibleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] font-medium text-muted-foreground", children: visibleRows.length })
3752
+ visibleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] font-medium text-muted-foreground", children: visibleRows.length })
3629
3753
  ] }),
3630
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3631
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3754
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3755
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3632
3756
  "button",
3633
3757
  {
3634
3758
  type: "button",
3635
3759
  onClick: () => setShowUniversal((v) => !v),
3636
- className: (0, import_design_system8.cn)(
3760
+ className: (0, import_design_system9.cn)(
3637
3761
  "inline-flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] transition-colors",
3638
3762
  showUniversal ? "bg-accent text-foreground" : "text-muted-foreground hover:bg-accent hover:text-foreground"
3639
3763
  ),
3640
3764
  children: [
3641
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PlusIcon, { className: "h-3 w-3" }),
3765
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PlusIcon, { className: "h-3 w-3" }),
3642
3766
  "Add"
3643
3767
  ]
3644
3768
  }
3645
3769
  ),
3646
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3770
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3647
3771
  "button",
3648
3772
  {
3649
3773
  type: "button",
3650
3774
  onClick: () => void adapter.reload(),
3651
3775
  title: "Refresh",
3652
3776
  className: "text-muted-foreground/60 transition-colors hover:text-foreground",
3653
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3777
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3654
3778
  RefreshIcon,
3655
3779
  {
3656
- className: (0, import_design_system8.cn)(
3780
+ className: (0, import_design_system9.cn)(
3657
3781
  "h-3 w-3",
3658
3782
  adapter.status === "loading" && "animate-spin"
3659
3783
  )
@@ -3663,7 +3787,7 @@ function AssociationList(props) {
3663
3787
  )
3664
3788
  ] })
3665
3789
  ] }),
3666
- showUniversal && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "rounded-md border border-border/60 bg-muted/30 p-2 max-h-80 flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3790
+ showUniversal && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "rounded-md border border-border/60 bg-muted/30 p-2 max-h-80 flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3667
3791
  UniversalAssociationPicker,
3668
3792
  {
3669
3793
  tokens: attachableTokens,
@@ -3673,9 +3797,9 @@ function AssociationList(props) {
3673
3797
  onDetach: (token, id) => adapter.detach(token, id)
3674
3798
  }
3675
3799
  ) }),
3676
- adapter.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-2.5 py-2", children: [
3677
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "truncate text-[11px] text-destructive", children: adapter.error || "Failed to load resources" }),
3678
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3800
+ adapter.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-2.5 py-2", children: [
3801
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate text-[11px] text-destructive", children: adapter.error || "Failed to load resources" }),
3802
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3679
3803
  "button",
3680
3804
  {
3681
3805
  type: "button",
@@ -3685,29 +3809,29 @@ function AssociationList(props) {
3685
3809
  }
3686
3810
  )
3687
3811
  ] }),
3688
- adapter.status !== "error" && isLoading && visibleRows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1.5 px-1", children: [
3689
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system8.Skeleton, { className: "h-3 w-20" }),
3690
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system8.Skeleton, { className: "h-7 w-full rounded-md" }),
3691
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system8.Skeleton, { className: "h-7 w-3/4 rounded-md" })
3812
+ adapter.status !== "error" && isLoading && visibleRows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1.5 px-1", children: [
3813
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_design_system9.Skeleton, { className: "h-3 w-20" }),
3814
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_design_system9.Skeleton, { className: "h-7 w-full rounded-md" }),
3815
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_design_system9.Skeleton, { className: "h-7 w-3/4 rounded-md" })
3692
3816
  ] }),
3693
- adapter.status === "ready" && visibleRows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "px-1 py-1 text-[11px] text-muted-foreground", children: "Nothing attached yet \u2014 use Add to link anything." }),
3694
- visibleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "space-y-2.5", children: grouped.map(({ role, tokens: tokenGroups }) => {
3817
+ adapter.status === "ready" && visibleRows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "px-1 py-1 text-[11px] text-muted-foreground", children: "Nothing attached yet \u2014 use Add to link anything." }),
3818
+ visibleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "space-y-2.5", children: grouped.map(({ role, tokens: tokenGroups }) => {
3695
3819
  const roleMeta = getContentRoleMeta(role);
3696
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1.5", children: [
3697
- variant === "full" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1.5 px-1", children: [
3698
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3820
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1.5", children: [
3821
+ variant === "full" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5 px-1", children: [
3822
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3699
3823
  "span",
3700
3824
  {
3701
- className: (0, import_design_system8.cn)(
3825
+ className: (0, import_design_system9.cn)(
3702
3826
  "h-3 w-0.5 rounded-full",
3703
3827
  roleMeta.accentBar
3704
3828
  )
3705
3829
  }
3706
3830
  ),
3707
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3831
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3708
3832
  "p",
3709
3833
  {
3710
- className: (0, import_design_system8.cn)(
3834
+ className: (0, import_design_system9.cn)(
3711
3835
  "text-[10px] font-semibold uppercase tracking-wider",
3712
3836
  roleMeta.accentText
3713
3837
  ),
@@ -3717,28 +3841,28 @@ function AssociationList(props) {
3717
3841
  ] }),
3718
3842
  tokenGroups.map(({ info, token, rows: tokenRows }) => {
3719
3843
  const TokenIcon = info?.Icon ?? null;
3720
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-0.5", children: [
3721
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between gap-1 px-1", children: [
3722
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "flex items-center gap-1 text-[10px] font-medium text-muted-foreground/80", children: [
3723
- TokenIcon ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TokenIcon, { className: "h-3 w-3" }) : null,
3844
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-0.5", children: [
3845
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between gap-1 px-1", children: [
3846
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "flex items-center gap-1 text-[10px] font-medium text-muted-foreground/80", children: [
3847
+ TokenIcon ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TokenIcon, { className: "h-3 w-3" }) : null,
3724
3848
  info?.labelPlural ?? titleize(token),
3725
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-muted-foreground/50", children: tokenRows.length })
3849
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-muted-foreground/50", children: tokenRows.length })
3726
3850
  ] }),
3727
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
3851
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
3728
3852
  props.renderSectionActions && info ? props.renderSectionActions(info.token) : null,
3729
- info?.canListCandidates && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3853
+ info?.canListCandidates && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3730
3854
  "button",
3731
3855
  {
3732
3856
  type: "button",
3733
3857
  onClick: () => setPickerToken(info.token),
3734
3858
  title: `Add ${info.labelPlural}`,
3735
3859
  className: "rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground",
3736
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PlusIcon, { className: "h-3 w-3" })
3860
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PlusIcon, { className: "h-3 w-3" })
3737
3861
  }
3738
3862
  )
3739
3863
  ] })
3740
3864
  ] }),
3741
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "space-y-0.5", children: tokenRows.map((row) => {
3865
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "space-y-0.5", children: tokenRows.map((row) => {
3742
3866
  const busy = removingKeys.has(row.key);
3743
3867
  const custom = props.renderRow?.(row, {
3744
3868
  title: titleFor({
@@ -3751,12 +3875,12 @@ function AssociationList(props) {
3751
3875
  onOpen: () => openRow(row)
3752
3876
  });
3753
3877
  if (custom != null) {
3754
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { children: custom }, row.key);
3878
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: custom }, row.key);
3755
3879
  }
3756
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3880
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3757
3881
  "div",
3758
3882
  {
3759
- className: (0, import_design_system8.cn)(
3883
+ className: (0, import_design_system9.cn)(
3760
3884
  "group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-accent",
3761
3885
  busy && "opacity-50"
3762
3886
  ),
@@ -3765,7 +3889,7 @@ function AssociationList(props) {
3765
3889
  token: row.token,
3766
3890
  id: row.resourceId,
3767
3891
  label: row.label
3768
- }) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(UnresolvedRef, { token: row.token, id: row.resourceId }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3892
+ }) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(UnresolvedRef, { token: row.token, id: row.resourceId }) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3769
3893
  DoorRef,
3770
3894
  {
3771
3895
  token: row.token,
@@ -3781,9 +3905,9 @@ function AssociationList(props) {
3781
3905
  className: "min-w-0 flex-1 text-foreground"
3782
3906
  }
3783
3907
  ),
3784
- row.originRefs && row.originRefs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground/60", children: [
3908
+ row.originRefs && row.originRefs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground/60", children: [
3785
3909
  "via",
3786
- row.originRefs.map((origin) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3910
+ row.originRefs.map((origin) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3787
3911
  DoorRef,
3788
3912
  {
3789
3913
  token: origin.token,
@@ -3795,8 +3919,8 @@ function AssociationList(props) {
3795
3919
  },
3796
3920
  `${origin.token}:${origin.id}`
3797
3921
  ))
3798
- ] }) : row.originNote ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground/60", children: row.originNote }) : null,
3799
- adapter.setPinned && info && row.removable && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3922
+ ] }) : row.originNote ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground/60", children: row.originNote }) : null,
3923
+ adapter.setPinned && info && row.removable && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3800
3924
  "button",
3801
3925
  {
3802
3926
  type: "button",
@@ -3804,14 +3928,14 @@ function AssociationList(props) {
3804
3928
  onClick: () => void handlePin(row, !(row.pinned ?? false)),
3805
3929
  title: row.pinned ? "Unpin (stops staying in agent context)" : "Pin \u2014 always in agent context",
3806
3930
  "aria-label": row.pinned ? "Unpin" : "Pin",
3807
- className: (0, import_design_system8.cn)(
3931
+ className: (0, import_design_system9.cn)(
3808
3932
  "shrink-0 rounded p-0.5 transition-colors hover:!text-foreground",
3809
3933
  row.pinned ? "text-primary" : "text-muted-foreground/0 group-hover:text-muted-foreground"
3810
3934
  ),
3811
- children: pinningKeys.has(row.key) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3935
+ children: pinningKeys.has(row.key) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3812
3936
  PinIcon,
3813
3937
  {
3814
- className: (0, import_design_system8.cn)(
3938
+ className: (0, import_design_system9.cn)(
3815
3939
  "h-3 w-3",
3816
3940
  row.pinned && "fill-primary/20"
3817
3941
  )
@@ -3819,7 +3943,7 @@ function AssociationList(props) {
3819
3943
  )
3820
3944
  }
3821
3945
  ),
3822
- row.removable && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3946
+ row.removable && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3823
3947
  "button",
3824
3948
  {
3825
3949
  type: "button",
@@ -3828,7 +3952,7 @@ function AssociationList(props) {
3828
3952
  title: "Detach",
3829
3953
  "aria-label": "Detach",
3830
3954
  className: "shrink-0 rounded p-0.5 text-muted-foreground/0 transition-colors group-hover:text-muted-foreground hover:!text-destructive disabled:opacity-50",
3831
- children: busy ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(XIcon, { className: "h-3 w-3" })
3955
+ children: busy ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(XIcon, { className: "h-3 w-3" })
3832
3956
  }
3833
3957
  )
3834
3958
  ]
@@ -3839,7 +3963,7 @@ function AssociationList(props) {
3839
3963
  })
3840
3964
  ] }, role);
3841
3965
  }) }),
3842
- pickerToken && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3966
+ pickerToken && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3843
3967
  AssociationPicker,
3844
3968
  {
3845
3969
  open: true,
@@ -3896,8 +4020,8 @@ function titleize(token) {
3896
4020
 
3897
4021
  // src/react/components/AssociationCaptureToolbar.tsx
3898
4022
  var import_react18 = require("react");
3899
- var import_design_system9 = require("@ai-matrx/design-system");
3900
- var import_jsx_runtime13 = require("react/jsx-runtime");
4023
+ var import_design_system10 = require("@ai-matrx/design-system");
4024
+ var import_jsx_runtime14 = require("react/jsx-runtime");
3901
4025
  function AssociationCaptureToolbar({
3902
4026
  attach,
3903
4027
  uploadFolderPath,
@@ -4128,10 +4252,10 @@ function AssociationCaptureToolbar({
4128
4252
  }
4129
4253
  };
4130
4254
  const anyBuiltIn = actions.upload || actions.addFile || actions.newDocument;
4131
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4255
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4132
4256
  "div",
4133
4257
  {
4134
- className: (0, import_design_system9.cn)(
4258
+ className: (0, import_design_system10.cn)(
4135
4259
  "relative flex h-full min-h-0 flex-col",
4136
4260
  isDragOver && "ring-2 ring-inset ring-primary/50",
4137
4261
  className
@@ -4149,11 +4273,11 @@ function AssociationCaptureToolbar({
4149
4273
  },
4150
4274
  onDrop: handleDrop,
4151
4275
  children: [
4152
- isDragOver ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "pointer-events-none absolute inset-0 z-10 grid place-items-center bg-background/70", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex items-center gap-2 rounded-md border border-primary/40 bg-card px-3 py-1.5 text-xs font-medium text-foreground", children: [
4153
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(UploadIcon, { className: "size-3.5 text-primary" }),
4276
+ isDragOver ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "pointer-events-none absolute inset-0 z-10 grid place-items-center bg-background/70", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "flex items-center gap-2 rounded-md border border-primary/40 bg-card px-3 py-1.5 text-xs font-medium text-foreground", children: [
4277
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(UploadIcon, { className: "size-3.5 text-primary" }),
4154
4278
  "Drop to upload & attach"
4155
4279
  ] }) }) : null,
4156
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4280
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4157
4281
  "input",
4158
4282
  {
4159
4283
  ref: fileInputRef,
@@ -4163,9 +4287,9 @@ function AssociationCaptureToolbar({
4163
4287
  onChange: handleFilesSelected
4164
4288
  }
4165
4289
  ),
4166
- showToolbar && (anyBuiltIn || extraActions) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border/60 px-1.5 py-1", children: namingDoc ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-1 items-center gap-1.5 py-0.5", children: [
4167
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4168
- import_design_system9.Input,
4290
+ showToolbar && (anyBuiltIn || extraActions) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border/60 px-1.5 py-1", children: namingDoc ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-1 items-center gap-1.5 py-0.5", children: [
4291
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4292
+ import_design_system10.Input,
4169
4293
  {
4170
4294
  autoFocus: true,
4171
4295
  value: docName,
@@ -4183,17 +4307,17 @@ function AssociationCaptureToolbar({
4183
4307
  style: { fontSize: 16 }
4184
4308
  }
4185
4309
  ),
4186
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4310
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4187
4311
  "button",
4188
4312
  {
4189
4313
  type: "button",
4190
4314
  disabled: creatingDoc || !docName.trim(),
4191
4315
  onClick: () => void handleCreateDoc(),
4192
4316
  className: "flex h-7 items-center rounded-md bg-primary px-2 text-[11px] font-medium text-primary-foreground disabled:opacity-50",
4193
- children: creatingDoc ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SpinnerIcon, { className: "size-3.5 animate-spin" }) : "Create"
4317
+ children: creatingDoc ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SpinnerIcon, { className: "size-3.5 animate-spin" }) : "Create"
4194
4318
  }
4195
4319
  ),
4196
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4320
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4197
4321
  "button",
4198
4322
  {
4199
4323
  type: "button",
@@ -4206,8 +4330,8 @@ function AssociationCaptureToolbar({
4206
4330
  children: "Cancel"
4207
4331
  }
4208
4332
  )
4209
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
4210
- actions.upload ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4333
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4334
+ actions.upload ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4211
4335
  CaptureToolbarAction,
4212
4336
  {
4213
4337
  icon: isUploading ? SpinnerIcon : UploadIcon,
@@ -4217,7 +4341,7 @@ function AssociationCaptureToolbar({
4217
4341
  disabled: isPicking || isUploading
4218
4342
  }
4219
4343
  ) : null,
4220
- actions.addFile ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4344
+ actions.addFile ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4221
4345
  CaptureToolbarAction,
4222
4346
  {
4223
4347
  icon: isPicking ? SpinnerIcon : FolderOpenIcon,
@@ -4227,8 +4351,8 @@ function AssociationCaptureToolbar({
4227
4351
  disabled: isPicking || isUploading
4228
4352
  }
4229
4353
  ) : null,
4230
- (actions.upload || actions.addFile) && actions.newDocument ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "mx-1 h-4 w-px bg-border" }) : null,
4231
- actions.newDocument ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4354
+ (actions.upload || actions.addFile) && actions.newDocument ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "mx-1 h-4 w-px bg-border" }) : null,
4355
+ actions.newDocument ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4232
4356
  CaptureToolbarAction,
4233
4357
  {
4234
4358
  icon: creatingDoc ? SpinnerIcon : PlusIcon,
@@ -4252,8 +4376,8 @@ function CaptureToolbarAction({
4252
4376
  disabled,
4253
4377
  spinning
4254
4378
  }) {
4255
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4256
- import_design_system9.Button,
4379
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4380
+ import_design_system10.Button,
4257
4381
  {
4258
4382
  type: "button",
4259
4383
  size: "sm",
@@ -4262,7 +4386,7 @@ function CaptureToolbarAction({
4262
4386
  disabled,
4263
4387
  className: "h-7 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground",
4264
4388
  children: [
4265
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { className: (0, import_design_system9.cn)("size-3.5", spinning && "animate-spin") }),
4389
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { className: (0, import_design_system10.cn)("size-3.5", spinning && "animate-spin") }),
4266
4390
  label
4267
4391
  ]
4268
4392
  }
@@ -4271,7 +4395,7 @@ function CaptureToolbarAction({
4271
4395
 
4272
4396
  // src/react/lazyPorts.tsx
4273
4397
  var import_react19 = require("react");
4274
- var import_jsx_runtime14 = require("react/jsx-runtime");
4398
+ var import_jsx_runtime15 = require("react/jsx-runtime");
4275
4399
  function lazyComponent(load) {
4276
4400
  return (0, import_react19.lazy)(async () => {
4277
4401
  const loaded = await load();
@@ -4281,14 +4405,14 @@ function lazyComponent(load) {
4281
4405
  function lazyWindowShell(load) {
4282
4406
  const Loaded = lazyComponent(load);
4283
4407
  return function LazyWindowShell(props) {
4284
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react19.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Loaded, { ...props }) });
4408
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react19.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Loaded, { ...props }) });
4285
4409
  };
4286
4410
  }
4287
4411
  function lazyPickerOverride(load) {
4288
4412
  const Loaded = lazyComponent(load);
4289
4413
  return function LazyPickerOverride(props) {
4290
4414
  if (!props.open) return null;
4291
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react19.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Loaded, { ...props }) });
4415
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react19.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Loaded, { ...props }) });
4292
4416
  };
4293
4417
  }
4294
4418
 
@@ -4401,8 +4525,8 @@ function useAssociationPickerBridge(props, options = {}) {
4401
4525
 
4402
4526
  // src/react/components/AssociationEntitySelect.tsx
4403
4527
  var import_react21 = require("react");
4404
- var import_design_system10 = require("@ai-matrx/design-system");
4405
- var import_jsx_runtime15 = require("react/jsx-runtime");
4528
+ var import_design_system11 = require("@ai-matrx/design-system");
4529
+ var import_jsx_runtime16 = require("react/jsx-runtime");
4406
4530
  function AssociationEntitySelect({
4407
4531
  token,
4408
4532
  adapter,
@@ -4443,26 +4567,26 @@ function AssociationEntitySelect({
4443
4567
  if (id) close();
4444
4568
  else notifier.error(`Couldn't create the ${entityLabel}`);
4445
4569
  };
4446
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4570
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4447
4571
  "div",
4448
4572
  {
4449
- className: (0, import_design_system10.cn)(
4573
+ className: (0, import_design_system11.cn)(
4450
4574
  "group/entity-ref flex min-w-0 items-center gap-0.5",
4451
4575
  className
4452
4576
  ),
4453
4577
  children: [
4454
- showIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4578
+ showIcon ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4455
4579
  InfoIcon,
4456
4580
  {
4457
- className: (0, import_design_system10.cn)(
4581
+ className: (0, import_design_system11.cn)(
4458
4582
  "size-3.5 shrink-0",
4459
4583
  iconClassName ?? "text-muted-foreground"
4460
4584
  ),
4461
4585
  "aria-hidden": true
4462
4586
  }
4463
4587
  ) : null,
4464
- active ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4465
- import_design_system10.EditableLabel,
4588
+ active ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4589
+ import_design_system11.EditableLabel,
4466
4590
  {
4467
4591
  value: active.title,
4468
4592
  onCommit: async (next) => {
@@ -4475,29 +4599,29 @@ function AssociationEntitySelect({
4475
4599
  commitMode: "await",
4476
4600
  activation: renameActivation,
4477
4601
  ariaLabel: info.label,
4478
- className: (0, import_design_system10.cn)("max-w-[14rem]", labelClassName),
4602
+ className: (0, import_design_system11.cn)("max-w-[14rem]", labelClassName),
4479
4603
  displayClassName: "text-xs font-medium text-foreground",
4480
4604
  inputClassName: "text-xs font-medium"
4481
4605
  }
4482
4606
  ) : null,
4483
- active ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DoorControlsSlot, { token, id: active.id, name: active.title }) : null,
4484
- !active ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4607
+ active ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DoorControlsSlot, { token, id: active.id, name: active.title }) : null,
4608
+ !active ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4485
4609
  "span",
4486
4610
  {
4487
- className: (0, import_design_system10.cn)(
4611
+ className: (0, import_design_system11.cn)(
4488
4612
  "truncate px-1 text-xs font-medium text-muted-foreground",
4489
4613
  labelClassName
4490
4614
  ),
4491
4615
  children: adapter.loading ? "\u2026" : emptyLabel ?? info.labelPlural
4492
4616
  }
4493
4617
  ) : null,
4494
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4495
- import_design_system10.Popover,
4618
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4619
+ import_design_system11.Popover,
4496
4620
  {
4497
4621
  open,
4498
4622
  onOpenChange: (next) => next ? setOpen(true) : close(),
4499
4623
  children: [
4500
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4624
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4501
4625
  "button",
4502
4626
  {
4503
4627
  type: "button",
@@ -4505,28 +4629,28 @@ function AssociationEntitySelect({
4505
4629
  title: `Switch or add ${info.labelPlural.toLowerCase()}`,
4506
4630
  "aria-label": `Switch or add ${info.labelPlural.toLowerCase()}`,
4507
4631
  children: [
4508
- items.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "tabular-nums", children: [
4632
+ items.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "tabular-nums", children: [
4509
4633
  activeIndex >= 0 ? activeIndex + 1 : "\u2014",
4510
4634
  "/",
4511
4635
  items.length
4512
4636
  ] }) : null,
4513
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDownIcon, { className: "size-3 opacity-60" })
4637
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronDownIcon, { className: "size-3 opacity-60" })
4514
4638
  ]
4515
4639
  }
4516
4640
  ) }),
4517
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.PopoverContent, { sizing: "content", className: "p-0", align, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Command, { children: [
4518
- items.length > 5 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4519
- import_design_system10.CommandInput,
4641
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.PopoverContent, { sizing: "content", className: "p-0", align, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.Command, { children: [
4642
+ items.length > 5 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4643
+ import_design_system11.CommandInput,
4520
4644
  {
4521
4645
  value: query,
4522
4646
  onValueChange: setQuery,
4523
4647
  placeholder: `Search ${info.labelPlural.toLowerCase()}\u2026`
4524
4648
  }
4525
4649
  ) : null,
4526
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.CommandList, { children: [
4527
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.CommandEmpty, { children: "No match." }),
4528
- items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.CommandGroup, { children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4529
- import_design_system10.CommandItem,
4650
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.CommandList, { children: [
4651
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.CommandEmpty, { children: "No match." }),
4652
+ items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.CommandGroup, { children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4653
+ import_design_system11.CommandItem,
4530
4654
  {
4531
4655
  value: `${item.title} ${item.id}`,
4532
4656
  onSelect: () => {
@@ -4536,17 +4660,17 @@ function AssociationEntitySelect({
4536
4660
  },
4537
4661
  className: "group/entity-ref group gap-2",
4538
4662
  children: [
4539
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4663
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4540
4664
  CheckIcon,
4541
4665
  {
4542
- className: (0, import_design_system10.cn)(
4666
+ className: (0, import_design_system11.cn)(
4543
4667
  "size-3.5 shrink-0",
4544
4668
  item.id === activeId ? "opacity-100" : "opacity-0"
4545
4669
  )
4546
4670
  }
4547
4671
  ),
4548
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "min-w-0 flex-1 truncate", children: item.title }),
4549
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4672
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "min-w-0 flex-1 truncate", children: item.title }),
4673
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4550
4674
  "span",
4551
4675
  {
4552
4676
  className: "inline-flex shrink-0 items-center",
@@ -4554,7 +4678,7 @@ function AssociationEntitySelect({
4554
4678
  e.preventDefault();
4555
4679
  e.stopPropagation();
4556
4680
  },
4557
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4681
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4558
4682
  DoorControlsSlot,
4559
4683
  {
4560
4684
  token,
@@ -4564,7 +4688,7 @@ function AssociationEntitySelect({
4564
4688
  )
4565
4689
  }
4566
4690
  ),
4567
- adapter.detach && item.id !== activeId ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4691
+ adapter.detach && item.id !== activeId ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4568
4692
  "button",
4569
4693
  {
4570
4694
  type: "button",
@@ -4579,7 +4703,7 @@ function AssociationEntitySelect({
4579
4703
  className: "grid size-5 shrink-0 place-items-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-destructive group-hover:opacity-100",
4580
4704
  title: `Remove this ${entityLabel} from here (does not delete it)`,
4581
4705
  "aria-label": `Remove ${item.title}`,
4582
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(XIcon, { className: "size-3" })
4706
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(XIcon, { className: "size-3" })
4583
4707
  }
4584
4708
  ) : null
4585
4709
  ]
@@ -4587,9 +4711,9 @@ function AssociationEntitySelect({
4587
4711
  item.id
4588
4712
  )) }) : null
4589
4713
  ] }),
4590
- createSlot !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "border-t border-border p-1", children: typeof createSlot === "function" ? createSlot(close) : createSlot }) : null,
4591
- createSlot === void 0 && adapter.createAndAttach ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "border-t border-border p-1", children: creating ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1 px-1 py-0.5", children: [
4592
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4714
+ createSlot !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "border-t border-border p-1", children: typeof createSlot === "function" ? createSlot(close) : createSlot }) : null,
4715
+ createSlot === void 0 && adapter.createAndAttach ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "border-t border-border p-1", children: creating ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1 px-1 py-0.5", children: [
4716
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4593
4717
  "input",
4594
4718
  {
4595
4719
  autoFocus: true,
@@ -4613,17 +4737,17 @@ function AssociationEntitySelect({
4613
4737
  "aria-label": `New ${entityLabel} name`
4614
4738
  }
4615
4739
  ),
4616
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4740
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4617
4741
  "button",
4618
4742
  {
4619
4743
  type: "button",
4620
4744
  disabled: busy || !draftName.trim(),
4621
4745
  onClick: () => void create(draftName),
4622
4746
  className: "inline-flex h-6 shrink-0 items-center rounded-md px-1.5 text-[10px] font-medium text-primary transition-colors hover:bg-accent disabled:opacity-50",
4623
- children: busy ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SpinnerIcon, { className: "size-3 animate-spin" }) : "Create"
4747
+ children: busy ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SpinnerIcon, { className: "size-3 animate-spin" }) : "Create"
4624
4748
  }
4625
4749
  )
4626
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4750
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4627
4751
  "button",
4628
4752
  {
4629
4753
  type: "button",
@@ -4634,7 +4758,7 @@ function AssociationEntitySelect({
4634
4758
  },
4635
4759
  className: "flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
4636
4760
  children: [
4637
- busy ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SpinnerIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PlusIcon, { className: "size-3.5" }),
4761
+ busy ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SpinnerIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PlusIcon, { className: "size-3.5" }),
4638
4762
  query.trim() ? `Create "${query.trim()}"` : `New ${info.label}`
4639
4763
  ]
4640
4764
  }
@@ -4650,7 +4774,7 @@ function AssociationEntitySelect({
4650
4774
 
4651
4775
  // src/react/components/CategorySelect.tsx
4652
4776
  var import_react22 = require("react");
4653
- var import_design_system11 = require("@ai-matrx/design-system");
4777
+ var import_design_system12 = require("@ai-matrx/design-system");
4654
4778
 
4655
4779
  // src/core/categoryHierarchy.ts
4656
4780
  function buildCategoryHierarchy(categories) {
@@ -4717,7 +4841,7 @@ function buildCategoryHierarchy(categories) {
4717
4841
  }
4718
4842
 
4719
4843
  // src/react/components/CategorySelect.tsx
4720
- var import_jsx_runtime16 = require("react/jsx-runtime");
4844
+ var import_jsx_runtime17 = require("react/jsx-runtime");
4721
4845
  var NONE = "__none__";
4722
4846
  var ROOT_PARENT = "__root__";
4723
4847
  function plural(noun) {
@@ -4753,9 +4877,9 @@ function CategorySelect({
4753
4877
  // The type-ahead matches the parent's name too, so someone who knows
4754
4878
  // the branch but not the leaf still finds it.
4755
4879
  keywords: parent ? parent.name : "",
4756
- render: depth === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "font-medium", children: category.name }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex items-center gap-1.5 pl-3 text-muted-foreground", children: [
4757
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CornerDownRightIcon, { className: "h-3.5 w-3.5 shrink-0" }),
4758
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-foreground", children: category.name })
4880
+ render: depth === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-medium", children: category.name }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex items-center gap-1.5 pl-3 text-muted-foreground", children: [
4881
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CornerDownRightIcon, { className: "h-3.5 w-3.5 shrink-0" }),
4882
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-foreground", children: category.name })
4759
4883
  ] })
4760
4884
  })) : categories.map((category) => ({
4761
4885
  value: category.id,
@@ -4802,9 +4926,9 @@ function CategorySelect({
4802
4926
  );
4803
4927
  return result.id;
4804
4928
  };
4805
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
4806
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4807
- import_design_system11.CreatablePicker,
4929
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
4930
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4931
+ import_design_system12.CreatablePicker,
4808
4932
  {
4809
4933
  value: value ?? (allowNone ? NONE : null),
4810
4934
  onSelect: (next) => onChange(next === NONE ? null : next),
@@ -4819,19 +4943,19 @@ function CategorySelect({
4819
4943
  emptyLabel: `No ${noun} matches that.`,
4820
4944
  ...allowCreate ? { onCreate: create } : {},
4821
4945
  ...allowCreate && hierarchy.hasHierarchy ? {
4822
- createExtra: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.Select, { value: createParentId, onValueChange: setCreateParentId, children: [
4823
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4824
- import_design_system11.SelectTrigger,
4946
+ createExtra: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.Select, { value: createParentId, onValueChange: setCreateParentId, children: [
4947
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4948
+ import_design_system12.SelectTrigger,
4825
4949
  {
4826
4950
  className: "h-7 text-xs",
4827
4951
  "aria-label": `Put the new ${noun} under`,
4828
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.SelectValue, {})
4952
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectValue, {})
4829
4953
  }
4830
4954
  ),
4831
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.SelectContent, { children: [
4832
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.SelectItem, { value: ROOT_PARENT, className: "text-xs", children: "Top level" }),
4833
- hierarchy.items.filter((item) => item.depth === 0).map((item) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4834
- import_design_system11.SelectItem,
4955
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.SelectContent, { children: [
4956
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectItem, { value: ROOT_PARENT, className: "text-xs", children: "Top level" }),
4957
+ hierarchy.items.filter((item) => item.depth === 0).map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
4958
+ import_design_system12.SelectItem,
4835
4959
  {
4836
4960
  value: item.category.id,
4837
4961
  className: "text-xs",
@@ -4850,20 +4974,20 @@ function CategorySelect({
4850
4974
  selected === null && value !== null ? (
4851
4975
  // A stored id whose row this reader cannot see is not "nothing chosen":
4852
4976
  // saying so beats a blank box that looks like an unsaved field.
4853
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "mt-1 text-xs text-muted-foreground", children: [
4977
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "mt-1 text-xs text-muted-foreground", children: [
4854
4978
  "This ",
4855
4979
  noun,
4856
4980
  " is no longer available to you."
4857
4981
  ] })
4858
4982
  ) : null,
4859
- error ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "mt-1 text-xs text-destructive", children: error }) : null
4983
+ error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "mt-1 text-xs text-destructive", children: error }) : null
4860
4984
  ] });
4861
4985
  }
4862
4986
 
4863
4987
  // src/react/components/CategoryTagPicker.tsx
4864
4988
  var import_react23 = require("react");
4865
- var import_design_system12 = require("@ai-matrx/design-system");
4866
- var import_jsx_runtime17 = require("react/jsx-runtime");
4989
+ var import_design_system13 = require("@ai-matrx/design-system");
4990
+ var import_jsx_runtime18 = require("react/jsx-runtime");
4867
4991
  var ROOT_PARENT2 = "__root__";
4868
4992
  function CategoryTagPicker({
4869
4993
  entityType,
@@ -4987,86 +5111,86 @@ function CategoryTagPicker({
4987
5111
  const exactMatch = categories.some(
4988
5112
  (c) => c.name.toLowerCase() === search.trim().toLowerCase()
4989
5113
  );
4990
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
4991
- selected.map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
4992
- import_design_system12.Badge,
5114
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
5115
+ selected.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5116
+ import_design_system13.Badge,
4993
5117
  {
4994
5118
  variant: "secondary",
4995
5119
  className: "gap-1 pr-1 text-xs font-medium",
4996
5120
  children: [
4997
5121
  showHierarchy ? hierarchyById.get(c.id)?.displayName ?? c.name : c.name,
4998
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5122
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4999
5123
  "button",
5000
5124
  {
5001
5125
  type: "button",
5002
5126
  onClick: () => void toggle(c.id),
5003
5127
  className: "ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20",
5004
5128
  "aria-label": `Remove ${c.name}`,
5005
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(XIcon, { className: "h-2.5 w-2.5" })
5129
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(XIcon, { className: "h-2.5 w-2.5" })
5006
5130
  }
5007
5131
  )
5008
5132
  ]
5009
5133
  },
5010
5134
  c.id
5011
5135
  )),
5012
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.Popover, { open, onOpenChange: setOpen, children: [
5013
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
5014
- import_design_system12.Button,
5136
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.Popover, { open, onOpenChange: setOpen, children: [
5137
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5138
+ import_design_system13.Button,
5015
5139
  {
5016
5140
  variant: "outline",
5017
5141
  size: "sm",
5018
5142
  className: "h-7 gap-1 px-2 text-xs",
5019
5143
  children: [
5020
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { className: "h-3.5 w-3.5" }),
5144
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { className: "h-3.5 w-3.5" }),
5021
5145
  selected.length === 0 ? addLabel : "Edit",
5022
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronsUpDownIcon, { className: "h-3 w-3 opacity-50" })
5146
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronsUpDownIcon, { className: "h-3 w-3 opacity-50" })
5023
5147
  ]
5024
5148
  }
5025
5149
  ) }),
5026
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.PopoverContent, { sizing: "content", className: "p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.Command, { shouldFilter: false, children: [
5027
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5028
- import_design_system12.CommandInput,
5150
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.PopoverContent, { sizing: "content", className: "p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.Command, { shouldFilter: false, children: [
5151
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5152
+ import_design_system13.CommandInput,
5029
5153
  {
5030
5154
  placeholder: allowCreate ? "Search or create..." : "Search...",
5031
5155
  value: search,
5032
5156
  onValueChange: setSearch
5033
5157
  }
5034
5158
  ),
5035
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.CommandList, { children: [
5036
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.CommandEmpty, { className: "px-2 py-3 text-xs text-muted-foreground", children: search.trim() ? "No match." : emptyText }),
5037
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.CommandGroup, { children: showHierarchy ? filteredHierarchy.map(({ category, depth, parent }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
5038
- import_design_system12.CommandItem,
5159
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.CommandList, { children: [
5160
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.CommandEmpty, { className: "px-2 py-3 text-xs text-muted-foreground", children: search.trim() ? "No match." : emptyText }),
5161
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.CommandGroup, { children: showHierarchy ? filteredHierarchy.map(({ category, depth, parent }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5162
+ import_design_system13.CommandItem,
5039
5163
  {
5040
5164
  value: category.id,
5041
5165
  keywords: parent ? [parent.name, category.name] : [],
5042
5166
  onSelect: () => void toggle(category.id),
5043
- className: (0, import_design_system12.cn)("text-xs", depth === 1 && "pl-6"),
5167
+ className: (0, import_design_system13.cn)("text-xs", depth === 1 && "pl-6"),
5044
5168
  children: [
5045
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5169
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5046
5170
  CheckIcon,
5047
5171
  {
5048
- className: (0, import_design_system12.cn)(
5172
+ className: (0, import_design_system13.cn)(
5049
5173
  "mr-2 h-3.5 w-3.5",
5050
5174
  selectedIds.has(category.id) ? "opacity-100" : "opacity-0"
5051
5175
  )
5052
5176
  }
5053
5177
  ),
5054
- depth === 1 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CornerDownRightIcon, { className: "mr-1.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : null,
5055
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: (0, import_design_system12.cn)(depth === 0 && "font-medium"), children: category.name })
5178
+ depth === 1 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CornerDownRightIcon, { className: "mr-1.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : null,
5179
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: (0, import_design_system13.cn)(depth === 0 && "font-medium"), children: category.name })
5056
5180
  ]
5057
5181
  },
5058
5182
  category.id
5059
- )) : filtered.map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
5060
- import_design_system12.CommandItem,
5183
+ )) : filtered.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5184
+ import_design_system13.CommandItem,
5061
5185
  {
5062
5186
  value: c.id,
5063
5187
  onSelect: () => void toggle(c.id),
5064
5188
  className: "text-xs",
5065
5189
  children: [
5066
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5190
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5067
5191
  CheckIcon,
5068
5192
  {
5069
- className: (0, import_design_system12.cn)(
5193
+ className: (0, import_design_system13.cn)(
5070
5194
  "mr-2 h-3.5 w-3.5",
5071
5195
  selectedIds.has(c.id) ? "opacity-100" : "opacity-0"
5072
5196
  )
@@ -5077,33 +5201,33 @@ function CategoryTagPicker({
5077
5201
  },
5078
5202
  c.id
5079
5203
  )) }),
5080
- allowCreate && search.trim() && !exactMatch ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.CommandGroup, { children: [
5081
- showHierarchy ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-1.5 px-2 pb-2", children: [
5082
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] font-medium text-muted-foreground", children: "Place in" }),
5083
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
5084
- import_design_system12.Select,
5204
+ allowCreate && search.trim() && !exactMatch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.CommandGroup, { children: [
5205
+ showHierarchy ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-1.5 px-2 pb-2", children: [
5206
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[11px] font-medium text-muted-foreground", children: "Place in" }),
5207
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5208
+ import_design_system13.Select,
5085
5209
  {
5086
5210
  value: createParentId,
5087
5211
  onValueChange: setCreateParentId,
5088
5212
  children: [
5089
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectTrigger, { size: "sm", className: "bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectValue, {}) }),
5090
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.SelectContent, { children: [
5091
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectItem, { value: ROOT_PARENT2, children: "Top level" }),
5092
- hierarchy.roots.map((root) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectItem, { value: root.id, children: root.name }, root.id))
5213
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.SelectTrigger, { size: "sm", className: "bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.SelectValue, {}) }),
5214
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.SelectContent, { children: [
5215
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.SelectItem, { value: ROOT_PARENT2, children: "Top level" }),
5216
+ hierarchy.roots.map((root) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.SelectItem, { value: root.id, children: root.name }, root.id))
5093
5217
  ] })
5094
5218
  ]
5095
5219
  }
5096
5220
  )
5097
5221
  ] }) : null,
5098
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
5099
- import_design_system12.CommandItem,
5222
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5223
+ import_design_system13.CommandItem,
5100
5224
  {
5101
5225
  value: `__create__${search}`,
5102
5226
  onSelect: () => void createAndAttach(),
5103
5227
  disabled: creating,
5104
5228
  className: "text-xs text-primary",
5105
5229
  children: [
5106
- creating ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SpinnerIcon, { className: "mr-2 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { className: "mr-2 h-3.5 w-3.5" }),
5230
+ creating ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SpinnerIcon, { className: "mr-2 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { className: "mr-2 h-3.5 w-3.5" }),
5107
5231
  "Create \u201C",
5108
5232
  search.trim(),
5109
5233
  "\u201D"
@@ -5119,9 +5243,9 @@ function CategoryTagPicker({
5119
5243
 
5120
5244
  // src/react/components/CommentThread.tsx
5121
5245
  var import_react24 = require("react");
5122
- var import_design_system13 = require("@ai-matrx/design-system");
5246
+ var import_design_system14 = require("@ai-matrx/design-system");
5123
5247
  var import_format = require("@ai-matrx/kit/format");
5124
- var import_jsx_runtime18 = require("react/jsx-runtime");
5248
+ var import_jsx_runtime19 = require("react/jsx-runtime");
5125
5249
  var AUTHOR_DOOR_TOKEN = "user";
5126
5250
  function resolveAuthor(comment, authorDisplay) {
5127
5251
  const base2 = {
@@ -5140,7 +5264,7 @@ function resolveAuthor(comment, authorDisplay) {
5140
5264
  }
5141
5265
  function AuthorAvatar({ author }) {
5142
5266
  if (author.avatarUrl) {
5143
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5267
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5144
5268
  "img",
5145
5269
  {
5146
5270
  src: author.avatarUrl,
@@ -5149,7 +5273,7 @@ function AuthorAvatar({ author }) {
5149
5273
  }
5150
5274
  );
5151
5275
  }
5152
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5276
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5153
5277
  "span",
5154
5278
  {
5155
5279
  "aria-hidden": true,
@@ -5164,7 +5288,7 @@ function AuthorName({
5164
5288
  }) {
5165
5289
  const DoorRef2 = entityDoors?.EntityRef;
5166
5290
  if (DoorRef2 && author.userId) {
5167
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5291
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5168
5292
  DoorRef2,
5169
5293
  {
5170
5294
  token: AUTHOR_DOOR_TOKEN,
@@ -5175,7 +5299,7 @@ function AuthorName({
5175
5299
  }
5176
5300
  );
5177
5301
  }
5178
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm font-medium text-foreground", children: author.name });
5302
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm font-medium text-foreground", children: author.name });
5179
5303
  }
5180
5304
  function CommentComposer({
5181
5305
  onSubmit,
@@ -5205,8 +5329,8 @@ function CommentComposer({
5205
5329
  }
5206
5330
  setBody("");
5207
5331
  }
5208
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("form", { onSubmit: submit, className: "flex flex-col gap-1.5", children: [
5209
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5332
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { onSubmit: submit, className: "flex flex-col gap-1.5", children: [
5333
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5210
5334
  "textarea",
5211
5335
  {
5212
5336
  value: body,
@@ -5221,8 +5345,8 @@ function CommentComposer({
5221
5345
  className: "w-full resize-y rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
5222
5346
  }
5223
5347
  ),
5224
- error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5225
- import_design_system13.ErrorBox,
5348
+ error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5349
+ import_design_system14.ErrorBox,
5226
5350
  {
5227
5351
  className: "text-xs text-destructive",
5228
5352
  message: error,
@@ -5231,9 +5355,9 @@ function CommentComposer({
5231
5355
  origin: "associations/CommentThread"
5232
5356
  }
5233
5357
  ),
5234
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
5235
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.Button, { type: "submit", size: "sm", disabled: !body.trim() || submitting, children: [
5236
- submitting && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SpinnerIcon, { className: "mr-1 h-3 w-3 animate-spin" }),
5358
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
5359
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_design_system14.Button, { type: "submit", size: "sm", disabled: !body.trim() || submitting, children: [
5360
+ submitting && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SpinnerIcon, { className: "mr-1 h-3 w-3 animate-spin" }),
5237
5361
  submitLabel
5238
5362
  ] }),
5239
5363
  trailing
@@ -5266,19 +5390,19 @@ function CommentItem({
5266
5390
  notifier.error(res.error ?? "Could not delete the comment");
5267
5391
  }
5268
5392
  }
5269
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5393
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
5270
5394
  "div",
5271
5395
  {
5272
5396
  "data-comment-id": comment.id,
5273
- className: (0, import_design_system13.cn)(
5397
+ className: (0, import_design_system14.cn)(
5274
5398
  "flex flex-col gap-1",
5275
5399
  depth > 0 && "border-l border-border pl-3"
5276
5400
  ),
5277
5401
  children: [
5278
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
5279
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AuthorAvatar, { author }),
5280
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AuthorName, { author, entityDoors }),
5281
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5402
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
5403
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AuthorAvatar, { author }),
5404
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AuthorName, { author, entityDoors }),
5405
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5282
5406
  "span",
5283
5407
  {
5284
5408
  className: "text-xs text-muted-foreground",
@@ -5289,7 +5413,7 @@ function CommentItem({
5289
5413
  })
5290
5414
  }
5291
5415
  ),
5292
- edited && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5416
+ edited && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5293
5417
  "span",
5294
5418
  {
5295
5419
  className: "text-xs text-muted-foreground",
@@ -5298,7 +5422,7 @@ function CommentItem({
5298
5422
  }
5299
5423
  )
5300
5424
  ] }),
5301
- editing ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "pl-8", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5425
+ editing ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pl-8", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5302
5426
  CommentComposer,
5303
5427
  {
5304
5428
  initialValue: comment.body,
@@ -5310,8 +5434,8 @@ function CommentItem({
5310
5434
  if (res.ok) setEditing(false);
5311
5435
  return res;
5312
5436
  },
5313
- trailing: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5314
- import_design_system13.Button,
5437
+ trailing: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5438
+ import_design_system14.Button,
5315
5439
  {
5316
5440
  type: "button",
5317
5441
  size: "sm",
@@ -5321,11 +5445,11 @@ function CommentItem({
5321
5445
  }
5322
5446
  )
5323
5447
  }
5324
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "whitespace-pre-wrap pl-8 text-sm text-foreground", children: comment.body }),
5325
- !editing && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center gap-1 pl-7", children: confirmingDelete ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
5326
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-xs text-destructive", children: "Deletes this comment for everyone." }),
5327
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5328
- import_design_system13.Button,
5448
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "whitespace-pre-wrap pl-8 text-sm text-foreground", children: comment.body }),
5449
+ !editing && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center gap-1 pl-7", children: confirmingDelete ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
5450
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs text-destructive", children: "Deletes this comment for everyone." }),
5451
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
5452
+ import_design_system14.Button,
5329
5453
  {
5330
5454
  type: "button",
5331
5455
  size: "sm",
@@ -5333,13 +5457,13 @@ function CommentItem({
5333
5457
  disabled: deleting,
5334
5458
  onClick: () => void confirmDelete(),
5335
5459
  children: [
5336
- deleting && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SpinnerIcon, { className: "mr-1 h-3 w-3 animate-spin" }),
5460
+ deleting && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SpinnerIcon, { className: "mr-1 h-3 w-3 animate-spin" }),
5337
5461
  "Delete"
5338
5462
  ]
5339
5463
  }
5340
5464
  ),
5341
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5342
- import_design_system13.Button,
5465
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5466
+ import_design_system14.Button,
5343
5467
  {
5344
5468
  type: "button",
5345
5469
  size: "sm",
@@ -5349,8 +5473,8 @@ function CommentItem({
5349
5473
  children: "Cancel"
5350
5474
  }
5351
5475
  )
5352
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
5353
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5476
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
5477
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5354
5478
  "button",
5355
5479
  {
5356
5480
  type: "button",
@@ -5359,8 +5483,8 @@ function CommentItem({
5359
5483
  children: "Reply"
5360
5484
  }
5361
5485
  ),
5362
- isOwn && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
5363
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5486
+ isOwn && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
5487
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5364
5488
  "button",
5365
5489
  {
5366
5490
  type: "button",
@@ -5369,7 +5493,7 @@ function CommentItem({
5369
5493
  children: "Edit"
5370
5494
  }
5371
5495
  ),
5372
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5496
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5373
5497
  "button",
5374
5498
  {
5375
5499
  type: "button",
@@ -5380,9 +5504,9 @@ function CommentItem({
5380
5504
  )
5381
5505
  ] })
5382
5506
  ] }) }),
5383
- replying && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-2 pl-8 pt-1", children: [
5384
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CornerDownRightIcon, { className: "mt-2 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
5385
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5507
+ replying && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-start gap-2 pl-8 pt-1", children: [
5508
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CornerDownRightIcon, { className: "mt-2 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
5509
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5386
5510
  CommentComposer,
5387
5511
  {
5388
5512
  submitLabel: "Reply",
@@ -5396,8 +5520,8 @@ function CommentItem({
5396
5520
  if (res.ok) setReplying(false);
5397
5521
  return res;
5398
5522
  },
5399
- trailing: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5400
- import_design_system13.Button,
5523
+ trailing: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5524
+ import_design_system14.Button,
5401
5525
  {
5402
5526
  type: "button",
5403
5527
  size: "sm",
@@ -5409,7 +5533,7 @@ function CommentItem({
5409
5533
  }
5410
5534
  ) })
5411
5535
  ] }),
5412
- replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-col gap-3 pl-8 pt-1", children: replies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5536
+ replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-col gap-3 pl-8 pt-1", children: replies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5413
5537
  CommentItem,
5414
5538
  {
5415
5539
  comment: reply,
@@ -5449,11 +5573,11 @@ function CommentThread({
5449
5573
  const thread = useComments({ token, id });
5450
5574
  const { roots, childrenOf } = buildCommentTree(thread.comments);
5451
5575
  const loading = (thread.status === "loading" || thread.status === "idle") && thread.comments.length === 0;
5452
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: (0, import_design_system13.cn)("flex flex-col gap-3", className), children: [
5453
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("header", { className: "flex items-center gap-2", children: [
5454
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: "Comments" }),
5455
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-xs text-muted-foreground tabular-nums", children: thread.comments.length }),
5456
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5576
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: (0, import_design_system14.cn)("flex flex-col gap-3", className), children: [
5577
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("header", { className: "flex items-center gap-2", children: [
5578
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: "Comments" }),
5579
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs text-muted-foreground tabular-nums", children: thread.comments.length }),
5580
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5457
5581
  "button",
5458
5582
  {
5459
5583
  type: "button",
@@ -5461,12 +5585,12 @@ function CommentThread({
5461
5585
  "aria-label": "Refresh comments",
5462
5586
  title: "Refresh comments",
5463
5587
  className: "ml-auto flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
5464
- children: thread.status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RefreshIcon, { className: "h-3.5 w-3.5" })
5588
+ children: thread.status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RefreshIcon, { className: "h-3.5 w-3.5" })
5465
5589
  }
5466
5590
  )
5467
5591
  ] }),
5468
- thread.error && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5469
- import_design_system13.ErrorBox,
5592
+ thread.error && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
5593
+ import_design_system14.ErrorBox,
5470
5594
  {
5471
5595
  as: "div",
5472
5596
  className: "flex items-center gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
@@ -5474,9 +5598,9 @@ function CommentThread({
5474
5598
  operation: "Load comments",
5475
5599
  origin: "associations/CommentThread",
5476
5600
  children: [
5477
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "min-w-0 flex-1", children: thread.error }),
5478
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5479
- import_design_system13.Button,
5601
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "min-w-0 flex-1", children: thread.error }),
5602
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5603
+ import_design_system14.Button,
5480
5604
  {
5481
5605
  type: "button",
5482
5606
  size: "sm",
@@ -5489,10 +5613,10 @@ function CommentThread({
5489
5613
  ]
5490
5614
  }
5491
5615
  ),
5492
- loading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-3", "aria-hidden": true, "data-testid": "comments-loading", children: [
5493
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.Skeleton, { className: "h-12 w-full" }),
5494
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.Skeleton, { className: "h-12 w-4/5" })
5495
- ] }) : roots.length === 0 && !thread.error ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-muted-foreground", children: "No comments yet." }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-col gap-4", children: roots.map((comment) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5616
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-3", "aria-hidden": true, "data-testid": "comments-loading", children: [
5617
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system14.Skeleton, { className: "h-12 w-full" }),
5618
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system14.Skeleton, { className: "h-12 w-4/5" })
5619
+ ] }) : roots.length === 0 && !thread.error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm text-muted-foreground", children: "No comments yet." }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-col gap-4", children: roots.map((comment) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5496
5620
  CommentItem,
5497
5621
  {
5498
5622
  comment,
@@ -5503,7 +5627,7 @@ function CommentThread({
5503
5627
  },
5504
5628
  comment.id
5505
5629
  )) }),
5506
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5630
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5507
5631
  CommentComposer,
5508
5632
  {
5509
5633
  onSubmit: (body) => thread.add(body, { orgId: orgId ?? null })