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