@epam/ai-dial-publish-panel 1.3.0-dev.326 → 1.3.0-dev.331

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,46 +1,46 @@
1
1
  import { useCallback as e, useEffect as t, useId as n, useMemo as r, useRef as i, useState as a } from "react";
2
- import { ButtonVariant as o, Checkbox as s, DIAL_ICON_SIZE as c, DIAL_KIT_ICON_STROKE as l, DialFileNodeType as u, ErrorText as d, GhostButton as f, GhostIconButton as p, Highlight as m, Input as h, LiveRegion as g, LiveRegionElement as _, NeutralButton as v, Notification as ee, NotificationType as y, NotificationVariant as b, Search as x, Select as S, SideDrawer as te, Spinner as C, Tag as w, TagInput as T } from "@epam/ai-dial-ui-kit";
3
- import { ResourceSummary as E, TAG_INPUT_TAG_CLASS_NAME as D, buildCssVars as O, mergeClasses as k } from "@epam/ai-dial-chat-shared";
4
- import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
5
- import { IconFolderPlus as ne, IconPlus as re, IconTrashX as ie } from "@tabler/icons-react";
6
- import { DialFileNodeType as ae, DialFoldersTree as oe } from "@epam/ai-dial-react-file-manager";
2
+ import { ButtonVariant as o, Checkbox as s, DIAL_ICON_SIZE as c, DIAL_KIT_ICON_STROKE as l, DialFileNodeType as u, ElementSize as d, ErrorText as f, FolderName as p, GhostButton as m, GhostIconButton as h, Highlight as g, Input as _, LinkButton as ee, LiveRegion as v, LiveRegionElement as te, LiveRegionPoliteness as y, NeutralButton as b, Notification as x, NotificationType as S, NotificationVariant as C, PrimaryButton as ne, RadioGroup as re, Search as w, Select as T, SideDrawer as E, Spinner as D, Tag as O, TagInput as k } from "@epam/ai-dial-ui-kit";
3
+ import { ResourceSummary as A, TAG_INPUT_TAG_CLASS_NAME as j, buildCssVars as ie, mergeClasses as M } from "@epam/ai-dial-chat-shared";
4
+ import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
5
+ import { IconFolder as I, IconFolderPlus as ae, IconPlus as L, IconTrashX as oe } from "@tabler/icons-react";
6
+ import { DialFileNodeType as se, DialFoldersTree as ce } from "@epam/ai-dial-react-file-manager";
7
7
  //#region src/models/publish.ts
8
- var N = /* @__PURE__ */ function(e) {
8
+ var R = /* @__PURE__ */ function(e) {
9
9
  return e.Equal = "EQUAL", e.Contain = "CONTAIN", e.Regex = "REGEX", e;
10
- }({}), P = /* @__PURE__ */ function(e) {
10
+ }({}), z = /* @__PURE__ */ function(e) {
11
11
  return e.None = "none", e.Info = "info", e.ReplaceWarning = "replaceWarning", e.NoAccess = "noAccess", e.SubmitError = "submitError", e;
12
- }({}), se = (e) => e.isSubmitting ? {
13
- calloutKind: P.None,
12
+ }({}), B = (e) => e.isSubmitting ? {
13
+ calloutKind: z.None,
14
14
  isSubmitDisabled: !0,
15
15
  isSubmitLoading: !0
16
16
  } : e.hasSelectedFolder ? e.hasWriteAccess ? e.hasSubmitError ? {
17
- calloutKind: P.SubmitError,
17
+ calloutKind: z.SubmitError,
18
18
  isSubmitDisabled: !1,
19
19
  isSubmitLoading: !1
20
20
  } : e.hasExistingPublicationInFolder ? {
21
- calloutKind: P.ReplaceWarning,
21
+ calloutKind: z.ReplaceWarning,
22
22
  isSubmitDisabled: e.allowReplace === !1,
23
23
  isSubmitLoading: !1
24
24
  } : {
25
- calloutKind: P.Info,
25
+ calloutKind: z.Info,
26
26
  isSubmitDisabled: !1,
27
27
  isSubmitLoading: !1
28
28
  } : {
29
- calloutKind: P.NoAccess,
29
+ calloutKind: z.NoAccess,
30
30
  isSubmitDisabled: !0,
31
31
  isSubmitLoading: !1
32
32
  } : {
33
- calloutKind: P.None,
33
+ calloutKind: z.None,
34
34
  isSubmitDisabled: !0,
35
35
  isSubmitLoading: !1
36
- }, F = 864e5, I = (e, t = Date.now(), n) => {
37
- let r = Math.floor((t - e) / F);
36
+ }, V = 864e5, H = (e, t = Date.now(), n) => {
37
+ let r = Math.floor((t - e) / V);
38
38
  return r <= 0 ? "Today" : r === 1 ? "Yesterday" : r < 7 ? `${r} days ago` : new Date(e).toLocaleDateString(n, {
39
39
  month: "short",
40
40
  day: "numeric",
41
41
  year: "numeric"
42
42
  });
43
- }, L = (e, t, n) => t.length === 0 ? [...e, {
43
+ }, le = (e, t, n) => t.length === 0 ? [...e, {
44
44
  path: [n],
45
45
  name: n
46
46
  }] : e.map((e) => e.path.join("/") === t.join("/") ? {
@@ -51,46 +51,46 @@ var N = /* @__PURE__ */ function(e) {
51
51
  }]
52
52
  } : {
53
53
  ...e,
54
- children: e.children ? L(e.children, t, n) : e.children
55
- }), R = (e, t, n) => {
54
+ children: e.children ? le(e.children, t, n) : e.children
55
+ }), U = (e, t, n) => {
56
56
  let r = [...t, n].join("/");
57
57
  return t.length === 0 ? e.filter((e) => e.path.join("/") !== r) : e.map((e) => e.path.join("/") === t.join("/") ? {
58
58
  ...e,
59
59
  children: (e.children ?? []).filter((e) => e.path.join("/") !== r)
60
60
  } : {
61
61
  ...e,
62
- children: e.children ? R(e.children, t, n) : e.children
62
+ children: e.children ? U(e.children, t, n) : e.children
63
63
  });
64
- }, z = ({ item: n, history: i, folderItems: o, hasWriteAccess: s = () => !0, defaultAuthor: c = "", onCreateFolder: l, onPublish: u, onPublishSuccess: d, onPublishError: f, onFetchExistingRules: p }) => {
64
+ }, ue = ({ item: n, history: i, folderItems: o, hasWriteAccess: s = () => !0, defaultAuthor: c = "", onCreateFolder: l, onPublish: u, onPublishSuccess: d, onPublishError: f, onFetchExistingRules: p }) => {
65
65
  let [m, h] = a(o);
66
66
  t(() => {
67
67
  h(o);
68
68
  }, [o]);
69
- let [g, _] = a(), [v, ee] = a(!1), [y, b] = a(!1), [x, S] = a([]), [te, C] = a(!1), [w, T] = a(!1), [E, D] = a(c), [O, k] = a(!1), [A, j] = a(!1);
69
+ let [g, _] = a(), [ee, v] = a(!1), [te, y] = a(!1), [b, x] = a([]), [S, C] = a(!1), [ne, re] = a(!1), [w, T] = a(c), [E, D] = a(!1), [O, k] = a(!1);
70
70
  t(() => {
71
- A || D(c);
72
- }, [c, A]);
73
- let M = e((e) => {
74
- j(!0), D(e);
71
+ O || T(c);
72
+ }, [c, O]);
73
+ let A = e((e) => {
74
+ k(!0), T(e);
75
75
  }, []);
76
76
  t(() => {
77
77
  if (g == null) {
78
- S([]), T(!1);
78
+ x([]), re(!1);
79
79
  return;
80
80
  }
81
81
  if (!p) return;
82
82
  let e = !1;
83
- return C(!0), T(!1), p(g).then((t) => {
84
- e || S(t);
83
+ return C(!0), re(!1), p(g).then((t) => {
84
+ e || x(t);
85
85
  }).catch(() => {
86
- e || T(!0);
86
+ e || re(!0);
87
87
  }).finally(() => {
88
88
  e || C(!1);
89
89
  }), () => {
90
90
  e = !0;
91
91
  };
92
92
  }, [g]);
93
- let ne = r(() => {
93
+ let j = r(() => {
94
94
  if (!g) return !1;
95
95
  let e = g.join("/");
96
96
  return i.some((t) => t.folderPath.join("/") === e ? n.version == null || t.version === n.version : !1);
@@ -98,258 +98,258 @@ var N = /* @__PURE__ */ function(e) {
98
98
  i,
99
99
  n.version,
100
100
  g
101
- ]), re = e(async (e, t) => {
102
- h((n) => L(n, e, t));
101
+ ]), ie = e(async (e, t) => {
102
+ h((n) => le(n, e, t));
103
103
  try {
104
104
  await l?.(e, t);
105
105
  } catch {
106
- h((n) => R(n, e, t)), b(!0);
106
+ h((n) => U(n, e, t)), y(!0);
107
107
  }
108
- }, [l]), ie = e(async () => {
108
+ }, [l]), M = e(async () => {
109
109
  if (!g) return !1;
110
- ee(!0), b(!1);
110
+ v(!0), y(!1);
111
111
  try {
112
- return await u(n, g, x, E.trim(), O), d?.(n, g), !0;
112
+ return await u(n, g, b, w.trim(), E), d?.(n, g), !0;
113
113
  } catch (e) {
114
- return b(!0), f?.(n, g, e), !1;
114
+ return y(!0), f?.(n, g, e), !1;
115
115
  } finally {
116
- ee(!1);
116
+ v(!1);
117
117
  }
118
118
  }, [
119
- E,
119
+ w,
120
120
  n,
121
121
  u,
122
122
  f,
123
123
  d,
124
- O,
125
- x,
124
+ E,
125
+ b,
126
126
  g
127
- ]), ae = e(() => {
128
- h(o), _(void 0), b(!1), S([]), T(!1), D(c), j(!1), k(!1);
127
+ ]), N = e(() => {
128
+ h(o), _(void 0), y(!1), x([]), re(!1), T(c), k(!1), D(!1);
129
129
  }, [c, o]);
130
130
  return {
131
131
  folderItems: m,
132
132
  selectedFolderPath: g,
133
133
  setSelectedFolderPath: _,
134
- handleCreateFolder: re,
135
- hasExistingPublicationInFolder: ne,
134
+ handleCreateFolder: ie,
135
+ hasExistingPublicationInFolder: j,
136
136
  hasWriteAccess: !g || s(g),
137
- isSubmitting: v,
138
- hasSubmitError: y,
139
- handleSubmit: ie,
140
- reset: ae,
141
- rules: x,
142
- setRules: S,
143
- author: E,
144
- setAuthor: M,
145
- publishCredentials: O,
146
- setPublishCredentials: k,
147
- isRulesLoading: te,
148
- hasRulesLoadError: w
137
+ isSubmitting: ee,
138
+ hasSubmitError: te,
139
+ handleSubmit: M,
140
+ reset: N,
141
+ rules: b,
142
+ setRules: x,
143
+ author: w,
144
+ setAuthor: A,
145
+ publishCredentials: E,
146
+ setPublishCredentials: D,
147
+ isRulesLoading: S,
148
+ hasRulesLoadError: ne
149
149
  };
150
- }, B = (e, t) => {
150
+ }, W = (e, t) => {
151
151
  let n = t.trim().toLowerCase();
152
152
  return n ? e.reduce((e, r) => {
153
- let i = r.children ? B(r.children, t) : void 0;
153
+ let i = r.children ? W(r.children, t) : void 0;
154
154
  return r.name.toLowerCase().includes(n) ? e.push(r) : i?.length && e.push({
155
155
  ...r,
156
156
  children: i
157
157
  }), e;
158
158
  }, []) : e;
159
- }, V = (e, t) => e.localeCompare(t, void 0, {
159
+ }, de = (e, t) => e.localeCompare(t, void 0, {
160
160
  sensitivity: "base",
161
161
  numeric: !0
162
- }), ce = (e) => [...e].sort((e, t) => V(e.name, t.name)).map((e) => e.children ? {
162
+ }), fe = (e) => [...e].sort((e, t) => de(e.name, t.name)).map((e) => e.children ? {
163
163
  ...e,
164
- children: ce(e.children)
165
- } : e), H = (e, t, n) => {
164
+ children: fe(e.children)
165
+ } : e), G = (e, t, n) => {
166
166
  let [r, ...i] = t;
167
167
  if (r == null) return e;
168
168
  let a = [...n, r], o = e.find((e) => e.name === r);
169
169
  return o ? i.length ? e.map((e) => e === o ? {
170
170
  ...e,
171
- children: H(e.children ?? [], i, a)
171
+ children: G(e.children ?? [], i, a)
172
172
  } : e) : e : [...e, {
173
173
  path: a,
174
174
  name: r,
175
- children: i.length ? H([], i, a) : void 0
175
+ children: i.length ? G([], i, a) : void 0
176
176
  }];
177
- }, U = (e, t) => t.reduce((e, t) => t.length ? H(e, t, []) : e, e), W = (e) => e.flatMap((e) => [e.path.join("/"), ...e.children ? W(e.children) : []]), G = (e) => e.join("/"), K = (e) => e.split("/").filter(Boolean), le = (e) => e.map((e) => {
178
- let t = G(e.path);
177
+ }, K = (e, t) => t.reduce((e, t) => t.length ? G(e, t, []) : e, e), q = (e) => e.flatMap((e) => [e.path.join("/"), ...e.children ? q(e.children) : []]), J = (e) => e.join("/"), pe = (e) => e.split("/").filter(Boolean), Y = (e) => e.map((e) => {
178
+ let t = J(e.path);
179
179
  return {
180
180
  path: t,
181
181
  name: e.name,
182
182
  folderId: t,
183
183
  nodeType: u.FOLDER,
184
- items: e.children ? le(e.children) : void 0
184
+ items: e.children ? Y(e.children) : void 0
185
185
  };
186
- }), q = /[/\\:;,={}&"]/, ue = (e, t, n) => {
186
+ }), me = /[/\\:;,={}&"]/, he = (e, t, n) => {
187
187
  let r = e.trim();
188
- return r ? r.includes("..") || q.test(r) ? n.invalid : t.some((e) => e.toLowerCase() === r.toLowerCase()) ? n.duplicate : null : n.empty;
189
- }, J = (e, t) => {
188
+ return r ? r.includes("..") || me.test(r) ? n.invalid : t.some((e) => e.toLowerCase() === r.toLowerCase()) ? n.duplicate : null : n.empty;
189
+ }, ge = (e, t) => {
190
190
  let n = new Set(t.map((e) => e.toLowerCase()));
191
191
  if (!n.has(e.toLowerCase())) return e;
192
192
  let r = 2;
193
193
  for (; n.has(`${e} ${r}`.toLowerCase());) r += 1;
194
194
  return `${e} ${r}`;
195
- }, de = (e, t) => {
195
+ }, _e = (e, t) => {
196
196
  if (t.length === 0) return e.map((e) => e.name);
197
- let n = G(t), r = (e) => {
197
+ let n = J(t), r = (e) => {
198
198
  for (let t of e) {
199
- if (G(t.path) === n) return t;
199
+ if (J(t.path) === n) return t;
200
200
  let e = t.children ? r(t.children) : void 0;
201
201
  if (e) return e;
202
202
  }
203
203
  };
204
204
  return (r(e)?.children ?? []).map((e) => e.name);
205
- }, Y = {
205
+ }, ve = {
206
206
  dialog: "_dialog_jqcm2_5",
207
207
  error: "_error_jqcm2_14",
208
208
  selectField: "_selectField_jqcm2_28",
209
209
  selectFieldOpen: "_selectFieldOpen_jqcm2_40"
210
- }, fe = 20, X = 200, pe = 8, me = (e) => {
210
+ }, X = 20, Z = 200, ye = 8, be = (e) => {
211
211
  let t = e.trim();
212
- if (t.length === 0 || t.length > X) return !1;
212
+ if (t.length === 0 || t.length > Z) return !1;
213
213
  try {
214
214
  return new RegExp(t) instanceof RegExp;
215
215
  } catch {
216
216
  return !1;
217
217
  }
218
- }, he = ({ sourceOptions: e, onSave: o, onCancel: s, disabled: c = !1, maxTargets: l = fe, labels: u = {}, errorClassName: p = "dial-tiny-text", styles: g = {} }) => {
219
- let _ = {
220
- ...O({
221
- "--pare-mobile-bg": g.colors?.mobileBackground,
222
- "--pare-bg": g.colors?.background,
223
- "--pare-error-text": g.colors?.errorText,
224
- "--pare-select-border": g.colors?.selectBorder,
225
- "--pare-select-border-hover": g.colors?.selectBorderHover,
226
- "--pare-select-border-open": g.colors?.selectBorderOpen,
227
- "--pare-select-border-focus": g.colors?.selectBorderFocus
218
+ }, Q = ({ sourceOptions: e, onSave: o, onCancel: s, disabled: c = !1, maxTargets: l = X, labels: u = {}, errorClassName: d = "dial-tiny-text", styles: p = {} }) => {
219
+ let h = {
220
+ ...ie({
221
+ "--pare-mobile-bg": p.colors?.mobileBackground,
222
+ "--pare-bg": p.colors?.background,
223
+ "--pare-error-text": p.colors?.errorText,
224
+ "--pare-select-border": p.colors?.selectBorder,
225
+ "--pare-select-border-hover": p.colors?.selectBorderHover,
226
+ "--pare-select-border-open": p.colors?.selectBorderOpen,
227
+ "--pare-select-border-focus": p.colors?.selectBorderFocus
228
228
  }),
229
- ...g.cssVars
230
- }, { sourceLabel: ee = "Source", sourcePlaceholder: y = "Select...", functionLabel: b = "Function", equalOptionLabel: x = "Equal", containOptionLabel: te = "Contain", regexOptionLabel: C = "Regex", targetsLabel: w = "Targets", targetsPlaceholder: E = "Add a target", targetsHintLabel: A = "Press Enter or comma to add a target.", patternLabel: ne = "Pattern", patternPlaceholder: re = "Enter a regular expression", invalidRegexError: ie = "Enter a valid regular expression.", requiredFieldError: ae = "This field is required.", targetsRequiredError: oe = "Add at least one target.", saveLabel: P = "Save", cancelLabel: se = "Cancel", dialogAriaLabel: F = "Add access rule" } = u, I = n(), L = n(), R = n(), z = n(), B = i(null);
229
+ ...p.cssVars
230
+ }, { sourceLabel: ee = "Source", sourcePlaceholder: v = "Select...", functionLabel: te = "Function", equalOptionLabel: y = "Equal", containOptionLabel: x = "Contain", regexOptionLabel: S = "Regex", targetsLabel: C = "Targets", targetsPlaceholder: ne = "Add a target", targetsHintLabel: re = "Press Enter or comma to add a target.", patternLabel: w = "Pattern", patternPlaceholder: E = "Enter a regular expression", invalidRegexError: D = "Enter a valid regular expression.", requiredFieldError: O = "This field is required.", targetsRequiredError: A = "Add at least one target.", saveLabel: N = "Save", cancelLabel: I = "Cancel", dialogAriaLabel: ae = "Add access rule" } = u, L = n(), oe = n(), se = n(), ce = n(), z = i(null);
231
231
  t(() => {
232
- B.current?.focus();
232
+ z.current?.focus();
233
233
  }, []);
234
- let [V, ce] = a(), [H, U] = a(), [W, G] = a([]), [K, le] = a(""), [q, ue] = a(!1), [J, de] = a(""), [X, he] = a(!1), [Z, ge] = a(!1), _e = k(Y.selectField, q && Y.selectFieldOpen), ve = k(Y.selectField, X && Y.selectFieldOpen), Q = r(() => e.map((e) => ({
234
+ let [B, V] = a(), [H, le] = a(), [U, ue] = a([]), [W, de] = a(""), [fe, G] = a(!1), [K, q] = a(""), [J, pe] = a(!1), [Y, me] = a(!1), he = M(ve.selectField, fe && ve.selectFieldOpen), ge = M(ve.selectField, J && ve.selectFieldOpen), _e = r(() => e.map((e) => ({
235
235
  value: e,
236
236
  label: e,
237
- labelNode: J.trim() ? /* @__PURE__ */ j(m, {
237
+ labelNode: K.trim() ? /* @__PURE__ */ P(g, {
238
238
  text: e,
239
- query: J,
239
+ query: K,
240
240
  maxLines: 1
241
241
  }) : void 0
242
- })), [e, J]), ye = r(() => [
242
+ })), [e, K]), Z = r(() => [
243
243
  {
244
- value: N.Equal,
245
- label: x
244
+ value: R.Equal,
245
+ label: y
246
246
  },
247
247
  {
248
- value: N.Contain,
249
- label: te
248
+ value: R.Contain,
249
+ label: x
250
250
  },
251
251
  {
252
- value: N.Regex,
253
- label: C
252
+ value: R.Regex,
253
+ label: S
254
254
  }
255
255
  ], [
256
+ y,
256
257
  x,
257
- te,
258
- C
259
- ]), be = H === N.Regex, $ = me(K), xe = V != null && H != null && (be ? $ : W.length > 0);
260
- return /* @__PURE__ */ M("div", {
261
- ref: B,
258
+ S
259
+ ]), Q = H === R.Regex, $ = be(W), xe = B != null && H != null && (Q ? $ : U.length > 0);
260
+ return /* @__PURE__ */ F("div", {
261
+ ref: z,
262
262
  role: "dialog",
263
263
  "aria-modal": "true",
264
- "aria-label": F,
264
+ "aria-label": ae,
265
265
  tabIndex: -1,
266
266
  onKeyDown: (e) => {
267
267
  e.key === "Escape" && (e.stopPropagation(), s());
268
268
  },
269
- style: _,
270
- className: k("fixed inset-0 z-60 flex flex-col gap-3 overflow-y-auto p-4", "desktop:static desktop:z-auto desktop:flex-none desktop:overflow-visible desktop:rounded-lg desktop:p-3", Y.dialog),
269
+ style: h,
270
+ className: M("fixed inset-0 z-60 flex flex-col gap-3 overflow-y-auto p-4", "desktop:static desktop:z-auto desktop:flex-none desktop:overflow-visible desktop:rounded-lg desktop:p-3", ve.dialog),
271
271
  children: [
272
- /* @__PURE__ */ j(S, {
273
- id: L,
272
+ /* @__PURE__ */ P(T, {
273
+ id: oe,
274
274
  labelProps: { label: ee },
275
- options: Q,
276
- value: V,
275
+ options: _e,
276
+ value: B,
277
277
  onChange: (e) => {
278
- ce(Array.isArray(e) ? e[0] : e), ue(!1);
278
+ V(Array.isArray(e) ? e[0] : e), G(!1);
279
279
  },
280
- placeholder: y,
281
- searchable: e.length > pe,
282
- searchPlaceholder: y,
283
- onSearchQueryChange: de,
280
+ placeholder: v,
281
+ searchable: e.length > ye,
282
+ searchPlaceholder: v,
283
+ onSearchQueryChange: q,
284
284
  disabled: c,
285
- open: q,
286
- onOpenChange: ue,
287
- fieldClassName: _e,
288
- invalid: Z && V == null,
289
- error: Z && V == null ? ae : void 0
285
+ open: fe,
286
+ onOpenChange: G,
287
+ fieldClassName: he,
288
+ invalid: Y && B == null,
289
+ error: Y && B == null ? O : void 0
290
290
  }),
291
- /* @__PURE__ */ j(S, {
292
- labelProps: { label: b },
293
- id: R,
294
- options: ye,
291
+ /* @__PURE__ */ P(T, {
292
+ labelProps: { label: te },
293
+ id: se,
294
+ options: Z,
295
295
  value: H,
296
296
  onChange: (e) => {
297
297
  let t = Array.isArray(e) ? e[0] : e;
298
- H === N.Regex != (t === N.Regex) && (G([]), le("")), U(t), he(!1);
298
+ H === R.Regex != (t === R.Regex) && (ue([]), de("")), le(t), pe(!1);
299
299
  },
300
- placeholder: b,
300
+ placeholder: te,
301
301
  disabled: c,
302
- open: X,
303
- onOpenChange: he,
304
- fieldClassName: ve,
305
- invalid: Z && H == null,
306
- error: Z && H == null ? ae : void 0
302
+ open: J,
303
+ onOpenChange: pe,
304
+ fieldClassName: ge,
305
+ invalid: Y && H == null,
306
+ error: Y && H == null ? O : void 0
307
307
  }),
308
- be ? /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j(h, {
309
- id: `${I}-input`,
310
- labelProps: { label: ne },
311
- placeholder: re,
312
- value: K,
313
- onChange: (e) => le(e ?? ""),
314
- invalid: (K.length > 0 || Z) && !$,
315
- "aria-describedby": (K.length > 0 || Z) && !$ ? I : void 0,
316
- disabled: c
317
- }), (K.length > 0 || Z) && !$ && /* @__PURE__ */ j(d, {
318
- id: I,
319
- className: k("mt-1 block", p, Y.error),
320
- text: ie
321
- })] }) : /* @__PURE__ */ j(T, {
322
- id: z,
308
+ Q ? /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(_, {
309
+ id: `${L}-input`,
323
310
  labelProps: { label: w },
324
311
  placeholder: E,
325
- caption: Z && W.length === 0 ? void 0 : A,
326
- error: Z && W.length === 0 ? oe : void 0,
327
- invalid: Z && W.length === 0,
328
312
  value: W,
313
+ onChange: (e) => de(e ?? ""),
314
+ invalid: (W.length > 0 || Y) && !$,
315
+ "aria-describedby": (W.length > 0 || Y) && !$ ? L : void 0,
316
+ disabled: c
317
+ }), (W.length > 0 || Y) && !$ && /* @__PURE__ */ P(f, {
318
+ id: L,
319
+ className: M("mt-1 block", d, ve.error),
320
+ text: D
321
+ })] }) : /* @__PURE__ */ P(k, {
322
+ id: ce,
323
+ labelProps: { label: C },
324
+ placeholder: ne,
325
+ caption: Y && U.length === 0 ? void 0 : re,
326
+ error: Y && U.length === 0 ? A : void 0,
327
+ invalid: Y && U.length === 0,
328
+ value: U,
329
329
  onChange: (e) => {
330
330
  let t = [];
331
331
  for (let n of e) {
332
332
  let e = n.trim();
333
333
  if (!(e.length === 0 || t.includes(e)) && (t.push(e), t.length >= l)) break;
334
334
  }
335
- G(t);
335
+ ue(t);
336
336
  },
337
337
  disabled: c,
338
- tagClassName: D
338
+ tagClassName: j
339
339
  }),
340
- /* @__PURE__ */ M("div", {
340
+ /* @__PURE__ */ F("div", {
341
341
  className: "mt-auto flex justify-end gap-2 desktop:mt-2",
342
- children: [/* @__PURE__ */ j(f, {
343
- label: se,
342
+ children: [/* @__PURE__ */ P(m, {
343
+ label: I,
344
344
  onClick: s,
345
345
  disabled: c
346
- }), /* @__PURE__ */ j(v, {
347
- label: P,
346
+ }), /* @__PURE__ */ P(b, {
347
+ label: N,
348
348
  onClick: () => {
349
- !xe || V == null || H == null ? ge(!0) : o({
350
- source: V,
349
+ !xe || B == null || H == null ? me(!0) : o({
350
+ source: B,
351
351
  function: H,
352
- targets: be ? [K.trim()] : W
352
+ targets: Q ? [W.trim()] : U
353
353
  });
354
354
  },
355
355
  disabled: c
@@ -357,164 +357,164 @@ var N = /* @__PURE__ */ function(e) {
357
357
  })
358
358
  ]
359
359
  });
360
- }, Z = {
360
+ }, $ = {
361
361
  ruleRow: "_ruleRow_nx0en_1",
362
362
  heading: "_heading_nx0en_5",
363
363
  hint: "_hint_nx0en_9",
364
364
  loading: "_loading_nx0en_13",
365
365
  ruleText: "_ruleText_nx0en_17"
366
- }, ge = 20, _e = (e, t) => e === N.Equal ? t.equal : e === N.Contain ? t.contain : t.regex, ve = ({ rules: e, onRulesChange: r, sourceOptions: s, folderName: u, disabled: d = !1, isLoading: m = !1, hasLoadError: h = !1, maxRules: v = ge, maxTargetsPerRule: x, labels: S = {}, headingClassName: te = "dial-body-semi-text", hintClassName: w = "dial-small-text", loadingClassName: T = "dial-small-text", ruleTextClassName: E = "dial-small-text", ruleSourceClassName: D = "dial-small-semi-text", styles: A = {} }) => {
367
- let ne = {
368
- ...O({
369
- "--par-rule-bg": A.colors?.ruleBackground,
370
- "--par-heading-text": A.colors?.headingText,
371
- "--par-hint-text": A.colors?.hintText,
372
- "--par-loading-text": A.colors?.loadingText,
373
- "--par-rule-text": A.colors?.ruleText
366
+ }, xe = 20, Se = (e, t) => e === R.Equal ? t.equal : e === R.Contain ? t.contain : t.regex, Ce = ({ rules: e, onRulesChange: r, sourceOptions: s, folderName: u, disabled: d = !1, isLoading: f = !1, hasLoadError: p = !1, maxRules: g = xe, maxTargetsPerRule: _, labels: ee = {}, headingClassName: y = "dial-body-semi-text", hintClassName: b = "dial-small-text", loadingClassName: ne = "dial-small-text", ruleTextClassName: re = "dial-small-text", ruleSourceClassName: w = "dial-small-semi-text", styles: T = {} }) => {
367
+ let E = {
368
+ ...ie({
369
+ "--par-rule-bg": T.colors?.ruleBackground,
370
+ "--par-heading-text": T.colors?.headingText,
371
+ "--par-hint-text": T.colors?.hintText,
372
+ "--par-loading-text": T.colors?.loadingText,
373
+ "--par-rule-text": T.colors?.ruleText
374
374
  }),
375
- ...A.cssVars
376
- }, { heading: ae = "Allow access if all match", folderScopeHint: oe = "These rules apply to \"{folder}\". Selecting another folder loads that folder's own rules instead.", noFolderScopeHint: N = "Access rules apply to the destination folder — pick a folder above to set its rules.", rulesWithoutFolderWarning: P = "These rules have no destination yet. Select a folder above to apply them.", maxRulesReachedLabel: se = "Rule limit reached ({max}). Remove a rule to add another.", addRuleLabel: F = "Add rule", clearAllLabel: I = "Clear all", orSeparatorLabel: L = "Or", removeRuleAriaLabelTemplate: R = "Remove rule for {source}: {targets}", equalFunctionLabel: z = "Equal", containFunctionLabel: B = "Contain", regexFunctionLabel: V = "Regex", loadingLabel: ce = "Loading existing rules…", loadErrorLabel: H = "Couldn't load existing rules for this folder. You can still add rules manually.", ruleAddedAnnouncement: U = "Rule added.", ruleRemovedAnnouncement: W = "Rule removed.", rulesClearedAnnouncement: G = "All rules cleared.", rulesLoadedAnnouncement: K = "Existing rules loaded for the selected folder.", editorLabels: le } = S, q = n(), [ue, J] = a(!1), [de, Y] = a(""), fe = i(null), X = i(m);
375
+ ...T.cssVars
376
+ }, { heading: O = "Allow access if all match", folderScopeHint: k = "These rules apply to \"{folder}\". Selecting another folder loads that folder's own rules instead.", noFolderScopeHint: A = "Access rules apply to the destination folder — pick a folder above to set its rules.", rulesWithoutFolderWarning: j = "These rules have no destination yet. Select a folder above to apply them.", maxRulesReachedLabel: N = "Rule limit reached ({max}). Remove a rule to add another.", addRuleLabel: I = "Add rule", clearAllLabel: ae = "Clear all", orSeparatorLabel: se = "Or", removeRuleAriaLabelTemplate: ce = "Remove rule for {source}: {targets}", equalFunctionLabel: R = "Equal", containFunctionLabel: z = "Contain", regexFunctionLabel: B = "Regex", loadingLabel: V = "Loading existing rules…", loadErrorLabel: H = "Couldn't load existing rules for this folder. You can still add rules manually.", ruleAddedAnnouncement: le = "Rule added.", ruleRemovedAnnouncement: U = "Rule removed.", rulesClearedAnnouncement: ue = "All rules cleared.", rulesLoadedAnnouncement: W = "Existing rules loaded for the selected folder.", editorLabels: de } = ee, fe = n(), [G, K] = a(!1), [q, J] = a(""), pe = i(null), Y = i(f);
377
377
  t(() => {
378
- X.current && !m && e.length > 0 && Y(K), X.current = m;
378
+ Y.current && !f && e.length > 0 && J(W), Y.current = f;
379
379
  }, [
380
- m,
380
+ f,
381
381
  e,
382
- K
382
+ W
383
383
  ]);
384
- let pe = () => {
385
- fe.current = document.activeElement, J(!0);
386
- }, me = () => {
387
- J(!1), fe.current?.focus?.();
388
- }, ve = (t) => {
389
- r([...e, t]), Y(U), me();
390
- }, Q = (t) => {
391
- r(e.filter((e, n) => n !== t)), Y(W);
392
- }, ye = () => {
393
- r([]), Y(G);
394
- }, be = {
395
- equal: z,
396
- contain: B,
397
- regex: V
398
- }, $ = e.length >= v, xe = d || $, Se = u != null && u !== "";
399
- return /* @__PURE__ */ M("div", {
384
+ let me = () => {
385
+ pe.current = document.activeElement, K(!0);
386
+ }, he = () => {
387
+ K(!1), pe.current?.focus?.();
388
+ }, ge = (t) => {
389
+ r([...e, t]), J(le), he();
390
+ }, _e = (t) => {
391
+ r(e.filter((e, n) => n !== t)), J(U);
392
+ }, ve = () => {
393
+ r([]), J(ue);
394
+ }, X = {
395
+ equal: R,
396
+ contain: z,
397
+ regex: B
398
+ }, Z = e.length >= g, ye = d || Z, be = u != null && u !== "";
399
+ return /* @__PURE__ */ F("div", {
400
400
  role: "group",
401
- "aria-labelledby": q,
402
- style: ne,
403
- className: k(d && "pointer-events-none opacity-60"),
401
+ "aria-labelledby": fe,
402
+ style: E,
403
+ className: M(d && "pointer-events-none opacity-60"),
404
404
  children: [
405
- /* @__PURE__ */ j(g, {
405
+ /* @__PURE__ */ P(v, {
406
406
  visuallyHidden: !0,
407
- as: _.Span,
408
- children: de
407
+ as: te.Span,
408
+ children: q
409
409
  }),
410
- /* @__PURE__ */ M("div", {
410
+ /* @__PURE__ */ F("div", {
411
411
  className: "mb-1 flex items-center justify-between gap-2",
412
- children: [/* @__PURE__ */ j("div", {
413
- id: q,
414
- className: k(te, Z.heading),
415
- children: ae
416
- }), e.length > 0 && /* @__PURE__ */ j(f, {
412
+ children: [/* @__PURE__ */ P("div", {
413
+ id: fe,
414
+ className: M(y, $.heading),
415
+ children: O
416
+ }), e.length > 0 && /* @__PURE__ */ P(m, {
417
417
  variant: o.Primary,
418
- label: I,
419
- onClick: ye,
418
+ label: ae,
419
+ onClick: ve,
420
420
  disabled: d
421
421
  })]
422
422
  }),
423
- /* @__PURE__ */ j("p", {
424
- className: k("mb-2", w, Z.hint),
425
- children: Se ? oe.replace("{folder}", u) : N
423
+ /* @__PURE__ */ P("p", {
424
+ className: M("mb-2", b, $.hint),
425
+ children: be ? k.replace("{folder}", u) : A
426
426
  }),
427
- e.length > 0 && !Se && /* @__PURE__ */ j("div", {
427
+ e.length > 0 && !be && /* @__PURE__ */ P("div", {
428
428
  className: "mb-2",
429
- children: /* @__PURE__ */ j(ee, {
430
- type: y.SectionMessage,
431
- variant: b.Warning,
432
- message: P
429
+ children: /* @__PURE__ */ P(x, {
430
+ type: S.SectionMessage,
431
+ variant: C.Warning,
432
+ message: j
433
433
  })
434
434
  }),
435
- m && /* @__PURE__ */ M("div", {
436
- className: k("mb-2 flex items-center gap-2", T, Z.loading),
437
- children: [/* @__PURE__ */ j(C, {
435
+ f && /* @__PURE__ */ F("div", {
436
+ className: M("mb-2 flex items-center gap-2", ne, $.loading),
437
+ children: [/* @__PURE__ */ P(D, {
438
438
  size: 16,
439
- ariaLabel: ce
440
- }), /* @__PURE__ */ j("span", { children: ce })]
439
+ ariaLabel: V
440
+ }), /* @__PURE__ */ P("span", { children: V })]
441
441
  }),
442
- h && /* @__PURE__ */ j("div", {
442
+ p && /* @__PURE__ */ P("div", {
443
443
  className: "mb-2",
444
- children: /* @__PURE__ */ j(ee, {
445
- type: y.SectionMessage,
446
- variant: b.Warning,
444
+ children: /* @__PURE__ */ P(x, {
445
+ type: S.SectionMessage,
446
+ variant: C.Warning,
447
447
  message: H
448
448
  })
449
449
  }),
450
- e.length > 0 && /* @__PURE__ */ j("ul", {
450
+ e.length > 0 && /* @__PURE__ */ P("ul", {
451
451
  className: "mb-3 flex flex-col gap-2",
452
452
  children: e.map((e, t) => {
453
- let n = e.targets.join(` ${L} `), r = R.replace("{source}", e.source).replace("{targets}", n);
454
- return /* @__PURE__ */ M("li", {
455
- className: k("flex items-center justify-between gap-2 rounded-lg px-3 py-2", Z.ruleRow),
456
- children: [/* @__PURE__ */ M("span", {
457
- className: k("truncate", E, Z.ruleText),
453
+ let n = e.targets.join(` ${se} `), r = ce.replace("{source}", e.source).replace("{targets}", n);
454
+ return /* @__PURE__ */ F("li", {
455
+ className: M("flex items-center justify-between gap-2 rounded-lg px-3 py-2", $.ruleRow),
456
+ children: [/* @__PURE__ */ F("span", {
457
+ className: M("truncate", re, $.ruleText),
458
458
  children: [
459
- /* @__PURE__ */ j("span", {
460
- className: D,
459
+ /* @__PURE__ */ P("span", {
460
+ className: w,
461
461
  children: e.source
462
462
  }),
463
463
  " ",
464
- _e(e.function, be),
464
+ Se(e.function, X),
465
465
  ": ",
466
466
  n
467
467
  ]
468
- }), /* @__PURE__ */ j(p, {
469
- icon: /* @__PURE__ */ j(ie, {
468
+ }), /* @__PURE__ */ P(h, {
469
+ icon: /* @__PURE__ */ P(oe, {
470
470
  size: c.SM,
471
471
  "aria-hidden": !0,
472
472
  stroke: l
473
473
  }),
474
474
  "aria-label": r,
475
- onClick: () => Q(t),
475
+ onClick: () => _e(t),
476
476
  disabled: d
477
477
  })]
478
478
  }, t);
479
479
  })
480
480
  }),
481
- ue && /* @__PURE__ */ j(he, {
481
+ G && /* @__PURE__ */ P(Q, {
482
482
  sourceOptions: s,
483
- onSave: ve,
484
- onCancel: me,
483
+ onSave: ge,
484
+ onCancel: he,
485
485
  disabled: d,
486
- maxTargets: x,
487
- labels: le,
488
- styles: A.editor
486
+ maxTargets: _,
487
+ labels: de,
488
+ styles: T.editor
489
489
  }),
490
- /* @__PURE__ */ j("div", {
490
+ /* @__PURE__ */ P("div", {
491
491
  className: "flex flex-wrap items-center gap-2",
492
- children: /* @__PURE__ */ j(f, {
493
- label: F,
494
- iconBefore: /* @__PURE__ */ j(re, {
492
+ children: /* @__PURE__ */ P(m, {
493
+ label: I,
494
+ iconBefore: /* @__PURE__ */ P(L, {
495
495
  size: c.SM,
496
496
  "aria-hidden": !0,
497
497
  stroke: l
498
498
  }),
499
- onClick: pe,
500
- disabled: xe
499
+ onClick: me,
500
+ disabled: ye
501
501
  })
502
502
  }),
503
- $ && /* @__PURE__ */ j("p", {
504
- className: k("mt-2", w, Z.hint),
505
- children: se.replace("{max}", String(v))
503
+ Z && /* @__PURE__ */ P("p", {
504
+ className: M("mt-2", b, $.hint),
505
+ children: N.replace("{max}", String(g))
506
506
  })
507
507
  ]
508
508
  });
509
- }, Q = {
509
+ }, we = {
510
510
  currentBadge: "_currentBadge_d0adf_1",
511
511
  sharedCredentialsBadge: "_sharedCredentialsBadge_d0adf_7",
512
512
  version: "_version_d0adf_13",
513
513
  date: "_date_d0adf_17",
514
514
  emptyState: "_emptyState_d0adf_21",
515
515
  stripedRow: "_stripedRow_d0adf_25"
516
- }, ye = ({ entries: e, currentVersion: t, isLoading: n = !1, hasError: r = !1, versionPrefix: i = "Version", currentBadgeLabel: a = "Current", sharedCredentialsLabel: o = "Shared credentials", emptyStateLabel: s = "Not published to this folder yet — this will be the first version here.", loadingLabel: c = "Loading history…", errorLabel: l = "Failed to load publish history.", versionClassName: u = "dial-small-text", dateClassName: d = "dial-small-text", emptyStateClassName: f = "dial-small-text", colors: p }) => {
517
- let m = O({
516
+ }, Te = ({ entries: e, currentVersion: t, isLoading: n = !1, hasError: r = !1, versionPrefix: i = "Version", currentBadgeLabel: a = "Current", sharedCredentialsLabel: o = "Shared credentials", emptyStateLabel: s = "Not published to this folder yet — this will be the first version here.", loadingLabel: c = "Loading history…", errorLabel: l = "Failed to load publish history.", versionClassName: u = "dial-small-text", dateClassName: d = "dial-small-text", emptyStateClassName: f = "dial-small-text", colors: p }) => {
517
+ let m = ie({
518
518
  "--phl-badge-border": p?.currentBadgeBorder,
519
519
  "--phl-badge-bg": p?.currentBadgeBackground,
520
520
  "--phl-badge-text": p?.currentBadgeText,
@@ -525,237 +525,304 @@ var N = /* @__PURE__ */ function(e) {
525
525
  "--phl-date-text": p?.dateText,
526
526
  "--phl-empty-text": p?.emptyStateText,
527
527
  "--phl-striped-bg": p?.stripedBackground
528
- }), h = k(f, Q.emptyState);
528
+ }), h = M(f, we.emptyState);
529
529
  if (n || r || e.length === 0) {
530
530
  let e = s;
531
- return n ? e = c : r && (e = l), /* @__PURE__ */ j(g, {
532
- as: _.P,
531
+ return n ? e = c : r && (e = l), /* @__PURE__ */ P(v, {
532
+ as: te.P,
533
533
  style: m,
534
534
  className: h,
535
535
  children: e
536
536
  });
537
537
  }
538
- return /* @__PURE__ */ j("ul", {
538
+ return /* @__PURE__ */ P("ul", {
539
539
  style: m,
540
- children: e.map((e, n) => /* @__PURE__ */ M("li", {
541
- className: k("flex items-center justify-between gap-2 rounded-lg px-3 py-[11px]", n % 2 == 0 && Q.stripedRow),
542
- children: [/* @__PURE__ */ M("span", {
540
+ children: e.map((e, n) => /* @__PURE__ */ F("li", {
541
+ className: M("flex items-center justify-between gap-2 rounded-lg px-3 py-[11px]", n % 2 == 0 && we.stripedRow),
542
+ children: [/* @__PURE__ */ F("span", {
543
543
  className: "flex min-w-0 items-center gap-2",
544
544
  style: m,
545
545
  children: [
546
- /* @__PURE__ */ M("span", {
547
- className: k(u, Q.version),
546
+ /* @__PURE__ */ F("span", {
547
+ className: M(u, we.version),
548
548
  children: [
549
549
  i,
550
550
  " ",
551
551
  e.version
552
552
  ]
553
553
  }),
554
- e.version === t && /* @__PURE__ */ j(w, {
554
+ e.version === t && /* @__PURE__ */ P(O, {
555
555
  label: a,
556
- className: k("shrink-0 whitespace-nowrap", Q.currentBadge)
556
+ className: M("shrink-0 whitespace-nowrap", we.currentBadge)
557
557
  }),
558
- e.publishCredentials === !0 && /* @__PURE__ */ j(w, {
558
+ e.publishCredentials === !0 && /* @__PURE__ */ P(O, {
559
559
  label: o,
560
- className: k("shrink-0 whitespace-nowrap", Q.sharedCredentialsBadge)
560
+ className: M("shrink-0 whitespace-nowrap", we.sharedCredentialsBadge)
561
561
  })
562
562
  ]
563
- }), /* @__PURE__ */ j("span", {
564
- className: k(d, Q.date),
565
- children: I(e.publishedAt)
563
+ }), /* @__PURE__ */ P("span", {
564
+ className: M(d, we.date),
565
+ children: H(e.publishedAt)
566
566
  })]
567
567
  }, `${e.version}-${n}`))
568
568
  });
569
- }, be = {
569
+ }, Ee = ":", De = (e) => `${Ee}${e}`, Oe = (e) => e?.startsWith(Ee) ? e.slice(1) : void 0, ke = (e) => [De(e.rootKey), ...e.path], Ae = (e) => {
570
+ let [t, ...n] = e, r = Oe(t);
571
+ return r == null ? void 0 : {
572
+ rootKey: r,
573
+ path: n
574
+ };
575
+ }, je = (e, t) => e.map((e) => ({
576
+ ...e,
577
+ path: [t, ...e.path],
578
+ children: e.children ? je(e.children, t) : void 0
579
+ })), Me = (e) => e.map((e) => {
580
+ let t = De(e.key);
581
+ return {
582
+ path: [t],
583
+ name: e.label,
584
+ children: je(fe(e.items), t)
585
+ };
586
+ }), Ne = (e) => e.map((e) => De(e.key)), Pe = (e, t) => {
587
+ let n = /* @__PURE__ */ new Set();
588
+ for (let r of e) {
589
+ let e = De(r.key);
590
+ for (let i of t(r) ?? []) n.add(i ? `${e}/${i}` : e);
591
+ }
592
+ return n;
593
+ }, Fe = (e, t) => {
594
+ let n = new Map(e.map((e) => [e.key, /* @__PURE__ */ new Set()]));
595
+ for (let e of t) {
596
+ let [t, ...r] = e.split("/"), i = Oe(t);
597
+ i != null && r.length !== 0 && n.get(i)?.add(J(r));
598
+ }
599
+ return n;
600
+ }, Ie = {
570
601
  divider: "_divider_1gs31_1",
571
602
  tree: "_tree_1gs31_17"
572
- }, $ = "data-cancel-creating-folder", xe = ({ items: e, selectedPath: n, onSelectedPathChange: o, onCreateFolder: s, searchQuery: u, disabled: d = !1, createFolderLabel: p = "Create new folder", cancelCreatingFolderLabel: m = "Cancel", addSiblingFolderLabel: h = "Add sibling", addChildFolderLabel: g = "Add child", newFolderDefaultName: _ = "New folder", noResultsLabel: v = "No folders match \"{query}\".", emptyFolderNameError: ee = "Folder name cannot be empty.", invalidFolderNameError: y = "Folder name contains invalid characters.", duplicateFolderNameError: b = "A folder with this name already exists.", rootLabel: x = "Organization", expandedPaths: S, onExpandedPathsChange: te, loadingPaths: C, styles: w = {} }) => {
573
- let T = {
574
- ...O({ "--pft-divider": w.colors?.divider }),
575
- ...w.cssVars
576
- }, [E, D] = a(() => new Set(n?.map((e, t) => G(n.slice(0, t + 1))) ?? [])), A = S ?? E, ie = (e) => {
603
+ }, Le = "data-cancel-creating-folder", Re = "", ze = [], Be = ({ items: e = ze, selectedPath: n, onSelectedPathChange: o, onCreateFolder: s, roots: u, destination: d, onDestinationChange: f, onCreateDestinationFolder: p, searchQuery: h, disabled: g = !1, createFolderLabel: _ = "Create new folder", cancelCreatingFolderLabel: ee = "Cancel", addSiblingFolderLabel: v = "Add sibling", addChildFolderLabel: te = "Add child", newFolderDefaultName: y = "New folder", noResultsLabel: b = "No folders match \"{query}\".", emptyFolderNameError: x = "Folder name cannot be empty.", invalidFolderNameError: S = "Folder name contains invalid characters.", duplicateFolderNameError: C = "A folder with this name already exists.", rootLabel: ne = "Organization", expandedPaths: re, onExpandedPathsChange: w, loadingPaths: T, styles: E = {} }) => {
604
+ let D = {
605
+ ...ie({ "--pft-divider": E.colors?.divider }),
606
+ ...E.cssVars
607
+ }, O = u != null, k = r(() => u ? Me(u) : e, [u, e]), A = r(() => u ? Ne(u) : [Re], [u]), j = n;
608
+ O && (j = d ? ke(d) : void 0);
609
+ let N = (e) => {
610
+ O ? f?.(e ? Ae(e) : void 0) : o?.(e);
611
+ }, [I, oe] = a(() => new Set(j?.map((e, t) => J(j.slice(0, t + 1))) ?? [])), R = r(() => u ? /* @__PURE__ */ new Set([...I, ...Pe(u, (e) => e.expandedPaths)]) : void 0, [u, I]) ?? re ?? I, z = r(() => u ? Pe(u, (e) => e.loadingPaths) : T, [u, T]), B = (e) => {
577
612
  let t = new Set(e);
578
- t.delete(""), te ? te(t) : D(t);
579
- }, [N, P] = a(null), [se, F] = a(_), I = i(null), L = i(!1);
613
+ for (let e of A) t.delete(e);
614
+ if (u) {
615
+ oe(t);
616
+ let e = Fe(u, t);
617
+ for (let t of u) t.onExpandedPathsChange?.(e.get(t.key) ?? /* @__PURE__ */ new Set());
618
+ } else w ? w(t) : oe(t);
619
+ }, [V, H] = a(null), [le, U] = a(y), ue = i(null), de = i(!1);
580
620
  t(() => {
581
621
  let e = (e) => {
582
- e.target instanceof Element && e.target.closest(`[${$}]`) && (L.current = !0);
622
+ e.target instanceof Element && e.target.closest(`[${Le}]`) && (de.current = !0);
583
623
  };
584
624
  return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
585
625
  }, []);
586
- let R = u.trim(), z = N != null, V = r(() => B(e, u), [e, u]), H = R.length > 0 && V.length === 0, U = !z && R.length > 0, q = r(() => ce(U ? V : e), [
587
- U,
588
- V,
589
- e
590
- ]), Y = r(() => /* @__PURE__ */ new Set(["", ...W(q)]), [q]), fe = r(() => /* @__PURE__ */ new Set(["", ...U ? Y : A]), [
591
- U,
592
- Y,
593
- A
594
- ]), X = r(() => le(q), [q]), pe = r(() => U && X.length === 0 ? [] : [{
595
- path: "",
596
- name: x,
597
- folderId: "",
598
- nodeType: ae.FOLDER,
599
- items: X
626
+ let G = h.trim(), K = V != null, me = r(() => W(k, h), [k, h]), ve = G.length > 0 && me.length === 0, X = !K && G.length > 0, Z = r(() => {
627
+ let e = X ? me : k;
628
+ return O ? e : fe(e);
629
+ }, [
630
+ X,
631
+ me,
632
+ k,
633
+ O
634
+ ]), ye = r(() => /* @__PURE__ */ new Set([...A, ...q(Z)]), [A, Z]), be = r(() => /* @__PURE__ */ new Set([...A, ...X ? ye : R]), [
635
+ A,
636
+ X,
637
+ ye,
638
+ R
639
+ ]), Q = r(() => Y(Z), [Z]), $ = r(() => X && Q.length === 0 ? [] : O ? Q : [{
640
+ path: Re,
641
+ name: ne,
642
+ folderId: Re,
643
+ nodeType: se.FOLDER,
644
+ items: Q
600
645
  }], [
646
+ Q,
647
+ ne,
601
648
  X,
602
- x,
603
- U
604
- ]), me = N ? G(N) : null, he = {
605
- empty: ee,
606
- invalid: y,
607
- duplicate: b
608
- }, Z = (t) => J(H && ue(R, [], he) == null ? R : _, de(e, t)), ge = (e) => {
609
- P(e), F(Z(e)), I.current = null, L.current = !1;
610
- let t = G(e);
611
- t && ie(new Set(A).add(t));
612
- }, _e = () => ge(n ?? []), ve = (e) => {
613
- let t = K(e.path), n = [{
649
+ O
650
+ ]), xe = V ? J(V) : null, Se = {
651
+ empty: x,
652
+ invalid: S,
653
+ duplicate: C
654
+ }, Ce = (e) => {
655
+ if (!u) return !0;
656
+ let t = Ae(e), n = u.find((e) => e.key === t?.rootKey);
657
+ return n != null && n.canCreateFolders !== !1;
658
+ }, we = (() => {
659
+ if (!u) return j ?? [];
660
+ if (j && Ce(j)) return j;
661
+ let e = u.find((e) => e.canCreateFolders !== !1);
662
+ return e ? ke({
663
+ rootKey: e.key,
664
+ path: []
665
+ }) : void 0;
666
+ })(), Te = (e) => ge(ve && he(G, [], Se) == null ? G : y, _e(k, e)), Ee = (e) => {
667
+ H(e), U(Te(e)), ue.current = null, de.current = !1;
668
+ let t = J(e);
669
+ t && B(new Set(R).add(t));
670
+ }, De = () => {
671
+ we && Ee(we);
672
+ }, Oe = (e) => {
673
+ let t = pe(e.path);
674
+ if (!Ce(t)) return [];
675
+ let n = [{
614
676
  key: "add-child",
615
- label: g,
616
- icon: /* @__PURE__ */ j(ne, {
677
+ label: te,
678
+ icon: /* @__PURE__ */ P(ae, {
617
679
  size: c.SM,
618
680
  "aria-hidden": !0,
619
681
  stroke: l
620
682
  }),
621
- onClick: () => ge(t)
683
+ onClick: () => Ee(t)
622
684
  }];
623
- return e.path !== "" && n.push({
685
+ return A.includes(e.path) || n.push({
624
686
  key: "add-sibling",
625
- label: h,
626
- icon: /* @__PURE__ */ j(re, {
687
+ label: v,
688
+ icon: /* @__PURE__ */ P(L, {
627
689
  size: c.SM,
628
690
  "aria-hidden": !0,
629
691
  stroke: l
630
692
  }),
631
- onClick: () => ge(t.slice(0, -1))
693
+ onClick: () => Ee(t.slice(0, -1))
632
694
  }), n;
633
- }, Q = (t) => {
634
- if (!N) return null;
635
- let n = ue(t, de(e, N), he);
636
- return I.current = n, n;
637
- }, ye = (e) => {
638
- if (!N || L.current) return;
639
- let t = e.trim(), n = I.current;
640
- (Q(e) ?? n) || (s(N, t), o([...N, t])), P(null);
641
- }, xe = () => P(null);
642
- return /* @__PURE__ */ M("div", {
643
- style: T,
644
- className: k(d && "pointer-events-none opacity-60", w.className),
695
+ }, je = (e) => {
696
+ if (!V) return null;
697
+ let t = he(e, _e(k, V), Se);
698
+ return ue.current = t, t;
699
+ }, Be = (e) => {
700
+ if (!V || de.current) return;
701
+ let t = e.trim(), n = ue.current;
702
+ if (!(je(e) ?? n)) {
703
+ let e = u ? Ae(V) : void 0;
704
+ e ? p?.(e.rootKey, e.path, t) : s?.(V, t), N([...V, t]);
705
+ }
706
+ H(null);
707
+ }, Ve = () => H(null);
708
+ return /* @__PURE__ */ F("div", {
709
+ style: D,
710
+ className: M(g && "pointer-events-none opacity-60", E.className),
645
711
  children: [
646
- /* @__PURE__ */ j("div", {
647
- className: k("w-full max-w-full min-w-0", be.tree),
648
- children: /* @__PURE__ */ j(oe, {
649
- items: pe,
712
+ /* @__PURE__ */ P("div", {
713
+ className: M("w-full max-w-full min-w-0", Ie.tree),
714
+ children: /* @__PURE__ */ P(ce, {
715
+ items: $,
650
716
  showFiles: !1,
651
- selectedPath: n == null ? void 0 : G(n),
652
- expandedPaths: fe,
653
- onExpandedPathsChange: ie,
654
- loadingPaths: C,
717
+ selectedPath: j == null ? void 0 : J(j),
718
+ expandedPaths: be,
719
+ onExpandedPathsChange: B,
720
+ loadingPaths: z,
655
721
  onItemClick: (e) => {
656
- o(n != null && G(n) === e.path ? void 0 : K(e.path));
722
+ let t = j != null && J(j) === e.path;
723
+ N(t ? void 0 : pe(e.path));
657
724
  },
658
- getContextMenuItems: ve,
659
- createdFolderPath: me,
660
- newFolderDefaultName: se,
661
- onCreateFolderSave: ye,
662
- onCreateFolderCancel: xe,
663
- onRenameValidate: (e) => Q(e),
664
- emptyStateTitle: U ? v.replace("{query}", R) : void 0
725
+ getContextMenuItems: Oe,
726
+ createdFolderPath: xe,
727
+ newFolderDefaultName: le,
728
+ onCreateFolderSave: Be,
729
+ onCreateFolderCancel: Ve,
730
+ onRenameValidate: (e) => je(e),
731
+ emptyStateTitle: X ? b.replace("{query}", G) : void 0
665
732
  })
666
733
  }),
667
- /* @__PURE__ */ j("div", {
668
- className: k("my-2 h-px", be.divider),
734
+ /* @__PURE__ */ P("div", {
735
+ className: M("my-2 h-px", Ie.divider),
669
736
  "aria-hidden": !0
670
737
  }),
671
- /* @__PURE__ */ M("div", {
738
+ /* @__PURE__ */ F("div", {
672
739
  className: "mb-4 flex flex-wrap items-center gap-2",
673
- children: [/* @__PURE__ */ j(f, {
674
- onClick: _e,
675
- label: p,
676
- iconBefore: /* @__PURE__ */ j(re, {
740
+ children: [/* @__PURE__ */ P(m, {
741
+ onClick: De,
742
+ label: _,
743
+ iconBefore: /* @__PURE__ */ P(L, {
677
744
  size: c.SM,
678
745
  "aria-hidden": !0,
679
746
  stroke: l
680
747
  }),
681
- disabled: d || z
682
- }), z && /* @__PURE__ */ j(f, {
683
- label: m,
684
- onClick: xe,
685
- disabled: d,
686
- [$]: ""
748
+ disabled: g || K || !we
749
+ }), K && /* @__PURE__ */ P(m, {
750
+ label: ee,
751
+ onClick: Ve,
752
+ disabled: g,
753
+ [Le]: ""
687
754
  })]
688
755
  })
689
756
  ]
690
757
  });
691
- }, Se = { panel: "dial-publish-panel-panel" }, Ce = {
758
+ }, Ve = { panel: "dial-publish-panel-panel" }, He = {
692
759
  summaryTitle: "_summaryTitle_tf20a_1",
693
760
  sectionHeading: "_sectionHeading_tf20a_5"
694
- }, we = 200, Te = ({ resource: e, renderSummary: t, folderItems: i, selectedFolderPath: o, onSelectedFolderPathChange: c, onCreateFolder: l, expandedPaths: u, onExpandedPathsChange: d, loadingPaths: f, hasExistingPublicationInFolder: p, hasWriteAccess: m, isSubmitting: g, hasSubmitError: _ = !1, allowReplace: v = !0, author: b, onAuthorChange: S, publishCredentials: te = !1, onPublishCredentialsChange: C, rules: w, onRulesChange: T, ruleSourceOptions: D, isRulesLoading: A = !1, hasRulesLoadError: ne = !1, labels: re = {}, summaryTitleClassName: ie = "dial-body-semi-text", headingClassName: ae = "dial-body-semi-text", calloutFolderNameClassName: oe = "dial-small-paragraph-semi-text", styles: N = {} }) => {
695
- let { colors: F, folderTree: I, accessRules: L } = N, R = {
696
- ...O({
697
- "--pp-summary-title-text": F?.summaryTitleText,
698
- "--pp-heading-text": F?.headingText
761
+ }, Ue = 200, We = ({ resource: e, renderSummary: t, folderItems: i, selectedFolderPath: o, onSelectedFolderPathChange: c, onCreateFolder: l, expandedPaths: u, onExpandedPathsChange: d, loadingPaths: f, hasExistingPublicationInFolder: p, hasWriteAccess: m, isSubmitting: h, hasSubmitError: g = !1, allowReplace: ee = !0, author: v, onAuthorChange: te, publishCredentials: y = !1, onPublishCredentialsChange: b, rules: C, onRulesChange: ne, ruleSourceOptions: re, isRulesLoading: T = !1, hasRulesLoadError: E = !1, labels: D = {}, summaryTitleClassName: O = "dial-body-semi-text", headingClassName: k = "dial-body-semi-text", calloutFolderNameClassName: j = "dial-small-paragraph-semi-text", styles: N = {} }) => {
762
+ let { colors: I, folderTree: ae, accessRules: L } = N, oe = {
763
+ ...ie({
764
+ "--pp-summary-title-text": I?.summaryTitleText,
765
+ "--pp-heading-text": I?.headingText
699
766
  }),
700
767
  ...N.cssVars
701
- }, z = {
702
- border: F?.summaryBorder,
703
- background: F?.summaryBackground,
704
- versionTagBorder: F?.summaryVersionTagBorder,
705
- versionTagBackground: F?.summaryVersionTagBackground,
706
- versionTagText: F?.summaryVersionTagText
707
- }, { folderLabel: B = "Publish to folder", replaceWarning: V = "Version {version} is already published in {folder}. Publishing will replace it.", noAccessError: ce = "You don't have permission to publish to {folder}. Pick another, or ask an owner for access.", submitError: H = "Publishing failed. Please try again.", folderEmptyStateLabel: U, addSiblingFolderLabel: W, addChildFolderLabel: G, cancelCreatingFolderLabel: K, createFolderEmptyNameError: le, createFolderInvalidNameError: q, createFolderDuplicateNameError: ue, rootFolderLabel: J = "Organization", summaryVersionLabel: de, accessRulesLabels: Y, searchPlaceholder: fe, clearSearchAriaLabel: X, authorLabel: pe = "Author", authorPlaceholder: me = "Author name", authorHint: he = "Shown as the publication’s author. Defaults to you — replace it to credit a team instead.", credentialsLabel: Z = "Publish with my credentials", credentialsHint: ge = "Members will use this without signing in themselves. Your credential itself is never shown to them." } = re, [_e, Q] = a(""), ye = n(), be = (e) => {
708
- Q(e ?? "");
709
- }, $ = o != null, Te = r(() => se({
710
- hasSelectedFolder: $,
768
+ }, se = {
769
+ border: I?.summaryBorder,
770
+ background: I?.summaryBackground,
771
+ versionTagBorder: I?.summaryVersionTagBorder,
772
+ versionTagBackground: I?.summaryVersionTagBackground,
773
+ versionTagText: I?.summaryVersionTagText
774
+ }, { folderLabel: ce = "Publish to folder", replaceWarning: R = "Version {version} is already published in {folder}. Publishing will replace it.", noAccessError: V = "You don't have permission to publish to {folder}. Pick another, or ask an owner for access.", submitError: H = "Publishing failed. Please try again.", folderEmptyStateLabel: le, addSiblingFolderLabel: U, addChildFolderLabel: ue, cancelCreatingFolderLabel: W, createFolderEmptyNameError: de, createFolderInvalidNameError: fe, createFolderDuplicateNameError: G, rootFolderLabel: K = "Organization", summaryVersionLabel: q, accessRulesLabels: J, searchPlaceholder: pe, clearSearchAriaLabel: Y, authorLabel: me = "Author", authorPlaceholder: he = "Author name", authorHint: ge = "Shown as the publication’s author. Defaults to you — replace it to credit a team instead.", credentialsLabel: _e = "Publish with my credentials", credentialsHint: ve = "Members will use this without signing in themselves. Your credential itself is never shown to them." } = D, [X, Z] = a(""), ye = n(), be = (e) => {
775
+ Z(e ?? "");
776
+ }, Q = o != null, $ = r(() => B({
777
+ hasSelectedFolder: Q,
711
778
  hasExistingPublicationInFolder: p,
712
779
  hasWriteAccess: m,
713
- isSubmitting: g,
714
- hasSubmitError: _,
715
- allowReplace: v
780
+ isSubmitting: h,
781
+ hasSubmitError: g,
782
+ allowReplace: ee
716
783
  }), [
717
- $,
784
+ Q,
718
785
  p,
719
786
  m,
787
+ h,
720
788
  g,
721
- _,
722
- v
723
- ]), De = $ ? o[o.length - 1] ?? J : "", ke = t ? t() : /* @__PURE__ */ j("span", {
724
- className: k("truncate", ie, Ce.summaryTitle),
789
+ ee
790
+ ]), xe = Q ? o[o.length - 1] ?? K : "", Se = t ? t() : /* @__PURE__ */ P("span", {
791
+ className: M("truncate", O, He.summaryTitle),
725
792
  children: e?.title
726
793
  });
727
- return /* @__PURE__ */ M("div", {
728
- className: k("flex flex-col gap-5", Se.panel),
729
- style: R,
730
- children: [e?.type == null ? /* @__PURE__ */ j(E, {
731
- colors: z,
732
- children: ke
733
- }) : /* @__PURE__ */ j(E, {
794
+ return /* @__PURE__ */ F("div", {
795
+ className: M("flex flex-col gap-5", Ve.panel),
796
+ style: oe,
797
+ children: [e?.type == null ? /* @__PURE__ */ P(A, {
798
+ colors: se,
799
+ children: Se
800
+ }) : /* @__PURE__ */ P(A, {
734
801
  item: {
735
802
  type: e.type,
736
803
  name: e.title,
737
804
  version: e.version ?? "",
738
805
  iconUrl: e.iconUrl
739
806
  },
740
- versionLabel: de,
741
- colors: z
742
- }), /* @__PURE__ */ M("div", { children: [
743
- /* @__PURE__ */ j("div", {
744
- className: k("mb-2", ae, Ce.sectionHeading),
745
- children: B
807
+ versionLabel: q,
808
+ colors: se
809
+ }), /* @__PURE__ */ F("div", { children: [
810
+ /* @__PURE__ */ P("div", {
811
+ className: M("mb-2", k, He.sectionHeading),
812
+ children: ce
746
813
  }),
747
- /* @__PURE__ */ j("div", {
814
+ /* @__PURE__ */ P("div", {
748
815
  role: "search",
749
816
  className: "mb-3",
750
- children: /* @__PURE__ */ j(x, {
751
- value: _e,
817
+ children: /* @__PURE__ */ P(w, {
818
+ value: X,
752
819
  onChange: be,
753
- placeholder: fe,
754
- clearLabel: X,
755
- "aria-label": fe
820
+ placeholder: pe,
821
+ clearLabel: Y,
822
+ "aria-label": pe
756
823
  })
757
824
  }),
758
- /* @__PURE__ */ j(xe, {
825
+ /* @__PURE__ */ P(Be, {
759
826
  items: i,
760
827
  selectedPath: o,
761
828
  onSelectedPathChange: c,
@@ -763,115 +830,115 @@ var N = /* @__PURE__ */ function(e) {
763
830
  expandedPaths: u,
764
831
  onExpandedPathsChange: d,
765
832
  loadingPaths: f,
766
- searchQuery: _e,
767
- disabled: g,
768
- noResultsLabel: U,
769
- addSiblingFolderLabel: W,
770
- addChildFolderLabel: G,
771
- cancelCreatingFolderLabel: K,
772
- emptyFolderNameError: le,
773
- invalidFolderNameError: q,
774
- duplicateFolderNameError: ue,
775
- rootLabel: J,
776
- styles: I
833
+ searchQuery: X,
834
+ disabled: h,
835
+ noResultsLabel: le,
836
+ addSiblingFolderLabel: U,
837
+ addChildFolderLabel: ue,
838
+ cancelCreatingFolderLabel: W,
839
+ emptyFolderNameError: de,
840
+ invalidFolderNameError: fe,
841
+ duplicateFolderNameError: G,
842
+ rootLabel: K,
843
+ styles: ae
777
844
  }),
778
- Te.calloutKind !== P.None && Te.calloutKind !== P.Info && /* @__PURE__ */ j("div", {
845
+ $.calloutKind !== z.None && $.calloutKind !== z.Info && /* @__PURE__ */ P("div", {
779
846
  className: "mt-3",
780
- children: /* @__PURE__ */ j(ee, {
781
- type: y.SectionMessage,
782
- variant: Ee(Te.calloutKind),
783
- message: Oe(Te.calloutKind, {
784
- replaceWarning: V,
785
- noAccessError: ce,
847
+ children: /* @__PURE__ */ P(x, {
848
+ type: S.SectionMessage,
849
+ variant: Ge($.calloutKind),
850
+ message: qe($.calloutKind, {
851
+ replaceWarning: R,
852
+ noAccessError: V,
786
853
  submitError: H,
787
- folderName: De,
854
+ folderName: xe,
788
855
  version: e?.version,
789
- folderNameClassName: oe
856
+ folderNameClassName: j
790
857
  })
791
858
  })
792
859
  }),
793
- /* @__PURE__ */ j("div", {
860
+ /* @__PURE__ */ P("div", {
794
861
  className: "mt-4",
795
- children: /* @__PURE__ */ j(h, {
862
+ children: /* @__PURE__ */ P(_, {
796
863
  id: ye,
797
- labelProps: { label: pe },
798
- placeholder: me,
799
- caption: he,
800
- value: b,
801
- onChange: (e) => S(e ?? ""),
802
- maxLength: we,
803
- disabled: g
864
+ labelProps: { label: me },
865
+ placeholder: he,
866
+ caption: ge,
867
+ value: v,
868
+ onChange: (e) => te(e ?? ""),
869
+ maxLength: Ue,
870
+ disabled: h
804
871
  })
805
872
  }),
806
- C != null && /* @__PURE__ */ j("div", {
873
+ b != null && /* @__PURE__ */ P("div", {
807
874
  className: "mt-4",
808
- children: /* @__PURE__ */ j(s, {
809
- labelProps: { label: Z },
810
- caption: ge,
811
- isSelected: te,
812
- onChange: C,
813
- disabled: g
875
+ children: /* @__PURE__ */ P(s, {
876
+ labelProps: { label: _e },
877
+ caption: ve,
878
+ isSelected: y,
879
+ onChange: b,
880
+ disabled: h
814
881
  })
815
882
  }),
816
- /* @__PURE__ */ j("div", {
883
+ /* @__PURE__ */ P("div", {
817
884
  className: "mt-4",
818
- children: /* @__PURE__ */ j(ve, {
819
- rules: w,
820
- onRulesChange: T,
821
- sourceOptions: D,
822
- folderName: $ ? De : void 0,
823
- disabled: g,
824
- isLoading: A,
825
- hasLoadError: ne,
826
- labels: Y,
885
+ children: /* @__PURE__ */ P(Ce, {
886
+ rules: C,
887
+ onRulesChange: ne,
888
+ sourceOptions: re,
889
+ folderName: Q ? xe : void 0,
890
+ disabled: h,
891
+ isLoading: T,
892
+ hasLoadError: E,
893
+ labels: J,
827
894
  styles: L
828
895
  })
829
896
  })
830
897
  ] })]
831
898
  });
832
- }, Ee = (e) => e === P.ReplaceWarning ? b.Warning : b.Error, De = (e, t, n) => {
899
+ }, Ge = (e) => e === z.ReplaceWarning ? C.Warning : C.Error, Ke = (e, t, n) => {
833
900
  let [r, i, ...a] = e.split("{folder}");
834
- return i === void 0 || a.length > 0 ? e : /* @__PURE__ */ M(A, { children: [
901
+ return i === void 0 || a.length > 0 ? e : /* @__PURE__ */ F(N, { children: [
835
902
  r,
836
- /* @__PURE__ */ j("strong", {
903
+ /* @__PURE__ */ P("strong", {
837
904
  className: n,
838
905
  children: t
839
906
  }),
840
907
  i
841
908
  ] });
842
- }, Oe = (e, t) => e === P.ReplaceWarning ? De(t.replaceWarning.replace("{version}", t.version ?? ""), t.folderName, t.folderNameClassName) : e === P.NoAccess ? De(t.noAccessError, t.folderName, t.folderNameClassName) : t.submitError, ke = { footer: "_footer_dks1v_1" }, Ae = ({ version: e, hasExistingPublicationInFolder: t, allowReplace: n = !0, isSubmitDisabled: r, isSubmitLoading: i, onCancel: a, onSubmit: o, labels: s = {}, colors: l }) => {
843
- let u = O({ "--pf-border": l?.border }), { cancelLabel: d = "Cancel", publishDefaultLabel: p = "Publish", updateLabel: m = "Update version {version}", publishingInProgressLabel: h = "Publishing…" } = s, g = i ? h : n && t && e != null ? m.replace("{version}", e) : p;
844
- return /* @__PURE__ */ M("div", {
909
+ }, qe = (e, t) => e === z.ReplaceWarning ? Ke(t.replaceWarning.replace("{version}", t.version ?? ""), t.folderName, t.folderNameClassName) : e === z.NoAccess ? Ke(t.noAccessError, t.folderName, t.folderNameClassName) : t.submitError, Je = { footer: "_footer_dks1v_1" }, Ye = ({ version: e, hasExistingPublicationInFolder: t, allowReplace: n = !0, isSubmitDisabled: r, isSubmitLoading: i, onCancel: a, onSubmit: o, labels: s = {}, colors: l }) => {
910
+ let u = ie({ "--pf-border": l?.border }), { cancelLabel: d = "Cancel", publishDefaultLabel: f = "Publish", updateLabel: p = "Update version {version}", publishingInProgressLabel: h = "Publishing…" } = s, g = i ? h : n && t && e != null ? p.replace("{version}", e) : f;
911
+ return /* @__PURE__ */ F("div", {
845
912
  style: u,
846
- className: k("flex items-center justify-end gap-2 border-t px-4 py-4 rtl:flex-row-reverse rtl:justify-start desktop:px-3.5", ke.footer),
847
- children: [/* @__PURE__ */ j(f, {
913
+ className: M("flex items-center justify-end gap-2 border-t px-4 py-4 rtl:flex-row-reverse rtl:justify-start desktop:px-3.5", Je.footer),
914
+ children: [/* @__PURE__ */ P(m, {
848
915
  label: d,
849
916
  className: "mobile:flex-1",
850
917
  disabled: i,
851
918
  onClick: a
852
- }), /* @__PURE__ */ j(v, {
919
+ }), /* @__PURE__ */ P(b, {
853
920
  label: g,
854
921
  className: "mobile:flex-1",
855
922
  disabled: r,
856
- iconBefore: i ? /* @__PURE__ */ j(C, { size: c.SM }) : void 0,
923
+ iconBefore: i ? /* @__PURE__ */ P(D, { size: c.SM }) : void 0,
857
924
  onClick: o
858
925
  })]
859
926
  });
860
- }, je = {
927
+ }, Xe = {
861
928
  backdrop: "_backdrop_16jmd_6",
862
929
  panel: "_panel_16jmd_10",
863
930
  divider: "_divider_16jmd_15",
864
931
  content: "_content_16jmd_19",
865
932
  title: "_title_16jmd_24"
866
- }, Me = ({ isOpen: e, resource: n, renderSummary: i, folderItems: o, selectedFolderPath: s, onSelectedFolderPathChange: c, onCreateFolder: l, expandedPaths: u, onExpandedPathsChange: d, loadingPaths: f, hasExistingPublicationInFolder: p, hasWriteAccess: m, isSubmitting: h, hasSubmitError: g = !1, allowReplace: _ = !0, author: v, onAuthorChange: ee, rules: y, onRulesChange: b, ruleSourceOptions: x, isRulesLoading: S = !1, hasRulesLoadError: C = !1, onClose: w, returnFocusRef: T, onSubmit: E, panelLabels: D, panelStyles: A, panelSummaryTitleClassName: ne, panelHeadingClassName: re, panelCalloutFolderNameClassName: ie, footerLabels: ae, labels: oe = {}, titleClassName: N = "dial-body-semi-text", colors: P }) => {
867
- let F = O({
868
- "--spp-backdrop-bg": P?.backdropBackground,
869
- "--spp-panel-bg": P?.panelBackground,
870
- "--spp-panel-border": P?.panelBorder,
871
- "--spp-divider-border": P?.dividerBorder,
872
- "--spp-scrollbar-thumb": P?.scrollbarThumb,
873
- "--spp-title-text": P?.titleText
874
- }), [I, L] = a(null), { title: R = "Publish", ariaLabel: z = "Publish", closeAriaLabel: B = "Close" } = oe, V = r(() => se({
933
+ }, Ze = ({ isOpen: e, resource: n, renderSummary: i, folderItems: o, selectedFolderPath: s, onSelectedFolderPathChange: c, onCreateFolder: l, expandedPaths: u, onExpandedPathsChange: d, loadingPaths: f, hasExistingPublicationInFolder: p, hasWriteAccess: m, isSubmitting: h, hasSubmitError: g = !1, allowReplace: _ = !0, author: ee, onAuthorChange: v, rules: te, onRulesChange: y, ruleSourceOptions: b, isRulesLoading: x = !1, hasRulesLoadError: S = !1, onClose: C, returnFocusRef: ne, onSubmit: re, panelLabels: w, panelStyles: T, panelSummaryTitleClassName: D, panelHeadingClassName: O, panelCalloutFolderNameClassName: k, footerLabels: A, labels: j = {}, titleClassName: N = "dial-body-semi-text", colors: I }) => {
934
+ let ae = ie({
935
+ "--spp-backdrop-bg": I?.backdropBackground,
936
+ "--spp-panel-bg": I?.panelBackground,
937
+ "--spp-panel-border": I?.panelBorder,
938
+ "--spp-divider-border": I?.dividerBorder,
939
+ "--spp-scrollbar-thumb": I?.scrollbarThumb,
940
+ "--spp-title-text": I?.titleText
941
+ }), [L, oe] = a(null), { title: se = "Publish", ariaLabel: ce = "Publish", closeAriaLabel: R = "Close" } = j, z = r(() => B({
875
942
  hasSelectedFolder: s != null,
876
943
  hasExistingPublicationInFolder: p,
877
944
  hasWriteAccess: m,
@@ -887,7 +954,7 @@ var N = /* @__PURE__ */ function(e) {
887
954
  _
888
955
  ]);
889
956
  return t(() => {
890
- let t = I?.closest("[role=\"dialog\"]");
957
+ let t = L?.closest("[role=\"dialog\"]");
891
958
  if (!e || !t) return;
892
959
  let n = () => t.focus({ preventScroll: !0 });
893
960
  n();
@@ -897,36 +964,36 @@ var N = /* @__PURE__ */ function(e) {
897
964
  document.addEventListener("focusin", r);
898
965
  let i = requestAnimationFrame(() => {
899
966
  document.removeEventListener("focusin", r);
900
- }), a = T?.current;
967
+ }), a = ne?.current;
901
968
  return () => {
902
969
  cancelAnimationFrame(i), document.removeEventListener("focusin", r), a?.isConnected && a.focus({ preventScroll: !0 });
903
970
  };
904
971
  }, [
905
972
  e,
906
- I,
907
- T
908
- ]), /* @__PURE__ */ M(te, {
973
+ L,
974
+ ne
975
+ ]), /* @__PURE__ */ F(E, {
909
976
  open: e,
910
- onClose: w,
911
- header: /* @__PURE__ */ j("span", {
912
- className: k("block truncate text-center", N, je.title),
913
- children: R
977
+ onClose: C,
978
+ header: /* @__PURE__ */ P("span", {
979
+ className: M("block truncate text-center", N, Xe.title),
980
+ children: se
914
981
  }),
915
- ariaLabel: z,
916
- closeAriaLabel: B,
982
+ ariaLabel: ce,
983
+ closeAriaLabel: R,
917
984
  closeDisabled: h,
918
- style: F,
919
- overlayStyle: F,
920
- className: k(je.panel, "tablet:w-[540px]! tablet:max-w-[calc(100%-32px)]!"),
921
- overlayClassName: je.backdrop,
922
- headerClassName: k("px-[22px]", je.divider),
985
+ style: ae,
986
+ overlayStyle: ae,
987
+ className: M(Xe.panel, "tablet:w-[540px]! tablet:max-w-[calc(100%-32px)]!"),
988
+ overlayClassName: Xe.backdrop,
989
+ headerClassName: M("px-[22px]", Xe.divider),
923
990
  bodyClassName: "flex flex-col overflow-hidden",
924
- children: [/* @__PURE__ */ j("div", {
925
- ref: L,
926
- className: k("min-h-0 flex-1 overflow-y-auto", je.content),
927
- children: /* @__PURE__ */ j("div", {
991
+ children: [/* @__PURE__ */ P("div", {
992
+ ref: oe,
993
+ className: M("min-h-0 flex-1 overflow-y-auto", Xe.content),
994
+ children: /* @__PURE__ */ P("div", {
928
995
  className: "p-[22px]",
929
- children: /* @__PURE__ */ j(Te, {
996
+ children: /* @__PURE__ */ P(We, {
930
997
  resource: n,
931
998
  renderSummary: i,
932
999
  folderItems: o,
@@ -941,31 +1008,293 @@ var N = /* @__PURE__ */ function(e) {
941
1008
  isSubmitting: h,
942
1009
  hasSubmitError: g,
943
1010
  allowReplace: _,
944
- author: v,
945
- onAuthorChange: ee,
946
- rules: y,
947
- onRulesChange: b,
948
- ruleSourceOptions: x,
949
- isRulesLoading: S,
950
- hasRulesLoadError: C,
951
- labels: D,
952
- styles: A,
953
- summaryTitleClassName: ne,
954
- headingClassName: re,
955
- calloutFolderNameClassName: ie
1011
+ author: ee,
1012
+ onAuthorChange: v,
1013
+ rules: te,
1014
+ onRulesChange: y,
1015
+ ruleSourceOptions: b,
1016
+ isRulesLoading: x,
1017
+ hasRulesLoadError: S,
1018
+ labels: w,
1019
+ styles: T,
1020
+ summaryTitleClassName: D,
1021
+ headingClassName: O,
1022
+ calloutFolderNameClassName: k
956
1023
  })
957
1024
  })
958
- }), /* @__PURE__ */ j(Ae, {
1025
+ }), /* @__PURE__ */ P(Ye, {
959
1026
  version: n?.version,
960
1027
  hasExistingPublicationInFolder: p,
961
1028
  allowReplace: _,
962
- isSubmitDisabled: V.isSubmitDisabled,
963
- isSubmitLoading: V.isSubmitLoading,
964
- onCancel: w,
965
- onSubmit: E,
966
- labels: ae
1029
+ isSubmitDisabled: z.isSubmitDisabled,
1030
+ isSubmitLoading: z.isSubmitLoading,
1031
+ onCancel: C,
1032
+ onSubmit: re,
1033
+ labels: A
1034
+ })]
1035
+ });
1036
+ }, Qe = /* @__PURE__ */ function(e) {
1037
+ return e.Keep = "keep", e.New = "new", e;
1038
+ }({}), $e = /* @__PURE__ */ function(e) {
1039
+ return e.Main = "main", e.ChangeFolder = "change-folder", e;
1040
+ }({}), et = {
1041
+ heading: "_heading_vk731_1",
1042
+ destination: "_destination_vk731_5"
1043
+ }, tt = ({ view: e, resource: t, roots: i, destination: o, onCreateFolder: s, onChangeFolderClick: u, changeFolderButtonRef: h, pendingDestination: g, onPendingDestinationChange: te, version: b, accessRules: x, isSubmitting: S = !1, submitError: C, foldersError: ne, onRetryFolders: T, panelLabels: E = {}, panelStyles: D = {}, headingClassName: O = "dial-body-semi-text", destinationClassName: k = "dial-small-semi-text" }) => {
1044
+ let { saveToFolderHeading: j = "Save to folder", changeFolderLabel: N = "Change", destinationAriaLabel: ae = "Destination folder", versionHeading: L = "Version", keepVersionLabel: oe = "Keep version {version}", saveAsNewVersionLabel: se = "Save as new version", newVersionLabel: ce = "Version", newVersionPlaceholder: R = "Enter new version", searchPlaceholder: z = "Search folders", clearSearchAriaLabel: B = "Clear search", folderEmptyStateLabel: V, createFolderLabel: H, cancelCreatingFolderLabel: le, addSiblingFolderLabel: U, addChildFolderLabel: ue, createFolderEmptyNameError: W, createFolderInvalidNameError: de, createFolderDuplicateNameError: fe, retryLabel: G = "Retry", summaryVersionLabel: K } = E, { colors: q, folderTree: J } = D, pe = {
1045
+ ...ie({
1046
+ "--stf-heading-text": q?.headingText,
1047
+ "--stf-destination-text": q?.destinationText
1048
+ }),
1049
+ ...D.cssVars
1050
+ }, Y = {
1051
+ border: q?.summaryBorder,
1052
+ background: q?.summaryBackground,
1053
+ versionTagBorder: q?.summaryVersionTagBorder,
1054
+ versionTagBackground: q?.summaryVersionTagBackground,
1055
+ versionTagText: q?.summaryVersionTagText
1056
+ }, [me, he] = a(""), ge = n(), _e = r(() => [i.find((e) => e.key === o.rootKey)?.label ?? o.rootKey, ...o.path], [i, o]), ve = i.find((e) => e.key === g?.rootKey), X = g ? g.path[g.path.length - 1] ?? ve?.label : void 0, Z = M(O, et.heading);
1057
+ if (e === $e.ChangeFolder) return /* @__PURE__ */ F("div", {
1058
+ className: "flex flex-col gap-3",
1059
+ style: pe,
1060
+ children: [
1061
+ /* @__PURE__ */ P("div", {
1062
+ role: "search",
1063
+ children: /* @__PURE__ */ P(w, {
1064
+ value: me,
1065
+ onChange: (e) => he(e ?? ""),
1066
+ placeholder: z,
1067
+ clearLabel: B,
1068
+ "aria-label": z
1069
+ })
1070
+ }),
1071
+ /* @__PURE__ */ P(v, {
1072
+ politeness: y.Assertive,
1073
+ children: ne && /* @__PURE__ */ F("div", {
1074
+ className: "flex flex-wrap items-center gap-2",
1075
+ children: [/* @__PURE__ */ P(f, { text: ne }), T && /* @__PURE__ */ P(ee, {
1076
+ label: G,
1077
+ onClick: T
1078
+ })]
1079
+ })
1080
+ }),
1081
+ /* @__PURE__ */ P(Be, {
1082
+ roots: i,
1083
+ destination: g,
1084
+ onDestinationChange: te,
1085
+ onCreateDestinationFolder: s,
1086
+ searchQuery: me,
1087
+ disabled: S,
1088
+ noResultsLabel: V,
1089
+ createFolderLabel: H,
1090
+ cancelCreatingFolderLabel: le,
1091
+ addSiblingFolderLabel: U,
1092
+ addChildFolderLabel: ue,
1093
+ emptyFolderNameError: W,
1094
+ invalidFolderNameError: de,
1095
+ duplicateFolderNameError: fe,
1096
+ styles: J
1097
+ }),
1098
+ x && ve?.hasAccessRules && /* @__PURE__ */ P("div", {
1099
+ className: "mt-1",
1100
+ children: /* @__PURE__ */ P(Ce, {
1101
+ rules: x.rules,
1102
+ onRulesChange: x.onRulesChange,
1103
+ sourceOptions: x.sourceOptions,
1104
+ folderName: X,
1105
+ disabled: S,
1106
+ isLoading: x.isLoading,
1107
+ hasLoadError: x.hasLoadError,
1108
+ labels: x.labels,
1109
+ styles: x.styles
1110
+ })
1111
+ })
1112
+ ]
1113
+ });
1114
+ let ye = b ? [{
1115
+ value: Qe.Keep,
1116
+ label: oe.replace("{version}", b.currentVersion)
1117
+ }, {
1118
+ value: Qe.New,
1119
+ label: se,
1120
+ content: /* @__PURE__ */ P(_, {
1121
+ id: ge,
1122
+ value: b.newVersion,
1123
+ onChange: (e) => b.onNewVersionChange(e ?? ""),
1124
+ onBlur: b.onNewVersionBlur,
1125
+ labelProps: {
1126
+ label: ce,
1127
+ required: !0
1128
+ },
1129
+ placeholder: R,
1130
+ error: b.newVersionError,
1131
+ invalid: !!b.newVersionError,
1132
+ disabled: S
1133
+ })
1134
+ }] : [];
1135
+ return /* @__PURE__ */ F("div", {
1136
+ className: "flex flex-col gap-5",
1137
+ style: pe,
1138
+ children: [
1139
+ t.type == null ? /* @__PURE__ */ P(A, {
1140
+ colors: Y,
1141
+ children: /* @__PURE__ */ P("span", {
1142
+ className: M("truncate", Z),
1143
+ children: t.title
1144
+ })
1145
+ }) : /* @__PURE__ */ P(A, {
1146
+ item: {
1147
+ type: t.type,
1148
+ name: t.title,
1149
+ version: t.version ?? "",
1150
+ iconUrl: t.iconUrl
1151
+ },
1152
+ versionLabel: K,
1153
+ colors: Y
1154
+ }),
1155
+ /* @__PURE__ */ F("section", {
1156
+ className: "flex flex-col gap-2",
1157
+ children: [/* @__PURE__ */ P("h2", {
1158
+ className: Z,
1159
+ children: j
1160
+ }), /* @__PURE__ */ F("div", {
1161
+ className: "flex min-w-0 items-center gap-2",
1162
+ children: [/* @__PURE__ */ P("div", {
1163
+ role: "group",
1164
+ "aria-label": ae,
1165
+ className: "min-w-0 flex-1",
1166
+ children: /* @__PURE__ */ P(p, {
1167
+ name: _e.join(" / "),
1168
+ nameClassName: M(k, et.destination)
1169
+ })
1170
+ }), /* @__PURE__ */ P(m, {
1171
+ ref: h,
1172
+ size: d.Small,
1173
+ label: N,
1174
+ iconBefore: /* @__PURE__ */ P(I, {
1175
+ size: c.SM,
1176
+ stroke: l,
1177
+ "aria-hidden": !0
1178
+ }),
1179
+ disabled: S,
1180
+ onClick: u
1181
+ })]
1182
+ })]
1183
+ }),
1184
+ b && /* @__PURE__ */ F("section", {
1185
+ className: "flex flex-col gap-2",
1186
+ children: [/* @__PURE__ */ P("h2", {
1187
+ className: Z,
1188
+ children: L
1189
+ }), /* @__PURE__ */ P(re, {
1190
+ ariaLabel: L,
1191
+ value: b.versionMode,
1192
+ onChange: (e) => b.onVersionModeChange(e),
1193
+ items: ye,
1194
+ disabled: S
1195
+ })]
1196
+ }),
1197
+ /* @__PURE__ */ P(v, {
1198
+ politeness: y.Assertive,
1199
+ children: C && /* @__PURE__ */ P(f, { text: C })
1200
+ })
1201
+ ]
1202
+ });
1203
+ }, nt = {
1204
+ backdrop: "_backdrop_1ie8s_6",
1205
+ panel: "_panel_1ie8s_10",
1206
+ divider: "_divider_1ie8s_15",
1207
+ footer: "_footer_1ie8s_19",
1208
+ content: "_content_1ie8s_23",
1209
+ title: "_title_1ie8s_28"
1210
+ }, rt = ({ isOpen: e, onClose: n, onSubmit: r, isSubmitDisabled: o = !1, returnFocusRef: s, labels: l = {}, colors: u, titleClassName: d = "dial-body-semi-text", destination: f, onDestinationChange: p, isSubmitting: h = !1, onPendingDestinationChange: g, ..._ }) => {
1211
+ let { title: ee = "Save", changeFolderTitle: v = "Change folder", closeAriaLabel: te = "Close", backAriaLabel: y = "Back", cancelLabel: x = "Cancel", saveLabel: S = "Save", savingLabel: C = "Saving…", selectLabel: re = "Select" } = l, w = ie({
1212
+ "--sstf-backdrop-bg": u?.backdropBackground,
1213
+ "--sstf-panel-bg": u?.panelBackground,
1214
+ "--sstf-panel-border": u?.panelBorder,
1215
+ "--sstf-divider-border": u?.dividerBorder,
1216
+ "--sstf-scrollbar-thumb": u?.scrollbarThumb,
1217
+ "--sstf-title-text": u?.titleText
1218
+ }), [T, O] = a($e.Main), [k, A] = a(f), j = i(null), N = i(null);
1219
+ t(() => {
1220
+ e && O($e.Main);
1221
+ }, [e]);
1222
+ let I = i(T);
1223
+ t(() => {
1224
+ I.current !== T && (I.current = T, T === $e.ChangeFolder ? j.current?.focus({ preventScroll: !0 }) : N.current?.focus({ preventScroll: !0 }));
1225
+ }, [T]);
1226
+ let ae = i(e);
1227
+ t(() => {
1228
+ let t = ae.current;
1229
+ ae.current = e, t && !e && s?.current?.isConnected && s.current.focus({ preventScroll: !0 });
1230
+ }, [e, s]);
1231
+ let L = T === $e.ChangeFolder, oe = (e) => {
1232
+ A(e), g?.(e);
1233
+ }, se = () => {
1234
+ oe(f), O($e.ChangeFolder);
1235
+ }, ce = () => {
1236
+ g?.(f), O($e.Main);
1237
+ }, R = () => {
1238
+ k && p(k), O($e.Main);
1239
+ };
1240
+ return /* @__PURE__ */ F(E, {
1241
+ open: e,
1242
+ onClose: n,
1243
+ header: /* @__PURE__ */ P("span", {
1244
+ ref: j,
1245
+ tabIndex: -1,
1246
+ className: M("block truncate outline-none", d, nt.title),
1247
+ children: L ? v : ee
1248
+ }),
1249
+ ariaLabel: ee,
1250
+ onBack: L ? ce : void 0,
1251
+ backAriaLabel: y,
1252
+ backDisabled: h,
1253
+ closeAriaLabel: te,
1254
+ closeDisabled: h,
1255
+ style: w,
1256
+ overlayStyle: w,
1257
+ className: M(nt.panel, "tablet:w-[540px]! tablet:max-w-[calc(100%-32px)]!"),
1258
+ overlayClassName: nt.backdrop,
1259
+ headerClassName: M("px-[22px]", nt.divider),
1260
+ bodyClassName: "flex flex-col overflow-hidden",
1261
+ children: [/* @__PURE__ */ P("div", {
1262
+ className: M("min-h-0 flex-1 overflow-y-auto p-[22px]", nt.content),
1263
+ children: /* @__PURE__ */ P(tt, {
1264
+ ..._,
1265
+ view: T,
1266
+ destination: f,
1267
+ onDestinationChange: p,
1268
+ isSubmitting: h,
1269
+ onChangeFolderClick: se,
1270
+ changeFolderButtonRef: N,
1271
+ pendingDestination: k,
1272
+ onPendingDestinationChange: oe
1273
+ })
1274
+ }), /* @__PURE__ */ F("div", {
1275
+ className: M("flex items-center justify-end gap-2 border-t px-4 py-4 desktop:px-3.5", nt.footer),
1276
+ children: [/* @__PURE__ */ P(m, {
1277
+ label: x,
1278
+ className: "mobile:flex-1",
1279
+ disabled: h,
1280
+ onClick: L ? ce : n
1281
+ }), L ? /* @__PURE__ */ P(b, {
1282
+ label: re,
1283
+ className: "mobile:flex-1",
1284
+ disabled: k == null,
1285
+ onClick: R
1286
+ }) : /* @__PURE__ */ P(ne, {
1287
+ label: h ? C : S,
1288
+ className: "mobile:flex-1",
1289
+ disabled: o || h,
1290
+ iconBefore: h ? /* @__PURE__ */ P("span", {
1291
+ "aria-hidden": !0,
1292
+ children: /* @__PURE__ */ P(D, { size: c.SM })
1293
+ }) : void 0,
1294
+ onClick: r
1295
+ })]
967
1296
  })]
968
1297
  });
969
1298
  };
970
1299
  //#endregion
971
- export { Se as PUBLISH_PANEL_CLASS, N as PublicationRuleFunction, he as PublishAccessRuleEditor, ve as PublishAccessRules, P as PublishCalloutKind, xe as PublishFoldersTree, Ae as PublishFooter, ye as PublishHistoryList, Te as PublishPanel, Me as StandalonePublishPanel, W as collectFolderKeys, se as derivePublishState, B as filterFolderTree, I as formatPublishedDate, K as fromFolderPathKey, de as getSiblingFolderNames, J as getUniqueFolderName, U as mergeFolderPaths, ce as sortFolderTree, le as toDialFileTree, G as toFolderPathKey, z as usePublishFlow, ue as validateFolderName };
1300
+ export { Ve as PUBLISH_PANEL_CLASS, R as PublicationRuleFunction, Q as PublishAccessRuleEditor, Ce as PublishAccessRules, z as PublishCalloutKind, Be as PublishFoldersTree, Ye as PublishFooter, Te as PublishHistoryList, We as PublishPanel, tt as SaveToFolderPanel, $e as SaveToFolderView, Qe as SaveVersionMode, Ze as StandalonePublishPanel, rt as StandaloneSaveToFolderPanel, q as collectFolderKeys, B as derivePublishState, W as filterFolderTree, H as formatPublishedDate, pe as fromFolderPathKey, _e as getSiblingFolderNames, ge as getUniqueFolderName, K as mergeFolderPaths, fe as sortFolderTree, Y as toDialFileTree, J as toFolderPathKey, ue as usePublishFlow, he as validateFolderName };