@instructure/platform-notebook 1.10.1 → 1.10.3

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