@instructure/platform-notebook 1.9.4 → 1.10.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/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { jsx as s, jsxs as S, Fragment as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsx as s, jsxs as S, Fragment as ze } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as qe, useMemo as he, useContext as Ke, useReducer as Xe, useRef as B, useEffect as z, useState as j, useCallback as q } from "react";
|
|
3
|
+
import { createPortal as ft } from "react-dom";
|
|
4
4
|
import { z as u } from "zod";
|
|
5
|
-
import
|
|
6
|
-
import { useQueryClient as we, useMutation as Oe, useQuery as
|
|
7
|
-
import { CloseButton as
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { Heading as Se } from "@instructure/ui-heading";
|
|
10
|
-
import { Tray as
|
|
11
|
-
import { View as X } from "@instructure/ui-view";
|
|
12
|
-
import { IconQuestionLine as Le, IconPinLine as Ae, IconWarningLine as
|
|
13
|
-
import { Menu as ue } from "@instructure/ui-menu";
|
|
14
|
-
import { TruncateText as Ee } from "@instructure/ui-truncate-text";
|
|
15
|
-
import { SimpleSelect as Be } from "@instructure/ui-simple-select";
|
|
16
|
-
import { Text as oe } from "@instructure/ui-text";
|
|
5
|
+
import mt from "diff-match-patch";
|
|
6
|
+
import { useQueryClient as we, useMutation as Oe, useQuery as gt } from "@tanstack/react-query";
|
|
7
|
+
import { CloseButton as ht, Button as re, IconButton as me } from "@instructure/ui-buttons/v11_7";
|
|
8
|
+
import { Flex as R } from "@instructure/ui-flex/v11_7";
|
|
9
|
+
import { Heading as Se } from "@instructure/ui-heading/v11_7";
|
|
10
|
+
import { Tray as pt } from "@instructure/ui-tray/v11_7";
|
|
11
|
+
import { View as X } from "@instructure/ui-view/v11_7";
|
|
12
|
+
import { IconQuestionLine as Le, IconPinLine as Ae, IconWarningLine as yt, IconNoteLine as bt, IconEditLine as Re, IconTrashLine as Te, IconArrowStartLine as Nt } from "@instructure/ui-icons";
|
|
13
|
+
import { Menu as ue } from "@instructure/ui-menu/v11_7";
|
|
14
|
+
import { TruncateText as Ee } from "@instructure/ui-truncate-text/v11_7";
|
|
15
|
+
import { SimpleSelect as Be } from "@instructure/ui-simple-select/v11_7";
|
|
16
|
+
import { Text as oe } from "@instructure/ui-text/v11_7";
|
|
17
17
|
import { ScreenReaderContent as pe } from "@instructure/ui-a11y-content";
|
|
18
|
-
import { Dialog as
|
|
19
|
-
import { TextArea as
|
|
20
|
-
import { Pill as $e } from "@instructure/ui-pill";
|
|
21
|
-
import { Pagination as
|
|
22
|
-
import { Spinner as
|
|
23
|
-
const
|
|
18
|
+
import { Dialog as Et } from "@instructure/ui-dialog";
|
|
19
|
+
import { TextArea as Qe } from "@instructure/ui-text-area/v11_7";
|
|
20
|
+
import { Pill as $e } from "@instructure/ui-pill/v11_7";
|
|
21
|
+
import { Pagination as Tt } from "@instructure/ui-pagination/v11_7";
|
|
22
|
+
import { Spinner as St } from "@instructure/ui-spinner/v11_7";
|
|
23
|
+
const vt = u.object({
|
|
24
24
|
startContainer: u.string(),
|
|
25
25
|
endContainer: u.string(),
|
|
26
26
|
startOffset: u.number(),
|
|
27
27
|
endOffset: u.number()
|
|
28
|
-
}),
|
|
28
|
+
}), It = u.object({
|
|
29
29
|
start: u.number(),
|
|
30
30
|
end: u.number()
|
|
31
31
|
}), De = u.object({
|
|
32
32
|
selectedText: u.string(),
|
|
33
33
|
hasNoHighlightAnymore: u.boolean().optional(),
|
|
34
|
-
textPosition:
|
|
35
|
-
range:
|
|
34
|
+
textPosition: It.nullable(),
|
|
35
|
+
range: vt.nullable(),
|
|
36
36
|
pageLastModifiedAt: u.string()
|
|
37
37
|
});
|
|
38
|
-
var
|
|
38
|
+
var k = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(k || {});
|
|
39
39
|
const Pe = u.enum([
|
|
40
40
|
"Important",
|
|
41
41
|
"Confusing"
|
|
42
42
|
/* CONFUSING */
|
|
43
|
-
]),
|
|
43
|
+
]), Ct = u.object({
|
|
44
44
|
totalCount: u.number().nullish(),
|
|
45
45
|
totalNrOfPages: u.number().nullish()
|
|
46
46
|
}), ve = u.object({
|
|
@@ -55,28 +55,28 @@ const Pe = u.enum([
|
|
|
55
55
|
highlightData: De,
|
|
56
56
|
createdAt: u.string(),
|
|
57
57
|
updatedAt: u.string()
|
|
58
|
-
}),
|
|
58
|
+
}), xt = u.object({
|
|
59
59
|
cursor: u.string(),
|
|
60
60
|
node: ve
|
|
61
61
|
});
|
|
62
62
|
u.object({
|
|
63
63
|
notes: u.object({
|
|
64
|
-
edges: u.array(
|
|
64
|
+
edges: u.array(xt),
|
|
65
65
|
nodes: u.array(ve),
|
|
66
|
-
pageInfo:
|
|
66
|
+
pageInfo: Ct
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
69
|
const Rt = u.object({
|
|
70
70
|
type: u.string(),
|
|
71
71
|
id: u.string()
|
|
72
|
-
}),
|
|
72
|
+
}), kt = u.object({
|
|
73
73
|
courseId: u.string().optional(),
|
|
74
74
|
learningObject: Rt.optional(),
|
|
75
75
|
reactions: u.array(u.string()).optional()
|
|
76
76
|
}).optional();
|
|
77
77
|
u.object({
|
|
78
78
|
courseId: u.string().optional(),
|
|
79
|
-
filter:
|
|
79
|
+
filter: kt,
|
|
80
80
|
offset: u.number().optional(),
|
|
81
81
|
pageSize: u.number().optional()
|
|
82
82
|
});
|
|
@@ -103,14 +103,14 @@ u.object({
|
|
|
103
103
|
u.object({
|
|
104
104
|
deleteNote: u.string()
|
|
105
105
|
});
|
|
106
|
-
var
|
|
106
|
+
var Ye = /* @__PURE__ */ ((t) => (t[t.FORWARDS = 1] = "FORWARDS", t[t.BACKWARDS = 2] = "BACKWARDS", t))(Ye || {});
|
|
107
107
|
class se {
|
|
108
108
|
constructor(e, n) {
|
|
109
109
|
this.start = e, this.end = n;
|
|
110
110
|
}
|
|
111
111
|
toRange() {
|
|
112
112
|
let e, n;
|
|
113
|
-
if (this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, n] =
|
|
113
|
+
if (this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, n] = Ze(this.start.element, this.start.offset, this.end.offset) : (e = this.start.resolve({
|
|
114
114
|
direction: 1
|
|
115
115
|
/* FORWARDS */
|
|
116
116
|
}), n = this.end.resolve({
|
|
@@ -138,12 +138,12 @@ class K {
|
|
|
138
138
|
}
|
|
139
139
|
resolve(e = {}) {
|
|
140
140
|
try {
|
|
141
|
-
return
|
|
141
|
+
return Ze(this.element, this.offset)[0];
|
|
142
142
|
} catch (n) {
|
|
143
143
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
144
144
|
const o = document.createTreeWalker(this.element.getRootNode(), NodeFilter.SHOW_TEXT);
|
|
145
145
|
o.currentNode = this.element;
|
|
146
|
-
const r = e.direction ===
|
|
146
|
+
const r = e.direction === Ye.FORWARDS, i = r ? o.nextNode() : o.previousNode();
|
|
147
147
|
if (!i)
|
|
148
148
|
throw n;
|
|
149
149
|
return { node: i, offset: r ? 0 : i.data.length };
|
|
@@ -168,7 +168,7 @@ class K {
|
|
|
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 =
|
|
171
|
+
const o = je(e) + n;
|
|
172
172
|
return new K(e.parentElement, o);
|
|
173
173
|
}
|
|
174
174
|
case Node.ELEMENT_NODE: {
|
|
@@ -176,7 +176,7 @@ class K {
|
|
|
176
176
|
return console.error("Child node offset is out of range"), null;
|
|
177
177
|
let o = 0;
|
|
178
178
|
for (let r = 0; r < n; r++)
|
|
179
|
-
o +=
|
|
179
|
+
o += Ve(e.childNodes[r]);
|
|
180
180
|
return new K(e, o);
|
|
181
181
|
}
|
|
182
182
|
default:
|
|
@@ -188,22 +188,22 @@ class K {
|
|
|
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 +=
|
|
191
|
+
o += je(n), n.parentElement && (n = n.parentElement);
|
|
192
192
|
return new K(n, o);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
const
|
|
195
|
+
const wt = (t) => {
|
|
196
196
|
const e = t.nodeName.toLowerCase();
|
|
197
197
|
return e === "#text" ? "text()" : e;
|
|
198
198
|
};
|
|
199
|
-
function
|
|
199
|
+
function Ot(t) {
|
|
200
200
|
let e = 0, n = t;
|
|
201
201
|
for (; n; )
|
|
202
202
|
n.nodeName === t.nodeName && (e += 1), n = n.previousSibling;
|
|
203
203
|
return e;
|
|
204
204
|
}
|
|
205
|
-
const
|
|
206
|
-
const e =
|
|
205
|
+
const Lt = (t) => {
|
|
206
|
+
const e = wt(t), n = Ot(t);
|
|
207
207
|
return `${e}[${n}]`;
|
|
208
208
|
}, He = (t, e) => {
|
|
209
209
|
let n = "", o = t;
|
|
@@ -212,10 +212,10 @@ const At = (t) => {
|
|
|
212
212
|
console.error("Node is not a descendant of root");
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
|
-
n = `${
|
|
215
|
+
n = `${Lt(o)}/${n}`, o = o.parentNode;
|
|
216
216
|
}
|
|
217
217
|
return n = `/${n}`, n = n.replace(/\/$/, ""), n;
|
|
218
|
-
},
|
|
218
|
+
}, At = (t, e, n) => {
|
|
219
219
|
const o = e.toUpperCase();
|
|
220
220
|
let r = -1;
|
|
221
221
|
for (let i = 0; i < t.children.length; i++) {
|
|
@@ -224,7 +224,7 @@ const At = (t) => {
|
|
|
224
224
|
return l;
|
|
225
225
|
}
|
|
226
226
|
return null;
|
|
227
|
-
},
|
|
227
|
+
}, Dt = (t, e) => {
|
|
228
228
|
if (!(t.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+])?)+$/) !== null))
|
|
229
229
|
return console.error("Expression is not a simple XPath"), null;
|
|
230
230
|
const o = t.split("/");
|
|
@@ -232,15 +232,15 @@ const At = (t) => {
|
|
|
232
232
|
o.shift();
|
|
233
233
|
for (const i of o) {
|
|
234
234
|
let l, a;
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
l = i.slice(0,
|
|
238
|
-
const y = i.slice(
|
|
235
|
+
const f = i.indexOf("[");
|
|
236
|
+
if (f !== -1) {
|
|
237
|
+
l = i.slice(0, f);
|
|
238
|
+
const y = i.slice(f + 1, i.indexOf("]"));
|
|
239
239
|
if (a = Number.parseInt(y, 10) - 1, a < 0)
|
|
240
240
|
return null;
|
|
241
241
|
} else
|
|
242
242
|
l = i, a = 0;
|
|
243
|
-
const c =
|
|
243
|
+
const c = At(r, l, a);
|
|
244
244
|
if (!c)
|
|
245
245
|
return null;
|
|
246
246
|
r = c;
|
|
@@ -248,7 +248,7 @@ const At = (t) => {
|
|
|
248
248
|
return r;
|
|
249
249
|
}, Ue = (t, e = document.body) => {
|
|
250
250
|
try {
|
|
251
|
-
return
|
|
251
|
+
return Dt(t, e);
|
|
252
252
|
} catch {
|
|
253
253
|
return document.evaluate(`.${t}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
254
254
|
}
|
|
@@ -311,7 +311,7 @@ class le {
|
|
|
311
311
|
return se.fromOffsets(this.root, this.start, this.end).toRange();
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
const
|
|
314
|
+
const Ve = (t) => {
|
|
315
315
|
var e;
|
|
316
316
|
switch (t.nodeType) {
|
|
317
317
|
case Node.ELEMENT_NODE:
|
|
@@ -320,12 +320,12 @@ const Ze = (t) => {
|
|
|
320
320
|
default:
|
|
321
321
|
return 0;
|
|
322
322
|
}
|
|
323
|
-
},
|
|
323
|
+
}, je = (t) => {
|
|
324
324
|
let e = t.previousSibling, n = 0;
|
|
325
325
|
for (; e; )
|
|
326
|
-
n +=
|
|
326
|
+
n += Ve(e), e = e.previousSibling;
|
|
327
327
|
return n;
|
|
328
|
-
},
|
|
328
|
+
}, Ze = (t, ...e) => {
|
|
329
329
|
let n = e.shift();
|
|
330
330
|
const o = t.ownerDocument.createNodeIterator(t, NodeFilter.SHOW_TEXT), r = [];
|
|
331
331
|
let i = o.nextNode(), l = null, a = 0;
|
|
@@ -334,28 +334,28 @@ const Ze = (t) => {
|
|
|
334
334
|
for (; n !== void 0 && l && a === n; )
|
|
335
335
|
r.push({ node: l, offset: l.data.length }), n = e.shift();
|
|
336
336
|
return n !== void 0 && console.error("Offset exceeds text length"), r;
|
|
337
|
-
},
|
|
337
|
+
}, Pt = (t, e, n, o) => {
|
|
338
338
|
const r = n - e;
|
|
339
339
|
return Math.abs(r - o) <= 5 ? le.fromSelector(t, {
|
|
340
340
|
start: e,
|
|
341
341
|
end: n
|
|
342
342
|
}) : null;
|
|
343
|
-
},
|
|
344
|
-
const r = new
|
|
343
|
+
}, _t = (t, e, n, o) => {
|
|
344
|
+
const r = new mt();
|
|
345
345
|
r.Match_Distance = 5e3;
|
|
346
346
|
const i = t.textContent;
|
|
347
347
|
if (!i)
|
|
348
348
|
return null;
|
|
349
349
|
if (e.length > 32) {
|
|
350
|
-
const l = e.slice(0, 32), a = e.slice(-32),
|
|
350
|
+
const l = e.slice(0, 32), a = e.slice(-32), f = o - n;
|
|
351
351
|
let c = r.match_main(i, l, n);
|
|
352
352
|
const y = r.match_main(i, a, o), d = y + a.length;
|
|
353
353
|
if (c === -1 || y === -1)
|
|
354
354
|
return null;
|
|
355
|
-
const h = d - c,
|
|
356
|
-
if ((c > d ||
|
|
357
|
-
return
|
|
358
|
-
if (c < d &&
|
|
355
|
+
const h = d - c, N = Math.abs(h - f);
|
|
356
|
+
if ((c > d || N > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(i, l, d), c !== -1 && c < d))
|
|
357
|
+
return Pt(t, c, d, f);
|
|
358
|
+
if (c < d && N <= 5)
|
|
359
359
|
return le.fromSelector(t, {
|
|
360
360
|
start: c,
|
|
361
361
|
end: d
|
|
@@ -369,21 +369,21 @@ const Ze = (t) => {
|
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
371
|
return null;
|
|
372
|
-
},
|
|
372
|
+
}, Ft = (t, e) => {
|
|
373
373
|
if (!e) return null;
|
|
374
374
|
const { highlightData: n } = t, { textPosition: o, selectedText: r } = n;
|
|
375
|
-
return
|
|
375
|
+
return _t(
|
|
376
376
|
e,
|
|
377
377
|
r,
|
|
378
378
|
(o == null ? void 0 : o.start) ?? 0,
|
|
379
379
|
(o == null ? void 0 : o.end) ?? 0
|
|
380
380
|
);
|
|
381
|
-
},
|
|
381
|
+
}, Mt = (t, e, n) => {
|
|
382
382
|
const o = [], r = [];
|
|
383
383
|
for (const i of e) {
|
|
384
|
-
const l =
|
|
384
|
+
const l = Ft(i, t);
|
|
385
385
|
if (l) {
|
|
386
|
-
const a = l.toRange(),
|
|
386
|
+
const a = l.toRange(), f = 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,
|
|
@@ -392,7 +392,7 @@ const Ze = (t) => {
|
|
|
392
392
|
...i.highlightData,
|
|
393
393
|
selectedText: c,
|
|
394
394
|
hasNoHighlightAnymore: !1,
|
|
395
|
-
range: (
|
|
395
|
+
range: (f == null ? void 0 : f.toSelector()) ?? null,
|
|
396
396
|
textPosition: l.toSelector(),
|
|
397
397
|
pageLastModifiedAt: n
|
|
398
398
|
}
|
|
@@ -410,12 +410,12 @@ const Ze = (t) => {
|
|
|
410
410
|
}) : r.push(i.id);
|
|
411
411
|
}
|
|
412
412
|
return { notesForUpdate: o, noteIdsForDelete: r };
|
|
413
|
-
},
|
|
413
|
+
}, Ge = (t, e) => {
|
|
414
414
|
var l;
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: n, id: o } = t, { range: r } = n ?? {};
|
|
417
|
-
r && ((l = ae.fromSelector(e, r)) == null ? void 0 : l.toRange()) &&
|
|
418
|
-
},
|
|
417
|
+
r && ((l = ae.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Qt({ id: o });
|
|
418
|
+
}, Bt = (t) => {
|
|
419
419
|
const n = document.querySelector(
|
|
420
420
|
`[data-highlight-id="${CSS.escape(t)}"].highlight-content`
|
|
421
421
|
) ?? document.getElementById(Ie(t));
|
|
@@ -423,50 +423,50 @@ const Ze = (t) => {
|
|
|
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
|
-
}, ye = 90,
|
|
426
|
+
}, ye = 90, be = 172, $t = (t) => {
|
|
427
427
|
const e = t.getClientRects();
|
|
428
428
|
if (!e.length)
|
|
429
429
|
return null;
|
|
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,
|
|
431
|
-
const E = p +
|
|
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, f = (p) => {
|
|
431
|
+
const E = p + be;
|
|
432
432
|
return p >= i && E <= l - i;
|
|
433
433
|
}, c = (p) => {
|
|
434
434
|
const E = p + ye;
|
|
435
435
|
return p >= i && E <= a - i;
|
|
436
436
|
};
|
|
437
437
|
let y;
|
|
438
|
-
const d = n.right -
|
|
439
|
-
if (
|
|
438
|
+
const d = n.right - be;
|
|
439
|
+
if (f(d))
|
|
440
440
|
y = d;
|
|
441
441
|
else {
|
|
442
442
|
const p = n.left;
|
|
443
|
-
if (
|
|
443
|
+
if (f(p))
|
|
444
444
|
y = p;
|
|
445
445
|
else {
|
|
446
|
-
const g = (n.left + n.right) / 2 -
|
|
447
|
-
|
|
446
|
+
const g = (n.left + n.right) / 2 - be / 2;
|
|
447
|
+
f(g) ? y = g : d < i ? y = i : y = l - be - i;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
let h;
|
|
451
|
-
const
|
|
452
|
-
if (c(
|
|
453
|
-
h =
|
|
451
|
+
const N = o.bottom + r;
|
|
452
|
+
if (c(N))
|
|
453
|
+
h = N;
|
|
454
454
|
else {
|
|
455
455
|
const p = n.top - ye - r;
|
|
456
|
-
c(p) ? h = p :
|
|
456
|
+
c(p) ? h = p : N + ye > a - i ? h = a - ye - i : h = i;
|
|
457
457
|
}
|
|
458
458
|
return { top: h, left: y };
|
|
459
|
-
},
|
|
459
|
+
}, Ht = (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
|
-
}, _e = (t) => `highlight-wrapper-${t}`, Ie = (t) => `${_e(t)}-start`,
|
|
464
|
+
}, _e = (t) => `highlight-wrapper-${t}`, Ie = (t) => `${_e(t)}-start`, Je = (t) => `${_e(t)}-end`, ge = (t) => `[data-highlight-id="${CSS.escape(t)}"]`, Ut = "2px", jt = "3px", Gt = "1px", et = "3px", Wt = "1px", tt = "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
|
-
},
|
|
468
|
-
t.style.backgroundColor = n, t.style.textDecorationColor = o, t.style.textDecorationStyle = r, e ? (t.dataset.selected = "true", t.style.outline = `${
|
|
469
|
-
},
|
|
467
|
+
}, nt = (t, e, n, o, r) => {
|
|
468
|
+
t.style.backgroundColor = n, t.style.textDecorationColor = o, t.style.textDecorationStyle = r, e ? (t.dataset.selected = "true", t.style.outline = `${Gt} ${r} ${o}`, t.style.outlineOffset = Wt, t.style.borderRadius = et, t.style.fontWeight = "bold") : (t.removeAttribute("data-selected"), t.style.outline = "", t.style.outlineOffset = "", t.style.borderRadius = "", t.style.fontWeight = "");
|
|
469
|
+
}, zt = (t, e) => {
|
|
470
470
|
var n;
|
|
471
471
|
try {
|
|
472
472
|
const o = ((n = e.nodeValue) == null ? void 0 : n.length) ?? e.childNodes.length;
|
|
@@ -474,7 +474,7 @@ const Ze = (t) => {
|
|
|
474
474
|
} catch {
|
|
475
475
|
return !1;
|
|
476
476
|
}
|
|
477
|
-
},
|
|
477
|
+
}, qt = (t) => {
|
|
478
478
|
var i;
|
|
479
479
|
if (t.collapsed)
|
|
480
480
|
return [];
|
|
@@ -484,7 +484,7 @@ const Ze = (t) => {
|
|
|
484
484
|
const n = [], o = (i = e == null ? void 0 : e.ownerDocument) == null ? void 0 : i.createNodeIterator(e, NodeFilter.SHOW_TEXT);
|
|
485
485
|
let r = (o == null ? void 0 : o.nextNode()) || null;
|
|
486
486
|
for (; r; ) {
|
|
487
|
-
if (!
|
|
487
|
+
if (!zt(t, r)) {
|
|
488
488
|
r = (o == null ? void 0 : o.nextNode()) || null;
|
|
489
489
|
continue;
|
|
490
490
|
}
|
|
@@ -496,51 +496,51 @@ const Ze = (t) => {
|
|
|
496
496
|
l === t.endContainer && t.endOffset < l.data.length && l.splitText(t.endOffset), n.push(l), r = (o == null ? void 0 : o.nextNode()) || null;
|
|
497
497
|
}
|
|
498
498
|
return n;
|
|
499
|
-
},
|
|
499
|
+
}, Kt = (t, e, n) => {
|
|
500
500
|
if (t.collapsed) return;
|
|
501
501
|
const o = e.id ?? "", r = _e(o);
|
|
502
502
|
if (document.getElementById(Ie(o))) {
|
|
503
|
-
|
|
503
|
+
Xt(e, n);
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
|
-
const l = e.type ===
|
|
506
|
+
const l = e.type === k.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, f = a ? l : Fe(l, 0.5), c = e.type === k.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, y = e.type === k.IMPORTANT ? "solid" : "dashed", d = document.createElement("span");
|
|
507
507
|
d.id = `${r}-start`, d.className = "highlight-marker-start", d.dataset.highlightId = o || "";
|
|
508
|
-
const h = e.labelPrefix ??
|
|
508
|
+
const h = e.labelPrefix ?? tt;
|
|
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";
|
|
510
|
-
const
|
|
511
|
-
|
|
510
|
+
const N = document.createElement("span");
|
|
511
|
+
N.id = Je(o), N.className = "highlight-marker-end", N.dataset.highlightId = o || "";
|
|
512
512
|
const p = t.cloneRange();
|
|
513
|
-
p.collapse(!1), p.insertNode(
|
|
513
|
+
p.collapse(!1), p.insertNode(N);
|
|
514
514
|
const E = t.cloneRange();
|
|
515
515
|
E.collapse(!0), E.insertNode(d);
|
|
516
516
|
const g = document.createRange();
|
|
517
|
-
g.setStartAfter(d), g.setEndBefore(
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
var
|
|
521
|
-
const
|
|
522
|
-
if ((
|
|
523
|
-
const
|
|
517
|
+
g.setStartAfter(d), g.setEndBefore(N);
|
|
518
|
+
const G = qt(g).filter((b) => b.textContent && b.textContent.length > 0);
|
|
519
|
+
G.forEach((b, C) => {
|
|
520
|
+
var F;
|
|
521
|
+
const A = b.parentElement;
|
|
522
|
+
if ((A == null ? void 0 : A.dataset.highlightId) === o) return;
|
|
523
|
+
const $ = C === 0, D = C === G.length - 1, T = G.length === 1;
|
|
524
524
|
let O;
|
|
525
|
-
T ? O = "single" :
|
|
525
|
+
T ? O = "single" : $ ? O = "first" : D ? O = "last" : O = "middle";
|
|
526
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",
|
|
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", nt(x, a, f, c, y), x.addEventListener("click", (V) => {
|
|
528
528
|
var Z;
|
|
529
529
|
V.target.tagName !== "A" && ((Z = e.onClick) == null || Z.call(e));
|
|
530
|
-
}), (
|
|
531
|
-
}), d.addEventListener("click", (
|
|
530
|
+
}), (F = b.parentNode) == null || F.insertBefore(x, b), x.appendChild(b);
|
|
531
|
+
}), d.addEventListener("click", (b) => {
|
|
532
532
|
var C;
|
|
533
|
-
|
|
534
|
-
}), d.addEventListener("keydown", (
|
|
533
|
+
b.target.tagName !== "A" && ((C = e.onClick) == null || C.call(e));
|
|
534
|
+
}), d.addEventListener("keydown", (b) => {
|
|
535
535
|
var C;
|
|
536
|
-
if (
|
|
537
|
-
|
|
538
|
-
else if (
|
|
539
|
-
const
|
|
540
|
-
for (const
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
543
|
-
|
|
536
|
+
if (b.key === "Enter" || b.key === " ")
|
|
537
|
+
b.preventDefault(), (C = e.onClick) == null || C.call(e);
|
|
538
|
+
else if (b.key === "Tab" && !b.shiftKey) {
|
|
539
|
+
const A = document.querySelectorAll(ge(o));
|
|
540
|
+
for (const $ of A) {
|
|
541
|
+
const D = $.querySelector("a");
|
|
542
|
+
if (D) {
|
|
543
|
+
b.preventDefault(), D.focus();
|
|
544
544
|
break;
|
|
545
545
|
}
|
|
546
546
|
}
|
|
@@ -549,30 +549,30 @@ const Ze = (t) => {
|
|
|
549
549
|
document.querySelectorAll(
|
|
550
550
|
`.highlight-content${ge(o)}`
|
|
551
551
|
).forEach((C) => {
|
|
552
|
-
C.style.boxShadow = `0 0 0 ${
|
|
552
|
+
C.style.boxShadow = `0 0 0 ${Ut} ${n.colors.focusOutline}`, C.style.borderRadius = jt;
|
|
553
553
|
});
|
|
554
554
|
}), d.addEventListener("blur", () => {
|
|
555
555
|
document.querySelectorAll(
|
|
556
556
|
`.highlight-content${ge(o)}`
|
|
557
557
|
).forEach((C) => {
|
|
558
|
-
C.style.boxShadow = "", C.style.borderRadius = C.dataset.selected ?
|
|
558
|
+
C.style.boxShadow = "", C.style.borderRadius = C.dataset.selected ? et : "";
|
|
559
559
|
});
|
|
560
560
|
});
|
|
561
561
|
};
|
|
562
|
-
function
|
|
563
|
-
const n = t.type ===
|
|
562
|
+
function Xt(t, e) {
|
|
563
|
+
const n = t.type === k.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, o = t.id === t.selectedNoteId, r = o ? n : Fe(n, 0.5), i = t.type === k.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline, l = t.type === k.IMPORTANT ? "solid" : "dashed";
|
|
564
564
|
document.querySelectorAll(
|
|
565
565
|
`.highlight-content${ge(t.id ?? "")}`
|
|
566
566
|
).forEach((c) => {
|
|
567
|
-
|
|
567
|
+
nt(c, o, r, i, l);
|
|
568
568
|
});
|
|
569
|
-
const
|
|
569
|
+
const f = document.getElementById(
|
|
570
570
|
Ie(t.id ?? "")
|
|
571
571
|
);
|
|
572
|
-
|
|
572
|
+
f && (f.setAttribute("aria-label", t.labelPrefix ?? tt), f.setAttribute("aria-expanded", String(o && !!t.isTrayOpen)), o ? f.setAttribute("aria-current", "true") : f.removeAttribute("aria-current"));
|
|
573
573
|
}
|
|
574
|
-
const
|
|
575
|
-
const e = t.id ?? "", n = document.getElementById(Ie(e)), o = document.getElementById(
|
|
574
|
+
const Qt = (t) => {
|
|
575
|
+
const e = t.id ?? "", n = document.getElementById(Ie(e)), o = document.getElementById(Je(e));
|
|
576
576
|
document.querySelectorAll(
|
|
577
577
|
ge(e)
|
|
578
578
|
).forEach((i) => {
|
|
@@ -585,7 +585,7 @@ const Yt = (t) => {
|
|
|
585
585
|
all: ["notebook"],
|
|
586
586
|
notes: (t) => ["notebook", "notes", t]
|
|
587
587
|
};
|
|
588
|
-
function
|
|
588
|
+
function Yt(t) {
|
|
589
589
|
const e = we();
|
|
590
590
|
return Oe({
|
|
591
591
|
mutationFn: (n) => t.createNote(n),
|
|
@@ -594,7 +594,7 @@ function Vt(t) {
|
|
|
594
594
|
}
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function Vt(t) {
|
|
598
598
|
const e = we();
|
|
599
599
|
return Oe({
|
|
600
600
|
mutationFn: (n) => t.deleteNote(n),
|
|
@@ -603,26 +603,26 @@ function Zt(t) {
|
|
|
603
603
|
}
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function ot({
|
|
607
607
|
api: t,
|
|
608
608
|
enabled: e = !0,
|
|
609
609
|
...n
|
|
610
610
|
}) {
|
|
611
|
-
return
|
|
611
|
+
return gt({
|
|
612
612
|
queryKey: fe.notes(n),
|
|
613
613
|
queryFn: () => t.getNotes(n),
|
|
614
614
|
enabled: e
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
|
-
const
|
|
618
|
-
function
|
|
617
|
+
const Zt = 100;
|
|
618
|
+
function rt({
|
|
619
619
|
api: t,
|
|
620
620
|
courseId: e,
|
|
621
621
|
learningObject: n,
|
|
622
622
|
reactions: o,
|
|
623
623
|
enabled: r = !0
|
|
624
624
|
}) {
|
|
625
|
-
return
|
|
625
|
+
return ot({
|
|
626
626
|
api: t,
|
|
627
627
|
filter: {
|
|
628
628
|
...e ? { courseId: e } : {},
|
|
@@ -630,11 +630,11 @@ function st({
|
|
|
630
630
|
...o != null && o.length ? { reactions: o } : {}
|
|
631
631
|
},
|
|
632
632
|
offset: 0,
|
|
633
|
-
pageSize:
|
|
633
|
+
pageSize: Zt,
|
|
634
634
|
enabled: r
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
|
-
function
|
|
637
|
+
function Jt(t) {
|
|
638
638
|
const e = we();
|
|
639
639
|
return Oe({
|
|
640
640
|
mutationFn: ({ id: n, input: o }) => t.updateNote(n, o),
|
|
@@ -642,10 +642,10 @@ function en(t) {
|
|
|
642
642
|
await e.cancelQueries({ queryKey: fe.all });
|
|
643
643
|
const i = e.getQueryCache().findAll({ queryKey: fe.all }), l = /* @__PURE__ */ new Map();
|
|
644
644
|
for (const a of i) {
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
...
|
|
648
|
-
notes:
|
|
645
|
+
const f = a.state.data;
|
|
646
|
+
f && (l.set(a.queryKey, f), e.setQueryData(a.queryKey, {
|
|
647
|
+
...f,
|
|
648
|
+
notes: f.notes.map(
|
|
649
649
|
(c) => c.id === n ? { ...c, ...o, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } : c
|
|
650
650
|
)
|
|
651
651
|
}));
|
|
@@ -662,51 +662,51 @@ function en(t) {
|
|
|
662
662
|
}
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
|
-
const
|
|
666
|
-
notebook:
|
|
667
|
-
notes:
|
|
668
|
-
important:
|
|
669
|
-
unclear:
|
|
670
|
-
back:
|
|
671
|
-
editNote:
|
|
672
|
-
save:
|
|
673
|
-
cancel:
|
|
674
|
-
deleteNote:
|
|
675
|
-
deleteNoteConfirmation:
|
|
676
|
-
note:
|
|
677
|
-
addNotePrompt:
|
|
678
|
-
removeFromNotebook:
|
|
679
|
-
addNoteOptional:
|
|
680
|
-
markImportant:
|
|
681
|
-
markUnclear:
|
|
682
|
-
savedToNotebook:
|
|
665
|
+
const en = "Notebook", tn = "Notes", nn = "Important", on = "Unclear", rn = "Back", sn = "Edit note", ln = "Save", an = "Cancel", cn = "Delete note", dn = "Delete note confirmation", un = "note", fn = "Add note (optional)", mn = "Remove from Notebook", gn = "Add a note (optional)", hn = "Mark important", pn = "Mark unclear", yn = "Saved to Notebook.", bn = "Note updated", Nn = "Note deleted", En = "Error saving to Notebook.", Tn = "Error updating note", Sn = "Note deletion failed", vn = "Loading notes", In = "Failed to load notes", Cn = "Start capturing your notes", xn = "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", kn = "Adjust your filters or create a new note to get started.", wn = "You have no notes for the selected filter", On = "Filter", Ln = "Previous page", An = "Next page", Dn = "All courses", Pn = "All notes", _n = "Close Notebook panel", Fn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", Mn = "The content you highlighted is no longer available.", Bn = "Notebook note", Me = {
|
|
666
|
+
notebook: en,
|
|
667
|
+
notes: tn,
|
|
668
|
+
important: nn,
|
|
669
|
+
unclear: on,
|
|
670
|
+
back: rn,
|
|
671
|
+
editNote: sn,
|
|
672
|
+
save: ln,
|
|
673
|
+
cancel: an,
|
|
674
|
+
deleteNote: cn,
|
|
675
|
+
deleteNoteConfirmation: dn,
|
|
676
|
+
note: un,
|
|
677
|
+
addNotePrompt: fn,
|
|
678
|
+
removeFromNotebook: mn,
|
|
679
|
+
addNoteOptional: gn,
|
|
680
|
+
markImportant: hn,
|
|
681
|
+
markUnclear: pn,
|
|
682
|
+
savedToNotebook: yn,
|
|
683
683
|
noteUpdated: bn,
|
|
684
|
-
noteDeleted:
|
|
685
|
-
errorSavingNote:
|
|
686
|
-
errorUpdatingNote:
|
|
687
|
-
noteDeletionFailed:
|
|
688
|
-
loadingNotes:
|
|
689
|
-
failedToLoadNotes:
|
|
690
|
-
emptyStateHeading:
|
|
691
|
-
emptyStateDescription:
|
|
684
|
+
noteDeleted: Nn,
|
|
685
|
+
errorSavingNote: En,
|
|
686
|
+
errorUpdatingNote: Tn,
|
|
687
|
+
noteDeletionFailed: Sn,
|
|
688
|
+
loadingNotes: vn,
|
|
689
|
+
failedToLoadNotes: In,
|
|
690
|
+
emptyStateHeading: Cn,
|
|
691
|
+
emptyStateDescription: xn,
|
|
692
692
|
nothingHereYet: Rn,
|
|
693
|
-
adjustFiltersOrCreate:
|
|
694
|
-
noNotesForFilter:
|
|
695
|
-
filter:
|
|
696
|
-
previousPage:
|
|
697
|
-
nextPage:
|
|
698
|
-
allCourses:
|
|
699
|
-
allNotes:
|
|
700
|
-
closeNotebookPanel:
|
|
701
|
-
featureDescription:
|
|
702
|
-
highlightUnavailable:
|
|
703
|
-
notebookNote:
|
|
704
|
-
},
|
|
705
|
-
function
|
|
693
|
+
adjustFiltersOrCreate: kn,
|
|
694
|
+
noNotesForFilter: wn,
|
|
695
|
+
filter: On,
|
|
696
|
+
previousPage: Ln,
|
|
697
|
+
nextPage: An,
|
|
698
|
+
allCourses: Dn,
|
|
699
|
+
allNotes: Pn,
|
|
700
|
+
closeNotebookPanel: _n,
|
|
701
|
+
featureDescription: Fn,
|
|
702
|
+
highlightUnavailable: Mn,
|
|
703
|
+
notebookNote: Bn
|
|
704
|
+
}, st = qe(null);
|
|
705
|
+
function it(t, e) {
|
|
706
706
|
const n = Me[t] ?? t;
|
|
707
707
|
return e ? n.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : n;
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function $n({
|
|
710
710
|
translations: t,
|
|
711
711
|
translate: e,
|
|
712
712
|
children: n
|
|
@@ -717,20 +717,20 @@ function Hn({
|
|
|
717
717
|
return (t == null ? void 0 : t[l]) ?? i[l];
|
|
718
718
|
}
|
|
719
719
|
}),
|
|
720
|
-
translate: e ??
|
|
720
|
+
translate: e ?? it
|
|
721
721
|
}), [t, e]);
|
|
722
|
-
return /* @__PURE__ */ s(
|
|
722
|
+
return /* @__PURE__ */ s(st.Provider, { value: o, children: n });
|
|
723
723
|
}
|
|
724
724
|
function ee() {
|
|
725
|
-
const t =
|
|
726
|
-
return t || { translations: Me, translate:
|
|
725
|
+
const t = Ke(st);
|
|
726
|
+
return t || { translations: Me, translate: it };
|
|
727
727
|
}
|
|
728
|
-
const
|
|
728
|
+
const Hn = (t) => ({
|
|
729
729
|
selectedNoteId: t ?? null,
|
|
730
730
|
isNoteEditing: !1,
|
|
731
731
|
isTrayOpen: t != null
|
|
732
732
|
});
|
|
733
|
-
function
|
|
733
|
+
function Un(t, e) {
|
|
734
734
|
switch (e.type) {
|
|
735
735
|
case "SELECT_NOTE":
|
|
736
736
|
return {
|
|
@@ -750,8 +750,8 @@ function Gn(t, e) {
|
|
|
750
750
|
return t;
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
|
-
const
|
|
754
|
-
function
|
|
753
|
+
const lt = qe(null);
|
|
754
|
+
function No({
|
|
755
755
|
api: t,
|
|
756
756
|
currentUserId: e,
|
|
757
757
|
objectId: n,
|
|
@@ -760,11 +760,11 @@ function Eo({
|
|
|
760
760
|
pageLastModifiedAt: i,
|
|
761
761
|
onOpen: l,
|
|
762
762
|
initialNoteId: a,
|
|
763
|
-
translations:
|
|
763
|
+
translations: f,
|
|
764
764
|
translate: c,
|
|
765
765
|
children: y
|
|
766
766
|
}) {
|
|
767
|
-
const [d, h] =
|
|
767
|
+
const [d, h] = Xe(Un, Hn(a)), N = B(a != null), p = he(
|
|
768
768
|
() => ({
|
|
769
769
|
api: t,
|
|
770
770
|
currentUserId: e,
|
|
@@ -777,37 +777,37 @@ function Eo({
|
|
|
777
777
|
clearSelectedNote: () => h({ type: "CLEAR_SELECTED_NOTE" }),
|
|
778
778
|
setEditing: (E) => h({ type: "SET_EDITING", payload: E }),
|
|
779
779
|
openTray: () => {
|
|
780
|
-
|
|
780
|
+
N.current || (N.current = !0, l == null || l()), h({ type: "OPEN_TRAY" });
|
|
781
781
|
},
|
|
782
782
|
closeTray: () => {
|
|
783
|
-
|
|
783
|
+
N.current = !1, h({ type: "CLOSE_TRAY" });
|
|
784
784
|
}
|
|
785
785
|
}),
|
|
786
786
|
[t, e, n, o, r, i, l, d]
|
|
787
787
|
);
|
|
788
|
-
return /* @__PURE__ */ s(
|
|
788
|
+
return /* @__PURE__ */ s(lt.Provider, { value: p, children: /* @__PURE__ */ s($n, { translations: f, translate: c, children: y }) });
|
|
789
789
|
}
|
|
790
|
-
function
|
|
791
|
-
const t =
|
|
790
|
+
function at() {
|
|
791
|
+
const t = Ke(lt);
|
|
792
792
|
if (!t)
|
|
793
793
|
throw new Error("useNotebook must be used within a NotebookProvider");
|
|
794
794
|
return t;
|
|
795
795
|
}
|
|
796
|
-
const
|
|
797
|
-
const { isTrayOpen: e, closeTray: n } =
|
|
796
|
+
const ct = "notebook-tray-content", Eo = ({ children: t }) => {
|
|
797
|
+
const { isTrayOpen: e, closeTray: n } = at(), { translations: o } = ee();
|
|
798
798
|
return /* @__PURE__ */ s(
|
|
799
|
-
|
|
799
|
+
pt,
|
|
800
800
|
{
|
|
801
801
|
label: o.notebook,
|
|
802
802
|
open: e,
|
|
803
803
|
onDismiss: n,
|
|
804
804
|
placement: "end",
|
|
805
805
|
size: "regular",
|
|
806
|
-
children: /* @__PURE__ */ S(
|
|
807
|
-
/* @__PURE__ */ s(
|
|
806
|
+
children: /* @__PURE__ */ S(R, { direction: "column", height: "100vh", id: ct, children: [
|
|
807
|
+
/* @__PURE__ */ s(R.Item, { children: /* @__PURE__ */ s(X, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ S(R, { justifyItems: "space-between", alignItems: "center", children: [
|
|
808
808
|
/* @__PURE__ */ s(Se, { level: "h3", children: o.notebook }),
|
|
809
809
|
/* @__PURE__ */ s(
|
|
810
|
-
|
|
810
|
+
ht,
|
|
811
811
|
{
|
|
812
812
|
screenReaderLabel: o.closeNotebookPanel,
|
|
813
813
|
onClick: n,
|
|
@@ -816,14 +816,14 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
816
816
|
}
|
|
817
817
|
)
|
|
818
818
|
] }) }) }),
|
|
819
|
-
/* @__PURE__ */ s(
|
|
819
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
|
|
820
820
|
] })
|
|
821
821
|
}
|
|
822
822
|
);
|
|
823
823
|
}, jn = ({ currentType: t, onSelectReaction: e }) => {
|
|
824
|
-
const { translations: n } = ee(), o =
|
|
824
|
+
const { translations: n } = ee(), o = B(null), r = B(null);
|
|
825
825
|
return z(() => {
|
|
826
|
-
t ===
|
|
826
|
+
t === k.CONFUSING && o.current ? o.current.focus() : t === k.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
|
|
827
827
|
}, [t]), /* @__PURE__ */ s(
|
|
828
828
|
X,
|
|
829
829
|
{
|
|
@@ -838,7 +838,7 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
838
838
|
ue.Item,
|
|
839
839
|
{
|
|
840
840
|
ref: o,
|
|
841
|
-
onClick: () => e(
|
|
841
|
+
onClick: () => e(k.CONFUSING),
|
|
842
842
|
children: [
|
|
843
843
|
/* @__PURE__ */ s(Le, { size: "x-small" }),
|
|
844
844
|
` ${n.markUnclear}`
|
|
@@ -849,7 +849,7 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
849
849
|
ue.Item,
|
|
850
850
|
{
|
|
851
851
|
ref: r,
|
|
852
|
-
onClick: () => e(
|
|
852
|
+
onClick: () => e(k.IMPORTANT),
|
|
853
853
|
children: [
|
|
854
854
|
/* @__PURE__ */ s(Ae, { size: "x-small" }),
|
|
855
855
|
` ${n.markImportant}`
|
|
@@ -860,7 +860,7 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
860
860
|
}
|
|
861
861
|
);
|
|
862
862
|
}, Ce = "notebook-inline-reaction-menu";
|
|
863
|
-
function
|
|
863
|
+
function To({
|
|
864
864
|
containerRef: t,
|
|
865
865
|
highlightTheme: e,
|
|
866
866
|
debounceTime: n = 500,
|
|
@@ -871,19 +871,19 @@ function So({
|
|
|
871
871
|
}) {
|
|
872
872
|
const {
|
|
873
873
|
api: a,
|
|
874
|
-
objectId:
|
|
874
|
+
objectId: f,
|
|
875
875
|
objectType: c,
|
|
876
876
|
courseId: y,
|
|
877
877
|
pageLastModifiedAt: d,
|
|
878
878
|
selectedNoteId: h,
|
|
879
|
-
isTrayOpen:
|
|
879
|
+
isTrayOpen: N,
|
|
880
880
|
selectNote: p,
|
|
881
881
|
openTray: E
|
|
882
|
-
} =
|
|
882
|
+
} = at(), { translations: g } = ee(), { data: Q } = rt({
|
|
883
883
|
api: a,
|
|
884
884
|
courseId: y,
|
|
885
|
-
learningObject: { type: c, id:
|
|
886
|
-
}), { mutate:
|
|
885
|
+
learningObject: { type: c, id: f }
|
|
886
|
+
}), { mutate: G } = Yt(a), { mutateAsync: b } = Jt(a), { mutate: C } = Vt(a), A = B([]), [$, D] = j([]), [T, O] = j(null), [x, F] = j(""), [V, Z] = j(null), ce = B(null);
|
|
887
887
|
ce.current = V;
|
|
888
888
|
const [J, de] = j(!1);
|
|
889
889
|
z(() => {
|
|
@@ -894,99 +894,99 @@ function So({
|
|
|
894
894
|
de(!0);
|
|
895
895
|
return;
|
|
896
896
|
}
|
|
897
|
-
const
|
|
898
|
-
for (const
|
|
899
|
-
if (
|
|
900
|
-
de(!0),
|
|
897
|
+
const _ = new MutationObserver((L) => {
|
|
898
|
+
for (const U of L)
|
|
899
|
+
if (U.type === "attributes" && U.attributeName === "class" && U.target.classList.contains("enhanced")) {
|
|
900
|
+
de(!0), _.disconnect();
|
|
901
901
|
return;
|
|
902
902
|
}
|
|
903
903
|
});
|
|
904
|
-
return
|
|
904
|
+
return _.observe(I, { attributes: !0, attributeFilter: ["class"] }), () => _.disconnect();
|
|
905
905
|
}, [t]);
|
|
906
906
|
const Y = q(() => {
|
|
907
|
-
Z(null), O(null),
|
|
907
|
+
Z(null), O(null), F("");
|
|
908
908
|
}, []);
|
|
909
909
|
z(() => {
|
|
910
910
|
if (!J || !t.current) return;
|
|
911
911
|
let I = null;
|
|
912
|
-
const
|
|
912
|
+
const _ = () => {
|
|
913
913
|
I && clearTimeout(I), I = setTimeout(() => {
|
|
914
914
|
var ie;
|
|
915
|
-
const v = window.getSelection(),
|
|
916
|
-
if (!(v != null && v.rangeCount) || !
|
|
915
|
+
const v = window.getSelection(), M = t.current;
|
|
916
|
+
if (!(v != null && v.rangeCount) || !M) return;
|
|
917
917
|
const ne = v.toString().trim();
|
|
918
918
|
if (ne === "") return;
|
|
919
|
-
const
|
|
920
|
-
if (!
|
|
921
|
-
const
|
|
922
|
-
|
|
919
|
+
const m = v.getRangeAt(0);
|
|
920
|
+
if (!M.contains(m.commonAncestorContainer)) return;
|
|
921
|
+
const W = (ie = le.fromRange(M, m)) == null ? void 0 : ie.toSelector();
|
|
922
|
+
W && !Ht(W, $) && (O(m.cloneRange()), F(ne), Z($t(m)));
|
|
923
923
|
}, n);
|
|
924
|
-
},
|
|
924
|
+
}, L = (v) => {
|
|
925
925
|
if (!(v.target instanceof Node)) return;
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
},
|
|
926
|
+
const M = document.getElementById(Ce);
|
|
927
|
+
M != null && M.contains(v.target) ? (v.preventDefault(), v.stopImmediatePropagation()) : Y();
|
|
928
|
+
}, U = () => {
|
|
929
929
|
Y();
|
|
930
|
-
},
|
|
930
|
+
}, P = (v) => {
|
|
931
931
|
v.key === "Escape" && ce.current !== null && (Y(), v.stopImmediatePropagation());
|
|
932
932
|
};
|
|
933
|
-
return document.addEventListener("selectionchange",
|
|
934
|
-
I && clearTimeout(I), document.removeEventListener("selectionchange",
|
|
933
|
+
return document.addEventListener("selectionchange", _), document.addEventListener("mousedown", L), document.addEventListener("touchstart", L), document.addEventListener("keydown", P), window.addEventListener("scroll", U, !0), () => {
|
|
934
|
+
I && clearTimeout(I), document.removeEventListener("selectionchange", _), document.removeEventListener("mousedown", L), document.removeEventListener("touchstart", L), document.removeEventListener("keydown", P), window.removeEventListener("scroll", U, !0);
|
|
935
935
|
};
|
|
936
|
-
}, [J,
|
|
936
|
+
}, [J, $, n, t, Y]);
|
|
937
937
|
const te = q(
|
|
938
938
|
(w) => {
|
|
939
|
-
var
|
|
939
|
+
var M;
|
|
940
940
|
const I = t.current;
|
|
941
941
|
if (!I || !w.highlightData) return null;
|
|
942
|
-
const { highlightData:
|
|
942
|
+
const { highlightData: _, reaction: L, id: U } = w, { range: P } = _, v = P && ((M = ae.fromSelector(I, P)) == null ? void 0 : M.toRange());
|
|
943
943
|
if (v) {
|
|
944
|
-
const ne =
|
|
945
|
-
id:
|
|
944
|
+
const ne = L[0] === k.IMPORTANT ? g.important : g.unclear, m = {
|
|
945
|
+
id: U,
|
|
946
946
|
selectedNoteId: h,
|
|
947
|
-
type:
|
|
948
|
-
isTrayOpen:
|
|
947
|
+
type: L[0],
|
|
948
|
+
isTrayOpen: N,
|
|
949
949
|
labelPrefix: `${g.notebookNote} (${ne})`,
|
|
950
|
-
popupId:
|
|
950
|
+
popupId: ct,
|
|
951
951
|
onClick: () => {
|
|
952
|
-
p(
|
|
952
|
+
p(U), E();
|
|
953
953
|
}
|
|
954
954
|
};
|
|
955
|
-
return
|
|
955
|
+
return Kt(v, m, e), _.textPosition;
|
|
956
956
|
}
|
|
957
957
|
return null;
|
|
958
958
|
},
|
|
959
|
-
[t, h,
|
|
959
|
+
[t, h, N, e, g, p, E]
|
|
960
960
|
);
|
|
961
961
|
z(() => {
|
|
962
962
|
if (!J || !Q || !t.current) return;
|
|
963
|
-
const w = t.current, I = Q.notes,
|
|
963
|
+
const w = t.current, I = Q.notes, _ = /* @__PURE__ */ new Set(), L = [], U = [];
|
|
964
964
|
if (I.length === 0) {
|
|
965
|
-
if (
|
|
966
|
-
for (const
|
|
967
|
-
|
|
968
|
-
|
|
965
|
+
if (A.current.length > 0) {
|
|
966
|
+
for (const P of A.current)
|
|
967
|
+
Ge(P, w);
|
|
968
|
+
A.current = [], D([]);
|
|
969
969
|
}
|
|
970
970
|
return;
|
|
971
971
|
}
|
|
972
972
|
if (d && I[0].highlightData.pageLastModifiedAt !== d) {
|
|
973
|
-
const { notesForUpdate:
|
|
973
|
+
const { notesForUpdate: P, noteIdsForDelete: v } = Mt(
|
|
974
974
|
w,
|
|
975
975
|
I,
|
|
976
976
|
d
|
|
977
977
|
);
|
|
978
|
-
for (const
|
|
979
|
-
|
|
980
|
-
for (const
|
|
981
|
-
C(
|
|
978
|
+
for (const M of P)
|
|
979
|
+
b({ id: M.id, input: M }).catch((ne) => r == null ? void 0 : r(ne));
|
|
980
|
+
for (const M of v)
|
|
981
|
+
C(M, { onError: i });
|
|
982
982
|
} else {
|
|
983
|
-
for (const
|
|
984
|
-
const v = te(
|
|
985
|
-
|
|
983
|
+
for (const P of I) {
|
|
984
|
+
const v = te(P);
|
|
985
|
+
_.add(P.id), v && (L.push(P), U.push(v));
|
|
986
986
|
}
|
|
987
|
-
for (const
|
|
988
|
-
|
|
989
|
-
|
|
987
|
+
for (const P of A.current)
|
|
988
|
+
_.has(P.id) || Ge(P, w);
|
|
989
|
+
D(U), A.current = L, h && Bt(h);
|
|
990
990
|
}
|
|
991
991
|
}, [
|
|
992
992
|
J,
|
|
@@ -994,39 +994,39 @@ function So({
|
|
|
994
994
|
te,
|
|
995
995
|
d,
|
|
996
996
|
t,
|
|
997
|
-
|
|
997
|
+
b,
|
|
998
998
|
C,
|
|
999
999
|
h
|
|
1000
1000
|
]);
|
|
1001
|
-
const
|
|
1001
|
+
const H = (w) => {
|
|
1002
1002
|
const I = t.current;
|
|
1003
1003
|
if (!T || !I) return;
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1004
|
+
const _ = ae.fromRange(I, T), L = le.fromRange(I, T);
|
|
1005
|
+
G(
|
|
1006
1006
|
{
|
|
1007
1007
|
courseId: y,
|
|
1008
|
-
objectId:
|
|
1008
|
+
objectId: f,
|
|
1009
1009
|
objectType: c,
|
|
1010
1010
|
userText: "",
|
|
1011
1011
|
reaction: [w],
|
|
1012
1012
|
highlightData: {
|
|
1013
1013
|
selectedText: x,
|
|
1014
|
-
textPosition: (
|
|
1015
|
-
range:
|
|
1014
|
+
textPosition: (L == null ? void 0 : L.toSelector()) ?? null,
|
|
1015
|
+
range: _.toSelector(),
|
|
1016
1016
|
pageLastModifiedAt: d ?? ""
|
|
1017
1017
|
}
|
|
1018
1018
|
},
|
|
1019
1019
|
{
|
|
1020
|
-
onSuccess: (
|
|
1020
|
+
onSuccess: (U) => {
|
|
1021
1021
|
var v;
|
|
1022
|
-
const
|
|
1023
|
-
Y(), (v = window.getSelection()) == null || v.removeAllRanges(), p(
|
|
1022
|
+
const P = U.id;
|
|
1023
|
+
Y(), (v = window.getSelection()) == null || v.removeAllRanges(), p(P), E(), l == null || l(U);
|
|
1024
1024
|
},
|
|
1025
1025
|
onError: o
|
|
1026
1026
|
}
|
|
1027
1027
|
);
|
|
1028
1028
|
};
|
|
1029
|
-
return !T || !V ? null :
|
|
1029
|
+
return !T || !V ? null : ft(
|
|
1030
1030
|
/* @__PURE__ */ s(
|
|
1031
1031
|
"div",
|
|
1032
1032
|
{
|
|
@@ -1043,23 +1043,23 @@ function So({
|
|
|
1043
1043
|
const I = document.getElementById(Ce);
|
|
1044
1044
|
I != null && I.contains(w.relatedTarget) || Y();
|
|
1045
1045
|
},
|
|
1046
|
-
children: /* @__PURE__ */ s(jn, { onSelectReaction:
|
|
1046
|
+
children: /* @__PURE__ */ s(jn, { onSelectReaction: H })
|
|
1047
1047
|
}
|
|
1048
1048
|
),
|
|
1049
1049
|
document.body
|
|
1050
1050
|
);
|
|
1051
1051
|
}
|
|
1052
|
-
const
|
|
1053
|
-
backgroundColor: t ===
|
|
1054
|
-
underlineColor: t ===
|
|
1055
|
-
underlineStyle: t ===
|
|
1056
|
-
}),
|
|
1052
|
+
const Gn = (t, e) => ({
|
|
1053
|
+
backgroundColor: t === k.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
1054
|
+
underlineColor: t === k.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
1055
|
+
underlineStyle: t === k.IMPORTANT ? "solid" : "dashed"
|
|
1056
|
+
}), ke = ({
|
|
1057
1057
|
children: t,
|
|
1058
|
-
type: e =
|
|
1058
|
+
type: e = k.IMPORTANT,
|
|
1059
1059
|
isCardActive: n = !0,
|
|
1060
1060
|
theme: o
|
|
1061
1061
|
}) => {
|
|
1062
|
-
const r =
|
|
1062
|
+
const r = Gn(e, o), l = {
|
|
1063
1063
|
position: "relative",
|
|
1064
1064
|
backgroundColor: n ? r.backgroundColor : Fe(r.backgroundColor, 0.5),
|
|
1065
1065
|
textDecorationLine: "underline",
|
|
@@ -1070,47 +1070,47 @@ const Wn = (t, e) => ({
|
|
|
1070
1070
|
lineHeight: "normal"
|
|
1071
1071
|
};
|
|
1072
1072
|
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: t });
|
|
1073
|
-
},
|
|
1073
|
+
}, dt = () => {
|
|
1074
1074
|
const { translations: t } = ee();
|
|
1075
|
-
return /* @__PURE__ */ S(
|
|
1076
|
-
/* @__PURE__ */ s(
|
|
1077
|
-
/* @__PURE__ */ s(
|
|
1075
|
+
return /* @__PURE__ */ S(R, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1076
|
+
/* @__PURE__ */ s(R.Item, { as: "div", children: /* @__PURE__ */ s(yt, { color: "error" }) }),
|
|
1077
|
+
/* @__PURE__ */ s(R.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(Ee, { maxLines: 3, children: t.highlightUnavailable }) })
|
|
1078
1078
|
] });
|
|
1079
|
-
},
|
|
1079
|
+
}, Wn = {
|
|
1080
1080
|
filter: null,
|
|
1081
1081
|
courseFilter: null,
|
|
1082
1082
|
currentPage: 1,
|
|
1083
1083
|
totalPages: void 0
|
|
1084
1084
|
};
|
|
1085
|
-
function
|
|
1085
|
+
function Ne(t, e) {
|
|
1086
1086
|
const n = typeof e == "number" ? Math.min(e, t) : t;
|
|
1087
1087
|
return Math.max(1, n);
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function zn(t, e) {
|
|
1090
1090
|
switch (e.type) {
|
|
1091
1091
|
case "SET_FILTER":
|
|
1092
1092
|
return { ...t, filter: e.payload, currentPage: 1 };
|
|
1093
1093
|
case "SET_COURSE_FILTER":
|
|
1094
1094
|
return { ...t, courseFilter: e.payload, currentPage: 1 };
|
|
1095
1095
|
case "SET_PAGE":
|
|
1096
|
-
return { ...t, currentPage:
|
|
1096
|
+
return { ...t, currentPage: Ne(e.payload, t.totalPages) };
|
|
1097
1097
|
case "FOCUS_PAGE":
|
|
1098
1098
|
return { ...t, currentPage: Math.max(1, e.payload) };
|
|
1099
1099
|
case "INCREMENT_PAGE":
|
|
1100
|
-
return { ...t, currentPage:
|
|
1100
|
+
return { ...t, currentPage: Ne(t.currentPage + 1, t.totalPages) };
|
|
1101
1101
|
case "DECREMENT_PAGE":
|
|
1102
|
-
return { ...t, currentPage:
|
|
1102
|
+
return { ...t, currentPage: Ne(t.currentPage - 1, t.totalPages) };
|
|
1103
1103
|
case "SET_TOTAL_PAGES":
|
|
1104
1104
|
return t.totalPages === e.payload ? t : {
|
|
1105
1105
|
...t,
|
|
1106
1106
|
totalPages: e.payload,
|
|
1107
|
-
currentPage:
|
|
1107
|
+
currentPage: Ne(t.currentPage, e.payload)
|
|
1108
1108
|
};
|
|
1109
1109
|
default:
|
|
1110
1110
|
return t;
|
|
1111
1111
|
}
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1113
|
+
function So({
|
|
1114
1114
|
api: t,
|
|
1115
1115
|
courseId: e,
|
|
1116
1116
|
enableCourseFilter: n = !1,
|
|
@@ -1119,55 +1119,55 @@ function vo({
|
|
|
1119
1119
|
focusNoteId: i
|
|
1120
1120
|
}) {
|
|
1121
1121
|
var te;
|
|
1122
|
-
const [l, a] =
|
|
1122
|
+
const [l, a] = Xe(zn, Wn), { filter: f, courseFilter: c, currentPage: y, totalPages: d } = l;
|
|
1123
1123
|
z(() => {
|
|
1124
1124
|
a({ type: "SET_PAGE", payload: 1 });
|
|
1125
1125
|
}, [r]);
|
|
1126
|
-
const h = n ? c : e,
|
|
1126
|
+
const h = n ? c : e, N = (y - 1) * r, p = !!o, E = {
|
|
1127
1127
|
...h ? { courseId: h } : {},
|
|
1128
|
-
...
|
|
1128
|
+
...f ? { reactions: [f] } : {},
|
|
1129
1129
|
...o ? { learningObject: o } : {}
|
|
1130
1130
|
}, {
|
|
1131
1131
|
data: g,
|
|
1132
1132
|
isLoading: Q,
|
|
1133
|
-
isError:
|
|
1134
|
-
} =
|
|
1133
|
+
isError: G
|
|
1134
|
+
} = ot({
|
|
1135
1135
|
api: t,
|
|
1136
1136
|
filter: E,
|
|
1137
|
-
offset:
|
|
1137
|
+
offset: N,
|
|
1138
1138
|
pageSize: r,
|
|
1139
1139
|
enabled: !p
|
|
1140
1140
|
}), {
|
|
1141
|
-
data:
|
|
1141
|
+
data: b,
|
|
1142
1142
|
isLoading: C,
|
|
1143
|
-
isError:
|
|
1144
|
-
} =
|
|
1143
|
+
isError: A
|
|
1144
|
+
} = rt({
|
|
1145
1145
|
api: t,
|
|
1146
1146
|
courseId: h ?? void 0,
|
|
1147
1147
|
learningObject: o,
|
|
1148
1148
|
enabled: p
|
|
1149
|
-
}),
|
|
1150
|
-
const
|
|
1151
|
-
return
|
|
1152
|
-
}, [
|
|
1149
|
+
}), $ = he(() => {
|
|
1150
|
+
const H = (b == null ? void 0 : b.notes) ?? [];
|
|
1151
|
+
return f ? H.filter((w) => w.reaction.includes(f)) : H;
|
|
1152
|
+
}, [b, f]), D = B(null);
|
|
1153
1153
|
z(() => {
|
|
1154
1154
|
if (!i) {
|
|
1155
|
-
|
|
1155
|
+
D.current = null;
|
|
1156
1156
|
return;
|
|
1157
1157
|
}
|
|
1158
|
-
if (
|
|
1159
|
-
const
|
|
1160
|
-
if (
|
|
1161
|
-
|
|
1162
|
-
const w = Math.floor(
|
|
1158
|
+
if (D.current === i) return;
|
|
1159
|
+
const H = $.findIndex((I) => I.id === i);
|
|
1160
|
+
if (H === -1) return;
|
|
1161
|
+
D.current = i;
|
|
1162
|
+
const w = Math.floor(H / r) + 1;
|
|
1163
1163
|
w !== y && a({ type: "FOCUS_PAGE", payload: w });
|
|
1164
|
-
}, [i,
|
|
1165
|
-
const T = p ?
|
|
1164
|
+
}, [i, $, r, y]);
|
|
1165
|
+
const T = p ? $.slice(N, N + r) : (g == null ? void 0 : g.notes) ?? [], O = p ? C : Q, x = p ? A : G, F = p ? Math.max(1, Math.ceil($.length / r)) : ((te = g == null ? void 0 : g.pageInfo) == null ? void 0 : te.totalNrOfPages) ?? void 0, V = p ? { totalCount: $.length, totalNrOfPages: F } : g == null ? void 0 : g.pageInfo;
|
|
1166
1166
|
z(() => {
|
|
1167
|
-
a({ type: "SET_TOTAL_PAGES", payload:
|
|
1168
|
-
}, [
|
|
1169
|
-
const Z = q((
|
|
1170
|
-
a({ type: "SET_PAGE", payload:
|
|
1167
|
+
a({ type: "SET_TOTAL_PAGES", payload: F });
|
|
1168
|
+
}, [F]);
|
|
1169
|
+
const Z = q((H) => {
|
|
1170
|
+
a({ type: "SET_PAGE", payload: H });
|
|
1171
1171
|
}, []), ce = q(() => {
|
|
1172
1172
|
a({
|
|
1173
1173
|
type: "INCREMENT_PAGE"
|
|
@@ -1178,17 +1178,17 @@ function vo({
|
|
|
1178
1178
|
type: "DECREMENT_PAGE"
|
|
1179
1179
|
/* DecrementPage */
|
|
1180
1180
|
});
|
|
1181
|
-
}, []), de = q((
|
|
1182
|
-
a({ type: "SET_FILTER", payload:
|
|
1183
|
-
}, []), Y = q((
|
|
1184
|
-
a({ type: "SET_COURSE_FILTER", payload:
|
|
1181
|
+
}, []), de = q((H) => {
|
|
1182
|
+
a({ type: "SET_FILTER", payload: H });
|
|
1183
|
+
}, []), Y = q((H) => {
|
|
1184
|
+
a({ type: "SET_COURSE_FILTER", payload: H });
|
|
1185
1185
|
}, []);
|
|
1186
1186
|
return {
|
|
1187
1187
|
notes: T,
|
|
1188
1188
|
pageInfo: V,
|
|
1189
1189
|
isLoading: O,
|
|
1190
1190
|
isError: x,
|
|
1191
|
-
filter:
|
|
1191
|
+
filter: f,
|
|
1192
1192
|
courseFilter: c,
|
|
1193
1193
|
currentPage: y,
|
|
1194
1194
|
totalPages: d,
|
|
@@ -1200,12 +1200,12 @@ function vo({
|
|
|
1200
1200
|
};
|
|
1201
1201
|
}
|
|
1202
1202
|
const xe = "all";
|
|
1203
|
-
function
|
|
1203
|
+
function vo({ filter: t, setFilter: e }) {
|
|
1204
1204
|
const { translations: n } = ee(), o = he(
|
|
1205
1205
|
() => [
|
|
1206
1206
|
{ label: n.allNotes, value: xe },
|
|
1207
|
-
{ label: n.important, value:
|
|
1208
|
-
{ label: n.unclear, value:
|
|
1207
|
+
{ label: n.important, value: k.IMPORTANT },
|
|
1208
|
+
{ label: n.unclear, value: k.CONFUSING }
|
|
1209
1209
|
],
|
|
1210
1210
|
[n]
|
|
1211
1211
|
), r = q(
|
|
@@ -1231,26 +1231,26 @@ function Io({ filter: t, setFilter: e }) {
|
|
|
1231
1231
|
handleReactionFilterChange: r
|
|
1232
1232
|
};
|
|
1233
1233
|
}
|
|
1234
|
-
const
|
|
1234
|
+
const qn = ({ hasActiveFilter: t = !1 }) => {
|
|
1235
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(
|
|
1236
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", children: /* @__PURE__ */ S(R, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1237
1237
|
!t && /* @__PURE__ */ s(bt, { size: "medium" }),
|
|
1238
1238
|
/* @__PURE__ */ s(Se, { level: "h3", children: n }),
|
|
1239
1239
|
/* @__PURE__ */ s(oe, { color: "secondary", children: o })
|
|
1240
1240
|
] }) });
|
|
1241
|
-
},
|
|
1242
|
-
[
|
|
1241
|
+
}, Kn = {
|
|
1242
|
+
[k.IMPORTANT]: {
|
|
1243
1243
|
color: "success",
|
|
1244
1244
|
translationKey: "important",
|
|
1245
1245
|
icon: /* @__PURE__ */ s(Ae, { size: "x-small" })
|
|
1246
1246
|
},
|
|
1247
|
-
[
|
|
1248
|
-
color: "
|
|
1247
|
+
[k.CONFUSING]: {
|
|
1248
|
+
color: "error",
|
|
1249
1249
|
translationKey: "unclear",
|
|
1250
1250
|
icon: /* @__PURE__ */ s(Le, { size: "x-small" })
|
|
1251
1251
|
}
|
|
1252
|
-
},
|
|
1253
|
-
const { translations: o } = ee(), r =
|
|
1252
|
+
}, ut = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
|
|
1253
|
+
const { translations: o } = ee(), r = Kn[t], i = o[r.translationKey], [l, a] = j(!1), f = B(null), c = B(null), y = B(null), d = q(
|
|
1254
1254
|
(h) => {
|
|
1255
1255
|
e == null || e(h), a(!1);
|
|
1256
1256
|
},
|
|
@@ -1260,12 +1260,12 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1260
1260
|
if (!l) return;
|
|
1261
1261
|
const h = (p) => {
|
|
1262
1262
|
p.key === "Escape" && p.stopPropagation();
|
|
1263
|
-
},
|
|
1263
|
+
}, N = (p) => {
|
|
1264
1264
|
var E;
|
|
1265
1265
|
p.key === "Escape" && (p.stopPropagation(), a(!1), (E = y.current) == null || E.focus());
|
|
1266
1266
|
};
|
|
1267
|
-
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup",
|
|
1268
|
-
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup",
|
|
1267
|
+
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup", N, !0), () => {
|
|
1268
|
+
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup", N, !0);
|
|
1269
1269
|
};
|
|
1270
1270
|
}, [l]), n && e ? /* @__PURE__ */ S(
|
|
1271
1271
|
ue,
|
|
@@ -1287,26 +1287,26 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1287
1287
|
}
|
|
1288
1288
|
),
|
|
1289
1289
|
children: [
|
|
1290
|
-
/* @__PURE__ */ S(ue.Item, { ref:
|
|
1290
|
+
/* @__PURE__ */ S(ue.Item, { ref: f, onClick: () => d(k.CONFUSING), children: [
|
|
1291
1291
|
/* @__PURE__ */ s(Le, { size: "x-small" }),
|
|
1292
1292
|
` ${o.markUnclear}`
|
|
1293
1293
|
] }),
|
|
1294
|
-
/* @__PURE__ */ S(ue.Item, { ref: c, onClick: () => d(
|
|
1294
|
+
/* @__PURE__ */ S(ue.Item, { ref: c, onClick: () => d(k.IMPORTANT), children: [
|
|
1295
1295
|
/* @__PURE__ */ s(Ae, { size: "x-small" }),
|
|
1296
1296
|
` ${o.markImportant}`
|
|
1297
1297
|
] })
|
|
1298
1298
|
]
|
|
1299
1299
|
}
|
|
1300
1300
|
) : /* @__PURE__ */ s(X, { display: "inline-flex", children: /* @__PURE__ */ s($e, { color: r.color, renderIcon: r.icon, children: i }) });
|
|
1301
|
-
}
|
|
1302
|
-
function
|
|
1301
|
+
};
|
|
1302
|
+
function We(t, e) {
|
|
1303
1303
|
return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
|
|
1304
1304
|
year: "numeric",
|
|
1305
1305
|
month: "short",
|
|
1306
1306
|
day: "numeric"
|
|
1307
1307
|
});
|
|
1308
1308
|
}
|
|
1309
|
-
const
|
|
1309
|
+
const Xn = ({
|
|
1310
1310
|
noteId: t,
|
|
1311
1311
|
date: e,
|
|
1312
1312
|
highlight: n,
|
|
@@ -1315,50 +1315,50 @@ const Qn = ({
|
|
|
1315
1315
|
onClick: i,
|
|
1316
1316
|
onDelete: l,
|
|
1317
1317
|
onSaveNote: a,
|
|
1318
|
-
onTypeChange:
|
|
1318
|
+
onTypeChange: f,
|
|
1319
1319
|
isActive: c,
|
|
1320
1320
|
isPanelView: y = !1,
|
|
1321
1321
|
courseName: d,
|
|
1322
1322
|
locale: h,
|
|
1323
|
-
highlightTheme:
|
|
1323
|
+
highlightTheme: N,
|
|
1324
1324
|
renderLink: p,
|
|
1325
1325
|
href: E
|
|
1326
1326
|
}) => {
|
|
1327
|
-
const { translations: g } = ee(), [Q,
|
|
1328
|
-
J.current =
|
|
1329
|
-
}, []), Y =
|
|
1327
|
+
const { translations: g } = ee(), [Q, G] = j(!1), [b, C] = j(!1), [A, $] = j(o || ""), [D, T] = j(!1), [O, x] = j(!1), [F, V] = j(!1), [Z, ce] = j(!1), J = B(null), de = q((m) => {
|
|
1328
|
+
J.current = m;
|
|
1329
|
+
}, []), Y = B(null), te = B(null), H = B(!1), w = B(null), I = B(null), _ = B(!1);
|
|
1330
1330
|
z(() => {
|
|
1331
|
-
var
|
|
1332
|
-
c ? ((
|
|
1331
|
+
var m, W;
|
|
1332
|
+
c ? ((m = J.current) == null || m.scrollIntoView({ behavior: "smooth", block: "nearest" }), (W = J.current) == null || W.focus()) : T(!1);
|
|
1333
1333
|
}, [c]), z(() => {
|
|
1334
|
-
var
|
|
1335
|
-
|
|
1336
|
-
}, [
|
|
1337
|
-
if (!
|
|
1338
|
-
|
|
1339
|
-
const
|
|
1340
|
-
|
|
1334
|
+
var m, W;
|
|
1335
|
+
b ? (H.current = !0, (m = Y.current) == null || m.focus()) : H.current && (H.current = !1, (W = te.current) == null || W.focus());
|
|
1336
|
+
}, [b]), z(() => {
|
|
1337
|
+
if (!D && _.current) {
|
|
1338
|
+
_.current = !1;
|
|
1339
|
+
const m = w.current;
|
|
1340
|
+
m != null && m.isConnected && m.focus();
|
|
1341
1341
|
}
|
|
1342
|
-
}, [
|
|
1343
|
-
const
|
|
1344
|
-
|
|
1342
|
+
}, [D]);
|
|
1343
|
+
const L = q((m, W) => {
|
|
1344
|
+
_.current = !W, T(!1);
|
|
1345
1345
|
}, []);
|
|
1346
1346
|
z(() => {
|
|
1347
|
-
if (!
|
|
1348
|
-
const
|
|
1347
|
+
if (!D) return;
|
|
1348
|
+
const m = (ie) => {
|
|
1349
1349
|
ie.key === "Escape" && ie.stopPropagation();
|
|
1350
|
-
},
|
|
1351
|
-
ie.key === "Escape" && (ie.stopPropagation(),
|
|
1350
|
+
}, W = (ie) => {
|
|
1351
|
+
ie.key === "Escape" && (ie.stopPropagation(), L());
|
|
1352
1352
|
};
|
|
1353
|
-
return window.addEventListener("keydown",
|
|
1354
|
-
window.removeEventListener("keydown",
|
|
1353
|
+
return window.addEventListener("keydown", m, !0), window.addEventListener("keyup", W, !0), () => {
|
|
1354
|
+
window.removeEventListener("keydown", m, !0), window.removeEventListener("keyup", W, !0);
|
|
1355
1355
|
};
|
|
1356
|
-
}, [
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1359
|
-
}, v = [g.note,
|
|
1360
|
-
v.push(n || g.highlightUnavailable), o && v.push(o), e && v.push(
|
|
1361
|
-
const
|
|
1356
|
+
}, [D, L]);
|
|
1357
|
+
const U = r === k.IMPORTANT ? g.important : g.unclear, P = (m) => {
|
|
1358
|
+
m.key === "Enter" && (m.preventDefault(), i == null || i());
|
|
1359
|
+
}, v = [g.note, U];
|
|
1360
|
+
v.push(n || g.highlightUnavailable), o && v.push(o), e && v.push(We(e, h)), d && v.push(d);
|
|
1361
|
+
const M = v.join(", "), ne = /* @__PURE__ */ S(
|
|
1362
1362
|
X,
|
|
1363
1363
|
{
|
|
1364
1364
|
as: "div",
|
|
@@ -1367,17 +1367,17 @@ const Qn = ({
|
|
|
1367
1367
|
borderRadius: "medium",
|
|
1368
1368
|
padding: "small",
|
|
1369
1369
|
position: "relative",
|
|
1370
|
-
role: E ? void 0 : c ||
|
|
1371
|
-
"aria-label": E ? void 0 :
|
|
1372
|
-
"aria-pressed": E || c ||
|
|
1370
|
+
role: E ? void 0 : c || b ? "group" : "button",
|
|
1371
|
+
"aria-label": E ? void 0 : M,
|
|
1372
|
+
"aria-pressed": E || c || b ? void 0 : c,
|
|
1373
1373
|
tabIndex: E || c ? -1 : 0,
|
|
1374
1374
|
"data-testid": `note-card-${t}`,
|
|
1375
1375
|
elementRef: de,
|
|
1376
1376
|
onClick: c ? void 0 : i,
|
|
1377
|
-
onMouseEnter: () =>
|
|
1378
|
-
onMouseLeave: () =>
|
|
1379
|
-
onKeyDown: c ? void 0 :
|
|
1380
|
-
cursor:
|
|
1377
|
+
onMouseEnter: () => G(!0),
|
|
1378
|
+
onMouseLeave: () => G(!1),
|
|
1379
|
+
onKeyDown: c ? void 0 : P,
|
|
1380
|
+
cursor: b ? "default" : "pointer",
|
|
1381
1381
|
children: [
|
|
1382
1382
|
/* @__PURE__ */ s(
|
|
1383
1383
|
"div",
|
|
@@ -1385,65 +1385,65 @@ const Qn = ({
|
|
|
1385
1385
|
"data-testid": `note-card-${t}-content`,
|
|
1386
1386
|
style: {
|
|
1387
1387
|
height: "100%",
|
|
1388
|
-
opacity: c &&
|
|
1388
|
+
opacity: c && D && l ? 0.25 : void 0
|
|
1389
1389
|
},
|
|
1390
|
-
children: /* @__PURE__ */ S(
|
|
1390
|
+
children: /* @__PURE__ */ S(R, { direction: "column", gap: "small", height: "100%", children: [
|
|
1391
1391
|
/* @__PURE__ */ s(
|
|
1392
|
-
|
|
1392
|
+
ut,
|
|
1393
1393
|
{
|
|
1394
1394
|
type: r,
|
|
1395
|
-
onTypeChange: y &&
|
|
1396
|
-
renderAsMenuTrigger: y && !!
|
|
1395
|
+
onTypeChange: y && f ? (m) => f(t, m) : void 0,
|
|
1396
|
+
renderAsMenuTrigger: y && !!f && !!c
|
|
1397
1397
|
}
|
|
1398
1398
|
),
|
|
1399
1399
|
n ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(oe, { children: c && y ? /* @__PURE__ */ s(
|
|
1400
|
-
|
|
1400
|
+
ke,
|
|
1401
1401
|
{
|
|
1402
1402
|
type: r,
|
|
1403
1403
|
isCardActive: !!c || Q,
|
|
1404
|
-
theme:
|
|
1404
|
+
theme: N,
|
|
1405
1405
|
children: n
|
|
1406
1406
|
}
|
|
1407
|
-
) : /* @__PURE__ */ S(
|
|
1407
|
+
) : /* @__PURE__ */ S(ze, { children: [
|
|
1408
1408
|
O && /* @__PURE__ */ s(pe, { children: n }),
|
|
1409
1409
|
/* @__PURE__ */ s("span", { "aria-hidden": O, style: { display: "block" }, children: /* @__PURE__ */ s(Ee, { maxLines: 3, truncate: "word", onUpdate: x, children: /* @__PURE__ */ s(
|
|
1410
|
-
|
|
1410
|
+
ke,
|
|
1411
1411
|
{
|
|
1412
1412
|
type: r,
|
|
1413
1413
|
isCardActive: !!c || Q,
|
|
1414
|
-
theme:
|
|
1414
|
+
theme: N,
|
|
1415
1415
|
children: n
|
|
1416
1416
|
}
|
|
1417
1417
|
) }) })
|
|
1418
|
-
] }) }) }) : /* @__PURE__ */ s(
|
|
1419
|
-
/* @__PURE__ */ s(
|
|
1420
|
-
|
|
1418
|
+
] }) }) }) : /* @__PURE__ */ s(dt, {}),
|
|
1419
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ S(R, { direction: "column", gap: "small", height: "100%", children: [
|
|
1420
|
+
b && y ? /* @__PURE__ */ S(R, { direction: "column", gap: "x-small", margin: "xx-small", children: [
|
|
1421
1421
|
/* @__PURE__ */ s(
|
|
1422
|
-
|
|
1422
|
+
Qe,
|
|
1423
1423
|
{
|
|
1424
1424
|
label: /* @__PURE__ */ s(pe, { children: g.editNote }),
|
|
1425
|
-
value:
|
|
1426
|
-
onChange: (
|
|
1425
|
+
value: A,
|
|
1426
|
+
onChange: (m) => $(m.target.value),
|
|
1427
1427
|
placeholder: g.addNoteOptional,
|
|
1428
|
-
textareaRef: (
|
|
1429
|
-
Y.current =
|
|
1428
|
+
textareaRef: (m) => {
|
|
1429
|
+
Y.current = m;
|
|
1430
1430
|
}
|
|
1431
1431
|
}
|
|
1432
1432
|
),
|
|
1433
|
-
/* @__PURE__ */ S(
|
|
1434
|
-
/* @__PURE__ */ s(
|
|
1433
|
+
/* @__PURE__ */ S(R, { gap: "xx-small", children: [
|
|
1434
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1435
1435
|
re,
|
|
1436
1436
|
{
|
|
1437
1437
|
display: "block",
|
|
1438
1438
|
size: "small",
|
|
1439
1439
|
"data-testid": `note-card-${t}-cancel`,
|
|
1440
1440
|
onClick: () => {
|
|
1441
|
-
|
|
1441
|
+
$(o || ""), C(!1);
|
|
1442
1442
|
},
|
|
1443
1443
|
children: g.cancel
|
|
1444
1444
|
}
|
|
1445
1445
|
) }),
|
|
1446
|
-
/* @__PURE__ */ s(
|
|
1446
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1447
1447
|
re,
|
|
1448
1448
|
{
|
|
1449
1449
|
display: "block",
|
|
@@ -1451,7 +1451,7 @@ const Qn = ({
|
|
|
1451
1451
|
size: "small",
|
|
1452
1452
|
"data-testid": `note-card-${t}-save`,
|
|
1453
1453
|
onClick: () => {
|
|
1454
|
-
a == null || a(t,
|
|
1454
|
+
a == null || a(t, A.trim()), C(!1);
|
|
1455
1455
|
},
|
|
1456
1456
|
children: g.save
|
|
1457
1457
|
}
|
|
@@ -1469,18 +1469,18 @@ const Qn = ({
|
|
|
1469
1469
|
margin: "xx-small 0 0 xxx-small",
|
|
1470
1470
|
screenReaderLabel: g.editNote,
|
|
1471
1471
|
"data-testid": `note-card-${t}-edit`,
|
|
1472
|
-
elementRef: (
|
|
1473
|
-
te.current =
|
|
1472
|
+
elementRef: (m) => {
|
|
1473
|
+
te.current = m;
|
|
1474
1474
|
},
|
|
1475
|
-
onClick: (
|
|
1476
|
-
|
|
1475
|
+
onClick: (m) => {
|
|
1476
|
+
m.stopPropagation(), C(!0);
|
|
1477
1477
|
},
|
|
1478
|
-
children: /* @__PURE__ */ s(
|
|
1478
|
+
children: /* @__PURE__ */ s(Re, {})
|
|
1479
1479
|
}
|
|
1480
1480
|
)
|
|
1481
1481
|
] }) : /* @__PURE__ */ S(oe, { children: [
|
|
1482
|
-
|
|
1483
|
-
/* @__PURE__ */ s("span", { "aria-hidden":
|
|
1482
|
+
F && /* @__PURE__ */ s(pe, { children: o }),
|
|
1483
|
+
/* @__PURE__ */ s("span", { "aria-hidden": F, style: { display: "block" }, children: /* @__PURE__ */ s(Ee, { maxLines: 3, truncate: "word", onUpdate: V, children: o }) })
|
|
1484
1484
|
] }) }) : y && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ S(oe, { color: "secondary", children: [
|
|
1485
1485
|
g.addNotePrompt,
|
|
1486
1486
|
" ",
|
|
@@ -1493,18 +1493,18 @@ const Qn = ({
|
|
|
1493
1493
|
margin: "xx-small 0 0 xxx-small",
|
|
1494
1494
|
screenReaderLabel: g.editNote,
|
|
1495
1495
|
"data-testid": `note-card-${t}-edit`,
|
|
1496
|
-
elementRef: (
|
|
1497
|
-
te.current =
|
|
1496
|
+
elementRef: (m) => {
|
|
1497
|
+
te.current = m;
|
|
1498
1498
|
},
|
|
1499
|
-
onClick: (
|
|
1500
|
-
|
|
1499
|
+
onClick: (m) => {
|
|
1500
|
+
m.stopPropagation(), C(!0);
|
|
1501
1501
|
},
|
|
1502
|
-
children: /* @__PURE__ */ s(
|
|
1502
|
+
children: /* @__PURE__ */ s(Re, {})
|
|
1503
1503
|
}
|
|
1504
1504
|
)
|
|
1505
1505
|
] }) }) : null,
|
|
1506
|
-
/* @__PURE__ */ S(
|
|
1507
|
-
/* @__PURE__ */ s(oe, { as: "div", size: "small", color: "secondary", children:
|
|
1506
|
+
/* @__PURE__ */ S(R, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
|
|
1507
|
+
/* @__PURE__ */ s(oe, { as: "div", size: "small", color: "secondary", children: We(e, h) }),
|
|
1508
1508
|
c && l && /* @__PURE__ */ s(
|
|
1509
1509
|
me,
|
|
1510
1510
|
{
|
|
@@ -1515,11 +1515,11 @@ const Qn = ({
|
|
|
1515
1515
|
margin: "xx-small",
|
|
1516
1516
|
screenReaderLabel: g.deleteNote,
|
|
1517
1517
|
"data-testid": `note-card-${t}-delete`,
|
|
1518
|
-
elementRef: (
|
|
1519
|
-
w.current =
|
|
1518
|
+
elementRef: (m) => {
|
|
1519
|
+
w.current = m;
|
|
1520
1520
|
},
|
|
1521
|
-
onClick: (
|
|
1522
|
-
|
|
1521
|
+
onClick: (m) => {
|
|
1522
|
+
m.stopPropagation(), _.current = !1, T(!0);
|
|
1523
1523
|
},
|
|
1524
1524
|
children: /* @__PURE__ */ s(Te, {})
|
|
1525
1525
|
}
|
|
@@ -1542,8 +1542,8 @@ const Qn = ({
|
|
|
1542
1542
|
] })
|
|
1543
1543
|
}
|
|
1544
1544
|
),
|
|
1545
|
-
c &&
|
|
1546
|
-
|
|
1545
|
+
c && D && l && /* @__PURE__ */ s(
|
|
1546
|
+
Et,
|
|
1547
1547
|
{
|
|
1548
1548
|
open: !0,
|
|
1549
1549
|
as: "div",
|
|
@@ -1554,11 +1554,13 @@ const Qn = ({
|
|
|
1554
1554
|
shouldCloseOnDocumentClick: !0,
|
|
1555
1555
|
shouldCloseOnEscape: !1,
|
|
1556
1556
|
shouldReturnFocus: !1,
|
|
1557
|
-
onDismiss:
|
|
1557
|
+
onDismiss: L,
|
|
1558
1558
|
children: /* @__PURE__ */ s(
|
|
1559
1559
|
X,
|
|
1560
1560
|
{
|
|
1561
1561
|
as: "div",
|
|
1562
|
+
background: "primary",
|
|
1563
|
+
borderRadius: "medium",
|
|
1562
1564
|
padding: "medium",
|
|
1563
1565
|
position: "absolute",
|
|
1564
1566
|
insetBlockStart: "0",
|
|
@@ -1567,7 +1569,7 @@ const Qn = ({
|
|
|
1567
1569
|
insetInlineEnd: "0",
|
|
1568
1570
|
stacking: "above",
|
|
1569
1571
|
children: /* @__PURE__ */ S(
|
|
1570
|
-
|
|
1572
|
+
R,
|
|
1571
1573
|
{
|
|
1572
1574
|
direction: "column",
|
|
1573
1575
|
justifyItems: "center",
|
|
@@ -1581,20 +1583,10 @@ const Qn = ({
|
|
|
1581
1583
|
display: "block",
|
|
1582
1584
|
color: "danger",
|
|
1583
1585
|
withBackground: !1,
|
|
1584
|
-
themeOverride: (f, L) => ({
|
|
1585
|
-
borderRadius: We,
|
|
1586
|
-
// Ghost states default to translucent fills; the faded card would show through.
|
|
1587
|
-
dangerGhostBackground: L.colors.contrasts.white1010,
|
|
1588
|
-
dangerGhostHoverBackground: L.colors.contrasts.red1212,
|
|
1589
|
-
dangerGhostActiveBackground: L.colors.contrasts.red1212,
|
|
1590
|
-
// red45 on the hover tint is 3.74:1; red57 clears AA in every state.
|
|
1591
|
-
dangerGhostColor: L.colors.contrasts.red5782,
|
|
1592
|
-
dangerGhostBorderColor: L.colors.contrasts.red5782
|
|
1593
|
-
}),
|
|
1594
1586
|
renderIcon: /* @__PURE__ */ s(Te, {}),
|
|
1595
1587
|
"data-testid": `note-card-${t}-confirm-delete`,
|
|
1596
|
-
onClick: (
|
|
1597
|
-
|
|
1588
|
+
onClick: (m) => {
|
|
1589
|
+
m.stopPropagation(), l(t), T(!1);
|
|
1598
1590
|
},
|
|
1599
1591
|
children: g.deleteNote
|
|
1600
1592
|
}
|
|
@@ -1604,17 +1596,12 @@ const Qn = ({
|
|
|
1604
1596
|
{
|
|
1605
1597
|
display: "block",
|
|
1606
1598
|
withBackground: !1,
|
|
1607
|
-
themeOverride: (f, L) => ({
|
|
1608
|
-
borderRadius: We,
|
|
1609
|
-
secondaryGhostBackground: L.colors.contrasts.white1010,
|
|
1610
|
-
secondaryGhostActiveBackground: L.colors.contrasts.grey1111
|
|
1611
|
-
}),
|
|
1612
1599
|
"data-testid": `note-card-${t}-cancel-delete`,
|
|
1613
|
-
elementRef: (
|
|
1614
|
-
I.current =
|
|
1600
|
+
elementRef: (m) => {
|
|
1601
|
+
I.current = m;
|
|
1615
1602
|
},
|
|
1616
|
-
onClick: (
|
|
1617
|
-
|
|
1603
|
+
onClick: (m) => {
|
|
1604
|
+
m.stopPropagation(), L();
|
|
1618
1605
|
},
|
|
1619
1606
|
children: g.cancel
|
|
1620
1607
|
}
|
|
@@ -1629,8 +1616,8 @@ const Qn = ({
|
|
|
1629
1616
|
]
|
|
1630
1617
|
}
|
|
1631
1618
|
);
|
|
1632
|
-
return E && p ? p({ href: E, children: ne, ariaLabel:
|
|
1633
|
-
},
|
|
1619
|
+
return E && p ? p({ href: E, children: ne, ariaLabel: M }) : ne;
|
|
1620
|
+
}, Qn = {
|
|
1634
1621
|
display: "grid",
|
|
1635
1622
|
gap: "1rem",
|
|
1636
1623
|
boxSizing: "border-box",
|
|
@@ -1638,7 +1625,7 @@ const Qn = ({
|
|
|
1638
1625
|
margin: 0,
|
|
1639
1626
|
padding: 0,
|
|
1640
1627
|
listStyle: "none"
|
|
1641
|
-
},
|
|
1628
|
+
}, Io = ({
|
|
1642
1629
|
notes: t,
|
|
1643
1630
|
isLoading: e,
|
|
1644
1631
|
isError: n,
|
|
@@ -1647,31 +1634,31 @@ const Qn = ({
|
|
|
1647
1634
|
onPageChange: i,
|
|
1648
1635
|
onNoteSelect: l,
|
|
1649
1636
|
onNoteDelete: a,
|
|
1650
|
-
onNoteSave:
|
|
1637
|
+
onNoteSave: f,
|
|
1651
1638
|
onNoteTypeChange: c,
|
|
1652
1639
|
onNotesEmptied: y,
|
|
1653
1640
|
selectedNoteId: d,
|
|
1654
1641
|
hasActiveFilter: h = !1,
|
|
1655
|
-
columnCount:
|
|
1642
|
+
columnCount: N = 1,
|
|
1656
1643
|
highlightTheme: p,
|
|
1657
1644
|
locale: E,
|
|
1658
1645
|
courseNames: g,
|
|
1659
1646
|
renderNoteLink: Q,
|
|
1660
|
-
noteHref:
|
|
1647
|
+
noteHref: G
|
|
1661
1648
|
}) => {
|
|
1662
|
-
const { translations:
|
|
1649
|
+
const { translations: b } = ee(), C = B(null), A = B(null), $ = q(
|
|
1663
1650
|
(T) => {
|
|
1664
|
-
const O = t.findIndex((
|
|
1651
|
+
const O = t.findIndex((F) => F.id === T);
|
|
1665
1652
|
let x = null;
|
|
1666
|
-
t.length > 1 && (x = O > 0 ? t[O - 1].id : t[1].id),
|
|
1653
|
+
t.length > 1 && (x = O > 0 ? t[O - 1].id : t[1].id), A.current = { targetId: x }, a == null || a(T);
|
|
1667
1654
|
},
|
|
1668
1655
|
[t, a]
|
|
1669
1656
|
);
|
|
1670
1657
|
if (z(() => {
|
|
1671
1658
|
var O;
|
|
1672
|
-
const T =
|
|
1659
|
+
const T = A.current;
|
|
1673
1660
|
if (T)
|
|
1674
|
-
if (
|
|
1661
|
+
if (A.current = null, T.targetId === null)
|
|
1675
1662
|
y == null || y();
|
|
1676
1663
|
else {
|
|
1677
1664
|
const x = (O = C.current) == null ? void 0 : O.querySelector(
|
|
@@ -1680,60 +1667,60 @@ const Qn = ({
|
|
|
1680
1667
|
x == null || x.focus();
|
|
1681
1668
|
}
|
|
1682
1669
|
}, [t, y]), e)
|
|
1683
|
-
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(
|
|
1670
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(St, { renderTitle: b.loadingNotes }) });
|
|
1684
1671
|
if (n)
|
|
1685
|
-
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(Se, { level: "h4", children:
|
|
1672
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(Se, { level: "h4", children: b.failedToLoadNotes }) });
|
|
1686
1673
|
if (t.length === 0)
|
|
1687
|
-
return /* @__PURE__ */ s(X, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(
|
|
1688
|
-
const
|
|
1689
|
-
return /* @__PURE__ */ S(
|
|
1674
|
+
return /* @__PURE__ */ s(X, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(qn, { hasActiveFilter: h }) });
|
|
1675
|
+
const D = typeof o == "number" && typeof r == "number" && r > 1 && i !== void 0;
|
|
1676
|
+
return /* @__PURE__ */ S(ze, { children: [
|
|
1690
1677
|
/* @__PURE__ */ s(
|
|
1691
1678
|
"ul",
|
|
1692
1679
|
{
|
|
1693
1680
|
ref: C,
|
|
1694
|
-
style: { ...
|
|
1681
|
+
style: { ...Qn, gridTemplateColumns: `repeat(${N}, minmax(0, 1fr))` },
|
|
1695
1682
|
role: "list",
|
|
1696
1683
|
"data-testid": "notes-grid",
|
|
1697
1684
|
children: t.map((T) => {
|
|
1698
1685
|
var O;
|
|
1699
1686
|
return /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(
|
|
1700
|
-
|
|
1687
|
+
Xn,
|
|
1701
1688
|
{
|
|
1702
1689
|
noteId: T.id,
|
|
1703
1690
|
date: T.createdAt,
|
|
1704
|
-
type: T.reaction[0] ??
|
|
1691
|
+
type: T.reaction[0] ?? k.IMPORTANT,
|
|
1705
1692
|
highlight: (O = T.highlightData) == null ? void 0 : O.selectedText,
|
|
1706
1693
|
note: T.userText,
|
|
1707
1694
|
isActive: d === T.id,
|
|
1708
1695
|
isPanelView: !!d,
|
|
1709
1696
|
onClick: l ? () => l(T.id) : void 0,
|
|
1710
|
-
onDelete: a ?
|
|
1711
|
-
onSaveNote:
|
|
1712
|
-
onTypeChange: c ? (x,
|
|
1697
|
+
onDelete: a ? $ : void 0,
|
|
1698
|
+
onSaveNote: f ? (x, F) => f(x, F) : void 0,
|
|
1699
|
+
onTypeChange: c ? (x, F) => c(x, F) : void 0,
|
|
1713
1700
|
highlightTheme: p,
|
|
1714
1701
|
locale: E,
|
|
1715
1702
|
courseName: g == null ? void 0 : g.get(T.courseId),
|
|
1716
1703
|
renderLink: Q,
|
|
1717
|
-
href:
|
|
1704
|
+
href: G ? G(T.id, T) : void 0
|
|
1718
1705
|
}
|
|
1719
1706
|
) }, T.id);
|
|
1720
1707
|
})
|
|
1721
1708
|
}
|
|
1722
1709
|
),
|
|
1723
|
-
|
|
1724
|
-
|
|
1710
|
+
D && /* @__PURE__ */ s(R, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ s(R.Item, { children: /* @__PURE__ */ s(
|
|
1711
|
+
Tt,
|
|
1725
1712
|
{
|
|
1726
1713
|
as: "nav",
|
|
1727
1714
|
variant: "input",
|
|
1728
|
-
labelNext:
|
|
1729
|
-
labelPrev:
|
|
1715
|
+
labelNext: b.nextPage,
|
|
1716
|
+
labelPrev: b.previousPage,
|
|
1730
1717
|
currentPage: o,
|
|
1731
1718
|
totalPageNumber: r,
|
|
1732
1719
|
onPageChange: i
|
|
1733
1720
|
}
|
|
1734
1721
|
) }) })
|
|
1735
1722
|
] });
|
|
1736
|
-
},
|
|
1723
|
+
}, Co = ({
|
|
1737
1724
|
noteText: t,
|
|
1738
1725
|
reaction: e,
|
|
1739
1726
|
highlightText: n,
|
|
@@ -1742,36 +1729,36 @@ const Qn = ({
|
|
|
1742
1729
|
onDelete: i,
|
|
1743
1730
|
onTypeChange: l,
|
|
1744
1731
|
onBack: a,
|
|
1745
|
-
editing:
|
|
1732
|
+
editing: f = !1
|
|
1746
1733
|
}) => {
|
|
1747
|
-
const { translations: c } = ee(), [y, d] = j(
|
|
1748
|
-
return /* @__PURE__ */ S(
|
|
1749
|
-
n != null ? /* @__PURE__ */ s(X, { as: "div", children: /* @__PURE__ */ s(oe, { children: /* @__PURE__ */ s(
|
|
1750
|
-
/* @__PURE__ */ s(
|
|
1751
|
-
y ? /* @__PURE__ */ S(
|
|
1734
|
+
const { translations: c } = ee(), [y, d] = j(f), [h, N] = j(t || ""), [p, E] = j(!1);
|
|
1735
|
+
return /* @__PURE__ */ S(R, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1736
|
+
n != null ? /* @__PURE__ */ s(X, { as: "div", children: /* @__PURE__ */ s(oe, { children: /* @__PURE__ */ s(ke, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ s(dt, {}),
|
|
1737
|
+
/* @__PURE__ */ s(ut, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1738
|
+
y ? /* @__PURE__ */ S(R, { direction: "column", gap: "x-small", children: [
|
|
1752
1739
|
/* @__PURE__ */ s(
|
|
1753
|
-
|
|
1740
|
+
Qe,
|
|
1754
1741
|
{
|
|
1755
1742
|
label: c.addNoteOptional,
|
|
1756
1743
|
value: h,
|
|
1757
|
-
onChange: (g) =>
|
|
1744
|
+
onChange: (g) => N(g.target.value),
|
|
1758
1745
|
resize: "vertical"
|
|
1759
1746
|
}
|
|
1760
1747
|
),
|
|
1761
|
-
/* @__PURE__ */ S(
|
|
1762
|
-
/* @__PURE__ */ s(
|
|
1748
|
+
/* @__PURE__ */ S(R, { gap: "xx-small", children: [
|
|
1749
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1763
1750
|
re,
|
|
1764
1751
|
{
|
|
1765
1752
|
display: "block",
|
|
1766
1753
|
size: "small",
|
|
1767
1754
|
"data-testid": "single-note-cancel",
|
|
1768
1755
|
onClick: () => {
|
|
1769
|
-
|
|
1756
|
+
N(t || ""), d(!1);
|
|
1770
1757
|
},
|
|
1771
1758
|
children: c.cancel
|
|
1772
1759
|
}
|
|
1773
1760
|
) }),
|
|
1774
|
-
/* @__PURE__ */ s(
|
|
1761
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1775
1762
|
re,
|
|
1776
1763
|
{
|
|
1777
1764
|
display: "block",
|
|
@@ -1785,23 +1772,23 @@ const Qn = ({
|
|
|
1785
1772
|
}
|
|
1786
1773
|
) })
|
|
1787
1774
|
] })
|
|
1788
|
-
] }) : /* @__PURE__ */ S(
|
|
1775
|
+
] }) : /* @__PURE__ */ S(R, { direction: "column", gap: "small", children: [
|
|
1789
1776
|
t && /* @__PURE__ */ S(X, { as: "div", children: [
|
|
1790
1777
|
/* @__PURE__ */ s(Se, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
|
|
1791
1778
|
/* @__PURE__ */ s(oe, { children: t })
|
|
1792
1779
|
] }),
|
|
1793
|
-
/* @__PURE__ */ S(
|
|
1780
|
+
/* @__PURE__ */ S(R, { justifyItems: "space-between", children: [
|
|
1794
1781
|
/* @__PURE__ */ s(
|
|
1795
1782
|
re,
|
|
1796
1783
|
{
|
|
1797
1784
|
size: "small",
|
|
1798
|
-
renderIcon: /* @__PURE__ */ s(
|
|
1785
|
+
renderIcon: /* @__PURE__ */ s(Nt, {}),
|
|
1799
1786
|
"data-testid": "single-note-back",
|
|
1800
1787
|
onClick: () => a == null ? void 0 : a(),
|
|
1801
1788
|
children: c.back
|
|
1802
1789
|
}
|
|
1803
1790
|
),
|
|
1804
|
-
/* @__PURE__ */ S(
|
|
1791
|
+
/* @__PURE__ */ S(R, { gap: "xx-small", children: [
|
|
1805
1792
|
i && /* @__PURE__ */ s(
|
|
1806
1793
|
me,
|
|
1807
1794
|
{
|
|
@@ -1824,12 +1811,12 @@ const Qn = ({
|
|
|
1824
1811
|
screenReaderLabel: c.editNote,
|
|
1825
1812
|
"data-testid": "single-note-edit",
|
|
1826
1813
|
onClick: () => d(!0),
|
|
1827
|
-
children: /* @__PURE__ */ s(
|
|
1814
|
+
children: /* @__PURE__ */ s(Re, {})
|
|
1828
1815
|
}
|
|
1829
1816
|
)
|
|
1830
1817
|
] })
|
|
1831
1818
|
] }),
|
|
1832
|
-
p && i && /* @__PURE__ */ s(X, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ S(
|
|
1819
|
+
p && i && /* @__PURE__ */ s(X, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ S(R, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1833
1820
|
/* @__PURE__ */ s(
|
|
1834
1821
|
re,
|
|
1835
1822
|
{
|
|
@@ -1859,26 +1846,26 @@ const Qn = ({
|
|
|
1859
1846
|
] });
|
|
1860
1847
|
};
|
|
1861
1848
|
export {
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1849
|
+
To as ContentWithNoteWrapper,
|
|
1850
|
+
ke as Highlight,
|
|
1851
|
+
dt as HighlightError,
|
|
1852
|
+
Xn as NoteCard,
|
|
1853
|
+
ut as NoteChip,
|
|
1867
1854
|
jn as NoteReactionMenu,
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1855
|
+
qn as NotebookEmptyState,
|
|
1856
|
+
No as NotebookProvider,
|
|
1857
|
+
$n as NotebookTranslationsProvider,
|
|
1858
|
+
Eo as NotebookTray,
|
|
1859
|
+
Io as NotesListView,
|
|
1860
|
+
k as REACTION_TYPE,
|
|
1861
|
+
Co as SingleNote,
|
|
1875
1862
|
Fe as createTransparentColor,
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1863
|
+
Yt as useCreateNote,
|
|
1864
|
+
Vt as useDeleteNote,
|
|
1865
|
+
ot as useGetNotes,
|
|
1866
|
+
at as useNotebook,
|
|
1880
1867
|
ee as useNotebookTranslations,
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1868
|
+
So as useNotesData,
|
|
1869
|
+
vo as useReactionFilter,
|
|
1870
|
+
Jt as useUpdateNote
|
|
1884
1871
|
};
|