@nivaro/react 0.3.62 → 0.3.63

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,22 +1,24 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
2
  import { useQueryClient as j, useQuery as G } from "@tanstack/react-query";
3
- import { Plus as I, X as A, GripVertical as W, ArrowUp as O, ArrowDown as B, Trash2 as H } from "lucide-react";
3
+ import { Plus as I, X as A, GripVertical as W, ArrowUp as B, ArrowDown as O, Trash2 as H } from "lucide-react";
4
4
  import { useState as b, useId as X } from "react";
5
5
  import { toast as T } from "sonner";
6
- import { useNivaroClient as Q } from "../../../context.js";
6
+ import { useNivaroClient as K } from "../../../context.js";
7
7
  import { get as J } from "../../../lib/commands.js";
8
8
  import { userErrorMessage as z } from "../../../lib/safe-error.js";
9
- import { Button as g } from "../../ui/button.js";
10
- import { Input as Y } from "../../ui/input.js";
9
+ import { cn as Y } from "../../../lib/utils.js";
10
+ import { ConfirmButton as Z } from "../../profile/primitives.js";
11
+ import { Button as f, buttonVariants as ee } from "../../ui/button.js";
12
+ import { Input as te } from "../../ui/input.js";
11
13
  import { Label as C } from "../../ui/label.js";
12
14
  import { Switch as F } from "../../ui/switch.js";
13
- import { Textarea as Z } from "../../ui/textarea.js";
14
- import { useLearningPaths as ee, learningPathApi as te, helpVideoKeys as $, useHelpVideoLibrary as ae } from "../api.js";
15
- import { PickerCombo as M, RemovableChip as re } from "../editor/PickerCombo.js";
16
- import { formatDuration as K } from "../viewer/format.js";
15
+ import { Textarea as ae } from "../../ui/textarea.js";
16
+ import { useLearningPaths as re, learningPathApi as se, helpVideoKeys as $, useHelpVideoLibrary as ie } from "../api.js";
17
+ import { PickerCombo as M, RemovableChip as oe } from "../editor/PickerCombo.js";
18
+ import { formatDuration as V } from "../viewer/format.js";
17
19
  import { moveItem as P } from "../viewer/paths.js";
18
20
  const q = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan motion-reduce:transition-none";
19
- function ie(a) {
21
+ function de(a) {
20
22
  return {
21
23
  title: (a == null ? void 0 : a.title) ?? "",
22
24
  description: (a == null ? void 0 : a.description) ?? "",
@@ -26,13 +28,13 @@ function ie(a) {
26
28
  roles: (a == null ? void 0 : a.roles.map((c) => ({ role_id: c.role_id, required: c.required }))) ?? []
27
29
  };
28
30
  }
29
- function _e() {
30
- var i, w;
31
- const a = Q(), c = j(), m = ee(), [d, v] = b(null), u = d && d !== "new" ? ((i = m.data) == null ? void 0 : i.find((o) => o.id === d)) ?? null : null;
32
- return /* @__PURE__ */ s("div", { className: "space-y-4", "data-hv-paths": !0, children: [
33
- /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-3", children: [
31
+ function Pe() {
32
+ var s, N;
33
+ const a = K(), c = j(), m = re(), [d, g] = b(null), u = d && d !== "new" ? ((s = m.data) == null ? void 0 : s.find((o) => o.id === d)) ?? null : null;
34
+ return /* @__PURE__ */ i("div", { className: "space-y-4", "data-hv-paths": !0, children: [
35
+ /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-3", children: [
34
36
  /* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", children: 'An ordered list of videos for a role — "Getting started as a Workflow Creator". People see it on My Work with their progress and a Continue button; a required path joins their required list until every video in it is watched.' }),
35
- /* @__PURE__ */ s(g, { size: "sm", className: "ml-auto", onClick: () => v("new"), "data-hv-path-new": !0, children: [
37
+ /* @__PURE__ */ i(f, { size: "sm", className: "ml-auto", onClick: () => g("new"), "data-hv-path-new": !0, children: [
36
38
  /* @__PURE__ */ t(I, { className: "h-4 w-4" }),
37
39
  " New path"
38
40
  ] })
@@ -40,14 +42,14 @@ function _e() {
40
42
  m.isLoading && /* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", children: "Loading…" }),
41
43
  m.isError && /* @__PURE__ */ t("p", { role: "alert", className: "text-[13px] text-rose-700 dark:text-rose-300", children: "Paths could not be loaded. Try again in a moment." }),
42
44
  m.data && m.data.length === 0 && d !== "new" && /* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", "data-hv-paths-empty": !0, children: "No learning paths yet." }),
43
- !!((w = m.data) != null && w.length) && /* @__PURE__ */ t("ul", { className: "divide-y divide-border rounded-lg border border-border bg-card", children: m.data.map((o) => /* @__PURE__ */ s(
45
+ !!((N = m.data) != null && N.length) && /* @__PURE__ */ t("ul", { className: "divide-y divide-border rounded-lg border border-border bg-card", children: m.data.map((o) => /* @__PURE__ */ i(
44
46
  "li",
45
47
  {
46
48
  className: "flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2",
47
49
  "data-hv-path-row": o.id,
48
50
  children: [
49
51
  /* @__PURE__ */ t("span", { className: "min-w-[10rem] flex-1 truncate text-[13px] font-medium", children: o.title || "Untitled path" }),
50
- /* @__PURE__ */ s("span", { className: "text-[12px] text-muted-foreground", children: [
52
+ /* @__PURE__ */ i("span", { className: "text-[12px] text-muted-foreground", children: [
51
53
  o.status === "published" ? "Published" : "Draft",
52
54
  " · ",
53
55
  o.items.length,
@@ -60,11 +62,11 @@ function _e() {
60
62
  o.new_user ? " · New users" : ""
61
63
  ] }),
62
64
  /* @__PURE__ */ t(
63
- g,
65
+ f,
64
66
  {
65
67
  size: "sm",
66
68
  variant: "ghost",
67
- onClick: () => v(o.id),
69
+ onClick: () => g(o.id),
68
70
  "data-hv-path-edit": o.id,
69
71
  children: "Edit"
70
72
  }
@@ -74,30 +76,30 @@ function _e() {
74
76
  o.id
75
77
  )) }),
76
78
  d && /* @__PURE__ */ t(
77
- se,
79
+ le,
78
80
  {
79
81
  path: u,
80
- onClose: () => v(null),
82
+ onClose: () => g(null),
81
83
  onSaved: (o) => {
82
- c.invalidateQueries({ queryKey: $.paths }), c.invalidateQueries({ queryKey: $.myPaths }), c.invalidateQueries({ queryKey: $.required }), v(o ? o.id : null);
84
+ c.invalidateQueries({ queryKey: $.paths }), c.invalidateQueries({ queryKey: $.myPaths }), c.invalidateQueries({ queryKey: $.required }), g(o ? o.id : null);
83
85
  },
84
- api: te(a)
86
+ api: se(a)
85
87
  },
86
88
  d
87
89
  )
88
90
  ] });
89
91
  }
90
- function se({
92
+ function le({
91
93
  path: a,
92
94
  onClose: c,
93
95
  onSaved: m,
94
96
  api: d
95
97
  }) {
96
98
  var E, R;
97
- const v = Q(), u = X(), [i, w] = b(() => ie(a)), [o, N] = b(!1), [D, y] = b(null), [k, L] = b(null), f = G({
99
+ const g = K(), u = X(), [s, N] = b(() => de(a)), [o, w] = b(!1), [D, y] = b(null), [k, L] = b(null), v = G({
98
100
  queryKey: ["chat-roles"],
99
- queryFn: async () => (await v.request(J("/chat/roles"))).data
100
- }), h = ae({ status: "published" }), x = /* @__PURE__ */ new Map();
101
+ queryFn: async () => (await g.request(J("/chat/roles"))).data
102
+ }), h = ie({ status: "published" }), x = /* @__PURE__ */ new Map();
101
103
  for (const e of ((E = h.data) == null ? void 0 : E.data) ?? []) x.set(e.id.toLowerCase(), e);
102
104
  for (const e of (a == null ? void 0 : a.items) ?? [])
103
105
  x.has(e.video_id.toLowerCase()) || x.set(e.video_id.toLowerCase(), e);
@@ -106,58 +108,58 @@ function se({
106
108
  return ((r = x.get(e.toLowerCase())) == null ? void 0 : r.title) ?? "Unknown video";
107
109
  }, U = (e) => {
108
110
  var r, n;
109
- return ((n = (r = f.data) == null ? void 0 : r.find((p) => p.id.toUpperCase() === e.toUpperCase())) == null ? void 0 : n.name) ?? (f.isLoading ? "Loading…" : "Unknown role");
110
- }, l = (e) => w((r) => ({ ...r, ...e })), S = async () => {
111
- const e = i.title.trim();
111
+ return ((n = (r = v.data) == null ? void 0 : r.find((p) => p.id.toUpperCase() === e.toUpperCase())) == null ? void 0 : n.name) ?? (v.isLoading ? "Loading…" : "Unknown role");
112
+ }, l = (e) => N((r) => ({ ...r, ...e })), Q = async () => {
113
+ const e = s.title.trim();
112
114
  if (!e) {
113
115
  y("Give the path a title.");
114
116
  return;
115
117
  }
116
- N(!0), y(null);
118
+ w(!0), y(null);
117
119
  try {
118
120
  const r = {
119
121
  title: e,
120
- description: i.description.trim() || null,
121
- status: i.status,
122
- new_user: i.new_user
122
+ description: s.description.trim() || null,
123
+ status: s.status,
124
+ new_user: s.new_user
123
125
  }, n = a ? await d.update(a.id, r) : await d.create(r);
124
- await d.setItems(n.id, i.video_ids);
125
- const p = await d.setRoles(n.id, i.roles);
126
+ await d.setItems(n.id, s.video_ids);
127
+ const p = await d.setRoles(n.id, s.roles);
126
128
  T.success(a ? `"${e}" saved` : `"${e}" created`), m(p);
127
129
  } catch (r) {
128
130
  y(`The path could not be saved. ${z(r, "")}`);
129
131
  } finally {
130
- N(!1);
132
+ w(!1);
131
133
  }
132
- }, V = async () => {
133
- if (a && window.confirm(`Delete "${a.title || "Untitled path"}"? Nobody's progress is lost.`)) {
134
- N(!0);
134
+ }, S = async () => {
135
+ if (a) {
136
+ w(!0);
135
137
  try {
136
138
  await d.remove(a.id), T.success(`"${a.title}" deleted`), m(null);
137
139
  } catch (e) {
138
- y(`The path could not be deleted. ${z(e, "")}`), N(!1);
140
+ y(`The path could not be deleted. ${z(e, "")}`), w(!1);
139
141
  }
140
142
  }
141
143
  };
142
- return /* @__PURE__ */ s(
144
+ return /* @__PURE__ */ i(
143
145
  "section",
144
146
  {
145
147
  className: "space-y-4 rounded-lg border border-border bg-card p-4",
146
148
  "aria-label": a ? `Edit ${a.title}` : "New learning path",
147
149
  "data-hv-path-editor": (a == null ? void 0 : a.id) ?? "new",
148
150
  children: [
149
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
151
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
150
152
  /* @__PURE__ */ t("h2", { className: "text-[14px] font-semibold", children: a ? "Edit path" : "New path" }),
151
- /* @__PURE__ */ t(g, { size: "sm", variant: "ghost", className: "ml-auto", onClick: c, "aria-label": "Close", children: /* @__PURE__ */ t(A, { className: "h-4 w-4" }) })
153
+ /* @__PURE__ */ t(f, { size: "sm", variant: "ghost", className: "ml-auto", onClick: c, "aria-label": "Close", children: /* @__PURE__ */ t(A, { className: "h-4 w-4" }) })
152
154
  ] }),
153
- /* @__PURE__ */ s("div", { className: "grid gap-3 sm:grid-cols-2", children: [
154
- /* @__PURE__ */ s("div", { className: "space-y-1", children: [
155
+ /* @__PURE__ */ i("div", { className: "grid gap-3 sm:grid-cols-2", children: [
156
+ /* @__PURE__ */ i("div", { className: "space-y-1", children: [
155
157
  /* @__PURE__ */ t(C, { htmlFor: `${u}-title`, className: "text-[12px]", children: "Title" }),
156
158
  /* @__PURE__ */ t(
157
- Y,
159
+ te,
158
160
  {
159
161
  id: `${u}-title`,
160
- value: i.title,
162
+ value: s.title,
161
163
  maxLength: 200,
162
164
  onChange: (e) => l({ title: e.target.value }),
163
165
  placeholder: "Getting started as a Workflow Creator",
@@ -166,13 +168,13 @@ function se({
166
168
  }
167
169
  )
168
170
  ] }),
169
- /* @__PURE__ */ s("div", { className: "space-y-1", children: [
171
+ /* @__PURE__ */ i("div", { className: "space-y-1", children: [
170
172
  /* @__PURE__ */ t(C, { htmlFor: `${u}-desc`, className: "text-[12px]", children: "Description" }),
171
173
  /* @__PURE__ */ t(
172
- Z,
174
+ ae,
173
175
  {
174
176
  id: `${u}-desc`,
175
- value: i.description,
177
+ value: s.description,
176
178
  maxLength: 2e3,
177
179
  rows: 2,
178
180
  onChange: (e) => l({ description: e.target.value }),
@@ -181,46 +183,46 @@ function se({
181
183
  )
182
184
  ] })
183
185
  ] }),
184
- /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-5", children: [
185
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
186
+ /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-5", children: [
187
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
186
188
  /* @__PURE__ */ t(
187
189
  F,
188
190
  {
189
191
  id: `${u}-published`,
190
- checked: i.status === "published",
192
+ checked: s.status === "published",
191
193
  onCheckedChange: (e) => l({ status: e ? "published" : "draft" }),
192
- "data-hv-path-published": i.status === "published" ? "on" : "off"
194
+ "data-hv-path-published": s.status === "published" ? "on" : "off"
193
195
  }
194
196
  ),
195
197
  /* @__PURE__ */ t(C, { htmlFor: `${u}-published`, className: "text-[13px] font-normal", children: "Published" })
196
198
  ] }),
197
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
199
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
198
200
  /* @__PURE__ */ t(
199
201
  F,
200
202
  {
201
203
  id: `${u}-new-user`,
202
- checked: i.new_user,
204
+ checked: s.new_user,
203
205
  onCheckedChange: (e) => l({ new_user: e }),
204
- "data-hv-path-new-user": i.new_user ? "on" : "off"
206
+ "data-hv-path-new-user": s.new_user ? "on" : "off"
205
207
  }
206
208
  ),
207
209
  /* @__PURE__ */ t(C, { htmlFor: `${u}-new-user`, className: "text-[13px] font-normal", children: "New User path" }),
208
210
  /* @__PURE__ */ t("span", { className: "text-[12px] text-muted-foreground", children: "shows to every account in its first week, whatever its role" })
209
211
  ] })
210
212
  ] }),
211
- /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
213
+ /* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
212
214
  /* @__PURE__ */ t("p", { className: "text-[12px] font-medium", children: "Videos, in order" }),
213
- i.video_ids.length === 0 && /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "No videos yet — add published videos below." }),
214
- /* @__PURE__ */ t("ol", { className: "space-y-1", "data-hv-path-items": !0, children: i.video_ids.map((e, r) => {
215
+ s.video_ids.length === 0 && /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "No videos yet — add published videos below." }),
216
+ /* @__PURE__ */ t("ol", { className: "space-y-1", "data-hv-path-items": !0, children: s.video_ids.map((e, r) => {
215
217
  var n;
216
- return /* @__PURE__ */ s(
218
+ return /* @__PURE__ */ i(
217
219
  "li",
218
220
  {
219
221
  draggable: !0,
220
222
  onDragStart: () => L(r),
221
223
  onDragOver: (p) => p.preventDefault(),
222
224
  onDrop: () => {
223
- k !== null && l({ video_ids: P(i.video_ids, k, r) }), L(null);
225
+ k !== null && l({ video_ids: P(s.video_ids, k, r) }), L(null);
224
226
  },
225
227
  onDragEnd: () => L(null),
226
228
  className: `flex items-center gap-2 rounded-md border border-border bg-background px-2 py-1 text-[13px] ${k === r ? "opacity-60" : ""}`,
@@ -233,22 +235,22 @@ function se({
233
235
  "aria-hidden": !0
234
236
  }
235
237
  ),
236
- /* @__PURE__ */ s("span", { className: "w-5 shrink-0 text-right tabular-nums text-muted-foreground", children: [
238
+ /* @__PURE__ */ i("span", { className: "w-5 shrink-0 text-right tabular-nums text-muted-foreground", children: [
237
239
  r + 1,
238
240
  "."
239
241
  ] }),
240
242
  /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: _(e) }),
241
- /* @__PURE__ */ t("span", { className: "shrink-0 text-[12px] text-muted-foreground", children: K(((n = x.get(e.toLowerCase())) == null ? void 0 : n.duration_ms) ?? null) }),
243
+ /* @__PURE__ */ t("span", { className: "shrink-0 text-[12px] text-muted-foreground", children: V(((n = x.get(e.toLowerCase())) == null ? void 0 : n.duration_ms) ?? null) }),
242
244
  /* @__PURE__ */ t(
243
245
  "button",
244
246
  {
245
247
  type: "button",
246
248
  className: `rounded p-0.5 text-muted-foreground hover:text-foreground disabled:opacity-40 ${q}`,
247
- onClick: () => l({ video_ids: P(i.video_ids, r, r - 1) }),
249
+ onClick: () => l({ video_ids: P(s.video_ids, r, r - 1) }),
248
250
  disabled: r === 0,
249
251
  "aria-label": `Move ${_(e)} up`,
250
252
  "data-hv-path-up": e,
251
- children: /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" })
253
+ children: /* @__PURE__ */ t(B, { className: "h-3.5 w-3.5" })
252
254
  }
253
255
  ),
254
256
  /* @__PURE__ */ t(
@@ -256,11 +258,11 @@ function se({
256
258
  {
257
259
  type: "button",
258
260
  className: `rounded p-0.5 text-muted-foreground hover:text-foreground disabled:opacity-40 ${q}`,
259
- onClick: () => l({ video_ids: P(i.video_ids, r, r + 1) }),
260
- disabled: r === i.video_ids.length - 1,
261
+ onClick: () => l({ video_ids: P(s.video_ids, r, r + 1) }),
262
+ disabled: r === s.video_ids.length - 1,
261
263
  "aria-label": `Move ${_(e)} down`,
262
264
  "data-hv-path-down": e,
263
- children: /* @__PURE__ */ t(B, { className: "h-3.5 w-3.5" })
265
+ children: /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" })
264
266
  }
265
267
  ),
266
268
  /* @__PURE__ */ t(
@@ -268,7 +270,7 @@ function se({
268
270
  {
269
271
  type: "button",
270
272
  className: `rounded p-0.5 text-muted-foreground hover:text-foreground ${q}`,
271
- onClick: () => l({ video_ids: i.video_ids.filter((p) => p !== e) }),
273
+ onClick: () => l({ video_ids: s.video_ids.filter((p) => p !== e) }),
272
274
  "aria-label": `Remove ${_(e)}`,
273
275
  "data-hv-path-remove": e,
274
276
  children: /* @__PURE__ */ t(A, { className: "h-3.5 w-3.5" })
@@ -279,23 +281,23 @@ function se({
279
281
  e
280
282
  );
281
283
  }) }),
282
- /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2", children: [
284
+ /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
283
285
  /* @__PURE__ */ t(
284
286
  M,
285
287
  {
286
288
  ariaLabel: "Add a video",
287
289
  placeholder: "Add a video",
288
290
  emptyText: h.isLoading ? "Loading…" : h.isError ? "Videos could not be loaded." : "Nothing matches.",
289
- options: (((R = h.data) == null ? void 0 : R.data) ?? []).filter((e) => !i.video_ids.some((r) => r.toLowerCase() === e.id.toLowerCase())).map((e) => ({
291
+ options: (((R = h.data) == null ? void 0 : R.data) ?? []).filter((e) => !s.video_ids.some((r) => r.toLowerCase() === e.id.toLowerCase())).map((e) => ({
290
292
  value: e.id,
291
293
  label: e.title || "Untitled video",
292
- hint: K(e.duration_ms)
294
+ hint: V(e.duration_ms)
293
295
  })),
294
- onPick: (e) => l({ video_ids: [...i.video_ids, e] })
296
+ onPick: (e) => l({ video_ids: [...s.video_ids, e] })
295
297
  }
296
298
  ),
297
299
  h.hasNextPage && /* @__PURE__ */ t(
298
- g,
300
+ f,
299
301
  {
300
302
  size: "sm",
301
303
  variant: "ghost",
@@ -306,26 +308,26 @@ function se({
306
308
  )
307
309
  ] })
308
310
  ] }),
309
- /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
311
+ /* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
310
312
  /* @__PURE__ */ t("p", { className: "text-[12px] font-medium", children: "Roles" }),
311
313
  /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "People in these roles get the path on My Work. Required: it joins their required list and they are told when it is published." }),
312
- /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-1.5", "data-hv-path-roles": !0, children: [
313
- i.roles.map((e) => /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1", children: /* @__PURE__ */ s(
314
- re,
314
+ /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-1.5", "data-hv-path-roles": !0, children: [
315
+ s.roles.map((e) => /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1", children: /* @__PURE__ */ i(
316
+ oe,
315
317
  {
316
318
  removeLabel: `Remove ${U(e.role_id)}`,
317
- onRemove: () => l({ roles: i.roles.filter((r) => r.role_id !== e.role_id) }),
319
+ onRemove: () => l({ roles: s.roles.filter((r) => r.role_id !== e.role_id) }),
318
320
  "data-hv-path-role": e.role_id,
319
321
  children: [
320
322
  U(e.role_id),
321
- /* @__PURE__ */ s("label", { className: "ml-1 inline-flex items-center gap-1 text-[11px] text-muted-foreground", children: [
323
+ /* @__PURE__ */ i("label", { className: "ml-1 inline-flex items-center gap-1 text-[11px] text-muted-foreground", children: [
322
324
  /* @__PURE__ */ t(
323
325
  "input",
324
326
  {
325
327
  type: "checkbox",
326
328
  checked: e.required,
327
329
  onChange: (r) => l({
328
- roles: i.roles.map(
330
+ roles: s.roles.map(
329
331
  (n) => n.role_id === e.role_id ? { ...n, required: r.target.checked } : n
330
332
  )
331
333
  }),
@@ -342,9 +344,9 @@ function se({
342
344
  {
343
345
  ariaLabel: "Add a role",
344
346
  placeholder: "Add a role",
345
- emptyText: f.isLoading ? "Loading…" : f.isError ? "Roles could not be loaded." : "Nothing matches.",
346
- options: (f.data ?? []).filter((e) => !i.roles.some((r) => r.role_id.toUpperCase() === e.id.toUpperCase())).map((e) => ({ value: e.id, label: e.name })),
347
- onPick: (e) => l({ roles: [...i.roles, { role_id: e, required: !1 }] })
347
+ emptyText: v.isLoading ? "Loading…" : v.isError ? "Roles could not be loaded." : "Nothing matches.",
348
+ options: (v.data ?? []).filter((e) => !s.roles.some((r) => r.role_id.toUpperCase() === e.id.toUpperCase())).map((e) => ({ value: e.id, label: e.name })),
349
+ onPick: (e) => l({ roles: [...s.roles, { role_id: e, required: !1 }] })
348
350
  }
349
351
  )
350
352
  ] })
@@ -358,18 +360,20 @@ function se({
358
360
  children: D
359
361
  }
360
362
  ),
361
- /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2", children: [
362
- /* @__PURE__ */ t(g, { size: "sm", onClick: () => void S(), disabled: o, "data-hv-path-save": !0, children: o ? "Saving…" : a ? "Save" : "Create path" }),
363
- /* @__PURE__ */ t(g, { size: "sm", variant: "outline", onClick: c, disabled: o, children: "Cancel" }),
364
- a && /* @__PURE__ */ s(
365
- g,
363
+ /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
364
+ /* @__PURE__ */ t(f, { size: "sm", onClick: () => void Q(), disabled: o, "data-hv-path-save": !0, children: o ? "Saving…" : a ? "Save" : "Create path" }),
365
+ /* @__PURE__ */ t(f, { size: "sm", variant: "outline", onClick: c, disabled: o, children: "Cancel" }),
366
+ a && /* @__PURE__ */ i(
367
+ Z,
366
368
  {
367
- size: "sm",
368
- variant: "ghost",
369
- className: "ml-auto text-rose-700 hover:text-rose-800 dark:text-rose-300",
370
- onClick: () => void V(),
369
+ className: Y(
370
+ ee({ size: "sm", variant: "ghost" }),
371
+ "ml-auto text-rose-700 hover:text-rose-800 dark:text-rose-300"
372
+ ),
373
+ armedClassName: "h-auto min-h-8 whitespace-normal bg-rose-50 text-left text-rose-800 hover:bg-rose-100 dark:bg-rose-500/10 dark:text-rose-300 dark:hover:bg-rose-500/20",
374
+ confirmLabel: `Delete "${a.title || "Untitled path"}"? Nobody's progress is lost.`,
375
+ onConfirm: () => void S(),
371
376
  disabled: o,
372
- "data-hv-path-delete": !0,
373
377
  children: [
374
378
  /* @__PURE__ */ t(H, { className: "h-3.5 w-3.5" }),
375
379
  " Delete path"
@@ -382,5 +386,5 @@ function se({
382
386
  );
383
387
  }
384
388
  export {
385
- _e as LearningPathsPanel
389
+ Pe as LearningPathsPanel
386
390
  };
@@ -12,16 +12,16 @@ const T = [
12
12
  ];
13
13
  function I({
14
14
  title: n,
15
- onConfirm: h,
15
+ onConfirm: g,
16
16
  onClose: i,
17
- container: g,
17
+ container: h,
18
18
  restoreFocus: v
19
19
  }) {
20
- const l = p(null), a = p(!1), [r, s] = m(!1), [d, c] = m(null), D = async () => {
20
+ const l = p(null), a = p(!1), [r, d] = m(!1), [s, c] = m(null), D = async () => {
21
21
  if (a.current || r) return;
22
- a.current = !0, s(!0), c(null);
23
- const e = await h();
24
- a.current = !1, s(!1), e.ok || c(e.message);
22
+ a.current = !0, d(!0), c(null);
23
+ const e = await g();
24
+ a.current = !1, d(!1), e.ok || c(e.message);
25
25
  };
26
26
  return /* @__PURE__ */ t(w, { open: !0, onOpenChange: (e) => !e && !r && i(), children: /* @__PURE__ */ o(
27
27
  y,
@@ -30,7 +30,7 @@ function I({
30
30
  onEscapeKeyDown: (e) => r && e.preventDefault(),
31
31
  onPointerDownOutside: (e) => r && e.preventDefault(),
32
32
  onInteractOutside: (e) => r && e.preventDefault(),
33
- container: g,
33
+ container: h,
34
34
  hideClose: r,
35
35
  className: "w-[calc(100vw-2rem)] max-w-[480px] dark:bg-card",
36
36
  onOpenAutoFocus: (e) => {
@@ -54,7 +54,7 @@ function I({
54
54
  /* @__PURE__ */ t("ul", { className: "list-disc space-y-1 pl-5 text-[13px] marker:text-muted-foreground", children: T.map((e) => /* @__PURE__ */ t("li", { children: e }, e)) }),
55
55
  /* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", children: "To keep it but out of the way, leave it in the archive." }),
56
56
  /* @__PURE__ */ t("p", { className: "sr-only", role: "status", "aria-live": "polite", "data-hv-purge-status": !0, children: r ? `Deleting “${n}”…` : "" }),
57
- d && /* @__PURE__ */ t(O, { "data-hv-purge-error": !0, children: d })
57
+ s && /* @__PURE__ */ t(O, { "data-hv-purge-error": !0, children: s })
58
58
  ] }),
59
59
  /* @__PURE__ */ o(E, { className: "flex-wrap border-border", children: [
60
60
  /* @__PURE__ */ t(