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