@instructure/platform-notebook 0.4.2 → 0.5.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,48 +1,49 @@
1
- import { jsx as i, jsxs as b, Fragment as Xe } from "react/jsx-runtime";
2
- import { createContext as Ae, useMemo as ge, useContext as Le, useReducer as Pe, useRef as oe, useEffect as Z, useState as H, useCallback as J } from "react";
3
- import { createPortal as Qe } from "react-dom";
1
+ import { jsx as i, jsxs as b, Fragment as Ve } from "react/jsx-runtime";
2
+ import { createContext as Pe, useMemo as oe, useContext as _e, useReducer as Fe, useRef as re, useEffect as J, useState as H, useCallback as K } from "react";
3
+ import { createPortal as Ze } from "react-dom";
4
4
  import { z as a } from "zod";
5
- import Ye from "diff-match-patch";
6
- import { useQueryClient as he, useMutation as pe, useQuery as Ve } from "@tanstack/react-query";
7
- import { IconQuestionLine as Ne, IconPinLine as ye, IconWarningLine as Ze, IconArrowOpenDownLine as Je, IconEditLine as ue, IconTrashLine as ie, IconArrowOpenStartLine as et, IconArrowOpenEndLine as tt, IconArrowStartLine as nt } from "@instructure/ui-icons";
5
+ import Je from "diff-match-patch";
6
+ import { useQueryClient as pe, useMutation as Ne, useQuery as et } from "@tanstack/react-query";
7
+ import { IconQuestionLine as ye, IconPinLine as be, IconWarningLine as tt, IconArrowOpenDownLine as nt, IconEditLine as me, IconTrashLine as le, IconArrowOpenStartLine as ot, IconArrowOpenEndLine as rt, IconArrowStartLine as st } from "@instructure/ui-icons";
8
8
  import { Menu as ee } from "@instructure/ui-menu";
9
- import { Flex as I } from "@instructure/ui-flex";
10
- import { TruncateText as fe } from "@instructure/ui-truncate-text";
11
- import { CloseButton as ot, Button as U, IconButton as G } from "@instructure/ui-buttons";
12
- import { Heading as le } from "@instructure/ui-heading";
13
- import { Tray as rt } from "@instructure/ui-tray";
14
- import { View as K } from "@instructure/ui-view";
15
- import { ScreenReaderContent as st } from "@instructure/ui-a11y-content";
9
+ import { Flex as v } from "@instructure/ui-flex";
10
+ import { TruncateText as he } from "@instructure/ui-truncate-text";
11
+ import { ScreenReaderContent as Me } from "@instructure/ui-a11y-content";
12
+ import { SimpleSelect as we } from "@instructure/ui-simple-select";
13
+ import { CloseButton as it, Button as U, IconButton as X } from "@instructure/ui-buttons";
14
+ import { Heading as ae } from "@instructure/ui-heading";
15
+ import { Tray as lt } from "@instructure/ui-tray";
16
+ import { View as Q } from "@instructure/ui-view";
16
17
  import { Text as z } from "@instructure/ui-text";
17
- import { TextArea as _e } from "@instructure/ui-text-area";
18
- import { Pill as xe } from "@instructure/ui-pill";
19
- import { Spinner as it } from "@instructure/ui-spinner";
20
- const lt = a.object({
18
+ import { TextArea as He } from "@instructure/ui-text-area";
19
+ import { Pill as Oe } from "@instructure/ui-pill";
20
+ import { Spinner as at } from "@instructure/ui-spinner";
21
+ const ct = a.object({
21
22
  startContainer: a.string(),
22
23
  endContainer: a.string(),
23
24
  startOffset: a.number(),
24
25
  endOffset: a.number()
25
- }), at = a.object({
26
+ }), dt = a.object({
26
27
  start: a.number(),
27
28
  end: a.number()
28
- }), be = a.object({
29
+ }), Ee = a.object({
29
30
  selectedText: a.string(),
30
31
  hasNoHighlightAnymore: a.boolean().optional(),
31
- textPosition: at.nullable(),
32
- range: lt.nullable(),
32
+ textPosition: dt.nullable(),
33
+ range: ct.nullable(),
33
34
  pageLastModifiedAt: a.string()
34
35
  });
35
36
  var A = /* @__PURE__ */ ((n) => (n.IMPORTANT = "Important", n.CONFUSING = "Confusing", n))(A || {});
36
- const Ee = a.enum([
37
+ const Se = a.enum([
37
38
  "Important",
38
39
  "Confusing"
39
40
  /* CONFUSING */
40
- ]), Fe = a.object({
41
+ ]), Be = a.object({
41
42
  startCursor: a.string().nullish(),
42
43
  endCursor: a.string().nullish(),
43
44
  hasNextPage: a.boolean().nullish(),
44
45
  hasPreviousPage: a.boolean().nullish()
45
- }), ae = a.object({
46
+ }), ce = a.object({
46
47
  id: a.string(),
47
48
  rootAccountUuid: a.string(),
48
49
  userId: a.string(),
@@ -50,33 +51,33 @@ const Ee = a.enum([
50
51
  objectId: a.string(),
51
52
  objectType: a.string(),
52
53
  userText: a.string().optional(),
53
- reaction: a.array(Ee),
54
- highlightData: be,
54
+ reaction: a.array(Se),
55
+ highlightData: Ee,
55
56
  createdAt: a.string(),
56
57
  updatedAt: a.string()
57
- }), ct = a.object({
58
+ }), ut = a.object({
58
59
  cursor: a.string(),
59
- node: ae
60
+ node: ce
60
61
  });
61
62
  a.object({
62
63
  notes: a.object({
63
- edges: a.array(ct),
64
- nodes: a.array(ae),
65
- pageInfo: Fe
64
+ edges: a.array(ut),
65
+ nodes: a.array(ce),
66
+ pageInfo: Be
66
67
  })
67
68
  });
68
- const dt = a.object({
69
+ const ft = a.object({
69
70
  type: a.string(),
70
71
  id: a.string()
71
- }), ut = a.object({
72
+ }), mt = a.object({
72
73
  courseId: a.string().optional(),
73
- learningObject: dt.optional(),
74
+ learningObject: ft.optional(),
74
75
  reactions: a.array(a.string()).optional()
75
76
  }).optional();
76
77
  a.object({
77
78
  courseId: a.string().optional(),
78
- filter: ut,
79
- pageParams: Fe.optional(),
79
+ filter: mt,
80
+ pageParams: Be.optional(),
80
81
  direction: a.enum(["next", "prev"]).optional(),
81
82
  pageSize: a.number().optional()
82
83
  });
@@ -85,32 +86,32 @@ a.object({
85
86
  objectId: a.string(),
86
87
  objectType: a.string(),
87
88
  userText: a.string().optional(),
88
- reaction: a.array(Ee),
89
- highlightData: be
89
+ reaction: a.array(Se),
90
+ highlightData: Ee
90
91
  });
91
92
  a.object({
92
- createNote: ae
93
+ createNote: ce
93
94
  });
94
95
  a.object({
95
96
  id: a.string(),
96
97
  userText: a.string().optional(),
97
- reaction: a.array(Ee),
98
- highlightData: be
98
+ reaction: a.array(Se),
99
+ highlightData: Ee
99
100
  });
100
101
  a.object({
101
- updateNote: ae
102
+ updateNote: ce
102
103
  });
103
104
  a.object({
104
105
  deleteNote: a.string()
105
106
  });
106
- var Me = /* @__PURE__ */ ((n) => (n[n.FORWARDS = 1] = "FORWARDS", n[n.BACKWARDS = 2] = "BACKWARDS", n))(Me || {});
107
+ var We = /* @__PURE__ */ ((n) => (n[n.FORWARDS = 1] = "FORWARDS", n[n.BACKWARDS = 2] = "BACKWARDS", n))(We || {});
107
108
  class $ {
108
109
  constructor(e, t) {
109
110
  this.start = e, this.end = t;
110
111
  }
111
112
  toRange() {
112
113
  let e, t;
113
- if (this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] = Be(this.start.element, this.start.offset, this.end.offset) : (e = this.start.resolve({
114
+ if (this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] = ze(this.start.element, this.start.offset, this.end.offset) : (e = this.start.resolve({
114
115
  direction: 1
115
116
  /* FORWARDS */
116
117
  }), t = this.end.resolve({
@@ -138,12 +139,12 @@ class B {
138
139
  }
139
140
  resolve(e = {}) {
140
141
  try {
141
- return Be(this.element, this.offset)[0];
142
+ return ze(this.element, this.offset)[0];
142
143
  } catch (t) {
143
144
  if (this.offset === 0 && e.direction !== void 0) {
144
145
  const o = document.createTreeWalker(this.element.getRootNode(), NodeFilter.SHOW_TEXT);
145
146
  o.currentNode = this.element;
146
- const r = e.direction === Me.FORWARDS, s = r ? o.nextNode() : o.previousNode();
147
+ const r = e.direction === We.FORWARDS, s = r ? o.nextNode() : o.previousNode();
147
148
  if (!s)
148
149
  throw t;
149
150
  return { node: s, offset: r ? 0 : s.data.length };
@@ -168,7 +169,7 @@ class B {
168
169
  return console.error("Text node offset is out of range"), null;
169
170
  if (!e.parentElement)
170
171
  return console.error("Text node has no parent"), null;
171
- const o = Oe(e) + t;
172
+ const o = De(e) + t;
172
173
  return new B(e.parentElement, o);
173
174
  }
174
175
  case Node.ELEMENT_NODE: {
@@ -176,7 +177,7 @@ class B {
176
177
  return console.error("Child node offset is out of range"), null;
177
178
  let o = 0;
178
179
  for (let r = 0; r < t; r++)
179
- o += He(e.childNodes[r]);
180
+ o += je(e.childNodes[r]);
180
181
  return new B(e, o);
181
182
  }
182
183
  default:
@@ -188,34 +189,34 @@ class B {
188
189
  throw new Error("Parent is not an ancestor of current element");
189
190
  let t = this.element, o = this.offset;
190
191
  for (; t !== e; )
191
- o += Oe(t), t.parentElement && (t = t.parentElement);
192
+ o += De(t), t.parentElement && (t = t.parentElement);
192
193
  return new B(t, o);
193
194
  }
194
195
  }
195
- const ft = (n) => {
196
+ const ht = (n) => {
196
197
  const e = n.nodeName.toLowerCase();
197
198
  return e === "#text" ? "text()" : e;
198
199
  };
199
- function mt(n) {
200
+ function gt(n) {
200
201
  let e = 0, t = n;
201
202
  for (; t; )
202
203
  t.nodeName === n.nodeName && (e += 1), t = t.previousSibling;
203
204
  return e;
204
205
  }
205
- const gt = (n) => {
206
- const e = ft(n), t = mt(n);
206
+ const pt = (n) => {
207
+ const e = ht(n), t = gt(n);
207
208
  return `${e}[${t}]`;
208
- }, we = (n, e) => {
209
+ }, ke = (n, e) => {
209
210
  let t = "", o = n;
210
211
  for (; o !== e; ) {
211
212
  if (!o) {
212
213
  console.error("Node is not a descendant of root");
213
214
  return;
214
215
  }
215
- t = `${gt(o)}/${t}`, o = o.parentNode;
216
+ t = `${pt(o)}/${t}`, o = o.parentNode;
216
217
  }
217
218
  return t = `/${t}`, t = t.replace(/\/$/, ""), t;
218
- }, ht = (n, e, t) => {
219
+ }, Nt = (n, e, t) => {
219
220
  const o = e.toUpperCase();
220
221
  let r = -1;
221
222
  for (let s = 0; s < n.children.length; s++) {
@@ -224,7 +225,7 @@ const gt = (n) => {
224
225
  return l;
225
226
  }
226
227
  return null;
227
- }, pt = (n, e) => {
228
+ }, yt = (n, e) => {
228
229
  if (!(n.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+])?)+$/) !== null))
229
230
  return console.error("Expression is not a simple XPath"), null;
230
231
  const o = n.split("/");
@@ -235,52 +236,52 @@ const gt = (n) => {
235
236
  const m = s.indexOf("[");
236
237
  if (m !== -1) {
237
238
  l = s.slice(0, m);
238
- const h = s.slice(m + 1, s.indexOf("]"));
239
- if (d = Number.parseInt(h, 10) - 1, d < 0)
239
+ const g = s.slice(m + 1, s.indexOf("]"));
240
+ if (d = Number.parseInt(g, 10) - 1, d < 0)
240
241
  return null;
241
242
  } else
242
243
  l = s, d = 0;
243
- const c = ht(r, l, d);
244
+ const c = Nt(r, l, d);
244
245
  if (!c)
245
246
  return null;
246
247
  r = c;
247
248
  }
248
249
  return r;
249
- }, ke = (n, e = document.body) => {
250
+ }, Re = (n, e = document.body) => {
250
251
  try {
251
- return pt(n, e);
252
+ return yt(n, e);
252
253
  } catch {
253
254
  return document.evaluate(`.${n}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
254
255
  }
255
256
  };
256
- class X {
257
+ class Y {
257
258
  constructor(e, t) {
258
259
  this.root = e, this.range = t;
259
260
  }
260
261
  static fromRange(e, t) {
261
- return new X(e, t);
262
+ return new Y(e, t);
262
263
  }
263
264
  static fromSelector(e, t) {
264
265
  if (!(t != null && t.startContainer) || !(t != null && t.endContainer))
265
266
  return console.error("No start or end container in selector"), null;
266
- const o = ke(t.startContainer, e);
267
+ const o = Re(t.startContainer, e);
267
268
  if (!o)
268
269
  return console.error("Failed to resolve startContainer XPath"), null;
269
- const r = ke(t.endContainer, e);
270
+ const r = Re(t.endContainer, e);
270
271
  if (!r)
271
272
  return console.error("Failed to resolve endContainer XPath"), null;
272
273
  const s = B.fromCharOffset(o, t.startOffset), l = B.fromCharOffset(r, t.endOffset);
273
274
  if (!s || !l)
274
275
  return null;
275
276
  const d = new $(s, l).toRange();
276
- return d ? new X(e, d) : null;
277
+ return d ? new Y(e, d) : null;
277
278
  }
278
279
  toRange() {
279
280
  return this.range;
280
281
  }
281
282
  toSelector() {
282
283
  var s;
283
- const e = (s = $.fromRange(this.range)) == null ? void 0 : s.toRange(), t = e && $.fromRange(e), o = t && we(t.start.element, this.root), r = t && we(t.end.element, this.root);
284
+ const e = (s = $.fromRange(this.range)) == null ? void 0 : s.toRange(), t = e && $.fromRange(e), o = t && ke(t.start.element, this.root), r = t && ke(t.end.element, this.root);
284
285
  return !o || !r ? null : {
285
286
  startContainer: o,
286
287
  startOffset: t.start.offset,
@@ -289,17 +290,17 @@ class X {
289
290
  };
290
291
  }
291
292
  }
292
- class q {
293
+ class G {
293
294
  constructor(e, t, o) {
294
295
  this.root = e, this.start = t, this.end = o;
295
296
  }
296
297
  static fromRange(e, t) {
297
298
  var r;
298
299
  const o = (r = $.fromRange(t)) == null ? void 0 : r.relativeTo(e);
299
- return o ? new q(e, o.start.offset, o.end.offset) : null;
300
+ return o ? new G(e, o.start.offset, o.end.offset) : null;
300
301
  }
301
302
  static fromSelector(e, t) {
302
- return new q(e, t.start, t.end);
303
+ return new G(e, t.start, t.end);
303
304
  }
304
305
  toSelector() {
305
306
  return {
@@ -311,7 +312,7 @@ class q {
311
312
  return $.fromOffsets(this.root, this.start, this.end).toRange();
312
313
  }
313
314
  }
314
- const He = (n) => {
315
+ const je = (n) => {
315
316
  var e;
316
317
  switch (n.nodeType) {
317
318
  case Node.ELEMENT_NODE:
@@ -320,12 +321,12 @@ const He = (n) => {
320
321
  default:
321
322
  return 0;
322
323
  }
323
- }, Oe = (n) => {
324
+ }, De = (n) => {
324
325
  let e = n.previousSibling, t = 0;
325
326
  for (; e; )
326
- t += He(e), e = e.previousSibling;
327
+ t += je(e), e = e.previousSibling;
327
328
  return t;
328
- }, Be = (n, ...e) => {
329
+ }, ze = (n, ...e) => {
329
330
  let t = e.shift();
330
331
  const o = n.ownerDocument.createNodeIterator(n, NodeFilter.SHOW_TEXT), r = [];
331
332
  let s = o.nextNode(), l = null, d = 0;
@@ -334,14 +335,14 @@ const He = (n) => {
334
335
  for (; t !== void 0 && l && d === t; )
335
336
  r.push({ node: l, offset: l.data.length }), t = e.shift();
336
337
  return t !== void 0 && console.error("Offset exceeds text length"), r;
337
- }, Nt = (n, e, t, o) => {
338
+ }, bt = (n, e, t, o) => {
338
339
  const r = t - e;
339
- return Math.abs(r - o) <= 5 ? q.fromSelector(n, {
340
+ return Math.abs(r - o) <= 5 ? G.fromSelector(n, {
340
341
  start: e,
341
342
  end: t
342
343
  }) : null;
343
- }, yt = (n, e, t, o) => {
344
- const r = new Ye();
344
+ }, Et = (n, e, t, o) => {
345
+ const r = new Je();
345
346
  r.Match_Distance = 5e3;
346
347
  const s = n.textContent;
347
348
  if (!s)
@@ -349,41 +350,41 @@ const He = (n) => {
349
350
  if (e.length > 32) {
350
351
  const l = e.slice(0, 32), d = e.slice(-32), m = o - t;
351
352
  let c = r.match_main(s, l, t);
352
- const h = r.match_main(s, d, o), g = h + d.length;
353
- if (c === -1 || h === -1)
353
+ const g = r.match_main(s, d, o), h = g + d.length;
354
+ if (c === -1 || g === -1)
354
355
  return null;
355
- const u = g - c, E = Math.abs(u - m);
356
- if ((c > g || E > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(s, l, g), c !== -1 && c < g))
357
- return Nt(n, c, g, m);
358
- if (c < g && E <= 5)
359
- return q.fromSelector(n, {
356
+ const u = h - c, E = Math.abs(u - m);
357
+ if ((c > h || E > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(s, l, h), c !== -1 && c < h))
358
+ return bt(n, c, h, m);
359
+ if (c < h && E <= 5)
360
+ return G.fromSelector(n, {
360
361
  start: c,
361
- end: g
362
+ end: h
362
363
  });
363
364
  } else {
364
365
  const l = r.match_main(s, e, t);
365
366
  if (l !== -1)
366
- return q.fromSelector(n, {
367
+ return G.fromSelector(n, {
367
368
  start: l,
368
369
  end: l + e.length
369
370
  });
370
371
  }
371
372
  return null;
372
- }, bt = (n, e) => {
373
+ }, St = (n, e) => {
373
374
  if (!e) return null;
374
375
  const { highlightData: t } = n, { textPosition: o, selectedText: r } = t;
375
- return yt(
376
+ return Et(
376
377
  e,
377
378
  r,
378
379
  (o == null ? void 0 : o.start) ?? 0,
379
380
  (o == null ? void 0 : o.end) ?? 0
380
381
  );
381
- }, Et = (n, e, t) => {
382
+ }, Ct = (n, e, t) => {
382
383
  const o = [], r = [];
383
384
  for (const s of e) {
384
- const l = bt(s, n);
385
+ const l = St(s, n);
385
386
  if (l) {
386
- const d = l.toRange(), m = d && X.fromRange(n, d);
387
+ const d = l.toRange(), m = d && Y.fromRange(n, d);
387
388
  o.push({
388
389
  id: s.id,
389
390
  reaction: s.reaction,
@@ -409,39 +410,39 @@ const He = (n) => {
409
410
  }) : r.push(s.id);
410
411
  }
411
412
  return { notesForUpdate: o, noteIdsForDelete: r };
412
- }, Re = (n, e) => {
413
+ }, Ae = (n, e) => {
413
414
  var l;
414
415
  if (!e) return;
415
416
  const { highlightData: t, id: o } = n, { range: r } = t ?? {};
416
- r && ((l = X.fromSelector(e, r)) == null ? void 0 : l.toRange()) && kt({ id: o });
417
- }, St = (n) => {
418
- const e = document.getElementById(Ce(n));
417
+ r && ((l = Y.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Rt({ id: o });
418
+ }, vt = (n) => {
419
+ const e = document.getElementById(ve(n));
419
420
  if (e) {
420
421
  const t = e.getBoundingClientRect();
421
422
  t.top >= 0 && t.left >= 0 && t.bottom <= (window.innerHeight || document.documentElement.clientHeight) && t.right <= (window.innerWidth || document.documentElement.clientWidth) || e.scrollIntoView({ behavior: "smooth", block: "start" });
422
423
  }
423
- }, re = 90, se = 172, Ct = (n) => {
424
+ }, se = 90, ie = 172, It = (n) => {
424
425
  const e = n.getClientRects();
425
426
  if (!e.length)
426
427
  return null;
427
428
  const t = e[0], o = e[e.length - 1], r = 4, s = 16, l = window.innerWidth || document.documentElement.clientWidth, d = window.innerHeight || document.documentElement.clientHeight, m = (f) => {
428
- const T = f + se;
429
- return f >= s && T <= l - s;
429
+ const I = f + ie;
430
+ return f >= s && I <= l - s;
430
431
  }, c = (f) => {
431
- const T = f + re;
432
- return f >= s && T <= d - s;
432
+ const I = f + se;
433
+ return f >= s && I <= d - s;
433
434
  };
434
- let h;
435
- const g = t.right - se;
436
- if (m(g))
437
- h = g;
435
+ let g;
436
+ const h = t.right - ie;
437
+ if (m(h))
438
+ g = h;
438
439
  else {
439
440
  const f = t.left;
440
441
  if (m(f))
441
- h = f;
442
+ g = f;
442
443
  else {
443
- const k = (t.left + t.right) / 2 - se / 2;
444
- m(k) ? h = k : g < s ? h = s : h = l - se - s;
444
+ const O = (t.left + t.right) / 2 - ie / 2;
445
+ m(O) ? g = O : h < s ? g = s : g = l - ie - s;
445
446
  }
446
447
  }
447
448
  let u;
@@ -449,19 +450,19 @@ const He = (n) => {
449
450
  if (c(E))
450
451
  u = E;
451
452
  else {
452
- const f = t.top - re - r;
453
- c(f) ? u = f : E + re > d - s ? u = d - re - s : u = s;
453
+ const f = t.top - se - r;
454
+ c(f) ? u = f : E + se > d - s ? u = d - se - s : u = s;
454
455
  }
455
- return { top: u, left: h };
456
- }, It = (n, e) => {
456
+ return { top: u, left: g };
457
+ }, Tt = (n, e) => {
457
458
  for (const t of e)
458
459
  if (n.start < t.end && n.end > t.start)
459
460
  return !0;
460
461
  return !1;
461
- }, Se = (n) => `highlight-wrapper-${n}`, Ce = (n) => `${Se(n)}-start`, We = (n) => `${Se(n)}-end`, ne = (n) => `[data-highlight-id="${CSS.escape(n)}"]`, ce = (n, e) => {
462
+ }, Ce = (n) => `highlight-wrapper-${n}`, ve = (n) => `${Ce(n)}-start`, Ue = (n) => `${Ce(n)}-end`, ne = (n) => `[data-highlight-id="${CSS.escape(n)}"]`, de = (n, e) => {
462
463
  const t = Number.parseInt(n.slice(1, 3), 16), o = Number.parseInt(n.slice(3, 5), 16), r = Number.parseInt(n.slice(5, 7), 16);
463
464
  return `rgba(${t}, ${o}, ${r}, ${e})`;
464
- }, Tt = (n, e) => {
465
+ }, xt = (n, e) => {
465
466
  var t;
466
467
  try {
467
468
  const o = ((t = e.nodeValue) == null ? void 0 : t.length) ?? e.childNodes.length;
@@ -469,7 +470,7 @@ const He = (n) => {
469
470
  } catch {
470
471
  return !1;
471
472
  }
472
- }, vt = (n) => {
473
+ }, wt = (n) => {
473
474
  var s;
474
475
  if (n.collapsed)
475
476
  return [];
@@ -479,7 +480,7 @@ const He = (n) => {
479
480
  const t = [], o = (s = e == null ? void 0 : e.ownerDocument) == null ? void 0 : s.createNodeIterator(e, NodeFilter.SHOW_TEXT);
480
481
  let r = (o == null ? void 0 : o.nextNode()) || null;
481
482
  for (; r; ) {
482
- if (!Tt(n, r)) {
483
+ if (!xt(n, r)) {
483
484
  r = (o == null ? void 0 : o.nextNode()) || null;
484
485
  continue;
485
486
  }
@@ -491,36 +492,36 @@ const He = (n) => {
491
492
  l === n.endContainer && n.endOffset < l.data.length && l.splitText(n.endOffset), t.push(l), r = (o == null ? void 0 : o.nextNode()) || null;
492
493
  }
493
494
  return t;
494
- }, xt = (n, e, t) => {
495
+ }, Ot = (n, e, t) => {
495
496
  if (n.collapsed) return;
496
- const o = e.id ?? "", r = Se(o);
497
- if (document.getElementById(Ce(o))) {
498
- wt(e, t);
497
+ const o = e.id ?? "", r = Ce(o);
498
+ if (document.getElementById(ve(o))) {
499
+ kt(e, t);
499
500
  return;
500
501
  }
501
- const l = e.type === A.IMPORTANT ? t.colors.importantBackground : t.colors.confusingBackground, m = e.id === e.selectedNoteId ? l : ce(l, 0.5), c = e.type === A.IMPORTANT ? t.colors.importantUnderline : t.colors.confusingUnderline, h = e.type === A.IMPORTANT ? "solid" : "dashed", g = n.toString(), u = document.createElement("span");
502
- u.id = `${r}-start`, u.className = "highlight-marker-start", u.dataset.highlightId = o || "", u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-label", g), u.style.position = "relative", u.style.fontSize = "0", u.style.lineHeight = "0", u.style.width = "0", u.style.height = "0", u.style.margin = "0", u.style.padding = "0", u.style.border = "0";
502
+ const l = e.type === A.IMPORTANT ? t.colors.importantBackground : t.colors.confusingBackground, m = e.id === e.selectedNoteId ? l : de(l, 0.5), c = e.type === A.IMPORTANT ? t.colors.importantUnderline : t.colors.confusingUnderline, g = e.type === A.IMPORTANT ? "solid" : "dashed", h = n.toString(), u = document.createElement("span");
503
+ u.id = `${r}-start`, u.className = "highlight-marker-start", u.dataset.highlightId = o || "", u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-label", h), u.style.position = "relative", u.style.fontSize = "0", u.style.lineHeight = "0", u.style.width = "0", u.style.height = "0", u.style.margin = "0", u.style.padding = "0", u.style.border = "0";
503
504
  const E = document.createElement("span");
504
- E.id = We(o), E.className = "highlight-marker-end", E.dataset.highlightId = o || "";
505
+ E.id = Ue(o), E.className = "highlight-marker-end", E.dataset.highlightId = o || "";
505
506
  const f = n.cloneRange();
506
507
  f.collapse(!1), f.insertNode(E);
507
- const T = n.cloneRange();
508
- T.collapse(!0), T.insertNode(u);
509
- const k = document.createRange();
510
- k.setStartAfter(u), k.setEndBefore(E);
511
- const v = vt(k).filter((N) => N.textContent && N.textContent.length > 0);
512
- v.forEach((N, x) => {
513
- var Y;
508
+ const I = n.cloneRange();
509
+ I.collapse(!0), I.insertNode(u);
510
+ const O = document.createRange();
511
+ O.setStartAfter(u), O.setEndBefore(E);
512
+ const T = wt(O).filter((N) => N.textContent && N.textContent.length > 0);
513
+ T.forEach((N, x) => {
514
+ var V;
514
515
  const R = N.parentElement;
515
516
  if ((R == null ? void 0 : R.dataset.highlightId) === o) return;
516
- const P = x === 0, C = x === v.length - 1, W = v.length === 1;
517
+ const P = x === 0, C = x === T.length - 1, W = T.length === 1;
517
518
  let L;
518
519
  W ? L = "single" : P ? L = "first" : C ? L = "last" : L = "middle";
519
520
  const D = document.createElement("span");
520
- D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position = L, D.style.backgroundColor = m, D.style.textDecorationLine = "underline", D.style.textDecorationColor = c, D.style.textDecorationStyle = h, D.style.textDecorationThickness = t.borderWidthSmall, D.style.textUnderlineOffset = t.underlineOffset, D.style.cursor = "pointer", D.addEventListener("click", (w) => {
521
+ D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position = L, D.style.backgroundColor = m, D.style.textDecorationLine = "underline", D.style.textDecorationColor = c, D.style.textDecorationStyle = g, D.style.textDecorationThickness = t.borderWidthSmall, D.style.textUnderlineOffset = t.underlineOffset, D.style.cursor = "pointer", D.addEventListener("click", (w) => {
521
522
  var y;
522
523
  w.target.tagName !== "A" && ((y = e.onClick) == null || y.call(e));
523
- }), (Y = N.parentNode) == null || Y.insertBefore(D, N), D.appendChild(N);
524
+ }), (V = N.parentNode) == null || V.insertBefore(D, N), D.appendChild(N);
524
525
  }), u.addEventListener("click", (N) => {
525
526
  var x;
526
527
  N.target.tagName !== "A" && ((x = e.onClick) == null || x.call(e));
@@ -552,16 +553,16 @@ const He = (n) => {
552
553
  });
553
554
  });
554
555
  };
555
- function wt(n, e) {
556
- const t = n.type === A.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, r = n.id === n.selectedNoteId ? t : ce(t, 0.5);
556
+ function kt(n, e) {
557
+ const t = n.type === A.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, r = n.id === n.selectedNoteId ? t : de(t, 0.5);
557
558
  document.querySelectorAll(
558
559
  ne(n.id ?? "")
559
560
  ).forEach((l) => {
560
561
  l.style.backgroundColor = r;
561
562
  });
562
563
  }
563
- const kt = (n) => {
564
- const e = n.id ?? "", t = document.getElementById(Ce(e)), o = document.getElementById(We(e));
564
+ const Rt = (n) => {
565
+ const e = n.id ?? "", t = document.getElementById(ve(e)), o = document.getElementById(Ue(e));
565
566
  document.querySelectorAll(
566
567
  ne(e)
567
568
  ).forEach((s) => {
@@ -574,38 +575,38 @@ const kt = (n) => {
574
575
  all: ["notebook"],
575
576
  notes: (n) => ["notebook", "notes", n]
576
577
  };
577
- function Ot(n) {
578
- const e = he();
579
- return pe({
578
+ function Dt(n) {
579
+ const e = pe();
580
+ return Ne({
580
581
  mutationFn: (t) => n.createNote(t),
581
582
  onSuccess: () => {
582
583
  e.invalidateQueries({ queryKey: te.all });
583
584
  }
584
585
  });
585
586
  }
586
- function Rt(n) {
587
- const e = he();
588
- return pe({
587
+ function At(n) {
588
+ const e = pe();
589
+ return Ne({
589
590
  mutationFn: (t) => n.deleteNote(t),
590
591
  onSuccess: () => {
591
592
  e.invalidateQueries({ queryKey: te.all });
592
593
  }
593
594
  });
594
595
  }
595
- function je({
596
+ function $e({
596
597
  api: n,
597
598
  enabled: e = !0,
598
599
  ...t
599
600
  }) {
600
- return Ve({
601
+ return et({
601
602
  queryKey: te.notes(t),
602
603
  queryFn: () => n.getNotes(t),
603
604
  enabled: e
604
605
  });
605
606
  }
606
- function Dt(n) {
607
- const e = he();
608
- return pe({
607
+ function Lt(n) {
608
+ const e = pe();
609
+ return Ne({
609
610
  mutationFn: ({ id: t, input: o }) => n.updateNote(t, o),
610
611
  onMutate: async ({ id: t, input: o }) => {
611
612
  await e.cancelQueries({ queryKey: te.all });
@@ -631,71 +632,71 @@ function Dt(n) {
631
632
  }
632
633
  });
633
634
  }
634
- const At = "Notebook", Lt = "Notes", Pt = "Important", _t = "Unclear", Ft = "Back", Mt = "Edit note", Ht = "Save", Bt = "Cancel", Wt = "Delete note", jt = "note", zt = "Add note (optional)", Ut = "Remove from Notebook", $t = "Add a note (optional).", qt = "Mark important", Gt = "Mark unclear", Kt = "Saved to Notebook.", Xt = "Note updated", Qt = "Note deleted", Yt = "Error saving to Notebook.", Vt = "Error updating note", Zt = "Note deletion failed", Jt = "Loading notes", en = "Failed to load notes", tn = "Start capturing your notes", nn = "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.", on = "Nothing here yet", rn = "Adjust your filters or create a new note to get started.", sn = "You have no notes for the selected filter", ln = "Previous page", an = "Next page", cn = "All courses", dn = "All notes", un = "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.", Ie = {
635
- notebook: At,
636
- notes: Lt,
637
- important: Pt,
638
- unclear: _t,
639
- back: Ft,
640
- editNote: Mt,
641
- save: Ht,
642
- cancel: Bt,
643
- deleteNote: Wt,
644
- note: jt,
645
- addNotePrompt: zt,
646
- removeFromNotebook: Ut,
647
- addNoteOptional: $t,
648
- markImportant: qt,
649
- markUnclear: Gt,
650
- savedToNotebook: Kt,
651
- noteUpdated: Xt,
652
- noteDeleted: Qt,
653
- errorSavingNote: Yt,
654
- errorUpdatingNote: Vt,
655
- noteDeletionFailed: Zt,
656
- loadingNotes: Jt,
657
- failedToLoadNotes: en,
658
- emptyStateHeading: tn,
659
- emptyStateDescription: nn,
660
- nothingHereYet: on,
661
- adjustFiltersOrCreate: rn,
662
- noNotesForFilter: sn,
663
- previousPage: ln,
664
- nextPage: an,
665
- allCourses: cn,
666
- allNotes: dn,
667
- closeNotebookPanel: un,
668
- featureDescription: fn,
669
- highlightUnavailable: mn
670
- }, ze = Ae(null);
671
- function Ue(n, e) {
635
+ const Pt = "Notebook", _t = "Notes", Ft = "Important", Mt = "Unclear", Ht = "Back", Bt = "Edit note", Wt = "Save", jt = "Cancel", zt = "Delete note", Ut = "note", $t = "Add note (optional)", Gt = "Remove from Notebook", qt = "Add a note (optional).", Kt = "Mark important", Xt = "Mark unclear", Qt = "Saved to Notebook.", Yt = "Note updated", Vt = "Note deleted", Zt = "Error saving to Notebook.", Jt = "Error updating note", en = "Note deletion failed", tn = "Loading notes", nn = "Failed to load notes", on = "Start capturing your notes", rn = "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.", sn = "Nothing here yet", ln = "Adjust your filters or create a new note to get started.", an = "You have no notes for the selected filter", cn = "Previous page", dn = "Next page", un = "All courses", fn = "All notes", mn = "Close Notebook panel", hn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", gn = "The content you highlighted is no longer available.", Ie = {
636
+ notebook: Pt,
637
+ notes: _t,
638
+ important: Ft,
639
+ unclear: Mt,
640
+ back: Ht,
641
+ editNote: Bt,
642
+ save: Wt,
643
+ cancel: jt,
644
+ deleteNote: zt,
645
+ note: Ut,
646
+ addNotePrompt: $t,
647
+ removeFromNotebook: Gt,
648
+ addNoteOptional: qt,
649
+ markImportant: Kt,
650
+ markUnclear: Xt,
651
+ savedToNotebook: Qt,
652
+ noteUpdated: Yt,
653
+ noteDeleted: Vt,
654
+ errorSavingNote: Zt,
655
+ errorUpdatingNote: Jt,
656
+ noteDeletionFailed: en,
657
+ loadingNotes: tn,
658
+ failedToLoadNotes: nn,
659
+ emptyStateHeading: on,
660
+ emptyStateDescription: rn,
661
+ nothingHereYet: sn,
662
+ adjustFiltersOrCreate: ln,
663
+ noNotesForFilter: an,
664
+ previousPage: cn,
665
+ nextPage: dn,
666
+ allCourses: un,
667
+ allNotes: fn,
668
+ closeNotebookPanel: mn,
669
+ featureDescription: hn,
670
+ highlightUnavailable: gn
671
+ }, Ge = Pe(null);
672
+ function qe(n, e) {
672
673
  const t = Ie[n] ?? n;
673
674
  return e ? t.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : t;
674
675
  }
675
- function gn({
676
+ function pn({
676
677
  translations: n,
677
678
  translate: e,
678
679
  children: t
679
680
  }) {
680
- const o = ge(
681
+ const o = oe(
681
682
  () => ({
682
683
  translations: { ...Ie, ...n },
683
- translate: e ?? Ue
684
+ translate: e ?? qe
684
685
  }),
685
686
  [n, e]
686
687
  );
687
- return /* @__PURE__ */ i(ze.Provider, { value: o, children: t });
688
+ return /* @__PURE__ */ i(Ge.Provider, { value: o, children: t });
688
689
  }
689
- function Q() {
690
- const n = Le(ze);
691
- return n || { translations: Ie, translate: Ue };
690
+ function q() {
691
+ const n = _e(Ge);
692
+ return n || { translations: Ie, translate: qe };
692
693
  }
693
- const hn = {
694
+ const Nn = {
694
695
  selectedNoteId: null,
695
696
  isNoteEditing: !1,
696
697
  isTrayOpen: !1
697
698
  };
698
- function pn(n, e) {
699
+ function yn(n, e) {
699
700
  switch (e.type) {
700
701
  case "SELECT_NOTE":
701
702
  return {
@@ -715,8 +716,8 @@ function pn(n, e) {
715
716
  return n;
716
717
  }
717
718
  }
718
- const $e = Ae(null);
719
- function qn({
719
+ const Ke = Pe(null);
720
+ function Xn({
720
721
  api: n,
721
722
  currentUserId: e,
722
723
  objectId: t,
@@ -728,7 +729,7 @@ function qn({
728
729
  translate: m,
729
730
  children: c
730
731
  }) {
731
- const [h, g] = Pe(pn, hn), u = ge(
732
+ const [g, h] = Fe(yn, Nn), u = oe(
732
733
  () => ({
733
734
  api: n,
734
735
  currentUserId: e,
@@ -737,12 +738,12 @@ function qn({
737
738
  courseId: r,
738
739
  pageLastModifiedAt: s,
739
740
  onAnalyticsEvent: l,
740
- ...h,
741
- selectNote: (E, f = !1) => g({ type: "SELECT_NOTE", payload: { id: E, isEditing: f } }),
742
- clearSelectedNote: () => g({ type: "CLEAR_SELECTED_NOTE" }),
743
- setEditing: (E) => g({ type: "SET_EDITING", payload: E }),
744
- openTray: () => g({ type: "OPEN_TRAY" }),
745
- closeTray: () => g({ type: "CLOSE_TRAY" })
741
+ ...g,
742
+ selectNote: (E, f = !1) => h({ type: "SELECT_NOTE", payload: { id: E, isEditing: f } }),
743
+ clearSelectedNote: () => h({ type: "CLEAR_SELECTED_NOTE" }),
744
+ setEditing: (E) => h({ type: "SET_EDITING", payload: E }),
745
+ openTray: () => h({ type: "OPEN_TRAY" }),
746
+ closeTray: () => h({ type: "CLOSE_TRAY" })
746
747
  }),
747
748
  [
748
749
  n,
@@ -752,33 +753,33 @@ function qn({
752
753
  r,
753
754
  s,
754
755
  l,
755
- h
756
+ g
756
757
  ]
757
758
  );
758
- return /* @__PURE__ */ i($e.Provider, { value: u, children: /* @__PURE__ */ i(gn, { translations: d, translate: m, children: c }) });
759
+ return /* @__PURE__ */ i(Ke.Provider, { value: u, children: /* @__PURE__ */ i(pn, { translations: d, translate: m, children: c }) });
759
760
  }
760
- function qe() {
761
- const n = Le($e);
761
+ function Xe() {
762
+ const n = _e(Ke);
762
763
  if (!n)
763
764
  throw new Error("useNotebook must be used within a NotebookProvider");
764
765
  return n;
765
766
  }
766
- const Nn = ({ currentType: n, onSelectReaction: e }) => {
767
- const { translations: t } = Q(), o = oe(null), r = oe(null);
768
- return Z(() => {
767
+ const bn = ({ currentType: n, onSelectReaction: e }) => {
768
+ const { translations: t } = q(), o = re(null), r = re(null);
769
+ return J(() => {
769
770
  n === A.CONFUSING && o.current ? o.current.focus() : n === A.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
770
771
  }, [n]), /* @__PURE__ */ b(ee, { children: [
771
772
  /* @__PURE__ */ b(ee.Item, { ref: o, onClick: () => e(A.CONFUSING), children: [
772
- /* @__PURE__ */ i(Ne, { size: "x-small" }),
773
+ /* @__PURE__ */ i(ye, { size: "x-small" }),
773
774
  ` ${t.markUnclear}`
774
775
  ] }),
775
776
  /* @__PURE__ */ b(ee.Item, { ref: r, onClick: () => e(A.IMPORTANT), children: [
776
- /* @__PURE__ */ i(ye, { size: "x-small" }),
777
+ /* @__PURE__ */ i(be, { size: "x-small" }),
777
778
  ` ${t.markImportant}`
778
779
  ] })
779
780
  ] });
780
- }, de = "notebook-inline-reaction-menu";
781
- function Gn({
781
+ }, ue = "notebook-inline-reaction-menu";
782
+ function Qn({
782
783
  containerRef: n,
783
784
  highlightTheme: e,
784
785
  debounceTime: t = 500
@@ -791,16 +792,16 @@ function Gn({
791
792
  pageLastModifiedAt: d,
792
793
  selectedNoteId: m,
793
794
  selectNote: c,
794
- openTray: h
795
- } = qe(), { data: g } = je({
795
+ openTray: g
796
+ } = Xe(), { data: h } = $e({
796
797
  api: o,
797
798
  filter: {
798
799
  learningObject: { type: s, id: r }
799
800
  },
800
801
  courseId: l,
801
802
  pageSize: 100
802
- }), { mutate: u } = Ot(o), { mutate: E } = Dt(o), { mutate: f } = Rt(o), T = oe([]), [k, O] = H([]), [v, N] = H(null), [x, R] = H(""), [P, C] = H(null), [W, L] = H(!1);
803
- Z(() => {
803
+ }), { mutate: u } = Dt(o), { mutate: E } = Lt(o), { mutate: f } = At(o), I = re([]), [O, k] = H([]), [T, N] = H(null), [x, R] = H(""), [P, C] = H(null), [W, L] = H(!1);
804
+ J(() => {
804
805
  const w = n.current;
805
806
  if (!w) return;
806
807
  const y = w.closest(".user_content") ?? w;
@@ -816,24 +817,24 @@ function Gn({
816
817
  }
817
818
  });
818
819
  return _.observe(y, { attributes: !0, attributeFilter: ["class"] }), () => _.disconnect();
819
- }, [n]), Z(() => {
820
+ }, [n]), J(() => {
820
821
  if (!W || !n.current) return;
821
822
  let y = null;
822
823
  const _ = () => {
823
824
  y && clearTimeout(y), y = setTimeout(() => {
824
- var ve;
825
+ var xe;
825
826
  const S = window.getSelection(), p = n.current;
826
827
  if (!(S != null && S.rangeCount) || !p) return;
827
828
  const j = S.toString().trim();
828
829
  if (j === "") return;
829
- const V = S.getRangeAt(0);
830
- if (!p.contains(V.commonAncestorContainer)) return;
831
- const Te = (ve = q.fromRange(p, V)) == null ? void 0 : ve.toSelector();
832
- Te && !It(Te, k) && (N(V.cloneRange()), R(j), C(Ct(V)));
830
+ const Z = S.getRangeAt(0);
831
+ if (!p.contains(Z.commonAncestorContainer)) return;
832
+ const Te = (xe = G.fromRange(p, Z)) == null ? void 0 : xe.toSelector();
833
+ Te && !Tt(Te, O) && (N(Z.cloneRange()), R(j), C(It(Z)));
833
834
  }, t);
834
835
  }, F = (S) => {
835
836
  if (!(S.target instanceof Node)) return;
836
- const p = document.getElementById(de);
837
+ const p = document.getElementById(ue);
837
838
  p != null && p.contains(S.target) ? (S.preventDefault(), S.stopImmediatePropagation()) : (C(null), N(null), R(""));
838
839
  }, M = () => {
839
840
  C(null), N(null), R("");
@@ -841,43 +842,43 @@ function Gn({
841
842
  return document.addEventListener("selectionchange", _), document.addEventListener("mousedown", F), document.addEventListener("touchstart", F), window.addEventListener("scroll", M, !0), () => {
842
843
  y && clearTimeout(y), document.removeEventListener("selectionchange", _), document.removeEventListener("mousedown", F), document.removeEventListener("touchstart", F), window.removeEventListener("scroll", M, !0);
843
844
  };
844
- }, [W, k, t, n]), Z(() => {
845
- m && St(m);
845
+ }, [W, O, t, n]), J(() => {
846
+ m && vt(m);
846
847
  }, [m]);
847
- const D = J(
848
+ const D = K(
848
849
  (w) => {
849
850
  var j;
850
851
  const y = n.current;
851
852
  if (!y || !w.highlightData) return null;
852
- const { highlightData: _, reaction: F, id: M } = w, { range: S } = _, p = S && ((j = X.fromSelector(y, S)) == null ? void 0 : j.toRange());
853
+ const { highlightData: _, reaction: F, id: M } = w, { range: S } = _, p = S && ((j = Y.fromSelector(y, S)) == null ? void 0 : j.toRange());
853
854
  if (p) {
854
- const V = {
855
+ const Z = {
855
856
  id: M,
856
857
  selectedNoteId: m,
857
858
  type: F[0],
858
859
  onClick: () => {
859
- c(M), h();
860
+ c(M), g();
860
861
  }
861
862
  };
862
- return xt(p, V, e), _.textPosition;
863
+ return Ot(p, Z, e), _.textPosition;
863
864
  }
864
865
  return null;
865
866
  },
866
- [n, m, e, c, h]
867
+ [n, m, e, c, g]
867
868
  );
868
- Z(() => {
869
- if (!W || !g || !n.current) return;
870
- const w = n.current, y = g.notes, _ = /* @__PURE__ */ new Set(), F = [], M = [];
869
+ J(() => {
870
+ if (!W || !h || !n.current) return;
871
+ const w = n.current, y = h.notes, _ = /* @__PURE__ */ new Set(), F = [], M = [];
871
872
  if (y.length === 0) {
872
- if (T.current.length > 0) {
873
- for (const S of T.current)
874
- Re(S, w);
875
- T.current = [], O([]);
873
+ if (I.current.length > 0) {
874
+ for (const S of I.current)
875
+ Ae(S, w);
876
+ I.current = [], k([]);
876
877
  }
877
878
  return;
878
879
  }
879
880
  if (d && y[0].highlightData.pageLastModifiedAt !== d) {
880
- const { notesForUpdate: S, noteIdsForDelete: p } = Et(
881
+ const { notesForUpdate: S, noteIdsForDelete: p } = Ct(
881
882
  w,
882
883
  y,
883
884
  d
@@ -891,23 +892,23 @@ function Gn({
891
892
  const p = D(S);
892
893
  _.add(S.id), p && (F.push(S), M.push(p));
893
894
  }
894
- for (const S of T.current)
895
- _.has(S.id) || Re(S, w);
896
- O(M), T.current = F;
895
+ for (const S of I.current)
896
+ _.has(S.id) || Ae(S, w);
897
+ k(M), I.current = F;
897
898
  }
898
899
  }, [
899
900
  W,
900
- g,
901
+ h,
901
902
  D,
902
903
  d,
903
904
  n,
904
905
  E,
905
906
  f
906
907
  ]);
907
- const Y = (w) => {
908
+ const V = (w) => {
908
909
  const y = n.current;
909
- if (!v || !y) return;
910
- const _ = X.fromRange(y, v), F = q.fromRange(y, v);
910
+ if (!T || !y) return;
911
+ const _ = Y.fromRange(y, T), F = G.fromRange(y, T);
911
912
  u(
912
913
  {
913
914
  courseId: l,
@@ -926,16 +927,16 @@ function Gn({
926
927
  onSuccess: (M) => {
927
928
  var p;
928
929
  const S = M.id;
929
- N(null), R(""), C(null), (p = window.getSelection()) == null || p.removeAllRanges(), c(S), h();
930
+ N(null), R(""), C(null), (p = window.getSelection()) == null || p.removeAllRanges(), c(S), g();
930
931
  }
931
932
  }
932
933
  );
933
934
  };
934
- return !v || !P ? null : Qe(
935
+ return !T || !P ? null : Ze(
935
936
  /* @__PURE__ */ i(
936
937
  "div",
937
938
  {
938
- id: de,
939
+ id: ue,
939
940
  role: "toolbar",
940
941
  style: {
941
942
  position: "fixed",
@@ -945,28 +946,28 @@ function Gn({
945
946
  whiteSpace: "nowrap"
946
947
  },
947
948
  onBlur: (w) => {
948
- const y = document.getElementById(de);
949
+ const y = document.getElementById(ue);
949
950
  y != null && y.contains(w.relatedTarget) || (C(null), N(null), R(""));
950
951
  },
951
- children: /* @__PURE__ */ i(Nn, { onSelectReaction: Y })
952
+ children: /* @__PURE__ */ i(bn, { onSelectReaction: V })
952
953
  }
953
954
  ),
954
955
  document.body
955
956
  );
956
957
  }
957
- const yn = (n, e) => ({
958
+ const En = (n, e) => ({
958
959
  backgroundColor: n === A.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
959
960
  underlineColor: n === A.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
960
961
  underlineStyle: n === A.IMPORTANT ? "solid" : "dashed"
961
- }), me = ({
962
+ }), ge = ({
962
963
  children: n,
963
964
  type: e = A.IMPORTANT,
964
965
  isCardActive: t = !0,
965
966
  theme: o
966
967
  }) => {
967
- const r = yn(e, o), l = {
968
+ const r = En(e, o), l = {
968
969
  position: "relative",
969
- backgroundColor: t ? r.backgroundColor : ce(r.backgroundColor, 0.5),
970
+ backgroundColor: t ? r.backgroundColor : de(r.backgroundColor, 0.5),
970
971
  textDecorationLine: "underline",
971
972
  textDecorationStyle: r.underlineStyle,
972
973
  textDecorationColor: r.underlineColor,
@@ -975,18 +976,18 @@ const yn = (n, e) => ({
975
976
  lineHeight: "normal"
976
977
  };
977
978
  return /* @__PURE__ */ i("span", { "data-note-highlight": "true", style: l, children: n });
978
- }, Ge = () => {
979
- const { translations: n } = Q();
980
- return /* @__PURE__ */ b(I, { gap: "xx-small", alignItems: "start", as: "div", children: [
981
- /* @__PURE__ */ i(I.Item, { as: "div", children: /* @__PURE__ */ i(Ze, { color: "error" }) }),
982
- /* @__PURE__ */ i(I.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ i(fe, { maxLines: 3, children: n.highlightUnavailable }) })
979
+ }, Qe = () => {
980
+ const { translations: n } = q();
981
+ return /* @__PURE__ */ b(v, { gap: "xx-small", alignItems: "start", as: "div", children: [
982
+ /* @__PURE__ */ i(v.Item, { as: "div", children: /* @__PURE__ */ i(tt, { color: "error" }) }),
983
+ /* @__PURE__ */ i(v.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ i(he, { maxLines: 3, children: n.highlightUnavailable }) })
983
984
  ] });
984
- }, bn = {
985
+ }, Sn = {
985
986
  filter: null,
986
987
  courseFilter: null,
987
988
  pageParamsWithDirection: {}
988
989
  };
989
- function En(n, e) {
990
+ function Cn(n, e) {
990
991
  switch (e.type) {
991
992
  case "SET_FILTER":
992
993
  return { ...n, filter: e.payload, pageParamsWithDirection: {} };
@@ -998,47 +999,47 @@ function En(n, e) {
998
999
  return n;
999
1000
  }
1000
1001
  }
1001
- function Kn({
1002
+ function Yn({
1002
1003
  api: n,
1003
1004
  courseId: e,
1004
1005
  enableCourseFilter: t = !1,
1005
1006
  learningObject: o,
1006
1007
  pageSize: r = 16
1007
1008
  }) {
1008
- const [s, l] = Pe(En, bn), { filter: d, courseFilter: m, pageParamsWithDirection: c } = s;
1009
- Z(() => {
1009
+ const [s, l] = Fe(Cn, Sn), { filter: d, courseFilter: m, pageParamsWithDirection: c } = s;
1010
+ J(() => {
1010
1011
  Object.keys(c).length > 0 && l({ type: "SET_PAGE_PARAMS_WITH_DIRECTION", payload: {} });
1011
1012
  }, [r]);
1012
- const h = t ? m : e, { direction: g, pageParams: u } = c, E = g === "next" ? (u == null ? void 0 : u.endCursor) ?? void 0 : g === "prev" ? (u == null ? void 0 : u.startCursor) ?? void 0 : void 0, { data: f, isLoading: T, isError: k } = je({
1013
+ const g = t ? m : e, { direction: h, pageParams: u } = c, E = h === "next" ? (u == null ? void 0 : u.endCursor) ?? void 0 : h === "prev" ? (u == null ? void 0 : u.startCursor) ?? void 0 : void 0, { data: f, isLoading: I, isError: O } = $e({
1013
1014
  api: n,
1014
1015
  filter: {
1015
- ...h ? { courseId: h } : {},
1016
+ ...g ? { courseId: g } : {},
1016
1017
  ...d ? { reactions: [d] } : {},
1017
1018
  ...o ? { learningObject: o } : {}
1018
1019
  },
1019
1020
  cursor: E,
1020
- direction: g,
1021
+ direction: h,
1021
1022
  pageSize: r
1022
- }), O = (f == null ? void 0 : f.notes) ?? [], v = f == null ? void 0 : f.pageInfo, N = J(() => {
1023
+ }), k = (f == null ? void 0 : f.notes) ?? [], T = f == null ? void 0 : f.pageInfo, N = K(() => {
1023
1024
  l({
1024
1025
  type: "SET_PAGE_PARAMS_WITH_DIRECTION",
1025
1026
  payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "next" }
1026
1027
  });
1027
- }, [f == null ? void 0 : f.pageInfo]), x = J(() => {
1028
+ }, [f == null ? void 0 : f.pageInfo]), x = K(() => {
1028
1029
  l({
1029
1030
  type: "SET_PAGE_PARAMS_WITH_DIRECTION",
1030
1031
  payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "prev" }
1031
1032
  });
1032
- }, [f == null ? void 0 : f.pageInfo]), R = J((C) => {
1033
+ }, [f == null ? void 0 : f.pageInfo]), R = K((C) => {
1033
1034
  l({ type: "SET_FILTER", payload: C });
1034
- }, []), P = J((C) => {
1035
+ }, []), P = K((C) => {
1035
1036
  l({ type: "SET_COURSE_FILTER", payload: C });
1036
1037
  }, []);
1037
1038
  return {
1038
- notes: O,
1039
- pageInfo: v,
1040
- isLoading: T,
1041
- isError: k,
1039
+ notes: k,
1040
+ pageInfo: T,
1041
+ isLoading: I,
1042
+ isError: O,
1042
1043
  filter: d,
1043
1044
  courseFilter: m,
1044
1045
  setFilter: R,
@@ -1047,21 +1048,53 @@ function Kn({
1047
1048
  fetchPreviousPage: x
1048
1049
  };
1049
1050
  }
1050
- const Xn = ({ children: n }) => {
1051
- const { isTrayOpen: e, closeTray: t } = qe(), { translations: o } = Q();
1051
+ const fe = "all";
1052
+ function Vn({ filter: n, setFilter: e }) {
1053
+ const { translations: t } = q(), o = oe(
1054
+ () => [
1055
+ { label: t.allNotes, value: fe },
1056
+ { label: t.important, value: A.IMPORTANT },
1057
+ { label: t.unclear, value: A.CONFUSING }
1058
+ ],
1059
+ [t]
1060
+ ), r = K(
1061
+ (l, { value: d }) => {
1062
+ e(!d || d === fe ? null : d);
1063
+ },
1064
+ [e]
1065
+ );
1066
+ return {
1067
+ filterElement: oe(
1068
+ () => /* @__PURE__ */ i(
1069
+ we,
1070
+ {
1071
+ renderLabel: /* @__PURE__ */ i(Me, { children: t.notes }),
1072
+ value: n ?? fe,
1073
+ onChange: r,
1074
+ children: o.map((l) => /* @__PURE__ */ i(we.Option, { id: l.value, value: l.value, children: l.label }, l.value))
1075
+ }
1076
+ ),
1077
+ [n, o, r, t.notes]
1078
+ ),
1079
+ reactionFilterOptions: o,
1080
+ handleReactionFilterChange: r
1081
+ };
1082
+ }
1083
+ const Zn = ({ children: n }) => {
1084
+ const { isTrayOpen: e, closeTray: t } = Xe(), { translations: o } = q();
1052
1085
  return /* @__PURE__ */ i(
1053
- rt,
1086
+ lt,
1054
1087
  {
1055
1088
  label: o.notebook,
1056
1089
  open: e,
1057
1090
  onDismiss: t,
1058
1091
  placement: "end",
1059
1092
  size: "regular",
1060
- children: /* @__PURE__ */ b(I, { direction: "column", height: "100vh", children: [
1061
- /* @__PURE__ */ i(I.Item, { children: /* @__PURE__ */ i(K, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ b(I, { justifyItems: "space-between", alignItems: "center", children: [
1062
- /* @__PURE__ */ i(le, { level: "h3", children: o.notebook }),
1093
+ children: /* @__PURE__ */ b(v, { direction: "column", height: "100vh", children: [
1094
+ /* @__PURE__ */ i(v.Item, { children: /* @__PURE__ */ i(Q, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ b(v, { justifyItems: "space-between", alignItems: "center", children: [
1095
+ /* @__PURE__ */ i(ae, { level: "h3", children: o.notebook }),
1063
1096
  /* @__PURE__ */ i(
1064
- ot,
1097
+ it,
1065
1098
  {
1066
1099
  screenReaderLabel: o.closeNotebookPanel,
1067
1100
  onClick: t,
@@ -1070,25 +1103,25 @@ const Xn = ({ children: n }) => {
1070
1103
  }
1071
1104
  )
1072
1105
  ] }) }) }),
1073
- /* @__PURE__ */ i(I.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: n })
1106
+ /* @__PURE__ */ i(v.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: n })
1074
1107
  ] })
1075
1108
  }
1076
1109
  );
1077
- }, Sn = {
1110
+ }, vn = {
1078
1111
  [A.IMPORTANT]: {
1079
1112
  color: "info",
1080
1113
  translationKey: "important",
1081
- icon: /* @__PURE__ */ i(ye, { size: "x-small" })
1114
+ icon: /* @__PURE__ */ i(be, { size: "x-small" })
1082
1115
  },
1083
1116
  [A.CONFUSING]: {
1084
1117
  color: "danger",
1085
1118
  translationKey: "unclear",
1086
- icon: /* @__PURE__ */ i(Ne, { size: "x-small" })
1119
+ icon: /* @__PURE__ */ i(ye, { size: "x-small" })
1087
1120
  }
1088
- }, Ke = ({ type: n, onTypeChange: e, renderAsMenuTrigger: t = !1 }) => {
1089
- const { translations: o } = Q(), r = Sn[n], s = o[r.translationKey], [l, d] = H(!1), m = oe(null), c = oe(null), h = J(
1090
- (g) => {
1091
- e == null || e(g), d(!1);
1121
+ }, Ye = ({ type: n, onTypeChange: e, renderAsMenuTrigger: t = !1 }) => {
1122
+ const { translations: o } = q(), r = vn[n], s = o[r.translationKey], [l, d] = H(!1), m = re(null), c = re(null), g = K(
1123
+ (h) => {
1124
+ e == null || e(h), d(!1);
1092
1125
  },
1093
1126
  [e]
1094
1127
  );
@@ -1097,35 +1130,35 @@ const Xn = ({ children: n }) => {
1097
1130
  {
1098
1131
  placement: "bottom start",
1099
1132
  show: l,
1100
- onToggle: (g) => d(g),
1133
+ onToggle: (h) => d(h),
1101
1134
  shouldHideOnSelect: !0,
1102
1135
  shouldFocusTriggerOnClose: !0,
1103
- trigger: /* @__PURE__ */ b(xe, { color: r.color, renderIcon: r.icon, children: [
1136
+ trigger: /* @__PURE__ */ b(Oe, { color: r.color, renderIcon: r.icon, children: [
1104
1137
  s,
1105
1138
  " ",
1106
- /* @__PURE__ */ i(Je, { size: "x-small" })
1139
+ /* @__PURE__ */ i(nt, { size: "x-small" })
1107
1140
  ] }),
1108
1141
  children: [
1109
- /* @__PURE__ */ b(ee.Item, { ref: m, onClick: () => h(A.CONFUSING), children: [
1110
- /* @__PURE__ */ i(Ne, { size: "x-small" }),
1142
+ /* @__PURE__ */ b(ee.Item, { ref: m, onClick: () => g(A.CONFUSING), children: [
1143
+ /* @__PURE__ */ i(ye, { size: "x-small" }),
1111
1144
  ` ${o.markUnclear}`
1112
1145
  ] }),
1113
- /* @__PURE__ */ b(ee.Item, { ref: c, onClick: () => h(A.IMPORTANT), children: [
1114
- /* @__PURE__ */ i(ye, { size: "x-small" }),
1146
+ /* @__PURE__ */ b(ee.Item, { ref: c, onClick: () => g(A.IMPORTANT), children: [
1147
+ /* @__PURE__ */ i(be, { size: "x-small" }),
1115
1148
  ` ${o.markImportant}`
1116
1149
  ] })
1117
1150
  ]
1118
1151
  }
1119
- ) : /* @__PURE__ */ i(xe, { color: r.color, renderIcon: r.icon, children: s });
1152
+ ) : /* @__PURE__ */ i(Oe, { color: r.color, renderIcon: r.icon, children: s });
1120
1153
  };
1121
- function De(n, e) {
1154
+ function Le(n, e) {
1122
1155
  return (n instanceof Date ? n : new Date(n)).toLocaleString(e, {
1123
1156
  year: "numeric",
1124
1157
  month: "short",
1125
1158
  day: "numeric"
1126
1159
  });
1127
1160
  }
1128
- const Cn = ({
1161
+ const In = ({
1129
1162
  noteId: n,
1130
1163
  date: e,
1131
1164
  highlight: t,
@@ -1136,21 +1169,21 @@ const Cn = ({
1136
1169
  onSaveNote: d,
1137
1170
  onTypeChange: m,
1138
1171
  isActive: c,
1139
- isPanelView: h = !1,
1140
- courseName: g,
1172
+ isPanelView: g = !1,
1173
+ courseName: h,
1141
1174
  locale: u,
1142
1175
  highlightTheme: E,
1143
1176
  cardTheme: f,
1144
- renderLink: T,
1145
- href: k
1177
+ renderLink: I,
1178
+ href: O
1146
1179
  }) => {
1147
- const { translations: O } = Q(), [v, N] = H(!1), [x, R] = H(!1), [P, C] = H(o || ""), [W, L] = H(!1), D = r === A.IMPORTANT ? O.important : O.unclear, Y = (p) => {
1180
+ const { translations: k } = q(), [T, N] = H(!1), [x, R] = H(!1), [P, C] = H(o || ""), [W, L] = H(!1), D = r === A.IMPORTANT ? k.important : k.unclear, V = (p) => {
1148
1181
  p.key === "Enter" && (p.preventDefault(), s == null || s());
1149
- }, w = [D, O.note];
1150
- t && w.push(t), o && w.push(o), e && w.push(De(e, u)), g && w.push(g);
1182
+ }, w = [D, k.note];
1183
+ t && w.push(t), o && w.push(o), e && w.push(Le(e, u)), h && w.push(h);
1151
1184
  const y = w.join(", "), _ = r === A.CONFUSING ? f.confusingBorderColor : f.importantBorderColor, M = {
1152
1185
  borderStyle: "solid",
1153
- borderColor: c || v ? _ : ce(_, 0.5),
1186
+ borderColor: c || T ? _ : de(_, 0.5),
1154
1187
  borderWidth: "0.0625rem 0.0625rem 0.25rem 0.25rem",
1155
1188
  borderRadius: "1rem",
1156
1189
  padding: "1rem",
@@ -1162,56 +1195,56 @@ const Cn = ({
1162
1195
  /* @__PURE__ */ b(
1163
1196
  "div",
1164
1197
  {
1165
- role: k || x ? void 0 : "button",
1166
- "aria-label": k ? void 0 : y,
1167
- "aria-pressed": k || x ? void 0 : c,
1168
- tabIndex: k || c ? -1 : 0,
1198
+ role: O || x ? void 0 : "button",
1199
+ "aria-label": O ? void 0 : y,
1200
+ "aria-pressed": O || x ? void 0 : c,
1201
+ tabIndex: O || c ? -1 : 0,
1169
1202
  "data-testid": "note-card",
1170
1203
  onClick: c ? void 0 : s,
1171
1204
  onMouseEnter: () => N(!0),
1172
1205
  onMouseLeave: () => N(!1),
1173
- onKeyDown: c ? void 0 : Y,
1206
+ onKeyDown: c ? void 0 : V,
1174
1207
  style: M,
1175
1208
  children: [
1176
- /* @__PURE__ */ b(I, { direction: "column", gap: "small", children: [
1209
+ /* @__PURE__ */ b(v, { direction: "column", gap: "small", children: [
1177
1210
  /* @__PURE__ */ i(
1178
- Ke,
1211
+ Ye,
1179
1212
  {
1180
1213
  type: r,
1181
- onTypeChange: h && m ? (p) => m(n, p) : void 0,
1182
- renderAsMenuTrigger: h && !!m && !!c
1214
+ onTypeChange: g && m ? (p) => m(n, p) : void 0,
1215
+ renderAsMenuTrigger: g && !!m && !!c
1183
1216
  }
1184
1217
  ),
1185
- t ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ i(z, { children: c && h ? /* @__PURE__ */ i(
1186
- me,
1218
+ t ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ i(z, { children: c && g ? /* @__PURE__ */ i(
1219
+ ge,
1187
1220
  {
1188
1221
  type: r,
1189
- isCardActive: !!c || v,
1222
+ isCardActive: !!c || T,
1190
1223
  theme: E,
1191
1224
  children: t
1192
1225
  }
1193
- ) : /* @__PURE__ */ i(fe, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ i(
1194
- me,
1226
+ ) : /* @__PURE__ */ i(he, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ i(
1227
+ ge,
1195
1228
  {
1196
1229
  type: r,
1197
- isCardActive: !!c || v,
1230
+ isCardActive: !!c || T,
1198
1231
  theme: E,
1199
1232
  children: t
1200
1233
  }
1201
- ) }) }) }) : /* @__PURE__ */ i(Ge, {}),
1202
- /* @__PURE__ */ b(I, { direction: "column", gap: c ? "small" : "none", children: [
1203
- x && h ? /* @__PURE__ */ b(I, { direction: "column", gap: "x-small", children: [
1234
+ ) }) }) }) : /* @__PURE__ */ i(Qe, {}),
1235
+ /* @__PURE__ */ b(v, { direction: "column", gap: c ? "small" : "none", children: [
1236
+ x && g ? /* @__PURE__ */ b(v, { direction: "column", gap: "x-small", children: [
1204
1237
  /* @__PURE__ */ i(
1205
- _e,
1238
+ He,
1206
1239
  {
1207
- label: /* @__PURE__ */ i(st, { children: O.editNote }),
1240
+ label: /* @__PURE__ */ i(Me, { children: k.editNote }),
1208
1241
  value: P,
1209
1242
  onChange: (p) => C(p.target.value),
1210
- placeholder: O.addNoteOptional
1243
+ placeholder: k.addNoteOptional
1211
1244
  }
1212
1245
  ),
1213
- /* @__PURE__ */ b(I, { gap: "xx-small", children: [
1214
- /* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1246
+ /* @__PURE__ */ b(v, { gap: "xx-small", children: [
1247
+ /* @__PURE__ */ i(v.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1215
1248
  U,
1216
1249
  {
1217
1250
  display: "block",
@@ -1220,10 +1253,10 @@ const Cn = ({
1220
1253
  onClick: () => {
1221
1254
  C(o || ""), R(!1);
1222
1255
  },
1223
- children: O.cancel
1256
+ children: k.cancel
1224
1257
  }
1225
1258
  ) }),
1226
- /* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1259
+ /* @__PURE__ */ i(v.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1227
1260
  U,
1228
1261
  {
1229
1262
  display: "block",
@@ -1234,68 +1267,68 @@ const Cn = ({
1234
1267
  d == null || d(n, P), R(!1);
1235
1268
  },
1236
1269
  interaction: P.trim() ? "enabled" : "disabled",
1237
- children: O.save
1270
+ children: k.save
1238
1271
  }
1239
1272
  ) })
1240
1273
  ] })
1241
- ] }) : o ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && h ? /* @__PURE__ */ b(z, { children: [
1274
+ ] }) : o ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && g ? /* @__PURE__ */ b(z, { children: [
1242
1275
  o,
1243
1276
  " ",
1244
1277
  /* @__PURE__ */ i(
1245
- G,
1278
+ X,
1246
1279
  {
1247
1280
  size: "small",
1248
1281
  withBackground: !1,
1249
1282
  withBorder: !1,
1250
- screenReaderLabel: O.editNote,
1283
+ screenReaderLabel: k.editNote,
1251
1284
  "data-testid": "note-card-edit",
1252
1285
  onClick: (p) => {
1253
1286
  p.stopPropagation(), R(!0);
1254
1287
  },
1255
- children: /* @__PURE__ */ i(ue, {})
1288
+ children: /* @__PURE__ */ i(me, {})
1256
1289
  }
1257
1290
  )
1258
- ] }) : /* @__PURE__ */ i(z, { children: /* @__PURE__ */ i(fe, { maxLines: 3, truncate: "word", children: o }) }) }) : h && c ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ b(z, { color: "secondary", children: [
1259
- O.addNotePrompt,
1291
+ ] }) : /* @__PURE__ */ i(z, { children: /* @__PURE__ */ i(he, { maxLines: 3, truncate: "word", children: o }) }) }) : g && c ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ b(z, { color: "secondary", children: [
1292
+ k.addNotePrompt,
1260
1293
  " ",
1261
1294
  /* @__PURE__ */ i(
1262
- G,
1295
+ X,
1263
1296
  {
1264
1297
  size: "small",
1265
1298
  withBackground: !1,
1266
1299
  withBorder: !1,
1267
- screenReaderLabel: O.editNote,
1300
+ screenReaderLabel: k.editNote,
1268
1301
  "data-testid": "note-card-edit",
1269
1302
  onClick: (p) => {
1270
1303
  p.stopPropagation(), R(!0);
1271
1304
  },
1272
- children: /* @__PURE__ */ i(ue, {})
1305
+ children: /* @__PURE__ */ i(me, {})
1273
1306
  }
1274
1307
  )
1275
1308
  ] }) }) : null,
1276
- /* @__PURE__ */ b(I, { justifyItems: "space-between", alignItems: "center", children: [
1277
- /* @__PURE__ */ i(z, { size: "small", color: "secondary", children: De(e, u) }),
1309
+ /* @__PURE__ */ b(v, { justifyItems: "space-between", alignItems: "center", children: [
1310
+ /* @__PURE__ */ i(z, { size: "small", color: "secondary", children: Le(e, u) }),
1278
1311
  c && l && /* @__PURE__ */ i(
1279
- G,
1312
+ X,
1280
1313
  {
1281
1314
  size: "small",
1282
1315
  withBackground: !1,
1283
1316
  withBorder: !1,
1284
1317
  color: "danger",
1285
- screenReaderLabel: O.deleteNote,
1318
+ screenReaderLabel: k.deleteNote,
1286
1319
  "data-testid": "note-card-delete",
1287
1320
  onClick: (p) => {
1288
1321
  p.stopPropagation(), L(!0);
1289
1322
  },
1290
- children: /* @__PURE__ */ i(ie, {})
1323
+ children: /* @__PURE__ */ i(le, {})
1291
1324
  }
1292
1325
  )
1293
1326
  ] }),
1294
- g && /* @__PURE__ */ i(z, { size: "small", color: "secondary", children: g })
1327
+ h && /* @__PURE__ */ i(z, { size: "small", color: "secondary", children: h })
1295
1328
  ] })
1296
1329
  ] }),
1297
1330
  W && l && /* @__PURE__ */ i(
1298
- K,
1331
+ Q,
1299
1332
  {
1300
1333
  as: "div",
1301
1334
  background: "primary",
@@ -1308,7 +1341,7 @@ const Cn = ({
1308
1341
  insetInlineEnd: "0",
1309
1342
  stacking: "above",
1310
1343
  children: /* @__PURE__ */ b(
1311
- I,
1344
+ v,
1312
1345
  {
1313
1346
  direction: "column",
1314
1347
  justifyItems: "center",
@@ -1322,12 +1355,12 @@ const Cn = ({
1322
1355
  display: "block",
1323
1356
  color: "danger",
1324
1357
  size: "small",
1325
- renderIcon: /* @__PURE__ */ i(ie, {}),
1358
+ renderIcon: /* @__PURE__ */ i(le, {}),
1326
1359
  "data-testid": "note-card-confirm-delete",
1327
1360
  onClick: (p) => {
1328
1361
  p.stopPropagation(), l(n), L(!1);
1329
1362
  },
1330
- children: O.deleteNote
1363
+ children: k.deleteNote
1331
1364
  }
1332
1365
  ),
1333
1366
  /* @__PURE__ */ i(
@@ -1339,7 +1372,7 @@ const Cn = ({
1339
1372
  onClick: (p) => {
1340
1373
  p.stopPropagation(), L(!1);
1341
1374
  },
1342
- children: O.cancel
1375
+ children: k.cancel
1343
1376
  }
1344
1377
  )
1345
1378
  ]
@@ -1351,28 +1384,28 @@ const Cn = ({
1351
1384
  }
1352
1385
  )
1353
1386
  );
1354
- return k && T ? T({ href: k, children: S, ariaLabel: y }) : S;
1387
+ return O && I ? I({ href: O, children: S, ariaLabel: y }) : S;
1355
1388
  };
1356
- function In(n, e) {
1389
+ function Tn(n, e) {
1357
1390
  const t = Array.from({ length: e }, () => []);
1358
1391
  return n.forEach((o, r) => {
1359
1392
  t[r % e].push(o);
1360
1393
  }), t;
1361
1394
  }
1362
- const Tn = {
1395
+ const xn = {
1363
1396
  display: "flex",
1364
1397
  gap: "1rem",
1365
1398
  padding: "1rem",
1366
1399
  boxSizing: "border-box",
1367
1400
  width: "100%",
1368
1401
  alignItems: "flex-start"
1369
- }, vn = {
1402
+ }, wn = {
1370
1403
  display: "flex",
1371
1404
  flexDirection: "column",
1372
1405
  gap: "1rem",
1373
1406
  flex: 1,
1374
1407
  minWidth: 0
1375
- }, Qn = ({
1408
+ }, Jn = ({
1376
1409
  notes: n,
1377
1410
  isLoading: e,
1378
1411
  isError: t,
@@ -1383,27 +1416,27 @@ const Tn = {
1383
1416
  onNoteDelete: d,
1384
1417
  onNoteSave: m,
1385
1418
  onNoteTypeChange: c,
1386
- selectedNoteId: h,
1387
- hasActiveFilter: g = !1,
1419
+ selectedNoteId: g,
1420
+ hasActiveFilter: h = !1,
1388
1421
  columnCount: u = 1,
1389
1422
  highlightTheme: E,
1390
1423
  cardTheme: f,
1391
- locale: T,
1392
- renderNoteLink: k,
1393
- noteHref: O
1424
+ locale: I,
1425
+ renderNoteLink: O,
1426
+ noteHref: k
1394
1427
  }) => {
1395
- const { translations: v } = Q(), N = ge(
1396
- () => In(n, u),
1428
+ const { translations: T } = q(), N = oe(
1429
+ () => Tn(n, u),
1397
1430
  [n, u]
1398
1431
  ), x = (o == null ? void 0 : o.hasNextPage) || (o == null ? void 0 : o.hasPreviousPage);
1399
1432
  if (e)
1400
- return /* @__PURE__ */ i(K, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ i(it, { renderTitle: v.loadingNotes }) });
1433
+ return /* @__PURE__ */ i(Q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ i(at, { renderTitle: T.loadingNotes }) });
1401
1434
  if (t)
1402
- return /* @__PURE__ */ i(K, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(le, { level: "h4", children: v.failedToLoadNotes }) });
1435
+ return /* @__PURE__ */ i(Q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(ae, { level: "h4", children: T.failedToLoadNotes }) });
1403
1436
  if (n.length === 0) {
1404
- const R = g ? v.nothingHereYet : v.emptyStateHeading, P = g ? v.adjustFiltersOrCreate : v.emptyStateDescription;
1437
+ const R = h ? T.nothingHereYet : T.emptyStateHeading, P = h ? T.adjustFiltersOrCreate : T.emptyStateDescription;
1405
1438
  return /* @__PURE__ */ b(
1406
- I,
1439
+ v,
1407
1440
  {
1408
1441
  direction: "column",
1409
1442
  alignItems: "center",
@@ -1412,67 +1445,67 @@ const Tn = {
1412
1445
  gap: "small",
1413
1446
  "data-testid": "empty-notes",
1414
1447
  children: [
1415
- /* @__PURE__ */ i(le, { level: "h3", children: R }),
1448
+ /* @__PURE__ */ i(ae, { level: "h3", children: R }),
1416
1449
  /* @__PURE__ */ i(z, { color: "secondary", children: P })
1417
1450
  ]
1418
1451
  }
1419
1452
  );
1420
1453
  }
1421
- return /* @__PURE__ */ b(Xe, { children: [
1422
- /* @__PURE__ */ i("div", { style: Tn, "data-testid": "notes-grid", children: N.map((R, P) => (
1454
+ return /* @__PURE__ */ b(Ve, { children: [
1455
+ /* @__PURE__ */ i("div", { style: xn, "data-testid": "notes-grid", children: N.map((R, P) => (
1423
1456
  // biome-ignore lint/suspicious/noArrayIndexKey: columns are positional, index is stable
1424
- /* @__PURE__ */ i("div", { style: vn, children: R.map((C) => {
1457
+ /* @__PURE__ */ i("div", { style: wn, children: R.map((C) => {
1425
1458
  var W;
1426
1459
  return /* @__PURE__ */ i(
1427
- Cn,
1460
+ In,
1428
1461
  {
1429
1462
  noteId: C.id,
1430
1463
  date: C.createdAt,
1431
1464
  type: C.reaction[0] ?? A.IMPORTANT,
1432
1465
  highlight: (W = C.highlightData) == null ? void 0 : W.selectedText,
1433
1466
  note: C.userText,
1434
- isActive: h === C.id,
1435
- isPanelView: !!h,
1467
+ isActive: g === C.id,
1468
+ isPanelView: !!g,
1436
1469
  onClick: l ? () => l(C.id) : void 0,
1437
1470
  onDelete: d ? (L) => d(L) : void 0,
1438
1471
  onSaveNote: m ? (L, D) => m(L, D) : void 0,
1439
1472
  onTypeChange: c ? (L, D) => c(L, D) : void 0,
1440
1473
  highlightTheme: E,
1441
1474
  cardTheme: f,
1442
- locale: T,
1443
- renderLink: k,
1444
- href: O ? O(C.id, C) : void 0
1475
+ locale: I,
1476
+ renderLink: O,
1477
+ href: k ? k(C.id, C) : void 0
1445
1478
  },
1446
1479
  C.id
1447
1480
  );
1448
1481
  }) }, P)
1449
1482
  )) }),
1450
- x && /* @__PURE__ */ b(I, { justifyItems: "center", gap: "small", padding: "small", "data-testid": "notes-pagination", children: [
1483
+ x && /* @__PURE__ */ b(v, { justifyItems: "center", gap: "small", padding: "small", "data-testid": "notes-pagination", children: [
1451
1484
  /* @__PURE__ */ i(
1452
- G,
1485
+ X,
1453
1486
  {
1454
1487
  size: "small",
1455
- screenReaderLabel: v.previousPage,
1488
+ screenReaderLabel: T.previousPage,
1456
1489
  "data-testid": "notes-prev-page",
1457
1490
  interaction: o != null && o.hasPreviousPage ? "enabled" : "disabled",
1458
1491
  onClick: r,
1459
- children: /* @__PURE__ */ i(et, {})
1492
+ children: /* @__PURE__ */ i(ot, {})
1460
1493
  }
1461
1494
  ),
1462
1495
  /* @__PURE__ */ i(
1463
- G,
1496
+ X,
1464
1497
  {
1465
1498
  size: "small",
1466
- screenReaderLabel: v.nextPage,
1499
+ screenReaderLabel: T.nextPage,
1467
1500
  "data-testid": "notes-next-page",
1468
1501
  interaction: o != null && o.hasNextPage ? "enabled" : "disabled",
1469
1502
  onClick: s,
1470
- children: /* @__PURE__ */ i(tt, {})
1503
+ children: /* @__PURE__ */ i(rt, {})
1471
1504
  }
1472
1505
  )
1473
1506
  ] })
1474
1507
  ] });
1475
- }, Yn = ({
1508
+ }, eo = ({
1476
1509
  noteText: n,
1477
1510
  reaction: e,
1478
1511
  highlightText: t,
@@ -1483,34 +1516,34 @@ const Tn = {
1483
1516
  onBack: d,
1484
1517
  editing: m = !1
1485
1518
  }) => {
1486
- const { translations: c } = Q(), [h, g] = H(m), [u, E] = H(n || ""), [f, T] = H(!1);
1487
- return /* @__PURE__ */ b(I, { direction: "column", gap: "small", "data-testid": "single-note", children: [
1488
- t != null ? /* @__PURE__ */ i(K, { as: "div", children: /* @__PURE__ */ i(z, { children: /* @__PURE__ */ i(me, { type: e, isCardActive: !0, theme: o, children: t }) }) }) : /* @__PURE__ */ i(Ge, {}),
1489
- /* @__PURE__ */ i(Ke, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
1490
- h ? /* @__PURE__ */ b(I, { direction: "column", gap: "x-small", children: [
1519
+ const { translations: c } = q(), [g, h] = H(m), [u, E] = H(n || ""), [f, I] = H(!1);
1520
+ return /* @__PURE__ */ b(v, { direction: "column", gap: "small", "data-testid": "single-note", children: [
1521
+ t != null ? /* @__PURE__ */ i(Q, { as: "div", children: /* @__PURE__ */ i(z, { children: /* @__PURE__ */ i(ge, { type: e, isCardActive: !0, theme: o, children: t }) }) }) : /* @__PURE__ */ i(Qe, {}),
1522
+ /* @__PURE__ */ i(Ye, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
1523
+ g ? /* @__PURE__ */ b(v, { direction: "column", gap: "x-small", children: [
1491
1524
  /* @__PURE__ */ i(
1492
- _e,
1525
+ He,
1493
1526
  {
1494
1527
  label: c.addNoteOptional,
1495
1528
  value: u,
1496
- onChange: (k) => E(k.target.value),
1529
+ onChange: (O) => E(O.target.value),
1497
1530
  resize: "vertical"
1498
1531
  }
1499
1532
  ),
1500
- /* @__PURE__ */ b(I, { gap: "xx-small", children: [
1501
- /* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1533
+ /* @__PURE__ */ b(v, { gap: "xx-small", children: [
1534
+ /* @__PURE__ */ i(v.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1502
1535
  U,
1503
1536
  {
1504
1537
  display: "block",
1505
1538
  size: "small",
1506
1539
  "data-testid": "single-note-cancel",
1507
1540
  onClick: () => {
1508
- E(n || ""), g(!1);
1541
+ E(n || ""), h(!1);
1509
1542
  },
1510
1543
  children: c.cancel
1511
1544
  }
1512
1545
  ) }),
1513
- /* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1546
+ /* @__PURE__ */ i(v.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1514
1547
  U,
1515
1548
  {
1516
1549
  display: "block",
@@ -1518,31 +1551,31 @@ const Tn = {
1518
1551
  size: "small",
1519
1552
  "data-testid": "single-note-save",
1520
1553
  onClick: () => {
1521
- r(u), g(!1);
1554
+ r(u), h(!1);
1522
1555
  },
1523
1556
  children: c.save
1524
1557
  }
1525
1558
  ) })
1526
1559
  ] })
1527
- ] }) : /* @__PURE__ */ b(I, { direction: "column", gap: "small", children: [
1528
- n && /* @__PURE__ */ b(K, { as: "div", children: [
1529
- /* @__PURE__ */ i(le, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
1560
+ ] }) : /* @__PURE__ */ b(v, { direction: "column", gap: "small", children: [
1561
+ n && /* @__PURE__ */ b(Q, { as: "div", children: [
1562
+ /* @__PURE__ */ i(ae, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
1530
1563
  /* @__PURE__ */ i(z, { children: n })
1531
1564
  ] }),
1532
- /* @__PURE__ */ b(I, { justifyItems: "space-between", children: [
1565
+ /* @__PURE__ */ b(v, { justifyItems: "space-between", children: [
1533
1566
  /* @__PURE__ */ i(
1534
1567
  U,
1535
1568
  {
1536
1569
  size: "small",
1537
- renderIcon: /* @__PURE__ */ i(nt, {}),
1570
+ renderIcon: /* @__PURE__ */ i(st, {}),
1538
1571
  "data-testid": "single-note-back",
1539
1572
  onClick: () => d == null ? void 0 : d(),
1540
1573
  children: c.back
1541
1574
  }
1542
1575
  ),
1543
- /* @__PURE__ */ b(I, { gap: "xx-small", children: [
1576
+ /* @__PURE__ */ b(v, { gap: "xx-small", children: [
1544
1577
  s && /* @__PURE__ */ i(
1545
- G,
1578
+ X,
1546
1579
  {
1547
1580
  size: "small",
1548
1581
  withBackground: !1,
@@ -1550,35 +1583,35 @@ const Tn = {
1550
1583
  color: "danger",
1551
1584
  screenReaderLabel: c.deleteNote,
1552
1585
  "data-testid": "single-note-delete",
1553
- onClick: () => T(!0),
1554
- children: /* @__PURE__ */ i(ie, {})
1586
+ onClick: () => I(!0),
1587
+ children: /* @__PURE__ */ i(le, {})
1555
1588
  }
1556
1589
  ),
1557
1590
  /* @__PURE__ */ i(
1558
- G,
1591
+ X,
1559
1592
  {
1560
1593
  size: "small",
1561
1594
  withBackground: !1,
1562
1595
  withBorder: !1,
1563
1596
  screenReaderLabel: c.editNote,
1564
1597
  "data-testid": "single-note-edit",
1565
- onClick: () => g(!0),
1566
- children: /* @__PURE__ */ i(ue, {})
1598
+ onClick: () => h(!0),
1599
+ children: /* @__PURE__ */ i(me, {})
1567
1600
  }
1568
1601
  )
1569
1602
  ] })
1570
1603
  ] }),
1571
- f && s && /* @__PURE__ */ i(K, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ b(I, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
1604
+ f && s && /* @__PURE__ */ i(Q, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ b(v, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
1572
1605
  /* @__PURE__ */ i(
1573
1606
  U,
1574
1607
  {
1575
1608
  display: "block",
1576
1609
  color: "danger",
1577
1610
  size: "small",
1578
- renderIcon: /* @__PURE__ */ i(ie, {}),
1611
+ renderIcon: /* @__PURE__ */ i(le, {}),
1579
1612
  "data-testid": "single-note-confirm-delete",
1580
1613
  onClick: () => {
1581
- s(), T(!1);
1614
+ s(), I(!1);
1582
1615
  },
1583
1616
  children: c.deleteNote
1584
1617
  }
@@ -1589,7 +1622,7 @@ const Tn = {
1589
1622
  display: "block",
1590
1623
  size: "small",
1591
1624
  "data-testid": "single-note-cancel-delete",
1592
- onClick: () => T(!1),
1625
+ onClick: () => I(!1),
1593
1626
  children: c.cancel
1594
1627
  }
1595
1628
  )
@@ -1598,24 +1631,25 @@ const Tn = {
1598
1631
  ] });
1599
1632
  };
1600
1633
  export {
1601
- Gn as ContentWithNoteWrapper,
1602
- me as Highlight,
1603
- Ge as HighlightError,
1604
- Cn as NoteCard,
1605
- Ke as NoteChip,
1606
- Nn as NoteReactionMenu,
1607
- qn as NotebookProvider,
1608
- gn as NotebookTranslationsProvider,
1609
- Xn as NotebookTray,
1610
- Qn as NotesListView,
1634
+ Qn as ContentWithNoteWrapper,
1635
+ ge as Highlight,
1636
+ Qe as HighlightError,
1637
+ In as NoteCard,
1638
+ Ye as NoteChip,
1639
+ bn as NoteReactionMenu,
1640
+ Xn as NotebookProvider,
1641
+ pn as NotebookTranslationsProvider,
1642
+ Zn as NotebookTray,
1643
+ Jn as NotesListView,
1611
1644
  A as REACTION_TYPE,
1612
- Yn as SingleNote,
1613
- ce as createTransparentColor,
1614
- Ot as useCreateNote,
1615
- Rt as useDeleteNote,
1616
- je as useGetNotes,
1617
- qe as useNotebook,
1618
- Q as useNotebookTranslations,
1619
- Kn as useNotesData,
1620
- Dt as useUpdateNote
1645
+ eo as SingleNote,
1646
+ de as createTransparentColor,
1647
+ Dt as useCreateNote,
1648
+ At as useDeleteNote,
1649
+ $e as useGetNotes,
1650
+ Xe as useNotebook,
1651
+ q as useNotebookTranslations,
1652
+ Yn as useNotesData,
1653
+ Vn as useReactionFilter,
1654
+ Lt as useUpdateNote
1621
1655
  };