monto-email-builder 1.4.5 → 1.4.7

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