@instructure/platform-notebook 1.6.2 → 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 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
- import { z as u } from "zod";
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
- import { Flex as x } from "@instructure/ui-flex";
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
9
  import { Heading as ye } from "@instructure/ui-heading";
10
- import { Tray as mt } from "@instructure/ui-tray";
11
- import { View as q } from "@instructure/ui-view";
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";
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 yt } 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 Nt } from "@instructure/ui-pagination";
21
- import { Spinner as bt } from "@instructure/ui-spinner";
22
- const Et = u.object({
23
- startContainer: u.string(),
24
- endContainer: u.string(),
25
- startOffset: u.number(),
26
- endOffset: u.number()
27
- }), St = u.object({
28
- start: u.number(),
29
- end: u.number()
30
- }), ke = u.object({
31
- selectedText: u.string(),
32
- hasNoHighlightAnymore: u.boolean().optional(),
33
- textPosition: St.nullable(),
34
- range: Et.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
- var w = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(w || {});
38
- const we = u.enum([
38
+ var L = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(L || {});
39
+ const Oe = f.enum([
39
40
  "Important",
40
41
  "Confusing"
41
42
  /* CONFUSING */
42
- ]), Tt = u.object({
43
- totalCount: u.number().nullish(),
44
- totalNrOfPages: u.number().nullish()
45
- }), Ne = 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(we),
54
- highlightData: ke,
55
- createdAt: u.string(),
56
- updatedAt: u.string()
57
- }), It = u.object({
58
- cursor: u.string(),
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),
55
+ highlightData: we,
56
+ createdAt: f.string(),
57
+ updatedAt: f.string()
58
+ }), It = f.object({
59
+ cursor: f.string(),
59
60
  node: Ne
60
61
  });
61
- u.object({
62
- notes: u.object({
63
- edges: u.array(It),
64
- nodes: u.array(Ne),
65
- pageInfo: Tt
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 vt = u.object({
69
- type: u.string(),
70
- id: u.string()
71
- }), Ct = u.object({
72
- courseId: u.string().optional(),
73
- learningObject: vt.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: Ct,
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(we),
88
- highlightData: ke
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),
89
+ highlightData: we
89
90
  });
90
- u.object({
91
+ f.object({
91
92
  createNote: Ne
92
93
  });
93
- u.object({
94
- id: u.string(),
95
- userText: u.string().optional(),
96
- reaction: u.array(we),
97
- highlightData: ke
94
+ f.object({
95
+ id: f.string(),
96
+ userText: f.string().optional(),
97
+ reaction: f.array(Oe),
98
+ highlightData: we
98
99
  });
99
- u.object({
100
+ f.object({
100
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 = W.fromPoint(e.startContainer, e.startOffset), o = W.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 W(e, n), new W(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 W {
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 W {
153
154
  static fromCharOffset(e, n) {
154
155
  switch (e.nodeType) {
155
156
  case Node.TEXT_NODE:
156
- return W.fromPoint(e, n);
157
+ return q.fromPoint(e, n);
157
158
  case Node.ELEMENT_NODE:
158
- return new W(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
  }
@@ -168,15 +169,15 @@ class W {
168
169
  if (!e.parentElement)
169
170
  return console.error("Text node has no parent"), null;
170
171
  const o = He(e) + n;
171
- return new W(e.parentElement, o);
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 W(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;
@@ -188,21 +189,21 @@ class W {
188
189
  let n = this.element, o = this.offset;
189
190
  for (; n !== e; )
190
191
  o += He(n), n.parentElement && (n = n.parentElement);
191
- return new W(n, o);
192
+ return new q(n, o);
192
193
  }
193
194
  }
194
- const xt = (t) => {
195
+ const kt = (t) => {
195
196
  const e = t.nodeName.toLowerCase();
196
197
  return e === "#text" ? "text()" : e;
197
198
  };
198
- function Rt(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
205
  const Ot = (t) => {
205
- const e = xt(t), n = Rt(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;
@@ -214,7 +215,7 @@ const Ot = (t) => {
214
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 Ot = (t) => {
223
224
  return l;
224
225
  }
225
226
  return null;
226
- }, wt = (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,7 +240,7 @@ const Ot = (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;
@@ -247,17 +248,17 @@ const Ot = (t) => {
247
248
  return r;
248
249
  }, $e = (t, e = document.body) => {
249
250
  try {
250
- return wt(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))
@@ -268,18 +269,18 @@ class oe {
268
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 = W.fromCharOffset(o, n.startOffset), l = W.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:
@@ -322,9 +323,9 @@ const Xe = (t) => {
322
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
- }, Lt = (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
- }, At = (t, e, n, o) => {
343
- const r = new dt();
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 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
- 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
- }, Dt = (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 At(
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
- }, Pt = (t, e, n) => {
381
+ }, Ft = (t, e, n) => {
381
382
  const o = [], r = [];
382
383
  for (const s of e) {
383
- const l = Dt(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
- }, Ue = (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()) && Kt({ id: o });
417
- }, _t = (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, Ft = (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,26 +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 N;
450
- const y = o.bottom + r;
451
- if (c(y))
452
- N = y;
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) ? N = h : y + me > a - s ? N = a - me - s : N = s;
456
+ c(h) ? E = h : b + me > a - s ? E = a - me - s : E = s;
456
457
  }
457
- return { top: N, left: g };
458
- }, Mt = (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)}"]`, Bt = "2px", $t = "3px", Ht = "1px", Ve = "3px", Ut = "1px", jt = "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
- }, 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
+ }, 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) => {
469
470
  var n;
470
471
  try {
471
472
  const o = ((n = e.nodeValue) == null ? void 0 : n.length) ?? e.childNodes.length;
@@ -473,7 +474,7 @@ const Xe = (t) => {
473
474
  } catch {
474
475
  return !1;
475
476
  }
476
- }, Wt = (t) => {
477
+ }, qt = (t) => {
477
478
  var s;
478
479
  if (t.collapsed)
479
480
  return [];
@@ -483,7 +484,7 @@ const Xe = (t) => {
483
484
  const n = [], o = (s = e == null ? void 0 : e.ownerDocument) == null ? void 0 : s.createNodeIterator(e, NodeFilter.SHOW_TEXT);
484
485
  let r = (o == null ? void 0 : o.nextNode()) || null;
485
486
  for (; r; ) {
486
- if (!Gt(t, r)) {
487
+ if (!zt(t, r)) {
487
488
  r = (o == null ? void 0 : o.nextNode()) || null;
488
489
  continue;
489
490
  }
@@ -495,51 +496,51 @@ const Xe = (t) => {
495
496
  l === t.endContainer && t.endOffset < l.data.length && l.splitText(t.endOffset), n.push(l), r = (o == null ? void 0 : o.nextNode()) || null;
496
497
  }
497
498
  return n;
498
- }, zt = (t, e, n) => {
499
+ }, Kt = (t, e, n) => {
499
500
  if (t.collapsed) return;
500
501
  const o = e.id ?? "", r = Le(o);
501
502
  if (document.getElementById(be(o))) {
502
- qt(e, n);
503
+ Xt(e, n);
503
504
  return;
504
505
  }
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");
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");
506
507
  d.id = `${r}-start`, d.className = "highlight-marker-start", d.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 || "";
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 || "";
511
512
  const h = t.cloneRange();
512
- h.collapse(!1), h.insertNode(y);
513
- const T = t.cloneRange();
514
- 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);
515
516
  const p = document.createRange();
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) => {
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) => {
519
520
  var H;
520
- const B = b.parentElement;
521
+ const B = S.parentElement;
521
522
  if ((B == null ? void 0 : B.dataset.highlightId) === o) return;
522
- const F = I === 0, E = I === M.length - 1, A = M.length === 1;
523
+ const F = C === 0, y = C === M.length - 1, A = M.length === 1;
523
524
  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) => {
527
- var K;
528
- Q.target.tagName !== "A" && ((K = e.onClick) == null || K.call(e));
529
- }), (H = b.parentNode) == null || H.insertBefore(R, b), R.appendChild(b);
530
- }), d.addEventListener("click", (b) => {
531
- var I;
532
- b.target.tagName !== "A" && ((I = e.onClick) == null || I.call(e));
533
- }), d.addEventListener("keydown", (b) => {
534
- var I;
535
- if (b.key === "Enter" || b.key === " ")
536
- b.preventDefault(), (I = e.onClick) == null || I.call(e);
537
- else if (b.key === "Tab" && !b.shiftKey) {
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) {
538
539
  const B = document.querySelectorAll(ue(o));
539
540
  for (const F of B) {
540
- const E = F.querySelector("a");
541
- if (E) {
542
- b.preventDefault(), E.focus();
541
+ const y = F.querySelector("a");
542
+ if (y) {
543
+ S.preventDefault(), y.focus();
543
544
  break;
544
545
  }
545
546
  }
@@ -547,31 +548,31 @@ const Xe = (t) => {
547
548
  }), d.addEventListener("focus", () => {
548
549
  document.querySelectorAll(
549
550
  `.highlight-content${ue(o)}`
550
- ).forEach((I) => {
551
- I.style.boxShadow = `0 0 0 ${Bt} ${n.colors.focusOutline}`, I.style.borderRadius = $t;
551
+ ).forEach((C) => {
552
+ C.style.boxShadow = `0 0 0 ${Ht} ${n.colors.focusOutline}`, C.style.borderRadius = Gt;
552
553
  });
553
554
  }), d.addEventListener("blur", () => {
554
555
  document.querySelectorAll(
555
556
  `.highlight-content${ue(o)}`
556
- ).forEach((I) => {
557
- I.style.boxShadow = "", I.style.borderRadius = I.dataset.selected ? Ve : "";
557
+ ).forEach((C) => {
558
+ C.style.boxShadow = "", C.style.borderRadius = C.dataset.selected ? Ze : "";
558
559
  });
559
560
  });
560
561
  };
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";
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";
563
564
  document.querySelectorAll(
564
565
  `.highlight-content${ue(t.id ?? "")}`
565
566
  ).forEach((c) => {
566
- Ze(c, o, r, s, l);
567
+ Je(c, o, r, s, l);
567
568
  });
568
569
  const m = document.getElementById(
569
570
  be(t.id ?? "")
570
571
  );
571
572
  m && (m.setAttribute("aria-expanded", String(o && !!t.isTrayOpen)), o ? m.setAttribute("aria-current", "true") : m.removeAttribute("aria-current"));
572
573
  }
573
- const Kt = (t) => {
574
- 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));
575
576
  document.querySelectorAll(
576
577
  ue(e)
577
578
  ).forEach((s) => {
@@ -584,8 +585,8 @@ const Kt = (t) => {
584
585
  all: ["notebook"],
585
586
  notes: (t) => ["notebook", "notes", t]
586
587
  };
587
- function Xt(t) {
588
- const e = Ce();
588
+ function Yt(t) {
589
+ const e = Ie();
589
590
  return xe({
590
591
  mutationFn: (n) => t.createNote(n),
591
592
  onSuccess: () => {
@@ -593,8 +594,8 @@ function Xt(t) {
593
594
  }
594
595
  });
595
596
  }
596
- function Qt(t) {
597
- const e = Ce();
597
+ function Vt(t) {
598
+ const e = Ie();
598
599
  return xe({
599
600
  mutationFn: (n) => t.deleteNote(n),
600
601
  onSuccess: () => {
@@ -602,26 +603,26 @@ function Qt(t) {
602
603
  }
603
604
  });
604
605
  }
605
- function Je({
606
+ function et({
606
607
  api: t,
607
608
  enabled: e = !0,
608
609
  ...n
609
610
  }) {
610
- return ut({
611
+ return ft({
611
612
  queryKey: ce.notes(n),
612
613
  queryFn: () => t.getNotes(n),
613
614
  enabled: e
614
615
  });
615
616
  }
616
- const Yt = 100;
617
- function et({
617
+ const Zt = 100;
618
+ function tt({
618
619
  api: t,
619
620
  courseId: e,
620
621
  learningObject: n,
621
622
  reactions: o,
622
623
  enabled: r = !0
623
624
  }) {
624
- return Je({
625
+ return et({
625
626
  api: t,
626
627
  filter: {
627
628
  ...e ? { courseId: e } : {},
@@ -629,12 +630,12 @@ function et({
629
630
  ...o != null && o.length ? { reactions: o } : {}
630
631
  },
631
632
  offset: 0,
632
- pageSize: Yt,
633
+ pageSize: Zt,
633
634
  enabled: r
634
635
  });
635
636
  }
636
- function Vt(t) {
637
- const e = Ce();
637
+ function Jt(t) {
638
+ const e = Ie();
638
639
  return xe({
639
640
  mutationFn: ({ id: n, input: o }) => t.updateNote(n, o),
640
641
  onMutate: async ({ id: n, input: o }) => {
@@ -661,50 +662,51 @@ function Vt(t) {
661
662
  }
662
663
  });
663
664
  }
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) {
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) {
704
706
  const n = De[t] ?? t;
705
707
  return e ? n.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : n;
706
708
  }
707
- function Fn({
709
+ function $n({
708
710
  translations: t,
709
711
  translate: e,
710
712
  children: n
@@ -712,22 +714,22 @@ function Fn({
712
714
  const o = fe(
713
715
  () => ({
714
716
  translations: { ...De, ...t },
715
- translate: e ?? nt
717
+ translate: e ?? ot
716
718
  }),
717
719
  [t, e]
718
720
  );
719
- return /* @__PURE__ */ i(tt.Provider, { value: o, children: n });
721
+ return /* @__PURE__ */ i(nt.Provider, { value: o, children: n });
720
722
  }
721
723
  function Y() {
722
- const t = We(tt);
723
- return t || { translations: De, translate: nt };
724
+ const t = ze(nt);
725
+ return t || { translations: De, translate: ot };
724
726
  }
725
- const Mn = (t) => ({
727
+ const Hn = (t) => ({
726
728
  selectedNoteId: t ?? null,
727
729
  isNoteEditing: !1,
728
730
  isTrayOpen: t != null
729
731
  });
730
- function Bn(t, e) {
732
+ function Gn(t, e) {
731
733
  switch (e.type) {
732
734
  case "SELECT_NOTE":
733
735
  return {
@@ -747,8 +749,8 @@ function Bn(t, e) {
747
749
  return t;
748
750
  }
749
751
  }
750
- const ot = Ge(null);
751
- function ho({
752
+ const rt = We(null);
753
+ function bo({
752
754
  api: t,
753
755
  currentUserId: e,
754
756
  objectId: n,
@@ -762,7 +764,7 @@ function ho({
762
764
  translate: g,
763
765
  children: d
764
766
  }) {
765
- const [N, y] = ze(Bn, Mn(m)), h = _(m != null), T = fe(
767
+ const [E, b] = qe(Gn, Hn(m)), h = _(m != null), v = fe(
766
768
  () => ({
767
769
  api: t,
768
770
  currentUserId: e,
@@ -771,15 +773,15 @@ function ho({
771
773
  courseId: r,
772
774
  pageLastModifiedAt: s,
773
775
  onAnalyticsEvent: l,
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
+ ...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 }),
778
780
  openTray: () => {
779
- h.current || (h.current = !0, a == null || a()), y({ type: "OPEN_TRAY" });
781
+ h.current || (h.current = !0, a == null || a()), b({ type: "OPEN_TRAY" });
780
782
  },
781
783
  closeTray: () => {
782
- h.current = !1, y({ type: "CLOSE_TRAY" });
784
+ h.current = !1, b({ type: "CLOSE_TRAY" });
783
785
  }
784
786
  }),
785
787
  [
@@ -791,32 +793,32 @@ function ho({
791
793
  s,
792
794
  l,
793
795
  a,
794
- N
796
+ E
795
797
  ]
796
798
  );
797
- return /* @__PURE__ */ i(ot.Provider, { value: T, children: /* @__PURE__ */ i(Fn, { translations: c, translate: g, children: d }) });
799
+ return /* @__PURE__ */ i(rt.Provider, { value: v, children: /* @__PURE__ */ i($n, { translations: c, translate: g, children: d }) });
798
800
  }
799
- function rt() {
800
- const t = We(ot);
801
+ function st() {
802
+ const t = ze(rt);
801
803
  if (!t)
802
804
  throw new Error("useNotebook must be used within a NotebookProvider");
803
805
  return t;
804
806
  }
805
- const st = "notebook-tray-content", po = ({ children: t }) => {
806
- const { isTrayOpen: e, closeTray: n } = rt(), { translations: o } = Y();
807
+ const it = "notebook-tray-content", Eo = ({ children: t }) => {
808
+ const { isTrayOpen: e, closeTray: n } = st(), { translations: o } = Y();
807
809
  return /* @__PURE__ */ i(
808
- mt,
810
+ gt,
809
811
  {
810
812
  label: o.notebook,
811
813
  open: e,
812
814
  onDismiss: n,
813
815
  placement: "end",
814
816
  size: "regular",
815
- children: /* @__PURE__ */ C(x, { direction: "column", height: "100vh", id: st, children: [
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: [
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: [
817
819
  /* @__PURE__ */ i(ye, { level: "h3", children: o.notebook }),
818
820
  /* @__PURE__ */ i(
819
- ft,
821
+ mt,
820
822
  {
821
823
  screenReaderLabel: o.closeNotebookPanel,
822
824
  onClick: n,
@@ -825,16 +827,16 @@ const st = "notebook-tray-content", po = ({ children: t }) => {
825
827
  }
826
828
  )
827
829
  ] }) }) }),
828
- /* @__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 })
829
831
  ] })
830
832
  }
831
833
  );
832
- }, $n = ({ currentType: t, onSelectReaction: e }) => {
834
+ }, Un = ({ currentType: t, onSelectReaction: e }) => {
833
835
  const { translations: n } = Y(), o = _(null), r = _(null);
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();
836
+ return j(() => {
837
+ t === L.CONFUSING && o.current ? o.current.focus() : t === L.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
836
838
  }, [t]), /* @__PURE__ */ i(
837
- q,
839
+ K,
838
840
  {
839
841
  as: "div",
840
842
  background: "primary",
@@ -842,25 +844,25 @@ const st = "notebook-tray-content", po = ({ children: t }) => {
842
844
  borderColor: "secondary",
843
845
  borderRadius: "medium",
844
846
  shadow: "resting",
845
- children: /* @__PURE__ */ C(ae, { children: [
846
- /* @__PURE__ */ C(
847
+ children: /* @__PURE__ */ R(ae, { children: [
848
+ /* @__PURE__ */ R(
847
849
  ae.Item,
848
850
  {
849
851
  ref: o,
850
- onClick: () => e(w.CONFUSING),
852
+ onClick: () => e(L.CONFUSING),
851
853
  children: [
852
854
  /* @__PURE__ */ i(Re, { size: "x-small" }),
853
855
  ` ${n.markUnclear}`
854
856
  ]
855
857
  }
856
858
  ),
857
- /* @__PURE__ */ C(
859
+ /* @__PURE__ */ R(
858
860
  ae.Item,
859
861
  {
860
862
  ref: r,
861
- onClick: () => e(w.IMPORTANT),
863
+ onClick: () => e(L.IMPORTANT),
862
864
  children: [
863
- /* @__PURE__ */ i(Oe, { size: "x-small" }),
865
+ /* @__PURE__ */ i(ke, { size: "x-small" }),
864
866
  ` ${n.markImportant}`
865
867
  ]
866
868
  }
@@ -869,7 +871,7 @@ const st = "notebook-tray-content", po = ({ children: t }) => {
869
871
  }
870
872
  );
871
873
  }, Ee = "notebook-inline-reaction-menu";
872
- function yo({
874
+ function So({
873
875
  containerRef: t,
874
876
  highlightTheme: e,
875
877
  debounceTime: n = 500,
@@ -884,157 +886,157 @@ function yo({
884
886
  courseId: c,
885
887
  pageLastModifiedAt: g,
886
888
  selectedNoteId: d,
887
- isTrayOpen: N,
888
- selectNote: y,
889
+ isTrayOpen: E,
890
+ selectNote: b,
889
891
  openTray: h
890
- } = rt(), { translations: T } = Y(), { data: p } = et({
892
+ } = st(), { translations: v } = Y(), { data: p } = tt({
891
893
  api: l,
892
894
  courseId: c,
893
895
  learningObject: { type: m, id: a }
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(() => {
898
- const S = t.current;
899
- if (!S) return;
900
- const v = S.closest(".user_content") ?? S;
901
- if (v.classList.contains("enhanced")) {
902
- 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);
903
905
  return;
904
906
  }
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
+ 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();
909
911
  return;
910
912
  }
911
913
  });
912
- return D.observe(v, { attributes: !0, attributeFilter: ["class"] }), () => D.disconnect();
914
+ return D.observe(T, { attributes: !0, attributeFilter: ["class"] }), () => D.disconnect();
913
915
  }, [t]);
914
- const G = X(() => {
915
- Q(null), A(null), R("");
916
+ const G = z(() => {
917
+ Q(null), A(null), w("");
916
918
  }, []);
917
- z(() => {
919
+ j(() => {
918
920
  if (!V || !t.current) return;
919
- let v = null;
921
+ let T = null;
920
922
  const D = () => {
921
- v && clearTimeout(v), v = setTimeout(() => {
923
+ T && clearTimeout(T), T = setTimeout(() => {
922
924
  var _e;
923
- const k = window.getSelection(), $ = t.current;
924
- if (!(k != null && k.rangeCount) || !$) return;
925
- const ie = k.toString().trim();
925
+ const I = window.getSelection(), $ = t.current;
926
+ if (!(I != null && I.rangeCount) || !$) return;
927
+ const ie = I.toString().trim();
926
928
  if (ie === "") return;
927
- const le = k.getRangeAt(0);
929
+ const le = I.getRangeAt(0);
928
930
  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)));
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)));
931
933
  }, n);
932
- }, f = (k) => {
933
- if (!(k.target instanceof Node)) return;
934
+ }, P = (I) => {
935
+ if (!(I.target instanceof Node)) return;
934
936
  const $ = document.getElementById(Ee);
935
- $ != null && $.contains(k.target) ? (k.preventDefault(), k.stopImmediatePropagation()) : G();
936
- }, L = () => {
937
+ $ != null && $.contains(I.target) ? (I.preventDefault(), I.stopImmediatePropagation()) : G();
938
+ }, u = () => {
937
939
  G();
938
- }, P = (k) => {
939
- k.key === "Escape" && K.current !== null && (G(), k.stopImmediatePropagation());
940
+ }, N = (I) => {
941
+ I.key === "Escape" && X.current !== null && (G(), I.stopImmediatePropagation());
940
942
  };
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);
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);
943
945
  };
944
946
  }, [V, B, n, t, G]);
945
- const re = X(
946
- (S) => {
947
+ const Z = z(
948
+ (x) => {
947
949
  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,
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,
954
956
  selectedNoteId: d,
955
- type: f[0],
956
- isTrayOpen: N,
957
- labelPrefix: `${T.notebookNote} (${ie})`,
958
- popupId: st,
957
+ type: P[0],
958
+ isTrayOpen: E,
959
+ labelPrefix: `${v.notebookNote} (${ie})`,
960
+ popupId: it,
959
961
  onClick: () => {
960
- y(L), h();
962
+ b(u), h();
961
963
  }
962
964
  };
963
- return zt(k, le, e), D.textPosition;
965
+ return Kt(I, le, e), D.textPosition;
964
966
  }
965
967
  return null;
966
968
  },
967
- [t, d, N, e, T, y, h]
969
+ [t, d, E, e, v, b, h]
968
970
  );
969
- z(() => {
971
+ j(() => {
970
972
  if (!V || !p || !t.current) return;
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([]);
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([]);
977
979
  }
978
980
  return;
979
981
  }
980
- if (g && v[0].highlightData.pageLastModifiedAt !== g) {
981
- const { notesForUpdate: P, noteIdsForDelete: k } = Pt(
982
- S,
983
- v,
982
+ if (g && T[0].highlightData.pageLastModifiedAt !== g) {
983
+ const { notesForUpdate: N, noteIdsForDelete: I } = Ft(
984
+ x,
985
+ T,
984
986
  g
985
987
  );
986
- for (const $ of P)
988
+ for (const $ of N)
987
989
  M({ id: $.id, input: $ }).catch((ie) => r == null ? void 0 : r(ie));
988
- for (const $ of k)
989
- b($, { onError: s });
990
+ for (const $ of I)
991
+ S($, { onError: s });
990
992
  } else {
991
- for (const P of v) {
992
- const k = re(P);
993
- D.add(P.id), k && (f.push(P), L.push(k));
993
+ for (const N of T) {
994
+ const I = Z(N);
995
+ D.add(N.id), I && (P.push(N), u.push(I));
994
996
  }
995
- for (const P of I.current)
996
- D.has(P.id) || Ue(P, S);
997
- F(L), I.current = f, d && _t(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);
998
1000
  }
999
1001
  }, [
1000
1002
  V,
1001
1003
  p,
1002
- re,
1004
+ Z,
1003
1005
  g,
1004
1006
  t,
1005
1007
  M,
1006
- b,
1008
+ S,
1007
1009
  d
1008
1010
  ]);
1009
- const se = (S) => {
1010
- const v = t.current;
1011
- if (!E || !v) return;
1012
- const D = oe.fromRange(v, E), f = te.fromRange(v, E);
1013
- j(
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(
1014
1016
  {
1015
1017
  courseId: c,
1016
1018
  objectId: a,
1017
1019
  objectType: m,
1018
1020
  userText: "",
1019
- reaction: [S],
1021
+ reaction: [x],
1020
1022
  highlightData: {
1021
1023
  selectedText: O,
1022
- textPosition: (f == null ? void 0 : f.toSelector()) ?? null,
1024
+ textPosition: (P == null ? void 0 : P.toSelector()) ?? null,
1023
1025
  range: D.toSelector(),
1024
1026
  pageLastModifiedAt: g ?? ""
1025
1027
  }
1026
1028
  },
1027
1029
  {
1028
- onSuccess: (L) => {
1029
- var k;
1030
- const P = L.id;
1031
- G(), (k = window.getSelection()) == null || k.removeAllRanges(), y(P), h();
1030
+ onSuccess: (u) => {
1031
+ var I;
1032
+ const N = u.id;
1033
+ G(), (I = window.getSelection()) == null || I.removeAllRanges(), b(N), h();
1032
1034
  },
1033
1035
  onError: o
1034
1036
  }
1035
1037
  );
1036
1038
  };
1037
- return !E || !H ? null : ct(
1039
+ return !y || !H ? null : dt(
1038
1040
  /* @__PURE__ */ i(
1039
1041
  "div",
1040
1042
  {
@@ -1047,27 +1049,27 @@ function yo({
1047
1049
  left: H.left,
1048
1050
  whiteSpace: "nowrap"
1049
1051
  },
1050
- onBlur: (S) => {
1051
- const v = document.getElementById(Ee);
1052
- v != null && v.contains(S.relatedTarget) || G();
1052
+ onBlur: (x) => {
1053
+ const T = document.getElementById(Ee);
1054
+ T != null && T.contains(x.relatedTarget) || G();
1053
1055
  },
1054
- children: /* @__PURE__ */ i($n, { onSelectReaction: se })
1056
+ children: /* @__PURE__ */ i(Un, { onSelectReaction: se })
1055
1057
  }
1056
1058
  ),
1057
1059
  document.body
1058
1060
  );
1059
1061
  }
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"
1064
- }), ve = ({
1062
+ const jn = (t, e) => ({
1063
+ backgroundColor: t === L.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
1064
+ underlineColor: t === L.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
1065
+ underlineStyle: t === L.IMPORTANT ? "solid" : "dashed"
1066
+ }), Ce = ({
1065
1067
  children: t,
1066
- type: e = w.IMPORTANT,
1068
+ type: e = L.IMPORTANT,
1067
1069
  isCardActive: n = !0,
1068
1070
  theme: o
1069
1071
  }) => {
1070
- const r = Hn(e, o), l = {
1072
+ const r = jn(e, o), l = {
1071
1073
  position: "relative",
1072
1074
  backgroundColor: n ? r.backgroundColor : Ae(r.backgroundColor, 0.5),
1073
1075
  textDecorationLine: "underline",
@@ -1078,13 +1080,13 @@ const Hn = (t, e) => ({
1078
1080
  lineHeight: "normal"
1079
1081
  };
1080
1082
  return /* @__PURE__ */ i("span", { "data-note-highlight": "true", style: l, children: t });
1081
- }, it = () => {
1083
+ }, lt = () => {
1082
1084
  const { translations: t } = Y();
1083
- return /* @__PURE__ */ C(x, { gap: "xx-small", alignItems: "start", as: "div", children: [
1084
- /* @__PURE__ */ i(x.Item, { as: "div", children: /* @__PURE__ */ i(gt, { color: "error" }) }),
1085
- /* @__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 }) })
1086
1088
  ] });
1087
- }, Un = {
1089
+ }, Wn = {
1088
1090
  filter: null,
1089
1091
  courseFilter: null,
1090
1092
  currentPage: 1,
@@ -1094,7 +1096,7 @@ function he(t, e) {
1094
1096
  const n = typeof e == "number" ? Math.min(e, t) : t;
1095
1097
  return Math.max(1, n);
1096
1098
  }
1097
- function jn(t, e) {
1099
+ function zn(t, e) {
1098
1100
  switch (e.type) {
1099
1101
  case "SET_FILTER":
1100
1102
  return { ...t, filter: e.payload, currentPage: 1 };
@@ -1118,7 +1120,7 @@ function jn(t, e) {
1118
1120
  return t;
1119
1121
  }
1120
1122
  }
1121
- function No({
1123
+ function To({
1122
1124
  api: t,
1123
1125
  courseId: e,
1124
1126
  enableCourseFilter: n = !1,
@@ -1127,96 +1129,96 @@ function No({
1127
1129
  focusNoteId: s
1128
1130
  }) {
1129
1131
  var se;
1130
- const [l, a] = ze(jn, Un), { filter: m, courseFilter: c, currentPage: g, totalPages: d } = l;
1131
- z(() => {
1132
+ const [l, a] = qe(zn, Wn), { filter: m, courseFilter: c, currentPage: g, totalPages: d } = l;
1133
+ j(() => {
1132
1134
  a({ type: "SET_PAGE", payload: 1 });
1133
1135
  }, [r]);
1134
- const N = n ? c : e, y = (g - 1) * r, h = !!o, T = {
1135
- ...N ? { courseId: N } : {},
1136
+ const E = n ? c : e, b = (g - 1) * r, h = !!o, v = {
1137
+ ...E ? { courseId: E } : {},
1136
1138
  ...m ? { reactions: [m] } : {},
1137
1139
  ...o ? { learningObject: o } : {}
1138
1140
  }, {
1139
1141
  data: p,
1140
- isLoading: j,
1142
+ isLoading: W,
1141
1143
  isError: M
1142
- } = Je({
1144
+ } = et({
1143
1145
  api: t,
1144
- filter: T,
1145
- offset: y,
1146
+ filter: v,
1147
+ offset: b,
1146
1148
  pageSize: r,
1147
1149
  enabled: !h
1148
1150
  }), {
1149
- data: b,
1150
- isLoading: I,
1151
+ data: S,
1152
+ isLoading: C,
1151
1153
  isError: B
1152
- } = et({
1154
+ } = tt({
1153
1155
  api: t,
1154
- courseId: N ?? void 0,
1156
+ courseId: E ?? void 0,
1155
1157
  learningObject: o,
1156
1158
  enabled: h
1157
1159
  }), F = fe(() => {
1158
- const S = (b == null ? void 0 : b.notes) ?? [];
1159
- return m ? S.filter((v) => v.reaction.includes(m)) : S;
1160
- }, [b, m]), E = _(null);
1161
- z(() => {
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(() => {
1162
1164
  if (!s) {
1163
- E.current = null;
1165
+ y.current = null;
1164
1166
  return;
1165
1167
  }
1166
- if (E.current === s) return;
1167
- const S = F.findIndex((D) => D.id === s);
1168
- if (S === -1) return;
1169
- E.current = s;
1170
- const v = Math.floor(S / r) + 1;
1171
- v !== g && a({ type: "FOCUS_PAGE", payload: v });
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 });
1172
1174
  }, [s, F, r, g]);
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
+ 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(() => {
1175
1177
  a({ type: "SET_TOTAL_PAGES", payload: H });
1176
1178
  }, [H]);
1177
- const K = X((S) => {
1178
- a({ type: "SET_PAGE", payload: S });
1179
- }, []), V = X(() => {
1179
+ const X = z((x) => {
1180
+ a({ type: "SET_PAGE", payload: x });
1181
+ }, []), V = z(() => {
1180
1182
  a({
1181
1183
  type: "INCREMENT_PAGE"
1182
1184
  /* IncrementPage */
1183
1185
  });
1184
- }, []), ne = X(() => {
1186
+ }, []), oe = z(() => {
1185
1187
  a({
1186
1188
  type: "DECREMENT_PAGE"
1187
1189
  /* DecrementPage */
1188
1190
  });
1189
- }, []), G = X((S) => {
1190
- a({ type: "SET_FILTER", payload: S });
1191
- }, []), re = X((S) => {
1192
- 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 });
1193
1195
  }, []);
1194
1196
  return {
1195
1197
  notes: A,
1196
1198
  pageInfo: Q,
1197
1199
  isLoading: O,
1198
- isError: R,
1200
+ isError: w,
1199
1201
  filter: m,
1200
1202
  courseFilter: c,
1201
1203
  currentPage: g,
1202
1204
  totalPages: d,
1203
1205
  setFilter: G,
1204
- setCourseFilter: re,
1205
- setPage: K,
1206
+ setCourseFilter: Z,
1207
+ setPage: X,
1206
1208
  fetchNextPage: V,
1207
- fetchPreviousPage: ne
1209
+ fetchPreviousPage: oe
1208
1210
  };
1209
1211
  }
1210
1212
  const Se = "all";
1211
- function bo({ filter: t, setFilter: e }) {
1213
+ function vo({ filter: t, setFilter: e }) {
1212
1214
  const { translations: n } = Y(), o = fe(
1213
1215
  () => [
1214
1216
  { label: n.allNotes, value: Se },
1215
- { label: n.important, value: w.IMPORTANT },
1216
- { label: n.unclear, value: w.CONFUSING }
1217
+ { label: n.important, value: L.IMPORTANT },
1218
+ { label: n.unclear, value: L.CONFUSING }
1217
1219
  ],
1218
1220
  [n]
1219
- ), r = X(
1221
+ ), r = z(
1220
1222
  (l, { value: a }) => {
1221
1223
  e(!a || a === Se ? null : a);
1222
1224
  },
@@ -1239,48 +1241,48 @@ function bo({ filter: t, setFilter: e }) {
1239
1241
  handleReactionFilterChange: r
1240
1242
  };
1241
1243
  }
1242
- const Gn = ({ hasActiveFilter: t = !1 }) => {
1244
+ const qn = ({ hasActiveFilter: t = !1 }) => {
1243
1245
  const { translations: e } = Y(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
1244
- return /* @__PURE__ */ i(q, { as: "div", textAlign: "center", children: /* @__PURE__ */ C(x, { direction: "column", alignItems: "center", gap: "small", children: [
1245
- !t && /* @__PURE__ */ i(ht, { size: "medium" }),
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" }),
1246
1248
  /* @__PURE__ */ i(ye, { level: "h3", children: n }),
1247
- /* @__PURE__ */ i(Z, { color: "secondary", children: o })
1249
+ /* @__PURE__ */ i(J, { color: "secondary", children: o })
1248
1250
  ] }) });
1249
- }, Wn = {
1250
- [w.IMPORTANT]: {
1251
+ }, Kn = {
1252
+ [L.IMPORTANT]: {
1251
1253
  color: "success",
1252
1254
  translationKey: "important",
1253
- icon: /* @__PURE__ */ i(Oe, { size: "x-small" })
1255
+ icon: /* @__PURE__ */ i(ke, { size: "x-small" })
1254
1256
  },
1255
- [w.CONFUSING]: {
1257
+ [L.CONFUSING]: {
1256
1258
  color: "danger",
1257
1259
  translationKey: "unclear",
1258
1260
  icon: /* @__PURE__ */ i(Re, { size: "x-small" })
1259
1261
  }
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
+ }, 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);
1264
1266
  },
1265
1267
  [e]
1266
1268
  );
1267
- return z(() => {
1269
+ return j(() => {
1268
1270
  if (!l) return;
1269
- const N = (h) => {
1271
+ const E = (h) => {
1270
1272
  h.key === "Escape" && h.stopPropagation();
1271
- }, y = (h) => {
1272
- var T;
1273
- 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());
1274
1276
  };
1275
- return document.addEventListener("keydown", N, !0), document.addEventListener("keyup", y, !0), () => {
1276
- document.removeEventListener("keydown", N, !0), document.removeEventListener("keyup", y, !0);
1277
+ return document.addEventListener("keydown", E, !0), document.addEventListener("keyup", b, !0), () => {
1278
+ document.removeEventListener("keydown", E, !0), document.removeEventListener("keyup", b, !0);
1277
1279
  };
1278
- }, [l]), n && e ? /* @__PURE__ */ C(
1280
+ }, [l]), n && e ? /* @__PURE__ */ R(
1279
1281
  ae,
1280
1282
  {
1281
1283
  placement: "bottom start",
1282
1284
  show: l,
1283
- onToggle: (N) => a(N),
1285
+ onToggle: (E) => a(E),
1284
1286
  shouldHideOnSelect: !0,
1285
1287
  shouldFocusTriggerOnClose: !0,
1286
1288
  trigger: /* @__PURE__ */ i(
@@ -1288,25 +1290,25 @@ const Gn = ({ hasActiveFilter: t = !1 }) => {
1288
1290
  {
1289
1291
  color: r.color,
1290
1292
  renderIcon: r.icon,
1291
- elementRef: (N) => {
1292
- g.current = N;
1293
+ elementRef: (E) => {
1294
+ g.current = E;
1293
1295
  },
1294
1296
  children: s
1295
1297
  }
1296
1298
  ),
1297
1299
  children: [
1298
- /* @__PURE__ */ C(ae.Item, { ref: m, onClick: () => d(w.CONFUSING), children: [
1300
+ /* @__PURE__ */ R(ae.Item, { ref: m, onClick: () => d(L.CONFUSING), children: [
1299
1301
  /* @__PURE__ */ i(Re, { size: "x-small" }),
1300
1302
  ` ${o.markUnclear}`
1301
1303
  ] }),
1302
- /* @__PURE__ */ C(ae.Item, { ref: c, onClick: () => d(w.IMPORTANT), children: [
1303
- /* @__PURE__ */ i(Oe, { size: "x-small" }),
1304
+ /* @__PURE__ */ R(ae.Item, { ref: c, onClick: () => d(L.IMPORTANT), children: [
1305
+ /* @__PURE__ */ i(ke, { size: "x-small" }),
1304
1306
  ` ${o.markImportant}`
1305
1307
  ] })
1306
1308
  ]
1307
1309
  }
1308
- ) : /* @__PURE__ */ i(q, { display: "inline-flex", children: /* @__PURE__ */ i(Me, { color: r.color, renderIcon: r.icon, children: s }) });
1309
- };
1310
+ ) : /* @__PURE__ */ i(K, { display: "inline-flex", children: /* @__PURE__ */ i(Me, { color: r.color, renderIcon: r.icon, children: s }) });
1311
+ }, Ue = "0.75rem";
1310
1312
  function je(t, e) {
1311
1313
  return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
1312
1314
  year: "numeric",
@@ -1314,7 +1316,7 @@ function je(t, e) {
1314
1316
  day: "numeric"
1315
1317
  });
1316
1318
  }
1317
- const zn = ({
1319
+ const Xn = ({
1318
1320
  noteId: t,
1319
1321
  date: e,
1320
1322
  highlight: n,
@@ -1327,30 +1329,47 @@ const zn = ({
1327
1329
  isActive: c,
1328
1330
  isPanelView: g = !1,
1329
1331
  courseName: d,
1330
- locale: N,
1331
- highlightTheme: y,
1332
+ locale: E,
1333
+ highlightTheme: b,
1332
1334
  renderLink: h,
1333
- href: T
1335
+ href: v
1334
1336
  }) => {
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());
1347
- }, [E]);
1348
- const re = r === w.IMPORTANT ? p.important : p.unclear, se = (f) => {
1349
- f.key === "Enter" && (f.preventDefault(), s == null || s());
1350
- }, S = [re, p.note];
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(
1353
- 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,
1354
1373
  {
1355
1374
  as: "div",
1356
1375
  height: "100%",
@@ -1358,205 +1377,243 @@ const zn = ({
1358
1377
  borderRadius: "medium",
1359
1378
  padding: "small",
1360
1379
  position: "relative",
1361
- role: T ? void 0 : c || b ? "group" : "button",
1362
- "aria-label": T ? void 0 : v,
1363
- "aria-pressed": T || c || b ? void 0 : c,
1364
- 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,
1365
1384
  "data-testid": `note-card-${t}`,
1366
- elementRef: R,
1385
+ elementRef: w,
1367
1386
  onClick: c ? void 0 : s,
1368
1387
  onMouseEnter: () => M(!0),
1369
1388
  onMouseLeave: () => M(!1),
1370
- onKeyDown: c ? void 0 : se,
1371
- cursor: b ? "default" : "pointer",
1389
+ onKeyDown: c ? void 0 : x,
1390
+ cursor: S ? "default" : "pointer",
1372
1391
  children: [
1373
- /* @__PURE__ */ C(x, { direction: "column", gap: "small", height: "100%", children: [
1374
- /* @__PURE__ */ i(
1375
- lt,
1376
- {
1377
- type: r,
1378
- onTypeChange: g && m ? (f) => m(t, f) : void 0,
1379
- renderAsMenuTrigger: g && !!m && !!c
1380
- }
1381
- ),
1382
- n ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ i(Z, { children: c && g ? /* @__PURE__ */ i(
1383
- ve,
1384
- {
1385
- type: r,
1386
- isCardActive: !!c || j,
1387
- theme: y,
1388
- children: n
1389
- }
1390
- ) : /* @__PURE__ */ i(Ie, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ i(
1391
- ve,
1392
- {
1393
- type: r,
1394
- isCardActive: !!c || j,
1395
- theme: y,
1396
- children: n
1397
- }
1398
- ) }) }) }) : /* @__PURE__ */ i(it, {}),
1399
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ C(x, { direction: "column", gap: "small", height: "100%", children: [
1400
- 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: [
1401
1401
  /* @__PURE__ */ i(
1402
- qe,
1402
+ at,
1403
1403
  {
1404
- label: /* @__PURE__ */ i(yt, { children: p.editNote }),
1405
- value: B,
1406
- onChange: (f) => F(f.target.value),
1407
- placeholder: p.addNoteOptional,
1408
- textareaRef: (f) => {
1409
- H.current = f;
1410
- }
1404
+ type: r,
1405
+ onTypeChange: g && m ? (u) => m(t, u) : void 0,
1406
+ renderAsMenuTrigger: g && !!m && !!c
1411
1407
  }
1412
1408
  ),
1413
- /* @__PURE__ */ C(x, { gap: "xx-small", children: [
1414
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1415
- J,
1416
- {
1417
- display: "block",
1418
- size: "small",
1419
- "data-testid": `note-card-${t}-cancel`,
1420
- onClick: () => {
1421
- F(o || ""), I(!1);
1422
- },
1423
- children: p.cancel
1424
- }
1425
- ) }),
1426
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1427
- J,
1428
- {
1429
- display: "block",
1430
- color: "primary",
1431
- size: "small",
1432
- "data-testid": `note-card-${t}-save`,
1433
- onClick: () => {
1434
- a == null || a(t, B.trim()), I(!1);
1435
- },
1436
- children: p.save
1437
- }
1438
- ) })
1439
- ] })
1440
- ] }) : o ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && g ? /* @__PURE__ */ C(Z, { children: [
1441
- o,
1442
- " ",
1443
- /* @__PURE__ */ i(
1444
- de,
1445
- {
1446
- size: "small",
1447
- withBackground: !1,
1448
- withBorder: !1,
1449
- margin: "xx-small 0 0 xxx-small",
1450
- screenReaderLabel: p.editNote,
1451
- "data-testid": `note-card-${t}-edit`,
1452
- elementRef: (f) => {
1453
- Q.current = f;
1454
- },
1455
- onClick: (f) => {
1456
- f.stopPropagation(), I(!0);
1457
- },
1458
- children: /* @__PURE__ */ i(Te, {})
1459
- }
1460
- )
1461
- ] }) : /* @__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: [
1462
- p.addNotePrompt,
1463
- " ",
1464
- /* @__PURE__ */ i(
1465
- de,
1409
+ n ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ i(J, { children: c && g ? /* @__PURE__ */ i(
1410
+ Ce,
1466
1411
  {
1467
- size: "small",
1468
- withBackground: !1,
1469
- withBorder: !1,
1470
- margin: "xx-small 0 0 xxx-small",
1471
- screenReaderLabel: p.editNote,
1472
- "data-testid": `note-card-${t}-edit`,
1473
- elementRef: (f) => {
1474
- Q.current = f;
1475
- },
1476
- onClick: (f) => {
1477
- f.stopPropagation(), I(!0);
1478
- },
1479
- children: /* @__PURE__ */ i(Te, {})
1412
+ type: r,
1413
+ isCardActive: !!c || W,
1414
+ theme: b,
1415
+ children: n
1480
1416
  }
1481
- )
1482
- ] }) }) : null,
1483
- /* @__PURE__ */ C(x, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
1484
- /* @__PURE__ */ i(Z, { size: "small", color: "secondary", children: je(e, N) }),
1485
- c && l && /* @__PURE__ */ i(
1486
- de,
1417
+ ) : /* @__PURE__ */ i(ve, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ i(
1418
+ Ce,
1487
1419
  {
1488
- size: "small",
1489
- withBackground: !1,
1490
- withBorder: !1,
1491
- color: "danger",
1492
- margin: "xx-small",
1493
- screenReaderLabel: p.deleteNote,
1494
- "data-testid": `note-card-${t}-delete`,
1495
- elementRef: (f) => {
1496
- V.current = f;
1497
- },
1498
- onClick: (f) => {
1499
- f.stopPropagation(), A(!0);
1500
- },
1501
- children: /* @__PURE__ */ i(pe, {})
1420
+ type: r,
1421
+ isCardActive: !!c || W,
1422
+ theme: b,
1423
+ children: n
1502
1424
  }
1503
- )
1504
- ] }),
1505
- d && /* @__PURE__ */ i(Z, { size: "small", color: "secondary", children: d })
1506
- ] }) })
1507
- ] }),
1508
- E && l && /* @__PURE__ */ i(
1509
- q,
1510
- {
1511
- as: "div",
1512
- background: "primary",
1513
- padding: "medium",
1514
- borderRadius: "large",
1515
- position: "absolute",
1516
- insetBlockStart: "0",
1517
- insetBlockEnd: "0",
1518
- insetInlineStart: "0",
1519
- insetInlineEnd: "0",
1520
- stacking: "above",
1521
- children: /* @__PURE__ */ C(
1522
- x,
1523
- {
1524
- direction: "column",
1525
- justifyItems: "center",
1526
- alignItems: "center",
1527
- gap: "x-small",
1528
- height: "100%",
1529
- 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: [
1530
1428
  /* @__PURE__ */ i(
1531
- 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,
1532
1472
  {
1533
- display: "block",
1534
- color: "danger",
1535
1473
  size: "small",
1536
- renderIcon: /* @__PURE__ */ i(pe, {}),
1537
- "data-testid": `note-card-${t}-confirm-delete`,
1538
- elementRef: (f) => {
1539
- 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;
1540
1481
  },
1541
- onClick: (f) => {
1542
- f.stopPropagation(), l(t), A(!1);
1482
+ onClick: (u) => {
1483
+ u.stopPropagation(), C(!0);
1543
1484
  },
1544
- children: p.deleteNote
1485
+ children: /* @__PURE__ */ i(Te, {})
1545
1486
  }
1546
- ),
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
+ " ",
1547
1491
  /* @__PURE__ */ i(
1548
- J,
1492
+ de,
1549
1493
  {
1550
- display: "block",
1551
1494
  size: "small",
1552
- "data-testid": `note-card-${t}-cancel-delete`,
1553
- onClick: (f) => {
1554
- f.stopPropagation(), G.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;
1502
+ },
1503
+ onClick: (u) => {
1504
+ u.stopPropagation(), C(!0);
1555
1505
  },
1556
- children: p.cancel
1506
+ children: /* @__PURE__ */ i(Te, {})
1557
1507
  }
1558
1508
  )
1559
- ]
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
+ )
1560
1617
  }
1561
1618
  )
1562
1619
  }
@@ -1564,8 +1621,8 @@ const zn = ({
1564
1621
  ]
1565
1622
  }
1566
1623
  );
1567
- return T && h ? h({ href: T, children: D, ariaLabel: v }) : D;
1568
- }, qn = {
1624
+ return v && h ? h({ href: v, children: P, ariaLabel: D }) : P;
1625
+ }, Qn = {
1569
1626
  display: "grid",
1570
1627
  gap: "1rem",
1571
1628
  boxSizing: "border-box",
@@ -1573,7 +1630,7 @@ const zn = ({
1573
1630
  margin: 0,
1574
1631
  padding: 0,
1575
1632
  listStyle: "none"
1576
- }, Eo = ({
1633
+ }, Co = ({
1577
1634
  notes: t,
1578
1635
  isLoading: e,
1579
1636
  isError: n,
@@ -1586,75 +1643,75 @@ const zn = ({
1586
1643
  onNoteTypeChange: c,
1587
1644
  onNotesEmptied: g,
1588
1645
  selectedNoteId: d,
1589
- hasActiveFilter: N = !1,
1590
- columnCount: y = 1,
1646
+ hasActiveFilter: E = !1,
1647
+ columnCount: b = 1,
1591
1648
  highlightTheme: h,
1592
- locale: T,
1649
+ locale: v,
1593
1650
  renderNoteLink: p,
1594
- noteHref: j
1651
+ noteHref: W
1595
1652
  }) => {
1596
- const { translations: M } = Y(), b = _(null), I = _(null), B = X(
1597
- (E) => {
1598
- const A = t.findIndex((R) => R.id === E);
1653
+ const { translations: M } = Y(), S = _(null), C = _(null), B = z(
1654
+ (y) => {
1655
+ const A = t.findIndex((w) => w.id === y);
1599
1656
  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);
1657
+ t.length > 1 && (O = A > 0 ? t[A - 1].id : t[1].id), C.current = { targetId: O }, a == null || a(y);
1601
1658
  },
1602
1659
  [t, a]
1603
1660
  );
1604
- if (z(() => {
1661
+ if (j(() => {
1605
1662
  var A;
1606
- const E = I.current;
1607
- if (E)
1608
- if (I.current = null, E.targetId === null)
1663
+ const y = C.current;
1664
+ if (y)
1665
+ if (C.current = null, y.targetId === null)
1609
1666
  g == null || g();
1610
1667
  else {
1611
- const O = (A = b.current) == null ? void 0 : A.querySelector(
1612
- `[data-testid="note-card-${E.targetId}"]`
1668
+ const O = (A = S.current) == null ? void 0 : A.querySelector(
1669
+ `[data-testid="note-card-${y.targetId}"]`
1613
1670
  );
1614
1671
  O == null || O.focus();
1615
1672
  }
1616
1673
  }, [t, g]), e)
1617
- return /* @__PURE__ */ i(q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ i(bt, { 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 }) });
1618
1675
  if (n)
1619
- return /* @__PURE__ */ i(q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(ye, { 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 }) });
1620
1677
  if (t.length === 0)
1621
- return /* @__PURE__ */ i(q, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(Gn, { hasActiveFilter: N }) });
1678
+ return /* @__PURE__ */ i(K, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(qn, { hasActiveFilter: E }) });
1622
1679
  const F = typeof o == "number" && typeof r == "number" && r > 1 && s !== void 0;
1623
- return /* @__PURE__ */ C(at, { children: [
1680
+ return /* @__PURE__ */ R(ct, { children: [
1624
1681
  /* @__PURE__ */ i(
1625
1682
  "ul",
1626
1683
  {
1627
- ref: b,
1628
- style: { ...qn, gridTemplateColumns: `repeat(${y}, minmax(0, 1fr))` },
1684
+ ref: S,
1685
+ style: { ...Qn, gridTemplateColumns: `repeat(${b}, minmax(0, 1fr))` },
1629
1686
  role: "list",
1630
1687
  "data-testid": "notes-grid",
1631
- children: t.map((E) => {
1688
+ children: t.map((y) => {
1632
1689
  var A;
1633
1690
  return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
1634
- zn,
1691
+ Xn,
1635
1692
  {
1636
- noteId: E.id,
1637
- date: E.createdAt,
1638
- type: E.reaction[0] ?? w.IMPORTANT,
1639
- highlight: (A = E.highlightData) == null ? void 0 : A.selectedText,
1640
- note: E.userText,
1641
- 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,
1642
1699
  isPanelView: !!d,
1643
- onClick: l ? () => l(E.id) : void 0,
1700
+ onClick: l ? () => l(y.id) : void 0,
1644
1701
  onDelete: a ? B : void 0,
1645
- onSaveNote: m ? (O, R) => m(O, R) : void 0,
1646
- onTypeChange: c ? (O, R) => c(O, R) : void 0,
1702
+ onSaveNote: m ? (O, w) => m(O, w) : void 0,
1703
+ onTypeChange: c ? (O, w) => c(O, w) : void 0,
1647
1704
  highlightTheme: h,
1648
- locale: T,
1705
+ locale: v,
1649
1706
  renderLink: p,
1650
- href: j ? j(E.id, E) : void 0
1707
+ href: W ? W(y.id, y) : void 0
1651
1708
  }
1652
- ) }, E.id);
1709
+ ) }, y.id);
1653
1710
  })
1654
1711
  }
1655
1712
  ),
1656
- F && /* @__PURE__ */ i(x, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ i(x.Item, { children: /* @__PURE__ */ i(
1657
- Nt,
1713
+ F && /* @__PURE__ */ i(k, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ i(k.Item, { children: /* @__PURE__ */ i(
1714
+ Et,
1658
1715
  {
1659
1716
  as: "nav",
1660
1717
  variant: "input",
@@ -1666,7 +1723,7 @@ const zn = ({
1666
1723
  }
1667
1724
  ) }) })
1668
1725
  ] });
1669
- }, So = ({
1726
+ }, Io = ({
1670
1727
  noteText: t,
1671
1728
  reaction: e,
1672
1729
  highlightText: n,
@@ -1677,64 +1734,64 @@ const zn = ({
1677
1734
  onBack: a,
1678
1735
  editing: m = !1
1679
1736
  }) => {
1680
- const { translations: c } = Y(), [g, d] = U(m), [N, y] = U(t || ""), [h, T] = U(!1);
1681
- return /* @__PURE__ */ C(x, { direction: "column", gap: "small", "data-testid": "single-note", children: [
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 }),
1684
- 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: [
1685
1742
  /* @__PURE__ */ i(
1686
- qe,
1743
+ Ke,
1687
1744
  {
1688
1745
  label: c.addNoteOptional,
1689
- value: N,
1690
- onChange: (p) => y(p.target.value),
1746
+ value: E,
1747
+ onChange: (p) => b(p.target.value),
1691
1748
  resize: "vertical"
1692
1749
  }
1693
1750
  ),
1694
- /* @__PURE__ */ C(x, { gap: "xx-small", children: [
1695
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1696
- J,
1751
+ /* @__PURE__ */ R(k, { gap: "xx-small", children: [
1752
+ /* @__PURE__ */ i(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1753
+ ee,
1697
1754
  {
1698
1755
  display: "block",
1699
1756
  size: "small",
1700
1757
  "data-testid": "single-note-cancel",
1701
1758
  onClick: () => {
1702
- y(t || ""), d(!1);
1759
+ b(t || ""), d(!1);
1703
1760
  },
1704
1761
  children: c.cancel
1705
1762
  }
1706
1763
  ) }),
1707
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1708
- J,
1764
+ /* @__PURE__ */ i(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1765
+ ee,
1709
1766
  {
1710
1767
  display: "block",
1711
1768
  color: "primary",
1712
1769
  size: "small",
1713
1770
  "data-testid": "single-note-save",
1714
1771
  onClick: () => {
1715
- r(N), d(!1);
1772
+ r(E), d(!1);
1716
1773
  },
1717
1774
  children: c.save
1718
1775
  }
1719
1776
  ) })
1720
1777
  ] })
1721
- ] }) : /* @__PURE__ */ C(x, { direction: "column", gap: "small", children: [
1722
- t && /* @__PURE__ */ C(q, { as: "div", children: [
1778
+ ] }) : /* @__PURE__ */ R(k, { direction: "column", gap: "small", children: [
1779
+ t && /* @__PURE__ */ R(K, { as: "div", children: [
1723
1780
  /* @__PURE__ */ i(ye, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
1724
- /* @__PURE__ */ i(Z, { children: t })
1781
+ /* @__PURE__ */ i(J, { children: t })
1725
1782
  ] }),
1726
- /* @__PURE__ */ C(x, { justifyItems: "space-between", children: [
1783
+ /* @__PURE__ */ R(k, { justifyItems: "space-between", children: [
1727
1784
  /* @__PURE__ */ i(
1728
- J,
1785
+ ee,
1729
1786
  {
1730
1787
  size: "small",
1731
- renderIcon: /* @__PURE__ */ i(pt, {}),
1788
+ renderIcon: /* @__PURE__ */ i(yt, {}),
1732
1789
  "data-testid": "single-note-back",
1733
1790
  onClick: () => a == null ? void 0 : a(),
1734
1791
  children: c.back
1735
1792
  }
1736
1793
  ),
1737
- /* @__PURE__ */ C(x, { gap: "xx-small", children: [
1794
+ /* @__PURE__ */ R(k, { gap: "xx-small", children: [
1738
1795
  s && /* @__PURE__ */ i(
1739
1796
  de,
1740
1797
  {
@@ -1744,7 +1801,7 @@ const zn = ({
1744
1801
  color: "danger",
1745
1802
  screenReaderLabel: c.deleteNote,
1746
1803
  "data-testid": "single-note-delete",
1747
- onClick: () => T(!0),
1804
+ onClick: () => v(!0),
1748
1805
  children: /* @__PURE__ */ i(pe, {})
1749
1806
  }
1750
1807
  ),
@@ -1762,9 +1819,9 @@ const zn = ({
1762
1819
  )
1763
1820
  ] })
1764
1821
  ] }),
1765
- 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: [
1766
1823
  /* @__PURE__ */ i(
1767
- J,
1824
+ ee,
1768
1825
  {
1769
1826
  display: "block",
1770
1827
  color: "danger",
@@ -1772,18 +1829,18 @@ const zn = ({
1772
1829
  renderIcon: /* @__PURE__ */ i(pe, {}),
1773
1830
  "data-testid": "single-note-confirm-delete",
1774
1831
  onClick: () => {
1775
- s(), T(!1);
1832
+ s(), v(!1);
1776
1833
  },
1777
1834
  children: c.deleteNote
1778
1835
  }
1779
1836
  ),
1780
1837
  /* @__PURE__ */ i(
1781
- J,
1838
+ ee,
1782
1839
  {
1783
1840
  display: "block",
1784
1841
  size: "small",
1785
1842
  "data-testid": "single-note-cancel-delete",
1786
- onClick: () => T(!1),
1843
+ onClick: () => v(!1),
1787
1844
  children: c.cancel
1788
1845
  }
1789
1846
  )
@@ -1792,26 +1849,26 @@ const zn = ({
1792
1849
  ] });
1793
1850
  };
1794
1851
  export {
1795
- yo as ContentWithNoteWrapper,
1796
- ve as Highlight,
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,
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,
1863
+ L as REACTION_TYPE,
1864
+ Io as SingleNote,
1808
1865
  Ae as createTransparentColor,
1809
- Xt as useCreateNote,
1810
- Qt as useDeleteNote,
1811
- Je as useGetNotes,
1812
- rt as useNotebook,
1866
+ Yt as useCreateNote,
1867
+ Vt as useDeleteNote,
1868
+ et as useGetNotes,
1869
+ st as useNotebook,
1813
1870
  Y as useNotebookTranslations,
1814
- No as useNotesData,
1815
- bo as useReactionFilter,
1816
- Vt as useUpdateNote
1871
+ To as useNotesData,
1872
+ vo as useReactionFilter,
1873
+ Jt as useUpdateNote
1817
1874
  };