@alfadocs/ui-kit 1.148.0 → 1.149.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.
Files changed (90) hide show
  1. package/dist/_chunks/{calendar-appointment-editor-dialog-Cz8F2H4M.js → calendar-appointment-editor-dialog-fQleWmJE.js} +5 -5
  2. package/dist/_chunks/{calendar-waiting-list-panel-C4T85b4q.js → calendar-waiting-list-panel-BKBHfBpn.js} +2 -2
  3. package/dist/_chunks/{calendar.sheets-DsgPdycU.js → calendar.sheets-lgAqJB34.js} +2 -2
  4. package/dist/_chunks/notes-panel-Cw06dLDm.js +1135 -0
  5. package/dist/_chunks/rich-text-editor-eGdYDPK2.js +4405 -0
  6. package/dist/_chunks/task-editor-C-4I2sBa.js +1162 -0
  7. package/dist/_chunks/{tasks-panel-DufAoAxG.js → tasks-panel-BDPQPOP6.js} +475 -461
  8. package/dist/_chunks/{use-appointment-details-read-kYp-gfhb.js → use-appointment-details-read-Bl1DHXQ2.js} +568 -554
  9. package/dist/agent-catalog.json +9 -7
  10. package/dist/agent-i18n/en.json +4 -4
  11. package/dist/appointment-editor-panel/index.js +1 -1
  12. package/dist/aws-transcribe/index.js +287 -181
  13. package/dist/browser-support.js +1 -1
  14. package/dist/components/_shared/save-outcome.d.ts +23 -0
  15. package/dist/components/appointment-details-panel/index.js +1 -1
  16. package/dist/components/index.d.ts +1 -0
  17. package/dist/components/notes-panel/index.js +1 -1
  18. package/dist/components/rich-text-editor/help-me-write-overlay.d.ts +12 -1
  19. package/dist/components/rich-text-editor/index.js +1 -1
  20. package/dist/components/rich-text-editor/rich-text-editor.d.ts +5 -3
  21. package/dist/components/task-editor/index.js +1 -1
  22. package/dist/components/task-editor/use-task-editor-form.d.ts +7 -1
  23. package/dist/components/tasks-panel/index.js +1 -1
  24. package/dist/core.css +1 -1
  25. package/dist/find-free-slots-panel/index.js +1 -1
  26. package/dist/i18n/locales/ar.d.ts +1 -0
  27. package/dist/i18n/locales/ar.js +2 -1
  28. package/dist/i18n/locales/de.d.ts +1 -0
  29. package/dist/i18n/locales/de.js +2 -1
  30. package/dist/i18n/locales/el.d.ts +1 -0
  31. package/dist/i18n/locales/el.js +2 -1
  32. package/dist/i18n/locales/en.d.ts +1 -0
  33. package/dist/i18n/locales/en.js +2 -1
  34. package/dist/i18n/locales/es.d.ts +1 -0
  35. package/dist/i18n/locales/es.js +2 -1
  36. package/dist/i18n/locales/fr.d.ts +1 -0
  37. package/dist/i18n/locales/fr.js +2 -1
  38. package/dist/i18n/locales/hi.d.ts +1 -0
  39. package/dist/i18n/locales/hi.js +2 -1
  40. package/dist/i18n/locales/it.d.ts +1 -0
  41. package/dist/i18n/locales/it.js +2 -1
  42. package/dist/i18n/locales/ja.d.ts +1 -0
  43. package/dist/i18n/locales/ja.js +2 -1
  44. package/dist/i18n/locales/nl.d.ts +1 -0
  45. package/dist/i18n/locales/nl.js +2 -1
  46. package/dist/i18n/locales/pl.d.ts +1 -0
  47. package/dist/i18n/locales/pl.js +2 -1
  48. package/dist/i18n/locales/pt.d.ts +1 -0
  49. package/dist/i18n/locales/pt.js +2 -1
  50. package/dist/i18n/locales/ro.d.ts +1 -0
  51. package/dist/i18n/locales/ro.js +2 -1
  52. package/dist/i18n/locales/ru.d.ts +1 -0
  53. package/dist/i18n/locales/ru.js +2 -1
  54. package/dist/i18n/locales/sq.d.ts +1 -0
  55. package/dist/i18n/locales/sq.js +2 -1
  56. package/dist/i18n/locales/sv.d.ts +1 -0
  57. package/dist/i18n/locales/sv.js +2 -1
  58. package/dist/i18n/locales/tr.d.ts +1 -0
  59. package/dist/i18n/locales/tr.js +2 -1
  60. package/dist/i18n/locales/zh.d.ts +1 -0
  61. package/dist/i18n/locales/zh.js +2 -1
  62. package/dist/index.js +1407 -1403
  63. package/dist/locales/ar.json +2 -1
  64. package/dist/locales/de.json +2 -1
  65. package/dist/locales/el.json +2 -1
  66. package/dist/locales/en.json +2 -1
  67. package/dist/locales/es.json +2 -1
  68. package/dist/locales/fr.json +2 -1
  69. package/dist/locales/hi.json +2 -1
  70. package/dist/locales/it.json +2 -1
  71. package/dist/locales/ja.json +2 -1
  72. package/dist/locales/nl.json +2 -1
  73. package/dist/locales/pl.json +2 -1
  74. package/dist/locales/pt.json +2 -1
  75. package/dist/locales/ro.json +2 -1
  76. package/dist/locales/ru.json +2 -1
  77. package/dist/locales/sq.json +2 -1
  78. package/dist/locales/sv.json +2 -1
  79. package/dist/locales/tr.json +2 -1
  80. package/dist/locales/zh.json +2 -1
  81. package/dist/online-bookings-panel/index.js +1 -1
  82. package/dist/patterns/calendar/index.js +2 -2
  83. package/dist/save-outcome/index.js +20 -0
  84. package/dist/speech/aws-transcribe.d.ts +30 -6
  85. package/dist/tokens.css +1 -1
  86. package/dist/waiting-list-panel/index.js +2 -2
  87. package/package.json +5 -1
  88. package/dist/_chunks/notes-panel-BHMnLbEH.js +0 -1116
  89. package/dist/_chunks/rich-text-editor-BAcJq1PO.js +0 -4359
  90. package/dist/_chunks/task-editor-B9YpfwcW.js +0 -1095
@@ -1,1116 +0,0 @@
1
- import { jsxs as b, jsx as i, Fragment as qn } from "react/jsx-runtime";
2
- import { forwardRef as _n, useRef as u, useState as x, useId as Dn, useEffect as C, useCallback as W, useMemo as mt, useImperativeHandle as kn } from "react";
3
- import { c as Rt } from "./index-D2ZczOXr.js";
4
- import { useTranslation as zn } from "react-i18next";
5
- import { g as vt } from "./get-error-message-DbFUzuja.js";
6
- import { h as Nt } from "./handled-rejection-C-6Dq0As.js";
7
- import { u as Hn } from "./registry-DvAUVLHh.js";
8
- import { C as Mn } from "./clinical-note-card-D-9xmRpf.js";
9
- import { R as Wn } from "./rich-text-editor-BAcJq1PO.js";
10
- import { T as $n } from "./text-area-COMVJ1yE.js";
11
- import { A as L } from "./alert-C4WKViaS.js";
12
- import { B as ne } from "./button-Dp4j9ygh.js";
13
- import { I as yt } from "./icon-button-u9VMQn3x.js";
14
- import { S as Bn } from "./switch-DO6uC4HJ.js";
15
- import { T as Kn } from "./tooltip-uEBdD1-5.js";
16
- import { C as bt } from "./card-n6W6LW-N.js";
17
- import { C as In, S as ye } from "./skeleton-tTWJpvAq.js";
18
- import { D as q } from "./dialog-239Geb7Z.js";
19
- import { P as Yn } from "./panel-header-CbtlTe85.js";
20
- import { a as Gn, u as Jn, R as Qn } from "./use-list-reflow-C7O4Uqnl.js";
21
- import { u as Un } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
22
- import { u as Xn } from "./use-resolved-theme-B0f1_oyq.js";
23
- import { N as Zn } from "./notebook-pen-CO7HoM-W.js";
24
- import { P as er } from "./pencil-B1sKKyuT.js";
25
- import { T as tr } from "./trash-2-uumy3fy1.js";
26
- const nr = {
27
- id: "notes-panel",
28
- // 'submit' backs add_note (compose + commit a note). pin / flag are toggles
29
- // with no dedicated capability in the closed vocabulary.
30
- capabilities: ["submit"],
31
- state: {
32
- notes: {
33
- type: "Array<{ id?: string; pinned: boolean; flagged: boolean; clinical: boolean; deleted: boolean }>",
34
- descriptionKey: "ui.agent.notesPanel.state.notes",
35
- description: "Timeline note ids + pinned / flagged / clinical / deleted flags. Never the note body or author (both PHI). A note whose delete is in flight is left out; a pin or flag in flight is reported with its new value. A deleted note takes no pin or flag.",
36
- read: (o) => o.getNotes()
37
- },
38
- canAddClinical: {
39
- type: "boolean",
40
- descriptionKey: "ui.agent.notesPanel.state.canAddClinical",
41
- description: "Whether the current user may write clinical notes (the practice_add_clinical_note permission gate).",
42
- read: (o) => o.canAddClinical()
43
- },
44
- currentNoteId: {
45
- type: "string | null",
46
- descriptionKey: "ui.agent.notesPanel.state.currentNoteId",
47
- description: "Id of the note the host has addressed — the one marked, scrolled to and focused. Null when none is. An id only, never note content.",
48
- read: (o) => o.getCurrentNoteId()
49
- }
50
- },
51
- actions: {
52
- add_note: {
53
- // Writes a clinical/admin note body — patient-identifiable content. PHI.
54
- safety: "phi",
55
- argsType: "{ content: string; clinical: boolean }",
56
- argsSchema: {
57
- type: "object",
58
- properties: {
59
- content: {
60
- type: "string",
61
- description: "Note body. Rich HTML for the rich composer, else plain text."
62
- },
63
- clinical: {
64
- type: "boolean",
65
- description: "Whether the note is clinical. Requires the clinical-note permission; the submission is dropped when the gate is closed."
66
- }
67
- },
68
- required: ["content", "clinical"]
69
- },
70
- openWorld: !0,
71
- descriptionKey: "ui.agent.notesPanel.actions.addNote",
72
- description: "Compose and commit a new note. A clinical note requires the clinical-note permission (read canAddClinical first).",
73
- examples: [
74
- {
75
- args: { content: "Patient reported improvement.", clinical: !0 },
76
- note: "Add a clinical note."
77
- }
78
- ],
79
- invoke: (o, f) => o.addNote(f)
80
- },
81
- toggle_pin: {
82
- // A host write; it re-orders the timeline (pinned notes lead).
83
- safety: "write",
84
- argsType: "{ id: string }",
85
- argsSchema: {
86
- type: "object",
87
- properties: { id: { type: "string" } },
88
- required: ["id"]
89
- },
90
- idempotent: !1,
91
- // Reaches the host's data source; the result is the host's promise.
92
- openWorld: !0,
93
- errors: [
94
- "The panel offers no pin here: no onTogglePin, no note with this id, a deleted note, or actions.pin is false.",
95
- "A pin or delete for this note is still pending. Read notes again once it has settled.",
96
- "The host refused the change. The pin is restored and the panel shows the host's message."
97
- ],
98
- descriptionKey: "ui.agent.notesPanel.actions.togglePin",
99
- description: "Toggle the pinned state of the note with the given id. Returns the host's promise; a refusal restores the pin and the panel shows the host's message. Rejects without reaching the host when the panel refuses: a deleted note, actions.pin false, or a write for the note still pending.",
100
- invoke: (o, f) => o.togglePin(f.id)
101
- },
102
- toggle_flag: {
103
- safety: "write",
104
- argsType: "{ id: string }",
105
- argsSchema: {
106
- type: "object",
107
- properties: { id: { type: "string" } },
108
- required: ["id"]
109
- },
110
- idempotent: !1,
111
- // Reaches the host's data source; the result is the host's promise.
112
- openWorld: !0,
113
- errors: [
114
- "The panel offers no flag here: no onToggleFlag, no note with this id, a deleted note, or actions.flag is false.",
115
- "A flag or delete for this note is still pending. Read notes again once it has settled.",
116
- "The host refused the change. The flag is restored and the panel shows the host's message."
117
- ],
118
- descriptionKey: "ui.agent.notesPanel.actions.toggleFlag",
119
- description: "Toggle the flagged state of the note with the given id. Returns the host's promise; a refusal restores the flag and the panel shows the host's message. Rejects without reaching the host when the panel refuses: a deleted note, actions.flag false, or a write for the note still pending.",
120
- invoke: (o, f) => o.toggleFlag(f.id)
121
- }
122
- },
123
- domHooks: {
124
- root: {
125
- attr: "data-component",
126
- value: "notes-panel",
127
- description: "Marks the NotesPanel region."
128
- },
129
- instanceId: {
130
- attr: "data-component-id",
131
- sourceProp: "id",
132
- description: "Sourced from the id prop. Required to address a specific notes panel from the agent."
133
- },
134
- item: {
135
- attr: "data-note-id",
136
- description: "Stable note id on each rendered note row. Row controls carry data-note-action: edit, delete, pin or flag."
137
- }
138
- }
139
- }, rr = "ds:isolate ds:[&_[data-component=card]>*]:relative ds:[&_[data-component=card]>*]:z-[1]", sr = Rt(
140
- "ds:relative ds:flex ds:flex-col ds:rounded-[var(--radius-lg)]",
141
- {
142
- variants: {
143
- current: {
144
- true: "ds:focus:outline-[length:var(--focus-ring-width)] ds:focus:outline-solid ds:focus:outline-[color:var(--ring)] ds:focus:outline-offset-[length:var(--focus-ring-offset)]",
145
- false: ""
146
- },
147
- washed: { true: rr, false: "" }
148
- },
149
- defaultVariants: { current: !1, washed: !1 }
150
- }
151
- ), wt = Rt(
152
- "ds:pointer-events-none ds:absolute ds:inset-0 ds:rounded-[var(--radius-lg)] ds:bg-[color:var(--accent)]",
153
- {
154
- variants: {
155
- state: {
156
- addressed: [
157
- // At rest the wash is clear; the accessible themes hold it at 12%
158
- // instead of playing it (--accessible-on is 1 there).
159
- "ds:opacity-[calc(var(--opacity-12)*var(--accessible-on,0))]",
160
- "ds:animate-[var(--accessible-off,note-addressed_calc(var(--animation-duration)*9)_var(--ease-in-out))]",
161
- "ds:motion-reduce:animate-none ds:motion-reduce:opacity-[var(--opacity-12)]"
162
- ].join(" "),
163
- editing: "ds:opacity-[var(--opacity-12)]"
164
- }
165
- }
166
- }
167
- ), At = [
168
- "ds:rounded-[var(--radius-lg)] ds:outline-none",
169
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
170
- "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
171
- ].join(" "), ir = ["ds:flex ds:flex-col", At].join(" "), lr = "ds:opacity-0", ar = [
172
- "ds:transition-opacity ds:duration-[var(--animation-duration)]",
173
- "ds:ease-[var(--ease-out)] ds:motion-reduce:transition-none"
174
- ].join(" "), or = [3, 2, 3];
175
- function Pt(o) {
176
- return o ? /<img\b/i.test(o) ? !0 : o.replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, " ").trim().length > 0 : !1;
177
- }
178
- function Tt(o, f, y) {
179
- const p = o == null ? void 0 : o.toggle(f, y), m = p ? p.refusal : "the panel is not mounted";
180
- return m === void 0 ? p == null ? void 0 : p.result : Nt(new Error(`NotesPanel: ${y} refused (${m}).`));
181
- }
182
- const xt = /* @__PURE__ */ new Map(), Ct = /* @__PURE__ */ new Set();
183
- function be(o) {
184
- return o.map(
185
- (f) => `${f.id ?? ""}:${f.pinned ? 1 : 0}${f.flagged ? 1 : 0}${f.deleted ? 1 : 0}`
186
- ).join("|");
187
- }
188
- function St(o) {
189
- return typeof (o == null ? void 0 : o.then) == "function";
190
- }
191
- function Et(o, f, y) {
192
- const p = o.indexOf(y);
193
- if (p >= 0) return p;
194
- const m = f.indexOf(y);
195
- if (m < 0) return -1;
196
- const re = new Set(o);
197
- return f.slice(0, m).filter((S) => re.has(S)).length;
198
- }
199
- function dr(o) {
200
- if (o.hasAttribute("tabindex")) {
201
- o.focus();
202
- return;
203
- }
204
- const f = () => o.removeAttribute("tabindex");
205
- o.setAttribute("tabindex", "-1"), o.focus(), document.activeElement === o ? o.addEventListener("blur", f, { once: !0 }) : f();
206
- }
207
- const qr = _n(
208
- function({
209
- id: f,
210
- notes: y,
211
- onAddNote: p,
212
- status: m = "ready",
213
- onRetry: re,
214
- currentNoteId: S,
215
- currentNoteKey: _e,
216
- composer: A = "rich",
217
- editorToolbar: Ft = "standard",
218
- redactor: Vt,
219
- imageUploadUrl: Ot,
220
- showClinicalToggle: jt = !0,
221
- canAddClinicalNote: se = !0,
222
- clinicalGatedReason: Lt,
223
- defaultClinical: $ = !1,
224
- onRequestAiDraft: qt,
225
- aiDraftFormat: _t,
226
- aiPrivacyNotice: Dt,
227
- onDictate: kt,
228
- onProofread: zt,
229
- onAutoFormat: Ht,
230
- aiConsent: Mt,
231
- variables: Wt,
232
- validateVariable: $t,
233
- onVariableValidityChange: Bt,
234
- renderHelpMeWrite: Kt,
235
- aiTemplates: It,
236
- onAiApplied: Yt,
237
- onUploadImage: Gt,
238
- onAiCreditsExhausted: Jt,
239
- showExtensions: Qt,
240
- aiCreditsNotice: Ut,
241
- extensions: Xt,
242
- extensionContext: Zt,
243
- onExtensionRun: en,
244
- composerBefore: tn,
245
- composerAfter: nn,
246
- onTogglePin: De,
247
- onToggleFlag: ke,
248
- noteActions: ze,
249
- onEditNote: B,
250
- editClinical: rn = !1,
251
- onDeleteNote: K,
252
- onWriteError: He,
253
- confirmDelete: Me = !0,
254
- title: sn,
255
- composerPlaceholder: ln,
256
- addNoteLabel: an,
257
- emptyState: on,
258
- className: dn,
259
- "aria-label": we,
260
- ...cn
261
- }, un) {
262
- var pt;
263
- const { t: a, i18n: We } = zn("ui"), _ = u(null), [k, I] = x(""), [ie, le] = x($), [P, $e] = x(!1), [Be, ae] = x(null), [g, Pe] = x(null), Ke = u(g);
264
- Ke.current = g;
265
- const Ie = u(!1);
266
- m === "loading" && (Ie.current = !0);
267
- const fn = Ie.current ? In : "", gn = sn ?? a("notesPanel.title", { defaultValue: "Notes" }), Ye = Dn(), Ge = ln ?? a("notesPanel.placeholder", { defaultValue: "Add a note…" }), Je = g !== null ? a("notesPanel.edit", { defaultValue: "Edit note" }) : a("notesPanel.composerLabel", { defaultValue: "New note" }), hn = A === "rich" ? Pt(k) : k.trim().length > 0, E = u(y);
268
- E.current = y;
269
- const [Y, pn] = x(xt), R = u(xt), [mn, vn] = x(Ct), G = u(Ct), F = u(!0);
270
- C(() => (F.current = !0, () => {
271
- F.current = !1;
272
- }), []);
273
- const V = u(null), D = u(He);
274
- D.current = He;
275
- const Te = W(() => {
276
- const e = V.current;
277
- return !F.current || !e || e.closest('[hidden],[inert],[aria-hidden="true"]') ? !1 : typeof e.checkVisibility == "function" ? e.checkVisibility() : !0;
278
- }, []), J = u([]), [yn, bn] = x(0), xe = W((e) => {
279
- if (!F.current) {
280
- e(!1);
281
- return;
282
- }
283
- J.current.push(e), bn((t) => t + 1);
284
- }, []);
285
- C(() => {
286
- const e = J.current;
287
- J.current = [], e.forEach((t) => t(!0));
288
- }, [yn]), C(
289
- () => () => {
290
- const e = J.current;
291
- J.current = [], e.forEach((t) => t(!1));
292
- },
293
- []
294
- );
295
- const Qe = (e) => {
296
- const t = new Map(R.current);
297
- e(t), R.current = t, pn(t);
298
- }, Ce = (e) => {
299
- const t = new Set(G.current);
300
- e(t), G.current = t, vn(t);
301
- }, oe = (e, t) => {
302
- var n;
303
- return (n = R.current.get(e)) == null ? void 0 : n[t];
304
- }, Q = (e, t, n) => Qe((l) => {
305
- const s = { ...l.get(e) };
306
- n ? s[t] = n : delete s[t], Object.keys(s).length > 0 ? l.set(e, s) : l.delete(e);
307
- }), Ue = (e) => {
308
- var t;
309
- return e != null && !!((t = R.current.get(e)) != null && t.delete);
310
- }, wn = W(() => {
311
- var h;
312
- if (!(g !== null ? B : p) || P) return;
313
- const t = A === "rich", n = t ? ((h = _.current) == null ? void 0 : h.getHTML()) ?? k : k.trim();
314
- if (t ? !Pt(n) : !n) return;
315
- const l = () => {
316
- var c;
317
- t && ((c = _.current) == null || c.clear()), I(""), le($), Pe(null);
318
- };
319
- ae(null);
320
- const s = g, r = (c) => xe((v) => {
321
- var N;
322
- const T = v && (s === null || Ke.current === s && E.current.some((te) => te.id === s && !te.deleted));
323
- T && ae(vt(c, a("notesPanel.addFailed"))), (N = D.current) == null || N.call(D, {
324
- kind: s !== null ? "edit" : "add",
325
- noteId: s ?? void 0,
326
- error: c,
327
- shown: T && Te()
328
- });
329
- });
330
- let d;
331
- try {
332
- d = g !== null && B ? B(g, { content: n, clinical: ie }) : p == null ? void 0 : p({ content: n, clinical: ie });
333
- } catch (c) {
334
- r(c);
335
- return;
336
- }
337
- if (!d || typeof d.then != "function") return l();
338
- $e(!0), Promise.resolve(d).then(l, r).finally(() => $e(!1));
339
- }, [
340
- A,
341
- k,
342
- ie,
343
- $,
344
- g,
345
- xe,
346
- p,
347
- B,
348
- Te,
349
- P,
350
- a
351
- ]), Xe = jt && (g === null || rn), Pn = g !== null && !!((pt = Y.get(g)) != null && pt.delete), de = W(
352
- (e) => {
353
- try {
354
- return new Intl.DateTimeFormat(We.language, {
355
- day: "numeric",
356
- month: "long",
357
- year: "numeric",
358
- hour: "2-digit",
359
- minute: "2-digit"
360
- }).format(new Date(e.dateIso));
361
- } catch {
362
- return e.dateIso;
363
- }
364
- },
365
- [We.language]
366
- ), Tn = W(
367
- (e) => {
368
- var n, l, s, r;
369
- if (!e.id || P || (n = R.current.get(e.id)) != null && n.delete) return;
370
- const t = e.content ?? "";
371
- ae(null), Pe(e.id), le(e.clinical ?? !1), I(t), A === "rich" && ((l = _.current) == null || l.clear(), (s = _.current) == null || s.insertAtCursor(t, { asHtml: !0 })), (r = _.current) == null || r.focus();
372
- },
373
- [A, P]
374
- ), ce = W(() => {
375
- var e;
376
- A === "rich" && ((e = _.current) == null || e.clear()), I(""), le($), ae(null), Pe(null);
377
- }, [A, $]), Ze = g === null || y.some((e) => e.id === g && !e.deleted);
378
- C(() => {
379
- Ze || ce();
380
- }, [Ze, ce]);
381
- const Se = (e) => {
382
- var t, n;
383
- return (e.id ? (n = (t = Y.get(e.id)) == null ? void 0 : t.pin) == null ? void 0 : n.next : void 0) ?? !!e.pinned;
384
- }, xn = (e) => {
385
- var t, n;
386
- return (e.id ? (n = (t = Y.get(e.id)) == null ? void 0 : t.flag) == null ? void 0 : n.next : void 0) ?? !!e.flagged;
387
- }, z = y.filter((e) => !e.id || !mn.has(e.id)).sort((e, t) => Number(Se(t)) - Number(Se(e))), et = z.flatMap((e) => e.id ? [e.id] : []), H = u([]);
388
- H.current = et.filter(
389
- (e) => {
390
- var t;
391
- return !((t = Y.get(e)) != null && t.delete);
392
- }
393
- );
394
- const Ee = u([]);
395
- Ee.current = et;
396
- const { isAccessible: Cn } = Xn(V), tt = Cn || void 0, { containerRef: Sn } = Gn({
397
- key: z.map((e) => e.id).join(),
398
- reduceMotion: tt
399
- }), ue = Jn({ reduceMotion: tt }), [w, fe] = x(null), nt = u(0), Re = u(0), rt = () => {
400
- Re.current += 1, fe(null);
401
- }, ge = (e, t, n, l = !0) => {
402
- const s = Re.current;
403
- xe((r) => {
404
- var h;
405
- const d = r && l && s === Re.current && Te() && E.current.some((c) => c.id === t) && (e === "delete" || !Ue(t) && !G.current.has(t));
406
- d && (nt.current += 1, fe({
407
- kind: e,
408
- noteId: t,
409
- message: vt(n, ""),
410
- seq: nt.current
411
- })), (h = D.current) == null || h.call(D, { kind: e, noteId: t, error: n, shown: d });
412
- });
413
- }, En = (e) => {
414
- const t = y.find((l) => l.id === e.noteId), n = t != null && t.dateIso ? de(t) : "";
415
- if (n)
416
- switch (e.kind) {
417
- case "delete":
418
- return a("notesPanel.deleteFailedNamed", { date: n });
419
- case "pin":
420
- return a("notesPanel.pinFailedNamed", { date: n });
421
- case "unpin":
422
- return a("notesPanel.unpinFailedNamed", { date: n });
423
- case "flag":
424
- return a("notesPanel.flagFailedNamed", { date: n });
425
- default:
426
- return a("notesPanel.unflagFailedNamed", { date: n });
427
- }
428
- switch (e.kind) {
429
- case "delete":
430
- return a("notesPanel.deleteFailed");
431
- case "pin":
432
- return a("notesPanel.pinFailed");
433
- case "unpin":
434
- return a("notesPanel.unpinFailed");
435
- case "flag":
436
- return a("notesPanel.flagFailed");
437
- default:
438
- return a("notesPanel.unflagFailed");
439
- }
440
- }, he = w !== null && y.some((e) => e.id === w.noteId), st = u(null);
441
- w && he && (st.current = w), C(() => {
442
- w && !he && fe(null);
443
- }, [w, he]);
444
- const [Ne, it] = x({ text: "", seq: 0 }), Ae = u(void 0), lt = (e) => {
445
- it((t) => ({ text: e, seq: t.seq + 1 })), window.clearTimeout(Ae.current), Ae.current = window.setTimeout(
446
- () => it((t) => ({ ...t, text: "" })),
447
- 1e3
448
- );
449
- };
450
- C(() => () => window.clearTimeout(Ae.current), []);
451
- const at = () => lt(a("notesPanel.deleted")), pe = u(0), ot = u(m);
452
- C(() => {
453
- ot.current === "loading" && m === "ready" && (pe.current += 1), ot.current = m;
454
- }, [m]);
455
- const dt = () => {
456
- const e = E.current, t = be(e), n = new Map(e.map((r) => [r.id, r])), l = [];
457
- if (R.current.forEach((r, d) => {
458
- const h = n.get(d);
459
- Object.keys(r).forEach((c) => {
460
- const v = r[c];
461
- if (!v) return;
462
- if (!h) {
463
- l.push([d, c]);
464
- return;
465
- }
466
- if (!v.settled) return;
467
- const T = c === "delete" ? h.deleted === !0 : (c === "pin" ? !!h.pinned : !!h.flagged) === v.next, N = pe.current > v.edgeAtSettle || c !== "delete" && t !== v.sigAtSettle;
468
- (T || N) && l.push([d, c]);
469
- });
470
- }), l.length === 0) return;
471
- Qe(
472
- (r) => l.forEach(([d, h]) => {
473
- const c = { ...r.get(d) };
474
- delete c[h], Object.keys(c).length > 0 ? r.set(d, c) : r.delete(d);
475
- })
476
- );
477
- const s = l.filter(([, r]) => r === "delete").map(([r]) => r);
478
- s.some((r) => G.current.has(r)) && Ce((r) => s.forEach((d) => r.delete(d))), s.forEach((r) => ue.cancel(r));
479
- }, ct = (e, t, n) => {
480
- oe(e, t) === n && (Q(e, t, {
481
- ...n,
482
- settled: !0,
483
- edgeAtSettle: pe.current,
484
- sigAtSettle: be(E.current)
485
- }), dt());
486
- }, ut = (e, t, n) => oe(e, t) !== n ? !1 : (Q(e, t, void 0), t !== "delete" || (G.current.has(e) && Ce((l) => l.delete(e)), ue.cancel(e)), !0), Rn = mt(() => be(y), [y]);
487
- C(() => {
488
- dt();
489
- }, [Rn, m]);
490
- const Fe = (e, t) => {
491
- var N, te;
492
- const n = t === "pin" ? De : ke, l = (j) => ({
493
- started: !1,
494
- refusal: j
495
- });
496
- if (!n)
497
- return l(t === "pin" ? "no onTogglePin" : "no onToggleFlag");
498
- const s = E.current.find((j) => j.id === e);
499
- if (!s) return l("no note has this id");
500
- if (s.deleted) return l("the note is deleted");
501
- if (t === "pin" && ((N = s.actions) == null ? void 0 : N.pin) === !1)
502
- return l("actions.pin is false for this note");
503
- if (t === "flag" && ((te = s.actions) == null ? void 0 : te.flag) === !1)
504
- return l("actions.flag is false for this note");
505
- const r = R.current.get(e);
506
- if (r != null && r.delete) return l("the note is being deleted");
507
- if (r != null && r[t])
508
- return l(`a ${t} write for this note is still pending`);
509
- const d = !(t === "pin" ? s.pinned : s.flagged), h = t === "pin" ? d ? "pin" : "unpin" : d ? "flag" : "unflag";
510
- rt();
511
- let c;
512
- try {
513
- c = n(e, d);
514
- } catch (j) {
515
- return ge(h, e, j), { started: !1, result: Nt(j) };
516
- }
517
- if (!St(c)) return { started: !0, result: c };
518
- const v = {
519
- next: d,
520
- settled: !1,
521
- edgeAtSettle: 0,
522
- sigAtSettle: ""
523
- };
524
- Q(e, t, v);
525
- const T = Promise.resolve(c);
526
- return T.then(
527
- () => {
528
- F.current && ct(e, t, v);
529
- },
530
- (j) => {
531
- const Ln = F.current && ut(e, t, v);
532
- ge(h, e, j, Ln);
533
- }
534
- ), { started: !0, result: T };
535
- }, ft = (e) => {
536
- var l;
537
- if (!K) return !1;
538
- const t = E.current.find((s) => s.id === e);
539
- if (!t || t.deleted || ((l = t.actions) == null ? void 0 : l.delete) === !1 || oe(e, "delete")) return !1;
540
- rt();
541
- let n;
542
- try {
543
- n = K(e);
544
- } catch (s) {
545
- return ge("delete", e, s), !1;
546
- }
547
- if (St(n)) {
548
- const s = {
549
- settled: !1,
550
- edgeAtSettle: 0,
551
- sigAtSettle: ""
552
- };
553
- Q(e, "delete", s), t.keptOnDelete && lt(
554
- t.dateIso ? a("notesPanel.deletingNamed", { date: de(t) }) : a("notesPanel.deleting")
555
- ), Promise.resolve(n).then(
556
- () => {
557
- F.current && (at(), ct(e, "delete", s));
558
- },
559
- (r) => {
560
- const d = F.current && ut(e, "delete", s);
561
- ge("delete", e, r, d);
562
- }
563
- );
564
- } else
565
- Q(e, "delete", {
566
- settled: !0,
567
- edgeAtSettle: pe.current,
568
- sigAtSettle: be(E.current)
569
- }), at();
570
- return t.keptOnDelete || ue.leave(e, () => {
571
- oe(e, "delete") && Ce((s) => s.add(e));
572
- }), !0;
573
- }, [U, X] = x(null), me = u(null), Nn = (e) => {
574
- if (!(!K || Ue(e)) && !(P && g === e)) {
575
- if (!Me) {
576
- ft(e);
577
- return;
578
- }
579
- me.current = { noteId: e, index: -1, started: !1 }, X(e);
580
- }
581
- }, An = () => {
582
- const e = U;
583
- if (!e) return;
584
- const t = H.current.indexOf(e);
585
- ft(e) && (me.current = { noteId: e, index: t, started: !0 }), X(null);
586
- }, Ve = U !== null && y.some((e) => e.id === U && !e.deleted);
587
- C(() => {
588
- U !== null && !Ve && X(null);
589
- }, [U, Ve]), kn(un, () => V.current, []);
590
- const O = (e, t) => {
591
- var n;
592
- return e ? ((n = V.current) == null ? void 0 : n.querySelector(
593
- `[data-note-id="${CSS.escape(e)}"] ${t ? `[data-note-action="${CSS.escape(t)}"]` : "[data-note-action]"}`
594
- )) ?? null : null;
595
- }, ve = (e, t) => {
596
- const n = H.current;
597
- return O(n[e], t) ?? O(n[e - 1], t) ?? O(n[e], null) ?? O(n[e - 1], null);
598
- }, Fn = () => {
599
- const e = V.current, t = (e == null ? void 0 : e.querySelector("[data-notes-panel-empty]")) ?? e;
600
- t && dr(t);
601
- }, Z = (e) => {
602
- e ? e.focus() : Fn();
603
- }, Vn = (e) => {
604
- const t = me.current;
605
- if (me.current = null, !t || e.defaultPrevented) return;
606
- e.preventDefault();
607
- const n = O(t.noteId, "delete");
608
- Z(
609
- t.started ? ve(t.index, "delete") ?? n : n
610
- );
611
- }, Oe = u(null), gt = (e) => {
612
- const t = e.kind === "delete" ? "delete" : e.kind.endsWith("pin") ? "pin" : "flag", n = H.current.indexOf(e.noteId);
613
- return O(e.noteId, t) ?? O(e.noteId, null) ?? (n >= 0 ? ve(n, t) : null);
614
- }, On = (e) => {
615
- var t;
616
- (t = Oe.current) != null && t.contains(document.activeElement) && Z(gt(e)), fe(null);
617
- }, M = u(null);
618
- C(() => {
619
- const e = V.current;
620
- if (!e) return;
621
- const t = (l) => {
622
- var d, h;
623
- const s = l.target;
624
- if (!(s instanceof HTMLElement)) return;
625
- const r = ((d = s.closest("[data-note-id]")) == null ? void 0 : d.dataset.noteId) ?? null;
626
- M.current = {
627
- el: s,
628
- noteId: r,
629
- action: ((h = s.closest("[data-note-action]")) == null ? void 0 : h.dataset.noteAction) ?? null,
630
- index: r ? Et(H.current, Ee.current, r) : -1,
631
- inWriteError: !!s.closest("[data-notes-panel-write-error]")
632
- };
633
- }, n = (l) => {
634
- const s = l.relatedTarget;
635
- if (s instanceof Node) {
636
- e.contains(s) || (M.current = null);
637
- return;
638
- }
639
- const r = l.target;
640
- queueMicrotask(() => {
641
- const d = M.current;
642
- d && d.el === r && d.el.isConnected && document.activeElement !== d.el && (M.current = null);
643
- });
644
- };
645
- return e.addEventListener("focusin", t), e.addEventListener("focusout", n), () => {
646
- e.removeEventListener("focusin", t), e.removeEventListener("focusout", n);
647
- };
648
- }, []), Un(() => {
649
- var l;
650
- const e = M.current;
651
- if (!e || !V.current) return;
652
- if (e.el.isConnected) {
653
- const s = e.noteId ? Et(
654
- H.current,
655
- Ee.current,
656
- e.noteId
657
- ) : -1;
658
- s >= 0 && (e.index = s);
659
- return;
660
- }
661
- M.current = null;
662
- const t = document.activeElement;
663
- if (t && t !== document.body) return;
664
- const n = e.action ? O(e.noteId, e.action) : null;
665
- if (n) n.focus();
666
- else if (e.noteId)
667
- Z(ve(e.index, e.action));
668
- else if (e.el.hasAttribute("data-notes-panel-empty"))
669
- Z(ve(0, "delete"));
670
- else if (e.inWriteError) {
671
- const s = (l = Oe.current) == null ? void 0 : l.querySelector(
672
- "[data-alert-dismiss]"
673
- ), r = st.current;
674
- s ? s.focus() : Z(r ? gt(r) : null);
675
- }
676
- });
677
- const je = u(null);
678
- C(() => {
679
- var e, t;
680
- S && ((e = je.current) == null || e.scrollIntoView({ block: "center" }), (t = je.current) == null || t.focus());
681
- }, [S, _e]);
682
- const ee = u(p);
683
- ee.current = p;
684
- const Le = u(se);
685
- Le.current = se;
686
- const ht = u(S);
687
- ht.current = S;
688
- const qe = u(null);
689
- qe.current = { toggle: Fe };
690
- const jn = mt(
691
- () => ({
692
- // Ids + flags only — never the note body or author (both PHI).
693
- getNotes: () => E.current.filter((e) => {
694
- var t;
695
- return !(e.id && ((t = R.current.get(e.id)) != null && t.delete));
696
- }).map((e) => {
697
- var n, l;
698
- const t = e.id ? R.current.get(e.id) : void 0;
699
- return {
700
- id: e.id,
701
- pinned: ((n = t == null ? void 0 : t.pin) == null ? void 0 : n.next) ?? !!e.pinned,
702
- flagged: ((l = t == null ? void 0 : t.flag) == null ? void 0 : l.next) ?? !!e.flagged,
703
- clinical: !!e.clinical,
704
- deleted: !!e.deleted
705
- };
706
- }),
707
- canAddNote: () => !!ee.current,
708
- canAddClinical: () => Le.current,
709
- getCurrentNoteId: () => ht.current ?? null,
710
- addNote: (e) => {
711
- var t;
712
- if (!(e.clinical && !Le.current))
713
- return (t = ee.current) == null ? void 0 : t.call(ee, e);
714
- },
715
- togglePin: (e) => Tt(qe.current, e, "pin"),
716
- toggleFlag: (e) => Tt(qe.current, e, "flag")
717
- }),
718
- []
719
- );
720
- return Hn(nr, jn, f), /* @__PURE__ */ b(
721
- "section",
722
- {
723
- ref: V,
724
- "data-component": "notes-panel",
725
- "data-component-id": f,
726
- "aria-labelledby": we ? void 0 : Ye,
727
- "aria-label": we,
728
- className: [ir, dn].filter(Boolean).join(" "),
729
- ...cn,
730
- children: [
731
- /* @__PURE__ */ i(
732
- Yn,
733
- {
734
- title: gn,
735
- icon: /* @__PURE__ */ i(Zn, { "aria-hidden": "true" }),
736
- headingId: we ? void 0 : Ye,
737
- sticky: !0,
738
- divider: !0
739
- }
740
- ),
741
- /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
742
- p || g !== null ? /* @__PURE__ */ b(
743
- "div",
744
- {
745
- "data-notes-panel-composer": g !== null ? "edit" : "add",
746
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
747
- children: [
748
- tn,
749
- A === "rich" ? /* @__PURE__ */ i(
750
- Wn,
751
- {
752
- ref: _,
753
- ariaLabel: Je,
754
- placeholder: Ge,
755
- toolbar: Ft,
756
- minHeight: "fill",
757
- redactor: Vt,
758
- imageUploadUrl: Ot,
759
- readOnly: P,
760
- onChange: ({ html: e }) => I(e),
761
- onRequestAiDraft: qt,
762
- aiDraftFormat: _t,
763
- aiPrivacyNotice: Dt,
764
- onDictate: kt,
765
- onProofread: zt,
766
- onAutoFormat: Ht,
767
- aiConsent: Mt,
768
- variables: Wt,
769
- validateVariable: $t,
770
- onVariableValidityChange: Bt,
771
- renderHelpMeWrite: Kt,
772
- aiTemplates: It,
773
- onAiApplied: Yt,
774
- onUploadImage: Gt,
775
- onAiCreditsExhausted: Jt,
776
- showExtensions: Qt,
777
- aiCreditsNotice: Ut,
778
- extensions: Xt,
779
- extensionContext: Zt,
780
- onExtensionRun: en,
781
- aiConsentHeadingLevel: 3
782
- }
783
- ) : /* @__PURE__ */ i(
784
- $n,
785
- {
786
- value: k,
787
- readOnly: P,
788
- onChange: (e) => I(e.target.value),
789
- placeholder: Ge,
790
- autoResize: !0,
791
- minRows: 2,
792
- maxRows: 6,
793
- "aria-label": Je
794
- }
795
- ),
796
- /* @__PURE__ */ b(
797
- "div",
798
- {
799
- className: [
800
- "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
801
- Xe ? "ds:justify-between" : "ds:justify-end"
802
- ].join(" "),
803
- children: [
804
- Xe ? (() => {
805
- const e = P || !se, t = se ? void 0 : Lt ?? a("notesPanel.clinicalGated", {
806
- defaultValue: "You do not have permission to write clinical notes."
807
- }), n = /* @__PURE__ */ i(
808
- Bn,
809
- {
810
- size: "sm",
811
- label: a("notesPanel.clinicalToggle", {
812
- defaultValue: "Clinical note"
813
- }),
814
- checked: ie,
815
- onCheckedChange: le,
816
- disabled: e
817
- }
818
- );
819
- return e && t ? /* @__PURE__ */ i(Kn, { label: t, children: /* @__PURE__ */ i("span", { tabIndex: 0, children: n }) }) : n;
820
- })() : null,
821
- /* @__PURE__ */ b("span", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
822
- g !== null ? /* @__PURE__ */ i(
823
- ne,
824
- {
825
- type: "button",
826
- size: "sm",
827
- intent: "ghost",
828
- onClick: ce,
829
- disabled: P,
830
- children: a("notesPanel.cancelEdit", { defaultValue: "Cancel" })
831
- }
832
- ) : null,
833
- /* @__PURE__ */ i(
834
- ne,
835
- {
836
- type: "button",
837
- size: "sm",
838
- onClick: wn,
839
- disabled: !hn || Pn,
840
- loading: P,
841
- children: g !== null ? a("notesPanel.saveEdit", { defaultValue: "Save note" }) : an ?? a("notesPanel.add", { defaultValue: "Add note" })
842
- }
843
- )
844
- ] })
845
- ]
846
- }
847
- ),
848
- Be ? /* @__PURE__ */ i(L, { variant: "error", children: /* @__PURE__ */ i(L.Description, { children: Be }) }) : null,
849
- nn
850
- ]
851
- }
852
- ) : null,
853
- m === "loading" && z.length === 0 ? (
854
- /* Note-shaped placeholders, not a spinner: the reader sees where
855
- the notes will land and how many to expect. The status text is
856
- for assistive tech only; sighted readers get the motion. */
857
- /* @__PURE__ */ b(
858
- "div",
859
- {
860
- "data-notes-panel-loading": "",
861
- "aria-busy": "true",
862
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
863
- children: [
864
- /* @__PURE__ */ i("span", { role: "status", className: "ds:sr-only", children: a("notesPanel.loading") }),
865
- or.map((e, t) => /* @__PURE__ */ i(bt, { variant: "elevated", "aria-hidden": "true", children: /* @__PURE__ */ i(bt.Body, { children: /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
866
- /* @__PURE__ */ b("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
867
- /* @__PURE__ */ i(
868
- ye,
869
- {
870
- variant: "circular",
871
- size: "sm",
872
- stagger: t * 2
873
- }
874
- ),
875
- /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-1 ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
876
- /* @__PURE__ */ i(
877
- ye,
878
- {
879
- variant: "text",
880
- size: "sm",
881
- stagger: t * 2,
882
- width: "40%"
883
- }
884
- ),
885
- /* @__PURE__ */ i(
886
- ye,
887
- {
888
- variant: "text",
889
- size: "sm",
890
- stagger: t * 2,
891
- width: "25%"
892
- }
893
- )
894
- ] })
895
- ] }),
896
- /* @__PURE__ */ i(
897
- ye,
898
- {
899
- variant: "text",
900
- size: "sm",
901
- lines: e,
902
- stagger: t * 2 + 1
903
- }
904
- )
905
- ] }) }) }, t))
906
- ]
907
- }
908
- )
909
- ) : m === "error" ? /* @__PURE__ */ b(L, { variant: "error", children: [
910
- /* @__PURE__ */ i(L.Description, { children: a("notesPanel.loadError") }),
911
- re ? /* @__PURE__ */ i(L.Action, { children: /* @__PURE__ */ i(ne, { intent: "secondary", size: "sm", onClick: re, children: a("notesPanel.retry") }) }) : null
912
- ] }) : null,
913
- w && he ? /* @__PURE__ */ b(
914
- L,
915
- {
916
- ref: Oe,
917
- variant: "error",
918
- dismissible: !0,
919
- onOpenChange: (e) => {
920
- e || On(w);
921
- },
922
- "data-notes-panel-write-error": w.kind,
923
- children: [
924
- /* @__PURE__ */ i(L.Title, { as: "p", children: En(w) }),
925
- w.message ? /* @__PURE__ */ i(L.Description, { children: w.message }) : null
926
- ]
927
- },
928
- w.seq
929
- ) : null,
930
- /* @__PURE__ */ i(
931
- "span",
932
- {
933
- "aria-live": "polite",
934
- "aria-atomic": "true",
935
- "data-notes-panel-announcer": "",
936
- className: "ds:sr-only",
937
- children: Ne.text ? /* @__PURE__ */ i("span", { children: Ne.text }, Ne.seq) : null
938
- }
939
- ),
940
- m === "loading" && z.length > 0 ? /* @__PURE__ */ i("span", { role: "status", className: "ds:sr-only", children: a("notesPanel.loading") }) : null,
941
- z.length > 0 ? /* @__PURE__ */ i(
942
- "ul",
943
- {
944
- ref: Sn,
945
- "aria-busy": m === "loading" || void 0,
946
- className: `ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-0 ${fn}`.trim(),
947
- children: z.map(({ actions: e, keptOnDelete: t, ...n }, l) => {
948
- const s = S != null && n.id === S, r = n.id, d = r != null && g === r, h = r != null && ue.isLeaving(r), c = r ? Y.get(r) : void 0, v = !!(c != null && c.delete), T = v && !!t, N = P && d;
949
- return /* @__PURE__ */ b(
950
- "li",
951
- {
952
- ref: s ? je : void 0,
953
- "data-note-id": r,
954
- tabIndex: s ? -1 : void 0,
955
- "aria-current": s ? "true" : void 0,
956
- "data-reflow-id": r,
957
- "data-leaving": h ? "" : void 0,
958
- "data-editing": d ? "" : void 0,
959
- "aria-busy": T || void 0,
960
- className: [
961
- sr({
962
- current: s,
963
- washed: s || d
964
- }),
965
- ar,
966
- Qn,
967
- h ? lr : ""
968
- ].filter(Boolean).join(" "),
969
- children: [
970
- s ? /* @__PURE__ */ i("span", { className: "ds:sr-only", children: a("notesPanel.current", {
971
- defaultValue: "Current note"
972
- }) }) : null,
973
- T ? /* @__PURE__ */ i("span", { "data-notes-panel-deleting": "", className: "ds:sr-only", children: a("notesPanel.deleting") }) : null,
974
- d ? /* @__PURE__ */ i(
975
- "span",
976
- {
977
- "aria-hidden": "true",
978
- "data-notes-panel-wash": "editing",
979
- className: wt({ state: "editing" })
980
- }
981
- ) : s ? /* @__PURE__ */ i(
982
- "span",
983
- {
984
- "aria-hidden": "true",
985
- "data-notes-panel-wash": "addressed",
986
- className: wt({ state: "addressed" })
987
- },
988
- `${S}:${_e ?? ""}`
989
- ) : null,
990
- /* @__PURE__ */ i(
991
- Mn,
992
- {
993
- surface: "elevated",
994
- truncate: !s,
995
- headerActions: /* @__PURE__ */ b(qn, { children: [
996
- ze ? ze(
997
- { ...n, actions: e, keptOnDelete: t },
998
- { deleting: v }
999
- ) : null,
1000
- B && r && !n.deleted && (e == null ? void 0 : e.edit) !== !1 ? /* @__PURE__ */ i(
1001
- yt,
1002
- {
1003
- icon: /* @__PURE__ */ i(er, {}),
1004
- intent: "ghost",
1005
- size: "sm",
1006
- "aria-label": a("notesPanel.editNamed", {
1007
- date: de(n),
1008
- defaultValue: "Edit note · {{date}}"
1009
- }),
1010
- tooltip: a("notesPanel.edit", {
1011
- defaultValue: "Edit note"
1012
- }),
1013
- "aria-pressed": g === r,
1014
- disabled: P || v,
1015
- "data-notes-panel-edit": "",
1016
- "data-note-action": "edit",
1017
- onClick: () => g === r ? ce() : Tn(n)
1018
- }
1019
- ) : null,
1020
- K && r && !n.deleted && (e == null ? void 0 : e.delete) !== !1 ? /* @__PURE__ */ i(
1021
- yt,
1022
- {
1023
- icon: /* @__PURE__ */ i(tr, {}),
1024
- intent: "ghost",
1025
- size: "sm",
1026
- "aria-label": a("notesPanel.deleteNamed", {
1027
- date: de(n),
1028
- defaultValue: "Delete note · {{date}}"
1029
- }),
1030
- tooltip: a("notesPanel.delete", {
1031
- defaultValue: "Delete note"
1032
- }),
1033
- "data-note-action": "delete",
1034
- "aria-disabled": T || N || void 0,
1035
- "aria-busy": T || void 0,
1036
- onClick: () => Nn(r)
1037
- }
1038
- ) : null
1039
- ] }),
1040
- ...n,
1041
- pinned: Se(n),
1042
- flagged: xn(n),
1043
- pinPending: !!(c != null && c.pin) || v,
1044
- flagPending: !!(c != null && c.flag) || v,
1045
- onTogglePin: De && r && (e == null ? void 0 : e.pin) !== !1 && !n.deleted ? () => Fe(r, "pin") : void 0,
1046
- onToggleFlag: ke && r && (e == null ? void 0 : e.flag) !== !1 && !n.deleted ? () => Fe(r, "flag") : void 0
1047
- }
1048
- )
1049
- ]
1050
- },
1051
- n.id ?? l
1052
- );
1053
- })
1054
- }
1055
- ) : m !== "ready" ? null : (
1056
- /* Where focus lands, from script, when the last note leaves. */
1057
- /* @__PURE__ */ i("div", { "data-notes-panel-empty": "", className: At, children: on ?? /* @__PURE__ */ i("p", { className: "ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]", children: a("notesPanel.empty", { defaultValue: "No notes yet." }) }) })
1058
- )
1059
- ] }),
1060
- K && Me ? /* @__PURE__ */ i(
1061
- q,
1062
- {
1063
- scope: "container",
1064
- open: Ve,
1065
- onOpenChange: (e) => !e && X(null),
1066
- children: /* @__PURE__ */ b(
1067
- q.Content,
1068
- {
1069
- variant: "alert",
1070
- size: "sm",
1071
- onCloseAutoFocus: Vn,
1072
- children: [
1073
- /* @__PURE__ */ i(q.Header, { children: /* @__PURE__ */ i(q.Title, { children: a("notesPanel.deleteConfirmTitle", {
1074
- defaultValue: "Delete this note?"
1075
- }) }) }),
1076
- /* @__PURE__ */ i(q.Body, { children: /* @__PURE__ */ i(q.Description, { children: a("notesPanel.deleteConfirmBody", {
1077
- defaultValue: "The note will be removed from the record."
1078
- }) }) }),
1079
- /* @__PURE__ */ b(q.Footer, { children: [
1080
- /* @__PURE__ */ i(q.Close, { asChild: !0, children: /* @__PURE__ */ i(
1081
- ne,
1082
- {
1083
- intent: "secondary",
1084
- size: "sm",
1085
- onClick: () => X(null),
1086
- children: a("notesPanel.deleteConfirmCancel", {
1087
- defaultValue: "Cancel"
1088
- })
1089
- }
1090
- ) }),
1091
- /* @__PURE__ */ i(
1092
- ne,
1093
- {
1094
- intent: "destructive",
1095
- size: "sm",
1096
- onClick: An,
1097
- children: a("notesPanel.deleteConfirmAction", {
1098
- defaultValue: "Delete"
1099
- })
1100
- }
1101
- )
1102
- ] })
1103
- ]
1104
- }
1105
- )
1106
- }
1107
- ) : null
1108
- ]
1109
- }
1110
- );
1111
- }
1112
- );
1113
- export {
1114
- qr as N
1115
- };
1116
- //# sourceMappingURL=notes-panel-BHMnLbEH.js.map