@alfadocs/ui-kit 0.66.0 → 0.67.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 (153) hide show
  1. package/dist/_chunks/{agenda-card-Bl-SBiCh.js → agenda-card-BxSFkqgY.js} +2 -2
  2. package/dist/_chunks/{agenda-tray-Bh1KfEOG.js → agenda-tray-T-BumlGZ.js} +2 -2
  3. package/dist/_chunks/{ai-consent-banner-Btzmk8OH.js → ai-consent-banner-Dxtx_WAh.js} +2 -2
  4. package/dist/_chunks/{ai-tools-rail-DAfaW8eA.js → ai-tools-rail-CInA_1-E.js} +57 -50
  5. package/dist/_chunks/{alia-sidebar-CN8pA6c-.js → alia-sidebar-Ckv0yCKi.js} +2 -2
  6. package/dist/_chunks/{anamnesis-card-qeLYRG79.js → anamnesis-card-N8pIKWuS.js} +2 -2
  7. package/dist/_chunks/{antenatal-schedule-timeline-BfzFjEyb.js → antenatal-schedule-timeline-35ebkcZT.js} +2 -2
  8. package/dist/_chunks/{appointment-tray-BQnJEora.js → appointment-tray-BMl89NPW.js} +4 -4
  9. package/dist/_chunks/{badge-zsf5i5bH.js → badge-CqGsX32l.js} +46 -42
  10. package/dist/_chunks/{bishop-score-DPN4Ched.js → bishop-score-CjsB9bM-.js} +2 -2
  11. package/dist/_chunks/{bmi-calculator-DuUneHuZ.js → bmi-calculator-n-823_1V.js} +2 -2
  12. package/dist/_chunks/{care-plan-card-D42WD4-T.js → care-plan-card-BwVUyUBb.js} +4 -4
  13. package/dist/_chunks/{care-plan-entry-card-BukNI7Uy.js → care-plan-entry-card-VzdQHcOL.js} +4 -4
  14. package/dist/_chunks/{clinical-note-card-BYo437dU.js → clinical-note-card-gtrxv6zn.js} +2 -2
  15. package/dist/_chunks/{color-picker-9tL7pz5y.js → color-picker-FXpItIaF.js} +198 -175
  16. package/dist/_chunks/{contact-profile-card-CCeJmjbd.js → contact-profile-card-7BMB85T6.js} +2 -2
  17. package/dist/_chunks/{cycle-calculator-D6LTmtQt.js → cycle-calculator-BF0ointe.js} +2 -2
  18. package/dist/_chunks/{dependent-selector-CRWgieHm.js → dependent-selector-DpzGtr_J.js} +2 -2
  19. package/dist/_chunks/{document-scanner-biBS_f6c.js → document-scanner-D2qehl3-.js} +53 -53
  20. package/dist/_chunks/{due-date-calculator-CIG194vq.js → due-date-calculator-DU9AEWNy.js} +3 -3
  21. package/dist/_chunks/{editable-currency-cell-renderer-f3d0Rhue.js → editable-currency-cell-renderer-D1ewvJKO.js} +875 -809
  22. package/dist/_chunks/{fetal-weight-Xf8-ZoDy.js → fetal-weight-BVSzOhuR.js} +2 -2
  23. package/dist/_chunks/{gestational-age-calculator-BGsZaWXW.js → gestational-age-calculator-DBlFdoiP.js} +3 -3
  24. package/dist/_chunks/{hcg-doubling-LH5i6oM7.js → hcg-doubling-if4Q8aSX.js} +2 -2
  25. package/dist/_chunks/{marketplace-app-shell-Cou6XnMJ.js → marketplace-app-shell-D4-T9Qzz.js} +3 -3
  26. package/dist/_chunks/{message-card-Bgcvfj6-.js → message-card-Bx4GmLvf.js} +9 -9
  27. package/dist/_chunks/{message-tray-saAVMeHP.js → message-tray-CVyJajVJ.js} +2 -2
  28. package/dist/_chunks/{operator-hero-CM8949Hd.js → operator-hero-f_KaRhw5.js} +2 -2
  29. package/dist/_chunks/{patient-search-Bw9ONucF.js → patient-search-DR9XUYRQ.js} +2 -2
  30. package/dist/_chunks/{patient-shell-Tgpv0HND.js → patient-shell-BfgufL_q.js} +2 -2
  31. package/dist/_chunks/{patient-summary-card-Bgso0p_l.js → patient-summary-card-hEmr4eTW.js} +4 -4
  32. package/dist/_chunks/{payment-request-card-DBz3hVDz.js → payment-request-card-CYE5vhZ0.js} +3 -3
  33. package/dist/_chunks/{periodontal-chart-card-AYyHtU9K.js → periodontal-chart-card-Dh3KgvYG.js} +2 -2
  34. package/dist/_chunks/{practice-results-CVAgY2RZ.js → practice-results-DND2SAt7.js} +2 -2
  35. package/dist/_chunks/{pregnancy-dating-f9aJbiAk.js → pregnancy-dating-QY-sqpvj.js} +3 -3
  36. package/dist/_chunks/{pregnancy-weight-gain-BMRBeA8V.js → pregnancy-weight-gain-DOJXXNYP.js} +2 -2
  37. package/dist/_chunks/rich-text-editor-DAeCXiQG.js +1973 -0
  38. package/dist/_chunks/{scroll-area-BWqCkEGz.js → scroll-area-5wNK0Cyz.js} +40 -30
  39. package/dist/_chunks/{sidebar-BFwbx74W.js → sidebar-DaB4ulxH.js} +351 -344
  40. package/dist/_chunks/{suggestion-chip-C4kxWUIs.js → suggestion-chip-Bk4PmYTg.js} +30 -30
  41. package/dist/_chunks/{tab-bar-Xetknddo.js → tab-bar-B1ovILzh.js} +2 -2
  42. package/dist/_chunks/{tag-CdA0s_VV.js → tag-BQXwuJq1.js} +41 -38
  43. package/dist/_chunks/{transaction-chip-BZCa6XDn.js → transaction-chip-DK84XCBU.js} +46 -33
  44. package/dist/_chunks/{workflow-map-Bt4Of5dT.js → workflow-map-JAZryZJr.js} +2 -2
  45. package/dist/agent-catalog.json +1 -1
  46. package/dist/components/agenda-card/index.js +1 -1
  47. package/dist/components/agenda-tray/index.js +1 -1
  48. package/dist/components/ai-consent-banner/index.js +1 -1
  49. package/dist/components/ai-tools-rail/index.js +1 -1
  50. package/dist/components/anamnesis-card/index.js +1 -1
  51. package/dist/components/appointment-card/index.js +1 -1
  52. package/dist/components/badge/index.js +1 -1
  53. package/dist/components/bishop-score/index.js +1 -1
  54. package/dist/components/bmi-calculator/index.js +1 -1
  55. package/dist/components/care-plan-card/index.js +1 -1
  56. package/dist/components/care-plan-entry-card/index.js +1 -1
  57. package/dist/components/clinical-note-card/index.js +1 -1
  58. package/dist/components/color-picker/index.js +1 -1
  59. package/dist/components/contact-profile-card/index.js +1 -1
  60. package/dist/components/cycle-calculator/index.js +1 -1
  61. package/dist/components/data-table/cell-renderers/actions-cell-renderer.d.ts +16 -0
  62. package/dist/components/data-table/cell-renderers/tooth-cell-renderer.d.ts +12 -0
  63. package/dist/components/data-table/data-table.d.ts +1 -1
  64. package/dist/components/data-table/index.d.ts +2 -0
  65. package/dist/components/data-table/index.js +13 -12
  66. package/dist/components/data-table/toolbar.d.ts +5 -1
  67. package/dist/components/dependent-selector/index.js +1 -1
  68. package/dist/components/document-scanner/index.js +1 -1
  69. package/dist/components/due-date-calculator/index.js +2 -2
  70. package/dist/components/fetal-weight/index.js +1 -1
  71. package/dist/components/gestational-age-calculator/index.js +1 -1
  72. package/dist/components/hcg-doubling/index.js +1 -1
  73. package/dist/components/message-card/index.js +1 -1
  74. package/dist/components/message-tray/index.js +1 -1
  75. package/dist/components/operator-hero/index.js +1 -1
  76. package/dist/components/patient-search/index.js +1 -1
  77. package/dist/components/patient-summary-card/index.js +1 -1
  78. package/dist/components/payment-card/index.js +1 -1
  79. package/dist/components/periodontal-chart-card/index.js +1 -1
  80. package/dist/components/practice-results/index.js +1 -1
  81. package/dist/components/pregnancy-dating/index.js +1 -1
  82. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  83. package/dist/components/rich-text-editor/editor-toolbar.d.ts +25 -1
  84. package/dist/components/rich-text-editor/index.js +1 -1
  85. package/dist/components/rich-text-editor/rich-text-editor.d.ts +2 -0
  86. package/dist/components/scroll-area/index.js +1 -1
  87. package/dist/components/sidebar/index.js +1 -1
  88. package/dist/components/suggestion-chip/index.js +1 -1
  89. package/dist/components/tab-bar/index.js +1 -1
  90. package/dist/components/tag/index.js +1 -1
  91. package/dist/components/transaction-chip/index.js +1 -1
  92. package/dist/components/workflow/index.js +1 -1
  93. package/dist/i18n/locales/ar.d.ts +14 -1
  94. package/dist/i18n/locales/ar.js +16 -3
  95. package/dist/i18n/locales/de.d.ts +14 -1
  96. package/dist/i18n/locales/de.js +16 -3
  97. package/dist/i18n/locales/el.d.ts +14 -1
  98. package/dist/i18n/locales/el.js +16 -3
  99. package/dist/i18n/locales/en.d.ts +14 -1
  100. package/dist/i18n/locales/en.js +16 -3
  101. package/dist/i18n/locales/es.d.ts +14 -1
  102. package/dist/i18n/locales/es.js +16 -3
  103. package/dist/i18n/locales/fr.d.ts +14 -1
  104. package/dist/i18n/locales/fr.js +16 -3
  105. package/dist/i18n/locales/hi.d.ts +14 -1
  106. package/dist/i18n/locales/hi.js +16 -3
  107. package/dist/i18n/locales/it.d.ts +14 -1
  108. package/dist/i18n/locales/it.js +16 -3
  109. package/dist/i18n/locales/ja.d.ts +14 -1
  110. package/dist/i18n/locales/ja.js +16 -3
  111. package/dist/i18n/locales/nl.d.ts +14 -1
  112. package/dist/i18n/locales/nl.js +14 -3
  113. package/dist/i18n/locales/pl.d.ts +14 -1
  114. package/dist/i18n/locales/pl.js +16 -3
  115. package/dist/i18n/locales/pt.d.ts +14 -1
  116. package/dist/i18n/locales/pt.js +16 -3
  117. package/dist/i18n/locales/ro.d.ts +14 -1
  118. package/dist/i18n/locales/ro.js +16 -3
  119. package/dist/i18n/locales/ru.d.ts +14 -1
  120. package/dist/i18n/locales/ru.js +16 -3
  121. package/dist/i18n/locales/sq.d.ts +14 -1
  122. package/dist/i18n/locales/sq.js +16 -3
  123. package/dist/i18n/locales/sv.d.ts +14 -1
  124. package/dist/i18n/locales/sv.js +14 -3
  125. package/dist/i18n/locales/tr.d.ts +14 -1
  126. package/dist/i18n/locales/tr.js +16 -3
  127. package/dist/i18n/locales/zh.d.ts +14 -1
  128. package/dist/i18n/locales/zh.js +14 -3
  129. package/dist/index.js +508 -507
  130. package/dist/locales/ar.json +16 -3
  131. package/dist/locales/de.json +16 -3
  132. package/dist/locales/el.json +16 -3
  133. package/dist/locales/en.json +16 -3
  134. package/dist/locales/es.json +16 -3
  135. package/dist/locales/fr.json +16 -3
  136. package/dist/locales/hi.json +16 -3
  137. package/dist/locales/it.json +16 -3
  138. package/dist/locales/ja.json +16 -3
  139. package/dist/locales/nl.json +16 -3
  140. package/dist/locales/pl.json +16 -3
  141. package/dist/locales/pt.json +16 -3
  142. package/dist/locales/ro.json +16 -3
  143. package/dist/locales/ru.json +16 -3
  144. package/dist/locales/sq.json +16 -3
  145. package/dist/locales/sv.json +16 -3
  146. package/dist/locales/tr.json +16 -3
  147. package/dist/locales/zh.json +16 -3
  148. package/dist/patterns/alia-assistant/index.js +1 -1
  149. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  150. package/dist/patterns/patient-shell/index.js +1 -1
  151. package/dist/tokens.css +6 -3
  152. package/package.json +1 -1
  153. package/dist/_chunks/rich-text-editor-B5XQNxe8.js +0 -1586
@@ -1,1586 +0,0 @@
1
- import { jsx as e, jsxs as u, Fragment as De } from "react/jsx-runtime";
2
- import { useId as ee, useState as N, useRef as $, useCallback as x, useEffect as G, forwardRef as et, useMemo as Ee, useImperativeHandle as tt } from "react";
3
- import { c as _e } from "./index-D2ZczOXr.js";
4
- import { useTranslation as Q } from "react-i18next";
5
- import { SafeHtml as rt, sanitiseHtml as nt } from "../safe-html/index.js";
6
- import { u as ot } from "./registry-nPAVE19X.js";
7
- import { I as D } from "./icon-button-LqoiKcUN.js";
8
- import { S as at } from "./spinner-hbwuKwMf.js";
9
- import { T as it } from "./text-area-BIx0tZ05.js";
10
- import { E as st } from "./editor-overlay-wYm22wZK.js";
11
- import { R as lt } from "./rotate-ccw-BWANpitO.js";
12
- import { C as dt } from "./check-DPdL_Sm7.js";
13
- import { S as Me } from "./square-CZoGU14v.js";
14
- import { M as Re } from "./mic-B4Gog3Gi.js";
15
- import { S as ct } from "./send-CySZIRPJ.js";
16
- import { S as Te } from "./sparkles-CuYXqQLg.js";
17
- import { B as te } from "./button-DD_0Xdmr.js";
18
- import { P as U } from "./popover-DTbfAuR0.js";
19
- import { D as be } from "./dropdown-menu-DwwPovMZ.js";
20
- import { D as A } from "./dialog-DMGnSelc.js";
21
- import { C as ut } from "./color-picker-9tL7pz5y.js";
22
- import { T as ye } from "./text-input-BaClJL8Y.js";
23
- import { C as mt } from "./checkbox-DRcOdmXv.js";
24
- import { F as ht } from "./file-upload-BosbPDb1.js";
25
- import { C as ft } from "./chevron-down-BX_NP2Yh.js";
26
- import { c as z } from "./createLucideIcon-CrFbzy84.js";
27
- import { I as gt } from "./image-C6RM5hfF.js";
28
- import { C as pt } from "./columns-2-BTOBZbep.js";
29
- import { T as bt } from "./trash-2-rPAKaRgB.js";
30
- /**
31
- * @license lucide-react v1.8.0 - ISC
32
- *
33
- * This source code is licensed under the ISC license.
34
- * See the LICENSE file in the root directory of this source tree.
35
- */
36
- const vt = [
37
- ["rect", { width: "13", height: "7", x: "3", y: "3", rx: "1", key: "11xb64" }],
38
- ["path", { d: "m22 15-3-3 3-3", key: "26chmm" }],
39
- ["rect", { width: "13", height: "7", x: "3", y: "14", rx: "1", key: "k6ky7n" }]
40
- ], yt = z("between-horizontal-end", vt);
41
- /**
42
- * @license lucide-react v1.8.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */
47
- const kt = [
48
- ["rect", { width: "13", height: "7", x: "8", y: "3", rx: "1", key: "pkso9a" }],
49
- ["path", { d: "m2 9 3 3-3 3", key: "1agib5" }],
50
- ["rect", { width: "13", height: "7", x: "8", y: "14", rx: "1", key: "1q5fc1" }]
51
- ], xt = z("between-horizontal-start", kt);
52
- /**
53
- * @license lucide-react v1.8.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */
58
- const wt = [
59
- ["rect", { width: "7", height: "13", x: "3", y: "3", rx: "1", key: "1fdu0f" }],
60
- ["path", { d: "m9 22 3-3 3 3", key: "17z65a" }],
61
- ["rect", { width: "7", height: "13", x: "14", y: "3", rx: "1", key: "1squn4" }]
62
- ], Ct = z("between-vertical-end", wt);
63
- /**
64
- * @license lucide-react v1.8.0 - ISC
65
- *
66
- * This source code is licensed under the ISC license.
67
- * See the LICENSE file in the root directory of this source tree.
68
- */
69
- const Nt = [
70
- ["rect", { width: "7", height: "13", x: "3", y: "8", rx: "1", key: "1fjrkv" }],
71
- ["path", { d: "m15 2-3 3-3-3", key: "1uh6eb" }],
72
- ["rect", { width: "7", height: "13", x: "14", y: "8", rx: "1", key: "w3fjg8" }]
73
- ], zt = z("between-vertical-start", Nt);
74
- /**
75
- * @license lucide-react v1.8.0 - ISC
76
- *
77
- * This source code is licensed under the ISC license.
78
- * See the LICENSE file in the root directory of this source tree.
79
- */
80
- const Mt = [
81
- [
82
- "path",
83
- { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
84
- ]
85
- ], Rt = z("bold", Mt);
86
- /**
87
- * @license lucide-react v1.8.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */
92
- const Tt = [
93
- ["path", { d: "M4 12h8", key: "17cfdx" }],
94
- ["path", { d: "M4 18V6", key: "1rz3zl" }],
95
- ["path", { d: "M12 18V6", key: "zqpxq5" }],
96
- ["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
97
- ], _t = z("heading-2", Tt);
98
- /**
99
- * @license lucide-react v1.8.0 - ISC
100
- *
101
- * This source code is licensed under the ISC license.
102
- * See the LICENSE file in the root directory of this source tree.
103
- */
104
- const It = [
105
- ["path", { d: "M4 12h8", key: "17cfdx" }],
106
- ["path", { d: "M4 18V6", key: "1rz3zl" }],
107
- ["path", { d: "M12 18V6", key: "zqpxq5" }],
108
- ["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
109
- ["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
110
- ], St = z("heading-3", It);
111
- /**
112
- * @license lucide-react v1.8.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */
117
- const At = [
118
- ["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
119
- ["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
120
- ["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
121
- ], Ht = z("italic", At);
122
- /**
123
- * @license lucide-react v1.8.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */
128
- const $t = [
129
- ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
130
- ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
131
- ], Lt = z("link", $t);
132
- /**
133
- * @license lucide-react v1.8.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */
138
- const Et = [
139
- ["path", { d: "M11 5h10", key: "1cz7ny" }],
140
- ["path", { d: "M11 12h10", key: "1438ji" }],
141
- ["path", { d: "M11 19h10", key: "11t30w" }],
142
- ["path", { d: "M4 4h1v5", key: "10yrso" }],
143
- ["path", { d: "M4 9h2", key: "r1h2o0" }],
144
- ["path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02", key: "xtkcd5" }]
145
- ], jt = z("list-ordered", Et);
146
- /**
147
- * @license lucide-react v1.8.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */
152
- const qt = [
153
- ["path", { d: "M3 5h.01", key: "18ugdj" }],
154
- ["path", { d: "M3 12h.01", key: "nlz23k" }],
155
- ["path", { d: "M3 19h.01", key: "noohij" }],
156
- ["path", { d: "M8 5h13", key: "1pao27" }],
157
- ["path", { d: "M8 12h13", key: "1za7za" }],
158
- ["path", { d: "M8 19h13", key: "m83p4d" }]
159
- ], Ot = z("list", qt);
160
- /**
161
- * @license lucide-react v1.8.0 - ISC
162
- *
163
- * This source code is licensed under the ISC license.
164
- * See the LICENSE file in the root directory of this source tree.
165
- */
166
- const Dt = [["path", { d: "M5 12h14", key: "1ays0h" }]], Ft = z("minus", Dt);
167
- /**
168
- * @license lucide-react v1.8.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */
173
- const Pt = [
174
- [
175
- "path",
176
- {
177
- d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
178
- key: "e79jfc"
179
- }
180
- ],
181
- ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
182
- ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
183
- ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
184
- ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
185
- ], Bt = z("palette", Pt);
186
- /**
187
- * @license lucide-react v1.8.0 - ISC
188
- *
189
- * This source code is licensed under the ISC license.
190
- * See the LICENSE file in the root directory of this source tree.
191
- */
192
- const Vt = [
193
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
194
- ["path", { d: "M14 9h1", key: "l0svgy" }],
195
- ["path", { d: "M19 9h2", key: "te2zfg" }],
196
- ["path", { d: "M3 9h2", key: "1h4ldw" }],
197
- ["path", { d: "M9 9h1", key: "15jzuz" }]
198
- ], Wt = z("panel-top-dashed", Vt);
199
- /**
200
- * @license lucide-react v1.8.0 - ISC
201
- *
202
- * This source code is licensed under the ISC license.
203
- * See the LICENSE file in the root directory of this source tree.
204
- */
205
- const Gt = [
206
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
207
- ["path", { d: "M3 9h18", key: "1pudct" }]
208
- ], Ut = z("panel-top", Gt);
209
- /**
210
- * @license lucide-react v1.8.0 - ISC
211
- *
212
- * This source code is licensed under the ISC license.
213
- * See the LICENSE file in the root directory of this source tree.
214
- */
215
- const Qt = [
216
- ["path", { d: "M13 4v16", key: "8vvj80" }],
217
- ["path", { d: "M17 4v16", key: "7dpous" }],
218
- ["path", { d: "M19 4H9.5a4.5 4.5 0 0 0 0 9H13", key: "sh4n9v" }]
219
- ], Xt = z("pilcrow", Qt);
220
- /**
221
- * @license lucide-react v1.8.0 - ISC
222
- *
223
- * This source code is licensed under the ISC license.
224
- * See the LICENSE file in the root directory of this source tree.
225
- */
226
- const Zt = [
227
- [
228
- "path",
229
- {
230
- d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
231
- key: "rib7q0"
232
- }
233
- ],
234
- [
235
- "path",
236
- {
237
- d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
238
- key: "1ymkrd"
239
- }
240
- ]
241
- ], Jt = z("quote", Zt);
242
- /**
243
- * @license lucide-react v1.8.0 - ISC
244
- *
245
- * This source code is licensed under the ISC license.
246
- * See the LICENSE file in the root directory of this source tree.
247
- */
248
- const Yt = [
249
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
250
- ["path", { d: "M3 12h18", key: "1i2n21" }]
251
- ], Kt = z("rows-2", Yt);
252
- /**
253
- * @license lucide-react v1.8.0 - ISC
254
- *
255
- * This source code is licensed under the ISC license.
256
- * See the LICENSE file in the root directory of this source tree.
257
- */
258
- const er = [
259
- ["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
260
- ["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
261
- ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
262
- ], tr = z("strikethrough", er);
263
- /**
264
- * @license lucide-react v1.8.0 - ISC
265
- *
266
- * This source code is licensed under the ISC license.
267
- * See the LICENSE file in the root directory of this source tree.
268
- */
269
- const rr = [
270
- ["path", { d: "M12 3v18", key: "108xh3" }],
271
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
272
- ["path", { d: "M3 9h18", key: "1pudct" }],
273
- ["path", { d: "M3 15h18", key: "5xshup" }]
274
- ], nr = z("table", rr), or = {
275
- id: "rich-text-editor",
276
- capabilities: ["edit_inline"],
277
- state: {
278
- html: {
279
- type: "string",
280
- description: "Sanitised HTML representation of the editor content.",
281
- read: (n) => n.getHTML()
282
- },
283
- text: {
284
- type: "string",
285
- description: "Plain-text content of the editor (tags stripped).",
286
- read: (n) => n.getText()
287
- },
288
- markdown: {
289
- type: "string",
290
- description: "Markdown representation of the editor content. The Redactor engine has no native Markdown serialiser, so this is always empty — read `html` instead.",
291
- read: (n) => n.getMarkdown()
292
- }
293
- },
294
- actions: {
295
- set_content: {
296
- safety: "destructive",
297
- argsType: "{ html: string }",
298
- description: "Replace the editor content. Loses unsaved input.",
299
- invoke: (n, o) => {
300
- n.setContent(o.html);
301
- }
302
- },
303
- insert_at_cursor: {
304
- safety: "destructive",
305
- argsType: "{ content: string; asHtml?: boolean }",
306
- description: "Insert content at the caret (replacing any selection). HTML is sanitised; pass asHtml:false for plain text. Seam for merge/template variables and AI-generated drafts.",
307
- invoke: (n, o) => {
308
- n.insertAtCursor(o.content, { asHtml: o.asHtml });
309
- }
310
- },
311
- apply_format: {
312
- safety: "destructive",
313
- argsType: "{ format: 'bold' | 'italic' | 'strikethrough' | 'bulletedList' | 'numberedList' | 'heading' | 'quote' | 'paragraph' }",
314
- description: "Toggle/apply a block or inline format on the current selection (bold, italic, strikethrough, bulleted/numbered list, heading, quote, paragraph).",
315
- invoke: (n, o) => {
316
- n.applyFormat(o.format);
317
- }
318
- },
319
- clear: {
320
- safety: "destructive",
321
- description: "Empty the editor. Loses unsaved input.",
322
- invoke: (n) => {
323
- n.clear();
324
- }
325
- },
326
- focus: {
327
- safety: "read",
328
- description: "Move keyboard focus to the editor surface.",
329
- invoke: (n) => {
330
- n.focus();
331
- }
332
- }
333
- },
334
- domHooks: {
335
- root: { attr: "data-component", value: "rich-text-editor" },
336
- instanceId: {
337
- attr: "data-component-id",
338
- sourceProp: "id",
339
- description: "Sourced from the id prop."
340
- }
341
- }
342
- }, ar = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", ir = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", sr = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]", je = [
343
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
344
- "ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
345
- "ds:p-[var(--spacing-sm)] ds:[max-block-size:10rem] ds:overflow-y-auto",
346
- "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]"
347
- ].join(" ");
348
- function qe(n, o) {
349
- return o ? n ? /\s$/.test(n) ? `${n}${o}` : `${n} ${o}` : o : n;
350
- }
351
- function lr({
352
- open: n,
353
- onClose: o,
354
- onRequestAiDraft: d,
355
- onInsert: s,
356
- previewAsHtml: i = !0,
357
- privacyNotice: m,
358
- onDictate: f
359
- }) {
360
- const { t: l } = Q(), w = ee(), R = ee(), [p, M] = N(""), [v, H] = N(!1), [b, c] = N(!1), [I, C] = N(null), P = $(null), [T, re] = N(!1), [L, X] = N(""), B = $(null), Z = x(() => {
361
- var h;
362
- (h = B.current) == null || h.abort();
363
- }, []), y = x(() => {
364
- if (!f) return;
365
- const h = new AbortController();
366
- B.current = h, re(!0), X(""), f({
367
- signal: h.signal,
368
- onPartialTranscript: (S) => {
369
- h.signal.aborted || X(S);
370
- },
371
- onFinalTranscript: (S) => {
372
- if (h.signal.aborted) return;
373
- const Y = S.trim();
374
- X(""), Y && M((j) => qe(j, Y));
375
- }
376
- }).catch(() => {
377
- }).finally(() => {
378
- X(""), B.current === h && (B.current = null, re(!1));
379
- });
380
- }, [f]), E = x(() => {
381
- T ? Z() : y();
382
- }, [T, y, Z]);
383
- G(() => {
384
- var h, S;
385
- n ? (M(""), H(!1), c(!1), C(null), X("")) : ((h = P.current) == null || h.abort(), P.current = null, (S = B.current) == null || S.abort());
386
- }, [n]), G(
387
- () => () => {
388
- var h, S;
389
- (h = P.current) == null || h.abort(), (S = B.current) == null || S.abort();
390
- },
391
- []
392
- );
393
- const q = x(() => {
394
- var Y;
395
- const h = p.trim();
396
- if (!h || v) return;
397
- Z(), (Y = P.current) == null || Y.abort();
398
- const S = new AbortController();
399
- P.current = S, c(!1), H(!0), d({ prompt: h, signal: S.signal }).then((j) => {
400
- S.signal.aborted || (C(j), H(!1));
401
- }).catch((j) => {
402
- S.signal.aborted || j && typeof j == "object" && "name" in j && j.name === "AbortError" || (c(!0), H(!1));
403
- });
404
- }, [p, v, d, Z]), ie = x(() => {
405
- I != null && (s(I), o());
406
- }, [I, s, o]), me = I != null, J = T ? qe(p, L) : p;
407
- return /* @__PURE__ */ e(
408
- st,
409
- {
410
- open: n,
411
- onClose: o,
412
- title: /* @__PURE__ */ u("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
413
- /* @__PURE__ */ e(Te, { "aria-hidden": "true", className: "ds:size-4" }),
414
- l("editor.ai.dialogTitle")
415
- ] }),
416
- ariaLabel: l("editor.ai.dialogTitle"),
417
- children: me ? /* @__PURE__ */ u("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-xs)]", children: [
418
- /* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: i ? /* @__PURE__ */ e(
419
- rt,
420
- {
421
- html: I,
422
- profile: "rich-text",
423
- className: je,
424
- tabIndex: 0,
425
- "aria-label": l("editor.ai.dialogTitle")
426
- }
427
- ) : (
428
- // Focusable so a keyboard user can scroll a long draft preview
429
- // (mirrors the SafeHtml preview branch above). The lint rule's
430
- // tabIndex allowlist doesn't cover a scrollable, non-interactive
431
- // text region.
432
- // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
433
- /* @__PURE__ */ e("p", { className: je, tabIndex: 0, children: I })
434
- ) }),
435
- /* @__PURE__ */ e(
436
- D,
437
- {
438
- size: "sm",
439
- intent: "ghost",
440
- className: "ds:rounded-full",
441
- icon: /* @__PURE__ */ e(lt, {}),
442
- "aria-label": l("editor.ai.retry"),
443
- onClick: () => C(null)
444
- }
445
- ),
446
- /* @__PURE__ */ e(
447
- D,
448
- {
449
- size: "sm",
450
- intent: "primary",
451
- className: "ds:rounded-full",
452
- icon: /* @__PURE__ */ e(dt, {}),
453
- "aria-label": l("common.confirm"),
454
- onClick: ie
455
- }
456
- )
457
- ] }) : /* @__PURE__ */ u(De, { children: [
458
- /* @__PURE__ */ u("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-xs)]", children: [
459
- /* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ e(
460
- it,
461
- {
462
- id: w,
463
- size: "md",
464
- value: J,
465
- onChange: (h) => M(h.target.value),
466
- placeholder: l("editor.ai.promptPlaceholder"),
467
- "aria-label": l("editor.ai.promptLabel"),
468
- autoResize: !0,
469
- minRows: 1,
470
- maxRows: 3,
471
- readOnly: T,
472
- tone: b ? "error" : "default",
473
- "aria-describedby": b ? R : void 0
474
- }
475
- ) }),
476
- f ? /* @__PURE__ */ e(
477
- D,
478
- {
479
- size: "sm",
480
- intent: "ghost",
481
- className: T ? ar : void 0,
482
- icon: T ? /* @__PURE__ */ e(Me, { className: "ds:fill-current" }) : /* @__PURE__ */ e(Re, {}),
483
- "aria-pressed": T,
484
- "aria-label": l(T ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
485
- onClick: E
486
- }
487
- ) : null,
488
- /* @__PURE__ */ e(
489
- D,
490
- {
491
- size: "sm",
492
- intent: "primary",
493
- icon: v ? /* @__PURE__ */ e(at, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(ct, {}),
494
- className: "ds:rounded-full",
495
- disabled: v || !p.trim(),
496
- "aria-busy": v || void 0,
497
- "aria-label": l("editor.ai.generate"),
498
- onClick: q
499
- }
500
- )
501
- ] }),
502
- b ? /* @__PURE__ */ e("p", { id: R, role: "alert", className: sr, children: l("editor.ai.error") }) : m ? /* @__PURE__ */ e("p", { className: ir, children: m }) : null
503
- ] })
504
- }
505
- );
506
- }
507
- const dr = {
508
- bold: {
509
- id: "bold",
510
- icon: /* @__PURE__ */ e(Rt, {}),
511
- label: ["editor.bold", "Bold"],
512
- command: ["module.inline.format", { tag: "b" }],
513
- toggle: "bold"
514
- },
515
- italic: {
516
- id: "italic",
517
- icon: /* @__PURE__ */ e(Ht, {}),
518
- label: ["editor.italic", "Italic"],
519
- command: ["module.inline.format", { tag: "i" }],
520
- toggle: "italic"
521
- },
522
- strike: {
523
- id: "strike",
524
- icon: /* @__PURE__ */ e(tr, {}),
525
- label: ["editor.strike", "Strikethrough"],
526
- command: ["module.inline.format", { tag: "del" }],
527
- toggle: "strike"
528
- },
529
- ul: {
530
- id: "ul",
531
- icon: /* @__PURE__ */ e(Ot, {}),
532
- label: ["editor.list.bullet", "Bulleted list"],
533
- command: ["module.list.toggle", "ul"],
534
- toggle: "ul"
535
- },
536
- ol: {
537
- id: "ol",
538
- icon: /* @__PURE__ */ e(jt, {}),
539
- label: ["editor.list.ordered", "Numbered list"],
540
- command: ["module.list.toggle", "ol"],
541
- toggle: "ol"
542
- },
543
- rule: {
544
- id: "rule",
545
- icon: /* @__PURE__ */ e(Ft, {}),
546
- label: ["editor.horizontalRule", "Horizontal rule"],
547
- command: ["module.line.insert"]
548
- }
549
- }, Ne = [
550
- {
551
- id: "paragraph",
552
- tag: "p",
553
- icon: /* @__PURE__ */ e(Xt, {}),
554
- label: ["editor.paragraph", "Paragraph"]
555
- },
556
- {
557
- id: "h2",
558
- tag: "h2",
559
- icon: /* @__PURE__ */ e(_t, {}),
560
- label: ["editor.heading2", "Heading 2"]
561
- },
562
- {
563
- id: "h3",
564
- tag: "h3",
565
- icon: /* @__PURE__ */ e(St, {}),
566
- label: ["editor.heading3", "Heading 3"]
567
- },
568
- {
569
- id: "quote",
570
- tag: "blockquote",
571
- icon: /* @__PURE__ */ e(Jt, {}),
572
- label: ["editor.quote", "Quote"]
573
- }
574
- ], cr = {
575
- minimal: ["bold", "italic", "link"],
576
- standard: ["format", "bold", "italic", "strike", "ul", "ol", "link"],
577
- full: ["format", "bold", "italic", "strike", "ul", "ol", "link", "rule"]
578
- }, ur = [
579
- {
580
- id: "rowAbove",
581
- command: "plugin.table.addRowAbove",
582
- icon: /* @__PURE__ */ e(xt, {}),
583
- label: ["editor.table.rowAbove", "Add row above"]
584
- },
585
- {
586
- id: "rowBelow",
587
- command: "plugin.table.addRowBelow",
588
- icon: /* @__PURE__ */ e(yt, {}),
589
- label: ["editor.table.rowBelow", "Add row below"]
590
- },
591
- {
592
- id: "colLeft",
593
- command: "plugin.table.addColumnLeft",
594
- icon: /* @__PURE__ */ e(zt, {}),
595
- label: ["editor.table.columnLeft", "Add column left"]
596
- },
597
- {
598
- id: "colRight",
599
- command: "plugin.table.addColumnRight",
600
- icon: /* @__PURE__ */ e(Ct, {}),
601
- label: ["editor.table.columnRight", "Add column right"]
602
- },
603
- {
604
- id: "addHead",
605
- command: "plugin.table.addHead",
606
- icon: /* @__PURE__ */ e(Ut, {}),
607
- label: ["editor.table.addHeader", "Add header row"]
608
- },
609
- {
610
- id: "deleteHead",
611
- command: "plugin.table.deleteHead",
612
- icon: /* @__PURE__ */ e(Wt, {}),
613
- label: ["editor.table.deleteHeader", "Remove header row"]
614
- },
615
- {
616
- id: "deleteRow",
617
- command: "plugin.table.deleteRow",
618
- icon: /* @__PURE__ */ e(Kt, {}),
619
- label: ["editor.table.deleteRow", "Delete row"]
620
- },
621
- {
622
- id: "deleteColumn",
623
- command: "plugin.table.deleteColumn",
624
- icon: /* @__PURE__ */ e(pt, {}),
625
- label: ["editor.table.deleteColumn", "Delete column"]
626
- },
627
- {
628
- id: "deleteTable",
629
- command: "plugin.table.deleteTable",
630
- icon: /* @__PURE__ */ e(bt, {}),
631
- label: ["editor.table.deleteTable", "Delete table"]
632
- }
633
- ], ve = 6, mr = _e(
634
- [
635
- "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
636
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
637
- "ds:bg-[var(--background)] ds:p-[var(--spacing-xs)]",
638
- "ds:shadow-[var(--shadow-md)]"
639
- ].join(" ")
640
- ), hr = "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[var(--border)] ds:[margin-inline:var(--spacing-2xs)]", ue = "ds:text-[length:var(--font-size-sm)] ds:font-medium ds:text-[color:var(--foreground)]";
641
- function ke(n) {
642
- return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
643
- }
644
- function fr({
645
- run: n,
646
- active: o,
647
- onTriggerDown: d
648
- }) {
649
- const { t: s } = Q(), i = Ne.find((m) => o.has(m.id)) ?? Ne[0];
650
- return /* @__PURE__ */ u(be.Root, { children: [
651
- /* @__PURE__ */ e(be.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
652
- te,
653
- {
654
- size: "sm",
655
- intent: "ghost",
656
- startIcon: i.icon,
657
- endIcon: /* @__PURE__ */ e(ft, {}),
658
- "aria-label": s("editor.format", "Paragraph style"),
659
- onMouseDown: d,
660
- children: s(i.label[0], i.label[1])
661
- }
662
- ) }),
663
- /* @__PURE__ */ e(be.Content, { align: "start", children: Ne.map((m) => /* @__PURE__ */ e(
664
- be.Item,
665
- {
666
- startIcon: m.icon,
667
- onSelect: () => n("module.block.format", { tag: m.tag }),
668
- children: s(m.label[0], m.label[1])
669
- },
670
- m.id
671
- )) })
672
- ] });
673
- }
674
- function gr({
675
- insertHtml: n,
676
- saveSelection: o,
677
- restoreSelection: d,
678
- getSelectedText: s
679
- }) {
680
- const { t: i } = Q(), [m, f] = N(!1), [l, w] = N(""), [R, p] = N(""), [M, v] = N(!1), H = ee(), b = ee(), c = () => {
681
- w(""), p(""), v(!1);
682
- }, I = () => {
683
- const C = l.trim();
684
- if (!C) return;
685
- const P = R.trim() || C, T = M ? ' target="_blank" rel="noopener noreferrer"' : "", re = `<a href="${ke(C)}"${T}>${ke(P)}</a>`;
686
- f(!1), c(), window.requestAnimationFrame(() => {
687
- d(), n(re);
688
- });
689
- };
690
- return /* @__PURE__ */ u(A.Root, { open: m, onOpenChange: f, children: [
691
- /* @__PURE__ */ e(A.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
692
- D,
693
- {
694
- size: "sm",
695
- intent: "ghost",
696
- icon: /* @__PURE__ */ e(Lt, {}),
697
- "aria-label": i("editor.link.insert", "Insert link"),
698
- onMouseDown: () => {
699
- o(), p(s());
700
- }
701
- }
702
- ) }),
703
- /* @__PURE__ */ u(A.Content, { children: [
704
- /* @__PURE__ */ e(A.Header, { children: /* @__PURE__ */ e(A.Title, { children: i("editor.link.insert", "Insert link") }) }),
705
- /* @__PURE__ */ u(A.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
706
- /* @__PURE__ */ u("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
707
- /* @__PURE__ */ e("label", { htmlFor: H, className: ue, children: i("editor.link.url", "URL") }),
708
- /* @__PURE__ */ e(
709
- ye,
710
- {
711
- id: H,
712
- type: "url",
713
- value: l,
714
- onChange: (C) => w(C.target.value),
715
- placeholder: "https://…"
716
- }
717
- )
718
- ] }),
719
- /* @__PURE__ */ u("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
720
- /* @__PURE__ */ e("label", { htmlFor: b, className: ue, children: i("editor.link.text", "Text to display") }),
721
- /* @__PURE__ */ e(
722
- ye,
723
- {
724
- id: b,
725
- value: R,
726
- onChange: (C) => p(C.target.value),
727
- placeholder: i("editor.link.textPlaceholder", "Link text")
728
- }
729
- )
730
- ] }),
731
- /* @__PURE__ */ e(
732
- mt,
733
- {
734
- checked: M,
735
- onCheckedChange: (C) => v(C === !0),
736
- label: i("editor.link.newTab", "Open in new tab")
737
- }
738
- )
739
- ] }),
740
- /* @__PURE__ */ u(A.Footer, { children: [
741
- /* @__PURE__ */ e(A.Close, { asChild: !0, children: /* @__PURE__ */ e(te, { intent: "secondary", children: i("editor.ai.cancel", "Cancel") }) }),
742
- /* @__PURE__ */ e(te, { onClick: I, disabled: !l.trim(), children: i("editor.link.insertAction", "Insert") })
743
- ] })
744
- ] })
745
- ] });
746
- }
747
- function pr({
748
- insertHtml: n,
749
- saveSelection: o,
750
- restoreSelection: d,
751
- uploadImage: s
752
- }) {
753
- const { t: i } = Q(), [m, f] = N(!1), [l, w] = N(""), [R, p] = N(""), M = ee(), v = ee(), H = (c, I) => {
754
- const C = `<img src="${ke(c)}" alt="${ke(I)}" loading="lazy">`;
755
- f(!1), w(""), p(""), window.requestAnimationFrame(() => {
756
- d(), n(C);
757
- });
758
- }, b = () => {
759
- const c = l.trim();
760
- c && H(c, R.trim());
761
- };
762
- return /* @__PURE__ */ u(A.Root, { open: m, onOpenChange: f, children: [
763
- /* @__PURE__ */ e(A.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
764
- D,
765
- {
766
- size: "sm",
767
- intent: "ghost",
768
- icon: /* @__PURE__ */ e(gt, {}),
769
- "aria-label": i("editor.image.insert", "Insert image"),
770
- onMouseDown: () => o()
771
- }
772
- ) }),
773
- /* @__PURE__ */ u(A.Content, { children: [
774
- /* @__PURE__ */ e(A.Header, { children: /* @__PURE__ */ e(A.Title, { children: i("editor.image.insert", "Insert image") }) }),
775
- /* @__PURE__ */ u(A.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
776
- s ? /* @__PURE__ */ u("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
777
- /* @__PURE__ */ e("span", { className: ue, children: i("editor.image.upload", "Upload") }),
778
- /* @__PURE__ */ e(
779
- ht,
780
- {
781
- variant: "dropzone",
782
- accept: {
783
- "image/*": [".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"]
784
- },
785
- maxFiles: 1,
786
- onUpload: async (c, { signal: I }) => {
787
- const C = await s(c, I);
788
- H(C, c.name);
789
- }
790
- }
791
- ),
792
- /* @__PURE__ */ e("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: i("editor.image.orUrl", "Or paste an image URL") })
793
- ] }) : null,
794
- /* @__PURE__ */ u("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
795
- /* @__PURE__ */ e("label", { htmlFor: M, className: ue, children: i("editor.image.url", "Image URL") }),
796
- /* @__PURE__ */ e(
797
- ye,
798
- {
799
- id: M,
800
- type: "url",
801
- value: l,
802
- onChange: (c) => w(c.target.value),
803
- placeholder: "https://…"
804
- }
805
- )
806
- ] }),
807
- /* @__PURE__ */ u("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
808
- /* @__PURE__ */ e("label", { htmlFor: v, className: ue, children: i("editor.image.alt", "Alt text") }),
809
- /* @__PURE__ */ e(
810
- ye,
811
- {
812
- id: v,
813
- value: R,
814
- onChange: (c) => p(c.target.value),
815
- placeholder: i(
816
- "editor.image.altPlaceholder",
817
- "Describe the image"
818
- )
819
- }
820
- )
821
- ] })
822
- ] }),
823
- /* @__PURE__ */ u(A.Footer, { children: [
824
- /* @__PURE__ */ e(A.Close, { asChild: !0, children: /* @__PURE__ */ e(te, { intent: "secondary", children: i("editor.ai.cancel", "Cancel") }) }),
825
- /* @__PURE__ */ e(te, { onClick: b, disabled: !l.trim(), children: i("editor.link.insertAction", "Insert") })
826
- ] })
827
- ] })
828
- ] });
829
- }
830
- function br({
831
- run: n,
832
- saveSelection: o,
833
- restoreSelection: d
834
- }) {
835
- const { t: s } = Q(), [i, m] = N("#1f2a5c"), f = () => {
836
- d(), n("module.inline.format", {
837
- tag: "span",
838
- style: { color: i },
839
- type: "toggle"
840
- });
841
- }, l = () => {
842
- d(), n("module.inline.remove", { style: "color" });
843
- };
844
- return /* @__PURE__ */ u(U, { onOpenChange: (w) => w && o(), children: [
845
- /* @__PURE__ */ e(U.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
846
- D,
847
- {
848
- size: "sm",
849
- intent: "ghost",
850
- icon: /* @__PURE__ */ e(Bt, {}),
851
- "aria-label": s("editor.textColor", "Text colour"),
852
- onMouseDown: (w) => {
853
- w.preventDefault(), o();
854
- }
855
- }
856
- ) }),
857
- /* @__PURE__ */ u(U.Content, { side: "bottom", align: "start", children: [
858
- /* @__PURE__ */ e(U.Heading, { children: s("editor.textColor", "Text colour") }),
859
- /* @__PURE__ */ e("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ e(ut, { variant: "inline", value: i, onChange: m }) }),
860
- /* @__PURE__ */ u("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-sm)]", children: [
861
- /* @__PURE__ */ e(te, { size: "sm", intent: "secondary", onClick: l, children: s("editor.color.remove", "Remove colour") }),
862
- /* @__PURE__ */ e(te, { size: "sm", onClick: f, children: s("editor.color.apply", "Apply") })
863
- ] })
864
- ] })
865
- ] });
866
- }
867
- function vr(n, o) {
868
- const d = Array.from({ length: o }, () => "<td><br></td>").join("");
869
- return `<table><tbody>${Array.from({ length: n }, () => `<tr>${d}</tr>`).join("")}</tbody></table>`;
870
- }
871
- function yr({
872
- run: n,
873
- insertHtml: o,
874
- active: d
875
- }) {
876
- const { t: s } = Q(), [i, m] = N({ r: 0, c: 0 }), f = d.has("table");
877
- return /* @__PURE__ */ u(U, { onOpenChange: (l) => !l && m({ r: 0, c: 0 }), children: [
878
- /* @__PURE__ */ e(U.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
879
- D,
880
- {
881
- size: "sm",
882
- intent: "ghost",
883
- icon: /* @__PURE__ */ e(nr, {}),
884
- "aria-label": s("editor.table.insert", "Insert table"),
885
- onMouseDown: (l) => l.preventDefault()
886
- }
887
- ) }),
888
- /* @__PURE__ */ u(U.Content, { side: "bottom", align: "start", children: [
889
- /* @__PURE__ */ e(U.Heading, { children: s("editor.table.insert", "Insert table") }),
890
- /* @__PURE__ */ e(
891
- "div",
892
- {
893
- role: "group",
894
- "aria-label": s("editor.table.sizePicker", "Table size"),
895
- className: "ds:mt-[var(--spacing-sm)] ds:grid ds:grid-cols-6 ds:gap-[var(--spacing-2xs)]",
896
- onMouseLeave: () => m({ r: 0, c: 0 }),
897
- children: Array.from({ length: ve * ve }, (l, w) => {
898
- const R = Math.floor(w / ve) + 1, p = w % ve + 1, M = R <= i.r && p <= i.c;
899
- return /* @__PURE__ */ e(
900
- "button",
901
- {
902
- type: "button",
903
- "aria-label": s("editor.table.sizeCell", "{{r}}×{{c}}", { r: R, c: p }),
904
- onMouseEnter: () => m({ r: R, c: p }),
905
- onClick: () => o(vr(R, p)),
906
- className: `ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ${M ? "ds:bg-[var(--primary)]" : "ds:bg-[var(--muted)]"}`
907
- },
908
- w
909
- );
910
- })
911
- }
912
- ),
913
- /* @__PURE__ */ e("p", { className: "ds:mt-[var(--spacing-xs)] ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: i.r > 0 ? s("editor.table.sizeCell", "{{r}}×{{c}}", {
914
- r: i.r,
915
- c: i.c
916
- }) : s("editor.table.sizeHint", "Pick a size") }),
917
- f ? /* @__PURE__ */ u(De, { children: [
918
- /* @__PURE__ */ e("div", { className: "ds:my-[var(--spacing-sm)] ds:h-[var(--border-width-sm)] ds:bg-[var(--border)]" }),
919
- /* @__PURE__ */ e("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: ur.map((l) => /* @__PURE__ */ u(
920
- "button",
921
- {
922
- type: "button",
923
- onClick: () => n(l.command),
924
- className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] ds:text-start ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)] ds:hover:bg-[var(--muted)]",
925
- children: [
926
- /* @__PURE__ */ e(
927
- "span",
928
- {
929
- "aria-hidden": "true",
930
- className: "ds:inline-flex ds:size-4 ds:shrink-0 ds:items-center ds:justify-center ds:text-[color:var(--muted-foreground)]",
931
- children: l.icon
932
- }
933
- ),
934
- s(l.label[0], l.label[1])
935
- ]
936
- },
937
- l.id
938
- )) })
939
- ] }) : null
940
- ] })
941
- ] });
942
- }
943
- function kr({
944
- run: n,
945
- active: o,
946
- preset: d,
947
- insertHtml: s,
948
- saveSelection: i,
949
- restoreSelection: m,
950
- getSelectedText: f,
951
- uploadImage: l,
952
- enableColor: w = !1,
953
- enableImage: R = !1,
954
- enableTable: p = !1
955
- }) {
956
- const { t: M } = Q(), v = w || R || p, H = (b) => b.preventDefault();
957
- return /* @__PURE__ */ u(
958
- "div",
959
- {
960
- role: "toolbar",
961
- "aria-label": M("editor.toolbarLabel"),
962
- className: mr(),
963
- "data-component": "editor-toolbar",
964
- children: [
965
- cr[d].map((b) => {
966
- if (b === "format")
967
- return /* @__PURE__ */ e(
968
- fr,
969
- {
970
- run: n,
971
- active: o,
972
- onTriggerDown: H
973
- },
974
- "format"
975
- );
976
- if (b === "link")
977
- return /* @__PURE__ */ e(
978
- gr,
979
- {
980
- insertHtml: s,
981
- saveSelection: i,
982
- restoreSelection: m,
983
- getSelectedText: f
984
- },
985
- "link"
986
- );
987
- const c = dr[b];
988
- return /* @__PURE__ */ e(
989
- D,
990
- {
991
- size: "sm",
992
- intent: "ghost",
993
- icon: c.icon,
994
- "aria-label": M(c.label[0], c.label[1]),
995
- "aria-pressed": c.toggle ? o.has(c.toggle) : void 0,
996
- onMouseDown: H,
997
- onClick: () => n(...c.command)
998
- },
999
- c.id
1000
- );
1001
- }),
1002
- v ? /* @__PURE__ */ e("span", { "aria-hidden": "true", className: hr }) : null,
1003
- w ? /* @__PURE__ */ e(
1004
- br,
1005
- {
1006
- run: n,
1007
- saveSelection: i,
1008
- restoreSelection: m
1009
- }
1010
- ) : null,
1011
- R ? /* @__PURE__ */ e(
1012
- pr,
1013
- {
1014
- insertHtml: s,
1015
- saveSelection: i,
1016
- restoreSelection: m,
1017
- uploadImage: l
1018
- }
1019
- ) : null,
1020
- p ? /* @__PURE__ */ e(yr, { run: n, insertHtml: s, active: o }) : null
1021
- ]
1022
- }
1023
- );
1024
- }
1025
- function W(n) {
1026
- return nt(n, "rich-text");
1027
- }
1028
- function ze(n = "") {
1029
- const o = String(n).trim();
1030
- if (o === "" || o === "<p><br></p>" || o === "<p>&nbsp;</p>")
1031
- return "";
1032
- const d = o.replace(/<br\s*\/?>/gi, "").replace(/&nbsp;/gi, "").replace(/<[^>]+>/g, "").trim();
1033
- return d === "" && /<img\b[^>]*>/i.test(o) ? o : d === "" ? "" : o;
1034
- }
1035
- function xr(n) {
1036
- return n.replace(
1037
- /<img(?![^>]*\sloading=)([^>]*)>/gi,
1038
- '<img loading="lazy"$1>'
1039
- );
1040
- }
1041
- function wr(n) {
1042
- if (!n || typeof n != "object") return;
1043
- const o = n, d = (s) => {
1044
- if (s && typeof s == "object" && "url" in s) {
1045
- const i = s.url;
1046
- return typeof i == "string" ? i : void 0;
1047
- }
1048
- };
1049
- return typeof o.url == "string" ? o.url : d(o.file) ?? d(o.data) ?? Object.values(o).map(d).find(Boolean);
1050
- }
1051
- function Cr(n) {
1052
- if (n) return n;
1053
- if (typeof window > "u") return null;
1054
- const o = window;
1055
- return o.$R ?? o.Redactor ?? null;
1056
- }
1057
- const Nr = {
1058
- bold: ["module.inline.format", { tag: "b" }],
1059
- italic: ["module.inline.format", { tag: "i" }],
1060
- strikethrough: ["module.inline.format", { tag: "del" }],
1061
- bulletedList: ["module.list.toggle", "ul"],
1062
- numberedList: ["module.list.toggle", "ol"],
1063
- heading: ["module.block.format", { tag: "h2" }],
1064
- quote: ["module.block.format", { tag: "blockquote" }],
1065
- paragraph: ["module.block.format", { tag: "p" }]
1066
- }, zr = {
1067
- zh: "zh_cn",
1068
- pt: "pt_br"
1069
- };
1070
- function Mr(n) {
1071
- const o = n.split("-")[0];
1072
- return zr[o] ?? o ?? "en";
1073
- }
1074
- const Rr = _e(
1075
- "redactor-theme-alfadocs ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"
1076
- ), Tr = _e(
1077
- [
1078
- "ds:block ds:[inline-size:100%]",
1079
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1080
- "ds:bg-[var(--background)] ds:text-[var(--foreground)]",
1081
- "ds:shadow-[var(--shadow-md)]",
1082
- "ds:font-[family-name:var(--font-sans)] ds:text-[length:var(--font-size-base)]",
1083
- "ds:p-[var(--spacing-md)] ds:[min-block-size:var(--rich-text-editor-min-block-size)]",
1084
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1085
- "ds:focus-visible:outline-solid",
1086
- "ds:focus-visible:outline-[var(--ring)]",
1087
- "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1088
- "ds:forced-colors:focus-visible:outline-[CanvasText]"
1089
- ].join(" ")
1090
- ), Fe = [
1091
- "ds:inline-flex ds:items-center ds:justify-center",
1092
- "ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]",
1093
- "ds:text-[color:var(--primary-foreground)]",
1094
- "ds:transition-colors",
1095
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1096
- "ds:focus-visible:outline-solid",
1097
- "ds:focus-visible:outline-[var(--primary-foreground)]",
1098
- "ds:focus-visible:[outline-offset:calc(var(--focus-ring-width)*-1)]"
1099
- ].join(" "), Oe = `${Fe} ds:hover:bg-[color-mix(in_srgb,var(--primary-foreground)_15%,transparent)]`, _r = `${Fe} ds:bg-[var(--destructive)] ds:hover:bg-[color-mix(in_srgb,var(--destructive)_88%,var(--primary-foreground))]`, Ir = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", Sr = et(
1100
- ({
1101
- id: n,
1102
- defaultValue: o,
1103
- value: d,
1104
- onChange: s,
1105
- toolbar: i = "standard",
1106
- placeholder: m,
1107
- readOnly: f = !1,
1108
- ariaLabel: l,
1109
- minHeight: w,
1110
- className: R,
1111
- redactor: p,
1112
- options: M,
1113
- plugins: v,
1114
- lang: H,
1115
- imageUploadUrl: b,
1116
- onKeyDown: c,
1117
- onRequestAiDraft: I,
1118
- aiDraftFormat: C = "html",
1119
- aiPrivacyNotice: P,
1120
- onDictate: T
1121
- }, re) => {
1122
- const { t: L, i18n: X } = Q(), B = ee(), Z = Ee(
1123
- () => `rte-${B.replace(/[^a-zA-Z0-9-_]/g, "")}`,
1124
- [B]
1125
- ), y = `#${Z}`, E = $(null), q = $(null), ie = $(!1), me = $(f), J = $(null), [h, S] = N(!1), [Y, j] = N(!1), [Pe, Be] = N(
1126
- () => /* @__PURE__ */ new Set()
1127
- ), se = $(null), O = $(s), he = $(c);
1128
- G(() => {
1129
- O.current = s, he.current = c;
1130
- }, [s, c]);
1131
- const Ve = $(
1132
- (() => {
1133
- const t = d ?? o ?? "";
1134
- return t ? W(t) : "";
1135
- })()
1136
- ), le = x(() => {
1137
- var r;
1138
- const t = q.current;
1139
- if (t)
1140
- try {
1141
- const a = t(y, "source.getCode");
1142
- if (typeof a == "string") return a;
1143
- } catch {
1144
- }
1145
- return ((r = E.current) == null ? void 0 : r.value) ?? "";
1146
- }, [y]), V = x(
1147
- (t, ...r) => {
1148
- const a = q.current;
1149
- if (!a) return !1;
1150
- const g = me.current;
1151
- if (g)
1152
- try {
1153
- a(y, "disableReadOnly");
1154
- } catch {
1155
- }
1156
- try {
1157
- return a(y, t, ...r), !0;
1158
- } catch {
1159
- return !1;
1160
- } finally {
1161
- if (g)
1162
- try {
1163
- a(y, "enableReadOnly");
1164
- } catch {
1165
- }
1166
- }
1167
- },
1168
- [y]
1169
- ), K = x(
1170
- (t, r) => {
1171
- var ce;
1172
- const a = (r == null ? void 0 : r.asHtml) ?? !0, g = a ? W(t) : t;
1173
- if (V(a ? "insertion.insertHtml" : "insertion.insertText", g)) return;
1174
- const k = E.current;
1175
- if (!k) return;
1176
- const oe = k.selectionStart ?? k.value.length, ae = k.selectionEnd ?? k.value.length;
1177
- k.value = k.value.slice(0, oe) + g + k.value.slice(ae);
1178
- const pe = oe + g.length;
1179
- try {
1180
- k.setSelectionRange(pe, pe);
1181
- } catch {
1182
- }
1183
- (ce = O.current) == null || ce.call(O, { html: W(k.value), markdown: "" });
1184
- },
1185
- [V]
1186
- ), xe = $(null), ne = x(() => {
1187
- var g;
1188
- const t = (g = J.current) == null ? void 0 : g.querySelector(".redactor-in"), r = typeof window < "u" ? window.getSelection() : null, a = /* @__PURE__ */ new Set();
1189
- if (t && r && r.anchorNode && t.contains(r.anchorNode) && typeof document.queryCommandState == "function") {
1190
- r.rangeCount > 0 && (xe.current = r.getRangeAt(0).cloneRange());
1191
- try {
1192
- document.queryCommandState("bold") && a.add("bold"), document.queryCommandState("italic") && a.add("italic"), document.queryCommandState("strikeThrough") && a.add("strike"), document.queryCommandState("insertUnorderedList") && a.add("ul"), document.queryCommandState("insertOrderedList") && a.add("ol");
1193
- const _ = String(
1194
- document.queryCommandValue("formatBlock") || ""
1195
- ).toLowerCase();
1196
- /^h[1-6]$/.test(_) ? (a.add("heading"), a.add(_)) : _ === "blockquote" ? a.add("quote") : a.add("paragraph");
1197
- const k = r.anchorNode.nodeType === Node.TEXT_NODE ? r.anchorNode.parentElement : r.anchorNode;
1198
- k && t.contains(k) && k.closest("table") && a.add("table");
1199
- } catch {
1200
- }
1201
- }
1202
- Be(
1203
- (_) => _.size === a.size && [...a].every((k) => _.has(k)) ? _ : a
1204
- );
1205
- }, []), we = x(
1206
- (t, ...r) => {
1207
- V(t, ...r), typeof window < "u" ? window.requestAnimationFrame(() => ne()) : ne();
1208
- },
1209
- [V, ne]
1210
- ), We = x(
1211
- (t) => {
1212
- K(t, { asHtml: !0 }), typeof window < "u" && window.requestAnimationFrame(() => ne());
1213
- },
1214
- [K, ne]
1215
- ), Ge = x(() => {
1216
- var r;
1217
- if (typeof window < "u") {
1218
- const a = (r = J.current) == null ? void 0 : r.querySelector(".redactor-in"), g = window.getSelection();
1219
- a && g && g.rangeCount > 0 && g.anchorNode && a.contains(g.anchorNode) && (xe.current = g.getRangeAt(0).cloneRange());
1220
- }
1221
- const t = q.current;
1222
- if (t)
1223
- try {
1224
- t(y, "selection.save");
1225
- } catch {
1226
- }
1227
- }, [y]), Ue = x(() => {
1228
- const t = q.current;
1229
- if (!t) return;
1230
- try {
1231
- t(y, "editor.focus");
1232
- } catch {
1233
- }
1234
- const r = xe.current;
1235
- if (r && typeof window < "u") {
1236
- const a = window.getSelection();
1237
- if (a)
1238
- try {
1239
- a.removeAllRanges(), a.addRange(r);
1240
- return;
1241
- } catch {
1242
- }
1243
- }
1244
- try {
1245
- t(y, "selection.restore");
1246
- } catch {
1247
- }
1248
- }, [y]), Qe = x(() => {
1249
- var a;
1250
- if (typeof window > "u") return "";
1251
- const t = (a = J.current) == null ? void 0 : a.querySelector(".redactor-in"), r = window.getSelection();
1252
- return !t || !r || !r.anchorNode || !t.contains(r.anchorNode) ? "" : r.toString();
1253
- }, []), Xe = x(
1254
- async (t, r) => {
1255
- if (!b) throw new Error("No image upload URL configured.");
1256
- const a = new FormData();
1257
- a.append("file", t);
1258
- const g = await fetch(b, {
1259
- method: "POST",
1260
- body: a,
1261
- credentials: "same-origin",
1262
- signal: r
1263
- });
1264
- if (!g.ok) throw new Error(`Image upload failed (${g.status}).`);
1265
- const _ = wr(await g.json());
1266
- if (!_) throw new Error("Image upload response contained no URL.");
1267
- return _;
1268
- },
1269
- [b]
1270
- ), de = $(null), fe = $(null), [F, Ie] = N(!1), [Ze, Se] = N(!1), ge = x(() => {
1271
- const t = fe.current;
1272
- t != null && t.parentNode && t.parentNode.removeChild(t), fe.current = null;
1273
- }, []), Ae = x((t) => {
1274
- var g;
1275
- const r = (g = J.current) == null ? void 0 : g.querySelector(
1276
- ".redactor-in"
1277
- );
1278
- if (!r) return;
1279
- let a = fe.current;
1280
- if (!a || !r.contains(a)) {
1281
- a = document.createElement("span"), a.setAttribute("data-rte-interim", ""), a.setAttribute("contenteditable", "false");
1282
- const _ = window.getSelection();
1283
- if (_ && _.rangeCount > 0 && r.contains(_.anchorNode)) {
1284
- const k = _.getRangeAt(0);
1285
- k.collapse(!1), k.insertNode(a);
1286
- } else
1287
- r.appendChild(a);
1288
- fe.current = a;
1289
- }
1290
- a.textContent = t;
1291
- }, []), He = x(() => {
1292
- var t;
1293
- (t = de.current) == null || t.abort();
1294
- }, []), $e = x(() => {
1295
- if (!T) return;
1296
- const t = new AbortController();
1297
- de.current = t, Se(!1), Ie(!0), ge(), T({
1298
- signal: t.signal,
1299
- // Interim text shows live in the editor (grey + caret); each final
1300
- // replaces it with committed text at the caret.
1301
- onPartialTranscript: (r) => {
1302
- t.signal.aborted || Ae(r);
1303
- },
1304
- onFinalTranscript: (r) => {
1305
- if (t.signal.aborted) return;
1306
- ge();
1307
- const a = r.trim();
1308
- a && K(`${a} `, { asHtml: !1 });
1309
- }
1310
- }).catch((r) => {
1311
- t.signal.aborted || r && typeof r == "object" && "name" in r && r.name === "AbortError" || Se(!0);
1312
- }).finally(() => {
1313
- ge(), de.current === t && (de.current = null, Ie(!1));
1314
- });
1315
- }, [T, K, ge, Ae]), Le = x(() => {
1316
- F ? He() : $e();
1317
- }, [F, $e, He]);
1318
- G(() => () => {
1319
- var t;
1320
- return (t = de.current) == null ? void 0 : t.abort();
1321
- }, []), G(() => {
1322
- const t = E.current;
1323
- if (!t) return;
1324
- t.value = Ve.current;
1325
- const r = Cr(p);
1326
- if (!r) {
1327
- S(!0);
1328
- return;
1329
- }
1330
- q.current = r;
1331
- const a = {
1332
- lang: H ?? Mr(X.language || "en"),
1333
- // The kit renders its OWN toolbar (EditorToolbar) and drives Redactor
1334
- // via the command API, so Redactor's native toolbar is suppressed.
1335
- toolbar: !1,
1336
- plugins: v ?? [],
1337
- placeholder: m ?? L("editor.placeholder"),
1338
- toolbarFixed: !1,
1339
- // Platform parity (RedactorWysiwyg.js:84): no inline shortcode expansion.
1340
- shortcodes: !1,
1341
- imageEditable: !1,
1342
- imageResizable: !0
1343
- }, g = b ? { imageUpload: b } : {}, _ = (M == null ? void 0 : M.callbacks) ?? {}, k = {
1344
- ...a,
1345
- ...g,
1346
- ...M ?? {},
1347
- // Re-pin safety-critical keys LAST so consumer `options` can't override
1348
- // the sanitising change handler, re-enable image editing, or turn off
1349
- // drag-resize (platform re-pins both image flags — RedactorWysiwyg.js:115-116).
1350
- imageEditable: !1,
1351
- imageResizable: !0,
1352
- callbacks: {
1353
- ..._,
1354
- changed(oe) {
1355
- const ae = ze(xr(oe)), pe = W(ae);
1356
- ie.current = !0, O.current && (se.current && clearTimeout(se.current), se.current = setTimeout(() => {
1357
- var ce;
1358
- (ce = O.current) == null || ce.call(O, { html: pe, markdown: "" });
1359
- }, 100));
1360
- },
1361
- keydown(oe) {
1362
- var ae;
1363
- (ae = he.current) == null || ae.call(he, oe);
1364
- },
1365
- observe() {
1366
- ne();
1367
- }
1368
- }
1369
- };
1370
- try {
1371
- if (r(y, k), f)
1372
- try {
1373
- r(y, "enableReadOnly");
1374
- } catch {
1375
- }
1376
- } catch {
1377
- S(!0);
1378
- }
1379
- return () => {
1380
- se.current && clearTimeout(se.current);
1381
- try {
1382
- r(y, "destroy");
1383
- } catch {
1384
- }
1385
- q.current = null;
1386
- };
1387
- }, []), G(() => {
1388
- if (!q.current || d === void 0) return;
1389
- if (ie.current) {
1390
- ie.current = !1;
1391
- return;
1392
- }
1393
- const t = W(ze(d));
1394
- ze(le()) !== t && V("source.setCode", t);
1395
- }, [d, le, V]), G(() => {
1396
- me.current = f;
1397
- const t = q.current;
1398
- if (t)
1399
- try {
1400
- t(y, f ? "enableReadOnly" : "disableReadOnly");
1401
- } catch {
1402
- }
1403
- }, [f, y]), G(() => {
1404
- if (!h || d === void 0) return;
1405
- const t = E.current;
1406
- if (!t) return;
1407
- const r = W(d);
1408
- t.value !== r && document.activeElement !== t && (t.value = r);
1409
- }, [h, d]);
1410
- const Ce = Ee(
1411
- () => ({
1412
- getHTML() {
1413
- return le();
1414
- },
1415
- getText() {
1416
- return le().replace(/<[^>]*>/g, " ").replace(/&nbsp;/gi, " ").replace(/\s+/g, " ").trim();
1417
- },
1418
- getMarkdown() {
1419
- return "";
1420
- },
1421
- setContent(t) {
1422
- const r = W(t);
1423
- V("source.setCode", r) || E.current && (E.current.value = r);
1424
- },
1425
- insertAtCursor: K,
1426
- applyFormat(t) {
1427
- const r = Nr[t];
1428
- r && we(...r);
1429
- },
1430
- focus() {
1431
- var r;
1432
- const t = q.current;
1433
- if (t)
1434
- try {
1435
- t(y, "editor.focus");
1436
- return;
1437
- } catch {
1438
- }
1439
- (r = E.current) == null || r.focus();
1440
- },
1441
- clear() {
1442
- V("source.setCode", "") || E.current && (E.current.value = "");
1443
- }
1444
- }),
1445
- [y, le, V, K, we]
1446
- );
1447
- tt(re, () => Ce, [Ce]), ot(or, Ce, n);
1448
- const Je = x(
1449
- (t) => {
1450
- var r;
1451
- (r = O.current) == null || r.call(O, {
1452
- html: W(t.target.value),
1453
- markdown: ""
1454
- });
1455
- },
1456
- []
1457
- ), Ye = l ?? L("editor.regionLabel"), Ke = m ?? L("editor.placeholder");
1458
- return /* @__PURE__ */ u(
1459
- "div",
1460
- {
1461
- ref: J,
1462
- className: [Rr(), R].filter(Boolean).join(" "),
1463
- "data-component": "rich-text-editor",
1464
- "data-component-id": n,
1465
- "data-min-height": w,
1466
- children: [
1467
- !h && !f ? /* @__PURE__ */ e(
1468
- kr,
1469
- {
1470
- run: we,
1471
- active: Pe,
1472
- preset: i,
1473
- insertHtml: We,
1474
- saveSelection: Ge,
1475
- restoreSelection: Ue,
1476
- getSelectedText: Qe,
1477
- uploadImage: b ? Xe : void 0,
1478
- enableColor: (v == null ? void 0 : v.includes("fontcolor")) ?? !1,
1479
- enableImage: !!b,
1480
- enableTable: (v == null ? void 0 : v.includes("table")) ?? !1
1481
- }
1482
- ) : null,
1483
- /* @__PURE__ */ u("div", { className: "ds:relative", children: [
1484
- /* @__PURE__ */ e(
1485
- "textarea",
1486
- {
1487
- ref: E,
1488
- id: Z,
1489
- "aria-label": Ye,
1490
- "aria-multiline": "true",
1491
- placeholder: Ke,
1492
- onChange: h ? Je : void 0,
1493
- readOnly: h ? f : void 0,
1494
- className: h ? Tr() : void 0
1495
- }
1496
- ),
1497
- I && T ? /* @__PURE__ */ u("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10 ds:flex ds:items-center ds:overflow-hidden ds:rounded-full ds:bg-[var(--primary)] ds:shadow-[var(--shadow-lg)]", children: [
1498
- /* @__PURE__ */ e(
1499
- "button",
1500
- {
1501
- type: "button",
1502
- onClick: Le,
1503
- "aria-pressed": F,
1504
- "aria-label": L(F ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
1505
- className: F ? _r : Oe,
1506
- children: F ? /* @__PURE__ */ e(
1507
- Me,
1508
- {
1509
- "aria-hidden": "true",
1510
- className: "ds:size-5 ds:fill-current"
1511
- }
1512
- ) : /* @__PURE__ */ e(Re, { "aria-hidden": "true", className: "ds:size-5" })
1513
- }
1514
- ),
1515
- /* @__PURE__ */ e(
1516
- "span",
1517
- {
1518
- "aria-hidden": "true",
1519
- className: "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[color-mix(in_srgb,var(--primary-foreground)_35%,transparent)]"
1520
- }
1521
- ),
1522
- /* @__PURE__ */ e(
1523
- "button",
1524
- {
1525
- type: "button",
1526
- onClick: () => j(!0),
1527
- "aria-label": L("editor.ai.helpMeWrite"),
1528
- className: Oe,
1529
- children: /* @__PURE__ */ e(Te, { "aria-hidden": "true", className: "ds:size-5" })
1530
- }
1531
- )
1532
- ] }) : T ? /* @__PURE__ */ e("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10", children: /* @__PURE__ */ e(
1533
- D,
1534
- {
1535
- size: "lg",
1536
- intent: "primary",
1537
- icon: F ? /* @__PURE__ */ e(Me, { className: "ds:fill-current" }) : /* @__PURE__ */ e(Re, {}),
1538
- "aria-pressed": F,
1539
- "aria-label": L(F ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
1540
- onClick: Le,
1541
- className: F ? `${Ir} ds:rounded-full ds:shadow-[var(--shadow-lg)]` : "ds:rounded-full ds:shadow-[var(--shadow-lg)]"
1542
- }
1543
- ) }) : I ? /* @__PURE__ */ e("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10", children: /* @__PURE__ */ e(
1544
- D,
1545
- {
1546
- size: "lg",
1547
- intent: "primary",
1548
- icon: /* @__PURE__ */ e(Te, {}),
1549
- "aria-label": L("editor.ai.helpMeWrite"),
1550
- onClick: () => j(!0),
1551
- className: "ds:rounded-full ds:shadow-[var(--shadow-lg)]"
1552
- }
1553
- ) }) : null,
1554
- I ? /* @__PURE__ */ e(
1555
- lr,
1556
- {
1557
- open: Y,
1558
- onClose: () => j(!1),
1559
- onRequestAiDraft: I,
1560
- onInsert: (t) => K(t, { asHtml: C !== "text" }),
1561
- previewAsHtml: C !== "text",
1562
- privacyNotice: P,
1563
- onDictate: T
1564
- }
1565
- ) : null
1566
- ] }),
1567
- T && Ze ? /* @__PURE__ */ e(
1568
- "p",
1569
- {
1570
- role: "alert",
1571
- className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
1572
- children: L("editor.ai.dictationError")
1573
- }
1574
- ) : null
1575
- ]
1576
- }
1577
- );
1578
- }
1579
- );
1580
- Sr.displayName = "RichTextEditor";
1581
- export {
1582
- Sr as R,
1583
- or as r,
1584
- Rr as w
1585
- };
1586
- //# sourceMappingURL=rich-text-editor-B5XQNxe8.js.map