@instructure/platform-notebook 1.2.0 → 1.3.1

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