@alfadocs/ui-kit 1.147.2 → 1.149.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{appointment-timeline-D5qbZ7in.js → appointment-timeline-CuZW-CGT.js} +2 -2
- package/dist/_chunks/{bill-line-table-DnkFqMnM.js → bill-line-table-B8Cc2pTH.js} +2 -2
- package/dist/_chunks/button-group-CHQD8GJ0.js +449 -0
- package/dist/_chunks/{calendar-appointment-editor-dialog-CoIFwj9g.js → calendar-appointment-editor-dialog-Dx9_KIWA.js} +7 -7
- package/dist/_chunks/{calendar-waiting-list-panel-DuALuqLD.js → calendar-waiting-list-panel-BKBHfBpn.js} +3 -3
- package/dist/_chunks/{calendar.sheets-CueyPkTT.js → calendar.sheets-lgAqJB34.js} +3 -3
- package/dist/_chunks/{data-grid-CujX-2tF.js → data-grid-CkzbCZSo.js} +486 -476
- package/dist/_chunks/{default-tabs-CqP1uWdx.js → default-tabs-C45FVzsG.js} +3 -3
- package/dist/_chunks/{face-scheme-ByYeboH9.js → face-scheme-BC2whb1S.js} +2 -2
- package/dist/_chunks/{invoice-upload-list-srvWy5_d.js → invoice-upload-list-BReimsvV.js} +3 -3
- package/dist/_chunks/notes-panel-Cw06dLDm.js +1135 -0
- package/dist/_chunks/prescription-history-CQuJmd4H.js +1846 -0
- package/dist/_chunks/rich-text-editor-eGdYDPK2.js +4405 -0
- package/dist/_chunks/task-editor-4zFL10oM.js +1153 -0
- package/dist/_chunks/{tasks-panel-DsjfS_k5.js → tasks-panel-BDPQPOP6.js} +475 -461
- package/dist/_chunks/{toolbar-z_6tE7zG.js → toolbar-B9oh9XY9.js} +2 -2
- package/dist/_chunks/{use-appointment-details-read-CC74Y-r5.js → use-appointment-details-read-Bl1DHXQ2.js} +568 -554
- package/dist/agent-catalog.json +9 -7
- package/dist/agent-i18n/en.json +4 -4
- package/dist/appointment-editor-panel/index.js +1 -1
- package/dist/aws-transcribe/index.js +287 -181
- package/dist/browser-support.js +1 -1
- package/dist/calendar-action-buttons/index.js +1 -1
- package/dist/components/_shared/save-outcome.d.ts +23 -0
- package/dist/components/appointment-details-panel/index.js +1 -1
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/bill-line-table/index.js +1 -1
- package/dist/components/bill-table/index.js +1 -1
- package/dist/components/button-group/button-group.d.ts +2 -1
- package/dist/components/button-group/index.js +1 -1
- package/dist/components/data-grid/data-grid.variants.d.ts +7 -1
- package/dist/components/data-grid/index.js +2 -2
- package/dist/components/face-scheme/index.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/invoice-upload-list/index.js +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/rich-text-editor/help-me-write-overlay.d.ts +12 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.d.ts +5 -3
- package/dist/components/task-editor/index.js +1 -1
- package/dist/components/task-editor/use-task-editor-form.d.ts +7 -1
- package/dist/components/tasks-panel/index.js +1 -1
- package/dist/core.css +1 -1
- package/dist/find-free-slots-panel/index.js +1 -1
- package/dist/host-compat.css +7 -1
- package/dist/i18n/locales/ar.d.ts +1 -0
- package/dist/i18n/locales/ar.js +2 -1
- package/dist/i18n/locales/de.d.ts +1 -0
- package/dist/i18n/locales/de.js +2 -1
- package/dist/i18n/locales/el.d.ts +1 -0
- package/dist/i18n/locales/el.js +2 -1
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.js +2 -1
- package/dist/i18n/locales/es.d.ts +1 -0
- package/dist/i18n/locales/es.js +2 -1
- package/dist/i18n/locales/fr.d.ts +1 -0
- package/dist/i18n/locales/fr.js +2 -1
- package/dist/i18n/locales/hi.d.ts +1 -0
- package/dist/i18n/locales/hi.js +2 -1
- package/dist/i18n/locales/it.d.ts +1 -0
- package/dist/i18n/locales/it.js +2 -1
- package/dist/i18n/locales/ja.d.ts +1 -0
- package/dist/i18n/locales/ja.js +2 -1
- package/dist/i18n/locales/nl.d.ts +1 -0
- package/dist/i18n/locales/nl.js +2 -1
- package/dist/i18n/locales/pl.d.ts +1 -0
- package/dist/i18n/locales/pl.js +2 -1
- package/dist/i18n/locales/pt.d.ts +1 -0
- package/dist/i18n/locales/pt.js +2 -1
- package/dist/i18n/locales/ro.d.ts +1 -0
- package/dist/i18n/locales/ro.js +2 -1
- package/dist/i18n/locales/ru.d.ts +1 -0
- package/dist/i18n/locales/ru.js +2 -1
- package/dist/i18n/locales/sq.d.ts +1 -0
- package/dist/i18n/locales/sq.js +2 -1
- package/dist/i18n/locales/sv.d.ts +1 -0
- package/dist/i18n/locales/sv.js +2 -1
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/locales/tr.js +2 -1
- package/dist/i18n/locales/zh.d.ts +1 -0
- package/dist/i18n/locales/zh.js +2 -1
- package/dist/index.js +1408 -1404
- package/dist/locales/ar.json +2 -1
- package/dist/locales/de.json +2 -1
- package/dist/locales/el.json +2 -1
- package/dist/locales/en.json +2 -1
- package/dist/locales/es.json +2 -1
- package/dist/locales/fr.json +2 -1
- package/dist/locales/hi.json +2 -1
- package/dist/locales/it.json +2 -1
- package/dist/locales/ja.json +2 -1
- package/dist/locales/nl.json +2 -1
- package/dist/locales/pl.json +2 -1
- package/dist/locales/pt.json +2 -1
- package/dist/locales/ro.json +2 -1
- package/dist/locales/ru.json +2 -1
- package/dist/locales/sq.json +2 -1
- package/dist/locales/sv.json +2 -1
- package/dist/locales/tr.json +2 -1
- package/dist/locales/zh.json +2 -1
- package/dist/online-bookings-panel/index.js +1 -1
- package/dist/patterns/calendar/index.js +2 -2
- package/dist/patterns/prescription/index.d.ts +1 -1
- package/dist/patterns/prescription/index.js +1 -1
- package/dist/patterns/prescription/prescription-history.d.ts +28 -0
- package/dist/save-outcome/index.js +20 -0
- package/dist/speech/aws-transcribe.d.ts +30 -6
- package/dist/tokens.css +1 -1
- package/dist/waiting-list-panel/index.js +2 -2
- package/package.json +5 -1
- package/dist/_chunks/button-group-N60L3HMa.js +0 -408
- package/dist/_chunks/notes-panel-BHMnLbEH.js +0 -1116
- package/dist/_chunks/prescription-history-CFs3JMIE.js +0 -1773
- package/dist/_chunks/rich-text-editor-BAcJq1PO.js +0 -4359
- package/dist/_chunks/task-editor-B9YpfwcW.js +0 -1095
|
@@ -0,0 +1,4405 @@
|
|
|
1
|
+
import { jsx as t, jsxs as A, Fragment as je } from "react/jsx-runtime";
|
|
2
|
+
import { useId as Ve, useState as T, useRef as x, useEffect as I, useCallback as C, Fragment as xt, useLayoutEffect as ci, forwardRef as di, useMemo as vt, useImperativeHandle as ui } from "react";
|
|
3
|
+
import { c as Ct } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as ae } from "react-i18next";
|
|
5
|
+
import { SafeHtml as mi, sanitiseHtml as fi } from "../safe-html/index.js";
|
|
6
|
+
import { a as gi, c as hi, d as pi, b as so } from "./ai-fab-pill-BOu96kCx.js";
|
|
7
|
+
import { u as bi } from "./registry-DvAUVLHh.js";
|
|
8
|
+
import { u as vi } from "./use-ai-sparkle-Cf4yVTLB.js";
|
|
9
|
+
import { S as Yn } from "./spinner-CoflYlEx.js";
|
|
10
|
+
import { A as yi } from "./ai-sparkle-D23NT8Z_.js";
|
|
11
|
+
import { B as Le } from "./button-Dp4j9ygh.js";
|
|
12
|
+
import { I as Z } from "./icon-button-u9VMQn3x.js";
|
|
13
|
+
import { A as wi } from "./ai-permission-notice-C_YB3MBA.js";
|
|
14
|
+
import { T as ki } from "./text-area-COMVJ1yE.js";
|
|
15
|
+
import { E as Gn } from "./editor-overlay-jc9HUeQ2.js";
|
|
16
|
+
import { A as xi } from "./ai-credits-exhausted-notice-DCq27xy2.js";
|
|
17
|
+
import { u as Ci } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
|
|
18
|
+
import { X as Ai } from "./x-B5YnXwCz.js";
|
|
19
|
+
import { R as Ni } from "./rotate-ccw-BBQnIVTr.js";
|
|
20
|
+
import { C as Ti } from "./check-DrFSN__t.js";
|
|
21
|
+
import { L as Kn } from "./loader-circle-BECIU_8N.js";
|
|
22
|
+
import { S as $t } from "./square-DASBRZ0U.js";
|
|
23
|
+
import { M as Vn } from "./mic-CUklMZGF.js";
|
|
24
|
+
import { S as Ei } from "./send-C5kDJ-Mz.js";
|
|
25
|
+
import { D as W } from "./dropdown-menu-Bm1KALnk.js";
|
|
26
|
+
import * as ln from "@radix-ui/react-popover";
|
|
27
|
+
import { u as Ri, f as Mi } from "./non-modal-tab-exit-DqJao_E-.js";
|
|
28
|
+
import { V as lo } from "./variables-menu-C4NcClKi.js";
|
|
29
|
+
import { a as er } from "./tooltip-uEBdD1-5.js";
|
|
30
|
+
import { P as ie } from "./popover-C9O7my6h.js";
|
|
31
|
+
import { D as ue } from "./dialog-239Geb7Z.js";
|
|
32
|
+
import { C as tr } from "./color-picker-5FKOk_z1.js";
|
|
33
|
+
import { S as fn } from "./state-backed-text-input-DVETOhSS.js";
|
|
34
|
+
import { C as Si } from "./checkbox-DV4sNDeB.js";
|
|
35
|
+
import { F as zi } from "./file-upload-DQc0LsBM.js";
|
|
36
|
+
import { c as P } from "./createLucideIcon-DhHxpK9K.js";
|
|
37
|
+
import { E as Li } from "./ellipsis-dRo9ouSU.js";
|
|
38
|
+
import { H as _i } from "./highlighter-DSkckT2Q.js";
|
|
39
|
+
import { C as nr } from "./chevron-down-DWE7GSq9.js";
|
|
40
|
+
import { I as Ii } from "./image-B_5MNK0x.js";
|
|
41
|
+
import { P as $i } from "./plus-DzMQ_c6b.js";
|
|
42
|
+
import { S as Hi } from "./settings-d25ju_6L.js";
|
|
43
|
+
import { U as Oi } from "./undo-2-EBxWjj1W.js";
|
|
44
|
+
import { T as Di } from "./trash-2-uumy3fy1.js";
|
|
45
|
+
import { u as Pi, w as yt } from "./ai-credits-notice-B6buIgmV.js";
|
|
46
|
+
/**
|
|
47
|
+
* @license lucide-react v1.22.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/
|
|
52
|
+
const qi = [
|
|
53
|
+
["path", { d: "M4 20h16", key: "14thso" }],
|
|
54
|
+
["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
|
|
55
|
+
["path", { d: "M8 12h8", key: "1wcyev" }]
|
|
56
|
+
], Bi = P("baseline", qi);
|
|
57
|
+
/**
|
|
58
|
+
* @license lucide-react v1.22.0 - ISC
|
|
59
|
+
*
|
|
60
|
+
* This source code is licensed under the ISC license.
|
|
61
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
+
*/
|
|
63
|
+
const Fi = [
|
|
64
|
+
["rect", { width: "13", height: "7", x: "3", y: "3", rx: "1", key: "11xb64" }],
|
|
65
|
+
["path", { d: "m22 15-3-3 3-3", key: "26chmm" }],
|
|
66
|
+
["rect", { width: "13", height: "7", x: "3", y: "14", rx: "1", key: "k6ky7n" }]
|
|
67
|
+
], ji = P("between-horizontal-end", Fi);
|
|
68
|
+
/**
|
|
69
|
+
* @license lucide-react v1.22.0 - ISC
|
|
70
|
+
*
|
|
71
|
+
* This source code is licensed under the ISC license.
|
|
72
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
+
*/
|
|
74
|
+
const Gi = [
|
|
75
|
+
["rect", { width: "13", height: "7", x: "8", y: "3", rx: "1", key: "pkso9a" }],
|
|
76
|
+
["path", { d: "m2 9 3 3-3 3", key: "1agib5" }],
|
|
77
|
+
["rect", { width: "13", height: "7", x: "8", y: "14", rx: "1", key: "1q5fc1" }]
|
|
78
|
+
], Ki = P("between-horizontal-start", Gi);
|
|
79
|
+
/**
|
|
80
|
+
* @license lucide-react v1.22.0 - ISC
|
|
81
|
+
*
|
|
82
|
+
* This source code is licensed under the ISC license.
|
|
83
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
84
|
+
*/
|
|
85
|
+
const Vi = [
|
|
86
|
+
["rect", { width: "7", height: "13", x: "3", y: "3", rx: "1", key: "1fdu0f" }],
|
|
87
|
+
["path", { d: "m9 22 3-3 3 3", key: "17z65a" }],
|
|
88
|
+
["rect", { width: "7", height: "13", x: "14", y: "3", rx: "1", key: "1squn4" }]
|
|
89
|
+
], Wi = P("between-vertical-end", Vi);
|
|
90
|
+
/**
|
|
91
|
+
* @license lucide-react v1.22.0 - ISC
|
|
92
|
+
*
|
|
93
|
+
* This source code is licensed under the ISC license.
|
|
94
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
+
*/
|
|
96
|
+
const Xi = [
|
|
97
|
+
["rect", { width: "7", height: "13", x: "3", y: "8", rx: "1", key: "1fjrkv" }],
|
|
98
|
+
["path", { d: "m15 2-3 3-3-3", key: "1uh6eb" }],
|
|
99
|
+
["rect", { width: "7", height: "13", x: "14", y: "8", rx: "1", key: "w3fjg8" }]
|
|
100
|
+
], Ui = P("between-vertical-start", Xi);
|
|
101
|
+
/**
|
|
102
|
+
* @license lucide-react v1.22.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/
|
|
107
|
+
const Zi = [
|
|
108
|
+
[
|
|
109
|
+
"path",
|
|
110
|
+
{
|
|
111
|
+
d: "M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",
|
|
112
|
+
key: "1ah6g2"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
["rect", { x: "14", y: "2", width: "8", height: "8", rx: "1", key: "88lufb" }]
|
|
116
|
+
], Wn = P("blocks", Zi);
|
|
117
|
+
/**
|
|
118
|
+
* @license lucide-react v1.22.0 - ISC
|
|
119
|
+
*
|
|
120
|
+
* This source code is licensed under the ISC license.
|
|
121
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
+
*/
|
|
123
|
+
const Qi = [
|
|
124
|
+
[
|
|
125
|
+
"path",
|
|
126
|
+
{ 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" }
|
|
127
|
+
]
|
|
128
|
+
], Ji = P("bold", Qi);
|
|
129
|
+
/**
|
|
130
|
+
* @license lucide-react v1.22.0 - ISC
|
|
131
|
+
*
|
|
132
|
+
* This source code is licensed under the ISC license.
|
|
133
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
134
|
+
*/
|
|
135
|
+
const Yi = [
|
|
136
|
+
[
|
|
137
|
+
"path",
|
|
138
|
+
{ d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1", key: "ezmyqa" }
|
|
139
|
+
],
|
|
140
|
+
[
|
|
141
|
+
"path",
|
|
142
|
+
{
|
|
143
|
+
d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",
|
|
144
|
+
key: "e1hn23"
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
], ea = P("braces", Yi);
|
|
148
|
+
/**
|
|
149
|
+
* @license lucide-react v1.22.0 - ISC
|
|
150
|
+
*
|
|
151
|
+
* This source code is licensed under the ISC license.
|
|
152
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
153
|
+
*/
|
|
154
|
+
const ta = [
|
|
155
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
156
|
+
["path", { d: "M12 3v18", key: "108xh3" }]
|
|
157
|
+
], na = P("columns-2", ta);
|
|
158
|
+
/**
|
|
159
|
+
* @license lucide-react v1.22.0 - ISC
|
|
160
|
+
*
|
|
161
|
+
* This source code is licensed under the ISC license.
|
|
162
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
163
|
+
*/
|
|
164
|
+
const ra = [
|
|
165
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
166
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
167
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
168
|
+
["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
|
|
169
|
+
], oa = P("heading-2", ra);
|
|
170
|
+
/**
|
|
171
|
+
* @license lucide-react v1.22.0 - ISC
|
|
172
|
+
*
|
|
173
|
+
* This source code is licensed under the ISC license.
|
|
174
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
+
*/
|
|
176
|
+
const ia = [
|
|
177
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
178
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
179
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
180
|
+
["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
|
|
181
|
+
["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
|
|
182
|
+
], aa = P("heading-3", ia);
|
|
183
|
+
/**
|
|
184
|
+
* @license lucide-react v1.22.0 - ISC
|
|
185
|
+
*
|
|
186
|
+
* This source code is licensed under the ISC license.
|
|
187
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
188
|
+
*/
|
|
189
|
+
const sa = [
|
|
190
|
+
["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
|
|
191
|
+
["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
|
|
192
|
+
["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
|
|
193
|
+
], la = P("italic", sa);
|
|
194
|
+
/**
|
|
195
|
+
* @license lucide-react v1.22.0 - ISC
|
|
196
|
+
*
|
|
197
|
+
* This source code is licensed under the ISC license.
|
|
198
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
199
|
+
*/
|
|
200
|
+
const ca = [
|
|
201
|
+
["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" }],
|
|
202
|
+
["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" }]
|
|
203
|
+
], da = P("link", ca);
|
|
204
|
+
/**
|
|
205
|
+
* @license lucide-react v1.22.0 - ISC
|
|
206
|
+
*
|
|
207
|
+
* This source code is licensed under the ISC license.
|
|
208
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
209
|
+
*/
|
|
210
|
+
const ua = [
|
|
211
|
+
["path", { d: "M11 5h10", key: "1cz7ny" }],
|
|
212
|
+
["path", { d: "M11 12h10", key: "1438ji" }],
|
|
213
|
+
["path", { d: "M11 19h10", key: "11t30w" }],
|
|
214
|
+
["path", { d: "M4 4h1v5", key: "10yrso" }],
|
|
215
|
+
["path", { d: "M4 9h2", key: "r1h2o0" }],
|
|
216
|
+
["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" }]
|
|
217
|
+
], ma = P("list-ordered", ua);
|
|
218
|
+
/**
|
|
219
|
+
* @license lucide-react v1.22.0 - ISC
|
|
220
|
+
*
|
|
221
|
+
* This source code is licensed under the ISC license.
|
|
222
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
223
|
+
*/
|
|
224
|
+
const fa = [
|
|
225
|
+
["path", { d: "M3 5h.01", key: "18ugdj" }],
|
|
226
|
+
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
227
|
+
["path", { d: "M3 19h.01", key: "noohij" }],
|
|
228
|
+
["path", { d: "M8 5h13", key: "1pao27" }],
|
|
229
|
+
["path", { d: "M8 12h13", key: "1za7za" }],
|
|
230
|
+
["path", { d: "M8 19h13", key: "m83p4d" }]
|
|
231
|
+
], ga = P("list", fa);
|
|
232
|
+
/**
|
|
233
|
+
* @license lucide-react v1.22.0 - ISC
|
|
234
|
+
*
|
|
235
|
+
* This source code is licensed under the ISC license.
|
|
236
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
237
|
+
*/
|
|
238
|
+
const ha = [
|
|
239
|
+
["path", { d: "M11 7 6 2", key: "1jwth8" }],
|
|
240
|
+
["path", { d: "M18.992 12H2.041", key: "xw1gg" }],
|
|
241
|
+
[
|
|
242
|
+
"path",
|
|
243
|
+
{
|
|
244
|
+
d: "M21.145 18.38A3.34 3.34 0 0 1 20 16.5a3.3 3.3 0 0 1-1.145 1.88c-.575.46-.855 1.02-.855 1.595A2 2 0 0 0 20 22a2 2 0 0 0 2-2.025c0-.58-.285-1.13-.855-1.595",
|
|
245
|
+
key: "1nkol4"
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
[
|
|
249
|
+
"path",
|
|
250
|
+
{
|
|
251
|
+
d: "m8.5 4.5 2.148-2.148a1.205 1.205 0 0 1 1.704 0l7.296 7.296a1.205 1.205 0 0 1 0 1.704l-7.592 7.592a3.615 3.615 0 0 1-5.112 0l-3.888-3.888a3.615 3.615 0 0 1 0-5.112L5.67 7.33",
|
|
252
|
+
key: "1nk1rd"
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
], pa = P("paint-bucket", ha);
|
|
256
|
+
/**
|
|
257
|
+
* @license lucide-react v1.22.0 - ISC
|
|
258
|
+
*
|
|
259
|
+
* This source code is licensed under the ISC license.
|
|
260
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
+
*/
|
|
262
|
+
const ba = [
|
|
263
|
+
["rect", { width: "16", height: "6", x: "2", y: "2", rx: "2", key: "jcyz7m" }],
|
|
264
|
+
["path", { d: "M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2", key: "1b9h7c" }],
|
|
265
|
+
["rect", { width: "4", height: "6", x: "8", y: "16", rx: "1", key: "d6e7yl" }]
|
|
266
|
+
], va = P("paint-roller", ba);
|
|
267
|
+
/**
|
|
268
|
+
* @license lucide-react v1.22.0 - ISC
|
|
269
|
+
*
|
|
270
|
+
* This source code is licensed under the ISC license.
|
|
271
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
272
|
+
*/
|
|
273
|
+
const ya = [
|
|
274
|
+
[
|
|
275
|
+
"path",
|
|
276
|
+
{
|
|
277
|
+
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",
|
|
278
|
+
key: "e79jfc"
|
|
279
|
+
}
|
|
280
|
+
],
|
|
281
|
+
["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
|
|
282
|
+
["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
|
|
283
|
+
["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
|
|
284
|
+
["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
|
|
285
|
+
], wa = P("palette", ya);
|
|
286
|
+
/**
|
|
287
|
+
* @license lucide-react v1.22.0 - ISC
|
|
288
|
+
*
|
|
289
|
+
* This source code is licensed under the ISC license.
|
|
290
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
+
*/
|
|
292
|
+
const ka = [
|
|
293
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
294
|
+
["path", { d: "M9 3v18", key: "fh3hqa" }]
|
|
295
|
+
], xa = P("panel-left", ka);
|
|
296
|
+
/**
|
|
297
|
+
* @license lucide-react v1.22.0 - ISC
|
|
298
|
+
*
|
|
299
|
+
* This source code is licensed under the ISC license.
|
|
300
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
+
*/
|
|
302
|
+
const Ca = [
|
|
303
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
304
|
+
["path", { d: "M15 3v18", key: "14nvp0" }]
|
|
305
|
+
], Aa = P("panel-right", Ca);
|
|
306
|
+
/**
|
|
307
|
+
* @license lucide-react v1.22.0 - ISC
|
|
308
|
+
*
|
|
309
|
+
* This source code is licensed under the ISC license.
|
|
310
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
+
*/
|
|
312
|
+
const Na = [
|
|
313
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
314
|
+
["path", { d: "M14 9h1", key: "l0svgy" }],
|
|
315
|
+
["path", { d: "M19 9h2", key: "te2zfg" }],
|
|
316
|
+
["path", { d: "M3 9h2", key: "1h4ldw" }],
|
|
317
|
+
["path", { d: "M9 9h1", key: "15jzuz" }]
|
|
318
|
+
], Ta = P("panel-top-dashed", Na);
|
|
319
|
+
/**
|
|
320
|
+
* @license lucide-react v1.22.0 - ISC
|
|
321
|
+
*
|
|
322
|
+
* This source code is licensed under the ISC license.
|
|
323
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
324
|
+
*/
|
|
325
|
+
const Ea = [
|
|
326
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
327
|
+
["path", { d: "M3 9h18", key: "1pudct" }]
|
|
328
|
+
], Ra = P("panel-top", Ea);
|
|
329
|
+
/**
|
|
330
|
+
* @license lucide-react v1.22.0 - ISC
|
|
331
|
+
*
|
|
332
|
+
* This source code is licensed under the ISC license.
|
|
333
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
334
|
+
*/
|
|
335
|
+
const Ma = [
|
|
336
|
+
["path", { d: "M10 3H8", key: "mzdi2d" }],
|
|
337
|
+
["path", { d: "m15.007 5.008 3.987 3.986", key: "1scubj" }],
|
|
338
|
+
["path", { d: "M20 15v4", key: "nmhudv" }],
|
|
339
|
+
[
|
|
340
|
+
"path",
|
|
341
|
+
{
|
|
342
|
+
d: "M21.174 6.813a2.82 2.82 0 0 0-3.986-3.987L3.842 16.175a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
343
|
+
key: "fs0856"
|
|
344
|
+
}
|
|
345
|
+
],
|
|
346
|
+
["path", { d: "M22 17h-4", key: "1sj068" }],
|
|
347
|
+
["path", { d: "M4 5v4", key: "13jjxc" }],
|
|
348
|
+
["path", { d: "M6 7H2", key: "8zbtv0" }],
|
|
349
|
+
["path", { d: "M9 2v2", key: "165o2o" }]
|
|
350
|
+
], Gr = P("pencil-sparkles", Ma);
|
|
351
|
+
/**
|
|
352
|
+
* @license lucide-react v1.22.0 - ISC
|
|
353
|
+
*
|
|
354
|
+
* This source code is licensed under the ISC license.
|
|
355
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
356
|
+
*/
|
|
357
|
+
const Sa = [
|
|
358
|
+
["path", { d: "M13 4v16", key: "8vvj80" }],
|
|
359
|
+
["path", { d: "M17 4v16", key: "7dpous" }],
|
|
360
|
+
["path", { d: "M19 4H9.5a4.5 4.5 0 0 0 0 9H13", key: "sh4n9v" }]
|
|
361
|
+
], za = P("pilcrow", Sa);
|
|
362
|
+
/**
|
|
363
|
+
* @license lucide-react v1.22.0 - ISC
|
|
364
|
+
*
|
|
365
|
+
* This source code is licensed under the ISC license.
|
|
366
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
367
|
+
*/
|
|
368
|
+
const La = [
|
|
369
|
+
[
|
|
370
|
+
"path",
|
|
371
|
+
{
|
|
372
|
+
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",
|
|
373
|
+
key: "rib7q0"
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
[
|
|
377
|
+
"path",
|
|
378
|
+
{
|
|
379
|
+
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",
|
|
380
|
+
key: "1ymkrd"
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
], _a = P("quote", La);
|
|
384
|
+
/**
|
|
385
|
+
* @license lucide-react v1.22.0 - ISC
|
|
386
|
+
*
|
|
387
|
+
* This source code is licensed under the ISC license.
|
|
388
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
389
|
+
*/
|
|
390
|
+
const Ia = [
|
|
391
|
+
["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
|
|
392
|
+
["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
|
|
393
|
+
], $a = P("redo-2", Ia);
|
|
394
|
+
/**
|
|
395
|
+
* @license lucide-react v1.22.0 - ISC
|
|
396
|
+
*
|
|
397
|
+
* This source code is licensed under the ISC license.
|
|
398
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
399
|
+
*/
|
|
400
|
+
const Ha = [
|
|
401
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
402
|
+
["path", { d: "M3 12h18", key: "1i2n21" }]
|
|
403
|
+
], Oa = P("rows-2", Ha);
|
|
404
|
+
/**
|
|
405
|
+
* @license lucide-react v1.22.0 - ISC
|
|
406
|
+
*
|
|
407
|
+
* This source code is licensed under the ISC license.
|
|
408
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
409
|
+
*/
|
|
410
|
+
const Da = [
|
|
411
|
+
["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
|
|
412
|
+
["path", { d: "M8 12h8", key: "1wcyev" }],
|
|
413
|
+
["path", { d: "m16 20 2 2 4-4", key: "13tcca" }]
|
|
414
|
+
], Kr = P("spell-check", Da);
|
|
415
|
+
/**
|
|
416
|
+
* @license lucide-react v1.22.0 - ISC
|
|
417
|
+
*
|
|
418
|
+
* This source code is licensed under the ISC license.
|
|
419
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
420
|
+
*/
|
|
421
|
+
const Pa = [
|
|
422
|
+
["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
|
|
423
|
+
["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
|
|
424
|
+
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
|
|
425
|
+
], qa = P("strikethrough", Pa);
|
|
426
|
+
/**
|
|
427
|
+
* @license lucide-react v1.22.0 - ISC
|
|
428
|
+
*
|
|
429
|
+
* This source code is licensed under the ISC license.
|
|
430
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
431
|
+
*/
|
|
432
|
+
const Ba = [
|
|
433
|
+
["path", { d: "M12 3v18", key: "108xh3" }],
|
|
434
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
435
|
+
["path", { d: "M3 9h18", key: "1pudct" }],
|
|
436
|
+
["path", { d: "M3 15h18", key: "5xshup" }]
|
|
437
|
+
], Fa = P("table", Ba);
|
|
438
|
+
/**
|
|
439
|
+
* @license lucide-react v1.22.0 - ISC
|
|
440
|
+
*
|
|
441
|
+
* This source code is licensed under the ISC license.
|
|
442
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
443
|
+
*/
|
|
444
|
+
const ja = [
|
|
445
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
446
|
+
["path", { d: "M17 12H7", key: "16if0g" }],
|
|
447
|
+
["path", { d: "M19 19H5", key: "vjpgq2" }]
|
|
448
|
+
], co = P("text-align-center", ja);
|
|
449
|
+
/**
|
|
450
|
+
* @license lucide-react v1.22.0 - ISC
|
|
451
|
+
*
|
|
452
|
+
* This source code is licensed under the ISC license.
|
|
453
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
454
|
+
*/
|
|
455
|
+
const Ga = [
|
|
456
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
457
|
+
["path", { d: "M21 12H9", key: "dn1m92" }],
|
|
458
|
+
["path", { d: "M21 19H7", key: "4cu937" }]
|
|
459
|
+
], uo = P("text-align-end", Ga);
|
|
460
|
+
/**
|
|
461
|
+
* @license lucide-react v1.22.0 - ISC
|
|
462
|
+
*
|
|
463
|
+
* This source code is licensed under the ISC license.
|
|
464
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
465
|
+
*/
|
|
466
|
+
const Ka = [
|
|
467
|
+
["path", { d: "M3 5h18", key: "1u36vt" }],
|
|
468
|
+
["path", { d: "M3 12h18", key: "1i2n21" }],
|
|
469
|
+
["path", { d: "M3 19h18", key: "awlh7x" }]
|
|
470
|
+
], Va = P("text-align-justify", Ka);
|
|
471
|
+
/**
|
|
472
|
+
* @license lucide-react v1.22.0 - ISC
|
|
473
|
+
*
|
|
474
|
+
* This source code is licensed under the ISC license.
|
|
475
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
476
|
+
*/
|
|
477
|
+
const Wa = [
|
|
478
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
479
|
+
["path", { d: "M15 12H3", key: "6jk70r" }],
|
|
480
|
+
["path", { d: "M17 19H3", key: "z6ezky" }]
|
|
481
|
+
], mo = P("text-align-start", Wa);
|
|
482
|
+
/**
|
|
483
|
+
* @license lucide-react v1.22.0 - ISC
|
|
484
|
+
*
|
|
485
|
+
* This source code is licensed under the ISC license.
|
|
486
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
487
|
+
*/
|
|
488
|
+
const Xa = [
|
|
489
|
+
["rect", { width: "18", height: "12", x: "3", y: "8", rx: "1", key: "158fvp" }],
|
|
490
|
+
["path", { d: "M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3", key: "s0042v" }],
|
|
491
|
+
["path", { d: "M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3", key: "9wmeh2" }]
|
|
492
|
+
], Xn = P("toy-brick", Xa);
|
|
493
|
+
/**
|
|
494
|
+
* @license lucide-react v1.22.0 - ISC
|
|
495
|
+
*
|
|
496
|
+
* This source code is licensed under the ISC license.
|
|
497
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
498
|
+
*/
|
|
499
|
+
const Ua = [
|
|
500
|
+
["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
|
|
501
|
+
["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
|
|
502
|
+
], Za = P("underline", Ua);
|
|
503
|
+
/**
|
|
504
|
+
* @license lucide-react v1.22.0 - ISC
|
|
505
|
+
*
|
|
506
|
+
* This source code is licensed under the ISC license.
|
|
507
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
508
|
+
*/
|
|
509
|
+
const Qa = [
|
|
510
|
+
[
|
|
511
|
+
"path",
|
|
512
|
+
{
|
|
513
|
+
d: "m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",
|
|
514
|
+
key: "ul74o6"
|
|
515
|
+
}
|
|
516
|
+
],
|
|
517
|
+
["path", { d: "m14 7 3 3", key: "1r5n42" }],
|
|
518
|
+
["path", { d: "M5 6v4", key: "ilb8ba" }],
|
|
519
|
+
["path", { d: "M19 14v4", key: "blhpug" }],
|
|
520
|
+
["path", { d: "M10 2v2", key: "7u0qdc" }],
|
|
521
|
+
["path", { d: "M7 8H3", key: "zfb6yr" }],
|
|
522
|
+
["path", { d: "M21 16h-4", key: "1cnmox" }],
|
|
523
|
+
["path", { d: "M11 3H9", key: "1obp7u" }]
|
|
524
|
+
], Vr = P("wand-sparkles", Qa);
|
|
525
|
+
function Wr(n) {
|
|
526
|
+
return {
|
|
527
|
+
format: n("editor.vendor.format"),
|
|
528
|
+
image: n("editor.vendor.image"),
|
|
529
|
+
file: n("editor.vendor.file"),
|
|
530
|
+
link: n("editor.vendor.link"),
|
|
531
|
+
bold: n("editor.bold"),
|
|
532
|
+
italic: n("editor.italic"),
|
|
533
|
+
deleted: n("editor.strike"),
|
|
534
|
+
underline: n("editor.underline"),
|
|
535
|
+
superscript: n("editor.vendor.superscript"),
|
|
536
|
+
subscript: n("editor.vendor.subscript"),
|
|
537
|
+
"bold-abbr": n("editor.vendor.boldAbbr"),
|
|
538
|
+
"italic-abbr": n("editor.vendor.italicAbbr"),
|
|
539
|
+
"deleted-abbr": n("editor.vendor.deletedAbbr"),
|
|
540
|
+
"underline-abbr": n("editor.vendor.underlineAbbr"),
|
|
541
|
+
"superscript-abbr": n("editor.vendor.superscriptAbbr"),
|
|
542
|
+
"subscript-abbr": n("editor.vendor.subscriptAbbr"),
|
|
543
|
+
lists: n("editor.vendor.lists"),
|
|
544
|
+
"link-insert": n("editor.link.insert"),
|
|
545
|
+
"link-edit": n("editor.link.edit"),
|
|
546
|
+
"link-in-new-tab": n("editor.vendor.linkInNewTab"),
|
|
547
|
+
unlink: n("editor.vendor.unlink"),
|
|
548
|
+
cancel: n("common.cancel"),
|
|
549
|
+
close: n("common.close"),
|
|
550
|
+
insert: n("editor.link.insertAction"),
|
|
551
|
+
save: n("common.save"),
|
|
552
|
+
delete: n("common.delete"),
|
|
553
|
+
text: n("editor.vendor.text"),
|
|
554
|
+
edit: n("editor.vendor.edit"),
|
|
555
|
+
title: n("editor.image.alt"),
|
|
556
|
+
paragraph: n("editor.vendor.paragraph"),
|
|
557
|
+
quote: n("editor.quote"),
|
|
558
|
+
code: n("editor.vendor.code"),
|
|
559
|
+
heading1: n("editor.vendor.heading1"),
|
|
560
|
+
heading2: n("editor.heading2"),
|
|
561
|
+
heading3: n("editor.heading3"),
|
|
562
|
+
heading4: n("editor.vendor.heading4"),
|
|
563
|
+
heading5: n("editor.vendor.heading5"),
|
|
564
|
+
heading6: n("editor.vendor.heading6"),
|
|
565
|
+
filename: n("editor.vendor.filename"),
|
|
566
|
+
optional: n("common.optional"),
|
|
567
|
+
unorderedlist: n("editor.vendor.unorderedlist"),
|
|
568
|
+
orderedlist: n("editor.vendor.orderedlist"),
|
|
569
|
+
outdent: n("editor.vendor.outdent"),
|
|
570
|
+
indent: n("editor.vendor.indent"),
|
|
571
|
+
horizontalrule: n("editor.vendor.horizontalrule"),
|
|
572
|
+
upload: n("editor.image.upload"),
|
|
573
|
+
"upload-label": n("editor.vendor.uploadLabel"),
|
|
574
|
+
"accessibility-help-label": n("editor.regionLabel"),
|
|
575
|
+
caption: n("editor.vendor.caption"),
|
|
576
|
+
bulletslist: n("editor.vendor.bulletslist"),
|
|
577
|
+
numberslist: n("editor.vendor.numberslist"),
|
|
578
|
+
"image-position": n("editor.vendor.imagePosition"),
|
|
579
|
+
none: n("editor.vendor.none"),
|
|
580
|
+
left: n("editor.vendor.left"),
|
|
581
|
+
right: n("editor.vendor.right"),
|
|
582
|
+
center: n("editor.vendor.center"),
|
|
583
|
+
undo: n("editor.undo"),
|
|
584
|
+
redo: n("editor.redo"),
|
|
585
|
+
size: n("editor.vendor.fontSize"),
|
|
586
|
+
"remove-size": n("editor.vendor.removeSize"),
|
|
587
|
+
fontcolor: n("editor.textColor"),
|
|
588
|
+
highlight: n("editor.highlightColor"),
|
|
589
|
+
table: n("editor.vendor.table"),
|
|
590
|
+
"insert-table": n("editor.table.insert"),
|
|
591
|
+
"insert-row-above": n("editor.table.rowAbove"),
|
|
592
|
+
"insert-row-below": n("editor.table.rowBelow"),
|
|
593
|
+
"insert-column-left": n("editor.table.columnLeft"),
|
|
594
|
+
"insert-column-right": n("editor.table.columnRight"),
|
|
595
|
+
"add-head": n("editor.table.addHeader"),
|
|
596
|
+
"delete-head": n("editor.table.deleteHeader"),
|
|
597
|
+
"delete-column": n("editor.table.deleteColumn"),
|
|
598
|
+
"delete-row": n("editor.table.deleteRow"),
|
|
599
|
+
"delete-table": n("editor.table.deleteTable")
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
const Ja = {
|
|
603
|
+
id: "rich-text-editor",
|
|
604
|
+
capabilities: ["edit_inline"],
|
|
605
|
+
state: {
|
|
606
|
+
html: {
|
|
607
|
+
type: "string",
|
|
608
|
+
descriptionKey: "ui.agent.richTextEditor.state.html",
|
|
609
|
+
description: "Sanitised HTML representation of the editor content.",
|
|
610
|
+
read: (n) => n.getHTML()
|
|
611
|
+
},
|
|
612
|
+
text: {
|
|
613
|
+
type: "string",
|
|
614
|
+
descriptionKey: "ui.agent.richTextEditor.state.text",
|
|
615
|
+
description: "Plain-text content of the editor (tags stripped).",
|
|
616
|
+
read: (n) => n.getText()
|
|
617
|
+
},
|
|
618
|
+
markdown: {
|
|
619
|
+
type: "string",
|
|
620
|
+
descriptionKey: "ui.agent.richTextEditor.state.markdown",
|
|
621
|
+
description: "Markdown representation of the editor content. The Redactor engine has no native Markdown serialiser, so this is always empty — read `html` instead.",
|
|
622
|
+
read: (n) => n.getMarkdown()
|
|
623
|
+
},
|
|
624
|
+
aiBusy: {
|
|
625
|
+
type: "boolean",
|
|
626
|
+
descriptionKey: "ui.agent.richTextEditor.state.aiBusy",
|
|
627
|
+
description: "True while a one-shot AI action (a practice template, spelling or auto-format) is rewriting the note. Read `html` once it is false.",
|
|
628
|
+
read: (n) => n.isAiBusy()
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
// Image wrap/align/resize are intentionally NOT agent actions — they target
|
|
632
|
+
// the ephemeral click-selected image the handle can't address. Agents emit
|
|
633
|
+
// `<img class="wysiwyg-img-*" style="width:N%">` via set_content instead.
|
|
634
|
+
actions: {
|
|
635
|
+
set_content: {
|
|
636
|
+
// Replaces the whole document — discards whatever the user had typed.
|
|
637
|
+
safety: "destructive",
|
|
638
|
+
argsType: "{ html: string }",
|
|
639
|
+
argsSchema: {
|
|
640
|
+
type: "object",
|
|
641
|
+
properties: {
|
|
642
|
+
html: {
|
|
643
|
+
type: "string",
|
|
644
|
+
description: "Replacement HTML (sanitised via DOMPurify)."
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
required: ["html"]
|
|
648
|
+
},
|
|
649
|
+
idempotent: !0,
|
|
650
|
+
descriptionKey: "ui.agent.richTextEditor.actions.setContent",
|
|
651
|
+
description: "Replace the editor content. Loses unsaved input.",
|
|
652
|
+
invoke: (n, a) => {
|
|
653
|
+
n.setContent(a.html);
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
insert_at_cursor: {
|
|
657
|
+
// Reversible via the editor's own undo stack — write, not destructive.
|
|
658
|
+
safety: "write",
|
|
659
|
+
argsType: "{ content: string; asHtml?: boolean }",
|
|
660
|
+
argsSchema: {
|
|
661
|
+
type: "object",
|
|
662
|
+
properties: {
|
|
663
|
+
content: {
|
|
664
|
+
type: "string",
|
|
665
|
+
description: "Content to insert at the caret."
|
|
666
|
+
},
|
|
667
|
+
asHtml: {
|
|
668
|
+
type: "boolean",
|
|
669
|
+
description: "Treat content as HTML (sanitised). Pass false for plain text. Defaults to true."
|
|
670
|
+
}
|
|
671
|
+
},
|
|
672
|
+
required: ["content"]
|
|
673
|
+
},
|
|
674
|
+
descriptionKey: "ui.agent.richTextEditor.actions.insertAtCursor",
|
|
675
|
+
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.",
|
|
676
|
+
examples: [
|
|
677
|
+
{
|
|
678
|
+
args: { content: "{{patient.firstName}}", asHtml: !1 },
|
|
679
|
+
note: "Insert a merge variable as plain text."
|
|
680
|
+
}
|
|
681
|
+
],
|
|
682
|
+
invoke: (n, a) => {
|
|
683
|
+
n.insertAtCursor(a.content, { asHtml: a.asHtml });
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
apply_format: {
|
|
687
|
+
// Reversible via undo — write, not destructive.
|
|
688
|
+
safety: "write",
|
|
689
|
+
argsType: "{ format: 'bold' | 'italic' | 'strikethrough' | 'bulletedList' | 'numberedList' | 'heading' | 'quote' | 'paragraph' }",
|
|
690
|
+
argsSchema: {
|
|
691
|
+
type: "object",
|
|
692
|
+
properties: {
|
|
693
|
+
format: {
|
|
694
|
+
type: "string",
|
|
695
|
+
enum: [
|
|
696
|
+
"bold",
|
|
697
|
+
"italic",
|
|
698
|
+
"strikethrough",
|
|
699
|
+
"bulletedList",
|
|
700
|
+
"numberedList",
|
|
701
|
+
"heading",
|
|
702
|
+
"quote",
|
|
703
|
+
"paragraph"
|
|
704
|
+
],
|
|
705
|
+
description: "Block or inline format to toggle/apply."
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
required: ["format"]
|
|
709
|
+
},
|
|
710
|
+
descriptionKey: "ui.agent.richTextEditor.actions.applyFormat",
|
|
711
|
+
description: "Toggle/apply a block or inline format on the current selection (bold, italic, strikethrough, bulleted/numbered list, heading, quote, paragraph).",
|
|
712
|
+
examples: [{ args: { format: "bold" }, note: "Bold the selection." }],
|
|
713
|
+
invoke: (n, a) => {
|
|
714
|
+
n.applyFormat(a.format);
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
clear: {
|
|
718
|
+
// Empties the document — loses unsaved input.
|
|
719
|
+
safety: "destructive",
|
|
720
|
+
idempotent: !0,
|
|
721
|
+
descriptionKey: "ui.agent.richTextEditor.actions.clear",
|
|
722
|
+
description: "Empty the editor. Loses unsaved input.",
|
|
723
|
+
invoke: (n) => {
|
|
724
|
+
n.clear();
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
focus: {
|
|
728
|
+
safety: "read",
|
|
729
|
+
idempotent: !0,
|
|
730
|
+
descriptionKey: "ui.agent.richTextEditor.actions.focus",
|
|
731
|
+
description: "Move keyboard focus to the editor surface.",
|
|
732
|
+
invoke: (n) => {
|
|
733
|
+
n.focus();
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
},
|
|
737
|
+
domHooks: {
|
|
738
|
+
root: { attr: "data-component", value: "rich-text-editor" },
|
|
739
|
+
instanceId: {
|
|
740
|
+
attr: "data-component-id",
|
|
741
|
+
sourceProp: "id",
|
|
742
|
+
description: "Sourced from the id prop."
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}, Ya = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", wt = "ds:!size-[var(--min-target-size)]", es = 384, ts = "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", qn = Ct("ds:flex ds:gap-[var(--spacing-sm)]", {
|
|
746
|
+
variants: { stacked: { true: "ds:flex-col", false: "ds:items-center" } }
|
|
747
|
+
}), Bn = Ct("ds:min-w-0", {
|
|
748
|
+
variants: { stacked: { true: "", false: "ds:flex-1" } }
|
|
749
|
+
}), Xr = Ct(
|
|
750
|
+
"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
751
|
+
{ variants: { stacked: { true: "ds:justify-end", false: "" } } }
|
|
752
|
+
), ns = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", rs = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]";
|
|
753
|
+
function fo({ id: n }) {
|
|
754
|
+
const { t: a } = ae("ui");
|
|
755
|
+
return /* @__PURE__ */ t(
|
|
756
|
+
"p",
|
|
757
|
+
{
|
|
758
|
+
"data-component": "editor-request-error",
|
|
759
|
+
id: n,
|
|
760
|
+
role: "alert",
|
|
761
|
+
className: rs,
|
|
762
|
+
children: a("editor.ai.error")
|
|
763
|
+
}
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
const Ur = [
|
|
767
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
768
|
+
"ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
|
|
769
|
+
"ds:p-[var(--spacing-sm)] ds:[max-block-size:10rem] ds:overflow-y-auto",
|
|
770
|
+
"ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]",
|
|
771
|
+
// The preview renders arbitrary model-generated rich text, and the
|
|
772
|
+
// `rich-text` SafeHtml profile allows ul/ol/li. Inside a
|
|
773
|
+
// [data-component] preflight's list reset still applies and the host
|
|
774
|
+
// undo deliberately does not reach, so markers and indent have to be
|
|
775
|
+
// asked for explicitly — otherwise a generated bullet list previews as
|
|
776
|
+
// flush, marker-less lines.
|
|
777
|
+
"ds:[&_ul]:list-disc ds:[&_ol]:list-decimal",
|
|
778
|
+
"ds:[&_ul]:ps-[var(--spacing-md)] ds:[&_ol]:ps-[var(--spacing-md)]"
|
|
779
|
+
].join(" ");
|
|
780
|
+
function Zr(n, a) {
|
|
781
|
+
return a ? n ? /\s$/.test(n) ? `${n}${a}` : `${n} ${a}` : a : n;
|
|
782
|
+
}
|
|
783
|
+
function Qr(n) {
|
|
784
|
+
return typeof n == "object" && n !== null && "name" in n && n.name === "AiCreditsExhaustedError";
|
|
785
|
+
}
|
|
786
|
+
function os({
|
|
787
|
+
open: n,
|
|
788
|
+
onClose: a,
|
|
789
|
+
onRequestAiDraft: u,
|
|
790
|
+
onInsert: c,
|
|
791
|
+
onCreditsExhausted: g,
|
|
792
|
+
creditsExhausted: h = !1,
|
|
793
|
+
previewAsHtml: y = !0,
|
|
794
|
+
privacyNotice: w,
|
|
795
|
+
onDictate: b
|
|
796
|
+
}) {
|
|
797
|
+
const { t: p } = ae("ui"), E = Ve(), R = Ve(), [L, S] = T(""), [B, f] = T(!1), [m, v] = T(!1), [z, H] = T(!1), D = x(g);
|
|
798
|
+
I(() => {
|
|
799
|
+
D.current = g;
|
|
800
|
+
}, [g]);
|
|
801
|
+
const [j, X] = T(null), F = x(null), [k, se] = T(!1), [Q, oe] = T("listening"), [le, J] = T(""), [Ee, U] = T(""), he = x(null), V = x(null), te = C((_ = !1) => {
|
|
802
|
+
var K;
|
|
803
|
+
V.current && (V.current.keepLate = _), (K = he.current) == null || K.abort();
|
|
804
|
+
}, []), ce = C(() => {
|
|
805
|
+
if (!b) return;
|
|
806
|
+
const _ = new AbortController();
|
|
807
|
+
he.current = _;
|
|
808
|
+
const K = { keepLate: !1 };
|
|
809
|
+
V.current = K;
|
|
810
|
+
let xe = !1;
|
|
811
|
+
const ne = () => !xe && (!_.signal.aborted || K.keepLate);
|
|
812
|
+
se(!0), oe("listening"), J(""), U(p("editor.ai.listening")), b({
|
|
813
|
+
signal: _.signal,
|
|
814
|
+
onStatus: (q) => {
|
|
815
|
+
ne() && (oe(q), U(
|
|
816
|
+
p(q === "connecting" ? "voiceControl.status.starting" : "editor.ai.listening")
|
|
817
|
+
));
|
|
818
|
+
},
|
|
819
|
+
onPartialTranscript: (q) => {
|
|
820
|
+
ne() && J(q);
|
|
821
|
+
},
|
|
822
|
+
onFinalTranscript: (q) => {
|
|
823
|
+
if (!ne()) return;
|
|
824
|
+
const Ce = q.trim();
|
|
825
|
+
J(""), Ce && (S((de) => Zr(de, Ce)), U(Ce));
|
|
826
|
+
}
|
|
827
|
+
}).catch((q) => {
|
|
828
|
+
var Ce;
|
|
829
|
+
_.signal.aborted || !Qr(q) || (H(!0), (Ce = D.current) == null || Ce.call(D));
|
|
830
|
+
}).finally(() => {
|
|
831
|
+
xe = !0, J(""), he.current === _ && (he.current = null, V.current = null, se(!1), U(""));
|
|
832
|
+
});
|
|
833
|
+
}, [b, p]), Re = C(() => {
|
|
834
|
+
k ? te(!0) : ce();
|
|
835
|
+
}, [k, ce, te]);
|
|
836
|
+
I(() => {
|
|
837
|
+
var _, K;
|
|
838
|
+
n ? (S(""), f(!1), v(!1), H(!1), X(null), J(""), U("")) : ((_ = F.current) == null || _.abort(), F.current = null, (K = he.current) == null || K.abort());
|
|
839
|
+
}, [n]), I(
|
|
840
|
+
() => () => {
|
|
841
|
+
var _, K;
|
|
842
|
+
(_ = F.current) == null || _.abort(), (K = he.current) == null || K.abort();
|
|
843
|
+
},
|
|
844
|
+
[]
|
|
845
|
+
);
|
|
846
|
+
const At = C(() => {
|
|
847
|
+
var xe;
|
|
848
|
+
const _ = L.trim();
|
|
849
|
+
if (!_ || B) return;
|
|
850
|
+
te(), (xe = F.current) == null || xe.abort();
|
|
851
|
+
const K = new AbortController();
|
|
852
|
+
F.current = K, v(!1), f(!0), u({ prompt: _, signal: K.signal }).then((ne) => {
|
|
853
|
+
K.signal.aborted || (X(ne), f(!1));
|
|
854
|
+
}).catch((ne) => {
|
|
855
|
+
var q;
|
|
856
|
+
if (!(K.signal.aborted || ne && typeof ne == "object" && "name" in ne && ne.name === "AbortError")) {
|
|
857
|
+
if (f(!1), Qr(ne)) {
|
|
858
|
+
H(!0), (q = D.current) == null || q.call(D);
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
v(!0);
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
}, [L, B, u, te]), He = C(() => {
|
|
865
|
+
j != null && (c(j), a());
|
|
866
|
+
}, [j, c, a]), at = x(null), [ke, pn] = T(!1);
|
|
867
|
+
Ci(() => {
|
|
868
|
+
const _ = at.current;
|
|
869
|
+
if (!n || !_) return;
|
|
870
|
+
const K = () => {
|
|
871
|
+
const ne = _.clientWidth;
|
|
872
|
+
pn(ne > 0 && ne < es);
|
|
873
|
+
};
|
|
874
|
+
if (K(), typeof ResizeObserver > "u") return;
|
|
875
|
+
const xe = new ResizeObserver(K);
|
|
876
|
+
return xe.observe(_), () => xe.disconnect();
|
|
877
|
+
}, [n]);
|
|
878
|
+
const $ = x(null), Dt = j != null, Pt = z || h, Me = k && Q === "connecting", O = k ? Zr(L, le) : L;
|
|
879
|
+
I(() => {
|
|
880
|
+
var _;
|
|
881
|
+
z && ((_ = $.current) == null || _.focus());
|
|
882
|
+
}, [z]);
|
|
883
|
+
const Y = ke ? null : /* @__PURE__ */ t(
|
|
884
|
+
Z,
|
|
885
|
+
{
|
|
886
|
+
size: "md",
|
|
887
|
+
intent: "outline",
|
|
888
|
+
className: wt,
|
|
889
|
+
icon: /* @__PURE__ */ t(Ai, {}),
|
|
890
|
+
"aria-label": p("common.close"),
|
|
891
|
+
onClick: a
|
|
892
|
+
}
|
|
893
|
+
);
|
|
894
|
+
return /* @__PURE__ */ t(
|
|
895
|
+
Gn,
|
|
896
|
+
{
|
|
897
|
+
open: n,
|
|
898
|
+
onClose: a,
|
|
899
|
+
title: ke ? p("editor.ai.dialogTitle") : void 0,
|
|
900
|
+
ariaLabel: p("editor.ai.dialogTitle"),
|
|
901
|
+
children: /* @__PURE__ */ t("div", { ref: at, className: ts, children: Pt ? /* @__PURE__ */ A("div", { className: qn({ stacked: ke }), children: [
|
|
902
|
+
Y,
|
|
903
|
+
/* @__PURE__ */ t("div", { className: Bn({ stacked: ke }), children: /* @__PURE__ */ t(
|
|
904
|
+
xi,
|
|
905
|
+
{
|
|
906
|
+
ref: $,
|
|
907
|
+
tabIndex: -1,
|
|
908
|
+
headingLevel: 2,
|
|
909
|
+
announce: "assertive"
|
|
910
|
+
}
|
|
911
|
+
) })
|
|
912
|
+
] }) : Dt ? /* @__PURE__ */ A("div", { className: qn({ stacked: ke }), children: [
|
|
913
|
+
Y,
|
|
914
|
+
/* @__PURE__ */ t("div", { className: Bn({ stacked: ke }), children: y ? /* @__PURE__ */ t(
|
|
915
|
+
mi,
|
|
916
|
+
{
|
|
917
|
+
html: j,
|
|
918
|
+
profile: "rich-text",
|
|
919
|
+
className: Ur,
|
|
920
|
+
tabIndex: 0,
|
|
921
|
+
"aria-label": p("editor.ai.dialogTitle")
|
|
922
|
+
}
|
|
923
|
+
) : (
|
|
924
|
+
// Focusable so a keyboard user can scroll a long draft preview
|
|
925
|
+
// (mirrors the SafeHtml preview branch above). The lint rule's
|
|
926
|
+
// tabIndex allowlist doesn't cover a scrollable, non-interactive
|
|
927
|
+
// text region.
|
|
928
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
929
|
+
/* @__PURE__ */ t("p", { className: Ur, tabIndex: 0, children: j })
|
|
930
|
+
) }),
|
|
931
|
+
/* @__PURE__ */ A("div", { className: Xr({ stacked: ke }), children: [
|
|
932
|
+
/* @__PURE__ */ t(
|
|
933
|
+
Z,
|
|
934
|
+
{
|
|
935
|
+
size: "md",
|
|
936
|
+
intent: "outline",
|
|
937
|
+
className: `${wt} ds:rounded-full`,
|
|
938
|
+
icon: /* @__PURE__ */ t(Ni, {}),
|
|
939
|
+
"aria-label": p("editor.ai.retry"),
|
|
940
|
+
onClick: () => X(null)
|
|
941
|
+
}
|
|
942
|
+
),
|
|
943
|
+
/* @__PURE__ */ t(
|
|
944
|
+
Z,
|
|
945
|
+
{
|
|
946
|
+
size: "md",
|
|
947
|
+
intent: "primary",
|
|
948
|
+
className: `${wt} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
|
|
949
|
+
icon: /* @__PURE__ */ t(Ti, {}),
|
|
950
|
+
"aria-label": p("common.confirm"),
|
|
951
|
+
onClick: He
|
|
952
|
+
}
|
|
953
|
+
)
|
|
954
|
+
] })
|
|
955
|
+
] }) : /* @__PURE__ */ A(je, { children: [
|
|
956
|
+
/* @__PURE__ */ A("div", { className: qn({ stacked: ke }), children: [
|
|
957
|
+
Y,
|
|
958
|
+
/* @__PURE__ */ t("div", { className: Bn({ stacked: ke }), children: /* @__PURE__ */ t(
|
|
959
|
+
ki,
|
|
960
|
+
{
|
|
961
|
+
id: E,
|
|
962
|
+
size: "md",
|
|
963
|
+
value: O,
|
|
964
|
+
onChange: (_) => S(_.target.value),
|
|
965
|
+
placeholder: p(k ? Me ? "voiceControl.status.starting" : "editor.ai.listening" : "editor.ai.promptPlaceholder"),
|
|
966
|
+
"aria-label": p("editor.ai.promptLabel"),
|
|
967
|
+
autoResize: !0,
|
|
968
|
+
minRows: 1,
|
|
969
|
+
maxRows: 3,
|
|
970
|
+
readOnly: k,
|
|
971
|
+
tone: m ? "error" : "default",
|
|
972
|
+
"aria-describedby": m ? R : void 0
|
|
973
|
+
}
|
|
974
|
+
) }),
|
|
975
|
+
/* @__PURE__ */ A("div", { className: Xr({ stacked: ke }), children: [
|
|
976
|
+
b ? /* @__PURE__ */ t(
|
|
977
|
+
Z,
|
|
978
|
+
{
|
|
979
|
+
size: "md",
|
|
980
|
+
intent: "outline",
|
|
981
|
+
className: k && !Me ? `${wt} ${Ya}` : wt,
|
|
982
|
+
icon: Me ? /* @__PURE__ */ t(Kn, { className: "ds:animate-spin ds:motion-reduce:animate-none" }) : k ? /* @__PURE__ */ t($t, { className: "ds:fill-current" }) : /* @__PURE__ */ t(Vn, {}),
|
|
983
|
+
"aria-pressed": k,
|
|
984
|
+
"aria-label": p(k ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
985
|
+
onClick: Re
|
|
986
|
+
}
|
|
987
|
+
) : null,
|
|
988
|
+
/* @__PURE__ */ t(
|
|
989
|
+
Z,
|
|
990
|
+
{
|
|
991
|
+
size: "md",
|
|
992
|
+
intent: "primary",
|
|
993
|
+
icon: B ? /* @__PURE__ */ t(Yn, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ t(Ei, {}),
|
|
994
|
+
className: `${wt} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
|
|
995
|
+
disabled: B || !L.trim(),
|
|
996
|
+
"aria-busy": B || void 0,
|
|
997
|
+
"aria-label": p("editor.ai.generate"),
|
|
998
|
+
onClick: At
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] })
|
|
1002
|
+
] }),
|
|
1003
|
+
b ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Ee }) : null,
|
|
1004
|
+
m ? /* @__PURE__ */ t(fo, { id: R }) : w ? /* @__PURE__ */ t("p", { className: ns, children: w }) : null
|
|
1005
|
+
] }) })
|
|
1006
|
+
}
|
|
1007
|
+
);
|
|
1008
|
+
}
|
|
1009
|
+
function go(n, a) {
|
|
1010
|
+
return n(a, { nsSeparator: !1, defaultValue: a });
|
|
1011
|
+
}
|
|
1012
|
+
const ho = {
|
|
1013
|
+
// Redactor's own history. AI rewrites push onto it too (see
|
|
1014
|
+
// `pushUndoState` in rich-text-editor.tsx), so Undo steps back over them.
|
|
1015
|
+
undo: {
|
|
1016
|
+
id: "undo",
|
|
1017
|
+
icon: /* @__PURE__ */ t(Oi, {}),
|
|
1018
|
+
label: ["editor.undo", "Undo"],
|
|
1019
|
+
command: ["module.buffer.undo"]
|
|
1020
|
+
},
|
|
1021
|
+
redo: {
|
|
1022
|
+
id: "redo",
|
|
1023
|
+
icon: /* @__PURE__ */ t($a, {}),
|
|
1024
|
+
label: ["editor.redo", "Redo"],
|
|
1025
|
+
command: ["module.buffer.redo"]
|
|
1026
|
+
},
|
|
1027
|
+
bold: {
|
|
1028
|
+
id: "bold",
|
|
1029
|
+
icon: /* @__PURE__ */ t(Ji, {}),
|
|
1030
|
+
label: ["editor.bold", "Bold"],
|
|
1031
|
+
command: ["module.inline.format", { tag: "b" }],
|
|
1032
|
+
toggle: "bold"
|
|
1033
|
+
},
|
|
1034
|
+
italic: {
|
|
1035
|
+
id: "italic",
|
|
1036
|
+
icon: /* @__PURE__ */ t(la, {}),
|
|
1037
|
+
label: ["editor.italic", "Italic"],
|
|
1038
|
+
command: ["module.inline.format", { tag: "i" }],
|
|
1039
|
+
toggle: "italic"
|
|
1040
|
+
},
|
|
1041
|
+
underline: {
|
|
1042
|
+
id: "underline",
|
|
1043
|
+
icon: /* @__PURE__ */ t(Za, {}),
|
|
1044
|
+
label: ["editor.underline", "Underline"],
|
|
1045
|
+
command: ["module.inline.format", { tag: "u" }],
|
|
1046
|
+
toggle: "underline"
|
|
1047
|
+
},
|
|
1048
|
+
strike: {
|
|
1049
|
+
id: "strike",
|
|
1050
|
+
icon: /* @__PURE__ */ t(qa, {}),
|
|
1051
|
+
label: ["editor.strike", "Strikethrough"],
|
|
1052
|
+
command: ["module.inline.format", { tag: "del" }],
|
|
1053
|
+
toggle: "strike"
|
|
1054
|
+
},
|
|
1055
|
+
ul: {
|
|
1056
|
+
id: "ul",
|
|
1057
|
+
icon: /* @__PURE__ */ t(ga, {}),
|
|
1058
|
+
label: ["editor.list.bullet", "Bulleted list"],
|
|
1059
|
+
command: ["module.list.toggle", "ul"],
|
|
1060
|
+
toggle: "ul"
|
|
1061
|
+
},
|
|
1062
|
+
ol: {
|
|
1063
|
+
id: "ol",
|
|
1064
|
+
icon: /* @__PURE__ */ t(ma, {}),
|
|
1065
|
+
label: ["editor.list.ordered", "Numbered list"],
|
|
1066
|
+
command: ["module.list.toggle", "ol"],
|
|
1067
|
+
toggle: "ol"
|
|
1068
|
+
}
|
|
1069
|
+
}, Fn = [
|
|
1070
|
+
{
|
|
1071
|
+
id: "paragraph",
|
|
1072
|
+
tag: "p",
|
|
1073
|
+
icon: /* @__PURE__ */ t(za, {}),
|
|
1074
|
+
label: ["editor.paragraph", "Paragraph"]
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
id: "h2",
|
|
1078
|
+
tag: "h2",
|
|
1079
|
+
icon: /* @__PURE__ */ t(oa, {}),
|
|
1080
|
+
label: ["editor.heading2", "Heading 2"]
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
id: "h3",
|
|
1084
|
+
tag: "h3",
|
|
1085
|
+
icon: /* @__PURE__ */ t(aa, {}),
|
|
1086
|
+
label: ["editor.heading3", "Heading 3"]
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
id: "quote",
|
|
1090
|
+
tag: "blockquote",
|
|
1091
|
+
icon: /* @__PURE__ */ t(_a, {}),
|
|
1092
|
+
label: ["editor.quote", "Quote"]
|
|
1093
|
+
}
|
|
1094
|
+
], cn = [
|
|
1095
|
+
{
|
|
1096
|
+
id: "left",
|
|
1097
|
+
icon: /* @__PURE__ */ t(mo, {}),
|
|
1098
|
+
label: ["editor.align.left", "Align left"]
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
id: "center",
|
|
1102
|
+
icon: /* @__PURE__ */ t(co, {}),
|
|
1103
|
+
label: ["editor.align.center", "Align centre"]
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
id: "right",
|
|
1107
|
+
icon: /* @__PURE__ */ t(uo, {}),
|
|
1108
|
+
label: ["editor.align.right", "Align right"]
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
id: "justify",
|
|
1112
|
+
icon: /* @__PURE__ */ t(Va, {}),
|
|
1113
|
+
label: ["editor.align.justify", "Justify"]
|
|
1114
|
+
}
|
|
1115
|
+
], Un = [
|
|
1116
|
+
"p",
|
|
1117
|
+
"div",
|
|
1118
|
+
"blockquote",
|
|
1119
|
+
"pre",
|
|
1120
|
+
"h1",
|
|
1121
|
+
"h2",
|
|
1122
|
+
"h3",
|
|
1123
|
+
"h4",
|
|
1124
|
+
"h5",
|
|
1125
|
+
"h6",
|
|
1126
|
+
"li"
|
|
1127
|
+
], is = {
|
|
1128
|
+
minimal: ["bold", "italic", "underline", "link"],
|
|
1129
|
+
standard: [
|
|
1130
|
+
"undo",
|
|
1131
|
+
"redo",
|
|
1132
|
+
"format",
|
|
1133
|
+
"bold",
|
|
1134
|
+
"italic",
|
|
1135
|
+
"underline",
|
|
1136
|
+
"strike",
|
|
1137
|
+
"align",
|
|
1138
|
+
"ul",
|
|
1139
|
+
"ol",
|
|
1140
|
+
"link"
|
|
1141
|
+
],
|
|
1142
|
+
full: [
|
|
1143
|
+
"undo",
|
|
1144
|
+
"redo",
|
|
1145
|
+
"format",
|
|
1146
|
+
"bold",
|
|
1147
|
+
"italic",
|
|
1148
|
+
"underline",
|
|
1149
|
+
"strike",
|
|
1150
|
+
"align",
|
|
1151
|
+
"ul",
|
|
1152
|
+
"ol",
|
|
1153
|
+
"link"
|
|
1154
|
+
]
|
|
1155
|
+
}, po = [
|
|
1156
|
+
{
|
|
1157
|
+
id: "rowAbove",
|
|
1158
|
+
command: "plugin.table.addRowAbove",
|
|
1159
|
+
icon: /* @__PURE__ */ t(Ki, {}),
|
|
1160
|
+
label: ["editor.table.rowAbove", "Add row above"]
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
id: "rowBelow",
|
|
1164
|
+
command: "plugin.table.addRowBelow",
|
|
1165
|
+
icon: /* @__PURE__ */ t(ji, {}),
|
|
1166
|
+
label: ["editor.table.rowBelow", "Add row below"]
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
id: "colLeft",
|
|
1170
|
+
command: "plugin.table.addColumnLeft",
|
|
1171
|
+
icon: /* @__PURE__ */ t(Ui, {}),
|
|
1172
|
+
label: ["editor.table.columnLeft", "Add column left"]
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
id: "colRight",
|
|
1176
|
+
command: "plugin.table.addColumnRight",
|
|
1177
|
+
icon: /* @__PURE__ */ t(Wi, {}),
|
|
1178
|
+
label: ["editor.table.columnRight", "Add column right"]
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
id: "addHead",
|
|
1182
|
+
command: "plugin.table.addHead",
|
|
1183
|
+
icon: /* @__PURE__ */ t(Ra, {}),
|
|
1184
|
+
label: ["editor.table.addHeader", "Add header row"]
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
id: "deleteHead",
|
|
1188
|
+
command: "plugin.table.deleteHead",
|
|
1189
|
+
icon: /* @__PURE__ */ t(Ta, {}),
|
|
1190
|
+
label: ["editor.table.deleteHeader", "Remove header row"]
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
id: "deleteRow",
|
|
1194
|
+
command: "plugin.table.deleteRow",
|
|
1195
|
+
icon: /* @__PURE__ */ t(Oa, {}),
|
|
1196
|
+
label: ["editor.table.deleteRow", "Delete row"]
|
|
1197
|
+
},
|
|
1198
|
+
{
|
|
1199
|
+
id: "deleteColumn",
|
|
1200
|
+
command: "plugin.table.deleteColumn",
|
|
1201
|
+
icon: /* @__PURE__ */ t(na, {}),
|
|
1202
|
+
label: ["editor.table.deleteColumn", "Delete column"]
|
|
1203
|
+
},
|
|
1204
|
+
{
|
|
1205
|
+
id: "deleteTable",
|
|
1206
|
+
command: "plugin.table.deleteTable",
|
|
1207
|
+
icon: /* @__PURE__ */ t(Di, {}),
|
|
1208
|
+
label: ["editor.table.deleteTable", "Delete table"]
|
|
1209
|
+
}
|
|
1210
|
+
], dn = 6, bo = "ds:[&_[data-intent=ghost]:hover]:bg-[color-mix(in_srgb,var(--accent)_12%,transparent)] ds:[&_[data-intent=ghost]:hover]:text-[color:var(--accent)]", as = Ct(
|
|
1211
|
+
[
|
|
1212
|
+
"ds:@container/toolbar",
|
|
1213
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
1214
|
+
"ds:bg-[var(--background)] ds:p-[var(--spacing-xs)]",
|
|
1215
|
+
"ds:shadow-[var(--shadow-md)]",
|
|
1216
|
+
bo
|
|
1217
|
+
].join(" ")
|
|
1218
|
+
), ss = "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", hn = "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[var(--border)] ds:[margin-inline:var(--spacing-2xs)]", Ht = "ds:text-[length:var(--font-size-sm)] ds:font-medium ds:text-[color:var(--foreground)]";
|
|
1219
|
+
function gn(n) {
|
|
1220
|
+
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1221
|
+
}
|
|
1222
|
+
function ls(n) {
|
|
1223
|
+
const a = n.trim();
|
|
1224
|
+
return a && (/^([^\s/:@]+\.[^\s/:@]+|localhost):\d+([/?#]|$)/i.test(a) ? `https://${a}` : /^[a-z][a-z0-9+.-]*:/i.test(a) || /^[/#?]/.test(a) || a.startsWith("[[") ? a : /^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(a) ? `mailto:${a}` : `https://${a}`);
|
|
1225
|
+
}
|
|
1226
|
+
function cs({
|
|
1227
|
+
variables: n,
|
|
1228
|
+
recentVariableTokens: a,
|
|
1229
|
+
insertVariable: u,
|
|
1230
|
+
saveSelection: c
|
|
1231
|
+
}) {
|
|
1232
|
+
const { t: g } = ae("ui"), [h, y] = T(!1), [w, b] = T(""), p = x(null), E = x(!1), R = Ri(!0, {
|
|
1233
|
+
getAnchor: Mi,
|
|
1234
|
+
onReturnToTrigger: () => y(!1)
|
|
1235
|
+
}), L = n;
|
|
1236
|
+
return /* @__PURE__ */ A(
|
|
1237
|
+
ln.Root,
|
|
1238
|
+
{
|
|
1239
|
+
open: h,
|
|
1240
|
+
onOpenChange: (S) => {
|
|
1241
|
+
S && c(), y(S), S && b("");
|
|
1242
|
+
},
|
|
1243
|
+
children: [
|
|
1244
|
+
/* @__PURE__ */ t(ln.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1245
|
+
Z,
|
|
1246
|
+
{
|
|
1247
|
+
ref: p,
|
|
1248
|
+
size: "sm",
|
|
1249
|
+
intent: "ghost",
|
|
1250
|
+
icon: /* @__PURE__ */ t(ea, {}),
|
|
1251
|
+
"aria-label": g("editor.insertVariable", "Insert variable")
|
|
1252
|
+
}
|
|
1253
|
+
) }),
|
|
1254
|
+
/* @__PURE__ */ t(ln.Portal, { children: /* @__PURE__ */ t(
|
|
1255
|
+
ln.Content,
|
|
1256
|
+
{
|
|
1257
|
+
align: "start",
|
|
1258
|
+
sideOffset: 4,
|
|
1259
|
+
className: "ds:z-[var(--z-popover)]",
|
|
1260
|
+
onKeyDown: R,
|
|
1261
|
+
onCloseAutoFocus: (S) => {
|
|
1262
|
+
E.current && (S.preventDefault(), E.current = !1);
|
|
1263
|
+
},
|
|
1264
|
+
children: /* @__PURE__ */ t(
|
|
1265
|
+
lo,
|
|
1266
|
+
{
|
|
1267
|
+
variables: L,
|
|
1268
|
+
recentTokens: a,
|
|
1269
|
+
query: w,
|
|
1270
|
+
onQueryChange: b,
|
|
1271
|
+
searchFocusable: !0,
|
|
1272
|
+
"aria-label": g("editor.insertVariable", "Insert variable"),
|
|
1273
|
+
onSelect: (S) => {
|
|
1274
|
+
E.current = !0, u(S.token), y(!1);
|
|
1275
|
+
},
|
|
1276
|
+
onClose: () => y(!1)
|
|
1277
|
+
}
|
|
1278
|
+
)
|
|
1279
|
+
}
|
|
1280
|
+
) })
|
|
1281
|
+
]
|
|
1282
|
+
}
|
|
1283
|
+
);
|
|
1284
|
+
}
|
|
1285
|
+
function ds({
|
|
1286
|
+
run: n,
|
|
1287
|
+
active: a,
|
|
1288
|
+
onTriggerDown: u
|
|
1289
|
+
}) {
|
|
1290
|
+
const { t: c } = ae("ui"), g = Fn.find((h) => a.has(h.id)) ?? Fn[0];
|
|
1291
|
+
return /* @__PURE__ */ A(W.Root, { children: [
|
|
1292
|
+
/* @__PURE__ */ t(W.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1293
|
+
Le,
|
|
1294
|
+
{
|
|
1295
|
+
size: "sm",
|
|
1296
|
+
intent: "ghost",
|
|
1297
|
+
startIcon: g.icon,
|
|
1298
|
+
endIcon: /* @__PURE__ */ t(nr, {}),
|
|
1299
|
+
"aria-label": `${c("editor.format", "Paragraph style")}: ${c(
|
|
1300
|
+
g.label[0],
|
|
1301
|
+
g.label[1]
|
|
1302
|
+
)}`,
|
|
1303
|
+
onMouseDown: u,
|
|
1304
|
+
children: /* @__PURE__ */ t("span", { className: "ds:hidden ds:@[448px]/toolbar:inline", children: c(g.label[0], g.label[1]) })
|
|
1305
|
+
}
|
|
1306
|
+
) }),
|
|
1307
|
+
/* @__PURE__ */ t(W.Content, { align: "start", children: Fn.map((h) => /* @__PURE__ */ t(
|
|
1308
|
+
W.Item,
|
|
1309
|
+
{
|
|
1310
|
+
startIcon: h.icon,
|
|
1311
|
+
onSelect: () => n("module.block.format", { tag: h.tag }),
|
|
1312
|
+
children: c(h.label[0], h.label[1])
|
|
1313
|
+
},
|
|
1314
|
+
h.id
|
|
1315
|
+
)) })
|
|
1316
|
+
] });
|
|
1317
|
+
}
|
|
1318
|
+
function us({
|
|
1319
|
+
run: n,
|
|
1320
|
+
active: a,
|
|
1321
|
+
onTriggerDown: u
|
|
1322
|
+
}) {
|
|
1323
|
+
const { t: c } = ae("ui"), g = x(null), [h, y] = T(!1);
|
|
1324
|
+
ci(() => {
|
|
1325
|
+
const R = g.current;
|
|
1326
|
+
R && y(getComputedStyle(R).direction === "rtl");
|
|
1327
|
+
}, []);
|
|
1328
|
+
const w = h ? "right" : "left", b = cn.find((R) => a.has(`align-${R.id}`)) ?? cn.find((R) => R.id === w) ?? cn[0], p = (R) => {
|
|
1329
|
+
R === w ? n("module.block.remove", { style: "text-align" }, Un) : n("module.block.add", { style: { "text-align": R } }, Un), R === w || R === "justify" ? n("module.block.remove", { style: "list-style-position" }, ["li"]) : n("module.block.add", { style: { "list-style-position": "inside" } }, [
|
|
1330
|
+
"li"
|
|
1331
|
+
]);
|
|
1332
|
+
}, E = `${c("editor.align.label", "Text alignment")}: ${c(
|
|
1333
|
+
b.label[0],
|
|
1334
|
+
b.label[1]
|
|
1335
|
+
)}`;
|
|
1336
|
+
return /* @__PURE__ */ A(W.Root, { children: [
|
|
1337
|
+
/* @__PURE__ */ t(W.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1338
|
+
Le,
|
|
1339
|
+
{
|
|
1340
|
+
ref: g,
|
|
1341
|
+
size: "sm",
|
|
1342
|
+
intent: "ghost",
|
|
1343
|
+
startIcon: b.icon,
|
|
1344
|
+
endIcon: /* @__PURE__ */ t(nr, {}),
|
|
1345
|
+
"aria-label": E,
|
|
1346
|
+
onMouseDown: u
|
|
1347
|
+
}
|
|
1348
|
+
) }),
|
|
1349
|
+
/* @__PURE__ */ t(W.Content, { align: "start", children: /* @__PURE__ */ t(W.RadioGroup, { value: b.id, onValueChange: p, children: cn.map((R) => /* @__PURE__ */ t(W.RadioItem, { value: R.id, children: c(R.label[0], R.label[1]) }, R.id)) }) })
|
|
1350
|
+
] });
|
|
1351
|
+
}
|
|
1352
|
+
function ms({
|
|
1353
|
+
insertHtml: n,
|
|
1354
|
+
saveSelection: a,
|
|
1355
|
+
restoreSelection: u,
|
|
1356
|
+
getSelectedText: c
|
|
1357
|
+
}) {
|
|
1358
|
+
const { t: g } = ae("ui"), [h, y] = T(!1), [w, b] = T(""), [p, E] = T(""), [R, L] = T(!1), S = Ve(), B = Ve(), f = () => {
|
|
1359
|
+
b(""), E(""), L(!1);
|
|
1360
|
+
}, m = () => {
|
|
1361
|
+
const v = w.trim();
|
|
1362
|
+
if (!v) return;
|
|
1363
|
+
const z = ls(v), H = p.trim() || v, D = R ? ' target="_blank" rel="noopener noreferrer"' : "", j = `<a href="${gn(z)}"${D}>${gn(H)}</a>`;
|
|
1364
|
+
y(!1), f(), window.requestAnimationFrame(() => {
|
|
1365
|
+
u(), n(j);
|
|
1366
|
+
});
|
|
1367
|
+
};
|
|
1368
|
+
return /* @__PURE__ */ A(ue.Root, { open: h, onOpenChange: y, children: [
|
|
1369
|
+
/* @__PURE__ */ t(ue.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1370
|
+
Z,
|
|
1371
|
+
{
|
|
1372
|
+
size: "sm",
|
|
1373
|
+
intent: "ghost",
|
|
1374
|
+
icon: /* @__PURE__ */ t(da, {}),
|
|
1375
|
+
"aria-label": g("editor.link.insert", "Insert link"),
|
|
1376
|
+
onMouseDown: () => {
|
|
1377
|
+
a(), E(c());
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
) }),
|
|
1381
|
+
/* @__PURE__ */ A(ue.Content, { children: [
|
|
1382
|
+
/* @__PURE__ */ t(ue.Header, { children: /* @__PURE__ */ t(ue.Title, { children: g("editor.link.insert", "Insert link") }) }),
|
|
1383
|
+
/* @__PURE__ */ A(ue.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
1384
|
+
/* @__PURE__ */ A("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1385
|
+
/* @__PURE__ */ t("label", { htmlFor: S, className: Ht, children: g("editor.link.url", "URL") }),
|
|
1386
|
+
/* @__PURE__ */ t(
|
|
1387
|
+
fn,
|
|
1388
|
+
{
|
|
1389
|
+
id: S,
|
|
1390
|
+
type: "url",
|
|
1391
|
+
value: w,
|
|
1392
|
+
onChange: (v) => b(v.target.value),
|
|
1393
|
+
placeholder: "https://…"
|
|
1394
|
+
}
|
|
1395
|
+
)
|
|
1396
|
+
] }),
|
|
1397
|
+
/* @__PURE__ */ A("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1398
|
+
/* @__PURE__ */ t("label", { htmlFor: B, className: Ht, children: g("editor.link.text", "Text to display") }),
|
|
1399
|
+
/* @__PURE__ */ t(
|
|
1400
|
+
fn,
|
|
1401
|
+
{
|
|
1402
|
+
id: B,
|
|
1403
|
+
value: p,
|
|
1404
|
+
onChange: (v) => E(v.target.value),
|
|
1405
|
+
placeholder: g("editor.link.textPlaceholder", "Link text")
|
|
1406
|
+
}
|
|
1407
|
+
)
|
|
1408
|
+
] }),
|
|
1409
|
+
/* @__PURE__ */ t(
|
|
1410
|
+
Si,
|
|
1411
|
+
{
|
|
1412
|
+
checked: R,
|
|
1413
|
+
onCheckedChange: (v) => L(v === !0),
|
|
1414
|
+
label: g("editor.link.newTab", "Open in new tab")
|
|
1415
|
+
}
|
|
1416
|
+
)
|
|
1417
|
+
] }),
|
|
1418
|
+
/* @__PURE__ */ A(ue.Footer, { children: [
|
|
1419
|
+
/* @__PURE__ */ t(ue.Close, { asChild: !0, children: /* @__PURE__ */ t(Le, { intent: "secondary", children: g("common.cancel") }) }),
|
|
1420
|
+
/* @__PURE__ */ t(Le, { onClick: m, disabled: !w.trim(), children: g("editor.link.insertAction", "Insert") })
|
|
1421
|
+
] })
|
|
1422
|
+
] })
|
|
1423
|
+
] });
|
|
1424
|
+
}
|
|
1425
|
+
function fs({
|
|
1426
|
+
insertHtml: n,
|
|
1427
|
+
saveSelection: a,
|
|
1428
|
+
restoreSelection: u,
|
|
1429
|
+
uploadImage: c
|
|
1430
|
+
}) {
|
|
1431
|
+
const { t: g } = ae("ui"), [h, y] = T(!1), [w, b] = T(""), [p, E] = T(""), R = Ve(), L = Ve(), S = (f, m) => {
|
|
1432
|
+
const v = `<img src="${gn(f)}" alt="${gn(m)}" loading="lazy">`;
|
|
1433
|
+
y(!1), b(""), E(""), window.requestAnimationFrame(() => {
|
|
1434
|
+
u(), n(v);
|
|
1435
|
+
});
|
|
1436
|
+
}, B = () => {
|
|
1437
|
+
const f = w.trim();
|
|
1438
|
+
f && S(f, p.trim());
|
|
1439
|
+
};
|
|
1440
|
+
return /* @__PURE__ */ A(ue.Root, { open: h, onOpenChange: y, children: [
|
|
1441
|
+
/* @__PURE__ */ t(ue.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1442
|
+
Z,
|
|
1443
|
+
{
|
|
1444
|
+
size: "sm",
|
|
1445
|
+
intent: "ghost",
|
|
1446
|
+
icon: /* @__PURE__ */ t(Ii, {}),
|
|
1447
|
+
"aria-label": g("editor.image.insert", "Insert image"),
|
|
1448
|
+
onMouseDown: () => a()
|
|
1449
|
+
}
|
|
1450
|
+
) }),
|
|
1451
|
+
/* @__PURE__ */ A(ue.Content, { children: [
|
|
1452
|
+
/* @__PURE__ */ t(ue.Header, { children: /* @__PURE__ */ t(ue.Title, { children: g("editor.image.insert", "Insert image") }) }),
|
|
1453
|
+
/* @__PURE__ */ A(ue.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
1454
|
+
c ? /* @__PURE__ */ A("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1455
|
+
/* @__PURE__ */ t("span", { className: Ht, children: g("editor.image.upload", "Upload") }),
|
|
1456
|
+
/* @__PURE__ */ t(
|
|
1457
|
+
zi,
|
|
1458
|
+
{
|
|
1459
|
+
variant: "dropzone",
|
|
1460
|
+
accept: {
|
|
1461
|
+
"image/*": [".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"]
|
|
1462
|
+
},
|
|
1463
|
+
maxFiles: 1,
|
|
1464
|
+
onUpload: async (f, { signal: m }) => {
|
|
1465
|
+
const v = await c(f, m);
|
|
1466
|
+
S(v, f.name);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
),
|
|
1470
|
+
/* @__PURE__ */ t("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: g("editor.image.orUrl", "Or paste an image URL") })
|
|
1471
|
+
] }) : null,
|
|
1472
|
+
/* @__PURE__ */ A("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1473
|
+
/* @__PURE__ */ t("label", { htmlFor: R, className: Ht, children: g("editor.image.url", "Image URL") }),
|
|
1474
|
+
/* @__PURE__ */ t(
|
|
1475
|
+
fn,
|
|
1476
|
+
{
|
|
1477
|
+
id: R,
|
|
1478
|
+
type: "url",
|
|
1479
|
+
value: w,
|
|
1480
|
+
onChange: (f) => b(f.target.value),
|
|
1481
|
+
placeholder: "https://…"
|
|
1482
|
+
}
|
|
1483
|
+
)
|
|
1484
|
+
] }),
|
|
1485
|
+
/* @__PURE__ */ A("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1486
|
+
/* @__PURE__ */ t("label", { htmlFor: L, className: Ht, children: g("editor.image.alt", "Alt text") }),
|
|
1487
|
+
/* @__PURE__ */ t(
|
|
1488
|
+
fn,
|
|
1489
|
+
{
|
|
1490
|
+
id: L,
|
|
1491
|
+
value: p,
|
|
1492
|
+
onChange: (f) => E(f.target.value),
|
|
1493
|
+
placeholder: g(
|
|
1494
|
+
"editor.image.altPlaceholder",
|
|
1495
|
+
"Describe the image"
|
|
1496
|
+
)
|
|
1497
|
+
}
|
|
1498
|
+
)
|
|
1499
|
+
] })
|
|
1500
|
+
] }),
|
|
1501
|
+
/* @__PURE__ */ A(ue.Footer, { children: [
|
|
1502
|
+
/* @__PURE__ */ t(ue.Close, { asChild: !0, children: /* @__PURE__ */ t(Le, { intent: "secondary", children: g("common.cancel") }) }),
|
|
1503
|
+
/* @__PURE__ */ t(Le, { onClick: B, disabled: !w.trim(), children: g("editor.image.insertAction", "Insert") })
|
|
1504
|
+
] })
|
|
1505
|
+
] })
|
|
1506
|
+
] });
|
|
1507
|
+
}
|
|
1508
|
+
function gs({
|
|
1509
|
+
run: n,
|
|
1510
|
+
saveSelection: a,
|
|
1511
|
+
restoreSelection: u
|
|
1512
|
+
}) {
|
|
1513
|
+
const { t: c } = ae("ui"), [g, h] = T("#1f2a5c"), y = (b) => {
|
|
1514
|
+
h(b), u(), n("module.inline.format", {
|
|
1515
|
+
tag: "span",
|
|
1516
|
+
style: { color: b },
|
|
1517
|
+
type: "toggle"
|
|
1518
|
+
});
|
|
1519
|
+
}, w = () => {
|
|
1520
|
+
u(), n("module.inline.remove", { style: "color" });
|
|
1521
|
+
};
|
|
1522
|
+
return /* @__PURE__ */ A(ie, { onOpenChange: (b) => b && a(), children: [
|
|
1523
|
+
/* @__PURE__ */ t(ie.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1524
|
+
Z,
|
|
1525
|
+
{
|
|
1526
|
+
size: "sm",
|
|
1527
|
+
intent: "ghost",
|
|
1528
|
+
icon: /* @__PURE__ */ t(wa, {}),
|
|
1529
|
+
"aria-label": c("editor.textColor", "Text colour"),
|
|
1530
|
+
onMouseDown: (b) => {
|
|
1531
|
+
b.preventDefault(), a();
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
) }),
|
|
1535
|
+
/* @__PURE__ */ A(ie.Content, { side: "bottom", align: "start", children: [
|
|
1536
|
+
/* @__PURE__ */ t(ie.Heading, { children: c("editor.textColor", "Text colour") }),
|
|
1537
|
+
/* @__PURE__ */ t("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
|
|
1538
|
+
tr,
|
|
1539
|
+
{
|
|
1540
|
+
variant: "inline",
|
|
1541
|
+
size: "sm",
|
|
1542
|
+
value: g,
|
|
1543
|
+
onChange: y
|
|
1544
|
+
}
|
|
1545
|
+
) }),
|
|
1546
|
+
/* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t(Le, { size: "sm", intent: "secondary", onClick: w, children: c("editor.color.remove", "Remove colour") }) })
|
|
1547
|
+
] })
|
|
1548
|
+
] });
|
|
1549
|
+
}
|
|
1550
|
+
function hs({
|
|
1551
|
+
run: n,
|
|
1552
|
+
saveSelection: a,
|
|
1553
|
+
restoreSelection: u
|
|
1554
|
+
}) {
|
|
1555
|
+
const { t: c } = ae("ui"), [g, h] = T("#fff3a3"), y = (b) => {
|
|
1556
|
+
h(b), u(), n("module.inline.format", {
|
|
1557
|
+
tag: "span",
|
|
1558
|
+
style: { "background-color": b },
|
|
1559
|
+
type: "toggle"
|
|
1560
|
+
});
|
|
1561
|
+
}, w = () => {
|
|
1562
|
+
u(), n("module.inline.remove", { style: "background-color" });
|
|
1563
|
+
};
|
|
1564
|
+
return /* @__PURE__ */ A(ie, { onOpenChange: (b) => b && a(), children: [
|
|
1565
|
+
/* @__PURE__ */ t(ie.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1566
|
+
Z,
|
|
1567
|
+
{
|
|
1568
|
+
size: "sm",
|
|
1569
|
+
intent: "ghost",
|
|
1570
|
+
icon: /* @__PURE__ */ t(_i, {}),
|
|
1571
|
+
"aria-label": c("editor.highlightColor", "Highlight"),
|
|
1572
|
+
onMouseDown: (b) => {
|
|
1573
|
+
b.preventDefault(), a();
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
) }),
|
|
1577
|
+
/* @__PURE__ */ A(ie.Content, { side: "bottom", align: "start", children: [
|
|
1578
|
+
/* @__PURE__ */ t(ie.Heading, { children: c("editor.highlightColor", "Highlight") }),
|
|
1579
|
+
/* @__PURE__ */ t("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
|
|
1580
|
+
tr,
|
|
1581
|
+
{
|
|
1582
|
+
variant: "inline",
|
|
1583
|
+
size: "sm",
|
|
1584
|
+
value: g,
|
|
1585
|
+
onChange: y
|
|
1586
|
+
}
|
|
1587
|
+
) }),
|
|
1588
|
+
/* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t(Le, { size: "sm", intent: "secondary", onClick: w, children: c("editor.highlight.remove", "Remove highlight") }) })
|
|
1589
|
+
] })
|
|
1590
|
+
] });
|
|
1591
|
+
}
|
|
1592
|
+
function ps(n, a) {
|
|
1593
|
+
const u = Array.from({ length: a }, () => "<td><br></td>").join("");
|
|
1594
|
+
return `<table><tbody>${Array.from({ length: n }, () => `<tr>${u}</tr>`).join("")}</tbody></table>`;
|
|
1595
|
+
}
|
|
1596
|
+
function bs({
|
|
1597
|
+
run: n,
|
|
1598
|
+
insertTable: a,
|
|
1599
|
+
active: u
|
|
1600
|
+
}) {
|
|
1601
|
+
const { t: c } = ae("ui"), [g, h] = T({ r: 0, c: 0 }), [y, w] = T(!1), b = u.has("table") || y, p = /* @__PURE__ */ t(
|
|
1602
|
+
Z,
|
|
1603
|
+
{
|
|
1604
|
+
size: "sm",
|
|
1605
|
+
intent: "ghost",
|
|
1606
|
+
icon: /* @__PURE__ */ t(Fa, {}),
|
|
1607
|
+
"aria-label": c("editor.table.insert", "Insert table"),
|
|
1608
|
+
onMouseDown: (E) => E.preventDefault()
|
|
1609
|
+
}
|
|
1610
|
+
);
|
|
1611
|
+
return b ? /* @__PURE__ */ A(W.Root, { open: y, onOpenChange: w, children: [
|
|
1612
|
+
/* @__PURE__ */ t(W.Trigger, { asChild: !0, children: p }),
|
|
1613
|
+
/* @__PURE__ */ t(W.Content, { side: "bottom", align: "start", children: po.map((E) => /* @__PURE__ */ t(
|
|
1614
|
+
W.Item,
|
|
1615
|
+
{
|
|
1616
|
+
startIcon: E.icon,
|
|
1617
|
+
onSelect: () => n(E.command),
|
|
1618
|
+
children: c(E.label[0], E.label[1])
|
|
1619
|
+
},
|
|
1620
|
+
E.id
|
|
1621
|
+
)) })
|
|
1622
|
+
] }) : /* @__PURE__ */ A(ie, { onOpenChange: (E) => !E && h({ r: 0, c: 0 }), children: [
|
|
1623
|
+
/* @__PURE__ */ t(ie.Trigger, { asChild: !0, children: p }),
|
|
1624
|
+
/* @__PURE__ */ A(ie.Content, { side: "bottom", align: "start", children: [
|
|
1625
|
+
/* @__PURE__ */ t(ie.Heading, { children: c("editor.table.insert", "Insert table") }),
|
|
1626
|
+
/* @__PURE__ */ t(
|
|
1627
|
+
"div",
|
|
1628
|
+
{
|
|
1629
|
+
role: "group",
|
|
1630
|
+
"aria-label": c("editor.table.sizePicker", "Table size"),
|
|
1631
|
+
className: "ds:mt-[var(--spacing-sm)] ds:grid ds:w-fit ds:grid-cols-6 ds:gap-[var(--spacing-2xs)]",
|
|
1632
|
+
onMouseLeave: () => h({ r: 0, c: 0 }),
|
|
1633
|
+
children: Array.from({ length: dn * dn }, (E, R) => {
|
|
1634
|
+
const L = Math.floor(R / dn) + 1, S = R % dn + 1, B = L <= g.r && S <= g.c;
|
|
1635
|
+
return /* @__PURE__ */ t(
|
|
1636
|
+
"button",
|
|
1637
|
+
{
|
|
1638
|
+
type: "button",
|
|
1639
|
+
"aria-label": c("editor.table.sizeCell", "{{r}}×{{c}}", {
|
|
1640
|
+
r: L,
|
|
1641
|
+
c: S
|
|
1642
|
+
}),
|
|
1643
|
+
onMouseEnter: () => h({ r: L, c: S }),
|
|
1644
|
+
onClick: () => a(ps(L, S)),
|
|
1645
|
+
className: `ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ${B ? "ds:bg-[var(--primary)]" : "ds:bg-[var(--muted)]"}`
|
|
1646
|
+
},
|
|
1647
|
+
R
|
|
1648
|
+
);
|
|
1649
|
+
})
|
|
1650
|
+
}
|
|
1651
|
+
),
|
|
1652
|
+
/* @__PURE__ */ t("p", { className: "ds:mt-[var(--spacing-xs)] ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: g.r > 0 ? c("editor.table.sizeCell", "{{r}}×{{c}}", {
|
|
1653
|
+
r: g.r,
|
|
1654
|
+
c: g.c
|
|
1655
|
+
}) : c("editor.table.sizeHint", "Pick a size") })
|
|
1656
|
+
] })
|
|
1657
|
+
] });
|
|
1658
|
+
}
|
|
1659
|
+
const vs = Object.fromEntries(po.map((n) => [n.id, n])), ys = [
|
|
1660
|
+
"ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
|
|
1661
|
+
"ds:[inset-block-start:var(--rte-tt-top)] ds:[inset-inline-start:var(--rte-tt-start)]",
|
|
1662
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
1663
|
+
"ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
|
|
1664
|
+
].join(" "), ws = "#fde68a";
|
|
1665
|
+
function Jr({
|
|
1666
|
+
scope: n,
|
|
1667
|
+
icon: a,
|
|
1668
|
+
label: u,
|
|
1669
|
+
onOpenChange: c,
|
|
1670
|
+
saveTableCell: g,
|
|
1671
|
+
applyTableBackground: h
|
|
1672
|
+
}) {
|
|
1673
|
+
const { t: y } = ae("ui"), [w, b] = T(ws);
|
|
1674
|
+
return /* @__PURE__ */ A(
|
|
1675
|
+
ie,
|
|
1676
|
+
{
|
|
1677
|
+
onOpenChange: (p) => {
|
|
1678
|
+
c(p), p && g();
|
|
1679
|
+
},
|
|
1680
|
+
children: [
|
|
1681
|
+
/* @__PURE__ */ t(ie.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1682
|
+
Z,
|
|
1683
|
+
{
|
|
1684
|
+
size: "sm",
|
|
1685
|
+
intent: "ghost",
|
|
1686
|
+
icon: a,
|
|
1687
|
+
tooltip: u,
|
|
1688
|
+
onMouseDown: (p) => p.preventDefault()
|
|
1689
|
+
}
|
|
1690
|
+
) }),
|
|
1691
|
+
/* @__PURE__ */ A(ie.Content, { side: "bottom", align: "center", children: [
|
|
1692
|
+
/* @__PURE__ */ t(
|
|
1693
|
+
tr,
|
|
1694
|
+
{
|
|
1695
|
+
variant: "inline",
|
|
1696
|
+
size: "sm",
|
|
1697
|
+
value: w,
|
|
1698
|
+
onChange: (p) => {
|
|
1699
|
+
b(p), h(n, p);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
),
|
|
1703
|
+
/* @__PURE__ */ t(
|
|
1704
|
+
Le,
|
|
1705
|
+
{
|
|
1706
|
+
size: "sm",
|
|
1707
|
+
intent: "ghost",
|
|
1708
|
+
className: "ds:mt-[var(--spacing-xs)] ds:w-full",
|
|
1709
|
+
onClick: () => h(n, null),
|
|
1710
|
+
children: y("editor.table.clearColor", "Clear colour")
|
|
1711
|
+
}
|
|
1712
|
+
)
|
|
1713
|
+
] })
|
|
1714
|
+
]
|
|
1715
|
+
}
|
|
1716
|
+
);
|
|
1717
|
+
}
|
|
1718
|
+
function ks({
|
|
1719
|
+
active: n,
|
|
1720
|
+
run: a,
|
|
1721
|
+
areaRef: u,
|
|
1722
|
+
getActiveTableEl: c,
|
|
1723
|
+
enableColor: g = !1,
|
|
1724
|
+
saveTableCell: h,
|
|
1725
|
+
applyTableBackground: y
|
|
1726
|
+
}) {
|
|
1727
|
+
const { t: w } = ae("ui"), b = n.has("table"), [p, E] = T(null), R = x(0), [L, S] = T(!1), B = C((m) => {
|
|
1728
|
+
R.current = Math.max(
|
|
1729
|
+
0,
|
|
1730
|
+
R.current + (m ? 1 : -1)
|
|
1731
|
+
), S(R.current > 0);
|
|
1732
|
+
}, []);
|
|
1733
|
+
if (I(() => {
|
|
1734
|
+
if (L) return;
|
|
1735
|
+
if (!b || typeof window > "u") {
|
|
1736
|
+
E(null);
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
const m = () => {
|
|
1740
|
+
const D = u.current, j = c();
|
|
1741
|
+
if (!D || !j) {
|
|
1742
|
+
E(null);
|
|
1743
|
+
return;
|
|
1744
|
+
}
|
|
1745
|
+
const X = D.getBoundingClientRect(), F = j.getBoundingClientRect(), k = getComputedStyle(D).direction === "rtl", se = Math.max(0, F.top - X.top - 44), Q = k ? X.right - F.right + F.width / 2 : F.left - X.left + F.width / 2;
|
|
1746
|
+
E({ top: se, start: Math.max(0, Q), rtl: k });
|
|
1747
|
+
};
|
|
1748
|
+
m();
|
|
1749
|
+
const v = new ResizeObserver(m), z = u.current, H = c();
|
|
1750
|
+
return z && v.observe(z), H && v.observe(H), window.addEventListener("scroll", m, !0), window.addEventListener("resize", m), () => {
|
|
1751
|
+
v.disconnect(), window.removeEventListener("scroll", m, !0), window.removeEventListener("resize", m);
|
|
1752
|
+
};
|
|
1753
|
+
}, [b, L, u, c]), !b && !L || !p) return null;
|
|
1754
|
+
const f = [
|
|
1755
|
+
["rowAbove", "rowBelow"],
|
|
1756
|
+
["colLeft", "colRight"],
|
|
1757
|
+
["addHead"],
|
|
1758
|
+
...g ? ["colour"] : [],
|
|
1759
|
+
["deleteRow", "deleteColumn"],
|
|
1760
|
+
["deleteTable"]
|
|
1761
|
+
];
|
|
1762
|
+
return (
|
|
1763
|
+
// Tooltips disambiguate the icon-only ops on hover (and provide each
|
|
1764
|
+
// button's accessible name via IconButton's `tooltip` prop). Radix Tooltip
|
|
1765
|
+
// needs a provider ancestor, so scope one to the bar.
|
|
1766
|
+
/* @__PURE__ */ t(er, { children: /* @__PURE__ */ t(
|
|
1767
|
+
"div",
|
|
1768
|
+
{
|
|
1769
|
+
role: "group",
|
|
1770
|
+
"aria-label": w("editor.table.toolbar", "Table tools"),
|
|
1771
|
+
className: `${ys} ${p.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
|
|
1772
|
+
style: {
|
|
1773
|
+
"--rte-tt-top": `${p.top}px`,
|
|
1774
|
+
"--rte-tt-start": `${p.start}px`
|
|
1775
|
+
},
|
|
1776
|
+
children: f.map((m, v) => /* @__PURE__ */ A(xt, { children: [
|
|
1777
|
+
v > 0 ? /* @__PURE__ */ t("span", { "aria-hidden": "true", className: hn }) : null,
|
|
1778
|
+
m === "colour" ? /* @__PURE__ */ A(je, { children: [
|
|
1779
|
+
/* @__PURE__ */ t(
|
|
1780
|
+
Jr,
|
|
1781
|
+
{
|
|
1782
|
+
scope: "cell",
|
|
1783
|
+
icon: /* @__PURE__ */ t(pa, {}),
|
|
1784
|
+
label: w("editor.table.cellColor", "Cell colour"),
|
|
1785
|
+
onOpenChange: B,
|
|
1786
|
+
saveTableCell: h,
|
|
1787
|
+
applyTableBackground: y
|
|
1788
|
+
}
|
|
1789
|
+
),
|
|
1790
|
+
/* @__PURE__ */ t(
|
|
1791
|
+
Jr,
|
|
1792
|
+
{
|
|
1793
|
+
scope: "row",
|
|
1794
|
+
icon: /* @__PURE__ */ t(va, {}),
|
|
1795
|
+
label: w("editor.table.rowColor", "Row colour"),
|
|
1796
|
+
onOpenChange: B,
|
|
1797
|
+
saveTableCell: h,
|
|
1798
|
+
applyTableBackground: y
|
|
1799
|
+
}
|
|
1800
|
+
)
|
|
1801
|
+
] }) : m.map((z) => {
|
|
1802
|
+
const H = vs[z];
|
|
1803
|
+
return /* @__PURE__ */ t(
|
|
1804
|
+
Z,
|
|
1805
|
+
{
|
|
1806
|
+
size: "sm",
|
|
1807
|
+
intent: "ghost",
|
|
1808
|
+
icon: H.icon,
|
|
1809
|
+
tooltip: w(H.label[0], H.label[1]),
|
|
1810
|
+
onMouseDown: (D) => D.preventDefault(),
|
|
1811
|
+
onClick: () => a(H.command)
|
|
1812
|
+
},
|
|
1813
|
+
z
|
|
1814
|
+
);
|
|
1815
|
+
})
|
|
1816
|
+
] }, m === "colour" ? "colour" : m[0]))
|
|
1817
|
+
}
|
|
1818
|
+
) })
|
|
1819
|
+
);
|
|
1820
|
+
}
|
|
1821
|
+
const Zn = [
|
|
1822
|
+
"wysiwyg-img-inline",
|
|
1823
|
+
"wysiwyg-img-wrap-left",
|
|
1824
|
+
"wysiwyg-img-wrap-right"
|
|
1825
|
+
], vo = [
|
|
1826
|
+
"wysiwyg-img-align-left",
|
|
1827
|
+
"wysiwyg-img-align-center",
|
|
1828
|
+
"wysiwyg-img-align-right"
|
|
1829
|
+
];
|
|
1830
|
+
function Yr(n, a) {
|
|
1831
|
+
return a.find((u) => n.classList.contains(u)) ?? "";
|
|
1832
|
+
}
|
|
1833
|
+
function xs(n) {
|
|
1834
|
+
const a = n.closest(".redactor-in"), u = a instanceof HTMLElement ? a.clientWidth : 0, c = n.getBoundingClientRect().width;
|
|
1835
|
+
return u <= 0 || c <= 0 ? Ot : Math.round(Math.min(Ot, c / u * 100));
|
|
1836
|
+
}
|
|
1837
|
+
const Qn = 10, Ot = 100, Cs = 5, As = 10, eo = (n) => Math.min(Ot, Math.max(Qn, Math.round(n))), Ns = [
|
|
1838
|
+
{
|
|
1839
|
+
id: "wysiwyg-img-inline",
|
|
1840
|
+
icon: /* @__PURE__ */ t(Bi, {}),
|
|
1841
|
+
label: ["editor.image.inline", "Inline with text"]
|
|
1842
|
+
},
|
|
1843
|
+
{
|
|
1844
|
+
id: "wysiwyg-img-wrap-left",
|
|
1845
|
+
icon: /* @__PURE__ */ t(xa, {}),
|
|
1846
|
+
label: ["editor.image.wrapLeft", "Wrap left"]
|
|
1847
|
+
},
|
|
1848
|
+
{
|
|
1849
|
+
id: "wysiwyg-img-wrap-right",
|
|
1850
|
+
icon: /* @__PURE__ */ t(Aa, {}),
|
|
1851
|
+
label: ["editor.image.wrapRight", "Wrap right"]
|
|
1852
|
+
}
|
|
1853
|
+
], Ts = [
|
|
1854
|
+
{
|
|
1855
|
+
id: "wysiwyg-img-align-left",
|
|
1856
|
+
icon: /* @__PURE__ */ t(mo, {}),
|
|
1857
|
+
label: ["editor.image.alignLeft", "Align left"]
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
id: "wysiwyg-img-align-center",
|
|
1861
|
+
icon: /* @__PURE__ */ t(co, {}),
|
|
1862
|
+
label: ["editor.image.alignCenter", "Align centre"]
|
|
1863
|
+
},
|
|
1864
|
+
{
|
|
1865
|
+
id: "wysiwyg-img-align-right",
|
|
1866
|
+
icon: /* @__PURE__ */ t(uo, {}),
|
|
1867
|
+
label: ["editor.image.alignRight", "Align right"]
|
|
1868
|
+
}
|
|
1869
|
+
], Es = [
|
|
1870
|
+
{
|
|
1871
|
+
id: "tl",
|
|
1872
|
+
pos: "ds:[inset-block-start:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-start:calc(var(--spacing-md)*-0.5)]",
|
|
1873
|
+
cursor: "ds:cursor-nwse-resize",
|
|
1874
|
+
sign: -1,
|
|
1875
|
+
labelKey: "editor.image.resizeTopStart",
|
|
1876
|
+
labelFallback: "Resize image, top-start corner"
|
|
1877
|
+
},
|
|
1878
|
+
{
|
|
1879
|
+
id: "tr",
|
|
1880
|
+
pos: "ds:[inset-block-start:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-end:calc(var(--spacing-md)*-0.5)]",
|
|
1881
|
+
cursor: "ds:cursor-nesw-resize",
|
|
1882
|
+
sign: 1,
|
|
1883
|
+
labelKey: "editor.image.resizeTopEnd",
|
|
1884
|
+
labelFallback: "Resize image, top-end corner"
|
|
1885
|
+
},
|
|
1886
|
+
{
|
|
1887
|
+
id: "bl",
|
|
1888
|
+
pos: "ds:[inset-block-end:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-start:calc(var(--spacing-md)*-0.5)]",
|
|
1889
|
+
cursor: "ds:cursor-nesw-resize",
|
|
1890
|
+
sign: -1,
|
|
1891
|
+
labelKey: "editor.image.resizeBottomStart",
|
|
1892
|
+
labelFallback: "Resize image, bottom-start corner"
|
|
1893
|
+
},
|
|
1894
|
+
{
|
|
1895
|
+
id: "br",
|
|
1896
|
+
pos: "ds:[inset-block-end:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-end:calc(var(--spacing-md)*-0.5)]",
|
|
1897
|
+
cursor: "ds:cursor-nwse-resize",
|
|
1898
|
+
sign: 1,
|
|
1899
|
+
labelKey: "editor.image.resizeBottomEnd",
|
|
1900
|
+
labelFallback: "Resize image, bottom-end corner"
|
|
1901
|
+
}
|
|
1902
|
+
], Rs = [
|
|
1903
|
+
"ds:absolute ds:z-20 ds:pointer-events-none",
|
|
1904
|
+
"ds:[inset-block-start:var(--rte-img-top)] ds:[inset-inline-start:var(--rte-img-start)]",
|
|
1905
|
+
"ds:[inline-size:var(--rte-img-width)] ds:[block-size:var(--rte-img-height)]",
|
|
1906
|
+
"ds:rounded-[var(--radius-2xs)]",
|
|
1907
|
+
"ds:[outline-style:solid] ds:[outline-width:var(--border-width-md)]",
|
|
1908
|
+
"ds:[outline-color:var(--accent)] ds:[outline-offset:var(--focus-ring-offset)]"
|
|
1909
|
+
].join(" "), Ms = [
|
|
1910
|
+
"ds:absolute ds:pointer-events-auto ds:touch-none",
|
|
1911
|
+
"ds:[inline-size:var(--spacing-md)] ds:[block-size:var(--spacing-md)]",
|
|
1912
|
+
"ds:rounded-[var(--radius-2xs)] ds:shadow-[var(--shadow-sm)]",
|
|
1913
|
+
"ds:bg-[var(--accent)] ds:border ds:border-[color:var(--background)]",
|
|
1914
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
1915
|
+
"ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)]",
|
|
1916
|
+
"ds:focus-visible:[outline-offset:var(--focus-ring-offset)]",
|
|
1917
|
+
"ds:forced-colors:bg-[CanvasText]"
|
|
1918
|
+
].join(" "), Ss = [
|
|
1919
|
+
"ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
|
|
1920
|
+
"ds:[inset-block-start:var(--rte-img-bar-top)] ds:[inset-inline-start:var(--rte-img-center)]",
|
|
1921
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
1922
|
+
"ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
|
|
1923
|
+
].join(" ");
|
|
1924
|
+
function zs({
|
|
1925
|
+
areaRef: n,
|
|
1926
|
+
activeImageEl: a,
|
|
1927
|
+
applyImageClass: u,
|
|
1928
|
+
setImageWidth: c
|
|
1929
|
+
}) {
|
|
1930
|
+
const { t: g } = ae("ui"), [h, y] = T(null), w = x(null);
|
|
1931
|
+
I(() => {
|
|
1932
|
+
if (!a || typeof window > "u") {
|
|
1933
|
+
y(null);
|
|
1934
|
+
return;
|
|
1935
|
+
}
|
|
1936
|
+
const f = () => {
|
|
1937
|
+
const D = n.current;
|
|
1938
|
+
if (!D) {
|
|
1939
|
+
y(null);
|
|
1940
|
+
return;
|
|
1941
|
+
}
|
|
1942
|
+
const j = D.getBoundingClientRect(), X = a.getBoundingClientRect(), F = getComputedStyle(D).direction === "rtl", k = X.top - j.top, se = F ? j.right - X.right : X.left - j.left, Q = se + X.width / 2, oe = Math.max(0, k - 44);
|
|
1943
|
+
y({
|
|
1944
|
+
top: k,
|
|
1945
|
+
start: Math.max(0, se),
|
|
1946
|
+
width: X.width,
|
|
1947
|
+
height: X.height,
|
|
1948
|
+
center: Math.max(0, Q),
|
|
1949
|
+
barTop: oe,
|
|
1950
|
+
pct: xs(a),
|
|
1951
|
+
rtl: F
|
|
1952
|
+
});
|
|
1953
|
+
};
|
|
1954
|
+
f();
|
|
1955
|
+
const m = new ResizeObserver(f);
|
|
1956
|
+
m.observe(a);
|
|
1957
|
+
const v = n.current;
|
|
1958
|
+
v && m.observe(v);
|
|
1959
|
+
const z = a.closest(".redactor-in");
|
|
1960
|
+
let H = null;
|
|
1961
|
+
return z && (H = new MutationObserver(f), H.observe(z, {
|
|
1962
|
+
subtree: !0,
|
|
1963
|
+
childList: !0,
|
|
1964
|
+
characterData: !0,
|
|
1965
|
+
attributes: !0,
|
|
1966
|
+
attributeFilter: ["class", "style", "width", "height", "src"]
|
|
1967
|
+
})), window.addEventListener("scroll", f, !0), window.addEventListener("resize", f), () => {
|
|
1968
|
+
m.disconnect(), H == null || H.disconnect(), window.removeEventListener("scroll", f, !0), window.removeEventListener("resize", f);
|
|
1969
|
+
};
|
|
1970
|
+
}, [a, n]);
|
|
1971
|
+
const b = C(
|
|
1972
|
+
(f) => (m) => {
|
|
1973
|
+
!m.isPrimary || !h || (m.preventDefault(), m.currentTarget.setPointerCapture(m.pointerId), w.current = {
|
|
1974
|
+
pointerId: m.pointerId,
|
|
1975
|
+
startX: m.clientX,
|
|
1976
|
+
startPct: h.pct,
|
|
1977
|
+
sign: f.sign * (h.rtl ? -1 : 1)
|
|
1978
|
+
});
|
|
1979
|
+
},
|
|
1980
|
+
[h]
|
|
1981
|
+
), p = C(
|
|
1982
|
+
(f) => {
|
|
1983
|
+
const m = w.current;
|
|
1984
|
+
if (!m || f.pointerId !== m.pointerId || !a) return;
|
|
1985
|
+
const v = a.closest(".redactor-in"), z = v instanceof HTMLElement ? v.clientWidth : 0;
|
|
1986
|
+
if (z <= 0) return;
|
|
1987
|
+
const H = m.sign * (f.clientX - m.startX) / z * 100;
|
|
1988
|
+
c(eo(m.startPct + H));
|
|
1989
|
+
},
|
|
1990
|
+
[a, c]
|
|
1991
|
+
), E = C(
|
|
1992
|
+
(f) => {
|
|
1993
|
+
const m = w.current;
|
|
1994
|
+
!m || f.pointerId !== m.pointerId || (f.currentTarget.releasePointerCapture(f.pointerId), w.current = null);
|
|
1995
|
+
},
|
|
1996
|
+
[]
|
|
1997
|
+
), R = C(
|
|
1998
|
+
(f) => {
|
|
1999
|
+
if (!h) return;
|
|
2000
|
+
let m = null;
|
|
2001
|
+
const v = f.shiftKey ? As : Cs;
|
|
2002
|
+
switch (f.key) {
|
|
2003
|
+
// Up / right always grow; down / left always shrink — independent of
|
|
2004
|
+
// which corner has focus, so the gesture reads the same everywhere.
|
|
2005
|
+
case "ArrowRight":
|
|
2006
|
+
case "ArrowUp":
|
|
2007
|
+
m = h.pct + v;
|
|
2008
|
+
break;
|
|
2009
|
+
case "ArrowLeft":
|
|
2010
|
+
case "ArrowDown":
|
|
2011
|
+
m = h.pct - v;
|
|
2012
|
+
break;
|
|
2013
|
+
case "Home":
|
|
2014
|
+
m = Qn;
|
|
2015
|
+
break;
|
|
2016
|
+
case "End":
|
|
2017
|
+
m = Ot;
|
|
2018
|
+
break;
|
|
2019
|
+
default:
|
|
2020
|
+
return;
|
|
2021
|
+
}
|
|
2022
|
+
f.preventDefault(), c(eo(m));
|
|
2023
|
+
},
|
|
2024
|
+
[h, c]
|
|
2025
|
+
);
|
|
2026
|
+
if (!a || !h) return null;
|
|
2027
|
+
const L = Yr(a, Zn), S = Yr(a, vo), B = g("editor.image.widthAnnounce", {
|
|
2028
|
+
width: h.pct,
|
|
2029
|
+
defaultValue: "{{width}} percent"
|
|
2030
|
+
});
|
|
2031
|
+
return /* @__PURE__ */ A(je, { children: [
|
|
2032
|
+
/* @__PURE__ */ t(
|
|
2033
|
+
"div",
|
|
2034
|
+
{
|
|
2035
|
+
className: Rs,
|
|
2036
|
+
style: {
|
|
2037
|
+
"--rte-img-top": `${h.top}px`,
|
|
2038
|
+
"--rte-img-start": `${h.start}px`,
|
|
2039
|
+
"--rte-img-width": `${h.width}px`,
|
|
2040
|
+
"--rte-img-height": `${h.height}px`
|
|
2041
|
+
},
|
|
2042
|
+
children: Es.map((f) => /* @__PURE__ */ t(
|
|
2043
|
+
"div",
|
|
2044
|
+
{
|
|
2045
|
+
role: "slider",
|
|
2046
|
+
tabIndex: 0,
|
|
2047
|
+
"aria-label": g(f.labelKey, f.labelFallback),
|
|
2048
|
+
"aria-orientation": "horizontal",
|
|
2049
|
+
"aria-valuemin": Qn,
|
|
2050
|
+
"aria-valuemax": Ot,
|
|
2051
|
+
"aria-valuenow": h.pct,
|
|
2052
|
+
"aria-valuetext": B,
|
|
2053
|
+
className: `${Ms} ${f.pos} ${f.cursor}`,
|
|
2054
|
+
onPointerDown: b(f),
|
|
2055
|
+
onPointerMove: p,
|
|
2056
|
+
onPointerUp: E,
|
|
2057
|
+
onPointerCancel: E,
|
|
2058
|
+
onKeyDown: R
|
|
2059
|
+
},
|
|
2060
|
+
f.id
|
|
2061
|
+
))
|
|
2062
|
+
}
|
|
2063
|
+
),
|
|
2064
|
+
/* @__PURE__ */ t(er, { children: /* @__PURE__ */ t(
|
|
2065
|
+
"div",
|
|
2066
|
+
{
|
|
2067
|
+
role: "group",
|
|
2068
|
+
"aria-label": g("editor.image.toolbar", "Image tools"),
|
|
2069
|
+
className: `${Ss} ${h.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
|
|
2070
|
+
style: {
|
|
2071
|
+
"--rte-img-bar-top": `${h.barTop}px`,
|
|
2072
|
+
"--rte-img-center": `${h.center}px`
|
|
2073
|
+
},
|
|
2074
|
+
children: [Ns, Ts].map((f, m) => /* @__PURE__ */ A(xt, { children: [
|
|
2075
|
+
m > 0 ? /* @__PURE__ */ t("span", { "aria-hidden": "true", className: hn }) : null,
|
|
2076
|
+
f.map((v) => {
|
|
2077
|
+
const z = m === 0 ? L === v.id : S === v.id;
|
|
2078
|
+
return /* @__PURE__ */ t(
|
|
2079
|
+
Z,
|
|
2080
|
+
{
|
|
2081
|
+
size: "sm",
|
|
2082
|
+
intent: "ghost",
|
|
2083
|
+
icon: v.icon,
|
|
2084
|
+
"aria-pressed": z,
|
|
2085
|
+
tooltip: g(v.label[0], v.label[1]),
|
|
2086
|
+
onMouseDown: (H) => H.preventDefault(),
|
|
2087
|
+
onClick: () => u(v.id)
|
|
2088
|
+
},
|
|
2089
|
+
v.id
|
|
2090
|
+
);
|
|
2091
|
+
})
|
|
2092
|
+
] }, m === 0 ? "flow" : "align"))
|
|
2093
|
+
}
|
|
2094
|
+
) })
|
|
2095
|
+
] });
|
|
2096
|
+
}
|
|
2097
|
+
function Ls({
|
|
2098
|
+
templates: n,
|
|
2099
|
+
onPick: a,
|
|
2100
|
+
onManage: u,
|
|
2101
|
+
noteEmpty: c,
|
|
2102
|
+
onOpenChange: g,
|
|
2103
|
+
trigger: h,
|
|
2104
|
+
side: y = "top"
|
|
2105
|
+
}) {
|
|
2106
|
+
const { t: w } = ae("ui"), b = Ve();
|
|
2107
|
+
return /* @__PURE__ */ A(W.Root, { onOpenChange: g, children: [
|
|
2108
|
+
/* @__PURE__ */ t(W.Trigger, { asChild: !0, children: h }),
|
|
2109
|
+
/* @__PURE__ */ A(W.Content, { side: y, align: "end", sideOffset: 8, children: [
|
|
2110
|
+
/* @__PURE__ */ t(W.Label, { children: n.length > 0 ? w("editor.ai.templatesGroup") : w("editor.ai.noTemplates") }),
|
|
2111
|
+
n.map((p) => /* @__PURE__ */ t(
|
|
2112
|
+
W.Item,
|
|
2113
|
+
{
|
|
2114
|
+
startIcon: /* @__PURE__ */ t(Wn, {}),
|
|
2115
|
+
description: p.description || void 0,
|
|
2116
|
+
"aria-disabled": c || void 0,
|
|
2117
|
+
"aria-describedby": c ? b : void 0,
|
|
2118
|
+
className: "ds:aria-disabled:opacity-50 ds:aria-disabled:cursor-not-allowed",
|
|
2119
|
+
onSelect: (E) => {
|
|
2120
|
+
if (c) {
|
|
2121
|
+
E.preventDefault();
|
|
2122
|
+
return;
|
|
2123
|
+
}
|
|
2124
|
+
a(p);
|
|
2125
|
+
},
|
|
2126
|
+
children: p.name
|
|
2127
|
+
},
|
|
2128
|
+
p.id
|
|
2129
|
+
)),
|
|
2130
|
+
c && n.length > 0 ? /* @__PURE__ */ t(
|
|
2131
|
+
"p",
|
|
2132
|
+
{
|
|
2133
|
+
id: b,
|
|
2134
|
+
className: "ds:m-0 ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] ds:text-[length:var(--font-size-xs)] ds:text-[color:var(--muted-foreground)]",
|
|
2135
|
+
children: w("editor.ai.templatesNoteEmpty")
|
|
2136
|
+
}
|
|
2137
|
+
) : null,
|
|
2138
|
+
u && n.length === 0 ? /* @__PURE__ */ t(
|
|
2139
|
+
W.Item,
|
|
2140
|
+
{
|
|
2141
|
+
startIcon: /* @__PURE__ */ t($i, {}),
|
|
2142
|
+
onSelect: () => u("create"),
|
|
2143
|
+
children: w("editor.ai.createFirstTemplate")
|
|
2144
|
+
}
|
|
2145
|
+
) : null,
|
|
2146
|
+
u && n.length > 0 ? /* @__PURE__ */ A(je, { children: [
|
|
2147
|
+
/* @__PURE__ */ t(W.Separator, {}),
|
|
2148
|
+
/* @__PURE__ */ t(
|
|
2149
|
+
W.Item,
|
|
2150
|
+
{
|
|
2151
|
+
startIcon: /* @__PURE__ */ t(Hi, {}),
|
|
2152
|
+
onSelect: () => u("list"),
|
|
2153
|
+
children: w("editor.ai.manageTemplates")
|
|
2154
|
+
}
|
|
2155
|
+
)
|
|
2156
|
+
] }) : null
|
|
2157
|
+
] })
|
|
2158
|
+
] });
|
|
2159
|
+
}
|
|
2160
|
+
const _s = [
|
|
2161
|
+
"ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
|
|
2162
|
+
"ds:[inset-block-start:var(--rte-sel-top)] ds:[inset-inline-start:var(--rte-sel-start)]",
|
|
2163
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
2164
|
+
"ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]",
|
|
2165
|
+
bo
|
|
2166
|
+
].join(" "), Is = ["bold", "italic", "underline", "strike"];
|
|
2167
|
+
function $s({
|
|
2168
|
+
active: n,
|
|
2169
|
+
run: a,
|
|
2170
|
+
areaRef: u,
|
|
2171
|
+
getEditorRoot: c,
|
|
2172
|
+
suppressed: g = !1,
|
|
2173
|
+
holdOpen: h = !1,
|
|
2174
|
+
children: y
|
|
2175
|
+
}) {
|
|
2176
|
+
const { t: w } = ae("ui"), b = x(null), [p, E] = T(null), R = x(h);
|
|
2177
|
+
return I(() => {
|
|
2178
|
+
R.current = h;
|
|
2179
|
+
}, [h]), I(() => {
|
|
2180
|
+
if (g || typeof window > "u") {
|
|
2181
|
+
E(null);
|
|
2182
|
+
return;
|
|
2183
|
+
}
|
|
2184
|
+
let L = !1, S = 0, B = !1, f = !1;
|
|
2185
|
+
const m = () => {
|
|
2186
|
+
B = !1, E(null);
|
|
2187
|
+
}, v = () => {
|
|
2188
|
+
var Re;
|
|
2189
|
+
if (R.current || L) return;
|
|
2190
|
+
if (f) {
|
|
2191
|
+
m();
|
|
2192
|
+
return;
|
|
2193
|
+
}
|
|
2194
|
+
const F = u.current, k = c(), se = window.getSelection();
|
|
2195
|
+
if (!F || !k || !se || se.rangeCount === 0 || se.isCollapsed || !F.contains(document.activeElement)) {
|
|
2196
|
+
m();
|
|
2197
|
+
return;
|
|
2198
|
+
}
|
|
2199
|
+
const Q = se.getRangeAt(0);
|
|
2200
|
+
if (!k.contains(Q.commonAncestorContainer)) {
|
|
2201
|
+
m();
|
|
2202
|
+
return;
|
|
2203
|
+
}
|
|
2204
|
+
if (!Q.toString().trim()) {
|
|
2205
|
+
m();
|
|
2206
|
+
return;
|
|
2207
|
+
}
|
|
2208
|
+
const oe = F.getBoundingClientRect(), le = Q.getBoundingClientRect(), J = getComputedStyle(F).direction === "rtl", Ee = le.top - oe.top - 48, U = Ee >= 0 ? Ee : le.bottom - oe.top + 8, he = ((Re = b.current) == null ? void 0 : Re.offsetWidth) ?? 0, V = J ? oe.right - le.right + le.width / 2 : le.left - oe.left + le.width / 2, te = he / 2, ce = Math.min(
|
|
2209
|
+
Math.max(V, te),
|
|
2210
|
+
Math.max(te, oe.width - te)
|
|
2211
|
+
);
|
|
2212
|
+
E({ top: U, start: ce, rtl: J }), he === 0 && !B && (B = !0, S = requestAnimationFrame(v));
|
|
2213
|
+
}, z = () => {
|
|
2214
|
+
cancelAnimationFrame(S), S = requestAnimationFrame(v);
|
|
2215
|
+
}, H = (F) => {
|
|
2216
|
+
const k = c();
|
|
2217
|
+
k && F.target instanceof Node && k.contains(F.target) && (L = !0, m());
|
|
2218
|
+
}, D = () => {
|
|
2219
|
+
L && (L = !1, z());
|
|
2220
|
+
}, j = (F) => {
|
|
2221
|
+
if (F.key !== "Escape") return;
|
|
2222
|
+
const k = u.current;
|
|
2223
|
+
!k || !k.contains(document.activeElement) || (f = !0, m());
|
|
2224
|
+
}, X = () => {
|
|
2225
|
+
f = !1, z();
|
|
2226
|
+
};
|
|
2227
|
+
return document.addEventListener("selectionchange", X), document.addEventListener("focusin", z), document.addEventListener("keydown", j, !0), document.addEventListener("pointerdown", H, !0), document.addEventListener("pointerup", D, !0), document.addEventListener("pointercancel", D, !0), window.addEventListener("scroll", z, !0), window.addEventListener("resize", z), z(), () => {
|
|
2228
|
+
cancelAnimationFrame(S), document.removeEventListener("selectionchange", X), document.removeEventListener("focusin", z), document.removeEventListener("keydown", j, !0), document.removeEventListener("pointerdown", H, !0), document.removeEventListener("pointerup", D, !0), document.removeEventListener("pointercancel", D, !0), window.removeEventListener("scroll", z, !0), window.removeEventListener("resize", z);
|
|
2229
|
+
};
|
|
2230
|
+
}, [g, u, c]), g || !p ? null : /* @__PURE__ */ t(er, { children: /* @__PURE__ */ A(
|
|
2231
|
+
"div",
|
|
2232
|
+
{
|
|
2233
|
+
ref: b,
|
|
2234
|
+
role: "group",
|
|
2235
|
+
"aria-label": w("editor.ai.selectionTools"),
|
|
2236
|
+
"data-component-part": "selection-toolbar",
|
|
2237
|
+
className: `${_s} ${p.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
|
|
2238
|
+
style: {
|
|
2239
|
+
"--rte-sel-top": `${p.top}px`,
|
|
2240
|
+
"--rte-sel-start": `${p.start}px`
|
|
2241
|
+
},
|
|
2242
|
+
children: [
|
|
2243
|
+
Is.map((L) => {
|
|
2244
|
+
const S = ho[L];
|
|
2245
|
+
return /* @__PURE__ */ t(
|
|
2246
|
+
Z,
|
|
2247
|
+
{
|
|
2248
|
+
size: "sm",
|
|
2249
|
+
intent: "ghost",
|
|
2250
|
+
icon: S.icon,
|
|
2251
|
+
tooltip: w(S.label[0], S.label[1]),
|
|
2252
|
+
"aria-pressed": S.toggle ? n.has(S.toggle) : void 0,
|
|
2253
|
+
onMouseDown: (B) => B.preventDefault(),
|
|
2254
|
+
onClick: () => a(...S.command)
|
|
2255
|
+
},
|
|
2256
|
+
L
|
|
2257
|
+
);
|
|
2258
|
+
}),
|
|
2259
|
+
y ? /* @__PURE__ */ A(je, { children: [
|
|
2260
|
+
/* @__PURE__ */ t("span", { "aria-hidden": "true", className: hn }),
|
|
2261
|
+
y
|
|
2262
|
+
] }) : null
|
|
2263
|
+
]
|
|
2264
|
+
}
|
|
2265
|
+
) });
|
|
2266
|
+
}
|
|
2267
|
+
function Hs({
|
|
2268
|
+
run: n,
|
|
2269
|
+
active: a,
|
|
2270
|
+
preset: u,
|
|
2271
|
+
insertHtml: c,
|
|
2272
|
+
insertTable: g,
|
|
2273
|
+
saveSelection: h,
|
|
2274
|
+
restoreSelection: y,
|
|
2275
|
+
getSelectedText: w,
|
|
2276
|
+
uploadImage: b,
|
|
2277
|
+
enableColor: p = !1,
|
|
2278
|
+
enableImage: E = !1,
|
|
2279
|
+
enableTable: R = !1,
|
|
2280
|
+
showExtensions: L = !1,
|
|
2281
|
+
extensionControl: S,
|
|
2282
|
+
variables: B,
|
|
2283
|
+
recentVariableTokens: f,
|
|
2284
|
+
insertVariable: m
|
|
2285
|
+
}) {
|
|
2286
|
+
const { t: v } = ae("ui"), z = (V) => V.preventDefault(), H = (V) => is[u].includes(V), D = (V) => {
|
|
2287
|
+
if (!H(V)) return null;
|
|
2288
|
+
const te = ho[V];
|
|
2289
|
+
return /* @__PURE__ */ t(
|
|
2290
|
+
Z,
|
|
2291
|
+
{
|
|
2292
|
+
size: "sm",
|
|
2293
|
+
intent: "ghost",
|
|
2294
|
+
icon: te.icon,
|
|
2295
|
+
"aria-label": v(te.label[0], te.label[1]),
|
|
2296
|
+
"aria-pressed": te.toggle ? a.has(te.toggle) : void 0,
|
|
2297
|
+
onMouseDown: z,
|
|
2298
|
+
onClick: () => n(...te.command)
|
|
2299
|
+
},
|
|
2300
|
+
te.id
|
|
2301
|
+
);
|
|
2302
|
+
}, j = () => /* @__PURE__ */ t("span", { "aria-hidden": "true", className: hn }), X = H("format"), F = [D("undo"), D("redo")].filter(Boolean), k = [
|
|
2303
|
+
D("bold"),
|
|
2304
|
+
D("italic"),
|
|
2305
|
+
D("underline"),
|
|
2306
|
+
D("strike"),
|
|
2307
|
+
p ? /* @__PURE__ */ t(
|
|
2308
|
+
gs,
|
|
2309
|
+
{
|
|
2310
|
+
run: n,
|
|
2311
|
+
saveSelection: h,
|
|
2312
|
+
restoreSelection: y
|
|
2313
|
+
},
|
|
2314
|
+
"colour"
|
|
2315
|
+
) : null,
|
|
2316
|
+
p ? /* @__PURE__ */ t(
|
|
2317
|
+
hs,
|
|
2318
|
+
{
|
|
2319
|
+
run: n,
|
|
2320
|
+
saveSelection: h,
|
|
2321
|
+
restoreSelection: y
|
|
2322
|
+
},
|
|
2323
|
+
"highlight"
|
|
2324
|
+
) : null
|
|
2325
|
+
].filter(Boolean), se = F.length > 0 || X || k.length > 0, Q = H("align") ? [
|
|
2326
|
+
/* @__PURE__ */ t(
|
|
2327
|
+
us,
|
|
2328
|
+
{
|
|
2329
|
+
run: n,
|
|
2330
|
+
active: a,
|
|
2331
|
+
onTriggerDown: z
|
|
2332
|
+
},
|
|
2333
|
+
"align"
|
|
2334
|
+
)
|
|
2335
|
+
] : [], oe = [D("ul"), D("ol")].filter(Boolean), le = [
|
|
2336
|
+
H("link") ? /* @__PURE__ */ t(
|
|
2337
|
+
ms,
|
|
2338
|
+
{
|
|
2339
|
+
insertHtml: c,
|
|
2340
|
+
saveSelection: h,
|
|
2341
|
+
restoreSelection: y,
|
|
2342
|
+
getSelectedText: w
|
|
2343
|
+
},
|
|
2344
|
+
"link"
|
|
2345
|
+
) : null,
|
|
2346
|
+
E ? /* @__PURE__ */ t(
|
|
2347
|
+
fs,
|
|
2348
|
+
{
|
|
2349
|
+
insertHtml: c,
|
|
2350
|
+
saveSelection: h,
|
|
2351
|
+
restoreSelection: y,
|
|
2352
|
+
uploadImage: b
|
|
2353
|
+
},
|
|
2354
|
+
"image"
|
|
2355
|
+
) : null,
|
|
2356
|
+
R ? /* @__PURE__ */ t(
|
|
2357
|
+
bs,
|
|
2358
|
+
{
|
|
2359
|
+
run: n,
|
|
2360
|
+
insertTable: g,
|
|
2361
|
+
active: a
|
|
2362
|
+
},
|
|
2363
|
+
"table"
|
|
2364
|
+
) : null,
|
|
2365
|
+
B && B.length > 0 && m ? /* @__PURE__ */ t(
|
|
2366
|
+
cs,
|
|
2367
|
+
{
|
|
2368
|
+
variables: B,
|
|
2369
|
+
recentVariableTokens: f,
|
|
2370
|
+
insertVariable: m,
|
|
2371
|
+
saveSelection: h
|
|
2372
|
+
},
|
|
2373
|
+
"variables"
|
|
2374
|
+
) : null
|
|
2375
|
+
].filter(Boolean), J = S ? [/* @__PURE__ */ t(xt, { children: S }, "extensions")] : L ? [
|
|
2376
|
+
/* @__PURE__ */ t(
|
|
2377
|
+
Z,
|
|
2378
|
+
{
|
|
2379
|
+
size: "sm",
|
|
2380
|
+
intent: "ghost",
|
|
2381
|
+
icon: /* @__PURE__ */ t(Xn, {}),
|
|
2382
|
+
"aria-label": v("editor.extensions", "Editor extensions"),
|
|
2383
|
+
disabled: !0,
|
|
2384
|
+
onMouseDown: z
|
|
2385
|
+
},
|
|
2386
|
+
"extensions"
|
|
2387
|
+
)
|
|
2388
|
+
] : [], Ee = [
|
|
2389
|
+
Q,
|
|
2390
|
+
oe,
|
|
2391
|
+
le,
|
|
2392
|
+
J
|
|
2393
|
+
].filter((V) => V.length > 0), U = Ee.length > 0, he = (V) => Ee.map((te, ce) => /* @__PURE__ */ A(xt, { children: [
|
|
2394
|
+
ce > 0 || V ? /* @__PURE__ */ t(j, {}) : null,
|
|
2395
|
+
te
|
|
2396
|
+
] }, ce));
|
|
2397
|
+
return (
|
|
2398
|
+
// Outer element is the query container + visual chrome; the flex row is an
|
|
2399
|
+
// inner child so `container-type` never lands on the flex parent (which
|
|
2400
|
+
// would blockify the inline controls).
|
|
2401
|
+
/* @__PURE__ */ t("div", { className: as(), "data-component": "editor-toolbar", children: /* @__PURE__ */ A(
|
|
2402
|
+
"div",
|
|
2403
|
+
{
|
|
2404
|
+
role: "group",
|
|
2405
|
+
"aria-label": v("editor.toolbarLabel"),
|
|
2406
|
+
className: ss,
|
|
2407
|
+
children: [
|
|
2408
|
+
F,
|
|
2409
|
+
F.length > 0 && (X || k.length > 0) ? /* @__PURE__ */ t(j, {}) : null,
|
|
2410
|
+
X ? /* @__PURE__ */ t(ds, { run: n, active: a, onTriggerDown: z }) : null,
|
|
2411
|
+
X && k.length > 0 ? /* @__PURE__ */ t(j, {}) : null,
|
|
2412
|
+
k,
|
|
2413
|
+
U ? /* @__PURE__ */ A(je, { children: [
|
|
2414
|
+
/* @__PURE__ */ t("div", { className: "ds:hidden ds:@[384px]/toolbar:contents", children: he(se) }),
|
|
2415
|
+
/* @__PURE__ */ A("div", { className: "ds:contents ds:@[384px]/toolbar:hidden", children: [
|
|
2416
|
+
se ? /* @__PURE__ */ t(j, {}) : null,
|
|
2417
|
+
/* @__PURE__ */ A(ie, { children: [
|
|
2418
|
+
/* @__PURE__ */ t(ie.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2419
|
+
Z,
|
|
2420
|
+
{
|
|
2421
|
+
size: "sm",
|
|
2422
|
+
intent: "ghost",
|
|
2423
|
+
icon: /* @__PURE__ */ t(Li, {}),
|
|
2424
|
+
"aria-label": v("editor.more", "More options"),
|
|
2425
|
+
onMouseDown: z
|
|
2426
|
+
}
|
|
2427
|
+
) }),
|
|
2428
|
+
/* @__PURE__ */ t(ie.Content, { side: "bottom", align: "end", children: /* @__PURE__ */ t("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: he(!1) }) })
|
|
2429
|
+
] })
|
|
2430
|
+
] })
|
|
2431
|
+
] }) : null
|
|
2432
|
+
]
|
|
2433
|
+
}
|
|
2434
|
+
) })
|
|
2435
|
+
);
|
|
2436
|
+
}
|
|
2437
|
+
function ze(n) {
|
|
2438
|
+
return fi(n, "rich-text");
|
|
2439
|
+
}
|
|
2440
|
+
function un(n = "") {
|
|
2441
|
+
const a = String(n).trim();
|
|
2442
|
+
if (a === "" || a === "<p><br></p>" || a === "<p> </p>")
|
|
2443
|
+
return "";
|
|
2444
|
+
const u = a.replace(/<br\s*\/?>/gi, "").replace(/ /gi, "").replace(/<[^>]+>/g, "").trim();
|
|
2445
|
+
return u === "" && /<img\b[^>]*>/i.test(a) ? a : u === "" ? "" : a;
|
|
2446
|
+
}
|
|
2447
|
+
function to(n) {
|
|
2448
|
+
return n.replace(
|
|
2449
|
+
/<img(?![^>]*\sloading=)([^>]*)>/gi,
|
|
2450
|
+
'<img loading="lazy"$1>'
|
|
2451
|
+
);
|
|
2452
|
+
}
|
|
2453
|
+
const Os = Un.join(", "), Ds = 10, jn = /^[A-Za-z0-9_]+$/, yo = /\[\[([A-Za-z0-9_]+)\]\]/g, Jn = "rte-variable-invalid", Ps = new RegExp(
|
|
2454
|
+
`\\s*\\b${Jn}\\b`,
|
|
2455
|
+
"g"
|
|
2456
|
+
);
|
|
2457
|
+
function no(n) {
|
|
2458
|
+
const a = n.includes("data-rte-interim") ? n.replace(/<span\b[^>]*\bdata-rte-interim\b[^>]*>[^<]*<\/span>/g, "") : n;
|
|
2459
|
+
return a.includes('data-redactor-type="variable"') ? a.replace(
|
|
2460
|
+
/<span\b[^>]*data-redactor-type="variable"[^>]*>/g,
|
|
2461
|
+
(u) => u.replace(/\s(?:data-label|title)="[^"]*"/g, "").replace(Ps, "").replace(/\sclass=""/g, "")
|
|
2462
|
+
) : a;
|
|
2463
|
+
}
|
|
2464
|
+
function qs(n) {
|
|
2465
|
+
const a = n.replace(/<[^>]*>/g, " ");
|
|
2466
|
+
return Array.from(a.matchAll(yo), (u) => u[1]);
|
|
2467
|
+
}
|
|
2468
|
+
function ro(n) {
|
|
2469
|
+
return typeof n == "object" && n !== null && "name" in n && n.name === "AiCreditsExhaustedError";
|
|
2470
|
+
}
|
|
2471
|
+
function Bs(n) {
|
|
2472
|
+
return typeof n == "object" && n !== null && "name" in n && n.name === "AbortError";
|
|
2473
|
+
}
|
|
2474
|
+
function Fs(n) {
|
|
2475
|
+
const a = document.createElement("template");
|
|
2476
|
+
return a.content.appendChild(n), a.innerHTML;
|
|
2477
|
+
}
|
|
2478
|
+
function oo(n) {
|
|
2479
|
+
const a = document.createElement("template");
|
|
2480
|
+
return a.innerHTML = n, (a.content.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
2481
|
+
}
|
|
2482
|
+
function io(n) {
|
|
2483
|
+
return n.replace(/<[^>]*>/g, "").replace(/ /gi, "").replace(/[\s\u200B\uFEFF]+/g, "");
|
|
2484
|
+
}
|
|
2485
|
+
function js(n) {
|
|
2486
|
+
const a = window.getSelection();
|
|
2487
|
+
if (!a || a.rangeCount === 0) return null;
|
|
2488
|
+
const u = a.getRangeAt(0);
|
|
2489
|
+
if (!n.contains(u.startContainer)) return null;
|
|
2490
|
+
const c = document.createRange();
|
|
2491
|
+
return c.selectNodeContents(n), c.setEnd(u.startContainer, u.startOffset), c.toString().length;
|
|
2492
|
+
}
|
|
2493
|
+
function Gs(n, a) {
|
|
2494
|
+
var h;
|
|
2495
|
+
const u = window.getSelection();
|
|
2496
|
+
if (!u) return;
|
|
2497
|
+
const c = document.createTreeWalker(n, NodeFilter.SHOW_TEXT);
|
|
2498
|
+
let g = 0;
|
|
2499
|
+
for (let y = c.nextNode(); y; y = c.nextNode()) {
|
|
2500
|
+
const w = y;
|
|
2501
|
+
if (g + w.data.length >= a) {
|
|
2502
|
+
const b = document.createRange(), p = (h = w.parentElement) == null ? void 0 : h.closest(
|
|
2503
|
+
'[data-redactor-type="variable"]'
|
|
2504
|
+
);
|
|
2505
|
+
p ? b.setStartAfter(p) : b.setStart(w, a - g), b.collapse(!0), u.removeAllRanges(), u.addRange(b);
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
g += w.data.length;
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
function ao(n) {
|
|
2512
|
+
return `<span data-redactor-type="variable">[[${n}]]</span>`;
|
|
2513
|
+
}
|
|
2514
|
+
function kt(n, a) {
|
|
2515
|
+
var y;
|
|
2516
|
+
if (a.size === 0 || !n.includes("[[") || typeof DOMParser > "u")
|
|
2517
|
+
return n;
|
|
2518
|
+
const u = new DOMParser().parseFromString(
|
|
2519
|
+
`<body>${n}</body>`,
|
|
2520
|
+
"text/html"
|
|
2521
|
+
), c = u.createTreeWalker(u.body, NodeFilter.SHOW_TEXT), g = [];
|
|
2522
|
+
for (let w = c.nextNode(); w; w = c.nextNode()) {
|
|
2523
|
+
const b = w;
|
|
2524
|
+
(y = b.parentElement) != null && y.closest('[data-redactor-type="variable"]') || b.data.includes("[[") && g.push(b);
|
|
2525
|
+
}
|
|
2526
|
+
let h = !1;
|
|
2527
|
+
for (const w of g) {
|
|
2528
|
+
const b = u.createDocumentFragment();
|
|
2529
|
+
let p = 0;
|
|
2530
|
+
for (const E of w.data.matchAll(yo)) {
|
|
2531
|
+
const R = a.get(E[1].toLowerCase());
|
|
2532
|
+
if (!R || E.index === void 0) continue;
|
|
2533
|
+
b.append(w.data.slice(p, E.index));
|
|
2534
|
+
const L = u.createElement("span");
|
|
2535
|
+
L.setAttribute("data-redactor-type", "variable"), L.textContent = `[[${R}]]`, b.append(L), p = E.index + E[0].length;
|
|
2536
|
+
}
|
|
2537
|
+
p !== 0 && (b.append(w.data.slice(p)), w.replaceWith(b), h = !0);
|
|
2538
|
+
}
|
|
2539
|
+
return h ? u.body.innerHTML : n;
|
|
2540
|
+
}
|
|
2541
|
+
function Ks(n) {
|
|
2542
|
+
if (!n || typeof n != "object") return;
|
|
2543
|
+
const a = n, u = (c) => {
|
|
2544
|
+
if (c && typeof c == "object" && "url" in c) {
|
|
2545
|
+
const g = c.url;
|
|
2546
|
+
return typeof g == "string" ? g : void 0;
|
|
2547
|
+
}
|
|
2548
|
+
};
|
|
2549
|
+
return typeof a.url == "string" ? a.url : u(a.file) ?? u(a.data) ?? Object.values(a).map(u).find(Boolean);
|
|
2550
|
+
}
|
|
2551
|
+
function Vs(n) {
|
|
2552
|
+
if (n) return n;
|
|
2553
|
+
if (typeof window > "u") return null;
|
|
2554
|
+
const a = window;
|
|
2555
|
+
return a.$R ?? a.Redactor ?? null;
|
|
2556
|
+
}
|
|
2557
|
+
const Ws = {
|
|
2558
|
+
bold: ["module.inline.format", { tag: "b" }],
|
|
2559
|
+
italic: ["module.inline.format", { tag: "i" }],
|
|
2560
|
+
strikethrough: ["module.inline.format", { tag: "del" }],
|
|
2561
|
+
bulletedList: ["module.list.toggle", "ul"],
|
|
2562
|
+
numberedList: ["module.list.toggle", "ol"],
|
|
2563
|
+
heading: ["module.block.format", { tag: "h2" }],
|
|
2564
|
+
quote: ["module.block.format", { tag: "blockquote" }],
|
|
2565
|
+
paragraph: ["module.block.format", { tag: "p" }]
|
|
2566
|
+
}, Xs = {
|
|
2567
|
+
zh: "zh_cn",
|
|
2568
|
+
pt: "pt_br"
|
|
2569
|
+
};
|
|
2570
|
+
function Us(n) {
|
|
2571
|
+
const a = n.split("-")[0];
|
|
2572
|
+
return Xs[a] ?? a ?? "en";
|
|
2573
|
+
}
|
|
2574
|
+
const Zs = Ct(
|
|
2575
|
+
"redactor-theme-alfadocs ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"
|
|
2576
|
+
), Qs = [
|
|
2577
|
+
"ds:absolute ds:z-30",
|
|
2578
|
+
"ds:[inset-inline-start:var(--rte-typeahead-x)] ds:[inset-block-start:var(--rte-typeahead-y)]"
|
|
2579
|
+
].join(" "), Js = Ct(
|
|
2580
|
+
[
|
|
2581
|
+
"ds:block ds:[inline-size:100%]",
|
|
2582
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--control-border)]",
|
|
2583
|
+
"ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
2584
|
+
"ds:shadow-[var(--shadow-md)]",
|
|
2585
|
+
"ds:font-[family-name:var(--font-sans)] ds:text-[length:var(--font-size-base)]",
|
|
2586
|
+
"ds:p-[var(--spacing-md)] ds:[min-block-size:var(--rich-text-editor-min-block-size)]",
|
|
2587
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
2588
|
+
"ds:focus-visible:outline-solid",
|
|
2589
|
+
"ds:focus-visible:outline-[var(--ring)]",
|
|
2590
|
+
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
2591
|
+
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
2592
|
+
].join(" ")
|
|
2593
|
+
), Ys = so({ recording: !1 }), el = so({ recording: !0 });
|
|
2594
|
+
function mn(n, a) {
|
|
2595
|
+
return a ? { "aria-label": n } : { tooltip: n };
|
|
2596
|
+
}
|
|
2597
|
+
const wo = ["kit", "marketplace"];
|
|
2598
|
+
function tl({
|
|
2599
|
+
groupedExtensions: n,
|
|
2600
|
+
showExtensionGroups: a,
|
|
2601
|
+
extensionPending: u,
|
|
2602
|
+
extensionSession: c,
|
|
2603
|
+
extensionError: g,
|
|
2604
|
+
openExtension: h,
|
|
2605
|
+
closeExtension: y,
|
|
2606
|
+
saveSelection: w,
|
|
2607
|
+
closeSignal: b,
|
|
2608
|
+
restoreFocusOnCloseRef: p
|
|
2609
|
+
}) {
|
|
2610
|
+
const { t: E } = ae("ui"), [R, L] = T(!1), S = x(null), B = x(!1);
|
|
2611
|
+
return I(() => {
|
|
2612
|
+
L(!1);
|
|
2613
|
+
}, [b]), I(() => {
|
|
2614
|
+
B.current && !c && (B.current = !1, p.current && window.requestAnimationFrame(() => {
|
|
2615
|
+
var f;
|
|
2616
|
+
return (f = S.current) == null ? void 0 : f.focus();
|
|
2617
|
+
}));
|
|
2618
|
+
}, [c, p]), /* @__PURE__ */ A(
|
|
2619
|
+
W.Root,
|
|
2620
|
+
{
|
|
2621
|
+
open: R,
|
|
2622
|
+
onOpenChange: (f) => {
|
|
2623
|
+
f ? (w(), L(!0)) : (L(!1), u && y());
|
|
2624
|
+
},
|
|
2625
|
+
children: [
|
|
2626
|
+
/* @__PURE__ */ t(W.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2627
|
+
Z,
|
|
2628
|
+
{
|
|
2629
|
+
ref: S,
|
|
2630
|
+
"data-component-part": "extensions-trigger",
|
|
2631
|
+
size: "sm",
|
|
2632
|
+
intent: "ghost",
|
|
2633
|
+
icon: /* @__PURE__ */ t(Xn, {}),
|
|
2634
|
+
"aria-label": E("editor.extensions"),
|
|
2635
|
+
onPointerDown: () => w()
|
|
2636
|
+
}
|
|
2637
|
+
) }),
|
|
2638
|
+
/* @__PURE__ */ t(
|
|
2639
|
+
W.Content,
|
|
2640
|
+
{
|
|
2641
|
+
align: "end",
|
|
2642
|
+
onCloseAutoFocus: (f) => {
|
|
2643
|
+
(c == null ? void 0 : c.extension.kind) === "panel" && !g && f.preventDefault();
|
|
2644
|
+
},
|
|
2645
|
+
children: n.map(
|
|
2646
|
+
(f, m) => f.length > 0 ? /* @__PURE__ */ A(xt, { children: [
|
|
2647
|
+
a ? /* @__PURE__ */ t(W.Label, { children: E(
|
|
2648
|
+
m === 0 ? "editor.extensionsKit" : "editor.extensionsMarketplace"
|
|
2649
|
+
) }) : null,
|
|
2650
|
+
f.map((v) => {
|
|
2651
|
+
var z;
|
|
2652
|
+
return /* @__PURE__ */ A(
|
|
2653
|
+
W.Item,
|
|
2654
|
+
{
|
|
2655
|
+
"data-extension-id": v.id,
|
|
2656
|
+
disabled: u && (c == null ? void 0 : c.extension.id) !== v.id,
|
|
2657
|
+
"aria-busy": u && (c == null ? void 0 : c.extension.id) === v.id || void 0,
|
|
2658
|
+
onSelect: (H) => {
|
|
2659
|
+
v.kind === "action" && H.preventDefault(), B.current = !0, h(v);
|
|
2660
|
+
},
|
|
2661
|
+
children: [
|
|
2662
|
+
u && (c == null ? void 0 : c.extension.id) === v.id ? /* @__PURE__ */ t(Yn, { size: "sm" }) : v.icon ?? /* @__PURE__ */ t(Xn, {}),
|
|
2663
|
+
/* @__PURE__ */ A("span", { className: "ds:flex ds:min-w-0 ds:flex-col ds:text-start", children: [
|
|
2664
|
+
/* @__PURE__ */ t("span", { children: go(E, v.label) }),
|
|
2665
|
+
v.description ? /* @__PURE__ */ t("span", { className: "type-meta ds:text-muted-foreground", children: v.description }) : null,
|
|
2666
|
+
((z = v.source) == null ? void 0 : z.kind) === "marketplace" ? /* @__PURE__ */ A("span", { className: "type-meta ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-muted-foreground", children: [
|
|
2667
|
+
v.source.appIconUrl ? /* @__PURE__ */ t(
|
|
2668
|
+
"img",
|
|
2669
|
+
{
|
|
2670
|
+
src: v.source.appIconUrl,
|
|
2671
|
+
alt: "",
|
|
2672
|
+
className: "ds:size-[var(--spacing-md)]"
|
|
2673
|
+
}
|
|
2674
|
+
) : null,
|
|
2675
|
+
v.source.appName
|
|
2676
|
+
] }) : null
|
|
2677
|
+
] })
|
|
2678
|
+
]
|
|
2679
|
+
},
|
|
2680
|
+
v.id
|
|
2681
|
+
);
|
|
2682
|
+
})
|
|
2683
|
+
] }, wo[m]) : null
|
|
2684
|
+
)
|
|
2685
|
+
}
|
|
2686
|
+
)
|
|
2687
|
+
]
|
|
2688
|
+
}
|
|
2689
|
+
);
|
|
2690
|
+
}
|
|
2691
|
+
const nl = di(
|
|
2692
|
+
({
|
|
2693
|
+
id: n,
|
|
2694
|
+
defaultValue: a,
|
|
2695
|
+
value: u,
|
|
2696
|
+
onChange: c,
|
|
2697
|
+
toolbar: g = "standard",
|
|
2698
|
+
placeholder: h,
|
|
2699
|
+
readOnly: y = !1,
|
|
2700
|
+
ariaLabel: w,
|
|
2701
|
+
minHeight: b,
|
|
2702
|
+
showExtensions: p,
|
|
2703
|
+
extensions: E,
|
|
2704
|
+
extensionContext: R,
|
|
2705
|
+
onExtensionRun: L,
|
|
2706
|
+
className: S,
|
|
2707
|
+
redactor: B,
|
|
2708
|
+
options: f,
|
|
2709
|
+
plugins: m,
|
|
2710
|
+
lang: v,
|
|
2711
|
+
imageUploadUrl: z,
|
|
2712
|
+
onUploadImage: H,
|
|
2713
|
+
onKeyDown: D,
|
|
2714
|
+
onRequestAiDraft: j,
|
|
2715
|
+
aiDraftFormat: X = "html",
|
|
2716
|
+
aiPrivacyNotice: F,
|
|
2717
|
+
aiConsent: k,
|
|
2718
|
+
aiConsentHeadingLevel: se,
|
|
2719
|
+
onDictate: Q,
|
|
2720
|
+
onProofread: oe,
|
|
2721
|
+
onAutoFormat: le,
|
|
2722
|
+
aiTemplates: J,
|
|
2723
|
+
onAiApplied: Ee,
|
|
2724
|
+
aiSparkle: U = !0,
|
|
2725
|
+
selectionToolbar: he,
|
|
2726
|
+
variables: V,
|
|
2727
|
+
recentVariableTokens: te,
|
|
2728
|
+
onVariableInserted: ce,
|
|
2729
|
+
validateVariable: Re,
|
|
2730
|
+
onVariableValidityChange: At,
|
|
2731
|
+
renderHelpMeWrite: He,
|
|
2732
|
+
onAiCreditsExhausted: at,
|
|
2733
|
+
aiCreditsNotice: ke
|
|
2734
|
+
}, pn) => {
|
|
2735
|
+
var Fr, jr;
|
|
2736
|
+
const { t: $, i18n: Dt } = ae("ui"), Pt = Ve(), Me = vt(
|
|
2737
|
+
() => `rte-${Pt.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
2738
|
+
[Pt]
|
|
2739
|
+
), O = `#${Me}`, Y = x(null), _ = x(null), K = x(null), xe = x(!1), ne = x(y), q = x(null), Ce = x(null), [de, rr] = T(!1), [We, Ge] = T(!1), [Ae, or] = T(null), [bn, ir] = T(!1), [vn, yn] = T(!1), Nt = x(null), qt = x(L);
|
|
2740
|
+
qt.current = L;
|
|
2741
|
+
const Xe = x(null), [ko, xo] = T(0), ar = x(!0), wn = C((e = !0) => {
|
|
2742
|
+
ar.current = e, xo((r) => r + 1);
|
|
2743
|
+
}, []), kn = C(() => {
|
|
2744
|
+
var e, r;
|
|
2745
|
+
(e = Nt.current) == null || e.abort(), Nt.current = null, (r = Xe.current) == null || r.call(Xe, { status: "aborted" }), or(null), yn(!1), ir(!1);
|
|
2746
|
+
}, []), Oe = C(
|
|
2747
|
+
(e = !0) => {
|
|
2748
|
+
kn(), wn(e);
|
|
2749
|
+
},
|
|
2750
|
+
[kn, wn]
|
|
2751
|
+
);
|
|
2752
|
+
I(
|
|
2753
|
+
() => () => {
|
|
2754
|
+
var e, r;
|
|
2755
|
+
(e = Nt.current) == null || e.abort(), (r = Xe.current) == null || r.call(Xe, { status: "aborted" });
|
|
2756
|
+
},
|
|
2757
|
+
[]
|
|
2758
|
+
);
|
|
2759
|
+
const [Co, Ao] = T(""), [No, To] = T(
|
|
2760
|
+
"document"
|
|
2761
|
+
), [sr, Tt] = T(!1);
|
|
2762
|
+
I(() => {
|
|
2763
|
+
We || Tt(!1);
|
|
2764
|
+
}, [We]);
|
|
2765
|
+
const _e = x(at), xn = x(He), Cn = x(!!j);
|
|
2766
|
+
I(() => {
|
|
2767
|
+
_e.current = at, xn.current = He, Cn.current = !!j;
|
|
2768
|
+
}, [at, He, j]);
|
|
2769
|
+
const Bt = x(null), pe = vt(
|
|
2770
|
+
() => new Map(
|
|
2771
|
+
(V ?? []).map((e) => e.token).filter((e) => jn.test(e)).map((e) => [e.toLowerCase(), e])
|
|
2772
|
+
),
|
|
2773
|
+
[V]
|
|
2774
|
+
), lr = vt(
|
|
2775
|
+
() => new Map(
|
|
2776
|
+
(V ?? []).map(
|
|
2777
|
+
(e) => [e.token.toLowerCase(), e.label]
|
|
2778
|
+
)
|
|
2779
|
+
),
|
|
2780
|
+
[V]
|
|
2781
|
+
), st = x(pe);
|
|
2782
|
+
I(() => {
|
|
2783
|
+
st.current = pe;
|
|
2784
|
+
}, [pe]);
|
|
2785
|
+
const cr = vt(
|
|
2786
|
+
() => (V ?? []).filter((e) => jn.test(e.token)),
|
|
2787
|
+
[V]
|
|
2788
|
+
), An = x(Re);
|
|
2789
|
+
I(() => {
|
|
2790
|
+
An.current = Re;
|
|
2791
|
+
}, [Re]);
|
|
2792
|
+
const Nn = Re !== void 0, Tn = C(
|
|
2793
|
+
(e) => Nn && An.current ? An.current(e) : pe.has(e.toLowerCase()),
|
|
2794
|
+
[Nn, pe]
|
|
2795
|
+
), lt = pe.size > 0 || Nn, [ct, dr] = T([]), Ue = x(At);
|
|
2796
|
+
I(() => {
|
|
2797
|
+
Ue.current = At;
|
|
2798
|
+
}, [At]);
|
|
2799
|
+
const De = x(() => {
|
|
2800
|
+
}), [En, Eo] = T(
|
|
2801
|
+
() => /* @__PURE__ */ new Set()
|
|
2802
|
+
), Ft = x(null), [Ro, Mo] = T(
|
|
2803
|
+
null
|
|
2804
|
+
), jt = C((e) => {
|
|
2805
|
+
Ft.current = e, Mo(e);
|
|
2806
|
+
}, []), Et = x(null), Gt = x(null), be = x(c), Kt = x(D);
|
|
2807
|
+
I(() => {
|
|
2808
|
+
be.current = c, Kt.current = D;
|
|
2809
|
+
}, [c, D]);
|
|
2810
|
+
const So = x(
|
|
2811
|
+
(() => {
|
|
2812
|
+
const e = u ?? a ?? "";
|
|
2813
|
+
return e ? ze(e) : "";
|
|
2814
|
+
})()
|
|
2815
|
+
), me = C(() => {
|
|
2816
|
+
var r;
|
|
2817
|
+
const e = _.current;
|
|
2818
|
+
if (e)
|
|
2819
|
+
try {
|
|
2820
|
+
const o = e(O, "source.getCode");
|
|
2821
|
+
if (typeof o == "string") return no(o);
|
|
2822
|
+
} catch {
|
|
2823
|
+
}
|
|
2824
|
+
return ((r = Y.current) == null ? void 0 : r.value) ?? "";
|
|
2825
|
+
}, [O]);
|
|
2826
|
+
I(() => {
|
|
2827
|
+
De.current = () => {
|
|
2828
|
+
var o;
|
|
2829
|
+
if (!lt) {
|
|
2830
|
+
dr((i) => i.length ? [] : i);
|
|
2831
|
+
return;
|
|
2832
|
+
}
|
|
2833
|
+
const e = (o = q.current) == null ? void 0 : o.querySelector(".redactor-in");
|
|
2834
|
+
e == null || e.querySelectorAll('[data-redactor-type="variable"]').forEach((i) => {
|
|
2835
|
+
const l = /^\[\[([A-Za-z0-9_]+)\]\]$/.exec(
|
|
2836
|
+
i.textContent ?? ""
|
|
2837
|
+
), s = !l || !Tn(l[1]);
|
|
2838
|
+
i.classList.contains(Jn) !== s && i.classList.toggle(Jn, s);
|
|
2839
|
+
const d = l ? lr.get(l[1].toLowerCase()) ?? l[1] : i.textContent ?? "";
|
|
2840
|
+
i.getAttribute("data-label") !== d && i.setAttribute("data-label", d);
|
|
2841
|
+
const N = i.textContent ?? "";
|
|
2842
|
+
i.getAttribute("title") !== N && i.setAttribute("title", N);
|
|
2843
|
+
});
|
|
2844
|
+
const r = Array.from(
|
|
2845
|
+
new Set(
|
|
2846
|
+
qs(me()).filter(
|
|
2847
|
+
(i) => !Tn(i)
|
|
2848
|
+
)
|
|
2849
|
+
)
|
|
2850
|
+
);
|
|
2851
|
+
dr(
|
|
2852
|
+
(i) => i.length === r.length && i.every((l, s) => l === r[s]) ? i : r
|
|
2853
|
+
);
|
|
2854
|
+
}, De.current();
|
|
2855
|
+
}, [lt, Tn, lr, me]), I(() => {
|
|
2856
|
+
var o;
|
|
2857
|
+
const r = ((o = q.current) == null ? void 0 : o.querySelector(".redactor-in")) ?? Y.current;
|
|
2858
|
+
r && (ct.length > 0 ? (r.setAttribute("aria-invalid", "true"), r.setAttribute("aria-describedby", `${Me}-variables-error`)) : (r.removeAttribute("aria-invalid"), r.removeAttribute("aria-describedby")));
|
|
2859
|
+
}, [ct, Me, de]);
|
|
2860
|
+
const Rn = x(!1);
|
|
2861
|
+
I(() => {
|
|
2862
|
+
var e, r;
|
|
2863
|
+
lt ? (Rn.current = !0, (e = Ue.current) == null || e.call(Ue, ct)) : Rn.current && (Rn.current = !1, (r = Ue.current) == null || r.call(Ue, []));
|
|
2864
|
+
}, [ct, lt]), I(() => {
|
|
2865
|
+
Re && De.current();
|
|
2866
|
+
}, [Re]);
|
|
2867
|
+
const fe = C(
|
|
2868
|
+
(e, ...r) => {
|
|
2869
|
+
const o = _.current;
|
|
2870
|
+
if (!o) return !1;
|
|
2871
|
+
const i = ne.current;
|
|
2872
|
+
if (i)
|
|
2873
|
+
try {
|
|
2874
|
+
o(O, "disableReadOnly");
|
|
2875
|
+
} catch {
|
|
2876
|
+
}
|
|
2877
|
+
try {
|
|
2878
|
+
return o(O, e, ...r), !0;
|
|
2879
|
+
} catch {
|
|
2880
|
+
return !1;
|
|
2881
|
+
} finally {
|
|
2882
|
+
if (i)
|
|
2883
|
+
try {
|
|
2884
|
+
o(O, "enableReadOnly");
|
|
2885
|
+
} catch {
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
},
|
|
2889
|
+
[O]
|
|
2890
|
+
), ge = C(
|
|
2891
|
+
(e, r) => {
|
|
2892
|
+
var G;
|
|
2893
|
+
const o = (r == null ? void 0 : r.asHtml) ?? !0, i = o ? ze(e) : e;
|
|
2894
|
+
if (fe(o ? "insertion.insertHtml" : "insertion.insertText", i)) return;
|
|
2895
|
+
const s = Y.current;
|
|
2896
|
+
if (!s) return;
|
|
2897
|
+
const d = s.selectionStart ?? s.value.length, N = s.selectionEnd ?? s.value.length;
|
|
2898
|
+
s.value = s.value.slice(0, d) + i + s.value.slice(N);
|
|
2899
|
+
const M = d + i.length;
|
|
2900
|
+
try {
|
|
2901
|
+
s.setSelectionRange(M, M);
|
|
2902
|
+
} catch {
|
|
2903
|
+
}
|
|
2904
|
+
(G = be.current) == null || G.call(be, { html: ze(s.value), markdown: "" });
|
|
2905
|
+
},
|
|
2906
|
+
[fe]
|
|
2907
|
+
), Ne = x(null), ve = C(() => {
|
|
2908
|
+
var i;
|
|
2909
|
+
const e = (i = q.current) == null ? void 0 : i.querySelector(".redactor-in"), r = typeof window < "u" ? window.getSelection() : null, o = /* @__PURE__ */ new Set();
|
|
2910
|
+
if (e && r && r.anchorNode && e.contains(r.anchorNode) && typeof document.queryCommandState == "function") {
|
|
2911
|
+
r.rangeCount > 0 && (Ne.current = r.getRangeAt(0).cloneRange());
|
|
2912
|
+
try {
|
|
2913
|
+
document.queryCommandState("bold") && o.add("bold"), document.queryCommandState("italic") && o.add("italic"), document.queryCommandState("underline") && o.add("underline"), document.queryCommandState("strikeThrough") && o.add("strike"), document.queryCommandState("insertUnorderedList") && o.add("ul"), document.queryCommandState("insertOrderedList") && o.add("ol");
|
|
2914
|
+
const l = String(
|
|
2915
|
+
document.queryCommandValue("formatBlock") || ""
|
|
2916
|
+
).toLowerCase();
|
|
2917
|
+
/^h[1-6]$/.test(l) ? (o.add("heading"), o.add(l)) : l === "blockquote" ? o.add("quote") : o.add("paragraph");
|
|
2918
|
+
const s = r.anchorNode.nodeType === Node.TEXT_NODE ? r.anchorNode.parentElement : r.anchorNode;
|
|
2919
|
+
s && e.contains(s) && s.closest("table") && o.add("table");
|
|
2920
|
+
const d = s == null ? void 0 : s.closest(
|
|
2921
|
+
"p, div, blockquote, pre, h1, h2, h3, h4, h5, h6, li, td, th"
|
|
2922
|
+
);
|
|
2923
|
+
if (d && e.contains(d) && d !== e) {
|
|
2924
|
+
const N = getComputedStyle(d), M = N.direction === "rtl", G = N.textAlign.replace(/^-webkit-/, ""), re = M ? "right" : "left", Se = M ? "left" : "right", ee = ["left", "center", "right", "justify"].includes(G) ? G : G === "end" ? Se : re;
|
|
2925
|
+
o.add(`align-${ee}`);
|
|
2926
|
+
}
|
|
2927
|
+
} catch {
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
Eo(
|
|
2931
|
+
(l) => l.size === o.size && [...o].every((s) => l.has(s)) ? l : o
|
|
2932
|
+
);
|
|
2933
|
+
}, []), Ze = C(
|
|
2934
|
+
(e, ...r) => {
|
|
2935
|
+
fe(e, ...r), typeof window < "u" ? window.requestAnimationFrame(() => ve()) : ve();
|
|
2936
|
+
},
|
|
2937
|
+
[fe, ve]
|
|
2938
|
+
);
|
|
2939
|
+
I(() => {
|
|
2940
|
+
const e = q.current;
|
|
2941
|
+
if (!e) return;
|
|
2942
|
+
const r = {
|
|
2943
|
+
b: ["module.inline.format", { tag: "b" }],
|
|
2944
|
+
i: ["module.inline.format", { tag: "i" }],
|
|
2945
|
+
u: ["module.inline.format", { tag: "u" }]
|
|
2946
|
+
}, o = (i) => {
|
|
2947
|
+
if (!(i.metaKey || i.ctrlKey) || i.altKey || i.shiftKey || i.isComposing) return;
|
|
2948
|
+
const l = r[i.key.toLowerCase()];
|
|
2949
|
+
if (!l) return;
|
|
2950
|
+
const s = e.querySelector(".redactor-in");
|
|
2951
|
+
!s || !(i.target instanceof Node) || !s.contains(i.target) || ne.current || (i.preventDefault(), i.stopImmediatePropagation(), Ze(...l));
|
|
2952
|
+
};
|
|
2953
|
+
return e.addEventListener("keydown", o, !0), () => e.removeEventListener("keydown", o, !0);
|
|
2954
|
+
}, [Ze]), I(() => {
|
|
2955
|
+
const e = q.current;
|
|
2956
|
+
if (!e) return;
|
|
2957
|
+
let r;
|
|
2958
|
+
const o = (l) => {
|
|
2959
|
+
var M;
|
|
2960
|
+
const s = (M = window.getSelection()) == null ? void 0 : M.anchorNode;
|
|
2961
|
+
if (!s) return null;
|
|
2962
|
+
const d = s.nodeType === Node.TEXT_NODE ? s.parentElement : s, N = (d == null ? void 0 : d.closest(Os)) ?? null;
|
|
2963
|
+
return N && N !== l && l.contains(N) ? N : null;
|
|
2964
|
+
}, i = (l) => {
|
|
2965
|
+
if (l.key !== "Enter" || l.shiftKey || l.isComposing)
|
|
2966
|
+
return;
|
|
2967
|
+
const s = e.querySelector(".redactor-in");
|
|
2968
|
+
if (!s || !(l.target instanceof Node) || !s.contains(l.target) || ne.current)
|
|
2969
|
+
return;
|
|
2970
|
+
const d = o(s), N = d == null ? void 0 : d.style.textAlign;
|
|
2971
|
+
if (!d || !N) return;
|
|
2972
|
+
const M = d.tagName === "LI" ? d.style.listStylePosition : "";
|
|
2973
|
+
clearTimeout(r), r = setTimeout(() => {
|
|
2974
|
+
const G = o(s);
|
|
2975
|
+
if (!G || G === d || G.style.textAlign) return;
|
|
2976
|
+
G.style.textAlign = N, M && G.tagName === "LI" && (G.style.listStylePosition = M);
|
|
2977
|
+
const re = _.current;
|
|
2978
|
+
if (re)
|
|
2979
|
+
try {
|
|
2980
|
+
re(O, "broadcast", "hardsync");
|
|
2981
|
+
} catch {
|
|
2982
|
+
}
|
|
2983
|
+
ve();
|
|
2984
|
+
}, Ds);
|
|
2985
|
+
};
|
|
2986
|
+
return e.addEventListener("keydown", i, !0), () => {
|
|
2987
|
+
clearTimeout(r), e.removeEventListener("keydown", i, !0);
|
|
2988
|
+
};
|
|
2989
|
+
}, [O, ve]);
|
|
2990
|
+
const Qe = C(
|
|
2991
|
+
(e) => {
|
|
2992
|
+
ge(e, { asHtml: !0 }), typeof window < "u" && window.requestAnimationFrame(() => ve());
|
|
2993
|
+
},
|
|
2994
|
+
[ge, ve]
|
|
2995
|
+
), [dt, Mn] = T(null), Vt = x(null), Sn = `${Me}-variables`, ur = x(null), [zn, zo] = T(void 0), Ie = C(() => {
|
|
2996
|
+
Vt.current = null, Mn(null);
|
|
2997
|
+
}, []), Wt = C(
|
|
2998
|
+
(e, r) => {
|
|
2999
|
+
const o = window.getSelection();
|
|
3000
|
+
if (!o) return;
|
|
3001
|
+
const i = document.createRange();
|
|
3002
|
+
i.setStart(r.node, r.start), i.setEnd(r.node, r.end), o.removeAllRanges(), o.addRange(i), Qe(ao(e)), window.requestAnimationFrame(() => De.current());
|
|
3003
|
+
},
|
|
3004
|
+
[Qe]
|
|
3005
|
+
);
|
|
3006
|
+
I(() => {
|
|
3007
|
+
const e = q.current;
|
|
3008
|
+
if (!e || !lt) return;
|
|
3009
|
+
const r = () => {
|
|
3010
|
+
var Fe;
|
|
3011
|
+
const l = e.querySelector(".redactor-in"), s = window.getSelection();
|
|
3012
|
+
if (!l || !s || s.rangeCount === 0 || !s.isCollapsed) {
|
|
3013
|
+
Ie();
|
|
3014
|
+
return;
|
|
3015
|
+
}
|
|
3016
|
+
const { startContainer: d, startOffset: N } = s.getRangeAt(0);
|
|
3017
|
+
if (d.nodeType !== Node.TEXT_NODE || !l.contains(d) || (((Fe = d.parentElement) == null ? void 0 : Fe.closest(
|
|
3018
|
+
'[data-redactor-type="variable"]'
|
|
3019
|
+
)) ?? null) !== null) {
|
|
3020
|
+
Ie();
|
|
3021
|
+
return;
|
|
3022
|
+
}
|
|
3023
|
+
const M = d, G = M.data.slice(0, N), re = /\[\[([A-Za-z0-9_]+)\]\]$/.exec(G);
|
|
3024
|
+
if (re) {
|
|
3025
|
+
Ie(), Wt(
|
|
3026
|
+
pe.get(re[1].toLowerCase()) ?? re[1],
|
|
3027
|
+
{ node: M, start: N - re[0].length, end: N }
|
|
3028
|
+
);
|
|
3029
|
+
return;
|
|
3030
|
+
}
|
|
3031
|
+
const Se = /\[\[([A-Za-z0-9_ ]{0,40})$/.exec(G), ee = Ce.current;
|
|
3032
|
+
if (!Se || !ee || (V ?? []).length === 0) {
|
|
3033
|
+
Ie();
|
|
3034
|
+
return;
|
|
3035
|
+
}
|
|
3036
|
+
const Be = {
|
|
3037
|
+
node: M,
|
|
3038
|
+
start: N - Se[0].length,
|
|
3039
|
+
end: N
|
|
3040
|
+
};
|
|
3041
|
+
Vt.current = Be;
|
|
3042
|
+
const bt = document.createRange();
|
|
3043
|
+
bt.setStart(M, Be.start), bt.setEnd(M, Be.end);
|
|
3044
|
+
const it = bt.getBoundingClientRect(), It = ee.getBoundingClientRect(), Pn = getComputedStyle(ee).direction === "rtl";
|
|
3045
|
+
Mn({
|
|
3046
|
+
query: Se[1],
|
|
3047
|
+
left: Pn ? It.right - it.right : it.left - It.left,
|
|
3048
|
+
top: it.bottom - It.top + 4
|
|
3049
|
+
});
|
|
3050
|
+
}, o = (l) => {
|
|
3051
|
+
var d;
|
|
3052
|
+
if (!Vt.current || !["ArrowDown", "ArrowUp", "Home", "End", "Enter", "Escape"].includes(
|
|
3053
|
+
l.key
|
|
3054
|
+
))
|
|
3055
|
+
return;
|
|
3056
|
+
(((d = ur.current) == null ? void 0 : d.handleKeyDown(l)) ?? !1) && (l.preventDefault(), l.stopImmediatePropagation());
|
|
3057
|
+
}, i = () => Ie();
|
|
3058
|
+
return e.addEventListener("input", r), e.addEventListener("keydown", o, !0), e.addEventListener("focusout", i), () => {
|
|
3059
|
+
e.removeEventListener("input", r), e.removeEventListener("keydown", o, !0), e.removeEventListener("focusout", i);
|
|
3060
|
+
};
|
|
3061
|
+
}, [
|
|
3062
|
+
lt,
|
|
3063
|
+
pe,
|
|
3064
|
+
V,
|
|
3065
|
+
Wt,
|
|
3066
|
+
Ie
|
|
3067
|
+
]), I(() => {
|
|
3068
|
+
var r;
|
|
3069
|
+
const e = (r = q.current) == null ? void 0 : r.querySelector(".redactor-in");
|
|
3070
|
+
e && (dt ? (e.setAttribute("aria-expanded", "true"), e.setAttribute("aria-controls", `${Sn}-list`), zn ? e.setAttribute("aria-activedescendant", zn) : e.removeAttribute("aria-activedescendant")) : (e.removeAttribute("aria-expanded"), e.removeAttribute("aria-controls"), e.removeAttribute("aria-activedescendant")));
|
|
3071
|
+
}, [dt, Sn, zn]);
|
|
3072
|
+
const Lo = C(
|
|
3073
|
+
(e) => {
|
|
3074
|
+
const r = Vt.current;
|
|
3075
|
+
Ie(), r && Wt(e.token, r), ce == null || ce(e.token);
|
|
3076
|
+
},
|
|
3077
|
+
[Ie, Wt, ce]
|
|
3078
|
+
), _o = C(() => {
|
|
3079
|
+
Ie();
|
|
3080
|
+
}, [Ie]), Io = C((e) => {
|
|
3081
|
+
Mn((r) => r && { ...r, query: e });
|
|
3082
|
+
}, []), ut = C(() => {
|
|
3083
|
+
var r;
|
|
3084
|
+
if (typeof window < "u") {
|
|
3085
|
+
const o = (r = q.current) == null ? void 0 : r.querySelector(".redactor-in"), i = window.getSelection();
|
|
3086
|
+
o && i && i.rangeCount > 0 && i.anchorNode && o.contains(i.anchorNode) && (Ne.current = i.getRangeAt(0).cloneRange());
|
|
3087
|
+
}
|
|
3088
|
+
const e = _.current;
|
|
3089
|
+
if (e)
|
|
3090
|
+
try {
|
|
3091
|
+
e(O, "selection.save");
|
|
3092
|
+
} catch {
|
|
3093
|
+
}
|
|
3094
|
+
}, [O]), we = C(() => {
|
|
3095
|
+
const e = _.current;
|
|
3096
|
+
if (!e) return;
|
|
3097
|
+
const r = Ne.current;
|
|
3098
|
+
try {
|
|
3099
|
+
e(O, "editor.focus");
|
|
3100
|
+
} catch {
|
|
3101
|
+
}
|
|
3102
|
+
if (r && typeof window < "u") {
|
|
3103
|
+
const o = window.getSelection();
|
|
3104
|
+
if (o)
|
|
3105
|
+
try {
|
|
3106
|
+
o.removeAllRanges(), o.addRange(r);
|
|
3107
|
+
return;
|
|
3108
|
+
} catch {
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
try {
|
|
3112
|
+
e(O, "selection.restore");
|
|
3113
|
+
} catch {
|
|
3114
|
+
}
|
|
3115
|
+
}, [O]), $o = C(() => {
|
|
3116
|
+
var o;
|
|
3117
|
+
if (typeof window > "u") return "";
|
|
3118
|
+
const e = (o = q.current) == null ? void 0 : o.querySelector(".redactor-in"), r = window.getSelection();
|
|
3119
|
+
return !e || !r || !r.anchorNode || !e.contains(r.anchorNode) ? "" : r.toString();
|
|
3120
|
+
}, []), Ho = C(() => {
|
|
3121
|
+
var l;
|
|
3122
|
+
if (typeof window > "u") return null;
|
|
3123
|
+
const e = (l = q.current) == null ? void 0 : l.querySelector(".redactor-in"), r = window.getSelection();
|
|
3124
|
+
if (!e || !r || r.rangeCount === 0) return null;
|
|
3125
|
+
const o = r.anchorNode, i = o && o.nodeType === Node.TEXT_NODE ? o.parentElement : o;
|
|
3126
|
+
return !i || !e.contains(i) ? null : i.closest("table");
|
|
3127
|
+
}, []), mr = x(null), Xt = C(() => {
|
|
3128
|
+
var l;
|
|
3129
|
+
if (typeof window > "u") return null;
|
|
3130
|
+
const e = (l = q.current) == null ? void 0 : l.querySelector(".redactor-in"), r = window.getSelection();
|
|
3131
|
+
if (!e || !r || r.rangeCount === 0) return null;
|
|
3132
|
+
const o = r.anchorNode, i = o && o.nodeType === Node.TEXT_NODE ? o.parentElement : o;
|
|
3133
|
+
return !i || !e.contains(i) ? null : i.closest("td,th");
|
|
3134
|
+
}, []), Oo = C(() => {
|
|
3135
|
+
mr.current = Xt();
|
|
3136
|
+
}, [Xt]), Do = C(
|
|
3137
|
+
(e, r) => {
|
|
3138
|
+
var s;
|
|
3139
|
+
const o = mr.current ?? Xt();
|
|
3140
|
+
if (!o) return;
|
|
3141
|
+
const i = e === "row" ? Array.from(((s = o.closest("tr")) == null ? void 0 : s.children) ?? [o]).filter(
|
|
3142
|
+
(d) => d instanceof HTMLElement && (d.tagName === "TD" || d.tagName === "TH")
|
|
3143
|
+
) : [o], l = _.current;
|
|
3144
|
+
if (l)
|
|
3145
|
+
try {
|
|
3146
|
+
l(O, "module.buffer.trigger");
|
|
3147
|
+
} catch {
|
|
3148
|
+
}
|
|
3149
|
+
for (const d of i)
|
|
3150
|
+
r ? d.style.setProperty("background-color", r) : d.style.removeProperty("background-color");
|
|
3151
|
+
if (l)
|
|
3152
|
+
try {
|
|
3153
|
+
l(O, "broadcast", "hardsync");
|
|
3154
|
+
} catch {
|
|
3155
|
+
}
|
|
3156
|
+
typeof window < "u" && window.requestAnimationFrame(() => ve());
|
|
3157
|
+
},
|
|
3158
|
+
[Xt, O, ve]
|
|
3159
|
+
);
|
|
3160
|
+
I(() => {
|
|
3161
|
+
const e = q.current;
|
|
3162
|
+
if (typeof window > "u" || !e) return;
|
|
3163
|
+
const r = (l) => {
|
|
3164
|
+
const s = e.querySelector(".redactor-in"), d = l.target;
|
|
3165
|
+
if (!s || !(d instanceof Node) || !s.contains(d))
|
|
3166
|
+
return;
|
|
3167
|
+
const N = d instanceof Element ? d.closest("img") : null;
|
|
3168
|
+
jt(N && s.contains(N) ? N : null);
|
|
3169
|
+
}, o = (l) => {
|
|
3170
|
+
l.key === "Escape" && Ft.current && jt(null);
|
|
3171
|
+
}, i = (l) => {
|
|
3172
|
+
const s = l.relatedTarget;
|
|
3173
|
+
(!(s instanceof Node) || !e.contains(s)) && jt(null);
|
|
3174
|
+
};
|
|
3175
|
+
return e.addEventListener("click", r), e.addEventListener("keydown", o), e.addEventListener("focusout", i), () => {
|
|
3176
|
+
e.removeEventListener("click", r), e.removeEventListener("keydown", o), e.removeEventListener("focusout", i);
|
|
3177
|
+
};
|
|
3178
|
+
}, [jt]);
|
|
3179
|
+
const Po = C(
|
|
3180
|
+
(e) => {
|
|
3181
|
+
const r = Ft.current;
|
|
3182
|
+
if (!r) return;
|
|
3183
|
+
const o = Zn.includes(
|
|
3184
|
+
e
|
|
3185
|
+
) ? Zn : vo, i = _.current;
|
|
3186
|
+
if (i)
|
|
3187
|
+
try {
|
|
3188
|
+
i(O, "module.buffer.trigger");
|
|
3189
|
+
} catch {
|
|
3190
|
+
}
|
|
3191
|
+
for (const l of o) r.classList.remove(l);
|
|
3192
|
+
if (r.classList.add(e), i)
|
|
3193
|
+
try {
|
|
3194
|
+
i(O, "broadcast", "hardsync");
|
|
3195
|
+
} catch {
|
|
3196
|
+
}
|
|
3197
|
+
typeof window < "u" && window.requestAnimationFrame(() => ve());
|
|
3198
|
+
},
|
|
3199
|
+
[O, ve]
|
|
3200
|
+
), qo = C(
|
|
3201
|
+
(e) => {
|
|
3202
|
+
const r = Ft.current;
|
|
3203
|
+
if (!r) return;
|
|
3204
|
+
const o = _.current;
|
|
3205
|
+
if (o)
|
|
3206
|
+
try {
|
|
3207
|
+
o(O, "module.buffer.trigger");
|
|
3208
|
+
} catch {
|
|
3209
|
+
}
|
|
3210
|
+
if (r.style.setProperty("width", `${e}%`), o)
|
|
3211
|
+
try {
|
|
3212
|
+
o(O, "broadcast", "hardsync");
|
|
3213
|
+
} catch {
|
|
3214
|
+
}
|
|
3215
|
+
typeof window < "u" && window.requestAnimationFrame(() => ve());
|
|
3216
|
+
},
|
|
3217
|
+
[O, ve]
|
|
3218
|
+
), Bo = C(
|
|
3219
|
+
(e) => {
|
|
3220
|
+
var o;
|
|
3221
|
+
const r = _.current;
|
|
3222
|
+
if (r && typeof window < "u") {
|
|
3223
|
+
const i = (o = q.current) == null ? void 0 : o.querySelector(".redactor-in"), l = window.getSelection(), s = l == null ? void 0 : l.anchorNode, d = s && s.nodeType === Node.TEXT_NODE ? s.parentElement : s, N = d && (i != null && i.contains(d)) ? d.closest("ul,ol") : null;
|
|
3224
|
+
if (N)
|
|
3225
|
+
try {
|
|
3226
|
+
r(O, "caret.setAfter", N);
|
|
3227
|
+
} catch {
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
Qe(e), typeof window < "u" && window.requestAnimationFrame(() => {
|
|
3231
|
+
var l;
|
|
3232
|
+
const i = (l = q.current) == null ? void 0 : l.querySelector(".redactor-in");
|
|
3233
|
+
i == null || i.querySelectorAll("table td, table th").forEach((s) => {
|
|
3234
|
+
let d = s.lastChild;
|
|
3235
|
+
for (; d && d.nodeType === Node.TEXT_NODE && !(d.textContent ?? "").trim(); ) {
|
|
3236
|
+
const N = d.previousSibling;
|
|
3237
|
+
s.removeChild(d), d = N;
|
|
3238
|
+
}
|
|
3239
|
+
});
|
|
3240
|
+
});
|
|
3241
|
+
},
|
|
3242
|
+
[Qe, O]
|
|
3243
|
+
), fr = C(
|
|
3244
|
+
async (e, r) => {
|
|
3245
|
+
if (H) return H(e, r);
|
|
3246
|
+
if (!z) throw new Error("No image upload URL configured.");
|
|
3247
|
+
const o = new FormData();
|
|
3248
|
+
o.append("file", e);
|
|
3249
|
+
const i = await fetch(z, {
|
|
3250
|
+
method: "POST",
|
|
3251
|
+
body: o,
|
|
3252
|
+
credentials: "same-origin",
|
|
3253
|
+
signal: r
|
|
3254
|
+
});
|
|
3255
|
+
if (!i.ok) throw new Error(`Image upload failed (${i.status}).`);
|
|
3256
|
+
const l = Ks(await i.json());
|
|
3257
|
+
if (!l) throw new Error("Image upload response contained no URL.");
|
|
3258
|
+
return l;
|
|
3259
|
+
},
|
|
3260
|
+
[z, H]
|
|
3261
|
+
), Je = vi({ enabled: U }), {
|
|
3262
|
+
start: mt,
|
|
3263
|
+
land: Pe,
|
|
3264
|
+
reset: ft
|
|
3265
|
+
} = Je, Rt = x(null), gt = x(null), [ye, gr] = T(!1), [Fo, hr] = T("listening"), [jo, pr] = T(!1), [Go, Mt] = T(""), ht = C(() => {
|
|
3266
|
+
const e = gt.current;
|
|
3267
|
+
e != null && e.parentNode && e.parentNode.removeChild(e), gt.current = null;
|
|
3268
|
+
}, []), pt = x(""), Ut = C((e) => {
|
|
3269
|
+
var s, d;
|
|
3270
|
+
const r = (s = q.current) == null ? void 0 : s.querySelector(
|
|
3271
|
+
".redactor-in"
|
|
3272
|
+
);
|
|
3273
|
+
if (!r) return;
|
|
3274
|
+
let o = gt.current;
|
|
3275
|
+
if (!o || !r.contains(o)) {
|
|
3276
|
+
o = document.createElement("span"), o.setAttribute("data-rte-interim", ""), o.setAttribute("contenteditable", "false");
|
|
3277
|
+
const N = window.getSelection();
|
|
3278
|
+
if (N && N.rangeCount > 0 && r.contains(N.anchorNode)) {
|
|
3279
|
+
const M = N.getRangeAt(0).cloneRange();
|
|
3280
|
+
M.collapse(!1), M.insertNode(o);
|
|
3281
|
+
} else {
|
|
3282
|
+
const M = r.lastElementChild;
|
|
3283
|
+
M !== null && M.tagName === "P" && M === r.firstElementChild && (M.textContent ?? "").replace(/[\ufeff\s]/g, "") === "" && Array.from(M.children).every((re) => re.tagName === "BR") ? ((d = M.lastChild) == null ? void 0 : d.nodeName) === "BR" ? M.insertBefore(o, M.lastChild) : M.appendChild(o) : r.appendChild(o);
|
|
3284
|
+
}
|
|
3285
|
+
gt.current = o;
|
|
3286
|
+
}
|
|
3287
|
+
pt.current ? o.setAttribute("data-hint", pt.current) : o.removeAttribute("data-hint");
|
|
3288
|
+
const i = o.previousSibling, l = (i == null ? void 0 : i.nodeType) === Node.TEXT_NODE ? i.data.replace(/\ufeff/g, "").slice(-1) : "";
|
|
3289
|
+
o.toggleAttribute("data-gap", /\S/.test(l) && l !== " "), o.textContent = e;
|
|
3290
|
+
}, []), br = C(
|
|
3291
|
+
(e) => {
|
|
3292
|
+
var r;
|
|
3293
|
+
pt.current = e, Ut(((r = gt.current) == null ? void 0 : r.textContent) ?? "");
|
|
3294
|
+
},
|
|
3295
|
+
[Ut]
|
|
3296
|
+
), Zt = x(null), Qt = C(
|
|
3297
|
+
(e = !1) => {
|
|
3298
|
+
var o;
|
|
3299
|
+
Zt.current && (Zt.current.keepLate = e), (o = Rt.current) == null || o.abort(), pt.current = "";
|
|
3300
|
+
const r = gt.current;
|
|
3301
|
+
r && !r.textContent ? ht() : r == null || r.removeAttribute("data-hint");
|
|
3302
|
+
},
|
|
3303
|
+
[ht]
|
|
3304
|
+
), vr = C(() => {
|
|
3305
|
+
var s;
|
|
3306
|
+
if (typeof window > "u") return !1;
|
|
3307
|
+
const e = window.getSelection(), r = (s = q.current) == null ? void 0 : s.querySelector(".redactor-in");
|
|
3308
|
+
if (!e || e.rangeCount === 0 || !r) return !1;
|
|
3309
|
+
const { startContainer: o, startOffset: i } = e.getRangeAt(0);
|
|
3310
|
+
if (!r.contains(o) || o.nodeType !== Node.TEXT_NODE || i === 0)
|
|
3311
|
+
return !1;
|
|
3312
|
+
const l = o.data.charAt(i - 1);
|
|
3313
|
+
return /\S/.test(l) && l !== " ";
|
|
3314
|
+
}, []), Te = k !== void 0 && !k.granted, Jt = x(null), Yt = C(() => {
|
|
3315
|
+
if (!Q || Te) return;
|
|
3316
|
+
const e = new AbortController();
|
|
3317
|
+
Rt.current = e;
|
|
3318
|
+
const r = { keepLate: !1 };
|
|
3319
|
+
Zt.current = r;
|
|
3320
|
+
let o = !1;
|
|
3321
|
+
const i = () => !o && (!e.signal.aborted || r.keepLate);
|
|
3322
|
+
pr(!1), gr(!0), hr("listening"), Mt($("editor.ai.listening")), U && mt(), ht();
|
|
3323
|
+
const l = (s) => {
|
|
3324
|
+
if (Jt.current) {
|
|
3325
|
+
pt.current = "";
|
|
3326
|
+
return;
|
|
3327
|
+
}
|
|
3328
|
+
br(s);
|
|
3329
|
+
};
|
|
3330
|
+
l($("editor.ai.listening")), Q({
|
|
3331
|
+
signal: e.signal,
|
|
3332
|
+
onStatus: (s) => {
|
|
3333
|
+
if (!i()) return;
|
|
3334
|
+
const d = $(s === "connecting" ? "voiceControl.status.starting" : "editor.ai.listening");
|
|
3335
|
+
hr(s), Mt(d), l(d);
|
|
3336
|
+
},
|
|
3337
|
+
// Interim text shows live in the editor (grey + caret); each final
|
|
3338
|
+
// replaces it with committed text at the caret.
|
|
3339
|
+
onPartialTranscript: (s) => {
|
|
3340
|
+
i() && Ut(s);
|
|
3341
|
+
},
|
|
3342
|
+
onFinalTranscript: (s) => {
|
|
3343
|
+
if (!i()) return;
|
|
3344
|
+
ht();
|
|
3345
|
+
const d = s.trim();
|
|
3346
|
+
if (d) {
|
|
3347
|
+
const N = Jt.current;
|
|
3348
|
+
if (N) {
|
|
3349
|
+
Jt.current = null, Ne.current = N, we(), ge(`${d} `, { asHtml: !1 }), U && Pe(), Mt(d);
|
|
3350
|
+
return;
|
|
3351
|
+
}
|
|
3352
|
+
if (vr()) {
|
|
3353
|
+
const M = window.getSelection(), G = M == null ? void 0 : M.getRangeAt(0);
|
|
3354
|
+
if (M && G) {
|
|
3355
|
+
const re = G.startContainer, Se = G.startOffset;
|
|
3356
|
+
re.insertData(Se, " ");
|
|
3357
|
+
const ee = document.createRange();
|
|
3358
|
+
ee.setStart(re, Se + 1), ee.collapse(!0), M.removeAllRanges(), M.addRange(ee);
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
ge(`${d} `, { asHtml: !1 }), U && Pe(), Mt(d);
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
}).catch((s) => {
|
|
3365
|
+
var d;
|
|
3366
|
+
if (!(e.signal.aborted || s && typeof s == "object" && "name" in s && s.name === "AbortError")) {
|
|
3367
|
+
if (ro(s) && ((d = _e.current) == null || d.call(_e), xn.current || Cn.current)) {
|
|
3368
|
+
Tt(!0), Ge(!0);
|
|
3369
|
+
return;
|
|
3370
|
+
}
|
|
3371
|
+
pr(!0);
|
|
3372
|
+
}
|
|
3373
|
+
}).finally(() => {
|
|
3374
|
+
o = !0, pt.current = "", ht(), Rt.current === e && (Rt.current = null, Zt.current = null, gr(!1), Mt(""), U && !qe.current && ft());
|
|
3375
|
+
});
|
|
3376
|
+
}, [
|
|
3377
|
+
Q,
|
|
3378
|
+
Te,
|
|
3379
|
+
ge,
|
|
3380
|
+
we,
|
|
3381
|
+
ht,
|
|
3382
|
+
Ut,
|
|
3383
|
+
br,
|
|
3384
|
+
vr,
|
|
3385
|
+
U,
|
|
3386
|
+
mt,
|
|
3387
|
+
Pe,
|
|
3388
|
+
ft,
|
|
3389
|
+
$
|
|
3390
|
+
]);
|
|
3391
|
+
I(() => () => {
|
|
3392
|
+
var e;
|
|
3393
|
+
return (e = Rt.current) == null ? void 0 : e.abort();
|
|
3394
|
+
}, []);
|
|
3395
|
+
const [en, St] = T(null), Ye = x(null), tn = x(null), [Ko, yr] = T(!1), Vo = ((k == null ? void 0 : k.pending) ?? !1) || Ko, nn = x(!1), Ln = C(() => {
|
|
3396
|
+
Ye.current = null, tn.current = null, nn.current = !1, St(null);
|
|
3397
|
+
}, []), Wo = C(() => {
|
|
3398
|
+
var r;
|
|
3399
|
+
nn.current = !0;
|
|
3400
|
+
const e = (r = k == null ? void 0 : k.onGrant) == null ? void 0 : r.call(k);
|
|
3401
|
+
e && typeof e.then == "function" && (yr(!0), Promise.resolve(e).catch(() => {
|
|
3402
|
+
}).finally(() => yr(!1)));
|
|
3403
|
+
}, [k]), wr = x((k == null ? void 0 : k.granted) ?? !0);
|
|
3404
|
+
I(() => {
|
|
3405
|
+
const e = wr.current;
|
|
3406
|
+
if (wr.current = (k == null ? void 0 : k.granted) ?? !0, !e && (k != null && k.granted) && Ye.current) {
|
|
3407
|
+
const r = Ye.current, o = nn.current;
|
|
3408
|
+
Ye.current = null, nn.current = !1, St(null);
|
|
3409
|
+
const i = tn.current;
|
|
3410
|
+
if (tn.current = null, !o) return;
|
|
3411
|
+
r === "write" ? Ge(!0) : r === "action" ? i == null || i() : (we(), Yt());
|
|
3412
|
+
}
|
|
3413
|
+
}, [k == null ? void 0 : k.granted, we, Yt]), I(() => {
|
|
3414
|
+
Te && (Ge(!1), ye && Qt());
|
|
3415
|
+
}, [Te, ye, Qt]);
|
|
3416
|
+
const kr = C(
|
|
3417
|
+
(e = "document") => {
|
|
3418
|
+
if (ye) {
|
|
3419
|
+
Qt(!0);
|
|
3420
|
+
return;
|
|
3421
|
+
}
|
|
3422
|
+
ut();
|
|
3423
|
+
const r = Ne.current;
|
|
3424
|
+
if (Jt.current = e === "selection" && r && !r.collapsed ? r.cloneRange() : null, Te) {
|
|
3425
|
+
Ye.current = "dictate", St("dictate");
|
|
3426
|
+
return;
|
|
3427
|
+
}
|
|
3428
|
+
Yt();
|
|
3429
|
+
},
|
|
3430
|
+
[ye, Qt, Te, ut, Yt]
|
|
3431
|
+
), xr = C(
|
|
3432
|
+
(e = "document") => {
|
|
3433
|
+
ut();
|
|
3434
|
+
const r = Ne.current, o = r ? r.cloneRange() : null, i = e === "selection" && !!(o && !o.collapsed);
|
|
3435
|
+
if (o && !i && o.collapse(!1), Bt.current = o, To(i ? "selection" : "document"), Ao(i && o ? o.toString() : ""), Te) {
|
|
3436
|
+
Ye.current = "write", St("write");
|
|
3437
|
+
return;
|
|
3438
|
+
}
|
|
3439
|
+
Ge(!0);
|
|
3440
|
+
},
|
|
3441
|
+
[ut, Te]
|
|
3442
|
+
), Cr = vt(() => k != null && k.granted ? /* @__PURE__ */ A(je, { children: [
|
|
3443
|
+
$(
|
|
3444
|
+
"editor.ai.consentRecorded",
|
|
3445
|
+
"AI assistance consent has been recorded."
|
|
3446
|
+
),
|
|
3447
|
+
F ? /* @__PURE__ */ A(je, { children: [
|
|
3448
|
+
" ",
|
|
3449
|
+
F
|
|
3450
|
+
] }) : null
|
|
3451
|
+
] }) : F, [k, F, $]), [et, _n] = T(null), [Xo, rn] = T(!1), [Ar, Nr] = T(!1), [Uo, tt] = T(""), Tr = x(null), qe = x(null), on = x(Ee);
|
|
3452
|
+
I(() => {
|
|
3453
|
+
on.current = Ee;
|
|
3454
|
+
}, [Ee]), I(() => {
|
|
3455
|
+
U && (!ye && et === null || Je.state === null && mt());
|
|
3456
|
+
}, [U, ye, et, Je.state, mt]);
|
|
3457
|
+
const zt = (e) => e.preventDefault(), Er = C(
|
|
3458
|
+
(e) => {
|
|
3459
|
+
var o;
|
|
3460
|
+
const r = _.current;
|
|
3461
|
+
if (r)
|
|
3462
|
+
try {
|
|
3463
|
+
const i = r(O);
|
|
3464
|
+
(o = i == null ? void 0 : i.broadcast) == null || o.call(i, "state", !1, e);
|
|
3465
|
+
} catch {
|
|
3466
|
+
}
|
|
3467
|
+
},
|
|
3468
|
+
[O]
|
|
3469
|
+
), Rr = x(!1), nt = C(
|
|
3470
|
+
(e) => {
|
|
3471
|
+
const r = _.current;
|
|
3472
|
+
if (!r || Rr.current === e) return;
|
|
3473
|
+
Rr.current = e;
|
|
3474
|
+
const o = e || y;
|
|
3475
|
+
ne.current = o;
|
|
3476
|
+
try {
|
|
3477
|
+
r(O, o ? "enableReadOnly" : "disableReadOnly");
|
|
3478
|
+
} catch {
|
|
3479
|
+
}
|
|
3480
|
+
},
|
|
3481
|
+
[O, y]
|
|
3482
|
+
), In = C(
|
|
3483
|
+
(e) => {
|
|
3484
|
+
var o;
|
|
3485
|
+
const r = kt(
|
|
3486
|
+
ze(e),
|
|
3487
|
+
st.current
|
|
3488
|
+
);
|
|
3489
|
+
!fe("source.setCode", r) && Y.current && (Y.current.value = r), (o = be.current) == null || o.call(be, { html: r, markdown: "" });
|
|
3490
|
+
},
|
|
3491
|
+
[fe]
|
|
3492
|
+
), rt = C(
|
|
3493
|
+
(e) => {
|
|
3494
|
+
var l;
|
|
3495
|
+
const r = (l = q.current) == null ? void 0 : l.querySelector(".redactor-in"), o = typeof window < "u" ? window.getSelection() : null;
|
|
3496
|
+
if (e === "selection" && r && o && o.rangeCount > 0 && !o.isCollapsed) {
|
|
3497
|
+
const s = o.getRangeAt(0);
|
|
3498
|
+
if (r.contains(s.commonAncestorContainer)) {
|
|
3499
|
+
const d = s.toString();
|
|
3500
|
+
if (d.trim())
|
|
3501
|
+
return {
|
|
3502
|
+
scope: "selection",
|
|
3503
|
+
range: s.cloneRange(),
|
|
3504
|
+
html: Fs(s.cloneContents()),
|
|
3505
|
+
text: d
|
|
3506
|
+
};
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
const i = me();
|
|
3510
|
+
return { scope: "document", range: null, html: i, text: oo(i) };
|
|
3511
|
+
},
|
|
3512
|
+
[me]
|
|
3513
|
+
), $n = C(
|
|
3514
|
+
(e, r, o, i) => {
|
|
3515
|
+
if (qe.current || !o.text.trim()) return;
|
|
3516
|
+
const l = new AbortController();
|
|
3517
|
+
qe.current = l, _n(e), Nr(!1), Tr.current = e, tt($("editor.ai.generating")), rn(!1), U && mt();
|
|
3518
|
+
const s = me();
|
|
3519
|
+
nt(!0), Promise.resolve(
|
|
3520
|
+
r({
|
|
3521
|
+
html: o.html,
|
|
3522
|
+
text: o.text,
|
|
3523
|
+
scope: o.scope,
|
|
3524
|
+
signal: l.signal
|
|
3525
|
+
})
|
|
3526
|
+
).then((d) => {
|
|
3527
|
+
var M;
|
|
3528
|
+
if (l.signal.aborted) return;
|
|
3529
|
+
nt(!1);
|
|
3530
|
+
const N = String(d ?? "");
|
|
3531
|
+
if (me() !== s) {
|
|
3532
|
+
Nr(!0), tt("");
|
|
3533
|
+
return;
|
|
3534
|
+
}
|
|
3535
|
+
if (!oo(N)) {
|
|
3536
|
+
rn(!0), tt("");
|
|
3537
|
+
return;
|
|
3538
|
+
}
|
|
3539
|
+
if (Er(s), o.scope === "selection" && o.range) {
|
|
3540
|
+
if (!o.range.startContainer.isConnected) {
|
|
3541
|
+
rn(!0), tt("");
|
|
3542
|
+
return;
|
|
3543
|
+
}
|
|
3544
|
+
Ne.current = o.range, we();
|
|
3545
|
+
const G = kt(
|
|
3546
|
+
ze(N),
|
|
3547
|
+
st.current
|
|
3548
|
+
);
|
|
3549
|
+
fe("insertion.insertHtml", G) || ge(N, { asHtml: !0 });
|
|
3550
|
+
} else
|
|
3551
|
+
In(N);
|
|
3552
|
+
U && Pe(), tt($("editor.ai.actionDone")), (M = on.current) == null || M.call(on, {
|
|
3553
|
+
action: e,
|
|
3554
|
+
template: i,
|
|
3555
|
+
scope: o.scope,
|
|
3556
|
+
previousHtml: s,
|
|
3557
|
+
undo: () => In(s)
|
|
3558
|
+
});
|
|
3559
|
+
}).catch((d) => {
|
|
3560
|
+
var N;
|
|
3561
|
+
if (nt(!1), !(l.signal.aborted || Bs(d))) {
|
|
3562
|
+
if (ro(d) && ((N = _e.current) == null || N.call(_e), xn.current || Cn.current)) {
|
|
3563
|
+
Tt(!0), Ge(!0);
|
|
3564
|
+
return;
|
|
3565
|
+
}
|
|
3566
|
+
rn(!0), tt("");
|
|
3567
|
+
}
|
|
3568
|
+
}).finally(() => {
|
|
3569
|
+
qe.current === l && (qe.current = null, nt(!1), _n(null), ft());
|
|
3570
|
+
});
|
|
3571
|
+
},
|
|
3572
|
+
[
|
|
3573
|
+
U,
|
|
3574
|
+
mt,
|
|
3575
|
+
Pe,
|
|
3576
|
+
ft,
|
|
3577
|
+
nt,
|
|
3578
|
+
me,
|
|
3579
|
+
we,
|
|
3580
|
+
fe,
|
|
3581
|
+
ge,
|
|
3582
|
+
In,
|
|
3583
|
+
Er,
|
|
3584
|
+
$
|
|
3585
|
+
]
|
|
3586
|
+
), Lt = C(
|
|
3587
|
+
(e, r, o, i) => {
|
|
3588
|
+
if (Te) {
|
|
3589
|
+
tn.current = () => $n(e, r, o, i), Ye.current = "action", St("action");
|
|
3590
|
+
return;
|
|
3591
|
+
}
|
|
3592
|
+
$n(e, r, o, i);
|
|
3593
|
+
},
|
|
3594
|
+
[Te, $n]
|
|
3595
|
+
), Mr = C(
|
|
3596
|
+
(e, r) => {
|
|
3597
|
+
const o = J == null ? void 0 : J.onRun;
|
|
3598
|
+
o && Lt(
|
|
3599
|
+
"template",
|
|
3600
|
+
(i) => o({ ...i, template: e }),
|
|
3601
|
+
r,
|
|
3602
|
+
e
|
|
3603
|
+
);
|
|
3604
|
+
},
|
|
3605
|
+
[J, Lt]
|
|
3606
|
+
), Sr = C(() => {
|
|
3607
|
+
var e;
|
|
3608
|
+
(e = qe.current) == null || e.abort(), qe.current = null, nt(!1), _n(null), tt(""), ft();
|
|
3609
|
+
}, [nt, ft]), zr = x(null);
|
|
3610
|
+
I(() => {
|
|
3611
|
+
const e = et ?? Tr.current;
|
|
3612
|
+
if (!e) return;
|
|
3613
|
+
const r = e === "template" ? "ai-templates" : `ai-${e}`, o = requestAnimationFrame(() => {
|
|
3614
|
+
var l, s;
|
|
3615
|
+
const i = document.activeElement;
|
|
3616
|
+
i && i !== document.body && i.isConnected || (s = (l = zr.current) == null ? void 0 : l.querySelector(`[data-component-part="${r}"]`)) == null || s.focus();
|
|
3617
|
+
});
|
|
3618
|
+
return () => cancelAnimationFrame(o);
|
|
3619
|
+
}, [et]), I(() => () => {
|
|
3620
|
+
var e;
|
|
3621
|
+
return (e = qe.current) == null ? void 0 : e.abort();
|
|
3622
|
+
}, []), I(() => {
|
|
3623
|
+
const e = Y.current;
|
|
3624
|
+
if (!e) return;
|
|
3625
|
+
e.value = So.current, De.current();
|
|
3626
|
+
const r = Vs(B);
|
|
3627
|
+
if (!r) {
|
|
3628
|
+
rr(!0);
|
|
3629
|
+
return;
|
|
3630
|
+
}
|
|
3631
|
+
if (_.current = r, e.value = kt(e.value, st.current), v === void 0 && (f == null ? void 0 : f.lang) === void 0 && r.addLang && r.lang) {
|
|
3632
|
+
const d = `alfadocs-${Me}`;
|
|
3633
|
+
r.addLang(d, Wr($)), K.current = d;
|
|
3634
|
+
}
|
|
3635
|
+
const o = {
|
|
3636
|
+
lang: K.current ?? v ?? Us(Dt.language || "en"),
|
|
3637
|
+
// The kit renders its OWN toolbar (EditorToolbar) and drives Redactor
|
|
3638
|
+
// via the command API, so Redactor's native toolbar is suppressed.
|
|
3639
|
+
toolbar: !1,
|
|
3640
|
+
plugins: m ?? [],
|
|
3641
|
+
placeholder: h ?? $("editor.placeholder"),
|
|
3642
|
+
toolbarFixed: !1,
|
|
3643
|
+
// Platform parity (RedactorWysiwyg.js:84): no inline shortcode expansion.
|
|
3644
|
+
shortcodes: !1,
|
|
3645
|
+
// The kit owns image editing: ImageFloatingToolbar provides DS-native,
|
|
3646
|
+
// keyboard-accessible resize + wrap/align, so Redactor's own image
|
|
3647
|
+
// popup AND its single-handle drag-resizer are both disabled to avoid a
|
|
3648
|
+
// second, untokenised, mouse-only UI competing with ours.
|
|
3649
|
+
imageEditable: !1,
|
|
3650
|
+
imageResizable: !1
|
|
3651
|
+
}, i = z ? { imageUpload: z } : {}, l = (f == null ? void 0 : f.callbacks) ?? {}, s = {
|
|
3652
|
+
...o,
|
|
3653
|
+
...i,
|
|
3654
|
+
...f ?? {},
|
|
3655
|
+
// Re-pin safety-critical keys LAST so consumer `options` can't override
|
|
3656
|
+
// the sanitising change handler or re-enable Redactor's native image UI
|
|
3657
|
+
// (the kit's ImageFloatingToolbar replaces both — see kitDefaults above).
|
|
3658
|
+
imageEditable: !1,
|
|
3659
|
+
imageResizable: !1,
|
|
3660
|
+
callbacks: {
|
|
3661
|
+
...l,
|
|
3662
|
+
changed(d) {
|
|
3663
|
+
De.current();
|
|
3664
|
+
const N = un(
|
|
3665
|
+
to(no(d))
|
|
3666
|
+
), M = ze(N), G = _r.current;
|
|
3667
|
+
if (G && Date.now() < G.until && io(M) === G.text) {
|
|
3668
|
+
Gt.current = M;
|
|
3669
|
+
return;
|
|
3670
|
+
}
|
|
3671
|
+
M !== Gt.current && (Gt.current = M, xe.current = !0, be.current && (Et.current && clearTimeout(Et.current), Et.current = setTimeout(() => {
|
|
3672
|
+
var re;
|
|
3673
|
+
(re = be.current) == null || re.call(be, { html: M, markdown: "" });
|
|
3674
|
+
}, 100)));
|
|
3675
|
+
},
|
|
3676
|
+
keydown(d) {
|
|
3677
|
+
var N;
|
|
3678
|
+
(N = Kt.current) == null || N.call(Kt, d);
|
|
3679
|
+
},
|
|
3680
|
+
observe() {
|
|
3681
|
+
ve();
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
};
|
|
3685
|
+
try {
|
|
3686
|
+
if (r(O, s), Gt.current = ze(
|
|
3687
|
+
un(to(me()))
|
|
3688
|
+
), De.current(), y)
|
|
3689
|
+
try {
|
|
3690
|
+
r(O, "enableReadOnly");
|
|
3691
|
+
} catch {
|
|
3692
|
+
}
|
|
3693
|
+
} catch {
|
|
3694
|
+
K.current && r.lang && delete r.lang[K.current], K.current = null, _.current = null, rr(!0);
|
|
3695
|
+
}
|
|
3696
|
+
return () => {
|
|
3697
|
+
Et.current && clearTimeout(Et.current);
|
|
3698
|
+
try {
|
|
3699
|
+
r(O, "destroy");
|
|
3700
|
+
} catch {
|
|
3701
|
+
}
|
|
3702
|
+
K.current && r.lang && delete r.lang[K.current], K.current = null, _.current = null;
|
|
3703
|
+
};
|
|
3704
|
+
}, []), I(() => {
|
|
3705
|
+
const e = _.current, r = K.current;
|
|
3706
|
+
if (!(!(e != null && e.addLang) || !r)) {
|
|
3707
|
+
e.addLang(r, Wr($));
|
|
3708
|
+
try {
|
|
3709
|
+
e(O, "lang.rebuild", r);
|
|
3710
|
+
} catch {
|
|
3711
|
+
}
|
|
3712
|
+
}
|
|
3713
|
+
}, [$, Dt.language, O]);
|
|
3714
|
+
const Lr = x(pe), _r = x(
|
|
3715
|
+
null
|
|
3716
|
+
);
|
|
3717
|
+
I(() => {
|
|
3718
|
+
var o, i;
|
|
3719
|
+
if (Lr.current === pe || (Lr.current = pe, !_.current || pe.size === 0)) return;
|
|
3720
|
+
const e = me(), r = kt(e, pe);
|
|
3721
|
+
if (r !== e) {
|
|
3722
|
+
const l = (o = q.current) == null ? void 0 : o.querySelector(".redactor-in"), d = l != null && l.contains(document.activeElement) && l ? js(l) : null;
|
|
3723
|
+
_r.current = {
|
|
3724
|
+
text: io(e),
|
|
3725
|
+
until: Date.now() + 1e3
|
|
3726
|
+
}, fe("source.setCode", r);
|
|
3727
|
+
const N = (i = q.current) == null ? void 0 : i.querySelector(".redactor-in");
|
|
3728
|
+
d !== null && N && Gs(N, d);
|
|
3729
|
+
}
|
|
3730
|
+
window.requestAnimationFrame(() => De.current());
|
|
3731
|
+
}, [pe, me, fe]), I(() => {
|
|
3732
|
+
if (!_.current || u === void 0) return;
|
|
3733
|
+
if (xe.current) {
|
|
3734
|
+
xe.current = !1;
|
|
3735
|
+
return;
|
|
3736
|
+
}
|
|
3737
|
+
const e = kt(
|
|
3738
|
+
ze(un(u)),
|
|
3739
|
+
st.current
|
|
3740
|
+
);
|
|
3741
|
+
un(me()) !== e && fe("source.setCode", e);
|
|
3742
|
+
}, [u, me, fe]), I(() => {
|
|
3743
|
+
ne.current = y;
|
|
3744
|
+
const e = _.current;
|
|
3745
|
+
if (e)
|
|
3746
|
+
try {
|
|
3747
|
+
e(O, y ? "enableReadOnly" : "disableReadOnly");
|
|
3748
|
+
} catch {
|
|
3749
|
+
}
|
|
3750
|
+
}, [y, O]), I(() => {
|
|
3751
|
+
if (!de || u === void 0) return;
|
|
3752
|
+
const e = Y.current;
|
|
3753
|
+
if (!e) return;
|
|
3754
|
+
const r = ze(u);
|
|
3755
|
+
e.value !== r && document.activeElement !== e && (e.value = r);
|
|
3756
|
+
}, [de, u]);
|
|
3757
|
+
const Ke = vt(
|
|
3758
|
+
() => ({
|
|
3759
|
+
getHTML() {
|
|
3760
|
+
return me();
|
|
3761
|
+
},
|
|
3762
|
+
getText() {
|
|
3763
|
+
return me().replace(/<[^>]*>/g, " ").replace(/ /gi, " ").replace(/\s+/g, " ").trim();
|
|
3764
|
+
},
|
|
3765
|
+
getMarkdown() {
|
|
3766
|
+
return "";
|
|
3767
|
+
},
|
|
3768
|
+
isAiBusy() {
|
|
3769
|
+
return qe.current !== null;
|
|
3770
|
+
},
|
|
3771
|
+
setContent(e) {
|
|
3772
|
+
const r = ze(e);
|
|
3773
|
+
fe(
|
|
3774
|
+
"source.setCode",
|
|
3775
|
+
kt(r, st.current)
|
|
3776
|
+
) || Y.current && (Y.current.value = r);
|
|
3777
|
+
},
|
|
3778
|
+
insertAtCursor: ge,
|
|
3779
|
+
applyFormat(e) {
|
|
3780
|
+
const r = Ws[e];
|
|
3781
|
+
r && Ze(...r);
|
|
3782
|
+
},
|
|
3783
|
+
focus() {
|
|
3784
|
+
var r;
|
|
3785
|
+
const e = _.current;
|
|
3786
|
+
if (e)
|
|
3787
|
+
try {
|
|
3788
|
+
e(O, "editor.focus");
|
|
3789
|
+
return;
|
|
3790
|
+
} catch {
|
|
3791
|
+
}
|
|
3792
|
+
(r = Y.current) == null || r.focus();
|
|
3793
|
+
},
|
|
3794
|
+
clear() {
|
|
3795
|
+
fe("source.setCode", "") || Y.current && (Y.current.value = "");
|
|
3796
|
+
}
|
|
3797
|
+
}),
|
|
3798
|
+
[O, me, fe, ge, Ze]
|
|
3799
|
+
);
|
|
3800
|
+
ui(pn, () => Ke, [Ke]), bi(Ja, Ke, n);
|
|
3801
|
+
const Zo = C(
|
|
3802
|
+
(e) => {
|
|
3803
|
+
var r;
|
|
3804
|
+
De.current(), (r = be.current) == null || r.call(be, {
|
|
3805
|
+
html: ze(e.target.value),
|
|
3806
|
+
markdown: ""
|
|
3807
|
+
});
|
|
3808
|
+
},
|
|
3809
|
+
[]
|
|
3810
|
+
), an = w ?? $("editor.regionLabel"), Hn = f == null ? void 0 : f.placeholder, _t = typeof Hn == "string" || Hn === !1 ? Hn : h ?? $("editor.placeholder");
|
|
3811
|
+
I(() => {
|
|
3812
|
+
var i;
|
|
3813
|
+
if (de) return;
|
|
3814
|
+
const e = (i = q.current) == null ? void 0 : i.querySelector(".redactor-in");
|
|
3815
|
+
if (!e) return;
|
|
3816
|
+
const r = () => {
|
|
3817
|
+
e.getAttribute("role") !== "textbox" && e.setAttribute("role", "textbox"), e.getAttribute("aria-multiline") !== "true" && e.setAttribute("aria-multiline", "true"), e.getAttribute("aria-label") !== an && e.setAttribute("aria-label", an), _t === !1 ? e.hasAttribute("placeholder") && e.removeAttribute("placeholder") : e.getAttribute("placeholder") !== _t && e.setAttribute("placeholder", _t), e.hasAttribute("aria-labelledby") && e.removeAttribute("aria-labelledby");
|
|
3818
|
+
};
|
|
3819
|
+
r();
|
|
3820
|
+
const o = new MutationObserver(r);
|
|
3821
|
+
return o.observe(e, {
|
|
3822
|
+
attributes: !0,
|
|
3823
|
+
attributeFilter: ["role", "aria-labelledby", "placeholder"]
|
|
3824
|
+
}), () => o.disconnect();
|
|
3825
|
+
}, [de, an, _t]);
|
|
3826
|
+
const sn = et !== null, Qo = C(
|
|
3827
|
+
(e) => {
|
|
3828
|
+
jn.test(e) && (de ? ge(`[[${e}]]`, { asHtml: !1 }) : (we(), Qe(ao(e))), ce == null || ce(e));
|
|
3829
|
+
},
|
|
3830
|
+
[
|
|
3831
|
+
de,
|
|
3832
|
+
ge,
|
|
3833
|
+
we,
|
|
3834
|
+
Qe,
|
|
3835
|
+
ce
|
|
3836
|
+
]
|
|
3837
|
+
), On = x(null), [Jo, Yo] = T(!1), [ei, ti] = T(!1), ni = C(
|
|
3838
|
+
(e, r) => {
|
|
3839
|
+
if (ti(e), !e) return;
|
|
3840
|
+
const o = rt(r);
|
|
3841
|
+
On.current = o, Yo(!o.text.trim());
|
|
3842
|
+
},
|
|
3843
|
+
[rt]
|
|
3844
|
+
), ri = C(
|
|
3845
|
+
(e) => {
|
|
3846
|
+
const r = On.current ?? rt("document");
|
|
3847
|
+
On.current = null, Mr(e, r);
|
|
3848
|
+
},
|
|
3849
|
+
[rt, Mr]
|
|
3850
|
+
), Ir = (e, r) => {
|
|
3851
|
+
if (!r) return null;
|
|
3852
|
+
const o = et === e;
|
|
3853
|
+
return {
|
|
3854
|
+
key: e,
|
|
3855
|
+
// While running, the segment becomes a Stop/Cancel button (progress
|
|
3856
|
+
// shows on the scrim spinner).
|
|
3857
|
+
icon: o ? /* @__PURE__ */ t($t, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : e === "proofread" ? /* @__PURE__ */ t(Kr, { "aria-hidden": "true", className: "ds:size-5" }) : /* @__PURE__ */ t(Vr, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
3858
|
+
label: o ? $("common.cancel") : e === "proofread" ? $("editor.ai.proofread", "Check spelling & grammar") : $("editor.ai.autoFormat", "Auto-format document"),
|
|
3859
|
+
onClick: o ? Sr : () => Lt(e, r, rt("document")),
|
|
3860
|
+
running: o
|
|
3861
|
+
};
|
|
3862
|
+
}, $e = Pi(ke), Dn = ye && Fo === "connecting", ot = [];
|
|
3863
|
+
if (Q && ot.push({
|
|
3864
|
+
key: "dictate",
|
|
3865
|
+
// Connecting: a spinner, not yet the red recording look, so the
|
|
3866
|
+
// red means "speak now". Pressing it still stops the session.
|
|
3867
|
+
icon: Dn ? /* @__PURE__ */ t(
|
|
3868
|
+
Kn,
|
|
3869
|
+
{
|
|
3870
|
+
"aria-hidden": "true",
|
|
3871
|
+
className: "ds:size-5 ds:animate-spin ds:motion-reduce:animate-none"
|
|
3872
|
+
}
|
|
3873
|
+
) : ye ? /* @__PURE__ */ t($t, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ t(Vn, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
3874
|
+
label: $(ye ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
3875
|
+
onClick: () => kr("document"),
|
|
3876
|
+
recording: ye && !Dn,
|
|
3877
|
+
// On from the first press, though not red until it listens.
|
|
3878
|
+
pressed: ye
|
|
3879
|
+
}), J) {
|
|
3880
|
+
const e = et === "template";
|
|
3881
|
+
ot.push({
|
|
3882
|
+
key: "templates",
|
|
3883
|
+
icon: e ? /* @__PURE__ */ t($t, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ t(Wn, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
3884
|
+
label: $(e ? "common.cancel" : "editor.ai.templates"),
|
|
3885
|
+
onClick: e ? Sr : void 0,
|
|
3886
|
+
running: e,
|
|
3887
|
+
menu: !e
|
|
3888
|
+
});
|
|
3889
|
+
}
|
|
3890
|
+
const $r = Ir("proofread", oe);
|
|
3891
|
+
$r && ot.push($r);
|
|
3892
|
+
const Hr = Ir("format", le);
|
|
3893
|
+
Hr && ot.push(Hr), (j || He) && ot.push({
|
|
3894
|
+
key: "write",
|
|
3895
|
+
icon: /* @__PURE__ */ t(Gr, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
3896
|
+
label: $("editor.ai.helpMeWrite"),
|
|
3897
|
+
onClick: () => xr("document")
|
|
3898
|
+
});
|
|
3899
|
+
const Or = (e, r) => J ? /* @__PURE__ */ t(
|
|
3900
|
+
Ls,
|
|
3901
|
+
{
|
|
3902
|
+
side: r === "document" ? "top" : "bottom",
|
|
3903
|
+
templates: J.templates,
|
|
3904
|
+
onPick: ri,
|
|
3905
|
+
onManage: J.onManage,
|
|
3906
|
+
noteEmpty: Jo,
|
|
3907
|
+
onOpenChange: (o) => ni(o, r),
|
|
3908
|
+
trigger: e
|
|
3909
|
+
}
|
|
3910
|
+
) : null, Dr = (E ?? []).filter(
|
|
3911
|
+
(e) => !e.contexts || R !== void 0 && e.contexts.includes(R)
|
|
3912
|
+
);
|
|
3913
|
+
I(() => {
|
|
3914
|
+
(We || en !== null || y) && Oe(!1);
|
|
3915
|
+
}, [We, en, y, Oe]), I(() => {
|
|
3916
|
+
Ae && !(E ?? []).some(
|
|
3917
|
+
(e) => e.id === Ae.extension.id && (!e.contexts || R !== void 0 && e.contexts.includes(R))
|
|
3918
|
+
) && Oe();
|
|
3919
|
+
}, [E, R, Ae, Oe]);
|
|
3920
|
+
const oi = (e) => {
|
|
3921
|
+
var re, Se;
|
|
3922
|
+
if (vn) return;
|
|
3923
|
+
kn(), Ge(!1), Ln();
|
|
3924
|
+
const r = new AbortController();
|
|
3925
|
+
Nt.current = r;
|
|
3926
|
+
const o = (re = Ne.current) == null ? void 0 : re.cloneRange(), i = Y.current ? [
|
|
3927
|
+
Y.current.selectionStart,
|
|
3928
|
+
Y.current.selectionEnd
|
|
3929
|
+
] : null, l = (o == null ? void 0 : o.toString()) ?? (i ? (((Se = Y.current) == null ? void 0 : Se.value) ?? "").slice(...i) : "");
|
|
3930
|
+
let s = !1;
|
|
3931
|
+
const d = (ee) => {
|
|
3932
|
+
var Be;
|
|
3933
|
+
s || (s = !0, (Be = qt.current) == null || Be.call(qt, e.id, ee));
|
|
3934
|
+
};
|
|
3935
|
+
Xe.current = d;
|
|
3936
|
+
const N = () => {
|
|
3937
|
+
r.signal.aborted || (d({ status: "error" }), r.abort(), yn(!1), ir(!0), wn());
|
|
3938
|
+
}, M = async (ee) => {
|
|
3939
|
+
var bt;
|
|
3940
|
+
if (r.signal.aborted) return;
|
|
3941
|
+
let Be = ee.mode === "image" ? "" : ee.html;
|
|
3942
|
+
if (ee.mode !== "text") {
|
|
3943
|
+
const it = await ee.pngDataUri();
|
|
3944
|
+
if (r.signal.aborted) return;
|
|
3945
|
+
const It = await (await fetch(it.dataUri, { signal: r.signal })).blob(), Pn = await fr(
|
|
3946
|
+
new File([It], "extension-result.png", { type: "image/png" }),
|
|
3947
|
+
r.signal
|
|
3948
|
+
);
|
|
3949
|
+
if (r.signal.aborted) return;
|
|
3950
|
+
const Fe = document.createElement("img");
|
|
3951
|
+
Fe.src = Pn, Fe.alt = ee.text, Fe.width = it.width, Fe.height = it.height, Fe.loading = "lazy", Be += Fe.outerHTML;
|
|
3952
|
+
}
|
|
3953
|
+
r.signal.aborted || (o && (Ne.current = o.cloneRange()), i && ((bt = Y.current) == null || bt.setSelectionRange(...i)), we(), ge(Be, { asHtml: !0 }), d({ status: "success" }), Oe());
|
|
3954
|
+
}, G = {
|
|
3955
|
+
html: Ke.getHTML(),
|
|
3956
|
+
text: Ke.getText(),
|
|
3957
|
+
selectionText: l,
|
|
3958
|
+
scope: l ? "selection" : "document",
|
|
3959
|
+
signal: r.signal,
|
|
3960
|
+
close: () => {
|
|
3961
|
+
Nt.current === r && Oe();
|
|
3962
|
+
},
|
|
3963
|
+
insert: async (ee) => {
|
|
3964
|
+
try {
|
|
3965
|
+
await M(ee);
|
|
3966
|
+
} catch {
|
|
3967
|
+
N();
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
};
|
|
3971
|
+
or({ extension: e, context: G }), e.kind === "action" && (yn(!0), (async () => {
|
|
3972
|
+
try {
|
|
3973
|
+
if (!e.run) throw new Error("Missing extension run");
|
|
3974
|
+
const ee = await e.run(G);
|
|
3975
|
+
if (r.signal.aborted) return;
|
|
3976
|
+
ee ? await M(ee) : (d({ status: "success" }), Oe());
|
|
3977
|
+
} catch {
|
|
3978
|
+
N();
|
|
3979
|
+
}
|
|
3980
|
+
})());
|
|
3981
|
+
}, Pr = wo.map(
|
|
3982
|
+
(e) => Dr.filter(
|
|
3983
|
+
(r) => {
|
|
3984
|
+
var o;
|
|
3985
|
+
return (((o = r.source) == null ? void 0 : o.kind) ?? "kit") === e;
|
|
3986
|
+
}
|
|
3987
|
+
)
|
|
3988
|
+
), ii = Pr.every(
|
|
3989
|
+
(e) => e.length > 0
|
|
3990
|
+
), ai = Dr.length > 0 ? /* @__PURE__ */ t(
|
|
3991
|
+
tl,
|
|
3992
|
+
{
|
|
3993
|
+
groupedExtensions: Pr,
|
|
3994
|
+
showExtensionGroups: ii,
|
|
3995
|
+
extensionPending: vn,
|
|
3996
|
+
extensionSession: Ae,
|
|
3997
|
+
extensionError: bn,
|
|
3998
|
+
openExtension: oi,
|
|
3999
|
+
closeExtension: Oe,
|
|
4000
|
+
saveSelection: ut,
|
|
4001
|
+
closeSignal: ko,
|
|
4002
|
+
restoreFocusOnCloseRef: ar
|
|
4003
|
+
}
|
|
4004
|
+
) : void 0, qr = !!(j || He), Br = !!(J || oe || le || qr || Q), si = !de && !y && (he ?? Br), li = C(
|
|
4005
|
+
() => {
|
|
4006
|
+
var e;
|
|
4007
|
+
return ((e = q.current) == null ? void 0 : e.querySelector(".redactor-in")) ?? null;
|
|
4008
|
+
},
|
|
4009
|
+
[]
|
|
4010
|
+
);
|
|
4011
|
+
return /* @__PURE__ */ A(
|
|
4012
|
+
"div",
|
|
4013
|
+
{
|
|
4014
|
+
ref: q,
|
|
4015
|
+
className: [Zs(), S].filter(Boolean).join(" "),
|
|
4016
|
+
"data-component": "rich-text-editor",
|
|
4017
|
+
"data-component-id": n,
|
|
4018
|
+
"data-min-height": b,
|
|
4019
|
+
children: [
|
|
4020
|
+
!de && !y ? /* @__PURE__ */ t(
|
|
4021
|
+
Hs,
|
|
4022
|
+
{
|
|
4023
|
+
run: Ze,
|
|
4024
|
+
active: En,
|
|
4025
|
+
preset: g,
|
|
4026
|
+
insertHtml: Qe,
|
|
4027
|
+
insertTable: Bo,
|
|
4028
|
+
saveSelection: ut,
|
|
4029
|
+
restoreSelection: we,
|
|
4030
|
+
getSelectedText: $o,
|
|
4031
|
+
uploadImage: z || H ? fr : void 0,
|
|
4032
|
+
enableColor: (m == null ? void 0 : m.includes("fontcolor")) ?? !1,
|
|
4033
|
+
enableImage: !!(z || H),
|
|
4034
|
+
enableTable: (m == null ? void 0 : m.includes("table")) ?? !1,
|
|
4035
|
+
showExtensions: p,
|
|
4036
|
+
extensionControl: ai,
|
|
4037
|
+
variables: cr,
|
|
4038
|
+
recentVariableTokens: te,
|
|
4039
|
+
insertVariable: Qo
|
|
4040
|
+
}
|
|
4041
|
+
) : null,
|
|
4042
|
+
/* @__PURE__ */ A("div", { className: "ds:relative", ref: Ce, children: [
|
|
4043
|
+
/* @__PURE__ */ t(
|
|
4044
|
+
"textarea",
|
|
4045
|
+
{
|
|
4046
|
+
ref: Y,
|
|
4047
|
+
id: Me,
|
|
4048
|
+
"aria-label": an,
|
|
4049
|
+
"aria-multiline": "true",
|
|
4050
|
+
"aria-busy": sn || void 0,
|
|
4051
|
+
placeholder: _t || void 0,
|
|
4052
|
+
onChange: de ? Zo : void 0,
|
|
4053
|
+
readOnly: de ? y : void 0,
|
|
4054
|
+
className: de ? Js() : void 0
|
|
4055
|
+
}
|
|
4056
|
+
),
|
|
4057
|
+
sn ? /* @__PURE__ */ t(
|
|
4058
|
+
"div",
|
|
4059
|
+
{
|
|
4060
|
+
"aria-hidden": "true",
|
|
4061
|
+
className: "ds:absolute ds:inset-0 ds:z-[5] ds:flex ds:items-center ds:justify-center ds:cursor-wait ds:rounded-[var(--radius-md)] ds:bg-[color-mix(in_srgb,var(--background)_40%,transparent)]",
|
|
4062
|
+
children: /* @__PURE__ */ t(Yn, { size: "lg", variant: "prism" })
|
|
4063
|
+
}
|
|
4064
|
+
) : null,
|
|
4065
|
+
/* @__PURE__ */ A("div", { className: "ds:sticky ds:bottom-0 ds:z-10", children: [
|
|
4066
|
+
ot.length > 0 ? /* @__PURE__ */ A(
|
|
4067
|
+
"div",
|
|
4068
|
+
{
|
|
4069
|
+
ref: zr,
|
|
4070
|
+
className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10",
|
|
4071
|
+
"data-ai-sparkle": Je.props["data-ai-sparkle"],
|
|
4072
|
+
children: [
|
|
4073
|
+
/* @__PURE__ */ A("div", { className: gi, children: [
|
|
4074
|
+
ot.map((e, r) => {
|
|
4075
|
+
const o = /* @__PURE__ */ t(
|
|
4076
|
+
"button",
|
|
4077
|
+
{
|
|
4078
|
+
type: "button",
|
|
4079
|
+
onClick: e.onClick,
|
|
4080
|
+
"aria-pressed": (e.pressed ?? e.recording) || void 0,
|
|
4081
|
+
"aria-busy": e.running || void 0,
|
|
4082
|
+
"aria-haspopup": e.menu ? "menu" : void 0,
|
|
4083
|
+
"data-component-part": `ai-${e.key}`,
|
|
4084
|
+
disabled: sn && !e.running || void 0,
|
|
4085
|
+
"aria-label": e.label,
|
|
4086
|
+
className: e.recording ? el : Ys,
|
|
4087
|
+
children: e.icon
|
|
4088
|
+
}
|
|
4089
|
+
);
|
|
4090
|
+
return /* @__PURE__ */ A(xt, { children: [
|
|
4091
|
+
r > 0 ? /* @__PURE__ */ t(
|
|
4092
|
+
"span",
|
|
4093
|
+
{
|
|
4094
|
+
"aria-hidden": "true",
|
|
4095
|
+
className: hi
|
|
4096
|
+
}
|
|
4097
|
+
) : null,
|
|
4098
|
+
yt(
|
|
4099
|
+
e.menu ? Or(o, "document") : o,
|
|
4100
|
+
$e
|
|
4101
|
+
)
|
|
4102
|
+
] }, e.key);
|
|
4103
|
+
}),
|
|
4104
|
+
Je.state ? /* @__PURE__ */ t(
|
|
4105
|
+
"span",
|
|
4106
|
+
{
|
|
4107
|
+
"aria-hidden": "true",
|
|
4108
|
+
className: `${pi} ${Je.props.className}`
|
|
4109
|
+
}
|
|
4110
|
+
) : null
|
|
4111
|
+
] }),
|
|
4112
|
+
/* @__PURE__ */ t(yi, { state: Je.state })
|
|
4113
|
+
]
|
|
4114
|
+
}
|
|
4115
|
+
) : null,
|
|
4116
|
+
/* @__PURE__ */ t(
|
|
4117
|
+
Gn,
|
|
4118
|
+
{
|
|
4119
|
+
open: !!(Ae && (!vn || bn)),
|
|
4120
|
+
onClose: Oe,
|
|
4121
|
+
title: Ae ? go($, Ae.extension.label) : void 0,
|
|
4122
|
+
children: bn ? /* @__PURE__ */ t(fo, {}) : /* @__PURE__ */ t("div", { className: "ds:overflow-y-auto ds:[max-block-size:min(60dvh,calc(var(--rich-text-editor-min-block-size)*3))]", children: (jr = Ae == null ? void 0 : (Fr = Ae.extension).render) == null ? void 0 : jr.call(
|
|
4123
|
+
Fr,
|
|
4124
|
+
Ae.context
|
|
4125
|
+
) })
|
|
4126
|
+
}
|
|
4127
|
+
),
|
|
4128
|
+
He ? He({
|
|
4129
|
+
open: We && !Te,
|
|
4130
|
+
onClose: () => {
|
|
4131
|
+
Ge(!1), Tt(!1);
|
|
4132
|
+
},
|
|
4133
|
+
selectionText: Co,
|
|
4134
|
+
scope: No,
|
|
4135
|
+
creditsExhausted: sr,
|
|
4136
|
+
getHTML: Ke.getHTML,
|
|
4137
|
+
getText: Ke.getText,
|
|
4138
|
+
// All three write seams put AI output into the note, so
|
|
4139
|
+
// each one is an action landing and sparkles the pill.
|
|
4140
|
+
insertAtSelection: (e) => {
|
|
4141
|
+
Bt.current && (Ne.current = Bt.current.cloneRange()), we(), ge(e, { asHtml: !0 }), U && Pe();
|
|
4142
|
+
},
|
|
4143
|
+
insertAfterSelection: (e) => {
|
|
4144
|
+
const r = Bt.current ?? Ne.current;
|
|
4145
|
+
if (r) {
|
|
4146
|
+
const o = r.cloneRange();
|
|
4147
|
+
o.collapse(!1), Ne.current = o;
|
|
4148
|
+
}
|
|
4149
|
+
we(), ge(e, { asHtml: !0 }), U && Pe();
|
|
4150
|
+
},
|
|
4151
|
+
setContent: (e) => {
|
|
4152
|
+
Ke.setContent(e), U && Pe();
|
|
4153
|
+
},
|
|
4154
|
+
onDictate: Q,
|
|
4155
|
+
privacyNotice: Cr
|
|
4156
|
+
}) : j ? /* @__PURE__ */ t(
|
|
4157
|
+
os,
|
|
4158
|
+
{
|
|
4159
|
+
open: We && !Te,
|
|
4160
|
+
onClose: () => {
|
|
4161
|
+
Ge(!1), Tt(!1);
|
|
4162
|
+
},
|
|
4163
|
+
onRequestAiDraft: j,
|
|
4164
|
+
creditsExhausted: sr,
|
|
4165
|
+
onCreditsExhausted: () => {
|
|
4166
|
+
var e;
|
|
4167
|
+
return (e = _e.current) == null ? void 0 : e.call(_e);
|
|
4168
|
+
},
|
|
4169
|
+
onInsert: (e) => {
|
|
4170
|
+
we(), ge(e, { asHtml: X !== "text" }), U && Pe();
|
|
4171
|
+
},
|
|
4172
|
+
previewAsHtml: X !== "text",
|
|
4173
|
+
privacyNotice: Cr,
|
|
4174
|
+
onDictate: Q
|
|
4175
|
+
}
|
|
4176
|
+
) : null,
|
|
4177
|
+
k ? /* @__PURE__ */ t(
|
|
4178
|
+
Gn,
|
|
4179
|
+
{
|
|
4180
|
+
open: en !== null,
|
|
4181
|
+
onClose: Ln,
|
|
4182
|
+
ariaLabel: $(
|
|
4183
|
+
"editor.ai.consentRegionLabel",
|
|
4184
|
+
"AI assistance consent for this document"
|
|
4185
|
+
),
|
|
4186
|
+
footer: /* @__PURE__ */ t(Le, { intent: "ghost", size: "sm", onClick: Ln, children: $("common.close") }),
|
|
4187
|
+
children: /* @__PURE__ */ t(
|
|
4188
|
+
wi,
|
|
4189
|
+
{
|
|
4190
|
+
granted: k.granted,
|
|
4191
|
+
grantedAt: k.grantedAt,
|
|
4192
|
+
grantedBy: k.grantedBy,
|
|
4193
|
+
canGrant: (k.canGrant ?? !0) && k.onGrant !== void 0,
|
|
4194
|
+
pending: Vo,
|
|
4195
|
+
onGrantConsent: Wo,
|
|
4196
|
+
headingLevel: se,
|
|
4197
|
+
"aria-label": $(
|
|
4198
|
+
"editor.ai.consentRegionLabel",
|
|
4199
|
+
"AI assistance consent for this document"
|
|
4200
|
+
)
|
|
4201
|
+
}
|
|
4202
|
+
)
|
|
4203
|
+
}
|
|
4204
|
+
) : null
|
|
4205
|
+
] }),
|
|
4206
|
+
!de && !y && ((m == null ? void 0 : m.includes("table")) ?? !1) ? /* @__PURE__ */ t(
|
|
4207
|
+
ks,
|
|
4208
|
+
{
|
|
4209
|
+
active: En,
|
|
4210
|
+
run: Ze,
|
|
4211
|
+
areaRef: Ce,
|
|
4212
|
+
getActiveTableEl: Ho,
|
|
4213
|
+
enableColor: (m == null ? void 0 : m.includes("fontcolor")) ?? !1,
|
|
4214
|
+
saveTableCell: Oo,
|
|
4215
|
+
applyTableBackground: Do
|
|
4216
|
+
}
|
|
4217
|
+
) : null,
|
|
4218
|
+
!de && !y ? /* @__PURE__ */ t(
|
|
4219
|
+
zs,
|
|
4220
|
+
{
|
|
4221
|
+
areaRef: Ce,
|
|
4222
|
+
activeImageEl: Ro,
|
|
4223
|
+
applyImageClass: Po,
|
|
4224
|
+
setImageWidth: qo
|
|
4225
|
+
}
|
|
4226
|
+
) : null,
|
|
4227
|
+
si ? /* @__PURE__ */ t(
|
|
4228
|
+
$s,
|
|
4229
|
+
{
|
|
4230
|
+
active: En,
|
|
4231
|
+
run: Ze,
|
|
4232
|
+
areaRef: Ce,
|
|
4233
|
+
getEditorRoot: li,
|
|
4234
|
+
suppressed: sn || We || en !== null || Ae !== null,
|
|
4235
|
+
holdOpen: ei,
|
|
4236
|
+
children: Br ? /* @__PURE__ */ A(je, { children: [
|
|
4237
|
+
Q ? yt(
|
|
4238
|
+
/* @__PURE__ */ t(
|
|
4239
|
+
Z,
|
|
4240
|
+
{
|
|
4241
|
+
size: "sm",
|
|
4242
|
+
intent: "ghost",
|
|
4243
|
+
"data-component-part": "selection-ai-dictate",
|
|
4244
|
+
onMouseDown: zt,
|
|
4245
|
+
icon: Dn ? /* @__PURE__ */ t(Kn, { className: "ds:animate-spin ds:motion-reduce:animate-none" }) : ye ? /* @__PURE__ */ t($t, {}) : /* @__PURE__ */ t(Vn, {}),
|
|
4246
|
+
"aria-pressed": ye,
|
|
4247
|
+
...mn(
|
|
4248
|
+
$(ye ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
4249
|
+
!!$e
|
|
4250
|
+
),
|
|
4251
|
+
onClick: () => kr("selection")
|
|
4252
|
+
}
|
|
4253
|
+
),
|
|
4254
|
+
$e
|
|
4255
|
+
) : null,
|
|
4256
|
+
J ? yt(
|
|
4257
|
+
Or(
|
|
4258
|
+
/* @__PURE__ */ t(
|
|
4259
|
+
Le,
|
|
4260
|
+
{
|
|
4261
|
+
size: "sm",
|
|
4262
|
+
intent: "ghost",
|
|
4263
|
+
"data-component-part": "selection-ai-templates",
|
|
4264
|
+
onMouseDown: zt,
|
|
4265
|
+
startIcon: /* @__PURE__ */ t(Wn, {}),
|
|
4266
|
+
endIcon: /* @__PURE__ */ t(nr, {}),
|
|
4267
|
+
children: $("editor.ai.templates")
|
|
4268
|
+
}
|
|
4269
|
+
),
|
|
4270
|
+
"selection"
|
|
4271
|
+
),
|
|
4272
|
+
$e
|
|
4273
|
+
) : null,
|
|
4274
|
+
oe ? yt(
|
|
4275
|
+
/* @__PURE__ */ t(
|
|
4276
|
+
Z,
|
|
4277
|
+
{
|
|
4278
|
+
size: "sm",
|
|
4279
|
+
intent: "ghost",
|
|
4280
|
+
"data-component-part": "selection-ai-proofread",
|
|
4281
|
+
onMouseDown: zt,
|
|
4282
|
+
icon: /* @__PURE__ */ t(Kr, {}),
|
|
4283
|
+
...mn(
|
|
4284
|
+
$("editor.ai.proofread"),
|
|
4285
|
+
!!$e
|
|
4286
|
+
),
|
|
4287
|
+
onClick: () => Lt(
|
|
4288
|
+
"proofread",
|
|
4289
|
+
oe,
|
|
4290
|
+
rt("selection")
|
|
4291
|
+
)
|
|
4292
|
+
}
|
|
4293
|
+
),
|
|
4294
|
+
$e
|
|
4295
|
+
) : null,
|
|
4296
|
+
le ? yt(
|
|
4297
|
+
/* @__PURE__ */ t(
|
|
4298
|
+
Z,
|
|
4299
|
+
{
|
|
4300
|
+
size: "sm",
|
|
4301
|
+
intent: "ghost",
|
|
4302
|
+
"data-component-part": "selection-ai-format",
|
|
4303
|
+
onMouseDown: zt,
|
|
4304
|
+
icon: /* @__PURE__ */ t(Vr, {}),
|
|
4305
|
+
...mn(
|
|
4306
|
+
$("editor.ai.autoFormat"),
|
|
4307
|
+
!!$e
|
|
4308
|
+
),
|
|
4309
|
+
onClick: () => Lt(
|
|
4310
|
+
"format",
|
|
4311
|
+
le,
|
|
4312
|
+
rt("selection")
|
|
4313
|
+
)
|
|
4314
|
+
}
|
|
4315
|
+
),
|
|
4316
|
+
$e
|
|
4317
|
+
) : null,
|
|
4318
|
+
qr ? yt(
|
|
4319
|
+
/* @__PURE__ */ t(
|
|
4320
|
+
Z,
|
|
4321
|
+
{
|
|
4322
|
+
size: "sm",
|
|
4323
|
+
intent: "ghost",
|
|
4324
|
+
"data-component-part": "selection-ai-write",
|
|
4325
|
+
onMouseDown: zt,
|
|
4326
|
+
icon: /* @__PURE__ */ t(Gr, {}),
|
|
4327
|
+
...mn(
|
|
4328
|
+
$("editor.ai.helpMeWrite"),
|
|
4329
|
+
!!$e
|
|
4330
|
+
),
|
|
4331
|
+
onClick: () => xr("selection")
|
|
4332
|
+
}
|
|
4333
|
+
),
|
|
4334
|
+
$e
|
|
4335
|
+
) : null
|
|
4336
|
+
] }) : null
|
|
4337
|
+
}
|
|
4338
|
+
) : null,
|
|
4339
|
+
dt ? /* @__PURE__ */ t(
|
|
4340
|
+
"div",
|
|
4341
|
+
{
|
|
4342
|
+
className: Qs,
|
|
4343
|
+
style: {
|
|
4344
|
+
"--rte-typeahead-x": `${dt.left}px`,
|
|
4345
|
+
"--rte-typeahead-y": `${dt.top}px`
|
|
4346
|
+
},
|
|
4347
|
+
children: /* @__PURE__ */ t(
|
|
4348
|
+
lo,
|
|
4349
|
+
{
|
|
4350
|
+
ref: ur,
|
|
4351
|
+
id: Sn,
|
|
4352
|
+
variables: cr,
|
|
4353
|
+
recentTokens: te,
|
|
4354
|
+
query: dt.query,
|
|
4355
|
+
onQueryChange: Io,
|
|
4356
|
+
onSelect: Lo,
|
|
4357
|
+
onClose: _o,
|
|
4358
|
+
searchFocusable: !1,
|
|
4359
|
+
onActiveDescendantChange: zo
|
|
4360
|
+
}
|
|
4361
|
+
)
|
|
4362
|
+
}
|
|
4363
|
+
) : null
|
|
4364
|
+
] }),
|
|
4365
|
+
Q ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Go }) : null,
|
|
4366
|
+
ct.length > 0 ? /* @__PURE__ */ t(
|
|
4367
|
+
"p",
|
|
4368
|
+
{
|
|
4369
|
+
id: `${Me}-variables-error`,
|
|
4370
|
+
role: "alert",
|
|
4371
|
+
className: "ds:m-0 ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
|
|
4372
|
+
children: $("editor.variableInvalid", {
|
|
4373
|
+
tokens: ct.map((e) => `[[${e}]]`).join(", ")
|
|
4374
|
+
})
|
|
4375
|
+
}
|
|
4376
|
+
) : null,
|
|
4377
|
+
Q && jo ? /* @__PURE__ */ t(
|
|
4378
|
+
"p",
|
|
4379
|
+
{
|
|
4380
|
+
role: "alert",
|
|
4381
|
+
className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
|
|
4382
|
+
children: $("editor.ai.dictationError")
|
|
4383
|
+
}
|
|
4384
|
+
) : null,
|
|
4385
|
+
J || oe || le ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Uo }) : null,
|
|
4386
|
+
Xo || Ar ? /* @__PURE__ */ t(
|
|
4387
|
+
"p",
|
|
4388
|
+
{
|
|
4389
|
+
role: "alert",
|
|
4390
|
+
className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
|
|
4391
|
+
children: $(Ar ? "editor.ai.actionStale" : "editor.ai.actionError")
|
|
4392
|
+
}
|
|
4393
|
+
) : null
|
|
4394
|
+
]
|
|
4395
|
+
}
|
|
4396
|
+
);
|
|
4397
|
+
}
|
|
4398
|
+
);
|
|
4399
|
+
nl.displayName = "RichTextEditor";
|
|
4400
|
+
export {
|
|
4401
|
+
nl as R,
|
|
4402
|
+
Ja as r,
|
|
4403
|
+
Zs as w
|
|
4404
|
+
};
|
|
4405
|
+
//# sourceMappingURL=rich-text-editor-eGdYDPK2.js.map
|