@emailmaker/emailmaker 1.2.3 → 1.2.5

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 (54) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/emailmaker-core.ee1618fa.js +859 -0
  3. package/emailmaker-esm.js +11 -11
  4. package/{emailmaker-po.8c2b05d7.js → emailmaker-po.ee1618fa.js} +1 -1
  5. package/emailmaker.js +12 -12
  6. package/iframe/.vite/manifest.json +4 -4
  7. package/iframe/{iframe-eblock.8c2b05d7.html → iframe-eblock.ee1618fa.html} +2 -2
  8. package/iframe/{iframe.8c2b05d7.html → iframe.ee1618fa.html} +2 -2
  9. package/iframe/js/elMarkupHelper.Buog1r0c.js +278 -0
  10. package/iframe/js/{iframe-eblock.body.8c2b05d7.js → iframe-eblock.body.ee1618fa.js} +1 -1
  11. package/iframe/js/iframe-eblock.js +2 -2
  12. package/iframe/js/{iframe.body.8c2b05d7.js → iframe.body.ee1618fa.js} +1 -1
  13. package/iframe/js/iframe.js +2 -2
  14. package/iframe/js/sanitize-html/sanitize-html.js +46 -21756
  15. package/package.json +1 -1
  16. package/runtime/react/index.js +1 -1
  17. package/static/core/155e871a.js +7 -0
  18. package/static/core/{c6cd3dc2.js → 17fba7af.js} +1 -1
  19. package/static/core/{b752ed52.js → 2a042fe3.js} +1 -1
  20. package/static/core/{dfbe3ba4.js → 32a14159.js} +1 -1
  21. package/static/core/{ed4586a5.js → 4de9c323.js} +1 -1
  22. package/static/core/{9e7c400d.js → 50ba806c.js} +1 -1
  23. package/static/core/{bbb11e65.js → 5b6e2acb.js} +1 -1
  24. package/static/core/{286097e2.js → 63e7f8c1.js} +2 -2
  25. package/static/core/{ee6a6899.js → 64711257.js} +1 -1
  26. package/static/core/{b99f4f42.js → 659796a7.js} +1 -1
  27. package/static/core/{60b75c99.js → 683a6a53.js} +1 -1
  28. package/static/core/{aab84cf4.js → 6b16159c.js} +1 -1
  29. package/static/core/{1912a30e.js → 7e167222.js} +1 -1
  30. package/static/core/{d2a90b69.js → 82f8beb4.js} +1 -1
  31. package/static/core/{844fbb88.js → 987afc3f.js} +1 -1
  32. package/static/core/{e13d6875.js → 9eaed676.js} +1 -1
  33. package/static/core/{1687225b.js → a8b4352d.js} +1 -1
  34. package/static/core/{42ec1ce9.js → b7289065.js} +1 -1
  35. package/static/core/b96e571d.js +2 -0
  36. package/static/core/{9ff19e12.js → c03be019.js} +2 -2
  37. package/static/core/{492992bb.js → c3d00c5e.js} +1 -1
  38. package/static/core/{b6999cba.js → c67df236.js} +1 -1
  39. package/static/core/{c7b2d60e.js → c8443fab.js} +1 -1
  40. package/static/core/{48e93de9.js → d2780737.js} +1 -1
  41. package/static/core/d503c406.js +1 -0
  42. package/static/core/{c2daae71.js → dd230bbb.js} +1 -1
  43. package/static/core/e7fa68c2.js +28 -0
  44. package/static/core/{6535dd13.js → f35181ec.js} +1 -1
  45. package/static/esm/{ea997fe3.js → b4f8dfdc.js} +1 -1
  46. package/static/umd-runtime/{runtime.BqNyFZPj.js → runtime.Bsid8PpY.js} +1 -1
  47. package/vendor/@emailmaker/ui-kit/package.json +1 -1
  48. package/emailmaker-core.8c2b05d7.js +0 -859
  49. package/iframe/js/elMarkupHelper.DnlKn-Lc.js +0 -277
  50. package/iframe/js/sanitize-html/sanitize-html.min.js +0 -16923
  51. package/static/core/316f71b7.js +0 -2
  52. package/static/core/466f98bb.js +0 -28
  53. package/static/core/6e548251.js +0 -1
  54. package/static/core/97aabe39.js +0 -7
package/emailmaker-esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import{n as ps,r as Hl}from"./static/esm/971f1b2c.js";import{$ as Lo,A as $l,At as ve,B as ql,Bt as ue,C as Vl,Ct as je,D as Gl,Dt as Bn,E as zl,Et as Wl,F as Kl,Ft as pt,G as Yl,H as Vr,I as Xl,It as V,J as Jl,K as Ql,L as Sn,Lt as _e,M as hs,Mt as un,N as Zl,Nt as ee,O as Gr,Ot as ec,P as tc,Pt as nc,Q as zr,R as rc,Rt as oc,S as Pe,St as dt,T as No,Tt as mr,U as ic,V as ms,W as zt,X as sc,Y as ac,Z as st,_ as lc,_t as cc,a as dc,at as gs,b as uc,bt as Bt,c as vs,ct as De,d as K,dt as pe,et as jt,f as fc,ft as Wr,gt as Fo,h as pc,ht as hc,i as mc,it as bs,j as gc,jt as Kr,k as vc,kt as bc,l as yc,lt as In,m as Ec,mt as _c,n as wc,nt as ys,o as Sc,ot as fe,p as Yr,pt as Oe,q as Ut,r as Ic,rt as Ue,s as bt,st as W,t as we,u as Cc,ut as Xr,v as Jr,vt as Tc,w as Ac,wt as Rc,x as Qr,xt as Ee,y as Ne,yt as H,z as Es,zt as Pc}from"./static/esm/ea997fe3.js";import{t as Dc}from"./static/esm/f76c9d9d.js";(function(){"use strict";var e=window.__emailmaker__=window.__emailmaker__||{};e.__facadeSentinel="@shared-runtime:init-complete",e.publicPath||(e.publicPath=(function(){var m=(function(){if(typeof document<"u"&&document.querySelector)try{var x=document.querySelector('script[src*="emailmaker-esm.js"]')||document.querySelector('script[src*="emailmaker.js"]');if(x&&x.src)return x.src.substring(0,x.src.lastIndexOf("/")+1)}catch{}try{var E=import.meta.url;if(E)return E.substring(0,E.lastIndexOf("/")+1)}catch{}return"./"})();m||(m="./");try{var f=String(m);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(f)||f.indexOf("//")===0)return f.charAt(f.length-1)==="/"?f:f+"/";var u=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",p=u?new URL(f,u).href:f;return p.charAt(p.length-1)==="/"?p:p+"/"}catch{var D=String(m);return D.charAt(D.length-1)==="/"?D:D+"/"}})()),typeof e.setPublicPath!="function"&&(e.setPublicPath=function(m){return e.publicPath=(function(){var f=m==null?"":String(m);f||(f="./");try{var u=String(f);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(u)||u.indexOf("//")===0)return u.charAt(u.length-1)==="/"?u:u+"/";var p=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",D=p?new URL(u,p).href:u;return D.charAt(D.length-1)==="/"?D:D+"/"}catch{var x=String(f);return x.charAt(x.length-1)==="/"?x:x+"/"}})(),e.publicPath}),e.__publicPathDiagnosticsLogged||(e.__publicPathDiagnosticsLogged=!0,(function(){var m=String(e.publicPath||"");if(m.indexOf("file:")!==0&&!(m&&m!=="./")){var f="";try{if(typeof window<"u"){for(var u in window)if(!(u==="__emailmaker__"||!/^__[^_].*__$/.test(u))){var p;try{p=window[u]}catch{continue}if(p&&typeof p=="object"&&p.publicPath){f=" Another product namespace ("+u+") has publicPath set — verify the host bundler plugin matches the installed npm brand.";break}}}}catch{}}})()),e.assetUrl||(e.assetUrl=function(m){function f(S){try{var N=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"";return N?new URL(String(S||""),N).href:String(S||"")}catch{return String(S||"")}}var u=String(m||"");if(!u)return"";if(/^(?:data:|blob:)/.test(u))return u;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(u)||u.indexOf("//")===0||u.charAt(0)==="/")return f(u);var p=u.replace(/^\.\/+/,"").replace(/^\/+/,""),D="static/media".replace(/^\.\/+/,"").replace(/^\/+/,"").replace(/\/+$/,""),x=D&&p.indexOf(D+"/")!==0?D+"/"+p:p,E=e.publicPath||"./";try{return new URL(x,E).href}catch{return E.slice(-1)!=="/"&&(E+="/"),f(E+x)}}),e.version||(e.version="1.2.3");var t=e.modules=Object.create(null);if(typeof e.define!="function"){var n=`/**
1
+ import{n as Cs,r as nc}from"./static/esm/971f1b2c.js";import{$ as rc,A as oc,At as yr,B as ic,Bt as ht,C as Un,Ct as sc,D as ac,Dt as ut,E as ke,Et as Ie,F as lc,Ft as _e,G as Ts,Gt as he,H as cc,Ht as Ce,I as As,It as Jr,J as Kt,K as Qr,L as dc,Lt as pn,M as Zr,Mt as Hn,N as uc,Nt as fc,O as pc,Ot as Ue,P as hc,Pt as mc,Q as gc,R as vc,Rt as ne,S as bc,St as yc,T as eo,Tt as Ut,U as Rs,Ut as Ec,V as Cn,Vt as z,W as _c,Wt as wc,X as Sc,Y as Ic,Z as Ht,_ as Cc,_t as to,a as Tc,at as $t,b as no,bt as Ac,c as Ps,ct as He,d as Rc,dt as me,et as Pc,f as Dc,ft as Y,g as Oc,gt as ge,h as ro,ht as oo,i as kc,it as xc,j as Mc,jt as Lc,k as Ho,kt as Nc,l as Fc,lt as Ds,m as Bc,mt as Tn,n as jc,nt as io,o as Uc,p as X,pt as xe,q as Hc,r as $c,rt as $o,s as yt,st as Os,t as Te,tt as at,u as Vc,ut as ks,vt as Me,w as qc,wt as q,x as Fe,xt as Vo,y as Gc,yt as zc,z as Wc,zt as Kc}from"./static/esm/b4f8dfdc.js";import{t as Yc}from"./static/esm/f76c9d9d.js";(function(){"use strict";var e=window.__emailmaker__=window.__emailmaker__||{};e.__facadeSentinel="@shared-runtime:init-complete",e.publicPath||(e.publicPath=(function(){var g=(function(){if(typeof document<"u"&&document.querySelector)try{var M=document.querySelector('script[src*="emailmaker-esm.js"]')||document.querySelector('script[src*="emailmaker.js"]');if(M&&M.src)return M.src.substring(0,M.src.lastIndexOf("/")+1)}catch{}try{var y=import.meta.url;if(y)return y.substring(0,y.lastIndexOf("/")+1)}catch{}return"./"})();g||(g="./");try{var p=String(g);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(p)||p.indexOf("//")===0)return p.charAt(p.length-1)==="/"?p:p+"/";var u=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",f=u?new URL(p,u).href:p;return f.charAt(f.length-1)==="/"?f:f+"/"}catch{var P=String(g);return P.charAt(P.length-1)==="/"?P:P+"/"}})()),typeof e.setPublicPath!="function"&&(e.setPublicPath=function(g){return e.publicPath=(function(){var p=g==null?"":String(g);p||(p="./");try{var u=String(p);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(u)||u.indexOf("//")===0)return u.charAt(u.length-1)==="/"?u:u+"/";var f=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",P=f?new URL(u,f).href:u;return P.charAt(P.length-1)==="/"?P:P+"/"}catch{var M=String(p);return M.charAt(M.length-1)==="/"?M:M+"/"}})(),e.publicPath}),e.__publicPathDiagnosticsLogged||(e.__publicPathDiagnosticsLogged=!0,(function(){var g=String(e.publicPath||"");if(g.indexOf("file:")!==0&&!(g&&g!=="./")){var p="";try{if(typeof window<"u"){for(var u in window)if(!(u==="__emailmaker__"||!/^__[^_].*__$/.test(u))){var f;try{f=window[u]}catch{continue}if(f&&typeof f=="object"&&f.publicPath){p=" Another product namespace ("+u+") has publicPath set — verify the host bundler plugin matches the installed npm brand.";break}}}}catch{}}})()),e.assetUrl||(e.assetUrl=function(g){function p(S){try{var F=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"";return F?new URL(String(S||""),F).href:String(S||"")}catch{return String(S||"")}}var u=String(g||"");if(!u)return"";if(/^(?:data:|blob:)/.test(u))return u;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(u)||u.indexOf("//")===0||u.charAt(0)==="/")return p(u);var f=u.replace(/^\.\/+/,"").replace(/^\/+/,""),P="static/media".replace(/^\.\/+/,"").replace(/^\/+/,"").replace(/\/+$/,""),M=P&&f.indexOf(P+"/")!==0?P+"/"+f:f,y=e.publicPath||"./";try{return new URL(M,y).href}catch{return y.slice(-1)!=="/"&&(y+="/"),p(y+M)}}),e.version||(e.version="1.2.5");var t=e.modules=Object.create(null);if(typeof e.define!="function"){var n=`/**
2
2
  * Async AMD Loader (IIFE version for injection)
3
3
  *
4
4
  * This file is injected at the beginning of iframe entry points.
@@ -993,15 +993,15 @@ import{n as ps,r as Hl}from"./static/esm/971f1b2c.js";import{$ as Lo,A as $l,At
993
993
  __amdEnv.syncRequire = syncRequire;
994
994
  __amdEnv.diagnosticsBuffer = diagBuffer;
995
995
  })();
996
- `,r=new Function("__amdEnv",n);r(e),typeof e.require=="function"&&typeof e.require.config=="function"&&e.require.config({baseUrl:"./",paths:{core:"emailmaker-core.8c2b05d7.js",po:"emailmaker-po.8c2b05d7.js",monaco:"static/monaco/index.CCINpETE.js"}})}e.define("__delivery__/libs",[],function(){return import("./static/esm/delivery-libs.js")});var o=function(m){var f,u=function(){return f||(f=Promise.resolve().then(m))};return{then:function(p,D){return u().then(p,D)},catch:function(p){return u().catch(p)},finally:function(p){return u().finally(p)}}},i=o(function(){return e.require(["__delivery__/libs"]).then(function(m){return m[0]})});t.React=o(function(){return i.then(function(m){return m.React})}),t.ReactDom=o(function(){return i.then(function(m){return m.ReactDom})}),t.ReactDomClient=o(function(){return i.then(function(m){return m.ReactDomClient})}),t.ReactJsxRuntime=o(function(){return i.then(function(m){return m.ReactJsxRuntime})}),t.ReactJsxDevRuntime=o(function(){return i.then(function(m){return m.ReactJsxDevRuntime})}),t.AntDesignIconBase=o(function(){return i.then(function(m){return m.AntDesignIconBase})}),t.AntDesignCssinjs=o(function(){return i.then(function(m){return m.AntDesignCssinjs})}),t.Classnames=o(function(){return i.then(function(m){return m.Classnames})}),t.Dayjs=o(function(){return i.then(function(m){return m.Dayjs})});var s=o(function(){return Promise.all([i]).then(function(m){var f=m[0]||Object.create(null),u=Object.create(null);for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(u[p]=f[p]);for(var D in u)Object.prototype.hasOwnProperty.call(u,D)&&(t[D]=u[D]);return u})}),a={Uuid:"the shared `uuid` package was removed from the editor runtime; bundle `uuid` into the plugin or use `crypto.randomUUID()`"},l=["then","toString","valueOf","constructor","inspect","$$typeof"];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&t[c]===void 0&&(t[c]=(function(m,f){return new Proxy(Object.create(null),{get:function(u,p){if(!(typeof p=="symbol"||l.indexOf(p)!==-1))throw new Error("[shared-runtime] "+m+"."+String(p)+" is not available: "+f+".")}})})(c,a[c]));var d={},g={Antd:"[runtime] `antd` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",AntDesignIcons:"[runtime] `@ant-design/icons` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",UiKit:"[runtime] `@emailmaker/ui-kit` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",UiKitIcons:"[runtime] `@emailmaker/ui-kit/icons` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator."},h={Antd:"[runtime] `antd` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version.",AntDesignIcons:"[runtime] `@ant-design/icons` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version.",UiKit:"[runtime] `@emailmaker/ui-kit` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version.",UiKitIcons:"[runtime] `@emailmaker/ui-kit/icons` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version."},y=Object.create(null),I=function(m){for(var f=String(m&&m.stack||"").split(`
997
- `),u="",p=0;p<f.length;p+=1){var D=/((?:https?|file|blob):\/\/[^\s()]+?)(?::\d+){1,2}\)?\s*$/.exec(f[p]);if(D){if(!u){u=D[1];continue}if(D[1]!==u)return D[1]}}return""},w=function(m){var f=I(new Error(m)),u=f?m+" Requested by: "+f+".":m;return e.__compatMissingReason=u,u};if(e.registerCompat=function(m){if(!(!m||typeof m!="object"))for(var f in m)Object.prototype.hasOwnProperty.call(m,f)&&(y[f]=m[f])},e.__compatPending){for(var b=0;b<e.__compatPending.length;b+=1)e.registerCompat(e.__compatPending[b]);e.__compatPending=void 0}for(var R in g)Object.prototype.hasOwnProperty.call(g,R)&&(function(m,f,u){var p=!1,D=function(){if(!(m in y))throw new Error(w(f));return y[m]};Object.defineProperty(t,m,{configurable:!0,enumerable:!0,get:function(){var x=D();return p||(p=!0),x},set:function(x){y[m]=x}}),Object.defineProperty(d,m,{configurable:!0,enumerable:!0,get:D,set:function(x){y[m]=x}})})(R,g[R],h[R]);var A=t;for(var L in d)Object.prototype.hasOwnProperty.call(d,L)&&(A===t&&(A=Object.create(t)),Object.defineProperty(A,L,Object.getOwnPropertyDescriptor(d,L)));var P=s,O=[],_=function(){for(var m=[],f=0;f<O.length;f+=1)(function(u){var p=t[u];p&&typeof p.then=="function"&&m.push(Promise.resolve(p).then(function(D){t[u]=D}))})(O[f]);return Promise.all(m)},C=typeof e.prefetch=="function"?e.prefetch:void 0;if(e.prefetch=function(){return s.then(_).then(function(){if(typeof C=="function")return C.call(e)})},typeof e.define=="function"){let m=function(f){if(!f||typeof f!="object"&&typeof f!="function"||f.__esModule)return f;if(T){var u=T.get(f);if(u)return u}var p=Object.create(null);Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});for(var D=Reflect.ownKeys(f),x=0;x<D.length;x++){var E=D[x];if(E!=="__esModule"){var S=Object.getOwnPropertyDescriptor(f,E);S&&Object.defineProperty(p,E,S)}}return Object.prototype.hasOwnProperty.call(p,"default")||Object.defineProperty(p,"default",{enumerable:!0,value:f,writable:!1}),T&&T.set(f,p),p};var T=typeof WeakMap<"u"?new WeakMap:null;e.define("react",[],function(){var f=A.React;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.React)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.React;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react",[],function(){var f=A.React;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.React)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.React;return m(p)})}),e.define("react-dom",[],function(){var f=A.ReactDom;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.ReactDom)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.ReactDom;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react-dom",[],function(){var f=A.ReactDom;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.ReactDom)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.ReactDom;return m(p)})}),e.define("react-dom/client",[],function(){var f=A.ReactDomClient;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.ReactDomClient)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.ReactDomClient;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react-dom/client",[],function(){var f=A.ReactDomClient;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.ReactDomClient)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.ReactDomClient;return m(p)})}),e.define("react/jsx-runtime",[],function(){var f=A.ReactJsxRuntime;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.ReactJsxRuntime)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.ReactJsxRuntime;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react/jsx-runtime",[],function(){var f=A.ReactJsxRuntime;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.ReactJsxRuntime)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.ReactJsxRuntime;return m(p)})}),e.define("react/jsx-dev-runtime",[],function(){var f=A.ReactJsxDevRuntime;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.ReactJsxDevRuntime)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.ReactJsxDevRuntime;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react/jsx-dev-runtime",[],function(){var f=A.ReactJsxDevRuntime;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.ReactJsxDevRuntime)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.ReactJsxDevRuntime;return m(p)})}),e.define("antd",[],function(){var f=A.Antd;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.Antd)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.Antd;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/antd",[],function(){var f=A.Antd;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.Antd)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.Antd;return m(p)})}),e.define("@ant-design/icons/es/components/AntdIcon",[],function(){var f=A.AntDesignIconBase;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.AntDesignIconBase)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.AntDesignIconBase;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/icons/es/components/AntdIcon",[],function(){var f=A.AntDesignIconBase;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.AntDesignIconBase)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.AntDesignIconBase;return m(p)})}),e.define("@ant-design/icons",[],function(){var f=A.AntDesignIcons;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.AntDesignIcons)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.AntDesignIcons;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/icons",[],function(){var f=A.AntDesignIcons;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.AntDesignIcons)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.AntDesignIcons;return m(p)})}),e.define("@ant-design/cssinjs",[],function(){var f=A.AntDesignCssinjs;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.AntDesignCssinjs)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.AntDesignCssinjs;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/cssinjs",[],function(){var f=A.AntDesignCssinjs;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.AntDesignCssinjs)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.AntDesignCssinjs;return m(p)})}),e.define("classnames",[],function(){var f=A.Classnames;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.Classnames)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.Classnames;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/classnames",[],function(){var f=A.Classnames;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.Classnames)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.Classnames;return m(p)})}),e.define("dayjs",[],function(){var f=A.Dayjs;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.Dayjs)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.Dayjs;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/dayjs",[],function(){var f=A.Dayjs;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.Dayjs)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.Dayjs;return m(p)})}),e.define("@emailmaker/ui-kit",[],function(){var f=A.UiKit;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.UiKit)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.UiKit;return m(p)})}),e.define("@emailmaker/emailmaker/ui-kit",[],function(){var f=A.UiKit;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.UiKit)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.UiKit;return m(p)})}),e.define("@emailmaker/emailmaker/ui-kit/icons",[],function(){var f=A.UiKitIcons;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.UiKitIcons)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.UiKitIcons;return m(p)})}),e.define("@emailmaker/ui-kit/icons",[],function(){var f=A.UiKitIcons;return f&&typeof f.then=="function"?f.then(function(u){return u===void 0?P.then(function(p){return m(p.UiKitIcons)}):m(u)}):f!==void 0?m(f):P.then(function(u){var p=u.UiKitIcons;return m(p)})})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__="@shared-runtime:init-complete"})();var Oc=new Function("url","return import(url)");function kc(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function Zr(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function _s(e){return e.type==="umd"||e.resolve==="registry"}var xc="If the plugin is built on globals, enable the compatibility layer: the `compatGlobals` option of the bundler plugin or `import '<package>/compat-globals'` before creating the editor.";function Mc(e){const t=Array.isArray(e)?e[0]:e;return Zr(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function Lc(e,t){const n=Mc(e),r=Zr(e)?e:void 0,o=t instanceof Error?t.message:String(t),i=r&&_s(r)&&!/compat/iu.test(o)?` ${xc}`:"",s=new Error(`Plugin "${n}" was skipped: it failed to load. ${o}${i}`);return s.cause=t,{name:n,url:r?.url,error:s}}function Nc(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}var Fc=class{_context;_pluginRegistry;_options;_map=new Map;_optionsMap=new Map;_readyMap=new Map;_resolveMap=new Map;_initializingPlugins=new Map;_creatingPlugins=new Set;_initializedPlugins=new Set;_creationOrder=[];_lifecycleListeners=new Set;_activated=!1;constructor(e,t,n={}){this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(Zr(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(_s(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Oc(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,this._options.explainScriptFailure?.();let o;const i=a=>{o||(a.filename===r.src?o=this._scriptExecutionError(e,a.error??a.message):Nc(a)&&(o=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},s=()=>window.removeEventListener("error",i);window.addEventListener("error",i),r.onload=()=>{if(s(),o){n(o);return}t()},r.onerror=()=>{s(),n(new Error(`Failed to load script: ${e}`))},document.head.appendChild(r)})}_scriptExecutionError(e,t){const n=t instanceof Error?t.message:String(t),r=new Error(`Plugin script "${e}" threw while executing: ${n}`);return r.cause=t,r}initSync(e){const t=[];for(const n of e){const r=this._createOrSkip(n,void 0);r&&t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const o=await this._resolveOrSkip(r);if(!o)continue;const i=this._createOrSkip(o.ctor,o.options);i&&!n.has(i)&&(n.add(i),t.push(i))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const s of e){const a=await this._resolveOrSkip(s);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((s,a)=>{t.has(a)||r.push({key:a,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:a,plugin:l}=r[s];await this._initializingPlugins.get(l),await this._disposePlugin(l,l.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(l),this._resolveMap.delete(l),this._initializingPlugins.delete(l),this._initializedPlugins.delete(l);const c=this._creationOrder.indexOf(l);c>=0&&this._creationOrder.splice(c,1)}const o=[],i=new Set;for(const{ctor:s,options:a}of n){const l=this._createOrSkip(s,a);l&&!i.has(l)&&(i.add(l),o.push(l))}this._activated&&await this._startPluginsBatch(o)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,o)=>{let i,s=!1;const a=()=>{s||(s=!0,i&&clearTimeout(i),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(i=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,a),o(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),o=this._createPluginInstance(e,r),i=o.constructor.name;this._emitLifecycle({type:"created",plugin:o,name:i}),o.required?.(),this._map.set(n,o),this._creationOrder.push(o),this._setupReadyPromise(o)}return this._map.get(n)}async _resolveOrSkip(e){try{return await this._resolveEntry(e)}catch(t){const n=Lc(e,t);try{this._options.reportLoadFailure?.(n)}catch{}return}}_createOrSkip(e,t){try{return this._getOrCreate(e,t)}catch(n){const r=e.name||"anonymous plugin";this._emitLifecycle({type:"create:error",ctor:e,name:r,error:n});return}}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);const r=this._options.openEarlyWindow?.();try{return kc(e)?new e(this._context,t):e(this._context,t)||{}}finally{r?.(),this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const o of t){if(this._initializedPlugins.has(o))continue;const i=this._initializingPlugins.get(o);if(i){n.add(i);continue}r.push(o)}if(r.length>0){const o=this._runBatchLifecycle(r);for(const i of r)this._initializingPlugins.set(i,o);n.add(o),o.finally(()=>{for(const i of r)this._initializingPlugins.get(i)===o&&this._initializingPlugins.delete(i)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});const o=this._options.openEarlyWindow?.();try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(i){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:i})}finally{o?.()}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await n.afterInit?.(),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(o){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:o})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},Bc=class{_plugins=new Map;_listeners=new Map;_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const o of n)try{o.callback(t)}catch{}const r=n.filter(o=>!o.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(o=>(t.ctor=o,t.loading=void 0,this._notifyListeners(e,o),o));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const o={callback:t,once:!1};return r.push(o),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const o={callback:t,once:!0};return r.push(o),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(o=>o.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},jc=class{resolveRegistry;constructor(e){this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},Bo=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function Uc(e,t){return t+e}function Hc(){return typeof performance>"u"?Date.now():Uc(performance.now(),performance.timeOrigin)}var $c="emailmaker:diagnostics",qc="diagnostics",Vc="diagnostics";function jo(e,t){return t?`${e}${e.includes("?")?"&":"?"}${Vc}=1`:e}var jn;function Gc(){try{const e=new URLSearchParams(window.location.search).get(qc);return e===null?void 0:e!=="0"}catch{return}}function zc(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function Wc(){try{const e=window.localStorage.getItem($c);return e===null?void 0:e==="1"}catch{return}}function kt(){return jn===void 0&&(jn=typeof window>"u"?!1:Gc()??zc()??Wc()??!1),jn}function Kc(e){return`__${(e||"emailmaker").toLowerCase().replaceAll("-","")}__`}var de={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},p_=Object.values(de),h_=[de.canvasPainted,de.canvasSettled,de.appVisible,de.editorVisible],Yc=5e3,Xc=3e3,Uo="diagnosticsStore",Wt,yt;function Ho(){return{marks:new Bo(Yc),resources:new Bo(Xc)}}function ws(){if(yt)return yt;const e=eo();return e?(yt=e[Uo]??Wt??Ho(),e[Uo]=yt,Wt=void 0,yt):(Wt??=Ho(),Wt)}function ne(e,t){kt()&&ws().marks.push({phase:e,at:Hc(),...t})}function eo(){if(typeof window.__emailmaker__<"u"&&window.__emailmaker__)return window.__emailmaker__;if(typeof window>"u")return;const e=window[Kc()];return e!==null&&typeof e=="object"?e:void 0}function Jc(e){const t=e.length,n=ws();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function Qc(){const e=eo();return!e||!Array.isArray(e.diagnosticsBuffer)?0:Jc(e.diagnosticsBuffer)}var Zc="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function Be(){const e=new Error(Zc);return e.name="DestroyedInstanceError",e}function ed(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function gr(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const i=e,s=t;return i.length===s.length&&i.every((a,l)=>gr(a,s[l]))}const r=Object.keys(e),o=Object.keys(t);return r.length!==o.length?!1:r.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&gr(e[i],t[i]))}function Ss(e,t){const n={watch(r){let o,i=!1;return e.watch(s=>{const a=t(s);i&&gr(o,a)||(o=a,i=!0,r(a))})},select(r){return Ss(n,r)}};return n}function ge(...e){let t=e[0],n=e.length>0;const r=new Set,o={get(){return n?t:void 0},set(i){t=i,n=!0;for(const s of Array.from(r))s(i)},watch(i){return r.add(i),n&&i(t),{dispose:()=>r.delete(i)}},select(i){return Ss(o,i)}};return o}var td=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:ql.UrlEncoded,...t})},Is=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},n={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...n});get_translations3=({id:e,file:t,...n},r={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...r})};function nd(e){return String(e||"").trim()||void 0}var rd=class extends ue{deps;_app;_baseUrl;_appInit;_restBaseUrl;_prevApp;constructor(e){super(),this.deps=e,this.addDisposable(e.options.select(t=>this._slice(t)).watch(t=>this._start(t)))}get app(){return this._app}_slice(e){return Object.prototype.hasOwnProperty.call(e,"baseUrl")&&(this._baseUrl=nd(e.baseUrl)),Object.prototype.hasOwnProperty.call(e,"appInit")&&(this._appInit=e.appInit),{appInit:this._appInit,user:e.user,project:e.project,baseUrl:this._baseUrl,restBaseUrl:this.deps.resolveRestBaseUrl(this._baseUrl),standalone:this.deps.isStandalone()}}_start(e){if(this._restBaseUrl!==e.restBaseUrl&&(this._restBaseUrl=e.restBaseUrl,this.deps.setRestBaseUrl(e.restBaseUrl)),e.standalone)return;const t=e.appInit||this.deps.fallbackAppInit,n=Promise.resolve(t({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:this._prevApp}));this._app=n,n.then(r=>{this._app===n&&(this._prevApp=r)},()=>{}),this.deps.publish(n)}},to=V("AppInitService");function od(e){return async()=>{const t=await e();return(await new td(t).app_init_create({})).data}}function id(e){e.injectFactory(to,(t,n)=>{if(n)return n;const r=new rd({options:e.getInstance(pe),isStandalone:()=>!!e.getInstance(Oe),resolveRestBaseUrl:o=>o?No(o):No()||void 0,setRestBaseUrl:o=>{e.getInstance(Vl)?.setOptions(o?{baseUrl:o}:{})},fallbackAppInit:od(()=>e.getInstanceAsync(rc)),publish:o=>{e.inject(Ue,o)}});return e.getInstance(W)?.addDisposable(r),r},!0)}var no=V("documentSession.emailDocuments");function at(e){return e?.getInstance(no)}var sd=V("RevisionServiceFlag");function Cs(e){return e.getOrCreateInstance(sd,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function Ts(e){return Cs(e).isEnabled()}var ad=V("EmailRightsResolver");function ld(e,t){const n=e.getInstance(ad);return n?n(t):!0}var ro={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},As=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],Rs=2e4,cd=As.reduce((e,t)=>e+ro[t],0),Ps=Rs+cd+3e3;function dd(e){return As.reduce((t,n)=>t+Ds(n,e),0)}function Ds(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:ro[e]}function Os(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Ps}function ks(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:Rs}function Cn(e=Ps){return e+3e3}function xs(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}var ud=()=>Cn();function fd(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function pd(e){return t=>fd(e.getOrCreateInstance(H.BEFORE_SAVE_EMAIL,()=>new je).fire(t),ud())}var Qe=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},Ms=class extends Error{timeoutMs;constructor(e){super(`[emailmaker] handleEmailAutosave did not respond within ${e}ms — the autosave was not written`),this.timeoutMs=e,this.name="IntegratorAutosaveTimeoutError"}},Tn=class extends Error{timeoutMs;constructor(e,t="handleSaveEmail",n="email"){super(`[emailmaker] ${t} did not respond within ${e}ms — the ${n} was not saved`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}};function ae(e){return e.getOrCreateInstance(Ut,()=>new jt)}var Ls=new WeakMap,vr=new WeakMap;function be(e){return Ls.get(e)??0}function fn(e,t){let n=vr.get(e);return n||(n=new Set,vr.set(e,n)),n.add(t),()=>{n?.delete(t)}}function hd(e){Ls.set(e,be(e)+1),vr.get(e)?.forEach(t=>t())}var md=1e4;function gd(e,t=md){return async()=>{const n=ae(e);let r;const o=new Promise(i=>{r=setTimeout(()=>i("silent"),t)});try{const i=await Promise.race([n.sendAsync(K.SANDBOX_CANVAS_SYNCED,void 0,!1),o]);if(i==="silent"||i&&!i.synced)throw i==="silent"||i?.unsent,new Qe("canvas-not-synced")}finally{clearTimeout(r)}}}function vd(e){return e!=null&&e!==""}var Ns;function xt(e,t){return Ns?.capture(e,t)}function bd(e,t){return Ns?.captureMessage(e,t)}var yd=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Ed=200;function Fs(e=new Set){const t=new Set;return(n,r)=>{if(!yd.some(([i,s])=>!e.has(i)&&s.test(n)))return;const o=r??`new:${n.length}:${n.slice(0,200)}`;t.has(o)||(t.size>=Ed&&t.clear(),t.add(o))}}function Bs(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Fs()}}var _d=Bs();function $e(e){return e?.getInstance(Vr)??_d}function wd(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function Kt(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var Ie=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${Kt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Kt(this.oldText)}")`:`(replace@${this.oldPosition} "${Kt(this.oldText)}" with "${Kt(this.newText)}")`}};function $o(e,t){return e===null||e.length===0?t:new Sd(e,t).compress()}var Sd=class Ae{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),o=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(o===null)break;this._acceptCurr(o),o=this._getCurr(++n);continue}if(o===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(o.oldEnd<=r.newPosition){this._acceptCurr(o),o=this._getCurr(++n);continue}if(r.newEnd<=o.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(o.oldPosition<r.newPosition){const[l,c]=Ae._splitCurr(o,r.newPosition-o.oldPosition);this._acceptCurr(l),o=c;continue}if(r.newPosition<o.oldPosition){const[l,c]=Ae._splitPrev(r,o.oldPosition-r.newPosition);this._acceptPrev(l),r=c;continue}let s,a;if(o.oldEnd===r.newEnd)s=r,a=o,r=this._getPrev(++t),o=this._getCurr(++n);else if(o.oldEnd<r.newEnd){const[l,c]=Ae._splitPrev(r,o.oldLength);s=l,a=o,r=c,o=this._getCurr(++n)}else{const[l,c]=Ae._splitCurr(o,r.newLength);s=r,a=l,r=this._getPrev(++t),o=c}this._result[this._resultLen++]=new Ie(s.oldPosition,s.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const i=Ae._merge(this._result);return Ae._removeNoOps(i)}_acceptCurr(t){this._result[this._resultLen++]=Ae._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=Ae._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new Ie(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new Ie(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),o=t.newText.substr(n);return[new Ie(t.oldPosition,t.oldText,t.newPosition,r),new Ie(t.oldEnd,"",t.newPosition+n,o)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),o=t.oldText.substr(n);return[new Ie(t.oldPosition,r,t.newPosition,t.newText),new Ie(t.oldPosition+n,o,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,o=t[0];for(let i=1;i<t.length;i++){const s=t[i];o.oldEnd===s.oldPosition?o=new Ie(o.oldPosition,o.oldText+s.oldText,o.newPosition,o.newText+s.newText):(n[r++]=o,o=s)}return n[r++]=o,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let o=0;o<t.length;o++){const i=t[o];i.oldText!==i.newText&&(n[r++]=i)}return n}};function Id(e){return new Ie(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Cd(e){return e.map(Id)}function qo(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Td(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const o=t[r];n=n.slice(0,o.oldPosition)+o.newText+n.slice(o.oldEnd)}return n}function Ad(e,t,n){let r=0;const o=e.start===e.end;for(const i of t){const s=i.newLength-i.oldLength;if(i.oldLength===0){const a=i.oldPosition;if(o&&a===e.start)r+=n==="after"?s:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=s)}continue}if(o){if(e.start>=i.oldEnd)r+=s;else if(e.start>i.oldPosition)return null;continue}if(e.start>=i.oldEnd)r+=s;else if(e.end>i.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var Ze=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},Vo=0,Rd=Math.random().toString(36).slice(2,8);function Pd(){return Vo+=1,`doc-${Rd}-${Vo}`}function Dd(e){const t=e.createBuffer(),n=e.docId??Pd();let r=e.serverId??null,o=0,i=null,s=e.attributes??{};const a=new Set;let l=!1,c=!1,d;const g=new Set;let h=null;const y=()=>(h?.version!==o&&(h={version:o,value:t.read()}),h.value),I=w=>Object.entries(w).some(([b,R])=>s[b]!==R);return{get:()=>({docId:n,serverId:r,version:o,savedVersion:i,attributes:s}),getContent:y,mutate(w,{source:b}){if(l)return o;const R=w.changes?.length?w.changes:void 0,A=R?Td(y(),R):w.content!==void 0?w.content:void 0,L=A!==void 0&&A!==y(),P=w.attributes!==void 0&&I(w.attributes);if(!L&&!P)return o;const O=!(o>(i??-1)),_=P?Object.keys(w.attributes).filter(T=>s[T]!==w.attributes[T]):[];L&&t.write(A),P&&(s={...s,...w.attributes}),o+=1,b!=="user"&&O&&(i=o);const C={source:b,version:o,changes:R,...L?{content:!0}:{},..._.length>0?{attributes:_}:{}};return a.forEach(T=>T(C)),o},markSaved(w,b){const R={serverId:r,savedVersion:i};b!==void 0&&(r=b),(i===null||w>i)&&(i=w),(R.serverId!==r||R.savedVersion!==i)&&a.forEach(A=>A({source:"system",version:o}))},markUnsaved(){l||i===null||i<o||(i=o-1,a.forEach(w=>w({source:"system",version:o})))},markReady(){c||d!==void 0||(c=!0,g.forEach(w=>w.resolve()),g.clear(),a.forEach(w=>w({source:"system",version:o})))},isReady:()=>c,markFailed(w){c||d!==void 0||l||(d=w,g.forEach(b=>b.reject(new Ze(w))),g.clear(),a.forEach(b=>b({source:"system",version:o})))},failure:()=>d,whenReady(){return c?Promise.resolve():d!==void 0?Promise.reject(new Ze(d)):l?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((w,b)=>{g.add({resolve:w,reject:b})})},subscribe(w){return a.add(w),()=>a.delete(w)},isNew:()=>r===null,isDirty:()=>o>(i??-1),isDisposed:()=>l,dispose(){l=!0,g.forEach(w=>w.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),g.clear(),a.clear(),t.dispose()}}}var Od=500,kd=100,Un=0;function xd(e,t={}){const n=t.groupIntervalMs??Od,r=t.maxSteps??kd,o=t.now??(()=>0);let i=[],s=0,a=Un+=1,l=null,c=!1,d=!1,g=!1;const h=new Set,y=()=>h.forEach(_=>_()),I=(_,C)=>{if(_.length){d=!0;try{e.mutate({changes:_},{source:C})}finally{d=!1}}},w=_=>I(_,"user"),b=_=>{const C=o();c&&l!==null&&C-l<n?i[s-1]=$o(i[s-1],_):(i=i.slice(0,s),i.push(_),s=i.length,c=!0,i.length>r&&(i=i.slice(i.length-r),s=i.length,a=Un+=1)),l=C,y()},R=()=>{c=!1,l=null},A=_=>{if(!_.length)return;const C=i.length>s;C&&(i=i.slice(0,s)),s>0&&(i[s-1]=$o(i[s-1],_)),R(),C&&y()},L=e.subscribe(({source:_,changes:C})=>{if(!(g||d||!C?.length)){if(_==="remote"){P();return}if(_!=="user"){A(C);return}b(C)}}),P=()=>{i=[],s=0,R(),a=Un+=1,y()},O=()=>{if(s===0)return!1;const _=Cd(i[s-1]);return qo(e.getContent(),_)?(w(_),s-=1,R(),!0):(i=i.slice(0,s-1),s=i.length,R(),y(),!1)};return{canUndo:()=>s>0,canRedo:()=>s<i.length,undo(){O()&&y()},redo(){if(!(s>=i.length)){if(!qo(e.getContent(),i[s])){i=i.slice(0,s),R(),y();return}w(i[s]),s+=1,R(),y()}},clear:P,applyWithoutHistory(_){const C=e.get().version;if(I(_,"system"),e.get().version===C){R();return}A(_)},getPast:_=>i.slice(0,s).reverse().slice(0,_),getFuture:_=>i.slice(s).reverse().slice(0,_),createSnapshot:()=>({stackId:a,index:s}),restoreSnapshot(_){if(_.stackId!==a||_.index>s)return!1;for(;s>_.index;)if(!O())return y(),!1;return y(),!0},subscribe(_){return h.add(_),()=>h.delete(_)},dispose(){g=!0,L(),h.clear(),i=[],s=0}}}var Md=["edit","move","resize","insert"];function Hn(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Ld(e){return typeof e=="string"?e:null}function Nd(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Fd(e){return Md.includes(e)?e:null}function Bd(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:Ld(t.originId),changeId:Hn(t.changeId),rev:Hn(t.rev),baseRev:Hn(t.baseRev),expected:Nd(t.expected),intent:Fd(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var oo=e=>e.replace(/\r\n?/g,`
998
- `);function jd(){return typeof navigator<"u"&&navigator.onLine===!1}function Ud(e){if(e==null)return[];const t=[e];if(typeof e!="object")return t;const n=e;if(n.error!=null&&(t.push(n.error),typeof n.error=="object")){const r=n.error;if(r.data!=null){t.push(r.data);const o=r.data;typeof r.data=="object"&&o.error!=null&&t.push(o.error)}r.error!=null&&t.push(r.error)}if(n.data!=null&&(t.push(n.data),typeof n.data=="object")){const r=n.data;r.error!=null&&t.push(r.error)}return n.innerException!=null&&t.push(n.innerException),t}function js(e){if(!e)return!1;if(typeof e=="string"){const n=e.toLowerCase();return n.includes("fetch")||n.includes("network")||n.includes("timeout")||n.includes("failed to fetch")||n.includes("load failed")||n.includes("networkerror")}if(e instanceof Error)return js(e.message);if(typeof e!="object")return!1;const t=e;return t.status==="FETCH_ERROR"||t.status==="TIMEOUT_ERROR"||t.status==="PARSING_ERROR"?!0:typeof t.status=="number"?t.status===0||t.status===408||t.status>=500:!1}function Hd(e){return jd()?!0:Ud(e).some(js)}var Us=new WeakSet,Hs=new WeakMap;function $s(e){typeof e=="object"&&e!==null&&Us.add(e)}function $d(e,t){typeof e=="object"&&e!==null&&Hs.set(e,t)}function qd(e){return typeof e=="object"&&e!==null?Hs.get(e):void 0}function Vd(e){return e instanceof Tn||e instanceof Ms||typeof e=="object"&&e!==null&&Us.has(e)}function Gd(e){return e instanceof Qe||Vd(e)}function zd(e){return e instanceof Qe?e.reason==="canvas-not-synced":!Gd(e)&&Hd(e)}var qs="draft";function ot(e){return e==null||e===""?qs:String(e)}function pn(e){return e==null||e===""?`${br}${qs}`:`${br}${String(e)}`}var br="block:";function te(e){return e?.startsWith(br)===!0}function lt(e){return te(e.sessionKey())?void 0:e.current()}function Ye(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return ne(`show:gate:${e}`,{kind:"wait"}),t.then(o=>(ne(`show:gate:${e}:end`,{kind:"wait"}),o),o=>{const i=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw Kr(o)?(`${e}`,{...n}):(`${e}`,{error:xs(o),...n},void 0),o})}var Wd=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function Kd(e){const t=e?.trim()??"";if(!Wd.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function Rt(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function io(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function Yd(e,t={}){const n=Rt((e??[]).filter(r=>r?.html?.trim()));return io(n,t)?n:null}function Xd(e,t){const n=Date.parse(Rt(e)?.modified??""),r=Yd(e),o=Date.parse(r?.modified??""),i=t===void 0||Number.isFinite(o)&&o>t,s=[n,t??NaN].filter(a=>Number.isFinite(a));return{autosave:i?r:null,...s.length?{latestAt:Math.max(...s)}:{}}}function Go(e,t,n){const r=Rt((e??[]).filter(l=>l?.html?.trim())),o=Date.parse(r?.modified??""),i=Date.parse(Rt((n??[]).filter(l=>l?.html?.trim()))?.modified??""),s=r&&Number.isFinite(o)&&(t===void 0||o>t)&&!(i>o),a=[Date.parse(Rt(e??[])?.modified??""),t??NaN].filter(l=>Number.isFinite(l));return{autosave:s&&io(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function Jd({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var zo=["recovery","plugin","rest"],Qd=["subject","preheader"];function Zd(e){let t={},n;for(let o=zo.length-1;o>=0;o--){const i=e.get(zo[o]);i&&(i.attributes&&(t={...t,...i.attributes}),i.content!==void 0&&(n=i.content))}const r=e.get("plugin")?.attributes;for(const o of Qd){const i=r?.[o];typeof i=="string"&&i!==""&&(t={...t,[o]:i})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function so(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?oo(t.content):void 0,o=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...o?{changes:[new Ie(0,n,0,r)]}:{}},{source:"remote"})}var $n=e=>typeof e=="string"?e.trim():"";function eu(e,t,n,r){const{version:o,attributes:i}=e.get(),s=i,a=r==="snapshot"||r==="anchor",l=a?s.author:void 0,c=a?s.date_gmt:void 0,d=$n(s.title)||$n(s.subject)||$n(t.fallbackTitle);return{version:o,payload:{html:e.getContent(),title:d,subject:s.subject,preheader:s.preheader,description:s.description,common_styles:s.common_styles||"",meta:s.meta,utm_parameters:s.utm_parameters,parent_email:s.parent_email,is_template:s.is_template||!1,is_inited:s.is_inited,tags:s.tags,emailtags:s.emailtags,group:s.group,renderGuid:e.get().docId,project:t.project??s.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source,...l!=null&&l!==""?{author:l}:{},...c?{excerpt:c}:{}}}}var tu=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function nu(e){const t={};for(const n of tu)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function ru(e,t,n,r,o){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(o);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,o):t.saveAutosave(r,o)}function ke(e,t=!1){const n={};for(const r of Object.keys(e)){let o=e[r];o!==void 0&&!(typeof o=="number"&&Number.isNaN(o))&&(t&&typeof o=="object"&&o!==null&&(o=ke(o)),n[r]=o)}return n}function ou(e){return typeof e=="string"&&e.includes("autosave")}var iu=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function Vs(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!iu.has(t))):{}}function ht(e,t,n={}){e&&e.mutate({attributes:su(e.get().attributes,t)},{source:n.source??"user"})}function su(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function ao(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function au(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function Gs(e){if(!e)return null;const t=Vs(e);return e.common_styles!==void 0&&(t.common_styles=au(e.common_styles)),ao(e.html,t)}function zs(e){return e?ao(e.html,ke(Vs(e))):null}var lu=["common_styles","subject","preheader","meta"];function Wo(e){if(!e?.html?.trim())return null;const t={};for(const n of lu)cu(n,e[n])&&(t[n]=e[n]);return ao(e.html,t)}function cu(e,t){return e==="common_styles"?typeof t=="string"&&t.startsWith("{"):e==="meta"?typeof t=="object"&&t!==null&&!Array.isArray(t):typeof t=="string"}var du=["modified","lock"];function uu(e){if(!e)return null;const t={};for(const n of du)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var fu=10,pu=(e,t)=>e.key===t.key&&hu(e.serverId,t.serverId),hu=(e,t)=>e==null||e===t;function mu(e){return typeof e?.then=="function"}var Ko=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},Ws=e=>{e.request.serverId!=null&&!An(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},gu=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),An=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),Yo=(e,t)=>t?.content!==void 0&&Jd({hasUnsavedUserEdit:An(e)})==="skip",Xo=(e,t)=>{for(const n of["subject","preheader"]){const r=t.attributes?.[n];typeof r=="string"&&(e.shownHeaders[n]=r)}},vu=e=>e.document.subscribe(t=>{t.source==="user"&&(t.content&&e.userTouched.add("content"),t.attributes?.forEach(n=>e.userTouched.add(n))),e.document.isDirty()||e.userTouched.clear()}),bu=(e,t)=>{!e.ready||t.content===void 0||e.document.get().serverId==null||(e.contentShown=!0,!(![...e.userTouched].every(n=>n==="content"||n in(t.attributes??{}))||!e.document.isDirty())&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent(),e.userTouched.clear(),e.document.get().docId))},yu=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([o,i])=>e.attributes[o]!==i)),r=t.content!==void 0&&t.content!==e.content?t.content:void 0;return r===void 0&&Object.keys(n).length===0?null:r===void 0?{attributes:n}:{content:r,attributes:n}},Eu=e=>{const t=Zd(e.reports),n=yu(e.lastMerged,t);e.lastMerged=t,e.broughtContent=Rn(t.content)??e.broughtContent,n&&(so(e.document,n),Ws(e))},qn=(e,t)=>{if(!e.ready&&!An(e)){Eu(e);return}e.broughtContent=Rn(t?.content)??e.broughtContent,so(e.document,t)},Rn=e=>e===void 0?void 0:oo(e),_u=(e,t)=>t.content===void 0||Rn(t.content)!==e.broughtContent||!An(e)?t:{...t,content:void 0},wu=e=>{const{attributes:t,serverId:n,docId:r}=e.document.get();return{...t,html:e.document.getContent(),id:n??void 0,isNew:n==null,renderGuid:r}};function Su(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:o,resolveTerms:i,canEdit:s,notifyBeforeSave:a,awaitCanvasSynced:l,savedEchoForm:c=v=>v,onAdapterError:d,onTimeout:g}=e;let h,y;const I=new Set,w=new Set,b=()=>I.forEach(v=>v()),R=(v,k)=>{if(!(v.closed||v.ready)){if(v.error!==void 0){v.document.markFailed(v.error),v.document.get().docId;return}Ws(v),v.ready=!0,v.document.markReady(),v.document.get().docId,[...v.reports.keys()]}},A=(v,k,j)=>{d?.(k.id,j),!(!k.required||v.closed)&&(v.error=j,v.document.get().docId,k.id,b())},L=(v,k)=>{const j=new Set(k.map(B=>B.id));k.forEach(B=>{B.watch&&v.watchers.push(B.watch(U=>v.closed?!1:v.ready&&(Yo(v,U)||v.contentShown===!0&&U?.content!==void 0)?(v.document.get().docId,B.id,!1):(U&&v.reports.set(B.id,U),qn(v,U),U?.content!==void 0&&(v.showFill=void 0),!0)))});const z=(B,U)=>{if(!v.closed){if(!B.required&&Yo(v,U)){v.document.get().docId,B.id,B.loaded?.(!1);return}U&&(v.reports.set(B.id,U),B.id==="plugin"&&Xo(v,U)),qn(v,U),B.loaded?.(U!==null)}},G=()=>{j.size>0||v.closed||(Ko(v),R(v,[]))},F=[];if(k.forEach(B=>{let U;try{U=B.load()}catch(Y){A(v,B,Y),j.delete(B.id);return}if(mu(U)){F.push({id:B.id,required:B.required,load:()=>U,...B.loaded?{loaded:Y=>B.loaded?.(Y)}:{}});return}z(B,U),j.delete(B.id)}),F.length===0){G();return}v.timer=setTimeout(()=>{v.timer=void 0,g?.([...j]),v.document.get().docId,[...j],R(v,[...j])},n),v.timer.unref?.(),F.forEach(B=>{B.load().then(U=>z(B,U)).catch(U=>{A(v,B,U)}).finally(()=>{j.delete(B.id),G()})})},P=async(v,k,j)=>{if(j==="snapshot"||j==="anchor")return;const z=i?.();if(z)return z.resolve({project:k.project??v.project,tags:(v.tags??[]).map(G=>({name:G}))})},O=v=>{if(v.lock===!0&&s?.(v)===!1)return new Qe("locked");const k=v.tags?.length??0,j=v.emailtags?.length??0;if(Math.max(k,j)>fu)return new Qe("too-many-tags")},_=(v,k)=>{const j=v.document.get().serverId;k||j==null||(v.recoveryFacts={emailId:j,historyLoaded:!0,isRecovering:!1},te(v.request.key)||(v.request={...v.request,key:ot(j),serverId:j}))},C=(v,k,j)=>{if(v.closed||j?.id==null)return;const z=v.document.get().serverId,G=z!=null;G&&z!==String(j.id)||(v.document.markSaved(k,String(j.id)),_(v,G),v.document.get().serverId,b())},T=async(v,k,j)=>{try{await v.document.whenReady()}catch(U){return v.saveError=U,v.saveFailures+=1,v.failedIntent=k,v.saveFailures,!1}if(v.closed)return!1;const z=O(v.document.get().attributes);if(z)return v.saveError=z,v.saveFailures+=1,v.failedIntent=k,z.reason,b(),!1;if(a&&(await a(wu(v)).catch(()=>{}),v.closed))return!1;if(l){try{await l()}catch(U){return v.saveError=U,v.saveFailures+=1,v.failedIntent=k,v.saveFailures,b(),!1}if(v.closed)return!1}if(gu(v))return k==="snapshot"||(v.saveError=new Qe("empty-content"),v.saveFailures+=1,v.failedIntent=k,b()),!1;let G;try{G=await P(v.document.get().attributes,j,k)}catch(U){return v.saveError=U,v.saveFailures+=1,v.failedIntent=k,v.saveFailures,b(),!1}if(v.closed)return!1;const{payload:F,version:B}=eu(v.document,j,G,k);v.document.get().docId;try{const U=v.document.get().serverId!=null,Y=await ru(r(),o(v.request.key),k,v.document.get().serverId,F);if(v.closed)return!0;let Z;if(k==="snapshot"||k==="anchor"){const Te=Y?.modified!=null?Date.parse(Y.modified):NaN;Z=Number.isFinite(Te)?Te:Date.now(),v.snapshotVersion=B,v.lastRevisionAt=Z}else v.document.markSaved(B,Y?.id!=null?String(Y.id):void 0),v.savedContent=F.html,v.broughtContent=Rn(c(F.html));_(v,U),v.saveError=void 0,v.saveFailures=0,v.failedIntent=void 0,v.document.get().serverId,b();const xe={intent:k,serverId:v.document.get().serverId,created:!U,...Z!==void 0?{revisionAt:Z}:{}};return w.forEach(Te=>Te(xe)),!0}catch(U){return(k==="publish"||k==="materialize")&&qd(U)?.then(Y=>C(v,B,Y)),v.saveError=U,v.saveFailures+=1,v.failedIntent=k,v.saveFailures,b(),!1}},m=v=>{v.closed=!0,v.watchers.forEach(k=>k()),v.watchers=[],Ko(v),v.history.dispose(),v.document.dispose()},f=()=>{h&&(m(h),h=void 0)},u=()=>{y&&(m(y),y=void 0)},p=(v,k,j)=>{let z=!1;k.show&&(v.show?.id!==k.show.id||v.show.token!==k.show.token)&&(v.show=k.show,z=!0,{docId:v.document.get().docId,...k.show});const G=j==="show"?zs(k.patch):null;if(G){v.reports.set("plugin",G),Xo(v,G);const F=_u(v,G);qn(v,F),bu(v,F)}z&&b()},D=(v,k={})=>S(h,v,k),x=()=>h&&te(h.request.key??"")?y:h,E=v=>({error:v?.saveError,failures:v?.saveFailures??0,saving:v?.saving===!0,failedIntent:v?.failedIntent}),S=(v,k,j)=>!v||v.closed||k==="materialize"&&v.document.get().serverId!=null?Promise.resolve(!1):v.saving?k==="snapshot"||k==="materialize"?Promise.resolve(!1):(v.inFlight??Promise.resolve(!1)).then(()=>S(v,k,j)):(v.saving=!0,b(),v.inFlight=T(v,k,j).finally(()=>{v.saving=!1,v.inFlight=void 0,h===v&&!v.closed&&b()}),v.inFlight),N=(v,k="open",j=!1)=>{if(h&&!h.closed&&k!=="new"&&pu(h.request,v))return p(h,v,k),h.document;f(),j||u();const z=Dd({createBuffer:()=>wd(""),serverId:v.serverId??null}),G={request:v,show:v.show,document:z,history:xd(z,{now:Date.now}),watchers:[],userTouched:new Set,shownHeaders:{},saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return h=G,G.watchers.push(vu(G)),z.get().docId,v.serverId,L(G,t(v,{publishRecoveryFacts(F){G.closed||(G.recoveryFacts=F,b())},readShownContent:()=>G.closed?null:G.document.getContent()})),b(),z},$=(v,k,j)=>({key:te(v)?v:pn(v),serverId:k?.id!=null?String(k.id):null,email:k,show:j});return{openWith:N,open:(v,k={})=>N({key:ot(v),serverId:v,email:k.email,patch:k.patch,show:k.show},"open"),openDraft:(v,k={})=>N({key:ot(void 0),serverId:null,email:v,patch:k.patch,show:k.show},"open"),startNewDraft:(v,k={})=>N({key:ot(void 0),serverId:null,email:v,patch:k.patch,show:k.show},"new"),reload:(v,k={})=>N({key:ot(v),serverId:v,email:k.email,patch:k.patch,show:k.show},"new"),openBlock:(v,k,j)=>N($(v,k,j),"open"),reloadBlock:(v,k,j)=>N($(v,k,j),"new"),openBlockOver:(v,k)=>{const j=$(v,k);return h&&!h.closed&&h.request.key===j.key?h.document:(h&&!h.closed&&!te(h.request.key)&&(u(),y=h,h=void 0),N(j,"open",!0))},resumeSuspended:()=>{if(y)return f(),h=y,y=void 0,b(),h.document},hasSuspended:()=>!!y,suspendedDocument:()=>y?.document,show:(v,k)=>{const j=h;if(!(!j||j.closed))return N({...j.request,patch:v,show:k},"show")},current:()=>h?.document,noteServerFacts:({serverId:v,block:k},j)=>{const z=h;!z||z.closed||z.request.serverId!==v||te(z.request.key??"")===k&&so(z.document,uu(j))},save:D,saveEmail:(v,k={})=>S(x(),v,k),saveState:()=>E(h),emailSaveState:()=>E(x()),revisionFacts(){if(!h)return;const v=h.revisionFactsSnapshot;return v&&v.snapshotVersion===h.snapshotVersion&&v.lastRevisionAt===h.lastRevisionAt?v:(h.revisionFactsSnapshot={snapshotVersion:h.snapshotVersion,lastRevisionAt:h.lastRevisionAt},h.revisionFactsSnapshot)},recoveryFacts:()=>h?.recoveryFacts,history:()=>h?.history,forcedHeaders:()=>h?.forcedHeaders,beginForcedHeaders(v){h&&!h.closed&&(h.forcedHeaders=v)},endForcedHeaders(){for(const v of[h,y])v&&(v.forcedHeaders=void 0)},onSaved(v){return w.add(v),()=>w.delete(v)},showFacts:()=>h?.show,shownHeaders:()=>({...h?.shownHeaders}),showFill:()=>h?.showFill,beginShowFill(v){h&&!h.closed&&(h.showFill={showId:v,codeEdits:0})},noteCodeEdit(){h?.showFill&&(h.showFill.codeEdits+=1)},endShowFill(v){for(const k of[h,y])k?.showFill?.showId===v&&(k.showFill=void 0)},sessionKey:()=>h?.request.key,openError:()=>h?.error,subscribe(v){return I.add(v),()=>I.delete(v)},close(){!h&&!y||(f(),u(),b())}}}var lo=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function co(e){if(e instanceof lo)return e.reason;if(e instanceof Ze)return co(e.reason)}function Iu(e){const t=e instanceof Ze?e.reason:e;return t instanceof lo&&t.reason==="unavailable"&&t.cause instanceof TypeError}function Cu(e){const t=co(e);return t==="forbidden"||t==="not-found"}function Tu(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new lo("not-found");return Gs(n)}}}var Ks=V("EmailPort");function Au(e){return e.getInstance(Ks)}function Ru(e,t){e.inject(Ks,t)}var Ys=V("documentSession.restEmailPortFactories");function Xs(e){return e.getInstance(Ys)!==void 0}function tt(e){const t=e.getInstance(Ys);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var Pu=V("EmailTermsResolver");function Du(e){return e.getInstance(Pu)}var Js=V("EmailHistoryPort"),Ou=V("BlockHistoryPort");function Qs(e){return e.getInstance(Ou)}function Zs(e){return e.getInstance(Js)}function ku(e,t){e.inject(Js,t)}var xu="em_autosave_pending";function hn(e){return`${xu}_${e}`}function Mu(e,t){try{sessionStorage.setItem(hn(e),JSON.stringify(t))}catch{}}function ea(e){try{const t=sessionStorage.getItem(hn(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(hn(e)),null):n}catch{return null}}function St(e){try{sessionStorage.removeItem(hn(e))}catch{}}var Lu=2e3,Nu=5e3,Fu=5,Bu=5e3,ju=4;function Uu(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function Hu(e,t){return e==null||t==null?!1:e.replaceAll(`\r
996
+ `,r=new Function("__amdEnv",n);r(e),typeof e.require=="function"&&typeof e.require.config=="function"&&e.require.config({baseUrl:"./",paths:{core:"emailmaker-core.ee1618fa.js",po:"emailmaker-po.ee1618fa.js",monaco:"static/monaco/index.CCINpETE.js"}})}e.define("__delivery__/libs",[],function(){return import("./static/esm/delivery-libs.js")});var o=function(g){var p,u=function(){return p||(p=Promise.resolve().then(g))};return{then:function(f,P){return u().then(f,P)},catch:function(f){return u().catch(f)},finally:function(f){return u().finally(f)}}},i=o(function(){return e.require(["__delivery__/libs"]).then(function(g){return g[0]})});t.React=o(function(){return i.then(function(g){return g.React})}),t.ReactDom=o(function(){return i.then(function(g){return g.ReactDom})}),t.ReactDomClient=o(function(){return i.then(function(g){return g.ReactDomClient})}),t.ReactJsxRuntime=o(function(){return i.then(function(g){return g.ReactJsxRuntime})}),t.ReactJsxDevRuntime=o(function(){return i.then(function(g){return g.ReactJsxDevRuntime})}),t.AntDesignIconBase=o(function(){return i.then(function(g){return g.AntDesignIconBase})}),t.AntDesignCssinjs=o(function(){return i.then(function(g){return g.AntDesignCssinjs})}),t.Classnames=o(function(){return i.then(function(g){return g.Classnames})}),t.Dayjs=o(function(){return i.then(function(g){return g.Dayjs})});var s=o(function(){return Promise.all([i]).then(function(g){var p=g[0]||Object.create(null),u=Object.create(null);for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(u[f]=p[f]);for(var P in u)Object.prototype.hasOwnProperty.call(u,P)&&(t[P]=u[P]);return u})}),a={Uuid:"the shared `uuid` package was removed from the editor runtime; bundle `uuid` into the plugin or use `crypto.randomUUID()`"},l=["then","toString","valueOf","constructor","inspect","$$typeof"];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&t[c]===void 0&&(t[c]=(function(g,p){return new Proxy(Object.create(null),{get:function(u,f){if(!(typeof f=="symbol"||l.indexOf(f)!==-1))throw new Error("[shared-runtime] "+g+"."+String(f)+" is not available: "+p+".")}})})(c,a[c]));var d={},m={Antd:"[runtime] `antd` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",AntDesignIcons:"[runtime] `@ant-design/icons` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",UiKit:"[runtime] `@emailmaker/ui-kit` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",UiKitIcons:"[runtime] `@emailmaker/ui-kit/icons` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator."},h={Antd:"[runtime] `antd` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version.",AntDesignIcons:"[runtime] `@ant-design/icons` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version.",UiKit:"[runtime] `@emailmaker/ui-kit` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version.",UiKitIcons:"[runtime] `@emailmaker/ui-kit/icons` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version."},E=Object.create(null),w=function(g){for(var p=String(g&&g.stack||"").split(`
997
+ `),u="",f=0;f<p.length;f+=1){var P=/((?:https?|file|blob):\/\/[^\s()]+?)(?::\d+){1,2}\)?\s*$/.exec(p[f]);if(P){if(!u){u=P[1];continue}if(P[1]!==u)return P[1]}}return""},_=function(g){var p=w(new Error(g)),u=p?g+" Requested by: "+p+".":g;return e.__compatMissingReason=u,u};if(e.registerCompat=function(g){if(!(!g||typeof g!="object"))for(var p in g)Object.prototype.hasOwnProperty.call(g,p)&&(E[p]=g[p])},e.__compatPending){for(var b=0;b<e.__compatPending.length;b+=1)e.registerCompat(e.__compatPending[b]);e.__compatPending=void 0}for(var T in m)Object.prototype.hasOwnProperty.call(m,T)&&(function(g,p,u){var f=!1,P=function(){if(!(g in E))throw new Error(_(p));return E[g]};Object.defineProperty(t,g,{configurable:!0,enumerable:!0,get:function(){var M=P();return f||(f=!0),M},set:function(M){E[g]=M}}),Object.defineProperty(d,g,{configurable:!0,enumerable:!0,get:P,set:function(M){E[g]=M}})})(T,m[T],h[T]);var A=t;for(var B in d)Object.prototype.hasOwnProperty.call(d,B)&&(A===t&&(A=Object.create(t)),Object.defineProperty(A,B,Object.getOwnPropertyDescriptor(d,B)));var O=s,k=[],C=function(){for(var g=[],p=0;p<k.length;p+=1)(function(u){var f=t[u];f&&typeof f.then=="function"&&g.push(Promise.resolve(f).then(function(P){t[u]=P}))})(k[p]);return Promise.all(g)},R=typeof e.prefetch=="function"?e.prefetch:void 0;if(e.prefetch=function(){return s.then(C).then(function(){if(typeof R=="function")return R.call(e)})},typeof e.define=="function"){let g=function(p){if(!p||typeof p!="object"&&typeof p!="function"||p.__esModule)return p;if(I){var u=I.get(p);if(u)return u}var f=Object.create(null);Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});for(var P=Reflect.ownKeys(p),M=0;M<P.length;M++){var y=P[M];if(y!=="__esModule"){var S=Object.getOwnPropertyDescriptor(p,y);S&&Object.defineProperty(f,y,S)}}return Object.prototype.hasOwnProperty.call(f,"default")||Object.defineProperty(f,"default",{enumerable:!0,value:p,writable:!1}),I&&I.set(p,f),f};var I=typeof WeakMap<"u"?new WeakMap:null;e.define("react",[],function(){var p=A.React;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.React)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.React;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/react",[],function(){var p=A.React;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.React)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.React;return g(f)})}),e.define("react-dom",[],function(){var p=A.ReactDom;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.ReactDom)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.ReactDom;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/react-dom",[],function(){var p=A.ReactDom;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.ReactDom)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.ReactDom;return g(f)})}),e.define("react-dom/client",[],function(){var p=A.ReactDomClient;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.ReactDomClient)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.ReactDomClient;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/react-dom/client",[],function(){var p=A.ReactDomClient;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.ReactDomClient)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.ReactDomClient;return g(f)})}),e.define("react/jsx-runtime",[],function(){var p=A.ReactJsxRuntime;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.ReactJsxRuntime)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.ReactJsxRuntime;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/react/jsx-runtime",[],function(){var p=A.ReactJsxRuntime;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.ReactJsxRuntime)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.ReactJsxRuntime;return g(f)})}),e.define("react/jsx-dev-runtime",[],function(){var p=A.ReactJsxDevRuntime;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.ReactJsxDevRuntime)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.ReactJsxDevRuntime;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/react/jsx-dev-runtime",[],function(){var p=A.ReactJsxDevRuntime;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.ReactJsxDevRuntime)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.ReactJsxDevRuntime;return g(f)})}),e.define("antd",[],function(){var p=A.Antd;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.Antd)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.Antd;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/antd",[],function(){var p=A.Antd;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.Antd)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.Antd;return g(f)})}),e.define("@ant-design/icons/es/components/AntdIcon",[],function(){var p=A.AntDesignIconBase;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.AntDesignIconBase)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.AntDesignIconBase;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/icons/es/components/AntdIcon",[],function(){var p=A.AntDesignIconBase;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.AntDesignIconBase)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.AntDesignIconBase;return g(f)})}),e.define("@ant-design/icons",[],function(){var p=A.AntDesignIcons;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.AntDesignIcons)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.AntDesignIcons;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/icons",[],function(){var p=A.AntDesignIcons;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.AntDesignIcons)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.AntDesignIcons;return g(f)})}),e.define("@ant-design/cssinjs",[],function(){var p=A.AntDesignCssinjs;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.AntDesignCssinjs)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.AntDesignCssinjs;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/cssinjs",[],function(){var p=A.AntDesignCssinjs;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.AntDesignCssinjs)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.AntDesignCssinjs;return g(f)})}),e.define("classnames",[],function(){var p=A.Classnames;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.Classnames)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.Classnames;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/classnames",[],function(){var p=A.Classnames;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.Classnames)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.Classnames;return g(f)})}),e.define("dayjs",[],function(){var p=A.Dayjs;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.Dayjs)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.Dayjs;return g(f)})}),e.define("@emailmaker/emailmaker/runtime/dayjs",[],function(){var p=A.Dayjs;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.Dayjs)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.Dayjs;return g(f)})}),e.define("@emailmaker/ui-kit",[],function(){var p=A.UiKit;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.UiKit)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.UiKit;return g(f)})}),e.define("@emailmaker/emailmaker/ui-kit",[],function(){var p=A.UiKit;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.UiKit)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.UiKit;return g(f)})}),e.define("@emailmaker/emailmaker/ui-kit/icons",[],function(){var p=A.UiKitIcons;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.UiKitIcons)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.UiKitIcons;return g(f)})}),e.define("@emailmaker/ui-kit/icons",[],function(){var p=A.UiKitIcons;return p&&typeof p.then=="function"?p.then(function(u){return u===void 0?O.then(function(f){return g(f.UiKitIcons)}):g(u)}):p!==void 0?g(p):O.then(function(u){var f=u.UiKitIcons;return g(f)})})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__="@shared-runtime:init-complete"})();var Xc=new Function("url","return import(url)");function Jc(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function so(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function xs(e){return e.type==="umd"||e.resolve==="registry"}var Qc="If the plugin is built on globals, enable the compatibility layer: the `compatGlobals` option of the bundler plugin or `import '<package>/compat-globals'` before creating the editor.";function Zc(e){const t=Array.isArray(e)?e[0]:e;return so(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function ed(e,t){const n=Zc(e),r=so(e)?e:void 0,o=t instanceof Error?t.message:String(t),i=r&&xs(r)&&!/compat/iu.test(o)?` ${Qc}`:"",s=new Error(`Plugin "${n}" was skipped: it failed to load. ${o}${i}`);return s.cause=t,{name:n,url:r?.url,error:s}}function td(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}var nd=class{_context;_pluginRegistry;_options;_map=new Map;_optionsMap=new Map;_readyMap=new Map;_resolveMap=new Map;_initializingPlugins=new Map;_creatingPlugins=new Set;_initializedPlugins=new Set;_creationOrder=[];_lifecycleListeners=new Set;_activated=!1;constructor(e,t,n={}){this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(so(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(xs(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Xc(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,this._options.explainScriptFailure?.();let o;const i=a=>{o||(a.filename===r.src?o=this._scriptExecutionError(e,a.error??a.message):td(a)&&(o=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},s=()=>window.removeEventListener("error",i);window.addEventListener("error",i),r.onload=()=>{if(s(),o){n(o);return}t()},r.onerror=()=>{s(),n(new Error(`Failed to load script: ${e}`))},document.head.appendChild(r)})}_scriptExecutionError(e,t){const n=t instanceof Error?t.message:String(t),r=new Error(`Plugin script "${e}" threw while executing: ${n}`);return r.cause=t,r}initSync(e){const t=[];for(const n of e){const r=this._createOrSkip(n,void 0);r&&t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const o=await this._resolveOrSkip(r);if(!o)continue;const i=this._createOrSkip(o.ctor,o.options);i&&!n.has(i)&&(n.add(i),t.push(i))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const s of e){const a=await this._resolveOrSkip(s);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((s,a)=>{t.has(a)||r.push({key:a,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:a,plugin:l}=r[s];await this._initializingPlugins.get(l),await this._disposePlugin(l,l.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(l),this._resolveMap.delete(l),this._initializingPlugins.delete(l),this._initializedPlugins.delete(l);const c=this._creationOrder.indexOf(l);c>=0&&this._creationOrder.splice(c,1)}const o=[],i=new Set;for(const{ctor:s,options:a}of n){const l=this._createOrSkip(s,a);l&&!i.has(l)&&(i.add(l),o.push(l))}this._activated&&await this._startPluginsBatch(o)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,o)=>{let i,s=!1;const a=()=>{s||(s=!0,i&&clearTimeout(i),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(i=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,a),o(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),o=this._createPluginInstance(e,r),i=o.constructor.name;this._emitLifecycle({type:"created",plugin:o,name:i}),o.required?.(),this._map.set(n,o),this._creationOrder.push(o),this._setupReadyPromise(o)}return this._map.get(n)}async _resolveOrSkip(e){try{return await this._resolveEntry(e)}catch(t){const n=ed(e,t);try{this._options.reportLoadFailure?.(n)}catch{}return}}_createOrSkip(e,t){try{return this._getOrCreate(e,t)}catch(n){const r=e.name||"anonymous plugin";this._emitLifecycle({type:"create:error",ctor:e,name:r,error:n});return}}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);const r=this._options.openEarlyWindow?.();try{return Jc(e)?new e(this._context,t):e(this._context,t)||{}}finally{r?.(),this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const o of t){if(this._initializedPlugins.has(o))continue;const i=this._initializingPlugins.get(o);if(i){n.add(i);continue}r.push(o)}if(r.length>0){const o=this._runBatchLifecycle(r);for(const i of r)this._initializingPlugins.set(i,o);n.add(o),o.finally(()=>{for(const i of r)this._initializingPlugins.get(i)===o&&this._initializingPlugins.delete(i)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});const o=this._options.openEarlyWindow?.();try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(i){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:i})}finally{o?.()}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await n.afterInit?.(),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(o){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:o})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},rd=class{_plugins=new Map;_listeners=new Map;_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const o of n)try{o.callback(t)}catch{}const r=n.filter(o=>!o.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(o=>(t.ctor=o,t.loading=void 0,this._notifyListeners(e,o),o));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const o={callback:t,once:!1};return r.push(o),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const o={callback:t,once:!0};return r.push(o),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(o=>o.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},od=class{resolveRegistry;constructor(e){this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},qo=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function id(e,t){return t+e}function sd(){return typeof performance>"u"?Date.now():id(performance.now(),performance.timeOrigin)}var ad="emailmaker:diagnostics",ld="diagnostics",cd="diagnostics";function Go(e,t){return t?`${e}${e.includes("?")?"&":"?"}${cd}=1`:e}var $n;function dd(){try{const e=new URLSearchParams(window.location.search).get(ld);return e===null?void 0:e!=="0"}catch{return}}function ud(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function fd(){try{const e=window.localStorage.getItem(ad);return e===null?void 0:e==="1"}catch{return}}function xt(){return $n===void 0&&($n=typeof window>"u"?!1:dd()??ud()??fd()??!1),$n}function pd(e){return`__${(e||"emailmaker").toLowerCase().replaceAll("-","")}__`}var pe={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},X_=Object.values(pe),J_=[pe.canvasPainted,pe.canvasSettled,pe.appVisible,pe.editorVisible],hd=5e3,md=3e3,zo="diagnosticsStore",Yt,Et;function Wo(){return{marks:new qo(hd),resources:new qo(md)}}function Ms(){if(Et)return Et;const e=ao();return e?(Et=e[zo]??Yt??Wo(),e[zo]=Et,Yt=void 0,Et):(Yt??=Wo(),Yt)}function oe(e,t){xt()&&Ms().marks.push({phase:e,at:sd(),...t})}function ao(){if(typeof window.__emailmaker__<"u"&&window.__emailmaker__)return window.__emailmaker__;if(typeof window>"u")return;const e=window[pd()];return e!==null&&typeof e=="object"?e:void 0}function gd(e){const t=e.length,n=Ms();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function vd(){const e=ao();return!e||!Array.isArray(e.diagnosticsBuffer)?0:gd(e.diagnosticsBuffer)}var bd="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function je(){const e=new Error(bd);return e.name="DestroyedInstanceError",e}function yd(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function Er(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const i=e,s=t;return i.length===s.length&&i.every((a,l)=>Er(a,s[l]))}const r=Object.keys(e),o=Object.keys(t);return r.length!==o.length?!1:r.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&Er(e[i],t[i]))}function Ls(e,t){const n={watch(r){let o,i=!1;return e.watch(s=>{const a=t(s);i&&Er(o,a)||(o=a,i=!0,r(a))})},select(r){return Ls(n,r)}};return n}function ye(...e){let t=e[0],n=e.length>0;const r=new Set,o={get(){return n?t:void 0},set(i){t=i,n=!0;for(const s of Array.from(r))s(i)},watch(i){return r.add(i),n&&i(t),{dispose:()=>r.delete(i)}},select(i){return Ls(o,i)}};return o}var Ed=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:_c.UrlEncoded,...t})},Ns=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},n={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...n});get_translations3=({id:e,file:t,...n},r={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...r})};function _d(e){return String(e||"").trim()||void 0}var wd=class extends he{deps;_app;_baseUrl;_appInit;_restBaseUrl;_prevApp;constructor(e){super(),this.deps=e,this.addDisposable(e.options.select(t=>this._slice(t)).watch(t=>this._start(t)))}get app(){return this._app}_slice(e){return Object.prototype.hasOwnProperty.call(e,"baseUrl")&&(this._baseUrl=_d(e.baseUrl)),Object.prototype.hasOwnProperty.call(e,"appInit")&&(this._appInit=e.appInit),{appInit:this._appInit,user:e.user,project:e.project,baseUrl:this._baseUrl,restBaseUrl:this.deps.resolveRestBaseUrl(this._baseUrl),standalone:this.deps.isStandalone()}}_start(e){if(this._restBaseUrl!==e.restBaseUrl&&(this._restBaseUrl=e.restBaseUrl,this.deps.setRestBaseUrl(e.restBaseUrl)),e.standalone)return;const t=e.appInit||this.deps.fallbackAppInit,n=Promise.resolve(t({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:this._prevApp}));this._app=n,n.then(r=>{this._app===n&&(this._prevApp=r)},()=>{}),this.deps.publish(n)}},lo=z("AppInitService");function Sd(e){return async()=>{const t=await e();return(await new Ed(t).app_init_create({})).data}}function Id(e){e.injectFactory(lo,(t,n)=>{if(n)return n;const r=new wd({options:e.getInstance(ge),isStandalone:()=>!!e.getInstance(Me),resolveRestBaseUrl:o=>o?Ho(o):Ho()||void 0,setRestBaseUrl:o=>{e.getInstance(ac)?.setOptions(o?{baseUrl:o}:{})},fallbackAppInit:Sd(()=>e.getInstanceAsync(cc)),publish:o=>{e.inject(He,o)}});return e.getInstance(Y)?.addDisposable(r),r},!0)}var co=z("documentSession.emailDocuments");function lt(e){return e?.getInstance(co)}var Cd=z("RevisionServiceFlag");function Fs(e){return e.getOrCreateInstance(Cd,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function Bs(e){return Fs(e).isEnabled()}var Td=z("EmailRightsResolver");function Ad(e,t){const n=e.getInstance(Td);return n?n(t):!0}var uo={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},js=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],Us=2e4,Rd=js.reduce((e,t)=>e+uo[t],0),Hs=Us+Rd+3e3;function Pd(e){return js.reduce((t,n)=>t+$s(n,e),0)}function $s(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:uo[e]}function Vs(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Hs}function qs(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:Us}function An(e=Hs){return e+3e3}function Gs(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}var Dd=()=>An();function Od(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function kd(e){return t=>Od(e.getOrCreateInstance(q.BEFORE_SAVE_EMAIL,()=>new Ue).fire(t),Dd())}var Ze=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},xd=class extends Error{constructor(e){super(`[emailmaker] слот автосохранения недоступен: у письма ${e} нет копии в WordPress`),this.name="AutosaveSlotUnavailableError"}},zs=class extends Error{timeoutMs;constructor(e){super(`[emailmaker] handleEmailAutosave did not respond within ${e}ms — the autosave was not written`),this.timeoutMs=e,this.name="IntegratorAutosaveTimeoutError"}},Rn=class extends Error{timeoutMs;constructor(e,t="handleSaveEmail",n="email"){super(`[emailmaker] ${t} did not respond within ${e}ms — the ${n} was not saved`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}};function de(e){return e.getOrCreateInstance(Ht,()=>new $t)}var Ws=new WeakMap,_r=new WeakMap;function we(e){return Ws.get(e)??0}function hn(e,t){let n=_r.get(e);return n||(n=new Set,_r.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Md(e){Ws.set(e,we(e)+1),_r.get(e)?.forEach(t=>t())}function wr(e,t){return e.originId!==null||t.originId!==null?e.originId===t.originId:e.generation===t.generation}var Ld=z("documentSession.canvasReceipts");function Nd(){let e,t={scope:{generation:-1,originId:null},changeId:0};return{open(n,r){const o={guid:n,version:r};return e=o,()=>{e===o&&(e=void 0)}},note(n,r){const o=wr(t.scope,r)?t.changeId:0;t={scope:r,changeId:Math.max(o,n)}},read(n){if(!e)return;const{scope:r}=t,o={guid:e.guid,rev:e.version()};return r.originId!==null?{...o,changeId:t.changeId,originId:r.originId}:{...o,changeId:r.generation===n?t.changeId:0}}}}function Ks(e){return e.getOrCreateInstance(Ld,Nd)}var Fd=2e3,Bd=Vc+Rc+Fd;function jd(e,t=Bd){return async()=>{const n=de(e);let r;const o=new Promise(i=>{r=setTimeout(()=>i("silent"),t)});try{const i=Ks(e).read(we(n)),s=await Promise.race([n.sendAsync(X.SANDBOX_CANVAS_SYNCED,i?{applied:i}:void 0,!1),o]);if(s==="silent"||s&&!s.synced)throw s==="silent"||s?.unsent,new Ze("canvas-not-synced")}finally{clearTimeout(r)}}}function Ud(e){return e!=null&&e!==""}var Ys;function Mt(e,t){return Ys?.capture(e,t)}function Hd(e,t){return Ys?.captureMessage(e,t)}var $d=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Vd=200;function Xs(e=new Set){const t=new Set;return(n,r)=>{if(!$d.some(([i,s])=>!e.has(i)&&s.test(n)))return;const o=r??`new:${n.length}:${n.slice(0,200)}`;t.has(o)||(t.size>=Vd&&t.clear(),t.add(o))}}function Js(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Xs()}}var qd=Js();function Ve(e){return e?.getInstance(Qr)??qd}function Gd(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function Xt(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var Re=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${Xt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Xt(this.oldText)}")`:`(replace@${this.oldPosition} "${Xt(this.oldText)}" with "${Xt(this.newText)}")`}};function Ko(e,t){return e===null||e.length===0?t:new zd(e,t).compress()}var zd=class De{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),o=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(o===null)break;this._acceptCurr(o),o=this._getCurr(++n);continue}if(o===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(o.oldEnd<=r.newPosition){this._acceptCurr(o),o=this._getCurr(++n);continue}if(r.newEnd<=o.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(o.oldPosition<r.newPosition){const[l,c]=De._splitCurr(o,r.newPosition-o.oldPosition);this._acceptCurr(l),o=c;continue}if(r.newPosition<o.oldPosition){const[l,c]=De._splitPrev(r,o.oldPosition-r.newPosition);this._acceptPrev(l),r=c;continue}let s,a;if(o.oldEnd===r.newEnd)s=r,a=o,r=this._getPrev(++t),o=this._getCurr(++n);else if(o.oldEnd<r.newEnd){const[l,c]=De._splitPrev(r,o.oldLength);s=l,a=o,r=c,o=this._getCurr(++n)}else{const[l,c]=De._splitCurr(o,r.newLength);s=r,a=l,r=this._getPrev(++t),o=c}this._result[this._resultLen++]=new Re(s.oldPosition,s.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const i=De._merge(this._result);return De._removeNoOps(i)}_acceptCurr(t){this._result[this._resultLen++]=De._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=De._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new Re(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new Re(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),o=t.newText.substr(n);return[new Re(t.oldPosition,t.oldText,t.newPosition,r),new Re(t.oldEnd,"",t.newPosition+n,o)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),o=t.oldText.substr(n);return[new Re(t.oldPosition,r,t.newPosition,t.newText),new Re(t.oldPosition+n,o,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,o=t[0];for(let i=1;i<t.length;i++){const s=t[i];o.oldEnd===s.oldPosition?o=new Re(o.oldPosition,o.oldText+s.oldText,o.newPosition,o.newText+s.newText):(n[r++]=o,o=s)}return n[r++]=o,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let o=0;o<t.length;o++){const i=t[o];i.oldText!==i.newText&&(n[r++]=i)}return n}};function Wd(e){return new Re(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Kd(e){return e.map(Wd)}function Yo(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Yd(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const o=t[r];n=n.slice(0,o.oldPosition)+o.newText+n.slice(o.oldEnd)}return n}function Xd(e,t,n){let r=0;const o=e.start===e.end;for(const i of t){const s=i.newLength-i.oldLength;if(i.oldLength===0){const a=i.oldPosition;if(o&&a===e.start)r+=n==="after"?s:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=s)}continue}if(o){if(e.start>=i.oldEnd)r+=s;else if(e.start>i.oldPosition)return null;continue}if(e.start>=i.oldEnd)r+=s;else if(e.end>i.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var et=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},Xo=0,Jd=Math.random().toString(36).slice(2,8);function Qd(){return Xo+=1,`doc-${Jd}-${Xo}`}function Zd(e){const t=e.createBuffer(),n=e.docId??Qd();let r=e.serverId??null,o=0,i=null,s=e.attributes??{};const a=new Set;let l=!1,c=!1,d;const m=new Set;let h=null;const E=()=>(h?.version!==o&&(h={version:o,value:t.read()}),h.value),w=_=>Object.entries(_).some(([b,T])=>s[b]!==T);return{get:()=>({docId:n,serverId:r,version:o,savedVersion:i,attributes:s}),getContent:E,mutate(_,{source:b}){if(l)return o;const T=_.changes?.length?_.changes:void 0,A=T?Yd(E(),T):_.content!==void 0?_.content:void 0,B=A!==void 0&&A!==E(),O=_.attributes!==void 0&&w(_.attributes);if(!B&&!O)return o;const k=!(o>(i??-1)),C=O?Object.keys(_.attributes).filter(I=>s[I]!==_.attributes[I]):[];B&&t.write(A),O&&(s={...s,..._.attributes}),o+=1,b!=="user"&&k&&(i=o);const R={source:b,version:o,changes:T,...B?{content:!0}:{},...C.length>0?{attributes:C}:{}};return a.forEach(I=>I(R)),o},markSaved(_,b){const T={serverId:r,savedVersion:i};b!==void 0&&(r=b),(i===null||_>i)&&(i=_),(T.serverId!==r||T.savedVersion!==i)&&a.forEach(A=>A({source:"system",version:o}))},markUnsaved(){l||i===null||i<o||(i=o-1,a.forEach(_=>_({source:"system",version:o})))},markReady(){c||d!==void 0||(c=!0,m.forEach(_=>_.resolve()),m.clear(),a.forEach(_=>_({source:"system",version:o})))},isReady:()=>c,markFailed(_){c||d!==void 0||l||(d=_,m.forEach(b=>b.reject(new et(_))),m.clear(),a.forEach(b=>b({source:"system",version:o})))},failure:()=>d,whenReady(){return c?Promise.resolve():d!==void 0?Promise.reject(new et(d)):l?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((_,b)=>{m.add({resolve:_,reject:b})})},subscribe(_){return a.add(_),()=>a.delete(_)},isNew:()=>r===null,isDirty:()=>o>(i??-1),isDisposed:()=>l,dispose(){l=!0,m.forEach(_=>_.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),m.clear(),a.clear(),t.dispose()}}}var eu=500,tu=100,Vn=0;function Jo(e,t){let n=0;for(const r of t){if(r.oldPosition>e||r.oldPosition===e&&r.oldLength>0)break;if(r.oldEnd>e)return r.newEnd;n=r.newEnd-r.oldEnd}return e+n}function nu(e,t){const n={before:e?.before,after:t?.after};return n.before||n.after?n:void 0}function ru(e,t){const n=e?.after;return n?{...e,after:{start:Jo(n.start,t),end:Jo(n.end,t)}}:e}function ou(e,t={}){const n=t.groupIntervalMs??eu,r=t.maxSteps??tu,o=t.now??(()=>0);let i=[],s=0,a=Vn+=1,l=null,c,d,m,h=!1,E=!1,w=!1,_=!1;const b=new Set,T=()=>b.forEach(u=>u()),A=(u,f)=>{if(u.length){w=!0;try{e.mutate({changes:u},{source:f})}finally{w=!1}}},B=u=>A(u,"user"),O=u=>{const f=c?.from??o();if(E&&l!==null&&h===(c!==void 0)&&f>=l&&f-l<n){const P=i[s-1];i[s-1]={changes:Ko(P.changes,u),selection:nu(P.selection,d)}}else i=i.slice(0,s),i.push({changes:u,selection:d}),s=i.length,E=!0,i.length>r&&(i=i.slice(i.length-r),s=i.length,a=Vn+=1);l=c?.to??f,h=c!==void 0,T()},k=()=>{E=!1,l=null},C=u=>{if(!u.length)return;const f=i.length>s;if(f&&(i=i.slice(0,s)),s>0){const P=i[s-1];i[s-1]={changes:Ko(P.changes,u),selection:ru(P.selection,u)}}k(),f&&T()},R=e.subscribe(({source:u,changes:f})=>{if(!(_||w||!f?.length)){if(u==="remote"){I();return}if(u!=="user"){C(f);return}O(f)}}),I=()=>{i=[],s=0,k(),a=Vn+=1,T()},g=(u,f)=>{m=f;try{B(u)}finally{m=void 0}},p=(u=!1)=>{if(s===0)return!1;const f=i[s-1],P=Kd(f.changes);return Yo(e.getContent(),P)?(g(P,u?{kind:"undo",selection:f.selection?.before}:void 0),s-=1,k(),!0):(i=i.slice(0,s-1),s=i.length,k(),T(),!1)};return{recordAt(u,f,P){const M=c,y=d;c=u,d=P;try{return f()}finally{c=M,d=y}},activeMove:()=>m,canUndo:()=>s>0,canRedo:()=>s<i.length,undo(){p(!0)&&T(),k()},redo(){if(s>=i.length){k();return}const u=i[s];if(!Yo(e.getContent(),u.changes)){i=i.slice(0,s),k(),T();return}g(u.changes,{kind:"redo",selection:u.selection?.after}),s+=1,k(),T()},clear:I,closeGroup:k,applyWithoutHistory(u){const f=e.get().version;if(A(u,"system"),e.get().version===f){k();return}C(u)},getPast:u=>i.slice(0,s).reverse().slice(0,u).map(f=>f.changes),getFuture:u=>i.slice(s).reverse().slice(0,u).map(f=>f.changes),createSnapshot:()=>({stackId:a,index:s}),restoreSnapshot(u){if(u.stackId!==a||u.index>s)return!1;for(;s>u.index;)if(!p())return T(),!1;return T(),!0},subscribe(u){return b.add(u),()=>b.delete(u)},dispose(){_=!0,R(),b.clear(),i=[],s=0}}}var iu=["edit","move","resize","insert"];function qn(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function su(e){return typeof e=="string"?e:null}function au(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function lu(e){return iu.includes(e)?e:null}function cu(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:su(t.originId),changeId:qn(t.changeId),rev:qn(t.rev),baseRev:qn(t.baseRev),expected:au(t.expected),intent:lu(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var fo=e=>e.replace(/\r\n?/g,`
998
+ `),du=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;function Sr(e){return typeof e=="string"&&du.test(e)}var uu=class extends Error{kind;failed;constructor(e,t){super(`не удалось завести термы (${e}): ${t.map(({name:n})=>n).join(", ")}`),this.name="TermsFailedError",this.kind=e,this.failed=t}};function fu(){return typeof navigator<"u"&&navigator.onLine===!1}function pu(e){if(e==null)return[];const t=[e];if(typeof e!="object")return t;const n=e;if(n.error!=null&&(t.push(n.error),typeof n.error=="object")){const r=n.error;if(r.data!=null){t.push(r.data);const o=r.data;typeof r.data=="object"&&o.error!=null&&t.push(o.error)}r.error!=null&&t.push(r.error)}if(n.data!=null&&(t.push(n.data),typeof n.data=="object")){const r=n.data;r.error!=null&&t.push(r.error)}return n.innerException!=null&&t.push(n.innerException),t}function Qs(e){if(!e)return!1;if(typeof e=="string"){const n=e.toLowerCase();return n.includes("fetch")||n.includes("network")||n.includes("timeout")||n.includes("failed to fetch")||n.includes("load failed")||n.includes("networkerror")}if(e instanceof Error)return Qs(e.message);if(typeof e!="object")return!1;const t=e;return t.status==="FETCH_ERROR"||t.status==="TIMEOUT_ERROR"||t.status==="PARSING_ERROR"?!0:typeof t.status=="number"?t.status===0||t.status===408||t.status>=500:!1}function hu(e){return fu()?!0:pu(e).some(Qs)}var Zs=new WeakSet,ea=new WeakMap;function ta(e){typeof e=="object"&&e!==null&&Zs.add(e)}function mu(e,t){typeof e=="object"&&e!==null&&ea.set(e,t)}function gu(e){return typeof e=="object"&&e!==null?ea.get(e):void 0}function vu(e){return e instanceof Rn||e instanceof zs||typeof e=="object"&&e!==null&&Zs.has(e)}function bu(e){return e instanceof Ze||e instanceof xd||e instanceof uu||vu(e)}function Qo(e){return na(e)?.v2Error?.data?.code==="emails.mirror_unavailable"}function na(e){return e instanceof Error&&e.name==="EmailWriteFailedError"?e:void 0}function yu(e){if(e instanceof Ze)return e.reason==="canvas-not-synced";if(bu(e))return!1;const t=na(e);return t?(t.v2Error?.status??0)>0?Qo(e):!0:hu(e)||Qo(e)}var ra="draft";function it(e){return e==null||e===""?ra:String(e)}function mn(e){return e==null||e===""?`${Ir}${ra}`:`${Ir}${String(e)}`}var Ir="block:";function re(e){return e?.startsWith(Ir)===!0}function ct(e){return re(e.sessionKey())?void 0:e.current()}function Xe(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return oe(`show:gate:${e}`,{kind:"wait"}),t.then(o=>(oe(`show:gate:${e}:end`,{kind:"wait"}),o),o=>{const i=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw Jr(o)?(`${e}`,{...n}):(`${e}`,{error:Gs(o),...n},void 0),o})}var Eu=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function _u(e){const t=e?.trim()??"";if(!Eu.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function Pt(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function po(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function wu(e,t={}){const n=Pt((e??[]).filter(r=>r?.html?.trim()));return po(n,t)?n:null}function Su(e,t){const n=Date.parse(Pt(e)?.modified??""),r=wu(e),o=Date.parse(r?.modified??""),i=t===void 0||Number.isFinite(o)&&o>t,s=[n,t??NaN].filter(a=>Number.isFinite(a));return{autosave:i?r:null,...s.length?{latestAt:Math.max(...s)}:{}}}function Zo(e,t,n){const r=Pt((e??[]).filter(l=>l?.html?.trim())),o=Date.parse(r?.modified??""),i=Date.parse(Pt((n??[]).filter(l=>l?.html?.trim()))?.modified??""),s=r&&Number.isFinite(o)&&(t===void 0||o>t)&&!(i>o),a=[Date.parse(Pt(e??[])?.modified??""),t??NaN].filter(l=>Number.isFinite(l));return{autosave:s&&po(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function Iu({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var ei=["recovery","plugin","rest"],Cu=["subject","preheader"];function Tu(e){let t={},n;for(let o=ei.length-1;o>=0;o--){const i=e.get(ei[o]);i&&(i.attributes&&(t={...t,...i.attributes}),i.content!==void 0&&(n=i.content))}const r=e.get("plugin")?.attributes;for(const o of Cu){const i=r?.[o];typeof i=="string"&&i!==""&&(t={...t,[o]:i})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function gn(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?fo(t.content):void 0,o=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...o?{changes:[new Re(0,n,0,r)]}:{}},{source:"remote"})}var Gn=e=>typeof e=="string"?e.trim():"";function Au(e,t,n,r){const{version:o,attributes:i}=e.get(),s=i,a=r==="snapshot"||r==="anchor",l=a?s.author:void 0,c=a?s.date_gmt:void 0,d=Gn(s.title)||Gn(s.subject)||Gn(t.fallbackTitle);return{version:o,payload:{html:e.getContent(),title:d,subject:s.subject,preheader:s.preheader,description:s.description,common_styles:s.common_styles||"",meta:s.meta,utm_parameters:s.utm_parameters,parent_email:s.parent_email,is_template:s.is_template||!1,is_inited:s.is_inited,tags:s.tags,emailtags:s.emailtags,group:s.group,projectCategories:s.projectCategories,renderGuid:e.get().docId,project:t.project??s.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source,...l!=null&&l!==""?{author:l}:{},...c?{excerpt:c}:{}}}}var Ru=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function Pu(e){const t={};for(const n of Ru)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function Du(e,t,n,r,o,i){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(o);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,o):t.saveAutosave(r,o,i==null?void 0:{wpId:i})}function Le(e,t=!1){const n={};for(const r of Object.keys(e)){let o=e[r];o!==void 0&&!(typeof o=="number"&&Number.isNaN(o))&&(t&&typeof o=="object"&&o!==null&&(o=Le(o)),n[r]=o)}return n}function Ou(e){return typeof e=="string"&&e.includes("autosave")}var ku=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function oa(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!ku.has(t))):{}}function mt(e,t,n={}){e&&e.mutate({attributes:xu(e.get().attributes,t)},{source:n.source??"user"})}function xu(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function ho(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function Mu(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function ia(e){if(!e)return null;const t=oa(e);return e.common_styles!==void 0&&(t.common_styles=Mu(e.common_styles)),ho(e.html,t)}function sa(e){return e?ho(e.html,Le(oa(e))):null}var Lu=["common_styles","subject","preheader","meta"];function ti(e){if(!e?.html?.trim())return null;const t={};for(const n of Lu)Nu(n,e[n])&&(t[n]=e[n]);return ho(e.html,t)}function Nu(e,t){return e==="common_styles"?typeof t=="string"&&t.startsWith("{"):e==="meta"?typeof t=="object"&&t!==null&&!Array.isArray(t):typeof t=="string"}var Fu=["modified","lock","wpId","secretHash"];function ni(e){if(!e)return null;const t={};for(const n of Fu)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var Bu=10,ju=(e,t)=>e.key===t.key&&Uu(e.serverId,t.serverId),Uu=(e,t)=>e==null||e===t;function Hu(e){return typeof e?.then=="function"}var ri=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},aa=e=>{e.request.serverId!=null&&!Pn(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},$u=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),Pn=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),oi=(e,t)=>t?.content!==void 0&&Iu({hasUnsavedUserEdit:Pn(e)})==="skip",ii=(e,t)=>{for(const n of["subject","preheader"]){const r=t.attributes?.[n];typeof r=="string"&&(e.shownHeaders[n]=r)}},Vu=e=>e.document.subscribe(t=>{t.source==="user"&&(t.content&&e.userTouched.add("content"),t.attributes?.forEach(n=>e.userTouched.add(n))),e.document.isDirty()||e.userTouched.clear()}),qu=(e,t)=>{!e.ready||t.content===void 0||e.document.get().serverId==null||(e.contentShown=!0,!(![...e.userTouched].every(n=>n==="content"||n in(t.attributes??{}))||!e.document.isDirty())&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent(),e.userTouched.clear(),e.document.get().docId))},Gu=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([o,i])=>e.attributes[o]!==i)),r=t.content!==void 0&&t.content!==e.content?t.content:void 0;return r===void 0&&Object.keys(n).length===0?null:r===void 0?{attributes:n}:{content:r,attributes:n}},zu=e=>{const t=Tu(e.reports),n=Gu(e.lastMerged,t);e.lastMerged=t,e.broughtContent=Dn(t.content)??e.broughtContent,n&&(gn(e.document,n),aa(e))},zn=(e,t)=>{if(!e.ready&&!Pn(e)){zu(e);return}e.broughtContent=Dn(t?.content)??e.broughtContent,gn(e.document,t)},Dn=e=>e===void 0?void 0:fo(e),Wu=(e,t)=>t.content===void 0||Dn(t.content)!==e.broughtContent||!Pn(e)?t:{...t,content:void 0},Ku=e=>{const{attributes:t,serverId:n,docId:r}=e.document.get();return{...t,html:e.document.getContent(),id:n??void 0,isNew:n==null,renderGuid:r}};function Yu(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:o,resolveTerms:i,canEdit:s,notifyBeforeSave:a,awaitCanvasSynced:l,savedEchoForm:c=v=>v,onAdapterError:d,onTimeout:m}=e;let h,E;const w=new Set,_=new Set,b=()=>w.forEach(v=>v()),T=(v,x)=>{if(!(v.closed||v.ready)){if(v.error!==void 0){v.document.markFailed(v.error),v.document.get().docId;return}aa(v),v.ready=!0,v.document.markReady(),v.document.get().docId,[...v.reports.keys()]}},A=(v,x,U)=>{d?.(x.id,U),!(!x.required||v.closed)&&(v.error=U,v.emailReported=!0,v.document.get().docId,x.id,b())},B=(v,x)=>{const U=new Set(x.map(D=>D.id));x.forEach(D=>{D.watch&&v.watchers.push(D.watch(L=>v.closed?!1:v.ready&&(oi(v,L)||v.contentShown===!0&&L?.content!==void 0)?(v.document.get().docId,D.id,!1):(L&&v.reports.set(D.id,L),zn(v,L),L?.content!==void 0&&(v.showFill=void 0),!0)))});const W=(D,L)=>{if(!v.closed){if(!D.required&&oi(v,L)){v.document.get().docId,D.id,D.loaded?.(!1);return}L&&(v.reports.set(D.id,L),D.id==="plugin"&&ii(v,L)),D.required&&(v.emailReported=!0),zn(v,L),D.loaded?.(L!==null)}},$=()=>{U.size>0||v.closed||(ri(v),T(v,[]))},j=[];if(x.forEach(D=>{let L;try{L=D.load()}catch(H){A(v,D,H),U.delete(D.id);return}if(Hu(L)){j.push({id:D.id,required:D.required,load:()=>L,...D.loaded?{loaded:H=>D.loaded?.(H)}:{}});return}W(D,L),U.delete(D.id)}),j.length===0){$();return}v.timer=setTimeout(()=>{v.timer=void 0,m?.([...U]),v.document.get().docId,[...U],T(v,[...U])},n),v.timer.unref?.(),j.forEach(D=>{D.load().then(L=>W(D,L)).catch(L=>{A(v,D,L)}).finally(()=>{U.delete(D.id),$()})})},O=async(v,x,U)=>{if(U==="snapshot"||U==="anchor")return;const W=i?.();if(W)return W.resolve({project:x.project??v.project,tags:(v.tags??[]).map($=>({name:$}))})},k=v=>{if(v.lock===!0&&s?.(v)===!1)return new Ze("locked");const x=v.tags?.length??0,U=v.emailtags?.length??0;if(Math.max(x,U)>Bu)return new Ze("too-many-tags")},C=(v,x)=>{const U=v.document.get().serverId;x||U==null||(v.recoveryFacts={emailId:U,historyLoaded:!0,isRecovering:!1},re(v.request.key)||(v.request={...v.request,key:it(U),serverId:U}))},R=(v,x,U)=>{if(v.closed||U?.id==null)return;const W=v.document.get().serverId,$=W!=null;$&&W!==String(U.id)||(v.document.markSaved(x,String(U.id)),C(v,$),v.document.get().serverId,b())},I=async(v,x,U)=>{try{await v.document.whenReady()}catch(L){return v.saveError=L,v.saveFailures+=1,v.failedIntent=x,v.saveFailures,!1}if(v.closed)return!1;const W=k(v.document.get().attributes);if(W)return v.saveError=W,v.saveFailures+=1,v.failedIntent=x,W.reason,b(),!1;if(a&&(await a(Ku(v)).catch(()=>{}),v.closed))return!1;if(l){try{await l()}catch(L){return v.saveError=L,v.saveFailures+=1,v.failedIntent=x,v.saveFailures,b(),!1}if(v.closed)return!1}if($u(v))return x==="snapshot"||(v.saveError=new Ze("empty-content"),v.saveFailures+=1,v.failedIntent=x,b()),!1;let $;try{$=await O(v.document.get().attributes,U,x)}catch(L){return v.saveError=L,v.saveFailures+=1,v.failedIntent=x,v.saveFailures,b(),!1}if(v.closed)return!1;const{payload:j,version:D}=Au(v.document,U,$,x);v.document.get().docId;try{const L=v.document.get().serverId!=null,H=await Du(r(),o(v.request.key),x,v.document.get().serverId,j,v.document.get().attributes.wpId);if(v.closed)return!0;let K;if(x==="snapshot"||x==="anchor"){const Z=H?.modified!=null?Date.parse(H.modified):NaN;K=Number.isFinite(Z)?Z:Date.now(),v.snapshotVersion=D,v.lastRevisionAt=K}else{v.document.markSaved(D,H?.id!=null?String(H.id):void 0),v.savedContent=j.html;const Z=H;gn(v.document,ni(Z&&{wpId:Z.wpId,secretHash:Z.secretHash})),v.broughtContent=Dn(c(j.html))}C(v,L),v.saveError=void 0,v.saveFailures=0,v.failedIntent=void 0,v.document.get().serverId,b();const te={intent:x,serverId:v.document.get().serverId,created:!L,...K!==void 0?{revisionAt:K}:{}};return _.forEach(Z=>Z(te)),!0}catch(L){return(x==="publish"||x==="materialize")&&gu(L)?.then(H=>R(v,D,H)),v.saveError=L,v.saveFailures+=1,v.failedIntent=x,v.saveFailures,b(),!1}},g=v=>{v.closed=!0,v.watchers.forEach(x=>x()),v.watchers=[],ri(v),v.history.dispose(),v.document.dispose()},p=()=>{h&&(g(h),h=void 0)},u=()=>{E&&(g(E),E=void 0)},f=(v,x,U)=>{let W=!1;x.show&&(v.show?.id!==x.show.id||v.show.token!==x.show.token)&&(v.show=x.show,W=!0,{docId:v.document.get().docId,...x.show});const $=U==="show"?sa(x.patch):null;if($){v.reports.set("plugin",$),ii(v,$);const j=Wu(v,$);zn(v,j),qu(v,j)}W&&b()},P=(v,x={})=>S(h,v,x),M=()=>h&&re(h.request.key??"")?E:h,y=v=>({error:v?.saveError,failures:v?.saveFailures??0,saving:v?.saving===!0,failedIntent:v?.failedIntent}),S=(v,x,U)=>!v||v.closed||x==="materialize"&&v.document.get().serverId!=null?Promise.resolve(!1):v.saving?x==="snapshot"||x==="materialize"?Promise.resolve(!1):(v.inFlight??Promise.resolve(!1)).then(()=>S(v,x,U)):(v.saving=!0,b(),v.inFlight=I(v,x,U).finally(()=>{v.saving=!1,v.inFlight=void 0,h===v&&!v.closed&&b()}),v.inFlight),F=(v,x="open",U=!1)=>{if(h&&!h.closed&&x!=="new"&&ju(h.request,v))return f(h,v,x),h.document;p(),U||u();const W=Zd({createBuffer:()=>Gd(""),serverId:v.serverId??null}),$={request:v,show:v.show,document:W,history:ou(W,{now:Date.now}),watchers:[],userTouched:new Set,shownHeaders:{},saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return h=$,$.watchers.push(Vu($)),W.get().docId,v.serverId,B($,t(v,{publishRecoveryFacts(j){$.closed||($.recoveryFacts=j,b())},readShownContent:()=>$.closed?null:$.document.getContent(),readWpId:()=>$.closed?void 0:$.document.get().attributes.wpId,readWpIdOutlook:()=>{if($.closed)return"gone";const{wpId:j}=$.document.get().attributes;return j??($.emailReported?"absent":"pending")}})),b(),W},V=(v,x,U)=>({key:re(v)?v:mn(v),serverId:x?.id!=null?String(x.id):null,email:x,show:U});return{openWith:F,open:(v,x={})=>F({key:it(v),serverId:v,email:x.email,patch:x.patch,show:x.show},"open"),openDraft:(v,x={})=>F({key:it(void 0),serverId:null,email:v,patch:x.patch,show:x.show},"open"),startNewDraft:(v,x={})=>F({key:it(void 0),serverId:null,email:v,patch:x.patch,show:x.show},"new"),reload:(v,x={})=>F({key:it(v),serverId:v,email:x.email,patch:x.patch,show:x.show},"new"),openBlock:(v,x,U)=>F(V(v,x,U),"open"),reloadBlock:(v,x,U)=>F(V(v,x,U),"new"),openBlockOver:(v,x)=>{const U=V(v,x);return h&&!h.closed&&h.request.key===U.key?h.document:(h&&!h.closed&&!re(h.request.key)&&(u(),E=h,h=void 0),F(U,"open",!0))},resumeSuspended:()=>{if(E)return p(),h=E,E=void 0,b(),h.document},hasSuspended:()=>!!E,suspendedDocument:()=>E?.document,show:(v,x)=>{const U=h;if(!(!U||U.closed))return F({...U.request,patch:v,show:x},"show")},current:()=>h?.document,noteServerFacts:({serverId:v,block:x},U)=>{const W=h;!W||W.closed||W.request.serverId!==v||re(W.request.key??"")===x&&gn(W.document,ni(U))},save:P,saveEmail:(v,x={})=>S(M(),v,x),saveState:()=>y(h),emailSaveState:()=>y(M()),revisionFacts(){if(!h)return;const v=h.revisionFactsSnapshot;return v&&v.snapshotVersion===h.snapshotVersion&&v.lastRevisionAt===h.lastRevisionAt?v:(h.revisionFactsSnapshot={snapshotVersion:h.snapshotVersion,lastRevisionAt:h.lastRevisionAt},h.revisionFactsSnapshot)},recoveryFacts:()=>h?.recoveryFacts,history:()=>h?.history,forcedHeaders:()=>h?.forcedHeaders,beginForcedHeaders(v){h&&!h.closed&&(h.forcedHeaders=v)},endForcedHeaders(){for(const v of[h,E])v&&(v.forcedHeaders=void 0)},onSaved(v){return _.add(v),()=>_.delete(v)},showFacts:()=>h?.show,shownHeaders:()=>({...h?.shownHeaders}),showFill:()=>h?.showFill,beginShowFill(v){h&&!h.closed&&(h.showFill={showId:v,codeEdits:0})},noteCodeEdit(){h?.showFill&&(h.showFill.codeEdits+=1)},endShowFill(v){for(const x of[h,E])x?.showFill?.showId===v&&(x.showFill=void 0)},sessionKey:()=>h?.request.key,openError:()=>h?.error,subscribe(v){return w.add(v),()=>w.delete(v)},close(){!h&&!E||(p(),u(),b())}}}var mo=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function go(e){if(e instanceof mo)return e.reason;if(e instanceof et)return go(e.reason)}function Xu(e){const t=e instanceof et?e.reason:e;return t instanceof mo&&t.reason==="unavailable"&&t.cause instanceof TypeError}function Ju(e){const t=go(e);return t!==void 0&&t!=="unavailable"}function Qu(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new mo("not-found");return ia(n)}}}var la=z("EmailPort");function Zu(e){return e.getInstance(la)}function ef(e,t){e.inject(la,t)}var ca=z("documentSession.restEmailPortFactories");function da(e){return e.getInstance(ca)!==void 0}function nt(e){const t=e.getInstance(ca);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var tf=z("EmailTermsResolver");function nf(e){return e.getInstance(tf)}var ua=z("EmailHistoryPort"),rf=z("BlockHistoryPort");function fa(e){return e.getInstance(rf)}function pa(e){return e.getInstance(ua)}function of(e,t){e.inject(ua,t)}var sf="em_autosave_pending";function vn(e){return`${sf}_${e}`}function af(e,t){try{sessionStorage.setItem(vn(e),JSON.stringify(t))}catch{}}function ha(e){try{const t=sessionStorage.getItem(vn(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(vn(e)),null):n}catch{return null}}function St(e){try{sessionStorage.removeItem(vn(e))}catch{}}var lf=2e3,cf=5e3,df=5,uf=5e3,ff=4;function pf(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function hf(e,t){return e==null||t==null?!1:e.replaceAll(`\r
999
999
  `,`
1000
1000
  `)===t.replaceAll(`\r
1001
1001
  `,`
1002
- `)}function Vn(e,t){return io(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function $u({emailId:e,readAutosave:t,revisionServiceEnabled:n,readShownContent:r,onFacts:o,onLate:i,onError:s,pageLoadTs:a=Uu()}){let l=null,c=!1,d=!1,g=0,h={emailId:e,historyLoaded:!1,isRecovering:!1},y=null;const I=new Promise(p=>{y=p}),w=p=>{h={...h,...p},o(h)};let b;const R=p=>{g+=1,w({applied:{phase:p,seq:g}})},A=()=>{l?.timer&&clearTimeout(l.timer),l=null},L=p=>{if(!d){if(y){const D=y;y=null,D(p),b=p.revision?p.phase:void 0;return}i(p)&&p.revision&&R(p.phase)}},P=()=>{if(!l||d)return;const p=l.phase==="fast",D=p?Lu:Bu,x=p?Fu:ju;l.timer=setTimeout(()=>{const E=l;if(!(!E||d)){if(E.attempts+=1,T(),p&&E.attempts>=x){const{pending:S}=E;St(e),w({isRecovering:!1}),L({revision:{html:S.html,common_styles:S.common_styles,subject:S.subject,preheader:S.preheader},phase:"timeout"}),c=!0,E.phase="bg",E.attempts=0,P();return}if(!p&&E.attempts>=x){St(e),A(),w({isRecovering:!1}),c=!0;return}P()}},D),l.timer.unref?.()},O=p=>{l={phase:"fast",attempts:0,pending:p,timer:null},w({isRecovering:!0}),P()},_=p=>{if(d)return;if(w({historyLoaded:!0,latestRevisionAt:p.latestAt!==void 0&&Number.isFinite(p.latestAt)?p.latestAt:void 0}),n&&l){const E=Vn(p,l.pending.sentAt);if(!E)return;const S=l.phase==="fast"?"found":"bg";St(e),A(),w({isRecovering:!1}),c=!0,L({revision:E,phase:S});return}if(c)return;const D=n?ea(e):null,x=D&&(D.sentAt<a||!Hu(D.html,r()))?D:null;if(x){const E=Vn(p,x.sentAt);if(E){St(e),c=!0,L({revision:E,phase:"found"});return}O(x);return}c=!0,L({revision:Vn(p),phase:"normal"})},C=p=>{d||(s?.(p),h.historyLoaded||(w({historyLoaded:!1,latestRevisionAt:void 0}),u()),!l&&L({revision:null,phase:"normal"}))},T=()=>t(e).then(_).catch(C);let m,f=!1;const u=()=>{f||l||d||(f=!0,m=setTimeout(()=>{m=void 0,!d&&!h.historyLoaded&&T()},Nu))};return T(),{verdict:()=>I,confirmVerdict(p){const D=b;b=void 0,p&&D!==void 0&&!d&&R(D)},dispose(){d=!0,m!==void 0&&(clearTimeout(m),m=void 0),A()}}}function qu({port:e,revisionServiceEnabled:t,emailId:n,readShownContent:r,onFacts:o}){let i=null;const s=$u({emailId:n,readAutosave:a=>e.readAutosave(a),revisionServiceEnabled:t,readShownContent:r,onFacts:o,onLate:({revision:a,phase:l})=>{const c=Wo(a);return i?.(c)??!1},onError:a=>{a instanceof Error&&a.message}});return{id:"recovery",load:()=>s.verdict().then(({revision:a})=>Wo(a)),loaded(a){s.confirmVerdict(a)},watch(a){return i=a,()=>{i=null,s.dispose()}}}}function ta(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Mu(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const o=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),o}}}function Vu(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const o=Date.now(),i=await t.updateEmail(n,r);return await e.updateEmail(n,r),(ea(n)?.sentAt??Number.POSITIVE_INFINITY)<=o&&St(n),i}}}var na=V("CurrentUser"),ra={};function uo(e){return e.getOrCreateInstance(na,()=>ge(ra))}function oa(e){return e?.getInstance(na)?.get()??ra}var ia=V("HeadlessMode");function sa(e){return e.getOrCreateInstance(ia,()=>ge(!1))}function Gu(e){return e?.getInstance(ia)?.get()??!1}var zu=V("HiddenMount");function Wu(e){return e.getOrCreateInstance(zu,()=>ge(!1))}function Ku(e){if(!e)return!1;try{return!!Qr(e).data?.act_as}catch{return!1}}function Yu(e){return Ku(e?.getInstance(ms)?.get(yc.em_token))}function aa(e){return e?.getInstance(fe)?.get()??{}}function Pn(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Xu(e,t){return t.modeDefaults(Pn(e,t.fallbackMode))}function la(e,t){const n=Pn(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function ca(e,t){const n=Pn(e,t),r=e.user?.advancedConfigs?.[n],o=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...o}}function Ju(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function Qu(e){return $l(e.map(t=>t?.resourceProxy))}function Zu(e){return gc(e.map(t=>t?.resourceProxyPolicy))}function ef(e){return vc(e.map(t=>t?.backendProxy))}function tf(e){return hs(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function nf(e,t){return[e.base,Xu(e,t),e.profile,e.serverSide,la(e,t.fallbackMode),e.local,e.user,ca(e,t.fallbackMode)]}function Gn(e,t){const n=nf(e,t),r=hs(n),o=Ju(n);o!==void 0&&(r.fileManager=o);const i=Qu(n);i!==void 0&&(r.resourceProxy=i);const s=Zu(n);s&&Object.keys(s).length>0&&(r.resourceProxyPolicy=s);const a=ef(n);a!==void 0&&(r.backendProxy=a);const l=tf(n);return l&&Object.keys(l).length>0&&(r.backendProxyPolicy=l),r}function rf(e,t,n){const r=la(e,n),o=ca(e,n);return Zl([o,e.user,r,e.serverSide],t)}var of=1.5;function sf(e){return e.isHeadless||!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=of*e.autosaveTimeoutMs?"none":"revision"}function af(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:o}=e,i=e.readFailures??(()=>0),s=e.readFailureRetryable??(()=>!0);let a;const l=C=>a!==void 0&&a.version===C.get().version?i()-a.failuresAtStart:0,c=C=>{const T=l(C);if(T<=0)return!1;const m=n().retryMaxAttempts??5;return!s()||T>m},d=()=>{const{autosaveTimeoutMs:C,retryIntervalMs:T}=n(),m=t();return m!==void 0&&l(m)>0&&T!==void 0&&T>0?T:C},g=C=>C.isNew()&&i()>=3,h=()=>{const C=t();if(!C||C.isDisposed()||c(C))return"none";const{latestRevisionAt:T,snapshotVersion:m,...f}=n(),u=Date.now(),p=sf({...f,isDirty:C.isDirty(),isNew:C.isNew(),isReady:C.isReady(),latestRevisionAgeMs:T!=null&&T<=u?u-T:void 0,isSnapshotSent:m!=null&&m===C.get().version});return p==="create"&&g(C)?"none":p},y=()=>{const C=t();if(!C||C.isDisposed()||g(C)||c(C)||n().isHeadless)return!1;if(!C.isDirty())return C.isNew();const{snapshotVersion:T}=n();return!(T!=null&&T===C.get().version)};let I,w,b,R,A=!1;const L=()=>{w=void 0;const C=t();if(!C||C.isDisposed())return;if(C.get().docId!==I){P();return}const T=h();T!=="none"&&a?.version!==C.get().version&&(a={version:C.get().version,failuresAtStart:i()}),T==="create"?r():T==="revision"?o():y()&&(I=C.get().docId,w=setTimeout(L,d()))},P=()=>{const C=t();A||!C||w!==void 0||h()==="none"&&!y()||(I=C.get().docId,w=setTimeout(L,d()))},O=C=>{C.source==="user"&&w!==void 0&&(clearTimeout(w),w=void 0),P()},_=()=>{const C=t();C!==b&&(R?.(),b=C,a=void 0,R=C?.subscribe(O),w!==void 0&&(clearTimeout(w),w=void 0))};return _(),P(),{refresh:()=>{A||(_(),P())},stop:()=>{A=!0,R?.(),R=void 0,b=void 0,w!==void 0&&(clearTimeout(w),w=void 0)}}}var da=V("documentSession.autosaveUiFacts"),ua={isUserBusy:!1,saveContext:{}};function lf(e){return e.getOrCreateInstance(da,()=>ge(ua))}function yr(e){return e?.getInstance(da)?.get()??ua}function fa(e){return yr(e).saveContext.fallbackTitle||"Untitled email."}var cf=1e4,df=3e4;function uf(e,t){const n=d=>{const g=e.getInstance(fe)?.layers?.(),h=g?rf(g,d):void 0;return typeof h=="number"&&h>=0?h:void 0},r=()=>{const d=t.current(),g=d?.get().serverId??void 0,h=te(t.sessionKey()),y=t.recoveryFacts(),I=y?.emailId===g?y:void 0,w=t.revisionFacts(),b=I?.latestRevisionAt,R=w?.lastRevisionAt,A=oa(e).profile;return{isInited:h||d?.get().attributes.is_inited===!0,isEnabled:!!A?.autosaves&&!Yu(e),isHistoryLoaded:I?.historyLoaded===!0,isUserBusy:yr(e).isUserBusy,isHeadless:Gu(e),autosaveTimeoutMs:aa(e).autosaveTimeout||cf,latestRevisionAt:b!==void 0||R!==void 0?Math.max(b??0,R??0):void 0,snapshotVersion:w?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??df,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},o=()=>{const d=yr(e).saveContext;return{...d,project:d.project??t.current()?.get().attributes.project,fallbackTitle:fa(e)}},i=af({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>zd(t.saveState().error),onCreate:()=>{te(t.sessionKey())||t.save("materialize",o())},onRevision:()=>{t.save("snapshot",{project:o().project})}}),s=t.subscribe(i.refresh),a=uo(e).watch(()=>i.refresh()),l=lf(e).watch(()=>i.refresh()),c=sa(e).watch(()=>i.refresh());return()=>{s(),a.dispose(),l.dispose(),c.dispose(),i.stop()}}var Jo=12e3;function ce(e){return e.getOrCreateInstance(no,()=>{const t=Su({resolveAdapters:(r,o)=>hf(r,e,o),resolveWritePort:()=>pa(e),resolveHistoryPort:r=>te(r)?ma(e):ha(e),resolveTerms:()=>Du(e),canEdit:r=>ld(e,r),notifyBeforeSave:pd(e),awaitCanvasSynced:gd(e),savedEchoForm:r=>{const o=$e(e);return o.toEditorForm(o.toOutputForm(r))},timeoutMs:Jo,onAdapterError:(r,o)=>{o instanceof Error&&o.message;const i=Cu(o),s=Iu(o);xt(o,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(i),network_failure:String(s)},level:i||s?"warning":"error"})},onTimeout:r=>{}}),n=uf(e,t);return e.getInstance(W)?.addDispose(n),t})}function et(e){return e?.getInstance(no)}function pa(e){const t=Au(e);return t?fo(e)?Vu(t,tt(e).email(e)):t:tt(e).email(e)}function ff(e){return Zs(e)!==void 0||Xs(e)}function ha(e){const t=Zs(e);return t?fo(e)?(ne("port:history:server-backed"),ta(t,tt(e).history(e))):(ne("port:history:integrator"),t):(ne("port:history:rest (порт не зарегистрирован)"),tt(e).history(e))}function ma(e){const t=Qs(e);return t?fo(e)?(ne("port:block-history:server-backed"),ta(t,tt(e).blockHistory(e))):(ne("port:block-history:integrator"),t):(ne("port:block-history:rest (порт не зарегистрирован)"),tt(e).blockHistory(e))}function pf(e){return Qs(e)!==void 0||Xs(e)}function fo(e){return Ts(e)}function hf({email:e,patch:t,serverId:n,key:r},o,i){const s=[];e?s.push({id:"rest",load:()=>Gs(e),required:!0}):n&&s.push(Tu(pa(o),n)),t&&s.push({id:"plugin",load:()=>zs(t)});const a=te(r);return vd(n)&&(a?pf(o):ff(o))&&s.push(qu({port:a?ma(o):ha(o),revisionServiceEnabled:Ts(o),emailId:n,readShownContent:()=>i.readShownContent(),onFacts:l=>i.publishRecoveryFacts(l)})),s}function mf(e){const t=ce(e),n=ae(e).addListener(K.APPLICATION_HAS_AMP,r=>{lt(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(W)?.addDispose(()=>n.dispose())}function gf(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function vf(e){const t=e.fetchImpl??((i,s)=>fetch(i,s)),n=e.pageHost??(()=>window.location.hostname),r=new Set,o=i=>{try{const s=new URL(i,window.location.href);return s.protocol!=="https:"&&s.protocol!=="http:"?!1:s.hostname===n()||e.sourceHosts().includes(s.hostname)}catch{return!1}};return{accepts:o,async load(i){if(!o(i))return;const s=!r.has(i);r.add(i);try{const a=await t(i,{mode:"cors",credentials:"omit",cache:s?"no-cache":"default"});if(!a.ok)return;const l=await a.blob();return gf(l)?l:void 0}catch{return}}}}var Je={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function bf(e){const t={maxBytes:e.maxBytes??Je.maxBytes,maxImageBytes:e.maxImageBytes??Je.maxImageBytes,ttlMs:e.ttlMs??Je.ttlMs},n=e.now??(()=>Date.now()),r=new Map,o=new Map,i={hits:0,loads:0,failures:0};let s=0;const a=g=>{const h=r.get(g);h&&(s-=h.bytes,r.delete(g))},l=g=>t.ttlMs<=0||n()-g.storedAt<t.ttlMs,c=()=>{if(s<=t.maxBytes)return;const g=[...r.entries()].sort((h,y)=>h[1].usedAt-y[1].usedAt);for(const[h]of g){if(s<=t.maxBytes)return;a(h)}},d=(g,h)=>{h.size>t.maxImageBytes||(r.set(g,{blob:h,bytes:h.size,storedAt:n(),usedAt:n()}),s+=h.size,c())};return{async get(g){const h=r.get(g);if(h&&l(h))return h.usedAt=n(),i.hits+=1,h.blob;h&&a(g);const y=o.get(g);if(y!==void 0)return y;i.loads+=1;const I=(async()=>{try{const w=await e.load(g);return w?d(g,w):i.failures+=1,w}catch{i.failures+=1;return}finally{o.delete(g)}})();return o.set(g,I),I},forget(g){a(g),o.delete(g)},configure(g){Object.assign(t,{maxBytes:g.maxBytes??t.maxBytes,maxImageBytes:g.maxImageBytes??t.maxImageBytes,ttlMs:g.ttlMs??t.ttlMs});for(const[h,y]of r)y.bytes>t.maxImageBytes&&a(h);c()},clear(){r.clear(),o.clear(),s=0},stats(){return{entries:r.size,bytes:s,...i}}}}var yf=["emcdn.ru","scr.emcdn.ru"];function Ef(e){const t=String(e??"").trim();if(!t)return"";try{return new URL(t.includes("//")?t:`https://${t}`).hostname}catch{return t.split("/")[0].split(":")[0]}}function _f(e,t){const n=(r,o)=>{const i=new Set(o?t:[]);for(const s of r){const a=Ef(s);a&&i.add(a)}return[...i]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function wf(e){const t=e??{},n=t.isPlugin!==!0?yf:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Je};const o=r===!0||r===void 0?{}:r;return{enabled:o.enabled!==!1,sourceHosts:_f(o.sourceHosts,n),maxBytes:o.maxBytes??Je.maxBytes,maxImageBytes:o.maxImageBytes??Je.maxImageBytes,ttlMs:o.ttlMs??Je.ttlMs}}function Sf(e){const t=ae(e),n=e.getInstance(fe),r=()=>wf({...n?.get(),isPlugin:!0});let o=r();const i=vf({sourceHosts:()=>o.sourceHosts}),s=bf({load:w=>i.load(w),maxBytes:o.maxBytes,maxImageBytes:o.maxImageBytes,ttlMs:o.ttlMs}),a=()=>{t.send(K.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:o.enabled,sourceHosts:[...o.sourceHosts]})},l=t.onInit(()=>a()),c=n?.watch(()=>{const w=r(),b=JSON.stringify(w)!==JSON.stringify(o);o=w,s.configure(w),w.enabled||s.clear(),b&&t.isInited()&&a()}),d={asked:0,served:0,refused:0},g=[],h=(w,b)=>(d.refused+=1,g.push({url:w,reason:b}),g.length>20&&g.shift(),{refused:!0}),y=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:o,counters:{...d},refusals:[...g],store:s.stats()})}),I=t.addListenerAsync(K.APPLICATION_CANVAS_IMAGE_GET,async w=>{const b=w?.url??"";if(d.asked+=1,!o.enabled||!b)return h(b,"disabled");if(!i.accepts(b))return h(b,"host");w.fresh&&s.forget(b);const R=await s.get(b);return R?(d.served+=1,{blob:R}):h(b,"load-failed")});e.getInstance(W)?.addDispose(()=>{l.dispose(),c?.dispose(),I.dispose(),s.clear(),delete y.__emmCanvasImages__})}var If=2e3;function Cf(e){const t=ae(e),n=new Map,r=()=>{const s=t.getTarget();if(!s||t.hasPort(s))return;clearTimeout(n.get(s));const a=new MessageChannel;let l=!1,c=!1;const d=h=>{h.data?.operationId==="em:port-ready"&&(l=!0,a.port1.removeEventListener("message",d),c&&t.resumePort(s),t.drainWindow(s))};a.port1.addEventListener("message",d),t.sendPort(s,a.port2),t.usePort(a.port1,!1,s);const g=setTimeout(()=>{n.get(s)===g&&n.delete(s),!(l||!t.hasPort(s,a.port1))&&(xt(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),c=!0,t.holdPort(s))},If);n.set(s,g)},o=Object.assign(globalThis,{__emmCanvasPort__:()=>{const s=t.getTarget();return{usesPort:t.usesPort,windowDrained:s?t.isWindowDrained(s):!1}}}),i=t.onInit(()=>r());e.getInstance(W)?.addDispose(()=>{for(const s of n.values())clearTimeout(s);i.dispose(),delete o.__emmCanvasPort__})}var Tf=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Af(e){return Tf.test(e)||e.indexOf("//")===0}function Yt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function Rf(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Qo(e,t){const n=e==null||e===""?"./":String(e);if(Af(n))return Yt(n);const r=t??Rf();if(!r)return Yt(n);try{return Yt(new URL(n,r).href)}catch{return Yt(n)}}function Pf(){return typeof window.__emailmaker__<"u"&&window.__emailmaker__?.publicPath?Qo(window.__emailmaker__.publicPath):Qo("/")}var Df=()=>"",Of=()=>"8c2b05d7";function kf(e,t){const n=new URL(e);return n.hostname!=="localhost"||t.hostname==="localhost"?e:(n.hostname=t.hostname,n.toString())}function ga(e){const t=e?"iframe-eblock":"iframe",n=Df();if(n){const i=kf(n,window.location).replace(/\/?$/,"/");return jo(`${i}${t}.html`,kt())}const r=Of(),o=`${Pf().replace(/\/?$/,"/")}iframe/`;return jo(`${o}${t}${r?`.${r}`:""}.html`,kt())}var Zo="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Er(e){return/^file:/i.test(String(e||"").trim())}function xf(e){return Er(e)?`${Zo} allow-same-origin`:Zo}var Mf="em:module-body-ack";function Lf(e,t,n){try{const r=new URL("./",new URL(t,n)).href,o=new URL(e,r).href;return o.startsWith(r)?o:void 0}catch{return}}function po(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.([0-9a-f]{6,}))?\.html$/.exec(t);return n?{name:n[1],hash:n[2]}:void 0}function Nf(e){const t=po(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function Ff(e,t){const n=po(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(o=>e[o]?.file).filter(o=>!!o):[]}function Bf(e,t){const n=po(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const o=new Set([r]),i=[r],s=[];for(;i.length>0;)for(const a of e[i.shift()]??[])o.has(a)||(o.add(a),s.push(a),i.push(a));return s}var jf=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function Uf(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&jf.test(t[t.length-2])}async function Hf(e,t){const n=Uf(e)?{}:{cache:"no-cache"};t?.priority&&(n.priority=t.priority);try{const r=await fetch(e,n);return r.ok?await r.blob():void 0}catch{return}}function $f(e){const t=new Map,n=(r,o)=>{const i=Lf(r,e.canvasSrc,e.origin);if(!i)return;const s=t.get(i);if(s!==void 0)return s;const a=e.fetchBody(i,o);return t.set(i,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,o){for(const i of r)n(i,o)},reset(){t.clear()},get size(){return t.size}}}var Re;function qf(e){try{return Er(new URL(e,window.location.href).href)}catch{return Er(window.location.href)}}function va(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof window.__emailmaker__<"u"&&window.__emailmaker__?.preload?.canvasCrossOrigin===!0}var Vf=()=>Promise.resolve(void 0);function ba(){const e=ga(!1);if(!qf(e)){if(!Re||Re.canvasSrc!==e){const t=va(e)?Hf:Vf;Re={canvasSrc:e,store:$f({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return Re.store}}async function Gf(e,t){try{const n=new URL(".vite/manifest.json",new URL("./",new URL(e,window.location.href))).href,r=await fetch(n,{cache:"no-cache"});if(!r.ok)return;const o=await r.json();t(Ff(o,e))}catch{}}function ho(e){const t=ba();if(!t||!Re||Re.warmed||!va(Re.canvasSrc))return;Re.warmed=!0;const{canvasSrc:n}=Re,r=Nf(n);r&&t.warm([r],e);const o={"js/iframe-eblock.js":["js/elMarkupHelper.DnlKn-Lc.js"],"js/iframe.js":["js/elMarkupHelper.DnlKn-Lc.js"],"js/darkreader.CLd5EML2.js":[],"js/elMarkupHelper.DnlKn-Lc.js":[],"js/rules.CnnzdMsj.js":[],"js/typograf.all.Mun9CrLC.js":[]};o?t.warm(Bf(o,n),e):Gf(n,i=>t.warm(i,e))}function zf(e){const t=ba();if(!t)return;ho();const n=r=>{const o=r.data;if(!o||o.operationId!=="em:module-body"||!o.result)return;const i=r.source;i&&(i.postMessage({operationId:Mf,for:o.result},"*"),t.take(o.data?.url??"").then(s=>{i.postMessage({operationId:o.result,data:s??null},"*")}))};window.addEventListener("message",n),e.getInstance(W)?.addDispose(()=>{window.removeEventListener("message",n)})}var ct=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,Wf=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,mt=/<style\b[^>]*>[\s\S]*?<\/style>/gi,ei=/display:\s*none\s*!important/gi,Kf=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Yf=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Xf=/height\s*:\s*100%\s*!important/i,Jf=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"];function Qf(e){return ei.lastIndex=0,(e.match(ei)||[]).length}function ya(e){const t=e.trim(),n=Qf(t);if(n===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||n>=3||t.length>2e3))return!0;const r=Jf.filter(o=>t.includes(o)).length;return r>=1&&(n>=3||t.length>2e3)||n>=5&&r>=1?!0:n>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function Zf(e){mt.lastIndex=0;for(const t of e.matchAll(mt))if(ya(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function ep(e){let t=!1;return mt.lastIndex=0,{html:e.replace(mt,n=>ya(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function tp(e){return ct.lastIndex=0,ct.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||Zf(e)}function np(e){if(!tp(e))return{html:e,found:!1};let t=!1,n=e;ct.lastIndex=0,ct.test(n)&&(ct.lastIndex=0,n=n.replace(ct,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Wf,""),t=!0);const r=ep(n);return n=r.html,t=t||r.found,{html:n,found:t}}function rp(e){return!e||!Xf.test(e)?e:(mt.lastIndex=0,e.replace(mt,t=>t.replace(Kf,(n,r,o,i)=>`${r}${o.replace(Yf,"")}${i}`)))}function Ea(e){const t=np(e.replaceAll(`\r
1002
+ `)}function Wn(e,t){return po(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function mf({emailId:e,readAutosave:t,revisionServiceEnabled:n,readShownContent:r,onFacts:o,onLate:i,onError:s,pageLoadTs:a=pf()}){let l=null,c=!1,d=!1,m=0,h={emailId:e,historyLoaded:!1,isRecovering:!1},E=null;const w=new Promise(f=>{E=f}),_=f=>{h={...h,...f},o(h)};let b;const T=f=>{m+=1,_({applied:{phase:f,seq:m}})},A=()=>{l?.timer&&clearTimeout(l.timer),l=null},B=f=>{if(!d){if(E){const P=E;E=null,P(f),b=f.revision?f.phase:void 0;return}i(f)&&f.revision&&T(f.phase)}},O=()=>{if(!l||d)return;const f=l.phase==="fast",P=f?lf:uf,M=f?df:ff;l.timer=setTimeout(()=>{const y=l;if(!(!y||d)){if(y.attempts+=1,I(),f&&y.attempts>=M){const{pending:S}=y;St(e),_({isRecovering:!1}),B({revision:{html:S.html,common_styles:S.common_styles,subject:S.subject,preheader:S.preheader},phase:"timeout"}),c=!0,y.phase="bg",y.attempts=0,O();return}if(!f&&y.attempts>=M){St(e),A(),_({isRecovering:!1}),c=!0;return}O()}},P),l.timer.unref?.()},k=f=>{l={phase:"fast",attempts:0,pending:f,timer:null},_({isRecovering:!0}),O()},C=f=>{if(d)return;if(_({historyLoaded:!0,latestRevisionAt:f.latestAt!==void 0&&Number.isFinite(f.latestAt)?f.latestAt:void 0}),n&&l){const y=Wn(f,l.pending.sentAt);if(!y)return;const S=l.phase==="fast"?"found":"bg";St(e),A(),_({isRecovering:!1}),c=!0,B({revision:y,phase:S});return}if(c)return;const P=n?ha(e):null,M=P&&(P.sentAt<a||!hf(P.html,r()))?P:null;if(M){const y=Wn(f,M.sentAt);if(y){St(e),c=!0,B({revision:y,phase:"found"});return}k(M);return}c=!0,B({revision:Wn(f),phase:"normal"})},R=f=>{d||(s?.(f),h.historyLoaded||(_({historyLoaded:!1,latestRevisionAt:void 0}),u()),!l&&B({revision:null,phase:"normal"}))},I=()=>t(e).then(C).catch(R);let g,p=!1;const u=()=>{p||l||d||(p=!0,g=setTimeout(()=>{g=void 0,!d&&!h.historyLoaded&&I()},cf))};return I(),{verdict:()=>w,confirmVerdict(f){const P=b;b=void 0,f&&P!==void 0&&!d&&T(P)},dispose(){d=!0,g!==void 0&&(clearTimeout(g),g=void 0),A()}}}var si=2e4,gf=50;async function vf(e,t){const n=Date.now()+si;for(;;){const r=e();if(typeof r=="number")return r;if(r!=="pending")return r==="gone"?"gone":void 0;if(Date.now()>=n)return;await new Promise(o=>setTimeout(o,gf))}}function bf({port:e,revisionServiceEnabled:t,emailId:n,wpId:r,wpIdOutlook:o,readShownContent:i,onFacts:s}){let a=null;const l=mf({emailId:n,readAutosave:async c=>{if(!r)return e.readAutosave(c);const d=e.requiresWpId&&o?await vf(o,c):r();return d==="gone"?{autosave:null}:e.readAutosave(c,{wpId:d})},revisionServiceEnabled:t,readShownContent:i,onFacts:s,onLate:({revision:c,phase:d})=>{const m=ti(c);return a?.(m)??!1},onError:c=>{c instanceof Error&&c.message}});return{id:"recovery",load:()=>l.verdict().then(({revision:c})=>ti(c)),loaded(c){l.confirmVerdict(c)},watch(c){return a=c,()=>{a=null,l.dispose()}}}}function ma(e,t){return{readRevisions:(n,r,o)=>t.readRevisions(n,r,o),readAutosave:(n,r)=>t.readAutosave(n,r),async saveAutosave(n,r,o){af(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const i=await t.saveAutosave(n,r,o);return await e.saveAutosave(n,r),i}}}function yf(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const o=Date.now(),i=await t.updateEmail(n,r);return await e.updateEmail(n,r),(ha(n)?.sentAt??Number.POSITIVE_INFINITY)<=o&&St(n),i&&{...i,id:n}}}}var ga=z("CurrentUser"),va={};function vo(e){return e.getOrCreateInstance(ga,()=>ye(va))}function ba(e){return e?.getInstance(ga)?.get()??va}var ya=z("HeadlessMode");function Ea(e){return e.getOrCreateInstance(ya,()=>ye(!1))}function Ef(e){return e?.getInstance(ya)?.get()??!1}var _f=z("HiddenMount");function wf(e){return e.getOrCreateInstance(_f,()=>ye(!1))}function Sf(e){if(!e)return!1;try{return!!eo(e).data?.act_as}catch{return!1}}function If(e){return Sf(e?.getInstance(Ts)?.get(Fc.em_token))}function _a(e){return e?.getInstance(me)?.get()??{}}function On(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Cf(e,t){return t.modeDefaults(On(e,t.fallbackMode))}function wa(e,t){const n=On(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Sa(e,t){const n=On(e,t),r=e.user?.advancedConfigs?.[n],o=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...o}}function Tf(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function Af(e){return hc(e.map(t=>t?.resourceProxy))}function Rf(e){return lc(e.map(t=>t?.resourceProxyPolicy))}function Pf(e){return uc(e.map(t=>t?.backendProxy))}function Df(e){return As(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Of(e,t){return[e.base,Cf(e,t),e.profile,e.serverSide,wa(e,t.fallbackMode),e.local,e.user,Sa(e,t.fallbackMode)]}function Kn(e,t){const n=Of(e,t),r=As(n),o=Tf(n);o!==void 0&&(r.fileManager=o);const i=Af(n);i!==void 0&&(r.resourceProxy=i);const s=Rf(n);s&&Object.keys(s).length>0&&(r.resourceProxyPolicy=s);const a=Pf(n);a!==void 0&&(r.backendProxy=a);const l=Df(n);return l&&Object.keys(l).length>0&&(r.backendProxyPolicy=l),r}function kf(e,t,n){const r=wa(e,n),o=Sa(e,n);return dc([o,e.user,r,e.serverSide],t)}var xf=1.5;function Mf(e){return e.isHeadless||!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=xf*e.autosaveTimeoutMs?"none":"revision"}function Lf(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:o}=e,i=e.readFailures??(()=>0),s=e.readFailureRetryable??(()=>!0);let a;const l=R=>a!==void 0&&a.version===R.get().version?i()-a.failuresAtStart:0,c=R=>{const I=l(R);if(I<=0)return!1;const g=n().retryMaxAttempts??5;return!s()||I>g},d=()=>{const{autosaveTimeoutMs:R,retryIntervalMs:I}=n(),g=t();return g!==void 0&&l(g)>0&&I!==void 0&&I>0?I:R},m=R=>R.isNew()&&i()>=3,h=()=>{const R=t();if(!R||R.isDisposed()||c(R))return"none";const{latestRevisionAt:I,snapshotVersion:g,...p}=n(),u=Date.now(),f=Mf({...p,isDirty:R.isDirty(),isNew:R.isNew(),isReady:R.isReady(),latestRevisionAgeMs:I!=null&&I<=u?u-I:void 0,isSnapshotSent:g!=null&&g===R.get().version});return f==="create"&&m(R)?"none":f},E=()=>{const R=t();if(!R||R.isDisposed()||m(R)||c(R)||n().isHeadless)return!1;if(!R.isDirty())return R.isNew();const{snapshotVersion:I}=n();return!(I!=null&&I===R.get().version)};let w,_,b,T,A=!1;const B=()=>{_=void 0;const R=t();if(!R||R.isDisposed())return;if(R.get().docId!==w){O();return}const I=h();I!=="none"&&a?.version!==R.get().version&&(a={version:R.get().version,failuresAtStart:i()}),I==="create"?r():I==="revision"?o():E()&&(w=R.get().docId,_=setTimeout(B,d()))},O=()=>{const R=t();A||!R||_!==void 0||h()==="none"&&!E()||(w=R.get().docId,_=setTimeout(B,d()))},k=R=>{R.source==="user"&&_!==void 0&&(clearTimeout(_),_=void 0),O()},C=()=>{const R=t();R!==b&&(T?.(),b=R,a=void 0,T=R?.subscribe(k),_!==void 0&&(clearTimeout(_),_=void 0))};return C(),O(),{refresh:()=>{A||(C(),O())},stop:()=>{A=!0,T?.(),T=void 0,b=void 0,_!==void 0&&(clearTimeout(_),_=void 0)}}}var Ia=z("documentSession.autosaveUiFacts"),Ca={isUserBusy:!1,saveContext:{}};function Nf(e){return e.getOrCreateInstance(Ia,()=>ye(Ca))}function Cr(e){return e?.getInstance(Ia)?.get()??Ca}function Ta(e){return Cr(e).saveContext.fallbackTitle||"Untitled email."}var Ff=1e4,Bf=3e4;function jf(e,t){const n=d=>{const m=e.getInstance(me)?.layers?.(),h=m?kf(m,d):void 0;return typeof h=="number"&&h>=0?h:void 0},r=()=>{const d=t.current(),m=d?.get().serverId??void 0,h=re(t.sessionKey()),E=t.recoveryFacts(),w=E?.emailId===m?E:void 0,_=t.revisionFacts(),b=w?.latestRevisionAt,T=_?.lastRevisionAt,A=ba(e).profile;return{isInited:h||d?.get().attributes.is_inited===!0,isEnabled:!!A?.autosaves&&!If(e),isHistoryLoaded:w?.historyLoaded===!0,isUserBusy:Cr(e).isUserBusy,isHeadless:Ef(e),autosaveTimeoutMs:_a(e).autosaveTimeout||Ff,latestRevisionAt:b!==void 0||T!==void 0?Math.max(b??0,T??0):void 0,snapshotVersion:_?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??Bf,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},o=()=>{const d=Cr(e).saveContext;return{...d,project:d.project??t.current()?.get().attributes.project,fallbackTitle:Ta(e)}},i=Lf({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>yu(t.saveState().error),onCreate:()=>{re(t.sessionKey())||t.save("materialize",o())},onRevision:()=>{t.save("snapshot",{project:o().project})}}),s=t.subscribe(i.refresh),a=vo(e).watch(()=>i.refresh()),l=Nf(e).watch(()=>i.refresh()),c=Ea(e).watch(()=>i.refresh());return()=>{s(),a.dispose(),l.dispose(),c.dispose(),i.stop()}}var ai=12e3;function fe(e){return e.getOrCreateInstance(co,()=>{const t=Yu({resolveAdapters:(r,o)=>$f(r,e,o),resolveWritePort:()=>Aa(e),resolveHistoryPort:r=>re(r)?Pa(e):Ra(e),resolveTerms:()=>nf(e),canEdit:r=>Ad(e,r),notifyBeforeSave:kd(e),awaitCanvasSynced:jd(e),savedEchoForm:r=>{const o=Ve(e);return o.toEditorForm(o.toOutputForm(r))},timeoutMs:ai,onAdapterError:(r,o)=>{o instanceof Error&&o.message;const i=Ju(o),s=Xu(o);Mt(o,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(i),network_failure:String(s)},level:i||s?"warning":"error"})},onTimeout:r=>{}}),n=jf(e,t);return e.getInstance(Y)?.addDispose(n),t})}function tt(e){return e?.getInstance(co)}function Aa(e){const t=Zu(e);return t?bo(e)?yf(t,nt(e).email(e)):t:nt(e).email(e)}function Uf(e){return pa(e)!==void 0||da(e)}function Ra(e){const t=pa(e);return t?bo(e)?(oe("port:history:server-backed"),ma(t,nt(e).history(e))):(oe("port:history:integrator"),t):(oe("port:history:rest (порт не зарегистрирован)"),nt(e).history(e))}function Pa(e){const t=fa(e);return t?bo(e)?(oe("port:block-history:server-backed"),ma(t,nt(e).blockHistory(e))):(oe("port:block-history:integrator"),t):(oe("port:block-history:rest (порт не зарегистрирован)"),nt(e).blockHistory(e))}function Hf(e){return fa(e)!==void 0||da(e)}function bo(e){return Bs(e)}function $f({email:e,patch:t,serverId:n,key:r},o,i){const s=[];e?s.push({id:"rest",load:()=>ia(e),required:!0}):n&&s.push(Qu(Aa(o),n)),t&&s.push({id:"plugin",load:()=>sa(t)});const a=re(r);return Ud(n)&&(a?Hf(o):Uf(o))&&s.push(bf({port:a?Pa(o):Ra(o),revisionServiceEnabled:Bs(o),emailId:n,...a?{}:{wpId:()=>i.readWpId(),wpIdOutlook:()=>i.readWpIdOutlook()},readShownContent:()=>i.readShownContent(),onFacts:l=>i.publishRecoveryFacts(l)})),s}function Vf(e){const t=fe(e),n=de(e).addListener(X.APPLICATION_HAS_AMP,r=>{ct(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(Y)?.addDispose(()=>n.dispose())}function qf(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Gf(e){const t=e.fetchImpl??((i,s)=>fetch(i,s)),n=e.pageHost??(()=>window.location.hostname),r=new Set,o=i=>{try{const s=new URL(i,window.location.href);return s.protocol!=="https:"&&s.protocol!=="http:"?!1:s.hostname===n()||e.sourceHosts().includes(s.hostname)}catch{return!1}};return{accepts:o,async load(i){if(!o(i))return;const s=!r.has(i);r.add(i);try{const a=await t(i,{mode:"cors",credentials:"omit",cache:s?"no-cache":"default"});if(!a.ok)return;const l=await a.blob();return qf(l)?l:void 0}catch{return}}}}var Qe={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function zf(e){const t={maxBytes:e.maxBytes??Qe.maxBytes,maxImageBytes:e.maxImageBytes??Qe.maxImageBytes,ttlMs:e.ttlMs??Qe.ttlMs},n=e.now??(()=>Date.now()),r=new Map,o=new Map,i={hits:0,loads:0,failures:0};let s=0;const a=m=>{const h=r.get(m);h&&(s-=h.bytes,r.delete(m))},l=m=>t.ttlMs<=0||n()-m.storedAt<t.ttlMs,c=()=>{if(s<=t.maxBytes)return;const m=[...r.entries()].sort((h,E)=>h[1].usedAt-E[1].usedAt);for(const[h]of m){if(s<=t.maxBytes)return;a(h)}},d=(m,h)=>{h.size>t.maxImageBytes||(r.set(m,{blob:h,bytes:h.size,storedAt:n(),usedAt:n()}),s+=h.size,c())};return{async get(m){const h=r.get(m);if(h&&l(h))return h.usedAt=n(),i.hits+=1,h.blob;h&&a(m);const E=o.get(m);if(E!==void 0)return E;i.loads+=1;const w=(async()=>{try{const _=await e.load(m);return _?d(m,_):i.failures+=1,_}catch{i.failures+=1;return}finally{o.delete(m)}})();return o.set(m,w),w},forget(m){a(m),o.delete(m)},configure(m){Object.assign(t,{maxBytes:m.maxBytes??t.maxBytes,maxImageBytes:m.maxImageBytes??t.maxImageBytes,ttlMs:m.ttlMs??t.ttlMs});for(const[h,E]of r)E.bytes>t.maxImageBytes&&a(h);c()},clear(){r.clear(),o.clear(),s=0},stats(){return{entries:r.size,bytes:s,...i}}}}var Wf=["emcdn.ru","scr.emcdn.ru"];function Kf(e){const t=String(e??"").trim();if(!t)return"";try{return new URL(t.includes("//")?t:`https://${t}`).hostname}catch{return t.split("/")[0].split(":")[0]}}function Yf(e,t){const n=(r,o)=>{const i=new Set(o?t:[]);for(const s of r){const a=Kf(s);a&&i.add(a)}return[...i]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Xf(e){const t=e??{},n=t.isPlugin!==!0?Wf:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Qe};const o=r===!0||r===void 0?{}:r;return{enabled:o.enabled!==!1,sourceHosts:Yf(o.sourceHosts,n),maxBytes:o.maxBytes??Qe.maxBytes,maxImageBytes:o.maxImageBytes??Qe.maxImageBytes,ttlMs:o.ttlMs??Qe.ttlMs}}function Jf(e){const t=de(e),n=e.getInstance(me),r=()=>Xf({...n?.get(),isPlugin:!0});let o=r();const i=Gf({sourceHosts:()=>o.sourceHosts}),s=zf({load:_=>i.load(_),maxBytes:o.maxBytes,maxImageBytes:o.maxImageBytes,ttlMs:o.ttlMs}),a=()=>{t.send(X.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:o.enabled,sourceHosts:[...o.sourceHosts]})},l=t.onInit(()=>a()),c=n?.watch(()=>{const _=r(),b=JSON.stringify(_)!==JSON.stringify(o);o=_,s.configure(_),_.enabled||s.clear(),b&&t.isInited()&&a()}),d={asked:0,served:0,refused:0},m=[],h=(_,b)=>(d.refused+=1,m.push({url:_,reason:b}),m.length>20&&m.shift(),{refused:!0}),E=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:o,counters:{...d},refusals:[...m],store:s.stats()})}),w=t.addListenerAsync(X.APPLICATION_CANVAS_IMAGE_GET,async _=>{const b=_?.url??"";if(d.asked+=1,!o.enabled||!b)return h(b,"disabled");if(!i.accepts(b))return h(b,"host");_.fresh&&s.forget(b);const T=await s.get(b);return T?(d.served+=1,{blob:T}):h(b,"load-failed")});e.getInstance(Y)?.addDispose(()=>{l.dispose(),c?.dispose(),w.dispose(),s.clear(),delete E.__emmCanvasImages__})}var Qf=2e3;function Zf(e){const t=de(e),n=new Map,r=()=>{const s=t.getTarget();if(!s||t.hasPort(s))return;clearTimeout(n.get(s));const a=new MessageChannel;let l=!1,c=!1;const d=h=>{h.data?.operationId==="em:port-ready"&&(l=!0,a.port1.removeEventListener("message",d),c&&t.resumePort(s),t.drainWindow(s))};a.port1.addEventListener("message",d),t.sendPort(s,a.port2),t.usePort(a.port1,!1,s);const m=setTimeout(()=>{n.get(s)===m&&n.delete(s),!(l||!t.hasPort(s,a.port1))&&(Mt(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),c=!0,t.holdPort(s))},Qf);n.set(s,m)},o=Object.assign(globalThis,{__emmCanvasPort__:()=>{const s=t.getTarget();return{usesPort:t.usesPort,windowDrained:s?t.isWindowDrained(s):!1}}}),i=t.onInit(()=>r());e.getInstance(Y)?.addDispose(()=>{for(const s of n.values())clearTimeout(s);i.dispose(),delete o.__emmCanvasPort__})}var ep=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function tp(e){return ep.test(e)||e.indexOf("//")===0}function Jt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function np(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function li(e,t){const n=e==null||e===""?"./":String(e);if(tp(n))return Jt(n);const r=t??np();if(!r)return Jt(n);try{return Jt(new URL(n,r).href)}catch{return Jt(n)}}function rp(){return typeof window.__emailmaker__<"u"&&window.__emailmaker__?.publicPath?li(window.__emailmaker__.publicPath):li("/")}var op=()=>"",ip=()=>"ee1618fa";function sp(e,t){const n=new URL(e);return n.hostname!=="localhost"||t.hostname==="localhost"?e:(n.hostname=t.hostname,n.toString())}function Da(e){const t=e?"iframe-eblock":"iframe",n=op();if(n){const i=sp(n,window.location).replace(/\/?$/,"/");return Go(`${i}${t}.html`,xt())}const r=ip(),o=`${rp().replace(/\/?$/,"/")}iframe/`;return Go(`${o}${t}${r?`.${r}`:""}.html`,xt())}var ci="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Tr(e){return/^file:/i.test(String(e||"").trim())}function ap(e){return Tr(e)?`${ci} allow-same-origin`:ci}var lp="em:module-body-ack";function cp(e,t,n){try{const r=new URL("./",new URL(t,n)).href,o=new URL(e,r).href;return o.startsWith(r)?o:void 0}catch{return}}function yo(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.([0-9a-f]{6,}))?\.html$/.exec(t);return n?{name:n[1],hash:n[2]}:void 0}function dp(e){const t=yo(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function up(e,t){const n=yo(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(o=>e[o]?.file).filter(o=>!!o):[]}function fp(e,t){const n=yo(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const o=new Set([r]),i=[r],s=[];for(;i.length>0;)for(const a of e[i.shift()]??[])o.has(a)||(o.add(a),s.push(a),i.push(a));return s}var pp=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function hp(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&pp.test(t[t.length-2])}async function mp(e,t){const n=hp(e)?{}:{cache:"no-cache"};t?.priority&&(n.priority=t.priority);try{const r=await fetch(e,n);return r.ok?await r.blob():void 0}catch{return}}function gp(e){const t=new Map,n=(r,o)=>{const i=cp(r,e.canvasSrc,e.origin);if(!i)return;const s=t.get(i);if(s!==void 0)return s;const a=e.fetchBody(i,o);return t.set(i,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,o){for(const i of r)n(i,o)},reset(){t.clear()},get size(){return t.size}}}var Oe;function vp(e){try{return Tr(new URL(e,window.location.href).href)}catch{return Tr(window.location.href)}}function Oa(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof window.__emailmaker__<"u"&&window.__emailmaker__?.preload?.canvasCrossOrigin===!0}var bp=()=>Promise.resolve(void 0);function ka(){const e=Da(!1);if(!vp(e)){if(!Oe||Oe.canvasSrc!==e){const t=Oa(e)?mp:bp;Oe={canvasSrc:e,store:gp({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return Oe.store}}async function yp(e,t){try{const n=new URL(".vite/manifest.json",new URL("./",new URL(e,window.location.href))).href,r=await fetch(n,{cache:"no-cache"});if(!r.ok)return;const o=await r.json();t(up(o,e))}catch{}}function Eo(e){const t=ka();if(!t||!Oe||Oe.warmed||!Oa(Oe.canvasSrc))return;Oe.warmed=!0;const{canvasSrc:n}=Oe,r=dp(n);r&&t.warm([r],e);const o={"js/iframe-eblock.js":["js/elMarkupHelper.Buog1r0c.js"],"js/iframe.js":["js/elMarkupHelper.Buog1r0c.js"],"js/darkreader.CLd5EML2.js":[],"js/elMarkupHelper.Buog1r0c.js":[],"js/rules.CnnzdMsj.js":[],"js/typograf.all.Mun9CrLC.js":[]};o?t.warm(fp(o,n),e):yp(n,i=>t.warm(i,e))}function Ep(e){const t=ka();if(!t)return;Eo();const n=r=>{const o=r.data;if(!o||o.operationId!=="em:module-body"||!o.result)return;const i=r.source;i&&(i.postMessage({operationId:lp,for:o.result},"*"),t.take(o.data?.url??"").then(s=>{i.postMessage({operationId:o.result,data:s??null},"*")}))};window.addEventListener("message",n),e.getInstance(Y)?.addDispose(()=>{window.removeEventListener("message",n)})}var dt=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,_p=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,gt=/<style\b[^>]*>[\s\S]*?<\/style>/gi,di=/display:\s*none\s*!important/gi,wp=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Sp=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Ip=/height\s*:\s*100%\s*!important/i,Cp=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"];function Tp(e){return di.lastIndex=0,(e.match(di)||[]).length}function xa(e){const t=e.trim(),n=Tp(t);if(n===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||n>=3||t.length>2e3))return!0;const r=Cp.filter(o=>t.includes(o)).length;return r>=1&&(n>=3||t.length>2e3)||n>=5&&r>=1?!0:n>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function Ap(e){gt.lastIndex=0;for(const t of e.matchAll(gt))if(xa(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Rp(e){let t=!1;return gt.lastIndex=0,{html:e.replace(gt,n=>xa(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Pp(e){return dt.lastIndex=0,dt.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||Ap(e)}function Dp(e){if(!Pp(e))return{html:e,found:!1};let t=!1,n=e;dt.lastIndex=0,dt.test(n)&&(dt.lastIndex=0,n=n.replace(dt,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(_p,""),t=!0);const r=Rp(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Op(e){return!e||!Ip.test(e)?e:(gt.lastIndex=0,e.replace(gt,t=>t.replace(wp,(n,r,o,i)=>`${r}${o.replace(Sp,"")}${i}`)))}function Ma(e){const t=Dp(e.replaceAll(`\r
1003
1003
  `,`
1004
- `));return{html:rp(t.html),hasBrowserExtensionArtifacts:t.found}}function mn(e){return e?.getContent()??""}function _a(e,t){e?.mutate({content:oo(t)},{source:"remote"})}function Dn(e){return V(e)}function le(e,t){return e.getOrCreateInstance(t,()=>new je)}function J(e,t){return e.getOrCreateInstance(t,()=>new je).event}function gn(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var op=class extends Error{label;timeoutMs;constructor(e){super(`[sandbox:ready] iframe handshake timed out after ${e}ms`),this.name="SandboxReadyTimeoutError",this.label="sandbox:ready",this.timeoutMs=e}};function ip(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.isInited=="function"&&typeof t.getTarget=="function"&&typeof t.onInit=="function"}function sp(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(ee(n),new Promise((r,o)=>{let i=!1,s,a;const l=d=>{i||(i=!0,s!==void 0&&(clearTimeout(s),s=void 0),a?.dispose(),n?.removeEventListener("abort",c),d())},c=()=>{l(()=>o(ve(n?.reason)))};if(a=e.onInit(()=>{e.isInited()&&e.getTarget()&&l(()=>r())}),e.isInited()&&e.getTarget()){l(()=>r());return}t>0&&(s=setTimeout(()=>{l(()=>o(new op(t)))},t)),n?.addEventListener("abort",c)}))}var ap=class extends Error{label;timeoutMs;constructor(e,t){super(`[${e}] timed out after ${t}ms`),this.name="OperationTimeoutError",this.label=e,this.timeoutMs=t}};function lp(e,t,n){return t<=0?e:new Promise((r,o)=>{let i=!1,s;const a=l=>{i||(i=!0,s!==void 0&&(clearTimeout(s),s=void 0),l())};s=setTimeout(()=>{a(()=>o(new ap(n,t)))},t),e.then(l=>{a(()=>r(l))},l=>{a(()=>o(l))})})}var cp=2,It=Symbol("sandbox:frame-replaced");function ti(e){return e===It}function Ke(e,t,n,r,o,i,s){const a=`sandbox:${t}`,l=i?.getSandboxTimeoutMs(t)??ro[t],c=()=>{let I=lp(e.sendAsync(n,r),l,a);return I=un(I,i?.signal),Ye(a,I,o)};if(t==="INIT_START"&&ip(e)){const I=i?.getSandboxReadyTimeoutMs()??2e4,w=e,b=R=>{const A=sp(w,I,i?.signal);return Ye("sandbox:INIT_START:ready-wait",A,o).then(()=>{if(!s||R<=0)return c();const L=s.getGeneration();let P;const O=new Promise((C,T)=>{P=s.onChange(()=>{s.getGeneration()!==L&&T(It)})}),_=c();return _.catch(()=>{}),Promise.race([_,O]).finally(()=>P?.()).catch(C=>{if(C!==It)throw C;return{...o},b(R-1)})})};return b(cp)}if(!s)return c();const d=s.getGeneration();let g;const h=new Promise((I,w)=>{g=s.onChange(()=>{s.getGeneration()!==d&&w(It)})}),y=c();return y.catch(()=>{}),Promise.race([y,h]).finally(()=>g?.()).catch(I=>{throw I===It&&{...o},I})}var wa="self-init:";function dp(e){return e.startsWith(wa)}function mo(e,t){const n=e.getActiveShowRequest();return dp(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function up(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t(),o=()=>e.frameWatch?.();let i="",s;const a=I=>{s={target:e.readTarget?.(),docId:I}},l=()=>e.readDocument()?mn(e.readDocument()):i,c=()=>$e(e.container).editorPolicy,d=()=>e.readEmail(),g=()=>{const I=d();return{...I,id:e.isTemplate()||I.isNew?void 0:I.id,html:l()}};let h=!1;const y={readContent:l,publicEmail:g,sendInitStart:()=>Ke(n,"INIT_START",K.SANDBOX_INIT_START,{guid:d().renderGuid},void 0,r()),sendInited:()=>Ke(n,"INITED",K.SANDBOX_INITED,{guid:d().renderGuid},void 0,r(),o()),async sendContent(){const I=d(),{html:w,hasBrowserExtensionArtifacts:b}=Ea(I?.html||"");b&&e.events.browserExtensionDetected(),_a(e.readDocument(),w),i=w,a(I.renderGuid),await Ke(n,"SET_ENTITY",K.SANDBOX_SET_ENTITY,gn(l(),I.renderGuid,c(),e.readDocument()?.get().version),{guid:I.renderGuid,emailId:I.id??null},r(),o())},refreshContent:()=>(a(d().renderGuid),Ke(n,"SET_ENTITY",K.SANDBOX_SET_ENTITY,gn(l(),d().renderGuid,c(),e.readDocument()?.get().version),void 0,r(),o())),sendPreheader:async()=>{const I=d();if(I.preheader!==void 0)return Ke(n,"PREHEADER",K.SANDBOX_PREHEADER_UPDATE,{value:I.preheader,guid:I.renderGuid,force:!0},void 0,r(),o())},sendSubject:async()=>{const I=d();if(I.subject!==void 0)return Ke(n,"SUBJECT",K.SANDBOX_SUBJECT_UPDATE,{value:I.subject,guid:I.renderGuid,force:!0},void 0,r(),o())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:I=>e.showFilled?.(I),noteFilled:(I,w)=>e.noteFilled?.(I,w),contentSent:()=>s,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(g()),fireInit(I,w){if(!mo(t(),I)){t().getActiveShowRequest()?.showId;return}const b=d();b.id,b.renderGuid,t().completeShow(I);const R=e.readDocument();ht(R,{is_inited:!0},{source:"system"});const A=()=>{const P=g();w&&(P.reset=!0);const O=e.events.inited(P);return w||(h&&y.fireEmailChanged(),h=!0),O};if(!R||R.isReady())return A();const{docId:L}=R.get();return R.whenReady().then(()=>e.readDocument()?.get().docId===L?A():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(g())},fireContentChanged(){e.events.contentChanged(l())}};return y}var fp=class extends Error{showId;constructor(e,t){super(`[emailmaker] show() timed out after ${t}ms waiting for editor init (showId=${e}). Check earlier console errors: wrong host-plugin publicPath (chunks return HTML), mount element removed without destroy(), or sandbox init never completed. Search for [show-pipeline] and [AMD] messages.`),this.name="ShowPipelineTimeoutError",this.showId=e}},pp=class{_activeRequest=null;_pending=new Map;_listeners=new Set;getActiveShowRequest(){return this._activeRequest}onShowRequested(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}requestShow(e,t,n){return this._rejectPending(ve("Superseded by newer show()")),n.aborted?Promise.reject(ve(n.reason)):(this._activeRequest=e,new Promise((r,o)=>{const i=setTimeout(()=>{this._settle(e.showId,()=>{o(new fp(e.showId,t))})},t);i.unref?.();const s=()=>{this._settle(e.showId,()=>{o(ve(n.reason))})};n.addEventListener("abort",s,{once:!0});const a=()=>{clearTimeout(i),n.removeEventListener("abort",s)};this._pending.set(e.showId,{request:e,resolve:r,reject:o,timeoutId:i,dispose:a});for(const l of this._listeners)l(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function hp(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function mp(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Os(e),n=ks(e),r=dd(e.sandbox);t<n+r}var Sa=class{_controller=new AbortController;_externalSignalDisposable=new ue;_sessionChangeListeners=new Set;_showRegistry=new pp;_timeouts;_generation=0;_sessionStarted=!1;_externalSignal;get signal(){return this._controller.signal}get externalSignal(){return this._externalSignal}get generation(){return this._generation}get contentReadyTimeoutMs(){return Os(this._timeouts)}getSandboxTimeoutMs(e){return Ds(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return ks(this._timeouts)}bumpGeneration(){this._generation+=1}getActiveShowRequest(){return this._showRegistry.getActiveShowRequest()}onShowRequested(e){return this._showRegistry.onShowRequested(e)}requestShow(e){return this._showRegistry.requestShow(e,this.contentReadyTimeoutMs,this._controller.signal)}completeShow(e){this._showRegistry.completeShow(e)}hasPendingShow(e){return this._showRegistry.hasPendingShow(e)}failShow(e,t){this._showRegistry.failShow(e,t)}rejectAllPendingShows(e){this._showRegistry.rejectAll(e)}onSessionReplaced(e){return this._sessionChangeListeners.add(e),()=>{this._sessionChangeListeners.delete(e)}}configure(e){e.timeouts!==void 0&&(this._timeouts=hp(this._timeouts,e.timeouts),mp(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,e.signal!==void 0&&(this._externalSignal=e.signal),t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}relinkExternalSignal(e){this._externalSignal=e,this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new ue,this._linkExternalSignal(e)}abort(e){const t=e??ve("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new ue}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new ue,this._showRegistry.rejectAll(ve("Init session replaced")),this._controller.signal.aborted||this._controller.abort(ve("Init session replaced")),this._controller=new AbortController,this._emitSessionReplaced()}_emitSessionReplaced(){for(const e of this._sessionChangeListeners)e()}_linkExternalSignal(e){if(!e)return;if(e.aborted){this._controller.signal.aborted||(this._controller.abort(e.reason??ve()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??ve()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},go=(()=>{const e=new Sa;return e.configure({}),e})();function nt(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.parentNode;return n instanceof ShadowRoot&&n.host instanceof HTMLElement?n.host:null}function Ge(e){return!e||e==="none"}function gp(e){const t=e.contain??"",n=e.willChange??"";return!Ge(e.transform)||!Ge(e.perspective)||!Ge(e.filter)||!Ge(e.backdropFilter)||!Ge(e.translate)||!Ge(e.rotate)||!Ge(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function ni(e){const t=/paint|strict|content/.test(e.contain??"");return{x:t||!!e.overflowX&&e.overflowX!=="visible",y:t||!!e.overflowY&&e.overflowY!=="visible"}}function vp(e){const t=[],n=document.documentElement,r=ni(getComputedStyle(n)),o=r.x||r.y;let i="none";const s=getComputedStyle(e).position;(s==="absolute"||s==="fixed")&&(i=s);for(let a=nt(e);a&&a!==n;a=nt(a)){const l=getComputedStyle(a),c=i==="none"||gp(l)||i==="absolute"&&!!l.position&&l.position!=="static",d=a===document.body&&!o;if(c){i="none";const g=d?{x:!1,y:!1}:ni(l);(g.x||g.y)&&t.push({node:a,...g})}(l.position==="absolute"||l.position==="fixed")&&(i==="none"||l.position==="fixed")&&(i=l.position==="fixed"?"fixed":"absolute")}return t}function Ia(e){const t=e.getBoundingClientRect(),n=e.offsetWidth>0&&t.width>0?t.width/e.offsetWidth:1;return{x:n,y:e.offsetHeight>0&&t.height>0?t.height/e.offsetHeight:n}}function Xt(e){return Number.parseFloat(e)||0}function _r(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=Ia(e),o=Xt(n.borderLeftWidth),i=Xt(n.borderTopWidth),s=Xt(n.borderRightWidth),a=Xt(n.borderBottomWidth),l=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-o-s):0,c=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-i-a):0;return{left:t.left+o*r.x,top:t.top+i*r.y,right:t.right-(s+l)*r.x,bottom:t.bottom-(a+c)*r.y}}function bp(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},o=(i,s,a)=>{s&&(r.left=Math.max(r.left,i.left),r.right=Math.min(r.right,i.right)),a&&(r.top=Math.max(r.top,i.top),r.bottom=Math.min(r.bottom,i.bottom))};return t.forEach(i=>o(_r(i.node),i.x,i.y)),n&&o(_r(n),!0,!0),r}var wr={originX:0,originY:0,scaleX:1,scaleY:1};function vn(e,t){return{left:(e.left-t.originX)/t.scaleX,top:(e.top-t.originY)/t.scaleY,width:Math.max(0,e.right-e.left)/t.scaleX,height:Math.max(0,e.bottom-e.top)/t.scaleY}}function Ca(e,t,n){const r=t.width>0&&e.width>0?e.width/t.width:n.scaleX,o=t.height>0&&e.height>0?e.height/t.height:r;return{originX:e.left-t.left*r,originY:e.top-t.top*o,scaleX:r,scaleY:o}}function Ta(e,t){return Math.abs(e.left-t.left)<=.5&&Math.abs(e.top-t.top)<=.5&&Math.abs(e.width-(t.right-t.left))<=.5&&Math.abs(e.height-(t.bottom-t.top))<=.5}var yp=1e3;function Ep(e){const{slot:t,own:n}=e;let r,o=0,i=!1;const s=()=>{if(r=void 0,!i){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<o)&&(r=window.requestAnimationFrame(s))}},a=()=>{!i&&r===void 0&&(r=window.requestAnimationFrame(s))},l=()=>{o=performance.now()+yp,a()},c=[window],d=[document.documentElement];for(let b=t;b;b=nt(b)){const R=b.getRootNode();R instanceof ShadowRoot&&!c.includes(R)&&(c.push(R),d.push(R))}const g=[["scroll",a],["load",a],["transitionrun",l],["transitionend",a],["transitioncancel",a],["animationstart",l],["animationend",a],["animationcancel",a]];c.forEach(b=>g.forEach(([R,A])=>b.addEventListener(R,A,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const h=typeof MutationObserver=="function"?new MutationObserver(b=>{b.some(R=>!n.contains(R.target))&&a()}):void 0;d.forEach(b=>h?.observe(b,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let y;try{if(typeof ResizeObserver=="function"){const b=new ResizeObserver(a);typeof b.observe=="function"&&(y=b)}}catch{y=void 0}let I=[];return{schedule:a,observe:b=>{!y||b.length===I.length&&b.every((R,A)=>R===I[A])||(y.disconnect(),I=b,b.forEach(R=>y?.observe(R)))},dispose(){i=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),c.forEach(b=>g.forEach(([R,A])=>b.removeEventListener(R,A,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),h?.disconnect(),y?.disconnect()}}}var _p="pluginZoom",wp=/^(?:ant|vscode|monaco|docs)-/;function Sp(e){return wp.test(e)}function Ip(){const e="em".trim();if(!/^[a-z][a-z0-9]*$/i.test(e))throw new Error(`[cssVars] REACT_APP_CSS_VAR_PREFIX="${e}" is not a valid CSS identifier fragment.`);return e}var Cp=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function Tp(){return Cp}var Ap=new Set;function Rp(e,t,n=Ap){return e.startsWith(`${t}-`)?!1:!Sp(e)&&!n.has(e)}function Pp(e,t){return`--${t}-${e}`}function Aa(e){const t=Ip();return Rp(e,t,Tp())?Pp(e,t):`--${e}`}function Dp(e,t){const n=Aa(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function Ra(e,t){return Dp(e,t)}var Pa=300,ri=15e3,Op=5e3,oi="em-canvas-busy-style";function kp(){if(document.getElementById(oi))return;const e=document.createElement("style");e.id=oi,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var xp="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z";function Mp(e){const t=Ra("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(Aa("colorPrimary")).trim()||t}function Da(e){kp();const t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("viewBox","0 0 1024 1024"),n.setAttribute("width","48"),n.setAttribute("height","48"),n.setAttribute("fill","currentColor"),n.setAttribute("aria-hidden","true");const r=document.createElementNS(t,"path");r.setAttribute("d",xp),n.appendChild(r);const o=document.createElement("span");return o.setAttribute("role","img"),o.setAttribute("aria-label","loading"),o.setAttribute("style",`display:inline-flex;color:${Mp(e)};animation:em-canvas-busy-spin 1s linear infinite`),o.appendChild(n),o}function Lp(e,t,n){const r=t??e,o=Math.max(r.left,e.left,0),i=Math.min(r.right,e.right,n.width),s=Math.max(r.top,e.top,0),a=Math.min(r.bottom,e.bottom,n.height);return i<=o||a<=s?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(o+i)/2-e.left,y:(s+a)/2-e.top}}function Np(e,t){const n=e.getBoundingClientRect(),r=document.createElement("div");r.setAttribute("aria-busy","true"),Object.assign(r.style,{position:"fixed",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,cursor:"progress"}),e.appendChild(r);const o={left:n.left,top:n.top,right:n.right,bottom:n.bottom},i=r.getBoundingClientRect();if(i.width>0&&!Ta({left:i.left,top:i.top,width:i.width,height:i.height},o)){const s=vn(o,Ca(i,vn(o,wr),wr));Object.assign(r.style,{left:`${s.left}px`,top:`${s.top}px`,width:`${s.width}px`,height:`${s.height}px`})}return{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const s=Lp(n,t(),{width:window.innerWidth,height:window.innerHeight}),a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:`${s.x}px`,top:`${s.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),a.appendChild(Da(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function zn(e){const t=document.createElement("div");t.setAttribute("aria-busy","true"),Object.assign(t.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"progress"});const n=getComputedStyle(e).position!=="static";n||(e.style.position="relative"),e.appendChild(t);const r=setTimeout(()=>{t.appendChild(Da(e))},Pa);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var Fp=8e3;function Bp(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),followReload:()=>{},moveTo:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,slot:null,whenShown:()=>Promise.resolve(),filled:void 0,noteFilled:()=>{},alignTo:()=>{},resize:()=>{},hold:()=>{},dispose:()=>{}}}function jp(e,t){for(let n=nt(e);n;n=nt(n)){const r=getComputedStyle(n),o=r.overflowX!=="visible"||r.overflowY!=="visible",i=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(s=>it(s)>0);if(o&&i)return n;if(n===t)return null}return null}function it(e){return Number.parseFloat(e)||0}function Jt(e,t){return Math.abs(e-t)<=1}function Up(e){const t=getComputedStyle(e),n=it(t.borderTopWidth),r=it(t.borderRightWidth),o=it(t.borderBottomWidth),i=it(t.borderLeftWidth),s=(a,l,c)=>Math.max(0,it(a)-Math.max(l,c));return{..._r(e),radii:[s(t.borderTopLeftRadius,n,i),s(t.borderTopRightRadius,n,r),s(t.borderBottomRightRadius,o,r),s(t.borderBottomLeftRadius,o,i)]}}function Hp(e,t){const n=Jt(t.top,e.top),r=Jt(t.bottom,e.bottom),o=Jt(t.left,e.left),i=Jt(t.right,e.right),s=[n&&o?e.radii[0]:0,n&&i?e.radii[1]:0,r&&i?e.radii[2]:0,r&&o?e.radii[3]:0];return s.every(a=>a===0)?"":s.map(a=>`${a}px`).join(" ")}function $p(e,t,n,r,o,i){const s=n.readyTimeoutMs??Fp,a=document.createElement("div");a.dataset.canvasHost=e,r&&(a.dataset.canvasPlace=r),a.style.position="fixed",a.style.overflow="hidden",a.style.visibility="hidden",a.style.setProperty("zoom",Ra(_p,"1"));const l=n.resolveSrc(e),c=document.createElement("iframe");c.setAttribute("sandbox",n.resolveSandbox(l)),c.setAttribute("allow","clipboard-read; clipboard-write"),c.setAttribute("title","Email content"),c.style.width="100%",c.style.border="0",c.style.display="block",c.style.minHeight="600px",c.src=l,a.appendChild(c),t.appendChild(a),n.mark?.("created"),o||n.onCreated?.(c);const d=new ue;let g=!1,h,y=!1,I,w,b,R;const A=()=>{clearTimeout(R),R=setTimeout(()=>{y||(y=!0,w?.(new Error(`[canvas] ${e}: документ не загрузился за ${s} мс`)))},s)},L=()=>g?(b=Promise.resolve(),y=!0,b):(y=!1,b=new Promise((F,B)=>{I=F,w=B}),A(),b),P=()=>{if(clearTimeout(R),g=!0,y){b=Promise.resolve();return}y=!0,n.mark?.("loaded"),I?.()};c.addEventListener("load",P),d.addDispose(()=>{clearTimeout(R),c.removeEventListener("load",P)});let O;const _=()=>{O??=n.bindResizer?.(c)},C=()=>{O?.dispose(),O=void 0};let T=null,m=null,f,u=wr,p="",D="",x=0;const E=F=>{const B=JSON.stringify(F);return B===p?!1:(p=B,a.style.visibility=F.visibility,a.style.left=`${F.css.left}px`,a.style.top=`${F.css.top}px`,a.style.width=`${F.css.width}px`,a.style.height=`${F.css.height}px`,a.style.borderRadius=F.radius,c.style.width=F.elementWidth>0?`${F.elementWidth}px`:"100%",c.style.transform=F.shiftX!==0?`translate(${F.shiftX}px, ${F.shiftY}px)`:`translateY(${F.shiftY}px)`,!0)};let S=!1;const N=()=>{if(!T)return p="",a.style.visibility="hidden",c.removeAttribute("id"),!1;n.elementId&&(c.id=n.elementId);const F=T.getBoundingClientRect(),B=vp(T),U=m?.isConnected?m:null;f?.observe([T,c,...B.map(oe=>oe.node),...U?[U]:[]]);const Y=bp(F,B,U),Z=Math.max(0,Y.right-Y.left),xe=Math.max(0,Y.bottom-Y.top),Te=getComputedStyle(T).visibility==="visible",qe=Z<=0||xe<=0,Me=qe?{left:Y.left,top:Y.top,right:Y.left,bottom:Y.top}:Y,M=qe?null:jp(T,U??B[0]?.node??null),Q=M?Hp(Up(M),Me):"",X=oe=>E({visibility:Te&&!S?"":"hidden",css:vn(Me,oe),elementWidth:F.width/oe.scaleX,shiftX:(F.left-Me.left)/oe.scaleX,shiftY:(F.top-Me.top)/oe.scaleY,radius:Q});let he=X(u);if(!qe){const oe=a.getBoundingClientRect();oe.width>0&&!Ta({left:oe.left,top:oe.top,width:oe.width,height:oe.height},Me)&&(u=Ca(oe,vn(Me,u),u),he=X(u)||he)}return he},$=()=>{if(!T)return!1;let F=N();const B=c.getBoundingClientRect().height;B>0&&B!==x&&(x=B,T.style.height=`${B/Ia(T).y}px`,F=!0);const U=getComputedStyle(T).pointerEvents;return U!==D&&(D=U,a.style.pointerEvents=U),F},v=()=>{f?.dispose(),f=void 0},k=F=>{f=Ep({slot:F,own:a,measure:$,onDetached:v})};let j=[];const z=(F,B)=>{if(m=B,F&&j.length>0){const U=j;j=[],U.forEach(Y=>Y())}if(F===T){F&&!f&&k(F),$();return}if(v(),T&&T.style.removeProperty("height"),p="",x=0,D="",T=F,!F){N(),C();return}n.onShown?.(c),k(F),$(),_()};d.addDispose(v);const G=F=>{g=!1,h=void 0,i?.(),F&&n.onReload?.(c);let B;y||b===void 0?B=L():(A(),B=b);try{c.contentWindow?.location.reload()}catch{c.src=l}return B};return{element:c,ready(){return b??L()},reload:()=>G(!0),reloadQuietly:()=>G(!1),followReload:()=>{h=void 0,i?.(),n.onReload?.(c)},moveTo(F){if(a.parentNode===F)return b??L();g=!1,h=void 0,i?.();let B;return y||b===void 0?B=L():(A(),B=b),F.appendChild(a),n.onReload?.(c),p="",f?.schedule(),B},get shown(){return T!==null},get slot(){return T},whenShown(){return T!==null?Promise.resolve():new Promise(F=>{j.push(F)})},get filled(){return h},noteFilled(F){h=F},alignTo(F,B){z(F,B??null)},hold(F){S!==F&&(S=F,N())},scrollBy(F,B){let U=F,Y=B;for(let Z=T?nt(T):null;Z;Z=nt(Z)){if(Math.abs(U)<1&&Math.abs(Y)<1)return;const xe=getComputedStyle(Z);if((xe.overflowY==="auto"||xe.overflowY==="scroll")&&Z.scrollHeight>Z.clientHeight){const Te=Z.scrollTop,qe=Z.scrollLeft;Z.scrollBy({left:U,top:Y,behavior:"instant"}),U-=Z.scrollLeft-qe,Y-=Z.scrollTop-Te}}(Math.abs(U)>=1||Math.abs(Y)>=1)&&window.scrollBy({left:U,top:Y,behavior:"instant"})},resize(){O?.resize()},dispose(){z(null,null),C(),d.dispose(),a.remove()}}}function qp(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",o=(u,p)=>u==="email"?`email:${p??n}`:u,i=new Map;let s,a=[],l=!1,c,d,g=!1,h,y,I="shown",w=0,b,R,A;const L=u=>d!==void 0&&u.filled!==void 0&&u.filled!==d,P=()=>{b=void 0;const u=h;!g||!u||d===void 0||R===d||!L(u)||(R=d,e.onForeignDocument?.({wanted:d,filled:u.filled,role:I,heldMs:Date.now()-w}))},O=()=>{g=!1,h=void 0,y=void 0,clearTimeout(b),b=void 0},_=(u,p)=>{const D=i.get("email"),x=D?.slot??null;return u&&x&&L(u)?(u.alignTo(null),g||(g=!0,w=Date.now(),b=setTimeout(P,Op)),I=p,h=u,!(s!==void 0||l)&&y!==u&&(y=u,e.onShown?.(u.element)),!c&&!s&&(c=zn(x)),!1):(g&&(O(),c?.remove(),c=void 0),u?.alignTo(x,D?.clip??null),!0)},C=()=>{g&&!l&&_(t.get(o("email")),"shown")},T=()=>{a.forEach(u=>clearTimeout(u)),a=[],s?.remove(),s=void 0,c?.remove(),c=void 0,(l||g)&&(l=!1,_(t.get(o("email")),"shown"))},m=(u,p,D)=>{const x=o(u,p),E=t.get(x);if(E)return E;const S=e.resolveMount();if(!S)return Bp();const N=$p(u,S,e,u==="email"?p??n:void 0,D,u==="email"?()=>C():void 0);return t.set(x,N),N},f={get:u=>m(u),current:u=>m(u),peek:u=>t.get(o(u)),spare:()=>t.get(o("email",r())),ensureSpare:()=>m("email",r(),!0),promote(){const u=t.get(o("email",r()));if(!u)return;const p=t.get(o("email"));n=r(),A=void 0,_(u,"spare"),p?.alignTo(null)},alignSurface(u,p,D){const x=i.get(u);if(i.set(u,{slot:p,clip:D??null}),u==="email"&&l){c?.remove(),c=p?zn(p):void 0;return}const E=p?m(u):t.get(o(u));if(u!=="email"){E?.alignTo(p,D??null);return}if(!p){A=x?.slot&&E?.shown?{slot:x.slot,handle:E}:void 0,g&&(O(),c?.remove(),c=void 0),E?.alignTo(null);return}const S=A?.slot===p&&A.handle===E;if(A=void 0,x?.slot===p&&E?.shown||S){E?.alignTo(p,D??null);return}_(E,"shown")},want(u){d=u,u!==void 0&&C()},noteFilled(u,p){const D=f.byWindow(u);D&&(D.noteFilled(p),D===t.get(o("email"))&&C())},visible(){for(const u of t.values())if(u.shown)return u},byWindow(u){if(u){for(const p of t.values())if(p.element.contentWindow===u)return p}},busy(u){if(T(),!u)return;if(!f.visible()){l=!0,c?.remove(),c=void 0;const x=i.get("email");x?.slot&&(c=zn(x.slot)),a=[setTimeout(T,ri)];return}const p=e.resolveMount();if(!p)return;const D=Np(p,()=>f.visible()?.element.parentElement?.getBoundingClientRect()??null);s=D,a=[setTimeout(()=>D.showSpinner(),Pa),setTimeout(T,ri)]},remount(u){T();const p=o("email");t.forEach((D,x)=>{if(x===p){D.moveTo(u).catch(()=>{});return}D.dispose(),t.delete(x)})},dispose(){d=void 0,l=!1,O(),A=void 0,T(),t.forEach(u=>u.dispose()),t.clear(),i.clear(),n="a",d=void 0,R=void 0}};return f}var Vp=V("canvas.resizerBinder"),Sr=V("canvas.service"),Gp={created:de.canvasCreated,loaded:de.canvasLoaded},Oa=new WeakMap;function Ir(e){return Oa.get(e)??0}function zp(e,t){if(e.getInstance(Sr))return;const n=qp({resolveMount:()=>t.resolveMount(),resolveSrc:o=>t.resolveSrc(o),resolveSandbox:xf,elementId:t.elementId,bindResizer:o=>e.getInstance(Vp)?.(o),onCreated:o=>Pt(e,o,"fresh"),onReload:o=>{Oa.set(o,Ir(o)+1),Pt(e,o,"fresh")},onShown:o=>{const i=n.byWindow(ae(e).getTarget());i&&i.element!==o&&ii(i.element)===ii(o)||Pt(e,o,"switch")},mark:o=>t.mark?.(Gp[o]),onForeignDocument:o=>{({...o},bd("canvas identity: place held, frame has another document",{origin:"canvas-identity",level:"warning",tags:{role:o.role},contexts:{canvasIdentity:{...o,path:window.location.pathname}}}))}}),r=ae(e).addListener(K.SANDBOX_WHEEL,o=>{n.visible()?.scrollBy(o?.deltaX??0,o?.deltaY??0)});e.inject(Sr,n),e.getInstance(W)?.addDispose(()=>{r.dispose(),n.dispose()})}function ii(e){return e.parentElement?.dataset.canvasHost}function Pt(e,t,n){const r=ae(e),o=t.contentWindow;if(!o)return;const i=r.getTarget()===o;i&&n==="switch"||(n==="fresh"&&(r.forget(o),i&&r.setTarget(void 0)),r.setTarget(o),hd(r))}function Wp(e,t){Pt(e,t,"promote")}function Kp(e,t){Pt(e,t,"switch")}function Yp(e,t){const n=t.contentWindow;n&&ae(e).greet(n)}function ka(e,t){const n=t.contentWindow;n&&ae(e).forget(n)}function Xp(e,t){const n=se(e)?.byWindow(t)?.element;if(!n)return;const r=Ir(n);return()=>Ir(n)!==r}function se(e){return e.getInstance(Sr)}function xa({attributes:e,readContent:t,docId:n,hasSession:r,serverId:o,show:i}){if(!r)return;const s={id:o??void 0,renderGuid:n,showId:i?.id,isNew:o==null,showToken:i?.token},a={...e,...s};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}function On(e){return{...xa({attributes:e.get().attributes,readContent:()=>e.getContent(),docId:e.get().docId,hasSession:!0,serverId:e.get().serverId,show:void 0}),html:e.getContent()}}function sn(e){const t=ce(e),n=t.current();if(!n||!te(t.sessionKey()))return;const r=On(n),o=n.isDirty();le(e,H.ON_BLOCK_CLOSE_ID).fire({block:r,hasUnsavedChanges:o})}function Jp(e){const t=ce(e);return!t.current()||!te(t.sessionKey())?!1:(sn(e),t.hasSuspended()?t.resumeSuspended()!==void 0:!1)}function Qp(e){const t=ce(e),n=ae(e),r=()=>e.getInstance(De)??go;let o,i,s=!1,a=!1,l,c;const d=D=>On(D),g=()=>{const D=L(),x=D?.get().docId;if(!D||!x||x!==l||s)return;const E=D.get().version;E!==c&&(c=E,le(e,H.ON_BLOCK_CHANGED_ID).fire(d(D)))};let h;const y=D=>{const x=t.showFacts();!x||x.id===h||!mo(D,x.id)||(h=x.id,D.completeShow(x.id))},I=async(D,x,E)=>{const S=E.generation,N=()=>E.generation!==S||E.signal.aborted||t.current()!==D||a,$=be(n);let v;const k=new Promise(z=>{v=fn(n,()=>z("regenerated"))}),j=async(...z)=>await Promise.race([Ke(...z).then(()=>"sent"),k])==="sent";s=!0;try{if(!await j(n,"INIT_START",K.SANDBOX_INIT_START,{guid:x},void 0,E)||N())return;const{html:z,hasBrowserExtensionArtifacts:G}=Ea(mn(D));if(G&&le(e,H.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),_a(D,z),!await j(n,"SET_ENTITY",K.SANDBOX_SET_ENTITY,gn(mn(D),x,$e(e).editorPolicy,D.get().version),void 0,E)||N()||!await j(n,"INITED",K.SANDBOX_INITED,{guid:x},void 0,E)||N())return;o=x,i=$,P(),c=D.get().version,l!==x&&(l=x,le(e,H.ON_BLOCK_INIT_ID).fire(d(D))),y(E)}finally{v?.(),s=!1,be(n)!==$&&C()}};let w,b,R;const A=()=>{const D=se(e)?.peek("block");return D?.reload?(D.reload().catch(()=>{}),!0):!1},L=()=>te(t.sessionKey())?t.current():void 0,P=()=>{const D=L()?.get().docId,x=!D||R===D||o===D&&i===be(n);se(e)?.peek("block")?.hold(!x)},O=()=>{if(a||(P(),g(),s))return;const D=L(),x=D?.get().docId;if(!D||!x)return;if(o===x&&i===be(n)){y(r());return}if(!D.isReady())return;const E=r();E.signal.aborted||o!==void 0&&o!==x&&w!==x&&(w=x,A())||I(D,x,E).catch(()=>{if(!(a||t.current()!==D)){if(b!==x){b=x,A();return}R=x,P()}})};let _=!1;const C=()=>{_||a||(_=!0,queueMicrotask(()=>{_=!1,O()}))};let T,m;const f=()=>{const D=L(),x=D?.get().docId;x!==m&&(T?.(),m=x,T=D?.subscribe(C)),P(),C()},u=t.subscribe(f),p=fn(n,()=>{P(),C()});f(),e.getInstance(W)?.addDispose(()=>{a=!0,p(),T?.(),u()})}function Zp(e){const t=ce(e);let n="email";const r=()=>{if(!t.current())return;const i=te(t.sessionKey())?"block":"email",s=se(e);if(i===n||!s)return;n=i;const a=s.peek(i);if(a){Kp(e,a.element);return}s.get(i)},o=t.subscribe(r);e.getInstance(W)?.addDispose(o)}var eh=200;function th({startVersion:e,limit:t=eh}){let n=[],r=e;const o=i=>{n=n.filter(s=>s.version>i),r=Math.max(r,i)};return{record(i){!i.changes?.length&&!i.contentReplaced||(n.push(i),n.length>t&&o(n[n.length-t-1].version))},rebase(i,s){if(s<r)return null;const a=n.filter(c=>c.version>s);o(s);let l=i;for(const c of a){if(c.contentReplaced||!c.changes)return null;const d=c.changes,g=[];for(const h of l){if(c.fromCanvas&&d.some(I=>h.range.start<=I.oldEnd&&h.range.end>=I.oldPosition))return null;const y=Ad(h.range,d,"after");if(!y)return null;g.push({range:y,text:h.text})}l=g}return l}}}function nh(e,t){let n=0;return e.map(({start:r,end:o,text:i})=>{const s=new Ie(r,t.slice(r,o),r+n,i);return n+=i.length-(o-r),s})}function rh(e,t){const n=[...e].sort((r,o)=>r.range.start-o.range.start);return nh(n.map(({range:r,text:o})=>({start:r.start,end:r.end,text:o})),t)}function oh(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var ih=32;function sh(e=ih){const t=new Map;return{find(n,r){const o=t.get(n);return o?.generation===r?o.echo:void 0},remember(n,r,o){t.delete(n),t.set(n,{generation:r,echo:o}),t.size>e&&t.delete(t.keys().next().value)}}}var vo=V("canvas.sandboxFill");function Ma(e){return e.getInstance(vo)?.pipeline.isEventsLocked()===!0}function Et(e){xt(e,{origin:"canvas-channel"})}function ah(e){const t=ce(e),n=ae(e);let r;const o=(l,c)=>{const d=l.get().docId;let g=!1,h=null,y=null;const I=th({startVersion:l.get().version});let w=l.getContent();const b=sh();let R=!0;const A=(m,f)=>{!R||t.current()!==l||(xt(f,{origin:"canvas-channel"}),n.sendAsync(K.SANDBOX_SET_ENTITY,gn(mn(l),d,$e(e).editorPolicy,l.get().version)).catch(Et))},L=async(m,f)=>{if(y){y.push({edits:m,rev:f});return}y=[{edits:m,rev:f}];try{do{const u=y.splice(0,y.length);await n.sendAsync(K.SANDBOX_UPDATE_ENTITY,{edits:u.map(p=>p.edits),guid:d,rev:u[u.length-1].rev})}while(y.length)}catch(u){A("app edits failed to reach the canvas",u)}finally{y=null}},P=(m,f)=>{const u=y?.splice(0,y.length)??[];u.length&&n.sendAsync(K.SANDBOX_UPDATE_ENTITY,{edits:u.map(D=>D.edits),guid:d,rev:u[u.length-1].rev}).catch(Et);const p={edits:[m],guid:d,rev:l.get().version,...f!==null?{changeId:f}:{}};f!==null&&b.remember(f,be(n),p),n.sendAsync(K.SANDBOX_UPDATE_ENTITY,p).catch(Et)},O=m=>{const{guid:f,pushUndoStop:u}=m;if(f!==d)return;const p=Bd(m),D=p.changeId!==null?b.find(p.changeId,be(n)):void 0;if(D){n.sendAsync(K.SANDBOX_UPDATE_ENTITY,D).catch(Et);return}let{edits:x}=m;if(p.baseRev!==null){const S=I.rebase(x,p.baseRev);if(!S){xt(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),P([],p.changeId);return}x=S}const E=l.get().version;try{g=!0,h=p.changeId;const S=rh(x,l.getContent());u===!1?c.applyWithoutHistory(S):l.mutate({changes:S},{source:Ma(e)?"system":"user"})}catch(S){A("canvas batch failed to apply",S);return}finally{g=!1,h=null}l.get().version===E&&p.baseRev!==null&&P([],p.changeId)},_=l.subscribe(({changes:m,version:f})=>{const u=l.getContent(),p=!m?.length&&u!==w;if(w=u,I.record({version:f,changes:m,contentReplaced:p,fromCanvas:g}),!m?.length)return;const D=oh(m);g?P(D,h):L(D,f).catch(Et)}),C=n.addListener(K.APPLICATION_UPDATE_ENTITY,O),T=n.addListener(K.APPLICATION_SYNC_DRIFT,m=>{m.reason==="echo-timeout"&&A("canvas lost the echo of its batch",new Error(`canvas echo timeout, ${m.unsent??0} edits unsent`))});return()=>{R=!1,_(),C.dispose(),T.dispose()}};let i;const s=()=>{const l=t.current(),c=t.history(),d=l?.get().docId;d!==i&&(r?.(),r=void 0,i=d,l&&c&&(r=o(l,c)))},a=t.subscribe(s);s(),e.getInstance(W)?.addDispose(()=>{r?.(),a()})}function lh(e){const t=ae(e),n=()=>se(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(K.RELOAD,()=>{n()?.followReload()}),o=t.addOffTargetListener(K.RELOAD,a=>{const l=se(e)?.byWindow(a);l&&ka(e,l.element)}),i=t.addListener(a=>{a.data?.operation===K.SANDBOX_RESIZED&&n()?.resize()}),s=J(e,H.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(W)?.addDispose(()=>{r.dispose(),o.dispose(),i.dispose(),s.dispose()})}function si(){const e=document.createElement("div");return e.dataset.canvasOffscreen="true",e.style.position="absolute",e.style.left="-10000px",e.style.top="-10000px",e.style.width="1600px",e.style.height="1000px",document.body.appendChild(e),e}function ch(e){const t=e.getInstance(pe);let n,r;e.getInstance(W)?.addDispose(()=>{r?.remove(),r=void 0}),zp(e,{resolveMount:()=>n,resolveSrc:i=>ga(i==="block"),elementId:"email_iframe",mark:i=>ne(i)}),t?.watch(i=>{const s=i?.element;if(n&&s instanceof HTMLElement&&s!==n){n=s,se(e)?.remount(s),r?.remove(),r=void 0;return}if(!n){if(s instanceof HTMLElement)n=s;else if(i!==void 0){n=r??=si(),se(e)?.alignSurface("email",r,r);return}else return;se(e)?.get("email")}});let o;e.getInstance(W)?.addDispose(()=>{o?.remove(),o=void 0}),Wu(e).watch(i=>{const s=se(e);if(s){if(i){o??=si(),s.alignSurface("email",o,o);return}o&&(s.alignSurface("email",null),o.remove(),o=void 0)}})}var bo=V("canvas.headerFlow"),ai=["subject","preheader"],li=3e3,dh=3,uh={subject:K.SANDBOX_SUBJECT_UPDATE,preheader:K.SANDBOX_PREHEADER_UPDATE};function fh(e){const t=ce(e),n=ae(e),r=O=>O?"remote":Ma(e)?"system":"user",o=(O,{guid:_,value:C,forced:T})=>{const m=lt(t);if(!m||typeof C!="string"||_&&_!==m.get().docId)return;const f=t.forcedHeaders();if(f?.[O]!==void 0&&!T&&C!==f[O])return;const u=m.get().attributes[O];if(!T&&y(O,C,u))return;const p=!T&&g.delete(O);T&&(b.delete(O),b.size===0&&t.endForcedHeaders()),l=!0;try{ht(m,{[O]:C},{source:p?"system":r(T)})}finally{l=!1}i[O]=C};let i={},s,a,l=!1,c=Promise.resolve();const d={},g=new Map,h=(O,_)=>{i[O]=_;const C={};g.set(O,C);const T=()=>{g.get(O)===C&&g.delete(O)};I(O,_,{force:!0}).then(T),setTimeout(T,li)},y=(O,_,C)=>{const T=t.showFill();if(!T||typeof C!="string")return!1;const m=d[O]?.showId===T.showId?d[O]:void 0;return _===C?(d[O]=m??{showId:T.showId,codeEdits:T.codeEdits,corrections:0},!1):m&&T.codeEdits>m.codeEdits&&_!==m.stale?!1:((!m||_===m.stale&&m.corrections<dh)&&(d[O]={showId:T.showId,stale:_,codeEdits:T.codeEdits,corrections:(m?.corrections??0)+1},h(O,C)),!0)},I=(O,_,{force:C=!1,echo:T=!1,undoStep:m=!1})=>(c=n.sendAsync(uh[O],{value:_,guid:lt(t)?.get().docId,...C?{force:!0}:{},...T?{echo:!0}:{},...m?{undoStep:!0}:{}}).catch(f=>{}),c);let w;const b=new Set;e.inject(bo,{whenDelivered:async()=>{await c},reassert:O=>{const _=lt(t),C=ai.filter(T=>typeof O[T]=="string");if(!(!_||C.length===0)){l=!0;try{ht(_,Object.fromEntries(C.map(T=>[T,O[T]])),{source:"system"})}finally{l=!1}t.beginForcedHeaders(Object.fromEntries(C.map(T=>[T,O[T]]))),clearTimeout(w),w=setTimeout(()=>{b.clear(),t.endForcedHeaders()},li),b.clear();for(const T of C)b.add(T);for(const T of C)i[T]=O[T],I(T,O[T],{force:!0,echo:!0})}}});const R=()=>{s?.(),s=void 0;const O=lt(t);if(O!==a&&g.clear(),a=O,!O){i={};return}const _=O.get().attributes;i={subject:_.subject,preheader:_.preheader},s=O.subscribe(({source:C})=>{if(l)return;const T=O.get().attributes,m=t.forcedHeaders();for(const f of ai){const u=T[f];if(u===i[f])continue;i[f]=u,g.delete(f);const p=C==="system"&&m?.[f]!==void 0;I(f,u??"",{force:p,echo:p,undoStep:C==="user"})}})};R();const A=t.subscribe(R),L=n.addListenerAsync(K.APPLICATION_SUBJECT_UPDATE,O=>o("subject",O)),P=n.addListenerAsync(K.APPLICATION_PREHEADER_UPDATE,O=>o("preheader",O));e.getInstance(W)?.addDispose(()=>{L.dispose(),P.dispose(),A(),s?.(),clearTimeout(w)})}function ph(e){const t=ce(e);let n={document:void 0,seq:0};const r=()=>{const i=t.recoveryFacts(),s=lt(t);if(!i?.applied||!s||String(i.emailId)!==String(s.get().serverId)||(n.document!==s&&(n={document:s,seq:0}),i.applied.seq<=n.seq))return;n={document:s,seq:i.applied.seq};const a=t.shownHeaders();(a.subject!==void 0||a.preheader!==void 0)&&e.getInstance(bo)?.reassert(a)},o=t.subscribe(r);e.getInstance(W)?.addDispose(o)}function hh(e,t){return(e&&e!=="system"?e:t?"dark":"light")==="dark"?Cc:fc}function mh(e,t){return{copyPasteEnabled:e.copyPasteEnabled,saveBlockEnabled:t?!1:e.saveBlockEnabled,editImageControlEnabled:e.editImageControlEnabled,elementAIimageEnabled:e.elementAIimageEnabled,imageCenterStockEnabled:e.imageCenterStockEnabled,imageCenterGifEnabled:e.imageCenterGifEnabled,imageCenterEditorEnabled:e.imageCenterEditorEnabled,blocksAddPanelEnabled:e.blocksAddPanelEnabled!==!1&&e.blocksSectionsShow!==!1}}function gh(e){return e.isCodeMode&&(e.direction==="left"||e.direction==="right")}function ci(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Cr(e,t){const n={...e};for(const r of Object.keys(t)){const o=t[r],i=e[r];ci(o)&&ci(i)?n[r]=Cr(i,o):o!==void 0&&(n[r]=o)}return n}function vh(e,t){const n=Jr;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const o=JSON.parse(r);if(o&&typeof o=="object"&&!Array.isArray(o)&&Object.keys(o).length>0)return Cr(n,o)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?Cr(n,t):n}var bh=ge(void 0),di=bh,La=V("CodeMode");function Na(){let e;try{const t=window.localStorage?.getItem(Yr.em_code_mode_settings);e=t?JSON.parse(t):void 0}catch{e=void 0}return{isCodeMode:!!(e?.isCodeMode||e?.isCodeMode===void 0),direction:e?.codeModeDirection||"left"}}function yh(e){try{window.localStorage?.setItem(Yr.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function yo(e){return e.getOrCreateInstance(La,()=>{const t=ge(Na());return t.watch(yh),t})}function Fa(e){return e?.getInstance(La)?.get()??Na()}function Tr(e,t){const n=yo(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function Eh(e,t){const n=yo(e);n.set({...n.get(),direction:t})}var _h=V("DefaultCommonStyles");function Ba(e){return e.getOrCreateInstance(_h,()=>ge(void 0))}function wh(e,t){Ba(e).set(t)}var Sh=V("CanvasViewport"),Ih=V("CanvasPreviewPage");function Fe(e,t,n){let r,o;const i=()=>{if(!r||!e.isInited())return;const l=r.value===void 0?"undefined":JSON.stringify(r.value);l!==o&&(o=l,e.send(t,r.value))},s=n.watch(l=>{r={value:l},i()}),a=e.onInit(()=>{o=void 0,i()});return{dispose(){s.dispose(),a.dispose()}}}function Qt(e){const t=ge(e());return{source:t,refresh:()=>t.set(e())}}function Ch(e){const t=ae(e),n=e.getInstance(fe),r=e.getInstance(pe),o=ce(e),i=yo(e),s=matchMedia(pc),a=()=>n?.get()??{};let l;const c=Qt(()=>hh(di.get()??a().theme,s.matches)),d=Qt(()=>mh(a(),te(o.sessionKey()))),g=Qt(()=>a().lockEditor),h=Qt(()=>vh(o.current()?.get().attributes?.common_styles,l)),y=e.getOrCreateInstance(Sh,()=>ge()),I=e.getOrCreateInstance(Ih,()=>ge()),w=[Fe(t,Ne.theme,c.source),Fe(t,Ne.flags,d.source),Fe(t,Ne.lockEditor,g.source),Fe(t,Ne.commonStyles,h.source),Fe(t,Ne.codeMode,i.select(gh)),Fe(t,Ne.appName,ge("emailmaker")),Fe(t,Ne.previewPage,I),Fe(t,Ne.viewport,y)],b=()=>{c.refresh(),d.refresh(),g.refresh()},R=n?.watch(b),A=Ba(e).watch(m=>{l=m,h.refresh()}),L=r?.watch(m=>{m&&"commonStyles"in m&&(l=m.commonStyles),h.refresh()});let P;const O=()=>{P?.(),P=o.current()?.subscribe(()=>h.refresh()),h.refresh(),d.refresh()};O();const _=o.subscribe(O),C=()=>c.refresh();s.addEventListener("change",C);const T=di.watch(()=>c.refresh());e.getInstance(W)?.addDispose(()=>{w.forEach(m=>m.dispose()),R?.dispose(),A.dispose(),L?.dispose(),P?.(),_(),s.removeEventListener("change",C),T.dispose()})}var Ar;(function(e){function t(o,i,s=(a,l)=>a===l){if(o===i)return!0;if(o.length!==i.length)return!1;for(let a=0;a<o.length;a++)if(!s(o[a],i[a]))return!1;return!0}e.isEqual=t;function n(o,i=s=>s){const s=new Set;return o.filter(a=>{const l=i(a);return s.has(l)?!1:(s.add(l),!0)})}e.unique=n;function r(o=[],i=[],s=(a,l)=>a===l){const a=[],l=[],c=[];for(const d of o){const g=i.find(h=>s(d,h));g?c.push({prev:d,next:g}):l.push(d)}for(const d of i)o.find(g=>s(d,g))||a.push(d);return{added:a,removed:l,exists:c}}e.diff=r})(Ar||(Ar={}));function Th(e,t){return e.type===t.type&&e.key===t.key}function Ah(e){const t=ae(e),n=()=>e.getServices(st)??[];let r=[];const o=t.onInit(()=>{r=n(),t.send(K.SANDBOX_ADD_EXTENSIONS,r)}),i=Pc(st),s=e.onInject(a=>{if(a!==i)return;const l=n();if(!t.isInited()){r=l;return}const{added:c,removed:d}=Ar.diff(r,l,Th);if(r=l,d.length){if(d.some(g=>g.type==="script")){t.send(K.RELOAD);return}t.send(K.SANDBOX_REMOVE_EXTENSIONS,d.map(g=>g.key))}c.length&&t.send(K.SANDBOX_ADD_EXTENSIONS,c)});e.getInstance(W)?.addDispose(()=>{o.dispose(),s?.dispose()})}var Rh=new Set([...Object.values(K).map(e=>String(e)),"INIT_MESSAGE","FETCH_USER","USER_LOGGED_IN",String(zr)]);function Ph(e){return e.length>0&&!e.startsWith("em:")&&!Rh.has(e)}function Dh(e){const t=ae(e),n=new Map;let r=!1,o=-1,i=new Set;const s=c=>(c!==o&&(o=c,i=new Set),i),a=t.observeOutgoing((c,d)=>{if(!r||!Ph(c))return;const g=be(t);n.set(c,{data:d,generation:g,scripts:new Set(s(g))})}),l=t.addListener(zr,c=>{if(c.phase!=="ready"||c.status!=="success")return;r=!0;const d=be(t),g=s(d);g.add(c.key);for(const[h,y]of n)y.generation===d||![...y.scripts].every(I=>g.has(I))||(y.generation=d,t.send(ys(h),y.data))});e.getInstance(W)?.addDispose(()=>{a.dispose(),l.dispose()})}var Oh=V("prewarm.editorVisible");function kh(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function xh(e={}){const t=e.paint??kh;let n=!1,r=!1,o=!1,i=!1,s=!1;const a=[],l=()=>{s||i||!n||!r||!o||(i=!0,t(()=>{s=!0,ne(de.editorVisible);for(const c of a.splice(0))c()}))};return{noteShellVisible(){n=!0,l()},notePagePainted(){r=!0,l()},noteContentShown(){o=!0,l()},whenVisible(c){if(s){c();return}a.push(c)},contentShown:()=>o}}function Mh(e){return e.getOrCreateInstance(Oh,()=>xh())}var Lh=500,Nh=500,Fh=5e3;function Bh(e){const t=e.quietMs??Lh,n=e.floorMs??Nh,r=e.ceilingMs??Fh;let o,i,s=0;const a=()=>{clearTimeout(o),clearTimeout(i),o=void 0,i=void 0},l=()=>{a(),e.run()},c=()=>{clearTimeout(o);const d=n-(Date.now()-s);o=setTimeout(l,Math.max(t,d))};return{start(){a(),s=Date.now(),i=setTimeout(l,r),c()},notify(){o!==void 0&&c()},cancel:a}}var jh=2;function ui(){return new Error("[sandbox] document reloaded during fill")}function Uh(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function Wn(e){try{e()}catch{}}function Hh(e){let t;return Wn(()=>{t=e()}),{stage:n=>Wn(()=>t?.stage(n)),end:(n,r)=>Wn(()=>t?.end(n,r))}}function $h(e){const t=()=>e.initPipeline();let n=!1,r,o,i,s=0,a,l;const c=()=>{const _=e.readTarget?.(),C=e.readSandboxGeneration?.();return _===void 0||C===void 0?void 0:{target:_,generation:C}},d=()=>{const _=c();return _&&{..._,canvasReplaced:e.trackDocument?.(_.target)}},g=_=>{if(_?.canvasReplaced?.())return!0;const C=c();return _!==void 0&&C?.target===_.target&&C.generation!==_.generation},y=up({...e,waitScope:()=>({getSandboxTimeoutMs:_=>t().getSandboxTimeoutMs(_),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal}),frameWatch:()=>{const _=l;if(!(!_||!e.onSandboxGenerationChange))return{getGeneration:()=>c()?.generation??_.generation,onChange:C=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===_.target||_.canvasReplaced?.())&&C()})??(()=>{})}}});let I;const w=(_,C)=>{if(I===_)return;I=_;const T=s;setTimeout(()=>{s!==T||t().signal.aborted||L(_,C).catch(()=>{})},0)},b=()=>{a?.abort(),a=void 0};let R;const A=()=>{const _=t().signal;_!==R&&(R?.removeEventListener("abort",b),R=_,_.addEventListener("abort",b))};async function L(_,C,T=0){const m=++s;b(),a=new AbortController,l=void 0,A();const f=()=>s!==m,u=y.readTarget(),p=t().generation,D=()=>p===t().generation&&!t().signal.aborted,x=C?"init:reset-":"init:",E=Hh(()=>e.observeShow?.(Uh(_,C,e.readEmail())));if(!C){const z=y.publicEmail();z?.id,z?.renderGuid,z?.preheader}let S=!1,N=!1,$,v=!1;const k=()=>{if(g($))throw ui()},j=()=>{if(f())throw ve("Fill superseded")};try{n=!0,await y.sendInitStart(),j(),$=d(),l=$,T===0&&y.fireWillInit(),await(C||T>0?y.refreshContent():y.sendContent()),S=!0,j(),k();const z=y.contentSent();y.noteFilled(z?.target,z?.docId),E.stage("content"),C||y.publicEmail()?.id;try{await y.sendPreheader()}catch(G){if(ti(G)||f())throw G;`${x}`,String(G)}j();try{await y.sendSubject()}catch(G){if(ti(G)||f())throw G;`${x}`,String(G)}if(j(),k(),y.showFilled(u),await y.sendInited(),j(),k(),N=!0,o===_){const G=e.readSandboxGeneration?.()??i;G!==void 0&&(r=G)}E.stage("reveal"),await y.revealFilled(),k(),E.end("revealed")}catch(z){const G=!f()&&D()&&g($),F=G?ui():void 0,B=F??z,U=G&&T<jh?O(_,C,T+1):void 0;v=G&&U===void 0;const Y=f()?void 0:{showId:_,contentApplied:S,sandboxInitedAcked:N,superseded:!1,...e.describeSurface?.(),error:String(F??z)};Y&&(`${x}`,void 0);const Z=!f()&&e.recoverFailedFill?.(u)===!0;if(E.end(f()?"superseded":Z?"recovered":Kr(B)||!D()?"aborted":"failed",Y),!Z&&!f()&&mo(t(),_)&&t().failShow(_,B),U!==void 0)return U;throw B}finally{P(_,C,x,{superseded:f(),sessionGeneration:p,contentApplied:S,sandboxInitedAcked:N&&!v,retry:!v,commit:D()})}}function P(_,C,T,m){const{superseded:f,contentApplied:u,sandboxInitedAcked:p}=m;if(f){`${T}`;return}p&&m.commit?y.fireInit(_,C||void 0):p?(`${T}`,m.sessionGeneration,t().generation,t().signal.aborted,void 0):u?(`${T}`,void 0):(`${T}`,void 0),n=!1,a=void 0,!p&&o===_&&(o=void 0,r===i&&(r=void 0)),!p&&u&&m.retry&&w(_,C)}function O(_,C,T){return L(_,C,T)}return{channel:y,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:_=>{r=_},lastCorrelation:()=>o,markCorrelation:_=>{o=_},bumpRunSeq:()=>{s+=1},noteSandboxGeneration:_=>{i=_},fill:_=>L(_,!1),refill:_=>L(_,!0),stop:()=>{s+=1,b(),n=!1,R?.removeEventListener("abort",b),R=void 0}}}function qh(e,t,n){if(!e?.renderGuid||!e.showId||e.showId!==t.showId)return!1;if(t.isNew)return e.id==null;const r=t.emailId??t.navId;return r!=null&&String(e.id??"")!==String(r)?!1:ja(e,n)}function ja(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Vh(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:o,readSandboxGeneration:i}=e,s=d=>{const g=n(),h=o();if(!qh(g,d,h)){d.showId,d.navId,d.emailId,g?.id,g?.showId,g?.renderGuid;return}d.showId,g?.id,g?.renderGuid,t.markFilled(i()),t.markCorrelation(d.showId),t.fill(d.showId).catch(()=>{})};return{showRequested:d=>{s(d)},showRequestIdentityChanged:()=>{const d=e.initPipeline().getActiveShowRequest();d&&s(d)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const d=i();if(t.filledGeneration()===d)return;const g=n(),h=o();if(!g?.renderGuid||!ja(g,h))return;const y=`${wa}${g.renderGuid}`;t.markFilled(d),t.markCorrelation(y);const I=r()?.isReady()===!0;g.id,g.renderGuid,(I?w=>t.refill(w):w=>t.fill(w))(y).catch(()=>{t.lastCorrelation()===y&&t.markFilled(void 0)})},saasChanged:()=>{const d=n();d?.renderGuid,d?.showToken,d?.id,r()}}}var Gh=V("canvas.health");function zh(e){return e??""}function Wh(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function fi(e){return e.length>0}function Kh(e){const t=ce(e),n=ae(e),r=()=>te(t.sessionKey())?void 0:t.current(),o=()=>{const M=r();return xa({attributes:M?.get().attributes??{},readContent:()=>M?.getContent(),docId:M?.get().docId,hasSession:!!M,serverId:M?.get().serverId,show:t.showFacts()})},i=()=>e.getInstance(De)??go;let s={},a=!1;const l=e.getInstance(pe)?.watch(M=>{a=!!M?.element});let c=!1,d=!1,g=!1,h=0;const y=()=>{const M=se(e);if(!M)return;const Q=++h,X=M.spare();return X&&ka(e,X.element),(X?X.reloadQuietly():M.ensureSpare()?.ready())?.then(()=>{if(Q!==h)return;c=!0;const he=M.spare();he&&Yp(e,he.element),g&&(g=!1,p(),G())})},I=Bh({run:()=>{g||y()?.catch(()=>{})}}),w=()=>{Mh(e).noteContentShown(),!c&&!g&&I.start()};let b=!1;const R=M=>{const Q=se(e),X=Q?.spare()?.element.contentWindow;d&&Q&&X&&M===X&&(d=!1,Q.promote(),Q.busy(!1),b=!0)};let A=!1;const O=$h({container:e,messageService:n,initPipeline:i,readDocument:r,readEmail:o,revealFilled:()=>{const M=se(e);return b&&M&&(b=!1,I.start()),a?M?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:R,noteFilled:(M,Q)=>se(e)?.noteFilled(M,Q),recoverFailedFill:M=>{const Q=se(e),X=Q?.spare()?.element.contentWindow;return!d||!Q||!X||M!==X?!1:(d=!1,c=!1,f="reload",Q.busy(!1),Q.peek("email")?.reload(),A=!0,G(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!s.isTemplate,readSandboxGeneration:()=>be(n),onSandboxGenerationChange:M=>fn(n,M),trackDocument:M=>Xp(e,M),observeShow:M=>e.getInstance(Gh)?.begin(M),describeSurface:()=>({canvasPath:f,promoted:d,spareClean:c,handshake:n.isInited(),generation:be(n)}),events:{willInit:M=>{le(e,H.WILL_EMAIL_INIT_ID).fire(M)},inited:M=>{w(),le(e,H.ON_EMAIL_INIT_ID).fire(M)},contentChanged:M=>{le(e,H.ON_CONTENT_CHANGED_ID).fire(M)},emailChanged:M=>{le(e,H.ON_EMAIL_CHANGED_ID).fire(M)},browserExtensionDetected:()=>{le(e,H.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),_=Vh({pipeline:O,initPipeline:i,readEmail:o,readDocument:r,readRouteEmailId:()=>s.emailId,readSandboxGeneration:()=>be(n)});let C="",T="",m="",f="none";const u=()=>{const M=se(e)?.spare()?.element.contentWindow;M&&n.getTarget()===M||n.sendNow({operation:K.SANDBOX_LOCK_EDIT,data:!0})},p=()=>{const M=se(e)?.spare();M&&(u(),c=!1,d=!0,Wp(e,M.element))},D=(M,Q)=>{const X=se(e);if(!X)return!0;const he=X.spare(),oe=he&&c?"spare":"prepare";if(f=oe,X.busy(!0),he&&c)return p(),!0;I.cancel(),u();const Ve=y();if(Ve===void 0)return f="reload",X.busy(!1),X.peek("email")?.reload(),!0;g=!0;const Le=h;return Ve.catch(()=>{!g||Le!==h||(g=!1,f="reload",X.busy(!1),X.peek("email")?.reload())}),!1},x=()=>{if(te(t.sessionKey()))return;xe(),O.noteSandboxGeneration(be(n));const M=o(),Q=Wh(M?.renderGuid,M?.showId,M?.id,s.emailId),X=zh(M?.renderGuid);if(X!==T){const Ve=T;T=X;const Le=se(e)?.peek("email")?.filled,Ul=Le!==void 0&&Le!==X;fi(X)&&(fi(Ve)||Ul)&&D(Ve||(Le??""),X)}if(g)return;(Q!==C||A)&&(A=!1,C=Q,_.showRequestIdentityChanged());const he=r(),oe=`${Q}|${he?.get().docId??""}|${be(n)}`;oe!==m&&he?.isReady()===!0&&(m=oe,_.selfInitChanged()),_.saasChanged(),j()};let E=!1,S="",N="",$=!1,v=!1;const k=M=>{M.source==="user"?v=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&($=!0),G()},j=()=>{const M=o();if(!M?.renderGuid)return;const Q=O.channel.readContent(),X=JSON.stringify([M.preheader,M.common_styles,M.meta,M.subject,M.utm_parameters?.utm_campaign??"",M.utm_parameters?.utm_content??"",M.utm_parameters?.utm_medium??"",M.utm_parameters?.utm_source??"",M.utm_parameters?.utm_term??""]),he=E&&Q!==N,oe=E&&X!==S;E=!0,N=Q,S=X;const Ve=$&&!v;if($=!1,v=!1,O.isEventsLocked()||Ve)return;const Le={...M,id:s.isTemplate||M.isNew?void 0:M.id,html:Q};if(he){le(e,H.ON_CONTENT_CHANGED_ID).fire(Q),le(e,H.ON_EMAIL_CHANGED_ID).fire(Le);return}oe&&M.is_inited&&le(e,H.ON_EMAIL_CHANGED_ID).fire(Le)};let z=!1;const G=()=>{z||(z=!0,queueMicrotask(()=>{z=!1,x()}))};e.inject(vo,{pipeline:O,setRoute:M=>{M.emailId===s.emailId&&!!M.isTemplate==!!s.isTemplate||(s=M,G())}});let F,B;const U=()=>{const M=r()?.get().docId;M!==B&&(F?.(),B=M,F=r()?.subscribe(k)),G()};let Y,Z;const xe=()=>{const M=e.getInstance(De);!M||M===Y||(Z?.(),Y=M,Z=M.onShowRequested(Q=>_.showRequested(Q)))},Te=n.addListener(M=>{M.data?.operation===K.SANDBOX_RESIZED&&I.notify()}),qe=t.subscribe(U),Me=fn(n,G);U(),e.getInstance(W)?.addDispose(()=>{l?.dispose(),Z?.(),Me(),qe(),F?.(),Te.dispose(),I.cancel(),O.stop()})}function Yh(){return lc!=="emailmaker"}var Xh={config:{mode:"freeUserBlocks",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",saveHotkeyEnabled:!0,commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formButtonFieldReplacerEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!1,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},Ua={config:{mode:"pro",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",saveHotkeyEnabled:!0,commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!0,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0,enableCopyFile:!0}},project:void 0,page:{isNew:!0,type:"email",project:0,id:"",showToken:0}},pi=Ua,Jh=["pro"],Rr={};function Qh(e){Rr=e}var Ha=e=>Jh.includes(e)?pi:Rr[e]??Rr.editor??pi,Pr={config:{mode:"simple",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!1,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",saveHotkeyEnabled:!0,commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!1,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0}},project:void 0},Zh={config:{mode:"editor",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!1,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!1,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!1,emailDropdownMenuClone:!0,emailDropdownMenuImport:!1,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportTextEnabled:!1,exportMarkdownEnabled:!1,exportZipEnabled:!0,exportClipboardEnabled:!1,exportWebHookEnabled:!1,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",saveHotkeyEnabled:!0,commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!1,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!1,aiAssistentEnabled:!1,optimizeEnabled:!1,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!1,tagsEnabled:!0,isTemplateEnabled:!1,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!1,deleteButtonEnabled:!0,toggleSidePanel:!1,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!1,formFieldImageTitleEnabled:!1,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!1,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!1,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!1,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!1,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},em={...Pr,config:{...Pr.config,imageCenterFileManagerView:!1}};Qh({pro:Ua,editor:Zh,simple:Yh()?Pr:em,blocks:Xh});function tm(e,t,n=e.getInstance(fe)){n?.setMode(t),n?.get()?.codeEnabled===!1&&Fa(e).isCodeMode&&Tr(e,!1)}function nm(e){e.getInstance(_c)||e.inject(Oe,void 0)}function kn(e){return String(e.standaloneKey||"").trim()||void 0}function rm(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function Eo(e){return rm(e)?!!kn(e):!1}function Ht(e){return!!kn(e)&&!Eo(e)}var om=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function hi(e){return e==="server"?"serverSide":e}function im({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},o=ge();let i={kind:"pending"},s;const a=new Promise(h=>{s=h}),l=n===void 0?void 0:setTimeout(()=>{d({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function c(){i.kind!=="pending"&&o.set(Gn(r,e))}function d(h){if(i.kind!=="pending")return;clearTimeout(l),i=h;const y=Gn(r,e);o.set(y),s(y)}function g(h,y){r[hi(h)]=y,h==="server"&&i.kind==="pending"?d({kind:"applied"}):c()}return{watch:h=>o.watch(h),select:h=>o.select(h),get:()=>o.get(),ready:()=>a,state:()=>i,layers:()=>({...r}),bootstrap(){const h=Gn(r,e);return Object.fromEntries(om.map(y=>[y,h[y]]))},merge(h,y){g(y,{...r[hi(y)],...h})},replace(h,y){g(y,h)},setMode(h){r.user={...r.user,mode:h},c()},setAdvancedConfigs(h){r.advancedConfigs=h,c()},serverAbsent(h){d({kind:"absent",reason:h})},applyServerResponse(h){i.kind==="pending"&&g("server",{...r.serverSide,...h})},dispose(){clearTimeout(l)}}}var sm=5e3;function am(){return{...Ha("pro")?.config,mergeTags:void 0}}function lm(e,t){e.getInstance(pe)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs});const r=n.config??{},o=t.layers().user.mode;t.replace(r.mode===void 0&&o!==void 0?{...r,mode:o}:r,"user")})}function cm(e,t){let n;uo(e).watch(({profile:r})=>{const o=`${r?.theme??""}|${r?.locale??""}`;if(o===n)return;n=o;const i={};r?.theme&&(i.theme=r.theme),r?.locale&&(i.locale=r.locale),t.replace(i,"profile")})}function dm(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function um(e,t){let n,r=!1,o;const i=a=>{o??=Pn(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&tm(e,a,t)},s=uo(e).watch(({profile:a})=>{const l=a?.email_builder_config,c=dm(l);if(c===void 0||l===n)return;const d=n===void 0;n=l,!(d&&r)&&i(c)});e.getInstance(W)?.addDisposable(s),t.ready().then(a=>{if(!a.configSwither)return;const l=localStorage.getItem("configSwither")||(n===void 0?a.mode:o)||"editor";localStorage.setItem("configSwither",l),r=n===void 0,i(l)})}var mi="замкнутый контур: app_init не выполняется";function fm(e,t){if(e.getInstance(Oe)){t.serverAbsent(mi);return}const n=e.getInstance(pe)?.watch(r=>{Ht(r)&&t.serverAbsent(mi)});n&&e.getInstance(W)?.addDisposable(n)}async function pm(e,t){if(e.getInstance(to)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(Ue);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function hm(e){e.injectFactory(fe,(t,n)=>{if(n)return n;const r=im({base:am(),env:{modeDefaults:o=>Ha(o)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:sm});return lm(e,r),cm(e,r),um(e,r),fm(e,r),pm(e,r),e.getInstance(W)?.addDisposable(r),r},!0)}var ut=class extends ue{_event;_listener;_disposeEvent;constructor(e){super(),this._event=e}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),e?this._disposeEvent=this._event(e):this._disposeEvent=void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}};function q(e,t,n){const r=bc(e);return(o,i,s)=>{const a=r(async l=>{const c=t?t(l):l;s&&o.bind(s);const d=await o(c);return n?n(d):d},i,s);return()=>a.dispose()}}var mm=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new mr;this.handleDestroy=q(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new ut(this.handleDestroy));e.lifetime.addDisposable(t),e.lifetime.addDisposable(e.options.watch(({handleDestroy:r})=>n.setListener(r))),e.lifetime.addDispose(()=>e.release())}destroy(){if(!this.deps.lifetime.isDisposed())try{this.deps.lifetime.dispose()}catch{}}},_o=V("DestroyableService");function gm(e){e.injectFactory(_o,(t,n)=>{if(n)return n;const r=e.getInstance(W);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new mm({lifetime:r,options:e.getInstance(pe),getInstance:()=>e.getInstance(In),release:()=>tc(e.getInstance(Tc)??e)})},!0)}function vm(e){const t=e.getInstance(_o);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var bm=1e3;function $a(e,t,n=bm,r=0){if(r>n||e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(typeof e=="object"&&typeof t=="object"){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;for(const s of o)if(!$a(e[s],t[s],n,r+1))return!1;return!0}return!1}function Dt(e,t){if(!e||typeof e!="object")return t;if(!t||typeof t!="object")return{};const n={};for(const r of Object.keys(t)){const o=t[r],i=e[r];$a(o,i)||(n[r]=o)}return n}var ym=({source:e,emailtags:t,group:n,tags:r,...o})=>o;async function Em(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function _m({emails:e,saveTimeoutMs:t},n,r){const o=t?.()??Cn();let i;try{const s=e.notifySave(n);return await Promise.race([s,new Promise((a,l)=>{i=setTimeout(()=>{const c=new Tn(o);n.value.id,$d(c,Em(s,r)),l(c)},o)})])}catch(s){throw $s(s),s}finally{i!==void 0&&clearTimeout(i)}}function wm(e){const{emails:t}=e,n=async(r,o)=>{const i=ym(o),s=r===void 0?void 0:await t.cache.getIfPresent(r),a=s?{...s,...i}:i,l=s?Dt(s,i):i,c=d=>{const g=String(d.id??r??_e()),h=d.id===void 0?{...d,id:g}:d;return t.cache.addOrUpdate(g,()=>h)};return await c(await _m(e,{prev:s,patch:l,value:a,source:o.source??""},c))};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const o=await n(void 0,r);return o?.renderGuid?o:{...o,renderGuid:_e()}},async updateEmail(r,o){return await n(r,o)}}}var Kn=20;function Sm(e){const t=Im(e);return e.saveTimeoutMs?Cm(t,e.saveTimeoutMs):t}function Im({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:o,integratorProject:i}){const s=async(a,l)=>(t.clear(),await t.get(a,{page:l}),(await e.cache.values()??[]).filter(c=>String(c?.parent)===String(a)));return{async readRevisions(a,l=1){const c=await s(a,l);return{revisions:c.slice(Kn*(l-1),Kn*l),page:l,hasMore:c.length>Kn*l}},async readAutosave(a){const l=await r?.(a)??NaN,c=Number.isFinite(l)?l:void 0,d=await n?.(a);if(!d?.asked)return Xd(await s(a,1),c);if(!d.revision)return Go([],c);const g={...d.revision,parent:a,isAutosave:!0};return Go([g],c,await s(a,1))},async saveAutosave(a,l){const c=await o?.(a),d=i?.();return await e.create({...nu(l),...c!==void 0?{author:c}:{},...d!==void 0?{project:d}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function Cm(e,t){return{...e,async saveAutosave(n,r){const o=t();let i;try{return await Promise.race([e.saveAutosave(n,r),new Promise((s,a)=>{i=setTimeout(()=>a(new Ms(o)),o)})])}catch(s){throw $s(s),s}finally{i!==void 0&&clearTimeout(i)}}}}var Tm=class extends Rc{async execute([e],t){for(const n of t){const r=await n(e);r&&(r.id===void 0&&(r.id=e.value.id),e.value=r)}return e.value}},Am=class extends je{};var gi=class extends ue{_items=new Map;_onChangeEmitter=new Wl;async _getOrCreate(e,t){const n=this._items;let r;if(n.has(e))try{r=await n.get(e)}catch{t&&(r=await t())}else t&&(r=await t(),r&&this._onChangeEmitter.fire());return r}async _addOrUpdate(e,t){let n;const r=this._items;if(r.has(e))try{n=await r.get(e)}catch{}const o=await t(n);return Pe(n,o)||this._onChangeEmitter.fire(),o}entries(){return Promise.all([...this._items.entries()].map(([e,t])=>t.then(n=>[e,n]))).then(e=>e.filter(([t,n])=>!!n))}values(){return Promise.all([...this._items.values()].map(e=>e).filter(e=>!!e))}getOrCreate(e,t){const n=this._getOrCreate(e,()=>t(e));return this._items.set(e,n),n}addOrUpdate(e,t){const n=this._addOrUpdate(e,t);return this._items.set(e,n),n}async getIfPresent(e){if(this._items.has(e))try{return await this._items.get(e)}catch{return}}add(e,t){const n=Promise.resolve(t);return this._items.set(e,n),n}remove(e){if(this._items.has(e)){const t=this._items.get(e);return this._items.delete(e),this._onChangeEmitter.fire(),t}return Promise.resolve(void 0)}async setAll(e){try{this.suspendChange();const t=[],n=new Set(Array.from(e).map(([o,i])=>o)),r=(await this.entries()).filter(([o,i])=>!n.has(o));for(const[o,i]of e)t.push(this.addOrUpdate(o,()=>i)),n.add(o);for(const[o]of r)t.push(this.remove(o));return await Promise.all(t),r}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}onChange=this._onChangeEmitter.event};function Rm(e,{filter:t,order:n="asc",orderBy:r,page:o,pageSize:i=20}={}){const s=e.length;let a=e.length;if(t!==void 0){const l=Object.keys(t);e=e.filter(c=>{for(const d of l){const g=c[d],h=t[d];return d==="id"||typeof g!="string"?g===h:typeof h=="string"&&g.startsWith(h)}return!0}),a=e.length}return r&&(e=e.sort((l,c)=>(l[r]>c[r]?1:c[r]>l[r]?-1:0)*(n==="asc"?1:-1))),o!==void 0&&(e=e.slice(i*(o-1),i*o)),{data:e,filteredTotal:a,total:s,totalPages:Math.ceil(a/i)}}function Pm(e=[]){if(e=e.filter(n=>n),e.length<=1)return e[0];const t=new Map;for(const n of e)for(const r of n)if(r.id!==void 0){const o=t.get(r.id)||{};t.set(r.id,{...o,...r})}return[...t].map(([n,r])=>r)}function Dm(e,t){return vi(e)&&vi(t)?String(e)===String(t):e===t}function vi(e){return typeof e=="string"||typeof e=="number"}var Om=class extends ue{_cache=new gi;_readEmitter=new je;_saveEmitter=this.addDisposable(new Tm);_removeEmitter=this.addDisposable(new Am);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(n=>!!n)))}hasReadHandler(){return this._readEmitter.hasListeners()}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new ue);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new gi),o=n.addDisposable(new je);t=this._foreignCache[e]={get:async(i,s={})=>{await r.getOrCreate(i,async()=>{try{const l=Pm(await o.fire(i))||[];for(const c of l)c[e]=i,await this._cache.add(c.id,c);return l}catch{return[]}});const a=(await this._cache.values()||[]).filter(l=>{const c=l[e];return c==null||Dm(c,i)});return Rm(a,s)},first(i,s={}){return t.get(i,{...s,page:1,pageSize:1}).then(({data:a})=>a[0])},handleRead:o.event,clear(){r.clear()},dispose(){n.dispose()}}}return t}async create(e,{source:t="",silent:n}={}){let r=e;return n||(r=await this._saveEmitter.fire({prev:void 0,patch:e,value:r,source:t})),r.id===void 0&&(r.id=_e()),await this._cache.addOrUpdate(r.id,()=>r)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:n="",silent:r}={}){return this._cache.addOrUpdate(e,async o=>{const i=o?{...o,...t}:t;if(!r)return t=o?Dt(o,t):t,await this._saveEmitter.fire({prev:o,patch:t,value:i,source:n})})}async remove(e,{source:t="",silent:n}={}){const r=await this._cache.remove(e);return n||await this._removeEmitter.fire({value:r,source:t}),r}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}handlerRead=this._readEmitter.event;onSave=this._saveEmitter.event;onRemove=this._removeEmitter.event;onChange=this._cache.onChange};function $t(e){const t=V(e);return n=>n.getOrCreateInstance(t,()=>new Om)}function qa(e){const t=e.getInstance(W);if(!t)throw new Error("Failed");return t}function bi(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Zt(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function km(e,t,n){return e&&!bi(t)&&bi(e)?{...n,meta:e.meta}:n}var xm=V("CurrentProject"),Mm={};function qt(e){return e?.getInstance(xm)?.get()??Mm}function wo(e){const t=qt(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var Va=$t("plugin.dataSource.emails"),Ga=$t("plugin.dataSource.emailRevisions"),za=Dn("plugin.readEmailAutosave"),yi=V("emailDocuments.provided");function Lm(e){const t=Va(e),n=Ga(e),r=n.byForeignKey("parent");if(e.getInstance(yi))return{emails:t,emailRevisions:n};e.inject(yi,!0);const o=()=>Cn(e.getInstance(De)?.contentReadyTimeoutMs),i=wm({emails:t,saveTimeoutMs:o}),s=new Map,a=(l,c)=>d=>{const g=d?.id??c;return(typeof g=="string"||typeof g=="number")&&s.set(String(g),l),d};return Ru(e,{...i,createEmail:l=>i.createEmail(l).then(a(Date.now())),updateEmail:(l,c)=>i.updateEmail(l,c).then(a(Date.now(),l))}),ku(e,Sm({revisions:n,revisionsByEmail:r,readAutosave:async l=>{const c=await le(e,za).fire(l);return c.length===0?{asked:!1}:{asked:!0,revision:c[0]??null}},savedAt:async l=>{const c=Kd((await t.cache.getIfPresent(l))?.modified),d=s.get(String(l))??NaN;return Number.isFinite(d)&&!(c>=d)?d:c},emailAuthor:async l=>(await t.cache.getIfPresent(l))?.author,saveTimeoutMs:o,integratorProject:()=>qt(e).requested})),qa(e).addDisposable(t.onSave(({prev:l,patch:c,value:d})=>km(l,c,d),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function Ei(e,t){return!e?.data||!t||e.id!==t.locale?!1:t.contentHash?e.hash===t.contentHash:t.updatedAt>0&&t.updatedAt<=e.time}function Nm(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var Fm="po",en=null;function Bm(){const e=typeof window.__emailmaker__<"u"?window.__emailmaker__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([Fm],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function jm(){return en===null&&(en=Bm().catch(e=>{throw en=null,e})),en}async function Wa(e){if(typeof e=="object")return So(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Um(t):Hm(t)}function So(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Um(e){try{return So(JSON.parse(e))}catch{return}}var _i=!1;async function Hm(e){try{return So((await jm()).parsePoCatalog(e))}catch{_i||(_i=!0);return}}var $m="em_locale",qm="em_ant_locale",Vm="locale",Gm="ant_locale";function Io(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function Ka(e,t){const n=Io(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function zm(){return Io("em_locale")??Ka(Vm,"em_locale")}function wi(e){try{localStorage.setItem($m,JSON.stringify(e))}catch{}}function Wm(){return Io("em_ant_locale")??Ka(Gm,"em_ant_locale")}function Km(e,t){try{localStorage.setItem(qm,JSON.stringify({id:e,data:t}))}catch{}}var Ym=8e3;function Xm(e,t){const n=e,r=t,o=Object.keys(n).filter(i=>i!=="");return o.length!==Object.keys(r).filter(i=>i!=="").length?!1:o.every(i=>JSON.stringify(n[i])===JSON.stringify(r[i]))}function Jm(e){const t=zm(),n=Wm();let r={ready:!1},o;const i=ge(r);let s=0;const a=b=>{r={...r,...b},i.set(r)},l=()=>{r.ready||a({ready:!0})},c=setTimeout(l,e.unlockAfterMs??Ym),d=b=>b!==s;let g;async function h(b,R){if(n?.id===b&&n.data&&a({antd:n.data}),!g)return;const A=await g(b).catch(()=>{});!A||d(R)||(a({antd:A}),Km(b,A))}async function y(b,R){const A=await e.askHost(b).catch(()=>null);if(d(R))return!0;if(A==null)return!1;const L=await Wa(A);return d(R)||(L&&a({catalog:L}),l()),!0}async function I(b,R){const A=await e.readList();if(d(R))return;if("error"in A){a({failure:{kind:"GET_LOCALES_ERROR",error:A.error}}),l();return}const L=A.data.find(O=>O.locale===b);if(!L){Nm("em_locale")&&a({catalog:void 0}),l();return}if(Ei(t,L)&&(!o||o.catalog===t?.data)){l();return}if(o?.entry&&r.catalog===o.catalog&&Ei(o.entry,L)){wi(o.entry),l();return}const P=await e.readCatalog(b);if(!d(R)){if("error"in P){a({failure:{kind:"GET_LOCALE_ERROR",error:P.error}}),l();return}P.data&&(o?.id===b&&r.catalog===o.catalog&&Xm(o.catalog,P.data)||a({catalog:P.data}),wi({id:b,time:L.updatedAt||Math.floor(Date.now()/1e3),hash:L.contentHash,data:P.data})),l()}}async function w(b,R){if(!await y(b,R)){if(!d(R)&&(o?.id===b&&r.catalog===o.catalog||b==="en_US")&&l(),e.canUseNetwork&&!e.canUseNetwork()){l();return}await I(b,R)}}return{set(b){if(!b||b===r.id)return;const R=s+=1;a({id:b,failure:void 0});const A=o?.id===b&&r.catalog===o.catalog;(o&&!A&&r.catalog===o.catalog||b==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===b&&t.data&&(a({catalog:t.data}),l()),h(b,R),w(b,R)},prime(b,R,A){r.id&&r.id!==b||r.catalog||!R||(o=t?.id===b&&t.data&&(!A||t.time>=A.time)?{id:b,catalog:t.data}:{id:b,catalog:R,entry:A?{id:b,time:A.time,hash:A.hash,data:R}:void 0},a({catalog:o.catalog}))},useAntdLoader(b){g=b,r.id&&h(r.id,s)},state:i,snapshot:()=>r,dispose:()=>clearTimeout(c)}}var Qm=class{http;constructor(e){this.http=e}jsonList=({locale:e},t={})=>this.http.request({path:`/translations/${e}.json`,method:"GET",format:"json",...t});getTranslations=({locale:e},t={})=>this.http.request({path:`/translations/${e}.po`,method:"GET",...t});localesList=(e={})=>this.http.request({path:"/translations/locales",method:"GET",format:"json",...e})},Zm=class{baseUrl="/api/v2";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(n=>this.encodeQueryParam(t,n)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(n=>typeof t[n]<"u").map(n=>Array.isArray(t[n])?this.addArrayQueryParam(t,n):this.addQueryParam(t,n)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{const r=e[n];return t.append(n,r instanceof Blob?r:typeof r=="object"&&r!==null?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const n=this.abortControllers.get(e);return n?n.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:o,format:i,baseUrl:s,cancelToken:a,...l})=>{const c=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},d=this.mergeRequestParams(l,c),g=o&&this.toQueryString(o),h=this.contentFormatters[r||"application/json"],y=i||d.format;return this.customFetch(`${s||this.baseUrl||""}${n}${g?`?${g}`:""}`,{...d,headers:{...d.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(a?this.createAbortSignal(a):d.signal)||null,body:typeof e>"u"||e===null?null:h(e)}).then(async I=>{const w=I;w.data=null,w.error=null;const b=y?I.clone():I,R=y?await b[y]().then(A=>(w.ok?w.data=A:w.error=A,w)).catch(A=>(w.error=A,w)):w;return a&&this.abortControllers.delete(a),R})}},eg=V("rest.v2.transport"),Si=Symbol("rest.v2.secureRequest");function tg(e){return e.getOrCreateInstance(eg,()=>{const t=e.getInstance(Kl)?.execute||fetch;return new Zm({baseUrl:"https://app.emailmaker.ru/api/v2",securityWorker:()=>({[Si]:!0}),customFetch:(n,r={})=>{const{[Si]:o,...i}=r;return t(n,{...i,[Xl]:o!==!0})}})})}function ng(e,t){const n=tg(e);return Object.assign({},...t.map(r=>new r(n)))}function Ii(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function Ya(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Ii(n.details,"wp_code")??n.code,message:Ii(n.details,"wp_message")??n.message,details:n.details}}:t&&typeof t=="object"?{status:e.status,data:t}:{status:e.status,data:{message:e.statusText||"request failed"}}}function Xa(e){return!e.ok||!!e.error}function rg(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function Ja(){return rg(Yr.em_translations_v2)??!0}function og(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function ig(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function sg(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],o=r[0];return typeof o=="string"&&o!==""&&t.push({locale:o,updatedAt:og(r[1])}),t},[]):[]}function ag(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:ig(n.updated_at),contentHash:n.content_hash}),t),[])}function Qa(e){return ng(e,[Qm])}function bn(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function Dr(e){return!e.ok||e.error!=null}function Or(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Yn(e){return{data:await Wa(e)??null}}async function lg(e){if(Ja())try{const n=await Qa(e).localesList();return Xa(n)?{error:Ya(n)}:{data:ag(n.data)}}catch(n){return bn(n)}const t=Es(e,[Is]);try{const n=await t.get_translations2({file:"react_app"});return Dr(n)?Or(n):{data:sg(n.data)}}catch(n){return bn(n)}}async function cg(e,t){if(Ja())try{const r=await Qa(e).jsonList({locale:t});return Xa(r)?{error:Ya(r)}:Yn(r.data)}catch(r){return bn(r)}const n=Es(e,[Is]);try{const r=await n.get_translations3({id:t,file:"react_app"});return Dr(r)?Or(r):Yn(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return Dr(r)?Or(r):Yn(r.data)}catch(r){return bn(r)}}}var tn=new WeakMap;function dg(e){const t=tn.get(e);if(t!==void 0)return t;const n=lg(e).then(r=>("error"in r&&tn.delete(e),r),r=>{throw tn.delete(e),r});return tn.set(e,n),n}var gt=V("locale.service");function ug(e){if(e.getInstance(gt))return;const t=Jm({readList:()=>dg(e),readCatalog:n=>cg(e,n),askHost:async n=>(await le(e,H.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(Oe)});e.inject(gt,t),e.getInstance(W)?.addDispose(()=>t.dispose())}function fg(e){const t=e.getInstance(fe);if(!t)return;const n=e.getInstance(gt);if(!n)return;const r=t.select(o=>o.locale).watch(o=>n.set(o||"ru_RU"));e.getInstance(W)?.addDisposable(r)}var pg="user_id",hg="project_id",Ci=V("rest.identityHeadersProvided");function mg(e){if(e.getInstance(Ci))return;e.inject(Ci,!0);let t;e.getInstance(pe)?.watch(n=>{t=n}),e.addService(Sn,{execute(n,r){if(r?.public)return;const o=t?.user?.id??oa(e).profile?.id;o!=null&&o!==""&&n.headers.set(pg,String(o));const i=t?.project;i!=null&&i!==""&&n.headers.set(hg,String(i))}})}function gg(e){const t=e?.[""];return typeof t?.lang=="string"?t.lang:void 0}function vg(e){return e.id??gg(e.catalog)}function bg(e){if(e==="uk"||e.startsWith("uk_"))return"uk";const t=e.search(/[_-]/);return t>0?e.slice(0,t):e}function yg(e){return bg(e||"en_US")}var Eg="Accept-Language",Ti=V("rest.localeHeaderProvided");function _g(e){e.getInstance(Ti)||(e.inject(Ti,!0),e.addService(Sn,{execute(t){const n=e.getInstance(gt)?.snapshot();t.headers.set(Eg,yg(n&&vg(n)))}}))}function wg(e){if(!e)return!1;try{return e.getInstance(Oe)!==void 0}catch{return!1}}var Sg="Invalid standaloneKey.",m_=V("StandaloneMockGuard");function Ig(){const e=new Error(Sg);return e.name="InvalidStandaloneKeyError",e}function Cg(e){e.addService(Sn,{execute:()=>{if(wg(e))throw Ig()}})}function Tg(e){Ac(e),Cg(e)}function Ag(e){const t=new Sa;e.inject(De,t);const n=e.getInstance(pe)?.watch(o=>{if(!o)return;const i=o.signal??t.externalSignal;t.configure({replaceSession:!0,...o.timeouts!==void 0?{timeouts:o.timeouts}:{},...i!==void 0?{signal:i}:{}})}),r=e.getInstance(W);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var Za=$t("plugin.dataSource.blocks"),Rg=$t("plugin.dataSource.blockRevisions"),Pg=$t("plugin.dataSource.comments"),Dg=Dn(),Og=Dn(),el=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1004
+ `));return{html:Op(t.html),hasBrowserExtensionArtifacts:t.found}}function Lt(e){return e?.getContent()??""}function La(e,t){e?.mutate({content:fo(t)},{source:"remote"})}function kn(e){return z(e)}function ue(e,t){return e.getOrCreateInstance(t,()=>new Ue)}function Q(e,t){return e.getOrCreateInstance(t,()=>new Ue).event}function bn(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var kp=class extends Error{label;timeoutMs;constructor(e){super(`[sandbox:ready] iframe handshake timed out after ${e}ms`),this.name="SandboxReadyTimeoutError",this.label="sandbox:ready",this.timeoutMs=e}};function xp(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.isInited=="function"&&typeof t.getTarget=="function"&&typeof t.onInit=="function"}function Mp(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(ne(n),new Promise((r,o)=>{let i=!1,s,a;const l=d=>{i||(i=!0,s!==void 0&&(clearTimeout(s),s=void 0),a?.dispose(),n?.removeEventListener("abort",c),d())},c=()=>{l(()=>o(_e(n?.reason)))};if(a=e.onInit(()=>{e.isInited()&&e.getTarget()&&l(()=>r())}),e.isInited()&&e.getTarget()){l(()=>r());return}t>0&&(s=setTimeout(()=>{l(()=>o(new kp(t)))},t)),n?.addEventListener("abort",c)}))}var Lp=class extends Error{label;timeoutMs;constructor(e,t){super(`[${e}] timed out after ${t}ms`),this.name="OperationTimeoutError",this.label=e,this.timeoutMs=t}};function Np(e,t,n){return t<=0?e:new Promise((r,o)=>{let i=!1,s;const a=l=>{i||(i=!0,s!==void 0&&(clearTimeout(s),s=void 0),l())};s=setTimeout(()=>{a(()=>o(new Lp(n,t)))},t),e.then(l=>{a(()=>r(l))},l=>{a(()=>o(l))})})}var Fp=2,It=Symbol("sandbox:frame-replaced");function ui(e){return e===It}function Ye(e,t,n,r,o,i,s){const a=`sandbox:${t}`,l=i?.getSandboxTimeoutMs(t)??uo[t],c=()=>{let w=Np(e.sendAsync(n,r),l,a);return w=pn(w,i?.signal),Xe(a,w,o)};if(t==="INIT_START"&&xp(e)){const w=i?.getSandboxReadyTimeoutMs()??2e4,_=e,b=T=>{const A=Mp(_,w,i?.signal);return Xe("sandbox:INIT_START:ready-wait",A,o).then(()=>{if(!s||T<=0)return c();const B=s.getGeneration();let O;const k=new Promise((R,I)=>{O=s.onChange(()=>{s.getGeneration()!==B&&I(It)})}),C=c();return C.catch(()=>{}),Promise.race([C,k]).finally(()=>O?.()).catch(R=>{if(R!==It)throw R;return{...o},b(T-1)})})};return b(Fp)}if(!s)return c();const d=s.getGeneration();let m;const h=new Promise((w,_)=>{m=s.onChange(()=>{s.getGeneration()!==d&&_(It)})}),E=c();return E.catch(()=>{}),Promise.race([E,h]).finally(()=>m?.()).catch(w=>{throw w===It&&{...o},w})}var Na="self-init:";function Bp(e){return e.startsWith(Na)}function _o(e,t){const n=e.getActiveShowRequest();return Bp(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function jp(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t(),o=()=>e.frameWatch?.();let i="",s;const a=w=>{s={target:e.readTarget?.(),docId:w}},l=()=>e.readDocument()?Lt(e.readDocument()):i,c=()=>Ve(e.container).editorPolicy,d=()=>e.readEmail(),m=()=>{const w=d();return{...w,id:e.isTemplate()||w.isNew?void 0:w.id,html:l()}};let h=!1;const E={readContent:l,publicEmail:m,sendInitStart:()=>Ye(n,"INIT_START",X.SANDBOX_INIT_START,{guid:d().renderGuid},void 0,r()),sendInited:()=>Ye(n,"INITED",X.SANDBOX_INITED,{guid:d().renderGuid},void 0,r(),o()),async sendContent(){const w=d(),{html:_,hasBrowserExtensionArtifacts:b}=Ma(w?.html||"");b&&e.events.browserExtensionDetected(),La(e.readDocument(),_),i=_,a(w.renderGuid),await Ye(n,"SET_ENTITY",X.SANDBOX_SET_ENTITY,bn(l(),w.renderGuid,c(),e.readDocument()?.get().version),{guid:w.renderGuid,emailId:w.id??null},r(),o())},refreshContent:()=>(a(d().renderGuid),Ye(n,"SET_ENTITY",X.SANDBOX_SET_ENTITY,bn(l(),d().renderGuid,c(),e.readDocument()?.get().version),void 0,r(),o())),sendPreheader:async()=>{const w=d();if(w.preheader!==void 0)return Ye(n,"PREHEADER",X.SANDBOX_PREHEADER_UPDATE,{value:w.preheader,guid:w.renderGuid,force:!0},void 0,r(),o())},sendSubject:async()=>{const w=d();if(w.subject!==void 0)return Ye(n,"SUBJECT",X.SANDBOX_SUBJECT_UPDATE,{value:w.subject,guid:w.renderGuid,force:!0},void 0,r(),o())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:w=>e.showFilled?.(w),noteFilled:(w,_)=>e.noteFilled?.(w,_),contentSent:()=>s,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(m()),fireInit(w,_){if(!_o(t(),w)){t().getActiveShowRequest()?.showId;return}const b=d();b.id,b.renderGuid,t().completeShow(w);const T=e.readDocument();mt(T,{is_inited:!0},{source:"system"});const A=()=>{const O=m();_&&(O.reset=!0);const k=e.events.inited(O);return _||(h&&E.fireEmailChanged(),h=!0),k};if(!T||T.isReady())return A();const{docId:B}=T.get();return T.whenReady().then(()=>e.readDocument()?.get().docId===B?A():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(m())},fireContentChanged(){e.events.contentChanged(l())}};return E}var Up=class extends Error{showId;constructor(e,t){super(`[emailmaker] show() timed out after ${t}ms waiting for editor init (showId=${e}). Check earlier console errors: wrong host-plugin publicPath (chunks return HTML), mount element removed without destroy(), or sandbox init never completed. Search for [show-pipeline] and [AMD] messages.`),this.name="ShowPipelineTimeoutError",this.showId=e}},Hp=class{_activeRequest=null;_pending=new Map;_listeners=new Set;getActiveShowRequest(){return this._activeRequest}onShowRequested(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}requestShow(e,t,n){return this._rejectPending(_e("Superseded by newer show()")),n.aborted?Promise.reject(_e(n.reason)):(this._activeRequest=e,new Promise((r,o)=>{const i=setTimeout(()=>{this._settle(e.showId,()=>{o(new Up(e.showId,t))})},t);i.unref?.();const s=()=>{this._settle(e.showId,()=>{o(_e(n.reason))})};n.addEventListener("abort",s,{once:!0});const a=()=>{clearTimeout(i),n.removeEventListener("abort",s)};this._pending.set(e.showId,{request:e,resolve:r,reject:o,timeoutId:i,dispose:a});for(const l of this._listeners)l(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function $p(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function Vp(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Vs(e),n=qs(e),r=Pd(e.sandbox);t<n+r}var Fa=class{_controller=new AbortController;_externalSignalDisposable=new he;_sessionChangeListeners=new Set;_showRegistry=new Hp;_timeouts;_generation=0;_sessionStarted=!1;_externalSignal;get signal(){return this._controller.signal}get externalSignal(){return this._externalSignal}get generation(){return this._generation}get contentReadyTimeoutMs(){return Vs(this._timeouts)}getSandboxTimeoutMs(e){return $s(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return qs(this._timeouts)}bumpGeneration(){this._generation+=1}getActiveShowRequest(){return this._showRegistry.getActiveShowRequest()}onShowRequested(e){return this._showRegistry.onShowRequested(e)}requestShow(e){return this._showRegistry.requestShow(e,this.contentReadyTimeoutMs,this._controller.signal)}completeShow(e){this._showRegistry.completeShow(e)}hasPendingShow(e){return this._showRegistry.hasPendingShow(e)}failShow(e,t){this._showRegistry.failShow(e,t)}rejectAllPendingShows(e){this._showRegistry.rejectAll(e)}onSessionReplaced(e){return this._sessionChangeListeners.add(e),()=>{this._sessionChangeListeners.delete(e)}}configure(e){e.timeouts!==void 0&&(this._timeouts=$p(this._timeouts,e.timeouts),Vp(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,e.signal!==void 0&&(this._externalSignal=e.signal),t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}relinkExternalSignal(e){this._externalSignal=e,this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new he,this._linkExternalSignal(e)}abort(e){const t=e??_e("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new he}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new he,this._showRegistry.rejectAll(_e("Init session replaced")),this._controller.signal.aborted||this._controller.abort(_e("Init session replaced")),this._controller=new AbortController,this._emitSessionReplaced()}_emitSessionReplaced(){for(const e of this._sessionChangeListeners)e()}_linkExternalSignal(e){if(!e)return;if(e.aborted){this._controller.signal.aborted||(this._controller.abort(e.reason??_e()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??_e()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},wo=(()=>{const e=new Fa;return e.configure({}),e})();function rt(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.parentNode;return n instanceof ShadowRoot&&n.host instanceof HTMLElement?n.host:null}function Ge(e){return!e||e==="none"}function qp(e){const t=e.contain??"",n=e.willChange??"";return!Ge(e.transform)||!Ge(e.perspective)||!Ge(e.filter)||!Ge(e.backdropFilter)||!Ge(e.translate)||!Ge(e.rotate)||!Ge(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function fi(e){const t=/paint|strict|content/.test(e.contain??"");return{x:t||!!e.overflowX&&e.overflowX!=="visible",y:t||!!e.overflowY&&e.overflowY!=="visible"}}function Gp(e){const t=[],n=document.documentElement,r=fi(getComputedStyle(n)),o=r.x||r.y;let i="none";const s=getComputedStyle(e).position;(s==="absolute"||s==="fixed")&&(i=s);for(let a=rt(e);a&&a!==n;a=rt(a)){const l=getComputedStyle(a),c=i==="none"||qp(l)||i==="absolute"&&!!l.position&&l.position!=="static",d=a===document.body&&!o;if(c){i="none";const m=d?{x:!1,y:!1}:fi(l);(m.x||m.y)&&t.push({node:a,...m})}(l.position==="absolute"||l.position==="fixed")&&(i==="none"||l.position==="fixed")&&(i=l.position==="fixed"?"fixed":"absolute")}return t}function Ba(e){const t=e.getBoundingClientRect(),n=e.offsetWidth>0&&t.width>0?t.width/e.offsetWidth:1;return{x:n,y:e.offsetHeight>0&&t.height>0?t.height/e.offsetHeight:n}}function Qt(e){return Number.parseFloat(e)||0}function Ar(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=Ba(e),o=Qt(n.borderLeftWidth),i=Qt(n.borderTopWidth),s=Qt(n.borderRightWidth),a=Qt(n.borderBottomWidth),l=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-o-s):0,c=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-i-a):0;return{left:t.left+o*r.x,top:t.top+i*r.y,right:t.right-(s+l)*r.x,bottom:t.bottom-(a+c)*r.y}}function zp(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},o=(i,s,a)=>{s&&(r.left=Math.max(r.left,i.left),r.right=Math.min(r.right,i.right)),a&&(r.top=Math.max(r.top,i.top),r.bottom=Math.min(r.bottom,i.bottom))};return t.forEach(i=>o(Ar(i.node),i.x,i.y)),n&&o(Ar(n),!0,!0),r}var Rr={originX:0,originY:0,scaleX:1,scaleY:1};function yn(e,t){return{left:(e.left-t.originX)/t.scaleX,top:(e.top-t.originY)/t.scaleY,width:Math.max(0,e.right-e.left)/t.scaleX,height:Math.max(0,e.bottom-e.top)/t.scaleY}}function ja(e,t,n){const r=t.width>0&&e.width>0?e.width/t.width:n.scaleX,o=t.height>0&&e.height>0?e.height/t.height:r;return{originX:e.left-t.left*r,originY:e.top-t.top*o,scaleX:r,scaleY:o}}function Ua(e,t){return Math.abs(e.left-t.left)<=.5&&Math.abs(e.top-t.top)<=.5&&Math.abs(e.width-(t.right-t.left))<=.5&&Math.abs(e.height-(t.bottom-t.top))<=.5}var Wp=1e3;function Kp(e){const{slot:t,own:n}=e;let r,o=0,i=!1;const s=()=>{if(r=void 0,!i){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<o)&&(r=window.requestAnimationFrame(s))}},a=()=>{!i&&r===void 0&&(r=window.requestAnimationFrame(s))},l=()=>{o=performance.now()+Wp,a()},c=[window],d=[document.documentElement];for(let b=t;b;b=rt(b)){const T=b.getRootNode();T instanceof ShadowRoot&&!c.includes(T)&&(c.push(T),d.push(T))}const m=[["scroll",a],["load",a],["transitionrun",l],["transitionend",a],["transitioncancel",a],["animationstart",l],["animationend",a],["animationcancel",a]];c.forEach(b=>m.forEach(([T,A])=>b.addEventListener(T,A,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const h=typeof MutationObserver=="function"?new MutationObserver(b=>{b.some(T=>!n.contains(T.target))&&a()}):void 0;d.forEach(b=>h?.observe(b,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let E;try{if(typeof ResizeObserver=="function"){const b=new ResizeObserver(a);typeof b.observe=="function"&&(E=b)}}catch{E=void 0}let w=[];return{schedule:a,observe:b=>{!E||b.length===w.length&&b.every((T,A)=>T===w[A])||(E.disconnect(),w=b,b.forEach(T=>E?.observe(T)))},dispose(){i=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),c.forEach(b=>m.forEach(([T,A])=>b.removeEventListener(T,A,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),h?.disconnect(),E?.disconnect()}}}var Yp="pluginZoom",Xp=/^(?:ant|vscode|monaco|docs)-/;function Jp(e){return Xp.test(e)}function Qp(){const e="em".trim();if(!/^[a-z][a-z0-9]*$/i.test(e))throw new Error(`[cssVars] REACT_APP_CSS_VAR_PREFIX="${e}" is not a valid CSS identifier fragment.`);return e}var Zp=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function eh(){return Zp}var th=new Set;function nh(e,t,n=th){return e.startsWith(`${t}-`)?!1:!Jp(e)&&!n.has(e)}function rh(e,t){return`--${t}-${e}`}function Ha(e){const t=Qp();return nh(e,t,eh())?rh(e,t):`--${e}`}function oh(e,t){const n=Ha(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function $a(e,t){return oh(e,t)}var Va=300,pi=15e3,ih=5e3,hi="em-canvas-busy-style";function sh(){if(document.getElementById(hi))return;const e=document.createElement("style");e.id=hi,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var ah="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z";function lh(e){const t=$a("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(Ha("colorPrimary")).trim()||t}function qa(e){sh();const t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("viewBox","0 0 1024 1024"),n.setAttribute("width","48"),n.setAttribute("height","48"),n.setAttribute("fill","currentColor"),n.setAttribute("aria-hidden","true");const r=document.createElementNS(t,"path");r.setAttribute("d",ah),n.appendChild(r);const o=document.createElement("span");return o.setAttribute("role","img"),o.setAttribute("aria-label","loading"),o.setAttribute("style",`display:inline-flex;color:${lh(e)};animation:em-canvas-busy-spin 1s linear infinite`),o.appendChild(n),o}function ch(e,t,n){const r=t??e,o=Math.max(r.left,e.left,0),i=Math.min(r.right,e.right,n.width),s=Math.max(r.top,e.top,0),a=Math.min(r.bottom,e.bottom,n.height);return i<=o||a<=s?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(o+i)/2-e.left,y:(s+a)/2-e.top}}function dh(e,t){const n=e.getBoundingClientRect(),r=document.createElement("div");r.setAttribute("aria-busy","true"),Object.assign(r.style,{position:"fixed",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,cursor:"progress"}),e.appendChild(r);const o={left:n.left,top:n.top,right:n.right,bottom:n.bottom},i=r.getBoundingClientRect();if(i.width>0&&!Ua({left:i.left,top:i.top,width:i.width,height:i.height},o)){const s=yn(o,ja(i,yn(o,Rr),Rr));Object.assign(r.style,{left:`${s.left}px`,top:`${s.top}px`,width:`${s.width}px`,height:`${s.height}px`})}return{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const s=ch(n,t(),{width:window.innerWidth,height:window.innerHeight}),a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:`${s.x}px`,top:`${s.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),a.appendChild(qa(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function Yn(e){const t=document.createElement("div");t.setAttribute("aria-busy","true"),Object.assign(t.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"progress"});const n=getComputedStyle(e).position!=="static";n||(e.style.position="relative"),e.appendChild(t);const r=setTimeout(()=>{t.appendChild(qa(e))},Va);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var uh=8e3;function fh(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),followReload:()=>{},moveTo:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,slot:null,whenShown:()=>Promise.resolve(),filled:void 0,noteFilled:()=>{},alignTo:()=>{},resize:()=>{},hold:()=>{},dispose:()=>{}}}function ph(e,t){for(let n=rt(e);n;n=rt(n)){const r=getComputedStyle(n),o=r.overflowX!=="visible"||r.overflowY!=="visible",i=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(s=>st(s)>0);if(o&&i)return n;if(n===t)return null}return null}function st(e){return Number.parseFloat(e)||0}function Zt(e,t){return Math.abs(e-t)<=1}function hh(e){const t=getComputedStyle(e),n=st(t.borderTopWidth),r=st(t.borderRightWidth),o=st(t.borderBottomWidth),i=st(t.borderLeftWidth),s=(a,l,c)=>Math.max(0,st(a)-Math.max(l,c));return{...Ar(e),radii:[s(t.borderTopLeftRadius,n,i),s(t.borderTopRightRadius,n,r),s(t.borderBottomRightRadius,o,r),s(t.borderBottomLeftRadius,o,i)]}}function mh(e,t){const n=Zt(t.top,e.top),r=Zt(t.bottom,e.bottom),o=Zt(t.left,e.left),i=Zt(t.right,e.right),s=[n&&o?e.radii[0]:0,n&&i?e.radii[1]:0,r&&i?e.radii[2]:0,r&&o?e.radii[3]:0];return s.every(a=>a===0)?"":s.map(a=>`${a}px`).join(" ")}function gh(e,t,n,r,o,i){const s=n.readyTimeoutMs??uh,a=document.createElement("div");a.dataset.canvasHost=e,r&&(a.dataset.canvasPlace=r),a.style.position="fixed",a.style.overflow="hidden",a.style.visibility="hidden",a.style.setProperty("zoom",$a(Yp,"1"));const l=n.resolveSrc(e),c=document.createElement("iframe");c.setAttribute("sandbox",n.resolveSandbox(l)),c.setAttribute("allow","clipboard-read; clipboard-write"),c.setAttribute("title","Email content"),c.style.width="100%",c.style.border="0",c.style.display="block",c.style.minHeight="600px",c.src=l,a.appendChild(c),t.appendChild(a),n.mark?.("created"),o||n.onCreated?.(c);const d=new he;let m=!1,h,E=!1,w,_,b,T;const A=()=>{clearTimeout(T),T=setTimeout(()=>{E||(E=!0,_?.(new Error(`[canvas] ${e}: документ не загрузился за ${s} мс`)))},s)},B=()=>m?(b=Promise.resolve(),E=!0,b):(E=!1,b=new Promise((j,D)=>{w=j,_=D}),A(),b),O=()=>{if(clearTimeout(T),m=!0,E){b=Promise.resolve();return}E=!0,n.mark?.("loaded"),w?.()};c.addEventListener("load",O),d.addDispose(()=>{clearTimeout(T),c.removeEventListener("load",O)});let k;const C=()=>{k??=n.bindResizer?.(c)},R=()=>{k?.dispose(),k=void 0};let I=null,g=null,p,u=Rr,f="",P="",M=0;const y=j=>{const D=JSON.stringify(j);return D===f?!1:(f=D,a.style.visibility=j.visibility,a.style.left=`${j.css.left}px`,a.style.top=`${j.css.top}px`,a.style.width=`${j.css.width}px`,a.style.height=`${j.css.height}px`,a.style.borderRadius=j.radius,c.style.width=j.elementWidth>0?`${j.elementWidth}px`:"100%",c.style.transform=j.shiftX!==0?`translate(${j.shiftX}px, ${j.shiftY}px)`:`translateY(${j.shiftY}px)`,!0)};let S=!1;const F=()=>{if(!I)return f="",a.style.visibility="hidden",c.removeAttribute("id"),!1;n.elementId&&(c.id=n.elementId);const j=I.getBoundingClientRect(),D=Gp(I),L=g?.isConnected?g:null;p?.observe([I,c,...D.map(se=>se.node),...L?[L]:[]]);const H=zp(j,D,L),K=Math.max(0,H.right-H.left),te=Math.max(0,H.bottom-H.top),Z=getComputedStyle(I).visibility==="visible",ce=K<=0||te<=0,Ee=ce?{left:H.left,top:H.top,right:H.left,bottom:H.top}:H,N=ce?null:ph(I,L??D[0]?.node??null),ee=N?mh(hh(N),Ee):"",J=se=>y({visibility:Z&&!S?"":"hidden",css:yn(Ee,se),elementWidth:j.width/se.scaleX,shiftX:(j.left-Ee.left)/se.scaleX,shiftY:(j.top-Ee.top)/se.scaleY,radius:ee});let ve=J(u);if(!ce){const se=a.getBoundingClientRect();se.width>0&&!Ua({left:se.left,top:se.top,width:se.width,height:se.height},Ee)&&(u=ja(se,yn(Ee,u),u),ve=J(u)||ve)}return ve},V=()=>{if(!I)return!1;let j=F();const D=c.getBoundingClientRect().height;D>0&&D!==M&&(M=D,I.style.height=`${D/Ba(I).y}px`,j=!0);const L=getComputedStyle(I).pointerEvents;return L!==P&&(P=L,a.style.pointerEvents=L),j},v=()=>{p?.dispose(),p=void 0},x=j=>{p=Kp({slot:j,own:a,measure:V,onDetached:v})};let U=[];const W=(j,D)=>{if(g=D,j&&U.length>0){const L=U;U=[],L.forEach(H=>H())}if(j===I){j&&!p&&x(j),V();return}if(v(),I&&I.style.removeProperty("height"),f="",M=0,P="",I=j,!j){F(),R();return}n.onShown?.(c),x(j),V(),C()};d.addDispose(v);const $=j=>{m=!1,h=void 0,i?.(),j&&n.onReload?.(c);let D;E||b===void 0?D=B():(A(),D=b);try{c.contentWindow?.location.reload()}catch{c.src=l}return D};return{element:c,ready(){return b??B()},reload:()=>$(!0),reloadQuietly:()=>$(!1),followReload:()=>{h=void 0,i?.(),n.onReload?.(c)},moveTo(j){if(a.parentNode===j)return b??B();m=!1,h=void 0,i?.();let D;return E||b===void 0?D=B():(A(),D=b),j.appendChild(a),n.onReload?.(c),f="",p?.schedule(),D},get shown(){return I!==null},get slot(){return I},whenShown(){return I!==null?Promise.resolve():new Promise(j=>{U.push(j)})},get filled(){return h},noteFilled(j){h=j},alignTo(j,D){W(j,D??null)},hold(j){S!==j&&(S=j,F())},scrollBy(j,D){let L=j,H=D;for(let K=I?rt(I):null;K;K=rt(K)){if(Math.abs(L)<1&&Math.abs(H)<1)return;const te=getComputedStyle(K);if((te.overflowY==="auto"||te.overflowY==="scroll")&&K.scrollHeight>K.clientHeight){const Z=K.scrollTop,ce=K.scrollLeft;K.scrollBy({left:L,top:H,behavior:"instant"}),L-=K.scrollLeft-ce,H-=K.scrollTop-Z}}(Math.abs(L)>=1||Math.abs(H)>=1)&&window.scrollBy({left:L,top:H,behavior:"instant"})},resize(){k?.resize()},dispose(){W(null,null),R(),d.dispose(),a.remove()}}}function vh(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",o=(u,f)=>u==="email"?`email:${f??n}`:u,i=new Map;let s,a=[],l=!1,c,d,m=!1,h,E,w="shown",_=0,b,T,A;const B=u=>d!==void 0&&u.filled!==void 0&&u.filled!==d,O=()=>{b=void 0;const u=h;!m||!u||d===void 0||T===d||!B(u)||(T=d,e.onForeignDocument?.({wanted:d,filled:u.filled,role:w,heldMs:Date.now()-_}))},k=()=>{m=!1,h=void 0,E=void 0,clearTimeout(b),b=void 0},C=(u,f)=>{const P=i.get("email"),M=P?.slot??null;return u&&M&&B(u)?(u.alignTo(null),m||(m=!0,_=Date.now(),b=setTimeout(O,ih)),w=f,h=u,!(s!==void 0||l)&&E!==u&&(E=u,e.onShown?.(u.element)),!c&&!s&&(c=Yn(M)),!1):(m&&(k(),c?.remove(),c=void 0),u?.alignTo(M,P?.clip??null),!0)},R=()=>{m&&!l&&C(t.get(o("email")),"shown")},I=()=>{a.forEach(u=>clearTimeout(u)),a=[],s?.remove(),s=void 0,c?.remove(),c=void 0,(l||m)&&(l=!1,C(t.get(o("email")),"shown"))},g=(u,f,P)=>{const M=o(u,f),y=t.get(M);if(y)return y;const S=e.resolveMount();if(!S)return fh();const F=gh(u,S,e,u==="email"?f??n:void 0,P,u==="email"?()=>R():void 0);return t.set(M,F),F},p={get:u=>g(u),current:u=>g(u),peek:u=>t.get(o(u)),spare:()=>t.get(o("email",r())),ensureSpare:()=>g("email",r(),!0),promote(){const u=t.get(o("email",r()));if(!u)return;const f=t.get(o("email"));n=r(),A=void 0,C(u,"spare"),f?.alignTo(null)},alignSurface(u,f,P){const M=i.get(u);if(i.set(u,{slot:f,clip:P??null}),u==="email"&&l){c?.remove(),c=f?Yn(f):void 0;return}const y=f?g(u):t.get(o(u));if(u!=="email"){y?.alignTo(f,P??null);return}if(!f){A=M?.slot&&y?.shown?{slot:M.slot,handle:y}:void 0,m&&(k(),c?.remove(),c=void 0),y?.alignTo(null);return}const S=A?.slot===f&&A.handle===y;if(A=void 0,M?.slot===f&&y?.shown||S){y?.alignTo(f,P??null);return}C(y,"shown")},want(u){d=u,u!==void 0&&R()},noteFilled(u,f){const P=p.byWindow(u);P&&(P.noteFilled(f),P===t.get(o("email"))&&R())},visible(){for(const u of t.values())if(u.shown)return u},byWindow(u){if(u){for(const f of t.values())if(f.element.contentWindow===u)return f}},busy(u){if(I(),!u)return;if(!p.visible()){l=!0,c?.remove(),c=void 0;const M=i.get("email");M?.slot&&(c=Yn(M.slot)),a=[setTimeout(I,pi)];return}const f=e.resolveMount();if(!f)return;const P=dh(f,()=>p.visible()?.element.parentElement?.getBoundingClientRect()??null);s=P,a=[setTimeout(()=>P.showSpinner(),Va),setTimeout(I,pi)]},remount(u){I();const f=o("email");t.forEach((P,M)=>{if(M===f){P.moveTo(u).catch(()=>{});return}P.dispose(),t.delete(M)})},dispose(){d=void 0,l=!1,k(),A=void 0,I(),t.forEach(u=>u.dispose()),t.clear(),i.clear(),n="a",d=void 0,T=void 0}};return p}var bh=z("canvas.resizerBinder"),Pr=z("canvas.service"),yh={created:pe.canvasCreated,loaded:pe.canvasLoaded},Ga=new WeakMap;function Dr(e){return Ga.get(e)??0}function Eh(e,t){if(e.getInstance(Pr))return;const n=vh({resolveMount:()=>t.resolveMount(),resolveSrc:o=>t.resolveSrc(o),resolveSandbox:ap,elementId:t.elementId,bindResizer:o=>e.getInstance(bh)?.(o),onCreated:o=>Dt(e,o,"fresh"),onReload:o=>{Ga.set(o,Dr(o)+1),Dt(e,o,"fresh")},onShown:o=>{const i=n.byWindow(de(e).getTarget());i&&i.element!==o&&mi(i.element)===mi(o)||Dt(e,o,"switch")},mark:o=>t.mark?.(yh[o]),onForeignDocument:o=>{({...o},Hd("canvas identity: place held, frame has another document",{origin:"canvas-identity",level:"warning",tags:{role:o.role},contexts:{canvasIdentity:{...o,path:window.location.pathname}}}))}}),r=de(e).addListener(X.SANDBOX_WHEEL,o=>{n.visible()?.scrollBy(o?.deltaX??0,o?.deltaY??0)});e.inject(Pr,n),e.getInstance(Y)?.addDispose(()=>{r.dispose(),n.dispose()})}function mi(e){return e.parentElement?.dataset.canvasHost}function Dt(e,t,n){const r=de(e),o=t.contentWindow;if(!o)return;const i=r.getTarget()===o;i&&n==="switch"||(n==="fresh"&&(r.forget(o),i&&r.setTarget(void 0)),r.setTarget(o),Md(r))}function _h(e,t){Dt(e,t,"promote")}function wh(e,t){Dt(e,t,"switch")}function Sh(e,t){const n=t.contentWindow;n&&de(e).greet(n)}function za(e,t){const n=t.contentWindow;n&&de(e).forget(n)}function Ih(e,t){const n=le(e)?.byWindow(t)?.element;if(!n)return;const r=Dr(n);return()=>Dr(n)!==r}function le(e){return e.getInstance(Pr)}function Wa({attributes:e,readContent:t,docId:n,hasSession:r,serverId:o,show:i}){if(!r)return;const s={id:o??void 0,renderGuid:n,showId:i?.id,isNew:o==null,showToken:i?.token},a={...e,...s};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}function xn(e){return{...Wa({attributes:e.get().attributes,readContent:()=>e.getContent(),docId:e.get().docId,hasSession:!0,serverId:e.get().serverId,show:void 0}),html:e.getContent()}}function ln(e){const t=fe(e),n=t.current();if(!n||!re(t.sessionKey()))return;const r=xn(n),o=n.isDirty();ue(e,q.ON_BLOCK_CLOSE_ID).fire({block:r,hasUnsavedChanges:o})}function Ch(e){const t=fe(e);return!t.current()||!re(t.sessionKey())?!1:(ln(e),t.hasSuspended()?t.resumeSuspended()!==void 0:!1)}function Th(e){const t=fe(e),n=de(e),r=()=>e.getInstance(xe)??wo;let o,i,s=!1,a=!1,l,c;const d=P=>xn(P),m=()=>{const P=B(),M=P?.get().docId;if(!P||!M||M!==l||s)return;const y=P.get().version;y!==c&&(c=y,ue(e,q.ON_BLOCK_CHANGED_ID).fire(d(P)))};let h;const E=P=>{const M=t.showFacts();!M||M.id===h||!_o(P,M.id)||(h=M.id,P.completeShow(M.id))},w=async(P,M,y)=>{const S=y.generation,F=()=>y.generation!==S||y.signal.aborted||t.current()!==P||a,V=we(n);let v;const x=new Promise(W=>{v=hn(n,()=>W("regenerated"))}),U=async(...W)=>await Promise.race([Ye(...W).then(()=>"sent"),x])==="sent";s=!0;try{if(!await U(n,"INIT_START",X.SANDBOX_INIT_START,{guid:M},void 0,y)||F())return;const{html:W,hasBrowserExtensionArtifacts:$}=Ma(Lt(P));if($&&ue(e,q.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),La(P,W),!await U(n,"SET_ENTITY",X.SANDBOX_SET_ENTITY,bn(Lt(P),M,Ve(e).editorPolicy,P.get().version),void 0,y)||F()||!await U(n,"INITED",X.SANDBOX_INITED,{guid:M},void 0,y)||F())return;o=M,i=V,O(),c=P.get().version,l!==M&&(l=M,ue(e,q.ON_BLOCK_INIT_ID).fire(d(P))),E(y)}finally{v?.(),s=!1,we(n)!==V&&R()}};let _,b,T;const A=()=>{const P=le(e)?.peek("block");return P?.reload?(P.reload().catch(()=>{}),!0):!1},B=()=>re(t.sessionKey())?t.current():void 0,O=()=>{const P=B()?.get().docId,M=!P||T===P||o===P&&i===we(n);le(e)?.peek("block")?.hold(!M)},k=()=>{if(a||(O(),m(),s))return;const P=B(),M=P?.get().docId;if(!P||!M)return;if(o===M&&i===we(n)){E(r());return}if(!P.isReady())return;const y=r();y.signal.aborted||o!==void 0&&o!==M&&_!==M&&(_=M,A())||w(P,M,y).catch(()=>{if(!(a||t.current()!==P)){if(b!==M){b=M,A();return}T=M,O()}})};let C=!1;const R=()=>{C||a||(C=!0,queueMicrotask(()=>{C=!1,k()}))};let I,g;const p=()=>{const P=B(),M=P?.get().docId;M!==g&&(I?.(),g=M,I=P?.subscribe(R)),O(),R()},u=t.subscribe(p),f=hn(n,()=>{O(),R()});p(),e.getInstance(Y)?.addDispose(()=>{a=!0,f(),I?.(),u()})}function Ah(e){const t=fe(e);let n="email";const r=()=>{if(!t.current())return;const i=re(t.sessionKey())?"block":"email",s=le(e);if(i===n||!s)return;n=i;const a=s.peek(i);if(a){wh(e,a.element);return}s.get(i)},o=t.subscribe(r);e.getInstance(Y)?.addDispose(o)}var Rh=200;function Ph({startVersion:e,limit:t=Rh}){let n=[],r=e;const o=i=>{n=n.filter(s=>s.version>i),r=Math.max(r,i)};return{record(i){!i.changes?.length&&!i.contentReplaced||(n.push(i),n.length>t&&o(n[n.length-t-1].version))},rebase(i,s){if(s<r)return null;const a=n.filter(c=>c.version>s);o(s);let l=i;for(const c of a){if(c.contentReplaced||!c.changes)return null;const d=c.changes,m=[];for(const h of l){if(c.fromCanvas&&d.some(w=>h.range.start<=w.oldEnd&&h.range.end>=w.oldPosition))return null;const E=Xd(h.range,d,"after");if(!E)return null;m.push({range:E,text:h.text})}l=m}return l}}}function Dh(e,t){let n=0;return e.map(({start:r,end:o,text:i})=>{const s=new Re(r,t.slice(r,o),r+n,i);return n+=i.length-(o-r),s})}function Oh(e,t){const n=[...e].sort((r,o)=>r.range.start-o.range.start);return Dh(n.map(({range:r,text:o})=>({start:r.start,end:r.end,text:o})),t)}function kh(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var xh=32;function Mh(e=xh){const t=new Map;return{find(n,r){const o=t.get(n);return o&&wr(o.scope,r)?o.echo:void 0},remember(n,r,o){t.delete(n),t.set(n,{scope:r,echo:o}),t.size>e&&t.delete(t.keys().next().value)},echoes(n){return[...t.values()].filter(r=>wr(r.scope,n)).map(r=>r.echo)}}}function Lh(e,t){const n=bc(e,t);return n?[{range:{start:n.start,end:n.fromEnd},text:t.slice(n.start,n.toEnd)}]:[]}var So=z("canvas.sandboxFill");function Ka(e){return e.getInstance(So)?.pipeline.isEventsLocked()===!0}var Nh=/<(style|script|template|noscript|textarea)\b[^>]*>[\s\S]*?<\/\1\s*>|<!--[\s\S]*?-->/gi,Fh=/<\/?[a-zA-Z]/g;function gi(e){return e.match(Fh)?.length??0}function vi(e){return[...e.matchAll(Nh)].map(t=>[t.index,t.index+t[0].length])}function Xn(e,t,n){let r=0,o=0;for(const[i,s]of n){for(;o<t.length&&t[o][1]<=i;)o++;let a=i;for(let l=o;l<t.length&&t[l][0]<s;l++)r+=gi(e.substring(a,Math.max(a,t[l][0]))),a=Math.max(a,t[l][1]);r+=gi(e.substring(Math.min(a,s),s))}return r}function Bh(e,t){const n=[...t].sort((l,c)=>l.oldPosition-c.oldPosition||l.oldEnd-c.oldEnd),r=[],o=[],i=[];let s=0,a=0;for(const l of n){const c=e.substring(s,l.oldPosition);r.push(c,l.newText),a+=c.length,o.push([l.oldPosition,l.oldEnd]),i.push([a,a+l.newText.length]),a+=l.newText.length,s=l.oldEnd}return r.push(e.substring(s)),{next:r.join(""),removed:o,inserted:i}}function jh(e,t){if(e.reduce((s,a)=>s+a.oldLength,0)<=200)return null;const n=vi(t),r=Bh(t,e),o=Xn(t,n,r.removed)-Xn(r.next,vi(r.next),r.inserted),i=Xn(t,n,[[0,t.length]]);return o>100&&o>i*.2?{removed:o,total:i}:null}function ze(e){Mt(e,{origin:"canvas-channel"})}var Uh=100;function Hh(e){const t=e?.data,n=t?.action==="undo"||t?.action==="redo";return t?.operation===X.APPLICATION_ACTION&&n&&typeof t.actionId=="number"?{action:t.action,actionId:t.actionId}:void 0}function $h(e){const t=fe(e),n=de(e);let r;const o=(l,c)=>{const d=l.get().docId;let m=!1,h=null,E=null,w;const _=Ph({startVersion:l.get().version});let b=l.getContent();const T=Mh(),A=Ks(e),B=A.open(d,()=>l.get().version);let O=!1;const k=D=>({generation:we(n),originId:D});let C=k(null),R=!0;const I=(D,L)=>{!R||t.current()!==l||(Mt(L,{origin:"canvas-channel"}),E?.splice(0,E.length),n.sendAsync(X.SANDBOX_SET_ENTITY,bn(Lt(l),d,Ve(e).editorPolicy,l.get().version)).catch(ze))},g=D=>{const L=D[D.length-1],H=[...D].reverse().find(Z=>Z.answer?.actionId!==void 0)?.answer?.actionId,K=L.answer?.selection,te=H!==void 0||K?{...H!==void 0?{actionId:H}:{},...K?{selection:K}:{}}:void 0;return{edits:D.map(Z=>Z.edits),guid:d,rev:L.rev,...te?{historyAnswer:te}:{}}},p=()=>{const D=c.activeMove(),L=D&&w?.action===D.kind?w:void 0;if(L&&(w=void 0),!(!L&&!D?.selection))return{...L?{actionId:L.actionId}:{},...D?.selection?{selection:D.selection}:{}}},u=D=>{f({edits:[],rev:l.get().version,answer:{actionId:D.actionId}}).catch(ze)},f=async D=>{if(E){E.push(D);return}E=[D];try{do await n.sendAsync(X.SANDBOX_UPDATE_ENTITY,g(E.splice(0,E.length)));while(E.length)}catch(L){I("app edits failed to reach the canvas",L)}finally{E=null}},P=D=>{D.length&&n.sendAsync(X.SANDBOX_UPDATE_ENTITY,g(D)).catch(ze)},M=(D,L)=>{O=!0,P(E?.splice(0,E.length)??[]);const H={edits:[D],guid:d,rev:l.get().version,...L!==null?{changeId:L}:{}};L!==null&&T.remember(L,C,H),n.sendAsync(X.SANDBOX_UPDATE_ENTITY,H).catch(ze)},y=new Set,S=(D,L,H)=>{M([],H);const{length:K,hash:te}=Un(JSON.stringify(L.map(Ee=>[Ee.oldText,Ee.newText]))),Z=`${K}:${te}`;if(y.has(Z))return;y.add(Z);const ce=new Error(`canvas service batch removes ${D.removed} of ${D.total} tags`);I("canvas service batch removes a large part of the email",ce)},F=({changeId:D,baseRev:L})=>{!O&&(D!==null||L!==null)&&M([],D)},V=D=>{if(D.guid!==d)return;const L=cu(D);O=!1,C=k(L.originId);try{v(D,L)}catch(H){F(L),I("canvas batch failed to apply",H)}finally{F(L),L.changeId!==null&&A.note(L.changeId,C)}},v=(D,L)=>{const{pushUndoStop:H}=D,K=L.changeId!==null?T.find(L.changeId,C):void 0;if(K){O=!0,n.sendAsync(X.SANDBOX_UPDATE_ENTITY,K).catch(ze);return}let{edits:te,selection:Z}=D;if(L.baseRev!==null){const ce=_.rebase(te,L.baseRev);if(!ce){Mt(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),M([],L.changeId);return}ce!==te&&(Z=void 0),te=ce}try{m=!0,h=L.changeId;const ce=Oh(te,l.getContent());if(H===!1){const Ee=jh(ce,l.getContent());if(Ee){S(Ee,ce,L.changeId);return}c.applyWithoutHistory(ce)}else c.recordAt(D.typedAt,()=>l.mutate({changes:ce},{source:Ka(e)?"system":"user"}),Z),D.closesStep&&c.closeGroup()}finally{m=!1,h=null}},x=l.subscribe(({changes:D,version:L})=>{const H=l.getContent(),K=!D?.length&&H!==b;if(b=H,_.record({version:L,changes:D,contentReplaced:K,fromCanvas:m}),!D?.length)return;const te=kh(D);m?M(te,h):f({edits:te,rev:L,answer:p()}).catch(ze)}),U=n.addListener(X.APPLICATION_UPDATE_ENTITY,V),W=n.addListenerAsyncPipe(xc,(D,L)=>{w=Hh(D);try{return L?.(D)}finally{const H=w;w=void 0,H&&u(H)}},Uh),$=(D,L,{reportId:H,dropsCovered:K})=>{const te=E?.splice(0,E.length)??[];n.sendAsync(X.SANDBOX_UPDATE_ENTITY,{edits:[Lh(D,L)],guid:d,rev:l.get().version,resync:{textFingerprint:Un(L),reportId:H}}).catch(Z=>I("canvas resync edit failed to reach the canvas",Z)),K&&P(te)},j=n.addListener(X.APPLICATION_SYNC_DRIFT,D=>{if(!((D.reason==="echo-timeout"||D.reason==="resync-failed")&&D.guid!==void 0&&D.guid!==d)){if(D.reason==="resync-failed"){I("canvas failed to apply the resync edit",new Error("canvas resync failed"));return}if(D.reason==="echo-timeout"){const{textFingerprint:L}=D,H=Lt(l),K=Un(H);if(L?.length===K.length&&L.hash===K.hash){T.echoes(k(D.originId??null)).forEach(Z=>{n.sendAsync(X.SANDBOX_UPDATE_ENTITY,Z).catch(ze)}),D.reportId!==void 0&&$(H,H,D);return}const te=new Error(`canvas echo timeout, ${D.unsent??0} edits unsent`);if(D.canvasText===void 0){I("canvas lost the echo of its batch",te);return}$(D.canvasText,H,D)}}});return()=>{R=!1,B(),x(),U.dispose(),W.dispose(),j.dispose()}};let i;const s=()=>{const l=t.current(),c=t.history(),d=l?.get().docId;d!==i&&(r?.(),r=void 0,i=d,l&&c&&(r=o(l,c)))},a=t.subscribe(s);s(),e.getInstance(Y)?.addDispose(()=>{r?.(),a()})}function Vh(e){const t=de(e),n=()=>le(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(X.RELOAD,()=>{n()?.followReload()}),o=t.addOffTargetListener(X.RELOAD,a=>{const l=le(e)?.byWindow(a);l&&za(e,l.element)}),i=t.addListener(a=>{a.data?.operation===X.SANDBOX_RESIZED&&n()?.resize()}),s=Q(e,q.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(Y)?.addDispose(()=>{r.dispose(),o.dispose(),i.dispose(),s.dispose()})}function bi(){const e=document.createElement("div");return e.dataset.canvasOffscreen="true",e.style.position="absolute",e.style.left="-10000px",e.style.top="-10000px",e.style.width="1600px",e.style.height="1000px",document.body.appendChild(e),e}function qh(e){const t=e.getInstance(ge);let n,r;e.getInstance(Y)?.addDispose(()=>{r?.remove(),r=void 0}),Eh(e,{resolveMount:()=>n,resolveSrc:i=>Da(i==="block"),elementId:"email_iframe",mark:i=>oe(i)}),t?.watch(i=>{const s=i?.element;if(n&&s instanceof HTMLElement&&s!==n){n=s,le(e)?.remount(s),r?.remove(),r=void 0;return}if(!n){if(s instanceof HTMLElement)n=s;else if(i!==void 0){n=r??=bi(),le(e)?.alignSurface("email",r,r);return}else return;le(e)?.get("email")}});let o;e.getInstance(Y)?.addDispose(()=>{o?.remove(),o=void 0}),wf(e).watch(i=>{const s=le(e);if(s){if(i){o??=bi(),s.alignSurface("email",o,o);return}o&&(s.alignSurface("email",null),o.remove(),o=void 0)}})}var Io=z("canvas.headerFlow"),yi=["subject","preheader"],Ei=3e3,Gh=3,zh={subject:X.SANDBOX_SUBJECT_UPDATE,preheader:X.SANDBOX_PREHEADER_UPDATE};function Wh(e){const t=fe(e),n=de(e),r=k=>k?"remote":Ka(e)?"system":"user",o=(k,{guid:C,value:R,forced:I})=>{const g=ct(t);if(!g||typeof R!="string"||C&&C!==g.get().docId)return;const p=t.forcedHeaders();if(p?.[k]!==void 0&&!I&&R!==p[k])return;const u=g.get().attributes[k];if(!I&&E(k,R,u))return;const f=!I&&m.delete(k);I&&(b.delete(k),b.size===0&&t.endForcedHeaders()),l=!0;try{mt(g,{[k]:R},{source:f?"system":r(I)})}finally{l=!1}i[k]=R};let i={},s,a,l=!1,c=Promise.resolve();const d={},m=new Map,h=(k,C)=>{i[k]=C;const R={};m.set(k,R);const I=()=>{m.get(k)===R&&m.delete(k)};w(k,C,{force:!0}).then(I),setTimeout(I,Ei)},E=(k,C,R)=>{const I=t.showFill();if(!I||typeof R!="string")return!1;const g=d[k]?.showId===I.showId?d[k]:void 0;return C===R?(d[k]=g??{showId:I.showId,codeEdits:I.codeEdits,corrections:0},!1):g&&I.codeEdits>g.codeEdits&&C!==g.stale?!1:((!g||C===g.stale&&g.corrections<Gh)&&(d[k]={showId:I.showId,stale:C,codeEdits:I.codeEdits,corrections:(g?.corrections??0)+1},h(k,R)),!0)},w=(k,C,{force:R=!1,echo:I=!1,undoStep:g=!1})=>(c=n.sendAsync(zh[k],{value:C,guid:ct(t)?.get().docId,...R?{force:!0}:{},...I?{echo:!0}:{},...g?{undoStep:!0}:{}}).catch(p=>{}),c);let _;const b=new Set;e.inject(Io,{whenDelivered:async()=>{await c},reassert:k=>{const C=ct(t),R=yi.filter(I=>typeof k[I]=="string");if(!(!C||R.length===0)){l=!0;try{mt(C,Object.fromEntries(R.map(I=>[I,k[I]])),{source:"system"})}finally{l=!1}t.beginForcedHeaders(Object.fromEntries(R.map(I=>[I,k[I]]))),clearTimeout(_),_=setTimeout(()=>{b.clear(),t.endForcedHeaders()},Ei),b.clear();for(const I of R)b.add(I);for(const I of R)i[I]=k[I],w(I,k[I],{force:!0,echo:!0})}}});const T=()=>{s?.(),s=void 0;const k=ct(t);if(k!==a&&m.clear(),a=k,!k){i={};return}const C=k.get().attributes;i={subject:C.subject,preheader:C.preheader},s=k.subscribe(({source:R})=>{if(l)return;const I=k.get().attributes,g=t.forcedHeaders();for(const p of yi){const u=I[p];if(u===i[p])continue;i[p]=u,m.delete(p);const f=R==="system"&&g?.[p]!==void 0;w(p,u??"",{force:f,echo:f,undoStep:R==="user"})}})};T();const A=t.subscribe(T),B=n.addListenerAsync(X.APPLICATION_SUBJECT_UPDATE,k=>o("subject",k)),O=n.addListenerAsync(X.APPLICATION_PREHEADER_UPDATE,k=>o("preheader",k));e.getInstance(Y)?.addDispose(()=>{B.dispose(),O.dispose(),A(),s?.(),clearTimeout(_)})}function Kh(e){const t=fe(e);let n={document:void 0,seq:0};const r=()=>{const i=t.recoveryFacts(),s=ct(t);if(!i?.applied||!s||String(i.emailId)!==String(s.get().serverId)||(n.document!==s&&(n={document:s,seq:0}),i.applied.seq<=n.seq))return;n={document:s,seq:i.applied.seq};const a=t.shownHeaders();(a.subject!==void 0||a.preheader!==void 0)&&e.getInstance(Io)?.reassert(a)},o=t.subscribe(r);e.getInstance(Y)?.addDispose(o)}function Yh(e,t){return(e&&e!=="system"?e:t?"dark":"light")==="dark"?Dc:Bc}function Xh(e,t){return{copyPasteEnabled:e.copyPasteEnabled,saveBlockEnabled:t?!1:e.saveBlockEnabled,editImageControlEnabled:e.editImageControlEnabled,elementAIimageEnabled:e.elementAIimageEnabled,imageCenterStockEnabled:e.imageCenterStockEnabled,imageCenterGifEnabled:e.imageCenterGifEnabled,imageCenterEditorEnabled:e.imageCenterEditorEnabled,blocksAddPanelEnabled:e.blocksAddPanelEnabled!==!1&&e.blocksSectionsShow!==!1}}function Jh(e){return e.isCodeMode&&(e.direction==="left"||e.direction==="right")}function _i(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Or(e,t){const n={...e};for(const r of Object.keys(t)){const o=t[r],i=e[r];_i(o)&&_i(i)?n[r]=Or(i,o):o!==void 0&&(n[r]=o)}return n}function Qh(e,t){const n=no;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const o=JSON.parse(r);if(o&&typeof o=="object"&&!Array.isArray(o)&&Object.keys(o).length>0)return Or(n,o)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?Or(n,t):n}var Zh=ye(void 0),wi=Zh,Ya=z("CodeMode");function Xa(){let e;try{const t=window.localStorage?.getItem(ro.em_code_mode_settings);e=t?JSON.parse(t):void 0}catch{e=void 0}return{isCodeMode:!!(e?.isCodeMode||e?.isCodeMode===void 0),direction:e?.codeModeDirection||"left"}}function em(e){try{window.localStorage?.setItem(ro.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function Co(e){return e.getOrCreateInstance(Ya,()=>{const t=ye(Xa());return t.watch(em),t})}function Ja(e){return e?.getInstance(Ya)?.get()??Xa()}function kr(e,t){const n=Co(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function tm(e,t){const n=Co(e);n.set({...n.get(),direction:t})}var nm=z("DefaultCommonStyles");function Qa(e){return e.getOrCreateInstance(nm,()=>ye(void 0))}function rm(e,t){Qa(e).set(t)}var om=z("CanvasViewport"),im=z("CanvasPreviewPage");function Be(e,t,n){let r,o;const i=()=>{if(!r||!e.isInited())return;const l=r.value===void 0?"undefined":JSON.stringify(r.value);l!==o&&(o=l,e.send(t,r.value))},s=n.watch(l=>{r={value:l},i()}),a=e.onInit(()=>{o=void 0,i()});return{dispose(){s.dispose(),a.dispose()}}}function en(e){const t=ye(e());return{source:t,refresh:()=>t.set(e())}}function sm(e){const t=de(e),n=e.getInstance(me),r=e.getInstance(ge),o=fe(e),i=Co(e),s=matchMedia(Cc),a=()=>n?.get()??{};let l;const c=en(()=>Yh(wi.get()??a().theme,s.matches)),d=en(()=>Xh(a(),re(o.sessionKey()))),m=en(()=>a().lockEditor),h=en(()=>Qh(o.current()?.get().attributes?.common_styles,l)),E=e.getOrCreateInstance(om,()=>ye()),w=e.getOrCreateInstance(im,()=>ye()),_=[Be(t,Fe.theme,c.source),Be(t,Fe.flags,d.source),Be(t,Fe.lockEditor,m.source),Be(t,Fe.commonStyles,h.source),Be(t,Fe.codeMode,i.select(Jh)),Be(t,Fe.appName,ye("emailmaker")),Be(t,Fe.previewPage,w),Be(t,Fe.viewport,E)],b=()=>{c.refresh(),d.refresh(),m.refresh()},T=n?.watch(b),A=Qa(e).watch(g=>{l=g,h.refresh()}),B=r?.watch(g=>{g&&"commonStyles"in g&&(l=g.commonStyles),h.refresh()});let O;const k=()=>{O?.(),O=o.current()?.subscribe(()=>h.refresh()),h.refresh(),d.refresh()};k();const C=o.subscribe(k),R=()=>c.refresh();s.addEventListener("change",R);const I=wi.watch(()=>c.refresh());e.getInstance(Y)?.addDispose(()=>{_.forEach(g=>g.dispose()),T?.dispose(),A.dispose(),B?.dispose(),O?.(),C(),s.removeEventListener("change",R),I.dispose()})}var xr;(function(e){function t(o,i,s=(a,l)=>a===l){if(o===i)return!0;if(o.length!==i.length)return!1;for(let a=0;a<o.length;a++)if(!s(o[a],i[a]))return!1;return!0}e.isEqual=t;function n(o,i=s=>s){const s=new Set;return o.filter(a=>{const l=i(a);return s.has(l)?!1:(s.add(l),!0)})}e.unique=n;function r(o=[],i=[],s=(a,l)=>a===l){const a=[],l=[],c=[];for(const d of o){const m=i.find(h=>s(d,h));m?c.push({prev:d,next:m}):l.push(d)}for(const d of i)o.find(m=>s(d,m))||a.push(d);return{added:a,removed:l,exists:c}}e.diff=r})(xr||(xr={}));function am(e,t){return e.type===t.type&&e.key===t.key}function lm(e){const t=de(e),n=()=>e.getServices(at)??[];let r=[];const o=t.onInit(()=>{r=n(),t.send(X.SANDBOX_ADD_EXTENSIONS,r)}),i=wc(at),s=e.onInject(a=>{if(a!==i)return;const l=n();if(!t.isInited()){r=l;return}const{added:c,removed:d}=xr.diff(r,l,am);if(r=l,d.length){if(d.some(m=>m.type==="script")){t.send(X.RELOAD);return}t.send(X.SANDBOX_REMOVE_EXTENSIONS,d.map(m=>m.key))}c.length&&t.send(X.SANDBOX_ADD_EXTENSIONS,c)});e.getInstance(Y)?.addDispose(()=>{o.dispose(),s?.dispose()})}var cm=new Set([...Object.values(X).map(e=>String(e)),"INIT_MESSAGE","FETCH_USER","USER_LOGGED_IN",String(io)]);function dm(e){return e.length>0&&!e.startsWith("em:")&&!cm.has(e)}function um(e){const t=de(e),n=new Map;let r=!1,o=-1,i=new Set;const s=c=>(c!==o&&(o=c,i=new Set),i),a=t.observeOutgoing((c,d)=>{if(!r||!dm(c))return;const m=we(t);n.set(c,{data:d,generation:m,scripts:new Set(s(m))})}),l=t.addListener(io,c=>{if(c.phase!=="ready"||c.status!=="success")return;r=!0;const d=we(t),m=s(d);m.add(c.key);for(const[h,E]of n)E.generation===d||![...E.scripts].every(w=>m.has(w))||(E.generation=d,t.send(Os(h),E.data))});e.getInstance(Y)?.addDispose(()=>{a.dispose(),l.dispose()})}var fm=z("prewarm.editorVisible");function pm(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function hm(e={}){const t=e.paint??pm;let n=!1,r=!1,o=!1,i=!1,s=!1;const a=[],l=()=>{s||i||!n||!r||!o||(i=!0,t(()=>{s=!0,oe(pe.editorVisible);for(const c of a.splice(0))c()}))};return{noteShellVisible(){n=!0,l()},notePagePainted(){r=!0,l()},noteContentShown(){o=!0,l()},whenVisible(c){if(s){c();return}a.push(c)},contentShown:()=>o}}function mm(e){return e.getOrCreateInstance(fm,()=>hm())}var gm=500,vm=500,bm=5e3;function ym(e){const t=e.quietMs??gm,n=e.floorMs??vm,r=e.ceilingMs??bm;let o,i,s=0;const a=()=>{clearTimeout(o),clearTimeout(i),o=void 0,i=void 0},l=()=>{a(),e.run()},c=()=>{clearTimeout(o);const d=n-(Date.now()-s);o=setTimeout(l,Math.max(t,d))};return{start(){a(),s=Date.now(),i=setTimeout(l,r),c()},notify(){o!==void 0&&c()},cancel:a}}var Em=2;function Si(){return new Error("[sandbox] document reloaded during fill")}function _m(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function Jn(e){try{e()}catch{}}function wm(e){let t;return Jn(()=>{t=e()}),{stage:n=>Jn(()=>t?.stage(n)),end:(n,r)=>Jn(()=>t?.end(n,r))}}function Sm(e){const t=()=>e.initPipeline();let n=!1,r,o,i,s=0,a,l;const c=()=>{const C=e.readTarget?.(),R=e.readSandboxGeneration?.();return C===void 0||R===void 0?void 0:{target:C,generation:R}},d=()=>{const C=c();return C&&{...C,canvasReplaced:e.trackDocument?.(C.target)}},m=C=>{if(C?.canvasReplaced?.())return!0;const R=c();return C!==void 0&&R?.target===C.target&&R.generation!==C.generation},E=jp({...e,waitScope:()=>({getSandboxTimeoutMs:C=>t().getSandboxTimeoutMs(C),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal}),frameWatch:()=>{const C=l;if(!(!C||!e.onSandboxGenerationChange))return{getGeneration:()=>c()?.generation??C.generation,onChange:R=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===C.target||C.canvasReplaced?.())&&R()})??(()=>{})}}});let w;const _=(C,R)=>{if(w===C)return;w=C;const I=s;setTimeout(()=>{s!==I||t().signal.aborted||B(C,R).catch(()=>{})},0)},b=()=>{a?.abort(),a=void 0};let T;const A=()=>{const C=t().signal;C!==T&&(T?.removeEventListener("abort",b),T=C,C.addEventListener("abort",b))};async function B(C,R,I=0){const g=++s;b(),a=new AbortController,l=void 0,A();const p=()=>s!==g,u=E.readTarget(),f=t().generation,P=()=>f===t().generation&&!t().signal.aborted,M=R?"init:reset-":"init:",y=wm(()=>e.observeShow?.(_m(C,R,e.readEmail())));if(!R){const W=E.publicEmail();W?.id,W?.renderGuid,W?.preheader}let S=!1,F=!1,V,v=!1;const x=()=>{if(m(V))throw Si()},U=()=>{if(p())throw _e("Fill superseded")};try{n=!0,await E.sendInitStart(),U(),V=d(),l=V,I===0&&E.fireWillInit(),await(R||I>0?E.refreshContent():E.sendContent()),S=!0,U(),x();const W=E.contentSent();E.noteFilled(W?.target,W?.docId),y.stage("content"),R||E.publicEmail()?.id;try{await E.sendPreheader()}catch($){if(ui($)||p())throw $;`${M}`,String($)}U();try{await E.sendSubject()}catch($){if(ui($)||p())throw $;`${M}`,String($)}if(U(),x(),E.showFilled(u),await E.sendInited(),U(),x(),F=!0,o===C){const $=e.readSandboxGeneration?.()??i;$!==void 0&&(r=$)}y.stage("reveal"),await E.revealFilled(),x(),y.end("revealed")}catch(W){const $=!p()&&P()&&m(V),j=$?Si():void 0,D=j??W,L=$&&I<Em?k(C,R,I+1):void 0;v=$&&L===void 0;const H=p()?void 0:{showId:C,contentApplied:S,sandboxInitedAcked:F,superseded:!1,...e.describeSurface?.(),error:String(j??W)};H&&(`${M}`,void 0);const K=!p()&&e.recoverFailedFill?.(u)===!0;if(y.end(p()?"superseded":K?"recovered":Jr(D)||!P()?"aborted":"failed",H),!K&&!p()&&_o(t(),C)&&t().failShow(C,D),L!==void 0)return L;throw D}finally{O(C,R,M,{superseded:p(),sessionGeneration:f,contentApplied:S,sandboxInitedAcked:F&&!v,retry:!v,commit:P()})}}function O(C,R,I,g){const{superseded:p,contentApplied:u,sandboxInitedAcked:f}=g;if(p){`${I}`;return}f&&g.commit?E.fireInit(C,R||void 0):f?(`${I}`,g.sessionGeneration,t().generation,t().signal.aborted,void 0):u?(`${I}`,void 0):(`${I}`,void 0),n=!1,a=void 0,!f&&o===C&&(o=void 0,r===i&&(r=void 0)),!f&&u&&g.retry&&_(C,R)}function k(C,R,I){return B(C,R,I)}return{channel:E,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:C=>{r=C},lastCorrelation:()=>o,markCorrelation:C=>{o=C},bumpRunSeq:()=>{s+=1},noteSandboxGeneration:C=>{i=C},fill:C=>B(C,!1),refill:C=>B(C,!0),stop:()=>{s+=1,b(),n=!1,T?.removeEventListener("abort",b),T=void 0}}}function Im(e,t,n){if(!e?.renderGuid||!e.showId||e.showId!==t.showId)return!1;if(t.isNew)return e.id==null;const r=t.emailId??t.navId;return r!=null&&String(e.id??"")!==String(r)?!1:Za(e,n)}function Za(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Cm(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:o,readSandboxGeneration:i}=e,s=d=>{const m=n(),h=o();if(!Im(m,d,h)){d.showId,d.navId,d.emailId,m?.id,m?.showId,m?.renderGuid;return}d.showId,m?.id,m?.renderGuid,t.markFilled(i()),t.markCorrelation(d.showId),t.fill(d.showId).catch(()=>{})};return{showRequested:d=>{s(d)},showRequestIdentityChanged:()=>{const d=e.initPipeline().getActiveShowRequest();d&&s(d)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const d=i();if(t.filledGeneration()===d)return;const m=n(),h=o();if(!m?.renderGuid||!Za(m,h))return;const E=`${Na}${m.renderGuid}`;t.markFilled(d),t.markCorrelation(E);const w=r()?.isReady()===!0;m.id,m.renderGuid,(w?_=>t.refill(_):_=>t.fill(_))(E).catch(()=>{t.lastCorrelation()===E&&t.markFilled(void 0)})},saasChanged:()=>{const d=n();d?.renderGuid,d?.showToken,d?.id,r()}}}var Tm=z("canvas.health");function Am(e){return e??""}function Rm(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Ii(e){return e.length>0}function Pm(e){const t=fe(e),n=de(e),r=()=>re(t.sessionKey())?void 0:t.current(),o=()=>{const N=r();return Wa({attributes:N?.get().attributes??{},readContent:()=>N?.getContent(),docId:N?.get().docId,hasSession:!!N,serverId:N?.get().serverId,show:t.showFacts()})},i=()=>e.getInstance(xe)??wo;let s={},a=!1;const l=e.getInstance(ge)?.watch(N=>{a=!!N?.element});let c=!1,d=!1,m=!1,h=0;const E=()=>{const N=le(e);if(!N)return;const ee=++h,J=N.spare();return J&&za(e,J.element),(J?J.reloadQuietly():N.ensureSpare()?.ready())?.then(()=>{if(ee!==h)return;c=!0;const ve=N.spare();ve&&Sh(e,ve.element),m&&(m=!1,f(),$())})},w=ym({run:()=>{m||E()?.catch(()=>{})}}),_=()=>{mm(e).noteContentShown(),!c&&!m&&w.start()};let b=!1;const T=N=>{const ee=le(e),J=ee?.spare()?.element.contentWindow;d&&ee&&J&&N===J&&(d=!1,ee.promote(),ee.busy(!1),b=!0)};let A=!1;const k=Sm({container:e,messageService:n,initPipeline:i,readDocument:r,readEmail:o,revealFilled:()=>{const N=le(e);return b&&N&&(b=!1,w.start()),a?N?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:T,noteFilled:(N,ee)=>le(e)?.noteFilled(N,ee),recoverFailedFill:N=>{const ee=le(e),J=ee?.spare()?.element.contentWindow;return!d||!ee||!J||N!==J?!1:(d=!1,c=!1,p="reload",ee.busy(!1),ee.peek("email")?.reload(),A=!0,$(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!s.isTemplate,readSandboxGeneration:()=>we(n),onSandboxGenerationChange:N=>hn(n,N),trackDocument:N=>Ih(e,N),observeShow:N=>e.getInstance(Tm)?.begin(N),describeSurface:()=>({canvasPath:p,promoted:d,spareClean:c,handshake:n.isInited(),generation:we(n)}),events:{willInit:N=>{ue(e,q.WILL_EMAIL_INIT_ID).fire(N)},inited:N=>{_(),ue(e,q.ON_EMAIL_INIT_ID).fire(N)},contentChanged:N=>{ue(e,q.ON_CONTENT_CHANGED_ID).fire(N)},emailChanged:N=>{ue(e,q.ON_EMAIL_CHANGED_ID).fire(N)},browserExtensionDetected:()=>{ue(e,q.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),C=Cm({pipeline:k,initPipeline:i,readEmail:o,readDocument:r,readRouteEmailId:()=>s.emailId,readSandboxGeneration:()=>we(n)});let R="",I="",g="",p="none";const u=()=>{const N=le(e)?.spare()?.element.contentWindow;N&&n.getTarget()===N||n.sendNow({operation:X.SANDBOX_LOCK_EDIT,data:!0})},f=()=>{const N=le(e)?.spare();N&&(u(),c=!1,d=!0,_h(e,N.element))},P=(N,ee)=>{const J=le(e);if(!J)return!0;const ve=J.spare(),se=ve&&c?"spare":"prepare";if(p=se,J.busy(!0),ve&&c)return f(),!0;w.cancel(),u();const qe=E();if(qe===void 0)return p="reload",J.busy(!1),J.peek("email")?.reload(),!0;m=!0;const Ne=h;return qe.catch(()=>{!m||Ne!==h||(m=!1,p="reload",J.busy(!1),J.peek("email")?.reload())}),!1},M=()=>{if(re(t.sessionKey()))return;te(),k.noteSandboxGeneration(we(n));const N=o(),ee=Rm(N?.renderGuid,N?.showId,N?.id,s.emailId),J=Am(N?.renderGuid);if(J!==I){const qe=I;I=J;const Ne=le(e)?.peek("email")?.filled,tc=Ne!==void 0&&Ne!==J;Ii(J)&&(Ii(qe)||tc)&&P(qe||(Ne??""),J)}if(m)return;(ee!==R||A)&&(A=!1,R=ee,C.showRequestIdentityChanged());const ve=r(),se=`${ee}|${ve?.get().docId??""}|${we(n)}`;se!==g&&ve?.isReady()===!0&&(g=se,C.selfInitChanged()),C.saasChanged(),U()};let y=!1,S="",F="",V=!1,v=!1;const x=N=>{N.source==="user"?v=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(V=!0),$()},U=()=>{const N=o();if(!N?.renderGuid)return;const ee=k.channel.readContent(),J=JSON.stringify([N.preheader,N.common_styles,N.meta,N.subject,N.utm_parameters?.utm_campaign??"",N.utm_parameters?.utm_content??"",N.utm_parameters?.utm_medium??"",N.utm_parameters?.utm_source??"",N.utm_parameters?.utm_term??""]),ve=y&&ee!==F,se=y&&J!==S;y=!0,F=ee,S=J;const qe=V&&!v;if(V=!1,v=!1,k.isEventsLocked()||qe)return;const Ne={...N,id:s.isTemplate||N.isNew?void 0:N.id,html:ee};if(ve){ue(e,q.ON_CONTENT_CHANGED_ID).fire(ee),ue(e,q.ON_EMAIL_CHANGED_ID).fire(Ne);return}se&&N.is_inited&&ue(e,q.ON_EMAIL_CHANGED_ID).fire(Ne)};let W=!1;const $=()=>{W||(W=!0,queueMicrotask(()=>{W=!1,M()}))};e.inject(So,{pipeline:k,setRoute:N=>{N.emailId===s.emailId&&!!N.isTemplate==!!s.isTemplate||(s=N,$())}});let j,D;const L=()=>{const N=r()?.get().docId;N!==D&&(j?.(),D=N,j=r()?.subscribe(x)),$()};let H,K;const te=()=>{const N=e.getInstance(xe);!N||N===H||(K?.(),H=N,K=N.onShowRequested(ee=>C.showRequested(ee)))},Z=n.addListener(N=>{N.data?.operation===X.SANDBOX_RESIZED&&w.notify()}),ce=t.subscribe(L),Ee=hn(n,$);L(),e.getInstance(Y)?.addDispose(()=>{l?.dispose(),K?.(),Ee(),ce(),j?.(),Z.dispose(),w.cancel(),k.stop()})}function Dm(){return Gc!=="emailmaker"}var Om={config:{mode:"freeUserBlocks",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",saveHotkeyEnabled:!0,commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formButtonFieldReplacerEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!1,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},el={config:{mode:"pro",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",saveHotkeyEnabled:!0,commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!0,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0,enableCopyFile:!0}},project:void 0,page:{isNew:!0,type:"email",project:0,id:"",showToken:0}},Ci=el,km=["pro"],Mr={};function xm(e){Mr=e}var tl=e=>km.includes(e)?Ci:Mr[e]??Mr.editor??Ci,Lr={config:{mode:"simple",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!1,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",saveHotkeyEnabled:!0,commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!1,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0}},project:void 0},Mm={config:{mode:"editor",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!1,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!1,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!1,emailDropdownMenuClone:!0,emailDropdownMenuImport:!1,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportTextEnabled:!1,exportMarkdownEnabled:!1,exportZipEnabled:!0,exportClipboardEnabled:!1,exportWebHookEnabled:!1,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",saveHotkeyEnabled:!0,commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!1,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!1,aiAssistentEnabled:!1,optimizeEnabled:!1,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!1,tagsEnabled:!0,isTemplateEnabled:!1,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!1,deleteButtonEnabled:!0,toggleSidePanel:!1,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!1,formFieldImageTitleEnabled:!1,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!1,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!1,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!1,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!1,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},Lm={...Lr,config:{...Lr.config,imageCenterFileManagerView:!1}};xm({pro:el,editor:Mm,simple:Dm()?Lr:Lm,blocks:Om});function Nm(e,t,n=e.getInstance(me)){n?.setMode(t),n?.get()?.codeEnabled===!1&&Ja(e).isCodeMode&&kr(e,!1)}function Fm(e){e.getInstance(zc)||e.inject(Me,void 0)}function Mn(e){return String(e.standaloneKey||"").trim()||void 0}function Bm(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function To(e){return Bm(e)?!!Mn(e):!1}function Vt(e){return!!Mn(e)&&!To(e)}var jm=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function Ti(e){return e==="server"?"serverSide":e}function Um({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},o=ye();let i={kind:"pending"},s;const a=new Promise(h=>{s=h}),l=n===void 0?void 0:setTimeout(()=>{d({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function c(){i.kind!=="pending"&&o.set(Kn(r,e))}function d(h){if(i.kind!=="pending")return;clearTimeout(l),i=h;const E=Kn(r,e);o.set(E),s(E)}function m(h,E){r[Ti(h)]=E,h==="server"&&i.kind==="pending"?d({kind:"applied"}):c()}return{watch:h=>o.watch(h),select:h=>o.select(h),get:()=>o.get(),ready:()=>a,state:()=>i,layers:()=>({...r}),bootstrap(){const h=Kn(r,e);return Object.fromEntries(jm.map(E=>[E,h[E]]))},merge(h,E){m(E,{...r[Ti(E)],...h})},replace(h,E){m(E,h)},setMode(h){r.user={...r.user,mode:h},c()},setAdvancedConfigs(h){r.advancedConfigs=h,c()},serverAbsent(h){d({kind:"absent",reason:h})},applyServerResponse(h){i.kind==="pending"&&m("server",{...r.serverSide,...h})},dispose(){clearTimeout(l)}}}var Hm=5e3;function $m(){return{...tl("pro")?.config,mergeTags:void 0}}function Vm(e,t){e.getInstance(ge)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs});const r=n.config??{},o=t.layers().user.mode;t.replace(r.mode===void 0&&o!==void 0?{...r,mode:o}:r,"user")})}function qm(e,t){let n;vo(e).watch(({profile:r})=>{const o=`${r?.theme??""}|${r?.locale??""}`;if(o===n)return;n=o;const i={};r?.theme&&(i.theme=r.theme),r?.locale&&(i.locale=r.locale),t.replace(i,"profile")})}function Gm(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function zm(e,t){let n,r=!1,o;const i=a=>{o??=On(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&Nm(e,a,t)},s=vo(e).watch(({profile:a})=>{const l=a?.email_builder_config,c=Gm(l);if(c===void 0||l===n)return;const d=n===void 0;n=l,!(d&&r)&&i(c)});e.getInstance(Y)?.addDisposable(s),t.ready().then(a=>{if(!a.configSwither)return;const l=localStorage.getItem("configSwither")||(n===void 0?a.mode:o)||"editor";localStorage.setItem("configSwither",l),r=n===void 0,i(l)})}var Ai="замкнутый контур: app_init не выполняется";function Wm(e,t){if(e.getInstance(Me)){t.serverAbsent(Ai);return}const n=e.getInstance(ge)?.watch(r=>{Vt(r)&&t.serverAbsent(Ai)});n&&e.getInstance(Y)?.addDisposable(n)}async function Km(e,t){if(e.getInstance(lo)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(He);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function Ym(e){e.injectFactory(me,(t,n)=>{if(n)return n;const r=Um({base:$m(),env:{modeDefaults:o=>tl(o)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Hm});return Vm(e,r),qm(e,r),zm(e,r),Wm(e,r),Km(e,r),e.getInstance(Y)?.addDisposable(r),r},!0)}var ft=class extends he{_event;_listener;_disposeEvent;constructor(e){super(),this._event=e}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),e?this._disposeEvent=this._event(e):this._disposeEvent=void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}};function G(e,t,n){const r=mc(e);return(o,i,s)=>{const a=r(async l=>{const c=t?t(l):l;s&&o.bind(s);const d=await o(c);return n?n(d):d},i,s);return()=>a.dispose()}}var Xm=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new yr;this.handleDestroy=G(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new ft(this.handleDestroy));e.lifetime.addDisposable(t),e.lifetime.addDisposable(e.options.watch(({handleDestroy:r})=>n.setListener(r))),e.lifetime.addDispose(()=>e.release())}destroy(){if(!this.deps.lifetime.isDisposed())try{this.deps.lifetime.dispose()}catch{}}},Ao=z("DestroyableService");function Jm(e){e.injectFactory(Ao,(t,n)=>{if(n)return n;const r=e.getInstance(Y);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new Xm({lifetime:r,options:e.getInstance(ge),getInstance:()=>e.getInstance(Tn),release:()=>vc(e.getInstance(sc)??e)})},!0)}function Qm(e){const t=e.getInstance(Ao);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var Zm=1e3;function nl(e,t,n=Zm,r=0){if(r>n||e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(typeof e=="object"&&typeof t=="object"){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;for(const s of o)if(!nl(e[s],t[s],n,r+1))return!1;return!0}return!1}function Ot(e,t){if(!e||typeof e!="object")return t;if(!t||typeof t!="object")return{};const n={};for(const r of Object.keys(t)){const o=t[r],i=e[r];nl(o,i)||(n[r]=o)}return n}var eg=({source:e,emailtags:t,group:n,tags:r,...o})=>o;async function tg(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function ng({emails:e,saveTimeoutMs:t},n,r){const o=t?.()??An();let i;try{const s=e.notifySave(n);return await Promise.race([s,new Promise((a,l)=>{i=setTimeout(()=>{const c=new Rn(o);n.value.id,mu(c,tg(s,r)),l(c)},o)})])}catch(s){throw ta(s),s}finally{i!==void 0&&clearTimeout(i)}}function rg(e){const{emails:t}=e,n=async(r,o)=>{const i=eg(o),s=r===void 0?void 0:await t.cache.getIfPresent(r),a=s?{...s,...i}:i,l=s?Ot(s,i):i,c=d=>{const m=String(d.id??r??Ce()),h=d.id===void 0?{...d,id:m}:d;return t.cache.addOrUpdate(m,()=>h)};return await c(await ng(e,{prev:s,patch:l,value:a,source:o.source??""},c))};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const o=await n(void 0,r);return o?.renderGuid?o:{...o,renderGuid:Ce()}},async updateEmail(r,o){return await n(r,o)}}}var Qn=20;function og(e){const t=ig(e);return e.saveTimeoutMs?sg(t,e.saveTimeoutMs):t}function ig({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:o,integratorProject:i}){const s=async(a,l)=>(t.clear(),await t.get(a,{page:l}),(await e.cache.values()??[]).filter(c=>String(c?.parent)===String(a)));return{async readRevisions(a,l=1){const c=await s(a,l);return{revisions:c.slice(Qn*(l-1),Qn*l),page:l,hasMore:c.length>Qn*l}},async readAutosave(a){const l=await r?.(a)??NaN,c=Number.isFinite(l)?l:void 0,d=await n?.(a);if(!d?.asked)return Su(await s(a,1),c);if(!d.revision)return Zo([],c);const m={...d.revision,parent:a,isAutosave:!0};return Zo([m],c,await s(a,1))},async saveAutosave(a,l){const c=await o?.(a),d=i?.();return await e.create({...Pu(l),...c!==void 0?{author:c}:{},...d!==void 0?{project:d}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function sg(e,t){return{...e,async saveAutosave(n,r){const o=t();let i;try{return await Promise.race([e.saveAutosave(n,r),new Promise((s,a)=>{i=setTimeout(()=>a(new zs(o)),o)})])}catch(s){throw ta(s),s}finally{i!==void 0&&clearTimeout(i)}}}}var ag=class extends Nc{async execute([e],t){for(const n of t){const r=await n(e);r&&(r.id===void 0&&(r.id=e.value.id),e.value=r)}return e.value}},lg=class extends Ue{};var Ri=class extends he{_items=new Map;_onChangeEmitter=new Lc;async _getOrCreate(e,t){const n=this._items;let r;if(n.has(e))try{r=await n.get(e)}catch{t&&(r=await t())}else t&&(r=await t(),r&&this._onChangeEmitter.fire());return r}async _addOrUpdate(e,t){let n;const r=this._items;if(r.has(e))try{n=await r.get(e)}catch{}const o=await t(n);return ke(n,o)||this._onChangeEmitter.fire(),o}entries(){return Promise.all([...this._items.entries()].map(([e,t])=>t.then(n=>[e,n]))).then(e=>e.filter(([t,n])=>!!n))}values(){return Promise.all([...this._items.values()].map(e=>e).filter(e=>!!e))}getOrCreate(e,t){const n=this._getOrCreate(e,()=>t(e));return this._items.set(e,n),n}addOrUpdate(e,t){const n=this._addOrUpdate(e,t);return this._items.set(e,n),n}async getIfPresent(e){if(this._items.has(e))try{return await this._items.get(e)}catch{return}}add(e,t){const n=Promise.resolve(t);return this._items.set(e,n),n}remove(e){if(this._items.has(e)){const t=this._items.get(e);return this._items.delete(e),this._onChangeEmitter.fire(),t}return Promise.resolve(void 0)}async setAll(e){try{this.suspendChange();const t=[],n=new Set(Array.from(e).map(([o,i])=>o)),r=(await this.entries()).filter(([o,i])=>!n.has(o));for(const[o,i]of e)t.push(this.addOrUpdate(o,()=>i)),n.add(o);for(const[o]of r)t.push(this.remove(o));return await Promise.all(t),r}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}onChange=this._onChangeEmitter.event};function cg(e,{filter:t,order:n="asc",orderBy:r,page:o,pageSize:i=20}={}){const s=e.length;let a=e.length;if(t!==void 0){const l=Object.keys(t);e=e.filter(c=>{for(const d of l){const m=c[d],h=t[d];return d==="id"||typeof m!="string"?m===h:typeof h=="string"&&m.startsWith(h)}return!0}),a=e.length}return r&&(e=e.sort((l,c)=>(l[r]>c[r]?1:c[r]>l[r]?-1:0)*(n==="asc"?1:-1))),o!==void 0&&(e=e.slice(i*(o-1),i*o)),{data:e,filteredTotal:a,total:s,totalPages:Math.ceil(a/i)}}function dg(e=[]){if(e=e.filter(n=>n),e.length<=1)return e[0];const t=new Map;for(const n of e)for(const r of n)if(r.id!==void 0){const o=t.get(r.id)||{};t.set(r.id,{...o,...r})}return[...t].map(([n,r])=>r)}function ug(e,t){return Pi(e)&&Pi(t)?String(e)===String(t):e===t}function Pi(e){return typeof e=="string"||typeof e=="number"}var fg=class extends he{_cache=new Ri;_readEmitter=new Ue;_saveEmitter=this.addDisposable(new ag);_removeEmitter=this.addDisposable(new lg);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(n=>!!n)))}hasReadHandler(){return this._readEmitter.hasListeners()}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new he);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new Ri),o=n.addDisposable(new Ue);t=this._foreignCache[e]={get:async(i,s={})=>{await r.getOrCreate(i,async()=>{try{const l=dg(await o.fire(i))||[];for(const c of l)c[e]=i,await this._cache.add(c.id,c);return l}catch{return[]}});const a=(await this._cache.values()||[]).filter(l=>{const c=l[e];return c==null||ug(c,i)});return cg(a,s)},first(i,s={}){return t.get(i,{...s,page:1,pageSize:1}).then(({data:a})=>a[0])},handleRead:o.event,clear(){r.clear()},dispose(){n.dispose()}}}return t}async create(e,{source:t="",silent:n}={}){let r=e;return n||(r=await this._saveEmitter.fire({prev:void 0,patch:e,value:r,source:t})),r.id===void 0&&(r.id=Ce()),await this._cache.addOrUpdate(r.id,()=>r)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:n="",silent:r}={}){return this._cache.addOrUpdate(e,async o=>{const i=o?{...o,...t}:t;if(!r)return t=o?Ot(o,t):t,await this._saveEmitter.fire({prev:o,patch:t,value:i,source:n})})}async remove(e,{source:t="",silent:n}={}){const r=await this._cache.remove(e);return n||await this._removeEmitter.fire({value:r,source:t}),r}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}handlerRead=this._readEmitter.event;onSave=this._saveEmitter.event;onRemove=this._removeEmitter.event;onChange=this._cache.onChange};function qt(e){const t=z(e);return n=>n.getOrCreateInstance(t,()=>new fg)}function rl(e){const t=e.getInstance(Y);if(!t)throw new Error("Failed");return t}function Di(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function tn(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function pg(e,t,n){return e&&!Di(t)&&Di(e)?{...n,meta:e.meta}:n}var hg=z("CurrentProject"),mg={};function Gt(e){return e?.getInstance(hg)?.get()??mg}function Ro(e){const t=Gt(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var ol=qt("plugin.dataSource.emails"),il=qt("plugin.dataSource.emailRevisions"),sl=kn("plugin.readEmailAutosave"),Oi=z("emailDocuments.provided");function gg(e){const t=ol(e),n=il(e),r=n.byForeignKey("parent");if(e.getInstance(Oi))return{emails:t,emailRevisions:n};e.inject(Oi,!0);const o=()=>An(e.getInstance(xe)?.contentReadyTimeoutMs),i=rg({emails:t,saveTimeoutMs:o}),s=new Map,a=(l,c)=>d=>{const m=d?.id??c;return(typeof m=="string"||typeof m=="number")&&s.set(String(m),l),d};return ef(e,{...i,createEmail:l=>i.createEmail(l).then(a(Date.now())),updateEmail:(l,c)=>i.updateEmail(l,c).then(a(Date.now(),l))}),of(e,og({revisions:n,revisionsByEmail:r,readAutosave:async l=>{const c=await ue(e,sl).fire(l);return c.length===0?{asked:!1}:{asked:!0,revision:c[0]??null}},savedAt:async l=>{const c=_u((await t.cache.getIfPresent(l))?.modified),d=s.get(String(l))??NaN;return Number.isFinite(d)&&!(c>=d)?d:c},emailAuthor:async l=>(await t.cache.getIfPresent(l))?.author,saveTimeoutMs:o,integratorProject:()=>Gt(e).requested})),rl(e).addDisposable(t.onSave(({prev:l,patch:c,value:d})=>pg(l,c,d),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function ki(e,t){return!e?.data||!t||e.id!==t.locale?!1:t.contentHash?e.hash===t.contentHash:t.updatedAt>0&&t.updatedAt<=e.time}function vg(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var bg="po",nn=null;function yg(){const e=typeof window.__emailmaker__<"u"?window.__emailmaker__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([bg],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function Eg(){return nn===null&&(nn=yg().catch(e=>{throw nn=null,e})),nn}async function al(e){if(typeof e=="object")return Po(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?_g(t):wg(t)}function Po(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function _g(e){try{return Po(JSON.parse(e))}catch{return}}var xi=!1;async function wg(e){try{return Po((await Eg()).parsePoCatalog(e))}catch{xi||(xi=!0);return}}var Sg="em_locale",Ig="em_ant_locale",Cg="locale",Tg="ant_locale";function Do(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function ll(e,t){const n=Do(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function Ag(){return Do("em_locale")??ll(Cg,"em_locale")}function Mi(e){try{localStorage.setItem(Sg,JSON.stringify(e))}catch{}}function Rg(){return Do("em_ant_locale")??ll(Tg,"em_ant_locale")}function Pg(e,t){try{localStorage.setItem(Ig,JSON.stringify({id:e,data:t}))}catch{}}var Dg=8e3;function Og(e,t){const n=e,r=t,o=Object.keys(n).filter(i=>i!=="");return o.length!==Object.keys(r).filter(i=>i!=="").length?!1:o.every(i=>JSON.stringify(n[i])===JSON.stringify(r[i]))}function kg(e){const t=Ag(),n=Rg();let r={ready:!1},o;const i=ye(r);let s=0;const a=b=>{r={...r,...b},i.set(r)},l=()=>{r.ready||a({ready:!0})},c=setTimeout(l,e.unlockAfterMs??Dg),d=b=>b!==s;let m;async function h(b,T){if(n?.id===b&&n.data&&a({antd:n.data}),!m)return;const A=await m(b).catch(()=>{});!A||d(T)||(a({antd:A}),Pg(b,A))}async function E(b,T){const A=await e.askHost(b).catch(()=>null);if(d(T))return!0;if(A==null)return!1;const B=await al(A);return d(T)||(B&&a({catalog:B}),l()),!0}async function w(b,T){const A=await e.readList();if(d(T))return;if("error"in A){a({failure:{kind:"GET_LOCALES_ERROR",error:A.error}}),l();return}const B=A.data.find(k=>k.locale===b);if(!B){vg("em_locale")&&a({catalog:void 0}),l();return}if(ki(t,B)&&(!o||o.catalog===t?.data)){l();return}if(o?.entry&&r.catalog===o.catalog&&ki(o.entry,B)){Mi(o.entry),l();return}const O=await e.readCatalog(b);if(!d(T)){if("error"in O){a({failure:{kind:"GET_LOCALE_ERROR",error:O.error}}),l();return}O.data&&(o?.id===b&&r.catalog===o.catalog&&Og(o.catalog,O.data)||a({catalog:O.data}),Mi({id:b,time:B.updatedAt||Math.floor(Date.now()/1e3),hash:B.contentHash,data:O.data})),l()}}async function _(b,T){if(!await E(b,T)){if(!d(T)&&(o?.id===b&&r.catalog===o.catalog||b==="en_US")&&l(),e.canUseNetwork&&!e.canUseNetwork()){l();return}await w(b,T)}}return{set(b){if(!b||b===r.id)return;const T=s+=1;a({id:b,failure:void 0});const A=o?.id===b&&r.catalog===o.catalog;(o&&!A&&r.catalog===o.catalog||b==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===b&&t.data&&(a({catalog:t.data}),l()),h(b,T),_(b,T)},prime(b,T,A){r.id&&r.id!==b||r.catalog||!T||(o=t?.id===b&&t.data&&(!A||t.time>=A.time)?{id:b,catalog:t.data}:{id:b,catalog:T,entry:A?{id:b,time:A.time,hash:A.hash,data:T}:void 0},a({catalog:o.catalog}))},useAntdLoader(b){m=b,r.id&&h(r.id,s)},state:i,snapshot:()=>r,dispose:()=>clearTimeout(c)}}var xg=class{http;constructor(e){this.http=e}jsonList=({locale:e},t={})=>this.http.request({path:`/translations/${e}.json`,method:"GET",format:"json",...t});getTranslations=({locale:e},t={})=>this.http.request({path:`/translations/${e}.po`,method:"GET",...t});localesList=(e={})=>this.http.request({path:"/translations/locales",method:"GET",format:"json",...e})},Mg=class{baseUrl="/api/v2";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(n=>this.encodeQueryParam(t,n)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(n=>typeof t[n]<"u").map(n=>Array.isArray(t[n])?this.addArrayQueryParam(t,n):this.addQueryParam(t,n)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{const r=e[n];return t.append(n,r instanceof Blob?r:typeof r=="object"&&r!==null?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const n=this.abortControllers.get(e);return n?n.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:o,format:i,baseUrl:s,cancelToken:a,...l})=>{const c=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},d=this.mergeRequestParams(l,c),m=o&&this.toQueryString(o),h=this.contentFormatters[r||"application/json"],E=i||d.format;return this.customFetch(`${s||this.baseUrl||""}${n}${m?`?${m}`:""}`,{...d,headers:{...d.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(a?this.createAbortSignal(a):d.signal)||null,body:typeof e>"u"||e===null?null:h(e)}).then(async w=>{const _=w;_.data=null,_.error=null;const b=E?w.clone():w,T=E?await b[E]().then(A=>(_.ok?_.data=A:_.error=A,_)).catch(A=>(_.error=A,_)):_;return a&&this.abortControllers.delete(a),T})}},Lg=z("rest.v2.transport"),Li=Symbol("rest.v2.secureRequest");function Ng(e){return e.getOrCreateInstance(Lg,()=>{const t=e.getInstance(Wc)?.execute||fetch;return new Mg({baseUrl:"https://app.emailmaker.ru/api/v2",securityWorker:()=>({[Li]:!0}),customFetch:(n,r={})=>{const{[Li]:o,...i}=r;return t(n,{...i,[ic]:o!==!0})}})})}function Fg(e,t){const n=Ng(e);return Object.assign({},...t.map(r=>new r(n)))}function Ni(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function cl(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Ni(n.details,"wp_code")??n.code,message:Ni(n.details,"wp_message")??n.message,details:n.details}}:t&&typeof t=="object"?{status:e.status,data:t}:{status:e.status,data:{message:e.statusText||"request failed"}}}function dl(e){return!e.ok||!!e.error}function Bg(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function ul(){return Bg(ro.em_translations_v2)??!0}function jg(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Ug(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Hg(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],o=r[0];return typeof o=="string"&&o!==""&&t.push({locale:o,updatedAt:jg(r[1])}),t},[]):[]}function $g(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:Ug(n.updated_at),contentHash:n.content_hash}),t),[])}function fl(e){return Fg(e,[xg])}function En(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function Nr(e){return!e.ok||e.error!=null}function Fr(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Zn(e){return{data:await al(e)??null}}async function Vg(e){if(ul())try{const n=await fl(e).localesList();return dl(n)?{error:cl(n)}:{data:$g(n.data)}}catch(n){return En(n)}const t=Rs(e,[Ns]);try{const n=await t.get_translations2({file:"react_app"});return Nr(n)?Fr(n):{data:Hg(n.data)}}catch(n){return En(n)}}async function qg(e,t){if(ul())try{const r=await fl(e).jsonList({locale:t});return dl(r)?{error:cl(r)}:Zn(r.data)}catch(r){return En(r)}const n=Rs(e,[Ns]);try{const r=await n.get_translations3({id:t,file:"react_app"});return Nr(r)?Fr(r):Zn(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return Nr(r)?Fr(r):Zn(r.data)}catch(r){return En(r)}}}var rn=new WeakMap;function Gg(e){const t=rn.get(e);if(t!==void 0)return t;const n=Vg(e).then(r=>("error"in r&&rn.delete(e),r),r=>{throw rn.delete(e),r});return rn.set(e,n),n}var vt=z("locale.service");function zg(e){if(e.getInstance(vt))return;const t=kg({readList:()=>Gg(e),readCatalog:n=>qg(e,n),askHost:async n=>(await ue(e,q.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(Me)});e.inject(vt,t),e.getInstance(Y)?.addDispose(()=>t.dispose())}function Wg(e){const t=e.getInstance(me);if(!t)return;const n=e.getInstance(vt);if(!n)return;const r=t.select(o=>o.locale).watch(o=>n.set(o||"ru_RU"));e.getInstance(Y)?.addDisposable(r)}var Kg="user_id",Yg="project_id",Fi=z("rest.identityHeadersProvided");function Xg(e){if(e.getInstance(Fi))return;e.inject(Fi,!0);let t;e.getInstance(ge)?.watch(n=>{t=n}),e.addService(Cn,{execute(n,r){if(r?.public)return;const o=t?.user?.id??ba(e).profile?.id;o!=null&&o!==""&&n.headers.set(Kg,String(o));const i=t?.project;i!=null&&i!==""&&n.headers.set(Yg,String(i))}})}function Jg(e){const t=e?.[""];return typeof t?.lang=="string"?t.lang:void 0}function Qg(e){return e.id??Jg(e.catalog)}function Zg(e){if(e==="uk"||e.startsWith("uk_"))return"uk";const t=e.search(/[_-]/);return t>0?e.slice(0,t):e}function ev(e){return Zg(e||"en_US")}var tv="Accept-Language",Bi=z("rest.localeHeaderProvided");function nv(e){e.getInstance(Bi)||(e.inject(Bi,!0),e.addService(Cn,{execute(t){const n=e.getInstance(vt)?.snapshot();t.headers.set(tv,ev(n&&Qg(n)))}}))}function rv(e){if(!e)return!1;try{return e.getInstance(Me)!==void 0}catch{return!1}}var ov="Invalid standaloneKey.",Q_=z("StandaloneMockGuard");function iv(){const e=new Error(ov);return e.name="InvalidStandaloneKeyError",e}function sv(e){e.addService(Cn,{execute:()=>{if(rv(e))throw iv()}})}function av(e){pc(e),sv(e)}function lv(e){const t=new Fa;e.inject(xe,t);const n=e.getInstance(ge)?.watch(o=>{if(!o)return;const i=o.signal??t.externalSignal;t.configure({replaceSession:!0,...o.timeouts!==void 0?{timeouts:o.timeouts}:{},...i!==void 0?{signal:i}:{}})}),r=e.getInstance(Y);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var pl=qt("plugin.dataSource.blocks"),cv=qt("plugin.dataSource.blockRevisions"),dv=qt("plugin.dataSource.comments"),uv=kn(),fv=kn(),hl=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1005
1005
  <html>
1006
1006
  <head>
1007
1007
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -1042,10 +1042,10 @@ import{n as ps,r as Hl}from"./static/esm/971f1b2c.js";import{$ as Lo,A as $l,At
1042
1042
  </tr>
1043
1043
  </table>
1044
1044
  </body>
1045
- </html>`;function kg(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:el,project:e?.id,project_title:e?.title??"",tags:[],utm_parameters:{utm_source:"",utm_medium:"",utm_campaign:"",utm_term:"",utm_content:""},parent_email:null,common_styles:"{}",title:"",emailtags:[],isAmp:!1}}var tl=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function xg(e){return!Object.keys(e).some(t=>tl.has(t))}function Mg(e){const t={},n={};for(const[r,o]of Object.entries(e))tl.has(r)?t[r]=o:n[r]=o;return{showOptions:t,misplacedEmailFields:n}}function Ai(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function xn(e){return typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,"block")&&!Object.prototype.hasOwnProperty.call(e,"email")}function Lg(e){const t=typeof e.block=="string"?{code:e.block}:{...e.block},n=t.id!==void 0&&t.id!==""&&t.code===void 0,r=e.reload===!0&&t.id!==void 0&&t.id!=="";return{block:t,byId:n,blocks:e.blocks,revisions:e.revisions,reload:r}}function Vt(e){return{emails:Va(e),blocks:Za(e),emailRevisions:Ga(e),blocksRevision:Rg(e),comments:Pg(e)}}function Ng(e){const t=Object.values(Vt(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function Mn(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(xg(e))return{email:Ai(e)};{const{showOptions:n,misplacedEmailFields:r}=Mg(e),o=Object.keys(r);t&&o.length>0&&void 0;const i=typeof e.email=="string"?{code:e.email}:e.email;return{...n,email:Ai({...r,...i})}}}function Co(e){const t=et(e);return t&&te(t.sessionKey())?t.suspendedDocument():t?.current()}function an(e){return Co(e)?.getContent()}function nl(e,t){const n=t??kg(),r=Co(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:an(e)??n.html}:n}async function Ct(e){return(await e.getInstanceAsync(Ue))?.project}async function rl(e){return wo(e)??await Ct(e)}async function Ri(e,t){const n=Za(e);if(n.hasReadHandler()){const r=await n.get(t);if(r&&Object.keys(r).some(o=>o!=="id"))return r;await n.remove(t,{silent:!0});return}return n.byForeignKey("project").first(await rl(e),{filter:{id:t}})}function Pi(e){if(!e)return;if(xn(e)){const n=typeof e.block=="string"?e.block:e.block.id;return n==null?void 0:`block:${n}`}const t=Mn(e,!1).email.id;return t==null?void 0:String(t)}function Fg(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function Bg(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}var Di=new WeakMap;function jg(e,t){const n=(Di.get(e)??Promise.resolve()).then(t,t);return Di.set(e,n.catch(()=>{})),n}function vt({code:e,project:t,...n},r){const o=ke(n),i=wo(r),s=$e(r);return e&&s.warnAboutUnconfiguredInput(e,n.id),{...o,...e?{html:s.toEditorForm(e)}:{},...i===void 0?{}:{project:i},..."utm_parameters"in o?{utm_parameters:o.utm_parameters||{}}:{},_embedded:void 0}}function ye({html:e,renderGuid:t,showToken:n,showId:r,...o},i){const{requested:s}=qt(i),a=aa(i);return ke({...o,code:$e(i).toOutputForm(e),project:s===void 0?o.project:s,utm_parameters:a.UTMEnabled?o.utm_parameters:void 0,tags:void 0,template:void 0,guid:void 0,emailtags:void 0,project_title:void 0,project_author:void 0,is_template:void 0,is_inited:void 0})}function kr(e){return e==null?"":e.replaceAll(`\r
1045
+ </html>`;function pv(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:hl,project:e?.id,project_title:e?.title??"",utm_parameters:{utm_source:"",utm_medium:"",utm_campaign:"",utm_term:"",utm_content:""},parent_email:null,common_styles:"{}",title:"",emailtags:[],isAmp:!1}}var ml=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function hv(e){return!Object.keys(e).some(t=>ml.has(t))}function mv(e){const t={},n={};for(const[r,o]of Object.entries(e))ml.has(r)?t[r]=o:n[r]=o;return{showOptions:t,misplacedEmailFields:n}}function ji(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function Ln(e){return typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,"block")&&!Object.prototype.hasOwnProperty.call(e,"email")}function gv(e){const t=typeof e.block=="string"?{code:e.block}:{...e.block},n=t.id!==void 0&&t.id!==""&&t.code===void 0,r=e.reload===!0&&t.id!==void 0&&t.id!=="";return{block:t,byId:n,blocks:e.blocks,revisions:e.revisions,reload:r}}function zt(e){return{emails:ol(e),blocks:pl(e),emailRevisions:il(e),blocksRevision:cv(e),comments:dv(e)}}function vv(e){const t=Object.values(zt(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function Nn(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(hv(e))return{email:ji(e)};{const{showOptions:n,misplacedEmailFields:r}=mv(e),o=Object.keys(r);t&&o.length>0&&void 0;const i=typeof e.email=="string"?{code:e.email}:e.email;return{...n,email:ji({...r,...i})}}}function Oo(e){const t=tt(e);return t&&re(t.sessionKey())?t.suspendedDocument():t?.current()}function cn(e){return Oo(e)?.getContent()}function gl(e,t){const n=t??pv(),r=Oo(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:cn(e)??n.html}:n}async function Ct(e){return(await e.getInstanceAsync(He))?.project}async function vl(e){return Ro(e)??await Ct(e)}async function Ui(e,t){const n=pl(e);if(n.hasReadHandler()){const r=await n.get(t);if(r&&Object.keys(r).some(o=>o!=="id"))return r;await n.remove(t,{silent:!0});return}return n.byForeignKey("project").first(await vl(e),{filter:{id:t}})}function Hi(e){if(!e)return;if(Ln(e)){const n=typeof e.block=="string"?e.block:e.block.id;return n==null?void 0:`block:${n}`}const t=Nn(e,!1).email.id;return t==null?void 0:String(t)}function bv(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function yv(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}var $i=new WeakMap;function Ev(e,t){const n=($i.get(e)??Promise.resolve()).then(t,t);return $i.set(e,n.catch(()=>{})),n}function bt({code:e,project:t,...n},r){const o=Le(n),i=Ro(r),s=Ve(r);return e&&s.warnAboutUnconfiguredInput(e,n.id),{...o,...e?{html:s.toEditorForm(e)}:{},...i===void 0?{}:{project:i},..."utm_parameters"in o?{utm_parameters:o.utm_parameters||{}}:{},_embedded:void 0}}function Se({html:e,renderGuid:t,showToken:n,showId:r,...o},i){const{requested:s}=Gt(i),a=_a(i);return Le({...o,code:Ve(i).toOutputForm(e),project:s===void 0?o.project:s,utm_parameters:a.UTMEnabled?o.utm_parameters:void 0,tags:void 0,template:void 0,guid:void 0,emailtags:void 0,project_title:void 0,project_author:void 0,is_template:void 0,is_inited:void 0,secretHash:void 0})}function Br(e){return e==null?"":e.replaceAll(`\r
1046
1046
  `,`
1047
- `)}function Oi(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function Ug(e,t,n,r){const o=Hg(e,t,n,r);return o===void 0}function Hg(e,t,n,r){if(xn(t))return"block";const{email:o}=Mn(t,!1),i=vt(o,e),s=i.id;if(s===void 0)return"no-id";if(r!==void 0&&r!==s)return"other-id-shown";const a=et(e)?.current();if(!a)return"no-session";const l=a.get(),c=l.attributes;if(l.serverId!==s)return"document-id";if(c.is_inited!==!0)return"not-inited";const d=Oi(kr(n??a.getContent()));if(i.html!==void 0&&Oi(kr(i.html))!==d)return"html";if(i.subject!==void 0&&i.subject!==c.subject)return"subject";if(i.preheader!==void 0&&i.preheader!==c.preheader)return"preheader";if(i.common_styles!==void 0&&i.common_styles!==c.common_styles)return"common_styles"}function ki(e,t){if(xn(t))return;const{email:n}=Mn(t,!1),r=vt(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:kr(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function $g(e,t){const n={...e};return delete n.id,{...n,...t}}function qg(e){return e.html?e:{...e,html:el}}function Xe({code:e,project:t,...n},r,o){const i=o??wo(r);return{...n,...e?{html:$e(r).toEditorForm(e)}:{},renderGuid:_e(),...i===void 0?{}:{project:i}}}function me({html:e,renderGuid:t,...n},r){const{requested:o}=qt(r);return ke({...n,code:$e(r).toOutputForm(e),project:o===void 0?n.project:o,guid:void 0,link:void 0,status:void 0,slug:void 0,password:void 0,comment_status:void 0,template:void 0,blocktags:void 0,project_title:void 0,ping_status:void 0,lock:void 0,tag:void 0,is_template:void 0})}function ol(e){return et(e)?.current()?.get().serverId??void 0}function xr(e,t,n){return n===void 0&&(n=e.post===void 0?ol(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function Tt(e,t){return ke({...e,link:void 0,comment_status:void 0})}function ln({code:e,autosave:t,...n},r,o){return o===void 0&&(o=n.parent===void 0?ol(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||ou(n.slug),parent:o}}function Mr({html:e,isAutosave:t,...n},r){return ke({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:ke({html:e,ampHtml:e&&""})})}function cn({code:e,autosave:t,...n},r){return{...n,...e?{html:e}:{},isAutosave:t===!0,parent:r??n.parent}}function xi({html:e,isAutosave:t,...n}){return ke({...n,autosave:t?!0:void 0,code:e,guid:void 0})}var ft=V("NotificationService"),Vg=V("emailTemplate.reads");async function Gg(e,t){try{return await tt(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,Wg(e,t,n);return}}var zg=V("emailTemplate.notifiedFailures");function Wg(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(zg,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(ft).then(()=>{Bt(e,H.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Kg(e,t){const n=e.getOrCreateInstance(Vg,()=>new Map),r=n.get(t);if(r!==void 0)return r;const o=Gg(e,t).then(i=>(i===void 0&&n.delete(t),i));return n.set(t,o),o}var Xn="EXTERNAL",Mi=Symbol("supersededShow");function Yg(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var Xg="email_id";function Jn(e){return Object.entries(e).some(([t,n])=>t!=="id"&&n!==void 0)}async function Jg(e,t){const n=Cn();let r;try{return await Promise.race([e,new Promise((o,i)=>{r=setTimeout(()=>{e.then(t,()=>{}),i(new Tn(n,"handleSaveBlock","block"))},n)})])}finally{clearTimeout(r)}}var Qg=class extends ue{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_latestShow=Promise.resolve();_dataSources;_eventLock;_queue=vs();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=Vt(t),this._eventLock=Ng(t);const n=J(e,H.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(J(e,H.OPEN_BLOCK_REQUEST_ID)(r=>this.openBlock(r))),this.addDisposable(e.addService(Sn,{execute:(r,o)=>{!o?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(Xg,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(De)??go}_throwIfDestroyed(){if(this.isDisposed())throw Be()}async getTemplateEmail(e){const t=await Kg(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,n}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await Ct(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,Xe(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(o=>o.id!==void 0).map(o=>[o.id,ln(o,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(o=>o.id!==void 0).map(o=>[o.id,xr(o,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,o){const i=this._dataSources.emails,s=i.cache,a=await Ct(this._container),l=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let c=vt(e,this._container);const d=c.id;let g=d;if(d!==void 0){const h=await i.get(d);c={...h??{},...c,utm_parameters:c.utm_parameters??h?.utm_parameters??{},renderGuid:h?.renderGuid??_e(),...l>0?{showToken:l}:{},...o?{showId:o}:{},project:a}}else{g=n??_e();const h=await i.get(g);c={...c,utm_parameters:c.utm_parameters??{},renderGuid:h?.renderGuid??_e(),...l>0?{showToken:l}:{},...o?{showId:o}:{},project:a},delete c.project}if(t){const h=await this.getTemplateEmail(String(t));h&&(c=$g(h,c))}return d===void 0&&(c=qg(c)),await s.setAll([[g,c]]),c}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==ki(this._container,e))return!1;const n=an(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=ki(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:an(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&Fg({ticket:t,emailId:Pi(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,Mi;if(!e)return;const n=this._getInitPipeline();if(ee(n.signal),xn(e))return this._showBlock(e,n);const r=te(ce(this._container).sessionKey()),o=Bg(e);if(!r&&!o&&Ug(this._container,e,an(this._container),this._prevCommand?.id)||!r&&!o&&this._isRepeatOfLastShow(e))return;const i=Mn(e);i.email.id,this._prevCommand?.id;let s,a="",l=0,c=!1,d,g=Promise.resolve(),h,y=!1;try{this._eventLock.suspendChange();const{email:I,blocks:w,autosaves:b,comments:R,templateId:A,reload:L}=i;s=I.id;const P=vt(I,this._container),O=P.id,_=O??_e(),C=await Ye("getProject",Ct(this._container));ee(n.signal),a=_e();const T={isNew:O===void 0,id:String(_),project:C},m=L===!0&&O!==void 0;m&&(await this._dataSources.emails.remove(String(O),{silent:!0}),String(O)),l=++this._showToken,String(_);const f=[];f.push(this.setBlocks(w)),I.id!==void 0&&(f.push(this.setComments(R)),f.push(this.setEmailRevisions(b,String(I.id)))),f.push(this.setEmail(I,Number(A),O===void 0?String(_):void 0,l,a)),await Ye("setEmail+blocks+revisions",Promise.all(f),{emailId:O??String(_),showId:a,targetShowToken:l}),ee(n.signal);const u=await this._dataSources.emails.get(String(_)),p=ce(this._container),D={id:a,token:l};if(r){sn(this._container);const S=p.suspendedDocument()?.get().serverId;!m&&O!==void 0&&S!=null&&String(S)===String(O)&&p.resumeSuspended()}O===void 0?h=p.startNewDraft(u??P,{patch:P,show:D}):m?h=p.reload(O,{email:u??P,patch:P,show:D}):p.sessionKey()===ot(O)?h=p.show(P,D):h=p.open(O,{email:u??P,patch:P,show:D}),p.beginShowFill(a);const x=!!this._prevCommand&&Pe(this._prevCommand,T);T.id,!this._prevCommand||Pe(this._prevCommand,T),this._prevCommand?.id,this._rememberShow(T),g=n.requestShow({showId:a,navId:String(_),emailId:O,isNew:O===void 0}),y=!0;const E=()=>p.endShowFill(a);Promise.allSettled([g,h.whenReady()]).then(E),String(_),c=!0}catch(I){d=I,y&&a&&n.failShow(a,I),a&&et(this._container)?.endShowFill(a),Kr(I)||(xs(I),void 0)}finally{this._eventLock.resumeChange()}if(!c)throw d instanceof Error?d:new Error(`[emailmaker] show() setup failed: ${String(d??"unknown error")}`);return Ye("show-init-deferred",Promise.all([g,h?.whenReady().catch(I=>{if(I instanceof Ze){const w=co(I);throw w?new Error(`[emailmaker] show(): email open failed (${w})`,{cause:I}):I}})??Promise.resolve()]).then(()=>{}),{showId:a,emailId:s??null}).then(()=>{this._rememberShownContent(e)})}async _showBlock(e,t){const{block:n,byId:r,blocks:o,revisions:i,reload:s}=Lg(e),a=_e();let l=!1;try{await this.setBlocks(o),ee(t.signal),s&&(await this._dataSources.blocks.remove(String(n.id),{silent:!0}),this._dataSources.blocks.byForeignKey("project").clear(),String(n.id));const c=n.id!==void 0&&n.id!==""?String(n.id):void 0,d=ce(this._container);if(!s&&c!==void 0&&d.sessionKey()===pn(c)){const A=Jn(n)?await this._storeShownBlock(n):void 0,L={id:a,token:++this._showToken},P=d.show(A,L),O=t.requestShow({showId:a,navId:c,emailId:void 0,isNew:!1});l=!0,await Ye("show-block-init",Promise.all([O,P?.whenReady().catch(()=>{})]),{showId:a});return}const g=r||s?await Ri(this._container,String(n.id)):void 0,h=g&&(s||Jn(n))?await this._storeShownBlock({...me(g,this._container),...n}):r||s?g:await this._storeShownBlock(n);if(ee(t.signal),!h)throw new Error(`[emailmaker] show(): block ${String(n.id)} not found`);i!==void 0&&h.id!==void 0&&await this._dataSources.blocksRevision.cache.setAll(i.filter(A=>A.id!==void 0).map(A=>[A.id,cn(A,String(h.id))])),this._prevCommand=void 0,this._lastShow=void 0;const y=h.id!==void 0?String(h.id):_e(),I={id:a,token:++this._showToken};sn(this._container);const w=s?d.reloadBlock(y,h,I):d.openBlock(y,h,I);h.id;const b=t.requestShow({showId:a,navId:y,emailId:void 0,isNew:h.id===void 0});l=!0;const R=w.whenReady().catch(A=>{if(A instanceof Ze)throw A});await Ye("show-block-init",Promise.all([b,R]),{showId:a})}catch(c){throw l&&t.failShow(a,c),c}}async _storeShownBlock(e){const t=Xe(e,this._container,await Ct(this._container));return t.id!==void 0&&await this._dataSources.blocks.cache.add(t.id,t),t}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();ee(e.signal);const t=ce(this._container);if(te(t.sessionKey())&&!t.hasSuspended())throw new Error("[emailmaker] save(): no open email — a block is open, use saveBlock()");const n=await t.saveEmail("publish",{source:Xn,fallbackTitle:fa(this._container)});if(ee(e.signal),!n)throw Yg(t.emailSaveState().error);return ye(nl(this._container,this._currentEmail),this._container)}async _saveBlock(){this._throwIfDestroyed();const e=ce(this._container),t=e.current();if(!t||!te(e.sessionKey()))throw new Error("[emailmaker] saveBlock(): no open block");return jg(t,async()=>{await t.whenReady();const n=On(t),r=t.get().version,o={title:n.title,project:n.project,type:n.type??"Other",description:n.description,html:n.html,blocktags:n.blocktags,...n.meta?{meta:n.meta}:{}},i=this._dataSources.blocks,s=await Jg(t.get().serverId==null?i.create(o,{source:Xn}):i.update(String(t.get().serverId),o,{source:Xn}),a=>{a&&ce(this._container).current()===t&&t.get().serverId==null&&a.id!==void 0&&t.markSaved(r,String(a.id))});if(!s)throw new Error("[emailmaker] save(): block was not saved");return t.markSaved(r,s.id!==void 0?String(s.id):void 0),me(s,this._container)})}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;this._latestShowEmailId=Pi(e);const n=this._queuedShow(e,t).then(r=>r===Mi?this._latestShow.catch(()=>{}):void 0);return this._latestShow=n,n};_queuedSave=this._queue.decorate(()=>this._save(),this);save=()=>this._queuedSave();_queuedSaveBlock=this._queue.decorate(()=>this._saveBlock(),this);saveBlock=()=>this._queuedSaveBlock();showBlock=(e,t={})=>this.show({...t,block:e});async _openBlock(e){this._throwIfDestroyed(),ee(this._getInitPipeline().signal);const t=typeof e=="string"?{id:e}:e,n=t.id!==void 0&&t.id!==""?String(t.id):void 0,r=ce(this._container);if(n!==void 0&&r.sessionKey()===pn(n))return;const o=t.code===void 0&&n!==void 0?await Ri(this._container,n):void 0,i=o&&Jn(t)?await this._storeShownBlock({...me(o,this._container),...t}):t.code===void 0&&n!==void 0?o:await this._storeShownBlock(t);if(!i)throw new Error(`[emailmaker] openBlock(): block ${String(n)} not found`);sn(this._container);const s=r.openBlockOver(i.id!==void 0?String(i.id):_e(),i);i.id,r.hasSuspended(),le(this._container,H.ON_BLOCK_OPEN_ID).fire({block:i}),await s.whenReady().catch(a=>{if(a instanceof Ze)throw r.current()===s&&(le(this._container,H.ON_BLOCK_CLOSE_ID).fire({block:i,hasUnsavedChanges:!1}),r.resumeSuspended()),a})}async _closeBlock(){this._throwIfDestroyed(),Jp(this._container)}_queuedOpenBlock=this._queue.decorate(e=>this._openBlock(e),this);_queuedCloseBlock=this._queue.decorate(()=>this._closeBlock(),this);openBlock=e=>this._queuedOpenBlock(e);closeBlock=()=>this._queuedCloseBlock()};function Zg(e){return String(e).replace(/"/g,"&quot;")}function ev(e=new Date){const t=n=>String(n).padStart(2,"0");return String(e.getFullYear())+t(e.getMonth()+1)+t(e.getDate())+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}function tv(e){const t=/<(table|tr|div)(\s[^>]*)>/gi;let n;for(;(n=t.exec(e))!==null;){const r=n[2]??"";if(/\bem\s*=\s*["']block["']/i.test(r))return{full:n[0],index:n.index}}return null}function Li(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),o=Zg(n);return r.test(e)?e.replace(r,`${t}="${o}"`):e.replace(/>$/,` ${t}="${o}">`)}function nv(e,t,n){if(!e?.trim()||!t)return e;const r=tv(e);if(!r)return e;const o=String(t),i=ev(n??new Date);let{full:s,index:a}=r;const l=s.length;return/\bem-block-id\s*=/.test(s)||(s=Li(s,"em-block-id",o)),s=Li(s,"em-block-version",i),e.slice(0,a)+s+e.slice(a+l)}function rv(e){if(e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object")return e.meta;const t=e.catalogExtra?.meta;if(t!=null&&typeof t=="object")return t}function ov(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),o=t?.project??(e.project!==void 0&&e.project!==null?String(e.project):void 0);return{type:t?.type??n,insertFrom:n,name:t?.name??e.name,blockId:r,project:o,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:rv(e)}}function Qn(e,t){return t?ov(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var il=["title","slug","type","tags","blocktags","modified","author","lock","subject","description","excerpt","status","is_template","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author","isAmp","meta"],iv=[...il,"html","id","project","password"],g_=new Set(["html",...il,"global_block","project"]);function sv(e){if(!e||typeof e!="object")return{};const t={};e.id!=null&&e.id!==""&&(t.id=String(e.id)),e.title!=null&&e.title!==""&&(t.title=e.title),e.slug!=null&&e.slug!==""&&(t.slug=e.slug),e.type!=null&&e.type!==""&&(t.type=e.type),e.tags!=null&&(t.tags=e.tags),e.blocktags!=null&&(t.blocktags=e.blocktags),e.modified!=null&&e.modified!==""&&(t.modified=e.modified),e.author!=null&&e.author!==""&&(t.author=String(e.author)),e.lock!=null&&(t.lock=e.lock),e.subject!=null&&e.subject!==""&&(t.subject=e.subject),e.description!=null&&e.description!==""&&(t.description=e.description),e.excerpt!=null&&e.excerpt!==""&&(t.excerpt=e.excerpt),e.status!=null&&e.status!==""&&(t.status=e.status),e.is_template!=null&&(t.is_template=e.is_template),e.link!=null&&e.link!==""&&(t.link=e.link),e.renderGuid!=null&&e.renderGuid!==""&&(t.renderGuid=e.renderGuid),e.date!=null&&e.date!==""&&(t.date=e.date),e.date_gmt!=null&&e.date_gmt!==""&&(t.date_gmt=e.date_gmt),e.modified_gmt!=null&&e.modified_gmt!==""&&(t.modified_gmt=e.modified_gmt),e.comment_status!=null&&e.comment_status!==""&&(t.comment_status=e.comment_status),e.ping_status!=null&&e.ping_status!==""&&(t.ping_status=e.ping_status),e.template!=null&&e.template!==""&&(t.template=e.template),e.related_email!=null&&e.related_email!==""&&(t.related_email=e.related_email),e.project_title!=null&&e.project_title!==""&&(t.project_title=e.project_title),e.project_author!=null&&e.project_author!==""&&(t.project_author=e.project_author),e.isAmp!=null&&(t.isAmp=e.isAmp),e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object"&&(t.meta=e.meta);const n=new Set(iv),r={};for(const o of Object.keys(e))n.has(o)||(r[o]=e[o]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function av(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...sv(e),html:typeof e.html=="string"?e.html:"",insertFrom:t.type,name:t.name,project:t.project??e.project,id:e.id!=null&&e.id!==""?String(e.id):t.blockId}}var Lr=new WeakMap;function lv(e){let t=Lr.get(e);return t||(t={byId:new Map,fallback:[]},Lr.set(e,t)),t}function cv(e){Lr.delete(e)}function dv(e,t){const{byId:n,fallback:r}=lv(t);if(e.blockId){const o=n.get(e.blockId);if(o){n.delete(e.blockId);const i=r.indexOf(o);return i>=0&&r.splice(i,1),o}return}for(let o=r.length-1;o>=0;o--){const i=r[o],s=e.name!=null&&e.name!==""&&i.name!=null&&i.name!==""&&i.name===e.name,a=e.type!=null&&e.type!==""&&i.insertFrom===e.type;if(s&&a)return r.splice(o,1),i.id!=null&&i.id!==""&&n.delete(String(i.id)),i}}async function uv(e,t){const{blocks:n}=Vt(e);return await n.cache.getIfPresent(t)??void 0}async function fv(e,t){if(!t.blockId)return;const n=await uv(e,t.blockId);if(n)return av(n,t)}async function pv(e,t){const n=dv(e,t);if(n)return Qn(e,n);const r=await fv(t,e);return r?Qn(e,r):Qn(e,void 0)}var hv=ys("application_block_inserted"),mv=-1e3,Ni=new WeakSet;function gv(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.type=="string"||typeof t.name=="string"||typeof t.blockId=="string"||typeof t.project=="string"||typeof t.project=="number"}function vv(e){if(!e||Ni.has(e))return;Ni.add(e);const t=new ue,n=ae(e);return t.addDisposable(n.addListenerAsyncPipe(hv,async(r,o)=>{const i=gv(r)?await pv(r,e):r;return o?o(i):i},mv)),t.addDisposable({dispose:()=>{cv(e)}}),t}var bv=Dn("plugin.readBlockAutosave"),v_=V("blockDocuments.provided"),sl=V("plugin.earlyWindow");function yv(e){return e.getOrCreateInstance(sl,()=>({depth:0}))}function Ev(e){const t=yv(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function al(e){return(e?.getInstance(sl)?.depth??0)>0}function ll(e,t){let n,r=!1;return e(o=>{n=o,r=!0}),(o,i,s)=>{const a=e(o,i,s);if(r&&al(t)){const l=n;queueMicrotask(()=>{o.call(s,l)})}return a}}var Zn=100,_v=class extends ue{_container;_events;constructor(e){super(),this._container=e;const t=vv(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:o,blocksRevision:i}=Vt(e),s=J(e,H.ON_SHARE_ID),a=J(e,H.ON_SHOW_PREVIEW_ID),l=J(e,H.ON_EMAIL_CLONE_ID),c=J(e,H.ON_BLOCK_OPEN_ID),d=J(e,H.ON_BLOCK_CLOSE_ID),g=J(e,H.ON_BLOCK_CLONE_ID),h=J(e,H.ON_BLOCK_INIT_ID),y=J(e,H.ON_BLOCK_CHANGED_ID),I=J(e,H.ON_CODE_VALIDATE_ID),w=J(e,H.ON_IMPORT_VALIDATE_ID),b=J(e,H.ON_SUBJECT_CHANGED_ID),R=J(e,H.ON_EMAIL_CHANGED_ID),A=J(e,H.ON_PREHEADER_CHANGED_ID),L=J(e,H.ON_SAVEBUTTON_CLICK_ID),P=J(e,H.ON_BLOCK_SAVEBUTTON_CLICK_ID),O=J(e,H.ON_NEXTBUTTON_CLICK_ID),_=J(e,H.ON_SEND_LIVEPREVIEW_ID),C=J(e,H.ON_SEND_TESTEMAIL_ID),T=J(e,Og),m=J(e,H.ON_CONTENT_CHANGED_ID),f=J(e,Dg),u=J(e,H.ON_PREVIOUSBUTTON_CLICK_ID),p=J(e,H.ON_SEND_EMAIL_MODAL_ID),D=ec(J(e,H.ON_EMAIL_INIT_ID),E=>!E.reset),x=J(e,H.ON_ANALYTICS_EVENT);return{handlePreheaderChanged:q(A),handleSubjectChanged:q(b),handleValidate:q(I),handleImportValidate:q(w),handleReadEmail:q(n.handlerRead,E=>E,E=>E&&vt(E,e)),handleSaveEmail:q(n.onSave,function({prev:E,patch:S,value:N,source:$}){const v=E?ye(E,e):void 0;return{prev:v,patch:Dt(v,ye(S,e)),value:ye(N,e),source:$}},E=>E?vt(E,e):void 0),handleRemoveEmail:q(n.onRemove,({value:E,source:S})=>({value:ye(E,e),source:S}),()=>{}),handleReadCommonBlocks:q(T,E=>E.project,E=>E?.map(S=>Xe(S,e))),handleReadTemplateBlocks:q(f,E=>E,E=>E?.map(S=>Xe(S,e))),handleReadBlocks:q(t.byForeignKey("project").handleRead,E=>qt(e).requested||String(E),E=>E?.map(S=>Xe(S,e))),handleReadBlock:q(t.handlerRead,E=>E,E=>E?Xe(E,e):void 0),handleOpenBlock:q(c,({block:E})=>({block:me(E,e)})),handleCloseBlock:q(d,({block:E,hasUnsavedChanges:S})=>({block:me(E,e),hasUnsavedChanges:S})),handleCloneBlock:q(g,E=>me(E,e)),handleSaveBlock:q(t.onSave,function({prev:E,patch:S,value:N,source:$}){const v=N.global_block===!0&&N.id&&typeof N.html=="string"?{...N,html:nv(N.html,String(N.id))}:N,k=E?me(E,e):void 0;return{prev:k,patch:Dt(k,me(S,e)),value:me(v,e),source:$}},E=>E?Xe(E,e):void 0),handleRemoveBlock:q(t.onRemove,({value:E,source:S})=>({value:me(E,e),source:S}),()=>{}),handleReadComments:q(r.byForeignKey("post").handleRead,E=>E,E=>E?.map(S=>xr(S,e))),handleSaveComment:q(r.onSave,function({prev:E,patch:S,value:N,source:$}){const v=E?Tt(E,e):void 0;return{prev:v,patch:Dt(v,Tt(S,e)),value:Tt(N,e),source:$}},E=>E?xr(E,e):void 0),handleRemoveComment:q(r.onRemove,({value:E,source:S})=>({value:Tt(E,e),source:S}),()=>{}),handleReadEmailRevisions:q(o.byForeignKey("parent").handleRead,E=>E,E=>E?.map(S=>ln(S,e))),handleReadEmailAutosave:q(J(e,za),E=>E,E=>E?ln(E,e):null),handleEmailAutosave:q(o.onSave,function({prev:E,patch:S,value:N,source:$}){return{value:Mr(N,e),source:$}},E=>E?ln(E,e):void 0),handleRemoveEmailAutoSave:q(o.onRemove,({value:E,source:S})=>({value:Mr(E,e),source:S}),()=>{}),handleReadBlockRevisions:q(i.byForeignKey("parent").handleRead,E=>E,E=>E?.map(S=>cn(S))),handleReadBlockAutosave:q(J(e,bv),E=>E,E=>E?cn(E):null),handleBlockAutosave:q(i.onSave,({value:E,source:S})=>({value:xi(E),source:S}),E=>E?cn(E):void 0),handleRemoveBlockAutoSave:q(i.onRemove,({value:E,source:S})=>({value:xi(E),source:S}),()=>{}),handleBlockInit:q(h,E=>me(E,e)),handleBlockChanged:q(Bn(y,Zn),E=>me(E,e)),handleEmailChanged:q(Bn(R,Zn),E=>ye(E,e)),handleEmailInit:ll(q(D,E=>ye(E,e)),e),handlePreviousButtonClick:q(u,E=>ye(E,e)),handleNextButtonClick:q(O,E=>ye(E,e)),handleSaveButtonClick:q(L,E=>ye(E,e)),handleSaveBlockButtonClick:q(P,E=>me(E,e)),handleHtmlChanged:q(Bn(m,Zn)),handleTestEmailSend:q(C,({html:E,...S})=>({...S,code:E,compiled:{html:E,ampHtml:""}})),handleTestEmailModal:q(p,E=>ye(E,e)),handleCloneEmail:q(l,E=>ye(E,e)),handleShareEmail:q(s),handlePreviewEmail:q(a),handleLivePreviewEmail:q(_),handleAnalyticsEvent:q(x)}}get(){return this._events||(this._events=this._get())}_listenersUpdaters;setOptions(e={}){const t=this.get();let n=this._listenersUpdaters;if(!n){n=this._listenersUpdaters={};for(const r of Object.keys(t))n[r]=this.addDisposable(new ut(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},wv=V("DataController"),Sv=V("DataEvents");function cl(e){return e.getOrCreateInstance(wv,()=>{const t=new Qg(e);return e.getInstance(W)?.addDisposable(t),t})}function dl(e){return e.getOrCreateInstance(Sv,()=>new _v(e))}var Iv=V("plugin.pluginStart");function ul(e){return e.getOrCreateInstance(Iv,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(W)?.addDispose(()=>t()),{done:n,finish:t}})}function Cv(e){return ul(e).done}function Tv(e){const t=ul(e);return t.run===void 0&&(t.run=(e.getInstance(Wr)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var Av=V("plugin.startupShow");function Rv(e){const t=cl(e),n=dl(e),r=e.getInstance(pe),o=e.getInstance(W),i={current:Promise.resolve()};e.inject(Av,i);let s=!1;const a=r?.watch(c=>{c&&n.setOptions(c),s=(c?.plugins?.length??0)>0,i.current=i.current.catch(()=>{})}),l=r?.select(c=>c?.content).watch(c=>{if(c===void 0)return;const d=()=>(ne(de.showStart),t.show(c).finally(()=>ne(de.showEnd))),g=s?Cv(e).then(d):d();g.catch(()=>{}),i.current=g});a&&o?.addDisposable(a),l&&o?.addDisposable(l)}function Pv(e){const t=cl(e);return{...dl(e).get(),show(n){return ne(de.showStart),t.show(n).finally(()=>ne(de.showEnd))},openBlock(n){return t.openBlock(n)},closeBlock(){return t.closeBlock()},showBlock(n,r){return ne(de.showStart),t.showBlock(n,r).finally(()=>ne(de.showEnd))},save(){return t.save()},saveBlock(){return t.saveBlock()}}}function fl(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function Ln(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",o=!1;for(let i=t;i<e.length;i++){const s=e[i];if(o){o=!1;continue}if(s==="\\"){o=!0;continue}if(r){s===r&&(r="");continue}if(s==='"'||s==="'"){r=s;continue}if(s==="("){n++;continue}if(s===")"&&(n--,n<0))return!1}return n===0}function Dv(e){return(t,n,r)=>Ln(t)?e(t,n,r):!1}function Ov(e){return t=>Ln(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function kv(e){return(t,n,r)=>Ln(t)?fl(t)?e(t,n,r):t:!1}function xv(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return Ln(n)?fl(n)?e(t):t:!1}}function Mv(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function To(e,t){const n=e.length;for(let r=0;r<n;r++){const o=e.charCodeAt(r);if(o===0||t==='"'&&o===34||t==="'"&&o===39||t===""&&(o===32||o===9||o===10||o===13||o===12||o===34||o===39||o===60||o===62||o===61||o===96))return!1}return!0}function Lv(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let o="";for(let i=0;i<e;i++){const s=r[i]%62;o+=t.charAt(s)}return o}var Nv=8,Fv=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=Lv(Nv),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},Nn=new Fv;function Fi(e,t){return t!==void 0&&!To(e,t)?`%|{${Nn.getOrCreateByKey(e)}}|%`:e}function Bv(e){const t=Nn.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function ie(e,t,n){return t!==void 0?To(e,t)?e:`%|{${Nn.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function jv(e){return e.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}function re(e){return e.startsWith("<!--")&&e.endsWith("-->")?jv(e.slice(4,-3)):e}function Uv(e){const t=/^(IF|ELSE|ELSIF|ELSEIF|END|FOREACH|WHILE|NEXT|LAST|BREAK|DO|UNLESS|CONTINUE|SET|UNSET|DEFINE|INCLUDE)\b/i,n=/\w+\s*\(/;let r=e;const o=e.match(/\[%\s*([^%]*?)\s*%\]/);o&&(r=o[1]);const i=r.trim();return t.test(i)||n.test(i)}function Hv(e,t,n){return t!==void 0?To(e,t)?e:`%|{${Nn.getOrCreateByKey(e)}}|%`:n||Mv(e)||Uv(e)?`<!--${e}-->`:e}var ze=Dv(ie),We=Ov(re),$v=kv(ie),qv=xv(re),pl=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",Bv),e.escape("@{","}",ie,!0).unescape("<!--@{","}-->",re,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",Fi,!0),e.escape("{{","}}",Fi,!0),e.createSyntax("brace-percent").escape("{%","%}",ie).unescape("<!--{%","%}-->",re),e.createSyntax("brace-hash").escape("{#","#}",ie).unescape("<!--{#","#}-->",re),e.createSyntax("proscript").escape("[%","%]",Hv,!0).unescape("<!--[%","%]-->",re,!0),e.createSyntax("getresponse").escape("[[IF","]]",ie).escape("[[if","]]",ie).escape("[[ELSE]]","",ie).escape("[[else]]","",ie).escape("[[ENDIF]]","",ie).escape("[[endif]]","",ie).unescape("<!--[[IF","]]-->",re).unescape("<!--[[if","]]-->",re).unescape("<!--[[ELSE]]","-->",re).unescape("<!--[[else]]","-->",re).unescape("<!--[[ENDIF]]","-->",re).unescape("<!--[[endif]]","-->",re),e.createSyntax("expert-sender").escape("<if",">",ie).escape("</if",">",ie).escape("<else",">",ie).escape("</else",">",ie).escape("<var ",">",ie,!0).unescape("<!--<if ",">-->",re).unescape("<!--</if",">-->",re).unescape("<!--<else ",">-->",re).unescape("<!--</else",">-->",re).unescape("<!--<var",">-->",re,!0),e.createSyntax("velocity").escape("#if",")",ze).escape("#elseif",")",ze).escape("#else","",ie).escape("#foreach",")",ze).escape("#macro",")",ze).escape("#set",")",$v,!0).escape("#parse",")",ze).escape("#include",")",ze).escape("#evaluate",")",ze).escape("#end","",ie).escape("#break","",ie).escape("#stop","",ie).unescape("<!--#macro","-->",We).unescape("<!--#if","-->",We).unescape("<!--#elseif","-->",We).unescape("<!--#else","-->",re).unescape("<!--#foreach","-->",We).unescape("<!--#parse","-->",We).unescape("<!--#include","-->",We).unescape("<!--#evaluate","-->",We).unescape("<!--#end","-->",re).unescape("<!--#break","-->",re).unescape("<!--#stop","-->",re).unescape("<!--#set","-->",qv,!0),e.createSyntax("mailchimp").escape("*|","|*",ie).unescape("<!--*|","|*-->",re)},Nr="bare",Vv=new Map;function Gv(e){return e?Vv.get(e)??Nr:Nr}var hl=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function Bi(e){return hl.includes(e)}function _t(e){return e==="bare"||e==="html-comment"}function er(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zv(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!_t(e))return t(`templateDirectives: unknown form "${String(e)}", falling back to the default ("bare").`),n;r={output:e}}else if(typeof e=="object"&&!Array.isArray(e))r=e;else return t(`templateDirectives: expected a string or an object, got ${typeof e}. Ignored.`),n;for(const[c,d]of[["output",r.output],["editor",r.editor]])if(d!==void 0&&!_t(d))return t(`templateDirectives.${c}: unknown form "${String(d)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!er(r.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),n;if(r.syntaxes){for(const[c,d]of Object.entries(r.syntaxes))if(!(!Bi(c)||d===void 0||_t(d))){if(!er(d))return t(`templateDirectives.syntaxes.${c}: expected a form or an object, configuration ignored.`),n;for(const g of["output","editor"]){const h=d[g];if(h!==void 0&&!_t(h))return t(`templateDirectives.syntaxes.${c}.${g}: unknown form "${String(h)}", configuration ignored.`),n}}}if(r.output===void 0&&r.editor===void 0&&r.syntaxes===void 0)return n;const o=r.output??Nr;let i=r.editor;o==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),i=void 0);const s=[];if(r.syntaxes)for(const c of Object.keys(r.syntaxes)){if(!Bi(c)){t(`templateDirectives.syntaxes: unknown syntax id "${c}", entry ignored.`);continue}s.push(c)}else s.push(...hl);const a={},l={};for(const c of s){const d=r.syntaxes?.[c],g=er(d)?d:void 0,h=(_t(d)?d:g?.output)??o;let y=g?.editor??i??h;h==="bare"&&y==="html-comment"&&(t(`templateDirectives.syntaxes.${c}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),y="bare"),a[c]=h,l[c]=y}return{output:a,editor:l}}function ml(e,t,n,r){for(let o=t;o<n;o++){const i=e[o];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?i===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(i)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):i==="<"?r.insideTag=!0:i===">"?r.insideTag=!1:r.insideTag&&(i==='"'||i==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=i,r.unquotedAttr=!1):r.insideTag&&/\S/.test(i)&&r.attributeQuoteChar===void 0&&e[o-1]==="="&&!['"',"'","`"].includes(i)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function At(e,t){return e.start<t.end&&t.start<e.end}function ji(e,t,n,r,o=[]){if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return[];const i=t.flatMap(d=>d.match(e).flatMap(g=>!Number.isInteger(g.start)||!Number.isInteger(g.end)||g.start<0||g.end>e.length||g.start>=g.end?[]:[{range:g,mapFn:d.mapFn,overrideBuiltins:d.overrideBuiltins,syntax:d.syntax,isVariable:d.isVariable}])).sort((d,g)=>d.range.start-g.range.start||d.range.end-g.range.end),s=[],a=o.slice().sort((d,g)=>d.start-g.start),l={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(const{range:d,mapFn:g,overrideBuiltins:h,syntax:y,isVariable:I}of i){if(r?(l.insideAttributeValue=!0,l.attributeQuoteChar='"'):ml(e,c,d.start,l),c=d.end,a.some(A=>At(A,d)))continue;const w=l.insideAttributeValue?l.attributeQuoteChar??"":void 0,b=e.substring(d.start,d.end),R=g(b,w,l.insideTag);R!==!1&&R!==b&&(s.push({range:d,text:R,overrideBuiltins:h,syntax:y,isVariable:I}),a.push(d))}return s.sort((d,g)=>d.range.start-g.range.start||d.range.end-g.range.end)}function Wv(e,t){const n=t.reduce((a,{mapFn:l,start:c,end:d,syntax:g,isVariable:h})=>(a[c]||(a[c]=[]),a[c].push({value:d,mapFn:l,syntax:g,isVariable:h}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),o=new RegExp(r,"g"),i=[];let s;for(;(s=o.exec(e))!==null;){const a=s[0];i.push({start:s.index,startToken:a,endTokens:n[a]})}return i}function tr(e,t,n,r,o=!1){const i=[];if(n&&(t=t.filter(c=>c.isVariable)),!t.length)return i;const s=Wv(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let l=0;for(let c=0;c<s.length;c++){const{start:d,startToken:g,endTokens:h}=s[c];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):ml(e,l,d,a),l=d;const y=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let I=!1;for(const{mapFn:w,value:b,syntax:R,isVariable:A}of h){let L=d+g.length,P=e.indexOf(b,L);for(;P!==-1;){let O=P,_=d+g.length,C=0;for(;O!==-1;){const p=e.indexOf(g,_);if(p!==-1&&p<O)C++,_=p+g.length,O=e.indexOf(b,_);else if(C>0)C--,_=O+b.length,O=e.indexOf(b,_);else break}if(O<0)break;const T=O+b.length,m=e.substring(d,T),f=w(m,y,a.insideTag);if(f===!1){L=P+Math.max(b.length,1),P=e.indexOf(b,L);continue}(o||f!==m)&&i.push({range:{start:d,end:T},text:o?m:f,syntax:R,isVariable:A});const u=s.findIndex(({start:p})=>p>=T);u>c?c=u-1:c=s.length,I=!0;break}if(I)break}}return i}function nn(e,t){if(!t.length)return e;const n=t.slice().sort((o,i)=>i.range.start-o.range.start);let r=e;for(const{text:o,range:i}of n)r=r.slice(0,i.start)+o+r.slice(i.end);return r}var Kv=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=pl){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,o,i,s){return t.push({start:r,end:o,mapFn:i,isVariable:s,syntax:this.syntax||r}),this},unescape(r,o,i,s){return n.push({start:r,end:o,mapFn:i,isVariable:s,syntax:this.syntax||r}),this}})}registerMatcherPair(e){const t=e.syntax||"matcher",n={syntax:t,match:e.escape.match,mapFn:e.escape.mapFn,isVariable:e.escape.isVariable,overrideBuiltins:e.escape.overrideBuiltins},r={syntax:t,match:e.unescape.match,mapFn:e.unescape.mapFn,isVariable:e.unescape.isVariable,overrideBuiltins:e.unescape.overrideBuiltins};this._escapeMatchers.push(n),this._unescapeMatchers.push(r);let o=!1;const i={dispose:()=>{o||(o=!0,this._escapeMatchers=this._escapeMatchers.filter(s=>s!==n),this._unescapeMatchers=this._unescapeMatchers.filter(s=>s!==r))}};return this.addDisposable(i),i}_collectMappings(e,t,n){const r=tr(e,this._escapes,t,n),o=ji(e,this._escapeMatchers,t,n),i=o.filter(l=>l.overrideBuiltins).map(l=>l.range),s=r.filter(l=>!i.some(c=>At(c,l.range))),a=o.filter(l=>l.overrideBuiltins||!s.some(c=>At(l.range,c.range)));return[...s,...a].sort((l,c)=>l.range.start-c.range.start||l.range.end-c.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=tr(e,this._unescapes,t),r=ji(e,this._unescapeMatchers,t,!1),o=r.filter(a=>a.overrideBuiltins).map(a=>a.range),i=n.filter(a=>!o.some(l=>At(l,a.range))),s=r.filter(a=>a.overrideBuiltins||!i.some(l=>At(a.range,l.range)));return[...i,...s].sort((a,l)=>a.range.start-l.range.start||a.range.end-l.range.end)}getRevertMappings(e,t,n){const r=n?o=>o!==void 0&&n.has(o):o=>Gv(o)==="html-comment";return this._collectRevertMappings(e,t).filter(o=>o.isVariable||!r(o.syntax))}getDetectedMappings(e,t,n){return tr(e,this._escapes,t,n,!0)}getEscapedText(e,t){return nn(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return nn(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=i=>i===void 0?void 0:t[i],r=Object.values(t);let o=e;return r.includes("bare")&&(o=nn(o,this._collectRevertMappings(o).filter(i=>n(i.syntax)==="bare"))),r.includes("html-comment")&&(o=nn(o,this._collectMappings(o).filter(i=>!i.isVariable&&n(i.syntax)==="html-comment"&&i.text.startsWith("<!--")&&i.text.endsWith("-->")))),o}hasDetectedMappings(e,t,n){return this.getDetectedMappings(e,t,n).length>0}addDisposable(e){this._disposables.push(e)}dispose(){for(const e of this._disposables)e.dispose()}};function Ui(e){return e.replace("<script","<___script").replace("<\/script>","</___script>")}var Hi=new Kv(e=>{e.escape("<script","<\/script>",t=>Ui(t)).unescape("<___script","</___script>",t=>t.replace("<___script","<script").replace("</___script>","<\/script>")),e.escape("<script","/>",t=>Ui(t)).unescape("<___script","/>",t=>t.replace("<___script","<script")),pl(e)});function Yv(e){const t=zv(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return Bs();const n=new Set(Object.keys(t.output).filter(o=>t.output[o]==="html-comment")),r=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:o=>Hi.normalizeToPolicy(o,t.editor),toOutputForm:o=>Hi.normalizeToPolicy(o,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:Fs(r)}}function Xv(e){let t;e.injectFactory(Vr,()=>{const n=e.getInstance(fe)?.layers().user.templateDirectives;return(!t||t.raw!==n)&&(t={raw:n,policy:Yv(n)}),t.policy})}var Jv=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Qv(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const o=t.get(r)??[];o.push(n),t.set(r,o)}return t}function Zv(e,t){const n=[];for(const r of e.awaits?.services??[])for(const o of t.get(r)??[])o!==e&&n.push(o);return n}function gl(e){const t=Qv(e),n=[],r=new Set,o=[],i=new Set,s=a=>{if(!r.has(a)){if(i.has(a)){const l=o.indexOf(a);throw new Jv([...o.slice(l),a].map(c=>c.name))}i.add(a),o.push(a);for(const l of Zv(a,t))s(l);o.pop(),i.delete(a),r.add(a),n.push(a)}};for(const a of e)s(a);return n}var eb=[{name:"rest.client",setup:Tg},{name:"auth.oauth",setup:uc},{name:"rest.identityHeaders",setup:mg},{name:"rest.localeHeader",setup:_g},{name:"lifetime.destroyable",provides:[_o],setup:gm},{name:"appInit",provides:[Ue,to],setup:id},{name:"config",provides:[fe],setup:hm},{name:"templateDirectives",provides:[Vr],setup:Xv},{name:"email.documents",setup:Lm},{name:"show.initPipeline",provides:[De],setup:Ag},{name:"show",setup:Rv},{name:"locale.service",provides:[gt],setup:ug},{name:"locale.fromConfig",awaits:{services:[fe,gt]},setup:fg},{name:"canvas.early",setup:ch},{name:"canvas.previewSettings",setup:Ch},{name:"canvas.sandboxExtensions",setup:Ah},{name:"canvas.sandboxScriptRelay",setup:Dh},{name:"canvas.headerSync",provides:[bo],setup:fh},{name:"canvas.headersAfterRecovery",setup:ph},{name:"canvas.ampSync",setup:mf},{name:"canvas.moduleBridge",setup:zf},{name:"canvas.port",setup:Cf},{name:"canvas.images",setup:Sf},{name:"canvas.edits",setup:ah},{name:"canvas.surfaceFollowsSession",setup:Zp},{name:"canvas.blockContent",setup:Qp},{name:"canvas.sandboxFill",provides:[vo],setup:Kh},{name:"canvas.reactions",setup:lh}],$i;function Ao(e){const t=e.getInstance(pe);if(t)return t;e.getInstance(W)||e.inject(W,new ue);const n=ge();e.inject(pe,n),$i??=gl(eb);for(const r of $i)r.setup(e);return n}function tb(e){}var nb=[{name:"save.previewFollow",setup:tb}],qi=V("plugin.lateUnitsInstalled");function rb(e){if(!e.getInstance(qi)){e.inject(qi,!0);for(const t of gl(nb))t.setup(e)}}function ob(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function ib(e){if(!e)return;const t=Qr(e)?.data,n=t?.data?.scope??t?.scope;return(Array.isArray(n)?n.flatMap(r=>typeof r=="string"?r.split(/\s+/):[]):typeof n=="string"?n.split(/\s+/):[]).find(r=>/^project_\d+$/.test(r))?.replace(/^project_/,"")||void 0}var sb=bt(e=>{let t,n,r;return{async setOptions(o){const i=r!==o.getAuthToken,s=!Pe(t,o.user),a=n!==o.project;if(r=o.getAuthToken,t=o.user,n=o.project,!(!e.getInstance(Oe)||!o.getAuthToken)&&!(!i&&!s&&!a))try{const l=await o.getAuthToken(o.user,o.project);e.inject(hc,Promise.resolve(l||""));const c=ib(l);if(!c)return;e.inject(cc,c);const d=e.getInstance(Ue),g=d?await d.catch(()=>{}):void 0;e.inject(Ue,Promise.resolve(ob(c,g)))}catch{}}}});function ab(e,t){if(e.getInstance(Fo))return;e.inject(Fo,!0);const n=Ee(e,H.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}var lb=bt(e=>{let t,n=!1;return{setOptions(r){const o=n;if(n=!0,!Ht(r)){t&&(nm(e),Eo(r)),t=void 0;return}const i=kn(r);if(!i||t===i&&e.getInstance(Oe))return;t=i,e.inject(Oe,i);const s=e.getInstance(W);s&&ab(e,s)}}}),cb=bt(e=>{const t=e.getInstance(W),n=Ee(e,bs),r=q(n),o=t.addDisposable(new ut(r));return{setOptions({handleLoad:i}){o.setListener(i)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function vl(e,t,n=!0){const r=e,o=t;for(const i of Object.keys(o)){const s=o[i];s!=null&&(n&&typeof s=="object"?r[i]=vl(r[i]||{},s,!0):r[i]=s)}return e}async function db(e){const t=(await Dc(()=>import("./static/esm/2490dab8.js").then(n=>Hl(n.default)),[],import.meta.url)).default;return new Promise((n,r)=>{t.load({google:{families:[e]},classes:!1,active:()=>n(),inactive:()=>r(new Error(`Шрифт не загрузился: ${e}`))})})}var bl=V("EditorOptions"),Fr=Ec;function ub(e){const t=typeof e.font_family=="string"?`${e.font_family}, sans-serif`:void 0,n=e.word_wrap===void 0?void 0:e.word_wrap?"on":"off";return{tabSize:e.tab_size,fontFamily:t,fontSize:e.font_size,wordWrap:n,insertSpaces:e.insert_spaces,minimap:{enabled:e.minimap}}}function fb(e){return e.getOrCreateInstance(bl,()=>{const t=ge(Fr);let n=Fr.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(db(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function pb(e){return e?.getInstance(bl)?.get()??Fr}function hb(e,t={}){const n=fb(e);n.set(vl({...n.get()},ub(t)))}function mb(e){return{font_size:e.fontSize,font_family:e.fontFamily,tab_size:e.tabSize,word_wrap:e.wordWrap,minimap:e.minimap,insert_spaces:e.insertSpaces}}function gb(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var vb=V("plugin.publicConfig");function Br(e){return e.getInstance(fe)?.get()??{}}function Vi(e){return e.getInstance(fe)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function Gi(e){const t=Fa(e),n=Br(e);return{...n,locale:n.locale||"ru_RU",theme:n.theme||"light",editor:gb(pb(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function zi(e){return e.getInstance(fe)?.get()!==void 0}function bb(e){const t=vs(),n=le(e,gs);let r,o,i=!1;const s=async()=>{try{return e.getInstance(Ue)===void 0?{}:(await e.getInstanceAsync(Ue))?.app_config||{}}catch{return{}}},a=async({onlyChangedCodeMode:g=!1}={})=>{await e.getInstance(fe)?.ready(),Cs(e).set(Br(e).revisionService===!0);const{codeModeDirection:h,editor:y}=Br(e);y&&hb(e,mb(y)),h!==void 0&&!(g&&h===o)&&(o=h,h==="none"?Tr(e,!1):(Tr(e,!0),Eh(e,h)))},l=async()=>{if(!zi(e))return;const g=Gi(e),h=JSON.stringify(g);h!==r&&(r=h,await n.fire(g))},c=async g=>{const h=e.getInstance(fe),y={advancedConfigs:Vi(e).advancedConfigs,serverSide:await s(),user:g};h?.setAdvancedConfigs({...y.advancedConfigs,...y.user?.advancedConfigs});const I=h?.layers().user.mode;h?.replace(y.user?.mode===void 0&&I!==void 0?{...y.user,mode:I}:y.user,"user"),h?.replace(y.serverSide,"server"),await a(),await l()},d=g=>{const{commonStyles:h,...y}=g;return"commonStyles"in g&&wh(e,h===void 0?void 0:h),y};return{queue:t,reactToConfig:a,emitConfigChanged:l,resolveServerSideConfig:s,getConfig:()=>zi(e)?Gi(e):{},setConfig:t.decorate(async g=>{await c(d(g))}),updateConfig:t.decorate(async g=>{const h=d(g);await c({...Vi(e).user,...h})}),announceAssembled(){i||(i=!0,e.getInstance(fe)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await l()})))}}}function yl(e){return e.getOrCreateInstance(vb,()=>bb(e))}function yb(e){const t=yl(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var Eb=bt(e=>{const t=e.getInstance(W),n=t.addDisposable(new je),r=t.addDisposable(new je),o=Bt(e,gs),i=q(n.event),s=q(r.event),a=ll(q(o.event),e),l=t.addDisposable(new ut(i)),c=t.addDisposable(new ut(s)),d=t.addDisposable(new ut(a));return{instance:{handleSetOptions:i,handleOptionsChanged:s,handleConfigChanged:a},async setOptions(g){l.setListener(g.handleSetOptions),c.setListener(g.handleOptionsChanged),d.setListener(g.handleConfigChanged),yl(e).announceAssembled(),await n.fire(g),await r.fire(g)},dispose(){}}}),nr,El="core";function _b(){const e=window.__emailmaker__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([El],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function wb(e){const t=window.__emailmaker__?.require?.warm;return typeof t!="function"?Gt().then(()=>{}):t([El],e)}function Gt(){return nr===void 0&&(nr=_b().then(e=>(kt()&&e.installDiagnostics().catch(t=>{}),e))),nr}var rr=null,or=null;async function Sb(e){typeof e?.prefetch=="function"&&await e.prefetch()}function Ro(){return rr||(rr=Gt().then(()=>{})),rr}function _l(e){return or||(or=Sb(e)),or}function Ib(){return _l(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0)}function Cb(){const e=typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function Tb(e){return Promise.all([Ro(),_l(e)]).then(()=>{})}function Ab(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function Wi(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>wb(t?{priority:t}:void 0)).then(()=>(ho(t?{priority:t}:void 0),n?Ro():void 0)).catch(()=>{})}function Rb(e){const t=Ab(e);if(t==="eager")Wi(e);else if(t==="idle"){const n=()=>Wi(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var wl="PluginRegistry";function Pb(e=oc()){return e.getOrCreateInstance(wl,()=>new Bc)}var Db=new jc(()=>Pb()),Ob=["handleAIImageRequest","handleAITextRequest","handleAnalyticsEvent","handleBlockAutosave","handleBlockChanged","handleBlockInit","handleCloneBlock","handleCloneEmail","handleCloseBlock","handleConfigChanged","handleDestroy","handleEmailAutosave","handleEmailChanged","handleEmailInit","handleError","handleFileProxy","handleHtmlChanged","handleImportValidate","handleLimitUsage","handleLivePreviewEmail","handleLoad","handleLoadImage","handleNextButtonClick","handleNotify","handleOpenBlock","handleOptionsChanged","handlePreheaderChanged","handlePreviewEmail","handlePreviousButtonClick","handleReadBlock","handleReadBlockAutosave","handleReadBlockRevisions","handleReadBlocks","handleReadComments","handleReadCommonBlocks","handleReadEmail","handleReadEmailAutosave","handleReadEmailRevisions","handleReadLocale","handleReadTemplateBlocks","handleRemoveBlock","handleRemoveBlockAutoSave","handleRemoveComment","handleRemoveEmail","handleRemoveEmailAutoSave","handleSaveBlock","handleSaveBlockButtonClick","handleSaveButtonClick","handleSaveComment","handleSaveEmail","handleSetOptions","handleShareEmail","handleSubjectChanged","handleSuccess","handleTestEmailModal","handleTestEmailSend","handleTranslate","handleUrlProxy","handleValidate"],kb=["closeBlock","compileEmail","getBlockSnapshot","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","openBlock","save","saveBlock","setConfig","show","showBlock","updateConfig","useAsync","validateCode","waitPlugin"],yn=new Map([...Ob.map(e=>[e,"event"]),...kb.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),xb=new Map([["use","use `useAsync()` or await `ready` first"]]);function Mb(e){return xb.get(e)??"await `ready` first"}var Lb=new Set(["async","queued"]),Nb=Symbol.for("emailmaker.earlyCtxPlaceholder");function Ki(e){return e[Nb]=!0,e}function Fb(e){return new Error(`[emailmaker] ${e}() is not available in a plugin constructor: the editor core is still loading. Call it from init() or later (${Mb(e)}).`)}function Bb(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function jb(e){return[...yn].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function Ub(e,t){for(const n of jb(e)){const r=yn.get(n);if(r!==void 0&&Lb.has(r)){const o=async(...i)=>{await t;const s=e[n];if(typeof s!="function"||s===o)throw Bb(n);return s.apply(e,i)};e[n]=Ki(o);continue}e[n]=Ki(()=>{throw Fb(n)})}}function Hb(e,t,n){e.getInstanceAsync(ft).then(()=>{Bt(e,H.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function $b(e,t){e.getInstanceAsync(ft).then(()=>{Bt(e,H.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_LOAD_ERROR",data:{plugin:t.name,url:t.url,message:t.error.message},innerException:t.error})},()=>{})}var qb=bt(e=>{let t;function n(){return new Promise(o=>{const i=e.getOrCreateInstance(Xr,()=>new Set),s=()=>{i.delete(s),o()};i.add(s)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(o){const i=e.getInstance(In),s=e.getInstance(wl);if(!t){t=new Fc(i,s,{ensureHostRuntimeReady:Ib,explainScriptFailure:Cb,openEarlyWindow:()=>Ev(e),reportLoadFailure:c=>$b(e,c)}),e.inject(Wr,t);const l=t.onLifecycle(c=>{c.type==="create:error"&&Hb(e,c.name,c.error)});e.getInstance(W)?.addDisposable(l)}const a=o?.plugins||[];i&&(sa(e),a.length>0&&Ub(i,n()),await t.setPlugins(a))},instance:{use(o){return typeof o=="function"?r().useByCtor(o):r().useByKey(o)},useAsync(o){return r().useAsync(o)},waitPlugin(o){return r().waitFor(o)}},dispose(){t?.dispose(),t=void 0}}}),Sl=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const o=this._listeners.indexOf(r);o>=0&&this._listeners.splice(o,1)}}}async run(e){const t=[...this._listeners].sort((n,r)=>r.priority-n.priority);for(const{fn:n}of t){const r=await n(e);r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp)&&Object.assign(e,r)}return e}},Vb=V("ELEMENT_INSERT_HTML_PIPELINE"),Gb=V("BLOCK_INSERT_HTML_PIPELINE"),zb="application_block_inserted",Wb=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Gb,()=>new Sl).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(Ut,()=>new jt),o=n?e.bind(n):e;return r.addListener(zb,o,t)}},Po=V("ComponentRegistry"),Kb=V("ComponentRegistryGate");function Do(){return pt.getOrCreateInstance(Kb,()=>({pending:[]}))}function Yb(e=Po){return Do().factory!==void 0||pt.getInstance(e)!==void 0}function jr(e,t,n=Po){if(Yb(n)){t(En(e,n));return}Do().pending.push(()=>t(En(e,n)))}function En(e,t=Po){const n=pt.getInstance(t);if(n)return n;const r=Do().factory;if(!r)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return pt.getOrCreateInstance(t,r)}var Xb=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=[];let n=!1;const r=i=>{if(!n){n=!0;for(const s of t)s.dispose();e(i)}};t.push(this._container.addService(zt,{execute:i=>{r(i.value.map(s=>({name:s.name,html:s.html})))}}));const o=this._container.getInstance(Ql)?.watch(i=>{i&&r([])});o&&(n?o.dispose():t.push(o))})}update(e,t){const n=this._container;return n.addService(zt,{execute:r=>{const o=En(n),i=r.value.find(s=>s.name===e);if(i){const{icon:s,title:a,fallbackTooltip:l,...c}=t;s&&(i.icon=o.getReactNode(s)),a&&(i.title=o.getReactNode(a)),l&&(i.fallbackTooltip=o.getReactNode(l)),Object.assign(i,c)}}})}delete(e){this._container.addService(zt,{execute:t=>{const n=t.value.findIndex(r=>r.name===e);n>=0&&t.value.splice(n,1)}})}insert(e,t){const n=this._container;return n.addService(zt,{execute:r=>{const o=En(n);r.value.splice(t??r.value.length,0,{...e,title:o.getReactNode(e.title),icon:o.getReactNode(e.icon),fallbackTooltip:o.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Vb,()=>new Sl).add(e,t??0,n)}handleInject(e,t,n){return dt(this._container,Yl).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},Jb=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(Ut,()=>new jt)}send(e,t,n){this._messageService.send(e,t,n)}sendAsync(e,t,n=!0){return this._messageService.sendAsync(e,t,n)}addListener(e,t,n){return this._messageService.addListener(e,t,n)}addListenerAsync(e,t,n=0){return this._messageService.addListenerAsync(e,t,n)}onInit(e,t=!0,n=0){return this._messageService.onInit(e,t,n)}isInited(){return this._messageService.isInited()}};function Qb(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function Yi(e,t){if(!t)return;const n=r=>r===void 0?void 0:e.getReactNode(r);return{...t,footer:n(t.footer),okText:n(t.okText),cancelText:n(t.cancelText),closeIcon:n(t.closeIcon)}}var Zb=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=dt(t,ac),this._closeModalEmitter=dt(t,Jl),this._updateModalEmitter=dt(t,sc)}get _container(){return this._context.container}show(e){const t=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n=e.modalProps;return jr(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:Yi(r,n)})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;jr(this._container,r=>{this._updateModalEmitter.fire(Qb({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:Yi(r,n)}))})}};function rn(e){return e?.surfaces?{surfaces:[...e.surfaces]}:{}}var ey=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;_readyListeners=new Set;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{this._resolveLoaded=()=>{this._loadedSettled||(this._loadedSettled=!0,n())},this._rejectLoaded=o=>{this._loadedSettled||(this._loadedSettled=!0,r(o))}}),this.ready=new Promise((n,r)=>{this._resolveReady=()=>{this._readySettled||(this._readySettled=!0,n())},this._rejectReady=o=>{this._readySettled||(this._readySettled=!0,r(o))}})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady();for(const e of Array.from(this._readyListeners))try{e()}catch{}}onReady(e){return this._readyListeners.add(e),this._readySettled&&e(),{dispose:()=>{this._readyListeners.delete(e)}}}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose(),this._loadedDisposable.dispose(),this._readyListeners.clear();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},ty=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(Ut,()=>new jt)}_createScriptHandle(e,t){const n=this._messageService.addListener(zr,o=>{if(o.key===e){if(o.phase==="load"&&o.status==="success"){r.resolveLoaded();return}if(o.phase==="ready"&&o.status==="success"){r.resolveReady();return}if(o.phase==="load"){r.rejectLoad(new Error(o.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(o.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new ey(t,n);return r}registerSandboxCSS(e,t){return this._container.addService(st,{...rn(t),type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t,n){return this._container.addService(st,{...rn(n),type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e,t){const n=this._container.addService(st,{...rn(t),type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,n)}registerSandboxScriptCode(e,t,n){const r=this._container.addService(st,{...rn(n),type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,r)}},ny=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function Ur(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&ny.has(t)}function Il(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}return`nohwcrypto-${Date.now()}`}function ir(){return`__settingsPanel:${Il()}`}function sr(e,t){return{type:e,props:t}}function ry(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!Ur(e)}function Xi(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(Ur(t)){const r=ir();return n(e.add(r,t)),sr(r,{})}if(typeof t=="function"){const r=ir();return n(e.add(r,t)),sr(r,{})}if(ry(t)){const r=t.type;if(typeof r=="string")return t;if(Ur(r)||typeof r=="function"){const o=ir();return n(e.add(o,r)),sr(o,t.props)}return t}return t}var oy=class{_context;_panelRegistrationDisposables=[];constructor(e){this._context=e}get _container(){return this._context.container}_clearPanelRegistrations(){for(const e of this._panelRegistrationDisposables)e.dispose();this._panelRegistrationDisposables.length=0}_trackRegistration(e){this._panelRegistrationDisposables.push(e)}showSettingsPanel(e){this._clearPanelRegistrations();const t=e.instanceKey??Il();jr(this._container,n=>{const r=s=>this._trackRegistration(s),o=Xi(n,e.content,r),i=e.advancedTabs?.map(s=>({...s,content:Xi(n,s.content,r)}));dt(this._container,Lo).fire({...e,content:o,advancedTabs:i,instanceKey:t,type:ic})})}closeSettingsPanel(){this._clearPanelRegistrations(),dt(this._container,Lo).fire(null)}},Cl={SandboxScriptApi:ty,ElementsApi:Xb,BlocksApi:Wb,MessageService:Jb,SettingsPanelApi:oy,ModalApi:Zb};function ar(e,t,n,r={}){const o=Object.assign({},e);for(const[i,s]of Object.entries(t))if(s!==void 0)if(n.includes(i)&&typeof s=="object"&&s!==null){const a=o[i],l=r[i]??{};o[i]=Object.assign({},typeof a=="object"&&a!==null?a:l,s)}else o[i]=s;return o}var Se={border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:5,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},borderRadiusCards:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},padding:{all:null,top:null,right:null,bottom:null,left:null}},iy={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",lineHeight:21,lineHeightDim:"px",color:"#5a5a5a",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},lr={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:24,fontSizeDim:"px",lineHeight:32,lineHeightDim:"px",color:"#333333",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},Ji={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},rt={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1C52DC",bold:!1,italic:!1,backgroundColor:"#1C52DC",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:Se.border,borderRadius:Se.borderRadius,textAlign:"center",padding:Se.padding},Qi={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:Se.padding},cr={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:Se.border,borderRadius:Se.borderRadiusCards};function sy(e){return{...iy,...e}}function ay(e){return{...lr,...e,bold:e?.bold??lr.bold,italic:e?.italic??lr.italic}}function ly(e){return{...Ji,...e,underline:e?.underline??Ji.underline}}function cy(e){return{...rt,...e,bold:e?.bold??rt.bold,italic:e?.italic??rt.italic,border:{...rt.border,...e?.border},borderRadius:{...rt.borderRadius,...e?.borderRadius},padding:{...rt.padding,...e?.padding}}}function dy(e){return{...Qi,...e,padding:{...Qi.padding,...e?.padding}}}function uy(e){return{...cr,...e,border:{...cr.border,...e?.border},borderRadius:{...cr.borderRadius,...e?.borderRadius}}}function dr(e={}){return{backgroundColor:e.backgroundColor||"",backgroundImage:(e.backgroundImage||[]).map(t=>({type:"url",value:t?.value||""})),backgroundPositionX:e.backgroundPositionX||"",backgroundPositionY:e.backgroundPositionY||"",backgroundRepeat:e.backgroundRepeat||"",backgroundSize:e.backgroundSize||"",backgroundColorContent:e.backgroundColorContent||"",textStrong:e.textStrong||!1,textItalic:e.textItalic||!1,textUnderline:e.textUnderline||!1,width:e.width,responsive:e.responsive}}function Zi(e){let t={...Jr};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function ur(e){return{text:sy(e.text),headings:ay(e.headings),links:ly(e.links),buttons:cy(e.buttons),block:dy(e.block),cards:uy(e.cards)}}var es=V("EmailSettingsPort"),fy=1e4,Tl=class{_editor;_layoutSettingsChanged=new mr;_contentStylesChanged=new mr;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentLayoutSettings()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentContentStyles()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_replayToEarlyPlugin(e,t){if(!al(this._editor.container)||!at(this._editor.container)?.current()?.get().attributes.is_inited)return;const n=t();queueMicrotask(()=>e(n))}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(es);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return dr(this._settings().read())}_getCurrentContentStyles(){const e=at(this._editor.container)?.current()?.get().attributes.common_styles;return ur(Zi(e))}_getLayoutSnapshot(e){return JSON.stringify(e)}_getContentSnapshot(e){return JSON.stringify(e)}async _ensureMessageSubscription(){if(!this._messageSubscription){if(this._messageSubscriptionPromise)return this._messageSubscriptionPromise;this._messageSubscriptionPromise=(async()=>{if(await this._editor.container.getInstanceAsync(es),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(Ut,()=>new jt),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const o=r?.data,i=o?.operation;if(i===K.APPLICATION_EMAIL_SETTINGS_SET){const l=dr(o?.settings),c=this._getLayoutSnapshot(l);c!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=c,this._layoutSettingsChanged.fire(l));return}if(i!==K.APPLICATION_COMMON_STYLES_UPDATE)return;const s=ur(r.data?.settings?.commonStyles??{...Jr}),a=this._getContentSnapshot(s);a!==this._prevContentSnapshot&&(this._prevContentSnapshot=a,this._contentStylesChanged.fire(s))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){return await this._waitForEmailSettingsFromIframe(),this._getCurrentLayoutSettings()}async setEmailLayoutSettings(e){await this._waitForEmailSettingsFromIframe();const t=this._settings(),n={...t.read(),...e};t.write(n);const r=dr(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=fy){const t=at(this._editor.container)?.current()?.get().attributes.is_inited,n=this._settings().read();if(t&&n&&Object.keys(n).length>0&&(n.backgroundColor||n.backgroundImage?.[0]?.value||n.width?.value||n.responsive!==void 0)||t)return;const r=this._editor.container,o=Ee(r,H.ON_EMAIL_INIT_ID);return new Promise(i=>{let s=!1,a;const l=()=>{a&&(clearTimeout(a),a=void 0)},c=o(()=>{s||(s=!0,l(),c.dispose(),i())});a=setTimeout(()=>{s||(s=!0,c.dispose(),i())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=at(this._editor.container)?.current();if(!t)return;const n=Zi(t.get().attributes.common_styles);e.text!==void 0&&(n.text={...n.text||{},...e.text}),e.headings!==void 0&&(n.headings={...n.headings||{},...e.headings}),e.links!==void 0&&(n.links={...n.links||{},...e.links}),e.buttons!==void 0&&(n.buttons=ar(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:Se.border,borderRadius:Se.borderRadius,padding:Se.padding})),e.block!==void 0&&(n.block=ar(n.block||{},e.block,["padding"],{padding:Se.padding})),e.cards!==void 0&&(n.cards=ar(n.cards||{},e.cards,["border","borderRadius"],{border:Se.border,borderRadius:Se.borderRadiusCards}));const r=JSON.stringify(n);ht(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const o=ur(n);this._prevContentSnapshot=this._getContentSnapshot(o),this._contentStylesChanged.fire(o)}},py={...Cl,EmailSettingsApi:Tl},hy={...Cl},b_={...hy,EmailSettingsApi:Tl},my={...py};function gy(){Db.addAll(my)}var vy=[bt(()=>{gy()}),cb,Eb,lb,mc,sb,Ic];async function by(){return(await Gt()).asyncMixins}var yy=qb,Ey=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let o;try{o=await by()}catch(s){throw e.failPendingWaits(s),s}t=o(e);const i=await e.getInstanceAsync(In);Object.assign(i,t.instance||{});for(const s of e.getInstance(Xr)??[])s()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},_y=Sc([...vy]);function fr(){let e,t=!1;const n=new Map,r=new Map;function o(){for(const i of r.values())i();r.clear()}return{event(i,s,a){const l=Symbol("subscription");return t||(n.set(l,{listener:i,priority:s,thisArg:a}),e&&r.set(l,e(i,s,a))),()=>{n.delete(l),r.get(l)?.(),r.delete(l)}},attach(i){o(),e=i;for(const[s,{listener:a,priority:l,thisArg:c}]of n)r.set(s,i(a,l,c))},dispose(){t=!0,o(),n.clear(),e=void 0}}}function wy(e){const t=fr(),n=fr(),r=fr();return e.getInstance(W)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(ft).then(o=>{t.attach(o.onNotify),n.attach(o.onError),r.attach(o.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(o){const i=e.getInstance(ft);if(i){i.notify(o);return}e.getInstanceAsync(ft).then(s=>s.notify(o),()=>{})}}}var Al=V("CodeErrors"),Sy=[];function Iy(e){return e?.getInstance(Al)?.get()??Sy}function Cy(e){return e?.getInstance(Al)!==void 0}var Ty=class extends ue{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=Vt(e),this.addDisposable(Ee(e,H.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){const e=et(this._container);if(e&&te(e.sessionKey())&&!e.hasSuspended())throw new Error("[emailmaker] no open email: only a block is shown");return nl(this._container,this._currentEmail)}async getBlocks(){const e=await this._readProjectBlocks();return await this._blockMetaWrites,(await this._dataSources.blocks.cache.values()).filter(t=>String(t.project)===String(e)).map(t=>me(t,this._container))}async _readProjectBlocks(){const e=await rl(this._container);return await this._dataSources.blocks.byForeignKey("project").get(e),e}async getComments(){const{cache:e}=this._dataSources.comments,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.post===t.id).map(n=>Tt(n,this._container))}async getEmailRevisions(){const{cache:e}=this._dataSources.emailRevisions,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.parent===t.id).map(n=>Mr(n,this._container))}async getEmailSnapshot(){return ye(this.openEmail(),this._container)}async getBlockSnapshot(){const e=et(this._container),t=e?.current();return!e||!t||!te(e.sessionKey())?null:(await t.whenReady(),me(On(t),this._container))}setEmailMeta(e){const t=Co(this._container);if(!t)return;const n=t.get().attributes.meta;ht(t,{meta:Zt({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,o=>o&&Zt(o,e))}setBlockMeta(e,t){const n=et(this._container);if(n?.sessionKey()===pn(e)){const o=n.current();o&&ht(o,{meta:Zt({meta:o.get().attributes.meta},t).meta})}const r=async()=>{await this._readProjectBlocks();const{cache:o}=this._dataSources.blocks;await o.getIfPresent(e)&&await o.addOrUpdate(e,i=>i&&Zt(i,t))};this._blockMetaWrites=this._blockMetaWrites.then(r).catch(()=>{})}getCodeErrors(){return Cy(this._container)?Iy(this._container):void 0}},Ay=V("EmailDataController");function Ry(e){return e.getOrCreateInstance(Ay,()=>{const t=new Ty(e);return e.getInstance(W)?.addDisposable(t),t})}function Py(e){const t=Ry(e);return{getEmailSnapshot:()=>t.getEmailSnapshot(),getBlockSnapshot:()=>t.getBlockSnapshot(),getCodeErrors:()=>t.getCodeErrors(),getBlocks:()=>t.getBlocks(),getComments:()=>t.getComments(),getEmailRevisions:()=>t.getEmailRevisions(),setEmailMeta:n=>t.setEmailMeta(n),setBlockMeta:(n,r)=>t.setBlockMeta(n,r)}}function Dy(e){return{undo:()=>e.undo(),redo:()=>e.redo(),clear:()=>e.clear(),canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo(),createSnapshot:()=>e.createSnapshot(),restoreSnapshot:t=>{e.restoreSnapshot(t)},getPast:t=>e.getPast(t).map(n=>({changes:n})),getFuture:t=>e.getFuture(t).map(n=>({changes:n}))}}function Oy(e){let t;const n=qa(e),r=Ee(e,H.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:i})=>{t=i}));const o=()=>t?Dy(t):void 0;return{undoRedoService:{undo:()=>o()?.undo(),redo:()=>o()?.redo(),clear:()=>o()?.clear(),getPast:i=>o()?.getPast(i)??[],getFuture:i=>o()?.getFuture(i)??[],canUndo:()=>o()?.canUndo()??!1,canRedo:()=>o()?.canRedo()??!1,createSnapshot:()=>o()?.createSnapshot(),restoreSnapshot:i=>o()?.restoreSnapshot(i)}}}var ky=V("plugin.mountElement");function xy(e){const t=e.getInstance(pe)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function My(e){return e.getOrCreateInstance(ky,()=>{let t=!1,n;return{get:()=>t?n:xy(e),set(r){t=!0,n=r}}})}function Ly(e){const t=My(e);return{getElement:()=>t.get()}}function Ny(e){return{handleLoadImage:q(Ee(e,H.UPLOAD_EVENT_ID)),handleFileProxy:q(Ee(e,H.FILE_PROXY_EVENT_ID)),handleUrlProxy:q(Ee(e,H.PROXY_URL_EVENT_ID)),handleAITextRequest:q(Ee(e,H.AI_TEXT_REQUEST_ID)),handleAIImageRequest:q(Ee(e,H.AI_IMAGE_REQUEST_ID)),handleReadLocale:q(Ee(e,H.READ_LOCALE)),handleLimitUsage:q(Ee(e,H.ON_LIMIT_ID)),handleTranslate:q(Ee(e,H.ON_TRANSLATE_ID))}}var Fy=[vm,Pv,wy,yb,Py,Oy,Ly,Ny];function By(e,t=Fy){const n=Ao(e);rb(e);const r=_y(e),o=yy(e),i=Ey(e),s={...r.instance,...o.instance,...i.instance};for(const l of t)Object.assign(s,l(e));let a=!0;return{instance:s,async setOptions(l){await r.setOptions(l);const c=a&&n.get()===l;a=!1,c||n.set(l),await o.setOptions(l),await i.setOptions(l)}}}function jy(e){return{get:t=>e.get(t),remove:(t,n)=>e.remove(t,n),set:(t,n,r)=>{if(n==null){e.get(t),e.remove(t,r);return}e.set(t,n,r)}}}var Uy=class{_storage=Object.create(null);get(e){const t=this._storage[e];return t&&(!t.expires||t.expires<Date.now())?t.value:""}set(e,t,n){this._storage[e]={value:t,expires:n.expires?n.expires*1e3+Date.now():void 0}}remove(e){delete this._storage[e]}},Hy="editor-runtime.react.copies",pr=8;function Mt(e){return e&&typeof e=="object"?e:void 0}function ts(e){const t=Mt(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=Mt(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function $y(e){const t=Mt(e),n=t&&typeof t.version=="string"?t.version:void 0,r=Mt(t?.default),o=r&&typeof r.version=="string"?r.version:void 0;return n??o??"unknown"}function qy(e,t,n){return e.package===t&&e.version===n}function Vy({ourReact:e,entries:t,packageName:n,version:r}){const o=ts(e);if(!o||!Array.isArray(t))return[];const i=[],s=new Set;for(const a of t){const l=Mt(a);if(!l||!qy(l,n,r))continue;const c=ts(l.react);!c||c===o||s.has(c)||(s.add(c),i.push({package:n,version:r,reactVersion:$y(l.react),react:l.react}))}return i}function Gy({packageName:e,copies:t}){const n=[`[${e}] A second copy of React is on this page (singleton invariant broken).`,`The editor runs on its own React, the plugin got another one from ${e}/runtime/react.`,`This shows up as "Cannot read properties of null (reading 'useState')" and takes down the whole`,"editor, not just the plugin panel: plugin components render inside the editor tree.","","Found:"];for(const r of t.slice(0,pr))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>pr&&n.push(` …and ${t.length-pr} more`),n.push("","Likely root cause: the editor is loaded from its UMD entry (a <script> on the page), while the","plugin was built as an ESM package by the host bundler. Those two never share a React.","","Fix it either way:"," • build the plugin on globals — it then takes React from the page registry, or"," • load the editor from its ESM entry and build both with the same bundler."),n.join(`
1048
- `)}var ns=new Set;function zy({packageName:e="@emailmaker/emailmaker",version:t="1.2.3",log:n=r=>{}}={}){const r=o=>{try{const i=globalThis[Symbol.for(Hy)],s=Vy({ourReact:o,entries:i,packageName:e,version:t}).filter(a=>!ns.has(a.react));if(!s.length)return;s.forEach(a=>ns.add(a.react)),n(Gy({packageName:e,copies:s}))}catch{}};try{const o=eo()?.modules?.React;if(o&&typeof o.then=="function"){o.then(r,()=>{});return}r(o)}catch{}}async function Wy(e,t,n){ee(e.signal);const r=t??pt.createChild();Ao(r);const o=r.getInstance(W);let i;async function s(){r.inject(ms,jy(new Uy)),zy();const a=By(r),l={...a.instance,container:r,get ready(){return i??Promise.resolve(l)},async reset(c){if(ee(c.signal),o.isDisposed())throw Be();return await a.setOptions(c),l}};r.inject(In,l);try{if(n?.onInstance?.(l),await a.setOptions(e),ee(e.signal),o.isDisposed()||await Tv(r),e.devTools)try{const c=r.getInstance(Wr);c&&await(await Gt()).initDevTools(r,c)}catch{}return ee(e.signal),Bt(r,bs).fire(l),l}catch(c){throw o.dispose(),c}}try{return i=un(s(),e.signal),i.catch(()=>{}),await i}catch(a){throw o.isDisposed()||o.dispose(),a}}var Lt=new WeakMap;function Ky(e){return e?Lt.get(e):void 0}function Rl(e){try{e.getInstance(W)?.dispose()}catch{}try{e.dispose()}catch{}}function Yy(e,t){if(!e)return;const n=Lt.get(e);n&&n!==t&&Rl(n),Lt.set(e,t)}function Xy(e,t){e&&Lt.get(e)===t&&Lt.delete(e)}function Jy(e){const t=pt.createChild();return Ht(e)&&t.inject(Oe,kn(e)),t}var Ot=new WeakMap,Qy="data-emailmaker-config-styles";function Zy(e){return typeof e=="string"?e.trim():""}function rs(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function eE(e,t,n){if(!e||typeof document>"u")return null;const r=Zy(t),o=Ot.get(e),i=n||e;if(!r)return o&&(o.remove(),Ot.delete(e)),null;if(o)return o.textContent!==r&&(o.textContent=r),(o.parentNode!==i||o!==i.firstChild)&&rs(i,o),o;const s=document.createElement("style");return s.setAttribute(Qy,"true"),s.textContent=r,rs(i,s),Ot.set(e,s),s}function tE(e){if(!e)return;const t=Ot.get(e);t&&(t.remove(),Ot.delete(e))}function Pl(){return!1}var nE=`
1047
+ `)}function Vi(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function _v(e,t,n,r){const o=wv(e,t,n,r);return o===void 0}function wv(e,t,n,r){if(Ln(t))return"block";const{email:o}=Nn(t,!1),i=bt(o,e),s=i.id;if(s===void 0)return"no-id";if(r!==void 0&&r!==s)return"other-id-shown";const a=tt(e)?.current();if(!a)return"no-session";const l=a.get(),c=l.attributes;if(l.serverId!==s)return"document-id";if(c.is_inited!==!0)return"not-inited";const d=Vi(Br(n??a.getContent()));if(i.html!==void 0&&Vi(Br(i.html))!==d)return"html";if(i.subject!==void 0&&i.subject!==c.subject)return"subject";if(i.preheader!==void 0&&i.preheader!==c.preheader)return"preheader";if(i.common_styles!==void 0&&i.common_styles!==c.common_styles)return"common_styles"}function qi(e,t){if(Ln(t))return;const{email:n}=Nn(t,!1),r=bt(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:Br(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function Sv(e){return Array.isArray(e)?e.some(t=>Sr(t)):Sr(e)}function Iv(e){const t={...e};delete t.wpId,delete t.secretHash,delete t.projectCategories;for(const n of["author","folder","project"])Sv(t[n])&&delete t[n];return t}function Cv(e,t){const n={...e};return delete n.id,{...n,...t}}function Tv(e){return e.html?e:{...e,html:hl}}function Je({code:e,project:t,...n},r,o){const i=o??Ro(r);return{...n,...e?{html:Ve(r).toEditorForm(e)}:{},renderGuid:Ce(),...i===void 0?{}:{project:i}}}function be({html:e,renderGuid:t,...n},r){const{requested:o}=Gt(r);return Le({...n,code:Ve(r).toOutputForm(e),project:o===void 0?n.project:o,guid:void 0,link:void 0,status:void 0,slug:void 0,password:void 0,comment_status:void 0,template:void 0,blocktags:void 0,project_title:void 0,ping_status:void 0,lock:void 0,tag:void 0,is_template:void 0})}function bl(e){return tt(e)?.current()?.get().serverId??void 0}function jr(e,t,n){return n===void 0&&(n=e.post===void 0?bl(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function Tt(e,t){return Le({...e,link:void 0,comment_status:void 0})}function dn({code:e,autosave:t,...n},r,o){return o===void 0&&(o=n.parent===void 0?bl(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||Ou(n.slug),parent:o}}function Ur({html:e,isAutosave:t,...n},r){return Le({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:Le({html:e,ampHtml:e&&""})})}function un({code:e,autosave:t,...n},r){return{...n,...e?{html:e}:{},isAutosave:t===!0,parent:r??n.parent}}function Gi({html:e,isAutosave:t,...n}){return Le({...n,autosave:t?!0:void 0,code:e,guid:void 0})}var pt=z("NotificationService"),Av=z("emailTemplate.reads");async function Rv(e,t){try{const n=nt(e);return await(n.template?n.template(e):n.email(e)).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,Dv(e,t,n);return}}var Pv=z("emailTemplate.notifiedFailures");function Dv(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(Pv,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(pt).then(()=>{Ut(e,q.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Ov(e,t){const n=e.getOrCreateInstance(Av,()=>new Map),r=n.get(t);if(r!==void 0)return r;const o=Rv(e,t).then(i=>(i===void 0&&n.delete(t),i));return n.set(t,o),o}var er="EXTERNAL",zi=Symbol("supersededShow");function kv(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var xv="email_id";function tr(e){return Object.entries(e).some(([t,n])=>t!=="id"&&n!==void 0)}async function Mv(e,t){const n=An();let r;try{return await Promise.race([e,new Promise((o,i)=>{r=setTimeout(()=>{e.then(t,()=>{}),i(new Rn(n,"handleSaveBlock","block"))},n)})])}finally{clearTimeout(r)}}var Lv=class extends he{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_latestShow=Promise.resolve();_dataSources;_eventLock;_queue=Ps();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=zt(t),this._eventLock=vv(t);const n=Q(e,q.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(Q(e,q.OPEN_BLOCK_REQUEST_ID)(r=>this.openBlock(r))),this.addDisposable(e.addService(Cn,{execute:(r,o)=>{!o?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(xv,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(xe)??wo}_throwIfDestroyed(){if(this.isDisposed())throw je()}async getTemplateEmail(e){const t=await Ov(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,Iv(n)}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await Ct(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,Je(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(o=>o.id!==void 0).map(o=>[o.id,dn(o,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(o=>o.id!==void 0).map(o=>[o.id,jr(o,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,o){const i=this._dataSources.emails,s=i.cache,a=await Ct(this._container),l=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let c=bt(e,this._container);const d=c.id;let m=d;if(d!==void 0){const h=await i.get(d);c={...h??{},...c,utm_parameters:c.utm_parameters??h?.utm_parameters??{},renderGuid:h?.renderGuid??Ce(),...l>0?{showToken:l}:{},...o?{showId:o}:{},project:a}}else{m=n??Ce();const h=await i.get(m);c={...c,utm_parameters:c.utm_parameters??{},renderGuid:h?.renderGuid??Ce(),...l>0?{showToken:l}:{},...o?{showId:o}:{},project:a},delete c.project}if(t){const h=await this.getTemplateEmail(String(t));h&&(c=Cv(h,c))}return d===void 0&&(c=Tv(c)),await s.setAll([[m,c]]),c}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==qi(this._container,e))return!1;const n=cn(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=qi(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:cn(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&bv({ticket:t,emailId:Hi(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,zi;if(!e)return;const n=this._getInitPipeline();if(ne(n.signal),Ln(e))return this._showBlock(e,n);const r=re(fe(this._container).sessionKey()),o=yv(e);if(!r&&!o&&_v(this._container,e,cn(this._container),this._prevCommand?.id)||!r&&!o&&this._isRepeatOfLastShow(e))return;const i=Nn(e);i.email.id,this._prevCommand?.id;let s,a="",l=0,c=!1,d,m=Promise.resolve(),h,E=!1;try{this._eventLock.suspendChange();const{email:w,blocks:_,autosaves:b,comments:T,templateId:A,reload:B}=i;s=w.id;const O=bt(w,this._container),k=O.id,C=k??Ce(),R=await Xe("getProject",Ct(this._container));ne(n.signal),a=Ce();const I={isNew:k===void 0,id:String(C),project:R},g=B===!0&&k!==void 0;g&&(await this._dataSources.emails.remove(String(k),{silent:!0}),String(k)),l=++this._showToken,String(C);const p=[];p.push(this.setBlocks(_)),w.id!==void 0&&(p.push(this.setComments(T)),p.push(this.setEmailRevisions(b,String(w.id)))),p.push(this.setEmail(w,Sr(A)?A:Number(A),k===void 0?String(C):void 0,l,a)),await Xe("setEmail+blocks+revisions",Promise.all(p),{emailId:k??String(C),showId:a,targetShowToken:l}),ne(n.signal);const u=await this._dataSources.emails.get(String(C)),f=fe(this._container),P={id:a,token:l};if(r){ln(this._container);const S=f.suspendedDocument()?.get().serverId;!g&&k!==void 0&&S!=null&&String(S)===String(k)&&f.resumeSuspended()}k===void 0?h=f.startNewDraft(u??O,{patch:O,show:P}):g?h=f.reload(k,{email:u??O,patch:O,show:P}):f.sessionKey()===it(k)?h=f.show(O,P):h=f.open(k,{email:u??O,patch:O,show:P}),f.beginShowFill(a);const M=!!this._prevCommand&&ke(this._prevCommand,I);I.id,!this._prevCommand||ke(this._prevCommand,I),this._prevCommand?.id,this._rememberShow(I),m=n.requestShow({showId:a,navId:String(C),emailId:k,isNew:k===void 0}),E=!0;const y=()=>f.endShowFill(a);Promise.allSettled([m,h.whenReady()]).then(y),String(C),c=!0}catch(w){d=w,E&&a&&n.failShow(a,w),a&&tt(this._container)?.endShowFill(a),Jr(w)||(Gs(w),void 0)}finally{this._eventLock.resumeChange()}if(!c)throw d instanceof Error?d:new Error(`[emailmaker] show() setup failed: ${String(d??"unknown error")}`);return Xe("show-init-deferred",Promise.all([m,h?.whenReady().catch(w=>{if(w instanceof et){const _=go(w);throw _?new Error(`[emailmaker] show(): email open failed (${_})`,{cause:w}):w}})??Promise.resolve()]).then(()=>{}),{showId:a,emailId:s??null}).then(()=>{this._rememberShownContent(e)})}async _showBlock(e,t){const{block:n,byId:r,blocks:o,revisions:i,reload:s}=gv(e),a=Ce();let l=!1;try{await this.setBlocks(o),ne(t.signal),s&&(await this._dataSources.blocks.remove(String(n.id),{silent:!0}),this._dataSources.blocks.byForeignKey("project").clear(),String(n.id));const c=n.id!==void 0&&n.id!==""?String(n.id):void 0,d=fe(this._container);if(!s&&c!==void 0&&d.sessionKey()===mn(c)){const A=tr(n)?await this._storeShownBlock(n):void 0,B={id:a,token:++this._showToken},O=d.show(A,B),k=t.requestShow({showId:a,navId:c,emailId:void 0,isNew:!1});l=!0,await Xe("show-block-init",Promise.all([k,O?.whenReady().catch(()=>{})]),{showId:a});return}const m=r||s?await Ui(this._container,String(n.id)):void 0,h=m&&(s||tr(n))?await this._storeShownBlock({...be(m,this._container),...n}):r||s?m:await this._storeShownBlock(n);if(ne(t.signal),!h)throw new Error(`[emailmaker] show(): block ${String(n.id)} not found`);i!==void 0&&h.id!==void 0&&await this._dataSources.blocksRevision.cache.setAll(i.filter(A=>A.id!==void 0).map(A=>[A.id,un(A,String(h.id))])),this._prevCommand=void 0,this._lastShow=void 0;const E=h.id!==void 0?String(h.id):Ce(),w={id:a,token:++this._showToken};ln(this._container);const _=s?d.reloadBlock(E,h,w):d.openBlock(E,h,w);h.id;const b=t.requestShow({showId:a,navId:E,emailId:void 0,isNew:h.id===void 0});l=!0;const T=_.whenReady().catch(A=>{if(A instanceof et)throw A});await Xe("show-block-init",Promise.all([b,T]),{showId:a})}catch(c){throw l&&t.failShow(a,c),c}}async _storeShownBlock(e){const t=Je(e,this._container,await Ct(this._container));return t.id!==void 0&&await this._dataSources.blocks.cache.add(t.id,t),t}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();ne(e.signal);const t=fe(this._container);if(re(t.sessionKey())&&!t.hasSuspended())throw new Error("[emailmaker] save(): no open email — a block is open, use saveBlock()");const n=await t.saveEmail("publish",{source:er,fallbackTitle:Ta(this._container)});if(ne(e.signal),!n)throw kv(t.emailSaveState().error);return Se(gl(this._container,this._currentEmail),this._container)}async _saveBlock(){this._throwIfDestroyed();const e=fe(this._container),t=e.current();if(!t||!re(e.sessionKey()))throw new Error("[emailmaker] saveBlock(): no open block");return Ev(t,async()=>{await t.whenReady();const n=xn(t),r=t.get().version,o={title:n.title,project:n.project,type:n.type??"Other",description:n.description,html:n.html,blocktags:n.blocktags,...n.meta?{meta:n.meta}:{}},i=this._dataSources.blocks,s=await Mv(t.get().serverId==null?i.create(o,{source:er}):i.update(String(t.get().serverId),o,{source:er}),a=>{a&&fe(this._container).current()===t&&t.get().serverId==null&&a.id!==void 0&&t.markSaved(r,String(a.id))});if(!s)throw new Error("[emailmaker] save(): block was not saved");return t.markSaved(r,s.id!==void 0?String(s.id):void 0),be(s,this._container)})}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;this._latestShowEmailId=Hi(e);const n=this._queuedShow(e,t).then(r=>r===zi?this._latestShow.catch(()=>{}):void 0);return this._latestShow=n,n};_queuedSave=this._queue.decorate(()=>this._save(),this);save=()=>this._queuedSave();_queuedSaveBlock=this._queue.decorate(()=>this._saveBlock(),this);saveBlock=()=>this._queuedSaveBlock();showBlock=(e,t={})=>this.show({...t,block:e});async _openBlock(e){this._throwIfDestroyed(),ne(this._getInitPipeline().signal);const t=typeof e=="string"?{id:e}:e,n=t.id!==void 0&&t.id!==""?String(t.id):void 0,r=fe(this._container);if(n!==void 0&&r.sessionKey()===mn(n))return;const o=t.code===void 0&&n!==void 0?await Ui(this._container,n):void 0,i=o&&tr(t)?await this._storeShownBlock({...be(o,this._container),...t}):t.code===void 0&&n!==void 0?o:await this._storeShownBlock(t);if(!i)throw new Error(`[emailmaker] openBlock(): block ${String(n)} not found`);ln(this._container);const s=r.openBlockOver(i.id!==void 0?String(i.id):Ce(),i);i.id,r.hasSuspended(),ue(this._container,q.ON_BLOCK_OPEN_ID).fire({block:i}),await s.whenReady().catch(a=>{if(a instanceof et)throw r.current()===s&&(ue(this._container,q.ON_BLOCK_CLOSE_ID).fire({block:i,hasUnsavedChanges:!1}),r.resumeSuspended()),a})}async _closeBlock(){this._throwIfDestroyed(),Ch(this._container)}_queuedOpenBlock=this._queue.decorate(e=>this._openBlock(e),this);_queuedCloseBlock=this._queue.decorate(()=>this._closeBlock(),this);openBlock=e=>this._queuedOpenBlock(e);closeBlock=()=>this._queuedCloseBlock()};function Nv(e){return String(e).replace(/"/g,"&quot;")}function Fv(e=new Date){const t=n=>String(n).padStart(2,"0");return String(e.getFullYear())+t(e.getMonth()+1)+t(e.getDate())+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}function Bv(e){const t=/<(table|tr|div)(\s[^>]*)>/gi;let n;for(;(n=t.exec(e))!==null;){const r=n[2]??"";if(/\bem\s*=\s*["']block["']/i.test(r))return{full:n[0],index:n.index}}return null}function Wi(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),o=Nv(n);return r.test(e)?e.replace(r,`${t}="${o}"`):e.replace(/>$/,` ${t}="${o}">`)}function jv(e,t,n){if(!e?.trim()||!t)return e;const r=Bv(e);if(!r)return e;const o=String(t),i=Fv(n??new Date);let{full:s,index:a}=r;const l=s.length;return/\bem-block-id\s*=/.test(s)||(s=Wi(s,"em-block-id",o)),s=Wi(s,"em-block-version",i),e.slice(0,a)+s+e.slice(a+l)}function Uv(e){if(e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object")return e.meta;const t=e.catalogExtra?.meta;if(t!=null&&typeof t=="object")return t}function Hv(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),o=t?.project??(e.project!==void 0&&e.project!==null?String(e.project):void 0);return{type:t?.type??n,insertFrom:n,name:t?.name??e.name,blockId:r,project:o,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:Uv(e)}}function nr(e,t){return t?Hv(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var yl=["title","slug","type","tags","blocktags","modified","author","lock","subject","description","excerpt","status","is_template","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author","isAmp","meta"],$v=[...yl,"html","id","project","password"],Z_=new Set(["html",...yl,"global_block","project"]);function Vv(e){if(!e||typeof e!="object")return{};const t={};e.id!=null&&e.id!==""&&(t.id=String(e.id)),e.title!=null&&e.title!==""&&(t.title=e.title),e.slug!=null&&e.slug!==""&&(t.slug=e.slug),e.type!=null&&e.type!==""&&(t.type=e.type),e.tags!=null&&(t.tags=e.tags),e.blocktags!=null&&(t.blocktags=e.blocktags),e.modified!=null&&e.modified!==""&&(t.modified=e.modified),e.author!=null&&e.author!==""&&(t.author=String(e.author)),e.lock!=null&&(t.lock=e.lock),e.subject!=null&&e.subject!==""&&(t.subject=e.subject),e.description!=null&&e.description!==""&&(t.description=e.description),e.excerpt!=null&&e.excerpt!==""&&(t.excerpt=e.excerpt),e.status!=null&&e.status!==""&&(t.status=e.status),e.is_template!=null&&(t.is_template=e.is_template),e.link!=null&&e.link!==""&&(t.link=e.link),e.renderGuid!=null&&e.renderGuid!==""&&(t.renderGuid=e.renderGuid),e.date!=null&&e.date!==""&&(t.date=e.date),e.date_gmt!=null&&e.date_gmt!==""&&(t.date_gmt=e.date_gmt),e.modified_gmt!=null&&e.modified_gmt!==""&&(t.modified_gmt=e.modified_gmt),e.comment_status!=null&&e.comment_status!==""&&(t.comment_status=e.comment_status),e.ping_status!=null&&e.ping_status!==""&&(t.ping_status=e.ping_status),e.template!=null&&e.template!==""&&(t.template=e.template),e.related_email!=null&&e.related_email!==""&&(t.related_email=e.related_email),e.project_title!=null&&e.project_title!==""&&(t.project_title=e.project_title),e.project_author!=null&&e.project_author!==""&&(t.project_author=e.project_author),e.isAmp!=null&&(t.isAmp=e.isAmp),e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object"&&(t.meta=e.meta);const n=new Set($v),r={};for(const o of Object.keys(e))n.has(o)||(r[o]=e[o]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function qv(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...Vv(e),html:typeof e.html=="string"?e.html:"",insertFrom:t.type,name:t.name,project:t.project??e.project,id:e.id!=null&&e.id!==""?String(e.id):t.blockId}}var Hr=new WeakMap;function Gv(e){let t=Hr.get(e);return t||(t={byId:new Map,fallback:[]},Hr.set(e,t)),t}function zv(e){Hr.delete(e)}function Wv(e,t){const{byId:n,fallback:r}=Gv(t);if(e.blockId){const o=n.get(e.blockId);if(o){n.delete(e.blockId);const i=r.indexOf(o);return i>=0&&r.splice(i,1),o}return}for(let o=r.length-1;o>=0;o--){const i=r[o],s=e.name!=null&&e.name!==""&&i.name!=null&&i.name!==""&&i.name===e.name,a=e.type!=null&&e.type!==""&&i.insertFrom===e.type;if(s&&a)return r.splice(o,1),i.id!=null&&i.id!==""&&n.delete(String(i.id)),i}}async function Kv(e,t){const{blocks:n}=zt(e);return await n.cache.getIfPresent(t)??void 0}async function Yv(e,t){if(!t.blockId)return;const n=await Kv(e,t.blockId);if(n)return qv(n,t)}async function Xv(e,t){const n=Wv(e,t);if(n)return nr(e,n);const r=await Yv(t,e);return r?nr(e,r):nr(e,void 0)}var Jv=Os("application_block_inserted"),Qv=-1e3,Ki=new WeakSet;function Zv(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.type=="string"||typeof t.name=="string"||typeof t.blockId=="string"||typeof t.project=="string"||typeof t.project=="number"}function eb(e){if(!e||Ki.has(e))return;Ki.add(e);const t=new he,n=de(e);return t.addDisposable(n.addListenerAsyncPipe(Jv,async(r,o)=>{const i=Zv(r)?await Xv(r,e):r;return o?o(i):i},Qv)),t.addDisposable({dispose:()=>{zv(e)}}),t}var tb=kn("plugin.readBlockAutosave"),ew=z("blockDocuments.provided"),El=z("plugin.earlyWindow");function nb(e){return e.getOrCreateInstance(El,()=>({depth:0}))}function rb(e){const t=nb(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function _l(e){return(e?.getInstance(El)?.depth??0)>0}function wl(e,t){let n,r=!1;return e(o=>{n=o,r=!0}),(o,i,s)=>{const a=e(o,i,s);if(r&&_l(t)){const l=n;queueMicrotask(()=>{o.call(s,l)})}return a}}var rr=100,ob=class extends he{_container;_events;constructor(e){super(),this._container=e;const t=eb(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:o,blocksRevision:i}=zt(e),s=Q(e,q.ON_SHARE_ID),a=Q(e,q.ON_SHOW_PREVIEW_ID),l=Q(e,q.ON_EMAIL_CLONE_ID),c=Q(e,q.ON_BLOCK_OPEN_ID),d=Q(e,q.ON_BLOCK_CLOSE_ID),m=Q(e,q.ON_BLOCK_CLONE_ID),h=Q(e,q.ON_BLOCK_INIT_ID),E=Q(e,q.ON_BLOCK_CHANGED_ID),w=Q(e,q.ON_CODE_VALIDATE_ID),_=Q(e,q.ON_IMPORT_VALIDATE_ID),b=Q(e,q.ON_SUBJECT_CHANGED_ID),T=Q(e,q.ON_EMAIL_CHANGED_ID),A=Q(e,q.ON_PREHEADER_CHANGED_ID),B=Q(e,q.ON_SAVEBUTTON_CLICK_ID),O=Q(e,q.ON_BLOCK_SAVEBUTTON_CLICK_ID),k=Q(e,q.ON_NEXTBUTTON_CLICK_ID),C=Q(e,q.ON_SEND_LIVEPREVIEW_ID),R=Q(e,q.ON_SEND_TESTEMAIL_ID),I=Q(e,fv),g=Q(e,q.ON_CONTENT_CHANGED_ID),p=Q(e,uv),u=Q(e,q.ON_PREVIOUSBUTTON_CLICK_ID),f=Q(e,q.ON_SEND_EMAIL_MODAL_ID),P=fc(Q(e,q.ON_EMAIL_INIT_ID),y=>!y.reset),M=Q(e,q.ON_ANALYTICS_EVENT);return{handlePreheaderChanged:G(A),handleSubjectChanged:G(b),handleValidate:G(w),handleImportValidate:G(_),handleReadEmail:G(n.handlerRead,y=>y,y=>y&&bt(y,e)),handleSaveEmail:G(n.onSave,function({prev:y,patch:S,value:F,source:V}){const v=y?Se(y,e):void 0;return{prev:v,patch:Ot(v,Se(S,e)),value:Se(F,e),source:V}},y=>y?bt(y,e):void 0),handleRemoveEmail:G(n.onRemove,({value:y,source:S})=>({value:Se(y,e),source:S}),()=>{}),handleReadCommonBlocks:G(I,y=>y.project,y=>y?.map(S=>Je(S,e))),handleReadTemplateBlocks:G(p,y=>y,y=>y?.map(S=>Je(S,e))),handleReadBlocks:G(t.byForeignKey("project").handleRead,y=>Gt(e).requested||String(y),y=>y?.map(S=>Je(S,e))),handleReadBlock:G(t.handlerRead,y=>y,y=>y?Je(y,e):void 0),handleOpenBlock:G(c,({block:y})=>({block:be(y,e)})),handleCloseBlock:G(d,({block:y,hasUnsavedChanges:S})=>({block:be(y,e),hasUnsavedChanges:S})),handleCloneBlock:G(m,y=>be(y,e)),handleSaveBlock:G(t.onSave,function({prev:y,patch:S,value:F,source:V}){const v=F.global_block===!0&&F.id&&typeof F.html=="string"?{...F,html:jv(F.html,String(F.id))}:F,x=y?be(y,e):void 0;return{prev:x,patch:Ot(x,be(S,e)),value:be(v,e),source:V}},y=>y?Je(y,e):void 0),handleRemoveBlock:G(t.onRemove,({value:y,source:S})=>({value:be(y,e),source:S}),()=>{}),handleReadComments:G(r.byForeignKey("post").handleRead,y=>y,y=>y?.map(S=>jr(S,e))),handleSaveComment:G(r.onSave,function({prev:y,patch:S,value:F,source:V}){const v=y?Tt(y,e):void 0;return{prev:v,patch:Ot(v,Tt(S,e)),value:Tt(F,e),source:V}},y=>y?jr(y,e):void 0),handleRemoveComment:G(r.onRemove,({value:y,source:S})=>({value:Tt(y,e),source:S}),()=>{}),handleReadEmailRevisions:G(o.byForeignKey("parent").handleRead,y=>y,y=>y?.map(S=>dn(S,e))),handleReadEmailAutosave:G(Q(e,sl),y=>y,y=>y?dn(y,e):null),handleEmailAutosave:G(o.onSave,function({prev:y,patch:S,value:F,source:V}){return{value:Ur(F,e),source:V}},y=>y?dn(y,e):void 0),handleRemoveEmailAutoSave:G(o.onRemove,({value:y,source:S})=>({value:Ur(y,e),source:S}),()=>{}),handleReadBlockRevisions:G(i.byForeignKey("parent").handleRead,y=>y,y=>y?.map(S=>un(S))),handleReadBlockAutosave:G(Q(e,tb),y=>y,y=>y?un(y):null),handleBlockAutosave:G(i.onSave,({value:y,source:S})=>({value:Gi(y),source:S}),y=>y?un(y):void 0),handleRemoveBlockAutoSave:G(i.onRemove,({value:y,source:S})=>({value:Gi(y),source:S}),()=>{}),handleBlockInit:G(h,y=>be(y,e)),handleBlockChanged:G(Hn(E,rr),y=>be(y,e)),handleEmailChanged:G(Hn(T,rr),y=>Se(y,e)),handleEmailInit:wl(G(P,y=>Se(y,e)),e),handlePreviousButtonClick:G(u,y=>Se(y,e)),handleNextButtonClick:G(k,y=>Se(y,e)),handleSaveButtonClick:G(B,y=>Se(y,e)),handleSaveBlockButtonClick:G(O,y=>be(y,e)),handleHtmlChanged:G(Hn(g,rr)),handleTestEmailSend:G(R,({html:y,...S})=>({...S,code:y,compiled:{html:y,ampHtml:""}})),handleTestEmailModal:G(f,y=>Se(y,e)),handleCloneEmail:G(l,y=>Se(y,e)),handleShareEmail:G(s),handlePreviewEmail:G(a),handleLivePreviewEmail:G(C),handleAnalyticsEvent:G(M)}}get(){return this._events||(this._events=this._get())}_listenersUpdaters;setOptions(e={}){const t=this.get();let n=this._listenersUpdaters;if(!n){n=this._listenersUpdaters={};for(const r of Object.keys(t))n[r]=this.addDisposable(new ft(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},ib=z("DataController"),sb=z("DataEvents");function Sl(e){return e.getOrCreateInstance(ib,()=>{const t=new Lv(e);return e.getInstance(Y)?.addDisposable(t),t})}function Il(e){return e.getOrCreateInstance(sb,()=>new ob(e))}var ab=z("plugin.pluginStart");function Cl(e){return e.getOrCreateInstance(ab,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(Y)?.addDispose(()=>t()),{done:n,finish:t}})}function lb(e){return Cl(e).done}function cb(e){const t=Cl(e);return t.run===void 0&&(t.run=(e.getInstance(to)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var db=z("plugin.startupShow");function ub(e){const t=Sl(e),n=Il(e),r=e.getInstance(ge),o=e.getInstance(Y),i={current:Promise.resolve()};e.inject(db,i);let s=!1;const a=r?.watch(c=>{c&&n.setOptions(c),s=(c?.plugins?.length??0)>0,i.current=i.current.catch(()=>{})}),l=r?.select(c=>c?.content).watch(c=>{if(c===void 0)return;const d=()=>(oe(pe.showStart),t.show(c).finally(()=>oe(pe.showEnd))),m=s?lb(e).then(d):d();m.catch(()=>{}),i.current=m});a&&o?.addDisposable(a),l&&o?.addDisposable(l)}function fb(e){const t=Sl(e);return{...Il(e).get(),show(n){return oe(pe.showStart),t.show(n).finally(()=>oe(pe.showEnd))},openBlock(n){return t.openBlock(n)},closeBlock(){return t.closeBlock()},showBlock(n,r){return oe(pe.showStart),t.showBlock(n,r).finally(()=>oe(pe.showEnd))},save(){return t.save()},saveBlock(){return t.saveBlock()}}}function Tl(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function Fn(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",o=!1;for(let i=t;i<e.length;i++){const s=e[i];if(o){o=!1;continue}if(s==="\\"){o=!0;continue}if(r){s===r&&(r="");continue}if(s==='"'||s==="'"){r=s;continue}if(s==="("){n++;continue}if(s===")"&&(n--,n<0))return!1}return n===0}function pb(e){return(t,n,r)=>Fn(t)?e(t,n,r):!1}function hb(e){return t=>Fn(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function mb(e){return(t,n,r)=>Fn(t)?Tl(t)?e(t,n,r):t:!1}function gb(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return Fn(n)?Tl(n)?e(t):t:!1}}function vb(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function ko(e,t){const n=e.length;for(let r=0;r<n;r++){const o=e.charCodeAt(r);if(o===0||t==='"'&&o===34||t==="'"&&o===39||t===""&&(o===32||o===9||o===10||o===13||o===12||o===34||o===39||o===60||o===62||o===61||o===96))return!1}return!0}function bb(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let o="";for(let i=0;i<e;i++){const s=r[i]%62;o+=t.charAt(s)}return o}var yb=8,Eb=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=bb(yb),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},Bn=new Eb;function Yi(e,t){return t!==void 0&&!ko(e,t)?`%|{${Bn.getOrCreateByKey(e)}}|%`:e}function _b(e){const t=Bn.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function ae(e,t,n){return t!==void 0?ko(e,t)?e:`%|{${Bn.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function wb(e){return e.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}function ie(e){return e.startsWith("<!--")&&e.endsWith("-->")?wb(e.slice(4,-3)):e}function Sb(e){const t=/^(IF|ELSE|ELSIF|ELSEIF|END|FOREACH|WHILE|NEXT|LAST|BREAK|DO|UNLESS|CONTINUE|SET|UNSET|DEFINE|INCLUDE)\b/i,n=/\w+\s*\(/;let r=e;const o=e.match(/\[%\s*([^%]*?)\s*%\]/);o&&(r=o[1]);const i=r.trim();return t.test(i)||n.test(i)}function Ib(e,t,n){return t!==void 0?ko(e,t)?e:`%|{${Bn.getOrCreateByKey(e)}}|%`:n||vb(e)||Sb(e)?`<!--${e}-->`:e}var We=pb(ae),Ke=hb(ie),Cb=mb(ae),Tb=gb(ie),Al=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",_b),e.escape("@{","}",ae,!0).unescape("<!--@{","}-->",ie,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",Yi,!0),e.escape("{{","}}",Yi,!0),e.createSyntax("brace-percent").escape("{%","%}",ae).unescape("<!--{%","%}-->",ie),e.createSyntax("brace-hash").escape("{#","#}",ae).unescape("<!--{#","#}-->",ie),e.createSyntax("proscript").escape("[%","%]",Ib,!0).unescape("<!--[%","%]-->",ie,!0),e.createSyntax("getresponse").escape("[[IF","]]",ae).escape("[[if","]]",ae).escape("[[ELSE]]","",ae).escape("[[else]]","",ae).escape("[[ENDIF]]","",ae).escape("[[endif]]","",ae).unescape("<!--[[IF","]]-->",ie).unescape("<!--[[if","]]-->",ie).unescape("<!--[[ELSE]]","-->",ie).unescape("<!--[[else]]","-->",ie).unescape("<!--[[ENDIF]]","-->",ie).unescape("<!--[[endif]]","-->",ie),e.createSyntax("expert-sender").escape("<if",">",ae).escape("</if",">",ae).escape("<else",">",ae).escape("</else",">",ae).escape("<var ",">",ae,!0).unescape("<!--<if ",">-->",ie).unescape("<!--</if",">-->",ie).unescape("<!--<else ",">-->",ie).unescape("<!--</else",">-->",ie).unescape("<!--<var",">-->",ie,!0),e.createSyntax("velocity").escape("#if",")",We).escape("#elseif",")",We).escape("#else","",ae).escape("#foreach",")",We).escape("#macro",")",We).escape("#set",")",Cb,!0).escape("#parse",")",We).escape("#include",")",We).escape("#evaluate",")",We).escape("#end","",ae).escape("#break","",ae).escape("#stop","",ae).unescape("<!--#macro","-->",Ke).unescape("<!--#if","-->",Ke).unescape("<!--#elseif","-->",Ke).unescape("<!--#else","-->",ie).unescape("<!--#foreach","-->",Ke).unescape("<!--#parse","-->",Ke).unescape("<!--#include","-->",Ke).unescape("<!--#evaluate","-->",Ke).unescape("<!--#end","-->",ie).unescape("<!--#break","-->",ie).unescape("<!--#stop","-->",ie).unescape("<!--#set","-->",Tb,!0),e.createSyntax("mailchimp").escape("*|","|*",ae).unescape("<!--*|","|*-->",ie)},$r="bare",Ab=new Map;function Rb(e){return e?Ab.get(e)??$r:$r}var Rl=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function Xi(e){return Rl.includes(e)}function _t(e){return e==="bare"||e==="html-comment"}function or(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Pb(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!_t(e))return t(`templateDirectives: unknown form "${String(e)}", falling back to the default ("bare").`),n;r={output:e}}else if(typeof e=="object"&&!Array.isArray(e))r=e;else return t(`templateDirectives: expected a string or an object, got ${typeof e}. Ignored.`),n;for(const[c,d]of[["output",r.output],["editor",r.editor]])if(d!==void 0&&!_t(d))return t(`templateDirectives.${c}: unknown form "${String(d)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!or(r.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),n;if(r.syntaxes){for(const[c,d]of Object.entries(r.syntaxes))if(!(!Xi(c)||d===void 0||_t(d))){if(!or(d))return t(`templateDirectives.syntaxes.${c}: expected a form or an object, configuration ignored.`),n;for(const m of["output","editor"]){const h=d[m];if(h!==void 0&&!_t(h))return t(`templateDirectives.syntaxes.${c}.${m}: unknown form "${String(h)}", configuration ignored.`),n}}}if(r.output===void 0&&r.editor===void 0&&r.syntaxes===void 0)return n;const o=r.output??$r;let i=r.editor;o==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),i=void 0);const s=[];if(r.syntaxes)for(const c of Object.keys(r.syntaxes)){if(!Xi(c)){t(`templateDirectives.syntaxes: unknown syntax id "${c}", entry ignored.`);continue}s.push(c)}else s.push(...Rl);const a={},l={};for(const c of s){const d=r.syntaxes?.[c],m=or(d)?d:void 0,h=(_t(d)?d:m?.output)??o;let E=m?.editor??i??h;h==="bare"&&E==="html-comment"&&(t(`templateDirectives.syntaxes.${c}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),E="bare"),a[c]=h,l[c]=E}return{output:a,editor:l}}function Pl(e,t,n,r){for(let o=t;o<n;o++){const i=e[o];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?i===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(i)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):i==="<"?r.insideTag=!0:i===">"?r.insideTag=!1:r.insideTag&&(i==='"'||i==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=i,r.unquotedAttr=!1):r.insideTag&&/\S/.test(i)&&r.attributeQuoteChar===void 0&&e[o-1]==="="&&!['"',"'","`"].includes(i)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function At(e,t){return e.start<t.end&&t.start<e.end}function Ji(e,t,n,r,o=[]){if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return[];const i=t.flatMap(d=>d.match(e).flatMap(m=>!Number.isInteger(m.start)||!Number.isInteger(m.end)||m.start<0||m.end>e.length||m.start>=m.end?[]:[{range:m,mapFn:d.mapFn,overrideBuiltins:d.overrideBuiltins,syntax:d.syntax,isVariable:d.isVariable}])).sort((d,m)=>d.range.start-m.range.start||d.range.end-m.range.end),s=[],a=o.slice().sort((d,m)=>d.start-m.start),l={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(const{range:d,mapFn:m,overrideBuiltins:h,syntax:E,isVariable:w}of i){if(r?(l.insideAttributeValue=!0,l.attributeQuoteChar='"'):Pl(e,c,d.start,l),c=d.end,a.some(A=>At(A,d)))continue;const _=l.insideAttributeValue?l.attributeQuoteChar??"":void 0,b=e.substring(d.start,d.end),T=m(b,_,l.insideTag);T!==!1&&T!==b&&(s.push({range:d,text:T,overrideBuiltins:h,syntax:E,isVariable:w}),a.push(d))}return s.sort((d,m)=>d.range.start-m.range.start||d.range.end-m.range.end)}function Db(e,t){const n=t.reduce((a,{mapFn:l,start:c,end:d,syntax:m,isVariable:h})=>(a[c]||(a[c]=[]),a[c].push({value:d,mapFn:l,syntax:m,isVariable:h}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),o=new RegExp(r,"g"),i=[];let s;for(;(s=o.exec(e))!==null;){const a=s[0];i.push({start:s.index,startToken:a,endTokens:n[a]})}return i}function ir(e,t,n,r,o=!1){const i=[];if(n&&(t=t.filter(c=>c.isVariable)),!t.length)return i;const s=Db(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let l=0;for(let c=0;c<s.length;c++){const{start:d,startToken:m,endTokens:h}=s[c];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):Pl(e,l,d,a),l=d;const E=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let w=!1;for(const{mapFn:_,value:b,syntax:T,isVariable:A}of h){let B=d+m.length,O=e.indexOf(b,B);for(;O!==-1;){let k=O,C=d+m.length,R=0;for(;k!==-1;){const f=e.indexOf(m,C);if(f!==-1&&f<k)R++,C=f+m.length,k=e.indexOf(b,C);else if(R>0)R--,C=k+b.length,k=e.indexOf(b,C);else break}if(k<0)break;const I=k+b.length,g=e.substring(d,I),p=_(g,E,a.insideTag);if(p===!1){B=O+Math.max(b.length,1),O=e.indexOf(b,B);continue}(o||p!==g)&&i.push({range:{start:d,end:I},text:o?g:p,syntax:T,isVariable:A});const u=s.findIndex(({start:f})=>f>=I);u>c?c=u-1:c=s.length,w=!0;break}if(w)break}}return i}function on(e,t){if(!t.length)return e;const n=t.slice().sort((o,i)=>i.range.start-o.range.start);let r=e;for(const{text:o,range:i}of n)r=r.slice(0,i.start)+o+r.slice(i.end);return r}var Ob=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=Al){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,o,i,s){return t.push({start:r,end:o,mapFn:i,isVariable:s,syntax:this.syntax||r}),this},unescape(r,o,i,s){return n.push({start:r,end:o,mapFn:i,isVariable:s,syntax:this.syntax||r}),this}})}registerMatcherPair(e){const t=e.syntax||"matcher",n={syntax:t,match:e.escape.match,mapFn:e.escape.mapFn,isVariable:e.escape.isVariable,overrideBuiltins:e.escape.overrideBuiltins},r={syntax:t,match:e.unescape.match,mapFn:e.unescape.mapFn,isVariable:e.unescape.isVariable,overrideBuiltins:e.unescape.overrideBuiltins};this._escapeMatchers.push(n),this._unescapeMatchers.push(r);let o=!1;const i={dispose:()=>{o||(o=!0,this._escapeMatchers=this._escapeMatchers.filter(s=>s!==n),this._unescapeMatchers=this._unescapeMatchers.filter(s=>s!==r))}};return this.addDisposable(i),i}_collectMappings(e,t,n){const r=ir(e,this._escapes,t,n),o=Ji(e,this._escapeMatchers,t,n),i=o.filter(l=>l.overrideBuiltins).map(l=>l.range),s=r.filter(l=>!i.some(c=>At(c,l.range))),a=o.filter(l=>l.overrideBuiltins||!s.some(c=>At(l.range,c.range)));return[...s,...a].sort((l,c)=>l.range.start-c.range.start||l.range.end-c.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=ir(e,this._unescapes,t),r=Ji(e,this._unescapeMatchers,t,!1),o=r.filter(a=>a.overrideBuiltins).map(a=>a.range),i=n.filter(a=>!o.some(l=>At(l,a.range))),s=r.filter(a=>a.overrideBuiltins||!i.some(l=>At(a.range,l.range)));return[...i,...s].sort((a,l)=>a.range.start-l.range.start||a.range.end-l.range.end)}getRevertMappings(e,t,n){const r=n?o=>o!==void 0&&n.has(o):o=>Rb(o)==="html-comment";return this._collectRevertMappings(e,t).filter(o=>o.isVariable||!r(o.syntax))}getDetectedMappings(e,t,n){return ir(e,this._escapes,t,n,!0)}getEscapedText(e,t){return on(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return on(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=i=>i===void 0?void 0:t[i],r=Object.values(t);let o=e;return r.includes("bare")&&(o=on(o,this._collectRevertMappings(o).filter(i=>n(i.syntax)==="bare"))),r.includes("html-comment")&&(o=on(o,this._collectMappings(o).filter(i=>!i.isVariable&&n(i.syntax)==="html-comment"&&i.text.startsWith("<!--")&&i.text.endsWith("-->")))),o}hasDetectedMappings(e,t,n){return this.getDetectedMappings(e,t,n).length>0}addDisposable(e){this._disposables.push(e)}dispose(){for(const e of this._disposables)e.dispose()}},Dl="em___script",Rt=`<${Dl}`,Vr=`</${Dl}>`;function Qi(e){return e.replace("<script",Rt).replace("<\/script>",Vr)}var Zi=new Ob(e=>{e.escape("<script","<\/script>",t=>Qi(t)).unescape(Rt,Vr,t=>t.replace(Rt,"<script").replace(Vr,"<\/script>")),e.escape("<script","/>",t=>Qi(t)).unescape(Rt,"/>",t=>t.replace(Rt,"<script")),Al(e)});function kb(e){const t=Pb(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return Js();const n=new Set(Object.keys(t.output).filter(o=>t.output[o]==="html-comment")),r=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:o=>Zi.normalizeToPolicy(o,t.editor),toOutputForm:o=>Zi.normalizeToPolicy(o,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:Xs(r)}}function xb(e){let t;e.injectFactory(Qr,()=>{const n=e.getInstance(me)?.layers().user.templateDirectives;return(!t||t.raw!==n)&&(t={raw:n,policy:kb(n)}),t.policy})}var Mb=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Lb(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const o=t.get(r)??[];o.push(n),t.set(r,o)}return t}function Nb(e,t){const n=[];for(const r of e.awaits?.services??[])for(const o of t.get(r)??[])o!==e&&n.push(o);return n}function Ol(e){const t=Lb(e),n=[],r=new Set,o=[],i=new Set,s=a=>{if(!r.has(a)){if(i.has(a)){const l=o.indexOf(a);throw new Mb([...o.slice(l),a].map(c=>c.name))}i.add(a),o.push(a);for(const l of Nb(a,t))s(l);o.pop(),i.delete(a),r.add(a),n.push(a)}};for(const a of e)s(a);return n}var Fb=[{name:"rest.client",setup:av},{name:"auth.oauth",setup:qc},{name:"rest.identityHeaders",setup:Xg},{name:"rest.localeHeader",setup:nv},{name:"lifetime.destroyable",provides:[Ao],setup:Jm},{name:"appInit",provides:[He,lo],setup:Id},{name:"config",provides:[me],setup:Ym},{name:"templateDirectives",provides:[Qr],setup:xb},{name:"email.documents",setup:gg},{name:"show.initPipeline",provides:[xe],setup:lv},{name:"show",setup:ub},{name:"locale.service",provides:[vt],setup:zg},{name:"locale.fromConfig",awaits:{services:[me,vt]},setup:Wg},{name:"canvas.early",setup:qh},{name:"canvas.previewSettings",setup:sm},{name:"canvas.sandboxExtensions",setup:lm},{name:"canvas.sandboxScriptRelay",setup:um},{name:"canvas.headerSync",provides:[Io],setup:Wh},{name:"canvas.headersAfterRecovery",setup:Kh},{name:"canvas.ampSync",setup:Vf},{name:"canvas.moduleBridge",setup:Ep},{name:"canvas.port",setup:Zf},{name:"canvas.images",setup:Jf},{name:"canvas.edits",setup:$h},{name:"canvas.surfaceFollowsSession",setup:Ah},{name:"canvas.blockContent",setup:Th},{name:"canvas.sandboxFill",provides:[So],setup:Pm},{name:"canvas.reactions",setup:Vh}],es;function xo(e){const t=e.getInstance(ge);if(t)return t;e.getInstance(Y)||e.inject(Y,new he);const n=ye();e.inject(ge,n),es??=Ol(Fb);for(const r of es)r.setup(e);return n}function Bb(e){}var jb=[{name:"save.previewFollow",setup:Bb}],ts=z("plugin.lateUnitsInstalled");function Ub(e){if(!e.getInstance(ts)){e.inject(ts,!0);for(const t of Ol(jb))t.setup(e)}}function Hb(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function $b(e){if(!e)return;const t=eo(e)?.data,n=t?.data?.scope??t?.scope;return(Array.isArray(n)?n.flatMap(r=>typeof r=="string"?r.split(/\s+/):[]):typeof n=="string"?n.split(/\s+/):[]).find(r=>/^project_\d+$/.test(r))?.replace(/^project_/,"")||void 0}var Vb=yt(e=>{let t,n,r;return{async setOptions(o){const i=r!==o.getAuthToken,s=!ke(t,o.user),a=n!==o.project;if(r=o.getAuthToken,t=o.user,n=o.project,!(!e.getInstance(Me)||!o.getAuthToken)&&!(!i&&!s&&!a))try{const l=await o.getAuthToken(o.user,o.project);e.inject(Ac,Promise.resolve(l||""));const c=$b(l);if(!c)return;e.inject(yc,c);const d=e.getInstance(He),m=d?await d.catch(()=>{}):void 0;e.inject(He,Promise.resolve(Hb(c,m)))}catch{}}}});function qb(e,t){if(e.getInstance(Vo))return;e.inject(Vo,!0);const n=Ie(e,q.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}var Gb=yt(e=>{let t,n=!1;return{setOptions(r){const o=n;if(n=!0,!Vt(r)){t&&(Fm(e),To(r)),t=void 0;return}const i=Mn(r);if(!i||t===i&&e.getInstance(Me))return;t=i,e.inject(Me,i);const s=e.getInstance(Y);s&&qb(e,s)}}}),zb=yt(e=>{const t=e.getInstance(Y),n=Ie(e,Ds),r=G(n),o=t.addDisposable(new ft(r));return{setOptions({handleLoad:i}){o.setListener(i)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function kl(e,t,n=!0){const r=e,o=t;for(const i of Object.keys(o)){const s=o[i];s!=null&&(n&&typeof s=="object"?r[i]=kl(r[i]||{},s,!0):r[i]=s)}return e}async function Wb(e){const t=(await Yc(()=>import("./static/esm/2490dab8.js").then(n=>nc(n.default)),[],import.meta.url)).default;return new Promise((n,r)=>{t.load({google:{families:[e]},classes:!1,active:()=>n(),inactive:()=>r(new Error(`Шрифт не загрузился: ${e}`))})})}var xl=z("EditorOptions"),qr=Oc;function Kb(e){const t=typeof e.font_family=="string"?`${e.font_family}, sans-serif`:void 0,n=e.word_wrap===void 0?void 0:e.word_wrap?"on":"off";return{tabSize:e.tab_size,fontFamily:t,fontSize:e.font_size,wordWrap:n,insertSpaces:e.insert_spaces,minimap:{enabled:e.minimap}}}function Yb(e){return e.getOrCreateInstance(xl,()=>{const t=ye(qr);let n=qr.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(Wb(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function Xb(e){return e?.getInstance(xl)?.get()??qr}function Jb(e,t={}){const n=Yb(e);n.set(kl({...n.get()},Kb(t)))}function Qb(e){return{font_size:e.fontSize,font_family:e.fontFamily,tab_size:e.tabSize,word_wrap:e.wordWrap,minimap:e.minimap,insert_spaces:e.insertSpaces}}function Zb(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var ey=z("plugin.publicConfig");function Gr(e){return e.getInstance(me)?.get()??{}}function ns(e){return e.getInstance(me)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function rs(e){const t=Ja(e),n=Gr(e);return{...n,locale:n.locale||"ru_RU",theme:n.theme||"light",editor:Zb(Xb(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function os(e){return e.getInstance(me)?.get()!==void 0}function ty(e){const t=Ps(),n=ue(e,ks);let r,o,i=!1;const s=async()=>{try{return e.getInstance(He)===void 0?{}:(await e.getInstanceAsync(He))?.app_config||{}}catch{return{}}},a=async({onlyChangedCodeMode:m=!1}={})=>{await e.getInstance(me)?.ready(),Fs(e).set(Gr(e).revisionService===!0);const{codeModeDirection:h,editor:E}=Gr(e);E&&Jb(e,Qb(E)),h!==void 0&&!(m&&h===o)&&(o=h,h==="none"?kr(e,!1):(kr(e,!0),tm(e,h)))},l=async()=>{if(!os(e))return;const m=rs(e),h=JSON.stringify(m);h!==r&&(r=h,await n.fire(m))},c=async m=>{const h=e.getInstance(me),E={advancedConfigs:ns(e).advancedConfigs,serverSide:await s(),user:m};h?.setAdvancedConfigs({...E.advancedConfigs,...E.user?.advancedConfigs});const w=h?.layers().user.mode;h?.replace(E.user?.mode===void 0&&w!==void 0?{...E.user,mode:w}:E.user,"user"),h?.replace(E.serverSide,"server"),await a(),await l()},d=m=>{const{commonStyles:h,...E}=m;return"commonStyles"in m&&rm(e,h===void 0?void 0:h),E};return{queue:t,reactToConfig:a,emitConfigChanged:l,resolveServerSideConfig:s,getConfig:()=>os(e)?rs(e):{},setConfig:t.decorate(async m=>{await c(d(m))}),updateConfig:t.decorate(async m=>{const h=d(m);await c({...ns(e).user,...h})}),announceAssembled(){i||(i=!0,e.getInstance(me)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await l()})))}}}function Ml(e){return e.getOrCreateInstance(ey,()=>ty(e))}function ny(e){const t=Ml(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var ry=yt(e=>{const t=e.getInstance(Y),n=t.addDisposable(new Ue),r=t.addDisposable(new Ue),o=Ut(e,ks),i=G(n.event),s=G(r.event),a=wl(G(o.event),e),l=t.addDisposable(new ft(i)),c=t.addDisposable(new ft(s)),d=t.addDisposable(new ft(a));return{instance:{handleSetOptions:i,handleOptionsChanged:s,handleConfigChanged:a},async setOptions(m){l.setListener(m.handleSetOptions),c.setListener(m.handleOptionsChanged),d.setListener(m.handleConfigChanged),Ml(e).announceAssembled(),await n.fire(m),await r.fire(m)},dispose(){}}}),sr,Ll="core";function oy(){const e=window.__emailmaker__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([Ll],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function iy(e){const t=window.__emailmaker__?.require?.warm;return typeof t!="function"?Wt().then(()=>{}):t([Ll],e)}function Wt(){return sr===void 0&&(sr=oy().then(e=>(xt()&&e.installDiagnostics().catch(t=>{}),e))),sr}var ar=null,lr=null;async function sy(e){typeof e?.prefetch=="function"&&await e.prefetch()}function Mo(){return ar||(ar=Wt().then(()=>{})),ar}function Nl(e){return lr||(lr=sy(e)),lr}function ay(){return Nl(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0)}function ly(){const e=typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function cy(e){return Promise.all([Mo(),Nl(e)]).then(()=>{})}function dy(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function is(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>iy(t?{priority:t}:void 0)).then(()=>(Eo(t?{priority:t}:void 0),n?Mo():void 0)).catch(()=>{})}function uy(e){const t=dy(e);if(t==="eager")is(e);else if(t==="idle"){const n=()=>is(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var Fl="PluginRegistry";function fy(e=Ec()){return e.getOrCreateInstance(Fl,()=>new rd)}var py=new od(()=>fy()),hy=["handleAIImageRequest","handleAITextRequest","handleAnalyticsEvent","handleBlockAutosave","handleBlockChanged","handleBlockInit","handleCloneBlock","handleCloneEmail","handleCloseBlock","handleConfigChanged","handleDestroy","handleEmailAutosave","handleEmailChanged","handleEmailInit","handleError","handleFileProxy","handleHtmlChanged","handleImportValidate","handleLimitUsage","handleLivePreviewEmail","handleLoad","handleLoadImage","handleNextButtonClick","handleNotify","handleOpenBlock","handleOptionsChanged","handlePreheaderChanged","handlePreviewEmail","handlePreviousButtonClick","handleReadBlock","handleReadBlockAutosave","handleReadBlockRevisions","handleReadBlocks","handleReadComments","handleReadCommonBlocks","handleReadEmail","handleReadEmailAutosave","handleReadEmailRevisions","handleReadLocale","handleReadTemplateBlocks","handleRemoveBlock","handleRemoveBlockAutoSave","handleRemoveComment","handleRemoveEmail","handleRemoveEmailAutoSave","handleSaveBlock","handleSaveBlockButtonClick","handleSaveButtonClick","handleSaveComment","handleSaveEmail","handleSetOptions","handleShareEmail","handleSubjectChanged","handleSuccess","handleTestEmailModal","handleTestEmailSend","handleTranslate","handleUrlProxy","handleValidate"],my=["closeBlock","compileEmail","getBlockSnapshot","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","openBlock","save","saveBlock","setConfig","show","showBlock","updateConfig","useAsync","validateCode","waitPlugin"],_n=new Map([...hy.map(e=>[e,"event"]),...my.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),gy=new Map([["use","use `useAsync()` or await `ready` first"]]);function vy(e){return gy.get(e)??"await `ready` first"}var by=new Set(["async","queued"]),yy=Symbol.for("emailmaker.earlyCtxPlaceholder");function ss(e){return e[yy]=!0,e}function Ey(e){return new Error(`[emailmaker] ${e}() is not available in a plugin constructor: the editor core is still loading. Call it from init() or later (${vy(e)}).`)}function _y(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function wy(e){return[..._n].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function Sy(e,t){for(const n of wy(e)){const r=_n.get(n);if(r!==void 0&&by.has(r)){const o=async(...i)=>{await t;const s=e[n];if(typeof s!="function"||s===o)throw _y(n);return s.apply(e,i)};e[n]=ss(o);continue}e[n]=ss(()=>{throw Ey(n)})}}function Iy(e,t,n){e.getInstanceAsync(pt).then(()=>{Ut(e,q.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function Cy(e,t){e.getInstanceAsync(pt).then(()=>{Ut(e,q.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_LOAD_ERROR",data:{plugin:t.name,url:t.url,message:t.error.message},innerException:t.error})},()=>{})}var Ty=yt(e=>{let t;function n(){return new Promise(o=>{const i=e.getOrCreateInstance(oo,()=>new Set),s=()=>{i.delete(s),o()};i.add(s)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(o){const i=e.getInstance(Tn),s=e.getInstance(Fl);if(!t){t=new nd(i,s,{ensureHostRuntimeReady:ay,explainScriptFailure:ly,openEarlyWindow:()=>rb(e),reportLoadFailure:c=>Cy(e,c)}),e.inject(to,t);const l=t.onLifecycle(c=>{c.type==="create:error"&&Iy(e,c.name,c.error)});e.getInstance(Y)?.addDisposable(l)}const a=o?.plugins||[];i&&(Ea(e),a.length>0&&Sy(i,n()),await t.setPlugins(a))},instance:{use(o){return typeof o=="function"?r().useByCtor(o):r().useByKey(o)},useAsync(o){return r().useAsync(o)},waitPlugin(o){return r().waitFor(o)}},dispose(){t?.dispose(),t=void 0}}}),Bl=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const o=this._listeners.indexOf(r);o>=0&&this._listeners.splice(o,1)}}}async run(e){const t=[...this._listeners].sort((n,r)=>r.priority-n.priority);for(const{fn:n}of t){const r=await n(e);r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp)&&Object.assign(e,r)}return e}},Ay=z("ELEMENT_INSERT_HTML_PIPELINE"),Ry=z("BLOCK_INSERT_HTML_PIPELINE"),Py="application_block_inserted",Dy=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Ry,()=>new Bl).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(Ht,()=>new $t),o=n?e.bind(n):e;return r.addListener(Py,o,t)}},Lo=z("ComponentRegistry"),Oy=z("ComponentRegistryGate");function No(){return ht.getOrCreateInstance(Oy,()=>({pending:[]}))}function ky(e=Lo){return No().factory!==void 0||ht.getInstance(e)!==void 0}function zr(e,t,n=Lo){if(ky(n)){t(wn(e,n));return}No().pending.push(()=>t(wn(e,n)))}function wn(e,t=Lo){const n=ht.getInstance(t);if(n)return n;const r=No().factory;if(!r)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return ht.getOrCreateInstance(t,r)}var xy=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=[];let n=!1;const r=i=>{if(!n){n=!0;for(const s of t)s.dispose();e(i)}};t.push(this._container.addService(Kt,{execute:i=>{r(i.value.map(s=>({name:s.name,html:s.html})))}}));const o=this._container.getInstance(Sc)?.watch(i=>{i&&r([])});o&&(n?o.dispose():t.push(o))})}update(e,t){const n=this._container;return n.addService(Kt,{execute:r=>{const o=wn(n),i=r.value.find(s=>s.name===e);if(i){const{icon:s,title:a,fallbackTooltip:l,...c}=t;s&&(i.icon=o.getReactNode(s)),a&&(i.title=o.getReactNode(a)),l&&(i.fallbackTooltip=o.getReactNode(l)),Object.assign(i,c)}}})}delete(e){this._container.addService(Kt,{execute:t=>{const n=t.value.findIndex(r=>r.name===e);n>=0&&t.value.splice(n,1)}})}insert(e,t){const n=this._container;return n.addService(Kt,{execute:r=>{const o=wn(n);r.value.splice(t??r.value.length,0,{...e,title:o.getReactNode(e.title),icon:o.getReactNode(e.icon),fallbackTooltip:o.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Ay,()=>new Bl).add(e,t??0,n)}handleInject(e,t,n){return ut(this._container,Ic).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},My=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(Ht,()=>new $t)}send(e,t,n){this._messageService.send(e,t,n)}sendAsync(e,t,n=!0){return this._messageService.sendAsync(e,t,n)}addListener(e,t,n){return this._messageService.addListener(e,t,n)}addListenerAsync(e,t,n=0){return this._messageService.addListenerAsync(e,t,n)}onInit(e,t=!0,n=0){return this._messageService.onInit(e,t,n)}isInited(){return this._messageService.isInited()}};function Ly(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function as(e,t){if(!t)return;const n=r=>r===void 0?void 0:e.getReactNode(r);return{...t,footer:n(t.footer),okText:n(t.okText),cancelText:n(t.cancelText),closeIcon:n(t.closeIcon)}}var Ny=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=ut(t,rc),this._closeModalEmitter=ut(t,gc),this._updateModalEmitter=ut(t,Pc)}get _container(){return this._context.container}show(e){const t=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n=e.modalProps;return zr(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:as(r,n)})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;zr(this._container,r=>{this._updateModalEmitter.fire(Ly({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:as(r,n)}))})}};function sn(e){return e?.surfaces?{surfaces:[...e.surfaces]}:{}}var Fy=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;_readyListeners=new Set;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{this._resolveLoaded=()=>{this._loadedSettled||(this._loadedSettled=!0,n())},this._rejectLoaded=o=>{this._loadedSettled||(this._loadedSettled=!0,r(o))}}),this.ready=new Promise((n,r)=>{this._resolveReady=()=>{this._readySettled||(this._readySettled=!0,n())},this._rejectReady=o=>{this._readySettled||(this._readySettled=!0,r(o))}})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady();for(const e of Array.from(this._readyListeners))try{e()}catch{}}onReady(e){return this._readyListeners.add(e),this._readySettled&&e(),{dispose:()=>{this._readyListeners.delete(e)}}}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose(),this._loadedDisposable.dispose(),this._readyListeners.clear();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},By=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(Ht,()=>new $t)}_createScriptHandle(e,t){const n=this._messageService.addListener(io,o=>{if(o.key===e){if(o.phase==="load"&&o.status==="success"){r.resolveLoaded();return}if(o.phase==="ready"&&o.status==="success"){r.resolveReady();return}if(o.phase==="load"){r.rejectLoad(new Error(o.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(o.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new Fy(t,n);return r}registerSandboxCSS(e,t){return this._container.addService(at,{...sn(t),type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t,n){return this._container.addService(at,{...sn(n),type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e,t){const n=this._container.addService(at,{...sn(t),type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,n)}registerSandboxScriptCode(e,t,n){const r=this._container.addService(at,{...sn(n),type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,r)}},jy=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function Wr(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&jy.has(t)}function jl(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}return`nohwcrypto-${Date.now()}`}function cr(){return`__settingsPanel:${jl()}`}function dr(e,t){return{type:e,props:t}}function Uy(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!Wr(e)}function ls(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(Wr(t)){const r=cr();return n(e.add(r,t)),dr(r,{})}if(typeof t=="function"){const r=cr();return n(e.add(r,t)),dr(r,{})}if(Uy(t)){const r=t.type;if(typeof r=="string")return t;if(Wr(r)||typeof r=="function"){const o=cr();return n(e.add(o,r)),dr(o,t.props)}return t}return t}var Hy=class{_context;_panelRegistrationDisposables=[];constructor(e){this._context=e}get _container(){return this._context.container}_clearPanelRegistrations(){for(const e of this._panelRegistrationDisposables)e.dispose();this._panelRegistrationDisposables.length=0}_trackRegistration(e){this._panelRegistrationDisposables.push(e)}showSettingsPanel(e){this._clearPanelRegistrations();const t=e.instanceKey??jl();zr(this._container,n=>{const r=s=>this._trackRegistration(s),o=ls(n,e.content,r),i=e.advancedTabs?.map(s=>({...s,content:ls(n,s.content,r)}));ut(this._container,$o).fire({...e,content:o,advancedTabs:i,instanceKey:t,type:Hc})})}closeSettingsPanel(){this._clearPanelRegistrations(),ut(this._container,$o).fire(null)}},Ul={SandboxScriptApi:By,ElementsApi:xy,BlocksApi:Dy,MessageService:My,SettingsPanelApi:Hy,ModalApi:Ny};function ur(e,t,n,r={}){const o=Object.assign({},e);for(const[i,s]of Object.entries(t))if(s!==void 0)if(n.includes(i)&&typeof s=="object"&&s!==null){const a=o[i],l=r[i]??{};o[i]=Object.assign({},typeof a=="object"&&a!==null?a:l,s)}else o[i]=s;return o}var Ae={border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:5,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},borderRadiusCards:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},padding:{all:null,top:null,right:null,bottom:null,left:null}},$y={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",lineHeight:21,lineHeightDim:"px",color:"#5a5a5a",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},fr={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:24,fontSizeDim:"px",lineHeight:32,lineHeightDim:"px",color:"#333333",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},cs={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},ot={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1C52DC",bold:!1,italic:!1,backgroundColor:"#1C52DC",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:Ae.border,borderRadius:Ae.borderRadius,textAlign:"center",padding:Ae.padding},ds={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:Ae.padding},pr={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:Ae.border,borderRadius:Ae.borderRadiusCards};function Vy(e){return{...$y,...e}}function qy(e){return{...fr,...e,bold:e?.bold??fr.bold,italic:e?.italic??fr.italic}}function Gy(e){return{...cs,...e,underline:e?.underline??cs.underline}}function zy(e){return{...ot,...e,bold:e?.bold??ot.bold,italic:e?.italic??ot.italic,border:{...ot.border,...e?.border},borderRadius:{...ot.borderRadius,...e?.borderRadius},padding:{...ot.padding,...e?.padding}}}function Wy(e){return{...ds,...e,padding:{...ds.padding,...e?.padding}}}function Ky(e){return{...pr,...e,border:{...pr.border,...e?.border},borderRadius:{...pr.borderRadius,...e?.borderRadius}}}function hr(e={}){return{backgroundColor:e.backgroundColor||"",backgroundImage:(e.backgroundImage||[]).map(t=>({type:"url",value:t?.value||""})),backgroundPositionX:e.backgroundPositionX||"",backgroundPositionY:e.backgroundPositionY||"",backgroundRepeat:e.backgroundRepeat||"",backgroundSize:e.backgroundSize||"",backgroundColorContent:e.backgroundColorContent||"",textStrong:e.textStrong||!1,textItalic:e.textItalic||!1,textUnderline:e.textUnderline||!1,width:e.width,responsive:e.responsive}}function us(e){let t={...no};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function mr(e){return{text:Vy(e.text),headings:qy(e.headings),links:Gy(e.links),buttons:zy(e.buttons),block:Wy(e.block),cards:Ky(e.cards)}}var fs=z("EmailSettingsPort"),Yy=1e4,Hl=class{_editor;_layoutSettingsChanged=new yr;_contentStylesChanged=new yr;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentLayoutSettings()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentContentStyles()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_replayToEarlyPlugin(e,t){if(!_l(this._editor.container)||!lt(this._editor.container)?.current()?.get().attributes.is_inited)return;const n=t();queueMicrotask(()=>e(n))}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(fs);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return hr(this._settings().read())}_getCurrentContentStyles(){const e=lt(this._editor.container)?.current()?.get().attributes.common_styles;return mr(us(e))}_getLayoutSnapshot(e){return JSON.stringify(e)}_getContentSnapshot(e){return JSON.stringify(e)}async _ensureMessageSubscription(){if(!this._messageSubscription){if(this._messageSubscriptionPromise)return this._messageSubscriptionPromise;this._messageSubscriptionPromise=(async()=>{if(await this._editor.container.getInstanceAsync(fs),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(Ht,()=>new $t),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const o=r?.data,i=o?.operation;if(i===X.APPLICATION_EMAIL_SETTINGS_SET){const l=hr(o?.settings),c=this._getLayoutSnapshot(l);c!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=c,this._layoutSettingsChanged.fire(l));return}if(i!==X.APPLICATION_COMMON_STYLES_UPDATE)return;const s=mr(r.data?.settings?.commonStyles??{...no}),a=this._getContentSnapshot(s);a!==this._prevContentSnapshot&&(this._prevContentSnapshot=a,this._contentStylesChanged.fire(s))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){return await this._waitForEmailSettingsFromIframe(),this._getCurrentLayoutSettings()}async setEmailLayoutSettings(e){await this._waitForEmailSettingsFromIframe();const t=this._settings(),n={...t.read(),...e};t.write(n);const r=hr(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=Yy){const t=lt(this._editor.container)?.current()?.get().attributes.is_inited,n=this._settings().read();if(t&&n&&Object.keys(n).length>0&&(n.backgroundColor||n.backgroundImage?.[0]?.value||n.width?.value||n.responsive!==void 0)||t)return;const r=this._editor.container,o=Ie(r,q.ON_EMAIL_INIT_ID);return new Promise(i=>{let s=!1,a;const l=()=>{a&&(clearTimeout(a),a=void 0)},c=o(()=>{s||(s=!0,l(),c.dispose(),i())});a=setTimeout(()=>{s||(s=!0,c.dispose(),i())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=lt(this._editor.container)?.current();if(!t)return;const n=us(t.get().attributes.common_styles);e.text!==void 0&&(n.text={...n.text||{},...e.text}),e.headings!==void 0&&(n.headings={...n.headings||{},...e.headings}),e.links!==void 0&&(n.links={...n.links||{},...e.links}),e.buttons!==void 0&&(n.buttons=ur(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:Ae.border,borderRadius:Ae.borderRadius,padding:Ae.padding})),e.block!==void 0&&(n.block=ur(n.block||{},e.block,["padding"],{padding:Ae.padding})),e.cards!==void 0&&(n.cards=ur(n.cards||{},e.cards,["border","borderRadius"],{border:Ae.border,borderRadius:Ae.borderRadiusCards}));const r=JSON.stringify(n);mt(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const o=mr(n);this._prevContentSnapshot=this._getContentSnapshot(o),this._contentStylesChanged.fire(o)}},Xy={...Ul,EmailSettingsApi:Hl},Jy={...Ul},tw={...Jy,EmailSettingsApi:Hl},Qy={...Xy};function Zy(){py.addAll(Qy)}var eE=[yt(()=>{Zy()}),zb,ry,Gb,kc,Vb,$c];async function tE(){return(await Wt()).asyncMixins}var nE=Ty,rE=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let o;try{o=await tE()}catch(s){throw e.failPendingWaits(s),s}t=o(e);const i=await e.getInstanceAsync(Tn);Object.assign(i,t.instance||{});for(const s of e.getInstance(oo)??[])s()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},oE=Uc([...eE]);function gr(){let e,t=!1;const n=new Map,r=new Map;function o(){for(const i of r.values())i();r.clear()}return{event(i,s,a){const l=Symbol("subscription");return t||(n.set(l,{listener:i,priority:s,thisArg:a}),e&&r.set(l,e(i,s,a))),()=>{n.delete(l),r.get(l)?.(),r.delete(l)}},attach(i){o(),e=i;for(const[s,{listener:a,priority:l,thisArg:c}]of n)r.set(s,i(a,l,c))},dispose(){t=!0,o(),n.clear(),e=void 0}}}function iE(e){const t=gr(),n=gr(),r=gr();return e.getInstance(Y)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(pt).then(o=>{t.attach(o.onNotify),n.attach(o.onError),r.attach(o.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(o){const i=e.getInstance(pt);if(i){i.notify(o);return}e.getInstanceAsync(pt).then(s=>s.notify(o),()=>{})}}}var $l=z("CodeErrors"),sE=[];function aE(e){return e?.getInstance($l)?.get()??sE}function lE(e){return e?.getInstance($l)!==void 0}var cE=class extends he{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=zt(e),this.addDisposable(Ie(e,q.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){const e=tt(this._container);if(e&&re(e.sessionKey())&&!e.hasSuspended())throw new Error("[emailmaker] no open email: only a block is shown");return gl(this._container,this._currentEmail)}async getBlocks(){const e=await this._readProjectBlocks();return await this._blockMetaWrites,(await this._dataSources.blocks.cache.values()).filter(t=>String(t.project)===String(e)).map(t=>be(t,this._container))}async _readProjectBlocks(){const e=await vl(this._container);return await this._dataSources.blocks.byForeignKey("project").get(e),e}async getComments(){const{cache:e}=this._dataSources.comments,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.post===t.id).map(n=>Tt(n,this._container))}async getEmailRevisions(){const{cache:e}=this._dataSources.emailRevisions,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.parent===t.id).map(n=>Ur(n,this._container))}async getEmailSnapshot(){return Se(this.openEmail(),this._container)}async getBlockSnapshot(){const e=tt(this._container),t=e?.current();return!e||!t||!re(e.sessionKey())?null:(await t.whenReady(),be(xn(t),this._container))}setEmailMeta(e){const t=Oo(this._container);if(!t)return;const n=t.get().attributes.meta;mt(t,{meta:tn({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,o=>o&&tn(o,e))}setBlockMeta(e,t){const n=tt(this._container);if(n?.sessionKey()===mn(e)){const o=n.current();o&&mt(o,{meta:tn({meta:o.get().attributes.meta},t).meta})}const r=async()=>{await this._readProjectBlocks();const{cache:o}=this._dataSources.blocks;await o.getIfPresent(e)&&await o.addOrUpdate(e,i=>i&&tn(i,t))};this._blockMetaWrites=this._blockMetaWrites.then(r).catch(()=>{})}getCodeErrors(){return lE(this._container)?aE(this._container):void 0}},dE=z("EmailDataController");function uE(e){return e.getOrCreateInstance(dE,()=>{const t=new cE(e);return e.getInstance(Y)?.addDisposable(t),t})}function fE(e){const t=uE(e);return{getEmailSnapshot:()=>t.getEmailSnapshot(),getBlockSnapshot:()=>t.getBlockSnapshot(),getCodeErrors:()=>t.getCodeErrors(),getBlocks:()=>t.getBlocks(),getComments:()=>t.getComments(),getEmailRevisions:()=>t.getEmailRevisions(),setEmailMeta:n=>t.setEmailMeta(n),setBlockMeta:(n,r)=>t.setBlockMeta(n,r)}}function pE(e){return{undo:()=>e.undo(),redo:()=>e.redo(),clear:()=>e.clear(),canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo(),createSnapshot:()=>e.createSnapshot(),restoreSnapshot:t=>{e.restoreSnapshot(t)},getPast:t=>e.getPast(t).map(n=>({changes:n})),getFuture:t=>e.getFuture(t).map(n=>({changes:n}))}}function hE(e){let t;const n=rl(e),r=Ie(e,q.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:i})=>{t=i}));const o=()=>t?pE(t):void 0;return{undoRedoService:{undo:()=>o()?.undo(),redo:()=>o()?.redo(),clear:()=>o()?.clear(),getPast:i=>o()?.getPast(i)??[],getFuture:i=>o()?.getFuture(i)??[],canUndo:()=>o()?.canUndo()??!1,canRedo:()=>o()?.canRedo()??!1,createSnapshot:()=>o()?.createSnapshot(),restoreSnapshot:i=>o()?.restoreSnapshot(i)}}}var mE=z("plugin.mountElement");function gE(e){const t=e.getInstance(ge)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function vE(e){return e.getOrCreateInstance(mE,()=>{let t=!1,n;return{get:()=>t?n:gE(e),set(r){t=!0,n=r}}})}function bE(e){const t=vE(e);return{getElement:()=>t.get()}}function yE(e){return{handleLoadImage:G(Ie(e,q.UPLOAD_EVENT_ID)),handleFileProxy:G(Ie(e,q.FILE_PROXY_EVENT_ID)),handleUrlProxy:G(Ie(e,q.PROXY_URL_EVENT_ID)),handleAITextRequest:G(Ie(e,q.AI_TEXT_REQUEST_ID)),handleAIImageRequest:G(Ie(e,q.AI_IMAGE_REQUEST_ID)),handleReadLocale:G(Ie(e,q.READ_LOCALE)),handleLimitUsage:G(Ie(e,q.ON_LIMIT_ID)),handleTranslate:G(Ie(e,q.ON_TRANSLATE_ID))}}var EE=[Qm,fb,iE,ny,fE,hE,bE,yE];function _E(e,t=EE){const n=xo(e);Ub(e);const r=oE(e),o=nE(e),i=rE(e),s={...r.instance,...o.instance,...i.instance};for(const l of t)Object.assign(s,l(e));let a=!0;return{instance:s,async setOptions(l){await r.setOptions(l);const c=a&&n.get()===l;a=!1,c||n.set(l),await o.setOptions(l),await i.setOptions(l)}}}function wE(e){return{get:t=>e.get(t),remove:(t,n)=>e.remove(t,n),set:(t,n,r)=>{if(n==null){e.get(t),e.remove(t,r);return}e.set(t,n,r)}}}var SE=class{_storage=Object.create(null);get(e){const t=this._storage[e];return t&&(!t.expires||t.expires<Date.now())?t.value:""}set(e,t,n){this._storage[e]={value:t,expires:n.expires?n.expires*1e3+Date.now():void 0}}remove(e){delete this._storage[e]}},IE="editor-runtime.react.copies",vr=8;function Nt(e){return e&&typeof e=="object"?e:void 0}function ps(e){const t=Nt(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=Nt(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function CE(e){const t=Nt(e),n=t&&typeof t.version=="string"?t.version:void 0,r=Nt(t?.default),o=r&&typeof r.version=="string"?r.version:void 0;return n??o??"unknown"}function TE(e,t,n){return e.package===t&&e.version===n}function AE({ourReact:e,entries:t,packageName:n,version:r}){const o=ps(e);if(!o||!Array.isArray(t))return[];const i=[],s=new Set;for(const a of t){const l=Nt(a);if(!l||!TE(l,n,r))continue;const c=ps(l.react);!c||c===o||s.has(c)||(s.add(c),i.push({package:n,version:r,reactVersion:CE(l.react),react:l.react}))}return i}function RE({packageName:e,copies:t}){const n=[`[${e}] A second copy of React is on this page (singleton invariant broken).`,`The editor runs on its own React, the plugin got another one from ${e}/runtime/react.`,`This shows up as "Cannot read properties of null (reading 'useState')" and takes down the whole`,"editor, not just the plugin panel: plugin components render inside the editor tree.","","Found:"];for(const r of t.slice(0,vr))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>vr&&n.push(` …and ${t.length-vr} more`),n.push("","Likely root cause: the editor is loaded from its UMD entry (a <script> on the page), while the","plugin was built as an ESM package by the host bundler. Those two never share a React.","","Fix it either way:"," • build the plugin on globals — it then takes React from the page registry, or"," • load the editor from its ESM entry and build both with the same bundler."),n.join(`
1048
+ `)}var hs=new Set;function PE({packageName:e="@emailmaker/emailmaker",version:t="1.2.5",log:n=r=>{}}={}){const r=o=>{try{const i=globalThis[Symbol.for(IE)],s=AE({ourReact:o,entries:i,packageName:e,version:t}).filter(a=>!hs.has(a.react));if(!s.length)return;s.forEach(a=>hs.add(a.react)),n(RE({packageName:e,copies:s}))}catch{}};try{const o=ao()?.modules?.React;if(o&&typeof o.then=="function"){o.then(r,()=>{});return}r(o)}catch{}}async function DE(e,t,n){ne(e.signal);const r=t??ht.createChild();xo(r);const o=r.getInstance(Y);let i;async function s(){r.inject(Ts,wE(new SE)),PE();const a=_E(r),l={...a.instance,container:r,get ready(){return i??Promise.resolve(l)},async reset(c){if(ne(c.signal),o.isDisposed())throw je();return await a.setOptions(c),l}};r.inject(Tn,l);try{if(n?.onInstance?.(l),await a.setOptions(e),ne(e.signal),o.isDisposed()||await cb(r),e.devTools)try{const c=r.getInstance(to);c&&await(await Wt()).initDevTools(r,c)}catch{}return ne(e.signal),Ut(r,Ds).fire(l),l}catch(c){throw o.dispose(),c}}try{return i=pn(s(),e.signal),i.catch(()=>{}),await i}catch(a){throw o.isDisposed()||o.dispose(),a}}var Ft=new WeakMap;function OE(e){return e?Ft.get(e):void 0}function Vl(e){try{e.getInstance(Y)?.dispose()}catch{}try{e.dispose()}catch{}}function kE(e,t){if(!e)return;const n=Ft.get(e);n&&n!==t&&Vl(n),Ft.set(e,t)}function xE(e,t){e&&Ft.get(e)===t&&Ft.delete(e)}function ME(e){const t=ht.createChild();return Vt(e)&&t.inject(Me,Mn(e)),t}var kt=new WeakMap,LE="data-emailmaker-config-styles";function NE(e){return typeof e=="string"?e.trim():""}function ms(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function FE(e,t,n){if(!e||typeof document>"u")return null;const r=NE(t),o=kt.get(e),i=n||e;if(!r)return o&&(o.remove(),kt.delete(e)),null;if(o)return o.textContent!==r&&(o.textContent=r),(o.parentNode!==i||o!==i.firstChild)&&ms(i,o),o;const s=document.createElement("style");return s.setAttribute(LE,"true"),s.textContent=r,ms(i,s),kt.set(e,s),s}function BE(e){if(!e)return;const t=kt.get(e);t&&(t.remove(),kt.delete(e))}function ql(){return!1}var jE=`
1049
1049
  .blocks-app-initial-spinner-wrapper {
1050
1050
  width: 100%;
1051
1051
  height: 100%;
@@ -1074,7 +1074,7 @@ import{n as ps,r as Hl}from"./static/esm/971f1b2c.js";import{$ as Lo,A as $l,At
1074
1074
  100% {
1075
1075
  transform: rotate(360deg);
1076
1076
  }
1077
- }`;function rE(){return()=>{}}function oE(e,t){if(!Pl()||!e||typeof document>"u")return rE();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=document.createElement("div");n.classList.add("blocks-app-initial-spinner-wrapper");const r=document.createElement("div");r.classList.add("blocks-app-initial-spinner"),n.appendChild(r);const o=document.createElement("style");o.setAttribute(t,"true"),o.textContent=nE,document.head?.appendChild(o),e.appendChild(n);let i=!1;return()=>{i||(i=!0,n.remove(),o.remove())}}function iE(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function sE({report:e}={}){const t=new Map,n=new Set,r=e??(o=>{});return{run(o,i){const s=t.get(o);if(s!==void 0)return s;const a=i().catch(l=>{throw n.has(o)||(n.add(o),r(l)),iE(l)||t.delete(o),l});return t.set(o,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var Oo=sE();function Dl(){Oo.clear()}Gl(()=>Oo.clear());var os=new WeakMap;function ko(e){return zl(e)}function aE(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function lE(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function cE(e){if(!e.getAuthToken)return;const t=await e.getAuthToken(e.user,e.project,void 0),n=String(t||"").trim();return n?`Bearer ${n}`:void 0}var xo=new WeakMap;function hr(e,t){xo.set(e,t)}function dE(e){return xo.get(e)}function uE(e,t){return async({baseUrl:n})=>{const r=t(),o=r&&xo.get(r)||e,i=ko(n);if(!i)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const s=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await cE(o);if(o.getAuthToken&&!a)throw lE();a&&s.set("authorization",a);const l=await dc("/app/v1/app_init",{method:"POST",headers:s,body:new URLSearchParams,credentials:"same-origin"},i,{attemptTimeout:Eo(o)||void 0});if(!l.ok)throw aE(l.status,l.statusText);return await l.json()}}function fE(e){return JSON.stringify({baseUrl:ko(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function pE(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function hE(e){return t=>Oo.run(fE(t),()=>(ne("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>ne("appInit:end",{kind:"network"}))))}function mE(e,t){if(Ht(e)||!e.appInit&&!ko(e.baseUrl)||!pE(e))return e;const n=e.appInit??uE(e,t);let r=os.get(n);return r||(r=hE(n),os.set(n,r)),{...e,appInit:r}}var Ol=0;function gE(){return Ol}function vE(){Ol+=1,Dl()}var is=new WeakMap,ss=new WeakMap,bE=3e4;function yE(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function EE(e,t){try{const n=Qr(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+bE}function _E(e){const t=new Map,n=new Map;return async(r,o,i)=>{const s=yE(r,o);if(i)return n.delete(s),t.delete(s),Dl(),e(r,o,i);const a=n.get(s);if(a&&!t.has(s)){if(a.expiresAtMs>Date.now())return a.token;n.delete(s)}let l=t.get(s);return l===void 0&&(ne("authToken:start",{kind:"network"}),l=Promise.resolve(e(r,o,i)).then(c=>{const d=String(c||"").trim();return d&&n.set(s,{token:c,expiresAtMs:EE(d,Date.now())}),c}).finally(()=>{ne("authToken:end",{kind:"network"}),t.delete(s)}),t.set(s,l)),l}}function wE(e){if(Ht(e))return e;const t=e.getAuthToken;if(!t)return e;let n=is.get(t);const r=gE();return(!n||ss.get(t)!==r)&&(n=_E(t),is.set(t,n),ss.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(o=>{}),{...e,getAuthToken:n}}var SE="[emailmaker] This editor was destroyed: a later init()/create() into the same element failed to start, and the editor could not be handed back. Call init() again; the reason is in `cause`.";function IE(e){const t=new Error(SE,{cause:e});return t.name="EditorStartFailedError",t}var CE={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function as(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var kl=["handleLoad","handleDestroy"];function xl(e,t){let n=e;for(const r of kl){const o=e?.[r];typeof o=="function"&&(n={...n,[r]:(i,...s)=>o(t,...s)})}return n}function TE(e){let t,n="pending",r,o,i,s;const a=new Set,l=[],c=new Set;let d,g;const h=new Promise((S,N)=>{d=S,g=N});h.catch(()=>{});const y={},I=S=>t?.[S],w=()=>r??Be(),b=(S,N)=>{const $=I(S);if(typeof $!="function")throw as(S);return $.apply(t,N)},R=(S,N)=>{try{return Promise.resolve(b(S,N))}catch($){return Promise.reject($)}},A=()=>{const S=t?.container?.getInstance?.(W);if(!(n!=="ready"||S?.isDisposed()||typeof I("getConfig")!="function"))try{s=b("getConfig",[])}catch{}},L=()=>n==="dead"?Promise.reject(w()):n==="ready"?Promise.resolve():h,P=()=>{for(const[S,N]of yn)N==="field"&&(y[S]=I(S))},O=S=>{const N=I(S.name);S.dispose||typeof N!="function"||n==="dead"||(S.dispose=N.apply(t,S.args))},_=()=>a.forEach(O),C=()=>{for(const S of a){try{S.dispose?.()}catch{}S.dispose=void 0}},T=()=>{P(),_()},m=()=>{i?.delete(T),i=void 0},f=(S,N)=>{const[$,...v]=N;return!kl.includes(S)||typeof $!="function"?N:[(k,...j)=>$(y,...j),...v]},u=(S,N)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof I(S)!="function")throw as(S);const $={name:S,args:f(S,N)};return a.add($),O($),()=>{a.delete($),$.dispose?.(),$.dispose=void 0}},p=()=>t?.container?.getInstance(pe)?.get()?.content,D=()=>{const S=e.element();return S!==void 0&&typeof S!="string"?S:void 0},x=(S,N)=>{switch(N){case"event":return(...$)=>u(S,$);case"async":return(...$)=>(S==="show"&&$[0]!==void 0&&e.shown?.($[0]),n!=="dead"&&typeof I(S)=="function"?R(S,$):L().then(()=>b(S,$)));case"queued":return(...$)=>{if(n==="dead"){if(S==="notify")return;throw w()}if(n==="pending"){l.push({name:S,args:$});return}return b(S,$)};case"sync":return(...$)=>{if(n==="dead"){if(S==="getConfig")return s;throw w()}if(typeof I(S)!="function")throw new Error(`[emailmaker] \`${S}\` is not available before the editor is ready: ${CE[S]??"await `ready` first"}`);const v=b(S,$);return S==="getConfig"&&(s=v),v};case"element":return()=>{if(typeof I(S)!="function")return D();try{return b(S,[])}catch{return D()}};case"codeErrors":return()=>n==="ready"&&typeof I(S)=="function"?b(S,[]):[];case"field":return}};for(const[S,N]of yn)y[S]=x(S,N);y.reset=S=>(S?.content!==void 0&&e.shown?.(S.content),L().then(async()=>{const N=S?.content!==void 0&&Pe(S.content,p());await b("reset",[xl(S,E)]),N&&await b("show",[S.content])}).then(()=>y)),y.destroy=()=>{if(n==="dead")return;const S=ve("[emailmaker] editor was destroyed before it was ready");o?.catch(()=>{}),c.forEach(N=>N(S)),A(),e.destroy()},Object.defineProperty(y,"ready",{get:()=>o,enumerable:!0,configurable:!0});const E=y;return{object:E,get state(){return n},get editor(){return t},bind:S=>{n==="dead"||t===S||(C(),m(),t=S,P(),_(),n==="pending"&&(i=S.container.getOrCreateInstance(Xr,()=>new Set),i.add(T)))},settle:()=>{if(n==="pending"){n="ready",m(),P(),_();for(const S of l.splice(0))try{b(S.name,S.args)}catch(N){queueMicrotask(()=>{throw N})}d()}},kill:(S,N)=>{n!=="dead"&&(A(),n="dead",r=S,l.length=0,c.forEach($=>$(S)),m(),N?.keepSubscriptions||(C(),a.clear()),g(S))},detach:()=>{C(),a.clear()},setReady:S=>{o=S},trackCall:S=>(c.add(S),()=>c.delete(S)),hasCalls:()=>c.size>0}}var Ml="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function AE(){return ve(Ml)}function RE(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Ml}function PE(e,t,n){if(typeof document>"u")return;let r=!1,o;const i=()=>{r=!0,o?.disconnect(),o=void 0},s=()=>{r||(i(),t())};if(n.addDispose(i),!e.isConnected){queueMicrotask(s);return}o=new MutationObserver(()=>{e.isConnected||s()});let a=e.parentNode;for(;a;)o.observe(a,{childList:!0}),a=a.parentNode}function DE(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:o}=e;if(t===void 0||!(n instanceof Element))return r;const i=new AbortController;return PE(n,()=>{n.id,i.abort(AE())},o),Gr(r,i.signal)}var Ll="Superseded by newer init() on the same mount element";function ls(){return ve(Ll)}function OE(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Ll}var wt=new Map,cs=new WeakMap,on=new WeakMap;function kE(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function xE(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=kE(e);(n?wt.get(n):void 0)?.forEach(d=>{d.element!==e&&d.controller.abort(ls())});const r=cs.get(e)??new Set;t&&r.forEach(d=>{d.supersedable&&d.controller.abort(ls())});const o=on.get(e)??Promise.resolve();let i;const s=new Promise(d=>{i=d}),a=o.then(()=>s);on.set(e,a),a.then(()=>{on.get(e)===a&&on.delete(e)});const l=new AbortController,c={element:e,controller:l,supersedable:t};if(r.add(c),cs.set(e,r),n){const d=wt.get(n)??new Set;d.add(c),wt.set(n,d)}return{signal:l.signal,previous:o,release:()=>{i(),r.delete(c);const d=n?wt.get(n):void 0;n&&d?.delete(c)&&d.size===0&&wt.delete(n)}}}var Nt=new WeakMap;function Mo(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function Hr(e){return Object.entries(e).filter(([t,n])=>Mo(t,n)).map(([t])=>t).sort()}function ds(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!Mo(n,r)&&(t[n]=r);return t}function $r(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:Nt.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},Nt.set(e,r));const{current:o,trampolines:i}=r;o.clear();const s={...t};for(const a of Hr(t)){o.set(a,t[a]);let l=i.get(a);l||(l=(...c)=>o.get(a)?.(...c),i.set(a,l)),s[a]=l}return r.lastOptions=t,s}function Nl(e,t){const n=e?Nt.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const o=t[r];Mo(r,o)?n.current.set(r,o):n.current.delete(r)}}function ME(e){const t=e?Nt.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((o,i)=>t.current.set(i,o)),t.lastOptions=r}}function LE(e,t,n){const r=e?Nt.get(e):void 0;if(!r||!n)return!1;const o=Hr(t),i=Pe(o,Hr(r.lastOptions)),s=o.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!i||!s||!Pe(ds(t),ds(r.lastOptions))?!1:($r(e,t),!0)}var Ce=new WeakMap;function Fn(e){let t=Ce.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},Ce.set(e,t)),t}var He=e=>e!==void 0&&e.state!=="dead";function NE(e){const t=Ce.get(e)?.shared;return He(t)?t:void 0}function FE(e,t){Fn(e).shared=t}function BE(e,t){!(He(e.shared)&&[...e.counted].some(He))||e.warned||!t.devTools||(e.warned=!0)}function jE(e,t,n,r){const o=Fn(e);return o.latestCall+=1,o.releaseTimer!==void 0&&(clearTimeout(o.releaseTimer),o.releaseTimer=void 0),o.leaving.forEach(i=>i.detach()),o.leaving.clear(),n==="single"?o.shared=t:o.counted.add(t),o.options.set(t,r),o.order=[...o.order.filter(i=>i!==t&&He(i)),t],BE(o,r),o.latestCall}function UE(e,t){return Ce.get(e)?.latestCall===t}function HE(e){const t=Ce.get(e);if(t)return t.order=t.order.filter(He),t.order.at(-1)?.object}function Ft(e,t){const n=Ce.get(e);return n?He(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&He(r)):!1}function $E(e,t){const n=Ce.get(e),r=n?.order.filter(o=>o!==t&&He(o)).at(-1);return r?n?.options.get(r):void 0}function Fl(e,t){Fn(e).content={value:t}}function qE(e){return Ce.get(e)?.content}function VE(e,t,n,r){const o=Fn(e);if(o.counted.delete(t),o.options.delete(t),Ft(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),o.leaving.add(t),Bl(e,r)}function Bl(e,t){const n=Ce.get(e);!n||Ft(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!Ft(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function GE(e,t){const n=Ce.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);Ce.delete(e)}}var y_=ps({FileManagerApiError:()=>zE,IntegratorSaveTimeoutError:()=>Tn,SaveRefusedError:()=>Qe}),zE=class jl extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,o){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=o,Error.captureStackTrace&&Error.captureStackTrace(this,jl)}},E_=ps({mapHttpStatusToErrorCode:()=>nc});function WE(e,t){return{...e,element:t}}function qr(){return()=>{}}function KE(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?qr():(eE(t,e.config?.styles,t),()=>{tE(t)})}function YE(e){if(!Pl()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:qr()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:qr()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(o=>{o.remove()});const n=oE(t,"data-emailmaker"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function XE(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function _n(e){try{e.destroy()}catch{}}function dn(e,...t){const n=we.get(e);t.some(r=>r!==void 0&&r===n)&&we.delete(e)}var __="1.2.3";async function w_(e){ho(),await Tb(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0)}async function S_(e){return t_(e).ready}function JE(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function QE(e){const t=we.get(e);return t&&!(t instanceof Promise)?t:void 0}function wn(e,t,n){const r=t??QE(e);r&&(dn(e,r),_n(r)),GE(e,n)}function ZE(e){const{control:t,mode:n,ref:r}=e,o=r.host;if(!o){const s=t.editor;e_(s),t.kill(Be());return}if(n==="single"){wn(o,t.editor,Be());return}const i=$E(o,t);VE(o,t,Be(),()=>wn(o,t.editor,Be())),i&&Ft(o)&&Nl(o,i)}function e_(e){e&&_n(e)}function t_(e){ne(de.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=Gr(e.signal,n.signal),o=t==="single"?JE(e.element):void 0,i=o?NE(o):void 0;let s;if(i)s={control:i,mode:t,ref:{host:o}};else{const d={},g=TE({element:()=>d.host??e.element,destroy:()=>ZE(s),shown:h=>{d.host&&Fl(d.host,h)}});s={control:g,mode:t,ref:d},o&&FE(o,g)}const{control:a}=s,l=a.trackCall(d=>n.abort(d)),c=s_(xl({...e,signal:r},a.object),s).then(()=>(l(),ne(de.initEnd),a.settle(),a.object),d=>{l(),a.state==="pending"&&!a.hasCalls()&&a.kill(d);const g=s.ref.host;throw g&&Bl(g,()=>wn(g,void 0,Be())),d});return a.setReady(c),a.object}function I_(e){const t=typeof e=="string"?document.querySelector(e):e;return t?HE(t):void 0}function n_(e){let t,n,r=!1;try{t=e.container.getInstance(pe)?.get(),n=e.container.getInstance(De)?.externalSignal;const o=at(e.container)?.current();r=o!==void 0&&o.get().savedVersion!==null&&o.isDirty()}catch{t=void 0}return{options:t,signal:n,email:r_(e),dirty:r}}async function r_(e){try{return await e.getEmailSnapshot()}catch{return}}function o_(e){const t=at(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function us(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||Ft(e,n)}async function i_(e,t,n,r,o){if(r.mode==="counted"&&r.control.detach(),OE(o)||RE(o))return;const i=()=>wn(t,e,IE(o)),{options:s}=n;if(!s||!us(t,r)){i();return}const a=await n.email,l=a&&(s.content!==void 0||a.id!==void 0)?a:void 0,c=typeof s.content=="object"&&"email"in s.content?s.content:void 0;try{await e.reset({...s,signal:s.signal??n.signal,content:l?{...c,email:l}:s.content}),n.dirty&&l&&o_(e),us(t,r)?we.set(t,e):i()}catch{i()}}async function s_(e,t){ee(e.signal);const n=new ue;let r,o,i,s,a=0;try{const l=await wc(e.element,n,e.signal);l&&(s=l,t.ref.host=l,a=jE(l,t.control,t.mode,e));const c=DE({hostElementOption:e.element,resolvedElement:l,externalSignal:e.signal,disposable:n}),d=xE(l,{supersede:t.mode==="single"});r=d.release;const g=Gr(c,d.signal);ee(g),i=ME(l),Nl(l,e),await un(d.previous,g),o=a_(e,l,t,g,i);const h=await un(o,g);return l&&e.content!==void 0&&Fl(l,e.content),h}catch(l){throw s&&i&&UE(s,a)&&i(),l}finally{const l=r;o!==void 0&&l?o.then(l,l):l?.(),n.dispose()}}async function fs(e,t,n,r){const o=qE(t);n===void 0||r||!o||Pe(n,o.value)||await e.show(n)}async function a_(e,t,n,r,o){const{control:i}=n,s=w=>i.bind(w);ee(r);let a;const l=w=>{vE();const b=wE(WE(w,t)),R=mE(b,()=>a);return{preparedOptions:R,preparedOptionsWithSignal:r!=null?{...R,signal:r}:R}};let c;if(t){const w=we.get(t);if(w){let b;try{b=await w,ee(r)}catch{ee(r),dn(t,w),b=void 0}if(b)if(b.getElement()===t){const R=Ky(t);a=R;const A=b.container.getInstance(pe)?.get();if(LE(t,e,A))return s(b),r&&b.container.getInstance(De)?.relinkExternalSignal(r),we.set(t,b),await fs(b,t,e.content,!1),b;const L=!Pe(e.content,A?.content);c=l($r(t,e));const{preparedOptions:P,preparedOptionsWithSignal:O}=c,_=R&&dE(R),C=n_(b);try{R&&hr(R,P),s(b);const T=await b.reset(XE(e,O));return ee(r),we.set(t,b),await fs(b,t,e.content,L),T}catch(T){if(R&&_&&hr(R,_),!ed(T))throw o(),await i_(b,t,C,n,T),T;dn(t,w,b),_n(b),ee(r)}}else dn(t,w,b),_n(b)}}ee(r),c??=l($r(t,e,{fresh:!0}));const{preparedOptions:d}=c,g=KE(d),h=YE(d),y=r!=null?{...h.options,signal:r}:h.options;let I;try{a=Jy(y),Yy(t,a),hr(a,d),Ao(a).set(y),await Ro(),ne(de.coreReady),ee(r),ee(r),I=Wy(y,a,{onInstance:s}),t&&we.set(t,I);const w=await I;if(r?.aborted&&(w.destroy(),ee(r)),t)if(we.get(t)===I)we.set(t,w);else throw w.destroy(),ee(r),ve(r?.reason);return w}catch(w){throw g(),h.cleanup(),a&&(Rl(a),Xy(t,a)),t&&I&&we.get(t)===I&&we.delete(t),w}}async function C_(e){return(await Gt()).parseAMP(e)}typeof window<"u"&&(kt()&&Qc(),Rb(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0));export{Ml as ELEMENT_DETACHED_ABORT_MESSAGE,Ll as SUPERSEDED_INIT_ABORT_MESSAGE,t_ as create,y_ as errors,I_ as getInstance,E_ as helpers,S_ as init,RE as isElementDetachedError,OE as isSupersededInitError,C_ as parseAMP,Db as pluginRegistry,w_ as preload,__ as version};
1077
+ }`;function UE(){return()=>{}}function HE(e,t){if(!ql()||!e||typeof document>"u")return UE();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=document.createElement("div");n.classList.add("blocks-app-initial-spinner-wrapper");const r=document.createElement("div");r.classList.add("blocks-app-initial-spinner"),n.appendChild(r);const o=document.createElement("style");o.setAttribute(t,"true"),o.textContent=jE,document.head?.appendChild(o),e.appendChild(n);let i=!1;return()=>{i||(i=!0,n.remove(),o.remove())}}function $E(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function VE({report:e}={}){const t=new Map,n=new Set,r=e??(o=>{});return{run(o,i){const s=t.get(o);if(s!==void 0)return s;const a=i().catch(l=>{throw n.has(o)||(n.add(o),r(l)),$E(l)||t.delete(o),l});return t.set(o,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var Fo=VE();function Gl(){Fo.clear()}Mc(()=>Fo.clear());var gs=new WeakMap;function Bo(e){return oc(e)}function qE(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function GE(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function zE(e){if(!e.getAuthToken)return;const t=await e.getAuthToken(e.user,e.project,void 0),n=String(t||"").trim();return n?`Bearer ${n}`:void 0}var jo=new WeakMap;function br(e,t){jo.set(e,t)}function WE(e){return jo.get(e)}function KE(e,t){return async({baseUrl:n})=>{const r=t(),o=r&&jo.get(r)||e,i=Bo(n);if(!i)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const s=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await zE(o);if(o.getAuthToken&&!a)throw GE();a&&s.set("authorization",a);const l=await Tc("/app/v1/app_init",{method:"POST",headers:s,body:new URLSearchParams,credentials:"same-origin"},i,{attemptTimeout:To(o)||void 0});if(!l.ok)throw qE(l.status,l.statusText);return await l.json()}}function YE(e){return JSON.stringify({baseUrl:Bo(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function XE(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function JE(e){return t=>Fo.run(YE(t),()=>(oe("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>oe("appInit:end",{kind:"network"}))))}function QE(e,t){if(Vt(e)||!e.appInit&&!Bo(e.baseUrl)||!XE(e))return e;const n=e.appInit??KE(e,t);let r=gs.get(n);return r||(r=JE(n),gs.set(n,r)),{...e,appInit:r}}var zl=0;function ZE(){return zl}function e_(){zl+=1,Gl()}var vs=new WeakMap,bs=new WeakMap,t_=3e4;function n_(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function r_(e,t){try{const n=eo(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+t_}function o_(e){const t=new Map,n=new Map;return async(r,o,i)=>{const s=n_(r,o);if(i)return n.delete(s),t.delete(s),Gl(),e(r,o,i);const a=n.get(s);if(a&&!t.has(s)){if(a.expiresAtMs>Date.now())return a.token;n.delete(s)}let l=t.get(s);return l===void 0&&(oe("authToken:start",{kind:"network"}),l=Promise.resolve(e(r,o,i)).then(c=>{const d=String(c||"").trim();return d&&n.set(s,{token:c,expiresAtMs:r_(d,Date.now())}),c}).finally(()=>{oe("authToken:end",{kind:"network"}),t.delete(s)}),t.set(s,l)),l}}function i_(e){if(Vt(e))return e;const t=e.getAuthToken;if(!t)return e;let n=vs.get(t);const r=ZE();return(!n||bs.get(t)!==r)&&(n=o_(t),vs.set(t,n),bs.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(o=>{}),{...e,getAuthToken:n}}var s_="[emailmaker] This editor was destroyed: a later init()/create() into the same element failed to start, and the editor could not be handed back. Call init() again; the reason is in `cause`.";function a_(e){const t=new Error(s_,{cause:e});return t.name="EditorStartFailedError",t}var l_={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function ys(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var Wl=["handleLoad","handleDestroy"];function Kl(e,t){let n=e;for(const r of Wl){const o=e?.[r];typeof o=="function"&&(n={...n,[r]:(i,...s)=>o(t,...s)})}return n}function c_(e){let t,n="pending",r,o,i,s;const a=new Set,l=[],c=new Set;let d,m;const h=new Promise((S,F)=>{d=S,m=F});h.catch(()=>{});const E={},w=S=>t?.[S],_=()=>r??je(),b=(S,F)=>{const V=w(S);if(typeof V!="function")throw ys(S);return V.apply(t,F)},T=(S,F)=>{try{return Promise.resolve(b(S,F))}catch(V){return Promise.reject(V)}},A=()=>{const S=t?.container?.getInstance?.(Y);if(!(n!=="ready"||S?.isDisposed()||typeof w("getConfig")!="function"))try{s=b("getConfig",[])}catch{}},B=()=>n==="dead"?Promise.reject(_()):n==="ready"?Promise.resolve():h,O=()=>{for(const[S,F]of _n)F==="field"&&(E[S]=w(S))},k=S=>{const F=w(S.name);S.dispose||typeof F!="function"||n==="dead"||(S.dispose=F.apply(t,S.args))},C=()=>a.forEach(k),R=()=>{for(const S of a){try{S.dispose?.()}catch{}S.dispose=void 0}},I=()=>{O(),C()},g=()=>{i?.delete(I),i=void 0},p=(S,F)=>{const[V,...v]=F;return!Wl.includes(S)||typeof V!="function"?F:[(x,...U)=>V(E,...U),...v]},u=(S,F)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof w(S)!="function")throw ys(S);const V={name:S,args:p(S,F)};return a.add(V),k(V),()=>{a.delete(V),V.dispose?.(),V.dispose=void 0}},f=()=>t?.container?.getInstance(ge)?.get()?.content,P=()=>{const S=e.element();return S!==void 0&&typeof S!="string"?S:void 0},M=(S,F)=>{switch(F){case"event":return(...V)=>u(S,V);case"async":return(...V)=>(S==="show"&&V[0]!==void 0&&e.shown?.(V[0]),n!=="dead"&&typeof w(S)=="function"?T(S,V):B().then(()=>b(S,V)));case"queued":return(...V)=>{if(n==="dead"){if(S==="notify")return;throw _()}if(n==="pending"){l.push({name:S,args:V});return}return b(S,V)};case"sync":return(...V)=>{if(n==="dead"){if(S==="getConfig")return s;throw _()}if(typeof w(S)!="function")throw new Error(`[emailmaker] \`${S}\` is not available before the editor is ready: ${l_[S]??"await `ready` first"}`);const v=b(S,V);return S==="getConfig"&&(s=v),v};case"element":return()=>{if(typeof w(S)!="function")return P();try{return b(S,[])}catch{return P()}};case"codeErrors":return()=>n==="ready"&&typeof w(S)=="function"?b(S,[]):[];case"field":return}};for(const[S,F]of _n)E[S]=M(S,F);E.reset=S=>(S?.content!==void 0&&e.shown?.(S.content),B().then(async()=>{const F=S?.content!==void 0&&ke(S.content,f());await b("reset",[Kl(S,y)]),F&&await b("show",[S.content])}).then(()=>E)),E.destroy=()=>{if(n==="dead")return;const S=_e("[emailmaker] editor was destroyed before it was ready");o?.catch(()=>{}),c.forEach(F=>F(S)),A(),e.destroy()},Object.defineProperty(E,"ready",{get:()=>o,enumerable:!0,configurable:!0});const y=E;return{object:y,get state(){return n},get editor(){return t},bind:S=>{n==="dead"||t===S||(R(),g(),t=S,O(),C(),n==="pending"&&(i=S.container.getOrCreateInstance(oo,()=>new Set),i.add(I)))},settle:()=>{if(n==="pending"){n="ready",g(),O(),C();for(const S of l.splice(0))try{b(S.name,S.args)}catch(F){queueMicrotask(()=>{throw F})}d()}},kill:(S,F)=>{n!=="dead"&&(A(),n="dead",r=S,l.length=0,c.forEach(V=>V(S)),g(),F?.keepSubscriptions||(R(),a.clear()),m(S))},detach:()=>{R(),a.clear()},setReady:S=>{o=S},trackCall:S=>(c.add(S),()=>c.delete(S)),hasCalls:()=>c.size>0}}var Yl="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function d_(){return _e(Yl)}function u_(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Yl}function f_(e,t,n){if(typeof document>"u")return;let r=!1,o;const i=()=>{r=!0,o?.disconnect(),o=void 0},s=()=>{r||(i(),t())};if(n.addDispose(i),!e.isConnected){queueMicrotask(s);return}o=new MutationObserver(()=>{e.isConnected||s()});let a=e.parentNode;for(;a;)o.observe(a,{childList:!0}),a=a.parentNode}function p_(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:o}=e;if(t===void 0||!(n instanceof Element))return r;const i=new AbortController;return f_(n,()=>{n.id,i.abort(d_())},o),Zr(r,i.signal)}var Xl="Superseded by newer init() on the same mount element";function Es(){return _e(Xl)}function h_(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Xl}var wt=new Map,_s=new WeakMap,an=new WeakMap;function m_(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function g_(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=m_(e);(n?wt.get(n):void 0)?.forEach(d=>{d.element!==e&&d.controller.abort(Es())});const r=_s.get(e)??new Set;t&&r.forEach(d=>{d.supersedable&&d.controller.abort(Es())});const o=an.get(e)??Promise.resolve();let i;const s=new Promise(d=>{i=d}),a=o.then(()=>s);an.set(e,a),a.then(()=>{an.get(e)===a&&an.delete(e)});const l=new AbortController,c={element:e,controller:l,supersedable:t};if(r.add(c),_s.set(e,r),n){const d=wt.get(n)??new Set;d.add(c),wt.set(n,d)}return{signal:l.signal,previous:o,release:()=>{i(),r.delete(c);const d=n?wt.get(n):void 0;n&&d?.delete(c)&&d.size===0&&wt.delete(n)}}}var Bt=new WeakMap;function Uo(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function Kr(e){return Object.entries(e).filter(([t,n])=>Uo(t,n)).map(([t])=>t).sort()}function ws(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!Uo(n,r)&&(t[n]=r);return t}function Yr(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:Bt.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},Bt.set(e,r));const{current:o,trampolines:i}=r;o.clear();const s={...t};for(const a of Kr(t)){o.set(a,t[a]);let l=i.get(a);l||(l=(...c)=>o.get(a)?.(...c),i.set(a,l)),s[a]=l}return r.lastOptions=t,s}function Jl(e,t){const n=e?Bt.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const o=t[r];Uo(r,o)?n.current.set(r,o):n.current.delete(r)}}function v_(e){const t=e?Bt.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((o,i)=>t.current.set(i,o)),t.lastOptions=r}}function b_(e,t,n){const r=e?Bt.get(e):void 0;if(!r||!n)return!1;const o=Kr(t),i=ke(o,Kr(r.lastOptions)),s=o.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!i||!s||!ke(ws(t),ws(r.lastOptions))?!1:(Yr(e,t),!0)}var Pe=new WeakMap;function jn(e){let t=Pe.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},Pe.set(e,t)),t}var $e=e=>e!==void 0&&e.state!=="dead";function y_(e){const t=Pe.get(e)?.shared;return $e(t)?t:void 0}function E_(e,t){jn(e).shared=t}function __(e,t){!($e(e.shared)&&[...e.counted].some($e))||e.warned||!t.devTools||(e.warned=!0)}function w_(e,t,n,r){const o=jn(e);return o.latestCall+=1,o.releaseTimer!==void 0&&(clearTimeout(o.releaseTimer),o.releaseTimer=void 0),o.leaving.forEach(i=>i.detach()),o.leaving.clear(),n==="single"?o.shared=t:o.counted.add(t),o.options.set(t,r),o.order=[...o.order.filter(i=>i!==t&&$e(i)),t],__(o,r),o.latestCall}function S_(e,t){return Pe.get(e)?.latestCall===t}function I_(e){const t=Pe.get(e);if(t)return t.order=t.order.filter($e),t.order.at(-1)?.object}function jt(e,t){const n=Pe.get(e);return n?$e(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&$e(r)):!1}function C_(e,t){const n=Pe.get(e),r=n?.order.filter(o=>o!==t&&$e(o)).at(-1);return r?n?.options.get(r):void 0}function Ql(e,t){jn(e).content={value:t}}function T_(e){return Pe.get(e)?.content}function A_(e,t,n,r){const o=jn(e);if(o.counted.delete(t),o.options.delete(t),jt(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),o.leaving.add(t),Zl(e,r)}function Zl(e,t){const n=Pe.get(e);!n||jt(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!jt(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function R_(e,t){const n=Pe.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);Pe.delete(e)}}var nw=Cs({FileManagerApiError:()=>P_,IntegratorSaveTimeoutError:()=>Rn,SaveRefusedError:()=>Ze}),P_=class ec extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,o){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=o,Error.captureStackTrace&&Error.captureStackTrace(this,ec)}},rw=Cs({mapHttpStatusToErrorCode:()=>Kc});function D_(e,t){return{...e,element:t}}function Xr(){return()=>{}}function O_(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Xr():(FE(t,e.config?.styles,t),()=>{BE(t)})}function k_(e){if(!ql()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Xr()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Xr()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(o=>{o.remove()});const n=HE(t,"data-emailmaker"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function x_(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function Sn(e){try{e.destroy()}catch{}}function fn(e,...t){const n=Te.get(e);t.some(r=>r!==void 0&&r===n)&&Te.delete(e)}var ow="1.2.5";async function iw(e){Eo(),await cy(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0)}async function sw(e){return B_(e).ready}function M_(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function L_(e){const t=Te.get(e);return t&&!(t instanceof Promise)?t:void 0}function In(e,t,n){const r=t??L_(e);r&&(fn(e,r),Sn(r)),R_(e,n)}function N_(e){const{control:t,mode:n,ref:r}=e,o=r.host;if(!o){const s=t.editor;F_(s),t.kill(je());return}if(n==="single"){In(o,t.editor,je());return}const i=C_(o,t);A_(o,t,je(),()=>In(o,t.editor,je())),i&&jt(o)&&Jl(o,i)}function F_(e){e&&Sn(e)}function B_(e){oe(pe.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=Zr(e.signal,n.signal),o=t==="single"?M_(e.element):void 0,i=o?y_(o):void 0;let s;if(i)s={control:i,mode:t,ref:{host:o}};else{const d={},m=c_({element:()=>d.host??e.element,destroy:()=>N_(s),shown:h=>{d.host&&Ql(d.host,h)}});s={control:m,mode:t,ref:d},o&&E_(o,m)}const{control:a}=s,l=a.trackCall(d=>n.abort(d)),c=V_(Kl({...e,signal:r},a.object),s).then(()=>(l(),oe(pe.initEnd),a.settle(),a.object),d=>{l(),a.state==="pending"&&!a.hasCalls()&&a.kill(d);const m=s.ref.host;throw m&&Zl(m,()=>In(m,void 0,je())),d});return a.setReady(c),a.object}function aw(e){const t=typeof e=="string"?document.querySelector(e):e;return t?I_(t):void 0}function j_(e){let t,n,r=!1;try{t=e.container.getInstance(ge)?.get(),n=e.container.getInstance(xe)?.externalSignal;const o=lt(e.container)?.current();r=o!==void 0&&o.get().savedVersion!==null&&o.isDirty()}catch{t=void 0}return{options:t,signal:n,email:U_(e),dirty:r}}async function U_(e){try{return await e.getEmailSnapshot()}catch{return}}function H_(e){const t=lt(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Ss(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||jt(e,n)}async function $_(e,t,n,r,o){if(r.mode==="counted"&&r.control.detach(),h_(o)||u_(o))return;const i=()=>In(t,e,a_(o)),{options:s}=n;if(!s||!Ss(t,r)){i();return}const a=await n.email,l=a&&(s.content!==void 0||a.id!==void 0)?a:void 0,c=typeof s.content=="object"&&"email"in s.content?s.content:void 0;try{await e.reset({...s,signal:s.signal??n.signal,content:l?{...c,email:l}:s.content}),n.dirty&&l&&H_(e),Ss(t,r)?Te.set(t,e):i()}catch{i()}}async function V_(e,t){ne(e.signal);const n=new he;let r,o,i,s,a=0;try{const l=await jc(e.element,n,e.signal);l&&(s=l,t.ref.host=l,a=w_(l,t.control,t.mode,e));const c=p_({hostElementOption:e.element,resolvedElement:l,externalSignal:e.signal,disposable:n}),d=g_(l,{supersede:t.mode==="single"});r=d.release;const m=Zr(c,d.signal);ne(m),i=v_(l),Jl(l,e),await pn(d.previous,m),o=q_(e,l,t,m,i);const h=await pn(o,m);return l&&e.content!==void 0&&Ql(l,e.content),h}catch(l){throw s&&i&&S_(s,a)&&i(),l}finally{const l=r;o!==void 0&&l?o.then(l,l):l?.(),n.dispose()}}async function Is(e,t,n,r){const o=T_(t);n===void 0||r||!o||ke(n,o.value)||await e.show(n)}async function q_(e,t,n,r,o){const{control:i}=n,s=_=>i.bind(_);ne(r);let a;const l=_=>{e_();const b=i_(D_(_,t)),T=QE(b,()=>a);return{preparedOptions:T,preparedOptionsWithSignal:r!=null?{...T,signal:r}:T}};let c;if(t){const _=Te.get(t);if(_){let b;try{b=await _,ne(r)}catch{ne(r),fn(t,_),b=void 0}if(b)if(b.getElement()===t){const T=OE(t);a=T;const A=b.container.getInstance(ge)?.get();if(b_(t,e,A))return s(b),r&&b.container.getInstance(xe)?.relinkExternalSignal(r),Te.set(t,b),await Is(b,t,e.content,!1),b;const B=!ke(e.content,A?.content);c=l(Yr(t,e));const{preparedOptions:O,preparedOptionsWithSignal:k}=c,C=T&&WE(T),R=j_(b);try{T&&br(T,O),s(b);const I=await b.reset(x_(e,k));return ne(r),Te.set(t,b),await Is(b,t,e.content,B),I}catch(I){if(T&&C&&br(T,C),!yd(I))throw o(),await $_(b,t,R,n,I),I;fn(t,_,b),Sn(b),ne(r)}}else fn(t,_,b),Sn(b)}}ne(r),c??=l(Yr(t,e,{fresh:!0}));const{preparedOptions:d}=c,m=O_(d),h=k_(d),E=r!=null?{...h.options,signal:r}:h.options;let w;try{a=ME(E),kE(t,a),br(a,d),xo(a).set(E),await Mo(),oe(pe.coreReady),ne(r),ne(r),w=DE(E,a,{onInstance:s}),t&&Te.set(t,w);const _=await w;if(r?.aborted&&(_.destroy(),ne(r)),t)if(Te.get(t)===w)Te.set(t,_);else throw _.destroy(),ne(r),_e(r?.reason);return _}catch(_){throw m(),h.cleanup(),a&&(Vl(a),xE(t,a)),t&&w&&Te.get(t)===w&&Te.delete(t),_}}async function lw(e){return(await Wt()).parseAMP(e)}typeof window<"u"&&(xt()&&vd(),uy(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0));export{Yl as ELEMENT_DETACHED_ABORT_MESSAGE,Xl as SUPERSEDED_INIT_ABORT_MESSAGE,B_ as create,nw as errors,aw as getInstance,rw as helpers,sw as init,u_ as isElementDetachedError,h_ as isSupersededInitError,lw as parseAMP,py as pluginRegistry,iw as preload,ow as version};
1078
1078
 
1079
1079
 
1080
- window.__emailmaker__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/15ea858c.js":[],"static/core/1687225b.js":["static/core/9e7c400d.js","static/core/9ff19e12.js","static/core/42ec1ce9.js","static/core/97aabe39.js","__delivery__/libs"],"static/core/1912a30e.js":[],"static/core/286097e2.js":["static/core/9ff19e12.js","static/core/466f98bb.js","__delivery__/libs","static/core/9e7c400d.js"],"static/core/316f71b7.js":["static/core/844fbb88.js","__delivery__/libs"],"static/core/370f04c3.js":[],"static/core/42ec1ce9.js":["static/core/9e7c400d.js","__delivery__/libs"],"static/core/43a8b244.js":[],"static/core/466f98bb.js":["static/core/844fbb88.js","__delivery__/libs"],"static/core/4797d4f7.js":[],"static/core/48e93de9.js":["static/core/1912a30e.js"],"static/core/492992bb.js":[],"static/core/60b75c99.js":["static/core/1912a30e.js"],"static/core/6535dd13.js":["static/core/370f04c3.js","__delivery__/libs","monaco"],"static/core/6933d533.js":[],"static/core/6e548251.js":["static/core/bbb11e65.js","static/core/1912a30e.js","static/core/60b75c99.js"],"static/core/7452d34b.js":[],"static/core/76d1f317.js":[],"static/core/844fbb88.js":["__delivery__/libs"],"static/core/8a5b1c18.js":[],"static/core/8bf56b5b.js":[],"static/core/97aabe39.js":["static/core/466f98bb.js","__delivery__/libs"],"static/core/9e7c400d.js":["static/core/a8cb6e27.js","static/core/e88db487.js","__delivery__/libs"],"static/core/9ff19e12.js":["static/core/9e7c400d.js","__delivery__/libs"],"static/core/a8cb6e27.js":[],"static/core/aab84cf4.js":[],"static/core/abcacabc.js":[],"static/core/b6999cba.js":[],"static/core/b712bb05.js":["static/core/e88db487.js"],"static/core/b752ed52.js":[],"static/core/b99f4f42.js":[],"static/core/bbb11e65.js":[],"static/core/c2daae71.js":[],"static/core/c6cd3dc2.js":[],"static/core/c7b2d60e.js":[],"static/core/d0b845c8.js":[],"static/core/d2a90b69.js":[],"static/core/dfbe3ba4.js":[],"static/core/e13d6875.js":[],"static/core/e88db487.js":[],"static/core/ed4586a5.js":["static/core/bbb11e65.js"],"static/core/ee6a6899.js":["static/core/9e7c400d.js","static/core/e88db487.js","__delivery__/libs"],"static/monaco/editor.api-DqgksfDR.js":[],"monaco":["static/monaco/editor.api-DqgksfDR.js","static/monaco/lspLanguageFeatures-BnvITcKb.js"],"static/monaco/lspLanguageFeatures-BnvITcKb.js":["static/monaco/editor.api-DqgksfDR.js"],"compat-globals.js":["static/esm/971f1b2c.js"],"emailmaker-esm.js":["static/esm/971f1b2c.js","static/esm/ea997fe3.js","static/esm/f76c9d9d.js"],"static/esm/delivery-libs.js":[],"static/esm/2490dab8.js":["static/esm/971f1b2c.js"],"static/esm/971f1b2c.js":[],"static/esm/ea997fe3.js":[],"static/esm/f76c9d9d.js":[]},"bundles":{"static/core/466f98bb.js":["static/core/df55e6fd.js","static/core/5835858b.js","static/core/ffc6c926.js"],"static/core/ed4586a5.js":["static/core/a54d9b28.js"],"static/core/ee6a6899.js":["static/core/74d00db4.js"],"static/core/97aabe39.js":["static/core/61378c9e.js"],"static/core/286097e2.js":["static/core/c5bbb916.js"],"core":["static/core/5dc34752.js","static/core/422c8b42.js","static/core/c804e4dd.js","static/core/b0620c65.js","static/core/abb243ca.js"]}});
1080
+ window.__emailmaker__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/155e871a.js":["static/core/e7fa68c2.js","__delivery__/libs"],"static/core/15ea858c.js":[],"static/core/17fba7af.js":[],"static/core/2a042fe3.js":[],"static/core/32a14159.js":[],"static/core/370f04c3.js":[],"static/core/43a8b244.js":[],"static/core/4797d4f7.js":[],"static/core/4de9c323.js":["static/core/5b6e2acb.js"],"static/core/50ba806c.js":["static/core/a8cb6e27.js","static/core/e88db487.js","__delivery__/libs"],"static/core/5b6e2acb.js":[],"static/core/63e7f8c1.js":["static/core/c03be019.js","static/core/e7fa68c2.js","__delivery__/libs","static/core/50ba806c.js"],"static/core/64711257.js":["static/core/50ba806c.js","static/core/e88db487.js","__delivery__/libs"],"static/core/659796a7.js":[],"static/core/683a6a53.js":["static/core/7e167222.js"],"static/core/6933d533.js":[],"static/core/6b16159c.js":[],"static/core/7452d34b.js":[],"static/core/76d1f317.js":[],"static/core/7e167222.js":[],"static/core/82f8beb4.js":[],"static/core/8a5b1c18.js":[],"static/core/8bf56b5b.js":[],"static/core/987afc3f.js":["__delivery__/libs"],"static/core/9eaed676.js":[],"static/core/a8b4352d.js":["static/core/50ba806c.js","static/core/c03be019.js","static/core/b7289065.js","static/core/155e871a.js","__delivery__/libs"],"static/core/a8cb6e27.js":[],"static/core/abcacabc.js":[],"static/core/b712bb05.js":["static/core/e88db487.js"],"static/core/b7289065.js":["static/core/50ba806c.js","__delivery__/libs"],"static/core/b96e571d.js":["static/core/987afc3f.js","__delivery__/libs"],"static/core/c03be019.js":["static/core/50ba806c.js","__delivery__/libs"],"static/core/c3d00c5e.js":[],"static/core/c67df236.js":[],"static/core/c8443fab.js":[],"static/core/d0b845c8.js":[],"static/core/d2780737.js":["static/core/7e167222.js"],"static/core/d503c406.js":["static/core/5b6e2acb.js","static/core/7e167222.js","static/core/683a6a53.js"],"static/core/dd230bbb.js":[],"static/core/e7fa68c2.js":["static/core/987afc3f.js","__delivery__/libs"],"static/core/e88db487.js":[],"static/core/f35181ec.js":["static/core/370f04c3.js","__delivery__/libs","monaco"],"static/monaco/editor.api-DqgksfDR.js":[],"monaco":["static/monaco/editor.api-DqgksfDR.js","static/monaco/lspLanguageFeatures-BnvITcKb.js"],"static/monaco/lspLanguageFeatures-BnvITcKb.js":["static/monaco/editor.api-DqgksfDR.js"],"compat-globals.js":["static/esm/971f1b2c.js"],"emailmaker-esm.js":["static/esm/971f1b2c.js","static/esm/b4f8dfdc.js","static/esm/f76c9d9d.js"],"static/esm/delivery-libs.js":[],"static/esm/2490dab8.js":["static/esm/971f1b2c.js"],"static/esm/971f1b2c.js":[],"static/esm/b4f8dfdc.js":[],"static/esm/f76c9d9d.js":[]},"bundles":{"static/core/e7fa68c2.js":["static/core/61d7e59b.js","static/core/425e50a8.js","static/core/b37ca4d7.js"],"static/core/4de9c323.js":["static/core/a54d9b28.js"],"static/core/64711257.js":["static/core/74d00db4.js"],"static/core/155e871a.js":["static/core/61378c9e.js"],"static/core/63e7f8c1.js":["static/core/17bec902.js"],"core":["static/core/5dc34752.js","static/core/ee980948.js","static/core/814472f3.js","static/core/2fab5a65.js","static/core/75bbe11f.js"]}});