@knkcs/contenthub-ui 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,123 +1,123 @@
1
- import { S as e, h as t, y as n } from "./heads-Brd2Gtjm.js";
2
- import { useCallback as r, useEffect as i, useMemo as a, useState as o } from "react";
3
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
4
- import { Button as u, EmptyState as d } from "@knkcs/anker/atoms";
5
- import { DataTable as f, DateCell as p, Modal as ee, Toolbar as m, TreeViewBranchControl as h, TreeViewBranchIndicator as g, TreeViewBranchText as _, TreeViewItem as v, TreeViewItemText as y, TreeViewLabel as b, TreeViewNode as x, TreeViewRoot as S, TreeViewTree as C, TruncatedTextCell as w, createTreeCollection as T } from "@knkcs/anker/components";
6
- import { Alert as E, Box as te, HStack as D, NativeSelect as O, Spinner as k, Stack as ne, Text as A, Tooltip as re } from "@knkcs/anker/primitives";
7
- import { IndexPageTemplate as ie, SubNavLayout as j } from "@knkcs/anker/templates";
8
- import { keepPreviousData as ae, useInfiniteQuery as oe, useQuery as M, useQueryClient as se } from "@tanstack/react-query";
9
- import { ChevronRight as ce, FileText as le, Lock as N, Plus as ue } from "lucide-react";
10
- import { useTranslation as P } from "react-i18next";
11
- import { zodResolver as de } from "@hookform/resolvers/zod";
12
- import { BaseSelectField as F, InputField as I, LookupSelectField as fe } from "@knkcs/anker/forms";
13
- import { FormProvider as L, useForm as R, useWatch as z } from "react-hook-form";
14
- import { z as B } from "zod";
15
- import { useHostIdentity as pe } from "@knkcs/anker/host";
16
- import { useSearchParams as me } from "react-router";
1
+ import { C as e, S as t, h as n, y as r } from "./heads-dBmqNcOB.js";
2
+ import { useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
3
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
4
+ import { Button as f, EmptyState as p } from "@knkcs/anker/atoms";
5
+ import { DataTable as m, DateCell as h, Modal as g, Toolbar as _, TreeViewBranchControl as v, TreeViewBranchIndicator as y, TreeViewBranchText as b, TreeViewItem as x, TreeViewItemText as S, TreeViewLabel as ee, TreeViewNode as C, TreeViewRoot as w, TreeViewTree as T, TruncatedTextCell as te, createTreeCollection as E } from "@knkcs/anker/components";
6
+ import { Alert as D, HStack as O, NativeSelect as k, Spinner as A, Stack as j, Text as M } from "@knkcs/anker/primitives";
7
+ import { IndexPageTemplate as ne, SubNavLayout as N } from "@knkcs/anker/templates";
8
+ import { keepPreviousData as re, useInfiniteQuery as ie, useQuery as P, useQueryClient as ae } from "@tanstack/react-query";
9
+ import { ChevronRight as F, FileText as oe, Lock as se, Plus as ce } from "lucide-react";
10
+ import { useTranslation as I } from "react-i18next";
11
+ import { zodResolver as L } from "@hookform/resolvers/zod";
12
+ import { BaseSelectField as R, InputField as z, LookupSelectField as B } from "@knkcs/anker/forms";
13
+ import { FormProvider as V, useForm as le, useWatch as H } from "react-hook-form";
14
+ import { z as U } from "zod";
15
+ import { useHostIdentity as ue } from "@knkcs/anker/host";
16
+ import { useSearchParams as de } from "react-router";
17
17
  //#region src/common/query-keys.ts
18
- var V = {
18
+ var W = {
19
19
  all: ["contenthub"],
20
- blockReasons: () => [...V.all, "block-reasons"],
21
- changeSets: () => [...V.all, "change-sets"],
22
- changeSetLists: () => [...V.changeSets(), "list"],
23
- changeSetList: (e) => [...V.changeSetLists(), e],
24
- openChangeSets: () => [...V.changeSetLists(), "open-picker"],
20
+ blockReasons: () => [...W.all, "block-reasons"],
21
+ changeSets: () => [...W.all, "change-sets"],
22
+ changeSetLists: () => [...W.changeSets(), "list"],
23
+ changeSetList: (e) => [...W.changeSetLists(), e],
24
+ openChangeSets: () => [...W.changeSetLists(), "open-picker"],
25
25
  changeSet: (e) => [
26
- ...V.changeSets(),
26
+ ...W.changeSets(),
27
27
  "detail",
28
28
  e
29
29
  ],
30
30
  publishReadiness: (e) => [
31
- ...V.changeSets(),
31
+ ...W.changeSets(),
32
32
  "readiness",
33
33
  e
34
34
  ],
35
- publishReadinessAt: (e, t) => [...V.publishReadiness(e), t],
35
+ publishReadinessAt: (e, t) => [...W.publishReadiness(e), t],
36
36
  checkStandings: (e) => [
37
- ...V.changeSets(),
37
+ ...W.changeSets(),
38
38
  "checks",
39
39
  e
40
40
  ],
41
- changeSetStatuses: () => [...V.all, "change-set-statuses"],
42
- requiredChecks: () => [...V.all, "required-checks"],
41
+ changeSetStatuses: () => [...W.all, "change-set-statuses"],
42
+ requiredChecks: () => [...W.all, "required-checks"],
43
43
  requiredCheckRecorders: (e) => [
44
- ...V.requiredChecks(),
44
+ ...W.requiredChecks(),
45
45
  "recorders",
46
46
  e
47
47
  ],
48
- collections: () => [...V.all, "collections"],
48
+ collections: () => [...W.all, "collections"],
49
49
  collectionGrants: (e) => [
50
- ...V.collections(),
50
+ ...W.collections(),
51
51
  "grants",
52
52
  e
53
53
  ],
54
- contents: () => [...V.all, "contents"],
55
- contentLists: () => [...V.contents(), "list"],
56
- contentList: (e) => [...V.contentLists(), e],
54
+ contents: () => [...W.all, "contents"],
55
+ contentLists: () => [...W.contents(), "list"],
56
+ contentList: (e) => [...W.contentLists(), e],
57
57
  content: (e) => [
58
- ...V.contents(),
58
+ ...W.contents(),
59
59
  "detail",
60
60
  e
61
61
  ],
62
62
  contentRead: (e, t) => [
63
- ...V.content(e),
63
+ ...W.content(e),
64
64
  "read",
65
65
  t
66
66
  ],
67
- contentTimeline: (e) => [...V.content(e), "timeline"],
67
+ contentTimeline: (e) => [...W.content(e), "timeline"],
68
68
  contentRevisions: (e, t) => [
69
- ...V.content(e),
69
+ ...W.content(e),
70
70
  "revisions",
71
71
  t
72
72
  ],
73
73
  contentCompare: (e, t, n) => [
74
- ...V.content(e),
74
+ ...W.content(e),
75
75
  "compare",
76
76
  t,
77
77
  n
78
78
  ],
79
79
  contentReferences: (e, t) => [
80
- ...V.content(e),
80
+ ...W.content(e),
81
81
  "references",
82
82
  t
83
83
  ],
84
- contentReferrers: (e) => [...V.content(e), "referrers"],
84
+ contentReferrers: (e) => [...W.content(e), "referrers"],
85
85
  contentOutdatedPins: (e, t) => [
86
- ...V.content(e),
86
+ ...W.content(e),
87
87
  "outdated-pins",
88
88
  t
89
89
  ],
90
- contentChangeSets: (e) => [...V.content(e), "change-sets"],
90
+ contentChangeSets: (e) => [...W.content(e), "change-sets"],
91
91
  chainPreview: (e, t, ...n) => [
92
- ...V.content(e),
92
+ ...W.content(e),
93
93
  "preview",
94
94
  t,
95
95
  ...n
96
96
  ],
97
97
  previewInForce: (e, t, n) => [
98
- ...V.content(e),
98
+ ...W.content(e),
99
99
  "preview-in-force",
100
100
  t,
101
101
  n
102
102
  ],
103
103
  pendingMerge: (e) => [
104
- ...V.all,
104
+ ...W.all,
105
105
  "pending-merge",
106
106
  e
107
107
  ],
108
- blueprints: () => [...V.all, "blueprints"],
108
+ blueprints: () => [...W.all, "blueprints"],
109
109
  blueprintNames: (e) => [
110
- ...V.blueprints(),
110
+ ...W.blueprints(),
111
111
  "names",
112
112
  e
113
113
  ],
114
- blueprintFilterOptions: () => [...V.blueprints(), "filter-options"],
114
+ blueprintFilterOptions: () => [...W.blueprints(), "filter-options"],
115
115
  blueprintReleases: (e) => [
116
- ...V.blueprints(),
116
+ ...W.blueprints(),
117
117
  "releases",
118
118
  e
119
119
  ]
120
- }, H = {
120
+ }, G = {
121
121
  common: { cancel: "Abbrechen" },
122
122
  settings: {
123
123
  section: "Einstellungen",
@@ -574,7 +574,6 @@ var V = {
574
574
  more: "Mehr anzeigen",
575
575
  create: {
576
576
  button: "Neuer Inhalt",
577
- unavailable: "Neue Inhalte brauchen die Blueprints des Arbeitsbereichs, und dieser Host ist nicht mit blueprinthub verbunden.",
578
577
  title: "Neuer Inhalt",
579
578
  blueprint: "Blueprint",
580
579
  blueprintHelp: "Die Art des Inhalts, wie ein Blueprint sie festlegt.",
@@ -584,6 +583,11 @@ var V = {
584
583
  releaseHelp: "Das Release, auf das der Inhalt festgelegt wird. Das neueste ist vorausgewählt.",
585
584
  releaseRequired: "Wählen Sie ein Release.",
586
585
  noRelease: "Dieser Blueprint hat noch kein Release. Erstellen Sie zuerst eines in blueprinthub.",
586
+ noUsableRelease: "Kein Release dieses Blueprints kann verwendet werden. Korrigieren Sie den Blueprint in blueprinthub und erstellen Sie ein neues Release.",
587
+ releasesFailed: "Die Releases konnten nicht geladen werden: blueprinthub antwortet nicht. Versuchen Sie es erneut.",
588
+ refusedRelease: "{{name}} (nicht verwendbar)",
589
+ refusedReleases: "Auf diese Releases kann contenthub nicht festlegen:",
590
+ refusedReleaseReasons: "{{name}}: {{reasons}}",
587
591
  changeSet: "Change Set",
588
592
  changeSetHelp: "Ein neuer Inhalt entsteht in einem Change Set und existiert nur dort, bis es veröffentlicht wird.",
589
593
  changeSetRequired: "Wählen Sie ein Change Set.",
@@ -834,7 +838,7 @@ var V = {
834
838
  confirm: "Archivieren"
835
839
  }
836
840
  }
837
- }, U = {
841
+ }, fe = {
838
842
  common: { cancel: "Cancel" },
839
843
  settings: {
840
844
  section: "Settings",
@@ -1525,7 +1529,6 @@ var V = {
1525
1529
  more: "Show more",
1526
1530
  create: {
1527
1531
  button: "New Content",
1528
- unavailable: "New Content needs the workspace's Blueprints, and this host has no connection to blueprinthub.",
1529
1532
  title: "New Content",
1530
1533
  blueprint: "Blueprint",
1531
1534
  blueprintHelp: "The kind of Content, as a Blueprint defines it.",
@@ -1535,6 +1538,11 @@ var V = {
1535
1538
  releaseHelp: "The Release the Content pins. The newest is chosen for you.",
1536
1539
  releaseRequired: "Choose a Release.",
1537
1540
  noRelease: "This Blueprint has no Release yet. Cut one in blueprinthub first.",
1541
+ noUsableRelease: "No Release of this Blueprint can be used. Fix the Blueprint in blueprinthub and cut a new Release.",
1542
+ releasesFailed: "The Releases could not be loaded: blueprinthub isn't answering. Try again.",
1543
+ refusedRelease: "{{name}} (can't be used)",
1544
+ refusedReleases: "contenthub can't pin these Releases:",
1545
+ refusedReleaseReasons: "{{name}}: {{reasons}}",
1538
1546
  changeSet: "Change Set",
1539
1547
  changeSetHelp: "New Content is created in a Change Set and exists only there until it is published.",
1540
1548
  changeSetRequired: "Choose a Change Set.",
@@ -1785,19 +1793,38 @@ var V = {
1785
1793
  confirm: "Archive"
1786
1794
  }
1787
1795
  }
1788
- }, W = "contenthub-ui", G = {
1789
- en: { [W]: U },
1790
- de: { [W]: H }
1791
- }, K = {
1792
- namespace: W,
1793
- resources: G
1794
- }, q = 200;
1795
- function J(e, t = !0) {
1796
- return M({
1797
- queryKey: V.openChangeSets(),
1796
+ }, K = "contenthub-ui", q = {
1797
+ en: { [K]: fe },
1798
+ de: { [K]: G }
1799
+ }, pe = {
1800
+ namespace: K,
1801
+ resources: q
1802
+ };
1803
+ //#endregion
1804
+ //#region src/common/blueprint-source.ts
1805
+ function me(t) {
1806
+ return {
1807
+ searchBlueprints: (e) => t.searchBlueprints(e),
1808
+ async getBlueprints(n) {
1809
+ let r = [...new Set(n.filter((e) => e !== ""))], i = [];
1810
+ for (let t = 0; t < r.length; t += e) i.push(r.slice(t, t + e));
1811
+ return (await Promise.all(i.map((e) => t.getBlueprints(e)))).flat();
1812
+ },
1813
+ listReleases: (e) => t.listBlueprintReleases(e)
1814
+ };
1815
+ }
1816
+ function he(e, t) {
1817
+ return o(() => t ?? me(e), [e, t]);
1818
+ }
1819
+ //#endregion
1820
+ //#region src/common/use-open-change-sets.ts
1821
+ var J = 200;
1822
+ function ge(e, t = !0) {
1823
+ return P({
1824
+ queryKey: W.openChangeSets(),
1798
1825
  queryFn: () => e.listChangeSets({
1799
1826
  state: "open",
1800
- pageSize: q
1827
+ pageSize: J
1801
1828
  }),
1802
1829
  enabled: t
1803
1830
  });
@@ -1805,20 +1832,20 @@ function J(e, t = !0) {
1805
1832
  //#endregion
1806
1833
  //#region src/screens/collection-tree.tsx
1807
1834
  var Y = "__all__";
1808
- function he(e, t) {
1835
+ function _e(e, t) {
1809
1836
  let n = new Map(t.map((e) => [e.id, e])), r = [], i = /* @__PURE__ */ new Set(), a = n.get(e);
1810
1837
  for (; a && !i.has(a.id);) i.add(a.id), r.unshift(a), a = n.get(a.parentId);
1811
1838
  return r;
1812
1839
  }
1813
1840
  function X() {
1814
- let { t: e } = P(W);
1815
- return /* @__PURE__ */ c(N, {
1841
+ let { t: e } = I(K);
1842
+ return /* @__PURE__ */ u(se, {
1816
1843
  size: 12,
1817
1844
  "aria-label": e("library.restricted")
1818
1845
  });
1819
1846
  }
1820
- function ge({ collections: e, activeId: t, onSelect: n }) {
1821
- let { t: r } = P(W), i = a(() => new Map(e.map((e) => [e.id, e])), [e]), s = a(() => {
1847
+ function ve({ collections: e, activeId: t, onSelect: n }) {
1848
+ let { t: r } = I(K), i = o(() => new Map(e.map((e) => [e.id, e])), [e]), a = o(() => {
1822
1849
  let t = /* @__PURE__ */ new Map();
1823
1850
  for (let n of e) {
1824
1851
  let e = n.parentId !== "" && i.has(n.parentId) ? n.parentId : "", r = t.get(e) ?? [];
@@ -1837,7 +1864,7 @@ function ge({ collections: e, activeId: t, onSelect: n }) {
1837
1864
  children: i.map((e) => n(e, a))
1838
1865
  };
1839
1866
  }, a = (t.get("") ?? []).map((e) => n(e, /* @__PURE__ */ new Set([e.id])));
1840
- return T({
1867
+ return E({
1841
1868
  rootNode: {
1842
1869
  id: "ROOT",
1843
1870
  name: "",
@@ -1855,24 +1882,24 @@ function ge({ collections: e, activeId: t, onSelect: n }) {
1855
1882
  e,
1856
1883
  i,
1857
1884
  r
1858
- ]), [u] = o(() => he(t, e).slice(0, -1).map((e) => e.id));
1859
- return /* @__PURE__ */ l(S, {
1860
- collection: s,
1885
+ ]), [s] = c(() => _e(t, e).slice(0, -1).map((e) => e.id));
1886
+ return /* @__PURE__ */ d(w, {
1887
+ collection: a,
1861
1888
  size: "sm",
1862
1889
  selectedValue: [t === "" ? Y : t],
1863
- defaultExpandedValue: u,
1890
+ defaultExpandedValue: s,
1864
1891
  onSelectionChange: (e) => {
1865
1892
  let t = e.selectedValue[0];
1866
1893
  t !== void 0 && n(t === Y ? "" : t);
1867
1894
  },
1868
- children: [/* @__PURE__ */ c(b, {
1895
+ children: [/* @__PURE__ */ u(ee, {
1869
1896
  srOnly: !0,
1870
1897
  children: r("library.collections")
1871
- }), /* @__PURE__ */ c(C, { children: /* @__PURE__ */ c(x, { render: ({ node: e, nodeState: t }) => t.isBranch ? /* @__PURE__ */ l(h, { children: [
1872
- /* @__PURE__ */ c(g, { children: /* @__PURE__ */ c(ce, { size: 14 }) }),
1873
- /* @__PURE__ */ c(_, { children: e.name }),
1874
- e.restricted ? /* @__PURE__ */ c(X, {}) : null
1875
- ] }) : /* @__PURE__ */ l(v, { children: [/* @__PURE__ */ c(y, { children: e.name }), e.restricted ? /* @__PURE__ */ c(X, {}) : null] }) }) })]
1898
+ }), /* @__PURE__ */ u(T, { children: /* @__PURE__ */ u(C, { render: ({ node: e, nodeState: t }) => t.isBranch ? /* @__PURE__ */ d(v, { children: [
1899
+ /* @__PURE__ */ u(y, { children: /* @__PURE__ */ u(F, { size: 14 }) }),
1900
+ /* @__PURE__ */ u(b, { children: e.name }),
1901
+ e.restricted ? /* @__PURE__ */ u(X, {}) : null
1902
+ ] }) : /* @__PURE__ */ d(x, { children: [/* @__PURE__ */ u(S, { children: e.name }), e.restricted ? /* @__PURE__ */ u(X, {}) : null] }) }) })]
1876
1903
  });
1877
1904
  }
1878
1905
  //#endregion
@@ -1881,94 +1908,94 @@ var Z = {
1881
1908
  name: "",
1882
1909
  sourceDate: "",
1883
1910
  sourceReference: ""
1884
- }, Q = "contenthub-create-change-set", $ = /^[^\u0000-\u001f\u007f]*$/;
1885
- function _e({ open: t, onClose: n, onSubmit: r }) {
1886
- let { t: s } = P(W), d = a(() => B.object({
1887
- name: B.string().trim().min(1, s("changeSets.form.nameRequired")).max(200, s("changeSets.form.tooLong", { max: 200 })).regex($, s("changeSets.form.oneLine")),
1888
- sourceDate: B.string().trim(),
1889
- sourceReference: B.string().trim().max(500, s("changeSets.form.tooLong", { max: 500 })).regex($, s("changeSets.form.oneLine"))
1911
+ }, ye = "contenthub-create-change-set", Q = /^[^\u0000-\u001f\u007f]*$/;
1912
+ function be({ open: e, onClose: n, onSubmit: r }) {
1913
+ let { t: i } = I(K), s = o(() => U.object({
1914
+ name: U.string().trim().min(1, i("changeSets.form.nameRequired")).max(200, i("changeSets.form.tooLong", { max: 200 })).regex(Q, i("changeSets.form.oneLine")),
1915
+ sourceDate: U.string().trim(),
1916
+ sourceReference: U.string().trim().max(500, i("changeSets.form.tooLong", { max: 500 })).regex(Q, i("changeSets.form.oneLine"))
1890
1917
  }).superRefine((e, t) => {
1891
1918
  e.sourceReference !== "" && e.sourceDate === "" && t.addIssue({
1892
1919
  code: "custom",
1893
1920
  path: ["sourceDate"],
1894
- message: s("changeSets.form.sourceDateRequired")
1921
+ message: i("changeSets.form.sourceDateRequired")
1895
1922
  }), e.sourceDate !== "" && e.sourceReference === "" && t.addIssue({
1896
1923
  code: "custom",
1897
1924
  path: ["sourceReference"],
1898
- message: s("changeSets.form.sourceReferenceRequired")
1925
+ message: i("changeSets.form.sourceReferenceRequired")
1899
1926
  });
1900
- }), [s]), f = R({
1901
- resolver: de(d),
1927
+ }), [i]), l = le({
1928
+ resolver: L(s),
1902
1929
  defaultValues: Z
1903
- }), [p, m] = o(null), h = f.formState.isSubmitting;
1904
- i(() => {
1905
- t && (f.reset(Z), m(null));
1906
- }, [t, f]);
1907
- let g = f.handleSubmit(async (t) => {
1930
+ }), [p, m] = c(null), h = l.formState.isSubmitting;
1931
+ a(() => {
1932
+ e && (l.reset(Z), m(null));
1933
+ }, [e, l]);
1934
+ let _ = l.handleSubmit(async (e) => {
1908
1935
  m(null);
1909
1936
  try {
1910
1937
  await r({
1911
- name: t.name,
1912
- source: t.sourceDate === "" ? void 0 : {
1913
- date: t.sourceDate,
1914
- reference: t.sourceReference
1938
+ name: e.name,
1939
+ source: e.sourceDate === "" ? void 0 : {
1940
+ date: e.sourceDate,
1941
+ reference: e.sourceReference
1915
1942
  }
1916
1943
  });
1917
- } catch (t) {
1918
- m(t instanceof e ? t.message : s("changeSets.form.failed"));
1944
+ } catch (e) {
1945
+ m(e instanceof t ? e.message : i("changeSets.form.failed"));
1919
1946
  }
1920
1947
  });
1921
- return /* @__PURE__ */ c(ee, {
1922
- open: t,
1948
+ return /* @__PURE__ */ u(g, {
1949
+ open: e,
1923
1950
  onClose: n,
1924
1951
  lazyMount: !0,
1925
1952
  unmountOnExit: !0,
1926
1953
  size: "md",
1927
- header: s("changeSets.form.createTitle"),
1928
- footer: /* @__PURE__ */ l(D, {
1954
+ header: i("changeSets.form.createTitle"),
1955
+ footer: /* @__PURE__ */ d(O, {
1929
1956
  gap: "2",
1930
- children: [/* @__PURE__ */ c(u, {
1957
+ children: [/* @__PURE__ */ u(f, {
1931
1958
  size: "sm",
1932
1959
  variant: "ghost",
1933
1960
  onClick: n,
1934
- children: s("common.cancel")
1935
- }), /* @__PURE__ */ c(u, {
1961
+ children: i("common.cancel")
1962
+ }), /* @__PURE__ */ u(f, {
1936
1963
  type: "submit",
1937
- form: Q,
1964
+ form: ye,
1938
1965
  size: "sm",
1939
1966
  variant: "solid",
1940
1967
  loading: h,
1941
- children: s("changeSets.form.createSubmit")
1968
+ children: i("changeSets.form.createSubmit")
1942
1969
  })]
1943
1970
  }),
1944
- children: /* @__PURE__ */ c(L, {
1945
- ...f,
1946
- children: /* @__PURE__ */ c("form", {
1947
- id: Q,
1971
+ children: /* @__PURE__ */ u(V, {
1972
+ ...l,
1973
+ children: /* @__PURE__ */ u("form", {
1974
+ id: ye,
1948
1975
  onSubmit: (e) => {
1949
- e.preventDefault(), g();
1976
+ e.preventDefault(), _();
1950
1977
  },
1951
- children: /* @__PURE__ */ l(ne, {
1978
+ children: /* @__PURE__ */ d(j, {
1952
1979
  gap: "4",
1953
1980
  children: [
1954
- /* @__PURE__ */ c(I, {
1981
+ /* @__PURE__ */ u(z, {
1955
1982
  name: "name",
1956
- label: s("changeSets.form.name"),
1957
- helperText: s("changeSets.form.nameHelp"),
1983
+ label: i("changeSets.form.name"),
1984
+ helperText: i("changeSets.form.nameHelp"),
1958
1985
  required: !0
1959
1986
  }),
1960
- /* @__PURE__ */ c(I, {
1987
+ /* @__PURE__ */ u(z, {
1961
1988
  name: "sourceDate",
1962
1989
  type: "date",
1963
- label: s("changeSets.form.sourceDate"),
1964
- helperText: s("changeSets.form.sourceDateHelp")
1990
+ label: i("changeSets.form.sourceDate"),
1991
+ helperText: i("changeSets.form.sourceDateHelp")
1965
1992
  }),
1966
- /* @__PURE__ */ c(I, {
1993
+ /* @__PURE__ */ u(z, {
1967
1994
  name: "sourceReference",
1968
- label: s("changeSets.form.sourceReference"),
1969
- helperText: s("changeSets.form.sourceReferenceHelp")
1995
+ label: i("changeSets.form.sourceReference"),
1996
+ helperText: i("changeSets.form.sourceReferenceHelp")
1970
1997
  }),
1971
- p ? /* @__PURE__ */ c(E, {
1998
+ p ? /* @__PURE__ */ u(D, {
1972
1999
  status: "error",
1973
2000
  title: p
1974
2001
  }) : null
@@ -1980,8 +2007,8 @@ function _e({ open: t, onClose: n, onSubmit: r }) {
1980
2007
  }
1981
2008
  //#endregion
1982
2009
  //#region src/screens/change-set-choice.tsx
1983
- var ve = "@new";
1984
- function ye(e, t, n = !1) {
2010
+ var xe = "@new";
2011
+ function Se(e, t, n = !1) {
1985
2012
  if (!t.changeSetId) return {
1986
2013
  path: "changeSetId",
1987
2014
  message: e("library.create.changeSetRequired")
@@ -1994,42 +2021,42 @@ function ye(e, t, n = !1) {
1994
2021
  } : [...r].length > 200 ? {
1995
2022
  path: "changeSetName",
1996
2023
  message: e("changeSets.form.tooLong", { max: 200 })
1997
- } : $.test(r) ? null : {
2024
+ } : Q.test(r) ? null : {
1998
2025
  path: "changeSetName",
1999
2026
  message: e("changeSets.form.oneLine")
2000
2027
  };
2001
2028
  }
2002
- function be({ client: e, open: t, helperText: n, nameHelperText: r, nameOptional: i = !1 }) {
2003
- let { t: o } = P(W), u = J(e, t), d = a(() => [{
2004
- id: ve,
2005
- label: o("library.create.newChangeSet")
2006
- }, ...(u.data?.changeSets ?? []).map((e) => ({
2029
+ function Ce({ client: e, open: t, helperText: n, nameHelperText: r, nameOptional: i = !1 }) {
2030
+ let { t: a } = I(K), s = ge(e, t), c = o(() => [{
2031
+ id: xe,
2032
+ label: a("library.create.newChangeSet")
2033
+ }, ...(s.data?.changeSets ?? []).map((e) => ({
2007
2034
  id: e.id,
2008
2035
  label: e.name
2009
- }))], [u.data, o]), f = z({ name: "changeSetId" });
2010
- return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(F, {
2036
+ }))], [s.data, a]), f = H({ name: "changeSetId" });
2037
+ return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(R, {
2011
2038
  name: "changeSetId",
2012
- label: o("library.create.changeSet"),
2039
+ label: a("library.create.changeSet"),
2013
2040
  helperText: n,
2014
- options: d,
2041
+ options: c,
2015
2042
  isClearable: !1,
2016
2043
  required: !0
2017
- }), f === "@new" ? /* @__PURE__ */ c(I, {
2044
+ }), f === "@new" ? /* @__PURE__ */ u(z, {
2018
2045
  name: "changeSetName",
2019
- label: o("library.create.changeSetName"),
2020
- helperText: r ?? o("changeSets.form.nameHelp"),
2046
+ label: a("library.create.changeSetName"),
2047
+ helperText: r ?? a("changeSets.form.nameHelp"),
2021
2048
  required: !i
2022
2049
  }) : null] });
2023
2050
  }
2024
2051
  //#endregion
2025
2052
  //#region src/screens/create-content-modal.tsx
2026
- var xe = "contenthub-create-content";
2027
- function Se({ open: s, onClose: d, client: f, blueprintSource: p, initialChangeSetId: m, onCreated: h }) {
2028
- let { t: g } = P(W), _ = se(), v = a(() => B.object({
2029
- blueprintId: B.string().nullable().refine((e) => !!e, g("library.create.blueprintRequired")),
2030
- releaseId: B.string().nullable().refine((e) => !!e, g("library.create.releaseRequired")),
2031
- changeSetId: B.string().nullable().refine((e) => !!e, g("library.create.changeSetRequired")),
2032
- changeSetName: B.string().trim()
2053
+ var we = "contenthub-create-content", $ = (e) => !e.refusals?.length, Te = (e) => e.path ? `${e.code} (${e.path})` : e.code;
2054
+ function Ee({ open: e, onClose: l, client: p, blueprintSource: m, initialChangeSetId: h, onCreated: _ }) {
2055
+ let { t: v } = I(K), y = ae(), b = o(() => U.object({
2056
+ blueprintId: U.string().nullable().refine((e) => !!e, v("library.create.blueprintRequired")),
2057
+ releaseId: U.string().nullable().refine((e) => !!e, v("library.create.releaseRequired")),
2058
+ changeSetId: U.string().nullable().refine((e) => !!e, v("library.create.changeSetRequired")),
2059
+ changeSetName: U.string().trim()
2033
2060
  }).superRefine((e, t) => {
2034
2061
  if (e.changeSetId !== "@new") return;
2035
2062
  let n = (e) => t.addIssue({
@@ -2037,57 +2064,59 @@ function Se({ open: s, onClose: d, client: f, blueprintSource: p, initialChangeS
2037
2064
  path: ["changeSetName"],
2038
2065
  message: e
2039
2066
  });
2040
- e.changeSetName === "" ? n(g("changeSets.form.nameRequired")) : [...e.changeSetName].length > 200 ? n(g("changeSets.form.tooLong", { max: 200 })) : $.test(e.changeSetName) || n(g("changeSets.form.oneLine"));
2041
- }), [g]), y = a(() => ({
2067
+ e.changeSetName === "" ? n(v("changeSets.form.nameRequired")) : [...e.changeSetName].length > 200 ? n(v("changeSets.form.tooLong", { max: 200 })) : Q.test(e.changeSetName) || n(v("changeSets.form.oneLine"));
2068
+ }), [v]), x = o(() => ({
2042
2069
  blueprintId: null,
2043
2070
  releaseId: null,
2044
- changeSetId: m || "@new",
2071
+ changeSetId: h || "@new",
2045
2072
  changeSetName: ""
2046
- }), [m]), b = R({
2047
- resolver: de(v),
2048
- defaultValues: y
2049
- }), [x, S] = o(null), C = b.formState.isSubmitting, w = z({
2050
- control: b.control,
2073
+ }), [h]), S = le({
2074
+ resolver: L(b),
2075
+ defaultValues: x
2076
+ }), [ee, C] = c(null), w = S.formState.isSubmitting, T = H({
2077
+ control: S.control,
2051
2078
  name: "blueprintId"
2052
- }), T = z({
2053
- control: b.control,
2079
+ }), te = H({
2080
+ control: S.control,
2054
2081
  name: "changeSetId"
2055
2082
  });
2056
- i(() => {
2057
- s && (b.reset(y), S(null));
2083
+ a(() => {
2084
+ e && (S.reset(x), C(null));
2058
2085
  }, [
2059
- s,
2060
- b,
2061
- y
2086
+ e,
2087
+ S,
2088
+ x
2062
2089
  ]);
2063
- let te = J(f, s), O = a(() => [{
2064
- id: ve,
2065
- label: g("library.create.newChangeSet")
2066
- }, ...(te.data?.changeSets ?? []).map((e) => ({
2090
+ let E = ge(p, e), k = o(() => [{
2091
+ id: xe,
2092
+ label: v("library.create.newChangeSet")
2093
+ }, ...(E.data?.changeSets ?? []).map((e) => ({
2067
2094
  id: e.id,
2068
2095
  label: e.name
2069
- }))], [te.data, g]), k = M({
2070
- queryKey: V.blueprintReleases(w ?? ""),
2071
- queryFn: () => p.listReleases(w),
2072
- enabled: s && !!w
2073
- }), A = a(() => (k.data ?? []).map((e) => ({
2096
+ }))], [E.data, v]), A = P({
2097
+ queryKey: W.blueprintReleases(T ?? ""),
2098
+ queryFn: () => m.listReleases(T),
2099
+ enabled: e && !!T
2100
+ }), ne = o(() => (A.data ?? []).map((e) => ({
2074
2101
  id: e.id,
2075
- label: e.name
2076
- })), [k.data]);
2077
- i(() => {
2078
- let e = b.getValues("releaseId"), t = k.data;
2079
- if (!w) {
2080
- e !== null && b.setValue("releaseId", null);
2102
+ label: $(e) ? e.name : v("library.create.refusedRelease", { name: e.name }),
2103
+ data: { refused: !$(e) }
2104
+ })), [A.data, v]), N = o(() => (A.data ?? []).filter((e) => !$(e)), [A.data]), re = s(T);
2105
+ a(() => {
2106
+ re.current !== T && (re.current = T, S.setValue("releaseId", null));
2107
+ let e = S.getValues("releaseId"), t = A.data;
2108
+ if (!T) {
2109
+ e !== null && S.setValue("releaseId", null);
2081
2110
  return;
2082
2111
  }
2083
- t && !t.some((t) => t.id === e) && b.setValue("releaseId", t[0]?.id ?? null);
2112
+ t && !t.some((t) => t.id === e && $(t)) && S.setValue("releaseId", t.find($)?.id ?? null);
2084
2113
  }, [
2085
- w,
2086
- k.data,
2087
- b
2114
+ T,
2115
+ A.data,
2116
+ S
2088
2117
  ]);
2089
- let re = !!w && k.isSuccess && k.data.length === 0, ie = r(async ({ query: e, cursor: t, signal: n }) => {
2090
- let r = await p.searchBlueprints({
2118
+ let ie = !!T && A.isSuccess && A.data.length === 0, F = !!T && A.isSuccess && A.data.length > 0 && !A.data.some($), oe = i(async ({ query: e, cursor: t, signal: n }) => {
2119
+ let r = await m.searchBlueprints({
2091
2120
  query: e,
2092
2121
  pageToken: t ?? void 0,
2093
2122
  signal: n
@@ -2099,109 +2128,132 @@ function Se({ open: s, onClose: d, client: f, blueprintSource: p, initialChangeS
2099
2128
  })),
2100
2129
  nextCursor: r.nextPageToken || null
2101
2130
  };
2102
- }, [p]), j = r(async ({ ids: e }) => {
2103
- let t = await p.getBlueprints(e);
2131
+ }, [m]), se = i(async ({ ids: e }) => {
2132
+ let t = await m.getBlueprints(e);
2104
2133
  return e.map((e) => ({
2105
2134
  id: e,
2106
2135
  label: t.find((t) => t.id === e)?.name ?? e
2107
2136
  }));
2108
- }, [p]), ae = b.handleSubmit(async (e) => {
2109
- S(null);
2137
+ }, [m]), ce = S.handleSubmit(async (e) => {
2138
+ C(null);
2110
2139
  let t = e.changeSetId, n = !1;
2111
2140
  try {
2112
2141
  if (t === "@new") {
2113
- let r = await f.createChangeSet({ name: e.changeSetName.trim() });
2114
- n = !0, t = r.id, b.setValue("changeSetId", t);
2142
+ let r = await p.createChangeSet({ name: e.changeSetName.trim() });
2143
+ n = !0, t = r.id, S.setValue("changeSetId", t);
2115
2144
  }
2116
- let r = await f.createContent({
2145
+ let r = await p.createContent({
2117
2146
  changeSetId: t,
2118
2147
  blueprintReleaseId: e.releaseId
2119
2148
  });
2120
- _.invalidateQueries({ queryKey: V.contents() }), h(r);
2149
+ y.invalidateQueries({ queryKey: W.contents() }), _(r);
2121
2150
  } catch (e) {
2122
- if (S(oe(e)), !n) return;
2151
+ if (C(ue(e)), !n) return;
2123
2152
  }
2124
- _.invalidateQueries({ queryKey: V.changeSets() });
2153
+ y.invalidateQueries({ queryKey: W.changeSets() });
2125
2154
  });
2126
- function oe(r) {
2127
- if (r instanceof n) {
2128
- let e = r.reasons.map((e) => e.path ? `${e.code} (${e.path})` : e.code).join(", ");
2129
- return g("library.create.refused", { reasons: e });
2155
+ function ue(e) {
2156
+ if (e instanceof r) {
2157
+ let t = e.reasons.map(Te).join(", ");
2158
+ return v("library.create.refused", { reasons: t });
2130
2159
  }
2131
- return r instanceof t ? g("library.create.changeSetClosed") : r instanceof e ? r.message : g("library.create.failed");
2160
+ return e instanceof n ? v("library.create.changeSetClosed") : e instanceof t ? e.message : v("library.create.failed");
2132
2161
  }
2133
- return /* @__PURE__ */ c(ee, {
2134
- open: s,
2135
- onClose: d,
2162
+ return /* @__PURE__ */ u(g, {
2163
+ open: e,
2164
+ onClose: l,
2136
2165
  lazyMount: !0,
2137
2166
  unmountOnExit: !0,
2138
2167
  size: "md",
2139
- header: g("library.create.title"),
2140
- footer: /* @__PURE__ */ l(D, {
2168
+ header: v("library.create.title"),
2169
+ footer: /* @__PURE__ */ d(O, {
2141
2170
  gap: "2",
2142
- children: [/* @__PURE__ */ c(u, {
2171
+ children: [/* @__PURE__ */ u(f, {
2143
2172
  size: "sm",
2144
2173
  variant: "ghost",
2145
- onClick: d,
2146
- children: g("common.cancel")
2147
- }), /* @__PURE__ */ c(u, {
2174
+ onClick: l,
2175
+ children: v("common.cancel")
2176
+ }), /* @__PURE__ */ u(f, {
2148
2177
  type: "submit",
2149
- form: xe,
2178
+ form: we,
2150
2179
  size: "sm",
2151
2180
  variant: "solid",
2152
- loading: C,
2153
- disabled: re,
2154
- children: g("library.create.submit")
2181
+ loading: w,
2182
+ disabled: ie || F || A.isError,
2183
+ children: v("library.create.submit")
2155
2184
  })]
2156
2185
  }),
2157
- children: /* @__PURE__ */ c(L, {
2158
- ...b,
2159
- children: /* @__PURE__ */ c("form", {
2160
- id: xe,
2186
+ children: /* @__PURE__ */ u(V, {
2187
+ ...S,
2188
+ children: /* @__PURE__ */ u("form", {
2189
+ id: we,
2161
2190
  onSubmit: (e) => {
2162
- e.preventDefault(), ae();
2191
+ e.preventDefault(), ce();
2163
2192
  },
2164
- children: /* @__PURE__ */ l(ne, {
2193
+ children: /* @__PURE__ */ d(j, {
2165
2194
  gap: "4",
2166
2195
  children: [
2167
- /* @__PURE__ */ c(fe, {
2196
+ /* @__PURE__ */ u(B, {
2168
2197
  name: "blueprintId",
2169
- label: g("library.create.blueprint"),
2170
- helperText: g("library.create.blueprintHelp"),
2171
- search: ie,
2172
- resolve: j,
2173
- placeholder: g("library.create.pickBlueprint"),
2198
+ label: v("library.create.blueprint"),
2199
+ helperText: v("library.create.blueprintHelp"),
2200
+ search: oe,
2201
+ resolve: se,
2202
+ placeholder: v("library.create.pickBlueprint"),
2174
2203
  required: !0
2175
2204
  }),
2176
- w ? /* @__PURE__ */ c(F, {
2205
+ T ? /* @__PURE__ */ u(R, {
2177
2206
  name: "releaseId",
2178
- label: g("library.create.release"),
2179
- helperText: g("library.create.releaseHelp"),
2180
- options: A,
2207
+ label: v("library.create.release"),
2208
+ helperText: v("library.create.releaseHelp"),
2209
+ options: ne,
2181
2210
  isClearable: !1,
2182
- required: !0
2211
+ required: !0,
2212
+ selectProps: { isOptionDisabled: (e) => e.data?.refused === !0 }
2213
+ }) : null,
2214
+ ie ? /* @__PURE__ */ u(D, {
2215
+ status: "warning",
2216
+ title: v("library.create.noRelease")
2183
2217
  }) : null,
2184
- re ? /* @__PURE__ */ c(E, {
2218
+ F ? /* @__PURE__ */ u(D, {
2185
2219
  status: "warning",
2186
- title: g("library.create.noRelease")
2220
+ title: v("library.create.noUsableRelease")
2187
2221
  }) : null,
2188
- /* @__PURE__ */ c(F, {
2222
+ A.isError ? /* @__PURE__ */ u(D, {
2223
+ status: "error",
2224
+ title: v("library.create.releasesFailed")
2225
+ }) : null,
2226
+ N.length > 0 ? /* @__PURE__ */ u(D, {
2227
+ status: "info",
2228
+ title: v("library.create.refusedReleases"),
2229
+ children: /* @__PURE__ */ u(j, {
2230
+ gap: "1",
2231
+ children: N.map((e) => /* @__PURE__ */ u(M, {
2232
+ textStyle: "sm",
2233
+ children: v("library.create.refusedReleaseReasons", {
2234
+ name: e.name,
2235
+ reasons: (e.refusals ?? []).map(Te).join(", ")
2236
+ })
2237
+ }, e.id))
2238
+ })
2239
+ }) : null,
2240
+ /* @__PURE__ */ u(R, {
2189
2241
  name: "changeSetId",
2190
- label: g("library.create.changeSet"),
2191
- helperText: g("library.create.changeSetHelp"),
2192
- options: O,
2242
+ label: v("library.create.changeSet"),
2243
+ helperText: v("library.create.changeSetHelp"),
2244
+ options: k,
2193
2245
  isClearable: !1,
2194
2246
  required: !0
2195
2247
  }),
2196
- T === "@new" ? /* @__PURE__ */ c(I, {
2248
+ te === "@new" ? /* @__PURE__ */ u(z, {
2197
2249
  name: "changeSetName",
2198
- label: g("library.create.changeSetName"),
2199
- helperText: g("changeSets.form.nameHelp"),
2250
+ label: v("library.create.changeSetName"),
2251
+ helperText: v("changeSets.form.nameHelp"),
2200
2252
  required: !0
2201
2253
  }) : null,
2202
- x ? /* @__PURE__ */ c(E, {
2254
+ ee ? /* @__PURE__ */ u(D, {
2203
2255
  status: "error",
2204
- title: x
2256
+ title: ee
2205
2257
  }) : null
2206
2258
  ]
2207
2259
  })
@@ -2211,82 +2263,90 @@ function Se({ open: s, onClose: d, client: f, blueprintSource: p, initialChangeS
2211
2263
  }
2212
2264
  //#endregion
2213
2265
  //#region src/screens/content-library.tsx
2214
- var Ce = [
2266
+ var De = [
2215
2267
  "main",
2216
2268
  "in_force",
2217
2269
  "change_set"
2218
- ], we = 50, Te = 300, Ee = 5, De = "@me", Oe = "collection";
2219
- function ke(e) {
2270
+ ], Oe = 50, ke = 300, Ae = 5, je = "@me", Me = "collection";
2271
+ function Ne(e) {
2220
2272
  return Object.values(e).filter((e) => typeof e == "string" && e.trim() !== "" && e.length <= 200).slice(0, 2).join(" ");
2221
2273
  }
2222
- function Ae({ client: t, blueprintSource: n, onOpenContent: s, onOpenBranch: ee }) {
2223
- let { t: h } = P(W), [g, _] = me(), v = g.get("collection") ?? "", [y, b] = o("main"), [x, S] = o(""), [C, T] = o(""), [se, ce] = o(""), [N, de] = o(""), [F, I] = o(""), [fe, L] = o(!1), { userId: R, members: z } = pe();
2224
- i(() => {
2225
- let e = setTimeout(() => ce(C), Te);
2274
+ function Pe({ client: e, blueprintSource: n, onOpenContent: r, onOpenBranch: s }) {
2275
+ let { t: l } = I(K), g = he(e, n), [v, y] = de(), b = v.get("collection") ?? "", [x, S] = c("main"), [ee, C] = c(""), [w, T] = c(""), [E, ae] = c(""), [F, se] = c(""), [L, R] = c(""), [z, B] = c(!1), { userId: V, members: le } = ue();
2276
+ a(() => {
2277
+ let e = setTimeout(() => ae(w), ke);
2226
2278
  return () => clearTimeout(e);
2227
- }, [C]);
2228
- let B = r((e) => _((t) => {
2279
+ }, [w]);
2280
+ let H = i((e) => y((t) => {
2229
2281
  let n = new URLSearchParams(t);
2230
- return e ? n.set(Oe, e) : n.delete(Oe), n;
2231
- }), [_]), H = M({
2232
- queryKey: V.collections(),
2233
- queryFn: () => t.listCollections()
2234
- }), U = J(t), G = r((e) => U.data?.changeSets.find((t) => t.id === e)?.name ?? e, [U.data]), K = x || U.data?.changeSets[0]?.id || "", q = a(() => y === "change_set" ? K ? {
2282
+ return e ? n.set(Me, e) : n.delete(Me), n;
2283
+ }), [y]), U = P({
2284
+ queryKey: W.collections(),
2285
+ queryFn: () => e.listCollections()
2286
+ }), G = ge(e), fe = i((e) => G.data?.changeSets.find((t) => t.id === e)?.name ?? e, [G.data]), q = ee || G.data?.changeSets[0]?.id || "", pe = o(() => x === "change_set" ? q ? {
2235
2287
  kind: "change_set",
2236
- changeSetId: K
2237
- } : void 0 : { kind: y }, [y, K]), Y = a(() => ({
2238
- view: q,
2239
- collectionId: v || void 0,
2240
- search: y === "in_force" ? void 0 : se.trim() || void 0,
2241
- blueprintIds: N ? [N] : void 0,
2242
- assigneeId: F === De ? R : F || void 0
2288
+ changeSetId: q
2289
+ } : void 0 : { kind: x }, [x, q]), me = o(() => ({
2290
+ view: pe,
2291
+ collectionId: b || void 0,
2292
+ search: x === "in_force" ? void 0 : E.trim() || void 0,
2293
+ blueprintIds: F ? [F] : void 0,
2294
+ assigneeId: L === je ? V : L || void 0
2243
2295
  }), [
2244
- q,
2245
- v,
2246
- y,
2247
- se,
2248
- N,
2296
+ pe,
2297
+ b,
2298
+ x,
2299
+ E,
2249
2300
  F,
2250
- R
2251
- ]), X = oe({
2252
- queryKey: V.contentList(Y),
2253
- queryFn: ({ pageParam: e }) => t.listContents({
2254
- ...Y,
2255
- pageSize: we,
2256
- pageToken: e
2301
+ L,
2302
+ V
2303
+ ]), J = ie({
2304
+ queryKey: W.contentList(me),
2305
+ queryFn: ({ pageParam: t }) => e.listContents({
2306
+ ...me,
2307
+ pageSize: Oe,
2308
+ pageToken: t
2257
2309
  }),
2258
2310
  initialPageParam: "",
2259
2311
  getNextPageParam: (e) => e.nextPageToken || void 0,
2260
- enabled: q !== void 0,
2261
- placeholderData: ae
2262
- }), Z = a(() => X.data?.pages.flatMap((e) => e.contents) ?? [], [X.data]), Q = a(() => [...new Set(Z.map((e) => e.blueprintId))].sort(), [Z]), $ = M({
2263
- queryKey: V.blueprintNames(Q),
2264
- queryFn: () => n.getBlueprints(Q),
2265
- enabled: n !== void 0 && Q.length > 0,
2266
- placeholderData: ae,
2312
+ enabled: pe !== void 0,
2313
+ placeholderData: re
2314
+ }), Y = o(() => J.data?.pages.flatMap((e) => e.contents) ?? [], [J.data]), X = o(() => [...new Set(Y.map((e) => e.blueprintId))].sort(), [Y]), Z = P({
2315
+ queryKey: W.blueprintNames(X),
2316
+ queryFn: () => g.getBlueprints(X),
2317
+ enabled: X.length > 0,
2318
+ placeholderData: re,
2267
2319
  staleTime: 6e4
2268
- }), _e = r((e) => $.data?.find((t) => t.id === e)?.name ?? e, [$.data]), ve = M({
2269
- queryKey: V.blueprintFilterOptions(),
2320
+ }), ye = i((e) => Z.data?.find((t) => t.id === e)?.name ?? e, [Z.data]), Q = P({
2321
+ queryKey: W.blueprintFilterOptions(),
2270
2322
  queryFn: async () => {
2271
- let e = n, t = [], r = "";
2272
- for (let n = 0; n < Ee; n++) {
2273
- let n = await e.searchBlueprints({
2323
+ let e = [], t = "";
2324
+ for (let n = 0; n < Ae; n++) {
2325
+ let n = await g.searchBlueprints({
2274
2326
  query: "",
2275
- pageToken: r
2327
+ pageToken: t
2276
2328
  });
2277
- if (t.push(...n.blueprints), r = n.nextPageToken, r === "") break;
2329
+ if (e.push(...n.blueprints), t = n.nextPageToken, t === "") break;
2278
2330
  }
2279
- return t;
2331
+ return e;
2280
2332
  },
2281
- enabled: n !== void 0,
2282
2333
  staleTime: 6e4
2283
- }), ye = a(() => [
2334
+ }), be = o(() => /* @__PURE__ */ new Map(), [g]), xe = o(() => {
2335
+ for (let e of Z.data ?? []) be.set(e.id, e);
2336
+ let e = new Map(be);
2337
+ for (let t of Q.data ?? []) e.set(t.id, t);
2338
+ return [...e.values()].sort((e, t) => e.name.localeCompare(t.name));
2339
+ }, [
2340
+ be,
2341
+ Q.data,
2342
+ Z.data
2343
+ ]), Se = o(() => [
2284
2344
  {
2285
2345
  id: "content",
2286
- header: h("library.columns.content"),
2346
+ header: l("library.columns.content"),
2287
2347
  cell: ({ row: e }) => {
2288
- let t = ke(e.original.data);
2289
- return /* @__PURE__ */ c(w, {
2348
+ let t = Ne(e.original.data);
2349
+ return /* @__PURE__ */ u(te, {
2290
2350
  value: t || e.original.id,
2291
2351
  subText: t ? e.original.id : void 0
2292
2352
  });
@@ -2294,201 +2354,188 @@ function Ae({ client: t, blueprintSource: n, onOpenContent: s, onOpenBranch: ee
2294
2354
  },
2295
2355
  {
2296
2356
  id: "blueprint",
2297
- header: h("library.columns.blueprint"),
2298
- cell: ({ row: e }) => /* @__PURE__ */ c(w, { value: _e(e.original.blueprintId) })
2357
+ header: l("library.columns.blueprint"),
2358
+ cell: ({ row: e }) => /* @__PURE__ */ u(te, { value: ye(e.original.blueprintId) })
2299
2359
  },
2300
2360
  {
2301
2361
  id: "readOn",
2302
- header: h("library.columns.readOn"),
2362
+ header: l("library.columns.readOn"),
2303
2363
  cell: ({ row: e }) => {
2304
- let t = e.original, n = t.changeSetId ? G(t.changeSetId) : t.releaseId ? h("library.readOn.release") : h("library.readOn.main");
2305
- return /* @__PURE__ */ c(w, { value: n });
2364
+ let t = e.original, n = t.changeSetId ? fe(t.changeSetId) : t.releaseId ? l("library.readOn.release") : l("library.readOn.main");
2365
+ return /* @__PURE__ */ u(te, { value: n });
2306
2366
  }
2307
2367
  },
2308
2368
  {
2309
2369
  id: "revised",
2310
- header: h("library.columns.revised"),
2311
- cell: ({ row: e }) => /* @__PURE__ */ c(p, { value: e.original.revisionCreateTime })
2370
+ header: l("library.columns.revised"),
2371
+ cell: ({ row: e }) => /* @__PURE__ */ u(h, { value: e.original.revisionCreateTime })
2312
2372
  }
2313
2373
  ], [
2314
- h,
2315
- _e,
2316
- G
2317
- ]), be = n ? /* @__PURE__ */ l(u, {
2374
+ l,
2375
+ ye,
2376
+ fe
2377
+ ]), Ce = /* @__PURE__ */ d(f, {
2318
2378
  size: "sm",
2319
2379
  variant: "solid",
2320
- onClick: () => L(!0),
2321
- children: [/* @__PURE__ */ c(ue, { size: 16 }), h("library.create.button")]
2322
- }) : /* @__PURE__ */ c(re, {
2323
- content: h("library.create.unavailable"),
2324
- children: /* @__PURE__ */ c(te, {
2325
- as: "span",
2326
- display: "inline-flex",
2327
- children: /* @__PURE__ */ l(u, {
2328
- size: "sm",
2329
- variant: "solid",
2330
- disabled: !0,
2331
- title: h("library.create.unavailable"),
2332
- children: [/* @__PURE__ */ c(ue, { size: 16 }), h("library.create.button")]
2333
- })
2334
- })
2335
- }), xe = X.error instanceof e ? X.error.message : h("library.loadError"), Ae = v ? he(v, H.data ?? []).map((e) => e.name).join(" / ") || v : h("library.allContent");
2336
- return /* @__PURE__ */ l(ie, {
2337
- title: h("library.title"),
2338
- breadcrumbs: [{ label: h("library.title") }],
2339
- actions: be,
2340
- toolbar: /* @__PURE__ */ l(m, { children: [
2341
- y === "in_force" ? /* @__PURE__ */ c(A, {
2380
+ onClick: () => B(!0),
2381
+ children: [/* @__PURE__ */ u(ce, { size: 16 }), l("library.create.button")]
2382
+ }), we = J.error instanceof t ? J.error.message : l("library.loadError"), $ = b ? _e(b, U.data ?? []).map((e) => e.name).join(" / ") || b : l("library.allContent");
2383
+ return /* @__PURE__ */ d(ne, {
2384
+ title: l("library.title"),
2385
+ breadcrumbs: [{ label: l("library.title") }],
2386
+ actions: Ce,
2387
+ toolbar: /* @__PURE__ */ d(_, { children: [
2388
+ x === "in_force" ? /* @__PURE__ */ u(M, {
2342
2389
  fontSize: "sm",
2343
2390
  color: "muted",
2344
- children: h("library.filter.searchInForce")
2345
- }) : /* @__PURE__ */ c(m.Search, {
2346
- placeholder: h("library.filter.searchPlaceholder"),
2347
- value: C,
2391
+ children: l("library.filter.searchInForce")
2392
+ }) : /* @__PURE__ */ u(_.Search, {
2393
+ placeholder: l("library.filter.searchPlaceholder"),
2394
+ value: w,
2348
2395
  onChange: (e) => T([...e].slice(0, 200).join(""))
2349
2396
  }),
2350
- /* @__PURE__ */ l(m.Filters, { children: [
2351
- /* @__PURE__ */ c(O, {
2397
+ /* @__PURE__ */ d(_.Filters, { children: [
2398
+ /* @__PURE__ */ u(k, {
2352
2399
  size: "sm",
2353
- "aria-label": h("library.filter.view"),
2354
- value: y,
2400
+ "aria-label": l("library.filter.view"),
2401
+ value: x,
2355
2402
  onChange: (e) => {
2356
2403
  let t = e.target.value;
2357
- t === "in_force" && (T(""), ce("")), b(t);
2404
+ t === "in_force" && (T(""), ae("")), S(t);
2358
2405
  },
2359
- children: Ce.map((e) => /* @__PURE__ */ c("option", {
2406
+ children: De.map((e) => /* @__PURE__ */ u("option", {
2360
2407
  value: e,
2361
- children: h(`library.view.${e}`)
2408
+ children: l(`library.view.${e}`)
2362
2409
  }, e))
2363
2410
  }),
2364
- y === "change_set" ? /* @__PURE__ */ l(O, {
2411
+ x === "change_set" ? /* @__PURE__ */ d(k, {
2365
2412
  size: "sm",
2366
- "aria-label": h("library.filter.changeSet"),
2367
- value: K,
2368
- onChange: (e) => S(e.target.value),
2369
- children: [U.data?.changeSets.length ? null : /* @__PURE__ */ c("option", {
2413
+ "aria-label": l("library.filter.changeSet"),
2414
+ value: q,
2415
+ onChange: (e) => C(e.target.value),
2416
+ children: [G.data?.changeSets.length ? null : /* @__PURE__ */ u("option", {
2370
2417
  value: "",
2371
- children: h("library.filter.noOpenChangeSet")
2372
- }), (U.data?.changeSets ?? []).map((e) => /* @__PURE__ */ c("option", {
2418
+ children: l("library.filter.noOpenChangeSet")
2419
+ }), (G.data?.changeSets ?? []).map((e) => /* @__PURE__ */ u("option", {
2373
2420
  value: e.id,
2374
2421
  children: e.name
2375
2422
  }, e.id))]
2376
2423
  }) : null,
2377
- n ? /* @__PURE__ */ l(O, {
2424
+ /* @__PURE__ */ d(k, {
2378
2425
  size: "sm",
2379
- "aria-label": h("library.filter.blueprint"),
2380
- value: N,
2381
- onChange: (e) => de(e.target.value),
2382
- children: [/* @__PURE__ */ c("option", {
2426
+ "aria-label": l("library.filter.blueprint"),
2427
+ value: F,
2428
+ onChange: (e) => se(e.target.value),
2429
+ children: [/* @__PURE__ */ u("option", {
2383
2430
  value: "",
2384
- children: h("library.filter.anyBlueprint")
2385
- }), (ve.data ?? []).map((e) => /* @__PURE__ */ c("option", {
2431
+ children: l("library.filter.anyBlueprint")
2432
+ }), xe.map((e) => /* @__PURE__ */ u("option", {
2386
2433
  value: e.id,
2387
2434
  children: e.name
2388
2435
  }, e.id))]
2389
- }) : null,
2390
- /* @__PURE__ */ l(O, {
2436
+ }),
2437
+ /* @__PURE__ */ d(k, {
2391
2438
  size: "sm",
2392
- "aria-label": h("library.filter.assignee"),
2393
- value: F,
2394
- onChange: (e) => I(e.target.value),
2439
+ "aria-label": l("library.filter.assignee"),
2440
+ value: L,
2441
+ onChange: (e) => R(e.target.value),
2395
2442
  children: [
2396
- /* @__PURE__ */ c("option", {
2443
+ /* @__PURE__ */ u("option", {
2397
2444
  value: "",
2398
- children: h("library.filter.anyone")
2445
+ children: l("library.filter.anyone")
2399
2446
  }),
2400
- /* @__PURE__ */ c("option", {
2401
- value: De,
2402
- children: h("library.filter.me")
2447
+ /* @__PURE__ */ u("option", {
2448
+ value: je,
2449
+ children: l("library.filter.me")
2403
2450
  }),
2404
- z.list().filter((e) => e.userId !== R).map((e) => /* @__PURE__ */ c("option", {
2451
+ le.list().filter((e) => e.userId !== V).map((e) => /* @__PURE__ */ u("option", {
2405
2452
  value: e.userId,
2406
2453
  children: e.displayName
2407
2454
  }, e.userId))
2408
2455
  ]
2409
2456
  })
2410
2457
  ] }),
2411
- /* @__PURE__ */ c(m.Right, { children: X.isError ? null : /* @__PURE__ */ l(m.Count, { children: [h("library.count", { count: Z.length }), X.hasNextPage ? "+" : ""] }) })
2458
+ /* @__PURE__ */ u(_.Right, { children: J.isError ? null : /* @__PURE__ */ d(_.Count, { children: [l("library.count", { count: Y.length }), J.hasNextPage ? "+" : ""] }) })
2412
2459
  ] }),
2413
- children: [/* @__PURE__ */ l(j, {
2460
+ children: [/* @__PURE__ */ d(N, {
2414
2461
  storageKey: "contenthub-library-subnav",
2415
- children: [/* @__PURE__ */ c(j.Nav, {
2416
- "aria-label": h("library.collections"),
2417
- children: H.isSuccess ? /* @__PURE__ */ c(ge, {
2418
- collections: H.data,
2419
- activeId: v,
2420
- onSelect: B
2421
- }) : H.isError ? /* @__PURE__ */ c(A, {
2462
+ children: [/* @__PURE__ */ u(N.Nav, {
2463
+ "aria-label": l("library.collections"),
2464
+ children: U.isSuccess ? /* @__PURE__ */ u(ve, {
2465
+ collections: U.data,
2466
+ activeId: b,
2467
+ onSelect: H
2468
+ }) : U.isError ? /* @__PURE__ */ u(M, {
2422
2469
  fontSize: "sm",
2423
2470
  color: "muted",
2424
2471
  px: "3",
2425
2472
  py: "2",
2426
- children: h("library.collectionsError")
2427
- }) : /* @__PURE__ */ c(D, {
2473
+ children: l("library.collectionsError")
2474
+ }) : /* @__PURE__ */ u(O, {
2428
2475
  justify: "center",
2429
2476
  py: "4",
2430
- children: /* @__PURE__ */ c(k, { size: "sm" })
2477
+ children: /* @__PURE__ */ u(A, { size: "sm" })
2431
2478
  })
2432
- }), /* @__PURE__ */ l(j.Detail, { children: [/* @__PURE__ */ c(j.Toolbar, { children: /* @__PURE__ */ c(A, {
2479
+ }), /* @__PURE__ */ d(N.Detail, { children: [/* @__PURE__ */ u(N.Toolbar, { children: /* @__PURE__ */ u(M, {
2433
2480
  fontSize: "sm",
2434
2481
  fontWeight: "medium",
2435
- children: Ae
2436
- }) }), /* @__PURE__ */ l(ne, {
2482
+ children: $
2483
+ }) }), /* @__PURE__ */ d(j, {
2437
2484
  gap: "3",
2438
2485
  children: [
2439
- X.isError ? /* @__PURE__ */ c(E, {
2486
+ J.isError ? /* @__PURE__ */ u(D, {
2440
2487
  status: "error",
2441
- title: xe,
2488
+ title: we,
2442
2489
  mx: "8",
2443
2490
  mt: "4"
2444
2491
  }) : null,
2445
- /* @__PURE__ */ c(f, {
2446
- columns: ye,
2447
- data: Z,
2448
- loading: X.isLoading,
2492
+ /* @__PURE__ */ u(m, {
2493
+ columns: Se,
2494
+ data: Y,
2495
+ loading: J.isLoading,
2449
2496
  getRowId: (e) => `${e.id}/${e.branchId}/${e.releaseId}`,
2450
- onRowClick: (e) => s({
2497
+ onRowClick: (e) => r({
2451
2498
  contentId: e.id,
2452
2499
  changeSetId: e.changeSetId || void 0
2453
2500
  }),
2454
2501
  variant: "hoverable",
2455
- emptyState: /* @__PURE__ */ c(d, {
2456
- icon: /* @__PURE__ */ c(le, { size: 32 }),
2457
- header: h("library.empty"),
2458
- description: h("library.emptyHint")
2502
+ emptyState: /* @__PURE__ */ u(p, {
2503
+ icon: /* @__PURE__ */ u(oe, { size: 32 }),
2504
+ header: l("library.empty"),
2505
+ description: l("library.emptyHint")
2459
2506
  })
2460
2507
  }),
2461
- X.hasNextPage ? /* @__PURE__ */ c(D, {
2508
+ J.hasNextPage ? /* @__PURE__ */ u(O, {
2462
2509
  justify: "center",
2463
2510
  pb: "4",
2464
- children: /* @__PURE__ */ c(u, {
2511
+ children: /* @__PURE__ */ u(f, {
2465
2512
  size: "sm",
2466
2513
  variant: "outline",
2467
- loading: X.isFetchingNextPage,
2468
- onClick: () => void X.fetchNextPage(),
2469
- children: h("library.more")
2514
+ loading: J.isFetchingNextPage,
2515
+ onClick: () => void J.fetchNextPage(),
2516
+ children: l("library.more")
2470
2517
  })
2471
2518
  }) : null
2472
2519
  ]
2473
2520
  })] })]
2474
- }), n ? /* @__PURE__ */ c(Se, {
2475
- open: fe,
2476
- onClose: () => L(!1),
2477
- client: t,
2478
- blueprintSource: n,
2479
- initialChangeSetId: y === "change_set" ? K : void 0,
2521
+ }), /* @__PURE__ */ u(Ee, {
2522
+ open: z,
2523
+ onClose: () => B(!1),
2524
+ client: e,
2525
+ blueprintSource: g,
2526
+ initialChangeSetId: x === "change_set" ? q : void 0,
2480
2527
  onCreated: (e) => {
2481
- L(!1), ee({
2528
+ B(!1), s({
2482
2529
  changeSetId: e.changeSetId,
2483
2530
  contentId: e.id,
2484
2531
  branchId: e.branchId
2485
2532
  });
2486
2533
  }
2487
- }) : null]
2534
+ })]
2488
2535
  });
2489
2536
  }
2490
- Ae.displayName = "ContentLibrary";
2537
+ Pe.displayName = "ContentLibrary";
2491
2538
  //#endregion
2492
- export { ve as a, he as c, K as d, G as f, be as i, J as l, Ae as n, ye as o, V as p, ke as r, _e as s, Oe as t, W as u };
2539
+ export { xe as a, _e as c, K as d, pe as f, Ce as i, ge as l, W as m, Pe as n, Se as o, q as p, Ne as r, be as s, Me as t, he as u };
2493
2540
 
2494
- //# sourceMappingURL=content-library-B2eauvHt.js.map
2541
+ //# sourceMappingURL=content-library-v0mjVD4J.js.map