@emabuild/core 0.1.0 → 0.1.1

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.
Files changed (26) hide show
  1. package/dist/{form-tool-DSXsWpjQ.js → form-tool-DShwYWpp.js} +2 -2
  2. package/dist/{form-tool-DSXsWpjQ.js.map → form-tool-DShwYWpp.js.map} +1 -1
  3. package/dist/{html-tool-Be4HAhoj.js → html-tool-YYfXkFIO.js} +2 -2
  4. package/dist/{html-tool-Be4HAhoj.js.map → html-tool-YYfXkFIO.js.map} +1 -1
  5. package/dist/{index-CZt184D3.js → index-BQJRD2VW.js} +666 -625
  6. package/dist/index-BQJRD2VW.js.map +1 -0
  7. package/dist/index.js +1 -1
  8. package/dist/{menu-tool-HPxxeiRV.js → menu-tool-Dus3qFoN.js} +2 -2
  9. package/dist/{menu-tool-HPxxeiRV.js.map → menu-tool-Dus3qFoN.js.map} +1 -1
  10. package/dist/sidebar/body-settings.d.ts.map +1 -1
  11. package/dist/{social-tool-bc46FNgk.js → social-tool-Ba7s8khr.js} +2 -2
  12. package/dist/{social-tool-bc46FNgk.js.map → social-tool-Ba7s8khr.js.map} +1 -1
  13. package/dist/{table-tool-LzRcAPFb.js → table-tool-D8yaPASq.js} +2 -2
  14. package/dist/{table-tool-LzRcAPFb.js.map → table-tool-D8yaPASq.js.map} +1 -1
  15. package/dist/{timer-tool-GPhdsvRE.js → timer-tool-YDsaHv7a.js} +2 -2
  16. package/dist/{timer-tool-GPhdsvRE.js.map → timer-tool-YDsaHv7a.js.map} +1 -1
  17. package/dist/tools/built-in/heading-tool.d.ts.map +1 -1
  18. package/dist/tools/built-in/text-tool.d.ts.map +1 -1
  19. package/dist/tools/helpers/index.d.ts +1 -1
  20. package/dist/tools/helpers/index.d.ts.map +1 -1
  21. package/dist/tools/helpers/value-extractor.d.ts +6 -0
  22. package/dist/tools/helpers/value-extractor.d.ts.map +1 -1
  23. package/dist/{video-tool-CPjCWbTX.js → video-tool-3FQ9rHns.js} +2 -2
  24. package/dist/{video-tool-CPjCWbTX.js.map → video-tool-3FQ9rHns.js.map} +1 -1
  25. package/package.json +3 -3
  26. package/dist/index-CZt184D3.js.map +0 -1
@@ -1,53 +1,53 @@
1
1
  import { html as c, LitElement as v, css as $ } from "lit";
2
- import { property as f, customElement as k } from "lit/decorators.js";
3
- import { unsafeHTML as q } from "lit/directives/unsafe-html.js";
4
- function lt() {
5
- const t = {};
2
+ import { property as b, customElement as k } from "lit/decorators.js";
3
+ import { unsafeHTML as H } from "lit/directives/unsafe-html.js";
4
+ function dt() {
5
+ const e = {};
6
6
  return {
7
7
  getCounters() {
8
- return { ...t };
8
+ return { ...e };
9
9
  },
10
- setCounters(e) {
11
- for (const o of Object.keys(t))
12
- delete t[o];
13
- Object.assign(t, e);
10
+ setCounters(t) {
11
+ for (const o of Object.keys(e))
12
+ delete e[o];
13
+ Object.assign(e, t);
14
14
  },
15
- next(e) {
16
- const o = t[e] ?? 0;
17
- return t[e] = o + 1, t[e];
15
+ next(t) {
16
+ const o = e[t] ?? 0;
17
+ return e[t] = o + 1, e[t];
18
18
  }
19
19
  };
20
20
  }
21
- class dt {
21
+ class ct {
22
22
  constructor() {
23
23
  this.listeners = /* @__PURE__ */ new Map();
24
24
  }
25
25
  /** Register a listener for an event */
26
- on(e, o) {
27
- this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(o);
26
+ on(t, o) {
27
+ this.listeners.has(t) || this.listeners.set(t, /* @__PURE__ */ new Set()), this.listeners.get(t).add(o);
28
28
  }
29
29
  /** Remove a specific listener */
30
- off(e, o) {
31
- this.listeners.get(e)?.delete(o);
30
+ off(t, o) {
31
+ this.listeners.get(t)?.delete(o);
32
32
  }
33
33
  /** Emit an event with a payload. Errors in listeners are caught and logged. */
34
- emit(e, o) {
35
- this.listeners.get(e)?.forEach((n) => {
34
+ emit(t, o) {
35
+ this.listeners.get(t)?.forEach((n) => {
36
36
  try {
37
37
  n(o);
38
38
  } catch (i) {
39
- console.error(`[emabuild] Error in "${e}" listener:`, i);
39
+ console.error(`[emabuild] Error in "${t}" listener:`, i);
40
40
  }
41
41
  });
42
42
  }
43
43
  /** Remove all listeners, optionally scoped to a single event */
44
- removeAllListeners(e) {
45
- e ? this.listeners.delete(e) : this.listeners.clear();
44
+ removeAllListeners(t) {
45
+ t ? this.listeners.delete(t) : this.listeners.clear();
46
46
  }
47
47
  }
48
- class ct {
49
- constructor(e = 50) {
50
- this.undoStack = [], this.redoStack = [], this.maxHistory = e;
48
+ class pt {
49
+ constructor(t = 50) {
50
+ this.undoStack = [], this.redoStack = [], this.maxHistory = t;
51
51
  }
52
52
  /** Whether there are states to undo to */
53
53
  get canUndo() {
@@ -58,27 +58,27 @@ class ct {
58
58
  return this.redoStack.length > 0;
59
59
  }
60
60
  /** Save current design to the undo stack before a mutation */
61
- push(e) {
62
- this.undoStack.push(structuredClone(e)), this.undoStack.length > this.maxHistory && this.undoStack.shift(), this.redoStack = [];
61
+ push(t) {
62
+ this.undoStack.push(structuredClone(t)), this.undoStack.length > this.maxHistory && this.undoStack.shift(), this.redoStack = [];
63
63
  }
64
64
  /** Restore the previous state, pushing current state to redo. Returns the restored design or undefined. */
65
- undo(e) {
65
+ undo(t) {
66
66
  const o = this.undoStack.pop();
67
67
  if (o)
68
- return this.redoStack.push(structuredClone(e)), o;
68
+ return this.redoStack.push(structuredClone(t)), o;
69
69
  }
70
70
  /** Restore the next state, pushing current state to undo. Returns the restored design or undefined. */
71
- redo(e) {
71
+ redo(t) {
72
72
  const o = this.redoStack.pop();
73
73
  if (o)
74
- return this.undoStack.push(structuredClone(e)), o;
74
+ return this.undoStack.push(structuredClone(t)), o;
75
75
  }
76
76
  /** Clear all history (e.g. when loading a new design) */
77
77
  clear() {
78
78
  this.undoStack = [], this.redoStack = [];
79
79
  }
80
80
  }
81
- function pt() {
81
+ function ht() {
82
82
  return {
83
83
  counters: { u_row: 0, u_column: 0 },
84
84
  body: {
@@ -123,9 +123,9 @@ function pt() {
123
123
  schemaVersion: 16
124
124
  };
125
125
  }
126
- function ht(t, e) {
127
- const o = t.next("u_row"), n = e.map(() => {
128
- const i = t.next("u_column");
126
+ function ut(e, t) {
127
+ const o = e.next("u_row"), n = t.map(() => {
128
+ const i = e.next("u_column");
129
129
  return {
130
130
  id: `u_column_${i}`,
131
131
  contents: [],
@@ -140,7 +140,7 @@ function ht(t, e) {
140
140
  });
141
141
  return {
142
142
  id: `u_row_${o}`,
143
- cells: e,
143
+ cells: t,
144
144
  columns: n,
145
145
  values: {
146
146
  displayCondition: null,
@@ -156,58 +156,58 @@ function ht(t, e) {
156
156
  }
157
157
  };
158
158
  }
159
- function ut(t, e, o = {}) {
160
- const n = t.next(`u_content_${e}`), i = `u_content_${e}_${n}`;
159
+ function gt(e, t, o = {}) {
160
+ const n = e.next(`u_content_${t}`), i = `u_content_${t}_${n}`;
161
161
  return {
162
162
  id: i,
163
- type: e,
163
+ type: t,
164
164
  values: {
165
165
  containerPadding: "10px",
166
166
  anchor: "",
167
167
  hideDesktop: !1,
168
168
  hideMobile: !1,
169
169
  displayCondition: null,
170
- _meta: { htmlID: i, htmlClassNames: `u_content_${e}` },
170
+ _meta: { htmlID: i, htmlClassNames: `u_content_${t}` },
171
171
  ...o
172
172
  }
173
173
  };
174
174
  }
175
- function U(t, e) {
176
- return t.body.rows.find((o) => o.id === e);
175
+ function F(e, t) {
176
+ return e.body.rows.find((o) => o.id === t);
177
177
  }
178
- function H(t, e) {
179
- for (const o of t.body.rows) {
180
- const n = o.columns.find((i) => i.id === e);
178
+ function O(e, t) {
179
+ for (const o of e.body.rows) {
180
+ const n = o.columns.find((i) => i.id === t);
181
181
  if (n) return n;
182
182
  }
183
183
  }
184
- function O(t, e) {
185
- for (const o of t.body.rows)
184
+ function j(e, t) {
185
+ for (const o of e.body.rows)
186
186
  for (const n of o.columns) {
187
- const i = n.contents.find((r) => r.id === e);
187
+ const i = n.contents.find((r) => r.id === t);
188
188
  if (i) return i;
189
189
  }
190
190
  }
191
- function gt(t, e) {
192
- for (const o of t.body.rows)
191
+ function ft(e, t) {
192
+ for (const o of e.body.rows)
193
193
  for (const n of o.columns)
194
- if (n.contents.some((i) => i.id === e)) return n;
194
+ if (n.contents.some((i) => i.id === t)) return n;
195
195
  }
196
- function bt(t, e) {
197
- for (const o of t.body.rows)
198
- if (o.columns.some((n) => n.id === e)) return o;
196
+ function bt(e, t) {
197
+ for (const o of e.body.rows)
198
+ if (o.columns.some((n) => n.id === t)) return o;
199
199
  }
200
- function F(t, e) {
201
- return t.body.rows.findIndex((o) => o.id === e);
200
+ function N(e, t) {
201
+ return e.body.rows.findIndex((o) => o.id === t);
202
202
  }
203
- class ft {
203
+ class mt {
204
204
  constructor() {
205
- this.history = new ct(), this.counterManager = lt(), this.subscribers = /* @__PURE__ */ new Set(), this.channelSubscribers = /* @__PURE__ */ new Map(), this.events = new dt(), this._selectedId = null, this._hoveredId = null, this._viewMode = "desktop", this._activeTab = "content", this.design = pt();
205
+ this.history = new pt(), this.counterManager = dt(), this.subscribers = /* @__PURE__ */ new Set(), this.channelSubscribers = /* @__PURE__ */ new Map(), this.events = new ct(), this._selectedId = null, this._hoveredId = null, this._viewMode = "desktop", this._activeTab = "content", this.design = ht();
206
206
  }
207
207
  // ── Subscriptions ──────────────────────────────────────────
208
208
  /** Subscribe to ALL state changes (legacy). Returns an unsubscribe function. */
209
- subscribe(e) {
210
- return this.subscribers.add(e), () => this.subscribers.delete(e);
209
+ subscribe(t) {
210
+ return this.subscribers.add(t), () => this.subscribers.delete(t);
211
211
  }
212
212
  /**
213
213
  * Subscribe to specific channels only. The callback is invoked only
@@ -219,23 +219,23 @@ class ft {
219
219
  * store.subscribeChannels(['design'], () => this.requestUpdate());
220
220
  * ```
221
221
  */
222
- subscribeChannels(e, o) {
223
- for (const n of e)
222
+ subscribeChannels(t, o) {
223
+ for (const n of t)
224
224
  this.channelSubscribers.has(n) || this.channelSubscribers.set(n, /* @__PURE__ */ new Set()), this.channelSubscribers.get(n).add(o);
225
225
  return () => {
226
- for (const n of e)
226
+ for (const n of t)
227
227
  this.channelSubscribers.get(n)?.delete(o);
228
228
  };
229
229
  }
230
230
  /** Notify legacy (all) subscribers */
231
231
  notify() {
232
- this.subscribers.forEach((e) => e());
232
+ this.subscribers.forEach((t) => t());
233
233
  }
234
234
  /** Notify only subscribers of specific channels + legacy subscribers */
235
- notifyChannels(...e) {
235
+ notifyChannels(...t) {
236
236
  const o = /* @__PURE__ */ new Set();
237
237
  for (const n of this.subscribers) o.add(n);
238
- for (const n of e) {
238
+ for (const n of t) {
239
239
  const i = this.channelSubscribers.get(n);
240
240
  if (i) for (const r of i) o.add(r);
241
241
  }
@@ -278,52 +278,52 @@ class ft {
278
278
  }
279
279
  // ── Design Loading ─────────────────────────────────────────
280
280
  /** Load a design document, resetting history and selection */
281
- loadDesign(e) {
282
- this.design = structuredClone(e), this.counterManager.setCounters(this.design.counters), this.history.clear(), this._selectedId = null, this.notifyChannels("design", "selection"), this.events.emit("design:loaded", { design: this.design });
281
+ loadDesign(t) {
282
+ this.design = structuredClone(t), this.counterManager.setCounters(this.design.counters), this.history.clear(), this._selectedId = null, this.notifyChannels("design", "selection"), this.events.emit("design:loaded", { design: this.design });
283
283
  }
284
284
  // ── Undo / Redo ────────────────────────────────────────────
285
285
  undo() {
286
- const e = this.history.undo(this.design);
287
- e && (this.design = e, this.counterManager.setCounters(this.design.counters), this.notifyChannels("design"), this.emitUpdate("content_updated"));
286
+ const t = this.history.undo(this.design);
287
+ t && (this.design = t, this.counterManager.setCounters(this.design.counters), this.notifyChannels("design"), this.emitUpdate("content_updated"));
288
288
  }
289
289
  redo() {
290
- const e = this.history.redo(this.design);
291
- e && (this.design = e, this.counterManager.setCounters(this.design.counters), this.notifyChannels("design"), this.emitUpdate("content_updated"));
290
+ const t = this.history.redo(this.design);
291
+ t && (this.design = t, this.counterManager.setCounters(this.design.counters), this.notifyChannels("design"), this.emitUpdate("content_updated"));
292
292
  }
293
293
  // ── Selection / UI State ───────────────────────────────────
294
- select(e) {
295
- this._selectedId = e, this.notifyChannels("selection");
294
+ select(t) {
295
+ this._selectedId = t, this.notifyChannels("selection");
296
296
  }
297
- hover(e) {
298
- this._hoveredId = e, this.notifyChannels("hover");
297
+ hover(t) {
298
+ this._hoveredId = t, this.notifyChannels("hover");
299
299
  }
300
- setViewMode(e) {
301
- this._viewMode = e, this.notifyChannels("viewMode");
300
+ setViewMode(t) {
301
+ this._viewMode = t, this.notifyChannels("viewMode");
302
302
  }
303
- setActiveTab(e) {
304
- this._activeTab = e, this.notifyChannels("activeTab");
303
+ setActiveTab(t) {
304
+ this._activeTab = t, this.notifyChannels("activeTab");
305
305
  }
306
306
  // ── Row Operations ─────────────────────────────────────────
307
307
  /** Add a row at the given index (or at the end) */
308
- addRow(e, o) {
308
+ addRow(t, o) {
309
309
  this.history.push(this.design);
310
- const n = this.design.body.rows, i = structuredClone(e);
310
+ const n = this.design.body.rows, i = structuredClone(t);
311
311
  o !== void 0 && o >= 0 && o <= n.length ? n.splice(o, 0, i) : n.push(i), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("row_added", i);
312
312
  }
313
313
  /** Remove a row by ID */
314
- removeRow(e) {
315
- const o = F(this.design, e);
316
- o !== -1 && (this.history.push(this.design), this.design.body.rows.splice(o, 1), this._selectedId === e && (this._selectedId = null), this.notifyChannels("design"), this.emitUpdate("row_removed"));
314
+ removeRow(t) {
315
+ const o = N(this.design, t);
316
+ o !== -1 && (this.history.push(this.design), this.design.body.rows.splice(o, 1), this._selectedId === t && (this._selectedId = null), this.notifyChannels("design"), this.emitUpdate("row_removed"));
317
317
  }
318
318
  /** Move a row from one index to another */
319
- moveRow(e, o) {
319
+ moveRow(t, o) {
320
320
  this.history.push(this.design);
321
- const n = this.design.body.rows, [i] = n.splice(e, 1);
321
+ const n = this.design.body.rows, [i] = n.splice(t, 1);
322
322
  n.splice(o, 0, i), this.notifyChannels("design"), this.emitUpdate("row_reordered");
323
323
  }
324
324
  /** Duplicate a row, assigning fresh IDs to all nested elements */
325
- duplicateRow(e) {
326
- const o = U(this.design, e);
325
+ duplicateRow(t) {
326
+ const o = F(this.design, t);
327
327
  if (!o) return;
328
328
  this.history.push(this.design);
329
329
  const n = structuredClone(o), i = this.counterManager.next("u_row");
@@ -336,72 +336,72 @@ class ft {
336
336
  d.id = `u_content_${d.type}_${p}`, d.values._meta = { htmlID: d.id, htmlClassNames: `u_content_${d.type}` };
337
337
  }
338
338
  }
339
- const r = F(this.design, e);
339
+ const r = N(this.design, t);
340
340
  this.design.body.rows.splice(r + 1, 0, n), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("row_added", n);
341
341
  }
342
342
  /** Get the index of a row */
343
- getRowIndex(e) {
344
- return F(this.design, e);
343
+ getRowIndex(t) {
344
+ return N(this.design, t);
345
345
  }
346
346
  /** Update row-level values */
347
- updateRowValues(e, o) {
348
- const n = U(this.design, e);
347
+ updateRowValues(t, o) {
348
+ const n = F(this.design, t);
349
349
  n && (this.history.push(this.design), Object.assign(n.values, o), this.notifyChannels("design"), this.emitUpdate("content_updated"));
350
350
  }
351
351
  // ── Column Operations ──────────────────────────────────────
352
352
  /** Update column-level values */
353
- updateColumnValues(e, o) {
354
- const n = H(this.design, e);
353
+ updateColumnValues(t, o) {
354
+ const n = O(this.design, t);
355
355
  n && (this.history.push(this.design), Object.assign(n.values, o), this.notifyChannels("design"), this.emitUpdate("content_updated"));
356
356
  }
357
357
  // ── Content Operations ─────────────────────────────────────
358
358
  /** Add content to a column at the given index */
359
- addContent(e, o, n) {
360
- const i = H(this.design, e);
359
+ addContent(t, o, n) {
360
+ const i = O(this.design, t);
361
361
  if (!i) return;
362
362
  this.history.push(this.design);
363
363
  const r = structuredClone(o);
364
364
  n !== void 0 && n >= 0 && n <= i.contents.length ? i.contents.splice(n, 0, r) : i.contents.push(r), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("content_added", r);
365
365
  }
366
366
  /** Remove a content block by ID */
367
- removeContent(e) {
367
+ removeContent(t) {
368
368
  for (const o of this.design.body.rows)
369
369
  for (const n of o.columns) {
370
- const i = n.contents.findIndex((r) => r.id === e);
370
+ const i = n.contents.findIndex((r) => r.id === t);
371
371
  if (i !== -1) {
372
- this.history.push(this.design), n.contents.splice(i, 1), this._selectedId === e && (this._selectedId = null), this.notifyChannels("design"), this.emitUpdate("content_removed");
372
+ this.history.push(this.design), n.contents.splice(i, 1), this._selectedId === t && (this._selectedId = null), this.notifyChannels("design"), this.emitUpdate("content_removed");
373
373
  return;
374
374
  }
375
375
  }
376
376
  }
377
377
  /** Update content values by ID */
378
- updateContentValues(e, o) {
379
- const n = O(this.design, e);
378
+ updateContentValues(t, o) {
379
+ const n = j(this.design, t);
380
380
  n && (this.history.push(this.design), Object.assign(n.values, o), this.notifyChannels("design"), this.emitUpdate("content_updated"));
381
381
  }
382
382
  /** Move a content block to a different column at a given index */
383
- moveContent(e, o, n) {
384
- const i = O(this.design, e);
383
+ moveContent(t, o, n) {
384
+ const i = j(this.design, t);
385
385
  if (!i) return;
386
386
  this.history.push(this.design);
387
387
  for (const s of this.design.body.rows)
388
388
  for (const l of s.columns) {
389
- const d = l.contents.findIndex((p) => p.id === e);
389
+ const d = l.contents.findIndex((p) => p.id === t);
390
390
  if (d !== -1) {
391
391
  l.contents.splice(d, 1);
392
392
  break;
393
393
  }
394
394
  }
395
- const r = H(this.design, o);
395
+ const r = O(this.design, o);
396
396
  r && r.contents.splice(n, 0, i), this.notifyChannels("design"), this.emitUpdate("content_reordered");
397
397
  }
398
398
  /** Duplicate a content block, inserting the copy right after the original */
399
- duplicateContent(e) {
400
- const o = O(this.design, e);
399
+ duplicateContent(t) {
400
+ const o = j(this.design, t);
401
401
  if (o)
402
402
  for (const n of this.design.body.rows)
403
403
  for (const i of n.columns) {
404
- const r = i.contents.findIndex((s) => s.id === e);
404
+ const r = i.contents.findIndex((s) => s.id === t);
405
405
  if (r !== -1) {
406
406
  this.history.push(this.design);
407
407
  const s = structuredClone(o), l = this.counterManager.next(`u_content_${o.type}`);
@@ -412,51 +412,51 @@ class ft {
412
412
  }
413
413
  // ── Body Values ────────────────────────────────────────────
414
414
  /** Update body-level values (background, fonts, etc.) */
415
- updateBodyValues(e) {
416
- this.history.push(this.design), Object.assign(this.design.body.values, e), this.notifyChannels("design"), this.emitUpdate("body_updated");
415
+ updateBodyValues(t) {
416
+ this.history.push(this.design), Object.assign(this.design.body.values, t), this.notifyChannels("design"), this.emitUpdate("body_updated");
417
417
  }
418
418
  // ── Lookups (delegate to design-lookup) ────────────────────
419
- findRow(e) {
420
- return U(this.design, e);
419
+ findRow(t) {
420
+ return F(this.design, t);
421
421
  }
422
- findColumn(e) {
423
- return H(this.design, e);
422
+ findColumn(t) {
423
+ return O(this.design, t);
424
424
  }
425
- findContent(e) {
426
- return O(this.design, e);
425
+ findContent(t) {
426
+ return j(this.design, t);
427
427
  }
428
- findParentColumn(e) {
429
- return gt(this.design, e);
428
+ findParentColumn(t) {
429
+ return ft(this.design, t);
430
430
  }
431
- findParentRow(e) {
432
- return bt(this.design, e);
431
+ findParentRow(t) {
432
+ return bt(this.design, t);
433
433
  }
434
434
  // ── Factory Methods (delegate to design-factory) ───────────
435
435
  /** Create a new row with the given column layout */
436
- createRow(e) {
437
- const o = ht(this.counterManager, e);
436
+ createRow(t) {
437
+ const o = ut(this.counterManager, t);
438
438
  return this.syncCounters(), o;
439
439
  }
440
440
  /** Create a new content block for the given tool type */
441
- createContent(e, o = {}) {
442
- const n = ut(this.counterManager, e, o);
441
+ createContent(t, o = {}) {
442
+ const n = gt(this.counterManager, t, o);
443
443
  return this.syncCounters(), n;
444
444
  }
445
445
  // ── Private Helpers ────────────────────────────────────────
446
446
  syncCounters() {
447
447
  this.design.counters = this.counterManager.getCounters();
448
448
  }
449
- emitUpdate(e, o) {
450
- this.events.emit("design:updated", { type: e, item: o });
449
+ emitUpdate(t, o) {
450
+ this.events.emit("design:updated", { type: t, item: o });
451
451
  }
452
452
  }
453
- class mt {
453
+ class xt {
454
454
  constructor() {
455
455
  this.tools = /* @__PURE__ */ new Map(), this.lazyLoaders = /* @__PURE__ */ new Map(), this.lazyMeta = /* @__PURE__ */ new Map(), this.loadingPromises = /* @__PURE__ */ new Map();
456
456
  }
457
457
  /** Register a tool eagerly (available immediately) */
458
- register(e) {
459
- this.tools.set(e.name, e), this.lazyLoaders.delete(e.name), this.lazyMeta.delete(e.name);
458
+ register(t) {
459
+ this.tools.set(t.name, t), this.lazyLoaders.delete(t.name), this.lazyMeta.delete(t.name);
460
460
  }
461
461
  /**
462
462
  * Register a tool lazily. The tool's code is only loaded when first needed.
@@ -473,56 +473,56 @@ class mt {
473
473
  * );
474
474
  * ```
475
475
  */
476
- registerLazy(e, o) {
477
- this.tools.has(e.name) || (this.lazyMeta.set(e.name, e), this.lazyLoaders.set(e.name, o));
476
+ registerLazy(t, o) {
477
+ this.tools.has(t.name) || (this.lazyMeta.set(t.name, t), this.lazyLoaders.set(t.name, o));
478
478
  }
479
479
  /** Get a tool by name. Returns undefined if not loaded yet (use ensureLoaded for lazy tools). */
480
- get(e) {
481
- return this.tools.get(e);
480
+ get(t) {
481
+ return this.tools.get(t);
482
482
  }
483
483
  /** Check if a tool is registered (eager or lazy) */
484
- has(e) {
485
- return this.tools.has(e) || this.lazyLoaders.has(e);
484
+ has(t) {
485
+ return this.tools.has(t) || this.lazyLoaders.has(t);
486
486
  }
487
487
  /** Check if a tool is fully loaded and ready to render */
488
- isLoaded(e) {
489
- return this.tools.has(e);
488
+ isLoaded(t) {
489
+ return this.tools.has(t);
490
490
  }
491
491
  /**
492
492
  * Ensure a lazy tool is loaded. Returns the tool definition.
493
493
  * If the tool is already loaded, returns it immediately.
494
494
  * If it's being loaded, returns the in-flight promise.
495
495
  */
496
- async ensureLoaded(e) {
497
- if (this.tools.has(e)) return this.tools.get(e);
498
- if (this.loadingPromises.has(e)) return this.loadingPromises.get(e);
499
- const o = this.lazyLoaders.get(e);
496
+ async ensureLoaded(t) {
497
+ if (this.tools.has(t)) return this.tools.get(t);
498
+ if (this.loadingPromises.has(t)) return this.loadingPromises.get(t);
499
+ const o = this.lazyLoaders.get(t);
500
500
  if (!o) return;
501
- const n = o().then((i) => (this.tools.set(e, i), this.lazyLoaders.delete(e), this.lazyMeta.delete(e), this.loadingPromises.delete(e), i));
502
- return this.loadingPromises.set(e, n), n;
501
+ const n = o().then((i) => (this.tools.set(t, i), this.lazyLoaders.delete(t), this.lazyMeta.delete(t), this.loadingPromises.delete(t), i));
502
+ return this.loadingPromises.set(t, n), n;
503
503
  }
504
504
  /**
505
505
  * Get all tools for display in the sidebar palette.
506
506
  * Returns both loaded tools and lazy tool metadata, sorted by position.
507
507
  */
508
508
  getAll() {
509
- return Array.from(this.tools.values()).sort((e, o) => (e.position ?? 0) - (o.position ?? 0));
509
+ return Array.from(this.tools.values()).sort((t, o) => (t.position ?? 0) - (o.position ?? 0));
510
510
  }
511
511
  /**
512
512
  * Get all tool names and display metadata (including lazy tools not yet loaded).
513
513
  * Used by the sidebar to show all available tools.
514
514
  */
515
515
  getAllMeta() {
516
- const e = [];
516
+ const t = [];
517
517
  for (const o of this.tools.values())
518
- e.push({ name: o.name, label: o.label, icon: o.icon, position: o.position });
518
+ t.push({ name: o.name, label: o.label, icon: o.icon, position: o.position });
519
519
  for (const o of this.lazyMeta.values())
520
- e.push(o);
521
- return e.sort((o, n) => (o.position ?? 0) - (n.position ?? 0));
520
+ t.push(o);
521
+ return t.sort((o, n) => (o.position ?? 0) - (n.position ?? 0));
522
522
  }
523
523
  /** Get default values for a tool. Loads lazily if needed (sync — returns empty if not loaded). */
524
- getDefaultValues(e) {
525
- const o = this.tools.get(e);
524
+ getDefaultValues(t) {
525
+ const o = this.tools.get(t);
526
526
  if (!o) return {};
527
527
  const n = { ...o.defaultValues };
528
528
  for (const i of Object.values(o.options))
@@ -531,40 +531,40 @@ class mt {
531
531
  return n;
532
532
  }
533
533
  /** Get property groups for a tool */
534
- getPropertyGroups(e) {
535
- return this.tools.get(e)?.options ?? {};
534
+ getPropertyGroups(t) {
535
+ return this.tools.get(t)?.options ?? {};
536
536
  }
537
537
  }
538
538
  const E = {
539
539
  /** ID of the content currently being dragged (null if not dragging content) */
540
540
  draggingContentId: null,
541
- startContentDrag(t) {
542
- this.draggingContentId = t;
541
+ startContentDrag(e) {
542
+ this.draggingContentId = e;
543
543
  },
544
544
  reset() {
545
545
  this.draggingContentId = null;
546
546
  }
547
547
  };
548
- function J(t) {
549
- const e = document.createElement("div");
550
- return Object.assign(e.style, {
548
+ function Q(e) {
549
+ const t = document.createElement("div");
550
+ return Object.assign(t.style, {
551
551
  position: "absolute",
552
552
  left: "0",
553
553
  right: "0",
554
554
  height: "3px",
555
- background: t,
555
+ background: e,
556
556
  borderRadius: "2px",
557
557
  pointerEvents: "none",
558
558
  zIndex: "1000",
559
559
  display: "none",
560
- boxShadow: `0 0 6px ${t}80`
561
- }), e;
560
+ boxShadow: `0 0 6px ${e}80`
561
+ }), t;
562
562
  }
563
- function X(t, e, o, n, i = "4px") {
564
- t.parentNode !== e && (t.remove(), e.appendChild(t));
565
- const s = (e instanceof ShadowRoot ? e.host : e).getBoundingClientRect();
563
+ function Z(e, t, o, n, i = "4px") {
564
+ e.parentNode !== t && (e.remove(), t.appendChild(e));
565
+ const s = (t instanceof ShadowRoot ? t.host : t).getBoundingClientRect();
566
566
  let l;
567
- o.length === 0 || n === 0 ? l = o.length === 0 ? 0 : o[0].getBoundingClientRect().top - s.top : n >= o.length ? l = o[o.length - 1].getBoundingClientRect().bottom - s.top : l = o[n].getBoundingClientRect().top - s.top, Object.assign(t.style, {
567
+ o.length === 0 || n === 0 ? l = o.length === 0 ? 0 : o[0].getBoundingClientRect().top - s.top : n >= o.length ? l = o[o.length - 1].getBoundingClientRect().bottom - s.top : l = o[n].getBoundingClientRect().top - s.top, Object.assign(e.style, {
568
568
  display: "block",
569
569
  top: `${l}px`,
570
570
  left: i,
@@ -572,24 +572,24 @@ function X(t, e, o, n, i = "4px") {
572
572
  width: "auto"
573
573
  });
574
574
  }
575
- function M(t) {
576
- t && (t.style.display = "none");
575
+ function M(e) {
576
+ e && (e.style.display = "none");
577
577
  }
578
- function N(t, e) {
579
- const o = (t instanceof ShadowRoot, t.children);
578
+ function G(e, t) {
579
+ const o = (e instanceof ShadowRoot, e.children);
580
580
  for (const n of Array.from(o)) {
581
581
  const i = n;
582
- e(i), i.shadowRoot && N(i.shadowRoot, e), i.children?.length && N(i, e);
582
+ t(i), i.shadowRoot && G(i.shadowRoot, t), i.children?.length && G(i, t);
583
583
  }
584
584
  }
585
- function Q(t, e) {
585
+ function tt(e, t) {
586
586
  const o = [];
587
- return N(t, (n) => {
588
- n.matches?.(e) && o.push(n);
587
+ return G(e, (n) => {
588
+ n.matches?.(t) && o.push(n);
589
589
  }), o;
590
590
  }
591
- class xt {
592
- constructor(e, o, n) {
591
+ class yt {
592
+ constructor(t, o, n) {
593
593
  this.currentDrop = null, this.contentIndicator = null, this.rowIndicator = null, this.onDragOver = (i) => {
594
594
  const r = i.dataTransfer?.types || [], s = r.includes("application/maileditor-tool"), l = r.includes("application/maileditor-layout"), d = r.includes("application/maileditor-content") || !!E.draggingContentId;
595
595
  !s && !d && !l || (i.preventDefault(), i.dataTransfer.dropEffect = s || l ? "copy" : "move", l ? (this.currentDrop = this.findRowDropTarget(i.clientY), M(this.contentIndicator), this.showRowIndicator()) : (this.currentDrop = this.findContentDropTarget(i.clientX, i.clientY), M(this.rowIndicator), this.showContentIndicator()));
@@ -612,68 +612,68 @@ class xt {
612
612
  }, this.onDragLeave = (i) => {
613
613
  const r = i.relatedTarget;
614
614
  (!r || !this.root.contains(r)) && (this.hideAllIndicators(), this.currentDrop = null);
615
- }, this.store = e, this.toolRegistry = o, this.root = n;
615
+ }, this.store = t, this.toolRegistry = o, this.root = n;
616
616
  }
617
617
  /** Attach all drag event listeners to the shadow root */
618
618
  attach() {
619
- this.root.addEventListener("dragover", this.onDragOver), this.root.addEventListener("drop", this.onDrop), this.root.addEventListener("dragend", this.onDragEnd), this.root.addEventListener("dragleave", this.onDragLeave), this.contentIndicator = J("#3b82f6"), this.rowIndicator = J("#8b5cf6");
619
+ this.root.addEventListener("dragover", this.onDragOver), this.root.addEventListener("drop", this.onDrop), this.root.addEventListener("dragend", this.onDragEnd), this.root.addEventListener("dragleave", this.onDragLeave), this.contentIndicator = Q("#3b82f6"), this.rowIndicator = Q("#8b5cf6");
620
620
  }
621
621
  /** Remove all event listeners and clean up indicators */
622
622
  detach() {
623
623
  this.root.removeEventListener("dragover", this.onDragOver), this.root.removeEventListener("drop", this.onDrop), this.root.removeEventListener("dragend", this.onDragEnd), this.root.removeEventListener("dragleave", this.onDragLeave), this.contentIndicator?.remove(), this.rowIndicator?.remove();
624
624
  }
625
625
  // ── Drop Handlers ──────────────────────────────────────────
626
- handleLayoutDrop(e, o = this.currentDrop) {
627
- const n = this.store.createRow(e), i = o?.type === "row" ? o.rowIndex : void 0;
626
+ handleLayoutDrop(t, o = this.currentDrop) {
627
+ const n = this.store.createRow(t), i = o?.type === "row" ? o.rowIndex : void 0;
628
628
  this.store.addRow(n, i);
629
629
  }
630
- async handleToolDrop(e, o) {
631
- if (await this.toolRegistry.ensureLoaded(e), o?.type === "content" && o.columnId) {
632
- const n = this.toolRegistry.getDefaultValues(e), i = this.store.createContent(e, n);
630
+ async handleToolDrop(t, o) {
631
+ if (await this.toolRegistry.ensureLoaded(t), o?.type === "content" && o.columnId) {
632
+ const n = this.toolRegistry.getDefaultValues(t), i = this.store.createContent(t, n);
633
633
  this.store.addContent(o.columnId, i, o.contentIndex), this.store.select(i.id);
634
634
  } else {
635
635
  const n = this.store.createRow([1]);
636
636
  this.store.addRow(n);
637
- const i = this.toolRegistry.getDefaultValues(e), r = this.store.createContent(e, i);
637
+ const i = this.toolRegistry.getDefaultValues(t), r = this.store.createContent(t, i);
638
638
  this.store.addContent(n.columns[0].id, r), this.store.select(r.id);
639
639
  }
640
640
  }
641
- handleContentDrop(e, o) {
642
- o?.type === "content" && o.columnId && (this.store.moveContent(e, o.columnId, o.contentIndex), this.store.select(e));
641
+ handleContentDrop(t, o) {
642
+ o?.type === "content" && o.columnId && (this.store.moveContent(t, o.columnId, o.contentIndex), this.store.select(t));
643
643
  }
644
644
  // ── Drop Target Detection ─────────────────────────────────
645
- findRowDropTarget(e) {
645
+ findRowDropTarget(t) {
646
646
  const o = this.root.querySelector("me-editor-canvas");
647
647
  if (!o?.shadowRoot) return null;
648
648
  const n = Array.from(o.shadowRoot.querySelectorAll("me-row-renderer"));
649
649
  if (n.length === 0) return { type: "row", rowIndex: 0, y: 0 };
650
- let i = Math.abs(e - n[0].getBoundingClientRect().top), r = { type: "row", rowIndex: 0, y: n[0].getBoundingClientRect().top };
650
+ let i = Math.abs(t - n[0].getBoundingClientRect().top), r = { type: "row", rowIndex: 0, y: n[0].getBoundingClientRect().top };
651
651
  for (let s = 0; s < n.length; s++) {
652
- const l = n[s].getBoundingClientRect().bottom, d = Math.abs(e - l);
652
+ const l = n[s].getBoundingClientRect().bottom, d = Math.abs(t - l);
653
653
  d < i && (i = d, r = { type: "row", rowIndex: s + 1, y: l });
654
654
  }
655
655
  return r;
656
656
  }
657
- findContentDropTarget(e, o) {
658
- const n = Q(this.root, "me-column-renderer");
657
+ findContentDropTarget(t, o) {
658
+ const n = tt(this.root, "me-column-renderer");
659
659
  let i = null, r = 1 / 0;
660
660
  for (const s of n) {
661
661
  const l = s.dataset.columnId;
662
662
  if (!l || !s.shadowRoot) continue;
663
663
  const d = s.getBoundingClientRect();
664
- if (e < d.left || e > d.right) continue;
664
+ if (t < d.left || t > d.right) continue;
665
665
  const p = Array.from(s.shadowRoot.querySelectorAll("me-content-renderer"));
666
666
  if (p.length === 0) {
667
- const u = Math.abs(o - (d.top + d.height / 2));
668
- u < r && (r = u, i = { type: "content", columnId: l, contentIndex: 0, y: d.top + d.height / 2 });
667
+ const g = Math.abs(o - (d.top + d.height / 2));
668
+ g < r && (r = g, i = { type: "content", columnId: l, contentIndex: 0, y: d.top + d.height / 2 });
669
669
  continue;
670
670
  }
671
671
  const h = p[0].getBoundingClientRect().top;
672
- let g = Math.abs(o - h);
673
- g < r && (r = g, i = { type: "content", columnId: l, contentIndex: 0, y: h });
674
- for (let u = 0; u < p.length; u++) {
675
- const m = p[u].getBoundingClientRect(), x = p[u + 1]?.getBoundingClientRect(), b = x ? (m.bottom + x.top) / 2 : m.bottom;
676
- g = Math.abs(o - b), g < r && (r = g, i = { type: "content", columnId: l, contentIndex: u + 1, y: b });
672
+ let u = Math.abs(o - h);
673
+ u < r && (r = u, i = { type: "content", columnId: l, contentIndex: 0, y: h });
674
+ for (let g = 0; g < p.length; g++) {
675
+ const m = p[g].getBoundingClientRect(), x = p[g + 1]?.getBoundingClientRect(), f = x ? (m.bottom + x.top) / 2 : m.bottom;
676
+ u = Math.abs(o - f), u < r && (r = u, i = { type: "content", columnId: l, contentIndex: g + 1, y: f });
677
677
  }
678
678
  }
679
679
  return i;
@@ -684,20 +684,20 @@ class xt {
684
684
  M(this.contentIndicator);
685
685
  return;
686
686
  }
687
- const o = Q(this.root, "me-column-renderer").find((i) => i.dataset.columnId === this.currentDrop.columnId);
687
+ const o = tt(this.root, "me-column-renderer").find((i) => i.dataset.columnId === this.currentDrop.columnId);
688
688
  if (!o?.shadowRoot) return;
689
689
  const n = Array.from(o.shadowRoot.querySelectorAll("me-content-renderer"));
690
- X(this.contentIndicator, o.shadowRoot, n, this.currentDrop.contentIndex ?? 0, "4px");
690
+ Z(this.contentIndicator, o.shadowRoot, n, this.currentDrop.contentIndex ?? 0, "4px");
691
691
  }
692
692
  showRowIndicator() {
693
693
  if (!this.rowIndicator || !this.currentDrop) {
694
694
  M(this.rowIndicator);
695
695
  return;
696
696
  }
697
- const e = this.root.querySelector("me-editor-canvas"), o = e?.shadowRoot?.querySelector(".canvas-body");
697
+ const t = this.root.querySelector("me-editor-canvas"), o = t?.shadowRoot?.querySelector(".canvas-body");
698
698
  if (!o) return;
699
- const n = Array.from(e.shadowRoot.querySelectorAll("me-row-renderer"));
700
- X(this.rowIndicator, o, n, this.currentDrop.rowIndex ?? 0, "0");
699
+ const n = Array.from(t.shadowRoot.querySelectorAll("me-row-renderer"));
700
+ Z(this.rowIndicator, o, n, this.currentDrop.rowIndex ?? 0, "0");
701
701
  }
702
702
  hideAllIndicators() {
703
703
  M(this.contentIndicator), M(this.rowIndicator);
@@ -706,41 +706,41 @@ class xt {
706
706
  this.currentDrop = null, E.reset();
707
707
  }
708
708
  }
709
- function a(t, e, o = "") {
710
- const n = t[e];
709
+ function a(e, t, o = "") {
710
+ const n = e[t];
711
711
  return typeof n == "string" && n !== "" ? n : typeof n == "number" ? String(n) : o;
712
712
  }
713
- function Z(t) {
714
- return typeof t == "string" ? t : t && typeof t == "object" && "url" in t && t.url || "";
713
+ function et(e) {
714
+ return typeof e == "string" ? e : e && typeof e == "object" && "url" in e && e.url || "";
715
715
  }
716
- function tt(t) {
717
- if (t && typeof t == "object") {
718
- const e = t;
716
+ function ot(e) {
717
+ if (e && typeof e == "object") {
718
+ const t = e;
719
719
  return {
720
- width: typeof e.width == "number" ? e.width : void 0,
721
- maxWidth: typeof e.maxWidth == "string" ? e.maxWidth : void 0
720
+ width: typeof t.width == "number" ? t.width : void 0,
721
+ maxWidth: typeof t.maxWidth == "string" ? t.maxWidth : void 0
722
722
  };
723
723
  }
724
724
  return {};
725
725
  }
726
- function yt(t) {
727
- const e = t.action;
728
- if (e && typeof e == "object") {
729
- const o = e.values;
726
+ function wt(e) {
727
+ const t = e.action;
728
+ if (t && typeof t == "object") {
729
+ const o = t.values;
730
730
  return {
731
731
  href: o?.href || "",
732
732
  target: o?.target || "_blank"
733
733
  };
734
734
  }
735
735
  return {
736
- href: a(t, "href"),
737
- target: a(t, "target", "_blank")
736
+ href: a(e, "href"),
737
+ target: a(e, "target", "_blank")
738
738
  };
739
739
  }
740
- function et(t, e = "") {
741
- const o = t.text;
740
+ function nt(e, t = "") {
741
+ const o = e.text;
742
742
  if (typeof o == "string" && o !== "") return o;
743
- const n = t.textJson;
743
+ const n = e.textJson;
744
744
  if (typeof n == "string")
745
745
  try {
746
746
  const i = JSON.parse(n), r = [], s = (l) => {
@@ -751,36 +751,52 @@ function et(t, e = "") {
751
751
  if (s(i.root || i), r.length > 0) return r.join("");
752
752
  } catch {
753
753
  }
754
- return e;
754
+ return t;
755
+ }
756
+ function Y(e, t = "arial,helvetica,sans-serif") {
757
+ const o = e.fontFamily;
758
+ if (typeof o == "string" && o !== "") return o;
759
+ if (o && typeof o == "object") {
760
+ const n = o, i = n.value || t, r = n.url;
761
+ if (r && typeof document < "u") {
762
+ const s = `emabuild-font-${i.replace(/[^a-z]/gi, "")}`;
763
+ if (!document.getElementById(s)) {
764
+ const l = document.createElement("link");
765
+ l.id = s, l.rel = "stylesheet", l.href = r, document.head.appendChild(l);
766
+ }
767
+ }
768
+ return i;
769
+ }
770
+ return t;
755
771
  }
756
- function se(t, e) {
757
- if (typeof t != "string") return e;
772
+ function le(e, t) {
773
+ if (typeof e != "string") return t;
758
774
  try {
759
- return JSON.parse(t);
775
+ return JSON.parse(e);
760
776
  } catch {
761
- return e;
777
+ return t;
762
778
  }
763
779
  }
764
- function V(t, e) {
765
- const { padding: o, align: n = "left", extraTdStyle: i = "" } = e;
780
+ function V(e, t) {
781
+ const { padding: o, align: n = "left", extraTdStyle: i = "" } = t;
766
782
  return `<table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
767
783
  <tbody><tr><td style="${`overflow-wrap:break-word;word-break:break-word;padding:${o};font-family:arial,helvetica,sans-serif;${i}`}" align="${n}">
768
- ${t}
784
+ ${e}
769
785
  </td></tr></tbody>
770
786
  </table>`;
771
787
  }
772
- function wt(t, e, o) {
788
+ function vt(e, t, o) {
773
789
  const { bgColor: n, textColor: i, fontSize: r, fontWeight: s, borderRadius: l } = o, d = parseInt(l) || 0;
774
790
  if (d <= 0) return "";
775
791
  const p = Math.round(d / 20 * 100);
776
792
  return `<!--[if mso]>
777
- <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${e}" style="height:auto;v-text-anchor:middle;width:auto;" arcsize="${p}%" stroke="f" fillcolor="${n}">
793
+ <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${t}" style="height:auto;v-text-anchor:middle;width:auto;" arcsize="${p}%" stroke="f" fillcolor="${n}">
778
794
  <w:anchorlock/>
779
- <center style="color:${i};font-family:arial,helvetica,sans-serif;font-size:${r};font-weight:${s};">${t}</center>
795
+ <center style="color:${i};font-family:arial,helvetica,sans-serif;font-size:${r};font-weight:${s};">${e}</center>
780
796
  </v:roundrect>
781
797
  <![endif]-->`;
782
798
  }
783
- const vt = {
799
+ const $t = {
784
800
  name: "text",
785
801
  label: "Text",
786
802
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/></svg>',
@@ -842,20 +858,20 @@ const vt = {
842
858
  textAlign: "left"
843
859
  },
844
860
  renderer: {
845
- renderEditor(t) {
846
- const e = a(t, "containerPadding", "10px"), o = a(t, "backgroundColor", "transparent"), n = a(t, "color", "inherit"), i = a(t, "lineHeight", "140%"), r = a(t, "text");
861
+ renderEditor(e) {
862
+ const t = a(e, "containerPadding", "10px"), o = a(e, "backgroundColor", "transparent"), n = a(e, "color", "inherit"), i = a(e, "lineHeight", "140%"), r = Y(e), s = a(e, "text");
847
863
  return c`
848
- <div style="padding:${e};background-color:${o};color:${n};line-height:${i};word-break:break-word;">
849
- ${q(r)}
864
+ <div style="padding:${t};background-color:${o};color:${n};line-height:${i};font-family:${r};word-break:break-word;">
865
+ ${H(s)}
850
866
  </div>
851
867
  `;
852
868
  },
853
- renderHtml(t) {
854
- const e = a(t, "containerPadding", "10px"), o = a(t, "backgroundColor"), n = a(t, "color", "#000000"), i = a(t, "lineHeight", "140%"), r = a(t, "textAlign", "left"), s = a(t, "text"), l = o ? `background-color:${o};` : "", d = `<div style="font-size:14px;color:${n};line-height:${i};text-align:${r};word-wrap:break-word;">${s}</div>`;
855
- return V(d, { padding: e, extraTdStyle: l });
869
+ renderHtml(e) {
870
+ const t = a(e, "containerPadding", "10px"), o = a(e, "backgroundColor"), n = a(e, "color", "#000000"), i = a(e, "lineHeight", "140%"), r = a(e, "textAlign", "left"), s = a(e, "text"), l = o ? `background-color:${o};` : "", d = `<div style="font-size:14px;color:${n};line-height:${i};text-align:${r};word-wrap:break-word;">${s}</div>`;
871
+ return V(d, { padding: t, extraTdStyle: l });
856
872
  }
857
873
  }
858
- }, $t = {
874
+ }, kt = {
859
875
  name: "heading",
860
876
  label: "Heading",
861
877
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 12h12"/><path d="M6 4v16"/><path d="M18 4v16"/></svg>',
@@ -956,20 +972,20 @@ const vt = {
956
972
  containerPadding: "10px"
957
973
  },
958
974
  renderer: {
959
- renderEditor(t) {
960
- const e = a(t, "containerPadding", "10px"), o = a(t, "fontSize", "22px"), n = a(t, "color", "#000000"), i = a(t, "textAlign", "left"), r = a(t, "fontWeight", "700"), s = a(t, "lineHeight", "140%"), l = et(t, "Heading");
975
+ renderEditor(e) {
976
+ const t = a(e, "containerPadding", "10px"), o = a(e, "fontSize", "22px"), n = a(e, "color", "#000000"), i = a(e, "textAlign", "left"), r = a(e, "fontWeight", "700"), s = a(e, "lineHeight", "140%"), l = Y(e), d = nt(e, "Heading");
961
977
  return c`
962
- <div style="padding:${e};font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};">
963
- ${l}
978
+ <div style="padding:${t};font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};font-family:${l};">
979
+ ${H(d)}
964
980
  </div>
965
981
  `;
966
982
  },
967
- renderHtml(t) {
968
- const e = a(t, "containerPadding", "10px"), o = a(t, "fontSize", "22px"), n = a(t, "color", "#000000"), i = a(t, "textAlign", "left"), r = a(t, "fontWeight", "700"), s = a(t, "lineHeight", "140%"), l = a(t, "letterSpacing", "normal"), d = a(t, "headingType", "h1"), p = et(t, "Heading"), h = `<${d} style="margin:0;font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};letter-spacing:${l};">${p}</${d}>`;
969
- return V(h, { padding: e });
983
+ renderHtml(e) {
984
+ const t = a(e, "containerPadding", "10px"), o = a(e, "fontSize", "22px"), n = a(e, "color", "#000000"), i = a(e, "textAlign", "left"), r = a(e, "fontWeight", "700"), s = a(e, "lineHeight", "140%"), l = a(e, "letterSpacing", "normal"), d = Y(e), p = a(e, "headingType", "h1"), h = nt(e, "Heading"), u = `<${p} style="margin:0;font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};letter-spacing:${l};font-family:${d};">${h}</${p}>`;
985
+ return V(u, { padding: t });
970
986
  }
971
987
  }
972
- }, kt = {
988
+ }, Ct = {
973
989
  name: "paragraph",
974
990
  label: "Paragraph",
975
991
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/><line x1="3" y1="14" x2="17" y2="14"/></svg>',
@@ -1011,16 +1027,16 @@ const vt = {
1011
1027
  containerPadding: "10px"
1012
1028
  },
1013
1029
  renderer: {
1014
- renderEditor(t) {
1015
- const e = a(t, "containerPadding", "10px"), o = a(t, "color", "#374151"), n = a(t, "lineHeight", "160%");
1016
- return c`<div style="padding:${e};color:${o};line-height:${n};word-break:break-word;">${q(a(t, "text"))}</div>`;
1030
+ renderEditor(e) {
1031
+ const t = a(e, "containerPadding", "10px"), o = a(e, "color", "#374151"), n = a(e, "lineHeight", "160%");
1032
+ return c`<div style="padding:${t};color:${o};line-height:${n};word-break:break-word;">${H(a(e, "text"))}</div>`;
1017
1033
  },
1018
- renderHtml(t) {
1019
- const e = a(t, "containerPadding", "10px"), o = a(t, "color", "#374151"), n = a(t, "lineHeight", "160%"), i = a(t, "textAlign", "left"), r = a(t, "letterSpacing", "normal"), s = `<div style="font-size:14px;color:${o};line-height:${n};text-align:${i};letter-spacing:${r};word-wrap:break-word;">${a(t, "text")}</div>`;
1020
- return V(s, { padding: e });
1034
+ renderHtml(e) {
1035
+ const t = a(e, "containerPadding", "10px"), o = a(e, "color", "#374151"), n = a(e, "lineHeight", "160%"), i = a(e, "textAlign", "left"), r = a(e, "letterSpacing", "normal"), s = `<div style="font-size:14px;color:${o};line-height:${n};text-align:${i};letter-spacing:${r};word-wrap:break-word;">${a(e, "text")}</div>`;
1036
+ return V(s, { padding: t });
1021
1037
  }
1022
1038
  }
1023
- }, Ct = {
1039
+ }, _t = {
1024
1040
  name: "image",
1025
1041
  label: "Image",
1026
1042
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
@@ -1080,16 +1096,16 @@ const vt = {
1080
1096
  containerPadding: "10px"
1081
1097
  },
1082
1098
  renderer: {
1083
- renderEditor(t) {
1084
- const e = a(t, "containerPadding", "10px"), o = Z(t.src), n = a(t, "alt"), r = tt(t.src).maxWidth || a(t, "width", "100%"), s = a(t, "borderRadius", "0px"), l = a(t, "textAlign", a(t, "align", "center"));
1085
- return o ? c`<div style="padding:${e};text-align:${l};"><img src=${o} alt=${n} style="display:inline-block;max-width:100%;width:${r};border-radius:${s};border:0;" /></div>` : c`<div style="padding:${e};text-align:${l};"><div style="background:#f1f5f9;border:2px dashed #cbd5e1;border-radius:8px;padding:40px 20px;text-align:center;color:#94a3b8;font-size:13px;">No image set. Enter a URL in the property panel.</div></div>`;
1099
+ renderEditor(e) {
1100
+ const t = a(e, "containerPadding", "10px"), o = et(e.src), n = a(e, "alt"), r = ot(e.src).maxWidth || a(e, "width", "100%"), s = a(e, "borderRadius", "0px"), l = a(e, "textAlign", a(e, "align", "center"));
1101
+ return o ? c`<div style="padding:${t};text-align:${l};"><img src=${o} alt=${n} style="display:inline-block;max-width:100%;width:${r};border-radius:${s};border:0;" /></div>` : c`<div style="padding:${t};text-align:${l};"><div style="background:#f1f5f9;border:2px dashed #cbd5e1;border-radius:8px;padding:40px 20px;text-align:center;color:#94a3b8;font-size:13px;">No image set. Enter a URL in the property panel.</div></div>`;
1086
1102
  },
1087
- renderHtml(t, e) {
1088
- const o = a(t, "containerPadding", "10px"), n = Z(t.src), i = a(t, "alt"), r = yt(t), l = tt(t.src).maxWidth || a(t, "width", "100%"), d = a(t, "borderRadius", "0px"), p = a(t, "textAlign", a(t, "align", "center")), h = l === "100%" ? e.columnWidth : parseInt(l) || e.columnWidth, g = d !== "0px" ? `border-radius:${d};` : "", u = `<img align="${p}" border="0" src="${n}" alt="${i}" title="${i}" style="outline:none;text-decoration:none;clear:both;display:inline-block!important;border:none;height:auto;float:none;width:${l};max-width:${h}px;${g}" width="${h}" />`, m = r.href ? `<a href="${r.href}" target="${r.target}" style="text-decoration:none;">${u}</a>` : u;
1103
+ renderHtml(e, t) {
1104
+ const o = a(e, "containerPadding", "10px"), n = et(e.src), i = a(e, "alt"), r = wt(e), l = ot(e.src).maxWidth || a(e, "width", "100%"), d = a(e, "borderRadius", "0px"), p = a(e, "textAlign", a(e, "align", "center")), h = l === "100%" ? t.columnWidth : parseInt(l) || t.columnWidth, u = d !== "0px" ? `border-radius:${d};` : "", g = `<img align="${p}" border="0" src="${n}" alt="${i}" title="${i}" style="outline:none;text-decoration:none;clear:both;display:inline-block!important;border:none;height:auto;float:none;width:${l};max-width:${h}px;${u}" width="${h}" />`, m = r.href ? `<a href="${r.href}" target="${r.target}" style="text-decoration:none;">${g}</a>` : g;
1089
1105
  return V(m, { padding: o, align: p });
1090
1106
  }
1091
1107
  }
1092
- }, _t = {
1108
+ }, Dt = {
1093
1109
  name: "button",
1094
1110
  label: "Button",
1095
1111
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="20" height="10" rx="2"/><path d="M12 7v10"/><path d="m8 12 4-3 4 3"/></svg>',
@@ -1175,25 +1191,25 @@ const vt = {
1175
1191
  containerPadding: "10px"
1176
1192
  },
1177
1193
  renderer: {
1178
- renderEditor(t) {
1179
- const e = a(t, "containerPadding", "10px"), o = a(t, "backgroundColor", "#3b82f6"), n = a(t, "textColor", "#ffffff"), i = a(t, "fontSize", "14px"), r = a(t, "fontWeight", "700"), s = a(t, "borderRadius", "4px"), l = a(t, "buttonPadding", "10px 20px"), d = a(t, "text", "Click Me"), p = a(t, "textAlign", "center"), h = a(t, "buttonWidth", "auto"), g = a(t, "borderWidth", "0px"), u = a(t, "borderColor", o), m = g !== "0px" ? `border:${g} solid ${u};` : "border:none;", x = h === "auto" ? "display:inline-block;" : `display:block;width:${h};`;
1194
+ renderEditor(e) {
1195
+ const t = a(e, "containerPadding", "10px"), o = a(e, "backgroundColor", "#3b82f6"), n = a(e, "textColor", "#ffffff"), i = a(e, "fontSize", "14px"), r = a(e, "fontWeight", "700"), s = a(e, "borderRadius", "4px"), l = a(e, "buttonPadding", "10px 20px"), d = a(e, "text", "Click Me"), p = a(e, "textAlign", "center"), h = a(e, "buttonWidth", "auto"), u = a(e, "borderWidth", "0px"), g = a(e, "borderColor", o), m = u !== "0px" ? `border:${u} solid ${g};` : "border:none;", x = h === "auto" ? "display:inline-block;" : `display:block;width:${h};`;
1180
1196
  return c`
1181
- <div style="padding:${e};text-align:${p};">
1197
+ <div style="padding:${t};text-align:${p};">
1182
1198
  <a style="${x}background-color:${o};color:${n};font-size:${i};font-weight:${r};border-radius:${s};padding:${l};text-decoration:none;text-align:center;${m}cursor:pointer;font-family:arial,helvetica,sans-serif;box-sizing:border-box;">${d}</a>
1183
1199
  </div>
1184
1200
  `;
1185
1201
  },
1186
- renderHtml(t) {
1187
- const e = a(t, "containerPadding", "10px"), o = a(t, "backgroundColor", "#3b82f6"), n = a(t, "textColor", "#ffffff"), i = a(t, "fontSize", "14px"), r = a(t, "fontWeight", "700"), s = a(t, "borderRadius", "4px"), l = a(t, "buttonPadding", "10px 20px"), d = a(t, "text", "Click Me"), p = a(t, "textAlign", "center"), h = a(t, "href", "#"), g = a(t, "target", "_blank"), u = a(t, "borderWidth", "0px"), m = a(t, "borderColor", o), x = u !== "0px" ? `border:${u} solid ${m};` : "border:none;", b = wt(d, h, { bgColor: o, textColor: n, fontSize: i, fontWeight: r, borderRadius: s }), y = b ? `${b}
1202
+ renderHtml(e) {
1203
+ const t = a(e, "containerPadding", "10px"), o = a(e, "backgroundColor", "#3b82f6"), n = a(e, "textColor", "#ffffff"), i = a(e, "fontSize", "14px"), r = a(e, "fontWeight", "700"), s = a(e, "borderRadius", "4px"), l = a(e, "buttonPadding", "10px 20px"), d = a(e, "text", "Click Me"), p = a(e, "textAlign", "center"), h = a(e, "href", "#"), u = a(e, "target", "_blank"), g = a(e, "borderWidth", "0px"), m = a(e, "borderColor", o), x = g !== "0px" ? `border:${g} solid ${m};` : "border:none;", f = vt(d, h, { bgColor: o, textColor: n, fontSize: i, fontWeight: r, borderRadius: s }), y = f ? `${f}
1188
1204
  <!--[if !mso]><!-->` : "<!--[if !mso]><!-->", z = `<div align="${p}">
1189
1205
  ${y}
1190
- <a href="${h}" target="${g}" style="box-sizing:border-box;display:inline-block;text-decoration:none;text-align:center;color:${n};background-color:${o};border-radius:${s};font-size:${i};font-weight:${r};padding:${l};font-family:arial,helvetica,sans-serif;${x}mso-border-alt:none;word-break:keep-all;"><span style="line-height:120%;">${d}</span></a>
1206
+ <a href="${h}" target="${u}" style="box-sizing:border-box;display:inline-block;text-decoration:none;text-align:center;color:${n};background-color:${o};border-radius:${s};font-size:${i};font-weight:${r};padding:${l};font-family:arial,helvetica,sans-serif;${x}mso-border-alt:none;word-break:keep-all;"><span style="line-height:120%;">${d}</span></a>
1191
1207
  <!--<![endif]-->
1192
1208
  </div>`;
1193
- return V(z, { padding: e, align: p });
1209
+ return V(z, { padding: t, align: p });
1194
1210
  }
1195
1211
  }
1196
- }, Dt = {
1212
+ }, St = {
1197
1213
  name: "divider",
1198
1214
  label: "Divider",
1199
1215
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="2" y1="12" x2="22" y2="12"/></svg>',
@@ -1239,53 +1255,53 @@ const vt = {
1239
1255
  containerPadding: "10px"
1240
1256
  },
1241
1257
  renderer: {
1242
- renderEditor(t) {
1243
- const e = a(t, "containerPadding", "10px"), o = a(t, "width", "100%"), n = `${a(t, "borderTopWidth", "1px")} ${a(t, "borderTopStyle", "solid")} ${a(t, "borderTopColor", "#cccccc")}`;
1244
- return c`<div style="padding:${e};"><div style="border-top:${n};width:${o};margin:0 auto;"></div></div>`;
1258
+ renderEditor(e) {
1259
+ const t = a(e, "containerPadding", "10px"), o = a(e, "width", "100%"), n = `${a(e, "borderTopWidth", "1px")} ${a(e, "borderTopStyle", "solid")} ${a(e, "borderTopColor", "#cccccc")}`;
1260
+ return c`<div style="padding:${t};"><div style="border-top:${n};width:${o};margin:0 auto;"></div></div>`;
1245
1261
  },
1246
- renderHtml(t) {
1247
- const e = a(t, "containerPadding", "10px"), o = a(t, "width", "100%"), n = `${a(t, "borderTopWidth", "1px")} ${a(t, "borderTopStyle", "solid")} ${a(t, "borderTopColor", "#cccccc")}`, i = `<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="${o}" style="border-collapse:collapse;border-top:${n};"><tbody><tr><td style="font-size:0;line-height:0;">&nbsp;</td></tr></tbody></table>`;
1248
- return V(i, { padding: e, align: "center" });
1262
+ renderHtml(e) {
1263
+ const t = a(e, "containerPadding", "10px"), o = a(e, "width", "100%"), n = `${a(e, "borderTopWidth", "1px")} ${a(e, "borderTopStyle", "solid")} ${a(e, "borderTopColor", "#cccccc")}`, i = `<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="${o}" style="border-collapse:collapse;border-top:${n};"><tbody><tr><td style="font-size:0;line-height:0;">&nbsp;</td></tr></tbody></table>`;
1264
+ return V(i, { padding: t, align: "center" });
1249
1265
  }
1250
1266
  }
1251
- }, St = [
1252
- vt,
1267
+ }, Rt = [
1253
1268
  $t,
1254
1269
  kt,
1255
1270
  Ct,
1256
1271
  _t,
1257
- Dt
1258
- ], ot = [
1272
+ Dt,
1273
+ St
1274
+ ], it = [
1259
1275
  {
1260
1276
  meta: { name: "html", label: "HTML", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>', position: 6 },
1261
- loader: () => import("./html-tool-Be4HAhoj.js").then((t) => t.htmlTool)
1277
+ loader: () => import("./html-tool-YYfXkFIO.js").then((e) => e.htmlTool)
1262
1278
  },
1263
1279
  {
1264
1280
  meta: { name: "social", label: "Social", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg>', position: 8 },
1265
- loader: () => import("./social-tool-bc46FNgk.js").then((t) => t.socialTool)
1281
+ loader: () => import("./social-tool-Ba7s8khr.js").then((e) => e.socialTool)
1266
1282
  },
1267
1283
  {
1268
1284
  meta: { name: "menu", label: "Menu", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>', position: 9 },
1269
- loader: () => import("./menu-tool-HPxxeiRV.js").then((t) => t.menuTool)
1285
+ loader: () => import("./menu-tool-Dus3qFoN.js").then((e) => e.menuTool)
1270
1286
  },
1271
1287
  {
1272
1288
  meta: { name: "video", label: "Video", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>', position: 10 },
1273
- loader: () => import("./video-tool-CPjCWbTX.js").then((t) => t.videoTool)
1289
+ loader: () => import("./video-tool-3FQ9rHns.js").then((e) => e.videoTool)
1274
1290
  },
1275
1291
  {
1276
1292
  meta: { name: "timer", label: "Timer", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>', position: 11 },
1277
- loader: () => import("./timer-tool-GPhdsvRE.js").then((t) => t.timerTool)
1293
+ loader: () => import("./timer-tool-YDsaHv7a.js").then((e) => e.timerTool)
1278
1294
  },
1279
1295
  {
1280
1296
  meta: { name: "table", label: "Table", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/></svg>', position: 12 },
1281
- loader: () => import("./table-tool-LzRcAPFb.js").then((t) => t.tableTool)
1297
+ loader: () => import("./table-tool-D8yaPASq.js").then((e) => e.tableTool)
1282
1298
  },
1283
1299
  {
1284
1300
  meta: { name: "form", label: "Form", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M7 7h10"/><path d="M7 12h10"/><path d="M7 17h6"/></svg>', position: 13 },
1285
- loader: () => import("./form-tool-DSXsWpjQ.js").then((t) => t.formTool)
1301
+ loader: () => import("./form-tool-DShwYWpp.js").then((e) => e.formTool)
1286
1302
  }
1287
1303
  ];
1288
- function Rt(t, e, o) {
1304
+ function Mt(e, t, o) {
1289
1305
  const n = o.backgroundColor || "#e7e7e7", i = o.contentWidth || "600px", r = o.fontFamily?.value || "arial,helvetica,sans-serif", s = o.textColor || "#000000", l = o.preheaderText || "", d = l ? `<div style="display:none;font-size:1px;color:${n};line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">${l}${"&zwnj;&nbsp;".repeat(80)}</div>` : "";
1290
1306
  return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1291
1307
  <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
@@ -1310,7 +1326,7 @@ function Rt(t, e, o) {
1310
1326
  <![endif]-->
1311
1327
  <!--[if !mso]><!-->
1312
1328
  <style type="text/css">
1313
- ${e}
1329
+ ${t}
1314
1330
  </style>
1315
1331
  <!--<![endif]-->
1316
1332
  <style type="text/css">
@@ -1329,7 +1345,7 @@ function Rt(t, e, o) {
1329
1345
  <tr style="vertical-align:top;">
1330
1346
  <td style="word-break:break-word;border-collapse:collapse !important;vertical-align:top;">
1331
1347
  <!--[if (mso)|(IE)]><table width="${parseInt(i)}" align="center" cellpadding="0" cellspacing="0" border="0"><tr><td><![endif]-->
1332
- ${t}
1348
+ ${e}
1333
1349
  <!--[if (mso)|(IE)]></td></tr></table><![endif]-->
1334
1350
  </td>
1335
1351
  </tr>
@@ -1338,20 +1354,20 @@ function Rt(t, e, o) {
1338
1354
  </body>
1339
1355
  </html>`;
1340
1356
  }
1341
- function Mt(t, e, o) {
1342
- const n = parseInt(e.contentWidth || "600"), i = t.values.backgroundColor || "", r = t.values.columnsBackgroundColor || "", s = t.values.padding || "0px", l = t.cells.reduce((b, y) => b + y, 0), d = i ? `background-color:${i};` : "", p = t.values.backgroundImage?.url ? `background-image:url('${t.values.backgroundImage.url}');background-repeat:${t.values.backgroundImage.repeat ? "repeat" : "no-repeat"};background-position:center top;background-size:${t.values.backgroundImage.cover ? "cover" : "auto"};` : "", h = t.columns.map((b, y) => {
1343
- const R = Math.round(t.cells[y] / l * n);
1344
- return nt(b, R, r, e, o);
1345
- }), g = t.columns.length > 1;
1346
- let u;
1347
- if (g) {
1348
- const b = t.columns.map((y, R) => {
1349
- const z = Math.round(t.cells[R] / l * n), at = nt(y, z, r, e, o);
1357
+ function Tt(e, t, o) {
1358
+ const n = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", r = e.values.columnsBackgroundColor || "", s = e.values.padding || "0px", l = e.cells.reduce((f, y) => f + y, 0), d = i ? `background-color:${i};` : "", p = e.values.backgroundImage?.url ? `background-image:url('${e.values.backgroundImage.url}');background-repeat:${e.values.backgroundImage.repeat ? "repeat" : "no-repeat"};background-position:center top;background-size:${e.values.backgroundImage.cover ? "cover" : "auto"};` : "", h = e.columns.map((f, y) => {
1359
+ const R = Math.round(e.cells[y] / l * n);
1360
+ return rt(f, R, r, t, o);
1361
+ }), u = e.columns.length > 1;
1362
+ let g;
1363
+ if (u) {
1364
+ const f = e.columns.map((y, R) => {
1365
+ const z = Math.round(e.cells[R] / l * n), at = rt(y, z, r, t, o);
1350
1366
  return `<!--[if (mso)|(IE)]><td align="center" width="${z}" style="width:${z}px;padding:0px;border:none;" valign="top"><![endif]-->
1351
1367
  ${at}
1352
1368
  <!--[if (mso)|(IE)]></td><![endif]-->`;
1353
1369
  });
1354
- u = `<!--[if (mso)|(IE)]><table role="presentation" width="${n}" cellpadding="0" cellspacing="0" border="0"><tr>${b.join(`
1370
+ g = `<!--[if (mso)|(IE)]><table role="presentation" width="${n}" cellpadding="0" cellspacing="0" border="0"><tr>${f.join(`
1355
1371
  `)}</tr></table><![endif]-->
1356
1372
 
1357
1373
  <!--[if !mso]><!-->
@@ -1361,33 +1377,33 @@ ${h.join(`
1361
1377
  </div>
1362
1378
  <!--<![endif]-->`;
1363
1379
  } else
1364
- u = h.join(`
1380
+ g = h.join(`
1365
1381
  `);
1366
- const m = t.values.hideDesktop ? " u_hide_desktop" : "", x = t.values.hideMobile ? " u_hide_mobile" : "";
1382
+ const m = e.values.hideDesktop ? " u_hide_desktop" : "", x = e.values.hideMobile ? " u_hide_mobile" : "";
1367
1383
  return `<div class="u_row${m}${x}" style="padding:${s};${d}${p}">
1368
1384
  <div style="margin:0 auto;min-width:320px;max-width:${n}px;overflow-wrap:break-word;word-wrap:break-word;word-break:break-word;background-color:transparent;">
1369
1385
  <div style="border-collapse:collapse;display:table;width:100%;height:100%;background-color:transparent;">
1370
- ${u}
1386
+ ${g}
1371
1387
  </div>
1372
1388
  </div>
1373
1389
  </div>`;
1374
1390
  }
1375
- function nt(t, e, o, n, i) {
1376
- const r = t.values.backgroundColor || o || "", s = t.values.padding || "0px", l = t.values.borderRadius || "0px", d = r ? `background-color:${r};` : "", p = t.contents.map((h) => {
1377
- const g = i.get(h.type);
1378
- if (!g) return `<!-- unknown tool: ${h.type} -->`;
1379
- const u = {
1380
- columnWidth: e,
1391
+ function rt(e, t, o, n, i) {
1392
+ const r = e.values.backgroundColor || o || "", s = e.values.padding || "0px", l = e.values.borderRadius || "0px", d = r ? `background-color:${r};` : "", p = e.contents.map((h) => {
1393
+ const u = i.get(h.type);
1394
+ if (!u) return `<!-- unknown tool: ${h.type} -->`;
1395
+ const g = {
1396
+ columnWidth: t,
1381
1397
  displayMode: "email",
1382
1398
  contentWidth: parseInt(n.contentWidth || "600"),
1383
1399
  bodyValues: n
1384
1400
  };
1385
- let m = g(h.values, u);
1386
- const x = !!h.values.hideDesktop, b = !!h.values.hideMobile;
1387
- return (x || b) && (m = `<div class="${[x && "u_hide_desktop", b && "u_hide_mobile"].filter(Boolean).join(" ")}">${m}</div>`), m;
1401
+ let m = u(h.values, g);
1402
+ const x = !!h.values.hideDesktop, f = !!h.values.hideMobile;
1403
+ return (x || f) && (m = `<div class="${[x && "u_hide_desktop", f && "u_hide_mobile"].filter(Boolean).join(" ")}">${m}</div>`), m;
1388
1404
  }).join(`
1389
1405
  `);
1390
- return `<div class="u_column" style="max-width:${e}px;min-width:${Math.min(e, 320)}px;display:table-cell;vertical-align:top;">
1406
+ return `<div class="u_column" style="max-width:${t}px;min-width:${Math.min(t, 320)}px;display:table-cell;vertical-align:top;">
1391
1407
  <div style="height:100%;width:100% !important;border-radius:${l};-webkit-border-radius:${l};${d}">
1392
1408
  <div style="box-sizing:border-box;height:100%;padding:${s};border:none;border-radius:${l};-webkit-border-radius:${l};">
1393
1409
  ${p || '<!--[if (!mso)&(!IE)]><!--><div style="height:0;min-height:1px;font-size:0;">&nbsp;</div><!--<![endif]-->'}
@@ -1395,13 +1411,13 @@ function nt(t, e, o, n, i) {
1395
1411
  </div>
1396
1412
  </div>`;
1397
1413
  }
1398
- function It(t) {
1414
+ function It(e) {
1399
1415
  return `
1400
- @media only screen and (min-width: ${t + 20}px) {
1416
+ @media only screen and (min-width: ${e + 20}px) {
1401
1417
  .u_row .u_column { display: table-cell; }
1402
1418
  }
1403
1419
 
1404
- @media only screen and (max-width: ${t + 20}px) {
1420
+ @media only screen and (max-width: ${e + 20}px) {
1405
1421
  .u_row .u_column {
1406
1422
  display: block !important;
1407
1423
  width: 100% !important;
@@ -1435,30 +1451,30 @@ function It(t) {
1435
1451
  .u_hide_desktop { display: block !important; }
1436
1452
  .u_hide_mobile { display: block !important; }
1437
1453
 
1438
- @media only screen and (max-width: ${t + 20}px) {
1454
+ @media only screen and (max-width: ${e + 20}px) {
1439
1455
  .u_hide_desktop { display: block !important; }
1440
1456
  .u_hide_mobile { display: none !important; }
1441
1457
  }
1442
1458
 
1443
- @media only screen and (min-width: ${t + 21}px) {
1459
+ @media only screen and (min-width: ${e + 21}px) {
1444
1460
  .u_hide_desktop { display: none !important; }
1445
1461
  .u_hide_mobile { display: block !important; }
1446
1462
  }`;
1447
1463
  }
1448
- function Tt(t, e, o) {
1449
- const n = t.body.values, i = parseInt(n.contentWidth || "600"), r = t.body.rows.map((g) => Mt(g, n, e)).join(`
1464
+ function Pt(e, t, o) {
1465
+ const n = e.body.values, i = parseInt(n.contentWidth || "600"), r = e.body.rows.map((u) => Tt(u, n, t)).join(`
1450
1466
  `), s = It(i);
1451
- let l = Rt(r, s, n);
1467
+ let l = Mt(r, s, n);
1452
1468
  if (o?.mergeTags)
1453
- for (const [g, u] of Object.entries(o.mergeTags))
1454
- l = l.replaceAll(`{{${g}}}`, u);
1469
+ for (const [u, g] of Object.entries(o.mergeTags))
1470
+ l = l.replaceAll(`{{${u}}}`, g);
1455
1471
  const d = l.match(/<body[^>]*>([\s\S]*)<\/body>/i), p = l.match(/<style[^>]*>([\s\S]*?)<\/style>/gi), h = [];
1456
1472
  return n.fontFamily?.url && h.push(n.fontFamily.url), {
1457
- design: structuredClone(t),
1473
+ design: structuredClone(e),
1458
1474
  html: l,
1459
1475
  chunks: {
1460
1476
  body: d?.[1] ?? r,
1461
- css: p?.map((g) => g.replace(/<\/?style[^>]*>/gi, "")).join(`
1477
+ css: p?.map((u) => u.replace(/<\/?style[^>]*>/gi, "")).join(`
1462
1478
  `) ?? s,
1463
1479
  fonts: h,
1464
1480
  js: ""
@@ -1470,12 +1486,12 @@ class S {
1470
1486
  * @param host - The Lit component that owns this controller
1471
1487
  * @param channels - Which store channels to subscribe to
1472
1488
  */
1473
- constructor(e, o) {
1474
- this.store = null, this.host = e, this.channels = o, e.addController(this);
1489
+ constructor(t, o) {
1490
+ this.store = null, this.host = t, this.channels = o, t.addController(this);
1475
1491
  }
1476
1492
  /** Set or change the store reference. Re-subscribes automatically. */
1477
- setStore(e) {
1478
- this.store !== e && (this.unsub?.(), this.store = e, this.subscribe());
1493
+ setStore(t) {
1494
+ this.store !== t && (this.unsub?.(), this.store = t, this.subscribe());
1479
1495
  }
1480
1496
  hostConnected() {
1481
1497
  this.subscribe();
@@ -1489,27 +1505,27 @@ class S {
1489
1505
  }));
1490
1506
  }
1491
1507
  }
1492
- var Pt = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, j = (t, e, o, n) => {
1493
- for (var i = n > 1 ? void 0 : n ? Vt(e, o) : e, r = t.length - 1, s; r >= 0; r--)
1494
- (s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
1495
- return n && i && Pt(e, o, i), i;
1508
+ var Vt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, W = (e, t, o, n) => {
1509
+ for (var i = n > 1 ? void 0 : n ? zt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
1510
+ (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
1511
+ return n && i && Vt(t, o, i), i;
1496
1512
  };
1497
1513
  let _ = class extends v {
1498
1514
  constructor() {
1499
- super(...arguments), this.storeCtrl = new S(this, ["design", "selection", "hover", "viewMode"]), this._onDragStart = (t) => {
1500
- t.dataTransfer.setData("application/maileditor-content", this.content.id), t.dataTransfer.effectAllowed = "move", this.style.opacity = "0.4", E.startContentDrag(this.content.id);
1515
+ super(...arguments), this.storeCtrl = new S(this, ["design", "selection", "hover", "viewMode"]), this._onDragStart = (e) => {
1516
+ e.dataTransfer.setData("application/maileditor-content", this.content.id), e.dataTransfer.effectAllowed = "move", this.style.opacity = "0.4", E.startContentDrag(this.content.id);
1501
1517
  }, this._onDragEnd = () => {
1502
1518
  this.style.opacity = "1", E.reset();
1503
1519
  };
1504
1520
  }
1505
- set store(t) {
1506
- this.storeCtrl.setStore(t);
1521
+ set store(e) {
1522
+ this.storeCtrl.setStore(e);
1507
1523
  }
1508
1524
  get store() {
1509
1525
  return this.storeCtrl.store;
1510
1526
  }
1511
- handleClick(t) {
1512
- t.stopPropagation(), this.store.select(this.content.id);
1527
+ handleClick(e) {
1528
+ e.stopPropagation(), this.store.select(this.content.id);
1513
1529
  }
1514
1530
  handleMouseEnter() {
1515
1531
  this.store.hover(this.content.id);
@@ -1517,11 +1533,11 @@ let _ = class extends v {
1517
1533
  handleMouseLeave() {
1518
1534
  this.store.hover(null);
1519
1535
  }
1520
- handleDelete(t) {
1521
- t.stopPropagation(), this.store.removeContent(this.content.id);
1536
+ handleDelete(e) {
1537
+ e.stopPropagation(), this.store.removeContent(this.content.id);
1522
1538
  }
1523
- handleDuplicate(t) {
1524
- t.stopPropagation(), this.store.duplicateContent(this.content.id);
1539
+ handleDuplicate(e) {
1540
+ e.stopPropagation(), this.store.duplicateContent(this.content.id);
1525
1541
  }
1526
1542
  connectedCallback() {
1527
1543
  super.connectedCallback(), this.addEventListener("dragstart", this._onDragStart), this.addEventListener("dragend", this._onDragEnd);
@@ -1531,14 +1547,14 @@ let _ = class extends v {
1531
1547
  }
1532
1548
  render() {
1533
1549
  if (!this.store) return c``;
1534
- const t = this.store.selectedId === this.content.id, e = this.store.hoveredId === this.content.id, o = this.store.viewMode, n = !!this.content.values.hideDesktop, i = !!this.content.values.hideMobile, r = o === "desktop" && n || o === "mobile" && i;
1535
- this.classList.toggle("selected", t), this.classList.toggle("hovered", e), this.classList.toggle("hidden-in-view", r), this.setAttribute("draggable", "true"), this.dataset.contentId = this.content.id;
1550
+ const e = this.store.selectedId === this.content.id, t = this.store.hoveredId === this.content.id, o = this.store.viewMode, n = !!this.content.values.hideDesktop, i = !!this.content.values.hideMobile, r = o === "desktop" && n || o === "mobile" && i;
1551
+ this.classList.toggle("selected", e), this.classList.toggle("hovered", t), this.classList.toggle("hidden-in-view", r), this.setAttribute("draggable", "true"), this.dataset.contentId = this.content.id;
1536
1552
  const s = this.toolRegistry.get(this.content.type);
1537
1553
  if (!s && this.toolRegistry.has(this.content.type))
1538
1554
  return this.toolRegistry.ensureLoaded(this.content.type).then(() => this.requestUpdate()), c`<div style="padding:16px;text-align:center;color:#9ca3af;font-size:13px;font-family:sans-serif;">Loading ${this.content.type}...</div>`;
1539
1555
  const l = s?.renderer.renderEditor(this.content.values, {
1540
- isSelected: t,
1541
- isHovered: e,
1556
+ isSelected: e,
1557
+ isHovered: t,
1542
1558
  columnWidth: 600,
1543
1559
  displayMode: "email"
1544
1560
  });
@@ -1591,36 +1607,36 @@ _.styles = $`
1591
1607
  .action-btn:hover { background: rgba(255,255,255,0.2); }
1592
1608
  .content-wrapper { position: relative; }
1593
1609
  `;
1594
- j([
1595
- f({ attribute: !1 })
1610
+ W([
1611
+ b({ attribute: !1 })
1596
1612
  ], _.prototype, "content", 2);
1597
- j([
1598
- f({ attribute: !1 })
1613
+ W([
1614
+ b({ attribute: !1 })
1599
1615
  ], _.prototype, "store", 1);
1600
- j([
1601
- f({ attribute: !1 })
1616
+ W([
1617
+ b({ attribute: !1 })
1602
1618
  ], _.prototype, "toolRegistry", 2);
1603
- _ = j([
1619
+ _ = W([
1604
1620
  k("me-content-renderer")
1605
1621
  ], _);
1606
- var zt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, B = (t, e, o, n) => {
1607
- for (var i = n > 1 ? void 0 : n ? Et(e, o) : e, r = t.length - 1, s; r >= 0; r--)
1608
- (s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
1609
- return n && i && zt(e, o, i), i;
1622
+ var Et = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, A = (e, t, o, n) => {
1623
+ for (var i = n > 1 ? void 0 : n ? Lt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
1624
+ (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
1625
+ return n && i && Et(t, o, i), i;
1610
1626
  };
1611
1627
  let w = class extends v {
1612
1628
  constructor() {
1613
1629
  super(...arguments), this.storeCtrl = new S(this, ["design"]), this.widthPercent = 100;
1614
1630
  }
1615
- set store(t) {
1616
- this.storeCtrl.setStore(t);
1631
+ set store(e) {
1632
+ this.storeCtrl.setStore(e);
1617
1633
  }
1618
1634
  get store() {
1619
1635
  return this.storeCtrl.store;
1620
1636
  }
1621
1637
  render() {
1622
- const t = this.column.values.padding || "0px", e = this.column.values.backgroundColor || "transparent", o = this.column.contents;
1623
- return this.dataset.columnId = this.column.id, this.style.width = `${this.widthPercent}%`, this.style.padding = t, this.style.backgroundColor = e, this.style.verticalAlign = "top", this.style.boxSizing = "border-box", o.length === 0 ? c`
1638
+ const e = this.column.values.padding || "0px", t = this.column.values.backgroundColor || "transparent", o = this.column.contents;
1639
+ return this.dataset.columnId = this.column.id, this.style.width = `${this.widthPercent}%`, this.style.padding = e, this.style.backgroundColor = t, this.style.verticalAlign = "top", this.style.boxSizing = "border-box", o.length === 0 ? c`
1624
1640
  <div class="empty-column" data-column-id=${this.column.id}>
1625
1641
  Drag content here
1626
1642
  </div>
@@ -1667,56 +1683,56 @@ w.styles = $`
1667
1683
  opacity: 1;
1668
1684
  }
1669
1685
  `;
1670
- B([
1671
- f({ attribute: !1 })
1686
+ A([
1687
+ b({ attribute: !1 })
1672
1688
  ], w.prototype, "column", 2);
1673
- B([
1674
- f({ attribute: !1 })
1689
+ A([
1690
+ b({ attribute: !1 })
1675
1691
  ], w.prototype, "store", 1);
1676
- B([
1677
- f({ attribute: !1 })
1692
+ A([
1693
+ b({ attribute: !1 })
1678
1694
  ], w.prototype, "toolRegistry", 2);
1679
- B([
1680
- f({ type: Number })
1695
+ A([
1696
+ b({ type: Number })
1681
1697
  ], w.prototype, "widthPercent", 2);
1682
- w = B([
1698
+ w = A([
1683
1699
  k("me-column-renderer")
1684
1700
  ], w);
1685
- var Lt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, W = (t, e, o, n) => {
1686
- for (var i = n > 1 ? void 0 : n ? At(e, o) : e, r = t.length - 1, s; r >= 0; r--)
1687
- (s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
1688
- return n && i && Lt(e, o, i), i;
1701
+ var Bt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, U = (e, t, o, n) => {
1702
+ for (var i = n > 1 ? void 0 : n ? At(t, o) : t, r = e.length - 1, s; r >= 0; r--)
1703
+ (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
1704
+ return n && i && Bt(t, o, i), i;
1689
1705
  };
1690
1706
  let D = class extends v {
1691
1707
  constructor() {
1692
1708
  super(...arguments), this.storeCtrl = new S(this, ["design", "viewMode"]);
1693
1709
  }
1694
- set store(t) {
1695
- this.storeCtrl.setStore(t);
1710
+ set store(e) {
1711
+ this.storeCtrl.setStore(e);
1696
1712
  }
1697
1713
  get store() {
1698
1714
  return this.storeCtrl.store;
1699
1715
  }
1700
- handleMoveUp(t) {
1701
- t.stopPropagation();
1702
- const e = this.store.getRowIndex(this.row.id);
1703
- e > 0 && this.store.moveRow(e, e - 1);
1716
+ handleMoveUp(e) {
1717
+ e.stopPropagation();
1718
+ const t = this.store.getRowIndex(this.row.id);
1719
+ t > 0 && this.store.moveRow(t, t - 1);
1704
1720
  }
1705
- handleMoveDown(t) {
1706
- t.stopPropagation();
1707
- const e = this.store.getRowIndex(this.row.id), o = this.store.getRows().length;
1708
- e < o - 1 && this.store.moveRow(e, e + 1);
1721
+ handleMoveDown(e) {
1722
+ e.stopPropagation();
1723
+ const t = this.store.getRowIndex(this.row.id), o = this.store.getRows().length;
1724
+ t < o - 1 && this.store.moveRow(t, t + 1);
1709
1725
  }
1710
- handleDuplicate(t) {
1711
- t.stopPropagation(), this.store.duplicateRow(this.row.id);
1726
+ handleDuplicate(e) {
1727
+ e.stopPropagation(), this.store.duplicateRow(this.row.id);
1712
1728
  }
1713
- handleDelete(t) {
1714
- t.stopPropagation(), this.store.removeRow(this.row.id);
1729
+ handleDelete(e) {
1730
+ e.stopPropagation(), this.store.removeRow(this.row.id);
1715
1731
  }
1716
1732
  render() {
1717
1733
  if (!this.store) return c``;
1718
- const { row: t, store: e, toolRegistry: o } = this, n = t.values.backgroundColor || "transparent", i = t.values.columnsBackgroundColor || "transparent", r = t.values.padding || "0px", s = t.cells.reduce((b, y) => b + y, 0), l = t.values.backgroundImage, d = typeof l == "object" && l?.url ? l.url : "", p = d ? `background-image:url('${d}');background-size:${l?.cover ? "cover" : "contain"};background-position:${l?.center ? "center" : "top left"};background-repeat:${l?.repeat ? "repeat" : "no-repeat"};` : "", h = e.viewMode, g = !!t.values.hideDesktop, u = !!t.values.hideMobile, m = h === "desktop" && g || h === "mobile" && u, x = g ? "Hidden on desktop" : u ? "Hidden on mobile" : "";
1719
- return this.classList.toggle("hidden-in-view", m), this.setAttribute("draggable", "true"), this.dataset.rowId = t.id, c`
1734
+ const { row: e, store: t, toolRegistry: o } = this, n = e.values.backgroundColor || "transparent", i = e.values.columnsBackgroundColor || "transparent", r = e.values.padding || "0px", s = e.cells.reduce((f, y) => f + y, 0), l = e.values.backgroundImage, d = typeof l == "object" && l?.url ? l.url : "", p = d ? `background-image:url('${d}');background-size:${l?.cover ? "cover" : "contain"};background-position:${l?.center ? "center" : "top left"};background-repeat:${l?.repeat ? "repeat" : "no-repeat"};` : "", h = t.viewMode, u = !!e.values.hideDesktop, g = !!e.values.hideMobile, m = h === "desktop" && u || h === "mobile" && g, x = u ? "Hidden on desktop" : g ? "Hidden on mobile" : "";
1735
+ return this.classList.toggle("hidden-in-view", m), this.setAttribute("draggable", "true"), this.dataset.rowId = e.id, c`
1720
1736
  ${m ? c`<div class="row-hidden-badge">${x}</div>` : ""}
1721
1737
  <div class="row-actions">
1722
1738
  <button class="row-action-btn" @click=${this.handleMoveUp} title="Move Up">
@@ -1736,12 +1752,12 @@ let D = class extends v {
1736
1752
  class="row-wrapper"
1737
1753
  style="background-color:${n};padding:${r};${p}"
1738
1754
  >
1739
- ${t.columns.map((b, y) => {
1740
- const R = t.cells[y] / s * 100;
1755
+ ${e.columns.map((f, y) => {
1756
+ const R = e.cells[y] / s * 100;
1741
1757
  return c`
1742
1758
  <me-column-renderer
1743
- .column=${b}
1744
- .store=${e}
1759
+ .column=${f}
1760
+ .store=${t}
1745
1761
  .toolRegistry=${o}
1746
1762
  .widthPercent=${R}
1747
1763
  style="background-color:${i};"
@@ -1816,29 +1832,29 @@ D.styles = $`
1816
1832
  stroke-linejoin: round;
1817
1833
  }
1818
1834
  `;
1819
- W([
1820
- f({ attribute: !1 })
1835
+ U([
1836
+ b({ attribute: !1 })
1821
1837
  ], D.prototype, "row", 2);
1822
- W([
1823
- f({ attribute: !1 })
1838
+ U([
1839
+ b({ attribute: !1 })
1824
1840
  ], D.prototype, "store", 1);
1825
- W([
1826
- f({ attribute: !1 })
1841
+ U([
1842
+ b({ attribute: !1 })
1827
1843
  ], D.prototype, "toolRegistry", 2);
1828
- D = W([
1844
+ D = U([
1829
1845
  k("me-row-renderer")
1830
1846
  ], D);
1831
- var Bt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, G = (t, e, o, n) => {
1832
- for (var i = n > 1 ? void 0 : n ? Ht(e, o) : e, r = t.length - 1, s; r >= 0; r--)
1833
- (s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
1834
- return n && i && Bt(e, o, i), i;
1847
+ var Ot = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, K = (e, t, o, n) => {
1848
+ for (var i = n > 1 ? void 0 : n ? jt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
1849
+ (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
1850
+ return n && i && Ot(t, o, i), i;
1835
1851
  };
1836
- let I = class extends v {
1852
+ let T = class extends v {
1837
1853
  constructor() {
1838
1854
  super(...arguments), this.storeCtrl = new S(this, ["design", "viewMode"]);
1839
1855
  }
1840
- set store(t) {
1841
- this.storeCtrl.setStore(t);
1856
+ set store(e) {
1857
+ this.storeCtrl.setStore(e);
1842
1858
  }
1843
1859
  get store() {
1844
1860
  return this.storeCtrl.store;
@@ -1846,11 +1862,11 @@ let I = class extends v {
1846
1862
  handleCanvasClick() {
1847
1863
  this.store.select(null);
1848
1864
  }
1849
- setViewMode(t) {
1850
- this.store.setViewMode(t);
1865
+ setViewMode(e) {
1866
+ this.store.setViewMode(e);
1851
1867
  }
1852
1868
  render() {
1853
- const t = this.store.getRows(), e = this.store.getBodyValues(), o = e.contentWidth || "600px", n = e.backgroundColor || "#e7e7e7", i = this.store.viewMode;
1869
+ const e = this.store.getRows(), t = this.store.getBodyValues(), o = t.contentWidth || "600px", n = t.backgroundColor || "#e7e7e7", i = this.store.viewMode;
1854
1870
  return c`
1855
1871
  <div class="view-toggle">
1856
1872
  <button
@@ -1868,12 +1884,12 @@ let I = class extends v {
1868
1884
  style="max-width:${i === "mobile" ? "375px" : o};background-color:${n};"
1869
1885
  @click=${this.handleCanvasClick}
1870
1886
  >
1871
- ${t.length === 0 ? c`
1887
+ ${e.length === 0 ? c`
1872
1888
  <div class="empty-canvas">
1873
1889
  <div class="empty-icon">&#9776;</div>
1874
1890
  <div>Drag a content block here</div>
1875
1891
  </div>
1876
- ` : t.map(
1892
+ ` : e.map(
1877
1893
  (s) => c`
1878
1894
  <me-row-renderer
1879
1895
  .row=${s}
@@ -1886,7 +1902,7 @@ let I = class extends v {
1886
1902
  `;
1887
1903
  }
1888
1904
  };
1889
- I.styles = $`
1905
+ T.styles = $`
1890
1906
  :host {
1891
1907
  display: block;
1892
1908
  flex: 1;
@@ -1940,67 +1956,87 @@ I.styles = $`
1940
1956
  color: white;
1941
1957
  }
1942
1958
  `;
1943
- G([
1944
- f({ attribute: !1 })
1945
- ], I.prototype, "store", 1);
1946
- G([
1947
- f({ attribute: !1 })
1948
- ], I.prototype, "toolRegistry", 2);
1949
- I = G([
1959
+ K([
1960
+ b({ attribute: !1 })
1961
+ ], T.prototype, "store", 1);
1962
+ K([
1963
+ b({ attribute: !1 })
1964
+ ], T.prototype, "toolRegistry", 2);
1965
+ T = K([
1950
1966
  k("me-editor-canvas")
1951
- ], I);
1952
- var Ot = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, rt = (t, e, o, n) => {
1953
- for (var i = n > 1 ? void 0 : n ? jt(e, o) : e, r = t.length - 1, s; r >= 0; r--)
1954
- (s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
1955
- return n && i && Ot(e, o, i), i;
1967
+ ], T);
1968
+ var Ht = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, st = (e, t, o, n) => {
1969
+ for (var i = n > 1 ? void 0 : n ? Wt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
1970
+ (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
1971
+ return n && i && Ht(t, o, i), i;
1956
1972
  };
1957
- const it = [
1958
- { label: "Arial", value: "arial,helvetica,sans-serif" },
1959
- { label: "Helvetica", value: "helvetica,sans-serif" },
1960
- { label: "Georgia", value: "georgia,serif" },
1961
- { label: "Times New Roman", value: "'times new roman',times,serif" },
1962
- { label: "Trebuchet MS", value: "trebuchet ms,helvetica,sans-serif" },
1963
- { label: "Verdana", value: "verdana,geneva,sans-serif" },
1964
- { label: "Courier New", value: "'courier new',courier,monospace" }
1973
+ const q = [
1974
+ // System / email-safe fonts
1975
+ { label: "Arial", value: "arial,helvetica,sans-serif", url: "" },
1976
+ { label: "Helvetica", value: "helvetica,sans-serif", url: "" },
1977
+ { label: "Georgia", value: "georgia,serif", url: "" },
1978
+ { label: "Times New Roman", value: "'times new roman',times,serif", url: "" },
1979
+ { label: "Trebuchet MS", value: "trebuchet ms,helvetica,sans-serif", url: "" },
1980
+ { label: "Verdana", value: "verdana,geneva,sans-serif", url: "" },
1981
+ { label: "Courier New", value: "'courier new',courier,monospace", url: "" },
1982
+ // Google Fonts
1983
+ { label: "Lato", value: "'Lato',sans-serif", url: "https://fonts.googleapis.com/css?family=Lato:400,700" },
1984
+ { label: "Montserrat", value: "'Montserrat',sans-serif", url: "https://fonts.googleapis.com/css?family=Montserrat:400,700" },
1985
+ { label: "Old Standard TT", value: "'Old Standard TT',serif", url: "https://fonts.googleapis.com/css?family=Old+Standard+TT:400,700" },
1986
+ { label: "Open Sans", value: "'Open Sans',sans-serif", url: "https://fonts.googleapis.com/css?family=Open+Sans:400,700" },
1987
+ { label: "Pacifico", value: "'Pacifico',cursive", url: "https://fonts.googleapis.com/css?family=Pacifico:400" },
1988
+ { label: "Playfair Display", value: "'Playfair Display',serif", url: "https://fonts.googleapis.com/css?family=Playfair+Display:400,700" },
1989
+ { label: "Raleway", value: "'Raleway',sans-serif", url: "https://fonts.googleapis.com/css?family=Raleway:400,700" },
1990
+ { label: "Roboto", value: "'Roboto',sans-serif", url: "https://fonts.googleapis.com/css?family=Roboto:400,700" },
1991
+ { label: "Rubik", value: "'Rubik',sans-serif", url: "https://fonts.googleapis.com/css?family=Rubik:400,700" },
1992
+ { label: "Source Sans Pro", value: "'Source Sans Pro',sans-serif", url: "https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700" }
1965
1993
  ];
1966
1994
  let L = class extends v {
1967
1995
  constructor() {
1968
1996
  super(...arguments), this.storeCtrl = new S(this, ["design"]);
1969
1997
  }
1970
- set store(t) {
1971
- this.storeCtrl.setStore(t);
1998
+ set store(e) {
1999
+ this.storeCtrl.setStore(e);
1972
2000
  }
1973
2001
  get store() {
1974
2002
  return this.storeCtrl.store;
1975
2003
  }
1976
- update_(t, e) {
1977
- this.store.updateBodyValues({ [t]: e });
2004
+ update_(e, t) {
2005
+ this.store.updateBodyValues({ [e]: t });
1978
2006
  }
1979
- updateLinkStyle(t, e) {
2007
+ updateLinkStyle(e, t) {
1980
2008
  const o = this.store.getBodyValues().linkStyle;
1981
- this.store.updateBodyValues({ linkStyle: { ...o, [t]: e } });
1982
- }
1983
- updateFontFamily(t) {
1984
- const e = it.find((o) => o.value === t);
1985
- this.store.updateBodyValues({ fontFamily: { label: e?.label || t, value: t } });
2009
+ this.store.updateBodyValues({ linkStyle: { ...o, [e]: t } });
2010
+ }
2011
+ updateFontFamily(e) {
2012
+ const t = q.find((n) => n.value === e), o = { label: t?.label || e, value: e };
2013
+ if (t?.url) {
2014
+ o.url = t.url;
2015
+ const n = `emabuild-font-${e.replace(/[^a-z]/gi, "")}`;
2016
+ if (!document.getElementById(n)) {
2017
+ const i = document.createElement("link");
2018
+ i.id = n, i.rel = "stylesheet", i.href = t.url, document.head.appendChild(i);
2019
+ }
2020
+ }
2021
+ this.store.updateBodyValues({ fontFamily: o });
1986
2022
  }
1987
2023
  render() {
1988
- const t = this.store.getBodyValues();
2024
+ const e = this.store.getBodyValues();
1989
2025
  return c`
1990
- ${this.renderColorField("Background Color", t.backgroundColor || "#e7e7e7", (e) => this.update_("backgroundColor", e))}
2026
+ ${this.renderColorField("Background Color", e.backgroundColor || "#e7e7e7", (t) => this.update_("backgroundColor", t))}
1991
2027
 
1992
2028
  <p class="section-title" style="margin-top:16px;">Content</p>
1993
2029
  <div class="field">
1994
2030
  <label class="field-label">Content Width (px)</label>
1995
- <input class="input" type="number" .value=${parseInt(t.contentWidth || "600")} min="320" max="960" step="10"
1996
- @change=${(e) => this.update_("contentWidth", e.target.value + "px")} />
2031
+ <input class="input" type="number" .value=${parseInt(e.contentWidth || "600")} min="320" max="960" step="10"
2032
+ @change=${(t) => this.update_("contentWidth", t.target.value + "px")} />
1997
2033
  </div>
1998
2034
  <div class="field">
1999
2035
  <label class="field-label">Content Align</label>
2000
2036
  <div class="align-group">
2001
- ${["left", "center", "right"].map((e) => c`
2002
- <button class="align-btn ${t.contentAlign === e ? "active" : ""}"
2003
- @click=${() => this.update_("contentAlign", e)}>${e}</button>
2037
+ ${["left", "center", "right"].map((t) => c`
2038
+ <button class="align-btn ${e.contentAlign === t ? "active" : ""}"
2039
+ @click=${() => this.update_("contentAlign", t)}>${t}</button>
2004
2040
  `)}
2005
2041
  </div>
2006
2042
  </div>
@@ -2008,18 +2044,23 @@ let L = class extends v {
2008
2044
  <p class="section-title" style="margin-top:16px;">Typography</p>
2009
2045
  <div class="field">
2010
2046
  <label class="field-label">Font Family</label>
2011
- <select class="input" @change=${(e) => this.updateFontFamily(e.target.value)}>
2012
- ${it.map((e) => c`<option value=${e.value} ?selected=${t.fontFamily?.value === e.value}>${e.label}</option>`)}
2047
+ <select class="input" @change=${(t) => this.updateFontFamily(t.target.value)}>
2048
+ <optgroup label="System Fonts">
2049
+ ${q.filter((t) => !t.url).map((t) => c`<option value=${t.value} ?selected=${e.fontFamily?.value === t.value}>${t.label}</option>`)}
2050
+ </optgroup>
2051
+ <optgroup label="Google Fonts">
2052
+ ${q.filter((t) => !!t.url).map((t) => c`<option value=${t.value} ?selected=${e.fontFamily?.value === t.value}>${t.label}</option>`)}
2053
+ </optgroup>
2013
2054
  </select>
2014
2055
  </div>
2015
- ${this.renderColorField("Text Color", t.textColor || "#000000", (e) => this.update_("textColor", e))}
2056
+ ${this.renderColorField("Text Color", e.textColor || "#000000", (t) => this.update_("textColor", t))}
2016
2057
 
2017
2058
  <p class="section-title" style="margin-top:16px;">Links</p>
2018
- ${this.renderColorField("Link Color", t.linkStyle?.linkColor || "#0000ee", (e) => this.updateLinkStyle("linkColor", e))}
2059
+ ${this.renderColorField("Link Color", e.linkStyle?.linkColor || "#0000ee", (t) => this.updateLinkStyle("linkColor", t))}
2019
2060
  <div class="field">
2020
2061
  <label style="display:flex;align-items:center;gap:8px;font-size:12px;color:#6b7280;cursor:pointer;">
2021
- <input type="checkbox" .checked=${t.linkStyle?.linkUnderline ?? !0}
2022
- @change=${(e) => this.updateLinkStyle("linkUnderline", e.target.checked)} />
2062
+ <input type="checkbox" .checked=${e.linkStyle?.linkUnderline ?? !0}
2063
+ @change=${(t) => this.updateLinkStyle("linkUnderline", t.target.checked)} />
2023
2064
  Underline Links
2024
2065
  </label>
2025
2066
  </div>
@@ -2027,20 +2068,20 @@ let L = class extends v {
2027
2068
  <p class="section-title" style="margin-top:16px;">Email</p>
2028
2069
  <div class="field">
2029
2070
  <label class="field-label">Preheader Text</label>
2030
- <textarea class="input" .value=${t.preheaderText || ""} placeholder="Preview text shown in inbox..."
2071
+ <textarea class="input" .value=${e.preheaderText || ""} placeholder="Preview text shown in inbox..."
2031
2072
  style="min-height:60px;resize:vertical;font-family:inherit;"
2032
- @change=${(e) => this.update_("preheaderText", e.target.value)}></textarea>
2073
+ @change=${(t) => this.update_("preheaderText", t.target.value)}></textarea>
2033
2074
  </div>
2034
2075
  `;
2035
2076
  }
2036
2077
  /** Reusable color field (swatch + hex input) */
2037
- renderColorField(t, e, o) {
2078
+ renderColorField(e, t, o) {
2038
2079
  return c`
2039
2080
  <div class="field">
2040
- <label class="field-label">${t}</label>
2081
+ <label class="field-label">${e}</label>
2041
2082
  <div class="color-row">
2042
- <input class="color-swatch" type="color" .value=${e} @input=${(n) => o(n.target.value)} />
2043
- <input class="input" type="text" .value=${e} style="flex:1;" @change=${(n) => o(n.target.value)} />
2083
+ <input class="color-swatch" type="color" .value=${t} @input=${(n) => o(n.target.value)} />
2084
+ <input class="input" type="text" .value=${t} style="flex:1;" @change=${(n) => o(n.target.value)} />
2044
2085
  </div>
2045
2086
  </div>
2046
2087
  `;
@@ -2071,66 +2112,66 @@ L.styles = $`
2071
2112
  }
2072
2113
  .align-btn.active { border-color: #3b82f6; background: #eff6ff; color: #3b82f6; }
2073
2114
  `;
2074
- rt([
2075
- f({ attribute: !1 })
2115
+ st([
2116
+ b({ attribute: !1 })
2076
2117
  ], L.prototype, "store", 1);
2077
- L = rt([
2118
+ L = st([
2078
2119
  k("me-body-settings")
2079
2120
  ], L);
2080
- var Wt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, Y = (t, e, o, n) => {
2081
- for (var i = n > 1 ? void 0 : n ? Ut(e, o) : e, r = t.length - 1, s; r >= 0; r--)
2082
- (s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
2083
- return n && i && Wt(e, o, i), i;
2121
+ var Ut = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, J = (e, t, o, n) => {
2122
+ for (var i = n > 1 ? void 0 : n ? Ft(t, o) : t, r = e.length - 1, s; r >= 0; r--)
2123
+ (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
2124
+ return n && i && Ut(t, o, i), i;
2084
2125
  };
2085
- let T = class extends v {
2126
+ let I = class extends v {
2086
2127
  constructor() {
2087
2128
  super(...arguments), this.storeCtrl = new S(this, ["activeTab"]);
2088
2129
  }
2089
- set store(t) {
2090
- this.storeCtrl.setStore(t);
2130
+ set store(e) {
2131
+ this.storeCtrl.setStore(e);
2091
2132
  }
2092
2133
  get store() {
2093
2134
  return this.storeCtrl.store;
2094
2135
  }
2095
- handleDragStart(t, e) {
2096
- t.dataTransfer.setData("application/maileditor-tool", e), t.dataTransfer.effectAllowed = "copy";
2136
+ handleDragStart(e, t) {
2137
+ e.dataTransfer.setData("application/maileditor-tool", t), e.dataTransfer.effectAllowed = "copy";
2097
2138
  }
2098
- handleLayoutDragStart(t, e) {
2099
- t.dataTransfer.setData("application/maileditor-layout", JSON.stringify(e)), t.dataTransfer.effectAllowed = "copy";
2139
+ handleLayoutDragStart(e, t) {
2140
+ e.dataTransfer.setData("application/maileditor-layout", JSON.stringify(t)), e.dataTransfer.effectAllowed = "copy";
2100
2141
  }
2101
- addRowWithLayout(t) {
2102
- const e = this.store.createRow(t);
2103
- this.store.addRow(e);
2142
+ addRowWithLayout(e) {
2143
+ const t = this.store.createRow(e);
2144
+ this.store.addRow(t);
2104
2145
  }
2105
2146
  render() {
2106
- const t = this.store.activeTab, e = this.toolRegistry.getAllMeta();
2147
+ const e = this.store.activeTab, t = this.toolRegistry.getAllMeta();
2107
2148
  return c`
2108
2149
  <div class="tabs">
2109
- <button class="tab ${t === "content" ? "active" : ""}" @click=${() => this.store.setActiveTab("content")}>Content</button>
2110
- <button class="tab ${t === "blocks" ? "active" : ""}" @click=${() => this.store.setActiveTab("blocks")}>Blocks</button>
2111
- <button class="tab ${t === "body" ? "active" : ""}" @click=${() => this.store.setActiveTab("body")}>Body</button>
2150
+ <button class="tab ${e === "content" ? "active" : ""}" @click=${() => this.store.setActiveTab("content")}>Content</button>
2151
+ <button class="tab ${e === "blocks" ? "active" : ""}" @click=${() => this.store.setActiveTab("blocks")}>Blocks</button>
2152
+ <button class="tab ${e === "body" ? "active" : ""}" @click=${() => this.store.setActiveTab("body")}>Body</button>
2112
2153
  </div>
2113
2154
 
2114
2155
  <div class="tab-content">
2115
- ${t === "content" ? this.renderContentTab(e) : ""}
2116
- ${t === "blocks" ? this.renderBlocksTab() : ""}
2117
- ${t === "body" ? this.renderBodyTab() : ""}
2156
+ ${e === "content" ? this.renderContentTab(t) : ""}
2157
+ ${e === "blocks" ? this.renderBlocksTab() : ""}
2158
+ ${e === "body" ? this.renderBodyTab() : ""}
2118
2159
  </div>
2119
2160
  `;
2120
2161
  }
2121
- renderContentTab(t) {
2162
+ renderContentTab(e) {
2122
2163
  return c`
2123
2164
  <p class="section-title">Content</p>
2124
2165
  <div class="tool-grid">
2125
- ${t.map(
2126
- (e) => c`
2166
+ ${e.map(
2167
+ (t) => c`
2127
2168
  <div
2128
2169
  class="tool-item"
2129
2170
  draggable="true"
2130
- @dragstart=${(o) => this.handleDragStart(o, e.name)}
2171
+ @dragstart=${(o) => this.handleDragStart(o, t.name)}
2131
2172
  >
2132
- <div class="tool-icon">${q(e.icon)}</div>
2133
- <span>${e.label}</span>
2173
+ <div class="tool-icon">${H(t.icon)}</div>
2174
+ <span>${t.label}</span>
2134
2175
  </div>
2135
2176
  `
2136
2177
  )}
@@ -2147,17 +2188,17 @@ let T = class extends v {
2147
2188
  </div>
2148
2189
  `;
2149
2190
  }
2150
- renderLayoutOption(t, e) {
2151
- const o = t.reduce((n, i) => n + i, 0);
2191
+ renderLayoutOption(e, t) {
2192
+ const o = e.reduce((n, i) => n + i, 0);
2152
2193
  return c`
2153
2194
  <div
2154
2195
  class="layout-item"
2155
2196
  draggable="true"
2156
- @click=${() => this.addRowWithLayout(t)}
2157
- @dragstart=${(n) => this.handleLayoutDragStart(n, t)}
2158
- title=${e}
2197
+ @click=${() => this.addRowWithLayout(e)}
2198
+ @dragstart=${(n) => this.handleLayoutDragStart(n, e)}
2199
+ title=${t}
2159
2200
  >
2160
- ${t.map(
2201
+ ${e.map(
2161
2202
  (n) => c`<div class="layout-col" style="width:${n / o * 100}%;"></div>`
2162
2203
  )}
2163
2204
  </div>
@@ -2174,7 +2215,7 @@ let T = class extends v {
2174
2215
  return c`<me-body-settings .store=${this.store}></me-body-settings>`;
2175
2216
  }
2176
2217
  };
2177
- T.styles = $`
2218
+ I.styles = $`
2178
2219
  :host {
2179
2220
  display: flex;
2180
2221
  flex-direction: column;
@@ -2308,64 +2349,64 @@ T.styles = $`
2308
2349
  transition: background 0.2s ease;
2309
2350
  }
2310
2351
  `;
2311
- Y([
2312
- f({ attribute: !1 })
2313
- ], T.prototype, "store", 1);
2314
- Y([
2315
- f({ attribute: !1 })
2316
- ], T.prototype, "toolRegistry", 2);
2317
- T = Y([
2352
+ J([
2353
+ b({ attribute: !1 })
2354
+ ], I.prototype, "store", 1);
2355
+ J([
2356
+ b({ attribute: !1 })
2357
+ ], I.prototype, "toolRegistry", 2);
2358
+ I = J([
2318
2359
  k("me-editor-sidebar")
2319
- ], T);
2320
- function Ft(t, e, o) {
2321
- const n = t && /^#[0-9a-fA-F]{3,8}$/.test(t) ? t : "#000000";
2360
+ ], I);
2361
+ function Nt(e, t, o) {
2362
+ const n = e && /^#[0-9a-fA-F]{3,8}$/.test(e) ? e : "#000000";
2322
2363
  return c`
2323
2364
  <div class="prop-row">
2324
2365
  <label class="prop-label">${o}</label>
2325
2366
  <div class="prop-color">
2326
2367
  <input class="color-swatch" type="color" .value=${n}
2327
- @input=${(i) => e(i.target.value)} />
2328
- <input class="prop-input" type="text" .value=${t ?? ""} style="flex:1;"
2329
- @change=${(i) => e(i.target.value)} />
2368
+ @input=${(i) => t(i.target.value)} />
2369
+ <input class="prop-input" type="text" .value=${e ?? ""} style="flex:1;"
2370
+ @change=${(i) => t(i.target.value)} />
2330
2371
  </div>
2331
2372
  </div>
2332
2373
  `;
2333
2374
  }
2334
- function Nt(t, e, o, n) {
2375
+ function qt(e, t, o, n) {
2335
2376
  const i = n?.options || [];
2336
2377
  return c`
2337
2378
  <div class="prop-row">
2338
2379
  <label class="prop-label">${o}</label>
2339
- <select class="prop-input" @change=${(r) => e(r.target.value)}>
2340
- ${i.map((r) => c`<option value=${r.value} ?selected=${t === r.value}>${r.label}</option>`)}
2380
+ <select class="prop-input" @change=${(r) => t(r.target.value)}>
2381
+ ${i.map((r) => c`<option value=${r.value} ?selected=${e === r.value}>${r.label}</option>`)}
2341
2382
  </select>
2342
2383
  </div>
2343
2384
  `;
2344
2385
  }
2345
- function qt(t, e, o) {
2386
+ function Gt(e, t, o) {
2346
2387
  return c`
2347
2388
  <div class="prop-row">
2348
2389
  <label class="prop-label">${o}</label>
2349
2390
  <div style="display:flex;gap:2px;">
2350
2391
  ${["left", "center", "right"].map((n) => c`
2351
2392
  <button
2352
- style="flex:1;padding:6px;border:1px solid ${t === n ? "#3b82f6" : "#d1d5db"};background:${t === n ? "#eff6ff" : "white"};border-radius:4px;cursor:pointer;font-size:11px;text-transform:capitalize;color:${t === n ? "#3b82f6" : "#6b7280"};"
2353
- @click=${() => e(n)}
2393
+ style="flex:1;padding:6px;border:1px solid ${e === n ? "#3b82f6" : "#d1d5db"};background:${e === n ? "#eff6ff" : "white"};border-radius:4px;cursor:pointer;font-size:11px;text-transform:capitalize;color:${e === n ? "#3b82f6" : "#6b7280"};"
2394
+ @click=${() => t(n)}
2354
2395
  >${n}</button>
2355
2396
  `)}
2356
2397
  </div>
2357
2398
  </div>
2358
2399
  `;
2359
2400
  }
2360
- function Gt(t) {
2361
- const e = (t || "0px").split(/\s+/).map((s) => parseInt(s) || 0), o = e[0], n = e[1] ?? o, i = e[2] ?? o, r = e[3] ?? n;
2401
+ function Yt(e) {
2402
+ const t = (e || "0px").split(/\s+/).map((s) => parseInt(s) || 0), o = t[0], n = t[1] ?? o, i = t[2] ?? o, r = t[3] ?? n;
2362
2403
  return [o, n, i, r];
2363
2404
  }
2364
- function Yt(t, e, o, n) {
2365
- return t === e && e === o && o === n ? `${t}px` : t === o && e === n ? `${t}px ${e}px` : `${t}px ${e}px ${o}px ${n}px`;
2405
+ function Kt(e, t, o, n) {
2406
+ return e === t && t === o && o === n ? `${e}px` : e === o && t === n ? `${e}px ${t}px` : `${e}px ${t}px ${o}px ${n}px`;
2366
2407
  }
2367
- function Kt(t, e, o) {
2368
- const [n, i, r, s] = Gt(t), l = (p, h, g, u) => e(Yt(p, h, g, u));
2408
+ function Jt(e, t, o) {
2409
+ const [n, i, r, s] = Yt(e), l = (p, h, u, g) => t(Kt(p, h, u, g));
2369
2410
  return c`
2370
2411
  <div class="prop-row">
2371
2412
  <label class="prop-label">${o}</label>
@@ -2387,106 +2428,106 @@ function Kt(t, e, o) {
2387
2428
  </div>
2388
2429
  `;
2389
2430
  }
2390
- function Jt(t, e, o) {
2431
+ function Xt(e, t, o) {
2391
2432
  return c`
2392
2433
  <div class="prop-row">
2393
2434
  <div class="prop-toggle">
2394
- <input type="checkbox" .checked=${!!t}
2395
- @change=${(n) => e(n.target.checked)} />
2435
+ <input type="checkbox" .checked=${!!e}
2436
+ @change=${(n) => t(n.target.checked)} />
2396
2437
  <label class="prop-label" style="margin:0;">${o}</label>
2397
2438
  </div>
2398
2439
  </div>
2399
2440
  `;
2400
2441
  }
2401
- function Xt(t, e, o) {
2442
+ function Qt(e, t, o) {
2402
2443
  return c`
2403
2444
  <div class="prop-row">
2404
2445
  <label class="prop-label">${o}</label>
2405
- <input class="prop-input" type="text" .value=${t ?? ""}
2406
- @change=${(n) => e(n.target.value)} />
2446
+ <input class="prop-input" type="text" .value=${e ?? ""}
2447
+ @change=${(n) => t(n.target.value)} />
2407
2448
  </div>
2408
2449
  `;
2409
2450
  }
2410
- function Qt(t, e, o) {
2451
+ function Zt(e, t, o) {
2411
2452
  return c`
2412
2453
  <div class="prop-row">
2413
2454
  <label class="prop-label">${o}</label>
2414
2455
  <textarea class="prop-input"
2415
2456
  style="min-height:100px;font-family:'SF Mono',Menlo,monospace;font-size:12px;"
2416
- .value=${t ?? ""}
2417
- @change=${(n) => e(n.target.value)}
2457
+ .value=${e ?? ""}
2458
+ @change=${(n) => t(n.target.value)}
2418
2459
  ></textarea>
2419
2460
  </div>
2420
2461
  `;
2421
2462
  }
2422
- var Zt = Object.defineProperty, te = Object.getOwnPropertyDescriptor, K = (t, e, o, n) => {
2423
- for (var i = n > 1 ? void 0 : n ? te(e, o) : e, r = t.length - 1, s; r >= 0; r--)
2424
- (s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
2425
- return n && i && Zt(e, o, i), i;
2463
+ var te = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, X = (e, t, o, n) => {
2464
+ for (var i = n > 1 ? void 0 : n ? ee(t, o) : t, r = e.length - 1, s; r >= 0; r--)
2465
+ (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
2466
+ return n && i && te(t, o, i), i;
2426
2467
  };
2427
2468
  let P = class extends v {
2428
2469
  constructor() {
2429
2470
  super(...arguments), this.storeCtrl = new S(this, ["design", "selection"]);
2430
2471
  }
2431
- set store(t) {
2432
- this.storeCtrl.setStore(t);
2472
+ set store(e) {
2473
+ this.storeCtrl.setStore(e);
2433
2474
  }
2434
2475
  get store() {
2435
2476
  return this.storeCtrl.store;
2436
2477
  }
2437
2478
  /** Create a change handler bound to a specific content ID and property key */
2438
- onChange(t, e) {
2479
+ onChange(e, t) {
2439
2480
  return (o) => {
2440
- this.store.updateContentValues(t, { [e]: o });
2481
+ this.store.updateContentValues(e, { [t]: o });
2441
2482
  };
2442
2483
  }
2443
2484
  render() {
2444
- const t = this.store.selectedId;
2445
- if (!t)
2446
- return c`<div class="no-selection">Select an element to edit its properties</div>`;
2447
- const e = this.store.findContent(t);
2485
+ const e = this.store.selectedId;
2448
2486
  if (!e)
2449
2487
  return c`<div class="no-selection">Select an element to edit its properties</div>`;
2450
- const o = this.toolRegistry.get(e.type);
2488
+ const t = this.store.findContent(e);
2489
+ if (!t)
2490
+ return c`<div class="no-selection">Select an element to edit its properties</div>`;
2491
+ const o = this.toolRegistry.get(t.type);
2451
2492
  return o ? c`
2452
2493
  <div class="header">
2453
2494
  <p class="header-title">${o.label}</p>
2454
- <p class="header-type">${e.type}</p>
2495
+ <p class="header-type">${t.type}</p>
2455
2496
  </div>
2456
- ${Object.entries(o.options).map(([, n]) => this.renderGroup(e, n))}
2457
- ` : c`<div class="no-selection">Unknown tool: ${e.type}</div>`;
2497
+ ${Object.entries(o.options).map(([, n]) => this.renderGroup(t, n))}
2498
+ ` : c`<div class="no-selection">Unknown tool: ${t.type}</div>`;
2458
2499
  }
2459
- renderGroup(t, e) {
2500
+ renderGroup(e, t) {
2460
2501
  return c`
2461
2502
  <div class="group">
2462
- <div class="group-title">${e.title}</div>
2503
+ <div class="group-title">${t.title}</div>
2463
2504
  <div class="group-body">
2464
- ${Object.entries(e.options).map(
2465
- ([o, n]) => this.renderWidget(t, o, n)
2505
+ ${Object.entries(t.options).map(
2506
+ ([o, n]) => this.renderWidget(e, o, n)
2466
2507
  )}
2467
2508
  </div>
2468
2509
  </div>
2469
2510
  `;
2470
2511
  }
2471
2512
  /** Delegate to the correct widget function based on the property's widget type */
2472
- renderWidget(t, e, o) {
2473
- const n = t.values[e] ?? o.defaultValue, i = this.onChange(t.id, e);
2513
+ renderWidget(e, t, o) {
2514
+ const n = e.values[t] ?? o.defaultValue, i = this.onChange(e.id, t);
2474
2515
  switch (o.widget) {
2475
2516
  case "color_picker":
2476
- return Ft(n, i, o.label);
2517
+ return Nt(n, i, o.label);
2477
2518
  case "toggle":
2478
- return Jt(n, i, o.label);
2519
+ return Xt(n, i, o.label);
2479
2520
  case "rich_text":
2480
- return Qt(n, i, o.label);
2521
+ return Zt(n, i, o.label);
2481
2522
  case "dropdown":
2482
- return Nt(n, i, o.label, o.widgetParams);
2523
+ return qt(n, i, o.label, o.widgetParams);
2483
2524
  case "alignment":
2484
- return qt(n, i, o.label);
2525
+ return Gt(n, i, o.label);
2485
2526
  case "padding":
2486
- return Kt(n, i, o.label);
2527
+ return Jt(n, i, o.label);
2487
2528
  case "text":
2488
2529
  default:
2489
- return Xt(n, i, o.label);
2530
+ return Qt(n, i, o.label);
2490
2531
  }
2491
2532
  }
2492
2533
  };
@@ -2524,38 +2565,38 @@ P.styles = $`
2524
2565
  .color-swatch { width: 28px; height: 28px; border-radius: 4px; border: 1px solid #d1d5db; cursor: pointer; padding: 0; }
2525
2566
  textarea.prop-input { min-height: 80px; resize: vertical; font-family: monospace; }
2526
2567
  `;
2527
- K([
2528
- f({ attribute: !1 })
2568
+ X([
2569
+ b({ attribute: !1 })
2529
2570
  ], P.prototype, "store", 1);
2530
- K([
2531
- f({ attribute: !1 })
2571
+ X([
2572
+ b({ attribute: !1 })
2532
2573
  ], P.prototype, "toolRegistry", 2);
2533
- P = K([
2574
+ P = X([
2534
2575
  k("me-property-panel")
2535
2576
  ], P);
2536
- var ee = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, st = (t, e, o, n) => {
2537
- for (var i = n > 1 ? void 0 : n ? oe(e, o) : e, r = t.length - 1, s; r >= 0; r--)
2538
- (s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
2539
- return n && i && ee(e, o, i), i;
2577
+ var oe = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, lt = (e, t, o, n) => {
2578
+ for (var i = n > 1 ? void 0 : n ? ne(t, o) : t, r = e.length - 1, s; r >= 0; r--)
2579
+ (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
2580
+ return n && i && oe(t, o, i), i;
2540
2581
  };
2541
- let A = class extends v {
2582
+ let B = class extends v {
2542
2583
  constructor() {
2543
- super(...arguments), this.options = {}, this.store = new ft(), this.toolRegistry = new mt(), this.dragManager = null, this.callbacks = /* @__PURE__ */ new Map(), this.unsubscribe = null, this._handleKeydown = (t) => {
2544
- const e = t.metaKey || t.ctrlKey, n = t.composedPath().some((i) => {
2584
+ super(...arguments), this.options = {}, this.store = new mt(), this.toolRegistry = new xt(), this.dragManager = null, this.callbacks = /* @__PURE__ */ new Map(), this.unsubscribe = null, this._handleKeydown = (e) => {
2585
+ const t = e.metaKey || e.ctrlKey, n = e.composedPath().some((i) => {
2545
2586
  const r = i?.tagName;
2546
2587
  return r === "INPUT" || r === "TEXTAREA" || r === "SELECT";
2547
2588
  });
2548
- n && !e || (e && t.key === "z" && !t.shiftKey ? (t.preventDefault(), this.store.undo()) : e && (t.key === "y" || t.key === "z" && t.shiftKey) ? (t.preventDefault(), this.store.redo()) : (t.key === "Delete" || t.key === "Backspace") && this.store.selectedId && !n ? (t.preventDefault(), this.store.removeContent(this.store.selectedId)) : t.key === "Escape" && this.store.select(null));
2589
+ n && !t || (t && e.key === "z" && !e.shiftKey ? (e.preventDefault(), this.store.undo()) : t && (e.key === "y" || e.key === "z" && e.shiftKey) ? (e.preventDefault(), this.store.redo()) : (e.key === "Delete" || e.key === "Backspace") && this.store.selectedId && !n ? (e.preventDefault(), this.store.removeContent(this.store.selectedId)) : e.key === "Escape" && this.store.select(null));
2549
2590
  };
2550
2591
  }
2551
2592
  connectedCallback() {
2552
2593
  super.connectedCallback(), this.registerBuiltInTools(), this.applyOptions(), this.setAttribute("tabindex", "0"), this.addEventListener("keydown", this._handleKeydown);
2553
2594
  }
2554
2595
  firstUpdated() {
2555
- this.dragManager = new xt(this.store, this.toolRegistry, this.shadowRoot), this.dragManager.attach(), this.store.events.on("design:loaded", (t) => {
2556
- this.dispatchEvent(new CustomEvent("design:loaded", { detail: t, bubbles: !0, composed: !0 }));
2557
- }), this.store.events.on("design:updated", (t) => {
2558
- this.dispatchEvent(new CustomEvent("design:updated", { detail: t, bubbles: !0, composed: !0 }));
2596
+ this.dragManager = new yt(this.store, this.toolRegistry, this.shadowRoot), this.dragManager.attach(), this.store.events.on("design:loaded", (e) => {
2597
+ this.dispatchEvent(new CustomEvent("design:loaded", { detail: e, bubbles: !0, composed: !0 }));
2598
+ }), this.store.events.on("design:updated", (e) => {
2599
+ this.dispatchEvent(new CustomEvent("design:updated", { detail: e, bubbles: !0, composed: !0 }));
2559
2600
  }), this.dispatchEvent(new CustomEvent("editor:ready", { bubbles: !0, composed: !0 })), this.preloadLazyTools();
2560
2601
  }
2561
2602
  disconnectedCallback() {
@@ -2564,41 +2605,41 @@ let A = class extends v {
2564
2605
  // ----------------------------------------------------------
2565
2606
  // Public API — public API
2566
2607
  // ----------------------------------------------------------
2567
- loadDesign(t) {
2568
- this.store.loadDesign(t);
2608
+ loadDesign(e) {
2609
+ this.store.loadDesign(e);
2569
2610
  }
2570
- saveDesign(t) {
2571
- t(structuredClone(this.store.getDesign()));
2611
+ saveDesign(e) {
2612
+ e(structuredClone(this.store.getDesign()));
2572
2613
  }
2573
- exportHtml(t, e) {
2614
+ exportHtml(e, t) {
2574
2615
  const o = this.store.getDesign(), n = /* @__PURE__ */ new Set();
2575
2616
  for (const r of o.body.rows)
2576
2617
  for (const s of r.columns)
2577
2618
  for (const l of s.contents)
2578
2619
  n.add(l.type);
2579
2620
  const i = Array.from(n).filter((r) => !this.toolRegistry.isLoaded(r)).map((r) => this.toolRegistry.ensureLoaded(r));
2580
- i.length > 0 ? Promise.all(i).then(() => this.doExport(o, t, e)) : this.doExport(o, t, e);
2621
+ i.length > 0 ? Promise.all(i).then(() => this.doExport(o, e, t)) : this.doExport(o, e, t);
2581
2622
  }
2582
- doExport(t, e, o) {
2623
+ doExport(e, t, o) {
2583
2624
  const n = /* @__PURE__ */ new Map();
2584
2625
  for (const i of this.toolRegistry.getAll())
2585
2626
  n.set(i.name, (r, s) => i.renderer.renderHtml(r, s));
2586
- e(Tt(t, n, o));
2627
+ t(Pt(e, n, o));
2587
2628
  }
2588
- async exportHtmlAsync(t) {
2589
- return new Promise((e) => this.exportHtml(e, t));
2629
+ async exportHtmlAsync(e) {
2630
+ return new Promise((t) => this.exportHtml(t, e));
2590
2631
  }
2591
- registerTool(t) {
2592
- this.toolRegistry.register(t), this.requestUpdate();
2632
+ registerTool(e) {
2633
+ this.toolRegistry.register(e), this.requestUpdate();
2593
2634
  }
2594
- registerPropertyEditor(t, e) {
2635
+ registerPropertyEditor(e, t) {
2595
2636
  }
2596
- registerTab(t) {
2637
+ registerTab(e) {
2597
2638
  }
2598
- registerCallback(t, e) {
2599
- this.callbacks.set(t, e);
2639
+ registerCallback(e, t) {
2640
+ this.callbacks.set(e, t);
2600
2641
  }
2601
- setMergeTags(t) {
2642
+ setMergeTags(e) {
2602
2643
  }
2603
2644
  undo() {
2604
2645
  this.store.undo();
@@ -2606,8 +2647,8 @@ let A = class extends v {
2606
2647
  redo() {
2607
2648
  this.store.redo();
2608
2649
  }
2609
- setBodyValues(t) {
2610
- this.store.updateBodyValues(t);
2650
+ setBodyValues(e) {
2651
+ this.store.updateBodyValues(e);
2611
2652
  }
2612
2653
  // ----------------------------------------------------------
2613
2654
  // Internal
@@ -2618,17 +2659,17 @@ let A = class extends v {
2618
2659
  * Falls back to setTimeout(1000) for browsers without idle callback support.
2619
2660
  */
2620
2661
  preloadLazyTools() {
2621
- const t = window.requestIdleCallback ?? ((e) => setTimeout(e, 1e3));
2622
- for (const { meta: e } of ot)
2623
- t(() => {
2624
- this.toolRegistry.ensureLoaded(e.name);
2662
+ const e = window.requestIdleCallback ?? ((t) => setTimeout(t, 1e3));
2663
+ for (const { meta: t } of it)
2664
+ e(() => {
2665
+ this.toolRegistry.ensureLoaded(t.name);
2625
2666
  });
2626
2667
  }
2627
2668
  registerBuiltInTools() {
2628
- for (const t of St)
2629
- this.toolRegistry.register(t);
2630
- for (const { meta: t, loader: e } of ot)
2631
- this.toolRegistry.registerLazy(t, e);
2669
+ for (const e of Rt)
2670
+ this.toolRegistry.register(e);
2671
+ for (const { meta: e, loader: t } of it)
2672
+ this.toolRegistry.registerLazy(e, t);
2632
2673
  }
2633
2674
  applyOptions() {
2634
2675
  this.options.design && this.store.loadDesign(this.options.design);
@@ -2650,7 +2691,7 @@ let A = class extends v {
2650
2691
  `;
2651
2692
  }
2652
2693
  };
2653
- A.styles = $`
2694
+ B.styles = $`
2654
2695
  :host {
2655
2696
  display: flex;
2656
2697
  width: 100%;
@@ -2665,31 +2706,31 @@ A.styles = $`
2665
2706
  }
2666
2707
  * { box-sizing: border-box; }
2667
2708
  `;
2668
- st([
2669
- f({ type: Object })
2670
- ], A.prototype, "options", 2);
2671
- A = st([
2709
+ lt([
2710
+ b({ type: Object })
2711
+ ], B.prototype, "options", 2);
2712
+ B = lt([
2672
2713
  k("mail-editor")
2673
- ], A);
2674
- function C(t, e) {
2675
- customElements.get(t) || customElements.define(t, e);
2714
+ ], B);
2715
+ function C(e, t) {
2716
+ customElements.get(e) || customElements.define(e, t);
2676
2717
  }
2677
- C("mail-editor", A);
2678
- C("me-editor-canvas", I);
2718
+ C("mail-editor", B);
2719
+ C("me-editor-canvas", T);
2679
2720
  C("me-row-renderer", D);
2680
2721
  C("me-column-renderer", w);
2681
2722
  C("me-content-renderer", _);
2682
- C("me-editor-sidebar", T);
2723
+ C("me-editor-sidebar", I);
2683
2724
  C("me-body-settings", L);
2684
2725
  C("me-property-panel", P);
2685
2726
  const ae = customElements.get("mail-editor") !== void 0;
2686
2727
  export {
2687
2728
  ae as E,
2688
- A as M,
2689
- mt as T,
2690
- ft as a,
2729
+ B as M,
2730
+ xt as T,
2731
+ mt as a,
2691
2732
  V as e,
2692
- se as j,
2733
+ le as j,
2693
2734
  a as s
2694
2735
  };
2695
- //# sourceMappingURL=index-CZt184D3.js.map
2736
+ //# sourceMappingURL=index-BQJRD2VW.js.map