@instructure/platform-notebook 0.7.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NoteCard.d.ts.map +1 -1
- package/dist/NotebookEmptyState.d.ts +5 -0
- package/dist/NotebookEmptyState.d.ts.map +1 -0
- package/dist/NotesListView.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +551 -557
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as Pe, useMemo as
|
|
1
|
+
import { jsx as s, jsxs as S, Fragment as Ye } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Pe, useMemo as re, useContext as _e, useReducer as Fe, useRef as ne, useEffect as Q, useState as B, useCallback as K } from "react";
|
|
3
3
|
import { createPortal as Ze } from "react-dom";
|
|
4
4
|
import { z as a } from "zod";
|
|
5
5
|
import Je from "diff-match-patch";
|
|
6
6
|
import { useQueryClient as ge, useMutation as pe, useQuery as et } from "@tanstack/react-query";
|
|
7
|
-
import { IconQuestionLine as Ne, IconPinLine as
|
|
7
|
+
import { IconQuestionLine as Ne, IconPinLine as be, IconWarningLine as tt, IconNoteLine as nt, IconEditLine as fe, IconTrashLine as le, IconArrowOpenStartLine as ot, IconArrowOpenEndLine as rt, IconArrowStartLine as st } from "@instructure/ui-icons";
|
|
8
8
|
import { Menu as ee } from "@instructure/ui-menu";
|
|
9
|
-
import { Flex as
|
|
9
|
+
import { Flex as T } from "@instructure/ui-flex";
|
|
10
10
|
import { TruncateText as me } from "@instructure/ui-truncate-text";
|
|
11
11
|
import { ScreenReaderContent as Me } from "@instructure/ui-a11y-content";
|
|
12
12
|
import { SimpleSelect as we } from "@instructure/ui-simple-select";
|
|
13
|
-
import { CloseButton as st, Button as $, IconButton as Y } from "@instructure/ui-buttons";
|
|
14
13
|
import { Heading as ae } from "@instructure/ui-heading";
|
|
15
|
-
import { Tray as it } from "@instructure/ui-tray";
|
|
16
|
-
import { View as q } from "@instructure/ui-view";
|
|
17
14
|
import { Text as U } from "@instructure/ui-text";
|
|
15
|
+
import { View as z } from "@instructure/ui-view";
|
|
16
|
+
import { CloseButton as it, Button as $, IconButton as V } from "@instructure/ui-buttons";
|
|
17
|
+
import { Tray as lt } from "@instructure/ui-tray";
|
|
18
18
|
import { TextArea as He } from "@instructure/ui-text-area";
|
|
19
19
|
import { Pill as ke } from "@instructure/ui-pill";
|
|
20
|
-
import { Spinner as
|
|
21
|
-
const
|
|
20
|
+
import { Spinner as at } from "@instructure/ui-spinner";
|
|
21
|
+
const ct = a.object({
|
|
22
22
|
startContainer: a.string(),
|
|
23
23
|
endContainer: a.string(),
|
|
24
24
|
startOffset: a.number(),
|
|
25
25
|
endOffset: a.number()
|
|
26
|
-
}),
|
|
26
|
+
}), dt = a.object({
|
|
27
27
|
start: a.number(),
|
|
28
28
|
end: a.number()
|
|
29
|
-
}),
|
|
29
|
+
}), ye = a.object({
|
|
30
30
|
selectedText: a.string(),
|
|
31
31
|
hasNoHighlightAnymore: a.boolean().optional(),
|
|
32
|
-
textPosition:
|
|
33
|
-
range:
|
|
32
|
+
textPosition: dt.nullable(),
|
|
33
|
+
range: ct.nullable(),
|
|
34
34
|
pageLastModifiedAt: a.string()
|
|
35
35
|
});
|
|
36
|
-
var
|
|
36
|
+
var w = /* @__PURE__ */ ((n) => (n.IMPORTANT = "Important", n.CONFUSING = "Confusing", n))(w || {});
|
|
37
37
|
const Ee = a.enum([
|
|
38
38
|
"Important",
|
|
39
39
|
"Confusing"
|
|
@@ -52,31 +52,31 @@ const Ee = a.enum([
|
|
|
52
52
|
objectType: a.string(),
|
|
53
53
|
userText: a.string().optional(),
|
|
54
54
|
reaction: a.array(Ee),
|
|
55
|
-
highlightData:
|
|
55
|
+
highlightData: ye,
|
|
56
56
|
createdAt: a.string(),
|
|
57
57
|
updatedAt: a.string()
|
|
58
|
-
}),
|
|
58
|
+
}), ut = a.object({
|
|
59
59
|
cursor: a.string(),
|
|
60
60
|
node: ce
|
|
61
61
|
});
|
|
62
62
|
a.object({
|
|
63
63
|
notes: a.object({
|
|
64
|
-
edges: a.array(
|
|
64
|
+
edges: a.array(ut),
|
|
65
65
|
nodes: a.array(ce),
|
|
66
66
|
pageInfo: Be
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
|
-
const
|
|
69
|
+
const ft = a.object({
|
|
70
70
|
type: a.string(),
|
|
71
71
|
id: a.string()
|
|
72
|
-
}),
|
|
72
|
+
}), mt = a.object({
|
|
73
73
|
courseId: a.string().optional(),
|
|
74
|
-
learningObject:
|
|
74
|
+
learningObject: ft.optional(),
|
|
75
75
|
reactions: a.array(a.string()).optional()
|
|
76
76
|
}).optional();
|
|
77
77
|
a.object({
|
|
78
78
|
courseId: a.string().optional(),
|
|
79
|
-
filter:
|
|
79
|
+
filter: mt,
|
|
80
80
|
pageParams: Be.optional(),
|
|
81
81
|
direction: a.enum(["next", "prev"]).optional(),
|
|
82
82
|
pageSize: a.number().optional()
|
|
@@ -87,7 +87,7 @@ a.object({
|
|
|
87
87
|
objectType: a.string(),
|
|
88
88
|
userText: a.string().optional(),
|
|
89
89
|
reaction: a.array(Ee),
|
|
90
|
-
highlightData:
|
|
90
|
+
highlightData: ye
|
|
91
91
|
});
|
|
92
92
|
a.object({
|
|
93
93
|
createNote: ce
|
|
@@ -96,7 +96,7 @@ a.object({
|
|
|
96
96
|
id: a.string(),
|
|
97
97
|
userText: a.string().optional(),
|
|
98
98
|
reaction: a.array(Ee),
|
|
99
|
-
highlightData:
|
|
99
|
+
highlightData: ye
|
|
100
100
|
});
|
|
101
101
|
a.object({
|
|
102
102
|
updateNote: ce
|
|
@@ -105,13 +105,13 @@ a.object({
|
|
|
105
105
|
deleteNote: a.string()
|
|
106
106
|
});
|
|
107
107
|
var We = /* @__PURE__ */ ((n) => (n[n.FORWARDS = 1] = "FORWARDS", n[n.BACKWARDS = 2] = "BACKWARDS", n))(We || {});
|
|
108
|
-
class
|
|
108
|
+
class q {
|
|
109
109
|
constructor(e, t) {
|
|
110
110
|
this.start = e, this.end = t;
|
|
111
111
|
}
|
|
112
112
|
toRange() {
|
|
113
113
|
let e, t;
|
|
114
|
-
if (this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] =
|
|
114
|
+
if (this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] = je(this.start.element, this.start.offset, this.end.offset) : (e = this.start.resolve({
|
|
115
115
|
direction: 1
|
|
116
116
|
/* FORWARDS */
|
|
117
117
|
}), t = this.end.resolve({
|
|
@@ -124,13 +124,13 @@ class G {
|
|
|
124
124
|
}
|
|
125
125
|
static fromRange(e) {
|
|
126
126
|
const t = W.fromPoint(e.startContainer, e.startOffset), o = W.fromPoint(e.endContainer, e.endOffset);
|
|
127
|
-
return !t || !o ? null : new
|
|
127
|
+
return !t || !o ? null : new q(t, o);
|
|
128
128
|
}
|
|
129
129
|
static fromOffsets(e, t, o) {
|
|
130
|
-
return new
|
|
130
|
+
return new q(new W(e, t), new W(e, o));
|
|
131
131
|
}
|
|
132
132
|
relativeTo(e) {
|
|
133
|
-
return new
|
|
133
|
+
return new q(this.start.relativeTo(e), this.end.relativeTo(e));
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
class W {
|
|
@@ -139,15 +139,15 @@ class W {
|
|
|
139
139
|
}
|
|
140
140
|
resolve(e = {}) {
|
|
141
141
|
try {
|
|
142
|
-
return
|
|
142
|
+
return je(this.element, this.offset)[0];
|
|
143
143
|
} catch (t) {
|
|
144
144
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
145
145
|
const o = document.createTreeWalker(this.element.getRootNode(), NodeFilter.SHOW_TEXT);
|
|
146
146
|
o.currentNode = this.element;
|
|
147
|
-
const r = e.direction === We.FORWARDS,
|
|
148
|
-
if (!
|
|
147
|
+
const r = e.direction === We.FORWARDS, i = r ? o.nextNode() : o.previousNode();
|
|
148
|
+
if (!i)
|
|
149
149
|
throw t;
|
|
150
|
-
return { node:
|
|
150
|
+
return { node: i, offset: r ? 0 : i.data.length };
|
|
151
151
|
}
|
|
152
152
|
throw t;
|
|
153
153
|
}
|
|
@@ -177,7 +177,7 @@ class W {
|
|
|
177
177
|
return console.error("Child node offset is out of range"), null;
|
|
178
178
|
let o = 0;
|
|
179
179
|
for (let r = 0; r < t; r++)
|
|
180
|
-
o +=
|
|
180
|
+
o += ze(e.childNodes[r]);
|
|
181
181
|
return new W(e, o);
|
|
182
182
|
}
|
|
183
183
|
default:
|
|
@@ -193,18 +193,18 @@ class W {
|
|
|
193
193
|
return new W(t, o);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
const
|
|
196
|
+
const ht = (n) => {
|
|
197
197
|
const e = n.nodeName.toLowerCase();
|
|
198
198
|
return e === "#text" ? "text()" : e;
|
|
199
199
|
};
|
|
200
|
-
function
|
|
200
|
+
function gt(n) {
|
|
201
201
|
let e = 0, t = n;
|
|
202
202
|
for (; t; )
|
|
203
203
|
t.nodeName === n.nodeName && (e += 1), t = t.previousSibling;
|
|
204
204
|
return e;
|
|
205
205
|
}
|
|
206
|
-
const
|
|
207
|
-
const e =
|
|
206
|
+
const pt = (n) => {
|
|
207
|
+
const e = ht(n), t = gt(n);
|
|
208
208
|
return `${e}[${t}]`;
|
|
209
209
|
}, Oe = (n, e) => {
|
|
210
210
|
let t = "", o = n;
|
|
@@ -213,53 +213,53 @@ const gt = (n) => {
|
|
|
213
213
|
console.error("Node is not a descendant of root");
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
|
-
t = `${
|
|
216
|
+
t = `${pt(o)}/${t}`, o = o.parentNode;
|
|
217
217
|
}
|
|
218
218
|
return t = `/${t}`, t = t.replace(/\/$/, ""), t;
|
|
219
|
-
},
|
|
219
|
+
}, Nt = (n, e, t) => {
|
|
220
220
|
const o = e.toUpperCase();
|
|
221
221
|
let r = -1;
|
|
222
|
-
for (let
|
|
223
|
-
const l = n.children[
|
|
222
|
+
for (let i = 0; i < n.children.length; i++) {
|
|
223
|
+
const l = n.children[i];
|
|
224
224
|
if (l.nodeName.toUpperCase() === o && (++r, r === t))
|
|
225
225
|
return l;
|
|
226
226
|
}
|
|
227
227
|
return null;
|
|
228
|
-
},
|
|
228
|
+
}, bt = (n, e) => {
|
|
229
229
|
if (!(n.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+])?)+$/) !== null))
|
|
230
230
|
return console.error("Expression is not a simple XPath"), null;
|
|
231
231
|
const o = n.split("/");
|
|
232
232
|
let r = e;
|
|
233
233
|
o.shift();
|
|
234
|
-
for (const
|
|
235
|
-
let l,
|
|
236
|
-
const m =
|
|
234
|
+
for (const i of o) {
|
|
235
|
+
let l, d;
|
|
236
|
+
const m = i.indexOf("[");
|
|
237
237
|
if (m !== -1) {
|
|
238
|
-
l =
|
|
239
|
-
const g =
|
|
240
|
-
if (
|
|
238
|
+
l = i.slice(0, m);
|
|
239
|
+
const g = i.slice(m + 1, i.indexOf("]"));
|
|
240
|
+
if (d = Number.parseInt(g, 10) - 1, d < 0)
|
|
241
241
|
return null;
|
|
242
242
|
} else
|
|
243
|
-
l =
|
|
244
|
-
const
|
|
245
|
-
if (!
|
|
243
|
+
l = i, d = 0;
|
|
244
|
+
const c = Nt(r, l, d);
|
|
245
|
+
if (!c)
|
|
246
246
|
return null;
|
|
247
|
-
r =
|
|
247
|
+
r = c;
|
|
248
248
|
}
|
|
249
249
|
return r;
|
|
250
250
|
}, Re = (n, e = document.body) => {
|
|
251
251
|
try {
|
|
252
|
-
return
|
|
252
|
+
return bt(n, e);
|
|
253
253
|
} catch {
|
|
254
254
|
return document.evaluate(`.${n}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
class
|
|
257
|
+
class Y {
|
|
258
258
|
constructor(e, t) {
|
|
259
259
|
this.root = e, this.range = t;
|
|
260
260
|
}
|
|
261
261
|
static fromRange(e, t) {
|
|
262
|
-
return new
|
|
262
|
+
return new Y(e, t);
|
|
263
263
|
}
|
|
264
264
|
static fromSelector(e, t) {
|
|
265
265
|
if (!(t != null && t.startContainer) || !(t != null && t.endContainer))
|
|
@@ -270,18 +270,18 @@ class V {
|
|
|
270
270
|
const r = Re(t.endContainer, e);
|
|
271
271
|
if (!r)
|
|
272
272
|
return console.error("Failed to resolve endContainer XPath"), null;
|
|
273
|
-
const
|
|
274
|
-
if (!
|
|
273
|
+
const i = W.fromCharOffset(o, t.startOffset), l = W.fromCharOffset(r, t.endOffset);
|
|
274
|
+
if (!i || !l)
|
|
275
275
|
return null;
|
|
276
|
-
const
|
|
277
|
-
return
|
|
276
|
+
const d = new q(i, l).toRange();
|
|
277
|
+
return d ? new Y(e, d) : null;
|
|
278
278
|
}
|
|
279
279
|
toRange() {
|
|
280
280
|
return this.range;
|
|
281
281
|
}
|
|
282
282
|
toSelector() {
|
|
283
|
-
var
|
|
284
|
-
const e = (
|
|
283
|
+
var i;
|
|
284
|
+
const e = (i = q.fromRange(this.range)) == null ? void 0 : i.toRange(), t = e && q.fromRange(e), o = t && Oe(t.start.element, this.root), r = t && Oe(t.end.element, this.root);
|
|
285
285
|
return !o || !r ? null : {
|
|
286
286
|
startContainer: o,
|
|
287
287
|
startOffset: t.start.offset,
|
|
@@ -290,17 +290,17 @@ class V {
|
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
class
|
|
293
|
+
class X {
|
|
294
294
|
constructor(e, t, o) {
|
|
295
295
|
this.root = e, this.start = t, this.end = o;
|
|
296
296
|
}
|
|
297
297
|
static fromRange(e, t) {
|
|
298
298
|
var r;
|
|
299
|
-
const o = (r =
|
|
300
|
-
return o ? new
|
|
299
|
+
const o = (r = q.fromRange(t)) == null ? void 0 : r.relativeTo(e);
|
|
300
|
+
return o ? new X(e, o.start.offset, o.end.offset) : null;
|
|
301
301
|
}
|
|
302
302
|
static fromSelector(e, t) {
|
|
303
|
-
return new
|
|
303
|
+
return new X(e, t.start, t.end);
|
|
304
304
|
}
|
|
305
305
|
toSelector() {
|
|
306
306
|
return {
|
|
@@ -309,10 +309,10 @@ class K {
|
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
311
|
toRange() {
|
|
312
|
-
return
|
|
312
|
+
return q.fromOffsets(this.root, this.start, this.end).toRange();
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
const
|
|
315
|
+
const ze = (n) => {
|
|
316
316
|
var e;
|
|
317
317
|
switch (n.nodeType) {
|
|
318
318
|
case Node.ELEMENT_NODE:
|
|
@@ -324,73 +324,73 @@ const je = (n) => {
|
|
|
324
324
|
}, De = (n) => {
|
|
325
325
|
let e = n.previousSibling, t = 0;
|
|
326
326
|
for (; e; )
|
|
327
|
-
t +=
|
|
327
|
+
t += ze(e), e = e.previousSibling;
|
|
328
328
|
return t;
|
|
329
|
-
},
|
|
329
|
+
}, je = (n, ...e) => {
|
|
330
330
|
let t = e.shift();
|
|
331
331
|
const o = n.ownerDocument.createNodeIterator(n, NodeFilter.SHOW_TEXT), r = [];
|
|
332
|
-
let
|
|
333
|
-
for (; t !== void 0 &&
|
|
334
|
-
l =
|
|
335
|
-
for (; t !== void 0 && l &&
|
|
332
|
+
let i = o.nextNode(), l = null, d = 0;
|
|
333
|
+
for (; t !== void 0 && i; )
|
|
334
|
+
l = i, d + l.data.length > t ? (r.push({ node: l, offset: t - d }), t = e.shift()) : (i = o.nextNode(), d += l.data.length);
|
|
335
|
+
for (; t !== void 0 && l && d === t; )
|
|
336
336
|
r.push({ node: l, offset: l.data.length }), t = e.shift();
|
|
337
337
|
return t !== void 0 && console.error("Offset exceeds text length"), r;
|
|
338
338
|
}, yt = (n, e, t, o) => {
|
|
339
339
|
const r = t - e;
|
|
340
|
-
return Math.abs(r - o) <= 5 ?
|
|
340
|
+
return Math.abs(r - o) <= 5 ? X.fromSelector(n, {
|
|
341
341
|
start: e,
|
|
342
342
|
end: t
|
|
343
343
|
}) : null;
|
|
344
|
-
},
|
|
344
|
+
}, Et = (n, e, t, o) => {
|
|
345
345
|
const r = new Je();
|
|
346
346
|
r.Match_Distance = 5e3;
|
|
347
|
-
const
|
|
348
|
-
if (!
|
|
347
|
+
const i = n.textContent;
|
|
348
|
+
if (!i)
|
|
349
349
|
return null;
|
|
350
350
|
if (e.length > 32) {
|
|
351
|
-
const l = e.slice(0, 32),
|
|
352
|
-
let
|
|
353
|
-
const g = r.match_main(
|
|
354
|
-
if (
|
|
351
|
+
const l = e.slice(0, 32), d = e.slice(-32), m = o - t;
|
|
352
|
+
let c = r.match_main(i, l, t);
|
|
353
|
+
const g = r.match_main(i, d, o), h = g + d.length;
|
|
354
|
+
if (c === -1 || g === -1)
|
|
355
355
|
return null;
|
|
356
|
-
const u = h -
|
|
357
|
-
if ((
|
|
358
|
-
return yt(n,
|
|
359
|
-
if (
|
|
360
|
-
return
|
|
361
|
-
start:
|
|
356
|
+
const u = h - c, E = Math.abs(u - m);
|
|
357
|
+
if ((c > h || E > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(i, l, h), c !== -1 && c < h))
|
|
358
|
+
return yt(n, c, h, m);
|
|
359
|
+
if (c < h && E <= 5)
|
|
360
|
+
return X.fromSelector(n, {
|
|
361
|
+
start: c,
|
|
362
362
|
end: h
|
|
363
363
|
});
|
|
364
364
|
} else {
|
|
365
|
-
const l = r.match_main(
|
|
365
|
+
const l = r.match_main(i, e, t);
|
|
366
366
|
if (l !== -1)
|
|
367
|
-
return
|
|
367
|
+
return X.fromSelector(n, {
|
|
368
368
|
start: l,
|
|
369
369
|
end: l + e.length
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
return null;
|
|
373
|
-
},
|
|
373
|
+
}, St = (n, e) => {
|
|
374
374
|
if (!e) return null;
|
|
375
375
|
const { highlightData: t } = n, { textPosition: o, selectedText: r } = t;
|
|
376
|
-
return
|
|
376
|
+
return Et(
|
|
377
377
|
e,
|
|
378
378
|
r,
|
|
379
379
|
(o == null ? void 0 : o.start) ?? 0,
|
|
380
380
|
(o == null ? void 0 : o.end) ?? 0
|
|
381
381
|
);
|
|
382
|
-
},
|
|
382
|
+
}, vt = (n, e, t) => {
|
|
383
383
|
const o = [], r = [];
|
|
384
|
-
for (const
|
|
385
|
-
const l =
|
|
384
|
+
for (const i of e) {
|
|
385
|
+
const l = St(i, n);
|
|
386
386
|
if (l) {
|
|
387
|
-
const
|
|
387
|
+
const d = l.toRange(), m = d && Y.fromRange(n, d);
|
|
388
388
|
o.push({
|
|
389
|
-
id:
|
|
390
|
-
reaction:
|
|
391
|
-
userText:
|
|
389
|
+
id: i.id,
|
|
390
|
+
reaction: i.reaction,
|
|
391
|
+
userText: i.userText,
|
|
392
392
|
highlightData: {
|
|
393
|
-
...
|
|
393
|
+
...i.highlightData,
|
|
394
394
|
hasNoHighlightAnymore: !1,
|
|
395
395
|
range: (m == null ? void 0 : m.toSelector()) ?? null,
|
|
396
396
|
textPosition: l.toSelector(),
|
|
@@ -398,24 +398,24 @@ const je = (n) => {
|
|
|
398
398
|
}
|
|
399
399
|
});
|
|
400
400
|
} else
|
|
401
|
-
|
|
402
|
-
id:
|
|
403
|
-
reaction:
|
|
404
|
-
userText:
|
|
401
|
+
i.userText ? o.push({
|
|
402
|
+
id: i.id,
|
|
403
|
+
reaction: i.reaction,
|
|
404
|
+
userText: i.userText,
|
|
405
405
|
highlightData: {
|
|
406
|
-
...
|
|
406
|
+
...i.highlightData,
|
|
407
407
|
pageLastModifiedAt: t,
|
|
408
408
|
hasNoHighlightAnymore: !0
|
|
409
409
|
}
|
|
410
|
-
}) : r.push(
|
|
410
|
+
}) : r.push(i.id);
|
|
411
411
|
}
|
|
412
412
|
return { notesForUpdate: o, noteIdsForDelete: r };
|
|
413
|
-
},
|
|
413
|
+
}, Le = (n, e) => {
|
|
414
414
|
var l;
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: t, id: o } = n, { range: r } = t ?? {};
|
|
417
|
-
r && ((l =
|
|
418
|
-
},
|
|
417
|
+
r && ((l = Y.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Rt({ id: o });
|
|
418
|
+
}, It = (n) => {
|
|
419
419
|
const e = document.getElementById(ve(n));
|
|
420
420
|
if (e) {
|
|
421
421
|
const t = e.getBoundingClientRect();
|
|
@@ -425,12 +425,12 @@ const je = (n) => {
|
|
|
425
425
|
const e = n.getClientRects();
|
|
426
426
|
if (!e.length)
|
|
427
427
|
return null;
|
|
428
|
-
const t = e[0], o = e[e.length - 1], r = 4,
|
|
428
|
+
const t = e[0], o = e[e.length - 1], r = 4, i = 16, l = window.innerWidth || document.documentElement.clientWidth, d = window.innerHeight || document.documentElement.clientHeight, m = (f) => {
|
|
429
429
|
const v = f + ie;
|
|
430
|
-
return f >=
|
|
431
|
-
},
|
|
430
|
+
return f >= i && v <= l - i;
|
|
431
|
+
}, c = (f) => {
|
|
432
432
|
const v = f + se;
|
|
433
|
-
return f >=
|
|
433
|
+
return f >= i && v <= d - i;
|
|
434
434
|
};
|
|
435
435
|
let g;
|
|
436
436
|
const h = t.right - ie;
|
|
@@ -442,27 +442,27 @@ const je = (n) => {
|
|
|
442
442
|
g = f;
|
|
443
443
|
else {
|
|
444
444
|
const y = (t.left + t.right) / 2 - ie / 2;
|
|
445
|
-
m(y) ? g = y : h <
|
|
445
|
+
m(y) ? g = y : h < i ? g = i : g = l - ie - i;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
let u;
|
|
449
449
|
const E = o.bottom + r;
|
|
450
|
-
if (
|
|
450
|
+
if (c(E))
|
|
451
451
|
u = E;
|
|
452
452
|
else {
|
|
453
453
|
const f = t.top - se - r;
|
|
454
|
-
|
|
454
|
+
c(f) ? u = f : E + se > d - i ? u = d - se - i : u = i;
|
|
455
455
|
}
|
|
456
456
|
return { top: u, left: g };
|
|
457
|
-
},
|
|
457
|
+
}, Ct = (n, e) => {
|
|
458
458
|
for (const t of e)
|
|
459
459
|
if (n.start < t.end && n.end > t.start)
|
|
460
460
|
return !0;
|
|
461
461
|
return !1;
|
|
462
|
-
}, Se = (n) => `highlight-wrapper-${n}`, ve = (n) => `${Se(n)}-start`, Ue = (n) => `${Se(n)}-end`,
|
|
462
|
+
}, Se = (n) => `highlight-wrapper-${n}`, ve = (n) => `${Se(n)}-start`, Ue = (n) => `${Se(n)}-end`, oe = (n) => `[data-highlight-id="${CSS.escape(n)}"]`, Ie = (n, e) => {
|
|
463
463
|
const t = Number.parseInt(n.slice(1, 3), 16), o = Number.parseInt(n.slice(3, 5), 16), r = Number.parseInt(n.slice(5, 7), 16);
|
|
464
464
|
return `rgba(${t}, ${o}, ${r}, ${e})`;
|
|
465
|
-
},
|
|
465
|
+
}, xt = (n, e) => {
|
|
466
466
|
var t;
|
|
467
467
|
try {
|
|
468
468
|
const o = ((t = e.nodeValue) == null ? void 0 : t.length) ?? e.childNodes.length;
|
|
@@ -470,17 +470,17 @@ const je = (n) => {
|
|
|
470
470
|
} catch {
|
|
471
471
|
return !1;
|
|
472
472
|
}
|
|
473
|
-
},
|
|
474
|
-
var
|
|
473
|
+
}, wt = (n) => {
|
|
474
|
+
var i;
|
|
475
475
|
if (n.collapsed)
|
|
476
476
|
return [];
|
|
477
477
|
let e = n.commonAncestorContainer;
|
|
478
478
|
if (e && e.nodeType !== Node.ELEMENT_NODE && (e = e.parentElement), !e)
|
|
479
479
|
return [];
|
|
480
|
-
const t = [], o = (
|
|
480
|
+
const t = [], o = (i = e == null ? void 0 : e.ownerDocument) == null ? void 0 : i.createNodeIterator(e, NodeFilter.SHOW_TEXT);
|
|
481
481
|
let r = (o == null ? void 0 : o.nextNode()) || null;
|
|
482
482
|
for (; r; ) {
|
|
483
|
-
if (!
|
|
483
|
+
if (!xt(n, r)) {
|
|
484
484
|
r = (o == null ? void 0 : o.nextNode()) || null;
|
|
485
485
|
continue;
|
|
486
486
|
}
|
|
@@ -492,14 +492,14 @@ const je = (n) => {
|
|
|
492
492
|
l === n.endContainer && n.endOffset < l.data.length && l.splitText(n.endOffset), t.push(l), r = (o == null ? void 0 : o.nextNode()) || null;
|
|
493
493
|
}
|
|
494
494
|
return t;
|
|
495
|
-
},
|
|
495
|
+
}, kt = (n, e, t) => {
|
|
496
496
|
if (n.collapsed) return;
|
|
497
497
|
const o = e.id ?? "", r = Se(o);
|
|
498
498
|
if (document.getElementById(ve(o))) {
|
|
499
|
-
|
|
499
|
+
Ot(e, t);
|
|
500
500
|
return;
|
|
501
501
|
}
|
|
502
|
-
const l = e.type ===
|
|
502
|
+
const l = e.type === w.IMPORTANT ? t.colors.importantBackground : t.colors.confusingBackground, m = e.id === e.selectedNoteId ? l : Ie(l, 0.5), c = e.type === w.IMPORTANT ? t.colors.importantUnderline : t.colors.confusingUnderline, g = e.type === w.IMPORTANT ? "solid" : "dashed", h = n.toString(), u = document.createElement("span");
|
|
503
503
|
u.id = `${r}-start`, u.className = "highlight-marker-start", u.dataset.highlightId = o || "", u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-label", h), u.style.position = "relative", u.style.fontSize = "0", u.style.lineHeight = "0", u.style.width = "0", u.style.height = "0", u.style.margin = "0", u.style.padding = "0", u.style.border = "0";
|
|
504
504
|
const E = document.createElement("span");
|
|
505
505
|
E.id = Ue(o), E.className = "highlight-marker-end", E.dataset.highlightId = o || "";
|
|
@@ -509,73 +509,73 @@ const je = (n) => {
|
|
|
509
509
|
v.collapse(!0), v.insertNode(u);
|
|
510
510
|
const y = document.createRange();
|
|
511
511
|
y.setStartAfter(u), y.setEndBefore(E);
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
var
|
|
515
|
-
const
|
|
516
|
-
if ((
|
|
517
|
-
const x = C === 0,
|
|
512
|
+
const F = wt(y).filter((N) => N.textContent && N.textContent.length > 0);
|
|
513
|
+
F.forEach((N, C) => {
|
|
514
|
+
var Z;
|
|
515
|
+
const k = N.parentElement;
|
|
516
|
+
if ((k == null ? void 0 : k.dataset.highlightId) === o) return;
|
|
517
|
+
const x = C === 0, O = C === F.length - 1, _ = F.length === 1;
|
|
518
518
|
let M;
|
|
519
|
-
|
|
519
|
+
_ ? M = "single" : x ? M = "first" : O ? M = "last" : M = "middle";
|
|
520
520
|
const D = document.createElement("span");
|
|
521
|
-
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position = M, D.style.backgroundColor = m, D.style.textDecorationLine = "underline", D.style.textDecorationColor =
|
|
521
|
+
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position = M, D.style.backgroundColor = m, D.style.textDecorationLine = "underline", D.style.textDecorationColor = c, D.style.textDecorationStyle = g, D.style.textDecorationThickness = t.borderWidthSmall, D.style.textUnderlineOffset = t.underlineOffset, D.style.cursor = "pointer", D.addEventListener("click", (R) => {
|
|
522
522
|
var b;
|
|
523
|
-
|
|
524
|
-
}), (
|
|
525
|
-
}), u.addEventListener("click", (
|
|
523
|
+
R.target.tagName !== "A" && ((b = e.onClick) == null || b.call(e));
|
|
524
|
+
}), (Z = N.parentNode) == null || Z.insertBefore(D, N), D.appendChild(N);
|
|
525
|
+
}), u.addEventListener("click", (N) => {
|
|
526
526
|
var C;
|
|
527
|
-
|
|
528
|
-
}), u.addEventListener("keydown", (
|
|
527
|
+
N.target.tagName !== "A" && ((C = e.onClick) == null || C.call(e));
|
|
528
|
+
}), u.addEventListener("keydown", (N) => {
|
|
529
529
|
var C;
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
else if (
|
|
533
|
-
const
|
|
534
|
-
for (const x of
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
|
|
530
|
+
if (N.key === "Enter" || N.key === " ")
|
|
531
|
+
N.preventDefault(), (C = e.onClick) == null || C.call(e);
|
|
532
|
+
else if (N.key === "Tab" && !N.shiftKey) {
|
|
533
|
+
const k = document.querySelectorAll(oe(o));
|
|
534
|
+
for (const x of k) {
|
|
535
|
+
const O = x.querySelector("a");
|
|
536
|
+
if (O) {
|
|
537
|
+
N.preventDefault(), O.focus();
|
|
538
538
|
break;
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
}), u.addEventListener("focus", () => {
|
|
543
543
|
document.querySelectorAll(
|
|
544
|
-
|
|
544
|
+
oe(o)
|
|
545
545
|
).forEach((C) => {
|
|
546
546
|
C.classList.add("highlight-focused");
|
|
547
547
|
});
|
|
548
548
|
}), u.addEventListener("blur", () => {
|
|
549
549
|
document.querySelectorAll(
|
|
550
|
-
|
|
550
|
+
oe(o)
|
|
551
551
|
).forEach((C) => {
|
|
552
552
|
C.classList.remove("highlight-focused");
|
|
553
553
|
});
|
|
554
554
|
});
|
|
555
555
|
};
|
|
556
|
-
function
|
|
557
|
-
const t = n.type ===
|
|
556
|
+
function Ot(n, e) {
|
|
557
|
+
const t = n.type === w.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, r = n.id === n.selectedNoteId ? t : Ie(t, 0.5);
|
|
558
558
|
document.querySelectorAll(
|
|
559
|
-
|
|
559
|
+
oe(n.id ?? "")
|
|
560
560
|
).forEach((l) => {
|
|
561
561
|
l.style.backgroundColor = r;
|
|
562
562
|
});
|
|
563
563
|
}
|
|
564
|
-
const
|
|
564
|
+
const Rt = (n) => {
|
|
565
565
|
const e = n.id ?? "", t = document.getElementById(ve(e)), o = document.getElementById(Ue(e));
|
|
566
566
|
document.querySelectorAll(
|
|
567
|
-
|
|
568
|
-
).forEach((
|
|
567
|
+
oe(e)
|
|
568
|
+
).forEach((i) => {
|
|
569
569
|
var l;
|
|
570
|
-
for (;
|
|
571
|
-
(l =
|
|
572
|
-
|
|
570
|
+
for (; i.firstChild; )
|
|
571
|
+
(l = i.parentNode) == null || l.insertBefore(i.firstChild, i);
|
|
572
|
+
i.remove();
|
|
573
573
|
}), t == null || t.remove(), o == null || o.remove();
|
|
574
574
|
}, te = {
|
|
575
575
|
all: ["notebook"],
|
|
576
576
|
notes: (n) => ["notebook", "notes", n]
|
|
577
577
|
};
|
|
578
|
-
function
|
|
578
|
+
function Dt(n) {
|
|
579
579
|
const e = ge();
|
|
580
580
|
return pe({
|
|
581
581
|
mutationFn: (t) => n.createNote(t),
|
|
@@ -584,7 +584,7 @@ function Rt(n) {
|
|
|
584
584
|
}
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function Lt(n) {
|
|
588
588
|
const e = ge();
|
|
589
589
|
return pe({
|
|
590
590
|
mutationFn: (t) => n.deleteNote(t),
|
|
@@ -610,13 +610,13 @@ function At(n) {
|
|
|
610
610
|
mutationFn: ({ id: t, input: o }) => n.updateNote(t, o),
|
|
611
611
|
onMutate: async ({ id: t, input: o }) => {
|
|
612
612
|
await e.cancelQueries({ queryKey: te.all });
|
|
613
|
-
const
|
|
614
|
-
for (const
|
|
615
|
-
const m =
|
|
616
|
-
m && (l.set(
|
|
613
|
+
const i = e.getQueryCache().findAll({ queryKey: te.all }), l = /* @__PURE__ */ new Map();
|
|
614
|
+
for (const d of i) {
|
|
615
|
+
const m = d.state.data;
|
|
616
|
+
m && (l.set(d.queryKey, m), e.setQueryData(d.queryKey, {
|
|
617
617
|
...m,
|
|
618
618
|
notes: m.notes.map(
|
|
619
|
-
(
|
|
619
|
+
(c) => c.id === t ? { ...c, ...o, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } : c
|
|
620
620
|
)
|
|
621
621
|
}));
|
|
622
622
|
}
|
|
@@ -624,79 +624,79 @@ function At(n) {
|
|
|
624
624
|
},
|
|
625
625
|
onError: (t, o, r) => {
|
|
626
626
|
if (r != null && r.previousData)
|
|
627
|
-
for (const [
|
|
628
|
-
e.setQueryData(
|
|
627
|
+
for (const [i, l] of r.previousData)
|
|
628
|
+
e.setQueryData(i, l);
|
|
629
629
|
},
|
|
630
630
|
onSettled: () => {
|
|
631
631
|
e.invalidateQueries({ queryKey: te.all });
|
|
632
632
|
}
|
|
633
633
|
});
|
|
634
634
|
}
|
|
635
|
-
const
|
|
636
|
-
notebook:
|
|
637
|
-
notes:
|
|
638
|
-
important:
|
|
639
|
-
unclear:
|
|
640
|
-
back:
|
|
641
|
-
editNote:
|
|
642
|
-
save:
|
|
643
|
-
cancel:
|
|
635
|
+
const Pt = "Notebook", _t = "Notes", Ft = "Important", Mt = "Unclear", Ht = "Back", Bt = "Edit note", Wt = "Save", zt = "Cancel", jt = "Delete note", Ut = "note", $t = "Add note (optional)", qt = "Remove from Notebook", Gt = "Add a note (optional)", Kt = "Mark important", Xt = "Mark unclear", Qt = "Saved to Notebook.", Vt = "Note updated", Yt = "Note deleted", Zt = "Error saving to Notebook.", Jt = "Error updating note", en = "Note deletion failed", tn = "Loading notes", nn = "Failed to load notes", on = "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.", sn = "Nothing here yet", ln = "Adjust your filters or create a new note to get started.", an = "You have no notes for the selected filter", cn = "Previous page", dn = "Next page", un = "All courses", fn = "All notes", mn = "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.", gn = "The content you highlighted is no longer available.", Te = {
|
|
636
|
+
notebook: Pt,
|
|
637
|
+
notes: _t,
|
|
638
|
+
important: Ft,
|
|
639
|
+
unclear: Mt,
|
|
640
|
+
back: Ht,
|
|
641
|
+
editNote: Bt,
|
|
642
|
+
save: Wt,
|
|
643
|
+
cancel: zt,
|
|
644
644
|
deleteNote: jt,
|
|
645
|
-
note:
|
|
646
|
-
addNotePrompt:
|
|
647
|
-
removeFromNotebook:
|
|
648
|
-
addNoteOptional:
|
|
649
|
-
markImportant:
|
|
650
|
-
markUnclear:
|
|
651
|
-
savedToNotebook:
|
|
652
|
-
noteUpdated:
|
|
645
|
+
note: Ut,
|
|
646
|
+
addNotePrompt: $t,
|
|
647
|
+
removeFromNotebook: qt,
|
|
648
|
+
addNoteOptional: Gt,
|
|
649
|
+
markImportant: Kt,
|
|
650
|
+
markUnclear: Xt,
|
|
651
|
+
savedToNotebook: Qt,
|
|
652
|
+
noteUpdated: Vt,
|
|
653
653
|
noteDeleted: Yt,
|
|
654
|
-
errorSavingNote:
|
|
655
|
-
errorUpdatingNote:
|
|
656
|
-
noteDeletionFailed:
|
|
657
|
-
loadingNotes:
|
|
658
|
-
failedToLoadNotes:
|
|
659
|
-
emptyStateHeading:
|
|
660
|
-
emptyStateDescription:
|
|
661
|
-
nothingHereYet:
|
|
662
|
-
adjustFiltersOrCreate:
|
|
663
|
-
noNotesForFilter:
|
|
664
|
-
previousPage:
|
|
665
|
-
nextPage:
|
|
666
|
-
allCourses:
|
|
667
|
-
allNotes:
|
|
668
|
-
closeNotebookPanel:
|
|
669
|
-
featureDescription:
|
|
670
|
-
highlightUnavailable:
|
|
654
|
+
errorSavingNote: Zt,
|
|
655
|
+
errorUpdatingNote: Jt,
|
|
656
|
+
noteDeletionFailed: en,
|
|
657
|
+
loadingNotes: tn,
|
|
658
|
+
failedToLoadNotes: nn,
|
|
659
|
+
emptyStateHeading: on,
|
|
660
|
+
emptyStateDescription: rn,
|
|
661
|
+
nothingHereYet: sn,
|
|
662
|
+
adjustFiltersOrCreate: ln,
|
|
663
|
+
noNotesForFilter: an,
|
|
664
|
+
previousPage: cn,
|
|
665
|
+
nextPage: dn,
|
|
666
|
+
allCourses: un,
|
|
667
|
+
allNotes: fn,
|
|
668
|
+
closeNotebookPanel: mn,
|
|
669
|
+
featureDescription: hn,
|
|
670
|
+
highlightUnavailable: gn
|
|
671
671
|
}, qe = Pe(null);
|
|
672
672
|
function Ge(n, e) {
|
|
673
|
-
const t =
|
|
673
|
+
const t = Te[n] ?? n;
|
|
674
674
|
return e ? t.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : t;
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function pn({
|
|
677
677
|
translations: n,
|
|
678
678
|
translate: e,
|
|
679
679
|
children: t
|
|
680
680
|
}) {
|
|
681
|
-
const o =
|
|
681
|
+
const o = re(
|
|
682
682
|
() => ({
|
|
683
|
-
translations: { ...
|
|
683
|
+
translations: { ...Te, ...n },
|
|
684
684
|
translate: e ?? Ge
|
|
685
685
|
}),
|
|
686
686
|
[n, e]
|
|
687
687
|
);
|
|
688
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ s(qe.Provider, { value: o, children: t });
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function G() {
|
|
691
691
|
const n = _e(qe);
|
|
692
|
-
return n || { translations:
|
|
692
|
+
return n || { translations: Te, translate: Ge };
|
|
693
693
|
}
|
|
694
|
-
const
|
|
694
|
+
const Nn = {
|
|
695
695
|
selectedNoteId: null,
|
|
696
696
|
isNoteEditing: !1,
|
|
697
697
|
isTrayOpen: !1
|
|
698
698
|
};
|
|
699
|
-
function
|
|
699
|
+
function bn(n, e) {
|
|
700
700
|
switch (e.type) {
|
|
701
701
|
case "SELECT_NOTE":
|
|
702
702
|
return {
|
|
@@ -717,26 +717,26 @@ function Nn(n, e) {
|
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
const Ke = Pe(null);
|
|
720
|
-
function
|
|
720
|
+
function Qn({
|
|
721
721
|
api: n,
|
|
722
722
|
currentUserId: e,
|
|
723
723
|
objectId: t,
|
|
724
724
|
objectType: o,
|
|
725
725
|
courseId: r,
|
|
726
|
-
pageLastModifiedAt:
|
|
726
|
+
pageLastModifiedAt: i,
|
|
727
727
|
onAnalyticsEvent: l,
|
|
728
|
-
translations:
|
|
728
|
+
translations: d,
|
|
729
729
|
translate: m,
|
|
730
|
-
children:
|
|
730
|
+
children: c
|
|
731
731
|
}) {
|
|
732
|
-
const [g, h] = Fe(
|
|
732
|
+
const [g, h] = Fe(bn, Nn), u = re(
|
|
733
733
|
() => ({
|
|
734
734
|
api: n,
|
|
735
735
|
currentUserId: e,
|
|
736
736
|
objectId: t,
|
|
737
737
|
objectType: o,
|
|
738
738
|
courseId: r,
|
|
739
|
-
pageLastModifiedAt:
|
|
739
|
+
pageLastModifiedAt: i,
|
|
740
740
|
onAnalyticsEvent: l,
|
|
741
741
|
...g,
|
|
742
742
|
selectNote: (E, f = !1) => h({ type: "SELECT_NOTE", payload: { id: E, isEditing: f } }),
|
|
@@ -751,12 +751,12 @@ function Kn({
|
|
|
751
751
|
t,
|
|
752
752
|
o,
|
|
753
753
|
r,
|
|
754
|
-
|
|
754
|
+
i,
|
|
755
755
|
l,
|
|
756
756
|
g
|
|
757
757
|
]
|
|
758
758
|
);
|
|
759
|
-
return /* @__PURE__ */
|
|
759
|
+
return /* @__PURE__ */ s(Ke.Provider, { value: u, children: /* @__PURE__ */ s(pn, { translations: d, translate: m, children: c }) });
|
|
760
760
|
}
|
|
761
761
|
function Xe() {
|
|
762
762
|
const n = _e(Ke);
|
|
@@ -765,21 +765,21 @@ function Xe() {
|
|
|
765
765
|
return n;
|
|
766
766
|
}
|
|
767
767
|
const yn = ({ currentType: n, onSelectReaction: e }) => {
|
|
768
|
-
const { translations: t } =
|
|
769
|
-
return
|
|
770
|
-
n ===
|
|
768
|
+
const { translations: t } = G(), o = ne(null), r = ne(null);
|
|
769
|
+
return Q(() => {
|
|
770
|
+
n === w.CONFUSING && o.current ? o.current.focus() : n === w.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
|
|
771
771
|
}, [n]), /* @__PURE__ */ S(ee, { children: [
|
|
772
|
-
/* @__PURE__ */ S(ee.Item, { ref: o, onClick: () => e(
|
|
773
|
-
/* @__PURE__ */
|
|
772
|
+
/* @__PURE__ */ S(ee.Item, { ref: o, onClick: () => e(w.CONFUSING), children: [
|
|
773
|
+
/* @__PURE__ */ s(Ne, { size: "x-small" }),
|
|
774
774
|
` ${t.markUnclear}`
|
|
775
775
|
] }),
|
|
776
|
-
/* @__PURE__ */ S(ee.Item, { ref: r, onClick: () => e(
|
|
777
|
-
/* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ S(ee.Item, { ref: r, onClick: () => e(w.IMPORTANT), children: [
|
|
777
|
+
/* @__PURE__ */ s(be, { size: "x-small" }),
|
|
778
778
|
` ${t.markImportant}`
|
|
779
779
|
] })
|
|
780
780
|
] });
|
|
781
781
|
}, de = "notebook-inline-reaction-menu";
|
|
782
|
-
function
|
|
782
|
+
function Vn({
|
|
783
783
|
containerRef: n,
|
|
784
784
|
highlightTheme: e,
|
|
785
785
|
debounceTime: t = 500
|
|
@@ -787,153 +787,153 @@ function Xn({
|
|
|
787
787
|
const {
|
|
788
788
|
api: o,
|
|
789
789
|
objectId: r,
|
|
790
|
-
objectType:
|
|
790
|
+
objectType: i,
|
|
791
791
|
courseId: l,
|
|
792
|
-
pageLastModifiedAt:
|
|
792
|
+
pageLastModifiedAt: d,
|
|
793
793
|
selectedNoteId: m,
|
|
794
|
-
selectNote:
|
|
794
|
+
selectNote: c,
|
|
795
795
|
openTray: g
|
|
796
796
|
} = Xe(), { data: h } = $e({
|
|
797
797
|
api: o,
|
|
798
798
|
filter: {
|
|
799
|
-
learningObject: { type:
|
|
799
|
+
learningObject: { type: i, id: r }
|
|
800
800
|
},
|
|
801
801
|
courseId: l,
|
|
802
802
|
pageSize: 100
|
|
803
|
-
}), { mutate: u } =
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
if (!
|
|
807
|
-
const b =
|
|
803
|
+
}), { mutate: u } = Dt(o), { mutate: E } = At(o), { mutate: f } = Lt(o), v = ne([]), [y, H] = B([]), [F, N] = B(null), [C, k] = B(""), [x, O] = B(null), [_, M] = B(!1);
|
|
804
|
+
Q(() => {
|
|
805
|
+
const R = n.current;
|
|
806
|
+
if (!R) return;
|
|
807
|
+
const b = R.closest(".user_content") ?? R;
|
|
808
808
|
if (b.classList.contains("enhanced")) {
|
|
809
809
|
M(!0);
|
|
810
810
|
return;
|
|
811
811
|
}
|
|
812
|
-
const
|
|
813
|
-
for (const
|
|
814
|
-
if (
|
|
815
|
-
M(!0),
|
|
812
|
+
const P = new MutationObserver((L) => {
|
|
813
|
+
for (const p of L)
|
|
814
|
+
if (p.type === "attributes" && p.attributeName === "class" && p.target.classList.contains("enhanced")) {
|
|
815
|
+
M(!0), P.disconnect();
|
|
816
816
|
return;
|
|
817
817
|
}
|
|
818
818
|
});
|
|
819
|
-
return
|
|
820
|
-
}, [n]),
|
|
821
|
-
if (!
|
|
819
|
+
return P.observe(b, { attributes: !0, attributeFilter: ["class"] }), () => P.disconnect();
|
|
820
|
+
}, [n]), Q(() => {
|
|
821
|
+
if (!_ || !n.current) return;
|
|
822
822
|
let b = null;
|
|
823
|
-
const
|
|
823
|
+
const P = () => {
|
|
824
824
|
b && clearTimeout(b), b = setTimeout(() => {
|
|
825
825
|
var xe;
|
|
826
|
-
const
|
|
827
|
-
if (!(
|
|
828
|
-
const
|
|
829
|
-
if (
|
|
830
|
-
const
|
|
831
|
-
if (!A.contains(
|
|
832
|
-
const Ce = (xe =
|
|
833
|
-
Ce && !
|
|
826
|
+
const I = window.getSelection(), A = n.current;
|
|
827
|
+
if (!(I != null && I.rangeCount) || !A) return;
|
|
828
|
+
const j = I.toString().trim();
|
|
829
|
+
if (j === "") return;
|
|
830
|
+
const J = I.getRangeAt(0);
|
|
831
|
+
if (!A.contains(J.commonAncestorContainer)) return;
|
|
832
|
+
const Ce = (xe = X.fromRange(A, J)) == null ? void 0 : xe.toSelector();
|
|
833
|
+
Ce && !Ct(Ce, y) && (N(J.cloneRange()), k(j), O(Tt(J)));
|
|
834
834
|
}, t);
|
|
835
|
-
},
|
|
836
|
-
if (!(
|
|
835
|
+
}, L = (I) => {
|
|
836
|
+
if (!(I.target instanceof Node)) return;
|
|
837
837
|
const A = document.getElementById(de);
|
|
838
|
-
A != null && A.contains(
|
|
839
|
-
},
|
|
840
|
-
|
|
838
|
+
A != null && A.contains(I.target) ? (I.preventDefault(), I.stopImmediatePropagation()) : (O(null), N(null), k(""));
|
|
839
|
+
}, p = () => {
|
|
840
|
+
O(null), N(null), k("");
|
|
841
841
|
};
|
|
842
|
-
return document.addEventListener("selectionchange",
|
|
843
|
-
b && clearTimeout(b), document.removeEventListener("selectionchange",
|
|
842
|
+
return document.addEventListener("selectionchange", P), document.addEventListener("mousedown", L), document.addEventListener("touchstart", L), window.addEventListener("scroll", p, !0), () => {
|
|
843
|
+
b && clearTimeout(b), document.removeEventListener("selectionchange", P), document.removeEventListener("mousedown", L), document.removeEventListener("touchstart", L), window.removeEventListener("scroll", p, !0);
|
|
844
844
|
};
|
|
845
|
-
}, [
|
|
846
|
-
m &&
|
|
845
|
+
}, [_, y, t, n]), Q(() => {
|
|
846
|
+
m && It(m);
|
|
847
847
|
}, [m]);
|
|
848
|
-
const D =
|
|
849
|
-
(
|
|
850
|
-
var
|
|
848
|
+
const D = K(
|
|
849
|
+
(R) => {
|
|
850
|
+
var j;
|
|
851
851
|
const b = n.current;
|
|
852
|
-
if (!b || !
|
|
853
|
-
const { highlightData:
|
|
852
|
+
if (!b || !R.highlightData) return null;
|
|
853
|
+
const { highlightData: P, reaction: L, id: p } = R, { range: I } = P, A = I && ((j = Y.fromSelector(b, I)) == null ? void 0 : j.toRange());
|
|
854
854
|
if (A) {
|
|
855
|
-
const
|
|
856
|
-
id:
|
|
855
|
+
const J = {
|
|
856
|
+
id: p,
|
|
857
857
|
selectedNoteId: m,
|
|
858
|
-
type:
|
|
858
|
+
type: L[0],
|
|
859
859
|
onClick: () => {
|
|
860
|
-
|
|
860
|
+
c(p), g();
|
|
861
861
|
}
|
|
862
862
|
};
|
|
863
|
-
return
|
|
863
|
+
return kt(A, J, e), P.textPosition;
|
|
864
864
|
}
|
|
865
865
|
return null;
|
|
866
866
|
},
|
|
867
|
-
[n, m, e,
|
|
867
|
+
[n, m, e, c, g]
|
|
868
868
|
);
|
|
869
|
-
|
|
870
|
-
if (!
|
|
871
|
-
const
|
|
869
|
+
Q(() => {
|
|
870
|
+
if (!_ || !h || !n.current) return;
|
|
871
|
+
const R = n.current, b = h.notes, P = /* @__PURE__ */ new Set(), L = [], p = [];
|
|
872
872
|
if (b.length === 0) {
|
|
873
873
|
if (v.current.length > 0) {
|
|
874
|
-
for (const
|
|
875
|
-
|
|
876
|
-
v.current = [],
|
|
874
|
+
for (const I of v.current)
|
|
875
|
+
Le(I, R);
|
|
876
|
+
v.current = [], H([]);
|
|
877
877
|
}
|
|
878
878
|
return;
|
|
879
879
|
}
|
|
880
|
-
if (
|
|
881
|
-
const { notesForUpdate:
|
|
882
|
-
|
|
880
|
+
if (d && b[0].highlightData.pageLastModifiedAt !== d) {
|
|
881
|
+
const { notesForUpdate: I, noteIdsForDelete: A } = vt(
|
|
882
|
+
R,
|
|
883
883
|
b,
|
|
884
|
-
|
|
884
|
+
d
|
|
885
885
|
);
|
|
886
|
-
for (const
|
|
887
|
-
E({ id:
|
|
888
|
-
for (const
|
|
889
|
-
f(
|
|
886
|
+
for (const j of I)
|
|
887
|
+
E({ id: j.id, input: j });
|
|
888
|
+
for (const j of A)
|
|
889
|
+
f(j);
|
|
890
890
|
} else {
|
|
891
|
-
for (const
|
|
892
|
-
const A = D(
|
|
893
|
-
|
|
891
|
+
for (const I of b) {
|
|
892
|
+
const A = D(I);
|
|
893
|
+
P.add(I.id), A && (L.push(I), p.push(A));
|
|
894
894
|
}
|
|
895
|
-
for (const
|
|
896
|
-
|
|
897
|
-
|
|
895
|
+
for (const I of v.current)
|
|
896
|
+
P.has(I.id) || Le(I, R);
|
|
897
|
+
H(p), v.current = L;
|
|
898
898
|
}
|
|
899
899
|
}, [
|
|
900
|
-
|
|
900
|
+
_,
|
|
901
901
|
h,
|
|
902
902
|
D,
|
|
903
|
-
|
|
903
|
+
d,
|
|
904
904
|
n,
|
|
905
905
|
E,
|
|
906
906
|
f
|
|
907
907
|
]);
|
|
908
|
-
const
|
|
908
|
+
const Z = (R) => {
|
|
909
909
|
const b = n.current;
|
|
910
|
-
if (!
|
|
911
|
-
const
|
|
910
|
+
if (!F || !b) return;
|
|
911
|
+
const P = Y.fromRange(b, F), L = X.fromRange(b, F);
|
|
912
912
|
u(
|
|
913
913
|
{
|
|
914
914
|
courseId: l,
|
|
915
915
|
objectId: r,
|
|
916
|
-
objectType:
|
|
916
|
+
objectType: i,
|
|
917
917
|
userText: "",
|
|
918
|
-
reaction: [
|
|
918
|
+
reaction: [R],
|
|
919
919
|
highlightData: {
|
|
920
920
|
selectedText: C,
|
|
921
|
-
textPosition: (
|
|
922
|
-
range:
|
|
923
|
-
pageLastModifiedAt:
|
|
921
|
+
textPosition: (L == null ? void 0 : L.toSelector()) ?? null,
|
|
922
|
+
range: P.toSelector(),
|
|
923
|
+
pageLastModifiedAt: d ?? ""
|
|
924
924
|
}
|
|
925
925
|
},
|
|
926
926
|
{
|
|
927
|
-
onSuccess: (
|
|
927
|
+
onSuccess: (p) => {
|
|
928
928
|
var A;
|
|
929
|
-
const
|
|
930
|
-
|
|
929
|
+
const I = p.id;
|
|
930
|
+
N(null), k(""), O(null), (A = window.getSelection()) == null || A.removeAllRanges(), c(I), g();
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
);
|
|
934
934
|
};
|
|
935
|
-
return !
|
|
936
|
-
/* @__PURE__ */
|
|
935
|
+
return !F || !x ? null : Ze(
|
|
936
|
+
/* @__PURE__ */ s(
|
|
937
937
|
"div",
|
|
938
938
|
{
|
|
939
939
|
id: de,
|
|
@@ -945,29 +945,29 @@ function Xn({
|
|
|
945
945
|
left: x.left,
|
|
946
946
|
whiteSpace: "nowrap"
|
|
947
947
|
},
|
|
948
|
-
onBlur: (
|
|
948
|
+
onBlur: (R) => {
|
|
949
949
|
const b = document.getElementById(de);
|
|
950
|
-
b != null && b.contains(
|
|
950
|
+
b != null && b.contains(R.relatedTarget) || (O(null), N(null), k(""));
|
|
951
951
|
},
|
|
952
|
-
children: /* @__PURE__ */
|
|
952
|
+
children: /* @__PURE__ */ s(yn, { onSelectReaction: Z })
|
|
953
953
|
}
|
|
954
954
|
),
|
|
955
955
|
document.body
|
|
956
956
|
);
|
|
957
957
|
}
|
|
958
|
-
const
|
|
959
|
-
backgroundColor: n ===
|
|
960
|
-
underlineColor: n ===
|
|
961
|
-
underlineStyle: n ===
|
|
958
|
+
const En = (n, e) => ({
|
|
959
|
+
backgroundColor: n === w.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
960
|
+
underlineColor: n === w.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
961
|
+
underlineStyle: n === w.IMPORTANT ? "solid" : "dashed"
|
|
962
962
|
}), he = ({
|
|
963
963
|
children: n,
|
|
964
|
-
type: e =
|
|
964
|
+
type: e = w.IMPORTANT,
|
|
965
965
|
isCardActive: t = !0,
|
|
966
966
|
theme: o
|
|
967
967
|
}) => {
|
|
968
|
-
const r =
|
|
968
|
+
const r = En(e, o), l = {
|
|
969
969
|
position: "relative",
|
|
970
|
-
backgroundColor: t ? r.backgroundColor :
|
|
970
|
+
backgroundColor: t ? r.backgroundColor : Ie(r.backgroundColor, 0.5),
|
|
971
971
|
textDecorationLine: "underline",
|
|
972
972
|
textDecorationStyle: r.underlineStyle,
|
|
973
973
|
textDecorationColor: r.underlineColor,
|
|
@@ -975,19 +975,19 @@ const bn = (n, e) => ({
|
|
|
975
975
|
textUnderlineOffset: o.underlineOffset,
|
|
976
976
|
lineHeight: "normal"
|
|
977
977
|
};
|
|
978
|
-
return /* @__PURE__ */
|
|
978
|
+
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: n });
|
|
979
979
|
}, Qe = () => {
|
|
980
|
-
const { translations: n } =
|
|
981
|
-
return /* @__PURE__ */ S(
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
980
|
+
const { translations: n } = G();
|
|
981
|
+
return /* @__PURE__ */ S(T, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
982
|
+
/* @__PURE__ */ s(T.Item, { as: "div", children: /* @__PURE__ */ s(tt, { color: "error" }) }),
|
|
983
|
+
/* @__PURE__ */ s(T.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(me, { maxLines: 3, children: n.highlightUnavailable }) })
|
|
984
984
|
] });
|
|
985
|
-
},
|
|
985
|
+
}, Sn = {
|
|
986
986
|
filter: null,
|
|
987
987
|
courseFilter: null,
|
|
988
988
|
pageParamsWithDirection: {}
|
|
989
989
|
};
|
|
990
|
-
function
|
|
990
|
+
function vn(n, e) {
|
|
991
991
|
switch (e.type) {
|
|
992
992
|
case "SET_FILTER":
|
|
993
993
|
return { ...n, filter: e.payload, pageParamsWithDirection: {} };
|
|
@@ -999,79 +999,79 @@ function Sn(n, e) {
|
|
|
999
999
|
return n;
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1002
|
+
function Yn({
|
|
1003
1003
|
api: n,
|
|
1004
1004
|
courseId: e,
|
|
1005
1005
|
enableCourseFilter: t = !1,
|
|
1006
1006
|
learningObject: o,
|
|
1007
1007
|
pageSize: r = 16
|
|
1008
1008
|
}) {
|
|
1009
|
-
const [
|
|
1010
|
-
|
|
1011
|
-
Object.keys(
|
|
1009
|
+
const [i, l] = Fe(vn, Sn), { filter: d, courseFilter: m, pageParamsWithDirection: c } = i;
|
|
1010
|
+
Q(() => {
|
|
1011
|
+
Object.keys(c).length > 0 && l({ type: "SET_PAGE_PARAMS_WITH_DIRECTION", payload: {} });
|
|
1012
1012
|
}, [r]);
|
|
1013
|
-
const g = t ? m : e, { direction: h, pageParams: u } =
|
|
1013
|
+
const g = t ? m : e, { direction: h, pageParams: u } = c, E = h === "next" ? (u == null ? void 0 : u.endCursor) ?? void 0 : h === "prev" ? (u == null ? void 0 : u.startCursor) ?? void 0 : void 0, { data: f, isLoading: v, isError: y } = $e({
|
|
1014
1014
|
api: n,
|
|
1015
1015
|
filter: {
|
|
1016
1016
|
...g ? { courseId: g } : {},
|
|
1017
|
-
...
|
|
1017
|
+
...d ? { reactions: [d] } : {},
|
|
1018
1018
|
...o ? { learningObject: o } : {}
|
|
1019
1019
|
},
|
|
1020
1020
|
cursor: E,
|
|
1021
1021
|
direction: h,
|
|
1022
1022
|
pageSize: r
|
|
1023
|
-
}),
|
|
1023
|
+
}), H = (f == null ? void 0 : f.notes) ?? [], F = f == null ? void 0 : f.pageInfo, N = K(() => {
|
|
1024
1024
|
l({
|
|
1025
1025
|
type: "SET_PAGE_PARAMS_WITH_DIRECTION",
|
|
1026
1026
|
payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "next" }
|
|
1027
1027
|
});
|
|
1028
|
-
}, [f == null ? void 0 : f.pageInfo]), C =
|
|
1028
|
+
}, [f == null ? void 0 : f.pageInfo]), C = K(() => {
|
|
1029
1029
|
l({
|
|
1030
1030
|
type: "SET_PAGE_PARAMS_WITH_DIRECTION",
|
|
1031
1031
|
payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "prev" }
|
|
1032
1032
|
});
|
|
1033
|
-
}, [f == null ? void 0 : f.pageInfo]),
|
|
1034
|
-
l({ type: "SET_FILTER", payload:
|
|
1035
|
-
}, []), x =
|
|
1036
|
-
l({ type: "SET_COURSE_FILTER", payload:
|
|
1033
|
+
}, [f == null ? void 0 : f.pageInfo]), k = K((O) => {
|
|
1034
|
+
l({ type: "SET_FILTER", payload: O });
|
|
1035
|
+
}, []), x = K((O) => {
|
|
1036
|
+
l({ type: "SET_COURSE_FILTER", payload: O });
|
|
1037
1037
|
}, []);
|
|
1038
1038
|
return {
|
|
1039
|
-
notes:
|
|
1040
|
-
pageInfo:
|
|
1039
|
+
notes: H,
|
|
1040
|
+
pageInfo: F,
|
|
1041
1041
|
isLoading: v,
|
|
1042
1042
|
isError: y,
|
|
1043
|
-
filter:
|
|
1043
|
+
filter: d,
|
|
1044
1044
|
courseFilter: m,
|
|
1045
|
-
setFilter:
|
|
1045
|
+
setFilter: k,
|
|
1046
1046
|
setCourseFilter: x,
|
|
1047
|
-
fetchNextPage:
|
|
1047
|
+
fetchNextPage: N,
|
|
1048
1048
|
fetchPreviousPage: C
|
|
1049
1049
|
};
|
|
1050
1050
|
}
|
|
1051
1051
|
const ue = "all";
|
|
1052
|
-
function
|
|
1053
|
-
const { translations: t } =
|
|
1052
|
+
function Zn({ filter: n, setFilter: e }) {
|
|
1053
|
+
const { translations: t } = G(), o = re(
|
|
1054
1054
|
() => [
|
|
1055
1055
|
{ label: t.allNotes, value: ue },
|
|
1056
|
-
{ label: t.important, value:
|
|
1057
|
-
{ label: t.unclear, value:
|
|
1056
|
+
{ label: t.important, value: w.IMPORTANT },
|
|
1057
|
+
{ label: t.unclear, value: w.CONFUSING }
|
|
1058
1058
|
],
|
|
1059
1059
|
[t]
|
|
1060
|
-
), r =
|
|
1061
|
-
(l, { value:
|
|
1062
|
-
e(!
|
|
1060
|
+
), r = K(
|
|
1061
|
+
(l, { value: d }) => {
|
|
1062
|
+
e(!d || d === ue ? null : d);
|
|
1063
1063
|
},
|
|
1064
1064
|
[e]
|
|
1065
1065
|
);
|
|
1066
1066
|
return {
|
|
1067
|
-
filterElement:
|
|
1068
|
-
() => /* @__PURE__ */
|
|
1067
|
+
filterElement: re(
|
|
1068
|
+
() => /* @__PURE__ */ s(
|
|
1069
1069
|
we,
|
|
1070
1070
|
{
|
|
1071
|
-
renderLabel: /* @__PURE__ */
|
|
1071
|
+
renderLabel: /* @__PURE__ */ s(Me, { children: t.notes }),
|
|
1072
1072
|
value: n ?? ue,
|
|
1073
1073
|
onChange: r,
|
|
1074
|
-
children: o.map((l) => /* @__PURE__ */
|
|
1074
|
+
children: o.map((l) => /* @__PURE__ */ s(we.Option, { id: l.value, value: l.value, children: l.label }, l.value))
|
|
1075
1075
|
}
|
|
1076
1076
|
),
|
|
1077
1077
|
[n, o, r, t.notes]
|
|
@@ -1080,21 +1080,28 @@ function Yn({ filter: n, setFilter: e }) {
|
|
|
1080
1080
|
handleReactionFilterChange: r
|
|
1081
1081
|
};
|
|
1082
1082
|
}
|
|
1083
|
-
const
|
|
1084
|
-
const {
|
|
1085
|
-
return /* @__PURE__ */
|
|
1086
|
-
|
|
1083
|
+
const In = ({ hasActiveFilter: n = !1 }) => {
|
|
1084
|
+
const { translations: e } = G(), t = n ? e.nothingHereYet : e.emptyStateHeading, o = n ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1085
|
+
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", children: /* @__PURE__ */ S(T, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1086
|
+
!n && /* @__PURE__ */ s(nt, { size: "medium" }),
|
|
1087
|
+
/* @__PURE__ */ s(ae, { level: "h3", children: t }),
|
|
1088
|
+
/* @__PURE__ */ s(U, { color: "secondary", children: o })
|
|
1089
|
+
] }) });
|
|
1090
|
+
}, Jn = ({ children: n }) => {
|
|
1091
|
+
const { isTrayOpen: e, closeTray: t } = Xe(), { translations: o } = G();
|
|
1092
|
+
return /* @__PURE__ */ s(
|
|
1093
|
+
lt,
|
|
1087
1094
|
{
|
|
1088
1095
|
label: o.notebook,
|
|
1089
1096
|
open: e,
|
|
1090
1097
|
onDismiss: t,
|
|
1091
1098
|
placement: "end",
|
|
1092
1099
|
size: "regular",
|
|
1093
|
-
children: /* @__PURE__ */ S(
|
|
1094
|
-
/* @__PURE__ */
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1097
|
-
|
|
1100
|
+
children: /* @__PURE__ */ S(T, { direction: "column", height: "100vh", children: [
|
|
1101
|
+
/* @__PURE__ */ s(T.Item, { children: /* @__PURE__ */ s(z, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ S(T, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1102
|
+
/* @__PURE__ */ s(ae, { level: "h3", children: o.notebook }),
|
|
1103
|
+
/* @__PURE__ */ s(
|
|
1104
|
+
it,
|
|
1098
1105
|
{
|
|
1099
1106
|
screenReaderLabel: o.closeNotebookPanel,
|
|
1100
1107
|
onClick: t,
|
|
@@ -1103,25 +1110,25 @@ const Vn = ({ children: n }) => {
|
|
|
1103
1110
|
}
|
|
1104
1111
|
)
|
|
1105
1112
|
] }) }) }),
|
|
1106
|
-
/* @__PURE__ */
|
|
1113
|
+
/* @__PURE__ */ s(T.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: n })
|
|
1107
1114
|
] })
|
|
1108
1115
|
}
|
|
1109
1116
|
);
|
|
1110
|
-
},
|
|
1111
|
-
[
|
|
1117
|
+
}, Tn = {
|
|
1118
|
+
[w.IMPORTANT]: {
|
|
1112
1119
|
color: "success",
|
|
1113
1120
|
translationKey: "important",
|
|
1114
|
-
icon: /* @__PURE__ */
|
|
1121
|
+
icon: /* @__PURE__ */ s(be, { size: "x-small" })
|
|
1115
1122
|
},
|
|
1116
|
-
[
|
|
1123
|
+
[w.CONFUSING]: {
|
|
1117
1124
|
color: "danger",
|
|
1118
1125
|
translationKey: "unclear",
|
|
1119
|
-
icon: /* @__PURE__ */
|
|
1126
|
+
icon: /* @__PURE__ */ s(Ne, { size: "x-small" })
|
|
1120
1127
|
}
|
|
1121
|
-
},
|
|
1122
|
-
const { translations: o } =
|
|
1128
|
+
}, Ve = ({ type: n, onTypeChange: e, renderAsMenuTrigger: t = !1 }) => {
|
|
1129
|
+
const { translations: o } = G(), r = Tn[n], i = o[r.translationKey], [l, d] = B(!1), m = ne(null), c = ne(null), g = K(
|
|
1123
1130
|
(h) => {
|
|
1124
|
-
e == null || e(h),
|
|
1131
|
+
e == null || e(h), d(!1);
|
|
1125
1132
|
},
|
|
1126
1133
|
[e]
|
|
1127
1134
|
);
|
|
@@ -1130,41 +1137,41 @@ const Vn = ({ children: n }) => {
|
|
|
1130
1137
|
{
|
|
1131
1138
|
placement: "bottom start",
|
|
1132
1139
|
show: l,
|
|
1133
|
-
onToggle: (h) =>
|
|
1140
|
+
onToggle: (h) => d(h),
|
|
1134
1141
|
shouldHideOnSelect: !0,
|
|
1135
1142
|
shouldFocusTriggerOnClose: !0,
|
|
1136
|
-
trigger: /* @__PURE__ */
|
|
1143
|
+
trigger: /* @__PURE__ */ s(ke, { color: r.color, renderIcon: r.icon, children: i }),
|
|
1137
1144
|
children: [
|
|
1138
|
-
/* @__PURE__ */ S(ee.Item, { ref: m, onClick: () => g(
|
|
1139
|
-
/* @__PURE__ */
|
|
1145
|
+
/* @__PURE__ */ S(ee.Item, { ref: m, onClick: () => g(w.CONFUSING), children: [
|
|
1146
|
+
/* @__PURE__ */ s(Ne, { size: "x-small" }),
|
|
1140
1147
|
` ${o.markUnclear}`
|
|
1141
1148
|
] }),
|
|
1142
|
-
/* @__PURE__ */ S(ee.Item, { ref:
|
|
1143
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ S(ee.Item, { ref: c, onClick: () => g(w.IMPORTANT), children: [
|
|
1150
|
+
/* @__PURE__ */ s(be, { size: "x-small" }),
|
|
1144
1151
|
` ${o.markImportant}`
|
|
1145
1152
|
] })
|
|
1146
1153
|
]
|
|
1147
1154
|
}
|
|
1148
|
-
) : /* @__PURE__ */
|
|
1155
|
+
) : /* @__PURE__ */ s(z, { display: "inline-flex", children: /* @__PURE__ */ s(ke, { color: r.color, renderIcon: r.icon, children: i }) });
|
|
1149
1156
|
};
|
|
1150
|
-
function
|
|
1157
|
+
function Ae(n, e) {
|
|
1151
1158
|
return (n instanceof Date ? n : new Date(n)).toLocaleString(e, {
|
|
1152
1159
|
year: "numeric",
|
|
1153
1160
|
month: "short",
|
|
1154
1161
|
day: "numeric"
|
|
1155
1162
|
});
|
|
1156
1163
|
}
|
|
1157
|
-
const
|
|
1164
|
+
const Cn = ({
|
|
1158
1165
|
noteId: n,
|
|
1159
1166
|
date: e,
|
|
1160
1167
|
highlight: t,
|
|
1161
1168
|
note: o,
|
|
1162
1169
|
type: r,
|
|
1163
|
-
onClick:
|
|
1170
|
+
onClick: i,
|
|
1164
1171
|
onDelete: l,
|
|
1165
|
-
onSaveNote:
|
|
1172
|
+
onSaveNote: d,
|
|
1166
1173
|
onTypeChange: m,
|
|
1167
|
-
isActive:
|
|
1174
|
+
isActive: c,
|
|
1168
1175
|
isPanelView: g = !1,
|
|
1169
1176
|
courseName: h,
|
|
1170
1177
|
locale: u,
|
|
@@ -1172,68 +1179,76 @@ const Tn = ({
|
|
|
1172
1179
|
renderLink: f,
|
|
1173
1180
|
href: v
|
|
1174
1181
|
}) => {
|
|
1175
|
-
const { translations: y } =
|
|
1176
|
-
|
|
1177
|
-
},
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1182
|
+
const { translations: y } = G(), [H, F] = B(!1), [N, C] = B(!1), [k, x] = B(o || ""), [O, _] = B(!1), M = ne(null), D = K((p) => {
|
|
1183
|
+
M.current = p;
|
|
1184
|
+
}, []);
|
|
1185
|
+
Q(() => {
|
|
1186
|
+
var p;
|
|
1187
|
+
c && ((p = M.current) == null || p.scrollIntoView({ behavior: "smooth", block: "nearest" }));
|
|
1188
|
+
}, [c]);
|
|
1189
|
+
const Z = r === w.IMPORTANT ? y.important : y.unclear, R = (p) => {
|
|
1190
|
+
p.key === "Enter" && (p.preventDefault(), i == null || i());
|
|
1191
|
+
}, b = [Z, y.note];
|
|
1192
|
+
t && b.push(t), o && b.push(o), e && b.push(Ae(e, u)), h && b.push(h);
|
|
1193
|
+
const P = b.join(", "), L = /* @__PURE__ */ S(
|
|
1194
|
+
z,
|
|
1181
1195
|
{
|
|
1182
1196
|
as: "div",
|
|
1183
1197
|
borderWidth: "small",
|
|
1184
1198
|
borderRadius: "medium",
|
|
1185
1199
|
padding: "small",
|
|
1186
1200
|
position: "relative",
|
|
1187
|
-
role: v ||
|
|
1188
|
-
"aria-label": v ? void 0 :
|
|
1189
|
-
"aria-pressed": v ||
|
|
1190
|
-
tabIndex: v ||
|
|
1201
|
+
role: v || N ? void 0 : "button",
|
|
1202
|
+
"aria-label": v ? void 0 : P,
|
|
1203
|
+
"aria-pressed": v || N ? void 0 : c,
|
|
1204
|
+
tabIndex: v || c ? -1 : 0,
|
|
1191
1205
|
"data-testid": "note-card",
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1206
|
+
elementRef: D,
|
|
1207
|
+
onClick: c ? void 0 : i,
|
|
1208
|
+
onMouseEnter: () => F(!0),
|
|
1209
|
+
onMouseLeave: () => F(!1),
|
|
1210
|
+
onKeyDown: c ? void 0 : R,
|
|
1211
|
+
cursor: N ? "default" : "pointer",
|
|
1197
1212
|
children: [
|
|
1198
|
-
/* @__PURE__ */ S(
|
|
1199
|
-
/* @__PURE__ */
|
|
1200
|
-
|
|
1213
|
+
/* @__PURE__ */ S(T, { direction: "column", gap: "small", children: [
|
|
1214
|
+
/* @__PURE__ */ s(
|
|
1215
|
+
Ve,
|
|
1201
1216
|
{
|
|
1202
1217
|
type: r,
|
|
1203
|
-
onTypeChange: g && m ? (
|
|
1204
|
-
renderAsMenuTrigger: g && !!m && !!
|
|
1218
|
+
onTypeChange: g && m ? (p) => m(n, p) : void 0,
|
|
1219
|
+
renderAsMenuTrigger: g && !!m && !!c
|
|
1205
1220
|
}
|
|
1206
1221
|
),
|
|
1207
|
-
t ? /* @__PURE__ */
|
|
1222
|
+
t ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(U, { children: c && g ? /* @__PURE__ */ s(
|
|
1208
1223
|
he,
|
|
1209
1224
|
{
|
|
1210
1225
|
type: r,
|
|
1211
|
-
isCardActive: !!
|
|
1226
|
+
isCardActive: !!c || H,
|
|
1212
1227
|
theme: E,
|
|
1213
1228
|
children: t
|
|
1214
1229
|
}
|
|
1215
|
-
) : /* @__PURE__ */
|
|
1230
|
+
) : /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ s(
|
|
1216
1231
|
he,
|
|
1217
1232
|
{
|
|
1218
1233
|
type: r,
|
|
1219
|
-
isCardActive: !!
|
|
1234
|
+
isCardActive: !!c || H,
|
|
1220
1235
|
theme: E,
|
|
1221
1236
|
children: t
|
|
1222
1237
|
}
|
|
1223
|
-
) }) }) }) : /* @__PURE__ */
|
|
1224
|
-
/* @__PURE__ */ S(
|
|
1225
|
-
|
|
1226
|
-
/* @__PURE__ */
|
|
1238
|
+
) }) }) }) : /* @__PURE__ */ s(Qe, {}),
|
|
1239
|
+
/* @__PURE__ */ S(T, { direction: "column", gap: "small", children: [
|
|
1240
|
+
N && g ? /* @__PURE__ */ S(T, { direction: "column", gap: "x-small", children: [
|
|
1241
|
+
/* @__PURE__ */ s(
|
|
1227
1242
|
He,
|
|
1228
1243
|
{
|
|
1229
|
-
label: /* @__PURE__ */
|
|
1230
|
-
value:
|
|
1231
|
-
onChange: (
|
|
1244
|
+
label: /* @__PURE__ */ s(Me, { children: y.editNote }),
|
|
1245
|
+
value: k,
|
|
1246
|
+
onChange: (p) => x(p.target.value),
|
|
1232
1247
|
placeholder: y.addNoteOptional
|
|
1233
1248
|
}
|
|
1234
1249
|
),
|
|
1235
|
-
/* @__PURE__ */ S(
|
|
1236
|
-
/* @__PURE__ */
|
|
1250
|
+
/* @__PURE__ */ S(T, { gap: "xx-small", children: [
|
|
1251
|
+
/* @__PURE__ */ s(T.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1237
1252
|
$,
|
|
1238
1253
|
{
|
|
1239
1254
|
display: "block",
|
|
@@ -1245,7 +1260,7 @@ const Tn = ({
|
|
|
1245
1260
|
children: y.cancel
|
|
1246
1261
|
}
|
|
1247
1262
|
) }),
|
|
1248
|
-
/* @__PURE__ */
|
|
1263
|
+
/* @__PURE__ */ s(T.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1249
1264
|
$,
|
|
1250
1265
|
{
|
|
1251
1266
|
display: "block",
|
|
@@ -1253,52 +1268,52 @@ const Tn = ({
|
|
|
1253
1268
|
size: "small",
|
|
1254
1269
|
"data-testid": "note-card-save",
|
|
1255
1270
|
onClick: () => {
|
|
1256
|
-
|
|
1271
|
+
d == null || d(n, k), C(!1);
|
|
1257
1272
|
},
|
|
1258
|
-
interaction:
|
|
1273
|
+
interaction: k.trim() ? "enabled" : "disabled",
|
|
1259
1274
|
children: y.save
|
|
1260
1275
|
}
|
|
1261
1276
|
) })
|
|
1262
1277
|
] })
|
|
1263
|
-
] }) : o ? /* @__PURE__ */
|
|
1278
|
+
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && g ? /* @__PURE__ */ S(U, { children: [
|
|
1264
1279
|
o,
|
|
1265
1280
|
" ",
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
|
|
1281
|
+
/* @__PURE__ */ s(
|
|
1282
|
+
V,
|
|
1268
1283
|
{
|
|
1269
1284
|
size: "small",
|
|
1270
1285
|
withBackground: !1,
|
|
1271
1286
|
withBorder: !1,
|
|
1272
1287
|
screenReaderLabel: y.editNote,
|
|
1273
1288
|
"data-testid": "note-card-edit",
|
|
1274
|
-
onClick: (
|
|
1275
|
-
|
|
1289
|
+
onClick: (p) => {
|
|
1290
|
+
p.stopPropagation(), C(!0);
|
|
1276
1291
|
},
|
|
1277
|
-
children: /* @__PURE__ */
|
|
1292
|
+
children: /* @__PURE__ */ s(fe, {})
|
|
1278
1293
|
}
|
|
1279
1294
|
)
|
|
1280
|
-
] }) : /* @__PURE__ */
|
|
1295
|
+
] }) : /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: o }) }) }) : g && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ S(U, { color: "secondary", children: [
|
|
1281
1296
|
y.addNotePrompt,
|
|
1282
1297
|
" ",
|
|
1283
|
-
/* @__PURE__ */
|
|
1284
|
-
|
|
1298
|
+
/* @__PURE__ */ s(
|
|
1299
|
+
V,
|
|
1285
1300
|
{
|
|
1286
1301
|
size: "small",
|
|
1287
1302
|
withBackground: !1,
|
|
1288
1303
|
withBorder: !1,
|
|
1289
1304
|
screenReaderLabel: y.editNote,
|
|
1290
1305
|
"data-testid": "note-card-edit",
|
|
1291
|
-
onClick: (
|
|
1292
|
-
|
|
1306
|
+
onClick: (p) => {
|
|
1307
|
+
p.stopPropagation(), C(!0);
|
|
1293
1308
|
},
|
|
1294
|
-
children: /* @__PURE__ */
|
|
1309
|
+
children: /* @__PURE__ */ s(fe, {})
|
|
1295
1310
|
}
|
|
1296
1311
|
)
|
|
1297
1312
|
] }) }) : null,
|
|
1298
|
-
/* @__PURE__ */ S(
|
|
1299
|
-
/* @__PURE__ */
|
|
1300
|
-
|
|
1301
|
-
|
|
1313
|
+
/* @__PURE__ */ S(T, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1314
|
+
/* @__PURE__ */ s(U, { size: "small", color: "secondary", children: Ae(e, u) }),
|
|
1315
|
+
c && l && /* @__PURE__ */ s(
|
|
1316
|
+
V,
|
|
1302
1317
|
{
|
|
1303
1318
|
size: "small",
|
|
1304
1319
|
withBackground: !1,
|
|
@@ -1306,18 +1321,18 @@ const Tn = ({
|
|
|
1306
1321
|
color: "danger",
|
|
1307
1322
|
screenReaderLabel: y.deleteNote,
|
|
1308
1323
|
"data-testid": "note-card-delete",
|
|
1309
|
-
onClick: (
|
|
1310
|
-
|
|
1324
|
+
onClick: (p) => {
|
|
1325
|
+
p.stopPropagation(), _(!0);
|
|
1311
1326
|
},
|
|
1312
|
-
children: /* @__PURE__ */
|
|
1327
|
+
children: /* @__PURE__ */ s(le, {})
|
|
1313
1328
|
}
|
|
1314
1329
|
)
|
|
1315
1330
|
] }),
|
|
1316
|
-
h && /* @__PURE__ */
|
|
1331
|
+
h && /* @__PURE__ */ s(U, { size: "small", color: "secondary", children: h })
|
|
1317
1332
|
] })
|
|
1318
1333
|
] }),
|
|
1319
|
-
|
|
1320
|
-
|
|
1334
|
+
O && l && /* @__PURE__ */ s(
|
|
1335
|
+
z,
|
|
1321
1336
|
{
|
|
1322
1337
|
as: "div",
|
|
1323
1338
|
background: "primary",
|
|
@@ -1330,7 +1345,7 @@ const Tn = ({
|
|
|
1330
1345
|
insetInlineEnd: "0",
|
|
1331
1346
|
stacking: "above",
|
|
1332
1347
|
children: /* @__PURE__ */ S(
|
|
1333
|
-
|
|
1348
|
+
T,
|
|
1334
1349
|
{
|
|
1335
1350
|
direction: "column",
|
|
1336
1351
|
justifyItems: "center",
|
|
@@ -1338,28 +1353,28 @@ const Tn = ({
|
|
|
1338
1353
|
gap: "x-small",
|
|
1339
1354
|
height: "100%",
|
|
1340
1355
|
children: [
|
|
1341
|
-
/* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ s(
|
|
1342
1357
|
$,
|
|
1343
1358
|
{
|
|
1344
1359
|
display: "block",
|
|
1345
1360
|
color: "danger",
|
|
1346
1361
|
size: "small",
|
|
1347
|
-
renderIcon: /* @__PURE__ */
|
|
1362
|
+
renderIcon: /* @__PURE__ */ s(le, {}),
|
|
1348
1363
|
"data-testid": "note-card-confirm-delete",
|
|
1349
|
-
onClick: (
|
|
1350
|
-
|
|
1364
|
+
onClick: (p) => {
|
|
1365
|
+
p.stopPropagation(), l(n), _(!1);
|
|
1351
1366
|
},
|
|
1352
1367
|
children: y.deleteNote
|
|
1353
1368
|
}
|
|
1354
1369
|
),
|
|
1355
|
-
/* @__PURE__ */
|
|
1370
|
+
/* @__PURE__ */ s(
|
|
1356
1371
|
$,
|
|
1357
1372
|
{
|
|
1358
1373
|
display: "block",
|
|
1359
1374
|
size: "small",
|
|
1360
1375
|
"data-testid": "note-card-cancel-delete",
|
|
1361
|
-
onClick: (
|
|
1362
|
-
|
|
1376
|
+
onClick: (p) => {
|
|
1377
|
+
p.stopPropagation(), _(!1);
|
|
1363
1378
|
},
|
|
1364
1379
|
children: y.cancel
|
|
1365
1380
|
}
|
|
@@ -1372,38 +1387,38 @@ const Tn = ({
|
|
|
1372
1387
|
]
|
|
1373
1388
|
}
|
|
1374
1389
|
);
|
|
1375
|
-
return v && f ? f({ href: v, children:
|
|
1390
|
+
return v && f ? f({ href: v, children: L, ariaLabel: P }) : L;
|
|
1376
1391
|
};
|
|
1377
|
-
function
|
|
1392
|
+
function xn(n, e) {
|
|
1378
1393
|
const t = Array.from({ length: e }, () => []);
|
|
1379
1394
|
return n.forEach((o, r) => {
|
|
1380
1395
|
t[r % e].push(o);
|
|
1381
1396
|
}), t;
|
|
1382
1397
|
}
|
|
1383
|
-
const
|
|
1398
|
+
const wn = {
|
|
1384
1399
|
display: "flex",
|
|
1385
1400
|
gap: "1rem",
|
|
1386
1401
|
padding: "1rem",
|
|
1387
1402
|
boxSizing: "border-box",
|
|
1388
1403
|
width: "100%",
|
|
1389
1404
|
alignItems: "flex-start"
|
|
1390
|
-
},
|
|
1405
|
+
}, kn = {
|
|
1391
1406
|
display: "flex",
|
|
1392
1407
|
flexDirection: "column",
|
|
1393
1408
|
gap: "1rem",
|
|
1394
1409
|
flex: 1,
|
|
1395
1410
|
minWidth: 0
|
|
1396
|
-
},
|
|
1411
|
+
}, eo = ({
|
|
1397
1412
|
notes: n,
|
|
1398
1413
|
isLoading: e,
|
|
1399
1414
|
isError: t,
|
|
1400
1415
|
pageInfo: o,
|
|
1401
1416
|
onPreviousPage: r,
|
|
1402
|
-
onNextPage:
|
|
1417
|
+
onNextPage: i,
|
|
1403
1418
|
onNoteSelect: l,
|
|
1404
|
-
onNoteDelete:
|
|
1419
|
+
onNoteDelete: d,
|
|
1405
1420
|
onNoteSave: m,
|
|
1406
|
-
onNoteTypeChange:
|
|
1421
|
+
onNoteTypeChange: c,
|
|
1407
1422
|
selectedNoteId: g,
|
|
1408
1423
|
hasActiveFilter: h = !1,
|
|
1409
1424
|
columnCount: u = 1,
|
|
@@ -1412,51 +1427,29 @@ const Cn = {
|
|
|
1412
1427
|
renderNoteLink: v,
|
|
1413
1428
|
noteHref: y
|
|
1414
1429
|
}) => {
|
|
1415
|
-
const { translations:
|
|
1416
|
-
() =>
|
|
1430
|
+
const { translations: H } = G(), F = re(
|
|
1431
|
+
() => xn(n, u),
|
|
1417
1432
|
[n, u]
|
|
1418
|
-
),
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
I,
|
|
1427
|
-
{
|
|
1428
|
-
direction: "column",
|
|
1429
|
-
alignItems: "center",
|
|
1430
|
-
justifyItems: "center",
|
|
1431
|
-
padding: "large",
|
|
1432
|
-
gap: "small",
|
|
1433
|
-
"data-testid": "empty-notes",
|
|
1434
|
-
children: [
|
|
1435
|
-
/* @__PURE__ */ i(ae, { level: "h3", children: C }),
|
|
1436
|
-
/* @__PURE__ */ i(U, { color: "secondary", children: w })
|
|
1437
|
-
]
|
|
1438
|
-
}
|
|
1439
|
-
);
|
|
1440
|
-
}
|
|
1441
|
-
return /* @__PURE__ */ S(Ve, { children: [
|
|
1442
|
-
/* @__PURE__ */ i("div", { style: Cn, "data-testid": "notes-grid", children: _.map((C, w) => (
|
|
1443
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: columns are positional, index is stable
|
|
1444
|
-
/* @__PURE__ */ i("div", { style: xn, children: C.map((x) => {
|
|
1445
|
-
var R;
|
|
1446
|
-
return /* @__PURE__ */ i(
|
|
1447
|
-
Tn,
|
|
1433
|
+
), N = (o == null ? void 0 : o.hasNextPage) || (o == null ? void 0 : o.hasPreviousPage);
|
|
1434
|
+
return e ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(at, { renderTitle: H.loadingNotes }) }) : t ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(ae, { level: "h4", children: H.failedToLoadNotes }) }) : n.length === 0 ? /* @__PURE__ */ s(z, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(In, { hasActiveFilter: h }) }) : /* @__PURE__ */ S(Ye, { children: [
|
|
1435
|
+
/* @__PURE__ */ s("div", { style: wn, "data-testid": "notes-grid", children: F.map((C, k) => (
|
|
1436
|
+
// oxlint-disable-next-line react/no-array-index-key -- columns are positional, index is stable
|
|
1437
|
+
/* @__PURE__ */ s("div", { style: kn, children: C.map((x) => {
|
|
1438
|
+
var O;
|
|
1439
|
+
return /* @__PURE__ */ s(
|
|
1440
|
+
Cn,
|
|
1448
1441
|
{
|
|
1449
1442
|
noteId: x.id,
|
|
1450
1443
|
date: x.createdAt,
|
|
1451
|
-
type: x.reaction[0] ??
|
|
1452
|
-
highlight: (
|
|
1444
|
+
type: x.reaction[0] ?? w.IMPORTANT,
|
|
1445
|
+
highlight: (O = x.highlightData) == null ? void 0 : O.selectedText,
|
|
1453
1446
|
note: x.userText,
|
|
1454
1447
|
isActive: g === x.id,
|
|
1455
1448
|
isPanelView: !!g,
|
|
1456
1449
|
onClick: l ? () => l(x.id) : void 0,
|
|
1457
|
-
onDelete:
|
|
1458
|
-
onSaveNote: m ? (
|
|
1459
|
-
onTypeChange:
|
|
1450
|
+
onDelete: d ? (_) => d(_) : void 0,
|
|
1451
|
+
onSaveNote: m ? (_, M) => m(_, M) : void 0,
|
|
1452
|
+
onTypeChange: c ? (_, M) => c(_, M) : void 0,
|
|
1460
1453
|
highlightTheme: E,
|
|
1461
1454
|
locale: f,
|
|
1462
1455
|
renderLink: v,
|
|
@@ -1464,60 +1457,60 @@ const Cn = {
|
|
|
1464
1457
|
},
|
|
1465
1458
|
x.id
|
|
1466
1459
|
);
|
|
1467
|
-
}) },
|
|
1460
|
+
}) }, k)
|
|
1468
1461
|
)) }),
|
|
1469
|
-
|
|
1470
|
-
/* @__PURE__ */
|
|
1471
|
-
|
|
1462
|
+
N && /* @__PURE__ */ S(T, { justifyItems: "center", gap: "small", padding: "small", "data-testid": "notes-pagination", children: [
|
|
1463
|
+
/* @__PURE__ */ s(
|
|
1464
|
+
V,
|
|
1472
1465
|
{
|
|
1473
1466
|
size: "small",
|
|
1474
|
-
screenReaderLabel:
|
|
1467
|
+
screenReaderLabel: H.previousPage,
|
|
1475
1468
|
"data-testid": "notes-prev-page",
|
|
1476
1469
|
interaction: o != null && o.hasPreviousPage ? "enabled" : "disabled",
|
|
1477
1470
|
onClick: r,
|
|
1478
|
-
children: /* @__PURE__ */
|
|
1471
|
+
children: /* @__PURE__ */ s(ot, {})
|
|
1479
1472
|
}
|
|
1480
1473
|
),
|
|
1481
|
-
/* @__PURE__ */
|
|
1482
|
-
|
|
1474
|
+
/* @__PURE__ */ s(
|
|
1475
|
+
V,
|
|
1483
1476
|
{
|
|
1484
1477
|
size: "small",
|
|
1485
|
-
screenReaderLabel:
|
|
1478
|
+
screenReaderLabel: H.nextPage,
|
|
1486
1479
|
"data-testid": "notes-next-page",
|
|
1487
1480
|
interaction: o != null && o.hasNextPage ? "enabled" : "disabled",
|
|
1488
|
-
onClick:
|
|
1489
|
-
children: /* @__PURE__ */
|
|
1481
|
+
onClick: i,
|
|
1482
|
+
children: /* @__PURE__ */ s(rt, {})
|
|
1490
1483
|
}
|
|
1491
1484
|
)
|
|
1492
1485
|
] })
|
|
1493
1486
|
] });
|
|
1494
|
-
},
|
|
1487
|
+
}, to = ({
|
|
1495
1488
|
noteText: n,
|
|
1496
1489
|
reaction: e,
|
|
1497
1490
|
highlightText: t,
|
|
1498
1491
|
highlightTheme: o,
|
|
1499
1492
|
onSave: r,
|
|
1500
|
-
onDelete:
|
|
1493
|
+
onDelete: i,
|
|
1501
1494
|
onTypeChange: l,
|
|
1502
|
-
onBack:
|
|
1495
|
+
onBack: d,
|
|
1503
1496
|
editing: m = !1
|
|
1504
1497
|
}) => {
|
|
1505
|
-
const { translations:
|
|
1506
|
-
return /* @__PURE__ */ S(
|
|
1507
|
-
t != null ? /* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
g ? /* @__PURE__ */ S(
|
|
1510
|
-
/* @__PURE__ */
|
|
1498
|
+
const { translations: c } = G(), [g, h] = B(m), [u, E] = B(n || ""), [f, v] = B(!1);
|
|
1499
|
+
return /* @__PURE__ */ S(T, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1500
|
+
t != null ? /* @__PURE__ */ s(z, { as: "div", children: /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(he, { type: e, isCardActive: !0, theme: o, children: t }) }) }) : /* @__PURE__ */ s(Qe, {}),
|
|
1501
|
+
/* @__PURE__ */ s(Ve, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1502
|
+
g ? /* @__PURE__ */ S(T, { direction: "column", gap: "x-small", children: [
|
|
1503
|
+
/* @__PURE__ */ s(
|
|
1511
1504
|
He,
|
|
1512
1505
|
{
|
|
1513
|
-
label:
|
|
1506
|
+
label: c.addNoteOptional,
|
|
1514
1507
|
value: u,
|
|
1515
1508
|
onChange: (y) => E(y.target.value),
|
|
1516
1509
|
resize: "vertical"
|
|
1517
1510
|
}
|
|
1518
1511
|
),
|
|
1519
|
-
/* @__PURE__ */ S(
|
|
1520
|
-
/* @__PURE__ */
|
|
1512
|
+
/* @__PURE__ */ S(T, { gap: "xx-small", children: [
|
|
1513
|
+
/* @__PURE__ */ s(T.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1521
1514
|
$,
|
|
1522
1515
|
{
|
|
1523
1516
|
display: "block",
|
|
@@ -1526,10 +1519,10 @@ const Cn = {
|
|
|
1526
1519
|
onClick: () => {
|
|
1527
1520
|
E(n || ""), h(!1);
|
|
1528
1521
|
},
|
|
1529
|
-
children:
|
|
1522
|
+
children: c.cancel
|
|
1530
1523
|
}
|
|
1531
1524
|
) }),
|
|
1532
|
-
/* @__PURE__ */
|
|
1525
|
+
/* @__PURE__ */ s(T.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1533
1526
|
$,
|
|
1534
1527
|
{
|
|
1535
1528
|
display: "block",
|
|
@@ -1539,77 +1532,77 @@ const Cn = {
|
|
|
1539
1532
|
onClick: () => {
|
|
1540
1533
|
r(u), h(!1);
|
|
1541
1534
|
},
|
|
1542
|
-
children:
|
|
1535
|
+
children: c.save
|
|
1543
1536
|
}
|
|
1544
1537
|
) })
|
|
1545
1538
|
] })
|
|
1546
|
-
] }) : /* @__PURE__ */ S(
|
|
1547
|
-
n && /* @__PURE__ */ S(
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
/* @__PURE__ */
|
|
1539
|
+
] }) : /* @__PURE__ */ S(T, { direction: "column", gap: "small", children: [
|
|
1540
|
+
n && /* @__PURE__ */ S(z, { as: "div", children: [
|
|
1541
|
+
/* @__PURE__ */ s(ae, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
|
|
1542
|
+
/* @__PURE__ */ s(U, { children: n })
|
|
1550
1543
|
] }),
|
|
1551
|
-
/* @__PURE__ */ S(
|
|
1552
|
-
/* @__PURE__ */
|
|
1544
|
+
/* @__PURE__ */ S(T, { justifyItems: "space-between", children: [
|
|
1545
|
+
/* @__PURE__ */ s(
|
|
1553
1546
|
$,
|
|
1554
1547
|
{
|
|
1555
1548
|
size: "small",
|
|
1556
|
-
renderIcon: /* @__PURE__ */
|
|
1549
|
+
renderIcon: /* @__PURE__ */ s(st, {}),
|
|
1557
1550
|
"data-testid": "single-note-back",
|
|
1558
|
-
onClick: () =>
|
|
1559
|
-
children:
|
|
1551
|
+
onClick: () => d == null ? void 0 : d(),
|
|
1552
|
+
children: c.back
|
|
1560
1553
|
}
|
|
1561
1554
|
),
|
|
1562
|
-
/* @__PURE__ */ S(
|
|
1563
|
-
|
|
1564
|
-
|
|
1555
|
+
/* @__PURE__ */ S(T, { gap: "xx-small", children: [
|
|
1556
|
+
i && /* @__PURE__ */ s(
|
|
1557
|
+
V,
|
|
1565
1558
|
{
|
|
1566
1559
|
size: "small",
|
|
1567
1560
|
withBackground: !1,
|
|
1568
1561
|
withBorder: !1,
|
|
1569
1562
|
color: "danger",
|
|
1570
|
-
screenReaderLabel:
|
|
1563
|
+
screenReaderLabel: c.deleteNote,
|
|
1571
1564
|
"data-testid": "single-note-delete",
|
|
1572
1565
|
onClick: () => v(!0),
|
|
1573
|
-
children: /* @__PURE__ */
|
|
1566
|
+
children: /* @__PURE__ */ s(le, {})
|
|
1574
1567
|
}
|
|
1575
1568
|
),
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
|
|
1569
|
+
/* @__PURE__ */ s(
|
|
1570
|
+
V,
|
|
1578
1571
|
{
|
|
1579
1572
|
size: "small",
|
|
1580
1573
|
withBackground: !1,
|
|
1581
1574
|
withBorder: !1,
|
|
1582
|
-
screenReaderLabel:
|
|
1575
|
+
screenReaderLabel: c.editNote,
|
|
1583
1576
|
"data-testid": "single-note-edit",
|
|
1584
1577
|
onClick: () => h(!0),
|
|
1585
|
-
children: /* @__PURE__ */
|
|
1578
|
+
children: /* @__PURE__ */ s(fe, {})
|
|
1586
1579
|
}
|
|
1587
1580
|
)
|
|
1588
1581
|
] })
|
|
1589
1582
|
] }),
|
|
1590
|
-
f &&
|
|
1591
|
-
/* @__PURE__ */
|
|
1583
|
+
f && i && /* @__PURE__ */ s(z, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ S(T, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1584
|
+
/* @__PURE__ */ s(
|
|
1592
1585
|
$,
|
|
1593
1586
|
{
|
|
1594
1587
|
display: "block",
|
|
1595
1588
|
color: "danger",
|
|
1596
1589
|
size: "small",
|
|
1597
|
-
renderIcon: /* @__PURE__ */
|
|
1590
|
+
renderIcon: /* @__PURE__ */ s(le, {}),
|
|
1598
1591
|
"data-testid": "single-note-confirm-delete",
|
|
1599
1592
|
onClick: () => {
|
|
1600
|
-
|
|
1593
|
+
i(), v(!1);
|
|
1601
1594
|
},
|
|
1602
|
-
children:
|
|
1595
|
+
children: c.deleteNote
|
|
1603
1596
|
}
|
|
1604
1597
|
),
|
|
1605
|
-
/* @__PURE__ */
|
|
1598
|
+
/* @__PURE__ */ s(
|
|
1606
1599
|
$,
|
|
1607
1600
|
{
|
|
1608
1601
|
display: "block",
|
|
1609
1602
|
size: "small",
|
|
1610
1603
|
"data-testid": "single-note-cancel-delete",
|
|
1611
1604
|
onClick: () => v(!1),
|
|
1612
|
-
children:
|
|
1605
|
+
children: c.cancel
|
|
1613
1606
|
}
|
|
1614
1607
|
)
|
|
1615
1608
|
] }) })
|
|
@@ -1617,25 +1610,26 @@ const Cn = {
|
|
|
1617
1610
|
] });
|
|
1618
1611
|
};
|
|
1619
1612
|
export {
|
|
1620
|
-
|
|
1613
|
+
Vn as ContentWithNoteWrapper,
|
|
1621
1614
|
he as Highlight,
|
|
1622
1615
|
Qe as HighlightError,
|
|
1623
|
-
|
|
1624
|
-
|
|
1616
|
+
Cn as NoteCard,
|
|
1617
|
+
Ve as NoteChip,
|
|
1625
1618
|
yn as NoteReactionMenu,
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
Dt as
|
|
1619
|
+
In as NotebookEmptyState,
|
|
1620
|
+
Qn as NotebookProvider,
|
|
1621
|
+
pn as NotebookTranslationsProvider,
|
|
1622
|
+
Jn as NotebookTray,
|
|
1623
|
+
eo as NotesListView,
|
|
1624
|
+
w as REACTION_TYPE,
|
|
1625
|
+
to as SingleNote,
|
|
1626
|
+
Ie as createTransparentColor,
|
|
1627
|
+
Dt as useCreateNote,
|
|
1628
|
+
Lt as useDeleteNote,
|
|
1635
1629
|
$e as useGetNotes,
|
|
1636
1630
|
Xe as useNotebook,
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1631
|
+
G as useNotebookTranslations,
|
|
1632
|
+
Yn as useNotesData,
|
|
1633
|
+
Zn as useReactionFilter,
|
|
1640
1634
|
At as useUpdateNote
|
|
1641
1635
|
};
|