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