@instructure/platform-notebook 0.4.1 → 0.5.0

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