@instructure/platform-notebook 1.9.2 → 1.9.4
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/NoteCard.d.ts.map +1 -1
- package/dist/TranslationsContext.d.ts.map +1 -1
- package/dist/index.js +554 -550
- package/package.json +17 -2
package/dist/index.js
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { createContext as Ke, useMemo as
|
|
1
|
+
import { jsx as s, jsxs as S, Fragment as qe } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Ke, useMemo as he, useContext as Xe, useReducer as Qe, useRef as $, useEffect as z, useState as j, useCallback as q } from "react";
|
|
3
3
|
import { createPortal as mt } from "react-dom";
|
|
4
|
-
import { z as
|
|
4
|
+
import { z as u } from "zod";
|
|
5
5
|
import gt from "diff-match-patch";
|
|
6
|
-
import { useQueryClient as
|
|
7
|
-
import { CloseButton as pt, Button as
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { Heading as
|
|
6
|
+
import { useQueryClient as we, useMutation as Oe, useQuery as ht } from "@tanstack/react-query";
|
|
7
|
+
import { CloseButton as pt, Button as re, IconButton as me } from "@instructure/ui-buttons";
|
|
8
|
+
import { Flex as k } from "@instructure/ui-flex";
|
|
9
|
+
import { Heading as Se } from "@instructure/ui-heading";
|
|
10
10
|
import { Tray as yt } from "@instructure/ui-tray";
|
|
11
|
-
import { View as
|
|
12
|
-
import { IconQuestionLine as
|
|
13
|
-
import { Menu as
|
|
14
|
-
import { TruncateText as
|
|
11
|
+
import { View as X } from "@instructure/ui-view";
|
|
12
|
+
import { IconQuestionLine as Le, IconPinLine as Ae, IconWarningLine as Nt, IconNoteLine as bt, IconEditLine as ke, IconTrashLine as Te, IconArrowStartLine as Et } from "@instructure/ui-icons";
|
|
13
|
+
import { Menu as ue } from "@instructure/ui-menu";
|
|
14
|
+
import { TruncateText as Ee } from "@instructure/ui-truncate-text";
|
|
15
15
|
import { SimpleSelect as Be } from "@instructure/ui-simple-select";
|
|
16
|
-
import { Text as
|
|
17
|
-
import { ScreenReaderContent as
|
|
16
|
+
import { Text as oe } from "@instructure/ui-text";
|
|
17
|
+
import { ScreenReaderContent as pe } from "@instructure/ui-a11y-content";
|
|
18
18
|
import { Dialog as Tt } from "@instructure/ui-dialog";
|
|
19
19
|
import { TextArea as Ye } from "@instructure/ui-text-area";
|
|
20
20
|
import { Pill as $e } from "@instructure/ui-pill";
|
|
21
21
|
import { Pagination as St } from "@instructure/ui-pagination";
|
|
22
22
|
import { Spinner as vt } from "@instructure/ui-spinner";
|
|
23
|
-
const It =
|
|
24
|
-
startContainer:
|
|
25
|
-
endContainer:
|
|
26
|
-
startOffset:
|
|
27
|
-
endOffset:
|
|
28
|
-
}), Ct =
|
|
29
|
-
start:
|
|
30
|
-
end:
|
|
31
|
-
}),
|
|
32
|
-
selectedText:
|
|
33
|
-
hasNoHighlightAnymore:
|
|
23
|
+
const It = u.object({
|
|
24
|
+
startContainer: u.string(),
|
|
25
|
+
endContainer: u.string(),
|
|
26
|
+
startOffset: u.number(),
|
|
27
|
+
endOffset: u.number()
|
|
28
|
+
}), Ct = u.object({
|
|
29
|
+
start: u.number(),
|
|
30
|
+
end: u.number()
|
|
31
|
+
}), De = u.object({
|
|
32
|
+
selectedText: u.string(),
|
|
33
|
+
hasNoHighlightAnymore: u.boolean().optional(),
|
|
34
34
|
textPosition: Ct.nullable(),
|
|
35
35
|
range: It.nullable(),
|
|
36
|
-
pageLastModifiedAt:
|
|
36
|
+
pageLastModifiedAt: u.string()
|
|
37
37
|
});
|
|
38
|
-
var
|
|
39
|
-
const
|
|
38
|
+
var R = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(R || {});
|
|
39
|
+
const Pe = u.enum([
|
|
40
40
|
"Important",
|
|
41
41
|
"Confusing"
|
|
42
42
|
/* CONFUSING */
|
|
43
|
-
]), xt =
|
|
44
|
-
totalCount:
|
|
45
|
-
totalNrOfPages:
|
|
46
|
-
}),
|
|
47
|
-
id:
|
|
48
|
-
rootAccountUuid:
|
|
49
|
-
userId:
|
|
50
|
-
courseId:
|
|
51
|
-
objectId:
|
|
52
|
-
objectType:
|
|
53
|
-
userText:
|
|
54
|
-
reaction:
|
|
55
|
-
highlightData:
|
|
56
|
-
createdAt:
|
|
57
|
-
updatedAt:
|
|
58
|
-
}),
|
|
59
|
-
cursor:
|
|
60
|
-
node:
|
|
43
|
+
]), xt = u.object({
|
|
44
|
+
totalCount: u.number().nullish(),
|
|
45
|
+
totalNrOfPages: u.number().nullish()
|
|
46
|
+
}), ve = u.object({
|
|
47
|
+
id: u.string(),
|
|
48
|
+
rootAccountUuid: u.string(),
|
|
49
|
+
userId: u.string(),
|
|
50
|
+
courseId: u.string(),
|
|
51
|
+
objectId: u.string(),
|
|
52
|
+
objectType: u.string(),
|
|
53
|
+
userText: u.string().optional(),
|
|
54
|
+
reaction: u.array(Pe),
|
|
55
|
+
highlightData: De,
|
|
56
|
+
createdAt: u.string(),
|
|
57
|
+
updatedAt: u.string()
|
|
58
|
+
}), kt = u.object({
|
|
59
|
+
cursor: u.string(),
|
|
60
|
+
node: ve
|
|
61
61
|
});
|
|
62
|
-
|
|
63
|
-
notes:
|
|
64
|
-
edges:
|
|
65
|
-
nodes:
|
|
62
|
+
u.object({
|
|
63
|
+
notes: u.object({
|
|
64
|
+
edges: u.array(kt),
|
|
65
|
+
nodes: u.array(ve),
|
|
66
66
|
pageInfo: xt
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
|
-
const
|
|
70
|
-
type:
|
|
71
|
-
id:
|
|
72
|
-
}), wt =
|
|
73
|
-
courseId:
|
|
74
|
-
learningObject:
|
|
75
|
-
reactions:
|
|
69
|
+
const Rt = u.object({
|
|
70
|
+
type: u.string(),
|
|
71
|
+
id: u.string()
|
|
72
|
+
}), wt = u.object({
|
|
73
|
+
courseId: u.string().optional(),
|
|
74
|
+
learningObject: Rt.optional(),
|
|
75
|
+
reactions: u.array(u.string()).optional()
|
|
76
76
|
}).optional();
|
|
77
|
-
|
|
78
|
-
courseId:
|
|
77
|
+
u.object({
|
|
78
|
+
courseId: u.string().optional(),
|
|
79
79
|
filter: wt,
|
|
80
|
-
offset:
|
|
81
|
-
pageSize:
|
|
80
|
+
offset: u.number().optional(),
|
|
81
|
+
pageSize: u.number().optional()
|
|
82
82
|
});
|
|
83
|
-
|
|
84
|
-
courseId:
|
|
85
|
-
objectId:
|
|
86
|
-
objectType:
|
|
87
|
-
userText:
|
|
88
|
-
reaction:
|
|
89
|
-
highlightData:
|
|
83
|
+
u.object({
|
|
84
|
+
courseId: u.string(),
|
|
85
|
+
objectId: u.string(),
|
|
86
|
+
objectType: u.string(),
|
|
87
|
+
userText: u.string().optional(),
|
|
88
|
+
reaction: u.array(Pe),
|
|
89
|
+
highlightData: De
|
|
90
90
|
});
|
|
91
|
-
|
|
92
|
-
createNote:
|
|
91
|
+
u.object({
|
|
92
|
+
createNote: ve
|
|
93
93
|
});
|
|
94
|
-
|
|
95
|
-
id:
|
|
96
|
-
userText:
|
|
97
|
-
reaction:
|
|
98
|
-
highlightData:
|
|
94
|
+
u.object({
|
|
95
|
+
id: u.string(),
|
|
96
|
+
userText: u.string().optional(),
|
|
97
|
+
reaction: u.array(Pe),
|
|
98
|
+
highlightData: De
|
|
99
99
|
});
|
|
100
|
-
|
|
101
|
-
updateNote:
|
|
100
|
+
u.object({
|
|
101
|
+
updateNote: ve
|
|
102
102
|
});
|
|
103
|
-
|
|
104
|
-
deleteNote:
|
|
103
|
+
u.object({
|
|
104
|
+
deleteNote: u.string()
|
|
105
105
|
});
|
|
106
106
|
var Ve = /* @__PURE__ */ ((t) => (t[t.FORWARDS = 1] = "FORWARDS", t[t.BACKWARDS = 2] = "BACKWARDS", t))(Ve || {});
|
|
107
|
-
class
|
|
107
|
+
class se {
|
|
108
108
|
constructor(e, n) {
|
|
109
109
|
this.start = e, this.end = n;
|
|
110
110
|
}
|
|
@@ -122,17 +122,17 @@ class oe {
|
|
|
122
122
|
return o.setStart(e.node, e.offset), o.setEnd(n.node, n.offset), o;
|
|
123
123
|
}
|
|
124
124
|
static fromRange(e) {
|
|
125
|
-
const n =
|
|
126
|
-
return !n || !o ? null : new
|
|
125
|
+
const n = K.fromPoint(e.startContainer, e.startOffset), o = K.fromPoint(e.endContainer, e.endOffset);
|
|
126
|
+
return !n || !o ? null : new se(n, o);
|
|
127
127
|
}
|
|
128
128
|
static fromOffsets(e, n, o) {
|
|
129
|
-
return new
|
|
129
|
+
return new se(new K(e, n), new K(e, o));
|
|
130
130
|
}
|
|
131
131
|
relativeTo(e) {
|
|
132
|
-
return new
|
|
132
|
+
return new se(this.start.relativeTo(e), this.end.relativeTo(e));
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
class
|
|
135
|
+
class K {
|
|
136
136
|
constructor(e, n) {
|
|
137
137
|
n < 0 && console.error("Offset is invalid"), this.element = e, this.offset = n;
|
|
138
138
|
}
|
|
@@ -154,9 +154,9 @@ class X {
|
|
|
154
154
|
static fromCharOffset(e, n) {
|
|
155
155
|
switch (e.nodeType) {
|
|
156
156
|
case Node.TEXT_NODE:
|
|
157
|
-
return
|
|
157
|
+
return K.fromPoint(e, n);
|
|
158
158
|
case Node.ELEMENT_NODE:
|
|
159
|
-
return new
|
|
159
|
+
return new K(e, n);
|
|
160
160
|
default:
|
|
161
161
|
return console.error("Node is not an element or text node"), null;
|
|
162
162
|
}
|
|
@@ -168,8 +168,8 @@ class X {
|
|
|
168
168
|
return console.error("Text node offset is out of range"), null;
|
|
169
169
|
if (!e.parentElement)
|
|
170
170
|
return console.error("Text node has no parent"), null;
|
|
171
|
-
const o =
|
|
172
|
-
return new
|
|
171
|
+
const o = Ge(e) + n;
|
|
172
|
+
return new K(e.parentElement, o);
|
|
173
173
|
}
|
|
174
174
|
case Node.ELEMENT_NODE: {
|
|
175
175
|
if (n < 0 || n > e.childNodes.length)
|
|
@@ -177,7 +177,7 @@ class X {
|
|
|
177
177
|
let o = 0;
|
|
178
178
|
for (let r = 0; r < n; r++)
|
|
179
179
|
o += Ze(e.childNodes[r]);
|
|
180
|
-
return new
|
|
180
|
+
return new K(e, o);
|
|
181
181
|
}
|
|
182
182
|
default:
|
|
183
183
|
return console.error("Point is not in an element or text node"), null;
|
|
@@ -188,8 +188,8 @@ class X {
|
|
|
188
188
|
throw new Error("Parent is not an ancestor of current element");
|
|
189
189
|
let n = this.element, o = this.offset;
|
|
190
190
|
for (; n !== e; )
|
|
191
|
-
o +=
|
|
192
|
-
return new
|
|
191
|
+
o += Ge(n), n.parentElement && (n = n.parentElement);
|
|
192
|
+
return new K(n, o);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
const Ot = (t) => {
|
|
@@ -246,41 +246,41 @@ const At = (t) => {
|
|
|
246
246
|
r = c;
|
|
247
247
|
}
|
|
248
248
|
return r;
|
|
249
|
-
},
|
|
249
|
+
}, Ue = (t, e = document.body) => {
|
|
250
250
|
try {
|
|
251
251
|
return Pt(t, e);
|
|
252
252
|
} catch {
|
|
253
253
|
return document.evaluate(`.${t}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
|
-
class
|
|
256
|
+
class ae {
|
|
257
257
|
constructor(e, n) {
|
|
258
258
|
this.root = e, this.range = n;
|
|
259
259
|
}
|
|
260
260
|
static fromRange(e, n) {
|
|
261
|
-
return new
|
|
261
|
+
return new ae(e, n);
|
|
262
262
|
}
|
|
263
263
|
static fromSelector(e, n) {
|
|
264
264
|
if (!(n != null && n.startContainer) || !(n != null && n.endContainer))
|
|
265
265
|
return console.error("No start or end container in selector"), null;
|
|
266
|
-
const o =
|
|
266
|
+
const o = Ue(n.startContainer, e);
|
|
267
267
|
if (!o)
|
|
268
268
|
return console.error("Failed to resolve startContainer XPath"), null;
|
|
269
|
-
const r =
|
|
269
|
+
const r = Ue(n.endContainer, e);
|
|
270
270
|
if (!r)
|
|
271
271
|
return console.error("Failed to resolve endContainer XPath"), null;
|
|
272
|
-
const i =
|
|
272
|
+
const i = K.fromCharOffset(o, n.startOffset), l = K.fromCharOffset(r, n.endOffset);
|
|
273
273
|
if (!i || !l)
|
|
274
274
|
return null;
|
|
275
|
-
const a = new
|
|
276
|
-
return a ? new
|
|
275
|
+
const a = new se(i, l).toRange();
|
|
276
|
+
return a ? new ae(e, a) : null;
|
|
277
277
|
}
|
|
278
278
|
toRange() {
|
|
279
279
|
return this.range;
|
|
280
280
|
}
|
|
281
281
|
toSelector() {
|
|
282
282
|
var i;
|
|
283
|
-
const e = (i =
|
|
283
|
+
const e = (i = se.fromRange(this.range)) == null ? void 0 : i.toRange(), n = e && se.fromRange(e), o = n && He(n.start.element, this.root), r = n && He(n.end.element, this.root);
|
|
284
284
|
return !o || !r ? null : {
|
|
285
285
|
startContainer: o,
|
|
286
286
|
startOffset: n.start.offset,
|
|
@@ -289,17 +289,17 @@ class le {
|
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
class
|
|
292
|
+
class le {
|
|
293
293
|
constructor(e, n, o) {
|
|
294
294
|
this.root = e, this.start = n, this.end = o;
|
|
295
295
|
}
|
|
296
296
|
static fromRange(e, n) {
|
|
297
297
|
var r;
|
|
298
|
-
const o = (r =
|
|
299
|
-
return o ? new
|
|
298
|
+
const o = (r = se.fromRange(n)) == null ? void 0 : r.relativeTo(e);
|
|
299
|
+
return o ? new le(e, o.start.offset, o.end.offset) : null;
|
|
300
300
|
}
|
|
301
301
|
static fromSelector(e, n) {
|
|
302
|
-
return new
|
|
302
|
+
return new le(e, n.start, n.end);
|
|
303
303
|
}
|
|
304
304
|
toSelector() {
|
|
305
305
|
return {
|
|
@@ -308,7 +308,7 @@ class ie {
|
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
310
|
toRange() {
|
|
311
|
-
return
|
|
311
|
+
return se.fromOffsets(this.root, this.start, this.end).toRange();
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
const Ze = (t) => {
|
|
@@ -320,7 +320,7 @@ const Ze = (t) => {
|
|
|
320
320
|
default:
|
|
321
321
|
return 0;
|
|
322
322
|
}
|
|
323
|
-
},
|
|
323
|
+
}, Ge = (t) => {
|
|
324
324
|
let e = t.previousSibling, n = 0;
|
|
325
325
|
for (; e; )
|
|
326
326
|
n += Ze(e), e = e.previousSibling;
|
|
@@ -336,7 +336,7 @@ const Ze = (t) => {
|
|
|
336
336
|
return n !== void 0 && console.error("Offset exceeds text length"), r;
|
|
337
337
|
}, _t = (t, e, n, o) => {
|
|
338
338
|
const r = n - e;
|
|
339
|
-
return Math.abs(r - o) <= 5 ?
|
|
339
|
+
return Math.abs(r - o) <= 5 ? le.fromSelector(t, {
|
|
340
340
|
start: e,
|
|
341
341
|
end: n
|
|
342
342
|
}) : null;
|
|
@@ -356,14 +356,14 @@ const Ze = (t) => {
|
|
|
356
356
|
if ((c > d || b > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(i, l, d), c !== -1 && c < d))
|
|
357
357
|
return _t(t, c, d, m);
|
|
358
358
|
if (c < d && b <= 5)
|
|
359
|
-
return
|
|
359
|
+
return le.fromSelector(t, {
|
|
360
360
|
start: c,
|
|
361
361
|
end: d
|
|
362
362
|
});
|
|
363
363
|
} else {
|
|
364
364
|
const l = r.match_main(i, e, n);
|
|
365
365
|
if (l !== -1)
|
|
366
|
-
return
|
|
366
|
+
return le.fromSelector(t, {
|
|
367
367
|
start: l,
|
|
368
368
|
end: l + e.length
|
|
369
369
|
});
|
|
@@ -383,7 +383,7 @@ const Ze = (t) => {
|
|
|
383
383
|
for (const i of e) {
|
|
384
384
|
const l = Mt(i, t);
|
|
385
385
|
if (l) {
|
|
386
|
-
const a = l.toRange(), m = a &&
|
|
386
|
+
const a = l.toRange(), m = a && ae.fromRange(t, a), c = (a == null ? void 0 : a.toString().trim()) || i.highlightData.selectedText;
|
|
387
387
|
o.push({
|
|
388
388
|
id: i.id,
|
|
389
389
|
reaction: i.reaction,
|
|
@@ -414,28 +414,28 @@ const Ze = (t) => {
|
|
|
414
414
|
var l;
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: n, id: o } = t, { range: r } = n ?? {};
|
|
417
|
-
r && ((l =
|
|
417
|
+
r && ((l = ae.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Yt({ id: o });
|
|
418
418
|
}, $t = (t) => {
|
|
419
419
|
const n = document.querySelector(
|
|
420
420
|
`[data-highlight-id="${CSS.escape(t)}"].highlight-content`
|
|
421
|
-
) ?? document.getElementById(
|
|
421
|
+
) ?? document.getElementById(Ie(t));
|
|
422
422
|
if (n) {
|
|
423
423
|
const o = n.getBoundingClientRect();
|
|
424
424
|
o.top >= 0 && o.bottom <= (window.innerHeight || document.documentElement.clientHeight) || n.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
425
425
|
}
|
|
426
|
-
},
|
|
426
|
+
}, ye = 90, Ne = 172, Ht = (t) => {
|
|
427
427
|
const e = t.getClientRects();
|
|
428
428
|
if (!e.length)
|
|
429
429
|
return null;
|
|
430
430
|
const n = e[0], o = e[e.length - 1], r = 4, i = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight, m = (p) => {
|
|
431
|
-
const E = p +
|
|
431
|
+
const E = p + Ne;
|
|
432
432
|
return p >= i && E <= l - i;
|
|
433
433
|
}, c = (p) => {
|
|
434
|
-
const E = p +
|
|
434
|
+
const E = p + ye;
|
|
435
435
|
return p >= i && E <= a - i;
|
|
436
436
|
};
|
|
437
437
|
let y;
|
|
438
|
-
const d = n.right -
|
|
438
|
+
const d = n.right - Ne;
|
|
439
439
|
if (m(d))
|
|
440
440
|
y = d;
|
|
441
441
|
else {
|
|
@@ -443,8 +443,8 @@ const Ze = (t) => {
|
|
|
443
443
|
if (m(p))
|
|
444
444
|
y = p;
|
|
445
445
|
else {
|
|
446
|
-
const g = (n.left + n.right) / 2 -
|
|
447
|
-
m(g) ? y = g : d < i ? y = i : y = l -
|
|
446
|
+
const g = (n.left + n.right) / 2 - Ne / 2;
|
|
447
|
+
m(g) ? y = g : d < i ? y = i : y = l - Ne - i;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
let h;
|
|
@@ -452,16 +452,16 @@ const Ze = (t) => {
|
|
|
452
452
|
if (c(b))
|
|
453
453
|
h = b;
|
|
454
454
|
else {
|
|
455
|
-
const p = n.top -
|
|
456
|
-
c(p) ? h = p : b +
|
|
455
|
+
const p = n.top - ye - r;
|
|
456
|
+
c(p) ? h = p : b + ye > a - i ? h = a - ye - i : h = i;
|
|
457
457
|
}
|
|
458
458
|
return { top: h, left: y };
|
|
459
|
-
},
|
|
459
|
+
}, Ut = (t, e) => {
|
|
460
460
|
for (const n of e)
|
|
461
461
|
if (t.start < n.end && t.end > n.start)
|
|
462
462
|
return !0;
|
|
463
463
|
return !1;
|
|
464
|
-
},
|
|
464
|
+
}, _e = (t) => `highlight-wrapper-${t}`, Ie = (t) => `${_e(t)}-start`, et = (t) => `${_e(t)}-end`, ge = (t) => `[data-highlight-id="${CSS.escape(t)}"]`, Gt = "2px", jt = "3px", Wt = "1px", tt = "3px", zt = "1px", nt = "Notebook note", Fe = (t, e) => {
|
|
465
465
|
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);
|
|
466
466
|
return `rgba(${n}, ${o}, ${r}, ${e})`;
|
|
467
467
|
}, ot = (t, e, n, o, r) => {
|
|
@@ -498,12 +498,12 @@ const Ze = (t) => {
|
|
|
498
498
|
return n;
|
|
499
499
|
}, Xt = (t, e, n) => {
|
|
500
500
|
if (t.collapsed) return;
|
|
501
|
-
const o = e.id ?? "", r =
|
|
502
|
-
if (document.getElementById(
|
|
501
|
+
const o = e.id ?? "", r = _e(o);
|
|
502
|
+
if (document.getElementById(Ie(o))) {
|
|
503
503
|
Qt(e, n);
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
|
-
const l = e.type ===
|
|
506
|
+
const l = e.type === R.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, m = a ? l : Fe(l, 0.5), c = e.type === R.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, y = e.type === R.IMPORTANT ? "solid" : "dashed", d = document.createElement("span");
|
|
507
507
|
d.id = `${r}-start`, d.className = "highlight-marker-start", d.dataset.highlightId = o || "";
|
|
508
508
|
const h = e.labelPrefix ?? nt;
|
|
509
509
|
d.setAttribute("role", "button"), d.setAttribute("tabindex", "0"), d.setAttribute("aria-label", h), d.setAttribute("aria-haspopup", "dialog"), d.setAttribute("aria-expanded", String(a && !!e.isTrayOpen)), a && d.setAttribute("aria-current", "true"), e.popupId && d.setAttribute("aria-controls", e.popupId), d.style.position = "relative", d.style.fontSize = "0", d.style.lineHeight = "0", d.style.width = "0", d.style.height = "0", d.style.margin = "0", d.style.padding = "0", d.style.border = "0", d.style.outline = "none";
|
|
@@ -515,91 +515,91 @@ const Ze = (t) => {
|
|
|
515
515
|
E.collapse(!0), E.insertNode(d);
|
|
516
516
|
const g = document.createRange();
|
|
517
517
|
g.setStartAfter(d), g.setEndBefore(b);
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
var
|
|
521
|
-
const
|
|
522
|
-
if ((
|
|
523
|
-
const
|
|
524
|
-
let
|
|
525
|
-
T ?
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
var
|
|
529
|
-
|
|
530
|
-
}), (
|
|
518
|
+
const W = Kt(g).filter((N) => N.textContent && N.textContent.length > 0);
|
|
519
|
+
W.forEach((N, C) => {
|
|
520
|
+
var M;
|
|
521
|
+
const D = N.parentElement;
|
|
522
|
+
if ((D == null ? void 0 : D.dataset.highlightId) === o) return;
|
|
523
|
+
const H = C === 0, P = C === W.length - 1, T = W.length === 1;
|
|
524
|
+
let O;
|
|
525
|
+
T ? O = "single" : H ? O = "first" : P ? O = "last" : O = "middle";
|
|
526
|
+
const x = document.createElement("span");
|
|
527
|
+
x.className = "highlight-content", x.dataset.highlightId = o || "", x.dataset.position = O, x.style.textDecorationLine = "underline", x.style.textDecorationThickness = n.borderWidthSmall, x.style.textUnderlineOffset = n.underlineOffset, x.style.cursor = "pointer", ot(x, a, m, c, y), x.addEventListener("click", (V) => {
|
|
528
|
+
var Z;
|
|
529
|
+
V.target.tagName !== "A" && ((Z = e.onClick) == null || Z.call(e));
|
|
530
|
+
}), (M = N.parentNode) == null || M.insertBefore(x, N), x.appendChild(N);
|
|
531
531
|
}), d.addEventListener("click", (N) => {
|
|
532
|
-
var
|
|
533
|
-
N.target.tagName !== "A" && ((
|
|
532
|
+
var C;
|
|
533
|
+
N.target.tagName !== "A" && ((C = e.onClick) == null || C.call(e));
|
|
534
534
|
}), d.addEventListener("keydown", (N) => {
|
|
535
|
-
var
|
|
535
|
+
var C;
|
|
536
536
|
if (N.key === "Enter" || N.key === " ")
|
|
537
|
-
N.preventDefault(), (
|
|
537
|
+
N.preventDefault(), (C = e.onClick) == null || C.call(e);
|
|
538
538
|
else if (N.key === "Tab" && !N.shiftKey) {
|
|
539
|
-
const
|
|
540
|
-
for (const
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
543
|
-
N.preventDefault(),
|
|
539
|
+
const D = document.querySelectorAll(ge(o));
|
|
540
|
+
for (const H of D) {
|
|
541
|
+
const P = H.querySelector("a");
|
|
542
|
+
if (P) {
|
|
543
|
+
N.preventDefault(), P.focus();
|
|
544
544
|
break;
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
}), d.addEventListener("focus", () => {
|
|
549
549
|
document.querySelectorAll(
|
|
550
|
-
`.highlight-content${
|
|
551
|
-
).forEach((
|
|
552
|
-
|
|
550
|
+
`.highlight-content${ge(o)}`
|
|
551
|
+
).forEach((C) => {
|
|
552
|
+
C.style.boxShadow = `0 0 0 ${Gt} ${n.colors.focusOutline}`, C.style.borderRadius = jt;
|
|
553
553
|
});
|
|
554
554
|
}), d.addEventListener("blur", () => {
|
|
555
555
|
document.querySelectorAll(
|
|
556
|
-
`.highlight-content${
|
|
557
|
-
).forEach((
|
|
558
|
-
|
|
556
|
+
`.highlight-content${ge(o)}`
|
|
557
|
+
).forEach((C) => {
|
|
558
|
+
C.style.boxShadow = "", C.style.borderRadius = C.dataset.selected ? tt : "";
|
|
559
559
|
});
|
|
560
560
|
});
|
|
561
561
|
};
|
|
562
562
|
function Qt(t, e) {
|
|
563
|
-
const n = t.type ===
|
|
563
|
+
const n = t.type === R.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, o = t.id === t.selectedNoteId, r = o ? n : Fe(n, 0.5), i = t.type === R.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline, l = t.type === R.IMPORTANT ? "solid" : "dashed";
|
|
564
564
|
document.querySelectorAll(
|
|
565
|
-
`.highlight-content${
|
|
565
|
+
`.highlight-content${ge(t.id ?? "")}`
|
|
566
566
|
).forEach((c) => {
|
|
567
567
|
ot(c, o, r, i, l);
|
|
568
568
|
});
|
|
569
569
|
const m = document.getElementById(
|
|
570
|
-
|
|
570
|
+
Ie(t.id ?? "")
|
|
571
571
|
);
|
|
572
572
|
m && (m.setAttribute("aria-label", t.labelPrefix ?? nt), m.setAttribute("aria-expanded", String(o && !!t.isTrayOpen)), o ? m.setAttribute("aria-current", "true") : m.removeAttribute("aria-current"));
|
|
573
573
|
}
|
|
574
574
|
const Yt = (t) => {
|
|
575
|
-
const e = t.id ?? "", n = document.getElementById(
|
|
575
|
+
const e = t.id ?? "", n = document.getElementById(Ie(e)), o = document.getElementById(et(e));
|
|
576
576
|
document.querySelectorAll(
|
|
577
|
-
|
|
577
|
+
ge(e)
|
|
578
578
|
).forEach((i) => {
|
|
579
579
|
var l;
|
|
580
580
|
for (; i.firstChild; )
|
|
581
581
|
(l = i.parentNode) == null || l.insertBefore(i.firstChild, i);
|
|
582
582
|
i.remove();
|
|
583
583
|
}), n == null || n.remove(), o == null || o.remove();
|
|
584
|
-
},
|
|
584
|
+
}, fe = {
|
|
585
585
|
all: ["notebook"],
|
|
586
586
|
notes: (t) => ["notebook", "notes", t]
|
|
587
587
|
};
|
|
588
588
|
function Vt(t) {
|
|
589
|
-
const e =
|
|
590
|
-
return
|
|
589
|
+
const e = we();
|
|
590
|
+
return Oe({
|
|
591
591
|
mutationFn: (n) => t.createNote(n),
|
|
592
592
|
onSuccess: () => {
|
|
593
|
-
e.invalidateQueries({ queryKey:
|
|
593
|
+
e.invalidateQueries({ queryKey: fe.all });
|
|
594
594
|
}
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
function Zt(t) {
|
|
598
|
-
const e =
|
|
599
|
-
return
|
|
598
|
+
const e = we();
|
|
599
|
+
return Oe({
|
|
600
600
|
mutationFn: (n) => t.deleteNote(n),
|
|
601
601
|
onSuccess: () => {
|
|
602
|
-
e.invalidateQueries({ queryKey:
|
|
602
|
+
e.invalidateQueries({ queryKey: fe.all });
|
|
603
603
|
}
|
|
604
604
|
});
|
|
605
605
|
}
|
|
@@ -609,7 +609,7 @@ function rt({
|
|
|
609
609
|
...n
|
|
610
610
|
}) {
|
|
611
611
|
return ht({
|
|
612
|
-
queryKey:
|
|
612
|
+
queryKey: fe.notes(n),
|
|
613
613
|
queryFn: () => t.getNotes(n),
|
|
614
614
|
enabled: e
|
|
615
615
|
});
|
|
@@ -635,12 +635,12 @@ function st({
|
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
637
|
function en(t) {
|
|
638
|
-
const e =
|
|
639
|
-
return
|
|
638
|
+
const e = we();
|
|
639
|
+
return Oe({
|
|
640
640
|
mutationFn: ({ id: n, input: o }) => t.updateNote(n, o),
|
|
641
641
|
onMutate: async ({ id: n, input: o }) => {
|
|
642
|
-
await e.cancelQueries({ queryKey:
|
|
643
|
-
const i = e.getQueryCache().findAll({ queryKey:
|
|
642
|
+
await e.cancelQueries({ queryKey: fe.all });
|
|
643
|
+
const i = e.getQueryCache().findAll({ queryKey: fe.all }), l = /* @__PURE__ */ new Map();
|
|
644
644
|
for (const a of i) {
|
|
645
645
|
const m = a.state.data;
|
|
646
646
|
m && (l.set(a.queryKey, m), e.setQueryData(a.queryKey, {
|
|
@@ -658,11 +658,11 @@ function en(t) {
|
|
|
658
658
|
e.setQueryData(i, l);
|
|
659
659
|
},
|
|
660
660
|
onSettled: () => {
|
|
661
|
-
e.invalidateQueries({ queryKey:
|
|
661
|
+
e.invalidateQueries({ queryKey: fe.all });
|
|
662
662
|
}
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
|
-
const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Back", ln = "Edit note", an = "Save", cn = "Cancel", dn = "Delete note", un = "Delete note confirmation", fn = "note", mn = "Add note (optional)", gn = "Remove from Notebook", hn = "Add a note (optional)", pn = "Mark important", yn = "Mark unclear", Nn = "Saved to Notebook.", bn = "Note updated", En = "Note deleted", Tn = "Error saving to Notebook.", Sn = "Error updating note", vn = "Note deletion failed", In = "Loading notes", Cn = "Failed to load notes", xn = "Start capturing your notes",
|
|
665
|
+
const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Back", ln = "Edit note", an = "Save", cn = "Cancel", dn = "Delete note", un = "Delete note confirmation", fn = "note", mn = "Add note (optional)", gn = "Remove from Notebook", hn = "Add a note (optional)", pn = "Mark important", yn = "Mark unclear", Nn = "Saved to Notebook.", bn = "Note updated", En = "Note deleted", Tn = "Error saving to Notebook.", Sn = "Error updating note", vn = "Note deletion failed", In = "Loading notes", Cn = "Failed to load notes", xn = "Start capturing your notes", kn = "Your notes from learning materials will appear here. Highlight key ideas, reflections, or questions as you learn—they'll all be saved in your Notebook for easy review later.", Rn = "Nothing here yet", wn = "Adjust your filters or create a new note to get started.", On = "You have no notes for the selected filter", Ln = "Filter", An = "Previous page", Dn = "Next page", Pn = "All courses", _n = "All notes", Fn = "Close Notebook panel", Mn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", Bn = "The content you highlighted is no longer available.", $n = "Notebook note", Me = {
|
|
666
666
|
notebook: tn,
|
|
667
667
|
notes: nn,
|
|
668
668
|
important: on,
|
|
@@ -688,8 +688,8 @@ const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Bac
|
|
|
688
688
|
loadingNotes: In,
|
|
689
689
|
failedToLoadNotes: Cn,
|
|
690
690
|
emptyStateHeading: xn,
|
|
691
|
-
emptyStateDescription:
|
|
692
|
-
nothingHereYet:
|
|
691
|
+
emptyStateDescription: kn,
|
|
692
|
+
nothingHereYet: Rn,
|
|
693
693
|
adjustFiltersOrCreate: wn,
|
|
694
694
|
noNotesForFilter: On,
|
|
695
695
|
filter: Ln,
|
|
@@ -703,7 +703,7 @@ const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Bac
|
|
|
703
703
|
notebookNote: $n
|
|
704
704
|
}, it = Ke(null);
|
|
705
705
|
function lt(t, e) {
|
|
706
|
-
const n =
|
|
706
|
+
const n = Me[t] ?? t;
|
|
707
707
|
return e ? n.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : n;
|
|
708
708
|
}
|
|
709
709
|
function Hn({
|
|
@@ -711,25 +711,26 @@ function Hn({
|
|
|
711
711
|
translate: e,
|
|
712
712
|
children: n
|
|
713
713
|
}) {
|
|
714
|
-
const o =
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
714
|
+
const o = he(() => ({
|
|
715
|
+
translations: new Proxy(Me, {
|
|
716
|
+
get(i, l) {
|
|
717
|
+
return (t == null ? void 0 : t[l]) ?? i[l];
|
|
718
|
+
}
|
|
718
719
|
}),
|
|
719
|
-
|
|
720
|
-
);
|
|
720
|
+
translate: e ?? lt
|
|
721
|
+
}), [t, e]);
|
|
721
722
|
return /* @__PURE__ */ s(it.Provider, { value: o, children: n });
|
|
722
723
|
}
|
|
723
|
-
function
|
|
724
|
+
function ee() {
|
|
724
725
|
const t = Xe(it);
|
|
725
|
-
return t || { translations:
|
|
726
|
+
return t || { translations: Me, translate: lt };
|
|
726
727
|
}
|
|
727
|
-
const
|
|
728
|
+
const Un = (t) => ({
|
|
728
729
|
selectedNoteId: t ?? null,
|
|
729
730
|
isNoteEditing: !1,
|
|
730
731
|
isTrayOpen: t != null
|
|
731
732
|
});
|
|
732
|
-
function
|
|
733
|
+
function Gn(t, e) {
|
|
733
734
|
switch (e.type) {
|
|
734
735
|
case "SELECT_NOTE":
|
|
735
736
|
return {
|
|
@@ -763,7 +764,7 @@ function Eo({
|
|
|
763
764
|
translate: c,
|
|
764
765
|
children: y
|
|
765
766
|
}) {
|
|
766
|
-
const [d, h] = Qe(
|
|
767
|
+
const [d, h] = Qe(Gn, Un(a)), b = $(a != null), p = he(
|
|
767
768
|
() => ({
|
|
768
769
|
api: t,
|
|
769
770
|
currentUserId: e,
|
|
@@ -793,7 +794,7 @@ function ct() {
|
|
|
793
794
|
return t;
|
|
794
795
|
}
|
|
795
796
|
const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
796
|
-
const { isTrayOpen: e, closeTray: n } = ct(), { translations: o } =
|
|
797
|
+
const { isTrayOpen: e, closeTray: n } = ct(), { translations: o } = ee();
|
|
797
798
|
return /* @__PURE__ */ s(
|
|
798
799
|
yt,
|
|
799
800
|
{
|
|
@@ -802,9 +803,9 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
802
803
|
onDismiss: n,
|
|
803
804
|
placement: "end",
|
|
804
805
|
size: "regular",
|
|
805
|
-
children: /* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */ s(
|
|
807
|
-
/* @__PURE__ */ s(
|
|
806
|
+
children: /* @__PURE__ */ S(k, { direction: "column", height: "100vh", id: dt, children: [
|
|
807
|
+
/* @__PURE__ */ s(k.Item, { children: /* @__PURE__ */ s(X, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ S(k, { justifyItems: "space-between", alignItems: "center", children: [
|
|
808
|
+
/* @__PURE__ */ s(Se, { level: "h3", children: o.notebook }),
|
|
808
809
|
/* @__PURE__ */ s(
|
|
809
810
|
pt,
|
|
810
811
|
{
|
|
@@ -815,16 +816,16 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
815
816
|
}
|
|
816
817
|
)
|
|
817
818
|
] }) }) }),
|
|
818
|
-
/* @__PURE__ */ s(
|
|
819
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
|
|
819
820
|
] })
|
|
820
821
|
}
|
|
821
822
|
);
|
|
822
823
|
}, jn = ({ currentType: t, onSelectReaction: e }) => {
|
|
823
|
-
const { translations: n } =
|
|
824
|
-
return
|
|
825
|
-
t ===
|
|
824
|
+
const { translations: n } = ee(), o = $(null), r = $(null);
|
|
825
|
+
return z(() => {
|
|
826
|
+
t === R.CONFUSING && o.current ? o.current.focus() : t === R.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
|
|
826
827
|
}, [t]), /* @__PURE__ */ s(
|
|
827
|
-
|
|
828
|
+
X,
|
|
828
829
|
{
|
|
829
830
|
as: "div",
|
|
830
831
|
background: "primary",
|
|
@@ -832,25 +833,25 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
832
833
|
borderColor: "secondary",
|
|
833
834
|
borderRadius: "medium",
|
|
834
835
|
shadow: "resting",
|
|
835
|
-
children: /* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */
|
|
837
|
-
|
|
836
|
+
children: /* @__PURE__ */ S(ue, { children: [
|
|
837
|
+
/* @__PURE__ */ S(
|
|
838
|
+
ue.Item,
|
|
838
839
|
{
|
|
839
840
|
ref: o,
|
|
840
|
-
onClick: () => e(
|
|
841
|
+
onClick: () => e(R.CONFUSING),
|
|
841
842
|
children: [
|
|
842
|
-
/* @__PURE__ */ s(
|
|
843
|
+
/* @__PURE__ */ s(Le, { size: "x-small" }),
|
|
843
844
|
` ${n.markUnclear}`
|
|
844
845
|
]
|
|
845
846
|
}
|
|
846
847
|
),
|
|
847
|
-
/* @__PURE__ */
|
|
848
|
-
|
|
848
|
+
/* @__PURE__ */ S(
|
|
849
|
+
ue.Item,
|
|
849
850
|
{
|
|
850
851
|
ref: r,
|
|
851
|
-
onClick: () => e(
|
|
852
|
+
onClick: () => e(R.IMPORTANT),
|
|
852
853
|
children: [
|
|
853
|
-
/* @__PURE__ */ s(
|
|
854
|
+
/* @__PURE__ */ s(Ae, { size: "x-small" }),
|
|
854
855
|
` ${n.markImportant}`
|
|
855
856
|
]
|
|
856
857
|
}
|
|
@@ -858,7 +859,7 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
858
859
|
] })
|
|
859
860
|
}
|
|
860
861
|
);
|
|
861
|
-
},
|
|
862
|
+
}, Ce = "notebook-inline-reaction-menu";
|
|
862
863
|
function So({
|
|
863
864
|
containerRef: t,
|
|
864
865
|
highlightTheme: e,
|
|
@@ -878,130 +879,130 @@ function So({
|
|
|
878
879
|
isTrayOpen: b,
|
|
879
880
|
selectNote: p,
|
|
880
881
|
openTray: E
|
|
881
|
-
} = ct(), { translations: g } =
|
|
882
|
+
} = ct(), { translations: g } = ee(), { data: Q } = st({
|
|
882
883
|
api: a,
|
|
883
884
|
courseId: y,
|
|
884
885
|
learningObject: { type: c, id: m }
|
|
885
|
-
}), { mutate:
|
|
886
|
-
|
|
887
|
-
const [
|
|
888
|
-
|
|
886
|
+
}), { mutate: W } = Vt(a), { mutateAsync: N } = en(a), { mutate: C } = Zt(a), D = $([]), [H, P] = j([]), [T, O] = j(null), [x, M] = j(""), [V, Z] = j(null), ce = $(null);
|
|
887
|
+
ce.current = V;
|
|
888
|
+
const [J, de] = j(!1);
|
|
889
|
+
z(() => {
|
|
889
890
|
const w = t.current;
|
|
890
891
|
if (!w) return;
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
|
|
892
|
+
const I = w.closest(".user_content") ?? w;
|
|
893
|
+
if (I.classList.contains("enhanced")) {
|
|
894
|
+
de(!0);
|
|
894
895
|
return;
|
|
895
896
|
}
|
|
896
|
-
const
|
|
897
|
-
for (const
|
|
898
|
-
if (
|
|
899
|
-
|
|
897
|
+
const F = new MutationObserver((A) => {
|
|
898
|
+
for (const G of A)
|
|
899
|
+
if (G.type === "attributes" && G.attributeName === "class" && G.target.classList.contains("enhanced")) {
|
|
900
|
+
de(!0), F.disconnect();
|
|
900
901
|
return;
|
|
901
902
|
}
|
|
902
903
|
});
|
|
903
|
-
return
|
|
904
|
+
return F.observe(I, { attributes: !0, attributeFilter: ["class"] }), () => F.disconnect();
|
|
904
905
|
}, [t]);
|
|
905
|
-
const
|
|
906
|
-
|
|
906
|
+
const Y = q(() => {
|
|
907
|
+
Z(null), O(null), M("");
|
|
907
908
|
}, []);
|
|
908
|
-
|
|
909
|
-
if (!
|
|
910
|
-
let
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
var
|
|
914
|
-
const
|
|
915
|
-
if (!(
|
|
916
|
-
const
|
|
917
|
-
if (
|
|
918
|
-
const
|
|
919
|
-
if (!
|
|
920
|
-
const
|
|
921
|
-
|
|
909
|
+
z(() => {
|
|
910
|
+
if (!J || !t.current) return;
|
|
911
|
+
let I = null;
|
|
912
|
+
const F = () => {
|
|
913
|
+
I && clearTimeout(I), I = setTimeout(() => {
|
|
914
|
+
var ie;
|
|
915
|
+
const v = window.getSelection(), B = t.current;
|
|
916
|
+
if (!(v != null && v.rangeCount) || !B) return;
|
|
917
|
+
const ne = v.toString().trim();
|
|
918
|
+
if (ne === "") return;
|
|
919
|
+
const f = v.getRangeAt(0);
|
|
920
|
+
if (!B.contains(f.commonAncestorContainer)) return;
|
|
921
|
+
const L = (ie = le.fromRange(B, f)) == null ? void 0 : ie.toSelector();
|
|
922
|
+
L && !Ut(L, H) && (O(f.cloneRange()), M(ne), Z(Ht(f)));
|
|
922
923
|
}, n);
|
|
923
|
-
},
|
|
924
|
-
if (!(
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
},
|
|
928
|
-
|
|
929
|
-
},
|
|
930
|
-
|
|
924
|
+
}, A = (v) => {
|
|
925
|
+
if (!(v.target instanceof Node)) return;
|
|
926
|
+
const B = document.getElementById(Ce);
|
|
927
|
+
B != null && B.contains(v.target) ? (v.preventDefault(), v.stopImmediatePropagation()) : Y();
|
|
928
|
+
}, G = () => {
|
|
929
|
+
Y();
|
|
930
|
+
}, _ = (v) => {
|
|
931
|
+
v.key === "Escape" && ce.current !== null && (Y(), v.stopImmediatePropagation());
|
|
931
932
|
};
|
|
932
|
-
return document.addEventListener("selectionchange",
|
|
933
|
-
|
|
933
|
+
return document.addEventListener("selectionchange", F), document.addEventListener("mousedown", A), document.addEventListener("touchstart", A), document.addEventListener("keydown", _), window.addEventListener("scroll", G, !0), () => {
|
|
934
|
+
I && clearTimeout(I), document.removeEventListener("selectionchange", F), document.removeEventListener("mousedown", A), document.removeEventListener("touchstart", A), document.removeEventListener("keydown", _), window.removeEventListener("scroll", G, !0);
|
|
934
935
|
};
|
|
935
|
-
}, [
|
|
936
|
-
const
|
|
936
|
+
}, [J, H, n, t, Y]);
|
|
937
|
+
const te = q(
|
|
937
938
|
(w) => {
|
|
938
|
-
var
|
|
939
|
-
const
|
|
940
|
-
if (!
|
|
941
|
-
const { highlightData:
|
|
942
|
-
if (
|
|
943
|
-
const
|
|
944
|
-
id:
|
|
939
|
+
var B;
|
|
940
|
+
const I = t.current;
|
|
941
|
+
if (!I || !w.highlightData) return null;
|
|
942
|
+
const { highlightData: F, reaction: A, id: G } = w, { range: _ } = F, v = _ && ((B = ae.fromSelector(I, _)) == null ? void 0 : B.toRange());
|
|
943
|
+
if (v) {
|
|
944
|
+
const ne = A[0] === R.IMPORTANT ? g.important : g.unclear, f = {
|
|
945
|
+
id: G,
|
|
945
946
|
selectedNoteId: h,
|
|
946
|
-
type:
|
|
947
|
+
type: A[0],
|
|
947
948
|
isTrayOpen: b,
|
|
948
|
-
labelPrefix: `${g.notebookNote} (${
|
|
949
|
+
labelPrefix: `${g.notebookNote} (${ne})`,
|
|
949
950
|
popupId: dt,
|
|
950
951
|
onClick: () => {
|
|
951
|
-
p(
|
|
952
|
+
p(G), E();
|
|
952
953
|
}
|
|
953
954
|
};
|
|
954
|
-
return Xt(
|
|
955
|
+
return Xt(v, f, e), F.textPosition;
|
|
955
956
|
}
|
|
956
957
|
return null;
|
|
957
958
|
},
|
|
958
959
|
[t, h, b, e, g, p, E]
|
|
959
960
|
);
|
|
960
|
-
|
|
961
|
-
if (!
|
|
962
|
-
const w = t.current,
|
|
963
|
-
if (
|
|
964
|
-
if (
|
|
965
|
-
for (const
|
|
966
|
-
je(
|
|
967
|
-
|
|
961
|
+
z(() => {
|
|
962
|
+
if (!J || !Q || !t.current) return;
|
|
963
|
+
const w = t.current, I = Q.notes, F = /* @__PURE__ */ new Set(), A = [], G = [];
|
|
964
|
+
if (I.length === 0) {
|
|
965
|
+
if (D.current.length > 0) {
|
|
966
|
+
for (const _ of D.current)
|
|
967
|
+
je(_, w);
|
|
968
|
+
D.current = [], P([]);
|
|
968
969
|
}
|
|
969
970
|
return;
|
|
970
971
|
}
|
|
971
|
-
if (d &&
|
|
972
|
-
const { notesForUpdate:
|
|
972
|
+
if (d && I[0].highlightData.pageLastModifiedAt !== d) {
|
|
973
|
+
const { notesForUpdate: _, noteIdsForDelete: v } = Bt(
|
|
973
974
|
w,
|
|
974
|
-
|
|
975
|
+
I,
|
|
975
976
|
d
|
|
976
977
|
);
|
|
977
|
-
for (const
|
|
978
|
-
N({ id:
|
|
979
|
-
for (const
|
|
980
|
-
|
|
978
|
+
for (const B of _)
|
|
979
|
+
N({ id: B.id, input: B }).catch((ne) => r == null ? void 0 : r(ne));
|
|
980
|
+
for (const B of v)
|
|
981
|
+
C(B, { onError: i });
|
|
981
982
|
} else {
|
|
982
|
-
for (const
|
|
983
|
-
const
|
|
984
|
-
|
|
983
|
+
for (const _ of I) {
|
|
984
|
+
const v = te(_);
|
|
985
|
+
F.add(_.id), v && (A.push(_), G.push(v));
|
|
985
986
|
}
|
|
986
|
-
for (const
|
|
987
|
-
|
|
988
|
-
|
|
987
|
+
for (const _ of D.current)
|
|
988
|
+
F.has(_.id) || je(_, w);
|
|
989
|
+
P(G), D.current = A, h && $t(h);
|
|
989
990
|
}
|
|
990
991
|
}, [
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
992
|
+
J,
|
|
993
|
+
Q,
|
|
994
|
+
te,
|
|
994
995
|
d,
|
|
995
996
|
t,
|
|
996
997
|
N,
|
|
997
|
-
|
|
998
|
+
C,
|
|
998
999
|
h
|
|
999
1000
|
]);
|
|
1000
|
-
const
|
|
1001
|
-
const
|
|
1002
|
-
if (!T || !
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1001
|
+
const U = (w) => {
|
|
1002
|
+
const I = t.current;
|
|
1003
|
+
if (!T || !I) return;
|
|
1004
|
+
const F = ae.fromRange(I, T), A = le.fromRange(I, T);
|
|
1005
|
+
W(
|
|
1005
1006
|
{
|
|
1006
1007
|
courseId: y,
|
|
1007
1008
|
objectId: m,
|
|
@@ -1009,58 +1010,58 @@ function So({
|
|
|
1009
1010
|
userText: "",
|
|
1010
1011
|
reaction: [w],
|
|
1011
1012
|
highlightData: {
|
|
1012
|
-
selectedText:
|
|
1013
|
-
textPosition: (
|
|
1014
|
-
range:
|
|
1013
|
+
selectedText: x,
|
|
1014
|
+
textPosition: (A == null ? void 0 : A.toSelector()) ?? null,
|
|
1015
|
+
range: F.toSelector(),
|
|
1015
1016
|
pageLastModifiedAt: d ?? ""
|
|
1016
1017
|
}
|
|
1017
1018
|
},
|
|
1018
1019
|
{
|
|
1019
|
-
onSuccess: (
|
|
1020
|
-
var
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1020
|
+
onSuccess: (G) => {
|
|
1021
|
+
var v;
|
|
1022
|
+
const _ = G.id;
|
|
1023
|
+
Y(), (v = window.getSelection()) == null || v.removeAllRanges(), p(_), E(), l == null || l(G);
|
|
1023
1024
|
},
|
|
1024
1025
|
onError: o
|
|
1025
1026
|
}
|
|
1026
1027
|
);
|
|
1027
1028
|
};
|
|
1028
|
-
return !T || !
|
|
1029
|
+
return !T || !V ? null : mt(
|
|
1029
1030
|
/* @__PURE__ */ s(
|
|
1030
1031
|
"div",
|
|
1031
1032
|
{
|
|
1032
|
-
id:
|
|
1033
|
+
id: Ce,
|
|
1033
1034
|
role: "toolbar",
|
|
1034
1035
|
style: {
|
|
1035
1036
|
position: "fixed",
|
|
1036
1037
|
zIndex: 100,
|
|
1037
|
-
top:
|
|
1038
|
-
left:
|
|
1038
|
+
top: V.top,
|
|
1039
|
+
left: V.left,
|
|
1039
1040
|
whiteSpace: "nowrap"
|
|
1040
1041
|
},
|
|
1041
1042
|
onBlur: (w) => {
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1043
|
+
const I = document.getElementById(Ce);
|
|
1044
|
+
I != null && I.contains(w.relatedTarget) || Y();
|
|
1044
1045
|
},
|
|
1045
|
-
children: /* @__PURE__ */ s(jn, { onSelectReaction:
|
|
1046
|
+
children: /* @__PURE__ */ s(jn, { onSelectReaction: U })
|
|
1046
1047
|
}
|
|
1047
1048
|
),
|
|
1048
1049
|
document.body
|
|
1049
1050
|
);
|
|
1050
1051
|
}
|
|
1051
1052
|
const Wn = (t, e) => ({
|
|
1052
|
-
backgroundColor: t ===
|
|
1053
|
-
underlineColor: t ===
|
|
1054
|
-
underlineStyle: t ===
|
|
1055
|
-
}),
|
|
1053
|
+
backgroundColor: t === R.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
1054
|
+
underlineColor: t === R.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
1055
|
+
underlineStyle: t === R.IMPORTANT ? "solid" : "dashed"
|
|
1056
|
+
}), Re = ({
|
|
1056
1057
|
children: t,
|
|
1057
|
-
type: e =
|
|
1058
|
+
type: e = R.IMPORTANT,
|
|
1058
1059
|
isCardActive: n = !0,
|
|
1059
1060
|
theme: o
|
|
1060
1061
|
}) => {
|
|
1061
1062
|
const r = Wn(e, o), l = {
|
|
1062
1063
|
position: "relative",
|
|
1063
|
-
backgroundColor: n ? r.backgroundColor :
|
|
1064
|
+
backgroundColor: n ? r.backgroundColor : Fe(r.backgroundColor, 0.5),
|
|
1064
1065
|
textDecorationLine: "underline",
|
|
1065
1066
|
textDecorationStyle: r.underlineStyle,
|
|
1066
1067
|
textDecorationColor: r.underlineColor,
|
|
@@ -1070,10 +1071,10 @@ const Wn = (t, e) => ({
|
|
|
1070
1071
|
};
|
|
1071
1072
|
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: t });
|
|
1072
1073
|
}, ut = () => {
|
|
1073
|
-
const { translations: t } =
|
|
1074
|
-
return /* @__PURE__ */
|
|
1075
|
-
/* @__PURE__ */ s(
|
|
1076
|
-
/* @__PURE__ */ s(
|
|
1074
|
+
const { translations: t } = ee();
|
|
1075
|
+
return /* @__PURE__ */ S(k, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1076
|
+
/* @__PURE__ */ s(k.Item, { as: "div", children: /* @__PURE__ */ s(Nt, { color: "error" }) }),
|
|
1077
|
+
/* @__PURE__ */ s(k.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(Ee, { maxLines: 3, children: t.highlightUnavailable }) })
|
|
1077
1078
|
] });
|
|
1078
1079
|
}, zn = {
|
|
1079
1080
|
filter: null,
|
|
@@ -1081,7 +1082,7 @@ const Wn = (t, e) => ({
|
|
|
1081
1082
|
currentPage: 1,
|
|
1082
1083
|
totalPages: void 0
|
|
1083
1084
|
};
|
|
1084
|
-
function
|
|
1085
|
+
function be(t, e) {
|
|
1085
1086
|
const n = typeof e == "number" ? Math.min(e, t) : t;
|
|
1086
1087
|
return Math.max(1, n);
|
|
1087
1088
|
}
|
|
@@ -1092,18 +1093,18 @@ function qn(t, e) {
|
|
|
1092
1093
|
case "SET_COURSE_FILTER":
|
|
1093
1094
|
return { ...t, courseFilter: e.payload, currentPage: 1 };
|
|
1094
1095
|
case "SET_PAGE":
|
|
1095
|
-
return { ...t, currentPage:
|
|
1096
|
+
return { ...t, currentPage: be(e.payload, t.totalPages) };
|
|
1096
1097
|
case "FOCUS_PAGE":
|
|
1097
1098
|
return { ...t, currentPage: Math.max(1, e.payload) };
|
|
1098
1099
|
case "INCREMENT_PAGE":
|
|
1099
|
-
return { ...t, currentPage:
|
|
1100
|
+
return { ...t, currentPage: be(t.currentPage + 1, t.totalPages) };
|
|
1100
1101
|
case "DECREMENT_PAGE":
|
|
1101
|
-
return { ...t, currentPage:
|
|
1102
|
+
return { ...t, currentPage: be(t.currentPage - 1, t.totalPages) };
|
|
1102
1103
|
case "SET_TOTAL_PAGES":
|
|
1103
1104
|
return t.totalPages === e.payload ? t : {
|
|
1104
1105
|
...t,
|
|
1105
1106
|
totalPages: e.payload,
|
|
1106
|
-
currentPage:
|
|
1107
|
+
currentPage: be(t.currentPage, e.payload)
|
|
1107
1108
|
};
|
|
1108
1109
|
default:
|
|
1109
1110
|
return t;
|
|
@@ -1117,9 +1118,9 @@ function vo({
|
|
|
1117
1118
|
pageSize: r = 16,
|
|
1118
1119
|
focusNoteId: i
|
|
1119
1120
|
}) {
|
|
1120
|
-
var
|
|
1121
|
+
var te;
|
|
1121
1122
|
const [l, a] = Qe(qn, zn), { filter: m, courseFilter: c, currentPage: y, totalPages: d } = l;
|
|
1122
|
-
|
|
1123
|
+
z(() => {
|
|
1123
1124
|
a({ type: "SET_PAGE", payload: 1 });
|
|
1124
1125
|
}, [r]);
|
|
1125
1126
|
const h = n ? c : e, b = (y - 1) * r, p = !!o, E = {
|
|
@@ -1128,8 +1129,8 @@ function vo({
|
|
|
1128
1129
|
...o ? { learningObject: o } : {}
|
|
1129
1130
|
}, {
|
|
1130
1131
|
data: g,
|
|
1131
|
-
isLoading:
|
|
1132
|
-
isError:
|
|
1132
|
+
isLoading: Q,
|
|
1133
|
+
isError: W
|
|
1133
1134
|
} = rt({
|
|
1134
1135
|
api: t,
|
|
1135
1136
|
filter: E,
|
|
@@ -1138,88 +1139,88 @@ function vo({
|
|
|
1138
1139
|
enabled: !p
|
|
1139
1140
|
}), {
|
|
1140
1141
|
data: N,
|
|
1141
|
-
isLoading:
|
|
1142
|
-
isError:
|
|
1142
|
+
isLoading: C,
|
|
1143
|
+
isError: D
|
|
1143
1144
|
} = st({
|
|
1144
1145
|
api: t,
|
|
1145
1146
|
courseId: h ?? void 0,
|
|
1146
1147
|
learningObject: o,
|
|
1147
1148
|
enabled: p
|
|
1148
|
-
}),
|
|
1149
|
-
const
|
|
1150
|
-
return m ?
|
|
1151
|
-
}, [N, m]),
|
|
1152
|
-
|
|
1149
|
+
}), H = he(() => {
|
|
1150
|
+
const U = (N == null ? void 0 : N.notes) ?? [];
|
|
1151
|
+
return m ? U.filter((w) => w.reaction.includes(m)) : U;
|
|
1152
|
+
}, [N, m]), P = $(null);
|
|
1153
|
+
z(() => {
|
|
1153
1154
|
if (!i) {
|
|
1154
|
-
|
|
1155
|
+
P.current = null;
|
|
1155
1156
|
return;
|
|
1156
1157
|
}
|
|
1157
|
-
if (
|
|
1158
|
-
const
|
|
1159
|
-
if (
|
|
1160
|
-
|
|
1161
|
-
const w = Math.floor(
|
|
1158
|
+
if (P.current === i) return;
|
|
1159
|
+
const U = H.findIndex((I) => I.id === i);
|
|
1160
|
+
if (U === -1) return;
|
|
1161
|
+
P.current = i;
|
|
1162
|
+
const w = Math.floor(U / r) + 1;
|
|
1162
1163
|
w !== y && a({ type: "FOCUS_PAGE", payload: w });
|
|
1163
|
-
}, [i,
|
|
1164
|
-
const T = p ?
|
|
1165
|
-
|
|
1166
|
-
a({ type: "SET_TOTAL_PAGES", payload:
|
|
1167
|
-
}, [
|
|
1168
|
-
const
|
|
1169
|
-
a({ type: "SET_PAGE", payload:
|
|
1170
|
-
}, []),
|
|
1164
|
+
}, [i, H, r, y]);
|
|
1165
|
+
const T = p ? H.slice(b, b + r) : (g == null ? void 0 : g.notes) ?? [], O = p ? C : Q, x = p ? D : W, M = p ? Math.max(1, Math.ceil(H.length / r)) : ((te = g == null ? void 0 : g.pageInfo) == null ? void 0 : te.totalNrOfPages) ?? void 0, V = p ? { totalCount: H.length, totalNrOfPages: M } : g == null ? void 0 : g.pageInfo;
|
|
1166
|
+
z(() => {
|
|
1167
|
+
a({ type: "SET_TOTAL_PAGES", payload: M });
|
|
1168
|
+
}, [M]);
|
|
1169
|
+
const Z = q((U) => {
|
|
1170
|
+
a({ type: "SET_PAGE", payload: U });
|
|
1171
|
+
}, []), ce = q(() => {
|
|
1171
1172
|
a({
|
|
1172
1173
|
type: "INCREMENT_PAGE"
|
|
1173
1174
|
/* IncrementPage */
|
|
1174
1175
|
});
|
|
1175
|
-
}, []),
|
|
1176
|
+
}, []), J = q(() => {
|
|
1176
1177
|
a({
|
|
1177
1178
|
type: "DECREMENT_PAGE"
|
|
1178
1179
|
/* DecrementPage */
|
|
1179
1180
|
});
|
|
1180
|
-
}, []),
|
|
1181
|
-
a({ type: "SET_FILTER", payload:
|
|
1182
|
-
}, []),
|
|
1183
|
-
a({ type: "SET_COURSE_FILTER", payload:
|
|
1181
|
+
}, []), de = q((U) => {
|
|
1182
|
+
a({ type: "SET_FILTER", payload: U });
|
|
1183
|
+
}, []), Y = q((U) => {
|
|
1184
|
+
a({ type: "SET_COURSE_FILTER", payload: U });
|
|
1184
1185
|
}, []);
|
|
1185
1186
|
return {
|
|
1186
1187
|
notes: T,
|
|
1187
|
-
pageInfo:
|
|
1188
|
-
isLoading:
|
|
1189
|
-
isError:
|
|
1188
|
+
pageInfo: V,
|
|
1189
|
+
isLoading: O,
|
|
1190
|
+
isError: x,
|
|
1190
1191
|
filter: m,
|
|
1191
1192
|
courseFilter: c,
|
|
1192
1193
|
currentPage: y,
|
|
1193
1194
|
totalPages: d,
|
|
1194
|
-
setFilter:
|
|
1195
|
-
setCourseFilter:
|
|
1196
|
-
setPage:
|
|
1197
|
-
fetchNextPage:
|
|
1198
|
-
fetchPreviousPage:
|
|
1195
|
+
setFilter: de,
|
|
1196
|
+
setCourseFilter: Y,
|
|
1197
|
+
setPage: Z,
|
|
1198
|
+
fetchNextPage: ce,
|
|
1199
|
+
fetchPreviousPage: J
|
|
1199
1200
|
};
|
|
1200
1201
|
}
|
|
1201
|
-
const
|
|
1202
|
+
const xe = "all";
|
|
1202
1203
|
function Io({ filter: t, setFilter: e }) {
|
|
1203
|
-
const { translations: n } =
|
|
1204
|
+
const { translations: n } = ee(), o = he(
|
|
1204
1205
|
() => [
|
|
1205
|
-
{ label: n.allNotes, value:
|
|
1206
|
-
{ label: n.important, value:
|
|
1207
|
-
{ label: n.unclear, value:
|
|
1206
|
+
{ label: n.allNotes, value: xe },
|
|
1207
|
+
{ label: n.important, value: R.IMPORTANT },
|
|
1208
|
+
{ label: n.unclear, value: R.CONFUSING }
|
|
1208
1209
|
],
|
|
1209
1210
|
[n]
|
|
1210
|
-
), r =
|
|
1211
|
+
), r = q(
|
|
1211
1212
|
(l, { value: a }) => {
|
|
1212
|
-
e(!a || a ===
|
|
1213
|
+
e(!a || a === xe ? null : a);
|
|
1213
1214
|
},
|
|
1214
1215
|
[e]
|
|
1215
1216
|
);
|
|
1216
1217
|
return {
|
|
1217
|
-
filterElement:
|
|
1218
|
+
filterElement: he(
|
|
1218
1219
|
() => /* @__PURE__ */ s(
|
|
1219
1220
|
Be,
|
|
1220
1221
|
{
|
|
1221
1222
|
renderLabel: n.filter,
|
|
1222
|
-
value: t ??
|
|
1223
|
+
value: t ?? xe,
|
|
1223
1224
|
onChange: r,
|
|
1224
1225
|
children: o.map((l) => /* @__PURE__ */ s(Be.Option, { id: l.value, value: l.value, children: l.label }, l.value))
|
|
1225
1226
|
}
|
|
@@ -1231,31 +1232,31 @@ function Io({ filter: t, setFilter: e }) {
|
|
|
1231
1232
|
};
|
|
1232
1233
|
}
|
|
1233
1234
|
const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
1234
|
-
const { translations: e } =
|
|
1235
|
-
return /* @__PURE__ */ s(
|
|
1235
|
+
const { translations: e } = ee(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1236
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", children: /* @__PURE__ */ S(k, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1236
1237
|
!t && /* @__PURE__ */ s(bt, { size: "medium" }),
|
|
1237
|
-
/* @__PURE__ */ s(
|
|
1238
|
-
/* @__PURE__ */ s(
|
|
1238
|
+
/* @__PURE__ */ s(Se, { level: "h3", children: n }),
|
|
1239
|
+
/* @__PURE__ */ s(oe, { color: "secondary", children: o })
|
|
1239
1240
|
] }) });
|
|
1240
1241
|
}, Xn = {
|
|
1241
|
-
[
|
|
1242
|
+
[R.IMPORTANT]: {
|
|
1242
1243
|
color: "success",
|
|
1243
1244
|
translationKey: "important",
|
|
1244
|
-
icon: /* @__PURE__ */ s(
|
|
1245
|
+
icon: /* @__PURE__ */ s(Ae, { size: "x-small" })
|
|
1245
1246
|
},
|
|
1246
|
-
[
|
|
1247
|
+
[R.CONFUSING]: {
|
|
1247
1248
|
color: "danger",
|
|
1248
1249
|
translationKey: "unclear",
|
|
1249
|
-
icon: /* @__PURE__ */ s(
|
|
1250
|
+
icon: /* @__PURE__ */ s(Le, { size: "x-small" })
|
|
1250
1251
|
}
|
|
1251
1252
|
}, ft = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
|
|
1252
|
-
const { translations: o } =
|
|
1253
|
+
const { translations: o } = ee(), r = Xn[t], i = o[r.translationKey], [l, a] = j(!1), m = $(null), c = $(null), y = $(null), d = q(
|
|
1253
1254
|
(h) => {
|
|
1254
1255
|
e == null || e(h), a(!1);
|
|
1255
1256
|
},
|
|
1256
1257
|
[e]
|
|
1257
1258
|
);
|
|
1258
|
-
return
|
|
1259
|
+
return z(() => {
|
|
1259
1260
|
if (!l) return;
|
|
1260
1261
|
const h = (p) => {
|
|
1261
1262
|
p.key === "Escape" && p.stopPropagation();
|
|
@@ -1266,8 +1267,8 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1266
1267
|
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup", b, !0), () => {
|
|
1267
1268
|
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup", b, !0);
|
|
1268
1269
|
};
|
|
1269
|
-
}, [l]), n && e ? /* @__PURE__ */
|
|
1270
|
-
|
|
1270
|
+
}, [l]), n && e ? /* @__PURE__ */ S(
|
|
1271
|
+
ue,
|
|
1271
1272
|
{
|
|
1272
1273
|
placement: "bottom start",
|
|
1273
1274
|
show: l,
|
|
@@ -1286,17 +1287,17 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1286
1287
|
}
|
|
1287
1288
|
),
|
|
1288
1289
|
children: [
|
|
1289
|
-
/* @__PURE__ */
|
|
1290
|
-
/* @__PURE__ */ s(
|
|
1290
|
+
/* @__PURE__ */ S(ue.Item, { ref: m, onClick: () => d(R.CONFUSING), children: [
|
|
1291
|
+
/* @__PURE__ */ s(Le, { size: "x-small" }),
|
|
1291
1292
|
` ${o.markUnclear}`
|
|
1292
1293
|
] }),
|
|
1293
|
-
/* @__PURE__ */
|
|
1294
|
-
/* @__PURE__ */ s(
|
|
1294
|
+
/* @__PURE__ */ S(ue.Item, { ref: c, onClick: () => d(R.IMPORTANT), children: [
|
|
1295
|
+
/* @__PURE__ */ s(Ae, { size: "x-small" }),
|
|
1295
1296
|
` ${o.markImportant}`
|
|
1296
1297
|
] })
|
|
1297
1298
|
]
|
|
1298
1299
|
}
|
|
1299
|
-
) : /* @__PURE__ */ s(
|
|
1300
|
+
) : /* @__PURE__ */ s(X, { display: "inline-flex", children: /* @__PURE__ */ s($e, { color: r.color, renderIcon: r.icon, children: i }) });
|
|
1300
1301
|
}, We = "0.75rem";
|
|
1301
1302
|
function ze(t, e) {
|
|
1302
1303
|
return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
|
|
@@ -1323,42 +1324,42 @@ const Qn = ({
|
|
|
1323
1324
|
renderLink: p,
|
|
1324
1325
|
href: E
|
|
1325
1326
|
}) => {
|
|
1326
|
-
const { translations: g } =
|
|
1327
|
-
|
|
1328
|
-
}, []),
|
|
1329
|
-
|
|
1330
|
-
var
|
|
1331
|
-
c ? ((
|
|
1332
|
-
}, [c]),
|
|
1333
|
-
var
|
|
1334
|
-
N ? (
|
|
1335
|
-
}, [N]),
|
|
1336
|
-
if (!
|
|
1337
|
-
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1327
|
+
const { translations: g } = ee(), [Q, W] = j(!1), [N, C] = j(!1), [D, H] = j(o || ""), [P, T] = j(!1), [O, x] = j(!1), [M, V] = j(!1), [Z, ce] = j(!1), J = $(null), de = q((f) => {
|
|
1328
|
+
J.current = f;
|
|
1329
|
+
}, []), Y = $(null), te = $(null), U = $(!1), w = $(null), I = $(null), F = $(!1);
|
|
1330
|
+
z(() => {
|
|
1331
|
+
var f, L;
|
|
1332
|
+
c ? ((f = J.current) == null || f.scrollIntoView({ behavior: "smooth", block: "nearest" }), (L = J.current) == null || L.focus()) : T(!1);
|
|
1333
|
+
}, [c]), z(() => {
|
|
1334
|
+
var f, L;
|
|
1335
|
+
N ? (U.current = !0, (f = Y.current) == null || f.focus()) : U.current && (U.current = !1, (L = te.current) == null || L.focus());
|
|
1336
|
+
}, [N]), z(() => {
|
|
1337
|
+
if (!P && F.current) {
|
|
1338
|
+
F.current = !1;
|
|
1339
|
+
const f = w.current;
|
|
1340
|
+
f != null && f.isConnected && f.focus();
|
|
1340
1341
|
}
|
|
1341
|
-
}, [
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1342
|
+
}, [P]);
|
|
1343
|
+
const A = q((f, L) => {
|
|
1344
|
+
F.current = !L, T(!1);
|
|
1344
1345
|
}, []);
|
|
1345
|
-
|
|
1346
|
-
if (!
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1349
|
-
},
|
|
1350
|
-
|
|
1346
|
+
z(() => {
|
|
1347
|
+
if (!P) return;
|
|
1348
|
+
const f = (ie) => {
|
|
1349
|
+
ie.key === "Escape" && ie.stopPropagation();
|
|
1350
|
+
}, L = (ie) => {
|
|
1351
|
+
ie.key === "Escape" && (ie.stopPropagation(), A());
|
|
1351
1352
|
};
|
|
1352
|
-
return window.addEventListener("keydown",
|
|
1353
|
-
window.removeEventListener("keydown",
|
|
1353
|
+
return window.addEventListener("keydown", f, !0), window.addEventListener("keyup", L, !0), () => {
|
|
1354
|
+
window.removeEventListener("keydown", f, !0), window.removeEventListener("keyup", L, !0);
|
|
1354
1355
|
};
|
|
1355
|
-
}, [
|
|
1356
|
-
const G = r ===
|
|
1357
|
-
|
|
1358
|
-
},
|
|
1359
|
-
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1356
|
+
}, [P, A]);
|
|
1357
|
+
const G = r === R.IMPORTANT ? g.important : g.unclear, _ = (f) => {
|
|
1358
|
+
f.key === "Enter" && (f.preventDefault(), i == null || i());
|
|
1359
|
+
}, v = [g.note, G];
|
|
1360
|
+
v.push(n || g.highlightUnavailable), o && v.push(o), e && v.push(ze(e, h)), d && v.push(d);
|
|
1361
|
+
const B = v.join(", "), ne = /* @__PURE__ */ S(
|
|
1362
|
+
X,
|
|
1362
1363
|
{
|
|
1363
1364
|
as: "div",
|
|
1364
1365
|
height: "100%",
|
|
@@ -1367,15 +1368,15 @@ const Qn = ({
|
|
|
1367
1368
|
padding: "small",
|
|
1368
1369
|
position: "relative",
|
|
1369
1370
|
role: E ? void 0 : c || N ? "group" : "button",
|
|
1370
|
-
"aria-label": E ? void 0 :
|
|
1371
|
+
"aria-label": E ? void 0 : B,
|
|
1371
1372
|
"aria-pressed": E || c || N ? void 0 : c,
|
|
1372
1373
|
tabIndex: E || c ? -1 : 0,
|
|
1373
1374
|
"data-testid": `note-card-${t}`,
|
|
1374
|
-
elementRef:
|
|
1375
|
+
elementRef: de,
|
|
1375
1376
|
onClick: c ? void 0 : i,
|
|
1376
|
-
onMouseEnter: () =>
|
|
1377
|
-
onMouseLeave: () =>
|
|
1378
|
-
onKeyDown: c ? void 0 :
|
|
1377
|
+
onMouseEnter: () => W(!0),
|
|
1378
|
+
onMouseLeave: () => W(!1),
|
|
1379
|
+
onKeyDown: c ? void 0 : _,
|
|
1379
1380
|
cursor: N ? "default" : "pointer",
|
|
1380
1381
|
children: [
|
|
1381
1382
|
/* @__PURE__ */ s(
|
|
@@ -1384,83 +1385,83 @@ const Qn = ({
|
|
|
1384
1385
|
"data-testid": `note-card-${t}-content`,
|
|
1385
1386
|
style: {
|
|
1386
1387
|
height: "100%",
|
|
1387
|
-
opacity: c &&
|
|
1388
|
+
opacity: c && P && l ? 0.25 : void 0
|
|
1388
1389
|
},
|
|
1389
|
-
children: /* @__PURE__ */
|
|
1390
|
+
children: /* @__PURE__ */ S(k, { direction: "column", gap: "small", height: "100%", children: [
|
|
1390
1391
|
/* @__PURE__ */ s(
|
|
1391
1392
|
ft,
|
|
1392
1393
|
{
|
|
1393
1394
|
type: r,
|
|
1394
|
-
onTypeChange: y && m ? (
|
|
1395
|
+
onTypeChange: y && m ? (f) => m(t, f) : void 0,
|
|
1395
1396
|
renderAsMenuTrigger: y && !!m && !!c
|
|
1396
1397
|
}
|
|
1397
1398
|
),
|
|
1398
|
-
n ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(
|
|
1399
|
-
|
|
1399
|
+
n ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(oe, { children: c && y ? /* @__PURE__ */ s(
|
|
1400
|
+
Re,
|
|
1400
1401
|
{
|
|
1401
1402
|
type: r,
|
|
1402
|
-
isCardActive: !!c ||
|
|
1403
|
+
isCardActive: !!c || Q,
|
|
1403
1404
|
theme: b,
|
|
1404
1405
|
children: n
|
|
1405
1406
|
}
|
|
1406
|
-
) : /* @__PURE__ */
|
|
1407
|
-
|
|
1408
|
-
/* @__PURE__ */ s("span", { "aria-hidden":
|
|
1409
|
-
|
|
1407
|
+
) : /* @__PURE__ */ S(qe, { children: [
|
|
1408
|
+
O && /* @__PURE__ */ s(pe, { children: n }),
|
|
1409
|
+
/* @__PURE__ */ s("span", { "aria-hidden": O, style: { display: "block" }, children: /* @__PURE__ */ s(Ee, { maxLines: 3, truncate: "word", onUpdate: x, children: /* @__PURE__ */ s(
|
|
1410
|
+
Re,
|
|
1410
1411
|
{
|
|
1411
1412
|
type: r,
|
|
1412
|
-
isCardActive: !!c ||
|
|
1413
|
+
isCardActive: !!c || Q,
|
|
1413
1414
|
theme: b,
|
|
1414
1415
|
children: n
|
|
1415
1416
|
}
|
|
1416
1417
|
) }) })
|
|
1417
1418
|
] }) }) }) : /* @__PURE__ */ s(ut, {}),
|
|
1418
|
-
/* @__PURE__ */ s(
|
|
1419
|
-
N && y ? /* @__PURE__ */
|
|
1419
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ S(k, { direction: "column", gap: "small", height: "100%", children: [
|
|
1420
|
+
N && y ? /* @__PURE__ */ S(k, { direction: "column", gap: "x-small", margin: "xx-small", children: [
|
|
1420
1421
|
/* @__PURE__ */ s(
|
|
1421
1422
|
Ye,
|
|
1422
1423
|
{
|
|
1423
|
-
label: /* @__PURE__ */ s(
|
|
1424
|
-
value:
|
|
1425
|
-
onChange: (
|
|
1424
|
+
label: /* @__PURE__ */ s(pe, { children: g.editNote }),
|
|
1425
|
+
value: D,
|
|
1426
|
+
onChange: (f) => H(f.target.value),
|
|
1426
1427
|
placeholder: g.addNoteOptional,
|
|
1427
|
-
textareaRef: (
|
|
1428
|
-
|
|
1428
|
+
textareaRef: (f) => {
|
|
1429
|
+
Y.current = f;
|
|
1429
1430
|
}
|
|
1430
1431
|
}
|
|
1431
1432
|
),
|
|
1432
|
-
/* @__PURE__ */
|
|
1433
|
-
/* @__PURE__ */ s(
|
|
1434
|
-
|
|
1433
|
+
/* @__PURE__ */ S(k, { gap: "xx-small", children: [
|
|
1434
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1435
|
+
re,
|
|
1435
1436
|
{
|
|
1436
1437
|
display: "block",
|
|
1437
1438
|
size: "small",
|
|
1438
1439
|
"data-testid": `note-card-${t}-cancel`,
|
|
1439
1440
|
onClick: () => {
|
|
1440
|
-
|
|
1441
|
+
H(o || ""), C(!1);
|
|
1441
1442
|
},
|
|
1442
1443
|
children: g.cancel
|
|
1443
1444
|
}
|
|
1444
1445
|
) }),
|
|
1445
|
-
/* @__PURE__ */ s(
|
|
1446
|
-
|
|
1446
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1447
|
+
re,
|
|
1447
1448
|
{
|
|
1448
1449
|
display: "block",
|
|
1449
1450
|
color: "primary",
|
|
1450
1451
|
size: "small",
|
|
1451
1452
|
"data-testid": `note-card-${t}-save`,
|
|
1452
1453
|
onClick: () => {
|
|
1453
|
-
a == null || a(t,
|
|
1454
|
+
a == null || a(t, D.trim()), C(!1);
|
|
1454
1455
|
},
|
|
1455
1456
|
children: g.save
|
|
1456
1457
|
}
|
|
1457
1458
|
) })
|
|
1458
1459
|
] })
|
|
1459
|
-
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && y ? /* @__PURE__ */
|
|
1460
|
+
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && y ? /* @__PURE__ */ S(oe, { children: [
|
|
1460
1461
|
o,
|
|
1461
1462
|
" ",
|
|
1462
1463
|
/* @__PURE__ */ s(
|
|
1463
|
-
|
|
1464
|
+
me,
|
|
1464
1465
|
{
|
|
1465
1466
|
size: "small",
|
|
1466
1467
|
withBackground: !1,
|
|
@@ -1468,23 +1469,23 @@ const Qn = ({
|
|
|
1468
1469
|
margin: "xx-small 0 0 xxx-small",
|
|
1469
1470
|
screenReaderLabel: g.editNote,
|
|
1470
1471
|
"data-testid": `note-card-${t}-edit`,
|
|
1471
|
-
elementRef: (
|
|
1472
|
-
|
|
1472
|
+
elementRef: (f) => {
|
|
1473
|
+
te.current = f;
|
|
1473
1474
|
},
|
|
1474
|
-
onClick: (
|
|
1475
|
-
|
|
1475
|
+
onClick: (f) => {
|
|
1476
|
+
f.stopPropagation(), C(!0);
|
|
1476
1477
|
},
|
|
1477
|
-
children: /* @__PURE__ */ s(
|
|
1478
|
+
children: /* @__PURE__ */ s(ke, {})
|
|
1478
1479
|
}
|
|
1479
1480
|
)
|
|
1480
|
-
] }) : /* @__PURE__ */
|
|
1481
|
-
|
|
1482
|
-
/* @__PURE__ */ s("span", { "aria-hidden":
|
|
1483
|
-
] }) }) : y && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */
|
|
1481
|
+
] }) : /* @__PURE__ */ S(oe, { children: [
|
|
1482
|
+
M && /* @__PURE__ */ s(pe, { children: o }),
|
|
1483
|
+
/* @__PURE__ */ s("span", { "aria-hidden": M, style: { display: "block" }, children: /* @__PURE__ */ s(Ee, { maxLines: 3, truncate: "word", onUpdate: V, children: o }) })
|
|
1484
|
+
] }) }) : y && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ S(oe, { color: "secondary", children: [
|
|
1484
1485
|
g.addNotePrompt,
|
|
1485
1486
|
" ",
|
|
1486
1487
|
/* @__PURE__ */ s(
|
|
1487
|
-
|
|
1488
|
+
me,
|
|
1488
1489
|
{
|
|
1489
1490
|
size: "small",
|
|
1490
1491
|
withBackground: !1,
|
|
@@ -1492,20 +1493,20 @@ const Qn = ({
|
|
|
1492
1493
|
margin: "xx-small 0 0 xxx-small",
|
|
1493
1494
|
screenReaderLabel: g.editNote,
|
|
1494
1495
|
"data-testid": `note-card-${t}-edit`,
|
|
1495
|
-
elementRef: (
|
|
1496
|
-
|
|
1496
|
+
elementRef: (f) => {
|
|
1497
|
+
te.current = f;
|
|
1497
1498
|
},
|
|
1498
|
-
onClick: (
|
|
1499
|
-
|
|
1499
|
+
onClick: (f) => {
|
|
1500
|
+
f.stopPropagation(), C(!0);
|
|
1500
1501
|
},
|
|
1501
|
-
children: /* @__PURE__ */ s(
|
|
1502
|
+
children: /* @__PURE__ */ s(ke, {})
|
|
1502
1503
|
}
|
|
1503
1504
|
)
|
|
1504
1505
|
] }) }) : null,
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */ s(
|
|
1506
|
+
/* @__PURE__ */ S(k, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
|
|
1507
|
+
/* @__PURE__ */ s(oe, { as: "div", size: "small", color: "secondary", children: ze(e, h) }),
|
|
1507
1508
|
c && l && /* @__PURE__ */ s(
|
|
1508
|
-
|
|
1509
|
+
me,
|
|
1509
1510
|
{
|
|
1510
1511
|
size: "small",
|
|
1511
1512
|
withBackground: !1,
|
|
@@ -1514,31 +1515,34 @@ const Qn = ({
|
|
|
1514
1515
|
margin: "xx-small",
|
|
1515
1516
|
screenReaderLabel: g.deleteNote,
|
|
1516
1517
|
"data-testid": `note-card-${t}-delete`,
|
|
1517
|
-
elementRef: (
|
|
1518
|
-
|
|
1518
|
+
elementRef: (f) => {
|
|
1519
|
+
w.current = f;
|
|
1519
1520
|
},
|
|
1520
|
-
onClick: (
|
|
1521
|
-
|
|
1521
|
+
onClick: (f) => {
|
|
1522
|
+
f.stopPropagation(), F.current = !1, T(!0);
|
|
1522
1523
|
},
|
|
1523
|
-
children: /* @__PURE__ */ s(
|
|
1524
|
+
children: /* @__PURE__ */ s(Te, {})
|
|
1524
1525
|
}
|
|
1525
1526
|
)
|
|
1526
1527
|
] }),
|
|
1527
|
-
d && /* @__PURE__ */
|
|
1528
|
-
|
|
1528
|
+
d && /* @__PURE__ */ S(
|
|
1529
|
+
oe,
|
|
1529
1530
|
{
|
|
1530
1531
|
as: "div",
|
|
1531
1532
|
size: "small",
|
|
1532
1533
|
color: "secondary",
|
|
1533
1534
|
"data-testid": `note-card-${t}-course`,
|
|
1534
|
-
children:
|
|
1535
|
+
children: [
|
|
1536
|
+
Z && /* @__PURE__ */ s(pe, { children: d }),
|
|
1537
|
+
/* @__PURE__ */ s("span", { "aria-hidden": Z, style: { display: "block" }, children: /* @__PURE__ */ s(Ee, { maxLines: 1, onUpdate: ce, children: d }) })
|
|
1538
|
+
]
|
|
1535
1539
|
}
|
|
1536
1540
|
)
|
|
1537
1541
|
] }) })
|
|
1538
1542
|
] })
|
|
1539
1543
|
}
|
|
1540
1544
|
),
|
|
1541
|
-
c &&
|
|
1545
|
+
c && P && l && /* @__PURE__ */ s(
|
|
1542
1546
|
Tt,
|
|
1543
1547
|
{
|
|
1544
1548
|
open: !0,
|
|
@@ -1546,13 +1550,13 @@ const Qn = ({
|
|
|
1546
1550
|
label: g.deleteNoteConfirmation,
|
|
1547
1551
|
shouldContainFocus: !0,
|
|
1548
1552
|
shouldFocusOnOpen: !0,
|
|
1549
|
-
defaultFocusElement: () =>
|
|
1553
|
+
defaultFocusElement: () => I.current,
|
|
1550
1554
|
shouldCloseOnDocumentClick: !0,
|
|
1551
1555
|
shouldCloseOnEscape: !1,
|
|
1552
1556
|
shouldReturnFocus: !1,
|
|
1553
|
-
onDismiss:
|
|
1557
|
+
onDismiss: A,
|
|
1554
1558
|
children: /* @__PURE__ */ s(
|
|
1555
|
-
|
|
1559
|
+
X,
|
|
1556
1560
|
{
|
|
1557
1561
|
as: "div",
|
|
1558
1562
|
padding: "medium",
|
|
@@ -1562,8 +1566,8 @@ const Qn = ({
|
|
|
1562
1566
|
insetInlineStart: "0",
|
|
1563
1567
|
insetInlineEnd: "0",
|
|
1564
1568
|
stacking: "above",
|
|
1565
|
-
children: /* @__PURE__ */
|
|
1566
|
-
|
|
1569
|
+
children: /* @__PURE__ */ S(
|
|
1570
|
+
k,
|
|
1567
1571
|
{
|
|
1568
1572
|
direction: "column",
|
|
1569
1573
|
justifyItems: "center",
|
|
@@ -1572,45 +1576,45 @@ const Qn = ({
|
|
|
1572
1576
|
height: "100%",
|
|
1573
1577
|
children: [
|
|
1574
1578
|
/* @__PURE__ */ s(
|
|
1575
|
-
|
|
1579
|
+
re,
|
|
1576
1580
|
{
|
|
1577
1581
|
display: "block",
|
|
1578
1582
|
color: "danger",
|
|
1579
1583
|
withBackground: !1,
|
|
1580
|
-
themeOverride: (
|
|
1584
|
+
themeOverride: (f, L) => ({
|
|
1581
1585
|
borderRadius: We,
|
|
1582
1586
|
// Ghost states default to translucent fills; the faded card would show through.
|
|
1583
|
-
dangerGhostBackground:
|
|
1584
|
-
dangerGhostHoverBackground:
|
|
1585
|
-
dangerGhostActiveBackground:
|
|
1587
|
+
dangerGhostBackground: L.colors.contrasts.white1010,
|
|
1588
|
+
dangerGhostHoverBackground: L.colors.contrasts.red1212,
|
|
1589
|
+
dangerGhostActiveBackground: L.colors.contrasts.red1212,
|
|
1586
1590
|
// red45 on the hover tint is 3.74:1; red57 clears AA in every state.
|
|
1587
|
-
dangerGhostColor:
|
|
1588
|
-
dangerGhostBorderColor:
|
|
1591
|
+
dangerGhostColor: L.colors.contrasts.red5782,
|
|
1592
|
+
dangerGhostBorderColor: L.colors.contrasts.red5782
|
|
1589
1593
|
}),
|
|
1590
|
-
renderIcon: /* @__PURE__ */ s(
|
|
1594
|
+
renderIcon: /* @__PURE__ */ s(Te, {}),
|
|
1591
1595
|
"data-testid": `note-card-${t}-confirm-delete`,
|
|
1592
|
-
onClick: (
|
|
1593
|
-
|
|
1596
|
+
onClick: (f) => {
|
|
1597
|
+
f.stopPropagation(), l(t), T(!1);
|
|
1594
1598
|
},
|
|
1595
1599
|
children: g.deleteNote
|
|
1596
1600
|
}
|
|
1597
1601
|
),
|
|
1598
1602
|
/* @__PURE__ */ s(
|
|
1599
|
-
|
|
1603
|
+
re,
|
|
1600
1604
|
{
|
|
1601
1605
|
display: "block",
|
|
1602
1606
|
withBackground: !1,
|
|
1603
|
-
themeOverride: (
|
|
1607
|
+
themeOverride: (f, L) => ({
|
|
1604
1608
|
borderRadius: We,
|
|
1605
|
-
secondaryGhostBackground:
|
|
1606
|
-
secondaryGhostActiveBackground:
|
|
1609
|
+
secondaryGhostBackground: L.colors.contrasts.white1010,
|
|
1610
|
+
secondaryGhostActiveBackground: L.colors.contrasts.grey1111
|
|
1607
1611
|
}),
|
|
1608
1612
|
"data-testid": `note-card-${t}-cancel-delete`,
|
|
1609
|
-
elementRef: (
|
|
1610
|
-
|
|
1613
|
+
elementRef: (f) => {
|
|
1614
|
+
I.current = f;
|
|
1611
1615
|
},
|
|
1612
|
-
onClick: (
|
|
1613
|
-
|
|
1616
|
+
onClick: (f) => {
|
|
1617
|
+
f.stopPropagation(), A();
|
|
1614
1618
|
},
|
|
1615
1619
|
children: g.cancel
|
|
1616
1620
|
}
|
|
@@ -1625,7 +1629,7 @@ const Qn = ({
|
|
|
1625
1629
|
]
|
|
1626
1630
|
}
|
|
1627
1631
|
);
|
|
1628
|
-
return E && p ? p({ href: E, children:
|
|
1632
|
+
return E && p ? p({ href: E, children: ne, ariaLabel: B }) : ne;
|
|
1629
1633
|
}, Yn = {
|
|
1630
1634
|
display: "grid",
|
|
1631
1635
|
gap: "1rem",
|
|
@@ -1652,71 +1656,71 @@ const Qn = ({
|
|
|
1652
1656
|
highlightTheme: p,
|
|
1653
1657
|
locale: E,
|
|
1654
1658
|
courseNames: g,
|
|
1655
|
-
renderNoteLink:
|
|
1656
|
-
noteHref:
|
|
1659
|
+
renderNoteLink: Q,
|
|
1660
|
+
noteHref: W
|
|
1657
1661
|
}) => {
|
|
1658
|
-
const { translations: N } =
|
|
1662
|
+
const { translations: N } = ee(), C = $(null), D = $(null), H = q(
|
|
1659
1663
|
(T) => {
|
|
1660
|
-
const
|
|
1661
|
-
let
|
|
1662
|
-
t.length > 1 && (
|
|
1664
|
+
const O = t.findIndex((M) => M.id === T);
|
|
1665
|
+
let x = null;
|
|
1666
|
+
t.length > 1 && (x = O > 0 ? t[O - 1].id : t[1].id), D.current = { targetId: x }, a == null || a(T);
|
|
1663
1667
|
},
|
|
1664
1668
|
[t, a]
|
|
1665
1669
|
);
|
|
1666
|
-
if (
|
|
1667
|
-
var
|
|
1668
|
-
const T =
|
|
1670
|
+
if (z(() => {
|
|
1671
|
+
var O;
|
|
1672
|
+
const T = D.current;
|
|
1669
1673
|
if (T)
|
|
1670
|
-
if (
|
|
1674
|
+
if (D.current = null, T.targetId === null)
|
|
1671
1675
|
y == null || y();
|
|
1672
1676
|
else {
|
|
1673
|
-
const
|
|
1677
|
+
const x = (O = C.current) == null ? void 0 : O.querySelector(
|
|
1674
1678
|
`[data-testid="note-card-${T.targetId}"]`
|
|
1675
1679
|
);
|
|
1676
|
-
|
|
1680
|
+
x == null || x.focus();
|
|
1677
1681
|
}
|
|
1678
1682
|
}, [t, y]), e)
|
|
1679
|
-
return /* @__PURE__ */ s(
|
|
1683
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(vt, { renderTitle: N.loadingNotes }) });
|
|
1680
1684
|
if (n)
|
|
1681
|
-
return /* @__PURE__ */ s(
|
|
1685
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(Se, { level: "h4", children: N.failedToLoadNotes }) });
|
|
1682
1686
|
if (t.length === 0)
|
|
1683
|
-
return /* @__PURE__ */ s(
|
|
1684
|
-
const
|
|
1685
|
-
return /* @__PURE__ */
|
|
1687
|
+
return /* @__PURE__ */ s(X, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(Kn, { hasActiveFilter: h }) });
|
|
1688
|
+
const P = typeof o == "number" && typeof r == "number" && r > 1 && i !== void 0;
|
|
1689
|
+
return /* @__PURE__ */ S(qe, { children: [
|
|
1686
1690
|
/* @__PURE__ */ s(
|
|
1687
1691
|
"ul",
|
|
1688
1692
|
{
|
|
1689
|
-
ref:
|
|
1693
|
+
ref: C,
|
|
1690
1694
|
style: { ...Yn, gridTemplateColumns: `repeat(${b}, minmax(0, 1fr))` },
|
|
1691
1695
|
role: "list",
|
|
1692
1696
|
"data-testid": "notes-grid",
|
|
1693
1697
|
children: t.map((T) => {
|
|
1694
|
-
var
|
|
1698
|
+
var O;
|
|
1695
1699
|
return /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(
|
|
1696
1700
|
Qn,
|
|
1697
1701
|
{
|
|
1698
1702
|
noteId: T.id,
|
|
1699
1703
|
date: T.createdAt,
|
|
1700
|
-
type: T.reaction[0] ??
|
|
1701
|
-
highlight: (
|
|
1704
|
+
type: T.reaction[0] ?? R.IMPORTANT,
|
|
1705
|
+
highlight: (O = T.highlightData) == null ? void 0 : O.selectedText,
|
|
1702
1706
|
note: T.userText,
|
|
1703
1707
|
isActive: d === T.id,
|
|
1704
1708
|
isPanelView: !!d,
|
|
1705
1709
|
onClick: l ? () => l(T.id) : void 0,
|
|
1706
|
-
onDelete: a ?
|
|
1707
|
-
onSaveNote: m ? (
|
|
1708
|
-
onTypeChange: c ? (
|
|
1710
|
+
onDelete: a ? H : void 0,
|
|
1711
|
+
onSaveNote: m ? (x, M) => m(x, M) : void 0,
|
|
1712
|
+
onTypeChange: c ? (x, M) => c(x, M) : void 0,
|
|
1709
1713
|
highlightTheme: p,
|
|
1710
1714
|
locale: E,
|
|
1711
1715
|
courseName: g == null ? void 0 : g.get(T.courseId),
|
|
1712
|
-
renderLink:
|
|
1713
|
-
href:
|
|
1716
|
+
renderLink: Q,
|
|
1717
|
+
href: W ? W(T.id, T) : void 0
|
|
1714
1718
|
}
|
|
1715
1719
|
) }, T.id);
|
|
1716
1720
|
})
|
|
1717
1721
|
}
|
|
1718
1722
|
),
|
|
1719
|
-
|
|
1723
|
+
P && /* @__PURE__ */ s(k, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ s(k.Item, { children: /* @__PURE__ */ s(
|
|
1720
1724
|
St,
|
|
1721
1725
|
{
|
|
1722
1726
|
as: "nav",
|
|
@@ -1740,11 +1744,11 @@ const Qn = ({
|
|
|
1740
1744
|
onBack: a,
|
|
1741
1745
|
editing: m = !1
|
|
1742
1746
|
}) => {
|
|
1743
|
-
const { translations: c } =
|
|
1744
|
-
return /* @__PURE__ */
|
|
1745
|
-
n != null ? /* @__PURE__ */ s(
|
|
1747
|
+
const { translations: c } = ee(), [y, d] = j(m), [h, b] = j(t || ""), [p, E] = j(!1);
|
|
1748
|
+
return /* @__PURE__ */ S(k, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1749
|
+
n != null ? /* @__PURE__ */ s(X, { as: "div", children: /* @__PURE__ */ s(oe, { children: /* @__PURE__ */ s(Re, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ s(ut, {}),
|
|
1746
1750
|
/* @__PURE__ */ s(ft, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1747
|
-
y ? /* @__PURE__ */
|
|
1751
|
+
y ? /* @__PURE__ */ S(k, { direction: "column", gap: "x-small", children: [
|
|
1748
1752
|
/* @__PURE__ */ s(
|
|
1749
1753
|
Ye,
|
|
1750
1754
|
{
|
|
@@ -1754,9 +1758,9 @@ const Qn = ({
|
|
|
1754
1758
|
resize: "vertical"
|
|
1755
1759
|
}
|
|
1756
1760
|
),
|
|
1757
|
-
/* @__PURE__ */
|
|
1758
|
-
/* @__PURE__ */ s(
|
|
1759
|
-
|
|
1761
|
+
/* @__PURE__ */ S(k, { gap: "xx-small", children: [
|
|
1762
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1763
|
+
re,
|
|
1760
1764
|
{
|
|
1761
1765
|
display: "block",
|
|
1762
1766
|
size: "small",
|
|
@@ -1767,8 +1771,8 @@ const Qn = ({
|
|
|
1767
1771
|
children: c.cancel
|
|
1768
1772
|
}
|
|
1769
1773
|
) }),
|
|
1770
|
-
/* @__PURE__ */ s(
|
|
1771
|
-
|
|
1774
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1775
|
+
re,
|
|
1772
1776
|
{
|
|
1773
1777
|
display: "block",
|
|
1774
1778
|
color: "primary",
|
|
@@ -1781,14 +1785,14 @@ const Qn = ({
|
|
|
1781
1785
|
}
|
|
1782
1786
|
) })
|
|
1783
1787
|
] })
|
|
1784
|
-
] }) : /* @__PURE__ */
|
|
1785
|
-
t && /* @__PURE__ */
|
|
1786
|
-
/* @__PURE__ */ s(
|
|
1787
|
-
/* @__PURE__ */ s(
|
|
1788
|
+
] }) : /* @__PURE__ */ S(k, { direction: "column", gap: "small", children: [
|
|
1789
|
+
t && /* @__PURE__ */ S(X, { as: "div", children: [
|
|
1790
|
+
/* @__PURE__ */ s(Se, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
|
|
1791
|
+
/* @__PURE__ */ s(oe, { children: t })
|
|
1788
1792
|
] }),
|
|
1789
|
-
/* @__PURE__ */
|
|
1793
|
+
/* @__PURE__ */ S(k, { justifyItems: "space-between", children: [
|
|
1790
1794
|
/* @__PURE__ */ s(
|
|
1791
|
-
|
|
1795
|
+
re,
|
|
1792
1796
|
{
|
|
1793
1797
|
size: "small",
|
|
1794
1798
|
renderIcon: /* @__PURE__ */ s(Et, {}),
|
|
@@ -1797,9 +1801,9 @@ const Qn = ({
|
|
|
1797
1801
|
children: c.back
|
|
1798
1802
|
}
|
|
1799
1803
|
),
|
|
1800
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ S(k, { gap: "xx-small", children: [
|
|
1801
1805
|
i && /* @__PURE__ */ s(
|
|
1802
|
-
|
|
1806
|
+
me,
|
|
1803
1807
|
{
|
|
1804
1808
|
size: "small",
|
|
1805
1809
|
withBackground: !1,
|
|
@@ -1808,11 +1812,11 @@ const Qn = ({
|
|
|
1808
1812
|
screenReaderLabel: c.deleteNote,
|
|
1809
1813
|
"data-testid": "single-note-delete",
|
|
1810
1814
|
onClick: () => E(!0),
|
|
1811
|
-
children: /* @__PURE__ */ s(
|
|
1815
|
+
children: /* @__PURE__ */ s(Te, {})
|
|
1812
1816
|
}
|
|
1813
1817
|
),
|
|
1814
1818
|
/* @__PURE__ */ s(
|
|
1815
|
-
|
|
1819
|
+
me,
|
|
1816
1820
|
{
|
|
1817
1821
|
size: "small",
|
|
1818
1822
|
withBackground: !1,
|
|
@@ -1820,19 +1824,19 @@ const Qn = ({
|
|
|
1820
1824
|
screenReaderLabel: c.editNote,
|
|
1821
1825
|
"data-testid": "single-note-edit",
|
|
1822
1826
|
onClick: () => d(!0),
|
|
1823
|
-
children: /* @__PURE__ */ s(
|
|
1827
|
+
children: /* @__PURE__ */ s(ke, {})
|
|
1824
1828
|
}
|
|
1825
1829
|
)
|
|
1826
1830
|
] })
|
|
1827
1831
|
] }),
|
|
1828
|
-
p && i && /* @__PURE__ */ s(
|
|
1832
|
+
p && i && /* @__PURE__ */ s(X, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ S(k, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1829
1833
|
/* @__PURE__ */ s(
|
|
1830
|
-
|
|
1834
|
+
re,
|
|
1831
1835
|
{
|
|
1832
1836
|
display: "block",
|
|
1833
1837
|
color: "danger",
|
|
1834
1838
|
size: "small",
|
|
1835
|
-
renderIcon: /* @__PURE__ */ s(
|
|
1839
|
+
renderIcon: /* @__PURE__ */ s(Te, {}),
|
|
1836
1840
|
"data-testid": "single-note-confirm-delete",
|
|
1837
1841
|
onClick: () => {
|
|
1838
1842
|
i(), E(!1);
|
|
@@ -1841,7 +1845,7 @@ const Qn = ({
|
|
|
1841
1845
|
}
|
|
1842
1846
|
),
|
|
1843
1847
|
/* @__PURE__ */ s(
|
|
1844
|
-
|
|
1848
|
+
re,
|
|
1845
1849
|
{
|
|
1846
1850
|
display: "block",
|
|
1847
1851
|
size: "small",
|
|
@@ -1856,7 +1860,7 @@ const Qn = ({
|
|
|
1856
1860
|
};
|
|
1857
1861
|
export {
|
|
1858
1862
|
So as ContentWithNoteWrapper,
|
|
1859
|
-
|
|
1863
|
+
Re as Highlight,
|
|
1860
1864
|
ut as HighlightError,
|
|
1861
1865
|
Qn as NoteCard,
|
|
1862
1866
|
ft as NoteChip,
|
|
@@ -1866,14 +1870,14 @@ export {
|
|
|
1866
1870
|
Hn as NotebookTranslationsProvider,
|
|
1867
1871
|
To as NotebookTray,
|
|
1868
1872
|
Co as NotesListView,
|
|
1869
|
-
|
|
1873
|
+
R as REACTION_TYPE,
|
|
1870
1874
|
xo as SingleNote,
|
|
1871
|
-
|
|
1875
|
+
Fe as createTransparentColor,
|
|
1872
1876
|
Vt as useCreateNote,
|
|
1873
1877
|
Zt as useDeleteNote,
|
|
1874
1878
|
rt as useGetNotes,
|
|
1875
1879
|
ct as useNotebook,
|
|
1876
|
-
|
|
1880
|
+
ee as useNotebookTranslations,
|
|
1877
1881
|
vo as useNotesData,
|
|
1878
1882
|
Io as useReactionFilter,
|
|
1879
1883
|
en as useUpdateNote
|