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