@emailmaker/emailmaker 1.2.0 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/README.md +4 -0
  3. package/emailmaker-core.ee1618fa.js +859 -0
  4. package/emailmaker-esm.js +11 -11
  5. package/{emailmaker-po.fec11667.js → emailmaker-po.ee1618fa.js} +1 -1
  6. package/emailmaker.d.ts +34 -2
  7. package/emailmaker.js +12 -12
  8. package/iframe/.vite/manifest.json +4 -4
  9. package/iframe/{iframe-eblock.fec11667.html → iframe-eblock.ee1618fa.html} +2 -2
  10. package/iframe/{iframe.fec11667.html → iframe.ee1618fa.html} +2 -2
  11. package/iframe/js/elMarkupHelper.Buog1r0c.js +278 -0
  12. package/iframe/js/iframe-eblock.body.ee1618fa.js +9 -0
  13. package/iframe/js/iframe-eblock.js +2 -2
  14. package/iframe/js/iframe.body.ee1618fa.js +129 -0
  15. package/iframe/js/iframe.js +2 -2
  16. package/iframe/js/sanitize-html/sanitize-html.js +46 -21756
  17. package/package.json +1 -1
  18. package/runtime/react/index.js +1 -1
  19. package/static/core/155e871a.js +7 -0
  20. package/static/core/{7be64bf5.js → 17fba7af.js} +1 -1
  21. package/static/core/{a9235d9e.js → 2a042fe3.js} +1 -1
  22. package/static/core/{c5713f94.js → 32a14159.js} +1 -1
  23. package/static/core/{99c15a5d.js → 4de9c323.js} +1 -1
  24. package/static/core/{ec5f739e.js → 50ba806c.js} +10 -10
  25. package/static/core/{db685f4e.js → 5b6e2acb.js} +1 -1
  26. package/static/core/{f2ced98d.js → 63e7f8c1.js} +2 -2
  27. package/static/core/{790366d3.js → 64711257.js} +1 -1
  28. package/static/core/{f54ef492.js → 659796a7.js} +1 -1
  29. package/static/core/{b74171bd.js → 683a6a53.js} +1 -1
  30. package/static/core/{b27aec0b.js → 6b16159c.js} +1 -1
  31. package/static/core/{5c4239d8.js → 7e167222.js} +1 -1
  32. package/static/core/{8b89090c.js → 82f8beb4.js} +1 -1
  33. package/static/core/{a2c7aeb0.js → 987afc3f.js} +1 -1
  34. package/static/core/{44fac8d4.js → 9eaed676.js} +1 -1
  35. package/static/core/{9f7e0f94.js → a8b4352d.js} +1 -1
  36. package/static/core/{b7dee12b.js → b7289065.js} +2 -2
  37. package/static/core/b96e571d.js +2 -0
  38. package/static/core/c03be019.js +4 -0
  39. package/static/core/{7d006e7b.js → c3d00c5e.js} +1 -1
  40. package/static/core/{727a165f.js → c67df236.js} +1 -1
  41. package/static/core/{e15ab856.js → c8443fab.js} +1 -1
  42. package/static/core/{64c27f91.js → d2780737.js} +1 -1
  43. package/static/core/d503c406.js +1 -0
  44. package/static/core/{29b3ccef.js → dd230bbb.js} +1 -1
  45. package/static/core/e7fa68c2.js +28 -0
  46. package/static/core/{ccb090eb.js → f35181ec.js} +7 -7
  47. package/static/esm/b4f8dfdc.js +1 -0
  48. package/static/umd-runtime/{runtime.CunK0nEC.js → runtime.Bsid8PpY.js} +1 -1
  49. package/vendor/@emailmaker/ui-kit/package.json +1 -1
  50. package/emailmaker-core.fec11667.js +0 -859
  51. package/iframe/js/elMarkupHelper.Dv3AYDYP.js +0 -279
  52. package/iframe/js/iframe-eblock.body.fec11667.js +0 -9
  53. package/iframe/js/iframe.body.fec11667.js +0 -129
  54. package/iframe/js/sanitize-html/sanitize-html.min.js +0 -16923
  55. package/static/core/2e70fae0.js +0 -4
  56. package/static/core/83d2ca5d.js +0 -28
  57. package/static/core/8da91a53.js +0 -2
  58. package/static/core/bbb87124.js +0 -1
  59. package/static/core/e7bbe544.js +0 -7
  60. 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.fec11667.js","monaco":"static/monaco/index.CCINpETE.js","po":"emailmaker-po.fec11667.js","static/umd-runtime/delivery-libs.js":"static/umd-runtime/delivery-libs.eFZaeVgo.js","static/umd-runtime/runtime.js":"static/umd-runtime/runtime.CunK0nEC.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"} });
1017
+ __amdEnv.require.config({ baseUrl: "./", paths: {"core":"emailmaker-core.ee1618fa.js","monaco":"static/monaco/index.CCINpETE.js","po":"emailmaker-po.ee1618fa.js","static/umd-runtime/delivery-libs.js":"static/umd-runtime/delivery-libs.eFZaeVgo.js","static/umd-runtime/runtime.js":"static/umd-runtime/runtime.Bsid8PpY.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.0";
1365
+ ns.version = "1.2.5";
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/512f983c.js",["require","exports","module"],function(Bn,a,Fn){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,X;function ut(){if(!X)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,se.prototype.getInstanceAsync),e.stack}function W(e){P.delete(e)&&X?.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),X?.start(s),this._onInject(t,()=>{W(s),i(this.getInstance(t))})})}failPendingWaits(t){for(const r of Array.from(P))r.container===this&&(W(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(c=>c!==r))}),i}addServiceFactory(t,r,n){const i=M(t);let o;this.injectFactory(i,(c,u=[])=>(o=r(c,o),o===void 0?u:u.indexOf(o)<0?[...u,o]:u),n);const s=new g;return s.addDispose(()=>{this.injectFactory(i,(c,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&&W(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:[]},c={container:e,source:"packages/runtime-core/di/index.ts",buildSource:r,timestamp:Date.now(),stack:new Error().stack};return s.entries.push(c),e}var j;function mt(){if(j)return j;const e=ht();return j=Ot(ae(e),e),j}var K=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 q(e){if(e?.aborted)throw S(e.reason)}function It(e,t){return t?(t.aborted&&e.catch(()=>{}),q(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(([,c])=>c<t),s=[e,t];return n.splice(o>=0?o:n.length,0,s),n.length===1&&i.onFirstListenerAdd&&i.onFirstListenerAdd(),{dispose:()=>{const c=n.indexOf(s);c>=0&&(n.splice(c,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)}},B=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((...c)=>{o=c,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 B)}function d(e){return f(e)}var Y;(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")})(Y||(Y={}));function Pt(e,t){return e.getOrCreateInstance(t,()=>new B).event}function Ct(e,t){return e.getOrCreateInstance(t,()=>new B)}var Lt=f("plugin.app"),vt=f("plugin.disposable"),Rt=f("InitPipelineContext"),wt=f("plugin.instance"),Mt=f("plugin.lateSurfaceListeners"),le=f("plugin.optionsSource"),jt=f("plugin.store"),de=f("ConfigSource"),Bt=f("plugin.standalone.project"),fe=f("plugin.standalone.bootstrapToken"),xn=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 Wt(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",$t="em:window-drained",F="";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(([c,u])=>r<=u),s=[t,r];return this.isDisposed()||i.splice(o>=0?o:i.length,0,s),{dispose(){const c=i.indexOf(s);c>=0&&i.splice(c,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=c=>o(c,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),Wt(r)&&s||this._singleton&&pe(r,T)){if(i&&s){const l=this._target;Promise.resolve().then(()=>this.usePort(i,!0,l))}const c=this._emitter.fireAsync(r.operationId||F,r.operationId===void 0?t:r.data),u=r.result,_=r.error;u&&_&&Promise.resolve(c).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:$t,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(F,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 c=this.addDisposable(new g);c.addDisposable(this.onInit(u=>{try{this._postMessage(u,{operationId:e,data:t,result:n,error:i})}catch(_){c.dispose(),s(_);return}c.addDisposable(this._onMessage(n,_=>{o(_),c.dispose()})),c.addDisposable(this._onMessage(i,_=>{s(_),c.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(F,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"),kn=f("client"),Un=f("v2_client"),Hn=f("ai_client"),sr=f("app.cookieManager"),Gn=f("app.storageProvider"),Vn=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:c,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,G=`${s||this.baseUrl||""}${r}${p?`?${p}`:""}`,Mn=_?_(G,{body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:c,extraQuery:u,proxyHandler:_,...l}):G,st=new Request(Mn,{...h,headers:{...h.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(c?this.createAbortSignal(c):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 jn=O?await at[O]().then(V=>(I.ok?I.data=V:I.error={data:V},I)).catch(V=>(I.error=V,I)):I;return c&&this.abortControllers.delete(c),jn})}},_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"),x=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(x),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 c=await fetch(s);const u=e.getServices(fr);for(const _ of u)c=await _.execute(c,s);return c}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&&(K.getInstance(t)?.dispose(),K.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 jr(e){return/[?#]/.test(e)||/\{(?:url|url_encoded|query|search|hash|fragment)\}/i.test(e)}function Br(e,t){if(jr(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("&"),c=n.lastIndexOf("=");return c>Math.max(o,s)&&c>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}`:"/",c=o.match(/^([^/]+)(?:\/([^/]+))?(?:\/(.*))?$/),u=c?.[1]||"",_=c?.[2]||"",l=c?.[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 c of e){const u=te(c,t);if(u!==void 0)return u}return}if(e==="*")return{};const r=Br(t,e),{regex:n,tokens:i}=Mr(e),o=n.exec(r);if(!o)return;const s={};return i.forEach((c,u)=>{s[`matched_${c}`]=o[u+1]||""}),s}function k(e,t,r={}){const n=xr(t);if(!n)return t;const i={...n,...r};let o="",s=0;const c=/\{([a-z_]+)\}/gi;let u;for(;u=c.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,c)=>{if(!s)return;if(typeof s=="string"){const E=s.includes("{")&&s.includes("}")?k(s,t):ye(s,t);o.push({key:`backend:${c}`,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("}")?k(O,t,_):O})():l?k(Pe(l,E),t,_):E.includes("{")&&E.includes("}")?k(E,t,_):ye(E,t);o.push({key:`backend:${u.id||"rule"}:${c}:${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 Wr(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 $r(){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 je(e,t=[]){return e?Jr([e,...t]).slice(0,3):[]}function Be(){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(!$r())return!1;const t=Me(e);if(!t)return!1;const r=Be();return r.length===0?!1:je(t,r).length>1}function R(e){const t=Me(e);if(!t)return[];const r=Be();return r.length===0?[t]:je(t,r)}function U(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 U(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 H(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 We(){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,c)=>{const u=o?`${o}[${c}]`:`${c}`;r(n,s,u)});return}if(typeof i=="object"){Object.keys(i).forEach(s=>{const c=i[s],u=o?`${o}[${s}]`:s;r(n,c,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=Wr(e,{config:r,method:t,standalone:n}),o=i.length>0?i:[e],s=this.buildRequestKey(e,t),c=y.get(s);return!c||!o.includes(c)?o:[c,...o.filter(u=>u!==c)]}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),c=this.getBackendProxyCandidates(i,o);let u,_;for(const l of c){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!==c[c.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?[U(r)]:[this.baseUrl].filter(Boolean);if(o.length===0)return this.requestOnOrigin(e,this.baseUrl);let s,c;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(c=E,!l){H(_,r);continue}break}return E.ok&&Xe(_,r),E}catch(E){if(!Ge(E))throw E;s=E,l||H(_,r)}}if(n&&We(),c)return c;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 $e=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 c=e.length;if(t.length!==c)return!1;for(let u=0;u<c;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 c=0;c<s;c++){const u=i[c];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,c)=>{if(o.stale)return"";try{let u=await c||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(x,{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}`)}})}function dn(e,t){if(e===t)return;let r=0;const n=Math.min(e.length,t.length);for(;r<n&&e[r]===t[r];)r++;let i=e.length,o=t.length;for(;i>r&&o>r&&e[i-1]===t[o-1];)i--,o--;return{start:r,fromEnd:i,toEnd:o}}function fn(e){let t=2166136261;for(let r=0;r<e.length;r++)t=Math.imul(t^e.charCodeAt(r),16777619);return{length:e.length,hash:t>>>0}}var En={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"},pn={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",hn="useblocks",On={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"},mn={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_emails_v2:"em_emails_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_guest_locale:"em_guest_locale"},An="light",gn="dark",In="system",Tn="(prefers-color-scheme: dark)",Sn=15e3,bn=3e3,Dn={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"},Nn={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 yn(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 c of n)await c.setOptions(s)},dispose:()=>{for(const s of n)s.dispose()}}}}function Pn(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?[U(r)]:[];if(o.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const s=e.startsWith("/")?e:`/${e}`;let c,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(c=p,!E){H(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||H(l,r)}finally{h?.done()}}if(N(r)&&We(),c)return c;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 Cn=ne(e=>{let t,r;const n=tt();return e.addService(x,{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 c=e.getInstance($e),u=String(c?.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),Pn()}})}),{setOptions(i){const o=i.jwtAuth,s=String(i.baseUrl||"").trim()||void 0,c=!w(o,t),u=s!==r;if(t=o,r=s,!o){nt(e);return}c||u?nt(e):e.inject(C,void 0)}}}),Ln=ne(e=>(Ze(e),{setOptions(t){Qe(e,t)}}));function vn(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 Rn(e,t,r){if(e.isConnected)return e;const n=e.id?.trim();return n?ot(`#${vn(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(q(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,c)=>{const u=O=>{o.dispose(),O()},_=()=>{u(()=>c(S(r?.reason)))};if(r?.aborted){_();return}r?.addEventListener("abort",_),o.addDispose(()=>r?.removeEventListener("abort",_));const l=document.body??document.documentElement;if(!l){u(()=>c(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 G of it(O))p(G)};p(l),A(),o.addDispose(()=>h.disconnect())})}return e instanceof Element?Rn(e,t,r):e}return e}var wn=new Map;Object.defineProperty(a,"ADVANCED_SETTINGS_PANEL",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(a,"APP_COOKIES",{enumerable:!0,get:function(){return On}}),Object.defineProperty(a,"APP_ID",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(a,"APP_LOAD_EVENT_ID",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(a,"ATOMS_HANDLERS_ID",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(a,"AsyncEmitter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"BaseEmitter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(a,"CANVAS_ECHO_LOST_AFTER_MS",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(a,"CANVAS_ECHO_RECOVERY_WAIT_MS",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(a,"CANVAS_FACTS",{enumerable:!0,get:function(){return En}}),Object.defineProperty(a,"COMMON_STYLES",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(a,"CONFIG_CHANGED_EVENT_ID",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(a,"CONFIG_SOURCE_ID",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"COOKIE_MANAGER_ID",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(a,"CUSTOM_FETCH_ID",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"CUSTOM_MESSAGE",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"ContentType",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(a,"DARK",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(a,"DISPOSABLE_ID",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(a,"DependencyResolver",{enumerable:!0,get:function(){return K}}),Object.defineProperty(a,"Disposable",{enumerable:!0,get:function(){return g}}),Object.defineProperty(a,"ELEMENT_MAP",{enumerable:!0,get:function(){return wn}}),Object.defineProperty(a,"EVENT_TYPES",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(a,"Emitter",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(a,"HANDLE_ATOM_INSERT_ID",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(a,"HEADLESS_MODE_ID",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(a,"INIT_PIPELINE_ID",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(a,"INSTANCE_ID",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(a,"JWTMixin",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(a,"LATE_SURFACE_LISTENERS_ID",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(a,"LIGHT",{enumerable:!0,get:function(){return An}}),Object.defineProperty(a,"LOCAL_STORAGE_ITEMS",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(a,"MESSAGE_SERVICE_ID",{enumerable:!0,get:function(){return er}}),Object.defineProperty(a,"MODAL_CLOSE_EVENT",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(a,"MODAL_SHOW_EVENT",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(a,"MODAL_UPDATE_EVENT",{enumerable:!0,get:function(){return or}}),Object.defineProperty(a,"MONACO_EDITOR_OPTIONS",{enumerable:!0,get:function(){return Nn}}),Object.defineProperty(a,"MessageService",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(a,"OAuthMixin",{enumerable:!0,get:function(){return Ln}}),Object.defineProperty(a,"OPTIONS_SOURCE_ID",{enumerable:!0,get:function(){return le}}),Object.defineProperty(a,"PLUGIN_COLLECTION_ID",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(a,"PORT_READY",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"PREFERS_COLOR_SCHEME_DARK",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(a,"PUBLIC_REQUEST",{enumerable:!0,get:function(){return me}}),Object.defineProperty(a,"REQUEST_HANDLER_ID",{enumerable:!0,get:function(){return x}}),Object.defineProperty(a,"REST_CLIENT_FACTORY_ID",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(a,"REST_TRANSPORT_ID",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"SANDBOX_EXTENSIONS_ID",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(a,"SANDBOX_EXTENSION_SCRIPT_STATUS_ID",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(a,"SECURITY_MODULE_ID",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(a,"SETTINGS_PANEL_EVENT",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(a,"STANDALONE_ACTIVATED_ID",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(a,"STANDALONE_BOOTSTRAP_TOKEN_ID",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(a,"STANDALONE_FILE_PROXY_REGISTERED_ID",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(a,"STANDALONE_PROJECT_ID",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(a,"STORE_ID",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(a,"SYSTEM",{enumerable:!0,get:function(){return In}}),Object.defineProperty(a,"Signal",{enumerable:!0,get:function(){return St}}),Object.defineProperty(a,"TEMPLATE_DIRECTIVES_ID",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(a,"USEBLOCKS",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(a,"combineMixins",{enumerable:!0,get:function(){return yn}}),Object.defineProperty(a,"composeAbortSignals",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(a,"createAbortError",{enumerable:!0,get:function(){return S}}),Object.defineProperty(a,"createIdentifier",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(a,"createIdentifier$1",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"createQueue",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(a,"debounce",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(a,"decodeJwt",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(a,"deepEqual",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"defineMixin",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(a,"events",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"fetchWithApiOriginFailover",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(a,"filter",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(a,"findTextDiffBounds",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(a,"generateUUID",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"getActiveBaseUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"getApi",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(a,"getEmitter",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(a,"getEmitter$1",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(a,"getEvent",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(a,"getServiceContainerId",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"isAbortError",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(a,"mapHttpStatusToErrorCode",{enumerable:!0,get:function(){return At}}),Object.defineProperty(a,"mergeBackendProxyLayers",{enumerable:!0,get:function(){return br}}),Object.defineProperty(a,"mergeResourceProxyLayers",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(a,"mergeResourceProxyPolicyLayers",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(a,"mergeShallowConfigLayers",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(a,"pickKey",{enumerable:!0,get:function(){return gr}}),Object.defineProperty(a,"provideOAuth",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(a,"raceWithAbortSignal",{enumerable:!0,get:function(){return It}}),Object.defineProperty(a,"registerRestTransport",{enumerable:!0,get:function(){return an}}),Object.defineProperty(a,"releaseContainer",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(a,"resolveContainer",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(a,"resolveExplicitApiBaseUrl",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(a,"setApiOriginFailoverHook",{enumerable:!0,get:function(){return en}}),Object.defineProperty(a,"snapshot",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(a,"textFingerprint",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(a,"throwIfAborted",{enumerable:!0,get:function(){return q}}),Object.defineProperty(a,"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/512f983c.js","static/umd/b3ebeaee.js"],function(Tt,pe,ub){Object.defineProperties(pe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const hn=Tt("./static/umd/790cf6cb.js"),l=Tt("./static/umd/512f983c.js"),ul=Tt("./static/umd/b3ebeaee.js");var fl=new Function("url","return import(url)");function pl(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function mn(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function so(e){return e.type==="umd"||e.resolve==="registry"}var hl="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 ml(e){const t=Array.isArray(e)?e[0]:e;return mn(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function gl(e,t){const n=ml(e),r=mn(e)?e:void 0,o=t instanceof Error?t.message:String(t),s=r&&so(r)&&!/compat/iu.test(o)?` ${hl}`:"",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 vl(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}function fb(e){return e}var El=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(mn(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(so(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await fl(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):vl(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=gl(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 pl(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)}))}},_l=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)}}}},bl=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()}},io=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 yl(e,t){return t+e}function Sl(){return typeof performance>"u"?Date.now():yl(performance.now(),performance.timeOrigin)}var wl="emailmaker:diagnostics",Il="diagnostics",Tl="diagnostics";function ao(e,t){return t?`${e}${e.includes("?")?"&":"?"}${Tl}=1`:e}var gn;function Cl(){try{const e=new URLSearchParams(window.location.search).get(Il);return e===null?void 0:e!=="0"}catch{return}}function Al(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function Dl(){try{const e=window.localStorage.getItem(wl);return e===null?void 0:e==="1"}catch{return}}function et(){return gn===void 0&&(gn=typeof window>"u"?!1:Cl()??Al()??Dl()??!1),gn}function Pl(e){return`__${(e||"emailmaker").toLowerCase().replaceAll("-","")}__`}var ae={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"},pb=Object.values(ae),hb=[ae.canvasPainted,ae.canvasSettled,ae.appVisible,ae.editorVisible],Ol=5e3,Rl=3e3,lo="diagnosticsStore",Ct,tt;function co(){return{marks:new io(Ol),resources:new io(Rl)}}function uo(){if(tt)return tt;const e=vn();return e?(tt=e[lo]??Ct??co(),e[lo]=tt,Ct=void 0,tt):(Ct??=co(),Ct)}function Z(e,t){et()&&uo().marks.push({phase:e,at:Sl(),...t})}function vn(){if(typeof __emailmaker__<"u"&&__emailmaker__)return __emailmaker__;if(typeof window>"u")return;const e=window[Pl()];return e!==null&&typeof e=="object"?e:void 0}function kl(e){const t=e.length,n=uo();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function Nl(){const e=vn();return!e||!Array.isArray(e.diagnosticsBuffer)?0:kl(e.diagnosticsBuffer)}var Ll="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function we(){const e=new Error(Ll);return e.name="DestroyedInstanceError",e}function Ml(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function En(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)=>En(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)&&En(e[s],t[s]))}function fo(e,t){const n={watch(r){let o,s=!1;return e.watch(i=>{const a=t(i);s&&En(o,a)||(o=a,s=!0,r(a))})},select(r){return fo(n,r)}};return n}function de(...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 fo(o,s)}};return o}var xl=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})},po=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 Fl(e){return String(e||"").trim()||void 0}var Bl=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=Fl(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)}},_n=l.createIdentifier$1("AppInitService");function jl(e){return async()=>{const t=await e();return(await new xl(t).app_init_create({})).data}}function Ul(e){e.injectFactory(_n,(t,n)=>{if(n)return n;const r=new Bl({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:jl(()=>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 bn=l.createIdentifier$1("documentSession.emailDocuments");function $e(e){return e?.getInstance(bn)}var Hl=l.createIdentifier$1("RevisionServiceFlag");function ho(e){return e.getOrCreateInstance(Hl,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function mo(e){return ho(e).isEnabled()}var $l=l.createIdentifier$1("EmailRightsResolver");function Vl(e,t){const n=e.getInstance($l);return n?n(t):!0}var yn={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},go=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],vo=2e4,Gl=go.reduce((e,t)=>e+yn[t],0),Eo=vo+Gl+3e3;function Wl(e){return go.reduce((t,n)=>t+_o(n,e),0)}function _o(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:yn[e]}function bo(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Eo}function yo(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:vo}function At(e=Eo){return e+3e3}var mb="[show-pipeline]";function So(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function gb(e,t){}var Yl=()=>At();function ql(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function Kl(e){return t=>ql(e.getOrCreateInstance(l.events.BEFORE_SAVE_EMAIL,()=>new l.AsyncEmitter).fire(t),Yl())}var De=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},zl=class extends Error{constructor(e){super(`[emailmaker] слот автосохранения недоступен: у письма ${e} нет копии в WordPress`),this.name="AutosaveSlotUnavailableError"}},wo=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"}},Dt=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 se(e){return e.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}var Io=new WeakMap,Sn=new WeakMap;function he(e){return Io.get(e)??0}function Pt(e,t){let n=Sn.get(e);return n||(n=new Set,Sn.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Xl(e){Io.set(e,he(e)+1),Sn.get(e)?.forEach(t=>t())}function wn(e,t){return e.originId!==null||t.originId!==null?e.originId===t.originId:e.generation===t.generation}var Jl=l.createIdentifier$1("documentSession.canvasReceipts");function Ql(){let e,t={scope:{generation:-1,originId:null},changeId:0};return{open(n,r){const o={guid:n,version:r};return e=o,()=>{e===o&&(e=void 0)}},note(n,r){const o=wn(t.scope,r)?t.changeId:0;t={scope:r,changeId:Math.max(o,n)}},read(n){if(!e)return;const{scope:r}=t,o={guid:e.guid,rev:e.version()};return r.originId!==null?{...o,changeId:t.changeId,originId:r.originId}:{...o,changeId:r.generation===n?t.changeId:0}}}}function To(e){return e.getOrCreateInstance(Jl,Ql)}var Zl=2e3,ec=l.CANVAS_ECHO_LOST_AFTER_MS+l.CANVAS_ECHO_RECOVERY_WAIT_MS+Zl;function tc(e,t=ec){return async()=>{const n=se(e);let r;const o=new Promise(s=>{r=setTimeout(()=>s("silent"),t)});try{const s=To(e).read(he(n)),i=await Promise.race([n.sendAsync(l.EVENT_TYPES.SANDBOX_CANVAS_SYNCED,s?{applied:s}:void 0,!1),o]);if(i==="silent"||i&&!i.synced)throw i==="silent"||i?.unsent,new De("canvas-not-synced")}finally{clearTimeout(r)}}}function nc(e){return e!=null&&e!==""}var Co;function nt(e,t){return Co?.capture(e,t)}function rc(e,t){return Co?.captureMessage(e,t)}var oc=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],sc=200;function Ao(e=new Set){const t=new Set;return(n,r)=>{if(!oc.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>=sc&&t.clear(),t.add(o))}}function Do(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Ao()}}var ic=Do();function Ie(e){return e?.getInstance(l.TEMPLATE_DIRECTIVES_ID)??ic}function ac(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function Ot(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var Ee=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} "${Ot(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Ot(this.oldText)}")`:`(replace@${this.oldPosition} "${Ot(this.oldText)}" with "${Ot(this.newText)}")`}};function Po(e,t){return e===null||e.length===0?t:new lc(e,t).compress()}var lc=class Se{_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]=Se._splitCurr(o,r.newPosition-o.oldPosition);this._acceptCurr(c),o=d;continue}if(r.newPosition<o.oldPosition){const[c,d]=Se._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]=Se._splitPrev(r,o.oldLength);i=c,a=o,r=d,o=this._getCurr(++n)}else{const[c,d]=Se._splitCurr(o,r.newLength);i=r,a=c,r=this._getPrev(++t),o=d}this._result[this._resultLen++]=new Ee(i.oldPosition,i.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=i.newLength-i.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const s=Se._merge(this._result);return Se._removeNoOps(s)}_acceptCurr(t){this._result[this._resultLen++]=Se._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++]=Se._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 Ee(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new Ee(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 Ee(t.oldPosition,t.oldText,t.newPosition,r),new Ee(t.oldEnd,"",t.newPosition+n,o)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),o=t.oldText.substr(n);return[new Ee(t.oldPosition,r,t.newPosition,t.newText),new Ee(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 Ee(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 cc(e){return new Ee(e.newPosition,e.newText,e.oldPosition,e.oldText)}function dc(e){return e.map(cc)}function Oo(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function uc(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 fc(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 Pe=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},Ro=0,pc=Math.random().toString(36).slice(2,8);function hc(){return Ro+=1,`doc-${pc}-${Ro}`}function mc(e){const t=e.createBuffer(),n=e.docId??hc();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),_=E=>Object.entries(E).some(([m,T])=>i[m]!==T);return{get:()=>({docId:n,serverId:r,version:o,savedVersion:s,attributes:i}),getContent:g,mutate(E,{source:m}){if(c)return o;const T=E.changes?.length?E.changes:void 0,O=T?uc(g(),T):E.content!==void 0?E.content:void 0,U=O!==void 0&&O!==g(),x=E.attributes!==void 0&&_(E.attributes);if(!U&&!x)return o;const D=!(o>(s??-1)),w=x?Object.keys(E.attributes).filter(y=>i[y]!==E.attributes[y]):[];U&&t.write(O),x&&(i={...i,...E.attributes}),o+=1,m!=="user"&&D&&(s=o);const C={source:m,version:o,changes:T,...U?{content:!0}:{},...w.length>0?{attributes:w}:{}};return a.forEach(y=>y(C)),o},markSaved(E,m){const T={serverId:r,savedVersion:s};m!==void 0&&(r=m),(s===null||E>s)&&(s=E),(T.serverId!==r||T.savedVersion!==s)&&a.forEach(O=>O({source:"system",version:o}))},markUnsaved(){c||s===null||s<o||(s=o-1,a.forEach(E=>E({source:"system",version:o})))},markReady(){d||u!==void 0||(d=!0,p.forEach(E=>E.resolve()),p.clear(),a.forEach(E=>E({source:"system",version:o})))},isReady:()=>d,markFailed(E){d||u!==void 0||c||(u=E,p.forEach(m=>m.reject(new Pe(E))),p.clear(),a.forEach(m=>m({source:"system",version:o})))},failure:()=>u,whenReady(){return d?Promise.resolve():u!==void 0?Promise.reject(new Pe(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((E,m)=>{p.add({resolve:E,reject:m})})},subscribe(E){return a.add(E),()=>a.delete(E)},isNew:()=>r===null,isDirty:()=>o>(s??-1),isDisposed:()=>c,dispose(){c=!0,p.forEach(E=>E.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),p.clear(),a.clear(),t.dispose()}}}var gc=500,vc=100,In=0;function ko(e,t){let n=0;for(const r of t){if(r.oldPosition>e||r.oldPosition===e&&r.oldLength>0)break;if(r.oldEnd>e)return r.newEnd;n=r.newEnd-r.oldEnd}return e+n}function Ec(e,t){const n={before:e?.before,after:t?.after};return n.before||n.after?n:void 0}function _c(e,t){const n=e?.after;return n?{...e,after:{start:ko(n.start,t),end:ko(n.end,t)}}:e}function bc(e,t={}){const n=t.groupIntervalMs??gc,r=t.maxSteps??vc,o=t.now??(()=>0);let s=[],i=0,a=In+=1,c=null,d,u,p,f=!1,g=!1,_=!1,E=!1;const m=new Set,T=()=>m.forEach(S=>S()),O=(S,I)=>{if(S.length){_=!0;try{e.mutate({changes:S},{source:I})}finally{_=!1}}},U=S=>O(S,"user"),x=S=>{const I=d?.from??o();if(g&&c!==null&&f===(d!==void 0)&&I>=c&&I-c<n){const k=s[i-1];s[i-1]={changes:Po(k.changes,S),selection:Ec(k.selection,u)}}else s=s.slice(0,i),s.push({changes:S,selection:u}),i=s.length,g=!0,s.length>r&&(s=s.slice(s.length-r),i=s.length,a=In+=1);c=d?.to??I,f=d!==void 0,T()},D=()=>{g=!1,c=null},w=S=>{if(!S.length)return;const I=s.length>i;if(I&&(s=s.slice(0,i)),i>0){const k=s[i-1];s[i-1]={changes:Po(k.changes,S),selection:_c(k.selection,S)}}D(),I&&T()},C=e.subscribe(({source:S,changes:I})=>{if(!(E||_||!I?.length)){if(S==="remote"){y();return}if(S!=="user"){w(I);return}x(I)}}),y=()=>{s=[],i=0,D(),a=In+=1,T()},N=(S,I)=>{p=I;try{U(S)}finally{p=void 0}},j=(S=!1)=>{if(i===0)return!1;const I=s[i-1],k=dc(I.changes);return Oo(e.getContent(),k)?(N(k,S?{kind:"undo",selection:I.selection?.before}:void 0),i-=1,D(),!0):(s=s.slice(0,i-1),i=s.length,D(),T(),!1)};return{recordAt(S,I,k){const M=d,v=u;d=S,u=k;try{return I()}finally{d=M,u=v}},activeMove:()=>p,canUndo:()=>i>0,canRedo:()=>i<s.length,undo(){j(!0)&&T(),D()},redo(){if(i>=s.length){D();return}const S=s[i];if(!Oo(e.getContent(),S.changes)){s=s.slice(0,i),D(),T();return}N(S.changes,{kind:"redo",selection:S.selection?.after}),i+=1,D(),T()},clear:y,closeGroup:D,applyWithoutHistory(S){const I=e.get().version;if(O(S,"system"),e.get().version===I){D();return}w(S)},getPast:S=>s.slice(0,i).reverse().slice(0,S).map(I=>I.changes),getFuture:S=>s.slice(i).reverse().slice(0,S).map(I=>I.changes),createSnapshot:()=>({stackId:a,index:i}),restoreSnapshot(S){if(S.stackId!==a||S.index>i)return!1;for(;i>S.index;)if(!j())return T(),!1;return T(),!0},subscribe(S){return m.add(S),()=>m.delete(S)},dispose(){E=!0,C(),m.clear(),s=[],i=0}}}var yc=["edit","move","resize","insert"];function Tn(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Sc(e){return typeof e=="string"?e:null}function wc(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Ic(e){return yc.includes(e)?e:null}function Tc(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:Sc(t.originId),changeId:Tn(t.changeId),rev:Tn(t.rev),baseRev:Tn(t.baseRev),expected:wc(t.expected),intent:Ic(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var Cn=e=>e.replace(/\r\n?/g,`
2103
+ `),Cc=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;function An(e){return typeof e=="string"&&Cc.test(e)}var Ac=class extends Error{kind;failed;constructor(e,t){super(`не удалось завести термы (${e}): ${t.map(({name:n})=>n).join(", ")}`),this.name="TermsFailedError",this.kind=e,this.failed=t}};function Dc(){return typeof navigator<"u"&&navigator.onLine===!1}function Pc(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 No(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 No(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 Dc()?!0:Pc(e).some(No)}var Lo=new WeakSet,Mo=new WeakMap;function xo(e){typeof e=="object"&&e!==null&&Lo.add(e)}function Rc(e,t){typeof e=="object"&&e!==null&&Mo.set(e,t)}function kc(e){return typeof e=="object"&&e!==null?Mo.get(e):void 0}function Nc(e){return e instanceof Dt||e instanceof wo||typeof e=="object"&&e!==null&&Lo.has(e)}function Lc(e){return e instanceof De||e instanceof zl||e instanceof Ac||Nc(e)}function Fo(e){return Bo(e)?.v2Error?.data?.code==="emails.mirror_unavailable"}function Bo(e){return e instanceof Error&&e.name==="EmailWriteFailedError"?e:void 0}function Mc(e){if(e instanceof De)return e.reason==="canvas-not-synced";if(Lc(e))return!1;const t=Bo(e);return t?(t.v2Error?.status??0)>0?Fo(e):!0:Oc(e)||Fo(e)}var jo="draft";function Ve(e){return e==null||e===""?jo:String(e)}function Rt(e){return e==null||e===""?`${Dn}${jo}`:`${Dn}${String(e)}`}var Dn="block:";function ee(e){return e?.startsWith(Dn)===!0}function Ge(e){return ee(e.sessionKey())?void 0:e.current()}function vb(e,t){}function Oe(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return Z(`show:gate:${e}`,{kind:"wait"}),t.then(o=>(Z(`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:So(o),...n},void 0),o})}var Eb=5e3,xc=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function Fc(e){const t=e?.trim()??"";if(!xc.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function rt(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function Pn(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function Bc(e,t={}){const n=rt((e??[]).filter(r=>r?.html?.trim()));return Pn(n,t)?n:null}function jc(e,t){const n=Date.parse(rt(e)?.modified??""),r=Bc(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 Uo(e,t,n){const r=rt((e??[]).filter(c=>c?.html?.trim())),o=Date.parse(r?.modified??""),s=Date.parse(rt((n??[]).filter(c=>c?.html?.trim()))?.modified??""),i=r&&Number.isFinite(o)&&(t===void 0||o>t)&&!(s>o),a=[Date.parse(rt(e??[])?.modified??""),t??NaN].filter(c=>Number.isFinite(c));return{autosave:i&&Pn(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function Uc({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var Ho=["recovery","plugin","rest"],Hc=["subject","preheader"];function $c(e){let t={},n;for(let o=Ho.length-1;o>=0;o--){const s=e.get(Ho[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 Hc){const s=r?.[o];typeof s=="string"&&s!==""&&(t={...t,[o]:s})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function kt(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?Cn(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 Ee(0,n,0,r)]}:{}},{source:"remote"})}var On=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=On(i.title)||On(i.subject)||On(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,projectCategories:i.projectCategories,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 Gc=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function Wc(e){const t={};for(const n of Gc)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function Yc(e,t,n,r,o,s){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,s==null?void 0:{wpId:s})}function be(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=be(o)),n[r]=o)}return n}function qc(e){return typeof e=="string"&&e.includes("autosave")}var Kc=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function $o(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!Kc.has(t))):{}}function We(e,t,n={}){e&&e.mutate({attributes:zc(e.get().attributes,t)},{source:n.source??"user"})}function zc(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function Rn(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function Xc(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function Vo(e){if(!e)return null;const t=$o(e);return e.common_styles!==void 0&&(t.common_styles=Xc(e.common_styles)),Rn(e.html,t)}function Go(e){return e?Rn(e.html,be($o(e))):null}var Jc=["common_styles","subject","preheader","meta"];function Wo(e){if(!e?.html?.trim())return null;const t={};for(const n of Jc)Qc(n,e[n])&&(t[n]=e[n]);return Rn(e.html,t)}function Qc(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 Zc=["modified","lock","wpId","secretHash"];function Yo(e){if(!e)return null;const t={};for(const n of Zc)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var ed=10,td=(e,t)=>e.key===t.key&&nd(e.serverId,t.serverId),nd=(e,t)=>e==null||e===t;function rd(e){return typeof e?.then=="function"}var qo=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},Ko=e=>{e.request.serverId!=null&&!Nt(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},od=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),Nt=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),zo=(e,t)=>t?.content!==void 0&&Uc({hasUnsavedUserEdit:Nt(e)})==="skip",Xo=(e,t)=>{for(const n of["subject","preheader"]){const r=t.attributes?.[n];typeof r=="string"&&(e.shownHeaders[n]=r)}},sd=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()}),id=(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))},ad=(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}},ld=e=>{const t=$c(e.reports),n=ad(e.lastMerged,t);e.lastMerged=t,e.broughtContent=Lt(t.content)??e.broughtContent,n&&(kt(e.document,n),Ko(e))},kn=(e,t)=>{if(!e.ready&&!Nt(e)){ld(e);return}e.broughtContent=Lt(t?.content)??e.broughtContent,kt(e.document,t)},Lt=e=>e===void 0?void 0:Cn(e),cd=(e,t)=>t.content===void 0||Lt(t.content)!==e.broughtContent||!Nt(e)?t:{...t,content:void 0},dd=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 ud(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 _=new Set,E=new Set,m=()=>_.forEach(h=>h()),T=(h,P)=>{if(!(h.closed||h.ready)){if(h.error!==void 0){h.document.markFailed(h.error),h.document.get().docId;return}Ko(h),h.ready=!0,h.document.markReady(),h.document.get().docId,[...h.reports.keys()]}},O=(h,P,H)=>{u?.(P.id,H),!(!P.required||h.closed)&&(h.error=H,h.emailReported=!0,h.document.get().docId,P.id,m())},U=(h,P)=>{const H=new Set(P.map(A=>A.id));P.forEach(A=>{A.watch&&h.watchers.push(A.watch(R=>h.closed?!1:h.ready&&(zo(h,R)||h.contentShown===!0&&R?.content!==void 0)?(h.document.get().docId,A.id,!1):(R&&h.reports.set(A.id,R),kn(h,R),R?.content!==void 0&&(h.showFill=void 0),!0)))});const Y=(A,R)=>{if(!h.closed){if(!A.required&&zo(h,R)){h.document.get().docId,A.id,A.loaded?.(!1);return}R&&(h.reports.set(A.id,R),A.id==="plugin"&&Xo(h,R)),A.required&&(h.emailReported=!0),kn(h,R),A.loaded?.(R!==null)}},V=()=>{H.size>0||h.closed||(qo(h),T(h,[]))},F=[];if(P.forEach(A=>{let R;try{R=A.load()}catch($){O(h,A,$),H.delete(A.id);return}if(rd(R)){F.push({id:A.id,required:A.required,load:()=>R,...A.loaded?{loaded:$=>A.loaded?.($)}:{}});return}Y(A,R),H.delete(A.id)}),F.length===0){V();return}h.timer=setTimeout(()=>{h.timer=void 0,p?.([...H]),h.document.get().docId,[...H],T(h,[...H])},n),h.timer.unref?.(),F.forEach(A=>{A.load().then(R=>Y(A,R)).catch(R=>{O(h,A,R)}).finally(()=>{H.delete(A.id),V()})})},x=async(h,P,H)=>{if(H==="snapshot"||H==="anchor")return;const Y=s?.();if(Y)return Y.resolve({project:P.project??h.project,tags:(h.tags??[]).map(V=>({name:V}))})},D=h=>{if(h.lock===!0&&i?.(h)===!1)return new De("locked");const P=h.tags?.length??0,H=h.emailtags?.length??0;if(Math.max(P,H)>ed)return new De("too-many-tags")},w=(h,P)=>{const H=h.document.get().serverId;P||H==null||(h.recoveryFacts={emailId:H,historyLoaded:!0,isRecovering:!1},ee(h.request.key)||(h.request={...h.request,key:Ve(H),serverId:H}))},C=(h,P,H)=>{if(h.closed||H?.id==null)return;const Y=h.document.get().serverId,V=Y!=null;V&&Y!==String(H.id)||(h.document.markSaved(P,String(H.id)),w(h,V),h.document.get().serverId,m())},y=async(h,P,H)=>{try{await h.document.whenReady()}catch(R){return h.saveError=R,h.saveFailures+=1,h.failedIntent=P,h.saveFailures,!1}if(h.closed)return!1;const Y=D(h.document.get().attributes);if(Y)return h.saveError=Y,h.saveFailures+=1,h.failedIntent=P,Y.reason,m(),!1;if(a&&(await a(dd(h)).catch(()=>{}),h.closed))return!1;if(c){try{await c()}catch(R){return h.saveError=R,h.saveFailures+=1,h.failedIntent=P,h.saveFailures,m(),!1}if(h.closed)return!1}if(od(h))return P==="snapshot"||(h.saveError=new De("empty-content"),h.saveFailures+=1,h.failedIntent=P,m()),!1;let V;try{V=await x(h.document.get().attributes,H,P)}catch(R){return h.saveError=R,h.saveFailures+=1,h.failedIntent=P,h.saveFailures,m(),!1}if(h.closed)return!1;const{payload:F,version:A}=Vc(h.document,H,V,P);h.document.get().docId;try{const R=h.document.get().serverId!=null,$=await Yc(r(),o(h.request.key),P,h.document.get().serverId,F,h.document.get().attributes.wpId);if(h.closed)return!0;let q;if(P==="snapshot"||P==="anchor"){const X=$?.modified!=null?Date.parse($.modified):NaN;q=Number.isFinite(X)?X:Date.now(),h.snapshotVersion=A,h.lastRevisionAt=q}else{h.document.markSaved(A,$?.id!=null?String($.id):void 0),h.savedContent=F.html;const X=$;kt(h.document,Yo(X&&{wpId:X.wpId,secretHash:X.secretHash})),h.broughtContent=Lt(d(F.html))}w(h,R),h.saveError=void 0,h.saveFailures=0,h.failedIntent=void 0,h.document.get().serverId,m();const Q={intent:P,serverId:h.document.get().serverId,created:!R,...q!==void 0?{revisionAt:q}:{}};return E.forEach(X=>X(Q)),!0}catch(R){return(P==="publish"||P==="materialize")&&kc(R)?.then($=>C(h,A,$)),h.saveError=R,h.saveFailures+=1,h.failedIntent=P,h.saveFailures,m(),!1}},N=h=>{h.closed=!0,h.watchers.forEach(P=>P()),h.watchers=[],qo(h),h.history.dispose(),h.document.dispose()},j=()=>{f&&(N(f),f=void 0)},S=()=>{g&&(N(g),g=void 0)},I=(h,P,H)=>{let Y=!1;P.show&&(h.show?.id!==P.show.id||h.show.token!==P.show.token)&&(h.show=P.show,Y=!0,{docId:h.document.get().docId,...P.show});const V=H==="show"?Go(P.patch):null;if(V){h.reports.set("plugin",V),Xo(h,V);const F=cd(h,V);kn(h,F),id(h,F)}Y&&m()},k=(h,P={})=>b(f,h,P),M=()=>f&&ee(f.request.key??"")?g:f,v=h=>({error:h?.saveError,failures:h?.saveFailures??0,saving:h?.saving===!0,failedIntent:h?.failedIntent}),b=(h,P,H)=>!h||h.closed||P==="materialize"&&h.document.get().serverId!=null?Promise.resolve(!1):h.saving?P==="snapshot"||P==="materialize"?Promise.resolve(!1):(h.inFlight??Promise.resolve(!1)).then(()=>b(h,P,H)):(h.saving=!0,m(),h.inFlight=y(h,P,H).finally(()=>{h.saving=!1,h.inFlight=void 0,f===h&&!h.closed&&m()}),h.inFlight),B=(h,P="open",H=!1)=>{if(f&&!f.closed&&P!=="new"&&td(f.request,h))return I(f,h,P),f.document;j(),H||S();const Y=mc({createBuffer:()=>ac(""),serverId:h.serverId??null}),V={request:h,show:h.show,document:Y,history:bc(Y,{now:Date.now}),watchers:[],userTouched:new Set,shownHeaders:{},saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return f=V,V.watchers.push(sd(V)),Y.get().docId,h.serverId,U(V,t(h,{publishRecoveryFacts(F){V.closed||(V.recoveryFacts=F,m())},readShownContent:()=>V.closed?null:V.document.getContent(),readWpId:()=>V.closed?void 0:V.document.get().attributes.wpId,readWpIdOutlook:()=>{if(V.closed)return"gone";const{wpId:F}=V.document.get().attributes;return F??(V.emailReported?"absent":"pending")}})),m(),Y},G=(h,P,H)=>({key:ee(h)?h:Rt(h),serverId:P?.id!=null?String(P.id):null,email:P,show:H});return{openWith:B,open:(h,P={})=>B({key:Ve(h),serverId:h,email:P.email,patch:P.patch,show:P.show},"open"),openDraft:(h,P={})=>B({key:Ve(void 0),serverId:null,email:h,patch:P.patch,show:P.show},"open"),startNewDraft:(h,P={})=>B({key:Ve(void 0),serverId:null,email:h,patch:P.patch,show:P.show},"new"),reload:(h,P={})=>B({key:Ve(h),serverId:h,email:P.email,patch:P.patch,show:P.show},"new"),openBlock:(h,P,H)=>B(G(h,P,H),"open"),reloadBlock:(h,P,H)=>B(G(h,P,H),"new"),openBlockOver:(h,P)=>{const H=G(h,P);return f&&!f.closed&&f.request.key===H.key?f.document:(f&&!f.closed&&!ee(f.request.key)&&(S(),g=f,f=void 0),B(H,"open",!0))},resumeSuspended:()=>{if(g)return j(),f=g,g=void 0,m(),f.document},hasSuspended:()=>!!g,suspendedDocument:()=>g?.document,show:(h,P)=>{const H=f;if(!(!H||H.closed))return B({...H.request,patch:h,show:P},"show")},current:()=>f?.document,noteServerFacts:({serverId:h,block:P},H)=>{const Y=f;!Y||Y.closed||Y.request.serverId!==h||ee(Y.request.key??"")===P&&kt(Y.document,Yo(H))},save:k,saveEmail:(h,P={})=>b(M(),h,P),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 E.add(h),()=>E.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 P of[f,g])P?.showFill?.showId===h&&(P.showFill=void 0)},sessionKey:()=>f?.request.key,openError:()=>f?.error,subscribe(h){return _.add(h),()=>_.delete(h)},close(){!f&&!g||(j(),S(),m())}}}var Nn=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function Ln(e){if(e instanceof Nn)return e.reason;if(e instanceof Pe)return Ln(e.reason)}function fd(e){const t=e instanceof Pe?e.reason:e;return t instanceof Nn&&t.reason==="unavailable"&&t.cause instanceof TypeError}function pd(e){const t=Ln(e);return t!==void 0&&t!=="unavailable"}function hd(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new Nn("not-found");return Vo(n)}}}var Jo=l.createIdentifier$1("EmailPort");function md(e){return e.getInstance(Jo)}function gd(e,t){e.inject(Jo,t)}var Qo=l.createIdentifier$1("documentSession.restEmailPortFactories");function Zo(e){return e.getInstance(Qo)!==void 0}function Re(e){const t=e.getInstance(Qo);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var vd=l.createIdentifier$1("EmailTermsResolver");function Ed(e){return e.getInstance(vd)}var es=l.createIdentifier$1("EmailHistoryPort"),_d=l.createIdentifier$1("BlockHistoryPort");function ts(e){return e.getInstance(_d)}function ns(e){return e.getInstance(es)}function bd(e,t){e.inject(es,t)}var yd="em_autosave_pending",_b=6e4;function Mt(e){return`${yd}_${e}`}function Sd(e,t){try{sessionStorage.setItem(Mt(e),JSON.stringify(t))}catch{}}function rs(e){try{const t=sessionStorage.getItem(Mt(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(Mt(e)),null):n}catch{return null}}function ot(e){try{sessionStorage.removeItem(Mt(e))}catch{}}var wd=2e3,Id=5e3,Td=5,Cd=5e3,Ad=4;function Dd(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function Pd(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 Mn(e,t){return Pn(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function Od({emailId:e,readAutosave:t,revisionServiceEnabled:n,readShownContent:r,onFacts:o,onLate:s,onError:i,pageLoadTs:a=Dd()}){let c=null,d=!1,u=!1,p=0,f={emailId:e,historyLoaded:!1,isRecovering:!1},g=null;const _=new Promise(I=>{g=I}),E=I=>{f={...f,...I},o(f)};let m;const T=I=>{p+=1,E({applied:{phase:I,seq:p}})},O=()=>{c?.timer&&clearTimeout(c.timer),c=null},U=I=>{if(!u){if(g){const k=g;g=null,k(I),m=I.revision?I.phase:void 0;return}s(I)&&I.revision&&T(I.phase)}},x=()=>{if(!c||u)return;const I=c.phase==="fast",k=I?wd:Cd,M=I?Td:Ad;c.timer=setTimeout(()=>{const v=c;if(!(!v||u)){if(v.attempts+=1,y(),I&&v.attempts>=M){const{pending:b}=v;ot(e),E({isRecovering:!1}),U({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,x();return}if(!I&&v.attempts>=M){ot(e),O(),E({isRecovering:!1}),d=!0;return}x()}},k),c.timer.unref?.()},D=I=>{c={phase:"fast",attempts:0,pending:I,timer:null},E({isRecovering:!0}),x()},w=I=>{if(u)return;if(E({historyLoaded:!0,latestRevisionAt:I.latestAt!==void 0&&Number.isFinite(I.latestAt)?I.latestAt:void 0}),n&&c){const v=Mn(I,c.pending.sentAt);if(!v)return;const b=c.phase==="fast"?"found":"bg";ot(e),O(),E({isRecovering:!1}),d=!0,U({revision:v,phase:b});return}if(d)return;const k=n?rs(e):null,M=k&&(k.sentAt<a||!Pd(k.html,r()))?k:null;if(M){const v=Mn(I,M.sentAt);if(v){ot(e),d=!0,U({revision:v,phase:"found"});return}D(M);return}d=!0,U({revision:Mn(I),phase:"normal"})},C=I=>{u||(i?.(I),f.historyLoaded||(E({historyLoaded:!1,latestRevisionAt:void 0}),S()),!c&&U({revision:null,phase:"normal"}))},y=()=>t(e).then(w).catch(C);let N,j=!1;const S=()=>{j||c||u||(j=!0,N=setTimeout(()=>{N=void 0,!u&&!f.historyLoaded&&y()},Id))};return y(),{verdict:()=>_,confirmVerdict(I){const k=m;m=void 0,I&&k!==void 0&&!u&&T(k)},dispose(){u=!0,N!==void 0&&(clearTimeout(N),N=void 0),O()}}}var os=2e4,Rd=50;async function kd(e,t){const n=Date.now()+os;for(;;){const r=e();if(typeof r=="number")return r;if(r!=="pending")return r==="gone"?"gone":void 0;if(Date.now()>=n)return;await new Promise(o=>setTimeout(o,Rd))}}function Nd({port:e,revisionServiceEnabled:t,emailId:n,wpId:r,wpIdOutlook:o,readShownContent:s,onFacts:i}){let a=null;const c=Od({emailId:n,readAutosave:async d=>{if(!r)return e.readAutosave(d);const u=e.requiresWpId&&o?await kd(o,d):r();return u==="gone"?{autosave:null}:e.readAutosave(d,{wpId:u})},revisionServiceEnabled:t,readShownContent:s,onFacts:i,onLate:({revision:d,phase:u})=>{const p=Wo(d);return a?.(p)??!1},onError:d=>{d instanceof Error&&d.message}});return{id:"recovery",load:()=>c.verdict().then(({revision:d})=>Wo(d)),loaded(d){c.confirmVerdict(d)},watch(d){return a=d,()=>{a=null,c.dispose()}}}}function ss(e,t){return{readRevisions:(n,r,o)=>t.readRevisions(n,r,o),readAutosave:(n,r)=>t.readAutosave(n,r),async saveAutosave(n,r,o){Sd(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const s=await t.saveAutosave(n,r,o);return await e.saveAutosave(n,r),s}}}function Ld(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),(rs(n)?.sentAt??Number.POSITIVE_INFINITY)<=o&&ot(n),s&&{...s,id:n}}}}var is=l.createIdentifier$1("CurrentUser"),as={};function xn(e){return e.getOrCreateInstance(is,()=>de(as))}function ls(e){return e?.getInstance(is)?.get()??as}var cs=l.createIdentifier$1("HeadlessMode");function ds(e){return e.getOrCreateInstance(cs,()=>de(!1))}function Md(e){return e?.getInstance(cs)?.get()??!1}var xd=l.createIdentifier$1("HiddenMount");function Fd(e){return e.getOrCreateInstance(xd,()=>de(!1))}function Bd(e){if(!e)return!1;try{return!!l.decodeJwt(e).data?.act_as}catch{return!1}}function jd(e){return Bd(e?.getInstance(l.COOKIE_MANAGER_ID)?.get(l.APP_COOKIES.em_token))}function us(e){return e?.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function xt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Ud(e,t){return t.modeDefaults(xt(e,t.fallbackMode))}function fs(e,t){const n=xt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function ps(e,t){const n=xt(e,t),r=e.user?.advancedConfigs?.[n],o=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...o}}function Hd(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 Vd(e){return l.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function Gd(e){return l.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function Wd(e){return l.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Yd(e,t){return[e.base,Ud(e,t),e.profile,e.serverSide,fs(e,t.fallbackMode),e.local,e.user,ps(e,t.fallbackMode)]}function Fn(e,t){const n=Yd(e,t),r=l.mergeShallowConfigLayers(n),o=Hd(n);o!==void 0&&(r.fileManager=o);const s=$d(n);s!==void 0&&(r.resourceProxy=s);const i=Vd(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const a=Gd(n);a!==void 0&&(r.backendProxy=a);const c=Wd(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function qd(e,t,n){const r=fs(e,n),o=ps(e,n);return l.pickKey([o,e.user,r,e.serverSide],t)}var Kd=1.5;function zd(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<=Kd*e.autosaveTimeoutMs?"none":"revision"}var bb=5,yb=3;function Xd(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:o}=e,s=e.readFailures??(()=>0),i=e.readFailureRetryable??(()=>!0);let a;const c=C=>a!==void 0&&a.version===C.get().version?s()-a.failuresAtStart:0,d=C=>{const y=c(C);if(y<=0)return!1;const N=n().retryMaxAttempts??5;return!i()||y>N},u=()=>{const{autosaveTimeoutMs:C,retryIntervalMs:y}=n(),N=t();return N!==void 0&&c(N)>0&&y!==void 0&&y>0?y:C},p=C=>C.isNew()&&s()>=3,f=()=>{const C=t();if(!C||C.isDisposed()||d(C))return"none";const{latestRevisionAt:y,snapshotVersion:N,...j}=n(),S=Date.now(),I=zd({...j,isDirty:C.isDirty(),isNew:C.isNew(),isReady:C.isReady(),latestRevisionAgeMs:y!=null&&y<=S?S-y:void 0,isSnapshotSent:N!=null&&N===C.get().version});return I==="create"&&p(C)?"none":I},g=()=>{const C=t();if(!C||C.isDisposed()||p(C)||d(C)||n().isHeadless)return!1;if(!C.isDirty())return C.isNew();const{snapshotVersion:y}=n();return!(y!=null&&y===C.get().version)};let _,E,m,T,O=!1;const U=()=>{E=void 0;const C=t();if(!C||C.isDisposed())return;if(C.get().docId!==_){x();return}const y=f();y!=="none"&&a?.version!==C.get().version&&(a={version:C.get().version,failuresAtStart:s()}),y==="create"?r():y==="revision"?o():g()&&(_=C.get().docId,E=setTimeout(U,u()))},x=()=>{const C=t();O||!C||E!==void 0||f()==="none"&&!g()||(_=C.get().docId,E=setTimeout(U,u()))},D=C=>{C.source==="user"&&E!==void 0&&(clearTimeout(E),E=void 0),x()},w=()=>{const C=t();C!==m&&(T?.(),m=C,a=void 0,T=C?.subscribe(D),E!==void 0&&(clearTimeout(E),E=void 0))};return w(),x(),{refresh:()=>{O||(w(),x())},stop:()=>{O=!0,T?.(),T=void 0,m=void 0,E!==void 0&&(clearTimeout(E),E=void 0)}}}var hs=l.createIdentifier$1("documentSession.autosaveUiFacts"),ms={isUserBusy:!1,saveContext:{}};function Jd(e){return e.getOrCreateInstance(hs,()=>de(ms))}function Bn(e){return e?.getInstance(hs)?.get()??ms}function gs(e){return Bn(e).saveContext.fallbackTitle||"Untitled email."}var Qd=1e4,Zd=3e4;function eu(e,t){const n=u=>{const p=e.getInstance(l.CONFIG_SOURCE_ID)?.layers?.(),f=p?qd(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=ee(t.sessionKey()),g=t.recoveryFacts(),_=g?.emailId===p?g:void 0,E=t.revisionFacts(),m=_?.latestRevisionAt,T=E?.lastRevisionAt,O=ls(e).profile;return{isInited:f||u?.get().attributes.is_inited===!0,isEnabled:!!O?.autosaves&&!jd(e),isHistoryLoaded:_?.historyLoaded===!0,isUserBusy:Bn(e).isUserBusy,isHeadless:Md(e),autosaveTimeoutMs:us(e).autosaveTimeout||Qd,latestRevisionAt:m!==void 0||T!==void 0?Math.max(m??0,T??0):void 0,snapshotVersion:E?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??Zd,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},o=()=>{const u=Bn(e).saveContext;return{...u,project:u.project??t.current()?.get().attributes.project,fallbackTitle:gs(e)}},s=Xd({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>Mc(t.saveState().error),onCreate:()=>{ee(t.sessionKey())||t.save("materialize",o())},onRevision:()=>{t.save("snapshot",{project:o().project})}}),i=t.subscribe(s.refresh),a=xn(e).watch(()=>s.refresh()),c=Jd(e).watch(()=>s.refresh()),d=ds(e).watch(()=>s.refresh());return()=>{i(),a.dispose(),c.dispose(),d.dispose(),s.stop()}}var vs=12e3;function le(e){return e.getOrCreateInstance(bn,()=>{const t=ud({resolveAdapters:(r,o)=>ru(r,e,o),resolveWritePort:()=>Es(e),resolveHistoryPort:r=>ee(r)?bs(e):_s(e),resolveTerms:()=>Ed(e),canEdit:r=>Vl(e,r),notifyBeforeSave:Kl(e),awaitCanvasSynced:tc(e),savedEchoForm:r=>{const o=Ie(e);return o.toEditorForm(o.toOutputForm(r))},timeoutMs:vs,onAdapterError:(r,o)=>{o instanceof Error&&o.message;const s=pd(o),i=fd(o);nt(o,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(s),network_failure:String(i)},level:s||i?"warning":"error"})},onTimeout:r=>{}}),n=eu(e,t);return e.getInstance(l.DISPOSABLE_ID)?.addDispose(n),t})}function ke(e){return e?.getInstance(bn)}function Es(e){const t=md(e);return t?jn(e)?Ld(t,Re(e).email(e)):t:Re(e).email(e)}function tu(e){return ns(e)!==void 0||Zo(e)}function _s(e){const t=ns(e);return t?jn(e)?(Z("port:history:server-backed"),ss(t,Re(e).history(e))):(Z("port:history:integrator"),t):(Z("port:history:rest (порт не зарегистрирован)"),Re(e).history(e))}function bs(e){const t=ts(e);return t?jn(e)?(Z("port:block-history:server-backed"),ss(t,Re(e).blockHistory(e))):(Z("port:block-history:integrator"),t):(Z("port:block-history:rest (порт не зарегистрирован)"),Re(e).blockHistory(e))}function nu(e){return ts(e)!==void 0||Zo(e)}function jn(e){return mo(e)}function ru({email:e,patch:t,serverId:n,key:r},o,s){const i=[];e?i.push({id:"rest",load:()=>Vo(e),required:!0}):n&&i.push(hd(Es(o),n)),t&&i.push({id:"plugin",load:()=>Go(t)});const a=ee(r);return nc(n)&&(a?nu(o):tu(o))&&i.push(Nd({port:a?bs(o):_s(o),revisionServiceEnabled:mo(o),emailId:n,...a?{}:{wpId:()=>s.readWpId(),wpIdOutlook:()=>s.readWpIdOutlook()},readShownContent:()=>s.readShownContent(),onFacts:c=>s.publishRecoveryFacts(c)})),i}function ou(e){const t=le(e),n=se(e).addListener(l.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{Ge(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function su(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function iu(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 su(c)?c:void 0}catch{return}}}}var Ne={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function au(e){const t={maxBytes:e.maxBytes??Ne.maxBytes,maxImageBytes:e.maxImageBytes??Ne.maxImageBytes,ttlMs:e.ttlMs??Ne.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 _=(async()=>{try{const E=await e.load(p);return E?u(p,E):s.failures+=1,E}catch{s.failures+=1;return}finally{o.delete(p)}})();return o.set(p,_),_},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 lu=["emcdn.ru","scr.emcdn.ru"];function cu(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 du(e,t){const n=(r,o)=>{const s=new Set(o?t:[]);for(const i of r){const a=cu(i);a&&s.add(a)}return[...s]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function uu(e){const t=e??{},n=t.isPlugin!==!0?lu:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Ne};const o=r===!0||r===void 0?{}:r;return{enabled:o.enabled!==!1,sourceHosts:du(o.sourceHosts,n),maxBytes:o.maxBytes??Ne.maxBytes,maxImageBytes:o.maxImageBytes??Ne.maxImageBytes,ttlMs:o.ttlMs??Ne.ttlMs}}function fu(e){const t=se(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=()=>uu({...n?.get(),isPlugin:!0});let o=r();const s=iu({sourceHosts:()=>o.sourceHosts}),i=au({load:E=>s.load(E),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 E=r(),m=JSON.stringify(E)!==JSON.stringify(o);o=E,i.configure(E),E.enabled||i.clear(),m&&t.isInited()&&a()}),u={asked:0,served:0,refused:0},p=[],f=(E,m)=>(u.refused+=1,p.push({url:E,reason:m}),p.length>20&&p.shift(),{refused:!0}),g=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:o,counters:{...u},refusals:[...p],store:i.stats()})}),_=t.addListenerAsync(l.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async E=>{const m=E?.url??"";if(u.asked+=1,!o.enabled||!m)return f(m,"disabled");if(!s.accepts(m))return f(m,"host");E.fresh&&i.forget(m);const T=await i.get(m);return T?(u.served+=1,{blob:T}):f(m,"load-failed")});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),d?.dispose(),_.dispose(),i.clear(),delete g.__emmCanvasImages__})}var pu=2e3;function hu(e){const t=se(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))&&(nt(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d=!0,t.holdPort(i))},pu);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 mu=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function gu(e){return mu.test(e)||e.indexOf("//")===0}function Ft(e){return e&&(e.endsWith("/")?e:`${e}/`)}function vu(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function ys(e,t){const n=e==null||e===""?"./":String(e);if(gu(n))return Ft(n);const r=t??vu();if(!r)return Ft(n);try{return Ft(new URL(n,r).href)}catch{return Ft(n)}}function Eu(){return typeof __emailmaker__<"u"&&__emailmaker__?.publicPath?ys(__emailmaker__.publicPath):ys("/")}var _u=()=>"",bu=()=>"ee1618fa";function yu(e,t){const n=new URL(e);return n.hostname!=="localhost"||t.hostname==="localhost"?e:(n.hostname=t.hostname,n.toString())}function Ss(e){const t=e?"iframe-eblock":"iframe",n=_u();if(n){const s=yu(n,window.location).replace(/\/?$/,"/");return ao(`${s}${t}.html`,et())}const r=bu(),o=`${Eu().replace(/\/?$/,"/")}iframe/`;return ao(`${o}${t}${r?`.${r}`:""}.html`,et())}var ws="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Un(e){return/^file:/i.test(String(e||"").trim())}function Su(e){return Un(e)?`${ws} allow-same-origin`:ws}var Sb="em:module-body",wu="em:module-body-ack";function Iu(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 Hn(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 Tu(e){const t=Hn(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function Cu(e,t){const n=Hn(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(o=>e[o]?.file).filter(o=>!!o):[]}function Au(e,t){const n=Hn(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 Du=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function Pu(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&Du.test(t[t.length-2])}async function Ou(e,t){const n=Pu(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 Ru(e){const t=new Map,n=(r,o)=>{const s=Iu(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 ye;function ku(e){try{return Un(new URL(e,window.location.href).href)}catch{return Un(window.location.href)}}function Is(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 Nu=()=>Promise.resolve(void 0);function Ts(){const e=Ss(!1);if(!ku(e)){if(!ye||ye.canvasSrc!==e){const t=Is(e)?Ou:Nu;ye={canvasSrc:e,store:Ru({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return ye.store}}async function Lu(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(Cu(o,e))}catch{}}function $n(e){const t=Ts();if(!t||!ye||ye.warmed||!Is(ye.canvasSrc))return;ye.warmed=!0;const{canvasSrc:n}=ye,r=Tu(n);r&&t.warm([r],e);const o={"js/iframe-eblock.js":["js/elMarkupHelper.Buog1r0c.js"],"js/iframe.js":["js/elMarkupHelper.Buog1r0c.js"],"js/darkreader.CLd5EML2.js":[],"js/elMarkupHelper.Buog1r0c.js":[],"js/rules.CnnzdMsj.js":[],"js/typograf.all.Mun9CrLC.js":[]};o?t.warm(Au(o,n),e):Lu(n,s=>t.warm(s,e))}function Mu(e){const t=Ts();if(!t)return;$n();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:wu,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,xu=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,qe=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Cs=/display:\s*none\s*!important/gi,Fu=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Bu=/\s*height\s*:\s*100%\s*!important\s*;?/gi,ju=/height\s*:\s*100%\s*!important/i,Uu=[".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 Cs.lastIndex=0,(e.match(Cs)||[]).length}function As(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=Uu.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){qe.lastIndex=0;for(const t of e.matchAll(qe))if(As(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Vu(e){let t=!1;return qe.lastIndex=0,{html:e.replace(qe,n=>As(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Gu(e){return Ye.lastIndex=0,Ye.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||$u(e)}function Wu(e){if(!Gu(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(xu,""),t=!0);const r=Vu(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Yu(e){return!e||!ju.test(e)?e:(qe.lastIndex=0,e.replace(qe,t=>t.replace(Fu,(n,r,o,s)=>`${r}${o.replace(Bu,"")}${s}`)))}function Ds(e){const t=Wu(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:Yu(t.html),hasBrowserExtensionArtifacts:t.found}}function st(e){return e?.getContent()??""}function Ps(e,t){e?.mutate({content:Cn(t)},{source:"remote"})}function Bt(e){return l.createIdentifier$1(e)}function ce(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter)}function K(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter).event}function jt(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var qu=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 Ku(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 zu(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 qu(t)))},t)),n?.addEventListener("abort",d)}))}var Xu=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 Ju(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 Xu(n,t)))},t),e.then(c=>{a(()=>r(c))},c=>{a(()=>o(c))})})}var Qu=2,it=Symbol("sandbox:frame-replaced");function Os(e){return e===it}function Le(e,t,n,r,o,s,i){const a=`sandbox:${t}`,c=s?.getSandboxTimeoutMs(t)??yn[t],d=()=>{let _=Ju(e.sendAsync(n,r),c,a);return _=l.raceWithAbortSignal(_,s?.signal),Oe(a,_,o)};if(t==="INIT_START"&&Ku(e)){const _=s?.getSandboxReadyTimeoutMs()??2e4,E=e,m=T=>{const O=zu(E,_,s?.signal);return Oe("sandbox:INIT_START:ready-wait",O,o).then(()=>{if(!i||T<=0)return d();const U=i.getGeneration();let x;const D=new Promise((C,y)=>{x=i.onChange(()=>{i.getGeneration()!==U&&y(it)})}),w=d();return w.catch(()=>{}),Promise.race([w,D]).finally(()=>x?.()).catch(C=>{if(C!==it)throw C;return{...o},m(T-1)})})};return m(Qu)}if(!i)return d();const u=i.getGeneration();let p;const f=new Promise((_,E)=>{p=i.onChange(()=>{i.getGeneration()!==u&&E(it)})}),g=d();return g.catch(()=>{}),Promise.race([g,f]).finally(()=>p?.()).catch(_=>{throw _===it&&{...o},_})}var Rs="self-init:";function Zu(e){return e.startsWith(Rs)}function Vn(e,t){const n=e.getActiveShowRequest();return Zu(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function ef(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()?st(e.readDocument()):s,d=()=>Ie(e.container).editorPolicy,u=()=>e.readEmail(),p=()=>{const _=u();return{..._,id:e.isTemplate()||_.isNew?void 0:_.id,html:c()}};let f=!1;const g={readContent:c,publicEmail:p,sendInitStart:()=>Le(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:u().renderGuid},void 0,r()),sendInited:()=>Le(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:u().renderGuid},void 0,r(),o()),async sendContent(){const _=u(),{html:E,hasBrowserExtensionArtifacts:m}=Ds(_?.html||"");m&&e.events.browserExtensionDetected(),Ps(e.readDocument(),E),s=E,a(_.renderGuid),await Le(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,jt(c(),_.renderGuid,d(),e.readDocument()?.get().version),{guid:_.renderGuid,emailId:_.id??null},r(),o())},refreshContent:()=>(a(u().renderGuid),Le(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,jt(c(),u().renderGuid,d(),e.readDocument()?.get().version),void 0,r(),o())),sendPreheader:async()=>{const _=u();if(_.preheader!==void 0)return Le(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 Le(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:(_,E)=>e.noteFilled?.(_,E),contentSent:()=>i,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(p()),fireInit(_,E){if(!Vn(t(),_)){t().getActiveShowRequest()?.showId;return}const m=u();m.id,m.renderGuid,t().completeShow(_);const T=e.readDocument();We(T,{is_inited:!0},{source:"system"});const O=()=>{const x=p();E&&(x.reset=!0);const D=e.events.inited(x);return E||(f&&g.fireEmailChanged(),f=!0),D};if(!T||T.isReady())return O();const{docId:U}=T.get();return T.whenReady().then(()=>e.readDocument()?.get().docId===U?O():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(p())},fireContentChanged(){e.events.contentChanged(c())}};return g}var tf=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}},nf=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 tf(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 rf(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function of(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=bo(e),n=yo(e),r=Wl(e.sandbox);t<n+r}var ks=class{_controller=new AbortController;_externalSignalDisposable=new l.Disposable;_sessionChangeListeners=new Set;_showRegistry=new nf;_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 bo(this._timeouts)}getSandboxTimeoutMs(e){return _o(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return yo(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=rf(this._timeouts,e.timeouts),of(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)})}},Gn=(()=>{const e=new ks;return e.configure({}),e})();function Me(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 xe(e){return!e||e==="none"}function sf(e){const t=e.contain??"",n=e.willChange??"";return!xe(e.transform)||!xe(e.perspective)||!xe(e.filter)||!xe(e.backdropFilter)||!xe(e.translate)||!xe(e.rotate)||!xe(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function Ns(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 af(e){const t=[],n=document.documentElement,r=Ns(getComputedStyle(n)),o=r.x||r.y;let s="none";const i=getComputedStyle(e).position;(i==="absolute"||i==="fixed")&&(s=i);for(let a=Me(e);a&&a!==n;a=Me(a)){const c=getComputedStyle(a),d=s==="none"||sf(c)||s==="absolute"&&!!c.position&&c.position!=="static",u=a===document.body&&!o;if(d){s="none";const p=u?{x:!1,y:!1}:Ns(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 Ls(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 Ut(e){return Number.parseFloat(e)||0}function Wn(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=Ls(e),o=Ut(n.borderLeftWidth),s=Ut(n.borderTopWidth),i=Ut(n.borderRightWidth),a=Ut(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 lf(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(Wn(s.node),s.x,s.y)),n&&o(Wn(n),!0,!0),r}var Yn={originX:0,originY:0,scaleX:1,scaleY:1};function Ht(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 Ms(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 xs(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 cf=1e3;function df(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()+cf,a()},d=[window],u=[document.documentElement];for(let m=t;m;m=Me(m)){const T=m.getRootNode();T instanceof ShadowRoot&&!d.includes(T)&&(d.push(T),u.push(T))}const p=[["scroll",a],["load",a],["transitionrun",c],["transitionend",a],["transitioncancel",a],["animationstart",c],["animationend",a],["animationcancel",a]];d.forEach(m=>p.forEach(([T,O])=>m.addEventListener(T,O,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const f=typeof MutationObserver=="function"?new MutationObserver(m=>{m.some(T=>!n.contains(T.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 _=[];return{schedule:a,observe:m=>{!g||m.length===_.length&&m.every((T,O)=>T===_[O])||(g.disconnect(),_=m,m.forEach(T=>g?.observe(T)))},dispose(){s=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),d.forEach(m=>p.forEach(([T,O])=>m.removeEventListener(T,O,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),f?.disconnect(),g?.disconnect()}}}var uf="pluginZoom",ff=/^(?:ant|vscode|monaco|docs)-/;function pf(e){return ff.test(e)}function hf(){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 mf=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function gf(){return mf}var vf=new Set;function Ef(e,t,n=vf){return e.startsWith(`${t}-`)?!1:!pf(e)&&!n.has(e)}function _f(e,t){return`--${t}-${e}`}function Fs(e){const t=hf();return Ef(e,t,gf())?_f(e,t):`--${e}`}function bf(e,t){const n=Fs(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function Bs(e,t){return bf(e,t)}var js=300,Us=15e3,yf=5e3,Hs="em-canvas-busy-style";function Sf(){if(document.getElementById(Hs))return;const e=document.createElement("style");e.id=Hs,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var wf="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 If(e){const t=Bs("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(Fs("colorPrimary")).trim()||t}function $s(e){Sf();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",wf),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:${If(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 Cf(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&&!xs({left:s.left,top:s.top,width:s.width,height:s.height},o)){const i=Ht(o,Ms(s,Ht(o,Yn),Yn));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($s(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function qn(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($s(e))},js);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var Af=8e3;function Df(){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 Pf(e,t){for(let n=Me(e);n;n=Me(n)){const r=getComputedStyle(n),o=r.overflowX!=="visible"||r.overflowY!=="visible",s=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(i=>Ke(i)>0);if(o&&s)return n;if(n===t)return null}return null}function Ke(e){return Number.parseFloat(e)||0}function $t(e,t){return Math.abs(e-t)<=1}function Of(e){const t=getComputedStyle(e),n=Ke(t.borderTopWidth),r=Ke(t.borderRightWidth),o=Ke(t.borderBottomWidth),s=Ke(t.borderLeftWidth),i=(a,c,d)=>Math.max(0,Ke(a)-Math.max(c,d));return{...Wn(e),radii:[i(t.borderTopLeftRadius,n,s),i(t.borderTopRightRadius,n,r),i(t.borderBottomRightRadius,o,r),i(t.borderBottomLeftRadius,o,s)]}}function Rf(e,t){const n=$t(t.top,e.top),r=$t(t.bottom,e.bottom),o=$t(t.left,e.left),s=$t(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 kf(e,t,n,r,o,s){const i=n.readyTimeoutMs??Af,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",Bs(uf,"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,_,E,m,T;const O=()=>{clearTimeout(T),T=setTimeout(()=>{g||(g=!0,E?.(new Error(`[canvas] ${e}: документ не загрузился за ${i} мс`)))},i)},U=()=>p?(m=Promise.resolve(),g=!0,m):(g=!1,m=new Promise((F,A)=>{_=F,E=A}),O(),m),x=()=>{if(clearTimeout(T),p=!0,g){m=Promise.resolve();return}g=!0,n.mark?.("loaded"),_?.()};d.addEventListener("load",x),u.addDispose(()=>{clearTimeout(T),d.removeEventListener("load",x)});let D;const w=()=>{D??=n.bindResizer?.(d)},C=()=>{D?.dispose(),D=void 0};let y=null,N=null,j,S=Yn,I="",k="",M=0;const v=F=>{const A=JSON.stringify(F);return A===I?!1:(I=A,a.style.visibility=F.visibility,a.style.left=`${F.css.left}px`,a.style.top=`${F.css.top}px`,a.style.width=`${F.css.width}px`,a.style.height=`${F.css.height}px`,a.style.borderRadius=F.radius,d.style.width=F.elementWidth>0?`${F.elementWidth}px`:"100%",d.style.transform=F.shiftX!==0?`translate(${F.shiftX}px, ${F.shiftY}px)`:`translateY(${F.shiftY}px)`,!0)};let b=!1;const B=()=>{if(!y)return I="",a.style.visibility="hidden",d.removeAttribute("id"),!1;n.elementId&&(d.id=n.elementId);const F=y.getBoundingClientRect(),A=af(y),R=N?.isConnected?N:null;j?.observe([y,d,...A.map(re=>re.node),...R?[R]:[]]);const $=lf(F,A,R),q=Math.max(0,$.right-$.left),Q=Math.max(0,$.bottom-$.top),X=getComputedStyle(y).visibility==="visible",ie=q<=0||Q<=0,me=ie?{left:$.left,top:$.top,right:$.left,bottom:$.top}:$,L=ie?null:Pf(y,R??A[0]?.node??null),J=L?Rf(Of(L),me):"",z=re=>v({visibility:X&&!b?"":"hidden",css:Ht(me,re),elementWidth:F.width/re.scaleX,shiftX:(F.left-me.left)/re.scaleX,shiftY:(F.top-me.top)/re.scaleY,radius:J});let fe=z(S);if(!ie){const re=a.getBoundingClientRect();re.width>0&&!xs({left:re.left,top:re.top,width:re.width,height:re.height},me)&&(S=Ms(re,Ht(me,S),S),fe=z(S)||fe)}return fe},G=()=>{if(!y)return!1;let F=B();const A=d.getBoundingClientRect().height;A>0&&A!==M&&(M=A,y.style.height=`${A/Ls(y).y}px`,F=!0);const R=getComputedStyle(y).pointerEvents;return R!==k&&(k=R,a.style.pointerEvents=R),F},h=()=>{j?.dispose(),j=void 0},P=F=>{j=df({slot:F,own:a,measure:G,onDetached:h})};let H=[];const Y=(F,A)=>{if(N=A,F&&H.length>0){const R=H;H=[],R.forEach($=>$())}if(F===y){F&&!j&&P(F),G();return}if(h(),y&&y.style.removeProperty("height"),I="",M=0,k="",y=F,!F){B(),C();return}n.onShown?.(d),P(F),G(),w()};u.addDispose(h);const V=F=>{p=!1,f=void 0,s?.(),F&&n.onReload?.(d);let A;g||m===void 0?A=U():(O(),A=m);try{d.contentWindow?.location.reload()}catch{d.src=c}return A};return{element:d,ready(){return m??U()},reload:()=>V(!0),reloadQuietly:()=>V(!1),followReload:()=>{f=void 0,s?.(),n.onReload?.(d)},moveTo(F){if(a.parentNode===F)return m??U();p=!1,f=void 0,s?.();let A;return g||m===void 0?A=U():(O(),A=m),F.appendChild(a),n.onReload?.(d),I="",j?.schedule(),A},get shown(){return y!==null},get slot(){return y},whenShown(){return y!==null?Promise.resolve():new Promise(F=>{H.push(F)})},get filled(){return f},noteFilled(F){f=F},alignTo(F,A){Y(F,A??null)},hold(F){b!==F&&(b=F,B())},scrollBy(F,A){let R=F,$=A;for(let q=y?Me(y):null;q;q=Me(q)){if(Math.abs(R)<1&&Math.abs($)<1)return;const Q=getComputedStyle(q);if((Q.overflowY==="auto"||Q.overflowY==="scroll")&&q.scrollHeight>q.clientHeight){const X=q.scrollTop,ie=q.scrollLeft;q.scrollBy({left:R,top:$,behavior:"instant"}),R-=q.scrollLeft-ie,$-=q.scrollTop-X}}(Math.abs(R)>=1||Math.abs($)>=1)&&window.scrollBy({left:R,top:$,behavior:"instant"})},resize(){D?.resize()},dispose(){Y(null,null),C(),u.dispose(),a.remove()}}}function Nf(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",o=(S,I)=>S==="email"?`email:${I??n}`:S,s=new Map;let i,a=[],c=!1,d,u,p=!1,f,g,_="shown",E=0,m,T,O;const U=S=>u!==void 0&&S.filled!==void 0&&S.filled!==u,x=()=>{m=void 0;const S=f;!p||!S||u===void 0||T===u||!U(S)||(T=u,e.onForeignDocument?.({wanted:u,filled:S.filled,role:_,heldMs:Date.now()-E}))},D=()=>{p=!1,f=void 0,g=void 0,clearTimeout(m),m=void 0},w=(S,I)=>{const k=s.get("email"),M=k?.slot??null;return S&&M&&U(S)?(S.alignTo(null),p||(p=!0,E=Date.now(),m=setTimeout(x,yf)),_=I,f=S,!(i!==void 0||c)&&g!==S&&(g=S,e.onShown?.(S.element)),!d&&!i&&(d=qn(M)),!1):(p&&(D(),d?.remove(),d=void 0),S?.alignTo(M,k?.clip??null),!0)},C=()=>{p&&!c&&w(t.get(o("email")),"shown")},y=()=>{a.forEach(S=>clearTimeout(S)),a=[],i?.remove(),i=void 0,d?.remove(),d=void 0,(c||p)&&(c=!1,w(t.get(o("email")),"shown"))},N=(S,I,k)=>{const M=o(S,I),v=t.get(M);if(v)return v;const b=e.resolveMount();if(!b)return Df();const B=kf(S,b,e,S==="email"?I??n:void 0,k,S==="email"?()=>C():void 0);return t.set(M,B),B},j={get:S=>N(S),current:S=>N(S),peek:S=>t.get(o(S)),spare:()=>t.get(o("email",r())),ensureSpare:()=>N("email",r(),!0),promote(){const S=t.get(o("email",r()));if(!S)return;const I=t.get(o("email"));n=r(),O=void 0,w(S,"spare"),I?.alignTo(null)},alignSurface(S,I,k){const M=s.get(S);if(s.set(S,{slot:I,clip:k??null}),S==="email"&&c){d?.remove(),d=I?qn(I):void 0;return}const v=I?N(S):t.get(o(S));if(S!=="email"){v?.alignTo(I,k??null);return}if(!I){O=M?.slot&&v?.shown?{slot:M.slot,handle:v}:void 0,p&&(D(),d?.remove(),d=void 0),v?.alignTo(null);return}const b=O?.slot===I&&O.handle===v;if(O=void 0,M?.slot===I&&v?.shown||b){v?.alignTo(I,k??null);return}w(v,"shown")},want(S){u=S,S!==void 0&&C()},noteFilled(S,I){const k=j.byWindow(S);k&&(k.noteFilled(I),k===t.get(o("email"))&&C())},visible(){for(const S of t.values())if(S.shown)return S},byWindow(S){if(S){for(const I of t.values())if(I.element.contentWindow===S)return I}},busy(S){if(y(),!S)return;if(!j.visible()){c=!0,d?.remove(),d=void 0;const M=s.get("email");M?.slot&&(d=qn(M.slot)),a=[setTimeout(y,Us)];return}const I=e.resolveMount();if(!I)return;const k=Cf(I,()=>j.visible()?.element.parentElement?.getBoundingClientRect()??null);i=k,a=[setTimeout(()=>k.showSpinner(),js),setTimeout(y,Us)]},remount(S){y();const I=o("email");t.forEach((k,M)=>{if(M===I){k.moveTo(S).catch(()=>{});return}k.dispose(),t.delete(M)})},dispose(){u=void 0,c=!1,D(),O=void 0,y(),t.forEach(S=>S.dispose()),t.clear(),s.clear(),n="a",u=void 0,T=void 0}};return j}var Lf=l.createIdentifier$1("canvas.resizerBinder"),Kn=l.createIdentifier$1("canvas.service"),Mf={created:ae.canvasCreated,loaded:ae.canvasLoaded},Vs=new WeakMap;function zn(e){return Vs.get(e)??0}function xf(e,t){if(e.getInstance(Kn))return;const n=Nf({resolveMount:()=>t.resolveMount(),resolveSrc:o=>t.resolveSrc(o),resolveSandbox:Su,elementId:t.elementId,bindResizer:o=>e.getInstance(Lf)?.(o),onCreated:o=>at(e,o,"fresh"),onReload:o=>{Vs.set(o,zn(o)+1),at(e,o,"fresh")},onShown:o=>{const s=n.byWindow(se(e).getTarget());s&&s.element!==o&&Gs(s.element)===Gs(o)||at(e,o,"switch")},mark:o=>t.mark?.(Mf[o]),onForeignDocument:o=>{({...o},rc("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=se(e).addListener(l.EVENT_TYPES.SANDBOX_WHEEL,o=>{n.visible()?.scrollBy(o?.deltaX??0,o?.deltaY??0)});e.inject(Kn,n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function Gs(e){return e.parentElement?.dataset.canvasHost}function at(e,t,n){const r=se(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),Xl(r))}function Ff(e,t){at(e,t,"promote")}function Bf(e,t){at(e,t,"switch")}function jf(e,t){const n=t.contentWindow;n&&se(e).greet(n)}function Ws(e,t){const n=t.contentWindow;n&&se(e).forget(n)}function Uf(e,t){const n=oe(e)?.byWindow(t)?.element;if(!n)return;const r=zn(n);return()=>zn(n)!==r}function oe(e){return e.getInstance(Kn)}function Ys({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 Vt(e){return{...Ys({attributes:e.get().attributes,readContent:()=>e.getContent(),docId:e.get().docId,hasSession:!0,serverId:e.get().serverId,show:void 0}),html:e.getContent()}}function Gt(e){const t=le(e),n=t.current();if(!n||!ee(t.sessionKey()))return;const r=Vt(n),o=n.isDirty();ce(e,l.events.ON_BLOCK_CLOSE_ID).fire({block:r,hasUnsavedChanges:o})}function Hf(e){const t=le(e);return!t.current()||!ee(t.sessionKey())?!1:(Gt(e),t.hasSuspended()?t.resumeSuspended()!==void 0:!1)}function $f(e){const t=le(e),n=se(e),r=()=>e.getInstance(l.INIT_PIPELINE_ID)??Gn;let o,s,i=!1,a=!1,c,d;const u=k=>Vt(k),p=()=>{const k=U(),M=k?.get().docId;if(!k||!M||M!==c||i)return;const v=k.get().version;v!==d&&(d=v,ce(e,l.events.ON_BLOCK_CHANGED_ID).fire(u(k)))};let f;const g=k=>{const M=t.showFacts();!M||M.id===f||!Vn(k,M.id)||(f=M.id,k.completeShow(M.id))},_=async(k,M,v)=>{const b=v.generation,B=()=>v.generation!==b||v.signal.aborted||t.current()!==k||a,G=he(n);let h;const P=new Promise(Y=>{h=Pt(n,()=>Y("regenerated"))}),H=async(...Y)=>await Promise.race([Le(...Y).then(()=>"sent"),P])==="sent";i=!0;try{if(!await H(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:M},void 0,v)||B())return;const{html:Y,hasBrowserExtensionArtifacts:V}=Ds(st(k));if(V&&ce(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),Ps(k,Y),!await H(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,jt(st(k),M,Ie(e).editorPolicy,k.get().version),void 0,v)||B()||!await H(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:M},void 0,v)||B())return;o=M,s=G,x(),d=k.get().version,c!==M&&(c=M,ce(e,l.events.ON_BLOCK_INIT_ID).fire(u(k))),g(v)}finally{h?.(),i=!1,he(n)!==G&&C()}};let E,m,T;const O=()=>{const k=oe(e)?.peek("block");return k?.reload?(k.reload().catch(()=>{}),!0):!1},U=()=>ee(t.sessionKey())?t.current():void 0,x=()=>{const k=U()?.get().docId,M=!k||T===k||o===k&&s===he(n);oe(e)?.peek("block")?.hold(!M)},D=()=>{if(a||(x(),p(),i))return;const k=U(),M=k?.get().docId;if(!k||!M)return;if(o===M&&s===he(n)){g(r());return}if(!k.isReady())return;const v=r();v.signal.aborted||o!==void 0&&o!==M&&E!==M&&(E=M,O())||_(k,M,v).catch(()=>{if(!(a||t.current()!==k)){if(m!==M){m=M,O();return}T=M,x()}})};let w=!1;const C=()=>{w||a||(w=!0,queueMicrotask(()=>{w=!1,D()}))};let y,N;const j=()=>{const k=U(),M=k?.get().docId;M!==N&&(y?.(),N=M,y=k?.subscribe(C)),x(),C()},S=t.subscribe(j),I=Pt(n,()=>{x(),C()});j(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a=!0,I(),y?.(),S()})}function Vf(e){const t=le(e);let n="email";const r=()=>{if(!t.current())return;const s=ee(t.sessionKey())?"block":"email",i=oe(e);if(s===n||!i)return;n=s;const a=i.peek(s);if(a){Bf(e,a.element);return}i.get(s)},o=t.subscribe(r);e.getInstance(l.DISPOSABLE_ID)?.addDispose(o)}var Gf=200;function Wf({startVersion:e,limit:t=Gf}){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(_=>f.range.start<=_.oldEnd&&f.range.end>=_.oldPosition))return null;const g=fc(f.range,u,"after");if(!g)return null;p.push({range:g,text:f.text})}c=p}return c}}}function Yf(e,t){let n=0;return e.map(({start:r,end:o,text:s})=>{const i=new Ee(r,t.slice(r,o),r+n,s);return n+=s.length-(o-r),i})}function qf(e,t){const n=[...e].sort((r,o)=>r.range.start-o.range.start);return Yf(n.map(({range:r,text:o})=>({start:r.start,end:r.end,text:o})),t)}function Kf(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var zf=32;function Xf(e=zf){const t=new Map;return{find(n,r){const o=t.get(n);return o&&wn(o.scope,r)?o.echo:void 0},remember(n,r,o){t.delete(n),t.set(n,{scope:r,echo:o}),t.size>e&&t.delete(t.keys().next().value)},echoes(n){return[...t.values()].filter(r=>wn(r.scope,n)).map(r=>r.echo)}}}function Jf(e,t){const n=l.findTextDiffBounds(e,t);return n?[{range:{start:n.start,end:n.fromEnd},text:t.slice(n.start,n.toEnd)}]:[]}var Xn=l.createIdentifier$1("canvas.sandboxFill");function qs(e){return e.getInstance(Xn)?.pipeline.isEventsLocked()===!0}var wb=.2,Qf=/<(style|script|template|noscript|textarea)\b[^>]*>[\s\S]*?<\/\1\s*>|<!--[\s\S]*?-->/gi,Zf=/<\/?[a-zA-Z]/g;function Ks(e){return e.match(Zf)?.length??0}function zs(e){return[...e.matchAll(Qf)].map(t=>[t.index,t.index+t[0].length])}function Jn(e,t,n){let r=0,o=0;for(const[s,i]of n){for(;o<t.length&&t[o][1]<=s;)o++;let a=s;for(let c=o;c<t.length&&t[c][0]<i;c++)r+=Ks(e.substring(a,Math.max(a,t[c][0]))),a=Math.max(a,t[c][1]);r+=Ks(e.substring(Math.min(a,i),i))}return r}function ep(e,t){const n=[...t].sort((c,d)=>c.oldPosition-d.oldPosition||c.oldEnd-d.oldEnd),r=[],o=[],s=[];let i=0,a=0;for(const c of n){const d=e.substring(i,c.oldPosition);r.push(d,c.newText),a+=d.length,o.push([c.oldPosition,c.oldEnd]),s.push([a,a+c.newText.length]),a+=c.newText.length,i=c.oldEnd}return r.push(e.substring(i)),{next:r.join(""),removed:o,inserted:s}}function tp(e,t){if(e.reduce((i,a)=>i+a.oldLength,0)<=200)return null;const n=zs(t),r=ep(t,e),o=Jn(t,n,r.removed)-Jn(r.next,zs(r.next),r.inserted),s=Jn(t,n,[[0,t.length]]);return o>100&&o>s*.2?{removed:o,total:s}:null}function Fe(e){nt(e,{origin:"canvas-channel"})}var np=100;function rp(e){const t=e?.data,n=t?.action==="undo"||t?.action==="redo";return t?.operation===l.EVENT_TYPES.APPLICATION_ACTION&&n&&typeof t.actionId=="number"?{action:t.action,actionId:t.actionId}:void 0}function op(e){const t=le(e),n=se(e);let r;const o=(c,d)=>{const u=c.get().docId;let p=!1,f=null,g=null,_;const E=Wf({startVersion:c.get().version});let m=c.getContent();const T=Xf(),O=To(e),U=O.open(u,()=>c.get().version);let x=!1;const D=A=>({generation:he(n),originId:A});let w=D(null),C=!0;const y=(A,R)=>{!C||t.current()!==c||(nt(R,{origin:"canvas-channel"}),g?.splice(0,g.length),n.sendAsync(l.EVENT_TYPES.SANDBOX_SET_ENTITY,jt(st(c),u,Ie(e).editorPolicy,c.get().version)).catch(Fe))},N=A=>{const R=A[A.length-1],$=[...A].reverse().find(X=>X.answer?.actionId!==void 0)?.answer?.actionId,q=R.answer?.selection,Q=$!==void 0||q?{...$!==void 0?{actionId:$}:{},...q?{selection:q}:{}}:void 0;return{edits:A.map(X=>X.edits),guid:u,rev:R.rev,...Q?{historyAnswer:Q}:{}}},j=()=>{const A=d.activeMove(),R=A&&_?.action===A.kind?_:void 0;if(R&&(_=void 0),!(!R&&!A?.selection))return{...R?{actionId:R.actionId}:{},...A?.selection?{selection:A.selection}:{}}},S=A=>{I({edits:[],rev:c.get().version,answer:{actionId:A.actionId}}).catch(Fe)},I=async A=>{if(g){g.push(A);return}g=[A];try{do await n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,N(g.splice(0,g.length)));while(g.length)}catch(R){y("app edits failed to reach the canvas",R)}finally{g=null}},k=A=>{A.length&&n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,N(A)).catch(Fe)},M=(A,R)=>{x=!0,k(g?.splice(0,g.length)??[]);const $={edits:[A],guid:u,rev:c.get().version,...R!==null?{changeId:R}:{}};R!==null&&T.remember(R,w,$),n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,$).catch(Fe)},v=new Set,b=(A,R,$)=>{M([],$);const{length:q,hash:Q}=l.textFingerprint(JSON.stringify(R.map(me=>[me.oldText,me.newText]))),X=`${q}:${Q}`;if(v.has(X))return;v.add(X);const ie=new Error(`canvas service batch removes ${A.removed} of ${A.total} tags`);y("canvas service batch removes a large part of the email",ie)},B=({changeId:A,baseRev:R})=>{!x&&(A!==null||R!==null)&&M([],A)},G=A=>{if(A.guid!==u)return;const R=Tc(A);x=!1,w=D(R.originId);try{h(A,R)}catch($){B(R),y("canvas batch failed to apply",$)}finally{B(R),R.changeId!==null&&O.note(R.changeId,w)}},h=(A,R)=>{const{pushUndoStop:$}=A,q=R.changeId!==null?T.find(R.changeId,w):void 0;if(q){x=!0,n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,q).catch(Fe);return}let{edits:Q,selection:X}=A;if(R.baseRev!==null){const ie=E.rebase(Q,R.baseRev);if(!ie){nt(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),M([],R.changeId);return}ie!==Q&&(X=void 0),Q=ie}try{p=!0,f=R.changeId;const ie=qf(Q,c.getContent());if($===!1){const me=tp(ie,c.getContent());if(me){b(me,ie,R.changeId);return}d.applyWithoutHistory(ie)}else d.recordAt(A.typedAt,()=>c.mutate({changes:ie},{source:qs(e)?"system":"user"}),X),A.closesStep&&d.closeGroup()}finally{p=!1,f=null}},P=c.subscribe(({changes:A,version:R})=>{const $=c.getContent(),q=!A?.length&&$!==m;if(m=$,E.record({version:R,changes:A,contentReplaced:q,fromCanvas:p}),!A?.length)return;const Q=Kf(A);p?M(Q,f):I({edits:Q,rev:R,answer:j()}).catch(Fe)}),H=n.addListener(l.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,G),Y=n.addListenerAsyncPipe(l.CUSTOM_MESSAGE,(A,R)=>{_=rp(A);try{return R?.(A)}finally{const $=_;_=void 0,$&&S($)}},np),V=(A,R,{reportId:$,dropsCovered:q})=>{const Q=g?.splice(0,g.length)??[];n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:[Jf(A,R)],guid:u,rev:c.get().version,resync:{textFingerprint:l.textFingerprint(R),reportId:$}}).catch(X=>y("canvas resync edit failed to reach the canvas",X)),q&&k(Q)},F=n.addListener(l.EVENT_TYPES.APPLICATION_SYNC_DRIFT,A=>{if(!((A.reason==="echo-timeout"||A.reason==="resync-failed")&&A.guid!==void 0&&A.guid!==u)){if(A.reason==="resync-failed"){y("canvas failed to apply the resync edit",new Error("canvas resync failed"));return}if(A.reason==="echo-timeout"){const{textFingerprint:R}=A,$=st(c),q=l.textFingerprint($);if(R?.length===q.length&&R.hash===q.hash){T.echoes(D(A.originId??null)).forEach(X=>{n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,X).catch(Fe)}),A.reportId!==void 0&&V($,$,A);return}const Q=new Error(`canvas echo timeout, ${A.unsent??0} edits unsent`);if(A.canvasText===void 0){y("canvas lost the echo of its batch",Q);return}V(A.canvasText,$,A)}}});return()=>{C=!1,U(),P(),H.dispose(),Y.dispose(),F.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 sp(e){const t=se(e),n=()=>oe(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(l.EVENT_TYPES.RELOAD,()=>{n()?.followReload()}),o=t.addOffTargetListener(l.EVENT_TYPES.RELOAD,a=>{const c=oe(e)?.byWindow(a);c&&Ws(e,c.element)}),s=t.addListener(a=>{a.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),i=K(e,l.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),o.dispose(),s.dispose(),i.dispose()})}function Xs(){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 ip(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);let n,r;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),xf(e,{resolveMount:()=>n,resolveSrc:s=>Ss(s==="block"),elementId:"email_iframe",mark:s=>Z(s)}),t?.watch(s=>{const i=s?.element;if(n&&i instanceof HTMLElement&&i!==n){n=i,oe(e)?.remount(i),r?.remove(),r=void 0;return}if(!n){if(i instanceof HTMLElement)n=i;else if(s!==void 0){n=r??=Xs(),oe(e)?.alignSurface("email",r,r);return}else return;oe(e)?.get("email")}});let o;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{o?.remove(),o=void 0}),Fd(e).watch(s=>{const i=oe(e);if(i){if(s){o??=Xs(),i.alignSurface("email",o,o);return}o&&(i.alignSurface("email",null),o.remove(),o=void 0)}})}var Qn=l.createIdentifier$1("canvas.headerFlow"),Js=["subject","preheader"],Qs=3e3,ap=3,lp={subject:l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function cp(e){const t=le(e),n=se(e),r=D=>D?"remote":qs(e)?"system":"user",o=(D,{guid:w,value:C,forced:y})=>{const N=Ge(t);if(!N||typeof C!="string"||w&&w!==N.get().docId)return;const j=t.forcedHeaders();if(j?.[D]!==void 0&&!y&&C!==j[D])return;const S=N.get().attributes[D];if(!y&&g(D,C,S))return;const I=!y&&p.delete(D);y&&(m.delete(D),m.size===0&&t.endForcedHeaders()),c=!0;try{We(N,{[D]:C},{source:I?"system":r(y)})}finally{c=!1}s[D]=C};let s={},i,a,c=!1,d=Promise.resolve();const u={},p=new Map,f=(D,w)=>{s[D]=w;const C={};p.set(D,C);const y=()=>{p.get(D)===C&&p.delete(D)};_(D,w,{force:!0}).then(y),setTimeout(y,Qs)},g=(D,w,C)=>{const y=t.showFill();if(!y||typeof C!="string")return!1;const N=u[D]?.showId===y.showId?u[D]:void 0;return w===C?(u[D]=N??{showId:y.showId,codeEdits:y.codeEdits,corrections:0},!1):N&&y.codeEdits>N.codeEdits&&w!==N.stale?!1:((!N||w===N.stale&&N.corrections<ap)&&(u[D]={showId:y.showId,stale:w,codeEdits:y.codeEdits,corrections:(N?.corrections??0)+1},f(D,C)),!0)},_=(D,w,{force:C=!1,echo:y=!1,undoStep:N=!1})=>(d=n.sendAsync(lp[D],{value:w,guid:Ge(t)?.get().docId,...C?{force:!0}:{},...y?{echo:!0}:{},...N?{undoStep:!0}:{}}).catch(j=>{}),d);let E;const m=new Set;e.inject(Qn,{whenDelivered:async()=>{await d},reassert:D=>{const w=Ge(t),C=Js.filter(y=>typeof D[y]=="string");if(!(!w||C.length===0)){c=!0;try{We(w,Object.fromEntries(C.map(y=>[y,D[y]])),{source:"system"})}finally{c=!1}t.beginForcedHeaders(Object.fromEntries(C.map(y=>[y,D[y]]))),clearTimeout(E),E=setTimeout(()=>{m.clear(),t.endForcedHeaders()},Qs),m.clear();for(const y of C)m.add(y);for(const y of C)s[y]=D[y],_(y,D[y],{force:!0,echo:!0})}}});const T=()=>{i?.(),i=void 0;const D=Ge(t);if(D!==a&&p.clear(),a=D,!D){s={};return}const w=D.get().attributes;s={subject:w.subject,preheader:w.preheader},i=D.subscribe(({source:C})=>{if(c)return;const y=D.get().attributes,N=t.forcedHeaders();for(const j of Js){const S=y[j];if(S===s[j])continue;s[j]=S,p.delete(j);const I=C==="system"&&N?.[j]!==void 0;_(j,S??"",{force:I,echo:I,undoStep:C==="user"})}})};T();const O=t.subscribe(T),U=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,D=>o("subject",D)),x=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,D=>o("preheader",D));e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{U.dispose(),x.dispose(),O(),i?.(),clearTimeout(E)})}function dp(e){const t=le(e);let n={document:void 0,seq:0};const r=()=>{const s=t.recoveryFacts(),i=Ge(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(Qn)?.reassert(a)},o=t.subscribe(r);e.getInstance(l.DISPOSABLE_ID)?.addDispose(o)}function up(e,t){return(e&&e!=="system"?e:t?"dark":"light")==="dark"?l.DARK:l.LIGHT}function fp(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 pp(e){return e.isCodeMode&&(e.direction==="left"||e.direction==="right")}function Zs(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];Zs(o)&&Zs(s)?n[r]=Zn(s,o):o!==void 0&&(n[r]=o)}return n}function hp(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 mp=de(void 0),ei=mp,ti=l.createIdentifier$1("CodeMode");function ni(){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 gp(e){try{window.localStorage?.setItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function er(e){return e.getOrCreateInstance(ti,()=>{const t=de(ni());return t.watch(gp),t})}function ri(e){return e?.getInstance(ti)?.get()??ni()}function tr(e,t){const n=er(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function vp(e,t){const n=er(e);n.set({...n.get(),direction:t})}var Ep=l.createIdentifier$1("DefaultCommonStyles");function oi(e){return e.getOrCreateInstance(Ep,()=>de(void 0))}function _p(e,t){oi(e).set(t)}var bp=l.createIdentifier$1("CanvasViewport"),yp=l.createIdentifier$1("CanvasPreviewPage");function Te(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 Wt(e){const t=de(e());return{source:t,refresh:()=>t.set(e())}}function Sp(e){const t=se(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=e.getInstance(l.OPTIONS_SOURCE_ID),o=le(e),s=er(e),i=matchMedia(l.PREFERS_COLOR_SCHEME_DARK),a=()=>n?.get()??{};let c;const d=Wt(()=>up(ei.get()??a().theme,i.matches)),u=Wt(()=>fp(a(),ee(o.sessionKey()))),p=Wt(()=>a().lockEditor),f=Wt(()=>hp(o.current()?.get().attributes?.common_styles,c)),g=e.getOrCreateInstance(bp,()=>de()),_=e.getOrCreateInstance(yp,()=>de()),E=[Te(t,l.CANVAS_FACTS.theme,d.source),Te(t,l.CANVAS_FACTS.flags,u.source),Te(t,l.CANVAS_FACTS.lockEditor,p.source),Te(t,l.CANVAS_FACTS.commonStyles,f.source),Te(t,l.CANVAS_FACTS.codeMode,s.select(pp)),Te(t,l.CANVAS_FACTS.appName,de("emailmaker")),Te(t,l.CANVAS_FACTS.previewPage,_),Te(t,l.CANVAS_FACTS.viewport,g)],m=()=>{d.refresh(),u.refresh(),p.refresh()},T=n?.watch(m),O=oi(e).watch(N=>{c=N,f.refresh()}),U=r?.watch(N=>{N&&"commonStyles"in N&&(c=N.commonStyles),f.refresh()});let x;const D=()=>{x?.(),x=o.current()?.subscribe(()=>f.refresh()),f.refresh(),u.refresh()};D();const w=o.subscribe(D),C=()=>d.refresh();i.addEventListener("change",C);const y=ei.watch(()=>d.refresh());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{E.forEach(N=>N.dispose()),T?.dispose(),O.dispose(),U?.dispose(),x?.(),w(),i.removeEventListener("change",C),y.dispose()})}var nr;(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})(nr||(nr={}));function wp(e,t){return e.type===t.type&&e.key===t.key}function Ip(e){const t=se(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}=nr.diff(r,c,wp);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 Tp=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 Cp(e){return e.length>0&&!e.startsWith("em:")&&!Tp.has(e)}function Ap(e){const t=se(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||!Cp(d))return;const p=he(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=he(t),p=i(u);p.add(d.key);for(const[f,g]of n)g.generation===u||![...g.scripts].every(_=>p.has(_))||(g.generation=u,t.send(l.createIdentifier(f),g.data))});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a.dispose(),c.dispose()})}var Dp=l.createIdentifier$1("prewarm.editorVisible");function Pp(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function Op(e={}){const t=e.paint??Pp;let n=!1,r=!1,o=!1,s=!1,i=!1;const a=[],c=()=>{i||s||!n||!r||!o||(s=!0,t(()=>{i=!0,Z(ae.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 Rp(e){return e.getOrCreateInstance(Dp,()=>Op())}var kp=500,Np=500,Lp=5e3;function Mp(e){const t=e.quietMs??kp,n=e.floorMs??Np,r=e.ceilingMs??Lp;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 xp=2;function si(){return new Error("[sandbox] document reloaded during fill")}function Fp(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function rr(e){try{e()}catch{}}function Bp(e){let t;return rr(()=>{t=e()}),{stage:n=>rr(()=>t?.stage(n)),end:(n,r)=>rr(()=>t?.end(n,r))}}function jp(e){const t=()=>e.initPipeline();let n=!1,r,o,s,i=0,a,c;const d=()=>{const w=e.readTarget?.(),C=e.readSandboxGeneration?.();return w===void 0||C===void 0?void 0:{target:w,generation:C}},u=()=>{const w=d();return w&&{...w,canvasReplaced:e.trackDocument?.(w.target)}},p=w=>{if(w?.canvasReplaced?.())return!0;const C=d();return w!==void 0&&C?.target===w.target&&C.generation!==w.generation},g=ef({...e,waitScope:()=>({getSandboxTimeoutMs:w=>t().getSandboxTimeoutMs(w),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal}),frameWatch:()=>{const w=c;if(!(!w||!e.onSandboxGenerationChange))return{getGeneration:()=>d()?.generation??w.generation,onChange:C=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===w.target||w.canvasReplaced?.())&&C()})??(()=>{})}}});let _;const E=(w,C)=>{if(_===w)return;_=w;const y=i;setTimeout(()=>{i!==y||t().signal.aborted||U(w,C).catch(()=>{})},0)},m=()=>{a?.abort(),a=void 0};let T;const O=()=>{const w=t().signal;w!==T&&(T?.removeEventListener("abort",m),T=w,w.addEventListener("abort",m))};async function U(w,C,y=0){const N=++i;m(),a=new AbortController,c=void 0,O();const j=()=>i!==N,S=g.readTarget(),I=t().generation,k=()=>I===t().generation&&!t().signal.aborted,M=C?"init:reset-":"init:",v=Bp(()=>e.observeShow?.(Fp(w,C,e.readEmail())));if(!C){const Y=g.publicEmail();Y?.id,Y?.renderGuid,Y?.preheader}let b=!1,B=!1,G,h=!1;const P=()=>{if(p(G))throw si()},H=()=>{if(j())throw l.createAbortError("Fill superseded")};try{n=!0,await g.sendInitStart(),H(),G=u(),c=G,y===0&&g.fireWillInit(),await(C||y>0?g.refreshContent():g.sendContent()),b=!0,H(),P();const Y=g.contentSent();g.noteFilled(Y?.target,Y?.docId),v.stage("content"),C||g.publicEmail()?.id;try{await g.sendPreheader()}catch(V){if(Os(V)||j())throw V;`${M}`,String(V)}H();try{await g.sendSubject()}catch(V){if(Os(V)||j())throw V;`${M}`,String(V)}if(H(),P(),g.showFilled(S),await g.sendInited(),H(),P(),B=!0,o===w){const V=e.readSandboxGeneration?.()??s;V!==void 0&&(r=V)}v.stage("reveal"),await g.revealFilled(),P(),v.end("revealed")}catch(Y){const V=!j()&&k()&&p(G),F=V?si():void 0,A=F??Y,R=V&&y<xp?D(w,C,y+1):void 0;h=V&&R===void 0;const $=j()?void 0:{showId:w,contentApplied:b,sandboxInitedAcked:B,superseded:!1,...e.describeSurface?.(),error:String(F??Y)};$&&(`${M}`,void 0);const q=!j()&&e.recoverFailedFill?.(S)===!0;if(v.end(j()?"superseded":q?"recovered":l.isAbortError(A)||!k()?"aborted":"failed",$),!q&&!j()&&Vn(t(),w)&&t().failShow(w,A),R!==void 0)return R;throw A}finally{x(w,C,M,{superseded:j(),sessionGeneration:I,contentApplied:b,sandboxInitedAcked:B&&!h,retry:!h,commit:k()})}}function x(w,C,y,N){const{superseded:j,contentApplied:S,sandboxInitedAcked:I}=N;if(j){`${y}`;return}I&&N.commit?g.fireInit(w,C||void 0):I?(`${y}`,N.sessionGeneration,t().generation,t().signal.aborted,void 0):S?(`${y}`,void 0):(`${y}`,void 0),n=!1,a=void 0,!I&&o===w&&(o=void 0,r===s&&(r=void 0)),!I&&S&&N.retry&&E(w,C)}function D(w,C,y){return U(w,C,y)}return{channel:g,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:w=>{r=w},lastCorrelation:()=>o,markCorrelation:w=>{o=w},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:w=>{s=w},fill:w=>U(w,!1),refill:w=>U(w,!0),stop:()=>{i+=1,m(),n=!1,T?.removeEventListener("abort",m),T=void 0}}}function Up(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:ii(e,n)}function ii(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Hp(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:o,readSandboxGeneration:s}=e,i=u=>{const p=n(),f=o();if(!Up(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||!ii(p,f))return;const g=`${Rs}${p.renderGuid}`;t.markFilled(u),t.markCorrelation(g);const _=r()?.isReady()===!0;p.id,p.renderGuid,(_?E=>t.refill(E):E=>t.fill(E))(g).catch(()=>{t.lastCorrelation()===g&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id,r()}}}var $p=l.createIdentifier$1("canvas.health");function Vp(e){return e??""}function Gp(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function ai(e){return e.length>0}function Wp(e){const t=le(e),n=se(e),r=()=>ee(t.sessionKey())?void 0:t.current(),o=()=>{const L=r();return Ys({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)??Gn;let i={},a=!1;const c=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(L=>{a=!!L?.element});let d=!1,u=!1,p=!1,f=0;const g=()=>{const L=oe(e);if(!L)return;const J=++f,z=L.spare();return z&&Ws(e,z.element),(z?z.reloadQuietly():L.ensureSpare()?.ready())?.then(()=>{if(J!==f)return;d=!0;const fe=L.spare();fe&&jf(e,fe.element),p&&(p=!1,I(),V())})},_=Mp({run:()=>{p||g()?.catch(()=>{})}}),E=()=>{Rp(e).noteContentShown(),!d&&!p&&_.start()};let m=!1;const T=L=>{const J=oe(e),z=J?.spare()?.element.contentWindow;u&&J&&z&&L===z&&(u=!1,J.promote(),J.busy(!1),m=!0)};let O=!1;const D=jp({container:e,messageService:n,initPipeline:s,readDocument:r,readEmail:o,revealFilled:()=>{const L=oe(e);return m&&L&&(m=!1,_.start()),a?L?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:T,noteFilled:(L,J)=>oe(e)?.noteFilled(L,J),recoverFailedFill:L=>{const J=oe(e),z=J?.spare()?.element.contentWindow;return!u||!J||!z||L!==z?!1:(u=!1,d=!1,j="reload",J.busy(!1),J.peek("email")?.reload(),O=!0,V(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>he(n),onSandboxGenerationChange:L=>Pt(n,L),trackDocument:L=>Uf(e,L),observeShow:L=>e.getInstance($p)?.begin(L),describeSurface:()=>({canvasPath:j,promoted:u,spareClean:d,handshake:n.isInited(),generation:he(n)}),events:{willInit:L=>{ce(e,l.events.WILL_EMAIL_INIT_ID).fire(L)},inited:L=>{E(),ce(e,l.events.ON_EMAIL_INIT_ID).fire(L)},contentChanged:L=>{ce(e,l.events.ON_CONTENT_CHANGED_ID).fire(L)},emailChanged:L=>{ce(e,l.events.ON_EMAIL_CHANGED_ID).fire(L)},browserExtensionDetected:()=>{ce(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),w=Hp({pipeline:D,initPipeline:s,readEmail:o,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>he(n)});let C="",y="",N="",j="none";const S=()=>{const L=oe(e)?.spare()?.element.contentWindow;L&&n.getTarget()===L||n.sendNow({operation:l.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0})},I=()=>{const L=oe(e)?.spare();L&&(S(),d=!1,u=!0,Ff(e,L.element))},k=(L,J)=>{const z=oe(e);if(!z)return!0;const fe=z.spare(),re=fe&&d?"spare":"prepare";if(j=re,z.busy(!0),fe&&d)return I(),!0;_.cancel(),S();const He=g();if(He===void 0)return j="reload",z.busy(!1),z.peek("email")?.reload(),!0;p=!0;const Ae=f;return He.catch(()=>{!p||Ae!==f||(p=!1,j="reload",z.busy(!1),z.peek("email")?.reload())}),!1},M=()=>{if(ee(t.sessionKey()))return;Q(),D.noteSandboxGeneration(he(n));const L=o(),J=Gp(L?.renderGuid,L?.showId,L?.id,i.emailId),z=Vp(L?.renderGuid);if(z!==y){const He=y;y=z;const Ae=oe(e)?.peek("email")?.filled,db=Ae!==void 0&&Ae!==z;ai(z)&&(ai(He)||db)&&k(He||(Ae??""),z)}if(p)return;(J!==C||O)&&(O=!1,C=J,w.showRequestIdentityChanged());const fe=r(),re=`${J}|${fe?.get().docId??""}|${he(n)}`;re!==N&&fe?.isReady()===!0&&(N=re,w.selfInitChanged()),w.saasChanged(),H()};let v=!1,b="",B="",G=!1,h=!1;const P=L=>{L.source==="user"?h=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(G=!0),V()},H=()=>{const L=o();if(!L?.renderGuid)return;const J=D.channel.readContent(),z=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??""]),fe=v&&J!==B,re=v&&z!==b;v=!0,B=J,b=z;const He=G&&!h;if(G=!1,h=!1,D.isEventsLocked()||He)return;const Ae={...L,id:i.isTemplate||L.isNew?void 0:L.id,html:J};if(fe){ce(e,l.events.ON_CONTENT_CHANGED_ID).fire(J),ce(e,l.events.ON_EMAIL_CHANGED_ID).fire(Ae);return}re&&L.is_inited&&ce(e,l.events.ON_EMAIL_CHANGED_ID).fire(Ae)};let Y=!1;const V=()=>{Y||(Y=!0,queueMicrotask(()=>{Y=!1,M()}))};e.inject(Xn,{pipeline:D,setRoute:L=>{L.emailId===i.emailId&&!!L.isTemplate==!!i.isTemplate||(i=L,V())}});let F,A;const R=()=>{const L=r()?.get().docId;L!==A&&(F?.(),A=L,F=r()?.subscribe(P)),V()};let $,q;const Q=()=>{const L=e.getInstance(l.INIT_PIPELINE_ID);!L||L===$||(q?.(),$=L,q=L.onShowRequested(J=>w.showRequested(J)))},X=n.addListener(L=>{L.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&_.notify()}),ie=t.subscribe(R),me=Pt(n,V);R(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c?.dispose(),q?.(),me(),ie(),F?.(),X.dispose(),_.cancel(),D.stop()})}function Yp(){return l.USEBLOCKS!=="emailmaker"}var qp={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},li={config:{mode:"pro",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",saveHotkeyEnabled:!0,commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!0,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0,enableCopyFile:!0}},project:void 0,page:{isNew:!0,type:"email",project:0,id:"",showToken:0}},ci=li,Kp=["pro"],or={};function zp(e){or=e}var di=e=>Kp.includes(e)?ci:or[e]??or.editor??ci,sr={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},Xp={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},Jp={...sr,config:{...sr.config,imageCenterFileManagerView:!1}};zp({pro:li,editor:Xp,simple:Yp()?sr:Jp,blocks:qp});function Qp(e,t,n=e.getInstance(l.CONFIG_SOURCE_ID)){n?.setMode(t),n?.get()?.codeEnabled===!1&&ri(e).isCodeMode&&tr(e,!1)}function Zp(e){e.getInstance(l.STANDALONE_ACTIVATED_ID)||e.inject(l.SECURITY_MODULE_ID,void 0)}function Yt(e){return String(e.standaloneKey||"").trim()||void 0}function eh(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function ir(e){return eh(e)?!!Yt(e):!1}function lt(e){return!!Yt(e)&&!ir(e)}var th=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function ui(e){return e==="server"?"serverSide":e}function nh({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},o=de();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(Fn(r,e))}function u(f){if(s.kind!=="pending")return;clearTimeout(c),s=f;const g=Fn(r,e);o.set(g),i(g)}function p(f,g){r[ui(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=Fn(r,e);return Object.fromEntries(th.map(g=>[g,f[g]]))},merge(f,g){p(g,{...r[ui(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 rh=5e3,Ib="pro";function oh(){return{...di("pro")?.config,mergeTags:void 0}}function sh(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 ih(e,t){let n;xn(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 ah(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function lh(e,t){let n,r=!1,o;const s=a=>{o??=xt(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&Qp(e,a,t)},i=xn(e).watch(({profile:a})=>{const c=a?.email_builder_config,d=ah(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 fi="замкнутый контур: app_init не выполняется";function ch(e,t){if(e.getInstance(l.SECURITY_MODULE_ID)){t.serverAbsent(fi);return}const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(r=>{lt(r)&&t.serverAbsent(fi)});n&&e.getInstance(l.DISPOSABLE_ID)?.addDisposable(n)}async function dh(e,t){if(e.getInstance(_n)===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 uh(e){e.injectFactory(l.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=nh({base:oh(),env:{modeDefaults:o=>di(o)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:rh});return sh(e,r),ih(e,r),lh(e,r),ch(e,r),dh(e,r),e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var ze=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 W(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 fh=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new l.Emitter;this.handleDestroy=W(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new ze(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{}}},ar=l.createIdentifier$1("DestroyableService");function ph(e){e.injectFactory(ar,(t,n)=>{if(n)return n;const r=e.getInstance(l.DISPOSABLE_ID);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new fh({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 hh(e){const t=e.getInstance(ar);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var mh=1e3;function pi(e,t,n=mh,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(!pi(e[i],t[i],n,r+1))return!1;return!0}return!1}function ct(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];pi(o,s)||(n[r]=o)}return n}var gh=({source:e,emailtags:t,group:n,tags:r,...o})=>o;async function vh(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function Eh({emails:e,saveTimeoutMs:t},n,r){const o=t?.()??At();let s;try{const i=e.notifySave(n);return await Promise.race([i,new Promise((a,c)=>{s=setTimeout(()=>{const d=new Dt(o);n.value.id,Rc(d,vh(i,r)),c(d)},o)})])}catch(i){throw xo(i),i}finally{s!==void 0&&clearTimeout(s)}}function _h(e){const{emails:t}=e,n=async(r,o)=>{const s=gh(o),i=r===void 0?void 0:await t.cache.getIfPresent(r),a=i?{...i,...s}:s,c=i?ct(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 Eh(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 lr=20;function bh(e){const t=yh(e);return e.saveTimeoutMs?Sh(t,e.saveTimeoutMs):t}function yh({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(lr*(c-1),lr*c),page:c,hasMore:d.length>lr*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 jc(await i(a,1),d);if(!u.revision)return Uo([],d);const p={...u.revision,parent:a,isAutosave:!0};return Uo([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 Sh(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 wo(o)),o)})])}catch(i){throw xo(i),i}finally{s!==void 0&&clearTimeout(s)}}}}var wh=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}},Ih=class extends l.AsyncEmitter{};function Tb(e){return e}var hi=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 Th(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 Ch(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 Ah(e,t){return mi(e)&&mi(t)?String(e)===String(t):e===t}function mi(e){return typeof e=="string"||typeof e=="number"}var Dh=class extends l.Disposable{_cache=new hi;_readEmitter=new l.AsyncEmitter;_saveEmitter=this.addDisposable(new wh);_removeEmitter=this.addDisposable(new Ih);_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 hi),o=n.addDisposable(new l.AsyncEmitter);t=this._foreignCache[e]={get:async(s,i={})=>{await r.getOrCreate(s,async()=>{try{const c=Ch(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||Ah(d,s)});return Th(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?ct(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 dt(e){const t=l.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new Dh)}function gi(e){const t=e.getInstance(l.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function vi(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function qt(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function Ph(e,t,n){return e&&!vi(t)&&vi(e)?{...n,meta:e.meta}:n}var Oh=l.createIdentifier$1("CurrentProject"),Rh={};function ut(e){return e?.getInstance(Oh)?.get()??Rh}function cr(e){const t=ut(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var Ei=dt("plugin.dataSource.emails"),_i=dt("plugin.dataSource.emailRevisions"),bi=Bt("plugin.readEmailAutosave"),yi=l.createIdentifier$1("emailDocuments.provided");function kh(e){const t=Ei(e),n=_i(e),r=n.byForeignKey("parent");if(e.getInstance(yi))return{emails:t,emailRevisions:n};e.inject(yi,!0);const o=()=>At(e.getInstance(l.INIT_PIPELINE_ID)?.contentReadyTimeoutMs),s=_h({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 gd(e,{...s,createEmail:c=>s.createEmail(c).then(a(Date.now())),updateEmail:(c,d)=>s.updateEmail(c,d).then(a(Date.now(),c))}),bd(e,bh({revisions:n,revisionsByEmail:r,readAutosave:async c=>{const d=await ce(e,bi).fire(c);return d.length===0?{asked:!1}:{asked:!0,revision:d[0]??null}},savedAt:async c=>{const d=Fc((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:()=>ut(e).requested})),gi(e).addDisposable(t.onSave(({prev:c,patch:d,value:u})=>Ph(c,d,u),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function Si(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 Nh(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var Lh="po",Kt=null;function Mh(){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([Lh],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function xh(){return Kt===null&&(Kt=Mh().catch(e=>{throw Kt=null,e})),Kt}async function wi(e){if(typeof e=="object")return dr(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Fh(t):Bh(t)}function dr(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Fh(e){try{return dr(JSON.parse(e))}catch{return}}var Ii=!1;async function Bh(e){try{return dr((await xh()).parsePoCatalog(e))}catch{Ii||(Ii=!0);return}}var jh="em_locale",Uh="em_ant_locale",Hh="locale",$h="ant_locale";function ur(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function Ti(e,t){const n=ur(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function Vh(){return ur("em_locale")??Ti(Hh,"em_locale")}function Ci(e){try{localStorage.setItem(jh,JSON.stringify(e))}catch{}}function Gh(){return ur("em_ant_locale")??Ti($h,"em_ant_locale")}function Wh(e,t){try{localStorage.setItem(Uh,JSON.stringify({id:e,data:t}))}catch{}}var Cb="en_US",Yh=8e3;function qh(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 Kh(e){const t=Vh(),n=Gh();let r={ready:!1},o;const s=de(r);let i=0;const a=m=>{r={...r,...m},s.set(r)},c=()=>{r.ready||a({ready:!0})},d=setTimeout(c,e.unlockAfterMs??Yh),u=m=>m!==i;let p;async function f(m,T){if(n?.id===m&&n.data&&a({antd:n.data}),!p)return;const O=await p(m).catch(()=>{});!O||u(T)||(a({antd:O}),Wh(m,O))}async function g(m,T){const O=await e.askHost(m).catch(()=>null);if(u(T))return!0;if(O==null)return!1;const U=await wi(O);return u(T)||(U&&a({catalog:U}),c()),!0}async function _(m,T){const O=await e.readList();if(u(T))return;if("error"in O){a({failure:{kind:"GET_LOCALES_ERROR",error:O.error}}),c();return}const U=O.data.find(D=>D.locale===m);if(!U){Nh("em_locale")&&a({catalog:void 0}),c();return}if(Si(t,U)&&(!o||o.catalog===t?.data)){c();return}if(o?.entry&&r.catalog===o.catalog&&Si(o.entry,U)){Ci(o.entry),c();return}const x=await e.readCatalog(m);if(!u(T)){if("error"in x){a({failure:{kind:"GET_LOCALE_ERROR",error:x.error}}),c();return}x.data&&(o?.id===m&&r.catalog===o.catalog&&qh(o.catalog,x.data)||a({catalog:x.data}),Ci({id:m,time:U.updatedAt||Math.floor(Date.now()/1e3),hash:U.contentHash,data:x.data})),c()}}async function E(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 O=o?.id===m&&r.catalog===o.catalog;(o&&!O&&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,T),E(m,T)},prime(m,T,O){r.id&&r.id!==m||r.catalog||!T||(o=t?.id===m&&t.data&&(!O||t.time>=O.time)?{id:m,catalog:t.data}:{id:m,catalog:T,entry:O?{id:m,time:O.time,hash:O.hash,data:T}:void 0},a({catalog:o.catalog}))},useAntdLoader(m){p=m,r.id&&f(r.id,i)},state:s,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var zh=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})},Xh=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 _=>{const E=_;E.data=null,E.error=null;const m=g?_.clone():_,T=g?await m[g]().then(O=>(E.ok?E.data=O:E.error=O,E)).catch(O=>(E.error=O,E)):E;return a&&this.abortControllers.delete(a),T})}},Jh=l.createIdentifier$1("rest.v2.transport"),Ai=Symbol("rest.v2.secureRequest");function Qh(e){return e.getOrCreateInstance(Jh,()=>{const t=e.getInstance(l.CUSTOM_FETCH_ID)?.execute||fetch;return new Xh({baseUrl:"https://app.emailmaker.ru/api/v2",securityWorker:()=>({[Ai]:!0}),customFetch:(n,r={})=>{const{[Ai]:o,...s}=r;return t(n,{...s,[l.PUBLIC_REQUEST]:o!==!0})}})})}function Zh(e,t){const n=Qh(e);return Object.assign({},...t.map(r=>new r(n)))}function Di(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function Pi(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Di(n.details,"wp_code")??n.code,message:Di(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 Oi(e){return!e.ok||!!e.error}function em(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function Ri(){return em(l.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function tm(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function nm(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function rm(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:tm(r[1])}),t},[]):[]}function om(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:nm(n.updated_at),contentHash:n.content_hash}),t),[])}function ki(e){return Zh(e,[zh])}function zt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function fr(e){return!e.ok||e.error!=null}function pr(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function hr(e){return{data:await wi(e)??null}}async function sm(e){if(Ri())try{const n=await ki(e).localesList();return Oi(n)?{error:Pi(n)}:{data:om(n.data)}}catch(n){return zt(n)}const t=l.getApi(e,[po]);try{const n=await t.get_translations2({file:"react_app"});return fr(n)?pr(n):{data:rm(n.data)}}catch(n){return zt(n)}}async function im(e,t){if(Ri())try{const r=await ki(e).jsonList({locale:t});return Oi(r)?{error:Pi(r)}:hr(r.data)}catch(r){return zt(r)}const n=l.getApi(e,[po]);try{const r=await n.get_translations3({id:t,file:"react_app"});return fr(r)?pr(r):hr(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return fr(r)?pr(r):hr(r.data)}catch(r){return zt(r)}}}var Xt=new WeakMap;function am(e){const t=Xt.get(e);if(t!==void 0)return t;const n=sm(e).then(r=>("error"in r&&Xt.delete(e),r),r=>{throw Xt.delete(e),r});return Xt.set(e,n),n}var Xe=l.createIdentifier$1("locale.service");function lm(e){if(e.getInstance(Xe))return;const t=Kh({readList:()=>am(e),readCatalog:n=>im(e,n),askHost:async n=>(await ce(e,l.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(l.SECURITY_MODULE_ID)});e.inject(Xe,t),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function cm(e){const t=e.getInstance(l.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(Xe);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 dm="user_id",um="project_id",Ni=l.createIdentifier$1("rest.identityHeadersProvided");function fm(e){if(e.getInstance(Ni))return;e.inject(Ni,!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??ls(e).profile?.id;o!=null&&o!==""&&n.headers.set(dm,String(o));const s=t?.project;s!=null&&s!==""&&n.headers.set(um,String(s))}})}function pm(e){const t=e?.[""];return typeof t?.lang=="string"?t.lang:void 0}function hm(e){return e.id??pm(e.catalog)}function mm(e){if(e==="uk"||e.startsWith("uk_"))return"uk";const t=e.search(/[_-]/);return t>0?e.slice(0,t):e}function gm(e){return mm(e||"en_US")}var vm="Accept-Language",Li=l.createIdentifier$1("rest.localeHeaderProvided");function Em(e){e.getInstance(Li)||(e.inject(Li,!0),e.addService(l.REQUEST_HANDLER_ID,{execute(t){const n=e.getInstance(Xe)?.snapshot();t.headers.set(vm,gm(n&&hm(n)))}}))}function _m(e){if(!e)return!1;try{return e.getInstance(l.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var bm="Invalid standaloneKey.",Ab=l.createIdentifier$1("StandaloneMockGuard");function ym(){const e=new Error(bm);return e.name="InvalidStandaloneKeyError",e}function Sm(e){e.addService(l.REQUEST_HANDLER_ID,{execute:()=>{if(_m(e))throw ym()}})}function wm(e){l.registerRestTransport(e),Sm(e)}function Im(e){const t=new ks;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 Mi=dt("plugin.dataSource.blocks"),Tm=dt("plugin.dataSource.blockRevisions"),Cm=dt("plugin.dataSource.comments"),Am=Bt(),Dm=Bt(),xi=`<!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 Xh(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 Jh(e){return!Object.keys(e).some(t=>Ii.has(t))}function Qh(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 W_(e){}function qt(e){return typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,"block")&&!Object.prototype.hasOwnProperty.call(e,"email")}function Zh(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 ct(e){return{emails:si(e),blocks:Si(e),emailRevisions:ii(e),blocksRevision:Wh(e),comments:qh(e)}}function em(e){const t=Object.values(ct(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function Kt(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(Jh(e))return{email:Ti(e)};{const{showOptions:n,misplacedEmailFields:r}=Qh(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 cr(e){const t=Ae(e);return t&&Q(t.sessionKey())?t.suspendedDocument():t?.current()}function zt(e){return cr(e)?.getContent()}function Ci(e,t){const n=t??Xh(),r=cr(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:zt(e)??n.html}:n}async function dt(e){return(await e.getInstanceAsync(l.APP_ID))?.project}async function Ai(e){return rr(e)??await dt(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(qt(e)){const n=typeof e.block=="string"?e.block:e.block.id;return n==null?void 0:`block:${n}`}const t=Kt(e,!1).email.id;return t==null?void 0:String(t)}function tm(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function nm(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}var Oi=new WeakMap;function rm(e,t){const n=(Oi.get(e)??Promise.resolve()).then(t,t);return Oi.set(e,n.catch(()=>{})),n}function qe({code:e,project:t,...n},r){const o=ge(n),s=rr(r),i=Oe(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 ue({html:e,renderGuid:t,showToken:n,showId:r,...o},s){const{requested:i}=lt(s),a=Jo(s);return ge({...o,code:Oe(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 dr(e){return e==null?"":e.replaceAll(`\r
2150
+ </html>`;function Pm(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:xi,project:e?.id,project_title:e?.title??"",utm_parameters:{utm_source:"",utm_medium:"",utm_campaign:"",utm_term:"",utm_content:""},parent_email:null,common_styles:"{}",title:"",emailtags:[],isAmp:!1}}var Fi=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function Om(e){return!Object.keys(e).some(t=>Fi.has(t))}function Rm(e){const t={},n={};for(const[r,o]of Object.entries(e))Fi.has(r)?t[r]=o:n[r]=o;return{showOptions:t,misplacedEmailFields:n}}function Bi(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function Db(e){}function Jt(e){return typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,"block")&&!Object.prototype.hasOwnProperty.call(e,"email")}function km(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 ft(e){return{emails:Ei(e),blocks:Mi(e),emailRevisions:_i(e),blocksRevision:Tm(e),comments:Cm(e)}}function Nm(e){const t=Object.values(ft(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function Qt(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(Om(e))return{email:Bi(e)};{const{showOptions:n,misplacedEmailFields:r}=Rm(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:Bi({...r,...s})}}}function mr(e){const t=ke(e);return t&&ee(t.sessionKey())?t.suspendedDocument():t?.current()}function Zt(e){return mr(e)?.getContent()}function ji(e,t){const n=t??Pm(),r=mr(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:Zt(e)??n.html}:n}async function pt(e){return(await e.getInstanceAsync(l.APP_ID))?.project}async function Ui(e){return cr(e)??await pt(e)}async function Hi(e,t){const n=Mi(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 Ui(e),{filter:{id:t}})}function $i(e){if(!e)return;if(Jt(e)){const n=typeof e.block=="string"?e.block:e.block.id;return n==null?void 0:`block:${n}`}const t=Qt(e,!1).email.id;return t==null?void 0:String(t)}function Lm(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function Mm(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}var Vi=new WeakMap;function xm(e,t){const n=(Vi.get(e)??Promise.resolve()).then(t,t);return Vi.set(e,n.catch(()=>{})),n}function Je({code:e,project:t,...n},r){const o=be(n),s=cr(r),i=Ie(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 ge({html:e,renderGuid:t,showToken:n,showId:r,...o},s){const{requested:i}=ut(s),a=us(s);return be({...o,code:Ie(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,secretHash:void 0})}function gr(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,"&quot;")}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(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/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 cE({packageName:e="@emailmaker/emailmaker",version:t="1.2.0",log:n=r=>{}}={}){const r=o=>{try{const s=globalThis[Symbol.for(oE)],i=aE({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(lE({packageName:e,copies:i}))}catch{}};try{const o=pn()?.modules?.React;if(o&&typeof o.then=="function"){o.then(r,()=>{});return}r(o)}catch{}}async function dE(e,t,n){l.throwIfAborted(e.signal);const r=t??l.DependencyResolver.createChild();Sr(r);const o=r.getInstance(l.DISPOSABLE_ID);let s;async function i(){r.inject(l.COOKIE_MANAGER_ID,nE(new rE)),cE();const a=tE(r),c={...a.instance,container:r,get ready(){return s??Promise.resolve(c)},async reset(d){if(l.throwIfAborted(d.signal),o.isDisposed())throw _e();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 Gm(r),e.devTools)try{const d=r.getInstance(l.PLUGIN_COLLECTION_ID);d&&await(await ht()).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 gt=new WeakMap;function uE(e){return e?gt.get(e):void 0}function Da(e){try{e.getInstance(l.DISPOSABLE_ID)?.dispose()}catch{}try{e.dispose()}catch{}}function fE(e,t){if(!e)return;const n=gt.get(e);n&&n!==t&&Da(n),gt.set(e,t)}function pE(e,t){e&&gt.get(e)===t&&gt.delete(e)}function hE(e){const t=l.DependencyResolver.createChild();return st(e)&&t.inject(l.SECURITY_MODULE_ID,$t(e)),t}var vt=new WeakMap,mE="data-emailmaker-config-styles";function gE(e){return typeof e=="string"?e.trim():""}function Pa(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function vE(e,t,n){if(!e||typeof document>"u")return null;const r=gE(t),o=vt.get(e),s=n||e;if(!r)return o&&(o.remove(),vt.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(mE,"true"),i.textContent=r,Pa(s,i),vt.set(e,i),i}function EE(e){if(!e)return;const t=vt.get(e);t&&(t.remove(),vt.delete(e))}var J_=!1;function Oa(){return!1}var Q_=28,_E=`
2152
+ `)}function Gi(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function Fm(e,t,n,r){const o=Bm(e,t,n,r);return o===void 0}function Bm(e,t,n,r){if(Jt(t))return"block";const{email:o}=Qt(t,!1),s=Je(o,e),i=s.id;if(i===void 0)return"no-id";if(r!==void 0&&r!==i)return"other-id-shown";const a=ke(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=Gi(gr(n??a.getContent()));if(s.html!==void 0&&Gi(gr(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 Wi(e,t){if(Jt(t))return;const{email:n}=Qt(t,!1),r=Je(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:gr(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function jm(e){return Array.isArray(e)?e.some(t=>An(t)):An(e)}function Um(e){const t={...e};delete t.wpId,delete t.secretHash,delete t.projectCategories;for(const n of["author","folder","project"])jm(t[n])&&delete t[n];return t}function Hm(e,t){const n={...e};return delete n.id,{...n,...t}}function $m(e){return e.html?e:{...e,html:xi}}function Be({code:e,project:t,...n},r,o){const s=o??cr(r);return{...n,...e?{html:Ie(r).toEditorForm(e)}:{},renderGuid:l.generateUUID(),...s===void 0?{}:{project:s}}}function ue({html:e,renderGuid:t,...n},r){const{requested:o}=ut(r);return be({...n,code:Ie(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 Yi(e){return ke(e)?.current()?.get().serverId??void 0}function vr(e,t,n){return n===void 0&&(n=e.post===void 0?Yi(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function ht(e,t){return be({...e,link:void 0,comment_status:void 0})}function en({code:e,autosave:t,...n},r,o){return o===void 0&&(o=n.parent===void 0?Yi(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||qc(n.slug),parent:o}}function Er({html:e,isAutosave:t,...n},r){return be({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:be({html:e,ampHtml:e&&""})})}function tn({code:e,autosave:t,...n},r){return{...n,...e?{html:e}:{},isAutosave:t===!0,parent:r??n.parent}}function qi({html:e,isAutosave:t,...n}){return be({...n,autosave:t?!0:void 0,code:e,guid:void 0})}var Qe=l.createIdentifier$1("NotificationService"),Vm=l.createIdentifier$1("emailTemplate.reads");async function Gm(e,t){try{const n=Re(e);return await(n.template?n.template(e):n.email(e)).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,Ym(e,t,n);return}}var Wm=l.createIdentifier$1("emailTemplate.notifiedFailures");function Ym(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(Wm,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(Qe).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function qm(e,t){const n=e.getOrCreateInstance(Vm,()=>new Map),r=n.get(t);if(r!==void 0)return r;const o=Gm(e,t).then(s=>(s===void 0&&n.delete(t),s));return n.set(t,o),o}var _r="EXTERNAL",Ki=Symbol("supersededShow");function Km(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var zm="email_id";function br(e){return Object.entries(e).some(([t,n])=>t!=="id"&&n!==void 0)}async function Xm(e,t){const n=At();let r;try{return await Promise.race([e,new Promise((o,s)=>{r=setTimeout(()=>{e.then(t,()=>{}),s(new Dt(n,"handleSaveBlock","block"))},n)})])}finally{clearTimeout(r)}}var Jm=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=ft(t),this._eventLock=Nm(t);const n=K(e,l.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(K(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(zm,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(l.INIT_PIPELINE_ID)??Gn}_throwIfDestroyed(){if(this.isDisposed())throw we()}async getTemplateEmail(e){const t=await qm(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,Um(n)}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await pt(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,Be(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,en(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,vr(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 pt(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=Je(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=Hm(f,d))}return u===void 0&&(d=$m(d)),await i.setAll([[p,d]]),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==Wi(this._container,e))return!1;const n=Zt(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=Wi(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&&Lm({ticket:t,emailId:$i(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,Ki;if(!e)return;const n=this._getInitPipeline();if(l.throwIfAborted(n.signal),Jt(e))return this._showBlock(e,n);const r=ee(le(this._container).sessionKey()),o=Mm(e);if(!r&&!o&&Fm(this._container,e,Zt(this._container),this._prevCommand?.id)||!r&&!o&&this._isRepeatOfLastShow(e))return;const s=Qt(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:_,blocks:E,autosaves:m,comments:T,templateId:O,reload:U}=s;i=_.id;const x=Je(_,this._container),D=x.id,w=D??l.generateUUID(),C=await Oe("getProject",pt(this._container));l.throwIfAborted(n.signal),a=l.generateUUID();const y={isNew:D===void 0,id:String(w),project:C},N=U===!0&&D!==void 0;N&&(await this._dataSources.emails.remove(String(D),{silent:!0}),String(D)),c=++this._showToken,String(w);const j=[];j.push(this.setBlocks(E)),_.id!==void 0&&(j.push(this.setComments(T)),j.push(this.setEmailRevisions(m,String(_.id)))),j.push(this.setEmail(_,An(O)?O:Number(O),D===void 0?String(w):void 0,c,a)),await Oe("setEmail+blocks+revisions",Promise.all(j),{emailId:D??String(w),showId:a,targetShowToken:c}),l.throwIfAborted(n.signal);const S=await this._dataSources.emails.get(String(w)),I=le(this._container),k={id:a,token:c};if(r){Gt(this._container);const b=I.suspendedDocument()?.get().serverId;!N&&D!==void 0&&b!=null&&String(b)===String(D)&&I.resumeSuspended()}D===void 0?f=I.startNewDraft(S??x,{patch:x,show:k}):N?f=I.reload(D,{email:S??x,patch:x,show:k}):I.sessionKey()===Ve(D)?f=I.show(x,k):f=I.open(D,{email:S??x,patch:x,show:k}),I.beginShowFill(a);const M=!!this._prevCommand&&l.deepEqual(this._prevCommand,y);y.id,!this._prevCommand||l.deepEqual(this._prevCommand,y),this._prevCommand?.id,this._rememberShow(y),p=n.requestShow({showId:a,navId:String(w),emailId:D,isNew:D===void 0}),g=!0;const v=()=>I.endShowFill(a);Promise.allSettled([p,f.whenReady()]).then(v),String(w),d=!0}catch(_){u=_,g&&a&&n.failShow(a,_),a&&ke(this._container)?.endShowFill(a),l.isAbortError(_)||(So(_),void 0)}finally{this._eventLock.resumeChange()}if(!d)throw u instanceof Error?u:new Error(`[emailmaker] show() setup failed: ${String(u??"unknown error")}`);return Oe("show-init-deferred",Promise.all([p,f?.whenReady().catch(_=>{if(_ instanceof Pe){const E=Ln(_);throw E?new Error(`[emailmaker] show(): email open failed (${E})`,{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}=km(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=le(this._container);if(!i&&d!==void 0&&u.sessionKey()===Rt(d)){const O=br(n)?await this._storeShownBlock(n):void 0,U={id:a,token:++this._showToken},x=u.show(O,U),D=t.requestShow({showId:a,navId:d,emailId:void 0,isNew:!1});c=!0,await Oe("show-block-init",Promise.all([D,x?.whenReady().catch(()=>{})]),{showId:a});return}const p=r||i?await Hi(this._container,String(n.id)):void 0,f=p&&(i||br(n))?await this._storeShownBlock({...ue(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(O=>O.id!==void 0).map(O=>[O.id,tn(O,String(f.id))])),this._prevCommand=void 0,this._lastShow=void 0;const g=f.id!==void 0?String(f.id):l.generateUUID(),_={id:a,token:++this._showToken};Gt(this._container);const E=i?u.reloadBlock(g,f,_):u.openBlock(g,f,_);f.id;const m=t.requestShow({showId:a,navId:g,emailId:void 0,isNew:f.id===void 0});c=!0;const T=E.whenReady().catch(O=>{if(O instanceof Pe)throw O});await Oe("show-block-init",Promise.all([m,T]),{showId:a})}catch(d){throw c&&t.failShow(a,d),d}}async _storeShownBlock(e){const t=Be(e,this._container,await pt(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=le(this._container);if(ee(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:_r,fallbackTitle:gs(this._container)});if(l.throwIfAborted(e.signal),!n)throw Km(t.emailSaveState().error);return ge(ji(this._container,this._currentEmail),this._container)}async _saveBlock(){this._throwIfDestroyed();const e=le(this._container),t=e.current();if(!t||!ee(e.sessionKey()))throw new Error("[emailmaker] saveBlock(): no open block");return xm(t,async()=>{await t.whenReady();const n=Vt(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 Xm(t.get().serverId==null?s.create(o,{source:_r}):s.update(String(t.get().serverId),o,{source:_r}),a=>{a&&le(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),ue(i,this._container)})}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;this._latestShowEmailId=$i(e);const n=this._queuedShow(e,t).then(r=>r===Ki?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=le(this._container);if(n!==void 0&&r.sessionKey()===Rt(n))return;const o=t.code===void 0&&n!==void 0?await Hi(this._container,n):void 0,s=o&&br(t)?await this._storeShownBlock({...ue(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`);Gt(this._container);const i=r.openBlockOver(s.id!==void 0?String(s.id):l.generateUUID(),s);s.id,r.hasSuspended(),ce(this._container,l.events.ON_BLOCK_OPEN_ID).fire({block:s}),await i.whenReady().catch(a=>{if(a instanceof Pe)throw r.current()===i&&(ce(this._container,l.events.ON_BLOCK_CLOSE_ID).fire({block:s,hasUnsavedChanges:!1}),r.resumeSuspended()),a})}async _closeBlock(){this._throwIfDestroyed(),Hf(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 Qm(e){return String(e).replace(/"/g,"&quot;")}function Zm(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 eg(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 zi(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),o=Qm(n);return r.test(e)?e.replace(r,`${t}="${o}"`):e.replace(/>$/,` ${t}="${o}">`)}function tg(e,t,n){if(!e?.trim()||!t)return e;const r=eg(e);if(!r)return e;const o=String(t),s=Zm(n??new Date);let{full:i,index:a}=r;const c=i.length;return/\bem-block-id\s*=/.test(i)||(i=zi(i,"em-block-id",o)),i=zi(i,"em-block-version",s),e.slice(0,a)+i+e.slice(a+c)}function ng(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 rg(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:ng(e)}}function yr(e,t){return t?rg(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var Xi=["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"],og=[...Xi,"html","id","project","password"],Pb=new Set(["html",...Xi,"global_block","project"]);function sg(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(og),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 ig(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...sg(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 Sr=new WeakMap;function ag(e){let t=Sr.get(e);return t||(t={byId:new Map,fallback:[]},Sr.set(e,t)),t}function lg(e){Sr.delete(e)}function cg(e,t){const{byId:n,fallback:r}=ag(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 dg(e,t){const{blocks:n}=ft(e);return await n.cache.getIfPresent(t)??void 0}async function ug(e,t){if(!t.blockId)return;const n=await dg(e,t.blockId);if(n)return ig(n,t)}async function fg(e,t){const n=cg(e,t);if(n)return yr(e,n);const r=await ug(t,e);return r?yr(e,r):yr(e,void 0)}var pg=l.createIdentifier("application_block_inserted"),hg=-1e3,Ji=new WeakSet;function mg(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 gg(e){if(!e||Ji.has(e))return;Ji.add(e);const t=new l.Disposable,n=se(e);return t.addDisposable(n.addListenerAsyncPipe(pg,async(r,o)=>{const s=mg(r)?await fg(r,e):r;return o?o(s):s},hg)),t.addDisposable({dispose:()=>{lg(e)}}),t}var vg=Bt("plugin.readBlockAutosave"),Ob=l.createIdentifier$1("blockDocuments.provided"),Qi=l.createIdentifier$1("plugin.earlyWindow");function Eg(e){return e.getOrCreateInstance(Qi,()=>({depth:0}))}function _g(e){const t=Eg(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function Zi(e){return(e?.getInstance(Qi)?.depth??0)>0}function ea(e,t){let n,r=!1;return e(o=>{n=o,r=!0}),(o,s,i)=>{const a=e(o,s,i);if(r&&Zi(t)){const c=n;queueMicrotask(()=>{o.call(i,c)})}return a}}var wr=100,bg=class extends l.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=gg(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:o,blocksRevision:s}=ft(e),i=K(e,l.events.ON_SHARE_ID),a=K(e,l.events.ON_SHOW_PREVIEW_ID),c=K(e,l.events.ON_EMAIL_CLONE_ID),d=K(e,l.events.ON_BLOCK_OPEN_ID),u=K(e,l.events.ON_BLOCK_CLOSE_ID),p=K(e,l.events.ON_BLOCK_CLONE_ID),f=K(e,l.events.ON_BLOCK_INIT_ID),g=K(e,l.events.ON_BLOCK_CHANGED_ID),_=K(e,l.events.ON_CODE_VALIDATE_ID),E=K(e,l.events.ON_IMPORT_VALIDATE_ID),m=K(e,l.events.ON_SUBJECT_CHANGED_ID),T=K(e,l.events.ON_EMAIL_CHANGED_ID),O=K(e,l.events.ON_PREHEADER_CHANGED_ID),U=K(e,l.events.ON_SAVEBUTTON_CLICK_ID),x=K(e,l.events.ON_BLOCK_SAVEBUTTON_CLICK_ID),D=K(e,l.events.ON_NEXTBUTTON_CLICK_ID),w=K(e,l.events.ON_SEND_LIVEPREVIEW_ID),C=K(e,l.events.ON_SEND_TESTEMAIL_ID),y=K(e,Dm),N=K(e,l.events.ON_CONTENT_CHANGED_ID),j=K(e,Am),S=K(e,l.events.ON_PREVIOUSBUTTON_CLICK_ID),I=K(e,l.events.ON_SEND_EMAIL_MODAL_ID),k=l.filter(K(e,l.events.ON_EMAIL_INIT_ID),v=>!v.reset),M=K(e,l.events.ON_ANALYTICS_EVENT);return{handlePreheaderChanged:W(O),handleSubjectChanged:W(m),handleValidate:W(_),handleImportValidate:W(E),handleReadEmail:W(n.handlerRead,v=>v,v=>v&&Je(v,e)),handleSaveEmail:W(n.onSave,function({prev:v,patch:b,value:B,source:G}){const h=v?ge(v,e):void 0;return{prev:h,patch:ct(h,ge(b,e)),value:ge(B,e),source:G}},v=>v?Je(v,e):void 0),handleRemoveEmail:W(n.onRemove,({value:v,source:b})=>({value:ge(v,e),source:b}),()=>{}),handleReadCommonBlocks:W(y,v=>v.project,v=>v?.map(b=>Be(b,e))),handleReadTemplateBlocks:W(j,v=>v,v=>v?.map(b=>Be(b,e))),handleReadBlocks:W(t.byForeignKey("project").handleRead,v=>ut(e).requested||String(v),v=>v?.map(b=>Be(b,e))),handleReadBlock:W(t.handlerRead,v=>v,v=>v?Be(v,e):void 0),handleOpenBlock:W(d,({block:v})=>({block:ue(v,e)})),handleCloseBlock:W(u,({block:v,hasUnsavedChanges:b})=>({block:ue(v,e),hasUnsavedChanges:b})),handleCloneBlock:W(p,v=>ue(v,e)),handleSaveBlock:W(t.onSave,function({prev:v,patch:b,value:B,source:G}){const h=B.global_block===!0&&B.id&&typeof B.html=="string"?{...B,html:tg(B.html,String(B.id))}:B,P=v?ue(v,e):void 0;return{prev:P,patch:ct(P,ue(b,e)),value:ue(h,e),source:G}},v=>v?Be(v,e):void 0),handleRemoveBlock:W(t.onRemove,({value:v,source:b})=>({value:ue(v,e),source:b}),()=>{}),handleReadComments:W(r.byForeignKey("post").handleRead,v=>v,v=>v?.map(b=>vr(b,e))),handleSaveComment:W(r.onSave,function({prev:v,patch:b,value:B,source:G}){const h=v?ht(v,e):void 0;return{prev:h,patch:ct(h,ht(b,e)),value:ht(B,e),source:G}},v=>v?vr(v,e):void 0),handleRemoveComment:W(r.onRemove,({value:v,source:b})=>({value:ht(v,e),source:b}),()=>{}),handleReadEmailRevisions:W(o.byForeignKey("parent").handleRead,v=>v,v=>v?.map(b=>en(b,e))),handleReadEmailAutosave:W(K(e,bi),v=>v,v=>v?en(v,e):null),handleEmailAutosave:W(o.onSave,function({prev:v,patch:b,value:B,source:G}){return{value:Er(B,e),source:G}},v=>v?en(v,e):void 0),handleRemoveEmailAutoSave:W(o.onRemove,({value:v,source:b})=>({value:Er(v,e),source:b}),()=>{}),handleReadBlockRevisions:W(s.byForeignKey("parent").handleRead,v=>v,v=>v?.map(b=>tn(b))),handleReadBlockAutosave:W(K(e,vg),v=>v,v=>v?tn(v):null),handleBlockAutosave:W(s.onSave,({value:v,source:b})=>({value:qi(v),source:b}),v=>v?tn(v):void 0),handleRemoveBlockAutoSave:W(s.onRemove,({value:v,source:b})=>({value:qi(v),source:b}),()=>{}),handleBlockInit:W(f,v=>ue(v,e)),handleBlockChanged:W(l.debounce(g,wr),v=>ue(v,e)),handleEmailChanged:W(l.debounce(T,wr),v=>ge(v,e)),handleEmailInit:ea(W(k,v=>ge(v,e)),e),handlePreviousButtonClick:W(S,v=>ge(v,e)),handleNextButtonClick:W(D,v=>ge(v,e)),handleSaveButtonClick:W(U,v=>ge(v,e)),handleSaveBlockButtonClick:W(x,v=>ue(v,e)),handleHtmlChanged:W(l.debounce(N,wr)),handleTestEmailSend:W(C,({html:v,...b})=>({...b,code:v,compiled:{html:v,ampHtml:""}})),handleTestEmailModal:W(I,v=>ge(v,e)),handleCloneEmail:W(c,v=>ge(v,e)),handleShareEmail:W(i),handlePreviewEmail:W(a),handleLivePreviewEmail:W(w),handleAnalyticsEvent:W(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 ze(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},yg=l.createIdentifier$1("DataController"),Sg=l.createIdentifier$1("DataEvents");function ta(e){return e.getOrCreateInstance(yg,()=>{const t=new Jm(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function na(e){return e.getOrCreateInstance(Sg,()=>new bg(e))}var wg=l.createIdentifier$1("plugin.pluginStart");function ra(e){return e.getOrCreateInstance(wg,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t()),{done:n,finish:t}})}function Ig(e){return ra(e).done}function Tg(e){const t=ra(e);return t.run===void 0&&(t.run=(e.getInstance(l.PLUGIN_COLLECTION_ID)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var Cg=l.createIdentifier$1("plugin.startupShow");function Ag(e){const t=ta(e),n=na(e),r=e.getInstance(l.OPTIONS_SOURCE_ID),o=e.getInstance(l.DISPOSABLE_ID),s={current:Promise.resolve()};e.inject(Cg,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=()=>(Z(ae.showStart),t.show(d).finally(()=>Z(ae.showEnd))),p=i?Ig(e).then(u):u();p.catch(()=>{}),s.current=p});a&&o?.addDisposable(a),c&&o?.addDisposable(c)}function Dg(e){const t=ta(e);return{...na(e).get(),show(n){return Z(ae.showStart),t.show(n).finally(()=>Z(ae.showEnd))},openBlock(n){return t.openBlock(n)},closeBlock(){return t.closeBlock()},showBlock(n,r){return Z(ae.showStart),t.showBlock(n,r).finally(()=>Z(ae.showEnd))},save(){return t.save()},saveBlock(){return t.saveBlock()}}}function oa(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function nn(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 Pg(e){return(t,n,r)=>nn(t)?e(t,n,r):!1}function Og(e){return t=>nn(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function Rg(e){return(t,n,r)=>nn(t)?oa(t)?e(t,n,r):t:!1}function kg(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return nn(n)?oa(n)?e(t):t:!1}}function Ng(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function Ir(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 Lg(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 Mg=8,xg=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=Lg(Mg),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},rn=new xg;function sa(e,t){return t!==void 0&&!Ir(e,t)?`%|{${rn.getOrCreateByKey(e)}}|%`:e}function Fg(e){const t=rn.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function ne(e,t,n){return t!==void 0?Ir(e,t)?e:`%|{${rn.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function Bg(e){return e.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}function te(e){return e.startsWith("<!--")&&e.endsWith("-->")?Bg(e.slice(4,-3)):e}function jg(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 Ug(e,t,n){return t!==void 0?Ir(e,t)?e:`%|{${rn.getOrCreateByKey(e)}}|%`:n||Ng(e)||jg(e)?`<!--${e}-->`:e}var je=Pg(ne),Ue=Og(te),Hg=Rg(ne),$g=kg(te),ia=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",Fg),e.escape("@{","}",ne,!0).unescape("<!--@{","}-->",te,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",sa,!0),e.escape("{{","}}",sa,!0),e.createSyntax("brace-percent").escape("{%","%}",ne).unescape("<!--{%","%}-->",te),e.createSyntax("brace-hash").escape("{#","#}",ne).unescape("<!--{#","#}-->",te),e.createSyntax("proscript").escape("[%","%]",Ug,!0).unescape("<!--[%","%]-->",te,!0),e.createSyntax("getresponse").escape("[[IF","]]",ne).escape("[[if","]]",ne).escape("[[ELSE]]","",ne).escape("[[else]]","",ne).escape("[[ENDIF]]","",ne).escape("[[endif]]","",ne).unescape("<!--[[IF","]]-->",te).unescape("<!--[[if","]]-->",te).unescape("<!--[[ELSE]]","-->",te).unescape("<!--[[else]]","-->",te).unescape("<!--[[ENDIF]]","-->",te).unescape("<!--[[endif]]","-->",te),e.createSyntax("expert-sender").escape("<if",">",ne).escape("</if",">",ne).escape("<else",">",ne).escape("</else",">",ne).escape("<var ",">",ne,!0).unescape("<!--<if ",">-->",te).unescape("<!--</if",">-->",te).unescape("<!--<else ",">-->",te).unescape("<!--</else",">-->",te).unescape("<!--<var",">-->",te,!0),e.createSyntax("velocity").escape("#if",")",je).escape("#elseif",")",je).escape("#else","",ne).escape("#foreach",")",je).escape("#macro",")",je).escape("#set",")",Hg,!0).escape("#parse",")",je).escape("#include",")",je).escape("#evaluate",")",je).escape("#end","",ne).escape("#break","",ne).escape("#stop","",ne).unescape("<!--#macro","-->",Ue).unescape("<!--#if","-->",Ue).unescape("<!--#elseif","-->",Ue).unescape("<!--#else","-->",te).unescape("<!--#foreach","-->",Ue).unescape("<!--#parse","-->",Ue).unescape("<!--#include","-->",Ue).unescape("<!--#evaluate","-->",Ue).unescape("<!--#end","-->",te).unescape("<!--#break","-->",te).unescape("<!--#stop","-->",te).unescape("<!--#set","-->",$g,!0),e.createSyntax("mailchimp").escape("*|","|*",ne).unescape("<!--*|","|*-->",te)},Tr="bare",Vg=new Map;function Gg(e){return e?Vg.get(e)??Tr:Tr}var aa=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function la(e){return aa.includes(e)}function mt(e){return e==="bare"||e==="html-comment"}function Cr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Wg(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!mt(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&&!mt(u))return t(`templateDirectives.${d}: unknown form "${String(u)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!Cr(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(!(!la(d)||u===void 0||mt(u))){if(!Cr(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&&!mt(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??Tr;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(!la(d)){t(`templateDirectives.syntaxes: unknown syntax id "${d}", entry ignored.`);continue}i.push(d)}else i.push(...aa);const a={},c={};for(const d of i){const u=r.syntaxes?.[d],p=Cr(u)?u:void 0,f=(mt(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 ca(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 gt(e,t){return e.start<t.end&&t.start<e.end}function da(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:_}of s){if(r?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):ca(e,d,u.start,c),d=u.end,a.some(O=>gt(O,u)))continue;const E=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,m=e.substring(u.start,u.end),T=p(m,E,c.insideTag);T!==!1&&T!==m&&(i.push({range:u,text:T,overrideBuiltins:f,syntax:g,isVariable:_}),a.push(u))}return i.sort((u,p)=>u.range.start-p.range.start||u.range.end-p.range.end)}function Yg(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 Ar(e,t,n,r,o=!1){const s=[];if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return s;const i=Yg(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='"'):ca(e,c,u,a),c=u;const g=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let _=!1;for(const{mapFn:E,value:m,syntax:T,isVariable:O}of f){let U=u+p.length,x=e.indexOf(m,U);for(;x!==-1;){let D=x,w=u+p.length,C=0;for(;D!==-1;){const I=e.indexOf(p,w);if(I!==-1&&I<D)C++,w=I+p.length,D=e.indexOf(m,w);else if(C>0)C--,w=D+m.length,D=e.indexOf(m,w);else break}if(D<0)break;const y=D+m.length,N=e.substring(u,y),j=E(N,g,a.insideTag);if(j===!1){U=x+Math.max(m.length,1),x=e.indexOf(m,U);continue}(o||j!==N)&&s.push({range:{start:u,end:y},text:o?N:j,syntax:T,isVariable:O});const S=i.findIndex(({start:I})=>I>=y);S>d?d=S-1:d=i.length,_=!0;break}if(_)break}}return s}function on(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 qg=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=ia){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=Ar(e,this._escapes,t,n),o=da(e,this._escapeMatchers,t,n),s=o.filter(c=>c.overrideBuiltins).map(c=>c.range),i=r.filter(c=>!s.some(d=>gt(d,c.range))),a=o.filter(c=>c.overrideBuiltins||!i.some(d=>gt(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=Ar(e,this._unescapes,t),r=da(e,this._unescapeMatchers,t,!1),o=r.filter(a=>a.overrideBuiltins).map(a=>a.range),s=n.filter(a=>!o.some(c=>gt(c,a.range))),i=r.filter(a=>a.overrideBuiltins||!s.some(c=>gt(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=>Gg(o)==="html-comment";return this._collectRevertMappings(e,t).filter(o=>o.isVariable||!r(o.syntax))}getDetectedMappings(e,t,n){return Ar(e,this._escapes,t,n,!0)}getEscapedText(e,t){return on(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return on(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=s=>s===void 0?void 0:t[s],r=Object.values(t);let o=e;return r.includes("bare")&&(o=on(o,this._collectRevertMappings(o).filter(s=>n(s.syntax)==="bare"))),r.includes("html-comment")&&(o=on(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()}},ua="em___script",vt=`<${ua}`,Dr=`</${ua}>`;function fa(e){return e.replace("<script",vt).replace("<\/script>",Dr)}var pa=new qg(e=>{e.escape("<script","<\/script>",t=>fa(t)).unescape(vt,Dr,t=>t.replace(vt,"<script").replace(Dr,"<\/script>")),e.escape("<script","/>",t=>fa(t)).unescape(vt,"/>",t=>t.replace(vt,"<script")),ia(e)});function Kg(e){const t=Wg(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return Do();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=>pa.normalizeToPolicy(o,t.editor),toOutputForm:o=>pa.normalizeToPolicy(o,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:Ao(r)}}function zg(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:Kg(n)}),t.policy})}function Rb(e){return e}var Xg=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Jg(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 Qg(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 ha(e){const t=Jg(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 Xg([...o.slice(c),a].map(d=>d.name))}s.add(a),o.push(a);for(const c of Qg(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 Zg=[{name:"rest.client",setup:wm},{name:"auth.oauth",setup:l.provideOAuth},{name:"rest.identityHeaders",setup:fm},{name:"rest.localeHeader",setup:Em},{name:"lifetime.destroyable",provides:[ar],setup:ph},{name:"appInit",provides:[l.APP_ID,_n],setup:Ul},{name:"config",provides:[l.CONFIG_SOURCE_ID],setup:uh},{name:"templateDirectives",provides:[l.TEMPLATE_DIRECTIVES_ID],setup:zg},{name:"email.documents",setup:kh},{name:"show.initPipeline",provides:[l.INIT_PIPELINE_ID],setup:Im},{name:"show",setup:Ag},{name:"locale.service",provides:[Xe],setup:lm},{name:"locale.fromConfig",awaits:{services:[l.CONFIG_SOURCE_ID,Xe]},setup:cm},{name:"canvas.early",setup:ip},{name:"canvas.previewSettings",setup:Sp},{name:"canvas.sandboxExtensions",setup:Ip},{name:"canvas.sandboxScriptRelay",setup:Ap},{name:"canvas.headerSync",provides:[Qn],setup:cp},{name:"canvas.headersAfterRecovery",setup:dp},{name:"canvas.ampSync",setup:ou},{name:"canvas.moduleBridge",setup:Mu},{name:"canvas.port",setup:hu},{name:"canvas.images",setup:fu},{name:"canvas.edits",setup:op},{name:"canvas.surfaceFollowsSession",setup:Vf},{name:"canvas.blockContent",setup:$f},{name:"canvas.sandboxFill",provides:[Xn],setup:Wp},{name:"canvas.reactions",setup:sp}],ma;function Pr(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=de();e.inject(l.OPTIONS_SOURCE_ID,n),ma??=ha(Zg);for(const r of ma)r.setup(e);return n}function ev(e){}var tv=[{name:"save.previewFollow",setup:ev}],ga=l.createIdentifier$1("plugin.lateUnitsInstalled");function nv(e){if(!e.getInstance(ga)){e.inject(ga,!0);for(const t of ha(tv))t.setup(e)}}function rv(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function ov(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 sv=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=ov(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(rv(d,p)))}catch{}}}});function iv(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 av=l.defineMixin(e=>{let t,n=!1;return{setOptions(r){const o=n;if(n=!0,!lt(r)){t&&(Zp(e),ir(r)),t=void 0;return}const s=Yt(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&&iv(e,i)}}}),lv=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=l.getEvent(e,l.APP_LOAD_EVENT_ID),r=W(n),o=t.addDisposable(new ze(r));return{setOptions({handleLoad:s}){o.setListener(s)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function va(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]=va(r[s]||{},i,!0):r[s]=i)}return e}async function cv(e){const t=(await ul.__vitePreload(()=>Promise.resolve().then(()=>Promise.resolve(Tt("./static/umd/3f12d6ff.js")).then(n=>hn.__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 Ea=l.createIdentifier$1("EditorOptions"),Or=l.MONACO_EDITOR_OPTIONS;function dv(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 uv(e){return e.getOrCreateInstance(Ea,()=>{const t=de(Or);let n=Or.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(cv(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function fv(e){return e?.getInstance(Ea)?.get()??Or}function pv(e,t={}){const n=uv(e);n.set(va({...n.get()},dv(t)))}function hv(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 mv(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var gv=l.createIdentifier$1("plugin.publicConfig");function Rr(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function _a(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function ba(e){const t=ri(e),n=Rr(e);return{...n,locale:n.locale||"ru_RU",theme:n.theme||"light",editor:mv(fv(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function ya(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()!==void 0}function vv(e){const t=l.createQueue(),n=ce(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(),ho(e).set(Rr(e).revisionService===!0);const{codeModeDirection:f,editor:g}=Rr(e);g&&pv(e,hv(g)),f!==void 0&&!(p&&f===o)&&(o=f,f==="none"?tr(e,!1):(tr(e,!0),vp(e,f)))},c=async()=>{if(!ya(e))return;const p=ba(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:_a(e).advancedConfigs,serverSide:await i(),user:p};f?.setAdvancedConfigs({...g.advancedConfigs,...g.user?.advancedConfigs});const _=f?.layers().user.mode;f?.replace(g.user?.mode===void 0&&_!==void 0?{...g.user,mode:_}:g.user,"user"),f?.replace(g.serverSide,"server"),await a(),await c()},u=p=>{const{commonStyles:f,...g}=p;return"commonStyles"in p&&_p(e,f===void 0?void 0:f),g};return{queue:t,reactToConfig:a,emitConfigChanged:c,resolveServerSideConfig:i,getConfig:()=>ya(e)?ba(e):{},setConfig:t.decorate(async p=>{await d(u(p))}),updateConfig:t.decorate(async p=>{const f=u(p);await d({..._a(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 Sa(e){return e.getOrCreateInstance(gv,()=>vv(e))}function Ev(e){const t=Sa(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var _v=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=W(n.event),i=W(r.event),a=ea(W(o.event),e),c=t.addDisposable(new ze(s)),d=t.addDisposable(new ze(i)),u=t.addDisposable(new ze(a));return{instance:{handleSetOptions:s,handleOptionsChanged:i,handleConfigChanged:a},async setOptions(p){c.setListener(p.handleSetOptions),d.setListener(p.handleOptionsChanged),u.setListener(p.handleConfigChanged),Sa(e).announceAssembled(),await n.fire(p),await r.fire(p)},dispose(){}}}),kr,wa="core";function bv(){const e=__emailmaker__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([wa],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function yv(e){const t=__emailmaker__?.require?.warm;return typeof t!="function"?Et().then(()=>{}):t([wa],e)}function Et(){return kr===void 0&&(kr=bv().then(e=>(et()&&e.installDiagnostics().catch(t=>{}),e))),kr}var Nr=null,Lr=null;async function Sv(e){typeof e?.prefetch=="function"&&await e.prefetch()}function Mr(){return Nr||(Nr=Et().then(()=>{})),Nr}function Ia(e){return Lr||(Lr=Sv(e)),Lr}function wv(){return Ia(typeof __emailmaker__<"u"?__emailmaker__:void 0)}function Iv(){const e=typeof __emailmaker__<"u"?__emailmaker__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function Tv(e){return Promise.all([Mr(),Ia(e)]).then(()=>{})}function Cv(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function Ta(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>yv(t?{priority:t}:void 0)).then(()=>($n(t?{priority:t}:void 0),n?Mr():void 0)).catch(()=>{})}function Av(e){const t=Cv(e);if(t==="eager")Ta(e);else if(t==="idle"){const n=()=>Ta(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var Ca="PluginRegistry";function Dv(e=l.resolveContainer()){return e.getOrCreateInstance(Ca,()=>new _l)}var Aa=new bl(()=>Dv()),Pv=["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"],Ov=["closeBlock","compileEmail","getBlockSnapshot","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","openBlock","save","saveBlock","setConfig","show","showBlock","updateConfig","useAsync","validateCode","waitPlugin"],sn=new Map([...Pv.map(e=>[e,"event"]),...Ov.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),Rv=new Map([["use","use `useAsync()` or await `ready` first"]]);function kv(e){return Rv.get(e)??"await `ready` first"}var Nv=new Set(["async","queued"]),Lv=Symbol.for("emailmaker.earlyCtxPlaceholder");function Da(e){return e[Lv]=!0,e}function Mv(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 (${kv(e)}).`)}function xv(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function Fv(e){return[...sn].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function Bv(e,t){for(const n of Fv(e)){const r=sn.get(n);if(r!==void 0&&Nv.has(r)){const o=async(...s)=>{await t;const i=e[n];if(typeof i!="function"||i===o)throw xv(n);return i.apply(e,s)};e[n]=Da(o);continue}e[n]=Da(()=>{throw Mv(n)})}}function jv(e,t,n){e.getInstanceAsync(Qe).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function Uv(e,t){e.getInstanceAsync(Qe).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 Hv=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(Ca);if(!t){t=new El(s,i,{ensureHostRuntimeReady:wv,explainScriptFailure:Iv,openEarlyWindow:()=>_g(e),reportLoadFailure:d=>Uv(e,d)}),e.inject(l.PLUGIN_COLLECTION_ID,t);const c=t.onLifecycle(d=>{d.type==="create:error"&&jv(e,d.name,d.error)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(c)}const a=o?.plugins||[];s&&(ds(e),a.length>0&&Bv(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}}}),Pa=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}},$v=l.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),Vv=l.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),Gv="application_block_inserted",Wv=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Vv,()=>new Pa).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(Gv,o,t)}},xr=l.createIdentifier$1("ComponentRegistry"),Yv=l.createIdentifier$1("ComponentRegistryGate");function Fr(){return l.DependencyResolver.getOrCreateInstance(Yv,()=>({pending:[]}))}function qv(e=xr){return Fr().factory!==void 0||l.DependencyResolver.getInstance(e)!==void 0}function Br(e,t,n=xr){if(qv(n)){t(an(e,n));return}Fr().pending.push(()=>t(an(e,n)))}function an(e,t=xr){const n=l.DependencyResolver.getInstance(t);if(n)return n;const r=Fr().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 Kv=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=an(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=an(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($v,()=>new Pa).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)}},zv=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 Xv(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function Oa(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 Jv=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 Br(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:Oa(r,n)})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;Br(this._container,r=>{this._updateModalEmitter.fire(Xv({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:Oa(r,n)}))})}};function ln(e){return e?.surfaces?{surfaces:[...e.surfaces]}:{}}var Qv=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)}},Zv=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 Qv(t,n);return r}registerSandboxCSS(e,t){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{...ln(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,{...ln(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,{...ln(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,{...ln(n),type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,r)}},eE=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function jr(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&eE.has(t)}function Ra(){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 Ur(){return`__settingsPanel:${Ra()}`}function Hr(e,t){return{type:e,props:t}}function tE(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!jr(e)}function ka(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(jr(t)){const r=Ur();return n(e.add(r,t)),Hr(r,{})}if(typeof t=="function"){const r=Ur();return n(e.add(r,t)),Hr(r,{})}if(tE(t)){const r=t.type;if(typeof r=="string")return t;if(jr(r)||typeof r=="function"){const o=Ur();return n(e.add(o,r)),Hr(o,t.props)}return t}return t}var nE=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??Ra();Br(this._container,n=>{const r=i=>this._trackRegistration(i),o=ka(n,e.content,r),s=e.advancedTabs?.map(i=>({...i,content:ka(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)}},Na={SandboxScriptApi:Zv,ElementsApi:Kv,BlocksApi:Wv,MessageService:zv,SettingsPanelApi:nE,ModalApi:Jv};function $r(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 ve={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}},rE={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"},Vr={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},La={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:ve.border,borderRadius:ve.borderRadius,textAlign:"center",padding:ve.padding},Ma={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:ve.padding},Gr={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:ve.border,borderRadius:ve.borderRadiusCards};function oE(e){return{...rE,...e}}function sE(e){return{...Vr,...e,bold:e?.bold??Vr.bold,italic:e?.italic??Vr.italic}}function iE(e){return{...La,...e,underline:e?.underline??La.underline}}function aE(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 lE(e){return{...Ma,...e,padding:{...Ma.padding,...e?.padding}}}function cE(e){return{...Gr,...e,border:{...Gr.border,...e?.border},borderRadius:{...Gr.borderRadius,...e?.borderRadius}}}function Wr(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 xa(e){let t={...l.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Yr(e){return{text:oE(e.text),headings:sE(e.headings),links:iE(e.links),buttons:aE(e.buttons),block:lE(e.block),cards:cE(e.cards)}}var Fa=l.createIdentifier$1("EmailSettingsPort"),dE=1e4,Ba=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(!Zi(this._editor.container)||!$e(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(Fa);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return Wr(this._settings().read())}_getCurrentContentStyles(){const e=$e(this._editor.container)?.current()?.get().attributes.common_styles;return Yr(xa(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(Fa),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=Wr(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=Yr(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=Wr(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=dE){const t=$e(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=$e(this._editor.container)?.current();if(!t)return;const n=xa(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=$r(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:ve.border,borderRadius:ve.borderRadius,padding:ve.padding})),e.block!==void 0&&(n.block=$r(n.block||{},e.block,["padding"],{padding:ve.padding})),e.cards!==void 0&&(n.cards=$r(n.cards||{},e.cards,["border","borderRadius"],{border:ve.border,borderRadius:ve.borderRadiusCards}));const r=JSON.stringify(n);We(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const o=Yr(n);this._prevContentSnapshot=this._getContentSnapshot(o),this._contentStylesChanged.fire(o)}},uE={...Na,EmailSettingsApi:Ba},fE={...Na},kb={...fE,EmailSettingsApi:Ba},pE={...uE};function hE(){Aa.addAll(pE)}var mE=[l.defineMixin(()=>{hE()}),lv,_v,av,l.JWTMixin,sv,l.OAuthMixin];async function gE(){return(await Et()).asyncMixins}var vE=Hv,EE=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let o;try{o=await gE()}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}}},_E=l.combineMixins([...mE]);function qr(){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 bE(e){const t=qr(),n=qr(),r=qr();return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(Qe).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(Qe);if(s){s.notify(o);return}e.getInstanceAsync(Qe).then(i=>i.notify(o),()=>{})}}}var ja=l.createIdentifier$1("CodeErrors"),yE=[];function SE(e){return e?.getInstance(ja)?.get()??yE}function wE(e){return e?.getInstance(ja)!==void 0}var IE=class extends l.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=ft(e),this.addDisposable(l.getEvent(e,l.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){const e=ke(this._container);if(e&&ee(e.sessionKey())&&!e.hasSuspended())throw new Error("[emailmaker] no open email: only a block is shown");return ji(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=>ue(t,this._container))}async _readProjectBlocks(){const e=await Ui(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=>ht(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=>Er(n,this._container))}async getEmailSnapshot(){return ge(this.openEmail(),this._container)}async getBlockSnapshot(){const e=ke(this._container),t=e?.current();return!e||!t||!ee(e.sessionKey())?null:(await t.whenReady(),ue(Vt(t),this._container))}setEmailMeta(e){const t=mr(this._container);if(!t)return;const n=t.get().attributes.meta;We(t,{meta:qt({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,o=>o&&qt(o,e))}setBlockMeta(e,t){const n=ke(this._container);if(n?.sessionKey()===Rt(e)){const o=n.current();o&&We(o,{meta:qt({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&&qt(s,t))};this._blockMetaWrites=this._blockMetaWrites.then(r).catch(()=>{})}getCodeErrors(){return wE(this._container)?SE(this._container):void 0}},TE=l.createIdentifier$1("EmailDataController");function CE(e){return e.getOrCreateInstance(TE,()=>{const t=new IE(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function AE(e){const t=CE(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 DE(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 PE(e){let t;const n=gi(e),r=l.getEvent(e,l.events.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:s})=>{t=s}));const o=()=>t?DE(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 OE=l.createIdentifier$1("plugin.mountElement");function RE(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 kE(e){return e.getOrCreateInstance(OE,()=>{let t=!1,n;return{get:()=>t?n:RE(e),set(r){t=!0,n=r}}})}function NE(e){const t=kE(e);return{getElement:()=>t.get()}}function LE(e){return{handleLoadImage:W(l.getEvent(e,l.events.UPLOAD_EVENT_ID)),handleFileProxy:W(l.getEvent(e,l.events.FILE_PROXY_EVENT_ID)),handleUrlProxy:W(l.getEvent(e,l.events.PROXY_URL_EVENT_ID)),handleAITextRequest:W(l.getEvent(e,l.events.AI_TEXT_REQUEST_ID)),handleAIImageRequest:W(l.getEvent(e,l.events.AI_IMAGE_REQUEST_ID)),handleReadLocale:W(l.getEvent(e,l.events.READ_LOCALE)),handleLimitUsage:W(l.getEvent(e,l.events.ON_LIMIT_ID)),handleTranslate:W(l.getEvent(e,l.events.ON_TRANSLATE_ID))}}var ME=[hh,Dg,bE,Ev,AE,PE,NE,LE];function xE(e,t=ME){const n=Pr(e);nv(e);const r=_E(e),o=vE(e),s=EE(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 FE(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 BE=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]}},jE="editor-runtime.react.copies",Kr=8;function _t(e){return e&&typeof e=="object"?e:void 0}function Ua(e){const t=_t(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=_t(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function UE(e){const t=_t(e),n=t&&typeof t.version=="string"?t.version:void 0,r=_t(t?.default),o=r&&typeof r.version=="string"?r.version:void 0;return n??o??"unknown"}function HE(e,t,n){return e.package===t&&e.version===n}function $E({ourReact:e,entries:t,packageName:n,version:r}){const o=Ua(e);if(!o||!Array.isArray(t))return[];const s=[],i=new Set;for(const a of t){const c=_t(a);if(!c||!HE(c,n,r))continue;const d=Ua(c.react);!d||d===o||i.has(d)||(i.add(d),s.push({package:n,version:r,reactVersion:UE(c.react),react:c.react}))}return s}function VE({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,Kr))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Kr&&n.push(` …and ${t.length-Kr} 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 Ha=new Set;function GE({packageName:e="@emailmaker/emailmaker",version:t="1.2.5",log:n=r=>{}}={}){const r=o=>{try{const s=globalThis[Symbol.for(jE)],i=$E({ourReact:o,entries:s,packageName:e,version:t}).filter(a=>!Ha.has(a.react));if(!i.length)return;i.forEach(a=>Ha.add(a.react)),n(VE({packageName:e,copies:i}))}catch{}};try{const o=vn()?.modules?.React;if(o&&typeof o.then=="function"){o.then(r,()=>{});return}r(o)}catch{}}async function WE(e,t,n){l.throwIfAborted(e.signal);const r=t??l.DependencyResolver.createChild();Pr(r);const o=r.getInstance(l.DISPOSABLE_ID);let s;async function i(){r.inject(l.COOKIE_MANAGER_ID,FE(new BE)),GE();const a=xE(r),c={...a.instance,container:r,get ready(){return s??Promise.resolve(c)},async reset(d){if(l.throwIfAborted(d.signal),o.isDisposed())throw we();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 Tg(r),e.devTools)try{const d=r.getInstance(l.PLUGIN_COLLECTION_ID);d&&await(await Et()).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 bt=new WeakMap;function YE(e){return e?bt.get(e):void 0}function $a(e){try{e.getInstance(l.DISPOSABLE_ID)?.dispose()}catch{}try{e.dispose()}catch{}}function qE(e,t){if(!e)return;const n=bt.get(e);n&&n!==t&&$a(n),bt.set(e,t)}function KE(e,t){e&&bt.get(e)===t&&bt.delete(e)}function zE(e){const t=l.DependencyResolver.createChild();return lt(e)&&t.inject(l.SECURITY_MODULE_ID,Yt(e)),t}var yt=new WeakMap,XE="data-emailmaker-config-styles";function JE(e){return typeof e=="string"?e.trim():""}function Va(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function QE(e,t,n){if(!e||typeof document>"u")return null;const r=JE(t),o=yt.get(e),s=n||e;if(!r)return o&&(o.remove(),yt.delete(e)),null;if(o)return o.textContent!==r&&(o.textContent=r),(o.parentNode!==s||o!==s.firstChild)&&Va(s,o),o;const i=document.createElement("style");return i.setAttribute(XE,"true"),i.textContent=r,Va(s,i),yt.set(e,i),i}function ZE(e){if(!e)return;const t=yt.get(e);t&&(t.remove(),yt.delete(e))}var Nb=!1;function Ga(){return!1}var Lb=28,e_=`
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 t_(){return()=>{}}function n_(e,t){if(!Ga()||!e||typeof document>"u")return t_();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 r_(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function o_({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)),r_(c)||t.delete(o),c});return t.set(o,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var zr=o_();function Wa(){zr.clear()}l.setApiOriginFailoverHook(()=>zr.clear());var Ya=new WeakMap;function Xr(e){return l.resolveExplicitApiBaseUrl(e)}function s_(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function i_(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function a_(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 Jr=new WeakMap;function Qr(e,t){Jr.set(e,t)}function l_(e){return Jr.get(e)}function c_(e,t){return async({baseUrl:n})=>{const r=t(),o=r&&Jr.get(r)||e,s=Xr(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 a_(o);if(o.getAuthToken&&!a)throw i_();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:ir(o)||void 0});if(!c.ok)throw s_(c.status,c.statusText);return await c.json()}}function d_(e){return JSON.stringify({baseUrl:Xr(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function u_(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function f_(e){return t=>zr.run(d_(t),()=>(Z("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>Z("appInit:end",{kind:"network"}))))}function p_(e,t){if(lt(e)||!e.appInit&&!Xr(e.baseUrl)||!u_(e))return e;const n=e.appInit??c_(e,t);let r=Ya.get(n);return r||(r=f_(n),Ya.set(n,r)),{...e,appInit:r}}var qa=0;function h_(){return qa}function m_(){qa+=1,Wa()}var Ka=new WeakMap,za=new WeakMap,g_=3e4;function v_(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function E_(e,t){try{const n=l.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+g_}function __(e){const t=new Map,n=new Map;return async(r,o,s)=>{const i=v_(r,o);if(s)return n.delete(i),t.delete(i),Wa(),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&&(Z("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:E_(u,Date.now())}),d}).finally(()=>{Z("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function b_(e){if(lt(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Ka.get(t);const r=h_();return(!n||za.get(t)!==r)&&(n=__(t),Ka.set(t,n),za.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(o=>{}),{...e,getAuthToken:n}}var y_="[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 S_(e){const t=new Error(y_,{cause:e});return t.name="EditorStartFailedError",t}var w_={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 Ja=["handleLoad","handleDestroy"];function Qa(e,t){let n=e;for(const r of Ja){const o=e?.[r];typeof o=="function"&&(n={...n,[r]:(s,...i)=>o(t,...i)})}return n}function I_(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,B)=>{u=b,p=B});f.catch(()=>{});const g={},_=b=>t?.[b],E=()=>r??we(),m=(b,B)=>{const G=_(b);if(typeof G!="function")throw Xa(b);return G.apply(t,B)},T=(b,B)=>{try{return Promise.resolve(m(b,B))}catch(G){return Promise.reject(G)}},O=()=>{const b=t?.container?.getInstance?.(l.DISPOSABLE_ID);if(!(n!=="ready"||b?.isDisposed()||typeof _("getConfig")!="function"))try{i=m("getConfig",[])}catch{}},U=()=>n==="dead"?Promise.reject(E()):n==="ready"?Promise.resolve():f,x=()=>{for(const[b,B]of sn)B==="field"&&(g[b]=_(b))},D=b=>{const B=_(b.name);b.dispose||typeof B!="function"||n==="dead"||(b.dispose=B.apply(t,b.args))},w=()=>a.forEach(D),C=()=>{for(const b of a){try{b.dispose?.()}catch{}b.dispose=void 0}},y=()=>{x(),w()},N=()=>{s?.delete(y),s=void 0},j=(b,B)=>{const[G,...h]=B;return!Ja.includes(b)||typeof G!="function"?B:[(P,...H)=>G(g,...H),...h]},S=(b,B)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof _(b)!="function")throw Xa(b);const G={name:b,args:j(b,B)};return a.add(G),D(G),()=>{a.delete(G),G.dispose?.(),G.dispose=void 0}},I=()=>t?.container?.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.content,k=()=>{const b=e.element();return b!==void 0&&typeof b!="string"?b:void 0},M=(b,B)=>{switch(B){case"event":return(...G)=>S(b,G);case"async":return(...G)=>(b==="show"&&G[0]!==void 0&&e.shown?.(G[0]),n!=="dead"&&typeof _(b)=="function"?T(b,G):U().then(()=>m(b,G)));case"queued":return(...G)=>{if(n==="dead"){if(b==="notify")return;throw E()}if(n==="pending"){c.push({name:b,args:G});return}return m(b,G)};case"sync":return(...G)=>{if(n==="dead"){if(b==="getConfig")return i;throw E()}if(typeof _(b)!="function")throw new Error(`[emailmaker] \`${b}\` is not available before the editor is ready: ${w_[b]??"await `ready` first"}`);const h=m(b,G);return b==="getConfig"&&(i=h),h};case"element":return()=>{if(typeof _(b)!="function")return k();try{return m(b,[])}catch{return k()}};case"codeErrors":return()=>n==="ready"&&typeof _(b)=="function"?m(b,[]):[];case"field":return}};for(const[b,B]of sn)g[b]=M(b,B);g.reset=b=>(b?.content!==void 0&&e.shown?.(b.content),U().then(async()=>{const B=b?.content!==void 0&&l.deepEqual(b.content,I());await m("reset",[Qa(b,v)]),B&&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(B=>B(b)),O(),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||(C(),N(),t=b,x(),w(),n==="pending"&&(s=b.container.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),s.add(y)))},settle:()=>{if(n==="pending"){n="ready",N(),x(),w();for(const b of c.splice(0))try{m(b.name,b.args)}catch(B){queueMicrotask(()=>{throw B})}u()}},kill:(b,B)=>{n!=="dead"&&(O(),n="dead",r=b,c.length=0,d.forEach(G=>G(b)),N(),B?.keepSubscriptions||(C(),a.clear()),p(b))},detach:()=>{C(),a.clear()},setReady:b=>{o=b},trackCall:b=>(d.add(b),()=>d.delete(b)),hasCalls:()=>d.size>0}}var Zr="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function T_(){return l.createAbortError(Zr)}function Za(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Zr}function C_(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 A_(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 C_(n,()=>{n.id,s.abort(T_())},o),l.composeAbortSignals(r,s.signal)}var eo="Superseded by newer init() on the same mount element";function el(){return l.createAbortError(eo)}function tl(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===eo}var St=new Map,nl=new WeakMap,cn=new WeakMap;function D_(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function P_(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=D_(e);(n?St.get(n):void 0)?.forEach(u=>{u.element!==e&&u.controller.abort(el())});const r=nl.get(e)??new Set;t&&r.forEach(u=>{u.supersedable&&u.controller.abort(el())});const o=cn.get(e)??Promise.resolve();let s;const i=new Promise(u=>{s=u}),a=o.then(()=>i);cn.set(e,a),a.then(()=>{cn.get(e)===a&&cn.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),nl.set(e,r),n){const u=St.get(n)??new Set;u.add(d),St.set(n,u)}return{signal:c.signal,previous:o,release:()=>{s(),r.delete(d);const u=n?St.get(n):void 0;n&&u?.delete(d)&&u.size===0&&St.delete(n)}}}var wt=new WeakMap;function to(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function no(e){return Object.entries(e).filter(([t,n])=>to(t,n)).map(([t])=>t).sort()}function rl(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!to(n,r)&&(t[n]=r);return t}function ro(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:wt.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},wt.set(e,r));const{current:o,trampolines:s}=r;o.clear();const i={...t};for(const a of no(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 ol(e,t){const n=e?wt.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const o=t[r];to(r,o)?n.current.set(r,o):n.current.delete(r)}}function O_(e){const t=e?wt.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 R_(e,t,n){const r=e?wt.get(e):void 0;if(!r||!n)return!1;const o=no(t),s=l.deepEqual(o,no(r.lastOptions)),i=o.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!s||!i||!l.deepEqual(rl(t),rl(r.lastOptions))?!1:(ro(e,t),!0)}var _e=new WeakMap,Mb=0;function dn(e){let t=_e.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},_e.set(e,t)),t}var Ce=e=>e!==void 0&&e.state!=="dead";function k_(e){const t=_e.get(e)?.shared;return Ce(t)?t:void 0}function N_(e,t){dn(e).shared=t}function L_(e,t){!(Ce(e.shared)&&[...e.counted].some(Ce))||e.warned||!t.devTools||(e.warned=!0)}function M_(e,t,n,r){const o=dn(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&&Ce(s)),t],L_(o,r),o.latestCall}function x_(e,t){return _e.get(e)?.latestCall===t}function F_(e){const t=_e.get(e);if(t)return t.order=t.order.filter(Ce),t.order.at(-1)?.object}function It(e,t){const n=_e.get(e);return n?Ce(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&Ce(r)):!1}function B_(e,t){const n=_e.get(e),r=n?.order.filter(o=>o!==t&&Ce(o)).at(-1);return r?n?.options.get(r):void 0}function sl(e,t){dn(e).content={value:t}}function j_(e){return _e.get(e)?.content}function U_(e,t,n,r){const o=dn(e);if(o.counted.delete(t),o.options.delete(t),It(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),o.leaving.add(t),il(e,r)}function il(e,t){const n=_e.get(e);!n||It(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!It(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function H_(e,t){const n=_e.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);_e.delete(e)}}var $_=hn.__exportAll({FileManagerApiError:()=>V_,IntegratorSaveTimeoutError:()=>Dt,SaveRefusedError:()=>De}),V_=class dl 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,dl)}},G_=hn.__exportAll({mapHttpStatusToErrorCode:()=>l.mapHttpStatusToErrorCode});function W_(e,t){return{...e,element:t}}function oo(){return()=>{}}function Y_(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?oo():(QE(t,e.config?.styles,t),()=>{ZE(t)})}function q_(e){if(!Ga()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:oo()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:oo()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(o=>{o.remove()});const n=n_(t,"data-emailmaker"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function K_(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function un(e){try{e.destroy()}catch{}}function fn(e,...t){const n=l.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&l.ELEMENT_MAP.delete(e)}var z_="1.2.5";async function X_(e){$n(),await Tv(typeof __emailmaker__<"u"?__emailmaker__:void 0)}async function J_(e){return al(e).ready}function Q_(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function Z_(e){const t=l.ELEMENT_MAP.get(e);return t&&!(t instanceof Promise)?t:void 0}function pn(e,t,n){const r=t??Z_(e);r&&(fn(e,r),un(r)),H_(e,n)}function eb(e){const{control:t,mode:n,ref:r}=e,o=r.host;if(!o){const i=t.editor;tb(i),t.kill(we());return}if(n==="single"){pn(o,t.editor,we());return}const s=B_(o,t);U_(o,t,we(),()=>pn(o,t.editor,we())),s&&It(o)&&ol(o,s)}function tb(e){e&&un(e)}function al(e){Z(ae.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=l.composeAbortSignals(e.signal,n.signal),o=t==="single"?Q_(e.element):void 0,s=o?k_(o):void 0;let i;if(s)i={control:s,mode:t,ref:{host:o}};else{const u={},p=I_({element:()=>u.host??e.element,destroy:()=>eb(i),shown:f=>{u.host&&sl(u.host,f)}});i={control:p,mode:t,ref:u},o&&N_(o,p)}const{control:a}=i,c=a.trackCall(u=>n.abort(u)),d=ab(Qa({...e,signal:r},a.object),i).then(()=>(c(),Z(ae.initEnd),a.settle(),a.object),u=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(u);const p=i.ref.host;throw p&&il(p,()=>pn(p,void 0,we())),u});return a.setReady(d),a.object}function nb(e){const t=typeof e=="string"?document.querySelector(e):e;return t?F_(t):void 0}function rb(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=$e(e.container)?.current();r=o!==void 0&&o.get().savedVersion!==null&&o.isDirty()}catch{t=void 0}return{options:t,signal:n,email:ob(e),dirty:r}}async function ob(e){try{return await e.getEmailSnapshot()}catch{return}}function sb(e){const t=$e(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function ll(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||It(e,n)}async function ib(e,t,n,r,o){if(r.mode==="counted"&&r.control.detach(),tl(o)||Za(o))return;const s=()=>pn(t,e,S_(o)),{options:i}=n;if(!i||!ll(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&&sb(e),ll(t,r)?l.ELEMENT_MAP.set(t,e):s()}catch{s()}}async function ab(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=M_(c,t.control,t.mode,e));const d=A_({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),u=P_(c,{supersede:t.mode==="single"});r=u.release;const p=l.composeAbortSignals(d,u.signal);l.throwIfAborted(p),s=O_(c),ol(c,e),await l.raceWithAbortSignal(u.previous,p),o=lb(e,c,t,p,s);const f=await l.raceWithAbortSignal(o,p);return c&&e.content!==void 0&&sl(c,e.content),f}catch(c){throw i&&s&&x_(i,a)&&s(),c}finally{const c=r;o!==void 0&&c?o.then(c,c):c?.(),n.dispose()}}async function cl(e,t,n,r){const o=j_(t);n===void 0||r||!o||l.deepEqual(n,o.value)||await e.show(n)}async function lb(e,t,n,r,o){const{control:s}=n,i=E=>s.bind(E);l.throwIfAborted(r);let a;const c=E=>{m_();const m=b_(W_(E,t)),T=p_(m,()=>a);return{preparedOptions:T,preparedOptionsWithSignal:r!=null?{...T,signal:r}:T}};let d;if(t){const E=l.ELEMENT_MAP.get(t);if(E){let m;try{m=await E,l.throwIfAborted(r)}catch{l.throwIfAborted(r),fn(t,E),m=void 0}if(m)if(m.getElement()===t){const T=YE(t);a=T;const O=m.container.getInstance(l.OPTIONS_SOURCE_ID)?.get();if(R_(t,e,O))return i(m),r&&m.container.getInstance(l.INIT_PIPELINE_ID)?.relinkExternalSignal(r),l.ELEMENT_MAP.set(t,m),await cl(m,t,e.content,!1),m;const U=!l.deepEqual(e.content,O?.content);d=c(ro(t,e));const{preparedOptions:x,preparedOptionsWithSignal:D}=d,w=T&&l_(T),C=rb(m);try{T&&Qr(T,x),i(m);const y=await m.reset(K_(e,D));return l.throwIfAborted(r),l.ELEMENT_MAP.set(t,m),await cl(m,t,e.content,U),y}catch(y){if(T&&w&&Qr(T,w),!Ml(y))throw o(),await ib(m,t,C,n,y),y;fn(t,E,m),un(m),l.throwIfAborted(r)}}else fn(t,E,m),un(m)}}l.throwIfAborted(r),d??=c(ro(t,e,{fresh:!0}));const{preparedOptions:u}=d,p=Y_(u),f=q_(u),g=r!=null?{...f.options,signal:r}:f.options;let _;try{a=zE(g),qE(t,a),Qr(a,u),Pr(a).set(g),await Mr(),Z(ae.coreReady),l.throwIfAborted(r),l.throwIfAborted(r),_=WE(g,a,{onInstance:i}),t&&l.ELEMENT_MAP.set(t,_);const E=await _;if(r?.aborted&&(E.destroy(),l.throwIfAborted(r)),t)if(l.ELEMENT_MAP.get(t)===_)l.ELEMENT_MAP.set(t,E);else throw E.destroy(),l.throwIfAborted(r),l.createAbortError(r?.reason);return E}catch(E){throw p(),f.cleanup(),a&&($a(a),KE(t,a)),t&&_&&l.ELEMENT_MAP.get(t)===_&&l.ELEMENT_MAP.delete(t),E}}async function cb(e){return(await Et()).parseAMP(e)}typeof window<"u"&&(et()&&Nl(),Av(typeof __emailmaker__<"u"?__emailmaker__:void 0)),pe.ELEMENT_DETACHED_ABORT_MESSAGE=Zr,pe.SUPERSEDED_INIT_ABORT_MESSAGE=eo,pe.create=al,Object.defineProperty(pe,"errors",{enumerable:!0,get:function(){return $_}}),pe.getInstance=nb,Object.defineProperty(pe,"helpers",{enumerable:!0,get:function(){return G_}}),pe.init=J_,pe.isElementDetachedError=Za,pe.isSupersededInitError=tl,pe.parseAMP=cb,pe.pluginRegistry=Aa,pe.preload=X_,pe.version=z_});
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/29b3ccef.js":[],"static/core/2e70fae0.js":["static/core/ec5f739e.js","__delivery__/libs"],"static/core/370f04c3.js":[],"static/core/43a8b244.js":[],"static/core/44fac8d4.js":[],"static/core/4797d4f7.js":[],"static/core/5c4239d8.js":[],"static/core/64c27f91.js":["static/core/5c4239d8.js"],"static/core/6933d533.js":[],"static/core/727a165f.js":[],"static/core/7452d34b.js":[],"static/core/76d1f317.js":[],"static/core/790366d3.js":["static/core/ec5f739e.js","static/core/e88db487.js","__delivery__/libs"],"static/core/7be64bf5.js":[],"static/core/7d006e7b.js":[],"static/core/83d2ca5d.js":["static/core/a2c7aeb0.js","__delivery__/libs"],"static/core/8a5b1c18.js":[],"static/core/8b89090c.js":[],"static/core/8bf56b5b.js":[],"static/core/8da91a53.js":["static/core/a2c7aeb0.js","__delivery__/libs"],"static/core/99c15a5d.js":["static/core/db685f4e.js"],"static/core/9f7e0f94.js":["static/core/ec5f739e.js","static/core/2e70fae0.js","static/core/b7dee12b.js","static/core/e7bbe544.js","__delivery__/libs"],"static/core/a2c7aeb0.js":["__delivery__/libs"],"static/core/a8cb6e27.js":[],"static/core/a9235d9e.js":[],"static/core/abcacabc.js":[],"static/core/b27aec0b.js":[],"static/core/b712bb05.js":["static/core/e88db487.js"],"static/core/b74171bd.js":["static/core/5c4239d8.js"],"static/core/b7dee12b.js":["static/core/ec5f739e.js","__delivery__/libs"],"static/core/bbb87124.js":["static/core/db685f4e.js","static/core/5c4239d8.js","static/core/b74171bd.js"],"static/core/c5713f94.js":[],"static/core/ccb090eb.js":["static/core/370f04c3.js","__delivery__/libs","monaco"],"static/core/d0b845c8.js":[],"static/core/db685f4e.js":[],"static/core/e15ab856.js":[],"static/core/e7bbe544.js":["static/core/83d2ca5d.js","__delivery__/libs"],"static/core/e88db487.js":[],"static/core/ec5f739e.js":["static/core/a8cb6e27.js","static/core/e88db487.js","__delivery__/libs"],"static/core/f2ced98d.js":["static/core/2e70fae0.js","static/core/83d2ca5d.js","__delivery__/libs","static/core/ec5f739e.js"],"static/core/f54ef492.js":[],"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/3a37cbb5.js":[],"static/umd/3f12d6ff.js":["static/umd/790cf6cb.js"],"static/umd/790cf6cb.js":[],"static/umd/b3ebeaee.js":[]},"bundles":{"static/core/83d2ca5d.js":["static/core/66d55956.js","static/core/bc1a9bce.js","static/core/ca683630.js"],"static/core/99c15a5d.js":["static/core/a54d9b28.js"],"static/core/790366d3.js":["static/core/74d00db4.js"],"static/core/e7bbe544.js":["static/core/61378c9e.js"],"static/core/f2ced98d.js":["static/core/73d746bd.js"],"core":["static/core/5dc34752.js","static/core/2462bf5f.js","static/core/f33f0316.js","static/core/64a89155.js","static/core/b65ac970.js"]}});
2189
+ __emailmaker__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/155e871a.js":["static/core/e7fa68c2.js","__delivery__/libs"],"static/core/15ea858c.js":[],"static/core/17fba7af.js":[],"static/core/2a042fe3.js":[],"static/core/32a14159.js":[],"static/core/370f04c3.js":[],"static/core/43a8b244.js":[],"static/core/4797d4f7.js":[],"static/core/4de9c323.js":["static/core/5b6e2acb.js"],"static/core/50ba806c.js":["static/core/a8cb6e27.js","static/core/e88db487.js","__delivery__/libs"],"static/core/5b6e2acb.js":[],"static/core/63e7f8c1.js":["static/core/c03be019.js","static/core/e7fa68c2.js","__delivery__/libs","static/core/50ba806c.js"],"static/core/64711257.js":["static/core/50ba806c.js","static/core/e88db487.js","__delivery__/libs"],"static/core/659796a7.js":[],"static/core/683a6a53.js":["static/core/7e167222.js"],"static/core/6933d533.js":[],"static/core/6b16159c.js":[],"static/core/7452d34b.js":[],"static/core/76d1f317.js":[],"static/core/7e167222.js":[],"static/core/82f8beb4.js":[],"static/core/8a5b1c18.js":[],"static/core/8bf56b5b.js":[],"static/core/987afc3f.js":["__delivery__/libs"],"static/core/9eaed676.js":[],"static/core/a8b4352d.js":["static/core/50ba806c.js","static/core/c03be019.js","static/core/b7289065.js","static/core/155e871a.js","__delivery__/libs"],"static/core/a8cb6e27.js":[],"static/core/abcacabc.js":[],"static/core/b712bb05.js":["static/core/e88db487.js"],"static/core/b7289065.js":["static/core/50ba806c.js","__delivery__/libs"],"static/core/b96e571d.js":["static/core/987afc3f.js","__delivery__/libs"],"static/core/c03be019.js":["static/core/50ba806c.js","__delivery__/libs"],"static/core/c3d00c5e.js":[],"static/core/c67df236.js":[],"static/core/c8443fab.js":[],"static/core/d0b845c8.js":[],"static/core/d2780737.js":["static/core/7e167222.js"],"static/core/d503c406.js":["static/core/5b6e2acb.js","static/core/7e167222.js","static/core/683a6a53.js"],"static/core/dd230bbb.js":[],"static/core/e7fa68c2.js":["static/core/987afc3f.js","__delivery__/libs"],"static/core/e88db487.js":[],"static/core/f35181ec.js":["static/core/370f04c3.js","__delivery__/libs","monaco"],"static/monaco/editor.api-DqgksfDR.js":[],"monaco":["static/monaco/editor.api-DqgksfDR.js","static/monaco/lspLanguageFeatures-BnvITcKb.js"],"static/monaco/lspLanguageFeatures-BnvITcKb.js":["static/monaco/editor.api-DqgksfDR.js"],"emailmaker.js":[],"static/umd/3f12d6ff.js":["static/umd/790cf6cb.js"],"static/umd/512f983c.js":[],"static/umd/790cf6cb.js":[],"static/umd/b3ebeaee.js":[]},"bundles":{"static/core/e7fa68c2.js":["static/core/61d7e59b.js","static/core/425e50a8.js","static/core/b37ca4d7.js"],"static/core/4de9c323.js":["static/core/a54d9b28.js"],"static/core/64711257.js":["static/core/74d00db4.js"],"static/core/155e871a.js":["static/core/61378c9e.js"],"static/core/63e7f8c1.js":["static/core/17bec902.js"],"core":["static/core/5dc34752.js","static/core/ee980948.js","static/core/814472f3.js","static/core/2fab5a65.js","static/core/75bbe11f.js"]}});