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