@emabuild/core 0.1.0 → 0.1.2

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 (32) hide show
  1. package/dist/canvas/content-renderer.d.ts +14 -0
  2. package/dist/canvas/content-renderer.d.ts.map +1 -1
  3. package/dist/canvas/inline-toolbar.d.ts +13 -0
  4. package/dist/canvas/inline-toolbar.d.ts.map +1 -0
  5. package/dist/{form-tool-DSXsWpjQ.js → form-tool-At5Uq7es.js} +2 -2
  6. package/dist/{form-tool-DSXsWpjQ.js.map → form-tool-At5Uq7es.js.map} +1 -1
  7. package/dist/{html-tool-Be4HAhoj.js → html-tool-BxuBzfKP.js} +2 -2
  8. package/dist/{html-tool-Be4HAhoj.js.map → html-tool-BxuBzfKP.js.map} +1 -1
  9. package/dist/{index-CZt184D3.js → index-BTE3G6Ph.js} +1137 -845
  10. package/dist/index-BTE3G6Ph.js.map +1 -0
  11. package/dist/index.js +1 -1
  12. package/dist/{menu-tool-HPxxeiRV.js → menu-tool-BZDYFgXW.js} +2 -2
  13. package/dist/{menu-tool-HPxxeiRV.js.map → menu-tool-BZDYFgXW.js.map} +1 -1
  14. package/dist/register-elements.d.ts.map +1 -1
  15. package/dist/sidebar/body-settings.d.ts.map +1 -1
  16. package/dist/{social-tool-bc46FNgk.js → social-tool-BY75hT3n.js} +2 -2
  17. package/dist/{social-tool-bc46FNgk.js.map → social-tool-BY75hT3n.js.map} +1 -1
  18. package/dist/{table-tool-LzRcAPFb.js → table-tool-Ep89kXMr.js} +2 -2
  19. package/dist/{table-tool-LzRcAPFb.js.map → table-tool-Ep89kXMr.js.map} +1 -1
  20. package/dist/{timer-tool-GPhdsvRE.js → timer-tool-Dj9QeWtN.js} +2 -2
  21. package/dist/{timer-tool-GPhdsvRE.js.map → timer-tool-Dj9QeWtN.js.map} +1 -1
  22. package/dist/tools/built-in/heading-tool.d.ts.map +1 -1
  23. package/dist/tools/built-in/image-tool.d.ts.map +1 -1
  24. package/dist/tools/built-in/text-tool.d.ts.map +1 -1
  25. package/dist/tools/helpers/index.d.ts +1 -1
  26. package/dist/tools/helpers/index.d.ts.map +1 -1
  27. package/dist/tools/helpers/value-extractor.d.ts +6 -0
  28. package/dist/tools/helpers/value-extractor.d.ts.map +1 -1
  29. package/dist/{video-tool-CPjCWbTX.js → video-tool-DiIJBQpM.js} +2 -2
  30. package/dist/{video-tool-CPjCWbTX.js.map → video-tool-DiIJBQpM.js.map} +1 -1
  31. package/package.json +3 -3
  32. package/dist/index-CZt184D3.js.map +0 -1
@@ -1,53 +1,53 @@
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 = {};
1
+ import { html as p, LitElement as $, css as k } from "lit";
2
+ import { property as b, customElement as C, state as pt } from "lit/decorators.js";
3
+ import { unsafeHTML as U } from "lit/directives/unsafe-html.js";
4
+ function ht() {
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 ut {
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 gt {
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 ft() {
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 bt(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 mt(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 N(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 j(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 W(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((s) => s.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 xt(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 yt(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 q(e, t) {
201
+ return e.body.rows.findIndex((o) => o.id === t);
202
202
  }
203
- class ft {
203
+ class wt {
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 gt(), this.counterManager = ht(), this.subscribers = /* @__PURE__ */ new Set(), this.channelSubscribers = /* @__PURE__ */ new Map(), this.events = new ut(), this._selectedId = null, this._hoveredId = null, this._viewMode = "desktop", this._activeTab = "content", this.design = ft();
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,25 +219,25 @@ 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
- if (i) for (const r of i) o.add(r);
240
+ if (i) for (const s of i) o.add(s);
241
241
  }
242
242
  o.forEach((n) => n());
243
243
  }
@@ -278,185 +278,185 @@ 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 = q(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 = N(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");
330
330
  n.id = `u_row_${i}`, n.values._meta = { htmlID: n.id, htmlClassNames: "u_row" };
331
- for (const s of n.columns) {
332
- const l = this.counterManager.next("u_column");
333
- s.id = `u_column_${l}`, s.values._meta = { htmlID: s.id, htmlClassNames: "u_column" };
334
- for (const d of s.contents) {
335
- const p = this.counterManager.next(`u_content_${d.type}`);
336
- d.id = `u_content_${d.type}_${p}`, d.values._meta = { htmlID: d.id, htmlClassNames: `u_content_${d.type}` };
331
+ for (const r of n.columns) {
332
+ const a = this.counterManager.next("u_column");
333
+ r.id = `u_column_${a}`, r.values._meta = { htmlID: r.id, htmlClassNames: "u_column" };
334
+ for (const d of r.contents) {
335
+ const c = this.counterManager.next(`u_content_${d.type}`);
336
+ d.id = `u_content_${d.type}_${c}`, d.values._meta = { htmlID: d.id, htmlClassNames: `u_content_${d.type}` };
337
337
  }
338
338
  }
339
- const r = F(this.design, e);
340
- this.design.body.rows.splice(r + 1, 0, n), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("row_added", n);
339
+ const s = q(this.design, t);
340
+ this.design.body.rows.splice(s + 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 q(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 = N(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 = j(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 = j(this.design, t);
361
361
  if (!i) return;
362
362
  this.history.push(this.design);
363
- const r = structuredClone(o);
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);
363
+ const s = structuredClone(o);
364
+ n !== void 0 && n >= 0 && n <= i.contents.length ? i.contents.splice(n, 0, s) : i.contents.push(s), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("content_added", s);
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((s) => s.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 = W(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 = W(this.design, t);
385
385
  if (!i) return;
386
386
  this.history.push(this.design);
387
- for (const s of this.design.body.rows)
388
- for (const l of s.columns) {
389
- const d = l.contents.findIndex((p) => p.id === e);
387
+ for (const r of this.design.body.rows)
388
+ for (const a of r.columns) {
389
+ const d = a.contents.findIndex((c) => c.id === t);
390
390
  if (d !== -1) {
391
- l.contents.splice(d, 1);
391
+ a.contents.splice(d, 1);
392
392
  break;
393
393
  }
394
394
  }
395
- const r = H(this.design, o);
396
- r && r.contents.splice(n, 0, i), this.notifyChannels("design"), this.emitUpdate("content_reordered");
395
+ const s = j(this.design, o);
396
+ s && s.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 = W(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);
405
- if (r !== -1) {
404
+ const s = i.contents.findIndex((r) => r.id === t);
405
+ if (s !== -1) {
406
406
  this.history.push(this.design);
407
- const s = structuredClone(o), l = this.counterManager.next(`u_content_${o.type}`);
408
- s.id = `u_content_${o.type}_${l}`, s.values._meta = { htmlID: s.id, htmlClassNames: `u_content_${o.type}` }, i.contents.splice(r + 1, 0, s), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("content_added", s);
407
+ const r = structuredClone(o), a = this.counterManager.next(`u_content_${o.type}`);
408
+ r.id = `u_content_${o.type}_${a}`, r.values._meta = { htmlID: r.id, htmlClassNames: `u_content_${o.type}` }, i.contents.splice(s + 1, 0, r), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("content_added", r);
409
409
  return;
410
410
  }
411
411
  }
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 N(this.design, t);
421
421
  }
422
- findColumn(e) {
423
- return H(this.design, e);
422
+ findColumn(t) {
423
+ return j(this.design, t);
424
424
  }
425
- findContent(e) {
426
- return O(this.design, e);
425
+ findContent(t) {
426
+ return W(this.design, t);
427
427
  }
428
- findParentColumn(e) {
429
- return gt(this.design, e);
428
+ findParentColumn(t) {
429
+ return xt(this.design, t);
430
430
  }
431
- findParentRow(e) {
432
- return bt(this.design, e);
431
+ findParentRow(t) {
432
+ return yt(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 = bt(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 = mt(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 vt {
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,207 +473,207 @@ 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))
529
- for (const [r, s] of Object.entries(i.options))
530
- r in n || (n[r] = s.defaultValue);
529
+ for (const [s, r] of Object.entries(i.options))
530
+ s in n || (n[s] = r.defaultValue);
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
- const E = {
538
+ const z = {
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 Z(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();
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, {
563
+ function tt(e, t, o, n, i = "4px") {
564
+ e.parentNode !== t && (e.remove(), t.appendChild(e));
565
+ const r = (t instanceof ShadowRoot ? t.host : t).getBoundingClientRect();
566
+ let a;
567
+ o.length === 0 || n === 0 ? a = o.length === 0 ? 0 : o[0].getBoundingClientRect().top - r.top : n >= o.length ? a = o[o.length - 1].getBoundingClientRect().bottom - r.top : a = o[n].getBoundingClientRect().top - r.top, Object.assign(e.style, {
568
568
  display: "block",
569
- top: `${l}px`,
569
+ top: `${a}px`,
570
570
  left: i,
571
571
  right: i,
572
572
  width: "auto"
573
573
  });
574
574
  }
575
- function M(t) {
576
- t && (t.style.display = "none");
575
+ function I(e) {
576
+ e && (e.style.display = "none");
577
577
  }
578
- function N(t, e) {
579
- const o = (t instanceof ShadowRoot, t.children);
578
+ function K(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 && K(i.shadowRoot, t), i.children?.length && K(i, t);
583
583
  }
584
584
  }
585
- function Q(t, e) {
585
+ function et(e, t) {
586
586
  const o = [];
587
- return N(t, (n) => {
588
- n.matches?.(e) && o.push(n);
587
+ return K(e, (n) => {
588
+ n.matches?.(t) && o.push(n);
589
589
  }), o;
590
590
  }
591
- class xt {
592
- constructor(e, o, n) {
591
+ class $t {
592
+ constructor(t, o, n) {
593
593
  this.currentDrop = null, this.contentIndicator = null, this.rowIndicator = null, this.onDragOver = (i) => {
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
- !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()));
594
+ const s = i.dataTransfer?.types || [], r = s.includes("application/maileditor-tool"), a = s.includes("application/maileditor-layout"), d = s.includes("application/maileditor-content") || !!z.draggingContentId;
595
+ !r && !d && !a || (i.preventDefault(), i.dataTransfer.dropEffect = r || a ? "copy" : "move", a ? (this.currentDrop = this.findRowDropTarget(i.clientY), I(this.contentIndicator), this.showRowIndicator()) : (this.currentDrop = this.findContentDropTarget(i.clientX, i.clientY), I(this.rowIndicator), this.showContentIndicator()));
596
596
  }, this.onDrop = (i) => {
597
597
  i.preventDefault(), this.hideAllIndicators();
598
- const r = this.currentDrop, s = i.dataTransfer?.getData("application/maileditor-layout");
599
- if (s) {
600
- this.handleLayoutDrop(JSON.parse(s), r), this.reset();
598
+ const s = this.currentDrop, r = i.dataTransfer?.getData("application/maileditor-layout");
599
+ if (r) {
600
+ this.handleLayoutDrop(JSON.parse(r), s), this.reset();
601
601
  return;
602
602
  }
603
- const l = i.dataTransfer?.getData("application/maileditor-tool");
604
- if (l) {
605
- this.handleToolDrop(l, r), this.reset();
603
+ const a = i.dataTransfer?.getData("application/maileditor-tool");
604
+ if (a) {
605
+ this.handleToolDrop(a, s), this.reset();
606
606
  return;
607
607
  }
608
- const d = i.dataTransfer?.getData("application/maileditor-content") || E.draggingContentId;
609
- d && this.handleContentDrop(d, r), this.reset();
608
+ const d = i.dataTransfer?.getData("application/maileditor-content") || z.draggingContentId;
609
+ d && this.handleContentDrop(d, s), this.reset();
610
610
  }, this.onDragEnd = () => {
611
611
  this.hideAllIndicators(), this.reset();
612
612
  }, this.onDragLeave = (i) => {
613
- const r = i.relatedTarget;
614
- (!r || !this.root.contains(r)) && (this.hideAllIndicators(), this.currentDrop = null);
615
- }, this.store = e, this.toolRegistry = o, this.root = n;
613
+ const s = i.relatedTarget;
614
+ (!s || !this.root.contains(s)) && (this.hideAllIndicators(), this.currentDrop = null);
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 = Z("#3b82f6"), this.rowIndicator = Z("#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);
638
- this.store.addContent(n.columns[0].id, r), this.store.select(r.id);
637
+ const i = this.toolRegistry.getDefaultValues(t), s = this.store.createContent(t, i);
638
+ this.store.addContent(n.columns[0].id, s), this.store.select(s.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 };
651
- for (let s = 0; s < n.length; s++) {
652
- const l = n[s].getBoundingClientRect().bottom, d = Math.abs(e - l);
653
- d < i && (i = d, r = { type: "row", rowIndex: s + 1, y: l });
654
- }
655
- return r;
656
- }
657
- findContentDropTarget(e, o) {
658
- const n = Q(this.root, "me-column-renderer");
659
- let i = null, r = 1 / 0;
660
- for (const s of n) {
661
- const l = s.dataset.columnId;
662
- if (!l || !s.shadowRoot) continue;
663
- const d = s.getBoundingClientRect();
664
- if (e < d.left || e > d.right) continue;
665
- const p = Array.from(s.shadowRoot.querySelectorAll("me-content-renderer"));
666
- if (p.length === 0) {
650
+ let i = Math.abs(t - n[0].getBoundingClientRect().top), s = { type: "row", rowIndex: 0, y: n[0].getBoundingClientRect().top };
651
+ for (let r = 0; r < n.length; r++) {
652
+ const a = n[r].getBoundingClientRect().bottom, d = Math.abs(t - a);
653
+ d < i && (i = d, s = { type: "row", rowIndex: r + 1, y: a });
654
+ }
655
+ return s;
656
+ }
657
+ findContentDropTarget(t, o) {
658
+ const n = et(this.root, "me-column-renderer");
659
+ let i = null, s = 1 / 0;
660
+ for (const r of n) {
661
+ const a = r.dataset.columnId;
662
+ if (!a || !r.shadowRoot) continue;
663
+ const d = r.getBoundingClientRect();
664
+ if (t < d.left || t > d.right) continue;
665
+ const c = Array.from(r.shadowRoot.querySelectorAll("me-content-renderer"));
666
+ if (c.length === 0) {
667
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 });
668
+ u < s && (s = u, i = { type: "content", columnId: a, contentIndex: 0, y: d.top + d.height / 2 });
669
669
  continue;
670
670
  }
671
- const h = p[0].getBoundingClientRect().top;
671
+ const h = c[0].getBoundingClientRect().top;
672
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 });
673
+ g < s && (s = g, i = { type: "content", columnId: a, contentIndex: 0, y: h });
674
+ for (let u = 0; u < c.length; u++) {
675
+ const f = c[u].getBoundingClientRect(), y = c[u + 1]?.getBoundingClientRect(), x = y ? (f.bottom + y.top) / 2 : f.bottom;
676
+ g = Math.abs(o - x), g < s && (s = g, i = { type: "content", columnId: a, contentIndex: u + 1, y: x });
677
677
  }
678
678
  }
679
679
  return i;
@@ -681,106 +681,122 @@ class xt {
681
681
  // ── Indicator Positioning ──────────────────────────────────
682
682
  showContentIndicator() {
683
683
  if (!this.contentIndicator || !this.currentDrop?.columnId) {
684
- M(this.contentIndicator);
684
+ I(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 = et(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
+ tt(this.contentIndicator, o.shadowRoot, n, this.currentDrop.contentIndex ?? 0, "4px");
691
691
  }
692
692
  showRowIndicator() {
693
693
  if (!this.rowIndicator || !this.currentDrop) {
694
- M(this.rowIndicator);
694
+ I(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
+ tt(this.rowIndicator, o, n, this.currentDrop.rowIndex ?? 0, "0");
701
701
  }
702
702
  hideAllIndicators() {
703
- M(this.contentIndicator), M(this.rowIndicator);
703
+ I(this.contentIndicator), I(this.rowIndicator);
704
704
  }
705
705
  reset() {
706
- this.currentDrop = null, E.reset();
706
+ this.currentDrop = null, z.reset();
707
707
  }
708
708
  }
709
- function a(t, e, o = "") {
710
- const n = t[e];
709
+ function l(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 ot(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 nt(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 kt(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: l(e, "href"),
737
+ target: l(e, "target", "_blank")
738
738
  };
739
739
  }
740
- function et(t, e = "") {
741
- const o = t.text;
740
+ function it(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
- const i = JSON.parse(n), r = [], s = (l) => {
747
- typeof l.text == "string" && r.push(l.text), l.type === "linebreak" && r.push("<br/>");
748
- const d = l.children;
749
- d && d.forEach(s);
746
+ const i = JSON.parse(n), s = [], r = (a) => {
747
+ typeof a.text == "string" && s.push(a.text), a.type === "linebreak" && s.push("<br/>");
748
+ const d = a.children;
749
+ d && d.forEach(r);
750
750
  };
751
- if (s(i.root || i), r.length > 0) return r.join("");
751
+ if (r(i.root || i), s.length > 0) return s.join("");
752
752
  } catch {
753
753
  }
754
- return e;
754
+ return t;
755
755
  }
756
- function se(t, e) {
757
- if (typeof t != "string") return e;
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, s = n.url;
761
+ if (s && typeof document < "u") {
762
+ const r = `emabuild-font-${i.replace(/[^a-z]/gi, "")}`;
763
+ if (!document.getElementById(r)) {
764
+ const a = document.createElement("link");
765
+ a.id = r, a.rel = "stylesheet", a.href = s, document.head.appendChild(a);
766
+ }
767
+ }
768
+ return i;
769
+ }
770
+ return t;
771
+ }
772
+ function me(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 L(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
- <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}
783
+ <tbody><tr><td style="${`padding:${o};font-family:arial,helvetica,sans-serif;${i}`}" align="${n}">
784
+ ${e}
769
785
  </td></tr></tbody>
770
786
  </table>`;
771
787
  }
772
- function wt(t, e, o) {
773
- const { bgColor: n, textColor: i, fontSize: r, fontWeight: s, borderRadius: l } = o, d = parseInt(l) || 0;
788
+ function Ct(e, t, o) {
789
+ const { bgColor: n, textColor: i, fontSize: s, fontWeight: r, borderRadius: a } = o, d = parseInt(a) || 0;
774
790
  if (d <= 0) return "";
775
- const p = Math.round(d / 20 * 100);
791
+ const c = 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="${c}%" 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:${s};font-weight:${r};">${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");
847
- return c`
848
- <div style="padding:${e};background-color:${o};color:${n};line-height:${i};word-break:break-word;">
849
- ${q(r)}
861
+ renderEditor(e) {
862
+ const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "transparent"), n = l(e, "color", "inherit"), i = l(e, "lineHeight", "140%"), s = Y(e), r = l(e, "text");
863
+ return p`
864
+ <div style="padding:${t};background-color:${o};color:${n};line-height:${i};font-family:${s};word-break:break-word;">
865
+ ${U(r)}
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 = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor"), n = l(e, "color", "#000000"), i = l(e, "lineHeight", "140%"), s = l(e, "textAlign", "left"), r = l(e, "text"), a = o ? `background-color:${o};` : "", d = `<div style="font-size:14px;color:${n};line-height:${i};text-align:${s};">${r}</div>`;
871
+ return L(d, { padding: t, extraTdStyle: a });
856
872
  }
857
873
  }
858
- }, $t = {
874
+ }, Dt = {
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");
961
- return c`
962
- <div style="padding:${e};font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};">
963
- ${l}
975
+ renderEditor(e) {
976
+ const t = l(e, "containerPadding", "10px"), o = l(e, "fontSize", "22px"), n = l(e, "color", "#000000"), i = l(e, "textAlign", "left"), s = l(e, "fontWeight", "700"), r = l(e, "lineHeight", "140%"), a = Y(e), d = it(e, "Heading");
977
+ return p`
978
+ <div style="padding:${t};font-size:${o};color:${n};text-align:${i};font-weight:${s};line-height:${r};font-family:${a};">
979
+ ${U(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 = l(e, "containerPadding", "10px"), o = l(e, "fontSize", "22px"), n = l(e, "color", "#000000"), i = l(e, "textAlign", "left"), s = l(e, "fontWeight", "700"), r = l(e, "lineHeight", "140%"), a = l(e, "letterSpacing", "normal"), d = Y(e), c = l(e, "headingType", "h1"), h = it(e, "Heading"), g = `<${c} style="margin:0;font-size:${o};color:${n};text-align:${i};font-weight:${s};line-height:${r};letter-spacing:${a};font-family:${d};">${h}</${c}>`;
985
+ return L(g, { padding: t });
970
986
  }
971
987
  }
972
- }, kt = {
988
+ }, St = {
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 = l(e, "containerPadding", "10px"), o = l(e, "color", "#374151"), n = l(e, "lineHeight", "160%");
1032
+ return p`<div style="padding:${t};color:${o};line-height:${n};word-break:break-word;">${U(l(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 = l(e, "containerPadding", "10px"), o = l(e, "color", "#374151"), n = l(e, "lineHeight", "160%"), i = l(e, "textAlign", "left"), s = l(e, "letterSpacing", "normal"), r = `<div style="font-size:14px;color:${o};line-height:${n};text-align:${i};letter-spacing:${s};word-wrap:break-word;">${l(e, "text")}</div>`;
1036
+ return L(r, { padding: t });
1021
1037
  }
1022
1038
  }
1023
- }, Ct = {
1039
+ }, Rt = {
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,19 @@ 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 = l(e, "containerPadding", "10px"), o = ot(e.src), n = l(e, "alt"), s = nt(e.src).maxWidth || l(e, "width", "100%"), r = l(e, "borderRadius", "0px"), a = l(e, "textAlign", l(e, "align", "center"));
1101
+ return o ? p`<div style="padding:${t};text-align:${a};"><img src=${o} alt=${n} style="display:inline-block;max-width:100%;width:${s};border-radius:${r};border:0;" /></div>` : p`<div style="padding:${t};text-align:${a};"><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;
1089
- return V(m, { padding: o, align: p });
1103
+ renderHtml(e, t) {
1104
+ const o = l(e, "containerPadding", "10px"), n = ot(e.src), i = l(e, "alt"), s = kt(e), r = nt(e.src), a = r.maxWidth || l(e, "width", "100%"), d = l(e, "borderRadius", "0px"), c = l(e, "textAlign", l(e, "align", "center"));
1105
+ let h;
1106
+ a.includes("%") ? h = Math.round(t.columnWidth * (parseFloat(a) / 100)) : a === "auto" ? h = r.width || t.columnWidth : h = parseInt(a) || t.columnWidth;
1107
+ const g = d !== "0px" ? `border-radius:${d};` : "", u = `<img align="${c}" border="0" src="${n}" alt="${i}" title="${i}" style="display:block;border:0;height:auto;width:100%;max-width:${h}px;${g}" width="${h}" />`, f = s.href ? `<a href="${s.href}" target="${s.target}" style="text-decoration:none;">${u}</a>` : u;
1108
+ return L(f, { padding: o, align: c });
1090
1109
  }
1091
1110
  }
1092
- }, _t = {
1111
+ }, Tt = {
1093
1112
  name: "button",
1094
1113
  label: "Button",
1095
1114
  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 +1194,25 @@ const vt = {
1175
1194
  containerPadding: "10px"
1176
1195
  },
1177
1196
  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};`;
1180
- return c`
1181
- <div style="padding:${e};text-align:${p};">
1182
- <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>
1197
+ renderEditor(e) {
1198
+ const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "#3b82f6"), n = l(e, "textColor", "#ffffff"), i = l(e, "fontSize", "14px"), s = l(e, "fontWeight", "700"), r = l(e, "borderRadius", "4px"), a = l(e, "buttonPadding", "10px 20px"), d = l(e, "text", "Click Me"), c = l(e, "textAlign", "center"), h = l(e, "buttonWidth", "auto"), g = l(e, "borderWidth", "0px"), u = l(e, "borderColor", o), f = g !== "0px" ? `border:${g} solid ${u};` : "border:none;", y = h === "auto" ? "display:inline-block;" : `display:block;width:${h};`;
1199
+ return p`
1200
+ <div style="padding:${t};text-align:${c};">
1201
+ <a style="${y}background-color:${o};color:${n};font-size:${i};font-weight:${s};border-radius:${r};padding:${a};text-decoration:none;text-align:center;${f}cursor:pointer;font-family:arial,helvetica,sans-serif;">${d}</a>
1183
1202
  </div>
1184
1203
  `;
1185
1204
  },
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}
1188
- <!--[if !mso]><!-->` : "<!--[if !mso]><!-->", z = `<div align="${p}">
1189
- ${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>
1205
+ renderHtml(e) {
1206
+ const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "#3b82f6"), n = l(e, "textColor", "#ffffff"), i = l(e, "fontSize", "14px"), s = l(e, "fontWeight", "700"), r = l(e, "borderRadius", "4px"), a = l(e, "buttonPadding", "10px 20px"), d = l(e, "text", "Click Me"), c = l(e, "textAlign", "center"), h = l(e, "href", "#"), g = l(e, "target", "_blank"), u = l(e, "borderWidth", "0px"), f = l(e, "borderColor", o), y = u !== "0px" ? `border:${u} solid ${f};` : "border:none;", x = Ct(d, h, { bgColor: o, textColor: n, fontSize: i, fontWeight: s, borderRadius: r }), m = x ? `${x}
1207
+ <!--[if !mso]><!-->` : "<!--[if !mso]><!-->", v = `<div align="${c}">
1208
+ ${m}
1209
+ <a href="${h}" target="${g}" style="display:inline-block;text-decoration:none;text-align:center;color:${n};background-color:${o};border-radius:${r};font-size:${i};font-weight:${s};padding:${a};font-family:arial,helvetica,sans-serif;${y}mso-border-alt:none;"><span style="line-height:120%;">${d}</span></a>
1191
1210
  <!--<![endif]-->
1192
1211
  </div>`;
1193
- return V(z, { padding: e, align: p });
1212
+ return L(v, { padding: t, align: c });
1194
1213
  }
1195
1214
  }
1196
- }, Dt = {
1215
+ }, It = {
1197
1216
  name: "divider",
1198
1217
  label: "Divider",
1199
1218
  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,54 +1258,54 @@ const vt = {
1239
1258
  containerPadding: "10px"
1240
1259
  },
1241
1260
  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>`;
1261
+ renderEditor(e) {
1262
+ const t = l(e, "containerPadding", "10px"), o = l(e, "width", "100%"), n = `${l(e, "borderTopWidth", "1px")} ${l(e, "borderTopStyle", "solid")} ${l(e, "borderTopColor", "#cccccc")}`;
1263
+ return p`<div style="padding:${t};"><div style="border-top:${n};width:${o};margin:0 auto;"></div></div>`;
1245
1264
  },
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" });
1265
+ renderHtml(e) {
1266
+ const t = l(e, "containerPadding", "10px"), o = l(e, "width", "100%"), n = `${l(e, "borderTopWidth", "1px")} ${l(e, "borderTopStyle", "solid")} ${l(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>`;
1267
+ return L(i, { padding: t, align: "center" });
1249
1268
  }
1250
1269
  }
1251
- }, St = [
1252
- vt,
1253
- $t,
1254
- kt,
1255
- Ct,
1270
+ }, Mt = [
1256
1271
  _t,
1257
- Dt
1258
- ], ot = [
1272
+ Dt,
1273
+ St,
1274
+ Rt,
1275
+ Tt,
1276
+ It
1277
+ ], st = [
1259
1278
  {
1260
1279
  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)
1280
+ loader: () => import("./html-tool-BxuBzfKP.js").then((e) => e.htmlTool)
1262
1281
  },
1263
1282
  {
1264
1283
  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)
1284
+ loader: () => import("./social-tool-BY75hT3n.js").then((e) => e.socialTool)
1266
1285
  },
1267
1286
  {
1268
1287
  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)
1288
+ loader: () => import("./menu-tool-BZDYFgXW.js").then((e) => e.menuTool)
1270
1289
  },
1271
1290
  {
1272
1291
  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)
1292
+ loader: () => import("./video-tool-DiIJBQpM.js").then((e) => e.videoTool)
1274
1293
  },
1275
1294
  {
1276
1295
  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)
1296
+ loader: () => import("./timer-tool-Dj9QeWtN.js").then((e) => e.timerTool)
1278
1297
  },
1279
1298
  {
1280
1299
  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)
1300
+ loader: () => import("./table-tool-Ep89kXMr.js").then((e) => e.tableTool)
1282
1301
  },
1283
1302
  {
1284
1303
  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)
1304
+ loader: () => import("./form-tool-At5Uq7es.js").then((e) => e.formTool)
1286
1305
  }
1287
1306
  ];
1288
- function Rt(t, e, o) {
1289
- 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>` : "";
1307
+ function Pt(e, t, o) {
1308
+ const n = o.backgroundColor || "#e7e7e7", i = o.contentWidth || "600px", s = o.fontFamily?.value || "arial,helvetica,sans-serif", r = o.textColor || "#000000", a = o.preheaderText || "" || "&zwnj;", d = `<div style="display:none;font-size:1px;color:${n};line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">${a}${"&zwnj;&nbsp;".repeat(80)}</div>`;
1290
1309
  return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1291
1310
  <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
1292
1311
  <head>
@@ -1305,31 +1324,29 @@ function Rt(t, e, o) {
1305
1324
  </o:OfficeDocumentSettings>
1306
1325
  </xml></noscript>
1307
1326
  <style type="text/css">
1308
- table, td, th { font-family: ${r} !important; }
1327
+ table, td, th { font-family: ${s} !important; }
1309
1328
  </style>
1310
1329
  <![endif]-->
1311
1330
  <!--[if !mso]><!-->
1312
1331
  <style type="text/css">
1313
- ${e}
1332
+ ${t}
1314
1333
  </style>
1315
1334
  <!--<![endif]-->
1316
1335
  <style type="text/css">
1317
1336
  body { margin: 0; padding: 0; }
1318
1337
  table, tr, td { vertical-align: top; border-collapse: collapse; }
1319
1338
  p { margin: 0; }
1320
- .ie-container table, .mso-container table { table-layout: fixed; }
1321
- * { line-height: inherit; }
1322
1339
  a[x-apple-data-detectors='true'] { color: inherit !important; text-decoration: none !important; }
1323
1340
  </style>
1324
1341
  </head>
1325
- <body class="clean-body u_body" style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:${n};color:${s};">
1342
+ <body class="clean-body u_body" style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:${n};color:${r};">
1326
1343
  ${d}
1327
- <table id="u_body" style="border-collapse:collapse;table-layout:fixed;border-spacing:0;mso-table-lspace:0pt;mso-table-rspace:0pt;vertical-align:top;min-width:320px;margin:0 auto;background-color:${n};width:100%;" cellpadding="0" cellspacing="0" border="0">
1344
+ <table id="u_body" role="presentation" style="border-collapse:collapse;border-spacing:0;margin:0 auto;background-color:${n};width:100%;" cellpadding="0" cellspacing="0" border="0">
1328
1345
  <tbody>
1329
- <tr style="vertical-align:top;">
1330
- <td style="word-break:break-word;border-collapse:collapse !important;vertical-align:top;">
1346
+ <tr>
1347
+ <td style="vertical-align:top;">
1331
1348
  <!--[if (mso)|(IE)]><table width="${parseInt(i)}" align="center" cellpadding="0" cellspacing="0" border="0"><tr><td><![endif]-->
1332
- ${t}
1349
+ ${e}
1333
1350
  <!--[if (mso)|(IE)]></td></tr></table><![endif]-->
1334
1351
  </td>
1335
1352
  </tr>
@@ -1338,74 +1355,63 @@ function Rt(t, e, o) {
1338
1355
  </body>
1339
1356
  </html>`;
1340
1357
  }
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;
1358
+ function Et(e, t, o) {
1359
+ const n = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", s = e.values.columnsBackgroundColor || "", r = e.values.padding || "0px", a = e.cells.reduce((m, w) => m + w, 0), d = i ? `background-color:${i};` : "", c = e.values.backgroundImage;
1360
+ let h = "";
1361
+ if (c?.url) {
1362
+ const m = c.repeat === !0 || c.repeat === "repeat" ? "repeat" : "no-repeat", w = c.cover === !0 ? "cover" : c.fullWidth === !0 ? "100% auto" : "auto", v = c.center !== !1 ? "center top" : "left top";
1363
+ h = `background-image:url('${c.url}');background-repeat:${m};background-position:${v};background-size:${w};`;
1364
+ }
1365
+ const g = e.columns.length > 1, u = e.columns.map((m, w) => {
1366
+ const v = Math.round(e.cells[w] / a * n);
1367
+ return { colHtml: Lt(m, v, s, t, o), colWidthPx: v };
1368
+ });
1369
+ let f;
1347
1370
  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);
1350
- return `<!--[if (mso)|(IE)]><td align="center" width="${z}" style="width:${z}px;padding:0px;border:none;" valign="top"><![endif]-->
1351
- ${at}
1352
- <!--[if (mso)|(IE)]></td><![endif]-->`;
1353
- });
1354
- u = `<!--[if (mso)|(IE)]><table role="presentation" width="${n}" cellpadding="0" cellspacing="0" border="0"><tr>${b.join(`
1355
- `)}</tr></table><![endif]-->
1356
-
1357
- <!--[if !mso]><!-->
1358
- <div style="max-width:${n}px;margin:0 auto;">
1359
- ${h.join(`
1360
- `)}
1361
- </div>
1362
- <!--<![endif]-->`;
1371
+ const m = u.map(
1372
+ ({ colHtml: w, colWidthPx: v }) => `<!--[if (mso)|(IE)]><td align="center" width="${v}" style="width:${v}px;padding:0px;" valign="top"><![endif]-->${w}<!--[if (mso)|(IE)]></td><![endif]-->`
1373
+ );
1374
+ f = `<!--[if (mso)|(IE)]><table role="presentation" width="${n}" cellpadding="0" cellspacing="0" border="0"><tr><![endif]-->${m.join("")}<!--[if (mso)|(IE)]></tr></table><![endif]-->`;
1363
1375
  } else
1364
- u = h.join(`
1365
- `);
1366
- const m = t.values.hideDesktop ? " u_hide_desktop" : "", x = t.values.hideMobile ? " u_hide_mobile" : "";
1367
- return `<div class="u_row${m}${x}" style="padding:${s};${d}${p}">
1368
- <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
- <div style="border-collapse:collapse;display:table;width:100%;height:100%;background-color:transparent;">
1370
- ${u}
1371
- </div>
1372
- </div>
1376
+ f = u.map(({ colHtml: m }) => m).join("");
1377
+ const y = e.values.hideDesktop ? " u_hide_desktop" : "", x = e.values.hideMobile ? " u_hide_mobile" : "";
1378
+ return `<div class="u_row${y}${x}" style="padding:${r};${d}${h}">
1379
+ <div style="margin:0 auto;max-width:${n}px;${g ? "font-size:0;" : ""}text-align:center;">${f}</div>
1373
1380
  </div>`;
1374
1381
  }
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) => {
1382
+ function Lt(e, t, o, n, i) {
1383
+ const s = e.values.backgroundColor || o || "", r = e.values.padding || "0px", a = e.values.borderRadius || "0px", d = s ? `background-color:${s};` : "", c = e.contents.map((h) => {
1377
1384
  const g = i.get(h.type);
1378
1385
  if (!g) return `<!-- unknown tool: ${h.type} -->`;
1379
1386
  const u = {
1380
- columnWidth: e,
1387
+ columnWidth: t,
1381
1388
  displayMode: "email",
1382
1389
  contentWidth: parseInt(n.contentWidth || "600"),
1383
1390
  bodyValues: n
1384
1391
  };
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;
1392
+ let f = g(h.values, u);
1393
+ const y = !!h.values.hideDesktop, x = !!h.values.hideMobile;
1394
+ return (y || x) && (f = `<div class="${[y && "u_hide_desktop", x && "u_hide_mobile"].filter(Boolean).join(" ")}">${f}</div>`), f;
1388
1395
  }).join(`
1389
1396
  `);
1390
- return `<div class="u_column" style="max-width:${e}px;min-width:${Math.min(e, 320)}px;display:table-cell;vertical-align:top;">
1391
- <div style="height:100%;width:100% !important;border-radius:${l};-webkit-border-radius:${l};${d}">
1392
- <div style="box-sizing:border-box;height:100%;padding:${s};border:none;border-radius:${l};-webkit-border-radius:${l};">
1393
- ${p || '<!--[if (!mso)&(!IE)]><!--><div style="height:0;min-height:1px;font-size:0;">&nbsp;</div><!--<![endif]-->'}
1397
+ return `<div class="u_column" style="display:inline-block;vertical-align:top;width:${t}px;max-width:${t}px;font-size:14px;text-align:left;">
1398
+ <div style="width:100%;${d}${a !== "0px" ? `border-radius:${a};` : ""}">
1399
+ <div style="padding:${r};">
1400
+ ${c || "&nbsp;"}
1394
1401
  </div>
1395
1402
  </div>
1396
1403
  </div>`;
1397
1404
  }
1398
- function It(t) {
1405
+ function zt(e) {
1399
1406
  return `
1400
- @media only screen and (min-width: ${t + 20}px) {
1401
- .u_row .u_column { display: table-cell; }
1407
+ @media only screen and (min-width: ${e + 20}px) {
1408
+ .u_row .u_column { display: inline-block !important; }
1402
1409
  }
1403
1410
 
1404
- @media only screen and (max-width: ${t + 20}px) {
1411
+ @media only screen and (max-width: ${e + 20}px) {
1405
1412
  .u_row .u_column {
1406
1413
  display: block !important;
1407
1414
  width: 100% !important;
1408
- min-width: 320px !important;
1409
1415
  max-width: 100% !important;
1410
1416
  }
1411
1417
  .u_row {
@@ -1435,47 +1441,73 @@ function It(t) {
1435
1441
  .u_hide_desktop { display: block !important; }
1436
1442
  .u_hide_mobile { display: block !important; }
1437
1443
 
1438
- @media only screen and (max-width: ${t + 20}px) {
1444
+ @media only screen and (max-width: ${e + 20}px) {
1439
1445
  .u_hide_desktop { display: block !important; }
1440
1446
  .u_hide_mobile { display: none !important; }
1441
1447
  }
1442
1448
 
1443
- @media only screen and (min-width: ${t + 21}px) {
1449
+ @media only screen and (min-width: ${e + 21}px) {
1444
1450
  .u_hide_desktop { display: none !important; }
1445
1451
  .u_hide_mobile { display: block !important; }
1446
1452
  }`;
1447
1453
  }
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(`
1450
- `), s = It(i);
1451
- let l = Rt(r, s, n);
1454
+ const Vt = [
1455
+ "box-sizing",
1456
+ "float",
1457
+ "overflow-wrap",
1458
+ "word-break",
1459
+ "word-wrap",
1460
+ "outline",
1461
+ "cursor",
1462
+ "transition",
1463
+ "animation",
1464
+ "transform",
1465
+ "position",
1466
+ "z-index",
1467
+ "display:\\s*flex",
1468
+ "display:\\s*grid",
1469
+ "gap"
1470
+ ], At = new RegExp(
1471
+ `(?:;\\s*|^\\s*)(${Vt.join("|")})\\s*:[^;]*;?`,
1472
+ "gi"
1473
+ ), Bt = /var\(--[^)]*\)/gi;
1474
+ function Ot(e) {
1475
+ return e.replace(/style="([^"]*)"/gi, (t, o) => {
1476
+ let n = o;
1477
+ return n = n.replace(At, ""), n = n.replace(Bt, "inherit"), n = n.replace(/;\s*;/g, ";").replace(/^\s*;\s*/, "").replace(/;\s*$/, "").trim(), n ? `style="${n}"` : "";
1478
+ });
1479
+ }
1480
+ function Ht(e, t, o) {
1481
+ const n = e.body.values, i = parseInt(n.contentWidth || "600"), s = e.body.rows.map((u) => Et(u, n, t)).join(`
1482
+ `), r = zt(i), a = Ot(s);
1483
+ let d = Pt(a, r, n);
1452
1484
  if (o?.mergeTags)
1453
- for (const [g, u] of Object.entries(o.mergeTags))
1454
- l = l.replaceAll(`{{${g}}}`, u);
1455
- const d = l.match(/<body[^>]*>([\s\S]*)<\/body>/i), p = l.match(/<style[^>]*>([\s\S]*?)<\/style>/gi), h = [];
1456
- return n.fontFamily?.url && h.push(n.fontFamily.url), {
1457
- design: structuredClone(t),
1458
- html: l,
1485
+ for (const [u, f] of Object.entries(o.mergeTags))
1486
+ d = d.replaceAll(`{{${u}}}`, f);
1487
+ const c = d.match(/<body[^>]*>([\s\S]*)<\/body>/i), h = d.match(/<style[^>]*>([\s\S]*?)<\/style>/gi), g = [];
1488
+ return n.fontFamily?.url && g.push(n.fontFamily.url), {
1489
+ design: structuredClone(e),
1490
+ html: d,
1459
1491
  chunks: {
1460
- body: d?.[1] ?? r,
1461
- css: p?.map((g) => g.replace(/<\/?style[^>]*>/gi, "")).join(`
1462
- `) ?? s,
1463
- fonts: h,
1492
+ body: c?.[1] ?? s,
1493
+ css: h?.map((u) => u.replace(/<\/?style[^>]*>/gi, "")).join(`
1494
+ `) ?? r,
1495
+ fonts: g,
1464
1496
  js: ""
1465
1497
  }
1466
1498
  };
1467
1499
  }
1468
- class S {
1500
+ class T {
1469
1501
  /**
1470
1502
  * @param host - The Lit component that owns this controller
1471
1503
  * @param channels - Which store channels to subscribe to
1472
1504
  */
1473
- constructor(e, o) {
1474
- this.store = null, this.host = e, this.channels = o, e.addController(this);
1505
+ constructor(t, o) {
1506
+ this.store = null, this.host = t, this.channels = o, t.addController(this);
1475
1507
  }
1476
1508
  /** Set or change the store reference. Re-subscribes automatically. */
1477
- setStore(e) {
1478
- this.store !== e && (this.unsub?.(), this.store = e, this.subscribe());
1509
+ setStore(t) {
1510
+ this.store !== t && (this.unsub?.(), this.store = t, this.subscribe());
1479
1511
  }
1480
1512
  hostConnected() {
1481
1513
  this.subscribe();
@@ -1489,27 +1521,184 @@ class S {
1489
1521
  }));
1490
1522
  }
1491
1523
  }
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;
1524
+ var jt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, at = (e, t, o, n) => {
1525
+ for (var i = n > 1 ? void 0 : n ? Wt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1526
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1527
+ return n && i && jt(t, o, i), i;
1528
+ };
1529
+ let V = class extends $ {
1530
+ constructor() {
1531
+ super(...arguments), this.visible = !1;
1532
+ }
1533
+ exec(e, t) {
1534
+ document.execCommand(e, !1, t), this.requestUpdate();
1535
+ }
1536
+ isActive(e) {
1537
+ try {
1538
+ return document.queryCommandState(e);
1539
+ } catch {
1540
+ return !1;
1541
+ }
1542
+ }
1543
+ /** Position the toolbar above a given element */
1544
+ positionAbove(e) {
1545
+ const t = e.getBoundingClientRect();
1546
+ this.style.left = `${t.left + t.width / 2}px`, this.style.top = `${t.top - 8}px`, this.style.transform = "translate(-50%, -100%)", this.classList.add("visible");
1547
+ }
1548
+ hide() {
1549
+ this.classList.remove("visible");
1550
+ }
1551
+ handleLink() {
1552
+ if (this.isActive("createLink"))
1553
+ this.exec("unlink");
1554
+ else {
1555
+ const e = prompt("Enter URL:");
1556
+ e && this.exec("createLink", e);
1557
+ }
1558
+ }
1559
+ render() {
1560
+ return p`
1561
+ <div class="toolbar" @mousedown=${(e) => e.preventDefault()}>
1562
+ <button class="btn ${this.isActive("bold") ? "active" : ""}"
1563
+ @click=${() => this.exec("bold")} title="Bold (Ctrl+B)">
1564
+ <strong>B</strong>
1565
+ </button>
1566
+ <button class="btn ${this.isActive("italic") ? "active" : ""}"
1567
+ @click=${() => this.exec("italic")} title="Italic (Ctrl+I)">
1568
+ <em>I</em>
1569
+ </button>
1570
+ <button class="btn ${this.isActive("underline") ? "active" : ""}"
1571
+ @click=${() => this.exec("underline")} title="Underline (Ctrl+U)">
1572
+ <u>U</u>
1573
+ </button>
1574
+ <button class="btn ${this.isActive("strikeThrough") ? "active" : ""}"
1575
+ @click=${() => this.exec("strikeThrough")} title="Strikethrough">
1576
+ <s>S</s>
1577
+ </button>
1578
+ <div class="separator"></div>
1579
+ <button class="btn ${this.isActive("createLink") ? "active" : ""}"
1580
+ @click=${this.handleLink} title="Link">
1581
+ <svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
1582
+ </button>
1583
+ <div class="separator"></div>
1584
+ <button class="btn" @click=${() => this.exec("justifyLeft")} title="Align Left">
1585
+ <svg viewBox="0 0 24 24"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="15" y2="12"/><line x1="3" y1="18" x2="18" y2="18"/></svg>
1586
+ </button>
1587
+ <button class="btn" @click=${() => this.exec("justifyCenter")} title="Align Center">
1588
+ <svg viewBox="0 0 24 24"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>
1589
+ </button>
1590
+ <button class="btn" @click=${() => this.exec("justifyRight")} title="Align Right">
1591
+ <svg viewBox="0 0 24 24"><line x1="3" y1="6" x2="21" y2="6"/><line x1="9" y1="12" x2="21" y2="12"/><line x1="6" y1="18" x2="21" y2="18"/></svg>
1592
+ </button>
1593
+ </div>
1594
+ `;
1595
+ }
1596
+ };
1597
+ V.styles = k`
1598
+ :host {
1599
+ position: fixed;
1600
+ z-index: 10000;
1601
+ display: none;
1602
+ }
1603
+ :host(.visible) {
1604
+ display: block;
1605
+ animation: fadeIn 0.15s ease;
1606
+ }
1607
+ @keyframes fadeIn {
1608
+ from { opacity: 0; transform: translateY(4px); }
1609
+ to { opacity: 1; transform: translateY(0); }
1610
+ }
1611
+ .toolbar {
1612
+ display: flex;
1613
+ align-items: center;
1614
+ gap: 2px;
1615
+ padding: 4px 6px;
1616
+ background: #1f2937;
1617
+ border-radius: 8px;
1618
+ box-shadow: 0 4px 16px rgba(0,0,0,0.2);
1619
+ }
1620
+ .btn {
1621
+ width: 32px;
1622
+ height: 32px;
1623
+ display: flex;
1624
+ align-items: center;
1625
+ justify-content: center;
1626
+ background: none;
1627
+ border: none;
1628
+ color: #d1d5db;
1629
+ cursor: pointer;
1630
+ border-radius: 4px;
1631
+ font-size: 14px;
1632
+ font-weight: 600;
1633
+ transition: all 0.1s ease;
1634
+ padding: 0;
1635
+ }
1636
+ .btn:hover { background: rgba(255,255,255,0.1); color: white; }
1637
+ .btn.active { background: rgba(59,130,246,0.3); color: #93c5fd; }
1638
+ .separator {
1639
+ width: 1px;
1640
+ height: 20px;
1641
+ background: #374151;
1642
+ margin: 0 2px;
1643
+ }
1644
+ .btn svg {
1645
+ width: 16px;
1646
+ height: 16px;
1647
+ stroke: currentColor;
1648
+ fill: none;
1649
+ stroke-width: 2;
1650
+ stroke-linecap: round;
1651
+ stroke-linejoin: round;
1652
+ }
1653
+ `;
1654
+ at([
1655
+ b({ type: Boolean })
1656
+ ], V.prototype, "visible", 2);
1657
+ V = at([
1658
+ C("me-inline-toolbar")
1659
+ ], V);
1660
+ var Ut = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, O = (e, t, o, n) => {
1661
+ for (var i = n > 1 ? void 0 : n ? Ft(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1662
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1663
+ return n && i && Ut(t, o, i), i;
1496
1664
  };
1497
- let _ = class extends v {
1665
+ const rt = /* @__PURE__ */ new Set(["text", "heading", "paragraph"]);
1666
+ function lt(e) {
1667
+ return e === "html" ? "html" : "text";
1668
+ }
1669
+ let D = class extends $ {
1498
1670
  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);
1671
+ super(...arguments), this.storeCtrl = new T(this, ["design", "selection", "hover", "viewMode"]), this.editing = !1, this.toolbar = null, this.editableEl = null, this.saveDebounceTimer = null, this._onDragStart = (e) => {
1672
+ if (this.editing) {
1673
+ e.preventDefault();
1674
+ return;
1675
+ }
1676
+ e.dataTransfer.setData("application/maileditor-content", this.content.id), e.dataTransfer.effectAllowed = "move", this.style.opacity = "0.4", z.startContentDrag(this.content.id);
1501
1677
  }, this._onDragEnd = () => {
1502
- this.style.opacity = "1", E.reset();
1678
+ this.style.opacity = "1", z.reset();
1679
+ }, this.handleInlineInput = () => {
1680
+ this.saveDebounceTimer && clearTimeout(this.saveDebounceTimer), this.saveDebounceTimer = setTimeout(() => this.saveInlineContent(), 500), this.showToolbar();
1681
+ }, this.handleInlineBlur = (e) => {
1682
+ const t = e.relatedTarget;
1683
+ t && (t.closest("me-inline-toolbar") || this.toolbar?.contains(t)) || setTimeout(() => {
1684
+ !this.shadowRoot?.activeElement && !this.toolbar?.matches(":hover") && this.stopEditing();
1685
+ }, 150);
1686
+ }, this.handleInlineKeydown = (e) => {
1687
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.stopEditing()), (e.key === "Delete" || e.key === "Backspace") && e.stopPropagation();
1503
1688
  };
1504
1689
  }
1505
- set store(t) {
1506
- this.storeCtrl.setStore(t);
1690
+ set store(e) {
1691
+ this.storeCtrl.setStore(e);
1507
1692
  }
1508
1693
  get store() {
1509
1694
  return this.storeCtrl.store;
1510
1695
  }
1511
- handleClick(t) {
1512
- t.stopPropagation(), this.store.select(this.content.id);
1696
+ // ── Event handlers ───────────────────────────────────────
1697
+ handleClick(e) {
1698
+ e.stopPropagation(), this.editing || this.store.select(this.content.id);
1699
+ }
1700
+ handleDblClick(e) {
1701
+ e.stopPropagation(), rt.has(this.content.type) && this.startEditing();
1513
1702
  }
1514
1703
  handleMouseEnter() {
1515
1704
  this.store.hover(this.content.id);
@@ -1517,58 +1706,124 @@ let _ = class extends v {
1517
1706
  handleMouseLeave() {
1518
1707
  this.store.hover(null);
1519
1708
  }
1520
- handleDelete(t) {
1521
- t.stopPropagation(), this.store.removeContent(this.content.id);
1709
+ handleDelete(e) {
1710
+ e.stopPropagation(), this.store.removeContent(this.content.id);
1522
1711
  }
1523
- handleDuplicate(t) {
1524
- t.stopPropagation(), this.store.duplicateContent(this.content.id);
1712
+ handleDuplicate(e) {
1713
+ e.stopPropagation(), this.store.duplicateContent(this.content.id);
1525
1714
  }
1715
+ // ── Inline editing ───────────────────────────────────────
1716
+ startEditing() {
1717
+ this.editing = !0, this.classList.add("editing"), this.setAttribute("draggable", "false"), this.updateComplete.then(() => {
1718
+ const e = this.shadowRoot?.querySelector(".inline-editable");
1719
+ if (e) {
1720
+ this.editableEl = e, e.focus();
1721
+ const t = window.getSelection(), o = document.createRange();
1722
+ o.selectNodeContents(e), o.collapse(!1), t?.removeAllRanges(), t?.addRange(o), this.showToolbar();
1723
+ }
1724
+ });
1725
+ }
1726
+ stopEditing() {
1727
+ this.editing && (this.saveInlineContent(), this.editing = !1, this.classList.remove("editing"), this.setAttribute("draggable", "true"), this.editableEl = null, this.toolbar?.hide());
1728
+ }
1729
+ saveInlineContent() {
1730
+ if (!this.editableEl) return;
1731
+ const e = this.editableEl.innerHTML, t = lt(this.content.type), o = this.content.values[t];
1732
+ e !== o && this.store.updateContentValues(this.content.id, { [t]: e });
1733
+ }
1734
+ showToolbar() {
1735
+ this.toolbar || (this.toolbar = document.createElement("me-inline-toolbar"), document.body.appendChild(this.toolbar)), this.editableEl && this.toolbar.positionAbove(this.editableEl);
1736
+ }
1737
+ // ── Lifecycle ────────────────────────────────────────────
1526
1738
  connectedCallback() {
1527
1739
  super.connectedCallback(), this.addEventListener("dragstart", this._onDragStart), this.addEventListener("dragend", this._onDragEnd);
1528
1740
  }
1529
1741
  disconnectedCallback() {
1530
- super.disconnectedCallback(), this.removeEventListener("dragstart", this._onDragStart), this.removeEventListener("dragend", this._onDragEnd);
1742
+ super.disconnectedCallback(), this.removeEventListener("dragstart", this._onDragStart), this.removeEventListener("dragend", this._onDragEnd), this.toolbar?.remove(), this.toolbar = null, this.saveDebounceTimer && clearTimeout(this.saveDebounceTimer);
1531
1743
  }
1744
+ // ── Render ───────────────────────────────────────────────
1532
1745
  render() {
1533
- 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;
1536
- const s = this.toolRegistry.get(this.content.type);
1537
- if (!s && this.toolRegistry.has(this.content.type))
1538
- 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
- const l = s?.renderer.renderEditor(this.content.values, {
1540
- isSelected: t,
1541
- isHovered: e,
1746
+ if (!this.store) return p``;
1747
+ 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, s = o === "desktop" && n || o === "mobile" && i;
1748
+ this.classList.toggle("selected", e && !this.editing), this.classList.toggle("hovered", t && !this.editing), this.classList.toggle("hidden-in-view", s), this.editing || this.setAttribute("draggable", "true"), this.dataset.contentId = this.content.id, this.editing && !e && this.stopEditing();
1749
+ const r = this.toolRegistry.get(this.content.type);
1750
+ if (!r && this.toolRegistry.has(this.content.type))
1751
+ return this.toolRegistry.ensureLoaded(this.content.type).then(() => this.requestUpdate()), p`<div style="padding:16px;text-align:center;color:#9ca3af;font-size:13px;">Loading ${this.content.type}...</div>`;
1752
+ const a = n ? "Hidden on desktop" : i ? "Hidden on mobile" : "", d = rt.has(this.content.type);
1753
+ if (this.editing && d && r) {
1754
+ const h = this.content.values, g = lt(this.content.type), u = h[g] || "", f = this.getInlineStyles(h);
1755
+ return p`
1756
+ <div class="content-wrapper">
1757
+ <div
1758
+ class="inline-editable"
1759
+ contenteditable="true"
1760
+ style=${f}
1761
+ .innerHTML=${u}
1762
+ @input=${this.handleInlineInput}
1763
+ @blur=${this.handleInlineBlur}
1764
+ @keydown=${this.handleInlineKeydown}
1765
+ ></div>
1766
+ </div>
1767
+ `;
1768
+ }
1769
+ const c = r?.renderer.renderEditor(this.content.values, {
1770
+ isSelected: e,
1771
+ isHovered: t,
1542
1772
  columnWidth: 600,
1543
1773
  displayMode: "email"
1544
1774
  });
1545
- return c`
1546
- ${r ? c`<div class="hidden-badge">${n ? "Hidden on desktop" : i ? "Hidden on mobile" : ""}</div>` : ""}
1775
+ return p`
1776
+ ${s ? p`<div class="hidden-badge">${a}</div>` : ""}
1547
1777
  <div class="action-bar">
1548
1778
  <button class="action-btn" @click=${this.handleDuplicate} title="Duplicate">&#9851;</button>
1549
1779
  <button class="action-btn" @click=${this.handleDelete} title="Delete">&#10005;</button>
1550
1780
  </div>
1551
- <div class="content-wrapper" @click=${this.handleClick}
1552
- @mouseenter=${this.handleMouseEnter} @mouseleave=${this.handleMouseLeave}>
1553
- ${l ?? c`<div style="padding:10px;color:#999;font-style:italic;">Unknown tool: ${this.content.type}</div>`}
1781
+ <div class="content-wrapper"
1782
+ @click=${this.handleClick}
1783
+ @dblclick=${this.handleDblClick}
1784
+ @mouseenter=${this.handleMouseEnter}
1785
+ @mouseleave=${this.handleMouseLeave}>
1786
+ ${c ?? p`<div style="padding:10px;color:#999;font-style:italic;">Unknown tool: ${this.content.type}</div>`}
1554
1787
  </div>
1555
1788
  `;
1556
1789
  }
1790
+ /** Build inline CSS for the contenteditable area based on content values */
1791
+ getInlineStyles(e) {
1792
+ const t = [], o = (g, u = "") => {
1793
+ const f = e[g];
1794
+ return typeof f == "string" ? f : typeof f == "number" ? String(f) : u;
1795
+ };
1796
+ t.push(`padding:${o("containerPadding", "10px")}`);
1797
+ const n = o("backgroundColor");
1798
+ n && t.push(`background-color:${n}`);
1799
+ const i = o("color");
1800
+ i && t.push(`color:${i}`);
1801
+ const s = o("fontSize");
1802
+ s && t.push(`font-size:${s}`);
1803
+ const r = o("fontWeight");
1804
+ r && t.push(`font-weight:${r}`);
1805
+ const a = o("lineHeight", "140%");
1806
+ t.push(`line-height:${a}`);
1807
+ const d = o("textAlign");
1808
+ d && t.push(`text-align:${d}`);
1809
+ const c = o("letterSpacing");
1810
+ c && c !== "normal" && t.push(`letter-spacing:${c}`);
1811
+ const h = e.fontFamily;
1812
+ return typeof h == "string" ? t.push(`font-family:${h}`) : h && typeof h == "object" && t.push(`font-family:${h.value || "inherit"}`), t.push("word-break:break-word", "outline:none", "min-height:1em"), t.join(";");
1813
+ }
1557
1814
  };
1558
- _.styles = $`
1815
+ D.styles = k`
1559
1816
  :host {
1560
1817
  display: block; position: relative; cursor: pointer;
1561
1818
  transition: outline 0.15s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
1562
1819
  }
1563
1820
  :host(.selected) { outline: 2px solid #3b82f6; outline-offset: -1px; }
1564
1821
  :host(.hovered:not(.selected)) { outline: 2px dashed #93c5fd; outline-offset: -1px; }
1822
+ :host(.editing) { outline: 2px solid #8b5cf6; outline-offset: -1px; cursor: text; }
1565
1823
  :host(.just-dropped) {
1566
1824
  animation: dropIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
1567
1825
  }
1568
- :host(.hidden-in-view) {
1569
- opacity: 0.3;
1570
- position: relative;
1571
- }
1826
+ :host(.hidden-in-view) { opacity: 0.3; position: relative; }
1572
1827
  .hidden-badge {
1573
1828
  position: absolute; top: 4px; right: 4px; z-index: 5;
1574
1829
  background: #f59e0b; color: white; font-size: 10px; font-weight: 600;
@@ -1583,50 +1838,61 @@ _.styles = $`
1583
1838
  display: none; position: absolute; top: -28px; right: 4px;
1584
1839
  background: #3b82f6; border-radius: 4px; padding: 2px; gap: 2px; z-index: 10;
1585
1840
  }
1586
- :host(.selected) .action-bar { display: flex; }
1841
+ :host(.selected:not(.editing)) .action-bar { display: flex; }
1587
1842
  .action-btn {
1588
1843
  background: none; border: none; color: white; cursor: pointer;
1589
1844
  padding: 2px 6px; font-size: 12px; line-height: 1; border-radius: 2px;
1590
1845
  }
1591
1846
  .action-btn:hover { background: rgba(255,255,255,0.2); }
1592
1847
  .content-wrapper { position: relative; }
1848
+ .inline-editable {
1849
+ outline: none;
1850
+ cursor: text;
1851
+ min-height: 1em;
1852
+ }
1853
+ .inline-editable:focus {
1854
+ outline: none;
1855
+ }
1593
1856
  `;
1594
- j([
1595
- f({ attribute: !1 })
1596
- ], _.prototype, "content", 2);
1597
- j([
1598
- f({ attribute: !1 })
1599
- ], _.prototype, "store", 1);
1600
- j([
1601
- f({ attribute: !1 })
1602
- ], _.prototype, "toolRegistry", 2);
1603
- _ = j([
1604
- k("me-content-renderer")
1605
- ], _);
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;
1857
+ O([
1858
+ b({ attribute: !1 })
1859
+ ], D.prototype, "content", 2);
1860
+ O([
1861
+ b({ attribute: !1 })
1862
+ ], D.prototype, "store", 1);
1863
+ O([
1864
+ b({ attribute: !1 })
1865
+ ], D.prototype, "toolRegistry", 2);
1866
+ O([
1867
+ pt()
1868
+ ], D.prototype, "editing", 2);
1869
+ D = O([
1870
+ C("me-content-renderer")
1871
+ ], D);
1872
+ var Nt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, H = (e, t, o, n) => {
1873
+ for (var i = n > 1 ? void 0 : n ? qt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1874
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1875
+ return n && i && Nt(t, o, i), i;
1610
1876
  };
1611
- let w = class extends v {
1877
+ let S = class extends $ {
1612
1878
  constructor() {
1613
- super(...arguments), this.storeCtrl = new S(this, ["design"]), this.widthPercent = 100;
1879
+ super(...arguments), this.storeCtrl = new T(this, ["design"]), this.widthPercent = 100;
1614
1880
  }
1615
- set store(t) {
1616
- this.storeCtrl.setStore(t);
1881
+ set store(e) {
1882
+ this.storeCtrl.setStore(e);
1617
1883
  }
1618
1884
  get store() {
1619
1885
  return this.storeCtrl.store;
1620
1886
  }
1621
1887
  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`
1888
+ const e = this.column.values.padding || "0px", t = this.column.values.backgroundColor || "transparent", o = this.column.contents;
1889
+ 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 ? p`
1624
1890
  <div class="empty-column" data-column-id=${this.column.id}>
1625
1891
  Drag content here
1626
1892
  </div>
1627
- ` : c`
1893
+ ` : p`
1628
1894
  ${o.map(
1629
- (n) => c`
1895
+ (n) => p`
1630
1896
  <me-content-renderer
1631
1897
  .content=${n}
1632
1898
  .store=${this.store}
@@ -1637,7 +1903,7 @@ let w = class extends v {
1637
1903
  `;
1638
1904
  }
1639
1905
  };
1640
- w.styles = $`
1906
+ S.styles = k`
1641
1907
  :host {
1642
1908
  display: block;
1643
1909
  min-height: 40px;
@@ -1667,57 +1933,57 @@ w.styles = $`
1667
1933
  opacity: 1;
1668
1934
  }
1669
1935
  `;
1670
- B([
1671
- f({ attribute: !1 })
1672
- ], w.prototype, "column", 2);
1673
- B([
1674
- f({ attribute: !1 })
1675
- ], w.prototype, "store", 1);
1676
- B([
1677
- f({ attribute: !1 })
1678
- ], w.prototype, "toolRegistry", 2);
1679
- B([
1680
- f({ type: Number })
1681
- ], w.prototype, "widthPercent", 2);
1682
- w = B([
1683
- k("me-column-renderer")
1684
- ], 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;
1936
+ H([
1937
+ b({ attribute: !1 })
1938
+ ], S.prototype, "column", 2);
1939
+ H([
1940
+ b({ attribute: !1 })
1941
+ ], S.prototype, "store", 1);
1942
+ H([
1943
+ b({ attribute: !1 })
1944
+ ], S.prototype, "toolRegistry", 2);
1945
+ H([
1946
+ b({ type: Number })
1947
+ ], S.prototype, "widthPercent", 2);
1948
+ S = H([
1949
+ C("me-column-renderer")
1950
+ ], S);
1951
+ var Gt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, F = (e, t, o, n) => {
1952
+ for (var i = n > 1 ? void 0 : n ? Kt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1953
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1954
+ return n && i && Gt(t, o, i), i;
1689
1955
  };
1690
- let D = class extends v {
1956
+ let R = class extends $ {
1691
1957
  constructor() {
1692
- super(...arguments), this.storeCtrl = new S(this, ["design", "viewMode"]);
1958
+ super(...arguments), this.storeCtrl = new T(this, ["design", "viewMode"]);
1693
1959
  }
1694
- set store(t) {
1695
- this.storeCtrl.setStore(t);
1960
+ set store(e) {
1961
+ this.storeCtrl.setStore(e);
1696
1962
  }
1697
1963
  get store() {
1698
1964
  return this.storeCtrl.store;
1699
1965
  }
1700
- handleMoveUp(t) {
1701
- t.stopPropagation();
1702
- const e = this.store.getRowIndex(this.row.id);
1703
- e > 0 && this.store.moveRow(e, e - 1);
1966
+ handleMoveUp(e) {
1967
+ e.stopPropagation();
1968
+ const t = this.store.getRowIndex(this.row.id);
1969
+ t > 0 && this.store.moveRow(t, t - 1);
1704
1970
  }
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);
1971
+ handleMoveDown(e) {
1972
+ e.stopPropagation();
1973
+ const t = this.store.getRowIndex(this.row.id), o = this.store.getRows().length;
1974
+ t < o - 1 && this.store.moveRow(t, t + 1);
1709
1975
  }
1710
- handleDuplicate(t) {
1711
- t.stopPropagation(), this.store.duplicateRow(this.row.id);
1976
+ handleDuplicate(e) {
1977
+ e.stopPropagation(), this.store.duplicateRow(this.row.id);
1712
1978
  }
1713
- handleDelete(t) {
1714
- t.stopPropagation(), this.store.removeRow(this.row.id);
1979
+ handleDelete(e) {
1980
+ e.stopPropagation(), this.store.removeRow(this.row.id);
1715
1981
  }
1716
1982
  render() {
1717
- 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`
1720
- ${m ? c`<div class="row-hidden-badge">${x}</div>` : ""}
1983
+ if (!this.store) return p``;
1984
+ const { row: e, store: t, toolRegistry: o } = this, n = e.values.backgroundColor || "transparent", i = e.values.columnsBackgroundColor || "transparent", s = e.values.padding || "0px", r = e.cells.reduce((x, m) => x + m, 0), a = e.values.backgroundImage, d = typeof a == "object" && a?.url ? a.url : "", c = d ? `background-image:url('${d}');background-size:${a?.cover ? "cover" : "contain"};background-position:${a?.center ? "center" : "top left"};background-repeat:${a?.repeat ? "repeat" : "no-repeat"};` : "", h = t.viewMode, g = !!e.values.hideDesktop, u = !!e.values.hideMobile, f = h === "desktop" && g || h === "mobile" && u, y = g ? "Hidden on desktop" : u ? "Hidden on mobile" : "";
1985
+ return this.classList.toggle("hidden-in-view", f), this.setAttribute("draggable", "true"), this.dataset.rowId = e.id, p`
1986
+ ${f ? p`<div class="row-hidden-badge">${y}</div>` : ""}
1721
1987
  <div class="row-actions">
1722
1988
  <button class="row-action-btn" @click=${this.handleMoveUp} title="Move Up">
1723
1989
  <svg viewBox="0 0 24 24"><path d="M12 19V5"/><path d="m5 12 7-7 7 7"/></svg>
@@ -1734,16 +2000,16 @@ let D = class extends v {
1734
2000
  </div>
1735
2001
  <div
1736
2002
  class="row-wrapper"
1737
- style="background-color:${n};padding:${r};${p}"
2003
+ style="background-color:${n};padding:${s};${c}"
1738
2004
  >
1739
- ${t.columns.map((b, y) => {
1740
- const R = t.cells[y] / s * 100;
1741
- return c`
2005
+ ${e.columns.map((x, m) => {
2006
+ const w = e.cells[m] / r * 100;
2007
+ return p`
1742
2008
  <me-column-renderer
1743
- .column=${b}
1744
- .store=${e}
2009
+ .column=${x}
2010
+ .store=${t}
1745
2011
  .toolRegistry=${o}
1746
- .widthPercent=${R}
2012
+ .widthPercent=${w}
1747
2013
  style="background-color:${i};"
1748
2014
  ></me-column-renderer>
1749
2015
  `;
@@ -1752,7 +2018,7 @@ let D = class extends v {
1752
2018
  `;
1753
2019
  }
1754
2020
  };
1755
- D.styles = $`
2021
+ R.styles = k`
1756
2022
  :host {
1757
2023
  display: block;
1758
2024
  position: relative;
@@ -1816,29 +2082,29 @@ D.styles = $`
1816
2082
  stroke-linejoin: round;
1817
2083
  }
1818
2084
  `;
1819
- W([
1820
- f({ attribute: !1 })
1821
- ], D.prototype, "row", 2);
1822
- W([
1823
- f({ attribute: !1 })
1824
- ], D.prototype, "store", 1);
1825
- W([
1826
- f({ attribute: !1 })
1827
- ], D.prototype, "toolRegistry", 2);
1828
- D = W([
1829
- k("me-row-renderer")
1830
- ], 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;
2085
+ F([
2086
+ b({ attribute: !1 })
2087
+ ], R.prototype, "row", 2);
2088
+ F([
2089
+ b({ attribute: !1 })
2090
+ ], R.prototype, "store", 1);
2091
+ F([
2092
+ b({ attribute: !1 })
2093
+ ], R.prototype, "toolRegistry", 2);
2094
+ R = F([
2095
+ C("me-row-renderer")
2096
+ ], R);
2097
+ var Yt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, J = (e, t, o, n) => {
2098
+ for (var i = n > 1 ? void 0 : n ? Jt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2099
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2100
+ return n && i && Yt(t, o, i), i;
1835
2101
  };
1836
- let I = class extends v {
2102
+ let M = class extends $ {
1837
2103
  constructor() {
1838
- super(...arguments), this.storeCtrl = new S(this, ["design", "viewMode"]);
2104
+ super(...arguments), this.storeCtrl = new T(this, ["design", "viewMode"]);
1839
2105
  }
1840
- set store(t) {
1841
- this.storeCtrl.setStore(t);
2106
+ set store(e) {
2107
+ this.storeCtrl.setStore(e);
1842
2108
  }
1843
2109
  get store() {
1844
2110
  return this.storeCtrl.store;
@@ -1846,12 +2112,12 @@ let I = class extends v {
1846
2112
  handleCanvasClick() {
1847
2113
  this.store.select(null);
1848
2114
  }
1849
- setViewMode(t) {
1850
- this.store.setViewMode(t);
2115
+ setViewMode(e) {
2116
+ this.store.setViewMode(e);
1851
2117
  }
1852
2118
  render() {
1853
- const t = this.store.getRows(), e = this.store.getBodyValues(), o = e.contentWidth || "600px", n = e.backgroundColor || "#e7e7e7", i = this.store.viewMode;
1854
- return c`
2119
+ const e = this.store.getRows(), t = this.store.getBodyValues(), o = t.contentWidth || "600px", n = t.backgroundColor || "#e7e7e7", i = this.store.viewMode;
2120
+ return p`
1855
2121
  <div class="view-toggle">
1856
2122
  <button
1857
2123
  class="view-btn ${i === "desktop" ? "active" : ""}"
@@ -1868,15 +2134,15 @@ let I = class extends v {
1868
2134
  style="max-width:${i === "mobile" ? "375px" : o};background-color:${n};"
1869
2135
  @click=${this.handleCanvasClick}
1870
2136
  >
1871
- ${t.length === 0 ? c`
2137
+ ${e.length === 0 ? p`
1872
2138
  <div class="empty-canvas">
1873
2139
  <div class="empty-icon">&#9776;</div>
1874
2140
  <div>Drag a content block here</div>
1875
2141
  </div>
1876
- ` : t.map(
1877
- (s) => c`
2142
+ ` : e.map(
2143
+ (r) => p`
1878
2144
  <me-row-renderer
1879
- .row=${s}
2145
+ .row=${r}
1880
2146
  .store=${this.store}
1881
2147
  .toolRegistry=${this.toolRegistry}
1882
2148
  ></me-row-renderer>
@@ -1886,7 +2152,7 @@ let I = class extends v {
1886
2152
  `;
1887
2153
  }
1888
2154
  };
1889
- I.styles = $`
2155
+ M.styles = k`
1890
2156
  :host {
1891
2157
  display: block;
1892
2158
  flex: 1;
@@ -1940,67 +2206,87 @@ I.styles = $`
1940
2206
  color: white;
1941
2207
  }
1942
2208
  `;
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([
1950
- 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;
2209
+ J([
2210
+ b({ attribute: !1 })
2211
+ ], M.prototype, "store", 1);
2212
+ J([
2213
+ b({ attribute: !1 })
2214
+ ], M.prototype, "toolRegistry", 2);
2215
+ M = J([
2216
+ C("me-editor-canvas")
2217
+ ], M);
2218
+ var Xt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, dt = (e, t, o, n) => {
2219
+ for (var i = n > 1 ? void 0 : n ? Qt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2220
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2221
+ return n && i && Xt(t, o, i), i;
1956
2222
  };
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" }
2223
+ const G = [
2224
+ // System / email-safe fonts
2225
+ { label: "Arial", value: "arial,helvetica,sans-serif", url: "" },
2226
+ { label: "Helvetica", value: "helvetica,sans-serif", url: "" },
2227
+ { label: "Georgia", value: "georgia,serif", url: "" },
2228
+ { label: "Times New Roman", value: "'times new roman',times,serif", url: "" },
2229
+ { label: "Trebuchet MS", value: "trebuchet ms,helvetica,sans-serif", url: "" },
2230
+ { label: "Verdana", value: "verdana,geneva,sans-serif", url: "" },
2231
+ { label: "Courier New", value: "'courier new',courier,monospace", url: "" },
2232
+ // Google Fonts
2233
+ { label: "Lato", value: "'Lato',sans-serif", url: "https://fonts.googleapis.com/css?family=Lato:400,700" },
2234
+ { label: "Montserrat", value: "'Montserrat',sans-serif", url: "https://fonts.googleapis.com/css?family=Montserrat:400,700" },
2235
+ { label: "Old Standard TT", value: "'Old Standard TT',serif", url: "https://fonts.googleapis.com/css?family=Old+Standard+TT:400,700" },
2236
+ { label: "Open Sans", value: "'Open Sans',sans-serif", url: "https://fonts.googleapis.com/css?family=Open+Sans:400,700" },
2237
+ { label: "Pacifico", value: "'Pacifico',cursive", url: "https://fonts.googleapis.com/css?family=Pacifico:400" },
2238
+ { label: "Playfair Display", value: "'Playfair Display',serif", url: "https://fonts.googleapis.com/css?family=Playfair+Display:400,700" },
2239
+ { label: "Raleway", value: "'Raleway',sans-serif", url: "https://fonts.googleapis.com/css?family=Raleway:400,700" },
2240
+ { label: "Roboto", value: "'Roboto',sans-serif", url: "https://fonts.googleapis.com/css?family=Roboto:400,700" },
2241
+ { label: "Rubik", value: "'Rubik',sans-serif", url: "https://fonts.googleapis.com/css?family=Rubik:400,700" },
2242
+ { label: "Source Sans Pro", value: "'Source Sans Pro',sans-serif", url: "https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700" }
1965
2243
  ];
1966
- let L = class extends v {
2244
+ let A = class extends $ {
1967
2245
  constructor() {
1968
- super(...arguments), this.storeCtrl = new S(this, ["design"]);
2246
+ super(...arguments), this.storeCtrl = new T(this, ["design"]);
1969
2247
  }
1970
- set store(t) {
1971
- this.storeCtrl.setStore(t);
2248
+ set store(e) {
2249
+ this.storeCtrl.setStore(e);
1972
2250
  }
1973
2251
  get store() {
1974
2252
  return this.storeCtrl.store;
1975
2253
  }
1976
- update_(t, e) {
1977
- this.store.updateBodyValues({ [t]: e });
2254
+ update_(e, t) {
2255
+ this.store.updateBodyValues({ [e]: t });
1978
2256
  }
1979
- updateLinkStyle(t, e) {
2257
+ updateLinkStyle(e, t) {
1980
2258
  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 } });
2259
+ this.store.updateBodyValues({ linkStyle: { ...o, [e]: t } });
2260
+ }
2261
+ updateFontFamily(e) {
2262
+ const t = G.find((n) => n.value === e), o = { label: t?.label || e, value: e };
2263
+ if (t?.url) {
2264
+ o.url = t.url;
2265
+ const n = `emabuild-font-${e.replace(/[^a-z]/gi, "")}`;
2266
+ if (!document.getElementById(n)) {
2267
+ const i = document.createElement("link");
2268
+ i.id = n, i.rel = "stylesheet", i.href = t.url, document.head.appendChild(i);
2269
+ }
2270
+ }
2271
+ this.store.updateBodyValues({ fontFamily: o });
1986
2272
  }
1987
2273
  render() {
1988
- const t = this.store.getBodyValues();
1989
- return c`
1990
- ${this.renderColorField("Background Color", t.backgroundColor || "#e7e7e7", (e) => this.update_("backgroundColor", e))}
2274
+ const e = this.store.getBodyValues();
2275
+ return p`
2276
+ ${this.renderColorField("Background Color", e.backgroundColor || "#e7e7e7", (t) => this.update_("backgroundColor", t))}
1991
2277
 
1992
2278
  <p class="section-title" style="margin-top:16px;">Content</p>
1993
2279
  <div class="field">
1994
2280
  <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")} />
2281
+ <input class="input" type="number" .value=${parseInt(e.contentWidth || "600")} min="320" max="960" step="10"
2282
+ @change=${(t) => this.update_("contentWidth", t.target.value + "px")} />
1997
2283
  </div>
1998
2284
  <div class="field">
1999
2285
  <label class="field-label">Content Align</label>
2000
2286
  <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>
2287
+ ${["left", "center", "right"].map((t) => p`
2288
+ <button class="align-btn ${e.contentAlign === t ? "active" : ""}"
2289
+ @click=${() => this.update_("contentAlign", t)}>${t}</button>
2004
2290
  `)}
2005
2291
  </div>
2006
2292
  </div>
@@ -2008,18 +2294,23 @@ let L = class extends v {
2008
2294
  <p class="section-title" style="margin-top:16px;">Typography</p>
2009
2295
  <div class="field">
2010
2296
  <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>`)}
2297
+ <select class="input" @change=${(t) => this.updateFontFamily(t.target.value)}>
2298
+ <optgroup label="System Fonts">
2299
+ ${G.filter((t) => !t.url).map((t) => p`<option value=${t.value} ?selected=${e.fontFamily?.value === t.value}>${t.label}</option>`)}
2300
+ </optgroup>
2301
+ <optgroup label="Google Fonts">
2302
+ ${G.filter((t) => !!t.url).map((t) => p`<option value=${t.value} ?selected=${e.fontFamily?.value === t.value}>${t.label}</option>`)}
2303
+ </optgroup>
2013
2304
  </select>
2014
2305
  </div>
2015
- ${this.renderColorField("Text Color", t.textColor || "#000000", (e) => this.update_("textColor", e))}
2306
+ ${this.renderColorField("Text Color", e.textColor || "#000000", (t) => this.update_("textColor", t))}
2016
2307
 
2017
2308
  <p class="section-title" style="margin-top:16px;">Links</p>
2018
- ${this.renderColorField("Link Color", t.linkStyle?.linkColor || "#0000ee", (e) => this.updateLinkStyle("linkColor", e))}
2309
+ ${this.renderColorField("Link Color", e.linkStyle?.linkColor || "#0000ee", (t) => this.updateLinkStyle("linkColor", t))}
2019
2310
  <div class="field">
2020
2311
  <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)} />
2312
+ <input type="checkbox" .checked=${e.linkStyle?.linkUnderline ?? !0}
2313
+ @change=${(t) => this.updateLinkStyle("linkUnderline", t.target.checked)} />
2023
2314
  Underline Links
2024
2315
  </label>
2025
2316
  </div>
@@ -2027,26 +2318,26 @@ let L = class extends v {
2027
2318
  <p class="section-title" style="margin-top:16px;">Email</p>
2028
2319
  <div class="field">
2029
2320
  <label class="field-label">Preheader Text</label>
2030
- <textarea class="input" .value=${t.preheaderText || ""} placeholder="Preview text shown in inbox..."
2321
+ <textarea class="input" .value=${e.preheaderText || ""} placeholder="Preview text shown in inbox..."
2031
2322
  style="min-height:60px;resize:vertical;font-family:inherit;"
2032
- @change=${(e) => this.update_("preheaderText", e.target.value)}></textarea>
2323
+ @change=${(t) => this.update_("preheaderText", t.target.value)}></textarea>
2033
2324
  </div>
2034
2325
  `;
2035
2326
  }
2036
2327
  /** Reusable color field (swatch + hex input) */
2037
- renderColorField(t, e, o) {
2038
- return c`
2328
+ renderColorField(e, t, o) {
2329
+ return p`
2039
2330
  <div class="field">
2040
- <label class="field-label">${t}</label>
2331
+ <label class="field-label">${e}</label>
2041
2332
  <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)} />
2333
+ <input class="color-swatch" type="color" .value=${t} @input=${(n) => o(n.target.value)} />
2334
+ <input class="input" type="text" .value=${t} style="flex:1;" @change=${(n) => o(n.target.value)} />
2044
2335
  </div>
2045
2336
  </div>
2046
2337
  `;
2047
2338
  }
2048
2339
  };
2049
- L.styles = $`
2340
+ A.styles = k`
2050
2341
  :host { display: block; }
2051
2342
  .section-title {
2052
2343
  font-size: 11px; font-weight: 600; text-transform: uppercase;
@@ -2071,66 +2362,66 @@ L.styles = $`
2071
2362
  }
2072
2363
  .align-btn.active { border-color: #3b82f6; background: #eff6ff; color: #3b82f6; }
2073
2364
  `;
2074
- rt([
2075
- f({ attribute: !1 })
2076
- ], L.prototype, "store", 1);
2077
- L = rt([
2078
- k("me-body-settings")
2079
- ], 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;
2365
+ dt([
2366
+ b({ attribute: !1 })
2367
+ ], A.prototype, "store", 1);
2368
+ A = dt([
2369
+ C("me-body-settings")
2370
+ ], A);
2371
+ var Zt = Object.defineProperty, te = Object.getOwnPropertyDescriptor, X = (e, t, o, n) => {
2372
+ for (var i = n > 1 ? void 0 : n ? te(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2373
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2374
+ return n && i && Zt(t, o, i), i;
2084
2375
  };
2085
- let T = class extends v {
2376
+ let P = class extends $ {
2086
2377
  constructor() {
2087
- super(...arguments), this.storeCtrl = new S(this, ["activeTab"]);
2378
+ super(...arguments), this.storeCtrl = new T(this, ["activeTab"]);
2088
2379
  }
2089
- set store(t) {
2090
- this.storeCtrl.setStore(t);
2380
+ set store(e) {
2381
+ this.storeCtrl.setStore(e);
2091
2382
  }
2092
2383
  get store() {
2093
2384
  return this.storeCtrl.store;
2094
2385
  }
2095
- handleDragStart(t, e) {
2096
- t.dataTransfer.setData("application/maileditor-tool", e), t.dataTransfer.effectAllowed = "copy";
2386
+ handleDragStart(e, t) {
2387
+ e.dataTransfer.setData("application/maileditor-tool", t), e.dataTransfer.effectAllowed = "copy";
2097
2388
  }
2098
- handleLayoutDragStart(t, e) {
2099
- t.dataTransfer.setData("application/maileditor-layout", JSON.stringify(e)), t.dataTransfer.effectAllowed = "copy";
2389
+ handleLayoutDragStart(e, t) {
2390
+ e.dataTransfer.setData("application/maileditor-layout", JSON.stringify(t)), e.dataTransfer.effectAllowed = "copy";
2100
2391
  }
2101
- addRowWithLayout(t) {
2102
- const e = this.store.createRow(t);
2103
- this.store.addRow(e);
2392
+ addRowWithLayout(e) {
2393
+ const t = this.store.createRow(e);
2394
+ this.store.addRow(t);
2104
2395
  }
2105
2396
  render() {
2106
- const t = this.store.activeTab, e = this.toolRegistry.getAllMeta();
2107
- return c`
2397
+ const e = this.store.activeTab, t = this.toolRegistry.getAllMeta();
2398
+ return p`
2108
2399
  <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>
2400
+ <button class="tab ${e === "content" ? "active" : ""}" @click=${() => this.store.setActiveTab("content")}>Content</button>
2401
+ <button class="tab ${e === "blocks" ? "active" : ""}" @click=${() => this.store.setActiveTab("blocks")}>Blocks</button>
2402
+ <button class="tab ${e === "body" ? "active" : ""}" @click=${() => this.store.setActiveTab("body")}>Body</button>
2112
2403
  </div>
2113
2404
 
2114
2405
  <div class="tab-content">
2115
- ${t === "content" ? this.renderContentTab(e) : ""}
2116
- ${t === "blocks" ? this.renderBlocksTab() : ""}
2117
- ${t === "body" ? this.renderBodyTab() : ""}
2406
+ ${e === "content" ? this.renderContentTab(t) : ""}
2407
+ ${e === "blocks" ? this.renderBlocksTab() : ""}
2408
+ ${e === "body" ? this.renderBodyTab() : ""}
2118
2409
  </div>
2119
2410
  `;
2120
2411
  }
2121
- renderContentTab(t) {
2122
- return c`
2412
+ renderContentTab(e) {
2413
+ return p`
2123
2414
  <p class="section-title">Content</p>
2124
2415
  <div class="tool-grid">
2125
- ${t.map(
2126
- (e) => c`
2416
+ ${e.map(
2417
+ (t) => p`
2127
2418
  <div
2128
2419
  class="tool-item"
2129
2420
  draggable="true"
2130
- @dragstart=${(o) => this.handleDragStart(o, e.name)}
2421
+ @dragstart=${(o) => this.handleDragStart(o, t.name)}
2131
2422
  >
2132
- <div class="tool-icon">${q(e.icon)}</div>
2133
- <span>${e.label}</span>
2423
+ <div class="tool-icon">${U(t.icon)}</div>
2424
+ <span>${t.label}</span>
2134
2425
  </div>
2135
2426
  `
2136
2427
  )}
@@ -2147,34 +2438,34 @@ let T = class extends v {
2147
2438
  </div>
2148
2439
  `;
2149
2440
  }
2150
- renderLayoutOption(t, e) {
2151
- const o = t.reduce((n, i) => n + i, 0);
2152
- return c`
2441
+ renderLayoutOption(e, t) {
2442
+ const o = e.reduce((n, i) => n + i, 0);
2443
+ return p`
2153
2444
  <div
2154
2445
  class="layout-item"
2155
2446
  draggable="true"
2156
- @click=${() => this.addRowWithLayout(t)}
2157
- @dragstart=${(n) => this.handleLayoutDragStart(n, t)}
2158
- title=${e}
2447
+ @click=${() => this.addRowWithLayout(e)}
2448
+ @dragstart=${(n) => this.handleLayoutDragStart(n, e)}
2449
+ title=${t}
2159
2450
  >
2160
- ${t.map(
2161
- (n) => c`<div class="layout-col" style="width:${n / o * 100}%;"></div>`
2451
+ ${e.map(
2452
+ (n) => p`<div class="layout-col" style="width:${n / o * 100}%;"></div>`
2162
2453
  )}
2163
2454
  </div>
2164
2455
  `;
2165
2456
  }
2166
2457
  renderBlocksTab() {
2167
- return c`
2458
+ return p`
2168
2459
  <p style="color:#9ca3af;font-size:13px;text-align:center;margin-top:40px;">
2169
2460
  No saved blocks yet.<br/>Select a row in the editor and save it as a block.
2170
2461
  </p>
2171
2462
  `;
2172
2463
  }
2173
2464
  renderBodyTab() {
2174
- return c`<me-body-settings .store=${this.store}></me-body-settings>`;
2465
+ return p`<me-body-settings .store=${this.store}></me-body-settings>`;
2175
2466
  }
2176
2467
  };
2177
- T.styles = $`
2468
+ P.styles = k`
2178
2469
  :host {
2179
2470
  display: flex;
2180
2471
  flex-direction: column;
@@ -2308,78 +2599,78 @@ T.styles = $`
2308
2599
  transition: background 0.2s ease;
2309
2600
  }
2310
2601
  `;
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([
2318
- 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";
2322
- return c`
2602
+ X([
2603
+ b({ attribute: !1 })
2604
+ ], P.prototype, "store", 1);
2605
+ X([
2606
+ b({ attribute: !1 })
2607
+ ], P.prototype, "toolRegistry", 2);
2608
+ P = X([
2609
+ C("me-editor-sidebar")
2610
+ ], P);
2611
+ function ee(e, t, o) {
2612
+ const n = e && /^#[0-9a-fA-F]{3,8}$/.test(e) ? e : "#000000";
2613
+ return p`
2323
2614
  <div class="prop-row">
2324
2615
  <label class="prop-label">${o}</label>
2325
2616
  <div class="prop-color">
2326
2617
  <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)} />
2618
+ @input=${(i) => t(i.target.value)} />
2619
+ <input class="prop-input" type="text" .value=${e ?? ""} style="flex:1;"
2620
+ @change=${(i) => t(i.target.value)} />
2330
2621
  </div>
2331
2622
  </div>
2332
2623
  `;
2333
2624
  }
2334
- function Nt(t, e, o, n) {
2625
+ function oe(e, t, o, n) {
2335
2626
  const i = n?.options || [];
2336
- return c`
2627
+ return p`
2337
2628
  <div class="prop-row">
2338
2629
  <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>`)}
2630
+ <select class="prop-input" @change=${(s) => t(s.target.value)}>
2631
+ ${i.map((s) => p`<option value=${s.value} ?selected=${e === s.value}>${s.label}</option>`)}
2341
2632
  </select>
2342
2633
  </div>
2343
2634
  `;
2344
2635
  }
2345
- function qt(t, e, o) {
2346
- return c`
2636
+ function ne(e, t, o) {
2637
+ return p`
2347
2638
  <div class="prop-row">
2348
2639
  <label class="prop-label">${o}</label>
2349
2640
  <div style="display:flex;gap:2px;">
2350
- ${["left", "center", "right"].map((n) => c`
2641
+ ${["left", "center", "right"].map((n) => p`
2351
2642
  <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)}
2643
+ 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"};"
2644
+ @click=${() => t(n)}
2354
2645
  >${n}</button>
2355
2646
  `)}
2356
2647
  </div>
2357
2648
  </div>
2358
2649
  `;
2359
2650
  }
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;
2362
- return [o, n, i, r];
2651
+ function ie(e) {
2652
+ const t = (e || "0px").split(/\s+/).map((r) => parseInt(r) || 0), o = t[0], n = t[1] ?? o, i = t[2] ?? o, s = t[3] ?? n;
2653
+ return [o, n, i, s];
2363
2654
  }
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`;
2655
+ function se(e, t, o, n) {
2656
+ 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
2657
  }
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));
2369
- return c`
2658
+ function re(e, t, o) {
2659
+ const [n, i, s, r] = ie(e), a = (c, h, g, u) => t(se(c, h, g, u));
2660
+ return p`
2370
2661
  <div class="prop-row">
2371
2662
  <label class="prop-label">${o}</label>
2372
2663
  <div style="display:grid;grid-template-columns:1fr 1fr;gap:4px;">
2373
2664
  ${[
2374
- { label: "T", val: n, change: (p) => l(p, i, r, s) },
2375
- { label: "R", val: i, change: (p) => l(n, p, r, s) },
2376
- { label: "B", val: r, change: (p) => l(n, i, p, s) },
2377
- { label: "L", val: s, change: (p) => l(n, i, r, p) }
2378
- ].map((p) => c`
2665
+ { label: "T", val: n, change: (c) => a(c, i, s, r) },
2666
+ { label: "R", val: i, change: (c) => a(n, c, s, r) },
2667
+ { label: "B", val: s, change: (c) => a(n, i, c, r) },
2668
+ { label: "L", val: r, change: (c) => a(n, i, s, c) }
2669
+ ].map((c) => p`
2379
2670
  <div style="display:flex;align-items:center;gap:4px;">
2380
- <span style="font-size:10px;color:#9ca3af;width:12px;">${p.label}</span>
2381
- <input type="number" .value=${p.val} min="0"
2382
- @change=${(h) => p.change(parseInt(h.target.value) || 0)}
2671
+ <span style="font-size:10px;color:#9ca3af;width:12px;">${c.label}</span>
2672
+ <input type="number" .value=${c.val} min="0"
2673
+ @change=${(h) => c.change(parseInt(h.target.value) || 0)}
2383
2674
  style="flex:1;padding:4px 6px;border:1px solid #d1d5db;border-radius:3px;font-size:12px;width:50px;" />
2384
2675
  </div>
2385
2676
  `)}
@@ -2387,110 +2678,110 @@ function Kt(t, e, o) {
2387
2678
  </div>
2388
2679
  `;
2389
2680
  }
2390
- function Jt(t, e, o) {
2391
- return c`
2681
+ function le(e, t, o) {
2682
+ return p`
2392
2683
  <div class="prop-row">
2393
2684
  <div class="prop-toggle">
2394
- <input type="checkbox" .checked=${!!t}
2395
- @change=${(n) => e(n.target.checked)} />
2685
+ <input type="checkbox" .checked=${!!e}
2686
+ @change=${(n) => t(n.target.checked)} />
2396
2687
  <label class="prop-label" style="margin:0;">${o}</label>
2397
2688
  </div>
2398
2689
  </div>
2399
2690
  `;
2400
2691
  }
2401
- function Xt(t, e, o) {
2402
- return c`
2692
+ function ae(e, t, o) {
2693
+ return p`
2403
2694
  <div class="prop-row">
2404
2695
  <label class="prop-label">${o}</label>
2405
- <input class="prop-input" type="text" .value=${t ?? ""}
2406
- @change=${(n) => e(n.target.value)} />
2696
+ <input class="prop-input" type="text" .value=${e ?? ""}
2697
+ @change=${(n) => t(n.target.value)} />
2407
2698
  </div>
2408
2699
  `;
2409
2700
  }
2410
- function Qt(t, e, o) {
2411
- return c`
2701
+ function de(e, t, o) {
2702
+ return p`
2412
2703
  <div class="prop-row">
2413
2704
  <label class="prop-label">${o}</label>
2414
2705
  <textarea class="prop-input"
2415
2706
  style="min-height:100px;font-family:'SF Mono',Menlo,monospace;font-size:12px;"
2416
- .value=${t ?? ""}
2417
- @change=${(n) => e(n.target.value)}
2707
+ .value=${e ?? ""}
2708
+ @change=${(n) => t(n.target.value)}
2418
2709
  ></textarea>
2419
2710
  </div>
2420
2711
  `;
2421
2712
  }
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;
2713
+ var ce = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, Q = (e, t, o, n) => {
2714
+ for (var i = n > 1 ? void 0 : n ? pe(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2715
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2716
+ return n && i && ce(t, o, i), i;
2426
2717
  };
2427
- let P = class extends v {
2718
+ let E = class extends $ {
2428
2719
  constructor() {
2429
- super(...arguments), this.storeCtrl = new S(this, ["design", "selection"]);
2720
+ super(...arguments), this.storeCtrl = new T(this, ["design", "selection"]);
2430
2721
  }
2431
- set store(t) {
2432
- this.storeCtrl.setStore(t);
2722
+ set store(e) {
2723
+ this.storeCtrl.setStore(e);
2433
2724
  }
2434
2725
  get store() {
2435
2726
  return this.storeCtrl.store;
2436
2727
  }
2437
2728
  /** Create a change handler bound to a specific content ID and property key */
2438
- onChange(t, e) {
2729
+ onChange(e, t) {
2439
2730
  return (o) => {
2440
- this.store.updateContentValues(t, { [e]: o });
2731
+ this.store.updateContentValues(e, { [t]: o });
2441
2732
  };
2442
2733
  }
2443
2734
  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);
2735
+ const e = this.store.selectedId;
2448
2736
  if (!e)
2449
- return c`<div class="no-selection">Select an element to edit its properties</div>`;
2450
- const o = this.toolRegistry.get(e.type);
2451
- return o ? c`
2737
+ return p`<div class="no-selection">Select an element to edit its properties</div>`;
2738
+ const t = this.store.findContent(e);
2739
+ if (!t)
2740
+ return p`<div class="no-selection">Select an element to edit its properties</div>`;
2741
+ const o = this.toolRegistry.get(t.type);
2742
+ return o ? p`
2452
2743
  <div class="header">
2453
2744
  <p class="header-title">${o.label}</p>
2454
- <p class="header-type">${e.type}</p>
2745
+ <p class="header-type">${t.type}</p>
2455
2746
  </div>
2456
- ${Object.entries(o.options).map(([, n]) => this.renderGroup(e, n))}
2457
- ` : c`<div class="no-selection">Unknown tool: ${e.type}</div>`;
2747
+ ${Object.entries(o.options).map(([, n]) => this.renderGroup(t, n))}
2748
+ ` : p`<div class="no-selection">Unknown tool: ${t.type}</div>`;
2458
2749
  }
2459
- renderGroup(t, e) {
2460
- return c`
2750
+ renderGroup(e, t) {
2751
+ return p`
2461
2752
  <div class="group">
2462
- <div class="group-title">${e.title}</div>
2753
+ <div class="group-title">${t.title}</div>
2463
2754
  <div class="group-body">
2464
- ${Object.entries(e.options).map(
2465
- ([o, n]) => this.renderWidget(t, o, n)
2755
+ ${Object.entries(t.options).map(
2756
+ ([o, n]) => this.renderWidget(e, o, n)
2466
2757
  )}
2467
2758
  </div>
2468
2759
  </div>
2469
2760
  `;
2470
2761
  }
2471
2762
  /** 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);
2763
+ renderWidget(e, t, o) {
2764
+ const n = e.values[t] ?? o.defaultValue, i = this.onChange(e.id, t);
2474
2765
  switch (o.widget) {
2475
2766
  case "color_picker":
2476
- return Ft(n, i, o.label);
2767
+ return ee(n, i, o.label);
2477
2768
  case "toggle":
2478
- return Jt(n, i, o.label);
2769
+ return le(n, i, o.label);
2479
2770
  case "rich_text":
2480
- return Qt(n, i, o.label);
2771
+ return de(n, i, o.label);
2481
2772
  case "dropdown":
2482
- return Nt(n, i, o.label, o.widgetParams);
2773
+ return oe(n, i, o.label, o.widgetParams);
2483
2774
  case "alignment":
2484
- return qt(n, i, o.label);
2775
+ return ne(n, i, o.label);
2485
2776
  case "padding":
2486
- return Kt(n, i, o.label);
2777
+ return re(n, i, o.label);
2487
2778
  case "text":
2488
2779
  default:
2489
- return Xt(n, i, o.label);
2780
+ return ae(n, i, o.label);
2490
2781
  }
2491
2782
  }
2492
2783
  };
2493
- P.styles = $`
2784
+ E.styles = k`
2494
2785
  :host {
2495
2786
  display: flex; flex-direction: column; width: 300px; min-width: 300px;
2496
2787
  background: #fff; border-left: 1px solid #e5e7eb;
@@ -2524,38 +2815,38 @@ P.styles = $`
2524
2815
  .color-swatch { width: 28px; height: 28px; border-radius: 4px; border: 1px solid #d1d5db; cursor: pointer; padding: 0; }
2525
2816
  textarea.prop-input { min-height: 80px; resize: vertical; font-family: monospace; }
2526
2817
  `;
2527
- K([
2528
- f({ attribute: !1 })
2529
- ], P.prototype, "store", 1);
2530
- K([
2531
- f({ attribute: !1 })
2532
- ], P.prototype, "toolRegistry", 2);
2533
- P = K([
2534
- k("me-property-panel")
2535
- ], 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;
2818
+ Q([
2819
+ b({ attribute: !1 })
2820
+ ], E.prototype, "store", 1);
2821
+ Q([
2822
+ b({ attribute: !1 })
2823
+ ], E.prototype, "toolRegistry", 2);
2824
+ E = Q([
2825
+ C("me-property-panel")
2826
+ ], E);
2827
+ var he = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, ct = (e, t, o, n) => {
2828
+ for (var i = n > 1 ? void 0 : n ? ue(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2829
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2830
+ return n && i && he(t, o, i), i;
2540
2831
  };
2541
- let A = class extends v {
2832
+ let B = class extends $ {
2542
2833
  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) => {
2545
- const r = i?.tagName;
2546
- return r === "INPUT" || r === "TEXTAREA" || r === "SELECT";
2834
+ super(...arguments), this.options = {}, this.store = new wt(), this.toolRegistry = new vt(), this.dragManager = null, this.callbacks = /* @__PURE__ */ new Map(), this.unsubscribe = null, this._handleKeydown = (e) => {
2835
+ const t = e.metaKey || e.ctrlKey, n = e.composedPath().some((i) => {
2836
+ const s = i?.tagName;
2837
+ return s === "INPUT" || s === "TEXTAREA" || s === "SELECT";
2547
2838
  });
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));
2839
+ 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
2840
  };
2550
2841
  }
2551
2842
  connectedCallback() {
2552
2843
  super.connectedCallback(), this.registerBuiltInTools(), this.applyOptions(), this.setAttribute("tabindex", "0"), this.addEventListener("keydown", this._handleKeydown);
2553
2844
  }
2554
2845
  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 }));
2846
+ this.dragManager = new $t(this.store, this.toolRegistry, this.shadowRoot), this.dragManager.attach(), this.store.events.on("design:loaded", (e) => {
2847
+ this.dispatchEvent(new CustomEvent("design:loaded", { detail: e, bubbles: !0, composed: !0 }));
2848
+ }), this.store.events.on("design:updated", (e) => {
2849
+ this.dispatchEvent(new CustomEvent("design:updated", { detail: e, bubbles: !0, composed: !0 }));
2559
2850
  }), this.dispatchEvent(new CustomEvent("editor:ready", { bubbles: !0, composed: !0 })), this.preloadLazyTools();
2560
2851
  }
2561
2852
  disconnectedCallback() {
@@ -2564,41 +2855,41 @@ let A = class extends v {
2564
2855
  // ----------------------------------------------------------
2565
2856
  // Public API — public API
2566
2857
  // ----------------------------------------------------------
2567
- loadDesign(t) {
2568
- this.store.loadDesign(t);
2858
+ loadDesign(e) {
2859
+ this.store.loadDesign(e);
2569
2860
  }
2570
- saveDesign(t) {
2571
- t(structuredClone(this.store.getDesign()));
2861
+ saveDesign(e) {
2862
+ e(structuredClone(this.store.getDesign()));
2572
2863
  }
2573
- exportHtml(t, e) {
2864
+ exportHtml(e, t) {
2574
2865
  const o = this.store.getDesign(), n = /* @__PURE__ */ new Set();
2575
- for (const r of o.body.rows)
2576
- for (const s of r.columns)
2577
- for (const l of s.contents)
2578
- n.add(l.type);
2579
- 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);
2581
- }
2582
- doExport(t, e, o) {
2866
+ for (const s of o.body.rows)
2867
+ for (const r of s.columns)
2868
+ for (const a of r.contents)
2869
+ n.add(a.type);
2870
+ const i = Array.from(n).filter((s) => !this.toolRegistry.isLoaded(s)).map((s) => this.toolRegistry.ensureLoaded(s));
2871
+ i.length > 0 ? Promise.all(i).then(() => this.doExport(o, e, t)) : this.doExport(o, e, t);
2872
+ }
2873
+ doExport(e, t, o) {
2583
2874
  const n = /* @__PURE__ */ new Map();
2584
2875
  for (const i of this.toolRegistry.getAll())
2585
- n.set(i.name, (r, s) => i.renderer.renderHtml(r, s));
2586
- e(Tt(t, n, o));
2876
+ n.set(i.name, (s, r) => i.renderer.renderHtml(s, r));
2877
+ t(Ht(e, n, o));
2587
2878
  }
2588
- async exportHtmlAsync(t) {
2589
- return new Promise((e) => this.exportHtml(e, t));
2879
+ async exportHtmlAsync(e) {
2880
+ return new Promise((t) => this.exportHtml(t, e));
2590
2881
  }
2591
- registerTool(t) {
2592
- this.toolRegistry.register(t), this.requestUpdate();
2882
+ registerTool(e) {
2883
+ this.toolRegistry.register(e), this.requestUpdate();
2593
2884
  }
2594
- registerPropertyEditor(t, e) {
2885
+ registerPropertyEditor(e, t) {
2595
2886
  }
2596
- registerTab(t) {
2887
+ registerTab(e) {
2597
2888
  }
2598
- registerCallback(t, e) {
2599
- this.callbacks.set(t, e);
2889
+ registerCallback(e, t) {
2890
+ this.callbacks.set(e, t);
2600
2891
  }
2601
- setMergeTags(t) {
2892
+ setMergeTags(e) {
2602
2893
  }
2603
2894
  undo() {
2604
2895
  this.store.undo();
@@ -2606,8 +2897,8 @@ let A = class extends v {
2606
2897
  redo() {
2607
2898
  this.store.redo();
2608
2899
  }
2609
- setBodyValues(t) {
2610
- this.store.updateBodyValues(t);
2900
+ setBodyValues(e) {
2901
+ this.store.updateBodyValues(e);
2611
2902
  }
2612
2903
  // ----------------------------------------------------------
2613
2904
  // Internal
@@ -2618,23 +2909,23 @@ let A = class extends v {
2618
2909
  * Falls back to setTimeout(1000) for browsers without idle callback support.
2619
2910
  */
2620
2911
  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);
2912
+ const e = window.requestIdleCallback ?? ((t) => setTimeout(t, 1e3));
2913
+ for (const { meta: t } of st)
2914
+ e(() => {
2915
+ this.toolRegistry.ensureLoaded(t.name);
2625
2916
  });
2626
2917
  }
2627
2918
  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);
2919
+ for (const e of Mt)
2920
+ this.toolRegistry.register(e);
2921
+ for (const { meta: e, loader: t } of st)
2922
+ this.toolRegistry.registerLazy(e, t);
2632
2923
  }
2633
2924
  applyOptions() {
2634
2925
  this.options.design && this.store.loadDesign(this.options.design);
2635
2926
  }
2636
2927
  render() {
2637
- return c`
2928
+ return p`
2638
2929
  <me-editor-sidebar
2639
2930
  .store=${this.store}
2640
2931
  .toolRegistry=${this.toolRegistry}
@@ -2650,7 +2941,7 @@ let A = class extends v {
2650
2941
  `;
2651
2942
  }
2652
2943
  };
2653
- A.styles = $`
2944
+ B.styles = k`
2654
2945
  :host {
2655
2946
  display: flex;
2656
2947
  width: 100%;
@@ -2665,31 +2956,32 @@ A.styles = $`
2665
2956
  }
2666
2957
  * { box-sizing: border-box; }
2667
2958
  `;
2668
- st([
2669
- f({ type: Object })
2670
- ], A.prototype, "options", 2);
2671
- A = st([
2672
- k("mail-editor")
2673
- ], A);
2674
- function C(t, e) {
2675
- customElements.get(t) || customElements.define(t, e);
2959
+ ct([
2960
+ b({ type: Object })
2961
+ ], B.prototype, "options", 2);
2962
+ B = ct([
2963
+ C("mail-editor")
2964
+ ], B);
2965
+ function _(e, t) {
2966
+ customElements.get(e) || customElements.define(e, t);
2676
2967
  }
2677
- C("mail-editor", A);
2678
- C("me-editor-canvas", I);
2679
- C("me-row-renderer", D);
2680
- C("me-column-renderer", w);
2681
- C("me-content-renderer", _);
2682
- C("me-editor-sidebar", T);
2683
- C("me-body-settings", L);
2684
- C("me-property-panel", P);
2685
- const ae = customElements.get("mail-editor") !== void 0;
2968
+ _("mail-editor", B);
2969
+ _("me-editor-canvas", M);
2970
+ _("me-row-renderer", R);
2971
+ _("me-column-renderer", S);
2972
+ _("me-content-renderer", D);
2973
+ _("me-editor-sidebar", P);
2974
+ _("me-body-settings", A);
2975
+ _("me-property-panel", E);
2976
+ _("me-inline-toolbar", V);
2977
+ const xe = customElements.get("mail-editor") !== void 0;
2686
2978
  export {
2687
- ae as E,
2688
- A as M,
2689
- mt as T,
2690
- ft as a,
2691
- V as e,
2692
- se as j,
2693
- a as s
2979
+ xe as E,
2980
+ B as M,
2981
+ vt as T,
2982
+ wt as a,
2983
+ L as e,
2984
+ me as j,
2985
+ l as s
2694
2986
  };
2695
- //# sourceMappingURL=index-CZt184D3.js.map
2987
+ //# sourceMappingURL=index-BTE3G6Ph.js.map