@instructure/platform-notebook 1.10.3 → 1.11.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.
- package/dist/Highlight.d.ts +7 -2
- package/dist/Highlight.d.ts.map +1 -1
- package/dist/NoteCard.d.ts +3 -2
- package/dist/NoteCard.d.ts.map +1 -1
- package/dist/NotebookEmptyState.d.ts.map +1 -1
- package/dist/NotesListView.d.ts.map +1 -1
- package/dist/hooks/useNotesData.d.ts +1 -0
- package/dist/hooks/useNotesData.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +793 -777
- package/dist/types.d.ts +30 -0
- package/dist/types.d.ts.map +1 -1
- package/locales/en.json +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,107 +1,111 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { createContext as Ve, useMemo as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { z as
|
|
5
|
-
import
|
|
6
|
-
import { useQueryClient as
|
|
7
|
-
import { CloseButton as
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { Heading as
|
|
1
|
+
import { jsx as i, jsxs as S, Fragment as Xe } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Ve, useMemo as pe, useContext as Qe, useReducer as Ye, useRef as F, useEffect as q, useState as W, useCallback as K } from "react";
|
|
3
|
+
import { createPortal as pt } from "react-dom";
|
|
4
|
+
import { z as d } from "zod";
|
|
5
|
+
import yt from "diff-match-patch";
|
|
6
|
+
import { useQueryClient as Oe, useMutation as Le, useQuery as Nt } from "@tanstack/react-query";
|
|
7
|
+
import { CloseButton as bt, Button as ne, IconButton as ge } from "@instructure/ui-buttons/v11_7";
|
|
8
|
+
import { Flex as C } from "@instructure/ui-flex/v11_7";
|
|
9
|
+
import { Heading as ve } from "@instructure/ui-heading/v11_7";
|
|
10
10
|
import { Tray as Et } from "@instructure/ui-tray/v11_7";
|
|
11
11
|
import { View as V } from "@instructure/ui-view/v11_7";
|
|
12
|
-
import { IconQuestionLine as
|
|
13
|
-
import { Menu as
|
|
14
|
-
import { TruncateText as
|
|
12
|
+
import { IconQuestionLine as Ae, IconPinLine as De, IconWarningLine as St, NotebookInstUIIcon as Tt, IconEditLine as we, IconTrashLine as Te, IconArrowStartLine as vt } from "@instructure/ui-icons";
|
|
13
|
+
import { Menu as fe } from "@instructure/ui-menu/v11_7";
|
|
14
|
+
import { TruncateText as Se } from "@instructure/ui-truncate-text/v11_7";
|
|
15
15
|
import { SimpleSelect as He } from "@instructure/ui-simple-select/v11_7";
|
|
16
|
-
import { Text as
|
|
17
|
-
import { ScreenReaderContent as
|
|
18
|
-
import { Dialog as
|
|
16
|
+
import { Text as Z } from "@instructure/ui-text/v11_7";
|
|
17
|
+
import { ScreenReaderContent as ye } from "@instructure/ui-a11y-content";
|
|
18
|
+
import { Dialog as It } from "@instructure/ui-dialog";
|
|
19
19
|
import { TextArea as Ze } from "@instructure/ui-text-area/v11_7";
|
|
20
|
-
import { Pill as
|
|
21
|
-
import { Pagination as
|
|
22
|
-
import { Spinner as
|
|
23
|
-
const
|
|
24
|
-
startContainer:
|
|
25
|
-
endContainer:
|
|
26
|
-
startOffset:
|
|
27
|
-
endOffset:
|
|
28
|
-
}),
|
|
29
|
-
start:
|
|
30
|
-
end:
|
|
31
|
-
}),
|
|
32
|
-
selectedText:
|
|
33
|
-
hasNoHighlightAnymore:
|
|
34
|
-
textPosition:
|
|
35
|
-
range:
|
|
36
|
-
pageLastModifiedAt:
|
|
20
|
+
import { Pill as $e } from "@instructure/ui-pill/v11_7";
|
|
21
|
+
import { Pagination as Ct } from "@instructure/ui-pagination/v11_7";
|
|
22
|
+
import { Spinner as xt } from "@instructure/ui-spinner/v11_7";
|
|
23
|
+
const Rt = d.object({
|
|
24
|
+
startContainer: d.string(),
|
|
25
|
+
endContainer: d.string(),
|
|
26
|
+
startOffset: d.number(),
|
|
27
|
+
endOffset: d.number()
|
|
28
|
+
}), wt = d.object({
|
|
29
|
+
start: d.number(),
|
|
30
|
+
end: d.number()
|
|
31
|
+
}), Pe = d.object({
|
|
32
|
+
selectedText: d.string(),
|
|
33
|
+
hasNoHighlightAnymore: d.boolean().optional(),
|
|
34
|
+
textPosition: wt.nullable(),
|
|
35
|
+
range: Rt.nullable(),
|
|
36
|
+
pageLastModifiedAt: d.string()
|
|
37
37
|
});
|
|
38
|
-
var
|
|
39
|
-
const
|
|
38
|
+
var L = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(L || {});
|
|
39
|
+
const _e = d.enum([
|
|
40
40
|
"Important",
|
|
41
41
|
"Confusing"
|
|
42
42
|
/* CONFUSING */
|
|
43
|
-
]),
|
|
44
|
-
totalCount:
|
|
45
|
-
totalNrOfPages:
|
|
46
|
-
}),
|
|
47
|
-
id:
|
|
48
|
-
rootAccountUuid:
|
|
49
|
-
userId:
|
|
50
|
-
courseId:
|
|
51
|
-
objectId:
|
|
52
|
-
objectType:
|
|
53
|
-
userText:
|
|
54
|
-
reaction:
|
|
55
|
-
highlightData:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
43
|
+
]), kt = d.object({
|
|
44
|
+
totalCount: d.number().nullish(),
|
|
45
|
+
totalNrOfPages: d.number().nullish()
|
|
46
|
+
}), Ie = d.object({
|
|
47
|
+
id: d.string(),
|
|
48
|
+
rootAccountUuid: d.string(),
|
|
49
|
+
userId: d.string(),
|
|
50
|
+
courseId: d.string(),
|
|
51
|
+
objectId: d.string(),
|
|
52
|
+
objectType: d.string(),
|
|
53
|
+
userText: d.string().optional(),
|
|
54
|
+
reaction: d.array(_e),
|
|
55
|
+
highlightData: Pe,
|
|
56
|
+
// Set by the host when the note's highlight is gone specifically because its source
|
|
57
|
+
// (the page/assignment/quiz it was captured from) was unpublished or deleted, as opposed
|
|
58
|
+
// to the note never having had a highlight. Selects the HighlightError reason in NoteCard.
|
|
59
|
+
highlightSourceUnavailable: d.boolean().optional(),
|
|
60
|
+
createdAt: d.string(),
|
|
61
|
+
updatedAt: d.string()
|
|
62
|
+
}), Ot = d.object({
|
|
63
|
+
cursor: d.string(),
|
|
64
|
+
node: Ie
|
|
61
65
|
});
|
|
62
|
-
|
|
63
|
-
notes:
|
|
64
|
-
edges:
|
|
65
|
-
nodes:
|
|
66
|
-
pageInfo:
|
|
66
|
+
d.object({
|
|
67
|
+
notes: d.object({
|
|
68
|
+
edges: d.array(Ot),
|
|
69
|
+
nodes: d.array(Ie),
|
|
70
|
+
pageInfo: kt
|
|
67
71
|
})
|
|
68
72
|
});
|
|
69
|
-
const
|
|
70
|
-
type:
|
|
71
|
-
id:
|
|
72
|
-
}),
|
|
73
|
-
courseId:
|
|
74
|
-
learningObject:
|
|
75
|
-
reactions:
|
|
73
|
+
const Lt = d.object({
|
|
74
|
+
type: d.string(),
|
|
75
|
+
id: d.string()
|
|
76
|
+
}), At = d.object({
|
|
77
|
+
courseId: d.string().optional(),
|
|
78
|
+
learningObject: Lt.optional(),
|
|
79
|
+
reactions: d.array(d.string()).optional()
|
|
76
80
|
}).optional();
|
|
77
|
-
|
|
78
|
-
courseId:
|
|
79
|
-
filter:
|
|
80
|
-
offset:
|
|
81
|
-
pageSize:
|
|
81
|
+
d.object({
|
|
82
|
+
courseId: d.string().optional(),
|
|
83
|
+
filter: At,
|
|
84
|
+
offset: d.number().optional(),
|
|
85
|
+
pageSize: d.number().optional()
|
|
82
86
|
});
|
|
83
|
-
|
|
84
|
-
courseId:
|
|
85
|
-
objectId:
|
|
86
|
-
objectType:
|
|
87
|
-
userText:
|
|
88
|
-
reaction:
|
|
89
|
-
highlightData:
|
|
87
|
+
d.object({
|
|
88
|
+
courseId: d.string(),
|
|
89
|
+
objectId: d.string(),
|
|
90
|
+
objectType: d.string(),
|
|
91
|
+
userText: d.string().optional(),
|
|
92
|
+
reaction: d.array(_e),
|
|
93
|
+
highlightData: Pe
|
|
90
94
|
});
|
|
91
|
-
|
|
92
|
-
createNote:
|
|
95
|
+
d.object({
|
|
96
|
+
createNote: Ie
|
|
93
97
|
});
|
|
94
|
-
|
|
95
|
-
id:
|
|
96
|
-
userText:
|
|
97
|
-
reaction:
|
|
98
|
-
highlightData:
|
|
98
|
+
d.object({
|
|
99
|
+
id: d.string(),
|
|
100
|
+
userText: d.string().optional(),
|
|
101
|
+
reaction: d.array(_e),
|
|
102
|
+
highlightData: Pe
|
|
99
103
|
});
|
|
100
|
-
|
|
101
|
-
updateNote:
|
|
104
|
+
d.object({
|
|
105
|
+
updateNote: Ie
|
|
102
106
|
});
|
|
103
|
-
|
|
104
|
-
deleteNote:
|
|
107
|
+
d.object({
|
|
108
|
+
deleteNote: d.string()
|
|
105
109
|
});
|
|
106
110
|
var Je = /* @__PURE__ */ ((t) => (t[t.FORWARDS = 1] = "FORWARDS", t[t.BACKWARDS = 2] = "BACKWARDS", t))(Je || {});
|
|
107
111
|
class oe {
|
|
@@ -200,18 +204,18 @@ class X {
|
|
|
200
204
|
return new X(n, o);
|
|
201
205
|
}
|
|
202
206
|
}
|
|
203
|
-
const
|
|
207
|
+
const Dt = (t) => {
|
|
204
208
|
const e = t.nodeName.toLowerCase();
|
|
205
209
|
return e === "#text" ? "text()" : e;
|
|
206
210
|
};
|
|
207
|
-
function
|
|
211
|
+
function Pt(t) {
|
|
208
212
|
let e = 0, n = t;
|
|
209
213
|
for (; n; )
|
|
210
214
|
n.nodeName === t.nodeName && (e += 1), n = n.previousSibling;
|
|
211
215
|
return e;
|
|
212
216
|
}
|
|
213
|
-
const
|
|
214
|
-
const e =
|
|
217
|
+
const _t = (t) => {
|
|
218
|
+
const e = Dt(t), n = Pt(t);
|
|
215
219
|
return `${e}[${n}]`;
|
|
216
220
|
}, Ge = (t, e) => {
|
|
217
221
|
let n = "", o = t;
|
|
@@ -220,10 +224,10 @@ const Pt = (t) => {
|
|
|
220
224
|
console.error("Node is not a descendant of root");
|
|
221
225
|
return;
|
|
222
226
|
}
|
|
223
|
-
n = `${
|
|
227
|
+
n = `${_t(o)}/${n}`, o = o.parentNode;
|
|
224
228
|
}
|
|
225
229
|
return n = `/${n}`, n = n.replace(/\/$/, ""), n;
|
|
226
|
-
},
|
|
230
|
+
}, Ft = (t, e, n) => {
|
|
227
231
|
const o = e.toUpperCase();
|
|
228
232
|
let r = -1;
|
|
229
233
|
for (let s = 0; s < t.children.length; s++) {
|
|
@@ -232,7 +236,7 @@ const Pt = (t) => {
|
|
|
232
236
|
return l;
|
|
233
237
|
}
|
|
234
238
|
return null;
|
|
235
|
-
},
|
|
239
|
+
}, Mt = (t, e) => {
|
|
236
240
|
if (!(t.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+])?)+$/) !== null))
|
|
237
241
|
return console.error("Expression is not a simple XPath"), null;
|
|
238
242
|
const o = t.split("/");
|
|
@@ -243,32 +247,32 @@ const Pt = (t) => {
|
|
|
243
247
|
const m = s.indexOf("[");
|
|
244
248
|
if (m !== -1) {
|
|
245
249
|
l = s.slice(0, m);
|
|
246
|
-
const
|
|
247
|
-
if (a = Number.parseInt(
|
|
250
|
+
const f = s.slice(m + 1, s.indexOf("]"));
|
|
251
|
+
if (a = Number.parseInt(f, 10) - 1, a < 0)
|
|
248
252
|
return null;
|
|
249
253
|
} else
|
|
250
254
|
l = s, a = 0;
|
|
251
|
-
const
|
|
252
|
-
if (!
|
|
255
|
+
const u = Ft(r, l, a);
|
|
256
|
+
if (!u)
|
|
253
257
|
return null;
|
|
254
|
-
r =
|
|
258
|
+
r = u;
|
|
255
259
|
}
|
|
256
260
|
return r;
|
|
257
261
|
}, je = (t, e = document.body) => {
|
|
258
262
|
if (t === "")
|
|
259
263
|
return e;
|
|
260
264
|
try {
|
|
261
|
-
return
|
|
265
|
+
return Mt(t, e);
|
|
262
266
|
} catch {
|
|
263
267
|
return document.evaluate(`.${t}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
264
268
|
}
|
|
265
269
|
};
|
|
266
|
-
class
|
|
270
|
+
class ce {
|
|
267
271
|
constructor(e, n) {
|
|
268
272
|
this.root = e, this.range = n;
|
|
269
273
|
}
|
|
270
274
|
static fromRange(e, n) {
|
|
271
|
-
return new
|
|
275
|
+
return new ce(e, n);
|
|
272
276
|
}
|
|
273
277
|
static fromSelector(e, n) {
|
|
274
278
|
if ((n == null ? void 0 : n.startContainer) == null || (n == null ? void 0 : n.endContainer) == null)
|
|
@@ -283,7 +287,7 @@ class ae {
|
|
|
283
287
|
if (!s || !l)
|
|
284
288
|
return null;
|
|
285
289
|
const a = new oe(s, l).toRange();
|
|
286
|
-
return a ? !e.contains(a.startContainer) || !e.contains(a.endContainer) ? (console.error("Resolved range escapes root"), null) : new
|
|
290
|
+
return a ? !e.contains(a.startContainer) || !e.contains(a.endContainer) ? (console.error("Resolved range escapes root"), null) : new ce(e, a) : null;
|
|
287
291
|
}
|
|
288
292
|
toRange() {
|
|
289
293
|
return this.range;
|
|
@@ -299,17 +303,17 @@ class ae {
|
|
|
299
303
|
};
|
|
300
304
|
}
|
|
301
305
|
}
|
|
302
|
-
class
|
|
306
|
+
class le {
|
|
303
307
|
constructor(e, n, o) {
|
|
304
308
|
this.root = e, this.start = n, this.end = o;
|
|
305
309
|
}
|
|
306
310
|
static fromRange(e, n) {
|
|
307
311
|
var r;
|
|
308
312
|
const o = (r = oe.fromRange(n)) == null ? void 0 : r.relativeTo(e);
|
|
309
|
-
return o ? new
|
|
313
|
+
return o ? new le(e, o.start.offset, o.end.offset) : null;
|
|
310
314
|
}
|
|
311
315
|
static fromSelector(e, n) {
|
|
312
|
-
return new
|
|
316
|
+
return new le(e, n.start, n.end);
|
|
313
317
|
}
|
|
314
318
|
toSelector() {
|
|
315
319
|
return {
|
|
@@ -344,63 +348,63 @@ const et = (t) => {
|
|
|
344
348
|
for (; n !== void 0 && l && a === n; )
|
|
345
349
|
r.push({ node: l, offset: l.data.length }), n = e.shift();
|
|
346
350
|
return n !== void 0 && console.error("Offset exceeds text length"), r;
|
|
347
|
-
},
|
|
351
|
+
}, Bt = (t, e, n, o) => {
|
|
348
352
|
const r = n - e;
|
|
349
|
-
return Math.abs(r - o) <= 5 ?
|
|
353
|
+
return Math.abs(r - o) <= 5 ? le.fromSelector(t, {
|
|
350
354
|
start: e,
|
|
351
355
|
end: n
|
|
352
356
|
}) : null;
|
|
353
|
-
},
|
|
354
|
-
const r = new
|
|
357
|
+
}, Ut = (t, e, n, o) => {
|
|
358
|
+
const r = new yt();
|
|
355
359
|
r.Match_Distance = 5e3;
|
|
356
360
|
const s = t.textContent;
|
|
357
361
|
if (!s)
|
|
358
362
|
return null;
|
|
359
363
|
if (e.length > 32) {
|
|
360
364
|
const l = e.slice(0, 32), a = e.slice(-32), m = o - n;
|
|
361
|
-
let
|
|
362
|
-
const
|
|
363
|
-
if (
|
|
365
|
+
let u = r.match_main(s, l, n);
|
|
366
|
+
const f = r.match_main(s, a, o), c = f + a.length;
|
|
367
|
+
if (u === -1 || f === -1)
|
|
364
368
|
return null;
|
|
365
|
-
const h =
|
|
366
|
-
if ((
|
|
367
|
-
return
|
|
368
|
-
if (
|
|
369
|
-
return
|
|
370
|
-
start:
|
|
371
|
-
end:
|
|
369
|
+
const h = c - u, N = Math.abs(h - m);
|
|
370
|
+
if ((u > c || N > 5) && (r.Match_Distance = e.length + 100, u = r.match_main(s, l, c), u !== -1 && u < c))
|
|
371
|
+
return Bt(t, u, c, m);
|
|
372
|
+
if (u < c && N <= 5)
|
|
373
|
+
return le.fromSelector(t, {
|
|
374
|
+
start: u,
|
|
375
|
+
end: c
|
|
372
376
|
});
|
|
373
377
|
} else {
|
|
374
378
|
const l = r.match_main(s, e, n);
|
|
375
379
|
if (l !== -1)
|
|
376
|
-
return
|
|
380
|
+
return le.fromSelector(t, {
|
|
377
381
|
start: l,
|
|
378
382
|
end: l + e.length
|
|
379
383
|
});
|
|
380
384
|
}
|
|
381
385
|
return null;
|
|
382
|
-
},
|
|
386
|
+
}, Ht = (t, e) => {
|
|
383
387
|
if (!e) return null;
|
|
384
388
|
const { highlightData: n } = t, { textPosition: o, selectedText: r } = n;
|
|
385
|
-
return
|
|
389
|
+
return Ut(
|
|
386
390
|
e,
|
|
387
391
|
r,
|
|
388
392
|
(o == null ? void 0 : o.start) ?? 0,
|
|
389
393
|
(o == null ? void 0 : o.end) ?? 0
|
|
390
394
|
);
|
|
391
|
-
},
|
|
395
|
+
}, $t = (t, e, n) => {
|
|
392
396
|
const o = [], r = [];
|
|
393
397
|
for (const s of e) {
|
|
394
|
-
const l =
|
|
398
|
+
const l = Ht(s, t);
|
|
395
399
|
if (l) {
|
|
396
|
-
const a = l.toRange(), m = a &&
|
|
400
|
+
const a = l.toRange(), m = a && ce.fromRange(t, a), u = (a == null ? void 0 : a.toString().trim()) || s.highlightData.selectedText;
|
|
397
401
|
o.push({
|
|
398
402
|
id: s.id,
|
|
399
403
|
reaction: s.reaction,
|
|
400
404
|
userText: s.userText,
|
|
401
405
|
highlightData: {
|
|
402
406
|
...s.highlightData,
|
|
403
|
-
selectedText:
|
|
407
|
+
selectedText: u,
|
|
404
408
|
hasNoHighlightAnymore: !1,
|
|
405
409
|
range: (m == null ? void 0 : m.toSelector()) ?? null,
|
|
406
410
|
textPosition: l.toSelector(),
|
|
@@ -424,59 +428,59 @@ const et = (t) => {
|
|
|
424
428
|
var l;
|
|
425
429
|
if (!e) return;
|
|
426
430
|
const { highlightData: n, id: o } = t, { range: r } = n ?? {};
|
|
427
|
-
r && ((l =
|
|
428
|
-
},
|
|
431
|
+
r && ((l = ce.fromSelector(e, r)) == null ? void 0 : l.toRange()) && en({ id: o });
|
|
432
|
+
}, Gt = (t) => {
|
|
429
433
|
const n = document.querySelector(
|
|
430
434
|
`[data-highlight-id="${CSS.escape(t)}"].highlight-content`
|
|
431
|
-
) ?? document.getElementById(
|
|
435
|
+
) ?? document.getElementById(Ce(t));
|
|
432
436
|
if (n) {
|
|
433
437
|
const o = n.getBoundingClientRect();
|
|
434
438
|
o.top >= 0 && o.bottom <= (window.innerHeight || document.documentElement.clientHeight) || n.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
435
439
|
}
|
|
436
|
-
},
|
|
440
|
+
}, Ne = 90, be = 172, jt = (t) => {
|
|
437
441
|
const e = t.getClientRects();
|
|
438
442
|
if (!e.length)
|
|
439
443
|
return null;
|
|
440
|
-
const n = e[0], o = e[e.length - 1], r = 4, s = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight, m = (
|
|
441
|
-
const
|
|
442
|
-
return
|
|
443
|
-
},
|
|
444
|
-
const
|
|
445
|
-
return
|
|
444
|
+
const n = e[0], o = e[e.length - 1], r = 4, s = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight, m = (p) => {
|
|
445
|
+
const x = p + be;
|
|
446
|
+
return p >= s && x <= l - s;
|
|
447
|
+
}, u = (p) => {
|
|
448
|
+
const x = p + Ne;
|
|
449
|
+
return p >= s && x <= a - s;
|
|
446
450
|
};
|
|
447
|
-
let
|
|
448
|
-
const
|
|
449
|
-
if (m(
|
|
450
|
-
|
|
451
|
+
let f;
|
|
452
|
+
const c = n.right - be;
|
|
453
|
+
if (m(c))
|
|
454
|
+
f = c;
|
|
451
455
|
else {
|
|
452
|
-
const
|
|
453
|
-
if (m(
|
|
454
|
-
|
|
456
|
+
const p = n.left;
|
|
457
|
+
if (m(p))
|
|
458
|
+
f = p;
|
|
455
459
|
else {
|
|
456
|
-
const
|
|
457
|
-
m(
|
|
460
|
+
const y = (n.left + n.right) / 2 - be / 2;
|
|
461
|
+
m(y) ? f = y : c < s ? f = s : f = l - be - s;
|
|
458
462
|
}
|
|
459
463
|
}
|
|
460
464
|
let h;
|
|
461
|
-
const
|
|
462
|
-
if (
|
|
463
|
-
h =
|
|
465
|
+
const N = o.bottom + r;
|
|
466
|
+
if (u(N))
|
|
467
|
+
h = N;
|
|
464
468
|
else {
|
|
465
|
-
const
|
|
466
|
-
|
|
469
|
+
const p = n.top - Ne - r;
|
|
470
|
+
u(p) ? h = p : N + Ne > a - s ? h = a - Ne - s : h = s;
|
|
467
471
|
}
|
|
468
|
-
return { top: h, left:
|
|
469
|
-
},
|
|
472
|
+
return { top: h, left: f };
|
|
473
|
+
}, Wt = (t, e) => {
|
|
470
474
|
for (const n of e)
|
|
471
475
|
if (t.start < n.end && t.end > n.start)
|
|
472
476
|
return !0;
|
|
473
477
|
return !1;
|
|
474
|
-
},
|
|
478
|
+
}, Fe = (t) => `highlight-wrapper-${t}`, Ce = (t) => `${Fe(t)}-start`, nt = (t) => `${Fe(t)}-end`, he = (t) => `[data-highlight-id="${CSS.escape(t)}"]`, zt = "2px", qt = "3px", Kt = "1px", ot = "3px", Xt = "1px", rt = "Notebook note", Me = (t, e) => {
|
|
475
479
|
const n = Number.parseInt(t.slice(1, 3), 16), o = Number.parseInt(t.slice(3, 5), 16), r = Number.parseInt(t.slice(5, 7), 16);
|
|
476
480
|
return `rgba(${n}, ${o}, ${r}, ${e})`;
|
|
477
481
|
}, st = (t, e, n, o, r) => {
|
|
478
|
-
t.style.backgroundColor = n, t.style.textDecorationColor = o, t.style.textDecorationStyle = r, e ? (t.dataset.selected = "true", t.style.outline = `${
|
|
479
|
-
},
|
|
482
|
+
t.style.backgroundColor = n, t.style.textDecorationColor = o, t.style.textDecorationStyle = r, e ? (t.dataset.selected = "true", t.style.outline = `${Kt} ${r} ${o}`, t.style.outlineOffset = Xt, t.style.borderRadius = ot, t.style.fontWeight = "bold") : (t.removeAttribute("data-selected"), t.style.outline = "", t.style.outlineOffset = "", t.style.borderRadius = "", t.style.fontWeight = "");
|
|
483
|
+
}, Vt = /* @__PURE__ */ new Set([
|
|
480
484
|
"AREA",
|
|
481
485
|
"BASE",
|
|
482
486
|
"BR",
|
|
@@ -495,11 +499,11 @@ const et = (t) => {
|
|
|
495
499
|
const n = t.cloneRange();
|
|
496
500
|
n.collapse(e);
|
|
497
501
|
const o = n.startContainer;
|
|
498
|
-
if (!(o.nodeType === Node.ELEMENT_NODE &&
|
|
502
|
+
if (!(o.nodeType === Node.ELEMENT_NODE && Vt.has(o.tagName)) || !o.parentNode)
|
|
499
503
|
return n;
|
|
500
504
|
const s = o.parentNode, l = Array.from(s.childNodes).indexOf(o), a = document.createRange();
|
|
501
505
|
return a.setStart(s, l), a.collapse(!0), a;
|
|
502
|
-
},
|
|
506
|
+
}, Qt = (t, e) => {
|
|
503
507
|
var n;
|
|
504
508
|
try {
|
|
505
509
|
const o = ((n = e.nodeValue) == null ? void 0 : n.length) ?? e.childNodes.length;
|
|
@@ -507,7 +511,7 @@ const et = (t) => {
|
|
|
507
511
|
} catch {
|
|
508
512
|
return !1;
|
|
509
513
|
}
|
|
510
|
-
},
|
|
514
|
+
}, Yt = (t) => {
|
|
511
515
|
var s;
|
|
512
516
|
if (t.collapsed)
|
|
513
517
|
return [];
|
|
@@ -517,7 +521,7 @@ const et = (t) => {
|
|
|
517
521
|
const n = [], o = (s = e == null ? void 0 : e.ownerDocument) == null ? void 0 : s.createNodeIterator(e, NodeFilter.SHOW_TEXT);
|
|
518
522
|
let r = (o == null ? void 0 : o.nextNode()) || null;
|
|
519
523
|
for (; r; ) {
|
|
520
|
-
if (!
|
|
524
|
+
if (!Qt(t, r)) {
|
|
521
525
|
r = (o == null ? void 0 : o.nextNode()) || null;
|
|
522
526
|
continue;
|
|
523
527
|
}
|
|
@@ -529,106 +533,106 @@ const et = (t) => {
|
|
|
529
533
|
l === t.endContainer && t.endOffset < l.data.length && l.splitText(t.endOffset), n.push(l), r = (o == null ? void 0 : o.nextNode()) || null;
|
|
530
534
|
}
|
|
531
535
|
return n;
|
|
532
|
-
},
|
|
536
|
+
}, Zt = (t, e, n) => {
|
|
533
537
|
if (t.collapsed) return;
|
|
534
|
-
const o = e.id ?? "", r =
|
|
535
|
-
if (document.getElementById(
|
|
536
|
-
|
|
538
|
+
const o = e.id ?? "", r = Fe(o);
|
|
539
|
+
if (document.getElementById(Ce(o))) {
|
|
540
|
+
Jt(e, n);
|
|
537
541
|
return;
|
|
538
542
|
}
|
|
539
|
-
const l = e.type ===
|
|
540
|
-
|
|
543
|
+
const l = e.type === L.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, m = a ? l : Me(l, 0.5), u = e.type === L.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, f = e.type === L.IMPORTANT ? "solid" : "dashed", c = document.createElement("span");
|
|
544
|
+
c.id = `${r}-start`, c.className = "highlight-marker-start", c.dataset.highlightId = o || "";
|
|
541
545
|
const h = e.labelPrefix ?? rt;
|
|
542
|
-
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
var
|
|
550
|
-
const
|
|
551
|
-
if ((
|
|
552
|
-
const D =
|
|
546
|
+
c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.setAttribute("aria-label", h), c.setAttribute("aria-haspopup", "dialog"), c.setAttribute("aria-expanded", String(a && !!e.isTrayOpen)), a && c.setAttribute("aria-current", "true"), e.popupId && c.setAttribute("aria-controls", e.popupId), c.style.position = "relative", c.style.fontSize = "0", c.style.lineHeight = "0", c.style.width = "0", c.style.height = "0", c.style.margin = "0", c.style.padding = "0", c.style.border = "0", c.style.outline = "none";
|
|
547
|
+
const N = document.createElement("span");
|
|
548
|
+
N.id = nt(o), N.className = "highlight-marker-end", N.dataset.highlightId = o || "", qe(t, !1).insertNode(N), qe(t, !0).insertNode(c);
|
|
549
|
+
const y = document.createRange();
|
|
550
|
+
y.setStartAfter(c), y.setEndBefore(N);
|
|
551
|
+
const z = Yt(y).filter((b) => b.textContent && b.textContent.length > 0);
|
|
552
|
+
z.forEach((b, T) => {
|
|
553
|
+
var j;
|
|
554
|
+
const P = b.parentElement;
|
|
555
|
+
if ((P == null ? void 0 : P.dataset.highlightId) === o) return;
|
|
556
|
+
const D = T === 0, G = T === z.length - 1, E = z.length === 1;
|
|
553
557
|
let w;
|
|
554
|
-
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
var
|
|
558
|
-
|
|
559
|
-
}), (
|
|
560
|
-
}),
|
|
561
|
-
var
|
|
562
|
-
|
|
563
|
-
}),
|
|
564
|
-
var
|
|
565
|
-
if (
|
|
566
|
-
|
|
567
|
-
else if (
|
|
568
|
-
const
|
|
569
|
-
for (const D of
|
|
570
|
-
const
|
|
571
|
-
if (
|
|
572
|
-
|
|
558
|
+
E ? w = "single" : D ? w = "first" : G ? w = "last" : w = "middle";
|
|
559
|
+
const v = document.createElement("span");
|
|
560
|
+
v.className = "highlight-content", v.dataset.highlightId = o || "", v.dataset.position = w, v.style.textDecorationLine = "underline", v.style.textDecorationThickness = n.borderWidthSmall, v.style.textUnderlineOffset = n.underlineOffset, v.style.cursor = "pointer", st(v, a, m, u, f), v.addEventListener("click", (ee) => {
|
|
561
|
+
var Q;
|
|
562
|
+
ee.target.tagName !== "A" && ((Q = e.onClick) == null || Q.call(e));
|
|
563
|
+
}), (j = b.parentNode) == null || j.insertBefore(v, b), v.appendChild(b);
|
|
564
|
+
}), c.addEventListener("click", (b) => {
|
|
565
|
+
var T;
|
|
566
|
+
b.target.tagName !== "A" && ((T = e.onClick) == null || T.call(e));
|
|
567
|
+
}), c.addEventListener("keydown", (b) => {
|
|
568
|
+
var T;
|
|
569
|
+
if (b.key === "Enter" || b.key === " ")
|
|
570
|
+
b.preventDefault(), (T = e.onClick) == null || T.call(e);
|
|
571
|
+
else if (b.key === "Tab" && !b.shiftKey) {
|
|
572
|
+
const P = document.querySelectorAll(he(o));
|
|
573
|
+
for (const D of P) {
|
|
574
|
+
const G = D.querySelector("a");
|
|
575
|
+
if (G) {
|
|
576
|
+
b.preventDefault(), G.focus();
|
|
573
577
|
break;
|
|
574
578
|
}
|
|
575
579
|
}
|
|
576
580
|
}
|
|
577
|
-
}),
|
|
581
|
+
}), c.addEventListener("focus", () => {
|
|
578
582
|
document.querySelectorAll(
|
|
579
|
-
`.highlight-content${
|
|
580
|
-
).forEach((
|
|
581
|
-
|
|
583
|
+
`.highlight-content${he(o)}`
|
|
584
|
+
).forEach((T) => {
|
|
585
|
+
T.style.boxShadow = `0 0 0 ${zt} ${n.colors.focusOutline}`, T.style.borderRadius = qt;
|
|
582
586
|
});
|
|
583
|
-
}),
|
|
587
|
+
}), c.addEventListener("blur", () => {
|
|
584
588
|
document.querySelectorAll(
|
|
585
|
-
`.highlight-content${
|
|
586
|
-
).forEach((
|
|
587
|
-
|
|
589
|
+
`.highlight-content${he(o)}`
|
|
590
|
+
).forEach((T) => {
|
|
591
|
+
T.style.boxShadow = "", T.style.borderRadius = T.dataset.selected ? ot : "";
|
|
588
592
|
});
|
|
589
593
|
});
|
|
590
594
|
};
|
|
591
|
-
function
|
|
592
|
-
const n = t.type ===
|
|
595
|
+
function Jt(t, e) {
|
|
596
|
+
const n = t.type === L.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, o = t.id === t.selectedNoteId, r = o ? n : Me(n, 0.5), s = t.type === L.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline, l = t.type === L.IMPORTANT ? "solid" : "dashed";
|
|
593
597
|
document.querySelectorAll(
|
|
594
|
-
`.highlight-content${
|
|
595
|
-
).forEach((
|
|
596
|
-
st(
|
|
598
|
+
`.highlight-content${he(t.id ?? "")}`
|
|
599
|
+
).forEach((u) => {
|
|
600
|
+
st(u, o, r, s, l);
|
|
597
601
|
});
|
|
598
602
|
const m = document.getElementById(
|
|
599
|
-
|
|
603
|
+
Ce(t.id ?? "")
|
|
600
604
|
);
|
|
601
605
|
m && (m.setAttribute("aria-label", t.labelPrefix ?? rt), m.setAttribute("aria-expanded", String(o && !!t.isTrayOpen)), o ? m.setAttribute("aria-current", "true") : m.removeAttribute("aria-current"));
|
|
602
606
|
}
|
|
603
|
-
const
|
|
604
|
-
const e = t.id ?? "", n = document.getElementById(
|
|
607
|
+
const en = (t) => {
|
|
608
|
+
const e = t.id ?? "", n = document.getElementById(Ce(e)), o = document.getElementById(nt(e));
|
|
605
609
|
document.querySelectorAll(
|
|
606
|
-
|
|
610
|
+
he(e)
|
|
607
611
|
).forEach((s) => {
|
|
608
612
|
var l;
|
|
609
613
|
for (; s.firstChild; )
|
|
610
614
|
(l = s.parentNode) == null || l.insertBefore(s.firstChild, s);
|
|
611
615
|
s.remove();
|
|
612
616
|
}), n == null || n.remove(), o == null || o.remove();
|
|
613
|
-
},
|
|
617
|
+
}, me = {
|
|
614
618
|
all: ["notebook"],
|
|
615
619
|
notes: (t) => ["notebook", "notes", t]
|
|
616
620
|
};
|
|
617
|
-
function
|
|
618
|
-
const e =
|
|
619
|
-
return
|
|
621
|
+
function tn(t) {
|
|
622
|
+
const e = Oe();
|
|
623
|
+
return Le({
|
|
620
624
|
mutationFn: (n) => t.createNote(n),
|
|
621
625
|
onSuccess: () => {
|
|
622
|
-
e.invalidateQueries({ queryKey:
|
|
626
|
+
e.invalidateQueries({ queryKey: me.all });
|
|
623
627
|
}
|
|
624
628
|
});
|
|
625
629
|
}
|
|
626
|
-
function
|
|
627
|
-
const e =
|
|
628
|
-
return
|
|
630
|
+
function nn(t) {
|
|
631
|
+
const e = Oe();
|
|
632
|
+
return Le({
|
|
629
633
|
mutationFn: (n) => t.deleteNote(n),
|
|
630
634
|
onSuccess: () => {
|
|
631
|
-
e.invalidateQueries({ queryKey:
|
|
635
|
+
e.invalidateQueries({ queryKey: me.all });
|
|
632
636
|
}
|
|
633
637
|
});
|
|
634
638
|
}
|
|
@@ -637,13 +641,13 @@ function it({
|
|
|
637
641
|
enabled: e = !0,
|
|
638
642
|
...n
|
|
639
643
|
}) {
|
|
640
|
-
return
|
|
641
|
-
queryKey:
|
|
644
|
+
return Nt({
|
|
645
|
+
queryKey: me.notes(n),
|
|
642
646
|
queryFn: () => t.getNotes(n),
|
|
643
647
|
enabled: e
|
|
644
648
|
});
|
|
645
649
|
}
|
|
646
|
-
const
|
|
650
|
+
const on = 100;
|
|
647
651
|
function lt({
|
|
648
652
|
api: t,
|
|
649
653
|
courseId: e,
|
|
@@ -659,23 +663,23 @@ function lt({
|
|
|
659
663
|
...o != null && o.length ? { reactions: o } : {}
|
|
660
664
|
},
|
|
661
665
|
offset: 0,
|
|
662
|
-
pageSize:
|
|
666
|
+
pageSize: on,
|
|
663
667
|
enabled: r
|
|
664
668
|
});
|
|
665
669
|
}
|
|
666
|
-
function
|
|
667
|
-
const e =
|
|
668
|
-
return
|
|
670
|
+
function rn(t) {
|
|
671
|
+
const e = Oe();
|
|
672
|
+
return Le({
|
|
669
673
|
mutationFn: ({ id: n, input: o }) => t.updateNote(n, o),
|
|
670
674
|
onMutate: async ({ id: n, input: o }) => {
|
|
671
|
-
await e.cancelQueries({ queryKey:
|
|
672
|
-
const s = e.getQueryCache().findAll({ queryKey:
|
|
675
|
+
await e.cancelQueries({ queryKey: me.all });
|
|
676
|
+
const s = e.getQueryCache().findAll({ queryKey: me.all }), l = /* @__PURE__ */ new Map();
|
|
673
677
|
for (const a of s) {
|
|
674
678
|
const m = a.state.data;
|
|
675
679
|
m && (l.set(a.queryKey, m), e.setQueryData(a.queryKey, {
|
|
676
680
|
...m,
|
|
677
681
|
notes: m.notes.map(
|
|
678
|
-
(
|
|
682
|
+
(u) => u.id === n ? { ...u, ...o, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } : u
|
|
679
683
|
)
|
|
680
684
|
}));
|
|
681
685
|
}
|
|
@@ -687,61 +691,63 @@ function on(t) {
|
|
|
687
691
|
e.setQueryData(s, l);
|
|
688
692
|
},
|
|
689
693
|
onSettled: () => {
|
|
690
|
-
e.invalidateQueries({ queryKey:
|
|
694
|
+
e.invalidateQueries({ queryKey: me.all });
|
|
691
695
|
}
|
|
692
696
|
});
|
|
693
697
|
}
|
|
694
|
-
const
|
|
695
|
-
notebook:
|
|
696
|
-
notes:
|
|
697
|
-
important:
|
|
698
|
-
unclear:
|
|
699
|
-
back:
|
|
700
|
-
editNote:
|
|
701
|
-
save:
|
|
702
|
-
cancel:
|
|
703
|
-
deleteNote:
|
|
704
|
-
deleteNoteConfirmation:
|
|
705
|
-
note:
|
|
706
|
-
addNotePrompt:
|
|
707
|
-
removeFromNotebook:
|
|
708
|
-
addNoteOptional:
|
|
698
|
+
const sn = "Notebook", ln = "Notes", an = "Important", cn = "Unclear", dn = "Back", un = "Edit note", fn = "Save", mn = "Cancel", gn = "Delete note", hn = "Delete note confirmation", pn = "note", yn = "Add note (optional)", Nn = "Remove from Notebook", bn = "Add a note (optional)", En = "Mark important", Sn = "Mark unclear", Tn = "Saved to Notebook.", vn = "Note updated", In = "Note deleted", Cn = "Error saving to Notebook.", xn = "Error updating note", Rn = "Note deletion failed", wn = "Loading notes", kn = "Failed to load notes", On = "Start capturing your notes", Ln = "To use the Notebook feature, select text on a page to mark it as Important or Unclear, and add an optional note.", An = "Only you can see your Notebook. Instructors and classmates don't see your notes.", Dn = "Nothing here yet", Pn = "Adjust your filters or create a new note to get started.", _n = "You have no notes for the selected filter", Fn = "Filter", Mn = "Previous page", Bn = "Next page", Un = "All courses", Hn = "All notes", $n = "Close Notebook panel", Gn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", jn = "The content you highlighted is no longer available.", Wn = "This source is no longer available.", zn = "Notebook note", Be = {
|
|
699
|
+
notebook: sn,
|
|
700
|
+
notes: ln,
|
|
701
|
+
important: an,
|
|
702
|
+
unclear: cn,
|
|
703
|
+
back: dn,
|
|
704
|
+
editNote: un,
|
|
705
|
+
save: fn,
|
|
706
|
+
cancel: mn,
|
|
707
|
+
deleteNote: gn,
|
|
708
|
+
deleteNoteConfirmation: hn,
|
|
709
|
+
note: pn,
|
|
710
|
+
addNotePrompt: yn,
|
|
711
|
+
removeFromNotebook: Nn,
|
|
712
|
+
addNoteOptional: bn,
|
|
709
713
|
markImportant: En,
|
|
710
|
-
markUnclear:
|
|
714
|
+
markUnclear: Sn,
|
|
711
715
|
savedToNotebook: Tn,
|
|
712
|
-
noteUpdated:
|
|
713
|
-
noteDeleted:
|
|
714
|
-
errorSavingNote:
|
|
715
|
-
errorUpdatingNote:
|
|
716
|
-
noteDeletionFailed:
|
|
717
|
-
loadingNotes:
|
|
718
|
-
failedToLoadNotes:
|
|
719
|
-
emptyStateHeading:
|
|
720
|
-
emptyStateDescription:
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
716
|
+
noteUpdated: vn,
|
|
717
|
+
noteDeleted: In,
|
|
718
|
+
errorSavingNote: Cn,
|
|
719
|
+
errorUpdatingNote: xn,
|
|
720
|
+
noteDeletionFailed: Rn,
|
|
721
|
+
loadingNotes: wn,
|
|
722
|
+
failedToLoadNotes: kn,
|
|
723
|
+
emptyStateHeading: On,
|
|
724
|
+
emptyStateDescription: Ln,
|
|
725
|
+
emptyStatePrecision: An,
|
|
726
|
+
nothingHereYet: Dn,
|
|
727
|
+
adjustFiltersOrCreate: Pn,
|
|
728
|
+
noNotesForFilter: _n,
|
|
729
|
+
filter: Fn,
|
|
730
|
+
previousPage: Mn,
|
|
731
|
+
nextPage: Bn,
|
|
732
|
+
allCourses: Un,
|
|
733
|
+
allNotes: Hn,
|
|
729
734
|
closeNotebookPanel: $n,
|
|
730
|
-
featureDescription:
|
|
731
|
-
highlightUnavailable:
|
|
732
|
-
|
|
735
|
+
featureDescription: Gn,
|
|
736
|
+
highlightUnavailable: jn,
|
|
737
|
+
highlightSourceUnavailable: Wn,
|
|
738
|
+
notebookNote: zn
|
|
733
739
|
}, at = Ve(null);
|
|
734
740
|
function ct(t, e) {
|
|
735
|
-
const n =
|
|
741
|
+
const n = Be[t] ?? t;
|
|
736
742
|
return e ? n.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : n;
|
|
737
743
|
}
|
|
738
|
-
function
|
|
744
|
+
function qn({
|
|
739
745
|
translations: t,
|
|
740
746
|
translate: e,
|
|
741
747
|
children: n
|
|
742
748
|
}) {
|
|
743
|
-
const o =
|
|
744
|
-
translations: new Proxy(
|
|
749
|
+
const o = pe(() => ({
|
|
750
|
+
translations: new Proxy(Be, {
|
|
745
751
|
get(s, l) {
|
|
746
752
|
return (t == null ? void 0 : t[l]) ?? s[l];
|
|
747
753
|
}
|
|
@@ -750,16 +756,16 @@ function jn({
|
|
|
750
756
|
}), [t, e]);
|
|
751
757
|
return /* @__PURE__ */ i(at.Provider, { value: o, children: n });
|
|
752
758
|
}
|
|
753
|
-
function
|
|
759
|
+
function J() {
|
|
754
760
|
const t = Qe(at);
|
|
755
|
-
return t || { translations:
|
|
761
|
+
return t || { translations: Be, translate: ct };
|
|
756
762
|
}
|
|
757
|
-
const
|
|
763
|
+
const Kn = (t) => ({
|
|
758
764
|
selectedNoteId: t ?? null,
|
|
759
765
|
isNoteEditing: !1,
|
|
760
766
|
isTrayOpen: t != null
|
|
761
767
|
});
|
|
762
|
-
function
|
|
768
|
+
function Xn(t, e) {
|
|
763
769
|
switch (e.type) {
|
|
764
770
|
case "SELECT_NOTE":
|
|
765
771
|
return {
|
|
@@ -780,7 +786,7 @@ function zn(t, e) {
|
|
|
780
786
|
}
|
|
781
787
|
}
|
|
782
788
|
const dt = Ve(null);
|
|
783
|
-
function
|
|
789
|
+
function xo({
|
|
784
790
|
api: t,
|
|
785
791
|
currentUserId: e,
|
|
786
792
|
objectId: n,
|
|
@@ -790,10 +796,10 @@ function Co({
|
|
|
790
796
|
onOpen: l,
|
|
791
797
|
initialNoteId: a,
|
|
792
798
|
translations: m,
|
|
793
|
-
translate:
|
|
794
|
-
children:
|
|
799
|
+
translate: u,
|
|
800
|
+
children: f
|
|
795
801
|
}) {
|
|
796
|
-
const [
|
|
802
|
+
const [c, h] = Ye(Xn, Kn(a)), N = F(a != null), p = pe(
|
|
797
803
|
() => ({
|
|
798
804
|
api: t,
|
|
799
805
|
currentUserId: e,
|
|
@@ -801,20 +807,20 @@ function Co({
|
|
|
801
807
|
objectType: o,
|
|
802
808
|
courseId: r,
|
|
803
809
|
pageLastModifiedAt: s,
|
|
804
|
-
...
|
|
805
|
-
selectNote: (
|
|
810
|
+
...c,
|
|
811
|
+
selectNote: (x, y = !1) => h({ type: "SELECT_NOTE", payload: { id: x, isEditing: y } }),
|
|
806
812
|
clearSelectedNote: () => h({ type: "CLEAR_SELECTED_NOTE" }),
|
|
807
|
-
setEditing: (
|
|
813
|
+
setEditing: (x) => h({ type: "SET_EDITING", payload: x }),
|
|
808
814
|
openTray: () => {
|
|
809
|
-
|
|
815
|
+
N.current || (N.current = !0, l == null || l()), h({ type: "OPEN_TRAY" });
|
|
810
816
|
},
|
|
811
817
|
closeTray: () => {
|
|
812
|
-
|
|
818
|
+
N.current = !1, h({ type: "CLOSE_TRAY" });
|
|
813
819
|
}
|
|
814
820
|
}),
|
|
815
|
-
[t, e, n, o, r, s, l,
|
|
821
|
+
[t, e, n, o, r, s, l, c]
|
|
816
822
|
);
|
|
817
|
-
return /* @__PURE__ */ i(dt.Provider, { value:
|
|
823
|
+
return /* @__PURE__ */ i(dt.Provider, { value: p, children: /* @__PURE__ */ i(qn, { translations: m, translate: u, children: f }) });
|
|
818
824
|
}
|
|
819
825
|
function ut() {
|
|
820
826
|
const t = Qe(dt);
|
|
@@ -822,8 +828,8 @@ function ut() {
|
|
|
822
828
|
throw new Error("useNotebook must be used within a NotebookProvider");
|
|
823
829
|
return t;
|
|
824
830
|
}
|
|
825
|
-
const ft = "notebook-tray-content",
|
|
826
|
-
const { isTrayOpen: e, closeTray: n } = ut(), { translations: o } =
|
|
831
|
+
const ft = "notebook-tray-content", Ro = ({ children: t }) => {
|
|
832
|
+
const { isTrayOpen: e, closeTray: n } = ut(), { translations: o } = J();
|
|
827
833
|
return /* @__PURE__ */ i(
|
|
828
834
|
Et,
|
|
829
835
|
{
|
|
@@ -832,11 +838,11 @@ const ft = "notebook-tray-content", vo = ({ children: t }) => {
|
|
|
832
838
|
onDismiss: n,
|
|
833
839
|
placement: "end",
|
|
834
840
|
size: "regular",
|
|
835
|
-
children: /* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */ i(
|
|
837
|
-
/* @__PURE__ */ i(
|
|
841
|
+
children: /* @__PURE__ */ S(C, { direction: "column", height: "100vh", id: ft, children: [
|
|
842
|
+
/* @__PURE__ */ i(C.Item, { children: /* @__PURE__ */ i(V, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ S(C, { justifyItems: "space-between", alignItems: "center", children: [
|
|
843
|
+
/* @__PURE__ */ i(ve, { level: "h3", children: o.notebook }),
|
|
838
844
|
/* @__PURE__ */ i(
|
|
839
|
-
|
|
845
|
+
bt,
|
|
840
846
|
{
|
|
841
847
|
screenReaderLabel: o.closeNotebookPanel,
|
|
842
848
|
onClick: n,
|
|
@@ -845,18 +851,18 @@ const ft = "notebook-tray-content", vo = ({ children: t }) => {
|
|
|
845
851
|
}
|
|
846
852
|
)
|
|
847
853
|
] }) }) }),
|
|
848
|
-
/* @__PURE__ */ i(
|
|
854
|
+
/* @__PURE__ */ i(C.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
|
|
849
855
|
] })
|
|
850
856
|
}
|
|
851
857
|
);
|
|
852
|
-
},
|
|
858
|
+
}, Vn = ({
|
|
853
859
|
currentType: t,
|
|
854
860
|
disabled: e = !1,
|
|
855
861
|
onSelectReaction: n
|
|
856
862
|
}) => {
|
|
857
|
-
const { translations: o } =
|
|
858
|
-
return
|
|
859
|
-
t ===
|
|
863
|
+
const { translations: o } = J(), r = F(null), s = F(null);
|
|
864
|
+
return q(() => {
|
|
865
|
+
t === L.CONFUSING && r.current ? r.current.focus() : t === L.IMPORTANT && s.current ? s.current.focus() : r.current && r.current.focus();
|
|
860
866
|
}, [t]), /* @__PURE__ */ i(
|
|
861
867
|
V,
|
|
862
868
|
{
|
|
@@ -866,27 +872,27 @@ const ft = "notebook-tray-content", vo = ({ children: t }) => {
|
|
|
866
872
|
borderColor: "secondary",
|
|
867
873
|
borderRadius: "medium",
|
|
868
874
|
shadow: "resting",
|
|
869
|
-
children: /* @__PURE__ */
|
|
870
|
-
/* @__PURE__ */
|
|
871
|
-
|
|
875
|
+
children: /* @__PURE__ */ S(fe, { children: [
|
|
876
|
+
/* @__PURE__ */ S(
|
|
877
|
+
fe.Item,
|
|
872
878
|
{
|
|
873
879
|
ref: r,
|
|
874
880
|
disabled: e,
|
|
875
|
-
onClick: () => n(
|
|
881
|
+
onClick: () => n(L.CONFUSING),
|
|
876
882
|
children: [
|
|
877
|
-
/* @__PURE__ */ i(
|
|
883
|
+
/* @__PURE__ */ i(Ae, { size: "x-small" }),
|
|
878
884
|
` ${o.markUnclear}`
|
|
879
885
|
]
|
|
880
886
|
}
|
|
881
887
|
),
|
|
882
|
-
/* @__PURE__ */
|
|
883
|
-
|
|
888
|
+
/* @__PURE__ */ S(
|
|
889
|
+
fe.Item,
|
|
884
890
|
{
|
|
885
891
|
ref: s,
|
|
886
892
|
disabled: e,
|
|
887
|
-
onClick: () => n(
|
|
893
|
+
onClick: () => n(L.IMPORTANT),
|
|
888
894
|
children: [
|
|
889
|
-
/* @__PURE__ */ i(
|
|
895
|
+
/* @__PURE__ */ i(De, { size: "x-small" }),
|
|
890
896
|
` ${o.markImportant}`
|
|
891
897
|
]
|
|
892
898
|
}
|
|
@@ -894,8 +900,8 @@ const ft = "notebook-tray-content", vo = ({ children: t }) => {
|
|
|
894
900
|
] })
|
|
895
901
|
}
|
|
896
902
|
);
|
|
897
|
-
},
|
|
898
|
-
function
|
|
903
|
+
}, xe = "notebook-inline-reaction-menu";
|
|
904
|
+
function wo({
|
|
899
905
|
containerRef: t,
|
|
900
906
|
highlightTheme: e,
|
|
901
907
|
debounceTime: n = 500,
|
|
@@ -907,201 +913,201 @@ function Io({
|
|
|
907
913
|
const {
|
|
908
914
|
api: a,
|
|
909
915
|
objectId: m,
|
|
910
|
-
objectType:
|
|
911
|
-
courseId:
|
|
912
|
-
pageLastModifiedAt:
|
|
916
|
+
objectType: u,
|
|
917
|
+
courseId: f,
|
|
918
|
+
pageLastModifiedAt: c,
|
|
913
919
|
selectedNoteId: h,
|
|
914
|
-
isTrayOpen:
|
|
915
|
-
selectNote:
|
|
916
|
-
openTray:
|
|
917
|
-
} = ut(), { translations:
|
|
920
|
+
isTrayOpen: N,
|
|
921
|
+
selectNote: p,
|
|
922
|
+
openTray: x
|
|
923
|
+
} = ut(), { translations: y } = J(), { data: k } = lt({
|
|
918
924
|
api: a,
|
|
919
|
-
courseId:
|
|
920
|
-
learningObject: { type:
|
|
921
|
-
}), { mutate:
|
|
922
|
-
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
const
|
|
926
|
-
if (!
|
|
927
|
-
const
|
|
928
|
-
if (
|
|
929
|
-
|
|
925
|
+
courseId: f,
|
|
926
|
+
learningObject: { type: u, id: m }
|
|
927
|
+
}), { mutate: z, isPending: b } = tn(a), { mutateAsync: T } = rn(a), { mutate: P } = nn(a), D = F([]), [G, E] = W([]), [w, v] = W(null), [j, ee] = W(""), [Q, ae] = W(null), de = F(null);
|
|
928
|
+
de.current = Q;
|
|
929
|
+
const te = F(!1), [re, se] = W(!1);
|
|
930
|
+
q(() => {
|
|
931
|
+
const M = t.current;
|
|
932
|
+
if (!M) return;
|
|
933
|
+
const I = M.closest(".user_content") ?? M;
|
|
934
|
+
if (I.classList.contains("enhanced")) {
|
|
935
|
+
se(!0);
|
|
930
936
|
return;
|
|
931
937
|
}
|
|
932
|
-
const
|
|
933
|
-
for (const
|
|
934
|
-
if (
|
|
935
|
-
|
|
938
|
+
const _ = new MutationObserver((B) => {
|
|
939
|
+
for (const H of B)
|
|
940
|
+
if (H.type === "attributes" && H.attributeName === "class" && H.target.classList.contains("enhanced")) {
|
|
941
|
+
se(!0), _.disconnect();
|
|
936
942
|
return;
|
|
937
943
|
}
|
|
938
944
|
});
|
|
939
|
-
return
|
|
945
|
+
return _.observe(I, { attributes: !0, attributeFilter: ["class"] }), () => _.disconnect();
|
|
940
946
|
}, [t]);
|
|
941
|
-
const
|
|
942
|
-
|
|
947
|
+
const A = K(() => {
|
|
948
|
+
ae(null), v(null), ee("");
|
|
943
949
|
}, []);
|
|
944
|
-
|
|
945
|
-
if (!
|
|
946
|
-
let
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
var
|
|
950
|
-
const R = window.getSelection(),
|
|
951
|
-
if (!(R != null && R.rangeCount) || !
|
|
952
|
-
const
|
|
953
|
-
if (
|
|
954
|
-
const
|
|
955
|
-
if (!
|
|
956
|
-
const
|
|
957
|
-
|
|
950
|
+
q(() => {
|
|
951
|
+
if (!re || !t.current) return;
|
|
952
|
+
let I = null;
|
|
953
|
+
const _ = () => {
|
|
954
|
+
I && clearTimeout(I), I = setTimeout(() => {
|
|
955
|
+
var Ue;
|
|
956
|
+
const R = window.getSelection(), U = t.current;
|
|
957
|
+
if (!(R != null && R.rangeCount) || !U) return;
|
|
958
|
+
const g = R.toString().trim();
|
|
959
|
+
if (g === "") return;
|
|
960
|
+
const $ = R.getRangeAt(0);
|
|
961
|
+
if (!U.contains($.commonAncestorContainer)) return;
|
|
962
|
+
const ie = (Ue = le.fromRange(U, $)) == null ? void 0 : Ue.toSelector();
|
|
963
|
+
ie && !Wt(ie, G) && (v($.cloneRange()), ee(g), ae(jt($)));
|
|
958
964
|
}, n);
|
|
959
|
-
},
|
|
965
|
+
}, B = (R) => {
|
|
960
966
|
if (!(R.target instanceof Node)) return;
|
|
961
|
-
const
|
|
962
|
-
|
|
963
|
-
},
|
|
964
|
-
|
|
965
|
-
},
|
|
966
|
-
R.key === "Escape" &&
|
|
967
|
+
const U = document.getElementById(xe);
|
|
968
|
+
U != null && U.contains(R.target) ? (R.preventDefault(), R.stopImmediatePropagation()) : A();
|
|
969
|
+
}, H = () => {
|
|
970
|
+
A();
|
|
971
|
+
}, O = (R) => {
|
|
972
|
+
R.key === "Escape" && de.current !== null && (A(), R.stopImmediatePropagation());
|
|
967
973
|
};
|
|
968
|
-
return document.addEventListener("selectionchange",
|
|
969
|
-
|
|
974
|
+
return document.addEventListener("selectionchange", _), document.addEventListener("mousedown", B), document.addEventListener("touchstart", B), document.addEventListener("keydown", O), window.addEventListener("scroll", H, !0), () => {
|
|
975
|
+
I && clearTimeout(I), document.removeEventListener("selectionchange", _), document.removeEventListener("mousedown", B), document.removeEventListener("touchstart", B), document.removeEventListener("keydown", O), window.removeEventListener("scroll", H, !0);
|
|
970
976
|
};
|
|
971
|
-
}, [
|
|
977
|
+
}, [re, G, n, t, A]);
|
|
972
978
|
const Y = K(
|
|
973
|
-
(
|
|
974
|
-
var
|
|
975
|
-
const
|
|
976
|
-
if (!
|
|
977
|
-
const { highlightData:
|
|
979
|
+
(M) => {
|
|
980
|
+
var U;
|
|
981
|
+
const I = t.current;
|
|
982
|
+
if (!I || !M.highlightData) return null;
|
|
983
|
+
const { highlightData: _, reaction: B, id: H } = M, { range: O } = _, R = O && ((U = ce.fromSelector(I, O)) == null ? void 0 : U.toRange());
|
|
978
984
|
if (R) {
|
|
979
|
-
const
|
|
980
|
-
id:
|
|
985
|
+
const g = B[0] === L.IMPORTANT ? y.important : y.unclear, $ = {
|
|
986
|
+
id: H,
|
|
981
987
|
selectedNoteId: h,
|
|
982
|
-
type:
|
|
983
|
-
isTrayOpen:
|
|
984
|
-
labelPrefix: `${
|
|
988
|
+
type: B[0],
|
|
989
|
+
isTrayOpen: N,
|
|
990
|
+
labelPrefix: `${y.notebookNote} (${g})`,
|
|
985
991
|
popupId: ft,
|
|
986
992
|
onClick: () => {
|
|
987
|
-
|
|
993
|
+
p(H), x();
|
|
988
994
|
}
|
|
989
995
|
};
|
|
990
|
-
return
|
|
996
|
+
return Zt(R, $, e), _.textPosition;
|
|
991
997
|
}
|
|
992
998
|
return null;
|
|
993
999
|
},
|
|
994
|
-
[t, h,
|
|
1000
|
+
[t, h, N, e, y, p, x]
|
|
995
1001
|
);
|
|
996
|
-
|
|
997
|
-
if (!
|
|
998
|
-
const
|
|
999
|
-
if (
|
|
1002
|
+
q(() => {
|
|
1003
|
+
if (!re || !k || !t.current) return;
|
|
1004
|
+
const M = t.current, I = k.notes, _ = /* @__PURE__ */ new Set(), B = [], H = [];
|
|
1005
|
+
if (I.length === 0) {
|
|
1000
1006
|
if (D.current.length > 0) {
|
|
1001
|
-
for (const
|
|
1002
|
-
ze(
|
|
1003
|
-
D.current = [],
|
|
1007
|
+
for (const O of D.current)
|
|
1008
|
+
ze(O, M);
|
|
1009
|
+
D.current = [], E([]);
|
|
1004
1010
|
}
|
|
1005
1011
|
return;
|
|
1006
1012
|
}
|
|
1007
|
-
if (
|
|
1008
|
-
const { notesForUpdate:
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1013
|
+
if (c && I[0].highlightData.pageLastModifiedAt !== c) {
|
|
1014
|
+
const { notesForUpdate: O, noteIdsForDelete: R } = $t(
|
|
1015
|
+
M,
|
|
1016
|
+
I,
|
|
1017
|
+
c
|
|
1012
1018
|
);
|
|
1013
|
-
for (const
|
|
1014
|
-
|
|
1015
|
-
for (const
|
|
1016
|
-
|
|
1019
|
+
for (const U of O)
|
|
1020
|
+
T({ id: U.id, input: U }).catch((g) => r == null ? void 0 : r(g));
|
|
1021
|
+
for (const U of R)
|
|
1022
|
+
P(U, { onError: s });
|
|
1017
1023
|
} else {
|
|
1018
|
-
for (const
|
|
1019
|
-
const R = Y(
|
|
1020
|
-
|
|
1024
|
+
for (const O of I) {
|
|
1025
|
+
const R = Y(O);
|
|
1026
|
+
_.add(O.id), R && (B.push(O), H.push(R));
|
|
1021
1027
|
}
|
|
1022
|
-
for (const
|
|
1023
|
-
|
|
1024
|
-
|
|
1028
|
+
for (const O of D.current)
|
|
1029
|
+
_.has(O.id) || ze(O, M);
|
|
1030
|
+
E(H), D.current = B, h && Gt(h);
|
|
1025
1031
|
}
|
|
1026
1032
|
}, [
|
|
1027
|
-
|
|
1028
|
-
|
|
1033
|
+
re,
|
|
1034
|
+
k,
|
|
1029
1035
|
Y,
|
|
1030
|
-
|
|
1036
|
+
c,
|
|
1031
1037
|
t,
|
|
1032
|
-
|
|
1033
|
-
|
|
1038
|
+
T,
|
|
1039
|
+
P,
|
|
1034
1040
|
h
|
|
1035
1041
|
]);
|
|
1036
|
-
const
|
|
1037
|
-
const
|
|
1038
|
-
if (!w || !
|
|
1039
|
-
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1042
|
+
const ue = (M) => {
|
|
1043
|
+
const I = t.current;
|
|
1044
|
+
if (!w || !I || te.current) return;
|
|
1045
|
+
te.current = !0;
|
|
1046
|
+
const _ = ce.fromRange(I, w), B = le.fromRange(I, w);
|
|
1047
|
+
z(
|
|
1042
1048
|
{
|
|
1043
|
-
courseId:
|
|
1049
|
+
courseId: f,
|
|
1044
1050
|
objectId: m,
|
|
1045
|
-
objectType:
|
|
1051
|
+
objectType: u,
|
|
1046
1052
|
userText: "",
|
|
1047
|
-
reaction: [
|
|
1053
|
+
reaction: [M],
|
|
1048
1054
|
highlightData: {
|
|
1049
|
-
selectedText:
|
|
1050
|
-
textPosition: (
|
|
1051
|
-
range:
|
|
1052
|
-
pageLastModifiedAt:
|
|
1055
|
+
selectedText: j,
|
|
1056
|
+
textPosition: (B == null ? void 0 : B.toSelector()) ?? null,
|
|
1057
|
+
range: _.toSelector(),
|
|
1058
|
+
pageLastModifiedAt: c ?? ""
|
|
1053
1059
|
}
|
|
1054
1060
|
},
|
|
1055
1061
|
{
|
|
1056
|
-
onSuccess: (
|
|
1062
|
+
onSuccess: (H) => {
|
|
1057
1063
|
var R;
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1064
|
+
const O = H.id;
|
|
1065
|
+
A(), (R = window.getSelection()) == null || R.removeAllRanges(), p(O), x(), l == null || l(H);
|
|
1060
1066
|
},
|
|
1061
1067
|
onError: o,
|
|
1062
1068
|
// Unlock on failure too, so the user can retry from the still-open menu
|
|
1063
1069
|
onSettled: () => {
|
|
1064
|
-
|
|
1070
|
+
te.current = !1;
|
|
1065
1071
|
}
|
|
1066
1072
|
}
|
|
1067
1073
|
);
|
|
1068
1074
|
};
|
|
1069
|
-
return !w || !
|
|
1075
|
+
return !w || !Q ? null : pt(
|
|
1070
1076
|
/* @__PURE__ */ i(
|
|
1071
1077
|
"div",
|
|
1072
1078
|
{
|
|
1073
|
-
id:
|
|
1079
|
+
id: xe,
|
|
1074
1080
|
role: "toolbar",
|
|
1075
1081
|
style: {
|
|
1076
1082
|
position: "fixed",
|
|
1077
1083
|
zIndex: 100,
|
|
1078
|
-
top:
|
|
1079
|
-
left:
|
|
1084
|
+
top: Q.top,
|
|
1085
|
+
left: Q.left,
|
|
1080
1086
|
whiteSpace: "nowrap"
|
|
1081
1087
|
},
|
|
1082
|
-
onBlur: (
|
|
1083
|
-
const
|
|
1084
|
-
|
|
1088
|
+
onBlur: (M) => {
|
|
1089
|
+
const I = document.getElementById(xe);
|
|
1090
|
+
I != null && I.contains(M.relatedTarget) || A();
|
|
1085
1091
|
},
|
|
1086
|
-
children: /* @__PURE__ */ i(
|
|
1092
|
+
children: /* @__PURE__ */ i(Vn, { onSelectReaction: ue, disabled: b })
|
|
1087
1093
|
}
|
|
1088
1094
|
),
|
|
1089
1095
|
document.body
|
|
1090
1096
|
);
|
|
1091
1097
|
}
|
|
1092
|
-
const
|
|
1093
|
-
backgroundColor: t ===
|
|
1094
|
-
underlineColor: t ===
|
|
1095
|
-
underlineStyle: t ===
|
|
1096
|
-
}),
|
|
1098
|
+
const Qn = (t, e) => ({
|
|
1099
|
+
backgroundColor: t === L.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
1100
|
+
underlineColor: t === L.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
1101
|
+
underlineStyle: t === L.IMPORTANT ? "solid" : "dashed"
|
|
1102
|
+
}), ke = ({
|
|
1097
1103
|
children: t,
|
|
1098
|
-
type: e =
|
|
1104
|
+
type: e = L.IMPORTANT,
|
|
1099
1105
|
isCardActive: n = !0,
|
|
1100
1106
|
theme: o
|
|
1101
1107
|
}) => {
|
|
1102
|
-
const r =
|
|
1108
|
+
const r = Qn(e, o), l = {
|
|
1103
1109
|
position: "relative",
|
|
1104
|
-
backgroundColor: n ? r.backgroundColor :
|
|
1110
|
+
backgroundColor: n ? r.backgroundColor : Me(r.backgroundColor, 0.5),
|
|
1105
1111
|
textDecorationLine: "underline",
|
|
1106
1112
|
textDecorationStyle: r.underlineStyle,
|
|
1107
1113
|
textDecorationColor: r.underlineColor,
|
|
@@ -1110,13 +1116,17 @@ const Kn = (t, e) => ({
|
|
|
1110
1116
|
lineHeight: "normal"
|
|
1111
1117
|
};
|
|
1112
1118
|
return /* @__PURE__ */ i("span", { "data-note-highlight": "true", style: l, children: t });
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
return
|
|
1116
|
-
|
|
1117
|
-
|
|
1119
|
+
};
|
|
1120
|
+
function mt(t, e = "noHighlight") {
|
|
1121
|
+
return e === "sourceUnavailable" ? t.highlightSourceUnavailable : t.highlightUnavailable;
|
|
1122
|
+
}
|
|
1123
|
+
const gt = ({ reason: t } = {}) => {
|
|
1124
|
+
const { translations: e } = J();
|
|
1125
|
+
return /* @__PURE__ */ S(C, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1126
|
+
/* @__PURE__ */ i(C.Item, { as: "div", children: /* @__PURE__ */ i(St, { color: "error" }) }),
|
|
1127
|
+
/* @__PURE__ */ i(C.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ i(Se, { maxLines: 3, children: mt(e, t) }) })
|
|
1118
1128
|
] });
|
|
1119
|
-
},
|
|
1129
|
+
}, Yn = {
|
|
1120
1130
|
filter: null,
|
|
1121
1131
|
courseFilter: null,
|
|
1122
1132
|
currentPage: 1,
|
|
@@ -1126,7 +1136,7 @@ function Ee(t, e) {
|
|
|
1126
1136
|
const n = typeof e == "number" ? Math.min(e, t) : t;
|
|
1127
1137
|
return Math.max(1, n);
|
|
1128
1138
|
}
|
|
1129
|
-
function
|
|
1139
|
+
function Zn(t, e) {
|
|
1130
1140
|
switch (e.type) {
|
|
1131
1141
|
case "SET_FILTER":
|
|
1132
1142
|
return { ...t, filter: e.payload, currentPage: 1 };
|
|
@@ -1150,7 +1160,7 @@ function Vn(t, e) {
|
|
|
1150
1160
|
return t;
|
|
1151
1161
|
}
|
|
1152
1162
|
}
|
|
1153
|
-
function
|
|
1163
|
+
function ko({
|
|
1154
1164
|
api: t,
|
|
1155
1165
|
courseId: e,
|
|
1156
1166
|
enableCourseFilter: n = !1,
|
|
@@ -1158,109 +1168,109 @@ function xo({
|
|
|
1158
1168
|
pageSize: r = 16,
|
|
1159
1169
|
focusNoteId: s
|
|
1160
1170
|
}) {
|
|
1161
|
-
var
|
|
1162
|
-
const [l, a] = Ye(
|
|
1163
|
-
|
|
1171
|
+
var se;
|
|
1172
|
+
const [l, a] = Ye(Zn, Yn), { filter: m, courseFilter: u, currentPage: f, totalPages: c } = l;
|
|
1173
|
+
q(() => {
|
|
1164
1174
|
a({ type: "SET_PAGE", payload: 1 });
|
|
1165
1175
|
}, [r]);
|
|
1166
|
-
const h = n ?
|
|
1176
|
+
const h = n ? u : e, N = (f - 1) * r, p = !!o, x = {
|
|
1167
1177
|
...h ? { courseId: h } : {},
|
|
1168
1178
|
...m ? { reactions: [m] } : {},
|
|
1169
1179
|
...o ? { learningObject: o } : {}
|
|
1170
1180
|
}, {
|
|
1171
|
-
data:
|
|
1172
|
-
isLoading:
|
|
1173
|
-
isError:
|
|
1181
|
+
data: y,
|
|
1182
|
+
isLoading: k,
|
|
1183
|
+
isError: z
|
|
1174
1184
|
} = it({
|
|
1175
1185
|
api: t,
|
|
1176
|
-
filter:
|
|
1177
|
-
offset:
|
|
1186
|
+
filter: x,
|
|
1187
|
+
offset: N,
|
|
1178
1188
|
pageSize: r,
|
|
1179
|
-
enabled: !
|
|
1189
|
+
enabled: !p
|
|
1180
1190
|
}), {
|
|
1181
|
-
data:
|
|
1182
|
-
isLoading:
|
|
1183
|
-
isError:
|
|
1191
|
+
data: b,
|
|
1192
|
+
isLoading: T,
|
|
1193
|
+
isError: P
|
|
1184
1194
|
} = lt({
|
|
1185
1195
|
api: t,
|
|
1186
1196
|
courseId: h ?? void 0,
|
|
1187
1197
|
learningObject: o,
|
|
1188
|
-
enabled:
|
|
1189
|
-
}), D =
|
|
1190
|
-
const
|
|
1191
|
-
return m ?
|
|
1192
|
-
}, [
|
|
1193
|
-
|
|
1198
|
+
enabled: p
|
|
1199
|
+
}), D = pe(() => {
|
|
1200
|
+
const A = (b == null ? void 0 : b.notes) ?? [];
|
|
1201
|
+
return m ? A.filter((Y) => Y.reaction.includes(m)) : A;
|
|
1202
|
+
}, [b, m]), G = F(null);
|
|
1203
|
+
q(() => {
|
|
1194
1204
|
if (!s) {
|
|
1195
|
-
|
|
1205
|
+
G.current = null;
|
|
1196
1206
|
return;
|
|
1197
1207
|
}
|
|
1198
|
-
if (
|
|
1199
|
-
const
|
|
1200
|
-
if (
|
|
1201
|
-
|
|
1202
|
-
const Y = Math.floor(
|
|
1203
|
-
Y !==
|
|
1204
|
-
}, [s, D, r,
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
a({ type: "SET_TOTAL_PAGES", payload:
|
|
1208
|
-
}, [
|
|
1209
|
-
const
|
|
1210
|
-
a({ type: "SET_PAGE", payload:
|
|
1211
|
-
}, []),
|
|
1208
|
+
if (G.current === s) return;
|
|
1209
|
+
const A = D.findIndex((ue) => ue.id === s);
|
|
1210
|
+
if (A === -1) return;
|
|
1211
|
+
G.current = s;
|
|
1212
|
+
const Y = Math.floor(A / r) + 1;
|
|
1213
|
+
Y !== f && a({ type: "FOCUS_PAGE", payload: Y });
|
|
1214
|
+
}, [s, D, r, f]);
|
|
1215
|
+
const E = p ? D.slice(N, N + r) : (y == null ? void 0 : y.notes) ?? [], w = p ? T : k, v = p ? P : z, j = p ? Math.max(1, Math.ceil(D.length / r)) : ((se = y == null ? void 0 : y.pageInfo) == null ? void 0 : se.totalNrOfPages) ?? void 0, ee = p ? { totalCount: D.length, totalNrOfPages: j } : y == null ? void 0 : y.pageInfo;
|
|
1216
|
+
q(() => {
|
|
1217
|
+
a({ type: "SET_TOTAL_PAGES", payload: j });
|
|
1218
|
+
}, [j]);
|
|
1219
|
+
const Q = K((A) => {
|
|
1220
|
+
a({ type: "SET_PAGE", payload: A });
|
|
1221
|
+
}, []), ae = K(() => {
|
|
1212
1222
|
a({
|
|
1213
1223
|
type: "INCREMENT_PAGE"
|
|
1214
1224
|
/* IncrementPage */
|
|
1215
1225
|
});
|
|
1216
|
-
}, []),
|
|
1226
|
+
}, []), de = K(() => {
|
|
1217
1227
|
a({
|
|
1218
1228
|
type: "DECREMENT_PAGE"
|
|
1219
1229
|
/* DecrementPage */
|
|
1220
1230
|
});
|
|
1221
|
-
}, []),
|
|
1222
|
-
a({ type: "SET_FILTER", payload:
|
|
1223
|
-
}, []),
|
|
1224
|
-
a({ type: "SET_COURSE_FILTER", payload:
|
|
1231
|
+
}, []), te = K((A) => {
|
|
1232
|
+
a({ type: "SET_FILTER", payload: A });
|
|
1233
|
+
}, []), re = K((A) => {
|
|
1234
|
+
a({ type: "SET_COURSE_FILTER", payload: A });
|
|
1225
1235
|
}, []);
|
|
1226
1236
|
return {
|
|
1227
|
-
notes:
|
|
1228
|
-
pageInfo:
|
|
1237
|
+
notes: E,
|
|
1238
|
+
pageInfo: ee,
|
|
1229
1239
|
isLoading: w,
|
|
1230
|
-
isError:
|
|
1240
|
+
isError: v,
|
|
1231
1241
|
filter: m,
|
|
1232
|
-
courseFilter:
|
|
1233
|
-
currentPage:
|
|
1234
|
-
totalPages:
|
|
1235
|
-
setFilter:
|
|
1236
|
-
setCourseFilter:
|
|
1237
|
-
setPage:
|
|
1238
|
-
fetchNextPage:
|
|
1239
|
-
fetchPreviousPage:
|
|
1242
|
+
courseFilter: u,
|
|
1243
|
+
currentPage: f,
|
|
1244
|
+
totalPages: c,
|
|
1245
|
+
setFilter: te,
|
|
1246
|
+
setCourseFilter: re,
|
|
1247
|
+
setPage: Q,
|
|
1248
|
+
fetchNextPage: ae,
|
|
1249
|
+
fetchPreviousPage: de
|
|
1240
1250
|
};
|
|
1241
1251
|
}
|
|
1242
|
-
const
|
|
1243
|
-
function
|
|
1244
|
-
const { translations: n } =
|
|
1252
|
+
const Re = "all";
|
|
1253
|
+
function Oo({ filter: t, setFilter: e }) {
|
|
1254
|
+
const { translations: n } = J(), o = pe(
|
|
1245
1255
|
() => [
|
|
1246
|
-
{ label: n.allNotes, value:
|
|
1247
|
-
{ label: n.important, value:
|
|
1248
|
-
{ label: n.unclear, value:
|
|
1256
|
+
{ label: n.allNotes, value: Re },
|
|
1257
|
+
{ label: n.important, value: L.IMPORTANT },
|
|
1258
|
+
{ label: n.unclear, value: L.CONFUSING }
|
|
1249
1259
|
],
|
|
1250
1260
|
[n]
|
|
1251
1261
|
), r = K(
|
|
1252
1262
|
(l, { value: a }) => {
|
|
1253
|
-
e(!a || a ===
|
|
1263
|
+
e(!a || a === Re ? null : a);
|
|
1254
1264
|
},
|
|
1255
1265
|
[e]
|
|
1256
1266
|
);
|
|
1257
1267
|
return {
|
|
1258
|
-
filterElement:
|
|
1268
|
+
filterElement: pe(
|
|
1259
1269
|
() => /* @__PURE__ */ i(
|
|
1260
1270
|
He,
|
|
1261
1271
|
{
|
|
1262
1272
|
renderLabel: n.filter,
|
|
1263
|
-
value: t ??
|
|
1273
|
+
value: t ?? Re,
|
|
1264
1274
|
onChange: r,
|
|
1265
1275
|
children: o.map((l) => /* @__PURE__ */ i(He.Option, { id: l.value, value: l.value, children: l.label }, l.value))
|
|
1266
1276
|
}
|
|
@@ -1271,44 +1281,45 @@ function Ro({ filter: t, setFilter: e }) {
|
|
|
1271
1281
|
handleReactionFilterChange: r
|
|
1272
1282
|
};
|
|
1273
1283
|
}
|
|
1274
|
-
const
|
|
1275
|
-
const { translations: e } =
|
|
1276
|
-
return /* @__PURE__ */ i(V, { as: "div", textAlign: "center", children: /* @__PURE__ */
|
|
1284
|
+
const Jn = ({ hasActiveFilter: t = !1 }) => {
|
|
1285
|
+
const { translations: e } = J(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1286
|
+
return /* @__PURE__ */ i(V, { as: "div", textAlign: "center", children: /* @__PURE__ */ S(C, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1277
1287
|
!t && /* @__PURE__ */ i(Tt, { size: "medium" }),
|
|
1278
|
-
/* @__PURE__ */ i(
|
|
1279
|
-
/* @__PURE__ */ i(
|
|
1288
|
+
/* @__PURE__ */ i(ve, { level: "h3", children: n }),
|
|
1289
|
+
/* @__PURE__ */ i(Z, { color: "secondary", children: o }),
|
|
1290
|
+
!t && /* @__PURE__ */ i(Z, { color: "secondary", children: e.emptyStatePrecision })
|
|
1280
1291
|
] }) });
|
|
1281
|
-
},
|
|
1282
|
-
[
|
|
1292
|
+
}, eo = {
|
|
1293
|
+
[L.IMPORTANT]: {
|
|
1283
1294
|
color: "success",
|
|
1284
1295
|
translationKey: "important",
|
|
1285
|
-
icon: /* @__PURE__ */ i(
|
|
1296
|
+
icon: /* @__PURE__ */ i(De, { size: "x-small" })
|
|
1286
1297
|
},
|
|
1287
|
-
[
|
|
1298
|
+
[L.CONFUSING]: {
|
|
1288
1299
|
color: "error",
|
|
1289
1300
|
translationKey: "unclear",
|
|
1290
|
-
icon: /* @__PURE__ */ i(
|
|
1301
|
+
icon: /* @__PURE__ */ i(Ae, { size: "x-small" })
|
|
1291
1302
|
}
|
|
1292
|
-
},
|
|
1293
|
-
const { translations: o } =
|
|
1303
|
+
}, ht = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
|
|
1304
|
+
const { translations: o } = J(), r = eo[t], s = o[r.translationKey], [l, a] = W(!1), m = F(null), u = F(null), f = F(null), c = K(
|
|
1294
1305
|
(h) => {
|
|
1295
1306
|
e == null || e(h), a(!1);
|
|
1296
1307
|
},
|
|
1297
1308
|
[e]
|
|
1298
1309
|
);
|
|
1299
|
-
return
|
|
1310
|
+
return q(() => {
|
|
1300
1311
|
if (!l) return;
|
|
1301
|
-
const h = (
|
|
1302
|
-
|
|
1303
|
-
},
|
|
1304
|
-
var
|
|
1305
|
-
|
|
1312
|
+
const h = (p) => {
|
|
1313
|
+
p.key === "Escape" && p.stopPropagation();
|
|
1314
|
+
}, N = (p) => {
|
|
1315
|
+
var x;
|
|
1316
|
+
p.key === "Escape" && (p.stopPropagation(), a(!1), (x = f.current) == null || x.focus());
|
|
1306
1317
|
};
|
|
1307
|
-
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup",
|
|
1308
|
-
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup",
|
|
1318
|
+
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup", N, !0), () => {
|
|
1319
|
+
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup", N, !0);
|
|
1309
1320
|
};
|
|
1310
|
-
}, [l]), n && e ? /* @__PURE__ */
|
|
1311
|
-
|
|
1321
|
+
}, [l]), n && e ? /* @__PURE__ */ S(
|
|
1322
|
+
fe,
|
|
1312
1323
|
{
|
|
1313
1324
|
placement: "bottom start",
|
|
1314
1325
|
show: l,
|
|
@@ -1316,28 +1327,28 @@ const Qn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1316
1327
|
shouldHideOnSelect: !0,
|
|
1317
1328
|
shouldFocusTriggerOnClose: !0,
|
|
1318
1329
|
trigger: /* @__PURE__ */ i(
|
|
1319
|
-
|
|
1330
|
+
$e,
|
|
1320
1331
|
{
|
|
1321
1332
|
color: r.color,
|
|
1322
1333
|
renderIcon: r.icon,
|
|
1323
1334
|
elementRef: (h) => {
|
|
1324
|
-
|
|
1335
|
+
f.current = h;
|
|
1325
1336
|
},
|
|
1326
1337
|
children: s
|
|
1327
1338
|
}
|
|
1328
1339
|
),
|
|
1329
1340
|
children: [
|
|
1330
|
-
/* @__PURE__ */
|
|
1331
|
-
/* @__PURE__ */ i(
|
|
1341
|
+
/* @__PURE__ */ S(fe.Item, { ref: m, onClick: () => c(L.CONFUSING), children: [
|
|
1342
|
+
/* @__PURE__ */ i(Ae, { size: "x-small" }),
|
|
1332
1343
|
` ${o.markUnclear}`
|
|
1333
1344
|
] }),
|
|
1334
|
-
/* @__PURE__ */
|
|
1335
|
-
/* @__PURE__ */ i(
|
|
1345
|
+
/* @__PURE__ */ S(fe.Item, { ref: u, onClick: () => c(L.IMPORTANT), children: [
|
|
1346
|
+
/* @__PURE__ */ i(De, { size: "x-small" }),
|
|
1336
1347
|
` ${o.markImportant}`
|
|
1337
1348
|
] })
|
|
1338
1349
|
]
|
|
1339
1350
|
}
|
|
1340
|
-
) : /* @__PURE__ */ i(V, { display: "inline-flex", children: /* @__PURE__ */ i(
|
|
1351
|
+
) : /* @__PURE__ */ i(V, { display: "inline-flex", children: /* @__PURE__ */ i($e, { color: r.color, renderIcon: r.icon, children: s }) });
|
|
1341
1352
|
};
|
|
1342
1353
|
function Ke(t, e) {
|
|
1343
1354
|
return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
|
|
@@ -1346,59 +1357,62 @@ function Ke(t, e) {
|
|
|
1346
1357
|
day: "numeric"
|
|
1347
1358
|
});
|
|
1348
1359
|
}
|
|
1349
|
-
const
|
|
1360
|
+
const to = ({
|
|
1350
1361
|
noteId: t,
|
|
1351
1362
|
date: e,
|
|
1352
1363
|
highlight: n,
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1364
|
+
highlightUnavailableReason: o,
|
|
1365
|
+
note: r,
|
|
1366
|
+
type: s,
|
|
1367
|
+
onClick: l,
|
|
1368
|
+
onDelete: a,
|
|
1369
|
+
onSaveNote: m,
|
|
1370
|
+
onTypeChange: u,
|
|
1371
|
+
isActive: f,
|
|
1372
|
+
isPanelView: c = !1,
|
|
1373
|
+
courseName: h,
|
|
1374
|
+
locale: N,
|
|
1375
|
+
highlightTheme: p,
|
|
1376
|
+
renderLink: x,
|
|
1377
|
+
href: y
|
|
1366
1378
|
}) => {
|
|
1367
|
-
const { translations:
|
|
1368
|
-
|
|
1369
|
-
}, []),
|
|
1370
|
-
|
|
1371
|
-
var
|
|
1372
|
-
|
|
1373
|
-
}, [
|
|
1374
|
-
var
|
|
1375
|
-
|
|
1376
|
-
}, [
|
|
1377
|
-
if (!
|
|
1378
|
-
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1379
|
+
const { translations: k } = J(), [z, b] = W(!1), [T, P] = W(!1), [D, G] = W(r || ""), [E, w] = W(!1), [v, j] = W(!1), [ee, Q] = W(!1), [ae, de] = W(!1), te = F(null), re = K((g) => {
|
|
1380
|
+
te.current = g;
|
|
1381
|
+
}, []), se = F(null), A = F(null), Y = F(!1), ue = F(null), M = F(null), I = F(!1);
|
|
1382
|
+
q(() => {
|
|
1383
|
+
var g, $;
|
|
1384
|
+
f ? ((g = te.current) == null || g.scrollIntoView({ behavior: "smooth", block: "nearest" }), ($ = te.current) == null || $.focus()) : w(!1);
|
|
1385
|
+
}, [f]), q(() => {
|
|
1386
|
+
var g, $;
|
|
1387
|
+
T ? (Y.current = !0, (g = se.current) == null || g.focus()) : Y.current && (Y.current = !1, ($ = A.current) == null || $.focus());
|
|
1388
|
+
}, [T]), q(() => {
|
|
1389
|
+
if (!E && I.current) {
|
|
1390
|
+
I.current = !1;
|
|
1391
|
+
const g = ue.current;
|
|
1392
|
+
g != null && g.isConnected && g.focus();
|
|
1381
1393
|
}
|
|
1382
|
-
}, [
|
|
1383
|
-
const
|
|
1384
|
-
|
|
1394
|
+
}, [E]);
|
|
1395
|
+
const _ = K((g, $) => {
|
|
1396
|
+
I.current = !$, w(!1);
|
|
1385
1397
|
}, []);
|
|
1386
|
-
|
|
1387
|
-
if (!
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
},
|
|
1391
|
-
|
|
1398
|
+
q(() => {
|
|
1399
|
+
if (!E) return;
|
|
1400
|
+
const g = (ie) => {
|
|
1401
|
+
ie.key === "Escape" && ie.stopPropagation();
|
|
1402
|
+
}, $ = (ie) => {
|
|
1403
|
+
ie.key === "Escape" && (ie.stopPropagation(), _());
|
|
1392
1404
|
};
|
|
1393
|
-
return window.addEventListener("keydown",
|
|
1394
|
-
window.removeEventListener("keydown",
|
|
1405
|
+
return window.addEventListener("keydown", g, !0), window.addEventListener("keyup", $, !0), () => {
|
|
1406
|
+
window.removeEventListener("keydown", g, !0), window.removeEventListener("keyup", $, !0);
|
|
1395
1407
|
};
|
|
1396
|
-
}, [
|
|
1397
|
-
const
|
|
1398
|
-
|
|
1399
|
-
},
|
|
1400
|
-
|
|
1401
|
-
|
|
1408
|
+
}, [E, _]);
|
|
1409
|
+
const B = s === L.IMPORTANT ? k.important : k.unclear, H = (g) => {
|
|
1410
|
+
g.key === "Enter" && (g.preventDefault(), l == null || l());
|
|
1411
|
+
}, O = [k.note, B];
|
|
1412
|
+
O.push(
|
|
1413
|
+
n || mt(k, o)
|
|
1414
|
+
), r && O.push(r), e && O.push(Ke(e, N)), h && O.push(h);
|
|
1415
|
+
const R = O.join(", "), U = /* @__PURE__ */ S(
|
|
1402
1416
|
V,
|
|
1403
1417
|
{
|
|
1404
1418
|
as: "div",
|
|
@@ -1407,17 +1421,17 @@ const Zn = ({
|
|
|
1407
1421
|
borderRadius: "medium",
|
|
1408
1422
|
padding: "small",
|
|
1409
1423
|
position: "relative",
|
|
1410
|
-
role:
|
|
1411
|
-
"aria-label":
|
|
1412
|
-
"aria-pressed":
|
|
1413
|
-
tabIndex:
|
|
1424
|
+
role: y ? void 0 : f || T ? "group" : "button",
|
|
1425
|
+
"aria-label": y ? void 0 : R,
|
|
1426
|
+
"aria-pressed": y || f || T ? void 0 : f,
|
|
1427
|
+
tabIndex: y || f ? -1 : 0,
|
|
1414
1428
|
"data-testid": `note-card-${t}`,
|
|
1415
|
-
elementRef:
|
|
1416
|
-
onClick:
|
|
1417
|
-
onMouseEnter: () =>
|
|
1418
|
-
onMouseLeave: () =>
|
|
1419
|
-
onKeyDown:
|
|
1420
|
-
cursor:
|
|
1429
|
+
elementRef: re,
|
|
1430
|
+
onClick: f ? void 0 : l,
|
|
1431
|
+
onMouseEnter: () => b(!0),
|
|
1432
|
+
onMouseLeave: () => b(!1),
|
|
1433
|
+
onKeyDown: f ? void 0 : H,
|
|
1434
|
+
cursor: T ? "default" : "pointer",
|
|
1421
1435
|
children: [
|
|
1422
1436
|
/* @__PURE__ */ i(
|
|
1423
1437
|
"div",
|
|
@@ -1425,15 +1439,15 @@ const Zn = ({
|
|
|
1425
1439
|
"data-testid": `note-card-${t}-content`,
|
|
1426
1440
|
style: {
|
|
1427
1441
|
height: "100%",
|
|
1428
|
-
opacity:
|
|
1442
|
+
opacity: f && E && a ? 0.25 : void 0
|
|
1429
1443
|
},
|
|
1430
|
-
children: /* @__PURE__ */
|
|
1444
|
+
children: /* @__PURE__ */ S(C, { direction: "column", gap: "small", height: "100%", children: [
|
|
1431
1445
|
/* @__PURE__ */ i(
|
|
1432
|
-
|
|
1446
|
+
ht,
|
|
1433
1447
|
{
|
|
1434
|
-
type:
|
|
1435
|
-
onTypeChange:
|
|
1436
|
-
renderAsMenuTrigger:
|
|
1448
|
+
type: s,
|
|
1449
|
+
onTypeChange: c && u ? (g) => u(t, g) : void 0,
|
|
1450
|
+
renderAsMenuTrigger: c && !!u && !!f
|
|
1437
1451
|
}
|
|
1438
1452
|
),
|
|
1439
1453
|
n ? /* @__PURE__ */ i(
|
|
@@ -1444,56 +1458,56 @@ const Zn = ({
|
|
|
1444
1458
|
overflowWrap: "break-word",
|
|
1445
1459
|
whiteSpace: "pre-wrap"
|
|
1446
1460
|
},
|
|
1447
|
-
children: /* @__PURE__ */ i(
|
|
1448
|
-
|
|
1461
|
+
children: /* @__PURE__ */ i(Z, { children: f && c ? /* @__PURE__ */ i(
|
|
1462
|
+
ke,
|
|
1449
1463
|
{
|
|
1450
|
-
type:
|
|
1451
|
-
isCardActive: !!
|
|
1452
|
-
theme:
|
|
1464
|
+
type: s,
|
|
1465
|
+
isCardActive: !!f || z,
|
|
1466
|
+
theme: p,
|
|
1453
1467
|
children: n
|
|
1454
1468
|
}
|
|
1455
|
-
) : /* @__PURE__ */
|
|
1456
|
-
|
|
1457
|
-
/* @__PURE__ */ i("span", { "aria-hidden":
|
|
1458
|
-
|
|
1469
|
+
) : /* @__PURE__ */ S(Xe, { children: [
|
|
1470
|
+
v && /* @__PURE__ */ i(ye, { children: n }),
|
|
1471
|
+
/* @__PURE__ */ i("span", { "aria-hidden": v, style: { display: "block" }, children: /* @__PURE__ */ i(Se, { maxLines: 3, truncate: "word", onUpdate: j, children: /* @__PURE__ */ i(
|
|
1472
|
+
ke,
|
|
1459
1473
|
{
|
|
1460
|
-
type:
|
|
1461
|
-
isCardActive: !!
|
|
1462
|
-
theme:
|
|
1474
|
+
type: s,
|
|
1475
|
+
isCardActive: !!f || z,
|
|
1476
|
+
theme: p,
|
|
1463
1477
|
children: n
|
|
1464
1478
|
}
|
|
1465
1479
|
) }) })
|
|
1466
1480
|
] }) })
|
|
1467
1481
|
}
|
|
1468
|
-
) : /* @__PURE__ */ i(
|
|
1469
|
-
/* @__PURE__ */ i(
|
|
1470
|
-
|
|
1482
|
+
) : /* @__PURE__ */ i(gt, { reason: o }),
|
|
1483
|
+
/* @__PURE__ */ i(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ S(C, { direction: "column", gap: "small", height: "100%", children: [
|
|
1484
|
+
T && c ? /* @__PURE__ */ S(C, { direction: "column", gap: "x-small", margin: "xx-small", children: [
|
|
1471
1485
|
/* @__PURE__ */ i(
|
|
1472
1486
|
Ze,
|
|
1473
1487
|
{
|
|
1474
|
-
label: /* @__PURE__ */ i(
|
|
1475
|
-
value:
|
|
1476
|
-
onChange: (
|
|
1477
|
-
placeholder:
|
|
1478
|
-
textareaRef: (
|
|
1479
|
-
|
|
1488
|
+
label: /* @__PURE__ */ i(ye, { children: k.editNote }),
|
|
1489
|
+
value: D,
|
|
1490
|
+
onChange: (g) => G(g.target.value),
|
|
1491
|
+
placeholder: k.addNoteOptional,
|
|
1492
|
+
textareaRef: (g) => {
|
|
1493
|
+
se.current = g;
|
|
1480
1494
|
}
|
|
1481
1495
|
}
|
|
1482
1496
|
),
|
|
1483
|
-
/* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */ i(
|
|
1497
|
+
/* @__PURE__ */ S(C, { gap: "xx-small", children: [
|
|
1498
|
+
/* @__PURE__ */ i(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1485
1499
|
ne,
|
|
1486
1500
|
{
|
|
1487
1501
|
display: "block",
|
|
1488
1502
|
size: "small",
|
|
1489
1503
|
"data-testid": `note-card-${t}-cancel`,
|
|
1490
1504
|
onClick: () => {
|
|
1491
|
-
|
|
1505
|
+
G(r || ""), P(!1);
|
|
1492
1506
|
},
|
|
1493
|
-
children:
|
|
1507
|
+
children: k.cancel
|
|
1494
1508
|
}
|
|
1495
1509
|
) }),
|
|
1496
|
-
/* @__PURE__ */ i(
|
|
1510
|
+
/* @__PURE__ */ i(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1497
1511
|
ne,
|
|
1498
1512
|
{
|
|
1499
1513
|
display: "block",
|
|
@@ -1501,13 +1515,13 @@ const Zn = ({
|
|
|
1501
1515
|
size: "small",
|
|
1502
1516
|
"data-testid": `note-card-${t}-save`,
|
|
1503
1517
|
onClick: () => {
|
|
1504
|
-
|
|
1518
|
+
m == null || m(t, D.trim()), P(!1);
|
|
1505
1519
|
},
|
|
1506
|
-
children:
|
|
1520
|
+
children: k.save
|
|
1507
1521
|
}
|
|
1508
1522
|
) })
|
|
1509
1523
|
] })
|
|
1510
|
-
] }) :
|
|
1524
|
+
] }) : r ? /* @__PURE__ */ i(
|
|
1511
1525
|
"div",
|
|
1512
1526
|
{
|
|
1513
1527
|
style: {
|
|
@@ -1515,86 +1529,86 @@ const Zn = ({
|
|
|
1515
1529
|
overflowWrap: "break-word",
|
|
1516
1530
|
whiteSpace: "pre-wrap"
|
|
1517
1531
|
},
|
|
1518
|
-
children:
|
|
1519
|
-
|
|
1532
|
+
children: f && c ? /* @__PURE__ */ S(Z, { children: [
|
|
1533
|
+
r,
|
|
1520
1534
|
" ",
|
|
1521
1535
|
/* @__PURE__ */ i(
|
|
1522
|
-
|
|
1536
|
+
ge,
|
|
1523
1537
|
{
|
|
1524
1538
|
size: "small",
|
|
1525
1539
|
withBackground: !1,
|
|
1526
1540
|
withBorder: !1,
|
|
1527
1541
|
margin: "xx-small 0 0 xxx-small",
|
|
1528
|
-
screenReaderLabel:
|
|
1542
|
+
screenReaderLabel: k.editNote,
|
|
1529
1543
|
"data-testid": `note-card-${t}-edit`,
|
|
1530
|
-
elementRef: (
|
|
1531
|
-
|
|
1544
|
+
elementRef: (g) => {
|
|
1545
|
+
A.current = g;
|
|
1532
1546
|
},
|
|
1533
|
-
onClick: (
|
|
1534
|
-
|
|
1547
|
+
onClick: (g) => {
|
|
1548
|
+
g.stopPropagation(), P(!0);
|
|
1535
1549
|
},
|
|
1536
|
-
children: /* @__PURE__ */ i(
|
|
1550
|
+
children: /* @__PURE__ */ i(we, {})
|
|
1537
1551
|
}
|
|
1538
1552
|
)
|
|
1539
|
-
] }) : /* @__PURE__ */
|
|
1540
|
-
|
|
1541
|
-
/* @__PURE__ */ i("span", { "aria-hidden":
|
|
1553
|
+
] }) : /* @__PURE__ */ S(Z, { children: [
|
|
1554
|
+
ee && /* @__PURE__ */ i(ye, { children: r }),
|
|
1555
|
+
/* @__PURE__ */ i("span", { "aria-hidden": ee, style: { display: "block" }, children: /* @__PURE__ */ i(Se, { maxLines: 3, truncate: "word", onUpdate: Q, children: r }) })
|
|
1542
1556
|
] })
|
|
1543
1557
|
}
|
|
1544
|
-
) :
|
|
1545
|
-
|
|
1558
|
+
) : c && f ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ S(Z, { color: "secondary", children: [
|
|
1559
|
+
k.addNotePrompt,
|
|
1546
1560
|
" ",
|
|
1547
1561
|
/* @__PURE__ */ i(
|
|
1548
|
-
|
|
1562
|
+
ge,
|
|
1549
1563
|
{
|
|
1550
1564
|
size: "small",
|
|
1551
1565
|
withBackground: !1,
|
|
1552
1566
|
withBorder: !1,
|
|
1553
1567
|
margin: "xx-small 0 0 xxx-small",
|
|
1554
|
-
screenReaderLabel:
|
|
1568
|
+
screenReaderLabel: k.editNote,
|
|
1555
1569
|
"data-testid": `note-card-${t}-edit`,
|
|
1556
|
-
elementRef: (
|
|
1557
|
-
|
|
1570
|
+
elementRef: (g) => {
|
|
1571
|
+
A.current = g;
|
|
1558
1572
|
},
|
|
1559
|
-
onClick: (
|
|
1560
|
-
|
|
1573
|
+
onClick: (g) => {
|
|
1574
|
+
g.stopPropagation(), P(!0);
|
|
1561
1575
|
},
|
|
1562
|
-
children: /* @__PURE__ */ i(
|
|
1576
|
+
children: /* @__PURE__ */ i(we, {})
|
|
1563
1577
|
}
|
|
1564
1578
|
)
|
|
1565
1579
|
] }) }) : null,
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */ i(
|
|
1568
|
-
|
|
1569
|
-
|
|
1580
|
+
/* @__PURE__ */ S(C, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
|
|
1581
|
+
/* @__PURE__ */ i(Z, { as: "div", size: "small", color: "secondary", children: Ke(e, N) }),
|
|
1582
|
+
f && a && /* @__PURE__ */ i(
|
|
1583
|
+
ge,
|
|
1570
1584
|
{
|
|
1571
1585
|
size: "small",
|
|
1572
1586
|
withBackground: !1,
|
|
1573
1587
|
withBorder: !1,
|
|
1574
1588
|
color: "danger",
|
|
1575
1589
|
margin: "xx-small",
|
|
1576
|
-
screenReaderLabel:
|
|
1590
|
+
screenReaderLabel: k.deleteNote,
|
|
1577
1591
|
"data-testid": `note-card-${t}-delete`,
|
|
1578
|
-
elementRef: (
|
|
1579
|
-
|
|
1592
|
+
elementRef: (g) => {
|
|
1593
|
+
ue.current = g;
|
|
1580
1594
|
},
|
|
1581
|
-
onClick: (
|
|
1582
|
-
|
|
1595
|
+
onClick: (g) => {
|
|
1596
|
+
g.stopPropagation(), I.current = !1, w(!0);
|
|
1583
1597
|
},
|
|
1584
1598
|
children: /* @__PURE__ */ i(Te, {})
|
|
1585
1599
|
}
|
|
1586
1600
|
)
|
|
1587
1601
|
] }),
|
|
1588
|
-
|
|
1589
|
-
|
|
1602
|
+
h && /* @__PURE__ */ S(
|
|
1603
|
+
Z,
|
|
1590
1604
|
{
|
|
1591
1605
|
as: "div",
|
|
1592
1606
|
size: "small",
|
|
1593
1607
|
color: "secondary",
|
|
1594
1608
|
"data-testid": `note-card-${t}-course`,
|
|
1595
1609
|
children: [
|
|
1596
|
-
|
|
1597
|
-
/* @__PURE__ */ i("span", { "aria-hidden":
|
|
1610
|
+
ae && /* @__PURE__ */ i(ye, { children: h }),
|
|
1611
|
+
/* @__PURE__ */ i("span", { "aria-hidden": ae, style: { display: "block" }, children: /* @__PURE__ */ i(Se, { maxLines: 1, onUpdate: de, children: h }) })
|
|
1598
1612
|
]
|
|
1599
1613
|
}
|
|
1600
1614
|
)
|
|
@@ -1602,19 +1616,19 @@ const Zn = ({
|
|
|
1602
1616
|
] })
|
|
1603
1617
|
}
|
|
1604
1618
|
),
|
|
1605
|
-
|
|
1606
|
-
|
|
1619
|
+
f && E && a && /* @__PURE__ */ i(
|
|
1620
|
+
It,
|
|
1607
1621
|
{
|
|
1608
1622
|
open: !0,
|
|
1609
1623
|
as: "div",
|
|
1610
|
-
label:
|
|
1624
|
+
label: k.deleteNoteConfirmation,
|
|
1611
1625
|
shouldContainFocus: !0,
|
|
1612
1626
|
shouldFocusOnOpen: !0,
|
|
1613
|
-
defaultFocusElement: () =>
|
|
1627
|
+
defaultFocusElement: () => M.current,
|
|
1614
1628
|
shouldCloseOnDocumentClick: !0,
|
|
1615
1629
|
shouldCloseOnEscape: !1,
|
|
1616
1630
|
shouldReturnFocus: !1,
|
|
1617
|
-
onDismiss:
|
|
1631
|
+
onDismiss: _,
|
|
1618
1632
|
children: /* @__PURE__ */ i(
|
|
1619
1633
|
V,
|
|
1620
1634
|
{
|
|
@@ -1628,8 +1642,8 @@ const Zn = ({
|
|
|
1628
1642
|
insetInlineStart: "0",
|
|
1629
1643
|
insetInlineEnd: "0",
|
|
1630
1644
|
stacking: "above",
|
|
1631
|
-
children: /* @__PURE__ */
|
|
1632
|
-
|
|
1645
|
+
children: /* @__PURE__ */ S(
|
|
1646
|
+
C,
|
|
1633
1647
|
{
|
|
1634
1648
|
direction: "column",
|
|
1635
1649
|
justifyItems: "center",
|
|
@@ -1645,10 +1659,10 @@ const Zn = ({
|
|
|
1645
1659
|
withBackground: !1,
|
|
1646
1660
|
renderIcon: /* @__PURE__ */ i(Te, {}),
|
|
1647
1661
|
"data-testid": `note-card-${t}-confirm-delete`,
|
|
1648
|
-
onClick: (
|
|
1649
|
-
|
|
1662
|
+
onClick: (g) => {
|
|
1663
|
+
g.stopPropagation(), a(t), w(!1);
|
|
1650
1664
|
},
|
|
1651
|
-
children:
|
|
1665
|
+
children: k.deleteNote
|
|
1652
1666
|
}
|
|
1653
1667
|
),
|
|
1654
1668
|
/* @__PURE__ */ i(
|
|
@@ -1657,13 +1671,13 @@ const Zn = ({
|
|
|
1657
1671
|
display: "block",
|
|
1658
1672
|
withBackground: !1,
|
|
1659
1673
|
"data-testid": `note-card-${t}-cancel-delete`,
|
|
1660
|
-
elementRef: (
|
|
1661
|
-
|
|
1674
|
+
elementRef: (g) => {
|
|
1675
|
+
M.current = g;
|
|
1662
1676
|
},
|
|
1663
|
-
onClick: (
|
|
1664
|
-
|
|
1677
|
+
onClick: (g) => {
|
|
1678
|
+
g.stopPropagation(), _();
|
|
1665
1679
|
},
|
|
1666
|
-
children:
|
|
1680
|
+
children: k.cancel
|
|
1667
1681
|
}
|
|
1668
1682
|
)
|
|
1669
1683
|
]
|
|
@@ -1676,8 +1690,8 @@ const Zn = ({
|
|
|
1676
1690
|
]
|
|
1677
1691
|
}
|
|
1678
1692
|
);
|
|
1679
|
-
return
|
|
1680
|
-
},
|
|
1693
|
+
return y && x ? x({ href: y, children: U, ariaLabel: R }) : U;
|
|
1694
|
+
}, no = {
|
|
1681
1695
|
display: "grid",
|
|
1682
1696
|
gap: "1rem",
|
|
1683
1697
|
boxSizing: "border-box",
|
|
@@ -1685,7 +1699,7 @@ const Zn = ({
|
|
|
1685
1699
|
margin: 0,
|
|
1686
1700
|
padding: 0,
|
|
1687
1701
|
listStyle: "none"
|
|
1688
|
-
},
|
|
1702
|
+
}, Lo = ({
|
|
1689
1703
|
notes: t,
|
|
1690
1704
|
isLoading: e,
|
|
1691
1705
|
isError: n,
|
|
@@ -1695,92 +1709,93 @@ const Zn = ({
|
|
|
1695
1709
|
onNoteSelect: l,
|
|
1696
1710
|
onNoteDelete: a,
|
|
1697
1711
|
onNoteSave: m,
|
|
1698
|
-
onNoteTypeChange:
|
|
1699
|
-
onNotesEmptied:
|
|
1700
|
-
selectedNoteId:
|
|
1712
|
+
onNoteTypeChange: u,
|
|
1713
|
+
onNotesEmptied: f,
|
|
1714
|
+
selectedNoteId: c,
|
|
1701
1715
|
hasActiveFilter: h = !1,
|
|
1702
|
-
columnCount:
|
|
1703
|
-
highlightTheme:
|
|
1704
|
-
locale:
|
|
1705
|
-
courseNames:
|
|
1706
|
-
renderNoteLink:
|
|
1707
|
-
noteHref:
|
|
1716
|
+
columnCount: N = 1,
|
|
1717
|
+
highlightTheme: p,
|
|
1718
|
+
locale: x,
|
|
1719
|
+
courseNames: y,
|
|
1720
|
+
renderNoteLink: k,
|
|
1721
|
+
noteHref: z
|
|
1708
1722
|
}) => {
|
|
1709
|
-
const { translations:
|
|
1710
|
-
(
|
|
1711
|
-
const w = t.findIndex((
|
|
1712
|
-
let
|
|
1713
|
-
t.length > 1 && (
|
|
1723
|
+
const { translations: b } = J(), T = F(null), P = F(null), D = K(
|
|
1724
|
+
(E) => {
|
|
1725
|
+
const w = t.findIndex((j) => j.id === E);
|
|
1726
|
+
let v = null;
|
|
1727
|
+
t.length > 1 && (v = w > 0 ? t[w - 1].id : t[1].id), P.current = { targetId: v }, a == null || a(E);
|
|
1714
1728
|
},
|
|
1715
1729
|
[t, a]
|
|
1716
1730
|
);
|
|
1717
|
-
if (
|
|
1731
|
+
if (q(() => {
|
|
1718
1732
|
var w;
|
|
1719
|
-
const
|
|
1720
|
-
if (
|
|
1721
|
-
if (
|
|
1722
|
-
|
|
1733
|
+
const E = P.current;
|
|
1734
|
+
if (E)
|
|
1735
|
+
if (P.current = null, E.targetId === null)
|
|
1736
|
+
f == null || f();
|
|
1723
1737
|
else {
|
|
1724
|
-
const
|
|
1725
|
-
`[data-testid="note-card-${
|
|
1738
|
+
const v = (w = T.current) == null ? void 0 : w.querySelector(
|
|
1739
|
+
`[data-testid="note-card-${E.targetId}"]`
|
|
1726
1740
|
);
|
|
1727
|
-
|
|
1741
|
+
v == null || v.focus();
|
|
1728
1742
|
}
|
|
1729
|
-
}, [t,
|
|
1730
|
-
return /* @__PURE__ */ i(V, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ i(
|
|
1743
|
+
}, [t, f]), e)
|
|
1744
|
+
return /* @__PURE__ */ i(V, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ i(xt, { renderTitle: b.loadingNotes }) });
|
|
1731
1745
|
if (n)
|
|
1732
|
-
return /* @__PURE__ */ i(V, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(
|
|
1746
|
+
return /* @__PURE__ */ i(V, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(ve, { level: "h4", children: b.failedToLoadNotes }) });
|
|
1733
1747
|
if (t.length === 0)
|
|
1734
|
-
return /* @__PURE__ */ i(V, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(
|
|
1735
|
-
const
|
|
1736
|
-
return /* @__PURE__ */
|
|
1748
|
+
return /* @__PURE__ */ i(V, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(Jn, { hasActiveFilter: h }) });
|
|
1749
|
+
const G = typeof o == "number" && typeof r == "number" && r > 1 && s !== void 0;
|
|
1750
|
+
return /* @__PURE__ */ S(Xe, { children: [
|
|
1737
1751
|
/* @__PURE__ */ i(
|
|
1738
1752
|
"ul",
|
|
1739
1753
|
{
|
|
1740
|
-
ref:
|
|
1741
|
-
style: { ...
|
|
1754
|
+
ref: T,
|
|
1755
|
+
style: { ...no, gridTemplateColumns: `repeat(${N}, minmax(0, 1fr))` },
|
|
1742
1756
|
role: "list",
|
|
1743
1757
|
"data-testid": "notes-grid",
|
|
1744
|
-
children: t.map((
|
|
1758
|
+
children: t.map((E) => {
|
|
1745
1759
|
var w;
|
|
1746
1760
|
return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
|
|
1747
|
-
|
|
1761
|
+
to,
|
|
1748
1762
|
{
|
|
1749
|
-
noteId:
|
|
1750
|
-
date:
|
|
1751
|
-
type:
|
|
1752
|
-
highlight: (w =
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1763
|
+
noteId: E.id,
|
|
1764
|
+
date: E.createdAt,
|
|
1765
|
+
type: E.reaction[0] ?? L.IMPORTANT,
|
|
1766
|
+
highlight: (w = E.highlightData) == null ? void 0 : w.selectedText,
|
|
1767
|
+
highlightUnavailableReason: E.highlightSourceUnavailable ? "sourceUnavailable" : void 0,
|
|
1768
|
+
note: E.userText,
|
|
1769
|
+
isActive: c === E.id,
|
|
1770
|
+
isPanelView: !!c,
|
|
1771
|
+
onClick: l ? () => l(E.id) : void 0,
|
|
1757
1772
|
onDelete: a ? D : void 0,
|
|
1758
|
-
onSaveNote: m ? (
|
|
1759
|
-
onTypeChange:
|
|
1760
|
-
highlightTheme:
|
|
1761
|
-
locale:
|
|
1762
|
-
courseName:
|
|
1763
|
-
renderLink:
|
|
1764
|
-
href:
|
|
1773
|
+
onSaveNote: m ? (v, j) => m(v, j) : void 0,
|
|
1774
|
+
onTypeChange: u ? (v, j) => u(v, j) : void 0,
|
|
1775
|
+
highlightTheme: p,
|
|
1776
|
+
locale: x,
|
|
1777
|
+
courseName: y == null ? void 0 : y.get(E.courseId),
|
|
1778
|
+
renderLink: k,
|
|
1779
|
+
href: z ? z(E.id, E) : void 0
|
|
1765
1780
|
}
|
|
1766
|
-
) },
|
|
1781
|
+
) }, E.id);
|
|
1767
1782
|
})
|
|
1768
1783
|
}
|
|
1769
1784
|
),
|
|
1770
|
-
|
|
1771
|
-
|
|
1785
|
+
G && /* @__PURE__ */ i(C, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ i(C.Item, { children: /* @__PURE__ */ i(
|
|
1786
|
+
Ct,
|
|
1772
1787
|
{
|
|
1773
1788
|
as: "nav",
|
|
1774
1789
|
variant: "input",
|
|
1775
|
-
labelNext:
|
|
1776
|
-
labelPrev:
|
|
1790
|
+
labelNext: b.nextPage,
|
|
1791
|
+
labelPrev: b.previousPage,
|
|
1777
1792
|
currentPage: o,
|
|
1778
1793
|
totalPageNumber: r,
|
|
1779
1794
|
onPageChange: s
|
|
1780
1795
|
}
|
|
1781
1796
|
) }) })
|
|
1782
1797
|
] });
|
|
1783
|
-
},
|
|
1798
|
+
}, Ao = ({
|
|
1784
1799
|
noteText: t,
|
|
1785
1800
|
reaction: e,
|
|
1786
1801
|
highlightText: n,
|
|
@@ -1791,34 +1806,34 @@ const Zn = ({
|
|
|
1791
1806
|
onBack: a,
|
|
1792
1807
|
editing: m = !1
|
|
1793
1808
|
}) => {
|
|
1794
|
-
const { translations:
|
|
1795
|
-
return /* @__PURE__ */
|
|
1796
|
-
n != null ? /* @__PURE__ */ i(V, { as: "div", children: /* @__PURE__ */ i(
|
|
1797
|
-
/* @__PURE__ */ i(
|
|
1798
|
-
|
|
1809
|
+
const { translations: u } = J(), [f, c] = W(m), [h, N] = W(t || ""), [p, x] = W(!1);
|
|
1810
|
+
return /* @__PURE__ */ S(C, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1811
|
+
n != null ? /* @__PURE__ */ i(V, { as: "div", children: /* @__PURE__ */ i(Z, { children: /* @__PURE__ */ i(ke, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ i(gt, {}),
|
|
1812
|
+
/* @__PURE__ */ i(ht, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1813
|
+
f ? /* @__PURE__ */ S(C, { direction: "column", gap: "x-small", children: [
|
|
1799
1814
|
/* @__PURE__ */ i(
|
|
1800
1815
|
Ze,
|
|
1801
1816
|
{
|
|
1802
|
-
label:
|
|
1817
|
+
label: u.addNoteOptional,
|
|
1803
1818
|
value: h,
|
|
1804
|
-
onChange: (
|
|
1819
|
+
onChange: (y) => N(y.target.value),
|
|
1805
1820
|
resize: "vertical"
|
|
1806
1821
|
}
|
|
1807
1822
|
),
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */ i(
|
|
1823
|
+
/* @__PURE__ */ S(C, { gap: "xx-small", children: [
|
|
1824
|
+
/* @__PURE__ */ i(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1810
1825
|
ne,
|
|
1811
1826
|
{
|
|
1812
1827
|
display: "block",
|
|
1813
1828
|
size: "small",
|
|
1814
1829
|
"data-testid": "single-note-cancel",
|
|
1815
1830
|
onClick: () => {
|
|
1816
|
-
|
|
1831
|
+
N(t || ""), c(!1);
|
|
1817
1832
|
},
|
|
1818
|
-
children:
|
|
1833
|
+
children: u.cancel
|
|
1819
1834
|
}
|
|
1820
1835
|
) }),
|
|
1821
|
-
/* @__PURE__ */ i(
|
|
1836
|
+
/* @__PURE__ */ i(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1822
1837
|
ne,
|
|
1823
1838
|
{
|
|
1824
1839
|
display: "block",
|
|
@@ -1826,57 +1841,57 @@ const Zn = ({
|
|
|
1826
1841
|
size: "small",
|
|
1827
1842
|
"data-testid": "single-note-save",
|
|
1828
1843
|
onClick: () => {
|
|
1829
|
-
r(h),
|
|
1844
|
+
r(h), c(!1);
|
|
1830
1845
|
},
|
|
1831
|
-
children:
|
|
1846
|
+
children: u.save
|
|
1832
1847
|
}
|
|
1833
1848
|
) })
|
|
1834
1849
|
] })
|
|
1835
|
-
] }) : /* @__PURE__ */
|
|
1836
|
-
t && /* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */ i(
|
|
1838
|
-
/* @__PURE__ */ i(
|
|
1850
|
+
] }) : /* @__PURE__ */ S(C, { direction: "column", gap: "small", children: [
|
|
1851
|
+
t && /* @__PURE__ */ S(V, { as: "div", children: [
|
|
1852
|
+
/* @__PURE__ */ i(ve, { level: "h4", margin: "0 0 xx-small 0", children: u.note }),
|
|
1853
|
+
/* @__PURE__ */ i(Z, { children: t })
|
|
1839
1854
|
] }),
|
|
1840
|
-
/* @__PURE__ */
|
|
1855
|
+
/* @__PURE__ */ S(C, { justifyItems: "space-between", children: [
|
|
1841
1856
|
/* @__PURE__ */ i(
|
|
1842
1857
|
ne,
|
|
1843
1858
|
{
|
|
1844
1859
|
size: "small",
|
|
1845
|
-
renderIcon: /* @__PURE__ */ i(
|
|
1860
|
+
renderIcon: /* @__PURE__ */ i(vt, {}),
|
|
1846
1861
|
"data-testid": "single-note-back",
|
|
1847
1862
|
onClick: () => a == null ? void 0 : a(),
|
|
1848
|
-
children:
|
|
1863
|
+
children: u.back
|
|
1849
1864
|
}
|
|
1850
1865
|
),
|
|
1851
|
-
/* @__PURE__ */
|
|
1866
|
+
/* @__PURE__ */ S(C, { gap: "xx-small", children: [
|
|
1852
1867
|
s && /* @__PURE__ */ i(
|
|
1853
|
-
|
|
1868
|
+
ge,
|
|
1854
1869
|
{
|
|
1855
1870
|
size: "small",
|
|
1856
1871
|
withBackground: !1,
|
|
1857
1872
|
withBorder: !1,
|
|
1858
1873
|
color: "danger",
|
|
1859
|
-
screenReaderLabel:
|
|
1874
|
+
screenReaderLabel: u.deleteNote,
|
|
1860
1875
|
"data-testid": "single-note-delete",
|
|
1861
|
-
onClick: () =>
|
|
1876
|
+
onClick: () => x(!0),
|
|
1862
1877
|
children: /* @__PURE__ */ i(Te, {})
|
|
1863
1878
|
}
|
|
1864
1879
|
),
|
|
1865
1880
|
/* @__PURE__ */ i(
|
|
1866
|
-
|
|
1881
|
+
ge,
|
|
1867
1882
|
{
|
|
1868
1883
|
size: "small",
|
|
1869
1884
|
withBackground: !1,
|
|
1870
1885
|
withBorder: !1,
|
|
1871
|
-
screenReaderLabel:
|
|
1886
|
+
screenReaderLabel: u.editNote,
|
|
1872
1887
|
"data-testid": "single-note-edit",
|
|
1873
|
-
onClick: () =>
|
|
1874
|
-
children: /* @__PURE__ */ i(
|
|
1888
|
+
onClick: () => c(!0),
|
|
1889
|
+
children: /* @__PURE__ */ i(we, {})
|
|
1875
1890
|
}
|
|
1876
1891
|
)
|
|
1877
1892
|
] })
|
|
1878
1893
|
] }),
|
|
1879
|
-
|
|
1894
|
+
p && s && /* @__PURE__ */ i(V, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ S(C, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1880
1895
|
/* @__PURE__ */ i(
|
|
1881
1896
|
ne,
|
|
1882
1897
|
{
|
|
@@ -1886,9 +1901,9 @@ const Zn = ({
|
|
|
1886
1901
|
renderIcon: /* @__PURE__ */ i(Te, {}),
|
|
1887
1902
|
"data-testid": "single-note-confirm-delete",
|
|
1888
1903
|
onClick: () => {
|
|
1889
|
-
s(),
|
|
1904
|
+
s(), x(!1);
|
|
1890
1905
|
},
|
|
1891
|
-
children:
|
|
1906
|
+
children: u.deleteNote
|
|
1892
1907
|
}
|
|
1893
1908
|
),
|
|
1894
1909
|
/* @__PURE__ */ i(
|
|
@@ -1897,8 +1912,8 @@ const Zn = ({
|
|
|
1897
1912
|
display: "block",
|
|
1898
1913
|
size: "small",
|
|
1899
1914
|
"data-testid": "single-note-cancel-delete",
|
|
1900
|
-
onClick: () =>
|
|
1901
|
-
children:
|
|
1915
|
+
onClick: () => x(!1),
|
|
1916
|
+
children: u.cancel
|
|
1902
1917
|
}
|
|
1903
1918
|
)
|
|
1904
1919
|
] }) })
|
|
@@ -1906,26 +1921,27 @@ const Zn = ({
|
|
|
1906
1921
|
] });
|
|
1907
1922
|
};
|
|
1908
1923
|
export {
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
tn as
|
|
1924
|
+
wo as ContentWithNoteWrapper,
|
|
1925
|
+
ke as Highlight,
|
|
1926
|
+
gt as HighlightError,
|
|
1927
|
+
to as NoteCard,
|
|
1928
|
+
ht as NoteChip,
|
|
1929
|
+
Vn as NoteReactionMenu,
|
|
1930
|
+
Jn as NotebookEmptyState,
|
|
1931
|
+
xo as NotebookProvider,
|
|
1932
|
+
qn as NotebookTranslationsProvider,
|
|
1933
|
+
Ro as NotebookTray,
|
|
1934
|
+
Lo as NotesListView,
|
|
1935
|
+
L as REACTION_TYPE,
|
|
1936
|
+
Ao as SingleNote,
|
|
1937
|
+
Me as createTransparentColor,
|
|
1938
|
+
mt as getHighlightUnavailableMessage,
|
|
1939
|
+
tn as useCreateNote,
|
|
1940
|
+
nn as useDeleteNote,
|
|
1925
1941
|
it as useGetNotes,
|
|
1926
1942
|
ut as useNotebook,
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1943
|
+
J as useNotebookTranslations,
|
|
1944
|
+
ko as useNotesData,
|
|
1945
|
+
Oo as useReactionFilter,
|
|
1946
|
+
rn as useUpdateNote
|
|
1931
1947
|
};
|