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