@instructure/platform-modules 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/adapters/canvasGraphql/index.d.ts.map +1 -1
  2. package/dist/adapters/canvasGraphql/normalize.d.ts +5 -0
  3. package/dist/adapters/canvasGraphql/normalize.d.ts.map +1 -1
  4. package/dist/adapters/canvasGraphql/queries.d.ts +5 -0
  5. package/dist/adapters/canvasGraphql/queries.d.ts.map +1 -1
  6. package/dist/adapters/inMemory.d.ts.map +1 -1
  7. package/dist/adapters/types.d.ts +6 -0
  8. package/dist/adapters/types.d.ts.map +1 -1
  9. package/dist/cache/keys.d.ts +3 -0
  10. package/dist/cache/keys.d.ts.map +1 -1
  11. package/dist/chunks/ModulesProgressBar-BFKPmBau.js +2727 -0
  12. package/dist/components/HighlightedText.d.ts +13 -0
  13. package/dist/components/HighlightedText.d.ts.map +1 -0
  14. package/dist/components/ModuleCard.d.ts +1 -0
  15. package/dist/components/ModuleCard.d.ts.map +1 -1
  16. package/dist/components/ModuleItemRow.d.ts +1 -0
  17. package/dist/components/ModuleItemRow.d.ts.map +1 -1
  18. package/dist/components/ModulesList.d.ts.map +1 -1
  19. package/dist/components/ModulesList.stories.d.ts +5 -0
  20. package/dist/components/ModulesList.stories.d.ts.map +1 -1
  21. package/dist/components/ModulesProgressBar.d.ts +3 -2
  22. package/dist/components/ModulesProgressBar.d.ts.map +1 -1
  23. package/dist/edit.js +9 -9
  24. package/dist/hooks/constants.d.ts +2 -0
  25. package/dist/hooks/constants.d.ts.map +1 -1
  26. package/dist/hooks/queryOptions.d.ts +2 -0
  27. package/dist/hooks/queryOptions.d.ts.map +1 -1
  28. package/dist/hooks/useItemsMode.d.ts +1 -0
  29. package/dist/hooks/useItemsMode.d.ts.map +1 -1
  30. package/dist/hooks/useModules.d.ts +1 -0
  31. package/dist/hooks/useModules.d.ts.map +1 -1
  32. package/dist/hooks/useModulesPageData.d.ts +11 -0
  33. package/dist/hooks/useModulesPageData.d.ts.map +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +1212 -1104
  37. package/dist/types/domain.d.ts +5 -0
  38. package/dist/types/domain.d.ts.map +1 -1
  39. package/dist/types/filterClause.d.ts +1 -0
  40. package/dist/types/filterClause.d.ts.map +1 -1
  41. package/dist/types/index.d.ts +1 -1
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/dist/types/schemas.d.ts +2 -1
  44. package/dist/types/schemas.d.ts.map +1 -1
  45. package/locales/en.json +6 -0
  46. package/package.json +1 -1
  47. package/dist/chunks/ModulesProgressBar-B1oRo549.js +0 -2548
@@ -1,2548 +0,0 @@
1
- import { keepPreviousData as Mn, useQuery as Tn, useQueryClient as Sn, QueryObserver as Io } from "@tanstack/react-query";
2
- import kt from "p-limit";
3
- import { createContext as dt, useContext as Ye, useRef as _, useMemo as G, isValidElement as mt, useState as oe, useEffect as me, useCallback as O, memo as Mo, Fragment as wn, cloneElement as To } from "react";
4
- import { BREAKPOINTS as So } from "@instructure/platform-with-breakpoints";
5
- import { jsx as l, jsxs as Y } from "react/jsx-runtime";
6
- import { useTheme as vn } from "@instructure/emotion";
7
- import { ScreenReaderContent as En } from "@instructure/ui-a11y-content";
8
- import { Flex as N } from "@instructure/ui-flex/v11_7";
9
- import { PlugInstUIIcon as wo, ExternalLinkInstUIIcon as vo, FileInstUIIcon as Eo, FileTextInstUIIcon as Po, MessagesSquareInstUIIcon as Co, RocketInstUIIcon as _o, FilePenLineInstUIIcon as Ao, ClockInstUIIcon as Do, CalendarInstUIIcon as pt, LockInstUIIcon as gt, CircleAlertInstUIIcon as Te, CircleCheckInstUIIcon as ft, ClockFadingInstUIIcon as ht, CircleDashedInstUIIcon as bt, CornerDownRightInstUIIcon as Lo, IconArrowOpenStartLine as xo, IconArrowOpenEndLine as Ro } from "@instructure/ui-icons";
10
- import { Link as No } from "@instructure/ui-link/v11_7";
11
- import { Text as ue } from "@instructure/ui-text/v11_7";
12
- import { View as ae } from "@instructure/ui-view/v11_7";
13
- import { Pill as Oo } from "@instructure/ui-pill/v11_7";
14
- import { IconButton as Ft } from "@instructure/ui-buttons/v11_7";
15
- import { Heading as ko } from "@instructure/ui-heading/v11_7";
16
- import { Tooltip as Fo } from "@instructure/ui-tooltip/v11_7";
17
- import { z as a } from "zod";
18
- import { isValid as rt, colorToRGB as st, overlayColors as qo, alpha as zo, color2hex as Pn, contrast as de, darken as Uo, lighten as $o } from "@instructure/ui-color-utils";
19
- import { Tag as Cn } from "@instructure/ui-tag/v11_7";
20
- const Bo = a.object({
21
- target: a.enum(["module", "item"]),
22
- field: a.string(),
23
- op: a.enum(["eq", "contains", "within"]),
24
- value: a.union([a.string(), a.boolean(), a.number()])
25
- }).strict();
26
- function Wo(e, t) {
27
- const n = e == null ? void 0 : e[t.target];
28
- return !n || !Object.prototype.hasOwnProperty.call(n, t.field) ? !1 : n[t.field].includes(t.op);
29
- }
30
- const Go = a.enum([
31
- "assignment",
32
- "quiz",
33
- "discussion",
34
- "page",
35
- "file",
36
- "external_url",
37
- "external_tool",
38
- "sub_header"
39
- ]), jo = a.enum(["not_started", "in_progress", "complete", "incomplete", "missing", "locked"]), Ho = a.enum([
40
- "not_started",
41
- "in_progress",
42
- "complete",
43
- "missing",
44
- "incomplete",
45
- "missing_and_incomplete",
46
- "locked"
47
- ]), Ko = a.enum([
48
- "must_view",
49
- "must_mark_done",
50
- "must_contribute",
51
- "must_submit",
52
- "min_score",
53
- "min_percentage",
54
- "unknown"
55
- ]), Yo = a.object({
56
- status: Ho.optional(),
57
- requirementsMet: a.number(),
58
- requirementCount: a.number(),
59
- percentComplete: a.number().min(0).max(100),
60
- nextDueAt: a.string().nullish(),
61
- missingCount: a.number(),
62
- incompleteCount: a.number()
63
- }), _n = a.object({
64
- itemId: a.string(),
65
- type: Ko,
66
- minScore: a.number().nullish(),
67
- minPercentage: a.number().nullish()
68
- }), An = a.object({
69
- id: a.string(),
70
- moduleId: a.string(),
71
- title: a.string(),
72
- type: Go,
73
- position: a.number(),
74
- itemNumber: a.number().optional(),
75
- indent: a.number(),
76
- published: a.boolean(),
77
- url: a.string().nullish(),
78
- newTab: a.boolean().nullish(),
79
- completionRequirement: _n.nullish(),
80
- dueAt: a.string().nullish(),
81
- status: jo.optional(),
82
- pointsPossible: a.number().nullish(),
83
- extensions: a.record(a.unknown()).optional()
84
- }), Qo = a.object({
85
- id: a.string(),
86
- name: a.string()
87
- }), Vo = a.object({
88
- id: a.string(),
89
- name: a.string(),
90
- position: a.number(),
91
- published: a.boolean(),
92
- itemCount: a.number(),
93
- estimatedDurationMinutes: a.number().optional(),
94
- items: a.array(An).optional(),
95
- unlockAt: a.string().nullish(),
96
- prerequisiteModules: a.array(Qo),
97
- requirementCount: a.number().nullish(),
98
- requireSequentialProgress: a.boolean(),
99
- completionRequirements: a.array(_n).optional(),
100
- progress: Yo.optional(),
101
- collapsed: a.boolean().nullish(),
102
- extensions: a.record(a.unknown()).optional()
103
- }), Lc = a.object({
104
- hasNextPage: a.boolean(),
105
- endCursor: a.string().nullable()
106
- }).refine((e) => !e.hasNextPage || e.endCursor !== null, {
107
- message: 'hasNextPage is true but endCursor is null: there is another page and no cursor to ask for it with, which renders a "Load more" that can never load.',
108
- path: ["endCursor"]
109
- }), Dn = a.object({
110
- hasNextPage: a.boolean(),
111
- endCursor: a.string().nullable(),
112
- hasPreviousPage: a.boolean(),
113
- startCursor: a.string().nullable(),
114
- totalCount: a.number().nullable(),
115
- totalNrOfPages: a.number().nullable()
116
- }).refine((e) => !e.hasNextPage || e.endCursor !== null, {
117
- message: 'hasNextPage is true but endCursor is null: there is another page and no cursor to ask for it with, which renders a "Load more" that can never load.',
118
- path: ["endCursor"]
119
- }), xc = a.object({
120
- modules: a.array(Vo),
121
- pageInfo: Dn
122
- }), Rc = a.object({
123
- items: a.array(An),
124
- pageInfo: Dn
125
- }), Ln = "career.estimatedDurationMinutes";
126
- function xn(e) {
127
- var n;
128
- const t = (n = e.extensions) == null ? void 0 : n[Ln];
129
- return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? null : t;
130
- }
131
- function Nc(e, t) {
132
- return t == null ? e : { ...e, [Ln]: t };
133
- }
134
- const Zo = "modules.suppressItemNumbering";
135
- function Oc(e) {
136
- var t;
137
- return ((t = e.extensions) == null ? void 0 : t[Zo]) === !0;
138
- }
139
- const Xo = "organize.newPlacement", Jo = "organize.newModule", er = "organize.addedItemCount";
140
- function kc(e) {
141
- var t;
142
- return ((t = e.extensions) == null ? void 0 : t[Xo]) === !0;
143
- }
144
- function Fc(e) {
145
- var t;
146
- return ((t = e.extensions) == null ? void 0 : t[Jo]) === !0;
147
- }
148
- function qc(e) {
149
- var n;
150
- const t = (n = e.extensions) == null ? void 0 : n[er];
151
- return typeof t != "number" || !Number.isInteger(t) || t < 0 ? 0 : t;
152
- }
153
- const Rn = dt(null), tr = () => {
154
- };
155
- function zc({
156
- host: e,
157
- onEvent: t,
158
- children: n
159
- }) {
160
- const o = _(t);
161
- o.current = t;
162
- const r = G(
163
- () => (s) => o.current({ event: s, host: e }),
164
- [e]
165
- );
166
- return /* @__PURE__ */ l(Rn.Provider, { value: r, children: n });
167
- }
168
- function nr() {
169
- return Ye(Rn) ?? tr;
170
- }
171
- const qt = 100, Nn = 2e3;
172
- class or extends Error {
173
- constructor(t, n) {
174
- super(
175
- `This in-memory adapter was built for course ${t} but was asked for course ${n}. A fixture serves exactly one course.`
176
- ), this.name = "InMemoryCourseMismatchError", this.expected = t, this.received = n;
177
- }
178
- }
179
- const zt = (e) => `offset:${e}`, Ut = (e) => {
180
- if (!e) return 0;
181
- const t = Number.parseInt(e.replace("offset:", ""), 10);
182
- return Number.isFinite(t) && t >= 0 ? t : 0;
183
- }, Ue = (e) => {
184
- if (e != null && e.aborted)
185
- throw new DOMException("The operation was aborted.", "AbortError");
186
- };
187
- function $t(e, t, n) {
188
- const o = e.length, r = Math.ceil(o / n), s = t.kind === "first" ? 0 : t.kind === "after" ? Ut(t.cursor) : t.kind === "before" ? Math.max(0, Ut(t.cursor) - n) : Math.max(0, o - t.count), i = e.slice(s, s + n), c = s + i.length, d = c < o, p = s > 0;
189
- return {
190
- slice: i,
191
- pageInfo: {
192
- hasNextPage: d,
193
- endCursor: d ? zt(c) : null,
194
- hasPreviousPage: p,
195
- startCursor: p ? zt(s) : null,
196
- totalCount: o,
197
- totalNrOfPages: r
198
- }
199
- };
200
- }
201
- const rr = /* @__PURE__ */ new Map([
202
- ["COMPLETED", (e) => {
203
- var t;
204
- return ((t = e.progress) == null ? void 0 : t.status) === "complete";
205
- }],
206
- ["IN_PROGRESS", (e) => {
207
- var t;
208
- return ((t = e.progress) == null ? void 0 : t.status) === "in_progress";
209
- }],
210
- ["INCOMPLETE", (e) => {
211
- var t;
212
- return ((t = e.progress) == null ? void 0 : t.status) !== "complete";
213
- }],
214
- [
215
- "NOT_STARTED",
216
- (e) => {
217
- var t, n;
218
- return ((t = e.progress) == null ? void 0 : t.status) !== "complete" && ((n = e.progress) == null ? void 0 : n.status) !== "in_progress";
219
- }
220
- ]
221
- ]), sr = /* @__PURE__ */ new Map([
222
- ["locked", (e) => {
223
- var t;
224
- return ((t = e.progress) == null ? void 0 : t.status) === "locked";
225
- }],
226
- ["missing", (e) => {
227
- var t;
228
- return ((t = e.progress) == null ? void 0 : t.status) === "missing";
229
- }],
230
- ["missing_and_incomplete", (e) => {
231
- var t;
232
- return ((t = e.progress) == null ? void 0 : t.status) === "missing_and_incomplete";
233
- }],
234
- ["incomplete", (e) => {
235
- var t;
236
- return ((t = e.progress) == null ? void 0 : t.status) === "incomplete";
237
- }],
238
- ["complete", (e) => {
239
- var t;
240
- return ((t = e.progress) == null ? void 0 : t.status) === "complete";
241
- }],
242
- ["in_progress", (e) => {
243
- var t;
244
- return ((t = e.progress) == null ? void 0 : t.status) === "in_progress";
245
- }],
246
- ["not_started", (e) => {
247
- var t;
248
- return ((t = e.progress) == null ? void 0 : t.status) === "not_started";
249
- }]
250
- ]), ir = {
251
- module: { completionStatus: ["eq"], moduleStatus: ["eq"], dueWithinDays: ["within"] }
252
- };
253
- function ar(e) {
254
- const t = Date.parse(e.start), n = Date.parse(e.end);
255
- return (o) => {
256
- var i;
257
- const r = (i = o.progress) == null ? void 0 : i.nextDueAt;
258
- if (!r) return !1;
259
- const s = Date.parse(r);
260
- return s >= t && s <= n;
261
- };
262
- }
263
- function lr(e, t) {
264
- if (e.target === "module" && e.field === "completionStatus" && e.op === "eq") {
265
- const n = typeof e.value == "string" ? rr.get(e.value) : void 0;
266
- if (!n) throw new Error(`unknown completionStatus "${String(e.value)}"`);
267
- return n;
268
- }
269
- if (e.target === "module" && e.field === "moduleStatus" && e.op === "eq") {
270
- const n = typeof e.value == "string" ? sr.get(e.value) : void 0;
271
- if (!n) throw new Error(`unknown moduleStatus "${String(e.value)}"`);
272
- return n;
273
- }
274
- if (e.target === "module" && e.field === "dueWithinDays" && e.op === "within") {
275
- if (!t) throw new Error("A dueWithinDays clause needs a dueRange");
276
- return ar(t);
277
- }
278
- throw new Error(`in-memory adapter cannot compile ${e.target}.${e.field} ${e.op}`);
279
- }
280
- function Uc(e, t = {}) {
281
- const n = (s) => e.itemsByModuleId[s] ?? [], o = (s) => {
282
- let i = 0;
283
- return n(s).map(
284
- (c) => c.type === "sub_header" ? c : { ...c, itemNumber: ++i }
285
- );
286
- }, r = (s) => {
287
- if (s !== e.courseId)
288
- throw new or(e.courseId, s);
289
- };
290
- return {
291
- capabilities: ir,
292
- async listModules({
293
- courseId: s,
294
- page: i = { kind: "first" },
295
- pageSize: c,
296
- includeItems: d,
297
- filter: p,
298
- dueRange: h,
299
- inlineItemsFirst: g,
300
- signal: f
301
- }) {
302
- var v;
303
- Ue(f), r(s), (v = t.onRequest) == null || v.call(t, "listModules", { operation: "listModules", courseId: s });
304
- const M = p ? e.modules.filter(lr(p, h)) : e.modules, { slice: x, pageInfo: k } = $t(M, i, c), A = Math.min(g ?? qt, qt);
305
- return { modules: x.map((R) => {
306
- const D = n(R.id), E = d && D.length <= A;
307
- return { ...R, itemCount: D.length, items: E ? D : void 0 };
308
- }), pageInfo: k };
309
- },
310
- async listModuleItems({
311
- courseId: s,
312
- moduleId: i,
313
- page: c = { kind: "first" },
314
- pageSize: d,
315
- signal: p
316
- }) {
317
- var f;
318
- Ue(p), r(s), (f = t.onRequest) == null || f.call(t, "listModuleItems", { operation: "listModuleItems", courseId: s, moduleId: i });
319
- const { slice: h, pageInfo: g } = $t(o(i), c, d);
320
- return { items: h, pageInfo: g };
321
- },
322
- async setModuleCollapsed({
323
- courseId: s,
324
- moduleId: i,
325
- collapsed: c,
326
- signal: d
327
- }) {
328
- var h;
329
- Ue(d), r(s), (h = t.onRequest) == null || h.call(t, "setModuleCollapsed", {
330
- operation: "setModuleCollapsed",
331
- courseId: s,
332
- moduleId: i,
333
- collapsed: c
334
- });
335
- const p = e.modules.findIndex((g) => g.id === i);
336
- p !== -1 && (e.modules[p] = { ...e.modules[p], collapsed: c });
337
- },
338
- async setAllModulesCollapsed({
339
- courseId: s,
340
- collapsed: i,
341
- signal: c
342
- }) {
343
- var d;
344
- Ue(c), r(s), (d = t.onRequest) == null || d.call(t, "setAllModulesCollapsed", {
345
- operation: "setAllModulesCollapsed",
346
- courseId: s,
347
- collapsed: i
348
- }), e.modules = e.modules.map((p) => ({ ...p, collapsed: i }));
349
- }
350
- };
351
- }
352
- const Ie = ["platform-modules"], Ne = {
353
- all: Ie,
354
- course: (e) => [...Ie, e],
355
- list: (e, t = {}) => [...Ie, e, "list", t],
356
- items: (e, t, n = {}) => [...Ie, e, "module", t, "items", n]
357
- };
358
- function cr(e) {
359
- return [...Ie, e, "list"];
360
- }
361
- function Ge(e, t) {
362
- return [...Ie, e, "module", t, "items"];
363
- }
364
- function $c(e, t, n, o) {
365
- const r = o ? Ne.items(t, n, o) : Ge(t, n);
366
- return e.invalidateQueries({ queryKey: r });
367
- }
368
- function Bc(e, t, n) {
369
- const o = n ? Ne.list(t, n) : cr(t);
370
- return e.invalidateQueries({ queryKey: o });
371
- }
372
- function Wc(e, t) {
373
- return e.invalidateQueries({ queryKey: Ne.course(t) });
374
- }
375
- const it = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
376
- function Bt(e, t) {
377
- const n = Object.entries(t ?? {}).filter(([, o]) => o !== void 0);
378
- return { ...e, ...Object.fromEntries(n) };
379
- }
380
- function Gc(e, t = {}) {
381
- const n = Object.keys(e).map((r) => [
382
- r,
383
- Bt(e[r], it(t, r) ? t[r] : void 0)
384
- ]), o = Object.keys(t).filter((r) => !it(e, r)).sort().map((r) => [r, Bt({}, t[r])]);
385
- return Object.fromEntries([...n, ...o]);
386
- }
387
- function we(e, t) {
388
- if (!(!it(e, t) || e[t].hidden))
389
- return e[t];
390
- }
391
- function On(e) {
392
- return Object.keys(e).filter((t) => we(e, t) !== void 0).map((t) => ({ ...e[t], key: t })).sort((t, n) => t.order - n.order);
393
- }
394
- const ur = "Page %{page} of %{pageCount}", dr = "First page", mr = "Previous page", pr = "Next page", gr = "Last page", fr = "Page %{page}", hr = "…", br = "Expand all modules", yr = "Collapse all modules", Ir = { one: "Loading items in %{count} module…", other: "Loading items in %{count} modules…" }, Mr = "All items loaded", Tr = { one: "%{count} module expanded", other: "%{count} modules expanded" }, Sr = { one: "%{count} module collapsed", other: "%{count} modules collapsed" }, wr = "Modules failed to load: %{message}", vr = "Loading modules", Er = "No modules available yet", Pr = "Modules will appear here once your instructor publishes them. Check back soon or reach out to your instructor for more information.", Cr = "No matching results", _r = "Adjust or clear your filters to see more items.", Ar = "Clear filters", Dr = "Status", Lr = "All", xr = "Not started", Rr = "In progress", Nr = "Complete", Or = "Due soon", kr = "Missing", Fr = "Locked until %{name} is completed.", qr = "Locked until %{prerequisites} are completed.", zr = "%{count} prerequisites", Ur = "%{label}. %{name}", $r = "%{label} %{name}", Br = "%{name} progress", Wr = { one: "%{loaded} of %{count} item loaded in %{name}", other: "%{loaded} of %{count} items loaded in %{name}" }, Gr = "Items failed to load: %{message}", jr = "Loading items", Hr = "Loading…", Kr = "No items.", Yr = "%{name} items pages", Qr = "Page %{page} of %{pageCount} in %{name}", Vr = "(unpublished)", Zr = "Collapse %{name}", Xr = "Expand %{name}", Jr = "Not started", es = "In progress", ts = "All completed", ns = "%{count} Missing", os = "%{count} Incomplete", rs = "%{missing} & %{incomplete}", ss = "Locked", is = "Due soon", as = "Not started", ls = "In progress", cs = "Completed", us = "Incomplete", ds = "Missing", ms = "Locked", ps = "Due soon", gs = "Assignment", fs = "Quiz", hs = "Discussion", bs = "Page", ys = "File", Is = "External URL", Ms = "External tool", Ts = "Text header", Ss = "Item type", ws = "Due date", vs = "Points", Es = "Requirement", Ps = "Estimated duration", Cs = "Publish state", _s = "View the item", As = "Submit the assignment", Ds = "Contribute to the page", Ls = "Mark as done", xs = "Score at least the minimum", Rs = "Score at least %{count}", Ns = "Score at least the minimum percentage", Os = "Score at least %{count}%", ks = "Complete the requirement", Fs = "today, %{time}", qs = "yesterday, %{time}", zs = "tomorrow, %{time}", Us = "%{date}, %{time}", $s = "%{time} (%{zone})", Bs = "Due %{when}", Ws = "Past due %{when}", Gs = "Will unlock on %{when}", js = "Unlocked on %{when}", Hs = "%{duration} to complete", Ks = "%{duration} remaining", Ys = "%{hours}h %{minutes}m", Qs = "%{count}h", Vs = "%{count}m", Zs = { one: "%{count} pt", other: "%{count} pts" }, Xs = "%{met} of %{count}", Js = { one: "%{met} of %{count} requirement met", other: "%{met} of %{count} requirements met" }, ei = "%{percent}%", ti = { one: "%{completedModules} of %{totalModules} module complete", other: "%{completedModules} of %{totalModules} modules complete" }, ni = "(%{itemsSummary})", oi = { one: "%{completedItems} of %{totalItems} item", other: "%{completedItems} of %{totalItems} items" }, ri = "Module progress", si = "Module progress pages", ii = "Modules %{start}–%{end} of %{total}", ai = "%{name}: %{status}", li = "%{count}min", ci = "%{count}hr", ui = "%{hours}hr %{minutes}min", di = "Unpublished", mi = "Untitled item", pi = "opens in a new window", gi = "Organize with AI", fi = "Organize content into modules", hi = "Module progression", bi = "Set module prerequisites", yi = "Set item requirements per module", Ii = "Close", Mi = "What should this do?", Ti = "Place new content only", Si = "Reorganize the whole course", wi = "This rebuilds every module in the course. Existing modules can be renamed, refilled, or removed.", vi = "Content to organize", Ei = "Anything else it should know? (optional)", Pi = "For example: keep the lab work together and put it last.", Ci = "%{used}/%{max}", _i = "Choose at least one kind of content.", Ai = "Organize", Di = "Cancel", Li = "Start over", xi = "Regenerate", Ri = "Apply", Ni = "Try again", Oi = "Organizing your content…", ki = "Creating your modules…", Fi = "Still working. Large courses take longer.", qi = "Your proposal is ready to review.", zi = "Your modules were created.", Ui = "Your content could not be organized: %{message}", $i = "Your modules could not be created: %{message}", Bi = "Proposed modules", Wi = "New module", Gi = { one: "%{count} item added", other: "%{count} items added" }, ji = "New", Hi = "New placement", Ki = { one: "%{count} item was not placed", other: "%{count} items were not placed" }, Yi = "You can still apply this. Anything left out stays where it is.", Qi = { one: "%{count} thing to know", other: "%{count} things to know" }, Vi = "No modules yet", Zi = "Modules you add to this course appear here.", Xi = { one: "%{count} item", other: "%{count} items" }, Ji = "Complete all required items in any order", ea = "Complete all required items in order", ta = "Complete one required item", na = "Required", oa = "Optional", ra = "Required", sa = "Move %{name}", ia = "draggable", aa = "To pick up a module or item, press Space or Enter. Use the arrow keys to move it. Press Space or Enter again to drop it, or press Escape to cancel.", la = "Picked up %{name}.", ca = "%{name} is at position %{position} of %{count}.", ua = "%{name} is at position %{position} of %{count} in %{module}.", da = "%{name} is not over a drop position.", ma = "%{name} was dropped at position %{position} of %{count}.", pa = "%{name} was dropped at position %{position} of %{count} in %{module}.", ga = "%{name} was dropped. It did not move.", fa = "Moving %{name} was canceled.", ha = {
395
- pageChangedAnnouncement: ur,
396
- paginationFirstPage: dr,
397
- paginationPreviousPage: mr,
398
- paginationNextPage: pr,
399
- paginationLastPage: gr,
400
- paginationPageLabel: fr,
401
- paginationEllipsis: hr,
402
- expandAllModules: br,
403
- collapseAllModules: yr,
404
- expandAllLoadingItems: Ir,
405
- expandAllItemsLoaded: Mr,
406
- modulesExpandedAnnouncement: Tr,
407
- modulesCollapsedAnnouncement: Sr,
408
- modulesLoadErrorAlert: wr,
409
- modulesLoadingSpinnerLabel: vr,
410
- noModulesEmptyStateTitle: Er,
411
- noModulesEmptyStateDescription: Pr,
412
- filteredEmptyStateTitle: Cr,
413
- filteredEmptyStateDescription: _r,
414
- clearFilters: Ar,
415
- filterGroupLabel: Dr,
416
- filterAll: Lr,
417
- filterNotStarted: xr,
418
- filterInProgress: Rr,
419
- filterComplete: Nr,
420
- filterDueThisWeek: Or,
421
- filterMissing: kr,
422
- lockedByPrerequisiteByline: Fr,
423
- lockedByPrerequisitesByline: qr,
424
- lockedByPrerequisitesCount: zr,
425
- moduleNameWithLabel: Ur,
426
- itemNameWithLabel: $r,
427
- moduleProgressScreenReaderLabel: Br,
428
- itemsLoadedAnnouncement: Wr,
429
- itemsLoadErrorAlert: Gr,
430
- itemsLoadingSpinnerLabel: jr,
431
- itemsLoadingText: Hr,
432
- noItemsEmptyState: Kr,
433
- itemsPaginationLabel: Yr,
434
- itemsPageChangedAnnouncement: Qr,
435
- moduleUnpublishedBadge: Vr,
436
- collapseModule: Zr,
437
- expandModule: Xr,
438
- moduleStatusNotStarted: Jr,
439
- moduleStatusInProgress: es,
440
- moduleStatusComplete: ts,
441
- moduleStatusMissing: ns,
442
- moduleStatusIncomplete: os,
443
- moduleStatusMissingAndIncomplete: rs,
444
- moduleStatusLocked: ss,
445
- moduleStatusDueSoon: is,
446
- itemStatusNotStarted: as,
447
- itemStatusInProgress: ls,
448
- itemStatusComplete: cs,
449
- itemStatusIncomplete: us,
450
- itemStatusMissing: ds,
451
- itemStatusLocked: ms,
452
- itemStatusDueSoon: ps,
453
- itemTypeAssignment: gs,
454
- itemTypeQuiz: fs,
455
- itemTypeDiscussion: hs,
456
- itemTypePage: bs,
457
- itemTypeFile: ys,
458
- itemTypeExternalUrl: Is,
459
- itemTypeExternalTool: Ms,
460
- itemTypeSubHeader: Ts,
461
- metaFieldTypeLabel: Ss,
462
- metaFieldDueAtLabel: ws,
463
- metaFieldPointsLabel: vs,
464
- metaFieldRequirementLabel: Es,
465
- metaFieldDurationLabel: Ps,
466
- metaFieldPublishStateLabel: Cs,
467
- requirementMustView: _s,
468
- requirementMustSubmit: As,
469
- requirementMustContribute: Ds,
470
- requirementMustMarkDone: Ls,
471
- requirementMinScoreUnknown: xs,
472
- requirementMinScore: Rs,
473
- requirementMinPercentageUnknown: Ns,
474
- requirementMinPercentage: Os,
475
- requirementUnknown: ks,
476
- dateTimeToday: Fs,
477
- dateTimeYesterday: qs,
478
- dateTimeTomorrow: zs,
479
- dateTimeWithDate: Us,
480
- timeWithZone: $s,
481
- dueByline: Bs,
482
- pastDueByline: Ws,
483
- unlockByline: Gs,
484
- unlockedByline: js,
485
- estimatedDurationByline: Hs,
486
- remainingDurationByline: Ks,
487
- estimatedDurationHoursAndMinutes: Ys,
488
- estimatedDurationHours: Qs,
489
- estimatedDurationMinutesAbbreviated: Vs,
490
- pointsAbbreviated: Zs,
491
- progressSummary: Xs,
492
- progressScreenReaderValue: Js,
493
- moduleProgressOverviewPercentLabel: ei,
494
- moduleProgressOverviewSummary: ti,
495
- moduleProgressOverviewDetail: ni,
496
- moduleProgressOverviewItemsSummary: oi,
497
- moduleProgressOverviewGroupLabel: ri,
498
- moduleProgressOverviewPaginationLabel: si,
499
- moduleProgressOverviewPageRange: ii,
500
- moduleProgressSegmentLabel: ai,
501
- durationMinutes: li,
502
- durationHours: ci,
503
- durationHoursAndMinutes: ui,
504
- itemUnpublishedLabel: di,
505
- itemUntitled: mi,
506
- opensInNewWindow: pi,
507
- organizeModulesTrigger: gi,
508
- organizeModalLabel: fi,
509
- organizeProgressionLegend: hi,
510
- organizeSetPrerequisites: bi,
511
- organizeSetRequirements: yi,
512
- organizeCloseModal: Ii,
513
- organizeModeLegend: Mi,
514
- organizeModePlaceNew: Ti,
515
- organizeModeReorganizeAll: Si,
516
- organizeReorganizeWarning: wi,
517
- organizeContentTypesLegend: vi,
518
- organizeDirectionLabel: Ei,
519
- organizeDirectionPlaceholder: Pi,
520
- organizeDirectionCount: Ci,
521
- organizeErrorPickAContentType: _i,
522
- organizeSubmit: Ai,
523
- organizeCancel: Di,
524
- organizeStartOver: Li,
525
- organizeRegenerate: xi,
526
- organizeApply: Ri,
527
- organizeTryAgain: Ni,
528
- organizeLoadingLabel: Oi,
529
- organizeApplyingLabel: ki,
530
- organizeStillWorking: Fi,
531
- organizeProposalReadyAnnouncement: qi,
532
- organizeAppliedAnnouncement: zi,
533
- organizeFailed: Ui,
534
- organizeApplyFailed: $i,
535
- organizePreviewHeading: Bi,
536
- organizeNewModuleLabel: Wi,
537
- organizeItemsAddedLabel: Gi,
538
- organizeNewItemPill: ji,
539
- metaFieldNewPlacementLabel: Hi,
540
- organizeUnplacedHeading: Ki,
541
- organizeUnplacedExplanation: Yi,
542
- organizeWarningsHeading: Qi,
543
- editNoModulesTitle: Vi,
544
- editNoModulesDescription: Zi,
545
- moduleItemCount: Xi,
546
- moduleRequirementAll: Ji,
547
- moduleRequirementAllInOrder: ea,
548
- moduleRequirementOne: ta,
549
- itemRequiredTag: na,
550
- itemOptionalTag: oa,
551
- moduleRequiredPill: ra,
552
- dragHandleLabel: sa,
553
- dragRoleDescription: ia,
554
- dragInstructions: aa,
555
- dragPickedUp: la,
556
- dragOverPosition: ca,
557
- dragOverPositionInModule: ua,
558
- dragOverNothing: da,
559
- dragDroppedPosition: ma,
560
- dragDroppedPositionInModule: pa,
561
- dragDroppedNowhere: ga,
562
- dragCanceled: fa
563
- }, ba = /%\{(\w+)\}/g, ya = ha, le = "en-US", Ia = /* @__PURE__ */ new Map(), Ma = /* @__PURE__ */ new Map();
564
- function kn(e, t, n) {
565
- const o = e.get(t);
566
- if (o) return o;
567
- const r = n();
568
- return e.set(t, r), r;
569
- }
570
- function Ta(e, t, n) {
571
- return n ? e.replace(ba, (o, r) => {
572
- if (!Object.prototype.hasOwnProperty.call(n, r)) return o;
573
- const s = n[r];
574
- return typeof s == "number" && Number.isFinite(s) ? kn(Ma, t, () => new Intl.NumberFormat(t)).format(s) : String(s);
575
- }) : e;
576
- }
577
- function Sa(e, t, n) {
578
- const o = n == null ? void 0 : n.count;
579
- if (typeof o == "number" && Number.isFinite(o)) {
580
- const r = kn(Ia, t, () => new Intl.PluralRules(t)).select(o), s = e[r];
581
- if (typeof s == "string") return s;
582
- }
583
- return typeof e.other == "string" ? e.other : void 0;
584
- }
585
- function Wt(e, t, n) {
586
- if (typeof e == "string") return e;
587
- if (e !== null && typeof e == "object")
588
- return Sa(e, t, n);
589
- }
590
- const Gt = /* @__PURE__ */ new Set();
591
- function wa(e) {
592
- Gt.has(e) || (Gt.add(e), console.warn(
593
- `[platform-modules] no translation for "${e}"; it will render as itself. Add it to the catalog passed to ModulesI18nProvider.`
594
- ));
595
- }
596
- function va(e, t, n, o, r) {
597
- const s = Wt(e == null ? void 0 : e[t], n, r);
598
- if (typeof s == "string") return s;
599
- const i = Wt(ya[t], n, r);
600
- return typeof i == "string" ? i : (o && wa(t), t);
601
- }
602
- function Fn(e, t = le, n = !1) {
603
- return (o, r) => Ta(va(e, o, t, n, r), t, r);
604
- }
605
- const Ea = Fn(), Pa = { t: Ea, locale: le }, at = dt(null);
606
- function jc({
607
- translations: e,
608
- locale: t,
609
- timezone: n,
610
- warnOnMissingKey: o,
611
- children: r
612
- }) {
613
- const s = Ye(at), i = G(() => {
614
- const c = (s == null ? void 0 : s.translations) === void 0 ? e : { ...s.translations, ...e }, d = t ?? (s == null ? void 0 : s.locale) ?? le;
615
- return {
616
- t: Fn(c, d, o),
617
- locale: d,
618
- timezone: n ?? (s == null ? void 0 : s.timezone),
619
- translations: c
620
- };
621
- }, [s, e, t, n, o]);
622
- return /* @__PURE__ */ l(at.Provider, { value: i, children: r });
623
- }
624
- function X() {
625
- return Ye(at) ?? Pa;
626
- }
627
- const lt = 864e5, ct = "en-US", jt = /* @__PURE__ */ new Map(), Ht = /* @__PURE__ */ new Map();
628
- function Ca(e) {
629
- const t = Ht.get(e);
630
- if (t) return t;
631
- const n = new Intl.NumberFormat(e, { useGrouping: !1 });
632
- return Ht.set(e, n), n;
633
- }
634
- function Kt(e, t) {
635
- return {
636
- time: new Intl.DateTimeFormat(e, {
637
- hour: "numeric",
638
- minute: "2-digit",
639
- timeZone: t
640
- }),
641
- day: new Intl.DateTimeFormat(e, { month: "long", day: "numeric", timeZone: t }),
642
- dayYear: new Intl.DateTimeFormat(e, {
643
- month: "long",
644
- day: "numeric",
645
- year: "numeric",
646
- timeZone: t
647
- }),
648
- zone: t ? new Intl.DateTimeFormat(e, { timeZone: t, timeZoneName: "short" }) : void 0,
649
- civilDay: new Intl.DateTimeFormat(ct, {
650
- year: "numeric",
651
- month: "numeric",
652
- day: "numeric",
653
- timeZone: t
654
- })
655
- };
656
- }
657
- function yt(e, t) {
658
- const n = t || void 0, o = `${e}|${n ?? ""}`, r = jt.get(o);
659
- if (r) return r;
660
- let s;
661
- try {
662
- s = Kt(e, n);
663
- } catch {
664
- console.warn(
665
- `[platform-modules] Unusable timezone ${JSON.stringify(n)}; rendering dates in the viewer's own clock instead.`
666
- ), s = Kt(e, void 0);
667
- }
668
- return jt.set(o, s), s;
669
- }
670
- function Yt(e, t) {
671
- return new Date(je(e, t)).getUTCFullYear();
672
- }
673
- function _a(e, t) {
674
- var o;
675
- const n = (o = e.zone) == null ? void 0 : o.formatToParts(t).find((r) => r.type === "timeZoneName");
676
- return (n == null ? void 0 : n.value) ?? null;
677
- }
678
- function qn(e, t) {
679
- var n;
680
- return Number((n = e.find((o) => o.type === t)) == null ? void 0 : n.value);
681
- }
682
- function je(e, t) {
683
- const n = e.civilDay.formatToParts(t), o = (r) => qn(n, r);
684
- return Date.UTC(o("year"), o("month") - 1, o("day"));
685
- }
686
- function Aa(e, t, n) {
687
- return Wn(yt(le, n), e, t);
688
- }
689
- const Qt = {
690
- hour12: !1,
691
- year: "numeric",
692
- month: "numeric",
693
- day: "numeric",
694
- hour: "numeric",
695
- minute: "numeric",
696
- second: "numeric"
697
- }, Vt = /* @__PURE__ */ new Map();
698
- function Da(e) {
699
- const t = e || void 0, n = t ?? "", o = Vt.get(n);
700
- if (o) return o;
701
- let r;
702
- try {
703
- r = new Intl.DateTimeFormat(ct, { ...Qt, timeZone: t });
704
- } catch {
705
- r = new Intl.DateTimeFormat(ct, Qt);
706
- }
707
- return Vt.set(n, r), r;
708
- }
709
- function Zt(e, t) {
710
- const n = Da(e).formatToParts(t), o = (s) => qn(n, s);
711
- return Date.UTC(
712
- o("year"),
713
- o("month") - 1,
714
- o("day"),
715
- o("hour") % 24,
716
- o("minute"),
717
- o("second")
718
- ) - Math.floor(t.getTime() / 1e3) * 1e3;
719
- }
720
- function Xt(e, t) {
721
- const n = je(yt(le, t), e), o = new Date(n - Zt(t, e));
722
- return n - Zt(t, o);
723
- }
724
- function La(e, t, n) {
725
- const o = Xt(e, n), r = new Date(o + t * lt + lt / 2);
726
- return {
727
- start: e.toISOString(),
728
- end: new Date(Xt(r, n) - 1).toISOString()
729
- };
730
- }
731
- const zn = 7;
732
- function Un(e) {
733
- if (!e) return null;
734
- const t = new Date(e);
735
- return Number.isNaN(t.getTime()) ? null : t;
736
- }
737
- function $n(e, t, n) {
738
- const o = Un(e);
739
- return o === null || Bn(e, t) ? !1 : Aa(o, t, n) < zn;
740
- }
741
- function Bn(e, t) {
742
- const n = Un(e);
743
- return n !== null && n.getTime() < t.getTime();
744
- }
745
- function Wn(e, t, n) {
746
- return Math.round((je(e, t) - je(e, n)) / lt);
747
- }
748
- function xa(e, t, n, { locale: o = le, timezone: r } = {}) {
749
- const s = new Date(t);
750
- if (Number.isNaN(s.getTime())) return t;
751
- const i = yt(o, r), c = _a(i, s), d = i.time.format(s), p = c ? e("timeWithZone", { time: d, zone: c }) : d, h = Wn(i, s, n);
752
- if (h === 0) return e("dateTimeToday", { time: p });
753
- if (h === -1) return e("dateTimeYesterday", { time: p });
754
- if (h === 1) return e("dateTimeTomorrow", { time: p });
755
- const f = Yt(i, s) === Yt(i, n) ? i.day.format(s) : i.dayYear.format(s);
756
- return e("dateTimeWithDate", { date: f, time: p });
757
- }
758
- function Gn(e, t = le) {
759
- return !Number.isInteger(e) || e < 1 ? null : Ca(t).format(e);
760
- }
761
- function Ra(e, t, n = le) {
762
- if (!e || t === void 0) return null;
763
- const o = Gn(t, n);
764
- return o === null ? null : `${e}.${o}`;
765
- }
766
- function Na(e, t) {
767
- return t == null ? null : e("pointsAbbreviated", { count: t });
768
- }
769
- function Oa(e, t) {
770
- switch (t.type) {
771
- case "must_view":
772
- return e("requirementMustView");
773
- case "must_submit":
774
- return e("requirementMustSubmit");
775
- case "must_contribute":
776
- return e("requirementMustContribute");
777
- case "must_mark_done":
778
- return e("requirementMustMarkDone");
779
- case "min_score":
780
- return t.minScore === null || t.minScore === void 0 ? e("requirementMinScoreUnknown") : e("requirementMinScore", { count: t.minScore });
781
- case "min_percentage":
782
- return t.minPercentage === null || t.minPercentage === void 0 ? e("requirementMinPercentageUnknown") : e("requirementMinPercentage", { count: t.minPercentage });
783
- case "unknown":
784
- return e("requirementUnknown");
785
- }
786
- }
787
- function ka(e, t, n) {
788
- return e("progressSummary", { met: t, count: n });
789
- }
790
- function Hc(e, t, n) {
791
- return e("progressScreenReaderValue", { met: t, count: n });
792
- }
793
- function Fa(e) {
794
- if (!e) return null;
795
- const t = e.map((n) => xn(n)).filter((n) => n !== null);
796
- return t.length === 0 ? null : t.reduce((n, o) => n + o, 0);
797
- }
798
- function Kc(e) {
799
- if (!e) return null;
800
- const t = e.filter((n) => n.status !== void 0 && n.status !== "complete");
801
- return Fa(t);
802
- }
803
- function jn(e) {
804
- return { hours: Math.floor(e / 60), mins: e % 60 };
805
- }
806
- function Hn(e, t) {
807
- const { hours: n, mins: o } = jn(t);
808
- return n > 0 && o > 0 ? e("estimatedDurationHoursAndMinutes", { hours: n, minutes: o }) : n > 0 ? e("estimatedDurationHours", { count: n }) : e("estimatedDurationMinutesAbbreviated", { count: o });
809
- }
810
- function qa(e, t) {
811
- return e("estimatedDurationByline", { duration: Hn(e, t) });
812
- }
813
- function za(e, t) {
814
- return e("remainingDurationByline", { duration: Hn(e, t) });
815
- }
816
- function Ua(e, t) {
817
- const { hours: n, mins: o } = jn(t);
818
- return n > 0 && o > 0 ? e("durationHoursAndMinutes", { hours: n, minutes: o }) : n > 0 ? e("durationHours", { count: n }) : e("durationMinutes", { count: o });
819
- }
820
- const $a = "all", Ba = zn, Wa = {
821
- all: {
822
- label: "filterAll",
823
- order: 10,
824
- unfiltered: !0,
825
- predicate: () => !0
826
- },
827
- not_started: {
828
- label: "filterNotStarted",
829
- order: 15,
830
- predicate: (e) => {
831
- var t;
832
- return ((t = e.progress) == null ? void 0 : t.status) === "not_started";
833
- },
834
- query: { target: "module", field: "moduleStatus", op: "eq", value: "not_started" }
835
- },
836
- in_progress: {
837
- label: "filterInProgress",
838
- order: 20,
839
- predicate: (e) => {
840
- var t;
841
- return ((t = e.progress) == null ? void 0 : t.status) === "in_progress";
842
- },
843
- query: { target: "module", field: "moduleStatus", op: "eq", value: "in_progress" }
844
- },
845
- complete: {
846
- label: "filterComplete",
847
- order: 30,
848
- predicate: (e) => {
849
- var t;
850
- return ((t = e.progress) == null ? void 0 : t.status) === "complete";
851
- },
852
- query: { target: "module", field: "completionStatus", op: "eq", value: "COMPLETED" }
853
- },
854
- due_this_week: {
855
- label: "filterDueThisWeek",
856
- order: 40,
857
- predicate: (e, { today: t, timezone: n }) => {
858
- var o;
859
- return $n((o = e.progress) == null ? void 0 : o.nextDueAt, t, n);
860
- },
861
- query: {
862
- target: "module",
863
- field: "dueWithinDays",
864
- op: "within",
865
- value: Ba
866
- }
867
- },
868
- missing: {
869
- label: "filterMissing",
870
- order: 50,
871
- predicate: (e) => {
872
- var t;
873
- return ((t = e.progress) == null ? void 0 : t.status) === "missing";
874
- },
875
- query: { target: "module", field: "moduleStatus", op: "eq", value: "missing" }
876
- }
877
- };
878
- function It(e) {
879
- return e == null ? void 0 : e.query;
880
- }
881
- function Kn(e) {
882
- return (e == null ? void 0 : e.unfiltered) === !0;
883
- }
884
- function Jt(e) {
885
- return e !== void 0 && !Kn(e);
886
- }
887
- function Ga(e) {
888
- return e !== void 0 && It(e) === void 0;
889
- }
890
- const ja = {
891
- moduleLabel: (e, t, { locale: n }) => Gn(e, n),
892
- dateTime: (e, t, { t: n, locale: o, timezone: r }) => xa(n, e, t, { locale: o, timezone: r }),
893
- points: (e, { t }) => Na(t, e),
894
- progress: (e, t, n, { t: o }) => ka(o, t, n)
895
- }, ne = { size: "xs", color: "mutedColor" }, Ha = {
896
- assignment: {
897
- label: "itemTypeAssignment",
898
- order: 10,
899
- icon: /* @__PURE__ */ l(Ao, { ...ne })
900
- },
901
- quiz: { label: "itemTypeQuiz", order: 20, icon: /* @__PURE__ */ l(_o, { ...ne }) },
902
- discussion: {
903
- label: "itemTypeDiscussion",
904
- order: 30,
905
- icon: /* @__PURE__ */ l(Co, { ...ne })
906
- },
907
- page: { label: "itemTypePage", order: 40, icon: /* @__PURE__ */ l(Po, { ...ne }) },
908
- file: { label: "itemTypeFile", order: 50, icon: /* @__PURE__ */ l(Eo, { ...ne }) },
909
- external_url: {
910
- label: "itemTypeExternalUrl",
911
- order: 60,
912
- icon: /* @__PURE__ */ l(vo, { ...ne })
913
- },
914
- external_tool: {
915
- label: "itemTypeExternalTool",
916
- order: 70,
917
- icon: /* @__PURE__ */ l(wo, { ...ne })
918
- },
919
- sub_header: { label: "itemTypeSubHeader", order: 80, icon: null }
920
- }, Yc = "type", Ka = { fontSizeMedium: "inherit" }, en = /* @__PURE__ */ l(pt, { ...ne });
921
- function tn({ item: e, today: t }) {
922
- return e.status !== "complete" && e.status !== "locked" && Bn(e.dueAt, t);
923
- }
924
- const Ya = {
925
- type: {
926
- label: "metaFieldTypeLabel",
927
- order: 10,
928
- renderIcon: ({ item: e, config: t }) => {
929
- const n = we(t.itemTypes, e.type);
930
- return n ? n.renderIcon ? n.renderIcon({ item: e }) : n.icon : null;
931
- },
932
- render: ({ item: e, t, config: n }) => {
933
- const o = we(n.itemTypes, e.type);
934
- return o ? t(o.label) : null;
935
- }
936
- },
937
- points: {
938
- label: "metaFieldPointsLabel",
939
- order: 20,
940
- render: ({ item: e, formatters: t }) => t.points(e.pointsPossible)
941
- },
942
- requirement: {
943
- label: "metaFieldRequirementLabel",
944
- order: 30,
945
- render: ({ item: e, t }) => e.completionRequirement ? Oa(t, e.completionRequirement) : null
946
- },
947
- dueAt: {
948
- label: "metaFieldDueAtLabel",
949
- order: 40,
950
- icon: en,
951
- /** Only the shipped glyph reddens; a host that cleared or replaced it keeps what it set. */
952
- renderIcon: (e) => {
953
- var n;
954
- const t = (n = e.config.itemMeta.dueAt) == null ? void 0 : n.icon;
955
- return t !== en || !tn(e) ? t : /* @__PURE__ */ l(pt, { ...ne, color: "errorColor" });
956
- },
957
- render: (e) => {
958
- const { item: t, today: n, formatters: o } = e;
959
- return t.dueAt ? tn(e) ? /* @__PURE__ */ l(ue, { color: "danger", themeOverride: Ka, children: o.pastDueByline(t.dueAt, n) }) : o.dueByline(t.dueAt, n) : null;
960
- }
961
- },
962
- estimatedDuration: {
963
- label: "metaFieldDurationLabel",
964
- order: 50,
965
- icon: /* @__PURE__ */ l(Do, { ...ne }),
966
- render: ({ item: e, t }) => {
967
- const n = xn(e);
968
- return n === null ? null : Ua(t, n);
969
- }
970
- },
971
- unpublished: {
972
- label: "metaFieldPublishStateLabel",
973
- order: 60,
974
- render: ({ item: e, t }) => e.published ? null : t("itemUnpublishedLabel")
975
- }
976
- }, Mt = {
977
- formatters: ja,
978
- itemTypes: Ha,
979
- itemStatuses: {},
980
- itemMeta: Ya,
981
- filters: Wa,
982
- moduleActions: {},
983
- itemActions: {},
984
- navigation: {},
985
- permissions: {},
986
- notify: void 0
987
- };
988
- Object.freeze(Mt);
989
- for (const e of Object.values(Mt)) {
990
- Object.freeze(e);
991
- for (const t of Object.values(e ?? {})) Object.freeze(t);
992
- }
993
- function Qa(e, t) {
994
- return On(e).filter((n) => {
995
- if (Kn(n)) return !1;
996
- const o = It(n);
997
- return o === void 0 ? !0 : !Wo(t, o);
998
- }).map((n) => n.key);
999
- }
1000
- function nn(e) {
1001
- return `[platform-modules] the adapter cannot serve filter(s): ${e.join(", ")}. Give the entry a query the adapter's capabilities declare, or mark it unfiltered.`;
1002
- }
1003
- function Va(e, t) {
1004
- const n = Qa(e, t);
1005
- if (n.length === 0) return e;
1006
- if (process.env.NODE_ENV !== "production")
1007
- throw new Error(nn(n));
1008
- console.warn(nn(n));
1009
- const o = Object.fromEntries(n.map((r) => [r, { ...e[r], hidden: !0 }]));
1010
- return { ...e, ...o };
1011
- }
1012
- const Yn = dt(null);
1013
- function Qc({ value: e, children: t }) {
1014
- return /* @__PURE__ */ l(Yn.Provider, { value: e, children: t });
1015
- }
1016
- function Qe() {
1017
- return Ye(Yn) ?? Mt;
1018
- }
1019
- function Vc(e) {
1020
- return we(Qe().itemMeta, e) !== void 0;
1021
- }
1022
- const Oe = a.object({
1023
- label: a.string(),
1024
- order: a.number(),
1025
- hidden: a.boolean().optional()
1026
- });
1027
- function ye(e) {
1028
- return a.record(a.string(), e);
1029
- }
1030
- const Za = ye(Oe.strict()), Tt = (e) => e == null || typeof e == "string" || typeof e == "number" || typeof e == "bigint" || typeof e == "boolean" || mt(e) || Array.isArray(e) && e.every(Tt), Qn = (e) => {
1031
- var t;
1032
- return e == null || typeof e == "function" && !((t = e.prototype) != null && t.isReactComponent);
1033
- }, Xa = Oe.extend({
1034
- icon: a.custom(Tt, { message: "icon must be a ReactNode" }),
1035
- renderIcon: a.custom(Qn, {
1036
- message: "renderIcon must be a function of the item, not a React component"
1037
- })
1038
- }).strict(), Vn = (e) => {
1039
- var t;
1040
- return typeof e == "function" && !((t = e.prototype) != null && t.isReactComponent);
1041
- }, on = (e) => e == null || Vn(e), rn = Oe.extend({
1042
- onSelect: a.custom(Vn, {
1043
- message: "onSelect must be a function taking an ActionContext"
1044
- }),
1045
- visible: a.custom(on, {
1046
- message: "visible must be a function taking an ActionContext, not a React component"
1047
- }),
1048
- renderModal: a.custom(on, {
1049
- message: "renderModal must be a function taking an ActionContext, not a React component"
1050
- })
1051
- }).strict();
1052
- function $e() {
1053
- return a.custom((e) => typeof e == "function", {
1054
- message: "Expected a function"
1055
- });
1056
- }
1057
- const Ja = Oe.extend({
1058
- render: a.custom((e) => typeof e == "function", {
1059
- message: "render must be a function taking a MetaFieldContext"
1060
- }),
1061
- icon: a.custom(Tt, { message: "icon must be a ReactNode" }),
1062
- renderIcon: a.custom(Qn, {
1063
- message: "renderIcon must be a function of the field context, not a React component"
1064
- })
1065
- }).strict(), el = Oe.extend({
1066
- predicate: a.custom((e) => typeof e == "function", {
1067
- message: "predicate must be a function of the module and a FilterContext"
1068
- }),
1069
- query: Bo.optional(),
1070
- unfiltered: a.boolean().optional()
1071
- }).strict(), xe = () => a.custom((e) => typeof e == "function", { message: "Expected a function" }).optional(), tl = a.object({
1072
- getItemHref: xe(),
1073
- getItemEditHref: xe(),
1074
- getModuleHref: xe(),
1075
- onItemClick: xe()
1076
- }).strict(), nl = a.object({
1077
- createModule: a.boolean().optional(),
1078
- updateModule: a.boolean().optional(),
1079
- deleteModule: a.boolean().optional(),
1080
- reorderModules: a.boolean().optional(),
1081
- setModulesPublished: a.boolean().optional(),
1082
- createModuleItem: a.boolean().optional(),
1083
- updateModuleItem: a.boolean().optional(),
1084
- deleteModuleItem: a.boolean().optional(),
1085
- reorderModuleItems: a.boolean().optional()
1086
- }).strict(), Zc = a.object({
1087
- formatters: a.object({
1088
- moduleLabel: $e(),
1089
- dateTime: $e(),
1090
- points: $e(),
1091
- progress: $e()
1092
- }).strict(),
1093
- itemTypes: ye(Xa),
1094
- itemStatuses: Za,
1095
- itemMeta: ye(Ja),
1096
- filters: ye(el),
1097
- moduleActions: ye(rn),
1098
- itemActions: ye(rn),
1099
- navigation: tl,
1100
- permissions: nl,
1101
- notify: xe()
1102
- });
1103
- function Zn() {
1104
- const { formatters: e } = Qe(), { t, locale: n, timezone: o } = X();
1105
- return G(() => {
1106
- const r = { t, locale: n, timezone: o }, s = (i, c) => e.dateTime(i, c, r);
1107
- return {
1108
- moduleLabel: (i, c) => e.moduleLabel(i, c, r) || null,
1109
- dueByline: (i, c) => t("dueByline", { when: s(i, c) }),
1110
- pastDueByline: (i, c) => t("pastDueByline", { when: s(i, c) }),
1111
- unlockByline: (i, c) => t("unlockByline", { when: s(i, c) }),
1112
- unlockedByline: (i, c) => t("unlockedByline", { when: s(i, c) }),
1113
- estimatedDurationByline: (i) => qa(t, i),
1114
- remainingDurationByline: (i) => za(t, i),
1115
- points: (i) => e.points(i, r),
1116
- progress: (i, c, d) => e.progress(i, c, d, r)
1117
- };
1118
- }, [e, t, n, o]);
1119
- }
1120
- const St = 10, ol = 4, rl = 20, Xn = 100, sl = 4, il = 4, wt = 5 * 60 * 1e3, Jn = 20;
1121
- function eo(e) {
1122
- const {
1123
- courseId: t,
1124
- adapter: n,
1125
- page: o,
1126
- pageSize: r,
1127
- includeItems: s,
1128
- filter: i,
1129
- dueRange: c,
1130
- inlineItemsFirst: d,
1131
- inlineFirst: p,
1132
- view: h,
1133
- staleTime: g,
1134
- enabled: f
1135
- } = e;
1136
- return {
1137
- // `inlineItemsFirst`/`inlineFirst` are deliberately out of the key: derived from this list.
1138
- queryKey: Ne.list(t, { view: h, pageSize: r, includeItems: s, filter: i, page: o }),
1139
- queryFn: ({ signal: M }) => n.listModules({
1140
- courseId: t,
1141
- page: o,
1142
- pageSize: r,
1143
- includeItems: s,
1144
- filter: i,
1145
- dueRange: c,
1146
- inlineItemsFirst: d,
1147
- inlineFirst: p,
1148
- signal: M
1149
- }),
1150
- enabled: f,
1151
- staleTime: g,
1152
- refetchOnWindowFocus: !1
1153
- };
1154
- }
1155
- function al(e) {
1156
- const { courseId: t, moduleId: n, adapter: o, page: r, pageSize: s, view: i, staleTime: c, enabled: d, limit: p } = e;
1157
- return {
1158
- queryKey: Ne.items(t, n, { view: i, pageSize: s, page: r }),
1159
- queryFn: ({ signal: h }) => {
1160
- const g = () => o.listModuleItems({ courseId: t, moduleId: n, page: r, pageSize: s, signal: h });
1161
- return p ? p(() => {
1162
- if (h.aborted)
1163
- throw new DOMException("The operation was aborted.", "AbortError");
1164
- return g();
1165
- }) : g();
1166
- },
1167
- placeholderData: Mn,
1168
- enabled: d,
1169
- staleTime: c,
1170
- refetchOnWindowFocus: !1
1171
- };
1172
- }
1173
- const He = { request: { kind: "first" }, page: 1 };
1174
- function Re(e, t) {
1175
- return e === null ? 1 : Math.max(1, Math.ceil(e / t));
1176
- }
1177
- function ll(e, t, n, o) {
1178
- switch (e) {
1179
- case "first":
1180
- return He;
1181
- case "previous":
1182
- return t === 2 ? He : n.hasPreviousPage && n.startCursor !== null ? { request: { kind: "before", cursor: n.startCursor }, page: t - 1 } : null;
1183
- case "next":
1184
- return n.hasNextPage && n.endCursor !== null ? { request: { kind: "after", cursor: n.endCursor }, page: t + 1 } : null;
1185
- case "last": {
1186
- const r = n.totalCount;
1187
- return r === null ? null : {
1188
- request: { kind: "last", count: r % o || o },
1189
- page: Re(r, o)
1190
- };
1191
- }
1192
- }
1193
- }
1194
- const tt = { kind: "first" }, cl = {
1195
- hasNextPage: !1,
1196
- endCursor: null,
1197
- hasPreviousPage: !1,
1198
- startCursor: null,
1199
- totalCount: null,
1200
- totalNrOfPages: null
1201
- };
1202
- function ul(e) {
1203
- var J, se, ce;
1204
- const {
1205
- courseId: t,
1206
- adapter: n,
1207
- pageSize: o = St,
1208
- includeItems: r = !1,
1209
- filter: s,
1210
- dueRange: i,
1211
- inlineItemsFirst: c,
1212
- inlineFirst: d,
1213
- view: p,
1214
- staleTime: h = wt,
1215
- enabled: g = !0
1216
- } = e, [f, M] = oe(tt), [x, k] = oe(1), A = JSON.stringify([t, p, o, r, s]), S = _(A);
1217
- me(() => {
1218
- S.current !== A && (S.current = A, M(tt), k(1));
1219
- }, [A]);
1220
- const v = Tn({
1221
- ...eo({
1222
- courseId: t,
1223
- adapter: n,
1224
- page: f,
1225
- pageSize: o,
1226
- includeItems: r,
1227
- filter: s,
1228
- dueRange: i,
1229
- inlineItemsFirst: c,
1230
- inlineFirst: d,
1231
- view: p,
1232
- staleTime: h,
1233
- enabled: g
1234
- }),
1235
- // `useItemsMode` shares `modulesQueryOptions`, and `inlineFirst` is out of that key.
1236
- placeholderData: Mn
1237
- }), R = _(null);
1238
- ((J = v.data) == null ? void 0 : J.pageInfo.totalCount) != null && (R.current = v.data.pageInfo.totalCount);
1239
- const D = _(1);
1240
- v.isPlaceholderData || (D.current = x);
1241
- const E = D.current, w = ((se = v.data) == null ? void 0 : se.pageInfo) ?? cl, T = ((ce = v.data) == null ? void 0 : ce.modules) ?? [], L = w.totalCount, Q = Re(L, o), j = O(() => {
1242
- M(tt), k(1);
1243
- }, []), H = w.hasPreviousPage, K = w.startCursor, I = O(() => {
1244
- !H || K === null || (M({ kind: "before", cursor: K }), k(E - 1));
1245
- }, [H, K, E]), q = w.hasNextPage, C = w.endCursor, re = O(() => {
1246
- !q || C === null || (M({ kind: "after", cursor: C }), k(E + 1));
1247
- }, [q, C, E]), $ = O(() => {
1248
- const ee = R.current, V = ee !== null && ee > 0 && ee % o || o;
1249
- M({ kind: "last", count: V }), k(Q);
1250
- }, [o, Q]);
1251
- return {
1252
- modules: T,
1253
- pageInfo: w,
1254
- page: E,
1255
- pageCount: Q,
1256
- hasNextPage: q,
1257
- hasPreviousPage: H,
1258
- goToFirstPage: j,
1259
- goToPreviousPage: I,
1260
- goToNextPage: re,
1261
- goToLastPage: $,
1262
- isLoading: v.isLoading,
1263
- isPending: v.isPending,
1264
- isPlaceholderData: v.isPlaceholderData,
1265
- error: v.error
1266
- };
1267
- }
1268
- const dl = { kind: "first" };
1269
- function ml(e, t, n = Nn) {
1270
- let o = 0, r = 0;
1271
- for (const s of e.modules) {
1272
- if (s.itemCount > t) return "onDemand";
1273
- o += s.itemCount, s.itemCount > r && (r = s.itemCount);
1274
- }
1275
- return o > t * 2 ? "onDemand" : Math.max(e.modules.length, 1) * Math.max(r, 1) <= n ? "inline" : "onDemand";
1276
- }
1277
- function pl(e) {
1278
- const {
1279
- courseId: t,
1280
- adapter: n,
1281
- mode: o = "auto",
1282
- inlineThreshold: r = Xn,
1283
- nodeBudget: s = n.inlineNodeBudget ?? Nn,
1284
- pageSize: i = St,
1285
- filter: c,
1286
- dueRange: d,
1287
- view: p,
1288
- staleTime: h = wt
1289
- } = e, g = o === "auto", f = Tn(
1290
- eo({
1291
- courseId: t,
1292
- adapter: n,
1293
- page: dl,
1294
- pageSize: i,
1295
- includeItems: !1,
1296
- filter: c,
1297
- dueRange: d,
1298
- view: p,
1299
- staleTime: h,
1300
- enabled: g
1301
- })
1302
- );
1303
- if (!g)
1304
- return {
1305
- resolvedMode: o,
1306
- isResolving: !1,
1307
- probed: !1,
1308
- error: null,
1309
- inlineShape: null
1310
- };
1311
- if (f.error)
1312
- return {
1313
- resolvedMode: "onDemand",
1314
- isResolving: !1,
1315
- probed: !0,
1316
- error: f.error,
1317
- inlineShape: null
1318
- };
1319
- const M = f.data;
1320
- return M ? {
1321
- resolvedMode: ml(M, r, s),
1322
- isResolving: !1,
1323
- probed: !0,
1324
- error: null,
1325
- inlineShape: gl(M)
1326
- } : { resolvedMode: null, isResolving: !0, probed: !0, error: null, inlineShape: null };
1327
- }
1328
- function gl(e) {
1329
- let t = 1;
1330
- for (const n of e.modules)
1331
- n.itemCount > t && (t = n.itemCount);
1332
- return { moduleCount: Math.max(e.modules.length, 1), maxItemCount: t };
1333
- }
1334
- const fl = `(max-width: ${So.mobileOnly.maxWidth})`;
1335
- function sn() {
1336
- return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia(fl);
1337
- }
1338
- function hl() {
1339
- const [e, t] = oe(() => {
1340
- var n;
1341
- return ((n = sn()) == null ? void 0 : n.matches) ?? !1;
1342
- });
1343
- return me(() => {
1344
- const n = sn();
1345
- if (n === null) return;
1346
- t(n.matches);
1347
- const o = (r) => t(r.matches);
1348
- return n.addEventListener("change", o), () => n.removeEventListener("change", o);
1349
- }, []), e;
1350
- }
1351
- const nt = "\0", bl = /* @__PURE__ */ new Map();
1352
- function yl(e, t, {
1353
- pageSize: n,
1354
- retainCollapsedLimit: o = Jn,
1355
- partition: r = ""
1356
- }) {
1357
- const s = Sn(), i = _(/* @__PURE__ */ new Map()), c = _(/* @__PURE__ */ new Map()), d = `${n}${nt}${r}`, p = _(d), [h, g] = oe(bl), f = e.join(nt), M = G(() => f === "" ? [] : f.split(nt), [f]);
1358
- me(() => {
1359
- const S = i.current, v = c.current;
1360
- p.current !== d && (v.clear(), p.current = d);
1361
- const R = () => {
1362
- g((T) => {
1363
- const L = /* @__PURE__ */ new Map();
1364
- let Q = T.size !== S.size;
1365
- for (const [j, H] of S) {
1366
- const K = H.getCurrentResult(), I = v.get(j), q = I ? K.isPlaceholderData ? I.shownPage : I.page : 1, C = T.get(j);
1367
- if (C && C.result === K && C.page === q) {
1368
- L.set(j, C);
1369
- continue;
1370
- }
1371
- L.set(j, { result: K, page: q }), Q = !0;
1372
- }
1373
- return Q ? L : T;
1374
- });
1375
- }, D = (T) => (v.get(T) ?? He).request, E = new Set(M);
1376
- for (const T of M) {
1377
- if (S.has(T)) continue;
1378
- const L = new Io(
1379
- s,
1380
- t(T, !0, D(T))
1381
- );
1382
- S.set(T, L), L.subscribe(R);
1383
- }
1384
- for (const [T, L] of S)
1385
- L.setOptions(t(T, E.has(T), D(T)));
1386
- for (const T of M) {
1387
- const L = S.get(T);
1388
- L && (S.delete(T), S.set(T, L));
1389
- }
1390
- let w = S.size - E.size;
1391
- if (w > o)
1392
- for (const [T, L] of S) {
1393
- if (w <= o) break;
1394
- E.has(T) || (L.destroy(), S.delete(T), v.delete(T), w -= 1);
1395
- }
1396
- R();
1397
- }, [s, t, M, o, d]), me(() => {
1398
- const S = i.current;
1399
- return () => {
1400
- for (const v of S.values()) v.destroy();
1401
- S.clear();
1402
- };
1403
- }, []);
1404
- const x = _(n);
1405
- x.current = n;
1406
- const k = _(t);
1407
- k.current = t;
1408
- const A = O((S, v) => {
1409
- const R = i.current.get(S), D = R == null ? void 0 : R.getCurrentResult();
1410
- if (!R || !(D != null && D.data) || D.isPlaceholderData) return;
1411
- const E = c.current.get(S) ?? He, w = ll(v, E.page, D.data.pageInfo, x.current);
1412
- !w || w.page === E.page || (c.current.set(S, { ...w, shownPage: E.page }), R.setOptions(
1413
- k.current(S, R.options.enabled !== !1, w.request)
1414
- ));
1415
- }, []);
1416
- return { entries: h, goToPage: A };
1417
- }
1418
- const Il = [];
1419
- function Xc(e) {
1420
- var Lt, xt;
1421
- const {
1422
- courseId: t,
1423
- adapter: n,
1424
- view: o,
1425
- itemsMode: r = "auto",
1426
- inlineThreshold: s = Xn,
1427
- pageSize: i = St,
1428
- mobilePageSize: c = ol,
1429
- itemPageSize: d = rl,
1430
- itemConcurrency: p = sl,
1431
- retainCollapsedLimit: h = Jn,
1432
- staleTime: g = wt,
1433
- initialExpandedModuleIds: f,
1434
- initialFilter: M = $a,
1435
- today: x
1436
- } = e, k = hl() ? c : i, A = Sn(), S = Qe(), [v, R] = oe(M), D = G(
1437
- () => Va(S.filters, n.capabilities),
1438
- [S.filters, n.capabilities]
1439
- ), E = we(D, v), w = It(E), { timezone: T } = X(), [L] = oe(() => /* @__PURE__ */ new Date()), Q = x ?? L, j = G(
1440
- () => (w == null ? void 0 : w.op) === "within" ? La(Q, Number(w.value), T) : void 0,
1441
- [w == null ? void 0 : w.op, w == null ? void 0 : w.value, Q, T]
1442
- ), H = pl({
1443
- courseId: t,
1444
- adapter: n,
1445
- mode: r,
1446
- inlineThreshold: s,
1447
- pageSize: k,
1448
- filter: w,
1449
- dueRange: j,
1450
- view: o,
1451
- staleTime: g
1452
- }), K = H.resolvedMode, I = ul({
1453
- courseId: t,
1454
- adapter: n,
1455
- pageSize: k,
1456
- filter: w,
1457
- dueRange: j,
1458
- view: o,
1459
- staleTime: g,
1460
- includeItems: K === "inline",
1461
- inlineItemsFirst: (Lt = H.inlineShape) == null ? void 0 : Lt.maxItemCount,
1462
- inlineFirst: (xt = H.inlineShape) == null ? void 0 : xt.moduleCount,
1463
- enabled: K !== null
1464
- }), [q, C] = oe(
1465
- () => f ?? []
1466
- ), re = f === void 0, $ = _(!1), J = Jt(E), se = _(J);
1467
- se.current = J;
1468
- const ce = _(I.hasNextPage);
1469
- ce.current = I.hasNextPage;
1470
- const ee = _(I.isPlaceholderData);
1471
- ee.current = I.isPlaceholderData, me(() => {
1472
- !re || $.current || J || I.isPlaceholderData || C((u) => {
1473
- const m = new Set(u), b = [...u];
1474
- for (const P of I.modules)
1475
- P.collapsed === !1 && !m.has(P.id) && b.push(P.id);
1476
- return b.length === u.length ? u : b;
1477
- });
1478
- }, [I.modules, I.isPlaceholderData, re, J]);
1479
- const V = G(() => {
1480
- const u = /* @__PURE__ */ new Map();
1481
- for (const m of I.modules) u.set(m.id, m);
1482
- return u;
1483
- }, [I.modules]), ie = G(
1484
- () => q.filter((u) => {
1485
- const m = V.get(u);
1486
- return m !== void 0 && m.items === void 0;
1487
- }),
1488
- [q, V]
1489
- ), ve = G(() => new Set(ie), [ie]), Ee = G(() => kt(p), [p]), ke = O(
1490
- (u, m, b) => al({
1491
- courseId: t,
1492
- moduleId: u,
1493
- adapter: n,
1494
- page: b,
1495
- pageSize: d,
1496
- view: o,
1497
- staleTime: g,
1498
- enabled: m,
1499
- limit: Ee
1500
- }),
1501
- [t, n, d, o, g, Ee]
1502
- ), Pe = yl(ie, ke, {
1503
- pageSize: d,
1504
- retainCollapsedLimit: h,
1505
- partition: JSON.stringify([t, o])
1506
- }), Ce = G(() => kt(il), []), [Fe, y] = oe(0), B = O((u) => (y((m) => m + 1), u.finally(() => y((m) => m - 1))), []), F = _(/* @__PURE__ */ new Map()), pe = _(Promise.resolve()), te = O(
1507
- (u, m, b) => {
1508
- if (se.current) return;
1509
- const P = n.setModuleCollapsed;
1510
- if (!P) return;
1511
- const z = Promise.all([pe.current, F.current.get(u)]).then(
1512
- () => Ce(() => P({ courseId: t, moduleId: u, collapsed: m }))
1513
- ), U = ((b == null ? void 0 : b.track) === !0 ? B(z) : z).catch((Z) => {
1514
- console.warn(
1515
- `[platform-modules] failed to persist module ${u} collapsed=${m}: ${String(Z)}`
1516
- );
1517
- }).finally(() => {
1518
- F.current.get(u) === U && F.current.delete(u);
1519
- });
1520
- F.current.set(u, U);
1521
- },
1522
- [n, t, Ce, B]
1523
- ), qe = O(
1524
- (u, m) => {
1525
- const b = n.setAllModulesCollapsed;
1526
- if (!(!se.current && !ce.current && !ee.current && b !== void 0)) {
1527
- for (const U of m) te(U, u, { track: !0 });
1528
- return;
1529
- }
1530
- const z = B(
1531
- Promise.all([pe.current, ...F.current.values()]).then(
1532
- () => b({ courseId: t, collapsed: u })
1533
- )
1534
- ).catch((U) => {
1535
- console.warn(
1536
- `[platform-modules] failed to persist all modules collapsed=${u}: ${String(U)}`
1537
- );
1538
- });
1539
- pe.current = z;
1540
- },
1541
- [n, t, te, B]
1542
- ), Ze = O(
1543
- (u, m) => {
1544
- $.current = !0, C(
1545
- (b) => b.includes(u) ? b : [...b, u]
1546
- ), (m == null ? void 0 : m.persist) !== !1 && te(u, !1);
1547
- },
1548
- [te]
1549
- ), _e = O(
1550
- (u, m) => {
1551
- $.current = !0, C((b) => b.filter((P) => P !== u)), A.cancelQueries({ queryKey: Ge(t, u) }), (m == null ? void 0 : m.persist) !== !1 && te(u, !0);
1552
- },
1553
- [A, t, te]
1554
- ), co = O(
1555
- (u) => {
1556
- $.current = !0, C((m) => {
1557
- const b = new Set(m), P = u.filter((z) => !b.has(z));
1558
- return P.length === 0 ? m : [...m, ...P];
1559
- });
1560
- for (const m of u) te(m, !1, { track: !0 });
1561
- },
1562
- [te]
1563
- ), uo = O(
1564
- (u) => {
1565
- $.current = !0;
1566
- const m = new Set(u);
1567
- C((b) => {
1568
- const P = b.filter((z) => !m.has(z));
1569
- return P.length === b.length ? b : P;
1570
- });
1571
- for (const b of m)
1572
- A.cancelQueries({ queryKey: Ge(t, b) }), te(b, !0, { track: !0 });
1573
- },
1574
- [A, t, te]
1575
- ), ge = _(q);
1576
- ge.current = q;
1577
- const mo = O(() => {
1578
- $.current = !0;
1579
- const u = ge.current;
1580
- if (u.length !== 0) {
1581
- for (const m of u)
1582
- A.cancelQueries({ queryKey: Ge(t, m) });
1583
- C([]), qe(!0, u);
1584
- }
1585
- }, [A, t, qe]), po = O(() => {
1586
- $.current = !0;
1587
- const u = I.modules.map((m) => m.id);
1588
- u.length !== 0 && (C(u), qe(!1, u));
1589
- }, [I.modules, qe]), Xe = _(v);
1590
- Xe.current = v;
1591
- const fe = _(null), go = O(
1592
- (u) => {
1593
- if (u === Xe.current) return;
1594
- if (Xe.current = u, Jt(we(D, u))) {
1595
- fe.current === null && (fe.current = ge.current);
1596
- const b = $.current;
1597
- for (const P of ge.current) _e(P, { persist: !1 });
1598
- $.current = b;
1599
- } else fe.current !== null && (C(fe.current), ge.current = fe.current, fe.current = null);
1600
- R(u);
1601
- },
1602
- [D, _e]
1603
- ), fo = O(
1604
- (u) => {
1605
- ge.current.includes(u) ? _e(u) : Ze(u);
1606
- },
1607
- [_e, Ze]
1608
- ), Et = _(V);
1609
- Et.current = V;
1610
- const [Pt, ho] = oe(() => /* @__PURE__ */ new Map()), Ct = Pe.goToPage, he = O(
1611
- (u, m) => {
1612
- var z;
1613
- const b = (z = Et.current.get(u)) == null ? void 0 : z.items;
1614
- if (b === void 0) {
1615
- Ct(u, m);
1616
- return;
1617
- }
1618
- const P = Re(b.length, d);
1619
- ho((U) => {
1620
- const Z = Math.min(U.get(u) ?? 1, P), Ae = m === "first" ? 1 : m === "last" ? P : Math.min(Math.max(Z + (m === "next" ? 1 : -1), 1), P);
1621
- return Ae === Z ? U : new Map(U).set(u, Ae);
1622
- });
1623
- },
1624
- [Ct, d]
1625
- ), Je = G(() => /* @__PURE__ */ new Map(), [he]), _t = O(
1626
- (u) => {
1627
- let m = Je.get(u);
1628
- return m || (m = {
1629
- goToFirstPage: () => he(u, "first"),
1630
- goToPreviousPage: () => he(u, "previous"),
1631
- goToNextPage: () => he(u, "next"),
1632
- goToLastPage: () => he(u, "last")
1633
- }, Je.set(u, m)), m;
1634
- },
1635
- [Je, he]
1636
- ), At = Pe.entries, Dt = _(/* @__PURE__ */ new Map()), bo = O(
1637
- (u) => {
1638
- var Rt, Nt;
1639
- const m = V.get(u), b = At.get(u), P = ve.has(u), z = Pt.get(u), U = _t(u), Z = Dt.current.get(u);
1640
- if (Z && Z.items === (m == null ? void 0 : m.items) && Z.entry === b && Z.active === P && Z.inlinePage === z && Z.navigation === U)
1641
- return Z.value;
1642
- const Ae = (De) => (Dt.current.set(u, {
1643
- items: m == null ? void 0 : m.items,
1644
- entry: b,
1645
- active: P,
1646
- inlinePage: z,
1647
- navigation: U,
1648
- value: De
1649
- }), De);
1650
- if ((m == null ? void 0 : m.items) !== void 0) {
1651
- const De = Re(m.items.length, d), Ot = Math.min(z ?? 1, De), et = (Ot - 1) * d;
1652
- return Ae({
1653
- items: m.items.slice(et, et + d),
1654
- page: Ot,
1655
- pageCount: De,
1656
- itemOffset: m.items.slice(0, et).filter((yo) => yo.type !== "sub_header").length,
1657
- ...U,
1658
- isLoading: !1,
1659
- isRefreshing: !1,
1660
- error: null,
1661
- source: "inline"
1662
- });
1663
- }
1664
- const W = b == null ? void 0 : b.result, ze = (b == null ? void 0 : b.page) ?? 1, be = (Rt = W == null ? void 0 : W.data) == null ? void 0 : Rt.pageInfo;
1665
- return Ae({
1666
- items: ((Nt = W == null ? void 0 : W.data) == null ? void 0 : Nt.items) ?? Il,
1667
- page: ze,
1668
- pageCount: Math.max(
1669
- Re((be == null ? void 0 : be.totalCount) ?? null, d),
1670
- be != null && be.hasNextPage ? ze + 1 : ze
1671
- ),
1672
- itemOffset: (ze - 1) * d,
1673
- ...U,
1674
- isLoading: W ? W.isLoading : P,
1675
- isRefreshing: (W == null ? void 0 : W.isPlaceholderData) ?? !1,
1676
- error: (W == null ? void 0 : W.error) ?? null,
1677
- source: "onDemand"
1678
- });
1679
- },
1680
- [V, At, ve, Pt, _t, d]
1681
- );
1682
- return {
1683
- modules: I.modules,
1684
- pageInfo: I.pageInfo,
1685
- page: I.page,
1686
- pageCount: I.pageCount,
1687
- pageSize: k,
1688
- hasNextPage: I.hasNextPage,
1689
- hasPreviousPage: I.hasPreviousPage,
1690
- goToFirstPage: I.goToFirstPage,
1691
- goToPreviousPage: I.goToPreviousPage,
1692
- goToNextPage: I.goToNextPage,
1693
- goToLastPage: I.goToLastPage,
1694
- isLoading: (H.isResolving || I.isPending) && !I.isPlaceholderData,
1695
- isRefreshing: I.isPlaceholderData,
1696
- error: I.error ?? H.error,
1697
- itemsMode: K,
1698
- getItems: bo,
1699
- expandModule: Ze,
1700
- collapseModule: _e,
1701
- expandModules: co,
1702
- collapseModules: uo,
1703
- collapseAllModules: mo,
1704
- expandAllModules: po,
1705
- toggleModule: fo,
1706
- expandedModuleIds: q,
1707
- filter: v,
1708
- setFilter: go,
1709
- filterEntry: E,
1710
- filterPredicate: Ga(E) ? E == null ? void 0 : E.predicate : void 0,
1711
- isPersistingCollapsed: Fe > 0
1712
- };
1713
- }
1714
- const Ml = 20, Tl = 4.5, an = 7, Sl = 5, wl = 20, to = "#000000", no = "#FFFFFF", oo = {
1715
- primary: { semantic: "base", textKey: "baseTextColor", borderKey: "baseBorderColor" },
1716
- info: { semantic: "info", textKey: "infoTextColor", borderKey: "infoBorderColor" },
1717
- success: { semantic: "success", textKey: "successTextColor", borderKey: "successBorderColor" },
1718
- warning: { semantic: "warning", textKey: "warningTextColor", borderKey: "warningBorderColor" }
1719
- }, vl = {
1720
- card: {
1721
- primary: { fill: "#E8EAEC", stroke: "#8D959F", text: "#273540" },
1722
- info: { fill: "#D5E4F2", stroke: "#2B7ABC", text: "#23649A" },
1723
- success: { fill: "#CDE7D8", stroke: "#03893D", text: "#02642C" },
1724
- warning: { fill: "#F5DBCC", stroke: "#CF4A00", text: "#A13900" }
1725
- },
1726
- row: {
1727
- primary: { fill: "#DEE1E4", stroke: "#8D959F", text: "#273540" },
1728
- info: { fill: "#CADCEA", stroke: "#2B7ABC", text: "#1E5685" },
1729
- success: { fill: "#C2DFD0", stroke: "#03893D", text: "#02642C" },
1730
- warning: { fill: "#EBD2C4", stroke: "#CF4A00", text: "#A13900" }
1731
- }
1732
- };
1733
- function El(e, t) {
1734
- const n = qo(
1735
- st(e),
1736
- st(zo(t, Ml))
1737
- );
1738
- return Pn(n);
1739
- }
1740
- function Pl(e, t, n) {
1741
- const o = de(n, t) >= an ? an : Tl;
1742
- return Math.min(o, Math.max(de(e, to), de(e, no)));
1743
- }
1744
- function Cl(e, t, n) {
1745
- const o = Pl(e, t, n);
1746
- if (de(e, t) >= o) return t;
1747
- const r = de(e, to) > de(e, no) ? Uo : $o;
1748
- let s = t;
1749
- for (let i = 0; i < wl && de(e, s) < o; i++)
1750
- s = r(s, Sl);
1751
- return Pn(s);
1752
- }
1753
- function _l(e) {
1754
- return rt(e) && st(e).a === 1;
1755
- }
1756
- function ln(e, t) {
1757
- var n;
1758
- return t === "card" ? (n = e == null ? void 0 : e.elevatedSurface) == null ? void 0 : n.base : e == null ? void 0 : e.muted;
1759
- }
1760
- function cn(e, t, n, o) {
1761
- var i, c, d, p;
1762
- const r = vl[n][e], s = t;
1763
- try {
1764
- const h = s == null ? void 0 : s.newTheme, g = (i = h == null ? void 0 : h.semantics) == null ? void 0 : i.call(h, h.primitives);
1765
- if (!g) return r;
1766
- const { semantic: f } = oo[e], M = ln((p = (d = (c = s == null ? void 0 : s.themeOverride) == null ? void 0 : c.semantics) == null ? void 0 : d.color) == null ? void 0 : p.background, n) ?? ln(g.color.background, n) ?? "", x = o.stroke ?? g.color.stroke[f], k = o.label ?? g.color.text[f];
1767
- if (!_l(M) || !rt(x) || !rt(k)) return r;
1768
- const A = El(M, x);
1769
- return { fill: A, stroke: x, text: Cl(A, k, M) };
1770
- } catch {
1771
- return r;
1772
- }
1773
- }
1774
- const un = /* @__PURE__ */ new WeakMap();
1775
- function ro(e, t, n, o = {}) {
1776
- if (typeof t != "object" || t === null)
1777
- return cn(e, t, n, o);
1778
- let r = un.get(t);
1779
- r === void 0 && (r = /* @__PURE__ */ new Map(), un.set(t, r));
1780
- const s = `${n}:${e}:${o.stroke ?? ""}:${o.label ?? ""}`, i = r.get(s);
1781
- if (i !== void 0) return i;
1782
- const c = cn(e, t, n, o);
1783
- return r.set(s, c), c;
1784
- }
1785
- function Be(e, t) {
1786
- const { textKey: n, borderKey: o } = oo[e];
1787
- return (r, s) => {
1788
- const i = r, { fill: c, stroke: d, text: p } = ro(e, s, t, {
1789
- stroke: i == null ? void 0 : i[o],
1790
- label: i == null ? void 0 : i[n]
1791
- });
1792
- return { backgroundColor: c, [n]: p, [o]: d };
1793
- };
1794
- }
1795
- function dn(e) {
1796
- return {
1797
- primary: Be("primary", e),
1798
- info: Be("info", e),
1799
- success: Be("success", e),
1800
- warning: Be("warning", e)
1801
- };
1802
- }
1803
- const Al = {
1804
- card: dn("card"),
1805
- row: dn("row")
1806
- }, Dl = "#9242B4", Ll = "#9E58BD";
1807
- function mn(e) {
1808
- return (t, n) => {
1809
- var i, c, d, p;
1810
- const { fill: o, stroke: r, text: s } = ro("primary", n, e, {
1811
- stroke: ((c = (i = n.colors) == null ? void 0 : i.contrasts) == null ? void 0 : c.violet4570) ?? Ll,
1812
- label: ((p = (d = n.colors) == null ? void 0 : d.contrasts) == null ? void 0 : p.violet5790) ?? Dl
1813
- });
1814
- return { backgroundColor: o, baseTextColor: s, baseBorderColor: r };
1815
- };
1816
- }
1817
- const so = {
1818
- tone: "primary",
1819
- icon: /* @__PURE__ */ l(pt, { size: "sm" }),
1820
- themes: {
1821
- card: mn("card"),
1822
- row: mn("row")
1823
- }
1824
- }, xl = {
1825
- not_started: { tone: "primary", icon: /* @__PURE__ */ l(bt, { size: "sm" }) },
1826
- in_progress: { tone: "info", icon: /* @__PURE__ */ l(ht, { size: "sm" }) },
1827
- complete: { tone: "success", icon: /* @__PURE__ */ l(ft, { size: "sm" }) },
1828
- missing: { tone: "warning", icon: /* @__PURE__ */ l(Te, { size: "sm" }) },
1829
- incomplete: { tone: "warning", icon: /* @__PURE__ */ l(Te, { size: "sm" }) },
1830
- missing_and_incomplete: { tone: "warning", icon: /* @__PURE__ */ l(Te, { size: "sm" }) },
1831
- locked: { tone: "primary", icon: /* @__PURE__ */ l(gt, { size: "sm" }) }
1832
- }, Rl = {
1833
- not_started: { tone: "primary", icon: /* @__PURE__ */ l(bt, { size: "sm" }) },
1834
- in_progress: { tone: "info", icon: /* @__PURE__ */ l(ht, { size: "sm" }) },
1835
- complete: { tone: "success", icon: /* @__PURE__ */ l(ft, { size: "sm" }) },
1836
- incomplete: { tone: "warning", icon: /* @__PURE__ */ l(Te, { size: "sm" }) },
1837
- missing: { tone: "warning", icon: /* @__PURE__ */ l(Te, { size: "sm" }) },
1838
- locked: { tone: "primary", icon: /* @__PURE__ */ l(gt, { size: "sm" }) }
1839
- };
1840
- function io(e, t, n, o) {
1841
- switch (t) {
1842
- case "not_started":
1843
- return e("moduleStatusNotStarted");
1844
- case "in_progress":
1845
- return e("moduleStatusInProgress");
1846
- case "complete":
1847
- return e("moduleStatusComplete");
1848
- case "missing":
1849
- return e("moduleStatusMissing", { count: n });
1850
- case "incomplete":
1851
- return e("moduleStatusIncomplete", { count: o });
1852
- case "missing_and_incomplete":
1853
- return e("moduleStatusMissingAndIncomplete", {
1854
- missing: e("moduleStatusMissing", { count: n }),
1855
- incomplete: e("moduleStatusIncomplete", { count: o })
1856
- });
1857
- case "locked":
1858
- return e("moduleStatusLocked");
1859
- }
1860
- }
1861
- function Nl(e, t) {
1862
- switch (t) {
1863
- case "not_started":
1864
- return e("itemStatusNotStarted");
1865
- case "in_progress":
1866
- return e("itemStatusInProgress");
1867
- case "complete":
1868
- return e("itemStatusComplete");
1869
- case "incomplete":
1870
- return e("itemStatusIncomplete");
1871
- case "missing":
1872
- return e("itemStatusMissing");
1873
- case "locked":
1874
- return e("itemStatusLocked");
1875
- }
1876
- }
1877
- function Ve(e, t, n, o) {
1878
- var r;
1879
- return /* @__PURE__ */ l(
1880
- Oo,
1881
- {
1882
- color: e.tone,
1883
- renderIcon: e.icon,
1884
- themeOverride: ((r = e.themes) == null ? void 0 : r[o]) ?? Al[o][e.tone],
1885
- "data-testid": n,
1886
- children: t
1887
- }
1888
- );
1889
- }
1890
- function Jc({
1891
- status: e,
1892
- missingCount: t,
1893
- incompleteCount: n
1894
- }) {
1895
- const { t: o } = X();
1896
- return Ve(
1897
- xl[e],
1898
- io(o, e, t, n),
1899
- "module-status-pill",
1900
- "card"
1901
- );
1902
- }
1903
- function Ol({ status: e }) {
1904
- const { t } = X();
1905
- return Ve(
1906
- Rl[e],
1907
- Nl(t, e),
1908
- "item-status-pill",
1909
- "row"
1910
- );
1911
- }
1912
- function eu() {
1913
- const { t: e } = X();
1914
- return Ve(so, e("moduleStatusDueSoon"), "module-due-soon-pill", "card");
1915
- }
1916
- function kl() {
1917
- const { t: e } = X();
1918
- return Ve(so, e("itemStatusDueSoon"), "item-due-soon-pill", "row");
1919
- }
1920
- function tu() {
1921
- const { t: e } = X();
1922
- return /* @__PURE__ */ l(Cn, { text: e("moduleRequiredPill"), size: "small", "data-testid": "module-required-pill" });
1923
- }
1924
- function Fl() {
1925
- const { t: e } = X();
1926
- return /* @__PURE__ */ l(Cn, { text: e("itemRequiredTag"), size: "small", "data-testid": "item-required-pill" });
1927
- }
1928
- function ql() {
1929
- const e = vn();
1930
- return "key" in e && e.key === "canvas-high-contrast" ? "inline" : "standalone";
1931
- }
1932
- const ao = 2.75, zl = `${ao}rem`, pn = "0.065em", Se = "0.8em", Ul = "0.28em", gn = "1px", $l = "0.57em", lo = {
1933
- display: "inline-block",
1934
- paddingLeft: Se,
1935
- marginLeft: `-${Se}`,
1936
- backgroundImage: `radial-gradient(circle, currentColor ${pn}, transparent ${pn})`,
1937
- backgroundRepeat: "no-repeat",
1938
- backgroundSize: `${Se} 100%`,
1939
- backgroundPosition: "left center"
1940
- }, Bl = {
1941
- ...lo,
1942
- backgroundImage: "none",
1943
- borderLeft: `${gn} solid`,
1944
- paddingLeft: `calc(${Se} / 2 - ${gn})`,
1945
- marginLeft: `calc(-${Se} / 2)`
1946
- };
1947
- function fn() {
1948
- return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia("(forced-colors: active)");
1949
- }
1950
- function Wl() {
1951
- const [e, t] = oe(() => {
1952
- var n;
1953
- return ((n = fn()) == null ? void 0 : n.matches) ?? !1;
1954
- });
1955
- return me(() => {
1956
- const n = fn();
1957
- if (n === null) return;
1958
- t(n.matches);
1959
- const o = (r) => t(r.matches);
1960
- return n.addEventListener("change", o), () => n.removeEventListener("change", o);
1961
- }, []), e ? Bl : lo;
1962
- }
1963
- const Gl = {
1964
- overflowX: "clip",
1965
- overflowWrap: "anywhere",
1966
- lineHeight: 0
1967
- }, jl = "#6A7883", vt = 0.5, Ke = { display: "block" }, Hl = { ...Ke, marginTop: `${vt}rem` }, Kl = {
1968
- ...Ke,
1969
- marginTop: `-${vt}rem`
1970
- }, hn = { marginTop: `${vt}rem` }, bn = { display: "inline-block" }, Yl = {
1971
- display: "-webkit-box",
1972
- WebkitLineClamp: 2,
1973
- WebkitBoxOrient: "vertical",
1974
- overflow: "hidden"
1975
- }, Ql = {
1976
- marginRight: `calc(${Se} - ${Ul})`
1977
- }, Vl = {
1978
- display: "inline-flex",
1979
- alignItems: "center",
1980
- height: "1lh",
1981
- verticalAlign: "top",
1982
- marginInlineEnd: $l
1983
- };
1984
- function Me(e) {
1985
- return e == null || typeof e == "boolean" || e === "" ? !0 : Array.isArray(e) ? e.every(Me) : mt(e) && e.type === wn ? Me(e.props.children) : !1;
1986
- }
1987
- const Zl = 1.5, Xl = 0.25, Jl = 0.5;
1988
- function ec(e, t) {
1989
- var o, r;
1990
- const n = vn();
1991
- return ("colors" in n ? (r = (o = n.colors) == null ? void 0 : o.contrasts) == null ? void 0 : r[e] : void 0) ?? t;
1992
- }
1993
- function tc({
1994
- item: e,
1995
- today: t,
1996
- attachedAbove: n,
1997
- attachedBelow: o,
1998
- stackPill: r = !1,
1999
- moduleLabel: s,
2000
- itemNumber: i
2001
- }) {
2002
- var Fe;
2003
- const { t: c, locale: d, timezone: p } = X(), h = nr(), g = ql(), f = ec("grey4570", jl), M = Wl(), x = _(null), k = Zn(), A = Qe(), { navigation: S } = A, v = G(() => On(A.itemMeta), [A.itemMeta]), R = e.title || c("itemUntitled");
2004
- if (e.type === "sub_header")
2005
- return /* @__PURE__ */ l(
2006
- ae,
2007
- {
2008
- as: "div",
2009
- padding: r ? "x-small small" : "x-small mediumSmall",
2010
- margin: "x-small 0 0 0",
2011
- "data-testid": `module-item-${e.id}`,
2012
- children: /* @__PURE__ */ l(
2013
- ue,
2014
- {
2015
- size: "small",
2016
- weight: "bold",
2017
- transform: "uppercase",
2018
- "data-testid": "module-item-title",
2019
- "data-sub-header": "true",
2020
- children: R
2021
- }
2022
- )
2023
- }
2024
- );
2025
- const D = Ra(s, i, d), E = D ? c("itemNameWithLabel", { label: D, name: R }) : R, w = ((Fe = S.getItemHref) == null ? void 0 : Fe.call(S, e)) ?? e.url ?? null, T = e.status === "locked", L = T ? null : w, Q = e.status !== void 0 && e.status !== "complete" && !T && $n(e.dueAt, t, p), j = S.onItemClick, H = (y) => {
2026
- h(`item-click-${e.type}`), j == null || j(e, y);
2027
- }, K = (y) => {
2028
- var F;
2029
- const B = x.current;
2030
- !B || B.contains(y.target) || (F = window.getSelection()) != null && F.toString().trim() || B.dispatchEvent(
2031
- new window.MouseEvent("click", {
2032
- bubbles: !0,
2033
- cancelable: !0,
2034
- ctrlKey: y.ctrlKey,
2035
- metaKey: y.metaKey,
2036
- shiftKey: y.shiftKey,
2037
- altKey: y.altKey
2038
- })
2039
- );
2040
- }, I = { item: e, t: c, today: t, locale: d, timezone: p, formatters: k, config: A }, q = v.map((y) => ({
2041
- key: y.key,
2042
- node: y.render(I),
2043
- icon: y.renderIcon ? y.renderIcon(I) : y.icon
2044
- })).filter((y) => !Me(y.node)), C = [];
2045
- let re;
2046
- const $ = r ? q.find((y) => y.key === "dueAt" && !Me(y.icon)) : void 0, J = $ && q.find((y) => y.key === "estimatedDuration");
2047
- for (const y of q)
2048
- if (y !== J)
2049
- if (!Me(y.icon) && (r || !re)) {
2050
- const B = y === $ && J ? [y, J] : [y];
2051
- C.push(B), re ?? (re = B);
2052
- } else re ? re.push(y) : C.length === 0 ? C.push([y]) : C[0].push(y);
2053
- const se = r ? { ...bn, ...hn } : bn, ce = r ? { ...M, ...hn } : M, ee = e.completionRequirement ? /* @__PURE__ */ l(Fl, {}) : null, V = Q || e.status ? /* @__PURE__ */ Y(N, { alignItems: "center", gap: "x-small", wrap: r ? "wrap" : "no-wrap", children: [
2054
- Q ? /* @__PURE__ */ l(N.Item, { children: /* @__PURE__ */ l(kl, {}) }) : null,
2055
- e.status ? /* @__PURE__ */ l(N.Item, { children: /* @__PURE__ */ l(Ol, { status: e.status }) }) : null
2056
- ] }) : null, ie = r && ee ? /* @__PURE__ */ Y(N, { direction: "column", alignItems: "start", gap: "x-small", children: [
2057
- /* @__PURE__ */ l(N.Item, { children: ee }),
2058
- V ? /* @__PURE__ */ l(N.Item, { children: V }) : null
2059
- ] }) : V, ve = r ? /* @__PURE__ */ l("span", { style: Yl, "data-title-clamp": "", children: E }) : E, Ee = {
2060
- weight: "bold",
2061
- size: r ? "medium" : "small",
2062
- lineHeight: "condensed",
2063
- "data-testid": "module-item-title"
2064
- }, ke = L ? /* @__PURE__ */ Y(
2065
- No,
2066
- {
2067
- href: L,
2068
- elementRef: (y) => {
2069
- x.current = y;
2070
- },
2071
- onClick: H,
2072
- forceButtonRole: !1,
2073
- variant: g,
2074
- display: r ? "block" : void 0,
2075
- target: e.newTab ? "_blank" : void 0,
2076
- rel: e.newTab ? "noopener noreferrer" : void 0,
2077
- children: [
2078
- /* @__PURE__ */ l(ue, { ...Ee, color: "primary", children: ve }),
2079
- e.newTab ? /* @__PURE__ */ l(En, { children: ` ${c("opensInNewWindow")}` }) : null
2080
- ]
2081
- }
2082
- ) : /* @__PURE__ */ l(
2083
- ue,
2084
- {
2085
- ...Ee,
2086
- color: T ? "secondary" : "primary",
2087
- "data-locked": T ? "true" : void 0,
2088
- children: ve
2089
- }
2090
- ), Pe = n ? "none" : "large", Ce = o ? "none" : "large";
2091
- return /* @__PURE__ */ l(
2092
- ae,
2093
- {
2094
- as: "div",
2095
- background: "secondary",
2096
- borderRadius: `${Pe} ${Pe} ${Ce} ${Ce}`,
2097
- padding: r ? "small" : "mediumSmall",
2098
- margin: n ? "0" : "x-small 0 0 0",
2099
- cursor: L ? "pointer" : void 0,
2100
- onClick: L ? K : void 0,
2101
- "data-testid": `module-item-${e.id}`,
2102
- children: /* @__PURE__ */ l("div", { style: { paddingInlineStart: `${Math.max(e.indent - 1, 0) * ao}rem` }, children: /* @__PURE__ */ Y(N, { alignItems: "start", gap: "mediumSmall", children: [
2103
- /* @__PURE__ */ l(N.Item, { shouldGrow: !0, shouldShrink: !0, children: /* @__PURE__ */ Y(N, { alignItems: "center", children: [
2104
- e.indent > 0 ? /* @__PURE__ */ l(
2105
- N.Item,
2106
- {
2107
- size: zl,
2108
- textAlign: "center",
2109
- "data-testid": "item-nest-arrow",
2110
- children: /* @__PURE__ */ l("span", { style: { color: f }, children: /* @__PURE__ */ l(Lo, { size: "md", color: "inherit" }) })
2111
- }
2112
- ) : null,
2113
- /* @__PURE__ */ Y(N.Item, { shouldGrow: !0, shouldShrink: !0, children: [
2114
- /* @__PURE__ */ l(
2115
- "div",
2116
- {
2117
- style: {
2118
- lineHeight: r ? 0 : `${Zl}rem`,
2119
- marginBottom: q.length === 0 ? 0 : `${r ? Jl : Xl}rem`
2120
- },
2121
- children: !r && ee ? /* @__PURE__ */ Y(N, { alignItems: "center", gap: "x-small", wrap: "wrap", children: [
2122
- /* @__PURE__ */ l(N.Item, { shouldShrink: !0, children: ke }),
2123
- /* @__PURE__ */ l(N.Item, { children: ee })
2124
- ] }) : ke
2125
- }
2126
- ),
2127
- /* @__PURE__ */ l("div", { style: Gl, children: /* @__PURE__ */ l(
2128
- ue,
2129
- {
2130
- size: r ? "small" : "x-small",
2131
- lineHeight: "default",
2132
- color: "secondary",
2133
- "data-testid": "module-item-meta",
2134
- children: C.map((y, B) => /* @__PURE__ */ l(
2135
- "span",
2136
- {
2137
- style: r ? B > 0 ? Ke : Kl : C.length > 1 ? B > 0 ? Hl : Ke : void 0,
2138
- "data-testid": "meta-line",
2139
- children: y.map((F, pe) => /* @__PURE__ */ Y(wn, { children: [
2140
- pe > 0 ? /* @__PURE__ */ l("span", { style: Ql, children: " " }) : null,
2141
- /* @__PURE__ */ Y(
2142
- "span",
2143
- {
2144
- style: pe > 0 ? ce : se,
2145
- "data-testid": "meta-fact",
2146
- "data-fact-key": F.key,
2147
- children: [
2148
- Me(F.icon) ? null : /* @__PURE__ */ l(
2149
- "span",
2150
- {
2151
- style: Vl,
2152
- "aria-hidden": "true",
2153
- "data-testid": `meta-icon-${F.key}`,
2154
- children: r && mt(F.icon) && F.icon.props.size === "xs" ? To(F.icon, { size: "sm" }) : F.icon
2155
- }
2156
- ),
2157
- F.node
2158
- ]
2159
- }
2160
- )
2161
- ] }, F.key))
2162
- },
2163
- y[0].key
2164
- ))
2165
- }
2166
- ) }),
2167
- r && ie ? /* @__PURE__ */ l(ae, { as: "div", margin: "x-small 0 0 0", children: ie }) : null
2168
- ] })
2169
- ] }) }),
2170
- !r && ie ? /* @__PURE__ */ l(N.Item, { children: ie }) : null
2171
- ] }) })
2172
- }
2173
- );
2174
- }
2175
- const nu = Mo(tc);
2176
- function nc(e) {
2177
- switch (e) {
2178
- case "complete":
2179
- return "complete";
2180
- case "locked":
2181
- return "locked";
2182
- case void 0:
2183
- case "not_started":
2184
- return "notStarted";
2185
- case "in_progress":
2186
- return "inProgress";
2187
- case "missing":
2188
- case "incomplete":
2189
- case "missing_and_incomplete":
2190
- return "missing";
2191
- }
2192
- }
2193
- function ot(e) {
2194
- return (t, n) => {
2195
- const { newTheme: o } = n;
2196
- return {
2197
- backgroundPrimaryInverse: o.semantics(o.primitives).color.background.accent[e]
2198
- };
2199
- };
2200
- }
2201
- const oc = {
2202
- missing: {
2203
- background: "primary-inverse",
2204
- borderWidth: "none",
2205
- themeOverride: ot("honey"),
2206
- icon: /* @__PURE__ */ l(Te, { size: "sm", color: "onColor" })
2207
- },
2208
- complete: {
2209
- background: "primary-inverse",
2210
- borderWidth: "none",
2211
- themeOverride: ot("aurora"),
2212
- icon: /* @__PURE__ */ l(ft, { size: "sm", color: "onColor" })
2213
- },
2214
- inProgress: {
2215
- background: "primary-inverse",
2216
- borderWidth: "none",
2217
- themeOverride: ot("sky"),
2218
- icon: /* @__PURE__ */ l(ht, { size: "sm", color: "onColor" })
2219
- },
2220
- notStarted: {
2221
- background: "primary",
2222
- borderWidth: "medium",
2223
- icon: /* @__PURE__ */ l(bt, { size: "sm", color: "baseColor" })
2224
- },
2225
- locked: {
2226
- background: "secondary",
2227
- borderWidth: "small",
2228
- icon: /* @__PURE__ */ l(gt, { size: "sm", color: "baseColor" })
2229
- }
2230
- };
2231
- function rc(e) {
2232
- var i, c, d;
2233
- let t = 0, n = 0, o = 0;
2234
- for (const p of e)
2235
- ((i = p.progress) == null ? void 0 : i.status) === "complete" && (t += 1), n += ((c = p.progress) == null ? void 0 : c.requirementCount) ?? 0, o += ((d = p.progress) == null ? void 0 : d.requirementsMet) ?? 0;
2236
- const r = e.length, s = r === 0 ? 0 : t === r ? 100 : Math.floor(t / r * 100);
2237
- return {
2238
- totalModules: r,
2239
- completedModules: t,
2240
- totalItems: n,
2241
- completedItems: o,
2242
- percent: s
2243
- };
2244
- }
2245
- const ut = 32, sc = "4px", ic = 4, Le = { none: 0, small: 1, medium: 2 }, ac = 6, lc = 8, yn = 2, We = 3;
2246
- function cc(e, t, n) {
2247
- const o = ic + n / 2, r = e ? ut / 2 : o, s = t ? ut / 2 : o;
2248
- return `${r}px ${s}px ${s}px ${r}px`;
2249
- }
2250
- function uc({
2251
- module: e,
2252
- isFirst: t,
2253
- isLast: n,
2254
- onClick: o
2255
- }) {
2256
- var f, M, x;
2257
- const { t: r } = X(), i = Zn().moduleLabel(e.position, e), c = i ? r("moduleNameWithLabel", { label: i, name: e.name }) : e.name, d = ((f = e.progress) == null ? void 0 : f.status) ?? "not_started", p = nc(d), h = r("moduleProgressSegmentLabel", {
2258
- name: c,
2259
- status: io(
2260
- r,
2261
- d,
2262
- ((M = e.progress) == null ? void 0 : M.missingCount) ?? 0,
2263
- ((x = e.progress) == null ? void 0 : x.incompleteCount) ?? 0
2264
- )
2265
- }), g = oc[p];
2266
- return /* @__PURE__ */ l(N.Item, { shouldGrow: !0, shouldShrink: !0, size: "0", children: /* @__PURE__ */ l(Fo, { renderTip: c, children: () => /* @__PURE__ */ Y(
2267
- ae,
2268
- {
2269
- as: "button",
2270
- type: "button",
2271
- display: "block",
2272
- width: "100%",
2273
- height: `${ut}px`,
2274
- padding: "0",
2275
- position: "relative",
2276
- borderRadius: cc(t, n, Le[g.borderWidth]),
2277
- borderWidth: g.borderWidth,
2278
- borderColor: "secondary",
2279
- background: g.background,
2280
- themeOverride: g.themeOverride,
2281
- cursor: o ? "pointer" : void 0,
2282
- onClick: o ? () => o(e.id) : void 0,
2283
- "data-testid": `modules-progress-segment-${e.id}`,
2284
- children: [
2285
- /* @__PURE__ */ l(N, { as: "span", height: "100%", justifyItems: "center", alignItems: "center", children: g.icon }),
2286
- /* @__PURE__ */ l(En, { children: h }),
2287
- /* @__PURE__ */ l(
2288
- "span",
2289
- {
2290
- "aria-hidden": "true",
2291
- "data-testid": `modules-progress-hit-area-${e.id}`,
2292
- style: {
2293
- position: "absolute",
2294
- top: `-${ac + Le[g.borderWidth]}px`,
2295
- bottom: `-${lc + Le[g.borderWidth]}px`,
2296
- left: `${yn - Le[g.borderWidth]}px`,
2297
- right: `${yn - Le[g.borderWidth]}px`
2298
- }
2299
- }
2300
- )
2301
- ]
2302
- }
2303
- ) }) });
2304
- }
2305
- function ou({
2306
- modules: e,
2307
- onModuleClick: t,
2308
- hasMoreModules: n = !1,
2309
- continuesBefore: o = !1,
2310
- continuesAfter: r = !1,
2311
- pagination: s
2312
- }) {
2313
- const { t: i } = X(), c = G(() => rc(e), [e]);
2314
- if (!e.some((g) => g.progress !== void 0) || c.totalModules === 0) return null;
2315
- const p = i("moduleProgressOverviewSummary", {
2316
- count: c.totalModules,
2317
- completedModules: c.completedModules,
2318
- totalModules: c.totalModules
2319
- }), h = c.totalItems > 0 ? i("moduleProgressOverviewDetail", {
2320
- itemsSummary: i("moduleProgressOverviewItemsSummary", {
2321
- count: c.totalItems,
2322
- completedItems: c.completedItems,
2323
- totalItems: c.totalItems
2324
- })
2325
- }) : null;
2326
- return /* @__PURE__ */ Y(ae, { as: "div", margin: "0 0 small 0", "data-testid": "modules-progress-overview", children: [
2327
- n ? null : /* @__PURE__ */ l(N, { wrap: "wrap", children: /* @__PURE__ */ Y(N.Item, { children: [
2328
- /* @__PURE__ */ l(ae, { as: "span", margin: "0 x-small 0 0", children: /* @__PURE__ */ l(
2329
- ko,
2330
- {
2331
- level: "reset",
2332
- variant: "titleSection",
2333
- "data-testid": "modules-progress-overview-percent",
2334
- children: i("moduleProgressOverviewPercentLabel", { percent: c.percent })
2335
- }
2336
- ) }),
2337
- /* @__PURE__ */ l(ue, { variant: "content", "data-testid": "modules-progress-overview-summary", children: h ? `${p} ${h}` : p })
2338
- ] }) }),
2339
- /* @__PURE__ */ l(ae, { as: "div", margin: "xx-small 0 0 0", children: /* @__PURE__ */ l(
2340
- N,
2341
- {
2342
- gap: sc,
2343
- role: "group",
2344
- "aria-label": i("moduleProgressOverviewGroupLabel"),
2345
- "data-testid": "modules-progress-overview-segments",
2346
- children: e.map((g, f) => /* @__PURE__ */ l(
2347
- uc,
2348
- {
2349
- module: g,
2350
- isFirst: f === 0 && !o,
2351
- isLast: f === e.length - 1 && !r,
2352
- onClick: t
2353
- },
2354
- g.id
2355
- ))
2356
- }
2357
- ) }),
2358
- s ? /* @__PURE__ */ l(dc, { pagination: s, shownCount: e.length }) : null
2359
- ] });
2360
- }
2361
- function In({
2362
- targetRef: e,
2363
- testId: t,
2364
- children: n
2365
- }) {
2366
- return /* @__PURE__ */ l(
2367
- "span",
2368
- {
2369
- "data-testid": t,
2370
- style: {
2371
- display: "inline-flex",
2372
- padding: `0 ${We}px ${We}px`,
2373
- margin: `0 -${We}px -${We}px`
2374
- },
2375
- onClick: (o) => {
2376
- var r;
2377
- o.target === o.currentTarget && ((r = e.current) == null || r.click());
2378
- },
2379
- children: n
2380
- }
2381
- );
2382
- }
2383
- function dc({
2384
- pagination: e,
2385
- shownCount: t
2386
- }) {
2387
- const { t: n } = X(), { rangeStart: o, totalCount: r, hasPreviousPage: s, hasNextPage: i, disabled: c = !1 } = e, d = _(null), p = _(null), h = _(null);
2388
- me(() => {
2389
- var M, x;
2390
- if (c) return;
2391
- const f = h.current;
2392
- h.current = null, f === "next" && !i && ((M = d.current) == null || M.focus()), f === "previous" && !s && ((x = p.current) == null || x.focus());
2393
- }, [c, i, s]);
2394
- const g = (f) => {
2395
- c || (h.current = f, f === "next" ? e.onNextPage() : e.onPreviousPage());
2396
- };
2397
- return /* @__PURE__ */ l(ae, { as: "div", margin: "x-small 0 0 0", children: /* @__PURE__ */ Y(
2398
- N,
2399
- {
2400
- as: "nav",
2401
- justifyItems: "space-between",
2402
- alignItems: "center",
2403
- gap: "x-small",
2404
- "aria-label": n("moduleProgressOverviewPaginationLabel"),
2405
- "data-testid": "modules-progress-overview-pagination",
2406
- children: [
2407
- /* @__PURE__ */ l(In, { targetRef: d, testId: "modules-progress-overview-previous-hit-area", children: /* @__PURE__ */ l(
2408
- Ft,
2409
- {
2410
- size: "small",
2411
- withBackground: !1,
2412
- withBorder: !1,
2413
- renderIcon: /* @__PURE__ */ l(xo, {}),
2414
- screenReaderLabel: n("paginationPreviousPage"),
2415
- interaction: s ? "enabled" : "disabled",
2416
- elementRef: (f) => {
2417
- d.current = f;
2418
- },
2419
- onClick: () => g("previous")
2420
- }
2421
- ) }),
2422
- r === null ? null : /* @__PURE__ */ l(ue, { size: "small", color: "secondary", "data-testid": "modules-progress-overview-range", children: n("moduleProgressOverviewPageRange", {
2423
- start: o,
2424
- end: o + t - 1,
2425
- total: r
2426
- }) }),
2427
- /* @__PURE__ */ l(In, { targetRef: p, testId: "modules-progress-overview-next-hit-area", children: /* @__PURE__ */ l(
2428
- Ft,
2429
- {
2430
- size: "small",
2431
- withBackground: !1,
2432
- withBorder: !1,
2433
- renderIcon: /* @__PURE__ */ l(Ro, {}),
2434
- screenReaderLabel: n("paginationNextPage"),
2435
- interaction: i ? "enabled" : "disabled",
2436
- elementRef: (f) => {
2437
- p.current = f;
2438
- },
2439
- onClick: () => g("next")
2440
- }
2441
- ) })
2442
- ]
2443
- }
2444
- ) });
2445
- }
2446
- export {
2447
- Yo as $,
2448
- Fa as A,
2449
- Gl as B,
2450
- Ql as C,
2451
- so as D,
2452
- eu as E,
2453
- Kc as F,
2454
- Hc as G,
2455
- nu as H,
2456
- Nn as I,
2457
- Zo as J,
2458
- er as K,
2459
- Jo as L,
2460
- Rc as M,
2461
- Xo as N,
2462
- jc as O,
2463
- Qc as P,
2464
- Uc as Q,
2465
- Xc as R,
2466
- ou as S,
2467
- $a as T,
2468
- _n as U,
2469
- Ko as V,
2470
- Bo as W,
2471
- Wo as X,
2472
- An as Y,
2473
- jo as Z,
2474
- Go as _,
2475
- xc as a,
2476
- Vo as a0,
2477
- Dn as a1,
2478
- Ho as a2,
2479
- Lc as a3,
2480
- Qo as a4,
2481
- Ln as a5,
2482
- xn as a6,
2483
- zc as a7,
2484
- or as a8,
2485
- rn as a9,
2486
- cr as aA,
2487
- kl as aB,
2488
- Nl as aC,
2489
- Ol as aD,
2490
- io as aE,
2491
- Fn as aF,
2492
- le as aG,
2493
- Ea as aH,
2494
- Me as aI,
2495
- ao as aJ,
2496
- ot as aK,
2497
- Wa as aa,
2498
- ja as ab,
2499
- Ba as ac,
2500
- It as ad,
2501
- el as ae,
2502
- Va as af,
2503
- Ga as ag,
2504
- Xa as ah,
2505
- Ja as ai,
2506
- Oe as aj,
2507
- ye as ak,
2508
- Yc as al,
2509
- Qa as am,
2510
- Vc as an,
2511
- we as ao,
2512
- Xn as ap,
2513
- sl as aq,
2514
- rl as ar,
2515
- ol as as,
2516
- St as at,
2517
- Jn as au,
2518
- wt as av,
2519
- ul as aw,
2520
- Wc as ax,
2521
- Ge as ay,
2522
- Ne as az,
2523
- qt as b,
2524
- $c as c,
2525
- Zc as d,
2526
- Fc as e,
2527
- kc as f,
2528
- qc as g,
2529
- it as h,
2530
- Bc as i,
2531
- Mt as j,
2532
- Qe as k,
2533
- xl as l,
2534
- Gc as m,
2535
- Vl as n,
2536
- Bt as o,
2537
- nr as p,
2538
- Zn as q,
2539
- ql as r,
2540
- tu as s,
2541
- Jc as t,
2542
- X as u,
2543
- On as v,
2544
- Nc as w,
2545
- $n as x,
2546
- Oc as y,
2547
- Wl as z
2548
- };