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