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