@instructure/platform-notebook 1.13.0 → 2.0.1

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