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