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