monto-email-builder 1.4.6 → 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 +1 @@
1
- {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/HtmlEditor/variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,0CAA0C,CAAC;AAElD,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvD,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,sBAAsB,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,GAAG;IACtE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,sBAAsB,EAAE,CAAC;IACpC,OAAO,EAAE,sBAAsB,EAAE,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,aAAa,EAAyB,CAAC;AACjF,eAAO,MAAM,qCAAqC,qBAAqB,CAAC;AAKxE,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAWvE;AAUD,wBAA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7C,sBAAsB,EAAE,CAuC1B;AAWD,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,aAAa,CAAC,sBAAsB,CAAC,GAC/C,MAAM,CAoCR;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,SAAK,GAAG,sBAAsB,GAAG,IAAI,CAY3H;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKrE;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAOxF"}
@@ -1,9 +1,9 @@
1
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 J, useImperativeHandle as Pt } from "react";
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
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 Q from "@mui/material/ToggleButton";
6
+ import Z from "@mui/material/ToggleButton";
7
7
  import rt from "@mui/material/ToggleButtonGroup";
8
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
9
  import { alpha as ue } from "@mui/material/styles";
@@ -17,17 +17,17 @@ import * as xr from "@mui/icons-material/ViewColumn";
17
17
  import * as gr from "@mui/icons-material/MonitorOutlined";
18
18
  import * as vr from "@mui/icons-material/PhoneIphoneOutlined";
19
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, ee = "unsubscribe_link", he = /\{\{\s*([^{}]+?)\s*\}\}/g, lt = /\{%\s*([^{}%]+?)\s*%\}/g;
20
+ const Ce = yr, U = "unsubscribe_link", he = /\{\{\s*([^{}]+?)\s*\}\}/g, lt = /\{%\s*([^{}%]+?)\s*%\}/g;
21
21
  function He(o) {
22
- return (o || "").replace(he, (l, u, d, g) => {
23
- const i = d + l.length;
24
- if (!be(g, d, i, "{", "}")) return l;
22
+ return (o || "").replace(he, (l, u, c, g) => {
23
+ const i = c + l.length;
24
+ if (!be(g, c, i, "{", "}")) return l;
25
25
  const m = String(u).trim();
26
- return !m || !A.test(m) || m !== ee ? l : `{%${m}%}`;
26
+ return !m || !A.test(m) || m !== U ? l : `{%${m}%}`;
27
27
  });
28
28
  }
29
- function be(o, a, l, u, d) {
30
- return o[a - 1] !== u && o[l] !== d;
29
+ function be(o, a, l, u, c) {
30
+ return o[a - 1] !== u && o[l] !== c;
31
31
  }
32
32
  function bt(o, a = "user") {
33
33
  return a === "builtin" || a === "system" ? `{%${o}%}` : `{{${o}}}`;
@@ -39,7 +39,7 @@ function Vr(o) {
39
39
  if (A.test(l))
40
40
  return {
41
41
  attribute: l,
42
- type: l === ee ? "system" : "user"
42
+ type: l === U ? "system" : "user"
43
43
  };
44
44
  }
45
45
  if (a.startsWith("{%") && a.endsWith("%}")) {
@@ -49,7 +49,7 @@ function Vr(o) {
49
49
  return null;
50
50
  }
51
51
  function Tr(o, a) {
52
- const l = o.variable ?? o.Variable ?? o.key ?? "", u = Vr(l), d = String(o.attribute ?? o.Attribute ?? (u == null ? void 0 : u.attribute) ?? "").trim(), i = (o.type ?? o.Type ?? (u == null ? void 0 : u.type) ?? (d === ee ? "system" : "user")) === "system" ? "system" : "user", m = o.attribute ?? o.Attribute ?? (u == null ? void 0 : u.attribute) ?? "", b = String(m).trim();
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
53
  return !b || !A.test(b) ? null : {
54
54
  id: Number(o.id) || a + 1,
55
55
  variableInstanceId: o.variableInstanceId ?? o.VariableInstanceId,
@@ -66,15 +66,15 @@ function st(o) {
66
66
  variableInstanceId: a.variableInstanceId || De(a.type, a.attribute, l)
67
67
  })) : [];
68
68
  }
69
- function Z(o) {
69
+ function ee(o) {
70
70
  const a = o || "", l = [], u = (i, m, b) => {
71
71
  l.push({ attribute: i, type: m, start: b });
72
72
  };
73
- let d;
74
- for (he.lastIndex = 0; d = he.exec(a); ) {
75
- const i = d.index, m = i + d[0].length;
73
+ let c;
74
+ for (he.lastIndex = 0; c = he.exec(a); ) {
75
+ const i = c.index, m = i + c[0].length;
76
76
  if (!be(a, i, m, "{", "}")) continue;
77
- const b = d[1].trim();
77
+ const b = c[1].trim();
78
78
  !b || !A.test(b) || u(b, "user", i);
79
79
  }
80
80
  let g;
@@ -95,22 +95,22 @@ function Z(o) {
95
95
  }
96
96
  function me(o, a) {
97
97
  const l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
98
- return a.forEach((d) => {
99
- const g = { item: d, consumed: !1 };
100
- if (d.variableInstanceId) {
101
- const b = l.get(d.variableInstanceId) ?? [];
102
- b.push(g), l.set(d.variableInstanceId, b);
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);
103
103
  }
104
- const i = `${d.type}:${d.attribute}`, m = u.get(i) ?? [];
104
+ const i = `${c.type}:${c.attribute}`, m = u.get(i) ?? [];
105
105
  m.push(g), u.set(i, m);
106
- }), o.map((d, g) => {
106
+ }), o.map((c, g) => {
107
107
  var R;
108
- const i = `${d.type}:${d.attribute}`, m = d.variableInstanceId ? (R = l.get(d.variableInstanceId)) == null ? void 0 : R.find((v) => !v.consumed) : void 0, b = (u.get(i) ?? []).find((v) => !v.consumed), C = m ?? b;
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
109
  return C && (C.consumed = !0), {
110
- ...d,
110
+ ...c,
111
111
  id: g + 1,
112
- variableInstanceId: d.variableInstanceId || De(d.type, d.attribute, g),
113
- default: d.type === "system" ? "" : (C == null ? void 0 : C.item.default) ?? d.default ?? ""
112
+ variableInstanceId: c.variableInstanceId || De(c.type, c.attribute, g),
113
+ default: c.type === "system" ? "" : (C == null ? void 0 : C.item.default) ?? c.default ?? ""
114
114
  };
115
115
  });
116
116
  }
@@ -122,8 +122,8 @@ function ct(o, a) {
122
122
  a.forEach((i) => {
123
123
  i.type === "user" && (i.variableInstanceId && l.set(i.variableInstanceId, i.default ?? ""), u.has(i.attribute) || u.set(i.attribute, i.default ?? ""));
124
124
  });
125
- const d = Z(o), g = /* @__PURE__ */ new Map();
126
- return d.forEach((i) => {
125
+ const c = ee(o), g = /* @__PURE__ */ new Map();
126
+ return c.forEach((i) => {
127
127
  const m = Number(String(i.variableInstanceId ?? "").split("-at-")[1]);
128
128
  Number.isFinite(m) && g.set(m, i);
129
129
  }), (o || "").replace(he, (i, m, b, C) => {
@@ -139,14 +139,14 @@ function ct(o, a) {
139
139
  function dt(o, a, l = "") {
140
140
  const u = o.trim();
141
141
  if (!u || !A.test(u)) return null;
142
- const d = a === "builtin" ? "system" : "user";
142
+ const c = a === "builtin" ? "system" : "user";
143
143
  return {
144
144
  id: 1,
145
- variableInstanceId: De(d, u, 0),
145
+ variableInstanceId: De(c, u, 0),
146
146
  variable: bt(u, a),
147
- type: d,
147
+ type: c,
148
148
  attribute: u,
149
- default: d === "system" ? "" : l
149
+ default: c === "system" ? "" : l
150
150
  };
151
151
  }
152
152
  function Hr(o) {
@@ -155,7 +155,7 @@ function Hr(o) {
155
155
  }
156
156
  function Cr(o, a) {
157
157
  const l = o.trim();
158
- return a === "builtin" && l === ee ? `<a href="{%${ee}%}">Unsubscribe Link</a>` : bt(l, a);
158
+ return a === "builtin" && l === U ? `<a href="{%${U}%}">Unsubscribe Link</a>` : bt(l, a);
159
159
  }
160
160
  function De(o, a, l) {
161
161
  return `html-${o}-${a}-${l + 1}`;
@@ -214,7 +214,7 @@ function _r({
214
214
  onChange: a,
215
215
  language: l = "zh",
216
216
  initialMode: u = "split",
217
- initialDevice: d = "desktop",
217
+ initialDevice: c = "desktop",
218
218
  codeEditorHeight: g = "100%",
219
219
  previewHeight: i = "100%",
220
220
  sx: m,
@@ -226,7 +226,7 @@ function _r({
226
226
  requireVariableDefaults: N = !0
227
227
  }, te) {
228
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(d), [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), U = $(null), ve = $(null), T = $(H), Ae = $(null), Be = $(null), ye = $(!1), ae = $(null);
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);
230
230
  G(() => {
231
231
  const e = He(o);
232
232
  e !== I && (pe(e), a == null || a(e));
@@ -236,17 +236,17 @@ function _r({
236
236
  T.current = e, fe(e);
237
237
  }, [v]), G(() => {
238
238
  if (v !== void 0) return;
239
- const e = Z(I), t = me(e, T.current);
240
- (t.length !== T.current.length || t.some((c, y) => {
239
+ const e = ee(I), t = me(e, T.current);
240
+ (t.length !== T.current.length || t.some((d, y) => {
241
241
  const p = T.current[y];
242
- return !p || p.variableInstanceId !== c.variableInstanceId || p.attribute !== c.attribute || p.type !== c.type || p.default !== c.default;
242
+ return !p || p.variableInstanceId !== d.variableInstanceId || p.attribute !== d.attribute || p.type !== d.type || p.default !== d.default;
243
243
  })) && (T.current = t, fe(t));
244
244
  }, [I, v]);
245
245
  const F = L(
246
246
  (e) => {
247
- const t = e.map((n, c) => ({
247
+ const t = e.map((n, d) => ({
248
248
  ...n,
249
- id: c + 1,
249
+ id: d + 1,
250
250
  default: n.type === "system" ? "" : n.default ?? ""
251
251
  }));
252
252
  return T.current = t, fe(t), z == null || z(t), t;
@@ -258,27 +258,27 @@ function _r({
258
258
  return e && typeof e.toString == "function" ? e.toString() : I;
259
259
  }, [I]), Ie = (e) => {
260
260
  const t = He(e);
261
- pe(t), U.current && clearTimeout(U.current), U.current = setTimeout(() => {
261
+ pe(t), Y.current && clearTimeout(Y.current), Y.current = setTimeout(() => {
262
262
  a == null || a(t);
263
263
  }, 300);
264
- }, Y = L(
264
+ }, K = L(
265
265
  (e) => {
266
- const t = Z(e ?? D()), n = me(t, T.current);
266
+ const t = ee(e ?? D()), n = me(t, T.current);
267
267
  return F(n);
268
268
  },
269
269
  [D, F]
270
270
  ), ie = L(() => {
271
271
  const e = D();
272
272
  e !== I && pe(e);
273
- const t = Y(e), n = N ? t.filter(
274
- (c) => c.type === "user" && it(c.attribute, "user") && c.default.trim() === ""
273
+ const t = K(e), n = N ? t.filter(
274
+ (d) => d.type === "user" && it(d.attribute, "user") && d.default.trim() === ""
275
275
  ) : [];
276
276
  return It(n.length > 0), n.length > 0 && P("variables"), {
277
277
  valid: n.length === 0,
278
278
  variables: t,
279
279
  missing: n
280
280
  };
281
- }, [D, I, N, Y]), Tt = L(() => {
281
+ }, [D, I, N, K]), Tt = L(() => {
282
282
  ye.current = !0, ie(), P("variables");
283
283
  }, [ie]);
284
284
  G(() => {
@@ -292,44 +292,44 @@ function _r({
292
292
  });
293
293
  return () => window.cancelAnimationFrame(e);
294
294
  }, [re, H.length]), G(() => () => {
295
- U.current && clearTimeout(U.current);
295
+ Y.current && clearTimeout(Y.current);
296
296
  }, []);
297
297
  const wt = (e) => {
298
- var f, E, K;
298
+ var f, E, X;
299
299
  const t = e || "";
300
300
  let n = t;
301
301
  if (!t.trim())
302
302
  n = "<!DOCTYPE html><html><head></head><body></body></html>";
303
303
  else {
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 = ((K = M.body) == null ? void 0 : K.tagName.toLowerCase()) === "body";
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
305
  if (!Ve || !$t || !Rt) {
306
306
  const Nt = M.body ? M.body.innerHTML : t;
307
307
  n = `<!DOCTYPE html><html><head>${M.head ? M.head.innerHTML : ""}</head><body>${Nt}</body></html>`;
308
308
  } else
309
309
  n = `<!DOCTYPE html>${M.documentElement.outerHTML}`;
310
310
  }
311
- const c = ["script", "iframe", "object", "embed", "canvas"], p = new DOMParser().parseFromString(n, "text/html");
312
- return c.forEach((X) => {
313
- p.querySelectorAll(X).forEach((Ve) => Ve.remove());
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
314
  }), n = `<!DOCTYPE html>${p.documentElement.outerHTML}`, n;
315
- }, Fe = J(
315
+ }, Fe = Q(
316
316
  () => ct(I, H),
317
317
  [H, I]
318
- ), le = J(() => wt(Fe), [Fe]);
318
+ ), le = Q(() => wt(Fe), [Fe]);
319
319
  Pt(
320
320
  te,
321
321
  () => ({
322
322
  getValue: () => D(),
323
323
  getPreviewHtml: () => ct(D(), T.current),
324
- scanVariables: () => Y(D()),
324
+ scanVariables: () => K(D()),
325
325
  getVariables: (e) => {
326
- const t = Y(D());
326
+ const t = K(D());
327
327
  return e == null || e(t), t;
328
328
  },
329
329
  validateVariables: ie,
330
330
  showVariables: () => P("variables")
331
331
  }),
332
- [D, Y, ie]
332
+ [D, K, ie]
333
333
  ), G(() => {
334
334
  ae.current && ae.current.srcdoc !== le && (ae.current.srcdoc = le);
335
335
  }, [le]);
@@ -339,14 +339,14 @@ function _r({
339
339
  (t === "desktop" || t === "mobile") && gt(t);
340
340
  }, se = L(
341
341
  (e) => {
342
- var c, y;
342
+ var d, y;
343
343
  const t = ve.current;
344
344
  if (t != null && t.state && (t != null && t.dispatch)) {
345
- const p = (c = t.state.selection) == null ? void 0 : c.main, f = t.state.doc.toString(), E = (p == null ? void 0 : p.from) ?? t.state.doc.length, K = (p == null ? void 0 : p.to) ?? E, X = `${f.slice(0, E)}${e}${f.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)}`;
346
346
  return t.dispatch({
347
- changes: { from: E, to: K, insert: e },
347
+ changes: { from: E, to: X, insert: e },
348
348
  selection: { anchor: E + e.length }
349
- }), (y = t.focus) == null || y.call(t), Ie(X), X;
349
+ }), (y = t.focus) == null || y.call(t), Ie(J), J;
350
350
  }
351
351
  const n = `${I}${e}`;
352
352
  return Ie(n), n;
@@ -357,7 +357,7 @@ function _r({
357
357
  const n = T.current;
358
358
  F(
359
359
  n.map(
360
- (c) => c.variableInstanceId === e ? { ...c, default: t } : c
360
+ (d) => d.variableInstanceId === e ? { ...d, default: t } : d
361
361
  )
362
362
  );
363
363
  },
@@ -365,11 +365,11 @@ function _r({
365
365
  ), Dt = L(
366
366
  (e, t) => {
367
367
  if (!dt(e, t)) return;
368
- const c = se(Cr(e, t)), y = Z(c), p = me(y, T.current);
368
+ const d = se(Cr(e, t)), y = ee(d), p = me(y, T.current);
369
369
  F(p), P("variables");
370
370
  },
371
371
  [se, F]
372
- ), ce = J(() => {
372
+ ), ce = Q(() => {
373
373
  const e = _.trim();
374
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
375
  }, [_, H]), Mt = L(() => {
@@ -377,7 +377,7 @@ function _r({
377
377
  if (oe(!0), ne(!0), ce || e === "") return;
378
378
  const t = dt(_.trim(), "user", e);
379
379
  if (!t) return;
380
- const n = se(t.variable), c = Z(n), y = me(c, T.current);
380
+ const n = se(t.variable), d = ee(n), y = me(d, T.current);
381
381
  let p = -1;
382
382
  for (let f = y.length - 1; f >= 0; f -= 1) {
383
383
  const E = y[f];
@@ -391,14 +391,14 @@ function _r({
391
391
  (f, E) => E === p ? { ...f, default: t.default } : f
392
392
  )
393
393
  ), Le(""), ke(""), oe(!1), ne(!1), P("variables");
394
- }, [W, _, ce, se, F]), Lt = J(() => {
394
+ }, [W, _, ce, se, F]), Lt = Q(() => {
395
395
  const e = /* @__PURE__ */ new Set();
396
- return [{ id: "custom", items: H.filter((n) => n.type === "user").filter((n) => !Ce.some((c) => c.items.some((y) => y.name === n.attribute))).filter((n) => e.has(n.attribute) ? !1 : (e.add(n.attribute), !0)).map((n) => ({
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
397
  name: n.attribute,
398
398
  labelKey: n.attribute,
399
399
  kind: "user"
400
400
  })) }, ...Ce];
401
- }, [H]), de = J(
401
+ }, [H]), de = Q(
402
402
  () => H.filter((e) => e.type !== "system"),
403
403
  [H]
404
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";
@@ -574,7 +574,7 @@ function _r({
574
574
  square: !0,
575
575
  elevation: 0,
576
576
  expanded: t,
577
- onChange: (n, c) => Vt(c ? e.id : null),
577
+ onChange: (n, d) => Vt(d ? e.id : null),
578
578
  sx: {
579
579
  "&:before": { display: "none" },
580
580
  border: 1,
@@ -707,26 +707,26 @@ function _r({
707
707
  children: s("htmlEditor.variables.empty")
708
708
  }
709
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"), c = 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;
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
711
  return /* @__PURE__ */ x(
712
712
  h,
713
713
  {
714
714
  sx: {
715
715
  display: "grid",
716
716
  gridTemplateColumns: { xs: "1fr", sm: "minmax(150px, 42%) 1fr" },
717
- alignItems: c ? "flex-start" : "center",
717
+ alignItems: d ? "flex-start" : "center",
718
718
  gap: 1,
719
719
  px: 1,
720
720
  py: 0.75,
721
721
  border: "1px solid",
722
- borderColor: c ? "error.main" : "transparent",
722
+ borderColor: d ? "error.main" : "transparent",
723
723
  borderRadius: 1,
724
- borderBottomColor: c ? "error.main" : "divider",
725
- backgroundColor: c ? ue(w.palette.error.main, 0.04) : "transparent",
724
+ borderBottomColor: d ? "error.main" : "divider",
725
+ backgroundColor: d ? ue(w.palette.error.main, 0.04) : "transparent",
726
726
  transition: "background-color 120ms ease, border-color 120ms ease",
727
727
  "&:hover": {
728
- backgroundColor: c ? ue(w.palette.error.main, 0.04) : "action.hover",
729
- borderColor: c ? "error.main" : "divider"
728
+ backgroundColor: d ? ue(w.palette.error.main, 0.04) : "action.hover",
729
+ borderColor: d ? "error.main" : "divider"
730
730
  }
731
731
  },
732
732
  children: [
@@ -740,7 +740,7 @@ function _r({
740
740
  fontSize: 13,
741
741
  lineHeight: 1.35,
742
742
  wordBreak: "break-all",
743
- color: c ? "error.main" : "text.primary"
743
+ color: d ? "error.main" : "text.primary"
744
744
  },
745
745
  children: y > 1 ? `${e.variable} (${p})` : e.variable
746
746
  }
@@ -751,10 +751,10 @@ function _r({
751
751
  size: "small",
752
752
  fullWidth: !0,
753
753
  value: e.default,
754
- label: c ? s("text.variables.defaultValueLabel") : void 0,
754
+ label: d ? s("text.variables.defaultValueLabel") : void 0,
755
755
  placeholder: s("text.variables.defaultPlaceholder"),
756
- error: c,
757
- helperText: c ? s("text.variables.defaultRequired") : " ",
756
+ error: d,
757
+ helperText: d ? s("text.variables.defaultRequired") : " ",
758
758
  FormHelperTextProps: Ee,
759
759
  onChange: (f) => St(e.variableInstanceId, f.target.value),
760
760
  sx: {
@@ -837,7 +837,7 @@ function _r({
837
837
  "aria-label": s("htmlEditor.mode.split"),
838
838
  children: [
839
839
  /* @__PURE__ */ r(q, { title: s("htmlEditor.tooltips.splitView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
840
- Q,
840
+ Z,
841
841
  {
842
842
  value: "split",
843
843
  "aria-label": s("htmlEditor.mode.split"),
@@ -845,7 +845,7 @@ function _r({
845
845
  }
846
846
  ) }),
847
847
  /* @__PURE__ */ r(q, { title: s("htmlEditor.tooltips.codeOnly"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
848
- Q,
848
+ Z,
849
849
  {
850
850
  value: "code",
851
851
  "aria-label": s("htmlEditor.mode.code"),
@@ -853,7 +853,7 @@ function _r({
853
853
  }
854
854
  ) }),
855
855
  /* @__PURE__ */ r(q, { title: s("htmlEditor.tooltips.previewOnly"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
856
- Q,
856
+ Z,
857
857
  {
858
858
  value: "preview",
859
859
  "aria-label": s("htmlEditor.mode.preview"),
@@ -902,7 +902,7 @@ function _r({
902
902
  "aria-label": s("htmlEditor.device.desktop"),
903
903
  children: [
904
904
  /* @__PURE__ */ r(q, { title: s("htmlEditor.tooltips.desktopView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
905
- Q,
905
+ Z,
906
906
  {
907
907
  value: "desktop",
908
908
  "aria-label": s("htmlEditor.device.desktop"),
@@ -910,7 +910,7 @@ function _r({
910
910
  }
911
911
  ) }),
912
912
  /* @__PURE__ */ r(q, { title: s("htmlEditor.tooltips.mobileView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
913
- Q,
913
+ Z,
914
914
  {
915
915
  value: "mobile",
916
916
  "aria-label": s("htmlEditor.device.mobile"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monto-email-builder",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "A powerful and customizable email template builder React component library with visual editing, internationalization, and image upload support",
5
5
  "keywords": [
6
6
  "email",