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