@emailmaker/emailmaker 1.2.0 → 1.2.3
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.
- package/README.md +4 -0
- package/emailmaker-core.8c2b05d7.js +859 -0
- package/emailmaker-esm.js +11 -11
- package/{emailmaker-po.fec11667.js → emailmaker-po.8c2b05d7.js} +1 -1
- package/emailmaker.d.ts +34 -2
- package/emailmaker.js +12 -12
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/{iframe-eblock.fec11667.html → iframe-eblock.8c2b05d7.html} +2 -2
- package/iframe/{iframe.fec11667.html → iframe.8c2b05d7.html} +2 -2
- package/iframe/js/elMarkupHelper.DnlKn-Lc.js +277 -0
- package/iframe/js/iframe-eblock.body.8c2b05d7.js +9 -0
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/iframe.body.8c2b05d7.js +129 -0
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{9f7e0f94.js → 1687225b.js} +1 -1
- package/static/core/{5c4239d8.js → 1912a30e.js} +1 -1
- package/static/core/{f2ced98d.js → 286097e2.js} +2 -2
- package/static/core/{8da91a53.js → 316f71b7.js} +1 -1
- package/static/core/{b7dee12b.js → 42ec1ce9.js} +2 -2
- package/static/core/466f98bb.js +28 -0
- package/static/core/{64c27f91.js → 48e93de9.js} +1 -1
- package/static/core/{7d006e7b.js → 492992bb.js} +1 -1
- package/static/core/{b74171bd.js → 60b75c99.js} +1 -1
- package/static/core/{ccb090eb.js → 6535dd13.js} +7 -7
- package/static/core/{bbb87124.js → 6e548251.js} +1 -1
- package/static/core/{a2c7aeb0.js → 844fbb88.js} +1 -1
- package/static/core/{e7bbe544.js → 97aabe39.js} +1 -1
- package/static/core/{ec5f739e.js → 9e7c400d.js} +10 -10
- package/static/core/9ff19e12.js +4 -0
- package/static/core/{b27aec0b.js → aab84cf4.js} +1 -1
- package/static/core/{727a165f.js → b6999cba.js} +1 -1
- package/static/core/{a9235d9e.js → b752ed52.js} +1 -1
- package/static/core/{f54ef492.js → b99f4f42.js} +1 -1
- package/static/core/{db685f4e.js → bbb11e65.js} +1 -1
- package/static/core/{29b3ccef.js → c2daae71.js} +1 -1
- package/static/core/{7be64bf5.js → c6cd3dc2.js} +1 -1
- package/static/core/{e15ab856.js → c7b2d60e.js} +1 -1
- package/static/core/{8b89090c.js → d2a90b69.js} +1 -1
- package/static/core/{c5713f94.js → dfbe3ba4.js} +1 -1
- package/static/core/{44fac8d4.js → e13d6875.js} +1 -1
- package/static/core/{99c15a5d.js → ed4586a5.js} +1 -1
- package/static/core/{790366d3.js → ee6a6899.js} +1 -1
- package/static/esm/ea997fe3.js +1 -0
- package/static/umd-runtime/{runtime.CunK0nEC.js → runtime.BqNyFZPj.js} +1 -1
- package/vendor/@emailmaker/ui-kit/package.json +1 -1
- package/emailmaker-core.fec11667.js +0 -859
- package/iframe/js/elMarkupHelper.Dv3AYDYP.js +0 -279
- package/iframe/js/iframe-eblock.body.fec11667.js +0 -9
- package/iframe/js/iframe.body.fec11667.js +0 -129
- package/static/core/2e70fae0.js +0 -4
- package/static/core/83d2ca5d.js +0 -28
- package/static/esm/ae0fe329.js +0 -1
package/emailmaker.js
CHANGED
|
@@ -1014,7 +1014,7 @@ var __amdEnv = window.__emailmaker__ || (window.__emailmaker__ = {});
|
|
|
1014
1014
|
|
|
1015
1015
|
|
|
1016
1016
|
// Configure AMD loader
|
|
1017
|
-
__amdEnv.require.config({ baseUrl: "./", paths: {"core":"emailmaker-core.
|
|
1017
|
+
__amdEnv.require.config({ baseUrl: "./", paths: {"core":"emailmaker-core.8c2b05d7.js","monaco":"static/monaco/index.CCINpETE.js","po":"emailmaker-po.8c2b05d7.js","static/umd-runtime/delivery-libs.js":"static/umd-runtime/delivery-libs.eFZaeVgo.js","static/umd-runtime/runtime.js":"static/umd-runtime/runtime.BqNyFZPj.js","static/umd-runtime/ui-kit-icons.js":"static/umd-runtime/ui-kit-icons.CSCUi7bp.js","static/umd-runtime/ui-kit.js":"static/umd-runtime/ui-kit.nmR1Bl60.js"} });
|
|
1018
1018
|
|
|
1019
1019
|
// PublicPath (script detection: entry script lookup → document.currentScript)
|
|
1020
1020
|
if (!__emailmaker__.publicPath) {
|
|
@@ -1362,7 +1362,7 @@ if (!ns.assetUrl) {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
|
|
1364
1364
|
if (!ns.version) {
|
|
1365
|
-
ns.version = "1.2.
|
|
1365
|
+
ns.version = "1.2.3";
|
|
1366
1366
|
}
|
|
1367
1367
|
|
|
1368
1368
|
var modules = ns.modules = Object.create(null);
|
|
@@ -2093,20 +2093,20 @@ if (typeof ns.define === 'function') {
|
|
|
2093
2093
|
__emailmaker__.define("static/umd/790cf6cb.js",["require","exports","module"],function(y,_,w){var p=Object.create,a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,f=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,O=(e,r)=>()=>(r||(e((r={exports:{}}).exports,r),e=null),r.exports),v=(e,r)=>{let t={};for(var u in e)a(t,u,{get:e[u],enumerable:!0});return r||a(t,Symbol.toStringTag,{value:"Module"}),t},P=(e,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(var c=b(r),l=0,j=c.length,n;l<j;l++)n=c[l],!o.call(e,n)&&n!==t&&a(e,n,{get:(s=>r[s]).bind(null,n),enumerable:!(u=i(r,n))||u.enumerable});return e},g=(e,r,t)=>(t=e!=null?p(f(e)):{},P(r||!e||!e.__esModule||!o.call(e,"default")?a(t,"default",{value:e,enumerable:!0}):t,e));Object.defineProperty(_,"__commonJSMin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_,"__exportAll",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_,"__toESM",{enumerable:!0,get:function(){return g}})});
|
|
2094
2094
|
|
|
2095
2095
|
|
|
2096
|
-
__emailmaker__.define("static/umd/3a37cbb5.js",["require","exports","module"],function(Rn,c,wn){var g=class ct{_inner;_isDisposed=!1;constructor(t=[]){this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof ct&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const r=this._inner.indexOf(t);r>=0&&this._inner.splice(r,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function M(e){return`service_container_${e}`}var y=new Set,V;function ut(){if(!V)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,se.prototype.getInstanceAsync),e.stack}function X(e){y.delete(e)&&V?.end(e)}var se=class oe extends g{_parent;_injectCallbacks=[];_injections=Object.create(null);_runCallbacks(t){[...this._injectCallbacks].forEach(r=>r(t))}constructor(t=null){super(),this._parent=t,t&&this.addDisposable(t.onInject(r=>this._runCallbacks(r)))}onInject=t=>(this._injectCallbacks.push(t),{dispose:()=>{const r=this._injectCallbacks.indexOf(t);r>=0&&this._injectCallbacks.splice(r,1)}});inject(t,r){this._injections[t]=()=>r,this._runCallbacks(t)}injectFactory(t,r,n){const i=this._injections[t];let o=typeof i=="function"?i():i;const s=this._injections[t]=()=>(o=r(this,o),o);n&&s(),this._runCallbacks(t)}_find(t,r=!0){return this._injections[t]||r&&this._parent?._find(t)}_onInject(t,r,n=new g){return n.addDisposable(this.onInject(i=>{t===i&&!n.isDisposed()&&(n.dispose(),r(this.getInstance(i)))})),this._parent&&n.addDisposable(this._parent._onInject(t,r,n)),this.addDisposable(n),n}getInstance(t,r=!0){const n=this._find(t,r);if(typeof n=="function")return n()}getOrCreateInstance(t,r){const n=this._find(t);if(typeof n=="function")return n();const i=r(this);return this.inject(t,i),i}getInstanceAsync(t){const r=this._find(t);if(typeof r=="function")return Promise.resolve(r());const n=ut();return new Promise((i,o)=>{const s={id:String(t),startedAt:Date.now(),origin:n,container:this,reject:o};y.add(s),V?.start(s),this._onInject(t,()=>{X(s),i(this.getInstance(t))})})}failPendingWaits(t){for(const r of Array.from(y))r.container===this&&(X(r),r.reject(t))}pendingWaits(){return[...y].filter(t=>t.container===this)}addService(t,r){const n=M(t);this.injectFactory(n,(o,s=[])=>s.indexOf(r)<0?[...s,r]:s);const i=new g;return i.addDispose(()=>{this.injectFactory(n,(o,s=[])=>s.filter(a=>a!==r))}),i}addServiceFactory(t,r,n){const i=M(t);let o;this.injectFactory(i,(a,u=[])=>(o=r(a,o),o===void 0?u:u.indexOf(o)<0?[...u,o]:u),n);const s=new g;return s.addDispose(()=>{this.injectFactory(i,(a,u=[])=>o===void 0?u:u.filter(_=>_!==o))}),s}getServices(t){const r=M(t);return[...this.getInstance(r,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new oe(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const r=this._parent?.getOrCreateIsolatedContainer(t);return new oe(r)})}remove(t){const r=this._injections;delete r[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(y))t.container===this&&X(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function $(e){return e.startsWith("__")?e:`__${e}__`}function _t(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=$(e),r=globalThis;return r[t]??={}}function lt(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function dt(e){if(e)return $(e);const t="emailmaker".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return $(t)}function ae(e){const t=dt(e),r=_t(t);if(lt(r.container))return r.container;const n=new se(null);return r.container=n,n}function ft(e){return ae(e)}function Et(){let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){let n=Math.random()*16;return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),(r==="x"?n:n&3|8).toString(16)})}function ce(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Et()}function f(e=ce()){return e}function ue(){return"umd".trim()||"unknown"}function pt(e){if(typeof globalThis>"u")return;const t=ue(),r=globalThis[e]??{};globalThis[e]=r;const n=r.__diagnostics??={},i=n.diModuleEval??={evalCount:0,records:[]};i.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),i.evalCount+=1}function ht(){const e="emailmaker".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function Ot(e,t){if(pt(t),typeof globalThis>"u")return e;const r=ue(),n=globalThis,i=n[t]=n[t]||{},o=i.__diagnostics=i.__diagnostics||{},s=o.dependencyResolver=o.dependencyResolver||{entries:[]},a={container:e,source:"packages/runtime-core/di/index.ts",buildSource:r,timestamp:Date.now(),stack:new Error().stack};return s.entries.push(a),e}var B;function mt(){if(B)return B;const e=ht();return B=Ot(ae(e),e),B}var W=new Proxy({},{get(e,t,r){const n=mt(),i=Reflect.get(n,t,r);return typeof i=="function"?i.bind(n):i}});function At(e,t="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return t}}function S(e){if(e instanceof DOMException&&e.name==="AbortError")return e;const t=e===void 0?"The operation was aborted.":typeof e=="string"?e:e instanceof Error?e.message:String(e);return new DOMException(t,"AbortError")}function gt(e){return e instanceof DOMException&&e.name==="AbortError"}function K(e){if(e?.aborted)throw S(e.reason)}function It(e,t){return t?(t.aborted&&e.catch(()=>{}),K(t),new Promise((r,n)=>{const i=()=>{o(),n(S(t.reason))},o=()=>{t.removeEventListener("abort",i)};t.addEventListener("abort",i),e.then(s=>{o(),r(s)},s=>{o(),n(s)})})):e}var _e=class extends g{_options;_listeners=[];constructor(e={}){super(),this._options=e}getListeners(e){return this._listeners.flatMap(([t])=>typeof t=="function"?t:t.getListeners(e))}hasListeners(){for(const[e]of this._listeners){if(typeof e=="function")return!0;const t=e;if(typeof t.hasListeners=="function"){if(t.hasListeners())return!0;continue}return!0}return!1}_addListener(e,t=0,r){if(this.isDisposed())return{dispose:()=>{}};const n=this._listeners,i=this._options;r&&typeof e=="function"&&(e=e.bind(r));const o=n.findIndex(([,a])=>a<t),s=[e,t];return n.splice(o>=0?o:n.length,0,s),n.length===1&&i.onFirstListenerAdd&&i.onFirstListenerAdd(),{dispose:()=>{const a=n.indexOf(s);a>=0&&(n.splice(a,1),!n.length&&i.onLastListenerRemove&&i.onLastListenerRemove())}}}on=this._addListener.bind(this);event=this._addListener.bind(this);once=(e,t=0,r)=>{const n=this._addListener((...i)=>(n?.dispose(),r?e.call(r,...i):e(...i)),t);return n};un=e=>{const t=this._listeners.findIndex(([r])=>r===e);t>=0&&(this._listeners.splice(t,1),this._listeners.length===0&&this._options.onLastListenerRemove&&this._options.onLastListenerRemove())};dispose(){this._listeners.splice(0,this._listeners.length),this._options.onLastListenerRemove&&this._options.onLastListenerRemove(),super.dispose()}},b=class extends _e{execute(e,t){for(const r of t)try{r(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},Tt=class extends b{execute([e],t){for(const r of t)try{r(e)}catch{}}},St=class extends b{_suspendCounter=0;_wasFired=!1;execute([e],t){if(this._suspendCounter)this._wasFired=!0;else for(const r of t)try{r(e)}catch{}}suspend(){this._suspendCounter++}resume(){--this._suspendCounter===0&&this._wasFired&&(this.fire(),this._wasFired=!1)}},j=class extends b{async execute([e],t){const r=[];for(const n of t)try{r.push(await n(e))}catch{}return r}async fireSettled(e){const t={results:[],errors:[]};if(this.isDisposed())return t;for(const r of this.getListeners([e]))try{t.results.push(await r(e))}catch(n){t.errors.push(n)}return t}};function bt(e,t=0){const r=new _e,n=e(r,t);return n&&r.addDisposable(n),r.event}function Dt(e,t,r=0){const n=new b,i=e((...o)=>{if(t(...o))return n.fire(...o)},r);return i&&n.addDisposable(i),n.event}function Nt(e,t=0,r=0){const n=new b;let i,o;const s=e((...a)=>{o=a,i||(i=setTimeout(()=>{o&&n.fire(...o),i=void 0},t))},r);return s&&n.addDisposable(s),n.event}function Pt(e,t){return e.getOrCreateInstance(t,()=>new j)}function d(e){return f(e)}var q;(function(e){e.BEFORE_SAVE_EMAIL=d("events.BEFORE_SAVE_EMAIL"),e.ON_SAVEBUTTON_CLICK_ID=d("events.ON_SAVEBUTTON_CLICK_ID"),e.ON_NEXTBUTTON_CLICK_ID=d("events.ON_NEXTBUTTON_CLICK_ID"),e.ON_PREVIOUSBUTTON_CLICK_ID=d("events.ON_PREVIOUSBUTTON_CLICK_ID"),e.ON_DOCUMENT_SESSION_CHANGE=d("events.ON_DOCUMENT_SESSION_CHANGE"),e.WILL_EMAIL_INIT_ID=d("events.WILL_EMAIL_INIT_ID"),e.ON_EMAIL_INIT_ID=d("events.ON_EMAIL_INIT_ID"),e.ON_BLOCK_INIT_ID=d("events.ON_BLOCK_INIT_ID"),e.ON_CONTENT_CHANGED_ID=d("events.ON_CONTENT_CHANGED_ID"),e.ON_PREHEADER_CHANGED_ID=d("events.ON_PREHEADER_CHANGED_ID"),e.ON_SUBJECT_CHANGED_ID=d("events.ON_SUBJECT_CHANGED_ID"),e.ON_EMAIL_CHANGED_ID=d("events.ON_EMAIL_CHANGED_ID"),e.ON_HEADER_APPLIED_ID=d("events.ON_HEADER_APPLIED_ID"),e.ON_BLOCK_CHANGED_ID=d("events.ON_BLOCK_CHANGED_ID"),e.ON_BLOCK_OPEN_ID=d("events.ON_BLOCK_OPEN_ID"),e.ON_BLOCK_CLOSE_ID=d("events.ON_BLOCK_CLOSE_ID"),e.OPEN_BLOCK_REQUEST_ID=d("events.OPEN_BLOCK_REQUEST_ID"),e.ON_BLOCK_SAVEBUTTON_CLICK_ID=d("events.ON_BLOCK_SAVEBUTTON_CLICK_ID"),e.ON_BLOCK_CLONE_ID=d("events.ON_BLOCK_CLONE_ID"),e.ON_CHUNKS_LOADED=d("events.ON_CHUNKS_LOADED"),e.ON_SEND_TESTEMAIL_ID=d("events.ON_SEND_TESTEMAIL_ID"),e.ON_SEND_LIVEPREVIEW_ID=d("events.ON_SEND_LIVEPREVIEW_ID"),e.ON_SHARE_ID=d("events.ON_SHARE_ID"),e.ON_SHOW_PREVIEW_ID=d("events.ON_SHOW_PREVIEW_ID"),e.ON_EMAIL_CLONE_ID=d("events.ON_EMAIL_CLONE_ID"),e.ON_SEND_EMAIL_MODAL_ID=d("events.ON_SEND_EMAIL_MODAL_ID"),e.ON_ANALYTICS_EVENT=d("events.ON_ANALYTICS_EVENT"),e.ON_NOTIFICATION=d("events.ON_NOTIFICATION"),e.READ_LOCALE=d("events.READ_LOCALE"),e.ON_TRANSLATE_ID=d("events.ON_TRANSLATE_ID"),e.ON_CODE_VALIDATE_ID=d("events.ON_CODE_VALIDATE_ID"),e.ON_IMPORT_VALIDATE_ID=d("events.ON_IMPORT_VALIDATE_ID"),e.UPLOAD_EVENT_ID=d("events.UPLOAD_EVENT_ID"),e.PROXY_URL_EVENT_ID=d("events.PROXY_URL_EVENT_ID"),e.FILE_PROXY_EVENT_ID=d("events.FILE_PROXY_EVENT_ID"),e.ON_LIMIT_ID=d("events.ON_LIMIT_ID"),e.ON_BROWSER_EXTENSION_DETECTED_ID=d("events.ON_BROWSER_EXTENSION_DETECTED_ID"),e.ON_LAYOUT_CONVERT_REQUEST_ID=d("events.ON_LAYOUT_CONVERT_REQUEST_ID"),e.ON_BROWSER_TRANSLATE_DETECTED_ID=d("events.ON_BROWSER_TRANSLATE_DETECTED_ID"),e.AI_TEXT_REQUEST_ID=d("events.AI_TEXT_REQUEST_ID"),e.AI_IMAGE_REQUEST_ID=d("events.AI_IMAGE_REQUEST_ID"),e.AI_TEXT_PROGRESS_ID=d("events.AI_TEXT_PROGRESS_ID"),e.AI_IMAGE_PROGRESS_ID=d("events.AI_IMAGE_PROGRESS_ID"),e.AI_TEXT_STREAM_ID=d("events.AI_TEXT_STREAM_ID")})(q||(q={}));function yt(e,t){return e.getOrCreateInstance(t,()=>new j).event}function Ct(e,t){return e.getOrCreateInstance(t,()=>new j)}var Lt=f("plugin.app"),vt=f("plugin.disposable"),Rt=f("InitPipelineContext"),wt=f("plugin.instance"),Mt=f("plugin.lateSurfaceListeners"),le=f("plugin.optionsSource"),Bt=f("plugin.store"),de=f("ConfigSource"),jt=f("plugin.standalone.project"),fe=f("plugin.standalone.bootstrapToken"),Mn=f("plugin.element"),Ee=f("plugin.securityModule"),Ft=f("plugin.standalone.activated"),xt=f("plugin.standalone.fileProxyRegistered"),z=f("plugin.jwt.token"),C=f("plugin.jwt.error"),kt=f("PluginCollection"),Ut=d("APP_LOAD_EVENT"),Ht=d("CONFIG_CHANGED_EVENT");function Gt(e,t=window){return{peer:e,send(r){e.postMessage(r,"*")},subscribe(r){const n=i=>{r({data:i.data,source:i.source,ports:i.ports})};return t.addEventListener("message",n),{dispose:()=>t.removeEventListener("message",n)}},close(){}}}function Vt(e){let t=!1;return{peer:e,send(r){e.postMessage(r)},subscribe(r){const n=i=>{r({data:i.data,source:e})};return e.addEventListener("message",n),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",n)}},close(){e.close()}}}function Xt(e){return e}function $t(e){return e&&typeof e=="object"}function pe(e,t){return e&&typeof e=="object"&&e.operationId===t}var T="INIT_MESSAGE",he="em:port-ready",Wt="em:window-drained",Y="";function Oe(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var Kt=class extends g{_listeners=Object.create(null);addListenerAsync=(e,t,r=0,n)=>{const i=this._listeners[e]||(this._listeners[e]=[]);n&&typeof t=="function"&&(t=t.bind(n));const o=i.findIndex(([a,u])=>r<=u),s=[t,r];return this.isDisposed()||i.splice(o>=0?o:i.length,0,s),{dispose(){const a=i.indexOf(s);a>=0&&i.splice(a,1)}}};fireAsync=(e,t)=>{if(!this.isDisposed()){const r=this._listeners[e]||(this._listeners[e]=[]);let n;for(let i=0;i<r.length;i++){const o=r[i][0],s=n;n=a=>o(a,s)}if(n)return n(t)}};addListener=(e,t,r=0)=>this.addListenerAsync(e,(n,i)=>{try{t(n)}catch{}return i&&i(n)},r)},qt=class extends g{_singleton;_target;_transport;_transportSubscription;_ports=new Map;_drained=new WeakSet;_portSendHeld=new WeakSet;_inited=!1;_emitter=this.addDisposable(new Kt);_handshaken=new WeakSet;_greeted=new WeakSet;_outgoingFilter;_outgoingObservers=new Set;_offTargetListeners=new Map;constructor(e,t){super(),this._singleton=t,this._transport=Gt({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(T,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(T))}),e&&this.setTarget(e)}_onTransportMessage=e=>{const t=e,r=t.data,n=t.source,i=r?.port===!0?t.ports?.[0]:void 0,o=!this._isPortSource(t.source);if(o&&n&&r?.operationId==="em:window-drained"){this._ports.has(n)&&this._drained.add(n);return}if(o&&n&&this._drained.has(n))return;if(n&&n!==this._target&&this._greeted.has(n)&&pe(r,T)){this._greeted.delete(n),this._handshaken.add(n),this._postMessage(n,{operationId:T,data:{}}),i&&this.usePort(i,!0,n);return}const s=t.source===this.target||this._isCurrentPort(t.source);if(s||this._notifyOffTarget(r?.operationId,t.source),$t(r)&&s||this._singleton&&pe(r,T)){if(i&&s){const l=this._target;Promise.resolve().then(()=>this.usePort(i,!0,l))}const a=this._emitter.fireAsync(r.operationId||Y,r.operationId===void 0?t:r.data),u=r.result,_=r.error;u&&_&&Promise.resolve(a).then(l=>this._sendMessage(u,l),l=>this._sendMessage(_,l))}};setTarget(e){if(this._target!==e){if(this._target=e,!e){this._inited=!1;return}if(this._handshaken.has(e)){this._inited=!0,this._emitter.fireAsync(T,void 0);return}this._inited=!1,this._postMessage(e,{operationId:T,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:T,data:{},port:!0},[t])}observeOutgoing(e){return this._outgoingObservers.add(e),{dispose:()=>{this._outgoingObservers.delete(e)}}}_notifyOutgoing(e,t){for(const r of Array.from(this._outgoingObservers))try{r(e,t)}catch{}}addOffTargetListener(e,t){let r=this._offTargetListeners.get(e);return r||(r=new Set,this._offTargetListeners.set(e,r)),r.add(t),{dispose:()=>{r.delete(t)}}}_notifyOffTarget(e,t){const r=typeof e=="string"?this._offTargetListeners.get(e):void 0,n=r?.size?this._knownPeer(t):void 0;if(!(!r||!n))for(const i of Array.from(r))try{i(n)}catch{}}_knownPeer(e){for(const[r,n]of this._ports)if(n.transport.peer===e)return r;const t=e;return typeof e=="object"&&e!==null&&(this._handshaken.has(t)||this._greeted.has(t))?t:void 0}setOutgoingFilter(e){return this._outgoingFilter=e,()=>{this._outgoingFilter===e&&(this._outgoingFilter=void 0)}}sendNow(e){const t=this._target;return!this._inited||!t?!1:(this._postMessage(t,e),!0)}greet(e){this._handshaken.has(e)||this._greeted.has(e)||this._target===e||(this._greeted.add(e),this._postMessage(e,{operationId:T,data:{}}))}forget(e){this._handshaken.delete(e),this._greeted.delete(e),this._closePort(e),this._drained.delete(e),this._target===e&&(this._inited=!1)}usePort(e,t=!1,r=this._target){if(!r||this._ports.has(r))return;const n=Vt(e),i=n.subscribe(this._onTransportMessage);this._ports.set(r,{transport:n,subscription:i}),t&&(n.send({operationId:he,data:{}}),this.drainWindow(r))}holdPort(e=this._target){!e||!this._ports.has(e)||(this._portSendHeld.add(e),this._drained.delete(e))}resumePort(e=this._target){e&&this._portSendHeld.delete(e)}useWindow(e=this._target){e&&(this._closePort(e),this._drained.delete(e))}get usesPort(){return this._target!==void 0&&this._ports.has(this._target)&&!this._portSendHeld.has(this._target)}hasPort(e,t){const r=this._ports.get(e);return r!==void 0&&(t===void 0||r.transport.peer===t)}_closePort(e){const t=this._ports.get(e);t&&(t.subscription.dispose(),t.transport.close(),this._ports.delete(e),this._portSendHeld.delete(e))}drainWindow(e){this._ports.has(e)&&e.postMessage({operationId:Wt,data:{}},"*")}isWindowDrained(e){return this._drained.has(e)}_isPortSource(e){for(const t of this._ports.values())if(t.transport.peer===e)return!0;return!1}_isCurrentPort(e){return this._target!==void 0&&this._ports.get(this._target)?.transport.peer===e}getTarget(){return this._target}get target(){return this._target}_postMessage(e,t,r){let n=t;this._outgoingFilter&&!r?.length&&(n="data"in t?{...t,data:this._outgoingFilter(t.data)}:this._outgoingFilter(t));try{const i=this._ports.get(e);if(i&&!this._portSendHeld.has(e)){i.transport.send(n);return}if(r?.length){e.postMessage(n,"*",r);return}e.postMessage(n,"*")}catch(i){if(i?.name==="DataCloneError"){const o=typeof n?.data=="object"&&n?.data!==null?n.data:void 0}throw i}}_sendMessage(e,t,r=!0){if(!r&&!this.isInited())return;e&&this._notifyOutgoing(e,t);const n=this.addDisposable(this.onInit(i=>{const o=e?{operationId:e,data:t}:t;try{this._postMessage(i,{...o})}finally{n.dispose()}}))}send(e,t,r){return typeof e=="string"?this._sendMessage(e,t,r):this._sendMessage(Y,e,t)}sendAsync(e,t,r=!0){if(!r&&!this.isInited())return Promise.resolve();this._notifyOutgoing(e,t);const n=Oe(),i=Oe();return new Promise((o,s)=>{const a=this.addDisposable(new g);a.addDisposable(this.onInit(u=>{try{this._postMessage(u,{operationId:e,data:t,result:n,error:i})}catch(_){a.dispose(),s(_);return}a.addDisposable(this._onMessage(n,_=>{o(_),a.dispose()})),a.addDisposable(this._onMessage(i,_=>{s(_),a.dispose()}))}))})}_onMessage(e,t,r=0){return this._emitter.addListener(e,t,r)}addListener(e,t,r){return t?this._onMessage(e,t,r):this._onMessage(Y,e)}addListenerAsyncPipe(e,t,r=0){return this._emitter.addListenerAsync(e,t,r)}addListenerAsync(e,t,r=0){return this._emitter.addListenerAsync(e,async(n,i)=>{const o=await t(n);return i?i(n):o},r)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,r=0){const n=this.addDisposable(new g);return this._inited&&this._target?t&&Promise.resolve().then(()=>{!this._inited||!this._target?n.addDisposable(this.onInit(e,t,r)):e(this._target)}):n.addDisposable(this._onMessage(T,()=>{e(this._target)},r)),n}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}};function L(e){return f(e)}var zt=f("extensions.atomsHandlers"),Yt=L("HANDLE_ATOM_INSERT"),Jt=f("HeadlessMode"),Qt=f("extensions.sandboxExtensions"),Zt="SANDBOX_EXTENSION_SCRIPT_STATUS",er=f("MESSAGE_SERVICE"),tr=L("SETTINGS_PANEL_EVENT"),rr="advanced",nr=L("MODAL_SHOW_EVENT"),ir=L("MODAL_CLOSE_EVENT"),or=L("MODAL_UPDATE_EVENT"),Bn=f("client"),jn=f("v2_client"),Fn=f("ai_client"),sr=f("app.cookieManager"),xn=f("app.storageProvider"),kn=f("image-blob-resolver"),ar=f("template-directives"),cr=(function(e){return e.Json="application/json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),ur=class{baseUrl="https://api.emailmaker.ru/wp-json";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(r=>this.encodeQueryParam(t,r)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(r=>typeof t[r]<"u").map(r=>Array.isArray(t[r])?this.addArrayQueryParam(t,r):this.addQueryParam(t,r)).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,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce((t,r)=>{const n=e[r];return t.append(r,n instanceof Blob?n:typeof n=="object"&&n!==null?JSON.stringify(n):`${n}`),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 r=this.abortControllers.get(e);return r?r.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))};async request({body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:u,proxyHandler:_,...l}){const E=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},h=this.mergeRequestParams(l,E);u&&(i=i?{...i,...u}:u);const p=i&&this.toQueryString(i),A=this.contentFormatters[n||"application/json"],O=o||h.format,H=`${s||this.baseUrl||""}${r}${p?`?${p}`:""}`,Ln=_?_(H,{body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:u,proxyHandler:_,...l}):H,st=new Request(Ln,{...h,headers:{...h.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(a?this.createAbortSignal(a):h.signal)||null,body:typeof e>"u"||e===null?null:A(e)});return this.customFetch(st).then(async at=>{const I=at;I.data=null,I.error=null,I.meta={request:st,response:I};const vn=O?await at[O]().then(G=>(I.ok?I.data=G:I.error={data:G},I)).catch(G=>(I.error=G,I)):I;return a&&this.abortControllers.delete(a),vn})}},_r=f("prewarm.networkActivity");function lr(){let e=0;const t=new Set,r=()=>{t.forEach(n=>n())};return{begin(){e+=1,r();let n=!1;return()=>{n||(n=!0,e-=1,r())}},inFlight:()=>e,watch(n){return t.add(n),()=>t.delete(n)}}}function dr(e){return e.getOrCreateInstance(_r,()=>lr())}var me=Symbol("rest.publicRequest"),F=f("rest.requestHandler"),fr=f("rest.responseHandler"),J=f("rest.customFetch"),Er=(e,t)=>fetch(e,t),Q=f("rest_transport"),pr=e=>{e.inject(J,{execute:async(t,r={})=>{const n=e.getServices(F),i={public:r[me]===!0},o=dr(e).begin();try{let s=t instanceof Request?t:new Request(t,r);for(const _ of n){const l=await _.execute(s,i);l instanceof Request&&(s=l)}let a=await fetch(s);const u=e.getServices(fr);for(const _ of u)a=await _.execute(a,s);return a}finally{o()}}})};function hr(e,t){const r=e.getInstance(Q);if(!r)throw new Error("[restApi] транспорт не зарегистрирован в контейнере");return Object.assign({},...t.map(n=>new n(r)))}var Or="INJECTION";function mr(e){return e.getState}function Ar(e){if(!mr(e)){e.dispose();return}const t=e.getState()[Or];t&&(W.getInstance(t)?.dispose(),W.remove(t))}function gr(e,t){for(const r of e)if(r&&t in r)return r[t]}function Ae(e){return Object.assign({},...e)}var ge=["generic","stockImages","emFiles","cdn"];function Z(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ie(e){return!Z(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>ge.includes(t))}function Te(e){return e.length===0?[]:e.length===1?e[0]:e}function Se(e){let t=!1,r=[];for(const n of e)if(n!==void 0){if(t=!0,Array.isArray(n)){r=[...n,...r];continue}r=[n,...r]}if(t)return Te(r)}function Ir(e){return Z(e)&&("value"in e||"replace"in e)}function be(e,t){return t===void 0?e:Array.isArray(t)?[...t,...e]:[t,...e]}function Tr(e){let t=!1,r=[],n=!1;for(const o of e)if(o!==void 0){if(Ir(o)){t=!0,o.replace&&(r=[],n=!0),o.value!==void 0&&(r=be(r,o.value),n=!0);continue}r=be(r,o),n=!0}const i=n?Te(r):void 0;if(!t)return i;if(i!==void 0)return{value:i}}function Sr(e){const t=e.filter(n=>n!==void 0);if(t.length===0)return;if(!t.some(n=>Ie(n)))return Se(t);const r={};for(const n of ge){const i=Tr(e.map(o=>{if(o!==void 0)return Ie(o)?o[n]:n==="generic"?o:void 0}));i!==void 0&&(r[n]=i)}return Object.keys(r).length>0?r:void 0}function br(e){return Se(e)}function Dr(e){if(e!==void 0){if(Array.isArray(e))return{replace:!1,hosts:e};if(Z(e)&&Array.isArray(e.value))return{replace:!!e.replace,hosts:e.value}}}function Nr(e,t){const r=[...e],n=new Set(r.map(i=>i.toLowerCase()));for(const i of t){const o=i.trim().replace(/:\d+$/,"");if(!o)continue;const s=o.toLowerCase();n.has(s)||(n.add(s),r.push(o))}return r}function Pr(e){let t=[],r=!1;for(const n of e){const i=Dr(n);i&&(r=!0,i.replace&&(t=[]),t=Nr(t,i.hosts))}return r?t:void 0}function yr(e){const t=e.filter(i=>i!==void 0);if(t.length===0)return;const r=Ae(t.map(({directHosts:i,...o})=>o)),n=Pr(t.map(i=>i?.directHosts));return n!==void 0&&(r.directHosts=n),r}function ee(e){return e?.backendProxy}function v(e){return e.replace(/\/$/,"")}function De(e){return/^https?:\/\//i.test(e)}function Ne(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Cr(e){const t=new Set;return e.filter(r=>!r.url||t.has(r.url)?!1:(t.add(r.url),!0))}function Lr(e){const t=ee(e);return t?[t]:[]}function vr(e){return{proxyEmFiles:!0,proxyAi:!1}}function Rr(e,t){const r=vr(t),n=t?.backendProxyPolicy;switch(e){case"emFiles":return n?.proxyEmFiles??r.proxyEmFiles;case"ai":return n?.proxyAi??r.proxyAi;default:return!0}}var wr={url:".+",url_encoded:".+",origin:"https?:\\/\\/[^\\/?#]+",origin_encoded:".+",proxy_url:"https?:\\/\\/[^\\/?#]+",proxy_url_encoded:".+",path:"[^?#]*",pathname:"[^?#]*",path_with_slash:"\\/[^?#]*",pathname_with_slash:"\\/[^?#]*",query:"[^#]*",search:"\\?[^#]*",hash:"#.*",fragment:".*",pathname_after_wp_json:"[^?#]*",pathname_after_wp_json_with_slash:"\\/[^?#]*",rest_namespace:"[^/?#]*",rest_version:"[^/?#]*",rest_route:"[^?#]*",rest_route_with_slash:"\\/[^?#]*"};function Mr(e){const t=[],r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\{([a-z_]+)\\\}/gi,(n,i)=>(t.push(i),`(${wr[i]||".+"})`));return{regex:new RegExp(`^${r}$`,"i"),tokens:t}}function Br(e){return/[?#]/.test(e)||/\{(?:url|url_encoded|query|search|hash|fragment)\}/i.test(e)}function jr(e,t){if(Br(t))return e;try{const r=new URL(e);return`${r.origin}${r.pathname}`}catch{return e.split(/[?#]/)[0]||e}}function Fr(e,t,r){if(r.endsWith("_encoded"))return!0;const n=e.slice(0,t),i=n.lastIndexOf("#"),o=n.lastIndexOf("?"),s=n.lastIndexOf("&"),a=n.lastIndexOf("=");return a>Math.max(o,s)&&a>i}function xr(e){try{const t=new URL(e),r=t.pathname.replace(/^\/+/,""),n=t.search.replace(/^\?/,""),i=t.hash.replace(/^#/,""),o=r.replace(/^wp-json\/?/i,""),s=o?`/${o}`:"/",a=o.match(/^([^/]+)(?:\/([^/]+))?(?:\/(.*))?$/),u=a?.[1]||"",_=a?.[2]||"",l=a?.[3]||"";return{url:e,url_encoded:encodeURIComponent(e),origin:t.origin,origin_encoded:encodeURIComponent(t.origin),proxy_url:t.origin,proxy_url_encoded:encodeURIComponent(t.origin),path:r,pathname:r,path_with_slash:t.pathname||"/",pathname_with_slash:t.pathname||"/",query:n,search:t.search,hash:t.hash,fragment:i,pathname_after_wp_json:o,pathname_after_wp_json_with_slash:s,rest_namespace:u,rest_version:_,rest_route:l,rest_route_with_slash:l?`/${l}`:"/"}}catch{return}}function te(e,t){if(!e)return{};if(Array.isArray(e)){for(const a of e){const u=te(a,t);if(u!==void 0)return u}return}if(e==="*")return{};const r=jr(t,e),{regex:n,tokens:i}=Mr(e),o=n.exec(r);if(!o)return;const s={};return i.forEach((a,u)=>{s[`matched_${a}`]=o[u+1]||""}),s}function x(e,t,r={}){const n=xr(t);if(!n)return t;const i={...n,...r};let o="",s=0;const a=/\{([a-z_]+)\}/gi;let u;for(;u=a.exec(e);){o+=e.slice(s,u.index);const _=i[u[1]]??"",l=Fr(e,u.index,u[1])?encodeURIComponent(_):_;o+=l,s=u.index+u[0].length}o+=e.slice(s);try{const _=new URL(o),l=new URL(t);return!o.includes("{search}")&&!o.includes("{query}")&&l.search&&l.searchParams.forEach((E,h)=>{_.searchParams.has(h)||_.searchParams.append(h,E)}),!o.includes("{hash}")&&!o.includes("{fragment}")&&l.hash&&!_.hash&&(_.hash=l.hash),_.toString()}catch{return o}}function Pe(e,t){try{const r=new URL(t);return`${v(e)}/${r.pathname.replace(/^\//,"")}${r.search}${r.hash}`}catch{return t}}function ye(e,t){const r=v(e);return t?De(t)?t:t.startsWith("?")||t.startsWith("#")?`${r}${t}`:`${r}${t.startsWith("/")?"":"/"}${t}`:r}function Ce(e,t,r,n){const i=e.match;return i?Array.isArray(i)?i.some(o=>Ce({...e,match:o},t,r,n)):typeof i=="function"?!!i({url:t,method:n,requestType:r}):i==="*"?!0:te(i,t)!==void 0:!0}function kr(e,t,r,n="generic"){if(e==null)return[];const i=Array.isArray(e)?e:[e],o=[];return i.forEach((s,a)=>{if(!s)return;if(typeof s=="string"){const E=s.includes("{")&&s.includes("}")?x(s,t):Pe(s,t);o.push({key:`backend:${a}`,url:E,source:"resource"});return}if(!Ne(s)||!("rewrite"in s))return;const u=s;if(!Ce(u,t,n,r))return;const _=typeof u.match=="string"||Array.isArray(u.match)?te(u.match,t)||{}:{},l=typeof u.proxyBase=="string"&&u.proxyBase.trim()?u.proxyBase.trim():void 0;(Array.isArray(u.rewrite)?u.rewrite:[u.rewrite]).filter(Boolean).forEach((E,h)=>{const p=typeof E=="function"?(()=>{const A=E({url:t,proxyBase:l,method:r,requestType:n,..._}),O=l&&!De(A)?ye(l,A):A;return O.includes("{")&&O.includes("}")?x(O,t,_):O})():l?x(ye(l,E),t,_):E.includes("{")&&E.includes("}")?x(E,t,_):Pe(E,t);o.push({key:`backend:${u.id||"rule"}:${a}:${h}`,url:p,source:"resource"})})}),Cr(o)}function Ur(e){try{const t=new URL(e);return/(?:^|\/)wp-json\/em-files\/v\d+(?:\/|$)/i.test(t.pathname)?"emFiles":/(?:^|\/)wp-json\/ai-generator\/v\d+(?:\/|$)/i.test(t.pathname)?"ai":"generic"}catch{return"generic"}}function Hr(e,t=[]){return e==null||(Array.isArray(e)?e:[e]).forEach(r=>{if(r){if(typeof r=="string"){const n=r.split("{")[0]?.trim();n&&t.push(v(n));return}!Ne(r)||!("rewrite"in r)||(typeof r.proxyBase=="string"&&r.proxyBase.trim()&&t.push(v(r.proxyBase.trim())),(Array.isArray(r.rewrite)?r.rewrite:[r.rewrite]).forEach(n=>{if(typeof n!="string")return;const i=n.split("{")[0]?.trim();i&&t.push(v(i))}))}}),t}function Gr(e,t){return Lr(t).flatMap(r=>Hr(r)).filter(Boolean).some(r=>r&&e.startsWith(r))}function Vr(e,t){return!!ee(t)&&Rr(e,t)}function Xr(e,t={}){const r=t.requestType||Ur(e);return Vr(r,t.config)?kr(ee(t.config),e,t.method,r):[]}function $r(e,t={}){return Gr(e,t.config)?[e]:Xr(e,t).map(r=>r.url)}function D(e){for(;e.endsWith("/");)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}function Le(...e){const t=e.filter(o=>o!=null);if(t.length===0)return;if(t.length===1)return t[0];const r=t.find(o=>o.aborted);if(r)return r;if(typeof AbortSignal<"u"&&typeof AbortSignal.any=="function")return AbortSignal.any(t);const n=new AbortController,i=o=>{n.signal.aborted||n.abort(o.reason)};for(const o of t)o.addEventListener("abort",()=>i(o),{once:!0});return n.signal}var ve=3e5,Re=15e3,m=null,we=!1;function Wr(){return!0}function Kr(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_TTL_MS||"").trim();if(!e)return ve;const t=Number(e);return Number.isFinite(t)&&t>0?t:ve}function qr(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_ATTEMPT_TIMEOUT_MS||"").trim();if(!e)return Re;const t=Number(e);return Number.isFinite(t)&&t>0?t:Re}function zr(){const e="https://app.emailmaker.ru/api/".trim();return e?D(e):void 0}function Yr(e){const t=e.trim();if(!t)return[];if(t.startsWith("["))try{const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("expected JSON array");return r.map(n=>String(n).trim()).filter(Boolean)}catch{return we||(we=!0),[]}return t.split(",").map(r=>r.trim()).filter(Boolean)}function Jr(e){const t=new Set,r=[];for(const n of e){const i=D(n);t.has(i)||(t.add(i),r.push(i))}return r}function Me(e){const t=String(e||"").trim();return t?D(t):zr()}function Be(e,t=[]){return e?Jr([e,...t]).slice(0,3):[]}function je(){return Yr(String({}.REACT_APP_OPENAPI_FAILOVER_BASE_URLS||"").trim())}function Qr(e=Date.now()){return m?e-m.switchedAt>=Kr():!0}function Fe(e=Date.now()){m&&Qr(e)&&(m=null)}function N(e){if(!Wr())return!1;const t=Me(e);if(!t)return!1;const r=je();return r.length===0?!1:Be(t,r).length>1}function R(e){const t=Me(e);if(!t)return[];const r=je();return r.length===0?[t]:Be(t,r)}function k(e){const t=R(e);if(t.length===0)return"";if(Fe(),m){const r=t.indexOf(m.activeUrl);if(r>=0)return t[r]}return t[0]}function xe(e){const t=R(e);if(t.length<=1||(Fe(),!m||!t.includes(m.activeUrl)))return t;const r=m.activeUrl;return[r,...t.filter(n=>n!==r)]}function ke(e){return k(e)||void 0}function Ue(e){const t=e||void 0;if(typeof AbortController>"u")return{signal:t,timeoutError:()=>{},done:()=>{}};const r=qr(),n=new AbortController;let i;const o=setTimeout(()=>{i=Zr(r),n.abort(i)},r);return{signal:Le(t,n.signal),timeoutError:()=>i,done:()=>clearTimeout(o)}}function Zr(e){const t=`[apiOriginFailover] origin attempt timed out after ${e}ms`;if(typeof DOMException=="function")return new DOMException(t,"TimeoutError");const r=new Error(t);return r.name="TimeoutError",r}function He(e){return e===502||e===503||e===504}function Ge(e){return!(e instanceof Error)&&!(e instanceof DOMException)?!1:e.name==="TimeoutError"?!0:e instanceof TypeError}var Ve;function en(e){Ve=e}function U(e,t){if(!N(t))return;const r=R(t);if(r.length<=1)return;const n=r.indexOf(D(e));if(n<0)return;const i=n+1;if(i>=r.length)return;const o=r[i],s=m?.activeUrl;m={activeUrl:o,switchedAt:Date.now()},s!==o&&Ve?.()}function Xe(e,t){if(!N(t))return;const r=D(e),n=R(t);if(n.includes(r)){if(r===n[0]){m=null;return}m?.activeUrl!==r&&(m={activeUrl:r,switchedAt:Date.now()})}}function $e(){m=null}var tn=e=>{const t=new FormData,r=(n,i,o)=>{if(i!=null){if(i instanceof Blob){n.append(o,i);return}if(Array.isArray(i)){i.forEach((s,a)=>{const u=o?`${o}[${a}]`:`${a}`;r(n,s,u)});return}if(typeof i=="object"){Object.keys(i).forEach(s=>{const a=i[s],u=o?`${o}[${s}]`:s;r(n,a,u)});return}n.append(o,String(i))}};return r(t,e),t},rn={baseUrl:D("https://app.emailmaker.ru/api/"),baseApiParams:{secure:!0,credentials:"same-origin",format:"json"},securityWorker:()=>({credentials:"same-origin"})},P=new Map;function nn(e){const t=e?.getInstance(de);return t?t.get()??t.bootstrap():void 0}var on=class extends ur{container;constructor(e={},t){super(e),this.container=t}buildRequestUrl(e){const{path:t,baseUrl:r,extraQuery:n}=e;let{query:i}=e;n&&(i=i?{...i,...n}:n);const o=i&&this.toQueryString(i);return`${r||this.baseUrl||""}${t}${o?`?${o}`:""}`}buildRequestKey(e,t){return`${t.toUpperCase()} ${e}`}getBackendProxyCandidates(e,t){const r=nn(this.container),n=this.container?.getInstance(Ee)!==void 0,i=$r(e,{config:r,method:t,standalone:n}),o=i.length>0?i:[e],s=this.buildRequestKey(e,t),a=P.get(s);return!a||!o.includes(a)?o:[a,...o.filter(u=>u!==a)]}shouldRetryResponse(e){return e.status===502||e.status===503||e.status===504}resolveFailoverBaseUrl(){return String(this.baseUrl||"").trim()||void 0}async requestOnOrigin(e,t,r=!1){const n={...e,baseUrl:t},i=this.buildRequestUrl(n),o=n.method||"GET",s=this.buildRequestKey(i,o),a=this.getBackendProxyCandidates(i,o);let u,_;for(const l of a){const E=p=>p===i?l:p,h=r?Ue(e.signal):void 0;try{const p=await super.request({...n,proxyHandler:E,...h?{signal:h.signal}:{}});if(!p.ok&&this.shouldRetryResponse(p)&&l!==a[a.length-1]){_=p,P.get(s)===l&&P.delete(s);continue}return P.set(s,l),p}catch(p){P.get(s)===l&&P.delete(s);const A=h?.timeoutError();if(A)throw A;if(u=p,(p instanceof DOMException||p instanceof Error)&&p.name==="AbortError")throw p}finally{h?.done()}}if(_)return _;throw u instanceof Error?u:new Error("Backend proxy chain failed")}async request(e){const t=String(e.baseUrl||"").trim();if(t)return this.requestOnOrigin(e,t);const r=this.resolveFailoverBaseUrl(),n=N(r),i=e.failoverAttemptTimeout??n,o=n?xe(r):r?[k(r)]:[this.baseUrl].filter(Boolean);if(o.length===0)return this.requestOnOrigin(e,this.baseUrl);let s,a;for(let u=0;u<o.length;u++){const _=o[u],l=u===o.length-1;try{const E=await this.requestOnOrigin(e,_,i);if(!E.ok&&He(E.status)){if(a=E,!l){U(_,r);continue}break}return E.ok&&Xe(_,r),E}catch(E){if(!Ge(E))throw E;s=E,l||U(_,r)}}if(n&&$e(),a)return a;throw s instanceof Error?s:new Error("API origin failover chain failed")}};function sn(e={},t){const r=new on({...rn,...e},t);return r.contentFormatters["multipart/form-data"]=tn,r}var We=f("rest.clientFactory"),an=e=>{pr(e);const t=sn({customFetch:e.getInstance(J)?.execute??Er},e);e.inject(Q,t)},Ke;(function(e){const t="https://racs.emcdn.ru/v3";function r(i,o){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)};return fetch(`${t}?resource=${i}&dataset=${document.location.hostname}`,s)}e.post=r;async function n(i,o=0){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:`{"filter":{},"limit":${o}}`};return await(await fetch(`${t}/get?resource=${i}&dataset=${document.location.hostname}`,s)).json()}e.getAll=n})(Ke||(Ke={}));function w(e,t){if(e!==t){if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e),n=Array.isArray(t);if(r){if(!n)return!1;const a=e.length;if(t.length!==a)return!1;for(let u=0;u<a;u++)if(!w(e[u],t[u]))return!1}else if(n)return!1;const i=Object.keys(e),o=Object.keys(t),s=i.length;if(s!==o.length)return!1;for(let a=0;a<s;a++){const u=i[a];if(!t.hasOwnProperty(u)||!w(e[u],t[u]))return!1}}return!0}function cn(e){const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),r=atob(t),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new TextDecoder().decode(n)}function qe(e){const[t,r,n]=e.split("."),i=JSON.parse(cn(r));return{exp:i.exp,createdAt:i.iat,data:i}}var re=f("plugin.auth.token"),ze=new WeakMap,un=3e4;function _n(e){let t;try{t=qe(e).exp}catch{return!0}return typeof t!="number"||!Number.isFinite(t)?!0:t*1e3<=Date.now()+un}function ln(e,t,r,n){const i=ze.get(e);i&&(i.stale=!0);const o={stale:!1};ze.set(e,o),e.injectFactory(re,async(s,a)=>{if(o.stale)return"";try{let u=await a||void 0;if(!u){const _=e.getInstance(fe);_&&(u=await _)}return t?!u||_n(u)?await t(r,n,u):u:""}catch{return""}},!0)}var Ye=f("auth.oauthProvided"),Je=new WeakMap;function Qe(e,t){const r=Je.get(e)??{applied:!1};(!r.applied||r.getAuthToken!==t.getAuthToken||!w(r.user,t.user)||r.project!==t.project)&&(Je.set(e,{applied:!0,getAuthToken:t.getAuthToken,user:t.user,project:t.project}),ln(e,t.getAuthToken,t.user,t.project))}function Ze(e){if(e.getInstance(Ye))return;e.inject(Ye,!0);let t;e.getInstance(le)?.watch(r=>{t=r}),e.addService(F,{execute:async(r,n)=>{if(n?.public||!t?.getAuthToken)return;e.getInstance(re)===void 0&&Qe(e,t);const i=await e.getInstanceAsync(re);i&&r.headers.set("authorization",`Bearer ${i}`)}})}var dn={theme:"canvas_fact_theme",flags:"canvas_fact_flags",commonStyles:"canvas_fact_common_styles",lockEditor:"canvas_fact_lock_editor",codeMode:"canvas_fact_code_mode",appName:"canvas_fact_app_name",previewPage:"canvas_fact_preview_page",viewport:"canvas_fact_viewport"},fn={text:{fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",lineHeight:21,lineHeightDim:"px",color:"#5a5a5a",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},headings:{fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, 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},links:{color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},buttons:{fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, 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:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:5,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},textAlign:"center",padding:{all:null,top:null,right:null,bottom:null,left:null}},block:{backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:{all:null,top:null,right:null,bottom:null,left:null}},cards:{contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}}},et="ERROR",En="useblocks",pn={em_token:"em_access_token",em_refresh_token:"em_refresh_token",em_admin_token:"em_admin_access_token",em_admin_refresh_token:"em_admin_refresh_token",em_impersonation:"em_impersonation",em_elements_view:"em_elements_view",em_new_block:"em_new_block",em_new_email:"em_new_email",em_id:"em_id",em_name:"em_name",em_email:"em_email",em_locale:"em_locale",em_carrotquest_hash:"em_carrotquest_hash",em_ducalis_hash:"em_ducalis_hash",em_email_subscription_consent:"em_email_subscription_consent",em_folder:"em_folder",promocode:"promocode",em_active_tab:"em_active_tab"},hn={em_color_scheme:"em_color_scheme",em_code_mode_pane_sizes:"em_code_mode_pane_sizes",em_preview_pane_sizes:"em_preview_pane_sizes",em_default_sizes:"em_default_sizes",em_pane_sizes:"em_pane_sizes",em_test_emails:"em_test_emails",em_menu_is_locked:"em_menu_is_locked",em_code_mode_settings:"em_code_mode_settings",em_folder_is_open:"em_folder_is_open",em_active_tab:"em_active_tab",em_ai_settings:"em_ai_settings",em_last_active_page:"em_last_active_page",em_layout_convert_never_suggest:"em_layout_convert_never_suggest",em_filemanager_v2:"em_filemanager_v2",em_projects_v2:"em_projects_v2",em_translations_v2:"em_translations_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_guest_locale:"em_guest_locale"},On="light",mn="dark",An="system",gn="(prefers-color-scheme: dark)",In={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:"sandbox_image_reset",SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:"application_subject_update",APPLICATION_PREHEADER_UPDATE:"application_preheader_update",APPLICATION_DOMPARSER_ERROR:"application_domparser_error",APPLICATION_SYNC_DRIFT:"application_sync_drift",APPLICATION_UPDATE_ENTITY:"application_update_entity",APPLICATION_IFRAME_DRAG_EVENT:"application_iframe_drag_event",APPLICATION_HAS_AMP:"application_has_amp",APPLICATION_CANVAS_IMAGE_GET:"application_canvas_image_get",APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:"application_atom_inserted",APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:"SANDBOX_READY",SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:"sandbox_subject_update",SANDBOX_PREHEADER_UPDATE:"sandbox_preheader_update",SANDBOX_DRAG_EVENT:"sandbox_drag_event",SANDBOX_WHEEL:"sandbox_wheel",SANDBOX_TRANSLATIONS:"sandbox_send_translations",SANDBOX_SET_THEME_VARIABLES:"sandbox_send_theme_variables",SANDBOX_SET_PROJECT_FONTS:"sandbox_set_project_fonts",SANDBOX_CANVAS_IMAGE_CACHE_SETUP:"sandbox_canvas_image_cache_setup",SANDBOX_SET_ENTITY:"sandbox_set_entity",SANDBOX_INIT_START:"sandbox_init_start",SANDBOX_INITED:"sandbox_inited",SANDBOX_UPDATE_ENTITY:"sandbox_update_entity",RELOAD:"reload",SANDBOX_ADD_EXTENSIONS:"sandbox_add_extensions",SANDBOX_REMOVE_EXTENSIONS:"sandbox_remove_extensions",SANDBOX_ADD_SCRIPT:"sandbox_add_script",SANDBOX_IS_EMAIL_EMPTY:"sandbox_is_email_empty",SANDBOX_SWITCH_THEME:"sandbox_switch_theme",SANDBOX_CANVAS_HEALTH:"sandbox_canvas_health"},Tn={language:"html",detectIndentation:!1,wordWrap:"on",wrappingIndent:"same",smoothScrolling:!0,automaticLayout:!0,tabSize:2,indentSize:2},tt=e=>{const t={current:Promise.resolve(),state:e,decorate:(r,n)=>(n&&(r=r.bind(n)),function(...i){const o=t.current.then(()=>r(...i));return t.current=o.then(s=>{t.state=s},s=>{}),o})};return t};function ne(e){return function(t){return{setOptions:()=>{},instance:{},dispose:()=>{},...e(t)||{}}}}function Sn(e){return t=>{const r={},n=[];for(const s of e)n.push(s(t));for(const s of n)Object.assign(r,s.instance);return{instance:r,setOptions:async s=>{for(const a of n)await a.setOptions(s)},dispose:()=>{for(const s of n)s.dispose()}}}}function bn(e=et){const t=new Error(e);return t.name="AuthPipelineError",t}async function rt(e,t,r,n){const i=n?.attemptTimeout??N(r),o=N(r)?xe(r):R(r).length>0?[k(r)]:[];if(o.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const s=e.startsWith("/")?e:`/${e}`;let a,u;for(let _=0;_<o.length;_++){const l=o[_],E=_===o.length-1,h=i?Ue(t.signal):void 0;try{const p=await fetch(`${l}${s}`,{...t,...h?{signal:h.signal}:{}});if(!p.ok&&He(p.status)){if(a=p,!E){U(l,r);continue}break}return p.ok&&Xe(l,r),p}catch(p){const A=h?.timeoutError();if(!A&&!Ge(p))throw p;u=A||p,E||U(l,r)}finally{h?.done()}}if(N(r)&&$e(),a)return a;throw u instanceof Error?u:new Error("[apiOriginFailover] fetch chain failed")}function nt(e){e.inject(C,void 0),e.inject(z,void 0)}var Dn=ne(e=>{let t,r;const n=tt();return e.addService(F,{execute:n.decorate(async(i,o)=>{if(o?.public||!t)return;const s=String(e.getInstance(z)||"").trim();if(s){i.headers.append("authorization",`Bearer ${s}`);return}if(!e.getInstance(C))try{const a=e.getInstance(We),u=String(a?.getOptions()?.baseUrl||"").trim(),_=ke(r||u||void 0);if(!_)throw new Error("JWT auth requires baseUrl");const l=await rt("/jwt-auth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},_);if(!l.ok)throw new Error(`JWT auth failed: ${l.status}`);const E=await l.json(),h=String(E.token||"").trim();if(!h)throw new Error("JWT auth failed: empty token");e.inject(C,void 0),e.inject(z,h),i.headers.append("authorization",`Bearer ${h}`)}catch{throw e.inject(C,et),bn()}})}),{setOptions(i){const o=i.jwtAuth,s=String(i.baseUrl||"").trim()||void 0,a=!w(o,t),u=s!==r;if(t=o,r=s,!o){nt(e);return}a||u?nt(e):e.inject(C,void 0)}}}),Nn=ne(e=>(Ze(e),{setOptions(t){Qe(e,t)}}));function Pn(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([^a-zA-Z0-9_-])/g,"\\$1")}function ie(e,t=document){try{const n=t.querySelector(e);if(n)return n}catch{return null}const r=t.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;if(!i)continue;const o=ie(e,i);if(o)return o}return null}function it(e,t=[]){const r=e.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;i&&(t.push(i),it(i,t))}return t}function yn(e,t,r){if(e.isConnected)return e;const n=e.id?.trim();return n?ot(`#${Pn(n)}`,t,r):Promise.reject(S("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."))}function ot(e,t,r){if(K(r),typeof e<"u"){if(typeof e=="string"){const n=e,i=ie(n);if(i)return i;const o=t.addDisposable(new g);return new Promise((s,a)=>{const u=O=>{o.dispose(),O()},_=()=>{u(()=>a(S(r?.reason)))};if(r?.aborted){_();return}r?.addEventListener("abort",_),o.addDispose(()=>r?.removeEventListener("abort",_));const l=document.body??document.documentElement;if(!l){u(()=>a(S("Document is not ready to observe mount element")));return}const E=new Set,h=new MutationObserver(()=>{const O=ie(n);if(O){u(()=>s(O));return}A()}),p=O=>{E.has(O)||(E.add(O),h.observe(O,{attributes:!0,childList:!0,subtree:!0}))},A=()=>{const O=document.documentElement;if(O)for(const H of it(O))p(H)};p(l),A(),o.addDispose(()=>h.disconnect())})}return e instanceof Element?yn(e,t,r):e}return e}var Cn=new Map;Object.defineProperty(c,"ADVANCED_SETTINGS_PANEL",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(c,"APP_COOKIES",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(c,"APP_ID",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(c,"APP_LOAD_EVENT_ID",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(c,"ATOMS_HANDLERS_ID",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(c,"AsyncEmitter",{enumerable:!0,get:function(){return j}}),Object.defineProperty(c,"BaseEmitter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(c,"CANVAS_FACTS",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(c,"COMMON_STYLES",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(c,"CONFIG_CHANGED_EVENT_ID",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(c,"CONFIG_SOURCE_ID",{enumerable:!0,get:function(){return de}}),Object.defineProperty(c,"COOKIE_MANAGER_ID",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(c,"CUSTOM_FETCH_ID",{enumerable:!0,get:function(){return J}}),Object.defineProperty(c,"ContentType",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(c,"DARK",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(c,"DISPOSABLE_ID",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(c,"DependencyResolver",{enumerable:!0,get:function(){return W}}),Object.defineProperty(c,"Disposable",{enumerable:!0,get:function(){return g}}),Object.defineProperty(c,"ELEMENT_MAP",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(c,"EVENT_TYPES",{enumerable:!0,get:function(){return In}}),Object.defineProperty(c,"Emitter",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(c,"HANDLE_ATOM_INSERT_ID",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(c,"HEADLESS_MODE_ID",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(c,"INIT_PIPELINE_ID",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(c,"INSTANCE_ID",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(c,"JWTMixin",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(c,"LATE_SURFACE_LISTENERS_ID",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(c,"LIGHT",{enumerable:!0,get:function(){return On}}),Object.defineProperty(c,"LOCAL_STORAGE_ITEMS",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(c,"MESSAGE_SERVICE_ID",{enumerable:!0,get:function(){return er}}),Object.defineProperty(c,"MODAL_CLOSE_EVENT",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(c,"MODAL_SHOW_EVENT",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(c,"MODAL_UPDATE_EVENT",{enumerable:!0,get:function(){return or}}),Object.defineProperty(c,"MONACO_EDITOR_OPTIONS",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(c,"MessageService",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(c,"OAuthMixin",{enumerable:!0,get:function(){return Nn}}),Object.defineProperty(c,"OPTIONS_SOURCE_ID",{enumerable:!0,get:function(){return le}}),Object.defineProperty(c,"PLUGIN_COLLECTION_ID",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(c,"PORT_READY",{enumerable:!0,get:function(){return he}}),Object.defineProperty(c,"PREFERS_COLOR_SCHEME_DARK",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(c,"PUBLIC_REQUEST",{enumerable:!0,get:function(){return me}}),Object.defineProperty(c,"REQUEST_HANDLER_ID",{enumerable:!0,get:function(){return F}}),Object.defineProperty(c,"REST_CLIENT_FACTORY_ID",{enumerable:!0,get:function(){return We}}),Object.defineProperty(c,"REST_TRANSPORT_ID",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(c,"SANDBOX_EXTENSIONS_ID",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(c,"SANDBOX_EXTENSION_SCRIPT_STATUS_ID",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(c,"SECURITY_MODULE_ID",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(c,"SETTINGS_PANEL_EVENT",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(c,"STANDALONE_ACTIVATED_ID",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(c,"STANDALONE_BOOTSTRAP_TOKEN_ID",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(c,"STANDALONE_FILE_PROXY_REGISTERED_ID",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(c,"STANDALONE_PROJECT_ID",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(c,"STORE_ID",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(c,"SYSTEM",{enumerable:!0,get:function(){return An}}),Object.defineProperty(c,"Signal",{enumerable:!0,get:function(){return St}}),Object.defineProperty(c,"TEMPLATE_DIRECTIVES_ID",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(c,"USEBLOCKS",{enumerable:!0,get:function(){return En}}),Object.defineProperty(c,"combineMixins",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(c,"composeAbortSignals",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(c,"createAbortError",{enumerable:!0,get:function(){return S}}),Object.defineProperty(c,"createIdentifier",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(c,"createIdentifier$1",{enumerable:!0,get:function(){return f}}),Object.defineProperty(c,"createQueue",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(c,"debounce",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(c,"decodeJwt",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(c,"deepEqual",{enumerable:!0,get:function(){return w}}),Object.defineProperty(c,"defineMixin",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(c,"events",{enumerable:!0,get:function(){return q}}),Object.defineProperty(c,"fetchWithApiOriginFailover",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(c,"filter",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(c,"generateUUID",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(c,"getActiveBaseUrl",{enumerable:!0,get:function(){return k}}),Object.defineProperty(c,"getApi",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(c,"getEmitter",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(c,"getEmitter$1",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(c,"getEvent",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(c,"getServiceContainerId",{enumerable:!0,get:function(){return M}}),Object.defineProperty(c,"isAbortError",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(c,"mapHttpStatusToErrorCode",{enumerable:!0,get:function(){return At}}),Object.defineProperty(c,"mergeBackendProxyLayers",{enumerable:!0,get:function(){return br}}),Object.defineProperty(c,"mergeResourceProxyLayers",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(c,"mergeResourceProxyPolicyLayers",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(c,"mergeShallowConfigLayers",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(c,"pickKey",{enumerable:!0,get:function(){return gr}}),Object.defineProperty(c,"provideOAuth",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(c,"raceWithAbortSignal",{enumerable:!0,get:function(){return It}}),Object.defineProperty(c,"registerRestTransport",{enumerable:!0,get:function(){return an}}),Object.defineProperty(c,"releaseContainer",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(c,"resolveContainer",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(c,"resolveExplicitApiBaseUrl",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(c,"setApiOriginFailoverHook",{enumerable:!0,get:function(){return en}}),Object.defineProperty(c,"snapshot",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(c,"throwIfAborted",{enumerable:!0,get:function(){return K}}),Object.defineProperty(c,"waitForElement",{enumerable:!0,get:function(){return ot}})});
|
|
2096
|
+
__emailmaker__.define("static/umd/cb17e366.js",["require","exports","module"],function(Rn,c,wn){var g=class ct{_inner;_isDisposed=!1;constructor(t=[]){this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof ct&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const r=this._inner.indexOf(t);r>=0&&this._inner.splice(r,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function M(e){return`service_container_${e}`}var P=new Set,V;function ut(){if(!V)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,se.prototype.getInstanceAsync),e.stack}function X(e){P.delete(e)&&V?.end(e)}var se=class oe extends g{_parent;_injectCallbacks=[];_injections=Object.create(null);_runCallbacks(t){[...this._injectCallbacks].forEach(r=>r(t))}constructor(t=null){super(),this._parent=t,t&&this.addDisposable(t.onInject(r=>this._runCallbacks(r)))}onInject=t=>(this._injectCallbacks.push(t),{dispose:()=>{const r=this._injectCallbacks.indexOf(t);r>=0&&this._injectCallbacks.splice(r,1)}});inject(t,r){this._injections[t]=()=>r,this._runCallbacks(t)}injectFactory(t,r,n){const i=this._injections[t];let o=typeof i=="function"?i():i;const s=this._injections[t]=()=>(o=r(this,o),o);n&&s(),this._runCallbacks(t)}_find(t,r=!0){return this._injections[t]||r&&this._parent?._find(t)}_onInject(t,r,n=new g){return n.addDisposable(this.onInject(i=>{t===i&&!n.isDisposed()&&(n.dispose(),r(this.getInstance(i)))})),this._parent&&n.addDisposable(this._parent._onInject(t,r,n)),this.addDisposable(n),n}getInstance(t,r=!0){const n=this._find(t,r);if(typeof n=="function")return n()}getOrCreateInstance(t,r){const n=this._find(t);if(typeof n=="function")return n();const i=r(this);return this.inject(t,i),i}getInstanceAsync(t){const r=this._find(t);if(typeof r=="function")return Promise.resolve(r());const n=ut();return new Promise((i,o)=>{const s={id:String(t),startedAt:Date.now(),origin:n,container:this,reject:o};P.add(s),V?.start(s),this._onInject(t,()=>{X(s),i(this.getInstance(t))})})}failPendingWaits(t){for(const r of Array.from(P))r.container===this&&(X(r),r.reject(t))}pendingWaits(){return[...P].filter(t=>t.container===this)}addService(t,r){const n=M(t);this.injectFactory(n,(o,s=[])=>s.indexOf(r)<0?[...s,r]:s);const i=new g;return i.addDispose(()=>{this.injectFactory(n,(o,s=[])=>s.filter(a=>a!==r))}),i}addServiceFactory(t,r,n){const i=M(t);let o;this.injectFactory(i,(a,u=[])=>(o=r(a,o),o===void 0?u:u.indexOf(o)<0?[...u,o]:u),n);const s=new g;return s.addDispose(()=>{this.injectFactory(i,(a,u=[])=>o===void 0?u:u.filter(_=>_!==o))}),s}getServices(t){const r=M(t);return[...this.getInstance(r,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new oe(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const r=this._parent?.getOrCreateIsolatedContainer(t);return new oe(r)})}remove(t){const r=this._injections;delete r[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(P))t.container===this&&X(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function $(e){return e.startsWith("__")?e:`__${e}__`}function _t(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=$(e),r=globalThis;return r[t]??={}}function lt(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function dt(e){if(e)return $(e);const t="emailmaker".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return $(t)}function ae(e){const t=dt(e),r=_t(t);if(lt(r.container))return r.container;const n=new se(null);return r.container=n,n}function ft(e){return ae(e)}function Et(){let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){let n=Math.random()*16;return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),(r==="x"?n:n&3|8).toString(16)})}function ce(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Et()}function f(e=ce()){return e}function ue(){return"umd".trim()||"unknown"}function pt(e){if(typeof globalThis>"u")return;const t=ue(),r=globalThis[e]??{};globalThis[e]=r;const n=r.__diagnostics??={},i=n.diModuleEval??={evalCount:0,records:[]};i.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),i.evalCount+=1}function ht(){const e="emailmaker".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function Ot(e,t){if(pt(t),typeof globalThis>"u")return e;const r=ue(),n=globalThis,i=n[t]=n[t]||{},o=i.__diagnostics=i.__diagnostics||{},s=o.dependencyResolver=o.dependencyResolver||{entries:[]},a={container:e,source:"packages/runtime-core/di/index.ts",buildSource:r,timestamp:Date.now(),stack:new Error().stack};return s.entries.push(a),e}var B;function mt(){if(B)return B;const e=ht();return B=Ot(ae(e),e),B}var W=new Proxy({},{get(e,t,r){const n=mt(),i=Reflect.get(n,t,r);return typeof i=="function"?i.bind(n):i}});function At(e,t="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return t}}function S(e){if(e instanceof DOMException&&e.name==="AbortError")return e;const t=e===void 0?"The operation was aborted.":typeof e=="string"?e:e instanceof Error?e.message:String(e);return new DOMException(t,"AbortError")}function gt(e){return e instanceof DOMException&&e.name==="AbortError"}function K(e){if(e?.aborted)throw S(e.reason)}function It(e,t){return t?(t.aborted&&e.catch(()=>{}),K(t),new Promise((r,n)=>{const i=()=>{o(),n(S(t.reason))},o=()=>{t.removeEventListener("abort",i)};t.addEventListener("abort",i),e.then(s=>{o(),r(s)},s=>{o(),n(s)})})):e}var _e=class extends g{_options;_listeners=[];constructor(e={}){super(),this._options=e}getListeners(e){return this._listeners.flatMap(([t])=>typeof t=="function"?t:t.getListeners(e))}hasListeners(){for(const[e]of this._listeners){if(typeof e=="function")return!0;const t=e;if(typeof t.hasListeners=="function"){if(t.hasListeners())return!0;continue}return!0}return!1}_addListener(e,t=0,r){if(this.isDisposed())return{dispose:()=>{}};const n=this._listeners,i=this._options;r&&typeof e=="function"&&(e=e.bind(r));const o=n.findIndex(([,a])=>a<t),s=[e,t];return n.splice(o>=0?o:n.length,0,s),n.length===1&&i.onFirstListenerAdd&&i.onFirstListenerAdd(),{dispose:()=>{const a=n.indexOf(s);a>=0&&(n.splice(a,1),!n.length&&i.onLastListenerRemove&&i.onLastListenerRemove())}}}on=this._addListener.bind(this);event=this._addListener.bind(this);once=(e,t=0,r)=>{const n=this._addListener((...i)=>(n?.dispose(),r?e.call(r,...i):e(...i)),t);return n};un=e=>{const t=this._listeners.findIndex(([r])=>r===e);t>=0&&(this._listeners.splice(t,1),this._listeners.length===0&&this._options.onLastListenerRemove&&this._options.onLastListenerRemove())};dispose(){this._listeners.splice(0,this._listeners.length),this._options.onLastListenerRemove&&this._options.onLastListenerRemove(),super.dispose()}},b=class extends _e{execute(e,t){for(const r of t)try{r(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},Tt=class extends b{execute([e],t){for(const r of t)try{r(e)}catch{}}},St=class extends b{_suspendCounter=0;_wasFired=!1;execute([e],t){if(this._suspendCounter)this._wasFired=!0;else for(const r of t)try{r(e)}catch{}}suspend(){this._suspendCounter++}resume(){--this._suspendCounter===0&&this._wasFired&&(this.fire(),this._wasFired=!1)}},j=class extends b{async execute([e],t){const r=[];for(const n of t)try{r.push(await n(e))}catch{}return r}async fireSettled(e){const t={results:[],errors:[]};if(this.isDisposed())return t;for(const r of this.getListeners([e]))try{t.results.push(await r(e))}catch(n){t.errors.push(n)}return t}};function bt(e,t=0){const r=new _e,n=e(r,t);return n&&r.addDisposable(n),r.event}function Dt(e,t,r=0){const n=new b,i=e((...o)=>{if(t(...o))return n.fire(...o)},r);return i&&n.addDisposable(i),n.event}function Nt(e,t=0,r=0){const n=new b;let i,o;const s=e((...a)=>{o=a,i||(i=setTimeout(()=>{o&&n.fire(...o),i=void 0},t))},r);return s&&n.addDisposable(s),n.event}function yt(e,t){return e.getOrCreateInstance(t,()=>new j)}function d(e){return f(e)}var q;(function(e){e.BEFORE_SAVE_EMAIL=d("events.BEFORE_SAVE_EMAIL"),e.ON_SAVEBUTTON_CLICK_ID=d("events.ON_SAVEBUTTON_CLICK_ID"),e.ON_NEXTBUTTON_CLICK_ID=d("events.ON_NEXTBUTTON_CLICK_ID"),e.ON_PREVIOUSBUTTON_CLICK_ID=d("events.ON_PREVIOUSBUTTON_CLICK_ID"),e.ON_DOCUMENT_SESSION_CHANGE=d("events.ON_DOCUMENT_SESSION_CHANGE"),e.WILL_EMAIL_INIT_ID=d("events.WILL_EMAIL_INIT_ID"),e.ON_EMAIL_INIT_ID=d("events.ON_EMAIL_INIT_ID"),e.ON_BLOCK_INIT_ID=d("events.ON_BLOCK_INIT_ID"),e.ON_CONTENT_CHANGED_ID=d("events.ON_CONTENT_CHANGED_ID"),e.ON_PREHEADER_CHANGED_ID=d("events.ON_PREHEADER_CHANGED_ID"),e.ON_SUBJECT_CHANGED_ID=d("events.ON_SUBJECT_CHANGED_ID"),e.ON_EMAIL_CHANGED_ID=d("events.ON_EMAIL_CHANGED_ID"),e.ON_BLOCK_CHANGED_ID=d("events.ON_BLOCK_CHANGED_ID"),e.ON_BLOCK_OPEN_ID=d("events.ON_BLOCK_OPEN_ID"),e.ON_BLOCK_CLOSE_ID=d("events.ON_BLOCK_CLOSE_ID"),e.OPEN_BLOCK_REQUEST_ID=d("events.OPEN_BLOCK_REQUEST_ID"),e.ON_BLOCK_SAVEBUTTON_CLICK_ID=d("events.ON_BLOCK_SAVEBUTTON_CLICK_ID"),e.ON_BLOCK_CLONE_ID=d("events.ON_BLOCK_CLONE_ID"),e.ON_CHUNKS_LOADED=d("events.ON_CHUNKS_LOADED"),e.ON_SEND_TESTEMAIL_ID=d("events.ON_SEND_TESTEMAIL_ID"),e.ON_SEND_LIVEPREVIEW_ID=d("events.ON_SEND_LIVEPREVIEW_ID"),e.ON_SHARE_ID=d("events.ON_SHARE_ID"),e.ON_SHOW_PREVIEW_ID=d("events.ON_SHOW_PREVIEW_ID"),e.ON_EMAIL_CLONE_ID=d("events.ON_EMAIL_CLONE_ID"),e.ON_SEND_EMAIL_MODAL_ID=d("events.ON_SEND_EMAIL_MODAL_ID"),e.ON_ANALYTICS_EVENT=d("events.ON_ANALYTICS_EVENT"),e.ON_NOTIFICATION=d("events.ON_NOTIFICATION"),e.READ_LOCALE=d("events.READ_LOCALE"),e.ON_TRANSLATE_ID=d("events.ON_TRANSLATE_ID"),e.ON_CODE_VALIDATE_ID=d("events.ON_CODE_VALIDATE_ID"),e.ON_IMPORT_VALIDATE_ID=d("events.ON_IMPORT_VALIDATE_ID"),e.UPLOAD_EVENT_ID=d("events.UPLOAD_EVENT_ID"),e.PROXY_URL_EVENT_ID=d("events.PROXY_URL_EVENT_ID"),e.FILE_PROXY_EVENT_ID=d("events.FILE_PROXY_EVENT_ID"),e.ON_LIMIT_ID=d("events.ON_LIMIT_ID"),e.ON_BROWSER_EXTENSION_DETECTED_ID=d("events.ON_BROWSER_EXTENSION_DETECTED_ID"),e.ON_LAYOUT_CONVERT_REQUEST_ID=d("events.ON_LAYOUT_CONVERT_REQUEST_ID"),e.ON_BROWSER_TRANSLATE_DETECTED_ID=d("events.ON_BROWSER_TRANSLATE_DETECTED_ID"),e.AI_TEXT_REQUEST_ID=d("events.AI_TEXT_REQUEST_ID"),e.AI_IMAGE_REQUEST_ID=d("events.AI_IMAGE_REQUEST_ID"),e.AI_TEXT_PROGRESS_ID=d("events.AI_TEXT_PROGRESS_ID"),e.AI_IMAGE_PROGRESS_ID=d("events.AI_IMAGE_PROGRESS_ID"),e.AI_TEXT_STREAM_ID=d("events.AI_TEXT_STREAM_ID")})(q||(q={}));function Pt(e,t){return e.getOrCreateInstance(t,()=>new j).event}function Ct(e,t){return e.getOrCreateInstance(t,()=>new j)}var Lt=f("plugin.app"),vt=f("plugin.disposable"),Rt=f("InitPipelineContext"),wt=f("plugin.instance"),Mt=f("plugin.lateSurfaceListeners"),le=f("plugin.optionsSource"),Bt=f("plugin.store"),de=f("ConfigSource"),jt=f("plugin.standalone.project"),fe=f("plugin.standalone.bootstrapToken"),Mn=f("plugin.element"),Ee=f("plugin.securityModule"),Ft=f("plugin.standalone.activated"),xt=f("plugin.standalone.fileProxyRegistered"),Y=f("plugin.jwt.token"),C=f("plugin.jwt.error"),kt=f("PluginCollection"),Ut=d("APP_LOAD_EVENT"),Ht=d("CONFIG_CHANGED_EVENT");function Gt(e,t=window){return{peer:e,send(r){e.postMessage(r,"*")},subscribe(r){const n=i=>{r({data:i.data,source:i.source,ports:i.ports})};return t.addEventListener("message",n),{dispose:()=>t.removeEventListener("message",n)}},close(){}}}function Vt(e){let t=!1;return{peer:e,send(r){e.postMessage(r)},subscribe(r){const n=i=>{r({data:i.data,source:e})};return e.addEventListener("message",n),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",n)}},close(){e.close()}}}function Xt(e){return e}function $t(e){return e&&typeof e=="object"}function pe(e,t){return e&&typeof e=="object"&&e.operationId===t}var T="INIT_MESSAGE",he="em:port-ready",Wt="em:window-drained",z="";function Oe(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var Kt=class extends g{_listeners=Object.create(null);addListenerAsync=(e,t,r=0,n)=>{const i=this._listeners[e]||(this._listeners[e]=[]);n&&typeof t=="function"&&(t=t.bind(n));const o=i.findIndex(([a,u])=>r<=u),s=[t,r];return this.isDisposed()||i.splice(o>=0?o:i.length,0,s),{dispose(){const a=i.indexOf(s);a>=0&&i.splice(a,1)}}};fireAsync=(e,t)=>{if(!this.isDisposed()){const r=this._listeners[e]||(this._listeners[e]=[]);let n;for(let i=0;i<r.length;i++){const o=r[i][0],s=n;n=a=>o(a,s)}if(n)return n(t)}};addListener=(e,t,r=0)=>this.addListenerAsync(e,(n,i)=>{try{t(n)}catch{}return i&&i(n)},r)},qt=class extends g{_singleton;_target;_transport;_transportSubscription;_ports=new Map;_drained=new WeakSet;_portSendHeld=new WeakSet;_inited=!1;_emitter=this.addDisposable(new Kt);_handshaken=new WeakSet;_greeted=new WeakSet;_outgoingFilter;_outgoingObservers=new Set;_offTargetListeners=new Map;constructor(e,t){super(),this._singleton=t,this._transport=Gt({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(T,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(T))}),e&&this.setTarget(e)}_onTransportMessage=e=>{const t=e,r=t.data,n=t.source,i=r?.port===!0?t.ports?.[0]:void 0,o=!this._isPortSource(t.source);if(o&&n&&r?.operationId==="em:window-drained"){this._ports.has(n)&&this._drained.add(n);return}if(o&&n&&this._drained.has(n))return;if(n&&n!==this._target&&this._greeted.has(n)&&pe(r,T)){this._greeted.delete(n),this._handshaken.add(n),this._postMessage(n,{operationId:T,data:{}}),i&&this.usePort(i,!0,n);return}const s=t.source===this.target||this._isCurrentPort(t.source);if(s||this._notifyOffTarget(r?.operationId,t.source),$t(r)&&s||this._singleton&&pe(r,T)){if(i&&s){const l=this._target;Promise.resolve().then(()=>this.usePort(i,!0,l))}const a=this._emitter.fireAsync(r.operationId||z,r.operationId===void 0?t:r.data),u=r.result,_=r.error;u&&_&&Promise.resolve(a).then(l=>this._sendMessage(u,l),l=>this._sendMessage(_,l))}};setTarget(e){if(this._target!==e){if(this._target=e,!e){this._inited=!1;return}if(this._handshaken.has(e)){this._inited=!0,this._emitter.fireAsync(T,void 0);return}this._inited=!1,this._postMessage(e,{operationId:T,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:T,data:{},port:!0},[t])}observeOutgoing(e){return this._outgoingObservers.add(e),{dispose:()=>{this._outgoingObservers.delete(e)}}}_notifyOutgoing(e,t){for(const r of Array.from(this._outgoingObservers))try{r(e,t)}catch{}}addOffTargetListener(e,t){let r=this._offTargetListeners.get(e);return r||(r=new Set,this._offTargetListeners.set(e,r)),r.add(t),{dispose:()=>{r.delete(t)}}}_notifyOffTarget(e,t){const r=typeof e=="string"?this._offTargetListeners.get(e):void 0,n=r?.size?this._knownPeer(t):void 0;if(!(!r||!n))for(const i of Array.from(r))try{i(n)}catch{}}_knownPeer(e){for(const[r,n]of this._ports)if(n.transport.peer===e)return r;const t=e;return typeof e=="object"&&e!==null&&(this._handshaken.has(t)||this._greeted.has(t))?t:void 0}setOutgoingFilter(e){return this._outgoingFilter=e,()=>{this._outgoingFilter===e&&(this._outgoingFilter=void 0)}}sendNow(e){const t=this._target;return!this._inited||!t?!1:(this._postMessage(t,e),!0)}greet(e){this._handshaken.has(e)||this._greeted.has(e)||this._target===e||(this._greeted.add(e),this._postMessage(e,{operationId:T,data:{}}))}forget(e){this._handshaken.delete(e),this._greeted.delete(e),this._closePort(e),this._drained.delete(e),this._target===e&&(this._inited=!1)}usePort(e,t=!1,r=this._target){if(!r||this._ports.has(r))return;const n=Vt(e),i=n.subscribe(this._onTransportMessage);this._ports.set(r,{transport:n,subscription:i}),t&&(n.send({operationId:he,data:{}}),this.drainWindow(r))}holdPort(e=this._target){!e||!this._ports.has(e)||(this._portSendHeld.add(e),this._drained.delete(e))}resumePort(e=this._target){e&&this._portSendHeld.delete(e)}useWindow(e=this._target){e&&(this._closePort(e),this._drained.delete(e))}get usesPort(){return this._target!==void 0&&this._ports.has(this._target)&&!this._portSendHeld.has(this._target)}hasPort(e,t){const r=this._ports.get(e);return r!==void 0&&(t===void 0||r.transport.peer===t)}_closePort(e){const t=this._ports.get(e);t&&(t.subscription.dispose(),t.transport.close(),this._ports.delete(e),this._portSendHeld.delete(e))}drainWindow(e){this._ports.has(e)&&e.postMessage({operationId:Wt,data:{}},"*")}isWindowDrained(e){return this._drained.has(e)}_isPortSource(e){for(const t of this._ports.values())if(t.transport.peer===e)return!0;return!1}_isCurrentPort(e){return this._target!==void 0&&this._ports.get(this._target)?.transport.peer===e}getTarget(){return this._target}get target(){return this._target}_postMessage(e,t,r){let n=t;this._outgoingFilter&&!r?.length&&(n="data"in t?{...t,data:this._outgoingFilter(t.data)}:this._outgoingFilter(t));try{const i=this._ports.get(e);if(i&&!this._portSendHeld.has(e)){i.transport.send(n);return}if(r?.length){e.postMessage(n,"*",r);return}e.postMessage(n,"*")}catch(i){if(i?.name==="DataCloneError"){const o=typeof n?.data=="object"&&n?.data!==null?n.data:void 0}throw i}}_sendMessage(e,t,r=!0){if(!r&&!this.isInited())return;e&&this._notifyOutgoing(e,t);const n=this.addDisposable(this.onInit(i=>{const o=e?{operationId:e,data:t}:t;try{this._postMessage(i,{...o})}finally{n.dispose()}}))}send(e,t,r){return typeof e=="string"?this._sendMessage(e,t,r):this._sendMessage(z,e,t)}sendAsync(e,t,r=!0){if(!r&&!this.isInited())return Promise.resolve();this._notifyOutgoing(e,t);const n=Oe(),i=Oe();return new Promise((o,s)=>{const a=this.addDisposable(new g);a.addDisposable(this.onInit(u=>{try{this._postMessage(u,{operationId:e,data:t,result:n,error:i})}catch(_){a.dispose(),s(_);return}a.addDisposable(this._onMessage(n,_=>{o(_),a.dispose()})),a.addDisposable(this._onMessage(i,_=>{s(_),a.dispose()}))}))})}_onMessage(e,t,r=0){return this._emitter.addListener(e,t,r)}addListener(e,t,r){return t?this._onMessage(e,t,r):this._onMessage(z,e)}addListenerAsyncPipe(e,t,r=0){return this._emitter.addListenerAsync(e,t,r)}addListenerAsync(e,t,r=0){return this._emitter.addListenerAsync(e,async(n,i)=>{const o=await t(n);return i?i(n):o},r)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,r=0){const n=this.addDisposable(new g);return this._inited&&this._target?t&&Promise.resolve().then(()=>{!this._inited||!this._target?n.addDisposable(this.onInit(e,t,r)):e(this._target)}):n.addDisposable(this._onMessage(T,()=>{e(this._target)},r)),n}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}};function L(e){return f(e)}var Yt=f("extensions.atomsHandlers"),zt=L("HANDLE_ATOM_INSERT"),Jt=f("HeadlessMode"),Qt=f("extensions.sandboxExtensions"),Zt="SANDBOX_EXTENSION_SCRIPT_STATUS",er=f("MESSAGE_SERVICE"),tr=L("SETTINGS_PANEL_EVENT"),rr="advanced",nr=L("MODAL_SHOW_EVENT"),ir=L("MODAL_CLOSE_EVENT"),or=L("MODAL_UPDATE_EVENT"),Bn=f("client"),jn=f("v2_client"),Fn=f("ai_client"),sr=f("app.cookieManager"),xn=f("app.storageProvider"),kn=f("image-blob-resolver"),ar=f("template-directives"),cr=(function(e){return e.Json="application/json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),ur=class{baseUrl="https://api.emailmaker.ru/wp-json";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(r=>this.encodeQueryParam(t,r)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(r=>typeof t[r]<"u").map(r=>Array.isArray(t[r])?this.addArrayQueryParam(t,r):this.addQueryParam(t,r)).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,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce((t,r)=>{const n=e[r];return t.append(r,n instanceof Blob?n:typeof n=="object"&&n!==null?JSON.stringify(n):`${n}`),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 r=this.abortControllers.get(e);return r?r.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))};async request({body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:u,proxyHandler:_,...l}){const E=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},h=this.mergeRequestParams(l,E);u&&(i=i?{...i,...u}:u);const p=i&&this.toQueryString(i),A=this.contentFormatters[n||"application/json"],O=o||h.format,H=`${s||this.baseUrl||""}${r}${p?`?${p}`:""}`,Ln=_?_(H,{body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:u,proxyHandler:_,...l}):H,st=new Request(Ln,{...h,headers:{...h.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(a?this.createAbortSignal(a):h.signal)||null,body:typeof e>"u"||e===null?null:A(e)});return this.customFetch(st).then(async at=>{const I=at;I.data=null,I.error=null,I.meta={request:st,response:I};const vn=O?await at[O]().then(G=>(I.ok?I.data=G:I.error={data:G},I)).catch(G=>(I.error=G,I)):I;return a&&this.abortControllers.delete(a),vn})}},_r=f("prewarm.networkActivity");function lr(){let e=0;const t=new Set,r=()=>{t.forEach(n=>n())};return{begin(){e+=1,r();let n=!1;return()=>{n||(n=!0,e-=1,r())}},inFlight:()=>e,watch(n){return t.add(n),()=>t.delete(n)}}}function dr(e){return e.getOrCreateInstance(_r,()=>lr())}var me=Symbol("rest.publicRequest"),F=f("rest.requestHandler"),fr=f("rest.responseHandler"),J=f("rest.customFetch"),Er=(e,t)=>fetch(e,t),Q=f("rest_transport"),pr=e=>{e.inject(J,{execute:async(t,r={})=>{const n=e.getServices(F),i={public:r[me]===!0},o=dr(e).begin();try{let s=t instanceof Request?t:new Request(t,r);for(const _ of n){const l=await _.execute(s,i);l instanceof Request&&(s=l)}let a=await fetch(s);const u=e.getServices(fr);for(const _ of u)a=await _.execute(a,s);return a}finally{o()}}})};function hr(e,t){const r=e.getInstance(Q);if(!r)throw new Error("[restApi] транспорт не зарегистрирован в контейнере");return Object.assign({},...t.map(n=>new n(r)))}var Or="INJECTION";function mr(e){return e.getState}function Ar(e){if(!mr(e)){e.dispose();return}const t=e.getState()[Or];t&&(W.getInstance(t)?.dispose(),W.remove(t))}function gr(e,t){for(const r of e)if(r&&t in r)return r[t]}function Ae(e){return Object.assign({},...e)}var ge=["generic","stockImages","emFiles","cdn"];function Z(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ie(e){return!Z(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>ge.includes(t))}function Te(e){return e.length===0?[]:e.length===1?e[0]:e}function Se(e){let t=!1,r=[];for(const n of e)if(n!==void 0){if(t=!0,Array.isArray(n)){r=[...n,...r];continue}r=[n,...r]}if(t)return Te(r)}function Ir(e){return Z(e)&&("value"in e||"replace"in e)}function be(e,t){return t===void 0?e:Array.isArray(t)?[...t,...e]:[t,...e]}function Tr(e){let t=!1,r=[],n=!1;for(const o of e)if(o!==void 0){if(Ir(o)){t=!0,o.replace&&(r=[],n=!0),o.value!==void 0&&(r=be(r,o.value),n=!0);continue}r=be(r,o),n=!0}const i=n?Te(r):void 0;if(!t)return i;if(i!==void 0)return{value:i}}function Sr(e){const t=e.filter(n=>n!==void 0);if(t.length===0)return;if(!t.some(n=>Ie(n)))return Se(t);const r={};for(const n of ge){const i=Tr(e.map(o=>{if(o!==void 0)return Ie(o)?o[n]:n==="generic"?o:void 0}));i!==void 0&&(r[n]=i)}return Object.keys(r).length>0?r:void 0}function br(e){return Se(e)}function Dr(e){if(e!==void 0){if(Array.isArray(e))return{replace:!1,hosts:e};if(Z(e)&&Array.isArray(e.value))return{replace:!!e.replace,hosts:e.value}}}function Nr(e,t){const r=[...e],n=new Set(r.map(i=>i.toLowerCase()));for(const i of t){const o=i.trim().replace(/:\d+$/,"");if(!o)continue;const s=o.toLowerCase();n.has(s)||(n.add(s),r.push(o))}return r}function yr(e){let t=[],r=!1;for(const n of e){const i=Dr(n);i&&(r=!0,i.replace&&(t=[]),t=Nr(t,i.hosts))}return r?t:void 0}function Pr(e){const t=e.filter(i=>i!==void 0);if(t.length===0)return;const r=Ae(t.map(({directHosts:i,...o})=>o)),n=yr(t.map(i=>i?.directHosts));return n!==void 0&&(r.directHosts=n),r}function ee(e){return e?.backendProxy}function v(e){return e.replace(/\/$/,"")}function De(e){return/^https?:\/\//i.test(e)}function Ne(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Cr(e){const t=new Set;return e.filter(r=>!r.url||t.has(r.url)?!1:(t.add(r.url),!0))}function Lr(e){const t=ee(e);return t?[t]:[]}function vr(e){return{proxyEmFiles:!0,proxyAi:!1}}function Rr(e,t){const r=vr(t),n=t?.backendProxyPolicy;switch(e){case"emFiles":return n?.proxyEmFiles??r.proxyEmFiles;case"ai":return n?.proxyAi??r.proxyAi;default:return!0}}var wr={url:".+",url_encoded:".+",origin:"https?:\\/\\/[^\\/?#]+",origin_encoded:".+",proxy_url:"https?:\\/\\/[^\\/?#]+",proxy_url_encoded:".+",path:"[^?#]*",pathname:"[^?#]*",path_with_slash:"\\/[^?#]*",pathname_with_slash:"\\/[^?#]*",query:"[^#]*",search:"\\?[^#]*",hash:"#.*",fragment:".*",pathname_after_wp_json:"[^?#]*",pathname_after_wp_json_with_slash:"\\/[^?#]*",rest_namespace:"[^/?#]*",rest_version:"[^/?#]*",rest_route:"[^?#]*",rest_route_with_slash:"\\/[^?#]*"};function Mr(e){const t=[],r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\{([a-z_]+)\\\}/gi,(n,i)=>(t.push(i),`(${wr[i]||".+"})`));return{regex:new RegExp(`^${r}$`,"i"),tokens:t}}function Br(e){return/[?#]/.test(e)||/\{(?:url|url_encoded|query|search|hash|fragment)\}/i.test(e)}function jr(e,t){if(Br(t))return e;try{const r=new URL(e);return`${r.origin}${r.pathname}`}catch{return e.split(/[?#]/)[0]||e}}function Fr(e,t,r){if(r.endsWith("_encoded"))return!0;const n=e.slice(0,t),i=n.lastIndexOf("#"),o=n.lastIndexOf("?"),s=n.lastIndexOf("&"),a=n.lastIndexOf("=");return a>Math.max(o,s)&&a>i}function xr(e){try{const t=new URL(e),r=t.pathname.replace(/^\/+/,""),n=t.search.replace(/^\?/,""),i=t.hash.replace(/^#/,""),o=r.replace(/^wp-json\/?/i,""),s=o?`/${o}`:"/",a=o.match(/^([^/]+)(?:\/([^/]+))?(?:\/(.*))?$/),u=a?.[1]||"",_=a?.[2]||"",l=a?.[3]||"";return{url:e,url_encoded:encodeURIComponent(e),origin:t.origin,origin_encoded:encodeURIComponent(t.origin),proxy_url:t.origin,proxy_url_encoded:encodeURIComponent(t.origin),path:r,pathname:r,path_with_slash:t.pathname||"/",pathname_with_slash:t.pathname||"/",query:n,search:t.search,hash:t.hash,fragment:i,pathname_after_wp_json:o,pathname_after_wp_json_with_slash:s,rest_namespace:u,rest_version:_,rest_route:l,rest_route_with_slash:l?`/${l}`:"/"}}catch{return}}function te(e,t){if(!e)return{};if(Array.isArray(e)){for(const a of e){const u=te(a,t);if(u!==void 0)return u}return}if(e==="*")return{};const r=jr(t,e),{regex:n,tokens:i}=Mr(e),o=n.exec(r);if(!o)return;const s={};return i.forEach((a,u)=>{s[`matched_${a}`]=o[u+1]||""}),s}function x(e,t,r={}){const n=xr(t);if(!n)return t;const i={...n,...r};let o="",s=0;const a=/\{([a-z_]+)\}/gi;let u;for(;u=a.exec(e);){o+=e.slice(s,u.index);const _=i[u[1]]??"",l=Fr(e,u.index,u[1])?encodeURIComponent(_):_;o+=l,s=u.index+u[0].length}o+=e.slice(s);try{const _=new URL(o),l=new URL(t);return!o.includes("{search}")&&!o.includes("{query}")&&l.search&&l.searchParams.forEach((E,h)=>{_.searchParams.has(h)||_.searchParams.append(h,E)}),!o.includes("{hash}")&&!o.includes("{fragment}")&&l.hash&&!_.hash&&(_.hash=l.hash),_.toString()}catch{return o}}function ye(e,t){try{const r=new URL(t);return`${v(e)}/${r.pathname.replace(/^\//,"")}${r.search}${r.hash}`}catch{return t}}function Pe(e,t){const r=v(e);return t?De(t)?t:t.startsWith("?")||t.startsWith("#")?`${r}${t}`:`${r}${t.startsWith("/")?"":"/"}${t}`:r}function Ce(e,t,r,n){const i=e.match;return i?Array.isArray(i)?i.some(o=>Ce({...e,match:o},t,r,n)):typeof i=="function"?!!i({url:t,method:n,requestType:r}):i==="*"?!0:te(i,t)!==void 0:!0}function kr(e,t,r,n="generic"){if(e==null)return[];const i=Array.isArray(e)?e:[e],o=[];return i.forEach((s,a)=>{if(!s)return;if(typeof s=="string"){const E=s.includes("{")&&s.includes("}")?x(s,t):ye(s,t);o.push({key:`backend:${a}`,url:E,source:"resource"});return}if(!Ne(s)||!("rewrite"in s))return;const u=s;if(!Ce(u,t,n,r))return;const _=typeof u.match=="string"||Array.isArray(u.match)?te(u.match,t)||{}:{},l=typeof u.proxyBase=="string"&&u.proxyBase.trim()?u.proxyBase.trim():void 0;(Array.isArray(u.rewrite)?u.rewrite:[u.rewrite]).filter(Boolean).forEach((E,h)=>{const p=typeof E=="function"?(()=>{const A=E({url:t,proxyBase:l,method:r,requestType:n,..._}),O=l&&!De(A)?Pe(l,A):A;return O.includes("{")&&O.includes("}")?x(O,t,_):O})():l?x(Pe(l,E),t,_):E.includes("{")&&E.includes("}")?x(E,t,_):ye(E,t);o.push({key:`backend:${u.id||"rule"}:${a}:${h}`,url:p,source:"resource"})})}),Cr(o)}function Ur(e){try{const t=new URL(e);return/(?:^|\/)wp-json\/em-files\/v\d+(?:\/|$)/i.test(t.pathname)?"emFiles":/(?:^|\/)wp-json\/ai-generator\/v\d+(?:\/|$)/i.test(t.pathname)?"ai":"generic"}catch{return"generic"}}function Hr(e,t=[]){return e==null||(Array.isArray(e)?e:[e]).forEach(r=>{if(r){if(typeof r=="string"){const n=r.split("{")[0]?.trim();n&&t.push(v(n));return}!Ne(r)||!("rewrite"in r)||(typeof r.proxyBase=="string"&&r.proxyBase.trim()&&t.push(v(r.proxyBase.trim())),(Array.isArray(r.rewrite)?r.rewrite:[r.rewrite]).forEach(n=>{if(typeof n!="string")return;const i=n.split("{")[0]?.trim();i&&t.push(v(i))}))}}),t}function Gr(e,t){return Lr(t).flatMap(r=>Hr(r)).filter(Boolean).some(r=>r&&e.startsWith(r))}function Vr(e,t){return!!ee(t)&&Rr(e,t)}function Xr(e,t={}){const r=t.requestType||Ur(e);return Vr(r,t.config)?kr(ee(t.config),e,t.method,r):[]}function $r(e,t={}){return Gr(e,t.config)?[e]:Xr(e,t).map(r=>r.url)}function D(e){for(;e.endsWith("/");)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}function Le(...e){const t=e.filter(o=>o!=null);if(t.length===0)return;if(t.length===1)return t[0];const r=t.find(o=>o.aborted);if(r)return r;if(typeof AbortSignal<"u"&&typeof AbortSignal.any=="function")return AbortSignal.any(t);const n=new AbortController,i=o=>{n.signal.aborted||n.abort(o.reason)};for(const o of t)o.addEventListener("abort",()=>i(o),{once:!0});return n.signal}var ve=3e5,Re=15e3,m=null,we=!1;function Wr(){return!0}function Kr(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_TTL_MS||"").trim();if(!e)return ve;const t=Number(e);return Number.isFinite(t)&&t>0?t:ve}function qr(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_ATTEMPT_TIMEOUT_MS||"").trim();if(!e)return Re;const t=Number(e);return Number.isFinite(t)&&t>0?t:Re}function Yr(){const e="https://app.emailmaker.ru/api/".trim();return e?D(e):void 0}function zr(e){const t=e.trim();if(!t)return[];if(t.startsWith("["))try{const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("expected JSON array");return r.map(n=>String(n).trim()).filter(Boolean)}catch{return we||(we=!0),[]}return t.split(",").map(r=>r.trim()).filter(Boolean)}function Jr(e){const t=new Set,r=[];for(const n of e){const i=D(n);t.has(i)||(t.add(i),r.push(i))}return r}function Me(e){const t=String(e||"").trim();return t?D(t):Yr()}function Be(e,t=[]){return e?Jr([e,...t]).slice(0,3):[]}function je(){return zr(String({}.REACT_APP_OPENAPI_FAILOVER_BASE_URLS||"").trim())}function Qr(e=Date.now()){return m?e-m.switchedAt>=Kr():!0}function Fe(e=Date.now()){m&&Qr(e)&&(m=null)}function N(e){if(!Wr())return!1;const t=Me(e);if(!t)return!1;const r=je();return r.length===0?!1:Be(t,r).length>1}function R(e){const t=Me(e);if(!t)return[];const r=je();return r.length===0?[t]:Be(t,r)}function k(e){const t=R(e);if(t.length===0)return"";if(Fe(),m){const r=t.indexOf(m.activeUrl);if(r>=0)return t[r]}return t[0]}function xe(e){const t=R(e);if(t.length<=1||(Fe(),!m||!t.includes(m.activeUrl)))return t;const r=m.activeUrl;return[r,...t.filter(n=>n!==r)]}function ke(e){return k(e)||void 0}function Ue(e){const t=e||void 0;if(typeof AbortController>"u")return{signal:t,timeoutError:()=>{},done:()=>{}};const r=qr(),n=new AbortController;let i;const o=setTimeout(()=>{i=Zr(r),n.abort(i)},r);return{signal:Le(t,n.signal),timeoutError:()=>i,done:()=>clearTimeout(o)}}function Zr(e){const t=`[apiOriginFailover] origin attempt timed out after ${e}ms`;if(typeof DOMException=="function")return new DOMException(t,"TimeoutError");const r=new Error(t);return r.name="TimeoutError",r}function He(e){return e===502||e===503||e===504}function Ge(e){return!(e instanceof Error)&&!(e instanceof DOMException)?!1:e.name==="TimeoutError"?!0:e instanceof TypeError}var Ve;function en(e){Ve=e}function U(e,t){if(!N(t))return;const r=R(t);if(r.length<=1)return;const n=r.indexOf(D(e));if(n<0)return;const i=n+1;if(i>=r.length)return;const o=r[i],s=m?.activeUrl;m={activeUrl:o,switchedAt:Date.now()},s!==o&&Ve?.()}function Xe(e,t){if(!N(t))return;const r=D(e),n=R(t);if(n.includes(r)){if(r===n[0]){m=null;return}m?.activeUrl!==r&&(m={activeUrl:r,switchedAt:Date.now()})}}function $e(){m=null}var tn=e=>{const t=new FormData,r=(n,i,o)=>{if(i!=null){if(i instanceof Blob){n.append(o,i);return}if(Array.isArray(i)){i.forEach((s,a)=>{const u=o?`${o}[${a}]`:`${a}`;r(n,s,u)});return}if(typeof i=="object"){Object.keys(i).forEach(s=>{const a=i[s],u=o?`${o}[${s}]`:s;r(n,a,u)});return}n.append(o,String(i))}};return r(t,e),t},rn={baseUrl:D("https://app.emailmaker.ru/api/"),baseApiParams:{secure:!0,credentials:"same-origin",format:"json"},securityWorker:()=>({credentials:"same-origin"})},y=new Map;function nn(e){const t=e?.getInstance(de);return t?t.get()??t.bootstrap():void 0}var on=class extends ur{container;constructor(e={},t){super(e),this.container=t}buildRequestUrl(e){const{path:t,baseUrl:r,extraQuery:n}=e;let{query:i}=e;n&&(i=i?{...i,...n}:n);const o=i&&this.toQueryString(i);return`${r||this.baseUrl||""}${t}${o?`?${o}`:""}`}buildRequestKey(e,t){return`${t.toUpperCase()} ${e}`}getBackendProxyCandidates(e,t){const r=nn(this.container),n=this.container?.getInstance(Ee)!==void 0,i=$r(e,{config:r,method:t,standalone:n}),o=i.length>0?i:[e],s=this.buildRequestKey(e,t),a=y.get(s);return!a||!o.includes(a)?o:[a,...o.filter(u=>u!==a)]}shouldRetryResponse(e){return e.status===502||e.status===503||e.status===504}resolveFailoverBaseUrl(){return String(this.baseUrl||"").trim()||void 0}async requestOnOrigin(e,t,r=!1){const n={...e,baseUrl:t},i=this.buildRequestUrl(n),o=n.method||"GET",s=this.buildRequestKey(i,o),a=this.getBackendProxyCandidates(i,o);let u,_;for(const l of a){const E=p=>p===i?l:p,h=r?Ue(e.signal):void 0;try{const p=await super.request({...n,proxyHandler:E,...h?{signal:h.signal}:{}});if(!p.ok&&this.shouldRetryResponse(p)&&l!==a[a.length-1]){_=p,y.get(s)===l&&y.delete(s);continue}return y.set(s,l),p}catch(p){y.get(s)===l&&y.delete(s);const A=h?.timeoutError();if(A)throw A;if(u=p,(p instanceof DOMException||p instanceof Error)&&p.name==="AbortError")throw p}finally{h?.done()}}if(_)return _;throw u instanceof Error?u:new Error("Backend proxy chain failed")}async request(e){const t=String(e.baseUrl||"").trim();if(t)return this.requestOnOrigin(e,t);const r=this.resolveFailoverBaseUrl(),n=N(r),i=e.failoverAttemptTimeout??n,o=n?xe(r):r?[k(r)]:[this.baseUrl].filter(Boolean);if(o.length===0)return this.requestOnOrigin(e,this.baseUrl);let s,a;for(let u=0;u<o.length;u++){const _=o[u],l=u===o.length-1;try{const E=await this.requestOnOrigin(e,_,i);if(!E.ok&&He(E.status)){if(a=E,!l){U(_,r);continue}break}return E.ok&&Xe(_,r),E}catch(E){if(!Ge(E))throw E;s=E,l||U(_,r)}}if(n&&$e(),a)return a;throw s instanceof Error?s:new Error("API origin failover chain failed")}};function sn(e={},t){const r=new on({...rn,...e},t);return r.contentFormatters["multipart/form-data"]=tn,r}var We=f("rest.clientFactory"),an=e=>{pr(e);const t=sn({customFetch:e.getInstance(J)?.execute??Er},e);e.inject(Q,t)},Ke;(function(e){const t="https://racs.emcdn.ru/v3";function r(i,o){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)};return fetch(`${t}?resource=${i}&dataset=${document.location.hostname}`,s)}e.post=r;async function n(i,o=0){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:`{"filter":{},"limit":${o}}`};return await(await fetch(`${t}/get?resource=${i}&dataset=${document.location.hostname}`,s)).json()}e.getAll=n})(Ke||(Ke={}));function w(e,t){if(e!==t){if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e),n=Array.isArray(t);if(r){if(!n)return!1;const a=e.length;if(t.length!==a)return!1;for(let u=0;u<a;u++)if(!w(e[u],t[u]))return!1}else if(n)return!1;const i=Object.keys(e),o=Object.keys(t),s=i.length;if(s!==o.length)return!1;for(let a=0;a<s;a++){const u=i[a];if(!t.hasOwnProperty(u)||!w(e[u],t[u]))return!1}}return!0}function cn(e){const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),r=atob(t),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new TextDecoder().decode(n)}function qe(e){const[t,r,n]=e.split("."),i=JSON.parse(cn(r));return{exp:i.exp,createdAt:i.iat,data:i}}var re=f("plugin.auth.token"),Ye=new WeakMap,un=3e4;function _n(e){let t;try{t=qe(e).exp}catch{return!0}return typeof t!="number"||!Number.isFinite(t)?!0:t*1e3<=Date.now()+un}function ln(e,t,r,n){const i=Ye.get(e);i&&(i.stale=!0);const o={stale:!1};Ye.set(e,o),e.injectFactory(re,async(s,a)=>{if(o.stale)return"";try{let u=await a||void 0;if(!u){const _=e.getInstance(fe);_&&(u=await _)}return t?!u||_n(u)?await t(r,n,u):u:""}catch{return""}},!0)}var ze=f("auth.oauthProvided"),Je=new WeakMap;function Qe(e,t){const r=Je.get(e)??{applied:!1};(!r.applied||r.getAuthToken!==t.getAuthToken||!w(r.user,t.user)||r.project!==t.project)&&(Je.set(e,{applied:!0,getAuthToken:t.getAuthToken,user:t.user,project:t.project}),ln(e,t.getAuthToken,t.user,t.project))}function Ze(e){if(e.getInstance(ze))return;e.inject(ze,!0);let t;e.getInstance(le)?.watch(r=>{t=r}),e.addService(F,{execute:async(r,n)=>{if(n?.public||!t?.getAuthToken)return;e.getInstance(re)===void 0&&Qe(e,t);const i=await e.getInstanceAsync(re);i&&r.headers.set("authorization",`Bearer ${i}`)}})}var dn={theme:"canvas_fact_theme",flags:"canvas_fact_flags",commonStyles:"canvas_fact_common_styles",lockEditor:"canvas_fact_lock_editor",codeMode:"canvas_fact_code_mode",appName:"canvas_fact_app_name",previewPage:"canvas_fact_preview_page",viewport:"canvas_fact_viewport"},fn={text:{fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",lineHeight:21,lineHeightDim:"px",color:"#5a5a5a",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},headings:{fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, 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},links:{color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},buttons:{fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, 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:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:5,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},textAlign:"center",padding:{all:null,top:null,right:null,bottom:null,left:null}},block:{backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:{all:null,top:null,right:null,bottom:null,left:null}},cards:{contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}}},et="ERROR",En="useblocks",pn={em_token:"em_access_token",em_refresh_token:"em_refresh_token",em_admin_token:"em_admin_access_token",em_admin_refresh_token:"em_admin_refresh_token",em_impersonation:"em_impersonation",em_elements_view:"em_elements_view",em_new_block:"em_new_block",em_new_email:"em_new_email",em_id:"em_id",em_name:"em_name",em_email:"em_email",em_locale:"em_locale",em_carrotquest_hash:"em_carrotquest_hash",em_ducalis_hash:"em_ducalis_hash",em_email_subscription_consent:"em_email_subscription_consent",em_folder:"em_folder",promocode:"promocode",em_active_tab:"em_active_tab"},hn={em_color_scheme:"em_color_scheme",em_code_mode_pane_sizes:"em_code_mode_pane_sizes",em_preview_pane_sizes:"em_preview_pane_sizes",em_default_sizes:"em_default_sizes",em_pane_sizes:"em_pane_sizes",em_test_emails:"em_test_emails",em_menu_is_locked:"em_menu_is_locked",em_code_mode_settings:"em_code_mode_settings",em_folder_is_open:"em_folder_is_open",em_active_tab:"em_active_tab",em_ai_settings:"em_ai_settings",em_last_active_page:"em_last_active_page",em_layout_convert_never_suggest:"em_layout_convert_never_suggest",em_filemanager_v2:"em_filemanager_v2",em_projects_v2:"em_projects_v2",em_translations_v2:"em_translations_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_guest_locale:"em_guest_locale"},On="light",mn="dark",An="system",gn="(prefers-color-scheme: dark)",In={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:"sandbox_image_reset",SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:"application_subject_update",APPLICATION_PREHEADER_UPDATE:"application_preheader_update",APPLICATION_DOMPARSER_ERROR:"application_domparser_error",APPLICATION_SYNC_DRIFT:"application_sync_drift",APPLICATION_UPDATE_ENTITY:"application_update_entity",APPLICATION_IFRAME_DRAG_EVENT:"application_iframe_drag_event",APPLICATION_HAS_AMP:"application_has_amp",APPLICATION_CANVAS_IMAGE_GET:"application_canvas_image_get",APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:"application_atom_inserted",APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:"SANDBOX_READY",SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:"sandbox_subject_update",SANDBOX_PREHEADER_UPDATE:"sandbox_preheader_update",SANDBOX_DRAG_EVENT:"sandbox_drag_event",SANDBOX_WHEEL:"sandbox_wheel",SANDBOX_TRANSLATIONS:"sandbox_send_translations",SANDBOX_SET_THEME_VARIABLES:"sandbox_send_theme_variables",SANDBOX_SET_PROJECT_FONTS:"sandbox_set_project_fonts",SANDBOX_CANVAS_IMAGE_CACHE_SETUP:"sandbox_canvas_image_cache_setup",SANDBOX_SET_ENTITY:"sandbox_set_entity",SANDBOX_INIT_START:"sandbox_init_start",SANDBOX_INITED:"sandbox_inited",SANDBOX_UPDATE_ENTITY:"sandbox_update_entity",RELOAD:"reload",SANDBOX_ADD_EXTENSIONS:"sandbox_add_extensions",SANDBOX_REMOVE_EXTENSIONS:"sandbox_remove_extensions",SANDBOX_ADD_SCRIPT:"sandbox_add_script",SANDBOX_IS_EMAIL_EMPTY:"sandbox_is_email_empty",SANDBOX_SWITCH_THEME:"sandbox_switch_theme",SANDBOX_CANVAS_HEALTH:"sandbox_canvas_health",SANDBOX_CANVAS_SYNCED:"sandbox_canvas_synced"},Tn={language:"html",detectIndentation:!1,wordWrap:"on",wrappingIndent:"same",smoothScrolling:!0,automaticLayout:!0,tabSize:2,indentSize:2},tt=e=>{const t={current:Promise.resolve(),state:e,decorate:(r,n)=>(n&&(r=r.bind(n)),function(...i){const o=t.current.then(()=>r(...i));return t.current=o.then(s=>{t.state=s},s=>{}),o})};return t};function ne(e){return function(t){return{setOptions:()=>{},instance:{},dispose:()=>{},...e(t)||{}}}}function Sn(e){return t=>{const r={},n=[];for(const s of e)n.push(s(t));for(const s of n)Object.assign(r,s.instance);return{instance:r,setOptions:async s=>{for(const a of n)await a.setOptions(s)},dispose:()=>{for(const s of n)s.dispose()}}}}function bn(e=et){const t=new Error(e);return t.name="AuthPipelineError",t}async function rt(e,t,r,n){const i=n?.attemptTimeout??N(r),o=N(r)?xe(r):R(r).length>0?[k(r)]:[];if(o.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const s=e.startsWith("/")?e:`/${e}`;let a,u;for(let _=0;_<o.length;_++){const l=o[_],E=_===o.length-1,h=i?Ue(t.signal):void 0;try{const p=await fetch(`${l}${s}`,{...t,...h?{signal:h.signal}:{}});if(!p.ok&&He(p.status)){if(a=p,!E){U(l,r);continue}break}return p.ok&&Xe(l,r),p}catch(p){const A=h?.timeoutError();if(!A&&!Ge(p))throw p;u=A||p,E||U(l,r)}finally{h?.done()}}if(N(r)&&$e(),a)return a;throw u instanceof Error?u:new Error("[apiOriginFailover] fetch chain failed")}function nt(e){e.inject(C,void 0),e.inject(Y,void 0)}var Dn=ne(e=>{let t,r;const n=tt();return e.addService(F,{execute:n.decorate(async(i,o)=>{if(o?.public||!t)return;const s=String(e.getInstance(Y)||"").trim();if(s){i.headers.append("authorization",`Bearer ${s}`);return}if(!e.getInstance(C))try{const a=e.getInstance(We),u=String(a?.getOptions()?.baseUrl||"").trim(),_=ke(r||u||void 0);if(!_)throw new Error("JWT auth requires baseUrl");const l=await rt("/jwt-auth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},_);if(!l.ok)throw new Error(`JWT auth failed: ${l.status}`);const E=await l.json(),h=String(E.token||"").trim();if(!h)throw new Error("JWT auth failed: empty token");e.inject(C,void 0),e.inject(Y,h),i.headers.append("authorization",`Bearer ${h}`)}catch{throw e.inject(C,et),bn()}})}),{setOptions(i){const o=i.jwtAuth,s=String(i.baseUrl||"").trim()||void 0,a=!w(o,t),u=s!==r;if(t=o,r=s,!o){nt(e);return}a||u?nt(e):e.inject(C,void 0)}}}),Nn=ne(e=>(Ze(e),{setOptions(t){Qe(e,t)}}));function yn(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([^a-zA-Z0-9_-])/g,"\\$1")}function ie(e,t=document){try{const n=t.querySelector(e);if(n)return n}catch{return null}const r=t.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;if(!i)continue;const o=ie(e,i);if(o)return o}return null}function it(e,t=[]){const r=e.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;i&&(t.push(i),it(i,t))}return t}function Pn(e,t,r){if(e.isConnected)return e;const n=e.id?.trim();return n?ot(`#${yn(n)}`,t,r):Promise.reject(S("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."))}function ot(e,t,r){if(K(r),typeof e<"u"){if(typeof e=="string"){const n=e,i=ie(n);if(i)return i;const o=t.addDisposable(new g);return new Promise((s,a)=>{const u=O=>{o.dispose(),O()},_=()=>{u(()=>a(S(r?.reason)))};if(r?.aborted){_();return}r?.addEventListener("abort",_),o.addDispose(()=>r?.removeEventListener("abort",_));const l=document.body??document.documentElement;if(!l){u(()=>a(S("Document is not ready to observe mount element")));return}const E=new Set,h=new MutationObserver(()=>{const O=ie(n);if(O){u(()=>s(O));return}A()}),p=O=>{E.has(O)||(E.add(O),h.observe(O,{attributes:!0,childList:!0,subtree:!0}))},A=()=>{const O=document.documentElement;if(O)for(const H of it(O))p(H)};p(l),A(),o.addDispose(()=>h.disconnect())})}return e instanceof Element?Pn(e,t,r):e}return e}var Cn=new Map;Object.defineProperty(c,"ADVANCED_SETTINGS_PANEL",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(c,"APP_COOKIES",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(c,"APP_ID",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(c,"APP_LOAD_EVENT_ID",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(c,"ATOMS_HANDLERS_ID",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(c,"AsyncEmitter",{enumerable:!0,get:function(){return j}}),Object.defineProperty(c,"BaseEmitter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(c,"CANVAS_FACTS",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(c,"COMMON_STYLES",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(c,"CONFIG_CHANGED_EVENT_ID",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(c,"CONFIG_SOURCE_ID",{enumerable:!0,get:function(){return de}}),Object.defineProperty(c,"COOKIE_MANAGER_ID",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(c,"CUSTOM_FETCH_ID",{enumerable:!0,get:function(){return J}}),Object.defineProperty(c,"ContentType",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(c,"DARK",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(c,"DISPOSABLE_ID",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(c,"DependencyResolver",{enumerable:!0,get:function(){return W}}),Object.defineProperty(c,"Disposable",{enumerable:!0,get:function(){return g}}),Object.defineProperty(c,"ELEMENT_MAP",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(c,"EVENT_TYPES",{enumerable:!0,get:function(){return In}}),Object.defineProperty(c,"Emitter",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(c,"HANDLE_ATOM_INSERT_ID",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(c,"HEADLESS_MODE_ID",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(c,"INIT_PIPELINE_ID",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(c,"INSTANCE_ID",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(c,"JWTMixin",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(c,"LATE_SURFACE_LISTENERS_ID",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(c,"LIGHT",{enumerable:!0,get:function(){return On}}),Object.defineProperty(c,"LOCAL_STORAGE_ITEMS",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(c,"MESSAGE_SERVICE_ID",{enumerable:!0,get:function(){return er}}),Object.defineProperty(c,"MODAL_CLOSE_EVENT",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(c,"MODAL_SHOW_EVENT",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(c,"MODAL_UPDATE_EVENT",{enumerable:!0,get:function(){return or}}),Object.defineProperty(c,"MONACO_EDITOR_OPTIONS",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(c,"MessageService",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(c,"OAuthMixin",{enumerable:!0,get:function(){return Nn}}),Object.defineProperty(c,"OPTIONS_SOURCE_ID",{enumerable:!0,get:function(){return le}}),Object.defineProperty(c,"PLUGIN_COLLECTION_ID",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(c,"PORT_READY",{enumerable:!0,get:function(){return he}}),Object.defineProperty(c,"PREFERS_COLOR_SCHEME_DARK",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(c,"PUBLIC_REQUEST",{enumerable:!0,get:function(){return me}}),Object.defineProperty(c,"REQUEST_HANDLER_ID",{enumerable:!0,get:function(){return F}}),Object.defineProperty(c,"REST_CLIENT_FACTORY_ID",{enumerable:!0,get:function(){return We}}),Object.defineProperty(c,"REST_TRANSPORT_ID",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(c,"SANDBOX_EXTENSIONS_ID",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(c,"SANDBOX_EXTENSION_SCRIPT_STATUS_ID",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(c,"SECURITY_MODULE_ID",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(c,"SETTINGS_PANEL_EVENT",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(c,"STANDALONE_ACTIVATED_ID",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(c,"STANDALONE_BOOTSTRAP_TOKEN_ID",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(c,"STANDALONE_FILE_PROXY_REGISTERED_ID",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(c,"STANDALONE_PROJECT_ID",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(c,"STORE_ID",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(c,"SYSTEM",{enumerable:!0,get:function(){return An}}),Object.defineProperty(c,"Signal",{enumerable:!0,get:function(){return St}}),Object.defineProperty(c,"TEMPLATE_DIRECTIVES_ID",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(c,"USEBLOCKS",{enumerable:!0,get:function(){return En}}),Object.defineProperty(c,"combineMixins",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(c,"composeAbortSignals",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(c,"createAbortError",{enumerable:!0,get:function(){return S}}),Object.defineProperty(c,"createIdentifier",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(c,"createIdentifier$1",{enumerable:!0,get:function(){return f}}),Object.defineProperty(c,"createQueue",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(c,"debounce",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(c,"decodeJwt",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(c,"deepEqual",{enumerable:!0,get:function(){return w}}),Object.defineProperty(c,"defineMixin",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(c,"events",{enumerable:!0,get:function(){return q}}),Object.defineProperty(c,"fetchWithApiOriginFailover",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(c,"filter",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(c,"generateUUID",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(c,"getActiveBaseUrl",{enumerable:!0,get:function(){return k}}),Object.defineProperty(c,"getApi",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(c,"getEmitter",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(c,"getEmitter$1",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(c,"getEvent",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(c,"getServiceContainerId",{enumerable:!0,get:function(){return M}}),Object.defineProperty(c,"isAbortError",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(c,"mapHttpStatusToErrorCode",{enumerable:!0,get:function(){return At}}),Object.defineProperty(c,"mergeBackendProxyLayers",{enumerable:!0,get:function(){return br}}),Object.defineProperty(c,"mergeResourceProxyLayers",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(c,"mergeResourceProxyPolicyLayers",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(c,"mergeShallowConfigLayers",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(c,"pickKey",{enumerable:!0,get:function(){return gr}}),Object.defineProperty(c,"provideOAuth",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(c,"raceWithAbortSignal",{enumerable:!0,get:function(){return It}}),Object.defineProperty(c,"registerRestTransport",{enumerable:!0,get:function(){return an}}),Object.defineProperty(c,"releaseContainer",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(c,"resolveContainer",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(c,"resolveExplicitApiBaseUrl",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(c,"setApiOriginFailoverHook",{enumerable:!0,get:function(){return en}}),Object.defineProperty(c,"snapshot",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(c,"throwIfAborted",{enumerable:!0,get:function(){return K}}),Object.defineProperty(c,"waitForElement",{enumerable:!0,get:function(){return ot}})});
|
|
2097
2097
|
|
|
2098
2098
|
|
|
2099
2099
|
__emailmaker__.define("static/umd/b3ebeaee.js",["require","exports","module"],function(f,l,m){var v=(function(){const e=typeof document<"u"&&document.createElement("link").relList;return e&&e.supports&&e.supports("modulepreload")?"modulepreload":"preload"})(),k=function(n,e){return new URL(n,e).href},h={},c=function(e,E,P){let p=Promise.resolve();if(0)var R,w;function i(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return p.then(r=>{for(const t of r||[])t.status==="rejected"&&i(t.reason);return e().catch(i)})};Object.defineProperty(l,"__vitePreload",{enumerable:!0,get:function(){return c}})});
|
|
2100
2100
|
|
|
2101
2101
|
|
|
2102
|
-
__emailmaker__.define("emailmaker.js",["require","exports","module","static/umd/790cf6cb.js","static/umd/3a37cbb5.js","static/umd/b3ebeaee.js"],function(St,de,O_){Object.defineProperties(de,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const dn=St("./static/umd/790cf6cb.js"),l=St("./static/umd/3a37cbb5.js"),Ja=St("./static/umd/b3ebeaee.js");var Qa=new Function("url","return import(url)");function Za(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function un(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Qr(e){return e.type==="umd"||e.resolve==="registry"}var el="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 tl(e){const t=Array.isArray(e)?e[0]:e;return un(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function nl(e,t){const n=tl(e),r=un(e)?e:void 0,o=t instanceof Error?t.message:String(t),s=r&&Qr(r)&&!/compat/iu.test(o)?` ${el}`:"",i=new Error(`Plugin "${n}" was skipped: it failed to load. ${o}${s}`);return i.cause=t,{name:n,url:r?.url,error:i}}function rl(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}function R_(e){return e}var ol=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(un(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(Qr(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Qa(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 s=a=>{o||(a.filename===r.src?o=this._scriptExecutionError(e,a.error??a.message):rl(a)&&(o=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},i=()=>window.removeEventListener("error",s);window.addEventListener("error",s),r.onload=()=>{if(i(),o){n(o);return}t()},r.onerror=()=>{i(),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 s=this._createOrSkip(o.ctor,o.options);s&&!n.has(s)&&(n.add(s),t.push(s))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const i of e){const a=await this._resolveOrSkip(i);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((i,a)=>{t.has(a)||r.push({key:a,plugin:i})});for(let i=r.length-1;i>=0;i--){const{key:a,plugin:c}=r[i];await this._initializingPlugins.get(c),await this._disposePlugin(c,c.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(c),this._resolveMap.delete(c),this._initializingPlugins.delete(c),this._initializedPlugins.delete(c);const d=this._creationOrder.indexOf(c);d>=0&&this._creationOrder.splice(d,1)}const o=[],s=new Set;for(const{ctor:i,options:a}of n){const c=this._createOrSkip(i,a);c&&!s.has(c)&&(s.add(c),o.push(c))}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 s,i=!1;const a=()=>{i||(i=!0,s&&clearTimeout(s),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(s=setTimeout(()=>{i||(i=!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),s=o.constructor.name;this._emitLifecycle({type:"created",plugin:o,name:s}),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=nl(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 Za(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 s=this._initializingPlugins.get(o);if(s){n.add(s);continue}r.push(o)}if(r.length>0){const o=this._runBatchLifecycle(r);for(const s of r)this._initializingPlugins.set(s,o);n.add(o),o.finally(()=>{for(const s of r)this._initializingPlugins.get(s)===o&&this._initializingPlugins.delete(s)})}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(s){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:s})}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)}))}},sl=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)}}}},il=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()}},Zr=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 al(e,t){return t+e}function ll(){return typeof performance>"u"?Date.now():al(performance.now(),performance.timeOrigin)}var cl="emailmaker:diagnostics",dl="diagnostics",ul="diagnostics";function eo(e,t){return t?`${e}${e.includes("?")?"&":"?"}${ul}=1`:e}var fn;function fl(){try{const e=new URLSearchParams(window.location.search).get(dl);return e===null?void 0:e!=="0"}catch{return}}function pl(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function hl(){try{const e=window.localStorage.getItem(cl);return e===null?void 0:e==="1"}catch{return}}function Je(){return fn===void 0&&(fn=typeof window>"u"?!1:fl()??pl()??hl()??!1),fn}function ml(e){return`__${(e||"emailmaker").toLowerCase().replaceAll("-","")}__`}var oe={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"},k_=Object.values(oe),N_=[oe.canvasPainted,oe.canvasSettled,oe.appVisible,oe.editorVisible],gl=5e3,vl=3e3,to="diagnosticsStore",wt,Qe;function no(){return{marks:new Zr(gl),resources:new Zr(vl)}}function ro(){if(Qe)return Qe;const e=pn();return e?(Qe=e[to]??wt??no(),e[to]=Qe,wt=void 0,Qe):(wt??=no(),wt)}function J(e,t){Je()&&ro().marks.push({phase:e,at:ll(),...t})}function pn(){if(typeof __emailmaker__<"u"&&__emailmaker__)return __emailmaker__;if(typeof window>"u")return;const e=window[ml()];return e!==null&&typeof e=="object"?e:void 0}function El(e){const t=e.length,n=ro();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function _l(){const e=pn();return!e||!Array.isArray(e.diagnosticsBuffer)?0:El(e.diagnosticsBuffer)}var bl="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function _e(){const e=new Error(bl);return e.name="DestroyedInstanceError",e}function yl(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function hn(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 s=e,i=t;return s.length===i.length&&s.every((a,c)=>hn(a,i[c]))}const r=Object.keys(e),o=Object.keys(t);return r.length!==o.length?!1:r.every(s=>Object.prototype.hasOwnProperty.call(t,s)&&hn(e[s],t[s]))}function oo(e,t){const n={watch(r){let o,s=!1;return e.watch(i=>{const a=t(i);s&&hn(o,a)||(o=a,s=!0,r(a))})},select(r){return oo(n,r)}};return n}function ae(...e){let t=e[0],n=e.length>0;const r=new Set,o={get(){return n?t:void 0},set(s){t=s,n=!0;for(const i of Array.from(r))i(s)},watch(s){return r.add(s),n&&s(t),{dispose:()=>r.delete(s)}},select(s){return oo(o,s)}};return o}var Sl=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:l.ContentType.UrlEncoded,...t})},so=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 wl(e){return String(e||"").trim()||void 0}var Il=class extends l.Disposable{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=wl(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)}},mn=l.createIdentifier$1("AppInitService");function Tl(e){return async()=>{const t=await e();return(await new Sl(t).app_init_create({})).data}}function Cl(e){e.injectFactory(mn,(t,n)=>{if(n)return n;const r=new Il({options:e.getInstance(l.OPTIONS_SOURCE_ID),isStandalone:()=>!!e.getInstance(l.SECURITY_MODULE_ID),resolveRestBaseUrl:o=>o?l.getActiveBaseUrl(o):l.getActiveBaseUrl()||void 0,setRestBaseUrl:o=>{e.getInstance(l.REST_CLIENT_FACTORY_ID)?.setOptions(o?{baseUrl:o}:{})},fallbackAppInit:Tl(()=>e.getInstanceAsync(l.REST_TRANSPORT_ID)),publish:o=>{e.inject(l.APP_ID,o)}});return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var gn=l.createIdentifier$1("documentSession.emailDocuments");function Be(e){return e?.getInstance(gn)}var Al=l.createIdentifier$1("RevisionServiceFlag");function io(e){return e.getOrCreateInstance(Al,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function ao(e){return io(e).isEnabled()}var Dl=l.createIdentifier$1("EmailRightsResolver");function Pl(e,t){const n=e.getInstance(Dl);return n?n(t):!0}var lo=l.createIdentifier$1("EmailHistoryAvailabilityResolver");function Ol(e){return e.getInstance(lo)!==void 0}async function Rl(e){const t=e.getInstance(lo);if(!t)return!0;try{return await t()}catch{return!1}}var vn={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},co=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],uo=2e4,kl=co.reduce((e,t)=>e+vn[t],0),fo=uo+kl+3e3;function Nl(e){return co.reduce((t,n)=>t+po(n,e),0)}function po(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:vn[e]}function ho(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:fo}function mo(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:uo}function It(e=fo){return e+3e3}var L_="[show-pipeline]";function go(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function M_(e,t){}var Ll=()=>It();function Ml(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function xl(e){return t=>Ml(e.getOrCreateInstance(l.events.BEFORE_SAVE_EMAIL,()=>new l.AsyncEmitter).fire(t),Ll())}function Fl(e){return e!=null&&e!==""}var vo;function Ze(e,t){return vo?.capture(e,t)}function Bl(e,t){return vo?.captureMessage(e,t)}function jl(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function Tt(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var he=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} "${Tt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Tt(this.oldText)}")`:`(replace@${this.oldPosition} "${Tt(this.oldText)}" with "${Tt(this.newText)}")`}};function Eo(e,t){return e===null||e.length===0?t:new Ul(e,t).compress()}var Ul=class Ee{_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[c,d]=Ee._splitCurr(o,r.newPosition-o.oldPosition);this._acceptCurr(c),o=d;continue}if(r.newPosition<o.oldPosition){const[c,d]=Ee._splitPrev(r,o.oldPosition-r.newPosition);this._acceptPrev(c),r=d;continue}let i,a;if(o.oldEnd===r.newEnd)i=r,a=o,r=this._getPrev(++t),o=this._getCurr(++n);else if(o.oldEnd<r.newEnd){const[c,d]=Ee._splitPrev(r,o.oldLength);i=c,a=o,r=d,o=this._getCurr(++n)}else{const[c,d]=Ee._splitCurr(o,r.newLength);i=r,a=c,r=this._getPrev(++t),o=d}this._result[this._resultLen++]=new he(i.oldPosition,i.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=i.newLength-i.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const s=Ee._merge(this._result);return Ee._removeNoOps(s)}_acceptCurr(t){this._result[this._resultLen++]=Ee._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++]=Ee._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 he(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new he(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 he(t.oldPosition,t.oldText,t.newPosition,r),new he(t.oldEnd,"",t.newPosition+n,o)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),o=t.oldText.substr(n);return[new he(t.oldPosition,r,t.newPosition,t.newText),new he(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 s=1;s<t.length;s++){const i=t[s];o.oldEnd===i.oldPosition?o=new he(o.oldPosition,o.oldText+i.oldText,o.newPosition,o.newText+i.newText):(n[r++]=o,o=i)}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 s=t[o];s.oldText!==s.newText&&(n[r++]=s)}return n}};function Hl(e){return new he(e.newPosition,e.newText,e.oldPosition,e.oldText)}function $l(e){return e.map(Hl)}function _o(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Vl(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 Gl(e,t,n){let r=0;const o=e.start===e.end;for(const s of t){const i=s.newLength-s.oldLength;if(s.oldLength===0){const a=s.oldPosition;if(o&&a===e.start)r+=n==="after"?i:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=i)}continue}if(o){if(e.start>=s.oldEnd)r+=i;else if(e.start>s.oldPosition)return null;continue}if(e.start>=s.oldEnd)r+=i;else if(e.end>s.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var Ie=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},bo=0,Yl=Math.random().toString(36).slice(2,8);function Wl(){return bo+=1,`doc-${Yl}-${bo}`}function ql(e){const t=e.createBuffer(),n=e.docId??Wl();let r=e.serverId??null,o=0,s=null,i=e.attributes??{};const a=new Set;let c=!1,d=!1,u;const f=new Set;let h=null;const g=()=>(h?.version!==o&&(h={version:o,value:t.read()}),h.value),_=y=>Object.entries(y).some(([m,T])=>i[m]!==T);return{get:()=>({docId:n,serverId:r,version:o,savedVersion:s,attributes:i}),getContent:g,mutate(y,{source:m}){if(c)return o;const T=y.changes?.length?y.changes:void 0,D=T?Vl(g(),T):y.content!==void 0?y.content:void 0,B=D!==void 0&&D!==g(),M=y.attributes!==void 0&&_(y.attributes);if(!B&&!M)return o;const C=!(o>(s??-1)),E=M?Object.keys(y.attributes).filter(w=>i[w]!==y.attributes[w]):[];B&&t.write(D),M&&(i={...i,...y.attributes}),o+=1,m!=="user"&&C&&(s=o);const b={source:m,version:o,changes:T,...B?{content:!0}:{},...E.length>0?{attributes:E}:{}};return a.forEach(w=>w(b)),o},markSaved(y,m){const T={serverId:r,savedVersion:s};m!==void 0&&(r=m),(s===null||y>s)&&(s=y),(T.serverId!==r||T.savedVersion!==s)&&a.forEach(D=>D({source:"system",version:o}))},markUnsaved(){c||s===null||s<o||(s=o-1,a.forEach(y=>y({source:"system",version:o})))},markReady(){d||u!==void 0||(d=!0,f.forEach(y=>y.resolve()),f.clear(),a.forEach(y=>y({source:"system",version:o})))},isReady:()=>d,markFailed(y){d||u!==void 0||c||(u=y,f.forEach(m=>m.reject(new Ie(y))),f.clear(),a.forEach(m=>m({source:"system",version:o})))},failure:()=>u,whenReady(){return d?Promise.resolve():u!==void 0?Promise.reject(new Ie(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((y,m)=>{f.add({resolve:y,reject:m})})},subscribe(y){return a.add(y),()=>a.delete(y)},isNew:()=>r===null,isDirty:()=>o>(s??-1),isDisposed:()=>c,dispose(){c=!0,f.forEach(y=>y.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),f.clear(),a.clear(),t.dispose()}}}var Kl=500,zl=100,En=0;function Xl(e,t={}){const n=t.groupIntervalMs??Kl,r=t.maxSteps??zl,o=t.now??(()=>0);let s=[],i=0,a=En+=1,c=null,d=!1,u=!1,f=!1;const h=new Set,g=()=>h.forEach(E=>E()),_=(E,b)=>{if(E.length){u=!0;try{e.mutate({changes:E},{source:b})}finally{u=!1}}},y=E=>_(E,"user"),m=E=>{const b=o();d&&c!==null&&b-c<n?s[i-1]=Eo(s[i-1],E):(s=s.slice(0,i),s.push(E),i=s.length,d=!0,s.length>r&&(s=s.slice(s.length-r),i=s.length,a=En+=1)),c=b,g()},T=()=>{d=!1,c=null},D=E=>{if(!E.length)return;const b=s.length>i;b&&(s=s.slice(0,i)),i>0&&(s[i-1]=Eo(s[i-1],E)),T(),b&&g()},B=e.subscribe(({source:E,changes:b})=>{if(!(f||u||!b?.length)){if(E==="remote"){M();return}if(E!=="user"){D(b);return}m(b)}}),M=()=>{s=[],i=0,T(),a=En+=1,g()},C=()=>{if(i===0)return!1;const E=$l(s[i-1]);return _o(e.getContent(),E)?(y(E),i-=1,T(),!0):(s=s.slice(0,i-1),i=s.length,T(),g(),!1)};return{canUndo:()=>i>0,canRedo:()=>i<s.length,undo(){C()&&g()},redo(){if(!(i>=s.length)){if(!_o(e.getContent(),s[i])){s=s.slice(0,i),T(),g();return}y(s[i]),i+=1,T(),g()}},clear:M,applyWithoutHistory(E){const b=e.get().version;if(_(E,"system"),e.get().version===b){T();return}D(E)},getPast:E=>s.slice(0,i).reverse().slice(0,E),getFuture:E=>s.slice(i).reverse().slice(0,E),createSnapshot:()=>({stackId:a,index:i}),restoreSnapshot(E){if(E.stackId!==a||E.index>i)return!1;for(;i>E.index;)if(!C())return g(),!1;return g(),!0},subscribe(E){return h.add(E),()=>h.delete(E)},dispose(){f=!0,B(),h.clear(),s=[],i=0}}}var Jl=["edit","move","resize","insert"];function _n(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Ql(e){return typeof e=="string"?e:null}function Zl(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function ec(e){return Jl.includes(e)?e:null}function tc(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:Ql(t.originId),changeId:_n(t.changeId),rev:_n(t.rev),baseRev:_n(t.baseRev),expected:Zl(t.expected),intent:ec(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var et=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},yo=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"}},Ct=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 nc(){return typeof navigator<"u"&&navigator.onLine===!1}function rc(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 So(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 So(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 oc(e){return nc()?!0:rc(e).some(So)}var wo=new WeakSet,Io=new WeakMap;function To(e){typeof e=="object"&&e!==null&&wo.add(e)}function sc(e,t){typeof e=="object"&&e!==null&&Io.set(e,t)}function ic(e){return typeof e=="object"&&e!==null?Io.get(e):void 0}function ac(e){return e instanceof Ct||e instanceof yo||typeof e=="object"&&e!==null&&wo.has(e)}function lc(e){return e instanceof et||ac(e)}function cc(e){return!lc(e)&&oc(e)}var Co="draft";function je(e){return e==null||e===""?Co:String(e)}function At(e){return e==null||e===""?`${bn}${Co}`:`${bn}${String(e)}`}var bn="block:";function Q(e){return e?.startsWith(bn)===!0}function Ue(e){return Q(e.sessionKey())?void 0:e.current()}function x_(e,t){}function Te(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return J(`show:gate:${e}`,{kind:"wait"}),t.then(o=>(J(`show:gate:${e}:end`,{kind:"wait"}),o),o=>{const s=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw l.isAbortError(o)?(`${e}`,{...n}):(`${e}`,{error:go(o),...n},void 0),o})}var F_=5e3,dc=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function uc(e){const t=e?.trim()??"";if(!dc.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function tt(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function yn(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function fc(e,t={}){const n=tt((e??[]).filter(r=>r?.html?.trim()));return yn(n,t)?n:null}function pc(e,t){const n=Date.parse(tt(e)?.modified??""),r=fc(e),o=Date.parse(r?.modified??""),s=t===void 0||Number.isFinite(o)&&o>t,i=[n,t??NaN].filter(a=>Number.isFinite(a));return{autosave:s?r:null,...i.length?{latestAt:Math.max(...i)}:{}}}function Ao(e,t,n){const r=tt((e??[]).filter(c=>c?.html?.trim())),o=Date.parse(r?.modified??""),s=Date.parse(tt((n??[]).filter(c=>c?.html?.trim()))?.modified??""),i=r&&Number.isFinite(o)&&(t===void 0||o>t)&&!(s>o),a=[Date.parse(tt(e??[])?.modified??""),t??NaN].filter(c=>Number.isFinite(c));return{autosave:i&&yn(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function hc({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var Do=e=>e.replace(/\r\n?/g,`
|
|
2103
|
-
`),Po=["recovery","plugin","rest"],mc=["subject","preheader"];function gc(e){let t={},n;for(let o=Po.length-1;o>=0;o--){const s=e.get(Po[o]);s&&(s.attributes&&(t={...t,...s.attributes}),s.content!==void 0&&(n=s.content))}const r=e.get("plugin")?.attributes;for(const o of mc){const s=r?.[o];typeof s=="string"&&s!==""&&(t={...t,[o]:s})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function Sn(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?Do(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 he(0,n,0,r)]}:{}},{source:"remote"})}var wn=e=>typeof e=="string"?e.trim():"";function vc(e,t,n,r){const{version:o,attributes:s}=e.get(),i=s,a=r==="snapshot"||r==="anchor",c=a?i.author:void 0,d=a?i.date_gmt:void 0,u=wn(i.title)||wn(i.subject)||wn(t.fallbackTitle);return{version:o,payload:{html:e.getContent(),title:u,subject:i.subject,preheader:i.preheader,description:i.description,common_styles:i.common_styles||"",meta:i.meta,utm_parameters:i.utm_parameters,parent_email:i.parent_email,is_template:i.is_template||!1,is_inited:i.is_inited,tags:i.tags,emailtags:i.emailtags,group:i.group,renderGuid:e.get().docId,project:t.project??i.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source,...c!=null&&c!==""?{author:c}:{},...d?{excerpt:d}:{}}}}var Ec=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function _c(e){const t={};for(const n of Ec)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function bc(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 ge(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=ge(o)),n[r]=o)}return n}function yc(e){return typeof e=="string"&&e.includes("autosave")}var Sc=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function Oo(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!Sc.has(t))):{}}function He(e,t,n={}){e&&e.mutate({attributes:wc(e.get().attributes,t)},{source:n.source??"user"})}function wc(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function In(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function Ic(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function Ro(e){if(!e)return null;const t=Oo(e);return e.common_styles!==void 0&&(t.common_styles=Ic(e.common_styles)),In(e.html,t)}function ko(e){return e?In(e.html,ge(Oo(e))):null}var Tc=["common_styles","subject","preheader","meta"];function No(e){if(!e?.html?.trim())return null;const t={};for(const n of Tc)Cc(n,e[n])&&(t[n]=e[n]);return In(e.html,t)}function Cc(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 Ac=["modified","lock"];function Dc(e){if(!e)return null;const t={};for(const n of Ac)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var Pc=10,Oc=(e,t)=>e.key===t.key&&Rc(e.serverId,t.serverId),Rc=(e,t)=>e==null||e===t;function kc(e){return typeof e?.then=="function"}var Lo=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},Mo=e=>{e.request.serverId!=null&&!Tn(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},Nc=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),Tn=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),xo=(e,t)=>t?.content!==void 0&&hc({hasUnsavedUserEdit:Tn(e)})==="skip",Fo=(e,t)=>{for(const n of["subject","preheader"]){const r=t.attributes?.[n];typeof r=="string"&&(e.shownHeaders[n]=r)}},Lc=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()}),Mc=(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))},xc=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([o,s])=>e.attributes[o]!==s)),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}},Fc=e=>{const t=gc(e.reports),n=xc(e.lastMerged,t);e.lastMerged=t,n&&(Sn(e.document,n),Mo(e))},Cn=(e,t)=>{if(!e.ready&&!Tn(e)){Fc(e);return}Sn(e.document,t)},Bc=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 jc(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:o,resolveTerms:s,canEdit:i,notifyBeforeSave:a,onAdapterError:c,onTimeout:d}=e;let u,f;const h=new Set,g=new Set,_=()=>h.forEach(p=>p()),y=(p,S)=>{if(!(p.closed||p.ready)){if(p.error!==void 0){p.document.markFailed(p.error),p.document.get().docId;return}Mo(p),p.ready=!0,p.document.markReady(),p.document.get().docId,[...p.reports.keys()]}},m=(p,S,F)=>{c?.(S.id,F),!(!S.required||p.closed)&&(p.error=F,p.document.get().docId,S.id,_())},T=(p,S)=>{const F=new Set(S.map(j=>j.id));S.forEach(j=>{j.watch&&p.watchers.push(j.watch(R=>p.closed?!1:p.ready&&(xo(p,R)||p.contentShown===!0&&R?.content!==void 0)?(p.document.get().docId,j.id,!1):(R&&p.reports.set(j.id,R),Cn(p,R),R?.content!==void 0&&(p.showFill=void 0),!0)))});const V=(j,R)=>{if(!p.closed){if(!j.required&&xo(p,R)){p.document.get().docId,j.id,j.loaded?.(!1);return}R&&(p.reports.set(j.id,R),j.id==="plugin"&&Fo(p,R)),Cn(p,R),j.loaded?.(R!==null)}},$=()=>{F.size>0||p.closed||(Lo(p),y(p,[]))},G=[];if(S.forEach(j=>{let R;try{R=j.load()}catch(H){m(p,j,H),F.delete(j.id);return}if(kc(R)){G.push({id:j.id,required:j.required,load:()=>R,...j.loaded?{loaded:H=>j.loaded?.(H)}:{}});return}V(j,R),F.delete(j.id)}),G.length===0){$();return}p.timer=setTimeout(()=>{p.timer=void 0,d?.([...F]),p.document.get().docId,[...F],y(p,[...F])},n),p.timer.unref?.(),G.forEach(j=>{j.load().then(R=>V(j,R)).catch(R=>{m(p,j,R)}).finally(()=>{F.delete(j.id),$()})})},D=async(p,S,F)=>{if(F==="snapshot"||F==="anchor")return;const V=s?.();if(V)return V.resolve({project:S.project??p.project,tags:(p.tags??[]).map($=>({name:$}))})},B=p=>{if(p.lock===!0&&i?.(p)===!1)return new et("locked");const S=p.tags?.length??0,F=p.emailtags?.length??0;if(Math.max(S,F)>Pc)return new et("too-many-tags")},M=(p,S)=>{const F=p.document.get().serverId;S||F==null||(p.recoveryFacts={emailId:F,historyLoaded:!0,isRecovering:!1},Q(p.request.key)||(p.request={...p.request,key:je(F),serverId:F}))},C=(p,S,F)=>{if(p.closed||F?.id==null)return;const V=p.document.get().serverId,$=V!=null;$&&V!==String(F.id)||(p.document.markSaved(S,String(F.id)),M(p,$),p.document.get().serverId,_())},E=async(p,S,F)=>{try{await p.document.whenReady()}catch(R){return p.saveError=R,p.saveFailures+=1,p.failedIntent=S,p.saveFailures,!1}if(p.closed)return!1;const V=B(p.document.get().attributes);if(V)return p.saveError=V,p.saveFailures+=1,p.failedIntent=S,V.reason,_(),!1;if(a&&(await a(Bc(p)).catch(()=>{}),p.closed))return!1;if(Nc(p))return S==="snapshot"||(p.saveError=new et("empty-content"),p.saveFailures+=1,p.failedIntent=S,_()),!1;let $;try{$=await D(p.document.get().attributes,F,S)}catch(R){return p.saveError=R,p.saveFailures+=1,p.failedIntent=S,p.saveFailures,_(),!1}if(p.closed)return!1;const{payload:G,version:j}=vc(p.document,F,$,S);p.document.get().docId;try{const R=p.document.get().serverId!=null,H=await bc(r(),o(p.request.key),S,p.document.get().serverId,G);if(p.closed)return!0;let q;if(S==="snapshot"||S==="anchor"){const X=H?.modified!=null?Date.parse(H.modified):NaN;q=Number.isFinite(X)?X:Date.now(),p.snapshotVersion=j,p.lastRevisionAt=q}else p.document.markSaved(j,H?.id!=null?String(H.id):void 0),p.savedContent=G.html;M(p,R),p.saveError=void 0,p.saveFailures=0,p.failedIntent=void 0,p.document.get().serverId,_();const z={intent:S,serverId:p.document.get().serverId,created:!R,...q!==void 0?{revisionAt:q}:{}};return g.forEach(X=>X(z)),!0}catch(R){return(S==="publish"||S==="materialize")&&ic(R)?.then(H=>C(p,j,H)),p.saveError=R,p.saveFailures+=1,p.failedIntent=S,p.saveFailures,_(),!1}},b=p=>{p.closed=!0,p.watchers.forEach(S=>S()),p.watchers=[],Lo(p),p.history.dispose(),p.document.dispose()},w=()=>{u&&(b(u),u=void 0)},O=()=>{f&&(b(f),f=void 0)},x=(p,S,F)=>{let V=!1;S.show&&(p.show?.id!==S.show.id||p.show.token!==S.show.token)&&(p.show=S.show,V=!0,{docId:p.document.get().docId,...S.show});const $=F==="show"?ko(S.patch):null;$&&(p.reports.set("plugin",$),Fo(p,$),Cn(p,$),Mc(p,$)),V&&_()},A=(p,S={})=>P(u,p,S),N=()=>u&&Q(u.request.key??"")?f:u,k=p=>({error:p?.saveError,failures:p?.saveFailures??0,saving:p?.saving===!0,failedIntent:p?.failedIntent}),P=(p,S,F)=>!p||p.closed||S==="materialize"&&p.document.get().serverId!=null?Promise.resolve(!1):p.saving?S==="snapshot"||S==="materialize"?Promise.resolve(!1):(p.inFlight??Promise.resolve(!1)).then(()=>P(p,S,F)):(p.saving=!0,_(),p.inFlight=E(p,S,F).finally(()=>{p.saving=!1,p.inFlight=void 0,u===p&&!p.closed&&_()}),p.inFlight),v=(p,S="open",F=!1)=>{if(u&&!u.closed&&S!=="new"&&Oc(u.request,p))return x(u,p,S),u.document;w(),F||O();const V=ql({createBuffer:()=>jl(""),serverId:p.serverId??null}),$={request:p,show:p.show,document:V,history:Xl(V,{now:Date.now}),watchers:[],userTouched:new Set,shownHeaders:{},saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return u=$,$.watchers.push(Lc($)),V.get().docId,p.serverId,T($,t(p,{publishRecoveryFacts(G){$.closed||($.recoveryFacts=G,_())},readShownContent:()=>$.closed?null:$.document.getContent()})),_(),V},I=(p,S,F)=>({key:Q(p)?p:At(p),serverId:S?.id!=null?String(S.id):null,email:S,show:F});return{openWith:v,open:(p,S={})=>v({key:je(p),serverId:p,email:S.email,patch:S.patch,show:S.show},"open"),openDraft:(p,S={})=>v({key:je(void 0),serverId:null,email:p,patch:S.patch,show:S.show},"open"),startNewDraft:(p,S={})=>v({key:je(void 0),serverId:null,email:p,patch:S.patch,show:S.show},"new"),reload:(p,S={})=>v({key:je(p),serverId:p,email:S.email,patch:S.patch,show:S.show},"new"),openBlock:(p,S,F)=>v(I(p,S,F),"open"),reloadBlock:(p,S,F)=>v(I(p,S,F),"new"),openBlockOver:(p,S)=>{const F=I(p,S);return u&&!u.closed&&u.request.key===F.key?u.document:(u&&!u.closed&&!Q(u.request.key)&&(O(),f=u,u=void 0),v(F,"open",!0))},resumeSuspended:()=>{if(f)return w(),u=f,f=void 0,_(),u.document},hasSuspended:()=>!!f,suspendedDocument:()=>f?.document,show:(p,S)=>{const F=u;if(!(!F||F.closed))return v({...F.request,patch:p,show:S},"show")},current:()=>u?.document,noteServerFacts:({serverId:p,block:S},F)=>{const V=u;!V||V.closed||V.request.serverId!==p||Q(V.request.key??"")===S&&Sn(V.document,Dc(F))},save:A,saveEmail:(p,S={})=>P(N(),p,S),saveState:()=>k(u),emailSaveState:()=>k(N()),revisionFacts(){if(!u)return;const p=u.revisionFactsSnapshot;return p&&p.snapshotVersion===u.snapshotVersion&&p.lastRevisionAt===u.lastRevisionAt?p:(u.revisionFactsSnapshot={snapshotVersion:u.snapshotVersion,lastRevisionAt:u.lastRevisionAt},u.revisionFactsSnapshot)},recoveryFacts:()=>u?.recoveryFacts,history:()=>u?.history,forcedHeaders:()=>u?.forcedHeaders,beginForcedHeaders(p){u&&!u.closed&&(u.forcedHeaders=p)},endForcedHeaders(){for(const p of[u,f])p&&(p.forcedHeaders=void 0)},onSaved(p){return g.add(p),()=>g.delete(p)},showFacts:()=>u?.show,shownHeaders:()=>({...u?.shownHeaders}),showFill:()=>u?.showFill,beginShowFill(p){u&&!u.closed&&(u.showFill={showId:p,codeEdits:0})},noteCodeEdit(){u?.showFill&&(u.showFill.codeEdits+=1)},endShowFill(p){for(const S of[u,f])S?.showFill?.showId===p&&(S.showFill=void 0)},sessionKey:()=>u?.request.key,openError:()=>u?.error,subscribe(p){return h.add(p),()=>h.delete(p)},close(){!u&&!f||(w(),O(),_())}}}var An=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function Dn(e){if(e instanceof An)return e.reason;if(e instanceof Ie)return Dn(e.reason)}function Uc(e){const t=e instanceof Ie?e.reason:e;return t instanceof An&&t.reason==="unavailable"&&t.cause instanceof TypeError}function Hc(e){const t=Dn(e);return t==="forbidden"||t==="not-found"}function $c(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new An("not-found");return Ro(n)}}}var Bo=l.createIdentifier$1("EmailPort");function Vc(e){return e.getInstance(Bo)}function Gc(e,t){e.inject(Bo,t)}var jo=l.createIdentifier$1("documentSession.restEmailPortFactories");function Uo(e){return e.getInstance(jo)!==void 0}function Ce(e){const t=e.getInstance(jo);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var Yc=l.createIdentifier$1("EmailTermsResolver");function Wc(e){return e.getInstance(Yc)}var Ho=l.createIdentifier$1("EmailHistoryPort"),qc=l.createIdentifier$1("BlockHistoryPort");function $o(e){return e.getInstance(qc)}function Vo(e){return e.getInstance(Ho)}function Kc(e,t){e.inject(Ho,t)}var zc="em_autosave_pending",B_=6e4;function Dt(e){return`${zc}_${e}`}function Xc(e,t){try{sessionStorage.setItem(Dt(e),JSON.stringify(t))}catch{}}function Go(e){try{const t=sessionStorage.getItem(Dt(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(Dt(e)),null):n}catch{return null}}function nt(e){try{sessionStorage.removeItem(Dt(e))}catch{}}var Jc=2e3,Qc=5e3,Zc=5,ed=5e3,td=4;function nd(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function rd(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
2102
|
+
__emailmaker__.define("emailmaker.js",["require","exports","module","static/umd/790cf6cb.js","static/umd/cb17e366.js","static/umd/b3ebeaee.js"],function(wt,de,N_){Object.defineProperties(de,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const fn=wt("./static/umd/790cf6cb.js"),l=wt("./static/umd/cb17e366.js"),Ja=wt("./static/umd/b3ebeaee.js");var Qa=new Function("url","return import(url)");function Za(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function pn(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function eo(e){return e.type==="umd"||e.resolve==="registry"}var el="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 tl(e){const t=Array.isArray(e)?e[0]:e;return pn(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function nl(e,t){const n=tl(e),r=pn(e)?e:void 0,o=t instanceof Error?t.message:String(t),s=r&&eo(r)&&!/compat/iu.test(o)?` ${el}`:"",i=new Error(`Plugin "${n}" was skipped: it failed to load. ${o}${s}`);return i.cause=t,{name:n,url:r?.url,error:i}}function rl(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}function L_(e){return e}var ol=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(pn(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(eo(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Qa(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 s=a=>{o||(a.filename===r.src?o=this._scriptExecutionError(e,a.error??a.message):rl(a)&&(o=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},i=()=>window.removeEventListener("error",s);window.addEventListener("error",s),r.onload=()=>{if(i(),o){n(o);return}t()},r.onerror=()=>{i(),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 s=this._createOrSkip(o.ctor,o.options);s&&!n.has(s)&&(n.add(s),t.push(s))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const i of e){const a=await this._resolveOrSkip(i);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((i,a)=>{t.has(a)||r.push({key:a,plugin:i})});for(let i=r.length-1;i>=0;i--){const{key:a,plugin:c}=r[i];await this._initializingPlugins.get(c),await this._disposePlugin(c,c.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(c),this._resolveMap.delete(c),this._initializingPlugins.delete(c),this._initializedPlugins.delete(c);const d=this._creationOrder.indexOf(c);d>=0&&this._creationOrder.splice(d,1)}const o=[],s=new Set;for(const{ctor:i,options:a}of n){const c=this._createOrSkip(i,a);c&&!s.has(c)&&(s.add(c),o.push(c))}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 s,i=!1;const a=()=>{i||(i=!0,s&&clearTimeout(s),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(s=setTimeout(()=>{i||(i=!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),s=o.constructor.name;this._emitLifecycle({type:"created",plugin:o,name:s}),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=nl(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 Za(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 s=this._initializingPlugins.get(o);if(s){n.add(s);continue}r.push(o)}if(r.length>0){const o=this._runBatchLifecycle(r);for(const s of r)this._initializingPlugins.set(s,o);n.add(o),o.finally(()=>{for(const s of r)this._initializingPlugins.get(s)===o&&this._initializingPlugins.delete(s)})}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(s){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:s})}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)}))}},sl=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)}}}},il=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()}},to=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 al(e,t){return t+e}function ll(){return typeof performance>"u"?Date.now():al(performance.now(),performance.timeOrigin)}var cl="emailmaker:diagnostics",dl="diagnostics",ul="diagnostics";function no(e,t){return t?`${e}${e.includes("?")?"&":"?"}${ul}=1`:e}var hn;function fl(){try{const e=new URLSearchParams(window.location.search).get(dl);return e===null?void 0:e!=="0"}catch{return}}function pl(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function hl(){try{const e=window.localStorage.getItem(cl);return e===null?void 0:e==="1"}catch{return}}function Ze(){return hn===void 0&&(hn=typeof window>"u"?!1:fl()??pl()??hl()??!1),hn}function ml(e){return`__${(e||"emailmaker").toLowerCase().replaceAll("-","")}__`}var oe={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"},M_=Object.values(oe),x_=[oe.canvasPainted,oe.canvasSettled,oe.appVisible,oe.editorVisible],gl=5e3,vl=3e3,ro="diagnosticsStore",It,et;function oo(){return{marks:new to(gl),resources:new to(vl)}}function so(){if(et)return et;const e=mn();return e?(et=e[ro]??It??oo(),e[ro]=et,It=void 0,et):(It??=oo(),It)}function J(e,t){Ze()&&so().marks.push({phase:e,at:ll(),...t})}function mn(){if(typeof __emailmaker__<"u"&&__emailmaker__)return __emailmaker__;if(typeof window>"u")return;const e=window[ml()];return e!==null&&typeof e=="object"?e:void 0}function El(e){const t=e.length,n=so();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function _l(){const e=mn();return!e||!Array.isArray(e.diagnosticsBuffer)?0:El(e.diagnosticsBuffer)}var bl="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function be(){const e=new Error(bl);return e.name="DestroyedInstanceError",e}function yl(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function gn(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 s=e,i=t;return s.length===i.length&&s.every((a,c)=>gn(a,i[c]))}const r=Object.keys(e),o=Object.keys(t);return r.length!==o.length?!1:r.every(s=>Object.prototype.hasOwnProperty.call(t,s)&&gn(e[s],t[s]))}function io(e,t){const n={watch(r){let o,s=!1;return e.watch(i=>{const a=t(i);s&&gn(o,a)||(o=a,s=!0,r(a))})},select(r){return io(n,r)}};return n}function ae(...e){let t=e[0],n=e.length>0;const r=new Set,o={get(){return n?t:void 0},set(s){t=s,n=!0;for(const i of Array.from(r))i(s)},watch(s){return r.add(s),n&&s(t),{dispose:()=>r.delete(s)}},select(s){return io(o,s)}};return o}var Sl=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:l.ContentType.UrlEncoded,...t})},ao=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 wl(e){return String(e||"").trim()||void 0}var Il=class extends l.Disposable{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=wl(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)}},vn=l.createIdentifier$1("AppInitService");function Tl(e){return async()=>{const t=await e();return(await new Sl(t).app_init_create({})).data}}function Cl(e){e.injectFactory(vn,(t,n)=>{if(n)return n;const r=new Il({options:e.getInstance(l.OPTIONS_SOURCE_ID),isStandalone:()=>!!e.getInstance(l.SECURITY_MODULE_ID),resolveRestBaseUrl:o=>o?l.getActiveBaseUrl(o):l.getActiveBaseUrl()||void 0,setRestBaseUrl:o=>{e.getInstance(l.REST_CLIENT_FACTORY_ID)?.setOptions(o?{baseUrl:o}:{})},fallbackAppInit:Tl(()=>e.getInstanceAsync(l.REST_TRANSPORT_ID)),publish:o=>{e.inject(l.APP_ID,o)}});return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var En=l.createIdentifier$1("documentSession.emailDocuments");function He(e){return e?.getInstance(En)}var Al=l.createIdentifier$1("RevisionServiceFlag");function lo(e){return e.getOrCreateInstance(Al,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function co(e){return lo(e).isEnabled()}var Dl=l.createIdentifier$1("EmailRightsResolver");function Pl(e,t){const n=e.getInstance(Dl);return n?n(t):!0}var _n={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},uo=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],fo=2e4,Ol=uo.reduce((e,t)=>e+_n[t],0),po=fo+Ol+3e3;function Rl(e){return uo.reduce((t,n)=>t+ho(n,e),0)}function ho(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:_n[e]}function mo(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:po}function go(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:fo}function Tt(e=po){return e+3e3}var F_="[show-pipeline]";function vo(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function B_(e,t){}var kl=()=>Tt();function Nl(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function Ll(e){return t=>Nl(e.getOrCreateInstance(l.events.BEFORE_SAVE_EMAIL,()=>new l.AsyncEmitter).fire(t),kl())}var Ae=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},Eo=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"}},Ct=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 re(e){return e.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}var _o=new WeakMap,bn=new WeakMap;function ue(e){return _o.get(e)??0}function At(e,t){let n=bn.get(e);return n||(n=new Set,bn.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Ml(e){_o.set(e,ue(e)+1),bn.get(e)?.forEach(t=>t())}var xl=1e4;function Fl(e,t=xl){return async()=>{const n=re(e);let r;const o=new Promise(s=>{r=setTimeout(()=>s("silent"),t)});try{const s=await Promise.race([n.sendAsync(l.EVENT_TYPES.SANDBOX_CANVAS_SYNCED,void 0,!1),o]);if(s==="silent"||s&&!s.synced)throw s==="silent"||s?.unsent,new Ae("canvas-not-synced")}finally{clearTimeout(r)}}}function Bl(e){return e!=null&&e!==""}var bo;function tt(e,t){return bo?.capture(e,t)}function jl(e,t){return bo?.captureMessage(e,t)}var Ul=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Hl=200;function yo(e=new Set){const t=new Set;return(n,r)=>{if(!Ul.some(([s,i])=>!e.has(s)&&i.test(n)))return;const o=r??`new:${n.length}:${n.slice(0,200)}`;t.has(o)||(t.size>=Hl&&t.clear(),t.add(o))}}function So(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:yo()}}var $l=So();function ye(e){return e?.getInstance(l.TEMPLATE_DIRECTIVES_ID)??$l}function Vl(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function Dt(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var he=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} "${Dt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Dt(this.oldText)}")`:`(replace@${this.oldPosition} "${Dt(this.oldText)}" with "${Dt(this.newText)}")`}};function wo(e,t){return e===null||e.length===0?t:new Gl(e,t).compress()}var Gl=class _e{_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[c,d]=_e._splitCurr(o,r.newPosition-o.oldPosition);this._acceptCurr(c),o=d;continue}if(r.newPosition<o.oldPosition){const[c,d]=_e._splitPrev(r,o.oldPosition-r.newPosition);this._acceptPrev(c),r=d;continue}let i,a;if(o.oldEnd===r.newEnd)i=r,a=o,r=this._getPrev(++t),o=this._getCurr(++n);else if(o.oldEnd<r.newEnd){const[c,d]=_e._splitPrev(r,o.oldLength);i=c,a=o,r=d,o=this._getCurr(++n)}else{const[c,d]=_e._splitCurr(o,r.newLength);i=r,a=c,r=this._getPrev(++t),o=d}this._result[this._resultLen++]=new he(i.oldPosition,i.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=i.newLength-i.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const s=_e._merge(this._result);return _e._removeNoOps(s)}_acceptCurr(t){this._result[this._resultLen++]=_e._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++]=_e._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 he(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new he(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 he(t.oldPosition,t.oldText,t.newPosition,r),new he(t.oldEnd,"",t.newPosition+n,o)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),o=t.oldText.substr(n);return[new he(t.oldPosition,r,t.newPosition,t.newText),new he(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 s=1;s<t.length;s++){const i=t[s];o.oldEnd===i.oldPosition?o=new he(o.oldPosition,o.oldText+i.oldText,o.newPosition,o.newText+i.newText):(n[r++]=o,o=i)}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 s=t[o];s.oldText!==s.newText&&(n[r++]=s)}return n}};function Yl(e){return new he(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Wl(e){return e.map(Yl)}function Io(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function ql(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 Kl(e,t,n){let r=0;const o=e.start===e.end;for(const s of t){const i=s.newLength-s.oldLength;if(s.oldLength===0){const a=s.oldPosition;if(o&&a===e.start)r+=n==="after"?i:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=i)}continue}if(o){if(e.start>=s.oldEnd)r+=i;else if(e.start>s.oldPosition)return null;continue}if(e.start>=s.oldEnd)r+=i;else if(e.end>s.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var De=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},To=0,zl=Math.random().toString(36).slice(2,8);function Xl(){return To+=1,`doc-${zl}-${To}`}function Jl(e){const t=e.createBuffer(),n=e.docId??Xl();let r=e.serverId??null,o=0,s=null,i=e.attributes??{};const a=new Set;let c=!1,d=!1,u;const p=new Set;let f=null;const g=()=>(f?.version!==o&&(f={version:o,value:t.read()}),f.value),y=_=>Object.entries(_).some(([m,I])=>i[m]!==I);return{get:()=>({docId:n,serverId:r,version:o,savedVersion:s,attributes:i}),getContent:g,mutate(_,{source:m}){if(c)return o;const I=_.changes?.length?_.changes:void 0,P=I?ql(g(),I):_.content!==void 0?_.content:void 0,x=P!==void 0&&P!==g(),L=_.attributes!==void 0&&y(_.attributes);if(!x&&!L)return o;const C=!(o>(s??-1)),E=L?Object.keys(_.attributes).filter(w=>i[w]!==_.attributes[w]):[];x&&t.write(P),L&&(i={...i,..._.attributes}),o+=1,m!=="user"&&C&&(s=o);const S={source:m,version:o,changes:I,...x?{content:!0}:{},...E.length>0?{attributes:E}:{}};return a.forEach(w=>w(S)),o},markSaved(_,m){const I={serverId:r,savedVersion:s};m!==void 0&&(r=m),(s===null||_>s)&&(s=_),(I.serverId!==r||I.savedVersion!==s)&&a.forEach(P=>P({source:"system",version:o}))},markUnsaved(){c||s===null||s<o||(s=o-1,a.forEach(_=>_({source:"system",version:o})))},markReady(){d||u!==void 0||(d=!0,p.forEach(_=>_.resolve()),p.clear(),a.forEach(_=>_({source:"system",version:o})))},isReady:()=>d,markFailed(_){d||u!==void 0||c||(u=_,p.forEach(m=>m.reject(new De(_))),p.clear(),a.forEach(m=>m({source:"system",version:o})))},failure:()=>u,whenReady(){return d?Promise.resolve():u!==void 0?Promise.reject(new De(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((_,m)=>{p.add({resolve:_,reject:m})})},subscribe(_){return a.add(_),()=>a.delete(_)},isNew:()=>r===null,isDirty:()=>o>(s??-1),isDisposed:()=>c,dispose(){c=!0,p.forEach(_=>_.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),p.clear(),a.clear(),t.dispose()}}}var Ql=500,Zl=100,yn=0;function ec(e,t={}){const n=t.groupIntervalMs??Ql,r=t.maxSteps??Zl,o=t.now??(()=>0);let s=[],i=0,a=yn+=1,c=null,d=!1,u=!1,p=!1;const f=new Set,g=()=>f.forEach(E=>E()),y=(E,S)=>{if(E.length){u=!0;try{e.mutate({changes:E},{source:S})}finally{u=!1}}},_=E=>y(E,"user"),m=E=>{const S=o();d&&c!==null&&S-c<n?s[i-1]=wo(s[i-1],E):(s=s.slice(0,i),s.push(E),i=s.length,d=!0,s.length>r&&(s=s.slice(s.length-r),i=s.length,a=yn+=1)),c=S,g()},I=()=>{d=!1,c=null},P=E=>{if(!E.length)return;const S=s.length>i;S&&(s=s.slice(0,i)),i>0&&(s[i-1]=wo(s[i-1],E)),I(),S&&g()},x=e.subscribe(({source:E,changes:S})=>{if(!(p||u||!S?.length)){if(E==="remote"){L();return}if(E!=="user"){P(S);return}m(S)}}),L=()=>{s=[],i=0,I(),a=yn+=1,g()},C=()=>{if(i===0)return!1;const E=Wl(s[i-1]);return Io(e.getContent(),E)?(_(E),i-=1,I(),!0):(s=s.slice(0,i-1),i=s.length,I(),g(),!1)};return{canUndo:()=>i>0,canRedo:()=>i<s.length,undo(){C()&&g()},redo(){if(!(i>=s.length)){if(!Io(e.getContent(),s[i])){s=s.slice(0,i),I(),g();return}_(s[i]),i+=1,I(),g()}},clear:L,applyWithoutHistory(E){const S=e.get().version;if(y(E,"system"),e.get().version===S){I();return}P(E)},getPast:E=>s.slice(0,i).reverse().slice(0,E),getFuture:E=>s.slice(i).reverse().slice(0,E),createSnapshot:()=>({stackId:a,index:i}),restoreSnapshot(E){if(E.stackId!==a||E.index>i)return!1;for(;i>E.index;)if(!C())return g(),!1;return g(),!0},subscribe(E){return f.add(E),()=>f.delete(E)},dispose(){p=!0,x(),f.clear(),s=[],i=0}}}var tc=["edit","move","resize","insert"];function Sn(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function nc(e){return typeof e=="string"?e:null}function rc(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function oc(e){return tc.includes(e)?e:null}function sc(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:nc(t.originId),changeId:Sn(t.changeId),rev:Sn(t.rev),baseRev:Sn(t.baseRev),expected:rc(t.expected),intent:oc(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var wn=e=>e.replace(/\r\n?/g,`
|
|
2103
|
+
`);function ic(){return typeof navigator<"u"&&navigator.onLine===!1}function ac(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 Co(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 Co(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 lc(e){return ic()?!0:ac(e).some(Co)}var Ao=new WeakSet,Do=new WeakMap;function Po(e){typeof e=="object"&&e!==null&&Ao.add(e)}function cc(e,t){typeof e=="object"&&e!==null&&Do.set(e,t)}function dc(e){return typeof e=="object"&&e!==null?Do.get(e):void 0}function uc(e){return e instanceof Ct||e instanceof Eo||typeof e=="object"&&e!==null&&Ao.has(e)}function fc(e){return e instanceof Ae||uc(e)}function pc(e){return e instanceof Ae?e.reason==="canvas-not-synced":!fc(e)&&lc(e)}var Oo="draft";function $e(e){return e==null||e===""?Oo:String(e)}function Pt(e){return e==null||e===""?`${In}${Oo}`:`${In}${String(e)}`}var In="block:";function Q(e){return e?.startsWith(In)===!0}function Ve(e){return Q(e.sessionKey())?void 0:e.current()}function j_(e,t){}function Pe(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return J(`show:gate:${e}`,{kind:"wait"}),t.then(o=>(J(`show:gate:${e}:end`,{kind:"wait"}),o),o=>{const s=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw l.isAbortError(o)?(`${e}`,{...n}):(`${e}`,{error:vo(o),...n},void 0),o})}var U_=5e3,hc=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function mc(e){const t=e?.trim()??"";if(!hc.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function nt(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function Tn(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function gc(e,t={}){const n=nt((e??[]).filter(r=>r?.html?.trim()));return Tn(n,t)?n:null}function vc(e,t){const n=Date.parse(nt(e)?.modified??""),r=gc(e),o=Date.parse(r?.modified??""),s=t===void 0||Number.isFinite(o)&&o>t,i=[n,t??NaN].filter(a=>Number.isFinite(a));return{autosave:s?r:null,...i.length?{latestAt:Math.max(...i)}:{}}}function Ro(e,t,n){const r=nt((e??[]).filter(c=>c?.html?.trim())),o=Date.parse(r?.modified??""),s=Date.parse(nt((n??[]).filter(c=>c?.html?.trim()))?.modified??""),i=r&&Number.isFinite(o)&&(t===void 0||o>t)&&!(s>o),a=[Date.parse(nt(e??[])?.modified??""),t??NaN].filter(c=>Number.isFinite(c));return{autosave:i&&Tn(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function Ec({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var ko=["recovery","plugin","rest"],_c=["subject","preheader"];function bc(e){let t={},n;for(let o=ko.length-1;o>=0;o--){const s=e.get(ko[o]);s&&(s.attributes&&(t={...t,...s.attributes}),s.content!==void 0&&(n=s.content))}const r=e.get("plugin")?.attributes;for(const o of _c){const s=r?.[o];typeof s=="string"&&s!==""&&(t={...t,[o]:s})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function Cn(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?wn(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 he(0,n,0,r)]}:{}},{source:"remote"})}var An=e=>typeof e=="string"?e.trim():"";function yc(e,t,n,r){const{version:o,attributes:s}=e.get(),i=s,a=r==="snapshot"||r==="anchor",c=a?i.author:void 0,d=a?i.date_gmt:void 0,u=An(i.title)||An(i.subject)||An(t.fallbackTitle);return{version:o,payload:{html:e.getContent(),title:u,subject:i.subject,preheader:i.preheader,description:i.description,common_styles:i.common_styles||"",meta:i.meta,utm_parameters:i.utm_parameters,parent_email:i.parent_email,is_template:i.is_template||!1,is_inited:i.is_inited,tags:i.tags,emailtags:i.emailtags,group:i.group,renderGuid:e.get().docId,project:t.project??i.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source,...c!=null&&c!==""?{author:c}:{},...d?{excerpt:d}:{}}}}var Sc=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function wc(e){const t={};for(const n of Sc)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function Ic(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 ve(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=ve(o)),n[r]=o)}return n}function Tc(e){return typeof e=="string"&&e.includes("autosave")}var Cc=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function No(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!Cc.has(t))):{}}function Ge(e,t,n={}){e&&e.mutate({attributes:Ac(e.get().attributes,t)},{source:n.source??"user"})}function Ac(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function Dn(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function Dc(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function Lo(e){if(!e)return null;const t=No(e);return e.common_styles!==void 0&&(t.common_styles=Dc(e.common_styles)),Dn(e.html,t)}function Mo(e){return e?Dn(e.html,ve(No(e))):null}var Pc=["common_styles","subject","preheader","meta"];function xo(e){if(!e?.html?.trim())return null;const t={};for(const n of Pc)Oc(n,e[n])&&(t[n]=e[n]);return Dn(e.html,t)}function Oc(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 Rc=["modified","lock"];function kc(e){if(!e)return null;const t={};for(const n of Rc)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var Nc=10,Lc=(e,t)=>e.key===t.key&&Mc(e.serverId,t.serverId),Mc=(e,t)=>e==null||e===t;function xc(e){return typeof e?.then=="function"}var Fo=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},Bo=e=>{e.request.serverId!=null&&!Ot(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},Fc=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),Ot=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),jo=(e,t)=>t?.content!==void 0&&Ec({hasUnsavedUserEdit:Ot(e)})==="skip",Uo=(e,t)=>{for(const n of["subject","preheader"]){const r=t.attributes?.[n];typeof r=="string"&&(e.shownHeaders[n]=r)}},Bc=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()}),jc=(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))},Uc=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([o,s])=>e.attributes[o]!==s)),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}},Hc=e=>{const t=bc(e.reports),n=Uc(e.lastMerged,t);e.lastMerged=t,e.broughtContent=Rt(t.content)??e.broughtContent,n&&(Cn(e.document,n),Bo(e))},Pn=(e,t)=>{if(!e.ready&&!Ot(e)){Hc(e);return}e.broughtContent=Rt(t?.content)??e.broughtContent,Cn(e.document,t)},Rt=e=>e===void 0?void 0:wn(e),$c=(e,t)=>t.content===void 0||Rt(t.content)!==e.broughtContent||!Ot(e)?t:{...t,content:void 0},Vc=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 Gc(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:o,resolveTerms:s,canEdit:i,notifyBeforeSave:a,awaitCanvasSynced:c,savedEchoForm:d=h=>h,onAdapterError:u,onTimeout:p}=e;let f,g;const y=new Set,_=new Set,m=()=>y.forEach(h=>h()),I=(h,D)=>{if(!(h.closed||h.ready)){if(h.error!==void 0){h.document.markFailed(h.error),h.document.get().docId;return}Bo(h),h.ready=!0,h.document.markReady(),h.document.get().docId,[...h.reports.keys()]}},P=(h,D,U)=>{u?.(D.id,U),!(!D.required||h.closed)&&(h.error=U,h.document.get().docId,D.id,m())},x=(h,D)=>{const U=new Set(D.map(j=>j.id));D.forEach(j=>{j.watch&&h.watchers.push(j.watch(H=>h.closed?!1:h.ready&&(jo(h,H)||h.contentShown===!0&&H?.content!==void 0)?(h.document.get().docId,j.id,!1):(H&&h.reports.set(j.id,H),Pn(h,H),H?.content!==void 0&&(h.showFill=void 0),!0)))});const Y=(j,H)=>{if(!h.closed){if(!j.required&&jo(h,H)){h.document.get().docId,j.id,j.loaded?.(!1);return}H&&(h.reports.set(j.id,H),j.id==="plugin"&&Uo(h,H)),Pn(h,H),j.loaded?.(H!==null)}},G=()=>{U.size>0||h.closed||(Fo(h),I(h,[]))},B=[];if(D.forEach(j=>{let H;try{H=j.load()}catch(W){P(h,j,W),U.delete(j.id);return}if(xc(H)){B.push({id:j.id,required:j.required,load:()=>H,...j.loaded?{loaded:W=>j.loaded?.(W)}:{}});return}Y(j,H),U.delete(j.id)}),B.length===0){G();return}h.timer=setTimeout(()=>{h.timer=void 0,p?.([...U]),h.document.get().docId,[...U],I(h,[...U])},n),h.timer.unref?.(),B.forEach(j=>{j.load().then(H=>Y(j,H)).catch(H=>{P(h,j,H)}).finally(()=>{U.delete(j.id),G()})})},L=async(h,D,U)=>{if(U==="snapshot"||U==="anchor")return;const Y=s?.();if(Y)return Y.resolve({project:D.project??h.project,tags:(h.tags??[]).map(G=>({name:G}))})},C=h=>{if(h.lock===!0&&i?.(h)===!1)return new Ae("locked");const D=h.tags?.length??0,U=h.emailtags?.length??0;if(Math.max(D,U)>Nc)return new Ae("too-many-tags")},E=(h,D)=>{const U=h.document.get().serverId;D||U==null||(h.recoveryFacts={emailId:U,historyLoaded:!0,isRecovering:!1},Q(h.request.key)||(h.request={...h.request,key:$e(U),serverId:U}))},S=(h,D,U)=>{if(h.closed||U?.id==null)return;const Y=h.document.get().serverId,G=Y!=null;G&&Y!==String(U.id)||(h.document.markSaved(D,String(U.id)),E(h,G),h.document.get().serverId,m())},w=async(h,D,U)=>{try{await h.document.whenReady()}catch(H){return h.saveError=H,h.saveFailures+=1,h.failedIntent=D,h.saveFailures,!1}if(h.closed)return!1;const Y=C(h.document.get().attributes);if(Y)return h.saveError=Y,h.saveFailures+=1,h.failedIntent=D,Y.reason,m(),!1;if(a&&(await a(Vc(h)).catch(()=>{}),h.closed))return!1;if(c){try{await c()}catch(H){return h.saveError=H,h.saveFailures+=1,h.failedIntent=D,h.saveFailures,m(),!1}if(h.closed)return!1}if(Fc(h))return D==="snapshot"||(h.saveError=new Ae("empty-content"),h.saveFailures+=1,h.failedIntent=D,m()),!1;let G;try{G=await L(h.document.get().attributes,U,D)}catch(H){return h.saveError=H,h.saveFailures+=1,h.failedIntent=D,h.saveFailures,m(),!1}if(h.closed)return!1;const{payload:B,version:j}=yc(h.document,U,G,D);h.document.get().docId;try{const H=h.document.get().serverId!=null,W=await Ic(r(),o(h.request.key),D,h.document.get().serverId,B);if(h.closed)return!0;let X;if(D==="snapshot"||D==="anchor"){const ge=W?.modified!=null?Date.parse(W.modified):NaN;X=Number.isFinite(ge)?ge:Date.now(),h.snapshotVersion=j,h.lastRevisionAt=X}else h.document.markSaved(j,W?.id!=null?String(W.id):void 0),h.savedContent=B.html,h.broughtContent=Rt(d(B.html));E(h,H),h.saveError=void 0,h.saveFailures=0,h.failedIntent=void 0,h.document.get().serverId,m();const Ie={intent:D,serverId:h.document.get().serverId,created:!H,...X!==void 0?{revisionAt:X}:{}};return _.forEach(ge=>ge(Ie)),!0}catch(H){return(D==="publish"||D==="materialize")&&dc(H)?.then(W=>S(h,j,W)),h.saveError=H,h.saveFailures+=1,h.failedIntent=D,h.saveFailures,m(),!1}},O=h=>{h.closed=!0,h.watchers.forEach(D=>D()),h.watchers=[],Fo(h),h.history.dispose(),h.document.dispose()},N=()=>{f&&(O(f),f=void 0)},A=()=>{g&&(O(g),g=void 0)},T=(h,D,U)=>{let Y=!1;D.show&&(h.show?.id!==D.show.id||h.show.token!==D.show.token)&&(h.show=D.show,Y=!0,{docId:h.document.get().docId,...D.show});const G=U==="show"?Mo(D.patch):null;if(G){h.reports.set("plugin",G),Uo(h,G);const B=$c(h,G);Pn(h,B),jc(h,B)}Y&&m()},R=(h,D={})=>b(f,h,D),M=()=>f&&Q(f.request.key??"")?g:f,v=h=>({error:h?.saveError,failures:h?.saveFailures??0,saving:h?.saving===!0,failedIntent:h?.failedIntent}),b=(h,D,U)=>!h||h.closed||D==="materialize"&&h.document.get().serverId!=null?Promise.resolve(!1):h.saving?D==="snapshot"||D==="materialize"?Promise.resolve(!1):(h.inFlight??Promise.resolve(!1)).then(()=>b(h,D,U)):(h.saving=!0,m(),h.inFlight=w(h,D,U).finally(()=>{h.saving=!1,h.inFlight=void 0,f===h&&!h.closed&&m()}),h.inFlight),F=(h,D="open",U=!1)=>{if(f&&!f.closed&&D!=="new"&&Lc(f.request,h))return T(f,h,D),f.document;N(),U||A();const Y=Jl({createBuffer:()=>Vl(""),serverId:h.serverId??null}),G={request:h,show:h.show,document:Y,history:ec(Y,{now:Date.now}),watchers:[],userTouched:new Set,shownHeaders:{},saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return f=G,G.watchers.push(Bc(G)),Y.get().docId,h.serverId,x(G,t(h,{publishRecoveryFacts(B){G.closed||(G.recoveryFacts=B,m())},readShownContent:()=>G.closed?null:G.document.getContent()})),m(),Y},V=(h,D,U)=>({key:Q(h)?h:Pt(h),serverId:D?.id!=null?String(D.id):null,email:D,show:U});return{openWith:F,open:(h,D={})=>F({key:$e(h),serverId:h,email:D.email,patch:D.patch,show:D.show},"open"),openDraft:(h,D={})=>F({key:$e(void 0),serverId:null,email:h,patch:D.patch,show:D.show},"open"),startNewDraft:(h,D={})=>F({key:$e(void 0),serverId:null,email:h,patch:D.patch,show:D.show},"new"),reload:(h,D={})=>F({key:$e(h),serverId:h,email:D.email,patch:D.patch,show:D.show},"new"),openBlock:(h,D,U)=>F(V(h,D,U),"open"),reloadBlock:(h,D,U)=>F(V(h,D,U),"new"),openBlockOver:(h,D)=>{const U=V(h,D);return f&&!f.closed&&f.request.key===U.key?f.document:(f&&!f.closed&&!Q(f.request.key)&&(A(),g=f,f=void 0),F(U,"open",!0))},resumeSuspended:()=>{if(g)return N(),f=g,g=void 0,m(),f.document},hasSuspended:()=>!!g,suspendedDocument:()=>g?.document,show:(h,D)=>{const U=f;if(!(!U||U.closed))return F({...U.request,patch:h,show:D},"show")},current:()=>f?.document,noteServerFacts:({serverId:h,block:D},U)=>{const Y=f;!Y||Y.closed||Y.request.serverId!==h||Q(Y.request.key??"")===D&&Cn(Y.document,kc(U))},save:R,saveEmail:(h,D={})=>b(M(),h,D),saveState:()=>v(f),emailSaveState:()=>v(M()),revisionFacts(){if(!f)return;const h=f.revisionFactsSnapshot;return h&&h.snapshotVersion===f.snapshotVersion&&h.lastRevisionAt===f.lastRevisionAt?h:(f.revisionFactsSnapshot={snapshotVersion:f.snapshotVersion,lastRevisionAt:f.lastRevisionAt},f.revisionFactsSnapshot)},recoveryFacts:()=>f?.recoveryFacts,history:()=>f?.history,forcedHeaders:()=>f?.forcedHeaders,beginForcedHeaders(h){f&&!f.closed&&(f.forcedHeaders=h)},endForcedHeaders(){for(const h of[f,g])h&&(h.forcedHeaders=void 0)},onSaved(h){return _.add(h),()=>_.delete(h)},showFacts:()=>f?.show,shownHeaders:()=>({...f?.shownHeaders}),showFill:()=>f?.showFill,beginShowFill(h){f&&!f.closed&&(f.showFill={showId:h,codeEdits:0})},noteCodeEdit(){f?.showFill&&(f.showFill.codeEdits+=1)},endShowFill(h){for(const D of[f,g])D?.showFill?.showId===h&&(D.showFill=void 0)},sessionKey:()=>f?.request.key,openError:()=>f?.error,subscribe(h){return y.add(h),()=>y.delete(h)},close(){!f&&!g||(N(),A(),m())}}}var On=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function Rn(e){if(e instanceof On)return e.reason;if(e instanceof De)return Rn(e.reason)}function Yc(e){const t=e instanceof De?e.reason:e;return t instanceof On&&t.reason==="unavailable"&&t.cause instanceof TypeError}function Wc(e){const t=Rn(e);return t==="forbidden"||t==="not-found"}function qc(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new On("not-found");return Lo(n)}}}var Ho=l.createIdentifier$1("EmailPort");function Kc(e){return e.getInstance(Ho)}function zc(e,t){e.inject(Ho,t)}var $o=l.createIdentifier$1("documentSession.restEmailPortFactories");function Vo(e){return e.getInstance($o)!==void 0}function Oe(e){const t=e.getInstance($o);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var Xc=l.createIdentifier$1("EmailTermsResolver");function Jc(e){return e.getInstance(Xc)}var Go=l.createIdentifier$1("EmailHistoryPort"),Qc=l.createIdentifier$1("BlockHistoryPort");function Yo(e){return e.getInstance(Qc)}function Wo(e){return e.getInstance(Go)}function Zc(e,t){e.inject(Go,t)}var ed="em_autosave_pending",H_=6e4;function kt(e){return`${ed}_${e}`}function td(e,t){try{sessionStorage.setItem(kt(e),JSON.stringify(t))}catch{}}function qo(e){try{const t=sessionStorage.getItem(kt(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(kt(e)),null):n}catch{return null}}function rt(e){try{sessionStorage.removeItem(kt(e))}catch{}}var nd=2e3,rd=5e3,od=5,sd=5e3,id=4;function ad(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function ld(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
2104
2104
|
`,`
|
|
2105
2105
|
`)===t.replaceAll(`\r
|
|
2106
2106
|
`,`
|
|
2107
|
-
`)}function Pn(e,t){return yn(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function od({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:o,onFacts:s,onLate:i,onError:a,pageLoadTs:c=nd()}){let d=null,u=!1,f=!1,h=0,g={emailId:e,historyLoaded:!1,isRecovering:!1},_=null;const y=new Promise(P=>{_=P}),m=P=>{g={...g,...P},s(g)};let T;const D=P=>{h+=1,m({applied:{phase:P,seq:h}})},B=()=>{d?.timer&&clearTimeout(d.timer),d=null},M=P=>{if(!f){if(_){const v=_;_=null,v(P),T=P.revision?P.phase:void 0;return}i(P)&&P.revision&&D(P.phase)}},C=()=>{if(!d||f)return;const P=d.phase==="fast",v=P?Jc:ed,I=P?Zc:td;d.timer=setTimeout(()=>{const p=d;if(!(!p||f)){if(p.attempts+=1,O(),P&&p.attempts>=I){const{pending:S}=p;nt(e),m({isRecovering:!1}),M({revision:{html:S.html,common_styles:S.common_styles,subject:S.subject,preheader:S.preheader},phase:"timeout"}),u=!0,p.phase="bg",p.attempts=0,C();return}if(!P&&p.attempts>=I){nt(e),B(),m({isRecovering:!1}),u=!0;return}C()}},v),d.timer.unref?.()},E=P=>{d={phase:"fast",attempts:0,pending:P,timer:null},m({isRecovering:!0}),C()},b=P=>{if(f)return;if(m({historyLoaded:!0,latestRevisionAt:P.latestAt!==void 0&&Number.isFinite(P.latestAt)?P.latestAt:void 0}),n&&d){const p=Pn(P,d.pending.sentAt);if(!p)return;const S=d.phase==="fast"?"found":"bg";nt(e),B(),m({isRecovering:!1}),u=!0,M({revision:p,phase:S});return}if(u)return;const v=n?Go(e):null,I=v&&(v.sentAt<c||!rd(v.html,o()))?v:null;if(I){const p=Pn(P,I.sentAt);if(p){nt(e),u=!0,M({revision:p,phase:"found"});return}E(I);return}u=!0,M({revision:Pn(P),phase:"normal"})},w=P=>{f||(a?.(P),g.historyLoaded||(m({historyLoaded:!1,latestRevisionAt:void 0}),N()),!d&&M({revision:null,phase:"normal"}))},O=()=>t(e).then(b).catch(w);let x,A=!1;const N=()=>{A||d||f||(A=!0,x=setTimeout(()=>{x=void 0,!f&&!g.historyLoaded&&O()},Qc))},k=()=>{f||(m({historyLoaded:!1,latestRevisionAt:void 0}),M({revision:null,phase:"normal"}))};return r?r().then(P=>P?O():k()):O(),{verdict:()=>y,confirmVerdict(P){const v=T;T=void 0,P&&v!==void 0&&!f&&D(v)},dispose(){f=!0,x!==void 0&&(clearTimeout(x),x=void 0),B()}}}function sd({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:o,onFacts:s}){let i=null;const a=od({emailId:r,readAutosave:c=>e.readAutosave(c),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:o,onFacts:s,onLate:({revision:c,phase:d})=>{const u=No(c);return i?.(u)??!1},onError:c=>{c instanceof Error&&c.message}});return{id:"recovery",load:()=>a.verdict().then(({revision:c})=>No(c)),loaded(c){a.confirmVerdict(c)},watch(c){return i=c,()=>{i=null,a.dispose()}}}}function Yo(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Xc(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 id(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const o=Date.now(),s=await t.updateEmail(n,r);return await e.updateEmail(n,r),(Go(n)?.sentAt??Number.POSITIVE_INFINITY)<=o&&nt(n),s}}}var Wo=l.createIdentifier$1("CurrentUser"),qo={};function On(e){return e.getOrCreateInstance(Wo,()=>ae(qo))}function Ko(e){return e?.getInstance(Wo)?.get()??qo}var zo=l.createIdentifier$1("HeadlessMode");function Xo(e){return e.getOrCreateInstance(zo,()=>ae(!1))}function ad(e){return e?.getInstance(zo)?.get()??!1}var ld=l.createIdentifier$1("HiddenMount");function cd(e){return e.getOrCreateInstance(ld,()=>ae(!1))}function dd(e){if(!e)return!1;try{return!!l.decodeJwt(e).data?.act_as}catch{return!1}}function ud(e){return dd(e?.getInstance(l.COOKIE_MANAGER_ID)?.get(l.APP_COOKIES.em_token))}function Jo(e){return e?.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function Pt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function fd(e,t){return t.modeDefaults(Pt(e,t.fallbackMode))}function Qo(e,t){const n=Pt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Zo(e,t){const n=Pt(e,t),r=e.user?.advancedConfigs?.[n],o=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...o}}function pd(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function hd(e){return l.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function md(e){return l.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function gd(e){return l.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function vd(e){return l.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Ed(e,t){return[e.base,fd(e,t),e.profile,e.serverSide,Qo(e,t.fallbackMode),e.local,e.user,Zo(e,t.fallbackMode)]}function Rn(e,t){const n=Ed(e,t),r=l.mergeShallowConfigLayers(n),o=pd(n);o!==void 0&&(r.fileManager=o);const s=hd(n);s!==void 0&&(r.resourceProxy=s);const i=md(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const a=gd(n);a!==void 0&&(r.backendProxy=a);const c=vd(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function _d(e,t,n){const r=Qo(e,n),o=Zo(e,n);return l.pickKey([o,e.user,r,e.serverSide],t)}var bd=1.5;function yd(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<=bd*e.autosaveTimeoutMs?"none":"revision"}var j_=5,U_=3;function Sd(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:o}=e,s=e.readFailures??(()=>0),i=e.readFailureRetryable??(()=>!0);let a;const c=b=>a!==void 0&&a.version===b.get().version?s()-a.failuresAtStart:0,d=b=>{const w=c(b);if(w<=0)return!1;const O=n().retryMaxAttempts??5;return!i()||w>O},u=()=>{const{autosaveTimeoutMs:b,retryIntervalMs:w}=n(),O=t();return O!==void 0&&c(O)>0&&w!==void 0&&w>0?w:b},f=b=>b.isNew()&&s()>=3,h=()=>{const b=t();if(!b||b.isDisposed()||d(b))return"none";const{latestRevisionAt:w,snapshotVersion:O,...x}=n(),A=Date.now(),N=yd({...x,isDirty:b.isDirty(),isNew:b.isNew(),isReady:b.isReady(),latestRevisionAgeMs:w!=null&&w<=A?A-w:void 0,isSnapshotSent:O!=null&&O===b.get().version});return N==="create"&&f(b)?"none":N},g=()=>{const b=t();if(!b||b.isDisposed()||f(b)||d(b)||n().isHeadless)return!1;if(!b.isDirty())return b.isNew();const{snapshotVersion:w}=n();return!(w!=null&&w===b.get().version)};let _,y,m,T,D=!1;const B=()=>{y=void 0;const b=t();if(!b||b.isDisposed())return;if(b.get().docId!==_){M();return}const w=h();w!=="none"&&a?.version!==b.get().version&&(a={version:b.get().version,failuresAtStart:s()}),w==="create"?r():w==="revision"?o():g()&&(_=b.get().docId,y=setTimeout(B,u()))},M=()=>{const b=t();D||!b||y!==void 0||h()==="none"&&!g()||(_=b.get().docId,y=setTimeout(B,u()))},C=b=>{b.source==="user"&&y!==void 0&&(clearTimeout(y),y=void 0),M()},E=()=>{const b=t();b!==m&&(T?.(),m=b,a=void 0,T=b?.subscribe(C),y!==void 0&&(clearTimeout(y),y=void 0))};return E(),M(),{refresh:()=>{D||(E(),M())},stop:()=>{D=!0,T?.(),T=void 0,m=void 0,y!==void 0&&(clearTimeout(y),y=void 0)}}}var es=l.createIdentifier$1("documentSession.autosaveUiFacts"),ts={isUserBusy:!1,saveContext:{}};function wd(e){return e.getOrCreateInstance(es,()=>ae(ts))}function kn(e){return e?.getInstance(es)?.get()??ts}function ns(e){return kn(e).saveContext.fallbackTitle||"Untitled email."}var Id=1e4,Td=3e4;function Cd(e,t){const n=u=>{const f=e.getInstance(l.CONFIG_SOURCE_ID)?.layers?.(),h=f?_d(f,u):void 0;return typeof h=="number"&&h>=0?h:void 0},r=()=>{const u=t.current(),f=u?.get().serverId??void 0,h=Q(t.sessionKey()),g=t.recoveryFacts(),_=g?.emailId===f?g:void 0,y=t.revisionFacts(),m=_?.latestRevisionAt,T=y?.lastRevisionAt,D=Ko(e).profile;return{isInited:h||u?.get().attributes.is_inited===!0,isEnabled:!!D?.autosaves&&!ud(e),isHistoryLoaded:_?.historyLoaded===!0,isUserBusy:kn(e).isUserBusy,isHeadless:ad(e),autosaveTimeoutMs:Jo(e).autosaveTimeout||Id,latestRevisionAt:m!==void 0||T!==void 0?Math.max(m??0,T??0):void 0,snapshotVersion:y?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??Td,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},o=()=>{const u=kn(e).saveContext;return{...u,project:u.project??t.current()?.get().attributes.project,fallbackTitle:ns(e)}},s=Sd({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>cc(t.saveState().error),onCreate:()=>{Q(t.sessionKey())||t.save("materialize",o())},onRevision:()=>{t.save("snapshot",{project:o().project})}}),i=t.subscribe(s.refresh),a=On(e).watch(()=>s.refresh()),c=wd(e).watch(()=>s.refresh()),d=Xo(e).watch(()=>s.refresh());return()=>{i(),a.dispose(),c.dispose(),d.dispose(),s.stop()}}var rs=12e3;function se(e){return e.getOrCreateInstance(gn,()=>{const t=jc({resolveAdapters:(r,o)=>Pd(r,e,o),resolveWritePort:()=>os(e),resolveHistoryPort:r=>Q(r)?is(e):ss(e),resolveTerms:()=>Wc(e),canEdit:r=>Pl(e,r),notifyBeforeSave:xl(e),timeoutMs:rs,onAdapterError:(r,o)=>{o instanceof Error&&o.message;const s=Hc(o),i=Uc(o);Ze(o,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(s),network_failure:String(i)},level:s||i?"warning":"error"})},onTimeout:r=>{}}),n=Cd(e,t);return e.getInstance(l.DISPOSABLE_ID)?.addDispose(n),t})}function Ae(e){return e?.getInstance(gn)}function os(e){const t=Vc(e);return t?Nn(e)?id(t,Ce(e).email(e)):t:Ce(e).email(e)}function Ad(e){return Vo(e)!==void 0||Uo(e)}function ss(e){const t=Vo(e);return t?Nn(e)?(J("port:history:server-backed"),Yo(t,Ce(e).history(e))):(J("port:history:integrator"),t):(J("port:history:rest (порт не зарегистрирован)"),Ce(e).history(e))}function is(e){const t=$o(e);return t?Nn(e)?(J("port:block-history:server-backed"),Yo(t,Ce(e).blockHistory(e))):(J("port:block-history:integrator"),t):(J("port:block-history:rest (порт не зарегистрирован)"),Ce(e).blockHistory(e))}function Dd(e){return $o(e)!==void 0||Uo(e)}function Nn(e){return ao(e)}function Pd({email:e,patch:t,serverId:n,key:r},o,s){const i=[];e?i.push({id:"rest",load:()=>Ro(e),required:!0}):n&&i.push($c(os(o),n)),t&&i.push({id:"plugin",load:()=>ko(t)});const a=Q(r);return Fl(n)&&(a?Dd(o):Ad(o))&&i.push(sd({port:a?is(o):ss(o),revisionServiceEnabled:ao(o),...!a&&Ol(o)?{isHistoryAvailable:()=>Rl(o)}:{},emailId:n,readShownContent:()=>s.readShownContent(),onFacts:c=>s.publishRecoveryFacts(c)})),i}function ie(e){return e.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}var as=new WeakMap,Ln=new WeakMap;function fe(e){return as.get(e)??0}function Ot(e,t){let n=Ln.get(e);return n||(n=new Set,Ln.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Od(e){as.set(e,fe(e)+1),Ln.get(e)?.forEach(t=>t())}function Rd(e){const t=se(e),n=ie(e).addListener(l.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{Ue(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function kd(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Nd(e){const t=e.fetchImpl??((s,i)=>fetch(s,i)),n=e.pageHost??(()=>window.location.hostname),r=new Set,o=s=>{try{const i=new URL(s,window.location.href);return i.protocol!=="https:"&&i.protocol!=="http:"?!1:i.hostname===n()||e.sourceHosts().includes(i.hostname)}catch{return!1}};return{accepts:o,async load(s){if(!o(s))return;const i=!r.has(s);r.add(s);try{const a=await t(s,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!a.ok)return;const c=await a.blob();return kd(c)?c:void 0}catch{return}}}}var De={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Ld(e){const t={maxBytes:e.maxBytes??De.maxBytes,maxImageBytes:e.maxImageBytes??De.maxImageBytes,ttlMs:e.ttlMs??De.ttlMs},n=e.now??(()=>Date.now()),r=new Map,o=new Map,s={hits:0,loads:0,failures:0};let i=0;const a=f=>{const h=r.get(f);h&&(i-=h.bytes,r.delete(f))},c=f=>t.ttlMs<=0||n()-f.storedAt<t.ttlMs,d=()=>{if(i<=t.maxBytes)return;const f=[...r.entries()].sort((h,g)=>h[1].usedAt-g[1].usedAt);for(const[h]of f){if(i<=t.maxBytes)return;a(h)}},u=(f,h)=>{h.size>t.maxImageBytes||(r.set(f,{blob:h,bytes:h.size,storedAt:n(),usedAt:n()}),i+=h.size,d())};return{async get(f){const h=r.get(f);if(h&&c(h))return h.usedAt=n(),s.hits+=1,h.blob;h&&a(f);const g=o.get(f);if(g!==void 0)return g;s.loads+=1;const _=(async()=>{try{const y=await e.load(f);return y?u(f,y):s.failures+=1,y}catch{s.failures+=1;return}finally{o.delete(f)}})();return o.set(f,_),_},forget(f){a(f),o.delete(f)},configure(f){Object.assign(t,{maxBytes:f.maxBytes??t.maxBytes,maxImageBytes:f.maxImageBytes??t.maxImageBytes,ttlMs:f.ttlMs??t.ttlMs});for(const[h,g]of r)g.bytes>t.maxImageBytes&&a(h);d()},clear(){r.clear(),o.clear(),i=0},stats(){return{entries:r.size,bytes:i,...s}}}}var Md=["emcdn.ru","scr.emcdn.ru"];function xd(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 Fd(e,t){const n=(r,o)=>{const s=new Set(o?t:[]);for(const i of r){const a=xd(i);a&&s.add(a)}return[...s]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Bd(e){const t=e??{},n=t.isPlugin!==!0?Md:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...De};const o=r===!0||r===void 0?{}:r;return{enabled:o.enabled!==!1,sourceHosts:Fd(o.sourceHosts,n),maxBytes:o.maxBytes??De.maxBytes,maxImageBytes:o.maxImageBytes??De.maxImageBytes,ttlMs:o.ttlMs??De.ttlMs}}function jd(e){const t=ie(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=()=>Bd({...n?.get(),isPlugin:!0});let o=r();const s=Nd({sourceHosts:()=>o.sourceHosts}),i=Ld({load:y=>s.load(y),maxBytes:o.maxBytes,maxImageBytes:o.maxImageBytes,ttlMs:o.ttlMs}),a=()=>{t.send(l.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:o.enabled,sourceHosts:[...o.sourceHosts]})},c=t.onInit(()=>a()),d=n?.watch(()=>{const y=r(),m=JSON.stringify(y)!==JSON.stringify(o);o=y,i.configure(y),y.enabled||i.clear(),m&&t.isInited()&&a()}),u={asked:0,served:0,refused:0},f=[],h=(y,m)=>(u.refused+=1,f.push({url:y,reason:m}),f.length>20&&f.shift(),{refused:!0}),g=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:o,counters:{...u},refusals:[...f],store:i.stats()})}),_=t.addListenerAsync(l.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async y=>{const m=y?.url??"";if(u.asked+=1,!o.enabled||!m)return h(m,"disabled");if(!s.accepts(m))return h(m,"host");y.fresh&&i.forget(m);const T=await i.get(m);return T?(u.served+=1,{blob:T}):h(m,"load-failed")});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),d?.dispose(),_.dispose(),i.clear(),delete g.__emmCanvasImages__})}var Ud=2e3;function Hd(e){const t=ie(e),n=new Map,r=()=>{const i=t.getTarget();if(!i||t.hasPort(i))return;clearTimeout(n.get(i));const a=new MessageChannel;let c=!1,d=!1;const u=h=>{h.data?.operationId==="em:port-ready"&&(c=!0,a.port1.removeEventListener("message",u),d&&t.resumePort(i),t.drainWindow(i))};a.port1.addEventListener("message",u),t.sendPort(i,a.port2),t.usePort(a.port1,!1,i);const f=setTimeout(()=>{n.get(i)===f&&n.delete(i),!(c||!t.hasPort(i,a.port1))&&(Ze(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d=!0,t.holdPort(i))},Ud);n.set(i,f)},o=Object.assign(globalThis,{__emmCanvasPort__:()=>{const i=t.getTarget();return{usesPort:t.usesPort,windowDrained:i?t.isWindowDrained(i):!1}}}),s=t.onInit(()=>r());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n.values())clearTimeout(i);s.dispose(),delete o.__emmCanvasPort__})}var $d=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Vd(e){return $d.test(e)||e.indexOf("//")===0}function Rt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function Gd(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function ls(e,t){const n=e==null||e===""?"./":String(e);if(Vd(n))return Rt(n);const r=t??Gd();if(!r)return Rt(n);try{return Rt(new URL(n,r).href)}catch{return Rt(n)}}function Yd(){return typeof __emailmaker__<"u"&&__emailmaker__?.publicPath?ls(__emailmaker__.publicPath):ls("/")}var Wd=()=>"",qd=()=>"fec11667";function Kd(e,t){const n=new URL(e);return n.hostname!=="localhost"||t.hostname==="localhost"?e:(n.hostname=t.hostname,n.toString())}function cs(e){const t=e?"iframe-eblock":"iframe",n=Wd();if(n){const s=Kd(n,window.location).replace(/\/?$/,"/");return eo(`${s}${t}.html`,Je())}const r=qd(),o=`${Yd().replace(/\/?$/,"/")}iframe/`;return eo(`${o}${t}${r?`.${r}`:""}.html`,Je())}var ds="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Mn(e){return/^file:/i.test(String(e||"").trim())}function zd(e){return Mn(e)?`${ds} allow-same-origin`:ds}var H_="em:module-body",Xd="em:module-body-ack";function Jd(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 xn(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 Qd(e){const t=xn(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function Zd(e,t){const n=xn(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(o=>e[o]?.file).filter(o=>!!o):[]}function eu(e,t){const n=xn(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const o=new Set([r]),s=[r],i=[];for(;s.length>0;)for(const a of e[s.shift()]??[])o.has(a)||(o.add(a),i.push(a),s.push(a));return i}var tu=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function nu(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&tu.test(t[t.length-2])}async function ru(e,t){const n=nu(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 ou(e){const t=new Map,n=(r,o)=>{const s=Jd(r,e.canvasSrc,e.origin);if(!s)return;const i=t.get(s);if(i!==void 0)return i;const a=e.fetchBody(s,o);return t.set(s,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,o){for(const s of r)n(s,o)},reset(){t.clear()},get size(){return t.size}}}var ve;function su(e){try{return Mn(new URL(e,window.location.href).href)}catch{return Mn(window.location.href)}}function us(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof __emailmaker__<"u"&&__emailmaker__?.preload?.canvasCrossOrigin===!0}var iu=()=>Promise.resolve(void 0);function fs(){const e=cs(!1);if(!su(e)){if(!ve||ve.canvasSrc!==e){const t=us(e)?ru:iu;ve={canvasSrc:e,store:ou({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return ve.store}}async function au(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(Zd(o,e))}catch{}}function Fn(e){const t=fs();if(!t||!ve||ve.warmed||!us(ve.canvasSrc))return;ve.warmed=!0;const{canvasSrc:n}=ve,r=Qd(n);r&&t.warm([r],e);const o={"js/iframe-eblock.js":["js/elMarkupHelper.Dv3AYDYP.js"],"js/iframe.js":["js/elMarkupHelper.Dv3AYDYP.js"],"js/darkreader.CLd5EML2.js":[],"js/elMarkupHelper.Dv3AYDYP.js":[],"js/rules.CnnzdMsj.js":[],"js/typograf.all.Mun9CrLC.js":[]};o?t.warm(eu(o,n),e):au(n,s=>t.warm(s,e))}function lu(e){const t=fs();if(!t)return;Fn();const n=r=>{const o=r.data;if(!o||o.operationId!=="em:module-body"||!o.result)return;const s=r.source;s&&(s.postMessage({operationId:Xd,for:o.result},"*"),t.take(o.data?.url??"").then(i=>{s.postMessage({operationId:o.result,data:i??null},"*")}))};window.addEventListener("message",n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",n)})}var $e=/<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,cu=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Ve=/<style\b[^>]*>[\s\S]*?<\/style>/gi,ps=/display:\s*none\s*!important/gi,du=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,uu=/\s*height\s*:\s*100%\s*!important\s*;?/gi,fu=/height\s*:\s*100%\s*!important/i,pu=[".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 hu(e){return ps.lastIndex=0,(e.match(ps)||[]).length}function hs(e){const t=e.trim(),n=hu(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=pu.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 mu(e){Ve.lastIndex=0;for(const t of e.matchAll(Ve))if(hs(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function gu(e){let t=!1;return Ve.lastIndex=0,{html:e.replace(Ve,n=>hs(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function vu(e){return $e.lastIndex=0,$e.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||mu(e)}function Eu(e){if(!vu(e))return{html:e,found:!1};let t=!1,n=e;$e.lastIndex=0,$e.test(n)&&($e.lastIndex=0,n=n.replace($e,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(cu,""),t=!0);const r=gu(n);return n=r.html,t=t||r.found,{html:n,found:t}}function _u(e){return!e||!fu.test(e)?e:(Ve.lastIndex=0,e.replace(Ve,t=>t.replace(du,(n,r,o,s)=>`${r}${o.replace(uu,"")}${s}`)))}function ms(e){const t=Eu(e.replaceAll(`\r
|
|
2107
|
+
`)}function kn(e,t){return Tn(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function cd({emailId:e,readAutosave:t,revisionServiceEnabled:n,readShownContent:r,onFacts:o,onLate:s,onError:i,pageLoadTs:a=ad()}){let c=null,d=!1,u=!1,p=0,f={emailId:e,historyLoaded:!1,isRecovering:!1},g=null;const y=new Promise(T=>{g=T}),_=T=>{f={...f,...T},o(f)};let m;const I=T=>{p+=1,_({applied:{phase:T,seq:p}})},P=()=>{c?.timer&&clearTimeout(c.timer),c=null},x=T=>{if(!u){if(g){const R=g;g=null,R(T),m=T.revision?T.phase:void 0;return}s(T)&&T.revision&&I(T.phase)}},L=()=>{if(!c||u)return;const T=c.phase==="fast",R=T?nd:sd,M=T?od:id;c.timer=setTimeout(()=>{const v=c;if(!(!v||u)){if(v.attempts+=1,w(),T&&v.attempts>=M){const{pending:b}=v;rt(e),_({isRecovering:!1}),x({revision:{html:b.html,common_styles:b.common_styles,subject:b.subject,preheader:b.preheader},phase:"timeout"}),d=!0,v.phase="bg",v.attempts=0,L();return}if(!T&&v.attempts>=M){rt(e),P(),_({isRecovering:!1}),d=!0;return}L()}},R),c.timer.unref?.()},C=T=>{c={phase:"fast",attempts:0,pending:T,timer:null},_({isRecovering:!0}),L()},E=T=>{if(u)return;if(_({historyLoaded:!0,latestRevisionAt:T.latestAt!==void 0&&Number.isFinite(T.latestAt)?T.latestAt:void 0}),n&&c){const v=kn(T,c.pending.sentAt);if(!v)return;const b=c.phase==="fast"?"found":"bg";rt(e),P(),_({isRecovering:!1}),d=!0,x({revision:v,phase:b});return}if(d)return;const R=n?qo(e):null,M=R&&(R.sentAt<a||!ld(R.html,r()))?R:null;if(M){const v=kn(T,M.sentAt);if(v){rt(e),d=!0,x({revision:v,phase:"found"});return}C(M);return}d=!0,x({revision:kn(T),phase:"normal"})},S=T=>{u||(i?.(T),f.historyLoaded||(_({historyLoaded:!1,latestRevisionAt:void 0}),A()),!c&&x({revision:null,phase:"normal"}))},w=()=>t(e).then(E).catch(S);let O,N=!1;const A=()=>{N||c||u||(N=!0,O=setTimeout(()=>{O=void 0,!u&&!f.historyLoaded&&w()},rd))};return w(),{verdict:()=>y,confirmVerdict(T){const R=m;m=void 0,T&&R!==void 0&&!u&&I(R)},dispose(){u=!0,O!==void 0&&(clearTimeout(O),O=void 0),P()}}}function dd({port:e,revisionServiceEnabled:t,emailId:n,readShownContent:r,onFacts:o}){let s=null;const i=cd({emailId:n,readAutosave:a=>e.readAutosave(a),revisionServiceEnabled:t,readShownContent:r,onFacts:o,onLate:({revision:a,phase:c})=>{const d=xo(a);return s?.(d)??!1},onError:a=>{a instanceof Error&&a.message}});return{id:"recovery",load:()=>i.verdict().then(({revision:a})=>xo(a)),loaded(a){i.confirmVerdict(a)},watch(a){return s=a,()=>{s=null,i.dispose()}}}}function Ko(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){td(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 ud(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const o=Date.now(),s=await t.updateEmail(n,r);return await e.updateEmail(n,r),(qo(n)?.sentAt??Number.POSITIVE_INFINITY)<=o&&rt(n),s}}}var zo=l.createIdentifier$1("CurrentUser"),Xo={};function Nn(e){return e.getOrCreateInstance(zo,()=>ae(Xo))}function Jo(e){return e?.getInstance(zo)?.get()??Xo}var Qo=l.createIdentifier$1("HeadlessMode");function Zo(e){return e.getOrCreateInstance(Qo,()=>ae(!1))}function fd(e){return e?.getInstance(Qo)?.get()??!1}var pd=l.createIdentifier$1("HiddenMount");function hd(e){return e.getOrCreateInstance(pd,()=>ae(!1))}function md(e){if(!e)return!1;try{return!!l.decodeJwt(e).data?.act_as}catch{return!1}}function gd(e){return md(e?.getInstance(l.COOKIE_MANAGER_ID)?.get(l.APP_COOKIES.em_token))}function es(e){return e?.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function Nt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function vd(e,t){return t.modeDefaults(Nt(e,t.fallbackMode))}function ts(e,t){const n=Nt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function ns(e,t){const n=Nt(e,t),r=e.user?.advancedConfigs?.[n],o=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...o}}function Ed(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function _d(e){return l.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function bd(e){return l.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function yd(e){return l.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function Sd(e){return l.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function wd(e,t){return[e.base,vd(e,t),e.profile,e.serverSide,ts(e,t.fallbackMode),e.local,e.user,ns(e,t.fallbackMode)]}function Ln(e,t){const n=wd(e,t),r=l.mergeShallowConfigLayers(n),o=Ed(n);o!==void 0&&(r.fileManager=o);const s=_d(n);s!==void 0&&(r.resourceProxy=s);const i=bd(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const a=yd(n);a!==void 0&&(r.backendProxy=a);const c=Sd(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function Id(e,t,n){const r=ts(e,n),o=ns(e,n);return l.pickKey([o,e.user,r,e.serverSide],t)}var Td=1.5;function Cd(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<=Td*e.autosaveTimeoutMs?"none":"revision"}var $_=5,V_=3;function Ad(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:o}=e,s=e.readFailures??(()=>0),i=e.readFailureRetryable??(()=>!0);let a;const c=S=>a!==void 0&&a.version===S.get().version?s()-a.failuresAtStart:0,d=S=>{const w=c(S);if(w<=0)return!1;const O=n().retryMaxAttempts??5;return!i()||w>O},u=()=>{const{autosaveTimeoutMs:S,retryIntervalMs:w}=n(),O=t();return O!==void 0&&c(O)>0&&w!==void 0&&w>0?w:S},p=S=>S.isNew()&&s()>=3,f=()=>{const S=t();if(!S||S.isDisposed()||d(S))return"none";const{latestRevisionAt:w,snapshotVersion:O,...N}=n(),A=Date.now(),T=Cd({...N,isDirty:S.isDirty(),isNew:S.isNew(),isReady:S.isReady(),latestRevisionAgeMs:w!=null&&w<=A?A-w:void 0,isSnapshotSent:O!=null&&O===S.get().version});return T==="create"&&p(S)?"none":T},g=()=>{const S=t();if(!S||S.isDisposed()||p(S)||d(S)||n().isHeadless)return!1;if(!S.isDirty())return S.isNew();const{snapshotVersion:w}=n();return!(w!=null&&w===S.get().version)};let y,_,m,I,P=!1;const x=()=>{_=void 0;const S=t();if(!S||S.isDisposed())return;if(S.get().docId!==y){L();return}const w=f();w!=="none"&&a?.version!==S.get().version&&(a={version:S.get().version,failuresAtStart:s()}),w==="create"?r():w==="revision"?o():g()&&(y=S.get().docId,_=setTimeout(x,u()))},L=()=>{const S=t();P||!S||_!==void 0||f()==="none"&&!g()||(y=S.get().docId,_=setTimeout(x,u()))},C=S=>{S.source==="user"&&_!==void 0&&(clearTimeout(_),_=void 0),L()},E=()=>{const S=t();S!==m&&(I?.(),m=S,a=void 0,I=S?.subscribe(C),_!==void 0&&(clearTimeout(_),_=void 0))};return E(),L(),{refresh:()=>{P||(E(),L())},stop:()=>{P=!0,I?.(),I=void 0,m=void 0,_!==void 0&&(clearTimeout(_),_=void 0)}}}var rs=l.createIdentifier$1("documentSession.autosaveUiFacts"),os={isUserBusy:!1,saveContext:{}};function Dd(e){return e.getOrCreateInstance(rs,()=>ae(os))}function Mn(e){return e?.getInstance(rs)?.get()??os}function ss(e){return Mn(e).saveContext.fallbackTitle||"Untitled email."}var Pd=1e4,Od=3e4;function Rd(e,t){const n=u=>{const p=e.getInstance(l.CONFIG_SOURCE_ID)?.layers?.(),f=p?Id(p,u):void 0;return typeof f=="number"&&f>=0?f:void 0},r=()=>{const u=t.current(),p=u?.get().serverId??void 0,f=Q(t.sessionKey()),g=t.recoveryFacts(),y=g?.emailId===p?g:void 0,_=t.revisionFacts(),m=y?.latestRevisionAt,I=_?.lastRevisionAt,P=Jo(e).profile;return{isInited:f||u?.get().attributes.is_inited===!0,isEnabled:!!P?.autosaves&&!gd(e),isHistoryLoaded:y?.historyLoaded===!0,isUserBusy:Mn(e).isUserBusy,isHeadless:fd(e),autosaveTimeoutMs:es(e).autosaveTimeout||Pd,latestRevisionAt:m!==void 0||I!==void 0?Math.max(m??0,I??0):void 0,snapshotVersion:_?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??Od,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},o=()=>{const u=Mn(e).saveContext;return{...u,project:u.project??t.current()?.get().attributes.project,fallbackTitle:ss(e)}},s=Ad({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>pc(t.saveState().error),onCreate:()=>{Q(t.sessionKey())||t.save("materialize",o())},onRevision:()=>{t.save("snapshot",{project:o().project})}}),i=t.subscribe(s.refresh),a=Nn(e).watch(()=>s.refresh()),c=Dd(e).watch(()=>s.refresh()),d=Zo(e).watch(()=>s.refresh());return()=>{i(),a.dispose(),c.dispose(),d.dispose(),s.stop()}}var is=12e3;function se(e){return e.getOrCreateInstance(En,()=>{const t=Gc({resolveAdapters:(r,o)=>Ld(r,e,o),resolveWritePort:()=>as(e),resolveHistoryPort:r=>Q(r)?cs(e):ls(e),resolveTerms:()=>Jc(e),canEdit:r=>Pl(e,r),notifyBeforeSave:Ll(e),awaitCanvasSynced:Fl(e),savedEchoForm:r=>{const o=ye(e);return o.toEditorForm(o.toOutputForm(r))},timeoutMs:is,onAdapterError:(r,o)=>{o instanceof Error&&o.message;const s=Wc(o),i=Yc(o);tt(o,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(s),network_failure:String(i)},level:s||i?"warning":"error"})},onTimeout:r=>{}}),n=Rd(e,t);return e.getInstance(l.DISPOSABLE_ID)?.addDispose(n),t})}function Re(e){return e?.getInstance(En)}function as(e){const t=Kc(e);return t?xn(e)?ud(t,Oe(e).email(e)):t:Oe(e).email(e)}function kd(e){return Wo(e)!==void 0||Vo(e)}function ls(e){const t=Wo(e);return t?xn(e)?(J("port:history:server-backed"),Ko(t,Oe(e).history(e))):(J("port:history:integrator"),t):(J("port:history:rest (порт не зарегистрирован)"),Oe(e).history(e))}function cs(e){const t=Yo(e);return t?xn(e)?(J("port:block-history:server-backed"),Ko(t,Oe(e).blockHistory(e))):(J("port:block-history:integrator"),t):(J("port:block-history:rest (порт не зарегистрирован)"),Oe(e).blockHistory(e))}function Nd(e){return Yo(e)!==void 0||Vo(e)}function xn(e){return co(e)}function Ld({email:e,patch:t,serverId:n,key:r},o,s){const i=[];e?i.push({id:"rest",load:()=>Lo(e),required:!0}):n&&i.push(qc(as(o),n)),t&&i.push({id:"plugin",load:()=>Mo(t)});const a=Q(r);return Bl(n)&&(a?Nd(o):kd(o))&&i.push(dd({port:a?cs(o):ls(o),revisionServiceEnabled:co(o),emailId:n,readShownContent:()=>s.readShownContent(),onFacts:c=>s.publishRecoveryFacts(c)})),i}function Md(e){const t=se(e),n=re(e).addListener(l.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{Ve(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function xd(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Fd(e){const t=e.fetchImpl??((s,i)=>fetch(s,i)),n=e.pageHost??(()=>window.location.hostname),r=new Set,o=s=>{try{const i=new URL(s,window.location.href);return i.protocol!=="https:"&&i.protocol!=="http:"?!1:i.hostname===n()||e.sourceHosts().includes(i.hostname)}catch{return!1}};return{accepts:o,async load(s){if(!o(s))return;const i=!r.has(s);r.add(s);try{const a=await t(s,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!a.ok)return;const c=await a.blob();return xd(c)?c:void 0}catch{return}}}}var ke={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Bd(e){const t={maxBytes:e.maxBytes??ke.maxBytes,maxImageBytes:e.maxImageBytes??ke.maxImageBytes,ttlMs:e.ttlMs??ke.ttlMs},n=e.now??(()=>Date.now()),r=new Map,o=new Map,s={hits:0,loads:0,failures:0};let i=0;const a=p=>{const f=r.get(p);f&&(i-=f.bytes,r.delete(p))},c=p=>t.ttlMs<=0||n()-p.storedAt<t.ttlMs,d=()=>{if(i<=t.maxBytes)return;const p=[...r.entries()].sort((f,g)=>f[1].usedAt-g[1].usedAt);for(const[f]of p){if(i<=t.maxBytes)return;a(f)}},u=(p,f)=>{f.size>t.maxImageBytes||(r.set(p,{blob:f,bytes:f.size,storedAt:n(),usedAt:n()}),i+=f.size,d())};return{async get(p){const f=r.get(p);if(f&&c(f))return f.usedAt=n(),s.hits+=1,f.blob;f&&a(p);const g=o.get(p);if(g!==void 0)return g;s.loads+=1;const y=(async()=>{try{const _=await e.load(p);return _?u(p,_):s.failures+=1,_}catch{s.failures+=1;return}finally{o.delete(p)}})();return o.set(p,y),y},forget(p){a(p),o.delete(p)},configure(p){Object.assign(t,{maxBytes:p.maxBytes??t.maxBytes,maxImageBytes:p.maxImageBytes??t.maxImageBytes,ttlMs:p.ttlMs??t.ttlMs});for(const[f,g]of r)g.bytes>t.maxImageBytes&&a(f);d()},clear(){r.clear(),o.clear(),i=0},stats(){return{entries:r.size,bytes:i,...s}}}}var jd=["emcdn.ru","scr.emcdn.ru"];function Ud(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 Hd(e,t){const n=(r,o)=>{const s=new Set(o?t:[]);for(const i of r){const a=Ud(i);a&&s.add(a)}return[...s]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function $d(e){const t=e??{},n=t.isPlugin!==!0?jd:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...ke};const o=r===!0||r===void 0?{}:r;return{enabled:o.enabled!==!1,sourceHosts:Hd(o.sourceHosts,n),maxBytes:o.maxBytes??ke.maxBytes,maxImageBytes:o.maxImageBytes??ke.maxImageBytes,ttlMs:o.ttlMs??ke.ttlMs}}function Vd(e){const t=re(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=()=>$d({...n?.get(),isPlugin:!0});let o=r();const s=Fd({sourceHosts:()=>o.sourceHosts}),i=Bd({load:_=>s.load(_),maxBytes:o.maxBytes,maxImageBytes:o.maxImageBytes,ttlMs:o.ttlMs}),a=()=>{t.send(l.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:o.enabled,sourceHosts:[...o.sourceHosts]})},c=t.onInit(()=>a()),d=n?.watch(()=>{const _=r(),m=JSON.stringify(_)!==JSON.stringify(o);o=_,i.configure(_),_.enabled||i.clear(),m&&t.isInited()&&a()}),u={asked:0,served:0,refused:0},p=[],f=(_,m)=>(u.refused+=1,p.push({url:_,reason:m}),p.length>20&&p.shift(),{refused:!0}),g=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:o,counters:{...u},refusals:[...p],store:i.stats()})}),y=t.addListenerAsync(l.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async _=>{const m=_?.url??"";if(u.asked+=1,!o.enabled||!m)return f(m,"disabled");if(!s.accepts(m))return f(m,"host");_.fresh&&i.forget(m);const I=await i.get(m);return I?(u.served+=1,{blob:I}):f(m,"load-failed")});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),d?.dispose(),y.dispose(),i.clear(),delete g.__emmCanvasImages__})}var Gd=2e3;function Yd(e){const t=re(e),n=new Map,r=()=>{const i=t.getTarget();if(!i||t.hasPort(i))return;clearTimeout(n.get(i));const a=new MessageChannel;let c=!1,d=!1;const u=f=>{f.data?.operationId==="em:port-ready"&&(c=!0,a.port1.removeEventListener("message",u),d&&t.resumePort(i),t.drainWindow(i))};a.port1.addEventListener("message",u),t.sendPort(i,a.port2),t.usePort(a.port1,!1,i);const p=setTimeout(()=>{n.get(i)===p&&n.delete(i),!(c||!t.hasPort(i,a.port1))&&(tt(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d=!0,t.holdPort(i))},Gd);n.set(i,p)},o=Object.assign(globalThis,{__emmCanvasPort__:()=>{const i=t.getTarget();return{usesPort:t.usesPort,windowDrained:i?t.isWindowDrained(i):!1}}}),s=t.onInit(()=>r());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n.values())clearTimeout(i);s.dispose(),delete o.__emmCanvasPort__})}var Wd=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function qd(e){return Wd.test(e)||e.indexOf("//")===0}function Lt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function Kd(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function ds(e,t){const n=e==null||e===""?"./":String(e);if(qd(n))return Lt(n);const r=t??Kd();if(!r)return Lt(n);try{return Lt(new URL(n,r).href)}catch{return Lt(n)}}function zd(){return typeof __emailmaker__<"u"&&__emailmaker__?.publicPath?ds(__emailmaker__.publicPath):ds("/")}var Xd=()=>"",Jd=()=>"8c2b05d7";function Qd(e,t){const n=new URL(e);return n.hostname!=="localhost"||t.hostname==="localhost"?e:(n.hostname=t.hostname,n.toString())}function us(e){const t=e?"iframe-eblock":"iframe",n=Xd();if(n){const s=Qd(n,window.location).replace(/\/?$/,"/");return no(`${s}${t}.html`,Ze())}const r=Jd(),o=`${zd().replace(/\/?$/,"/")}iframe/`;return no(`${o}${t}${r?`.${r}`:""}.html`,Ze())}var fs="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Fn(e){return/^file:/i.test(String(e||"").trim())}function Zd(e){return Fn(e)?`${fs} allow-same-origin`:fs}var G_="em:module-body",eu="em:module-body-ack";function tu(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 Bn(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 nu(e){const t=Bn(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function ru(e,t){const n=Bn(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(o=>e[o]?.file).filter(o=>!!o):[]}function ou(e,t){const n=Bn(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const o=new Set([r]),s=[r],i=[];for(;s.length>0;)for(const a of e[s.shift()]??[])o.has(a)||(o.add(a),i.push(a),s.push(a));return i}var su=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function iu(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&su.test(t[t.length-2])}async function au(e,t){const n=iu(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 lu(e){const t=new Map,n=(r,o)=>{const s=tu(r,e.canvasSrc,e.origin);if(!s)return;const i=t.get(s);if(i!==void 0)return i;const a=e.fetchBody(s,o);return t.set(s,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,o){for(const s of r)n(s,o)},reset(){t.clear()},get size(){return t.size}}}var Ee;function cu(e){try{return Fn(new URL(e,window.location.href).href)}catch{return Fn(window.location.href)}}function ps(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof __emailmaker__<"u"&&__emailmaker__?.preload?.canvasCrossOrigin===!0}var du=()=>Promise.resolve(void 0);function hs(){const e=us(!1);if(!cu(e)){if(!Ee||Ee.canvasSrc!==e){const t=ps(e)?au:du;Ee={canvasSrc:e,store:lu({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return Ee.store}}async function uu(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(ru(o,e))}catch{}}function jn(e){const t=hs();if(!t||!Ee||Ee.warmed||!ps(Ee.canvasSrc))return;Ee.warmed=!0;const{canvasSrc:n}=Ee,r=nu(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(ou(o,n),e):uu(n,s=>t.warm(s,e))}function fu(e){const t=hs();if(!t)return;jn();const n=r=>{const o=r.data;if(!o||o.operationId!=="em:module-body"||!o.result)return;const s=r.source;s&&(s.postMessage({operationId:eu,for:o.result},"*"),t.take(o.data?.url??"").then(i=>{s.postMessage({operationId:o.result,data:i??null},"*")}))};window.addEventListener("message",n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",n)})}var Ye=/<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,pu=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,We=/<style\b[^>]*>[\s\S]*?<\/style>/gi,ms=/display:\s*none\s*!important/gi,hu=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,mu=/\s*height\s*:\s*100%\s*!important\s*;?/gi,gu=/height\s*:\s*100%\s*!important/i,vu=[".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 Eu(e){return ms.lastIndex=0,(e.match(ms)||[]).length}function gs(e){const t=e.trim(),n=Eu(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=vu.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 _u(e){We.lastIndex=0;for(const t of e.matchAll(We))if(gs(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function bu(e){let t=!1;return We.lastIndex=0,{html:e.replace(We,n=>gs(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function yu(e){return Ye.lastIndex=0,Ye.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||_u(e)}function Su(e){if(!yu(e))return{html:e,found:!1};let t=!1,n=e;Ye.lastIndex=0,Ye.test(n)&&(Ye.lastIndex=0,n=n.replace(Ye,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(pu,""),t=!0);const r=bu(n);return n=r.html,t=t||r.found,{html:n,found:t}}function wu(e){return!e||!gu.test(e)?e:(We.lastIndex=0,e.replace(We,t=>t.replace(hu,(n,r,o,s)=>`${r}${o.replace(mu,"")}${s}`)))}function vs(e){const t=Su(e.replaceAll(`\r
|
|
2108
2108
|
`,`
|
|
2109
|
-
`));return{html:_u(t.html),hasBrowserExtensionArtifacts:t.found}}function kt(e){return e?.getContent()??""}function gs(e,t){e?.mutate({content:Do(t)},{source:"remote"})}function Nt(e){return l.createIdentifier$1(e)}function re(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter)}function Y(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter).event}function Lt(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var bu=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 yu(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 Su(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(l.throwIfAborted(n),new Promise((r,o)=>{let s=!1,i,a;const c=u=>{s||(s=!0,i!==void 0&&(clearTimeout(i),i=void 0),a?.dispose(),n?.removeEventListener("abort",d),u())},d=()=>{c(()=>o(l.createAbortError(n?.reason)))};if(a=e.onInit(()=>{e.isInited()&&e.getTarget()&&c(()=>r())}),e.isInited()&&e.getTarget()){c(()=>r());return}t>0&&(i=setTimeout(()=>{c(()=>o(new bu(t)))},t)),n?.addEventListener("abort",d)}))}var wu=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 Iu(e,t,n){return t<=0?e:new Promise((r,o)=>{let s=!1,i;const a=c=>{s||(s=!0,i!==void 0&&(clearTimeout(i),i=void 0),c())};i=setTimeout(()=>{a(()=>o(new wu(n,t)))},t),e.then(c=>{a(()=>r(c))},c=>{a(()=>o(c))})})}var Tu=2,rt=Symbol("sandbox:frame-replaced");function vs(e){return e===rt}function Pe(e,t,n,r,o,s,i){const a=`sandbox:${t}`,c=s?.getSandboxTimeoutMs(t)??vn[t],d=()=>{let _=Iu(e.sendAsync(n,r),c,a);return _=l.raceWithAbortSignal(_,s?.signal),Te(a,_,o)};if(t==="INIT_START"&&yu(e)){const _=s?.getSandboxReadyTimeoutMs()??2e4,y=e,m=T=>{const D=Su(y,_,s?.signal);return Te("sandbox:INIT_START:ready-wait",D,o).then(()=>{if(!i||T<=0)return d();const B=i.getGeneration();let M;const C=new Promise((b,w)=>{M=i.onChange(()=>{i.getGeneration()!==B&&w(rt)})}),E=d();return E.catch(()=>{}),Promise.race([E,C]).finally(()=>M?.()).catch(b=>{if(b!==rt)throw b;return{...o},m(T-1)})})};return m(Tu)}if(!i)return d();const u=i.getGeneration();let f;const h=new Promise((_,y)=>{f=i.onChange(()=>{i.getGeneration()!==u&&y(rt)})}),g=d();return g.catch(()=>{}),Promise.race([g,h]).finally(()=>f?.()).catch(_=>{throw _===rt&&{...o},_})}var Cu=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Au=200;function Es(e=new Set){const t=new Set;return(n,r)=>{if(!Cu.some(([s,i])=>!e.has(s)&&i.test(n)))return;const o=r??`new:${n.length}:${n.slice(0,200)}`;t.has(o)||(t.size>=Au&&t.clear(),t.add(o))}}function _s(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Es()}}var Du=_s();function Oe(e){return e?.getInstance(l.TEMPLATE_DIRECTIVES_ID)??Du}var bs="self-init:";function Pu(e){return e.startsWith(bs)}function Bn(e,t){const n=e.getActiveShowRequest();return Pu(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Ou(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t(),o=()=>e.frameWatch?.();let s="",i;const a=_=>{i={target:e.readTarget?.(),docId:_}},c=()=>e.readDocument()?kt(e.readDocument()):s,d=()=>Oe(e.container).editorPolicy,u=()=>e.readEmail(),f=()=>{const _=u();return{..._,id:e.isTemplate()||_.isNew?void 0:_.id,html:c()}};let h=!1;const g={readContent:c,publicEmail:f,sendInitStart:()=>Pe(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:u().renderGuid},void 0,r()),sendInited:()=>Pe(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:u().renderGuid},void 0,r(),o()),async sendContent(){const _=u(),{html:y,hasBrowserExtensionArtifacts:m}=ms(_?.html||"");m&&e.events.browserExtensionDetected(),gs(e.readDocument(),y),s=y,a(_.renderGuid),await Pe(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,Lt(c(),_.renderGuid,d(),e.readDocument()?.get().version),{guid:_.renderGuid,emailId:_.id??null},r(),o())},refreshContent:()=>(a(u().renderGuid),Pe(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,Lt(c(),u().renderGuid,d(),e.readDocument()?.get().version),void 0,r(),o())),sendPreheader:async()=>{const _=u();if(_.preheader!==void 0)return Pe(n,"PREHEADER",l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:_.preheader,guid:_.renderGuid,force:!0},void 0,r(),o())},sendSubject:async()=>{const _=u();if(_.subject!==void 0)return Pe(n,"SUBJECT",l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:_.subject,guid:_.renderGuid,force:!0},void 0,r(),o())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:_=>e.showFilled?.(_),noteFilled:(_,y)=>e.noteFilled?.(_,y),contentSent:()=>i,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(f()),fireInit(_,y){if(!Bn(t(),_)){t().getActiveShowRequest()?.showId;return}const m=u();m.id,m.renderGuid,t().completeShow(_);const T=e.readDocument();He(T,{is_inited:!0},{source:"system"});const D=()=>{const M=f();y&&(M.reset=!0);const C=e.events.inited(M);return y||(h&&g.fireEmailChanged(),h=!0),C};if(!T||T.isReady())return D();const{docId:B}=T.get();return T.whenReady().then(()=>e.readDocument()?.get().docId===B?D():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(f())},fireContentChanged(){e.events.contentChanged(c())}};return g}var Ru=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}},ku=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(l.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(l.createAbortError(n.reason)):(this._activeRequest=e,new Promise((r,o)=>{const s=setTimeout(()=>{this._settle(e.showId,()=>{o(new Ru(e.showId,t))})},t);s.unref?.();const i=()=>{this._settle(e.showId,()=>{o(l.createAbortError(n.reason))})};n.addEventListener("abort",i,{once:!0});const a=()=>{clearTimeout(s),n.removeEventListener("abort",i)};this._pending.set(e.showId,{request:e,resolve:r,reject:o,timeoutId:s,dispose:a});for(const c of this._listeners)c(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 Nu(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function Lu(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=ho(e),n=mo(e),r=Nl(e.sandbox);t<n+r}var ys=class{_controller=new AbortController;_externalSignalDisposable=new l.Disposable;_sessionChangeListeners=new Set;_showRegistry=new ku;_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 ho(this._timeouts)}getSandboxTimeoutMs(e){return po(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return mo(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=Nu(this._timeouts,e.timeouts),Lu(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 l.Disposable,this._linkExternalSignal(e)}abort(e){const t=e??l.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable,this._showRegistry.rejectAll(l.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(l.createAbortError("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??l.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??l.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},jn=(()=>{const e=new ys;return e.configure({}),e})();function Re(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 ke(e){return!e||e==="none"}function Mu(e){const t=e.contain??"",n=e.willChange??"";return!ke(e.transform)||!ke(e.perspective)||!ke(e.filter)||!ke(e.backdropFilter)||!ke(e.translate)||!ke(e.rotate)||!ke(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function Ss(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 xu(e){const t=[],n=document.documentElement,r=Ss(getComputedStyle(n)),o=r.x||r.y;let s="none";const i=getComputedStyle(e).position;(i==="absolute"||i==="fixed")&&(s=i);for(let a=Re(e);a&&a!==n;a=Re(a)){const c=getComputedStyle(a),d=s==="none"||Mu(c)||s==="absolute"&&!!c.position&&c.position!=="static",u=a===document.body&&!o;if(d){s="none";const f=u?{x:!1,y:!1}:Ss(c);(f.x||f.y)&&t.push({node:a,...f})}(c.position==="absolute"||c.position==="fixed")&&(s==="none"||c.position==="fixed")&&(s=c.position==="fixed"?"fixed":"absolute")}return t}function ws(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 Mt(e){return Number.parseFloat(e)||0}function Un(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=ws(e),o=Mt(n.borderLeftWidth),s=Mt(n.borderTopWidth),i=Mt(n.borderRightWidth),a=Mt(n.borderBottomWidth),c=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-o-i):0,d=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-s-a):0;return{left:t.left+o*r.x,top:t.top+s*r.y,right:t.right-(i+c)*r.x,bottom:t.bottom-(a+d)*r.y}}function Fu(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},o=(s,i,a)=>{i&&(r.left=Math.max(r.left,s.left),r.right=Math.min(r.right,s.right)),a&&(r.top=Math.max(r.top,s.top),r.bottom=Math.min(r.bottom,s.bottom))};return t.forEach(s=>o(Un(s.node),s.x,s.y)),n&&o(Un(n),!0,!0),r}var Hn={originX:0,originY:0,scaleX:1,scaleY:1};function xt(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 Is(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 Ts(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 Bu=1e3;function ju(e){const{slot:t,own:n}=e;let r,o=0,s=!1;const i=()=>{if(r=void 0,!s){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<o)&&(r=window.requestAnimationFrame(i))}},a=()=>{!s&&r===void 0&&(r=window.requestAnimationFrame(i))},c=()=>{o=performance.now()+Bu,a()},d=[window],u=[document.documentElement];for(let m=t;m;m=Re(m)){const T=m.getRootNode();T instanceof ShadowRoot&&!d.includes(T)&&(d.push(T),u.push(T))}const f=[["scroll",a],["load",a],["transitionrun",c],["transitionend",a],["transitioncancel",a],["animationstart",c],["animationend",a],["animationcancel",a]];d.forEach(m=>f.forEach(([T,D])=>m.addEventListener(T,D,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const h=typeof MutationObserver=="function"?new MutationObserver(m=>{m.some(T=>!n.contains(T.target))&&a()}):void 0;u.forEach(m=>h?.observe(m,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let g;try{if(typeof ResizeObserver=="function"){const m=new ResizeObserver(a);typeof m.observe=="function"&&(g=m)}}catch{g=void 0}let _=[];return{schedule:a,observe:m=>{!g||m.length===_.length&&m.every((T,D)=>T===_[D])||(g.disconnect(),_=m,m.forEach(T=>g?.observe(T)))},dispose(){s=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),d.forEach(m=>f.forEach(([T,D])=>m.removeEventListener(T,D,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),h?.disconnect(),g?.disconnect()}}}var Uu="pluginZoom",Hu=/^(?:ant|vscode|monaco|docs)-/;function $u(e){return Hu.test(e)}function Vu(){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 Gu=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function Yu(){return Gu}var Wu=new Set;function qu(e,t,n=Wu){return e.startsWith(`${t}-`)?!1:!$u(e)&&!n.has(e)}function Ku(e,t){return`--${t}-${e}`}function Cs(e){const t=Vu();return qu(e,t,Yu())?Ku(e,t):`--${e}`}function zu(e,t){const n=Cs(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function As(e,t){return zu(e,t)}var Ds=300,Ps=15e3,Xu=5e3,Os="em-canvas-busy-style";function Ju(){if(document.getElementById(Os))return;const e=document.createElement("style");e.id=Os,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var Qu="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 Zu(e){const t=As("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(Cs("colorPrimary")).trim()||t}function Rs(e){Ju();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",Qu),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:${Zu(e)};animation:em-canvas-busy-spin 1s linear infinite`),o.appendChild(n),o}function ef(e,t,n){const r=t??e,o=Math.max(r.left,e.left,0),s=Math.min(r.right,e.right,n.width),i=Math.max(r.top,e.top,0),a=Math.min(r.bottom,e.bottom,n.height);return s<=o||a<=i?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(o+s)/2-e.left,y:(i+a)/2-e.top}}function tf(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},s=r.getBoundingClientRect();if(s.width>0&&!Ts({left:s.left,top:s.top,width:s.width,height:s.height},o)){const i=xt(o,Is(s,xt(o,Hn),Hn));Object.assign(r.style,{left:`${i.left}px`,top:`${i.top}px`,width:`${i.width}px`,height:`${i.height}px`})}return{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const i=ef(n,t(),{width:window.innerWidth,height:window.innerHeight}),a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:`${i.x}px`,top:`${i.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),a.appendChild(Rs(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function $n(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(Rs(e))},Ds);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var nf=8e3;function rf(){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 of(e,t){for(let n=Re(e);n;n=Re(n)){const r=getComputedStyle(n),o=r.overflowX!=="visible"||r.overflowY!=="visible",s=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(i=>Ge(i)>0);if(o&&s)return n;if(n===t)return null}return null}function Ge(e){return Number.parseFloat(e)||0}function Ft(e,t){return Math.abs(e-t)<=1}function sf(e){const t=getComputedStyle(e),n=Ge(t.borderTopWidth),r=Ge(t.borderRightWidth),o=Ge(t.borderBottomWidth),s=Ge(t.borderLeftWidth),i=(a,c,d)=>Math.max(0,Ge(a)-Math.max(c,d));return{...Un(e),radii:[i(t.borderTopLeftRadius,n,s),i(t.borderTopRightRadius,n,r),i(t.borderBottomRightRadius,o,r),i(t.borderBottomLeftRadius,o,s)]}}function af(e,t){const n=Ft(t.top,e.top),r=Ft(t.bottom,e.bottom),o=Ft(t.left,e.left),s=Ft(t.right,e.right),i=[n&&o?e.radii[0]:0,n&&s?e.radii[1]:0,r&&s?e.radii[2]:0,r&&o?e.radii[3]:0];return i.every(a=>a===0)?"":i.map(a=>`${a}px`).join(" ")}function lf(e,t,n,r,o,s){const i=n.readyTimeoutMs??nf,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",As(Uu,"1"));const c=n.resolveSrc(e),d=document.createElement("iframe");d.setAttribute("sandbox",n.resolveSandbox(c)),d.setAttribute("allow","clipboard-read; clipboard-write"),d.setAttribute("title","Email content"),d.style.width="100%",d.style.border="0",d.style.display="block",d.style.minHeight="600px",d.src=c,a.appendChild(d),t.appendChild(a),n.mark?.("created"),o||n.onCreated?.(d);const u=new l.Disposable;let f=!1,h,g=!1,_,y,m,T;const D=()=>{clearTimeout(T),T=setTimeout(()=>{g||(g=!0,y?.(new Error(`[canvas] ${e}: документ не загрузился за ${i} мс`)))},i)},B=()=>f?(m=Promise.resolve(),g=!0,m):(g=!1,m=new Promise((R,H)=>{_=R,y=H}),D(),m),M=()=>{if(clearTimeout(T),f=!0,g){m=Promise.resolve();return}g=!0,n.mark?.("loaded"),_?.()};d.addEventListener("load",M),u.addDispose(()=>{clearTimeout(T),d.removeEventListener("load",M)});let C;const E=()=>{C??=n.bindResizer?.(d)},b=()=>{C?.dispose(),C=void 0};let w=null,O=null,x,A=Hn,N="",k="",P=0;const v=R=>{const H=JSON.stringify(R);return H===N?!1:(N=H,a.style.visibility=R.visibility,a.style.left=`${R.css.left}px`,a.style.top=`${R.css.top}px`,a.style.width=`${R.css.width}px`,a.style.height=`${R.css.height}px`,a.style.borderRadius=R.radius,d.style.width=R.elementWidth>0?`${R.elementWidth}px`:"100%",d.style.transform=R.shiftX!==0?`translate(${R.shiftX}px, ${R.shiftY}px)`:`translateY(${R.shiftY}px)`,!0)};let I=!1;const p=()=>{if(!w)return N="",a.style.visibility="hidden",d.removeAttribute("id"),!1;n.elementId&&(d.id=n.elementId);const R=w.getBoundingClientRect(),H=xu(w),q=O?.isConnected?O:null;x?.observe([w,d,...H.map(te=>te.node),...q?[q]:[]]);const z=Fu(R,H,q),X=Math.max(0,z.right-z.left),Xe=Math.max(0,z.bottom-z.top),yt=getComputedStyle(w).visibility==="visible",xe=X<=0||Xe<=0,Se=xe?{left:z.left,top:z.top,right:z.left,bottom:z.top}:z,L=xe?null:of(w,q??H[0]?.node??null),K=L?af(sf(L),Se):"",W=te=>v({visibility:yt&&!I?"":"hidden",css:xt(Se,te),elementWidth:R.width/te.scaleX,shiftX:(R.left-Se.left)/te.scaleX,shiftY:(R.top-Se.top)/te.scaleY,radius:K});let ce=W(A);if(!xe){const te=a.getBoundingClientRect();te.width>0&&!Ts({left:te.left,top:te.top,width:te.width,height:te.height},Se)&&(A=Is(te,xt(Se,A),A),ce=W(A)||ce)}return ce},S=()=>{if(!w)return!1;let R=p();const H=d.getBoundingClientRect().height;H>0&&H!==P&&(P=H,w.style.height=`${H/ws(w).y}px`,R=!0);const q=getComputedStyle(w).pointerEvents;return q!==k&&(k=q,a.style.pointerEvents=q),R},F=()=>{x?.dispose(),x=void 0},V=R=>{x=ju({slot:R,own:a,measure:S,onDetached:F})};let $=[];const G=(R,H)=>{if(O=H,R&&$.length>0){const q=$;$=[],q.forEach(z=>z())}if(R===w){R&&!x&&V(R),S();return}if(F(),w&&w.style.removeProperty("height"),N="",P=0,k="",w=R,!R){p(),b();return}n.onShown?.(d),V(R),S(),E()};u.addDispose(F);const j=R=>{f=!1,h=void 0,s?.(),R&&n.onReload?.(d);let H;g||m===void 0?H=B():(D(),H=m);try{d.contentWindow?.location.reload()}catch{d.src=c}return H};return{element:d,ready(){return m??B()},reload:()=>j(!0),reloadQuietly:()=>j(!1),followReload:()=>{h=void 0,s?.(),n.onReload?.(d)},moveTo(R){if(a.parentNode===R)return m??B();f=!1,h=void 0,s?.();let H;return g||m===void 0?H=B():(D(),H=m),R.appendChild(a),n.onReload?.(d),N="",x?.schedule(),H},get shown(){return w!==null},get slot(){return w},whenShown(){return w!==null?Promise.resolve():new Promise(R=>{$.push(R)})},get filled(){return h},noteFilled(R){h=R},alignTo(R,H){G(R,H??null)},hold(R){I!==R&&(I=R,p())},scrollBy(R,H){let q=R,z=H;for(let X=w?Re(w):null;X;X=Re(X)){if(Math.abs(q)<1&&Math.abs(z)<1)return;const Xe=getComputedStyle(X);if((Xe.overflowY==="auto"||Xe.overflowY==="scroll")&&X.scrollHeight>X.clientHeight){const yt=X.scrollTop,xe=X.scrollLeft;X.scrollBy({left:q,top:z,behavior:"instant"}),q-=X.scrollLeft-xe,z-=X.scrollTop-yt}}(Math.abs(q)>=1||Math.abs(z)>=1)&&window.scrollBy({left:q,top:z,behavior:"instant"})},resize(){C?.resize()},dispose(){G(null,null),b(),u.dispose(),a.remove()}}}function cf(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",o=(A,N)=>A==="email"?`email:${N??n}`:A,s=new Map;let i,a=[],c=!1,d,u,f=!1,h,g,_="shown",y=0,m,T,D;const B=A=>u!==void 0&&A.filled!==void 0&&A.filled!==u,M=()=>{m=void 0;const A=h;!f||!A||u===void 0||T===u||!B(A)||(T=u,e.onForeignDocument?.({wanted:u,filled:A.filled,role:_,heldMs:Date.now()-y}))},C=()=>{f=!1,h=void 0,g=void 0,clearTimeout(m),m=void 0},E=(A,N)=>{const k=s.get("email"),P=k?.slot??null;return A&&P&&B(A)?(A.alignTo(null),f||(f=!0,y=Date.now(),m=setTimeout(M,Xu)),_=N,h=A,!(i!==void 0||c)&&g!==A&&(g=A,e.onShown?.(A.element)),!d&&!i&&(d=$n(P)),!1):(f&&(C(),d?.remove(),d=void 0),A?.alignTo(P,k?.clip??null),!0)},b=()=>{f&&!c&&E(t.get(o("email")),"shown")},w=()=>{a.forEach(A=>clearTimeout(A)),a=[],i?.remove(),i=void 0,d?.remove(),d=void 0,(c||f)&&(c=!1,E(t.get(o("email")),"shown"))},O=(A,N,k)=>{const P=o(A,N),v=t.get(P);if(v)return v;const I=e.resolveMount();if(!I)return rf();const p=lf(A,I,e,A==="email"?N??n:void 0,k,A==="email"?()=>b():void 0);return t.set(P,p),p},x={get:A=>O(A),current:A=>O(A),peek:A=>t.get(o(A)),spare:()=>t.get(o("email",r())),ensureSpare:()=>O("email",r(),!0),promote(){const A=t.get(o("email",r()));if(!A)return;const N=t.get(o("email"));n=r(),D=void 0,E(A,"spare"),N?.alignTo(null)},alignSurface(A,N,k){const P=s.get(A);if(s.set(A,{slot:N,clip:k??null}),A==="email"&&c){d?.remove(),d=N?$n(N):void 0;return}const v=N?O(A):t.get(o(A));if(A!=="email"){v?.alignTo(N,k??null);return}if(!N){D=P?.slot&&v?.shown?{slot:P.slot,handle:v}:void 0,f&&(C(),d?.remove(),d=void 0),v?.alignTo(null);return}const I=D?.slot===N&&D.handle===v;if(D=void 0,P?.slot===N&&v?.shown||I){v?.alignTo(N,k??null);return}E(v,"shown")},want(A){u=A,A!==void 0&&b()},noteFilled(A,N){const k=x.byWindow(A);k&&(k.noteFilled(N),k===t.get(o("email"))&&b())},visible(){for(const A of t.values())if(A.shown)return A},byWindow(A){if(A){for(const N of t.values())if(N.element.contentWindow===A)return N}},busy(A){if(w(),!A)return;if(!x.visible()){c=!0,d?.remove(),d=void 0;const P=s.get("email");P?.slot&&(d=$n(P.slot)),a=[setTimeout(w,Ps)];return}const N=e.resolveMount();if(!N)return;const k=tf(N,()=>x.visible()?.element.parentElement?.getBoundingClientRect()??null);i=k,a=[setTimeout(()=>k.showSpinner(),Ds),setTimeout(w,Ps)]},remount(A){w();const N=o("email");t.forEach((k,P)=>{if(P===N){k.moveTo(A).catch(()=>{});return}k.dispose(),t.delete(P)})},dispose(){u=void 0,c=!1,C(),D=void 0,w(),t.forEach(A=>A.dispose()),t.clear(),s.clear(),n="a",u=void 0,T=void 0}};return x}var df=l.createIdentifier$1("canvas.resizerBinder"),Vn=l.createIdentifier$1("canvas.service"),uf={created:oe.canvasCreated,loaded:oe.canvasLoaded},ks=new WeakMap;function Gn(e){return ks.get(e)??0}function ff(e,t){if(e.getInstance(Vn))return;const n=cf({resolveMount:()=>t.resolveMount(),resolveSrc:o=>t.resolveSrc(o),resolveSandbox:zd,elementId:t.elementId,bindResizer:o=>e.getInstance(df)?.(o),onCreated:o=>ot(e,o,"fresh"),onReload:o=>{ks.set(o,Gn(o)+1),ot(e,o,"fresh")},onShown:o=>{const s=n.byWindow(ie(e).getTarget());s&&s.element!==o&&Ns(s.element)===Ns(o)||ot(e,o,"switch")},mark:o=>t.mark?.(uf[o]),onForeignDocument:o=>{({...o},Bl("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=ie(e).addListener(l.EVENT_TYPES.SANDBOX_WHEEL,o=>{n.visible()?.scrollBy(o?.deltaX??0,o?.deltaY??0)});e.inject(Vn,n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function Ns(e){return e.parentElement?.dataset.canvasHost}function ot(e,t,n){const r=ie(e),o=t.contentWindow;if(!o)return;const s=r.getTarget()===o;s&&n==="switch"||(n==="fresh"&&(r.forget(o),s&&r.setTarget(void 0)),r.setTarget(o),Od(r))}function pf(e,t){ot(e,t,"promote")}function hf(e,t){ot(e,t,"switch")}function mf(e,t){const n=t.contentWindow;n&&ie(e).greet(n)}function Ls(e,t){const n=t.contentWindow;n&&ie(e).forget(n)}function gf(e,t){const n=ne(e)?.byWindow(t)?.element;if(!n)return;const r=Gn(n);return()=>Gn(n)!==r}function ne(e){return e.getInstance(Vn)}function Ms({attributes:e,readContent:t,docId:n,hasSession:r,serverId:o,show:s}){if(!r)return;const i={id:o??void 0,renderGuid:n,showId:s?.id,isNew:o==null,showToken:s?.token},a={...e,...i};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}function Bt(e){return{...Ms({attributes:e.get().attributes,readContent:()=>e.getContent(),docId:e.get().docId,hasSession:!0,serverId:e.get().serverId,show:void 0}),html:e.getContent()}}function jt(e){const t=se(e),n=t.current();if(!n||!Q(t.sessionKey()))return;const r=Bt(n),o=n.isDirty();re(e,l.events.ON_BLOCK_CLOSE_ID).fire({block:r,hasUnsavedChanges:o})}function vf(e){const t=se(e);return!t.current()||!Q(t.sessionKey())?!1:(jt(e),t.hasSuspended()?t.resumeSuspended()!==void 0:!1)}function Ef(e){const t=se(e),n=ie(e),r=()=>e.getInstance(l.INIT_PIPELINE_ID)??jn;let o,s,i=!1,a=!1,c,d;const u=k=>Bt(k),f=()=>{const k=B(),P=k?.get().docId;if(!k||!P||P!==c||i)return;const v=k.get().version;v!==d&&(d=v,re(e,l.events.ON_BLOCK_CHANGED_ID).fire(u(k)))};let h;const g=k=>{const P=t.showFacts();!P||P.id===h||!Bn(k,P.id)||(h=P.id,k.completeShow(P.id))},_=async(k,P,v)=>{const I=v.generation,p=()=>v.generation!==I||v.signal.aborted||t.current()!==k||a,S=fe(n);let F;const V=new Promise(G=>{F=Ot(n,()=>G("regenerated"))}),$=async(...G)=>await Promise.race([Pe(...G).then(()=>"sent"),V])==="sent";i=!0;try{if(!await $(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:P},void 0,v)||p())return;const{html:G,hasBrowserExtensionArtifacts:j}=ms(kt(k));if(j&&re(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),gs(k,G),!await $(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,Lt(kt(k),P,Oe(e).editorPolicy,k.get().version),void 0,v)||p()||!await $(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:P},void 0,v)||p())return;o=P,s=S,M(),d=k.get().version,c!==P&&(c=P,re(e,l.events.ON_BLOCK_INIT_ID).fire(u(k))),g(v)}finally{F?.(),i=!1,fe(n)!==S&&b()}};let y,m,T;const D=()=>{const k=ne(e)?.peek("block");return k?.reload?(k.reload().catch(()=>{}),!0):!1},B=()=>Q(t.sessionKey())?t.current():void 0,M=()=>{const k=B()?.get().docId,P=!k||T===k||o===k&&s===fe(n);ne(e)?.peek("block")?.hold(!P)},C=()=>{if(a||(M(),f(),i))return;const k=B(),P=k?.get().docId;if(!k||!P)return;if(o===P&&s===fe(n)){g(r());return}if(!k.isReady())return;const v=r();v.signal.aborted||o!==void 0&&o!==P&&y!==P&&(y=P,D())||_(k,P,v).catch(()=>{if(!(a||t.current()!==k)){if(m!==P){m=P,D();return}T=P,M()}})};let E=!1;const b=()=>{E||a||(E=!0,queueMicrotask(()=>{E=!1,C()}))};let w,O;const x=()=>{const k=B(),P=k?.get().docId;P!==O&&(w?.(),O=P,w=k?.subscribe(b)),M(),b()},A=t.subscribe(x),N=Ot(n,()=>{M(),b()});x(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a=!0,N(),w?.(),A()})}function _f(e){const t=se(e);let n="email";const r=()=>{if(!t.current())return;const s=Q(t.sessionKey())?"block":"email",i=ne(e);if(s===n||!i)return;n=s;const a=i.peek(s);if(a){hf(e,a.element);return}i.get(s)},o=t.subscribe(r);e.getInstance(l.DISPOSABLE_ID)?.addDispose(o)}var bf=200;function yf({startVersion:e,limit:t=bf}){let n=[],r=e;const o=s=>{n=n.filter(i=>i.version>s),r=Math.max(r,s)};return{record(s){!s.changes?.length&&!s.contentReplaced||(n.push(s),n.length>t&&o(n[n.length-t-1].version))},rebase(s,i){if(i<r)return null;const a=n.filter(d=>d.version>i);o(i);let c=s;for(const d of a){if(d.contentReplaced||!d.changes)return null;const u=d.changes,f=[];for(const h of c){if(d.fromCanvas&&u.some(_=>h.range.start<=_.oldEnd&&h.range.end>=_.oldPosition))return null;const g=Gl(h.range,u,"after");if(!g)return null;f.push({range:g,text:h.text})}c=f}return c}}}function Sf(e,t){let n=0;return e.map(({start:r,end:o,text:s})=>{const i=new he(r,t.slice(r,o),r+n,s);return n+=s.length-(o-r),i})}function wf(e,t){const n=[...e].sort((r,o)=>r.range.start-o.range.start);return Sf(n.map(({range:r,text:o})=>({start:r.start,end:r.end,text:o})),t)}function If(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Yn=l.createIdentifier$1("canvas.sandboxFill");function xs(e){return e.getInstance(Yn)?.pipeline.isEventsLocked()===!0}function Ut(e){Ze(e,{origin:"canvas-channel"})}function Tf(e){const t=se(e),n=ie(e);let r;const o=(c,d)=>{const u=c.get().docId;let f=!1,h=null,g=null;const _=yf({startVersion:c.get().version});let y=c.getContent(),m=!0;const T=(b,w)=>{!m||t.current()!==c||(Ze(w,{origin:"canvas-channel"}),n.sendAsync(l.EVENT_TYPES.SANDBOX_SET_ENTITY,Lt(kt(c),u,Oe(e).editorPolicy,c.get().version)).catch(Ut))},D=async(b,w)=>{if(g){g.push({edits:b,rev:w});return}g=[{edits:b,rev:w}];try{do{const O=g.splice(0,g.length);await n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:O.map(x=>x.edits),guid:u,rev:O[O.length-1].rev})}while(g.length)}catch(O){T("app edits failed to reach the canvas",O)}finally{g=null}},B=(b,w)=>{const O=g?.splice(0,g.length)??[];O.length&&n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:O.map(x=>x.edits),guid:u,rev:O[O.length-1].rev}).catch(Ut),n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:[b],guid:u,rev:c.get().version,...w!==null?{changeId:w}:{}}).catch(Ut)},M=b=>{const{guid:w,pushUndoStop:O}=b;if(w!==u)return;const x=tc(b);let{edits:A}=b;if(x.baseRev!==null){const k=_.rebase(A,x.baseRev);if(!k){Ze(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),B([],x.changeId);return}A=k}const N=c.get().version;try{f=!0,h=x.changeId;const k=wf(A,c.getContent());O===!1?d.applyWithoutHistory(k):c.mutate({changes:k},{source:xs(e)?"system":"user"})}catch(k){T("canvas batch failed to apply",k);return}finally{f=!1,h=null}c.get().version===N&&x.baseRev!==null&&B([],x.changeId)},C=c.subscribe(({changes:b,version:w})=>{const O=c.getContent(),x=!b?.length&&O!==y;if(y=O,_.record({version:w,changes:b,contentReplaced:x,fromCanvas:f}),!b?.length)return;const A=If(b);f?B(A,h):D(A,w).catch(Ut)}),E=n.addListener(l.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,M);return()=>{m=!1,C(),E.dispose()}};let s;const i=()=>{const c=t.current(),d=t.history(),u=c?.get().docId;u!==s&&(r?.(),r=void 0,s=u,c&&d&&(r=o(c,d)))},a=t.subscribe(i);i(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.(),a()})}function Cf(e){const t=ie(e),n=()=>ne(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(l.EVENT_TYPES.RELOAD,()=>{n()?.followReload()}),o=t.addOffTargetListener(l.EVENT_TYPES.RELOAD,a=>{const c=ne(e)?.byWindow(a);c&&Ls(e,c.element)}),s=t.addListener(a=>{a.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),i=Y(e,l.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),o.dispose(),s.dispose(),i.dispose()})}function Fs(){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 Af(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);let n,r;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),ff(e,{resolveMount:()=>n,resolveSrc:s=>cs(s==="block"),elementId:"email_iframe",mark:s=>J(s)}),t?.watch(s=>{const i=s?.element;if(n&&i instanceof HTMLElement&&i!==n){n=i,ne(e)?.remount(i),r?.remove(),r=void 0;return}if(!n){if(i instanceof HTMLElement)n=i;else if(s!==void 0){n=r??=Fs(),ne(e)?.alignSurface("email",r,r);return}else return;ne(e)?.get("email")}});let o;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{o?.remove(),o=void 0}),cd(e).watch(s=>{const i=ne(e);if(i){if(s){o??=Fs(),i.alignSurface("email",o,o);return}o&&(i.alignSurface("email",null),o.remove(),o=void 0)}})}var Wn=l.createIdentifier$1("canvas.headerFlow"),Bs=["subject","preheader"],js=3e3,Df=3,Pf={subject:l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function Of(e){const t=se(e),n=ie(e),r=C=>C?"remote":xs(e)?"system":"user",o=(C,{guid:E,value:b,forced:w})=>{const O=Ue(t);if(!O||typeof b!="string"||E&&E!==O.get().docId)return;const x=t.forcedHeaders();if(x?.[C]!==void 0&&!w&&b!==x[C])return;const A=O.get().attributes[C];if(!w&&g(C,b,A))return;const N=!w&&f.delete(C);w&&(m.delete(C),m.size===0&&t.endForcedHeaders());const k=A??"";c=!0;try{He(O,{[C]:b},{source:N?"system":r(w)})}finally{c=!1}s[C]=b,re(e,l.events.ON_HEADER_APPLIED_ID).fire({field:C,value:b,forced:!!w,isGenerated:b!==k&&!!b})};let s={},i,a,c=!1,d=Promise.resolve();const u={},f=new Map,h=(C,E)=>{s[C]=E;const b={};f.set(C,b);const w=()=>{f.get(C)===b&&f.delete(C)};_(C,E,{force:!0}).then(w),setTimeout(w,js)},g=(C,E,b)=>{const w=t.showFill();if(!w||typeof b!="string")return!1;const O=u[C]?.showId===w.showId?u[C]:void 0;return E===b?(u[C]=O??{showId:w.showId,codeEdits:w.codeEdits,corrections:0},!1):O&&w.codeEdits>O.codeEdits&&E!==O.stale?!1:((!O||E===O.stale&&O.corrections<Df)&&(u[C]={showId:w.showId,stale:E,codeEdits:w.codeEdits,corrections:(O?.corrections??0)+1},h(C,b)),!0)},_=(C,E,{force:b=!1,echo:w=!1,undoStep:O=!1})=>(d=n.sendAsync(Pf[C],{value:E,guid:Ue(t)?.get().docId,...b?{force:!0}:{},...w?{echo:!0}:{},...O?{undoStep:!0}:{}}).catch(x=>{}),d);let y;const m=new Set;e.inject(Wn,{whenDelivered:async()=>{await d},reassert:C=>{const E=Ue(t),b=Bs.filter(w=>typeof C[w]=="string");if(!(!E||b.length===0)){c=!0;try{He(E,Object.fromEntries(b.map(w=>[w,C[w]])),{source:"system"})}finally{c=!1}t.beginForcedHeaders(Object.fromEntries(b.map(w=>[w,C[w]]))),clearTimeout(y),y=setTimeout(()=>{m.clear(),t.endForcedHeaders()},js),m.clear();for(const w of b)m.add(w);for(const w of b)s[w]=C[w],_(w,C[w],{force:!0,echo:!0})}}});const T=()=>{i?.(),i=void 0;const C=Ue(t);if(C!==a&&f.clear(),a=C,!C){s={};return}const E=C.get().attributes;s={subject:E.subject,preheader:E.preheader},i=C.subscribe(({source:b})=>{if(c)return;const w=C.get().attributes,O=t.forcedHeaders();for(const x of Bs){const A=w[x];if(A===s[x])continue;s[x]=A,f.delete(x);const N=b==="system"&&O?.[x]!==void 0;_(x,A??"",{force:N,echo:N,undoStep:b==="user"})}})};T();const D=t.subscribe(T),B=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,C=>o("subject",C)),M=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,C=>o("preheader",C));e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{B.dispose(),M.dispose(),D(),i?.(),clearTimeout(y)})}function Rf(e){const t=se(e);let n={document:void 0,seq:0};const r=()=>{const s=t.recoveryFacts(),i=Ue(t);if(!s?.applied||!i||String(s.emailId)!==String(i.get().serverId)||(n.document!==i&&(n={document:i,seq:0}),s.applied.seq<=n.seq))return;n={document:i,seq:s.applied.seq};const a=t.shownHeaders();(a.subject!==void 0||a.preheader!==void 0)&&e.getInstance(Wn)?.reassert(a)},o=t.subscribe(r);e.getInstance(l.DISPOSABLE_ID)?.addDispose(o)}function kf(e,t){return(e&&e!=="system"?e:t?"dark":"light")==="dark"?l.DARK:l.LIGHT}function Nf(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 Lf(e){return e.isCodeMode&&(e.direction==="left"||e.direction==="right")}function Us(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function qn(e,t){const n={...e};for(const r of Object.keys(t)){const o=t[r],s=e[r];Us(o)&&Us(s)?n[r]=qn(s,o):o!==void 0&&(n[r]=o)}return n}function Mf(e,t){const n=l.COMMON_STYLES;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 qn(n,o)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?qn(n,t):n}var xf=ae(void 0),Hs=xf,$s=l.createIdentifier$1("CodeMode");function Vs(){let e;try{const t=window.localStorage?.getItem(l.LOCAL_STORAGE_ITEMS.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 Ff(e){try{window.localStorage?.setItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function Kn(e){return e.getOrCreateInstance($s,()=>{const t=ae(Vs());return t.watch(Ff),t})}function Gs(e){return e?.getInstance($s)?.get()??Vs()}function zn(e,t){const n=Kn(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function Bf(e,t){const n=Kn(e);n.set({...n.get(),direction:t})}var jf=l.createIdentifier$1("DefaultCommonStyles");function Ys(e){return e.getOrCreateInstance(jf,()=>ae(void 0))}function Uf(e,t){Ys(e).set(t)}var Hf=l.createIdentifier$1("CanvasViewport"),$f=l.createIdentifier$1("CanvasPreviewPage");function be(e,t,n){let r,o;const s=()=>{if(!r||!e.isInited())return;const c=r.value===void 0?"undefined":JSON.stringify(r.value);c!==o&&(o=c,e.send(t,r.value))},i=n.watch(c=>{r={value:c},s()}),a=e.onInit(()=>{o=void 0,s()});return{dispose(){i.dispose(),a.dispose()}}}function Ht(e){const t=ae(e());return{source:t,refresh:()=>t.set(e())}}function Vf(e){const t=ie(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=e.getInstance(l.OPTIONS_SOURCE_ID),o=se(e),s=Kn(e),i=matchMedia(l.PREFERS_COLOR_SCHEME_DARK),a=()=>n?.get()??{};let c;const d=Ht(()=>kf(Hs.get()??a().theme,i.matches)),u=Ht(()=>Nf(a(),Q(o.sessionKey()))),f=Ht(()=>a().lockEditor),h=Ht(()=>Mf(o.current()?.get().attributes?.common_styles,c)),g=e.getOrCreateInstance(Hf,()=>ae()),_=e.getOrCreateInstance($f,()=>ae()),y=[be(t,l.CANVAS_FACTS.theme,d.source),be(t,l.CANVAS_FACTS.flags,u.source),be(t,l.CANVAS_FACTS.lockEditor,f.source),be(t,l.CANVAS_FACTS.commonStyles,h.source),be(t,l.CANVAS_FACTS.codeMode,s.select(Lf)),be(t,l.CANVAS_FACTS.appName,ae("emailmaker")),be(t,l.CANVAS_FACTS.previewPage,_),be(t,l.CANVAS_FACTS.viewport,g)],m=()=>{d.refresh(),u.refresh(),f.refresh()},T=n?.watch(m),D=Ys(e).watch(O=>{c=O,h.refresh()}),B=r?.watch(O=>{O&&"commonStyles"in O&&(c=O.commonStyles),h.refresh()});let M;const C=()=>{M?.(),M=o.current()?.subscribe(()=>h.refresh()),h.refresh(),u.refresh()};C();const E=o.subscribe(C),b=()=>d.refresh();i.addEventListener("change",b);const w=Hs.watch(()=>d.refresh());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{y.forEach(O=>O.dispose()),T?.dispose(),D.dispose(),B?.dispose(),M?.(),E(),i.removeEventListener("change",b),w.dispose()})}var Xn;(function(e){function t(o,s,i=(a,c)=>a===c){if(o===s)return!0;if(o.length!==s.length)return!1;for(let a=0;a<o.length;a++)if(!i(o[a],s[a]))return!1;return!0}e.isEqual=t;function n(o,s=i=>i){const i=new Set;return o.filter(a=>{const c=s(a);return i.has(c)?!1:(i.add(c),!0)})}e.unique=n;function r(o=[],s=[],i=(a,c)=>a===c){const a=[],c=[],d=[];for(const u of o){const f=s.find(h=>i(u,h));f?d.push({prev:u,next:f}):c.push(u)}for(const u of s)o.find(f=>i(u,f))||a.push(u);return{added:a,removed:c,exists:d}}e.diff=r})(Xn||(Xn={}));function Gf(e,t){return e.type===t.type&&e.key===t.key}function Yf(e){const t=ie(e),n=()=>e.getServices(l.SANDBOX_EXTENSIONS_ID)??[];let r=[];const o=t.onInit(()=>{r=n(),t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,r)}),s=l.getServiceContainerId(l.SANDBOX_EXTENSIONS_ID),i=e.onInject(a=>{if(a!==s)return;const c=n();if(!t.isInited()){r=c;return}const{added:d,removed:u}=Xn.diff(r,c,Gf);if(r=c,u.length){if(u.some(f=>f.type==="script")){t.send(l.EVENT_TYPES.RELOAD);return}t.send(l.EVENT_TYPES.SANDBOX_REMOVE_EXTENSIONS,u.map(f=>f.key))}d.length&&t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,d)});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{o.dispose(),i?.dispose()})}var Wf=new Set([...Object.values(l.EVENT_TYPES).map(e=>String(e)),"INIT_MESSAGE","FETCH_USER","USER_LOGGED_IN",String(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID)]);function qf(e){return e.length>0&&!e.startsWith("em:")&&!Wf.has(e)}function Kf(e){const t=ie(e),n=new Map;let r=!1,o=-1,s=new Set;const i=d=>(d!==o&&(o=d,s=new Set),s),a=t.observeOutgoing((d,u)=>{if(!r||!qf(d))return;const f=fe(t);n.set(d,{data:u,generation:f,scripts:new Set(i(f))})}),c=t.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,d=>{if(d.phase!=="ready"||d.status!=="success")return;r=!0;const u=fe(t),f=i(u);f.add(d.key);for(const[h,g]of n)g.generation===u||![...g.scripts].every(_=>f.has(_))||(g.generation=u,t.send(l.createIdentifier(h),g.data))});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a.dispose(),c.dispose()})}var zf=l.createIdentifier$1("prewarm.editorVisible");function Xf(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function Jf(e={}){const t=e.paint??Xf;let n=!1,r=!1,o=!1,s=!1,i=!1;const a=[],c=()=>{i||s||!n||!r||!o||(s=!0,t(()=>{i=!0,J(oe.editorVisible);for(const d of a.splice(0))d()}))};return{noteShellVisible(){n=!0,c()},notePagePainted(){r=!0,c()},noteContentShown(){o=!0,c()},whenVisible(d){if(i){d();return}a.push(d)},contentShown:()=>o}}function Qf(e){return e.getOrCreateInstance(zf,()=>Jf())}var Zf=500,ep=500,tp=5e3;function np(e){const t=e.quietMs??Zf,n=e.floorMs??ep,r=e.ceilingMs??tp;let o,s,i=0;const a=()=>{clearTimeout(o),clearTimeout(s),o=void 0,s=void 0},c=()=>{a(),e.run()},d=()=>{clearTimeout(o);const u=n-(Date.now()-i);o=setTimeout(c,Math.max(t,u))};return{start(){a(),i=Date.now(),s=setTimeout(c,r),d()},notify(){o!==void 0&&d()},cancel:a}}var rp=2;function Ws(){return new Error("[sandbox] document reloaded during fill")}function op(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function Jn(e){try{e()}catch{}}function sp(e){let t;return Jn(()=>{t=e()}),{stage:n=>Jn(()=>t?.stage(n)),end:(n,r)=>Jn(()=>t?.end(n,r))}}function ip(e){const t=()=>e.initPipeline();let n=!1,r,o,s,i=0,a,c;const d=()=>{const E=e.readTarget?.(),b=e.readSandboxGeneration?.();return E===void 0||b===void 0?void 0:{target:E,generation:b}},u=()=>{const E=d();return E&&{...E,canvasReplaced:e.trackDocument?.(E.target)}},f=E=>{if(E?.canvasReplaced?.())return!0;const b=d();return E!==void 0&&b?.target===E.target&&b.generation!==E.generation},g=Ou({...e,waitScope:()=>({getSandboxTimeoutMs:E=>t().getSandboxTimeoutMs(E),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal}),frameWatch:()=>{const E=c;if(!(!E||!e.onSandboxGenerationChange))return{getGeneration:()=>d()?.generation??E.generation,onChange:b=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===E.target||E.canvasReplaced?.())&&b()})??(()=>{})}}});let _;const y=(E,b)=>{if(_===E)return;_=E;const w=i;setTimeout(()=>{i!==w||t().signal.aborted||B(E,b).catch(()=>{})},0)},m=()=>{a?.abort(),a=void 0};let T;const D=()=>{const E=t().signal;E!==T&&(T?.removeEventListener("abort",m),T=E,E.addEventListener("abort",m))};async function B(E,b,w=0){const O=++i;m(),a=new AbortController,c=void 0,D();const x=()=>i!==O,A=g.readTarget(),N=t().generation,k=()=>N===t().generation&&!t().signal.aborted,P=b?"init:reset-":"init:",v=sp(()=>e.observeShow?.(op(E,b,e.readEmail())));if(!b){const G=g.publicEmail();G?.id,G?.renderGuid,G?.preheader}let I=!1,p=!1,S,F=!1;const V=()=>{if(f(S))throw Ws()},$=()=>{if(x())throw l.createAbortError("Fill superseded")};try{n=!0,await g.sendInitStart(),$(),S=u(),c=S,w===0&&g.fireWillInit(),await(b||w>0?g.refreshContent():g.sendContent()),I=!0,$(),V();const G=g.contentSent();g.noteFilled(G?.target,G?.docId),v.stage("content"),b||g.publicEmail()?.id;try{await g.sendPreheader()}catch(j){if(vs(j)||x())throw j;`${P}`,String(j)}$();try{await g.sendSubject()}catch(j){if(vs(j)||x())throw j;`${P}`,String(j)}if($(),V(),g.showFilled(A),await g.sendInited(),$(),V(),p=!0,o===E){const j=e.readSandboxGeneration?.()??s;j!==void 0&&(r=j)}v.stage("reveal"),await g.revealFilled(),V(),v.end("revealed")}catch(G){const j=!x()&&k()&&f(S),R=j?Ws():void 0,H=R??G,q=j&&w<rp?C(E,b,w+1):void 0;F=j&&q===void 0;const z=x()?void 0:{showId:E,contentApplied:I,sandboxInitedAcked:p,superseded:!1,...e.describeSurface?.(),error:String(R??G)};z&&(`${P}`,void 0);const X=!x()&&e.recoverFailedFill?.(A)===!0;if(v.end(x()?"superseded":X?"recovered":l.isAbortError(H)||!k()?"aborted":"failed",z),!X&&!x()&&Bn(t(),E)&&t().failShow(E,H),q!==void 0)return q;throw H}finally{M(E,b,P,{superseded:x(),sessionGeneration:N,contentApplied:I,sandboxInitedAcked:p&&!F,retry:!F,commit:k()})}}function M(E,b,w,O){const{superseded:x,contentApplied:A,sandboxInitedAcked:N}=O;if(x){`${w}`;return}N&&O.commit?g.fireInit(E,b||void 0):N?(`${w}`,O.sessionGeneration,t().generation,t().signal.aborted,void 0):A?(`${w}`,void 0):(`${w}`,void 0),n=!1,a=void 0,!N&&o===E&&(o=void 0,r===s&&(r=void 0)),!N&&A&&O.retry&&y(E,b)}function C(E,b,w){return B(E,b,w)}return{channel:g,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:E=>{r=E},lastCorrelation:()=>o,markCorrelation:E=>{o=E},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:E=>{s=E},fill:E=>B(E,!1),refill:E=>B(E,!0),stop:()=>{i+=1,m(),n=!1,T?.removeEventListener("abort",m),T=void 0}}}function ap(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:qs(e,n)}function qs(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function lp(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:o,readSandboxGeneration:s}=e,i=u=>{const f=n(),h=o();if(!ap(f,u,h)){u.showId,u.navId,u.emailId,f?.id,f?.showId,f?.renderGuid;return}u.showId,f?.id,f?.renderGuid,t.markFilled(s()),t.markCorrelation(u.showId),t.fill(u.showId).catch(()=>{})};return{showRequested:u=>{i(u)},showRequestIdentityChanged:()=>{const u=e.initPipeline().getActiveShowRequest();u&&i(u)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const u=s();if(t.filledGeneration()===u)return;const f=n(),h=o();if(!f?.renderGuid||!qs(f,h))return;const g=`${bs}${f.renderGuid}`;t.markFilled(u),t.markCorrelation(g);const _=r()?.isReady()===!0;f.id,f.renderGuid,(_?y=>t.refill(y):y=>t.fill(y))(g).catch(()=>{t.lastCorrelation()===g&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id,r()}}}var cp=l.createIdentifier$1("canvas.health");function dp(e){return e??""}function up(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Ks(e){return e.length>0}function fp(e){const t=se(e),n=ie(e),r=()=>Q(t.sessionKey())?void 0:t.current(),o=()=>{const L=r();return Ms({attributes:L?.get().attributes??{},readContent:()=>L?.getContent(),docId:L?.get().docId,hasSession:!!L,serverId:L?.get().serverId,show:t.showFacts()})},s=()=>e.getInstance(l.INIT_PIPELINE_ID)??jn;let i={},a=!1;const c=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(L=>{a=!!L?.element});let d=!1,u=!1,f=!1,h=0;const g=()=>{const L=ne(e);if(!L)return;const K=++h,W=L.spare();return W&&Ls(e,W.element),(W?W.reloadQuietly():L.ensureSpare()?.ready())?.then(()=>{if(K!==h)return;d=!0;const ce=L.spare();ce&&mf(e,ce.element),f&&(f=!1,N(),j())})},_=np({run:()=>{f||g()?.catch(()=>{})}}),y=()=>{Qf(e).noteContentShown(),!d&&!f&&_.start()};let m=!1;const T=L=>{const K=ne(e),W=K?.spare()?.element.contentWindow;u&&K&&W&&L===W&&(u=!1,K.promote(),K.busy(!1),m=!0)};let D=!1;const C=ip({container:e,messageService:n,initPipeline:s,readDocument:r,readEmail:o,revealFilled:()=>{const L=ne(e);return m&&L&&(m=!1,_.start()),a?L?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:T,noteFilled:(L,K)=>ne(e)?.noteFilled(L,K),recoverFailedFill:L=>{const K=ne(e),W=K?.spare()?.element.contentWindow;return!u||!K||!W||L!==W?!1:(u=!1,d=!1,x="reload",K.busy(!1),K.peek("email")?.reload(),D=!0,j(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>fe(n),onSandboxGenerationChange:L=>Ot(n,L),trackDocument:L=>gf(e,L),observeShow:L=>e.getInstance(cp)?.begin(L),describeSurface:()=>({canvasPath:x,promoted:u,spareClean:d,handshake:n.isInited(),generation:fe(n)}),events:{willInit:L=>{re(e,l.events.WILL_EMAIL_INIT_ID).fire(L)},inited:L=>{y(),re(e,l.events.ON_EMAIL_INIT_ID).fire(L)},contentChanged:L=>{re(e,l.events.ON_CONTENT_CHANGED_ID).fire(L)},emailChanged:L=>{re(e,l.events.ON_EMAIL_CHANGED_ID).fire(L)},browserExtensionDetected:()=>{re(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),E=lp({pipeline:C,initPipeline:s,readEmail:o,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>fe(n)});let b="",w="",O="",x="none";const A=()=>{const L=ne(e)?.spare()?.element.contentWindow;L&&n.getTarget()===L||n.sendNow({operation:l.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0})},N=()=>{const L=ne(e)?.spare();L&&(A(),d=!1,u=!0,pf(e,L.element))},k=(L,K)=>{const W=ne(e);if(!W)return!0;const ce=W.spare(),te=ce&&d?"spare":"prepare";if(x=te,W.busy(!0),ce&&d)return N(),!0;_.cancel(),A();const Fe=g();if(Fe===void 0)return x="reload",W.busy(!1),W.peek("email")?.reload(),!0;f=!0;const we=h;return Fe.catch(()=>{!f||we!==h||(f=!1,x="reload",W.busy(!1),W.peek("email")?.reload())}),!1},P=()=>{if(Q(t.sessionKey()))return;Xe(),C.noteSandboxGeneration(fe(n));const L=o(),K=up(L?.renderGuid,L?.showId,L?.id,i.emailId),W=dp(L?.renderGuid);if(W!==w){const Fe=w;w=W;const we=ne(e)?.peek("email")?.filled,P_=we!==void 0&&we!==W;Ks(W)&&(Ks(Fe)||P_)&&k(Fe||(we??""),W)}if(f)return;(K!==b||D)&&(D=!1,b=K,E.showRequestIdentityChanged());const ce=r(),te=`${K}|${ce?.get().docId??""}|${fe(n)}`;te!==O&&ce?.isReady()===!0&&(O=te,E.selfInitChanged()),E.saasChanged(),$()};let v=!1,I="",p="",S=!1,F=!1;const V=L=>{L.source==="user"?F=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(S=!0),j()},$=()=>{const L=o();if(!L?.renderGuid)return;const K=C.channel.readContent(),W=JSON.stringify([L.preheader,L.common_styles,L.meta,L.subject,L.utm_parameters?.utm_campaign??"",L.utm_parameters?.utm_content??"",L.utm_parameters?.utm_medium??"",L.utm_parameters?.utm_source??"",L.utm_parameters?.utm_term??""]),ce=v&&K!==p,te=v&&W!==I;v=!0,p=K,I=W;const Fe=S&&!F;if(S=!1,F=!1,C.isEventsLocked()||Fe)return;const we={...L,id:i.isTemplate||L.isNew?void 0:L.id,html:K};if(ce){re(e,l.events.ON_CONTENT_CHANGED_ID).fire(K),re(e,l.events.ON_EMAIL_CHANGED_ID).fire(we);return}te&&L.is_inited&&re(e,l.events.ON_EMAIL_CHANGED_ID).fire(we)};let G=!1;const j=()=>{G||(G=!0,queueMicrotask(()=>{G=!1,P()}))};e.inject(Yn,{pipeline:C,setRoute:L=>{L.emailId===i.emailId&&!!L.isTemplate==!!i.isTemplate||(i=L,j())}});let R,H;const q=()=>{const L=r()?.get().docId;L!==H&&(R?.(),H=L,R=r()?.subscribe(V)),j()};let z,X;const Xe=()=>{const L=e.getInstance(l.INIT_PIPELINE_ID);!L||L===z||(X?.(),z=L,X=L.onShowRequested(K=>E.showRequested(K)))},yt=n.addListener(L=>{L.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&_.notify()}),xe=t.subscribe(q),Se=Ot(n,j);q(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c?.dispose(),X?.(),Se(),xe(),R?.(),yt.dispose(),_.cancel(),C.stop()})}function pp(){return l.USEBLOCKS!=="emailmaker"}var hp={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},zs={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}},Xs=zs,mp=["pro"],Qn={};function gp(e){Qn=e}var Js=e=>mp.includes(e)?Xs:Qn[e]??Qn.editor??Xs,Zn={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},vp={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},Ep={...Zn,config:{...Zn.config,imageCenterFileManagerView:!1}};gp({pro:zs,editor:vp,simple:pp()?Zn:Ep,blocks:hp});function _p(e,t,n=e.getInstance(l.CONFIG_SOURCE_ID)){n?.setMode(t),n?.get()?.codeEnabled===!1&&Gs(e).isCodeMode&&zn(e,!1)}function bp(e){e.getInstance(l.STANDALONE_ACTIVATED_ID)||e.inject(l.SECURITY_MODULE_ID,void 0)}function $t(e){return String(e.standaloneKey||"").trim()||void 0}function yp(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function er(e){return yp(e)?!!$t(e):!1}function st(e){return!!$t(e)&&!er(e)}var Sp=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function Qs(e){return e==="server"?"serverSide":e}function wp({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},o=ae();let s={kind:"pending"},i;const a=new Promise(h=>{i=h}),c=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function d(){s.kind!=="pending"&&o.set(Rn(r,e))}function u(h){if(s.kind!=="pending")return;clearTimeout(c),s=h;const g=Rn(r,e);o.set(g),i(g)}function f(h,g){r[Qs(h)]=g,h==="server"&&s.kind==="pending"?u({kind:"applied"}):d()}return{watch:h=>o.watch(h),select:h=>o.select(h),get:()=>o.get(),ready:()=>a,state:()=>s,layers:()=>({...r}),bootstrap(){const h=Rn(r,e);return Object.fromEntries(Sp.map(g=>[g,h[g]]))},merge(h,g){f(g,{...r[Qs(g)],...h})},replace(h,g){f(g,h)},setMode(h){r.user={...r.user,mode:h},d()},setAdvancedConfigs(h){r.advancedConfigs=h,d()},serverAbsent(h){u({kind:"absent",reason:h})},applyServerResponse(h){s.kind==="pending"&&f("server",{...r.serverSide,...h})},dispose(){clearTimeout(c)}}}var Ip=5e3,$_="pro";function Tp(){return{...Js("pro")?.config,mergeTags:void 0}}function Cp(e,t){e.getInstance(l.OPTIONS_SOURCE_ID)?.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 Ap(e,t){let n;On(e).watch(({profile:r})=>{const o=`${r?.theme??""}|${r?.locale??""}`;if(o===n)return;n=o;const s={};r?.theme&&(s.theme=r.theme),r?.locale&&(s.locale=r.locale),t.replace(s,"profile")})}function Dp(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function Pp(e,t){let n,r=!1,o;const s=a=>{o??=Pt(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&_p(e,a,t)},i=On(e).watch(({profile:a})=>{const c=a?.email_builder_config,d=Dp(c);if(d===void 0||c===n)return;const u=n===void 0;n=c,!(u&&r)&&s(d)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(i),t.ready().then(a=>{if(!a.configSwither)return;const c=localStorage.getItem("configSwither")||(n===void 0?a.mode:o)||"editor";localStorage.setItem("configSwither",c),r=n===void 0,s(c)})}var Zs="замкнутый контур: app_init не выполняется";function Op(e,t){if(e.getInstance(l.SECURITY_MODULE_ID)){t.serverAbsent(Zs);return}const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(r=>{st(r)&&t.serverAbsent(Zs)});n&&e.getInstance(l.DISPOSABLE_ID)?.addDisposable(n)}async function Rp(e,t){if(e.getInstance(mn)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(l.APP_ID);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function kp(e){e.injectFactory(l.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=wp({base:Tp(),env:{modeDefaults:o=>Js(o)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Ip});return Cp(e,r),Ap(e,r),Pp(e,r),Op(e,r),Rp(e,r),e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var Ye=class extends l.Disposable{_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 U(e,t,n){const r=l.snapshot(e);return(o,s,i)=>{const a=r(async c=>{const d=t?t(c):c;i&&o.bind(i);const u=await o(d);return n?n(u):u},s,i);return()=>a.dispose()}}var Np=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new l.Emitter;this.handleDestroy=U(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Ye(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{}}},tr=l.createIdentifier$1("DestroyableService");function Lp(e){e.injectFactory(tr,(t,n)=>{if(n)return n;const r=e.getInstance(l.DISPOSABLE_ID);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new Np({lifetime:r,options:e.getInstance(l.OPTIONS_SOURCE_ID),getInstance:()=>e.getInstance(l.INSTANCE_ID),release:()=>l.releaseContainer(e.getInstance(l.STORE_ID)??e)})},!0)}function Mp(e){const t=e.getInstance(tr);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var xp=1e3;function ei(e,t,n=xp,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),s=Object.keys(t);if(o.length!==s.length)return!1;for(const i of o)if(!ei(e[i],t[i],n,r+1))return!1;return!0}return!1}function it(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],s=e[r];ei(o,s)||(n[r]=o)}return n}var Fp=({source:e,emailtags:t,group:n,tags:r,...o})=>o;async function Bp(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function jp({emails:e,saveTimeoutMs:t},n,r){const o=t?.()??It();let s;try{const i=e.notifySave(n);return await Promise.race([i,new Promise((a,c)=>{s=setTimeout(()=>{const d=new Ct(o);n.value.id,sc(d,Bp(i,r)),c(d)},o)})])}catch(i){throw To(i),i}finally{s!==void 0&&clearTimeout(s)}}function Up(e){const{emails:t}=e,n=async(r,o)=>{const s=Fp(o),i=r===void 0?void 0:await t.cache.getIfPresent(r),a=i?{...i,...s}:s,c=i?it(i,s):s,d=u=>{const f=String(u.id??r??l.generateUUID()),h=u.id===void 0?{...u,id:f}:u;return t.cache.addOrUpdate(f,()=>h)};return await d(await jp(e,{prev:i,patch:c,value:a,source:o.source??""},d))};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:l.generateUUID()}},async updateEmail(r,o){return await n(r,o)}}}var nr=20;function Hp(e){const t=$p(e);return e.saveTimeoutMs?Vp(t,e.saveTimeoutMs):t}function $p({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:o,integratorProject:s}){const i=async(a,c)=>(t.clear(),await t.get(a,{page:c}),(await e.cache.values()??[]).filter(d=>String(d?.parent)===String(a)));return{async readRevisions(a,c=1){const d=await i(a,c);return{revisions:d.slice(nr*(c-1),nr*c),page:c,hasMore:d.length>nr*c}},async readAutosave(a){const c=await r?.(a)??NaN,d=Number.isFinite(c)?c:void 0,u=await n?.(a);if(!u?.asked)return pc(await i(a,1),d);if(!u.revision)return Ao([],d);const f={...u.revision,parent:a,isAutosave:!0};return Ao([f],d,await i(a,1))},async saveAutosave(a,c){const d=await o?.(a),u=s?.();return await e.create({..._c(c),...d!==void 0?{author:d}:{},...u!==void 0?{project:u}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function Vp(e,t){return{...e,async saveAutosave(n,r){const o=t();let s;try{return await Promise.race([e.saveAutosave(n,r),new Promise((i,a)=>{s=setTimeout(()=>a(new yo(o)),o)})])}catch(i){throw To(i),i}finally{s!==void 0&&clearTimeout(s)}}}}var Gp=class extends l.BaseEmitter{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}},Yp=class extends l.AsyncEmitter{};function V_(e){return e}var ti=class extends l.Disposable{_items=new Map;_onChangeEmitter=new l.Signal;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 l.deepEqual(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,s])=>o)),r=(await this.entries()).filter(([o,s])=>!n.has(o));for(const[o,s]of e)t.push(this.addOrUpdate(o,()=>s)),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 Wp(e,{filter:t,order:n="asc",orderBy:r,page:o,pageSize:s=20}={}){const i=e.length;let a=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(d=>{for(const u of c){const f=d[u],h=t[u];return u==="id"||typeof f!="string"?f===h:typeof h=="string"&&f.startsWith(h)}return!0}),a=e.length}return r&&(e=e.sort((c,d)=>(c[r]>d[r]?1:d[r]>c[r]?-1:0)*(n==="asc"?1:-1))),o!==void 0&&(e=e.slice(s*(o-1),s*o)),{data:e,filteredTotal:a,total:i,totalPages:Math.ceil(a/s)}}function qp(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 Kp(e,t){return ni(e)&&ni(t)?String(e)===String(t):e===t}function ni(e){return typeof e=="string"||typeof e=="number"}var zp=class extends l.Disposable{_cache=new ti;_readEmitter=new l.AsyncEmitter;_saveEmitter=this.addDisposable(new Gp);_removeEmitter=this.addDisposable(new Yp);_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 l.Disposable);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new ti),o=n.addDisposable(new l.AsyncEmitter);t=this._foreignCache[e]={get:async(s,i={})=>{await r.getOrCreate(s,async()=>{try{const c=qp(await o.fire(s))||[];for(const d of c)d[e]=s,await this._cache.add(d.id,d);return c}catch{return[]}});const a=(await this._cache.values()||[]).filter(c=>{const d=c[e];return d==null||Kp(d,s)});return Wp(a,i)},first(s,i={}){return t.get(s,{...i,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=l.generateUUID()),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 s=o?{...o,...t}:t;if(!r)return t=o?it(o,t):t,await this._saveEmitter.fire({prev:o,patch:t,value:s,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 at(e){const t=l.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new zp)}function ri(e){const t=e.getInstance(l.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function oi(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Vt(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function Xp(e,t,n){return e&&!oi(t)&&oi(e)?{...n,meta:e.meta}:n}var Jp=l.createIdentifier$1("CurrentProject"),Qp={};function lt(e){return e?.getInstance(Jp)?.get()??Qp}function rr(e){const t=lt(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var si=at("plugin.dataSource.emails"),ii=at("plugin.dataSource.emailRevisions"),ai=Nt("plugin.readEmailAutosave"),li=l.createIdentifier$1("emailDocuments.provided");function Zp(e){const t=si(e),n=ii(e),r=n.byForeignKey("parent");if(e.getInstance(li))return{emails:t,emailRevisions:n};e.inject(li,!0);const o=()=>It(e.getInstance(l.INIT_PIPELINE_ID)?.contentReadyTimeoutMs),s=Up({emails:t,saveTimeoutMs:o}),i=new Map,a=(c,d)=>u=>{const f=u?.id??d;return(typeof f=="string"||typeof f=="number")&&i.set(String(f),c),u};return Gc(e,{...s,createEmail:c=>s.createEmail(c).then(a(Date.now())),updateEmail:(c,d)=>s.updateEmail(c,d).then(a(Date.now(),c))}),Kc(e,Hp({revisions:n,revisionsByEmail:r,readAutosave:async c=>{const d=await re(e,ai).fire(c);return d.length===0?{asked:!1}:{asked:!0,revision:d[0]??null}},savedAt:async c=>{const d=uc((await t.cache.getIfPresent(c))?.modified),u=i.get(String(c))??NaN;return Number.isFinite(u)&&!(d>=u)?u:d},emailAuthor:async c=>(await t.cache.getIfPresent(c))?.author,saveTimeoutMs:o,integratorProject:()=>lt(e).requested})),ri(e).addDisposable(t.onSave(({prev:c,patch:d,value:u})=>Xp(c,d,u),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function ci(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 eh(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var th="po",Gt=null;function nh(){const e=typeof __emailmaker__<"u"?__emailmaker__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([th],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function rh(){return Gt===null&&(Gt=nh().catch(e=>{throw Gt=null,e})),Gt}async function di(e){if(typeof e=="object")return or(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?oh(t):sh(t)}function or(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function oh(e){try{return or(JSON.parse(e))}catch{return}}var ui=!1;async function sh(e){try{return or((await rh()).parsePoCatalog(e))}catch{ui||(ui=!0);return}}var ih="em_locale",ah="em_ant_locale",lh="locale",ch="ant_locale";function sr(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function fi(e,t){const n=sr(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function dh(){return sr("em_locale")??fi(lh,"em_locale")}function pi(e){try{localStorage.setItem(ih,JSON.stringify(e))}catch{}}function uh(){return sr("em_ant_locale")??fi(ch,"em_ant_locale")}function fh(e,t){try{localStorage.setItem(ah,JSON.stringify({id:e,data:t}))}catch{}}var G_="en_US",ph=8e3;function hh(e,t){const n=e,r=t,o=Object.keys(n).filter(s=>s!=="");return o.length!==Object.keys(r).filter(s=>s!=="").length?!1:o.every(s=>JSON.stringify(n[s])===JSON.stringify(r[s]))}function mh(e){const t=dh(),n=uh();let r={ready:!1},o;const s=ae(r);let i=0;const a=m=>{r={...r,...m},s.set(r)},c=()=>{r.ready||a({ready:!0})},d=setTimeout(c,e.unlockAfterMs??ph),u=m=>m!==i;let f;async function h(m,T){if(n?.id===m&&n.data&&a({antd:n.data}),!f)return;const D=await f(m).catch(()=>{});!D||u(T)||(a({antd:D}),fh(m,D))}async function g(m,T){const D=await e.askHost(m).catch(()=>null);if(u(T))return!0;if(D==null)return!1;const B=await di(D);return u(T)||(B&&a({catalog:B}),c()),!0}async function _(m,T){const D=await e.readList();if(u(T))return;if("error"in D){a({failure:{kind:"GET_LOCALES_ERROR",error:D.error}}),c();return}const B=D.data.find(C=>C.locale===m);if(!B){eh("em_locale")&&a({catalog:void 0}),c();return}if(ci(t,B)&&(!o||o.catalog===t?.data)){c();return}if(o?.entry&&r.catalog===o.catalog&&ci(o.entry,B)){pi(o.entry),c();return}const M=await e.readCatalog(m);if(!u(T)){if("error"in M){a({failure:{kind:"GET_LOCALE_ERROR",error:M.error}}),c();return}M.data&&(o?.id===m&&r.catalog===o.catalog&&hh(o.catalog,M.data)||a({catalog:M.data}),pi({id:m,time:B.updatedAt||Math.floor(Date.now()/1e3),hash:B.contentHash,data:M.data})),c()}}async function y(m,T){if(!await g(m,T)){if(!u(T)&&(o?.id===m&&r.catalog===o.catalog||m==="en_US")&&c(),e.canUseNetwork&&!e.canUseNetwork()){c();return}await _(m,T)}}return{set(m){if(!m||m===r.id)return;const T=i+=1;a({id:m,failure:void 0});const D=o?.id===m&&r.catalog===o.catalog;(o&&!D&&r.catalog===o.catalog||m==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===m&&t.data&&(a({catalog:t.data}),c()),h(m,T),y(m,T)},prime(m,T,D){r.id&&r.id!==m||r.catalog||!T||(o=t?.id===m&&t.data&&(!D||t.time>=D.time)?{id:m,catalog:t.data}:{id:m,catalog:T,entry:D?{id:m,time:D.time,hash:D.hash,data:T}:void 0},a({catalog:o.catalog}))},useAntdLoader(m){f=m,r.id&&h(r.id,i)},state:s,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var gh=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})},vh=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:s,baseUrl:i,cancelToken:a,...c})=>{const d=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,d),f=o&&this.toQueryString(o),h=this.contentFormatters[r||"application/json"],g=s||u.format;return this.customFetch(`${i||this.baseUrl||""}${n}${f?`?${f}`:""}`,{...u,headers:{...u.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(a?this.createAbortSignal(a):u.signal)||null,body:typeof e>"u"||e===null?null:h(e)}).then(async _=>{const y=_;y.data=null,y.error=null;const m=g?_.clone():_,T=g?await m[g]().then(D=>(y.ok?y.data=D:y.error=D,y)).catch(D=>(y.error=D,y)):y;return a&&this.abortControllers.delete(a),T})}},Eh=l.createIdentifier$1("rest.v2.transport"),hi=Symbol("rest.v2.secureRequest");function _h(e){return e.getOrCreateInstance(Eh,()=>{const t=e.getInstance(l.CUSTOM_FETCH_ID)?.execute||fetch;return new vh({baseUrl:"https://app.emailmaker.ru/api/v2",securityWorker:()=>({[hi]:!0}),customFetch:(n,r={})=>{const{[hi]:o,...s}=r;return t(n,{...s,[l.PUBLIC_REQUEST]:o!==!0})}})})}function bh(e,t){const n=_h(e);return Object.assign({},...t.map(r=>new r(n)))}function mi(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function gi(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:mi(n.details,"wp_code")??n.code,message:mi(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 vi(e){return!e.ok||!!e.error}function yh(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function Ei(){return yh(l.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function Sh(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function wh(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Ih(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:Sh(r[1])}),t},[]):[]}function Th(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:wh(n.updated_at),contentHash:n.content_hash}),t),[])}function _i(e){return bh(e,[gh])}function Yt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function ir(e){return!e.ok||e.error!=null}function ar(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function lr(e){return{data:await di(e)??null}}async function Ch(e){if(Ei())try{const n=await _i(e).localesList();return vi(n)?{error:gi(n)}:{data:Th(n.data)}}catch(n){return Yt(n)}const t=l.getApi(e,[so]);try{const n=await t.get_translations2({file:"react_app"});return ir(n)?ar(n):{data:Ih(n.data)}}catch(n){return Yt(n)}}async function Ah(e,t){if(Ei())try{const r=await _i(e).jsonList({locale:t});return vi(r)?{error:gi(r)}:lr(r.data)}catch(r){return Yt(r)}const n=l.getApi(e,[so]);try{const r=await n.get_translations3({id:t,file:"react_app"});return ir(r)?ar(r):lr(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return ir(r)?ar(r):lr(r.data)}catch(r){return Yt(r)}}}var Wt=new WeakMap;function Dh(e){const t=Wt.get(e);if(t!==void 0)return t;const n=Ch(e).then(r=>("error"in r&&Wt.delete(e),r),r=>{throw Wt.delete(e),r});return Wt.set(e,n),n}var We=l.createIdentifier$1("locale.service");function Ph(e){if(e.getInstance(We))return;const t=mh({readList:()=>Dh(e),readCatalog:n=>Ah(e,n),askHost:async n=>(await re(e,l.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(l.SECURITY_MODULE_ID)});e.inject(We,t),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function Oh(e){const t=e.getInstance(l.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(We);if(!n)return;const r=t.select(o=>o.locale).watch(o=>n.set(o||"ru_RU"));e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r)}var Rh="user_id",kh="project_id",bi=l.createIdentifier$1("rest.identityHeadersProvided");function Nh(e){if(e.getInstance(bi))return;e.inject(bi,!0);let t;e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(n=>{t=n}),e.addService(l.REQUEST_HANDLER_ID,{execute(n,r){if(r?.public)return;const o=t?.user?.id??Ko(e).profile?.id;o!=null&&o!==""&&n.headers.set(Rh,String(o));const s=t?.project;s!=null&&s!==""&&n.headers.set(kh,String(s))}})}function Lh(e){const t=e?.[""];return typeof t?.lang=="string"?t.lang:void 0}function Mh(e){return e.id??Lh(e.catalog)}function xh(e){if(e==="uk"||e.startsWith("uk_"))return"uk";const t=e.search(/[_-]/);return t>0?e.slice(0,t):e}function Fh(e){return xh(e||"en_US")}var Bh="Accept-Language",yi=l.createIdentifier$1("rest.localeHeaderProvided");function jh(e){e.getInstance(yi)||(e.inject(yi,!0),e.addService(l.REQUEST_HANDLER_ID,{execute(t){const n=e.getInstance(We)?.snapshot();t.headers.set(Bh,Fh(n&&Mh(n)))}}))}function Uh(e){if(!e)return!1;try{return e.getInstance(l.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var Hh="Invalid standaloneKey.",Y_=l.createIdentifier$1("StandaloneMockGuard");function $h(){const e=new Error(Hh);return e.name="InvalidStandaloneKeyError",e}function Vh(e){e.addService(l.REQUEST_HANDLER_ID,{execute:()=>{if(Uh(e))throw $h()}})}function Gh(e){l.registerRestTransport(e),Vh(e)}function Yh(e){const t=new ys;e.inject(l.INIT_PIPELINE_ID,t);const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(o=>{if(!o)return;const s=o.signal??t.externalSignal;t.configure({replaceSession:!0,...o.timeouts!==void 0?{timeouts:o.timeouts}:{},...s!==void 0?{signal:s}:{}})}),r=e.getInstance(l.DISPOSABLE_ID);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var Si=at("plugin.dataSource.blocks"),Wh=at("plugin.dataSource.blockRevisions"),qh=at("plugin.dataSource.comments"),Kh=Nt(),zh=Nt(),wi=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
2109
|
+
`));return{html:wu(t.html),hasBrowserExtensionArtifacts:t.found}}function Mt(e){return e?.getContent()??""}function Es(e,t){e?.mutate({content:wn(t)},{source:"remote"})}function xt(e){return l.createIdentifier$1(e)}function ie(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter)}function q(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter).event}function Ft(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var Iu=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 Tu(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 Cu(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(l.throwIfAborted(n),new Promise((r,o)=>{let s=!1,i,a;const c=u=>{s||(s=!0,i!==void 0&&(clearTimeout(i),i=void 0),a?.dispose(),n?.removeEventListener("abort",d),u())},d=()=>{c(()=>o(l.createAbortError(n?.reason)))};if(a=e.onInit(()=>{e.isInited()&&e.getTarget()&&c(()=>r())}),e.isInited()&&e.getTarget()){c(()=>r());return}t>0&&(i=setTimeout(()=>{c(()=>o(new Iu(t)))},t)),n?.addEventListener("abort",d)}))}var Au=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 Du(e,t,n){return t<=0?e:new Promise((r,o)=>{let s=!1,i;const a=c=>{s||(s=!0,i!==void 0&&(clearTimeout(i),i=void 0),c())};i=setTimeout(()=>{a(()=>o(new Au(n,t)))},t),e.then(c=>{a(()=>r(c))},c=>{a(()=>o(c))})})}var Pu=2,ot=Symbol("sandbox:frame-replaced");function _s(e){return e===ot}function Ne(e,t,n,r,o,s,i){const a=`sandbox:${t}`,c=s?.getSandboxTimeoutMs(t)??_n[t],d=()=>{let y=Du(e.sendAsync(n,r),c,a);return y=l.raceWithAbortSignal(y,s?.signal),Pe(a,y,o)};if(t==="INIT_START"&&Tu(e)){const y=s?.getSandboxReadyTimeoutMs()??2e4,_=e,m=I=>{const P=Cu(_,y,s?.signal);return Pe("sandbox:INIT_START:ready-wait",P,o).then(()=>{if(!i||I<=0)return d();const x=i.getGeneration();let L;const C=new Promise((S,w)=>{L=i.onChange(()=>{i.getGeneration()!==x&&w(ot)})}),E=d();return E.catch(()=>{}),Promise.race([E,C]).finally(()=>L?.()).catch(S=>{if(S!==ot)throw S;return{...o},m(I-1)})})};return m(Pu)}if(!i)return d();const u=i.getGeneration();let p;const f=new Promise((y,_)=>{p=i.onChange(()=>{i.getGeneration()!==u&&_(ot)})}),g=d();return g.catch(()=>{}),Promise.race([g,f]).finally(()=>p?.()).catch(y=>{throw y===ot&&{...o},y})}var bs="self-init:";function Ou(e){return e.startsWith(bs)}function Un(e,t){const n=e.getActiveShowRequest();return Ou(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Ru(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t(),o=()=>e.frameWatch?.();let s="",i;const a=y=>{i={target:e.readTarget?.(),docId:y}},c=()=>e.readDocument()?Mt(e.readDocument()):s,d=()=>ye(e.container).editorPolicy,u=()=>e.readEmail(),p=()=>{const y=u();return{...y,id:e.isTemplate()||y.isNew?void 0:y.id,html:c()}};let f=!1;const g={readContent:c,publicEmail:p,sendInitStart:()=>Ne(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:u().renderGuid},void 0,r()),sendInited:()=>Ne(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:u().renderGuid},void 0,r(),o()),async sendContent(){const y=u(),{html:_,hasBrowserExtensionArtifacts:m}=vs(y?.html||"");m&&e.events.browserExtensionDetected(),Es(e.readDocument(),_),s=_,a(y.renderGuid),await Ne(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,Ft(c(),y.renderGuid,d(),e.readDocument()?.get().version),{guid:y.renderGuid,emailId:y.id??null},r(),o())},refreshContent:()=>(a(u().renderGuid),Ne(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,Ft(c(),u().renderGuid,d(),e.readDocument()?.get().version),void 0,r(),o())),sendPreheader:async()=>{const y=u();if(y.preheader!==void 0)return Ne(n,"PREHEADER",l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:y.preheader,guid:y.renderGuid,force:!0},void 0,r(),o())},sendSubject:async()=>{const y=u();if(y.subject!==void 0)return Ne(n,"SUBJECT",l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:y.subject,guid:y.renderGuid,force:!0},void 0,r(),o())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:y=>e.showFilled?.(y),noteFilled:(y,_)=>e.noteFilled?.(y,_),contentSent:()=>i,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(p()),fireInit(y,_){if(!Un(t(),y)){t().getActiveShowRequest()?.showId;return}const m=u();m.id,m.renderGuid,t().completeShow(y);const I=e.readDocument();Ge(I,{is_inited:!0},{source:"system"});const P=()=>{const L=p();_&&(L.reset=!0);const C=e.events.inited(L);return _||(f&&g.fireEmailChanged(),f=!0),C};if(!I||I.isReady())return P();const{docId:x}=I.get();return I.whenReady().then(()=>e.readDocument()?.get().docId===x?P():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(p())},fireContentChanged(){e.events.contentChanged(c())}};return g}var ku=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}},Nu=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(l.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(l.createAbortError(n.reason)):(this._activeRequest=e,new Promise((r,o)=>{const s=setTimeout(()=>{this._settle(e.showId,()=>{o(new ku(e.showId,t))})},t);s.unref?.();const i=()=>{this._settle(e.showId,()=>{o(l.createAbortError(n.reason))})};n.addEventListener("abort",i,{once:!0});const a=()=>{clearTimeout(s),n.removeEventListener("abort",i)};this._pending.set(e.showId,{request:e,resolve:r,reject:o,timeoutId:s,dispose:a});for(const c of this._listeners)c(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 Lu(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function Mu(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=mo(e),n=go(e),r=Rl(e.sandbox);t<n+r}var ys=class{_controller=new AbortController;_externalSignalDisposable=new l.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Nu;_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 mo(this._timeouts)}getSandboxTimeoutMs(e){return ho(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return go(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=Lu(this._timeouts,e.timeouts),Mu(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 l.Disposable,this._linkExternalSignal(e)}abort(e){const t=e??l.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable,this._showRegistry.rejectAll(l.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(l.createAbortError("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??l.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??l.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},Hn=(()=>{const e=new ys;return e.configure({}),e})();function Le(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 Me(e){return!e||e==="none"}function xu(e){const t=e.contain??"",n=e.willChange??"";return!Me(e.transform)||!Me(e.perspective)||!Me(e.filter)||!Me(e.backdropFilter)||!Me(e.translate)||!Me(e.rotate)||!Me(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function Ss(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 Fu(e){const t=[],n=document.documentElement,r=Ss(getComputedStyle(n)),o=r.x||r.y;let s="none";const i=getComputedStyle(e).position;(i==="absolute"||i==="fixed")&&(s=i);for(let a=Le(e);a&&a!==n;a=Le(a)){const c=getComputedStyle(a),d=s==="none"||xu(c)||s==="absolute"&&!!c.position&&c.position!=="static",u=a===document.body&&!o;if(d){s="none";const p=u?{x:!1,y:!1}:Ss(c);(p.x||p.y)&&t.push({node:a,...p})}(c.position==="absolute"||c.position==="fixed")&&(s==="none"||c.position==="fixed")&&(s=c.position==="fixed"?"fixed":"absolute")}return t}function ws(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 Bt(e){return Number.parseFloat(e)||0}function $n(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=ws(e),o=Bt(n.borderLeftWidth),s=Bt(n.borderTopWidth),i=Bt(n.borderRightWidth),a=Bt(n.borderBottomWidth),c=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-o-i):0,d=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-s-a):0;return{left:t.left+o*r.x,top:t.top+s*r.y,right:t.right-(i+c)*r.x,bottom:t.bottom-(a+d)*r.y}}function Bu(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},o=(s,i,a)=>{i&&(r.left=Math.max(r.left,s.left),r.right=Math.min(r.right,s.right)),a&&(r.top=Math.max(r.top,s.top),r.bottom=Math.min(r.bottom,s.bottom))};return t.forEach(s=>o($n(s.node),s.x,s.y)),n&&o($n(n),!0,!0),r}var Vn={originX:0,originY:0,scaleX:1,scaleY:1};function jt(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 Is(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 Ts(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 ju=1e3;function Uu(e){const{slot:t,own:n}=e;let r,o=0,s=!1;const i=()=>{if(r=void 0,!s){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<o)&&(r=window.requestAnimationFrame(i))}},a=()=>{!s&&r===void 0&&(r=window.requestAnimationFrame(i))},c=()=>{o=performance.now()+ju,a()},d=[window],u=[document.documentElement];for(let m=t;m;m=Le(m)){const I=m.getRootNode();I instanceof ShadowRoot&&!d.includes(I)&&(d.push(I),u.push(I))}const p=[["scroll",a],["load",a],["transitionrun",c],["transitionend",a],["transitioncancel",a],["animationstart",c],["animationend",a],["animationcancel",a]];d.forEach(m=>p.forEach(([I,P])=>m.addEventListener(I,P,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const f=typeof MutationObserver=="function"?new MutationObserver(m=>{m.some(I=>!n.contains(I.target))&&a()}):void 0;u.forEach(m=>f?.observe(m,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let g;try{if(typeof ResizeObserver=="function"){const m=new ResizeObserver(a);typeof m.observe=="function"&&(g=m)}}catch{g=void 0}let y=[];return{schedule:a,observe:m=>{!g||m.length===y.length&&m.every((I,P)=>I===y[P])||(g.disconnect(),y=m,m.forEach(I=>g?.observe(I)))},dispose(){s=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),d.forEach(m=>p.forEach(([I,P])=>m.removeEventListener(I,P,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),f?.disconnect(),g?.disconnect()}}}var Hu="pluginZoom",$u=/^(?:ant|vscode|monaco|docs)-/;function Vu(e){return $u.test(e)}function Gu(){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 Yu=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function Wu(){return Yu}var qu=new Set;function Ku(e,t,n=qu){return e.startsWith(`${t}-`)?!1:!Vu(e)&&!n.has(e)}function zu(e,t){return`--${t}-${e}`}function Cs(e){const t=Gu();return Ku(e,t,Wu())?zu(e,t):`--${e}`}function Xu(e,t){const n=Cs(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function As(e,t){return Xu(e,t)}var Ds=300,Ps=15e3,Ju=5e3,Os="em-canvas-busy-style";function Qu(){if(document.getElementById(Os))return;const e=document.createElement("style");e.id=Os,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var Zu="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 ef(e){const t=As("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(Cs("colorPrimary")).trim()||t}function Rs(e){Qu();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",Zu),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:${ef(e)};animation:em-canvas-busy-spin 1s linear infinite`),o.appendChild(n),o}function tf(e,t,n){const r=t??e,o=Math.max(r.left,e.left,0),s=Math.min(r.right,e.right,n.width),i=Math.max(r.top,e.top,0),a=Math.min(r.bottom,e.bottom,n.height);return s<=o||a<=i?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(o+s)/2-e.left,y:(i+a)/2-e.top}}function nf(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},s=r.getBoundingClientRect();if(s.width>0&&!Ts({left:s.left,top:s.top,width:s.width,height:s.height},o)){const i=jt(o,Is(s,jt(o,Vn),Vn));Object.assign(r.style,{left:`${i.left}px`,top:`${i.top}px`,width:`${i.width}px`,height:`${i.height}px`})}return{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const i=tf(n,t(),{width:window.innerWidth,height:window.innerHeight}),a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:`${i.x}px`,top:`${i.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),a.appendChild(Rs(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function Gn(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(Rs(e))},Ds);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var rf=8e3;function of(){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 sf(e,t){for(let n=Le(e);n;n=Le(n)){const r=getComputedStyle(n),o=r.overflowX!=="visible"||r.overflowY!=="visible",s=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(i=>qe(i)>0);if(o&&s)return n;if(n===t)return null}return null}function qe(e){return Number.parseFloat(e)||0}function Ut(e,t){return Math.abs(e-t)<=1}function af(e){const t=getComputedStyle(e),n=qe(t.borderTopWidth),r=qe(t.borderRightWidth),o=qe(t.borderBottomWidth),s=qe(t.borderLeftWidth),i=(a,c,d)=>Math.max(0,qe(a)-Math.max(c,d));return{...$n(e),radii:[i(t.borderTopLeftRadius,n,s),i(t.borderTopRightRadius,n,r),i(t.borderBottomRightRadius,o,r),i(t.borderBottomLeftRadius,o,s)]}}function lf(e,t){const n=Ut(t.top,e.top),r=Ut(t.bottom,e.bottom),o=Ut(t.left,e.left),s=Ut(t.right,e.right),i=[n&&o?e.radii[0]:0,n&&s?e.radii[1]:0,r&&s?e.radii[2]:0,r&&o?e.radii[3]:0];return i.every(a=>a===0)?"":i.map(a=>`${a}px`).join(" ")}function cf(e,t,n,r,o,s){const i=n.readyTimeoutMs??rf,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",As(Hu,"1"));const c=n.resolveSrc(e),d=document.createElement("iframe");d.setAttribute("sandbox",n.resolveSandbox(c)),d.setAttribute("allow","clipboard-read; clipboard-write"),d.setAttribute("title","Email content"),d.style.width="100%",d.style.border="0",d.style.display="block",d.style.minHeight="600px",d.src=c,a.appendChild(d),t.appendChild(a),n.mark?.("created"),o||n.onCreated?.(d);const u=new l.Disposable;let p=!1,f,g=!1,y,_,m,I;const P=()=>{clearTimeout(I),I=setTimeout(()=>{g||(g=!0,_?.(new Error(`[canvas] ${e}: документ не загрузился за ${i} мс`)))},i)},x=()=>p?(m=Promise.resolve(),g=!0,m):(g=!1,m=new Promise((B,j)=>{y=B,_=j}),P(),m),L=()=>{if(clearTimeout(I),p=!0,g){m=Promise.resolve();return}g=!0,n.mark?.("loaded"),y?.()};d.addEventListener("load",L),u.addDispose(()=>{clearTimeout(I),d.removeEventListener("load",L)});let C;const E=()=>{C??=n.bindResizer?.(d)},S=()=>{C?.dispose(),C=void 0};let w=null,O=null,N,A=Vn,T="",R="",M=0;const v=B=>{const j=JSON.stringify(B);return j===T?!1:(T=j,a.style.visibility=B.visibility,a.style.left=`${B.css.left}px`,a.style.top=`${B.css.top}px`,a.style.width=`${B.css.width}px`,a.style.height=`${B.css.height}px`,a.style.borderRadius=B.radius,d.style.width=B.elementWidth>0?`${B.elementWidth}px`:"100%",d.style.transform=B.shiftX!==0?`translate(${B.shiftX}px, ${B.shiftY}px)`:`translateY(${B.shiftY}px)`,!0)};let b=!1;const F=()=>{if(!w)return T="",a.style.visibility="hidden",d.removeAttribute("id"),!1;n.elementId&&(d.id=n.elementId);const B=w.getBoundingClientRect(),j=Fu(w),H=O?.isConnected?O:null;N?.observe([w,d,...j.map(te=>te.node),...H?[H]:[]]);const W=Bu(B,j,H),X=Math.max(0,W.right-W.left),Ie=Math.max(0,W.bottom-W.top),ge=getComputedStyle(w).visibility==="visible",je=X<=0||Ie<=0,Te=je?{left:W.left,top:W.top,right:W.left,bottom:W.top}:W,k=je?null:sf(w,H??j[0]?.node??null),z=k?lf(af(k),Te):"",K=te=>v({visibility:ge&&!b?"":"hidden",css:jt(Te,te),elementWidth:B.width/te.scaleX,shiftX:(B.left-Te.left)/te.scaleX,shiftY:(B.top-Te.top)/te.scaleY,radius:z});let ce=K(A);if(!je){const te=a.getBoundingClientRect();te.width>0&&!Ts({left:te.left,top:te.top,width:te.width,height:te.height},Te)&&(A=Is(te,jt(Te,A),A),ce=K(A)||ce)}return ce},V=()=>{if(!w)return!1;let B=F();const j=d.getBoundingClientRect().height;j>0&&j!==M&&(M=j,w.style.height=`${j/ws(w).y}px`,B=!0);const H=getComputedStyle(w).pointerEvents;return H!==R&&(R=H,a.style.pointerEvents=H),B},h=()=>{N?.dispose(),N=void 0},D=B=>{N=Uu({slot:B,own:a,measure:V,onDetached:h})};let U=[];const Y=(B,j)=>{if(O=j,B&&U.length>0){const H=U;U=[],H.forEach(W=>W())}if(B===w){B&&!N&&D(B),V();return}if(h(),w&&w.style.removeProperty("height"),T="",M=0,R="",w=B,!B){F(),S();return}n.onShown?.(d),D(B),V(),E()};u.addDispose(h);const G=B=>{p=!1,f=void 0,s?.(),B&&n.onReload?.(d);let j;g||m===void 0?j=x():(P(),j=m);try{d.contentWindow?.location.reload()}catch{d.src=c}return j};return{element:d,ready(){return m??x()},reload:()=>G(!0),reloadQuietly:()=>G(!1),followReload:()=>{f=void 0,s?.(),n.onReload?.(d)},moveTo(B){if(a.parentNode===B)return m??x();p=!1,f=void 0,s?.();let j;return g||m===void 0?j=x():(P(),j=m),B.appendChild(a),n.onReload?.(d),T="",N?.schedule(),j},get shown(){return w!==null},get slot(){return w},whenShown(){return w!==null?Promise.resolve():new Promise(B=>{U.push(B)})},get filled(){return f},noteFilled(B){f=B},alignTo(B,j){Y(B,j??null)},hold(B){b!==B&&(b=B,F())},scrollBy(B,j){let H=B,W=j;for(let X=w?Le(w):null;X;X=Le(X)){if(Math.abs(H)<1&&Math.abs(W)<1)return;const Ie=getComputedStyle(X);if((Ie.overflowY==="auto"||Ie.overflowY==="scroll")&&X.scrollHeight>X.clientHeight){const ge=X.scrollTop,je=X.scrollLeft;X.scrollBy({left:H,top:W,behavior:"instant"}),H-=X.scrollLeft-je,W-=X.scrollTop-ge}}(Math.abs(H)>=1||Math.abs(W)>=1)&&window.scrollBy({left:H,top:W,behavior:"instant"})},resize(){C?.resize()},dispose(){Y(null,null),S(),u.dispose(),a.remove()}}}function df(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",o=(A,T)=>A==="email"?`email:${T??n}`:A,s=new Map;let i,a=[],c=!1,d,u,p=!1,f,g,y="shown",_=0,m,I,P;const x=A=>u!==void 0&&A.filled!==void 0&&A.filled!==u,L=()=>{m=void 0;const A=f;!p||!A||u===void 0||I===u||!x(A)||(I=u,e.onForeignDocument?.({wanted:u,filled:A.filled,role:y,heldMs:Date.now()-_}))},C=()=>{p=!1,f=void 0,g=void 0,clearTimeout(m),m=void 0},E=(A,T)=>{const R=s.get("email"),M=R?.slot??null;return A&&M&&x(A)?(A.alignTo(null),p||(p=!0,_=Date.now(),m=setTimeout(L,Ju)),y=T,f=A,!(i!==void 0||c)&&g!==A&&(g=A,e.onShown?.(A.element)),!d&&!i&&(d=Gn(M)),!1):(p&&(C(),d?.remove(),d=void 0),A?.alignTo(M,R?.clip??null),!0)},S=()=>{p&&!c&&E(t.get(o("email")),"shown")},w=()=>{a.forEach(A=>clearTimeout(A)),a=[],i?.remove(),i=void 0,d?.remove(),d=void 0,(c||p)&&(c=!1,E(t.get(o("email")),"shown"))},O=(A,T,R)=>{const M=o(A,T),v=t.get(M);if(v)return v;const b=e.resolveMount();if(!b)return of();const F=cf(A,b,e,A==="email"?T??n:void 0,R,A==="email"?()=>S():void 0);return t.set(M,F),F},N={get:A=>O(A),current:A=>O(A),peek:A=>t.get(o(A)),spare:()=>t.get(o("email",r())),ensureSpare:()=>O("email",r(),!0),promote(){const A=t.get(o("email",r()));if(!A)return;const T=t.get(o("email"));n=r(),P=void 0,E(A,"spare"),T?.alignTo(null)},alignSurface(A,T,R){const M=s.get(A);if(s.set(A,{slot:T,clip:R??null}),A==="email"&&c){d?.remove(),d=T?Gn(T):void 0;return}const v=T?O(A):t.get(o(A));if(A!=="email"){v?.alignTo(T,R??null);return}if(!T){P=M?.slot&&v?.shown?{slot:M.slot,handle:v}:void 0,p&&(C(),d?.remove(),d=void 0),v?.alignTo(null);return}const b=P?.slot===T&&P.handle===v;if(P=void 0,M?.slot===T&&v?.shown||b){v?.alignTo(T,R??null);return}E(v,"shown")},want(A){u=A,A!==void 0&&S()},noteFilled(A,T){const R=N.byWindow(A);R&&(R.noteFilled(T),R===t.get(o("email"))&&S())},visible(){for(const A of t.values())if(A.shown)return A},byWindow(A){if(A){for(const T of t.values())if(T.element.contentWindow===A)return T}},busy(A){if(w(),!A)return;if(!N.visible()){c=!0,d?.remove(),d=void 0;const M=s.get("email");M?.slot&&(d=Gn(M.slot)),a=[setTimeout(w,Ps)];return}const T=e.resolveMount();if(!T)return;const R=nf(T,()=>N.visible()?.element.parentElement?.getBoundingClientRect()??null);i=R,a=[setTimeout(()=>R.showSpinner(),Ds),setTimeout(w,Ps)]},remount(A){w();const T=o("email");t.forEach((R,M)=>{if(M===T){R.moveTo(A).catch(()=>{});return}R.dispose(),t.delete(M)})},dispose(){u=void 0,c=!1,C(),P=void 0,w(),t.forEach(A=>A.dispose()),t.clear(),s.clear(),n="a",u=void 0,I=void 0}};return N}var uf=l.createIdentifier$1("canvas.resizerBinder"),Yn=l.createIdentifier$1("canvas.service"),ff={created:oe.canvasCreated,loaded:oe.canvasLoaded},ks=new WeakMap;function Wn(e){return ks.get(e)??0}function pf(e,t){if(e.getInstance(Yn))return;const n=df({resolveMount:()=>t.resolveMount(),resolveSrc:o=>t.resolveSrc(o),resolveSandbox:Zd,elementId:t.elementId,bindResizer:o=>e.getInstance(uf)?.(o),onCreated:o=>st(e,o,"fresh"),onReload:o=>{ks.set(o,Wn(o)+1),st(e,o,"fresh")},onShown:o=>{const s=n.byWindow(re(e).getTarget());s&&s.element!==o&&Ns(s.element)===Ns(o)||st(e,o,"switch")},mark:o=>t.mark?.(ff[o]),onForeignDocument:o=>{({...o},jl("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=re(e).addListener(l.EVENT_TYPES.SANDBOX_WHEEL,o=>{n.visible()?.scrollBy(o?.deltaX??0,o?.deltaY??0)});e.inject(Yn,n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function Ns(e){return e.parentElement?.dataset.canvasHost}function st(e,t,n){const r=re(e),o=t.contentWindow;if(!o)return;const s=r.getTarget()===o;s&&n==="switch"||(n==="fresh"&&(r.forget(o),s&&r.setTarget(void 0)),r.setTarget(o),Ml(r))}function hf(e,t){st(e,t,"promote")}function mf(e,t){st(e,t,"switch")}function gf(e,t){const n=t.contentWindow;n&&re(e).greet(n)}function Ls(e,t){const n=t.contentWindow;n&&re(e).forget(n)}function vf(e,t){const n=ne(e)?.byWindow(t)?.element;if(!n)return;const r=Wn(n);return()=>Wn(n)!==r}function ne(e){return e.getInstance(Yn)}function Ms({attributes:e,readContent:t,docId:n,hasSession:r,serverId:o,show:s}){if(!r)return;const i={id:o??void 0,renderGuid:n,showId:s?.id,isNew:o==null,showToken:s?.token},a={...e,...i};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}function Ht(e){return{...Ms({attributes:e.get().attributes,readContent:()=>e.getContent(),docId:e.get().docId,hasSession:!0,serverId:e.get().serverId,show:void 0}),html:e.getContent()}}function $t(e){const t=se(e),n=t.current();if(!n||!Q(t.sessionKey()))return;const r=Ht(n),o=n.isDirty();ie(e,l.events.ON_BLOCK_CLOSE_ID).fire({block:r,hasUnsavedChanges:o})}function Ef(e){const t=se(e);return!t.current()||!Q(t.sessionKey())?!1:($t(e),t.hasSuspended()?t.resumeSuspended()!==void 0:!1)}function _f(e){const t=se(e),n=re(e),r=()=>e.getInstance(l.INIT_PIPELINE_ID)??Hn;let o,s,i=!1,a=!1,c,d;const u=R=>Ht(R),p=()=>{const R=x(),M=R?.get().docId;if(!R||!M||M!==c||i)return;const v=R.get().version;v!==d&&(d=v,ie(e,l.events.ON_BLOCK_CHANGED_ID).fire(u(R)))};let f;const g=R=>{const M=t.showFacts();!M||M.id===f||!Un(R,M.id)||(f=M.id,R.completeShow(M.id))},y=async(R,M,v)=>{const b=v.generation,F=()=>v.generation!==b||v.signal.aborted||t.current()!==R||a,V=ue(n);let h;const D=new Promise(Y=>{h=At(n,()=>Y("regenerated"))}),U=async(...Y)=>await Promise.race([Ne(...Y).then(()=>"sent"),D])==="sent";i=!0;try{if(!await U(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:M},void 0,v)||F())return;const{html:Y,hasBrowserExtensionArtifacts:G}=vs(Mt(R));if(G&&ie(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),Es(R,Y),!await U(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,Ft(Mt(R),M,ye(e).editorPolicy,R.get().version),void 0,v)||F()||!await U(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:M},void 0,v)||F())return;o=M,s=V,L(),d=R.get().version,c!==M&&(c=M,ie(e,l.events.ON_BLOCK_INIT_ID).fire(u(R))),g(v)}finally{h?.(),i=!1,ue(n)!==V&&S()}};let _,m,I;const P=()=>{const R=ne(e)?.peek("block");return R?.reload?(R.reload().catch(()=>{}),!0):!1},x=()=>Q(t.sessionKey())?t.current():void 0,L=()=>{const R=x()?.get().docId,M=!R||I===R||o===R&&s===ue(n);ne(e)?.peek("block")?.hold(!M)},C=()=>{if(a||(L(),p(),i))return;const R=x(),M=R?.get().docId;if(!R||!M)return;if(o===M&&s===ue(n)){g(r());return}if(!R.isReady())return;const v=r();v.signal.aborted||o!==void 0&&o!==M&&_!==M&&(_=M,P())||y(R,M,v).catch(()=>{if(!(a||t.current()!==R)){if(m!==M){m=M,P();return}I=M,L()}})};let E=!1;const S=()=>{E||a||(E=!0,queueMicrotask(()=>{E=!1,C()}))};let w,O;const N=()=>{const R=x(),M=R?.get().docId;M!==O&&(w?.(),O=M,w=R?.subscribe(S)),L(),S()},A=t.subscribe(N),T=At(n,()=>{L(),S()});N(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a=!0,T(),w?.(),A()})}function bf(e){const t=se(e);let n="email";const r=()=>{if(!t.current())return;const s=Q(t.sessionKey())?"block":"email",i=ne(e);if(s===n||!i)return;n=s;const a=i.peek(s);if(a){mf(e,a.element);return}i.get(s)},o=t.subscribe(r);e.getInstance(l.DISPOSABLE_ID)?.addDispose(o)}var yf=200;function Sf({startVersion:e,limit:t=yf}){let n=[],r=e;const o=s=>{n=n.filter(i=>i.version>s),r=Math.max(r,s)};return{record(s){!s.changes?.length&&!s.contentReplaced||(n.push(s),n.length>t&&o(n[n.length-t-1].version))},rebase(s,i){if(i<r)return null;const a=n.filter(d=>d.version>i);o(i);let c=s;for(const d of a){if(d.contentReplaced||!d.changes)return null;const u=d.changes,p=[];for(const f of c){if(d.fromCanvas&&u.some(y=>f.range.start<=y.oldEnd&&f.range.end>=y.oldPosition))return null;const g=Kl(f.range,u,"after");if(!g)return null;p.push({range:g,text:f.text})}c=p}return c}}}function wf(e,t){let n=0;return e.map(({start:r,end:o,text:s})=>{const i=new he(r,t.slice(r,o),r+n,s);return n+=s.length-(o-r),i})}function If(e,t){const n=[...e].sort((r,o)=>r.range.start-o.range.start);return wf(n.map(({range:r,text:o})=>({start:r.start,end:r.end,text:o})),t)}function Tf(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Cf=32;function Af(e=Cf){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 qn=l.createIdentifier$1("canvas.sandboxFill");function xs(e){return e.getInstance(qn)?.pipeline.isEventsLocked()===!0}function it(e){tt(e,{origin:"canvas-channel"})}function Df(e){const t=se(e),n=re(e);let r;const o=(c,d)=>{const u=c.get().docId;let p=!1,f=null,g=null;const y=Sf({startVersion:c.get().version});let _=c.getContent();const m=Af();let I=!0;const P=(O,N)=>{!I||t.current()!==c||(tt(N,{origin:"canvas-channel"}),n.sendAsync(l.EVENT_TYPES.SANDBOX_SET_ENTITY,Ft(Mt(c),u,ye(e).editorPolicy,c.get().version)).catch(it))},x=async(O,N)=>{if(g){g.push({edits:O,rev:N});return}g=[{edits:O,rev:N}];try{do{const A=g.splice(0,g.length);await n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:A.map(T=>T.edits),guid:u,rev:A[A.length-1].rev})}while(g.length)}catch(A){P("app edits failed to reach the canvas",A)}finally{g=null}},L=(O,N)=>{const A=g?.splice(0,g.length)??[];A.length&&n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:A.map(R=>R.edits),guid:u,rev:A[A.length-1].rev}).catch(it);const T={edits:[O],guid:u,rev:c.get().version,...N!==null?{changeId:N}:{}};N!==null&&m.remember(N,ue(n),T),n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,T).catch(it)},C=O=>{const{guid:N,pushUndoStop:A}=O;if(N!==u)return;const T=sc(O),R=T.changeId!==null?m.find(T.changeId,ue(n)):void 0;if(R){n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,R).catch(it);return}let{edits:M}=O;if(T.baseRev!==null){const b=y.rebase(M,T.baseRev);if(!b){tt(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),L([],T.changeId);return}M=b}const v=c.get().version;try{p=!0,f=T.changeId;const b=If(M,c.getContent());A===!1?d.applyWithoutHistory(b):c.mutate({changes:b},{source:xs(e)?"system":"user"})}catch(b){P("canvas batch failed to apply",b);return}finally{p=!1,f=null}c.get().version===v&&T.baseRev!==null&&L([],T.changeId)},E=c.subscribe(({changes:O,version:N})=>{const A=c.getContent(),T=!O?.length&&A!==_;if(_=A,y.record({version:N,changes:O,contentReplaced:T,fromCanvas:p}),!O?.length)return;const R=Tf(O);p?L(R,f):x(R,N).catch(it)}),S=n.addListener(l.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,C),w=n.addListener(l.EVENT_TYPES.APPLICATION_SYNC_DRIFT,O=>{O.reason==="echo-timeout"&&P("canvas lost the echo of its batch",new Error(`canvas echo timeout, ${O.unsent??0} edits unsent`))});return()=>{I=!1,E(),S.dispose(),w.dispose()}};let s;const i=()=>{const c=t.current(),d=t.history(),u=c?.get().docId;u!==s&&(r?.(),r=void 0,s=u,c&&d&&(r=o(c,d)))},a=t.subscribe(i);i(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.(),a()})}function Pf(e){const t=re(e),n=()=>ne(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(l.EVENT_TYPES.RELOAD,()=>{n()?.followReload()}),o=t.addOffTargetListener(l.EVENT_TYPES.RELOAD,a=>{const c=ne(e)?.byWindow(a);c&&Ls(e,c.element)}),s=t.addListener(a=>{a.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),i=q(e,l.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),o.dispose(),s.dispose(),i.dispose()})}function Fs(){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 Of(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);let n,r;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),pf(e,{resolveMount:()=>n,resolveSrc:s=>us(s==="block"),elementId:"email_iframe",mark:s=>J(s)}),t?.watch(s=>{const i=s?.element;if(n&&i instanceof HTMLElement&&i!==n){n=i,ne(e)?.remount(i),r?.remove(),r=void 0;return}if(!n){if(i instanceof HTMLElement)n=i;else if(s!==void 0){n=r??=Fs(),ne(e)?.alignSurface("email",r,r);return}else return;ne(e)?.get("email")}});let o;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{o?.remove(),o=void 0}),hd(e).watch(s=>{const i=ne(e);if(i){if(s){o??=Fs(),i.alignSurface("email",o,o);return}o&&(i.alignSurface("email",null),o.remove(),o=void 0)}})}var Kn=l.createIdentifier$1("canvas.headerFlow"),Bs=["subject","preheader"],js=3e3,Rf=3,kf={subject:l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function Nf(e){const t=se(e),n=re(e),r=C=>C?"remote":xs(e)?"system":"user",o=(C,{guid:E,value:S,forced:w})=>{const O=Ve(t);if(!O||typeof S!="string"||E&&E!==O.get().docId)return;const N=t.forcedHeaders();if(N?.[C]!==void 0&&!w&&S!==N[C])return;const A=O.get().attributes[C];if(!w&&g(C,S,A))return;const T=!w&&p.delete(C);w&&(m.delete(C),m.size===0&&t.endForcedHeaders()),c=!0;try{Ge(O,{[C]:S},{source:T?"system":r(w)})}finally{c=!1}s[C]=S};let s={},i,a,c=!1,d=Promise.resolve();const u={},p=new Map,f=(C,E)=>{s[C]=E;const S={};p.set(C,S);const w=()=>{p.get(C)===S&&p.delete(C)};y(C,E,{force:!0}).then(w),setTimeout(w,js)},g=(C,E,S)=>{const w=t.showFill();if(!w||typeof S!="string")return!1;const O=u[C]?.showId===w.showId?u[C]:void 0;return E===S?(u[C]=O??{showId:w.showId,codeEdits:w.codeEdits,corrections:0},!1):O&&w.codeEdits>O.codeEdits&&E!==O.stale?!1:((!O||E===O.stale&&O.corrections<Rf)&&(u[C]={showId:w.showId,stale:E,codeEdits:w.codeEdits,corrections:(O?.corrections??0)+1},f(C,S)),!0)},y=(C,E,{force:S=!1,echo:w=!1,undoStep:O=!1})=>(d=n.sendAsync(kf[C],{value:E,guid:Ve(t)?.get().docId,...S?{force:!0}:{},...w?{echo:!0}:{},...O?{undoStep:!0}:{}}).catch(N=>{}),d);let _;const m=new Set;e.inject(Kn,{whenDelivered:async()=>{await d},reassert:C=>{const E=Ve(t),S=Bs.filter(w=>typeof C[w]=="string");if(!(!E||S.length===0)){c=!0;try{Ge(E,Object.fromEntries(S.map(w=>[w,C[w]])),{source:"system"})}finally{c=!1}t.beginForcedHeaders(Object.fromEntries(S.map(w=>[w,C[w]]))),clearTimeout(_),_=setTimeout(()=>{m.clear(),t.endForcedHeaders()},js),m.clear();for(const w of S)m.add(w);for(const w of S)s[w]=C[w],y(w,C[w],{force:!0,echo:!0})}}});const I=()=>{i?.(),i=void 0;const C=Ve(t);if(C!==a&&p.clear(),a=C,!C){s={};return}const E=C.get().attributes;s={subject:E.subject,preheader:E.preheader},i=C.subscribe(({source:S})=>{if(c)return;const w=C.get().attributes,O=t.forcedHeaders();for(const N of Bs){const A=w[N];if(A===s[N])continue;s[N]=A,p.delete(N);const T=S==="system"&&O?.[N]!==void 0;y(N,A??"",{force:T,echo:T,undoStep:S==="user"})}})};I();const P=t.subscribe(I),x=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,C=>o("subject",C)),L=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,C=>o("preheader",C));e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{x.dispose(),L.dispose(),P(),i?.(),clearTimeout(_)})}function Lf(e){const t=se(e);let n={document:void 0,seq:0};const r=()=>{const s=t.recoveryFacts(),i=Ve(t);if(!s?.applied||!i||String(s.emailId)!==String(i.get().serverId)||(n.document!==i&&(n={document:i,seq:0}),s.applied.seq<=n.seq))return;n={document:i,seq:s.applied.seq};const a=t.shownHeaders();(a.subject!==void 0||a.preheader!==void 0)&&e.getInstance(Kn)?.reassert(a)},o=t.subscribe(r);e.getInstance(l.DISPOSABLE_ID)?.addDispose(o)}function Mf(e,t){return(e&&e!=="system"?e:t?"dark":"light")==="dark"?l.DARK:l.LIGHT}function xf(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 Ff(e){return e.isCodeMode&&(e.direction==="left"||e.direction==="right")}function Us(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function zn(e,t){const n={...e};for(const r of Object.keys(t)){const o=t[r],s=e[r];Us(o)&&Us(s)?n[r]=zn(s,o):o!==void 0&&(n[r]=o)}return n}function Bf(e,t){const n=l.COMMON_STYLES;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 zn(n,o)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?zn(n,t):n}var jf=ae(void 0),Hs=jf,$s=l.createIdentifier$1("CodeMode");function Vs(){let e;try{const t=window.localStorage?.getItem(l.LOCAL_STORAGE_ITEMS.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 Uf(e){try{window.localStorage?.setItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function Xn(e){return e.getOrCreateInstance($s,()=>{const t=ae(Vs());return t.watch(Uf),t})}function Gs(e){return e?.getInstance($s)?.get()??Vs()}function Jn(e,t){const n=Xn(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function Hf(e,t){const n=Xn(e);n.set({...n.get(),direction:t})}var $f=l.createIdentifier$1("DefaultCommonStyles");function Ys(e){return e.getOrCreateInstance($f,()=>ae(void 0))}function Vf(e,t){Ys(e).set(t)}var Gf=l.createIdentifier$1("CanvasViewport"),Yf=l.createIdentifier$1("CanvasPreviewPage");function Se(e,t,n){let r,o;const s=()=>{if(!r||!e.isInited())return;const c=r.value===void 0?"undefined":JSON.stringify(r.value);c!==o&&(o=c,e.send(t,r.value))},i=n.watch(c=>{r={value:c},s()}),a=e.onInit(()=>{o=void 0,s()});return{dispose(){i.dispose(),a.dispose()}}}function Vt(e){const t=ae(e());return{source:t,refresh:()=>t.set(e())}}function Wf(e){const t=re(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=e.getInstance(l.OPTIONS_SOURCE_ID),o=se(e),s=Xn(e),i=matchMedia(l.PREFERS_COLOR_SCHEME_DARK),a=()=>n?.get()??{};let c;const d=Vt(()=>Mf(Hs.get()??a().theme,i.matches)),u=Vt(()=>xf(a(),Q(o.sessionKey()))),p=Vt(()=>a().lockEditor),f=Vt(()=>Bf(o.current()?.get().attributes?.common_styles,c)),g=e.getOrCreateInstance(Gf,()=>ae()),y=e.getOrCreateInstance(Yf,()=>ae()),_=[Se(t,l.CANVAS_FACTS.theme,d.source),Se(t,l.CANVAS_FACTS.flags,u.source),Se(t,l.CANVAS_FACTS.lockEditor,p.source),Se(t,l.CANVAS_FACTS.commonStyles,f.source),Se(t,l.CANVAS_FACTS.codeMode,s.select(Ff)),Se(t,l.CANVAS_FACTS.appName,ae("emailmaker")),Se(t,l.CANVAS_FACTS.previewPage,y),Se(t,l.CANVAS_FACTS.viewport,g)],m=()=>{d.refresh(),u.refresh(),p.refresh()},I=n?.watch(m),P=Ys(e).watch(O=>{c=O,f.refresh()}),x=r?.watch(O=>{O&&"commonStyles"in O&&(c=O.commonStyles),f.refresh()});let L;const C=()=>{L?.(),L=o.current()?.subscribe(()=>f.refresh()),f.refresh(),u.refresh()};C();const E=o.subscribe(C),S=()=>d.refresh();i.addEventListener("change",S);const w=Hs.watch(()=>d.refresh());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{_.forEach(O=>O.dispose()),I?.dispose(),P.dispose(),x?.dispose(),L?.(),E(),i.removeEventListener("change",S),w.dispose()})}var Qn;(function(e){function t(o,s,i=(a,c)=>a===c){if(o===s)return!0;if(o.length!==s.length)return!1;for(let a=0;a<o.length;a++)if(!i(o[a],s[a]))return!1;return!0}e.isEqual=t;function n(o,s=i=>i){const i=new Set;return o.filter(a=>{const c=s(a);return i.has(c)?!1:(i.add(c),!0)})}e.unique=n;function r(o=[],s=[],i=(a,c)=>a===c){const a=[],c=[],d=[];for(const u of o){const p=s.find(f=>i(u,f));p?d.push({prev:u,next:p}):c.push(u)}for(const u of s)o.find(p=>i(u,p))||a.push(u);return{added:a,removed:c,exists:d}}e.diff=r})(Qn||(Qn={}));function qf(e,t){return e.type===t.type&&e.key===t.key}function Kf(e){const t=re(e),n=()=>e.getServices(l.SANDBOX_EXTENSIONS_ID)??[];let r=[];const o=t.onInit(()=>{r=n(),t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,r)}),s=l.getServiceContainerId(l.SANDBOX_EXTENSIONS_ID),i=e.onInject(a=>{if(a!==s)return;const c=n();if(!t.isInited()){r=c;return}const{added:d,removed:u}=Qn.diff(r,c,qf);if(r=c,u.length){if(u.some(p=>p.type==="script")){t.send(l.EVENT_TYPES.RELOAD);return}t.send(l.EVENT_TYPES.SANDBOX_REMOVE_EXTENSIONS,u.map(p=>p.key))}d.length&&t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,d)});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{o.dispose(),i?.dispose()})}var zf=new Set([...Object.values(l.EVENT_TYPES).map(e=>String(e)),"INIT_MESSAGE","FETCH_USER","USER_LOGGED_IN",String(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID)]);function Xf(e){return e.length>0&&!e.startsWith("em:")&&!zf.has(e)}function Jf(e){const t=re(e),n=new Map;let r=!1,o=-1,s=new Set;const i=d=>(d!==o&&(o=d,s=new Set),s),a=t.observeOutgoing((d,u)=>{if(!r||!Xf(d))return;const p=ue(t);n.set(d,{data:u,generation:p,scripts:new Set(i(p))})}),c=t.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,d=>{if(d.phase!=="ready"||d.status!=="success")return;r=!0;const u=ue(t),p=i(u);p.add(d.key);for(const[f,g]of n)g.generation===u||![...g.scripts].every(y=>p.has(y))||(g.generation=u,t.send(l.createIdentifier(f),g.data))});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a.dispose(),c.dispose()})}var Qf=l.createIdentifier$1("prewarm.editorVisible");function Zf(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function ep(e={}){const t=e.paint??Zf;let n=!1,r=!1,o=!1,s=!1,i=!1;const a=[],c=()=>{i||s||!n||!r||!o||(s=!0,t(()=>{i=!0,J(oe.editorVisible);for(const d of a.splice(0))d()}))};return{noteShellVisible(){n=!0,c()},notePagePainted(){r=!0,c()},noteContentShown(){o=!0,c()},whenVisible(d){if(i){d();return}a.push(d)},contentShown:()=>o}}function tp(e){return e.getOrCreateInstance(Qf,()=>ep())}var np=500,rp=500,op=5e3;function sp(e){const t=e.quietMs??np,n=e.floorMs??rp,r=e.ceilingMs??op;let o,s,i=0;const a=()=>{clearTimeout(o),clearTimeout(s),o=void 0,s=void 0},c=()=>{a(),e.run()},d=()=>{clearTimeout(o);const u=n-(Date.now()-i);o=setTimeout(c,Math.max(t,u))};return{start(){a(),i=Date.now(),s=setTimeout(c,r),d()},notify(){o!==void 0&&d()},cancel:a}}var ip=2;function Ws(){return new Error("[sandbox] document reloaded during fill")}function ap(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function Zn(e){try{e()}catch{}}function lp(e){let t;return Zn(()=>{t=e()}),{stage:n=>Zn(()=>t?.stage(n)),end:(n,r)=>Zn(()=>t?.end(n,r))}}function cp(e){const t=()=>e.initPipeline();let n=!1,r,o,s,i=0,a,c;const d=()=>{const E=e.readTarget?.(),S=e.readSandboxGeneration?.();return E===void 0||S===void 0?void 0:{target:E,generation:S}},u=()=>{const E=d();return E&&{...E,canvasReplaced:e.trackDocument?.(E.target)}},p=E=>{if(E?.canvasReplaced?.())return!0;const S=d();return E!==void 0&&S?.target===E.target&&S.generation!==E.generation},g=Ru({...e,waitScope:()=>({getSandboxTimeoutMs:E=>t().getSandboxTimeoutMs(E),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal}),frameWatch:()=>{const E=c;if(!(!E||!e.onSandboxGenerationChange))return{getGeneration:()=>d()?.generation??E.generation,onChange:S=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===E.target||E.canvasReplaced?.())&&S()})??(()=>{})}}});let y;const _=(E,S)=>{if(y===E)return;y=E;const w=i;setTimeout(()=>{i!==w||t().signal.aborted||x(E,S).catch(()=>{})},0)},m=()=>{a?.abort(),a=void 0};let I;const P=()=>{const E=t().signal;E!==I&&(I?.removeEventListener("abort",m),I=E,E.addEventListener("abort",m))};async function x(E,S,w=0){const O=++i;m(),a=new AbortController,c=void 0,P();const N=()=>i!==O,A=g.readTarget(),T=t().generation,R=()=>T===t().generation&&!t().signal.aborted,M=S?"init:reset-":"init:",v=lp(()=>e.observeShow?.(ap(E,S,e.readEmail())));if(!S){const Y=g.publicEmail();Y?.id,Y?.renderGuid,Y?.preheader}let b=!1,F=!1,V,h=!1;const D=()=>{if(p(V))throw Ws()},U=()=>{if(N())throw l.createAbortError("Fill superseded")};try{n=!0,await g.sendInitStart(),U(),V=u(),c=V,w===0&&g.fireWillInit(),await(S||w>0?g.refreshContent():g.sendContent()),b=!0,U(),D();const Y=g.contentSent();g.noteFilled(Y?.target,Y?.docId),v.stage("content"),S||g.publicEmail()?.id;try{await g.sendPreheader()}catch(G){if(_s(G)||N())throw G;`${M}`,String(G)}U();try{await g.sendSubject()}catch(G){if(_s(G)||N())throw G;`${M}`,String(G)}if(U(),D(),g.showFilled(A),await g.sendInited(),U(),D(),F=!0,o===E){const G=e.readSandboxGeneration?.()??s;G!==void 0&&(r=G)}v.stage("reveal"),await g.revealFilled(),D(),v.end("revealed")}catch(Y){const G=!N()&&R()&&p(V),B=G?Ws():void 0,j=B??Y,H=G&&w<ip?C(E,S,w+1):void 0;h=G&&H===void 0;const W=N()?void 0:{showId:E,contentApplied:b,sandboxInitedAcked:F,superseded:!1,...e.describeSurface?.(),error:String(B??Y)};W&&(`${M}`,void 0);const X=!N()&&e.recoverFailedFill?.(A)===!0;if(v.end(N()?"superseded":X?"recovered":l.isAbortError(j)||!R()?"aborted":"failed",W),!X&&!N()&&Un(t(),E)&&t().failShow(E,j),H!==void 0)return H;throw j}finally{L(E,S,M,{superseded:N(),sessionGeneration:T,contentApplied:b,sandboxInitedAcked:F&&!h,retry:!h,commit:R()})}}function L(E,S,w,O){const{superseded:N,contentApplied:A,sandboxInitedAcked:T}=O;if(N){`${w}`;return}T&&O.commit?g.fireInit(E,S||void 0):T?(`${w}`,O.sessionGeneration,t().generation,t().signal.aborted,void 0):A?(`${w}`,void 0):(`${w}`,void 0),n=!1,a=void 0,!T&&o===E&&(o=void 0,r===s&&(r=void 0)),!T&&A&&O.retry&&_(E,S)}function C(E,S,w){return x(E,S,w)}return{channel:g,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:E=>{r=E},lastCorrelation:()=>o,markCorrelation:E=>{o=E},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:E=>{s=E},fill:E=>x(E,!1),refill:E=>x(E,!0),stop:()=>{i+=1,m(),n=!1,I?.removeEventListener("abort",m),I=void 0}}}function dp(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:qs(e,n)}function qs(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function up(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:o,readSandboxGeneration:s}=e,i=u=>{const p=n(),f=o();if(!dp(p,u,f)){u.showId,u.navId,u.emailId,p?.id,p?.showId,p?.renderGuid;return}u.showId,p?.id,p?.renderGuid,t.markFilled(s()),t.markCorrelation(u.showId),t.fill(u.showId).catch(()=>{})};return{showRequested:u=>{i(u)},showRequestIdentityChanged:()=>{const u=e.initPipeline().getActiveShowRequest();u&&i(u)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const u=s();if(t.filledGeneration()===u)return;const p=n(),f=o();if(!p?.renderGuid||!qs(p,f))return;const g=`${bs}${p.renderGuid}`;t.markFilled(u),t.markCorrelation(g);const y=r()?.isReady()===!0;p.id,p.renderGuid,(y?_=>t.refill(_):_=>t.fill(_))(g).catch(()=>{t.lastCorrelation()===g&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id,r()}}}var fp=l.createIdentifier$1("canvas.health");function pp(e){return e??""}function hp(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Ks(e){return e.length>0}function mp(e){const t=se(e),n=re(e),r=()=>Q(t.sessionKey())?void 0:t.current(),o=()=>{const k=r();return Ms({attributes:k?.get().attributes??{},readContent:()=>k?.getContent(),docId:k?.get().docId,hasSession:!!k,serverId:k?.get().serverId,show:t.showFacts()})},s=()=>e.getInstance(l.INIT_PIPELINE_ID)??Hn;let i={},a=!1;const c=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(k=>{a=!!k?.element});let d=!1,u=!1,p=!1,f=0;const g=()=>{const k=ne(e);if(!k)return;const z=++f,K=k.spare();return K&&Ls(e,K.element),(K?K.reloadQuietly():k.ensureSpare()?.ready())?.then(()=>{if(z!==f)return;d=!0;const ce=k.spare();ce&&gf(e,ce.element),p&&(p=!1,T(),G())})},y=sp({run:()=>{p||g()?.catch(()=>{})}}),_=()=>{tp(e).noteContentShown(),!d&&!p&&y.start()};let m=!1;const I=k=>{const z=ne(e),K=z?.spare()?.element.contentWindow;u&&z&&K&&k===K&&(u=!1,z.promote(),z.busy(!1),m=!0)};let P=!1;const C=cp({container:e,messageService:n,initPipeline:s,readDocument:r,readEmail:o,revealFilled:()=>{const k=ne(e);return m&&k&&(m=!1,y.start()),a?k?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:I,noteFilled:(k,z)=>ne(e)?.noteFilled(k,z),recoverFailedFill:k=>{const z=ne(e),K=z?.spare()?.element.contentWindow;return!u||!z||!K||k!==K?!1:(u=!1,d=!1,N="reload",z.busy(!1),z.peek("email")?.reload(),P=!0,G(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>ue(n),onSandboxGenerationChange:k=>At(n,k),trackDocument:k=>vf(e,k),observeShow:k=>e.getInstance(fp)?.begin(k),describeSurface:()=>({canvasPath:N,promoted:u,spareClean:d,handshake:n.isInited(),generation:ue(n)}),events:{willInit:k=>{ie(e,l.events.WILL_EMAIL_INIT_ID).fire(k)},inited:k=>{_(),ie(e,l.events.ON_EMAIL_INIT_ID).fire(k)},contentChanged:k=>{ie(e,l.events.ON_CONTENT_CHANGED_ID).fire(k)},emailChanged:k=>{ie(e,l.events.ON_EMAIL_CHANGED_ID).fire(k)},browserExtensionDetected:()=>{ie(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),E=up({pipeline:C,initPipeline:s,readEmail:o,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>ue(n)});let S="",w="",O="",N="none";const A=()=>{const k=ne(e)?.spare()?.element.contentWindow;k&&n.getTarget()===k||n.sendNow({operation:l.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0})},T=()=>{const k=ne(e)?.spare();k&&(A(),d=!1,u=!0,hf(e,k.element))},R=(k,z)=>{const K=ne(e);if(!K)return!0;const ce=K.spare(),te=ce&&d?"spare":"prepare";if(N=te,K.busy(!0),ce&&d)return T(),!0;y.cancel(),A();const Ue=g();if(Ue===void 0)return N="reload",K.busy(!1),K.peek("email")?.reload(),!0;p=!0;const Ce=f;return Ue.catch(()=>{!p||Ce!==f||(p=!1,N="reload",K.busy(!1),K.peek("email")?.reload())}),!1},M=()=>{if(Q(t.sessionKey()))return;Ie(),C.noteSandboxGeneration(ue(n));const k=o(),z=hp(k?.renderGuid,k?.showId,k?.id,i.emailId),K=pp(k?.renderGuid);if(K!==w){const Ue=w;w=K;const Ce=ne(e)?.peek("email")?.filled,k_=Ce!==void 0&&Ce!==K;Ks(K)&&(Ks(Ue)||k_)&&R(Ue||(Ce??""),K)}if(p)return;(z!==S||P)&&(P=!1,S=z,E.showRequestIdentityChanged());const ce=r(),te=`${z}|${ce?.get().docId??""}|${ue(n)}`;te!==O&&ce?.isReady()===!0&&(O=te,E.selfInitChanged()),E.saasChanged(),U()};let v=!1,b="",F="",V=!1,h=!1;const D=k=>{k.source==="user"?h=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(V=!0),G()},U=()=>{const k=o();if(!k?.renderGuid)return;const z=C.channel.readContent(),K=JSON.stringify([k.preheader,k.common_styles,k.meta,k.subject,k.utm_parameters?.utm_campaign??"",k.utm_parameters?.utm_content??"",k.utm_parameters?.utm_medium??"",k.utm_parameters?.utm_source??"",k.utm_parameters?.utm_term??""]),ce=v&&z!==F,te=v&&K!==b;v=!0,F=z,b=K;const Ue=V&&!h;if(V=!1,h=!1,C.isEventsLocked()||Ue)return;const Ce={...k,id:i.isTemplate||k.isNew?void 0:k.id,html:z};if(ce){ie(e,l.events.ON_CONTENT_CHANGED_ID).fire(z),ie(e,l.events.ON_EMAIL_CHANGED_ID).fire(Ce);return}te&&k.is_inited&&ie(e,l.events.ON_EMAIL_CHANGED_ID).fire(Ce)};let Y=!1;const G=()=>{Y||(Y=!0,queueMicrotask(()=>{Y=!1,M()}))};e.inject(qn,{pipeline:C,setRoute:k=>{k.emailId===i.emailId&&!!k.isTemplate==!!i.isTemplate||(i=k,G())}});let B,j;const H=()=>{const k=r()?.get().docId;k!==j&&(B?.(),j=k,B=r()?.subscribe(D)),G()};let W,X;const Ie=()=>{const k=e.getInstance(l.INIT_PIPELINE_ID);!k||k===W||(X?.(),W=k,X=k.onShowRequested(z=>E.showRequested(z)))},ge=n.addListener(k=>{k.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&y.notify()}),je=t.subscribe(H),Te=At(n,G);H(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c?.dispose(),X?.(),Te(),je(),B?.(),ge.dispose(),y.cancel(),C.stop()})}function gp(){return l.USEBLOCKS!=="emailmaker"}var vp={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},zs={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}},Xs=zs,Ep=["pro"],er={};function _p(e){er=e}var Js=e=>Ep.includes(e)?Xs:er[e]??er.editor??Xs,tr={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},bp={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},yp={...tr,config:{...tr.config,imageCenterFileManagerView:!1}};_p({pro:zs,editor:bp,simple:gp()?tr:yp,blocks:vp});function Sp(e,t,n=e.getInstance(l.CONFIG_SOURCE_ID)){n?.setMode(t),n?.get()?.codeEnabled===!1&&Gs(e).isCodeMode&&Jn(e,!1)}function wp(e){e.getInstance(l.STANDALONE_ACTIVATED_ID)||e.inject(l.SECURITY_MODULE_ID,void 0)}function Gt(e){return String(e.standaloneKey||"").trim()||void 0}function Ip(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function nr(e){return Ip(e)?!!Gt(e):!1}function at(e){return!!Gt(e)&&!nr(e)}var Tp=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function Qs(e){return e==="server"?"serverSide":e}function Cp({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},o=ae();let s={kind:"pending"},i;const a=new Promise(f=>{i=f}),c=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function d(){s.kind!=="pending"&&o.set(Ln(r,e))}function u(f){if(s.kind!=="pending")return;clearTimeout(c),s=f;const g=Ln(r,e);o.set(g),i(g)}function p(f,g){r[Qs(f)]=g,f==="server"&&s.kind==="pending"?u({kind:"applied"}):d()}return{watch:f=>o.watch(f),select:f=>o.select(f),get:()=>o.get(),ready:()=>a,state:()=>s,layers:()=>({...r}),bootstrap(){const f=Ln(r,e);return Object.fromEntries(Tp.map(g=>[g,f[g]]))},merge(f,g){p(g,{...r[Qs(g)],...f})},replace(f,g){p(g,f)},setMode(f){r.user={...r.user,mode:f},d()},setAdvancedConfigs(f){r.advancedConfigs=f,d()},serverAbsent(f){u({kind:"absent",reason:f})},applyServerResponse(f){s.kind==="pending"&&p("server",{...r.serverSide,...f})},dispose(){clearTimeout(c)}}}var Ap=5e3,Y_="pro";function Dp(){return{...Js("pro")?.config,mergeTags:void 0}}function Pp(e,t){e.getInstance(l.OPTIONS_SOURCE_ID)?.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 Op(e,t){let n;Nn(e).watch(({profile:r})=>{const o=`${r?.theme??""}|${r?.locale??""}`;if(o===n)return;n=o;const s={};r?.theme&&(s.theme=r.theme),r?.locale&&(s.locale=r.locale),t.replace(s,"profile")})}function Rp(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function kp(e,t){let n,r=!1,o;const s=a=>{o??=Nt(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&Sp(e,a,t)},i=Nn(e).watch(({profile:a})=>{const c=a?.email_builder_config,d=Rp(c);if(d===void 0||c===n)return;const u=n===void 0;n=c,!(u&&r)&&s(d)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(i),t.ready().then(a=>{if(!a.configSwither)return;const c=localStorage.getItem("configSwither")||(n===void 0?a.mode:o)||"editor";localStorage.setItem("configSwither",c),r=n===void 0,s(c)})}var Zs="замкнутый контур: app_init не выполняется";function Np(e,t){if(e.getInstance(l.SECURITY_MODULE_ID)){t.serverAbsent(Zs);return}const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(r=>{at(r)&&t.serverAbsent(Zs)});n&&e.getInstance(l.DISPOSABLE_ID)?.addDisposable(n)}async function Lp(e,t){if(e.getInstance(vn)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(l.APP_ID);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function Mp(e){e.injectFactory(l.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=Cp({base:Dp(),env:{modeDefaults:o=>Js(o)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Ap});return Pp(e,r),Op(e,r),kp(e,r),Np(e,r),Lp(e,r),e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var Ke=class extends l.Disposable{_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 $(e,t,n){const r=l.snapshot(e);return(o,s,i)=>{const a=r(async c=>{const d=t?t(c):c;i&&o.bind(i);const u=await o(d);return n?n(u):u},s,i);return()=>a.dispose()}}var xp=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new l.Emitter;this.handleDestroy=$(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Ke(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{}}},rr=l.createIdentifier$1("DestroyableService");function Fp(e){e.injectFactory(rr,(t,n)=>{if(n)return n;const r=e.getInstance(l.DISPOSABLE_ID);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new xp({lifetime:r,options:e.getInstance(l.OPTIONS_SOURCE_ID),getInstance:()=>e.getInstance(l.INSTANCE_ID),release:()=>l.releaseContainer(e.getInstance(l.STORE_ID)??e)})},!0)}function Bp(e){const t=e.getInstance(rr);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var jp=1e3;function ei(e,t,n=jp,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),s=Object.keys(t);if(o.length!==s.length)return!1;for(const i of o)if(!ei(e[i],t[i],n,r+1))return!1;return!0}return!1}function lt(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],s=e[r];ei(o,s)||(n[r]=o)}return n}var Up=({source:e,emailtags:t,group:n,tags:r,...o})=>o;async function Hp(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function $p({emails:e,saveTimeoutMs:t},n,r){const o=t?.()??Tt();let s;try{const i=e.notifySave(n);return await Promise.race([i,new Promise((a,c)=>{s=setTimeout(()=>{const d=new Ct(o);n.value.id,cc(d,Hp(i,r)),c(d)},o)})])}catch(i){throw Po(i),i}finally{s!==void 0&&clearTimeout(s)}}function Vp(e){const{emails:t}=e,n=async(r,o)=>{const s=Up(o),i=r===void 0?void 0:await t.cache.getIfPresent(r),a=i?{...i,...s}:s,c=i?lt(i,s):s,d=u=>{const p=String(u.id??r??l.generateUUID()),f=u.id===void 0?{...u,id:p}:u;return t.cache.addOrUpdate(p,()=>f)};return await d(await $p(e,{prev:i,patch:c,value:a,source:o.source??""},d))};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:l.generateUUID()}},async updateEmail(r,o){return await n(r,o)}}}var or=20;function Gp(e){const t=Yp(e);return e.saveTimeoutMs?Wp(t,e.saveTimeoutMs):t}function Yp({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:o,integratorProject:s}){const i=async(a,c)=>(t.clear(),await t.get(a,{page:c}),(await e.cache.values()??[]).filter(d=>String(d?.parent)===String(a)));return{async readRevisions(a,c=1){const d=await i(a,c);return{revisions:d.slice(or*(c-1),or*c),page:c,hasMore:d.length>or*c}},async readAutosave(a){const c=await r?.(a)??NaN,d=Number.isFinite(c)?c:void 0,u=await n?.(a);if(!u?.asked)return vc(await i(a,1),d);if(!u.revision)return Ro([],d);const p={...u.revision,parent:a,isAutosave:!0};return Ro([p],d,await i(a,1))},async saveAutosave(a,c){const d=await o?.(a),u=s?.();return await e.create({...wc(c),...d!==void 0?{author:d}:{},...u!==void 0?{project:u}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function Wp(e,t){return{...e,async saveAutosave(n,r){const o=t();let s;try{return await Promise.race([e.saveAutosave(n,r),new Promise((i,a)=>{s=setTimeout(()=>a(new Eo(o)),o)})])}catch(i){throw Po(i),i}finally{s!==void 0&&clearTimeout(s)}}}}var qp=class extends l.BaseEmitter{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}},Kp=class extends l.AsyncEmitter{};function W_(e){return e}var ti=class extends l.Disposable{_items=new Map;_onChangeEmitter=new l.Signal;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 l.deepEqual(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,s])=>o)),r=(await this.entries()).filter(([o,s])=>!n.has(o));for(const[o,s]of e)t.push(this.addOrUpdate(o,()=>s)),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 zp(e,{filter:t,order:n="asc",orderBy:r,page:o,pageSize:s=20}={}){const i=e.length;let a=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(d=>{for(const u of c){const p=d[u],f=t[u];return u==="id"||typeof p!="string"?p===f:typeof f=="string"&&p.startsWith(f)}return!0}),a=e.length}return r&&(e=e.sort((c,d)=>(c[r]>d[r]?1:d[r]>c[r]?-1:0)*(n==="asc"?1:-1))),o!==void 0&&(e=e.slice(s*(o-1),s*o)),{data:e,filteredTotal:a,total:i,totalPages:Math.ceil(a/s)}}function Xp(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 Jp(e,t){return ni(e)&&ni(t)?String(e)===String(t):e===t}function ni(e){return typeof e=="string"||typeof e=="number"}var Qp=class extends l.Disposable{_cache=new ti;_readEmitter=new l.AsyncEmitter;_saveEmitter=this.addDisposable(new qp);_removeEmitter=this.addDisposable(new Kp);_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 l.Disposable);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new ti),o=n.addDisposable(new l.AsyncEmitter);t=this._foreignCache[e]={get:async(s,i={})=>{await r.getOrCreate(s,async()=>{try{const c=Xp(await o.fire(s))||[];for(const d of c)d[e]=s,await this._cache.add(d.id,d);return c}catch{return[]}});const a=(await this._cache.values()||[]).filter(c=>{const d=c[e];return d==null||Jp(d,s)});return zp(a,i)},first(s,i={}){return t.get(s,{...i,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=l.generateUUID()),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 s=o?{...o,...t}:t;if(!r)return t=o?lt(o,t):t,await this._saveEmitter.fire({prev:o,patch:t,value:s,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 ct(e){const t=l.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new Qp)}function ri(e){const t=e.getInstance(l.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function oi(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Yt(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function Zp(e,t,n){return e&&!oi(t)&&oi(e)?{...n,meta:e.meta}:n}var eh=l.createIdentifier$1("CurrentProject"),th={};function dt(e){return e?.getInstance(eh)?.get()??th}function sr(e){const t=dt(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var si=ct("plugin.dataSource.emails"),ii=ct("plugin.dataSource.emailRevisions"),ai=xt("plugin.readEmailAutosave"),li=l.createIdentifier$1("emailDocuments.provided");function nh(e){const t=si(e),n=ii(e),r=n.byForeignKey("parent");if(e.getInstance(li))return{emails:t,emailRevisions:n};e.inject(li,!0);const o=()=>Tt(e.getInstance(l.INIT_PIPELINE_ID)?.contentReadyTimeoutMs),s=Vp({emails:t,saveTimeoutMs:o}),i=new Map,a=(c,d)=>u=>{const p=u?.id??d;return(typeof p=="string"||typeof p=="number")&&i.set(String(p),c),u};return zc(e,{...s,createEmail:c=>s.createEmail(c).then(a(Date.now())),updateEmail:(c,d)=>s.updateEmail(c,d).then(a(Date.now(),c))}),Zc(e,Gp({revisions:n,revisionsByEmail:r,readAutosave:async c=>{const d=await ie(e,ai).fire(c);return d.length===0?{asked:!1}:{asked:!0,revision:d[0]??null}},savedAt:async c=>{const d=mc((await t.cache.getIfPresent(c))?.modified),u=i.get(String(c))??NaN;return Number.isFinite(u)&&!(d>=u)?u:d},emailAuthor:async c=>(await t.cache.getIfPresent(c))?.author,saveTimeoutMs:o,integratorProject:()=>dt(e).requested})),ri(e).addDisposable(t.onSave(({prev:c,patch:d,value:u})=>Zp(c,d,u),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function ci(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 rh(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var oh="po",Wt=null;function sh(){const e=typeof __emailmaker__<"u"?__emailmaker__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([oh],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function ih(){return Wt===null&&(Wt=sh().catch(e=>{throw Wt=null,e})),Wt}async function di(e){if(typeof e=="object")return ir(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?ah(t):lh(t)}function ir(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function ah(e){try{return ir(JSON.parse(e))}catch{return}}var ui=!1;async function lh(e){try{return ir((await ih()).parsePoCatalog(e))}catch{ui||(ui=!0);return}}var ch="em_locale",dh="em_ant_locale",uh="locale",fh="ant_locale";function ar(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function fi(e,t){const n=ar(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function ph(){return ar("em_locale")??fi(uh,"em_locale")}function pi(e){try{localStorage.setItem(ch,JSON.stringify(e))}catch{}}function hh(){return ar("em_ant_locale")??fi(fh,"em_ant_locale")}function mh(e,t){try{localStorage.setItem(dh,JSON.stringify({id:e,data:t}))}catch{}}var q_="en_US",gh=8e3;function vh(e,t){const n=e,r=t,o=Object.keys(n).filter(s=>s!=="");return o.length!==Object.keys(r).filter(s=>s!=="").length?!1:o.every(s=>JSON.stringify(n[s])===JSON.stringify(r[s]))}function Eh(e){const t=ph(),n=hh();let r={ready:!1},o;const s=ae(r);let i=0;const a=m=>{r={...r,...m},s.set(r)},c=()=>{r.ready||a({ready:!0})},d=setTimeout(c,e.unlockAfterMs??gh),u=m=>m!==i;let p;async function f(m,I){if(n?.id===m&&n.data&&a({antd:n.data}),!p)return;const P=await p(m).catch(()=>{});!P||u(I)||(a({antd:P}),mh(m,P))}async function g(m,I){const P=await e.askHost(m).catch(()=>null);if(u(I))return!0;if(P==null)return!1;const x=await di(P);return u(I)||(x&&a({catalog:x}),c()),!0}async function y(m,I){const P=await e.readList();if(u(I))return;if("error"in P){a({failure:{kind:"GET_LOCALES_ERROR",error:P.error}}),c();return}const x=P.data.find(C=>C.locale===m);if(!x){rh("em_locale")&&a({catalog:void 0}),c();return}if(ci(t,x)&&(!o||o.catalog===t?.data)){c();return}if(o?.entry&&r.catalog===o.catalog&&ci(o.entry,x)){pi(o.entry),c();return}const L=await e.readCatalog(m);if(!u(I)){if("error"in L){a({failure:{kind:"GET_LOCALE_ERROR",error:L.error}}),c();return}L.data&&(o?.id===m&&r.catalog===o.catalog&&vh(o.catalog,L.data)||a({catalog:L.data}),pi({id:m,time:x.updatedAt||Math.floor(Date.now()/1e3),hash:x.contentHash,data:L.data})),c()}}async function _(m,I){if(!await g(m,I)){if(!u(I)&&(o?.id===m&&r.catalog===o.catalog||m==="en_US")&&c(),e.canUseNetwork&&!e.canUseNetwork()){c();return}await y(m,I)}}return{set(m){if(!m||m===r.id)return;const I=i+=1;a({id:m,failure:void 0});const P=o?.id===m&&r.catalog===o.catalog;(o&&!P&&r.catalog===o.catalog||m==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===m&&t.data&&(a({catalog:t.data}),c()),f(m,I),_(m,I)},prime(m,I,P){r.id&&r.id!==m||r.catalog||!I||(o=t?.id===m&&t.data&&(!P||t.time>=P.time)?{id:m,catalog:t.data}:{id:m,catalog:I,entry:P?{id:m,time:P.time,hash:P.hash,data:I}:void 0},a({catalog:o.catalog}))},useAntdLoader(m){p=m,r.id&&f(r.id,i)},state:s,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var _h=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})},bh=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:s,baseUrl:i,cancelToken:a,...c})=>{const d=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,d),p=o&&this.toQueryString(o),f=this.contentFormatters[r||"application/json"],g=s||u.format;return this.customFetch(`${i||this.baseUrl||""}${n}${p?`?${p}`:""}`,{...u,headers:{...u.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(a?this.createAbortSignal(a):u.signal)||null,body:typeof e>"u"||e===null?null:f(e)}).then(async y=>{const _=y;_.data=null,_.error=null;const m=g?y.clone():y,I=g?await m[g]().then(P=>(_.ok?_.data=P:_.error=P,_)).catch(P=>(_.error=P,_)):_;return a&&this.abortControllers.delete(a),I})}},yh=l.createIdentifier$1("rest.v2.transport"),hi=Symbol("rest.v2.secureRequest");function Sh(e){return e.getOrCreateInstance(yh,()=>{const t=e.getInstance(l.CUSTOM_FETCH_ID)?.execute||fetch;return new bh({baseUrl:"https://app.emailmaker.ru/api/v2",securityWorker:()=>({[hi]:!0}),customFetch:(n,r={})=>{const{[hi]:o,...s}=r;return t(n,{...s,[l.PUBLIC_REQUEST]:o!==!0})}})})}function wh(e,t){const n=Sh(e);return Object.assign({},...t.map(r=>new r(n)))}function mi(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function gi(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:mi(n.details,"wp_code")??n.code,message:mi(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 vi(e){return!e.ok||!!e.error}function Ih(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function Ei(){return Ih(l.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function Th(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Ch(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Ah(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:Th(r[1])}),t},[]):[]}function Dh(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:Ch(n.updated_at),contentHash:n.content_hash}),t),[])}function _i(e){return wh(e,[_h])}function qt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function lr(e){return!e.ok||e.error!=null}function cr(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function dr(e){return{data:await di(e)??null}}async function Ph(e){if(Ei())try{const n=await _i(e).localesList();return vi(n)?{error:gi(n)}:{data:Dh(n.data)}}catch(n){return qt(n)}const t=l.getApi(e,[ao]);try{const n=await t.get_translations2({file:"react_app"});return lr(n)?cr(n):{data:Ah(n.data)}}catch(n){return qt(n)}}async function Oh(e,t){if(Ei())try{const r=await _i(e).jsonList({locale:t});return vi(r)?{error:gi(r)}:dr(r.data)}catch(r){return qt(r)}const n=l.getApi(e,[ao]);try{const r=await n.get_translations3({id:t,file:"react_app"});return lr(r)?cr(r):dr(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return lr(r)?cr(r):dr(r.data)}catch(r){return qt(r)}}}var Kt=new WeakMap;function Rh(e){const t=Kt.get(e);if(t!==void 0)return t;const n=Ph(e).then(r=>("error"in r&&Kt.delete(e),r),r=>{throw Kt.delete(e),r});return Kt.set(e,n),n}var ze=l.createIdentifier$1("locale.service");function kh(e){if(e.getInstance(ze))return;const t=Eh({readList:()=>Rh(e),readCatalog:n=>Oh(e,n),askHost:async n=>(await ie(e,l.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(l.SECURITY_MODULE_ID)});e.inject(ze,t),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function Nh(e){const t=e.getInstance(l.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(ze);if(!n)return;const r=t.select(o=>o.locale).watch(o=>n.set(o||"ru_RU"));e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r)}var Lh="user_id",Mh="project_id",bi=l.createIdentifier$1("rest.identityHeadersProvided");function xh(e){if(e.getInstance(bi))return;e.inject(bi,!0);let t;e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(n=>{t=n}),e.addService(l.REQUEST_HANDLER_ID,{execute(n,r){if(r?.public)return;const o=t?.user?.id??Jo(e).profile?.id;o!=null&&o!==""&&n.headers.set(Lh,String(o));const s=t?.project;s!=null&&s!==""&&n.headers.set(Mh,String(s))}})}function Fh(e){const t=e?.[""];return typeof t?.lang=="string"?t.lang:void 0}function Bh(e){return e.id??Fh(e.catalog)}function jh(e){if(e==="uk"||e.startsWith("uk_"))return"uk";const t=e.search(/[_-]/);return t>0?e.slice(0,t):e}function Uh(e){return jh(e||"en_US")}var Hh="Accept-Language",yi=l.createIdentifier$1("rest.localeHeaderProvided");function $h(e){e.getInstance(yi)||(e.inject(yi,!0),e.addService(l.REQUEST_HANDLER_ID,{execute(t){const n=e.getInstance(ze)?.snapshot();t.headers.set(Hh,Uh(n&&Bh(n)))}}))}function Vh(e){if(!e)return!1;try{return e.getInstance(l.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var Gh="Invalid standaloneKey.",K_=l.createIdentifier$1("StandaloneMockGuard");function Yh(){const e=new Error(Gh);return e.name="InvalidStandaloneKeyError",e}function Wh(e){e.addService(l.REQUEST_HANDLER_ID,{execute:()=>{if(Vh(e))throw Yh()}})}function qh(e){l.registerRestTransport(e),Wh(e)}function Kh(e){const t=new ys;e.inject(l.INIT_PIPELINE_ID,t);const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(o=>{if(!o)return;const s=o.signal??t.externalSignal;t.configure({replaceSession:!0,...o.timeouts!==void 0?{timeouts:o.timeouts}:{},...s!==void 0?{signal:s}:{}})}),r=e.getInstance(l.DISPOSABLE_ID);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var Si=ct("plugin.dataSource.blocks"),zh=ct("plugin.dataSource.blockRevisions"),Xh=ct("plugin.dataSource.comments"),Jh=xt(),Qh=xt(),wi=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
2110
2110
|
<html>
|
|
2111
2111
|
<head>
|
|
2112
2112
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
@@ -2147,10 +2147,10 @@ __emailmaker__.define("emailmaker.js",["require","exports","module","static/umd/
|
|
|
2147
2147
|
</tr>
|
|
2148
2148
|
</table>
|
|
2149
2149
|
</body>
|
|
2150
|
-
</html>`;function
|
|
2150
|
+
</html>`;function Zh(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:wi,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 Ii=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function em(e){return!Object.keys(e).some(t=>Ii.has(t))}function tm(e){const t={},n={};for(const[r,o]of Object.entries(e))Ii.has(r)?t[r]=o:n[r]=o;return{showOptions:t,misplacedEmailFields:n}}function Ti(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function z_(e){}function zt(e){return typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,"block")&&!Object.prototype.hasOwnProperty.call(e,"email")}function nm(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 ut(e){return{emails:si(e),blocks:Si(e),emailRevisions:ii(e),blocksRevision:zh(e),comments:Xh(e)}}function rm(e){const t=Object.values(ut(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function Xt(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(em(e))return{email:Ti(e)};{const{showOptions:n,misplacedEmailFields:r}=tm(e),o=Object.keys(r);t&&o.length>0&&void 0;const s=typeof e.email=="string"?{code:e.email}:e.email;return{...n,email:Ti({...r,...s})}}}function ur(e){const t=Re(e);return t&&Q(t.sessionKey())?t.suspendedDocument():t?.current()}function Jt(e){return ur(e)?.getContent()}function Ci(e,t){const n=t??Zh(),r=ur(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:Jt(e)??n.html}:n}async function ft(e){return(await e.getInstanceAsync(l.APP_ID))?.project}async function Ai(e){return sr(e)??await ft(e)}async function Di(e,t){const n=Si(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 Ai(e),{filter:{id:t}})}function Pi(e){if(!e)return;if(zt(e)){const n=typeof e.block=="string"?e.block:e.block.id;return n==null?void 0:`block:${n}`}const t=Xt(e,!1).email.id;return t==null?void 0:String(t)}function om(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function sm(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}var Oi=new WeakMap;function im(e,t){const n=(Oi.get(e)??Promise.resolve()).then(t,t);return Oi.set(e,n.catch(()=>{})),n}function Xe({code:e,project:t,...n},r){const o=ve(n),s=sr(r),i=ye(r);return e&&i.warnAboutUnconfiguredInput(e,n.id),{...o,...e?{html:i.toEditorForm(e)}:{},...s===void 0?{}:{project:s},..."utm_parameters"in o?{utm_parameters:o.utm_parameters||{}}:{},_embedded:void 0}}function fe({html:e,renderGuid:t,showToken:n,showId:r,...o},s){const{requested:i}=dt(s),a=es(s);return ve({...o,code:ye(s).toOutputForm(e),project:i===void 0?o.project:i,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 fr(e){return e==null?"":e.replaceAll(`\r
|
|
2151
2151
|
`,`
|
|
2152
|
-
`)}function Ri(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function om(e,t,n,r){const o=sm(e,t,n,r);return o===void 0}function sm(e,t,n,r){if(qt(t))return"block";const{email:o}=Kt(t,!1),s=qe(o,e),i=s.id;if(i===void 0)return"no-id";if(r!==void 0&&r!==i)return"other-id-shown";const a=Ae(e)?.current();if(!a)return"no-session";const c=a.get(),d=c.attributes;if(c.serverId!==i)return"document-id";if(d.is_inited!==!0)return"not-inited";const u=Ri(dr(n??a.getContent()));if(s.html!==void 0&&Ri(dr(s.html))!==u)return"html";if(s.subject!==void 0&&s.subject!==d.subject)return"subject";if(s.preheader!==void 0&&s.preheader!==d.preheader)return"preheader";if(s.common_styles!==void 0&&s.common_styles!==d.common_styles)return"common_styles"}function ki(e,t){if(qt(t))return;const{email:n}=Kt(t,!1),r=qe(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:dr(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function im(e,t){const n={...e};return delete n.id,{...n,...t}}function am(e){return e.html?e:{...e,html:wi}}function Ne({code:e,project:t,...n},r,o){const s=o??rr(r);return{...n,...e?{html:Oe(r).toEditorForm(e)}:{},renderGuid:l.generateUUID(),...s===void 0?{}:{project:s}}}function le({html:e,renderGuid:t,...n},r){const{requested:o}=lt(r);return ge({...n,code:Oe(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 Ni(e){return Ae(e)?.current()?.get().serverId??void 0}function ur(e,t,n){return n===void 0&&(n=e.post===void 0?Ni(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function ut(e,t){return ge({...e,link:void 0,comment_status:void 0})}function Xt({code:e,autosave:t,...n},r,o){return o===void 0&&(o=n.parent===void 0?Ni(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||yc(n.slug),parent:o}}function fr({html:e,isAutosave:t,...n},r){return ge({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:ge({html:e,ampHtml:e&&""})})}function Jt({code:e,autosave:t,...n},r){return{...n,...e?{html:e}:{},isAutosave:t===!0,parent:r??n.parent}}function Li({html:e,isAutosave:t,...n}){return ge({...n,autosave:t?!0:void 0,code:e,guid:void 0})}var Ke=l.createIdentifier$1("NotificationService"),lm=l.createIdentifier$1("emailTemplate.reads");async function cm(e,t){try{return await Ce(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,um(e,t,n);return}}var dm=l.createIdentifier$1("emailTemplate.notifiedFailures");function um(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(dm,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(Ke).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function fm(e,t){const n=e.getOrCreateInstance(lm,()=>new Map),r=n.get(t);if(r!==void 0)return r;const o=cm(e,t).then(s=>(s===void 0&&n.delete(t),s));return n.set(t,o),o}var pr="EXTERNAL",Mi=Symbol("supersededShow");function pm(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var hm="email_id";function hr(e){return Object.entries(e).some(([t,n])=>t!=="id"&&n!==void 0)}async function mm(e,t){const n=It();let r;try{return await Promise.race([e,new Promise((o,s)=>{r=setTimeout(()=>{e.then(t,()=>{}),s(new Ct(n,"handleSaveBlock","block"))},n)})])}finally{clearTimeout(r)}}var gm=class extends l.Disposable{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_latestShow=Promise.resolve();_dataSources;_eventLock;_queue=l.createQueue();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=ct(t),this._eventLock=em(t);const n=Y(e,l.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(Y(e,l.events.OPEN_BLOCK_REQUEST_ID)(r=>this.openBlock(r))),this.addDisposable(e.addService(l.REQUEST_HANDLER_ID,{execute:(r,o)=>{!o?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(hm,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(l.INIT_PIPELINE_ID)??jn}_throwIfDestroyed(){if(this.isDisposed())throw _e()}async getTemplateEmail(e){const t=await fm(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 dt(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,Ne(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,Xt(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,ur(o,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,o){const s=this._dataSources.emails,i=s.cache,a=await dt(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=qe(e,this._container);const u=d.id;let f=u;if(u!==void 0){const h=await s.get(u);d={...h??{},...d,utm_parameters:d.utm_parameters??h?.utm_parameters??{},renderGuid:h?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...o?{showId:o}:{},project:a}}else{f=n??l.generateUUID();const h=await s.get(f);d={...d,utm_parameters:d.utm_parameters??{},renderGuid:h?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...o?{showId:o}:{},project:a},delete d.project}if(t){const h=await this.getTemplateEmail(String(t));h&&(d=im(h,d))}return u===void 0&&(d=am(d)),await i.setAll([[f,d]]),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==ki(this._container,e))return!1;const n=zt(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:zt(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&tm({ticket:t,emailId:Pi(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,Mi;if(!e)return;const n=this._getInitPipeline();if(l.throwIfAborted(n.signal),qt(e))return this._showBlock(e,n);const r=Q(se(this._container).sessionKey()),o=nm(e);if(!r&&!o&&om(this._container,e,zt(this._container),this._prevCommand?.id)||!r&&!o&&this._isRepeatOfLastShow(e))return;const s=Kt(e);s.email.id,this._prevCommand?.id;let i,a="",c=0,d=!1,u,f=Promise.resolve(),h,g=!1;try{this._eventLock.suspendChange();const{email:_,blocks:y,autosaves:m,comments:T,templateId:D,reload:B}=s;i=_.id;const M=qe(_,this._container),C=M.id,E=C??l.generateUUID(),b=await Te("getProject",dt(this._container));l.throwIfAborted(n.signal),a=l.generateUUID();const w={isNew:C===void 0,id:String(E),project:b},O=B===!0&&C!==void 0;O&&(await this._dataSources.emails.remove(String(C),{silent:!0}),String(C)),c=++this._showToken,String(E);const x=[];x.push(this.setBlocks(y)),_.id!==void 0&&(x.push(this.setComments(T)),x.push(this.setEmailRevisions(m,String(_.id)))),x.push(this.setEmail(_,Number(D),C===void 0?String(E):void 0,c,a)),await Te("setEmail+blocks+revisions",Promise.all(x),{emailId:C??String(E),showId:a,targetShowToken:c}),l.throwIfAborted(n.signal);const A=await this._dataSources.emails.get(String(E)),N=se(this._container),k={id:a,token:c};if(r){jt(this._container);const I=N.suspendedDocument()?.get().serverId;!O&&C!==void 0&&I!=null&&String(I)===String(C)&&N.resumeSuspended()}C===void 0?h=N.startNewDraft(A??M,{patch:M,show:k}):O?h=N.reload(C,{email:A??M,patch:M,show:k}):N.sessionKey()===je(C)?h=N.show(M,k):h=N.open(C,{email:A??M,patch:M,show:k}),N.beginShowFill(a);const P=!!this._prevCommand&&l.deepEqual(this._prevCommand,w);w.id,!this._prevCommand||l.deepEqual(this._prevCommand,w),this._prevCommand?.id,this._rememberShow(w),f=n.requestShow({showId:a,navId:String(E),emailId:C,isNew:C===void 0}),g=!0;const v=()=>N.endShowFill(a);Promise.allSettled([f,h.whenReady()]).then(v),String(E),d=!0}catch(_){u=_,g&&a&&n.failShow(a,_),a&&Ae(this._container)?.endShowFill(a),l.isAbortError(_)||(go(_),void 0)}finally{this._eventLock.resumeChange()}if(!d)throw u instanceof Error?u:new Error(`[emailmaker] show() setup failed: ${String(u??"unknown error")}`);return Te("show-init-deferred",Promise.all([f,h?.whenReady().catch(_=>{if(_ instanceof Ie){const y=Dn(_);throw y?new Error(`[emailmaker] show(): email open failed (${y})`,{cause:_}):_}})??Promise.resolve()]).then(()=>{}),{showId:a,emailId:i??null}).then(()=>{this._rememberShownContent(e)})}async _showBlock(e,t){const{block:n,byId:r,blocks:o,revisions:s,reload:i}=Zh(e),a=l.generateUUID();let c=!1;try{await this.setBlocks(o),l.throwIfAborted(t.signal),i&&(await this._dataSources.blocks.remove(String(n.id),{silent:!0}),this._dataSources.blocks.byForeignKey("project").clear(),String(n.id));const d=n.id!==void 0&&n.id!==""?String(n.id):void 0,u=se(this._container);if(!i&&d!==void 0&&u.sessionKey()===At(d)){const D=hr(n)?await this._storeShownBlock(n):void 0,B={id:a,token:++this._showToken},M=u.show(D,B),C=t.requestShow({showId:a,navId:d,emailId:void 0,isNew:!1});c=!0,await Te("show-block-init",Promise.all([C,M?.whenReady().catch(()=>{})]),{showId:a});return}const f=r||i?await Di(this._container,String(n.id)):void 0,h=f&&(i||hr(n))?await this._storeShownBlock({...le(f,this._container),...n}):r||i?f:await this._storeShownBlock(n);if(l.throwIfAborted(t.signal),!h)throw new Error(`[emailmaker] show(): block ${String(n.id)} not found`);s!==void 0&&h.id!==void 0&&await this._dataSources.blocksRevision.cache.setAll(s.filter(D=>D.id!==void 0).map(D=>[D.id,Jt(D,String(h.id))])),this._prevCommand=void 0,this._lastShow=void 0;const g=h.id!==void 0?String(h.id):l.generateUUID(),_={id:a,token:++this._showToken};jt(this._container);const y=i?u.reloadBlock(g,h,_):u.openBlock(g,h,_);h.id;const m=t.requestShow({showId:a,navId:g,emailId:void 0,isNew:h.id===void 0});c=!0;const T=y.whenReady().catch(D=>{if(D instanceof Ie)throw D});await Te("show-block-init",Promise.all([m,T]),{showId:a})}catch(d){throw c&&t.failShow(a,d),d}}async _storeShownBlock(e){const t=Ne(e,this._container,await dt(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();l.throwIfAborted(e.signal);const t=se(this._container);if(Q(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:pr,fallbackTitle:ns(this._container)});if(l.throwIfAborted(e.signal),!n)throw pm(t.emailSaveState().error);return ue(Ci(this._container,this._currentEmail),this._container)}async _saveBlock(){this._throwIfDestroyed();const e=se(this._container),t=e.current();if(!t||!Q(e.sessionKey()))throw new Error("[emailmaker] saveBlock(): no open block");return rm(t,async()=>{await t.whenReady();const n=Bt(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}:{}},s=this._dataSources.blocks,i=await mm(t.get().serverId==null?s.create(o,{source:pr}):s.update(String(t.get().serverId),o,{source:pr}),a=>{a&&se(this._container).current()===t&&t.get().serverId==null&&a.id!==void 0&&t.markSaved(r,String(a.id))});if(!i)throw new Error("[emailmaker] save(): block was not saved");return t.markSaved(r,i.id!==void 0?String(i.id):void 0),le(i,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(),l.throwIfAborted(this._getInitPipeline().signal);const t=typeof e=="string"?{id:e}:e,n=t.id!==void 0&&t.id!==""?String(t.id):void 0,r=se(this._container);if(n!==void 0&&r.sessionKey()===At(n))return;const o=t.code===void 0&&n!==void 0?await Di(this._container,n):void 0,s=o&&hr(t)?await this._storeShownBlock({...le(o,this._container),...t}):t.code===void 0&&n!==void 0?o:await this._storeShownBlock(t);if(!s)throw new Error(`[emailmaker] openBlock(): block ${String(n)} not found`);jt(this._container);const i=r.openBlockOver(s.id!==void 0?String(s.id):l.generateUUID(),s);s.id,r.hasSuspended(),re(this._container,l.events.ON_BLOCK_OPEN_ID).fire({block:s}),await i.whenReady().catch(a=>{if(a instanceof Ie)throw r.current()===i&&(re(this._container,l.events.ON_BLOCK_CLOSE_ID).fire({block:s,hasUnsavedChanges:!1}),r.resumeSuspended()),a})}async _closeBlock(){this._throwIfDestroyed(),vf(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 vm(e){return String(e).replace(/"/g,""")}function Em(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 _m(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 xi(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),o=vm(n);return r.test(e)?e.replace(r,`${t}="${o}"`):e.replace(/>$/,` ${t}="${o}">`)}function bm(e,t,n){if(!e?.trim()||!t)return e;const r=_m(e);if(!r)return e;const o=String(t),s=Em(n??new Date);let{full:i,index:a}=r;const c=i.length;return/\bem-block-id\s*=/.test(i)||(i=xi(i,"em-block-id",o)),i=xi(i,"em-block-version",s),e.slice(0,a)+i+e.slice(a+c)}function ym(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 Sm(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:ym(e)}}function mr(e,t){return t?Sm(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var Fi=["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"],wm=[...Fi,"html","id","project","password"],q_=new Set(["html",...Fi,"global_block","project"]);function Im(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(wm),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 Tm(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...Im(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 gr=new WeakMap;function Cm(e){let t=gr.get(e);return t||(t={byId:new Map,fallback:[]},gr.set(e,t)),t}function Am(e){gr.delete(e)}function Dm(e,t){const{byId:n,fallback:r}=Cm(t);if(e.blockId){const o=n.get(e.blockId);if(o){n.delete(e.blockId);const s=r.indexOf(o);return s>=0&&r.splice(s,1),o}return}for(let o=r.length-1;o>=0;o--){const s=r[o],i=e.name!=null&&e.name!==""&&s.name!=null&&s.name!==""&&s.name===e.name,a=e.type!=null&&e.type!==""&&s.insertFrom===e.type;if(i&&a)return r.splice(o,1),s.id!=null&&s.id!==""&&n.delete(String(s.id)),s}}async function Pm(e,t){const{blocks:n}=ct(e);return await n.cache.getIfPresent(t)??void 0}async function Om(e,t){if(!t.blockId)return;const n=await Pm(e,t.blockId);if(n)return Tm(n,t)}async function Rm(e,t){const n=Dm(e,t);if(n)return mr(e,n);const r=await Om(t,e);return r?mr(e,r):mr(e,void 0)}var km=l.createIdentifier("application_block_inserted"),Nm=-1e3,Bi=new WeakSet;function Lm(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 Mm(e){if(!e||Bi.has(e))return;Bi.add(e);const t=new l.Disposable,n=ie(e);return t.addDisposable(n.addListenerAsyncPipe(km,async(r,o)=>{const s=Lm(r)?await Rm(r,e):r;return o?o(s):s},Nm)),t.addDisposable({dispose:()=>{Am(e)}}),t}var xm=Nt("plugin.readBlockAutosave"),K_=l.createIdentifier$1("blockDocuments.provided"),ji=l.createIdentifier$1("plugin.earlyWindow");function Fm(e){return e.getOrCreateInstance(ji,()=>({depth:0}))}function Bm(e){const t=Fm(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function Ui(e){return(e?.getInstance(ji)?.depth??0)>0}function Hi(e,t){let n,r=!1;return e(o=>{n=o,r=!0}),(o,s,i)=>{const a=e(o,s,i);if(r&&Ui(t)){const c=n;queueMicrotask(()=>{o.call(i,c)})}return a}}var vr=100,jm=class extends l.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=Mm(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:o,blocksRevision:s}=ct(e),i=Y(e,l.events.ON_SHARE_ID),a=Y(e,l.events.ON_SHOW_PREVIEW_ID),c=Y(e,l.events.ON_EMAIL_CLONE_ID),d=Y(e,l.events.ON_BLOCK_OPEN_ID),u=Y(e,l.events.ON_BLOCK_CLOSE_ID),f=Y(e,l.events.ON_BLOCK_CLONE_ID),h=Y(e,l.events.ON_BLOCK_INIT_ID),g=Y(e,l.events.ON_BLOCK_CHANGED_ID),_=Y(e,l.events.ON_CODE_VALIDATE_ID),y=Y(e,l.events.ON_IMPORT_VALIDATE_ID),m=Y(e,l.events.ON_SUBJECT_CHANGED_ID),T=Y(e,l.events.ON_EMAIL_CHANGED_ID),D=Y(e,l.events.ON_PREHEADER_CHANGED_ID),B=Y(e,l.events.ON_SAVEBUTTON_CLICK_ID),M=Y(e,l.events.ON_BLOCK_SAVEBUTTON_CLICK_ID),C=Y(e,l.events.ON_NEXTBUTTON_CLICK_ID),E=Y(e,l.events.ON_SEND_LIVEPREVIEW_ID),b=Y(e,l.events.ON_SEND_TESTEMAIL_ID),w=Y(e,zh),O=Y(e,l.events.ON_CONTENT_CHANGED_ID),x=Y(e,Kh),A=Y(e,l.events.ON_PREVIOUSBUTTON_CLICK_ID),N=Y(e,l.events.ON_SEND_EMAIL_MODAL_ID),k=l.filter(Y(e,l.events.ON_EMAIL_INIT_ID),v=>!v.reset),P=Y(e,l.events.ON_ANALYTICS_EVENT);return{handlePreheaderChanged:U(D),handleSubjectChanged:U(m),handleValidate:U(_),handleImportValidate:U(y),handleReadEmail:U(n.handlerRead,v=>v,v=>v&&qe(v,e)),handleSaveEmail:U(n.onSave,function({prev:v,patch:I,value:p,source:S}){const F=v?ue(v,e):void 0;return{prev:F,patch:it(F,ue(I,e)),value:ue(p,e),source:S}},v=>v?qe(v,e):void 0),handleRemoveEmail:U(n.onRemove,({value:v,source:I})=>({value:ue(v,e),source:I}),()=>{}),handleReadCommonBlocks:U(w,v=>v.project,v=>v?.map(I=>Ne(I,e))),handleReadTemplateBlocks:U(x,v=>v,v=>v?.map(I=>Ne(I,e))),handleReadBlocks:U(t.byForeignKey("project").handleRead,v=>lt(e).requested||String(v),v=>v?.map(I=>Ne(I,e))),handleReadBlock:U(t.handlerRead,v=>v,v=>v?Ne(v,e):void 0),handleOpenBlock:U(d,({block:v})=>({block:le(v,e)})),handleCloseBlock:U(u,({block:v,hasUnsavedChanges:I})=>({block:le(v,e),hasUnsavedChanges:I})),handleCloneBlock:U(f,v=>le(v,e)),handleSaveBlock:U(t.onSave,function({prev:v,patch:I,value:p,source:S}){const F=p.global_block===!0&&p.id&&typeof p.html=="string"?{...p,html:bm(p.html,String(p.id))}:p,V=v?le(v,e):void 0;return{prev:V,patch:it(V,le(I,e)),value:le(F,e),source:S}},v=>v?Ne(v,e):void 0),handleRemoveBlock:U(t.onRemove,({value:v,source:I})=>({value:le(v,e),source:I}),()=>{}),handleReadComments:U(r.byForeignKey("post").handleRead,v=>v,v=>v?.map(I=>ur(I,e))),handleSaveComment:U(r.onSave,function({prev:v,patch:I,value:p,source:S}){const F=v?ut(v,e):void 0;return{prev:F,patch:it(F,ut(I,e)),value:ut(p,e),source:S}},v=>v?ur(v,e):void 0),handleRemoveComment:U(r.onRemove,({value:v,source:I})=>({value:ut(v,e),source:I}),()=>{}),handleReadEmailRevisions:U(o.byForeignKey("parent").handleRead,v=>v,v=>v?.map(I=>Xt(I,e))),handleReadEmailAutosave:U(Y(e,ai),v=>v,v=>v?Xt(v,e):null),handleEmailAutosave:U(o.onSave,function({prev:v,patch:I,value:p,source:S}){return{value:fr(p,e),source:S}},v=>v?Xt(v,e):void 0),handleRemoveEmailAutoSave:U(o.onRemove,({value:v,source:I})=>({value:fr(v,e),source:I}),()=>{}),handleReadBlockRevisions:U(s.byForeignKey("parent").handleRead,v=>v,v=>v?.map(I=>Jt(I))),handleReadBlockAutosave:U(Y(e,xm),v=>v,v=>v?Jt(v):null),handleBlockAutosave:U(s.onSave,({value:v,source:I})=>({value:Li(v),source:I}),v=>v?Jt(v):void 0),handleRemoveBlockAutoSave:U(s.onRemove,({value:v,source:I})=>({value:Li(v),source:I}),()=>{}),handleBlockInit:U(h,v=>le(v,e)),handleBlockChanged:U(l.debounce(g,vr),v=>le(v,e)),handleEmailChanged:U(l.debounce(T,vr),v=>ue(v,e)),handleEmailInit:Hi(U(k,v=>ue(v,e)),e),handlePreviousButtonClick:U(A,v=>ue(v,e)),handleNextButtonClick:U(C,v=>ue(v,e)),handleSaveButtonClick:U(B,v=>ue(v,e)),handleSaveBlockButtonClick:U(M,v=>le(v,e)),handleHtmlChanged:U(l.debounce(O,vr)),handleTestEmailSend:U(b,({html:v,...I})=>({...I,code:v,compiled:{html:v,ampHtml:""}})),handleTestEmailModal:U(N,v=>ue(v,e)),handleCloneEmail:U(c,v=>ue(v,e)),handleShareEmail:U(i),handlePreviewEmail:U(a),handleLivePreviewEmail:U(E),handleAnalyticsEvent:U(P)}}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 Ye(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},Um=l.createIdentifier$1("DataController"),Hm=l.createIdentifier$1("DataEvents");function $i(e){return e.getOrCreateInstance(Um,()=>{const t=new gm(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function Vi(e){return e.getOrCreateInstance(Hm,()=>new jm(e))}var $m=l.createIdentifier$1("plugin.pluginStart");function Gi(e){return e.getOrCreateInstance($m,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t()),{done:n,finish:t}})}function Vm(e){return Gi(e).done}function Gm(e){const t=Gi(e);return t.run===void 0&&(t.run=(e.getInstance(l.PLUGIN_COLLECTION_ID)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var Ym=l.createIdentifier$1("plugin.startupShow");function Wm(e){const t=$i(e),n=Vi(e),r=e.getInstance(l.OPTIONS_SOURCE_ID),o=e.getInstance(l.DISPOSABLE_ID),s={current:Promise.resolve()};e.inject(Ym,s);let i=!1;const a=r?.watch(d=>{d&&n.setOptions(d),i=(d?.plugins?.length??0)>0,s.current=s.current.catch(()=>{})}),c=r?.select(d=>d?.content).watch(d=>{if(d===void 0)return;const u=()=>(J(oe.showStart),t.show(d).finally(()=>J(oe.showEnd))),f=i?Vm(e).then(u):u();f.catch(()=>{}),s.current=f});a&&o?.addDisposable(a),c&&o?.addDisposable(c)}function qm(e){const t=$i(e);return{...Vi(e).get(),show(n){return J(oe.showStart),t.show(n).finally(()=>J(oe.showEnd))},openBlock(n){return t.openBlock(n)},closeBlock(){return t.closeBlock()},showBlock(n,r){return J(oe.showStart),t.showBlock(n,r).finally(()=>J(oe.showEnd))},save(){return t.save()},saveBlock(){return t.saveBlock()}}}function Yi(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function Qt(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",o=!1;for(let s=t;s<e.length;s++){const i=e[s];if(o){o=!1;continue}if(i==="\\"){o=!0;continue}if(r){i===r&&(r="");continue}if(i==='"'||i==="'"){r=i;continue}if(i==="("){n++;continue}if(i===")"&&(n--,n<0))return!1}return n===0}function Km(e){return(t,n,r)=>Qt(t)?e(t,n,r):!1}function zm(e){return t=>Qt(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function Xm(e){return(t,n,r)=>Qt(t)?Yi(t)?e(t,n,r):t:!1}function Jm(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return Qt(n)?Yi(n)?e(t):t:!1}}function Qm(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function Er(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 Zm(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let o="";for(let s=0;s<e;s++){const i=r[s]%62;o+=t.charAt(i)}return o}var eg=8,tg=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=Zm(eg),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},Zt=new tg;function Wi(e,t){return t!==void 0&&!Er(e,t)?`%|{${Zt.getOrCreateByKey(e)}}|%`:e}function ng(e){const t=Zt.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function ee(e,t,n){return t!==void 0?Er(e,t)?e:`%|{${Zt.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function rg(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function Z(e){return e.startsWith("<!--")&&e.endsWith("-->")?rg(e.slice(4,-3)):e}function og(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 s=r.trim();return t.test(s)||n.test(s)}function sg(e,t,n){return t!==void 0?Er(e,t)?e:`%|{${Zt.getOrCreateByKey(e)}}|%`:n||Qm(e)||og(e)?`<!--${e}-->`:e}var Le=Km(ee),Me=zm(Z),ig=Xm(ee),ag=Jm(Z),qi=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",ng),e.escape("@{","}",ee,!0).unescape("<!--@{","}-->",Z,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",Wi,!0),e.escape("{{","}}",Wi,!0),e.createSyntax("brace-percent").escape("{%","%}",ee).unescape("<!--{%","%}-->",Z),e.createSyntax("brace-hash").escape("{#","#}",ee).unescape("<!--{#","#}-->",Z),e.createSyntax("proscript").escape("[%","%]",sg,!0).unescape("<!--[%","%]-->",Z,!0),e.createSyntax("getresponse").escape("[[IF","]]",ee).escape("[[if","]]",ee).escape("[[ELSE]]","",ee).escape("[[else]]","",ee).escape("[[ENDIF]]","",ee).escape("[[endif]]","",ee).unescape("<!--[[IF","]]-->",Z).unescape("<!--[[if","]]-->",Z).unescape("<!--[[ELSE]]","-->",Z).unescape("<!--[[else]]","-->",Z).unescape("<!--[[ENDIF]]","-->",Z).unescape("<!--[[endif]]","-->",Z),e.createSyntax("expert-sender").escape("<if",">",ee).escape("</if",">",ee).escape("<else",">",ee).escape("</else",">",ee).escape("<var ",">",ee,!0).unescape("<!--<if ",">-->",Z).unescape("<!--</if",">-->",Z).unescape("<!--<else ",">-->",Z).unescape("<!--</else",">-->",Z).unescape("<!--<var",">-->",Z,!0),e.createSyntax("velocity").escape("#if",")",Le).escape("#elseif",")",Le).escape("#else","",ee).escape("#foreach",")",Le).escape("#macro",")",Le).escape("#set",")",ig,!0).escape("#parse",")",Le).escape("#include",")",Le).escape("#evaluate",")",Le).escape("#end","",ee).escape("#break","",ee).escape("#stop","",ee).unescape("<!--#macro","-->",Me).unescape("<!--#if","-->",Me).unescape("<!--#elseif","-->",Me).unescape("<!--#else","-->",Z).unescape("<!--#foreach","-->",Me).unescape("<!--#parse","-->",Me).unescape("<!--#include","-->",Me).unescape("<!--#evaluate","-->",Me).unescape("<!--#end","-->",Z).unescape("<!--#break","-->",Z).unescape("<!--#stop","-->",Z).unescape("<!--#set","-->",ag,!0),e.createSyntax("mailchimp").escape("*|","|*",ee).unescape("<!--*|","|*-->",Z)},_r="bare",lg=new Map;function cg(e){return e?lg.get(e)??_r:_r}var Ki=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function zi(e){return Ki.includes(e)}function ft(e){return e==="bare"||e==="html-comment"}function br(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function dg(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!ft(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[d,u]of[["output",r.output],["editor",r.editor]])if(u!==void 0&&!ft(u))return t(`templateDirectives.${d}: unknown form "${String(u)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!br(r.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),n;if(r.syntaxes){for(const[d,u]of Object.entries(r.syntaxes))if(!(!zi(d)||u===void 0||ft(u))){if(!br(u))return t(`templateDirectives.syntaxes.${d}: expected a form or an object, configuration ignored.`),n;for(const f of["output","editor"]){const h=u[f];if(h!==void 0&&!ft(h))return t(`templateDirectives.syntaxes.${d}.${f}: 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 s=r.editor;o==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),s=void 0);const i=[];if(r.syntaxes)for(const d of Object.keys(r.syntaxes)){if(!zi(d)){t(`templateDirectives.syntaxes: unknown syntax id "${d}", entry ignored.`);continue}i.push(d)}else i.push(...Ki);const a={},c={};for(const d of i){const u=r.syntaxes?.[d],f=br(u)?u:void 0,h=(ft(u)?u:f?.output)??o;let g=f?.editor??s??h;h==="bare"&&g==="html-comment"&&(t(`templateDirectives.syntaxes.${d}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),g="bare"),a[d]=h,c[d]=g}return{output:a,editor:c}}function Xi(e,t,n,r){for(let o=t;o<n;o++){const s=e[o];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?s===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(s)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):s==="<"?r.insideTag=!0:s===">"?r.insideTag=!1:r.insideTag&&(s==='"'||s==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=s,r.unquotedAttr=!1):r.insideTag&&/\S/.test(s)&&r.attributeQuoteChar===void 0&&e[o-1]==="="&&!['"',"'","`"].includes(s)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function pt(e,t){return e.start<t.end&&t.start<e.end}function Ji(e,t,n,r,o=[]){if(n&&(t=t.filter(u=>u.isVariable)),!t.length)return[];const s=t.flatMap(u=>u.match(e).flatMap(f=>!Number.isInteger(f.start)||!Number.isInteger(f.end)||f.start<0||f.end>e.length||f.start>=f.end?[]:[{range:f,mapFn:u.mapFn,overrideBuiltins:u.overrideBuiltins,syntax:u.syntax,isVariable:u.isVariable}])).sort((u,f)=>u.range.start-f.range.start||u.range.end-f.range.end),i=[],a=o.slice().sort((u,f)=>u.start-f.start),c={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let d=0;for(const{range:u,mapFn:f,overrideBuiltins:h,syntax:g,isVariable:_}of s){if(r?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):Xi(e,d,u.start,c),d=u.end,a.some(D=>pt(D,u)))continue;const y=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,m=e.substring(u.start,u.end),T=f(m,y,c.insideTag);T!==!1&&T!==m&&(i.push({range:u,text:T,overrideBuiltins:h,syntax:g,isVariable:_}),a.push(u))}return i.sort((u,f)=>u.range.start-f.range.start||u.range.end-f.range.end)}function ug(e,t){const n=t.reduce((a,{mapFn:c,start:d,end:u,syntax:f,isVariable:h})=>(a[d]||(a[d]=[]),a[d].push({value:u,mapFn:c,syntax:f,isVariable:h}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),o=new RegExp(r,"g"),s=[];let i;for(;(i=o.exec(e))!==null;){const a=i[0];s.push({start:i.index,startToken:a,endTokens:n[a]})}return s}function yr(e,t,n,r,o=!1){const s=[];if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return s;const i=ug(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(let d=0;d<i.length;d++){const{start:u,startToken:f,endTokens:h}=i[d];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):Xi(e,c,u,a),c=u;const g=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let _=!1;for(const{mapFn:y,value:m,syntax:T,isVariable:D}of h){let B=u+f.length,M=e.indexOf(m,B);for(;M!==-1;){let C=M,E=u+f.length,b=0;for(;C!==-1;){const N=e.indexOf(f,E);if(N!==-1&&N<C)b++,E=N+f.length,C=e.indexOf(m,E);else if(b>0)b--,E=C+m.length,C=e.indexOf(m,E);else break}if(C<0)break;const w=C+m.length,O=e.substring(u,w),x=y(O,g,a.insideTag);if(x===!1){B=M+Math.max(m.length,1),M=e.indexOf(m,B);continue}(o||x!==O)&&s.push({range:{start:u,end:w},text:o?O:x,syntax:T,isVariable:D});const A=i.findIndex(({start:N})=>N>=w);A>d?d=A-1:d=i.length,_=!0;break}if(_)break}}return s}function en(e,t){if(!t.length)return e;const n=t.slice().sort((o,s)=>s.range.start-o.range.start);let r=e;for(const{text:o,range:s}of n)r=r.slice(0,s.start)+o+r.slice(s.end);return r}var fg=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=qi){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,o,s,i){return t.push({start:r,end:o,mapFn:s,isVariable:i,syntax:this.syntax||r}),this},unescape(r,o,s,i){return n.push({start:r,end:o,mapFn:s,isVariable:i,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 s={dispose:()=>{o||(o=!0,this._escapeMatchers=this._escapeMatchers.filter(i=>i!==n),this._unescapeMatchers=this._unescapeMatchers.filter(i=>i!==r))}};return this.addDisposable(s),s}_collectMappings(e,t,n){const r=yr(e,this._escapes,t,n),o=Ji(e,this._escapeMatchers,t,n),s=o.filter(c=>c.overrideBuiltins).map(c=>c.range),i=r.filter(c=>!s.some(d=>pt(d,c.range))),a=o.filter(c=>c.overrideBuiltins||!i.some(d=>pt(c.range,d.range)));return[...i,...a].sort((c,d)=>c.range.start-d.range.start||c.range.end-d.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=yr(e,this._unescapes,t),r=Ji(e,this._unescapeMatchers,t,!1),o=r.filter(a=>a.overrideBuiltins).map(a=>a.range),s=n.filter(a=>!o.some(c=>pt(c,a.range))),i=r.filter(a=>a.overrideBuiltins||!s.some(c=>pt(a.range,c.range)));return[...s,...i].sort((a,c)=>a.range.start-c.range.start||a.range.end-c.range.end)}getRevertMappings(e,t,n){const r=n?o=>o!==void 0&&n.has(o):o=>cg(o)==="html-comment";return this._collectRevertMappings(e,t).filter(o=>o.isVariable||!r(o.syntax))}getDetectedMappings(e,t,n){return yr(e,this._escapes,t,n,!0)}getEscapedText(e,t){return en(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return en(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=s=>s===void 0?void 0:t[s],r=Object.values(t);let o=e;return r.includes("bare")&&(o=en(o,this._collectRevertMappings(o).filter(s=>n(s.syntax)==="bare"))),r.includes("html-comment")&&(o=en(o,this._collectMappings(o).filter(s=>!s.isVariable&&n(s.syntax)==="html-comment"&&s.text.startsWith("<!--")&&s.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 Qi(e){return e.replace("<script","<___script").replace("<\/script>","</___script>")}var Zi=new fg(e=>{e.escape("<script","<\/script>",t=>Qi(t)).unescape("<___script","</___script>",t=>t.replace("<___script","<script").replace("</___script>","<\/script>")),e.escape("<script","/>",t=>Qi(t)).unescape("<___script","/>",t=>t.replace("<___script","<script")),qi(e)});function pg(e){const t=dg(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return _s();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:Es(r)}}function hg(e){let t;e.injectFactory(l.TEMPLATE_DIRECTIVES_ID,()=>{const n=e.getInstance(l.CONFIG_SOURCE_ID)?.layers().user.templateDirectives;return(!t||t.raw!==n)&&(t={raw:n,policy:pg(n)}),t.policy})}function z_(e){return e}var mg=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function gg(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 vg(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 ea(e){const t=gg(e),n=[],r=new Set,o=[],s=new Set,i=a=>{if(!r.has(a)){if(s.has(a)){const c=o.indexOf(a);throw new mg([...o.slice(c),a].map(d=>d.name))}s.add(a),o.push(a);for(const c of vg(a,t))i(c);o.pop(),s.delete(a),r.add(a),n.push(a)}};for(const a of e)i(a);return n}var Eg=[{name:"rest.client",setup:Gh},{name:"auth.oauth",setup:l.provideOAuth},{name:"rest.identityHeaders",setup:Nh},{name:"rest.localeHeader",setup:jh},{name:"lifetime.destroyable",provides:[tr],setup:Lp},{name:"appInit",provides:[l.APP_ID,mn],setup:Cl},{name:"config",provides:[l.CONFIG_SOURCE_ID],setup:kp},{name:"templateDirectives",provides:[l.TEMPLATE_DIRECTIVES_ID],setup:hg},{name:"email.documents",setup:Zp},{name:"show.initPipeline",provides:[l.INIT_PIPELINE_ID],setup:Yh},{name:"show",setup:Wm},{name:"locale.service",provides:[We],setup:Ph},{name:"locale.fromConfig",awaits:{services:[l.CONFIG_SOURCE_ID,We]},setup:Oh},{name:"canvas.early",setup:Af},{name:"canvas.previewSettings",setup:Vf},{name:"canvas.sandboxExtensions",setup:Yf},{name:"canvas.sandboxScriptRelay",setup:Kf},{name:"canvas.headerSync",provides:[Wn],setup:Of},{name:"canvas.headersAfterRecovery",setup:Rf},{name:"canvas.ampSync",setup:Rd},{name:"canvas.moduleBridge",setup:lu},{name:"canvas.port",setup:Hd},{name:"canvas.images",setup:jd},{name:"canvas.edits",setup:Tf},{name:"canvas.surfaceFollowsSession",setup:_f},{name:"canvas.blockContent",setup:Ef},{name:"canvas.sandboxFill",provides:[Yn],setup:fp},{name:"canvas.reactions",setup:Cf}],ta;function Sr(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);if(t)return t;e.getInstance(l.DISPOSABLE_ID)||e.inject(l.DISPOSABLE_ID,new l.Disposable);const n=ae();e.inject(l.OPTIONS_SOURCE_ID,n),ta??=ea(Eg);for(const r of ta)r.setup(e);return n}function _g(e){}var bg=[{name:"save.previewFollow",setup:_g}],na=l.createIdentifier$1("plugin.lateUnitsInstalled");function yg(e){if(!e.getInstance(na)){e.inject(na,!0);for(const t of ea(bg))t.setup(e)}}function Sg(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function wg(e){if(!e)return;const t=l.decodeJwt(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 Ig=l.defineMixin(e=>{let t,n,r;return{async setOptions(o){const s=r!==o.getAuthToken,i=!l.deepEqual(t,o.user),a=n!==o.project;if(r=o.getAuthToken,t=o.user,n=o.project,!(!e.getInstance(l.SECURITY_MODULE_ID)||!o.getAuthToken)&&!(!s&&!i&&!a))try{const c=await o.getAuthToken(o.user,o.project);e.inject(l.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(c||""));const d=wg(c);if(!d)return;e.inject(l.STANDALONE_PROJECT_ID,d);const u=e.getInstance(l.APP_ID),f=u?await u.catch(()=>{}):void 0;e.inject(l.APP_ID,Promise.resolve(Sg(d,f)))}catch{}}}});function Tg(e,t){if(e.getInstance(l.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(l.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=l.getEvent(e,l.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}var Cg=l.defineMixin(e=>{let t,n=!1;return{setOptions(r){const o=n;if(n=!0,!st(r)){t&&(bp(e),er(r)),t=void 0;return}const s=$t(r);if(!s||t===s&&e.getInstance(l.SECURITY_MODULE_ID))return;t=s,e.inject(l.SECURITY_MODULE_ID,s);const i=e.getInstance(l.DISPOSABLE_ID);i&&Tg(e,i)}}}),Ag=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=l.getEvent(e,l.APP_LOAD_EVENT_ID),r=U(n),o=t.addDisposable(new Ye(r));return{setOptions({handleLoad:s}){o.setListener(s)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function ra(e,t,n=!0){const r=e,o=t;for(const s of Object.keys(o)){const i=o[s];i!=null&&(n&&typeof i=="object"?r[s]=ra(r[s]||{},i,!0):r[s]=i)}return e}async function Dg(e){const t=(await Ja.__vitePreload(()=>Promise.resolve().then(()=>Promise.resolve(St("./static/umd/3f12d6ff.js")).then(n=>dn.__toESM(n.default))),void 0,{}.url)).default;return new Promise((n,r)=>{t.load({google:{families:[e]},classes:!1,active:()=>n(),inactive:()=>r(new Error(`Шрифт не загрузился: ${e}`))})})}var oa=l.createIdentifier$1("EditorOptions"),wr=l.MONACO_EDITOR_OPTIONS;function Pg(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 Og(e){return e.getOrCreateInstance(oa,()=>{const t=ae(wr);let n=wr.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(Dg(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function Rg(e){return e?.getInstance(oa)?.get()??wr}function kg(e,t={}){const n=Og(e);n.set(ra({...n.get()},Pg(t)))}function Ng(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 Lg(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var Mg=l.createIdentifier$1("plugin.publicConfig");function Ir(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function sa(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function ia(e){const t=Gs(e),n=Ir(e);return{...n,locale:n.locale||"ru_RU",theme:n.theme||"light",editor:Lg(Rg(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function aa(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()!==void 0}function xg(e){const t=l.createQueue(),n=re(e,l.CONFIG_CHANGED_EVENT_ID);let r,o,s=!1;const i=async()=>{try{return e.getInstance(l.APP_ID)===void 0?{}:(await e.getInstanceAsync(l.APP_ID))?.app_config||{}}catch{return{}}},a=async({onlyChangedCodeMode:f=!1}={})=>{await e.getInstance(l.CONFIG_SOURCE_ID)?.ready(),io(e).set(Ir(e).revisionService===!0);const{codeModeDirection:h,editor:g}=Ir(e);g&&kg(e,Ng(g)),h!==void 0&&!(f&&h===o)&&(o=h,h==="none"?zn(e,!1):(zn(e,!0),Bf(e,h)))},c=async()=>{if(!aa(e))return;const f=ia(e),h=JSON.stringify(f);h!==r&&(r=h,await n.fire(f))},d=async f=>{const h=e.getInstance(l.CONFIG_SOURCE_ID),g={advancedConfigs:sa(e).advancedConfigs,serverSide:await i(),user:f};h?.setAdvancedConfigs({...g.advancedConfigs,...g.user?.advancedConfigs});const _=h?.layers().user.mode;h?.replace(g.user?.mode===void 0&&_!==void 0?{...g.user,mode:_}:g.user,"user"),h?.replace(g.serverSide,"server"),await a(),await c()},u=f=>{const{commonStyles:h,...g}=f;return"commonStyles"in f&&Uf(e,h===void 0?void 0:h),g};return{queue:t,reactToConfig:a,emitConfigChanged:c,resolveServerSideConfig:i,getConfig:()=>aa(e)?ia(e):{},setConfig:t.decorate(async f=>{await d(u(f))}),updateConfig:t.decorate(async f=>{const h=u(f);await d({...sa(e).user,...h})}),announceAssembled(){s||(s=!0,e.getInstance(l.CONFIG_SOURCE_ID)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await c()})))}}}function la(e){return e.getOrCreateInstance(Mg,()=>xg(e))}function Fg(e){const t=la(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var Bg=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=t.addDisposable(new l.AsyncEmitter),r=t.addDisposable(new l.AsyncEmitter),o=l.getEmitter(e,l.CONFIG_CHANGED_EVENT_ID),s=U(n.event),i=U(r.event),a=Hi(U(o.event),e),c=t.addDisposable(new Ye(s)),d=t.addDisposable(new Ye(i)),u=t.addDisposable(new Ye(a));return{instance:{handleSetOptions:s,handleOptionsChanged:i,handleConfigChanged:a},async setOptions(f){c.setListener(f.handleSetOptions),d.setListener(f.handleOptionsChanged),u.setListener(f.handleConfigChanged),la(e).announceAssembled(),await n.fire(f),await r.fire(f)},dispose(){}}}),Tr,ca="core";function jg(){const e=__emailmaker__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([ca],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function Ug(e){const t=__emailmaker__?.require?.warm;return typeof t!="function"?ht().then(()=>{}):t([ca],e)}function ht(){return Tr===void 0&&(Tr=jg().then(e=>(Je()&&e.installDiagnostics().catch(t=>{}),e))),Tr}var Cr=null,Ar=null;async function Hg(e){typeof e?.prefetch=="function"&&await e.prefetch()}function Dr(){return Cr||(Cr=ht().then(()=>{})),Cr}function da(e){return Ar||(Ar=Hg(e)),Ar}function $g(){return da(typeof __emailmaker__<"u"?__emailmaker__:void 0)}function Vg(){const e=typeof __emailmaker__<"u"?__emailmaker__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function Gg(e){return Promise.all([Dr(),da(e)]).then(()=>{})}function Yg(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function ua(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>Ug(t?{priority:t}:void 0)).then(()=>(Fn(t?{priority:t}:void 0),n?Dr():void 0)).catch(()=>{})}function Wg(e){const t=Yg(e);if(t==="eager")ua(e);else if(t==="idle"){const n=()=>ua(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var fa="PluginRegistry";function qg(e=l.resolveContainer()){return e.getOrCreateInstance(fa,()=>new sl)}var pa=new il(()=>qg()),Kg=["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"],zg=["closeBlock","compileEmail","getBlockSnapshot","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","openBlock","save","saveBlock","setConfig","show","showBlock","updateConfig","useAsync","validateCode","waitPlugin"],tn=new Map([...Kg.map(e=>[e,"event"]),...zg.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),Xg=new Map([["use","use `useAsync()` or await `ready` first"]]);function Jg(e){return Xg.get(e)??"await `ready` first"}var Qg=new Set(["async","queued"]),Zg=Symbol.for("emailmaker.earlyCtxPlaceholder");function ha(e){return e[Zg]=!0,e}function ev(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 (${Jg(e)}).`)}function tv(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function nv(e){return[...tn].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function rv(e,t){for(const n of nv(e)){const r=tn.get(n);if(r!==void 0&&Qg.has(r)){const o=async(...s)=>{await t;const i=e[n];if(typeof i!="function"||i===o)throw tv(n);return i.apply(e,s)};e[n]=ha(o);continue}e[n]=ha(()=>{throw ev(n)})}}function ov(e,t,n){e.getInstanceAsync(Ke).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function sv(e,t){e.getInstanceAsync(Ke).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_LOAD_ERROR",data:{plugin:t.name,url:t.url,message:t.error.message},innerException:t.error})},()=>{})}var iv=l.defineMixin(e=>{let t;function n(){return new Promise(o=>{const s=e.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),i=()=>{s.delete(i),o()};s.add(i)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(o){const s=e.getInstance(l.INSTANCE_ID),i=e.getInstance(fa);if(!t){t=new ol(s,i,{ensureHostRuntimeReady:$g,explainScriptFailure:Vg,openEarlyWindow:()=>Bm(e),reportLoadFailure:d=>sv(e,d)}),e.inject(l.PLUGIN_COLLECTION_ID,t);const c=t.onLifecycle(d=>{d.type==="create:error"&&ov(e,d.name,d.error)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(c)}const a=o?.plugins||[];s&&(Xo(e),a.length>0&&rv(s,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}}}),ma=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}},av=l.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),lv=l.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),cv="application_block_inserted",dv=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(lv,()=>new ma).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),o=n?e.bind(n):e;return r.addListener(cv,o,t)}},Pr=l.createIdentifier$1("ComponentRegistry"),uv=l.createIdentifier$1("ComponentRegistryGate");function Or(){return l.DependencyResolver.getOrCreateInstance(uv,()=>({pending:[]}))}function fv(e=Pr){return Or().factory!==void 0||l.DependencyResolver.getInstance(e)!==void 0}function Rr(e,t,n=Pr){if(fv(n)){t(nn(e,n));return}Or().pending.push(()=>t(nn(e,n)))}function nn(e,t=Pr){const n=l.DependencyResolver.getInstance(t);if(n)return n;const r=Or().factory;if(!r)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return l.DependencyResolver.getOrCreateInstance(t,r)}var pv=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=s=>{if(!n){n=!0;for(const i of t)i.dispose();e(s)}};t.push(this._container.addService(l.ATOMS_HANDLERS_ID,{execute:s=>{r(s.value.map(i=>({name:i.name,html:i.html})))}}));const o=this._container.getInstance(l.HEADLESS_MODE_ID)?.watch(s=>{s&&r([])});o&&(n?o.dispose():t.push(o))})}update(e,t){const n=this._container;return n.addService(l.ATOMS_HANDLERS_ID,{execute:r=>{const o=nn(n),s=r.value.find(i=>i.name===e);if(s){const{icon:i,title:a,fallbackTooltip:c,...d}=t;i&&(s.icon=o.getReactNode(i)),a&&(s.title=o.getReactNode(a)),c&&(s.fallbackTooltip=o.getReactNode(c)),Object.assign(s,d)}}})}delete(e){this._container.addService(l.ATOMS_HANDLERS_ID,{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(l.ATOMS_HANDLERS_ID,{execute:r=>{const o=nn(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(av,()=>new ma).add(e,t??0,n)}handleInject(e,t,n){return l.getEmitter$1(this._container,l.HANDLE_ATOM_INSERT_ID).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},hv=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}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 mv(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function ga(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 gv=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=l.getEmitter$1(t,l.MODAL_SHOW_EVENT),this._closeModalEmitter=l.getEmitter$1(t,l.MODAL_CLOSE_EVENT),this._updateModalEmitter=l.getEmitter$1(t,l.MODAL_UPDATE_EVENT)}get _container(){return this._context.container}show(e){const t=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n=e.modalProps;return Rr(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:ga(r,n)})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;Rr(this._container,r=>{this._updateModalEmitter.fire(mv({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:ga(r,n)}))})}};function rn(e){return e?.surfaces?{surfaces:[...e.surfaces]}:{}}var vv=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)}},Ev=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}_createScriptHandle(e,t){const n=this._messageService.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,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 vv(t,n);return r}registerSandboxCSS(e,t){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{...rn(t),type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t,n){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{...rn(n),type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e,t){const n=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{...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(l.SANDBOX_EXTENSIONS_ID,{...rn(n),type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,r)}},_v=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function kr(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&_v.has(t)}function va(){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 Nr(){return`__settingsPanel:${va()}`}function Lr(e,t){return{type:e,props:t}}function bv(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!kr(e)}function Ea(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(kr(t)){const r=Nr();return n(e.add(r,t)),Lr(r,{})}if(typeof t=="function"){const r=Nr();return n(e.add(r,t)),Lr(r,{})}if(bv(t)){const r=t.type;if(typeof r=="string")return t;if(kr(r)||typeof r=="function"){const o=Nr();return n(e.add(o,r)),Lr(o,t.props)}return t}return t}var yv=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??va();Rr(this._container,n=>{const r=i=>this._trackRegistration(i),o=Ea(n,e.content,r),s=e.advancedTabs?.map(i=>({...i,content:Ea(n,i.content,r)}));l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire({...e,content:o,advancedTabs:s,instanceKey:t,type:l.ADVANCED_SETTINGS_PANEL})})}closeSettingsPanel(){this._clearPanelRegistrations(),l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire(null)}},_a={SandboxScriptApi:Ev,ElementsApi:pv,BlocksApi:dv,MessageService:hv,SettingsPanelApi:yv,ModalApi:gv};function Mr(e,t,n,r={}){const o=Object.assign({},e);for(const[s,i]of Object.entries(t))if(i!==void 0)if(n.includes(s)&&typeof i=="object"&&i!==null){const a=o[s],c=r[s]??{};o[s]=Object.assign({},typeof a=="object"&&a!==null?a:c,i)}else o[s]=i;return o}var pe={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}},Sv={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"},xr={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},ba={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},ze={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:pe.border,borderRadius:pe.borderRadius,textAlign:"center",padding:pe.padding},ya={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:pe.padding},Fr={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:pe.border,borderRadius:pe.borderRadiusCards};function wv(e){return{...Sv,...e}}function Iv(e){return{...xr,...e,bold:e?.bold??xr.bold,italic:e?.italic??xr.italic}}function Tv(e){return{...ba,...e,underline:e?.underline??ba.underline}}function Cv(e){return{...ze,...e,bold:e?.bold??ze.bold,italic:e?.italic??ze.italic,border:{...ze.border,...e?.border},borderRadius:{...ze.borderRadius,...e?.borderRadius},padding:{...ze.padding,...e?.padding}}}function Av(e){return{...ya,...e,padding:{...ya.padding,...e?.padding}}}function Dv(e){return{...Fr,...e,border:{...Fr.border,...e?.border},borderRadius:{...Fr.borderRadius,...e?.borderRadius}}}function Br(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 Sa(e){let t={...l.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function jr(e){return{text:wv(e.text),headings:Iv(e.headings),links:Tv(e.links),buttons:Cv(e.buttons),block:Av(e.block),cards:Dv(e.cards)}}var wa=l.createIdentifier$1("EmailSettingsPort"),Pv=1e4,Ia=class{_editor;_layoutSettingsChanged=new l.Emitter;_contentStylesChanged=new l.Emitter;_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(!Ui(this._editor.container)||!Be(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(wa);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return Br(this._settings().read())}_getCurrentContentStyles(){const e=Be(this._editor.container)?.current()?.get().attributes.common_styles;return jr(Sa(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(wa),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),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,s=o?.operation;if(s===l.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){const c=Br(o?.settings),d=this._getLayoutSnapshot(c);d!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=d,this._layoutSettingsChanged.fire(c));return}if(s!==l.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE)return;const i=jr(r.data?.settings?.commonStyles??{...l.COMMON_STYLES}),a=this._getContentSnapshot(i);a!==this._prevContentSnapshot&&(this._prevContentSnapshot=a,this._contentStylesChanged.fire(i))})})();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=Br(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=Pv){const t=Be(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=l.getEvent(r,l.events.ON_EMAIL_INIT_ID);return new Promise(s=>{let i=!1,a;const c=()=>{a&&(clearTimeout(a),a=void 0)},d=o(()=>{i||(i=!0,c(),d.dispose(),s())});a=setTimeout(()=>{i||(i=!0,d.dispose(),s())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Be(this._editor.container)?.current();if(!t)return;const n=Sa(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=Mr(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:pe.border,borderRadius:pe.borderRadius,padding:pe.padding})),e.block!==void 0&&(n.block=Mr(n.block||{},e.block,["padding"],{padding:pe.padding})),e.cards!==void 0&&(n.cards=Mr(n.cards||{},e.cards,["border","borderRadius"],{border:pe.border,borderRadius:pe.borderRadiusCards}));const r=JSON.stringify(n);He(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const o=jr(n);this._prevContentSnapshot=this._getContentSnapshot(o),this._contentStylesChanged.fire(o)}},Ov={..._a,EmailSettingsApi:Ia},Rv={..._a},X_={...Rv,EmailSettingsApi:Ia},kv={...Ov};function Nv(){pa.addAll(kv)}var Lv=[l.defineMixin(()=>{Nv()}),Ag,Bg,Cg,l.JWTMixin,Ig,l.OAuthMixin];async function Mv(){return(await ht()).asyncMixins}var xv=iv,Fv=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let o;try{o=await Mv()}catch(i){throw e.failPendingWaits(i),i}t=o(e);const s=await e.getInstanceAsync(l.INSTANCE_ID);Object.assign(s,t.instance||{});for(const i of e.getInstance(l.LATE_SURFACE_LISTENERS_ID)??[])i()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},Bv=l.combineMixins([...Lv]);function Ur(){let e,t=!1;const n=new Map,r=new Map;function o(){for(const s of r.values())s();r.clear()}return{event(s,i,a){const c=Symbol("subscription");return t||(n.set(c,{listener:s,priority:i,thisArg:a}),e&&r.set(c,e(s,i,a))),()=>{n.delete(c),r.get(c)?.(),r.delete(c)}},attach(s){o(),e=s;for(const[i,{listener:a,priority:c,thisArg:d}]of n)r.set(i,s(a,c,d))},dispose(){t=!0,o(),n.clear(),e=void 0}}}function jv(e){const t=Ur(),n=Ur(),r=Ur();return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(Ke).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 s=e.getInstance(Ke);if(s){s.notify(o);return}e.getInstanceAsync(Ke).then(i=>i.notify(o),()=>{})}}}var Ta=l.createIdentifier$1("CodeErrors"),Uv=[];function Hv(e){return e?.getInstance(Ta)?.get()??Uv}function $v(e){return e?.getInstance(Ta)!==void 0}var Vv=class extends l.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=ct(e),this.addDisposable(l.getEvent(e,l.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){const e=Ae(this._container);if(e&&Q(e.sessionKey())&&!e.hasSuspended())throw new Error("[emailmaker] no open email: only a block is shown");return Ci(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=>le(t,this._container))}async _readProjectBlocks(){const e=await Ai(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=>ut(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=>fr(n,this._container))}async getEmailSnapshot(){return ue(this.openEmail(),this._container)}async getBlockSnapshot(){const e=Ae(this._container),t=e?.current();return!e||!t||!Q(e.sessionKey())?null:(await t.whenReady(),le(Bt(t),this._container))}setEmailMeta(e){const t=cr(this._container);if(!t)return;const n=t.get().attributes.meta;He(t,{meta:Vt({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,o=>o&&Vt(o,e))}setBlockMeta(e,t){const n=Ae(this._container);if(n?.sessionKey()===At(e)){const o=n.current();o&&He(o,{meta:Vt({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,s=>s&&Vt(s,t))};this._blockMetaWrites=this._blockMetaWrites.then(r).catch(()=>{})}getCodeErrors(){return $v(this._container)?Hv(this._container):void 0}},Gv=l.createIdentifier$1("EmailDataController");function Yv(e){return e.getOrCreateInstance(Gv,()=>{const t=new Vv(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function Wv(e){const t=Yv(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 qv(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 Kv(e){let t;const n=ri(e),r=l.getEvent(e,l.events.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:s})=>{t=s}));const o=()=>t?qv(t):void 0;return{undoRedoService:{undo:()=>o()?.undo(),redo:()=>o()?.redo(),clear:()=>o()?.clear(),getPast:s=>o()?.getPast(s)??[],getFuture:s=>o()?.getFuture(s)??[],canUndo:()=>o()?.canUndo()??!1,canRedo:()=>o()?.canRedo()??!1,createSnapshot:()=>o()?.createSnapshot(),restoreSnapshot:s=>o()?.restoreSnapshot(s)}}}var zv=l.createIdentifier$1("plugin.mountElement");function Xv(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function Jv(e){return e.getOrCreateInstance(zv,()=>{let t=!1,n;return{get:()=>t?n:Xv(e),set(r){t=!0,n=r}}})}function Qv(e){const t=Jv(e);return{getElement:()=>t.get()}}function Zv(e){return{handleLoadImage:U(l.getEvent(e,l.events.UPLOAD_EVENT_ID)),handleFileProxy:U(l.getEvent(e,l.events.FILE_PROXY_EVENT_ID)),handleUrlProxy:U(l.getEvent(e,l.events.PROXY_URL_EVENT_ID)),handleAITextRequest:U(l.getEvent(e,l.events.AI_TEXT_REQUEST_ID)),handleAIImageRequest:U(l.getEvent(e,l.events.AI_IMAGE_REQUEST_ID)),handleReadLocale:U(l.getEvent(e,l.events.READ_LOCALE)),handleLimitUsage:U(l.getEvent(e,l.events.ON_LIMIT_ID)),handleTranslate:U(l.getEvent(e,l.events.ON_TRANSLATE_ID))}}var eE=[Mp,qm,jv,Fg,Wv,Kv,Qv,Zv];function tE(e,t=eE){const n=Sr(e);yg(e);const r=Bv(e),o=xv(e),s=Fv(e),i={...r.instance,...o.instance,...s.instance};for(const c of t)Object.assign(i,c(e));let a=!0;return{instance:i,async setOptions(c){await r.setOptions(c);const d=a&&n.get()===c;a=!1,d||n.set(c),await o.setOptions(c),await s.setOptions(c)}}}function nE(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 rE=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]}},oE="editor-runtime.react.copies",Hr=8;function mt(e){return e&&typeof e=="object"?e:void 0}function Ca(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 sE(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 iE(e,t,n){return e.package===t&&e.version===n}function aE({ourReact:e,entries:t,packageName:n,version:r}){const o=Ca(e);if(!o||!Array.isArray(t))return[];const s=[],i=new Set;for(const a of t){const c=mt(a);if(!c||!iE(c,n,r))continue;const d=Ca(c.react);!d||d===o||i.has(d)||(i.add(d),s.push({package:n,version:r,reactVersion:sE(c.react),react:c.react}))}return s}function lE({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,Hr))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Hr&&n.push(` …and ${t.length-Hr} 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(`
|
|
2153
|
-
`)}var Aa=new Set;function
|
|
2152
|
+
`)}function Ri(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function am(e,t,n,r){const o=lm(e,t,n,r);return o===void 0}function lm(e,t,n,r){if(zt(t))return"block";const{email:o}=Xt(t,!1),s=Xe(o,e),i=s.id;if(i===void 0)return"no-id";if(r!==void 0&&r!==i)return"other-id-shown";const a=Re(e)?.current();if(!a)return"no-session";const c=a.get(),d=c.attributes;if(c.serverId!==i)return"document-id";if(d.is_inited!==!0)return"not-inited";const u=Ri(fr(n??a.getContent()));if(s.html!==void 0&&Ri(fr(s.html))!==u)return"html";if(s.subject!==void 0&&s.subject!==d.subject)return"subject";if(s.preheader!==void 0&&s.preheader!==d.preheader)return"preheader";if(s.common_styles!==void 0&&s.common_styles!==d.common_styles)return"common_styles"}function ki(e,t){if(zt(t))return;const{email:n}=Xt(t,!1),r=Xe(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:fr(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function cm(e,t){const n={...e};return delete n.id,{...n,...t}}function dm(e){return e.html?e:{...e,html:wi}}function xe({code:e,project:t,...n},r,o){const s=o??sr(r);return{...n,...e?{html:ye(r).toEditorForm(e)}:{},renderGuid:l.generateUUID(),...s===void 0?{}:{project:s}}}function le({html:e,renderGuid:t,...n},r){const{requested:o}=dt(r);return ve({...n,code:ye(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 Ni(e){return Re(e)?.current()?.get().serverId??void 0}function pr(e,t,n){return n===void 0&&(n=e.post===void 0?Ni(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function pt(e,t){return ve({...e,link:void 0,comment_status:void 0})}function Qt({code:e,autosave:t,...n},r,o){return o===void 0&&(o=n.parent===void 0?Ni(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||Tc(n.slug),parent:o}}function hr({html:e,isAutosave:t,...n},r){return ve({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:ve({html:e,ampHtml:e&&""})})}function Zt({code:e,autosave:t,...n},r){return{...n,...e?{html:e}:{},isAutosave:t===!0,parent:r??n.parent}}function Li({html:e,isAutosave:t,...n}){return ve({...n,autosave:t?!0:void 0,code:e,guid:void 0})}var Je=l.createIdentifier$1("NotificationService"),um=l.createIdentifier$1("emailTemplate.reads");async function fm(e,t){try{return await Oe(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,hm(e,t,n);return}}var pm=l.createIdentifier$1("emailTemplate.notifiedFailures");function hm(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(pm,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(Je).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function mm(e,t){const n=e.getOrCreateInstance(um,()=>new Map),r=n.get(t);if(r!==void 0)return r;const o=fm(e,t).then(s=>(s===void 0&&n.delete(t),s));return n.set(t,o),o}var mr="EXTERNAL",Mi=Symbol("supersededShow");function gm(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var vm="email_id";function gr(e){return Object.entries(e).some(([t,n])=>t!=="id"&&n!==void 0)}async function Em(e,t){const n=Tt();let r;try{return await Promise.race([e,new Promise((o,s)=>{r=setTimeout(()=>{e.then(t,()=>{}),s(new Ct(n,"handleSaveBlock","block"))},n)})])}finally{clearTimeout(r)}}var _m=class extends l.Disposable{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_latestShow=Promise.resolve();_dataSources;_eventLock;_queue=l.createQueue();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=ut(t),this._eventLock=rm(t);const n=q(e,l.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(q(e,l.events.OPEN_BLOCK_REQUEST_ID)(r=>this.openBlock(r))),this.addDisposable(e.addService(l.REQUEST_HANDLER_ID,{execute:(r,o)=>{!o?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(vm,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(l.INIT_PIPELINE_ID)??Hn}_throwIfDestroyed(){if(this.isDisposed())throw be()}async getTemplateEmail(e){const t=await mm(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 ft(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,Qt(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,pr(o,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,o){const s=this._dataSources.emails,i=s.cache,a=await ft(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=Xe(e,this._container);const u=d.id;let p=u;if(u!==void 0){const f=await s.get(u);d={...f??{},...d,utm_parameters:d.utm_parameters??f?.utm_parameters??{},renderGuid:f?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...o?{showId:o}:{},project:a}}else{p=n??l.generateUUID();const f=await s.get(p);d={...d,utm_parameters:d.utm_parameters??{},renderGuid:f?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...o?{showId:o}:{},project:a},delete d.project}if(t){const f=await this.getTemplateEmail(String(t));f&&(d=cm(f,d))}return u===void 0&&(d=dm(d)),await i.setAll([[p,d]]),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==ki(this._container,e))return!1;const n=Jt(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:Jt(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&om({ticket:t,emailId:Pi(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,Mi;if(!e)return;const n=this._getInitPipeline();if(l.throwIfAborted(n.signal),zt(e))return this._showBlock(e,n);const r=Q(se(this._container).sessionKey()),o=sm(e);if(!r&&!o&&am(this._container,e,Jt(this._container),this._prevCommand?.id)||!r&&!o&&this._isRepeatOfLastShow(e))return;const s=Xt(e);s.email.id,this._prevCommand?.id;let i,a="",c=0,d=!1,u,p=Promise.resolve(),f,g=!1;try{this._eventLock.suspendChange();const{email:y,blocks:_,autosaves:m,comments:I,templateId:P,reload:x}=s;i=y.id;const L=Xe(y,this._container),C=L.id,E=C??l.generateUUID(),S=await Pe("getProject",ft(this._container));l.throwIfAborted(n.signal),a=l.generateUUID();const w={isNew:C===void 0,id:String(E),project:S},O=x===!0&&C!==void 0;O&&(await this._dataSources.emails.remove(String(C),{silent:!0}),String(C)),c=++this._showToken,String(E);const N=[];N.push(this.setBlocks(_)),y.id!==void 0&&(N.push(this.setComments(I)),N.push(this.setEmailRevisions(m,String(y.id)))),N.push(this.setEmail(y,Number(P),C===void 0?String(E):void 0,c,a)),await Pe("setEmail+blocks+revisions",Promise.all(N),{emailId:C??String(E),showId:a,targetShowToken:c}),l.throwIfAborted(n.signal);const A=await this._dataSources.emails.get(String(E)),T=se(this._container),R={id:a,token:c};if(r){$t(this._container);const b=T.suspendedDocument()?.get().serverId;!O&&C!==void 0&&b!=null&&String(b)===String(C)&&T.resumeSuspended()}C===void 0?f=T.startNewDraft(A??L,{patch:L,show:R}):O?f=T.reload(C,{email:A??L,patch:L,show:R}):T.sessionKey()===$e(C)?f=T.show(L,R):f=T.open(C,{email:A??L,patch:L,show:R}),T.beginShowFill(a);const M=!!this._prevCommand&&l.deepEqual(this._prevCommand,w);w.id,!this._prevCommand||l.deepEqual(this._prevCommand,w),this._prevCommand?.id,this._rememberShow(w),p=n.requestShow({showId:a,navId:String(E),emailId:C,isNew:C===void 0}),g=!0;const v=()=>T.endShowFill(a);Promise.allSettled([p,f.whenReady()]).then(v),String(E),d=!0}catch(y){u=y,g&&a&&n.failShow(a,y),a&&Re(this._container)?.endShowFill(a),l.isAbortError(y)||(vo(y),void 0)}finally{this._eventLock.resumeChange()}if(!d)throw u instanceof Error?u:new Error(`[emailmaker] show() setup failed: ${String(u??"unknown error")}`);return Pe("show-init-deferred",Promise.all([p,f?.whenReady().catch(y=>{if(y instanceof De){const _=Rn(y);throw _?new Error(`[emailmaker] show(): email open failed (${_})`,{cause:y}):y}})??Promise.resolve()]).then(()=>{}),{showId:a,emailId:i??null}).then(()=>{this._rememberShownContent(e)})}async _showBlock(e,t){const{block:n,byId:r,blocks:o,revisions:s,reload:i}=nm(e),a=l.generateUUID();let c=!1;try{await this.setBlocks(o),l.throwIfAborted(t.signal),i&&(await this._dataSources.blocks.remove(String(n.id),{silent:!0}),this._dataSources.blocks.byForeignKey("project").clear(),String(n.id));const d=n.id!==void 0&&n.id!==""?String(n.id):void 0,u=se(this._container);if(!i&&d!==void 0&&u.sessionKey()===Pt(d)){const P=gr(n)?await this._storeShownBlock(n):void 0,x={id:a,token:++this._showToken},L=u.show(P,x),C=t.requestShow({showId:a,navId:d,emailId:void 0,isNew:!1});c=!0,await Pe("show-block-init",Promise.all([C,L?.whenReady().catch(()=>{})]),{showId:a});return}const p=r||i?await Di(this._container,String(n.id)):void 0,f=p&&(i||gr(n))?await this._storeShownBlock({...le(p,this._container),...n}):r||i?p:await this._storeShownBlock(n);if(l.throwIfAborted(t.signal),!f)throw new Error(`[emailmaker] show(): block ${String(n.id)} not found`);s!==void 0&&f.id!==void 0&&await this._dataSources.blocksRevision.cache.setAll(s.filter(P=>P.id!==void 0).map(P=>[P.id,Zt(P,String(f.id))])),this._prevCommand=void 0,this._lastShow=void 0;const g=f.id!==void 0?String(f.id):l.generateUUID(),y={id:a,token:++this._showToken};$t(this._container);const _=i?u.reloadBlock(g,f,y):u.openBlock(g,f,y);f.id;const m=t.requestShow({showId:a,navId:g,emailId:void 0,isNew:f.id===void 0});c=!0;const I=_.whenReady().catch(P=>{if(P instanceof De)throw P});await Pe("show-block-init",Promise.all([m,I]),{showId:a})}catch(d){throw c&&t.failShow(a,d),d}}async _storeShownBlock(e){const t=xe(e,this._container,await ft(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();l.throwIfAborted(e.signal);const t=se(this._container);if(Q(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:mr,fallbackTitle:ss(this._container)});if(l.throwIfAborted(e.signal),!n)throw gm(t.emailSaveState().error);return fe(Ci(this._container,this._currentEmail),this._container)}async _saveBlock(){this._throwIfDestroyed();const e=se(this._container),t=e.current();if(!t||!Q(e.sessionKey()))throw new Error("[emailmaker] saveBlock(): no open block");return im(t,async()=>{await t.whenReady();const n=Ht(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}:{}},s=this._dataSources.blocks,i=await Em(t.get().serverId==null?s.create(o,{source:mr}):s.update(String(t.get().serverId),o,{source:mr}),a=>{a&&se(this._container).current()===t&&t.get().serverId==null&&a.id!==void 0&&t.markSaved(r,String(a.id))});if(!i)throw new Error("[emailmaker] save(): block was not saved");return t.markSaved(r,i.id!==void 0?String(i.id):void 0),le(i,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(),l.throwIfAborted(this._getInitPipeline().signal);const t=typeof e=="string"?{id:e}:e,n=t.id!==void 0&&t.id!==""?String(t.id):void 0,r=se(this._container);if(n!==void 0&&r.sessionKey()===Pt(n))return;const o=t.code===void 0&&n!==void 0?await Di(this._container,n):void 0,s=o&&gr(t)?await this._storeShownBlock({...le(o,this._container),...t}):t.code===void 0&&n!==void 0?o:await this._storeShownBlock(t);if(!s)throw new Error(`[emailmaker] openBlock(): block ${String(n)} not found`);$t(this._container);const i=r.openBlockOver(s.id!==void 0?String(s.id):l.generateUUID(),s);s.id,r.hasSuspended(),ie(this._container,l.events.ON_BLOCK_OPEN_ID).fire({block:s}),await i.whenReady().catch(a=>{if(a instanceof De)throw r.current()===i&&(ie(this._container,l.events.ON_BLOCK_CLOSE_ID).fire({block:s,hasUnsavedChanges:!1}),r.resumeSuspended()),a})}async _closeBlock(){this._throwIfDestroyed(),Ef(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 bm(e){return String(e).replace(/"/g,""")}function ym(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 Sm(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 xi(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),o=bm(n);return r.test(e)?e.replace(r,`${t}="${o}"`):e.replace(/>$/,` ${t}="${o}">`)}function wm(e,t,n){if(!e?.trim()||!t)return e;const r=Sm(e);if(!r)return e;const o=String(t),s=ym(n??new Date);let{full:i,index:a}=r;const c=i.length;return/\bem-block-id\s*=/.test(i)||(i=xi(i,"em-block-id",o)),i=xi(i,"em-block-version",s),e.slice(0,a)+i+e.slice(a+c)}function Im(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 Tm(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:Im(e)}}function vr(e,t){return t?Tm(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var Fi=["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"],Cm=[...Fi,"html","id","project","password"],X_=new Set(["html",...Fi,"global_block","project"]);function Am(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(Cm),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 Dm(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...Am(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 Er=new WeakMap;function Pm(e){let t=Er.get(e);return t||(t={byId:new Map,fallback:[]},Er.set(e,t)),t}function Om(e){Er.delete(e)}function Rm(e,t){const{byId:n,fallback:r}=Pm(t);if(e.blockId){const o=n.get(e.blockId);if(o){n.delete(e.blockId);const s=r.indexOf(o);return s>=0&&r.splice(s,1),o}return}for(let o=r.length-1;o>=0;o--){const s=r[o],i=e.name!=null&&e.name!==""&&s.name!=null&&s.name!==""&&s.name===e.name,a=e.type!=null&&e.type!==""&&s.insertFrom===e.type;if(i&&a)return r.splice(o,1),s.id!=null&&s.id!==""&&n.delete(String(s.id)),s}}async function km(e,t){const{blocks:n}=ut(e);return await n.cache.getIfPresent(t)??void 0}async function Nm(e,t){if(!t.blockId)return;const n=await km(e,t.blockId);if(n)return Dm(n,t)}async function Lm(e,t){const n=Rm(e,t);if(n)return vr(e,n);const r=await Nm(t,e);return r?vr(e,r):vr(e,void 0)}var Mm=l.createIdentifier("application_block_inserted"),xm=-1e3,Bi=new WeakSet;function Fm(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 Bm(e){if(!e||Bi.has(e))return;Bi.add(e);const t=new l.Disposable,n=re(e);return t.addDisposable(n.addListenerAsyncPipe(Mm,async(r,o)=>{const s=Fm(r)?await Lm(r,e):r;return o?o(s):s},xm)),t.addDisposable({dispose:()=>{Om(e)}}),t}var jm=xt("plugin.readBlockAutosave"),J_=l.createIdentifier$1("blockDocuments.provided"),ji=l.createIdentifier$1("plugin.earlyWindow");function Um(e){return e.getOrCreateInstance(ji,()=>({depth:0}))}function Hm(e){const t=Um(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function Ui(e){return(e?.getInstance(ji)?.depth??0)>0}function Hi(e,t){let n,r=!1;return e(o=>{n=o,r=!0}),(o,s,i)=>{const a=e(o,s,i);if(r&&Ui(t)){const c=n;queueMicrotask(()=>{o.call(i,c)})}return a}}var _r=100,$m=class extends l.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=Bm(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:o,blocksRevision:s}=ut(e),i=q(e,l.events.ON_SHARE_ID),a=q(e,l.events.ON_SHOW_PREVIEW_ID),c=q(e,l.events.ON_EMAIL_CLONE_ID),d=q(e,l.events.ON_BLOCK_OPEN_ID),u=q(e,l.events.ON_BLOCK_CLOSE_ID),p=q(e,l.events.ON_BLOCK_CLONE_ID),f=q(e,l.events.ON_BLOCK_INIT_ID),g=q(e,l.events.ON_BLOCK_CHANGED_ID),y=q(e,l.events.ON_CODE_VALIDATE_ID),_=q(e,l.events.ON_IMPORT_VALIDATE_ID),m=q(e,l.events.ON_SUBJECT_CHANGED_ID),I=q(e,l.events.ON_EMAIL_CHANGED_ID),P=q(e,l.events.ON_PREHEADER_CHANGED_ID),x=q(e,l.events.ON_SAVEBUTTON_CLICK_ID),L=q(e,l.events.ON_BLOCK_SAVEBUTTON_CLICK_ID),C=q(e,l.events.ON_NEXTBUTTON_CLICK_ID),E=q(e,l.events.ON_SEND_LIVEPREVIEW_ID),S=q(e,l.events.ON_SEND_TESTEMAIL_ID),w=q(e,Qh),O=q(e,l.events.ON_CONTENT_CHANGED_ID),N=q(e,Jh),A=q(e,l.events.ON_PREVIOUSBUTTON_CLICK_ID),T=q(e,l.events.ON_SEND_EMAIL_MODAL_ID),R=l.filter(q(e,l.events.ON_EMAIL_INIT_ID),v=>!v.reset),M=q(e,l.events.ON_ANALYTICS_EVENT);return{handlePreheaderChanged:$(P),handleSubjectChanged:$(m),handleValidate:$(y),handleImportValidate:$(_),handleReadEmail:$(n.handlerRead,v=>v,v=>v&&Xe(v,e)),handleSaveEmail:$(n.onSave,function({prev:v,patch:b,value:F,source:V}){const h=v?fe(v,e):void 0;return{prev:h,patch:lt(h,fe(b,e)),value:fe(F,e),source:V}},v=>v?Xe(v,e):void 0),handleRemoveEmail:$(n.onRemove,({value:v,source:b})=>({value:fe(v,e),source:b}),()=>{}),handleReadCommonBlocks:$(w,v=>v.project,v=>v?.map(b=>xe(b,e))),handleReadTemplateBlocks:$(N,v=>v,v=>v?.map(b=>xe(b,e))),handleReadBlocks:$(t.byForeignKey("project").handleRead,v=>dt(e).requested||String(v),v=>v?.map(b=>xe(b,e))),handleReadBlock:$(t.handlerRead,v=>v,v=>v?xe(v,e):void 0),handleOpenBlock:$(d,({block:v})=>({block:le(v,e)})),handleCloseBlock:$(u,({block:v,hasUnsavedChanges:b})=>({block:le(v,e),hasUnsavedChanges:b})),handleCloneBlock:$(p,v=>le(v,e)),handleSaveBlock:$(t.onSave,function({prev:v,patch:b,value:F,source:V}){const h=F.global_block===!0&&F.id&&typeof F.html=="string"?{...F,html:wm(F.html,String(F.id))}:F,D=v?le(v,e):void 0;return{prev:D,patch:lt(D,le(b,e)),value:le(h,e),source:V}},v=>v?xe(v,e):void 0),handleRemoveBlock:$(t.onRemove,({value:v,source:b})=>({value:le(v,e),source:b}),()=>{}),handleReadComments:$(r.byForeignKey("post").handleRead,v=>v,v=>v?.map(b=>pr(b,e))),handleSaveComment:$(r.onSave,function({prev:v,patch:b,value:F,source:V}){const h=v?pt(v,e):void 0;return{prev:h,patch:lt(h,pt(b,e)),value:pt(F,e),source:V}},v=>v?pr(v,e):void 0),handleRemoveComment:$(r.onRemove,({value:v,source:b})=>({value:pt(v,e),source:b}),()=>{}),handleReadEmailRevisions:$(o.byForeignKey("parent").handleRead,v=>v,v=>v?.map(b=>Qt(b,e))),handleReadEmailAutosave:$(q(e,ai),v=>v,v=>v?Qt(v,e):null),handleEmailAutosave:$(o.onSave,function({prev:v,patch:b,value:F,source:V}){return{value:hr(F,e),source:V}},v=>v?Qt(v,e):void 0),handleRemoveEmailAutoSave:$(o.onRemove,({value:v,source:b})=>({value:hr(v,e),source:b}),()=>{}),handleReadBlockRevisions:$(s.byForeignKey("parent").handleRead,v=>v,v=>v?.map(b=>Zt(b))),handleReadBlockAutosave:$(q(e,jm),v=>v,v=>v?Zt(v):null),handleBlockAutosave:$(s.onSave,({value:v,source:b})=>({value:Li(v),source:b}),v=>v?Zt(v):void 0),handleRemoveBlockAutoSave:$(s.onRemove,({value:v,source:b})=>({value:Li(v),source:b}),()=>{}),handleBlockInit:$(f,v=>le(v,e)),handleBlockChanged:$(l.debounce(g,_r),v=>le(v,e)),handleEmailChanged:$(l.debounce(I,_r),v=>fe(v,e)),handleEmailInit:Hi($(R,v=>fe(v,e)),e),handlePreviousButtonClick:$(A,v=>fe(v,e)),handleNextButtonClick:$(C,v=>fe(v,e)),handleSaveButtonClick:$(x,v=>fe(v,e)),handleSaveBlockButtonClick:$(L,v=>le(v,e)),handleHtmlChanged:$(l.debounce(O,_r)),handleTestEmailSend:$(S,({html:v,...b})=>({...b,code:v,compiled:{html:v,ampHtml:""}})),handleTestEmailModal:$(T,v=>fe(v,e)),handleCloneEmail:$(c,v=>fe(v,e)),handleShareEmail:$(i),handlePreviewEmail:$(a),handleLivePreviewEmail:$(E),handleAnalyticsEvent:$(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 Ke(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},Vm=l.createIdentifier$1("DataController"),Gm=l.createIdentifier$1("DataEvents");function $i(e){return e.getOrCreateInstance(Vm,()=>{const t=new _m(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function Vi(e){return e.getOrCreateInstance(Gm,()=>new $m(e))}var Ym=l.createIdentifier$1("plugin.pluginStart");function Gi(e){return e.getOrCreateInstance(Ym,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t()),{done:n,finish:t}})}function Wm(e){return Gi(e).done}function qm(e){const t=Gi(e);return t.run===void 0&&(t.run=(e.getInstance(l.PLUGIN_COLLECTION_ID)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var Km=l.createIdentifier$1("plugin.startupShow");function zm(e){const t=$i(e),n=Vi(e),r=e.getInstance(l.OPTIONS_SOURCE_ID),o=e.getInstance(l.DISPOSABLE_ID),s={current:Promise.resolve()};e.inject(Km,s);let i=!1;const a=r?.watch(d=>{d&&n.setOptions(d),i=(d?.plugins?.length??0)>0,s.current=s.current.catch(()=>{})}),c=r?.select(d=>d?.content).watch(d=>{if(d===void 0)return;const u=()=>(J(oe.showStart),t.show(d).finally(()=>J(oe.showEnd))),p=i?Wm(e).then(u):u();p.catch(()=>{}),s.current=p});a&&o?.addDisposable(a),c&&o?.addDisposable(c)}function Xm(e){const t=$i(e);return{...Vi(e).get(),show(n){return J(oe.showStart),t.show(n).finally(()=>J(oe.showEnd))},openBlock(n){return t.openBlock(n)},closeBlock(){return t.closeBlock()},showBlock(n,r){return J(oe.showStart),t.showBlock(n,r).finally(()=>J(oe.showEnd))},save(){return t.save()},saveBlock(){return t.saveBlock()}}}function Yi(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function en(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",o=!1;for(let s=t;s<e.length;s++){const i=e[s];if(o){o=!1;continue}if(i==="\\"){o=!0;continue}if(r){i===r&&(r="");continue}if(i==='"'||i==="'"){r=i;continue}if(i==="("){n++;continue}if(i===")"&&(n--,n<0))return!1}return n===0}function Jm(e){return(t,n,r)=>en(t)?e(t,n,r):!1}function Qm(e){return t=>en(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function Zm(e){return(t,n,r)=>en(t)?Yi(t)?e(t,n,r):t:!1}function eg(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return en(n)?Yi(n)?e(t):t:!1}}function tg(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function br(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 ng(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let o="";for(let s=0;s<e;s++){const i=r[s]%62;o+=t.charAt(i)}return o}var rg=8,og=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=ng(rg),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},tn=new og;function Wi(e,t){return t!==void 0&&!br(e,t)?`%|{${tn.getOrCreateByKey(e)}}|%`:e}function sg(e){const t=tn.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function ee(e,t,n){return t!==void 0?br(e,t)?e:`%|{${tn.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function ig(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function Z(e){return e.startsWith("<!--")&&e.endsWith("-->")?ig(e.slice(4,-3)):e}function ag(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 s=r.trim();return t.test(s)||n.test(s)}function lg(e,t,n){return t!==void 0?br(e,t)?e:`%|{${tn.getOrCreateByKey(e)}}|%`:n||tg(e)||ag(e)?`<!--${e}-->`:e}var Fe=Jm(ee),Be=Qm(Z),cg=Zm(ee),dg=eg(Z),qi=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",sg),e.escape("@{","}",ee,!0).unescape("<!--@{","}-->",Z,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",Wi,!0),e.escape("{{","}}",Wi,!0),e.createSyntax("brace-percent").escape("{%","%}",ee).unescape("<!--{%","%}-->",Z),e.createSyntax("brace-hash").escape("{#","#}",ee).unescape("<!--{#","#}-->",Z),e.createSyntax("proscript").escape("[%","%]",lg,!0).unescape("<!--[%","%]-->",Z,!0),e.createSyntax("getresponse").escape("[[IF","]]",ee).escape("[[if","]]",ee).escape("[[ELSE]]","",ee).escape("[[else]]","",ee).escape("[[ENDIF]]","",ee).escape("[[endif]]","",ee).unescape("<!--[[IF","]]-->",Z).unescape("<!--[[if","]]-->",Z).unescape("<!--[[ELSE]]","-->",Z).unescape("<!--[[else]]","-->",Z).unescape("<!--[[ENDIF]]","-->",Z).unescape("<!--[[endif]]","-->",Z),e.createSyntax("expert-sender").escape("<if",">",ee).escape("</if",">",ee).escape("<else",">",ee).escape("</else",">",ee).escape("<var ",">",ee,!0).unescape("<!--<if ",">-->",Z).unescape("<!--</if",">-->",Z).unescape("<!--<else ",">-->",Z).unescape("<!--</else",">-->",Z).unescape("<!--<var",">-->",Z,!0),e.createSyntax("velocity").escape("#if",")",Fe).escape("#elseif",")",Fe).escape("#else","",ee).escape("#foreach",")",Fe).escape("#macro",")",Fe).escape("#set",")",cg,!0).escape("#parse",")",Fe).escape("#include",")",Fe).escape("#evaluate",")",Fe).escape("#end","",ee).escape("#break","",ee).escape("#stop","",ee).unescape("<!--#macro","-->",Be).unescape("<!--#if","-->",Be).unescape("<!--#elseif","-->",Be).unescape("<!--#else","-->",Z).unescape("<!--#foreach","-->",Be).unescape("<!--#parse","-->",Be).unescape("<!--#include","-->",Be).unescape("<!--#evaluate","-->",Be).unescape("<!--#end","-->",Z).unescape("<!--#break","-->",Z).unescape("<!--#stop","-->",Z).unescape("<!--#set","-->",dg,!0),e.createSyntax("mailchimp").escape("*|","|*",ee).unescape("<!--*|","|*-->",Z)},yr="bare",ug=new Map;function fg(e){return e?ug.get(e)??yr:yr}var Ki=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function zi(e){return Ki.includes(e)}function ht(e){return e==="bare"||e==="html-comment"}function Sr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pg(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!ht(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[d,u]of[["output",r.output],["editor",r.editor]])if(u!==void 0&&!ht(u))return t(`templateDirectives.${d}: unknown form "${String(u)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!Sr(r.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),n;if(r.syntaxes){for(const[d,u]of Object.entries(r.syntaxes))if(!(!zi(d)||u===void 0||ht(u))){if(!Sr(u))return t(`templateDirectives.syntaxes.${d}: expected a form or an object, configuration ignored.`),n;for(const p of["output","editor"]){const f=u[p];if(f!==void 0&&!ht(f))return t(`templateDirectives.syntaxes.${d}.${p}: unknown form "${String(f)}", configuration ignored.`),n}}}if(r.output===void 0&&r.editor===void 0&&r.syntaxes===void 0)return n;const o=r.output??yr;let s=r.editor;o==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),s=void 0);const i=[];if(r.syntaxes)for(const d of Object.keys(r.syntaxes)){if(!zi(d)){t(`templateDirectives.syntaxes: unknown syntax id "${d}", entry ignored.`);continue}i.push(d)}else i.push(...Ki);const a={},c={};for(const d of i){const u=r.syntaxes?.[d],p=Sr(u)?u:void 0,f=(ht(u)?u:p?.output)??o;let g=p?.editor??s??f;f==="bare"&&g==="html-comment"&&(t(`templateDirectives.syntaxes.${d}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),g="bare"),a[d]=f,c[d]=g}return{output:a,editor:c}}function Xi(e,t,n,r){for(let o=t;o<n;o++){const s=e[o];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?s===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(s)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):s==="<"?r.insideTag=!0:s===">"?r.insideTag=!1:r.insideTag&&(s==='"'||s==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=s,r.unquotedAttr=!1):r.insideTag&&/\S/.test(s)&&r.attributeQuoteChar===void 0&&e[o-1]==="="&&!['"',"'","`"].includes(s)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function mt(e,t){return e.start<t.end&&t.start<e.end}function Ji(e,t,n,r,o=[]){if(n&&(t=t.filter(u=>u.isVariable)),!t.length)return[];const s=t.flatMap(u=>u.match(e).flatMap(p=>!Number.isInteger(p.start)||!Number.isInteger(p.end)||p.start<0||p.end>e.length||p.start>=p.end?[]:[{range:p,mapFn:u.mapFn,overrideBuiltins:u.overrideBuiltins,syntax:u.syntax,isVariable:u.isVariable}])).sort((u,p)=>u.range.start-p.range.start||u.range.end-p.range.end),i=[],a=o.slice().sort((u,p)=>u.start-p.start),c={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let d=0;for(const{range:u,mapFn:p,overrideBuiltins:f,syntax:g,isVariable:y}of s){if(r?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):Xi(e,d,u.start,c),d=u.end,a.some(P=>mt(P,u)))continue;const _=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,m=e.substring(u.start,u.end),I=p(m,_,c.insideTag);I!==!1&&I!==m&&(i.push({range:u,text:I,overrideBuiltins:f,syntax:g,isVariable:y}),a.push(u))}return i.sort((u,p)=>u.range.start-p.range.start||u.range.end-p.range.end)}function hg(e,t){const n=t.reduce((a,{mapFn:c,start:d,end:u,syntax:p,isVariable:f})=>(a[d]||(a[d]=[]),a[d].push({value:u,mapFn:c,syntax:p,isVariable:f}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),o=new RegExp(r,"g"),s=[];let i;for(;(i=o.exec(e))!==null;){const a=i[0];s.push({start:i.index,startToken:a,endTokens:n[a]})}return s}function wr(e,t,n,r,o=!1){const s=[];if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return s;const i=hg(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(let d=0;d<i.length;d++){const{start:u,startToken:p,endTokens:f}=i[d];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):Xi(e,c,u,a),c=u;const g=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let y=!1;for(const{mapFn:_,value:m,syntax:I,isVariable:P}of f){let x=u+p.length,L=e.indexOf(m,x);for(;L!==-1;){let C=L,E=u+p.length,S=0;for(;C!==-1;){const T=e.indexOf(p,E);if(T!==-1&&T<C)S++,E=T+p.length,C=e.indexOf(m,E);else if(S>0)S--,E=C+m.length,C=e.indexOf(m,E);else break}if(C<0)break;const w=C+m.length,O=e.substring(u,w),N=_(O,g,a.insideTag);if(N===!1){x=L+Math.max(m.length,1),L=e.indexOf(m,x);continue}(o||N!==O)&&s.push({range:{start:u,end:w},text:o?O:N,syntax:I,isVariable:P});const A=i.findIndex(({start:T})=>T>=w);A>d?d=A-1:d=i.length,y=!0;break}if(y)break}}return s}function nn(e,t){if(!t.length)return e;const n=t.slice().sort((o,s)=>s.range.start-o.range.start);let r=e;for(const{text:o,range:s}of n)r=r.slice(0,s.start)+o+r.slice(s.end);return r}var mg=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=qi){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,o,s,i){return t.push({start:r,end:o,mapFn:s,isVariable:i,syntax:this.syntax||r}),this},unescape(r,o,s,i){return n.push({start:r,end:o,mapFn:s,isVariable:i,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 s={dispose:()=>{o||(o=!0,this._escapeMatchers=this._escapeMatchers.filter(i=>i!==n),this._unescapeMatchers=this._unescapeMatchers.filter(i=>i!==r))}};return this.addDisposable(s),s}_collectMappings(e,t,n){const r=wr(e,this._escapes,t,n),o=Ji(e,this._escapeMatchers,t,n),s=o.filter(c=>c.overrideBuiltins).map(c=>c.range),i=r.filter(c=>!s.some(d=>mt(d,c.range))),a=o.filter(c=>c.overrideBuiltins||!i.some(d=>mt(c.range,d.range)));return[...i,...a].sort((c,d)=>c.range.start-d.range.start||c.range.end-d.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=wr(e,this._unescapes,t),r=Ji(e,this._unescapeMatchers,t,!1),o=r.filter(a=>a.overrideBuiltins).map(a=>a.range),s=n.filter(a=>!o.some(c=>mt(c,a.range))),i=r.filter(a=>a.overrideBuiltins||!s.some(c=>mt(a.range,c.range)));return[...s,...i].sort((a,c)=>a.range.start-c.range.start||a.range.end-c.range.end)}getRevertMappings(e,t,n){const r=n?o=>o!==void 0&&n.has(o):o=>fg(o)==="html-comment";return this._collectRevertMappings(e,t).filter(o=>o.isVariable||!r(o.syntax))}getDetectedMappings(e,t,n){return wr(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=s=>s===void 0?void 0:t[s],r=Object.values(t);let o=e;return r.includes("bare")&&(o=nn(o,this._collectRevertMappings(o).filter(s=>n(s.syntax)==="bare"))),r.includes("html-comment")&&(o=nn(o,this._collectMappings(o).filter(s=>!s.isVariable&&n(s.syntax)==="html-comment"&&s.text.startsWith("<!--")&&s.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 Qi(e){return e.replace("<script","<___script").replace("<\/script>","</___script>")}var Zi=new mg(e=>{e.escape("<script","<\/script>",t=>Qi(t)).unescape("<___script","</___script>",t=>t.replace("<___script","<script").replace("</___script>","<\/script>")),e.escape("<script","/>",t=>Qi(t)).unescape("<___script","/>",t=>t.replace("<___script","<script")),qi(e)});function gg(e){const t=pg(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return So();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:yo(r)}}function vg(e){let t;e.injectFactory(l.TEMPLATE_DIRECTIVES_ID,()=>{const n=e.getInstance(l.CONFIG_SOURCE_ID)?.layers().user.templateDirectives;return(!t||t.raw!==n)&&(t={raw:n,policy:gg(n)}),t.policy})}function Q_(e){return e}var Eg=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function _g(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 bg(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 ea(e){const t=_g(e),n=[],r=new Set,o=[],s=new Set,i=a=>{if(!r.has(a)){if(s.has(a)){const c=o.indexOf(a);throw new Eg([...o.slice(c),a].map(d=>d.name))}s.add(a),o.push(a);for(const c of bg(a,t))i(c);o.pop(),s.delete(a),r.add(a),n.push(a)}};for(const a of e)i(a);return n}var yg=[{name:"rest.client",setup:qh},{name:"auth.oauth",setup:l.provideOAuth},{name:"rest.identityHeaders",setup:xh},{name:"rest.localeHeader",setup:$h},{name:"lifetime.destroyable",provides:[rr],setup:Fp},{name:"appInit",provides:[l.APP_ID,vn],setup:Cl},{name:"config",provides:[l.CONFIG_SOURCE_ID],setup:Mp},{name:"templateDirectives",provides:[l.TEMPLATE_DIRECTIVES_ID],setup:vg},{name:"email.documents",setup:nh},{name:"show.initPipeline",provides:[l.INIT_PIPELINE_ID],setup:Kh},{name:"show",setup:zm},{name:"locale.service",provides:[ze],setup:kh},{name:"locale.fromConfig",awaits:{services:[l.CONFIG_SOURCE_ID,ze]},setup:Nh},{name:"canvas.early",setup:Of},{name:"canvas.previewSettings",setup:Wf},{name:"canvas.sandboxExtensions",setup:Kf},{name:"canvas.sandboxScriptRelay",setup:Jf},{name:"canvas.headerSync",provides:[Kn],setup:Nf},{name:"canvas.headersAfterRecovery",setup:Lf},{name:"canvas.ampSync",setup:Md},{name:"canvas.moduleBridge",setup:fu},{name:"canvas.port",setup:Yd},{name:"canvas.images",setup:Vd},{name:"canvas.edits",setup:Df},{name:"canvas.surfaceFollowsSession",setup:bf},{name:"canvas.blockContent",setup:_f},{name:"canvas.sandboxFill",provides:[qn],setup:mp},{name:"canvas.reactions",setup:Pf}],ta;function Ir(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);if(t)return t;e.getInstance(l.DISPOSABLE_ID)||e.inject(l.DISPOSABLE_ID,new l.Disposable);const n=ae();e.inject(l.OPTIONS_SOURCE_ID,n),ta??=ea(yg);for(const r of ta)r.setup(e);return n}function Sg(e){}var wg=[{name:"save.previewFollow",setup:Sg}],na=l.createIdentifier$1("plugin.lateUnitsInstalled");function Ig(e){if(!e.getInstance(na)){e.inject(na,!0);for(const t of ea(wg))t.setup(e)}}function Tg(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Cg(e){if(!e)return;const t=l.decodeJwt(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 Ag=l.defineMixin(e=>{let t,n,r;return{async setOptions(o){const s=r!==o.getAuthToken,i=!l.deepEqual(t,o.user),a=n!==o.project;if(r=o.getAuthToken,t=o.user,n=o.project,!(!e.getInstance(l.SECURITY_MODULE_ID)||!o.getAuthToken)&&!(!s&&!i&&!a))try{const c=await o.getAuthToken(o.user,o.project);e.inject(l.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(c||""));const d=Cg(c);if(!d)return;e.inject(l.STANDALONE_PROJECT_ID,d);const u=e.getInstance(l.APP_ID),p=u?await u.catch(()=>{}):void 0;e.inject(l.APP_ID,Promise.resolve(Tg(d,p)))}catch{}}}});function Dg(e,t){if(e.getInstance(l.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(l.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=l.getEvent(e,l.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}var Pg=l.defineMixin(e=>{let t,n=!1;return{setOptions(r){const o=n;if(n=!0,!at(r)){t&&(wp(e),nr(r)),t=void 0;return}const s=Gt(r);if(!s||t===s&&e.getInstance(l.SECURITY_MODULE_ID))return;t=s,e.inject(l.SECURITY_MODULE_ID,s);const i=e.getInstance(l.DISPOSABLE_ID);i&&Dg(e,i)}}}),Og=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=l.getEvent(e,l.APP_LOAD_EVENT_ID),r=$(n),o=t.addDisposable(new Ke(r));return{setOptions({handleLoad:s}){o.setListener(s)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function ra(e,t,n=!0){const r=e,o=t;for(const s of Object.keys(o)){const i=o[s];i!=null&&(n&&typeof i=="object"?r[s]=ra(r[s]||{},i,!0):r[s]=i)}return e}async function Rg(e){const t=(await Ja.__vitePreload(()=>Promise.resolve().then(()=>Promise.resolve(wt("./static/umd/3f12d6ff.js")).then(n=>fn.__toESM(n.default))),void 0,{}.url)).default;return new Promise((n,r)=>{t.load({google:{families:[e]},classes:!1,active:()=>n(),inactive:()=>r(new Error(`Шрифт не загрузился: ${e}`))})})}var oa=l.createIdentifier$1("EditorOptions"),Tr=l.MONACO_EDITOR_OPTIONS;function kg(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 Ng(e){return e.getOrCreateInstance(oa,()=>{const t=ae(Tr);let n=Tr.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(Rg(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function Lg(e){return e?.getInstance(oa)?.get()??Tr}function Mg(e,t={}){const n=Ng(e);n.set(ra({...n.get()},kg(t)))}function xg(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 Fg(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var Bg=l.createIdentifier$1("plugin.publicConfig");function Cr(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function sa(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function ia(e){const t=Gs(e),n=Cr(e);return{...n,locale:n.locale||"ru_RU",theme:n.theme||"light",editor:Fg(Lg(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function aa(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()!==void 0}function jg(e){const t=l.createQueue(),n=ie(e,l.CONFIG_CHANGED_EVENT_ID);let r,o,s=!1;const i=async()=>{try{return e.getInstance(l.APP_ID)===void 0?{}:(await e.getInstanceAsync(l.APP_ID))?.app_config||{}}catch{return{}}},a=async({onlyChangedCodeMode:p=!1}={})=>{await e.getInstance(l.CONFIG_SOURCE_ID)?.ready(),lo(e).set(Cr(e).revisionService===!0);const{codeModeDirection:f,editor:g}=Cr(e);g&&Mg(e,xg(g)),f!==void 0&&!(p&&f===o)&&(o=f,f==="none"?Jn(e,!1):(Jn(e,!0),Hf(e,f)))},c=async()=>{if(!aa(e))return;const p=ia(e),f=JSON.stringify(p);f!==r&&(r=f,await n.fire(p))},d=async p=>{const f=e.getInstance(l.CONFIG_SOURCE_ID),g={advancedConfigs:sa(e).advancedConfigs,serverSide:await i(),user:p};f?.setAdvancedConfigs({...g.advancedConfigs,...g.user?.advancedConfigs});const y=f?.layers().user.mode;f?.replace(g.user?.mode===void 0&&y!==void 0?{...g.user,mode:y}:g.user,"user"),f?.replace(g.serverSide,"server"),await a(),await c()},u=p=>{const{commonStyles:f,...g}=p;return"commonStyles"in p&&Vf(e,f===void 0?void 0:f),g};return{queue:t,reactToConfig:a,emitConfigChanged:c,resolveServerSideConfig:i,getConfig:()=>aa(e)?ia(e):{},setConfig:t.decorate(async p=>{await d(u(p))}),updateConfig:t.decorate(async p=>{const f=u(p);await d({...sa(e).user,...f})}),announceAssembled(){s||(s=!0,e.getInstance(l.CONFIG_SOURCE_ID)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await c()})))}}}function la(e){return e.getOrCreateInstance(Bg,()=>jg(e))}function Ug(e){const t=la(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var Hg=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=t.addDisposable(new l.AsyncEmitter),r=t.addDisposable(new l.AsyncEmitter),o=l.getEmitter(e,l.CONFIG_CHANGED_EVENT_ID),s=$(n.event),i=$(r.event),a=Hi($(o.event),e),c=t.addDisposable(new Ke(s)),d=t.addDisposable(new Ke(i)),u=t.addDisposable(new Ke(a));return{instance:{handleSetOptions:s,handleOptionsChanged:i,handleConfigChanged:a},async setOptions(p){c.setListener(p.handleSetOptions),d.setListener(p.handleOptionsChanged),u.setListener(p.handleConfigChanged),la(e).announceAssembled(),await n.fire(p),await r.fire(p)},dispose(){}}}),Ar,ca="core";function $g(){const e=__emailmaker__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([ca],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function Vg(e){const t=__emailmaker__?.require?.warm;return typeof t!="function"?gt().then(()=>{}):t([ca],e)}function gt(){return Ar===void 0&&(Ar=$g().then(e=>(Ze()&&e.installDiagnostics().catch(t=>{}),e))),Ar}var Dr=null,Pr=null;async function Gg(e){typeof e?.prefetch=="function"&&await e.prefetch()}function Or(){return Dr||(Dr=gt().then(()=>{})),Dr}function da(e){return Pr||(Pr=Gg(e)),Pr}function Yg(){return da(typeof __emailmaker__<"u"?__emailmaker__:void 0)}function Wg(){const e=typeof __emailmaker__<"u"?__emailmaker__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function qg(e){return Promise.all([Or(),da(e)]).then(()=>{})}function Kg(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function ua(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>Vg(t?{priority:t}:void 0)).then(()=>(jn(t?{priority:t}:void 0),n?Or():void 0)).catch(()=>{})}function zg(e){const t=Kg(e);if(t==="eager")ua(e);else if(t==="idle"){const n=()=>ua(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var fa="PluginRegistry";function Xg(e=l.resolveContainer()){return e.getOrCreateInstance(fa,()=>new sl)}var pa=new il(()=>Xg()),Jg=["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"],Qg=["closeBlock","compileEmail","getBlockSnapshot","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","openBlock","save","saveBlock","setConfig","show","showBlock","updateConfig","useAsync","validateCode","waitPlugin"],rn=new Map([...Jg.map(e=>[e,"event"]),...Qg.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),Zg=new Map([["use","use `useAsync()` or await `ready` first"]]);function ev(e){return Zg.get(e)??"await `ready` first"}var tv=new Set(["async","queued"]),nv=Symbol.for("emailmaker.earlyCtxPlaceholder");function ha(e){return e[nv]=!0,e}function rv(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 (${ev(e)}).`)}function ov(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function sv(e){return[...rn].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function iv(e,t){for(const n of sv(e)){const r=rn.get(n);if(r!==void 0&&tv.has(r)){const o=async(...s)=>{await t;const i=e[n];if(typeof i!="function"||i===o)throw ov(n);return i.apply(e,s)};e[n]=ha(o);continue}e[n]=ha(()=>{throw rv(n)})}}function av(e,t,n){e.getInstanceAsync(Je).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function lv(e,t){e.getInstanceAsync(Je).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_LOAD_ERROR",data:{plugin:t.name,url:t.url,message:t.error.message},innerException:t.error})},()=>{})}var cv=l.defineMixin(e=>{let t;function n(){return new Promise(o=>{const s=e.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),i=()=>{s.delete(i),o()};s.add(i)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(o){const s=e.getInstance(l.INSTANCE_ID),i=e.getInstance(fa);if(!t){t=new ol(s,i,{ensureHostRuntimeReady:Yg,explainScriptFailure:Wg,openEarlyWindow:()=>Hm(e),reportLoadFailure:d=>lv(e,d)}),e.inject(l.PLUGIN_COLLECTION_ID,t);const c=t.onLifecycle(d=>{d.type==="create:error"&&av(e,d.name,d.error)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(c)}const a=o?.plugins||[];s&&(Zo(e),a.length>0&&iv(s,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}}}),ma=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}},dv=l.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),uv=l.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),fv="application_block_inserted",pv=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(uv,()=>new ma).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),o=n?e.bind(n):e;return r.addListener(fv,o,t)}},Rr=l.createIdentifier$1("ComponentRegistry"),hv=l.createIdentifier$1("ComponentRegistryGate");function kr(){return l.DependencyResolver.getOrCreateInstance(hv,()=>({pending:[]}))}function mv(e=Rr){return kr().factory!==void 0||l.DependencyResolver.getInstance(e)!==void 0}function Nr(e,t,n=Rr){if(mv(n)){t(on(e,n));return}kr().pending.push(()=>t(on(e,n)))}function on(e,t=Rr){const n=l.DependencyResolver.getInstance(t);if(n)return n;const r=kr().factory;if(!r)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return l.DependencyResolver.getOrCreateInstance(t,r)}var gv=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=s=>{if(!n){n=!0;for(const i of t)i.dispose();e(s)}};t.push(this._container.addService(l.ATOMS_HANDLERS_ID,{execute:s=>{r(s.value.map(i=>({name:i.name,html:i.html})))}}));const o=this._container.getInstance(l.HEADLESS_MODE_ID)?.watch(s=>{s&&r([])});o&&(n?o.dispose():t.push(o))})}update(e,t){const n=this._container;return n.addService(l.ATOMS_HANDLERS_ID,{execute:r=>{const o=on(n),s=r.value.find(i=>i.name===e);if(s){const{icon:i,title:a,fallbackTooltip:c,...d}=t;i&&(s.icon=o.getReactNode(i)),a&&(s.title=o.getReactNode(a)),c&&(s.fallbackTooltip=o.getReactNode(c)),Object.assign(s,d)}}})}delete(e){this._container.addService(l.ATOMS_HANDLERS_ID,{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(l.ATOMS_HANDLERS_ID,{execute:r=>{const o=on(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(dv,()=>new ma).add(e,t??0,n)}handleInject(e,t,n){return l.getEmitter$1(this._container,l.HANDLE_ATOM_INSERT_ID).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},vv=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}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 Ev(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function ga(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 _v=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=l.getEmitter$1(t,l.MODAL_SHOW_EVENT),this._closeModalEmitter=l.getEmitter$1(t,l.MODAL_CLOSE_EVENT),this._updateModalEmitter=l.getEmitter$1(t,l.MODAL_UPDATE_EVENT)}get _container(){return this._context.container}show(e){const t=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n=e.modalProps;return Nr(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:ga(r,n)})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;Nr(this._container,r=>{this._updateModalEmitter.fire(Ev({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:ga(r,n)}))})}};function sn(e){return e?.surfaces?{surfaces:[...e.surfaces]}:{}}var bv=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)}},yv=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}_createScriptHandle(e,t){const n=this._messageService.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,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 bv(t,n);return r}registerSandboxCSS(e,t){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{...sn(t),type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t,n){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{...sn(n),type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e,t){const n=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{...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(l.SANDBOX_EXTENSIONS_ID,{...sn(n),type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,r)}},Sv=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function Lr(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&Sv.has(t)}function va(){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 Mr(){return`__settingsPanel:${va()}`}function xr(e,t){return{type:e,props:t}}function wv(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!Lr(e)}function Ea(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(Lr(t)){const r=Mr();return n(e.add(r,t)),xr(r,{})}if(typeof t=="function"){const r=Mr();return n(e.add(r,t)),xr(r,{})}if(wv(t)){const r=t.type;if(typeof r=="string")return t;if(Lr(r)||typeof r=="function"){const o=Mr();return n(e.add(o,r)),xr(o,t.props)}return t}return t}var Iv=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??va();Nr(this._container,n=>{const r=i=>this._trackRegistration(i),o=Ea(n,e.content,r),s=e.advancedTabs?.map(i=>({...i,content:Ea(n,i.content,r)}));l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire({...e,content:o,advancedTabs:s,instanceKey:t,type:l.ADVANCED_SETTINGS_PANEL})})}closeSettingsPanel(){this._clearPanelRegistrations(),l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire(null)}},_a={SandboxScriptApi:yv,ElementsApi:gv,BlocksApi:pv,MessageService:vv,SettingsPanelApi:Iv,ModalApi:_v};function Fr(e,t,n,r={}){const o=Object.assign({},e);for(const[s,i]of Object.entries(t))if(i!==void 0)if(n.includes(s)&&typeof i=="object"&&i!==null){const a=o[s],c=r[s]??{};o[s]=Object.assign({},typeof a=="object"&&a!==null?a:c,i)}else o[s]=i;return o}var pe={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}},Tv={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"},Br={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},ba={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},Qe={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:pe.border,borderRadius:pe.borderRadius,textAlign:"center",padding:pe.padding},ya={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:pe.padding},jr={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:pe.border,borderRadius:pe.borderRadiusCards};function Cv(e){return{...Tv,...e}}function Av(e){return{...Br,...e,bold:e?.bold??Br.bold,italic:e?.italic??Br.italic}}function Dv(e){return{...ba,...e,underline:e?.underline??ba.underline}}function Pv(e){return{...Qe,...e,bold:e?.bold??Qe.bold,italic:e?.italic??Qe.italic,border:{...Qe.border,...e?.border},borderRadius:{...Qe.borderRadius,...e?.borderRadius},padding:{...Qe.padding,...e?.padding}}}function Ov(e){return{...ya,...e,padding:{...ya.padding,...e?.padding}}}function Rv(e){return{...jr,...e,border:{...jr.border,...e?.border},borderRadius:{...jr.borderRadius,...e?.borderRadius}}}function Ur(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 Sa(e){let t={...l.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Hr(e){return{text:Cv(e.text),headings:Av(e.headings),links:Dv(e.links),buttons:Pv(e.buttons),block:Ov(e.block),cards:Rv(e.cards)}}var wa=l.createIdentifier$1("EmailSettingsPort"),kv=1e4,Ia=class{_editor;_layoutSettingsChanged=new l.Emitter;_contentStylesChanged=new l.Emitter;_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(!Ui(this._editor.container)||!He(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(wa);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return Ur(this._settings().read())}_getCurrentContentStyles(){const e=He(this._editor.container)?.current()?.get().attributes.common_styles;return Hr(Sa(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(wa),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),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,s=o?.operation;if(s===l.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){const c=Ur(o?.settings),d=this._getLayoutSnapshot(c);d!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=d,this._layoutSettingsChanged.fire(c));return}if(s!==l.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE)return;const i=Hr(r.data?.settings?.commonStyles??{...l.COMMON_STYLES}),a=this._getContentSnapshot(i);a!==this._prevContentSnapshot&&(this._prevContentSnapshot=a,this._contentStylesChanged.fire(i))})})();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=Ur(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=kv){const t=He(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=l.getEvent(r,l.events.ON_EMAIL_INIT_ID);return new Promise(s=>{let i=!1,a;const c=()=>{a&&(clearTimeout(a),a=void 0)},d=o(()=>{i||(i=!0,c(),d.dispose(),s())});a=setTimeout(()=>{i||(i=!0,d.dispose(),s())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=He(this._editor.container)?.current();if(!t)return;const n=Sa(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=Fr(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:pe.border,borderRadius:pe.borderRadius,padding:pe.padding})),e.block!==void 0&&(n.block=Fr(n.block||{},e.block,["padding"],{padding:pe.padding})),e.cards!==void 0&&(n.cards=Fr(n.cards||{},e.cards,["border","borderRadius"],{border:pe.border,borderRadius:pe.borderRadiusCards}));const r=JSON.stringify(n);Ge(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const o=Hr(n);this._prevContentSnapshot=this._getContentSnapshot(o),this._contentStylesChanged.fire(o)}},Nv={..._a,EmailSettingsApi:Ia},Lv={..._a},Z_={...Lv,EmailSettingsApi:Ia},Mv={...Nv};function xv(){pa.addAll(Mv)}var Fv=[l.defineMixin(()=>{xv()}),Og,Hg,Pg,l.JWTMixin,Ag,l.OAuthMixin];async function Bv(){return(await gt()).asyncMixins}var jv=cv,Uv=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let o;try{o=await Bv()}catch(i){throw e.failPendingWaits(i),i}t=o(e);const s=await e.getInstanceAsync(l.INSTANCE_ID);Object.assign(s,t.instance||{});for(const i of e.getInstance(l.LATE_SURFACE_LISTENERS_ID)??[])i()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},Hv=l.combineMixins([...Fv]);function $r(){let e,t=!1;const n=new Map,r=new Map;function o(){for(const s of r.values())s();r.clear()}return{event(s,i,a){const c=Symbol("subscription");return t||(n.set(c,{listener:s,priority:i,thisArg:a}),e&&r.set(c,e(s,i,a))),()=>{n.delete(c),r.get(c)?.(),r.delete(c)}},attach(s){o(),e=s;for(const[i,{listener:a,priority:c,thisArg:d}]of n)r.set(i,s(a,c,d))},dispose(){t=!0,o(),n.clear(),e=void 0}}}function $v(e){const t=$r(),n=$r(),r=$r();return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(Je).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 s=e.getInstance(Je);if(s){s.notify(o);return}e.getInstanceAsync(Je).then(i=>i.notify(o),()=>{})}}}var Ta=l.createIdentifier$1("CodeErrors"),Vv=[];function Gv(e){return e?.getInstance(Ta)?.get()??Vv}function Yv(e){return e?.getInstance(Ta)!==void 0}var Wv=class extends l.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=ut(e),this.addDisposable(l.getEvent(e,l.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){const e=Re(this._container);if(e&&Q(e.sessionKey())&&!e.hasSuspended())throw new Error("[emailmaker] no open email: only a block is shown");return Ci(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=>le(t,this._container))}async _readProjectBlocks(){const e=await Ai(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=>pt(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=>hr(n,this._container))}async getEmailSnapshot(){return fe(this.openEmail(),this._container)}async getBlockSnapshot(){const e=Re(this._container),t=e?.current();return!e||!t||!Q(e.sessionKey())?null:(await t.whenReady(),le(Ht(t),this._container))}setEmailMeta(e){const t=ur(this._container);if(!t)return;const n=t.get().attributes.meta;Ge(t,{meta:Yt({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,o=>o&&Yt(o,e))}setBlockMeta(e,t){const n=Re(this._container);if(n?.sessionKey()===Pt(e)){const o=n.current();o&&Ge(o,{meta:Yt({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,s=>s&&Yt(s,t))};this._blockMetaWrites=this._blockMetaWrites.then(r).catch(()=>{})}getCodeErrors(){return Yv(this._container)?Gv(this._container):void 0}},qv=l.createIdentifier$1("EmailDataController");function Kv(e){return e.getOrCreateInstance(qv,()=>{const t=new Wv(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function zv(e){const t=Kv(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 Xv(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 Jv(e){let t;const n=ri(e),r=l.getEvent(e,l.events.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:s})=>{t=s}));const o=()=>t?Xv(t):void 0;return{undoRedoService:{undo:()=>o()?.undo(),redo:()=>o()?.redo(),clear:()=>o()?.clear(),getPast:s=>o()?.getPast(s)??[],getFuture:s=>o()?.getFuture(s)??[],canUndo:()=>o()?.canUndo()??!1,canRedo:()=>o()?.canRedo()??!1,createSnapshot:()=>o()?.createSnapshot(),restoreSnapshot:s=>o()?.restoreSnapshot(s)}}}var Qv=l.createIdentifier$1("plugin.mountElement");function Zv(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function eE(e){return e.getOrCreateInstance(Qv,()=>{let t=!1,n;return{get:()=>t?n:Zv(e),set(r){t=!0,n=r}}})}function tE(e){const t=eE(e);return{getElement:()=>t.get()}}function nE(e){return{handleLoadImage:$(l.getEvent(e,l.events.UPLOAD_EVENT_ID)),handleFileProxy:$(l.getEvent(e,l.events.FILE_PROXY_EVENT_ID)),handleUrlProxy:$(l.getEvent(e,l.events.PROXY_URL_EVENT_ID)),handleAITextRequest:$(l.getEvent(e,l.events.AI_TEXT_REQUEST_ID)),handleAIImageRequest:$(l.getEvent(e,l.events.AI_IMAGE_REQUEST_ID)),handleReadLocale:$(l.getEvent(e,l.events.READ_LOCALE)),handleLimitUsage:$(l.getEvent(e,l.events.ON_LIMIT_ID)),handleTranslate:$(l.getEvent(e,l.events.ON_TRANSLATE_ID))}}var rE=[Bp,Xm,$v,Ug,zv,Jv,tE,nE];function oE(e,t=rE){const n=Ir(e);Ig(e);const r=Hv(e),o=jv(e),s=Uv(e),i={...r.instance,...o.instance,...s.instance};for(const c of t)Object.assign(i,c(e));let a=!0;return{instance:i,async setOptions(c){await r.setOptions(c);const d=a&&n.get()===c;a=!1,d||n.set(c),await o.setOptions(c),await s.setOptions(c)}}}function sE(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 iE=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]}},aE="editor-runtime.react.copies",Vr=8;function vt(e){return e&&typeof e=="object"?e:void 0}function Ca(e){const t=vt(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=vt(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function lE(e){const t=vt(e),n=t&&typeof t.version=="string"?t.version:void 0,r=vt(t?.default),o=r&&typeof r.version=="string"?r.version:void 0;return n??o??"unknown"}function cE(e,t,n){return e.package===t&&e.version===n}function dE({ourReact:e,entries:t,packageName:n,version:r}){const o=Ca(e);if(!o||!Array.isArray(t))return[];const s=[],i=new Set;for(const a of t){const c=vt(a);if(!c||!cE(c,n,r))continue;const d=Ca(c.react);!d||d===o||i.has(d)||(i.add(d),s.push({package:n,version:r,reactVersion:lE(c.react),react:c.react}))}return s}function uE({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(`
|
|
2153
|
+
`)}var Aa=new Set;function fE({packageName:e="@emailmaker/emailmaker",version:t="1.2.3",log:n=r=>{}}={}){const r=o=>{try{const s=globalThis[Symbol.for(aE)],i=dE({ourReact:o,entries:s,packageName:e,version:t}).filter(a=>!Aa.has(a.react));if(!i.length)return;i.forEach(a=>Aa.add(a.react)),n(uE({packageName:e,copies:i}))}catch{}};try{const o=mn()?.modules?.React;if(o&&typeof o.then=="function"){o.then(r,()=>{});return}r(o)}catch{}}async function pE(e,t,n){l.throwIfAborted(e.signal);const r=t??l.DependencyResolver.createChild();Ir(r);const o=r.getInstance(l.DISPOSABLE_ID);let s;async function i(){r.inject(l.COOKIE_MANAGER_ID,sE(new iE)),fE();const a=oE(r),c={...a.instance,container:r,get ready(){return s??Promise.resolve(c)},async reset(d){if(l.throwIfAborted(d.signal),o.isDisposed())throw be();return await a.setOptions(d),c}};r.inject(l.INSTANCE_ID,c);try{if(n?.onInstance?.(c),await a.setOptions(e),l.throwIfAborted(e.signal),o.isDisposed()||await qm(r),e.devTools)try{const d=r.getInstance(l.PLUGIN_COLLECTION_ID);d&&await(await gt()).initDevTools(r,d)}catch{}return l.throwIfAborted(e.signal),l.getEmitter(r,l.APP_LOAD_EVENT_ID).fire(c),c}catch(d){throw o.dispose(),d}}try{return s=l.raceWithAbortSignal(i(),e.signal),s.catch(()=>{}),await s}catch(a){throw o.isDisposed()||o.dispose(),a}}var Et=new WeakMap;function hE(e){return e?Et.get(e):void 0}function Da(e){try{e.getInstance(l.DISPOSABLE_ID)?.dispose()}catch{}try{e.dispose()}catch{}}function mE(e,t){if(!e)return;const n=Et.get(e);n&&n!==t&&Da(n),Et.set(e,t)}function gE(e,t){e&&Et.get(e)===t&&Et.delete(e)}function vE(e){const t=l.DependencyResolver.createChild();return at(e)&&t.inject(l.SECURITY_MODULE_ID,Gt(e)),t}var _t=new WeakMap,EE="data-emailmaker-config-styles";function _E(e){return typeof e=="string"?e.trim():""}function Pa(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function bE(e,t,n){if(!e||typeof document>"u")return null;const r=_E(t),o=_t.get(e),s=n||e;if(!r)return o&&(o.remove(),_t.delete(e)),null;if(o)return o.textContent!==r&&(o.textContent=r),(o.parentNode!==s||o!==s.firstChild)&&Pa(s,o),o;const i=document.createElement("style");return i.setAttribute(EE,"true"),i.textContent=r,Pa(s,i),_t.set(e,i),i}function yE(e){if(!e)return;const t=_t.get(e);t&&(t.remove(),_t.delete(e))}var eb=!1;function Oa(){return!1}var tb=28,SE=`
|
|
2154
2154
|
.blocks-app-initial-spinner-wrapper {
|
|
2155
2155
|
width: 100%;
|
|
2156
2156
|
height: 100%;
|
|
@@ -2179,11 +2179,11 @@ __emailmaker__.define("emailmaker.js",["require","exports","module","static/umd/
|
|
|
2179
2179
|
100% {
|
|
2180
2180
|
transform: rotate(360deg);
|
|
2181
2181
|
}
|
|
2182
|
-
}`;function bE(){return()=>{}}function yE(e,t){if(!Oa()||!e||typeof document>"u")return bE();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.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=_E,document.head?.appendChild(o),e.appendChild(n);let s=!1;return()=>{s||(s=!0,n.remove(),o.remove())}}function SE(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function wE({report:e}={}){const t=new Map,n=new Set,r=e??(o=>{});return{run(o,s){const i=t.get(o);if(i!==void 0)return i;const a=s().catch(c=>{throw n.has(o)||(n.add(o),r(c)),SE(c)||t.delete(o),c});return t.set(o,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var $r=wE();function Ra(){$r.clear()}l.setApiOriginFailoverHook(()=>$r.clear());var ka=new WeakMap;function Vr(e){return l.resolveExplicitApiBaseUrl(e)}function IE(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function TE(){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 Gr=new WeakMap;function Yr(e,t){Gr.set(e,t)}function AE(e){return Gr.get(e)}function DE(e,t){return async({baseUrl:n})=>{const r=t(),o=r&&Gr.get(r)||e,s=Vr(n);if(!s)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await CE(o);if(o.getAuthToken&&!a)throw TE();a&&i.set("authorization",a);const c=await l.fetchWithApiOriginFailover("/app/v1/app_init",{method:"POST",headers:i,body:new URLSearchParams,credentials:"same-origin"},s,{attemptTimeout:er(o)||void 0});if(!c.ok)throw IE(c.status,c.statusText);return await c.json()}}function PE(e){return JSON.stringify({baseUrl:Vr(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function OE(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function RE(e){return t=>$r.run(PE(t),()=>(J("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>J("appInit:end",{kind:"network"}))))}function kE(e,t){if(st(e)||!e.appInit&&!Vr(e.baseUrl)||!OE(e))return e;const n=e.appInit??DE(e,t);let r=ka.get(n);return r||(r=RE(n),ka.set(n,r)),{...e,appInit:r}}var Na=0;function NE(){return Na}function LE(){Na+=1,Ra()}var La=new WeakMap,Ma=new WeakMap,ME=3e4;function xE(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function FE(e,t){try{const n=l.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+ME}function BE(e){const t=new Map,n=new Map;return async(r,o,s)=>{const i=xE(r,o);if(s)return n.delete(i),t.delete(i),Ra(),e(r,o,s);const a=n.get(i);if(a&&!t.has(i)){if(a.expiresAtMs>Date.now())return a.token;n.delete(i)}let c=t.get(i);return c===void 0&&(J("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,o,s)).then(d=>{const u=String(d||"").trim();return u&&n.set(i,{token:d,expiresAtMs:FE(u,Date.now())}),d}).finally(()=>{J("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function jE(e){if(st(e))return e;const t=e.getAuthToken;if(!t)return e;let n=La.get(t);const r=NE();return(!n||Ma.get(t)!==r)&&(n=BE(t),La.set(t,n),Ma.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(o=>{}),{...e,getAuthToken:n}}var UE="[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 HE(e){const t=new Error(UE,{cause:e});return t.name="EditorStartFailedError",t}var $E={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function xa(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var Fa=["handleLoad","handleDestroy"];function Ba(e,t){let n=e;for(const r of Fa){const o=e?.[r];typeof o=="function"&&(n={...n,[r]:(s,...i)=>o(t,...i)})}return n}function VE(e){let t,n="pending",r,o,s,i;const a=new Set,c=[],d=new Set;let u,f;const h=new Promise((I,p)=>{u=I,f=p});h.catch(()=>{});const g={},_=I=>t?.[I],y=()=>r??_e(),m=(I,p)=>{const S=_(I);if(typeof S!="function")throw xa(I);return S.apply(t,p)},T=(I,p)=>{try{return Promise.resolve(m(I,p))}catch(S){return Promise.reject(S)}},D=()=>{const I=t?.container?.getInstance?.(l.DISPOSABLE_ID);if(!(n!=="ready"||I?.isDisposed()||typeof _("getConfig")!="function"))try{i=m("getConfig",[])}catch{}},B=()=>n==="dead"?Promise.reject(y()):n==="ready"?Promise.resolve():h,M=()=>{for(const[I,p]of tn)p==="field"&&(g[I]=_(I))},C=I=>{const p=_(I.name);I.dispose||typeof p!="function"||n==="dead"||(I.dispose=p.apply(t,I.args))},E=()=>a.forEach(C),b=()=>{for(const I of a){try{I.dispose?.()}catch{}I.dispose=void 0}},w=()=>{M(),E()},O=()=>{s?.delete(w),s=void 0},x=(I,p)=>{const[S,...F]=p;return!Fa.includes(I)||typeof S!="function"?p:[(V,...$)=>S(g,...$),...F]},A=(I,p)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof _(I)!="function")throw xa(I);const S={name:I,args:x(I,p)};return a.add(S),C(S),()=>{a.delete(S),S.dispose?.(),S.dispose=void 0}},N=()=>t?.container?.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.content,k=()=>{const I=e.element();return I!==void 0&&typeof I!="string"?I:void 0},P=(I,p)=>{switch(p){case"event":return(...S)=>A(I,S);case"async":return(...S)=>(I==="show"&&S[0]!==void 0&&e.shown?.(S[0]),n!=="dead"&&typeof _(I)=="function"?T(I,S):B().then(()=>m(I,S)));case"queued":return(...S)=>{if(n==="dead"){if(I==="notify")return;throw y()}if(n==="pending"){c.push({name:I,args:S});return}return m(I,S)};case"sync":return(...S)=>{if(n==="dead"){if(I==="getConfig")return i;throw y()}if(typeof _(I)!="function")throw new Error(`[emailmaker] \`${I}\` is not available before the editor is ready: ${$E[I]??"await `ready` first"}`);const F=m(I,S);return I==="getConfig"&&(i=F),F};case"element":return()=>{if(typeof _(I)!="function")return k();try{return m(I,[])}catch{return k()}};case"codeErrors":return()=>n==="ready"&&typeof _(I)=="function"?m(I,[]):[];case"field":return}};for(const[I,p]of tn)g[I]=P(I,p);g.reset=I=>(I?.content!==void 0&&e.shown?.(I.content),B().then(async()=>{const p=I?.content!==void 0&&l.deepEqual(I.content,N());await m("reset",[Ba(I,v)]),p&&await m("show",[I.content])}).then(()=>g)),g.destroy=()=>{if(n==="dead")return;const I=l.createAbortError("[emailmaker] editor was destroyed before it was ready");o?.catch(()=>{}),d.forEach(p=>p(I)),D(),e.destroy()},Object.defineProperty(g,"ready",{get:()=>o,enumerable:!0,configurable:!0});const v=g;return{object:v,get state(){return n},get editor(){return t},bind:I=>{n==="dead"||t===I||(b(),O(),t=I,M(),E(),n==="pending"&&(s=I.container.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),s.add(w)))},settle:()=>{if(n==="pending"){n="ready",O(),M(),E();for(const I of c.splice(0))try{m(I.name,I.args)}catch(p){queueMicrotask(()=>{throw p})}u()}},kill:(I,p)=>{n!=="dead"&&(D(),n="dead",r=I,c.length=0,d.forEach(S=>S(I)),O(),p?.keepSubscriptions||(b(),a.clear()),f(I))},detach:()=>{b(),a.clear()},setReady:I=>{o=I},trackCall:I=>(d.add(I),()=>d.delete(I)),hasCalls:()=>d.size>0}}var Wr="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function GE(){return l.createAbortError(Wr)}function ja(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Wr}function YE(e,t,n){if(typeof document>"u")return;let r=!1,o;const s=()=>{r=!0,o?.disconnect(),o=void 0},i=()=>{r||(s(),t())};if(n.addDispose(s),!e.isConnected){queueMicrotask(i);return}o=new MutationObserver(()=>{e.isConnected||i()});let a=e.parentNode;for(;a;)o.observe(a,{childList:!0}),a=a.parentNode}function WE(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:o}=e;if(t===void 0||!(n instanceof Element))return r;const s=new AbortController;return YE(n,()=>{n.id,s.abort(GE())},o),l.composeAbortSignals(r,s.signal)}var qr="Superseded by newer init() on the same mount element";function Ua(){return l.createAbortError(qr)}function Ha(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===qr}var Et=new Map,$a=new WeakMap,on=new WeakMap;function qE(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function KE(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=qE(e);(n?Et.get(n):void 0)?.forEach(u=>{u.element!==e&&u.controller.abort(Ua())});const r=$a.get(e)??new Set;t&&r.forEach(u=>{u.supersedable&&u.controller.abort(Ua())});const o=on.get(e)??Promise.resolve();let s;const i=new Promise(u=>{s=u}),a=o.then(()=>i);on.set(e,a),a.then(()=>{on.get(e)===a&&on.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),$a.set(e,r),n){const u=Et.get(n)??new Set;u.add(d),Et.set(n,u)}return{signal:c.signal,previous:o,release:()=>{s(),r.delete(d);const u=n?Et.get(n):void 0;n&&u?.delete(d)&&u.size===0&&Et.delete(n)}}}var _t=new WeakMap;function Kr(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function zr(e){return Object.entries(e).filter(([t,n])=>Kr(t,n)).map(([t])=>t).sort()}function Va(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!Kr(n,r)&&(t[n]=r);return t}function Xr(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:_t.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},_t.set(e,r));const{current:o,trampolines:s}=r;o.clear();const i={...t};for(const a of zr(t)){o.set(a,t[a]);let c=s.get(a);c||(c=(...d)=>o.get(a)?.(...d),s.set(a,c)),i[a]=c}return r.lastOptions=t,i}function Ga(e,t){const n=e?_t.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const o=t[r];Kr(r,o)?n.current.set(r,o):n.current.delete(r)}}function zE(e){const t=e?_t.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((o,s)=>t.current.set(s,o)),t.lastOptions=r}}function XE(e,t,n){const r=e?_t.get(e):void 0;if(!r||!n)return!1;const o=zr(t),s=l.deepEqual(o,zr(r.lastOptions)),i=o.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!s||!i||!l.deepEqual(Va(t),Va(r.lastOptions))?!1:(Xr(e,t),!0)}var me=new WeakMap,Z_=0;function sn(e){let t=me.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},me.set(e,t)),t}var ye=e=>e!==void 0&&e.state!=="dead";function JE(e){const t=me.get(e)?.shared;return ye(t)?t:void 0}function QE(e,t){sn(e).shared=t}function ZE(e,t){!(ye(e.shared)&&[...e.counted].some(ye))||e.warned||!t.devTools||(e.warned=!0)}function e_(e,t,n,r){const o=sn(e);return o.latestCall+=1,o.releaseTimer!==void 0&&(clearTimeout(o.releaseTimer),o.releaseTimer=void 0),o.leaving.forEach(s=>s.detach()),o.leaving.clear(),n==="single"?o.shared=t:o.counted.add(t),o.options.set(t,r),o.order=[...o.order.filter(s=>s!==t&&ye(s)),t],ZE(o,r),o.latestCall}function t_(e,t){return me.get(e)?.latestCall===t}function n_(e){const t=me.get(e);if(t)return t.order=t.order.filter(ye),t.order.at(-1)?.object}function bt(e,t){const n=me.get(e);return n?ye(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&ye(r)):!1}function r_(e,t){const n=me.get(e),r=n?.order.filter(o=>o!==t&&ye(o)).at(-1);return r?n?.options.get(r):void 0}function Ya(e,t){sn(e).content={value:t}}function o_(e){return me.get(e)?.content}function s_(e,t,n,r){const o=sn(e);if(o.counted.delete(t),o.options.delete(t),bt(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),o.leaving.add(t),Wa(e,r)}function Wa(e,t){const n=me.get(e);!n||bt(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!bt(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function i_(e,t){const n=me.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);me.delete(e)}}var a_=dn.__exportAll({FileManagerApiError:()=>l_,IntegratorSaveTimeoutError:()=>Ct,SaveRefusedError:()=>et}),l_=class Xa 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,Xa)}},c_=dn.__exportAll({mapHttpStatusToErrorCode:()=>l.mapHttpStatusToErrorCode});function d_(e,t){return{...e,element:t}}function Jr(){return()=>{}}function u_(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Jr():(vE(t,e.config?.styles,t),()=>{EE(t)})}function f_(e){if(!Oa()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Jr()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Jr()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(o=>{o.remove()});const n=yE(t,"data-emailmaker"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function p_(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function an(e){try{e.destroy()}catch{}}function ln(e,...t){const n=l.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&l.ELEMENT_MAP.delete(e)}var h_="1.2.0";async function m_(e){Fn(),await Gg(typeof __emailmaker__<"u"?__emailmaker__:void 0)}async function g_(e){return qa(e).ready}function v_(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function E_(e){const t=l.ELEMENT_MAP.get(e);return t&&!(t instanceof Promise)?t:void 0}function cn(e,t,n){const r=t??E_(e);r&&(ln(e,r),an(r)),i_(e,n)}function __(e){const{control:t,mode:n,ref:r}=e,o=r.host;if(!o){const i=t.editor;b_(i),t.kill(_e());return}if(n==="single"){cn(o,t.editor,_e());return}const s=r_(o,t);s_(o,t,_e(),()=>cn(o,t.editor,_e())),s&&bt(o)&&Ga(o,s)}function b_(e){e&&an(e)}function qa(e){J(oe.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=l.composeAbortSignals(e.signal,n.signal),o=t==="single"?v_(e.element):void 0,s=o?JE(o):void 0;let i;if(s)i={control:s,mode:t,ref:{host:o}};else{const u={},f=VE({element:()=>u.host??e.element,destroy:()=>__(i),shown:h=>{u.host&&Ya(u.host,h)}});i={control:f,mode:t,ref:u},o&&QE(o,f)}const{control:a}=i,c=a.trackCall(u=>n.abort(u)),d=C_(Ba({...e,signal:r},a.object),i).then(()=>(c(),J(oe.initEnd),a.settle(),a.object),u=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(u);const f=i.ref.host;throw f&&Wa(f,()=>cn(f,void 0,_e())),u});return a.setReady(d),a.object}function y_(e){const t=typeof e=="string"?document.querySelector(e):e;return t?n_(t):void 0}function S_(e){let t,n,r=!1;try{t=e.container.getInstance(l.OPTIONS_SOURCE_ID)?.get(),n=e.container.getInstance(l.INIT_PIPELINE_ID)?.externalSignal;const o=Be(e.container)?.current();r=o!==void 0&&o.get().savedVersion!==null&&o.isDirty()}catch{t=void 0}return{options:t,signal:n,email:w_(e),dirty:r}}async function w_(e){try{return await e.getEmailSnapshot()}catch{return}}function I_(e){const t=Be(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Ka(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||bt(e,n)}async function T_(e,t,n,r,o){if(r.mode==="counted"&&r.control.detach(),Ha(o)||ja(o))return;const s=()=>cn(t,e,HE(o)),{options:i}=n;if(!i||!Ka(t,r)){s();return}const a=await n.email,c=a&&(i.content!==void 0||a.id!==void 0)?a:void 0,d=typeof i.content=="object"&&"email"in i.content?i.content:void 0;try{await e.reset({...i,signal:i.signal??n.signal,content:c?{...d,email:c}:i.content}),n.dirty&&c&&I_(e),Ka(t,r)?l.ELEMENT_MAP.set(t,e):s()}catch{s()}}async function C_(e,t){l.throwIfAborted(e.signal);const n=new l.Disposable;let r,o,s,i,a=0;try{const c=await l.waitForElement(e.element,n,e.signal);c&&(i=c,t.ref.host=c,a=e_(c,t.control,t.mode,e));const d=WE({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),u=KE(c,{supersede:t.mode==="single"});r=u.release;const f=l.composeAbortSignals(d,u.signal);l.throwIfAborted(f),s=zE(c),Ga(c,e),await l.raceWithAbortSignal(u.previous,f),o=A_(e,c,t,f,s);const h=await l.raceWithAbortSignal(o,f);return c&&e.content!==void 0&&Ya(c,e.content),h}catch(c){throw i&&s&&t_(i,a)&&s(),c}finally{const c=r;o!==void 0&&c?o.then(c,c):c?.(),n.dispose()}}async function za(e,t,n,r){const o=o_(t);n===void 0||r||!o||l.deepEqual(n,o.value)||await e.show(n)}async function A_(e,t,n,r,o){const{control:s}=n,i=y=>s.bind(y);l.throwIfAborted(r);let a;const c=y=>{LE();const m=jE(d_(y,t)),T=kE(m,()=>a);return{preparedOptions:T,preparedOptionsWithSignal:r!=null?{...T,signal:r}:T}};let d;if(t){const y=l.ELEMENT_MAP.get(t);if(y){let m;try{m=await y,l.throwIfAborted(r)}catch{l.throwIfAborted(r),ln(t,y),m=void 0}if(m)if(m.getElement()===t){const T=uE(t);a=T;const D=m.container.getInstance(l.OPTIONS_SOURCE_ID)?.get();if(XE(t,e,D))return i(m),r&&m.container.getInstance(l.INIT_PIPELINE_ID)?.relinkExternalSignal(r),l.ELEMENT_MAP.set(t,m),await za(m,t,e.content,!1),m;const B=!l.deepEqual(e.content,D?.content);d=c(Xr(t,e));const{preparedOptions:M,preparedOptionsWithSignal:C}=d,E=T&&AE(T),b=S_(m);try{T&&Yr(T,M),i(m);const w=await m.reset(p_(e,C));return l.throwIfAborted(r),l.ELEMENT_MAP.set(t,m),await za(m,t,e.content,B),w}catch(w){if(T&&E&&Yr(T,E),!yl(w))throw o(),await T_(m,t,b,n,w),w;ln(t,y,m),an(m),l.throwIfAborted(r)}}else ln(t,y,m),an(m)}}l.throwIfAborted(r),d??=c(Xr(t,e,{fresh:!0}));const{preparedOptions:u}=d,f=u_(u),h=f_(u),g=r!=null?{...h.options,signal:r}:h.options;let _;try{a=hE(g),fE(t,a),Yr(a,u),Sr(a).set(g),await Dr(),J(oe.coreReady),l.throwIfAborted(r),l.throwIfAborted(r),_=dE(g,a,{onInstance:i}),t&&l.ELEMENT_MAP.set(t,_);const y=await _;if(r?.aborted&&(y.destroy(),l.throwIfAborted(r)),t)if(l.ELEMENT_MAP.get(t)===_)l.ELEMENT_MAP.set(t,y);else throw y.destroy(),l.throwIfAborted(r),l.createAbortError(r?.reason);return y}catch(y){throw f(),h.cleanup(),a&&(Da(a),pE(t,a)),t&&_&&l.ELEMENT_MAP.get(t)===_&&l.ELEMENT_MAP.delete(t),y}}async function D_(e){return(await ht()).parseAMP(e)}typeof window<"u"&&(Je()&&_l(),Wg(typeof __emailmaker__<"u"?__emailmaker__:void 0)),de.ELEMENT_DETACHED_ABORT_MESSAGE=Wr,de.SUPERSEDED_INIT_ABORT_MESSAGE=qr,de.create=qa,Object.defineProperty(de,"errors",{enumerable:!0,get:function(){return a_}}),de.getInstance=y_,Object.defineProperty(de,"helpers",{enumerable:!0,get:function(){return c_}}),de.init=g_,de.isElementDetachedError=ja,de.isSupersededInitError=Ha,de.parseAMP=D_,de.pluginRegistry=pa,de.preload=m_,de.version=h_});
|
|
2182
|
+
}`;function wE(){return()=>{}}function IE(e,t){if(!Oa()||!e||typeof document>"u")return wE();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.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=SE,document.head?.appendChild(o),e.appendChild(n);let s=!1;return()=>{s||(s=!0,n.remove(),o.remove())}}function TE(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function CE({report:e}={}){const t=new Map,n=new Set,r=e??(o=>{});return{run(o,s){const i=t.get(o);if(i!==void 0)return i;const a=s().catch(c=>{throw n.has(o)||(n.add(o),r(c)),TE(c)||t.delete(o),c});return t.set(o,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var Gr=CE();function Ra(){Gr.clear()}l.setApiOriginFailoverHook(()=>Gr.clear());var ka=new WeakMap;function Yr(e){return l.resolveExplicitApiBaseUrl(e)}function AE(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function DE(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function PE(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 Wr=new WeakMap;function qr(e,t){Wr.set(e,t)}function OE(e){return Wr.get(e)}function RE(e,t){return async({baseUrl:n})=>{const r=t(),o=r&&Wr.get(r)||e,s=Yr(n);if(!s)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await PE(o);if(o.getAuthToken&&!a)throw DE();a&&i.set("authorization",a);const c=await l.fetchWithApiOriginFailover("/app/v1/app_init",{method:"POST",headers:i,body:new URLSearchParams,credentials:"same-origin"},s,{attemptTimeout:nr(o)||void 0});if(!c.ok)throw AE(c.status,c.statusText);return await c.json()}}function kE(e){return JSON.stringify({baseUrl:Yr(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function NE(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function LE(e){return t=>Gr.run(kE(t),()=>(J("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>J("appInit:end",{kind:"network"}))))}function ME(e,t){if(at(e)||!e.appInit&&!Yr(e.baseUrl)||!NE(e))return e;const n=e.appInit??RE(e,t);let r=ka.get(n);return r||(r=LE(n),ka.set(n,r)),{...e,appInit:r}}var Na=0;function xE(){return Na}function FE(){Na+=1,Ra()}var La=new WeakMap,Ma=new WeakMap,BE=3e4;function jE(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function UE(e,t){try{const n=l.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+BE}function HE(e){const t=new Map,n=new Map;return async(r,o,s)=>{const i=jE(r,o);if(s)return n.delete(i),t.delete(i),Ra(),e(r,o,s);const a=n.get(i);if(a&&!t.has(i)){if(a.expiresAtMs>Date.now())return a.token;n.delete(i)}let c=t.get(i);return c===void 0&&(J("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,o,s)).then(d=>{const u=String(d||"").trim();return u&&n.set(i,{token:d,expiresAtMs:UE(u,Date.now())}),d}).finally(()=>{J("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function $E(e){if(at(e))return e;const t=e.getAuthToken;if(!t)return e;let n=La.get(t);const r=xE();return(!n||Ma.get(t)!==r)&&(n=HE(t),La.set(t,n),Ma.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(o=>{}),{...e,getAuthToken:n}}var VE="[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 GE(e){const t=new Error(VE,{cause:e});return t.name="EditorStartFailedError",t}var YE={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function xa(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var Fa=["handleLoad","handleDestroy"];function Ba(e,t){let n=e;for(const r of Fa){const o=e?.[r];typeof o=="function"&&(n={...n,[r]:(s,...i)=>o(t,...i)})}return n}function WE(e){let t,n="pending",r,o,s,i;const a=new Set,c=[],d=new Set;let u,p;const f=new Promise((b,F)=>{u=b,p=F});f.catch(()=>{});const g={},y=b=>t?.[b],_=()=>r??be(),m=(b,F)=>{const V=y(b);if(typeof V!="function")throw xa(b);return V.apply(t,F)},I=(b,F)=>{try{return Promise.resolve(m(b,F))}catch(V){return Promise.reject(V)}},P=()=>{const b=t?.container?.getInstance?.(l.DISPOSABLE_ID);if(!(n!=="ready"||b?.isDisposed()||typeof y("getConfig")!="function"))try{i=m("getConfig",[])}catch{}},x=()=>n==="dead"?Promise.reject(_()):n==="ready"?Promise.resolve():f,L=()=>{for(const[b,F]of rn)F==="field"&&(g[b]=y(b))},C=b=>{const F=y(b.name);b.dispose||typeof F!="function"||n==="dead"||(b.dispose=F.apply(t,b.args))},E=()=>a.forEach(C),S=()=>{for(const b of a){try{b.dispose?.()}catch{}b.dispose=void 0}},w=()=>{L(),E()},O=()=>{s?.delete(w),s=void 0},N=(b,F)=>{const[V,...h]=F;return!Fa.includes(b)||typeof V!="function"?F:[(D,...U)=>V(g,...U),...h]},A=(b,F)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof y(b)!="function")throw xa(b);const V={name:b,args:N(b,F)};return a.add(V),C(V),()=>{a.delete(V),V.dispose?.(),V.dispose=void 0}},T=()=>t?.container?.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.content,R=()=>{const b=e.element();return b!==void 0&&typeof b!="string"?b:void 0},M=(b,F)=>{switch(F){case"event":return(...V)=>A(b,V);case"async":return(...V)=>(b==="show"&&V[0]!==void 0&&e.shown?.(V[0]),n!=="dead"&&typeof y(b)=="function"?I(b,V):x().then(()=>m(b,V)));case"queued":return(...V)=>{if(n==="dead"){if(b==="notify")return;throw _()}if(n==="pending"){c.push({name:b,args:V});return}return m(b,V)};case"sync":return(...V)=>{if(n==="dead"){if(b==="getConfig")return i;throw _()}if(typeof y(b)!="function")throw new Error(`[emailmaker] \`${b}\` is not available before the editor is ready: ${YE[b]??"await `ready` first"}`);const h=m(b,V);return b==="getConfig"&&(i=h),h};case"element":return()=>{if(typeof y(b)!="function")return R();try{return m(b,[])}catch{return R()}};case"codeErrors":return()=>n==="ready"&&typeof y(b)=="function"?m(b,[]):[];case"field":return}};for(const[b,F]of rn)g[b]=M(b,F);g.reset=b=>(b?.content!==void 0&&e.shown?.(b.content),x().then(async()=>{const F=b?.content!==void 0&&l.deepEqual(b.content,T());await m("reset",[Ba(b,v)]),F&&await m("show",[b.content])}).then(()=>g)),g.destroy=()=>{if(n==="dead")return;const b=l.createAbortError("[emailmaker] editor was destroyed before it was ready");o?.catch(()=>{}),d.forEach(F=>F(b)),P(),e.destroy()},Object.defineProperty(g,"ready",{get:()=>o,enumerable:!0,configurable:!0});const v=g;return{object:v,get state(){return n},get editor(){return t},bind:b=>{n==="dead"||t===b||(S(),O(),t=b,L(),E(),n==="pending"&&(s=b.container.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),s.add(w)))},settle:()=>{if(n==="pending"){n="ready",O(),L(),E();for(const b of c.splice(0))try{m(b.name,b.args)}catch(F){queueMicrotask(()=>{throw F})}u()}},kill:(b,F)=>{n!=="dead"&&(P(),n="dead",r=b,c.length=0,d.forEach(V=>V(b)),O(),F?.keepSubscriptions||(S(),a.clear()),p(b))},detach:()=>{S(),a.clear()},setReady:b=>{o=b},trackCall:b=>(d.add(b),()=>d.delete(b)),hasCalls:()=>d.size>0}}var Kr="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function qE(){return l.createAbortError(Kr)}function ja(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Kr}function KE(e,t,n){if(typeof document>"u")return;let r=!1,o;const s=()=>{r=!0,o?.disconnect(),o=void 0},i=()=>{r||(s(),t())};if(n.addDispose(s),!e.isConnected){queueMicrotask(i);return}o=new MutationObserver(()=>{e.isConnected||i()});let a=e.parentNode;for(;a;)o.observe(a,{childList:!0}),a=a.parentNode}function zE(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:o}=e;if(t===void 0||!(n instanceof Element))return r;const s=new AbortController;return KE(n,()=>{n.id,s.abort(qE())},o),l.composeAbortSignals(r,s.signal)}var zr="Superseded by newer init() on the same mount element";function Ua(){return l.createAbortError(zr)}function Ha(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===zr}var bt=new Map,$a=new WeakMap,an=new WeakMap;function XE(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function JE(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=XE(e);(n?bt.get(n):void 0)?.forEach(u=>{u.element!==e&&u.controller.abort(Ua())});const r=$a.get(e)??new Set;t&&r.forEach(u=>{u.supersedable&&u.controller.abort(Ua())});const o=an.get(e)??Promise.resolve();let s;const i=new Promise(u=>{s=u}),a=o.then(()=>i);an.set(e,a),a.then(()=>{an.get(e)===a&&an.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),$a.set(e,r),n){const u=bt.get(n)??new Set;u.add(d),bt.set(n,u)}return{signal:c.signal,previous:o,release:()=>{s(),r.delete(d);const u=n?bt.get(n):void 0;n&&u?.delete(d)&&u.size===0&&bt.delete(n)}}}var yt=new WeakMap;function Xr(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function Jr(e){return Object.entries(e).filter(([t,n])=>Xr(t,n)).map(([t])=>t).sort()}function Va(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!Xr(n,r)&&(t[n]=r);return t}function Qr(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:yt.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},yt.set(e,r));const{current:o,trampolines:s}=r;o.clear();const i={...t};for(const a of Jr(t)){o.set(a,t[a]);let c=s.get(a);c||(c=(...d)=>o.get(a)?.(...d),s.set(a,c)),i[a]=c}return r.lastOptions=t,i}function Ga(e,t){const n=e?yt.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const o=t[r];Xr(r,o)?n.current.set(r,o):n.current.delete(r)}}function QE(e){const t=e?yt.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((o,s)=>t.current.set(s,o)),t.lastOptions=r}}function ZE(e,t,n){const r=e?yt.get(e):void 0;if(!r||!n)return!1;const o=Jr(t),s=l.deepEqual(o,Jr(r.lastOptions)),i=o.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!s||!i||!l.deepEqual(Va(t),Va(r.lastOptions))?!1:(Qr(e,t),!0)}var me=new WeakMap,nb=0;function ln(e){let t=me.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},me.set(e,t)),t}var we=e=>e!==void 0&&e.state!=="dead";function e_(e){const t=me.get(e)?.shared;return we(t)?t:void 0}function t_(e,t){ln(e).shared=t}function n_(e,t){!(we(e.shared)&&[...e.counted].some(we))||e.warned||!t.devTools||(e.warned=!0)}function r_(e,t,n,r){const o=ln(e);return o.latestCall+=1,o.releaseTimer!==void 0&&(clearTimeout(o.releaseTimer),o.releaseTimer=void 0),o.leaving.forEach(s=>s.detach()),o.leaving.clear(),n==="single"?o.shared=t:o.counted.add(t),o.options.set(t,r),o.order=[...o.order.filter(s=>s!==t&&we(s)),t],n_(o,r),o.latestCall}function o_(e,t){return me.get(e)?.latestCall===t}function s_(e){const t=me.get(e);if(t)return t.order=t.order.filter(we),t.order.at(-1)?.object}function St(e,t){const n=me.get(e);return n?we(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&we(r)):!1}function i_(e,t){const n=me.get(e),r=n?.order.filter(o=>o!==t&&we(o)).at(-1);return r?n?.options.get(r):void 0}function Ya(e,t){ln(e).content={value:t}}function a_(e){return me.get(e)?.content}function l_(e,t,n,r){const o=ln(e);if(o.counted.delete(t),o.options.delete(t),St(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),o.leaving.add(t),Wa(e,r)}function Wa(e,t){const n=me.get(e);!n||St(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!St(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function c_(e,t){const n=me.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);me.delete(e)}}var d_=fn.__exportAll({FileManagerApiError:()=>u_,IntegratorSaveTimeoutError:()=>Ct,SaveRefusedError:()=>Ae}),u_=class Xa 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,Xa)}},f_=fn.__exportAll({mapHttpStatusToErrorCode:()=>l.mapHttpStatusToErrorCode});function p_(e,t){return{...e,element:t}}function Zr(){return()=>{}}function h_(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Zr():(bE(t,e.config?.styles,t),()=>{yE(t)})}function m_(e){if(!Oa()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Zr()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Zr()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(o=>{o.remove()});const n=IE(t,"data-emailmaker"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function g_(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function cn(e){try{e.destroy()}catch{}}function dn(e,...t){const n=l.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&l.ELEMENT_MAP.delete(e)}var v_="1.2.3";async function E_(e){jn(),await qg(typeof __emailmaker__<"u"?__emailmaker__:void 0)}async function __(e){return qa(e).ready}function b_(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function y_(e){const t=l.ELEMENT_MAP.get(e);return t&&!(t instanceof Promise)?t:void 0}function un(e,t,n){const r=t??y_(e);r&&(dn(e,r),cn(r)),c_(e,n)}function S_(e){const{control:t,mode:n,ref:r}=e,o=r.host;if(!o){const i=t.editor;w_(i),t.kill(be());return}if(n==="single"){un(o,t.editor,be());return}const s=i_(o,t);l_(o,t,be(),()=>un(o,t.editor,be())),s&&St(o)&&Ga(o,s)}function w_(e){e&&cn(e)}function qa(e){J(oe.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=l.composeAbortSignals(e.signal,n.signal),o=t==="single"?b_(e.element):void 0,s=o?e_(o):void 0;let i;if(s)i={control:s,mode:t,ref:{host:o}};else{const u={},p=WE({element:()=>u.host??e.element,destroy:()=>S_(i),shown:f=>{u.host&&Ya(u.host,f)}});i={control:p,mode:t,ref:u},o&&t_(o,p)}const{control:a}=i,c=a.trackCall(u=>n.abort(u)),d=P_(Ba({...e,signal:r},a.object),i).then(()=>(c(),J(oe.initEnd),a.settle(),a.object),u=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(u);const p=i.ref.host;throw p&&Wa(p,()=>un(p,void 0,be())),u});return a.setReady(d),a.object}function I_(e){const t=typeof e=="string"?document.querySelector(e):e;return t?s_(t):void 0}function T_(e){let t,n,r=!1;try{t=e.container.getInstance(l.OPTIONS_SOURCE_ID)?.get(),n=e.container.getInstance(l.INIT_PIPELINE_ID)?.externalSignal;const o=He(e.container)?.current();r=o!==void 0&&o.get().savedVersion!==null&&o.isDirty()}catch{t=void 0}return{options:t,signal:n,email:C_(e),dirty:r}}async function C_(e){try{return await e.getEmailSnapshot()}catch{return}}function A_(e){const t=He(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Ka(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||St(e,n)}async function D_(e,t,n,r,o){if(r.mode==="counted"&&r.control.detach(),Ha(o)||ja(o))return;const s=()=>un(t,e,GE(o)),{options:i}=n;if(!i||!Ka(t,r)){s();return}const a=await n.email,c=a&&(i.content!==void 0||a.id!==void 0)?a:void 0,d=typeof i.content=="object"&&"email"in i.content?i.content:void 0;try{await e.reset({...i,signal:i.signal??n.signal,content:c?{...d,email:c}:i.content}),n.dirty&&c&&A_(e),Ka(t,r)?l.ELEMENT_MAP.set(t,e):s()}catch{s()}}async function P_(e,t){l.throwIfAborted(e.signal);const n=new l.Disposable;let r,o,s,i,a=0;try{const c=await l.waitForElement(e.element,n,e.signal);c&&(i=c,t.ref.host=c,a=r_(c,t.control,t.mode,e));const d=zE({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),u=JE(c,{supersede:t.mode==="single"});r=u.release;const p=l.composeAbortSignals(d,u.signal);l.throwIfAborted(p),s=QE(c),Ga(c,e),await l.raceWithAbortSignal(u.previous,p),o=O_(e,c,t,p,s);const f=await l.raceWithAbortSignal(o,p);return c&&e.content!==void 0&&Ya(c,e.content),f}catch(c){throw i&&s&&o_(i,a)&&s(),c}finally{const c=r;o!==void 0&&c?o.then(c,c):c?.(),n.dispose()}}async function za(e,t,n,r){const o=a_(t);n===void 0||r||!o||l.deepEqual(n,o.value)||await e.show(n)}async function O_(e,t,n,r,o){const{control:s}=n,i=_=>s.bind(_);l.throwIfAborted(r);let a;const c=_=>{FE();const m=$E(p_(_,t)),I=ME(m,()=>a);return{preparedOptions:I,preparedOptionsWithSignal:r!=null?{...I,signal:r}:I}};let d;if(t){const _=l.ELEMENT_MAP.get(t);if(_){let m;try{m=await _,l.throwIfAborted(r)}catch{l.throwIfAborted(r),dn(t,_),m=void 0}if(m)if(m.getElement()===t){const I=hE(t);a=I;const P=m.container.getInstance(l.OPTIONS_SOURCE_ID)?.get();if(ZE(t,e,P))return i(m),r&&m.container.getInstance(l.INIT_PIPELINE_ID)?.relinkExternalSignal(r),l.ELEMENT_MAP.set(t,m),await za(m,t,e.content,!1),m;const x=!l.deepEqual(e.content,P?.content);d=c(Qr(t,e));const{preparedOptions:L,preparedOptionsWithSignal:C}=d,E=I&&OE(I),S=T_(m);try{I&&qr(I,L),i(m);const w=await m.reset(g_(e,C));return l.throwIfAborted(r),l.ELEMENT_MAP.set(t,m),await za(m,t,e.content,x),w}catch(w){if(I&&E&&qr(I,E),!yl(w))throw o(),await D_(m,t,S,n,w),w;dn(t,_,m),cn(m),l.throwIfAborted(r)}}else dn(t,_,m),cn(m)}}l.throwIfAborted(r),d??=c(Qr(t,e,{fresh:!0}));const{preparedOptions:u}=d,p=h_(u),f=m_(u),g=r!=null?{...f.options,signal:r}:f.options;let y;try{a=vE(g),mE(t,a),qr(a,u),Ir(a).set(g),await Or(),J(oe.coreReady),l.throwIfAborted(r),l.throwIfAborted(r),y=pE(g,a,{onInstance:i}),t&&l.ELEMENT_MAP.set(t,y);const _=await y;if(r?.aborted&&(_.destroy(),l.throwIfAborted(r)),t)if(l.ELEMENT_MAP.get(t)===y)l.ELEMENT_MAP.set(t,_);else throw _.destroy(),l.throwIfAborted(r),l.createAbortError(r?.reason);return _}catch(_){throw p(),f.cleanup(),a&&(Da(a),gE(t,a)),t&&y&&l.ELEMENT_MAP.get(t)===y&&l.ELEMENT_MAP.delete(t),_}}async function R_(e){return(await gt()).parseAMP(e)}typeof window<"u"&&(Ze()&&_l(),zg(typeof __emailmaker__<"u"?__emailmaker__:void 0)),de.ELEMENT_DETACHED_ABORT_MESSAGE=Kr,de.SUPERSEDED_INIT_ABORT_MESSAGE=zr,de.create=qa,Object.defineProperty(de,"errors",{enumerable:!0,get:function(){return d_}}),de.getInstance=I_,Object.defineProperty(de,"helpers",{enumerable:!0,get:function(){return f_}}),de.init=__,de.isElementDetachedError=ja,de.isSupersededInitError=Ha,de.parseAMP=R_,de.pluginRegistry=pa,de.preload=E_,de.version=v_});
|
|
2183
2183
|
|
|
2184
2184
|
|
|
2185
2185
|
// Возвращаем API из entry модуля
|
|
2186
2186
|
return __emailmaker__.syncRequire("emailmaker.js");
|
|
2187
2187
|
});
|
|
2188
2188
|
|
|
2189
|
-
__emailmaker__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/15ea858c.js":[],"static/core/
|
|
2189
|
+
__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"],"emailmaker.js":[],"static/umd/3f12d6ff.js":["static/umd/790cf6cb.js"],"static/umd/790cf6cb.js":[],"static/umd/b3ebeaee.js":[],"static/umd/cb17e366.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"]}});
|