@burdenoff/microfe-buildmyiq 2026.720.4 → 2026.725.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,18 +5,19 @@ import { PageLayout as n } from "../../components/PageLayout.js";
5
5
  import { formatDuration as r, formatEnumLabel as i } from "../../utils/formatters.js";
6
6
  import { StatusBadge as a } from "../../components/StatusBadge.js";
7
7
  import { EmptyState as o } from "../../components/EmptyState.js";
8
- import { ErrorView as ee, LoadingView as te, Section as ne } from "../../components/StateViews.js";
9
- import { useBuiAssessment as re, useBuiCreateQuestion as s, useBuiPublishAssessment as c } from "../../hooks/useBuildmyiqApi.js";
8
+ import { ErrorView as ee, LoadingView as s, Section as c } from "../../components/StateViews.js";
9
+ import { useBuiArchiveAssessment as te, useBuiAssessment as ne, useBuiCreateQuestion as re, useBuiPublishAssessment as ie } from "../../hooks/useBuildmyiqApi.js";
10
10
  import "../../hooks/index.js";
11
+ import { BuiPermissionButton as ae } from "../../components/BuiPermissionButton.js";
11
12
  import "../../components/index.js";
12
- import { QUESTION_TYPES as l } from "../../types/index.js";
13
- import { useMemo as u, useState as d } from "react";
14
- import { ArrowLeft as ie, Circle as f, ClipboardCheck as p, ClipboardEdit as ae, Clock as m, Lightbulb as h, Plus as g, Repeat as _, Send as v, Square as y, Trash2 as oe, Trophy as se } from "lucide-react";
15
- import { useParams as ce } from "react-router-dom";
16
- import { Fragment as le, jsx as b, jsxs as x } from "react/jsx-runtime";
17
- import { Button as S, Checkbox as ue, GlassCard as C, Input as w, Label as T, ResponsiveDialog as de, ResponsiveDialogContent as fe, ResponsiveDialogDescription as pe, ResponsiveDialogFooter as me, ResponsiveDialogHeader as he, ResponsiveDialogTitle as ge, Select as _e, SelectContent as E, SelectItem as D, SelectTrigger as O, SelectValue as k, Textarea as A } from "@burdenoff/fe-libs/ui";
13
+ import { QUESTION_TYPES as oe } from "../../types/index.js";
14
+ import { useMemo as l, useState as u } from "react";
15
+ import { Archive as se, ArrowLeft as d, Circle as f, ClipboardCheck as p, ClipboardEdit as ce, Clock as le, Lightbulb as m, Plus as h, Repeat as ue, Send as de, Square as g, Trash2 as fe, Trophy as pe } from "lucide-react";
16
+ import { useParams as me } from "react-router-dom";
17
+ import { Fragment as he, jsx as _, jsxs as v } from "react/jsx-runtime";
18
+ import { Button as y, Checkbox as ge, GlassCard as b, Input as x, Label as S, ResponsiveDialog as C, ResponsiveDialogContent as w, ResponsiveDialogDescription as T, ResponsiveDialogFooter as E, ResponsiveDialogHeader as D, ResponsiveDialogTitle as O, Select as _e, SelectContent as ve, SelectItem as ye, SelectTrigger as be, SelectValue as xe, Textarea as k } from "@burdenoff/fe-libs/ui";
18
19
  //#region src/buildmyiq/pages/assessments/AssessmentDetailPage.tsx
19
- var j = (e) => {
20
+ var A = (e) => {
20
21
  if (!Array.isArray(e)) return [];
21
22
  let t = [];
22
23
  for (let n of e) if (n && typeof n == "object" && "label" in n) {
@@ -30,455 +31,501 @@ var j = (e) => {
30
31
  }
31
32
  }
32
33
  return t;
33
- }, M = 1e3, N = new Set(["SINGLE_CHOICE", "MULTIPLE_CHOICE"]), P = (e) => e === "SINGLE_CHOICE" || e === "TRUE_FALSE", F = () => [{
34
+ }, j = 1e3, M = new Set(["SINGLE_CHOICE", "MULTIPLE_CHOICE"]), N = (e) => e === "SINGLE_CHOICE" || e === "TRUE_FALSE", P = () => [{
34
35
  label: "",
35
36
  correct: !1
36
37
  }, {
37
38
  label: "",
38
39
  correct: !1
39
- }], I = () => [{
40
+ }], Se = () => [{
40
41
  label: "True",
41
42
  correct: !1
42
43
  }, {
43
44
  label: "False",
44
45
  correct: !1
45
- }], L = () => ({
46
+ }], F = () => ({
46
47
  prompt: "",
47
48
  type: "SINGLE_CHOICE",
48
49
  points: "1",
49
50
  explanation: "",
50
- options: F(),
51
+ options: P(),
51
52
  shortAnswer: ""
52
- }), R = () => {
53
- let { assessmentId: f } = ce(), { navigateTo: h } = e(), y = re(f), j = c(), R = s(), [B, V] = d(!1), [H, U] = d(L), [W, G] = d(null), K = y.data ?? null, q = u(() => [...K?.questions ?? []].sort((e, t) => e.position - t.position), [K]), J = u(() => q.length ? Math.max(...q.map((e) => e.position)) + 1 : 1, [q]), Y = u(() => q.reduce((e, t) => e + t.points, 0), [q]), X = H.type === "TRUE_FALSE" || N.has(H.type), Z = () => {
54
- U(L()), G(null), V(!0);
55
- }, Q = () => {
56
- V(!1), U(L()), G(null);
57
- }, ye = (e) => {
58
- U((t) => {
53
+ }), I = () => {
54
+ let { assessmentId: f } = me(), { navigateTo: m } = e(), g = ne(f), A = ie(), I = te(), R = re(), [we, z] = u(!1), [B, V] = u(F), [H, U] = u(null), [Te, W] = u(!1), [G, K] = u(null), q = g.data ?? null, J = l(() => [...q?.questions ?? []].sort((e, t) => e.position - t.position), [q]), Y = l(() => J.length ? Math.max(...J.map((e) => e.position)) + 1 : 1, [J]), X = l(() => J.reduce((e, t) => e + t.points, 0), [J]), Z = B.type === "TRUE_FALSE" || M.has(B.type), Q = () => {
55
+ V(F()), U(null), z(!0);
56
+ }, $ = () => {
57
+ z(!1), V(F()), U(null);
58
+ }, Ee = (e) => {
59
+ V((t) => {
59
60
  let n = t.options;
60
- return e === "TRUE_FALSE" ? n = I() : N.has(e) && (n = t.options.some((e) => e.label === "True" || e.label === "False") ? F() : t.options), {
61
+ return e === "TRUE_FALSE" ? n = Se() : M.has(e) && (n = t.options.some((e) => e.label === "True" || e.label === "False") ? P() : t.options), {
61
62
  ...t,
62
63
  type: e,
63
64
  options: n
64
65
  };
65
66
  });
66
- }, be = (e, t) => {
67
- U((n) => ({
67
+ }, De = (e, t) => {
68
+ V((n) => ({
68
69
  ...n,
69
70
  options: n.options.map((n, r) => r === e ? {
70
71
  ...n,
71
72
  label: t
72
73
  } : n)
73
74
  }));
74
- }, xe = (e, t) => {
75
- U((n) => ({
75
+ }, Oe = (e, t) => {
76
+ V((n) => ({
76
77
  ...n,
77
78
  options: n.options.map((r, i) => i === e ? {
78
79
  ...r,
79
80
  correct: t
80
- } : P(n.type) ? {
81
+ } : N(n.type) ? {
81
82
  ...r,
82
83
  correct: !1
83
84
  } : r)
84
85
  }));
85
- }, Se = () => {
86
- U((e) => ({
86
+ }, ke = () => {
87
+ V((e) => ({
87
88
  ...e,
88
89
  options: [...e.options, {
89
90
  label: "",
90
91
  correct: !1
91
92
  }]
92
93
  }));
93
- }, Ce = (e) => {
94
- U((t) => ({
94
+ }, Ae = (e) => {
95
+ V((t) => ({
95
96
  ...t,
96
97
  options: t.options.filter((t, n) => n !== e)
97
98
  }));
98
- }, $ = async () => {
99
- if (K) try {
100
- await j.mutateAsync(K.id);
99
+ }, je = async () => {
100
+ if (q) try {
101
+ await A.mutateAsync(q.id);
101
102
  } catch {}
102
- }, we = async () => {
103
+ }, Me = async () => {
104
+ if (q) {
105
+ K(null);
106
+ try {
107
+ await I.mutateAsync({
108
+ id: q.id,
109
+ courseId: q.courseId
110
+ }), W(!1), m("assessments");
111
+ } catch (e) {
112
+ K(e instanceof Error ? e.message : "Failed to archive this assessment.");
113
+ }
114
+ }
115
+ }, Ne = async () => {
103
116
  if (!f) return;
104
- if (!H.prompt.trim()) {
105
- G("Question prompt is required.");
117
+ if (!B.prompt.trim()) {
118
+ U("Question prompt is required.");
106
119
  return;
107
120
  }
108
121
  let e, t;
109
- if (X) {
110
- let n = H.options.map((e) => ({
122
+ if (Z) {
123
+ let n = B.options.map((e) => ({
111
124
  label: e.label.trim(),
112
125
  correct: e.correct
113
126
  })).filter((e) => e.label.length > 0);
114
- if (N.has(H.type) && n.length < 2) {
115
- G("Add at least two options.");
127
+ if (M.has(B.type) && n.length < 2) {
128
+ U("Add at least two options.");
116
129
  return;
117
130
  }
118
131
  e = n.map((e) => ({ label: e.label }));
119
132
  let r = n.filter((e) => e.correct).map((e) => e.label);
120
133
  r.length && (t = r);
121
- } else H.type === "SHORT_ANSWER" && (t = H.shortAnswer.trim() || void 0);
134
+ } else B.type === "SHORT_ANSWER" && (t = B.shortAnswer.trim() || void 0);
122
135
  try {
123
136
  await R.mutateAsync({
124
137
  assessmentId: f,
125
- prompt: H.prompt.trim(),
126
- type: H.type,
127
- points: H.points ? Number(H.points) : void 0,
128
- position: J,
129
- explanation: H.explanation.trim() || void 0,
138
+ prompt: B.prompt.trim(),
139
+ type: B.type,
140
+ points: B.points ? Number(B.points) : void 0,
141
+ position: Y,
142
+ explanation: B.explanation.trim() || void 0,
130
143
  options: e,
131
144
  answerKey: t
132
- }), Q();
145
+ }), $();
133
146
  } catch (e) {
134
- G(e instanceof Error ? e.message : "Failed to add question.");
147
+ U(e instanceof Error ? e.message : "Failed to add question.");
135
148
  }
136
149
  };
137
- if (y.isLoading) return /* @__PURE__ */ b(n, {
150
+ if (g.isLoading) return /* @__PURE__ */ _(n, {
138
151
  title: "Assessment",
139
- children: /* @__PURE__ */ b(te, { label: "Loading assessment…" })
152
+ children: /* @__PURE__ */ _(s, { label: "Loading assessment…" })
140
153
  });
141
- if (y.isError) return /* @__PURE__ */ b(n, {
154
+ if (g.isError) return /* @__PURE__ */ _(n, {
142
155
  title: "Assessment",
143
- children: /* @__PURE__ */ b(ee, {
156
+ children: /* @__PURE__ */ _(ee, {
144
157
  message: "Couldn't load this assessment.",
145
- onRetry: () => y.refetch()
158
+ onRetry: () => g.refetch()
146
159
  })
147
160
  });
148
- if (!K) return /* @__PURE__ */ b(n, {
161
+ if (!q) return /* @__PURE__ */ _(n, {
149
162
  title: "Assessment",
150
- children: /* @__PURE__ */ b(o, {
163
+ children: /* @__PURE__ */ _(o, {
151
164
  illustration: "empty-search",
152
165
  title: "Assessment not found",
153
166
  description: "This assessment may have been removed or you don't have access to it.",
154
- action: /* @__PURE__ */ b(S, {
155
- onClick: () => h("assessments"),
167
+ action: /* @__PURE__ */ _(y, {
168
+ onClick: () => m("assessments"),
156
169
  children: "Back to assessments"
157
170
  })
158
171
  })
159
172
  });
160
- let Te = K.status === "DRAFT";
161
- return /* @__PURE__ */ x(n, {
162
- title: /* @__PURE__ */ x("span", {
173
+ let Pe = q.status === "DRAFT", Fe = q.status === "ARCHIVED";
174
+ return /* @__PURE__ */ v(n, {
175
+ title: /* @__PURE__ */ v("span", {
163
176
  className: "flex min-w-0 items-center gap-3",
164
- children: [/* @__PURE__ */ b("span", {
177
+ children: [/* @__PURE__ */ _("span", {
165
178
  className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-[var(--color-accent-teal)]",
166
- children: /* @__PURE__ */ b(ae, { className: "h-5 w-5" })
167
- }), /* @__PURE__ */ b("span", {
179
+ children: /* @__PURE__ */ _(ce, { className: "h-5 w-5" })
180
+ }), /* @__PURE__ */ _("span", {
168
181
  className: "truncate",
169
- children: K.title
182
+ children: q.title
170
183
  })]
171
184
  }),
172
- description: K.description ?? void 0,
173
- actions: /* @__PURE__ */ x(le, { children: [/* @__PURE__ */ x(S, {
174
- variant: "ghost",
175
- onClick: () => h("submissions"),
176
- children: [/* @__PURE__ */ b(p, { className: "mr-1.5 h-4 w-4" }), " Submissions"]
177
- }), Te ? /* @__PURE__ */ x(S, {
178
- onClick: $,
179
- disabled: j.isPending,
180
- children: [/* @__PURE__ */ b(v, { className: "mr-1.5 h-4 w-4" }), j.isPending ? "Publishing…" : "Publish"]
181
- }) : /* @__PURE__ */ b(a, {
182
- status: K.status,
183
- className: "px-3 py-1.5"
184
- })] }),
185
+ description: q.description ?? void 0,
186
+ actions: /* @__PURE__ */ v(he, { children: [
187
+ /* @__PURE__ */ v(y, {
188
+ variant: "ghost",
189
+ onClick: () => m("submissions"),
190
+ children: [/* @__PURE__ */ _(p, { className: "mr-1.5 h-4 w-4" }), " Submissions"]
191
+ }),
192
+ !Fe && /* @__PURE__ */ _(ae, {
193
+ resource: "buildmyiq-assessment",
194
+ action: "delete",
195
+ deniedBehavior: "hide",
196
+ children: /* @__PURE__ */ v(y, {
197
+ variant: "outline",
198
+ onClick: () => W(!0),
199
+ children: [/* @__PURE__ */ _(se, { className: "mr-1.5 h-4 w-4" }), " Archive"]
200
+ })
201
+ }),
202
+ Pe ? /* @__PURE__ */ v(y, {
203
+ onClick: je,
204
+ disabled: A.isPending,
205
+ children: [/* @__PURE__ */ _(de, { className: "mr-1.5 h-4 w-4" }), A.isPending ? "Publishing…" : "Publish"]
206
+ }) : /* @__PURE__ */ _(a, {
207
+ status: q.status,
208
+ className: "px-3 py-1.5"
209
+ })
210
+ ] }),
185
211
  children: [
186
- /* @__PURE__ */ x("button", {
212
+ /* @__PURE__ */ v("button", {
187
213
  type: "button",
188
- onClick: () => h("assessments"),
214
+ onClick: () => m("assessments"),
189
215
  className: "mb-4 inline-flex items-center gap-1.5 text-sm text-text-secondary transition-colors hover:text-text-primary",
190
- children: [/* @__PURE__ */ b(ie, { className: "h-4 w-4" }), " All assessments"]
216
+ children: [/* @__PURE__ */ _(d, { className: "h-4 w-4" }), " All assessments"]
191
217
  }),
192
- /* @__PURE__ */ x(C, {
218
+ G && /* @__PURE__ */ _("p", {
219
+ className: "mb-4 rounded-lg border border-status-error-bg-subtle bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
220
+ children: G
221
+ }),
222
+ /* @__PURE__ */ v(b, {
193
223
  treatment: "glass",
194
224
  className: "mb-6 p-5 sm:p-6",
195
- children: [/* @__PURE__ */ x("div", {
225
+ children: [/* @__PURE__ */ v("div", {
196
226
  className: "mb-5 flex flex-wrap items-center gap-2",
197
227
  children: [
198
- /* @__PURE__ */ b(a, { status: K.type }),
199
- /* @__PURE__ */ b(a, { status: K.status }),
200
- K.isGraded ? /* @__PURE__ */ b(a, { status: "GRADED" }) : /* @__PURE__ */ b("span", {
228
+ /* @__PURE__ */ _(a, { status: q.type }),
229
+ /* @__PURE__ */ _(a, { status: q.status }),
230
+ q.isGraded ? /* @__PURE__ */ _(a, { status: "GRADED" }) : /* @__PURE__ */ _("span", {
201
231
  className: "inline-flex items-center gap-1.5 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
202
232
  children: "Not graded"
203
233
  })
204
234
  ]
205
- }), /* @__PURE__ */ x("div", {
235
+ }), /* @__PURE__ */ v("div", {
206
236
  className: "grid grid-cols-2 gap-y-6 sm:grid-cols-4",
207
237
  children: [
208
- /* @__PURE__ */ b(z, {
209
- icon: /* @__PURE__ */ b(se, { className: "h-5 w-5" }),
238
+ /* @__PURE__ */ _(L, {
239
+ icon: /* @__PURE__ */ _(pe, { className: "h-5 w-5" }),
210
240
  label: "Passing score",
211
- value: `${K.passingScore}%`
241
+ value: `${q.passingScore}%`
212
242
  }),
213
- /* @__PURE__ */ b(z, {
214
- icon: /* @__PURE__ */ b(m, { className: "h-5 w-5" }),
243
+ /* @__PURE__ */ _(L, {
244
+ icon: /* @__PURE__ */ _(le, { className: "h-5 w-5" }),
215
245
  label: "Time limit",
216
- value: r(K.timeLimitMin),
246
+ value: r(q.timeLimitMin),
217
247
  divider: !0
218
248
  }),
219
- /* @__PURE__ */ b(z, {
220
- icon: /* @__PURE__ */ b(_, { className: "h-5 w-5" }),
249
+ /* @__PURE__ */ _(L, {
250
+ icon: /* @__PURE__ */ _(ue, { className: "h-5 w-5" }),
221
251
  label: "Max attempts",
222
- value: K.maxAttempts,
252
+ value: q.maxAttempts,
223
253
  divider: !0
224
254
  }),
225
- /* @__PURE__ */ b(z, {
226
- icon: /* @__PURE__ */ b(p, { className: "h-5 w-5" }),
255
+ /* @__PURE__ */ _(L, {
256
+ icon: /* @__PURE__ */ _(p, { className: "h-5 w-5" }),
227
257
  label: "Graded",
228
- value: K.isGraded ? "Yes" : "No",
258
+ value: q.isGraded ? "Yes" : "No",
229
259
  divider: !0
230
260
  })
231
261
  ]
232
262
  })]
233
263
  }),
234
- /* @__PURE__ */ b(ne, {
235
- title: `Questions (${q.length})`,
236
- description: q.length > 0 ? `${Y} point${Y === 1 ? "" : "s"} across ${q.length} question${q.length === 1 ? "" : "s"}` : void 0,
237
- action: /* @__PURE__ */ x(S, {
264
+ /* @__PURE__ */ _(c, {
265
+ title: `Questions (${J.length})`,
266
+ description: J.length > 0 ? `${X} point${X === 1 ? "" : "s"} across ${J.length} question${J.length === 1 ? "" : "s"}` : void 0,
267
+ action: /* @__PURE__ */ v(y, {
238
268
  variant: "outline",
239
- onClick: Z,
240
- children: [/* @__PURE__ */ b(g, { className: "mr-1.5 h-4 w-4" }), " Add question"]
269
+ onClick: Q,
270
+ children: [/* @__PURE__ */ _(h, { className: "mr-1.5 h-4 w-4" }), " Add question"]
241
271
  }),
242
- children: q.length === 0 ? /* @__PURE__ */ b(o, {
272
+ children: J.length === 0 ? /* @__PURE__ */ _(o, {
243
273
  illustration: "empty-data",
244
274
  title: "No questions yet",
245
275
  description: "Build this assessment by adding its first question.",
246
- action: /* @__PURE__ */ x(S, {
247
- onClick: Z,
248
- children: [/* @__PURE__ */ b(g, { className: "mr-1.5 h-4 w-4" }), " Add question"]
276
+ action: /* @__PURE__ */ v(y, {
277
+ onClick: Q,
278
+ children: [/* @__PURE__ */ _(h, { className: "mr-1.5 h-4 w-4" }), " Add question"]
249
279
  })
250
- }) : /* @__PURE__ */ b("ol", {
280
+ }) : /* @__PURE__ */ _("ol", {
251
281
  className: "flex flex-col gap-3",
252
- children: q.map((e, t) => /* @__PURE__ */ b(ve, {
282
+ children: J.map((e, t) => /* @__PURE__ */ _(Ce, {
253
283
  index: t + 1,
254
284
  question: e
255
285
  }, e.id))
256
286
  })
257
287
  }),
258
- /* @__PURE__ */ b(de, {
259
- open: B,
288
+ /* @__PURE__ */ _(C, {
289
+ open: we,
260
290
  onOpenChange: (e) => {
261
- e ? V(!0) : Q();
291
+ e ? z(!0) : $();
262
292
  },
263
- children: /* @__PURE__ */ x(fe, { children: [
264
- /* @__PURE__ */ x(he, { children: [/* @__PURE__ */ b(ge, { children: "Add question" }), /* @__PURE__ */ x(pe, { children: [
293
+ children: /* @__PURE__ */ v(w, { children: [
294
+ /* @__PURE__ */ v(D, { children: [/* @__PURE__ */ _(O, { children: "Add question" }), /* @__PURE__ */ v(T, { children: [
265
295
  "Question ",
266
- J,
296
+ Y,
267
297
  " · pick a type, write the prompt and mark the correct answer(s)."
268
298
  ] })] }),
269
- /* @__PURE__ */ x("div", {
299
+ /* @__PURE__ */ v("div", {
270
300
  className: "grid gap-4 py-2",
271
301
  children: [
272
- /* @__PURE__ */ x("div", {
302
+ /* @__PURE__ */ v("div", {
273
303
  className: "grid gap-1.5",
274
304
  children: [
275
- /* @__PURE__ */ b(T, {
305
+ /* @__PURE__ */ _(S, {
276
306
  htmlFor: "prompt",
277
307
  children: "Prompt *"
278
308
  }),
279
- /* @__PURE__ */ b(A, {
309
+ /* @__PURE__ */ _(k, {
280
310
  id: "prompt",
281
- value: H.prompt,
282
- onChange: (e) => U({
283
- ...H,
284
- prompt: e.target.value.slice(0, M)
311
+ value: B.prompt,
312
+ onChange: (e) => V({
313
+ ...B,
314
+ prompt: e.target.value.slice(0, j)
285
315
  }),
286
316
  placeholder: "Enter your question prompt…",
287
317
  rows: 3,
288
- maxLength: M
318
+ maxLength: j
289
319
  }),
290
- /* @__PURE__ */ x("p", {
320
+ /* @__PURE__ */ v("p", {
291
321
  className: "text-right text-xs tabular-nums text-text-secondary",
292
322
  children: [
293
- H.prompt.length,
323
+ B.prompt.length,
294
324
  " / ",
295
- M
325
+ j
296
326
  ]
297
327
  })
298
328
  ]
299
329
  }),
300
- /* @__PURE__ */ x("div", {
330
+ /* @__PURE__ */ v("div", {
301
331
  className: "grid gap-2 sm:grid-cols-2",
302
- children: [/* @__PURE__ */ x("div", {
332
+ children: [/* @__PURE__ */ v("div", {
303
333
  className: "grid gap-1.5",
304
- children: [/* @__PURE__ */ b(T, {
334
+ children: [/* @__PURE__ */ _(S, {
305
335
  htmlFor: "questionType",
306
336
  children: "Type"
307
- }), /* @__PURE__ */ x(_e, {
308
- value: H.type,
309
- onValueChange: (e) => ye(e),
310
- children: [/* @__PURE__ */ b(O, {
337
+ }), /* @__PURE__ */ v(_e, {
338
+ value: B.type,
339
+ onValueChange: (e) => Ee(e),
340
+ children: [/* @__PURE__ */ _(be, {
311
341
  id: "questionType",
312
- children: /* @__PURE__ */ b(k, {})
313
- }), /* @__PURE__ */ b(E, { children: l.map((e) => /* @__PURE__ */ b(D, {
342
+ children: /* @__PURE__ */ _(xe, {})
343
+ }), /* @__PURE__ */ _(ve, { children: oe.map((e) => /* @__PURE__ */ _(ye, {
314
344
  value: e,
315
345
  children: i(e)
316
346
  }, e)) })]
317
347
  })]
318
- }), /* @__PURE__ */ x("div", {
348
+ }), /* @__PURE__ */ v("div", {
319
349
  className: "grid gap-1.5",
320
- children: [/* @__PURE__ */ b(T, {
350
+ children: [/* @__PURE__ */ _(S, {
321
351
  htmlFor: "points",
322
352
  children: "Points"
323
- }), /* @__PURE__ */ b(w, {
353
+ }), /* @__PURE__ */ _(x, {
324
354
  id: "points",
325
355
  type: "number",
326
356
  min: "0",
327
357
  step: "1",
328
- value: H.points,
329
- onChange: (e) => U({
330
- ...H,
358
+ value: B.points,
359
+ onChange: (e) => V({
360
+ ...B,
331
361
  points: e.target.value
332
362
  }),
333
363
  placeholder: "1"
334
364
  })]
335
365
  })]
336
366
  }),
337
- X && /* @__PURE__ */ x("div", {
367
+ Z && /* @__PURE__ */ v("div", {
338
368
  className: "grid gap-2",
339
369
  children: [
340
- /* @__PURE__ */ x(T, { children: ["Options", H.type !== "TRUE_FALSE" && " *"] }),
341
- /* @__PURE__ */ x("p", {
370
+ /* @__PURE__ */ v(S, { children: ["Options", B.type !== "TRUE_FALSE" && " *"] }),
371
+ /* @__PURE__ */ v("p", {
342
372
  className: "-mt-1 text-xs text-text-secondary",
343
373
  children: [
344
374
  "Tick the ",
345
- P(H.type) ? "single correct answer" : "correct answers",
375
+ N(B.type) ? "single correct answer" : "correct answers",
346
376
  "."
347
377
  ]
348
378
  }),
349
- /* @__PURE__ */ b("div", {
379
+ /* @__PURE__ */ _("div", {
350
380
  className: "flex flex-col gap-2",
351
- children: H.options.map((e, n) => /* @__PURE__ */ x("div", {
381
+ children: B.options.map((e, n) => /* @__PURE__ */ v("div", {
352
382
  className: t("flex items-center gap-2.5 rounded-lg border px-2.5 py-1.5 transition-colors", e.correct ? "border-status-success-text bg-status-success-bg-subtle" : "border-border-seam bg-bg-surface"),
353
383
  children: [
354
- /* @__PURE__ */ b(ue, {
384
+ /* @__PURE__ */ _(ge, {
355
385
  checked: e.correct,
356
- onCheckedChange: (e) => xe(n, e === !0),
386
+ onCheckedChange: (e) => Oe(n, e === !0),
357
387
  "aria-label": "Mark option correct"
358
388
  }),
359
- /* @__PURE__ */ b(w, {
389
+ /* @__PURE__ */ _(x, {
360
390
  value: e.label,
361
- readOnly: H.type === "TRUE_FALSE",
362
- onChange: (e) => be(n, e.target.value),
391
+ readOnly: B.type === "TRUE_FALSE",
392
+ onChange: (e) => De(n, e.target.value),
363
393
  placeholder: `Option ${n + 1}`,
364
394
  className: "flex-1 border-0 bg-transparent px-1 shadow-none focus-visible:ring-0"
365
395
  }),
366
- e.correct && /* @__PURE__ */ b("span", {
396
+ e.correct && /* @__PURE__ */ _("span", {
367
397
  className: "shrink-0 text-xs font-medium text-status-success-text",
368
398
  children: "Correct"
369
399
  }),
370
- H.type !== "TRUE_FALSE" && H.options.length > 2 && /* @__PURE__ */ b(S, {
400
+ B.type !== "TRUE_FALSE" && B.options.length > 2 && /* @__PURE__ */ _(y, {
371
401
  type: "button",
372
402
  variant: "ghost",
373
403
  size: "icon",
374
- onClick: () => Ce(n),
404
+ onClick: () => Ae(n),
375
405
  "aria-label": "Remove option",
376
- children: /* @__PURE__ */ b(oe, { className: "h-4 w-4" })
406
+ children: /* @__PURE__ */ _(fe, { className: "h-4 w-4" })
377
407
  })
378
408
  ]
379
409
  }, n))
380
410
  }),
381
- H.type !== "TRUE_FALSE" && /* @__PURE__ */ x(S, {
411
+ B.type !== "TRUE_FALSE" && /* @__PURE__ */ v(y, {
382
412
  type: "button",
383
413
  variant: "ghost",
384
414
  size: "sm",
385
- onClick: Se,
386
- children: [/* @__PURE__ */ b(g, { className: "mr-1.5 h-4 w-4" }), " Add option"]
415
+ onClick: ke,
416
+ children: [/* @__PURE__ */ _(h, { className: "mr-1.5 h-4 w-4" }), " Add option"]
387
417
  })
388
418
  ]
389
419
  }),
390
- H.type === "SHORT_ANSWER" && /* @__PURE__ */ x("div", {
420
+ B.type === "SHORT_ANSWER" && /* @__PURE__ */ v("div", {
391
421
  className: "grid gap-1.5",
392
- children: [/* @__PURE__ */ b(T, {
422
+ children: [/* @__PURE__ */ _(S, {
393
423
  htmlFor: "shortAnswer",
394
424
  children: "Expected answer"
395
- }), /* @__PURE__ */ b(w, {
425
+ }), /* @__PURE__ */ _(x, {
396
426
  id: "shortAnswer",
397
- value: H.shortAnswer,
398
- onChange: (e) => U({
399
- ...H,
427
+ value: B.shortAnswer,
428
+ onChange: (e) => V({
429
+ ...B,
400
430
  shortAnswer: e.target.value
401
431
  }),
402
432
  placeholder: "The accepted answer (used as the grading key)."
403
433
  })]
404
434
  }),
405
- (H.type === "ESSAY" || H.type === "CODE") && /* @__PURE__ */ x("p", {
435
+ (B.type === "ESSAY" || B.type === "CODE") && /* @__PURE__ */ v("p", {
406
436
  className: "rounded-lg bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
407
- children: [i(H.type), " responses are graded manually from the Submissions view."]
437
+ children: [i(B.type), " responses are graded manually from the Submissions view."]
408
438
  }),
409
- /* @__PURE__ */ x("div", {
439
+ /* @__PURE__ */ v("div", {
410
440
  className: "grid gap-1.5",
411
- children: [/* @__PURE__ */ b(T, {
441
+ children: [/* @__PURE__ */ _(S, {
412
442
  htmlFor: "explanation",
413
443
  children: "Explanation"
414
- }), /* @__PURE__ */ b(A, {
444
+ }), /* @__PURE__ */ _(k, {
415
445
  id: "explanation",
416
- value: H.explanation,
417
- onChange: (e) => U({
418
- ...H,
446
+ value: B.explanation,
447
+ onChange: (e) => V({
448
+ ...B,
419
449
  explanation: e.target.value
420
450
  }),
421
451
  placeholder: "Shown to learners after grading (optional).",
422
452
  rows: 2
423
453
  })]
424
454
  }),
425
- W && /* @__PURE__ */ b("p", {
455
+ H && /* @__PURE__ */ _("p", {
426
456
  className: "text-sm text-status-error-text",
427
- children: W
457
+ children: H
428
458
  })
429
459
  ]
430
460
  }),
431
- /* @__PURE__ */ x(me, { children: [/* @__PURE__ */ b(S, {
461
+ /* @__PURE__ */ v(E, { children: [/* @__PURE__ */ _(y, {
432
462
  variant: "outline",
433
- onClick: Q,
463
+ onClick: $,
434
464
  children: "Cancel"
435
- }), /* @__PURE__ */ b(S, {
436
- onClick: we,
465
+ }), /* @__PURE__ */ _(y, {
466
+ onClick: Ne,
437
467
  disabled: R.isPending,
438
468
  children: R.isPending ? "Adding…" : "Add question"
439
469
  })] })
440
470
  ] })
471
+ }),
472
+ /* @__PURE__ */ _(C, {
473
+ open: Te,
474
+ onOpenChange: (e) => {
475
+ e || W(!1);
476
+ },
477
+ children: /* @__PURE__ */ v(w, { children: [/* @__PURE__ */ v(D, { children: [/* @__PURE__ */ _(O, { children: "Archive this assessment?" }), /* @__PURE__ */ _(T, { children: "Archived assessments are hidden from the catalog and can no longer be submitted to. This frees up its quota slot so you can create a replacement assessment for this course." })] }), /* @__PURE__ */ v(E, { children: [/* @__PURE__ */ _(y, {
478
+ variant: "outline",
479
+ onClick: () => W(!1),
480
+ disabled: I.isPending,
481
+ children: "Cancel"
482
+ }), /* @__PURE__ */ _(y, {
483
+ variant: "destructive",
484
+ onClick: Me,
485
+ disabled: I.isPending,
486
+ children: I.isPending ? "Archiving…" : "Archive assessment"
487
+ })] })] })
441
488
  })
442
489
  ]
443
490
  });
444
- }, z = ({ icon: e, label: n, value: r, divider: i }) => /* @__PURE__ */ x("div", {
491
+ }, L = ({ icon: e, label: n, value: r, divider: i }) => /* @__PURE__ */ v("div", {
445
492
  className: t("flex items-center gap-3", i && "sm:border-l sm:border-border-seam sm:pl-5"),
446
- children: [/* @__PURE__ */ b("span", {
493
+ children: [/* @__PURE__ */ _("span", {
447
494
  className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)] text-[var(--color-accent-teal)]",
448
495
  children: e
449
- }), /* @__PURE__ */ x("div", {
496
+ }), /* @__PURE__ */ v("div", {
450
497
  className: "min-w-0",
451
- children: [/* @__PURE__ */ b("p", {
498
+ children: [/* @__PURE__ */ _("p", {
452
499
  className: "text-xs font-medium uppercase tracking-wide text-text-secondary",
453
500
  children: n
454
- }), /* @__PURE__ */ b("p", {
501
+ }), /* @__PURE__ */ _("p", {
455
502
  className: "mt-0.5 text-lg font-semibold tabular-nums text-text-primary",
456
503
  children: r
457
504
  })]
458
505
  })]
459
- }), B = (e) => {
506
+ }), R = (e) => {
460
507
  switch (e) {
461
508
  case "SHORT_ANSWER": return "Learners type a short answer — auto-graded against the answer key.";
462
509
  case "ESSAY": return "Open long-form response — graded manually from Submissions.";
463
510
  case "CODE": return "Code response — graded manually from Submissions.";
464
511
  default: return "Free-text response.";
465
512
  }
466
- }, ve = ({ index: e, question: t }) => {
467
- let n = j(t.options), r = N.has(t.type) || t.type === "TRUE_FALSE", i = t.type === "MULTIPLE_CHOICE";
468
- return /* @__PURE__ */ b("li", { children: /* @__PURE__ */ b(C, {
513
+ }, Ce = ({ index: e, question: t }) => {
514
+ let n = A(t.options), r = M.has(t.type) || t.type === "TRUE_FALSE", i = t.type === "MULTIPLE_CHOICE";
515
+ return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(b, {
469
516
  treatment: "plain",
470
517
  className: "p-4 sm:p-5",
471
- children: /* @__PURE__ */ x("div", {
518
+ children: /* @__PURE__ */ v("div", {
472
519
  className: "flex items-start gap-3.5",
473
- children: [/* @__PURE__ */ b("span", {
520
+ children: [/* @__PURE__ */ _("span", {
474
521
  className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-sm font-bold tabular-nums text-[var(--color-accent-teal)]",
475
522
  children: e
476
- }), /* @__PURE__ */ x("div", {
523
+ }), /* @__PURE__ */ v("div", {
477
524
  className: "min-w-0 flex-1",
478
525
  children: [
479
- /* @__PURE__ */ x("div", {
526
+ /* @__PURE__ */ v("div", {
480
527
  className: "flex flex-wrap items-center gap-2",
481
- children: [/* @__PURE__ */ b(a, { status: t.type }), /* @__PURE__ */ x("span", {
528
+ children: [/* @__PURE__ */ _(a, { status: t.type }), /* @__PURE__ */ v("span", {
482
529
  className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium tabular-nums text-text-secondary",
483
530
  children: [
484
531
  t.points,
@@ -487,27 +534,27 @@ var j = (e) => {
487
534
  ]
488
535
  })]
489
536
  }),
490
- /* @__PURE__ */ b("p", {
537
+ /* @__PURE__ */ _("p", {
491
538
  className: "mt-2.5 font-medium text-text-primary",
492
539
  children: t.prompt
493
540
  }),
494
- r && n.length > 0 && /* @__PURE__ */ b("ul", {
541
+ r && n.length > 0 && /* @__PURE__ */ _("ul", {
495
542
  className: "mt-3 flex flex-col gap-2",
496
- children: n.map((e, t) => /* @__PURE__ */ x("li", {
543
+ children: n.map((e, t) => /* @__PURE__ */ v("li", {
497
544
  className: "flex items-center gap-2.5 rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary",
498
- children: [b(i ? y : f, { className: "h-4 w-4 shrink-0 text-text-secondary opacity-60" }), /* @__PURE__ */ b("span", {
545
+ children: [_(i ? g : f, { className: "h-4 w-4 shrink-0 text-text-secondary opacity-60" }), /* @__PURE__ */ _("span", {
499
546
  className: "min-w-0",
500
547
  children: e.label
501
548
  })]
502
549
  }, e.id ?? `${t}-${e.label}`))
503
550
  }),
504
- !r && /* @__PURE__ */ b("p", {
551
+ !r && /* @__PURE__ */ _("p", {
505
552
  className: "mt-3 rounded-lg border border-dashed border-border-seam bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
506
- children: B(t.type)
553
+ children: R(t.type)
507
554
  }),
508
- t.explanation && /* @__PURE__ */ x("p", {
555
+ t.explanation && /* @__PURE__ */ v("p", {
509
556
  className: "mt-3 flex items-start gap-1.5 rounded-lg bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
510
- children: [/* @__PURE__ */ b(h, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-status-warning-text" }), /* @__PURE__ */ b("span", { children: t.explanation })]
557
+ children: [/* @__PURE__ */ _(m, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-status-warning-text" }), /* @__PURE__ */ _("span", { children: t.explanation })]
511
558
  })
512
559
  ]
513
560
  })]
@@ -515,6 +562,6 @@ var j = (e) => {
515
562
  }) });
516
563
  };
517
564
  //#endregion
518
- export { R as AssessmentDetailPage };
565
+ export { I as AssessmentDetailPage };
519
566
 
520
567
  //# sourceMappingURL=AssessmentDetailPage.js.map