monto-email-builder 1.4.2 → 1.4.4
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/App/InspectorDrawer/ConfigurationPanel/input-panels/TextSidebarPanel.d.ts.map +1 -1
- package/dist/HtmlEditor/index.d.ts.map +1 -1
- package/dist/chunks/{chunk-ZMWDxWGX.js → chunk-CT9uNEVC.js} +60 -54
- package/dist/documents/blocks/Text/variableCatalog.d.ts +2 -0
- package/dist/documents/blocks/Text/variableCatalog.d.ts.map +1 -1
- package/dist/html-editor.js +437 -425
- package/dist/index.js +1601 -1591
- package/package.json +1 -1
package/dist/html-editor.js
CHANGED
|
@@ -1,385 +1,394 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import { html as
|
|
5
|
-
import { xcodeDark as
|
|
1
|
+
import { jsx as r, jsxs as x, Fragment as Nt } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ut, useState as V, useRef as $, useEffect as G, useCallback as L, useMemo as J, useImperativeHandle as Ot } from "react";
|
|
3
|
+
import Pt from "@uiw/react-codemirror";
|
|
4
|
+
import { html as _t } from "@codemirror/lang-html";
|
|
5
|
+
import { xcodeDark as Wt, tomorrowNightBlue as jt, dracula as mt, basicDark as Gt, abcdef as qt, bbedit as Ut, noctisLilac as Yt, gruvboxLight as Kt, tokyoNightDay as Xt, vscodeLight as Jt, xcodeLight as Qt } from "@uiw/codemirror-themes-all";
|
|
6
6
|
import Q from "@mui/material/ToggleButton";
|
|
7
7
|
import et from "@mui/material/ToggleButtonGroup";
|
|
8
|
-
import { ThemeProvider as
|
|
9
|
-
import { alpha as
|
|
10
|
-
import * as
|
|
11
|
-
import * as
|
|
12
|
-
import * as
|
|
13
|
-
import * as
|
|
14
|
-
import * as
|
|
15
|
-
import * as
|
|
16
|
-
import * as
|
|
17
|
-
import * as
|
|
18
|
-
import * as
|
|
19
|
-
import { B as
|
|
20
|
-
const
|
|
21
|
-
function
|
|
22
|
-
return a
|
|
8
|
+
import { ThemeProvider as Zt, ScopedCssBaseline as er, useTheme as tr, Box as h, Tooltip as q, FormControl as rr, InputLabel as or, Select as nr, ListSubheader as tt, MenuItem as rt, Button as Ie, Tabs as ar, Tab as ot, Typography as k, Accordion as ir, AccordionSummary as lr, AccordionDetails as sr, TextField as Ee, Divider as cr } from "@mui/material";
|
|
9
|
+
import { alpha as de } from "@mui/material/styles";
|
|
10
|
+
import * as dr from "@mui/icons-material/AddOutlined";
|
|
11
|
+
import * as ur from "@mui/icons-material/Code";
|
|
12
|
+
import * as mr from "@mui/icons-material/DataObjectOutlined";
|
|
13
|
+
import * as hr from "@mui/icons-material/ExpandMoreOutlined";
|
|
14
|
+
import * as br from "@mui/icons-material/HelpOutlined";
|
|
15
|
+
import * as pr from "@mui/icons-material/Visibility";
|
|
16
|
+
import * as fr from "@mui/icons-material/ViewColumn";
|
|
17
|
+
import * as xr from "@mui/icons-material/MonitorOutlined";
|
|
18
|
+
import * as gr from "@mui/icons-material/PhoneIphoneOutlined";
|
|
19
|
+
import { B as vr, V as F, r as B, T as yr, a as nt, t as Ir } from "./chunks/chunk-CT9uNEVC.js";
|
|
20
|
+
const Ve = vr, at = "unsubscribe_link", Te = /\{\{\s*([^{}]+?)\s*\}\}/g, it = /\{%\s*([^{}%]+?)\s*%\}/g;
|
|
21
|
+
function Ce(n, a, s, u, d) {
|
|
22
|
+
return n[a - 1] !== u && n[s] !== d;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function ht(n, a = "user") {
|
|
25
|
+
return a === "builtin" || a === "system" ? `{%${n}%}` : `{{${n}}}`;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const s =
|
|
31
|
-
if (
|
|
27
|
+
function Er(n) {
|
|
28
|
+
const a = typeof n == "string" ? n.trim() : "";
|
|
29
|
+
if (a.startsWith("{{") && a.endsWith("}}")) {
|
|
30
|
+
const s = a.slice(2, -2).trim();
|
|
31
|
+
if (F.test(s)) return { attribute: s, type: "user" };
|
|
32
32
|
}
|
|
33
|
-
if (
|
|
34
|
-
const s =
|
|
35
|
-
if (
|
|
33
|
+
if (a.startsWith("{%") && a.endsWith("%}")) {
|
|
34
|
+
const s = a.slice(2, -2).trim();
|
|
35
|
+
if (F.test(s)) return { attribute: s, type: "system" };
|
|
36
36
|
}
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
const s =
|
|
41
|
-
return !
|
|
42
|
-
id: Number(
|
|
43
|
-
variableInstanceId:
|
|
44
|
-
variable:
|
|
45
|
-
type:
|
|
46
|
-
attribute:
|
|
47
|
-
default: String(
|
|
39
|
+
function Vr(n, a) {
|
|
40
|
+
const s = n.variable ?? n.Variable ?? n.key ?? "", u = Er(s), g = (n.type ?? n.Type ?? (u == null ? void 0 : u.type) ?? "user") === "system" ? "system" : "user", i = n.attribute ?? n.Attribute ?? (u == null ? void 0 : u.attribute) ?? "", m = String(i).trim();
|
|
41
|
+
return !m || !F.test(m) ? null : {
|
|
42
|
+
id: Number(n.id) || a + 1,
|
|
43
|
+
variableInstanceId: n.variableInstanceId ?? n.VariableInstanceId,
|
|
44
|
+
variable: g === "system" ? `{%${m}%}` : `{{${m}}}`,
|
|
45
|
+
type: g,
|
|
46
|
+
attribute: m,
|
|
47
|
+
default: String(n.default ?? n.Default ?? n.value ?? "")
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
return Array.isArray(
|
|
52
|
-
...
|
|
50
|
+
function lt(n) {
|
|
51
|
+
return Array.isArray(n) ? n.map((a, s) => Vr(a, s)).filter((a) => !!a).map((a, s) => ({
|
|
52
|
+
...a,
|
|
53
53
|
id: s + 1,
|
|
54
|
-
variableInstanceId:
|
|
54
|
+
variableInstanceId: a.variableInstanceId || He(a.type, a.attribute, s)
|
|
55
55
|
})) : [];
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
s.push({ attribute: i, type:
|
|
57
|
+
function Z(n) {
|
|
58
|
+
const a = n || "", s = [], u = (i, m, f) => {
|
|
59
|
+
s.push({ attribute: i, type: m, start: f });
|
|
60
60
|
};
|
|
61
|
-
let
|
|
62
|
-
for (
|
|
63
|
-
const i =
|
|
64
|
-
if (!
|
|
65
|
-
const
|
|
66
|
-
!
|
|
61
|
+
let d;
|
|
62
|
+
for (Te.lastIndex = 0; d = Te.exec(a); ) {
|
|
63
|
+
const i = d.index, m = i + d[0].length;
|
|
64
|
+
if (!Ce(a, i, m, "{", "}")) continue;
|
|
65
|
+
const f = d[1].trim();
|
|
66
|
+
!f || !F.test(f) || u(f, "user", i);
|
|
67
67
|
}
|
|
68
|
-
let
|
|
69
|
-
for (
|
|
70
|
-
const i =
|
|
71
|
-
if (!
|
|
72
|
-
const
|
|
73
|
-
!
|
|
68
|
+
let g;
|
|
69
|
+
for (it.lastIndex = 0; g = it.exec(a); ) {
|
|
70
|
+
const i = g.index, m = i + g[0].length;
|
|
71
|
+
if (!Ce(a, i, m, "{", "}")) continue;
|
|
72
|
+
const f = g[1].trim();
|
|
73
|
+
!f || !F.test(f) || u(f, "system", i);
|
|
74
74
|
}
|
|
75
|
-
return s.sort((i,
|
|
76
|
-
id:
|
|
77
|
-
variableInstanceId:
|
|
75
|
+
return s.sort((i, m) => i.start - m.start), s.map((i, m) => ({
|
|
76
|
+
id: m + 1,
|
|
77
|
+
variableInstanceId: Hr(i.type, i.attribute, i.start),
|
|
78
78
|
variable: i.type === "system" ? `{%${i.attribute}%}` : `{{${i.attribute}}}`,
|
|
79
79
|
type: i.type,
|
|
80
80
|
attribute: i.attribute,
|
|
81
81
|
default: ""
|
|
82
82
|
}));
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
const s = /* @__PURE__ */ new Map(),
|
|
86
|
-
return
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
|
|
84
|
+
function ue(n, a) {
|
|
85
|
+
const s = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
|
|
86
|
+
return a.forEach((d) => {
|
|
87
|
+
const g = { item: d, consumed: !1 };
|
|
88
|
+
if (d.variableInstanceId) {
|
|
89
|
+
const f = s.get(d.variableInstanceId) ?? [];
|
|
90
|
+
f.push(g), s.set(d.variableInstanceId, f);
|
|
91
91
|
}
|
|
92
|
-
const i = `${
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
var
|
|
96
|
-
const i = `${
|
|
97
|
-
return
|
|
98
|
-
...
|
|
99
|
-
id:
|
|
100
|
-
variableInstanceId:
|
|
101
|
-
default:
|
|
92
|
+
const i = `${d.type}:${d.attribute}`, m = u.get(i) ?? [];
|
|
93
|
+
m.push(g), u.set(i, m);
|
|
94
|
+
}), n.map((d, g) => {
|
|
95
|
+
var z;
|
|
96
|
+
const i = `${d.type}:${d.attribute}`, m = d.variableInstanceId ? (z = s.get(d.variableInstanceId)) == null ? void 0 : z.find((v) => !v.consumed) : void 0, f = (u.get(i) ?? []).find((v) => !v.consumed), H = m ?? f;
|
|
97
|
+
return H && (H.consumed = !0), {
|
|
98
|
+
...d,
|
|
99
|
+
id: g + 1,
|
|
100
|
+
variableInstanceId: d.variableInstanceId || He(d.type, d.attribute, g),
|
|
101
|
+
default: d.type === "system" ? "" : (H == null ? void 0 : H.item.default) ?? d.default ?? ""
|
|
102
102
|
};
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
return
|
|
105
|
+
function Tr(n) {
|
|
106
|
+
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
const s = /* @__PURE__ */ new Map(),
|
|
110
|
-
|
|
111
|
-
i.type === "user" && (i.variableInstanceId && s.set(i.variableInstanceId, i.default ?? ""),
|
|
108
|
+
function st(n, a) {
|
|
109
|
+
const s = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
|
|
110
|
+
a.forEach((i) => {
|
|
111
|
+
i.type === "user" && (i.variableInstanceId && s.set(i.variableInstanceId, i.default ?? ""), u.has(i.attribute) || u.set(i.attribute, i.default ?? ""));
|
|
112
112
|
});
|
|
113
|
-
const
|
|
114
|
-
return
|
|
115
|
-
const
|
|
116
|
-
Number.isFinite(
|
|
117
|
-
}), (
|
|
118
|
-
var
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
121
|
-
const
|
|
122
|
-
if (!
|
|
123
|
-
const
|
|
124
|
-
return
|
|
113
|
+
const d = Z(n), g = /* @__PURE__ */ new Map();
|
|
114
|
+
return d.forEach((i) => {
|
|
115
|
+
const m = Number(String(i.variableInstanceId ?? "").split("-at-")[1]);
|
|
116
|
+
Number.isFinite(m) && g.set(m, i);
|
|
117
|
+
}), (n || "").replace(Te, (i, m, f, H) => {
|
|
118
|
+
var ee;
|
|
119
|
+
const z = f + i.length;
|
|
120
|
+
if (!Ce(H, f, z, "{", "}")) return i;
|
|
121
|
+
const v = String(m).trim();
|
|
122
|
+
if (!v || !F.test(v)) return i;
|
|
123
|
+
const R = (ee = g.get(f)) == null ? void 0 : ee.variableInstanceId, N = (R ? s.get(R) : void 0) ?? (a.filter((l) => l.type === "user" && l.attribute === v).length === 1 ? u.get(v) : void 0);
|
|
124
|
+
return N === void 0 || N === "" ? i : Tr(N);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
const
|
|
129
|
-
if (!
|
|
130
|
-
const
|
|
127
|
+
function ct(n, a, s = "") {
|
|
128
|
+
const u = n.trim();
|
|
129
|
+
if (!u || !F.test(u)) return null;
|
|
130
|
+
const d = a === "builtin" ? "system" : "user";
|
|
131
131
|
return {
|
|
132
132
|
id: 1,
|
|
133
|
-
variableInstanceId:
|
|
134
|
-
variable:
|
|
135
|
-
type:
|
|
136
|
-
attribute:
|
|
137
|
-
default:
|
|
133
|
+
variableInstanceId: He(d, u, 0),
|
|
134
|
+
variable: ht(u, a),
|
|
135
|
+
type: d,
|
|
136
|
+
attribute: u,
|
|
137
|
+
default: d === "system" ? "" : s
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
142
|
-
return
|
|
140
|
+
function Cr(n) {
|
|
141
|
+
const a = n.trim();
|
|
142
|
+
return a ? Ve.some((s) => s.items.some((u) => u.name === a)) : !1;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
const s =
|
|
146
|
-
return
|
|
144
|
+
function wr(n, a) {
|
|
145
|
+
const s = n.trim();
|
|
146
|
+
return a === "user" && s === at ? `<a href="{{${at}}}">Unsubscribe Link</a>` : ht(s, a);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return `html-${
|
|
148
|
+
function He(n, a, s) {
|
|
149
|
+
return `html-${n}-${a}-${s + 1}`;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
return `html-${
|
|
151
|
+
function Hr(n, a, s) {
|
|
152
|
+
return `html-${n}-${a}-at-${s}`;
|
|
153
153
|
}
|
|
154
|
-
const
|
|
154
|
+
const Sr = B(dr), Dr = B(ur), Mr = B(mr), Lr = B(hr), kr = B(br), Br = B(pr), Ar = B(fr), Fr = B(xr), Rr = B(gr), we = {
|
|
155
155
|
// 浅色主题
|
|
156
|
-
xcodeLight:
|
|
157
|
-
vscodeLight:
|
|
158
|
-
tokyoNightDay:
|
|
159
|
-
gruvboxLight:
|
|
160
|
-
noctisLilac:
|
|
156
|
+
xcodeLight: Qt,
|
|
157
|
+
vscodeLight: Jt,
|
|
158
|
+
tokyoNightDay: Xt,
|
|
159
|
+
gruvboxLight: Kt,
|
|
160
|
+
noctisLilac: Yt,
|
|
161
161
|
bbedit: Ut,
|
|
162
162
|
// 深色主题
|
|
163
|
-
abcdef:
|
|
164
|
-
basicDark:
|
|
165
|
-
dracula:
|
|
166
|
-
tomorrowNightBlue:
|
|
167
|
-
xcodeDark:
|
|
168
|
-
},
|
|
163
|
+
abcdef: qt,
|
|
164
|
+
basicDark: Gt,
|
|
165
|
+
dracula: mt,
|
|
166
|
+
tomorrowNightBlue: jt,
|
|
167
|
+
xcodeDark: Wt
|
|
168
|
+
}, $r = {
|
|
169
169
|
xcodeLight: "Xcode Light (Light)",
|
|
170
170
|
vscodeLight: "VSCode Light (Light)",
|
|
171
171
|
tokyoNightDay: "Tokyo Night Day (Light)",
|
|
172
172
|
gruvboxLight: "Gruvbox Light (Light)",
|
|
173
173
|
noctisLilac: "Noctis Lilac (Light)",
|
|
174
174
|
bbedit: "BBEdit (Light)"
|
|
175
|
-
},
|
|
175
|
+
}, zr = {
|
|
176
176
|
abcdef: "ABCDEF (Dark)",
|
|
177
177
|
basicDark: "Basic Dark (Dark)",
|
|
178
178
|
dracula: "Dracula (Dark)",
|
|
179
179
|
tomorrowNightBlue: "Tomorrow Night Blue (Dark)",
|
|
180
180
|
xcodeDark: "Xcode Dark (Dark)"
|
|
181
|
-
},
|
|
182
|
-
function Nr(
|
|
183
|
-
const
|
|
184
|
-
if (typeof window > "u") return
|
|
181
|
+
}, bt = "html-editor-theme", dt = "dracula";
|
|
182
|
+
function Nr(n = dt) {
|
|
183
|
+
const a = n && we[n] ? n : dt;
|
|
184
|
+
if (typeof window > "u") return a;
|
|
185
185
|
try {
|
|
186
|
-
const s = localStorage.getItem(
|
|
187
|
-
if (s &&
|
|
186
|
+
const s = localStorage.getItem(bt);
|
|
187
|
+
if (s && we[s]) return s;
|
|
188
188
|
} catch {
|
|
189
189
|
console.error("Failed to get HTML Editor stored theme");
|
|
190
190
|
}
|
|
191
|
-
return
|
|
191
|
+
return a;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function Or(n) {
|
|
194
194
|
try {
|
|
195
|
-
localStorage.setItem(
|
|
195
|
+
localStorage.setItem(bt, n);
|
|
196
196
|
} catch {
|
|
197
|
-
console.error("Failed to set HTML Editor stored theme",
|
|
197
|
+
console.error("Failed to set HTML Editor stored theme", n);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
function
|
|
201
|
-
value:
|
|
202
|
-
onChange:
|
|
200
|
+
function Pr({
|
|
201
|
+
value: n,
|
|
202
|
+
onChange: a,
|
|
203
203
|
language: s = "zh",
|
|
204
|
-
initialMode:
|
|
205
|
-
initialDevice:
|
|
206
|
-
codeEditorHeight:
|
|
204
|
+
initialMode: u = "split",
|
|
205
|
+
initialDevice: d = "desktop",
|
|
206
|
+
codeEditorHeight: g = "100%",
|
|
207
207
|
previewHeight: i = "100%",
|
|
208
|
-
sx:
|
|
209
|
-
showToolbar:
|
|
210
|
-
initialTheme:
|
|
211
|
-
initialRightTab:
|
|
212
|
-
variables:
|
|
213
|
-
onVariablesChange:
|
|
214
|
-
requireVariableDefaults:
|
|
215
|
-
},
|
|
216
|
-
var Re, $e,
|
|
217
|
-
const l = (e, t) =>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}, [
|
|
221
|
-
if (
|
|
222
|
-
const e =
|
|
223
|
-
|
|
224
|
-
}, [
|
|
225
|
-
|
|
208
|
+
sx: m,
|
|
209
|
+
showToolbar: f = !0,
|
|
210
|
+
initialTheme: H,
|
|
211
|
+
initialRightTab: z = "preview",
|
|
212
|
+
variables: v,
|
|
213
|
+
onVariablesChange: R,
|
|
214
|
+
requireVariableDefaults: N = !0
|
|
215
|
+
}, ee) {
|
|
216
|
+
var Re, $e, ze, Ne, Oe, Pe, _e, We, je, Ge, qe, Ue, Ye, Ke, Xe, Je, Qe, Ze;
|
|
217
|
+
const l = (e, t) => Ir(e, t, s), [S, ft] = V(u), [O, xt] = V(d), [Se, gt] = V(() => Nr(H)), [E, me] = V(n), [te, P] = V(z), [w, he] = V(() => lt(v)), [vt, yt] = V(!1), [It, Et] = V(null), [_, De] = V(""), [W, Me] = V(""), [be, re] = V(!1), [pe, oe] = V(!1), U = $(null), fe = $(null), T = $(w), Le = $(null), ke = $(null), xe = $(!1), ne = $(null);
|
|
218
|
+
G(() => {
|
|
219
|
+
n !== E && me(n);
|
|
220
|
+
}, [n]), G(() => {
|
|
221
|
+
if (v === void 0) return;
|
|
222
|
+
const e = lt(v);
|
|
223
|
+
T.current = e, he(e);
|
|
224
|
+
}, [v]), G(() => {
|
|
225
|
+
if (v !== void 0) return;
|
|
226
|
+
const e = Z(E), t = ue(e, T.current);
|
|
227
|
+
(t.length !== T.current.length || t.some((c, y) => {
|
|
228
|
+
const b = T.current[y];
|
|
229
|
+
return !b || b.variableInstanceId !== c.variableInstanceId || b.attribute !== c.attribute || b.type !== c.type || b.default !== c.default;
|
|
230
|
+
})) && (T.current = t, he(t));
|
|
231
|
+
}, [E, v]);
|
|
232
|
+
const A = L(
|
|
226
233
|
(e) => {
|
|
227
|
-
const t = e.map((
|
|
228
|
-
...
|
|
229
|
-
id:
|
|
230
|
-
default:
|
|
234
|
+
const t = e.map((o, c) => ({
|
|
235
|
+
...o,
|
|
236
|
+
id: c + 1,
|
|
237
|
+
default: o.type === "system" ? "" : o.default ?? ""
|
|
231
238
|
}));
|
|
232
|
-
return
|
|
239
|
+
return T.current = t, he(t), R == null || R(t), t;
|
|
233
240
|
},
|
|
234
|
-
[
|
|
235
|
-
),
|
|
236
|
-
var t,
|
|
237
|
-
const e = (
|
|
238
|
-
return e && typeof e.toString == "function" ? e.toString() :
|
|
239
|
-
}, [
|
|
240
|
-
|
|
241
|
-
|
|
241
|
+
[R]
|
|
242
|
+
), D = L(() => {
|
|
243
|
+
var t, o;
|
|
244
|
+
const e = (o = (t = fe.current) == null ? void 0 : t.state) == null ? void 0 : o.doc;
|
|
245
|
+
return e && typeof e.toString == "function" ? e.toString() : E;
|
|
246
|
+
}, [E]), ge = (e) => {
|
|
247
|
+
me(e), U.current && clearTimeout(U.current), U.current = setTimeout(() => {
|
|
248
|
+
a == null || a(e);
|
|
242
249
|
}, 300);
|
|
243
|
-
},
|
|
250
|
+
}, Y = L(
|
|
244
251
|
(e) => {
|
|
245
|
-
const t =
|
|
246
|
-
return
|
|
252
|
+
const t = Z(e ?? D()), o = ue(t, T.current);
|
|
253
|
+
return A(o);
|
|
247
254
|
},
|
|
248
|
-
[
|
|
249
|
-
), ae =
|
|
250
|
-
const e =
|
|
251
|
-
e !==
|
|
252
|
-
const t =
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
[D, A]
|
|
256
|
+
), ae = L(() => {
|
|
257
|
+
const e = D();
|
|
258
|
+
e !== E && me(e);
|
|
259
|
+
const t = Y(e), o = N ? t.filter(
|
|
260
|
+
(c) => c.type === "user" && nt(c.attribute, "user") && c.default.trim() === ""
|
|
261
|
+
) : [];
|
|
262
|
+
return yt(o.length > 0), o.length > 0 && P("variables"), {
|
|
263
|
+
valid: o.length === 0,
|
|
255
264
|
variables: t,
|
|
256
|
-
missing:
|
|
265
|
+
missing: o
|
|
257
266
|
};
|
|
258
|
-
}, [
|
|
259
|
-
|
|
267
|
+
}, [D, E, N, Y]), Vt = L(() => {
|
|
268
|
+
xe.current = !0, ae(), P("variables");
|
|
260
269
|
}, [ae]);
|
|
261
|
-
|
|
262
|
-
if (
|
|
270
|
+
G(() => {
|
|
271
|
+
if (te !== "variables" || !xe.current) return;
|
|
263
272
|
const e = window.requestAnimationFrame(() => {
|
|
264
|
-
const t = Le.current,
|
|
265
|
-
t &&
|
|
266
|
-
top: Math.max(
|
|
273
|
+
const t = Le.current, o = ke.current;
|
|
274
|
+
t && o && t.scrollTo({
|
|
275
|
+
top: Math.max(o.offsetTop - 8, 0),
|
|
267
276
|
behavior: "auto"
|
|
268
|
-
}),
|
|
277
|
+
}), xe.current = !1;
|
|
269
278
|
});
|
|
270
279
|
return () => window.cancelAnimationFrame(e);
|
|
271
|
-
}, [
|
|
280
|
+
}, [te, w.length]), G(() => () => {
|
|
272
281
|
U.current && clearTimeout(U.current);
|
|
273
282
|
}, []);
|
|
274
|
-
const
|
|
275
|
-
var
|
|
283
|
+
const Tt = (e) => {
|
|
284
|
+
var p, I, K;
|
|
276
285
|
const t = e || "";
|
|
277
|
-
let
|
|
286
|
+
let o = t;
|
|
278
287
|
if (!t.trim())
|
|
279
|
-
|
|
288
|
+
o = "<!DOCTYPE html><html><head></head><body></body></html>";
|
|
280
289
|
else {
|
|
281
|
-
const M = new DOMParser().parseFromString(t, "text/html"),
|
|
282
|
-
if (!
|
|
283
|
-
const
|
|
284
|
-
|
|
290
|
+
const M = new DOMParser().parseFromString(t, "text/html"), ye = ((p = M.documentElement) == null ? void 0 : p.tagName.toLowerCase()) === "html", Rt = ((I = M.head) == null ? void 0 : I.tagName.toLowerCase()) === "head", $t = ((K = M.body) == null ? void 0 : K.tagName.toLowerCase()) === "body";
|
|
291
|
+
if (!ye || !Rt || !$t) {
|
|
292
|
+
const zt = M.body ? M.body.innerHTML : t;
|
|
293
|
+
o = `<!DOCTYPE html><html><head>${M.head ? M.head.innerHTML : ""}</head><body>${zt}</body></html>`;
|
|
285
294
|
} else
|
|
286
|
-
|
|
295
|
+
o = `<!DOCTYPE html>${M.documentElement.outerHTML}`;
|
|
287
296
|
}
|
|
288
|
-
const
|
|
289
|
-
return
|
|
290
|
-
b.querySelectorAll(
|
|
291
|
-
}),
|
|
297
|
+
const c = ["script", "iframe", "object", "embed", "canvas"], b = new DOMParser().parseFromString(o, "text/html");
|
|
298
|
+
return c.forEach((X) => {
|
|
299
|
+
b.querySelectorAll(X).forEach((ye) => ye.remove());
|
|
300
|
+
}), o = `<!DOCTYPE html>${b.documentElement.outerHTML}`, o;
|
|
292
301
|
}, Be = J(
|
|
293
|
-
() =>
|
|
294
|
-
[
|
|
295
|
-
),
|
|
296
|
-
|
|
297
|
-
|
|
302
|
+
() => st(E, w),
|
|
303
|
+
[w, E]
|
|
304
|
+
), ie = J(() => Tt(Be), [Be]);
|
|
305
|
+
Ot(
|
|
306
|
+
ee,
|
|
298
307
|
() => ({
|
|
299
|
-
getValue: () =>
|
|
300
|
-
getPreviewHtml: () =>
|
|
301
|
-
scanVariables: () =>
|
|
308
|
+
getValue: () => D(),
|
|
309
|
+
getPreviewHtml: () => st(D(), T.current),
|
|
310
|
+
scanVariables: () => Y(D()),
|
|
302
311
|
getVariables: (e) => {
|
|
303
|
-
const t =
|
|
312
|
+
const t = Y(D());
|
|
304
313
|
return e == null || e(t), t;
|
|
305
314
|
},
|
|
306
315
|
validateVariables: ae,
|
|
307
316
|
showVariables: () => P("variables")
|
|
308
317
|
}),
|
|
309
|
-
[
|
|
310
|
-
),
|
|
311
|
-
|
|
312
|
-
}, [
|
|
313
|
-
const
|
|
314
|
-
t !== null &&
|
|
315
|
-
},
|
|
316
|
-
(t === "desktop" || t === "mobile") &&
|
|
317
|
-
},
|
|
318
|
+
[D, Y, ae]
|
|
319
|
+
), G(() => {
|
|
320
|
+
ne.current && ne.current.srcdoc !== ie && (ne.current.srcdoc = ie);
|
|
321
|
+
}, [ie]);
|
|
322
|
+
const Ct = (e, t) => {
|
|
323
|
+
t !== null && ft(t);
|
|
324
|
+
}, wt = (e, t) => {
|
|
325
|
+
(t === "desktop" || t === "mobile") && xt(t);
|
|
326
|
+
}, le = L(
|
|
318
327
|
(e) => {
|
|
319
|
-
var
|
|
320
|
-
const t =
|
|
328
|
+
var c, y;
|
|
329
|
+
const t = fe.current;
|
|
321
330
|
if (t != null && t.state && (t != null && t.dispatch)) {
|
|
322
|
-
const b = (
|
|
331
|
+
const b = (c = t.state.selection) == null ? void 0 : c.main, p = t.state.doc.toString(), I = (b == null ? void 0 : b.from) ?? t.state.doc.length, K = (b == null ? void 0 : b.to) ?? I, X = `${p.slice(0, I)}${e}${p.slice(K)}`;
|
|
323
332
|
return t.dispatch({
|
|
324
|
-
changes: { from: I, to:
|
|
333
|
+
changes: { from: I, to: K, insert: e },
|
|
325
334
|
selection: { anchor: I + e.length }
|
|
326
|
-
}), (
|
|
335
|
+
}), (y = t.focus) == null || y.call(t), ge(X), X;
|
|
327
336
|
}
|
|
328
|
-
const
|
|
329
|
-
return
|
|
337
|
+
const o = `${E}${e}`;
|
|
338
|
+
return ge(o), o;
|
|
330
339
|
},
|
|
331
|
-
[
|
|
332
|
-
),
|
|
340
|
+
[E]
|
|
341
|
+
), Ht = L(
|
|
333
342
|
(e, t) => {
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
(
|
|
343
|
+
const o = T.current;
|
|
344
|
+
A(
|
|
345
|
+
o.map(
|
|
346
|
+
(c) => c.variableInstanceId === e ? { ...c, default: t } : c
|
|
338
347
|
)
|
|
339
348
|
);
|
|
340
349
|
},
|
|
341
|
-
[
|
|
342
|
-
),
|
|
350
|
+
[A]
|
|
351
|
+
), St = L(
|
|
343
352
|
(e, t) => {
|
|
344
|
-
if (!
|
|
345
|
-
const
|
|
346
|
-
|
|
353
|
+
if (!ct(e, t)) return;
|
|
354
|
+
const c = le(wr(e, t)), y = Z(c), b = ue(y, T.current);
|
|
355
|
+
A(b), P("variables");
|
|
347
356
|
},
|
|
348
|
-
[
|
|
349
|
-
),
|
|
357
|
+
[le, A]
|
|
358
|
+
), se = J(() => {
|
|
350
359
|
const e = _.trim();
|
|
351
|
-
return e ?
|
|
352
|
-
}, [_,
|
|
360
|
+
return e ? F.test(e) ? Cr(e) || w.some((t) => t.type === "user" && t.attribute === e) ? l("text.variables.customVariableNameDuplicate") : "" : l("text.variables.customVariableNameInvalid") : l("text.variables.customVariableNameRequired");
|
|
361
|
+
}, [_, w]), Dt = L(() => {
|
|
353
362
|
const e = W.trim();
|
|
354
|
-
if (
|
|
355
|
-
const t =
|
|
363
|
+
if (re(!0), oe(!0), se || e === "") return;
|
|
364
|
+
const t = ct(_.trim(), "user", e);
|
|
356
365
|
if (!t) return;
|
|
357
|
-
const
|
|
366
|
+
const o = le(t.variable), c = Z(o), y = ue(c, T.current);
|
|
358
367
|
let b = -1;
|
|
359
|
-
for (let
|
|
360
|
-
const I =
|
|
368
|
+
for (let p = y.length - 1; p >= 0; p -= 1) {
|
|
369
|
+
const I = y[p];
|
|
361
370
|
if (I.type === t.type && I.attribute === t.attribute && I.default === "") {
|
|
362
|
-
b =
|
|
371
|
+
b = p;
|
|
363
372
|
break;
|
|
364
373
|
}
|
|
365
374
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
(
|
|
375
|
+
A(
|
|
376
|
+
y.map(
|
|
377
|
+
(p, I) => I === b ? { ...p, default: t.default } : p
|
|
369
378
|
)
|
|
370
|
-
),
|
|
371
|
-
}, [W, _,
|
|
379
|
+
), De(""), Me(""), re(!1), oe(!1), P("variables");
|
|
380
|
+
}, [W, _, se, le, A]), Mt = J(() => {
|
|
372
381
|
const e = /* @__PURE__ */ new Set();
|
|
373
|
-
return [{ id: "custom", items:
|
|
374
|
-
name:
|
|
375
|
-
labelKey:
|
|
382
|
+
return [{ id: "custom", items: w.filter((o) => o.type === "user").filter((o) => !Ve.some((c) => c.items.some((y) => y.name === o.attribute))).filter((o) => e.has(o.attribute) ? !1 : (e.add(o.attribute), !0)).map((o) => ({
|
|
383
|
+
name: o.attribute,
|
|
384
|
+
labelKey: o.attribute,
|
|
376
385
|
kind: "user"
|
|
377
|
-
})) }, ...
|
|
378
|
-
}, [
|
|
379
|
-
() =>
|
|
380
|
-
[
|
|
381
|
-
),
|
|
382
|
-
($e = (Re =
|
|
386
|
+
})) }, ...Ve];
|
|
387
|
+
}, [w]), ce = J(
|
|
388
|
+
() => w.filter((e) => e.type !== "system"),
|
|
389
|
+
[w]
|
|
390
|
+
), Lt = (e) => e === "custom" ? "text.variables.groupCustom" : e === "contacts" ? "text.variables.groupContacts" : e === "email" ? "text.variables.groupEmail" : e === "organization" ? "text.variables.groupOrganization" : e === "date" ? "text.variables.groupDate" : "text.variables.groupLinks", C = tr(), kt = O === "desktop" || O === "mobile" ? O : "desktop", Bt = S === "split" || S === "code" || S === "preview" ? S : "split";
|
|
391
|
+
($e = (Re = C.palette) == null ? void 0 : Re.action) == null || $e.selected, (Ne = (ze = C.palette) == null ? void 0 : ze.primary) == null || Ne.main, (Pe = (Oe = C.palette) == null ? void 0 : Oe.action) == null || Pe.selected, (We = (_e = C.palette) == null ? void 0 : _e.background) == null || We.paper, (Ge = (je = C.palette) == null ? void 0 : je.text) == null || Ge.primary, (Ue = (qe = C.palette) == null ? void 0 : qe.action) == null || Ue.hover;
|
|
383
392
|
const j = {
|
|
384
393
|
tooltip: {
|
|
385
394
|
sx: {
|
|
@@ -387,14 +396,14 @@ function Or({
|
|
|
387
396
|
fontWeight: 400,
|
|
388
397
|
lineHeight: 1.45,
|
|
389
398
|
maxWidth: 360,
|
|
390
|
-
backgroundColor:
|
|
391
|
-
color: ((Je = (Xe =
|
|
399
|
+
backgroundColor: de(((Ke = (Ye = C.palette) == null ? void 0 : Ye.text) == null ? void 0 : Ke.primary) ?? "#1F1F21", 0.9),
|
|
400
|
+
color: ((Je = (Xe = C.palette) == null ? void 0 : Xe.common) == null ? void 0 : Je.white) ?? "#fff"
|
|
392
401
|
}
|
|
393
402
|
},
|
|
394
403
|
arrow: {
|
|
395
|
-
sx: { color:
|
|
404
|
+
sx: { color: de(((Ze = (Qe = C.palette) == null ? void 0 : Qe.text) == null ? void 0 : Ze.primary) ?? "#1F1F21", 0.9) }
|
|
396
405
|
}
|
|
397
|
-
},
|
|
406
|
+
}, ve = {
|
|
398
407
|
component: "div",
|
|
399
408
|
sx: {
|
|
400
409
|
mt: 0.5,
|
|
@@ -402,21 +411,21 @@ function Or({
|
|
|
402
411
|
minHeight: 18,
|
|
403
412
|
lineHeight: 1.5
|
|
404
413
|
}
|
|
405
|
-
}, Ae = () => /* @__PURE__ */
|
|
406
|
-
|
|
414
|
+
}, Ae = () => /* @__PURE__ */ x(
|
|
415
|
+
h,
|
|
407
416
|
{
|
|
408
417
|
sx: {
|
|
409
|
-
height:
|
|
418
|
+
height: g,
|
|
410
419
|
minHeight: 0,
|
|
411
420
|
display: "flex",
|
|
412
421
|
flexDirection: "column",
|
|
413
422
|
position: "relative",
|
|
414
|
-
borderRight:
|
|
423
|
+
borderRight: S === "split" ? "1px solid" : "none",
|
|
415
424
|
borderColor: "divider"
|
|
416
425
|
},
|
|
417
426
|
children: [
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
|
|
427
|
+
/* @__PURE__ */ r(
|
|
428
|
+
h,
|
|
420
429
|
{
|
|
421
430
|
sx: {
|
|
422
431
|
flex: 1,
|
|
@@ -446,16 +455,16 @@ function Or({
|
|
|
446
455
|
opacity: 1
|
|
447
456
|
}
|
|
448
457
|
},
|
|
449
|
-
children: /* @__PURE__ */
|
|
450
|
-
|
|
458
|
+
children: /* @__PURE__ */ r(
|
|
459
|
+
Pt,
|
|
451
460
|
{
|
|
452
|
-
value:
|
|
461
|
+
value: E,
|
|
453
462
|
height: "100%",
|
|
454
|
-
extensions: [
|
|
455
|
-
theme:
|
|
456
|
-
onChange:
|
|
463
|
+
extensions: [_t()],
|
|
464
|
+
theme: we[Se] || mt,
|
|
465
|
+
onChange: ge,
|
|
457
466
|
onCreateEditor: (e) => {
|
|
458
|
-
|
|
467
|
+
fe.current = e;
|
|
459
468
|
},
|
|
460
469
|
basicSetup: {
|
|
461
470
|
lineNumbers: !0,
|
|
@@ -467,13 +476,13 @@ function Or({
|
|
|
467
476
|
)
|
|
468
477
|
}
|
|
469
478
|
),
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
|
|
479
|
+
/* @__PURE__ */ r(
|
|
480
|
+
Ie,
|
|
472
481
|
{
|
|
473
482
|
size: "small",
|
|
474
483
|
variant: "contained",
|
|
475
|
-
startIcon: /* @__PURE__ */
|
|
476
|
-
onClick:
|
|
484
|
+
startIcon: /* @__PURE__ */ r(Mr, { fontSize: "small" }),
|
|
485
|
+
onClick: Vt,
|
|
477
486
|
sx: {
|
|
478
487
|
position: "absolute",
|
|
479
488
|
right: 16,
|
|
@@ -487,15 +496,15 @@ function Or({
|
|
|
487
496
|
)
|
|
488
497
|
]
|
|
489
498
|
}
|
|
490
|
-
),
|
|
499
|
+
), At = () => /* @__PURE__ */ r(h, { sx: {
|
|
491
500
|
height: i,
|
|
492
501
|
overflow: "auto",
|
|
493
502
|
backgroundColor: "#F5F5F5",
|
|
494
503
|
padding: O === "mobile" ? "32px 16px" : "16px",
|
|
495
504
|
display: "flex",
|
|
496
505
|
justifyContent: "center"
|
|
497
|
-
}, children: /* @__PURE__ */
|
|
498
|
-
|
|
506
|
+
}, children: /* @__PURE__ */ r(
|
|
507
|
+
h,
|
|
499
508
|
{
|
|
500
509
|
sx: {
|
|
501
510
|
width: "100%",
|
|
@@ -504,11 +513,11 @@ function Or({
|
|
|
504
513
|
border: "none",
|
|
505
514
|
overflow: "hidden"
|
|
506
515
|
},
|
|
507
|
-
children: /* @__PURE__ */
|
|
516
|
+
children: /* @__PURE__ */ r(
|
|
508
517
|
"iframe",
|
|
509
518
|
{
|
|
510
|
-
ref:
|
|
511
|
-
srcDoc:
|
|
519
|
+
ref: ne,
|
|
520
|
+
srcDoc: ie,
|
|
512
521
|
style: {
|
|
513
522
|
width: "100%",
|
|
514
523
|
height: "100%",
|
|
@@ -520,8 +529,8 @@ function Or({
|
|
|
520
529
|
}
|
|
521
530
|
)
|
|
522
531
|
}
|
|
523
|
-
) }),
|
|
524
|
-
|
|
532
|
+
) }), Ft = () => /* @__PURE__ */ x(
|
|
533
|
+
h,
|
|
525
534
|
{
|
|
526
535
|
ref: Le,
|
|
527
536
|
sx: {
|
|
@@ -535,23 +544,23 @@ function Or({
|
|
|
535
544
|
pb: 6
|
|
536
545
|
},
|
|
537
546
|
children: [
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ r(h, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1, mb: 1.5 }, children: /* @__PURE__ */ x(h, { sx: { minWidth: 0 }, children: [
|
|
548
|
+
/* @__PURE__ */ x(h, { sx: { display: "flex", alignItems: "center", gap: 0.75 }, children: [
|
|
549
|
+
/* @__PURE__ */ r(k, { variant: "subtitle1", sx: { fontWeight: 700 }, children: l("htmlEditor.variables.title") }),
|
|
550
|
+
/* @__PURE__ */ r(q, { title: l("htmlEditor.variables.help"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(h, { component: "span", sx: { display: "inline-flex", color: "text.secondary", cursor: "help" }, children: /* @__PURE__ */ r(kr, { fontSize: "small" }) }) })
|
|
542
551
|
] }),
|
|
543
|
-
/* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.secondary", children: l("htmlEditor.variables.scanHint") })
|
|
544
553
|
] }) }),
|
|
545
|
-
/* @__PURE__ */
|
|
546
|
-
const t =
|
|
547
|
-
return /* @__PURE__ */
|
|
548
|
-
|
|
554
|
+
/* @__PURE__ */ r(h, { sx: { mb: 2 }, children: Mt.map((e) => {
|
|
555
|
+
const t = It === e.id;
|
|
556
|
+
return /* @__PURE__ */ x(
|
|
557
|
+
ir,
|
|
549
558
|
{
|
|
550
559
|
disableGutters: !0,
|
|
551
560
|
square: !0,
|
|
552
561
|
elevation: 0,
|
|
553
562
|
expanded: t,
|
|
554
|
-
onChange: (
|
|
563
|
+
onChange: (o, c) => Et(c ? e.id : null),
|
|
555
564
|
sx: {
|
|
556
565
|
"&:before": { display: "none" },
|
|
557
566
|
border: 1,
|
|
@@ -561,66 +570,66 @@ function Or({
|
|
|
561
570
|
mb: 1
|
|
562
571
|
},
|
|
563
572
|
children: [
|
|
564
|
-
/* @__PURE__ */
|
|
565
|
-
|
|
573
|
+
/* @__PURE__ */ r(
|
|
574
|
+
lr,
|
|
566
575
|
{
|
|
567
|
-
expandIcon: /* @__PURE__ */
|
|
576
|
+
expandIcon: /* @__PURE__ */ r(Lr, { fontSize: "small" }),
|
|
568
577
|
sx: {
|
|
569
578
|
minHeight: 44,
|
|
570
579
|
"& .MuiAccordionSummary-content": { my: 1 }
|
|
571
580
|
},
|
|
572
|
-
children: /* @__PURE__ */
|
|
581
|
+
children: /* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.primary", children: l(Lt(e.id)) })
|
|
573
582
|
}
|
|
574
583
|
),
|
|
575
|
-
/* @__PURE__ */
|
|
576
|
-
e.id === "custom" && /* @__PURE__ */
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
|
|
584
|
+
/* @__PURE__ */ x(sr, { sx: { pt: 0, pb: 1.25 }, children: [
|
|
585
|
+
e.id === "custom" && /* @__PURE__ */ x(h, { sx: { mb: 1 }, children: [
|
|
586
|
+
/* @__PURE__ */ r(
|
|
587
|
+
Ee,
|
|
579
588
|
{
|
|
580
589
|
size: "small",
|
|
581
590
|
fullWidth: !0,
|
|
582
591
|
label: l("text.variables.customVariableName"),
|
|
583
592
|
value: _,
|
|
584
593
|
placeholder: "e.g. order_id",
|
|
585
|
-
onChange: (
|
|
586
|
-
|
|
594
|
+
onChange: (o) => {
|
|
595
|
+
De(o.target.value), !be && o.target.value.trim() !== "" && re(!0);
|
|
587
596
|
},
|
|
588
597
|
onBlur: () => {
|
|
589
|
-
_.trim() !== "" &&
|
|
598
|
+
_.trim() !== "" && re(!0);
|
|
590
599
|
},
|
|
591
|
-
error:
|
|
592
|
-
helperText:
|
|
593
|
-
FormHelperTextProps:
|
|
600
|
+
error: be && !!se,
|
|
601
|
+
helperText: be && se || " ",
|
|
602
|
+
FormHelperTextProps: ve,
|
|
594
603
|
sx: { mb: 1 }
|
|
595
604
|
}
|
|
596
605
|
),
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
-
|
|
606
|
+
/* @__PURE__ */ r(
|
|
607
|
+
Ee,
|
|
599
608
|
{
|
|
600
609
|
size: "small",
|
|
601
610
|
fullWidth: !0,
|
|
602
611
|
label: l("text.variables.defaultValueLabel"),
|
|
603
612
|
value: W,
|
|
604
613
|
placeholder: l("text.variables.defaultPlaceholder"),
|
|
605
|
-
onChange: (
|
|
606
|
-
|
|
614
|
+
onChange: (o) => {
|
|
615
|
+
Me(o.target.value), !pe && o.target.value.trim() !== "" && oe(!0);
|
|
607
616
|
},
|
|
608
617
|
onBlur: () => {
|
|
609
|
-
W.trim() !== "" &&
|
|
618
|
+
W.trim() !== "" && oe(!0);
|
|
610
619
|
},
|
|
611
|
-
error:
|
|
612
|
-
helperText:
|
|
613
|
-
FormHelperTextProps:
|
|
620
|
+
error: pe && W.trim() === "",
|
|
621
|
+
helperText: pe && W.trim() === "" ? l("text.variables.defaultRequired") : " ",
|
|
622
|
+
FormHelperTextProps: ve
|
|
614
623
|
}
|
|
615
624
|
),
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
|
|
625
|
+
/* @__PURE__ */ r(
|
|
626
|
+
Ie,
|
|
618
627
|
{
|
|
619
628
|
fullWidth: !0,
|
|
620
629
|
size: "small",
|
|
621
630
|
variant: "outlined",
|
|
622
|
-
startIcon: /* @__PURE__ */
|
|
623
|
-
onClick:
|
|
631
|
+
startIcon: /* @__PURE__ */ r(Sr, { fontSize: "small" }),
|
|
632
|
+
onClick: Dt,
|
|
624
633
|
sx: {
|
|
625
634
|
justifyContent: "center",
|
|
626
635
|
borderColor: "divider",
|
|
@@ -632,33 +641,33 @@ function Or({
|
|
|
632
641
|
}
|
|
633
642
|
)
|
|
634
643
|
] }),
|
|
635
|
-
e.items.length > 0 && /* @__PURE__ */
|
|
636
|
-
|
|
644
|
+
e.items.length > 0 && /* @__PURE__ */ r(h, { sx: { display: "grid", gap: 0.75 }, children: e.items.map((o) => /* @__PURE__ */ r(
|
|
645
|
+
Ie,
|
|
637
646
|
{
|
|
638
647
|
size: "small",
|
|
639
648
|
variant: "outlined",
|
|
640
|
-
onClick: () =>
|
|
649
|
+
onClick: () => St(o.name, o.kind),
|
|
641
650
|
sx: {
|
|
642
651
|
justifyContent: "flex-start",
|
|
643
652
|
borderColor: "divider",
|
|
644
653
|
color: "text.secondary",
|
|
645
654
|
textTransform: "none"
|
|
646
655
|
},
|
|
647
|
-
children: /* @__PURE__ */
|
|
648
|
-
/* @__PURE__ */
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
|
|
656
|
+
children: /* @__PURE__ */ x(h, { sx: { textAlign: "left", minWidth: 0 }, children: [
|
|
657
|
+
/* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.primary", children: e.id === "custom" ? o.name : l(o.labelKey) }),
|
|
658
|
+
/* @__PURE__ */ r(
|
|
659
|
+
k,
|
|
651
660
|
{
|
|
652
661
|
component: "div",
|
|
653
662
|
variant: "caption",
|
|
654
663
|
color: "text.secondary",
|
|
655
664
|
sx: { fontFamily: "monospace" },
|
|
656
|
-
children:
|
|
665
|
+
children: o.kind === "builtin" ? `{%${o.name}%}` : `{{${o.name}}}`
|
|
657
666
|
}
|
|
658
667
|
)
|
|
659
668
|
] })
|
|
660
669
|
},
|
|
661
|
-
`${e.id}:${
|
|
670
|
+
`${e.id}:${o.name}`
|
|
662
671
|
)) })
|
|
663
672
|
] })
|
|
664
673
|
]
|
|
@@ -666,11 +675,11 @@ function Or({
|
|
|
666
675
|
e.id
|
|
667
676
|
);
|
|
668
677
|
}) }),
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
|
|
673
|
-
|
|
678
|
+
/* @__PURE__ */ r(cr, { sx: { my: 2 } }),
|
|
679
|
+
/* @__PURE__ */ r(k, { component: "div", ref: ke, variant: "subtitle2", sx: { mb: 0.5 }, children: l("htmlEditor.variables.detected") }),
|
|
680
|
+
/* @__PURE__ */ r(k, { component: "div", variant: "caption", color: "text.secondary", sx: { display: "block", mb: 1 }, children: l("htmlEditor.variables.defaultHelp") }),
|
|
681
|
+
ce.length === 0 ? /* @__PURE__ */ r(
|
|
682
|
+
h,
|
|
674
683
|
{
|
|
675
684
|
sx: {
|
|
676
685
|
border: "1px dashed",
|
|
@@ -683,32 +692,32 @@ function Or({
|
|
|
683
692
|
},
|
|
684
693
|
children: l("htmlEditor.variables.empty")
|
|
685
694
|
}
|
|
686
|
-
) : /* @__PURE__ */
|
|
687
|
-
const
|
|
688
|
-
return /* @__PURE__ */
|
|
689
|
-
|
|
695
|
+
) : /* @__PURE__ */ r(h, { sx: { display: "grid", gap: 0.75 }, children: ce.map((e, t) => {
|
|
696
|
+
const o = e.type === "user" && nt(e.attribute, "user"), c = vt && o && e.default.trim() === "", y = ce.filter((p) => p.type === e.type && p.attribute === e.attribute).length, b = ce.slice(0, t + 1).filter((p) => p.type === e.type && p.attribute === e.attribute).length;
|
|
697
|
+
return /* @__PURE__ */ x(
|
|
698
|
+
h,
|
|
690
699
|
{
|
|
691
700
|
sx: {
|
|
692
701
|
display: "grid",
|
|
693
702
|
gridTemplateColumns: { xs: "1fr", sm: "minmax(150px, 42%) 1fr" },
|
|
694
|
-
alignItems:
|
|
703
|
+
alignItems: c ? "flex-start" : "center",
|
|
695
704
|
gap: 1,
|
|
696
705
|
px: 1,
|
|
697
706
|
py: 0.75,
|
|
698
707
|
border: "1px solid",
|
|
699
|
-
borderColor:
|
|
708
|
+
borderColor: c ? "error.main" : "transparent",
|
|
700
709
|
borderRadius: 1,
|
|
701
|
-
borderBottomColor:
|
|
702
|
-
backgroundColor:
|
|
710
|
+
borderBottomColor: c ? "error.main" : "divider",
|
|
711
|
+
backgroundColor: c ? de(C.palette.error.main, 0.04) : "transparent",
|
|
703
712
|
transition: "background-color 120ms ease, border-color 120ms ease",
|
|
704
713
|
"&:hover": {
|
|
705
|
-
backgroundColor:
|
|
706
|
-
borderColor:
|
|
714
|
+
backgroundColor: c ? de(C.palette.error.main, 0.04) : "action.hover",
|
|
715
|
+
borderColor: c ? "error.main" : "divider"
|
|
707
716
|
}
|
|
708
717
|
},
|
|
709
718
|
children: [
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
|
|
719
|
+
/* @__PURE__ */ r(
|
|
720
|
+
k,
|
|
712
721
|
{
|
|
713
722
|
component: "div",
|
|
714
723
|
variant: "body2",
|
|
@@ -717,32 +726,35 @@ function Or({
|
|
|
717
726
|
fontSize: 13,
|
|
718
727
|
lineHeight: 1.35,
|
|
719
728
|
wordBreak: "break-all",
|
|
720
|
-
color:
|
|
729
|
+
color: c ? "error.main" : "text.primary"
|
|
721
730
|
},
|
|
722
|
-
children:
|
|
731
|
+
children: y > 1 ? `${e.variable} (${b})` : e.variable
|
|
723
732
|
}
|
|
724
733
|
),
|
|
725
|
-
/* @__PURE__ */
|
|
726
|
-
|
|
734
|
+
o ? /* @__PURE__ */ r(
|
|
735
|
+
Ee,
|
|
727
736
|
{
|
|
728
737
|
size: "small",
|
|
729
738
|
fullWidth: !0,
|
|
730
|
-
disabled: e.type === "system",
|
|
731
739
|
value: e.default,
|
|
732
|
-
label:
|
|
733
|
-
placeholder:
|
|
734
|
-
error:
|
|
735
|
-
helperText:
|
|
736
|
-
FormHelperTextProps:
|
|
737
|
-
onChange: (
|
|
740
|
+
label: c ? l("text.variables.defaultValueLabel") : void 0,
|
|
741
|
+
placeholder: l("text.variables.defaultPlaceholder"),
|
|
742
|
+
error: c,
|
|
743
|
+
helperText: c ? l("text.variables.defaultRequired") : " ",
|
|
744
|
+
FormHelperTextProps: ve,
|
|
745
|
+
onChange: (p) => Ht(e.variableInstanceId, p.target.value),
|
|
738
746
|
sx: {
|
|
747
|
+
"& .MuiOutlinedInput-root": {
|
|
748
|
+
minHeight: 40,
|
|
749
|
+
alignItems: "center"
|
|
750
|
+
},
|
|
739
751
|
"& .MuiInputBase-input": {
|
|
740
|
-
py:
|
|
752
|
+
py: 1.25,
|
|
741
753
|
fontSize: 13
|
|
742
754
|
}
|
|
743
755
|
}
|
|
744
756
|
}
|
|
745
|
-
)
|
|
757
|
+
) : /* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.secondary", sx: { fontSize: 13 }, children: l("htmlEditor.variables.systemDefault") })
|
|
746
758
|
]
|
|
747
759
|
},
|
|
748
760
|
e.variableInstanceId || `${e.type}:${e.attribute}:${e.id}`
|
|
@@ -750,11 +762,11 @@ function Or({
|
|
|
750
762
|
}) })
|
|
751
763
|
]
|
|
752
764
|
}
|
|
753
|
-
), Fe = () => /* @__PURE__ */
|
|
754
|
-
/* @__PURE__ */
|
|
765
|
+
), Fe = () => /* @__PURE__ */ x(h, { sx: { height: i, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
|
|
766
|
+
/* @__PURE__ */ x(
|
|
755
767
|
ar,
|
|
756
768
|
{
|
|
757
|
-
value:
|
|
769
|
+
value: te,
|
|
758
770
|
onChange: (e, t) => P(t),
|
|
759
771
|
sx: {
|
|
760
772
|
minHeight: 40,
|
|
@@ -767,15 +779,15 @@ function Or({
|
|
|
767
779
|
}
|
|
768
780
|
},
|
|
769
781
|
children: [
|
|
770
|
-
/* @__PURE__ */
|
|
771
|
-
/* @__PURE__ */
|
|
782
|
+
/* @__PURE__ */ r(ot, { value: "preview", label: l("htmlEditor.tabs.preview") }),
|
|
783
|
+
/* @__PURE__ */ r(ot, { value: "variables", label: l("htmlEditor.tabs.variables") })
|
|
772
784
|
]
|
|
773
785
|
}
|
|
774
786
|
),
|
|
775
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ r(h, { sx: { flex: 1, minHeight: 0, overflow: "hidden", display: "flex", flexDirection: "column" }, children: te === "preview" ? At() : Ft() })
|
|
776
788
|
] });
|
|
777
|
-
return /* @__PURE__ */
|
|
778
|
-
|
|
789
|
+
return /* @__PURE__ */ x(
|
|
790
|
+
h,
|
|
779
791
|
{
|
|
780
792
|
sx: {
|
|
781
793
|
display: "flex",
|
|
@@ -784,11 +796,11 @@ function Or({
|
|
|
784
796
|
width: "100%",
|
|
785
797
|
minHeight: 0,
|
|
786
798
|
minWidth: 0,
|
|
787
|
-
...
|
|
799
|
+
...m
|
|
788
800
|
},
|
|
789
801
|
children: [
|
|
790
|
-
|
|
791
|
-
|
|
802
|
+
f && /* @__PURE__ */ x(
|
|
803
|
+
h,
|
|
792
804
|
{
|
|
793
805
|
sx: {
|
|
794
806
|
display: "flex",
|
|
@@ -800,55 +812,55 @@ function Or({
|
|
|
800
812
|
backgroundColor: "background.paper"
|
|
801
813
|
},
|
|
802
814
|
children: [
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
/* @__PURE__ */
|
|
815
|
+
/* @__PURE__ */ x(h, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
816
|
+
/* @__PURE__ */ x(
|
|
805
817
|
et,
|
|
806
818
|
{
|
|
807
|
-
value:
|
|
819
|
+
value: Bt,
|
|
808
820
|
exclusive: !0,
|
|
809
|
-
onChange:
|
|
821
|
+
onChange: Ct,
|
|
810
822
|
size: "small",
|
|
811
823
|
"aria-label": l("htmlEditor.mode.split"),
|
|
812
824
|
children: [
|
|
813
|
-
/* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ r(q, { title: l("htmlEditor.tooltips.splitView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
|
|
814
826
|
Q,
|
|
815
827
|
{
|
|
816
828
|
value: "split",
|
|
817
829
|
"aria-label": l("htmlEditor.mode.split"),
|
|
818
|
-
children: /* @__PURE__ */
|
|
830
|
+
children: /* @__PURE__ */ r(Ar, { fontSize: "small" })
|
|
819
831
|
}
|
|
820
832
|
) }),
|
|
821
|
-
/* @__PURE__ */
|
|
833
|
+
/* @__PURE__ */ r(q, { title: l("htmlEditor.tooltips.codeOnly"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
|
|
822
834
|
Q,
|
|
823
835
|
{
|
|
824
836
|
value: "code",
|
|
825
837
|
"aria-label": l("htmlEditor.mode.code"),
|
|
826
|
-
children: /* @__PURE__ */
|
|
838
|
+
children: /* @__PURE__ */ r(Dr, { fontSize: "small" })
|
|
827
839
|
}
|
|
828
840
|
) }),
|
|
829
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ r(q, { title: l("htmlEditor.tooltips.previewOnly"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
|
|
830
842
|
Q,
|
|
831
843
|
{
|
|
832
844
|
value: "preview",
|
|
833
845
|
"aria-label": l("htmlEditor.mode.preview"),
|
|
834
|
-
children: /* @__PURE__ */
|
|
846
|
+
children: /* @__PURE__ */ r(Br, { fontSize: "small" })
|
|
835
847
|
}
|
|
836
848
|
) })
|
|
837
849
|
]
|
|
838
850
|
}
|
|
839
851
|
),
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
/* @__PURE__ */
|
|
842
|
-
/* @__PURE__ */
|
|
843
|
-
|
|
852
|
+
/* @__PURE__ */ x(rr, { size: "small", sx: { minWidth: 140 }, children: [
|
|
853
|
+
/* @__PURE__ */ r(or, { id: "theme-select-label", children: l("htmlEditor.theme") }),
|
|
854
|
+
/* @__PURE__ */ x(
|
|
855
|
+
nr,
|
|
844
856
|
{
|
|
845
857
|
labelId: "theme-select-label",
|
|
846
858
|
id: "theme-select",
|
|
847
|
-
value:
|
|
859
|
+
value: Se,
|
|
848
860
|
label: l("htmlEditor.theme"),
|
|
849
861
|
onChange: (e) => {
|
|
850
862
|
const t = e.target.value;
|
|
851
|
-
|
|
863
|
+
gt(t), Or(t);
|
|
852
864
|
},
|
|
853
865
|
sx: {
|
|
854
866
|
// fontSize: '0.875rem',
|
|
@@ -857,38 +869,38 @@ function Or({
|
|
|
857
869
|
}
|
|
858
870
|
},
|
|
859
871
|
children: [
|
|
860
|
-
/* @__PURE__ */
|
|
861
|
-
Object.entries(
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
-
Object.entries(
|
|
872
|
+
/* @__PURE__ */ r(tt, { children: l("htmlEditor.lightThemes") }),
|
|
873
|
+
Object.entries($r).map(([e, t]) => /* @__PURE__ */ r(rt, { value: e, children: t }, e)),
|
|
874
|
+
/* @__PURE__ */ r(tt, { children: l("htmlEditor.darkThemes") }),
|
|
875
|
+
Object.entries(zr).map(([e, t]) => /* @__PURE__ */ r(rt, { value: e, children: t }, e))
|
|
864
876
|
]
|
|
865
877
|
}
|
|
866
878
|
)
|
|
867
879
|
] })
|
|
868
880
|
] }),
|
|
869
|
-
/* @__PURE__ */
|
|
881
|
+
/* @__PURE__ */ r(h, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: S !== "code" && /* @__PURE__ */ x(
|
|
870
882
|
et,
|
|
871
883
|
{
|
|
872
|
-
value:
|
|
884
|
+
value: kt,
|
|
873
885
|
exclusive: !0,
|
|
874
|
-
onChange:
|
|
886
|
+
onChange: wt,
|
|
875
887
|
size: "small",
|
|
876
888
|
"aria-label": l("htmlEditor.device.desktop"),
|
|
877
889
|
children: [
|
|
878
|
-
/* @__PURE__ */
|
|
890
|
+
/* @__PURE__ */ r(q, { title: l("htmlEditor.tooltips.desktopView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
|
|
879
891
|
Q,
|
|
880
892
|
{
|
|
881
893
|
value: "desktop",
|
|
882
894
|
"aria-label": l("htmlEditor.device.desktop"),
|
|
883
|
-
children: /* @__PURE__ */
|
|
895
|
+
children: /* @__PURE__ */ r(Fr, { fontSize: "small" })
|
|
884
896
|
}
|
|
885
897
|
) }),
|
|
886
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ r(q, { title: l("htmlEditor.tooltips.mobileView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
|
|
887
899
|
Q,
|
|
888
900
|
{
|
|
889
901
|
value: "mobile",
|
|
890
902
|
"aria-label": l("htmlEditor.device.mobile"),
|
|
891
|
-
children: /* @__PURE__ */
|
|
903
|
+
children: /* @__PURE__ */ r(Rr, { fontSize: "small" })
|
|
892
904
|
}
|
|
893
905
|
) })
|
|
894
906
|
]
|
|
@@ -897,8 +909,8 @@ function Or({
|
|
|
897
909
|
]
|
|
898
910
|
}
|
|
899
911
|
),
|
|
900
|
-
/* @__PURE__ */
|
|
901
|
-
|
|
912
|
+
/* @__PURE__ */ x(
|
|
913
|
+
h,
|
|
902
914
|
{
|
|
903
915
|
sx: {
|
|
904
916
|
flex: 1,
|
|
@@ -908,12 +920,12 @@ function Or({
|
|
|
908
920
|
overflow: "hidden"
|
|
909
921
|
},
|
|
910
922
|
children: [
|
|
911
|
-
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
/* @__PURE__ */
|
|
923
|
+
S === "split" && /* @__PURE__ */ x(Nt, { children: [
|
|
924
|
+
/* @__PURE__ */ r(h, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Ae() }),
|
|
925
|
+
/* @__PURE__ */ r(h, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Fe() })
|
|
914
926
|
] }),
|
|
915
|
-
|
|
916
|
-
|
|
927
|
+
S === "code" && /* @__PURE__ */ r(h, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Ae() }),
|
|
928
|
+
S === "preview" && /* @__PURE__ */ r(h, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Fe() })
|
|
917
929
|
]
|
|
918
930
|
}
|
|
919
931
|
)
|
|
@@ -921,10 +933,10 @@ function Or({
|
|
|
921
933
|
}
|
|
922
934
|
);
|
|
923
935
|
}
|
|
924
|
-
const
|
|
925
|
-
|
|
926
|
-
const
|
|
927
|
-
|
|
936
|
+
const pt = ut(Pr);
|
|
937
|
+
pt.displayName = "HtmlEditorContent";
|
|
938
|
+
const _r = ut((n, a) => /* @__PURE__ */ r(Zt, { theme: yr, children: /* @__PURE__ */ r(
|
|
939
|
+
er,
|
|
928
940
|
{
|
|
929
941
|
sx: {
|
|
930
942
|
height: "100%",
|
|
@@ -934,11 +946,11 @@ const Pr = dt((a, n) => /* @__PURE__ */ o(Qt, { theme: vr, children: /* @__PURE_
|
|
|
934
946
|
display: "flex",
|
|
935
947
|
flexDirection: "column"
|
|
936
948
|
},
|
|
937
|
-
children: /* @__PURE__ */
|
|
949
|
+
children: /* @__PURE__ */ r(pt, { ref: a, ...n })
|
|
938
950
|
}
|
|
939
951
|
) }));
|
|
940
|
-
|
|
952
|
+
_r.displayName = "HtmlEditor";
|
|
941
953
|
export {
|
|
942
|
-
|
|
943
|
-
|
|
954
|
+
_r as HtmlEditor,
|
|
955
|
+
_r as default
|
|
944
956
|
};
|