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