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