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