@instructure/platform-notebook 1.6.1 → 1.6.2

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