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