@instructure/platform-notebook 1.10.0 → 1.10.2

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