@knkcs/contenthub-ui 0.5.0 → 0.6.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,134 +1,139 @@
1
- import { T as e, h as t, w as n, y as r } from "./heads-BrvZ_GYT.js";
1
+ import { E as e, T as t, b as n, g as r } from "./heads-BT8RZ-Gs.js";
2
2
  import { useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
3
3
  import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
4
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";
5
+ import { DataTable as m, DateCell as ee, Modal as h, Toolbar as g, TreeViewBranchControl as te, TreeViewBranchIndicator as _, TreeViewBranchText as v, TreeViewItem as y, TreeViewItemText as ne, TreeViewLabel as b, TreeViewNode as re, TreeViewRoot as x, TreeViewTree as S, TruncatedTextCell as C, createTreeCollection as w } from "@knkcs/anker/components";
6
+ import { Alert as T, HStack as E, NativeSelect as D, Spinner as ie, Stack as O, Text as k } from "@knkcs/anker/primitives";
7
+ import { IndexPageTemplate as ae, SubNavLayout as A } from "@knkcs/anker/templates";
8
+ import { keepPreviousData as j, useInfiniteQuery as oe, useQuery as M, useQueryClient as se } from "@tanstack/react-query";
9
+ import { ChevronRight as N, FileText as ce, Lock as le, Plus as ue } from "lucide-react";
10
+ import { useTranslation as P } from "react-i18next";
11
+ import { zodResolver as F } from "@hookform/resolvers/zod";
12
+ import { BaseSelectField as de, InputField as I, LookupSelectField as L } from "@knkcs/anker/forms";
13
+ import { FormProvider as R, useForm as fe, 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";
17
17
  //#region src/common/query-keys.ts
18
- var W = {
18
+ var V = {
19
19
  all: ["contenthub"],
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"],
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"],
25
25
  changeSet: (e) => [
26
- ...W.changeSets(),
26
+ ...V.changeSets(),
27
27
  "detail",
28
28
  e
29
29
  ],
30
30
  publishReadiness: (e) => [
31
- ...W.changeSets(),
31
+ ...V.changeSets(),
32
32
  "readiness",
33
33
  e
34
34
  ],
35
- publishReadinessAt: (e, t) => [...W.publishReadiness(e), t],
35
+ publishReadinessAt: (e, t) => [...V.publishReadiness(e), t],
36
36
  checkStandings: (e) => [
37
- ...W.changeSets(),
37
+ ...V.changeSets(),
38
38
  "checks",
39
39
  e
40
40
  ],
41
- changeSetStatuses: () => [...W.all, "change-set-statuses"],
42
- requiredChecks: () => [...W.all, "required-checks"],
41
+ changeSetStatuses: () => [...V.all, "change-set-statuses"],
42
+ requiredChecks: () => [...V.all, "required-checks"],
43
43
  requiredCheckRecorders: (e) => [
44
- ...W.requiredChecks(),
44
+ ...V.requiredChecks(),
45
45
  "recorders",
46
46
  e
47
47
  ],
48
- editingSettings: () => [...W.all, "editing-settings"],
48
+ editingSettings: () => [...V.all, "editing-settings"],
49
49
  effectiveEditingSettings: (e) => [
50
- ...W.editingSettings(),
50
+ ...V.editingSettings(),
51
51
  "effective",
52
52
  e
53
53
  ],
54
- collections: () => [...W.all, "collections"],
54
+ collections: () => [...V.all, "collections"],
55
55
  collectionGrants: (e) => [
56
- ...W.collections(),
56
+ ...V.collections(),
57
57
  "grants",
58
58
  e
59
59
  ],
60
- contents: () => [...W.all, "contents"],
61
- contentLists: () => [...W.contents(), "list"],
62
- contentList: (e) => [...W.contentLists(), e],
60
+ contents: () => [...V.all, "contents"],
61
+ contentLists: () => [...V.contents(), "list"],
62
+ contentList: (e) => [...V.contentLists(), e],
63
63
  content: (e) => [
64
- ...W.contents(),
64
+ ...V.contents(),
65
65
  "detail",
66
66
  e
67
67
  ],
68
68
  contentRead: (e, t) => [
69
- ...W.content(e),
69
+ ...V.content(e),
70
70
  "read",
71
71
  t
72
72
  ],
73
73
  contentBranchRead: (e, t, n) => [
74
- ...W.contentRead(e, t),
74
+ ...V.contentRead(e, t),
75
75
  "branch",
76
76
  n
77
77
  ],
78
- contentTimeline: (e) => [...W.content(e), "timeline"],
78
+ contentTimeline: (e) => [...V.content(e), "timeline"],
79
79
  contentRevisions: (e, t) => [
80
- ...W.content(e),
80
+ ...V.content(e),
81
81
  "revisions",
82
82
  t
83
83
  ],
84
84
  contentCompare: (e, t, n) => [
85
- ...W.content(e),
85
+ ...V.content(e),
86
86
  "compare",
87
87
  t,
88
88
  n
89
89
  ],
90
90
  contentReferences: (e, t) => [
91
- ...W.content(e),
91
+ ...V.content(e),
92
92
  "references",
93
93
  t
94
94
  ],
95
- contentReferrers: (e) => [...W.content(e), "referrers"],
95
+ contentReferrers: (e) => [...V.content(e), "referrers"],
96
96
  contentOutdatedPins: (e, t) => [
97
- ...W.content(e),
97
+ ...V.content(e),
98
98
  "outdated-pins",
99
99
  t
100
100
  ],
101
- contentChangeSets: (e) => [...W.content(e), "change-sets"],
101
+ contentChangeSets: (e) => [...V.content(e), "change-sets"],
102
102
  chainPreview: (e, t, ...n) => [
103
- ...W.content(e),
103
+ ...V.content(e),
104
104
  "preview",
105
105
  t,
106
106
  ...n
107
107
  ],
108
108
  previewInForce: (e, t, n) => [
109
- ...W.content(e),
109
+ ...V.content(e),
110
110
  "preview-in-force",
111
111
  t,
112
112
  n
113
113
  ],
114
114
  pendingMerge: (e) => [
115
- ...W.all,
115
+ ...V.all,
116
116
  "pending-merge",
117
117
  e
118
118
  ],
119
- blueprints: () => [...W.all, "blueprints"],
119
+ blueprints: () => [...V.all, "blueprints"],
120
120
  blueprintNames: (e) => [
121
- ...W.blueprints(),
121
+ ...V.blueprints(),
122
122
  "names",
123
123
  e
124
124
  ],
125
- blueprintFilterOptions: () => [...W.blueprints(), "filter-options"],
125
+ blueprintNamesByAccessor: (e) => [
126
+ ...V.blueprints(),
127
+ "names-by-accessor",
128
+ e
129
+ ],
130
+ blueprintFilterOptions: () => [...V.blueprints(), "filter-options"],
126
131
  blueprintReleases: (e) => [
127
- ...W.blueprints(),
132
+ ...V.blueprints(),
128
133
  "releases",
129
134
  e
130
135
  ]
131
- }, G = {
136
+ }, H = {
132
137
  common: { cancel: "Abbrechen" },
133
138
  settings: {
134
139
  section: "Einstellungen",
@@ -211,11 +216,10 @@ var W = {
211
216
  workspaceTitle: "Vorgaben des Arbeitsbereichs",
212
217
  createOverrideTitle: "Neue Blueprint-Abweichung",
213
218
  editOverrideTitle: "Blueprint-Abweichung bearbeiten",
214
- accessor: "Blueprint-Accessor",
215
- accessorHelp: "Der Blueprint, für dessen Inhalte dies gilt, als Accessor.",
216
- accessorRequired: "Geben Sie einen Blueprint-Accessor ein.",
217
- accessorTooLong: "Höchstens {{max}} Zeichen.",
218
- accessorTaken: "Für „{{name}}“ gibt es bereits eine Abweichung: Bearbeiten Sie diese.",
219
+ blueprint: "Blueprint",
220
+ blueprintHelp: "Der Blueprint, für dessen Inhalte dies gilt.",
221
+ blueprintPlaceholder: "Blueprint wählen",
222
+ blueprintRequired: "Wählen Sie einen Blueprint.",
219
223
  mode: "Bearbeitungsmodus",
220
224
  modeHelp: "Nur „Nur Change Sets“ wird durchgesetzt: Eine Direktbearbeitung solcher Inhalte wird abgelehnt. Importe, Abläufe und Blueprint-Upgrades nutzen immer Change Sets.",
221
225
  modeRequired: "Wählen Sie einen Bearbeitungsmodus.",
@@ -309,17 +313,17 @@ var W = {
309
313
  scopeHelp: "Jeder Branch braucht ein Ergebnis je erfasstem Inhalt; das Change Set einmal braucht ein Ergebnis für das ganze Change Set.",
310
314
  scopeRequired: "Wählen Sie einen Umfang.",
311
315
  everyBlueprint: "Gilt für Inhalte jedes Blueprints",
312
- accessors: "Blueprint-Accessoren",
313
- accessorsHelp: "Ein Accessor je Zeile: Die Prüfung gilt nur für Inhalte dieser Blueprints.",
314
- accessorsRequired: "Nennen Sie mindestens einen Blueprint oder lassen Sie sie für alle gelten.",
315
- accessorTooLong: "Ein Accessor hat höchstens {{max}} Zeichen.",
316
+ accessors: "Blueprints",
317
+ accessorsHelp: "Die Prüfung gilt nur für Inhalte dieser Blueprints.",
318
+ accessorsRequired: "Wählen Sie mindestens einen Blueprint oder lassen Sie sie für alle gelten.",
316
319
  independentLabel: "Unabhängig",
317
320
  independentHelp: "Bestanden und erlassen werden abgelehnt, wenn sie von jemandem kommen, der eine Revision am Geprüften geschrieben hat.",
318
321
  recorders: "Wer sie erfasst",
319
322
  recordersHelp: "Die Ergebnisse einer neuen Prüfung erfasst jedes Mitglied des Arbeitsbereichs. Auf benannte Personen einschränken lässt es sich in der Zeile der Prüfung unter „Wer sie erfasst“.",
320
323
  failed: "Die Pflichtprüfung konnte nicht gespeichert werden. Versuchen Sie es erneut.",
321
324
  createSubmit: "Anlegen",
322
- editSubmit: "Speichern"
325
+ editSubmit: "Speichern",
326
+ accessorsPlaceholder: "Blueprints wählen"
323
327
  },
324
328
  removeDialog: {
325
329
  title: "Pflichtprüfung entfernen",
@@ -1040,8 +1044,21 @@ var W = {
1040
1044
  required: "Wählen Sie den Tag, ab dem die Änderung gilt.",
1041
1045
  submit: "Bearbeiten"
1042
1046
  }
1047
+ },
1048
+ blueprintSelect: {
1049
+ archived: "{{name}} (archiviert)",
1050
+ unknown: "{{value}} (unbekannt)",
1051
+ empty: "Kein Blueprint passt",
1052
+ failed: "Die Blueprints konnten nicht geladen werden.",
1053
+ loading: "Wird geladen …",
1054
+ refused: "{{list}}.",
1055
+ refusal: {
1056
+ unknown: "„{{accessor}}“ benennt keinen Blueprint",
1057
+ archived: "„{{accessor}}“ ist archiviert",
1058
+ not_content: "„{{accessor}}“ ist kein Content-Blueprint"
1059
+ }
1043
1060
  }
1044
- }, fe = {
1061
+ }, he = {
1045
1062
  common: { cancel: "Cancel" },
1046
1063
  settings: {
1047
1064
  section: "Settings",
@@ -1124,11 +1141,10 @@ var W = {
1124
1141
  workspaceTitle: "Workspace defaults",
1125
1142
  createOverrideTitle: "New Blueprint override",
1126
1143
  editOverrideTitle: "Edit Blueprint override",
1127
- accessor: "Blueprint accessor",
1128
- accessorHelp: "The Blueprint whose Content this applies to, by accessor.",
1129
- accessorRequired: "Enter a Blueprint accessor.",
1130
- accessorTooLong: "At most {{max}} characters.",
1131
- accessorTaken: "“{{name}}” has an override already: edit it instead.",
1144
+ blueprint: "Blueprint",
1145
+ blueprintHelp: "The Blueprint whose Content this applies to.",
1146
+ blueprintPlaceholder: "Choose a Blueprint",
1147
+ blueprintRequired: "Choose a Blueprint.",
1132
1148
  mode: "Editing Mode",
1133
1149
  modeHelp: "Only “Change Sets only” is enforced: a Direct Edit on such Content is refused. Imports, flows and Blueprint upgrades always use Change Sets.",
1134
1150
  modeRequired: "Choose an Editing Mode.",
@@ -1222,17 +1238,17 @@ var W = {
1222
1238
  scopeHelp: "Each Branch needs a result per Content it covers; the Change Set once needs one result for the whole Change Set.",
1223
1239
  scopeRequired: "Choose a scope.",
1224
1240
  everyBlueprint: "Applies to Content of every Blueprint",
1225
- accessors: "Blueprint accessors",
1226
- accessorsHelp: "One accessor a line: the check applies to Content of these Blueprints only.",
1227
- accessorsRequired: "Name at least one Blueprint, or apply it to every Blueprint.",
1228
- accessorTooLong: "An accessor is at most {{max}} characters.",
1241
+ accessors: "Blueprints",
1242
+ accessorsHelp: "The check applies to Content of these Blueprints only.",
1243
+ accessorsRequired: "Choose at least one Blueprint, or apply it to every Blueprint.",
1229
1244
  independentLabel: "Independent",
1230
1245
  independentHelp: "Passed and waived are refused from anyone who wrote a Revision on what the result covers.",
1231
1246
  recorders: "Who records it",
1232
1247
  recordersHelp: "Every member of the workspace records a new check's results. Narrow it to named people from the check's row, under Who records it.",
1233
1248
  failed: "The Required Check could not be saved. Try again.",
1234
1249
  createSubmit: "Create",
1235
- editSubmit: "Save"
1250
+ editSubmit: "Save",
1251
+ accessorsPlaceholder: "Choose Blueprints"
1236
1252
  },
1237
1253
  removeDialog: {
1238
1254
  title: "Remove Required Check",
@@ -2190,39 +2206,54 @@ var W = {
2190
2206
  required: "Choose the day the change takes effect.",
2191
2207
  submit: "Edit"
2192
2208
  }
2209
+ },
2210
+ blueprintSelect: {
2211
+ archived: "{{name}} (archived)",
2212
+ unknown: "{{value}} (unknown)",
2213
+ empty: "No Blueprint matches",
2214
+ failed: "The Blueprints could not be loaded.",
2215
+ loading: "Loading…",
2216
+ refused: "{{list}}.",
2217
+ refusal: {
2218
+ unknown: "“{{accessor}}” names no Blueprint",
2219
+ archived: "“{{accessor}}” is archived",
2220
+ not_content: "“{{accessor}}” is not a content Blueprint"
2221
+ }
2193
2222
  }
2194
- }, K = "contenthub-ui", q = {
2195
- en: { [K]: fe },
2196
- de: { [K]: G }
2197
- }, pe = {
2198
- namespace: K,
2199
- resources: q
2223
+ }, U = "contenthub-ui", W = {
2224
+ en: { [U]: he },
2225
+ de: { [U]: H }
2226
+ }, G = {
2227
+ namespace: U,
2228
+ resources: W
2200
2229
  };
2201
2230
  //#endregion
2202
2231
  //#region src/common/blueprint-source.ts
2203
- function me(t) {
2232
+ function ge(e) {
2204
2233
  return {
2205
- searchBlueprints: (e) => t.searchBlueprints(e),
2206
- async getBlueprints(n) {
2207
- let r = [...new Set(n.filter((e) => e !== ""))], i = [];
2208
- for (let t = 0; t < r.length; t += e) i.push(r.slice(t, t + e));
2209
- return (await Promise.all(i.map((e) => t.getBlueprints(e)))).flat();
2210
- },
2211
- listReleases: (e) => t.listBlueprintReleases(e)
2234
+ searchBlueprints: (t) => e.searchBlueprints(t),
2235
+ getBlueprints: (t) => K(t, (t) => e.getBlueprints(t)),
2236
+ getBlueprintsByAccessor: (t) => K(t, (t) => e.getBlueprintsByAccessor(t)),
2237
+ listReleases: (t) => e.listBlueprintReleases(t)
2212
2238
  };
2213
2239
  }
2214
- function he(e, t) {
2215
- return o(() => t ?? me(e), [e, t]);
2240
+ async function K(t, n) {
2241
+ let r = [...new Set(t.filter((e) => e !== ""))], i = [];
2242
+ for (let t = 0; t < r.length; t += e) i.push(r.slice(t, t + e));
2243
+ return (await Promise.all(i.map(n))).flat();
2244
+ }
2245
+ function _e(e, t) {
2246
+ return o(() => t ?? ge(e), [e, t]);
2216
2247
  }
2217
2248
  //#endregion
2218
2249
  //#region src/common/use-open-change-sets.ts
2219
- var J = 200;
2220
- function ge(e, t = !0) {
2221
- return P({
2222
- queryKey: W.openChangeSets(),
2250
+ var q = 200;
2251
+ function J(e, t = !0) {
2252
+ return M({
2253
+ queryKey: V.openChangeSets(),
2223
2254
  queryFn: () => e.listChangeSets({
2224
2255
  state: "open",
2225
- pageSize: J
2256
+ pageSize: q
2226
2257
  }),
2227
2258
  enabled: t
2228
2259
  });
@@ -2230,20 +2261,20 @@ function ge(e, t = !0) {
2230
2261
  //#endregion
2231
2262
  //#region src/screens/collection-tree.tsx
2232
2263
  var Y = "__all__";
2233
- function _e(e, t) {
2264
+ function ve(e, t) {
2234
2265
  let n = new Map(t.map((e) => [e.id, e])), r = [], i = /* @__PURE__ */ new Set(), a = n.get(e);
2235
2266
  for (; a && !i.has(a.id);) i.add(a.id), r.unshift(a), a = n.get(a.parentId);
2236
2267
  return r;
2237
2268
  }
2238
2269
  function X() {
2239
- let { t: e } = I(K);
2240
- return /* @__PURE__ */ u(se, {
2270
+ let { t: e } = P(U);
2271
+ return /* @__PURE__ */ u(le, {
2241
2272
  size: 12,
2242
2273
  "aria-label": e("library.restricted")
2243
2274
  });
2244
2275
  }
2245
- function ve({ collections: e, activeId: t, onSelect: n }) {
2246
- let { t: r } = I(K), i = o(() => new Map(e.map((e) => [e.id, e])), [e]), a = o(() => {
2276
+ function ye({ collections: e, activeId: t, onSelect: n }) {
2277
+ let { t: r } = P(U), i = o(() => new Map(e.map((e) => [e.id, e])), [e]), a = o(() => {
2247
2278
  let t = /* @__PURE__ */ new Map();
2248
2279
  for (let n of e) {
2249
2280
  let e = n.parentId !== "" && i.has(n.parentId) ? n.parentId : "", r = t.get(e) ?? [];
@@ -2262,7 +2293,7 @@ function ve({ collections: e, activeId: t, onSelect: n }) {
2262
2293
  children: i.map((e) => n(e, a))
2263
2294
  };
2264
2295
  }, a = (t.get("") ?? []).map((e) => n(e, /* @__PURE__ */ new Set([e.id])));
2265
- return E({
2296
+ return w({
2266
2297
  rootNode: {
2267
2298
  id: "ROOT",
2268
2299
  name: "",
@@ -2280,8 +2311,8 @@ function ve({ collections: e, activeId: t, onSelect: n }) {
2280
2311
  e,
2281
2312
  i,
2282
2313
  r
2283
- ]), [s] = c(() => _e(t, e).slice(0, -1).map((e) => e.id));
2284
- return /* @__PURE__ */ d(w, {
2314
+ ]), [s] = c(() => ve(t, e).slice(0, -1).map((e) => e.id));
2315
+ return /* @__PURE__ */ d(x, {
2285
2316
  collection: a,
2286
2317
  size: "sm",
2287
2318
  selectedValue: [t === "" ? Y : t],
@@ -2290,28 +2321,90 @@ function ve({ collections: e, activeId: t, onSelect: n }) {
2290
2321
  let t = e.selectedValue[0];
2291
2322
  t !== void 0 && n(t === Y ? "" : t);
2292
2323
  },
2293
- children: [/* @__PURE__ */ u(ee, {
2324
+ children: [/* @__PURE__ */ u(b, {
2294
2325
  srOnly: !0,
2295
2326
  children: r("library.collections")
2296
- }), /* @__PURE__ */ u(T, { children: /* @__PURE__ */ u(C, { render: ({ node: e, nodeState: t }) => t.isBranch ? /* @__PURE__ */ d(v, { children: [
2297
- /* @__PURE__ */ u(y, { children: /* @__PURE__ */ u(F, { size: 14 }) }),
2298
- /* @__PURE__ */ u(b, { children: e.name }),
2327
+ }), /* @__PURE__ */ u(S, { children: /* @__PURE__ */ u(re, { render: ({ node: e, nodeState: t }) => t.isBranch ? /* @__PURE__ */ d(te, { children: [
2328
+ /* @__PURE__ */ u(_, { children: /* @__PURE__ */ u(N, { size: 14 }) }),
2329
+ /* @__PURE__ */ u(v, { children: e.name }),
2299
2330
  e.restricted ? /* @__PURE__ */ u(X, {}) : null
2300
- ] }) : /* @__PURE__ */ d(x, { children: [/* @__PURE__ */ u(S, { children: e.name }), e.restricted ? /* @__PURE__ */ u(X, {}) : null] }) }) })]
2331
+ ] }) : /* @__PURE__ */ d(y, { children: [/* @__PURE__ */ u(ne, { children: e.name }), e.restricted ? /* @__PURE__ */ u(X, {}) : null] }) }) })]
2332
+ });
2333
+ }
2334
+ //#endregion
2335
+ //#region src/screens/blueprint-select-field.tsx
2336
+ function be(e, t, n) {
2337
+ return n ? n.archived ? e("blueprintSelect.archived", { name: n.name }) : n.name : e("blueprintSelect.unknown", { value: t });
2338
+ }
2339
+ function xe(e, t) {
2340
+ let { t: n } = P(U), r = o(() => [...new Set(t)].sort(), [t]), i = M({
2341
+ queryKey: V.blueprintNamesByAccessor(r),
2342
+ queryFn: () => e.getBlueprintsByAccessor(r),
2343
+ enabled: r.length > 0,
2344
+ placeholderData: j,
2345
+ staleTime: 6e4
2346
+ }), a = i.isSuccess && !i.isPlaceholderData;
2347
+ return o(() => {
2348
+ let e = a ? new Map(i.data.map((e) => [e.accessor, e])) : null;
2349
+ return (t) => e ? be(n, t, e.get(t)) : t;
2350
+ }, [
2351
+ a,
2352
+ i.data,
2353
+ n
2354
+ ]);
2355
+ }
2356
+ function Z({ blueprintSource: e, valueKey: t, includeWithoutRelease: n = !1, exclude: r, ...a }) {
2357
+ let { t: o } = P(U), s = (r ?? []).join("\0"), c = i(async ({ query: r, cursor: i, signal: a }) => {
2358
+ let o = new Set(s === "" ? [] : s.split("\0")), c = await e.searchBlueprints({
2359
+ query: r,
2360
+ pageToken: i,
2361
+ includeWithoutRelease: n,
2362
+ signal: a
2363
+ });
2364
+ return {
2365
+ items: c.blueprints.filter((e) => !o.has(e[t])).map((e) => ({
2366
+ id: e[t],
2367
+ label: e.name
2368
+ })),
2369
+ nextCursor: c.nextPageToken || null
2370
+ };
2371
+ }, [
2372
+ e,
2373
+ t,
2374
+ n,
2375
+ s
2376
+ ]), l = i(async ({ ids: n }) => {
2377
+ let r = t === "id" ? await e.getBlueprints(n) : await e.getBlueprintsByAccessor(n), i = new Map(r.map((e) => [e[t], e]));
2378
+ return n.map((e) => ({
2379
+ id: e,
2380
+ label: be(o, e, i.get(e))
2381
+ }));
2382
+ }, [
2383
+ e,
2384
+ t,
2385
+ o
2386
+ ]);
2387
+ return /* @__PURE__ */ u(L, {
2388
+ ...a,
2389
+ search: c,
2390
+ resolve: l,
2391
+ emptyMessage: o("blueprintSelect.empty"),
2392
+ errorMessage: o("blueprintSelect.failed"),
2393
+ loadingMessage: o("blueprintSelect.loading")
2301
2394
  });
2302
2395
  }
2303
2396
  //#endregion
2304
2397
  //#region src/screens/create-change-set-modal.tsx
2305
- var Z = {
2398
+ var Se = {
2306
2399
  name: "",
2307
2400
  sourceDate: "",
2308
2401
  sourceReference: ""
2309
- }, ye = "contenthub-create-change-set", Q = /^[^\u0000-\u001f\u007f]*$/;
2310
- function be({ open: e, onClose: t, onSubmit: r }) {
2311
- let { t: i } = I(K), s = o(() => U.object({
2312
- name: U.string().trim().min(1, i("changeSets.form.nameRequired")).max(200, i("changeSets.form.tooLong", { max: 200 })).regex(Q, i("changeSets.form.oneLine")),
2313
- sourceDate: U.string().trim(),
2314
- sourceReference: U.string().trim().max(500, i("changeSets.form.tooLong", { max: 500 })).regex(Q, i("changeSets.form.oneLine"))
2402
+ }, Ce = "contenthub-create-change-set", Q = /^[^\u0000-\u001f\u007f]*$/;
2403
+ function we({ open: e, onClose: n, onSubmit: r }) {
2404
+ let { t: i } = P(U), s = o(() => B.object({
2405
+ name: B.string().trim().min(1, i("changeSets.form.nameRequired")).max(200, i("changeSets.form.tooLong", { max: 200 })).regex(Q, i("changeSets.form.oneLine")),
2406
+ sourceDate: B.string().trim(),
2407
+ sourceReference: B.string().trim().max(500, i("changeSets.form.tooLong", { max: 500 })).regex(Q, i("changeSets.form.oneLine"))
2315
2408
  }).superRefine((e, t) => {
2316
2409
  e.sourceReference !== "" && e.sourceDate === "" && t.addIssue({
2317
2410
  code: "custom",
@@ -2322,14 +2415,14 @@ function be({ open: e, onClose: t, onSubmit: r }) {
2322
2415
  path: ["sourceReference"],
2323
2416
  message: i("changeSets.form.sourceReferenceRequired")
2324
2417
  });
2325
- }), [i]), l = le({
2326
- resolver: L(s),
2327
- defaultValues: Z
2328
- }), [p, m] = c(null), h = l.formState.isSubmitting;
2418
+ }), [i]), l = fe({
2419
+ resolver: F(s),
2420
+ defaultValues: Se
2421
+ }), [p, m] = c(null), ee = l.formState.isSubmitting;
2329
2422
  a(() => {
2330
- e && (l.reset(Z), m(null));
2423
+ e && (l.reset(Se), m(null));
2331
2424
  }, [e, l]);
2332
- let _ = l.handleSubmit(async (e) => {
2425
+ let g = l.handleSubmit(async (e) => {
2333
2426
  m(null);
2334
2427
  try {
2335
2428
  await r({
@@ -2340,60 +2433,60 @@ function be({ open: e, onClose: t, onSubmit: r }) {
2340
2433
  }
2341
2434
  });
2342
2435
  } catch (e) {
2343
- m(e instanceof n ? e.message : i("changeSets.form.failed"));
2436
+ m(e instanceof t ? e.message : i("changeSets.form.failed"));
2344
2437
  }
2345
2438
  });
2346
- return /* @__PURE__ */ u(g, {
2439
+ return /* @__PURE__ */ u(h, {
2347
2440
  open: e,
2348
- onClose: t,
2441
+ onClose: n,
2349
2442
  lazyMount: !0,
2350
2443
  unmountOnExit: !0,
2351
2444
  size: "md",
2352
2445
  header: i("changeSets.form.createTitle"),
2353
- footer: /* @__PURE__ */ d(O, {
2446
+ footer: /* @__PURE__ */ d(E, {
2354
2447
  gap: "2",
2355
2448
  children: [/* @__PURE__ */ u(f, {
2356
2449
  size: "sm",
2357
2450
  variant: "ghost",
2358
- onClick: t,
2451
+ onClick: n,
2359
2452
  children: i("common.cancel")
2360
2453
  }), /* @__PURE__ */ u(f, {
2361
2454
  type: "submit",
2362
- form: ye,
2455
+ form: Ce,
2363
2456
  size: "sm",
2364
2457
  variant: "solid",
2365
- loading: h,
2458
+ loading: ee,
2366
2459
  children: i("changeSets.form.createSubmit")
2367
2460
  })]
2368
2461
  }),
2369
- children: /* @__PURE__ */ u(V, {
2462
+ children: /* @__PURE__ */ u(R, {
2370
2463
  ...l,
2371
2464
  children: /* @__PURE__ */ u("form", {
2372
- id: ye,
2465
+ id: Ce,
2373
2466
  onSubmit: (e) => {
2374
- e.preventDefault(), _();
2467
+ e.preventDefault(), g();
2375
2468
  },
2376
- children: /* @__PURE__ */ d(j, {
2469
+ children: /* @__PURE__ */ d(O, {
2377
2470
  gap: "4",
2378
2471
  children: [
2379
- /* @__PURE__ */ u(z, {
2472
+ /* @__PURE__ */ u(I, {
2380
2473
  name: "name",
2381
2474
  label: i("changeSets.form.name"),
2382
2475
  helperText: i("changeSets.form.nameHelp"),
2383
2476
  required: !0
2384
2477
  }),
2385
- /* @__PURE__ */ u(z, {
2478
+ /* @__PURE__ */ u(I, {
2386
2479
  name: "sourceDate",
2387
2480
  type: "date",
2388
2481
  label: i("changeSets.form.sourceDate"),
2389
2482
  helperText: i("changeSets.form.sourceDateHelp")
2390
2483
  }),
2391
- /* @__PURE__ */ u(z, {
2484
+ /* @__PURE__ */ u(I, {
2392
2485
  name: "sourceReference",
2393
2486
  label: i("changeSets.form.sourceReference"),
2394
2487
  helperText: i("changeSets.form.sourceReferenceHelp")
2395
2488
  }),
2396
- p ? /* @__PURE__ */ u(D, {
2489
+ p ? /* @__PURE__ */ u(T, {
2397
2490
  status: "error",
2398
2491
  title: p
2399
2492
  }) : null
@@ -2405,8 +2498,8 @@ function be({ open: e, onClose: t, onSubmit: r }) {
2405
2498
  }
2406
2499
  //#endregion
2407
2500
  //#region src/screens/change-set-choice.tsx
2408
- var xe = "@new";
2409
- function Se(e, t, n = !1) {
2501
+ var Te = "@new";
2502
+ function Ee(e, t, n = !1) {
2410
2503
  if (!t.changeSetId) return {
2411
2504
  path: "changeSetId",
2412
2505
  message: e("library.create.changeSetRequired")
@@ -2424,22 +2517,22 @@ function Se(e, t, n = !1) {
2424
2517
  message: e("changeSets.form.oneLine")
2425
2518
  };
2426
2519
  }
2427
- function Ce({ client: e, open: t, helperText: n, nameHelperText: r, nameOptional: i = !1 }) {
2428
- let { t: a } = I(K), s = ge(e, t), c = o(() => [{
2429
- id: xe,
2520
+ function De({ client: e, open: t, helperText: n, nameHelperText: r, nameOptional: i = !1 }) {
2521
+ let { t: a } = P(U), s = J(e, t), c = o(() => [{
2522
+ id: Te,
2430
2523
  label: a("library.create.newChangeSet")
2431
2524
  }, ...(s.data?.changeSets ?? []).map((e) => ({
2432
2525
  id: e.id,
2433
2526
  label: e.name
2434
- }))], [s.data, a]), f = H({ name: "changeSetId" });
2435
- return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(R, {
2527
+ }))], [s.data, a]), f = z({ name: "changeSetId" });
2528
+ return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(de, {
2436
2529
  name: "changeSetId",
2437
2530
  label: a("library.create.changeSet"),
2438
2531
  helperText: n,
2439
2532
  options: c,
2440
2533
  isClearable: !1,
2441
2534
  required: !0
2442
- }), f === "@new" ? /* @__PURE__ */ u(z, {
2535
+ }), f === "@new" ? /* @__PURE__ */ u(I, {
2443
2536
  name: "changeSetName",
2444
2537
  label: a("library.create.changeSetName"),
2445
2538
  helperText: r ?? a("changeSets.form.nameHelp"),
@@ -2448,13 +2541,13 @@ function Ce({ client: e, open: t, helperText: n, nameHelperText: r, nameOptional
2448
2541
  }
2449
2542
  //#endregion
2450
2543
  //#region src/screens/create-content-modal.tsx
2451
- var we = "contenthub-create-content", $ = (e) => !e.refusals?.length, Te = (e) => e.path ? `${e.code} (${e.path})` : e.code;
2452
- function Ee({ open: e, onClose: l, client: p, blueprintSource: m, initialChangeSetId: h, onCreated: _ }) {
2453
- let { t: v } = I(K), y = ae(), b = o(() => U.object({
2454
- blueprintId: U.string().nullable().refine((e) => !!e, v("library.create.blueprintRequired")),
2455
- releaseId: U.string().nullable().refine((e) => !!e, v("library.create.releaseRequired")),
2456
- changeSetId: U.string().nullable().refine((e) => !!e, v("library.create.changeSetRequired")),
2457
- changeSetName: U.string().trim()
2544
+ var Oe = "contenthub-create-content", $ = (e) => !e.refusals?.length, ke = (e) => e.path ? `${e.code} (${e.path})` : e.code;
2545
+ function Ae({ open: e, onClose: i, client: l, blueprintSource: p, initialChangeSetId: m, onCreated: ee }) {
2546
+ let { t: g } = P(U), te = se(), _ = o(() => B.object({
2547
+ blueprintId: B.string().nullable().refine((e) => !!e, g("library.create.blueprintRequired")),
2548
+ releaseId: B.string().nullable().refine((e) => !!e, g("library.create.releaseRequired")),
2549
+ changeSetId: B.string().nullable().refine((e) => !!e, g("library.create.changeSetRequired")),
2550
+ changeSetName: B.string().trim()
2458
2551
  }).superRefine((e, t) => {
2459
2552
  if (e.changeSetId !== "@new") return;
2460
2553
  let n = (e) => t.addIssue({
@@ -2462,196 +2555,177 @@ function Ee({ open: e, onClose: l, client: p, blueprintSource: m, initialChangeS
2462
2555
  path: ["changeSetName"],
2463
2556
  message: e
2464
2557
  });
2465
- 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"));
2466
- }), [v]), x = o(() => ({
2558
+ e.changeSetName === "" ? n(g("changeSets.form.nameRequired")) : [...e.changeSetName].length > 200 ? n(g("changeSets.form.tooLong", { max: 200 })) : Q.test(e.changeSetName) || n(g("changeSets.form.oneLine"));
2559
+ }), [g]), v = o(() => ({
2467
2560
  blueprintId: null,
2468
2561
  releaseId: null,
2469
- changeSetId: h || "@new",
2562
+ changeSetId: m || "@new",
2470
2563
  changeSetName: ""
2471
- }), [h]), S = le({
2472
- resolver: L(b),
2473
- defaultValues: x
2474
- }), [ee, C] = c(null), w = S.formState.isSubmitting, T = H({
2475
- control: S.control,
2564
+ }), [m]), y = fe({
2565
+ resolver: F(_),
2566
+ defaultValues: v
2567
+ }), [ne, b] = c(null), re = y.formState.isSubmitting, x = z({
2568
+ control: y.control,
2476
2569
  name: "blueprintId"
2477
- }), te = H({
2478
- control: S.control,
2570
+ }), S = z({
2571
+ control: y.control,
2479
2572
  name: "changeSetId"
2480
2573
  });
2481
2574
  a(() => {
2482
- e && (S.reset(x), C(null));
2575
+ e && (y.reset(v), b(null));
2483
2576
  }, [
2484
2577
  e,
2485
- S,
2486
- x
2578
+ y,
2579
+ v
2487
2580
  ]);
2488
- let E = ge(p, e), k = o(() => [{
2489
- id: xe,
2490
- label: v("library.create.newChangeSet")
2491
- }, ...(E.data?.changeSets ?? []).map((e) => ({
2581
+ let C = J(l, e), w = o(() => [{
2582
+ id: Te,
2583
+ label: g("library.create.newChangeSet")
2584
+ }, ...(C.data?.changeSets ?? []).map((e) => ({
2492
2585
  id: e.id,
2493
2586
  label: e.name
2494
- }))], [E.data, v]), A = P({
2495
- queryKey: W.blueprintReleases(T ?? ""),
2496
- queryFn: () => m.listReleases(T),
2497
- enabled: e && !!T
2498
- }), ne = o(() => (A.data ?? []).map((e) => ({
2587
+ }))], [C.data, g]), D = M({
2588
+ queryKey: V.blueprintReleases(x ?? ""),
2589
+ queryFn: () => p.listReleases(x),
2590
+ enabled: e && !!x
2591
+ }), ie = o(() => (D.data ?? []).map((e) => ({
2499
2592
  id: e.id,
2500
- label: $(e) ? e.name : v("library.create.refusedRelease", { name: e.name }),
2593
+ label: $(e) ? e.name : g("library.create.refusedRelease", { name: e.name }),
2501
2594
  data: { refused: !$(e) }
2502
- })), [A.data, v]), N = o(() => (A.data ?? []).filter((e) => !$(e)), [A.data]), re = s(T);
2595
+ })), [D.data, g]), ae = o(() => (D.data ?? []).filter((e) => !$(e)), [D.data]), A = s(x);
2503
2596
  a(() => {
2504
- re.current !== T && (re.current = T, S.setValue("releaseId", null));
2505
- let e = S.getValues("releaseId"), t = A.data;
2506
- if (!T) {
2507
- e !== null && S.setValue("releaseId", null);
2597
+ A.current !== x && (A.current = x, y.setValue("releaseId", null));
2598
+ let e = y.getValues("releaseId"), t = D.data;
2599
+ if (!x) {
2600
+ e !== null && y.setValue("releaseId", null);
2508
2601
  return;
2509
2602
  }
2510
- t && !t.some((t) => t.id === e && $(t)) && S.setValue("releaseId", t.find($)?.id ?? null);
2603
+ t && !t.some((t) => t.id === e && $(t)) && y.setValue("releaseId", t.find($)?.id ?? null);
2511
2604
  }, [
2512
- T,
2513
- A.data,
2514
- S
2605
+ x,
2606
+ D.data,
2607
+ y
2515
2608
  ]);
2516
- 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 }) => {
2517
- let r = await m.searchBlueprints({
2518
- query: e,
2519
- pageToken: t ?? void 0,
2520
- signal: n
2521
- });
2522
- return {
2523
- items: r.blueprints.map((e) => ({
2524
- id: e.id,
2525
- label: e.name
2526
- })),
2527
- nextCursor: r.nextPageToken || null
2528
- };
2529
- }, [m]), se = i(async ({ ids: e }) => {
2530
- let t = await m.getBlueprints(e);
2531
- return e.map((e) => ({
2532
- id: e,
2533
- label: t.find((t) => t.id === e)?.name ?? e
2534
- }));
2535
- }, [m]), ce = S.handleSubmit(async (e) => {
2536
- C(null);
2609
+ let j = !!x && D.isSuccess && D.data.length === 0, oe = !!x && D.isSuccess && D.data.length > 0 && !D.data.some($), N = y.handleSubmit(async (e) => {
2610
+ b(null);
2537
2611
  let t = e.changeSetId, n = !1;
2538
2612
  try {
2539
2613
  if (t === "@new") {
2540
- let r = await p.createChangeSet({ name: e.changeSetName.trim() });
2541
- n = !0, t = r.id, S.setValue("changeSetId", t);
2614
+ let r = await l.createChangeSet({ name: e.changeSetName.trim() });
2615
+ n = !0, t = r.id, y.setValue("changeSetId", t);
2542
2616
  }
2543
- let r = await p.createContent({
2617
+ let r = await l.createContent({
2544
2618
  changeSetId: t,
2545
2619
  blueprintReleaseId: e.releaseId
2546
2620
  });
2547
- y.invalidateQueries({ queryKey: W.contents() }), _(r);
2621
+ te.invalidateQueries({ queryKey: V.contents() }), ee(r);
2548
2622
  } catch (e) {
2549
- if (C(ue(e)), !n) return;
2623
+ if (b(ce(e)), !n) return;
2550
2624
  }
2551
- y.invalidateQueries({ queryKey: W.changeSets() });
2625
+ te.invalidateQueries({ queryKey: V.changeSets() });
2552
2626
  });
2553
- function ue(e) {
2554
- if (e instanceof r) {
2555
- let t = e.reasons.map(Te).join(", ");
2556
- return v("library.create.refused", { reasons: t });
2627
+ function ce(e) {
2628
+ if (e instanceof n) {
2629
+ let t = e.reasons.map(ke).join(", ");
2630
+ return g("library.create.refused", { reasons: t });
2557
2631
  }
2558
- return e instanceof t ? v("library.create.changeSetClosed") : e instanceof n ? e.message : v("library.create.failed");
2632
+ return e instanceof r ? g("library.create.changeSetClosed") : e instanceof t ? e.message : g("library.create.failed");
2559
2633
  }
2560
- return /* @__PURE__ */ u(g, {
2634
+ return /* @__PURE__ */ u(h, {
2561
2635
  open: e,
2562
- onClose: l,
2636
+ onClose: i,
2563
2637
  lazyMount: !0,
2564
2638
  unmountOnExit: !0,
2565
2639
  size: "md",
2566
- header: v("library.create.title"),
2567
- footer: /* @__PURE__ */ d(O, {
2640
+ header: g("library.create.title"),
2641
+ footer: /* @__PURE__ */ d(E, {
2568
2642
  gap: "2",
2569
2643
  children: [/* @__PURE__ */ u(f, {
2570
2644
  size: "sm",
2571
2645
  variant: "ghost",
2572
- onClick: l,
2573
- children: v("common.cancel")
2646
+ onClick: i,
2647
+ children: g("common.cancel")
2574
2648
  }), /* @__PURE__ */ u(f, {
2575
2649
  type: "submit",
2576
- form: we,
2650
+ form: Oe,
2577
2651
  size: "sm",
2578
2652
  variant: "solid",
2579
- loading: w,
2580
- disabled: ie || F || A.isError,
2581
- children: v("library.create.submit")
2653
+ loading: re,
2654
+ disabled: j || oe || D.isError,
2655
+ children: g("library.create.submit")
2582
2656
  })]
2583
2657
  }),
2584
- children: /* @__PURE__ */ u(V, {
2585
- ...S,
2658
+ children: /* @__PURE__ */ u(R, {
2659
+ ...y,
2586
2660
  children: /* @__PURE__ */ u("form", {
2587
- id: we,
2661
+ id: Oe,
2588
2662
  onSubmit: (e) => {
2589
- e.preventDefault(), ce();
2663
+ e.preventDefault(), N();
2590
2664
  },
2591
- children: /* @__PURE__ */ d(j, {
2665
+ children: /* @__PURE__ */ d(O, {
2592
2666
  gap: "4",
2593
2667
  children: [
2594
- /* @__PURE__ */ u(B, {
2668
+ /* @__PURE__ */ u(Z, {
2595
2669
  name: "blueprintId",
2596
- label: v("library.create.blueprint"),
2597
- helperText: v("library.create.blueprintHelp"),
2598
- search: oe,
2599
- resolve: se,
2600
- placeholder: v("library.create.pickBlueprint"),
2670
+ label: g("library.create.blueprint"),
2671
+ helperText: g("library.create.blueprintHelp"),
2672
+ blueprintSource: p,
2673
+ valueKey: "id",
2674
+ placeholder: g("library.create.pickBlueprint"),
2601
2675
  required: !0
2602
2676
  }),
2603
- T ? /* @__PURE__ */ u(R, {
2677
+ x ? /* @__PURE__ */ u(de, {
2604
2678
  name: "releaseId",
2605
- label: v("library.create.release"),
2606
- helperText: v("library.create.releaseHelp"),
2607
- options: ne,
2679
+ label: g("library.create.release"),
2680
+ helperText: g("library.create.releaseHelp"),
2681
+ options: ie,
2608
2682
  isClearable: !1,
2609
2683
  required: !0,
2610
2684
  selectProps: { isOptionDisabled: (e) => e.data?.refused === !0 }
2611
2685
  }) : null,
2612
- ie ? /* @__PURE__ */ u(D, {
2686
+ j ? /* @__PURE__ */ u(T, {
2613
2687
  status: "warning",
2614
- title: v("library.create.noRelease")
2688
+ title: g("library.create.noRelease")
2615
2689
  }) : null,
2616
- F ? /* @__PURE__ */ u(D, {
2690
+ oe ? /* @__PURE__ */ u(T, {
2617
2691
  status: "warning",
2618
- title: v("library.create.noUsableRelease")
2692
+ title: g("library.create.noUsableRelease")
2619
2693
  }) : null,
2620
- A.isError ? /* @__PURE__ */ u(D, {
2694
+ D.isError ? /* @__PURE__ */ u(T, {
2621
2695
  status: "error",
2622
- title: v("library.create.releasesFailed")
2696
+ title: g("library.create.releasesFailed")
2623
2697
  }) : null,
2624
- N.length > 0 ? /* @__PURE__ */ u(D, {
2698
+ ae.length > 0 ? /* @__PURE__ */ u(T, {
2625
2699
  status: "info",
2626
- title: v("library.create.refusedReleases"),
2627
- children: /* @__PURE__ */ u(j, {
2700
+ title: g("library.create.refusedReleases"),
2701
+ children: /* @__PURE__ */ u(O, {
2628
2702
  gap: "1",
2629
- children: N.map((e) => /* @__PURE__ */ u(M, {
2703
+ children: ae.map((e) => /* @__PURE__ */ u(k, {
2630
2704
  textStyle: "sm",
2631
- children: v("library.create.refusedReleaseReasons", {
2705
+ children: g("library.create.refusedReleaseReasons", {
2632
2706
  name: e.name,
2633
- reasons: (e.refusals ?? []).map(Te).join(", ")
2707
+ reasons: (e.refusals ?? []).map(ke).join(", ")
2634
2708
  })
2635
2709
  }, e.id))
2636
2710
  })
2637
2711
  }) : null,
2638
- /* @__PURE__ */ u(R, {
2712
+ /* @__PURE__ */ u(de, {
2639
2713
  name: "changeSetId",
2640
- label: v("library.create.changeSet"),
2641
- helperText: v("library.create.changeSetHelp"),
2642
- options: k,
2714
+ label: g("library.create.changeSet"),
2715
+ helperText: g("library.create.changeSetHelp"),
2716
+ options: w,
2643
2717
  isClearable: !1,
2644
2718
  required: !0
2645
2719
  }),
2646
- te === "@new" ? /* @__PURE__ */ u(z, {
2720
+ S === "@new" ? /* @__PURE__ */ u(I, {
2647
2721
  name: "changeSetName",
2648
- label: v("library.create.changeSetName"),
2649
- helperText: v("changeSets.form.nameHelp"),
2722
+ label: g("library.create.changeSetName"),
2723
+ helperText: g("changeSets.form.nameHelp"),
2650
2724
  required: !0
2651
2725
  }) : null,
2652
- ee ? /* @__PURE__ */ u(D, {
2726
+ ne ? /* @__PURE__ */ u(T, {
2653
2727
  status: "error",
2654
- title: ee
2728
+ title: ne
2655
2729
  }) : null
2656
2730
  ]
2657
2731
  })
@@ -2661,66 +2735,66 @@ function Ee({ open: e, onClose: l, client: p, blueprintSource: m, initialChangeS
2661
2735
  }
2662
2736
  //#endregion
2663
2737
  //#region src/screens/content-library.tsx
2664
- var De = [
2738
+ var je = [
2665
2739
  "main",
2666
2740
  "in_force",
2667
2741
  "change_set"
2668
- ], Oe = 50, ke = 300, Ae = 5, je = "@me", Me = "collection";
2669
- function Ne(e) {
2742
+ ], Me = 50, Ne = 300, Pe = 5, Fe = "@me", Ie = "collection";
2743
+ function Le(e) {
2670
2744
  return Object.values(e).filter((e) => typeof e == "string" && e.trim() !== "" && e.length <= 200).slice(0, 2).join(" ");
2671
2745
  }
2672
- function Pe({ client: e, blueprintSource: t, onOpenContent: r, onOpenBranch: s }) {
2673
- let { t: l } = I(K), g = he(e, t), [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();
2746
+ function Re({ client: e, blueprintSource: n, onOpenContent: r, onOpenBranch: s }) {
2747
+ let { t: l } = P(U), h = _e(e, n), [te, _] = me(), v = te.get("collection") ?? "", [y, ne] = c("main"), [b, re] = c(""), [x, S] = c(""), [w, se] = c(""), [N, le] = c(""), [F, de] = c(""), [I, L] = c(!1), { userId: R, members: fe } = pe();
2674
2748
  a(() => {
2675
- let e = setTimeout(() => ae(w), ke);
2749
+ let e = setTimeout(() => se(x), Ne);
2676
2750
  return () => clearTimeout(e);
2677
- }, [w]);
2678
- let H = i((e) => y((t) => {
2751
+ }, [x]);
2752
+ let z = i((e) => _((t) => {
2679
2753
  let n = new URLSearchParams(t);
2680
- return e ? n.set(Me, e) : n.delete(Me), n;
2681
- }), [y]), U = P({
2682
- queryKey: W.collections(),
2754
+ return e ? n.set(Ie, e) : n.delete(Ie), n;
2755
+ }), [_]), B = M({
2756
+ queryKey: V.collections(),
2683
2757
  queryFn: () => e.listCollections()
2684
- }), 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 ? {
2758
+ }), H = J(e), he = i((e) => H.data?.changeSets.find((t) => t.id === e)?.name ?? e, [H.data]), W = b || H.data?.changeSets[0]?.id || "", G = o(() => y === "change_set" ? W ? {
2685
2759
  kind: "change_set",
2686
- changeSetId: q
2687
- } : void 0 : { kind: x }, [x, q]), me = o(() => ({
2688
- view: pe,
2689
- collectionId: b || void 0,
2690
- search: x === "in_force" ? void 0 : E.trim() || void 0,
2691
- blueprintIds: F ? [F] : void 0,
2692
- assigneeId: L === je ? V : L || void 0
2760
+ changeSetId: W
2761
+ } : void 0 : { kind: y }, [y, W]), ge = o(() => ({
2762
+ view: G,
2763
+ collectionId: v || void 0,
2764
+ search: y === "in_force" ? void 0 : w.trim() || void 0,
2765
+ blueprintIds: N ? [N] : void 0,
2766
+ assigneeId: F === Fe ? R : F || void 0
2693
2767
  }), [
2694
- pe,
2695
- b,
2696
- x,
2697
- E,
2768
+ G,
2769
+ v,
2770
+ y,
2771
+ w,
2772
+ N,
2698
2773
  F,
2699
- L,
2700
- V
2701
- ]), J = ie({
2702
- queryKey: W.contentList(me),
2774
+ R
2775
+ ]), K = oe({
2776
+ queryKey: V.contentList(ge),
2703
2777
  queryFn: ({ pageParam: t }) => e.listContents({
2704
- ...me,
2705
- pageSize: Oe,
2778
+ ...ge,
2779
+ pageSize: Me,
2706
2780
  pageToken: t
2707
2781
  }),
2708
2782
  initialPageParam: "",
2709
2783
  getNextPageParam: (e) => e.nextPageToken || void 0,
2710
- enabled: pe !== void 0,
2711
- placeholderData: re
2712
- }), Y = o(() => J.data?.pages.flatMap((e) => e.contents) ?? [], [J.data]), X = o(() => [...new Set(Y.map((e) => e.blueprintId))].sort(), [Y]), Z = P({
2713
- queryKey: W.blueprintNames(X),
2714
- queryFn: () => g.getBlueprints(X),
2715
- enabled: X.length > 0,
2716
- placeholderData: re,
2784
+ enabled: G !== void 0,
2785
+ placeholderData: j
2786
+ }), q = o(() => K.data?.pages.flatMap((e) => e.contents) ?? [], [K.data]), Y = o(() => [...new Set(q.map((e) => e.blueprintId))].sort(), [q]), X = M({
2787
+ queryKey: V.blueprintNames(Y),
2788
+ queryFn: () => h.getBlueprints(Y),
2789
+ enabled: Y.length > 0,
2790
+ placeholderData: j,
2717
2791
  staleTime: 6e4
2718
- }), ye = i((e) => Z.data?.find((t) => t.id === e)?.name ?? e, [Z.data]), Q = P({
2719
- queryKey: W.blueprintFilterOptions(),
2792
+ }), be = i((e) => X.data?.find((t) => t.id === e)?.name ?? e, [X.data]), xe = M({
2793
+ queryKey: V.blueprintFilterOptions(),
2720
2794
  queryFn: async () => {
2721
2795
  let e = [], t = "";
2722
- for (let n = 0; n < Ae; n++) {
2723
- let n = await g.searchBlueprints({
2796
+ for (let n = 0; n < Pe; n++) {
2797
+ let n = await h.searchBlueprints({
2724
2798
  query: "",
2725
2799
  pageToken: t
2726
2800
  });
@@ -2729,22 +2803,22 @@ function Pe({ client: e, blueprintSource: t, onOpenContent: r, onOpenBranch: s }
2729
2803
  return e;
2730
2804
  },
2731
2805
  staleTime: 6e4
2732
- }), be = o(() => /* @__PURE__ */ new Map(), [g]), xe = o(() => {
2733
- for (let e of Z.data ?? []) be.set(e.id, e);
2734
- let e = new Map(be);
2735
- for (let t of Q.data ?? []) e.set(t.id, t);
2806
+ }), Z = o(() => /* @__PURE__ */ new Map(), [h]), Se = o(() => {
2807
+ for (let e of X.data ?? []) Z.set(e.id, e);
2808
+ let e = new Map(Z);
2809
+ for (let t of xe.data ?? []) e.set(t.id, t);
2736
2810
  return [...e.values()].sort((e, t) => e.name.localeCompare(t.name));
2737
2811
  }, [
2738
- be,
2739
- Q.data,
2740
- Z.data
2741
- ]), Se = o(() => [
2812
+ Z,
2813
+ xe.data,
2814
+ X.data
2815
+ ]), Ce = o(() => [
2742
2816
  {
2743
2817
  id: "content",
2744
2818
  header: l("library.columns.content"),
2745
2819
  cell: ({ row: e }) => {
2746
- let t = Ne(e.original.data);
2747
- return /* @__PURE__ */ u(te, {
2820
+ let t = Le(e.original.data);
2821
+ return /* @__PURE__ */ u(C, {
2748
2822
  value: t || e.original.id,
2749
2823
  subText: t ? e.original.id : void 0
2750
2824
  });
@@ -2753,144 +2827,144 @@ function Pe({ client: e, blueprintSource: t, onOpenContent: r, onOpenBranch: s }
2753
2827
  {
2754
2828
  id: "blueprint",
2755
2829
  header: l("library.columns.blueprint"),
2756
- cell: ({ row: e }) => /* @__PURE__ */ u(te, { value: ye(e.original.blueprintId) })
2830
+ cell: ({ row: e }) => /* @__PURE__ */ u(C, { value: be(e.original.blueprintId) })
2757
2831
  },
2758
2832
  {
2759
2833
  id: "readOn",
2760
2834
  header: l("library.columns.readOn"),
2761
2835
  cell: ({ row: e }) => {
2762
- let t = e.original, n = t.changeSetId ? fe(t.changeSetId) : t.releaseId ? l("library.readOn.release") : l("library.readOn.main");
2763
- return /* @__PURE__ */ u(te, { value: n });
2836
+ let t = e.original, n = t.changeSetId ? he(t.changeSetId) : t.releaseId ? l("library.readOn.release") : l("library.readOn.main");
2837
+ return /* @__PURE__ */ u(C, { value: n });
2764
2838
  }
2765
2839
  },
2766
2840
  {
2767
2841
  id: "revised",
2768
2842
  header: l("library.columns.revised"),
2769
- cell: ({ row: e }) => /* @__PURE__ */ u(h, { value: e.original.revisionCreateTime })
2843
+ cell: ({ row: e }) => /* @__PURE__ */ u(ee, { value: e.original.revisionCreateTime })
2770
2844
  }
2771
2845
  ], [
2772
2846
  l,
2773
- ye,
2774
- fe
2775
- ]), Ce = /* @__PURE__ */ d(f, {
2847
+ be,
2848
+ he
2849
+ ]), Q = /* @__PURE__ */ d(f, {
2776
2850
  size: "sm",
2777
2851
  variant: "solid",
2778
- onClick: () => B(!0),
2779
- children: [/* @__PURE__ */ u(ce, { size: 16 }), l("library.create.button")]
2780
- }), we = J.error instanceof n ? J.error.message : l("library.loadError"), $ = b ? _e(b, U.data ?? []).map((e) => e.name).join(" / ") || b : l("library.allContent");
2781
- return /* @__PURE__ */ d(ne, {
2852
+ onClick: () => L(!0),
2853
+ children: [/* @__PURE__ */ u(ue, { size: 16 }), l("library.create.button")]
2854
+ }), we = K.error instanceof t ? K.error.message : l("library.loadError"), Te = v ? ve(v, B.data ?? []).map((e) => e.name).join(" / ") || v : l("library.allContent");
2855
+ return /* @__PURE__ */ d(ae, {
2782
2856
  title: l("library.title"),
2783
2857
  breadcrumbs: [{ label: l("library.title") }],
2784
- actions: Ce,
2785
- toolbar: /* @__PURE__ */ d(_, { children: [
2786
- x === "in_force" ? /* @__PURE__ */ u(M, {
2858
+ actions: Q,
2859
+ toolbar: /* @__PURE__ */ d(g, { children: [
2860
+ y === "in_force" ? /* @__PURE__ */ u(k, {
2787
2861
  fontSize: "sm",
2788
2862
  color: "muted",
2789
2863
  children: l("library.filter.searchInForce")
2790
- }) : /* @__PURE__ */ u(_.Search, {
2864
+ }) : /* @__PURE__ */ u(g.Search, {
2791
2865
  placeholder: l("library.filter.searchPlaceholder"),
2792
- value: w,
2793
- onChange: (e) => T([...e].slice(0, 200).join(""))
2866
+ value: x,
2867
+ onChange: (e) => S([...e].slice(0, 200).join(""))
2794
2868
  }),
2795
- /* @__PURE__ */ d(_.Filters, { children: [
2796
- /* @__PURE__ */ u(k, {
2869
+ /* @__PURE__ */ d(g.Filters, { children: [
2870
+ /* @__PURE__ */ u(D, {
2797
2871
  size: "sm",
2798
2872
  "aria-label": l("library.filter.view"),
2799
- value: x,
2873
+ value: y,
2800
2874
  onChange: (e) => {
2801
2875
  let t = e.target.value;
2802
- t === "in_force" && (T(""), ae("")), S(t);
2876
+ t === "in_force" && (S(""), se("")), ne(t);
2803
2877
  },
2804
- children: De.map((e) => /* @__PURE__ */ u("option", {
2878
+ children: je.map((e) => /* @__PURE__ */ u("option", {
2805
2879
  value: e,
2806
2880
  children: l(`library.view.${e}`)
2807
2881
  }, e))
2808
2882
  }),
2809
- x === "change_set" ? /* @__PURE__ */ d(k, {
2883
+ y === "change_set" ? /* @__PURE__ */ d(D, {
2810
2884
  size: "sm",
2811
2885
  "aria-label": l("library.filter.changeSet"),
2812
- value: q,
2813
- onChange: (e) => C(e.target.value),
2814
- children: [G.data?.changeSets.length ? null : /* @__PURE__ */ u("option", {
2886
+ value: W,
2887
+ onChange: (e) => re(e.target.value),
2888
+ children: [H.data?.changeSets.length ? null : /* @__PURE__ */ u("option", {
2815
2889
  value: "",
2816
2890
  children: l("library.filter.noOpenChangeSet")
2817
- }), (G.data?.changeSets ?? []).map((e) => /* @__PURE__ */ u("option", {
2891
+ }), (H.data?.changeSets ?? []).map((e) => /* @__PURE__ */ u("option", {
2818
2892
  value: e.id,
2819
2893
  children: e.name
2820
2894
  }, e.id))]
2821
2895
  }) : null,
2822
- /* @__PURE__ */ d(k, {
2896
+ /* @__PURE__ */ d(D, {
2823
2897
  size: "sm",
2824
2898
  "aria-label": l("library.filter.blueprint"),
2825
- value: F,
2826
- onChange: (e) => se(e.target.value),
2899
+ value: N,
2900
+ onChange: (e) => le(e.target.value),
2827
2901
  children: [/* @__PURE__ */ u("option", {
2828
2902
  value: "",
2829
2903
  children: l("library.filter.anyBlueprint")
2830
- }), xe.map((e) => /* @__PURE__ */ u("option", {
2904
+ }), Se.map((e) => /* @__PURE__ */ u("option", {
2831
2905
  value: e.id,
2832
2906
  children: e.name
2833
2907
  }, e.id))]
2834
2908
  }),
2835
- /* @__PURE__ */ d(k, {
2909
+ /* @__PURE__ */ d(D, {
2836
2910
  size: "sm",
2837
2911
  "aria-label": l("library.filter.assignee"),
2838
- value: L,
2839
- onChange: (e) => R(e.target.value),
2912
+ value: F,
2913
+ onChange: (e) => de(e.target.value),
2840
2914
  children: [
2841
2915
  /* @__PURE__ */ u("option", {
2842
2916
  value: "",
2843
2917
  children: l("library.filter.anyone")
2844
2918
  }),
2845
2919
  /* @__PURE__ */ u("option", {
2846
- value: je,
2920
+ value: Fe,
2847
2921
  children: l("library.filter.me")
2848
2922
  }),
2849
- le.list().filter((e) => e.userId !== V).map((e) => /* @__PURE__ */ u("option", {
2923
+ fe.list().filter((e) => e.userId !== R).map((e) => /* @__PURE__ */ u("option", {
2850
2924
  value: e.userId,
2851
2925
  children: e.displayName
2852
2926
  }, e.userId))
2853
2927
  ]
2854
2928
  })
2855
2929
  ] }),
2856
- /* @__PURE__ */ u(_.Right, { children: J.isError ? null : /* @__PURE__ */ d(_.Count, { children: [l("library.count", { count: Y.length }), J.hasNextPage ? "+" : ""] }) })
2930
+ /* @__PURE__ */ u(g.Right, { children: K.isError ? null : /* @__PURE__ */ d(g.Count, { children: [l("library.count", { count: q.length }), K.hasNextPage ? "+" : ""] }) })
2857
2931
  ] }),
2858
- children: [/* @__PURE__ */ d(N, {
2932
+ children: [/* @__PURE__ */ d(A, {
2859
2933
  storageKey: "contenthub-library-subnav",
2860
- children: [/* @__PURE__ */ u(N.Nav, {
2934
+ children: [/* @__PURE__ */ u(A.Nav, {
2861
2935
  "aria-label": l("library.collections"),
2862
- children: U.isSuccess ? /* @__PURE__ */ u(ve, {
2863
- collections: U.data,
2864
- activeId: b,
2865
- onSelect: H
2866
- }) : U.isError ? /* @__PURE__ */ u(M, {
2936
+ children: B.isSuccess ? /* @__PURE__ */ u(ye, {
2937
+ collections: B.data,
2938
+ activeId: v,
2939
+ onSelect: z
2940
+ }) : B.isError ? /* @__PURE__ */ u(k, {
2867
2941
  fontSize: "sm",
2868
2942
  color: "muted",
2869
2943
  px: "3",
2870
2944
  py: "2",
2871
2945
  children: l("library.collectionsError")
2872
- }) : /* @__PURE__ */ u(O, {
2946
+ }) : /* @__PURE__ */ u(E, {
2873
2947
  justify: "center",
2874
2948
  py: "4",
2875
- children: /* @__PURE__ */ u(A, { size: "sm" })
2949
+ children: /* @__PURE__ */ u(ie, { size: "sm" })
2876
2950
  })
2877
- }), /* @__PURE__ */ d(N.Detail, { children: [/* @__PURE__ */ u(N.Toolbar, { children: /* @__PURE__ */ u(M, {
2951
+ }), /* @__PURE__ */ d(A.Detail, { children: [/* @__PURE__ */ u(A.Toolbar, { children: /* @__PURE__ */ u(k, {
2878
2952
  fontSize: "sm",
2879
2953
  fontWeight: "medium",
2880
- children: $
2881
- }) }), /* @__PURE__ */ d(j, {
2954
+ children: Te
2955
+ }) }), /* @__PURE__ */ d(O, {
2882
2956
  gap: "3",
2883
2957
  children: [
2884
- J.isError ? /* @__PURE__ */ u(D, {
2958
+ K.isError ? /* @__PURE__ */ u(T, {
2885
2959
  status: "error",
2886
2960
  title: we,
2887
2961
  mx: "8",
2888
2962
  mt: "4"
2889
2963
  }) : null,
2890
2964
  /* @__PURE__ */ u(m, {
2891
- columns: Se,
2892
- data: Y,
2893
- loading: J.isLoading,
2965
+ columns: Ce,
2966
+ data: q,
2967
+ loading: K.isLoading,
2894
2968
  getRowId: (e) => `${e.id}/${e.branchId}/${e.releaseId}`,
2895
2969
  onRowClick: (e) => r({
2896
2970
  contentId: e.id,
@@ -2898,32 +2972,32 @@ function Pe({ client: e, blueprintSource: t, onOpenContent: r, onOpenBranch: s }
2898
2972
  }),
2899
2973
  variant: "hoverable",
2900
2974
  emptyState: /* @__PURE__ */ u(p, {
2901
- icon: /* @__PURE__ */ u(oe, { size: 32 }),
2975
+ icon: /* @__PURE__ */ u(ce, { size: 32 }),
2902
2976
  header: l("library.empty"),
2903
2977
  description: l("library.emptyHint")
2904
2978
  })
2905
2979
  }),
2906
- J.hasNextPage ? /* @__PURE__ */ u(O, {
2980
+ K.hasNextPage ? /* @__PURE__ */ u(E, {
2907
2981
  justify: "center",
2908
2982
  pb: "4",
2909
2983
  children: /* @__PURE__ */ u(f, {
2910
2984
  size: "sm",
2911
2985
  variant: "outline",
2912
- loading: J.isFetchingNextPage,
2913
- onClick: () => void J.fetchNextPage(),
2986
+ loading: K.isFetchingNextPage,
2987
+ onClick: () => void K.fetchNextPage(),
2914
2988
  children: l("library.more")
2915
2989
  })
2916
2990
  }) : null
2917
2991
  ]
2918
2992
  })] })]
2919
- }), /* @__PURE__ */ u(Ee, {
2920
- open: z,
2921
- onClose: () => B(!1),
2993
+ }), /* @__PURE__ */ u(Ae, {
2994
+ open: I,
2995
+ onClose: () => L(!1),
2922
2996
  client: e,
2923
- blueprintSource: g,
2924
- initialChangeSetId: x === "change_set" ? q : void 0,
2997
+ blueprintSource: h,
2998
+ initialChangeSetId: y === "change_set" ? W : void 0,
2925
2999
  onCreated: (e) => {
2926
- B(!1), s({
3000
+ L(!1), s({
2927
3001
  changeSetId: e.changeSetId,
2928
3002
  contentId: e.id,
2929
3003
  branchId: e.branchId
@@ -2932,8 +3006,8 @@ function Pe({ client: e, blueprintSource: t, onOpenContent: r, onOpenBranch: s }
2932
3006
  })]
2933
3007
  });
2934
3008
  }
2935
- Pe.displayName = "ContentLibrary";
3009
+ Re.displayName = "ContentLibrary";
2936
3010
  //#endregion
2937
- 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 };
3011
+ export { Te as a, Z as c, J as d, _e as f, V as g, W as h, De as i, xe as l, G as m, Re as n, Ee as o, U as p, Le as r, we as s, Ie as t, ve as u };
2938
3012
 
2939
- //# sourceMappingURL=content-library-BdHuzmXL.js.map
3013
+ //# sourceMappingURL=content-library-C5MCRNY0.js.map