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