@instructure/platform-notebook 1.0.0 → 1.2.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 +850 -843
- 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
|
|
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
15
|
import { Text as W } from "@instructure/ui-text";
|
|
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
|
|
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 Ge = /* @__PURE__ */ ((t) => (t[t.FORWARDS = 1] = "FORWARDS", t[t.BACKWARDS = 2] = "BACKWARDS", t))(Ge || {});
|
|
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] = We(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
|
-
return
|
|
141
|
-
} catch (
|
|
140
|
+
return We(this.element, this.offset)[0];
|
|
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 === Ge.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 += Ue(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 Ue = (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
|
-
},
|
|
328
|
-
let
|
|
329
|
-
const o =
|
|
325
|
+
n += Ue(e), e = e.previousSibling;
|
|
326
|
+
return n;
|
|
327
|
+
}, We = (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,380 @@ 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
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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 n = document.querySelector(
|
|
419
|
+
`[data-highlight-id="${CSS.escape(t)}"].highlight-content`
|
|
420
|
+
) ?? document.getElementById(xe(t));
|
|
421
|
+
if (n) {
|
|
422
|
+
const o = n.getBoundingClientRect();
|
|
423
|
+
o.top >= 0 && o.bottom <= (window.innerHeight || document.documentElement.clientHeight) || n.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
421
424
|
}
|
|
422
|
-
},
|
|
423
|
-
const e =
|
|
425
|
+
}, ae = 90, ce = 172, wt = (t) => {
|
|
426
|
+
const e = t.getClientRects();
|
|
424
427
|
if (!e.length)
|
|
425
428
|
return null;
|
|
426
|
-
const
|
|
427
|
-
const
|
|
428
|
-
return
|
|
429
|
-
}, c = (
|
|
430
|
-
const
|
|
431
|
-
return
|
|
429
|
+
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) => {
|
|
430
|
+
const T = y + ce;
|
|
431
|
+
return y >= i && T <= l - i;
|
|
432
|
+
}, c = (y) => {
|
|
433
|
+
const T = y + ae;
|
|
434
|
+
return y >= i && T <= a - i;
|
|
432
435
|
};
|
|
433
|
-
let
|
|
434
|
-
const
|
|
435
|
-
if (
|
|
436
|
-
|
|
436
|
+
let h;
|
|
437
|
+
const g = n.right - ce;
|
|
438
|
+
if (m(g))
|
|
439
|
+
h = g;
|
|
437
440
|
else {
|
|
438
|
-
const
|
|
439
|
-
if (
|
|
440
|
-
|
|
441
|
+
const y = n.left;
|
|
442
|
+
if (m(y))
|
|
443
|
+
h = y;
|
|
441
444
|
else {
|
|
442
|
-
const N = (
|
|
443
|
-
|
|
445
|
+
const N = (n.left + n.right) / 2 - ce / 2;
|
|
446
|
+
m(N) ? h = N : g < i ? h = i : h = l - ce - i;
|
|
444
447
|
}
|
|
445
448
|
}
|
|
446
|
-
let
|
|
447
|
-
const
|
|
448
|
-
if (c(
|
|
449
|
-
|
|
449
|
+
let u;
|
|
450
|
+
const p = o.bottom + r;
|
|
451
|
+
if (c(p))
|
|
452
|
+
u = p;
|
|
450
453
|
else {
|
|
451
|
-
const
|
|
452
|
-
c(
|
|
454
|
+
const y = n.top - ae - r;
|
|
455
|
+
c(y) ? u = y : p + ae > a - i ? u = a - ae - i : u = i;
|
|
453
456
|
}
|
|
454
|
-
return { top:
|
|
455
|
-
},
|
|
456
|
-
for (const
|
|
457
|
-
if (
|
|
457
|
+
return { top: u, left: h };
|
|
458
|
+
}, kt = (t, e) => {
|
|
459
|
+
for (const n of e)
|
|
460
|
+
if (t.start < n.end && t.end > n.start)
|
|
458
461
|
return !0;
|
|
459
462
|
return !1;
|
|
460
|
-
},
|
|
461
|
-
const
|
|
462
|
-
return `rgba(${
|
|
463
|
-
},
|
|
464
|
-
var
|
|
463
|
+
}, 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) => {
|
|
464
|
+
const n = Number.parseInt(t.slice(1, 3), 16), o = Number.parseInt(t.slice(3, 5), 16), r = Number.parseInt(t.slice(5, 7), 16);
|
|
465
|
+
return `rgba(${n}, ${o}, ${r}, ${e})`;
|
|
466
|
+
}, Ot = (t, e) => {
|
|
467
|
+
var n;
|
|
465
468
|
try {
|
|
466
|
-
const o = ((
|
|
467
|
-
return
|
|
469
|
+
const o = ((n = e.nodeValue) == null ? void 0 : n.length) ?? e.childNodes.length;
|
|
470
|
+
return t.comparePoint(e, 0) <= 0 && t.comparePoint(e, o) >= 0;
|
|
468
471
|
} catch {
|
|
469
472
|
return !1;
|
|
470
473
|
}
|
|
471
|
-
},
|
|
474
|
+
}, Rt = (t) => {
|
|
472
475
|
var i;
|
|
473
|
-
if (
|
|
476
|
+
if (t.collapsed)
|
|
474
477
|
return [];
|
|
475
|
-
let e =
|
|
478
|
+
let e = t.commonAncestorContainer;
|
|
476
479
|
if (e && e.nodeType !== Node.ELEMENT_NODE && (e = e.parentElement), !e)
|
|
477
480
|
return [];
|
|
478
|
-
const
|
|
481
|
+
const n = [], o = (i = e == null ? void 0 : e.ownerDocument) == null ? void 0 : i.createNodeIterator(e, NodeFilter.SHOW_TEXT);
|
|
479
482
|
let r = (o == null ? void 0 : o.nextNode()) || null;
|
|
480
483
|
for (; r; ) {
|
|
481
|
-
if (!
|
|
484
|
+
if (!Ot(t, r)) {
|
|
482
485
|
r = (o == null ? void 0 : o.nextNode()) || null;
|
|
483
486
|
continue;
|
|
484
487
|
}
|
|
485
488
|
const l = r;
|
|
486
|
-
if (l ===
|
|
487
|
-
l.splitText(
|
|
489
|
+
if (l === t.startContainer && t.startOffset > 0) {
|
|
490
|
+
l.splitText(t.startOffset), r = (o == null ? void 0 : o.nextNode()) || null;
|
|
488
491
|
continue;
|
|
489
492
|
}
|
|
490
|
-
l ===
|
|
493
|
+
l === t.endContainer && t.endOffset < l.data.length && l.splitText(t.endOffset), n.push(l), r = (o == null ? void 0 : o.nextNode()) || null;
|
|
491
494
|
}
|
|
492
|
-
return
|
|
493
|
-
},
|
|
494
|
-
if (
|
|
495
|
-
const o = e.id ?? "", r =
|
|
496
|
-
if (document.getElementById(
|
|
497
|
-
|
|
495
|
+
return n;
|
|
496
|
+
}, Dt = (t, e, n) => {
|
|
497
|
+
if (t.collapsed) return;
|
|
498
|
+
const o = e.id ?? "", r = Ie(o);
|
|
499
|
+
if (document.getElementById(xe(o))) {
|
|
500
|
+
Pt(e, n);
|
|
498
501
|
return;
|
|
499
502
|
}
|
|
500
|
-
const l = e.type === k.IMPORTANT ?
|
|
501
|
-
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
const
|
|
505
|
-
|
|
506
|
-
const
|
|
507
|
-
|
|
503
|
+
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");
|
|
504
|
+
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";
|
|
505
|
+
const p = document.createElement("span");
|
|
506
|
+
p.id = qe(o), p.className = "highlight-marker-end", p.dataset.highlightId = o || "";
|
|
507
|
+
const y = t.cloneRange();
|
|
508
|
+
y.collapse(!1), y.insertNode(p);
|
|
509
|
+
const T = t.cloneRange();
|
|
510
|
+
T.collapse(!0), T.insertNode(u);
|
|
508
511
|
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
|
-
|
|
512
|
+
N.setStartAfter(u), N.setEndBefore(p);
|
|
513
|
+
const L = Rt(N).filter((b) => b.textContent && b.textContent.length > 0);
|
|
514
|
+
L.forEach((b, I) => {
|
|
515
|
+
var U;
|
|
516
|
+
const R = b.parentElement;
|
|
517
|
+
if ((R == null ? void 0 : R.dataset.highlightId) === o) return;
|
|
518
|
+
const C = I === 0, B = I === L.length - 1, x = L.length === 1;
|
|
519
|
+
let A;
|
|
520
|
+
x ? A = "single" : C ? A = "first" : B ? A = "last" : A = "middle";
|
|
521
|
+
const w = document.createElement("span");
|
|
522
|
+
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) => {
|
|
523
|
+
var $;
|
|
524
|
+
te.target.tagName !== "A" && (($ = e.onClick) == null || $.call(e));
|
|
525
|
+
}), (U = b.parentNode) == null || U.insertBefore(w, b), w.appendChild(b);
|
|
526
|
+
}), u.addEventListener("click", (b) => {
|
|
527
|
+
var I;
|
|
528
|
+
b.target.tagName !== "A" && ((I = e.onClick) == null || I.call(e));
|
|
529
|
+
}), u.addEventListener("keydown", (b) => {
|
|
530
|
+
var I;
|
|
531
|
+
if (b.key === "Enter" || b.key === " ")
|
|
532
|
+
b.preventDefault(), (I = e.onClick) == null || I.call(e);
|
|
533
|
+
else if (b.key === "Tab" && !b.shiftKey) {
|
|
534
|
+
const R = document.querySelectorAll(se(o));
|
|
535
|
+
for (const C of R) {
|
|
536
|
+
const B = C.querySelector("a");
|
|
537
|
+
if (B) {
|
|
538
|
+
b.preventDefault(), B.focus();
|
|
536
539
|
break;
|
|
537
540
|
}
|
|
538
541
|
}
|
|
539
542
|
}
|
|
540
|
-
}),
|
|
543
|
+
}), u.addEventListener("focus", () => {
|
|
541
544
|
document.querySelectorAll(
|
|
542
|
-
|
|
543
|
-
).forEach((
|
|
544
|
-
|
|
545
|
+
se(o)
|
|
546
|
+
).forEach((I) => {
|
|
547
|
+
I.classList.add("highlight-focused");
|
|
545
548
|
});
|
|
546
|
-
}),
|
|
549
|
+
}), u.addEventListener("blur", () => {
|
|
547
550
|
document.querySelectorAll(
|
|
548
|
-
|
|
549
|
-
).forEach((
|
|
550
|
-
|
|
551
|
+
se(o)
|
|
552
|
+
).forEach((I) => {
|
|
553
|
+
I.classList.remove("highlight-focused");
|
|
551
554
|
});
|
|
552
555
|
});
|
|
553
556
|
};
|
|
554
|
-
function
|
|
555
|
-
const
|
|
557
|
+
function Pt(t, e) {
|
|
558
|
+
const n = t.type === k.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, r = t.id === t.selectedNoteId ? n : we(n, 0.5);
|
|
556
559
|
document.querySelectorAll(
|
|
557
|
-
|
|
560
|
+
se(t.id ?? "")
|
|
558
561
|
).forEach((l) => {
|
|
559
562
|
l.style.backgroundColor = r;
|
|
560
563
|
});
|
|
561
564
|
}
|
|
562
|
-
const
|
|
563
|
-
const e =
|
|
565
|
+
const Lt = (t) => {
|
|
566
|
+
const e = t.id ?? "", n = document.getElementById(xe(e)), o = document.getElementById(qe(e));
|
|
564
567
|
document.querySelectorAll(
|
|
565
|
-
|
|
568
|
+
se(e)
|
|
566
569
|
).forEach((i) => {
|
|
567
570
|
var l;
|
|
568
571
|
for (; i.firstChild; )
|
|
569
572
|
(l = i.parentNode) == null || l.insertBefore(i.firstChild, i);
|
|
570
573
|
i.remove();
|
|
571
|
-
}),
|
|
572
|
-
},
|
|
574
|
+
}), n == null || n.remove(), o == null || o.remove();
|
|
575
|
+
}, oe = {
|
|
573
576
|
all: ["notebook"],
|
|
574
|
-
notes: (
|
|
577
|
+
notes: (t) => ["notebook", "notes", t]
|
|
575
578
|
};
|
|
576
|
-
function
|
|
577
|
-
const e =
|
|
578
|
-
return
|
|
579
|
-
mutationFn: (
|
|
579
|
+
function At(t) {
|
|
580
|
+
const e = be();
|
|
581
|
+
return Ee({
|
|
582
|
+
mutationFn: (n) => t.createNote(n),
|
|
580
583
|
onSuccess: () => {
|
|
581
|
-
e.invalidateQueries({ queryKey:
|
|
584
|
+
e.invalidateQueries({ queryKey: oe.all });
|
|
582
585
|
}
|
|
583
586
|
});
|
|
584
587
|
}
|
|
585
|
-
function
|
|
586
|
-
const e =
|
|
587
|
-
return
|
|
588
|
-
mutationFn: (
|
|
588
|
+
function Ft(t) {
|
|
589
|
+
const e = be();
|
|
590
|
+
return Ee({
|
|
591
|
+
mutationFn: (n) => t.deleteNote(n),
|
|
589
592
|
onSuccess: () => {
|
|
590
|
-
e.invalidateQueries({ queryKey:
|
|
593
|
+
e.invalidateQueries({ queryKey: oe.all });
|
|
591
594
|
}
|
|
592
595
|
});
|
|
593
596
|
}
|
|
594
|
-
function
|
|
595
|
-
api:
|
|
597
|
+
function Ke({
|
|
598
|
+
api: t,
|
|
596
599
|
enabled: e = !0,
|
|
597
|
-
...
|
|
600
|
+
...n
|
|
598
601
|
}) {
|
|
599
|
-
return
|
|
600
|
-
queryKey:
|
|
601
|
-
queryFn: () =>
|
|
602
|
+
return ot({
|
|
603
|
+
queryKey: oe.notes(n),
|
|
604
|
+
queryFn: () => t.getNotes(n),
|
|
602
605
|
enabled: e
|
|
603
606
|
});
|
|
604
607
|
}
|
|
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:
|
|
608
|
+
function _t(t) {
|
|
609
|
+
const e = be();
|
|
610
|
+
return Ee({
|
|
611
|
+
mutationFn: ({ id: n, input: o }) => t.updateNote(n, o),
|
|
612
|
+
onMutate: async ({ id: n, input: o }) => {
|
|
613
|
+
await e.cancelQueries({ queryKey: oe.all });
|
|
614
|
+
const i = e.getQueryCache().findAll({ queryKey: oe.all }), l = /* @__PURE__ */ new Map();
|
|
612
615
|
for (const a of i) {
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
...
|
|
616
|
-
notes:
|
|
617
|
-
(c) => c.id ===
|
|
616
|
+
const m = a.state.data;
|
|
617
|
+
m && (l.set(a.queryKey, m), e.setQueryData(a.queryKey, {
|
|
618
|
+
...m,
|
|
619
|
+
notes: m.notes.map(
|
|
620
|
+
(c) => c.id === n ? { ...c, ...o, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } : c
|
|
618
621
|
)
|
|
619
622
|
}));
|
|
620
623
|
}
|
|
621
624
|
return { previousData: l };
|
|
622
625
|
},
|
|
623
|
-
onError: (
|
|
626
|
+
onError: (n, o, r) => {
|
|
624
627
|
if (r != null && r.previousData)
|
|
625
628
|
for (const [i, l] of r.previousData)
|
|
626
629
|
e.setQueryData(i, l);
|
|
627
630
|
},
|
|
628
631
|
onSettled: () => {
|
|
629
|
-
e.invalidateQueries({ queryKey:
|
|
632
|
+
e.invalidateQueries({ queryKey: oe.all });
|
|
630
633
|
}
|
|
631
634
|
});
|
|
632
635
|
}
|
|
633
|
-
const
|
|
634
|
-
notebook:
|
|
635
|
-
notes:
|
|
636
|
-
important:
|
|
637
|
-
unclear:
|
|
638
|
-
back:
|
|
639
|
-
editNote:
|
|
640
|
-
save:
|
|
641
|
-
cancel:
|
|
642
|
-
deleteNote:
|
|
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 ?
|
|
636
|
+
const Mt = "Notebook", Bt = "Notes", Ht = "Important", jt = "Unclear", zt = "Back", $t = "Edit note", Gt = "Save", Ut = "Cancel", Wt = "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 = {
|
|
637
|
+
notebook: Mt,
|
|
638
|
+
notes: Bt,
|
|
639
|
+
important: Ht,
|
|
640
|
+
unclear: jt,
|
|
641
|
+
back: zt,
|
|
642
|
+
editNote: $t,
|
|
643
|
+
save: Gt,
|
|
644
|
+
cancel: Ut,
|
|
645
|
+
deleteNote: Wt,
|
|
646
|
+
note: qt,
|
|
647
|
+
addNotePrompt: Kt,
|
|
648
|
+
removeFromNotebook: Xt,
|
|
649
|
+
addNoteOptional: Qt,
|
|
650
|
+
markImportant: Vt,
|
|
651
|
+
markUnclear: Yt,
|
|
652
|
+
savedToNotebook: Zt,
|
|
653
|
+
noteUpdated: Jt,
|
|
654
|
+
noteDeleted: en,
|
|
655
|
+
errorSavingNote: tn,
|
|
656
|
+
errorUpdatingNote: nn,
|
|
657
|
+
noteDeletionFailed: on,
|
|
658
|
+
loadingNotes: rn,
|
|
659
|
+
failedToLoadNotes: sn,
|
|
660
|
+
emptyStateHeading: ln,
|
|
661
|
+
emptyStateDescription: an,
|
|
662
|
+
nothingHereYet: cn,
|
|
663
|
+
adjustFiltersOrCreate: dn,
|
|
664
|
+
noNotesForFilter: un,
|
|
665
|
+
previousPage: fn,
|
|
666
|
+
nextPage: mn,
|
|
667
|
+
allCourses: gn,
|
|
668
|
+
allNotes: hn,
|
|
669
|
+
closeNotebookPanel: pn,
|
|
670
|
+
featureDescription: Nn,
|
|
671
|
+
highlightUnavailable: yn
|
|
672
|
+
}, Xe = Be(null);
|
|
673
|
+
function Qe(t, e) {
|
|
674
|
+
const n = ke[t] ?? t;
|
|
675
|
+
return e ? n.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : n;
|
|
673
676
|
}
|
|
674
|
-
function
|
|
675
|
-
translations:
|
|
677
|
+
function bn({
|
|
678
|
+
translations: t,
|
|
676
679
|
translate: e,
|
|
677
|
-
children:
|
|
680
|
+
children: n
|
|
678
681
|
}) {
|
|
679
|
-
const o =
|
|
682
|
+
const o = ie(
|
|
680
683
|
() => ({
|
|
681
|
-
translations: { ...
|
|
682
|
-
translate: e ??
|
|
684
|
+
translations: { ...ke, ...t },
|
|
685
|
+
translate: e ?? Qe
|
|
683
686
|
}),
|
|
684
|
-
[
|
|
687
|
+
[t, e]
|
|
685
688
|
);
|
|
686
|
-
return /* @__PURE__ */ s(
|
|
689
|
+
return /* @__PURE__ */ s(Xe.Provider, { value: o, children: n });
|
|
687
690
|
}
|
|
688
|
-
function
|
|
689
|
-
const
|
|
690
|
-
return
|
|
691
|
+
function Q() {
|
|
692
|
+
const t = He(Xe);
|
|
693
|
+
return t || { translations: ke, translate: Qe };
|
|
691
694
|
}
|
|
692
|
-
const
|
|
693
|
-
selectedNoteId:
|
|
695
|
+
const En = (t) => ({
|
|
696
|
+
selectedNoteId: t ?? null,
|
|
694
697
|
isNoteEditing: !1,
|
|
695
|
-
isTrayOpen:
|
|
698
|
+
isTrayOpen: t != null
|
|
696
699
|
});
|
|
697
|
-
function
|
|
700
|
+
function Sn(t, e) {
|
|
698
701
|
switch (e.type) {
|
|
699
702
|
case "SELECT_NOTE":
|
|
700
703
|
return {
|
|
701
|
-
...
|
|
704
|
+
...t,
|
|
702
705
|
selectedNoteId: e.payload.id,
|
|
703
706
|
isNoteEditing: e.payload.isEditing
|
|
704
707
|
};
|
|
705
708
|
case "CLEAR_SELECTED_NOTE":
|
|
706
|
-
return { ...
|
|
709
|
+
return { ...t, selectedNoteId: null, isNoteEditing: !1 };
|
|
707
710
|
case "SET_EDITING":
|
|
708
|
-
return { ...
|
|
711
|
+
return { ...t, isNoteEditing: e.payload };
|
|
709
712
|
case "OPEN_TRAY":
|
|
710
|
-
return { ...
|
|
713
|
+
return { ...t, isTrayOpen: !0 };
|
|
711
714
|
case "CLOSE_TRAY":
|
|
712
|
-
return { ...
|
|
715
|
+
return { ...t, isTrayOpen: !1, selectedNoteId: null, isNoteEditing: !1 };
|
|
713
716
|
default:
|
|
714
|
-
return
|
|
717
|
+
return t;
|
|
715
718
|
}
|
|
716
719
|
}
|
|
717
|
-
const
|
|
718
|
-
function
|
|
719
|
-
api:
|
|
720
|
+
const Ve = Be(null);
|
|
721
|
+
function Jn({
|
|
722
|
+
api: t,
|
|
720
723
|
currentUserId: e,
|
|
721
|
-
objectId:
|
|
724
|
+
objectId: n,
|
|
722
725
|
objectType: o,
|
|
723
726
|
courseId: r,
|
|
724
727
|
pageLastModifiedAt: i,
|
|
725
728
|
onAnalyticsEvent: l,
|
|
726
729
|
onOpen: a,
|
|
727
|
-
initialNoteId:
|
|
730
|
+
initialNoteId: m,
|
|
728
731
|
translations: c,
|
|
729
|
-
translate:
|
|
730
|
-
children:
|
|
732
|
+
translate: h,
|
|
733
|
+
children: g
|
|
731
734
|
}) {
|
|
732
|
-
const [
|
|
735
|
+
const [u, p] = je(Sn, En(m)), y = J(m != null), T = ie(
|
|
733
736
|
() => ({
|
|
734
|
-
api:
|
|
737
|
+
api: t,
|
|
735
738
|
currentUserId: e,
|
|
736
|
-
objectId:
|
|
739
|
+
objectId: n,
|
|
737
740
|
objectType: o,
|
|
738
741
|
courseId: r,
|
|
739
742
|
pageLastModifiedAt: i,
|
|
740
743
|
onAnalyticsEvent: l,
|
|
741
|
-
...
|
|
742
|
-
selectNote: (N,
|
|
743
|
-
clearSelectedNote: () =>
|
|
744
|
-
setEditing: (N) =>
|
|
744
|
+
...u,
|
|
745
|
+
selectNote: (N, O = !1) => p({ type: "SELECT_NOTE", payload: { id: N, isEditing: O } }),
|
|
746
|
+
clearSelectedNote: () => p({ type: "CLEAR_SELECTED_NOTE" }),
|
|
747
|
+
setEditing: (N) => p({ type: "SET_EDITING", payload: N }),
|
|
745
748
|
openTray: () => {
|
|
746
|
-
|
|
749
|
+
y.current || (y.current = !0, a == null || a()), p({ type: "OPEN_TRAY" });
|
|
747
750
|
},
|
|
748
751
|
closeTray: () => {
|
|
749
|
-
|
|
752
|
+
y.current = !1, p({ type: "CLOSE_TRAY" });
|
|
750
753
|
}
|
|
751
754
|
}),
|
|
752
755
|
[
|
|
753
|
-
n,
|
|
754
|
-
e,
|
|
755
756
|
t,
|
|
757
|
+
e,
|
|
758
|
+
n,
|
|
756
759
|
o,
|
|
757
760
|
r,
|
|
758
761
|
i,
|
|
759
762
|
l,
|
|
760
763
|
a,
|
|
761
|
-
|
|
764
|
+
u
|
|
762
765
|
]
|
|
763
766
|
);
|
|
764
|
-
return /* @__PURE__ */ s(
|
|
767
|
+
return /* @__PURE__ */ s(Ve.Provider, { value: T, children: /* @__PURE__ */ s(bn, { translations: c, translate: h, children: g }) });
|
|
765
768
|
}
|
|
766
|
-
function
|
|
767
|
-
const
|
|
768
|
-
if (!
|
|
769
|
+
function Ye() {
|
|
770
|
+
const t = He(Ve);
|
|
771
|
+
if (!t)
|
|
769
772
|
throw new Error("useNotebook must be used within a NotebookProvider");
|
|
770
|
-
return
|
|
773
|
+
return t;
|
|
771
774
|
}
|
|
772
|
-
const
|
|
773
|
-
const { translations:
|
|
774
|
-
return
|
|
775
|
-
|
|
776
|
-
}, [
|
|
775
|
+
const Tn = ({ currentType: t, onSelectReaction: e }) => {
|
|
776
|
+
const { translations: n } = Q(), o = J(null), r = J(null);
|
|
777
|
+
return Z(() => {
|
|
778
|
+
t === k.CONFUSING && o.current ? o.current.focus() : t === k.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
|
|
779
|
+
}, [t]), /* @__PURE__ */ s(
|
|
777
780
|
z,
|
|
778
781
|
{
|
|
779
782
|
as: "div",
|
|
@@ -782,221 +785,225 @@ const bn = ({ currentType: n, onSelectReaction: e }) => {
|
|
|
782
785
|
borderColor: "secondary",
|
|
783
786
|
borderRadius: "medium",
|
|
784
787
|
shadow: "resting",
|
|
785
|
-
children: /* @__PURE__ */
|
|
786
|
-
/* @__PURE__ */
|
|
787
|
-
|
|
788
|
+
children: /* @__PURE__ */ E(ne, { children: [
|
|
789
|
+
/* @__PURE__ */ E(
|
|
790
|
+
ne.Item,
|
|
788
791
|
{
|
|
789
792
|
ref: o,
|
|
790
793
|
onClick: () => e(k.CONFUSING),
|
|
791
794
|
children: [
|
|
792
|
-
/* @__PURE__ */ s(
|
|
793
|
-
` ${
|
|
795
|
+
/* @__PURE__ */ s(Se, { size: "x-small" }),
|
|
796
|
+
` ${n.markUnclear}`
|
|
794
797
|
]
|
|
795
798
|
}
|
|
796
799
|
),
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
|
|
800
|
+
/* @__PURE__ */ E(
|
|
801
|
+
ne.Item,
|
|
799
802
|
{
|
|
800
803
|
ref: r,
|
|
801
804
|
onClick: () => e(k.IMPORTANT),
|
|
802
805
|
children: [
|
|
803
|
-
/* @__PURE__ */ s(
|
|
804
|
-
` ${
|
|
806
|
+
/* @__PURE__ */ s(Te, { size: "x-small" }),
|
|
807
|
+
` ${n.markImportant}`
|
|
805
808
|
]
|
|
806
809
|
}
|
|
807
810
|
)
|
|
808
811
|
] })
|
|
809
812
|
}
|
|
810
813
|
);
|
|
811
|
-
},
|
|
812
|
-
function
|
|
813
|
-
containerRef:
|
|
814
|
+
}, ge = "notebook-inline-reaction-menu";
|
|
815
|
+
function eo({
|
|
816
|
+
containerRef: t,
|
|
814
817
|
highlightTheme: e,
|
|
815
|
-
debounceTime:
|
|
818
|
+
debounceTime: n = 500,
|
|
819
|
+
onCreateError: o,
|
|
820
|
+
onUpdateError: r,
|
|
821
|
+
onDeleteError: i
|
|
816
822
|
}) {
|
|
817
823
|
const {
|
|
818
|
-
api:
|
|
819
|
-
objectId:
|
|
820
|
-
objectType:
|
|
821
|
-
courseId:
|
|
822
|
-
pageLastModifiedAt:
|
|
823
|
-
selectedNoteId:
|
|
824
|
-
selectNote:
|
|
825
|
-
openTray:
|
|
826
|
-
} =
|
|
827
|
-
api:
|
|
824
|
+
api: l,
|
|
825
|
+
objectId: a,
|
|
826
|
+
objectType: m,
|
|
827
|
+
courseId: c,
|
|
828
|
+
pageLastModifiedAt: h,
|
|
829
|
+
selectedNoteId: g,
|
|
830
|
+
selectNote: u,
|
|
831
|
+
openTray: p
|
|
832
|
+
} = Ye(), { data: y } = Ke({
|
|
833
|
+
api: l,
|
|
828
834
|
filter: {
|
|
829
|
-
learningObject: { type:
|
|
835
|
+
learningObject: { type: m, id: a }
|
|
830
836
|
},
|
|
831
|
-
courseId:
|
|
837
|
+
courseId: c,
|
|
832
838
|
pageSize: 100
|
|
833
|
-
}), { mutate:
|
|
834
|
-
|
|
835
|
-
const
|
|
836
|
-
if (!
|
|
837
|
-
const
|
|
838
|
-
if (
|
|
839
|
-
|
|
839
|
+
}), { 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), [U, te] = H(!1);
|
|
840
|
+
Z(() => {
|
|
841
|
+
const D = t.current;
|
|
842
|
+
if (!D) return;
|
|
843
|
+
const f = D.closest(".user_content") ?? D;
|
|
844
|
+
if (f.classList.contains("enhanced")) {
|
|
845
|
+
te(!0);
|
|
840
846
|
return;
|
|
841
847
|
}
|
|
842
|
-
const
|
|
843
|
-
for (const
|
|
844
|
-
if (
|
|
845
|
-
|
|
848
|
+
const F = new MutationObserver((_) => {
|
|
849
|
+
for (const M of _)
|
|
850
|
+
if (M.type === "attributes" && M.attributeName === "class" && M.target.classList.contains("enhanced")) {
|
|
851
|
+
te(!0), F.disconnect();
|
|
846
852
|
return;
|
|
847
853
|
}
|
|
848
854
|
});
|
|
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
|
-
|
|
855
|
+
return F.observe(f, { attributes: !0, attributeFilter: ["class"] }), () => F.disconnect();
|
|
856
|
+
}, [t]), Z(() => {
|
|
857
|
+
if (!U || !t.current) return;
|
|
858
|
+
let f = null;
|
|
859
|
+
const F = () => {
|
|
860
|
+
f && clearTimeout(f), f = setTimeout(() => {
|
|
861
|
+
var Re;
|
|
862
|
+
const v = window.getSelection(), P = t.current;
|
|
863
|
+
if (!(v != null && v.rangeCount) || !P) return;
|
|
864
|
+
const G = v.toString().trim();
|
|
865
|
+
if (G === "") return;
|
|
866
|
+
const V = v.getRangeAt(0);
|
|
867
|
+
if (!P.contains(V.commonAncestorContainer)) return;
|
|
868
|
+
const Oe = (Re = Y.fromRange(P, V)) == null ? void 0 : Re.toSelector();
|
|
869
|
+
Oe && !kt(Oe, b) && (C(V.cloneRange()), x(G), w(wt(V)));
|
|
870
|
+
}, n);
|
|
871
|
+
}, _ = (v) => {
|
|
872
|
+
if (!(v.target instanceof Node)) return;
|
|
873
|
+
const P = document.getElementById(ge);
|
|
874
|
+
P != null && P.contains(v.target) ? (v.preventDefault(), v.stopImmediatePropagation()) : (w(null), C(null), x(""));
|
|
875
|
+
}, M = () => {
|
|
876
|
+
w(null), C(null), x("");
|
|
871
877
|
};
|
|
872
|
-
return document.addEventListener("selectionchange",
|
|
873
|
-
|
|
878
|
+
return document.addEventListener("selectionchange", F), document.addEventListener("mousedown", _), document.addEventListener("touchstart", _), window.addEventListener("scroll", M, !0), () => {
|
|
879
|
+
f && clearTimeout(f), document.removeEventListener("selectionchange", F), document.removeEventListener("mousedown", _), document.removeEventListener("touchstart", _), window.removeEventListener("scroll", M, !0);
|
|
874
880
|
};
|
|
875
|
-
}, [
|
|
876
|
-
const
|
|
877
|
-
(
|
|
878
|
-
var
|
|
879
|
-
const
|
|
880
|
-
if (!
|
|
881
|
-
const { highlightData:
|
|
882
|
-
if (
|
|
883
|
-
const
|
|
884
|
-
id:
|
|
885
|
-
selectedNoteId:
|
|
886
|
-
type:
|
|
881
|
+
}, [U, b, n, t]);
|
|
882
|
+
const $ = q(
|
|
883
|
+
(D) => {
|
|
884
|
+
var G;
|
|
885
|
+
const f = t.current;
|
|
886
|
+
if (!f || !D.highlightData) return null;
|
|
887
|
+
const { highlightData: F, reaction: _, id: M } = D, { range: v } = F, P = v && ((G = ee.fromSelector(f, v)) == null ? void 0 : G.toRange());
|
|
888
|
+
if (P) {
|
|
889
|
+
const V = {
|
|
890
|
+
id: M,
|
|
891
|
+
selectedNoteId: g,
|
|
892
|
+
type: _[0],
|
|
887
893
|
onClick: () => {
|
|
888
|
-
|
|
894
|
+
u(M), p();
|
|
889
895
|
}
|
|
890
896
|
};
|
|
891
|
-
return
|
|
897
|
+
return Dt(P, V, e), F.textPosition;
|
|
892
898
|
}
|
|
893
899
|
return null;
|
|
894
900
|
},
|
|
895
|
-
[
|
|
901
|
+
[t, g, e, u, p]
|
|
896
902
|
);
|
|
897
|
-
|
|
898
|
-
if (!
|
|
899
|
-
const
|
|
900
|
-
if (
|
|
901
|
-
if (
|
|
902
|
-
for (const
|
|
903
|
-
|
|
904
|
-
|
|
903
|
+
Z(() => {
|
|
904
|
+
if (!U || !y || !t.current) return;
|
|
905
|
+
const D = t.current, f = y.notes, F = /* @__PURE__ */ new Set(), _ = [], M = [];
|
|
906
|
+
if (f.length === 0) {
|
|
907
|
+
if (L.current.length > 0) {
|
|
908
|
+
for (const v of L.current)
|
|
909
|
+
_e(v, D);
|
|
910
|
+
L.current = [], I([]);
|
|
905
911
|
}
|
|
906
912
|
return;
|
|
907
913
|
}
|
|
908
|
-
if (
|
|
909
|
-
const { notesForUpdate:
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
914
|
+
if (h && f[0].highlightData.pageLastModifiedAt !== h) {
|
|
915
|
+
const { notesForUpdate: v, noteIdsForDelete: P } = It(
|
|
916
|
+
D,
|
|
917
|
+
f,
|
|
918
|
+
h
|
|
913
919
|
);
|
|
914
|
-
for (const
|
|
915
|
-
|
|
916
|
-
for (const
|
|
917
|
-
|
|
920
|
+
for (const G of v)
|
|
921
|
+
N({ id: G.id, input: G }).catch((V) => r == null ? void 0 : r(V));
|
|
922
|
+
for (const G of P)
|
|
923
|
+
O(G, { onError: i });
|
|
918
924
|
} else {
|
|
919
|
-
for (const
|
|
920
|
-
const
|
|
921
|
-
|
|
925
|
+
for (const v of f) {
|
|
926
|
+
const P = $(v);
|
|
927
|
+
F.add(v.id), P && (_.push(v), M.push(P));
|
|
922
928
|
}
|
|
923
|
-
for (const
|
|
924
|
-
|
|
925
|
-
|
|
929
|
+
for (const v of L.current)
|
|
930
|
+
F.has(v.id) || _e(v, D);
|
|
931
|
+
I(M), L.current = _, g && xt(g);
|
|
926
932
|
}
|
|
927
933
|
}, [
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
a,
|
|
932
|
-
n,
|
|
934
|
+
U,
|
|
935
|
+
y,
|
|
936
|
+
$,
|
|
933
937
|
h,
|
|
934
|
-
|
|
935
|
-
|
|
938
|
+
t,
|
|
939
|
+
N,
|
|
940
|
+
O,
|
|
941
|
+
g
|
|
936
942
|
]);
|
|
937
|
-
const
|
|
938
|
-
const
|
|
939
|
-
if (!
|
|
940
|
-
const
|
|
941
|
-
|
|
943
|
+
const le = (D) => {
|
|
944
|
+
const f = t.current;
|
|
945
|
+
if (!R || !f) return;
|
|
946
|
+
const F = ee.fromRange(f, R), _ = Y.fromRange(f, R);
|
|
947
|
+
T(
|
|
942
948
|
{
|
|
943
|
-
courseId:
|
|
944
|
-
objectId:
|
|
945
|
-
objectType:
|
|
949
|
+
courseId: c,
|
|
950
|
+
objectId: a,
|
|
951
|
+
objectType: m,
|
|
946
952
|
userText: "",
|
|
947
|
-
reaction: [
|
|
953
|
+
reaction: [D],
|
|
948
954
|
highlightData: {
|
|
949
|
-
selectedText:
|
|
950
|
-
textPosition: (
|
|
951
|
-
range:
|
|
952
|
-
pageLastModifiedAt:
|
|
955
|
+
selectedText: B,
|
|
956
|
+
textPosition: (_ == null ? void 0 : _.toSelector()) ?? null,
|
|
957
|
+
range: F.toSelector(),
|
|
958
|
+
pageLastModifiedAt: h ?? ""
|
|
953
959
|
}
|
|
954
960
|
},
|
|
955
961
|
{
|
|
956
|
-
onSuccess: (
|
|
957
|
-
var
|
|
958
|
-
const
|
|
959
|
-
|
|
960
|
-
}
|
|
962
|
+
onSuccess: (M) => {
|
|
963
|
+
var P;
|
|
964
|
+
const v = M.id;
|
|
965
|
+
C(null), x(""), w(null), (P = window.getSelection()) == null || P.removeAllRanges(), u(v), p();
|
|
966
|
+
},
|
|
967
|
+
onError: o
|
|
961
968
|
}
|
|
962
969
|
);
|
|
963
970
|
};
|
|
964
|
-
return !
|
|
971
|
+
return !R || !A ? null : tt(
|
|
965
972
|
/* @__PURE__ */ s(
|
|
966
973
|
"div",
|
|
967
974
|
{
|
|
968
|
-
id:
|
|
975
|
+
id: ge,
|
|
969
976
|
role: "toolbar",
|
|
970
977
|
style: {
|
|
971
978
|
position: "fixed",
|
|
972
979
|
zIndex: 100,
|
|
973
|
-
top:
|
|
974
|
-
left:
|
|
980
|
+
top: A.top,
|
|
981
|
+
left: A.left,
|
|
975
982
|
whiteSpace: "nowrap"
|
|
976
983
|
},
|
|
977
|
-
onBlur: (
|
|
978
|
-
const
|
|
979
|
-
|
|
984
|
+
onBlur: (D) => {
|
|
985
|
+
const f = document.getElementById(ge);
|
|
986
|
+
f != null && f.contains(D.relatedTarget) || (w(null), C(null), x(""));
|
|
980
987
|
},
|
|
981
|
-
children: /* @__PURE__ */ s(
|
|
988
|
+
children: /* @__PURE__ */ s(Tn, { onSelectReaction: le })
|
|
982
989
|
}
|
|
983
990
|
),
|
|
984
991
|
document.body
|
|
985
992
|
);
|
|
986
993
|
}
|
|
987
|
-
const
|
|
988
|
-
backgroundColor:
|
|
989
|
-
underlineColor:
|
|
990
|
-
underlineStyle:
|
|
991
|
-
}),
|
|
992
|
-
children:
|
|
994
|
+
const vn = (t, e) => ({
|
|
995
|
+
backgroundColor: t === k.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
996
|
+
underlineColor: t === k.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
997
|
+
underlineStyle: t === k.IMPORTANT ? "solid" : "dashed"
|
|
998
|
+
}), ye = ({
|
|
999
|
+
children: t,
|
|
993
1000
|
type: e = k.IMPORTANT,
|
|
994
|
-
isCardActive:
|
|
1001
|
+
isCardActive: n = !0,
|
|
995
1002
|
theme: o
|
|
996
1003
|
}) => {
|
|
997
|
-
const r =
|
|
1004
|
+
const r = vn(e, o), l = {
|
|
998
1005
|
position: "relative",
|
|
999
|
-
backgroundColor:
|
|
1006
|
+
backgroundColor: n ? r.backgroundColor : we(r.backgroundColor, 0.5),
|
|
1000
1007
|
textDecorationLine: "underline",
|
|
1001
1008
|
textDecorationStyle: r.underlineStyle,
|
|
1002
1009
|
textDecorationColor: r.underlineColor,
|
|
@@ -1004,245 +1011,245 @@ const En = (n, e) => ({
|
|
|
1004
1011
|
textUnderlineOffset: o.underlineOffset,
|
|
1005
1012
|
lineHeight: "normal"
|
|
1006
1013
|
};
|
|
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(
|
|
1014
|
+
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: t });
|
|
1015
|
+
}, Ze = () => {
|
|
1016
|
+
const { translations: t } = Q();
|
|
1017
|
+
return /* @__PURE__ */ E(S, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1018
|
+
/* @__PURE__ */ s(S.Item, { as: "div", children: /* @__PURE__ */ s(rt, { color: "error" }) }),
|
|
1019
|
+
/* @__PURE__ */ s(S.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(Ne, { maxLines: 3, children: t.highlightUnavailable }) })
|
|
1013
1020
|
] });
|
|
1014
|
-
},
|
|
1021
|
+
}, Cn = {
|
|
1015
1022
|
filter: null,
|
|
1016
1023
|
courseFilter: null,
|
|
1017
1024
|
currentPage: 1,
|
|
1018
1025
|
totalPages: void 0
|
|
1019
1026
|
};
|
|
1020
|
-
function
|
|
1021
|
-
const
|
|
1022
|
-
return Math.max(1,
|
|
1027
|
+
function de(t, e) {
|
|
1028
|
+
const n = typeof e == "number" ? Math.min(e, t) : t;
|
|
1029
|
+
return Math.max(1, n);
|
|
1023
1030
|
}
|
|
1024
|
-
function
|
|
1031
|
+
function In(t, e) {
|
|
1025
1032
|
switch (e.type) {
|
|
1026
1033
|
case "SET_FILTER":
|
|
1027
|
-
return { ...
|
|
1034
|
+
return { ...t, filter: e.payload, currentPage: 1 };
|
|
1028
1035
|
case "SET_COURSE_FILTER":
|
|
1029
|
-
return { ...
|
|
1036
|
+
return { ...t, courseFilter: e.payload, currentPage: 1 };
|
|
1030
1037
|
case "SET_PAGE":
|
|
1031
|
-
return { ...
|
|
1038
|
+
return { ...t, currentPage: de(e.payload, t.totalPages) };
|
|
1032
1039
|
case "INCREMENT_PAGE":
|
|
1033
|
-
return { ...
|
|
1040
|
+
return { ...t, currentPage: de(t.currentPage + 1, t.totalPages) };
|
|
1034
1041
|
case "DECREMENT_PAGE":
|
|
1035
|
-
return { ...
|
|
1042
|
+
return { ...t, currentPage: de(t.currentPage - 1, t.totalPages) };
|
|
1036
1043
|
case "SET_TOTAL_PAGES":
|
|
1037
|
-
return
|
|
1038
|
-
...
|
|
1044
|
+
return t.totalPages === e.payload ? t : {
|
|
1045
|
+
...t,
|
|
1039
1046
|
totalPages: e.payload,
|
|
1040
|
-
currentPage:
|
|
1047
|
+
currentPage: de(t.currentPage, e.payload)
|
|
1041
1048
|
};
|
|
1042
1049
|
default:
|
|
1043
|
-
return
|
|
1050
|
+
return t;
|
|
1044
1051
|
}
|
|
1045
1052
|
}
|
|
1046
|
-
function
|
|
1047
|
-
api:
|
|
1053
|
+
function to({
|
|
1054
|
+
api: t,
|
|
1048
1055
|
courseId: e,
|
|
1049
|
-
enableCourseFilter:
|
|
1056
|
+
enableCourseFilter: n = !1,
|
|
1050
1057
|
learningObject: o,
|
|
1051
1058
|
pageSize: r = 16
|
|
1052
1059
|
}) {
|
|
1053
|
-
const [i, l] =
|
|
1054
|
-
|
|
1060
|
+
const [i, l] = je(In, Cn), { filter: a, courseFilter: m, currentPage: c, totalPages: h } = i;
|
|
1061
|
+
Z(() => {
|
|
1055
1062
|
l({ type: "SET_PAGE", payload: 1 });
|
|
1056
1063
|
}, [r]);
|
|
1057
|
-
const
|
|
1058
|
-
api:
|
|
1064
|
+
const g = n ? m : e, u = (c - 1) * r, { data: p, isLoading: y, isError: T } = Ke({
|
|
1065
|
+
api: t,
|
|
1059
1066
|
filter: {
|
|
1060
|
-
...
|
|
1067
|
+
...g ? { courseId: g } : {},
|
|
1061
1068
|
...a ? { reactions: [a] } : {},
|
|
1062
1069
|
...o ? { learningObject: o } : {}
|
|
1063
1070
|
},
|
|
1064
|
-
offset:
|
|
1071
|
+
offset: u,
|
|
1065
1072
|
pageSize: r
|
|
1066
|
-
}), N = (
|
|
1067
|
-
|
|
1068
|
-
l({ type: "SET_TOTAL_PAGES", payload:
|
|
1069
|
-
}, [
|
|
1070
|
-
const
|
|
1073
|
+
}), N = (p == null ? void 0 : p.notes) ?? [], O = p == null ? void 0 : p.pageInfo, L = (O == null ? void 0 : O.totalNrOfPages) ?? void 0;
|
|
1074
|
+
Z(() => {
|
|
1075
|
+
l({ type: "SET_TOTAL_PAGES", payload: L });
|
|
1076
|
+
}, [L]);
|
|
1077
|
+
const b = q((x) => {
|
|
1071
1078
|
l({ type: "SET_PAGE", payload: x });
|
|
1072
|
-
}, []),
|
|
1079
|
+
}, []), I = q(() => {
|
|
1073
1080
|
l({
|
|
1074
1081
|
type: "INCREMENT_PAGE"
|
|
1075
1082
|
/* IncrementPage */
|
|
1076
1083
|
});
|
|
1077
|
-
}, []),
|
|
1084
|
+
}, []), R = q(() => {
|
|
1078
1085
|
l({
|
|
1079
1086
|
type: "DECREMENT_PAGE"
|
|
1080
1087
|
/* DecrementPage */
|
|
1081
1088
|
});
|
|
1082
|
-
}, []),
|
|
1089
|
+
}, []), C = q((x) => {
|
|
1083
1090
|
l({ type: "SET_FILTER", payload: x });
|
|
1084
|
-
}, []),
|
|
1091
|
+
}, []), B = q((x) => {
|
|
1085
1092
|
l({ type: "SET_COURSE_FILTER", payload: x });
|
|
1086
1093
|
}, []);
|
|
1087
1094
|
return {
|
|
1088
1095
|
notes: N,
|
|
1089
|
-
pageInfo:
|
|
1090
|
-
isLoading:
|
|
1091
|
-
isError:
|
|
1096
|
+
pageInfo: O,
|
|
1097
|
+
isLoading: y,
|
|
1098
|
+
isError: T,
|
|
1092
1099
|
filter: a,
|
|
1093
|
-
courseFilter:
|
|
1100
|
+
courseFilter: m,
|
|
1094
1101
|
currentPage: c,
|
|
1095
|
-
totalPages:
|
|
1096
|
-
setFilter:
|
|
1097
|
-
setCourseFilter:
|
|
1098
|
-
setPage:
|
|
1099
|
-
fetchNextPage:
|
|
1100
|
-
fetchPreviousPage:
|
|
1102
|
+
totalPages: h,
|
|
1103
|
+
setFilter: C,
|
|
1104
|
+
setCourseFilter: B,
|
|
1105
|
+
setPage: b,
|
|
1106
|
+
fetchNextPage: I,
|
|
1107
|
+
fetchPreviousPage: R
|
|
1101
1108
|
};
|
|
1102
1109
|
}
|
|
1103
|
-
const
|
|
1104
|
-
function
|
|
1105
|
-
const { translations:
|
|
1110
|
+
const he = "all";
|
|
1111
|
+
function no({ filter: t, setFilter: e }) {
|
|
1112
|
+
const { translations: n } = Q(), o = ie(
|
|
1106
1113
|
() => [
|
|
1107
|
-
{ label:
|
|
1108
|
-
{ label:
|
|
1109
|
-
{ label:
|
|
1114
|
+
{ label: n.allNotes, value: he },
|
|
1115
|
+
{ label: n.important, value: k.IMPORTANT },
|
|
1116
|
+
{ label: n.unclear, value: k.CONFUSING }
|
|
1110
1117
|
],
|
|
1111
|
-
[
|
|
1112
|
-
), r =
|
|
1118
|
+
[n]
|
|
1119
|
+
), r = q(
|
|
1113
1120
|
(l, { value: a }) => {
|
|
1114
|
-
e(!a || a ===
|
|
1121
|
+
e(!a || a === he ? null : a);
|
|
1115
1122
|
},
|
|
1116
1123
|
[e]
|
|
1117
1124
|
);
|
|
1118
1125
|
return {
|
|
1119
|
-
filterElement:
|
|
1126
|
+
filterElement: ie(
|
|
1120
1127
|
() => /* @__PURE__ */ s(
|
|
1121
|
-
|
|
1128
|
+
De,
|
|
1122
1129
|
{
|
|
1123
|
-
renderLabel: /* @__PURE__ */ s(
|
|
1124
|
-
value:
|
|
1130
|
+
renderLabel: /* @__PURE__ */ s(ze, { children: n.notes }),
|
|
1131
|
+
value: t ?? he,
|
|
1125
1132
|
onChange: r,
|
|
1126
|
-
children: o.map((l) => /* @__PURE__ */ s(
|
|
1133
|
+
children: o.map((l) => /* @__PURE__ */ s(De.Option, { id: l.value, value: l.value, children: l.label }, l.value))
|
|
1127
1134
|
}
|
|
1128
1135
|
),
|
|
1129
|
-
[
|
|
1136
|
+
[t, o, r, n.notes]
|
|
1130
1137
|
),
|
|
1131
1138
|
reactionFilterOptions: o,
|
|
1132
1139
|
handleReactionFilterChange: r
|
|
1133
1140
|
};
|
|
1134
1141
|
}
|
|
1135
|
-
const
|
|
1136
|
-
const { translations: e } =
|
|
1137
|
-
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", children: /* @__PURE__ */
|
|
1138
|
-
!
|
|
1139
|
-
/* @__PURE__ */ s(
|
|
1142
|
+
const xn = ({ hasActiveFilter: t = !1 }) => {
|
|
1143
|
+
const { translations: e } = Q(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1144
|
+
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", children: /* @__PURE__ */ E(S, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1145
|
+
!t && /* @__PURE__ */ s(st, { size: "medium" }),
|
|
1146
|
+
/* @__PURE__ */ s(fe, { level: "h3", children: n }),
|
|
1140
1147
|
/* @__PURE__ */ s(W, { color: "secondary", children: o })
|
|
1141
1148
|
] }) });
|
|
1142
|
-
},
|
|
1143
|
-
const { isTrayOpen: e, closeTray:
|
|
1149
|
+
}, oo = ({ children: t }) => {
|
|
1150
|
+
const { isTrayOpen: e, closeTray: n } = Ye(), { translations: o } = Q();
|
|
1144
1151
|
return /* @__PURE__ */ s(
|
|
1145
|
-
|
|
1152
|
+
at,
|
|
1146
1153
|
{
|
|
1147
1154
|
label: o.notebook,
|
|
1148
1155
|
open: e,
|
|
1149
|
-
onDismiss:
|
|
1156
|
+
onDismiss: n,
|
|
1150
1157
|
placement: "end",
|
|
1151
1158
|
size: "regular",
|
|
1152
|
-
children: /* @__PURE__ */
|
|
1153
|
-
/* @__PURE__ */ s(
|
|
1154
|
-
/* @__PURE__ */ s(
|
|
1159
|
+
children: /* @__PURE__ */ E(S, { direction: "column", height: "100vh", children: [
|
|
1160
|
+
/* @__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: [
|
|
1161
|
+
/* @__PURE__ */ s(fe, { level: "h3", children: o.notebook }),
|
|
1155
1162
|
/* @__PURE__ */ s(
|
|
1156
|
-
|
|
1163
|
+
lt,
|
|
1157
1164
|
{
|
|
1158
1165
|
screenReaderLabel: o.closeNotebookPanel,
|
|
1159
|
-
onClick:
|
|
1166
|
+
onClick: n,
|
|
1160
1167
|
size: "small",
|
|
1161
1168
|
"data-testid": "notebook-tray-close"
|
|
1162
1169
|
}
|
|
1163
1170
|
)
|
|
1164
1171
|
] }) }) }),
|
|
1165
|
-
/* @__PURE__ */ s(
|
|
1172
|
+
/* @__PURE__ */ s(S.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
|
|
1166
1173
|
] })
|
|
1167
1174
|
}
|
|
1168
1175
|
);
|
|
1169
|
-
},
|
|
1176
|
+
}, wn = {
|
|
1170
1177
|
[k.IMPORTANT]: {
|
|
1171
1178
|
color: "success",
|
|
1172
1179
|
translationKey: "important",
|
|
1173
|
-
icon: /* @__PURE__ */ s(
|
|
1180
|
+
icon: /* @__PURE__ */ s(Te, { size: "x-small" })
|
|
1174
1181
|
},
|
|
1175
1182
|
[k.CONFUSING]: {
|
|
1176
1183
|
color: "danger",
|
|
1177
1184
|
translationKey: "unclear",
|
|
1178
|
-
icon: /* @__PURE__ */ s(
|
|
1185
|
+
icon: /* @__PURE__ */ s(Se, { size: "x-small" })
|
|
1179
1186
|
}
|
|
1180
|
-
},
|
|
1181
|
-
const { translations: o } =
|
|
1182
|
-
(
|
|
1183
|
-
e == null || e(
|
|
1187
|
+
}, Je = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
|
|
1188
|
+
const { translations: o } = Q(), r = wn[t], i = o[r.translationKey], [l, a] = H(!1), m = J(null), c = J(null), h = q(
|
|
1189
|
+
(g) => {
|
|
1190
|
+
e == null || e(g), a(!1);
|
|
1184
1191
|
},
|
|
1185
1192
|
[e]
|
|
1186
1193
|
);
|
|
1187
|
-
return
|
|
1188
|
-
|
|
1194
|
+
return n && e ? /* @__PURE__ */ E(
|
|
1195
|
+
ne,
|
|
1189
1196
|
{
|
|
1190
1197
|
placement: "bottom start",
|
|
1191
1198
|
show: l,
|
|
1192
|
-
onToggle: (
|
|
1199
|
+
onToggle: (g) => a(g),
|
|
1193
1200
|
shouldHideOnSelect: !0,
|
|
1194
1201
|
shouldFocusTriggerOnClose: !0,
|
|
1195
|
-
trigger: /* @__PURE__ */ s(
|
|
1202
|
+
trigger: /* @__PURE__ */ s(Pe, { color: r.color, renderIcon: r.icon, children: i }),
|
|
1196
1203
|
children: [
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */ s(
|
|
1204
|
+
/* @__PURE__ */ E(ne.Item, { ref: m, onClick: () => h(k.CONFUSING), children: [
|
|
1205
|
+
/* @__PURE__ */ s(Se, { size: "x-small" }),
|
|
1199
1206
|
` ${o.markUnclear}`
|
|
1200
1207
|
] }),
|
|
1201
|
-
/* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */ s(
|
|
1208
|
+
/* @__PURE__ */ E(ne.Item, { ref: c, onClick: () => h(k.IMPORTANT), children: [
|
|
1209
|
+
/* @__PURE__ */ s(Te, { size: "x-small" }),
|
|
1203
1210
|
` ${o.markImportant}`
|
|
1204
1211
|
] })
|
|
1205
1212
|
]
|
|
1206
1213
|
}
|
|
1207
|
-
) : /* @__PURE__ */ s(z, { display: "inline-flex", children: /* @__PURE__ */ s(
|
|
1214
|
+
) : /* @__PURE__ */ s(z, { display: "inline-flex", children: /* @__PURE__ */ s(Pe, { color: r.color, renderIcon: r.icon, children: i }) });
|
|
1208
1215
|
};
|
|
1209
|
-
function
|
|
1210
|
-
return (
|
|
1216
|
+
function Me(t, e) {
|
|
1217
|
+
return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
|
|
1211
1218
|
year: "numeric",
|
|
1212
1219
|
month: "short",
|
|
1213
1220
|
day: "numeric"
|
|
1214
1221
|
});
|
|
1215
1222
|
}
|
|
1216
|
-
const
|
|
1217
|
-
noteId:
|
|
1223
|
+
const kn = ({
|
|
1224
|
+
noteId: t,
|
|
1218
1225
|
date: e,
|
|
1219
|
-
highlight:
|
|
1226
|
+
highlight: n,
|
|
1220
1227
|
note: o,
|
|
1221
1228
|
type: r,
|
|
1222
1229
|
onClick: i,
|
|
1223
1230
|
onDelete: l,
|
|
1224
1231
|
onSaveNote: a,
|
|
1225
|
-
onTypeChange:
|
|
1232
|
+
onTypeChange: m,
|
|
1226
1233
|
isActive: c,
|
|
1227
|
-
isPanelView:
|
|
1228
|
-
courseName:
|
|
1229
|
-
locale:
|
|
1230
|
-
highlightTheme:
|
|
1231
|
-
renderLink:
|
|
1232
|
-
href:
|
|
1234
|
+
isPanelView: h = !1,
|
|
1235
|
+
courseName: g,
|
|
1236
|
+
locale: u,
|
|
1237
|
+
highlightTheme: p,
|
|
1238
|
+
renderLink: y,
|
|
1239
|
+
href: T
|
|
1233
1240
|
}) => {
|
|
1234
|
-
const { translations: N } =
|
|
1235
|
-
|
|
1241
|
+
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) => {
|
|
1242
|
+
A.current = f;
|
|
1236
1243
|
}, []);
|
|
1237
|
-
|
|
1238
|
-
var
|
|
1239
|
-
c && ((
|
|
1244
|
+
Z(() => {
|
|
1245
|
+
var f, F;
|
|
1246
|
+
c && ((f = A.current) == null || f.scrollIntoView({ behavior: "smooth", block: "nearest" }), (F = A.current) == null || F.focus());
|
|
1240
1247
|
}, [c]);
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1243
|
-
},
|
|
1244
|
-
|
|
1245
|
-
const
|
|
1248
|
+
const U = r === k.IMPORTANT ? N.important : N.unclear, te = (f) => {
|
|
1249
|
+
f.key === "Enter" && (f.preventDefault(), i == null || i());
|
|
1250
|
+
}, $ = [U, N.note];
|
|
1251
|
+
n && $.push(n), o && $.push(o), e && $.push(Me(e, u)), g && $.push(g);
|
|
1252
|
+
const le = $.join(", "), D = /* @__PURE__ */ E(
|
|
1246
1253
|
z,
|
|
1247
1254
|
{
|
|
1248
1255
|
as: "div",
|
|
@@ -1250,140 +1257,140 @@ const Cn = ({
|
|
|
1250
1257
|
borderRadius: "medium",
|
|
1251
1258
|
padding: "small",
|
|
1252
1259
|
position: "relative",
|
|
1253
|
-
role:
|
|
1254
|
-
"aria-label":
|
|
1255
|
-
"aria-pressed":
|
|
1256
|
-
tabIndex:
|
|
1257
|
-
"data-testid":
|
|
1258
|
-
elementRef:
|
|
1260
|
+
role: T || b ? void 0 : "button",
|
|
1261
|
+
"aria-label": T ? void 0 : le,
|
|
1262
|
+
"aria-pressed": T || b ? void 0 : c,
|
|
1263
|
+
tabIndex: T || c ? -1 : 0,
|
|
1264
|
+
"data-testid": `note-card-${t}`,
|
|
1265
|
+
elementRef: w,
|
|
1259
1266
|
onClick: c ? void 0 : i,
|
|
1260
|
-
onMouseEnter: () =>
|
|
1261
|
-
onMouseLeave: () =>
|
|
1262
|
-
onKeyDown: c ? void 0 :
|
|
1263
|
-
cursor:
|
|
1267
|
+
onMouseEnter: () => L(!0),
|
|
1268
|
+
onMouseLeave: () => L(!1),
|
|
1269
|
+
onKeyDown: c ? void 0 : te,
|
|
1270
|
+
cursor: b ? "default" : "pointer",
|
|
1264
1271
|
children: [
|
|
1265
|
-
/* @__PURE__ */
|
|
1272
|
+
/* @__PURE__ */ E(S, { direction: "column", gap: "small", children: [
|
|
1266
1273
|
/* @__PURE__ */ s(
|
|
1267
|
-
|
|
1274
|
+
Je,
|
|
1268
1275
|
{
|
|
1269
1276
|
type: r,
|
|
1270
|
-
onTypeChange:
|
|
1271
|
-
renderAsMenuTrigger:
|
|
1277
|
+
onTypeChange: h && m ? (f) => m(t, f) : void 0,
|
|
1278
|
+
renderAsMenuTrigger: h && !!m && !!c
|
|
1272
1279
|
}
|
|
1273
1280
|
),
|
|
1274
|
-
|
|
1275
|
-
|
|
1281
|
+
n ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(W, { children: c && h ? /* @__PURE__ */ s(
|
|
1282
|
+
ye,
|
|
1276
1283
|
{
|
|
1277
1284
|
type: r,
|
|
1278
|
-
isCardActive: !!c ||
|
|
1279
|
-
theme:
|
|
1280
|
-
children:
|
|
1285
|
+
isCardActive: !!c || O,
|
|
1286
|
+
theme: p,
|
|
1287
|
+
children: n
|
|
1281
1288
|
}
|
|
1282
|
-
) : /* @__PURE__ */ s(
|
|
1283
|
-
|
|
1289
|
+
) : /* @__PURE__ */ s(Ne, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ s(
|
|
1290
|
+
ye,
|
|
1284
1291
|
{
|
|
1285
1292
|
type: r,
|
|
1286
|
-
isCardActive: !!c ||
|
|
1287
|
-
theme:
|
|
1288
|
-
children:
|
|
1293
|
+
isCardActive: !!c || O,
|
|
1294
|
+
theme: p,
|
|
1295
|
+
children: n
|
|
1289
1296
|
}
|
|
1290
|
-
) }) }) }) : /* @__PURE__ */ s(
|
|
1291
|
-
/* @__PURE__ */
|
|
1292
|
-
|
|
1297
|
+
) }) }) }) : /* @__PURE__ */ s(Ze, {}),
|
|
1298
|
+
/* @__PURE__ */ E(S, { direction: "column", gap: "small", children: [
|
|
1299
|
+
b && h ? /* @__PURE__ */ E(S, { direction: "column", gap: "x-small", children: [
|
|
1293
1300
|
/* @__PURE__ */ s(
|
|
1294
|
-
|
|
1301
|
+
$e,
|
|
1295
1302
|
{
|
|
1296
|
-
label: /* @__PURE__ */ s(
|
|
1297
|
-
value:
|
|
1298
|
-
onChange: (
|
|
1303
|
+
label: /* @__PURE__ */ s(ze, { children: N.editNote }),
|
|
1304
|
+
value: R,
|
|
1305
|
+
onChange: (f) => C(f.target.value),
|
|
1299
1306
|
placeholder: N.addNoteOptional
|
|
1300
1307
|
}
|
|
1301
1308
|
),
|
|
1302
|
-
/* @__PURE__ */
|
|
1303
|
-
/* @__PURE__ */ s(
|
|
1304
|
-
|
|
1309
|
+
/* @__PURE__ */ E(S, { gap: "xx-small", children: [
|
|
1310
|
+
/* @__PURE__ */ s(S.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1311
|
+
K,
|
|
1305
1312
|
{
|
|
1306
1313
|
display: "block",
|
|
1307
1314
|
size: "small",
|
|
1308
|
-
"data-testid":
|
|
1315
|
+
"data-testid": `note-card-${t}-cancel`,
|
|
1309
1316
|
onClick: () => {
|
|
1310
|
-
|
|
1317
|
+
C(o || ""), I(!1);
|
|
1311
1318
|
},
|
|
1312
1319
|
children: N.cancel
|
|
1313
1320
|
}
|
|
1314
1321
|
) }),
|
|
1315
|
-
/* @__PURE__ */ s(
|
|
1316
|
-
|
|
1322
|
+
/* @__PURE__ */ s(S.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1323
|
+
K,
|
|
1317
1324
|
{
|
|
1318
1325
|
display: "block",
|
|
1319
1326
|
color: "primary",
|
|
1320
1327
|
size: "small",
|
|
1321
|
-
"data-testid":
|
|
1328
|
+
"data-testid": `note-card-${t}-save`,
|
|
1322
1329
|
onClick: () => {
|
|
1323
|
-
a == null || a(
|
|
1330
|
+
a == null || a(t, R), I(!1);
|
|
1324
1331
|
},
|
|
1325
|
-
interaction:
|
|
1332
|
+
interaction: R.trim() ? "enabled" : "disabled",
|
|
1326
1333
|
children: N.save
|
|
1327
1334
|
}
|
|
1328
1335
|
) })
|
|
1329
1336
|
] })
|
|
1330
|
-
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c &&
|
|
1337
|
+
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && h ? /* @__PURE__ */ E(W, { children: [
|
|
1331
1338
|
o,
|
|
1332
1339
|
" ",
|
|
1333
1340
|
/* @__PURE__ */ s(
|
|
1334
|
-
|
|
1341
|
+
re,
|
|
1335
1342
|
{
|
|
1336
1343
|
size: "small",
|
|
1337
1344
|
withBackground: !1,
|
|
1338
1345
|
withBorder: !1,
|
|
1339
1346
|
screenReaderLabel: N.editNote,
|
|
1340
|
-
"data-testid":
|
|
1341
|
-
onClick: (
|
|
1342
|
-
|
|
1347
|
+
"data-testid": `note-card-${t}-edit`,
|
|
1348
|
+
onClick: (f) => {
|
|
1349
|
+
f.stopPropagation(), I(!0);
|
|
1343
1350
|
},
|
|
1344
|
-
children: /* @__PURE__ */ s(
|
|
1351
|
+
children: /* @__PURE__ */ s(pe, {})
|
|
1345
1352
|
}
|
|
1346
1353
|
)
|
|
1347
|
-
] }) : /* @__PURE__ */ s(W, { children: /* @__PURE__ */ s(
|
|
1354
|
+
] }) : /* @__PURE__ */ s(W, { children: /* @__PURE__ */ s(Ne, { maxLines: 3, truncate: "word", children: o }) }) }) : h && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ E(W, { color: "secondary", children: [
|
|
1348
1355
|
N.addNotePrompt,
|
|
1349
1356
|
" ",
|
|
1350
1357
|
/* @__PURE__ */ s(
|
|
1351
|
-
|
|
1358
|
+
re,
|
|
1352
1359
|
{
|
|
1353
1360
|
size: "small",
|
|
1354
1361
|
withBackground: !1,
|
|
1355
1362
|
withBorder: !1,
|
|
1356
1363
|
screenReaderLabel: N.editNote,
|
|
1357
|
-
"data-testid":
|
|
1358
|
-
onClick: (
|
|
1359
|
-
|
|
1364
|
+
"data-testid": `note-card-${t}-edit`,
|
|
1365
|
+
onClick: (f) => {
|
|
1366
|
+
f.stopPropagation(), I(!0);
|
|
1360
1367
|
},
|
|
1361
|
-
children: /* @__PURE__ */ s(
|
|
1368
|
+
children: /* @__PURE__ */ s(pe, {})
|
|
1362
1369
|
}
|
|
1363
1370
|
)
|
|
1364
1371
|
] }) }) : null,
|
|
1365
|
-
/* @__PURE__ */
|
|
1366
|
-
/* @__PURE__ */ s(W, { size: "small", color: "secondary", children:
|
|
1372
|
+
/* @__PURE__ */ E(S, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1373
|
+
/* @__PURE__ */ s(W, { size: "small", color: "secondary", children: Me(e, u) }),
|
|
1367
1374
|
c && l && /* @__PURE__ */ s(
|
|
1368
|
-
|
|
1375
|
+
re,
|
|
1369
1376
|
{
|
|
1370
1377
|
size: "small",
|
|
1371
1378
|
withBackground: !1,
|
|
1372
1379
|
withBorder: !1,
|
|
1373
1380
|
color: "danger",
|
|
1374
1381
|
screenReaderLabel: N.deleteNote,
|
|
1375
|
-
"data-testid":
|
|
1376
|
-
onClick: (
|
|
1377
|
-
|
|
1382
|
+
"data-testid": `note-card-${t}-delete`,
|
|
1383
|
+
onClick: (f) => {
|
|
1384
|
+
f.stopPropagation(), x(!0);
|
|
1378
1385
|
},
|
|
1379
|
-
children: /* @__PURE__ */ s(
|
|
1386
|
+
children: /* @__PURE__ */ s(ue, {})
|
|
1380
1387
|
}
|
|
1381
1388
|
)
|
|
1382
1389
|
] }),
|
|
1383
|
-
|
|
1390
|
+
g && /* @__PURE__ */ s(W, { size: "small", color: "secondary", children: g })
|
|
1384
1391
|
] })
|
|
1385
1392
|
] }),
|
|
1386
|
-
|
|
1393
|
+
B && l && /* @__PURE__ */ s(
|
|
1387
1394
|
z,
|
|
1388
1395
|
{
|
|
1389
1396
|
as: "div",
|
|
@@ -1396,8 +1403,8 @@ const Cn = ({
|
|
|
1396
1403
|
insetInlineStart: "0",
|
|
1397
1404
|
insetInlineEnd: "0",
|
|
1398
1405
|
stacking: "above",
|
|
1399
|
-
children: /* @__PURE__ */
|
|
1400
|
-
|
|
1406
|
+
children: /* @__PURE__ */ E(
|
|
1407
|
+
S,
|
|
1401
1408
|
{
|
|
1402
1409
|
direction: "column",
|
|
1403
1410
|
justifyItems: "center",
|
|
@@ -1406,27 +1413,27 @@ const Cn = ({
|
|
|
1406
1413
|
height: "100%",
|
|
1407
1414
|
children: [
|
|
1408
1415
|
/* @__PURE__ */ s(
|
|
1409
|
-
|
|
1416
|
+
K,
|
|
1410
1417
|
{
|
|
1411
1418
|
display: "block",
|
|
1412
1419
|
color: "danger",
|
|
1413
1420
|
size: "small",
|
|
1414
|
-
renderIcon: /* @__PURE__ */ s(
|
|
1415
|
-
"data-testid":
|
|
1416
|
-
onClick: (
|
|
1417
|
-
|
|
1421
|
+
renderIcon: /* @__PURE__ */ s(ue, {}),
|
|
1422
|
+
"data-testid": `note-card-${t}-confirm-delete`,
|
|
1423
|
+
onClick: (f) => {
|
|
1424
|
+
f.stopPropagation(), l(t), x(!1);
|
|
1418
1425
|
},
|
|
1419
1426
|
children: N.deleteNote
|
|
1420
1427
|
}
|
|
1421
1428
|
),
|
|
1422
1429
|
/* @__PURE__ */ s(
|
|
1423
|
-
|
|
1430
|
+
K,
|
|
1424
1431
|
{
|
|
1425
1432
|
display: "block",
|
|
1426
1433
|
size: "small",
|
|
1427
|
-
"data-testid":
|
|
1428
|
-
onClick: (
|
|
1429
|
-
|
|
1434
|
+
"data-testid": `note-card-${t}-cancel-delete`,
|
|
1435
|
+
onClick: (f) => {
|
|
1436
|
+
f.stopPropagation(), x(!1);
|
|
1430
1437
|
},
|
|
1431
1438
|
children: N.cancel
|
|
1432
1439
|
}
|
|
@@ -1439,168 +1446,168 @@ const Cn = ({
|
|
|
1439
1446
|
]
|
|
1440
1447
|
}
|
|
1441
1448
|
);
|
|
1442
|
-
return
|
|
1449
|
+
return T && y ? y({ href: T, children: D, ariaLabel: le }) : D;
|
|
1443
1450
|
};
|
|
1444
|
-
function
|
|
1445
|
-
const
|
|
1446
|
-
return
|
|
1447
|
-
|
|
1448
|
-
}),
|
|
1451
|
+
function On(t, e) {
|
|
1452
|
+
const n = Array.from({ length: e }, () => []);
|
|
1453
|
+
return t.forEach((o, r) => {
|
|
1454
|
+
n[r % e].push(o);
|
|
1455
|
+
}), n;
|
|
1449
1456
|
}
|
|
1450
|
-
const
|
|
1457
|
+
const Rn = {
|
|
1451
1458
|
display: "flex",
|
|
1452
1459
|
gap: "1rem",
|
|
1453
1460
|
boxSizing: "border-box",
|
|
1454
1461
|
width: "100%",
|
|
1455
1462
|
alignItems: "flex-start"
|
|
1456
|
-
},
|
|
1463
|
+
}, Dn = {
|
|
1457
1464
|
display: "flex",
|
|
1458
1465
|
flexDirection: "column",
|
|
1459
1466
|
gap: "1rem",
|
|
1460
1467
|
flex: 1,
|
|
1461
1468
|
minWidth: 0
|
|
1462
|
-
},
|
|
1463
|
-
notes:
|
|
1469
|
+
}, ro = ({
|
|
1470
|
+
notes: t,
|
|
1464
1471
|
isLoading: e,
|
|
1465
|
-
isError:
|
|
1472
|
+
isError: n,
|
|
1466
1473
|
currentPage: o,
|
|
1467
1474
|
totalPages: r,
|
|
1468
1475
|
onPageChange: i,
|
|
1469
1476
|
onNoteSelect: l,
|
|
1470
1477
|
onNoteDelete: a,
|
|
1471
|
-
onNoteSave:
|
|
1478
|
+
onNoteSave: m,
|
|
1472
1479
|
onNoteTypeChange: c,
|
|
1473
|
-
selectedNoteId:
|
|
1474
|
-
hasActiveFilter:
|
|
1475
|
-
columnCount:
|
|
1476
|
-
highlightTheme:
|
|
1477
|
-
locale:
|
|
1478
|
-
renderNoteLink:
|
|
1480
|
+
selectedNoteId: h,
|
|
1481
|
+
hasActiveFilter: g = !1,
|
|
1482
|
+
columnCount: u = 1,
|
|
1483
|
+
highlightTheme: p,
|
|
1484
|
+
locale: y,
|
|
1485
|
+
renderNoteLink: T,
|
|
1479
1486
|
noteHref: N
|
|
1480
1487
|
}) => {
|
|
1481
|
-
const { translations:
|
|
1482
|
-
() =>
|
|
1483
|
-
[
|
|
1488
|
+
const { translations: O } = Q(), L = ie(
|
|
1489
|
+
() => On(t, u),
|
|
1490
|
+
[t, u]
|
|
1484
1491
|
);
|
|
1485
1492
|
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:
|
|
1493
|
+
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(dt, { renderTitle: O.loadingNotes }) });
|
|
1494
|
+
if (n)
|
|
1495
|
+
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(fe, { level: "h4", children: O.failedToLoadNotes }) });
|
|
1496
|
+
if (t.length === 0)
|
|
1497
|
+
return /* @__PURE__ */ s(z, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(xn, { hasActiveFilter: g }) });
|
|
1498
|
+
const b = typeof o == "number" && typeof r == "number" && r > 1 && i !== void 0;
|
|
1499
|
+
return /* @__PURE__ */ E(et, { children: [
|
|
1500
|
+
/* @__PURE__ */ s("div", { style: Rn, "data-testid": "notes-grid", children: L.map((I, R) => (
|
|
1494
1501
|
// oxlint-disable-next-line react/no-array-index-key -- columns are positional, index is stable
|
|
1495
|
-
/* @__PURE__ */ s("div", { style:
|
|
1496
|
-
var
|
|
1502
|
+
/* @__PURE__ */ s("div", { style: Dn, children: I.map((C) => {
|
|
1503
|
+
var B;
|
|
1497
1504
|
return /* @__PURE__ */ s(
|
|
1498
|
-
|
|
1505
|
+
kn,
|
|
1499
1506
|
{
|
|
1500
|
-
noteId:
|
|
1501
|
-
date:
|
|
1502
|
-
type:
|
|
1503
|
-
highlight: (
|
|
1504
|
-
note:
|
|
1505
|
-
isActive:
|
|
1506
|
-
isPanelView: !!
|
|
1507
|
-
onClick: l ? () => l(
|
|
1507
|
+
noteId: C.id,
|
|
1508
|
+
date: C.createdAt,
|
|
1509
|
+
type: C.reaction[0] ?? k.IMPORTANT,
|
|
1510
|
+
highlight: (B = C.highlightData) == null ? void 0 : B.selectedText,
|
|
1511
|
+
note: C.userText,
|
|
1512
|
+
isActive: h === C.id,
|
|
1513
|
+
isPanelView: !!h,
|
|
1514
|
+
onClick: l ? () => l(C.id) : void 0,
|
|
1508
1515
|
onDelete: a ? (x) => a(x) : void 0,
|
|
1509
|
-
onSaveNote:
|
|
1510
|
-
onTypeChange: c ? (x,
|
|
1511
|
-
highlightTheme:
|
|
1512
|
-
locale:
|
|
1513
|
-
renderLink:
|
|
1514
|
-
href: N ? N(
|
|
1516
|
+
onSaveNote: m ? (x, A) => m(x, A) : void 0,
|
|
1517
|
+
onTypeChange: c ? (x, A) => c(x, A) : void 0,
|
|
1518
|
+
highlightTheme: p,
|
|
1519
|
+
locale: y,
|
|
1520
|
+
renderLink: T,
|
|
1521
|
+
href: N ? N(C.id, C) : void 0
|
|
1515
1522
|
},
|
|
1516
|
-
|
|
1523
|
+
C.id
|
|
1517
1524
|
);
|
|
1518
|
-
}) },
|
|
1525
|
+
}) }, R)
|
|
1519
1526
|
)) }),
|
|
1520
|
-
|
|
1521
|
-
|
|
1527
|
+
b && /* @__PURE__ */ s(S, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ s(S.Item, { children: /* @__PURE__ */ s(
|
|
1528
|
+
ct,
|
|
1522
1529
|
{
|
|
1523
1530
|
as: "nav",
|
|
1524
1531
|
variant: "input",
|
|
1525
|
-
labelNext:
|
|
1526
|
-
labelPrev:
|
|
1532
|
+
labelNext: O.nextPage,
|
|
1533
|
+
labelPrev: O.previousPage,
|
|
1527
1534
|
currentPage: o,
|
|
1528
1535
|
totalPageNumber: r,
|
|
1529
1536
|
onPageChange: i
|
|
1530
1537
|
}
|
|
1531
1538
|
) }) })
|
|
1532
1539
|
] });
|
|
1533
|
-
},
|
|
1534
|
-
noteText:
|
|
1540
|
+
}, so = ({
|
|
1541
|
+
noteText: t,
|
|
1535
1542
|
reaction: e,
|
|
1536
|
-
highlightText:
|
|
1543
|
+
highlightText: n,
|
|
1537
1544
|
highlightTheme: o,
|
|
1538
1545
|
onSave: r,
|
|
1539
1546
|
onDelete: i,
|
|
1540
1547
|
onTypeChange: l,
|
|
1541
1548
|
onBack: a,
|
|
1542
|
-
editing:
|
|
1549
|
+
editing: m = !1
|
|
1543
1550
|
}) => {
|
|
1544
|
-
const { translations: c } =
|
|
1545
|
-
return /* @__PURE__ */
|
|
1546
|
-
|
|
1547
|
-
/* @__PURE__ */ s(
|
|
1548
|
-
|
|
1551
|
+
const { translations: c } = Q(), [h, g] = H(m), [u, p] = H(t || ""), [y, T] = H(!1);
|
|
1552
|
+
return /* @__PURE__ */ E(S, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1553
|
+
n != null ? /* @__PURE__ */ s(z, { as: "div", children: /* @__PURE__ */ s(W, { children: /* @__PURE__ */ s(ye, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ s(Ze, {}),
|
|
1554
|
+
/* @__PURE__ */ s(Je, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1555
|
+
h ? /* @__PURE__ */ E(S, { direction: "column", gap: "x-small", children: [
|
|
1549
1556
|
/* @__PURE__ */ s(
|
|
1550
|
-
|
|
1557
|
+
$e,
|
|
1551
1558
|
{
|
|
1552
1559
|
label: c.addNoteOptional,
|
|
1553
|
-
value:
|
|
1554
|
-
onChange: (N) =>
|
|
1560
|
+
value: u,
|
|
1561
|
+
onChange: (N) => p(N.target.value),
|
|
1555
1562
|
resize: "vertical"
|
|
1556
1563
|
}
|
|
1557
1564
|
),
|
|
1558
|
-
/* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */ s(
|
|
1560
|
-
|
|
1565
|
+
/* @__PURE__ */ E(S, { gap: "xx-small", children: [
|
|
1566
|
+
/* @__PURE__ */ s(S.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1567
|
+
K,
|
|
1561
1568
|
{
|
|
1562
1569
|
display: "block",
|
|
1563
1570
|
size: "small",
|
|
1564
1571
|
"data-testid": "single-note-cancel",
|
|
1565
1572
|
onClick: () => {
|
|
1566
|
-
|
|
1573
|
+
p(t || ""), g(!1);
|
|
1567
1574
|
},
|
|
1568
1575
|
children: c.cancel
|
|
1569
1576
|
}
|
|
1570
1577
|
) }),
|
|
1571
|
-
/* @__PURE__ */ s(
|
|
1572
|
-
|
|
1578
|
+
/* @__PURE__ */ s(S.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1579
|
+
K,
|
|
1573
1580
|
{
|
|
1574
1581
|
display: "block",
|
|
1575
1582
|
color: "primary",
|
|
1576
1583
|
size: "small",
|
|
1577
1584
|
"data-testid": "single-note-save",
|
|
1578
1585
|
onClick: () => {
|
|
1579
|
-
r(
|
|
1586
|
+
r(u), g(!1);
|
|
1580
1587
|
},
|
|
1581
1588
|
children: c.save
|
|
1582
1589
|
}
|
|
1583
1590
|
) })
|
|
1584
1591
|
] })
|
|
1585
|
-
] }) : /* @__PURE__ */
|
|
1586
|
-
|
|
1587
|
-
/* @__PURE__ */ s(
|
|
1588
|
-
/* @__PURE__ */ s(W, { children:
|
|
1592
|
+
] }) : /* @__PURE__ */ E(S, { direction: "column", gap: "small", children: [
|
|
1593
|
+
t && /* @__PURE__ */ E(z, { as: "div", children: [
|
|
1594
|
+
/* @__PURE__ */ s(fe, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
|
|
1595
|
+
/* @__PURE__ */ s(W, { children: t })
|
|
1589
1596
|
] }),
|
|
1590
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ E(S, { justifyItems: "space-between", children: [
|
|
1591
1598
|
/* @__PURE__ */ s(
|
|
1592
|
-
|
|
1599
|
+
K,
|
|
1593
1600
|
{
|
|
1594
1601
|
size: "small",
|
|
1595
|
-
renderIcon: /* @__PURE__ */ s(
|
|
1602
|
+
renderIcon: /* @__PURE__ */ s(it, {}),
|
|
1596
1603
|
"data-testid": "single-note-back",
|
|
1597
1604
|
onClick: () => a == null ? void 0 : a(),
|
|
1598
1605
|
children: c.back
|
|
1599
1606
|
}
|
|
1600
1607
|
),
|
|
1601
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ E(S, { gap: "xx-small", children: [
|
|
1602
1609
|
i && /* @__PURE__ */ s(
|
|
1603
|
-
|
|
1610
|
+
re,
|
|
1604
1611
|
{
|
|
1605
1612
|
size: "small",
|
|
1606
1613
|
withBackground: !1,
|
|
@@ -1608,46 +1615,46 @@ const xn = {
|
|
|
1608
1615
|
color: "danger",
|
|
1609
1616
|
screenReaderLabel: c.deleteNote,
|
|
1610
1617
|
"data-testid": "single-note-delete",
|
|
1611
|
-
onClick: () =>
|
|
1612
|
-
children: /* @__PURE__ */ s(
|
|
1618
|
+
onClick: () => T(!0),
|
|
1619
|
+
children: /* @__PURE__ */ s(ue, {})
|
|
1613
1620
|
}
|
|
1614
1621
|
),
|
|
1615
1622
|
/* @__PURE__ */ s(
|
|
1616
|
-
|
|
1623
|
+
re,
|
|
1617
1624
|
{
|
|
1618
1625
|
size: "small",
|
|
1619
1626
|
withBackground: !1,
|
|
1620
1627
|
withBorder: !1,
|
|
1621
1628
|
screenReaderLabel: c.editNote,
|
|
1622
1629
|
"data-testid": "single-note-edit",
|
|
1623
|
-
onClick: () =>
|
|
1624
|
-
children: /* @__PURE__ */ s(
|
|
1630
|
+
onClick: () => g(!0),
|
|
1631
|
+
children: /* @__PURE__ */ s(pe, {})
|
|
1625
1632
|
}
|
|
1626
1633
|
)
|
|
1627
1634
|
] })
|
|
1628
1635
|
] }),
|
|
1629
|
-
|
|
1636
|
+
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
1637
|
/* @__PURE__ */ s(
|
|
1631
|
-
|
|
1638
|
+
K,
|
|
1632
1639
|
{
|
|
1633
1640
|
display: "block",
|
|
1634
1641
|
color: "danger",
|
|
1635
1642
|
size: "small",
|
|
1636
|
-
renderIcon: /* @__PURE__ */ s(
|
|
1643
|
+
renderIcon: /* @__PURE__ */ s(ue, {}),
|
|
1637
1644
|
"data-testid": "single-note-confirm-delete",
|
|
1638
1645
|
onClick: () => {
|
|
1639
|
-
i(),
|
|
1646
|
+
i(), T(!1);
|
|
1640
1647
|
},
|
|
1641
1648
|
children: c.deleteNote
|
|
1642
1649
|
}
|
|
1643
1650
|
),
|
|
1644
1651
|
/* @__PURE__ */ s(
|
|
1645
|
-
|
|
1652
|
+
K,
|
|
1646
1653
|
{
|
|
1647
1654
|
display: "block",
|
|
1648
1655
|
size: "small",
|
|
1649
1656
|
"data-testid": "single-note-cancel-delete",
|
|
1650
|
-
onClick: () =>
|
|
1657
|
+
onClick: () => T(!1),
|
|
1651
1658
|
children: c.cancel
|
|
1652
1659
|
}
|
|
1653
1660
|
)
|
|
@@ -1656,26 +1663,26 @@ const xn = {
|
|
|
1656
1663
|
] });
|
|
1657
1664
|
};
|
|
1658
1665
|
export {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1666
|
+
eo as ContentWithNoteWrapper,
|
|
1667
|
+
ye as Highlight,
|
|
1668
|
+
Ze as HighlightError,
|
|
1669
|
+
kn as NoteCard,
|
|
1670
|
+
Je as NoteChip,
|
|
1671
|
+
Tn as NoteReactionMenu,
|
|
1672
|
+
xn as NotebookEmptyState,
|
|
1673
|
+
Jn as NotebookProvider,
|
|
1674
|
+
bn as NotebookTranslationsProvider,
|
|
1675
|
+
oo as NotebookTray,
|
|
1676
|
+
ro as NotesListView,
|
|
1670
1677
|
k as REACTION_TYPE,
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1678
|
+
so as SingleNote,
|
|
1679
|
+
we as createTransparentColor,
|
|
1680
|
+
At as useCreateNote,
|
|
1681
|
+
Ft as useDeleteNote,
|
|
1682
|
+
Ke as useGetNotes,
|
|
1683
|
+
Ye as useNotebook,
|
|
1684
|
+
Q as useNotebookTranslations,
|
|
1685
|
+
to as useNotesData,
|
|
1686
|
+
no as useReactionFilter,
|
|
1687
|
+
_t as useUpdateNote
|
|
1681
1688
|
};
|