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