useblocks 1.1.53 → 1.1.60

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 (68) hide show
  1. package/iframe/js/amp.BP7EklKo.js +1 -1
  2. package/iframe/js/iframe-eblock.js +1 -1
  3. package/iframe/js/iframe.js +1 -1
  4. package/iframe/js/rules.4N5s3OV-.js +1 -1
  5. package/npm-publish.manifest.json +7 -7
  6. package/package.json +1 -7
  7. package/runtime/THIRD_PARTY_LICENSES.txt +0 -235
  8. package/runtime/index.js +0 -2
  9. package/runtime/package.json +0 -6
  10. package/runtime/plugin-dev-manifest.json +0 -4
  11. package/singlepage_headless_plugin.html +1 -1
  12. package/static/core/{5318562c.js → 161d1254.js} +268 -257
  13. package/static/core/{b9f47840.js → 17d3ee0b.js} +8 -8
  14. package/static/core/{6895dd352.js → 195ca4a32.js} +15 -15
  15. package/static/core/{dc1f9e4f.js → 2569fac8.js} +26 -26
  16. package/static/core/{4ca527032.js → 26ddf93e2.js} +2 -2
  17. package/static/core/{9929a348.js → 30c5fe5f.js} +90 -90
  18. package/static/core/{e93d55b92.js → 3af8f3592.js} +4 -4
  19. package/static/core/{ebd852b6.js → 40f73dfb.js} +1019 -1032
  20. package/static/core/{c3058168.js → 43c3f160.js} +3283 -3189
  21. package/static/core/{542ea53f2.js → 4a27bba92.js} +8 -8
  22. package/static/core/4c39852e.js +3150 -0
  23. package/static/core/{e5e07f1d.js → 4e75b331.js} +13 -13
  24. package/static/core/{e1d239ab.js → 5345bef8.js} +42 -42
  25. package/static/core/{31e98e6e.js → 53463a60.js} +707 -712
  26. package/static/core/{27544e7e.js → 581ce428.js} +37 -19
  27. package/static/core/{d8daf1142.js → 6156301b2.js} +3 -3
  28. package/static/core/{c3849484.js → 64bea1a9.js} +5 -5
  29. package/static/core/{ce4fc17f2.js → 680236f4.js} +1 -1
  30. package/static/core/{4b75d16c2.js → 687795b52.js} +4 -4
  31. package/static/core/{70407ac0.js → 72f86b2d.js} +3 -3
  32. package/static/core/{139e4380.js → 7a15fa8b.js} +3 -3
  33. package/static/core/{b77f0769.js → 8432f11e.js} +5 -5
  34. package/static/core/{d1eb3c68.js → 8815eb5b.js} +15670 -15289
  35. package/static/core/{f3cff4c9.js → 8a496b64.js} +158 -158
  36. package/static/core/{4e1b970f.js → 8ba13f332.js} +1 -1
  37. package/static/core/{75737a9d.js → 951903fb.js} +9096 -9074
  38. package/static/core/{a95c02bb.js → a1355a35.js} +5 -5
  39. package/static/core/{7c6fb2162.js → a36c3ab62.js} +3 -3
  40. package/static/core/{2da1d66b.js → abd3f34c.js} +5 -5
  41. package/static/core/{528ad9282.js → ae20f0992.js} +16 -16
  42. package/static/core/ba6c356e.js +466 -0
  43. package/static/core/{ee0ddb51.js → c9e59b34.js} +6884 -4960
  44. package/static/core/{f96d2049.js → d1a1d4902.js} +1 -1
  45. package/static/core/{5b48fd69.js → d8d6485e.js} +5 -5
  46. package/static/core/{59e92cc3.js → d9398296.js} +5 -5
  47. package/static/core/{b408f33a.js → d9baa55e.js} +25 -25
  48. package/static/core/dbf19c2e.js +811 -0
  49. package/static/core/{bc7e3d2b.js → f953827c.js} +10 -10
  50. package/static/core/{1e5bf73c.js → ffee9a77.js} +7 -7
  51. package/static/esm/2474de05.js +131 -0
  52. package/static/esm/{d180c108.js → 53b688bd.js} +66 -85
  53. package/two_step_headless_plugin.html +1 -1
  54. package/useblocks-core.f6bb8947.js +673 -0
  55. package/useblocks-esm.js +875 -552
  56. package/useblocks.d.ts +8 -0
  57. package/useblocks.js +691 -408
  58. package/runtime/prop-types/index.js +0 -4
  59. package/runtime/react-router-dom/index.js +0 -2
  60. package/static/core/1995fb0a2.js +0 -602
  61. package/static/core/1f5e1fc9.js +0 -3097
  62. package/static/core/ce0410b1.js +0 -467
  63. package/static/esm/448d4bb0.js +0 -127
  64. package/static/runtime/dom-export-CHgQ7Ws9.js +0 -8069
  65. package/static/runtime/prop-types-p_yYKrF7.js +0 -47
  66. package/useblocks-core.2a5dade1.js +0 -643
  67. /package/iframe/{iframe-eblock.2a5dade1.html → iframe-eblock.f6bb8947.html} +0 -0
  68. /package/iframe/{iframe.2a5dade1.html → iframe.f6bb8947.html} +0 -0
@@ -1,47 +0,0 @@
1
- import { t as n } from "./rolldown-runtime-Bklm4c_g.js";
2
- var m = n(((a, t) => {
3
- t.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
4
- })), u = n(((a, t) => {
5
- var o = m();
6
- function s() {}
7
- function i() {}
8
- i.resetWarningCache = s, t.exports = function() {
9
- function e(h, f, T, _, l, y) {
10
- if (y !== o) {
11
- var c = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");
12
- throw c.name = "Invariant Violation", c;
13
- }
14
- }
15
- e.isRequired = e;
16
- function r() {
17
- return e;
18
- }
19
- var p = {
20
- array: e,
21
- bigint: e,
22
- bool: e,
23
- func: e,
24
- number: e,
25
- object: e,
26
- string: e,
27
- symbol: e,
28
- any: e,
29
- arrayOf: r,
30
- element: e,
31
- elementType: e,
32
- instanceOf: r,
33
- node: e,
34
- objectOf: r,
35
- oneOf: r,
36
- oneOfType: r,
37
- shape: r,
38
- exact: r,
39
- checkPropTypes: i,
40
- resetWarningCache: s
41
- };
42
- return p.PropTypes = p, p;
43
- };
44
- })), R = n(((a, t) => {
45
- t.exports = u()();
46
- }));
47
- export { R as t };
@@ -1,643 +0,0 @@
1
- __useblocks__.define("core", [
2
- "require",
3
- "exports",
4
- "module",
5
- "static/core/bd36b180.js",
6
- "static/core/ee0ddb51.js",
7
- "static/core/c3058168.js",
8
- "static/core/5318562c.js"
9
- ], function(f, E, he) {
10
- Object.defineProperties(E, {
11
- __esModule: { value: !0 },
12
- [Symbol.toStringTag]: { value: "Module" }
13
- });
14
- f("./static/core/bd36b180.js");
15
- const n = f("./static/core/ee0ddb51.js"), c = f("./static/core/c3058168.js"), h = f("./static/core/5318562c.js");
16
- var L = "Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";
17
- function O() {
18
- const e = new Error(L);
19
- return e.name = "DestroyedInstanceError", e;
20
- }
21
- function w(e) {
22
- return async () => (await e.app.app_init_create({})).data;
23
- }
24
- function F(e, t, r) {
25
- e.inject(n.APP_ID, void 0);
26
- let s;
27
- e.injectFactory(n.APP_ID, async (i, o) => s || (s = (async () => {
28
- const a = o ? await o : void 0;
29
- return t({
30
- baseUrl: r.baseUrl,
31
- user: r.user,
32
- project: r.project,
33
- prevApp: a
34
- });
35
- })(), s), !0);
36
- }
37
- var P = h.defineMixin((e) => {
38
- let t, r, s, i, o, a = !1;
39
- function d(l) {
40
- return String(l || "").trim() || void 0;
41
- }
42
- return { setOptions(l) {
43
- const p = !!e.getInstance(n.SECURITY_MODULE_ID), S = l.hasOwnProperty("baseUrl") ? d(l.baseUrl) : r, u = S ? n.normalizeBaseUrl(S) : void 0;
44
- if (l.hasOwnProperty("baseUrl")) {
45
- const _e = e.getInstance(n.REST_CLIENT_FACTORY_ID);
46
- t !== u && _e?.setOptions(u ? { baseUrl: u } : {});
47
- }
48
- const le = s !== l.appInit, de = !n.deepEqual(i, l.user), ue = o !== l.project, pe = t !== u;
49
- if (s = l.appInit, i = l.user, o = l.project, t = u, r = S, p || a && !le && !de && !ue && !pe) return;
50
- const ge = e.getInstance(n.REST_CLIENT_ID);
51
- F(e, s || w(ge), {
52
- baseUrl: r,
53
- user: l.user,
54
- project: l.project
55
- }), a = !0;
56
- } };
57
- }), v = n.createIdentifier$1(), y = n.createIdentifier$1(), x = h.defineMixin((e) => ({ setOptions(t) {
58
- const r = c.createQueue();
59
- e.addService(n.REQUEST_HANDLER_ID, { execute: r.decorate(async (s) => {
60
- if (!t.jwtAuth) return;
61
- let i = e.getInstance(v);
62
- if (!e.getInstance(y)) {
63
- if (!i) try {
64
- const o = e.getInstance(n.REST_CLIENT_FACTORY_ID)?.getOptions()?.baseUrl || "", a = await fetch(`${o}/jwt-auth/token`, {
65
- method: "POST",
66
- headers: { "Content-Type": "application/json" },
67
- body: JSON.stringify(t.jwtAuth)
68
- });
69
- if (!a.ok) throw new Error(`JWT auth failed: ${a.status}`);
70
- i = (await a.json()).token, e.inject(v, i);
71
- } catch {
72
- throw e.inject(y, n.ERROR), new Error(n.ERROR);
73
- }
74
- i && s.headers.append("authorization", `Bearer ${i}`);
75
- }
76
- }) });
77
- } })), R = h.defineMixin((e) => {
78
- let t, r, s;
79
- return { async setOptions(i) {
80
- const o = s !== i.getAuthToken, a = !n.deepEqual(t, i.user), d = r !== i.project;
81
- if (s = i.getAuthToken, t = i.user, r = i.project, !(!e.getInstance(n.SECURITY_MODULE_ID) || !i.getAuthToken) && !(!o && !a && !d)) try {
82
- const l = await i.getAuthToken(i.user, i.project);
83
- e.inject(n.STANDALONE_BOOTSTRAP_TOKEN_ID, Promise.resolve(l || ""));
84
- const p = c.extractServerProjectIdFromToken(l);
85
- if (!p) return;
86
- e.inject(n.STANDALONE_PROJECT_ID, p);
87
- const S = e.getInstance(n.APP_ID), u = S ? await S.catch(() => {}) : void 0;
88
- e.inject(n.APP_ID, Promise.resolve(c.createFallbackApp(p, u)));
89
- } catch {}
90
- } };
91
- }), N = h.defineMixin((e) => {
92
- const t = e.getInstance(n.DISPOSABLE_ID), r = new n.Emitter(), s = c.prepareEvent(r.event);
93
- t.addDispose(() => {
94
- const o = e.getInstance(n.INSTANCE_ID);
95
- r.fire(o);
96
- });
97
- const i = t.addDisposable(new c.ListenerUpdater(s));
98
- return t.addDisposable(r), {
99
- setOptions({ handleDestroy: o }) {
100
- i.setListener(o);
101
- },
102
- instance: {
103
- handleDestroy: s,
104
- destroy: () => {
105
- if (!t.isDisposed()) try {
106
- t.dispose();
107
- } catch {}
108
- }
109
- }
110
- };
111
- }), M = h.defineMixin((e) => {
112
- const t = e.getInstance(n.DISPOSABLE_ID), r = new c.InitPipelineContext();
113
- e.inject(n.INIT_PIPELINE_ID, r);
114
- let s;
115
- return t.addDispose(() => {
116
- r.abort();
117
- }), {
118
- setOptions(i) {
119
- i.signal !== void 0 && (s = i.signal), r.configure({
120
- replaceSession: !0,
121
- ...i.timeouts !== void 0 ? { timeouts: i.timeouts } : {},
122
- ...s !== void 0 ? { signal: s } : {}
123
- });
124
- },
125
- dispose() {}
126
- };
127
- }), U = h.defineMixin((e) => {
128
- const t = e.getInstance(n.DISPOSABLE_ID), r = c.prepareEvent(n.getEvent$1(e, n.APP_LOAD_EVENT_ID)), s = t.addDisposable(new c.ListenerUpdater(r));
129
- return {
130
- setOptions({ handleLoad: i }) {
131
- s.setListener(i);
132
- },
133
- instance: { handleLoad: r },
134
- dispose: () => t.dispose()
135
- };
136
- }), j = h.defineMixin((e) => {
137
- const t = e.getInstance(n.DISPOSABLE_ID), r = t.addDisposable(new n.AsyncEmitter()), s = t.addDisposable(new n.AsyncEmitter()), i = n.getEmitter$1(e, n.CONFIG_CHANGED_EVENT_ID), o = c.prepareEvent(r.event), a = c.prepareEvent(s.event), d = c.prepareEvent(i.event), l = t.addDisposable(new c.ListenerUpdater(o)), p = t.addDisposable(new c.ListenerUpdater(a)), S = t.addDisposable(new c.ListenerUpdater(d));
138
- return {
139
- instance: {
140
- handleSetOptions: o,
141
- handleOptionsChanged: a,
142
- handleConfigChanged: d
143
- },
144
- async setOptions(u) {
145
- l.setListener(u.handleSetOptions), p.setListener(u.handleOptionsChanged), S.setListener(u.handleConfigChanged), await r.fire(u), await s.fire(u);
146
- },
147
- dispose() {}
148
- };
149
- }), k = 1e4;
150
- function b(e, t, r, s = {}) {
151
- const i = Object.assign({}, e);
152
- for (const [o, a] of Object.entries(t)) if (a !== void 0) if (r.includes(o) && typeof a == "object" && a !== null) {
153
- const d = i[o], l = s[o] ?? {};
154
- i[o] = Object.assign({}, typeof d == "object" && d !== null ? d : l, a);
155
- } else i[o] = a;
156
- return i;
157
- }
158
- var _ = {
159
- border: {
160
- all: null,
161
- top: null,
162
- right: null,
163
- bottom: null,
164
- left: null
165
- },
166
- borderRadius: {
167
- all: 5,
168
- topLeft: null,
169
- topRight: null,
170
- bottomRight: null,
171
- bottomLeft: null
172
- },
173
- borderRadiusCards: {
174
- all: 10,
175
- topLeft: null,
176
- topRight: null,
177
- bottomRight: null,
178
- bottomLeft: null
179
- },
180
- padding: {
181
- all: null,
182
- top: null,
183
- right: null,
184
- bottom: null,
185
- left: null
186
- }
187
- }, B = {
188
- fontFamily: ["Safe Fonts", "-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],
189
- fontSize: 16,
190
- fontSizeDim: "px",
191
- lineHeight: 21,
192
- lineHeightDim: "px",
193
- color: "#5a5a5a",
194
- contrastColor: "#FFFFFF",
195
- textAlign: "left",
196
- paddingBottom: 10,
197
- paddingBottomDim: "px"
198
- }, C = {
199
- fontFamily: ["Safe Fonts", "-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],
200
- fontSize: 24,
201
- fontSizeDim: "px",
202
- lineHeight: 32,
203
- lineHeightDim: "px",
204
- color: "#333333",
205
- contrastColor: "#FFFFFF",
206
- textAlign: "left",
207
- paddingTop: 20,
208
- paddingTopDim: "px",
209
- paddingBottom: 20,
210
- paddingBottomDim: "px",
211
- letterSpacing: 0,
212
- letterSpacingDim: "px",
213
- bold: !0,
214
- italic: !1
215
- }, T = {
216
- color: "#1C52DC",
217
- contrastColor: "#FFFFFF",
218
- underline: !0
219
- }, m = {
220
- fontFamily: ["Safe Fonts", "-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],
221
- fontSize: 16,
222
- fontSizeDim: "px",
223
- letterSpacing: 0,
224
- letterSpacingDim: "px",
225
- color: "#FFFFFF",
226
- contrastColor: "#1C52DC",
227
- bold: !1,
228
- italic: !1,
229
- backgroundColor: "#1C52DC",
230
- contrastBackgroundColor: "#FFFFFF",
231
- marginTop: 10,
232
- marginTopDim: "px",
233
- marginBottom: 10,
234
- marginBottomDim: "px",
235
- border: _.border,
236
- borderRadius: _.borderRadius,
237
- textAlign: "center",
238
- padding: _.padding
239
- }, D = {
240
- backgroundColor: "#FFFFFF",
241
- contrastBackgroundColor: "#1C52DC",
242
- padding: _.padding
243
- }, I = {
244
- contrastBackgroundColor: "#1C52DC",
245
- contrastTextColor: "#FFFFFF",
246
- baseBackgroundColor: "#F8F8F8",
247
- baseTextColor: "#333333",
248
- border: _.border,
249
- borderRadius: _.borderRadiusCards
250
- };
251
- function Y(e) {
252
- return {
253
- ...B,
254
- ...e
255
- };
256
- }
257
- function H(e) {
258
- return {
259
- ...C,
260
- ...e,
261
- bold: e?.bold ?? C.bold,
262
- italic: e?.italic ?? C.italic
263
- };
264
- }
265
- function z(e) {
266
- return {
267
- ...T,
268
- ...e,
269
- underline: e?.underline ?? T.underline
270
- };
271
- }
272
- function V(e) {
273
- return {
274
- ...m,
275
- ...e,
276
- bold: e?.bold ?? m.bold,
277
- italic: e?.italic ?? m.italic,
278
- border: {
279
- ...m.border,
280
- ...e?.border ?? {}
281
- },
282
- borderRadius: {
283
- ...m.borderRadius,
284
- ...e?.borderRadius ?? {}
285
- },
286
- padding: {
287
- ...m.padding,
288
- ...e?.padding ?? {}
289
- }
290
- };
291
- }
292
- function G(e) {
293
- return {
294
- ...D,
295
- ...e,
296
- padding: {
297
- ...D.padding,
298
- ...e?.padding ?? {}
299
- }
300
- };
301
- }
302
- function $(e) {
303
- return {
304
- ...I,
305
- ...e,
306
- border: {
307
- ...I.border,
308
- ...e?.border ?? {}
309
- },
310
- borderRadius: {
311
- ...I.borderRadius,
312
- ...e?.borderRadius ?? {}
313
- }
314
- };
315
- }
316
- var A = class {
317
- _editor;
318
- _layoutSettingsChanged = new n.Emitter();
319
- _contentStylesChanged = new n.Emitter();
320
- _messageSubscription;
321
- _messageSubscriptionPromise;
322
- _prevLayoutSnapshot;
323
- _prevContentSnapshot;
324
- constructor(e) {
325
- this._editor = e;
326
- }
327
- onChangeEmailLayoutSettings(e) {
328
- const t = this._layoutSettingsChanged.event(e);
329
- return this._ensureMessageSubscription(), { dispose: () => {
330
- t.dispose(), this._disposeMessageSubscriptionIfUnused();
331
- } };
332
- }
333
- onChangeEmailContentStyles(e) {
334
- const t = this._contentStylesChanged.event(e);
335
- return this._ensureMessageSubscription(), { dispose: () => {
336
- t.dispose(), this._disposeMessageSubscriptionIfUnused();
337
- } };
338
- }
339
- _disposeMessageSubscriptionIfUnused() {
340
- this._layoutSettingsChanged.hasListeners() || this._contentStylesChanged.hasListeners() || (this._messageSubscription?.dispose(), this._messageSubscription = void 0);
341
- }
342
- _mapLayoutSettings(e = {}) {
343
- return {
344
- backgroundColor: e.backgroundColor || "",
345
- backgroundImage: (e.backgroundImage || []).map((t) => ({
346
- type: "url",
347
- value: t?.value || ""
348
- })),
349
- backgroundPositionX: e.backgroundPositionX || "",
350
- backgroundPositionY: e.backgroundPositionY || "",
351
- backgroundRepeat: e.backgroundRepeat || "",
352
- backgroundSize: e.backgroundSize || "",
353
- backgroundColorContent: e.backgroundColorContent || "",
354
- textStrong: e.textStrong || !1,
355
- textItalic: e.textItalic || !1,
356
- textUnderline: e.textUnderline || !1,
357
- width: e.width,
358
- responsive: e.responsive
359
- };
360
- }
361
- _parseCommonStyles(e) {
362
- let t = { ...c.COMMON_STYLES };
363
- try {
364
- e && e !== "{}" && (t = JSON.parse(e));
365
- } catch {}
366
- return t;
367
- }
368
- _mapCommonStylesToContentStyles(e) {
369
- return {
370
- text: Y(e.text),
371
- headings: H(e.headings),
372
- links: z(e.links),
373
- buttons: V(e.buttons),
374
- block: G(e.block),
375
- cards: $(e.cards)
376
- };
377
- }
378
- _getCurrentLayoutSettings(e) {
379
- return this._mapLayoutSettings(n.selectEmailSettings(e.getState()));
380
- }
381
- _getCurrentContentStyles(e) {
382
- return this._mapCommonStylesToContentStyles(this._parseCommonStyles(n.selectEmail(e.getState())?.common_styles));
383
- }
384
- _getLayoutSnapshot(e) {
385
- return JSON.stringify(e);
386
- }
387
- _getContentSnapshot(e) {
388
- return JSON.stringify(e);
389
- }
390
- async _ensureMessageSubscription() {
391
- if (!this._messageSubscription) {
392
- if (this._messageSubscriptionPromise) return this._messageSubscriptionPromise;
393
- this._messageSubscriptionPromise = (async () => {
394
- const e = await this._editor.container.getInstanceAsync(n.STORE_ID);
395
- if (this._messageSubscription) return;
396
- const t = this._editor.container.getOrCreateInstance(n.MESSAGE_SERVICE_ID, () => new n.MessageService()), r = this._getCurrentLayoutSettings(e), s = this._getCurrentContentStyles(e);
397
- this._prevLayoutSnapshot = this._getLayoutSnapshot(r), this._prevContentSnapshot = this._getContentSnapshot(s), this._messageSubscription = t.addListener((i) => {
398
- const o = i?.data?.operation;
399
- if (o === n.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET) {
400
- const l = this._mapLayoutSettings(i.data?.settings), p = this._getLayoutSnapshot(l);
401
- p !== this._prevLayoutSnapshot && (this._prevLayoutSnapshot = p, this._layoutSettingsChanged.fire(l));
402
- return;
403
- }
404
- if (o !== n.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE) return;
405
- const a = this._mapCommonStylesToContentStyles(i.data?.settings?.commonStyles ?? { ...c.COMMON_STYLES }), d = this._getContentSnapshot(a);
406
- d !== this._prevContentSnapshot && (this._prevContentSnapshot = d, this._contentStylesChanged.fire(a));
407
- });
408
- })();
409
- try {
410
- await this._messageSubscriptionPromise;
411
- } finally {
412
- this._messageSubscriptionPromise = void 0;
413
- }
414
- }
415
- }
416
- async getEmailLayoutSettings() {
417
- const e = await this._editor.container.getInstanceAsync(n.STORE_ID);
418
- return await this._waitForEmailSettingsFromIframe(e), this._getCurrentLayoutSettings(e);
419
- }
420
- async setEmailLayoutSettings(e) {
421
- const t = await this._editor.container.getInstanceAsync(n.STORE_ID);
422
- await this._waitForEmailSettingsFromIframe(t);
423
- const r = {
424
- ...n.selectEmailSettings(t.getState()),
425
- ...e
426
- };
427
- t.dispatch(n.setEmailSettings(r));
428
- const s = this._mapLayoutSettings(r);
429
- this._prevLayoutSnapshot = this._getLayoutSnapshot(s), this._layoutSettingsChanged.fire(s);
430
- }
431
- async _waitForEmailSettingsFromIframe(e, t = k) {
432
- const r = e.getState(), s = n.selectEmail(r), i = n.selectEmailSettings(r);
433
- if (s?.is_inited && i && Object.keys(i).length > 0 && (i.backgroundColor || i.backgroundImage?.[0]?.value || i.width?.value || i.responsive !== void 0) || s?.is_inited) return;
434
- const o = this._editor.container, a = n.getEvent$1(o, n.events.ON_EMAIL_INIT_ID);
435
- return new Promise((d) => {
436
- let l = !1, p;
437
- const S = () => {
438
- p && (clearTimeout(p), p = void 0);
439
- }, u = a(() => {
440
- l || (l = !0, S(), u.dispose(), d());
441
- });
442
- p = setTimeout(() => {
443
- l || (l = !0, u.dispose(), d());
444
- }, t);
445
- });
446
- }
447
- async getEmailContentStyles() {
448
- const e = await this._editor.container.getInstanceAsync(n.STORE_ID);
449
- return this._getCurrentContentStyles(e);
450
- }
451
- async setEmailContentStyles(e) {
452
- const t = await this._editor.container.getInstanceAsync(n.STORE_ID), r = n.selectEmail(t.getState());
453
- if (!r) return;
454
- let s = this._parseCommonStyles(r.common_styles);
455
- e.text !== void 0 && (s.text = {
456
- ...s.text || {},
457
- ...e.text
458
- }), e.headings !== void 0 && (s.headings = {
459
- ...s.headings || {},
460
- ...e.headings
461
- }), e.links !== void 0 && (s.links = {
462
- ...s.links || {},
463
- ...e.links
464
- }), e.buttons !== void 0 && (s.buttons = b(s.buttons || {}, e.buttons, [
465
- "border",
466
- "borderRadius",
467
- "padding"
468
- ], {
469
- border: _.border,
470
- borderRadius: _.borderRadius,
471
- padding: _.padding
472
- })), e.block !== void 0 && (s.block = b(s.block || {}, e.block, ["padding"], { padding: _.padding })), e.cards !== void 0 && (s.cards = b(s.cards || {}, e.cards, ["border", "borderRadius"], {
473
- border: _.border,
474
- borderRadius: _.borderRadiusCards
475
- })), t.dispatch(n.setEmailFromHistory({
476
- ...r,
477
- common_styles: JSON.stringify(s)
478
- }));
479
- const i = this._mapCommonStylesToContentStyles(s);
480
- this._prevContentSnapshot = this._getContentSnapshot(i), this._contentStylesChanged.fire(i);
481
- }
482
- }, J = {
483
- ...n.corePlugins,
484
- EmailSettingsApi: A
485
- };
486
- ({ ...n.corePlugins });
487
- var q = { ...J };
488
- function X() {
489
- c.pluginRegistry.addAll(q);
490
- }
491
- var W = [
492
- M,
493
- N,
494
- U,
495
- j,
496
- x,
497
- R,
498
- h.OAuthMixin,
499
- P
500
- ];
501
- async function Q() {
502
- return (await Promise.resolve().then(() => f("./static/core/d1eb3c68.js"))).default;
503
- }
504
- var Z = (e) => {
505
- let t = null, r = !1;
506
- return {
507
- instance: {},
508
- async setOptions(s) {
509
- if (!t && !r) {
510
- t = (await Q())(e);
511
- const i = await e.getInstanceAsync(n.INSTANCE_ID);
512
- Object.assign(i, t.instance || {}), X();
513
- }
514
- t && await t.setOptions(s);
515
- },
516
- dispose() {
517
- t?.dispose(), r = !0;
518
- }
519
- };
520
- }, ee = h.combineMixins([...W, Z]), te = class {
521
- _storage = Object.create(null);
522
- get(e) {
523
- const t = this._storage[e];
524
- return t && (!t.expires || t.expires < Date.now()) ? t.value : "";
525
- }
526
- set(e, t, r) {
527
- this._storage[e] = {
528
- value: t,
529
- expires: r.expires ? r.expires * 1e3 + Date.now() : void 0
530
- };
531
- }
532
- remove(e) {
533
- delete this._storage[e];
534
- }
535
- }, ne = 100, g = {
536
- events: [],
537
- container: null,
538
- collection: null
539
- };
540
- function se(e, t) {
541
- g.container = e, g.collection = t, t.onLifecycle((r) => {
542
- g.events.push({
543
- ...r,
544
- timestamp: Date.now()
545
- }), g.events.length > ne && (g.events = g.events.slice(-100));
546
- }), typeof window < "u" && (window.__EMAILMAKER_DEVTOOLS__ = ie());
547
- }
548
- function ie() {
549
- return {
550
- enabled: !0,
551
- plugins() {
552
- return g.collection ? g.collection.getStatus().map((e) => ({
553
- ...e,
554
- hasInit: !0,
555
- hasDispose: !0,
556
- hasAfterInit: !0
557
- })) : [];
558
- },
559
- registry() {
560
- if (!g.container) return [];
561
- try {
562
- return g.container.getInstance(c.PLUGIN_REGISTRY_ID).keys().map(String);
563
- } catch {
564
- return [];
565
- }
566
- },
567
- events(e = 50) {
568
- return g.events.slice(-e);
569
- },
570
- clearEvents() {
571
- g.events = [];
572
- },
573
- getPlugin(e) {
574
- if (g.collection) try {
575
- return g.collection.use(e);
576
- } catch {
577
- return;
578
- }
579
- }
580
- };
581
- }
582
- var re = h.combineMixins([ee]);
583
- async function oe(e) {
584
- c.throwIfAborted(e.signal);
585
- const t = new n.Disposable();
586
- async function r() {
587
- const s = n.DependencyResolver.createChild();
588
- if (e.standaloneKey) {
589
- s.inject(n.SECURITY_MODULE_ID, e.standaloneKey);
590
- const a = n.getEvent$1(s, n.events.FILE_PROXY_EVENT_ID);
591
- t.addDisposable(a(async ({ url: d }) => (await fetch(d)).blob(), Number.MIN_VALUE));
592
- }
593
- s.inject(n.DISPOSABLE_ID, t), s.inject(n.COOKIE_MANAGER_ID, new te()), n.registerRestClient(s);
594
- const i = re(s), o = {
595
- ...i.instance,
596
- container: s,
597
- async reset(a) {
598
- if (c.throwIfAborted(a.signal), t.isDisposed()) throw O();
599
- return await i.setOptions(a), o;
600
- }
601
- };
602
- s.inject(n.INSTANCE_ID, o);
603
- try {
604
- if (await i.setOptions(e), c.throwIfAborted(e.signal), e.devTools) try {
605
- const a = s.getInstance(n.PLUGIN_COLLECTION_ID);
606
- a && se(s, a);
607
- } catch {}
608
- return c.throwIfAborted(e.signal), n.getEmitter$1(s, n.APP_LOAD_EVENT_ID).fire(o), o;
609
- } catch (a) {
610
- throw t.dispose(), a;
611
- }
612
- }
613
- try {
614
- return await c.raceWithAbortSignal(r(), e.signal);
615
- } catch (s) {
616
- throw t.isDisposed() || t.dispose(), s;
617
- }
618
- }
619
- async function ae(e) {
620
- const t = new Map();
621
- typeof e == "object" && (e = e.code);
622
- const r = await c.changeHtml(e, async (i) => {
623
- await c.replaceImagesInDocument(i.document, (o) => c.mapper.getEscapedText(o) !== o ? o : c.toAbsoluteUrl(o), t);
624
- for (const o of i.document.querySelectorAll(".em-amp-show-disabled")) o.remove();
625
- i.handleRender(async ({ contentDocument: o, managedNodeController: a }) => {
626
- await c.html2amp(o, {
627
- mappedTags: { script: "___script" },
628
- commit: () => a.commit()
629
- });
630
- });
631
- }, [800]), s = await c.changeHtml(e, async (i) => {
632
- await c.replaceImagesInDocument(i.document, (o) => c.mapper.getEscapedText(o) !== o ? o : c.toAbsoluteUrl(o), t);
633
- for (const o of i.document.querySelectorAll(".em-amp-show-only")) o.remove();
634
- await c.amp2html(i.document, { mappedTags: { script: "___script" } });
635
- }, [800]);
636
- return {
637
- code: e,
638
- html: s,
639
- ampHtml: r
640
- };
641
- }
642
- E.init = oe, E.parseAMP = ae, E.version = "1.1.53";
643
- });